@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,253 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* TooltipProvider - Global context provider for tooltip functionality
|
|
8
|
+
*
|
|
9
|
+
* Wraps your application or component tree to enable tooltip functionality.
|
|
10
|
+
* Controls global tooltip behavior such as delay duration before showing tooltips.
|
|
11
|
+
* Required for tooltip components to function properly.
|
|
12
|
+
*
|
|
13
|
+
* @param delayDuration - Time in milliseconds to wait before showing tooltip (default: 0)
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* // Wrap your entire app
|
|
18
|
+
* <TooltipProvider>
|
|
19
|
+
* <App />
|
|
20
|
+
* </TooltipProvider>
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* // With custom delay
|
|
26
|
+
* <TooltipProvider delayDuration={700}>
|
|
27
|
+
* <MyComponent />
|
|
28
|
+
* </TooltipProvider>
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @see {@link https://ui.shadcn.com/docs/components/tooltip} for design patterns
|
|
32
|
+
* @since 1.0.0
|
|
33
|
+
*/
|
|
34
|
+
function TooltipProvider({
|
|
35
|
+
delayDuration = 0,
|
|
36
|
+
...props
|
|
37
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
|
|
38
|
+
return (
|
|
39
|
+
<TooltipPrimitive.Provider
|
|
40
|
+
data-slot="tooltip-provider"
|
|
41
|
+
delayDuration={delayDuration}
|
|
42
|
+
{...props}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Tooltip - Display contextual information on hover or focus
|
|
49
|
+
*
|
|
50
|
+
* A versatile tooltip component built on Radix UI primitives that provides
|
|
51
|
+
* contextual information when users hover over or focus on an element. Perfect
|
|
52
|
+
* for displaying help text, definitions, or additional context without cluttering
|
|
53
|
+
* the interface. Automatically wraps content in a TooltipProvider for convenience.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```tsx
|
|
57
|
+
* // Basic tooltip
|
|
58
|
+
* <Tooltip>
|
|
59
|
+
* <TooltipTrigger asChild>
|
|
60
|
+
* <Button variant="outline">Hover me</Button>
|
|
61
|
+
* </TooltipTrigger>
|
|
62
|
+
* <TooltipContent>
|
|
63
|
+
* <p>This is a helpful tooltip</p>
|
|
64
|
+
* </TooltipContent>
|
|
65
|
+
* </Tooltip>
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```tsx
|
|
70
|
+
* // Icon button with tooltip
|
|
71
|
+
* import { Info } from "lucide-react"
|
|
72
|
+
*
|
|
73
|
+
* <Tooltip>
|
|
74
|
+
* <TooltipTrigger asChild>
|
|
75
|
+
* <Button variant="ghost" size="icon">
|
|
76
|
+
* <Info className="h-4 w-4" />
|
|
77
|
+
* </Button>
|
|
78
|
+
* </TooltipTrigger>
|
|
79
|
+
* <TooltipContent>
|
|
80
|
+
* <p>Additional information</p>
|
|
81
|
+
* </TooltipContent>
|
|
82
|
+
* </Tooltip>
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```tsx
|
|
87
|
+
* // Disabled element with tooltip
|
|
88
|
+
* <Tooltip>
|
|
89
|
+
* <TooltipTrigger asChild>
|
|
90
|
+
* <span>
|
|
91
|
+
* <Button disabled>Disabled Action</Button>
|
|
92
|
+
* </span>
|
|
93
|
+
* </TooltipTrigger>
|
|
94
|
+
* <TooltipContent>
|
|
95
|
+
* <p>You need to complete setup first</p>
|
|
96
|
+
* </TooltipContent>
|
|
97
|
+
* </Tooltip>
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```tsx
|
|
102
|
+
* // Positioned tooltip with rich content
|
|
103
|
+
* <Tooltip>
|
|
104
|
+
* <TooltipTrigger asChild>
|
|
105
|
+
* <Badge variant="secondary">API Key</Badge>
|
|
106
|
+
* </TooltipTrigger>
|
|
107
|
+
* <TooltipContent side="right" className="max-w-[250px]">
|
|
108
|
+
* <div className="space-y-1">
|
|
109
|
+
* <p className="font-medium">API Authentication</p>
|
|
110
|
+
* <p className="text-xs">Your key is used to authenticate requests</p>
|
|
111
|
+
* </div>
|
|
112
|
+
* </TooltipContent>
|
|
113
|
+
* </Tooltip>
|
|
114
|
+
* ```
|
|
115
|
+
*
|
|
116
|
+
* @accessibility
|
|
117
|
+
* - Fully keyboard accessible (shows on focus, hides on blur)
|
|
118
|
+
* - Screen reader compatible with proper ARIA attributes
|
|
119
|
+
* - Escape key dismisses tooltip
|
|
120
|
+
* - Automatic positioning with collision detection
|
|
121
|
+
* - Respects user's reduced motion preferences
|
|
122
|
+
* - Portal rendering prevents z-index issues
|
|
123
|
+
*
|
|
124
|
+
* @see {@link https://ui.shadcn.com/docs/components/tooltip} for design patterns
|
|
125
|
+
* @see {@link Popover} - For interactive floating content
|
|
126
|
+
* @see {@link HoverCard} - For rich content previews
|
|
127
|
+
* @since 1.0.0
|
|
128
|
+
*/
|
|
129
|
+
function Tooltip({
|
|
130
|
+
...props
|
|
131
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Root>) {
|
|
132
|
+
return (
|
|
133
|
+
<TooltipProvider>
|
|
134
|
+
<TooltipPrimitive.Root data-slot="tooltip" {...props} />
|
|
135
|
+
</TooltipProvider>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* TooltipTrigger - The element that triggers the tooltip display
|
|
141
|
+
*
|
|
142
|
+
* Wraps the element that will show the tooltip on hover or focus.
|
|
143
|
+
* Use the `asChild` prop to merge props with the child element rather
|
|
144
|
+
* than rendering an additional wrapper element.
|
|
145
|
+
*
|
|
146
|
+
* @param asChild - When true, merges props with the child element instead of rendering a wrapper
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```tsx
|
|
150
|
+
* // Basic trigger
|
|
151
|
+
* <TooltipTrigger asChild>
|
|
152
|
+
* <Button>Hover me</Button>
|
|
153
|
+
* </TooltipTrigger>
|
|
154
|
+
* ```
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```tsx
|
|
158
|
+
* // With disabled element (requires wrapper)
|
|
159
|
+
* <TooltipTrigger asChild>
|
|
160
|
+
* <span>
|
|
161
|
+
* <Button disabled>Disabled</Button>
|
|
162
|
+
* </span>
|
|
163
|
+
* </TooltipTrigger>
|
|
164
|
+
* ```
|
|
165
|
+
*
|
|
166
|
+
* @accessibility
|
|
167
|
+
* - Automatically handles hover, focus, and blur events
|
|
168
|
+
* - Preserves existing keyboard navigation patterns
|
|
169
|
+
* - Maintains semantic meaning of wrapped element
|
|
170
|
+
* - Works with disabled elements when properly wrapped
|
|
171
|
+
*
|
|
172
|
+
* @since 1.0.0
|
|
173
|
+
*/
|
|
174
|
+
function TooltipTrigger({
|
|
175
|
+
...props
|
|
176
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
|
|
177
|
+
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* TooltipContent - The floating tooltip content container
|
|
182
|
+
*
|
|
183
|
+
* Contains the content displayed in the tooltip popup. Automatically positioned
|
|
184
|
+
* relative to the trigger element with intelligent collision detection to ensure
|
|
185
|
+
* the tooltip stays within the viewport. Includes smooth animations and an arrow
|
|
186
|
+
* pointer for visual connection to the trigger.
|
|
187
|
+
*
|
|
188
|
+
* @param side - Preferred side of the trigger to display on ("top" | "right" | "bottom" | "left")
|
|
189
|
+
* @param sideOffset - Distance in pixels from the trigger element (default: 0)
|
|
190
|
+
* @param className - Additional CSS classes for custom styling
|
|
191
|
+
* @param children - Content to display in the tooltip
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* ```tsx
|
|
195
|
+
* // Simple text tooltip
|
|
196
|
+
* <TooltipContent>
|
|
197
|
+
* <p>This is helpful information</p>
|
|
198
|
+
* </TooltipContent>
|
|
199
|
+
* ```
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```tsx
|
|
203
|
+
* // Positioned tooltip with offset
|
|
204
|
+
* <TooltipContent side="left" sideOffset={10}>
|
|
205
|
+
* <p>Appears on the left with spacing</p>
|
|
206
|
+
* </TooltipContent>
|
|
207
|
+
* ```
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* ```tsx
|
|
211
|
+
* // Rich content with custom width
|
|
212
|
+
* <TooltipContent className="max-w-[300px]">
|
|
213
|
+
* <div className="space-y-1">
|
|
214
|
+
* <p className="font-medium">Feature Name</p>
|
|
215
|
+
* <p className="text-xs">Detailed description here</p>
|
|
216
|
+
* </div>
|
|
217
|
+
* </TooltipContent>
|
|
218
|
+
* ```
|
|
219
|
+
*
|
|
220
|
+
* @accessibility
|
|
221
|
+
* - Rendered in a portal to avoid z-index stacking issues
|
|
222
|
+
* - Properly announced by screen readers with role="tooltip"
|
|
223
|
+
* - Smooth animations respect reduced motion preferences
|
|
224
|
+
* - Arrow provides visual connection to trigger element
|
|
225
|
+
* - Automatically dismisses when trigger loses focus
|
|
226
|
+
*
|
|
227
|
+
* @since 1.0.0
|
|
228
|
+
*/
|
|
229
|
+
function TooltipContent({
|
|
230
|
+
className,
|
|
231
|
+
sideOffset = 0,
|
|
232
|
+
children,
|
|
233
|
+
...props
|
|
234
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
|
|
235
|
+
return (
|
|
236
|
+
<TooltipPrimitive.Portal>
|
|
237
|
+
<TooltipPrimitive.Content
|
|
238
|
+
data-slot="tooltip-content"
|
|
239
|
+
sideOffset={sideOffset}
|
|
240
|
+
className={cn(
|
|
241
|
+
"bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
|
|
242
|
+
className,
|
|
243
|
+
)}
|
|
244
|
+
{...props}
|
|
245
|
+
>
|
|
246
|
+
{children}
|
|
247
|
+
<TooltipPrimitive.Arrow className="bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" />
|
|
248
|
+
</TooltipPrimitive.Content>
|
|
249
|
+
</TooltipPrimitive.Portal>
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
|
@@ -0,0 +1,468 @@
|
|
|
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
|
+
* Typography variant configuration using class-variance-authority
|
|
9
|
+
*
|
|
10
|
+
* Defines all possible typography variants, sizes, and styling options.
|
|
11
|
+
* Uses Tailwind CSS 4 with custom CSS properties for theming.
|
|
12
|
+
*
|
|
13
|
+
* @see {@link https://cva.style/docs} - CVA documentation
|
|
14
|
+
* @see {@link https://ui.shadcn.com/docs/components/typography} - Typography component inspiration
|
|
15
|
+
* @since 1.0.0
|
|
16
|
+
*/
|
|
17
|
+
const typographyVariants = cva("", {
|
|
18
|
+
variants: {
|
|
19
|
+
/**
|
|
20
|
+
* Typography variant types based on semantic meaning and visual hierarchy
|
|
21
|
+
*
|
|
22
|
+
* @variant heading - Primary headings for page/section titles (20px)
|
|
23
|
+
* @variant subheading - Secondary headings for subsections (17px)
|
|
24
|
+
* @variant body - Standard body text for content (14px)
|
|
25
|
+
* @variant bodyEmphasized - Emphasized body text with medium weight (14px)
|
|
26
|
+
* @variant details - Smaller text for details and descriptions (12px)
|
|
27
|
+
* @variant field - Text for form fields and labels (17px)
|
|
28
|
+
* @variant code - Monospace text for code snippets (17px)
|
|
29
|
+
* @variant microcopy - Very small text for captions and fine print (10px)
|
|
30
|
+
* @variant tableCell - Text for table cell content (17px)
|
|
31
|
+
* @variant tableHeader - Text for table headers with emphasis (17px)
|
|
32
|
+
*/
|
|
33
|
+
variant: {
|
|
34
|
+
heading: "text-lg font-semibold leading-tight",
|
|
35
|
+
subheading: "text-base font-medium leading-relaxed",
|
|
36
|
+
body: "text-sm leading-relaxed",
|
|
37
|
+
bodyEmphasized: "text-sm font-medium leading-relaxed",
|
|
38
|
+
details: "text-xs leading-normal",
|
|
39
|
+
field: "text-base leading-normal",
|
|
40
|
+
code: "text-base font-mono leading-normal",
|
|
41
|
+
microcopy: "text-microcopy leading-tight",
|
|
42
|
+
tableCell: "text-base leading-normal",
|
|
43
|
+
tableHeader: "text-base font-medium leading-normal",
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* Color variants for different semantic meanings
|
|
47
|
+
*
|
|
48
|
+
* @color default - Default text color based on theme
|
|
49
|
+
* @color muted - Muted text color for secondary information
|
|
50
|
+
* @color accent - Accent color for emphasis
|
|
51
|
+
* @color destructive - Red color for destructive actions or errors
|
|
52
|
+
* @color success - Green color for success states
|
|
53
|
+
* @color warning - Orange/yellow color for warnings
|
|
54
|
+
*/
|
|
55
|
+
color: {
|
|
56
|
+
default: "text-foreground",
|
|
57
|
+
muted: "text-muted-foreground",
|
|
58
|
+
accent: "text-accent-foreground",
|
|
59
|
+
destructive: "text-destructive",
|
|
60
|
+
success: "text-success",
|
|
61
|
+
warning: "text-warning",
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* Text alignment options
|
|
65
|
+
*/
|
|
66
|
+
align: {
|
|
67
|
+
left: "text-left",
|
|
68
|
+
center: "text-center",
|
|
69
|
+
right: "text-right",
|
|
70
|
+
justify: "text-justify",
|
|
71
|
+
},
|
|
72
|
+
/**
|
|
73
|
+
* Text transformation options
|
|
74
|
+
*/
|
|
75
|
+
transform: {
|
|
76
|
+
uppercase: "uppercase",
|
|
77
|
+
lowercase: "lowercase",
|
|
78
|
+
capitalize: "capitalize",
|
|
79
|
+
},
|
|
80
|
+
/**
|
|
81
|
+
* Font weight variations
|
|
82
|
+
*/
|
|
83
|
+
weight: {
|
|
84
|
+
normal: "font-normal",
|
|
85
|
+
medium: "font-medium",
|
|
86
|
+
semibold: "font-semibold",
|
|
87
|
+
bold: "font-bold",
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
defaultVariants: {
|
|
91
|
+
variant: "body",
|
|
92
|
+
color: "default",
|
|
93
|
+
align: "left",
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Props interface for the Typography component
|
|
99
|
+
*/
|
|
100
|
+
export interface TypographyProps
|
|
101
|
+
extends Omit<React.HTMLAttributes<HTMLElement>, "color">,
|
|
102
|
+
VariantProps<typeof typographyVariants> {
|
|
103
|
+
/**
|
|
104
|
+
* The HTML element or component to render as
|
|
105
|
+
* @default "p"
|
|
106
|
+
*/
|
|
107
|
+
as?: React.ElementType;
|
|
108
|
+
/**
|
|
109
|
+
* For label elements, the associated input ID
|
|
110
|
+
*/
|
|
111
|
+
htmlFor?: string;
|
|
112
|
+
/**
|
|
113
|
+
* Whether to render as a Slot component for composition
|
|
114
|
+
* @default false
|
|
115
|
+
*/
|
|
116
|
+
asChild?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Whether the text should be italic
|
|
119
|
+
* @default false
|
|
120
|
+
*/
|
|
121
|
+
italic?: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Whether the text should be underlined
|
|
124
|
+
* @default false
|
|
125
|
+
*/
|
|
126
|
+
underline?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Whether the text should be struck through
|
|
129
|
+
* @default false
|
|
130
|
+
*/
|
|
131
|
+
strikethrough?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Whether the text should have a truncated overflow with ellipsis
|
|
134
|
+
* @default false
|
|
135
|
+
*/
|
|
136
|
+
truncate?: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Screen reader only text (visually hidden but accessible)
|
|
139
|
+
* @default false
|
|
140
|
+
*/
|
|
141
|
+
srOnly?: boolean;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Typography component for consistent text styling across the application
|
|
146
|
+
*
|
|
147
|
+
* Provides a comprehensive set of typography variants based on design system
|
|
148
|
+
* specifications. Supports semantic HTML elements, accessibility features,
|
|
149
|
+
* and flexible styling options.
|
|
150
|
+
*
|
|
151
|
+
* @component
|
|
152
|
+
* @example
|
|
153
|
+
* ```tsx
|
|
154
|
+
* // Basic heading
|
|
155
|
+
* <Typography variant="heading" as="h1">
|
|
156
|
+
* Welcome to Neynar
|
|
157
|
+
* </Typography>
|
|
158
|
+
*
|
|
159
|
+
* // Body text with color
|
|
160
|
+
* <Typography variant="body" color="muted">
|
|
161
|
+
* This is some body text with muted color.
|
|
162
|
+
* </Typography>
|
|
163
|
+
*
|
|
164
|
+
* // Code snippet
|
|
165
|
+
* <Typography variant="code" as="code">
|
|
166
|
+
* const message = "Hello, world!";
|
|
167
|
+
* </Typography>
|
|
168
|
+
*
|
|
169
|
+
* // Table header
|
|
170
|
+
* <Typography variant="tableHeader" as="th">
|
|
171
|
+
* Column Header
|
|
172
|
+
* </Typography>
|
|
173
|
+
* ```
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* ```tsx
|
|
177
|
+
* // With additional styling
|
|
178
|
+
* <Typography
|
|
179
|
+
* variant="subheading"
|
|
180
|
+
* color="accent"
|
|
181
|
+
* align="center"
|
|
182
|
+
* italic
|
|
183
|
+
* underline
|
|
184
|
+
* >
|
|
185
|
+
* Styled Subheading
|
|
186
|
+
* </Typography>
|
|
187
|
+
*
|
|
188
|
+
* // Truncated text
|
|
189
|
+
* <Typography variant="body" truncate className="max-w-xs">
|
|
190
|
+
* This is a very long text that will be truncated with ellipsis
|
|
191
|
+
* </Typography>
|
|
192
|
+
*
|
|
193
|
+
* // Screen reader only
|
|
194
|
+
* <Typography variant="details" srOnly>
|
|
195
|
+
* Additional context for screen readers
|
|
196
|
+
* </Typography>
|
|
197
|
+
* ```
|
|
198
|
+
*
|
|
199
|
+
* @param props - Typography component props
|
|
200
|
+
* @param props.variant - Typography variant for semantic styling
|
|
201
|
+
* @param props.color - Color variant for different semantic meanings
|
|
202
|
+
* @param props.align - Text alignment
|
|
203
|
+
* @param props.transform - Text transformation
|
|
204
|
+
* @param props.weight - Font weight override
|
|
205
|
+
* @param props.as - HTML element to render as
|
|
206
|
+
* @param props.asChild - Render as Slot for composition
|
|
207
|
+
* @param props.italic - Apply italic styling
|
|
208
|
+
* @param props.underline - Apply underline styling
|
|
209
|
+
* @param props.strikethrough - Apply strikethrough styling
|
|
210
|
+
* @param props.truncate - Apply text truncation with ellipsis
|
|
211
|
+
* @param props.srOnly - Hide visually but keep accessible
|
|
212
|
+
* @param props.className - Additional CSS classes
|
|
213
|
+
* @param props.children - Content to render
|
|
214
|
+
*
|
|
215
|
+
* @accessibility
|
|
216
|
+
* - Uses semantic HTML elements when specified via `as` prop
|
|
217
|
+
* - Supports screen reader only content with `srOnly` prop
|
|
218
|
+
* - Maintains proper color contrast ratios across all color variants
|
|
219
|
+
* - Respects user preferences for reduced motion and high contrast
|
|
220
|
+
*
|
|
221
|
+
* @since 1.0.0
|
|
222
|
+
*/
|
|
223
|
+
export function Typography({
|
|
224
|
+
className,
|
|
225
|
+
variant,
|
|
226
|
+
color,
|
|
227
|
+
align,
|
|
228
|
+
transform,
|
|
229
|
+
weight,
|
|
230
|
+
as: Element = "p",
|
|
231
|
+
asChild = false,
|
|
232
|
+
italic = false,
|
|
233
|
+
underline = false,
|
|
234
|
+
strikethrough = false,
|
|
235
|
+
truncate = false,
|
|
236
|
+
srOnly = false,
|
|
237
|
+
...props
|
|
238
|
+
}: TypographyProps) {
|
|
239
|
+
const Comp = asChild ? Slot : Element;
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
return (
|
|
243
|
+
<Comp
|
|
244
|
+
className={cn(
|
|
245
|
+
typographyVariants({ variant, color, align, transform, weight }),
|
|
246
|
+
{
|
|
247
|
+
italic,
|
|
248
|
+
underline,
|
|
249
|
+
"line-through": strikethrough,
|
|
250
|
+
"truncate overflow-hidden text-ellipsis whitespace-nowrap": truncate,
|
|
251
|
+
"sr-only": srOnly,
|
|
252
|
+
},
|
|
253
|
+
className,
|
|
254
|
+
)}
|
|
255
|
+
{...props}
|
|
256
|
+
/>
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Individual semantic typography components with pre-configured defaults
|
|
262
|
+
*/
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* H1 heading component
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* ```tsx
|
|
269
|
+
* <H1>Main Page Title</H1>
|
|
270
|
+
* <H1 color="muted">Subtle heading</H1>
|
|
271
|
+
* ```
|
|
272
|
+
*/
|
|
273
|
+
export function H1(props: Omit<TypographyProps, "as" | "variant">) {
|
|
274
|
+
return <Typography variant="heading" as="h1" {...props} />;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* H2 heading component
|
|
279
|
+
*
|
|
280
|
+
* @example
|
|
281
|
+
* ```tsx
|
|
282
|
+
* <H2>Section Title</H2>
|
|
283
|
+
* <H2 color="accent">Highlighted section</H2>
|
|
284
|
+
* ```
|
|
285
|
+
*/
|
|
286
|
+
export function H2(props: Omit<TypographyProps, "as" | "variant">) {
|
|
287
|
+
return <Typography variant="subheading" as="h2" {...props} />;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* H3 heading component
|
|
292
|
+
*
|
|
293
|
+
* @example
|
|
294
|
+
* ```tsx
|
|
295
|
+
* <H3>Subsection Title</H3>
|
|
296
|
+
* ```
|
|
297
|
+
*/
|
|
298
|
+
export function H3(props: Omit<TypographyProps, "as" | "variant">) {
|
|
299
|
+
return <Typography variant="subheading" as="h3" {...props} />;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* H4 heading component
|
|
304
|
+
*
|
|
305
|
+
* @example
|
|
306
|
+
* ```tsx
|
|
307
|
+
* <H4>Minor Heading</H4>
|
|
308
|
+
* ```
|
|
309
|
+
*/
|
|
310
|
+
export function H4(props: Omit<TypographyProps, "as" | "variant">) {
|
|
311
|
+
return <Typography variant="bodyEmphasized" as="h4" {...props} />;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* H5 heading component
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* ```tsx
|
|
319
|
+
* <H5>Small Heading</H5>
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
322
|
+
export function H5(props: Omit<TypographyProps, "as" | "variant">) {
|
|
323
|
+
return <Typography variant="bodyEmphasized" as="h5" {...props} />;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* H6 heading component
|
|
328
|
+
*
|
|
329
|
+
* @example
|
|
330
|
+
* ```tsx
|
|
331
|
+
* <H6>Smallest Heading</H6>
|
|
332
|
+
* ```
|
|
333
|
+
*/
|
|
334
|
+
export function H6(props: Omit<TypographyProps, "as" | "variant">) {
|
|
335
|
+
return <Typography variant="details" as="h6" {...props} />;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Paragraph component for body text
|
|
340
|
+
*
|
|
341
|
+
* @example
|
|
342
|
+
* ```tsx
|
|
343
|
+
* <P>Standard paragraph text content.</P>
|
|
344
|
+
* <P color="muted">Secondary paragraph text.</P>
|
|
345
|
+
* <P className="mb-4">Paragraph with custom margin.</P>
|
|
346
|
+
* ```
|
|
347
|
+
*/
|
|
348
|
+
export function P(props: Omit<TypographyProps, "as" | "variant">) {
|
|
349
|
+
return <Typography variant="body" as="p" {...props} />;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Span component for inline text
|
|
354
|
+
*
|
|
355
|
+
* @example
|
|
356
|
+
* ```tsx
|
|
357
|
+
* <span>Regular text with <Span color="accent">highlighted</Span> content</span>
|
|
358
|
+
* <Span variant="details">Small inline text</Span>
|
|
359
|
+
* ```
|
|
360
|
+
*/
|
|
361
|
+
export function Span(props: Omit<TypographyProps, "as">) {
|
|
362
|
+
return <Typography as="span" {...props} />;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Code component for inline code snippets
|
|
367
|
+
*
|
|
368
|
+
* @example
|
|
369
|
+
* ```tsx
|
|
370
|
+
* <Code>const hello = "world";</Code>
|
|
371
|
+
* <Code color="muted">npm install</Code>
|
|
372
|
+
* ```
|
|
373
|
+
*/
|
|
374
|
+
export function Code(props: Omit<TypographyProps, "as" | "variant">) {
|
|
375
|
+
return <Typography variant="code" as="code" {...props} />;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Small component for fine print and microcopy
|
|
381
|
+
*
|
|
382
|
+
* @example
|
|
383
|
+
* ```tsx
|
|
384
|
+
* <Small>Terms and conditions apply</Small>
|
|
385
|
+
* <Small color="muted">Updated 2 minutes ago</Small>
|
|
386
|
+
* ```
|
|
387
|
+
*/
|
|
388
|
+
export function Small(props: Omit<TypographyProps, "as" | "variant">) {
|
|
389
|
+
return <Typography variant="microcopy" as="small" {...props} />;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Strong component for emphasized text
|
|
394
|
+
*
|
|
395
|
+
* @example
|
|
396
|
+
* ```tsx
|
|
397
|
+
* <Strong>Important information</Strong>
|
|
398
|
+
* <Strong color="destructive">Critical warning</Strong>
|
|
399
|
+
* ```
|
|
400
|
+
*/
|
|
401
|
+
export function Strong(props: Omit<TypographyProps, "as" | "variant">) {
|
|
402
|
+
return <Typography variant="bodyEmphasized" as="strong" {...props} />;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Lead component for introductory text
|
|
407
|
+
*
|
|
408
|
+
* @example
|
|
409
|
+
* ```tsx
|
|
410
|
+
* <Lead>This is the introduction to the article...</Lead>
|
|
411
|
+
* ```
|
|
412
|
+
*/
|
|
413
|
+
export function Lead(props: Omit<TypographyProps, "as" | "variant">) {
|
|
414
|
+
return <Typography variant="subheading" as="p" color="muted" {...props} />;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Anchor/Link component for interactive text links
|
|
419
|
+
*
|
|
420
|
+
* @example
|
|
421
|
+
* ```tsx
|
|
422
|
+
* <A href="https://example.com">Visit our website</A>
|
|
423
|
+
* <A href="/about" color="accent">Learn more</A>
|
|
424
|
+
* <A asChild><Link href="/about">Learn more</Link></A>
|
|
425
|
+
* ```
|
|
426
|
+
*/
|
|
427
|
+
export function A({
|
|
428
|
+
href,
|
|
429
|
+
asChild = false,
|
|
430
|
+
className,
|
|
431
|
+
...props
|
|
432
|
+
}: Omit<TypographyProps, "as" | "variant"> & React.AnchorHTMLAttributes<HTMLAnchorElement>) {
|
|
433
|
+
return (
|
|
434
|
+
<Typography
|
|
435
|
+
variant="body"
|
|
436
|
+
as={asChild ? undefined : "a"}
|
|
437
|
+
asChild={asChild}
|
|
438
|
+
className={cn("underline underline-offset-2 hover:text-primary transition-colors", className)}
|
|
439
|
+
{...(href ? { href } : {})}
|
|
440
|
+
{...props}
|
|
441
|
+
/>
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Blockquote component for quoted text
|
|
447
|
+
*
|
|
448
|
+
* @example
|
|
449
|
+
* ```tsx
|
|
450
|
+
* <Blockquote>"The best way to predict the future is to invent it."</Blockquote>
|
|
451
|
+
* ```
|
|
452
|
+
*/
|
|
453
|
+
export function Blockquote(props: Omit<TypographyProps, "as" | "variant">) {
|
|
454
|
+
return (
|
|
455
|
+
<Typography
|
|
456
|
+
variant="body"
|
|
457
|
+
as="blockquote"
|
|
458
|
+
italic
|
|
459
|
+
className="border-l-4 border-border pl-4"
|
|
460
|
+
{...props}
|
|
461
|
+
/>
|
|
462
|
+
);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Type export for external use
|
|
467
|
+
*/
|
|
468
|
+
export type { VariantProps as TypographyVariantProps } from "class-variance-authority";
|