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,309 @@
|
|
|
1
|
+
import { useDevContext } from "../../dev/components/dev-context";
|
|
2
|
+
import {
|
|
3
|
+
DocsP,
|
|
4
|
+
ExampleGrid,
|
|
5
|
+
ExampleSection,
|
|
6
|
+
Showcase,
|
|
7
|
+
ShowcaseDocs,
|
|
8
|
+
} from "../../dev/components/showcase";
|
|
9
|
+
import { DownloadIcon, MailIcon, PlusIcon } from "lucide-react";
|
|
10
|
+
import { useState } from "react";
|
|
11
|
+
|
|
12
|
+
import { Button, ButtonIcon } from "../../components/micro/button";
|
|
13
|
+
import { Spinner } from "../../components/micro/spinner";
|
|
14
|
+
import { type Size } from "../../lib/types";
|
|
15
|
+
|
|
16
|
+
function ButtonMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
17
|
+
const [isDeleting, setIsDeleting] = useState(false);
|
|
18
|
+
const [isSending, setIsSending] = useState(false);
|
|
19
|
+
|
|
20
|
+
const handleDelete = () => {
|
|
21
|
+
setIsDeleting(true);
|
|
22
|
+
setTimeout(() => setIsDeleting(false), 1500);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const handleSend = () => {
|
|
26
|
+
setIsSending(true);
|
|
27
|
+
setTimeout(() => setIsSending(false), 1500);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<div className="space-y-10 mt-6">
|
|
32
|
+
{/* ── Variants ── */}
|
|
33
|
+
<ExampleSection
|
|
34
|
+
label="Variants"
|
|
35
|
+
description="Tất cả các kiểu hiển thị hiện có."
|
|
36
|
+
codeString={`<Button variant="solid">
|
|
37
|
+
Solid
|
|
38
|
+
</Button>
|
|
39
|
+
<Button variant="outline">
|
|
40
|
+
Outline
|
|
41
|
+
</Button>
|
|
42
|
+
<Button variant="soft">
|
|
43
|
+
Soft
|
|
44
|
+
</Button>
|
|
45
|
+
<Button variant="ghost">
|
|
46
|
+
Ghost
|
|
47
|
+
</Button>
|
|
48
|
+
<Button variant="link">
|
|
49
|
+
Link
|
|
50
|
+
</Button>
|
|
51
|
+
`}
|
|
52
|
+
>
|
|
53
|
+
<Button size={globalSize} variant="solid">
|
|
54
|
+
Solid
|
|
55
|
+
</Button>
|
|
56
|
+
<Button size={globalSize} variant="outline">
|
|
57
|
+
Outline
|
|
58
|
+
</Button>
|
|
59
|
+
<Button size={globalSize} variant="soft">
|
|
60
|
+
Soft
|
|
61
|
+
</Button>
|
|
62
|
+
<Button size={globalSize} variant="ghost">
|
|
63
|
+
Ghost
|
|
64
|
+
</Button>
|
|
65
|
+
<Button size={globalSize} variant="link">
|
|
66
|
+
Link
|
|
67
|
+
</Button>
|
|
68
|
+
</ExampleSection>
|
|
69
|
+
|
|
70
|
+
{/* ── Colors ── */}
|
|
71
|
+
<ExampleSection
|
|
72
|
+
label="Colors"
|
|
73
|
+
description="Các màu semantic đi kèm variant solid."
|
|
74
|
+
codeString={`<Button color="primary">
|
|
75
|
+
Primary
|
|
76
|
+
</Button>
|
|
77
|
+
<Button color="secondary">
|
|
78
|
+
Secondary
|
|
79
|
+
</Button>
|
|
80
|
+
<Button color="destructive">
|
|
81
|
+
Destructive
|
|
82
|
+
</Button>
|
|
83
|
+
<Button color="warning">
|
|
84
|
+
Warning
|
|
85
|
+
</Button>
|
|
86
|
+
<Button color="success">
|
|
87
|
+
Success
|
|
88
|
+
</Button>
|
|
89
|
+
<Button color="info">
|
|
90
|
+
Info
|
|
91
|
+
</Button>
|
|
92
|
+
<Button color="tertiary">
|
|
93
|
+
Tertiary
|
|
94
|
+
</Button>
|
|
95
|
+
<Button color="muted">
|
|
96
|
+
Muted
|
|
97
|
+
</Button>
|
|
98
|
+
<Button color="accent">
|
|
99
|
+
Accent
|
|
100
|
+
</Button>
|
|
101
|
+
`}
|
|
102
|
+
>
|
|
103
|
+
<Button size={globalSize} color="primary">
|
|
104
|
+
Primary
|
|
105
|
+
</Button>
|
|
106
|
+
<Button size={globalSize} color="secondary">
|
|
107
|
+
Secondary
|
|
108
|
+
</Button>
|
|
109
|
+
<Button size={globalSize} color="destructive">
|
|
110
|
+
Destructive
|
|
111
|
+
</Button>
|
|
112
|
+
<Button size={globalSize} color="warning">
|
|
113
|
+
Warning
|
|
114
|
+
</Button>
|
|
115
|
+
<Button size={globalSize} color="success">
|
|
116
|
+
Success
|
|
117
|
+
</Button>
|
|
118
|
+
<Button size={globalSize} color="info">
|
|
119
|
+
Info
|
|
120
|
+
</Button>
|
|
121
|
+
<Button size={globalSize} color="tertiary">
|
|
122
|
+
Tertiary
|
|
123
|
+
</Button>
|
|
124
|
+
<Button size={globalSize} color="muted">
|
|
125
|
+
Muted
|
|
126
|
+
</Button>
|
|
127
|
+
<Button size={globalSize} color="accent">
|
|
128
|
+
Accent
|
|
129
|
+
</Button>
|
|
130
|
+
</ExampleSection>
|
|
131
|
+
|
|
132
|
+
{/* ── With Icon ── */}
|
|
133
|
+
<ExampleGrid>
|
|
134
|
+
<ExampleSection
|
|
135
|
+
label="With Icon"
|
|
136
|
+
description="Button kèm icon ở đầu hoặc cuối."
|
|
137
|
+
codeString={`<Button variant="outline">
|
|
138
|
+
<ButtonIcon render={<MailIcon />} />
|
|
139
|
+
Login with Email
|
|
140
|
+
</Button>
|
|
141
|
+
<Button>
|
|
142
|
+
<ButtonIcon render={<DownloadIcon />} />
|
|
143
|
+
Download
|
|
144
|
+
</Button>
|
|
145
|
+
`}
|
|
146
|
+
>
|
|
147
|
+
<Button size={globalSize} variant="outline">
|
|
148
|
+
<ButtonIcon render={<MailIcon />} />
|
|
149
|
+
Login with Email
|
|
150
|
+
</Button>
|
|
151
|
+
<Button size={globalSize}>
|
|
152
|
+
<ButtonIcon render={<DownloadIcon />} />
|
|
153
|
+
Download
|
|
154
|
+
</Button>
|
|
155
|
+
</ExampleSection>
|
|
156
|
+
|
|
157
|
+
<ExampleSection
|
|
158
|
+
label="Icon Only"
|
|
159
|
+
description="Button vuông chỉ chứa icon."
|
|
160
|
+
codeString={`<Button variant="outline" iconOnly={true}>
|
|
161
|
+
<ButtonIcon render={<PlusIcon />} />
|
|
162
|
+
</Button>
|
|
163
|
+
<Button variant="ghost" iconOnly={true}>
|
|
164
|
+
<ButtonIcon render={<MailIcon />} />
|
|
165
|
+
</Button>
|
|
166
|
+
<Button variant="soft" iconOnly={true}>
|
|
167
|
+
<ButtonIcon render={<DownloadIcon />} />
|
|
168
|
+
</Button>
|
|
169
|
+
`}
|
|
170
|
+
>
|
|
171
|
+
<Button size={globalSize} variant="outline" iconOnly={true}>
|
|
172
|
+
<ButtonIcon render={<PlusIcon />} />
|
|
173
|
+
</Button>
|
|
174
|
+
<Button size={globalSize} variant="ghost" iconOnly={true}>
|
|
175
|
+
<ButtonIcon render={<MailIcon />} />
|
|
176
|
+
</Button>
|
|
177
|
+
<Button size={globalSize} variant="soft" iconOnly={true}>
|
|
178
|
+
<ButtonIcon render={<DownloadIcon />} />
|
|
179
|
+
</Button>
|
|
180
|
+
</ExampleSection>
|
|
181
|
+
</ExampleGrid>
|
|
182
|
+
|
|
183
|
+
{/* ── Disabled ── */}
|
|
184
|
+
<ExampleSection
|
|
185
|
+
label="Disabled"
|
|
186
|
+
description="Button không thể tương tác, hiển thị mờ."
|
|
187
|
+
codeString={`<Button disabled>
|
|
188
|
+
Solid Disabled
|
|
189
|
+
</Button>
|
|
190
|
+
<Button variant="outline" disabled>
|
|
191
|
+
Outline Disabled
|
|
192
|
+
</Button>
|
|
193
|
+
<Button variant="soft" disabled>
|
|
194
|
+
Soft Disabled
|
|
195
|
+
</Button>
|
|
196
|
+
<Button variant="ghost" disabled>
|
|
197
|
+
Ghost Disabled
|
|
198
|
+
</Button>
|
|
199
|
+
<Button variant="link" disabled>
|
|
200
|
+
Link Disabled
|
|
201
|
+
</Button>
|
|
202
|
+
`}
|
|
203
|
+
>
|
|
204
|
+
<Button size={globalSize} disabled>
|
|
205
|
+
Solid Disabled
|
|
206
|
+
</Button>
|
|
207
|
+
<Button size={globalSize} variant="outline" disabled>
|
|
208
|
+
Outline Disabled
|
|
209
|
+
</Button>
|
|
210
|
+
<Button size={globalSize} variant="soft" disabled>
|
|
211
|
+
Soft Disabled
|
|
212
|
+
</Button>
|
|
213
|
+
<Button size={globalSize} variant="ghost" disabled>
|
|
214
|
+
Ghost Disabled
|
|
215
|
+
</Button>
|
|
216
|
+
<Button size={globalSize} variant="link" disabled>
|
|
217
|
+
Link Disabled
|
|
218
|
+
</Button>
|
|
219
|
+
</ExampleSection>
|
|
220
|
+
|
|
221
|
+
{/* ── Real-world examples ── */}
|
|
222
|
+
<ExampleGrid>
|
|
223
|
+
<ExampleSection
|
|
224
|
+
label="Loading State"
|
|
225
|
+
description="Button kèm Spinner khi đang xử lý async."
|
|
226
|
+
fullWidth
|
|
227
|
+
codeString={`<Button color="primary" className="w-full" disabled={isSending} onClick={handleSend}>
|
|
228
|
+
{isSending && <Spinner />}
|
|
229
|
+
{isSending ? "Sending..." : "Send Message"}
|
|
230
|
+
</Button>
|
|
231
|
+
<Button variant="outline" className="w-full">
|
|
232
|
+
Save Draft
|
|
233
|
+
</Button>`}
|
|
234
|
+
>
|
|
235
|
+
<div className="flex flex-col gap-3 w-full max-w-xs mx-auto">
|
|
236
|
+
<Button
|
|
237
|
+
size={globalSize}
|
|
238
|
+
color="primary"
|
|
239
|
+
className="w-full"
|
|
240
|
+
disabled={isSending}
|
|
241
|
+
onClick={handleSend}
|
|
242
|
+
>
|
|
243
|
+
{isSending && <Spinner />}
|
|
244
|
+
{isSending ? "Sending..." : "Send Message"}
|
|
245
|
+
</Button>
|
|
246
|
+
<Button size={globalSize} variant="outline" className="w-full">
|
|
247
|
+
Save Draft
|
|
248
|
+
</Button>
|
|
249
|
+
</div>
|
|
250
|
+
</ExampleSection>
|
|
251
|
+
|
|
252
|
+
<ExampleSection
|
|
253
|
+
label="Destructive"
|
|
254
|
+
description="Xác nhận hành động nguy hiểm (xoá dữ liệu, huỷ tài khoản...)."
|
|
255
|
+
fullWidth
|
|
256
|
+
codeString={`<Button color="destructive" className="w-full mt-1" disabled={isDeleting} onClick={handleDelete}>
|
|
257
|
+
{isDeleting && <Spinner />}
|
|
258
|
+
{isDeleting ? "Deleting..." : "Delete Permanently"}
|
|
259
|
+
</Button>`}
|
|
260
|
+
>
|
|
261
|
+
<div className="w-full max-w-xs mx-auto rounded-lg border border-destructive/20 bg-destructive/5 p-4 flex flex-col gap-2">
|
|
262
|
+
<p className="text-sm font-medium">Delete Workspace</p>
|
|
263
|
+
<p className="text-xs text-muted-foreground">
|
|
264
|
+
This action cannot be undone. All data will be lost.
|
|
265
|
+
</p>
|
|
266
|
+
<Button
|
|
267
|
+
size={globalSize}
|
|
268
|
+
color="destructive"
|
|
269
|
+
className="w-full mt-1"
|
|
270
|
+
disabled={isDeleting}
|
|
271
|
+
onClick={handleDelete}
|
|
272
|
+
>
|
|
273
|
+
{isDeleting && <Spinner />}
|
|
274
|
+
{isDeleting ? "Deleting..." : "Delete Permanently"}
|
|
275
|
+
</Button>
|
|
276
|
+
</div>
|
|
277
|
+
</ExampleSection>
|
|
278
|
+
</ExampleGrid>
|
|
279
|
+
</div>
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// ──────────────────────────────────────────────────────────
|
|
284
|
+
// SECTION 3: Entry point
|
|
285
|
+
// ──────────────────────────────────────────────────────────
|
|
286
|
+
export default function ButtonShowcase() {
|
|
287
|
+
const { size: globalSize } = useDevContext();
|
|
288
|
+
return (
|
|
289
|
+
<Showcase
|
|
290
|
+
title="Button"
|
|
291
|
+
description="Kích hoạt hành động hoặc sự kiện — ví dụ: submit form, mở dialog."
|
|
292
|
+
generalConcept={
|
|
293
|
+
<ShowcaseDocs>
|
|
294
|
+
<DocsP>
|
|
295
|
+
Thành phần cơ bản để người dùng tương tác. Hỗ trợ nhiều variant,
|
|
296
|
+
màu sắc, icon, và trạng thái loading/disabled. Thường được dùng
|
|
297
|
+
trong form, dialog, hoặc toolbar.
|
|
298
|
+
</DocsP>
|
|
299
|
+
</ShowcaseDocs>
|
|
300
|
+
}
|
|
301
|
+
tabs={[
|
|
302
|
+
{
|
|
303
|
+
label: "Micro (Primitive)",
|
|
304
|
+
content: <ButtonMicroShowcase globalSize={globalSize} />,
|
|
305
|
+
},
|
|
306
|
+
]}
|
|
307
|
+
/>
|
|
308
|
+
);
|
|
309
|
+
}
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import { useDevContext } from "../../dev/components/dev-context";
|
|
2
|
+
import {
|
|
3
|
+
DocsP,
|
|
4
|
+
ExampleGrid,
|
|
5
|
+
ExampleSection,
|
|
6
|
+
Showcase,
|
|
7
|
+
ShowcaseDocs,
|
|
8
|
+
} from "../../dev/components/showcase";
|
|
9
|
+
import { useState } from "react";
|
|
10
|
+
import { type DateRange } from "react-day-picker";
|
|
11
|
+
|
|
12
|
+
import { Calendar } from "../../components/micro/calendar";
|
|
13
|
+
import { DatePicker } from "../../components/macro/date-picker";
|
|
14
|
+
import { type Size } from "../../lib/types";
|
|
15
|
+
|
|
16
|
+
function CalendarMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
17
|
+
const [singleDate, setSingleDate] = useState<Date | undefined>(new Date());
|
|
18
|
+
const [multipleDates, setMultipleDates] = useState<Date[] | undefined>([
|
|
19
|
+
new Date(2026, 5, 10),
|
|
20
|
+
new Date(2026, 5, 15),
|
|
21
|
+
new Date(2026, 5, 20),
|
|
22
|
+
]);
|
|
23
|
+
const [dateRange, setDateRange] = useState<DateRange | undefined>({
|
|
24
|
+
from: new Date(2026, 5, 15),
|
|
25
|
+
to: new Date(2026, 5, 25),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div className="space-y-10 mt-6">
|
|
30
|
+
<ExampleGrid>
|
|
31
|
+
{/* ── Single Date ── */}
|
|
32
|
+
<ExampleSection
|
|
33
|
+
label="Single Date"
|
|
34
|
+
description="Chọn một ngày duy nhất."
|
|
35
|
+
codeString={`const [date, setDate] = React.useState<Date | undefined>(new Date())
|
|
36
|
+
|
|
37
|
+
<Calendar
|
|
38
|
+
mode="single"
|
|
39
|
+
selected={date}
|
|
40
|
+
onSelect={setDate}
|
|
41
|
+
className="rounded-xl border border-border shadow"
|
|
42
|
+
/>`}
|
|
43
|
+
>
|
|
44
|
+
<div className="border border-border rounded-xl inline-block bg-card p-3">
|
|
45
|
+
<Calendar
|
|
46
|
+
size={globalSize}
|
|
47
|
+
mode="single"
|
|
48
|
+
selected={singleDate}
|
|
49
|
+
onSelect={setSingleDate}
|
|
50
|
+
className="w-full"
|
|
51
|
+
/>
|
|
52
|
+
</div>
|
|
53
|
+
</ExampleSection>
|
|
54
|
+
|
|
55
|
+
{/* ── Date Range ── */}
|
|
56
|
+
<ExampleSection
|
|
57
|
+
label="Date Range"
|
|
58
|
+
description="Chọn một phạm vi ngày."
|
|
59
|
+
codeString={`const [date, setDate] = React.useState<DateRange | undefined>({
|
|
60
|
+
from: new Date(2026, 5, 15),
|
|
61
|
+
to: new Date(2026, 5, 25),
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
<Calendar
|
|
65
|
+
mode="range"
|
|
66
|
+
selected={date}
|
|
67
|
+
onSelect={setDate}
|
|
68
|
+
className="rounded-xl border border-border shadow"
|
|
69
|
+
/>`}
|
|
70
|
+
>
|
|
71
|
+
<div className="border border-border rounded-xl inline-block bg-card p-3">
|
|
72
|
+
<Calendar
|
|
73
|
+
size={globalSize}
|
|
74
|
+
mode="range"
|
|
75
|
+
selected={dateRange}
|
|
76
|
+
onSelect={setDateRange}
|
|
77
|
+
className="w-full"
|
|
78
|
+
/>
|
|
79
|
+
</div>
|
|
80
|
+
</ExampleSection>
|
|
81
|
+
</ExampleGrid>
|
|
82
|
+
|
|
83
|
+
<ExampleGrid>
|
|
84
|
+
{/* ── Multiple Dates ── */}
|
|
85
|
+
<ExampleSection
|
|
86
|
+
label="Multiple Dates"
|
|
87
|
+
description="Chọn nhiều ngày rời rạc (mode='multiple')."
|
|
88
|
+
codeString={`const [dates, setDates] = React.useState<Date[] | undefined>([])
|
|
89
|
+
|
|
90
|
+
<Calendar
|
|
91
|
+
mode="multiple"
|
|
92
|
+
selected={dates}
|
|
93
|
+
onSelect={setDates}
|
|
94
|
+
className="rounded-xl border border-border shadow"
|
|
95
|
+
/>`}
|
|
96
|
+
>
|
|
97
|
+
<div className="border border-border rounded-xl inline-block bg-card p-3">
|
|
98
|
+
<Calendar
|
|
99
|
+
size={globalSize}
|
|
100
|
+
mode="multiple"
|
|
101
|
+
selected={multipleDates}
|
|
102
|
+
onSelect={setMultipleDates}
|
|
103
|
+
className="w-full"
|
|
104
|
+
/>
|
|
105
|
+
</div>
|
|
106
|
+
</ExampleSection>
|
|
107
|
+
|
|
108
|
+
{/* ── Disabled Dates ── */}
|
|
109
|
+
<ExampleSection
|
|
110
|
+
label="Disabled Dates"
|
|
111
|
+
description="Vô hiệu hóa chọn ngày (VD: ngày trong quá khứ)."
|
|
112
|
+
codeString={`<Calendar
|
|
113
|
+
mode="single"
|
|
114
|
+
disabled={(date) => date < new Date()}
|
|
115
|
+
className="rounded-xl border border-border shadow"
|
|
116
|
+
/>`}
|
|
117
|
+
>
|
|
118
|
+
<div className="border border-border rounded-xl inline-block bg-card p-3">
|
|
119
|
+
<Calendar
|
|
120
|
+
size={globalSize}
|
|
121
|
+
mode="single"
|
|
122
|
+
disabled={(date) => date < new Date(2026, 5, 15)}
|
|
123
|
+
defaultMonth={new Date(2026, 5, 15)}
|
|
124
|
+
className="w-full"
|
|
125
|
+
/>
|
|
126
|
+
</div>
|
|
127
|
+
</ExampleSection>
|
|
128
|
+
</ExampleGrid>
|
|
129
|
+
|
|
130
|
+
{/* ── Two Months ── */}
|
|
131
|
+
<ExampleSection
|
|
132
|
+
label="Two Months"
|
|
133
|
+
description="Hiển thị 2 tháng liền kề (numberOfMonths=2) thường dùng cho Date Range."
|
|
134
|
+
codeString={`<Calendar
|
|
135
|
+
mode="range"
|
|
136
|
+
selected={date}
|
|
137
|
+
onSelect={setDate}
|
|
138
|
+
numberOfMonths={2}
|
|
139
|
+
className="rounded-xl border border-border shadow"
|
|
140
|
+
/>`}
|
|
141
|
+
>
|
|
142
|
+
<div className="border border-border rounded-xl inline-block bg-card p-3 overflow-x-auto max-w-full">
|
|
143
|
+
<Calendar
|
|
144
|
+
size={globalSize}
|
|
145
|
+
mode="range"
|
|
146
|
+
selected={dateRange}
|
|
147
|
+
onSelect={setDateRange}
|
|
148
|
+
numberOfMonths={2}
|
|
149
|
+
className="w-full"
|
|
150
|
+
/>
|
|
151
|
+
</div>
|
|
152
|
+
</ExampleSection>
|
|
153
|
+
|
|
154
|
+
{/* ── With Navigation Dropdown ── */}
|
|
155
|
+
<ExampleSection
|
|
156
|
+
label="With Navigation"
|
|
157
|
+
description="Lịch với điều hướng thả xuống cho tháng/năm."
|
|
158
|
+
codeString={`<Calendar
|
|
159
|
+
mode="single"
|
|
160
|
+
captionLayout="dropdown"
|
|
161
|
+
className="rounded-xl border border-border shadow"
|
|
162
|
+
/>`}
|
|
163
|
+
>
|
|
164
|
+
<div className="border border-border rounded-xl inline-block bg-card p-3">
|
|
165
|
+
<Calendar
|
|
166
|
+
size={globalSize}
|
|
167
|
+
mode="single"
|
|
168
|
+
captionLayout="dropdown"
|
|
169
|
+
className="w-full"
|
|
170
|
+
/>
|
|
171
|
+
</div>
|
|
172
|
+
</ExampleSection>
|
|
173
|
+
</div>
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// ──────────────────────────────────────────────────────────
|
|
178
|
+
// SECTION 3: Macro Showcase
|
|
179
|
+
// ──────────────────────────────────────────────────────────
|
|
180
|
+
function CalendarMacroShowcase({ globalSize }: { globalSize: Size }) {
|
|
181
|
+
const [singleDate, setSingleDate] = useState<Date | undefined>(undefined);
|
|
182
|
+
const [rangeDate, setRangeDate] = useState<DateRange | undefined>(undefined);
|
|
183
|
+
const [descDate, setDescDate] = useState<Date | undefined>(undefined);
|
|
184
|
+
const [errDate, setErrDate] = useState<Date | undefined>(undefined);
|
|
185
|
+
const [disDate, setDisDate] = useState<Date | undefined>(undefined);
|
|
186
|
+
const [smDate, setSmDate] = useState<Date | undefined>(undefined);
|
|
187
|
+
const [mdDate, setMdDate] = useState<Date | undefined>(undefined);
|
|
188
|
+
const [lgDate, setLgDate] = useState<Date | undefined>(undefined);
|
|
189
|
+
|
|
190
|
+
return (
|
|
191
|
+
<div className="space-y-10 mt-6">
|
|
192
|
+
{/* ── Single Date ── */}
|
|
193
|
+
<ExampleGrid>
|
|
194
|
+
<ExampleSection
|
|
195
|
+
label="Single Date"
|
|
196
|
+
description="DatePicker cơ bản chọn một ngày."
|
|
197
|
+
codeString={`const [date, setDate] = React.useState<Date | undefined>()
|
|
198
|
+
|
|
199
|
+
<DatePicker className="w-64"
|
|
200
|
+
label="Date"
|
|
201
|
+
value={date}
|
|
202
|
+
onValueChange={setDate}
|
|
203
|
+
/>`}
|
|
204
|
+
>
|
|
205
|
+
<DatePicker
|
|
206
|
+
className="w-64"
|
|
207
|
+
size={globalSize}
|
|
208
|
+
label="Date"
|
|
209
|
+
value={singleDate}
|
|
210
|
+
onValueChange={setSingleDate}
|
|
211
|
+
/>
|
|
212
|
+
</ExampleSection>
|
|
213
|
+
|
|
214
|
+
{/* ── Date Range ── */}
|
|
215
|
+
<ExampleSection
|
|
216
|
+
label="Date Range"
|
|
217
|
+
description="DatePicker chọn khoảng thời gian (range mode)."
|
|
218
|
+
codeString={`const [range, setRange] = React.useState<DateRange | undefined>()
|
|
219
|
+
|
|
220
|
+
<DatePicker className="w-64"
|
|
221
|
+
mode="range"
|
|
222
|
+
label="Date Range"
|
|
223
|
+
rangeValue={range}
|
|
224
|
+
onRangeChange={setRange}
|
|
225
|
+
/>`}
|
|
226
|
+
>
|
|
227
|
+
<DatePicker
|
|
228
|
+
className="w-64"
|
|
229
|
+
mode="range"
|
|
230
|
+
size={globalSize}
|
|
231
|
+
label="Date Range"
|
|
232
|
+
rangeValue={rangeDate}
|
|
233
|
+
onRangeChange={setRangeDate}
|
|
234
|
+
/>
|
|
235
|
+
</ExampleSection>
|
|
236
|
+
</ExampleGrid>
|
|
237
|
+
|
|
238
|
+
{/* ── Dropdown Modes ── */}
|
|
239
|
+
<ExampleGrid>
|
|
240
|
+
<ExampleSection
|
|
241
|
+
label="Single Dropdown"
|
|
242
|
+
description="Sổ danh sách để chọn tháng và năm nhanh chóng thay vì click qua lại liên tục."
|
|
243
|
+
codeString={`<DatePicker className="w-64"
|
|
244
|
+
label="Birthday"
|
|
245
|
+
captionLayout="dropdown"
|
|
246
|
+
startMonth={new Date(1900, 0)}
|
|
247
|
+
endMonth={new Date()}
|
|
248
|
+
/>`}
|
|
249
|
+
>
|
|
250
|
+
<DatePicker
|
|
251
|
+
className="w-64"
|
|
252
|
+
size={globalSize}
|
|
253
|
+
label="Birthday"
|
|
254
|
+
captionLayout="dropdown"
|
|
255
|
+
startMonth={new Date(1900, 0)}
|
|
256
|
+
endMonth={new Date()}
|
|
257
|
+
value={singleDate}
|
|
258
|
+
onValueChange={setSingleDate}
|
|
259
|
+
/>
|
|
260
|
+
</ExampleSection>
|
|
261
|
+
<ExampleSection
|
|
262
|
+
label="Range Dropdown"
|
|
263
|
+
description="Sổ danh sách cho cả 2 tháng khi chọn khoảng thời gian (cần numberOfMonths={2})."
|
|
264
|
+
codeString={`<DatePicker className="w-fit"
|
|
265
|
+
mode="range"
|
|
266
|
+
label="Date Range with Dropdowns"
|
|
267
|
+
captionLayout="dropdown"
|
|
268
|
+
numberOfMonths={2}
|
|
269
|
+
startMonth={new Date(2020, 0)}
|
|
270
|
+
endMonth={new Date(2030, 11)}
|
|
271
|
+
/>`}
|
|
272
|
+
>
|
|
273
|
+
<DatePicker
|
|
274
|
+
className="w-fit"
|
|
275
|
+
mode="range"
|
|
276
|
+
size={globalSize}
|
|
277
|
+
label="Date Range with Dropdowns"
|
|
278
|
+
captionLayout="dropdown"
|
|
279
|
+
numberOfMonths={2}
|
|
280
|
+
startMonth={new Date(2020, 0)}
|
|
281
|
+
endMonth={new Date(2030, 11)}
|
|
282
|
+
rangeValue={rangeDate}
|
|
283
|
+
onRangeChange={setRangeDate}
|
|
284
|
+
/>
|
|
285
|
+
</ExampleSection>
|
|
286
|
+
</ExampleGrid>
|
|
287
|
+
|
|
288
|
+
{/* ── With Description ── */}
|
|
289
|
+
<ExampleSection
|
|
290
|
+
label="With Label & Description"
|
|
291
|
+
description="Hiển thị label và mô tả bên dưới trigger."
|
|
292
|
+
codeString={`<DatePicker className="w-64"
|
|
293
|
+
label="Start Date"
|
|
294
|
+
description="Chọn ngày bắt đầu dự án."
|
|
295
|
+
placeholder="Pick a date"
|
|
296
|
+
/>`}
|
|
297
|
+
>
|
|
298
|
+
<DatePicker
|
|
299
|
+
className="w-64"
|
|
300
|
+
size={globalSize}
|
|
301
|
+
label="Start Date"
|
|
302
|
+
description="Chọn ngày bắt đầu dự án."
|
|
303
|
+
placeholder="Pick a date"
|
|
304
|
+
value={descDate}
|
|
305
|
+
onValueChange={setDescDate}
|
|
306
|
+
/>
|
|
307
|
+
</ExampleSection>
|
|
308
|
+
|
|
309
|
+
{/* ── Error / Validation ── */}
|
|
310
|
+
<ExampleSection
|
|
311
|
+
label="Error State"
|
|
312
|
+
description="Trigger hiển thị viền đỏ khi có errorMessage."
|
|
313
|
+
codeString={`<DatePicker className="w-64"
|
|
314
|
+
label="Due Date"
|
|
315
|
+
errorMessage="Due date is required."
|
|
316
|
+
/>`}
|
|
317
|
+
>
|
|
318
|
+
<DatePicker
|
|
319
|
+
className="w-64"
|
|
320
|
+
size={globalSize}
|
|
321
|
+
label="Due Date"
|
|
322
|
+
errorMessage="Due date is required."
|
|
323
|
+
value={errDate}
|
|
324
|
+
onValueChange={setErrDate}
|
|
325
|
+
/>
|
|
326
|
+
</ExampleSection>
|
|
327
|
+
|
|
328
|
+
{/* ── Disabled ── */}
|
|
329
|
+
<ExampleSection
|
|
330
|
+
label="Disabled"
|
|
331
|
+
description="Trigger bị vô hiệu hoá, người dùng không thể mở calendar."
|
|
332
|
+
codeString={`<DatePicker className="w-64"
|
|
333
|
+
label="Date"
|
|
334
|
+
disabled
|
|
335
|
+
/>`}
|
|
336
|
+
>
|
|
337
|
+
<DatePicker
|
|
338
|
+
className="w-64"
|
|
339
|
+
size={globalSize}
|
|
340
|
+
label="Date"
|
|
341
|
+
disabled
|
|
342
|
+
value={disDate}
|
|
343
|
+
onValueChange={setDisDate}
|
|
344
|
+
/>
|
|
345
|
+
</ExampleSection>
|
|
346
|
+
</div>
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// ──────────────────────────────────────────────────────────
|
|
351
|
+
// SECTION 4: Entry point
|
|
352
|
+
// ──────────────────────────────────────────────────────────
|
|
353
|
+
export default function CalendarShowcase() {
|
|
354
|
+
const { size: globalSize } = useDevContext();
|
|
355
|
+
return (
|
|
356
|
+
<Showcase
|
|
357
|
+
title="Calendar"
|
|
358
|
+
description="Thành phần chọn ngày, khoảng thời gian hoặc nhiều ngày."
|
|
359
|
+
generalConcept={
|
|
360
|
+
<ShowcaseDocs>
|
|
361
|
+
<DocsP>
|
|
362
|
+
Dùng để hiển thị lịch và cho phép người dùng chọn một ngày, nhiều
|
|
363
|
+
ngày hoặc một khoảng thời gian. Thường được sử dụng kết hợp với
|
|
364
|
+
Popover để tạo thành DatePicker.
|
|
365
|
+
</DocsP>
|
|
366
|
+
</ShowcaseDocs>
|
|
367
|
+
}
|
|
368
|
+
tabs={[
|
|
369
|
+
{
|
|
370
|
+
label: "Micro (Primitive)",
|
|
371
|
+
content: <CalendarMicroShowcase globalSize={globalSize} />,
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
label: "Macro (DatePicker)",
|
|
375
|
+
content: <CalendarMacroShowcase globalSize={globalSize} />,
|
|
376
|
+
},
|
|
377
|
+
]}
|
|
378
|
+
/>
|
|
379
|
+
);
|
|
380
|
+
}
|