From 899b332edf6fe37ba02d2a2f35ddd4aa64f6f55a Mon Sep 17 00:00:00 2001 From: Charles de Dreuille Date: Mon, 16 Jun 2025 23:49:58 +0100 Subject: [PATCH] Fix types Signed-off-by: Charles de Dreuille --- packages/canon/report.api.md | 22 ++++++++++--------- .../canon/src/components/FieldLabel/types.ts | 9 +++++--- .../src/components/TextField/TextField.tsx | 6 ++--- .../canon/src/components/TextField/types.ts | 8 +++---- 4 files changed, 25 insertions(+), 20 deletions(-) diff --git a/packages/canon/report.api.md b/packages/canon/report.api.md index 21304fdaa7..d11af005c7 100644 --- a/packages/canon/report.api.md +++ b/packages/canon/report.api.md @@ -25,7 +25,7 @@ import type { SwitchProps as SwitchProps_2 } from 'react-aria-components'; import { Table as Table_2 } from '@tanstack/react-table'; import { Tabs as Tabs_2 } from '@base-ui-components/react/tabs'; import { TdHTMLAttributes } from 'react'; -import type { TextFieldProps } from 'react-aria-components'; +import type { TextFieldProps as TextFieldProps_2 } from 'react-aria-components'; import { ThHTMLAttributes } from 'react'; import { Tooltip as Tooltip_2 } from '@base-ui-components/react/tooltip'; import type { useRender } from '@base-ui-components/react/use-render'; @@ -362,6 +362,8 @@ export const FieldLabel: ForwardRefExoticComponent< // @public (undocumented) export interface FieldLabelProps { description?: string | null; + htmlFor?: string; + id?: string; label?: string | null; secondaryLabel?: string | null; } @@ -420,14 +422,6 @@ export interface FlexProps extends SpaceProps { // @public (undocumented) export type FlexWrap = 'wrap' | 'nowrap' | 'wrap-reverse'; -// @public (undocumented) -export interface FormInputProps - extends Omit, - FieldLabelProps { - icon?: ReactNode; - size?: 'small' | 'medium' | Partial>; -} - // @public (undocumented) export const gapPropDefs: { gap: { @@ -1296,9 +1290,17 @@ export { Text_2 as Text }; // @public (undocumented) export const TextField: ForwardRefExoticComponent< - FormInputProps & RefAttributes + TextFieldProps & RefAttributes >; +// @public (undocumented) +export interface TextFieldProps + extends TextFieldProps_2, + Omit { + icon?: ReactNode; + size?: 'small' | 'medium' | Partial>; +} + // @public (undocumented) export interface TextProps extends Omit, 'color'> { diff --git a/packages/canon/src/components/FieldLabel/types.ts b/packages/canon/src/components/FieldLabel/types.ts index 38244f6fa8..dc4e444133 100644 --- a/packages/canon/src/components/FieldLabel/types.ts +++ b/packages/canon/src/components/FieldLabel/types.ts @@ -14,10 +14,8 @@ * limitations under the License. */ -import type { HTMLAttributes } from 'react'; - /** @public */ -export interface FieldLabelProps extends HTMLAttributes { +export interface FieldLabelProps { /** * The label of the text field */ @@ -37,4 +35,9 @@ export interface FieldLabelProps extends HTMLAttributes { * The HTML for attribute of the text field */ htmlFor?: string; + + /** + * The id of the text field + */ + id?: string; } diff --git a/packages/canon/src/components/TextField/TextField.tsx b/packages/canon/src/components/TextField/TextField.tsx index 88a80042ee..444e76e983 100644 --- a/packages/canon/src/components/TextField/TextField.tsx +++ b/packages/canon/src/components/TextField/TextField.tsx @@ -24,11 +24,11 @@ import { useResponsiveValue } from '../../hooks/useResponsiveValue'; import clsx from 'clsx'; import { FieldLabel } from '../FieldLabel'; -import type { FormInputProps } from './types'; +import type { TextFieldProps } from './types'; /** @public */ -export const TextField = forwardRef( - (props: FormInputProps, ref) => { +export const TextField = forwardRef( + (props, ref) => { const { className, icon, diff --git a/packages/canon/src/components/TextField/types.ts b/packages/canon/src/components/TextField/types.ts index 18cfa79f9e..92fa077389 100644 --- a/packages/canon/src/components/TextField/types.ts +++ b/packages/canon/src/components/TextField/types.ts @@ -14,15 +14,15 @@ * limitations under the License. */ -import type { TextFieldProps } from 'react-aria-components'; +import type { TextFieldProps as AriaTextFieldProps } from 'react-aria-components'; import { ReactNode } from 'react'; import type { Breakpoint } from '../../types'; import type { FieldLabelProps } from '../FieldLabel/types'; /** @public */ -export interface FormInputProps - extends Omit, - FieldLabelProps { +export interface TextFieldProps + extends AriaTextFieldProps, + Omit { /** * An icon to render before the input */