@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,76 @@
|
|
|
1
|
+
import { cn } from "@/lib/utils";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A skeleton component for displaying loading placeholders that improve perceived performance
|
|
5
|
+
*
|
|
6
|
+
* The Skeleton component creates animated placeholders that mimic the structure and layout
|
|
7
|
+
* of content that is being loaded. It uses a subtle pulse animation to indicate loading
|
|
8
|
+
* state and maintains layout stability during data fetching operations.
|
|
9
|
+
*
|
|
10
|
+
* Based on shadcn/ui skeleton patterns, this component is designed to be highly composable
|
|
11
|
+
* and can be shaped to match any content structure using Tailwind CSS classes.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* // Basic usage - simple text placeholder
|
|
16
|
+
* <Skeleton className="h-4 w-[250px]" />
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* // Avatar skeleton - circular placeholder
|
|
22
|
+
* <Skeleton className="h-12 w-12 rounded-full" />
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* // Card skeleton - structured content placeholder
|
|
28
|
+
* <div className="space-y-2">
|
|
29
|
+
* <Skeleton className="h-6 w-3/4" />
|
|
30
|
+
* <Skeleton className="h-4 w-full" />
|
|
31
|
+
* <Skeleton className="h-4 w-5/6" />
|
|
32
|
+
* </div>
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* // Complex layout with multiple skeletons
|
|
38
|
+
* <Card>
|
|
39
|
+
* <CardHeader>
|
|
40
|
+
* <div className="flex items-center gap-3">
|
|
41
|
+
* <Skeleton className="h-10 w-10 rounded-full" />
|
|
42
|
+
* <div className="space-y-2">
|
|
43
|
+
* <Skeleton className="h-4 w-24" />
|
|
44
|
+
* <Skeleton className="h-3 w-16" />
|
|
45
|
+
* </div>
|
|
46
|
+
* </div>
|
|
47
|
+
* </CardHeader>
|
|
48
|
+
* <CardContent>
|
|
49
|
+
* <Skeleton className="h-4 w-full" />
|
|
50
|
+
* <Skeleton className="h-4 w-4/5" />
|
|
51
|
+
* </CardContent>
|
|
52
|
+
* </Card>
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @param className - Additional CSS classes for customizing size, shape, and appearance
|
|
56
|
+
* @param props - Standard HTML div element props
|
|
57
|
+
*
|
|
58
|
+
* @accessibility
|
|
59
|
+
* The component includes a pulse animation to indicate loading state and maintains
|
|
60
|
+
* layout stability. Consider adding aria-busy="true" or aria-label="Loading content"
|
|
61
|
+
* to parent containers for better screen reader support.
|
|
62
|
+
*
|
|
63
|
+
* @see {@link https://ui.shadcn.com/docs/components/skeleton} shadcn/ui Skeleton documentation
|
|
64
|
+
* @since 1.0.0
|
|
65
|
+
*/
|
|
66
|
+
function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
|
|
67
|
+
return (
|
|
68
|
+
<div
|
|
69
|
+
data-slot="skeleton"
|
|
70
|
+
className={cn("bg-accent animate-pulse rounded-md", className)}
|
|
71
|
+
{...props}
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export { Skeleton };
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as SliderPrimitive from "@radix-ui/react-slider";
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Slider component for selecting numeric values within a range
|
|
8
|
+
*
|
|
9
|
+
* A versatile range input control built on Radix UI Slider primitives that allows users
|
|
10
|
+
* to select single or multiple values by dragging thumbs along a track. Supports both
|
|
11
|
+
* horizontal and vertical orientations, custom ranges, step intervals, and accessibility
|
|
12
|
+
* features for keyboard and touch interaction.
|
|
13
|
+
*
|
|
14
|
+
* Based on the shadcn/ui Slider component with enhanced styling and behavior.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* // Basic single-value slider
|
|
19
|
+
* <Slider defaultValue={[33]} max={100} step={1} />
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* // Controlled slider with state
|
|
25
|
+
* const [value, setValue] = useState([25])
|
|
26
|
+
*
|
|
27
|
+
* <Slider
|
|
28
|
+
* value={value}
|
|
29
|
+
* onValueChange={setValue}
|
|
30
|
+
* max={100}
|
|
31
|
+
* step={5}
|
|
32
|
+
* />
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* // Range slider with two thumbs
|
|
38
|
+
* <Slider
|
|
39
|
+
* defaultValue={[25, 75]}
|
|
40
|
+
* max={100}
|
|
41
|
+
* step={1}
|
|
42
|
+
* minStepsBetweenThumbs={10}
|
|
43
|
+
* />
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```tsx
|
|
48
|
+
* // Vertical orientation
|
|
49
|
+
* <Slider
|
|
50
|
+
* defaultValue={[50]}
|
|
51
|
+
* max={100}
|
|
52
|
+
* orientation="vertical"
|
|
53
|
+
* className="h-60"
|
|
54
|
+
* />
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```tsx
|
|
59
|
+
* // Custom range and step
|
|
60
|
+
* <Slider
|
|
61
|
+
* defaultValue={[500]}
|
|
62
|
+
* min={0}
|
|
63
|
+
* max={1000}
|
|
64
|
+
* step={50}
|
|
65
|
+
* />
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @accessibility
|
|
69
|
+
* - Implements WAI-ARIA slider pattern with proper roles and properties
|
|
70
|
+
* - Arrow keys adjust value by step amount (Left/Down decrease, Right/Up increase)
|
|
71
|
+
* - Page Up/Page Down adjust by larger increments (10 × step)
|
|
72
|
+
* - Home/End keys jump to minimum/maximum values
|
|
73
|
+
* - Supports keyboard navigation with focus visible indicators
|
|
74
|
+
* - Touch and mouse interaction supported
|
|
75
|
+
* - Screen reader announcements for value changes
|
|
76
|
+
* - Disabled state properly communicated to assistive technologies
|
|
77
|
+
*
|
|
78
|
+
* @see {@link https://ui.shadcn.com/docs/components/slider} for design patterns
|
|
79
|
+
* @see {@link https://www.radix-ui.com/docs/primitives/components/slider} for API reference
|
|
80
|
+
*
|
|
81
|
+
* @since 1.0.0
|
|
82
|
+
*/
|
|
83
|
+
/**
|
|
84
|
+
* @param className - Additional CSS classes for styling customization
|
|
85
|
+
* @param defaultValue - The default value(s) of the slider (uncontrolled)
|
|
86
|
+
* @param value - The controlled value(s) of the slider
|
|
87
|
+
* @param min - The minimum value of the slider (default: 0)
|
|
88
|
+
* @param max - The maximum value of the slider (default: 100)
|
|
89
|
+
* @param step - The step interval for value changes (default: 1)
|
|
90
|
+
* @param orientation - The orientation of the slider ("horizontal" | "vertical")
|
|
91
|
+
* @param disabled - Whether the slider is disabled
|
|
92
|
+
* @param onValueChange - Callback fired when the value changes
|
|
93
|
+
* @param minStepsBetweenThumbs - Minimum steps between thumbs in range mode
|
|
94
|
+
* @param ...props - Additional props passed to the underlying Radix Slider Root
|
|
95
|
+
*/
|
|
96
|
+
function Slider({
|
|
97
|
+
className,
|
|
98
|
+
defaultValue,
|
|
99
|
+
value,
|
|
100
|
+
min = 0,
|
|
101
|
+
max = 100,
|
|
102
|
+
...props
|
|
103
|
+
}: React.ComponentProps<typeof SliderPrimitive.Root>) {
|
|
104
|
+
const _values = Array.isArray(value)
|
|
105
|
+
? value
|
|
106
|
+
: Array.isArray(defaultValue)
|
|
107
|
+
? defaultValue
|
|
108
|
+
: [min, max];
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<SliderPrimitive.Root
|
|
112
|
+
data-slot="slider"
|
|
113
|
+
defaultValue={defaultValue}
|
|
114
|
+
value={value}
|
|
115
|
+
min={min}
|
|
116
|
+
max={max}
|
|
117
|
+
className={cn(
|
|
118
|
+
"relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",
|
|
119
|
+
className,
|
|
120
|
+
)}
|
|
121
|
+
{...props}
|
|
122
|
+
>
|
|
123
|
+
<SliderPrimitive.Track
|
|
124
|
+
data-slot="slider-track"
|
|
125
|
+
className={cn(
|
|
126
|
+
"bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5",
|
|
127
|
+
)}
|
|
128
|
+
>
|
|
129
|
+
<SliderPrimitive.Range
|
|
130
|
+
data-slot="slider-range"
|
|
131
|
+
className={cn(
|
|
132
|
+
"bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full",
|
|
133
|
+
)}
|
|
134
|
+
/>
|
|
135
|
+
</SliderPrimitive.Track>
|
|
136
|
+
{Array.from({ length: _values.length }, (_, index) => (
|
|
137
|
+
<SliderPrimitive.Thumb
|
|
138
|
+
data-slot="slider-thumb"
|
|
139
|
+
key={index}
|
|
140
|
+
className="border-primary bg-background ring-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
|
|
141
|
+
/>
|
|
142
|
+
))}
|
|
143
|
+
</SliderPrimitive.Root>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export { Slider };
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { useTheme } from "@/hooks/use-theme";
|
|
2
|
+
import { Toaster as Sonner, type ToasterProps, toast } from "sonner";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Toast notification container component built on Sonner
|
|
6
|
+
*
|
|
7
|
+
* An opinionated toast component that provides beautiful, accessible notifications
|
|
8
|
+
* with minimal setup. Automatically integrates with the theme system and provides
|
|
9
|
+
* consistent styling across the application. This is the recommended toast solution
|
|
10
|
+
* for @neynar/ui projects, replacing previous toast implementations.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* // Add to your app root layout
|
|
15
|
+
* import { Toaster } from '@neynar/ui/components/ui/sonner';
|
|
16
|
+
*
|
|
17
|
+
* export default function RootLayout({ children }) {
|
|
18
|
+
* return (
|
|
19
|
+
* <html lang="en">
|
|
20
|
+
* <body>
|
|
21
|
+
* <main>{children}</main>
|
|
22
|
+
* <Toaster />
|
|
23
|
+
* </body>
|
|
24
|
+
* </html>
|
|
25
|
+
* );
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* // Basic toast usage from anywhere in your app
|
|
32
|
+
* import { toast } from 'sonner';
|
|
33
|
+
*
|
|
34
|
+
* // Simple notification
|
|
35
|
+
* toast('Cast published successfully');
|
|
36
|
+
*
|
|
37
|
+
* // Success variant
|
|
38
|
+
* toast.success('Profile updated');
|
|
39
|
+
*
|
|
40
|
+
* // With description and action
|
|
41
|
+
* toast('Event created', {
|
|
42
|
+
* description: 'Sunday, December 03, 2023 at 9:00 AM',
|
|
43
|
+
* action: {
|
|
44
|
+
* label: 'Undo',
|
|
45
|
+
* onClick: () => console.log('Undo')
|
|
46
|
+
* }
|
|
47
|
+
* });
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```tsx
|
|
52
|
+
* // Promise-based toasts for async operations
|
|
53
|
+
* toast.promise(saveData(), {
|
|
54
|
+
* loading: 'Saving changes...',
|
|
55
|
+
* success: 'Data saved successfully!',
|
|
56
|
+
* error: 'Failed to save changes'
|
|
57
|
+
* });
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```tsx
|
|
62
|
+
* // Custom configuration
|
|
63
|
+
* <Toaster
|
|
64
|
+
* position="top-center"
|
|
65
|
+
* expand={true}
|
|
66
|
+
* richColors
|
|
67
|
+
* duration={5000}
|
|
68
|
+
* closeButton
|
|
69
|
+
* />
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @param props - Configuration options for the toast container
|
|
73
|
+
* @param props.position - Position of toasts on screen. Options: "top-left", "top-center", "top-right", "bottom-left", "bottom-center", "bottom-right". Default: "bottom-right"
|
|
74
|
+
* @param props.hotkey - Keyboard shortcut to focus toasts. Default: ["altKey", "KeyT"]
|
|
75
|
+
* @param props.richColors - Enable enhanced colors for different toast types. Default: false
|
|
76
|
+
* @param props.expand - Expand toasts by default to show full content. Default: false
|
|
77
|
+
* @param props.duration - Default duration in milliseconds before auto-dismiss. Default: 4000
|
|
78
|
+
* @param props.gap - Spacing between toasts in pixels. Default: 14
|
|
79
|
+
* @param props.visibleToasts - Maximum number of toasts visible at once. Default: 3
|
|
80
|
+
* @param props.closeButton - Show close button on each toast. Default: false
|
|
81
|
+
* @param props.toastOptions - Default options applied to all toasts
|
|
82
|
+
* @param props.className - Additional CSS classes for the toast container
|
|
83
|
+
* @param props.style - Additional inline styles for the toast container
|
|
84
|
+
* @param props.offset - Offset from viewport edges in pixels or string
|
|
85
|
+
* @param props.dir - Text direction for toast content. Options: "ltr", "rtl", "auto". Default: "ltr"
|
|
86
|
+
* @param props.loadingIcon - Custom loading icon component
|
|
87
|
+
* @param props.icons - Custom icons for different toast types
|
|
88
|
+
*
|
|
89
|
+
* @accessibility
|
|
90
|
+
* - Toasts are announced to screen readers with appropriate ARIA attributes
|
|
91
|
+
* - Keyboard navigation support with customizable hotkey
|
|
92
|
+
* - Auto-dismiss functionality with configurable duration
|
|
93
|
+
* - Focus management for interactive elements within toasts
|
|
94
|
+
* - Respects user's prefers-reduced-motion settings
|
|
95
|
+
* - High contrast support for better visibility
|
|
96
|
+
*
|
|
97
|
+
* @see {@link https://ui.shadcn.com/docs/components/sonner} - shadcn/ui Sonner documentation
|
|
98
|
+
* @see {@link https://sonner.emilkowal.ski/} - Official Sonner documentation
|
|
99
|
+
* @since 1.0.0
|
|
100
|
+
*/
|
|
101
|
+
function Toaster({ ...props }: ToasterProps) {
|
|
102
|
+
const { mode } = useTheme();
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<Sonner
|
|
106
|
+
theme={mode as ToasterProps["theme"]}
|
|
107
|
+
className="toaster group"
|
|
108
|
+
style={
|
|
109
|
+
{
|
|
110
|
+
"--normal-bg": "var(--popover)",
|
|
111
|
+
"--normal-text": "var(--popover-foreground)",
|
|
112
|
+
"--normal-border": "var(--border)",
|
|
113
|
+
} as React.CSSProperties
|
|
114
|
+
}
|
|
115
|
+
{...props}
|
|
116
|
+
/>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export { Toaster, toast };
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cn } from "@/lib/utils";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Props for the Stack component
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export type StackProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
10
|
+
/**
|
|
11
|
+
* The spacing between stack items using Tailwind CSS spacing scale
|
|
12
|
+
*
|
|
13
|
+
* Controls the gap between child elements using Tailwind's space utilities.
|
|
14
|
+
* Each value corresponds to a Tailwind spacing unit (1 = 0.25rem, 4 = 1rem, etc.)
|
|
15
|
+
*
|
|
16
|
+
* @defaultValue 4
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* // Tight spacing for compact layouts
|
|
20
|
+
* <Stack spacing={2}>
|
|
21
|
+
* <Button>Save</Button>
|
|
22
|
+
* <Button>Cancel</Button>
|
|
23
|
+
* </Stack>
|
|
24
|
+
*
|
|
25
|
+
* // Generous spacing for section separation
|
|
26
|
+
* <Stack spacing={8}>
|
|
27
|
+
* <section>First section</section>
|
|
28
|
+
* <section>Second section</section>
|
|
29
|
+
* </Stack>
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
spacing?: 1 | 2 | 3 | 4 | 6 | 8 | 12;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The layout direction of the stack
|
|
36
|
+
*
|
|
37
|
+
* - `"vertical"` - Arranges children in a column with vertical spacing
|
|
38
|
+
* - `"horizontal"` - Arranges children in a row with horizontal spacing
|
|
39
|
+
*
|
|
40
|
+
* @defaultValue "vertical"
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx
|
|
43
|
+
* // Vertical stack (default)
|
|
44
|
+
* <Stack>
|
|
45
|
+
* <Card>Item 1</Card>
|
|
46
|
+
* <Card>Item 2</Card>
|
|
47
|
+
* </Stack>
|
|
48
|
+
*
|
|
49
|
+
* // Horizontal stack for action buttons
|
|
50
|
+
* <Stack direction="horizontal">
|
|
51
|
+
* <Button>Primary</Button>
|
|
52
|
+
* <Button variant="outline">Secondary</Button>
|
|
53
|
+
* </Stack>
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
direction?: "vertical" | "horizontal";
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Stack - A flexible layout component for consistent spacing between elements
|
|
61
|
+
*
|
|
62
|
+
* Stack is a fundamental layout primitive that arranges child elements in either
|
|
63
|
+
* vertical or horizontal direction with consistent spacing. Built on flexbox principles,
|
|
64
|
+
* it provides a clean API for common layout patterns without requiring custom CSS.
|
|
65
|
+
*
|
|
66
|
+
* This component is particularly useful for:
|
|
67
|
+
* - Form layouts with consistent field spacing
|
|
68
|
+
* - Button groups and action bars
|
|
69
|
+
* - Content sections with uniform gaps
|
|
70
|
+
* - Navigation lists and menus
|
|
71
|
+
* - Card layouts and content grids
|
|
72
|
+
*
|
|
73
|
+
* @example Basic vertical layout (default)
|
|
74
|
+
* ```tsx
|
|
75
|
+
* <Stack>
|
|
76
|
+
* <Card>Profile Information</Card>
|
|
77
|
+
* <Card>Account Settings</Card>
|
|
78
|
+
* <Card>Privacy Controls</Card>
|
|
79
|
+
* </Stack>
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* @example Horizontal action bar
|
|
83
|
+
* ```tsx
|
|
84
|
+
* <Stack direction="horizontal" spacing={3}>
|
|
85
|
+
* <Button>Save Changes</Button>
|
|
86
|
+
* <Button variant="outline">Cancel</Button>
|
|
87
|
+
* <Button variant="ghost">Reset</Button>
|
|
88
|
+
* </Stack>
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* @example Form sections with custom spacing
|
|
92
|
+
* ```tsx
|
|
93
|
+
* <Stack spacing={6}>
|
|
94
|
+
* <fieldset>
|
|
95
|
+
* <legend>Personal Information</legend>
|
|
96
|
+
* <Stack spacing={3}>
|
|
97
|
+
* <Input placeholder="Full Name" />
|
|
98
|
+
* <Input placeholder="Email Address" />
|
|
99
|
+
* </Stack>
|
|
100
|
+
* </fieldset>
|
|
101
|
+
* <fieldset>
|
|
102
|
+
* <legend>Preferences</legend>
|
|
103
|
+
* <Stack spacing={2}>
|
|
104
|
+
* <Checkbox>Email notifications</Checkbox>
|
|
105
|
+
* <Checkbox>Marketing updates</Checkbox>
|
|
106
|
+
* </Stack>
|
|
107
|
+
* </fieldset>
|
|
108
|
+
* </Stack>
|
|
109
|
+
* ```
|
|
110
|
+
*
|
|
111
|
+
* @example Responsive layout with additional styling
|
|
112
|
+
* ```tsx
|
|
113
|
+
* <Stack
|
|
114
|
+
* spacing={4}
|
|
115
|
+
* className="w-full max-w-md mx-auto p-6"
|
|
116
|
+
* >
|
|
117
|
+
* <h2>User Dashboard</h2>
|
|
118
|
+
* <Stack direction="horizontal" spacing={2} className="justify-between">
|
|
119
|
+
* <Badge>Online</Badge>
|
|
120
|
+
* <Button size="sm">Edit Profile</Button>
|
|
121
|
+
* </Stack>
|
|
122
|
+
* </Stack>
|
|
123
|
+
* ```
|
|
124
|
+
*
|
|
125
|
+
* @remarks
|
|
126
|
+
* **Design Philosophy:**
|
|
127
|
+
* - Follows the principle of consistent spacing throughout the UI
|
|
128
|
+
* - Uses Tailwind's spacing scale for predictable sizing
|
|
129
|
+
* - Composable with other layout components
|
|
130
|
+
* - Maintains semantic HTML structure
|
|
131
|
+
*
|
|
132
|
+
* **Performance:**
|
|
133
|
+
* - Lightweight wrapper around flexbox CSS
|
|
134
|
+
* - No JavaScript overhead for layout calculations
|
|
135
|
+
* - Leverages Tailwind's JIT compilation for minimal CSS
|
|
136
|
+
*
|
|
137
|
+
* **Accessibility:**
|
|
138
|
+
* - Preserves natural document flow and reading order
|
|
139
|
+
* - Compatible with screen readers and keyboard navigation
|
|
140
|
+
* - Supports semantic HTML elements as children
|
|
141
|
+
* - Does not interfere with focus management
|
|
142
|
+
*
|
|
143
|
+
* @public
|
|
144
|
+
* @since 1.0.0
|
|
145
|
+
* @see {@link https://tailwindcss.com/docs/space} Tailwind CSS spacing utilities
|
|
146
|
+
*/
|
|
147
|
+
const Stack = React.forwardRef<HTMLDivElement, StackProps>(
|
|
148
|
+
({ className, spacing = 4, direction = "vertical", ...props }, ref) => {
|
|
149
|
+
return (
|
|
150
|
+
<div
|
|
151
|
+
ref={ref}
|
|
152
|
+
className={cn(
|
|
153
|
+
direction === "vertical" ? "flex flex-col" : "flex flex-row",
|
|
154
|
+
{
|
|
155
|
+
"space-y-1": direction === "vertical" && spacing === 1,
|
|
156
|
+
"space-y-2": direction === "vertical" && spacing === 2,
|
|
157
|
+
"space-y-3": direction === "vertical" && spacing === 3,
|
|
158
|
+
"space-y-4": direction === "vertical" && spacing === 4,
|
|
159
|
+
"space-y-6": direction === "vertical" && spacing === 6,
|
|
160
|
+
"space-y-8": direction === "vertical" && spacing === 8,
|
|
161
|
+
"space-y-12": direction === "vertical" && spacing === 12,
|
|
162
|
+
"space-x-1": direction === "horizontal" && spacing === 1,
|
|
163
|
+
"space-x-2": direction === "horizontal" && spacing === 2,
|
|
164
|
+
"space-x-3": direction === "horizontal" && spacing === 3,
|
|
165
|
+
"space-x-4": direction === "horizontal" && spacing === 4,
|
|
166
|
+
"space-x-6": direction === "horizontal" && spacing === 6,
|
|
167
|
+
"space-x-8": direction === "horizontal" && spacing === 8,
|
|
168
|
+
"space-x-12": direction === "horizontal" && spacing === 12,
|
|
169
|
+
},
|
|
170
|
+
className,
|
|
171
|
+
)}
|
|
172
|
+
{...props}
|
|
173
|
+
/>
|
|
174
|
+
);
|
|
175
|
+
},
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
Stack.displayName = "Stack";
|
|
179
|
+
|
|
180
|
+
export { Stack };
|