diff --git a/.changeset/wise-cobras-sink.md b/.changeset/wise-cobras-sink.md new file mode 100644 index 0000000000..7a6a73c726 --- /dev/null +++ b/.changeset/wise-cobras-sink.md @@ -0,0 +1,5 @@ +--- +'@backstage/canon': patch +--- + +Use the Field component from Base UI within the TextField. diff --git a/packages/canon/css/components.css b/packages/canon/css/components.css index 6496363868..1fc7f275c3 100644 --- a/packages/canon/css/components.css +++ b/packages/canon/css/components.css @@ -544,6 +544,7 @@ color: var(--canon-fg-primary); margin-bottom: var(--canon-space-1_5); cursor: pointer; + margin-right: auto; } .canon-TextFieldLabel[data-disabled] { diff --git a/packages/canon/css/styles.css b/packages/canon/css/styles.css index b2743220c7..3382c15675 100644 --- a/packages/canon/css/styles.css +++ b/packages/canon/css/styles.css @@ -9768,6 +9768,7 @@ color: var(--canon-fg-primary); margin-bottom: var(--canon-space-1_5); cursor: pointer; + margin-right: auto; } .canon-TextFieldLabel[data-disabled] { diff --git a/packages/canon/css/textfield.css b/packages/canon/css/textfield.css index 4caf7cb2e9..8315d48bc6 100644 --- a/packages/canon/css/textfield.css +++ b/packages/canon/css/textfield.css @@ -11,6 +11,7 @@ color: var(--canon-fg-primary); margin-bottom: var(--canon-space-1_5); cursor: pointer; + margin-right: auto; } .canon-TextFieldLabel[data-disabled] { diff --git a/packages/canon/src/components/TextField/TextField.styles.css b/packages/canon/src/components/TextField/TextField.styles.css index 7ee0a937dc..5acc8480f3 100644 --- a/packages/canon/src/components/TextField/TextField.styles.css +++ b/packages/canon/src/components/TextField/TextField.styles.css @@ -26,6 +26,7 @@ font-weight: var(--canon-font-weight-regular); color: var(--canon-fg-primary); margin-bottom: var(--canon-space-1_5); + margin-right: auto; cursor: pointer; } .canon-TextFieldLabel[data-disabled] { diff --git a/packages/canon/src/components/TextField/TextField.tsx b/packages/canon/src/components/TextField/TextField.tsx index db56463c3a..132d6ab1c6 100644 --- a/packages/canon/src/components/TextField/TextField.tsx +++ b/packages/canon/src/components/TextField/TextField.tsx @@ -14,8 +14,8 @@ * limitations under the License. */ -import { useId, forwardRef } from 'react'; -import { Input } from '@base-ui-components/react/input'; +import { Field } from '@base-ui-components/react/field'; +import { forwardRef } from 'react'; import { useResponsiveValue } from '../../hooks/useResponsiveValue'; import clsx from 'clsx'; @@ -39,56 +39,41 @@ export const TextField = forwardRef( // Get the responsive value for the variant const responsiveSize = useResponsiveValue(size); - // Generate unique IDs for accessibility - const inputId = useId(); - const descriptionId = useId(); - const errorId = useId(); - return ( -
{label && ( - + )} - {description && ( -

+ {description} -

+ )} {error && ( - + )} -
+ ); }, );