@regardio/react 0.3.2 → 0.4.0
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/dist/components/background-slideshow.d.ts +7 -5
- package/dist/components/background-slideshow.js +172 -74
- package/dist/components/blurry-gradient.d.ts +11 -4
- package/dist/components/blurry-gradient.js +121 -5
- package/dist/components/box.d.ts +12 -9
- package/dist/components/box.js +48 -23
- package/dist/components/carousel.d.ts +12 -10
- package/dist/components/carousel.js +146 -66
- package/dist/components/countdown.d.ts +5 -2
- package/dist/components/countdown.js +55 -21
- package/dist/components/definition-list.d.ts +19 -16
- package/dist/components/definition-list.js +83 -51
- package/dist/components/generic-error.d.ts +25 -5
- package/dist/components/generic-error.js +42 -34
- package/dist/components/heading.d.ts +13 -10
- package/dist/components/heading.js +114 -25
- package/dist/components/highlight.d.ts +11 -8
- package/dist/components/highlight.js +65 -17
- package/dist/components/icon-button.d.ts +7 -4
- package/dist/components/icon-button.js +16 -5
- package/dist/components/if.d.ts +6 -4
- package/dist/components/if.js +22 -14
- package/dist/components/iframe.d.ts +6 -4
- package/dist/components/iframe.js +26 -3
- package/dist/components/item.d.ts +17 -14
- package/dist/components/item.js +504 -301
- package/dist/components/leaflet-map.d.ts +5 -4
- package/dist/components/leaflet-map.js +192 -186
- package/dist/components/link.d.ts +24 -16
- package/dist/components/link.js +191 -102
- package/dist/components/list-item.d.ts +11 -8
- package/dist/components/list-item.js +35 -17
- package/dist/components/maptiler-map.d.ts +5 -4
- package/dist/components/maptiler-map.js +125 -112
- package/dist/components/markdown-container.d.ts +10 -8
- package/dist/components/markdown-container.js +181 -82
- package/dist/components/password-input.d.ts +7 -5
- package/dist/components/password-input.js +50 -8
- package/dist/components/picture.d.ts +19 -7
- package/dist/components/picture.js +75 -34
- package/dist/components/protected-email.d.ts +14 -3
- package/dist/components/protected-email.js +29 -15
- package/dist/components/text.d.ts +12 -9
- package/dist/components/text.js +42 -24
- package/dist/components/unordered-list.d.ts +11 -8
- package/dist/components/unordered-list.js +37 -19
- package/dist/hooks/use-current-route-data.d.ts +7 -2
- package/dist/hooks/use-current-route-data.js +13 -9
- package/dist/hooks/use-focus-search.d.ts +6 -3
- package/dist/hooks/use-focus-search.js +17 -13
- package/dist/hooks/use-matches-data.d.ts +9 -2
- package/dist/hooks/use-matches-data.js +12 -8
- package/dist/hooks/use-media-query.d.ts +8 -2
- package/dist/hooks/use-media-query.js +19 -15
- package/dist/hooks/use-mobile.d.ts +3 -2
- package/dist/hooks/use-mobile.js +18 -14
- package/dist/hooks/use-nonce.d.ts +12 -5
- package/dist/hooks/use-nonce.js +11 -7
- package/dist/hooks/use-orientation.d.ts +11 -3
- package/dist/hooks/use-orientation.js +28 -24
- package/dist/hooks/use-user.d.ts +43 -8
- package/dist/hooks/use-user.js +21 -13
- package/dist/utils/author.d.ts +4 -4
- package/dist/utils/author.js +49 -31
- package/dist/utils/cn.d.ts +8 -4
- package/dist/utils/cn.js +12 -8
- package/dist/utils/is-route-active.d.ts +19 -3
- package/dist/utils/is-route-active.js +45 -43
- package/dist/utils/locale.d.ts +66 -4
- package/dist/utils/locale.js +33 -22
- package/dist/utils/text.d.ts +24 -7
- package/dist/utils/text.js +114 -89
- package/package.json +4 -3
- package/src/stories/ListItem.stories.tsx +3 -2
- package/dist/components/background-slideshow.d.ts.map +0 -1
- package/dist/components/blurry-gradient.d.ts.map +0 -1
- package/dist/components/box.d.ts.map +0 -1
- package/dist/components/carousel.d.ts.map +0 -1
- package/dist/components/countdown.d.ts.map +0 -1
- package/dist/components/definition-list.d.ts.map +0 -1
- package/dist/components/generic-error.d.ts.map +0 -1
- package/dist/components/heading.d.ts.map +0 -1
- package/dist/components/highlight.d.ts.map +0 -1
- package/dist/components/icon-button.d.ts.map +0 -1
- package/dist/components/if.d.ts.map +0 -1
- package/dist/components/iframe.d.ts.map +0 -1
- package/dist/components/item.d.ts.map +0 -1
- package/dist/components/leaflet-map.d.ts.map +0 -1
- package/dist/components/link.d.ts.map +0 -1
- package/dist/components/link.test.d.ts +0 -2
- package/dist/components/link.test.d.ts.map +0 -1
- package/dist/components/link.test.js +0 -204
- package/dist/components/list-item.d.ts.map +0 -1
- package/dist/components/maptiler-map.d.ts.map +0 -1
- package/dist/components/markdown-container.d.ts.map +0 -1
- package/dist/components/password-input.d.ts.map +0 -1
- package/dist/components/picture.d.ts.map +0 -1
- package/dist/components/protected-email.d.ts.map +0 -1
- package/dist/components/text.d.ts.map +0 -1
- package/dist/components/unordered-list.d.ts.map +0 -1
- package/dist/hooks/use-current-route-data.d.ts.map +0 -1
- package/dist/hooks/use-focus-search.d.ts.map +0 -1
- package/dist/hooks/use-matches-data.d.ts.map +0 -1
- package/dist/hooks/use-media-query.d.ts.map +0 -1
- package/dist/hooks/use-mobile.d.ts.map +0 -1
- package/dist/hooks/use-nonce.d.ts.map +0 -1
- package/dist/hooks/use-nonce.test.d.ts +0 -2
- package/dist/hooks/use-nonce.test.d.ts.map +0 -1
- package/dist/hooks/use-nonce.test.js +0 -27
- package/dist/hooks/use-orientation.d.ts.map +0 -1
- package/dist/hooks/use-user.d.ts.map +0 -1
- package/dist/shadcn/accordion.d.ts +0 -25
- package/dist/shadcn/accordion.d.ts.map +0 -1
- package/dist/shadcn/accordion.js +0 -45
- package/dist/shadcn/alert-dialog.d.ts +0 -73
- package/dist/shadcn/alert-dialog.d.ts.map +0 -1
- package/dist/shadcn/alert-dialog.js +0 -93
- package/dist/shadcn/alert.d.ts +0 -34
- package/dist/shadcn/alert.d.ts.map +0 -1
- package/dist/shadcn/alert.js +0 -42
- package/dist/shadcn/aspect-ratio.d.ts +0 -6
- package/dist/shadcn/aspect-ratio.d.ts.map +0 -1
- package/dist/shadcn/aspect-ratio.js +0 -7
- package/dist/shadcn/avatar.d.ts +0 -16
- package/dist/shadcn/avatar.d.ts.map +0 -1
- package/dist/shadcn/avatar.js +0 -27
- package/dist/shadcn/badge.d.ts +0 -29
- package/dist/shadcn/badge.d.ts.map +0 -1
- package/dist/shadcn/badge.js +0 -29
- package/dist/shadcn/breadcrumb.d.ts +0 -42
- package/dist/shadcn/breadcrumb.d.ts.map +0 -1
- package/dist/shadcn/breadcrumb.js +0 -74
- package/dist/shadcn/button.d.ts +0 -38
- package/dist/shadcn/button.d.ts.map +0 -1
- package/dist/shadcn/button.js +0 -38
- package/dist/shadcn/calendar.d.ts +0 -23
- package/dist/shadcn/calendar.d.ts.map +0 -1
- package/dist/shadcn/calendar.js +0 -163
- package/dist/shadcn/card.d.ts +0 -31
- package/dist/shadcn/card.d.ts.map +0 -1
- package/dist/shadcn/card.js +0 -55
- package/dist/shadcn/carousel.d.ts +0 -51
- package/dist/shadcn/carousel.d.ts.map +0 -1
- package/dist/shadcn/carousel.js +0 -161
- package/dist/shadcn/chart.d.ts +0 -103
- package/dist/shadcn/chart.d.ts.map +0 -1
- package/dist/shadcn/chart.js +0 -248
- package/dist/shadcn/checkbox.d.ts +0 -8
- package/dist/shadcn/checkbox.d.ts.map +0 -1
- package/dist/shadcn/checkbox.js +0 -22
- package/dist/shadcn/collapsible.d.ts +0 -16
- package/dist/shadcn/collapsible.d.ts.map +0 -1
- package/dist/shadcn/collapsible.js +0 -19
- package/dist/shadcn/command.d.ts +0 -61
- package/dist/shadcn/command.d.ts.map +0 -1
- package/dist/shadcn/command.js +0 -123
- package/dist/shadcn/context-menu.d.ts +0 -107
- package/dist/shadcn/context-menu.d.ts.map +0 -1
- package/dist/shadcn/context-menu.js +0 -151
- package/dist/shadcn/dialog.d.ts +0 -57
- package/dist/shadcn/dialog.d.ts.map +0 -1
- package/dist/shadcn/dialog.js +0 -96
- package/dist/shadcn/drawer.d.ts +0 -54
- package/dist/shadcn/drawer.d.ts.map +0 -1
- package/dist/shadcn/drawer.js +0 -96
- package/dist/shadcn/dropdown-menu.d.ts +0 -110
- package/dist/shadcn/dropdown-menu.d.ts.map +0 -1
- package/dist/shadcn/dropdown-menu.js +0 -152
- package/dist/shadcn/form.d.ts +0 -59
- package/dist/shadcn/form.d.ts.map +0 -1
- package/dist/shadcn/form.js +0 -99
- package/dist/shadcn/hover-card.d.ts +0 -20
- package/dist/shadcn/hover-card.d.ts.map +0 -1
- package/dist/shadcn/hover-card.js +0 -26
- package/dist/shadcn/input-otp.d.ts +0 -25
- package/dist/shadcn/input-otp.d.ts.map +0 -1
- package/dist/shadcn/input-otp.js +0 -54
- package/dist/shadcn/input.d.ts +0 -14
- package/dist/shadcn/input.d.ts.map +0 -1
- package/dist/shadcn/input.js +0 -48
- package/dist/shadcn/label.d.ts +0 -8
- package/dist/shadcn/label.d.ts.map +0 -1
- package/dist/shadcn/label.js +0 -16
- package/dist/shadcn/menubar.d.ts +0 -108
- package/dist/shadcn/menubar.d.ts.map +0 -1
- package/dist/shadcn/menubar.js +0 -174
- package/dist/shadcn/navigation-menu.d.ts +0 -79
- package/dist/shadcn/navigation-menu.d.ts.map +0 -1
- package/dist/shadcn/navigation-menu.js +0 -108
- package/dist/shadcn/pagination.d.ts +0 -45
- package/dist/shadcn/pagination.d.ts.map +0 -1
- package/dist/shadcn/pagination.js +0 -83
- package/dist/shadcn/popover.d.ts +0 -19
- package/dist/shadcn/popover.d.ts.map +0 -1
- package/dist/shadcn/popover.js +0 -29
- package/dist/shadcn/progress.d.ts +0 -9
- package/dist/shadcn/progress.d.ts.map +0 -1
- package/dist/shadcn/progress.js +0 -17
- package/dist/shadcn/radio-group.d.ts +0 -12
- package/dist/shadcn/radio-group.d.ts.map +0 -1
- package/dist/shadcn/radio-group.js +0 -32
- package/dist/shadcn/resizable.d.ts +0 -20
- package/dist/shadcn/resizable.d.ts.map +0 -1
- package/dist/shadcn/resizable.js +0 -32
- package/dist/shadcn/scroll-area.d.ts +0 -16
- package/dist/shadcn/scroll-area.d.ts.map +0 -1
- package/dist/shadcn/scroll-area.js +0 -40
- package/dist/shadcn/select.d.ts +0 -63
- package/dist/shadcn/select.d.ts.map +0 -1
- package/dist/shadcn/select.js +0 -120
- package/dist/shadcn/separator.d.ts +0 -10
- package/dist/shadcn/separator.d.ts.map +0 -1
- package/dist/shadcn/separator.js +0 -18
- package/dist/shadcn/sheet.d.ts +0 -48
- package/dist/shadcn/sheet.d.ts.map +0 -1
- package/dist/shadcn/sheet.js +0 -99
- package/dist/shadcn/sidebar.d.ts +0 -200
- package/dist/shadcn/sidebar.d.ts.map +0 -1
- package/dist/shadcn/sidebar.js +0 -528
- package/dist/shadcn/skeleton.d.ts +0 -6
- package/dist/shadcn/skeleton.d.ts.map +0 -1
- package/dist/shadcn/skeleton.js +0 -11
- package/dist/shadcn/slider.d.ts +0 -12
- package/dist/shadcn/slider.d.ts.map +0 -1
- package/dist/shadcn/slider.js +0 -50
- package/dist/shadcn/sonner.d.ts +0 -7
- package/dist/shadcn/sonner.d.ts.map +0 -1
- package/dist/shadcn/sonner.js +0 -20
- package/dist/shadcn/switch.d.ts +0 -8
- package/dist/shadcn/switch.d.ts.map +0 -1
- package/dist/shadcn/switch.js +0 -22
- package/dist/shadcn/table.d.ts +0 -35
- package/dist/shadcn/table.d.ts.map +0 -1
- package/dist/shadcn/table.js +0 -73
- package/dist/shadcn/tabs.d.ts +0 -20
- package/dist/shadcn/tabs.d.ts.map +0 -1
- package/dist/shadcn/tabs.js +0 -40
- package/dist/shadcn/textarea.d.ts +0 -7
- package/dist/shadcn/textarea.d.ts.map +0 -1
- package/dist/shadcn/textarea.js +0 -14
- package/dist/shadcn/toggle-group.d.ts +0 -22
- package/dist/shadcn/toggle-group.d.ts.map +0 -1
- package/dist/shadcn/toggle-group.js +0 -43
- package/dist/shadcn/toggle.d.ts +0 -29
- package/dist/shadcn/toggle.d.ts.map +0 -1
- package/dist/shadcn/toggle.js +0 -31
- package/dist/shadcn/tooltip.d.ts +0 -20
- package/dist/shadcn/tooltip.d.ts.map +0 -1
- package/dist/shadcn/tooltip.js +0 -40
- package/dist/stories/BackgroundSlideshow.stories.d.ts +0 -9
- package/dist/stories/BackgroundSlideshow.stories.d.ts.map +0 -1
- package/dist/stories/BackgroundSlideshow.stories.js +0 -60
- package/dist/stories/BlurryGradient.stories.d.ts +0 -11
- package/dist/stories/BlurryGradient.stories.d.ts.map +0 -1
- package/dist/stories/BlurryGradient.stories.js +0 -53
- package/dist/stories/Box.stories.d.ts +0 -13
- package/dist/stories/Box.stories.d.ts.map +0 -1
- package/dist/stories/Box.stories.js +0 -50
- package/dist/stories/Carousel.stories.d.ts +0 -9
- package/dist/stories/Carousel.stories.d.ts.map +0 -1
- package/dist/stories/Carousel.stories.js +0 -30
- package/dist/stories/Countdown.stories.d.ts +0 -7
- package/dist/stories/Countdown.stories.d.ts.map +0 -1
- package/dist/stories/Countdown.stories.js +0 -11
- package/dist/stories/DefinitionList.stories.d.ts +0 -9
- package/dist/stories/DefinitionList.stories.d.ts.map +0 -1
- package/dist/stories/DefinitionList.stories.js +0 -20
- package/dist/stories/GenericError.stories.d.ts +0 -9
- package/dist/stories/GenericError.stories.d.ts.map +0 -1
- package/dist/stories/GenericError.stories.js +0 -39
- package/dist/stories/Heading.stories.d.ts +0 -15
- package/dist/stories/Heading.stories.d.ts.map +0 -1
- package/dist/stories/Heading.stories.js +0 -61
- package/dist/stories/Highlight.stories.d.ts +0 -8
- package/dist/stories/Highlight.stories.d.ts.map +0 -1
- package/dist/stories/Highlight.stories.js +0 -19
- package/dist/stories/IconButton.stories.d.ts +0 -10
- package/dist/stories/IconButton.stories.d.ts.map +0 -1
- package/dist/stories/IconButton.stories.js +0 -32
- package/dist/stories/If.stories.d.ts +0 -13
- package/dist/stories/If.stories.d.ts.map +0 -1
- package/dist/stories/If.stories.js +0 -54
- package/dist/stories/Iframe.stories.d.ts +0 -8
- package/dist/stories/Iframe.stories.d.ts.map +0 -1
- package/dist/stories/Iframe.stories.js +0 -23
- package/dist/stories/Item.stories.d.ts +0 -10
- package/dist/stories/Item.stories.d.ts.map +0 -1
- package/dist/stories/Item.stories.js +0 -32
- package/dist/stories/Link.stories.d.ts +0 -10
- package/dist/stories/Link.stories.d.ts.map +0 -1
- package/dist/stories/Link.stories.js +0 -36
- package/dist/stories/ListItem.stories.d.ts +0 -9
- package/dist/stories/ListItem.stories.d.ts.map +0 -1
- package/dist/stories/ListItem.stories.js +0 -25
- package/dist/stories/MarkdownContainer.stories.d.ts +0 -11
- package/dist/stories/MarkdownContainer.stories.d.ts.map +0 -1
- package/dist/stories/MarkdownContainer.stories.js +0 -66
- package/dist/stories/PasswordInput.stories.d.ts +0 -9
- package/dist/stories/PasswordInput.stories.d.ts.map +0 -1
- package/dist/stories/PasswordInput.stories.js +0 -27
- package/dist/stories/Picture.stories.d.ts +0 -10
- package/dist/stories/Picture.stories.d.ts.map +0 -1
- package/dist/stories/Picture.stories.js +0 -46
- package/dist/stories/ProtectedEmail.stories.d.ts +0 -10
- package/dist/stories/ProtectedEmail.stories.d.ts.map +0 -1
- package/dist/stories/ProtectedEmail.stories.js +0 -34
- package/dist/stories/Text.stories.d.ts +0 -10
- package/dist/stories/Text.stories.d.ts.map +0 -1
- package/dist/stories/Text.stories.js +0 -31
- package/dist/stories/UnorderedList.stories.d.ts +0 -10
- package/dist/stories/UnorderedList.stories.d.ts.map +0 -1
- package/dist/stories/UnorderedList.stories.js +0 -24
- package/dist/test-setup.d.ts +0 -2
- package/dist/test-setup.d.ts.map +0 -1
- package/dist/test-setup.js +0 -1
- package/dist/utils/author.d.ts.map +0 -1
- package/dist/utils/author.test.d.ts +0 -2
- package/dist/utils/author.test.d.ts.map +0 -1
- package/dist/utils/author.test.js +0 -46
- package/dist/utils/cn.d.ts.map +0 -1
- package/dist/utils/cn.test.d.ts +0 -2
- package/dist/utils/cn.test.d.ts.map +0 -1
- package/dist/utils/cn.test.js +0 -33
- package/dist/utils/is-route-active.d.ts.map +0 -1
- package/dist/utils/is-route-active.test.d.ts +0 -2
- package/dist/utils/is-route-active.test.d.ts.map +0 -1
- package/dist/utils/is-route-active.test.js +0 -61
- package/dist/utils/locale.d.ts.map +0 -1
- package/dist/utils/locale.test.d.ts +0 -2
- package/dist/utils/locale.test.d.ts.map +0 -1
- package/dist/utils/locale.test.js +0 -99
- package/dist/utils/text.d.ts.map +0 -1
- package/dist/utils/text.test.d.ts +0 -2
- package/dist/utils/text.test.d.ts.map +0 -1
- package/dist/utils/text.test.js +0 -122
|
@@ -1,87 +1,167 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import useEmblaCarousel from 'embla-carousel-react';
|
|
3
|
-
import { createContext, forwardRef,
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { createContext, forwardRef, useState, useCallback, useEffect, useContext } from 'react';
|
|
3
|
+
import { defineConfig, cx } from 'cva';
|
|
4
|
+
import { twMerge } from 'fluid-tailwindcss/tailwind-merge';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
// src/components/carousel.tsx
|
|
8
|
+
var { cva, compose } = defineConfig({
|
|
9
|
+
hooks: {
|
|
10
|
+
onComplete: (className) => {
|
|
11
|
+
return twMerge(className);
|
|
10
12
|
}
|
|
11
|
-
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
var cn = (...inputs) => twMerge(cx(inputs));
|
|
16
|
+
var CarouselContext = createContext(null);
|
|
17
|
+
function useCarousel() {
|
|
18
|
+
const context = useContext(CarouselContext);
|
|
19
|
+
if (!context) {
|
|
20
|
+
throw new Error("useCarousel must be used within a <Carousel />");
|
|
21
|
+
}
|
|
22
|
+
return context;
|
|
12
23
|
}
|
|
13
|
-
|
|
24
|
+
var Carousel = forwardRef(
|
|
25
|
+
({ children, className, opts, orientation = "horizontal", setApi, ...props }, ref) => {
|
|
14
26
|
const [emblaRef, emblaApi] = useEmblaCarousel({
|
|
15
|
-
|
|
16
|
-
|
|
27
|
+
...opts,
|
|
28
|
+
axis: orientation === "horizontal" ? "x" : "y"
|
|
17
29
|
});
|
|
18
30
|
const [canScrollPrev, setCanScrollPrev] = useState(false);
|
|
19
31
|
const [canScrollNext, setCanScrollNext] = useState(false);
|
|
20
32
|
const onSelect = useCallback((api) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
33
|
+
if (!api) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
setCanScrollPrev(api.canScrollPrev());
|
|
37
|
+
setCanScrollNext(api.canScrollNext());
|
|
26
38
|
}, []);
|
|
27
39
|
const scrollPrev = useCallback(() => {
|
|
28
|
-
|
|
40
|
+
emblaApi?.scrollPrev();
|
|
29
41
|
}, [emblaApi]);
|
|
30
42
|
const scrollNext = useCallback(() => {
|
|
31
|
-
|
|
43
|
+
emblaApi?.scrollNext();
|
|
32
44
|
}, [emblaApi]);
|
|
33
|
-
const handleKeyDown = useCallback(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
45
|
+
const handleKeyDown = useCallback(
|
|
46
|
+
(event) => {
|
|
47
|
+
if (event.key === "ArrowLeft") {
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
scrollPrev();
|
|
50
|
+
} else if (event.key === "ArrowRight") {
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
scrollNext();
|
|
37
53
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
}, [scrollPrev, scrollNext]);
|
|
54
|
+
},
|
|
55
|
+
[scrollPrev, scrollNext]
|
|
56
|
+
);
|
|
43
57
|
useEffect(() => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
58
|
+
if (!emblaApi || !setApi) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
setApi(emblaApi);
|
|
48
62
|
}, [emblaApi, setApi]);
|
|
49
63
|
useEffect(() => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
64
|
+
if (!emblaApi) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
onSelect(emblaApi);
|
|
68
|
+
emblaApi.on("reInit", onSelect);
|
|
69
|
+
emblaApi.on("select", onSelect);
|
|
70
|
+
return () => {
|
|
71
|
+
emblaApi?.off("select", onSelect);
|
|
72
|
+
};
|
|
59
73
|
}, [emblaApi, onSelect]);
|
|
60
|
-
return
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
return /* @__PURE__ */ jsx(
|
|
75
|
+
CarouselContext.Provider,
|
|
76
|
+
{
|
|
77
|
+
value: {
|
|
78
|
+
api: emblaApi,
|
|
79
|
+
canScrollNext,
|
|
80
|
+
canScrollPrev,
|
|
81
|
+
scrollNext,
|
|
82
|
+
scrollPrev
|
|
83
|
+
},
|
|
84
|
+
children: /* @__PURE__ */ jsx(
|
|
85
|
+
"section",
|
|
86
|
+
{
|
|
87
|
+
"aria-label": "Carousel",
|
|
88
|
+
"aria-roledescription": "carousel",
|
|
89
|
+
className: cn("relative", className),
|
|
90
|
+
onKeyDownCapture: handleKeyDown,
|
|
91
|
+
ref,
|
|
92
|
+
...props,
|
|
93
|
+
children: /* @__PURE__ */ jsx("div", { ref: emblaRef, children: /* @__PURE__ */ jsx("div", { children }) })
|
|
94
|
+
}
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
Carousel.displayName = "Carousel";
|
|
101
|
+
var CarouselContent = forwardRef(
|
|
102
|
+
({ className, ...props }, ref) => {
|
|
103
|
+
return /* @__PURE__ */ jsx(
|
|
104
|
+
"div",
|
|
105
|
+
{
|
|
106
|
+
className: cn("flex", className),
|
|
107
|
+
ref,
|
|
108
|
+
...props
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
CarouselContent.displayName = "CarouselContent";
|
|
114
|
+
var CarouselItem = forwardRef(
|
|
115
|
+
({ className, ...props }, ref) => {
|
|
116
|
+
return (
|
|
117
|
+
// biome-ignore lint/a11y/useSemanticElements: False positive
|
|
118
|
+
/* @__PURE__ */ jsx(
|
|
119
|
+
"div",
|
|
120
|
+
{
|
|
121
|
+
"aria-roledescription": "slide",
|
|
122
|
+
className: cn("min-w-0 shrink-0 grow-0", className),
|
|
123
|
+
ref,
|
|
124
|
+
role: "group",
|
|
125
|
+
...props
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
CarouselItem.displayName = "CarouselItem";
|
|
132
|
+
var CarouselPrevious = forwardRef(
|
|
133
|
+
({ className, ...props }, ref) => {
|
|
78
134
|
const { canScrollPrev, scrollPrev } = useCarousel();
|
|
79
|
-
return
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
135
|
+
return /* @__PURE__ */ jsx(
|
|
136
|
+
"button",
|
|
137
|
+
{
|
|
138
|
+
className: cn("disabled:opacity-50", className),
|
|
139
|
+
disabled: !canScrollPrev,
|
|
140
|
+
onClick: scrollPrev,
|
|
141
|
+
ref,
|
|
142
|
+
type: "button",
|
|
143
|
+
...props
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
CarouselPrevious.displayName = "CarouselPrevious";
|
|
149
|
+
var CarouselNext = forwardRef(
|
|
150
|
+
({ className, ...props }, ref) => {
|
|
83
151
|
const { canScrollNext, scrollNext } = useCarousel();
|
|
84
|
-
return
|
|
85
|
-
|
|
86
|
-
|
|
152
|
+
return /* @__PURE__ */ jsx(
|
|
153
|
+
"button",
|
|
154
|
+
{
|
|
155
|
+
className: cn("disabled:opacity-50", className),
|
|
156
|
+
disabled: !canScrollNext,
|
|
157
|
+
onClick: scrollNext,
|
|
158
|
+
ref,
|
|
159
|
+
type: "button",
|
|
160
|
+
...props
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
CarouselNext.displayName = "CarouselNext";
|
|
166
|
+
|
|
87
167
|
export { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, useCarousel };
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
declare function Countdown(): react_jsx_runtime.JSX.Element;
|
|
4
|
+
|
|
5
|
+
export { Countdown };
|
|
@@ -1,22 +1,51 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import { defineConfig, cx } from 'cva';
|
|
3
|
+
import { twMerge } from 'fluid-tailwindcss/tailwind-merge';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
// src/components/countdown.tsx
|
|
7
|
+
var { cva, compose } = defineConfig({
|
|
8
|
+
hooks: {
|
|
9
|
+
onComplete: (className) => {
|
|
10
|
+
return twMerge(className);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
var cn = (...inputs) => twMerge(cx(inputs));
|
|
15
|
+
function Countdown() {
|
|
16
|
+
const [timerValue, setTimerValue] = useState(0);
|
|
17
|
+
const [isMounted, setIsMounted] = useState(false);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
setIsMounted(true);
|
|
20
|
+
const intervalId = setInterval(() => {
|
|
21
|
+
setTimerValue((prevValue) => {
|
|
22
|
+
return prevValue + 1;
|
|
23
|
+
});
|
|
24
|
+
}, 1e3);
|
|
25
|
+
return () => {
|
|
26
|
+
return clearInterval(intervalId);
|
|
27
|
+
};
|
|
28
|
+
}, []);
|
|
29
|
+
return /* @__PURE__ */ jsx(
|
|
30
|
+
"div",
|
|
31
|
+
{
|
|
32
|
+
className: cn(
|
|
33
|
+
"before:absolute",
|
|
34
|
+
"before:bg-white",
|
|
35
|
+
'before:content-[""]',
|
|
36
|
+
"before:h-[180px]",
|
|
37
|
+
"before:rounded-full",
|
|
38
|
+
"before:w-[180px]",
|
|
39
|
+
"flex",
|
|
40
|
+
"h-[240px]",
|
|
41
|
+
"items-center",
|
|
42
|
+
"justify-center",
|
|
43
|
+
"relative",
|
|
44
|
+
"rounded-full",
|
|
45
|
+
"w-[240px]"
|
|
46
|
+
),
|
|
47
|
+
style: {
|
|
48
|
+
background: `conic-gradient(
|
|
20
49
|
transparent ${6 * (isMounted ? timerValue : 0)}deg,
|
|
21
50
|
hsl(var(--red-500)) 0deg,
|
|
22
51
|
hsl(var(--red-500)) 15deg,
|
|
@@ -43,6 +72,11 @@ export function Countdown() {
|
|
|
43
72
|
hsl(var(--pink-500)) 315deg,
|
|
44
73
|
hsl(var(--pink-500)) 345deg,
|
|
45
74
|
hsl(var(--red-500)) 345deg
|
|
46
|
-
)
|
|
47
|
-
|
|
75
|
+
)`
|
|
76
|
+
},
|
|
77
|
+
children: /* @__PURE__ */ jsx("span", { className: cn("text-foreground", "relative", "text-3xl", "font-bold"), children: isMounted ? timerValue < 10 ? `0${timerValue}` : timerValue : 0 })
|
|
78
|
+
}
|
|
79
|
+
);
|
|
48
80
|
}
|
|
81
|
+
|
|
82
|
+
export { Countdown };
|
|
@@ -1,40 +1,43 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as cva from 'cva';
|
|
3
|
+
import { VariantProps } from 'cva';
|
|
4
|
+
import { ComponentProps } from 'react';
|
|
5
|
+
|
|
3
6
|
declare const dl: (props?: ({
|
|
4
7
|
variant?: "primary" | "unstyled" | undefined;
|
|
5
8
|
} & ({
|
|
6
|
-
class?:
|
|
9
|
+
class?: cva.ClassValue;
|
|
7
10
|
className?: never;
|
|
8
11
|
} | {
|
|
9
12
|
class?: never;
|
|
10
|
-
className?:
|
|
13
|
+
className?: cva.ClassValue;
|
|
11
14
|
})) | undefined) => string;
|
|
12
15
|
declare const dt: (props?: ({
|
|
13
16
|
variant?: "primary" | undefined;
|
|
14
17
|
} & ({
|
|
15
|
-
class?:
|
|
18
|
+
class?: cva.ClassValue;
|
|
16
19
|
className?: never;
|
|
17
20
|
} | {
|
|
18
21
|
class?: never;
|
|
19
|
-
className?:
|
|
22
|
+
className?: cva.ClassValue;
|
|
20
23
|
})) | undefined) => string;
|
|
21
24
|
declare const dd: (props?: ({
|
|
22
25
|
variant?: "primary" | undefined;
|
|
23
26
|
} & ({
|
|
24
|
-
class?:
|
|
27
|
+
class?: cva.ClassValue;
|
|
25
28
|
className?: never;
|
|
26
29
|
} | {
|
|
27
30
|
class?: never;
|
|
28
|
-
className?:
|
|
31
|
+
className?: cva.ClassValue;
|
|
29
32
|
})) | undefined) => string;
|
|
30
|
-
|
|
33
|
+
interface DefinitionListProps extends ComponentProps<'dl'>, VariantProps<typeof dl> {
|
|
31
34
|
}
|
|
32
|
-
|
|
35
|
+
interface DtProps extends ComponentProps<'dt'>, VariantProps<typeof dt> {
|
|
33
36
|
}
|
|
34
|
-
|
|
37
|
+
interface DdProps extends ComponentProps<'dd'>, VariantProps<typeof dd> {
|
|
35
38
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
declare const DefinitionList: (props: DefinitionListProps) => react_jsx_runtime.JSX.Element;
|
|
40
|
+
declare const Dt: (props: DtProps) => react_jsx_runtime.JSX.Element;
|
|
41
|
+
declare const Dd: (props: DdProps) => react_jsx_runtime.JSX.Element;
|
|
42
|
+
|
|
43
|
+
export { Dd, type DdProps, DefinitionList, type DefinitionListProps, Dt, type DtProps };
|
|
@@ -1,57 +1,89 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
},
|
|
1
|
+
import { defineConfig } from 'cva';
|
|
2
|
+
import { twMerge } from 'fluid-tailwindcss/tailwind-merge';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
// src/utils/cn.ts
|
|
6
|
+
var { cva, compose } = defineConfig({
|
|
7
|
+
hooks: {
|
|
8
|
+
onComplete: (className) => {
|
|
9
|
+
return twMerge(className);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
14
12
|
});
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
var dl = cva({
|
|
14
|
+
base: ["grid"],
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
variant: "primary"
|
|
17
|
+
},
|
|
18
|
+
variants: {
|
|
19
|
+
variant: {
|
|
20
|
+
primary: ["grid-cols-[auto,1fr]", "gap-x-s", "gap-y-2xs"],
|
|
21
|
+
// Two-column grid with gap
|
|
22
|
+
unstyled: ["list-none", "p-0", "grid-cols-1"]
|
|
23
|
+
// Unstyled, single column
|
|
24
|
+
}
|
|
25
|
+
}
|
|
25
26
|
});
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
var dt = cva({
|
|
28
|
+
base: [],
|
|
29
|
+
defaultVariants: {
|
|
30
|
+
variant: "primary"
|
|
31
|
+
},
|
|
32
|
+
variants: {
|
|
33
|
+
variant: {
|
|
34
|
+
primary: ["uppercase", "tracking-wide"]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
36
37
|
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
var dd = cva({
|
|
39
|
+
base: ["mb-xs"],
|
|
40
|
+
defaultVariants: {
|
|
41
|
+
variant: "primary"
|
|
42
|
+
},
|
|
43
|
+
variants: {
|
|
44
|
+
variant: {
|
|
45
|
+
primary: []
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
var DefinitionList = (props) => {
|
|
50
|
+
const { children, className, variant } = props;
|
|
51
|
+
return /* @__PURE__ */ jsx(
|
|
52
|
+
"dl",
|
|
53
|
+
{
|
|
54
|
+
className: dl({
|
|
55
|
+
className,
|
|
56
|
+
variant
|
|
57
|
+
}),
|
|
58
|
+
children
|
|
59
|
+
}
|
|
60
|
+
);
|
|
43
61
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
62
|
+
var Dt = (props) => {
|
|
63
|
+
const { children, className, variant } = props;
|
|
64
|
+
return /* @__PURE__ */ jsx(
|
|
65
|
+
"dt",
|
|
66
|
+
{
|
|
67
|
+
className: dt({
|
|
68
|
+
className,
|
|
69
|
+
variant
|
|
70
|
+
}),
|
|
71
|
+
children
|
|
72
|
+
}
|
|
73
|
+
);
|
|
50
74
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
75
|
+
var Dd = (props) => {
|
|
76
|
+
const { children, className, variant } = props;
|
|
77
|
+
return /* @__PURE__ */ jsx(
|
|
78
|
+
"dd",
|
|
79
|
+
{
|
|
80
|
+
className: dd({
|
|
81
|
+
className,
|
|
82
|
+
variant
|
|
83
|
+
}),
|
|
84
|
+
children
|
|
85
|
+
}
|
|
86
|
+
);
|
|
57
87
|
};
|
|
88
|
+
|
|
89
|
+
export { Dd, DefinitionList, Dt };
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Descriptor returned from getErrorDescriptor to help apps localize messages.
|
|
5
|
+
*/
|
|
6
|
+
type ErrorDescriptor = {
|
|
3
7
|
type: 'http';
|
|
4
8
|
status: number;
|
|
5
9
|
statusText: string;
|
|
@@ -16,8 +20,24 @@ export type ErrorDescriptor = {
|
|
|
16
20
|
defaultId: string;
|
|
17
21
|
defaultMessage: string;
|
|
18
22
|
};
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Compute a normalized error descriptor from a React Router error.
|
|
25
|
+
* Apps can use this to map to i18n keys.
|
|
26
|
+
*/
|
|
27
|
+
declare function getErrorDescriptor(error: unknown): ErrorDescriptor;
|
|
28
|
+
/**
|
|
29
|
+
* GenericError
|
|
30
|
+
*
|
|
31
|
+
* A reusable error boundary component for React Router apps.
|
|
32
|
+
* - Displays status-based messages for route responses
|
|
33
|
+
* - Shows stack traces in development for non-response errors
|
|
34
|
+
*
|
|
35
|
+
* For localization, apps may either:
|
|
36
|
+
* - Wrap this component and use `getErrorDescriptor(useRouteError())` to map to i18n keys
|
|
37
|
+
* - Or provide a custom `renderMessage` to override the displayed details
|
|
38
|
+
*/
|
|
39
|
+
declare function GenericError({ renderMessage, }?: {
|
|
21
40
|
renderMessage?: (descriptor: ErrorDescriptor) => ReactElement;
|
|
22
41
|
}): ReactElement;
|
|
23
|
-
|
|
42
|
+
|
|
43
|
+
export { type ErrorDescriptor, GenericError, getErrorDescriptor };
|
|
@@ -1,39 +1,47 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
1
|
import { isRouteErrorResponse, useRouteError } from 'react-router';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
status,
|
|
11
|
-
statusText,
|
|
12
|
-
type: 'http',
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
if (error instanceof Error) {
|
|
16
|
-
return {
|
|
17
|
-
defaultId: 'errors.runtime',
|
|
18
|
-
defaultMessage: 'An unexpected error occurred.',
|
|
19
|
-
message: error.message,
|
|
20
|
-
type: 'error',
|
|
21
|
-
...(error.stack ? { stack: error.stack } : {}),
|
|
22
|
-
};
|
|
23
|
-
}
|
|
2
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
// src/components/generic-error.tsx
|
|
5
|
+
function getErrorDescriptor(error) {
|
|
6
|
+
if (isRouteErrorResponse(error)) {
|
|
7
|
+
const status = error.status;
|
|
8
|
+
const statusText = error.statusText || "Error";
|
|
24
9
|
return {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
10
|
+
defaultId: status === 404 ? "errors.404" : "errors.http",
|
|
11
|
+
defaultMessage: status === 404 ? "Not found" : `Error ${status}`,
|
|
12
|
+
status,
|
|
13
|
+
statusText,
|
|
14
|
+
type: "http"
|
|
28
15
|
};
|
|
16
|
+
}
|
|
17
|
+
if (error instanceof Error) {
|
|
18
|
+
return {
|
|
19
|
+
defaultId: "errors.runtime",
|
|
20
|
+
defaultMessage: "An unexpected error occurred.",
|
|
21
|
+
message: error.message,
|
|
22
|
+
type: "error",
|
|
23
|
+
...error.stack ? { stack: error.stack } : {}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
defaultId: "errors.unknown",
|
|
28
|
+
defaultMessage: "An unexpected error occurred.",
|
|
29
|
+
type: "unknown"
|
|
30
|
+
};
|
|
29
31
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
function GenericError({
|
|
33
|
+
renderMessage
|
|
34
|
+
} = {}) {
|
|
35
|
+
const error = useRouteError();
|
|
36
|
+
const descriptor = getErrorDescriptor(error);
|
|
37
|
+
const title = descriptor.type === "http" ? `Error ${descriptor.status}` : "Error";
|
|
38
|
+
return /* @__PURE__ */ jsxs("main", { className: "pt-2xl p-sm container mx-auto", children: [
|
|
39
|
+
/* @__PURE__ */ jsx("h1", { children: title }),
|
|
40
|
+
renderMessage ? renderMessage(descriptor) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
41
|
+
/* @__PURE__ */ jsx("p", { children: descriptor.type === "http" ? descriptor.defaultMessage : descriptor.type === "error" ? descriptor.message || descriptor.defaultMessage : descriptor.defaultMessage }),
|
|
42
|
+
import.meta.env.DEV && descriptor.type === "error" && descriptor.stack && /* @__PURE__ */ jsx("pre", { className: "w-full p-sm overflow-x-auto", children: /* @__PURE__ */ jsx("code", { children: descriptor.stack }) })
|
|
43
|
+
] })
|
|
44
|
+
] });
|
|
39
45
|
}
|
|
46
|
+
|
|
47
|
+
export { GenericError, getErrorDescriptor };
|