@neynar/ui 0.1.1
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/LICENSE +21 -0
- package/README.md +195 -0
- package/dist/components/ui/accordion.d.ts +229 -0
- package/dist/components/ui/accordion.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog.d.ts +247 -0
- package/dist/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert.d.ts +187 -0
- package/dist/components/ui/alert.d.ts.map +1 -0
- package/dist/components/ui/aspect-ratio.d.ts +94 -0
- package/dist/components/ui/aspect-ratio.d.ts.map +1 -0
- package/dist/components/ui/avatar.d.ts +244 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/badge.d.ts +163 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/breadcrumb.d.ts +281 -0
- package/dist/components/ui/breadcrumb.d.ts.map +1 -0
- package/dist/components/ui/button.d.ts +129 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/calendar.d.ts +169 -0
- package/dist/components/ui/calendar.d.ts.map +1 -0
- package/dist/components/ui/card.d.ts +365 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/carousel.d.ts +369 -0
- package/dist/components/ui/carousel.d.ts.map +1 -0
- package/dist/components/ui/chart.d.ts +442 -0
- package/dist/components/ui/chart.d.ts.map +1 -0
- package/dist/components/ui/checkbox.d.ts +88 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/collapsible.d.ts +182 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/combobox.d.ts +270 -0
- package/dist/components/ui/combobox.d.ts.map +1 -0
- package/dist/components/ui/command.d.ts +355 -0
- package/dist/components/ui/command.d.ts.map +1 -0
- package/dist/components/ui/container.d.ts +102 -0
- package/dist/components/ui/container.d.ts.map +1 -0
- package/dist/components/ui/context-menu.d.ts +339 -0
- package/dist/components/ui/context-menu.d.ts.map +1 -0
- package/dist/components/ui/date-picker.d.ts +145 -0
- package/dist/components/ui/date-picker.d.ts.map +1 -0
- package/dist/components/ui/dialog.d.ts +322 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/drawer.d.ts +154 -0
- package/dist/components/ui/drawer.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +349 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/empty-state.d.ts +133 -0
- package/dist/components/ui/empty-state.d.ts.map +1 -0
- package/dist/components/ui/hover-card.d.ts +109 -0
- package/dist/components/ui/hover-card.d.ts.map +1 -0
- package/dist/components/ui/input.d.ts +89 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/label.d.ts +93 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/menubar.d.ts +306 -0
- package/dist/components/ui/menubar.d.ts.map +1 -0
- package/dist/components/ui/navigation-menu.d.ts +318 -0
- package/dist/components/ui/navigation-menu.d.ts.map +1 -0
- package/dist/components/ui/pagination.d.ts +343 -0
- package/dist/components/ui/pagination.d.ts.map +1 -0
- package/dist/components/ui/popover.d.ts +178 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/progress.d.ts +64 -0
- package/dist/components/ui/progress.d.ts.map +1 -0
- package/dist/components/ui/radio-group.d.ts +144 -0
- package/dist/components/ui/radio-group.d.ts.map +1 -0
- package/dist/components/ui/resizable.d.ts +164 -0
- package/dist/components/ui/resizable.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.d.ts +82 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/select.d.ts +316 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/separator.d.ts +80 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/sheet.d.ts +346 -0
- package/dist/components/ui/sheet.d.ts.map +1 -0
- package/dist/components/ui/sidebar.d.ts +1561 -0
- package/dist/components/ui/sidebar.d.ts.map +1 -0
- package/dist/components/ui/skeleton.d.ts +66 -0
- package/dist/components/ui/skeleton.d.ts.map +1 -0
- package/dist/components/ui/slider.d.ts +95 -0
- package/dist/components/ui/slider.d.ts.map +1 -0
- package/dist/components/ui/sonner.d.ts +101 -0
- package/dist/components/ui/sonner.d.ts.map +1 -0
- package/dist/components/ui/stack.d.ts +192 -0
- package/dist/components/ui/stack.d.ts.map +1 -0
- package/dist/components/ui/stories/accordion.stories.d.ts +71 -0
- package/dist/components/ui/stories/accordion.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/alert-dialog.stories.d.ts +39 -0
- package/dist/components/ui/stories/alert-dialog.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/alert.stories.d.ts +48 -0
- package/dist/components/ui/stories/alert.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/aspect-ratio.stories.d.ts +53 -0
- package/dist/components/ui/stories/aspect-ratio.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/avatar.stories.d.ts +49 -0
- package/dist/components/ui/stories/avatar.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/badge.stories.d.ts +64 -0
- package/dist/components/ui/stories/badge.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/breadcrumb.stories.d.ts +27 -0
- package/dist/components/ui/stories/breadcrumb.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/button.stories.d.ts +92 -0
- package/dist/components/ui/stories/button.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/calendar.stories.d.ts +94 -0
- package/dist/components/ui/stories/calendar.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/card.stories.d.ts +29 -0
- package/dist/components/ui/stories/card.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/carousel.stories.d.ts +42 -0
- package/dist/components/ui/stories/carousel.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/chart.stories.d.ts +51 -0
- package/dist/components/ui/stories/chart.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/checkbox.stories.d.ts +72 -0
- package/dist/components/ui/stories/checkbox.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/cn.stories.d.ts +19 -0
- package/dist/components/ui/stories/cn.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/collapsible.stories.d.ts +51 -0
- package/dist/components/ui/stories/collapsible.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/colors.stories.d.ts +31 -0
- package/dist/components/ui/stories/colors.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/combobox.stories.d.ts +89 -0
- package/dist/components/ui/stories/combobox.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/command.stories.d.ts +69 -0
- package/dist/components/ui/stories/command.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/container.stories.d.ts +42 -0
- package/dist/components/ui/stories/container.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/context-menu.stories.d.ts +32 -0
- package/dist/components/ui/stories/context-menu.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/date-picker.stories.d.ts +67 -0
- package/dist/components/ui/stories/date-picker.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/dialog.stories.d.ts +48 -0
- package/dist/components/ui/stories/dialog.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/drawer.stories.d.ts +33 -0
- package/dist/components/ui/stories/drawer.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/dropdown-menu.stories.d.ts +31 -0
- package/dist/components/ui/stories/dropdown-menu.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/empty-state.stories.d.ts +74 -0
- package/dist/components/ui/stories/empty-state.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/hover-card.stories.d.ts +35 -0
- package/dist/components/ui/stories/hover-card.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/input.stories.d.ts +69 -0
- package/dist/components/ui/stories/input.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/label.stories.d.ts +47 -0
- package/dist/components/ui/stories/label.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/menubar.stories.d.ts +39 -0
- package/dist/components/ui/stories/menubar.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/navigation-menu.stories.d.ts +44 -0
- package/dist/components/ui/stories/navigation-menu.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/pagination.stories.d.ts +33 -0
- package/dist/components/ui/stories/pagination.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/popover.stories.d.ts +36 -0
- package/dist/components/ui/stories/popover.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/progress.stories.d.ts +38 -0
- package/dist/components/ui/stories/progress.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/radio-group.stories.d.ts +76 -0
- package/dist/components/ui/stories/radio-group.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/resizable.stories.d.ts +49 -0
- package/dist/components/ui/stories/resizable.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/scroll-area.stories.d.ts +35 -0
- package/dist/components/ui/stories/scroll-area.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/select.stories.d.ts +51 -0
- package/dist/components/ui/stories/select.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/separator.stories.d.ts +58 -0
- package/dist/components/ui/stories/separator.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/sheet.stories.d.ts +43 -0
- package/dist/components/ui/stories/sheet.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/sidebar.stories.d.ts +60 -0
- package/dist/components/ui/stories/sidebar.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/skeleton.stories.d.ts +42 -0
- package/dist/components/ui/stories/skeleton.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/slider.stories.d.ts +99 -0
- package/dist/components/ui/stories/slider.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/sonner.stories.d.ts +9 -0
- package/dist/components/ui/stories/sonner.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/stack.stories.d.ts +39 -0
- package/dist/components/ui/stories/stack.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/switch.stories.d.ts +71 -0
- package/dist/components/ui/stories/switch.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/table.stories.d.ts +40 -0
- package/dist/components/ui/stories/table.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/tabs.stories.d.ts +62 -0
- package/dist/components/ui/stories/tabs.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/text-field.stories.d.ts +78 -0
- package/dist/components/ui/stories/text-field.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/textarea.stories.d.ts +57 -0
- package/dist/components/ui/stories/textarea.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/theme-toggle.stories.d.ts +71 -0
- package/dist/components/ui/stories/theme-toggle.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/theme.stories.d.ts +51 -0
- package/dist/components/ui/stories/theme.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/toggle-group.stories.d.ts +71 -0
- package/dist/components/ui/stories/toggle-group.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/toggle.stories.d.ts +78 -0
- package/dist/components/ui/stories/toggle.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/tooltip.stories.d.ts +37 -0
- package/dist/components/ui/stories/tooltip.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/typography.stories.d.ts +137 -0
- package/dist/components/ui/stories/typography.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/use-mobile.stories.d.ts +20 -0
- package/dist/components/ui/stories/use-mobile.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/use-theme.stories.d.ts +23 -0
- package/dist/components/ui/stories/use-theme.stories.d.ts.map +1 -0
- package/dist/components/ui/switch.d.ts +84 -0
- package/dist/components/ui/switch.d.ts.map +1 -0
- package/dist/components/ui/table.d.ts +321 -0
- package/dist/components/ui/table.d.ts.map +1 -0
- package/dist/components/ui/tabs.d.ts +260 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/text-field.d.ts +157 -0
- package/dist/components/ui/text-field.d.ts.map +1 -0
- package/dist/components/ui/textarea.d.ts +84 -0
- package/dist/components/ui/textarea.d.ts.map +1 -0
- package/dist/components/ui/theme-toggle.d.ts +105 -0
- package/dist/components/ui/theme-toggle.d.ts.map +1 -0
- package/dist/components/ui/theme.d.ts +110 -0
- package/dist/components/ui/theme.d.ts.map +1 -0
- package/dist/components/ui/toggle-group.d.ts +133 -0
- package/dist/components/ui/toggle-group.d.ts.map +1 -0
- package/dist/components/ui/toggle.d.ts +84 -0
- package/dist/components/ui/toggle.d.ts.map +1 -0
- package/dist/components/ui/tooltip.d.ts +202 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/typography.d.ts +287 -0
- package/dist/components/ui/typography.d.ts.map +1 -0
- package/dist/hooks/use-mobile.d.ts +74 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/hooks/use-theme.d.ts +142 -0
- package/dist/hooks/use-theme.d.ts.map +1 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27498 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/utils.d.ts +43 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/docs/llm/colors.md +273 -0
- package/docs/llm/components/buttons.md +68 -0
- package/docs/llm/components/cards.md +53 -0
- package/docs/llm/components/display.md +134 -0
- package/docs/llm/components/feedback.md +96 -0
- package/docs/llm/components/forms.md +90 -0
- package/docs/llm/components/layout.md +59 -0
- package/docs/llm/components/menus.md +70 -0
- package/docs/llm/components/navigation.md +80 -0
- package/docs/llm/components/overlays.md +83 -0
- package/docs/llm/components/tables.md +73 -0
- package/docs/llm/components/typography.md +199 -0
- package/docs/llm/components/utilities.md +114 -0
- package/docs/llm/guide.md +165 -0
- package/llms.txt +122 -0
- package/package.json +104 -0
- package/src/components/ui/accordion.tsx +285 -0
- package/src/components/ui/alert-dialog.tsx +387 -0
- package/src/components/ui/alert.tsx +243 -0
- package/src/components/ui/aspect-ratio.tsx +99 -0
- package/src/components/ui/avatar.tsx +288 -0
- package/src/components/ui/badge.tsx +205 -0
- package/src/components/ui/breadcrumb.tsx +378 -0
- package/src/components/ui/button.tsx +195 -0
- package/src/components/ui/calendar.tsx +371 -0
- package/src/components/ui/card.tsx +447 -0
- package/src/components/ui/carousel.tsx +624 -0
- package/src/components/ui/chart.tsx +802 -0
- package/src/components/ui/checkbox.tsx +113 -0
- package/src/components/ui/collapsible.tsx +207 -0
- package/src/components/ui/combobox.tsx +373 -0
- package/src/components/ui/command.tsx +518 -0
- package/src/components/ui/container.tsx +114 -0
- package/src/components/ui/context-menu.tsx +563 -0
- package/src/components/ui/date-picker.tsx +213 -0
- package/src/components/ui/dialog.tsx +447 -0
- package/src/components/ui/drawer.tsx +273 -0
- package/src/components/ui/dropdown-menu.tsx +578 -0
- package/src/components/ui/empty-state.tsx +145 -0
- package/src/components/ui/hover-card.tsx +144 -0
- package/src/components/ui/input.tsx +106 -0
- package/src/components/ui/label.tsx +110 -0
- package/src/components/ui/menubar.tsx +553 -0
- package/src/components/ui/navigation-menu.tsx +471 -0
- package/src/components/ui/pagination.tsx +456 -0
- package/src/components/ui/popover.tsx +216 -0
- package/src/components/ui/progress.tsx +88 -0
- package/src/components/ui/radio-group.tsx +183 -0
- package/src/components/ui/resizable.tsx +209 -0
- package/src/components/ui/scroll-area.tsx +132 -0
- package/src/components/ui/select.tsx +485 -0
- package/src/components/ui/separator.tsx +101 -0
- package/src/components/ui/sheet.tsx +495 -0
- package/src/components/ui/sidebar.tsx +2211 -0
- package/src/components/ui/skeleton.tsx +76 -0
- package/src/components/ui/slider.tsx +147 -0
- package/src/components/ui/sonner.tsx +120 -0
- package/src/components/ui/stack.tsx +180 -0
- package/src/components/ui/stories/accordion.stories.tsx +429 -0
- package/src/components/ui/stories/alert-dialog.stories.tsx +519 -0
- package/src/components/ui/stories/alert.stories.tsx +228 -0
- package/src/components/ui/stories/aspect-ratio.stories.tsx +200 -0
- package/src/components/ui/stories/avatar.stories.tsx +317 -0
- package/src/components/ui/stories/badge.stories.tsx +260 -0
- package/src/components/ui/stories/breadcrumb.stories.tsx +482 -0
- package/src/components/ui/stories/button.stories.tsx +266 -0
- package/src/components/ui/stories/calendar.stories.tsx +375 -0
- package/src/components/ui/stories/card.stories.tsx +308 -0
- package/src/components/ui/stories/carousel.stories.tsx +328 -0
- package/src/components/ui/stories/chart.stories.tsx +430 -0
- package/src/components/ui/stories/checkbox.stories.tsx +297 -0
- package/src/components/ui/stories/cn.stories.tsx +433 -0
- package/src/components/ui/stories/collapsible.stories.tsx +256 -0
- package/src/components/ui/stories/colors.stories.tsx +502 -0
- package/src/components/ui/stories/combobox.stories.tsx +301 -0
- package/src/components/ui/stories/command.stories.tsx +632 -0
- package/src/components/ui/stories/container.stories.tsx +250 -0
- package/src/components/ui/stories/context-menu.stories.tsx +446 -0
- package/src/components/ui/stories/date-picker.stories.tsx +378 -0
- package/src/components/ui/stories/dialog.stories.tsx +535 -0
- package/src/components/ui/stories/drawer.stories.tsx +364 -0
- package/src/components/ui/stories/dropdown-menu.stories.tsx +374 -0
- package/src/components/ui/stories/empty-state.stories.tsx +244 -0
- package/src/components/ui/stories/hover-card.stories.tsx +355 -0
- package/src/components/ui/stories/input.stories.tsx +289 -0
- package/src/components/ui/stories/label.stories.tsx +294 -0
- package/src/components/ui/stories/menubar.stories.tsx +764 -0
- package/src/components/ui/stories/navigation-menu.stories.tsx +539 -0
- package/src/components/ui/stories/pagination.stories.tsx +604 -0
- package/src/components/ui/stories/popover.stories.tsx +392 -0
- package/src/components/ui/stories/progress.stories.tsx +218 -0
- package/src/components/ui/stories/radio-group.stories.tsx +400 -0
- package/src/components/ui/stories/resizable.stories.tsx +417 -0
- package/src/components/ui/stories/scroll-area.stories.tsx +180 -0
- package/src/components/ui/stories/select.stories.tsx +389 -0
- package/src/components/ui/stories/separator.stories.tsx +192 -0
- package/src/components/ui/stories/sheet.stories.tsx +468 -0
- package/src/components/ui/stories/sidebar.stories.tsx +731 -0
- package/src/components/ui/stories/skeleton.stories.tsx +216 -0
- package/src/components/ui/stories/slider.stories.tsx +321 -0
- package/src/components/ui/stories/sonner.stories.tsx +373 -0
- package/src/components/ui/stories/stack.stories.tsx +222 -0
- package/src/components/ui/stories/switch.stories.tsx +202 -0
- package/src/components/ui/stories/table.stories.tsx +541 -0
- package/src/components/ui/stories/tabs.stories.tsx +544 -0
- package/src/components/ui/stories/text-field.stories.tsx +280 -0
- package/src/components/ui/stories/textarea.stories.tsx +245 -0
- package/src/components/ui/stories/theme-toggle.stories.tsx +275 -0
- package/src/components/ui/stories/theme.stories.tsx +412 -0
- package/src/components/ui/stories/toggle-group.stories.tsx +337 -0
- package/src/components/ui/stories/toggle.stories.tsx +325 -0
- package/src/components/ui/stories/tooltip.stories.tsx +444 -0
- package/src/components/ui/stories/typography.stories.tsx +1586 -0
- package/src/components/ui/stories/use-mobile.stories.tsx +420 -0
- package/src/components/ui/stories/use-theme.stories.tsx +531 -0
- package/src/components/ui/switch.tsx +106 -0
- package/src/components/ui/table.tsx +424 -0
- package/src/components/ui/tabs.tsx +316 -0
- package/src/components/ui/text-field.tsx +206 -0
- package/src/components/ui/textarea.tsx +98 -0
- package/src/components/ui/theme-toggle.tsx +185 -0
- package/src/components/ui/theme.tsx +148 -0
- package/src/components/ui/toggle-group.tsx +196 -0
- package/src/components/ui/toggle.tsx +115 -0
- package/src/components/ui/tooltip.tsx +253 -0
- package/src/components/ui/typography.tsx +468 -0
- package/src/hooks/use-mobile.ts +91 -0
- package/src/hooks/use-theme.ts +319 -0
- package/src/index.ts +77 -0
- package/src/lib/utils.ts +57 -0
- package/src/styles/globals.css +160 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { ArrowRight, Download, Plus, Settings, Trash2, ExternalLink } from "lucide-react";
|
|
3
|
+
import { Button } from "../button";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Button component stories for design system documentation
|
|
7
|
+
*
|
|
8
|
+
* This story file demonstrates the Button component's capabilities through three focused stories:
|
|
9
|
+
* - Interactive: Playground for testing all props and variants
|
|
10
|
+
* - Variants: Systematic showcase of all available style and size combinations
|
|
11
|
+
* - InContext: Real-world usage examples for business and design teams
|
|
12
|
+
*/
|
|
13
|
+
const meta = {
|
|
14
|
+
title: "Form & Input/Button",
|
|
15
|
+
component: Button,
|
|
16
|
+
parameters: {
|
|
17
|
+
layout: "centered",
|
|
18
|
+
docs: {
|
|
19
|
+
description: {
|
|
20
|
+
component:
|
|
21
|
+
"A versatile button component built on Radix UI primitives with multiple variants, sizes, and composition support. Perfect for actions, navigation, and form submissions.",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
tags: ["autodocs"],
|
|
26
|
+
argTypes: {
|
|
27
|
+
variant: {
|
|
28
|
+
control: { type: "select" },
|
|
29
|
+
options: [
|
|
30
|
+
"default",
|
|
31
|
+
"destructive",
|
|
32
|
+
"outline",
|
|
33
|
+
"secondary",
|
|
34
|
+
"ghost",
|
|
35
|
+
"link",
|
|
36
|
+
],
|
|
37
|
+
description: "Visual style variant - each serves different interaction purposes",
|
|
38
|
+
},
|
|
39
|
+
size: {
|
|
40
|
+
control: { type: "select" },
|
|
41
|
+
options: ["default", "sm", "lg", "icon"],
|
|
42
|
+
description: "Button size - affects height, padding, and typography scale",
|
|
43
|
+
},
|
|
44
|
+
asChild: {
|
|
45
|
+
control: { type: "boolean" },
|
|
46
|
+
description:
|
|
47
|
+
"Composition prop - renders child element instead of button (useful for links)",
|
|
48
|
+
},
|
|
49
|
+
disabled: {
|
|
50
|
+
control: { type: "boolean" },
|
|
51
|
+
description: "Disables the button and applies disabled styling",
|
|
52
|
+
},
|
|
53
|
+
children: {
|
|
54
|
+
control: { type: "text" },
|
|
55
|
+
description: "Button content - can include text, icons, or other elements",
|
|
56
|
+
},
|
|
57
|
+
type: {
|
|
58
|
+
control: { type: "select" },
|
|
59
|
+
options: ["button", "submit", "reset"],
|
|
60
|
+
description: "HTML button type for form interactions",
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
args: {
|
|
64
|
+
onClick: () => console.log("Button clicked"),
|
|
65
|
+
children: "Button",
|
|
66
|
+
},
|
|
67
|
+
} satisfies Meta<typeof Button>;
|
|
68
|
+
|
|
69
|
+
export default meta;
|
|
70
|
+
type Story = StoryObj<typeof meta>;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Interactive Playground Story
|
|
74
|
+
*
|
|
75
|
+
* Use this story to test all button props and variants through Storybook controls.
|
|
76
|
+
* Perfect for designers and developers to experiment with different combinations.
|
|
77
|
+
*/
|
|
78
|
+
export const Interactive: Story = {
|
|
79
|
+
args: {
|
|
80
|
+
children: "Interactive Button",
|
|
81
|
+
variant: "default",
|
|
82
|
+
size: "default",
|
|
83
|
+
disabled: false,
|
|
84
|
+
asChild: false,
|
|
85
|
+
},
|
|
86
|
+
parameters: {
|
|
87
|
+
docs: {
|
|
88
|
+
description: {
|
|
89
|
+
story:
|
|
90
|
+
"Interactive playground for testing all button properties. Use the controls panel to experiment with different variants, sizes, and states. The onClick event logs to the Actions panel.",
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Variants Showcase Story
|
|
98
|
+
*
|
|
99
|
+
* Systematic display of all available button variants and sizes.
|
|
100
|
+
* Helps design teams understand the full range of available options.
|
|
101
|
+
*/
|
|
102
|
+
export const Variants: Story = {
|
|
103
|
+
render: () => (
|
|
104
|
+
<div className="space-y-8">
|
|
105
|
+
{/* Visual Variants */}
|
|
106
|
+
<div className="space-y-4">
|
|
107
|
+
<h3 className="text-lg font-semibold">Visual Variants</h3>
|
|
108
|
+
<div className="flex flex-wrap gap-3">
|
|
109
|
+
<Button variant="default">Default</Button>
|
|
110
|
+
<Button variant="destructive">Destructive</Button>
|
|
111
|
+
<Button variant="outline">Outline</Button>
|
|
112
|
+
<Button variant="secondary">Secondary</Button>
|
|
113
|
+
<Button variant="ghost">Ghost</Button>
|
|
114
|
+
<Button variant="link">Link</Button>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
{/* Size Variants */}
|
|
119
|
+
<div className="space-y-4">
|
|
120
|
+
<h3 className="text-lg font-semibold">Size Variants</h3>
|
|
121
|
+
<div className="flex items-center gap-3">
|
|
122
|
+
<Button size="sm">Small</Button>
|
|
123
|
+
<Button size="default">Default</Button>
|
|
124
|
+
<Button size="lg">Large</Button>
|
|
125
|
+
<Button size="icon" aria-label="Settings">
|
|
126
|
+
<Settings className="size-4" />
|
|
127
|
+
</Button>
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
{/* Icon Integration */}
|
|
132
|
+
<div className="space-y-4">
|
|
133
|
+
<h3 className="text-lg font-semibold">Icon Integration</h3>
|
|
134
|
+
<div className="flex flex-wrap gap-3">
|
|
135
|
+
<Button>
|
|
136
|
+
<Download className="size-4" />
|
|
137
|
+
Download
|
|
138
|
+
</Button>
|
|
139
|
+
<Button variant="outline">
|
|
140
|
+
Continue
|
|
141
|
+
<ArrowRight className="size-4" />
|
|
142
|
+
</Button>
|
|
143
|
+
<Button size="icon" variant="ghost" aria-label="Add item">
|
|
144
|
+
<Plus className="size-4" />
|
|
145
|
+
</Button>
|
|
146
|
+
</div>
|
|
147
|
+
</div>
|
|
148
|
+
|
|
149
|
+
{/* States */}
|
|
150
|
+
<div className="space-y-4">
|
|
151
|
+
<h3 className="text-lg font-semibold">States</h3>
|
|
152
|
+
<div className="flex flex-wrap gap-3">
|
|
153
|
+
<Button disabled>Disabled</Button>
|
|
154
|
+
<Button disabled variant="outline">
|
|
155
|
+
<div className="animate-spin rounded-full h-4 w-4 border-2 border-current border-t-transparent mr-2" />
|
|
156
|
+
Loading...
|
|
157
|
+
</Button>
|
|
158
|
+
</div>
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
),
|
|
162
|
+
parameters: {
|
|
163
|
+
layout: "padded",
|
|
164
|
+
docs: {
|
|
165
|
+
description: {
|
|
166
|
+
story:
|
|
167
|
+
"Complete showcase of all button variants, sizes, icon integrations, and states. Use this as a reference for what's available in the design system.",
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Real-world Context Story
|
|
175
|
+
*
|
|
176
|
+
* Demonstrates the button component in realistic UI scenarios.
|
|
177
|
+
* Helps business teams and designers understand practical usage patterns.
|
|
178
|
+
*/
|
|
179
|
+
export const InContext: Story = {
|
|
180
|
+
render: () => (
|
|
181
|
+
<div className="space-y-8 max-w-md">
|
|
182
|
+
{/* Form Actions */}
|
|
183
|
+
<div className="space-y-4">
|
|
184
|
+
<h3 className="text-lg font-semibold">Form Actions</h3>
|
|
185
|
+
<div className="p-6 border rounded-lg space-y-4">
|
|
186
|
+
<div className="space-y-2">
|
|
187
|
+
<label className="text-sm font-medium">Email</label>
|
|
188
|
+
<input
|
|
189
|
+
type="email"
|
|
190
|
+
placeholder="Enter your email"
|
|
191
|
+
className="w-full px-3 py-2 border rounded-md"
|
|
192
|
+
/>
|
|
193
|
+
</div>
|
|
194
|
+
<div className="flex gap-2">
|
|
195
|
+
<Button type="submit" className="flex-1">
|
|
196
|
+
Sign Up
|
|
197
|
+
</Button>
|
|
198
|
+
<Button variant="outline" type="button">
|
|
199
|
+
Cancel
|
|
200
|
+
</Button>
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|
|
203
|
+
</div>
|
|
204
|
+
|
|
205
|
+
{/* Action Bar */}
|
|
206
|
+
<div className="space-y-4">
|
|
207
|
+
<h3 className="text-lg font-semibold">Action Bar</h3>
|
|
208
|
+
<div className="flex items-center justify-between p-4 border rounded-lg">
|
|
209
|
+
<div>
|
|
210
|
+
<h4 className="font-medium">Delete Account</h4>
|
|
211
|
+
<p className="text-sm text-muted-foreground">This action cannot be undone.</p>
|
|
212
|
+
</div>
|
|
213
|
+
<Button variant="destructive" size="sm">
|
|
214
|
+
<Trash2 className="size-4" />
|
|
215
|
+
Delete
|
|
216
|
+
</Button>
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
|
|
220
|
+
{/* Navigation */}
|
|
221
|
+
<div className="space-y-4">
|
|
222
|
+
<h3 className="text-lg font-semibold">Navigation & Links</h3>
|
|
223
|
+
<div className="space-y-3">
|
|
224
|
+
<div className="flex gap-2">
|
|
225
|
+
<Button variant="ghost" size="sm">
|
|
226
|
+
<Settings className="size-4" />
|
|
227
|
+
Settings
|
|
228
|
+
</Button>
|
|
229
|
+
<Button variant="ghost" size="sm">
|
|
230
|
+
Profile
|
|
231
|
+
</Button>
|
|
232
|
+
</div>
|
|
233
|
+
<Button variant="link" asChild>
|
|
234
|
+
<a href="https://example.com" target="_blank" rel="noopener noreferrer">
|
|
235
|
+
External Link
|
|
236
|
+
<ExternalLink className="size-4" />
|
|
237
|
+
</a>
|
|
238
|
+
</Button>
|
|
239
|
+
</div>
|
|
240
|
+
</div>
|
|
241
|
+
|
|
242
|
+
{/* Loading State */}
|
|
243
|
+
<div className="space-y-4">
|
|
244
|
+
<h3 className="text-lg font-semibold">Loading States</h3>
|
|
245
|
+
<div className="flex gap-2">
|
|
246
|
+
<Button disabled>
|
|
247
|
+
<div className="animate-spin rounded-full h-4 w-4 border-2 border-current border-t-transparent" />
|
|
248
|
+
Processing...
|
|
249
|
+
</Button>
|
|
250
|
+
<Button variant="outline" disabled>
|
|
251
|
+
Saving...
|
|
252
|
+
</Button>
|
|
253
|
+
</div>
|
|
254
|
+
</div>
|
|
255
|
+
</div>
|
|
256
|
+
),
|
|
257
|
+
parameters: {
|
|
258
|
+
layout: "padded",
|
|
259
|
+
docs: {
|
|
260
|
+
description: {
|
|
261
|
+
story:
|
|
262
|
+
"Real-world usage examples showing how buttons work in common UI patterns like forms, action bars, navigation, and loading states. Use these patterns as inspiration for your own implementations.",
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
};
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import type { DateRange as DateRangeType } from "react-day-picker";
|
|
4
|
+
import { Calendar } from "../calendar";
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: "Form & Input/Calendar",
|
|
8
|
+
component: Calendar,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: "centered",
|
|
11
|
+
docs: {
|
|
12
|
+
description: {
|
|
13
|
+
component:
|
|
14
|
+
"A comprehensive date selection calendar component built on react-day-picker. Supports single dates, date ranges, multiple dates, and flexible validation rules with full accessibility features.",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
tags: ["autodocs"],
|
|
19
|
+
argTypes: {
|
|
20
|
+
mode: {
|
|
21
|
+
control: { type: "select" },
|
|
22
|
+
options: ["single", "multiple", "range"],
|
|
23
|
+
description: "The selection mode of the calendar",
|
|
24
|
+
},
|
|
25
|
+
showOutsideDays: {
|
|
26
|
+
control: { type: "boolean" },
|
|
27
|
+
description: "Whether to show days outside the current month",
|
|
28
|
+
},
|
|
29
|
+
captionLayout: {
|
|
30
|
+
control: { type: "select" },
|
|
31
|
+
options: ["label", "dropdown-buttons", "dropdown"],
|
|
32
|
+
description: "Layout mode for the month/year caption",
|
|
33
|
+
},
|
|
34
|
+
buttonVariant: {
|
|
35
|
+
control: { type: "select" },
|
|
36
|
+
options: [
|
|
37
|
+
"default",
|
|
38
|
+
"destructive",
|
|
39
|
+
"outline",
|
|
40
|
+
"secondary",
|
|
41
|
+
"ghost",
|
|
42
|
+
"link",
|
|
43
|
+
],
|
|
44
|
+
description: "Variant for the navigation buttons",
|
|
45
|
+
},
|
|
46
|
+
numberOfMonths: {
|
|
47
|
+
control: { type: "number", min: 1, max: 12 },
|
|
48
|
+
description: "Number of months to display simultaneously",
|
|
49
|
+
},
|
|
50
|
+
disabled: {
|
|
51
|
+
control: { type: "boolean" },
|
|
52
|
+
description: "Whether the calendar is disabled",
|
|
53
|
+
},
|
|
54
|
+
fromYear: {
|
|
55
|
+
control: { type: "number" },
|
|
56
|
+
description: "Earliest year for dropdown selection",
|
|
57
|
+
},
|
|
58
|
+
toYear: {
|
|
59
|
+
control: { type: "number" },
|
|
60
|
+
description: "Latest year for dropdown selection",
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
args: {
|
|
64
|
+
showOutsideDays: true,
|
|
65
|
+
captionLayout: "label",
|
|
66
|
+
buttonVariant: "ghost",
|
|
67
|
+
numberOfMonths: 1,
|
|
68
|
+
},
|
|
69
|
+
} satisfies Meta<typeof Calendar>;
|
|
70
|
+
|
|
71
|
+
export default meta;
|
|
72
|
+
type Story = StoryObj<typeof meta>;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Interactive playground for testing all calendar features and configurations.
|
|
76
|
+
* Use the controls panel to experiment with different props and see real-time changes.
|
|
77
|
+
*/
|
|
78
|
+
export const Interactive: Story = {
|
|
79
|
+
render: (args) => {
|
|
80
|
+
const [date, setDate] = useState<Date | undefined>();
|
|
81
|
+
const [dateRange, setDateRange] = useState<DateRangeType | undefined>();
|
|
82
|
+
const [multipleDates, setMultipleDates] = useState<Date[] | undefined>([]);
|
|
83
|
+
|
|
84
|
+
// Handle different selection modes
|
|
85
|
+
const getSelected = () => {
|
|
86
|
+
switch (args.mode) {
|
|
87
|
+
case "range":
|
|
88
|
+
return dateRange;
|
|
89
|
+
case "multiple":
|
|
90
|
+
return multipleDates;
|
|
91
|
+
default:
|
|
92
|
+
return date;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
97
|
+
const handleSelect = (selected: any) => {
|
|
98
|
+
switch (args.mode) {
|
|
99
|
+
case "range":
|
|
100
|
+
setDateRange(selected);
|
|
101
|
+
break;
|
|
102
|
+
case "multiple":
|
|
103
|
+
setMultipleDates(selected);
|
|
104
|
+
break;
|
|
105
|
+
default:
|
|
106
|
+
setDate(selected);
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const getSelectedText = () => {
|
|
112
|
+
switch (args.mode) {
|
|
113
|
+
case "range":
|
|
114
|
+
if (dateRange?.from && dateRange?.to) {
|
|
115
|
+
return `${dateRange.from.toLocaleDateString()} - ${dateRange.to.toLocaleDateString()}`;
|
|
116
|
+
}
|
|
117
|
+
if (dateRange?.from) {
|
|
118
|
+
return `From: ${dateRange.from.toLocaleDateString()}`;
|
|
119
|
+
}
|
|
120
|
+
return "No range selected";
|
|
121
|
+
case "multiple":
|
|
122
|
+
return multipleDates?.length
|
|
123
|
+
? `${multipleDates.length} dates selected: ${multipleDates
|
|
124
|
+
.slice(0, 3)
|
|
125
|
+
.map((d) => d.toLocaleDateString())
|
|
126
|
+
.join(", ")}${multipleDates.length > 3 ? "..." : ""}`
|
|
127
|
+
: "No dates selected";
|
|
128
|
+
default:
|
|
129
|
+
return date
|
|
130
|
+
? `Selected: ${date.toLocaleDateString()}`
|
|
131
|
+
: "No date selected";
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
return (
|
|
136
|
+
<div className="space-y-4">
|
|
137
|
+
<Calendar
|
|
138
|
+
{...args}
|
|
139
|
+
// @ts-expect-error - selected is not typed correctly
|
|
140
|
+
selected={getSelected()}
|
|
141
|
+
onSelect={handleSelect}
|
|
142
|
+
className="rounded-md border"
|
|
143
|
+
/>
|
|
144
|
+
<div className="text-sm text-muted-foreground max-w-md">
|
|
145
|
+
<strong>Current Selection:</strong> {getSelectedText()}
|
|
146
|
+
</div>
|
|
147
|
+
</div>
|
|
148
|
+
);
|
|
149
|
+
},
|
|
150
|
+
args: {
|
|
151
|
+
mode: "single",
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Comprehensive showcase of all calendar variants and configurations.
|
|
157
|
+
* Demonstrates different selection modes, layouts, and styling options.
|
|
158
|
+
*/
|
|
159
|
+
export const Variants: Story = {
|
|
160
|
+
render: () => {
|
|
161
|
+
const [singleDate, setSingleDate] = useState<Date | undefined>(new Date());
|
|
162
|
+
const [dateRange, setDateRange] = useState<DateRangeType | undefined>();
|
|
163
|
+
const [multipleDates, setMultipleDates] = useState<Date[] | undefined>([]);
|
|
164
|
+
|
|
165
|
+
return (
|
|
166
|
+
<div className="space-y-8 max-w-6xl">
|
|
167
|
+
<div>
|
|
168
|
+
<h3 className="text-lg font-semibold mb-4">Selection Modes</h3>
|
|
169
|
+
<div className="grid gap-6 md:grid-cols-2 lg:grid-cols-3">
|
|
170
|
+
<div className="space-y-2">
|
|
171
|
+
<h4 className="text-sm font-medium">Single Date</h4>
|
|
172
|
+
<Calendar
|
|
173
|
+
mode="single"
|
|
174
|
+
selected={singleDate}
|
|
175
|
+
onSelect={setSingleDate}
|
|
176
|
+
className="rounded-md border"
|
|
177
|
+
/>
|
|
178
|
+
</div>
|
|
179
|
+
<div className="space-y-2">
|
|
180
|
+
<h4 className="text-sm font-medium">Date Range</h4>
|
|
181
|
+
<Calendar
|
|
182
|
+
mode="range"
|
|
183
|
+
selected={dateRange}
|
|
184
|
+
onSelect={setDateRange}
|
|
185
|
+
className="rounded-md border"
|
|
186
|
+
/>
|
|
187
|
+
</div>
|
|
188
|
+
<div className="space-y-2">
|
|
189
|
+
<h4 className="text-sm font-medium">Multiple Dates</h4>
|
|
190
|
+
<Calendar
|
|
191
|
+
mode="multiple"
|
|
192
|
+
selected={multipleDates}
|
|
193
|
+
onSelect={setMultipleDates}
|
|
194
|
+
className="rounded-md border"
|
|
195
|
+
/>
|
|
196
|
+
</div>
|
|
197
|
+
</div>
|
|
198
|
+
</div>
|
|
199
|
+
|
|
200
|
+
<div>
|
|
201
|
+
<h3 className="text-lg font-semibold mb-4">Caption Layouts</h3>
|
|
202
|
+
<div className="grid gap-6 md:grid-cols-2">
|
|
203
|
+
<div className="space-y-2">
|
|
204
|
+
<h4 className="text-sm font-medium">Dropdown Navigation</h4>
|
|
205
|
+
<Calendar
|
|
206
|
+
mode="single"
|
|
207
|
+
captionLayout="dropdown"
|
|
208
|
+
fromYear={2020}
|
|
209
|
+
toYear={2030}
|
|
210
|
+
className="rounded-md border"
|
|
211
|
+
/>
|
|
212
|
+
</div>
|
|
213
|
+
<div className="space-y-2">
|
|
214
|
+
<h4 className="text-sm font-medium">Two Months</h4>
|
|
215
|
+
<Calendar
|
|
216
|
+
mode="range"
|
|
217
|
+
numberOfMonths={2}
|
|
218
|
+
className="rounded-md border"
|
|
219
|
+
/>
|
|
220
|
+
</div>
|
|
221
|
+
</div>
|
|
222
|
+
</div>
|
|
223
|
+
|
|
224
|
+
<div>
|
|
225
|
+
<h3 className="text-lg font-semibold mb-4">Button Variants</h3>
|
|
226
|
+
<div className="grid gap-6 md:grid-cols-3">
|
|
227
|
+
<div className="space-y-2">
|
|
228
|
+
<h4 className="text-sm font-medium">Outline Buttons</h4>
|
|
229
|
+
<Calendar
|
|
230
|
+
mode="single"
|
|
231
|
+
buttonVariant="outline"
|
|
232
|
+
className="rounded-md border"
|
|
233
|
+
/>
|
|
234
|
+
</div>
|
|
235
|
+
<div className="space-y-2">
|
|
236
|
+
<h4 className="text-sm font-medium">Secondary Buttons</h4>
|
|
237
|
+
<Calendar
|
|
238
|
+
mode="single"
|
|
239
|
+
buttonVariant="secondary"
|
|
240
|
+
className="rounded-md border"
|
|
241
|
+
/>
|
|
242
|
+
</div>
|
|
243
|
+
<div className="space-y-2">
|
|
244
|
+
<h4 className="text-sm font-medium">Default Buttons</h4>
|
|
245
|
+
<Calendar
|
|
246
|
+
mode="single"
|
|
247
|
+
buttonVariant="default"
|
|
248
|
+
className="rounded-md border"
|
|
249
|
+
/>
|
|
250
|
+
</div>
|
|
251
|
+
</div>
|
|
252
|
+
</div>
|
|
253
|
+
</div>
|
|
254
|
+
);
|
|
255
|
+
},
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Real-world usage example showing the calendar in a typical application context.
|
|
260
|
+
* Demonstrates integration with forms, validation, and user workflows.
|
|
261
|
+
*/
|
|
262
|
+
export const InContext: Story = {
|
|
263
|
+
render: () => {
|
|
264
|
+
const [checkIn, setCheckIn] = useState<Date | undefined>();
|
|
265
|
+
const [checkOut, setCheckOut] = useState<Date | undefined>();
|
|
266
|
+
const [eventDates, setEventDates] = useState<Date[] | undefined>([]);
|
|
267
|
+
const [birthdayDate, setBirthdayDate] = useState<Date | undefined>();
|
|
268
|
+
|
|
269
|
+
const today = new Date();
|
|
270
|
+
const maxCheckoutDate = new Date();
|
|
271
|
+
maxCheckoutDate.setMonth(today.getMonth() + 6);
|
|
272
|
+
|
|
273
|
+
return (
|
|
274
|
+
<div className="space-y-8 max-w-4xl">
|
|
275
|
+
<div className="rounded-lg border p-6 bg-card">
|
|
276
|
+
<h3 className="text-lg font-semibold mb-4">Hotel Booking System</h3>
|
|
277
|
+
<div className="grid gap-6 md:grid-cols-2">
|
|
278
|
+
<div className="space-y-3">
|
|
279
|
+
<label className="text-sm font-medium">Check-in Date</label>
|
|
280
|
+
<Calendar
|
|
281
|
+
mode="single"
|
|
282
|
+
selected={checkIn}
|
|
283
|
+
onSelect={setCheckIn}
|
|
284
|
+
disabled={(date) => date < today}
|
|
285
|
+
className="rounded-md border"
|
|
286
|
+
/>
|
|
287
|
+
<p className="text-xs text-muted-foreground">
|
|
288
|
+
{checkIn
|
|
289
|
+
? `Check-in: ${checkIn.toLocaleDateString()}`
|
|
290
|
+
: "Select check-in date"}
|
|
291
|
+
</p>
|
|
292
|
+
</div>
|
|
293
|
+
<div className="space-y-3">
|
|
294
|
+
<label className="text-sm font-medium">Check-out Date</label>
|
|
295
|
+
<Calendar
|
|
296
|
+
mode="single"
|
|
297
|
+
selected={checkOut}
|
|
298
|
+
onSelect={setCheckOut}
|
|
299
|
+
disabled={(date: Date) => {
|
|
300
|
+
return Boolean(
|
|
301
|
+
date < (checkIn || today) ||
|
|
302
|
+
date > maxCheckoutDate ||
|
|
303
|
+
(checkIn && date <= checkIn),
|
|
304
|
+
);
|
|
305
|
+
}}
|
|
306
|
+
className="rounded-md border"
|
|
307
|
+
/>
|
|
308
|
+
<p className="text-xs text-muted-foreground">
|
|
309
|
+
{checkOut
|
|
310
|
+
? `Check-out: ${checkOut.toLocaleDateString()}`
|
|
311
|
+
: "Select check-out date"}
|
|
312
|
+
</p>
|
|
313
|
+
</div>
|
|
314
|
+
</div>
|
|
315
|
+
</div>
|
|
316
|
+
|
|
317
|
+
<div className="rounded-lg border p-6 bg-card">
|
|
318
|
+
<h3 className="text-lg font-semibold mb-4">
|
|
319
|
+
Event Planning Dashboard
|
|
320
|
+
</h3>
|
|
321
|
+
<div className="grid gap-6 md:grid-cols-2">
|
|
322
|
+
<div className="space-y-3">
|
|
323
|
+
<label className="text-sm font-medium">Meeting Dates</label>
|
|
324
|
+
<Calendar
|
|
325
|
+
mode="multiple"
|
|
326
|
+
selected={eventDates}
|
|
327
|
+
onSelect={setEventDates}
|
|
328
|
+
disabled={(date) =>
|
|
329
|
+
date < today || date.getDay() === 0 || date.getDay() === 6
|
|
330
|
+
}
|
|
331
|
+
className="rounded-md border"
|
|
332
|
+
/>
|
|
333
|
+
<p className="text-xs text-muted-foreground">
|
|
334
|
+
{eventDates?.length
|
|
335
|
+
? `${eventDates.length} meeting dates selected`
|
|
336
|
+
: "Select weekdays for meetings"}
|
|
337
|
+
</p>
|
|
338
|
+
</div>
|
|
339
|
+
<div className="space-y-3">
|
|
340
|
+
<label className="text-sm font-medium">
|
|
341
|
+
Team Member Birthday
|
|
342
|
+
</label>
|
|
343
|
+
<Calendar
|
|
344
|
+
mode="single"
|
|
345
|
+
selected={birthdayDate}
|
|
346
|
+
onSelect={setBirthdayDate}
|
|
347
|
+
captionLayout="dropdown"
|
|
348
|
+
fromYear={1950}
|
|
349
|
+
toYear={new Date().getFullYear()}
|
|
350
|
+
className="rounded-md border"
|
|
351
|
+
/>
|
|
352
|
+
<p className="text-xs text-muted-foreground">
|
|
353
|
+
{birthdayDate
|
|
354
|
+
? `Birthday: ${birthdayDate.toLocaleDateString()}`
|
|
355
|
+
: "Select birthday date"}
|
|
356
|
+
</p>
|
|
357
|
+
</div>
|
|
358
|
+
</div>
|
|
359
|
+
</div>
|
|
360
|
+
|
|
361
|
+
<div className="rounded-lg border p-6 bg-card">
|
|
362
|
+
<h3 className="text-lg font-semibold mb-4">Features Demonstrated</h3>
|
|
363
|
+
<ul className="text-sm text-muted-foreground space-y-1">
|
|
364
|
+
<li>• Date validation and restrictions</li>
|
|
365
|
+
<li>• Weekend/business day filtering</li>
|
|
366
|
+
<li>• Multiple selection modes</li>
|
|
367
|
+
<li>• Dropdown navigation for large date ranges</li>
|
|
368
|
+
<li>• Real-time feedback and state management</li>
|
|
369
|
+
<li>• Accessible form integration</li>
|
|
370
|
+
</ul>
|
|
371
|
+
</div>
|
|
372
|
+
</div>
|
|
373
|
+
);
|
|
374
|
+
},
|
|
375
|
+
};
|