@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,285 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as AccordionPrimitive from "@radix-ui/react-accordion";
|
|
3
|
+
import { ChevronDownIcon } from "lucide-react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "@/lib/utils";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Accordion - Collapsible content panels for organizing information
|
|
9
|
+
*
|
|
10
|
+
* A vertically stacked set of interactive headings that each reveal a section of content.
|
|
11
|
+
* Built on Radix UI Accordion primitives with optimized animations and accessibility.
|
|
12
|
+
* Supports both single and multiple expanded items simultaneously based on the type prop.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* // Basic single accordion (only one item can be open)
|
|
17
|
+
* <Accordion type="single" collapsible>
|
|
18
|
+
* <AccordionItem value="item-1">
|
|
19
|
+
* <AccordionTrigger>Is it accessible?</AccordionTrigger>
|
|
20
|
+
* <AccordionContent>
|
|
21
|
+
* Yes. It adheres to the WAI-ARIA design pattern.
|
|
22
|
+
* </AccordionContent>
|
|
23
|
+
* </AccordionItem>
|
|
24
|
+
* </Accordion>
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* // Multiple accordion (multiple items can be open)
|
|
30
|
+
* <Accordion type="multiple">
|
|
31
|
+
* <AccordionItem value="item-1">
|
|
32
|
+
* <AccordionTrigger>Section 1</AccordionTrigger>
|
|
33
|
+
* <AccordionContent>Content for section 1</AccordionContent>
|
|
34
|
+
* </AccordionItem>
|
|
35
|
+
* <AccordionItem value="item-2">
|
|
36
|
+
* <AccordionTrigger>Section 2</AccordionTrigger>
|
|
37
|
+
* <AccordionContent>Content for section 2</AccordionContent>
|
|
38
|
+
* </AccordionItem>
|
|
39
|
+
* </Accordion>
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* // FAQ-style accordion with default open state
|
|
45
|
+
* <Accordion type="single" collapsible defaultValue="faq-1">
|
|
46
|
+
* <AccordionItem value="faq-1">
|
|
47
|
+
* <AccordionTrigger>How do I get started?</AccordionTrigger>
|
|
48
|
+
* <AccordionContent>
|
|
49
|
+
* Follow our quick start guide to set up your first project.
|
|
50
|
+
* </AccordionContent>
|
|
51
|
+
* </AccordionItem>
|
|
52
|
+
* </Accordion>
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @param type - "single" allows one item open, "multiple" allows multiple items open
|
|
56
|
+
* @param collapsible - When type="single", allows closing the open item (optional)
|
|
57
|
+
* @param defaultValue - Initial value(s) for open items
|
|
58
|
+
* @param value - Controlled value(s) for open items
|
|
59
|
+
* @param onValueChange - Callback when accordion state changes
|
|
60
|
+
* @param className - Additional CSS classes for styling
|
|
61
|
+
* @param orientation - "horizontal" or "vertical" (default: "vertical")
|
|
62
|
+
* @param dir - Text direction "ltr" or "rtl" for internationalization
|
|
63
|
+
* @param disabled - Disables all accordion interactions
|
|
64
|
+
*
|
|
65
|
+
* @accessibility
|
|
66
|
+
* - Full keyboard navigation support (Arrow keys, Space, Enter, Home, End)
|
|
67
|
+
* - ARIA expanded/collapsed states automatically managed
|
|
68
|
+
* - Screen reader announcements for state changes
|
|
69
|
+
* - Focus management with visible focus indicators
|
|
70
|
+
* - Properly labeled regions with aria-labelledby
|
|
71
|
+
* - Meets WCAG 2.1 AA standards for interactive elements
|
|
72
|
+
*
|
|
73
|
+
* @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/accordion/} WAI-ARIA Accordion Pattern
|
|
74
|
+
* @see {@link https://ui.shadcn.com/docs/components/accordion} shadcn/ui Accordion Documentation
|
|
75
|
+
* @see {@link AccordionItem} Individual accordion panel container
|
|
76
|
+
* @see {@link AccordionTrigger} Clickable header to expand/collapse content
|
|
77
|
+
* @see {@link AccordionContent} Collapsible content area with smooth animations
|
|
78
|
+
* @since 1.0.0
|
|
79
|
+
*/
|
|
80
|
+
function Accordion({
|
|
81
|
+
...props
|
|
82
|
+
}: React.ComponentProps<typeof AccordionPrimitive.Root>) {
|
|
83
|
+
return <AccordionPrimitive.Root data-slot="accordion" {...props} />;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* AccordionItem - Individual collapsible panel within an accordion
|
|
88
|
+
*
|
|
89
|
+
* A container component that wraps a single accordion section consisting of a trigger
|
|
90
|
+
* and collapsible content. Each item requires a unique value prop for identification
|
|
91
|
+
* and state management. Provides consistent spacing and border styling.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```tsx
|
|
95
|
+
* <AccordionItem value="settings">
|
|
96
|
+
* <AccordionTrigger>Account Settings</AccordionTrigger>
|
|
97
|
+
* <AccordionContent>
|
|
98
|
+
* <p>Manage your account preferences and security settings.</p>
|
|
99
|
+
* </AccordionContent>
|
|
100
|
+
* </AccordionItem>
|
|
101
|
+
* ```
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```tsx
|
|
105
|
+
* // With custom styling
|
|
106
|
+
* <AccordionItem value="custom" className="border-l-4 border-blue-500">
|
|
107
|
+
* <AccordionTrigger>Custom Styled Item</AccordionTrigger>
|
|
108
|
+
* <AccordionContent>Content with custom left border</AccordionContent>
|
|
109
|
+
* </AccordionItem>
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* @param value - Unique identifier for this accordion item (required)
|
|
113
|
+
* @param className - Additional CSS classes for custom styling
|
|
114
|
+
* @param disabled - Disables this specific accordion item
|
|
115
|
+
* @param children - Should contain AccordionTrigger and AccordionContent
|
|
116
|
+
*
|
|
117
|
+
* @accessibility
|
|
118
|
+
* - Manages expanded/collapsed state via ARIA attributes
|
|
119
|
+
* - Associates trigger with content using aria-controls and aria-labelledby
|
|
120
|
+
* - Provides proper focus management between items
|
|
121
|
+
* - Supports keyboard navigation within the accordion group
|
|
122
|
+
*
|
|
123
|
+
* @see {@link AccordionTrigger} The clickable header for this item
|
|
124
|
+
* @see {@link AccordionContent} The collapsible content for this item
|
|
125
|
+
*/
|
|
126
|
+
function AccordionItem({
|
|
127
|
+
className,
|
|
128
|
+
...props
|
|
129
|
+
}: React.ComponentProps<typeof AccordionPrimitive.Item>) {
|
|
130
|
+
return (
|
|
131
|
+
<AccordionPrimitive.Item
|
|
132
|
+
data-slot="accordion-item"
|
|
133
|
+
className={cn("border-b last:border-b-0", className)}
|
|
134
|
+
{...props}
|
|
135
|
+
/>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* AccordionTrigger - Clickable header that toggles accordion content visibility
|
|
141
|
+
*
|
|
142
|
+
* An interactive button element that users click or activate via keyboard to expand
|
|
143
|
+
* or collapse the associated accordion content. Features a rotating chevron icon
|
|
144
|
+
* for visual state indication and supports both text and custom content.
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```tsx
|
|
148
|
+
* // Simple text trigger
|
|
149
|
+
* <AccordionTrigger>
|
|
150
|
+
* Click to expand this section
|
|
151
|
+
* </AccordionTrigger>
|
|
152
|
+
* ```
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```tsx
|
|
156
|
+
* // With icon and custom styling
|
|
157
|
+
* <AccordionTrigger className="text-lg font-semibold">
|
|
158
|
+
* <User className="mr-2 h-4 w-4" />
|
|
159
|
+
* User Profile Settings
|
|
160
|
+
* </AccordionTrigger>
|
|
161
|
+
* ```
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```tsx
|
|
165
|
+
* // With complex content
|
|
166
|
+
* <AccordionTrigger>
|
|
167
|
+
* <div className="flex items-center justify-between w-full">
|
|
168
|
+
* <span>Section Title</span>
|
|
169
|
+
* <Badge variant="secondary">5 items</Badge>
|
|
170
|
+
* </div>
|
|
171
|
+
* </AccordionTrigger>
|
|
172
|
+
* ```
|
|
173
|
+
*
|
|
174
|
+
* @param className - Additional CSS classes for custom styling
|
|
175
|
+
* @param children - Content to display in the trigger (text, icons, or components)
|
|
176
|
+
* @param disabled - Disables the trigger interaction
|
|
177
|
+
* @param asChild - Renders the trigger as its child element when true
|
|
178
|
+
*
|
|
179
|
+
* @accessibility
|
|
180
|
+
* - Keyboard activated with Space, Enter, or Arrow keys
|
|
181
|
+
* - aria-expanded automatically indicates current expanded/collapsed state
|
|
182
|
+
* - Focus visible ring for keyboard navigation with proper contrast
|
|
183
|
+
* - Chevron icon rotation provides visual state feedback
|
|
184
|
+
* - Screen reader support with proper labeling and state announcements
|
|
185
|
+
* - Meets WCAG 2.1 AA interactive element requirements
|
|
186
|
+
*
|
|
187
|
+
* @see {@link AccordionContent} The content area controlled by this trigger
|
|
188
|
+
*/
|
|
189
|
+
function AccordionTrigger({
|
|
190
|
+
className,
|
|
191
|
+
children,
|
|
192
|
+
...props
|
|
193
|
+
}: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {
|
|
194
|
+
return (
|
|
195
|
+
<AccordionPrimitive.Header className="flex">
|
|
196
|
+
<AccordionPrimitive.Trigger
|
|
197
|
+
data-slot="accordion-trigger"
|
|
198
|
+
className={cn(
|
|
199
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
|
|
200
|
+
className,
|
|
201
|
+
)}
|
|
202
|
+
{...props}
|
|
203
|
+
>
|
|
204
|
+
{children}
|
|
205
|
+
<ChevronDownIcon className="text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" />
|
|
206
|
+
</AccordionPrimitive.Trigger>
|
|
207
|
+
</AccordionPrimitive.Header>
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* AccordionContent - Collapsible content area of an accordion item
|
|
213
|
+
*
|
|
214
|
+
* The expandable content section that is revealed or hidden when the associated
|
|
215
|
+
* AccordionTrigger is activated. Features smooth height-based animations using
|
|
216
|
+
* Tailwind CSS keyframes and supports any React content including complex layouts.
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```tsx
|
|
220
|
+
* // Simple text content
|
|
221
|
+
* <AccordionContent>
|
|
222
|
+
* <p>This content is revealed when the accordion is expanded.</p>
|
|
223
|
+
* <p>It can contain any React components or HTML elements.</p>
|
|
224
|
+
* </AccordionContent>
|
|
225
|
+
* ```
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```tsx
|
|
229
|
+
* // Rich content with components
|
|
230
|
+
* <AccordionContent>
|
|
231
|
+
* <div className="space-y-4">
|
|
232
|
+
* <Alert>
|
|
233
|
+
* <InfoIcon className="h-4 w-4" />
|
|
234
|
+
* <AlertTitle>Important Note</AlertTitle>
|
|
235
|
+
* <AlertDescription>This is highlighted information.</AlertDescription>
|
|
236
|
+
* </Alert>
|
|
237
|
+
* <Button variant="outline">Take Action</Button>
|
|
238
|
+
* </div>
|
|
239
|
+
* </AccordionContent>
|
|
240
|
+
* ```
|
|
241
|
+
*
|
|
242
|
+
* @example
|
|
243
|
+
* ```tsx
|
|
244
|
+
* // Content with custom padding
|
|
245
|
+
* <AccordionContent className="pt-6 pb-6">
|
|
246
|
+
* Content with extra vertical padding for better spacing.
|
|
247
|
+
* </AccordionContent>
|
|
248
|
+
* ```
|
|
249
|
+
*
|
|
250
|
+
* @param className - Additional CSS classes for custom styling (applied to inner div)
|
|
251
|
+
* @param children - Any React content to display when expanded
|
|
252
|
+
* @param forceMount - Forces content to remain mounted when collapsed (for animations)
|
|
253
|
+
*
|
|
254
|
+
* @accessibility
|
|
255
|
+
* - Hidden content is not focusable or accessible when collapsed
|
|
256
|
+
* - Smooth height animations enhance user experience without motion issues
|
|
257
|
+
* - Properly associated with trigger via ARIA attributes (aria-controls, aria-labelledby)
|
|
258
|
+
* - Content respects prefers-reduced-motion user preference
|
|
259
|
+
* - Focus moves naturally to content when expanded via keyboard
|
|
260
|
+
*
|
|
261
|
+
* @animation
|
|
262
|
+
* - Uses data-[state=open]:animate-accordion-down for expand animation
|
|
263
|
+
* - Uses data-[state=closed]:animate-accordion-up for collapse animation
|
|
264
|
+
* - Animations respect user's motion preferences
|
|
265
|
+
* - Smooth height transitions using Radix UI's --radix-accordion-content-height variable
|
|
266
|
+
*
|
|
267
|
+
* @see {@link AccordionTrigger} The trigger that controls this content's visibility
|
|
268
|
+
*/
|
|
269
|
+
function AccordionContent({
|
|
270
|
+
className,
|
|
271
|
+
children,
|
|
272
|
+
...props
|
|
273
|
+
}: React.ComponentProps<typeof AccordionPrimitive.Content>) {
|
|
274
|
+
return (
|
|
275
|
+
<AccordionPrimitive.Content
|
|
276
|
+
data-slot="accordion-content"
|
|
277
|
+
className="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm"
|
|
278
|
+
{...props}
|
|
279
|
+
>
|
|
280
|
+
<div className={cn("pt-0 pb-4", className)}>{children}</div>
|
|
281
|
+
</AccordionPrimitive.Content>
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
import { buttonVariants } from "@/components/ui/button";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Alert dialog component for critical confirmations and destructive actions
|
|
9
|
+
*
|
|
10
|
+
* A specialized modal dialog built on Radix UI Alert Dialog primitives that interrupts
|
|
11
|
+
* users with important information requiring immediate acknowledgment or decision.
|
|
12
|
+
* Unlike regular dialogs, alert dialogs cannot be dismissed by clicking outside and
|
|
13
|
+
* focus the action button by default for critical decisions.
|
|
14
|
+
*
|
|
15
|
+
* Based on the WAI-ARIA Alert Dialog design pattern, this component is specifically
|
|
16
|
+
* designed for destructive actions, confirmations, or critical warnings that need
|
|
17
|
+
* immediate attention before the user can continue.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* // Basic destructive confirmation
|
|
22
|
+
* <AlertDialog>
|
|
23
|
+
* <AlertDialogTrigger asChild>
|
|
24
|
+
* <Button variant="destructive">Delete Account</Button>
|
|
25
|
+
* </AlertDialogTrigger>
|
|
26
|
+
* <AlertDialogContent>
|
|
27
|
+
* <AlertDialogHeader>
|
|
28
|
+
* <AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
|
|
29
|
+
* <AlertDialogDescription>
|
|
30
|
+
* This action cannot be undone. This will permanently delete
|
|
31
|
+
* your account and remove your data from our servers.
|
|
32
|
+
* </AlertDialogDescription>
|
|
33
|
+
* </AlertDialogHeader>
|
|
34
|
+
* <AlertDialogFooter>
|
|
35
|
+
* <AlertDialogCancel>Cancel</AlertDialogCancel>
|
|
36
|
+
* <AlertDialogAction>Delete Account</AlertDialogAction>
|
|
37
|
+
* </AlertDialogFooter>
|
|
38
|
+
* </AlertDialogContent>
|
|
39
|
+
* </AlertDialog>
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* // Simple confirmation
|
|
45
|
+
* <AlertDialog>
|
|
46
|
+
* <AlertDialogTrigger asChild>
|
|
47
|
+
* <Button variant="outline">Sign Out</Button>
|
|
48
|
+
* </AlertDialogTrigger>
|
|
49
|
+
* <AlertDialogContent>
|
|
50
|
+
* <AlertDialogHeader>
|
|
51
|
+
* <AlertDialogTitle>Sign Out</AlertDialogTitle>
|
|
52
|
+
* <AlertDialogDescription>
|
|
53
|
+
* Are you sure you want to sign out of your account?
|
|
54
|
+
* </AlertDialogDescription>
|
|
55
|
+
* </AlertDialogHeader>
|
|
56
|
+
* <AlertDialogFooter>
|
|
57
|
+
* <AlertDialogCancel>Cancel</AlertDialogCancel>
|
|
58
|
+
* <AlertDialogAction>Sign Out</AlertDialogAction>
|
|
59
|
+
* </AlertDialogFooter>
|
|
60
|
+
* </AlertDialogContent>
|
|
61
|
+
* </AlertDialog>
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @accessibility
|
|
65
|
+
* - Follows WAI-ARIA Alert Dialog design pattern
|
|
66
|
+
* - Focus is trapped within the dialog when open
|
|
67
|
+
* - Cannot be dismissed by clicking outside (intentional for alerts)
|
|
68
|
+
* - Escape key closes the dialog (unless preventDefault is called)
|
|
69
|
+
* - Proper ARIA roles and attributes for screen readers
|
|
70
|
+
* - Focus returns to trigger element when closed
|
|
71
|
+
* - Action button receives initial focus by default
|
|
72
|
+
* - Supports keyboard navigation between focusable elements
|
|
73
|
+
*
|
|
74
|
+
* @see {@link https://ui.shadcn.com/docs/components/alert-dialog} shadcn/ui Alert Dialog docs
|
|
75
|
+
* @see {@link https://www.radix-ui.com/primitives/docs/components/alert-dialog} Radix UI Alert Dialog
|
|
76
|
+
* @see {@link Dialog} For general modal content that can be dismissed
|
|
77
|
+
* @see {@link Sheet} For side panel overlays
|
|
78
|
+
* @since 1.0.0
|
|
79
|
+
*/
|
|
80
|
+
/**
|
|
81
|
+
* Root component of the alert dialog
|
|
82
|
+
*
|
|
83
|
+
* Provides the context and state management for the entire alert dialog.
|
|
84
|
+
* Controls the open/closed state and manages focus behavior.
|
|
85
|
+
*
|
|
86
|
+
* @param props - All props are forwarded to the underlying Radix AlertDialog.Root
|
|
87
|
+
*/
|
|
88
|
+
function AlertDialog({
|
|
89
|
+
...props
|
|
90
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {
|
|
91
|
+
return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Trigger element that opens the alert dialog
|
|
96
|
+
*
|
|
97
|
+
* The element that opens the alert dialog when activated. Usually a button,
|
|
98
|
+
* but can be any interactive element. Use the `asChild` prop to compose
|
|
99
|
+
* with other components.
|
|
100
|
+
*
|
|
101
|
+
* @param props - All props are forwarded to the underlying Radix AlertDialog.Trigger
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```tsx
|
|
105
|
+
* <AlertDialogTrigger asChild>
|
|
106
|
+
* <Button variant="destructive">Delete</Button>
|
|
107
|
+
* </AlertDialogTrigger>
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
function AlertDialogTrigger({
|
|
111
|
+
...props
|
|
112
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {
|
|
113
|
+
return (
|
|
114
|
+
<AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Portal component for rendering dialog outside normal DOM tree
|
|
120
|
+
*
|
|
121
|
+
* Renders the alert dialog content into a portal, typically at the end of the document body.
|
|
122
|
+
* This ensures the dialog appears above other content and is properly accessible.
|
|
123
|
+
* Usually not used directly - AlertDialogContent includes this automatically.
|
|
124
|
+
*
|
|
125
|
+
* @param props - All props are forwarded to the underlying Radix AlertDialog.Portal
|
|
126
|
+
*/
|
|
127
|
+
function AlertDialogPortal({
|
|
128
|
+
...props
|
|
129
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
|
|
130
|
+
return (
|
|
131
|
+
<AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Overlay backdrop behind the alert dialog
|
|
137
|
+
*
|
|
138
|
+
* A semi-transparent backdrop that covers the entire viewport when the dialog is open.
|
|
139
|
+
* Provides visual separation and prevents interaction with background content.
|
|
140
|
+
* Includes fade in/out animations using data-state attributes.
|
|
141
|
+
*
|
|
142
|
+
* @param className - Additional CSS classes to apply
|
|
143
|
+
* @param props - All other props are forwarded to the underlying Radix AlertDialog.Overlay
|
|
144
|
+
*/
|
|
145
|
+
function AlertDialogOverlay({
|
|
146
|
+
className,
|
|
147
|
+
...props
|
|
148
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {
|
|
149
|
+
return (
|
|
150
|
+
<AlertDialogPrimitive.Overlay
|
|
151
|
+
data-slot="alert-dialog-overlay"
|
|
152
|
+
className={cn(
|
|
153
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
|
154
|
+
className,
|
|
155
|
+
)}
|
|
156
|
+
{...props}
|
|
157
|
+
/>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Main content container for the alert dialog
|
|
163
|
+
*
|
|
164
|
+
* The primary container that holds all alert dialog content. Automatically includes
|
|
165
|
+
* the portal and overlay, and provides default styling with responsive design.
|
|
166
|
+
* Centered on screen with fade and zoom animations.
|
|
167
|
+
*
|
|
168
|
+
* @param className - Additional CSS classes to apply to the content container
|
|
169
|
+
* @param props - All other props are forwarded to the underlying Radix AlertDialog.Content
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```tsx
|
|
173
|
+
* <AlertDialogContent>
|
|
174
|
+
* <AlertDialogHeader>
|
|
175
|
+
* <AlertDialogTitle>Confirm Action</AlertDialogTitle>
|
|
176
|
+
* <AlertDialogDescription>This action cannot be undone.</AlertDialogDescription>
|
|
177
|
+
* </AlertDialogHeader>
|
|
178
|
+
* <AlertDialogFooter>
|
|
179
|
+
* <AlertDialogCancel>Cancel</AlertDialogCancel>
|
|
180
|
+
* <AlertDialogAction>Continue</AlertDialogAction>
|
|
181
|
+
* </AlertDialogFooter>
|
|
182
|
+
* </AlertDialogContent>
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
function AlertDialogContent({
|
|
186
|
+
className,
|
|
187
|
+
...props
|
|
188
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Content>) {
|
|
189
|
+
return (
|
|
190
|
+
<AlertDialogPortal>
|
|
191
|
+
<AlertDialogOverlay />
|
|
192
|
+
<AlertDialogPrimitive.Content
|
|
193
|
+
data-slot="alert-dialog-content"
|
|
194
|
+
className={cn(
|
|
195
|
+
"bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
|
|
196
|
+
className,
|
|
197
|
+
)}
|
|
198
|
+
{...props}
|
|
199
|
+
/>
|
|
200
|
+
</AlertDialogPortal>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Header section of the alert dialog
|
|
206
|
+
*
|
|
207
|
+
* Contains the title and description of the alert dialog. Provides consistent
|
|
208
|
+
* spacing and alignment, with responsive text alignment (centered on mobile,
|
|
209
|
+
* left-aligned on larger screens).
|
|
210
|
+
*
|
|
211
|
+
* @param className - Additional CSS classes to apply
|
|
212
|
+
* @param props - All other props are forwarded to the underlying div element
|
|
213
|
+
*/
|
|
214
|
+
function AlertDialogHeader({
|
|
215
|
+
className,
|
|
216
|
+
...props
|
|
217
|
+
}: React.ComponentProps<"div">) {
|
|
218
|
+
return (
|
|
219
|
+
<div
|
|
220
|
+
data-slot="alert-dialog-header"
|
|
221
|
+
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
|
|
222
|
+
{...props}
|
|
223
|
+
/>
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Footer section of the alert dialog
|
|
229
|
+
*
|
|
230
|
+
* Contains the action buttons (cancel and confirm). Uses responsive layout
|
|
231
|
+
* with stacked buttons on mobile (cancel on top) and horizontal layout
|
|
232
|
+
* on larger screens (cancel on left, action on right).
|
|
233
|
+
*
|
|
234
|
+
* @param className - Additional CSS classes to apply
|
|
235
|
+
* @param props - All other props are forwarded to the underlying div element
|
|
236
|
+
*/
|
|
237
|
+
function AlertDialogFooter({
|
|
238
|
+
className,
|
|
239
|
+
...props
|
|
240
|
+
}: React.ComponentProps<"div">) {
|
|
241
|
+
return (
|
|
242
|
+
<div
|
|
243
|
+
data-slot="alert-dialog-footer"
|
|
244
|
+
className={cn(
|
|
245
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
246
|
+
className,
|
|
247
|
+
)}
|
|
248
|
+
{...props}
|
|
249
|
+
/>
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Title heading of the alert dialog
|
|
255
|
+
*
|
|
256
|
+
* The main heading that describes the alert or action being confirmed.
|
|
257
|
+
* Automatically provides proper ARIA labeling for screen readers.
|
|
258
|
+
* Should be concise and clearly state what the dialog is asking.
|
|
259
|
+
*
|
|
260
|
+
* @param className - Additional CSS classes to apply
|
|
261
|
+
* @param props - All other props are forwarded to the underlying Radix AlertDialog.Title
|
|
262
|
+
*
|
|
263
|
+
* @example
|
|
264
|
+
* ```tsx
|
|
265
|
+
* <AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
|
|
266
|
+
* <AlertDialogTitle>Delete Account</AlertDialogTitle>
|
|
267
|
+
* ```
|
|
268
|
+
*/
|
|
269
|
+
function AlertDialogTitle({
|
|
270
|
+
className,
|
|
271
|
+
...props
|
|
272
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
|
|
273
|
+
return (
|
|
274
|
+
<AlertDialogPrimitive.Title
|
|
275
|
+
data-slot="alert-dialog-title"
|
|
276
|
+
className={cn("text-lg font-semibold", className)}
|
|
277
|
+
{...props}
|
|
278
|
+
/>
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Description text of the alert dialog
|
|
284
|
+
*
|
|
285
|
+
* Provides additional context and explanation for the alert or action.
|
|
286
|
+
* Should clearly explain the consequences of the action being confirmed.
|
|
287
|
+
* Automatically provides proper ARIA description for screen readers.
|
|
288
|
+
*
|
|
289
|
+
* @param className - Additional CSS classes to apply
|
|
290
|
+
* @param props - All other props are forwarded to the underlying Radix AlertDialog.Description
|
|
291
|
+
*
|
|
292
|
+
* @example
|
|
293
|
+
* ```tsx
|
|
294
|
+
* <AlertDialogDescription>
|
|
295
|
+
* This action cannot be undone. This will permanently delete your
|
|
296
|
+
* account and remove your data from our servers.
|
|
297
|
+
* </AlertDialogDescription>
|
|
298
|
+
* ```
|
|
299
|
+
*/
|
|
300
|
+
function AlertDialogDescription({
|
|
301
|
+
className,
|
|
302
|
+
...props
|
|
303
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
|
|
304
|
+
return (
|
|
305
|
+
<AlertDialogPrimitive.Description
|
|
306
|
+
data-slot="alert-dialog-description"
|
|
307
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
308
|
+
{...props}
|
|
309
|
+
/>
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Primary action button of the alert dialog
|
|
315
|
+
*
|
|
316
|
+
* The button that confirms or executes the action being alerted about.
|
|
317
|
+
* Automatically receives focus when the dialog opens. Styled as a primary
|
|
318
|
+
* button by default, but can be customized for destructive actions.
|
|
319
|
+
* Closes the dialog when clicked.
|
|
320
|
+
*
|
|
321
|
+
* @param className - Additional CSS classes to apply (useful for destructive styling)
|
|
322
|
+
* @param props - All other props are forwarded to the underlying Radix AlertDialog.Action
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* ```tsx
|
|
326
|
+
* // Default action
|
|
327
|
+
* <AlertDialogAction>Continue</AlertDialogAction>
|
|
328
|
+
*
|
|
329
|
+
* // Destructive action
|
|
330
|
+
* <AlertDialogAction className="bg-red-600 hover:bg-red-700">
|
|
331
|
+
* Delete Account
|
|
332
|
+
* </AlertDialogAction>
|
|
333
|
+
* ```
|
|
334
|
+
*/
|
|
335
|
+
function AlertDialogAction({
|
|
336
|
+
className,
|
|
337
|
+
...props
|
|
338
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Action>) {
|
|
339
|
+
return (
|
|
340
|
+
<AlertDialogPrimitive.Action
|
|
341
|
+
className={cn(buttonVariants(), className)}
|
|
342
|
+
{...props}
|
|
343
|
+
/>
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Cancel button of the alert dialog
|
|
349
|
+
*
|
|
350
|
+
* The button that dismisses the dialog without performing the action.
|
|
351
|
+
* Styled as an outline button by default to de-emphasize compared to
|
|
352
|
+
* the primary action. Closes the dialog when clicked.
|
|
353
|
+
*
|
|
354
|
+
* @param className - Additional CSS classes to apply
|
|
355
|
+
* @param props - All other props are forwarded to the underlying Radix AlertDialog.Cancel
|
|
356
|
+
*
|
|
357
|
+
* @example
|
|
358
|
+
* ```tsx
|
|
359
|
+
* <AlertDialogCancel>Cancel</AlertDialogCancel>
|
|
360
|
+
* <AlertDialogCancel>No, keep it</AlertDialogCancel>
|
|
361
|
+
* ```
|
|
362
|
+
*/
|
|
363
|
+
function AlertDialogCancel({
|
|
364
|
+
className,
|
|
365
|
+
...props
|
|
366
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>) {
|
|
367
|
+
return (
|
|
368
|
+
<AlertDialogPrimitive.Cancel
|
|
369
|
+
className={cn(buttonVariants({ variant: "outline" }), className)}
|
|
370
|
+
{...props}
|
|
371
|
+
/>
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
export {
|
|
376
|
+
AlertDialog,
|
|
377
|
+
AlertDialogPortal,
|
|
378
|
+
AlertDialogOverlay,
|
|
379
|
+
AlertDialogTrigger,
|
|
380
|
+
AlertDialogContent,
|
|
381
|
+
AlertDialogHeader,
|
|
382
|
+
AlertDialogFooter,
|
|
383
|
+
AlertDialogTitle,
|
|
384
|
+
AlertDialogDescription,
|
|
385
|
+
AlertDialogAction,
|
|
386
|
+
AlertDialogCancel,
|
|
387
|
+
};
|