@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,205 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
3
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
4
|
+
|
|
5
|
+
import { cn } from "@/lib/utils";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Badge variant styles using class-variance-authority (CVA).
|
|
9
|
+
*
|
|
10
|
+
* This function generates type-safe CSS classes for different badge variants.
|
|
11
|
+
* Each variant is designed with specific semantic meaning and appropriate
|
|
12
|
+
* color schemes for both light and dark themes.
|
|
13
|
+
*
|
|
14
|
+
* ## Base Styles
|
|
15
|
+
* - Inline flex layout with center alignment
|
|
16
|
+
* - Fixed height with responsive padding
|
|
17
|
+
* - Rounded corners and border
|
|
18
|
+
* - Typography: small, medium weight, no wrap
|
|
19
|
+
* - Icon support with consistent sizing
|
|
20
|
+
* - Accessibility features (focus rings, error states)
|
|
21
|
+
* - Smooth transitions for interactive states
|
|
22
|
+
*
|
|
23
|
+
* ## Variants
|
|
24
|
+
* - **default**: Primary brand color, high emphasis
|
|
25
|
+
* - **secondary**: Muted background, medium emphasis
|
|
26
|
+
* - **destructive**: Error/warning states, urgent attention
|
|
27
|
+
* - **outline**: Subtle border-only style, low emphasis
|
|
28
|
+
*
|
|
29
|
+
* @param props - Variant configuration object
|
|
30
|
+
* @param props.variant - The visual variant to apply
|
|
31
|
+
* @returns CSS class string for the specified variant
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* // Use directly with className
|
|
36
|
+
* <span className={badgeVariants({ variant: "destructive" })}>
|
|
37
|
+
* Error
|
|
38
|
+
* </span>
|
|
39
|
+
*
|
|
40
|
+
* // Combine with additional classes
|
|
41
|
+
* <span className={cn(badgeVariants({ variant: "outline" }), "custom-class")}>
|
|
42
|
+
* Custom Badge
|
|
43
|
+
* </span>
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
const badgeVariants = cva(
|
|
47
|
+
"inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
|
|
48
|
+
{
|
|
49
|
+
variants: {
|
|
50
|
+
variant: {
|
|
51
|
+
/** Primary badge with brand colors - use for important status or primary actions */
|
|
52
|
+
default:
|
|
53
|
+
"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
|
|
54
|
+
/** Secondary badge with muted colors - use for supplementary information */
|
|
55
|
+
secondary:
|
|
56
|
+
"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
|
|
57
|
+
/** Destructive badge for errors/warnings - use for critical states */
|
|
58
|
+
destructive:
|
|
59
|
+
"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
60
|
+
/** Outline badge with border only - use for subtle labeling */
|
|
61
|
+
outline:
|
|
62
|
+
"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
defaultVariants: {
|
|
66
|
+
variant: "default",
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* A versatile badge component for displaying status indicators, labels, counts, and notifications.
|
|
73
|
+
*
|
|
74
|
+
* Badges are small status descriptors for UI elements. They provide visual feedback about the state,
|
|
75
|
+
* category, or importance of content. The component is built with accessibility in mind and supports
|
|
76
|
+
* multiple visual variants for different semantic meanings.
|
|
77
|
+
*
|
|
78
|
+
* ## Key Features
|
|
79
|
+
* - Multiple semantic variants (default, secondary, destructive, outline)
|
|
80
|
+
* - Icon support with proper sizing and spacing
|
|
81
|
+
* - Polymorphic rendering via `asChild` prop
|
|
82
|
+
* - Accessibility-first design with proper focus management
|
|
83
|
+
* - Support for interactive states (hover, focus, invalid)
|
|
84
|
+
* - Built-in responsive behavior
|
|
85
|
+
*
|
|
86
|
+
* ## When to Use
|
|
87
|
+
* - Status indicators (active, pending, error)
|
|
88
|
+
* - Notification counts and badges
|
|
89
|
+
* - Category labels and tags
|
|
90
|
+
* - Priority indicators
|
|
91
|
+
* - Quick action buttons (when used with asChild)
|
|
92
|
+
*
|
|
93
|
+
* ## Accessibility Features
|
|
94
|
+
* - Keyboard navigation support with focus-visible ring
|
|
95
|
+
* - High contrast colors for all variants
|
|
96
|
+
* - Support for `aria-invalid` state with visual feedback
|
|
97
|
+
* - Semantic color mapping (destructive = error, etc.)
|
|
98
|
+
* - Screen reader friendly content structure
|
|
99
|
+
*
|
|
100
|
+
* @component
|
|
101
|
+
* @example
|
|
102
|
+
* ```tsx
|
|
103
|
+
* // Basic status badge
|
|
104
|
+
* <Badge>New</Badge>
|
|
105
|
+
* <Badge variant="secondary">Draft</Badge>
|
|
106
|
+
* <Badge variant="destructive">Error</Badge>
|
|
107
|
+
* <Badge variant="outline">Pending</Badge>
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```tsx
|
|
112
|
+
* // Badge with icon
|
|
113
|
+
* import { Check, AlertTriangle } from "lucide-react";
|
|
114
|
+
*
|
|
115
|
+
* <Badge>
|
|
116
|
+
* <Check />
|
|
117
|
+
* Completed
|
|
118
|
+
* </Badge>
|
|
119
|
+
*
|
|
120
|
+
* <Badge variant="destructive">
|
|
121
|
+
* <AlertTriangle />
|
|
122
|
+
* Failed
|
|
123
|
+
* </Badge>
|
|
124
|
+
* ```
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```tsx
|
|
128
|
+
* // Notification count badge
|
|
129
|
+
* <div className="relative">
|
|
130
|
+
* <Bell />
|
|
131
|
+
* <Badge className="absolute -top-2 -right-2 size-5 p-0 text-xs">
|
|
132
|
+
* 3
|
|
133
|
+
* </Badge>
|
|
134
|
+
* </div>
|
|
135
|
+
* ```
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```tsx
|
|
139
|
+
* // Interactive badge as link
|
|
140
|
+
* import Link from "next/link";
|
|
141
|
+
*
|
|
142
|
+
* <Badge asChild>
|
|
143
|
+
* <Link href="/notifications">
|
|
144
|
+
* 3 new messages
|
|
145
|
+
* </Link>
|
|
146
|
+
* </Badge>
|
|
147
|
+
* ```
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```tsx
|
|
151
|
+
* // Removable tag badge
|
|
152
|
+
* <Badge className="pr-1">
|
|
153
|
+
* React
|
|
154
|
+
* <button className="ml-1 hover:bg-primary-foreground/20 rounded-full p-0.5">
|
|
155
|
+
* <X className="size-3" />
|
|
156
|
+
* </button>
|
|
157
|
+
* </Badge>
|
|
158
|
+
* ```
|
|
159
|
+
*
|
|
160
|
+
* @see {@link Button} - For primary actionable elements
|
|
161
|
+
* @see [shadcn/ui Badge Documentation](https://ui.shadcn.com/docs/components/badge)
|
|
162
|
+
* @since 1.0.0
|
|
163
|
+
*/
|
|
164
|
+
function Badge({
|
|
165
|
+
className,
|
|
166
|
+
variant,
|
|
167
|
+
asChild = false,
|
|
168
|
+
...props
|
|
169
|
+
}: React.ComponentProps<"span"> &
|
|
170
|
+
VariantProps<typeof badgeVariants> & {
|
|
171
|
+
/**
|
|
172
|
+
* If true, the badge will render its child element instead of a span element.
|
|
173
|
+
* Useful for creating badge-styled links, buttons, or other interactive elements.
|
|
174
|
+
*
|
|
175
|
+
* When true, you must provide exactly one child element that can receive props.
|
|
176
|
+
* The child element will receive all the badge styling and attributes.
|
|
177
|
+
*
|
|
178
|
+
* @default false
|
|
179
|
+
* @example
|
|
180
|
+
* ```tsx
|
|
181
|
+
* // Badge as a link
|
|
182
|
+
* <Badge asChild>
|
|
183
|
+
* <Link href="/profile">Profile</Link>
|
|
184
|
+
* </Badge>
|
|
185
|
+
*
|
|
186
|
+
* // Badge as a button
|
|
187
|
+
* <Badge asChild>
|
|
188
|
+
* <button onClick={handleClick}>Click me</button>
|
|
189
|
+
* </Badge>
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
asChild?: boolean;
|
|
193
|
+
}) {
|
|
194
|
+
const Comp = asChild ? Slot : "span";
|
|
195
|
+
|
|
196
|
+
return (
|
|
197
|
+
<Comp
|
|
198
|
+
data-slot="badge"
|
|
199
|
+
className={cn(badgeVariants({ variant }), className)}
|
|
200
|
+
{...props}
|
|
201
|
+
/>
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
3
|
+
import { ChevronRight, MoreHorizontal } from "lucide-react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "@/lib/utils";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Breadcrumb navigation component that displays hierarchical page location
|
|
9
|
+
*
|
|
10
|
+
* A breadcrumb navigation component built on semantic HTML that shows the current page
|
|
11
|
+
* location within a navigational hierarchy. Provides users with contextual awareness
|
|
12
|
+
* of their position in the site structure and enables easy navigation to parent pages.
|
|
13
|
+
*
|
|
14
|
+
* Based on the shadcn/ui Breadcrumb component with accessibility features and
|
|
15
|
+
* support for composition patterns including custom separators, ellipsis for long
|
|
16
|
+
* paths, dropdown menus, and custom link components via the asChild prop.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* // Basic breadcrumb navigation
|
|
21
|
+
* <Breadcrumb>
|
|
22
|
+
* <BreadcrumbList>
|
|
23
|
+
* <BreadcrumbItem>
|
|
24
|
+
* <BreadcrumbLink href="/">Home</BreadcrumbLink>
|
|
25
|
+
* </BreadcrumbItem>
|
|
26
|
+
* <BreadcrumbSeparator />
|
|
27
|
+
* <BreadcrumbItem>
|
|
28
|
+
* <BreadcrumbLink href="/products">Products</BreadcrumbLink>
|
|
29
|
+
* </BreadcrumbItem>
|
|
30
|
+
* <BreadcrumbSeparator />
|
|
31
|
+
* <BreadcrumbItem>
|
|
32
|
+
* <BreadcrumbPage>Laptop</BreadcrumbPage>
|
|
33
|
+
* </BreadcrumbItem>
|
|
34
|
+
* </BreadcrumbList>
|
|
35
|
+
* </Breadcrumb>
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```tsx
|
|
40
|
+
* // With ellipsis for long paths
|
|
41
|
+
* <Breadcrumb>
|
|
42
|
+
* <BreadcrumbList>
|
|
43
|
+
* <BreadcrumbItem>
|
|
44
|
+
* <BreadcrumbLink href="/">Home</BreadcrumbLink>
|
|
45
|
+
* </BreadcrumbItem>
|
|
46
|
+
* <BreadcrumbSeparator />
|
|
47
|
+
* <BreadcrumbItem>
|
|
48
|
+
* <BreadcrumbEllipsis />
|
|
49
|
+
* </BreadcrumbItem>
|
|
50
|
+
* <BreadcrumbSeparator />
|
|
51
|
+
* <BreadcrumbItem>
|
|
52
|
+
* <BreadcrumbLink href="/products/laptops">Laptops</BreadcrumbLink>
|
|
53
|
+
* </BreadcrumbItem>
|
|
54
|
+
* <BreadcrumbSeparator />
|
|
55
|
+
* <BreadcrumbItem>
|
|
56
|
+
* <BreadcrumbPage>Gaming Laptop</BreadcrumbPage>
|
|
57
|
+
* </BreadcrumbItem>
|
|
58
|
+
* </BreadcrumbList>
|
|
59
|
+
* </Breadcrumb>
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```tsx
|
|
64
|
+
* // With Next.js Link integration
|
|
65
|
+
* import { Link } from "next/link"
|
|
66
|
+
*
|
|
67
|
+
* <Breadcrumb>
|
|
68
|
+
* <BreadcrumbList>
|
|
69
|
+
* <BreadcrumbItem>
|
|
70
|
+
* <BreadcrumbLink asChild>
|
|
71
|
+
* <Link href="/">Home</Link>
|
|
72
|
+
* </BreadcrumbLink>
|
|
73
|
+
* </BreadcrumbItem>
|
|
74
|
+
* <BreadcrumbSeparator />
|
|
75
|
+
* <BreadcrumbItem>
|
|
76
|
+
* <BreadcrumbPage>Current Page</BreadcrumbPage>
|
|
77
|
+
* </BreadcrumbItem>
|
|
78
|
+
* </BreadcrumbList>
|
|
79
|
+
* </Breadcrumb>
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```tsx
|
|
84
|
+
* // With custom separator
|
|
85
|
+
* import { Slash } from "lucide-react"
|
|
86
|
+
*
|
|
87
|
+
* <Breadcrumb>
|
|
88
|
+
* <BreadcrumbList>
|
|
89
|
+
* <BreadcrumbItem>
|
|
90
|
+
* <BreadcrumbLink href="/">Home</BreadcrumbLink>
|
|
91
|
+
* </BreadcrumbItem>
|
|
92
|
+
* <BreadcrumbSeparator>
|
|
93
|
+
* <Slash />
|
|
94
|
+
* </BreadcrumbSeparator>
|
|
95
|
+
* <BreadcrumbItem>
|
|
96
|
+
* <BreadcrumbPage>Current Page</BreadcrumbPage>
|
|
97
|
+
* </BreadcrumbItem>
|
|
98
|
+
* </BreadcrumbList>
|
|
99
|
+
* </Breadcrumb>
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* @accessibility
|
|
103
|
+
* - Uses semantic `nav` element with `aria-label="breadcrumb"`
|
|
104
|
+
* - Current page marked with `aria-current="page"`
|
|
105
|
+
* - Separators marked with `role="presentation"` and `aria-hidden="true"`
|
|
106
|
+
* - Screen reader friendly navigation structure
|
|
107
|
+
* - Supports keyboard navigation through links
|
|
108
|
+
*
|
|
109
|
+
* @see {@link https://ui.shadcn.com/docs/components/breadcrumb} for design patterns
|
|
110
|
+
* @see {@link BreadcrumbList} - Ordered list container for breadcrumb items
|
|
111
|
+
* @see {@link BreadcrumbItem} - Individual breadcrumb list item
|
|
112
|
+
* @see {@link BreadcrumbLink} - Navigable breadcrumb link with asChild support
|
|
113
|
+
* @see {@link BreadcrumbPage} - Current page indicator (non-clickable)
|
|
114
|
+
* @see {@link BreadcrumbSeparator} - Visual separator between items
|
|
115
|
+
* @see {@link BreadcrumbEllipsis} - Ellipsis indicator for collapsed items
|
|
116
|
+
* @since 1.0.0
|
|
117
|
+
*/
|
|
118
|
+
function Breadcrumb({ ...props }: React.ComponentProps<"nav">) {
|
|
119
|
+
return <nav aria-label="breadcrumb" data-slot="breadcrumb" {...props} />;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Ordered list container for breadcrumb items
|
|
124
|
+
*
|
|
125
|
+
* Provides the structured list layout for breadcrumb navigation items with
|
|
126
|
+
* responsive spacing and text overflow handling. Uses semantic `ol` element
|
|
127
|
+
* for proper accessibility and screen reader navigation.
|
|
128
|
+
*
|
|
129
|
+
* @param className - Additional CSS classes to apply
|
|
130
|
+
* @param props - Standard HTML ordered list props
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```tsx
|
|
134
|
+
* <BreadcrumbList>
|
|
135
|
+
* <BreadcrumbItem>
|
|
136
|
+
* <BreadcrumbLink href="/">Home</BreadcrumbLink>
|
|
137
|
+
* </BreadcrumbItem>
|
|
138
|
+
* </BreadcrumbList>
|
|
139
|
+
* ```
|
|
140
|
+
*
|
|
141
|
+
* @since 1.0.0
|
|
142
|
+
*/
|
|
143
|
+
function BreadcrumbList({ className, ...props }: React.ComponentProps<"ol">) {
|
|
144
|
+
return (
|
|
145
|
+
<ol
|
|
146
|
+
data-slot="breadcrumb-list"
|
|
147
|
+
className={cn(
|
|
148
|
+
"text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",
|
|
149
|
+
className,
|
|
150
|
+
)}
|
|
151
|
+
{...props}
|
|
152
|
+
/>
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Individual breadcrumb list item container
|
|
158
|
+
*
|
|
159
|
+
* Wraps breadcrumb content (links, pages, separators) in a semantic list item.
|
|
160
|
+
* Provides consistent alignment and spacing for breadcrumb elements.
|
|
161
|
+
*
|
|
162
|
+
* @param className - Additional CSS classes to apply
|
|
163
|
+
* @param props - Standard HTML list item props
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```tsx
|
|
167
|
+
* <BreadcrumbItem>
|
|
168
|
+
* <BreadcrumbLink href="/products">Products</BreadcrumbLink>
|
|
169
|
+
* </BreadcrumbItem>
|
|
170
|
+
* ```
|
|
171
|
+
*
|
|
172
|
+
* @since 1.0.0
|
|
173
|
+
*/
|
|
174
|
+
function BreadcrumbItem({ className, ...props }: React.ComponentProps<"li">) {
|
|
175
|
+
return (
|
|
176
|
+
<li
|
|
177
|
+
data-slot="breadcrumb-item"
|
|
178
|
+
className={cn("inline-flex items-center gap-1.5", className)}
|
|
179
|
+
{...props}
|
|
180
|
+
/>
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Navigable link within breadcrumb trail
|
|
186
|
+
*
|
|
187
|
+
* Represents a clickable parent page in the breadcrumb hierarchy with hover
|
|
188
|
+
* effects and transition animations. Supports composition via the `asChild` prop
|
|
189
|
+
* for integration with routing libraries like Next.js Link or React Router.
|
|
190
|
+
*
|
|
191
|
+
* @param asChild - When true, renders children directly instead of an anchor element
|
|
192
|
+
* @param className - Additional CSS classes to apply
|
|
193
|
+
* @param props - Standard HTML anchor props when asChild is false
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```tsx
|
|
197
|
+
* // Standard link
|
|
198
|
+
* <BreadcrumbLink href="/products">Products</BreadcrumbLink>
|
|
199
|
+
* ```
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```tsx
|
|
203
|
+
* // With Next.js Link
|
|
204
|
+
* <BreadcrumbLink asChild>
|
|
205
|
+
* <Link href="/products">Products</Link>
|
|
206
|
+
* </BreadcrumbLink>
|
|
207
|
+
* ```
|
|
208
|
+
*
|
|
209
|
+
* @since 1.0.0
|
|
210
|
+
*/
|
|
211
|
+
function BreadcrumbLink({
|
|
212
|
+
asChild,
|
|
213
|
+
className,
|
|
214
|
+
...props
|
|
215
|
+
}: React.ComponentProps<"a"> & {
|
|
216
|
+
asChild?: boolean;
|
|
217
|
+
}) {
|
|
218
|
+
const Comp = asChild ? Slot : "a";
|
|
219
|
+
|
|
220
|
+
return (
|
|
221
|
+
<Comp
|
|
222
|
+
data-slot="breadcrumb-link"
|
|
223
|
+
className={cn("hover:text-foreground transition-colors", className)}
|
|
224
|
+
{...props}
|
|
225
|
+
/>
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Current page indicator in breadcrumb trail
|
|
231
|
+
*
|
|
232
|
+
* Represents the current page (non-clickable) at the end of the breadcrumb trail.
|
|
233
|
+
* Styled with prominent text color and marked with accessibility attributes
|
|
234
|
+
* including `aria-current="page"` for screen reader identification.
|
|
235
|
+
*
|
|
236
|
+
* @param className - Additional CSS classes to apply
|
|
237
|
+
* @param props - Standard HTML span props
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* ```tsx
|
|
241
|
+
* <BreadcrumbPage>Current Page Name</BreadcrumbPage>
|
|
242
|
+
* ```
|
|
243
|
+
*
|
|
244
|
+
* @accessibility
|
|
245
|
+
* - Uses `role="link"` with `aria-disabled="true"` for semantic meaning
|
|
246
|
+
* - Marked with `aria-current="page"` to indicate current location
|
|
247
|
+
*
|
|
248
|
+
* @since 1.0.0
|
|
249
|
+
*/
|
|
250
|
+
function BreadcrumbPage({ className, ...props }: React.ComponentProps<"span">) {
|
|
251
|
+
return (
|
|
252
|
+
<span
|
|
253
|
+
data-slot="breadcrumb-page"
|
|
254
|
+
role="link"
|
|
255
|
+
aria-disabled="true"
|
|
256
|
+
aria-current="page"
|
|
257
|
+
className={cn("text-foreground font-normal", className)}
|
|
258
|
+
{...props}
|
|
259
|
+
/>
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Visual separator between breadcrumb items
|
|
265
|
+
*
|
|
266
|
+
* Displays a separator icon (default: ChevronRight) between breadcrumb items.
|
|
267
|
+
* Supports custom separator icons by passing them as children. Hidden from
|
|
268
|
+
* screen readers with accessibility attributes for clean navigation experience.
|
|
269
|
+
*
|
|
270
|
+
* @param children - Custom separator icon to display instead of default ChevronRight
|
|
271
|
+
* @param className - Additional CSS classes to apply
|
|
272
|
+
* @param props - Standard HTML list item props
|
|
273
|
+
*
|
|
274
|
+
* @example
|
|
275
|
+
* ```tsx
|
|
276
|
+
* // Default separator
|
|
277
|
+
* <BreadcrumbSeparator />
|
|
278
|
+
* ```
|
|
279
|
+
*
|
|
280
|
+
* @example
|
|
281
|
+
* ```tsx
|
|
282
|
+
* // Custom separator
|
|
283
|
+
* import { Slash } from "lucide-react"
|
|
284
|
+
* <BreadcrumbSeparator>
|
|
285
|
+
* <Slash />
|
|
286
|
+
* </BreadcrumbSeparator>
|
|
287
|
+
* ```
|
|
288
|
+
*
|
|
289
|
+
* @accessibility
|
|
290
|
+
* - Uses `role="presentation"` to indicate decorative content
|
|
291
|
+
* - Hidden from screen readers with `aria-hidden="true"`
|
|
292
|
+
*
|
|
293
|
+
* @since 1.0.0
|
|
294
|
+
*/
|
|
295
|
+
function BreadcrumbSeparator({
|
|
296
|
+
children,
|
|
297
|
+
className,
|
|
298
|
+
...props
|
|
299
|
+
}: React.ComponentProps<"li">) {
|
|
300
|
+
return (
|
|
301
|
+
<li
|
|
302
|
+
data-slot="breadcrumb-separator"
|
|
303
|
+
role="presentation"
|
|
304
|
+
aria-hidden="true"
|
|
305
|
+
className={cn("[&>svg]:size-3.5", className)}
|
|
306
|
+
{...props}
|
|
307
|
+
>
|
|
308
|
+
{children ?? <ChevronRight />}
|
|
309
|
+
</li>
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Ellipsis indicator for collapsed breadcrumb items
|
|
315
|
+
*
|
|
316
|
+
* Shows a horizontal ellipsis icon (MoreHorizontal) to indicate hidden or
|
|
317
|
+
* collapsed middle items in a long breadcrumb trail. Useful for deep navigation
|
|
318
|
+
* hierarchies where space is limited. Often used in combination with dropdown
|
|
319
|
+
* menus to reveal the collapsed items.
|
|
320
|
+
*
|
|
321
|
+
* @param className - Additional CSS classes to apply
|
|
322
|
+
* @param props - Standard HTML span props
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* ```tsx
|
|
326
|
+
* // Simple ellipsis
|
|
327
|
+
* <BreadcrumbEllipsis />
|
|
328
|
+
* ```
|
|
329
|
+
*
|
|
330
|
+
* @example
|
|
331
|
+
* ```tsx
|
|
332
|
+
* // With dropdown menu for collapsed items
|
|
333
|
+
* <BreadcrumbItem>
|
|
334
|
+
* <DropdownMenu>
|
|
335
|
+
* <DropdownMenuTrigger>
|
|
336
|
+
* <BreadcrumbEllipsis />
|
|
337
|
+
* </DropdownMenuTrigger>
|
|
338
|
+
* <DropdownMenuContent>
|
|
339
|
+
* <DropdownMenuItem>Hidden Item 1</DropdownMenuItem>
|
|
340
|
+
* <DropdownMenuItem>Hidden Item 2</DropdownMenuItem>
|
|
341
|
+
* </DropdownMenuContent>
|
|
342
|
+
* </DropdownMenu>
|
|
343
|
+
* </BreadcrumbItem>
|
|
344
|
+
* ```
|
|
345
|
+
*
|
|
346
|
+
* @accessibility
|
|
347
|
+
* - Uses `role="presentation"` and `aria-hidden="true"` for decorative content
|
|
348
|
+
* - Includes screen reader text "More" for context
|
|
349
|
+
*
|
|
350
|
+
* @since 1.0.0
|
|
351
|
+
*/
|
|
352
|
+
function BreadcrumbEllipsis({
|
|
353
|
+
className,
|
|
354
|
+
...props
|
|
355
|
+
}: React.ComponentProps<"span">) {
|
|
356
|
+
return (
|
|
357
|
+
<span
|
|
358
|
+
data-slot="breadcrumb-ellipsis"
|
|
359
|
+
role="presentation"
|
|
360
|
+
aria-hidden="true"
|
|
361
|
+
className={cn("flex size-9 items-center justify-center", className)}
|
|
362
|
+
{...props}
|
|
363
|
+
>
|
|
364
|
+
<MoreHorizontal className="size-4" />
|
|
365
|
+
<span className="sr-only">More</span>
|
|
366
|
+
</span>
|
|
367
|
+
);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export {
|
|
371
|
+
Breadcrumb,
|
|
372
|
+
BreadcrumbList,
|
|
373
|
+
BreadcrumbItem,
|
|
374
|
+
BreadcrumbLink,
|
|
375
|
+
BreadcrumbPage,
|
|
376
|
+
BreadcrumbSeparator,
|
|
377
|
+
BreadcrumbEllipsis,
|
|
378
|
+
};
|