@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,145 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cn } from "@/lib/utils";
|
|
3
|
+
import { Button } from "./button";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Props for the EmptyState component
|
|
7
|
+
*
|
|
8
|
+
* Extends standard HTML div attributes to support all native div functionality
|
|
9
|
+
* while providing specific props for empty state content and behavior.
|
|
10
|
+
*
|
|
11
|
+
* @type EmptyStateProps
|
|
12
|
+
* @extends {React.HTMLAttributes<HTMLDivElement>}
|
|
13
|
+
*/
|
|
14
|
+
export type EmptyStateProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
15
|
+
/** Main title text displayed prominently in the empty state */
|
|
16
|
+
title: string;
|
|
17
|
+
/** Optional descriptive text providing additional context or guidance */
|
|
18
|
+
description?: string;
|
|
19
|
+
/** Optional icon, illustration, or React element displayed above the title */
|
|
20
|
+
icon?: React.ReactNode;
|
|
21
|
+
/** Optional action button configuration for primary user action */
|
|
22
|
+
action?: {
|
|
23
|
+
/** Text label for the action button */
|
|
24
|
+
label: string;
|
|
25
|
+
/** Click handler function executed when the action button is pressed */
|
|
26
|
+
onClick: () => void;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* EmptyState component for displaying empty or no-data states
|
|
32
|
+
*
|
|
33
|
+
* A versatile component that provides a consistent way to show empty states when there's
|
|
34
|
+
* no content to display. Commonly used in lists, tables, search results, dashboards,
|
|
35
|
+
* or any area where data might be absent. Follows standard empty state UX patterns
|
|
36
|
+
* with support for icons, descriptions, and call-to-action buttons to guide users.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```tsx
|
|
40
|
+
* // Basic empty state with title and description
|
|
41
|
+
* <EmptyState
|
|
42
|
+
* title="No results found"
|
|
43
|
+
* description="Try adjusting your search or filters to find what you're looking for"
|
|
44
|
+
* />
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```tsx
|
|
49
|
+
* // Empty state with icon and action button
|
|
50
|
+
* import { Search } from 'lucide-react';
|
|
51
|
+
*
|
|
52
|
+
* <EmptyState
|
|
53
|
+
* icon={<Search className="w-12 h-12" />}
|
|
54
|
+
* title="No search results"
|
|
55
|
+
* description="We couldn't find anything matching your search criteria"
|
|
56
|
+
* action={{
|
|
57
|
+
* label: "Clear search",
|
|
58
|
+
* onClick: () => handleClearSearch()
|
|
59
|
+
* }}
|
|
60
|
+
* />
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```tsx
|
|
65
|
+
* // Inbox empty state with contextual messaging
|
|
66
|
+
* import { Inbox } from 'lucide-react';
|
|
67
|
+
*
|
|
68
|
+
* <EmptyState
|
|
69
|
+
* icon={<Inbox className="w-16 h-16" />}
|
|
70
|
+
* title="Your inbox is empty"
|
|
71
|
+
* description="When you receive new messages, they'll appear here"
|
|
72
|
+
* action={{
|
|
73
|
+
* label: "Compose message",
|
|
74
|
+
* onClick: () => openComposer()
|
|
75
|
+
* }}
|
|
76
|
+
* />
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```tsx
|
|
81
|
+
* // Custom styled empty state for data visualization
|
|
82
|
+
* import { Database } from 'lucide-react';
|
|
83
|
+
*
|
|
84
|
+
* <EmptyState
|
|
85
|
+
* className="min-h-[400px] bg-muted/30 rounded-lg"
|
|
86
|
+
* icon={<Database className="w-14 h-14 opacity-50" />}
|
|
87
|
+
* title="No data available"
|
|
88
|
+
* description="Import data or connect a data source to get started"
|
|
89
|
+
* action={{
|
|
90
|
+
* label: "Import data",
|
|
91
|
+
* onClick: () => showImportDialog()
|
|
92
|
+
* }}
|
|
93
|
+
* />
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* @param props - Component props extending HTMLDivElement attributes
|
|
97
|
+
* @param props.title - Main title text displayed prominently (required)
|
|
98
|
+
* @param props.description - Optional descriptive text providing context
|
|
99
|
+
* @param props.icon - Optional icon or React element displayed above title
|
|
100
|
+
* @param props.action - Optional action button configuration
|
|
101
|
+
* @param props.className - Additional CSS classes for styling
|
|
102
|
+
* @param ref - Forwarded ref to the container div element
|
|
103
|
+
*
|
|
104
|
+
* @remarks
|
|
105
|
+
* **Accessibility Features:**
|
|
106
|
+
* - Uses semantic HTML structure with proper heading hierarchy
|
|
107
|
+
* - Title rendered as h3 element for screen reader navigation
|
|
108
|
+
* - Action button follows Button component accessibility patterns
|
|
109
|
+
* - Supports keyboard navigation and focus management
|
|
110
|
+
* - Screen reader friendly text content structure
|
|
111
|
+
*
|
|
112
|
+
* **Design Guidelines:**
|
|
113
|
+
* - Icon should be 48-64px (w-12 h-12 to w-16 h-16) for optimal visual balance
|
|
114
|
+
* - Keep titles concise and action-oriented
|
|
115
|
+
* - Use descriptions to provide helpful context or next steps
|
|
116
|
+
* - Action buttons should have clear, specific labels
|
|
117
|
+
*
|
|
118
|
+
* @see {@link Button} for action button styling and behavior
|
|
119
|
+
* @since 1.0.0
|
|
120
|
+
*/
|
|
121
|
+
const EmptyState = React.forwardRef<HTMLDivElement, EmptyStateProps>(
|
|
122
|
+
({ className, title, description, icon, action, ...props }, ref) => {
|
|
123
|
+
return (
|
|
124
|
+
<div
|
|
125
|
+
ref={ref}
|
|
126
|
+
className={cn(
|
|
127
|
+
"flex flex-col items-center justify-center text-center py-12 px-4",
|
|
128
|
+
className,
|
|
129
|
+
)}
|
|
130
|
+
{...props}
|
|
131
|
+
>
|
|
132
|
+
{icon && <div className="mb-4 text-muted-foreground">{icon}</div>}
|
|
133
|
+
<h3 className="text-lg font-semibold text-foreground mb-2">{title}</h3>
|
|
134
|
+
{description && (
|
|
135
|
+
<p className="text-muted-foreground mb-6 max-w-sm">{description}</p>
|
|
136
|
+
)}
|
|
137
|
+
{action && <Button onClick={action.onClick}>{action.label}</Button>}
|
|
138
|
+
</div>
|
|
139
|
+
);
|
|
140
|
+
},
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
EmptyState.displayName = "EmptyState";
|
|
144
|
+
|
|
145
|
+
export { EmptyState };
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as HoverCardPrimitive from "@radix-ui/react-hover-card";
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* HoverCard component for previewing content available behind a link
|
|
8
|
+
*
|
|
9
|
+
* For sighted users to preview content available behind a link. Displays rich content
|
|
10
|
+
* when users hover over a trigger element. Ideal for showing previews, user profiles,
|
|
11
|
+
* repository information, or contextual details without requiring navigation.
|
|
12
|
+
*
|
|
13
|
+
* Built on Radix UI Hover Card primitive with custom styling and animations.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* // Basic user profile hover card
|
|
18
|
+
* <HoverCard>
|
|
19
|
+
* <HoverCardTrigger asChild>
|
|
20
|
+
* <Button variant="link">@nextjs</Button>
|
|
21
|
+
* </HoverCardTrigger>
|
|
22
|
+
* <HoverCardContent className="w-80">
|
|
23
|
+
* <div className="flex justify-between gap-4">
|
|
24
|
+
* <Avatar>
|
|
25
|
+
* <AvatarImage src="https://github.com/vercel.png" />
|
|
26
|
+
* <AvatarFallback>VC</AvatarFallback>
|
|
27
|
+
* </Avatar>
|
|
28
|
+
* <div className="space-y-1">
|
|
29
|
+
* <h4 className="text-sm font-semibold">@nextjs</h4>
|
|
30
|
+
* <p className="text-sm">
|
|
31
|
+
* The React Framework – created and maintained by @vercel.
|
|
32
|
+
* </p>
|
|
33
|
+
* <div className="text-muted-foreground text-xs">
|
|
34
|
+
* Joined December 2021
|
|
35
|
+
* </div>
|
|
36
|
+
* </div>
|
|
37
|
+
* </div>
|
|
38
|
+
* </HoverCardContent>
|
|
39
|
+
* </HoverCard>
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* // With custom positioning and delays
|
|
45
|
+
* <HoverCard openDelay={500} closeDelay={200}>
|
|
46
|
+
* <HoverCardTrigger asChild>
|
|
47
|
+
* <Button>Hover me</Button>
|
|
48
|
+
* </HoverCardTrigger>
|
|
49
|
+
* <HoverCardContent side="top" align="start">
|
|
50
|
+
* Content appears above with custom alignment
|
|
51
|
+
* </HoverCardContent>
|
|
52
|
+
* </HoverCard>
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```tsx
|
|
57
|
+
* // Interactive content
|
|
58
|
+
* <HoverCard>
|
|
59
|
+
* <HoverCardTrigger asChild>
|
|
60
|
+
* <Button>Settings</Button>
|
|
61
|
+
* </HoverCardTrigger>
|
|
62
|
+
* <HoverCardContent>
|
|
63
|
+
* <div className="space-y-2">
|
|
64
|
+
* <h4 className="font-semibold">Quick Actions</h4>
|
|
65
|
+
* <Button size="sm">Manage Team</Button>
|
|
66
|
+
* <Button size="sm">View Reports</Button>
|
|
67
|
+
* </div>
|
|
68
|
+
* </HoverCardContent>
|
|
69
|
+
* </HoverCard>
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @accessibility
|
|
73
|
+
* **Important**: Hover cards are intended for sighted users only. The content will be
|
|
74
|
+
* inaccessible to keyboard users. Consider providing alternative access methods.
|
|
75
|
+
*
|
|
76
|
+
* - Opens on hover with configurable `openDelay`
|
|
77
|
+
* - Stays open when hovering over content
|
|
78
|
+
* - Closes with configurable `closeDelay`
|
|
79
|
+
* - Auto-positions to avoid viewport overflow
|
|
80
|
+
* - Supports focus-based interactions for some accessibility
|
|
81
|
+
*
|
|
82
|
+
* @see {@link https://ui.shadcn.com/docs/components/hover-card} shadcn/ui documentation
|
|
83
|
+
* @since 1.0.0
|
|
84
|
+
* @see {@link https://www.radix-ui.com/primitives/docs/components/hover-card} Radix UI Hover Card
|
|
85
|
+
*/
|
|
86
|
+
/**
|
|
87
|
+
* Root container for the hover card component
|
|
88
|
+
*
|
|
89
|
+
* @param openDelay - Delay in milliseconds before the hover card opens (default: 700)
|
|
90
|
+
* @param closeDelay - Delay in milliseconds before the hover card closes (default: 300)
|
|
91
|
+
* @param open - Controlled open state
|
|
92
|
+
* @param onOpenChange - Callback when open state changes
|
|
93
|
+
*/
|
|
94
|
+
function HoverCard({
|
|
95
|
+
...props
|
|
96
|
+
}: React.ComponentProps<typeof HoverCardPrimitive.Root>) {
|
|
97
|
+
return <HoverCardPrimitive.Root data-slot="hover-card" {...props} />;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Trigger element that opens the hover card on hover
|
|
102
|
+
*
|
|
103
|
+
* @param asChild - When true, merges props with immediate child element
|
|
104
|
+
*/
|
|
105
|
+
function HoverCardTrigger({
|
|
106
|
+
...props
|
|
107
|
+
}: React.ComponentProps<typeof HoverCardPrimitive.Trigger>) {
|
|
108
|
+
return (
|
|
109
|
+
<HoverCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Content container with built-in styling and animations
|
|
115
|
+
*
|
|
116
|
+
* @param side - Side of the trigger to position content ("top" | "right" | "bottom" | "left")
|
|
117
|
+
* @param align - Alignment relative to trigger ("start" | "center" | "end")
|
|
118
|
+
* @param sideOffset - Distance in pixels from the trigger (default: 4)
|
|
119
|
+
* @param alignOffset - Offset in pixels from the alignment axis
|
|
120
|
+
* @param className - Additional CSS classes
|
|
121
|
+
*/
|
|
122
|
+
function HoverCardContent({
|
|
123
|
+
className,
|
|
124
|
+
align = "center",
|
|
125
|
+
sideOffset = 4,
|
|
126
|
+
...props
|
|
127
|
+
}: React.ComponentProps<typeof HoverCardPrimitive.Content>) {
|
|
128
|
+
return (
|
|
129
|
+
<HoverCardPrimitive.Portal data-slot="hover-card-portal">
|
|
130
|
+
<HoverCardPrimitive.Content
|
|
131
|
+
data-slot="hover-card-content"
|
|
132
|
+
align={align}
|
|
133
|
+
sideOffset={sideOffset}
|
|
134
|
+
className={cn(
|
|
135
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
|
|
136
|
+
className,
|
|
137
|
+
)}
|
|
138
|
+
{...props}
|
|
139
|
+
/>
|
|
140
|
+
</HoverCardPrimitive.Portal>
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export { HoverCard, HoverCardTrigger, HoverCardContent };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "@/lib/utils";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A form input field component that displays text input or input-like elements
|
|
7
|
+
*
|
|
8
|
+
* A flexible input component based on shadcn/ui patterns that supports all native HTML input types
|
|
9
|
+
* and integrates seamlessly with form libraries like React Hook Form. Provides consistent styling,
|
|
10
|
+
* accessibility features, and error states across different input types.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* // Basic email input
|
|
15
|
+
* <Input type="email" placeholder="Email" />
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* // Input with label for accessibility
|
|
21
|
+
* <div className="space-y-2">
|
|
22
|
+
* <Label htmlFor="email">Email</Label>
|
|
23
|
+
* <Input id="email" type="email" placeholder="Enter your email" />
|
|
24
|
+
* </div>
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* // File input with proper labeling
|
|
30
|
+
* <div className="grid w-full max-w-sm items-center gap-1.5">
|
|
31
|
+
* <Label htmlFor="picture">Picture</Label>
|
|
32
|
+
* <Input id="picture" type="file" />
|
|
33
|
+
* </div>
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* // Disabled input state
|
|
39
|
+
* <Input disabled type="email" placeholder="Email" />
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* // Input with button for subscription forms
|
|
45
|
+
* <div className="flex w-full max-w-sm items-center space-x-2">
|
|
46
|
+
* <Input type="email" placeholder="Email" />
|
|
47
|
+
* <Button type="submit">Subscribe</Button>
|
|
48
|
+
* </div>
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```tsx
|
|
53
|
+
* // Form integration with React Hook Form
|
|
54
|
+
* const form = useForm();
|
|
55
|
+
*
|
|
56
|
+
* <Form>
|
|
57
|
+
* <FormField
|
|
58
|
+
* control={form.control}
|
|
59
|
+
* name="email"
|
|
60
|
+
* render={({ field }) => (
|
|
61
|
+
* <FormItem>
|
|
62
|
+
* <FormLabel>Email</FormLabel>
|
|
63
|
+
* <FormControl>
|
|
64
|
+
* <Input placeholder="shadcn" {...field} />
|
|
65
|
+
* </FormControl>
|
|
66
|
+
* <FormMessage />
|
|
67
|
+
* </FormItem>
|
|
68
|
+
* )}
|
|
69
|
+
* />
|
|
70
|
+
* </Form>
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @param className - Additional CSS classes to apply to the input
|
|
74
|
+
* @param type - The input type (text, email, password, file, etc.)
|
|
75
|
+
* @param props - All other standard HTML input attributes
|
|
76
|
+
*
|
|
77
|
+
* @accessibility
|
|
78
|
+
* - Supports all ARIA attributes including aria-invalid for error states
|
|
79
|
+
* - Focus visible ring with proper contrast for keyboard navigation
|
|
80
|
+
* - Compatible with screen readers and assistive technologies
|
|
81
|
+
* - Proper semantic markup for form fields
|
|
82
|
+
* - Disabled state prevents interaction and indicates unavailability
|
|
83
|
+
*
|
|
84
|
+
* @see {@link https://ui.shadcn.com/docs/components/input} - shadcn/ui Input documentation
|
|
85
|
+
* @see {@link Label} - For accessible input labels
|
|
86
|
+
* @see {@link Button} - Often used alongside inputs in forms
|
|
87
|
+
* @see {@link Form} - For complete form integration with validation
|
|
88
|
+
* @since 1.0.0
|
|
89
|
+
*/
|
|
90
|
+
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
|
91
|
+
return (
|
|
92
|
+
<input
|
|
93
|
+
type={type}
|
|
94
|
+
data-slot="input"
|
|
95
|
+
className={cn(
|
|
96
|
+
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
97
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
98
|
+
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
99
|
+
className,
|
|
100
|
+
)}
|
|
101
|
+
{...props}
|
|
102
|
+
/>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export { Input };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Label component for form controls with full accessibility support
|
|
8
|
+
*
|
|
9
|
+
* A fundamental form component that provides accessible text labels for form controls.
|
|
10
|
+
* Built on Radix UI Label primitive, it automatically associates with form elements
|
|
11
|
+
* and expands their clickable area for improved usability and accessibility.
|
|
12
|
+
* Essential for creating accessible forms that meet WCAG guidelines.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* // Basic label with input
|
|
17
|
+
* <div className="space-y-2">
|
|
18
|
+
* <Label htmlFor="email">Email address</Label>
|
|
19
|
+
* <Input id="email" type="email" placeholder="Enter your email" />
|
|
20
|
+
* </div>
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* // Required field with indicator
|
|
26
|
+
* <Label htmlFor="username">
|
|
27
|
+
* Username <span className="text-destructive">*</span>
|
|
28
|
+
* </Label>
|
|
29
|
+
* <Input id="username" required />
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* // Checkbox with label
|
|
35
|
+
* <div className="flex items-center space-x-2">
|
|
36
|
+
* <Checkbox id="terms" />
|
|
37
|
+
* <Label htmlFor="terms" className="text-sm font-normal">
|
|
38
|
+
* I agree to the terms and conditions
|
|
39
|
+
* </Label>
|
|
40
|
+
* </div>
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* // Label with helper text
|
|
46
|
+
* <div className="space-y-1">
|
|
47
|
+
* <Label htmlFor="password">Password</Label>
|
|
48
|
+
* <Input id="password" type="password" />
|
|
49
|
+
* <p className="text-sm text-muted-foreground">
|
|
50
|
+
* Must be at least 8 characters long
|
|
51
|
+
* </p>
|
|
52
|
+
* </div>
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```tsx
|
|
57
|
+
* // Complex label with nested content
|
|
58
|
+
* <Label htmlFor="plan" className="flex flex-col space-y-1 cursor-pointer">
|
|
59
|
+
* <span className="font-semibold">Choose your plan</span>
|
|
60
|
+
* <span className="text-sm text-muted-foreground">
|
|
61
|
+
* You can upgrade or downgrade anytime
|
|
62
|
+
* </span>
|
|
63
|
+
* </Label>
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @remarks
|
|
67
|
+
* The Label component automatically handles:
|
|
68
|
+
* - Form control association via htmlFor/id pairing
|
|
69
|
+
* - Click-to-focus behavior for associated controls
|
|
70
|
+
* - Disabled state styling when associated control is disabled
|
|
71
|
+
* - Screen reader accessibility announcements
|
|
72
|
+
* - Proper semantic markup for form structures
|
|
73
|
+
*
|
|
74
|
+
* @accessibility
|
|
75
|
+
* - **ARIA Labelling**: Provides accessible names for form controls
|
|
76
|
+
* - **Focus Management**: Clicking label focuses associated control
|
|
77
|
+
* - **Disabled State**: Inherits and displays disabled styling from peer controls
|
|
78
|
+
* - **Screen Reader**: Announced with associated control for context
|
|
79
|
+
* - **Keyboard Navigation**: Supports standard label interaction patterns
|
|
80
|
+
*
|
|
81
|
+
* @see {@link https://ui.shadcn.com/docs/components/label} - shadcn/ui Label documentation
|
|
82
|
+
* @see {@link https://www.radix-ui.com/primitives/docs/components/label} - Radix UI Label primitive
|
|
83
|
+
* @see {@link https://www.w3.org/WAI/tutorials/forms/labels/} - W3C Label best practices
|
|
84
|
+
* @since 1.0.0
|
|
85
|
+
*/
|
|
86
|
+
/**
|
|
87
|
+
* Label component props extending Radix UI Label Root props
|
|
88
|
+
*
|
|
89
|
+
* @param className - Additional CSS classes to apply to the label
|
|
90
|
+
* @param htmlFor - The id of the form element this label is associated with
|
|
91
|
+
* @param children - The label content (text, elements, or components)
|
|
92
|
+
* @param ...props - All other props are forwarded to the underlying Radix Label component
|
|
93
|
+
*/
|
|
94
|
+
function Label({
|
|
95
|
+
className,
|
|
96
|
+
...props
|
|
97
|
+
}: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
|
98
|
+
return (
|
|
99
|
+
<LabelPrimitive.Root
|
|
100
|
+
data-slot="label"
|
|
101
|
+
className={cn(
|
|
102
|
+
"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
103
|
+
className,
|
|
104
|
+
)}
|
|
105
|
+
{...props}
|
|
106
|
+
/>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export { Label };
|