@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,442 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as RechartsPrimitive from "recharts";
|
|
3
|
+
declare const THEMES: {
|
|
4
|
+
readonly light: "";
|
|
5
|
+
readonly dark: ".dark";
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Configuration object for chart data series
|
|
9
|
+
*
|
|
10
|
+
* Defines labels, colors, and icons for chart data series with support for
|
|
11
|
+
* both static colors and theme-aware color definitions. Each series can have
|
|
12
|
+
* either a static color or theme-specific colors for light/dark modes.
|
|
13
|
+
* This configuration drives both visual styling and accessibility features
|
|
14
|
+
* throughout the chart ecosystem.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* // Static color configuration with icon
|
|
19
|
+
* const chartConfig = {
|
|
20
|
+
* revenue: {
|
|
21
|
+
* label: "Revenue",
|
|
22
|
+
* color: "hsl(var(--chart-1))",
|
|
23
|
+
* icon: DollarSignIcon,
|
|
24
|
+
* },
|
|
25
|
+
* } satisfies ChartConfig
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* // Theme-aware color configuration for dark/light modes
|
|
31
|
+
* const chartConfig = {
|
|
32
|
+
* users: {
|
|
33
|
+
* label: "Active Users",
|
|
34
|
+
* theme: {
|
|
35
|
+
* light: "#0ea5e9",
|
|
36
|
+
* dark: "#0284c7",
|
|
37
|
+
* },
|
|
38
|
+
* },
|
|
39
|
+
* } satisfies ChartConfig
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* // Complex configuration with multiple series
|
|
45
|
+
* const chartConfig = {
|
|
46
|
+
* desktop: {
|
|
47
|
+
* label: "Desktop Users",
|
|
48
|
+
* color: "var(--chart-1)",
|
|
49
|
+
* icon: MonitorIcon,
|
|
50
|
+
* },
|
|
51
|
+
* mobile: {
|
|
52
|
+
* label: "Mobile Users",
|
|
53
|
+
* color: "var(--chart-2)",
|
|
54
|
+
* icon: SmartphoneIcon,
|
|
55
|
+
* },
|
|
56
|
+
* revenue: {
|
|
57
|
+
* label: "Revenue ($)",
|
|
58
|
+
* theme: {
|
|
59
|
+
* light: "#059669",
|
|
60
|
+
* dark: "#10b981",
|
|
61
|
+
* },
|
|
62
|
+
* },
|
|
63
|
+
* } satisfies ChartConfig
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @since 1.0.0
|
|
67
|
+
*/
|
|
68
|
+
export type ChartConfig = {
|
|
69
|
+
[k in string]: {
|
|
70
|
+
label?: React.ReactNode;
|
|
71
|
+
icon?: React.ComponentType;
|
|
72
|
+
} & ({
|
|
73
|
+
color?: string;
|
|
74
|
+
theme?: never;
|
|
75
|
+
} | {
|
|
76
|
+
color?: never;
|
|
77
|
+
theme: Record<keyof typeof THEMES, string>;
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Container component for Recharts charts with theming and configuration
|
|
82
|
+
*
|
|
83
|
+
* The ChartContainer provides a responsive wrapper for Recharts components with
|
|
84
|
+
* automatic theming, color management, and configuration. It generates CSS custom
|
|
85
|
+
* properties for chart colors, handles dark mode support, and applies consistent
|
|
86
|
+
* styling across all chart types. Built on the shadcn/ui design system with
|
|
87
|
+
* Recharts as the underlying charting library.
|
|
88
|
+
*
|
|
89
|
+
* @component
|
|
90
|
+
* @example
|
|
91
|
+
* ```tsx
|
|
92
|
+
* // Basic line chart with accessibility and tooltips
|
|
93
|
+
* const chartData = [
|
|
94
|
+
* { month: "Jan", revenue: 2000, profit: 400 },
|
|
95
|
+
* { month: "Feb", revenue: 2400, profit: 600 },
|
|
96
|
+
* { month: "Mar", revenue: 3200, profit: 900 },
|
|
97
|
+
* ]
|
|
98
|
+
*
|
|
99
|
+
* const chartConfig = {
|
|
100
|
+
* revenue: {
|
|
101
|
+
* label: "Revenue",
|
|
102
|
+
* color: "hsl(var(--chart-1))",
|
|
103
|
+
* },
|
|
104
|
+
* profit: {
|
|
105
|
+
* label: "Profit",
|
|
106
|
+
* color: "hsl(var(--chart-2))",
|
|
107
|
+
* },
|
|
108
|
+
* } satisfies ChartConfig
|
|
109
|
+
*
|
|
110
|
+
* <ChartContainer config={chartConfig} className="min-h-[300px]">
|
|
111
|
+
* <LineChart data={chartData} accessibilityLayer>
|
|
112
|
+
* <CartesianGrid strokeDasharray="3 3" />
|
|
113
|
+
* <XAxis dataKey="month" />
|
|
114
|
+
* <YAxis />
|
|
115
|
+
* <ChartTooltip content={<ChartTooltipContent />} />
|
|
116
|
+
* <Line
|
|
117
|
+
* type="monotone"
|
|
118
|
+
* dataKey="revenue"
|
|
119
|
+
* stroke="var(--color-revenue)"
|
|
120
|
+
* strokeWidth={2}
|
|
121
|
+
* />
|
|
122
|
+
* <Line
|
|
123
|
+
* type="monotone"
|
|
124
|
+
* dataKey="profit"
|
|
125
|
+
* stroke="var(--color-profit)"
|
|
126
|
+
* strokeWidth={2}
|
|
127
|
+
* />
|
|
128
|
+
* </LineChart>
|
|
129
|
+
* </ChartContainer>
|
|
130
|
+
* ```
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```tsx
|
|
134
|
+
* // Bar chart with theme-aware colors and custom formatting
|
|
135
|
+
* <ChartContainer
|
|
136
|
+
* config={{
|
|
137
|
+
* sales: {
|
|
138
|
+
* label: "Sales",
|
|
139
|
+
* theme: {
|
|
140
|
+
* light: "#0ea5e9",
|
|
141
|
+
* dark: "#0284c7",
|
|
142
|
+
* },
|
|
143
|
+
* },
|
|
144
|
+
* }}
|
|
145
|
+
* className="h-[400px]"
|
|
146
|
+
* >
|
|
147
|
+
* <BarChart data={data} accessibilityLayer>
|
|
148
|
+
* <XAxis dataKey="month" />
|
|
149
|
+
* <YAxis tickFormatter={(value) => `$${value.toLocaleString()}`} />
|
|
150
|
+
* <ChartTooltip content={<ChartTooltipContent />} />
|
|
151
|
+
* <Bar dataKey="sales" fill="var(--color-sales)" radius={4} />
|
|
152
|
+
* </BarChart>
|
|
153
|
+
* </ChartContainer>
|
|
154
|
+
* ```
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```tsx
|
|
158
|
+
* // Pie chart with legend and icons for device breakdown
|
|
159
|
+
* <ChartContainer config={{
|
|
160
|
+
* desktop: {
|
|
161
|
+
* label: "Desktop",
|
|
162
|
+
* color: "var(--chart-1)",
|
|
163
|
+
* icon: MonitorIcon,
|
|
164
|
+
* },
|
|
165
|
+
* mobile: {
|
|
166
|
+
* label: "Mobile",
|
|
167
|
+
* color: "var(--chart-2)",
|
|
168
|
+
* icon: SmartphoneIcon,
|
|
169
|
+
* },
|
|
170
|
+
* }}>
|
|
171
|
+
* <PieChart>
|
|
172
|
+
* <Pie data={data} dataKey="value" nameKey="device" />
|
|
173
|
+
* <ChartTooltip content={<ChartTooltipContent />} />
|
|
174
|
+
* <ChartLegend content={<ChartLegendContent />} />
|
|
175
|
+
* </PieChart>
|
|
176
|
+
* </ChartContainer>
|
|
177
|
+
* ```
|
|
178
|
+
*
|
|
179
|
+
* @accessibility
|
|
180
|
+
* **Core Accessibility Features:**
|
|
181
|
+
* - Responsive container adapts to screen size automatically
|
|
182
|
+
* - Theme-aware color system designed for WCAG contrast compliance
|
|
183
|
+
* - Supports Recharts' `accessibilityLayer` prop for keyboard navigation
|
|
184
|
+
* - High contrast colors available in both light and dark themes
|
|
185
|
+
* - Semantic HTML structure for screen reader compatibility
|
|
186
|
+
*
|
|
187
|
+
* **Important Accessibility Notes:**
|
|
188
|
+
* - Always include `accessibilityLayer` prop on Recharts components for keyboard access
|
|
189
|
+
* - Consider adding `aria-label` or `title` attributes for chart context
|
|
190
|
+
* - Ensure color is not the only way to distinguish data (use patterns, labels, or icons)
|
|
191
|
+
* - Test with screen readers as automatic data announcement may be limited
|
|
192
|
+
* - Provide alternative data representations (tables, text summaries) for complex charts
|
|
193
|
+
*
|
|
194
|
+
* **Keyboard Navigation:**
|
|
195
|
+
* - Arrow keys navigate between data points when `accessibilityLayer` is enabled
|
|
196
|
+
* - Tab key moves focus to interactive chart elements
|
|
197
|
+
* - Screen reader users should be provided with data summaries or alternative formats
|
|
198
|
+
*
|
|
199
|
+
* @performance
|
|
200
|
+
* - Use appropriate chart types for data size (avoid complex charts with large datasets)
|
|
201
|
+
* - Consider virtualization for charts with many data points
|
|
202
|
+
* - CSS variables are generated only for configured colors to minimize style overhead
|
|
203
|
+
*
|
|
204
|
+
* @see {@link https://ui.shadcn.com/docs/components/chart} shadcn/ui Chart documentation
|
|
205
|
+
* @see {@link https://recharts.org/en-US/api} Recharts API documentation
|
|
206
|
+
* @see {@link ChartTooltip} Tooltip component for interactive data display
|
|
207
|
+
* @see {@link ChartLegend} Legend component for series identification
|
|
208
|
+
* @see {@link useChart} Hook to access chart configuration
|
|
209
|
+
* @since 1.0.0
|
|
210
|
+
*/
|
|
211
|
+
declare function ChartContainer({ id, className, children, config, ...props }: React.ComponentProps<"div"> & {
|
|
212
|
+
/**
|
|
213
|
+
* Chart configuration defining series labels and colors
|
|
214
|
+
*/
|
|
215
|
+
config: ChartConfig;
|
|
216
|
+
/**
|
|
217
|
+
* Recharts component(s) to render
|
|
218
|
+
*/
|
|
219
|
+
children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
|
|
220
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
221
|
+
/**
|
|
222
|
+
* Internal component that generates CSS custom properties for chart colors
|
|
223
|
+
*
|
|
224
|
+
* Creates CSS variables based on the chart configuration to enable theme-aware
|
|
225
|
+
* coloring. Generates variables for both light and dark themes when theme
|
|
226
|
+
* configurations are provided, or uses static colors when available.
|
|
227
|
+
*
|
|
228
|
+
* @component
|
|
229
|
+
* @internal
|
|
230
|
+
* @param id - Unique identifier for the chart instance
|
|
231
|
+
* @param config - Chart configuration with color definitions
|
|
232
|
+
* @since 1.0.0
|
|
233
|
+
*/
|
|
234
|
+
declare function ChartStyle({ id, config }: {
|
|
235
|
+
id: string;
|
|
236
|
+
config: ChartConfig;
|
|
237
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
238
|
+
/**
|
|
239
|
+
* Tooltip component for charts
|
|
240
|
+
*
|
|
241
|
+
* Re-export of Recharts Tooltip component with support for custom content.
|
|
242
|
+
* Use with ChartTooltipContent for consistent styling and theming integration.
|
|
243
|
+
*
|
|
244
|
+
* @component
|
|
245
|
+
* @example
|
|
246
|
+
* ```tsx
|
|
247
|
+
* // Basic tooltip
|
|
248
|
+
* <ChartTooltip content={<ChartTooltipContent />} />
|
|
249
|
+
* ```
|
|
250
|
+
*
|
|
251
|
+
* @example
|
|
252
|
+
* ```tsx
|
|
253
|
+
* // Tooltip with custom positioning
|
|
254
|
+
* <ChartTooltip
|
|
255
|
+
* content={<ChartTooltipContent />}
|
|
256
|
+
* cursor={false}
|
|
257
|
+
* position={{ x: 10, y: 10 }}
|
|
258
|
+
* />
|
|
259
|
+
* ```
|
|
260
|
+
*
|
|
261
|
+
* @see {@link ChartTooltipContent} Custom tooltip content component
|
|
262
|
+
* @since 1.0.0
|
|
263
|
+
*/
|
|
264
|
+
declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
|
|
265
|
+
/**
|
|
266
|
+
* Custom tooltip content component for charts
|
|
267
|
+
*
|
|
268
|
+
* Provides a styled tooltip that displays chart data with proper formatting,
|
|
269
|
+
* colors, and labels from the chart configuration. Supports multiple indicator
|
|
270
|
+
* styles, custom formatters, and automatic theming integration.
|
|
271
|
+
*
|
|
272
|
+
* @component
|
|
273
|
+
* @example
|
|
274
|
+
* ```tsx
|
|
275
|
+
* // Basic tooltip with default styling
|
|
276
|
+
* <ChartTooltip content={<ChartTooltipContent />} />
|
|
277
|
+
* ```
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* ```tsx
|
|
281
|
+
* // Tooltip with custom value formatter
|
|
282
|
+
* <ChartTooltip
|
|
283
|
+
* content={
|
|
284
|
+
* <ChartTooltipContent
|
|
285
|
+
* formatter={(value, name) => [
|
|
286
|
+
* `$${value.toLocaleString()}`,
|
|
287
|
+
* name.toUpperCase()
|
|
288
|
+
* ]}
|
|
289
|
+
* />
|
|
290
|
+
* }
|
|
291
|
+
* />
|
|
292
|
+
* ```
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* ```tsx
|
|
296
|
+
* // Tooltip with line indicator and custom label
|
|
297
|
+
* <ChartTooltip
|
|
298
|
+
* content={
|
|
299
|
+
* <ChartTooltipContent
|
|
300
|
+
* indicator="line"
|
|
301
|
+
* labelFormatter={(label) => `Week of ${label}`}
|
|
302
|
+
* hideLabel={false}
|
|
303
|
+
* />
|
|
304
|
+
* }
|
|
305
|
+
* />
|
|
306
|
+
* ```
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* ```tsx
|
|
310
|
+
* // Tooltip with dashed indicator and no icons
|
|
311
|
+
* <ChartTooltip
|
|
312
|
+
* content={
|
|
313
|
+
* <ChartTooltipContent
|
|
314
|
+
* indicator="dashed"
|
|
315
|
+
* hideIndicator={false}
|
|
316
|
+
* nameKey="category"
|
|
317
|
+
* />
|
|
318
|
+
* }
|
|
319
|
+
* />
|
|
320
|
+
* ```
|
|
321
|
+
*
|
|
322
|
+
* @accessibility
|
|
323
|
+
* - High contrast colors for visibility in both themes
|
|
324
|
+
* - Proper semantic markup for screen readers
|
|
325
|
+
* - Formatted numbers with locale-aware display
|
|
326
|
+
* - Clear visual indicators for data series
|
|
327
|
+
*
|
|
328
|
+
* @since 1.0.0
|
|
329
|
+
*/
|
|
330
|
+
declare function ChartTooltipContent({ active, payload, className, indicator, hideLabel, hideIndicator, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey, }: React.ComponentProps<typeof RechartsPrimitive.Tooltip> & React.ComponentProps<"div"> & {
|
|
331
|
+
/**
|
|
332
|
+
* Whether to hide the label
|
|
333
|
+
* @default false
|
|
334
|
+
*/
|
|
335
|
+
hideLabel?: boolean;
|
|
336
|
+
/**
|
|
337
|
+
* Whether to hide the color indicator
|
|
338
|
+
* @default false
|
|
339
|
+
*/
|
|
340
|
+
hideIndicator?: boolean;
|
|
341
|
+
/**
|
|
342
|
+
* Style of the color indicator
|
|
343
|
+
* @default "dot"
|
|
344
|
+
*/
|
|
345
|
+
indicator?: "line" | "dot" | "dashed";
|
|
346
|
+
/**
|
|
347
|
+
* Key to use for the name in payload
|
|
348
|
+
*/
|
|
349
|
+
nameKey?: string;
|
|
350
|
+
/**
|
|
351
|
+
* Key to use for the label in payload
|
|
352
|
+
*/
|
|
353
|
+
labelKey?: string;
|
|
354
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
355
|
+
/**
|
|
356
|
+
* Legend component for charts
|
|
357
|
+
*
|
|
358
|
+
* Re-export of Recharts Legend component with support for custom content.
|
|
359
|
+
* Use with ChartLegendContent for consistent styling and theming integration.
|
|
360
|
+
*
|
|
361
|
+
* @component
|
|
362
|
+
* @example
|
|
363
|
+
* ```tsx
|
|
364
|
+
* // Basic legend
|
|
365
|
+
* <ChartLegend content={<ChartLegendContent />} />
|
|
366
|
+
* ```
|
|
367
|
+
*
|
|
368
|
+
* @example
|
|
369
|
+
* ```tsx
|
|
370
|
+
* // Legend positioned at top
|
|
371
|
+
* <ChartLegend
|
|
372
|
+
* content={<ChartLegendContent />}
|
|
373
|
+
* verticalAlign="top"
|
|
374
|
+
* height={36}
|
|
375
|
+
* />
|
|
376
|
+
* ```
|
|
377
|
+
*
|
|
378
|
+
* @see {@link ChartLegendContent} Custom legend content component
|
|
379
|
+
* @since 1.0.0
|
|
380
|
+
*/
|
|
381
|
+
declare const ChartLegend: typeof RechartsPrimitive.Legend;
|
|
382
|
+
/**
|
|
383
|
+
* Custom legend content component for charts
|
|
384
|
+
*
|
|
385
|
+
* Provides a styled legend that displays chart series with colors and labels
|
|
386
|
+
* from the chart configuration. Supports icon display, custom positioning,
|
|
387
|
+
* and automatic theming integration.
|
|
388
|
+
*
|
|
389
|
+
* @component
|
|
390
|
+
* @example
|
|
391
|
+
* ```tsx
|
|
392
|
+
* // Basic legend with default settings
|
|
393
|
+
* <ChartLegend content={<ChartLegendContent />} />
|
|
394
|
+
* ```
|
|
395
|
+
*
|
|
396
|
+
* @example
|
|
397
|
+
* ```tsx
|
|
398
|
+
* // Legend positioned at top without icons
|
|
399
|
+
* <ChartLegend
|
|
400
|
+
* content={
|
|
401
|
+
* <ChartLegendContent
|
|
402
|
+
* verticalAlign="top"
|
|
403
|
+
* hideIcon={true}
|
|
404
|
+
* />
|
|
405
|
+
* }
|
|
406
|
+
* />
|
|
407
|
+
* ```
|
|
408
|
+
*
|
|
409
|
+
* @example
|
|
410
|
+
* ```tsx
|
|
411
|
+
* // Legend with custom name key
|
|
412
|
+
* <ChartLegend
|
|
413
|
+
* content={
|
|
414
|
+
* <ChartLegendContent
|
|
415
|
+
* nameKey="category"
|
|
416
|
+
* className="justify-start"
|
|
417
|
+
* />
|
|
418
|
+
* }
|
|
419
|
+
* />
|
|
420
|
+
* ```
|
|
421
|
+
*
|
|
422
|
+
* @accessibility
|
|
423
|
+
* - Semantic markup for screen readers
|
|
424
|
+
* - Color indicators with clear labels
|
|
425
|
+
* - Proper contrast ratios for visibility
|
|
426
|
+
* - Logical tab order for keyboard navigation
|
|
427
|
+
*
|
|
428
|
+
* @since 1.0.0
|
|
429
|
+
*/
|
|
430
|
+
declare function ChartLegendContent({ className, hideIcon, payload, verticalAlign, nameKey, }: React.ComponentProps<"div"> & Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
|
|
431
|
+
/**
|
|
432
|
+
* Whether to hide series icons
|
|
433
|
+
* @default false
|
|
434
|
+
*/
|
|
435
|
+
hideIcon?: boolean;
|
|
436
|
+
/**
|
|
437
|
+
* Key to use for the name in payload
|
|
438
|
+
*/
|
|
439
|
+
nameKey?: string;
|
|
440
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
441
|
+
export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle, };
|
|
442
|
+
//# sourceMappingURL=chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../../../src/components/ui/chart.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
3
|
+
/**
|
|
4
|
+
* A versatile checkbox component for binary and multi-selection interfaces
|
|
5
|
+
*
|
|
6
|
+
* Built on Radix UI Checkbox primitive, this component provides a fully accessible
|
|
7
|
+
* checkbox with support for controlled/uncontrolled states, indeterminate state,
|
|
8
|
+
* and comprehensive form integration. Features consistent styling with the design
|
|
9
|
+
* system and proper keyboard navigation.
|
|
10
|
+
*
|
|
11
|
+
* @example Basic usage
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <div className="flex items-center space-x-2">
|
|
14
|
+
* <Checkbox id="terms" />
|
|
15
|
+
* <Label htmlFor="terms">Accept terms and conditions</Label>
|
|
16
|
+
* </div>
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @example Controlled checkbox with state management
|
|
20
|
+
* ```tsx
|
|
21
|
+
* const [checked, setChecked] = useState(false);
|
|
22
|
+
*
|
|
23
|
+
* <div className="flex items-center space-x-2">
|
|
24
|
+
* <Checkbox
|
|
25
|
+
* id="notifications"
|
|
26
|
+
* checked={checked}
|
|
27
|
+
* onCheckedChange={setChecked}
|
|
28
|
+
* />
|
|
29
|
+
* <Label htmlFor="notifications">Send me notifications</Label>
|
|
30
|
+
* </div>
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @example Indeterminate state for parent-child relationships
|
|
34
|
+
* ```tsx
|
|
35
|
+
* const [parentState, setParentState] = useState("indeterminate");
|
|
36
|
+
*
|
|
37
|
+
* <Checkbox
|
|
38
|
+
* checked={parentState}
|
|
39
|
+
* onCheckedChange={(checked) => {
|
|
40
|
+
* setParentState(checked);
|
|
41
|
+
* // Update child checkboxes accordingly
|
|
42
|
+
* }}
|
|
43
|
+
* />
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @example Form integration with multiple selections
|
|
47
|
+
* ```tsx
|
|
48
|
+
* const [preferences, setPreferences] = useState([]);
|
|
49
|
+
*
|
|
50
|
+
* {options.map((option) => (
|
|
51
|
+
* <div key={option.id} className="flex items-center space-x-2">
|
|
52
|
+
* <Checkbox
|
|
53
|
+
* id={option.id}
|
|
54
|
+
* name="preferences"
|
|
55
|
+
* value={option.value}
|
|
56
|
+
* checked={preferences.includes(option.id)}
|
|
57
|
+
* onCheckedChange={(checked) => {
|
|
58
|
+
* setPreferences(prev =>
|
|
59
|
+
* checked
|
|
60
|
+
* ? [...prev, option.id]
|
|
61
|
+
* : prev.filter(id => id !== option.id)
|
|
62
|
+
* );
|
|
63
|
+
* }}
|
|
64
|
+
* />
|
|
65
|
+
* <Label htmlFor={option.id}>{option.label}</Label>
|
|
66
|
+
* </div>
|
|
67
|
+
* ))}
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @see {@link https://ui.shadcn.com/docs/components/checkbox} for design patterns
|
|
71
|
+
* @since 1.0.0
|
|
72
|
+
* @see {@link Label} for accessible labeling
|
|
73
|
+
* @see {@link Switch} for boolean toggles
|
|
74
|
+
* @see {@link RadioGroup} for single selection scenarios
|
|
75
|
+
*
|
|
76
|
+
* @param className - Additional CSS classes to apply to the checkbox
|
|
77
|
+
* @param checked - Controlled checked state (boolean | "indeterminate")
|
|
78
|
+
* @param defaultChecked - Default checked state for uncontrolled usage
|
|
79
|
+
* @param onCheckedChange - Callback when the checked state changes
|
|
80
|
+
* @param disabled - Whether the checkbox is disabled
|
|
81
|
+
* @param required - Whether the checkbox is required for form validation
|
|
82
|
+
* @param name - Form field name for form submission
|
|
83
|
+
* @param value - Form field value for form submission
|
|
84
|
+
* @param id - Unique identifier, used with Label htmlFor attribute
|
|
85
|
+
*/
|
|
86
|
+
declare function Checkbox({ className, ...props }: React.ComponentProps<typeof CheckboxPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
87
|
+
export { Checkbox };
|
|
88
|
+
//# sourceMappingURL=checkbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../src/components/ui/checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAK9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkFG;AACH,iBAAS,QAAQ,CAAC,EAChB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,iBAAiB,CAAC,IAAI,CAAC,2CAkBrD;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|