@me1a/ui 2.2.2 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{atoms/accordion.mjs → accordion/index.mjs} +2 -2
- package/dist/accordion/index.mjs.map +1 -0
- package/dist/{atoms/avatar.mjs → avatar/index.mjs} +2 -2
- package/dist/avatar/index.mjs.map +1 -0
- package/dist/{atoms/badge.d.mts → badge/index.d.mts} +9 -8
- package/dist/{atoms/badge.mjs → badge/index.mjs} +2 -2
- package/dist/{atoms/badge.mjs.map → badge/index.mjs.map} +1 -1
- package/dist/{atoms/box.mjs → box/index.mjs} +2 -2
- package/dist/box/index.mjs.map +1 -0
- package/dist/{atoms/breadcrumb.mjs → breadcrumb/index.mjs} +2 -2
- package/dist/breadcrumb/index.mjs.map +1 -0
- package/dist/{atoms/button.d.mts → button/index.d.mts} +2 -2
- package/dist/{atoms/button.mjs → button/index.mjs} +2 -2
- package/dist/button/index.mjs.map +1 -0
- package/dist/card/index.d.mts +127 -0
- package/dist/card/index.mjs +2 -0
- package/dist/card/index.mjs.map +1 -0
- package/dist/{atoms/checkbox.mjs → checkbox/index.mjs} +2 -2
- package/dist/checkbox/index.mjs.map +1 -0
- package/dist/{atoms/collapsible.mjs → collapsible/index.mjs} +2 -2
- package/dist/collapsible/index.mjs.map +1 -0
- package/dist/{atoms/command.mjs → command/index.mjs} +2 -2
- package/dist/command/index.mjs.map +1 -0
- package/dist/container/index.d.mts +33 -0
- package/dist/{atoms/container.mjs → container/index.mjs} +2 -2
- package/dist/container/index.mjs.map +1 -0
- package/dist/{atoms/dialog.mjs → dialog/index.mjs} +2 -2
- package/dist/dialog/index.mjs.map +1 -0
- package/dist/{organisms/drawer.mjs → drawer/index.mjs} +2 -2
- package/dist/drawer/index.mjs.map +1 -0
- package/dist/{organisms/dropdown-menu.d.mts → dropdown-menu/index.d.mts} +2 -2
- package/dist/{organisms/dropdown-menu.mjs → dropdown-menu/index.mjs} +2 -2
- package/dist/dropdown-menu/index.mjs.map +1 -0
- package/dist/{rhf/form.mjs → form/index.mjs} +2 -2
- package/dist/form/index.mjs.map +1 -0
- package/dist/{hooks.d.mts → hooks/index.d.mts} +2 -2
- package/dist/{hooks.mjs → hooks/index.mjs} +2 -2
- package/dist/{hooks.js.map → hooks/index.mjs.map} +1 -1
- package/dist/index.d.mts +159 -39
- package/dist/index.mjs +47 -2
- package/dist/index.mjs.map +1 -1
- package/dist/{atoms/input.mjs → input/index.mjs} +2 -2
- package/dist/{atoms/input.mjs.map → input/index.mjs.map} +1 -1
- package/dist/{atoms/label.d.mts → label/index.d.mts} +2 -2
- package/dist/{atoms/label.mjs → label/index.mjs} +2 -2
- package/dist/{atoms/label.mjs.map → label/index.mjs.map} +1 -1
- package/dist/{molecules/navigation-menu.d.mts → navigation-menu/index.d.mts} +21 -20
- package/dist/{molecules/navigation-menu.mjs → navigation-menu/index.mjs} +2 -2
- package/dist/navigation-menu/index.mjs.map +1 -0
- package/dist/{atoms/page-loader.d.mts → page-loader/index.d.mts} +2 -2
- package/dist/{atoms/page-loader.mjs → page-loader/index.mjs} +2 -2
- package/dist/page-loader/index.mjs.map +1 -0
- package/dist/{atoms/pagination.d.mts → pagination/index.d.mts} +2 -2
- package/dist/{atoms/pagination.mjs → pagination/index.mjs} +2 -2
- package/dist/pagination/index.mjs.map +1 -0
- package/dist/{atoms/popover.mjs → popover/index.mjs} +2 -2
- package/dist/popover/index.mjs.map +1 -0
- package/dist/{atoms/radio-group.d.mts → radio-group/index.d.mts} +2 -2
- package/dist/{atoms/radio-group.mjs → radio-group/index.mjs} +2 -2
- package/dist/radio-group/index.mjs.map +1 -0
- package/dist/{atoms/resizable.mjs → resizable/index.mjs} +2 -2
- package/dist/resizable/index.mjs.map +1 -0
- package/dist/{rhf/rhf-checkbox.mjs → rhf-checkbox/index.mjs} +2 -2
- package/dist/rhf-checkbox/index.mjs.map +1 -0
- package/dist/{rhf/rhf-multi-select.mjs → rhf-multi-select/index.mjs} +2 -2
- package/dist/rhf-multi-select/index.mjs.map +1 -0
- package/dist/{rhf/rhf-radio-button-group.mjs → rhf-radio-button-group/index.mjs} +2 -2
- package/dist/rhf-radio-button-group/index.mjs.map +1 -0
- package/dist/{rhf/rhf-radio-group.mjs → rhf-radio-group/index.mjs} +2 -2
- package/dist/rhf-radio-group/index.mjs.map +1 -0
- package/dist/{rhf/rhf-select.mjs → rhf-select/index.mjs} +2 -2
- package/dist/rhf-select/index.mjs.map +1 -0
- package/dist/{rhf/rhf-switch.mjs → rhf-switch/index.mjs} +2 -2
- package/dist/rhf-switch/index.mjs.map +1 -0
- package/dist/{rhf/rhf-textarea.mjs → rhf-textarea/index.mjs} +2 -2
- package/dist/rhf-textarea/index.mjs.map +1 -0
- package/dist/{atoms/separator.mjs → separator/index.mjs} +2 -2
- package/dist/separator/index.mjs.map +1 -0
- package/dist/{atoms/sheet.d.mts → sheet/index.d.mts} +2 -2
- package/dist/{atoms/sheet.mjs → sheet/index.mjs} +2 -2
- package/dist/{atoms/sheet.mjs.map → sheet/index.mjs.map} +1 -1
- package/dist/{organisms/sidebar.d.mts → sidebar/index.d.mts} +4 -4
- package/dist/{organisms/sidebar.mjs → sidebar/index.mjs} +2 -2
- package/dist/sidebar/index.mjs.map +1 -0
- package/dist/skeleton/index.d.mts +17 -0
- package/dist/skeleton/index.mjs +2 -0
- package/dist/skeleton/index.mjs.map +1 -0
- package/dist/{atoms/stack.mjs → stack/index.mjs} +2 -2
- package/dist/{atoms/stack.mjs.map → stack/index.mjs.map} +1 -1
- package/dist/{atoms/switch.mjs → switch/index.mjs} +2 -2
- package/dist/switch/index.mjs.map +1 -0
- package/dist/{atoms/table.mjs → table/index.mjs} +2 -2
- package/dist/{atoms/table.mjs.map → table/index.mjs.map} +1 -1
- package/dist/tabs/index.d.mts +97 -0
- package/dist/tabs/index.mjs +2 -0
- package/dist/tabs/index.mjs.map +1 -0
- package/dist/{atoms/text-field.d.mts → text-field/index.d.mts} +2 -2
- package/dist/{atoms/text-field.mjs → text-field/index.mjs} +2 -2
- package/dist/text-field/index.mjs.map +1 -0
- package/dist/textarea/index.d.mts +24 -0
- package/dist/{atoms/textarea.mjs → textarea/index.mjs} +2 -2
- package/dist/textarea/index.mjs.map +1 -0
- package/dist/{atoms/toast.d.mts → toast/index.d.mts} +2 -2
- package/dist/{atoms/toast.mjs → toast/index.mjs} +2 -2
- package/dist/{atoms/toast.mjs.map → toast/index.mjs.map} +1 -1
- package/dist/{atoms/toaster.mjs → toaster/index.mjs} +2 -2
- package/dist/toaster/index.mjs.map +1 -0
- package/dist/{atoms/tooltip.mjs → tooltip/index.mjs} +2 -2
- package/dist/tooltip/index.mjs.map +1 -0
- package/dist/types/index.d.mts +2 -0
- package/dist/types/index.mjs +2 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/{atoms/typography.d.mts → typography/index.d.mts} +2 -2
- package/dist/{atoms/typography.mjs → typography/index.mjs} +2 -2
- package/dist/typography/index.mjs.map +1 -0
- package/dist/utils/index.d.mts +5 -0
- package/dist/{utils.mjs → utils/index.mjs} +2 -2
- package/dist/utils/index.mjs.map +1 -0
- package/package.json +196 -257
- package/dist/atoms/accordion.d.ts +0 -94
- package/dist/atoms/accordion.js +0 -2
- package/dist/atoms/accordion.js.map +0 -1
- package/dist/atoms/accordion.mjs.map +0 -1
- package/dist/atoms/avatar.d.ts +0 -34
- package/dist/atoms/avatar.js +0 -2
- package/dist/atoms/avatar.js.map +0 -1
- package/dist/atoms/avatar.mjs.map +0 -1
- package/dist/atoms/badge.d.ts +0 -40
- package/dist/atoms/badge.js +0 -2
- package/dist/atoms/badge.js.map +0 -1
- package/dist/atoms/box.d.ts +0 -50
- package/dist/atoms/box.js +0 -2
- package/dist/atoms/box.js.map +0 -1
- package/dist/atoms/box.mjs.map +0 -1
- package/dist/atoms/breadcrumb.d.ts +0 -35
- package/dist/atoms/breadcrumb.js +0 -2
- package/dist/atoms/breadcrumb.js.map +0 -1
- package/dist/atoms/breadcrumb.mjs.map +0 -1
- package/dist/atoms/button.d.ts +0 -82
- package/dist/atoms/button.js +0 -2
- package/dist/atoms/button.js.map +0 -1
- package/dist/atoms/button.mjs.map +0 -1
- package/dist/atoms/checkbox.d.ts +0 -21
- package/dist/atoms/checkbox.js +0 -2
- package/dist/atoms/checkbox.js.map +0 -1
- package/dist/atoms/checkbox.mjs.map +0 -1
- package/dist/atoms/collapsible.d.ts +0 -26
- package/dist/atoms/collapsible.js +0 -2
- package/dist/atoms/collapsible.js.map +0 -1
- package/dist/atoms/collapsible.mjs.map +0 -1
- package/dist/atoms/command.d.ts +0 -122
- package/dist/atoms/command.js +0 -2
- package/dist/atoms/command.js.map +0 -1
- package/dist/atoms/command.mjs.map +0 -1
- package/dist/atoms/container.js +0 -2
- package/dist/atoms/container.js.map +0 -1
- package/dist/atoms/container.mjs.map +0 -1
- package/dist/atoms/dialog.d.ts +0 -35
- package/dist/atoms/dialog.js +0 -2
- package/dist/atoms/dialog.js.map +0 -1
- package/dist/atoms/dialog.mjs.map +0 -1
- package/dist/atoms/input.d.ts +0 -12
- package/dist/atoms/input.js +0 -2
- package/dist/atoms/input.js.map +0 -1
- package/dist/atoms/label.d.ts +0 -18
- package/dist/atoms/label.js +0 -2
- package/dist/atoms/label.js.map +0 -1
- package/dist/atoms/page-loader.d.ts +0 -29
- package/dist/atoms/page-loader.js +0 -2
- package/dist/atoms/page-loader.js.map +0 -1
- package/dist/atoms/page-loader.mjs.map +0 -1
- package/dist/atoms/pagination.d.ts +0 -105
- package/dist/atoms/pagination.js +0 -2
- package/dist/atoms/pagination.js.map +0 -1
- package/dist/atoms/pagination.mjs.map +0 -1
- package/dist/atoms/popover.d.ts +0 -30
- package/dist/atoms/popover.js +0 -2
- package/dist/atoms/popover.js.map +0 -1
- package/dist/atoms/popover.mjs.map +0 -1
- package/dist/atoms/radio-group.d.ts +0 -62
- package/dist/atoms/radio-group.js +0 -2
- package/dist/atoms/radio-group.js.map +0 -1
- package/dist/atoms/radio-group.mjs.map +0 -1
- package/dist/atoms/resizable.d.ts +0 -53
- package/dist/atoms/resizable.js +0 -2
- package/dist/atoms/resizable.js.map +0 -1
- package/dist/atoms/resizable.mjs.map +0 -1
- package/dist/atoms/separator.d.ts +0 -13
- package/dist/atoms/separator.js +0 -2
- package/dist/atoms/separator.js.map +0 -1
- package/dist/atoms/separator.mjs.map +0 -1
- package/dist/atoms/sheet.d.ts +0 -42
- package/dist/atoms/sheet.js +0 -2
- package/dist/atoms/sheet.js.map +0 -1
- package/dist/atoms/skeleton.js +0 -2
- package/dist/atoms/skeleton.js.map +0 -1
- package/dist/atoms/skeleton.mjs +0 -2
- package/dist/atoms/skeleton.mjs.map +0 -1
- package/dist/atoms/stack.d.ts +0 -121
- package/dist/atoms/stack.js +0 -2
- package/dist/atoms/stack.js.map +0 -1
- package/dist/atoms/switch.d.ts +0 -21
- package/dist/atoms/switch.js +0 -2
- package/dist/atoms/switch.js.map +0 -1
- package/dist/atoms/switch.mjs.map +0 -1
- package/dist/atoms/table.d.ts +0 -53
- package/dist/atoms/table.js +0 -2
- package/dist/atoms/table.js.map +0 -1
- package/dist/atoms/text-field.d.ts +0 -65
- package/dist/atoms/text-field.js +0 -2
- package/dist/atoms/text-field.js.map +0 -1
- package/dist/atoms/text-field.mjs.map +0 -1
- package/dist/atoms/textarea.js +0 -2
- package/dist/atoms/textarea.js.map +0 -1
- package/dist/atoms/textarea.mjs.map +0 -1
- package/dist/atoms/toast.d.ts +0 -18
- package/dist/atoms/toast.js +0 -2
- package/dist/atoms/toast.js.map +0 -1
- package/dist/atoms/toaster.d.ts +0 -26
- package/dist/atoms/toaster.js +0 -2
- package/dist/atoms/toaster.js.map +0 -1
- package/dist/atoms/toaster.mjs.map +0 -1
- package/dist/atoms/tooltip.d.ts +0 -25
- package/dist/atoms/tooltip.js +0 -2
- package/dist/atoms/tooltip.js.map +0 -1
- package/dist/atoms/tooltip.mjs.map +0 -1
- package/dist/atoms/typography.d.ts +0 -24
- package/dist/atoms/typography.js +0 -2
- package/dist/atoms/typography.js.map +0 -1
- package/dist/atoms/typography.mjs.map +0 -1
- package/dist/atoms.d.mts +0 -1237
- package/dist/atoms.d.ts +0 -1237
- package/dist/atoms.js +0 -2
- package/dist/atoms.js.map +0 -1
- package/dist/atoms.mjs +0 -2
- package/dist/atoms.mjs.map +0 -1
- package/dist/hooks.d.ts +0 -57
- package/dist/hooks.js +0 -2
- package/dist/hooks.mjs.map +0 -1
- package/dist/index.d.ts +0 -2619
- package/dist/index.js +0 -2
- package/dist/index.js.map +0 -1
- package/dist/molecules/card.d.mts +0 -72
- package/dist/molecules/card.d.ts +0 -72
- package/dist/molecules/card.js +0 -2
- package/dist/molecules/card.js.map +0 -1
- package/dist/molecules/card.mjs +0 -2
- package/dist/molecules/card.mjs.map +0 -1
- package/dist/molecules/navigation-menu.d.ts +0 -103
- package/dist/molecules/navigation-menu.js +0 -2
- package/dist/molecules/navigation-menu.js.map +0 -1
- package/dist/molecules/navigation-menu.mjs.map +0 -1
- package/dist/molecules/tabs.d.mts +0 -32
- package/dist/molecules/tabs.d.ts +0 -32
- package/dist/molecules/tabs.js +0 -2
- package/dist/molecules/tabs.js.map +0 -1
- package/dist/molecules/tabs.mjs +0 -2
- package/dist/molecules/tabs.mjs.map +0 -1
- package/dist/molecules.d.mts +0 -201
- package/dist/molecules.d.ts +0 -201
- package/dist/molecules.js +0 -2
- package/dist/molecules.js.map +0 -1
- package/dist/molecules.mjs +0 -2
- package/dist/molecules.mjs.map +0 -1
- package/dist/organisms/drawer.d.ts +0 -63
- package/dist/organisms/drawer.js +0 -2
- package/dist/organisms/drawer.js.map +0 -1
- package/dist/organisms/drawer.mjs.map +0 -1
- package/dist/organisms/dropdown-menu.d.ts +0 -335
- package/dist/organisms/dropdown-menu.js +0 -2
- package/dist/organisms/dropdown-menu.js.map +0 -1
- package/dist/organisms/dropdown-menu.mjs.map +0 -1
- package/dist/organisms/sidebar.d.ts +0 -328
- package/dist/organisms/sidebar.js +0 -2
- package/dist/organisms/sidebar.js.map +0 -1
- package/dist/organisms/sidebar.mjs.map +0 -1
- package/dist/organisms.d.mts +0 -717
- package/dist/organisms.d.ts +0 -717
- package/dist/organisms.js +0 -2
- package/dist/organisms.js.map +0 -1
- package/dist/organisms.mjs +0 -2
- package/dist/organisms.mjs.map +0 -1
- package/dist/rhf/form.d.ts +0 -96
- package/dist/rhf/form.js +0 -2
- package/dist/rhf/form.js.map +0 -1
- package/dist/rhf/form.mjs.map +0 -1
- package/dist/rhf/rhf-checkbox.d.ts +0 -57
- package/dist/rhf/rhf-checkbox.js +0 -2
- package/dist/rhf/rhf-checkbox.js.map +0 -1
- package/dist/rhf/rhf-checkbox.mjs.map +0 -1
- package/dist/rhf/rhf-multi-select.d.ts +0 -84
- package/dist/rhf/rhf-multi-select.js +0 -2
- package/dist/rhf/rhf-multi-select.js.map +0 -1
- package/dist/rhf/rhf-multi-select.mjs.map +0 -1
- package/dist/rhf/rhf-radio-button-group.d.ts +0 -73
- package/dist/rhf/rhf-radio-button-group.js +0 -2
- package/dist/rhf/rhf-radio-button-group.js.map +0 -1
- package/dist/rhf/rhf-radio-button-group.mjs.map +0 -1
- package/dist/rhf/rhf-radio-group.d.ts +0 -103
- package/dist/rhf/rhf-radio-group.js +0 -2
- package/dist/rhf/rhf-radio-group.js.map +0 -1
- package/dist/rhf/rhf-radio-group.mjs.map +0 -1
- package/dist/rhf/rhf-select.d.ts +0 -80
- package/dist/rhf/rhf-select.js +0 -2
- package/dist/rhf/rhf-select.js.map +0 -1
- package/dist/rhf/rhf-select.mjs.map +0 -1
- package/dist/rhf/rhf-switch.d.ts +0 -57
- package/dist/rhf/rhf-switch.js +0 -2
- package/dist/rhf/rhf-switch.js.map +0 -1
- package/dist/rhf/rhf-switch.mjs.map +0 -1
- package/dist/rhf/rhf-textarea.d.ts +0 -66
- package/dist/rhf/rhf-textarea.js +0 -2
- package/dist/rhf/rhf-textarea.js.map +0 -1
- package/dist/rhf/rhf-textarea.mjs.map +0 -1
- package/dist/rhf.d.mts +0 -614
- package/dist/rhf.d.ts +0 -614
- package/dist/rhf.js +0 -2
- package/dist/rhf.js.map +0 -1
- package/dist/rhf.mjs +0 -2
- package/dist/rhf.mjs.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/types.mjs +0 -2
- package/dist/types.mjs.map +0 -1
- package/dist/utils.js +0 -2
- package/dist/utils.js.map +0 -1
- package/dist/utils.mjs.map +0 -1
- /package/dist/{atoms/accordion.d.mts → accordion/index.d.mts} +0 -0
- /package/dist/{atoms/avatar.d.mts → avatar/index.d.mts} +0 -0
- /package/dist/{atoms/box.d.mts → box/index.d.mts} +0 -0
- /package/dist/{atoms/breadcrumb.d.mts → breadcrumb/index.d.mts} +0 -0
- /package/dist/{atoms/checkbox.d.mts → checkbox/index.d.mts} +0 -0
- /package/dist/{atoms/collapsible.d.mts → collapsible/index.d.mts} +0 -0
- /package/dist/{atoms/command.d.mts → command/index.d.mts} +0 -0
- /package/dist/{atoms/dialog.d.mts → dialog/index.d.mts} +0 -0
- /package/dist/{organisms/drawer.d.mts → drawer/index.d.mts} +0 -0
- /package/dist/{rhf/form.d.mts → form/index.d.mts} +0 -0
- /package/dist/{atoms/input.d.mts → input/index.d.mts} +0 -0
- /package/dist/{atoms/popover.d.mts → popover/index.d.mts} +0 -0
- /package/dist/{atoms/resizable.d.mts → resizable/index.d.mts} +0 -0
- /package/dist/{rhf/rhf-checkbox.d.mts → rhf-checkbox/index.d.mts} +0 -0
- /package/dist/{rhf/rhf-multi-select.d.mts → rhf-multi-select/index.d.mts} +0 -0
- /package/dist/{rhf/rhf-radio-button-group.d.mts → rhf-radio-button-group/index.d.mts} +0 -0
- /package/dist/{rhf/rhf-radio-group.d.mts → rhf-radio-group/index.d.mts} +0 -0
- /package/dist/{rhf/rhf-select.d.mts → rhf-select/index.d.mts} +0 -0
- /package/dist/{rhf/rhf-switch.d.mts → rhf-switch/index.d.mts} +0 -0
- /package/dist/{rhf/rhf-textarea.d.mts → rhf-textarea/index.d.mts} +0 -0
- /package/dist/{atoms/separator.d.mts → separator/index.d.mts} +0 -0
- /package/dist/{atoms/stack.d.mts → stack/index.d.mts} +0 -0
- /package/dist/{atoms/switch.d.mts → switch/index.d.mts} +0 -0
- /package/dist/{atoms/table.d.mts → table/index.d.mts} +0 -0
- /package/dist/{atoms/toaster.d.mts → toaster/index.d.mts} +0 -0
- /package/dist/{atoms/tooltip.d.mts → tooltip/index.d.mts} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/cn.ts","../../src/components/atoms/button/button.tsx","../../src/components/atoms/command/command.tsx","../../src/components/atoms/typography/typography.tsx","../../src/components/atoms/select/multi-select.tsx","../../src/components/atoms/label/label.tsx","../../src/components/rhf/form/form.tsx","../../src/components/rhf/rhf-multi-select/rhf-multi-select.tsx"],"names":["cn","inputs","twMerge","clsx","buttonVariants","cva","Button","J","className","variant","size","asChild","startIcon","endIcon","loading","disabled","children","type","ariaLabel","props","ref","Comp","Slot","isDisabled","buttonAriaLabel","handleKeyDown","event","jsx","jsxs","Loader2","Command","C","CommandPrimitive","CommandInput","Search","CommandList","CommandEmpty","CommandGroup","CommandSeparator","CommandItem","typographyVariants","Typography","U","align","Component","MultiSelect","options","value","onChange","placeholder","required","error","fullWidth","searchable","id","maxSelections","showSelectAll","renderCommandList","open","setOpen","Z","selectedOptions","option","handleSelect","optionId","selectedId","handleSelectAll","enabledOptions","handleRemove","e","Popover","PopoverTrigger","X","ChevronDown","PopoverContent","o","Check","labelVariants","Label","te","FormFieldContext","FormField","Controller","useFormField","fieldContext","itemContext","FormItemContext","getFieldState","formState","useFormContext","fieldState","FormItem","FormLabel","formItemId","FormControl","formDescriptionId","formMessageId","FormDescription","FormMessage","body","RHFMultiSelect","name","label","description","warningText","readOnly","ariaDescribedby","other","control","field"],"mappings":"6dAGO,SAASA,CAAAA,CAAAA,GAAMC,EAAsB,CAC1C,OAAOC,QAAQC,IAAKF,CAAAA,CAAM,CA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,CAAA,CAAa,QAAA/C,CAAAA,CAAAA,CAAM,OAAQ,CAAA,CAAA,CACrC,CAACA,CAAAA,EAASqD,GACT7E,GAAC,CAAA,GAAA,CAAA,CAAE,UAAU,8CAA+C,CAAA,IAAA,CAAK,QAC9D,QAAA6E,CAAAA,CAAAA,CACH,CAEJ,CAAA,CAAA,CAAA,CAGN,CAEJ","file":"rhf-multi-select.mjs","sourcesContent":["import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","import * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport { cva } from \"class-variance-authority\"\nimport { cn } from \"@/utils/cn\"\nimport { Loader2 } from \"lucide-react\"\nimport { ButtonProps } from \"./button.types\"\n\n/**\n * Button variant styles using class-variance-authority.\n * Defines the visual styles for different button variants and sizes.\n * Follows WCAG 2.1 Level AA guidelines for accessibility.\n *\n * @example\n * ```tsx\n * <Button variant=\"primary\" size=\"lg\">Click me</Button>\n * ```\n */\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground shadow hover:bg-primary/90\",\n destructive: \"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90\",\n outline:\n \"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground\",\n secondary: \"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\"\n } as const,\n size: {\n default: \"h-9 px-4 py-2\",\n sm: \"h-8 rounded-md px-3 text-xs\",\n lg: \"h-10 rounded-md px-8\",\n icon: \"h-9 w-9\"\n } as const\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\"\n }\n }\n)\n\n/**\n * A versatile button component that supports multiple variants, sizes, and can be rendered as a child component.\n * Built on top of Radix UI's Slot primitive for maximum flexibility.\n * Implements proper accessibility features and follows WCAG 2.1 Level AA guidelines.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-button--docs\n *\n * @component\n * @example\n * ```tsx\n * // Default button\n * <Button>Click me</Button>\n *\n * // Destructive button with small size\n * <Button variant=\"destructive\" size=\"sm\">Delete</Button>\n *\n * // As a link\n * <Button variant=\"link\" asChild>\n * <a href=\"/about\">About</a>\n * </Button>\n *\n * // With icons\n * <Button startIcon={<Icon />}>With Start Icon</Button>\n * <Button endIcon={<Icon />}>With End Icon</Button>\n *\n * // Loading state\n * <Button loading>Loading</Button>\n * ```\n *\n * @param {ButtonProps} props - The component props\n * @param {React.Ref<HTMLButtonElement>} ref - Forwarded ref\n * @returns {JSX.Element} A button element\n */\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant,\n size,\n asChild = false,\n startIcon,\n endIcon,\n loading = false,\n disabled,\n children,\n type = \"button\",\n \"aria-label\": ariaLabel,\n ...props\n },\n ref\n ) => {\n const Comp = asChild ? Slot : \"button\"\n const isDisabled = disabled || loading\n const buttonAriaLabel = ariaLabel || (typeof children === \"string\" ? children : undefined)\n\n // Handle keyboard interaction\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault()\n if (!isDisabled && props.onClick) {\n props.onClick(event as unknown as React.MouseEvent<HTMLButtonElement>)\n }\n }\n }\n\n if (asChild) {\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n disabled={isDisabled}\n type={type}\n aria-label={buttonAriaLabel}\n aria-disabled={isDisabled}\n {...props}\n >\n {children}\n </Comp>\n )\n }\n\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n disabled={isDisabled}\n type={type}\n aria-label={buttonAriaLabel}\n aria-disabled={isDisabled}\n onKeyDown={handleKeyDown}\n {...props}\n >\n {loading && (\n <Loader2\n className=\"mr-2 h-4 w-4 animate-spin\"\n role=\"status\"\n aria-label=\"Loading\"\n aria-hidden=\"true\"\n />\n )}\n {!loading && startIcon && (\n <span className=\"mr-2\" aria-hidden=\"true\">\n {startIcon}\n </span>\n )}\n {children}\n {!loading && endIcon && (\n <span className=\"ml-2\" aria-hidden=\"true\">\n {endIcon}\n </span>\n )}\n </Comp>\n )\n }\n)\nButton.displayName = \"Button\"\n\nexport { Button, buttonVariants }\n","import * as React from \"react\"\nimport { Command as CommandPrimitive } from \"cmdk\"\nimport { Search } from \"lucide-react\"\n\nimport { cn } from \"@/utils/index\"\nimport { Dialog, DialogContent } from \"@/components/atoms/dialog\"\nimport {\n type CommandProps,\n type CommandRef,\n type CommandDialogProps,\n type CommandInputProps,\n type CommandInputRef,\n type CommandListProps,\n type CommandListRef,\n type CommandEmptyProps,\n type CommandEmptyRef,\n type CommandGroupProps,\n type CommandGroupRef,\n type CommandSeparatorProps,\n type CommandSeparatorRef,\n type CommandItemProps,\n type CommandItemRef,\n type CommandShortcutProps\n} from \"./command.types\"\n\n/**\n * Command component that provides a command palette interface.\n * Built on top of cmdk and Radix UI's Dialog primitive.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-command--docs\n *\n * @example\n * ```tsx\n * <Command>\n * <CommandInput placeholder=\"Search...\" />\n * <CommandList>\n * <CommandEmpty>No results found.</CommandEmpty>\n * <CommandGroup heading=\"Suggestions\">\n * <CommandItem>Calendar</CommandItem>\n * <CommandItem>Search</CommandItem>\n * </CommandGroup>\n * </CommandList>\n * </Command>\n * ```\n */\nconst Command = React.forwardRef<CommandRef, CommandProps>(({ className, ...props }, ref) => (\n <CommandPrimitive\n ref={ref}\n className={cn(\n \"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground\",\n className\n )}\n {...props}\n />\n))\nCommand.displayName = CommandPrimitive.displayName\n\nconst CommandDialog = ({ children, ...props }: CommandDialogProps) => {\n return (\n <Dialog {...props}>\n <DialogContent className=\"overflow-hidden p-0\">\n <Command className=\"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5\">\n {children}\n </Command>\n </DialogContent>\n </Dialog>\n )\n}\n\nconst CommandInput = React.forwardRef<CommandInputRef, CommandInputProps>(\n ({ className, ...props }, ref) => (\n <div className=\"flex items-center border-b px-3\" cmdk-input-wrapper=\"\">\n <Search className=\"mr-2 h-4 w-4 shrink-0 opacity-50\" />\n <CommandPrimitive.Input\n ref={ref}\n className={cn(\n \"flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n {...props}\n />\n </div>\n )\n)\nCommandInput.displayName = CommandPrimitive.Input.displayName\n\nconst CommandList = React.forwardRef<CommandListRef, CommandListProps>(\n ({ className, ...props }, ref) => (\n <CommandPrimitive.List\n ref={ref}\n className={cn(\"max-h-[300px] overflow-y-auto overflow-x-hidden\", className)}\n {...props}\n />\n )\n)\nCommandList.displayName = CommandPrimitive.List.displayName\n\nconst CommandEmpty = React.forwardRef<CommandEmptyRef, CommandEmptyProps>((props, ref) => (\n <CommandPrimitive.Empty ref={ref} className=\"py-6 text-center text-sm\" {...props} />\n))\nCommandEmpty.displayName = CommandPrimitive.Empty.displayName\n\nconst CommandGroup = React.forwardRef<CommandGroupRef, CommandGroupProps>(\n ({ className, ...props }, ref) => (\n <CommandPrimitive.Group\n ref={ref}\n className={cn(\n \"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground\",\n className\n )}\n {...props}\n />\n )\n)\nCommandGroup.displayName = CommandPrimitive.Group.displayName\n\nconst CommandSeparator = React.forwardRef<CommandSeparatorRef, CommandSeparatorProps>(\n ({ className, ...props }, ref) => (\n <CommandPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 h-px bg-border\", className)}\n {...props}\n />\n )\n)\nCommandSeparator.displayName = CommandPrimitive.Separator.displayName\n\nconst CommandItem = React.forwardRef<CommandItemRef, CommandItemProps>(\n ({ className, ...props }, ref) => (\n <CommandPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\n className\n )}\n {...props}\n />\n )\n)\nCommandItem.displayName = CommandPrimitive.Item.displayName\n\nconst CommandShortcut = ({ className, ...props }: CommandShortcutProps) => {\n return (\n <span\n className={cn(\"ml-auto text-xs tracking-widest text-muted-foreground\", className)}\n {...props}\n />\n )\n}\nCommandShortcut.displayName = \"CommandShortcut\"\n\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator\n}\n","import * as React from \"react\"\nimport { cn } from \"@/utils\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nconst typographyVariants = cva(\"\", {\n variants: {\n variant: {\n h1: \"scroll-m-5 text-4xl font-extrabold tracking-tight lg:text-5xl\",\n h2: \"scroll-m-5 text-3xl font-semibold tracking-tight\",\n h3: \"scroll-m-5 text-2xl font-semibold tracking-tight\",\n h4: \"scroll-m-5 text-xl font-semibold tracking-tight\",\n h5: \"scroll-m-5 text-lg font-semibold tracking-tight\",\n h6: \"scroll-m-5 text-base font-semibold tracking-tight\",\n p: \"leading-7 [&:not(:first-child)]:mt-6\",\n blockquote: \"mt-6 border-l-2 border-slate-300 pl-6 italic\",\n list: \"my-6 ml-6 list-disc [&>li]:mt-2\",\n lead: \"text-xl text-muted-foreground\",\n large: \"text-lg font-semibold\",\n small: \"text-sm font-medium leading-none\",\n muted: \"text-sm text-muted-foreground\"\n },\n align: {\n left: \"text-left\",\n center: \"text-center\",\n right: \"text-right\",\n justify: \"text-justify\"\n }\n },\n defaultVariants: {\n variant: \"p\",\n align: \"left\"\n }\n})\n\nexport interface TypographyProps\n extends React.HTMLAttributes<HTMLElement>,\n VariantProps<typeof typographyVariants> {\n as?: React.ElementType\n}\n\n/**\n * Typography component for creating accessible text elements.\n * Built on top of shadcn/ui's Typography component.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-typography--docs\n *\n */\nconst Typography = React.forwardRef<HTMLElement, TypographyProps>(\n ({ className, variant, align, as: Component = \"p\", ...props }, ref) => {\n return (\n <Component\n className={cn(typographyVariants({ variant, align, className }))}\n ref={ref}\n {...props}\n />\n )\n }\n)\n\nTypography.displayName = \"Typography\"\n\nexport { Typography, typographyVariants }\n","\"use client\"\n\nimport * as React from \"react\"\nimport { Check, ChevronDown, X } from \"lucide-react\"\n\nimport { cn } from \"@/utils\"\n\nimport { Popover, PopoverContent, PopoverTrigger } from \"@radix-ui/react-popover\"\nimport { Button } from \"../button\"\nimport {\n Command,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator\n} from \"../command\"\nimport { Typography } from \"../typography\"\n\nexport type MultiSelectOption = {\n id: string\n label: string\n startIcon?: React.ReactNode\n endIcon?: React.ReactNode\n className?: string\n disabled?: boolean\n}\n\nexport type MultiSelectProps = {\n /** Whether the select is searchable */\n searchable?: boolean\n /** Whether the select should take up the full width of its container */\n fullWidth?: boolean\n /** Array of options to display in the select */\n options: MultiSelectOption[]\n /** Currently selected values */\n value: string[]\n /** Callback fired when the values change */\n // eslint-disable-next-line no-unused-vars\n onChange: (value: string[]) => void\n /** Render a custom CommandList for the select, if not provided, the select will render a default CommandList with the options */\n // eslint-disable-next-line no-unused-vars\n renderCommandList?: (options: MultiSelectOption[]) => React.ReactNode\n /** Placeholder text to show when no value is selected */\n placeholder?: string\n /** Whether the select is disabled */\n disabled?: boolean\n /** Whether the select is required */\n required?: boolean\n /** Error message to display */\n error?: string\n /** Additional class name for the select */\n className?: string\n /** ID for the select element */\n id?: string\n /** Maximum number of selections allowed */\n maxSelections?: number\n /** Whether to show the select all option */\n showSelectAll?: boolean\n}\n\n/**\n * MultiSelect component that provides a searchable dropdown select input with multiple selection.\n * Built on top of Radix UI's Select primitive.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs-atoms-multiselect--docs\n *\n * @example\n * ```tsx\n * <MultiSelect\n * options={[\n * { id: \"1\", label: \"Option 1\" },\n * { id: \"2\", label: \"Option 2\" }\n * ]}\n * value={[\"1\"]}\n * onChange={setValue}\n * showSelectAll\n * />\n * ```\n */\nexport function MultiSelect({\n options,\n value,\n onChange,\n placeholder = \"Select options\",\n disabled,\n required,\n error,\n className,\n fullWidth,\n searchable,\n id,\n maxSelections,\n showSelectAll,\n renderCommandList\n}: MultiSelectProps) {\n const [open, setOpen] = React.useState(false)\n const selectedOptions = options.filter((option) => value.includes(option.id))\n\n const handleSelect = (optionId: string) => {\n if (value.includes(optionId)) {\n onChange(value.filter((selectedId) => selectedId !== optionId))\n } else {\n if (maxSelections && value.length >= maxSelections) {\n return\n }\n onChange([...value, optionId])\n }\n }\n\n const handleSelectAll = () => {\n const enabledOptions = options.filter((option) => !option.disabled)\n if (value.length === enabledOptions.length) {\n onChange([])\n } else {\n onChange(enabledOptions.map((option) => option.id))\n }\n }\n\n const handleRemove = (optionId: string, e: React.MouseEvent) => {\n e.stopPropagation()\n onChange(value.filter((selectedId) => selectedId !== optionId))\n }\n\n return (\n <div className={cn(fullWidth && \"w-full\")}>\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <Button\n variant=\"outline\"\n role=\"combobox\"\n aria-expanded={open}\n aria-controls={id ? `${id}-content` : undefined}\n aria-label={placeholder}\n aria-required={required}\n aria-invalid={!!error}\n disabled={disabled}\n id={id}\n className={cn(\n \"w-[13rem] justify-between min-h-[2.5rem] h-auto\",\n !value.length && \"text-muted-foreground\",\n fullWidth && \"w-full\",\n error && \"border-destructive focus-visible:ring-destructive\",\n className\n )}\n >\n <div className=\"flex flex-wrap gap-1\">\n {selectedOptions.length > 0 ? (\n selectedOptions.map((option) => (\n <div\n key={option.id}\n className=\"flex items-center gap-1 bg-secondary text-secondary-foreground px-2 py-0.5 rounded-md text-sm\"\n >\n <span>{option.label}</span>\n <span\n onClick={(e) => handleRemove(option.id, e)}\n className=\"hover:bg-secondary-foreground/20 rounded-sm\"\n >\n <X className=\"h-3 w-3\" />\n </span>\n </div>\n ))\n ) : (\n <span>{placeholder}</span>\n )}\n </div>\n <ChevronDown className={cn(\"opacity-50\", open && \"rotate-180\")} />\n </Button>\n </PopoverTrigger>\n <PopoverContent\n id={id ? `${id}-content` : undefined}\n className={cn(\n \"w-[13rem] p-0 rounded-md border bg-popover text-popover-foreground shadow-md\",\n fullWidth && \"w-full\"\n )}\n align=\"start\"\n >\n <Command>\n {searchable && (\n <CommandInput placeholder=\"Search...\" className=\"h-9\" disabled={disabled} />\n )}\n <CommandList className=\"max-h-[12rem] overflow-y-auto\">\n <CommandEmpty>No items found.</CommandEmpty>\n <CommandGroup>\n {showSelectAll && (\n <CommandItem\n onSelect={handleSelectAll}\n className=\"flex items-center gap-2 cursor-pointer my-1\"\n >\n <div className=\"flex h-4 w-4 items-center justify-center rounded border border-primary\">\n {value.length === options.filter((o) => !o.disabled).length && (\n <Check className=\"h-3 w-3\" />\n )}\n </div>\n <Typography variant=\"small\">Select All</Typography>\n </CommandItem>\n )}\n <CommandSeparator />\n </CommandGroup>\n {renderCommandList ? (\n renderCommandList(options)\n ) : (\n <CommandGroup>\n {options.map((option) => (\n <CommandItem\n value={option.id}\n key={option.id}\n onSelect={() => handleSelect(option.id)}\n disabled={option.disabled}\n className={cn(\n \"flex items-center justify-between cursor-pointer my-1\",\n option.disabled && \"opacity-50 cursor-not-allowed\",\n option.className\n )}\n >\n <div className=\"flex items-center gap-2\">\n <div className=\"flex h-4 w-4 items-center justify-center rounded border border-primary\">\n {value.includes(option.id) && <Check className=\"h-3 w-3\" />}\n </div>\n <div className=\"flex items-center gap-1\">\n {option.startIcon && option.startIcon}\n <Typography variant=\"small\">{option.label}</Typography>\n </div>\n </div>\n {option.endIcon && <div className=\"ml-2\">{option.endIcon}</div>}\n </CommandItem>\n ))}\n </CommandGroup>\n )}\n </CommandList>\n </Command>\n </PopoverContent>\n </Popover>\n </div>\n )\n}\n","import * as React from \"react\"\nimport * as LabelPrimitive from \"@radix-ui/react-label\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/utils/index\"\n\nconst labelVariants = cva(\n \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n)\n\nexport interface LabelProps\n extends React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>,\n VariantProps<typeof labelVariants> {}\n\n/**\n * Label component for creating accessible labels.\n * Built on top of Radix UI's Label primitive.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-label--docs\n *\n */\nconst Label = React.forwardRef<React.ElementRef<typeof LabelPrimitive.Root>, LabelProps>(\n ({ className, ...props }, ref) => (\n <LabelPrimitive.Root ref={ref} className={cn(labelVariants(), className)} {...props} />\n )\n)\nLabel.displayName = LabelPrimitive.Root.displayName\n\nexport { Label }\n","\"use client\"\n\nimport * as React from \"react\"\nimport * as LabelPrimitive from \"@radix-ui/react-label\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport {\n Controller,\n FormProvider,\n useFormContext,\n type ControllerProps,\n type FieldPath,\n type FieldValues\n} from \"react-hook-form\"\n\nimport { cn } from \"@/utils/cn\"\nimport { Label } from \"@/components/atoms/label\"\n\nconst Form = FormProvider\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> = {\n name: TName\n}\n\nconst FormFieldContext = React.createContext<FormFieldContextValue>({} as FormFieldContextValue)\n\nconst FormField = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n )\n}\n\nconst useFormField = () => {\n const fieldContext = React.useContext(FormFieldContext)\n const itemContext = React.useContext(FormItemContext)\n const { getFieldState, formState } = useFormContext()\n\n const fieldState = getFieldState(fieldContext.name, formState)\n\n if (!fieldContext) {\n throw new Error(\"useFormField should be used within <FormField>\")\n }\n\n const { id } = itemContext\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState\n }\n}\n\ntype FormItemContextValue = {\n id: string\n}\n\nconst FormItemContext = React.createContext<FormItemContextValue>({} as FormItemContextValue)\n\nconst FormItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => {\n const id = React.useId()\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <div ref={ref} className={cn(\"space-y-2\", className)} {...props} />\n </FormItemContext.Provider>\n )\n }\n)\nFormItem.displayName = \"FormItem\"\n\nconst FormLabel = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>\n>(({ className, ...props }, ref) => {\n const { error, formItemId } = useFormField()\n\n return (\n <Label\n ref={ref}\n className={cn(error && \"text-destructive\", className)}\n htmlFor={formItemId}\n {...props}\n />\n )\n})\nFormLabel.displayName = \"FormLabel\"\n\nconst FormControl = React.forwardRef<\n React.ElementRef<typeof Slot>,\n React.ComponentPropsWithoutRef<typeof Slot>\n>(({ ...props }, ref) => {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField()\n\n return (\n <Slot\n ref={ref}\n id={formItemId}\n aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}\n aria-invalid={!!error}\n {...props}\n />\n )\n})\nFormControl.displayName = \"FormControl\"\n\nconst FormDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => {\n const { formDescriptionId } = useFormField()\n\n return (\n <p\n ref={ref}\n id={formDescriptionId}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n )\n})\nFormDescription.displayName = \"FormDescription\"\n\nconst FormMessage = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, children, ...props }, ref) => {\n const { error, formMessageId } = useFormField()\n const body = error ? String(error?.message ?? \"\") : children\n\n if (!body) {\n return null\n }\n\n return (\n <p\n ref={ref}\n id={formMessageId}\n className={cn(\"text-sm font-medium text-destructive\", className)}\n {...props}\n >\n {body}\n </p>\n )\n})\nFormMessage.displayName = \"FormMessage\"\n\nexport {\n useFormField,\n Form,\n FormItem,\n FormLabel,\n FormControl,\n FormDescription,\n FormMessage,\n FormField\n}\n","import * as React from \"react\"\nimport { useFormContext, type FieldValues, type FieldPath } from \"react-hook-form\"\nimport { MultiSelect } from \"@/components/atoms/select\"\n\nimport { cn } from \"@/utils/cn\"\nimport {\n FormControl,\n FormItem,\n FormMessage,\n FormLabel,\n FormDescription,\n FormField\n} from \"@/components/rhf/form\"\nimport { type RHFMultiSelectProps } from \"./rhf-multi-select.types\"\n\n// ----------------------------------------------------------------------\n\n/**\n * A multi-select component that integrates with React Hook Form.\n * Provides form validation, error handling, and accessibility features.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/molecules-rhf-rhfmultiselect--docs\n *\n * @example\n * ```tsx\n * <Form>\n * <RHFMultiSelect\n * name=\"countries\"\n * label=\"Countries\"\n * options={[\n * { id: \"us\", label: \"United States\" },\n * { id: \"ca\", label: \"Canada\" }\n * ]}\n *\n * />\n * </Form>\n * ```\n */\nexport function RHFMultiSelect<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n name,\n label,\n description,\n className,\n warningText,\n required,\n disabled,\n readOnly,\n placeholder,\n \"aria-label\": ariaLabel,\n \"aria-describedby\": ariaDescribedby,\n options,\n ...other\n}: RHFMultiSelectProps<TFieldValues, TName>) {\n const { control } = useFormContext<TFieldValues>()\n\n return (\n <FormField\n name={name}\n control={control}\n render={({ field, fieldState: { error } }) => {\n return (\n <FormItem>\n {label && (\n <FormLabel>\n {label}\n {required && <span className=\"text-destructive ml-1\">*</span>}\n </FormLabel>\n )}\n <FormControl>\n <MultiSelect\n {...field}\n options={options}\n value={field.value || []}\n onChange={field.onChange}\n className={cn(\n error && \"border-destructive focus-visible:ring-destructive\",\n className\n )}\n disabled={disabled || readOnly}\n required={required}\n placeholder={placeholder}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n aria-invalid={!!error}\n aria-required={required}\n {...other}\n />\n </FormControl>\n {description && <FormDescription>{description}</FormDescription>}\n {error && <FormMessage>{error.message}</FormMessage>}\n {!error && warningText && (\n <p className=\"text-sm text-yellow-600 dark:text-yellow-500\" role=\"alert\">\n {warningText}\n </p>\n )}\n </FormItem>\n )\n }}\n />\n )\n}\n"]}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { FieldValues, FieldPath } from 'react-hook-form';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* RadioGroup component that allows users to select a single option from a list.
|
|
8
|
-
* Built on top of Radix UI's RadioGroup primitive.
|
|
9
|
-
*
|
|
10
|
-
* @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-radio-group--docs
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```tsx
|
|
14
|
-
* <RadioGroup defaultValue="option-1">
|
|
15
|
-
* <RadioGroupItem value="option-1">Option 1</RadioGroupItem>
|
|
16
|
-
* <RadioGroupItem value="option-2">Option 2</RadioGroupItem>
|
|
17
|
-
* </RadioGroup>
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
declare const RadioGroup: React.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
21
|
-
|
|
22
|
-
interface RHFRadioButtonGroupOption {
|
|
23
|
-
label: string;
|
|
24
|
-
id: string;
|
|
25
|
-
size?: "default" | "sm" | "lg";
|
|
26
|
-
}
|
|
27
|
-
interface RHFRadioButtonGroupProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends Omit<React.ComponentProps<typeof RadioGroup>, "name"> {
|
|
28
|
-
/** The name of the field in the form */
|
|
29
|
-
name: TName;
|
|
30
|
-
/** Optional label for the field */
|
|
31
|
-
label?: string;
|
|
32
|
-
/** Optional description text below the field */
|
|
33
|
-
description?: string;
|
|
34
|
-
/** Optional warning text to display */
|
|
35
|
-
warningText?: string;
|
|
36
|
-
/** Whether the field is required */
|
|
37
|
-
required?: boolean;
|
|
38
|
-
/** Whether the field is disabled */
|
|
39
|
-
disabled?: boolean;
|
|
40
|
-
/** Whether the field is read-only */
|
|
41
|
-
readOnly?: boolean;
|
|
42
|
-
/** Optional aria-label for accessibility */
|
|
43
|
-
"aria-label"?: string;
|
|
44
|
-
/** Optional aria-describedby for accessibility */
|
|
45
|
-
"aria-describedby"?: string;
|
|
46
|
-
/** Radio button group options */
|
|
47
|
-
options: RHFRadioButtonGroupOption[];
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* A radio button group component that integrates with React Hook Form.
|
|
52
|
-
* Uses buttons instead of traditional radio inputs for a more modern look.
|
|
53
|
-
*
|
|
54
|
-
* @url https://sergii-melnykov.github.io/ui/?path=/docs/molecules-rhf-rhfradiobuttongroup--docs
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```tsx
|
|
58
|
-
* <Form>
|
|
59
|
-
* <RHFRadioButtonGroup
|
|
60
|
-
* name="preference"
|
|
61
|
-
* label="Select your preference"
|
|
62
|
-
* options={[
|
|
63
|
-
* { value: "option1", label: "Option 1" },
|
|
64
|
-
* { value: "option2", label: "Option 2" },
|
|
65
|
-
* { value: "option3", label: "Option 3" }
|
|
66
|
-
* ]}
|
|
67
|
-
* />
|
|
68
|
-
* </Form>
|
|
69
|
-
* ```
|
|
70
|
-
*/
|
|
71
|
-
declare function RHFRadioButtonGroup<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ name, label, description, className, warningText, required, disabled, readOnly, "aria-label": ariaLabel, "aria-describedby": ariaDescribedby, options, ...other }: RHFRadioButtonGroupProps<TFieldValues, TName>): react_jsx_runtime.JSX.Element;
|
|
72
|
-
|
|
73
|
-
export { RHFRadioButtonGroup, type RHFRadioButtonGroupOption, type RHFRadioButtonGroupProps };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';var reactHookForm=require('react-hook-form'),m=require('react'),u=require('@radix-ui/react-radio-group'),lucideReact=require('lucide-react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),G=require('@radix-ui/react-label'),classVarianceAuthority=require('class-variance-authority'),jsxRuntime=require('react/jsx-runtime'),reactSlot=require('@radix-ui/react-slot');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var m__namespace=/*#__PURE__*/_interopNamespace(m);var u__namespace=/*#__PURE__*/_interopNamespace(u);var G__namespace=/*#__PURE__*/_interopNamespace(G);function r(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var X=classVarianceAuthority.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),b=m__namespace.forwardRef(({className:e,...o},t)=>jsxRuntime.jsx(G__namespace.Root,{ref:t,className:r(X(),e),...o}));b.displayName=G__namespace.Root.displayName;var L=m__namespace.forwardRef(({className:e,...o},t)=>jsxRuntime.jsx(u__namespace.Root,{className:r("grid gap-3",e),...o,ref:t}));L.displayName=u__namespace.Root.displayName;var B=m__namespace.forwardRef(({className:e,...o},t)=>jsxRuntime.jsx(u__namespace.Item,{ref:t,className:r("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),...o,children:jsxRuntime.jsx(u__namespace.Indicator,{className:"flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Circle,{className:"h-3.5 w-3.5 fill-primary"})})}));B.displayName=u__namespace.Item.displayName;var S=m__namespace.forwardRef(({className:e,...o},t)=>jsxRuntime.jsx("div",{ref:t,className:r("flex items-center gap-2",e),...o}));S.displayName="RadioItemContainer";var W=m__namespace.forwardRef(({className:e,...o},t)=>jsxRuntime.jsx(b,{ref:t,className:r("text-sm font-medium leading-none cursor-pointer peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...o}));W.displayName="RadioItemLabel";var $=classVarianceAuthority.cva("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),E=m__namespace.forwardRef(({className:e,variant:o,size:t,asChild:a=false,startIcon:i,endIcon:s,loading:n=false,disabled:H,children:F,type:g="button","aria-label":M,...R},C)=>{let p=a?reactSlot.Slot:"button",l=H||n,d=M||(typeof F=="string"?F:void 0),O=h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),!l&&R.onClick&&R.onClick(h));};return a?jsxRuntime.jsx(p,{className:r($({variant:o,size:t,className:e})),ref:C,disabled:l,type:g,"aria-label":d,"aria-disabled":l,...R,children:F}):jsxRuntime.jsxs(p,{className:r($({variant:o,size:t,className:e})),ref:C,disabled:l,type:g,"aria-label":d,"aria-disabled":l,onKeyDown:O,...R,children:[n&&jsxRuntime.jsx(lucideReact.Loader2,{className:"mr-2 h-4 w-4 animate-spin",role:"status","aria-label":"Loading","aria-hidden":"true"}),!n&&i&&jsxRuntime.jsx("span",{className:"mr-2","aria-hidden":"true",children:i}),F,!n&&s&&jsxRuntime.jsx("span",{className:"ml-2","aria-hidden":"true",children:s})]})});E.displayName="Button";var z=m__namespace.createContext({}),D=({...e})=>jsxRuntime.jsx(z.Provider,{value:{name:e.name},children:jsxRuntime.jsx(reactHookForm.Controller,{...e})}),x=()=>{let e=m__namespace.useContext(z),o=m__namespace.useContext(K),{getFieldState:t,formState:a}=reactHookForm.useFormContext(),i=t(e.name,a);if(!e)throw new Error("useFormField should be used within <FormField>");let{id:s}=o;return {id:s,name:e.name,formItemId:`${s}-form-item`,formDescriptionId:`${s}-form-item-description`,formMessageId:`${s}-form-item-message`,...i}},K=m__namespace.createContext({}),I=m__namespace.forwardRef(({className:e,...o},t)=>{let a=m__namespace.useId();return jsxRuntime.jsx(K.Provider,{value:{id:a},children:jsxRuntime.jsx("div",{ref:t,className:r("space-y-2",e),...o})})});I.displayName="FormItem";var V=m__namespace.forwardRef(({className:e,...o},t)=>{let{error:a,formItemId:i}=x();return jsxRuntime.jsx(b,{ref:t,className:r(a&&"text-destructive",e),htmlFor:i,...o})});V.displayName="FormLabel";var w=m__namespace.forwardRef(({...e},o)=>{let{error:t,formItemId:a,formDescriptionId:i,formMessageId:s}=x();return jsxRuntime.jsx(reactSlot.Slot,{ref:o,id:a,"aria-describedby":t?`${i} ${s}`:`${i}`,"aria-invalid":!!t,...e})});w.displayName="FormControl";var P=m__namespace.forwardRef(({className:e,...o},t)=>{let{formDescriptionId:a}=x();return jsxRuntime.jsx("p",{ref:t,id:a,className:r("text-sm text-muted-foreground",e),...o})});P.displayName="FormDescription";var T=m__namespace.forwardRef(({className:e,children:o,...t},a)=>{let{error:i,formMessageId:s}=x(),n=i?String(i?.message??""):o;return n?jsxRuntime.jsx("p",{ref:a,id:s,className:r("text-sm font-medium text-destructive",e),...t,children:n}):null});T.displayName="FormMessage";function qe({name:e,label:o,description:t,className:a,warningText:i,required:s,disabled:n,readOnly:H,"aria-label":F,"aria-describedby":g,options:M,...R}){let{control:C}=reactHookForm.useFormContext();return jsxRuntime.jsx(D,{name:e,control:C,render:({field:p,fieldState:{error:l}})=>jsxRuntime.jsxs(I,{className:"space-y-3",children:[o&&jsxRuntime.jsxs(V,{children:[o,s&&jsxRuntime.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),jsxRuntime.jsx(w,{children:jsxRuntime.jsx(L,{onValueChange:p.onChange,defaultValue:p.value,disabled:n,"aria-label":F,"aria-describedby":g,"aria-invalid":!!l,"aria-required":s,className:"flex gap-2 p-2 border border-gray-200 rounded-md w-fit",...R,children:M.map(d=>jsxRuntime.jsx(E,{size:d.size??"sm",variant:p.value===d.id?"default":"secondary",onClick:()=>p.onChange(d.id),role:"radio","aria-checked":p.value===d.id,disabled:n,children:d.label},d.id))})}),t&&jsxRuntime.jsx(P,{children:t}),i&&jsxRuntime.jsx(P,{className:"text-warning",children:i}),l&&jsxRuntime.jsx(T,{children:l.message})]})})}exports.RHFRadioButtonGroup=qe;//# sourceMappingURL=rhf-radio-button-group.js.map
|
|
2
|
-
//# sourceMappingURL=rhf-radio-button-group.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/cn.ts","../../src/components/atoms/label/label.tsx","../../src/components/atoms/radio-group/radio-group.tsx","../../src/components/atoms/button/button.tsx","../../src/components/rhf/form/form.tsx","../../src/components/rhf/rhf-radio-button-group/rhf-radio-button-group.tsx"],"names":["cn","inputs","twMerge","clsx","labelVariants","cva","Label","k","className","props","ref","jsx","G","RadioGroup","v","u","RadioGroupItem","Circle","RadioItemContainer","RadioItemLabel","buttonVariants","Button","A","variant","size","asChild","startIcon","endIcon","loading","disabled","children","type","ariaLabel","Comp","Slot","isDisabled","buttonAriaLabel","handleKeyDown","event","jsxs","Loader2","FormFieldContext","m","FormField","Controller","useFormField","fieldContext","itemContext","FormItemContext","getFieldState","formState","useFormContext","fieldState","id","FormItem","FormLabel","error","formItemId","FormControl","formDescriptionId","formMessageId","FormDescription","FormMessage","body","RHFRadioButtonGroup","name","label","description","warningText","required","readOnly","ariaDescribedby","options","other","control","field","option"],"mappings":"m1BAGO,SAASA,CAAMC,CAAAA,GAAAA,CAAAA,CAAsB,CAC1C,OAAOC,qBAAQC,CAAAA,SAAAA,CAAKF,CAAM,CAAC,CAC7B,CCCA,IAAMG,CAAAA,CAAgBC,0BACpB,CAAA,4FACF,CAaMC,CAAAA,CAAAA,CAAcC,YAClB,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AAA,CAAA,CARHA,CAAO,CAAA,EASd,CACD,CACH,CAAA,CAAA,CACF,CACCT,CAAAA,CAAAA,EAAexD,cAACkD,CAAAA,CAAAA,CAAA,CAAiB,QAAA,CAAAM,CAAY,CAAA,CAAA,CAC7CC,CAAezD,EAAAA,cAAAA,CAACkD,CAAA,CAAA,CAAgB,SAAU,CAAA,cAAA,CAAgB,QAAAO,CAAAA,CAAAA,CAAY,CACtEZ,CAAAA,CAAAA,EAAS7C,cAACmD,CAAAA,CAAAA,CAAA,CAAa,QAAA,CAAAN,CAAM,CAAA,OAAA,CAAQ,CACxC,CAAA,CAAA,CAAA,CAEJ,CAEJ","file":"rhf-radio-button-group.js","sourcesContent":["import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","import * as React from \"react\"\nimport * as LabelPrimitive from \"@radix-ui/react-label\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/utils/index\"\n\nconst labelVariants = cva(\n \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n)\n\nexport interface LabelProps\n extends React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>,\n VariantProps<typeof labelVariants> {}\n\n/**\n * Label component for creating accessible labels.\n * Built on top of Radix UI's Label primitive.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-label--docs\n *\n */\nconst Label = React.forwardRef<React.ElementRef<typeof LabelPrimitive.Root>, LabelProps>(\n ({ className, ...props }, ref) => (\n <LabelPrimitive.Root ref={ref} className={cn(labelVariants(), className)} {...props} />\n )\n)\nLabel.displayName = LabelPrimitive.Root.displayName\n\nexport { Label }\n","import * as React from \"react\"\nimport * as RadioGroupPrimitive from \"@radix-ui/react-radio-group\"\nimport { Circle } from \"lucide-react\"\n\nimport { cn } from \"@/utils\"\nimport { Label } from \"@/components/atoms/label\"\n\n/**\n * RadioGroup component that allows users to select a single option from a list.\n * Built on top of Radix UI's RadioGroup primitive.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-radio-group--docs\n *\n * @example\n * ```tsx\n * <RadioGroup defaultValue=\"option-1\">\n * <RadioGroupItem value=\"option-1\">Option 1</RadioGroupItem>\n * <RadioGroupItem value=\"option-2\">Option 2</RadioGroupItem>\n * </RadioGroup>\n * ```\n */\nconst RadioGroup = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>\n>(({ className, ...props }, ref) => {\n return <RadioGroupPrimitive.Root className={cn(\"grid gap-3\", className)} {...props} ref={ref} />\n})\nRadioGroup.displayName = RadioGroupPrimitive.Root.displayName\n\n/**\n * RadioGroupItem component that represents a single option in a RadioGroup.\n * Built on top of Radix UI's RadioGroupItem primitive.\n *\n * @example\n * ```tsx\n * <RadioGroupItem value=\"option-1\">Option 1</RadioGroupItem>\n * ```\n */\nconst RadioGroupItem = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>\n>(({ className, ...props }, ref) => {\n return (\n <RadioGroupPrimitive.Item\n ref={ref}\n className={cn(\n \"aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n {...props}\n >\n <RadioGroupPrimitive.Indicator className=\"flex items-center justify-center\">\n <Circle className=\"h-3.5 w-3.5 fill-primary\" />\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n )\n})\nRadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName\n\n/**\n * RadioItemContainer component that provides a container for radio group items with proper spacing and layout.\n *\n * @example\n * ```tsx\n * <RadioItemContainer>\n * <RadioGroupItem value=\"option-1\">Option 1</RadioGroupItem>\n * <RadioGroupItem value=\"option-2\">Option 2</RadioGroupItem>\n * </RadioItemContainer>\n * ```\n */\nconst RadioItemContainer = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => {\n return <div ref={ref} className={cn(\"flex items-center gap-2\", className)} {...props} />\n }\n)\nRadioItemContainer.displayName = \"RadioItemContainer\"\n\n/**\n * RadioItemLabel component that provides a label for individual radio items.\n * Built on top of the Label component.\n *\n * @example\n * ```tsx\n * <RadioItemLabel>Select an option</RadioItemLabel>\n * ```\n */\nconst RadioItemLabel = React.forwardRef<\n React.ElementRef<typeof Label>,\n React.ComponentPropsWithoutRef<typeof Label>\n>(({ className, ...props }, ref) => {\n return (\n <Label\n ref={ref}\n className={cn(\n \"text-sm font-medium leading-none cursor-pointer peer-disabled:cursor-not-allowed peer-disabled:opacity-70\",\n className\n )}\n {...props}\n />\n )\n})\nRadioItemLabel.displayName = \"RadioItemLabel\"\n\nexport { RadioGroup, RadioGroupItem, RadioItemContainer, RadioItemLabel }\n","import * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport { cva } from \"class-variance-authority\"\nimport { cn } from \"@/utils/cn\"\nimport { Loader2 } from \"lucide-react\"\nimport { ButtonProps } from \"./button.types\"\n\n/**\n * Button variant styles using class-variance-authority.\n * Defines the visual styles for different button variants and sizes.\n * Follows WCAG 2.1 Level AA guidelines for accessibility.\n *\n * @example\n * ```tsx\n * <Button variant=\"primary\" size=\"lg\">Click me</Button>\n * ```\n */\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground shadow hover:bg-primary/90\",\n destructive: \"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90\",\n outline:\n \"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground\",\n secondary: \"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\"\n } as const,\n size: {\n default: \"h-9 px-4 py-2\",\n sm: \"h-8 rounded-md px-3 text-xs\",\n lg: \"h-10 rounded-md px-8\",\n icon: \"h-9 w-9\"\n } as const\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\"\n }\n }\n)\n\n/**\n * A versatile button component that supports multiple variants, sizes, and can be rendered as a child component.\n * Built on top of Radix UI's Slot primitive for maximum flexibility.\n * Implements proper accessibility features and follows WCAG 2.1 Level AA guidelines.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-button--docs\n *\n * @component\n * @example\n * ```tsx\n * // Default button\n * <Button>Click me</Button>\n *\n * // Destructive button with small size\n * <Button variant=\"destructive\" size=\"sm\">Delete</Button>\n *\n * // As a link\n * <Button variant=\"link\" asChild>\n * <a href=\"/about\">About</a>\n * </Button>\n *\n * // With icons\n * <Button startIcon={<Icon />}>With Start Icon</Button>\n * <Button endIcon={<Icon />}>With End Icon</Button>\n *\n * // Loading state\n * <Button loading>Loading</Button>\n * ```\n *\n * @param {ButtonProps} props - The component props\n * @param {React.Ref<HTMLButtonElement>} ref - Forwarded ref\n * @returns {JSX.Element} A button element\n */\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant,\n size,\n asChild = false,\n startIcon,\n endIcon,\n loading = false,\n disabled,\n children,\n type = \"button\",\n \"aria-label\": ariaLabel,\n ...props\n },\n ref\n ) => {\n const Comp = asChild ? Slot : \"button\"\n const isDisabled = disabled || loading\n const buttonAriaLabel = ariaLabel || (typeof children === \"string\" ? children : undefined)\n\n // Handle keyboard interaction\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault()\n if (!isDisabled && props.onClick) {\n props.onClick(event as unknown as React.MouseEvent<HTMLButtonElement>)\n }\n }\n }\n\n if (asChild) {\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n disabled={isDisabled}\n type={type}\n aria-label={buttonAriaLabel}\n aria-disabled={isDisabled}\n {...props}\n >\n {children}\n </Comp>\n )\n }\n\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n disabled={isDisabled}\n type={type}\n aria-label={buttonAriaLabel}\n aria-disabled={isDisabled}\n onKeyDown={handleKeyDown}\n {...props}\n >\n {loading && (\n <Loader2\n className=\"mr-2 h-4 w-4 animate-spin\"\n role=\"status\"\n aria-label=\"Loading\"\n aria-hidden=\"true\"\n />\n )}\n {!loading && startIcon && (\n <span className=\"mr-2\" aria-hidden=\"true\">\n {startIcon}\n </span>\n )}\n {children}\n {!loading && endIcon && (\n <span className=\"ml-2\" aria-hidden=\"true\">\n {endIcon}\n </span>\n )}\n </Comp>\n )\n }\n)\nButton.displayName = \"Button\"\n\nexport { Button, buttonVariants }\n","\"use client\"\n\nimport * as React from \"react\"\nimport * as LabelPrimitive from \"@radix-ui/react-label\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport {\n Controller,\n FormProvider,\n useFormContext,\n type ControllerProps,\n type FieldPath,\n type FieldValues\n} from \"react-hook-form\"\n\nimport { cn } from \"@/utils/cn\"\nimport { Label } from \"@/components/atoms/label\"\n\nconst Form = FormProvider\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> = {\n name: TName\n}\n\nconst FormFieldContext = React.createContext<FormFieldContextValue>({} as FormFieldContextValue)\n\nconst FormField = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n )\n}\n\nconst useFormField = () => {\n const fieldContext = React.useContext(FormFieldContext)\n const itemContext = React.useContext(FormItemContext)\n const { getFieldState, formState } = useFormContext()\n\n const fieldState = getFieldState(fieldContext.name, formState)\n\n if (!fieldContext) {\n throw new Error(\"useFormField should be used within <FormField>\")\n }\n\n const { id } = itemContext\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState\n }\n}\n\ntype FormItemContextValue = {\n id: string\n}\n\nconst FormItemContext = React.createContext<FormItemContextValue>({} as FormItemContextValue)\n\nconst FormItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => {\n const id = React.useId()\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <div ref={ref} className={cn(\"space-y-2\", className)} {...props} />\n </FormItemContext.Provider>\n )\n }\n)\nFormItem.displayName = \"FormItem\"\n\nconst FormLabel = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>\n>(({ className, ...props }, ref) => {\n const { error, formItemId } = useFormField()\n\n return (\n <Label\n ref={ref}\n className={cn(error && \"text-destructive\", className)}\n htmlFor={formItemId}\n {...props}\n />\n )\n})\nFormLabel.displayName = \"FormLabel\"\n\nconst FormControl = React.forwardRef<\n React.ElementRef<typeof Slot>,\n React.ComponentPropsWithoutRef<typeof Slot>\n>(({ ...props }, ref) => {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField()\n\n return (\n <Slot\n ref={ref}\n id={formItemId}\n aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}\n aria-invalid={!!error}\n {...props}\n />\n )\n})\nFormControl.displayName = \"FormControl\"\n\nconst FormDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => {\n const { formDescriptionId } = useFormField()\n\n return (\n <p\n ref={ref}\n id={formDescriptionId}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n )\n})\nFormDescription.displayName = \"FormDescription\"\n\nconst FormMessage = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, children, ...props }, ref) => {\n const { error, formMessageId } = useFormField()\n const body = error ? String(error?.message ?? \"\") : children\n\n if (!body) {\n return null\n }\n\n return (\n <p\n ref={ref}\n id={formMessageId}\n className={cn(\"text-sm font-medium text-destructive\", className)}\n {...props}\n >\n {body}\n </p>\n )\n})\nFormMessage.displayName = \"FormMessage\"\n\nexport {\n useFormField,\n Form,\n FormItem,\n FormLabel,\n FormControl,\n FormDescription,\n FormMessage,\n FormField\n}\n","import * as React from \"react\"\nimport { useFormContext, type FieldValues, type FieldPath } from \"react-hook-form\"\nimport { RadioGroup } from \"@/components/atoms/radio-group\"\nimport { Button } from \"@/components/atoms/button\"\nimport {\n FormControl,\n FormItem,\n FormMessage,\n FormLabel,\n FormDescription,\n FormField\n} from \"@/components/rhf/form\"\nimport { type RHFRadioButtonGroupProps } from \"./rhf-radio-button-group.types\"\n\n// ----------------------------------------------------------------------\n\n/**\n * A radio button group component that integrates with React Hook Form.\n * Uses buttons instead of traditional radio inputs for a more modern look.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/molecules-rhf-rhfradiobuttongroup--docs\n *\n * @example\n * ```tsx\n * <Form>\n * <RHFRadioButtonGroup\n * name=\"preference\"\n * label=\"Select your preference\"\n * options={[\n * { value: \"option1\", label: \"Option 1\" },\n * { value: \"option2\", label: \"Option 2\" },\n * { value: \"option3\", label: \"Option 3\" }\n * ]}\n * />\n * </Form>\n * ```\n */\nexport function RHFRadioButtonGroup<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n name,\n label,\n description,\n className,\n warningText,\n required,\n disabled,\n readOnly,\n \"aria-label\": ariaLabel,\n \"aria-describedby\": ariaDescribedby,\n options,\n ...other\n}: RHFRadioButtonGroupProps<TFieldValues, TName>) {\n const { control } = useFormContext<TFieldValues>()\n\n return (\n <FormField\n name={name}\n control={control}\n render={({ field, fieldState: { error } }) => (\n <FormItem className=\"space-y-3\">\n {label && (\n <FormLabel>\n {label}\n {required && <span className=\"text-destructive ml-1\">*</span>}\n </FormLabel>\n )}\n <FormControl>\n <RadioGroup\n onValueChange={field.onChange}\n defaultValue={field.value}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n aria-invalid={!!error}\n aria-required={required}\n className=\"flex gap-2 p-2 border border-gray-200 rounded-md w-fit\"\n {...other}\n >\n {options.map((option) => (\n <Button\n key={option.id}\n size={option.size ?? \"sm\"}\n variant={field.value === option.id ? \"default\" : \"secondary\"}\n onClick={() => field.onChange(option.id)}\n role=\"radio\"\n aria-checked={field.value === option.id}\n disabled={disabled}\n >\n {option.label}\n </Button>\n ))}\n </RadioGroup>\n </FormControl>\n {description && <FormDescription>{description}</FormDescription>}\n {warningText && <FormDescription className=\"text-warning\">{warningText}</FormDescription>}\n {error && <FormMessage>{error.message}</FormMessage>}\n </FormItem>\n )}\n />\n )\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/cn.ts","../../src/components/atoms/label/label.tsx","../../src/components/atoms/radio-group/radio-group.tsx","../../src/components/atoms/button/button.tsx","../../src/components/rhf/form/form.tsx","../../src/components/rhf/rhf-radio-button-group/rhf-radio-button-group.tsx"],"names":["cn","inputs","twMerge","clsx","labelVariants","cva","Label","k","className","props","ref","jsx","RadioGroup","v","RadioGroupItem","Circle","RadioItemContainer","RadioItemLabel","buttonVariants","Button","A","variant","size","asChild","startIcon","endIcon","loading","disabled","children","type","ariaLabel","Comp","Slot","isDisabled","buttonAriaLabel","handleKeyDown","event","jsxs","Loader2","FormFieldContext","FormField","Controller","useFormField","fieldContext","itemContext","FormItemContext","getFieldState","formState","useFormContext","fieldState","id","FormItem","FormLabel","error","formItemId","FormControl","formDescriptionId","formMessageId","FormDescription","FormMessage","body","RHFRadioButtonGroup","name","label","description","warningText","required","readOnly","ariaDescribedby","options","other","control","field","option"],"mappings":"yYAGO,SAASA,CAAMC,CAAAA,GAAAA,CAAAA,CAAsB,CAC1C,OAAOC,OAAQC,CAAAA,IAAAA,CAAKF,CAAM,CAAC,CAC7B,CCCA,IAAMG,CAAAA,CAAgBC,GACpB,CAAA,4FACF,CAaMC,CAAAA,CAAAA,CAAcC,CAClB,CAAA,UAAA,CAAA,CAAC,CAAE,SAAA,CAAAC,CAAW,CAAA,GAAGC,CAAM,CAAA,CAAGC,IACxBC,GAAgB,CAAA,CAAA,CAAA,IAAA,CAAf,CAAoB,GAAA,CAAKD,CAAK,CAAA,SAAA,CAAWV,CAAGI,CAAAA,CAAAA,EAAiBI,CAAAA,CAAS,CAAI,CAAA,GAAGC,CAAO,CAAA,CAEzF,EACAH,CAAM,CAAA,WAAA,CAA6B,CAAK,CAAA,IAAA,CAAA,WAAA,CCLxC,IAAMM,CAAmB,CAAAC,CAAA,CAAA,UAAA,CAGvB,CAAC,CAAE,SAAAL,CAAAA,CAAAA,CAAW,GAAGC,CAAM,CAAA,CAAGC,CACnBC,GAAAA,GAAAA,CAAqB,CAApB,CAAA,IAAA,CAAA,CAAyB,SAAWX,CAAAA,CAAAA,CAAG,YAAcQ,CAAAA,CAAS,CAAI,CAAA,GAAGC,CAAO,CAAA,GAAA,CAAKC,CAAK,CAAA,CAC/F,CACDE,CAAAA,CAAAA,CAAW,WAAkC,CAAA,CAAA,CAAA,IAAA,CAAK,WAWlD,CAAA,IAAME,CAAuB,CAAAD,CAAA,CAAA,UAAA,CAG3B,CAAC,CAAE,SAAAL,CAAAA,CAAAA,CAAW,GAAGC,CAAM,EAAGC,CAExBC,GAAAA,GAAAA,CAAqB,CAApB,CAAA,IAAA,CAAA,CACC,GAAKD,CAAAA,CAAAA,CACL,SAAWV,CAAAA,CAAAA,CACT,8LACAQ,CAAAA,CAC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UC,GAAAA,CAAAA,CAAO,EAAK,CAAA,SAAA,CAAY,WACjD,CAAA,OAAA,CAAS,IAAMD,CAAAA,CAAM,QAASC,CAAAA,CAAAA,CAAO,EAAE,CAAA,CACvC,IAAK,CAAA,OAAA,CACL,cAAcD,CAAAA,CAAAA,CAAM,KAAUC,GAAAA,CAAAA,CAAO,EACrC,CAAA,QAAA,CAAU9C,CAET,CAAA,QAAA,CAAA8C,CAAO,CAAA,KAAA,CAAA,CARHA,CAAO,CAAA,EASd,CACD,CACH,CAAA,CAAA,CACF,CACCT,CAAAA,CAAAA,EAAerD,GAAC+C,CAAAA,CAAAA,CAAA,CAAiB,QAAA,CAAAM,CAAY,CAAA,CAAA,CAC7CC,CAAetD,EAAAA,GAAAA,CAAC+C,CAAA,CAAA,CAAgB,SAAU,CAAA,cAAA,CAAgB,QAAAO,CAAAA,CAAAA,CAAY,CACtEZ,CAAAA,CAAAA,EAAS1C,GAACgD,CAAAA,CAAAA,CAAA,CAAa,QAAA,CAAAN,CAAM,CAAA,OAAA,CAAQ,CACxC,CAAA,CAAA,CAAA,CAEJ,CAEJ","file":"rhf-radio-button-group.mjs","sourcesContent":["import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","import * as React from \"react\"\nimport * as LabelPrimitive from \"@radix-ui/react-label\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/utils/index\"\n\nconst labelVariants = cva(\n \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n)\n\nexport interface LabelProps\n extends React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>,\n VariantProps<typeof labelVariants> {}\n\n/**\n * Label component for creating accessible labels.\n * Built on top of Radix UI's Label primitive.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-label--docs\n *\n */\nconst Label = React.forwardRef<React.ElementRef<typeof LabelPrimitive.Root>, LabelProps>(\n ({ className, ...props }, ref) => (\n <LabelPrimitive.Root ref={ref} className={cn(labelVariants(), className)} {...props} />\n )\n)\nLabel.displayName = LabelPrimitive.Root.displayName\n\nexport { Label }\n","import * as React from \"react\"\nimport * as RadioGroupPrimitive from \"@radix-ui/react-radio-group\"\nimport { Circle } from \"lucide-react\"\n\nimport { cn } from \"@/utils\"\nimport { Label } from \"@/components/atoms/label\"\n\n/**\n * RadioGroup component that allows users to select a single option from a list.\n * Built on top of Radix UI's RadioGroup primitive.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-radio-group--docs\n *\n * @example\n * ```tsx\n * <RadioGroup defaultValue=\"option-1\">\n * <RadioGroupItem value=\"option-1\">Option 1</RadioGroupItem>\n * <RadioGroupItem value=\"option-2\">Option 2</RadioGroupItem>\n * </RadioGroup>\n * ```\n */\nconst RadioGroup = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>\n>(({ className, ...props }, ref) => {\n return <RadioGroupPrimitive.Root className={cn(\"grid gap-3\", className)} {...props} ref={ref} />\n})\nRadioGroup.displayName = RadioGroupPrimitive.Root.displayName\n\n/**\n * RadioGroupItem component that represents a single option in a RadioGroup.\n * Built on top of Radix UI's RadioGroupItem primitive.\n *\n * @example\n * ```tsx\n * <RadioGroupItem value=\"option-1\">Option 1</RadioGroupItem>\n * ```\n */\nconst RadioGroupItem = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>\n>(({ className, ...props }, ref) => {\n return (\n <RadioGroupPrimitive.Item\n ref={ref}\n className={cn(\n \"aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n {...props}\n >\n <RadioGroupPrimitive.Indicator className=\"flex items-center justify-center\">\n <Circle className=\"h-3.5 w-3.5 fill-primary\" />\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n )\n})\nRadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName\n\n/**\n * RadioItemContainer component that provides a container for radio group items with proper spacing and layout.\n *\n * @example\n * ```tsx\n * <RadioItemContainer>\n * <RadioGroupItem value=\"option-1\">Option 1</RadioGroupItem>\n * <RadioGroupItem value=\"option-2\">Option 2</RadioGroupItem>\n * </RadioItemContainer>\n * ```\n */\nconst RadioItemContainer = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => {\n return <div ref={ref} className={cn(\"flex items-center gap-2\", className)} {...props} />\n }\n)\nRadioItemContainer.displayName = \"RadioItemContainer\"\n\n/**\n * RadioItemLabel component that provides a label for individual radio items.\n * Built on top of the Label component.\n *\n * @example\n * ```tsx\n * <RadioItemLabel>Select an option</RadioItemLabel>\n * ```\n */\nconst RadioItemLabel = React.forwardRef<\n React.ElementRef<typeof Label>,\n React.ComponentPropsWithoutRef<typeof Label>\n>(({ className, ...props }, ref) => {\n return (\n <Label\n ref={ref}\n className={cn(\n \"text-sm font-medium leading-none cursor-pointer peer-disabled:cursor-not-allowed peer-disabled:opacity-70\",\n className\n )}\n {...props}\n />\n )\n})\nRadioItemLabel.displayName = \"RadioItemLabel\"\n\nexport { RadioGroup, RadioGroupItem, RadioItemContainer, RadioItemLabel }\n","import * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport { cva } from \"class-variance-authority\"\nimport { cn } from \"@/utils/cn\"\nimport { Loader2 } from \"lucide-react\"\nimport { ButtonProps } from \"./button.types\"\n\n/**\n * Button variant styles using class-variance-authority.\n * Defines the visual styles for different button variants and sizes.\n * Follows WCAG 2.1 Level AA guidelines for accessibility.\n *\n * @example\n * ```tsx\n * <Button variant=\"primary\" size=\"lg\">Click me</Button>\n * ```\n */\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground shadow hover:bg-primary/90\",\n destructive: \"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90\",\n outline:\n \"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground\",\n secondary: \"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\"\n } as const,\n size: {\n default: \"h-9 px-4 py-2\",\n sm: \"h-8 rounded-md px-3 text-xs\",\n lg: \"h-10 rounded-md px-8\",\n icon: \"h-9 w-9\"\n } as const\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\"\n }\n }\n)\n\n/**\n * A versatile button component that supports multiple variants, sizes, and can be rendered as a child component.\n * Built on top of Radix UI's Slot primitive for maximum flexibility.\n * Implements proper accessibility features and follows WCAG 2.1 Level AA guidelines.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-button--docs\n *\n * @component\n * @example\n * ```tsx\n * // Default button\n * <Button>Click me</Button>\n *\n * // Destructive button with small size\n * <Button variant=\"destructive\" size=\"sm\">Delete</Button>\n *\n * // As a link\n * <Button variant=\"link\" asChild>\n * <a href=\"/about\">About</a>\n * </Button>\n *\n * // With icons\n * <Button startIcon={<Icon />}>With Start Icon</Button>\n * <Button endIcon={<Icon />}>With End Icon</Button>\n *\n * // Loading state\n * <Button loading>Loading</Button>\n * ```\n *\n * @param {ButtonProps} props - The component props\n * @param {React.Ref<HTMLButtonElement>} ref - Forwarded ref\n * @returns {JSX.Element} A button element\n */\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant,\n size,\n asChild = false,\n startIcon,\n endIcon,\n loading = false,\n disabled,\n children,\n type = \"button\",\n \"aria-label\": ariaLabel,\n ...props\n },\n ref\n ) => {\n const Comp = asChild ? Slot : \"button\"\n const isDisabled = disabled || loading\n const buttonAriaLabel = ariaLabel || (typeof children === \"string\" ? children : undefined)\n\n // Handle keyboard interaction\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault()\n if (!isDisabled && props.onClick) {\n props.onClick(event as unknown as React.MouseEvent<HTMLButtonElement>)\n }\n }\n }\n\n if (asChild) {\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n disabled={isDisabled}\n type={type}\n aria-label={buttonAriaLabel}\n aria-disabled={isDisabled}\n {...props}\n >\n {children}\n </Comp>\n )\n }\n\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n disabled={isDisabled}\n type={type}\n aria-label={buttonAriaLabel}\n aria-disabled={isDisabled}\n onKeyDown={handleKeyDown}\n {...props}\n >\n {loading && (\n <Loader2\n className=\"mr-2 h-4 w-4 animate-spin\"\n role=\"status\"\n aria-label=\"Loading\"\n aria-hidden=\"true\"\n />\n )}\n {!loading && startIcon && (\n <span className=\"mr-2\" aria-hidden=\"true\">\n {startIcon}\n </span>\n )}\n {children}\n {!loading && endIcon && (\n <span className=\"ml-2\" aria-hidden=\"true\">\n {endIcon}\n </span>\n )}\n </Comp>\n )\n }\n)\nButton.displayName = \"Button\"\n\nexport { Button, buttonVariants }\n","\"use client\"\n\nimport * as React from \"react\"\nimport * as LabelPrimitive from \"@radix-ui/react-label\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport {\n Controller,\n FormProvider,\n useFormContext,\n type ControllerProps,\n type FieldPath,\n type FieldValues\n} from \"react-hook-form\"\n\nimport { cn } from \"@/utils/cn\"\nimport { Label } from \"@/components/atoms/label\"\n\nconst Form = FormProvider\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> = {\n name: TName\n}\n\nconst FormFieldContext = React.createContext<FormFieldContextValue>({} as FormFieldContextValue)\n\nconst FormField = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n )\n}\n\nconst useFormField = () => {\n const fieldContext = React.useContext(FormFieldContext)\n const itemContext = React.useContext(FormItemContext)\n const { getFieldState, formState } = useFormContext()\n\n const fieldState = getFieldState(fieldContext.name, formState)\n\n if (!fieldContext) {\n throw new Error(\"useFormField should be used within <FormField>\")\n }\n\n const { id } = itemContext\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState\n }\n}\n\ntype FormItemContextValue = {\n id: string\n}\n\nconst FormItemContext = React.createContext<FormItemContextValue>({} as FormItemContextValue)\n\nconst FormItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => {\n const id = React.useId()\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <div ref={ref} className={cn(\"space-y-2\", className)} {...props} />\n </FormItemContext.Provider>\n )\n }\n)\nFormItem.displayName = \"FormItem\"\n\nconst FormLabel = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>\n>(({ className, ...props }, ref) => {\n const { error, formItemId } = useFormField()\n\n return (\n <Label\n ref={ref}\n className={cn(error && \"text-destructive\", className)}\n htmlFor={formItemId}\n {...props}\n />\n )\n})\nFormLabel.displayName = \"FormLabel\"\n\nconst FormControl = React.forwardRef<\n React.ElementRef<typeof Slot>,\n React.ComponentPropsWithoutRef<typeof Slot>\n>(({ ...props }, ref) => {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField()\n\n return (\n <Slot\n ref={ref}\n id={formItemId}\n aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}\n aria-invalid={!!error}\n {...props}\n />\n )\n})\nFormControl.displayName = \"FormControl\"\n\nconst FormDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => {\n const { formDescriptionId } = useFormField()\n\n return (\n <p\n ref={ref}\n id={formDescriptionId}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n )\n})\nFormDescription.displayName = \"FormDescription\"\n\nconst FormMessage = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, children, ...props }, ref) => {\n const { error, formMessageId } = useFormField()\n const body = error ? String(error?.message ?? \"\") : children\n\n if (!body) {\n return null\n }\n\n return (\n <p\n ref={ref}\n id={formMessageId}\n className={cn(\"text-sm font-medium text-destructive\", className)}\n {...props}\n >\n {body}\n </p>\n )\n})\nFormMessage.displayName = \"FormMessage\"\n\nexport {\n useFormField,\n Form,\n FormItem,\n FormLabel,\n FormControl,\n FormDescription,\n FormMessage,\n FormField\n}\n","import * as React from \"react\"\nimport { useFormContext, type FieldValues, type FieldPath } from \"react-hook-form\"\nimport { RadioGroup } from \"@/components/atoms/radio-group\"\nimport { Button } from \"@/components/atoms/button\"\nimport {\n FormControl,\n FormItem,\n FormMessage,\n FormLabel,\n FormDescription,\n FormField\n} from \"@/components/rhf/form\"\nimport { type RHFRadioButtonGroupProps } from \"./rhf-radio-button-group.types\"\n\n// ----------------------------------------------------------------------\n\n/**\n * A radio button group component that integrates with React Hook Form.\n * Uses buttons instead of traditional radio inputs for a more modern look.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/molecules-rhf-rhfradiobuttongroup--docs\n *\n * @example\n * ```tsx\n * <Form>\n * <RHFRadioButtonGroup\n * name=\"preference\"\n * label=\"Select your preference\"\n * options={[\n * { value: \"option1\", label: \"Option 1\" },\n * { value: \"option2\", label: \"Option 2\" },\n * { value: \"option3\", label: \"Option 3\" }\n * ]}\n * />\n * </Form>\n * ```\n */\nexport function RHFRadioButtonGroup<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n name,\n label,\n description,\n className,\n warningText,\n required,\n disabled,\n readOnly,\n \"aria-label\": ariaLabel,\n \"aria-describedby\": ariaDescribedby,\n options,\n ...other\n}: RHFRadioButtonGroupProps<TFieldValues, TName>) {\n const { control } = useFormContext<TFieldValues>()\n\n return (\n <FormField\n name={name}\n control={control}\n render={({ field, fieldState: { error } }) => (\n <FormItem className=\"space-y-3\">\n {label && (\n <FormLabel>\n {label}\n {required && <span className=\"text-destructive ml-1\">*</span>}\n </FormLabel>\n )}\n <FormControl>\n <RadioGroup\n onValueChange={field.onChange}\n defaultValue={field.value}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n aria-invalid={!!error}\n aria-required={required}\n className=\"flex gap-2 p-2 border border-gray-200 rounded-md w-fit\"\n {...other}\n >\n {options.map((option) => (\n <Button\n key={option.id}\n size={option.size ?? \"sm\"}\n variant={field.value === option.id ? \"default\" : \"secondary\"}\n onClick={() => field.onChange(option.id)}\n role=\"radio\"\n aria-checked={field.value === option.id}\n disabled={disabled}\n >\n {option.label}\n </Button>\n ))}\n </RadioGroup>\n </FormControl>\n {description && <FormDescription>{description}</FormDescription>}\n {warningText && <FormDescription className=\"text-warning\">{warningText}</FormDescription>}\n {error && <FormMessage>{error.message}</FormMessage>}\n </FormItem>\n )}\n />\n )\n}\n"]}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { FieldValues, FieldPath } from 'react-hook-form';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* RadioGroup component that allows users to select a single option from a list.
|
|
8
|
-
* Built on top of Radix UI's RadioGroup primitive.
|
|
9
|
-
*
|
|
10
|
-
* @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-radio-group--docs
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```tsx
|
|
14
|
-
* <RadioGroup defaultValue="option-1">
|
|
15
|
-
* <RadioGroupItem value="option-1">Option 1</RadioGroupItem>
|
|
16
|
-
* <RadioGroupItem value="option-2">Option 2</RadioGroupItem>
|
|
17
|
-
* </RadioGroup>
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
declare const RadioGroup: React.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
21
|
-
|
|
22
|
-
interface RHFRadioGroupOption {
|
|
23
|
-
label: string;
|
|
24
|
-
id: string;
|
|
25
|
-
}
|
|
26
|
-
interface RHFRadioGroupWithChildrenProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends Omit<React.ComponentProps<typeof RadioGroup>, "name"> {
|
|
27
|
-
/** The name of the field in the form */
|
|
28
|
-
name: TName;
|
|
29
|
-
/** Optional label for the field */
|
|
30
|
-
label?: string;
|
|
31
|
-
/** Optional description text below the field */
|
|
32
|
-
description?: string;
|
|
33
|
-
/** Optional warning text to display */
|
|
34
|
-
warningText?: string;
|
|
35
|
-
/** Whether the field is required */
|
|
36
|
-
required?: boolean;
|
|
37
|
-
/** Whether the field is disabled */
|
|
38
|
-
disabled?: boolean;
|
|
39
|
-
/** Whether the field is read-only */
|
|
40
|
-
readOnly?: boolean;
|
|
41
|
-
/** Optional aria-label for accessibility */
|
|
42
|
-
"aria-label"?: string;
|
|
43
|
-
/** Optional aria-describedby for accessibility */
|
|
44
|
-
"aria-describedby"?: string;
|
|
45
|
-
/** Children must be RadioGroupItem components */
|
|
46
|
-
children: React.ReactNode;
|
|
47
|
-
}
|
|
48
|
-
interface RHFRadioGroupWithOptionsProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends Omit<React.ComponentProps<typeof RadioGroup>, "name"> {
|
|
49
|
-
/** The name of the field in the form */
|
|
50
|
-
name: TName;
|
|
51
|
-
/** Optional label for the field */
|
|
52
|
-
label?: string;
|
|
53
|
-
/** radio group options */
|
|
54
|
-
options: RHFRadioGroupOption[];
|
|
55
|
-
/** Optional description text below the field */
|
|
56
|
-
description?: string;
|
|
57
|
-
/** Optional warning text to display */
|
|
58
|
-
warningText?: string;
|
|
59
|
-
/** Whether the field is required */
|
|
60
|
-
required?: boolean;
|
|
61
|
-
/** Whether the field is disabled */
|
|
62
|
-
disabled?: boolean;
|
|
63
|
-
/** Whether the field is read-only */
|
|
64
|
-
readOnly?: boolean;
|
|
65
|
-
/** Optional aria-label for accessibility */
|
|
66
|
-
"aria-label"?: string;
|
|
67
|
-
/** Optional aria-describedby for accessibility */
|
|
68
|
-
"aria-describedby"?: string;
|
|
69
|
-
}
|
|
70
|
-
type RHFRadioGroupProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = RHFRadioGroupWithChildrenProps<TFieldValues, TName> | RHFRadioGroupWithOptionsProps<TFieldValues, TName>;
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* A radio group component that integrates with React Hook Form.
|
|
74
|
-
* Provides form validation, error handling, and accessibility features.
|
|
75
|
-
*
|
|
76
|
-
* @url https://sergii-melnykov.github.io/ui/?path=/docs/molecules-rhf-rhfradiogroup--docs
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* ```tsx
|
|
80
|
-
* // Using children
|
|
81
|
-
* <Form>
|
|
82
|
-
* <RHFRadioGroup name="preference" label="Select your preference">
|
|
83
|
-
* <RadioGroupItem value="option1" label="Option 1" />
|
|
84
|
-
* <RadioGroupItem value="option2" label="Option 2" />
|
|
85
|
-
* </RHFRadioGroup>
|
|
86
|
-
* </Form>
|
|
87
|
-
*
|
|
88
|
-
* // Using options prop
|
|
89
|
-
* <Form>
|
|
90
|
-
* <RHFRadioGroup
|
|
91
|
-
* name="preference"
|
|
92
|
-
* label="Select your preference"
|
|
93
|
-
* options={[
|
|
94
|
-
* { id: "option1", label: "Option 1" },
|
|
95
|
-
* { id: "option2", label: "Option 2" }
|
|
96
|
-
* ]}
|
|
97
|
-
* />
|
|
98
|
-
* </Form>
|
|
99
|
-
* ```
|
|
100
|
-
*/
|
|
101
|
-
declare function RHFRadioGroup<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ name, label, description, className, warningText, required, disabled, readOnly, "aria-label": ariaLabel, "aria-describedby": ariaDescribedby, children, ...other }: RHFRadioGroupProps<TFieldValues, TName>): react_jsx_runtime.JSX.Element;
|
|
102
|
-
|
|
103
|
-
export { RHFRadioGroup };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';var reactHookForm=require('react-hook-form'),r=require('react'),l=require('@radix-ui/react-radio-group'),lucideReact=require('lucide-react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),h=require('@radix-ui/react-label'),classVarianceAuthority=require('class-variance-authority'),jsxRuntime=require('react/jsx-runtime'),reactSlot=require('@radix-ui/react-slot');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var r__namespace=/*#__PURE__*/_interopNamespace(r);var l__namespace=/*#__PURE__*/_interopNamespace(l);var h__namespace=/*#__PURE__*/_interopNamespace(h);function a(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var z=classVarianceAuthority.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),p=r__namespace.forwardRef(({className:e,...t},o)=>jsxRuntime.jsx(h__namespace.Root,{ref:o,className:a(z(),e),...t}));p.displayName=h__namespace.Root.displayName;var y=r__namespace.forwardRef(({className:e,...t},o)=>jsxRuntime.jsx(l__namespace.Root,{className:a("grid gap-3",e),...t,ref:o}));y.displayName=l__namespace.Root.displayName;var b=r__namespace.forwardRef(({className:e,...t},o)=>jsxRuntime.jsx(l__namespace.Item,{ref:o,className:a("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:jsxRuntime.jsx(l__namespace.Indicator,{className:"flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Circle,{className:"h-3.5 w-3.5 fill-primary"})})}));b.displayName=l__namespace.Item.displayName;var x=r__namespace.forwardRef(({className:e,...t},o)=>jsxRuntime.jsx("div",{ref:o,className:a("flex items-center gap-2",e),...t}));x.displayName="RadioItemContainer";var I=r__namespace.forwardRef(({className:e,...t},o)=>jsxRuntime.jsx(p,{ref:o,className:a("text-sm font-medium leading-none cursor-pointer peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...t}));I.displayName="RadioItemLabel";var E=r__namespace.createContext({}),G=({...e})=>jsxRuntime.jsx(E.Provider,{value:{name:e.name},children:jsxRuntime.jsx(reactHookForm.Controller,{...e})}),R=()=>{let e=r__namespace.useContext(E),t=r__namespace.useContext(D),{getFieldState:o,formState:i}=reactHookForm.useFormContext(),m=o(e.name,i);if(!e)throw new Error("useFormField should be used within <FormField>");let{id:s}=t;return {id:s,name:e.name,formItemId:`${s}-form-item`,formDescriptionId:`${s}-form-item-description`,formMessageId:`${s}-form-item-message`,...m}},D=r__namespace.createContext({}),C=r__namespace.forwardRef(({className:e,...t},o)=>{let i=r__namespace.useId();return jsxRuntime.jsx(D.Provider,{value:{id:i},children:jsxRuntime.jsx("div",{ref:o,className:a("space-y-2",e),...t})})});C.displayName="FormItem";var v=r__namespace.forwardRef(({className:e,...t},o)=>{let{error:i,formItemId:m}=R();return jsxRuntime.jsx(p,{ref:o,className:a(i&&"text-destructive",e),htmlFor:m,...t})});v.displayName="FormLabel";var L=r__namespace.forwardRef(({...e},t)=>{let{error:o,formItemId:i,formDescriptionId:m,formMessageId:s}=R();return jsxRuntime.jsx(reactSlot.Slot,{ref:t,id:i,"aria-describedby":o?`${m} ${s}`:`${m}`,"aria-invalid":!!o,...e})});L.displayName="FormControl";var V=r__namespace.forwardRef(({className:e,...t},o)=>{let{formDescriptionId:i}=R();return jsxRuntime.jsx("p",{ref:o,id:i,className:a("text-sm text-muted-foreground",e),...t})});V.displayName="FormDescription";var N=r__namespace.forwardRef(({className:e,children:t,...o},i)=>{let{error:m,formMessageId:s}=R(),F=m?String(m?.message??""):t;return F?jsxRuntime.jsx("p",{ref:i,id:s,className:a("text-sm font-medium text-destructive",e),...o,children:F}):null});N.displayName="FormMessage";function Te({name:e,label:t,description:o,className:i,warningText:m,required:s,disabled:F,readOnly:Y,"aria-label":S,"aria-describedby":W,children:O,...T}){let{control:$}=reactHookForm.useFormContext(),M="options"in T;return jsxRuntime.jsx(G,{name:e,control:$,render:({field:w,fieldState:{error:P}})=>jsxRuntime.jsxs(C,{className:"space-y-3",children:[t&&jsxRuntime.jsxs(v,{children:[t,s&&jsxRuntime.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),jsxRuntime.jsx(L,{children:jsxRuntime.jsxs(y,{onValueChange:w.onChange,defaultValue:w.value,disabled:F,"aria-label":S,"aria-describedby":W,"aria-invalid":!!P,"aria-required":s,...T,children:[M&&T.options.map(u=>jsxRuntime.jsxs(x,{children:[jsxRuntime.jsx(b,{value:u.id,id:u.id}),jsxRuntime.jsx(I,{htmlFor:u.id,children:u.label})]},u.id)),!M&&O]})}),o&&jsxRuntime.jsx(V,{children:o}),P&&jsxRuntime.jsx(N,{children:P.message}),!P&&m&&jsxRuntime.jsx("p",{className:"text-sm text-yellow-600 dark:text-yellow-500",role:"alert",children:m})]})})}exports.RHFRadioGroup=Te;//# sourceMappingURL=rhf-radio-group.js.map
|
|
2
|
-
//# sourceMappingURL=rhf-radio-group.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/cn.ts","../../src/components/atoms/label/label.tsx","../../src/components/atoms/radio-group/radio-group.tsx","../../src/components/rhf/form/form.tsx","../../src/components/rhf/rhf-radio-group/rhf-radio-group.tsx"],"names":["cn","inputs","twMerge","clsx","labelVariants","cva","Label","H","className","props","ref","jsx","h","RadioGroup","f","l","RadioGroupItem","Circle","RadioItemContainer","RadioItemLabel","FormFieldContext","r","FormField","Controller","useFormField","fieldContext","itemContext","FormItemContext","getFieldState","formState","useFormContext","fieldState","id","FormItem","FormLabel","error","formItemId","FormControl","formDescriptionId","formMessageId","Slot","FormDescription","FormMessage","children","body","RHFRadioGroup","name","label","description","warningText","required","disabled","readOnly","ariaLabel","ariaDescribedby","other","control","hasOptions","field","jsxs","option"],"mappings":"m1BAGO,SAASA,CAAAA,CAAAA,GAAMC,EAAsB,CAC1C,OAAOC,sBAAQC,SAAKF,CAAAA,CAAM,CAAC,CAC7B,CCCA,IAAMG,EAAgBC,0BACpB,CAAA,4FACF,EAaMC,CAAc,CAAAC,YAAA,CAAA,UAAA,CAClB,CAAC,CAAE,SAAA,CAAAC,EAAW,GAAGC,CAAM,EAAGC,CACxBC,GAAAA,cAAAA,CAAgBC,kBAAf,CAAoB,GAAA,CAAKF,EAAK,SAAWV,CAAAA,CAAAA,CAAGI,CAAc,EAAA,CAAGI,CAAS,CAAI,CAAA,GAAGC,EAAO,CAEzF,CAAA,CACAH,EAAM,WAA6B,CAAAM,YAAA,CAAA,IAAA,CAAK,YCLxC,IAAMC,CAAAA,CAAmBC,wBAGvB,CAAC,CAAE,UAAAN,CAAW,CAAA,GAAGC,CAAM,CAAA,CAAGC,IACnBC,cAAqB,CAAAI,YAAA,CAAA,IAAA,CAApB,CAAy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Aa,QAAA,CAAAP,EAAM,OAAQ,CAAA,CAAA,CACrC,CAACA,CAASc,EAAAA,CAAAA,EACTtC,eAAC,GAAE,CAAA,CAAA,SAAA,CAAU,+CAA+C,IAAK,CAAA,OAAA,CAC9D,SAAAsC,CACH,CAAA,CAAA,CAAA,CAEJ,EAEJ,CAEJ","file":"rhf-radio-group.js","sourcesContent":["import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","import * as React from \"react\"\nimport * as LabelPrimitive from \"@radix-ui/react-label\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/utils/index\"\n\nconst labelVariants = cva(\n \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n)\n\nexport interface LabelProps\n extends React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>,\n VariantProps<typeof labelVariants> {}\n\n/**\n * Label component for creating accessible labels.\n * Built on top of Radix UI's Label primitive.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-label--docs\n *\n */\nconst Label = React.forwardRef<React.ElementRef<typeof LabelPrimitive.Root>, LabelProps>(\n ({ className, ...props }, ref) => (\n <LabelPrimitive.Root ref={ref} className={cn(labelVariants(), className)} {...props} />\n )\n)\nLabel.displayName = LabelPrimitive.Root.displayName\n\nexport { Label }\n","import * as React from \"react\"\nimport * as RadioGroupPrimitive from \"@radix-ui/react-radio-group\"\nimport { Circle } from \"lucide-react\"\n\nimport { cn } from \"@/utils\"\nimport { Label } from \"@/components/atoms/label\"\n\n/**\n * RadioGroup component that allows users to select a single option from a list.\n * Built on top of Radix UI's RadioGroup primitive.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-radio-group--docs\n *\n * @example\n * ```tsx\n * <RadioGroup defaultValue=\"option-1\">\n * <RadioGroupItem value=\"option-1\">Option 1</RadioGroupItem>\n * <RadioGroupItem value=\"option-2\">Option 2</RadioGroupItem>\n * </RadioGroup>\n * ```\n */\nconst RadioGroup = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>\n>(({ className, ...props }, ref) => {\n return <RadioGroupPrimitive.Root className={cn(\"grid gap-3\", className)} {...props} ref={ref} />\n})\nRadioGroup.displayName = RadioGroupPrimitive.Root.displayName\n\n/**\n * RadioGroupItem component that represents a single option in a RadioGroup.\n * Built on top of Radix UI's RadioGroupItem primitive.\n *\n * @example\n * ```tsx\n * <RadioGroupItem value=\"option-1\">Option 1</RadioGroupItem>\n * ```\n */\nconst RadioGroupItem = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>\n>(({ className, ...props }, ref) => {\n return (\n <RadioGroupPrimitive.Item\n ref={ref}\n className={cn(\n \"aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n {...props}\n >\n <RadioGroupPrimitive.Indicator className=\"flex items-center justify-center\">\n <Circle className=\"h-3.5 w-3.5 fill-primary\" />\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n )\n})\nRadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName\n\n/**\n * RadioItemContainer component that provides a container for radio group items with proper spacing and layout.\n *\n * @example\n * ```tsx\n * <RadioItemContainer>\n * <RadioGroupItem value=\"option-1\">Option 1</RadioGroupItem>\n * <RadioGroupItem value=\"option-2\">Option 2</RadioGroupItem>\n * </RadioItemContainer>\n * ```\n */\nconst RadioItemContainer = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => {\n return <div ref={ref} className={cn(\"flex items-center gap-2\", className)} {...props} />\n }\n)\nRadioItemContainer.displayName = \"RadioItemContainer\"\n\n/**\n * RadioItemLabel component that provides a label for individual radio items.\n * Built on top of the Label component.\n *\n * @example\n * ```tsx\n * <RadioItemLabel>Select an option</RadioItemLabel>\n * ```\n */\nconst RadioItemLabel = React.forwardRef<\n React.ElementRef<typeof Label>,\n React.ComponentPropsWithoutRef<typeof Label>\n>(({ className, ...props }, ref) => {\n return (\n <Label\n ref={ref}\n className={cn(\n \"text-sm font-medium leading-none cursor-pointer peer-disabled:cursor-not-allowed peer-disabled:opacity-70\",\n className\n )}\n {...props}\n />\n )\n})\nRadioItemLabel.displayName = \"RadioItemLabel\"\n\nexport { RadioGroup, RadioGroupItem, RadioItemContainer, RadioItemLabel }\n","\"use client\"\n\nimport * as React from \"react\"\nimport * as LabelPrimitive from \"@radix-ui/react-label\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport {\n Controller,\n FormProvider,\n useFormContext,\n type ControllerProps,\n type FieldPath,\n type FieldValues\n} from \"react-hook-form\"\n\nimport { cn } from \"@/utils/cn\"\nimport { Label } from \"@/components/atoms/label\"\n\nconst Form = FormProvider\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> = {\n name: TName\n}\n\nconst FormFieldContext = React.createContext<FormFieldContextValue>({} as FormFieldContextValue)\n\nconst FormField = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n )\n}\n\nconst useFormField = () => {\n const fieldContext = React.useContext(FormFieldContext)\n const itemContext = React.useContext(FormItemContext)\n const { getFieldState, formState } = useFormContext()\n\n const fieldState = getFieldState(fieldContext.name, formState)\n\n if (!fieldContext) {\n throw new Error(\"useFormField should be used within <FormField>\")\n }\n\n const { id } = itemContext\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState\n }\n}\n\ntype FormItemContextValue = {\n id: string\n}\n\nconst FormItemContext = React.createContext<FormItemContextValue>({} as FormItemContextValue)\n\nconst FormItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => {\n const id = React.useId()\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <div ref={ref} className={cn(\"space-y-2\", className)} {...props} />\n </FormItemContext.Provider>\n )\n }\n)\nFormItem.displayName = \"FormItem\"\n\nconst FormLabel = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>\n>(({ className, ...props }, ref) => {\n const { error, formItemId } = useFormField()\n\n return (\n <Label\n ref={ref}\n className={cn(error && \"text-destructive\", className)}\n htmlFor={formItemId}\n {...props}\n />\n )\n})\nFormLabel.displayName = \"FormLabel\"\n\nconst FormControl = React.forwardRef<\n React.ElementRef<typeof Slot>,\n React.ComponentPropsWithoutRef<typeof Slot>\n>(({ ...props }, ref) => {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField()\n\n return (\n <Slot\n ref={ref}\n id={formItemId}\n aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}\n aria-invalid={!!error}\n {...props}\n />\n )\n})\nFormControl.displayName = \"FormControl\"\n\nconst FormDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => {\n const { formDescriptionId } = useFormField()\n\n return (\n <p\n ref={ref}\n id={formDescriptionId}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n )\n})\nFormDescription.displayName = \"FormDescription\"\n\nconst FormMessage = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, children, ...props }, ref) => {\n const { error, formMessageId } = useFormField()\n const body = error ? String(error?.message ?? \"\") : children\n\n if (!body) {\n return null\n }\n\n return (\n <p\n ref={ref}\n id={formMessageId}\n className={cn(\"text-sm font-medium text-destructive\", className)}\n {...props}\n >\n {body}\n </p>\n )\n})\nFormMessage.displayName = \"FormMessage\"\n\nexport {\n useFormField,\n Form,\n FormItem,\n FormLabel,\n FormControl,\n FormDescription,\n FormMessage,\n FormField\n}\n","import * as React from \"react\"\nimport { useFormContext, type FieldValues, type FieldPath } from \"react-hook-form\"\nimport {\n RadioGroup,\n RadioGroupItem,\n RadioItemLabel,\n RadioItemContainer\n} from \"@/components/atoms/radio-group\"\nimport {\n FormControl,\n FormItem,\n FormMessage,\n FormLabel,\n FormDescription,\n FormField\n} from \"@/components/rhf/form\"\nimport {\n RHFRadioGroupOption,\n type RHFRadioGroupProps,\n type RHFRadioGroupWithOptionsProps\n} from \"./rhf-radio-group.types\"\n\n// ----------------------------------------------------------------------\n\n/**\n * A radio group component that integrates with React Hook Form.\n * Provides form validation, error handling, and accessibility features.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/molecules-rhf-rhfradiogroup--docs\n *\n * @example\n * ```tsx\n * // Using children\n * <Form>\n * <RHFRadioGroup name=\"preference\" label=\"Select your preference\">\n * <RadioGroupItem value=\"option1\" label=\"Option 1\" />\n * <RadioGroupItem value=\"option2\" label=\"Option 2\" />\n * </RHFRadioGroup>\n * </Form>\n *\n * // Using options prop\n * <Form>\n * <RHFRadioGroup\n * name=\"preference\"\n * label=\"Select your preference\"\n * options={[\n * { id: \"option1\", label: \"Option 1\" },\n * { id: \"option2\", label: \"Option 2\" }\n * ]}\n * />\n * </Form>\n * ```\n */\nexport function RHFRadioGroup<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n name,\n label,\n description,\n className,\n warningText,\n required,\n disabled,\n readOnly,\n \"aria-label\": ariaLabel,\n \"aria-describedby\": ariaDescribedby,\n children,\n ...other\n}: RHFRadioGroupProps<TFieldValues, TName>) {\n const { control } = useFormContext<TFieldValues>()\n const hasOptions = \"options\" in other\n\n return (\n <FormField\n name={name}\n control={control}\n render={({ field, fieldState: { error } }) => (\n <FormItem className=\"space-y-3\">\n {label && (\n <FormLabel>\n {label}\n {required && <span className=\"text-destructive ml-1\">*</span>}\n </FormLabel>\n )}\n <FormControl>\n <RadioGroup\n onValueChange={field.onChange}\n defaultValue={field.value}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n aria-invalid={!!error}\n aria-required={required}\n {...other}\n >\n {hasOptions &&\n (other as RHFRadioGroupWithOptionsProps<TFieldValues, TName>).options.map(\n (option: RHFRadioGroupOption) => (\n <RadioItemContainer key={option.id}>\n <RadioGroupItem value={option.id} id={option.id} />\n <RadioItemLabel htmlFor={option.id}>{option.label}</RadioItemLabel>\n </RadioItemContainer>\n )\n )}\n {!hasOptions && children}\n </RadioGroup>\n </FormControl>\n {description && <FormDescription>{description}</FormDescription>}\n {error && <FormMessage>{error.message}</FormMessage>}\n {!error && warningText && (\n <p className=\"text-sm text-yellow-600 dark:text-yellow-500\" role=\"alert\">\n {warningText}\n </p>\n )}\n </FormItem>\n )}\n />\n )\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/cn.ts","../../src/components/atoms/label/label.tsx","../../src/components/atoms/radio-group/radio-group.tsx","../../src/components/rhf/form/form.tsx","../../src/components/rhf/rhf-radio-group/rhf-radio-group.tsx"],"names":["cn","inputs","twMerge","clsx","labelVariants","cva","Label","H","className","props","ref","jsx","RadioGroup","f","RadioGroupItem","Circle","RadioItemContainer","RadioItemLabel","FormFieldContext","FormField","Controller","useFormField","fieldContext","itemContext","FormItemContext","getFieldState","formState","useFormContext","fieldState","id","FormItem","FormLabel","error","formItemId","FormControl","formDescriptionId","formMessageId","Slot","FormDescription","FormMessage","children","body","RHFRadioGroup","name","label","description","warningText","required","disabled","readOnly","ariaLabel","ariaDescribedby","other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,CAAAA,CAChB,gBAAee,CACd,CAAA,GAAGK,CAEH,CAAA,QAAA,CAAA,CAAAE,GACEF,CAA6D,CAAA,OAAA,CAAQ,IACnEK,CACCD,EAAAA,IAAAA,CAACxC,EAAA,CACC,QAAA,CAAA,CAAAL,IAACG,CAAA,CAAA,CAAe,MAAO2C,CAAO,CAAA,EAAA,CAAI,GAAIA,CAAO,CAAA,EAAA,CAAI,EACjD9C,GAACM,CAAAA,CAAAA,CAAA,CAAe,OAAA,CAASwC,EAAO,EAAK,CAAA,QAAA,CAAAA,EAAO,KAAM,CAAA,CAAA,CAAA,CAAA,CAF3BA,EAAO,EAGhC,CAEJ,EACD,CAACH,CAAAA,EAAcd,GAClB,CACF,CAAA,CAAA,CACCK,GAAelC,GAAC2B,CAAAA,CAAAA,CAAA,CAAiB,QAAAO,CAAAA,CAAAA,CAAY,EAC7Cb,CAASrB,EAAAA,GAAAA,CAAC4B,EAAA,CAAa,QAAA,CAAAP,EAAM,OAAQ,CAAA,CAAA,CACrC,CAACA,CAASc,EAAAA,CAAAA,EACTnC,IAAC,GAAE,CAAA,CAAA,SAAA,CAAU,+CAA+C,IAAK,CAAA,OAAA,CAC9D,SAAAmC,CACH,CAAA,CAAA,CAAA,CAEJ,EAEJ,CAEJ","file":"rhf-radio-group.mjs","sourcesContent":["import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","import * as React from \"react\"\nimport * as LabelPrimitive from \"@radix-ui/react-label\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/utils/index\"\n\nconst labelVariants = cva(\n \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n)\n\nexport interface LabelProps\n extends React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>,\n VariantProps<typeof labelVariants> {}\n\n/**\n * Label component for creating accessible labels.\n * Built on top of Radix UI's Label primitive.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-label--docs\n *\n */\nconst Label = React.forwardRef<React.ElementRef<typeof LabelPrimitive.Root>, LabelProps>(\n ({ className, ...props }, ref) => (\n <LabelPrimitive.Root ref={ref} className={cn(labelVariants(), className)} {...props} />\n )\n)\nLabel.displayName = LabelPrimitive.Root.displayName\n\nexport { Label }\n","import * as React from \"react\"\nimport * as RadioGroupPrimitive from \"@radix-ui/react-radio-group\"\nimport { Circle } from \"lucide-react\"\n\nimport { cn } from \"@/utils\"\nimport { Label } from \"@/components/atoms/label\"\n\n/**\n * RadioGroup component that allows users to select a single option from a list.\n * Built on top of Radix UI's RadioGroup primitive.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-radio-group--docs\n *\n * @example\n * ```tsx\n * <RadioGroup defaultValue=\"option-1\">\n * <RadioGroupItem value=\"option-1\">Option 1</RadioGroupItem>\n * <RadioGroupItem value=\"option-2\">Option 2</RadioGroupItem>\n * </RadioGroup>\n * ```\n */\nconst RadioGroup = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>\n>(({ className, ...props }, ref) => {\n return <RadioGroupPrimitive.Root className={cn(\"grid gap-3\", className)} {...props} ref={ref} />\n})\nRadioGroup.displayName = RadioGroupPrimitive.Root.displayName\n\n/**\n * RadioGroupItem component that represents a single option in a RadioGroup.\n * Built on top of Radix UI's RadioGroupItem primitive.\n *\n * @example\n * ```tsx\n * <RadioGroupItem value=\"option-1\">Option 1</RadioGroupItem>\n * ```\n */\nconst RadioGroupItem = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>\n>(({ className, ...props }, ref) => {\n return (\n <RadioGroupPrimitive.Item\n ref={ref}\n className={cn(\n \"aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n {...props}\n >\n <RadioGroupPrimitive.Indicator className=\"flex items-center justify-center\">\n <Circle className=\"h-3.5 w-3.5 fill-primary\" />\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n )\n})\nRadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName\n\n/**\n * RadioItemContainer component that provides a container for radio group items with proper spacing and layout.\n *\n * @example\n * ```tsx\n * <RadioItemContainer>\n * <RadioGroupItem value=\"option-1\">Option 1</RadioGroupItem>\n * <RadioGroupItem value=\"option-2\">Option 2</RadioGroupItem>\n * </RadioItemContainer>\n * ```\n */\nconst RadioItemContainer = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => {\n return <div ref={ref} className={cn(\"flex items-center gap-2\", className)} {...props} />\n }\n)\nRadioItemContainer.displayName = \"RadioItemContainer\"\n\n/**\n * RadioItemLabel component that provides a label for individual radio items.\n * Built on top of the Label component.\n *\n * @example\n * ```tsx\n * <RadioItemLabel>Select an option</RadioItemLabel>\n * ```\n */\nconst RadioItemLabel = React.forwardRef<\n React.ElementRef<typeof Label>,\n React.ComponentPropsWithoutRef<typeof Label>\n>(({ className, ...props }, ref) => {\n return (\n <Label\n ref={ref}\n className={cn(\n \"text-sm font-medium leading-none cursor-pointer peer-disabled:cursor-not-allowed peer-disabled:opacity-70\",\n className\n )}\n {...props}\n />\n )\n})\nRadioItemLabel.displayName = \"RadioItemLabel\"\n\nexport { RadioGroup, RadioGroupItem, RadioItemContainer, RadioItemLabel }\n","\"use client\"\n\nimport * as React from \"react\"\nimport * as LabelPrimitive from \"@radix-ui/react-label\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport {\n Controller,\n FormProvider,\n useFormContext,\n type ControllerProps,\n type FieldPath,\n type FieldValues\n} from \"react-hook-form\"\n\nimport { cn } from \"@/utils/cn\"\nimport { Label } from \"@/components/atoms/label\"\n\nconst Form = FormProvider\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> = {\n name: TName\n}\n\nconst FormFieldContext = React.createContext<FormFieldContextValue>({} as FormFieldContextValue)\n\nconst FormField = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n )\n}\n\nconst useFormField = () => {\n const fieldContext = React.useContext(FormFieldContext)\n const itemContext = React.useContext(FormItemContext)\n const { getFieldState, formState } = useFormContext()\n\n const fieldState = getFieldState(fieldContext.name, formState)\n\n if (!fieldContext) {\n throw new Error(\"useFormField should be used within <FormField>\")\n }\n\n const { id } = itemContext\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState\n }\n}\n\ntype FormItemContextValue = {\n id: string\n}\n\nconst FormItemContext = React.createContext<FormItemContextValue>({} as FormItemContextValue)\n\nconst FormItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => {\n const id = React.useId()\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <div ref={ref} className={cn(\"space-y-2\", className)} {...props} />\n </FormItemContext.Provider>\n )\n }\n)\nFormItem.displayName = \"FormItem\"\n\nconst FormLabel = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>\n>(({ className, ...props }, ref) => {\n const { error, formItemId } = useFormField()\n\n return (\n <Label\n ref={ref}\n className={cn(error && \"text-destructive\", className)}\n htmlFor={formItemId}\n {...props}\n />\n )\n})\nFormLabel.displayName = \"FormLabel\"\n\nconst FormControl = React.forwardRef<\n React.ElementRef<typeof Slot>,\n React.ComponentPropsWithoutRef<typeof Slot>\n>(({ ...props }, ref) => {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField()\n\n return (\n <Slot\n ref={ref}\n id={formItemId}\n aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}\n aria-invalid={!!error}\n {...props}\n />\n )\n})\nFormControl.displayName = \"FormControl\"\n\nconst FormDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => {\n const { formDescriptionId } = useFormField()\n\n return (\n <p\n ref={ref}\n id={formDescriptionId}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n )\n})\nFormDescription.displayName = \"FormDescription\"\n\nconst FormMessage = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, children, ...props }, ref) => {\n const { error, formMessageId } = useFormField()\n const body = error ? String(error?.message ?? \"\") : children\n\n if (!body) {\n return null\n }\n\n return (\n <p\n ref={ref}\n id={formMessageId}\n className={cn(\"text-sm font-medium text-destructive\", className)}\n {...props}\n >\n {body}\n </p>\n )\n})\nFormMessage.displayName = \"FormMessage\"\n\nexport {\n useFormField,\n Form,\n FormItem,\n FormLabel,\n FormControl,\n FormDescription,\n FormMessage,\n FormField\n}\n","import * as React from \"react\"\nimport { useFormContext, type FieldValues, type FieldPath } from \"react-hook-form\"\nimport {\n RadioGroup,\n RadioGroupItem,\n RadioItemLabel,\n RadioItemContainer\n} from \"@/components/atoms/radio-group\"\nimport {\n FormControl,\n FormItem,\n FormMessage,\n FormLabel,\n FormDescription,\n FormField\n} from \"@/components/rhf/form\"\nimport {\n RHFRadioGroupOption,\n type RHFRadioGroupProps,\n type RHFRadioGroupWithOptionsProps\n} from \"./rhf-radio-group.types\"\n\n// ----------------------------------------------------------------------\n\n/**\n * A radio group component that integrates with React Hook Form.\n * Provides form validation, error handling, and accessibility features.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/molecules-rhf-rhfradiogroup--docs\n *\n * @example\n * ```tsx\n * // Using children\n * <Form>\n * <RHFRadioGroup name=\"preference\" label=\"Select your preference\">\n * <RadioGroupItem value=\"option1\" label=\"Option 1\" />\n * <RadioGroupItem value=\"option2\" label=\"Option 2\" />\n * </RHFRadioGroup>\n * </Form>\n *\n * // Using options prop\n * <Form>\n * <RHFRadioGroup\n * name=\"preference\"\n * label=\"Select your preference\"\n * options={[\n * { id: \"option1\", label: \"Option 1\" },\n * { id: \"option2\", label: \"Option 2\" }\n * ]}\n * />\n * </Form>\n * ```\n */\nexport function RHFRadioGroup<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n name,\n label,\n description,\n className,\n warningText,\n required,\n disabled,\n readOnly,\n \"aria-label\": ariaLabel,\n \"aria-describedby\": ariaDescribedby,\n children,\n ...other\n}: RHFRadioGroupProps<TFieldValues, TName>) {\n const { control } = useFormContext<TFieldValues>()\n const hasOptions = \"options\" in other\n\n return (\n <FormField\n name={name}\n control={control}\n render={({ field, fieldState: { error } }) => (\n <FormItem className=\"space-y-3\">\n {label && (\n <FormLabel>\n {label}\n {required && <span className=\"text-destructive ml-1\">*</span>}\n </FormLabel>\n )}\n <FormControl>\n <RadioGroup\n onValueChange={field.onChange}\n defaultValue={field.value}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n aria-invalid={!!error}\n aria-required={required}\n {...other}\n >\n {hasOptions &&\n (other as RHFRadioGroupWithOptionsProps<TFieldValues, TName>).options.map(\n (option: RHFRadioGroupOption) => (\n <RadioItemContainer key={option.id}>\n <RadioGroupItem value={option.id} id={option.id} />\n <RadioItemLabel htmlFor={option.id}>{option.label}</RadioItemLabel>\n </RadioItemContainer>\n )\n )}\n {!hasOptions && children}\n </RadioGroup>\n </FormControl>\n {description && <FormDescription>{description}</FormDescription>}\n {error && <FormMessage>{error.message}</FormMessage>}\n {!error && warningText && (\n <p className=\"text-sm text-yellow-600 dark:text-yellow-500\" role=\"alert\">\n {warningText}\n </p>\n )}\n </FormItem>\n )}\n />\n )\n}\n"]}
|