@regardio/react 0.3.2
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 +9 -0
- package/README.md +133 -0
- package/dist/components/background-slideshow.d.ts +22 -0
- package/dist/components/background-slideshow.d.ts.map +1 -0
- package/dist/components/background-slideshow.js +76 -0
- package/dist/components/blurry-gradient.d.ts +9 -0
- package/dist/components/blurry-gradient.d.ts.map +1 -0
- package/dist/components/blurry-gradient.js +6 -0
- package/dist/components/box.d.ts +17 -0
- package/dist/components/box.d.ts.map +1 -0
- package/dist/components/box.js +25 -0
- package/dist/components/carousel.d.ts +26 -0
- package/dist/components/carousel.d.ts.map +1 -0
- package/dist/components/carousel.js +87 -0
- package/dist/components/countdown.d.ts +2 -0
- package/dist/components/countdown.d.ts.map +1 -0
- package/dist/components/countdown.js +48 -0
- package/dist/components/definition-list.d.ts +40 -0
- package/dist/components/definition-list.d.ts.map +1 -0
- package/dist/components/definition-list.js +57 -0
- package/dist/components/generic-error.d.ts +23 -0
- package/dist/components/generic-error.d.ts.map +1 -0
- package/dist/components/generic-error.js +39 -0
- package/dist/components/heading.d.ts +24 -0
- package/dist/components/heading.d.ts.map +1 -0
- package/dist/components/heading.js +29 -0
- package/dist/components/highlight.d.ts +16 -0
- package/dist/components/highlight.d.ts.map +1 -0
- package/dist/components/highlight.js +19 -0
- package/dist/components/icon-button.d.ts +6 -0
- package/dist/components/icon-button.d.ts.map +1 -0
- package/dist/components/icon-button.js +6 -0
- package/dist/components/if.d.ts +8 -0
- package/dist/components/if.d.ts.map +1 -0
- package/dist/components/if.js +16 -0
- package/dist/components/iframe.d.ts +8 -0
- package/dist/components/iframe.d.ts.map +1 -0
- package/dist/components/iframe.js +3 -0
- package/dist/components/item.d.ts +67 -0
- package/dist/components/item.d.ts.map +1 -0
- package/dist/components/item.js +309 -0
- package/dist/components/leaflet-map.d.ts +33 -0
- package/dist/components/leaflet-map.d.ts.map +1 -0
- package/dist/components/leaflet-map.js +195 -0
- package/dist/components/link.d.ts +41 -0
- package/dist/components/link.d.ts.map +1 -0
- package/dist/components/link.js +111 -0
- package/dist/components/link.test.d.ts +2 -0
- package/dist/components/link.test.d.ts.map +1 -0
- package/dist/components/link.test.js +204 -0
- package/dist/components/list-item.d.ts +16 -0
- package/dist/components/list-item.d.ts.map +1 -0
- package/dist/components/list-item.js +19 -0
- package/dist/components/maptiler-map.d.ts +26 -0
- package/dist/components/maptiler-map.d.ts.map +1 -0
- package/dist/components/maptiler-map.js +116 -0
- package/dist/components/markdown-container.d.ts +20 -0
- package/dist/components/markdown-container.d.ts.map +1 -0
- package/dist/components/markdown-container.js +93 -0
- package/dist/components/password-input.d.ts +9 -0
- package/dist/components/password-input.d.ts.map +1 -0
- package/dist/components/password-input.js +13 -0
- package/dist/components/picture.d.ts +26 -0
- package/dist/components/picture.d.ts.map +1 -0
- package/dist/components/picture.js +36 -0
- package/dist/components/protected-email.d.ts +9 -0
- package/dist/components/protected-email.d.ts.map +1 -0
- package/dist/components/protected-email.js +16 -0
- package/dist/components/text.d.ts +17 -0
- package/dist/components/text.d.ts.map +1 -0
- package/dist/components/text.js +27 -0
- package/dist/components/unordered-list.d.ts +16 -0
- package/dist/components/unordered-list.d.ts.map +1 -0
- package/dist/components/unordered-list.js +21 -0
- package/dist/hooks/use-current-route-data.d.ts +2 -0
- package/dist/hooks/use-current-route-data.d.ts.map +1 -0
- package/dist/hooks/use-current-route-data.js +12 -0
- package/dist/hooks/use-focus-search.d.ts +3 -0
- package/dist/hooks/use-focus-search.d.ts.map +1 -0
- package/dist/hooks/use-focus-search.js +15 -0
- package/dist/hooks/use-matches-data.d.ts +2 -0
- package/dist/hooks/use-matches-data.d.ts.map +1 -0
- package/dist/hooks/use-matches-data.js +11 -0
- package/dist/hooks/use-media-query.d.ts +2 -0
- package/dist/hooks/use-media-query.d.ts.map +1 -0
- package/dist/hooks/use-media-query.js +16 -0
- package/dist/hooks/use-mobile.d.ts +2 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/hooks/use-mobile.js +15 -0
- package/dist/hooks/use-nonce.d.ts +5 -0
- package/dist/hooks/use-nonce.d.ts.map +1 -0
- package/dist/hooks/use-nonce.js +9 -0
- package/dist/hooks/use-nonce.test.d.ts +2 -0
- package/dist/hooks/use-nonce.test.d.ts.map +1 -0
- package/dist/hooks/use-nonce.test.js +27 -0
- package/dist/hooks/use-orientation.d.ts +3 -0
- package/dist/hooks/use-orientation.d.ts.map +1 -0
- package/dist/hooks/use-orientation.js +25 -0
- package/dist/hooks/use-user.d.ts +15 -0
- package/dist/hooks/use-user.d.ts.map +1 -0
- package/dist/hooks/use-user.js +17 -0
- package/dist/shadcn/accordion.d.ts +25 -0
- package/dist/shadcn/accordion.d.ts.map +1 -0
- package/dist/shadcn/accordion.js +45 -0
- package/dist/shadcn/alert-dialog.d.ts +73 -0
- package/dist/shadcn/alert-dialog.d.ts.map +1 -0
- package/dist/shadcn/alert-dialog.js +93 -0
- package/dist/shadcn/alert.d.ts +34 -0
- package/dist/shadcn/alert.d.ts.map +1 -0
- package/dist/shadcn/alert.js +42 -0
- package/dist/shadcn/aspect-ratio.d.ts +6 -0
- package/dist/shadcn/aspect-ratio.d.ts.map +1 -0
- package/dist/shadcn/aspect-ratio.js +7 -0
- package/dist/shadcn/avatar.d.ts +16 -0
- package/dist/shadcn/avatar.d.ts.map +1 -0
- package/dist/shadcn/avatar.js +27 -0
- package/dist/shadcn/badge.d.ts +29 -0
- package/dist/shadcn/badge.d.ts.map +1 -0
- package/dist/shadcn/badge.js +29 -0
- package/dist/shadcn/breadcrumb.d.ts +42 -0
- package/dist/shadcn/breadcrumb.d.ts.map +1 -0
- package/dist/shadcn/breadcrumb.js +74 -0
- package/dist/shadcn/button.d.ts +38 -0
- package/dist/shadcn/button.d.ts.map +1 -0
- package/dist/shadcn/button.js +38 -0
- package/dist/shadcn/calendar.d.ts +23 -0
- package/dist/shadcn/calendar.d.ts.map +1 -0
- package/dist/shadcn/calendar.js +163 -0
- package/dist/shadcn/card.d.ts +31 -0
- package/dist/shadcn/card.d.ts.map +1 -0
- package/dist/shadcn/card.js +55 -0
- package/dist/shadcn/carousel.d.ts +51 -0
- package/dist/shadcn/carousel.d.ts.map +1 -0
- package/dist/shadcn/carousel.js +161 -0
- package/dist/shadcn/chart.d.ts +103 -0
- package/dist/shadcn/chart.d.ts.map +1 -0
- package/dist/shadcn/chart.js +248 -0
- package/dist/shadcn/checkbox.d.ts +8 -0
- package/dist/shadcn/checkbox.d.ts.map +1 -0
- package/dist/shadcn/checkbox.js +22 -0
- package/dist/shadcn/collapsible.d.ts +16 -0
- package/dist/shadcn/collapsible.d.ts.map +1 -0
- package/dist/shadcn/collapsible.js +19 -0
- package/dist/shadcn/command.d.ts +61 -0
- package/dist/shadcn/command.d.ts.map +1 -0
- package/dist/shadcn/command.js +123 -0
- package/dist/shadcn/context-menu.d.ts +107 -0
- package/dist/shadcn/context-menu.d.ts.map +1 -0
- package/dist/shadcn/context-menu.js +151 -0
- package/dist/shadcn/dialog.d.ts +57 -0
- package/dist/shadcn/dialog.d.ts.map +1 -0
- package/dist/shadcn/dialog.js +96 -0
- package/dist/shadcn/drawer.d.ts +54 -0
- package/dist/shadcn/drawer.d.ts.map +1 -0
- package/dist/shadcn/drawer.js +96 -0
- package/dist/shadcn/dropdown-menu.d.ts +110 -0
- package/dist/shadcn/dropdown-menu.d.ts.map +1 -0
- package/dist/shadcn/dropdown-menu.js +152 -0
- package/dist/shadcn/form.d.ts +59 -0
- package/dist/shadcn/form.d.ts.map +1 -0
- package/dist/shadcn/form.js +99 -0
- package/dist/shadcn/hover-card.d.ts +20 -0
- package/dist/shadcn/hover-card.d.ts.map +1 -0
- package/dist/shadcn/hover-card.js +26 -0
- package/dist/shadcn/input-otp.d.ts +25 -0
- package/dist/shadcn/input-otp.d.ts.map +1 -0
- package/dist/shadcn/input-otp.js +54 -0
- package/dist/shadcn/input.d.ts +14 -0
- package/dist/shadcn/input.d.ts.map +1 -0
- package/dist/shadcn/input.js +48 -0
- package/dist/shadcn/label.d.ts +8 -0
- package/dist/shadcn/label.d.ts.map +1 -0
- package/dist/shadcn/label.js +16 -0
- package/dist/shadcn/menubar.d.ts +108 -0
- package/dist/shadcn/menubar.d.ts.map +1 -0
- package/dist/shadcn/menubar.js +174 -0
- package/dist/shadcn/navigation-menu.d.ts +79 -0
- package/dist/shadcn/navigation-menu.d.ts.map +1 -0
- package/dist/shadcn/navigation-menu.js +108 -0
- package/dist/shadcn/pagination.d.ts +45 -0
- package/dist/shadcn/pagination.d.ts.map +1 -0
- package/dist/shadcn/pagination.js +83 -0
- package/dist/shadcn/popover.d.ts +19 -0
- package/dist/shadcn/popover.d.ts.map +1 -0
- package/dist/shadcn/popover.js +29 -0
- package/dist/shadcn/progress.d.ts +9 -0
- package/dist/shadcn/progress.d.ts.map +1 -0
- package/dist/shadcn/progress.js +17 -0
- package/dist/shadcn/radio-group.d.ts +12 -0
- package/dist/shadcn/radio-group.d.ts.map +1 -0
- package/dist/shadcn/radio-group.js +32 -0
- package/dist/shadcn/resizable.d.ts +20 -0
- package/dist/shadcn/resizable.d.ts.map +1 -0
- package/dist/shadcn/resizable.js +32 -0
- package/dist/shadcn/scroll-area.d.ts +16 -0
- package/dist/shadcn/scroll-area.d.ts.map +1 -0
- package/dist/shadcn/scroll-area.js +40 -0
- package/dist/shadcn/select.d.ts +63 -0
- package/dist/shadcn/select.d.ts.map +1 -0
- package/dist/shadcn/select.js +120 -0
- package/dist/shadcn/separator.d.ts +10 -0
- package/dist/shadcn/separator.d.ts.map +1 -0
- package/dist/shadcn/separator.js +18 -0
- package/dist/shadcn/sheet.d.ts +48 -0
- package/dist/shadcn/sheet.d.ts.map +1 -0
- package/dist/shadcn/sheet.js +99 -0
- package/dist/shadcn/sidebar.d.ts +200 -0
- package/dist/shadcn/sidebar.d.ts.map +1 -0
- package/dist/shadcn/sidebar.js +528 -0
- package/dist/shadcn/skeleton.d.ts +6 -0
- package/dist/shadcn/skeleton.d.ts.map +1 -0
- package/dist/shadcn/skeleton.js +11 -0
- package/dist/shadcn/slider.d.ts +12 -0
- package/dist/shadcn/slider.d.ts.map +1 -0
- package/dist/shadcn/slider.js +50 -0
- package/dist/shadcn/sonner.d.ts +7 -0
- package/dist/shadcn/sonner.d.ts.map +1 -0
- package/dist/shadcn/sonner.js +20 -0
- package/dist/shadcn/switch.d.ts +8 -0
- package/dist/shadcn/switch.d.ts.map +1 -0
- package/dist/shadcn/switch.js +22 -0
- package/dist/shadcn/table.d.ts +35 -0
- package/dist/shadcn/table.d.ts.map +1 -0
- package/dist/shadcn/table.js +73 -0
- package/dist/shadcn/tabs.d.ts +20 -0
- package/dist/shadcn/tabs.d.ts.map +1 -0
- package/dist/shadcn/tabs.js +40 -0
- package/dist/shadcn/textarea.d.ts +7 -0
- package/dist/shadcn/textarea.d.ts.map +1 -0
- package/dist/shadcn/textarea.js +14 -0
- package/dist/shadcn/toggle-group.d.ts +22 -0
- package/dist/shadcn/toggle-group.d.ts.map +1 -0
- package/dist/shadcn/toggle-group.js +43 -0
- package/dist/shadcn/toggle.d.ts +29 -0
- package/dist/shadcn/toggle.d.ts.map +1 -0
- package/dist/shadcn/toggle.js +31 -0
- package/dist/shadcn/tooltip.d.ts +20 -0
- package/dist/shadcn/tooltip.d.ts.map +1 -0
- package/dist/shadcn/tooltip.js +40 -0
- package/dist/stories/BackgroundSlideshow.stories.d.ts +9 -0
- package/dist/stories/BackgroundSlideshow.stories.d.ts.map +1 -0
- package/dist/stories/BackgroundSlideshow.stories.js +60 -0
- package/dist/stories/BlurryGradient.stories.d.ts +11 -0
- package/dist/stories/BlurryGradient.stories.d.ts.map +1 -0
- package/dist/stories/BlurryGradient.stories.js +53 -0
- package/dist/stories/Box.stories.d.ts +13 -0
- package/dist/stories/Box.stories.d.ts.map +1 -0
- package/dist/stories/Box.stories.js +50 -0
- package/dist/stories/Carousel.stories.d.ts +9 -0
- package/dist/stories/Carousel.stories.d.ts.map +1 -0
- package/dist/stories/Carousel.stories.js +30 -0
- package/dist/stories/Countdown.stories.d.ts +7 -0
- package/dist/stories/Countdown.stories.d.ts.map +1 -0
- package/dist/stories/Countdown.stories.js +11 -0
- package/dist/stories/DefinitionList.stories.d.ts +9 -0
- package/dist/stories/DefinitionList.stories.d.ts.map +1 -0
- package/dist/stories/DefinitionList.stories.js +20 -0
- package/dist/stories/GenericError.stories.d.ts +9 -0
- package/dist/stories/GenericError.stories.d.ts.map +1 -0
- package/dist/stories/GenericError.stories.js +39 -0
- package/dist/stories/Heading.stories.d.ts +15 -0
- package/dist/stories/Heading.stories.d.ts.map +1 -0
- package/dist/stories/Heading.stories.js +61 -0
- package/dist/stories/Highlight.stories.d.ts +8 -0
- package/dist/stories/Highlight.stories.d.ts.map +1 -0
- package/dist/stories/Highlight.stories.js +19 -0
- package/dist/stories/IconButton.stories.d.ts +10 -0
- package/dist/stories/IconButton.stories.d.ts.map +1 -0
- package/dist/stories/IconButton.stories.js +32 -0
- package/dist/stories/If.stories.d.ts +13 -0
- package/dist/stories/If.stories.d.ts.map +1 -0
- package/dist/stories/If.stories.js +54 -0
- package/dist/stories/Iframe.stories.d.ts +8 -0
- package/dist/stories/Iframe.stories.d.ts.map +1 -0
- package/dist/stories/Iframe.stories.js +23 -0
- package/dist/stories/Item.stories.d.ts +10 -0
- package/dist/stories/Item.stories.d.ts.map +1 -0
- package/dist/stories/Item.stories.js +32 -0
- package/dist/stories/Link.stories.d.ts +10 -0
- package/dist/stories/Link.stories.d.ts.map +1 -0
- package/dist/stories/Link.stories.js +36 -0
- package/dist/stories/ListItem.stories.d.ts +9 -0
- package/dist/stories/ListItem.stories.d.ts.map +1 -0
- package/dist/stories/ListItem.stories.js +25 -0
- package/dist/stories/MarkdownContainer.stories.d.ts +11 -0
- package/dist/stories/MarkdownContainer.stories.d.ts.map +1 -0
- package/dist/stories/MarkdownContainer.stories.js +66 -0
- package/dist/stories/PasswordInput.stories.d.ts +9 -0
- package/dist/stories/PasswordInput.stories.d.ts.map +1 -0
- package/dist/stories/PasswordInput.stories.js +27 -0
- package/dist/stories/Picture.stories.d.ts +10 -0
- package/dist/stories/Picture.stories.d.ts.map +1 -0
- package/dist/stories/Picture.stories.js +46 -0
- package/dist/stories/ProtectedEmail.stories.d.ts +10 -0
- package/dist/stories/ProtectedEmail.stories.d.ts.map +1 -0
- package/dist/stories/ProtectedEmail.stories.js +34 -0
- package/dist/stories/Text.stories.d.ts +10 -0
- package/dist/stories/Text.stories.d.ts.map +1 -0
- package/dist/stories/Text.stories.js +31 -0
- package/dist/stories/UnorderedList.stories.d.ts +10 -0
- package/dist/stories/UnorderedList.stories.d.ts.map +1 -0
- package/dist/stories/UnorderedList.stories.js +24 -0
- package/dist/test-setup.d.ts +2 -0
- package/dist/test-setup.d.ts.map +1 -0
- package/dist/test-setup.js +1 -0
- package/dist/utils/author.d.ts +9 -0
- package/dist/utils/author.d.ts.map +1 -0
- package/dist/utils/author.js +37 -0
- package/dist/utils/author.test.d.ts +2 -0
- package/dist/utils/author.test.d.ts.map +1 -0
- package/dist/utils/author.test.js +46 -0
- package/dist/utils/cn.d.ts +5 -0
- package/dist/utils/cn.d.ts.map +1 -0
- package/dist/utils/cn.js +10 -0
- package/dist/utils/cn.test.d.ts +2 -0
- package/dist/utils/cn.test.d.ts.map +1 -0
- package/dist/utils/cn.test.js +33 -0
- package/dist/utils/is-route-active.d.ts +3 -0
- package/dist/utils/is-route-active.d.ts.map +1 -0
- package/dist/utils/is-route-active.js +54 -0
- package/dist/utils/is-route-active.test.d.ts +2 -0
- package/dist/utils/is-route-active.test.d.ts.map +1 -0
- package/dist/utils/is-route-active.test.js +61 -0
- package/dist/utils/locale.d.ts +22 -0
- package/dist/utils/locale.d.ts.map +1 -0
- package/dist/utils/locale.js +25 -0
- package/dist/utils/locale.test.d.ts +2 -0
- package/dist/utils/locale.test.d.ts.map +1 -0
- package/dist/utils/locale.test.js +99 -0
- package/dist/utils/text.d.ts +7 -0
- package/dist/utils/text.d.ts.map +1 -0
- package/dist/utils/text.js +102 -0
- package/dist/utils/text.test.d.ts +2 -0
- package/dist/utils/text.test.d.ts.map +1 -0
- package/dist/utils/text.test.js +122 -0
- package/package.json +117 -0
- package/src/components/background-slideshow.tsx +172 -0
- package/src/components/blurry-gradient.tsx +97 -0
- package/src/components/box.tsx +45 -0
- package/src/components/carousel.tsx +197 -0
- package/src/components/countdown.tsx +82 -0
- package/src/components/definition-list.tsx +90 -0
- package/src/components/generic-error.tsx +104 -0
- package/src/components/heading.tsx +60 -0
- package/src/components/highlight.tsx +53 -0
- package/src/components/icon-button.tsx +20 -0
- package/src/components/if.tsx +29 -0
- package/src/components/iframe.tsx +19 -0
- package/src/components/item.tsx +340 -0
- package/src/components/leaflet-map.tsx +294 -0
- package/src/components/link.test.tsx +387 -0
- package/src/components/link.tsx +206 -0
- package/src/components/list-item.tsx +30 -0
- package/src/components/maptiler-map.tsx +181 -0
- package/src/components/markdown-container.tsx +153 -0
- package/src/components/password-input.tsx +49 -0
- package/src/components/picture.tsx +107 -0
- package/src/components/protected-email.tsx +49 -0
- package/src/components/text.tsx +38 -0
- package/src/components/unordered-list.tsx +32 -0
- package/src/hooks/use-current-route-data.ts +18 -0
- package/src/hooks/use-focus-search.ts +20 -0
- package/src/hooks/use-matches-data.ts +19 -0
- package/src/hooks/use-media-query.ts +33 -0
- package/src/hooks/use-mobile.ts +19 -0
- package/src/hooks/use-nonce.test.ts +35 -0
- package/src/hooks/use-nonce.ts +20 -0
- package/src/hooks/use-orientation.ts +48 -0
- package/src/hooks/use-user.tsx +72 -0
- package/src/stories/BackgroundSlideshow.stories.tsx +68 -0
- package/src/stories/BlurryGradient.stories.tsx +62 -0
- package/src/stories/Box.stories.tsx +83 -0
- package/src/stories/Carousel.stories.tsx +95 -0
- package/src/stories/Countdown.stories.tsx +16 -0
- package/src/stories/DefinitionList.stories.tsx +51 -0
- package/src/stories/GenericError.stories.tsx +58 -0
- package/src/stories/Heading.stories.tsx +82 -0
- package/src/stories/Highlight.stories.tsx +28 -0
- package/src/stories/IconButton.stories.tsx +90 -0
- package/src/stories/If.stories.tsx +72 -0
- package/src/stories/Iframe.stories.tsx +29 -0
- package/src/stories/Item.stories.tsx +79 -0
- package/src/stories/Link.stories.tsx +58 -0
- package/src/stories/ListItem.stories.tsx +37 -0
- package/src/stories/MarkdownContainer.stories.tsx +76 -0
- package/src/stories/PasswordInput.stories.tsx +34 -0
- package/src/stories/Picture.stories.tsx +54 -0
- package/src/stories/ProtectedEmail.stories.tsx +57 -0
- package/src/stories/Text.stories.tsx +44 -0
- package/src/stories/UnorderedList.stories.tsx +73 -0
- package/src/styles/storybook.css +1 -0
- package/src/styles/tailwind.css +7 -0
- package/src/test-setup.ts +1 -0
- package/src/utils/author.test.ts +54 -0
- package/src/utils/author.tsx +73 -0
- package/src/utils/cn.test.ts +48 -0
- package/src/utils/cn.ts +14 -0
- package/src/utils/is-route-active.test.ts +80 -0
- package/src/utils/is-route-active.ts +100 -0
- package/src/utils/locale.test.ts +148 -0
- package/src/utils/locale.ts +127 -0
- package/src/utils/text.test.ts +152 -0
- package/src/utils/text.tsx +209 -0
- package/src/vite-env.d.ts +1 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import { isRouteErrorResponse, useRouteError } from 'react-router';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Descriptor returned from getErrorDescriptor to help apps localize messages.
|
|
6
|
+
*/
|
|
7
|
+
export type ErrorDescriptor =
|
|
8
|
+
| {
|
|
9
|
+
type: 'http';
|
|
10
|
+
status: number;
|
|
11
|
+
statusText: string;
|
|
12
|
+
defaultId: string; // e.g. "errors.http"
|
|
13
|
+
defaultMessage: string; // e.g. "Error {status}"
|
|
14
|
+
}
|
|
15
|
+
| {
|
|
16
|
+
type: 'error';
|
|
17
|
+
defaultId: string; // e.g. "errors.runtime"
|
|
18
|
+
defaultMessage: string; // e.g. "An unexpected error occurred."
|
|
19
|
+
message?: string;
|
|
20
|
+
stack?: string;
|
|
21
|
+
}
|
|
22
|
+
| {
|
|
23
|
+
type: 'unknown';
|
|
24
|
+
defaultId: string; // e.g. "errors.unknown"
|
|
25
|
+
defaultMessage: string; // e.g. "An unexpected error occurred."
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Compute a normalized error descriptor from a React Router error.
|
|
30
|
+
* Apps can use this to map to i18n keys.
|
|
31
|
+
*/
|
|
32
|
+
export function getErrorDescriptor(error: unknown): ErrorDescriptor {
|
|
33
|
+
if (isRouteErrorResponse(error)) {
|
|
34
|
+
const status = error.status;
|
|
35
|
+
const statusText = error.statusText || 'Error';
|
|
36
|
+
return {
|
|
37
|
+
defaultId: status === 404 ? 'errors.404' : 'errors.http',
|
|
38
|
+
defaultMessage: status === 404 ? 'Not found' : `Error ${status}`,
|
|
39
|
+
status,
|
|
40
|
+
statusText,
|
|
41
|
+
type: 'http',
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (error instanceof Error) {
|
|
45
|
+
return {
|
|
46
|
+
defaultId: 'errors.runtime',
|
|
47
|
+
defaultMessage: 'An unexpected error occurred.',
|
|
48
|
+
message: error.message,
|
|
49
|
+
type: 'error',
|
|
50
|
+
...(error.stack ? { stack: error.stack } : {}),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
defaultId: 'errors.unknown',
|
|
55
|
+
defaultMessage: 'An unexpected error occurred.',
|
|
56
|
+
type: 'unknown',
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* GenericError
|
|
62
|
+
*
|
|
63
|
+
* A reusable error boundary component for React Router apps.
|
|
64
|
+
* - Displays status-based messages for route responses
|
|
65
|
+
* - Shows stack traces in development for non-response errors
|
|
66
|
+
*
|
|
67
|
+
* For localization, apps may either:
|
|
68
|
+
* - Wrap this component and use `getErrorDescriptor(useRouteError())` to map to i18n keys
|
|
69
|
+
* - Or provide a custom `renderMessage` to override the displayed details
|
|
70
|
+
*/
|
|
71
|
+
export function GenericError({
|
|
72
|
+
renderMessage,
|
|
73
|
+
}: {
|
|
74
|
+
renderMessage?: (descriptor: ErrorDescriptor) => ReactElement;
|
|
75
|
+
} = {}): ReactElement {
|
|
76
|
+
const error = useRouteError();
|
|
77
|
+
const descriptor = getErrorDescriptor(error);
|
|
78
|
+
|
|
79
|
+
const title = descriptor.type === 'http' ? `Error ${descriptor.status}` : 'Error';
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<main className="pt-2xl p-sm container mx-auto">
|
|
83
|
+
<h1>{title}</h1>
|
|
84
|
+
{renderMessage ? (
|
|
85
|
+
renderMessage(descriptor)
|
|
86
|
+
) : (
|
|
87
|
+
<>
|
|
88
|
+
<p>
|
|
89
|
+
{descriptor.type === 'http'
|
|
90
|
+
? descriptor.defaultMessage
|
|
91
|
+
: descriptor.type === 'error'
|
|
92
|
+
? descriptor.message || descriptor.defaultMessage
|
|
93
|
+
: descriptor.defaultMessage}
|
|
94
|
+
</p>
|
|
95
|
+
{import.meta.env.DEV && descriptor.type === 'error' && descriptor.stack && (
|
|
96
|
+
<pre className="w-full p-sm overflow-x-auto">
|
|
97
|
+
<code>{descriptor.stack}</code>
|
|
98
|
+
</pre>
|
|
99
|
+
)}
|
|
100
|
+
</>
|
|
101
|
+
)}
|
|
102
|
+
</main>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { ElementType, HTMLAttributes } from 'react';
|
|
2
|
+
import { cn, cva, type VariantProps } from '../utils/cn';
|
|
3
|
+
import { lowerCaseSzett, shy } from '../utils/text';
|
|
4
|
+
|
|
5
|
+
const heading = cva({
|
|
6
|
+
base: [],
|
|
7
|
+
defaultVariants: {
|
|
8
|
+
level: 3,
|
|
9
|
+
},
|
|
10
|
+
variants: {
|
|
11
|
+
level: {
|
|
12
|
+
1: ['text-2xl'],
|
|
13
|
+
2: ['text-xl'],
|
|
14
|
+
3: ['text-lg'],
|
|
15
|
+
4: ['text-md'],
|
|
16
|
+
5: ['text-sm'],
|
|
17
|
+
6: ['text-xs'],
|
|
18
|
+
},
|
|
19
|
+
variant: {},
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export interface HeadingProps
|
|
24
|
+
extends HTMLAttributes<HTMLHeadingElement>,
|
|
25
|
+
VariantProps<typeof heading> {
|
|
26
|
+
as?: ElementType;
|
|
27
|
+
className?: string;
|
|
28
|
+
locale?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type HeadingLevel = HeadingProps['level'];
|
|
32
|
+
|
|
33
|
+
export const Heading = ({
|
|
34
|
+
as,
|
|
35
|
+
children,
|
|
36
|
+
className,
|
|
37
|
+
level = 2,
|
|
38
|
+
variant,
|
|
39
|
+
...props
|
|
40
|
+
}: HeadingProps) => {
|
|
41
|
+
const word = lowerCaseSzett(shy(children));
|
|
42
|
+
const Component: ElementType = as || `h${level}`;
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<Component
|
|
46
|
+
className={cn(
|
|
47
|
+
heading({
|
|
48
|
+
level,
|
|
49
|
+
variant,
|
|
50
|
+
}),
|
|
51
|
+
className,
|
|
52
|
+
)}
|
|
53
|
+
{...props}
|
|
54
|
+
>
|
|
55
|
+
{word}
|
|
56
|
+
</Component>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
Heading.displayName = 'Heading';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
import { cva, type VariantProps } from '../utils/cn';
|
|
3
|
+
|
|
4
|
+
const li = cva({
|
|
5
|
+
defaultVariants: {
|
|
6
|
+
variant: 'primary',
|
|
7
|
+
},
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
primary: ['highlight'],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export interface HighlightProps extends ComponentProps<'mark'>, VariantProps<typeof li> {}
|
|
16
|
+
|
|
17
|
+
export const Highlight = (props: HighlightProps) => {
|
|
18
|
+
const { children, className, variant } = props;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<mark
|
|
22
|
+
className={li({
|
|
23
|
+
className,
|
|
24
|
+
variant,
|
|
25
|
+
})}
|
|
26
|
+
>
|
|
27
|
+
{children}
|
|
28
|
+
|
|
29
|
+
<svg
|
|
30
|
+
aria-label="!"
|
|
31
|
+
role="img"
|
|
32
|
+
>
|
|
33
|
+
<defs>
|
|
34
|
+
<filter>
|
|
35
|
+
<feTurbulence
|
|
36
|
+
baseFrequency="0 0.2"
|
|
37
|
+
numOctaves="5"
|
|
38
|
+
result="warp"
|
|
39
|
+
type="fractalNoise"
|
|
40
|
+
/>
|
|
41
|
+
<feDisplacementMap
|
|
42
|
+
in="SourceGraphic"
|
|
43
|
+
in2="warp"
|
|
44
|
+
scale="30"
|
|
45
|
+
xChannelSelector="R"
|
|
46
|
+
yChannelSelector="G"
|
|
47
|
+
/>
|
|
48
|
+
</filter>
|
|
49
|
+
</defs>
|
|
50
|
+
</svg>
|
|
51
|
+
</mark>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface IconButtonProps extends ComponentProps<'button'> {
|
|
4
|
+
icon: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const IconButton = (props: IconButtonProps) => {
|
|
8
|
+
const { className, icon } = props;
|
|
9
|
+
|
|
10
|
+
const defaultClassName = 'p-0';
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<button
|
|
14
|
+
className={className ? className : defaultClassName}
|
|
15
|
+
type={'button'}
|
|
16
|
+
>
|
|
17
|
+
{icon}
|
|
18
|
+
</button>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
|
|
3
|
+
type Condition<Value = unknown> = Value | false | null | undefined | 0 | '';
|
|
4
|
+
|
|
5
|
+
export function If<Value = unknown>({
|
|
6
|
+
condition,
|
|
7
|
+
children,
|
|
8
|
+
fallback,
|
|
9
|
+
}: React.PropsWithoutRef<{
|
|
10
|
+
condition: Condition<Value>;
|
|
11
|
+
children: React.ReactNode | ((value: Value) => React.ReactNode);
|
|
12
|
+
fallback?: React.ReactNode;
|
|
13
|
+
}>) {
|
|
14
|
+
return useMemo(() => {
|
|
15
|
+
if (condition) {
|
|
16
|
+
if (typeof children === 'function') {
|
|
17
|
+
return <>{children(condition)}</>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return <>{children}</>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (fallback) {
|
|
24
|
+
return <>{fallback}</>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return null;
|
|
28
|
+
}, [condition, fallback, children]);
|
|
29
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { cn } from '../utils/cn';
|
|
3
|
+
|
|
4
|
+
export type IframeProps = {
|
|
5
|
+
src: string;
|
|
6
|
+
title: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const Iframe: React.FC<IframeProps> = ({ src, title, className }) => (
|
|
11
|
+
<iframe
|
|
12
|
+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
|
13
|
+
allowFullScreen
|
|
14
|
+
className={cn('w-full aspect-video border-0', className)}
|
|
15
|
+
loading="lazy"
|
|
16
|
+
src={src}
|
|
17
|
+
title={title}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import type { ComponentProps, ElementType } from 'react';
|
|
2
|
+
import { cva, type VariantProps } from '../utils/cn';
|
|
3
|
+
import { Link } from './link';
|
|
4
|
+
|
|
5
|
+
export const priorities = {
|
|
6
|
+
high: [],
|
|
7
|
+
low: [],
|
|
8
|
+
medium: [],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const paddingValues = {
|
|
12
|
+
default: '',
|
|
13
|
+
gutter: 'p-grid-gutter',
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const width = {
|
|
17
|
+
full: ['col-span-12'],
|
|
18
|
+
lg: ['col-span-12', '@xs:col-span-8', '@md:col-span-8', '@xl:col-span-8'],
|
|
19
|
+
md: ['col-span-12', '@xs:col-span-6', '@md:col-span-6', '@xl:col-span-6'],
|
|
20
|
+
sm: ['col-span-6', '@xs:col-span-6', '@md:col-span-4', '@xl:col-span-4'],
|
|
21
|
+
xl: ['col-span-12', '@xs:col-span-8', '@md:col-span-9', '@xl:col-span-10'],
|
|
22
|
+
xs: ['col-span-6', '@xs:col-span-4', '@md:col-span-3', '@xl:col-span-2'],
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const height = {
|
|
26
|
+
1: ['row-span-1'],
|
|
27
|
+
2: ['row-span-2'],
|
|
28
|
+
3: ['row-span-3'],
|
|
29
|
+
4: ['row-span-4'],
|
|
30
|
+
5: ['row-span-5'],
|
|
31
|
+
6: ['row-span-6'],
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const themeColors = {
|
|
35
|
+
black: [],
|
|
36
|
+
blue: [],
|
|
37
|
+
coral: [],
|
|
38
|
+
cyan: [],
|
|
39
|
+
gray: [],
|
|
40
|
+
green: [],
|
|
41
|
+
lime: [],
|
|
42
|
+
neutral: [],
|
|
43
|
+
olive: [],
|
|
44
|
+
orange: [],
|
|
45
|
+
pink: [],
|
|
46
|
+
purple: [],
|
|
47
|
+
red: [],
|
|
48
|
+
teal: [],
|
|
49
|
+
unstyled: [],
|
|
50
|
+
white: [],
|
|
51
|
+
yellow: [],
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const item = cva({
|
|
55
|
+
base: ['relative'],
|
|
56
|
+
compoundVariants: [
|
|
57
|
+
{
|
|
58
|
+
className: ['bg-gray-300/20', 'black:bg-black/20'],
|
|
59
|
+
priority: 'low',
|
|
60
|
+
themeColor: 'black',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
className: ['bg-gray-300/50', 'black:bg-black/50'],
|
|
64
|
+
priority: 'medium',
|
|
65
|
+
themeColor: 'black',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
className: ['bg-gray-300/90', 'black:bg-black/90'],
|
|
69
|
+
priority: 'high',
|
|
70
|
+
themeColor: 'black',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
className: ['bg-blue-300/20', 'black:bg-blue-500/20'],
|
|
74
|
+
priority: 'low',
|
|
75
|
+
themeColor: 'blue',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
className: ['bg-blue-300/50', 'black:bg-blue-500/50'],
|
|
79
|
+
priority: 'medium',
|
|
80
|
+
themeColor: 'blue',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
className: ['bg-blue-300/90', 'black:bg-blue-500/80'],
|
|
84
|
+
priority: 'high',
|
|
85
|
+
themeColor: 'blue',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
className: ['bg-coral-300/20', 'black:bg-coral-500/20'],
|
|
89
|
+
priority: 'low',
|
|
90
|
+
themeColor: 'coral',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
className: ['bg-coral-300/50', 'black:bg-coral-500/50'],
|
|
94
|
+
priority: 'medium',
|
|
95
|
+
themeColor: 'coral',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
className: ['bg-coral-300/90', 'black:bg-coral-500/80'],
|
|
99
|
+
priority: 'high',
|
|
100
|
+
themeColor: 'coral',
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
className: ['bg-cyan-300/20', 'black:bg-cyan-500/20'],
|
|
104
|
+
priority: 'low',
|
|
105
|
+
themeColor: 'cyan',
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
className: ['bg-cyan-300/50', 'black:bg-cyan-500/50'],
|
|
109
|
+
priority: 'medium',
|
|
110
|
+
themeColor: 'cyan',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
className: ['bg-cyan-300/90', 'black:bg-cyan-500/80'],
|
|
114
|
+
priority: 'high',
|
|
115
|
+
themeColor: 'cyan',
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
className: ['bg-green-300/20', 'black:bg-green-500/20'],
|
|
119
|
+
priority: 'low',
|
|
120
|
+
themeColor: 'green',
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
className: ['bg-green-300/50', 'black:bg-green-500/50'],
|
|
124
|
+
priority: 'medium',
|
|
125
|
+
themeColor: 'green',
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
className: ['bg-green-300/90', 'black:bg-green-500/80'],
|
|
129
|
+
priority: 'high',
|
|
130
|
+
themeColor: 'green',
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
className: ['bg-lime-300/20', 'black:bg-lime-500/20'],
|
|
134
|
+
priority: 'low',
|
|
135
|
+
themeColor: 'lime',
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
className: ['bg-lime-300/50', 'black:bg-lime-500/50'],
|
|
139
|
+
priority: 'medium',
|
|
140
|
+
themeColor: 'lime',
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
className: ['bg-lime-300/90', 'black:bg-lime-500/80'],
|
|
144
|
+
priority: 'high',
|
|
145
|
+
themeColor: 'lime',
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
className: ['bg-gray-100/40', 'black:bg-gray-500/5'],
|
|
149
|
+
priority: 'low',
|
|
150
|
+
themeColor: 'neutral',
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
className: ['bg-gray-200/30', 'black:bg-gray-500/20'],
|
|
154
|
+
priority: 'medium',
|
|
155
|
+
themeColor: 'neutral',
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
className: ['bg-gray-300/70', 'black:bg-gray-500/50'],
|
|
159
|
+
priority: 'high',
|
|
160
|
+
themeColor: 'neutral',
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
className: ['bg-olive-300/20', 'black:bg-olive-500/20'],
|
|
164
|
+
priority: 'low',
|
|
165
|
+
themeColor: 'olive',
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
className: ['bg-olive-300/50', 'black:bg-olive-500/50'],
|
|
169
|
+
priority: 'medium',
|
|
170
|
+
themeColor: 'olive',
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
className: ['bg-olive-300/90', 'black:bg-olive-500/80'],
|
|
174
|
+
priority: 'high',
|
|
175
|
+
themeColor: 'olive',
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
className: ['bg-orange-300/20', 'black:bg-orange-500/20'],
|
|
179
|
+
priority: 'low',
|
|
180
|
+
themeColor: 'orange',
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
className: ['bg-orange-300/50', 'black:bg-orange-500/50'],
|
|
184
|
+
priority: 'medium',
|
|
185
|
+
themeColor: 'orange',
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
className: ['bg-orange-300/90', 'black:bg-orange-500/80'],
|
|
189
|
+
priority: 'high',
|
|
190
|
+
themeColor: 'orange',
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
className: ['bg-pink-300/20', 'black:bg-pink-500/20'],
|
|
194
|
+
priority: 'low',
|
|
195
|
+
themeColor: 'pink',
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
className: ['bg-pink-300/50', 'black:bg-pink-500/50'],
|
|
199
|
+
priority: 'medium',
|
|
200
|
+
themeColor: 'pink',
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
className: ['bg-pink-300/90', 'black:bg-pink-500/80'],
|
|
204
|
+
priority: 'high',
|
|
205
|
+
themeColor: 'pink',
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
className: ['bg-purple-300/20', 'black:bg-purple-500/20'],
|
|
209
|
+
priority: 'low',
|
|
210
|
+
themeColor: 'purple',
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
className: ['bg-purple-300/50', 'black:bg-purple-500/50'],
|
|
214
|
+
priority: 'medium',
|
|
215
|
+
themeColor: 'purple',
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
className: ['bg-purple-300/90', 'black:bg-purple-500/80'],
|
|
219
|
+
priority: 'high',
|
|
220
|
+
themeColor: 'purple',
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
className: ['bg-red-300/20', 'black:bg-red-500/20'],
|
|
224
|
+
priority: 'low',
|
|
225
|
+
themeColor: 'red',
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
className: ['bg-red-300/50', 'black:bg-red-500/50'],
|
|
229
|
+
priority: 'medium',
|
|
230
|
+
themeColor: 'red',
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
className: ['bg-red-300/90', 'black:bg-red-500/80'],
|
|
234
|
+
priority: 'high',
|
|
235
|
+
themeColor: 'red',
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
className: ['bg-teal-300/20', 'black:bg-teal-500/20'],
|
|
239
|
+
priority: 'low',
|
|
240
|
+
themeColor: 'teal',
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
className: ['bg-teal-300/50', 'black:bg-teal-500/50'],
|
|
244
|
+
priority: 'medium',
|
|
245
|
+
themeColor: 'teal',
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
className: ['bg-teal-300/90', 'black:bg-teal-500/80'],
|
|
249
|
+
priority: 'high',
|
|
250
|
+
themeColor: 'teal',
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
className: ['bg-yellow-300/20', 'black:bg-yellow-500/20'],
|
|
254
|
+
priority: 'low',
|
|
255
|
+
themeColor: 'yellow',
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
className: ['bg-yellow-300/50', 'black:bg-yellow-500/50'],
|
|
259
|
+
priority: 'medium',
|
|
260
|
+
themeColor: 'yellow',
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
className: ['bg-yellow-300/90', 'black:bg-yellow-500/80'],
|
|
264
|
+
priority: 'high',
|
|
265
|
+
themeColor: 'yellow',
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
className: ['bg-white/20', 'black:bg-white/20'],
|
|
269
|
+
priority: 'low',
|
|
270
|
+
themeColor: 'white',
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
className: ['bg-white/50', 'black:bg-white/50', 'black:text-black'],
|
|
274
|
+
priority: 'medium',
|
|
275
|
+
themeColor: 'white',
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
className: ['bg-white/90', 'black:bg-white/80', 'black:text-black'],
|
|
279
|
+
priority: 'high',
|
|
280
|
+
themeColor: 'white',
|
|
281
|
+
},
|
|
282
|
+
],
|
|
283
|
+
defaultVariants: {
|
|
284
|
+
height: 1,
|
|
285
|
+
padding: 'default',
|
|
286
|
+
priority: 'medium',
|
|
287
|
+
themeColor: 'unstyled',
|
|
288
|
+
variant: 'primary',
|
|
289
|
+
width: 'full',
|
|
290
|
+
},
|
|
291
|
+
variants: {
|
|
292
|
+
height: height,
|
|
293
|
+
padding: paddingValues,
|
|
294
|
+
priority: priorities,
|
|
295
|
+
themeColor: themeColors,
|
|
296
|
+
variant: {
|
|
297
|
+
primary: [],
|
|
298
|
+
reset: ['bg-transparent', 'rounded-none'],
|
|
299
|
+
spacer: ['hidden'],
|
|
300
|
+
unstyled: [],
|
|
301
|
+
},
|
|
302
|
+
width: width,
|
|
303
|
+
},
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
export interface ItemProps extends ComponentProps<'div'>, VariantProps<typeof item> {
|
|
307
|
+
as?: ElementType;
|
|
308
|
+
link?: string;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
export const Item = ({
|
|
312
|
+
as: Component = 'div',
|
|
313
|
+
children,
|
|
314
|
+
className,
|
|
315
|
+
height,
|
|
316
|
+
link,
|
|
317
|
+
padding,
|
|
318
|
+
priority,
|
|
319
|
+
themeColor,
|
|
320
|
+
variant,
|
|
321
|
+
width,
|
|
322
|
+
...props
|
|
323
|
+
}: ItemProps) => {
|
|
324
|
+
return (
|
|
325
|
+
<Component
|
|
326
|
+
className={item({
|
|
327
|
+
className,
|
|
328
|
+
height,
|
|
329
|
+
padding,
|
|
330
|
+
priority,
|
|
331
|
+
themeColor,
|
|
332
|
+
variant,
|
|
333
|
+
width,
|
|
334
|
+
})}
|
|
335
|
+
{...props}
|
|
336
|
+
>
|
|
337
|
+
{link ? <Link to={link}>{children}</Link> : children}
|
|
338
|
+
</Component>
|
|
339
|
+
);
|
|
340
|
+
};
|