@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,66 @@
|
|
|
1
|
+
import { MarkdownContainer } from '../components/markdown-container';
|
|
2
|
+
const meta = {
|
|
3
|
+
component: MarkdownContainer,
|
|
4
|
+
parameters: {
|
|
5
|
+
layout: 'padded',
|
|
6
|
+
},
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
title: 'Components/MarkdownContainer',
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
export const Default = {
|
|
12
|
+
args: {
|
|
13
|
+
children: `# Hello World
|
|
14
|
+
|
|
15
|
+
This is a **markdown** paragraph with *italic* text.
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
- List item 1
|
|
20
|
+
- List item 2
|
|
21
|
+
- List item 3
|
|
22
|
+
|
|
23
|
+
[Link to example](https://example.com)`,
|
|
24
|
+
locale: 'en',
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
export const GermanLocale = {
|
|
28
|
+
args: {
|
|
29
|
+
children: `# Willkommen
|
|
30
|
+
|
|
31
|
+
Dies ist ein "Beispieltext" mit typografischen Anführungszeichen.
|
|
32
|
+
|
|
33
|
+
## Funktionen
|
|
34
|
+
|
|
35
|
+
- Punkt 1
|
|
36
|
+
- Punkt 2`,
|
|
37
|
+
locale: 'de',
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
export const WithTruncation = {
|
|
41
|
+
args: {
|
|
42
|
+
children: 'This is a long paragraph that will be truncated. It contains multiple sentences. Each sentence adds more content. The truncation should work properly.',
|
|
43
|
+
locale: 'en',
|
|
44
|
+
sentences: 2,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
export const WithParagraphLimit = {
|
|
48
|
+
args: {
|
|
49
|
+
children: `First paragraph with some content.
|
|
50
|
+
|
|
51
|
+
Second paragraph with more content.
|
|
52
|
+
|
|
53
|
+
Third paragraph that should be hidden.
|
|
54
|
+
|
|
55
|
+
Fourth paragraph also hidden.`,
|
|
56
|
+
locale: 'en',
|
|
57
|
+
paragraphs: 2,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
export const WithCharacterLimit = {
|
|
61
|
+
args: {
|
|
62
|
+
characters: 50,
|
|
63
|
+
children: 'This is a long text that will be truncated after a certain number of characters.',
|
|
64
|
+
locale: 'en',
|
|
65
|
+
},
|
|
66
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { PasswordInput } from "../components/password-input";
|
|
3
|
+
declare const meta: Meta<typeof PasswordInput>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof PasswordInput>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithValue: Story;
|
|
8
|
+
export declare const WithCustomClass: Story;
|
|
9
|
+
//# sourceMappingURL=PasswordInput.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PasswordInput.stories.d.ts","sourceRoot":"","sources":["../../src/stories/PasswordInput.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,aAAa,CAOpC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,aAAa,CAAC,CAAC;AAE5C,eAAO,MAAM,OAAO,EAAE,KAIrB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAKvB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAK7B,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { PasswordInput } from "../components/password-input";
|
|
2
|
+
const meta = {
|
|
3
|
+
component: PasswordInput,
|
|
4
|
+
parameters: {
|
|
5
|
+
layout: "padded",
|
|
6
|
+
},
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
title: "Components/PasswordInput",
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
export const Default = {
|
|
12
|
+
args: {
|
|
13
|
+
placeholder: "Enter password",
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
export const WithValue = {
|
|
17
|
+
args: {
|
|
18
|
+
defaultValue: "secretpassword",
|
|
19
|
+
placeholder: "Enter password",
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
export const WithCustomClass = {
|
|
23
|
+
args: {
|
|
24
|
+
className: "border border-gray-300 rounded px-3 py-2",
|
|
25
|
+
placeholder: "Styled password input",
|
|
26
|
+
},
|
|
27
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { Picture } from "../components/picture";
|
|
3
|
+
declare const meta: Meta<typeof Picture>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Picture>;
|
|
6
|
+
export declare const SimpleImage: Story;
|
|
7
|
+
export declare const WithFormats: Story;
|
|
8
|
+
export declare const WithCustomSizes: Story;
|
|
9
|
+
export declare const WithClassName: Story;
|
|
10
|
+
//# sourceMappingURL=Picture.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Picture.stories.d.ts","sourceRoot":"","sources":["../../src/stories/Picture.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,OAAO,CAO9B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,OAAO,CAAC,CAAC;AAEtC,eAAO,MAAM,WAAW,EAAE,KAKzB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAUzB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAU7B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAO3B,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Picture } from "../components/picture";
|
|
2
|
+
const meta = {
|
|
3
|
+
component: Picture,
|
|
4
|
+
parameters: {
|
|
5
|
+
layout: "padded",
|
|
6
|
+
},
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
title: "Components/Picture",
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
export const SimpleImage = {
|
|
12
|
+
args: {
|
|
13
|
+
alt: "Placeholder image",
|
|
14
|
+
baseUrl: "https://via.placeholder.com/400x300",
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
export const WithFormats = {
|
|
18
|
+
args: {
|
|
19
|
+
alt: "Responsive image",
|
|
20
|
+
baseUrl: "https://via.placeholder.com/{format}",
|
|
21
|
+
formats: [
|
|
22
|
+
{ size: "480x360", width: 480 },
|
|
23
|
+
{ size: "800x600", width: 800 },
|
|
24
|
+
{ size: "1200x900", width: 1200 },
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export const WithCustomSizes = {
|
|
29
|
+
args: {
|
|
30
|
+
alt: "Custom sizes image",
|
|
31
|
+
baseUrl: "https://via.placeholder.com/{format}",
|
|
32
|
+
formats: [
|
|
33
|
+
{ size: "320x240", width: 320 },
|
|
34
|
+
{ size: "640x480", width: 640 },
|
|
35
|
+
],
|
|
36
|
+
sizes: "(max-width: 640px) 320px, 640px",
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
export const WithClassName = {
|
|
40
|
+
args: {
|
|
41
|
+
alt: "Styled image",
|
|
42
|
+
baseUrl: "https://via.placeholder.com/400x300",
|
|
43
|
+
className: "rounded-lg shadow-lg",
|
|
44
|
+
imgClassName: "object-cover",
|
|
45
|
+
},
|
|
46
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { ProtectedEmail } from "../components/protected-email";
|
|
3
|
+
declare const meta: Meta<typeof ProtectedEmail>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof ProtectedEmail>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithCustomText: Story;
|
|
8
|
+
export declare const WithClassName: Story;
|
|
9
|
+
export declare const MultipleEmails: Story;
|
|
10
|
+
//# sourceMappingURL=ProtectedEmail.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProtectedEmail.stories.d.ts","sourceRoot":"","sources":["../../src/stories/ProtectedEmail.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,cAAc,CAOrC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,cAAc,CAAC,CAAC;AAE7C,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAM5B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAM3B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAkB5B,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ProtectedEmail } from "../components/protected-email";
|
|
3
|
+
const meta = {
|
|
4
|
+
component: ProtectedEmail,
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: "padded",
|
|
7
|
+
},
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
title: "Components/ProtectedEmail",
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
export const Default = {
|
|
13
|
+
args: {
|
|
14
|
+
domain: "example.com",
|
|
15
|
+
username: "contact",
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export const WithCustomText = {
|
|
19
|
+
args: {
|
|
20
|
+
domain: "example.com",
|
|
21
|
+
text: "Send us an email",
|
|
22
|
+
username: "info",
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
export const WithClassName = {
|
|
26
|
+
args: {
|
|
27
|
+
className: "text-blue-600 underline hover:text-blue-800",
|
|
28
|
+
domain: "company.org",
|
|
29
|
+
username: "support",
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
export const MultipleEmails = {
|
|
33
|
+
render: () => (_jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [_jsx(ProtectedEmail, { domain: "example.com", username: "sales" }), _jsx(ProtectedEmail, { domain: "example.com", username: "support" }), _jsx(ProtectedEmail, { domain: "example.com", text: "General Inquiries", username: "info" })] })),
|
|
34
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { Text } from "../components/text";
|
|
3
|
+
declare const meta: Meta<typeof Text>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Text>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Subtitle: Story;
|
|
8
|
+
export declare const Code: Story;
|
|
9
|
+
export declare const AllVariants: Story;
|
|
10
|
+
//# sourceMappingURL=Text.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.stories.d.ts","sourceRoot":"","sources":["../../src/stories/Text.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,IAAI,CAO3B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAIrB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAKtB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,KAKlB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAQzB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from "../components/text";
|
|
3
|
+
const meta = {
|
|
4
|
+
component: Text,
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: "padded",
|
|
7
|
+
},
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
title: "Components/Text",
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
export const Default = {
|
|
13
|
+
args: {
|
|
14
|
+
children: "This is default text content.",
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
export const Subtitle = {
|
|
18
|
+
args: {
|
|
19
|
+
children: "This is subtitle text with larger size.",
|
|
20
|
+
variant: "subtitle",
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
export const Code = {
|
|
24
|
+
args: {
|
|
25
|
+
children: "const example = 'monospace code text';",
|
|
26
|
+
variant: "code",
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
export const AllVariants = {
|
|
30
|
+
render: () => (_jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "16px" }, children: [_jsx(Text, { variant: "primary", children: "Primary text (default)" }), _jsx(Text, { variant: "subtitle", children: "Subtitle text" }), _jsx(Text, { variant: "code", children: "Code text with monospace font" })] })),
|
|
31
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { UnorderedList } from "../components/unordered-list";
|
|
3
|
+
declare const meta: Meta<typeof UnorderedList>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof UnorderedList>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Inline: Story;
|
|
8
|
+
export declare const Unstyled: Story;
|
|
9
|
+
export declare const AllVariants: Story;
|
|
10
|
+
//# sourceMappingURL=UnorderedList.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnorderedList.stories.d.ts","sourceRoot":"","sources":["../../src/stories/UnorderedList.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,aAAa,CAOpC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,aAAa,CAAC,CAAC;AAE5C,eAAO,MAAM,OAAO,EAAE,KAQrB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAQpB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAQtB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KA0BzB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ListItem } from "../components/list-item";
|
|
3
|
+
import { UnorderedList } from "../components/unordered-list";
|
|
4
|
+
const meta = {
|
|
5
|
+
component: UnorderedList,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: "padded",
|
|
8
|
+
},
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
title: "Components/UnorderedList",
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
export const Default = {
|
|
14
|
+
render: () => (_jsxs(UnorderedList, { children: [_jsx(ListItem, { children: "Item 1" }), _jsx(ListItem, { children: "Item 2" }), _jsx(ListItem, { children: "Item 3" })] })),
|
|
15
|
+
};
|
|
16
|
+
export const Inline = {
|
|
17
|
+
render: () => (_jsxs(UnorderedList, { variant: "inline", children: [_jsx(ListItem, { children: "Tag 1" }), _jsx(ListItem, { children: "Tag 2" }), _jsx(ListItem, { children: "Tag 3" })] })),
|
|
18
|
+
};
|
|
19
|
+
export const Unstyled = {
|
|
20
|
+
render: () => (_jsxs(UnorderedList, { variant: "unstyled", children: [_jsx(ListItem, { children: "No bullet 1" }), _jsx(ListItem, { children: "No bullet 2" }), _jsx(ListItem, { children: "No bullet 3" })] })),
|
|
21
|
+
};
|
|
22
|
+
export const AllVariants = {
|
|
23
|
+
render: () => (_jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "24px" }, children: [_jsxs("div", { children: [_jsx("h4", { children: "Primary (default)" }), _jsxs(UnorderedList, { variant: "primary", children: [_jsx(ListItem, { children: "Item 1" }), _jsx(ListItem, { children: "Item 2" })] })] }), _jsxs("div", { children: [_jsx("h4", { children: "Inline" }), _jsxs(UnorderedList, { variant: "inline", children: [_jsx(ListItem, { children: "Item 1" }), _jsx(ListItem, { children: "Item 2" })] })] }), _jsxs("div", { children: [_jsx("h4", { children: "Unstyled" }), _jsxs(UnorderedList, { variant: "unstyled", children: [_jsx(ListItem, { children: "Item 1" }), _jsx(ListItem, { children: "Item 2" })] })] })] })),
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-setup.d.ts","sourceRoot":"","sources":["../src/test-setup.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom/vitest';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type AuthorInfo = {
|
|
2
|
+
name?: string;
|
|
3
|
+
email?: string;
|
|
4
|
+
url?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function parseAuthorString(input: string): AuthorInfo;
|
|
7
|
+
export declare function generateLinkFromAuthorString(input: string): React.ReactNode;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=author.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"author.d.ts","sourceRoot":"","sources":["../../src/utils/author.tsx"],"names":[],"mappings":"AAAA,KAAK,UAAU,GAAG;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAIF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CA0B3D;AAED,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAoC3E"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
const regex = /^(.*?)\s*(?:<([^>]+)>)?\s*(?:\(([^)]+)\))?$/;
|
|
3
|
+
export function parseAuthorString(input) {
|
|
4
|
+
const match = input.match(regex);
|
|
5
|
+
if (match) {
|
|
6
|
+
const [, name, email, url] = match;
|
|
7
|
+
const result = {};
|
|
8
|
+
if (email) {
|
|
9
|
+
result.email = email;
|
|
10
|
+
}
|
|
11
|
+
const trimmedName = name?.trim();
|
|
12
|
+
if (trimmedName) {
|
|
13
|
+
result.name = trimmedName;
|
|
14
|
+
}
|
|
15
|
+
if (url) {
|
|
16
|
+
result.url = url;
|
|
17
|
+
}
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
return {};
|
|
21
|
+
}
|
|
22
|
+
export function generateLinkFromAuthorString(input) {
|
|
23
|
+
const match = input.match(regex);
|
|
24
|
+
if (match) {
|
|
25
|
+
const [, name, email, url] = match.map((part) => {
|
|
26
|
+
return part?.trim();
|
|
27
|
+
});
|
|
28
|
+
if (email) {
|
|
29
|
+
return (_jsx("a", { className: 'u-email p-name', href: `mailto:${email}`, children: name }));
|
|
30
|
+
}
|
|
31
|
+
if (url && (url.startsWith('/') || url.startsWith('http'))) {
|
|
32
|
+
return (_jsx("a", { className: 'u-url p-name', href: url, children: name }));
|
|
33
|
+
}
|
|
34
|
+
return _jsx("span", { className: 'p-name', children: name });
|
|
35
|
+
}
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"author.test.d.ts","sourceRoot":"","sources":["../../src/utils/author.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest';
|
|
2
|
+
import { parseAuthorString } from './author';
|
|
3
|
+
describe('parseAuthorString', () => {
|
|
4
|
+
test('parses name only', () => {
|
|
5
|
+
expect(parseAuthorString('John Doe')).toEqual({ name: 'John Doe' });
|
|
6
|
+
});
|
|
7
|
+
test('parses name and email', () => {
|
|
8
|
+
expect(parseAuthorString('John Doe <john@example.com>')).toEqual({
|
|
9
|
+
email: 'john@example.com',
|
|
10
|
+
name: 'John Doe',
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
test('parses name and URL', () => {
|
|
14
|
+
expect(parseAuthorString('John Doe (https://example.com)')).toEqual({
|
|
15
|
+
name: 'John Doe',
|
|
16
|
+
url: 'https://example.com',
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
test('parses name, email, and URL', () => {
|
|
20
|
+
expect(parseAuthorString('John Doe <john@example.com> (https://example.com)')).toEqual({
|
|
21
|
+
email: 'john@example.com',
|
|
22
|
+
name: 'John Doe',
|
|
23
|
+
url: 'https://example.com',
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
test('handles email only (no name)', () => {
|
|
27
|
+
expect(parseAuthorString('<john@example.com>')).toEqual({
|
|
28
|
+
email: 'john@example.com',
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
test('handles whitespace in name', () => {
|
|
32
|
+
expect(parseAuthorString(' John Doe <john@example.com>')).toEqual({
|
|
33
|
+
email: 'john@example.com',
|
|
34
|
+
name: 'John Doe',
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
test('returns empty object for empty string', () => {
|
|
38
|
+
expect(parseAuthorString('')).toEqual({});
|
|
39
|
+
});
|
|
40
|
+
test('handles relative URL', () => {
|
|
41
|
+
expect(parseAuthorString('John Doe (/about/john)')).toEqual({
|
|
42
|
+
name: 'John Doe',
|
|
43
|
+
url: '/about/john',
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../../src/utils/cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAgB,MAAM,KAAK,CAAC;AAGvC,YAAY,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AAExC,eAAO,MAAQ,GAAG,qBAAE,OAAO,uBAMzB,CAAC;AAEH,eAAO,MAAM,EAAE,GAAI,GAAG,QAAQ,UAAU,CAAC,OAAO,EAAE,CAAC,WAAwB,CAAC"}
|
package/dist/utils/cn.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { cx, defineConfig } from 'cva';
|
|
2
|
+
import { twMerge } from 'fluid-tailwindcss/tailwind-merge';
|
|
3
|
+
export const { cva, compose } = defineConfig({
|
|
4
|
+
hooks: {
|
|
5
|
+
onComplete: (className) => {
|
|
6
|
+
return twMerge(className);
|
|
7
|
+
},
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
export const cn = (...inputs) => twMerge(cx(inputs));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cn.test.d.ts","sourceRoot":"","sources":["../../src/utils/cn.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { expect, test } from 'vitest';
|
|
2
|
+
import { cn } from './cn';
|
|
3
|
+
test('removes conflicting classes using twMerge', () => {
|
|
4
|
+
const classes = cn('text-red-500', 'text-blue-500');
|
|
5
|
+
expect(classes).toBe('text-blue-500');
|
|
6
|
+
});
|
|
7
|
+
test('merges multiple classes into a single string', () => {
|
|
8
|
+
const classes = cn('text-red-500', 'font-bold');
|
|
9
|
+
expect(classes).toBe('text-red-500 font-bold');
|
|
10
|
+
});
|
|
11
|
+
test('removes empty classes', () => {
|
|
12
|
+
const classes = cn('text-red-500', '', 'font-bold');
|
|
13
|
+
expect(classes).toBe('text-red-500 font-bold');
|
|
14
|
+
});
|
|
15
|
+
test('removes undefined classes', () => {
|
|
16
|
+
const classes = cn('text-red-500', undefined, 'font-bold');
|
|
17
|
+
expect(classes).toBe('text-red-500 font-bold');
|
|
18
|
+
});
|
|
19
|
+
test('removes null classes', () => {
|
|
20
|
+
const classes = cn('text-red-500', null, 'font-bold');
|
|
21
|
+
expect(classes).toBe('text-red-500 font-bold');
|
|
22
|
+
});
|
|
23
|
+
test('resolves nested arrays', () => {
|
|
24
|
+
const classes = cn('text-red-500', ['bg-blue-500', 'font-bold']);
|
|
25
|
+
expect(classes).toBe('text-red-500 bg-blue-500 font-bold');
|
|
26
|
+
});
|
|
27
|
+
test('resolves nested objects', () => {
|
|
28
|
+
const classes = cn('text-red-500', {
|
|
29
|
+
'bg-blue-500': true,
|
|
30
|
+
'font-bold': true,
|
|
31
|
+
});
|
|
32
|
+
expect(classes).toBe('text-red-500 bg-blue-500 font-bold');
|
|
33
|
+
});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare function isRouteActive(path: string, currentPath: string, end?: boolean | ((path: string) => boolean) | undefined): boolean;
|
|
2
|
+
export declare function checkIfRouteIsActive(targetLink: string, currentRoute: string, depth?: number): boolean;
|
|
3
|
+
//# sourceMappingURL=is-route-active.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-route-active.d.ts","sourceRoot":"","sources":["../../src/utils/is-route-active.ts"],"names":[],"mappings":"AASA,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,GAAG,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,SAAS,WAqBxD;AAUD,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,SAAI,WAmBvF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const ROOT_PATH = '/';
|
|
2
|
+
export function isRouteActive(path, currentPath, end) {
|
|
3
|
+
if (path === currentPath) {
|
|
4
|
+
return true;
|
|
5
|
+
}
|
|
6
|
+
if (typeof end === 'function') {
|
|
7
|
+
return !end(currentPath);
|
|
8
|
+
}
|
|
9
|
+
const defaultEnd = end ?? true;
|
|
10
|
+
const oneLevelDeep = 1;
|
|
11
|
+
const threeLevelsDeep = 3;
|
|
12
|
+
const depth = defaultEnd ? oneLevelDeep : threeLevelsDeep;
|
|
13
|
+
return checkIfRouteIsActive(path, currentPath, depth);
|
|
14
|
+
}
|
|
15
|
+
export function checkIfRouteIsActive(targetLink, currentRoute, depth = 1) {
|
|
16
|
+
const currentRoutePath = currentRoute.split('?')[0] ?? '';
|
|
17
|
+
if (!isRoot(currentRoutePath) && isRoot(targetLink)) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
if (!currentRoutePath.includes(targetLink)) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
const isSameRoute = targetLink === currentRoutePath;
|
|
24
|
+
if (isSameRoute) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
return hasMatchingSegments(targetLink, currentRoutePath, depth);
|
|
28
|
+
}
|
|
29
|
+
function splitIntoSegments(href) {
|
|
30
|
+
return href.split('/').filter(Boolean);
|
|
31
|
+
}
|
|
32
|
+
function hasMatchingSegments(targetLink, currentRoute, depth) {
|
|
33
|
+
const segments = splitIntoSegments(targetLink);
|
|
34
|
+
const matchingSegments = numberOfMatchingSegments(currentRoute, segments);
|
|
35
|
+
if (targetLink === currentRoute) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
return matchingSegments > segments.length - (depth - 1);
|
|
39
|
+
}
|
|
40
|
+
function numberOfMatchingSegments(href, segments) {
|
|
41
|
+
let count = 0;
|
|
42
|
+
for (const segment of splitIntoSegments(href)) {
|
|
43
|
+
if (segments.includes(segment)) {
|
|
44
|
+
count += 1;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
return count;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return count;
|
|
51
|
+
}
|
|
52
|
+
function isRoot(path) {
|
|
53
|
+
return path === ROOT_PATH;
|
|
54
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-route-active.test.d.ts","sourceRoot":"","sources":["../../src/utils/is-route-active.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest';
|
|
2
|
+
import { checkIfRouteIsActive, isRouteActive } from './is-route-active';
|
|
3
|
+
describe('isRouteActive', () => {
|
|
4
|
+
test('returns true when path matches currentPath exactly', () => {
|
|
5
|
+
expect(isRouteActive('/about', '/about')).toBe(true);
|
|
6
|
+
expect(isRouteActive('/contact', '/contact')).toBe(true);
|
|
7
|
+
});
|
|
8
|
+
test('returns false when paths are different', () => {
|
|
9
|
+
expect(isRouteActive('/about', '/contact')).toBe(false);
|
|
10
|
+
});
|
|
11
|
+
test('with end=true (default), only matches exact path', () => {
|
|
12
|
+
expect(isRouteActive('/about', '/about/team', true)).toBe(false);
|
|
13
|
+
expect(isRouteActive('/about', '/about', true)).toBe(true);
|
|
14
|
+
});
|
|
15
|
+
test('with end=false, matches parent paths', () => {
|
|
16
|
+
expect(isRouteActive('/about', '/about/team', false)).toBe(true);
|
|
17
|
+
expect(isRouteActive('/about', '/about/team/members', false)).toBe(true);
|
|
18
|
+
});
|
|
19
|
+
test('with end as function, uses function result', () => {
|
|
20
|
+
const endFn = (path) => path.includes('team');
|
|
21
|
+
expect(isRouteActive('/about', '/about/team', endFn)).toBe(false);
|
|
22
|
+
expect(isRouteActive('/about', '/about/contact', endFn)).toBe(true);
|
|
23
|
+
});
|
|
24
|
+
test('root path only matches root', () => {
|
|
25
|
+
expect(isRouteActive('/', '/')).toBe(true);
|
|
26
|
+
expect(isRouteActive('/', '/about', true)).toBe(false);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
describe('checkIfRouteIsActive', () => {
|
|
30
|
+
test('returns true for exact match', () => {
|
|
31
|
+
expect(checkIfRouteIsActive('/about', '/about')).toBe(true);
|
|
32
|
+
expect(checkIfRouteIsActive('/users/123', '/users/123')).toBe(true);
|
|
33
|
+
});
|
|
34
|
+
test('returns false when root is target but current is not root', () => {
|
|
35
|
+
expect(checkIfRouteIsActive('/', '/about')).toBe(false);
|
|
36
|
+
expect(checkIfRouteIsActive('/', '/users/123')).toBe(false);
|
|
37
|
+
});
|
|
38
|
+
test('returns true for root when current is root', () => {
|
|
39
|
+
expect(checkIfRouteIsActive('/', '/')).toBe(true);
|
|
40
|
+
});
|
|
41
|
+
test('returns false when target is not in current path', () => {
|
|
42
|
+
expect(checkIfRouteIsActive('/about', '/contact')).toBe(false);
|
|
43
|
+
expect(checkIfRouteIsActive('/users', '/posts')).toBe(false);
|
|
44
|
+
});
|
|
45
|
+
test('with depth=1, matches when segments match within depth', () => {
|
|
46
|
+
expect(checkIfRouteIsActive('/about', '/about/team', 1)).toBe(false);
|
|
47
|
+
expect(checkIfRouteIsActive('/about', '/about/team/members', 1)).toBe(false);
|
|
48
|
+
});
|
|
49
|
+
test('with depth=2, matches one level deep', () => {
|
|
50
|
+
expect(checkIfRouteIsActive('/about', '/about/team', 2)).toBe(true);
|
|
51
|
+
expect(checkIfRouteIsActive('/about', '/about/team/members', 2)).toBe(true);
|
|
52
|
+
});
|
|
53
|
+
test('with depth=3, matches two levels deep', () => {
|
|
54
|
+
expect(checkIfRouteIsActive('/about', '/about/team', 3)).toBe(true);
|
|
55
|
+
expect(checkIfRouteIsActive('/about', '/about/team/members', 3)).toBe(true);
|
|
56
|
+
expect(checkIfRouteIsActive('/about', '/about/team/members/details', 3)).toBe(true);
|
|
57
|
+
});
|
|
58
|
+
test('ignores query parameters in current route', () => {
|
|
59
|
+
expect(checkIfRouteIsActive('/about', '/about?foo=bar')).toBe(true);
|
|
60
|
+
});
|
|
61
|
+
});
|