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,41 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Accordion,
|
|
3
|
+
AccordionContent,
|
|
4
|
+
AccordionItem,
|
|
5
|
+
AccordionTrigger,
|
|
6
|
+
} from "../../components/micro/accordion";
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
|
|
9
|
+
export interface AccordionPresetItem {
|
|
10
|
+
value: string;
|
|
11
|
+
title: React.ReactNode;
|
|
12
|
+
content: React.ReactNode;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type AccordionPresetProps = React.ComponentProps<typeof Accordion> & {
|
|
17
|
+
items: AccordionPresetItem[];
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const AccordionPreset = React.forwardRef<
|
|
21
|
+
React.ComponentRef<typeof Accordion>,
|
|
22
|
+
AccordionPresetProps
|
|
23
|
+
>(({ items, ...accordionProps }, ref) => {
|
|
24
|
+
return (
|
|
25
|
+
<Accordion ref={ref} {...accordionProps}>
|
|
26
|
+
{items.map((item) => (
|
|
27
|
+
<AccordionItem
|
|
28
|
+
key={item.value}
|
|
29
|
+
value={item.value}
|
|
30
|
+
disabled={item.disabled}
|
|
31
|
+
>
|
|
32
|
+
<AccordionTrigger>{item.title}</AccordionTrigger>
|
|
33
|
+
<AccordionContent>{item.content}</AccordionContent>
|
|
34
|
+
</AccordionItem>
|
|
35
|
+
))}
|
|
36
|
+
</Accordion>
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
AccordionPreset.displayName = "AccordionPreset";
|
|
40
|
+
|
|
41
|
+
export { AccordionPreset };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
AlertDialog,
|
|
5
|
+
AlertDialogAction,
|
|
6
|
+
AlertDialogCancel,
|
|
7
|
+
AlertDialogContent,
|
|
8
|
+
AlertDialogDescription,
|
|
9
|
+
AlertDialogFooter,
|
|
10
|
+
AlertDialogHeader,
|
|
11
|
+
AlertDialogMedia,
|
|
12
|
+
AlertDialogTitle,
|
|
13
|
+
AlertDialogTrigger,
|
|
14
|
+
AlertDialogPortal,
|
|
15
|
+
} from "../../components/micro/alert-dialog";
|
|
16
|
+
import { ThemeWrapper } from "../../components/micro/theme-provider";
|
|
17
|
+
import { type Color, type Size, type Variant } from "../../lib/types";
|
|
18
|
+
import { cn } from "../../lib/utils";
|
|
19
|
+
import * as React from "react";
|
|
20
|
+
|
|
21
|
+
type AlertDialogPresetProps = Omit<
|
|
22
|
+
React.ComponentProps<typeof AlertDialog>,
|
|
23
|
+
"children"
|
|
24
|
+
> & {
|
|
25
|
+
children?: React.ReactNode;
|
|
26
|
+
trigger?: React.ReactElement;
|
|
27
|
+
icon?: React.ReactNode;
|
|
28
|
+
title?: React.ReactNode;
|
|
29
|
+
description?: React.ReactNode;
|
|
30
|
+
cancelLabel?: React.ReactNode;
|
|
31
|
+
cancelColor?: Color;
|
|
32
|
+
cancelVariant?: Variant;
|
|
33
|
+
actionLabel?: React.ReactNode;
|
|
34
|
+
actionColor?: Color;
|
|
35
|
+
actionVariant?: Variant;
|
|
36
|
+
onAction?: () => void;
|
|
37
|
+
onCancel?: () => void;
|
|
38
|
+
size?: Size;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
function AlertDialogPreset({
|
|
42
|
+
trigger,
|
|
43
|
+
icon,
|
|
44
|
+
title,
|
|
45
|
+
description,
|
|
46
|
+
cancelLabel,
|
|
47
|
+
cancelColor,
|
|
48
|
+
cancelVariant,
|
|
49
|
+
actionLabel,
|
|
50
|
+
actionColor,
|
|
51
|
+
actionVariant,
|
|
52
|
+
onAction,
|
|
53
|
+
onCancel,
|
|
54
|
+
size = "md",
|
|
55
|
+
children,
|
|
56
|
+
...props
|
|
57
|
+
}: AlertDialogPresetProps) {
|
|
58
|
+
return (
|
|
59
|
+
<AlertDialog {...props}>
|
|
60
|
+
{trigger && <AlertDialogTrigger render={trigger} />}
|
|
61
|
+
<AlertDialogPortal>
|
|
62
|
+
<ThemeWrapper>
|
|
63
|
+
<AlertDialogContent size={size}>
|
|
64
|
+
<div
|
|
65
|
+
className={cn("flex flex-col gap-1.5", {
|
|
66
|
+
"sm:flex-row sm:gap-4": !!icon,
|
|
67
|
+
})}
|
|
68
|
+
>
|
|
69
|
+
{icon && (
|
|
70
|
+
<AlertDialogMedia className="mx-auto mb-2 shrink-0 sm:mx-0 sm:mb-0">
|
|
71
|
+
{icon}
|
|
72
|
+
</AlertDialogMedia>
|
|
73
|
+
)}
|
|
74
|
+
<AlertDialogHeader>
|
|
75
|
+
{title && <AlertDialogTitle>{title}</AlertDialogTitle>}
|
|
76
|
+
{description && (
|
|
77
|
+
<AlertDialogDescription>{description}</AlertDialogDescription>
|
|
78
|
+
)}
|
|
79
|
+
{children}
|
|
80
|
+
</AlertDialogHeader>
|
|
81
|
+
</div>
|
|
82
|
+
{(cancelLabel || actionLabel) && (
|
|
83
|
+
<AlertDialogFooter className="group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 group-data-[size=sm]/alert-dialog-content:sm:flex group-data-[size=sm]/alert-dialog-content:sm:justify-end">
|
|
84
|
+
{cancelLabel && (
|
|
85
|
+
<AlertDialogCancel
|
|
86
|
+
size={size}
|
|
87
|
+
color={cancelColor}
|
|
88
|
+
variant={cancelVariant}
|
|
89
|
+
onClick={onCancel}
|
|
90
|
+
>
|
|
91
|
+
{cancelLabel}
|
|
92
|
+
</AlertDialogCancel>
|
|
93
|
+
)}
|
|
94
|
+
{actionLabel && (
|
|
95
|
+
<AlertDialogAction
|
|
96
|
+
size={size}
|
|
97
|
+
color={actionColor}
|
|
98
|
+
variant={actionVariant}
|
|
99
|
+
onClick={onAction}
|
|
100
|
+
>
|
|
101
|
+
{actionLabel}
|
|
102
|
+
</AlertDialogAction>
|
|
103
|
+
)}
|
|
104
|
+
</AlertDialogFooter>
|
|
105
|
+
)}
|
|
106
|
+
</AlertDialogContent>
|
|
107
|
+
</ThemeWrapper>
|
|
108
|
+
</AlertDialogPortal>
|
|
109
|
+
</AlertDialog>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
AlertDialogPreset.displayName = "AlertDialogPreset";
|
|
114
|
+
|
|
115
|
+
export { AlertDialogPreset };
|
|
116
|
+
export type { AlertDialogPresetProps };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Alert,
|
|
3
|
+
AlertAction,
|
|
4
|
+
AlertDescription,
|
|
5
|
+
AlertIcon,
|
|
6
|
+
AlertTitle,
|
|
7
|
+
type AlertProps,
|
|
8
|
+
} from "../../components/micro/alert";
|
|
9
|
+
import { Button } from "../../components/micro/button";
|
|
10
|
+
import { cn } from "../../lib/utils";
|
|
11
|
+
import { XIcon } from "lucide-react";
|
|
12
|
+
import * as React from "react";
|
|
13
|
+
|
|
14
|
+
export type AlertPresetProps = AlertProps & {
|
|
15
|
+
title?: React.ReactNode;
|
|
16
|
+
description?: React.ReactNode;
|
|
17
|
+
icon?: React.ReactElement;
|
|
18
|
+
action?: React.ReactNode;
|
|
19
|
+
dismissible?: boolean;
|
|
20
|
+
onDismiss?: () => void;
|
|
21
|
+
defaultOpen?: boolean;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const AlertPreset = React.forwardRef<HTMLDivElement, AlertPresetProps>(
|
|
25
|
+
(
|
|
26
|
+
{
|
|
27
|
+
title,
|
|
28
|
+
description,
|
|
29
|
+
icon,
|
|
30
|
+
action,
|
|
31
|
+
dismissible = false,
|
|
32
|
+
onDismiss,
|
|
33
|
+
defaultOpen = true,
|
|
34
|
+
children,
|
|
35
|
+
color = "info",
|
|
36
|
+
className,
|
|
37
|
+
...props
|
|
38
|
+
},
|
|
39
|
+
ref,
|
|
40
|
+
) => {
|
|
41
|
+
const [isOpen, setIsOpen] = React.useState(defaultOpen);
|
|
42
|
+
|
|
43
|
+
if (!isOpen) return null;
|
|
44
|
+
|
|
45
|
+
const handleDismiss = () => {
|
|
46
|
+
setIsOpen(false);
|
|
47
|
+
onDismiss?.();
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<Alert
|
|
52
|
+
ref={ref}
|
|
53
|
+
color={color}
|
|
54
|
+
className={cn(
|
|
55
|
+
"flex w-full flex-col gap-3 @sm/alert:flex-row @sm/alert:items-start",
|
|
56
|
+
dismissible && "pr-8 data-[size=sm]:pr-7 data-[size=lg]:pr-10",
|
|
57
|
+
className,
|
|
58
|
+
)}
|
|
59
|
+
{...props}
|
|
60
|
+
>
|
|
61
|
+
<div className="flex flex-1 items-start gap-3">
|
|
62
|
+
{icon && <AlertIcon render={icon} className="mt-0.5 shrink-0" />}
|
|
63
|
+
<div className="flex-1 space-y-0.5">
|
|
64
|
+
{title && <AlertTitle>{title}</AlertTitle>}
|
|
65
|
+
{description && <AlertDescription>{description}</AlertDescription>}
|
|
66
|
+
{children}
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
{action && (
|
|
70
|
+
<AlertAction className="shrink-0 @sm/alert:ml-4">
|
|
71
|
+
{action}
|
|
72
|
+
</AlertAction>
|
|
73
|
+
)}
|
|
74
|
+
{dismissible && (
|
|
75
|
+
<Button
|
|
76
|
+
variant="ghost"
|
|
77
|
+
color={color as React.ComponentProps<typeof Button>["color"]}
|
|
78
|
+
size="sm"
|
|
79
|
+
className="absolute right-1 top-1 p-0 size-6 group-data-[size=sm]/alert:size-5 group-data-[size=lg]/alert:size-7"
|
|
80
|
+
onClick={handleDismiss}
|
|
81
|
+
aria-label="Dismiss alert"
|
|
82
|
+
iconOnly
|
|
83
|
+
>
|
|
84
|
+
<XIcon className="size-3.5 group-data-[size=sm]/alert:size-3 group-data-[size=lg]/alert:size-4" />
|
|
85
|
+
</Button>
|
|
86
|
+
)}
|
|
87
|
+
</Alert>
|
|
88
|
+
);
|
|
89
|
+
},
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
AlertPreset.displayName = "AlertPreset";
|
|
93
|
+
|
|
94
|
+
export { AlertPreset };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Avatar,
|
|
3
|
+
AvatarBadge,
|
|
4
|
+
AvatarFallback,
|
|
5
|
+
AvatarImage,
|
|
6
|
+
} from "../../components/micro/avatar";
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
|
|
9
|
+
export type AvatarPresetProps = React.ComponentProps<typeof Avatar> & {
|
|
10
|
+
src?: string;
|
|
11
|
+
alt?: string;
|
|
12
|
+
fallback?: React.ReactNode;
|
|
13
|
+
status?: "online" | "offline" | "away" | "busy";
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const statusColors = {
|
|
17
|
+
online: "bg-success",
|
|
18
|
+
away: "bg-warning",
|
|
19
|
+
busy: "bg-destructive",
|
|
20
|
+
offline: "bg-muted-foreground/50",
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
function getInitials(name: string) {
|
|
24
|
+
const parts = name.split(" ").filter(Boolean);
|
|
25
|
+
if (parts.length === 0) return "??";
|
|
26
|
+
if (parts.length === 1)
|
|
27
|
+
return parts[0]?.substring(0, 2).toUpperCase() ?? "??";
|
|
28
|
+
return (
|
|
29
|
+
(parts[0]?.charAt(0) ?? "") + (parts[parts.length - 1]?.charAt(0) ?? "")
|
|
30
|
+
).toUpperCase();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const AvatarPreset = React.forwardRef<
|
|
34
|
+
React.ComponentRef<typeof Avatar>,
|
|
35
|
+
AvatarPresetProps
|
|
36
|
+
>(({ src, alt = "", fallback, status, ...avatarProps }, ref) => {
|
|
37
|
+
const generatedFallback = fallback ?? getInitials(alt);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Avatar ref={ref} {...avatarProps}>
|
|
41
|
+
<AvatarImage src={src} alt={alt} />
|
|
42
|
+
<AvatarFallback>{generatedFallback}</AvatarFallback>
|
|
43
|
+
{status && (
|
|
44
|
+
<AvatarBadge
|
|
45
|
+
className={`absolute z-10 right-0 bottom-0 ${statusColors[status]}`}
|
|
46
|
+
/>
|
|
47
|
+
)}
|
|
48
|
+
{avatarProps.children}
|
|
49
|
+
</Avatar>
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
AvatarPreset.displayName = "AvatarPreset";
|
|
53
|
+
|
|
54
|
+
export { AvatarPreset };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Breadcrumb,
|
|
3
|
+
BreadcrumbItem,
|
|
4
|
+
BreadcrumbLink,
|
|
5
|
+
BreadcrumbList,
|
|
6
|
+
BreadcrumbPage,
|
|
7
|
+
BreadcrumbSeparator,
|
|
8
|
+
} from "../../components/micro/breadcrumb";
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
|
|
11
|
+
export interface BreadcrumbPresetItem {
|
|
12
|
+
label: React.ReactNode;
|
|
13
|
+
href?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type BreadcrumbPresetProps = React.ComponentProps<typeof Breadcrumb> & {
|
|
17
|
+
items: BreadcrumbPresetItem[];
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const BreadcrumbPreset = React.forwardRef<
|
|
21
|
+
React.ComponentRef<typeof Breadcrumb>,
|
|
22
|
+
BreadcrumbPresetProps
|
|
23
|
+
>(({ items, ...breadcrumbProps }, ref) => {
|
|
24
|
+
return (
|
|
25
|
+
<Breadcrumb ref={ref} {...breadcrumbProps}>
|
|
26
|
+
<BreadcrumbList>
|
|
27
|
+
{items.map((item, index) => {
|
|
28
|
+
const isLast = index === items.length - 1;
|
|
29
|
+
const isPage = isLast || !item.href;
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<React.Fragment key={index}>
|
|
33
|
+
<BreadcrumbItem>
|
|
34
|
+
{isPage ? (
|
|
35
|
+
<BreadcrumbPage>{item.label}</BreadcrumbPage>
|
|
36
|
+
) : (
|
|
37
|
+
<BreadcrumbLink href={item.href}>{item.label}</BreadcrumbLink>
|
|
38
|
+
)}
|
|
39
|
+
</BreadcrumbItem>
|
|
40
|
+
{!isLast && <BreadcrumbSeparator />}
|
|
41
|
+
</React.Fragment>
|
|
42
|
+
);
|
|
43
|
+
})}
|
|
44
|
+
</BreadcrumbList>
|
|
45
|
+
</Breadcrumb>
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
BreadcrumbPreset.displayName = "BreadcrumbPreset";
|
|
49
|
+
|
|
50
|
+
export { BreadcrumbPreset };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Card,
|
|
3
|
+
CardContent,
|
|
4
|
+
CardDescription,
|
|
5
|
+
CardFooter,
|
|
6
|
+
CardHeader,
|
|
7
|
+
CardTitle,
|
|
8
|
+
} from "../../components/micro/card";
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
|
|
11
|
+
export type CardPresetProps = Omit<
|
|
12
|
+
React.ComponentProps<typeof Card>,
|
|
13
|
+
"title"
|
|
14
|
+
> & {
|
|
15
|
+
title?: React.ReactNode;
|
|
16
|
+
description?: React.ReactNode;
|
|
17
|
+
footer?: React.ReactNode;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const CardPreset = React.forwardRef<HTMLDivElement, CardPresetProps>(
|
|
21
|
+
({ title, description, footer, children, className, ...props }, ref) => {
|
|
22
|
+
return (
|
|
23
|
+
<div className={className} ref={ref}>
|
|
24
|
+
<div className="@container/card size-full">
|
|
25
|
+
<Card className="size-full" {...props}>
|
|
26
|
+
{(title || description) && (
|
|
27
|
+
<CardHeader>
|
|
28
|
+
{title && <CardTitle>{title}</CardTitle>}
|
|
29
|
+
{description && (
|
|
30
|
+
<CardDescription>{description}</CardDescription>
|
|
31
|
+
)}
|
|
32
|
+
</CardHeader>
|
|
33
|
+
)}
|
|
34
|
+
{children && <CardContent>{children}</CardContent>}
|
|
35
|
+
{footer && <CardFooter>{footer}</CardFooter>}
|
|
36
|
+
</Card>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
},
|
|
41
|
+
);
|
|
42
|
+
CardPreset.displayName = "CardPreset";
|
|
43
|
+
|
|
44
|
+
export { CardPreset };
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Carousel,
|
|
3
|
+
CarouselContent,
|
|
4
|
+
CarouselDots,
|
|
5
|
+
CarouselItem,
|
|
6
|
+
CarouselNext,
|
|
7
|
+
CarouselPrevious,
|
|
8
|
+
type CarouselApi,
|
|
9
|
+
} from "../../components/micro/carousel";
|
|
10
|
+
import { cn } from "../../lib/utils";
|
|
11
|
+
import * as React from "react";
|
|
12
|
+
|
|
13
|
+
export type CarouselPresetProps = Omit<
|
|
14
|
+
React.ComponentProps<typeof Carousel>,
|
|
15
|
+
"setApi" | "onScroll"
|
|
16
|
+
> & {
|
|
17
|
+
items: { id: string | number; content: React.ReactNode }[];
|
|
18
|
+
showArrows?: boolean;
|
|
19
|
+
showDots?: boolean;
|
|
20
|
+
itemClassName?: string;
|
|
21
|
+
contentClassName?: string;
|
|
22
|
+
|
|
23
|
+
// Controlled & Uncontrolled props
|
|
24
|
+
index?: number;
|
|
25
|
+
defaultIndex?: number;
|
|
26
|
+
onIndexChange?: (index: number) => void;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const CarouselPreset = React.forwardRef<
|
|
30
|
+
React.ComponentRef<typeof Carousel>,
|
|
31
|
+
CarouselPresetProps
|
|
32
|
+
>(
|
|
33
|
+
(
|
|
34
|
+
{
|
|
35
|
+
items,
|
|
36
|
+
showArrows = true,
|
|
37
|
+
showDots = true,
|
|
38
|
+
itemClassName,
|
|
39
|
+
contentClassName,
|
|
40
|
+
index: controlledIndex,
|
|
41
|
+
defaultIndex = 0,
|
|
42
|
+
onIndexChange,
|
|
43
|
+
className,
|
|
44
|
+
...carouselProps
|
|
45
|
+
},
|
|
46
|
+
ref,
|
|
47
|
+
) => {
|
|
48
|
+
const [api, setApi] = React.useState<CarouselApi>();
|
|
49
|
+
|
|
50
|
+
React.useEffect(() => {
|
|
51
|
+
if (!api) return;
|
|
52
|
+
const handleSelect = () => {
|
|
53
|
+
onIndexChange?.(api.selectedScrollSnap());
|
|
54
|
+
};
|
|
55
|
+
api.on("select", handleSelect);
|
|
56
|
+
return () => {
|
|
57
|
+
api.off("select", handleSelect);
|
|
58
|
+
};
|
|
59
|
+
}, [api, onIndexChange]);
|
|
60
|
+
|
|
61
|
+
React.useEffect(() => {
|
|
62
|
+
if (!api || controlledIndex === undefined) return;
|
|
63
|
+
if (api.selectedScrollSnap() !== controlledIndex) {
|
|
64
|
+
api.scrollTo(controlledIndex);
|
|
65
|
+
}
|
|
66
|
+
}, [api, controlledIndex]);
|
|
67
|
+
|
|
68
|
+
const orientation = carouselProps.orientation || "horizontal";
|
|
69
|
+
const opts = { ...carouselProps.opts, startIndex: defaultIndex };
|
|
70
|
+
|
|
71
|
+
if (orientation === "vertical") {
|
|
72
|
+
return (
|
|
73
|
+
<div className={className}>
|
|
74
|
+
<div className="@container/carousel h-full">
|
|
75
|
+
<Carousel
|
|
76
|
+
ref={ref}
|
|
77
|
+
{...carouselProps}
|
|
78
|
+
opts={opts}
|
|
79
|
+
setApi={setApi}
|
|
80
|
+
orientation="vertical"
|
|
81
|
+
className="h-full"
|
|
82
|
+
>
|
|
83
|
+
<CarouselContent className={cn("-mt-4", contentClassName)}>
|
|
84
|
+
{items.map((item) => (
|
|
85
|
+
<CarouselItem
|
|
86
|
+
key={item.id}
|
|
87
|
+
className={cn("pt-4", itemClassName)}
|
|
88
|
+
>
|
|
89
|
+
{item.content}
|
|
90
|
+
</CarouselItem>
|
|
91
|
+
))}
|
|
92
|
+
</CarouselContent>
|
|
93
|
+
{showArrows && (
|
|
94
|
+
<>
|
|
95
|
+
<CarouselPrevious className="absolute z-10 -top-12 left-1/2 -translate-x-1/2 rotate-90" />
|
|
96
|
+
<CarouselNext className="absolute z-10 -bottom-12 left-1/2 -translate-x-1/2 rotate-90" />
|
|
97
|
+
</>
|
|
98
|
+
)}
|
|
99
|
+
{showDots && (
|
|
100
|
+
<div className="mt-2 flex justify-center">
|
|
101
|
+
<CarouselDots />
|
|
102
|
+
</div>
|
|
103
|
+
)}
|
|
104
|
+
</Carousel>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<div className={className}>
|
|
112
|
+
<div className="@container/carousel size-full">
|
|
113
|
+
<Carousel
|
|
114
|
+
ref={ref}
|
|
115
|
+
{...carouselProps}
|
|
116
|
+
opts={opts}
|
|
117
|
+
setApi={setApi}
|
|
118
|
+
orientation="horizontal"
|
|
119
|
+
className="size-full"
|
|
120
|
+
>
|
|
121
|
+
<CarouselContent className={cn("-ml-4", contentClassName)}>
|
|
122
|
+
{items.map((item) => (
|
|
123
|
+
<CarouselItem
|
|
124
|
+
key={item.id}
|
|
125
|
+
className={cn("pl-4", itemClassName)}
|
|
126
|
+
>
|
|
127
|
+
{item.content}
|
|
128
|
+
</CarouselItem>
|
|
129
|
+
))}
|
|
130
|
+
</CarouselContent>
|
|
131
|
+
{showArrows && (
|
|
132
|
+
<>
|
|
133
|
+
<CarouselPrevious className="absolute z-10 inset-y-0 -left-12 my-auto" />
|
|
134
|
+
<CarouselNext className="absolute z-10 inset-y-0 -right-12 my-auto" />
|
|
135
|
+
</>
|
|
136
|
+
)}
|
|
137
|
+
{showDots && (
|
|
138
|
+
<div className="mt-4 flex justify-center">
|
|
139
|
+
<CarouselDots />
|
|
140
|
+
</div>
|
|
141
|
+
)}
|
|
142
|
+
</Carousel>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
);
|
|
146
|
+
},
|
|
147
|
+
);
|
|
148
|
+
CarouselPreset.displayName = "CarouselPreset";
|
|
149
|
+
|
|
150
|
+
export { CarouselPreset };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { render, screen } from "@testing-library/react";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { CheckboxPreset } from "./checkbox-preset";
|
|
4
|
+
|
|
5
|
+
describe("CheckboxPreset", () => {
|
|
6
|
+
it("renders checkbox", () => {
|
|
7
|
+
render(<CheckboxPreset />);
|
|
8
|
+
const checkbox = screen.getByRole("checkbox");
|
|
9
|
+
expect(checkbox).toBeInTheDocument();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("renders label when provided", () => {
|
|
13
|
+
render(<CheckboxPreset label="Accept terms" />);
|
|
14
|
+
expect(screen.getByText("Accept terms")).toBeInTheDocument();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("renders description when provided", () => {
|
|
18
|
+
render(<CheckboxPreset label="Terms" description="You must accept" />);
|
|
19
|
+
expect(screen.getByText("You must accept")).toBeInTheDocument();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("renders error message when provided", () => {
|
|
23
|
+
render(<CheckboxPreset errorMessage="Required" />);
|
|
24
|
+
expect(screen.getByText("Required")).toBeInTheDocument();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("sets aria-invalid when errorMessage is provided", () => {
|
|
28
|
+
render(<CheckboxPreset errorMessage="Required" />);
|
|
29
|
+
const checkbox = screen.getByRole("checkbox");
|
|
30
|
+
expect(checkbox).toHaveAttribute("aria-invalid", "true");
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it("renders the check indicator", () => {
|
|
34
|
+
const { container } = render(<CheckboxPreset />);
|
|
35
|
+
// CheckboxIndicator may not render a separate data-slot when unchecked
|
|
36
|
+
const checkbox = container.querySelector("[data-slot='checkbox']");
|
|
37
|
+
expect(checkbox).toBeInTheDocument();
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("links label to checkbox", () => {
|
|
41
|
+
render(<CheckboxPreset label="Agree" />);
|
|
42
|
+
const checkbox = screen.getByRole("checkbox");
|
|
43
|
+
const label = screen.getByText("Agree");
|
|
44
|
+
expect(checkbox).toBeInTheDocument();
|
|
45
|
+
expect(label).toBeInTheDocument();
|
|
46
|
+
// Label's for attr may point to internal input
|
|
47
|
+
expect(label.getAttribute("for")).toBeTruthy();
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Checkbox, CheckboxIndicator } from "../../components/micro/checkbox";
|
|
2
|
+
import {
|
|
3
|
+
Field,
|
|
4
|
+
FieldDescription,
|
|
5
|
+
FieldError,
|
|
6
|
+
FieldLabel,
|
|
7
|
+
} from "../../components/micro/field";
|
|
8
|
+
import { type Size } from "../../lib/types";
|
|
9
|
+
import { cn } from "../../lib/utils";
|
|
10
|
+
import { CheckIcon } from "lucide-react";
|
|
11
|
+
import * as React from "react";
|
|
12
|
+
|
|
13
|
+
export type CheckboxPresetProps = Omit<
|
|
14
|
+
React.ComponentProps<typeof Checkbox>,
|
|
15
|
+
"className" | "size"
|
|
16
|
+
> & {
|
|
17
|
+
// Forward className to the outermost wrapper (FieldPreset) instead of the Checkbox primitive
|
|
18
|
+
className?: string;
|
|
19
|
+
label?: React.ReactNode;
|
|
20
|
+
description?: React.ReactNode;
|
|
21
|
+
errorMessage?: React.ReactNode;
|
|
22
|
+
showError?: boolean;
|
|
23
|
+
size?: Size;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const CheckboxPreset = React.forwardRef<
|
|
27
|
+
React.ComponentRef<typeof Checkbox>,
|
|
28
|
+
CheckboxPresetProps
|
|
29
|
+
>(
|
|
30
|
+
(
|
|
31
|
+
{
|
|
32
|
+
label,
|
|
33
|
+
description,
|
|
34
|
+
errorMessage,
|
|
35
|
+
showError = true,
|
|
36
|
+
className,
|
|
37
|
+
id,
|
|
38
|
+
size = "md",
|
|
39
|
+
...checkboxProps
|
|
40
|
+
},
|
|
41
|
+
ref,
|
|
42
|
+
) => {
|
|
43
|
+
const generatedId = React.useId();
|
|
44
|
+
const inputId = id || generatedId;
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<Field
|
|
48
|
+
className={cn("flex flex-row items-start gap-3", className)}
|
|
49
|
+
data-size={size}
|
|
50
|
+
>
|
|
51
|
+
{/* Zero-width space hack to perfectly align the Checkbox with the first line of the Label */}
|
|
52
|
+
<div className="flex items-center text-sm leading-snug group-data-[size=sm]/field:text-xs group-data-[size=lg]/field:text-base">
|
|
53
|
+
​
|
|
54
|
+
<Checkbox
|
|
55
|
+
ref={ref}
|
|
56
|
+
id={inputId}
|
|
57
|
+
aria-invalid={!!errorMessage}
|
|
58
|
+
size={size}
|
|
59
|
+
{...checkboxProps}
|
|
60
|
+
>
|
|
61
|
+
<CheckboxIndicator>
|
|
62
|
+
<CheckIcon />
|
|
63
|
+
</CheckboxIndicator>
|
|
64
|
+
</Checkbox>
|
|
65
|
+
</div>
|
|
66
|
+
<div className="grid gap-1.5 leading-none">
|
|
67
|
+
{label && (
|
|
68
|
+
<FieldLabel
|
|
69
|
+
htmlFor={inputId}
|
|
70
|
+
className="font-medium cursor-pointer"
|
|
71
|
+
>
|
|
72
|
+
{label}
|
|
73
|
+
</FieldLabel>
|
|
74
|
+
)}
|
|
75
|
+
{description && <FieldDescription>{description}</FieldDescription>}
|
|
76
|
+
{showError && errorMessage && <FieldError>{errorMessage}</FieldError>}
|
|
77
|
+
</div>
|
|
78
|
+
</Field>
|
|
79
|
+
);
|
|
80
|
+
},
|
|
81
|
+
);
|
|
82
|
+
CheckboxPreset.displayName = "CheckboxPreset";
|
|
83
|
+
|
|
84
|
+
export { CheckboxPreset };
|