diff --git a/.claude/skills/studio-ui-patterns/SKILL.md b/.claude/skills/studio-ui-patterns/SKILL.md index 85acab8a14..2a67de2bee 100644 --- a/.claude/skills/studio-ui-patterns/SKILL.md +++ b/.claude/skills/studio-ui-patterns/SKILL.md @@ -34,7 +34,7 @@ Docs: `apps/design-system/content/docs/ui-patterns/forms.mdx` - Use `react-hook-form` + `zod` - Use `FormItemLayout` instead of manually composing `FormItem`/`FormLabel`/`FormMessage`/`FormDescription` -- Wrap inputs with `FormControl_Shadcn_`; use `_Shadcn_` imports from `ui` for primitives +- Wrap inputs with `FormControl`; use `_Shadcn_` imports from `ui` for primitives Layout selection: diff --git a/apps/design-system/content/docs/components/switch.mdx b/apps/design-system/content/docs/components/switch.mdx index 6e7ec2d1f7..958b3fe49f 100644 --- a/apps/design-system/content/docs/components/switch.mdx +++ b/apps/design-system/content/docs/components/switch.mdx @@ -66,13 +66,13 @@ When using Switch in custom flex layouts (especially with height constraints lik ```tsx
- ( - + - + )} />
diff --git a/apps/design-system/content/docs/fragments/form-item-layout.mdx b/apps/design-system/content/docs/fragments/form-item-layout.mdx index dfa5402563..be0b886d09 100644 --- a/apps/design-system/content/docs/fragments/form-item-layout.mdx +++ b/apps/design-system/content/docs/fragments/form-item-layout.mdx @@ -21,27 +21,27 @@ The styling and layout of these components can be customized by passing in the c The components that can be replaced in `react-hook-form` atoms are highlighted below: ```tsx showLineNumbers {1-2,6-8} - - Username - + + Username + - - This is your public display name. - - + + This is your public display name. + + ``` Using `FormItemLayout` it can look like this: ```tsx - + - + ``` -Please note that you must still use `FormControl_Shadcn_` to wrap input fields. +Please note that you must still use `FormControl` to wrap input fields. ## Examples diff --git a/apps/design-system/content/docs/ui-patterns/forms.mdx b/apps/design-system/content/docs/ui-patterns/forms.mdx index 33097def25..305231b796 100644 --- a/apps/design-system/content/docs/ui-patterns/forms.mdx +++ b/apps/design-system/content/docs/ui-patterns/forms.mdx @@ -51,7 +51,7 @@ Build a custom row when the cells are mixed controls, such as an input paired wi - Use `layout="horizontal"` for side panels with more width - Use `layout="vertical"` for side panels with limited width -3. **Wrap inputs in FormControl*Shadcn***: Always wrap form inputs with `FormControl_Shadcn_` to ensure proper form integration. +3. **Wrap inputs in FormControl*Shadcn***: Always wrap form inputs with `FormControl` to ensure proper form integration. 4. **Use Cards for grouping**: Wrap form sections in `Card` components with `CardContent` and `CardFooter` for actions. diff --git a/apps/design-system/registry/default/example/calendar-form.tsx b/apps/design-system/registry/default/example/calendar-form.tsx index 4e88bb391c..aaad24692e 100644 --- a/apps/design-system/registry/default/example/calendar-form.tsx +++ b/apps/design-system/registry/default/example/calendar-form.tsx @@ -8,13 +8,13 @@ import { toast } from 'sonner' import { Button, Calendar, - Form_Shadcn_, - FormControl_Shadcn_, - FormDescription_Shadcn_, - FormField_Shadcn_, - FormItem_Shadcn_, - FormLabel_Shadcn_, - FormMessage_Shadcn_, + Form, + FormControl, + FormDescription, + FormField, + FormItem, + FormLabel, + FormMessage, Popover_Shadcn_, PopoverContent_Shadcn_, PopoverTrigger_Shadcn_, @@ -45,17 +45,17 @@ export default function CalendarForm() { } return ( - +
- ( - - Date of birth + + Date of birth - + - + - - Your date of birth is used to calculate your age. - - - + Your date of birth is used to calculate your age. + + )} /> -
+ ) } diff --git a/apps/design-system/registry/default/example/calendar-react-hook-form.tsx b/apps/design-system/registry/default/example/calendar-react-hook-form.tsx index c5f155210b..fbe9c6685e 100644 --- a/apps/design-system/registry/default/example/calendar-react-hook-form.tsx +++ b/apps/design-system/registry/default/example/calendar-react-hook-form.tsx @@ -8,13 +8,13 @@ import { toast } from 'sonner' import { Button, Calendar, - Form_Shadcn_, - FormControl_Shadcn_, - FormDescription_Shadcn_, - FormField_Shadcn_, - FormItem_Shadcn_, - FormLabel_Shadcn_, - FormMessage_Shadcn_, + Form, + FormControl, + FormDescription, + FormField, + FormItem, + FormLabel, + FormMessage, Popover_Shadcn_, PopoverContent_Shadcn_, PopoverTrigger_Shadcn_, @@ -45,17 +45,17 @@ export default function CalendarForm() { } return ( - +
- ( - - Date of birth + + Date of birth - + - + - - Your date of birth is used to calculate your age. - - - + Your date of birth is used to calculate your age. + + )} /> -
+ ) } diff --git a/apps/design-system/registry/default/example/checkbox-form-multiple.tsx b/apps/design-system/registry/default/example/checkbox-form-multiple.tsx index e2667e7364..f7e8d4e40e 100644 --- a/apps/design-system/registry/default/example/checkbox-form-multiple.tsx +++ b/apps/design-system/registry/default/example/checkbox-form-multiple.tsx @@ -6,13 +6,13 @@ import { toast } from 'sonner' import { Button, Checkbox_Shadcn_, - Form_Shadcn_, - FormControl_Shadcn_, - FormDescription_Shadcn_, - FormField_Shadcn_, - FormItem_Shadcn_, - FormLabel_Shadcn_, - FormMessage_Shadcn_, + Form, + FormControl, + FormDescription, + FormField, + FormItem, + FormLabel, + FormMessage, } from 'ui' import { z } from 'zod' @@ -68,31 +68,31 @@ export default function CheckboxReactHookFormMultiple() { } return ( - +
- ( - +
- Sidebar - + Sidebar + Select the items you want to display in the sidebar. - +
{items.map((item) => ( - { return ( - - + { @@ -101,19 +101,19 @@ export default function CheckboxReactHookFormMultiple() { : field.onChange(field.value?.filter((value) => value !== item.id)) }} /> - - {item.label} - + + {item.label} +
) }} /> ))} - -
+ + )} /> -
+ ) } diff --git a/apps/design-system/registry/default/example/checkbox-form-single.tsx b/apps/design-system/registry/default/example/checkbox-form-single.tsx index 928c4b29e5..48d9ec938a 100644 --- a/apps/design-system/registry/default/example/checkbox-form-single.tsx +++ b/apps/design-system/registry/default/example/checkbox-form-single.tsx @@ -7,12 +7,12 @@ import { toast } from 'sonner' import { Button, Checkbox_Shadcn_, - Form_Shadcn_, - FormControl_Shadcn_, - FormDescription_Shadcn_, - FormField_Shadcn_, - FormItem_Shadcn_, - FormLabel_Shadcn_, + Form, + FormControl, + FormDescription, + FormField, + FormItem, + FormLabel, } from 'ui' import { z } from 'zod' @@ -39,28 +39,28 @@ export default function CheckboxReactHookFormSingle() { } return ( - +
- ( - - + + - +
- Use different settings for my mobile devices - + Use different settings for my mobile devices + You can manage your mobile notifications in the{' '} mobile settings page. - +
-
+ )} /> -
+ ) } diff --git a/apps/design-system/registry/default/example/combobox-form.tsx b/apps/design-system/registry/default/example/combobox-form.tsx index 4a9670fb43..edf9116104 100644 --- a/apps/design-system/registry/default/example/combobox-form.tsx +++ b/apps/design-system/registry/default/example/combobox-form.tsx @@ -12,13 +12,13 @@ import { CommandInput_Shadcn_, CommandItem_Shadcn_, CommandList_Shadcn_, - Form_Shadcn_, - FormControl_Shadcn_, - FormDescription_Shadcn_, - FormField_Shadcn_, - FormItem_Shadcn_, - FormLabel_Shadcn_, - FormMessage_Shadcn_, + Form, + FormControl, + FormDescription, + FormField, + FormItem, + FormLabel, + FormMessage, Popover_Shadcn_, PopoverContent_Shadcn_, PopoverTrigger_Shadcn_, @@ -61,17 +61,17 @@ export default function ComboboxForm() { } return ( - +
- ( - - Language + + Language - + - + @@ -121,17 +121,17 @@ export default function ComboboxForm() { - + This is the language that will be used in the dashboard. - - - + + + )} /> -
+ ) } diff --git a/apps/design-system/registry/default/example/confirmation-modal-demo.tsx b/apps/design-system/registry/default/example/confirmation-modal-demo.tsx index dc1d91e32d..e3d46a8e84 100644 --- a/apps/design-system/registry/default/example/confirmation-modal-demo.tsx +++ b/apps/design-system/registry/default/example/confirmation-modal-demo.tsx @@ -2,9 +2,9 @@ import { useState } from 'react' import { useForm } from 'react-hook-form' import { Button, - Form_Shadcn_, - FormControl_Shadcn_, - FormField_Shadcn_, + Form, + FormControl, + FormField, Select_Shadcn_, SelectContent_Shadcn_, SelectItem_Shadcn_, @@ -46,13 +46,13 @@ export default function ConfirmationModalDemo() {

{/* Dropdown for Postgres version */}
- - + ( - + @@ -62,11 +62,11 @@ export default function ConfirmationModalDemo() { 17.6.1.055 - + )} /> - +
diff --git a/apps/design-system/registry/default/example/date-picker-form.tsx b/apps/design-system/registry/default/example/date-picker-form.tsx index 94c59f6997..0f81cc719b 100644 --- a/apps/design-system/registry/default/example/date-picker-form.tsx +++ b/apps/design-system/registry/default/example/date-picker-form.tsx @@ -8,13 +8,13 @@ import { toast } from 'sonner' import { Button, Calendar, - Form_Shadcn_, - FormControl_Shadcn_, - FormDescription_Shadcn_, - FormField_Shadcn_, - FormItem_Shadcn_, - FormLabel_Shadcn_, - FormMessage_Shadcn_, + Form, + FormControl, + FormDescription, + FormField, + FormItem, + FormLabel, + FormMessage, Popover_Shadcn_, PopoverContent_Shadcn_, PopoverTrigger_Shadcn_, @@ -45,17 +45,17 @@ export default function DatePickerForm() { } return ( - +
- ( - - Date of birth + + Date of birth - + - + - - Your date of birth is used to calculate your age. - - - + Your date of birth is used to calculate your age. + + )} /> -
+ ) } diff --git a/apps/design-system/registry/default/example/form-item-layout-after-label.tsx b/apps/design-system/registry/default/example/form-item-layout-after-label.tsx index f0993f2cc6..bd0fbcfcab 100644 --- a/apps/design-system/registry/default/example/form-item-layout-after-label.tsx +++ b/apps/design-system/registry/default/example/form-item-layout-after-label.tsx @@ -1,6 +1,6 @@ import { zodResolver } from '@hookform/resolvers/zod' import { useForm } from 'react-hook-form' -import { Button, Form_Shadcn_, FormControl_Shadcn_, FormField_Shadcn_, Switch } from 'ui' +import { Button, Form, FormControl, FormField, Switch } from 'ui' import { Input } from 'ui-patterns/DataInputs/Input' import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout' import { InfoTooltip } from 'ui-patterns/info-tooltip' @@ -24,9 +24,9 @@ export default function FormItemLayoutDemo() { // action('form form.handleSubmit(onSubmit)')(values) } return ( - +
- ( @@ -36,9 +36,9 @@ export default function FormItemLayoutDemo() { labelOptional="Optional" afterLabel={Added after the label} > - + - + )} /> @@ -46,6 +46,6 @@ export default function FormItemLayoutDemo() { Submit -
+ ) } diff --git a/apps/design-system/registry/default/example/form-item-layout-before-label.tsx b/apps/design-system/registry/default/example/form-item-layout-before-label.tsx index ee4487f147..a3c7813ec3 100644 --- a/apps/design-system/registry/default/example/form-item-layout-before-label.tsx +++ b/apps/design-system/registry/default/example/form-item-layout-before-label.tsx @@ -1,6 +1,6 @@ import { zodResolver } from '@hookform/resolvers/zod' import { useForm } from 'react-hook-form' -import { Button, Form_Shadcn_, FormControl_Shadcn_, FormField_Shadcn_, Switch } from 'ui' +import { Button, Form, FormControl, FormField, Switch } from 'ui' import { Input } from 'ui-patterns/DataInputs/Input' import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout' import { InfoTooltip } from 'ui-patterns/info-tooltip' @@ -24,9 +24,9 @@ export default function FormItemLayoutDemo() { // action('form form.handleSubmit(onSubmit)')(values) } return ( - +
- ( @@ -36,9 +36,9 @@ export default function FormItemLayoutDemo() { labelOptional="Optional" beforeLabel={Added before the label} > - + - + )} /> @@ -46,6 +46,6 @@ export default function FormItemLayoutDemo() { Submit -
+ ) } diff --git a/apps/design-system/registry/default/example/form-item-layout-demo.tsx b/apps/design-system/registry/default/example/form-item-layout-demo.tsx index ba35f52e28..6adef61bc1 100644 --- a/apps/design-system/registry/default/example/form-item-layout-demo.tsx +++ b/apps/design-system/registry/default/example/form-item-layout-demo.tsx @@ -1,6 +1,6 @@ import { zodResolver } from '@hookform/resolvers/zod' import { useForm } from 'react-hook-form' -import { Button, Form_Shadcn_, FormControl_Shadcn_, FormField_Shadcn_ } from 'ui' +import { Button, Form, FormControl, FormField } from 'ui' import { Input } from 'ui-patterns/DataInputs/Input' import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout' import { z } from 'zod' @@ -28,9 +28,9 @@ export default function FormItemLayoutDemo() { // action('form form.handleSubmit(onSubmit)')(values) } return ( - +
- ( @@ -39,9 +39,9 @@ export default function FormItemLayoutDemo() { description="This is your public display name" labelOptional="optional" > - + - + )} /> @@ -49,6 +49,6 @@ export default function FormItemLayoutDemo() { Submit -
+ ) } diff --git a/apps/design-system/registry/default/example/form-item-layout-with-checkbox-list.tsx b/apps/design-system/registry/default/example/form-item-layout-with-checkbox-list.tsx index ff215787a1..0313425759 100644 --- a/apps/design-system/registry/default/example/form-item-layout-with-checkbox-list.tsx +++ b/apps/design-system/registry/default/example/form-item-layout-with-checkbox-list.tsx @@ -1,6 +1,6 @@ import { zodResolver } from '@hookform/resolvers/zod' import { useForm } from 'react-hook-form' -import { Button, Checkbox_Shadcn_, Form_Shadcn_, FormControl_Shadcn_, FormField_Shadcn_ } from 'ui' +import { Button, Checkbox_Shadcn_, Form, FormControl, FormField } from 'ui' import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout' import { z } from 'zod' @@ -51,9 +51,9 @@ export default function FormItemLayoutDemo() { // action('form form.handleSubmit(onSubmit)')(values) } return ( - +
- ( @@ -63,7 +63,7 @@ export default function FormItemLayoutDemo() { layout="horizontal" > {items.map((item) => ( - - + { @@ -85,7 +85,7 @@ export default function FormItemLayoutDemo() { : field.onChange(field.value?.filter((value) => value !== item.id)) }} /> - + ) }} @@ -99,6 +99,6 @@ export default function FormItemLayoutDemo() { Submit -
+ ) } diff --git a/apps/design-system/registry/default/example/form-item-layout-with-checkbox.tsx b/apps/design-system/registry/default/example/form-item-layout-with-checkbox.tsx index a21de03539..0edf170445 100644 --- a/apps/design-system/registry/default/example/form-item-layout-with-checkbox.tsx +++ b/apps/design-system/registry/default/example/form-item-layout-with-checkbox.tsx @@ -1,13 +1,6 @@ import { zodResolver } from '@hookform/resolvers/zod' import { useForm } from 'react-hook-form' -import { - Badge, - Button, - Checkbox_Shadcn_, - Form_Shadcn_, - FormControl_Shadcn_, - FormField_Shadcn_, -} from 'ui' +import { Badge, Button, Checkbox_Shadcn_, Form, FormControl, FormField } from 'ui' import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout' import { z } from 'zod' @@ -29,9 +22,9 @@ export default function FormItemLayoutDemo() { // action('form form.handleSubmit(onSubmit)')(values) } return ( - +
- ( @@ -40,9 +33,9 @@ export default function FormItemLayoutDemo() { description="This is your public display name." layout="flex" > - + - + )} /> @@ -50,6 +43,6 @@ export default function FormItemLayoutDemo() { Submit -
+ ) } diff --git a/apps/design-system/registry/default/example/form-item-layout-with-horizontal.tsx b/apps/design-system/registry/default/example/form-item-layout-with-horizontal.tsx index 9d0471d8b8..73cf02f14b 100644 --- a/apps/design-system/registry/default/example/form-item-layout-with-horizontal.tsx +++ b/apps/design-system/registry/default/example/form-item-layout-with-horizontal.tsx @@ -1,6 +1,6 @@ import { zodResolver } from '@hookform/resolvers/zod' import { useForm } from 'react-hook-form' -import { Button, Form_Shadcn_, FormControl_Shadcn_, FormField_Shadcn_, Separator } from 'ui' +import { Button, Form, FormControl, FormField, Separator } from 'ui' import { Input } from 'ui-patterns/DataInputs/Input' import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout' import { z } from 'zod' @@ -28,9 +28,9 @@ export default function FormItemLayoutDemo() { // action('form form.handleSubmit(onSubmit)')(values) } return ( - +
- ( @@ -40,9 +40,9 @@ export default function FormItemLayoutDemo() { description="This is your public display name" labelOptional="optional" > - + - + )} /> @@ -53,6 +53,6 @@ export default function FormItemLayoutDemo() { -
+ ) } diff --git a/apps/design-system/registry/default/example/form-item-layout-with-select.tsx b/apps/design-system/registry/default/example/form-item-layout-with-select.tsx index 22ae206dc4..21ec964274 100644 --- a/apps/design-system/registry/default/example/form-item-layout-with-select.tsx +++ b/apps/design-system/registry/default/example/form-item-layout-with-select.tsx @@ -2,9 +2,9 @@ import { zodResolver } from '@hookform/resolvers/zod' import { useForm } from 'react-hook-form' import { Button, - Form_Shadcn_, - FormControl_Shadcn_, - FormField_Shadcn_, + Form, + FormControl, + FormField, Select_Shadcn_, SelectContent_Shadcn_, SelectItem_Shadcn_, @@ -36,9 +36,9 @@ export default function FormItemLayoutDemo() { // action('form form.handleSubmit(onSubmit)')(values) } return ( - +
- ( @@ -48,11 +48,11 @@ export default function FormItemLayoutDemo() { labelOptional="Optional" > - + - + m@example.com m@google.com @@ -66,6 +66,6 @@ export default function FormItemLayoutDemo() { Submit -
+ ) } diff --git a/apps/design-system/registry/default/example/form-item-layout-with-switch.tsx b/apps/design-system/registry/default/example/form-item-layout-with-switch.tsx index 0e2c373502..f0bd8a5f99 100644 --- a/apps/design-system/registry/default/example/form-item-layout-with-switch.tsx +++ b/apps/design-system/registry/default/example/form-item-layout-with-switch.tsx @@ -1,6 +1,6 @@ import { zodResolver } from '@hookform/resolvers/zod' import { useForm } from 'react-hook-form' -import { Button, Form_Shadcn_, FormControl_Shadcn_, FormField_Shadcn_, Switch } from 'ui' +import { Button, Form, FormControl, FormField, Switch } from 'ui' import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout' import { z } from 'zod' @@ -22,9 +22,9 @@ export default function FormItemLayoutDemo() { // action('form form.handleSubmit(onSubmit)')(values) } return ( - +
- ( @@ -34,9 +34,9 @@ export default function FormItemLayoutDemo() { description="This is an explanation." layout="flex" > - + - + )} /> @@ -44,6 +44,6 @@ export default function FormItemLayoutDemo() { Submit -
+ ) } diff --git a/apps/design-system/registry/default/example/form-patterns-pagelayout.tsx b/apps/design-system/registry/default/example/form-patterns-pagelayout.tsx index b95b8c91c3..9d8b1008b2 100644 --- a/apps/design-system/registry/default/example/form-patterns-pagelayout.tsx +++ b/apps/design-system/registry/default/example/form-patterns-pagelayout.tsx @@ -10,9 +10,9 @@ import { CardContent, CardFooter, Checkbox_Shadcn_, - Form_Shadcn_, - FormControl_Shadcn_, - FormField_Shadcn_, + Form, + FormControl, + FormField, FormInputGroupInput, FormInputGroupTextArea, Input_Shadcn_, @@ -133,12 +133,12 @@ export default function FormPatternsPageLayout() { - +
{/* Text Input */} - ( @@ -147,9 +147,9 @@ export default function FormPatternsPageLayout() { label="Text Input" description="Single-line text entry for short values" > - + - + )} /> @@ -157,7 +157,7 @@ export default function FormPatternsPageLayout() { {/* Password Input */} - ( @@ -166,9 +166,9 @@ export default function FormPatternsPageLayout() { label="Password Input" description="Masked input for secure text entry" > - + - + )} /> @@ -176,7 +176,7 @@ export default function FormPatternsPageLayout() { {/* Copyable Input */} - ( @@ -185,7 +185,7 @@ export default function FormPatternsPageLayout() { label="Copyable Input" description="Read-only input with copy-to-clipboard functionality" > - + {}} onCopy={() => console.log('Copied to clipboard')} /> - + )} /> @@ -201,7 +201,7 @@ export default function FormPatternsPageLayout() { {/* Number Input */} - ( @@ -210,7 +210,7 @@ export default function FormPatternsPageLayout() { label="Number Input" description="Numeric input with min/max validation" > - + field.onChange(Number(e.target.value))} /> - + )} /> @@ -226,7 +226,7 @@ export default function FormPatternsPageLayout() { {/* Input with Units */} - ( @@ -235,7 +235,7 @@ export default function FormPatternsPageLayout() { label="Input with Units" description="Input with additional unit label" > - + MB - + )} /> @@ -256,7 +256,7 @@ export default function FormPatternsPageLayout() { {/* Textarea */} - ( @@ -265,14 +265,14 @@ export default function FormPatternsPageLayout() { label="Textarea" description="Multi-line text input for longer content" > - +