From c7427d40b7dfdc3a1baa26664da0d3beaac7d933 Mon Sep 17 00:00:00 2001 From: Charles de Dreuille Date: Mon, 10 Feb 2025 17:45:56 +0000 Subject: [PATCH] Fix the types Signed-off-by: Charles de Dreuille --- packages/canon/report.api.md | 28 +++++++++++++++---- .../canon/src/components/Button/index.tsx | 2 ++ packages/canon/src/components/Button/types.ts | 10 +++---- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/packages/canon/report.api.md b/packages/canon/report.api.md index 784dd4bc64..f194084a9b 100644 --- a/packages/canon/report.api.md +++ b/packages/canon/report.api.md @@ -121,6 +121,27 @@ export const Button: React_2.ForwardRefExoticComponent< ButtonProps & React_2.RefAttributes >; +// @public (undocumented) +export type ButtonOwnProps = GetPropDefTypes; + +// @public (undocumented) +export const buttonPropDefs: { + variant: { + type: 'enum'; + values: ('primary' | 'secondary')[]; + className: string; + default: 'primary'; + responsive: true; + }; + size: { + type: 'enum'; + values: ('small' | 'medium')[]; + className: string; + default: 'medium'; + responsive: true; + }; +}; + // @public export interface ButtonProps { // (undocumented) @@ -134,14 +155,11 @@ export interface ButtonProps { // (undocumented) iconStart?: IconNames; // (undocumented) - size?: 'small' | 'medium' | Partial>; + size?: ButtonOwnProps['size']; // (undocumented) style?: React.CSSProperties; // (undocumented) - variant?: - | 'primary' - | 'secondary' - | Partial>; + variant?: ButtonOwnProps['variant']; } // @public (undocumented) diff --git a/packages/canon/src/components/Button/index.tsx b/packages/canon/src/components/Button/index.tsx index c323ba0329..9051f1145e 100644 --- a/packages/canon/src/components/Button/index.tsx +++ b/packages/canon/src/components/Button/index.tsx @@ -15,3 +15,5 @@ */ export { Button } from './Button'; export type { ButtonProps } from './types'; +export { buttonPropDefs } from './Button.props'; +export type { ButtonOwnProps } from './Button.props'; diff --git a/packages/canon/src/components/Button/types.ts b/packages/canon/src/components/Button/types.ts index 8897d011c3..89bb8c79e5 100644 --- a/packages/canon/src/components/Button/types.ts +++ b/packages/canon/src/components/Button/types.ts @@ -14,18 +14,16 @@ * limitations under the License. */ import { IconNames } from '../Icon'; -import type { Breakpoint } from '../../types'; +import type { ButtonOwnProps } from './Button.props'; + /** * Properties for {@link Button} * * @public */ export interface ButtonProps { - size?: 'small' | 'medium' | Partial>; - variant?: - | 'primary' - | 'secondary' - | Partial>; + size?: ButtonOwnProps['size']; + variant?: ButtonOwnProps['variant']; children: React.ReactNode; className?: string; disabled?: boolean;