diff --git a/canon-docs/src/app/(docs)/components/button/page.mdx b/canon-docs/src/app/(docs)/components/button/page.mdx index c92b5b9921..a92a6675d1 100644 --- a/canon-docs/src/app/(docs)/components/button/page.mdx +++ b/canon-docs/src/app/(docs)/components/button/page.mdx @@ -11,7 +11,7 @@ import { ButtonResponsive, } from '@/snippets/button'; import { buttonVariants } from '@/snippets/_snippets'; -import { buttonPropDefs } from '../../../../../../packages/canon/src/components/Button/Button.props'; +import { buttonPropDefs } from './props'; # Button diff --git a/canon-docs/src/app/(docs)/components/button/props.ts b/canon-docs/src/app/(docs)/components/button/props.ts new file mode 100644 index 0000000000..3a8f98e000 --- /dev/null +++ b/canon-docs/src/app/(docs)/components/button/props.ts @@ -0,0 +1,19 @@ +import { classNamePropDefs, stylePropDefs } from '../../../../utils/propDefs'; +import type { PropDef } from '../../../../utils/propDefs'; + +export const boxPropDefs: Record = { + variant: { + type: 'enum', + values: ['primary', 'secondary'], + default: 'primary', + responsive: true, + }, + size: { + type: 'enum', + values: ['small', 'medium'], + default: 'medium', + responsive: true, + }, + ...classNamePropDefs, + ...stylePropDefs, +}; diff --git a/canon-docs/src/app/(docs)/components/checkbox/page.mdx b/canon-docs/src/app/(docs)/components/checkbox/page.mdx index 26a5d0f955..fd2ec42e1b 100644 --- a/canon-docs/src/app/(docs)/components/checkbox/page.mdx +++ b/canon-docs/src/app/(docs)/components/checkbox/page.mdx @@ -4,6 +4,7 @@ import { Snippet } from '@/components/Snippet'; import { Tabs } from '@/components/Tabs'; import { CodeBlock } from '@/components/CodeBlock'; import { BaseUI } from '@/components/HeadlessBanners/BaseUI'; +import { checkboxPropDefs } from './props'; # Checkbox @@ -42,50 +43,7 @@ A checkbox component that can be used to trigger actions. - void", - responsive: false, - }, - disabled: { - type: 'boolean', - responsive: false, - }, - required: { - type: 'boolean', - responsive: false, - }, - name: { - type: 'string', - responsive: false, - }, - value: { - type: 'string', - responsive: false, - }, - className: { - type: 'string', - responsive: false, - }, - style: { - type: 'CSSProperties', - responsive: false, - }, - }} -/> + ## Examples diff --git a/canon-docs/src/app/(docs)/components/checkbox/props.ts b/canon-docs/src/app/(docs)/components/checkbox/props.ts new file mode 100644 index 0000000000..8abbac1ec9 --- /dev/null +++ b/canon-docs/src/app/(docs)/components/checkbox/props.ts @@ -0,0 +1,44 @@ +import { classNamePropDefs, stylePropDefs } from '../../../../utils/propDefs'; +import type { PropDef } from '../../../../utils/propDefs'; + +export const checkboxPropDefs: Record = { + label: { + type: 'string', + responsive: false, + }, + defaultChecked: { + type: 'enum', + values: ['boolean', "'indeterminate'"], + responsive: false, + }, + checked: { + type: 'enum', + values: ['boolean', "'indeterminate'"], + responsive: false, + }, + onChange: { + type: 'enum', + values: ["(checked: boolean | 'indeterminate') => void"], + responsive: false, + }, + disabled: { + type: 'enum', + values: ['boolean'], + responsive: false, + }, + required: { + type: 'enum', + values: ['boolean'], + responsive: false, + }, + name: { + type: 'string', + responsive: false, + }, + value: { + type: 'string', + responsive: false, + }, + ...classNamePropDefs, + ...stylePropDefs, +}; diff --git a/canon-docs/src/app/(docs)/components/field/page.mdx b/canon-docs/src/app/(docs)/components/field/page.mdx index 83029be506..54c091faeb 100644 --- a/canon-docs/src/app/(docs)/components/field/page.mdx +++ b/canon-docs/src/app/(docs)/components/field/page.mdx @@ -4,6 +4,12 @@ import { Tabs } from '@/components/Tabs'; import { CodeBlock } from '@/components/CodeBlock'; import { FieldPreview } from '@/snippets/field'; import { BaseUI } from '@/components/HeadlessBanners/BaseUI'; +import { + fieldRootPropDefs, + fieldLabelPropDefs, + fieldDescriptionPropDefs, + fieldErrorPropDefs, +} from './props'; # Field @@ -49,113 +55,25 @@ A wrapper around `Input` or `Select` component to add label, description and err Groups all parts of the field. Renders a `
` element. - string | string[] | null | Promise', - responsive: false, - }, - validationMode: { - type: ['onBlur', 'onChange'], - responsive: false, - }, - validationDebounceTime: { - type: 'number', - responsive: false, - }, - className: { - type: 'string', - responsive: false, - }, - style: { - type: 'CSSProperties', - responsive: false, - }, - }} -/> + ### Field.Label An accessible label that is automatically associated with the field control. Renders a `