gladvn 0.2.14
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/README.md +112 -0
- package/bin/cli.js +326 -0
- package/dist/components/macro/accordion-preset.d.ts +14 -0
- package/dist/components/macro/accordion-preset.d.ts.map +1 -0
- package/dist/components/macro/alert-dialog-preset.d.ts +26 -0
- package/dist/components/macro/alert-dialog-preset.d.ts.map +1 -0
- package/dist/components/macro/alert-preset.d.ts +14 -0
- package/dist/components/macro/alert-preset.d.ts.map +1 -0
- package/dist/components/macro/avatar-preset.d.ts +11 -0
- package/dist/components/macro/avatar-preset.d.ts.map +1 -0
- package/dist/components/macro/breadcrumb-preset.d.ts +12 -0
- package/dist/components/macro/breadcrumb-preset.d.ts.map +1 -0
- package/dist/components/macro/card-preset.d.ts +10 -0
- package/dist/components/macro/card-preset.d.ts.map +1 -0
- package/dist/components/macro/carousel-preset.d.ts +18 -0
- package/dist/components/macro/carousel-preset.d.ts.map +1 -0
- package/dist/components/macro/checkbox-preset.d.ts +14 -0
- package/dist/components/macro/checkbox-preset.d.ts.map +1 -0
- package/dist/components/macro/combobox-preset.d.ts +27 -0
- package/dist/components/macro/combobox-preset.d.ts.map +1 -0
- package/dist/components/macro/command-preset.d.ts +16 -0
- package/dist/components/macro/command-preset.d.ts.map +1 -0
- package/dist/components/macro/date-picker.d.ts +62 -0
- package/dist/components/macro/date-picker.d.ts.map +1 -0
- package/dist/components/macro/dialog-preset.d.ts +24 -0
- package/dist/components/macro/dialog-preset.d.ts.map +1 -0
- package/dist/components/macro/empty-preset.d.ts +15 -0
- package/dist/components/macro/empty-preset.d.ts.map +1 -0
- package/dist/components/macro/field-preset.d.ts +15 -0
- package/dist/components/macro/field-preset.d.ts.map +1 -0
- package/dist/components/macro/index.d.ts +22 -0
- package/dist/components/macro/index.d.ts.map +1 -0
- package/dist/components/macro/input-otp-preset.d.ts +13 -0
- package/dist/components/macro/input-otp-preset.d.ts.map +1 -0
- package/dist/components/macro/input-preset.d.ts +21 -0
- package/dist/components/macro/input-preset.d.ts.map +1 -0
- package/dist/components/macro/pagination-preset.d.ts +13 -0
- package/dist/components/macro/pagination-preset.d.ts.map +1 -0
- package/dist/components/macro/progress-preset.d.ts +10 -0
- package/dist/components/macro/progress-preset.d.ts.map +1 -0
- package/dist/components/macro/radio-group-preset.d.ts +22 -0
- package/dist/components/macro/radio-group-preset.d.ts.map +1 -0
- package/dist/components/macro/select-preset.d.ts +42 -0
- package/dist/components/macro/select-preset.d.ts.map +1 -0
- package/dist/components/macro/slider-preset.d.ts +12 -0
- package/dist/components/macro/slider-preset.d.ts.map +1 -0
- package/dist/components/macro/switch-preset.d.ts +12 -0
- package/dist/components/macro/switch-preset.d.ts.map +1 -0
- package/dist/components/macro/tabs-preset.d.ts +17 -0
- package/dist/components/macro/tabs-preset.d.ts.map +1 -0
- package/dist/components/macro/textarea-preset.d.ts +17 -0
- package/dist/components/macro/textarea-preset.d.ts.map +1 -0
- package/dist/components/micro/accordion.d.ts +8 -0
- package/dist/components/micro/accordion.d.ts.map +1 -0
- package/dist/components/micro/alert-dialog.d.ts +33 -0
- package/dist/components/micro/alert-dialog.d.ts.map +1 -0
- package/dist/components/micro/alert.d.ts +28 -0
- package/dist/components/micro/alert.d.ts.map +1 -0
- package/dist/components/micro/aspect-ratio.d.ts +13 -0
- package/dist/components/micro/aspect-ratio.d.ts.map +1 -0
- package/dist/components/micro/avatar.d.ts +23 -0
- package/dist/components/micro/avatar.d.ts.map +1 -0
- package/dist/components/micro/badge.d.ts +16 -0
- package/dist/components/micro/badge.d.ts.map +1 -0
- package/dist/components/micro/breadcrumb.d.ts +24 -0
- package/dist/components/micro/breadcrumb.d.ts.map +1 -0
- package/dist/components/micro/button.d.ts +39 -0
- package/dist/components/micro/button.d.ts.map +1 -0
- package/dist/components/micro/calendar.d.ts +28 -0
- package/dist/components/micro/calendar.d.ts.map +1 -0
- package/dist/components/micro/card.d.ts +28 -0
- package/dist/components/micro/card.d.ts.map +1 -0
- package/dist/components/micro/carousel.d.ts +29 -0
- package/dist/components/micro/carousel.d.ts.map +1 -0
- package/dist/components/micro/chart.d.ts +49 -0
- package/dist/components/micro/chart.d.ts.map +1 -0
- package/dist/components/micro/checkbox.d.ts +17 -0
- package/dist/components/micro/checkbox.d.ts.map +1 -0
- package/dist/components/micro/collapsible.d.ts +15 -0
- package/dist/components/micro/collapsible.d.ts.map +1 -0
- package/dist/components/micro/combobox.d.ts +33 -0
- package/dist/components/micro/combobox.d.ts.map +1 -0
- package/dist/components/micro/command.d.ts +79 -0
- package/dist/components/micro/command.d.ts.map +1 -0
- package/dist/components/micro/context-menu.d.ts +60 -0
- package/dist/components/micro/context-menu.d.ts.map +1 -0
- package/dist/components/micro/dialog.d.ts +14 -0
- package/dist/components/micro/dialog.d.ts.map +1 -0
- package/dist/components/micro/direction.d.ts +2 -0
- package/dist/components/micro/direction.d.ts.map +1 -0
- package/dist/components/micro/drawer.d.ts +17 -0
- package/dist/components/micro/drawer.d.ts.map +1 -0
- package/dist/components/micro/dropdown-menu.d.ts +37 -0
- package/dist/components/micro/dropdown-menu.d.ts.map +1 -0
- package/dist/components/micro/empty.d.ts +23 -0
- package/dist/components/micro/empty.d.ts.map +1 -0
- package/dist/components/micro/field.d.ts +29 -0
- package/dist/components/micro/field.d.ts.map +1 -0
- package/dist/components/micro/hover-card.d.ts +17 -0
- package/dist/components/micro/hover-card.d.ts.map +1 -0
- package/dist/components/micro/input-group.d.ts +17 -0
- package/dist/components/micro/input-group.d.ts.map +1 -0
- package/dist/components/micro/input-otp.d.ts +44 -0
- package/dist/components/micro/input-otp.d.ts.map +1 -0
- package/dist/components/micro/input.d.ts +22 -0
- package/dist/components/micro/input.d.ts.map +1 -0
- package/dist/components/micro/item.d.ts +31 -0
- package/dist/components/micro/item.d.ts.map +1 -0
- package/dist/components/micro/kbd.d.ts +9 -0
- package/dist/components/micro/kbd.d.ts.map +1 -0
- package/dist/components/micro/label.d.ts +15 -0
- package/dist/components/micro/label.d.ts.map +1 -0
- package/dist/components/micro/menubar.d.ts +41 -0
- package/dist/components/micro/menubar.d.ts.map +1 -0
- package/dist/components/micro/navigation-menu.d.ts +18 -0
- package/dist/components/micro/navigation-menu.d.ts.map +1 -0
- package/dist/components/micro/pagination.d.ts +33 -0
- package/dist/components/micro/pagination.d.ts.map +1 -0
- package/dist/components/micro/popover.d.ts +23 -0
- package/dist/components/micro/popover.d.ts.map +1 -0
- package/dist/components/micro/progress.d.ts +19 -0
- package/dist/components/micro/progress.d.ts.map +1 -0
- package/dist/components/micro/radio-group.d.ts +13 -0
- package/dist/components/micro/radio-group.d.ts.map +1 -0
- package/dist/components/micro/resizable.d.ts +12 -0
- package/dist/components/micro/resizable.d.ts.map +1 -0
- package/dist/components/micro/scroll-area.d.ts +12 -0
- package/dist/components/micro/scroll-area.d.ts.map +1 -0
- package/dist/components/micro/select.d.ts +21 -0
- package/dist/components/micro/select.d.ts.map +1 -0
- package/dist/components/micro/separator.d.ts +9 -0
- package/dist/components/micro/separator.d.ts.map +1 -0
- package/dist/components/micro/sheet.d.ts +17 -0
- package/dist/components/micro/sheet.d.ts.map +1 -0
- package/dist/components/micro/sidebar.d.ts +28 -0
- package/dist/components/micro/sidebar.d.ts.map +1 -0
- package/dist/components/micro/skeleton.d.ts +9 -0
- package/dist/components/micro/skeleton.d.ts.map +1 -0
- package/dist/components/micro/slider.d.ts +14 -0
- package/dist/components/micro/slider.d.ts.map +1 -0
- package/dist/components/micro/sonner.d.ts +5 -0
- package/dist/components/micro/sonner.d.ts.map +1 -0
- package/dist/components/micro/spinner.d.ts +21 -0
- package/dist/components/micro/spinner.d.ts.map +1 -0
- package/dist/components/micro/switch.d.ts +13 -0
- package/dist/components/micro/switch.d.ts.map +1 -0
- package/dist/components/micro/table.d.ts +17 -0
- package/dist/components/micro/table.d.ts.map +1 -0
- package/dist/components/micro/tabs.d.ts +13 -0
- package/dist/components/micro/tabs.d.ts.map +1 -0
- package/dist/components/micro/textarea.d.ts +17 -0
- package/dist/components/micro/textarea.d.ts.map +1 -0
- package/dist/components/micro/theme-provider.d.ts +76 -0
- package/dist/components/micro/theme-provider.d.ts.map +1 -0
- package/dist/components/micro/toggle-group.d.ts +22 -0
- package/dist/components/micro/toggle-group.d.ts.map +1 -0
- package/dist/components/micro/toggle.d.ts +16 -0
- package/dist/components/micro/toggle.d.ts.map +1 -0
- package/dist/components/micro/tooltip.d.ts +20 -0
- package/dist/components/micro/tooltip.d.ts.map +1 -0
- package/dist/dev/App.d.ts +3 -0
- package/dist/dev/App.d.ts.map +1 -0
- package/dist/dev/components/GladcnLogo.d.ts +10 -0
- package/dist/dev/components/GladcnLogo.d.ts.map +1 -0
- package/dist/dev/components/code-highlighter.d.ts +5 -0
- package/dist/dev/components/code-highlighter.d.ts.map +1 -0
- package/dist/dev/components/dev-context.d.ts +12 -0
- package/dist/dev/components/dev-context.d.ts.map +1 -0
- package/dist/dev/components/showcase.d.ts +72 -0
- package/dist/dev/components/showcase.d.ts.map +1 -0
- package/dist/dev/data.d.ts +68 -0
- package/dist/dev/data.d.ts.map +1 -0
- package/dist/dev/main.d.ts +1 -0
- package/dist/dev/main.d.ts.map +1 -0
- package/dist/dev/sections/buttons.d.ts +2 -0
- package/dist/dev/sections/buttons.d.ts.map +1 -0
- package/dist/dev/sections/display.d.ts +2 -0
- package/dist/dev/sections/display.d.ts.map +1 -0
- package/dist/dev/sections/feedback.d.ts +2 -0
- package/dist/dev/sections/feedback.d.ts.map +1 -0
- package/dist/dev/sections/forms.d.ts +2 -0
- package/dist/dev/sections/forms.d.ts.map +1 -0
- package/dist/dev/sections/interactive.d.ts +2 -0
- package/dist/dev/sections/interactive.d.ts.map +1 -0
- package/dist/dev/sections/overview.d.ts +2 -0
- package/dist/dev/sections/overview.d.ts.map +1 -0
- package/dist/dev/showcase/accordion.d.ts +2 -0
- package/dist/dev/showcase/accordion.d.ts.map +1 -0
- package/dist/dev/showcase/alert-dialog.d.ts +2 -0
- package/dist/dev/showcase/alert-dialog.d.ts.map +1 -0
- package/dist/dev/showcase/alert.d.ts +2 -0
- package/dist/dev/showcase/alert.d.ts.map +1 -0
- package/dist/dev/showcase/aspect-ratio.d.ts +2 -0
- package/dist/dev/showcase/aspect-ratio.d.ts.map +1 -0
- package/dist/dev/showcase/avatar.d.ts +2 -0
- package/dist/dev/showcase/avatar.d.ts.map +1 -0
- package/dist/dev/showcase/badge.d.ts +2 -0
- package/dist/dev/showcase/badge.d.ts.map +1 -0
- package/dist/dev/showcase/breadcrumb.d.ts +2 -0
- package/dist/dev/showcase/breadcrumb.d.ts.map +1 -0
- package/dist/dev/showcase/button.d.ts +2 -0
- package/dist/dev/showcase/button.d.ts.map +1 -0
- package/dist/dev/showcase/calendar.d.ts +2 -0
- package/dist/dev/showcase/calendar.d.ts.map +1 -0
- package/dist/dev/showcase/card.d.ts +2 -0
- package/dist/dev/showcase/card.d.ts.map +1 -0
- package/dist/dev/showcase/carousel.d.ts +2 -0
- package/dist/dev/showcase/carousel.d.ts.map +1 -0
- package/dist/dev/showcase/chart.d.ts +2 -0
- package/dist/dev/showcase/chart.d.ts.map +1 -0
- package/dist/dev/showcase/checkbox.d.ts +2 -0
- package/dist/dev/showcase/checkbox.d.ts.map +1 -0
- package/dist/dev/showcase/collapsible.d.ts +3 -0
- package/dist/dev/showcase/collapsible.d.ts.map +1 -0
- package/dist/dev/showcase/combobox.d.ts +2 -0
- package/dist/dev/showcase/combobox.d.ts.map +1 -0
- package/dist/dev/showcase/command.d.ts +2 -0
- package/dist/dev/showcase/command.d.ts.map +1 -0
- package/dist/dev/showcase/context-menu.d.ts +2 -0
- package/dist/dev/showcase/context-menu.d.ts.map +1 -0
- package/dist/dev/showcase/dialog.d.ts +2 -0
- package/dist/dev/showcase/dialog.d.ts.map +1 -0
- package/dist/dev/showcase/drawer.d.ts +2 -0
- package/dist/dev/showcase/drawer.d.ts.map +1 -0
- package/dist/dev/showcase/dropdown-menu.d.ts +2 -0
- package/dist/dev/showcase/dropdown-menu.d.ts.map +1 -0
- package/dist/dev/showcase/empty.d.ts +2 -0
- package/dist/dev/showcase/empty.d.ts.map +1 -0
- package/dist/dev/showcase/hover-card.d.ts +2 -0
- package/dist/dev/showcase/hover-card.d.ts.map +1 -0
- package/dist/dev/showcase/input-group.d.ts +2 -0
- package/dist/dev/showcase/input-group.d.ts.map +1 -0
- package/dist/dev/showcase/input-otp.d.ts +2 -0
- package/dist/dev/showcase/input-otp.d.ts.map +1 -0
- package/dist/dev/showcase/input.d.ts +2 -0
- package/dist/dev/showcase/input.d.ts.map +1 -0
- package/dist/dev/showcase/item.d.ts +2 -0
- package/dist/dev/showcase/item.d.ts.map +1 -0
- package/dist/dev/showcase/kbd.d.ts +2 -0
- package/dist/dev/showcase/kbd.d.ts.map +1 -0
- package/dist/dev/showcase/label.d.ts +2 -0
- package/dist/dev/showcase/label.d.ts.map +1 -0
- package/dist/dev/showcase/menubar.d.ts +2 -0
- package/dist/dev/showcase/menubar.d.ts.map +1 -0
- package/dist/dev/showcase/navigation-menu.d.ts +3 -0
- package/dist/dev/showcase/navigation-menu.d.ts.map +1 -0
- package/dist/dev/showcase/overview.d.ts +2 -0
- package/dist/dev/showcase/overview.d.ts.map +1 -0
- package/dist/dev/showcase/pagination.d.ts +2 -0
- package/dist/dev/showcase/pagination.d.ts.map +1 -0
- package/dist/dev/showcase/popover.d.ts +2 -0
- package/dist/dev/showcase/popover.d.ts.map +1 -0
- package/dist/dev/showcase/progress.d.ts +2 -0
- package/dist/dev/showcase/progress.d.ts.map +1 -0
- package/dist/dev/showcase/radio-group.d.ts +2 -0
- package/dist/dev/showcase/radio-group.d.ts.map +1 -0
- package/dist/dev/showcase/resizable.d.ts +2 -0
- package/dist/dev/showcase/resizable.d.ts.map +1 -0
- package/dist/dev/showcase/scroll-area.d.ts +2 -0
- package/dist/dev/showcase/scroll-area.d.ts.map +1 -0
- package/dist/dev/showcase/select.d.ts +2 -0
- package/dist/dev/showcase/select.d.ts.map +1 -0
- package/dist/dev/showcase/separator.d.ts +2 -0
- package/dist/dev/showcase/separator.d.ts.map +1 -0
- package/dist/dev/showcase/sheet.d.ts +2 -0
- package/dist/dev/showcase/sheet.d.ts.map +1 -0
- package/dist/dev/showcase/sidebar.d.ts +2 -0
- package/dist/dev/showcase/sidebar.d.ts.map +1 -0
- package/dist/dev/showcase/skeleton.d.ts +2 -0
- package/dist/dev/showcase/skeleton.d.ts.map +1 -0
- package/dist/dev/showcase/slider.d.ts +2 -0
- package/dist/dev/showcase/slider.d.ts.map +1 -0
- package/dist/dev/showcase/sonner.d.ts +2 -0
- package/dist/dev/showcase/sonner.d.ts.map +1 -0
- package/dist/dev/showcase/spinner.d.ts +2 -0
- package/dist/dev/showcase/spinner.d.ts.map +1 -0
- package/dist/dev/showcase/switch.d.ts +2 -0
- package/dist/dev/showcase/switch.d.ts.map +1 -0
- package/dist/dev/showcase/table.d.ts +2 -0
- package/dist/dev/showcase/table.d.ts.map +1 -0
- package/dist/dev/showcase/tabs.d.ts +2 -0
- package/dist/dev/showcase/tabs.d.ts.map +1 -0
- package/dist/dev/showcase/textarea.d.ts +2 -0
- package/dist/dev/showcase/textarea.d.ts.map +1 -0
- package/dist/dev/showcase/theme-provider.d.ts +2 -0
- package/dist/dev/showcase/theme-provider.d.ts.map +1 -0
- package/dist/dev/showcase/toast.d.ts +2 -0
- package/dist/dev/showcase/toast.d.ts.map +1 -0
- package/dist/dev/showcase/toggle-group.d.ts +2 -0
- package/dist/dev/showcase/toggle-group.d.ts.map +1 -0
- package/dist/dev/showcase/toggle.d.ts +2 -0
- package/dist/dev/showcase/toggle.d.ts.map +1 -0
- package/dist/dev/showcase/tooltip.d.ts +2 -0
- package/dist/dev/showcase/tooltip.d.ts.map +1 -0
- package/dist/hooks/use-controllable-state.d.ts +14 -0
- package/dist/hooks/use-controllable-state.d.ts.map +1 -0
- package/dist/hooks/use-mobile.d.ts +2 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/index.cjs +5099 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +58 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4740 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/types.d.ts +4 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/preset.d.ts +18 -0
- package/dist/preset.d.ts.map +1 -0
- package/dist/test/setup.d.ts +1 -0
- package/dist/test/setup.d.ts.map +1 -0
- package/llms.txt +74 -0
- package/package.json +117 -0
- package/scripts/add-icononly-prop.ts +84 -0
- package/scripts/audit-best-practices.ts +114 -0
- package/scripts/audit-showcase.ts +262 -0
- package/scripts/audit-showcases.ts +83 -0
- package/scripts/clean-imports.ts +21 -0
- package/scripts/count_missing.ts +24 -0
- package/scripts/find-css-vars.ts +62 -0
- package/scripts/fix-portals.ts +90 -0
- package/scripts/full-audit.ts +89 -0
- package/scripts/merge-components.cjs +65 -0
- package/scripts/merge-components.js +64 -0
- package/scripts/optimize-barrel.ts +116 -0
- package/scripts/postinstall.cjs +228 -0
- package/scripts/refactor_divs.ts +39 -0
- package/scripts/remove_div_wrappers.ts +17 -0
- package/scripts/update-gaps.ts +83 -0
- package/scripts/update_showcase_codestrings.ts +87 -0
- package/src/components/macro/accordion-preset.test.tsx +37 -0
- package/src/components/macro/accordion-preset.tsx +41 -0
- package/src/components/macro/alert-dialog-preset.tsx +116 -0
- package/src/components/macro/alert-preset.tsx +94 -0
- package/src/components/macro/avatar-preset.tsx +54 -0
- package/src/components/macro/breadcrumb-preset.tsx +50 -0
- package/src/components/macro/card-preset.tsx +44 -0
- package/src/components/macro/carousel-preset.tsx +150 -0
- package/src/components/macro/checkbox-preset.test.tsx +49 -0
- package/src/components/macro/checkbox-preset.tsx +84 -0
- package/src/components/macro/combobox-preset.tsx +171 -0
- package/src/components/macro/command-preset.tsx +74 -0
- package/src/components/macro/date-picker.tsx +289 -0
- package/src/components/macro/dialog-preset.tsx +105 -0
- package/src/components/macro/empty-preset.tsx +46 -0
- package/src/components/macro/field-preset.test.tsx +69 -0
- package/src/components/macro/field-preset.tsx +65 -0
- package/src/components/macro/index.ts +21 -0
- package/src/components/macro/input-otp-preset.tsx +98 -0
- package/src/components/macro/input-preset.test.tsx +52 -0
- package/src/components/macro/input-preset.tsx +139 -0
- package/src/components/macro/pagination-preset.tsx +153 -0
- package/src/components/macro/progress-preset.test.tsx +65 -0
- package/src/components/macro/progress-preset.tsx +45 -0
- package/src/components/macro/radio-group-preset.tsx +115 -0
- package/src/components/macro/select-preset.tsx +168 -0
- package/src/components/macro/slider-preset.test.tsx +43 -0
- package/src/components/macro/slider-preset.tsx +86 -0
- package/src/components/macro/switch-preset.test.tsx +53 -0
- package/src/components/macro/switch-preset.tsx +70 -0
- package/src/components/macro/tabs-preset.test.tsx +31 -0
- package/src/components/macro/tabs-preset.tsx +51 -0
- package/src/components/macro/textarea-preset.test.tsx +39 -0
- package/src/components/macro/textarea-preset.tsx +55 -0
- package/src/components/micro/accordion.tsx +76 -0
- package/src/components/micro/alert-dialog.tsx +213 -0
- package/src/components/micro/alert.tsx +146 -0
- package/src/components/micro/aspect-ratio.tsx +38 -0
- package/src/components/micro/avatar.tsx +143 -0
- package/src/components/micro/badge.tsx +207 -0
- package/src/components/micro/breadcrumb.tsx +162 -0
- package/src/components/micro/button.test.tsx +25 -0
- package/src/components/micro/button.tsx +361 -0
- package/src/components/micro/calendar.tsx +383 -0
- package/src/components/micro/card.tsx +112 -0
- package/src/components/micro/carousel.tsx +341 -0
- package/src/components/micro/chart.tsx +392 -0
- package/src/components/micro/checkbox.tsx +74 -0
- package/src/components/micro/collapsible.tsx +65 -0
- package/src/components/micro/combobox.tsx +349 -0
- package/src/components/micro/command.tsx +238 -0
- package/src/components/micro/context-menu.tsx +285 -0
- package/src/components/micro/dialog.tsx +143 -0
- package/src/components/micro/direction.tsx +13 -0
- package/src/components/micro/drawer.tsx +149 -0
- package/src/components/micro/dropdown-menu.tsx +305 -0
- package/src/components/micro/empty.tsx +144 -0
- package/src/components/micro/field.tsx +311 -0
- package/src/components/micro/hover-card.tsx +86 -0
- package/src/components/micro/input-group.tsx +269 -0
- package/src/components/micro/input-otp.tsx +130 -0
- package/src/components/micro/input.tsx +56 -0
- package/src/components/micro/item.tsx +206 -0
- package/src/components/micro/kbd.tsx +38 -0
- package/src/components/micro/label.tsx +48 -0
- package/src/components/micro/menubar.tsx +302 -0
- package/src/components/micro/navigation-menu.tsx +197 -0
- package/src/components/micro/pagination.tsx +162 -0
- package/src/components/micro/popover.tsx +131 -0
- package/src/components/micro/progress.tsx +144 -0
- package/src/components/micro/radio-group.tsx +73 -0
- package/src/components/micro/resizable.tsx +64 -0
- package/src/components/micro/scroll-area.tsx +68 -0
- package/src/components/micro/select.tsx +234 -0
- package/src/components/micro/separator.tsx +37 -0
- package/src/components/micro/sheet.tsx +144 -0
- package/src/components/micro/sidebar.tsx +238 -0
- package/src/components/micro/skeleton.tsx +29 -0
- package/src/components/micro/slider.tsx +135 -0
- package/src/components/micro/sonner.tsx +85 -0
- package/src/components/micro/spinner.tsx +44 -0
- package/src/components/micro/switch.tsx +70 -0
- package/src/components/micro/table.tsx +210 -0
- package/src/components/micro/tabs.tsx +100 -0
- package/src/components/micro/textarea.tsx +53 -0
- package/src/components/micro/theme-provider.tsx +163 -0
- package/src/components/micro/toggle-group.tsx +121 -0
- package/src/components/micro/toggle.tsx +55 -0
- package/src/components/micro/tooltip.tsx +105 -0
- package/src/dev/App.tsx +322 -0
- package/src/dev/_debug_select.html +29 -0
- package/src/dev/components/GladcnLogo.tsx +80 -0
- package/src/dev/components/code-highlighter.tsx +67 -0
- package/src/dev/components/dev-context.tsx +31 -0
- package/src/dev/components/showcase.tsx +413 -0
- package/src/dev/data.ts +341 -0
- package/src/dev/index.css +55 -0
- package/src/dev/main.tsx +30 -0
- package/src/dev/sections/buttons.tsx +303 -0
- package/src/dev/sections/display.tsx +270 -0
- package/src/dev/sections/feedback.tsx +371 -0
- package/src/dev/sections/forms.tsx +652 -0
- package/src/dev/sections/interactive.tsx +51 -0
- package/src/dev/sections/overview.tsx +396 -0
- package/src/dev/showcase/accordion.tsx +947 -0
- package/src/dev/showcase/alert-dialog.tsx +1056 -0
- package/src/dev/showcase/alert.tsx +756 -0
- package/src/dev/showcase/aspect-ratio.tsx +339 -0
- package/src/dev/showcase/avatar.tsx +470 -0
- package/src/dev/showcase/badge.tsx +227 -0
- package/src/dev/showcase/breadcrumb.tsx +269 -0
- package/src/dev/showcase/button.tsx +309 -0
- package/src/dev/showcase/calendar.tsx +380 -0
- package/src/dev/showcase/card.tsx +448 -0
- package/src/dev/showcase/carousel.tsx +562 -0
- package/src/dev/showcase/chart.tsx +130 -0
- package/src/dev/showcase/checkbox.tsx +611 -0
- package/src/dev/showcase/collapsible.tsx +298 -0
- package/src/dev/showcase/combobox.tsx +777 -0
- package/src/dev/showcase/command.tsx +245 -0
- package/src/dev/showcase/context-menu.tsx +239 -0
- package/src/dev/showcase/dialog.tsx +1141 -0
- package/src/dev/showcase/drawer.tsx +392 -0
- package/src/dev/showcase/dropdown-menu.tsx +420 -0
- package/src/dev/showcase/empty.tsx +493 -0
- package/src/dev/showcase/hover-card.tsx +336 -0
- package/src/dev/showcase/input-group.tsx +511 -0
- package/src/dev/showcase/input-otp.tsx +404 -0
- package/src/dev/showcase/input.tsx +530 -0
- package/src/dev/showcase/item.tsx +295 -0
- package/src/dev/showcase/kbd.tsx +276 -0
- package/src/dev/showcase/label.tsx +121 -0
- package/src/dev/showcase/menubar.tsx +392 -0
- package/src/dev/showcase/navigation-menu.tsx +304 -0
- package/src/dev/showcase/overview.tsx +1106 -0
- package/src/dev/showcase/pagination.tsx +312 -0
- package/src/dev/showcase/popover.tsx +374 -0
- package/src/dev/showcase/progress.tsx +299 -0
- package/src/dev/showcase/radio-group.tsx +612 -0
- package/src/dev/showcase/resizable.tsx +237 -0
- package/src/dev/showcase/scroll-area.tsx +157 -0
- package/src/dev/showcase/select.tsx +628 -0
- package/src/dev/showcase/separator.tsx +126 -0
- package/src/dev/showcase/sheet.tsx +566 -0
- package/src/dev/showcase/sidebar.tsx +120 -0
- package/src/dev/showcase/skeleton.tsx +213 -0
- package/src/dev/showcase/slider.tsx +506 -0
- package/src/dev/showcase/sonner.tsx +376 -0
- package/src/dev/showcase/spinner.tsx +124 -0
- package/src/dev/showcase/switch.tsx +602 -0
- package/src/dev/showcase/table.tsx +196 -0
- package/src/dev/showcase/tabs.tsx +662 -0
- package/src/dev/showcase/textarea.tsx +498 -0
- package/src/dev/showcase/theme-provider.tsx +894 -0
- package/src/dev/showcase/toast.tsx +119 -0
- package/src/dev/showcase/toggle-group.tsx +223 -0
- package/src/dev/showcase/toggle.tsx +171 -0
- package/src/dev/showcase/tooltip.tsx +372 -0
- package/src/hooks/use-controllable-state.ts +87 -0
- package/src/hooks/use-mobile.ts +21 -0
- package/src/index.ts +62 -0
- package/src/lib/types.ts +14 -0
- package/src/lib/utils.test.ts +14 -0
- package/src/lib/utils.ts +6 -0
- package/src/preset.ts +17 -0
- package/src/styles/gladcn.css +116 -0
- package/src/styles/tokens.css +213 -0
- package/src/test/setup.ts +8 -0
- package/src/vite-env.d.ts +1 -0
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ✅ AUDITED & REFACTORED
|
|
3
|
+
* - Design System Compliant (20 Commandments)
|
|
4
|
+
* - WCAG AAA/AA
|
|
5
|
+
* - Form Control Parity
|
|
6
|
+
* - CSS Delegated Logic
|
|
7
|
+
*
|
|
8
|
+
* 🚨 CRITICAL RULE FOR AI:
|
|
9
|
+
* When using <Combobox>, YOU MUST pass the `items` prop (an array of data).
|
|
10
|
+
* Headless UI libraries rely on this prop to build a stable internal item registry.
|
|
11
|
+
* If omitted, the library is forced to scan the DOM on every render to discover items,
|
|
12
|
+
* which causes full list re-renders, layout recalculations, and severe "content jumping" bugs.
|
|
13
|
+
* DO NOT rely purely on static children mapping for Base UI collection components.
|
|
14
|
+
*/
|
|
15
|
+
"use client";
|
|
16
|
+
|
|
17
|
+
import { Combobox as ComboboxPrimitive } from "@base-ui/react";
|
|
18
|
+
import * as React from "react";
|
|
19
|
+
|
|
20
|
+
import { InputGroupButton } from "../../components/micro/input-group";
|
|
21
|
+
import { ThemeWrapper } from "../../components/micro/theme-provider";
|
|
22
|
+
import { cn } from "../../lib/utils";
|
|
23
|
+
import { CheckIcon, ChevronDownIcon, XIcon } from "lucide-react";
|
|
24
|
+
|
|
25
|
+
const ComboboxContext = React.createContext<{
|
|
26
|
+
anchor: Element | null;
|
|
27
|
+
setAnchor: (el: Element | null) => void;
|
|
28
|
+
}>({ anchor: null, setAnchor: () => {} });
|
|
29
|
+
|
|
30
|
+
function Combobox<Value = any, Multiple extends boolean | undefined = false>(
|
|
31
|
+
props: ComboboxPrimitive.Root.Props<Value, Multiple>,
|
|
32
|
+
) {
|
|
33
|
+
const [anchor, setAnchor] = React.useState<Element | null>(null);
|
|
34
|
+
return (
|
|
35
|
+
<ComboboxContext.Provider value={{ anchor, setAnchor }}>
|
|
36
|
+
<ComboboxPrimitive.Root {...props} />
|
|
37
|
+
</ComboboxContext.Provider>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function ComboboxValue({ ...props }: ComboboxPrimitive.Value.Props) {
|
|
42
|
+
return <ComboboxPrimitive.Value data-slot="combobox-value" {...props} />;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function ComboboxTrigger({
|
|
46
|
+
className,
|
|
47
|
+
children,
|
|
48
|
+
...props
|
|
49
|
+
}: ComboboxPrimitive.Trigger.Props) {
|
|
50
|
+
return (
|
|
51
|
+
<ComboboxPrimitive.Trigger
|
|
52
|
+
data-slot="combobox-trigger"
|
|
53
|
+
className={cn("[&>svg:not([class*='size-'])]:size-4", className)}
|
|
54
|
+
{...props}
|
|
55
|
+
>
|
|
56
|
+
{children}
|
|
57
|
+
<ChevronDownIcon className="pointer-events-none size-4 text-muted-foreground" />
|
|
58
|
+
</ComboboxPrimitive.Trigger>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function ComboboxClear({ className, ...props }: ComboboxPrimitive.Clear.Props) {
|
|
63
|
+
return (
|
|
64
|
+
<ComboboxPrimitive.Clear
|
|
65
|
+
data-slot="combobox-clear"
|
|
66
|
+
render={<InputGroupButton variant="ghost" icon />}
|
|
67
|
+
className={cn(className)}
|
|
68
|
+
{...props}
|
|
69
|
+
>
|
|
70
|
+
<XIcon className="pointer-events-none" />
|
|
71
|
+
</ComboboxPrimitive.Clear>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function ComboboxInput({ className, ...props }: ComboboxPrimitive.Input.Props) {
|
|
76
|
+
return (
|
|
77
|
+
<ComboboxPrimitive.Input
|
|
78
|
+
data-slot="combobox-input"
|
|
79
|
+
className={cn(
|
|
80
|
+
"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
81
|
+
className,
|
|
82
|
+
)}
|
|
83
|
+
{...props}
|
|
84
|
+
/>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const ComboboxContent = React.forwardRef<
|
|
89
|
+
HTMLDivElement,
|
|
90
|
+
ComboboxPrimitive.Popup.Props &
|
|
91
|
+
Pick<
|
|
92
|
+
ComboboxPrimitive.Positioner.Props,
|
|
93
|
+
"side" | "align" | "sideOffset" | "alignOffset" | "anchor"
|
|
94
|
+
>
|
|
95
|
+
>(({ className, side = "bottom", sideOffset = 4, align = "start", alignOffset = 0, anchor, ...props }, ref) => {
|
|
96
|
+
const { anchor: contextAnchor } = React.useContext(ComboboxContext);
|
|
97
|
+
return (
|
|
98
|
+
<ComboboxPrimitive.Positioner
|
|
99
|
+
side={side}
|
|
100
|
+
sideOffset={sideOffset}
|
|
101
|
+
align={align}
|
|
102
|
+
alignOffset={alignOffset}
|
|
103
|
+
anchor={anchor || contextAnchor}
|
|
104
|
+
className="isolate z-50"
|
|
105
|
+
>
|
|
106
|
+
<ComboboxPrimitive.Popup
|
|
107
|
+
ref={ref}
|
|
108
|
+
data-slot="combobox-content"
|
|
109
|
+
data-chips={!!anchor}
|
|
110
|
+
className={cn(
|
|
111
|
+
"group/combobox-content relative max-h-(--available-height) min-w-(--anchor-width) max-w-(--available-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 p-1 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 [&_[data-slot=input-group]]:mb-1 [&_[data-slot=input-group]]:w-full [&_[data-slot=input-group]]:border-input/30 [&_[data-slot=input-group]]:bg-input/30 [&_[data-slot=input-group]]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
112
|
+
className,
|
|
113
|
+
)}
|
|
114
|
+
{...props}
|
|
115
|
+
/>
|
|
116
|
+
</ComboboxPrimitive.Positioner>
|
|
117
|
+
);
|
|
118
|
+
});
|
|
119
|
+
ComboboxContent.displayName = "ComboboxContent";
|
|
120
|
+
|
|
121
|
+
function ComboboxList({ className, ...props }: ComboboxPrimitive.List.Props) {
|
|
122
|
+
return (
|
|
123
|
+
<ComboboxPrimitive.List
|
|
124
|
+
data-slot="combobox-list"
|
|
125
|
+
className={cn(
|
|
126
|
+
"no-scrollbar max-h-[min(calc(--spacing(72)-(--spacing(9))),calc(var(--available-height)-(--spacing(9))))] scroll-py-1 overflow-y-auto overscroll-contain data-empty:hidden",
|
|
127
|
+
className,
|
|
128
|
+
)}
|
|
129
|
+
{...props}
|
|
130
|
+
/>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function ComboboxItem({
|
|
135
|
+
className,
|
|
136
|
+
children,
|
|
137
|
+
...props
|
|
138
|
+
}: ComboboxPrimitive.Item.Props) {
|
|
139
|
+
return (
|
|
140
|
+
<ComboboxPrimitive.Item
|
|
141
|
+
data-slot="combobox-item"
|
|
142
|
+
className={cn(
|
|
143
|
+
"relative flex w-full cursor-default items-center gap-2 rounded-md py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:[&>svg]:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&>svg]:pointer-events-none [&>svg]:shrink-0 [&>svg:not([class*='size-'])]:size-4",
|
|
144
|
+
className,
|
|
145
|
+
)}
|
|
146
|
+
{...props}
|
|
147
|
+
>
|
|
148
|
+
{children}
|
|
149
|
+
<ComboboxPrimitive.ItemIndicator
|
|
150
|
+
render={
|
|
151
|
+
<span className="pointer-events-none absolute right-2 flex size-4 items-center justify-center" />
|
|
152
|
+
}
|
|
153
|
+
>
|
|
154
|
+
<CheckIcon className="pointer-events-none" />
|
|
155
|
+
</ComboboxPrimitive.ItemIndicator>
|
|
156
|
+
</ComboboxPrimitive.Item>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function ComboboxGroup({ className, ...props }: ComboboxPrimitive.Group.Props) {
|
|
161
|
+
return (
|
|
162
|
+
<ComboboxPrimitive.Group
|
|
163
|
+
data-slot="combobox-group"
|
|
164
|
+
className={cn(className)}
|
|
165
|
+
{...props}
|
|
166
|
+
/>
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function ComboboxLabel({
|
|
171
|
+
className,
|
|
172
|
+
...props
|
|
173
|
+
}: ComboboxPrimitive.GroupLabel.Props) {
|
|
174
|
+
return (
|
|
175
|
+
<ComboboxPrimitive.GroupLabel
|
|
176
|
+
data-slot="combobox-label"
|
|
177
|
+
className={cn("px-2 py-1.5 text-xs text-muted-foreground", className)}
|
|
178
|
+
{...props}
|
|
179
|
+
/>
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function ComboboxCollection({ ...props }: ComboboxPrimitive.Collection.Props) {
|
|
184
|
+
return (
|
|
185
|
+
<ComboboxPrimitive.Collection data-slot="combobox-collection" {...props} />
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function ComboboxEmpty({ className, ...props }: ComboboxPrimitive.Empty.Props) {
|
|
190
|
+
return (
|
|
191
|
+
<ComboboxPrimitive.Empty
|
|
192
|
+
data-slot="combobox-empty"
|
|
193
|
+
className={cn(
|
|
194
|
+
"hidden justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex",
|
|
195
|
+
className,
|
|
196
|
+
)}
|
|
197
|
+
{...props}
|
|
198
|
+
/>
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function ComboboxSeparator({
|
|
203
|
+
className,
|
|
204
|
+
...props
|
|
205
|
+
}: ComboboxPrimitive.Separator.Props) {
|
|
206
|
+
return (
|
|
207
|
+
<ComboboxPrimitive.Separator
|
|
208
|
+
data-slot="combobox-separator"
|
|
209
|
+
className={cn("my-1 h-px bg-border", className)}
|
|
210
|
+
{...props}
|
|
211
|
+
/>
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const ComboboxPortal = ComboboxPrimitive.Portal;
|
|
216
|
+
|
|
217
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
218
|
+
|
|
219
|
+
const comboboxChipsVariants = cva(
|
|
220
|
+
"group/combobox-chips flex flex-wrap items-center gap-1 rounded-lg border border-input bg-transparent bg-clip-padding transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 has-aria-invalid:border-destructive has-aria-invalid:focus-within:ring-3 has-aria-invalid:focus-within:ring-destructive/20 has-[[data-slot=combobox-chip]]:px-1 dark:bg-input/30 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:focus-within:ring-destructive/40 has-disabled:opacity-50 has-disabled:cursor-not-allowed has-disabled:pointer-events-none",
|
|
221
|
+
{
|
|
222
|
+
variants: {
|
|
223
|
+
size: {
|
|
224
|
+
sm: "chips-sm min-h-7 px-2 py-0.5 text-xs",
|
|
225
|
+
md: "chips-md min-h-8 px-2.5 py-1 text-sm",
|
|
226
|
+
lg: "chips-lg min-h-9 px-3 py-1.5 text-sm",
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
);
|
|
231
|
+
|
|
232
|
+
function ComboboxChips({
|
|
233
|
+
className,
|
|
234
|
+
size = "md",
|
|
235
|
+
...props
|
|
236
|
+
}: React.ComponentPropsWithRef<typeof ComboboxPrimitive.Chips> &
|
|
237
|
+
ComboboxPrimitive.Chips.Props &
|
|
238
|
+
VariantProps<typeof comboboxChipsVariants>) {
|
|
239
|
+
return (
|
|
240
|
+
<ComboboxPrimitive.Chips
|
|
241
|
+
data-slot="combobox-chips"
|
|
242
|
+
className={cn(comboboxChipsVariants({ size }), className)}
|
|
243
|
+
{...props}
|
|
244
|
+
/>
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function ComboboxChip<T = any>({
|
|
249
|
+
className,
|
|
250
|
+
children,
|
|
251
|
+
showRemove = true,
|
|
252
|
+
...props
|
|
253
|
+
}: Omit<ComboboxPrimitive.Chip.Props, "value"> & {
|
|
254
|
+
value: T;
|
|
255
|
+
showRemove?: boolean;
|
|
256
|
+
}) {
|
|
257
|
+
return (
|
|
258
|
+
<ComboboxPrimitive.Chip
|
|
259
|
+
data-slot="combobox-chip"
|
|
260
|
+
className={cn(
|
|
261
|
+
"flex w-fit items-center justify-center gap-1 rounded-sm bg-muted px-1.5 font-medium whitespace-nowrap text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pr-0",
|
|
262
|
+
"h-5 text-xs",
|
|
263
|
+
"group-[.chips-sm]/combobox-chips:h-4 group-[.chips-sm]/combobox-chips:text-[10px]",
|
|
264
|
+
"group-[.chips-lg]/combobox-chips:h-6 group-[.chips-lg]/combobox-chips:text-sm",
|
|
265
|
+
className,
|
|
266
|
+
)}
|
|
267
|
+
{...(props as ComboboxPrimitive.Chip.Props & { value: any })}
|
|
268
|
+
>
|
|
269
|
+
{children}
|
|
270
|
+
{showRemove && (
|
|
271
|
+
<ComboboxPrimitive.ChipRemove
|
|
272
|
+
className="-ml-1 flex size-4 items-center justify-center rounded-sm opacity-50 transition-opacity outline-none hover:opacity-100 hover:bg-foreground/10 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-offset-1 focus-visible:ring-offset-background"
|
|
273
|
+
data-slot="combobox-chip-remove"
|
|
274
|
+
>
|
|
275
|
+
<XIcon className="pointer-events-none size-3" />
|
|
276
|
+
</ComboboxPrimitive.ChipRemove>
|
|
277
|
+
)}
|
|
278
|
+
</ComboboxPrimitive.Chip>
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function ComboboxChipsInput({
|
|
283
|
+
className,
|
|
284
|
+
...props
|
|
285
|
+
}: ComboboxPrimitive.Input.Props) {
|
|
286
|
+
return (
|
|
287
|
+
<ComboboxPrimitive.Input
|
|
288
|
+
data-slot="combobox-chip-input"
|
|
289
|
+
className={cn(
|
|
290
|
+
"min-w-16 flex-1 outline-none bg-transparent disabled:opacity-100 disabled:cursor-not-allowed disabled:pointer-events-none",
|
|
291
|
+
"h-5",
|
|
292
|
+
"group-[.chips-sm]/combobox-chips:h-4",
|
|
293
|
+
"group-[.chips-lg]/combobox-chips:h-6",
|
|
294
|
+
className,
|
|
295
|
+
)}
|
|
296
|
+
{...props}
|
|
297
|
+
/>
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function useComboboxContext() {
|
|
302
|
+
const context = React.useContext(ComboboxContext);
|
|
303
|
+
if (!context) {
|
|
304
|
+
throw new Error("useComboboxContext must be used within a Combobox");
|
|
305
|
+
}
|
|
306
|
+
return context;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
const ComboboxAnchor = React.forwardRef<
|
|
310
|
+
HTMLDivElement,
|
|
311
|
+
React.ComponentPropsWithoutRef<"div">
|
|
312
|
+
>(({ className, ...props }, ref) => {
|
|
313
|
+
const { setAnchor } = useComboboxContext();
|
|
314
|
+
return (
|
|
315
|
+
<div
|
|
316
|
+
ref={(node) => {
|
|
317
|
+
setAnchor(node);
|
|
318
|
+
if (typeof ref === "function") ref(node);
|
|
319
|
+
else if (ref) ref.current = node;
|
|
320
|
+
}}
|
|
321
|
+
data-slot="combobox-anchor"
|
|
322
|
+
className={className}
|
|
323
|
+
{...props}
|
|
324
|
+
/>
|
|
325
|
+
);
|
|
326
|
+
});
|
|
327
|
+
ComboboxAnchor.displayName = "ComboboxAnchor";
|
|
328
|
+
|
|
329
|
+
export {
|
|
330
|
+
Combobox,
|
|
331
|
+
ComboboxAnchor,
|
|
332
|
+
ComboboxChip,
|
|
333
|
+
ComboboxChips,
|
|
334
|
+
ComboboxChipsInput,
|
|
335
|
+
ComboboxClear,
|
|
336
|
+
ComboboxCollection,
|
|
337
|
+
ComboboxContent,
|
|
338
|
+
ComboboxEmpty,
|
|
339
|
+
ComboboxGroup,
|
|
340
|
+
ComboboxInput,
|
|
341
|
+
ComboboxItem,
|
|
342
|
+
ComboboxLabel,
|
|
343
|
+
ComboboxList,
|
|
344
|
+
ComboboxPortal,
|
|
345
|
+
ComboboxSeparator,
|
|
346
|
+
ComboboxTrigger,
|
|
347
|
+
ComboboxValue,
|
|
348
|
+
useComboboxContext,
|
|
349
|
+
};
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ✅ AUDITED & REFACTORED
|
|
3
|
+
* - Design System Compliant (22 Commandments)
|
|
4
|
+
* - WCAG AAA/AA
|
|
5
|
+
* - Form Control Parity
|
|
6
|
+
* - CSS Delegated Logic
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
|
|
10
|
+
import { Command as CommandPrimitive } from "cmdk";
|
|
11
|
+
import * as React from "react";
|
|
12
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
13
|
+
|
|
14
|
+
import { InputGroup, InputGroupAddon } from "../../components/micro/input-group";
|
|
15
|
+
import { cn } from "../../lib/utils";
|
|
16
|
+
import { SearchIcon } from "lucide-react";
|
|
17
|
+
import { type Size } from "../../lib/types";
|
|
18
|
+
|
|
19
|
+
const CommandContext = React.createContext<{ size: Size }>({ size: "md" });
|
|
20
|
+
|
|
21
|
+
const Command = React.forwardRef<
|
|
22
|
+
React.ElementRef<typeof CommandPrimitive>,
|
|
23
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive> & {
|
|
24
|
+
size?: Size;
|
|
25
|
+
}
|
|
26
|
+
>(({ className, size = "md", ...props }, ref) => (
|
|
27
|
+
<CommandContext.Provider value={{ size }}>
|
|
28
|
+
<CommandPrimitive
|
|
29
|
+
ref={ref}
|
|
30
|
+
data-slot="command"
|
|
31
|
+
className={cn(
|
|
32
|
+
"flex size-full flex-col overflow-hidden rounded-xl bg-popover text-popover-foreground",
|
|
33
|
+
className,
|
|
34
|
+
)}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
</CommandContext.Provider>
|
|
38
|
+
));
|
|
39
|
+
Command.displayName = "Command";
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
const commandInputVariants = cva(
|
|
43
|
+
"w-full outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
|
|
44
|
+
{
|
|
45
|
+
variants: {
|
|
46
|
+
size: {
|
|
47
|
+
sm: "text-sm",
|
|
48
|
+
md: "text-sm",
|
|
49
|
+
lg: "text-base",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
defaultVariants: {
|
|
53
|
+
size: "md",
|
|
54
|
+
},
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const CommandInput = React.forwardRef<
|
|
59
|
+
React.ElementRef<typeof CommandPrimitive.Input>,
|
|
60
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
|
|
61
|
+
>(({ className, ...props }, ref) => {
|
|
62
|
+
const { size } = React.useContext(CommandContext);
|
|
63
|
+
return (
|
|
64
|
+
<div
|
|
65
|
+
data-slot="command-input-wrapper"
|
|
66
|
+
className={cn(
|
|
67
|
+
"pb-0",
|
|
68
|
+
size === "sm" && "p-1",
|
|
69
|
+
size === "md" && "p-2",
|
|
70
|
+
size === "lg" && "p-3"
|
|
71
|
+
)}
|
|
72
|
+
>
|
|
73
|
+
<InputGroup
|
|
74
|
+
className={cn(
|
|
75
|
+
"rounded-lg border-input/30 bg-input/30 shadow-none",
|
|
76
|
+
size === "sm" && "h-8",
|
|
77
|
+
size === "md" && "h-10",
|
|
78
|
+
size === "lg" && "h-11"
|
|
79
|
+
)}
|
|
80
|
+
>
|
|
81
|
+
<CommandPrimitive.Input
|
|
82
|
+
ref={ref}
|
|
83
|
+
data-slot="command-input"
|
|
84
|
+
className={cn(commandInputVariants({ size }), className)}
|
|
85
|
+
{...props}
|
|
86
|
+
/>
|
|
87
|
+
<InputGroupAddon className={cn("shrink-0", size === "lg" ? "pl-3" : "pl-2")}>
|
|
88
|
+
<SearchIcon className={cn("opacity-50", size === "lg" ? "size-5" : "size-4")} />
|
|
89
|
+
</InputGroupAddon>
|
|
90
|
+
</InputGroup>
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
});
|
|
94
|
+
CommandInput.displayName = "CommandInput";
|
|
95
|
+
|
|
96
|
+
const CommandList = React.forwardRef<
|
|
97
|
+
React.ElementRef<typeof CommandPrimitive.List>,
|
|
98
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
|
|
99
|
+
>(({ className, ...props }, ref) => (
|
|
100
|
+
<CommandPrimitive.List
|
|
101
|
+
ref={ref}
|
|
102
|
+
data-slot="command-list"
|
|
103
|
+
className={cn(
|
|
104
|
+
"no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",
|
|
105
|
+
className,
|
|
106
|
+
)}
|
|
107
|
+
{...props}
|
|
108
|
+
/>
|
|
109
|
+
));
|
|
110
|
+
CommandList.displayName = "CommandList";
|
|
111
|
+
|
|
112
|
+
const CommandEmpty = React.forwardRef<
|
|
113
|
+
React.ElementRef<typeof CommandPrimitive.Empty>,
|
|
114
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
|
|
115
|
+
>(({ className, ...props }, ref) => {
|
|
116
|
+
const { size } = React.useContext(CommandContext);
|
|
117
|
+
return (
|
|
118
|
+
<CommandPrimitive.Empty
|
|
119
|
+
ref={ref}
|
|
120
|
+
data-slot="command-empty"
|
|
121
|
+
className={cn(
|
|
122
|
+
"text-center",
|
|
123
|
+
size === "sm" && "py-4 text-xs",
|
|
124
|
+
size === "md" && "py-6 text-sm",
|
|
125
|
+
size === "lg" && "py-8 text-base",
|
|
126
|
+
className
|
|
127
|
+
)}
|
|
128
|
+
{...props}
|
|
129
|
+
/>
|
|
130
|
+
);
|
|
131
|
+
});
|
|
132
|
+
CommandEmpty.displayName = "CommandEmpty";
|
|
133
|
+
|
|
134
|
+
const commandGroupVariants = cva(
|
|
135
|
+
"overflow-hidden text-foreground **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground **:[[cmdk-group-items]]:flex **:[[cmdk-group-items]]:flex-col",
|
|
136
|
+
{
|
|
137
|
+
variants: {
|
|
138
|
+
size: {
|
|
139
|
+
sm: "p-1 **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-items]]:gap-0.5",
|
|
140
|
+
md: "p-2 **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-items]]:gap-1",
|
|
141
|
+
lg: "p-3 **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-2 **:[[cmdk-group-heading]]:text-sm **:[[cmdk-group-items]]:gap-1",
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
defaultVariants: {
|
|
145
|
+
size: "md",
|
|
146
|
+
},
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
const CommandGroup = React.forwardRef<
|
|
151
|
+
React.ElementRef<typeof CommandPrimitive.Group>,
|
|
152
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
|
|
153
|
+
>(({ className, ...props }, ref) => {
|
|
154
|
+
const { size } = React.useContext(CommandContext);
|
|
155
|
+
return (
|
|
156
|
+
<CommandPrimitive.Group
|
|
157
|
+
ref={ref}
|
|
158
|
+
data-slot="command-group"
|
|
159
|
+
className={cn(commandGroupVariants({ size }), className)}
|
|
160
|
+
{...props}
|
|
161
|
+
/>
|
|
162
|
+
);
|
|
163
|
+
});
|
|
164
|
+
CommandGroup.displayName = "CommandGroup";
|
|
165
|
+
|
|
166
|
+
const CommandSeparator = React.forwardRef<
|
|
167
|
+
React.ElementRef<typeof CommandPrimitive.Separator>,
|
|
168
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
|
|
169
|
+
>(({ className, ...props }, ref) => (
|
|
170
|
+
<CommandPrimitive.Separator
|
|
171
|
+
ref={ref}
|
|
172
|
+
data-slot="command-separator"
|
|
173
|
+
className={cn("-mx-1 h-px bg-border", className)}
|
|
174
|
+
{...props}
|
|
175
|
+
/>
|
|
176
|
+
));
|
|
177
|
+
CommandSeparator.displayName = "CommandSeparator";
|
|
178
|
+
|
|
179
|
+
const commandItemVariants = cva(
|
|
180
|
+
"group/command-item relative flex cursor-default items-center outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 hover:bg-accent hover:text-accent-foreground data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground aria-selected:bg-accent aria-selected:text-accent-foreground *:pointer-events-none *:shrink-0 hover:*:text-accent-foreground data-[selected=true]:*:text-accent-foreground aria-selected:*:text-accent-foreground",
|
|
181
|
+
{
|
|
182
|
+
variants: {
|
|
183
|
+
size: {
|
|
184
|
+
sm: "gap-2 rounded-sm px-2 py-1 text-xs **:[svg:not([class*='size-'])]:size-3.5",
|
|
185
|
+
md: "gap-2 rounded-sm px-2 py-1.5 text-sm **:[svg:not([class*='size-'])]:size-4",
|
|
186
|
+
lg: "gap-3 rounded-md px-3 py-2.5 text-base **:[svg:not([class*='size-'])]:size-5",
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
defaultVariants: {
|
|
190
|
+
size: "md",
|
|
191
|
+
},
|
|
192
|
+
}
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
const CommandItem = React.forwardRef<
|
|
196
|
+
React.ElementRef<typeof CommandPrimitive.Item>,
|
|
197
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
|
|
198
|
+
>(({ className, children, ...props }, ref) => {
|
|
199
|
+
const { size } = React.useContext(CommandContext);
|
|
200
|
+
return (
|
|
201
|
+
<CommandPrimitive.Item
|
|
202
|
+
ref={ref}
|
|
203
|
+
data-slot="command-item"
|
|
204
|
+
className={cn(commandItemVariants({ size }), className)}
|
|
205
|
+
{...props}
|
|
206
|
+
>
|
|
207
|
+
{children}
|
|
208
|
+
</CommandPrimitive.Item>
|
|
209
|
+
);
|
|
210
|
+
});
|
|
211
|
+
CommandItem.displayName = "CommandItem";
|
|
212
|
+
|
|
213
|
+
const CommandShortcut = React.forwardRef<
|
|
214
|
+
HTMLSpanElement,
|
|
215
|
+
React.ComponentPropsWithoutRef<"span">
|
|
216
|
+
>(({ className, ...props }, ref) => (
|
|
217
|
+
<span
|
|
218
|
+
ref={ref}
|
|
219
|
+
data-slot="command-shortcut"
|
|
220
|
+
className={cn(
|
|
221
|
+
"ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground",
|
|
222
|
+
className,
|
|
223
|
+
)}
|
|
224
|
+
{...props}
|
|
225
|
+
/>
|
|
226
|
+
));
|
|
227
|
+
CommandShortcut.displayName = "CommandShortcut";
|
|
228
|
+
|
|
229
|
+
export {
|
|
230
|
+
Command,
|
|
231
|
+
CommandEmpty,
|
|
232
|
+
CommandGroup,
|
|
233
|
+
CommandInput,
|
|
234
|
+
CommandItem,
|
|
235
|
+
CommandList,
|
|
236
|
+
CommandSeparator,
|
|
237
|
+
CommandShortcut,
|
|
238
|
+
};
|