diff --git a/.changeset/whole-papers-retire.md b/.changeset/whole-papers-retire.md new file mode 100644 index 0000000000..1dc392317c --- /dev/null +++ b/.changeset/whole-papers-retire.md @@ -0,0 +1,5 @@ +--- +'@backstage/canon': minor +--- + +Added a new TextField component to replace the Field and Input component. After feedback, it became clear that we needed to build a more opinionated version to avoid any problem in the future. diff --git a/packages/canon/report.api.md b/packages/canon/report.api.md index e3d55339ea..600e4ba878 100644 --- a/packages/canon/report.api.md +++ b/packages/canon/report.api.md @@ -5,9 +5,7 @@ ```ts import { Context } from 'react'; import type { CSSProperties } from 'react'; -import { Field as Field_2 } from '@base-ui-components/react/field'; import { ForwardRefExoticComponent } from 'react'; -import { Input as Input_2 } from '@base-ui-components/react/input'; import { Menu as Menu_2 } from '@base-ui-components/react/menu'; import { default as React_2 } from 'react'; import * as React_3 from 'react'; @@ -245,36 +243,6 @@ export type EnumPropDef = { required?: boolean; }; -// @public (undocumented) -export const Field: { - Root: React_2.ForwardRefExoticComponent< - Omit, 'ref'> & - React_2.RefAttributes - >; - Label: React_2.ForwardRefExoticComponent< - Omit, 'ref'> & - React_2.RefAttributes - >; - Description: React_2.ForwardRefExoticComponent< - Omit< - Field_2.Description.Props & React_2.RefAttributes, - 'ref' - > & - React_2.RefAttributes - >; - Error: React_2.ForwardRefExoticComponent< - Omit, 'ref'> & - React_2.RefAttributes - >; - Validity: ({ - children, - className, - ...props - }: React_2.ComponentPropsWithoutRef & { - className?: string; - }) => React_2.JSX.Element; -}; - // @public (undocumented) export const Flex: ForwardRefExoticComponent< FlexProps & RefAttributes @@ -717,17 +685,6 @@ export interface IconProviderProps { // @public (undocumented) export const icons: IconMap; -// @public (undocumented) -export const Input: React_2.ForwardRefExoticComponent< - InputProps & React_2.RefAttributes ->; - -// @public (undocumented) -export interface InputProps extends Omit { - // (undocumented) - size?: 'sm' | 'md'; -} - // @public (undocumented) export type JustifyContent = | 'stretch' @@ -1067,6 +1024,35 @@ const Text_2: React_2.ForwardRefExoticComponent< >; export { Text_2 as Text }; +// @public (undocumented) +export const TextField: React_2.ForwardRefExoticComponent< + TextFieldProps & React_2.RefAttributes +>; + +// @public (undocumented) +export type TextFieldOwnProps = GetPropDefTypes; + +// @public (undocumented) +export const textFieldPropDefs: { + size: { + type: 'enum'; + values: ('small' | 'medium')[]; + className: string; + default: 'medium'; + responsive: true; + }; +}; + +// @public (undocumented) +export interface TextFieldProps + extends Omit, 'size'> { + className?: string; + description?: string; + label?: string; + name: string; + size?: TextFieldOwnProps['size']; +} + // @public (undocumented) export interface TextProps { // (undocumented) diff --git a/packages/canon/src/components/TextField/index.ts b/packages/canon/src/components/TextField/index.ts index d491fe5e42..9c04b687bd 100644 --- a/packages/canon/src/components/TextField/index.ts +++ b/packages/canon/src/components/TextField/index.ts @@ -15,3 +15,6 @@ */ export * from './TextField'; +export type { TextFieldProps } from './types'; +export { textFieldPropDefs } from './TextField.props'; +export type { TextFieldOwnProps } from './TextField.props'; diff --git a/packages/canon/src/components/TextField/types.ts b/packages/canon/src/components/TextField/types.ts index 9b1b06509b..019e5fbbb7 100644 --- a/packages/canon/src/components/TextField/types.ts +++ b/packages/canon/src/components/TextField/types.ts @@ -15,6 +15,7 @@ */ import type { TextFieldOwnProps } from './TextField.props'; +/** @public */ export interface TextFieldProps extends Omit, 'size'> { /** diff --git a/tsconfig.json b/tsconfig.json index 8d72a3315b..8942e6f48f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,6 +8,7 @@ "plugins/*/dev", "plugins/*/migrations" ], + "exclude": ["**/*.stories.tsx", "**/*.stories.ts"], "compilerOptions": { "outDir": "dist-types", "rootDir": ".",