@regardio/react 0.3.3 → 0.4.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/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 +14 -11
- 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 +18 -15
- 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 +5 -4
- 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 -26
- 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,12 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
|
|
3
|
+
type ImageData = {
|
|
3
4
|
at: Record<string, string>;
|
|
4
5
|
fn: string;
|
|
5
6
|
hu: number;
|
|
6
7
|
id: string;
|
|
7
8
|
po: boolean;
|
|
8
9
|
};
|
|
9
|
-
|
|
10
|
+
interface BackgroundSlideshowProps {
|
|
10
11
|
baseUrl: string;
|
|
11
12
|
className?: string;
|
|
12
13
|
imgClassName?: string;
|
|
@@ -18,5 +19,6 @@ export interface BackgroundSlideshowProps {
|
|
|
18
19
|
slideshowInterval?: number;
|
|
19
20
|
transitionDuration?: number;
|
|
20
21
|
}
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
declare function BackgroundSlideshow({ baseUrl, className, imgClassName, locale, pictureClassName, images, slideshow, slideshowInterval, transitionDuration, filter, }: BackgroundSlideshowProps): ReactElement;
|
|
23
|
+
|
|
24
|
+
export { BackgroundSlideshow, type BackgroundSlideshowProps, type ImageData };
|
|
@@ -1,76 +1,174 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
at: img.at || {},
|
|
12
|
-
fn: img.fn || '',
|
|
13
|
-
hu: img.hu || 0,
|
|
14
|
-
id: img.id || '',
|
|
15
|
-
po: img.po || false,
|
|
16
|
-
};
|
|
17
|
-
})
|
|
18
|
-
.filter((img) => img !== null);
|
|
19
|
-
}, [images]);
|
|
20
|
-
const availableImages = useMemo(() => {
|
|
21
|
-
const filtered = filter ? validatedImages.filter(filter) : validatedImages;
|
|
22
|
-
return filtered.length > 0 ? filtered : validatedImages;
|
|
23
|
-
}, [validatedImages, filter]);
|
|
24
|
-
const firstImage = availableImages[0] || null;
|
|
25
|
-
const [slideshowStarted, setSlideshowStarted] = useState(false);
|
|
26
|
-
const [overlayImage, setOverlayImage] = useState(null);
|
|
27
|
-
const [overlayVisible, setOverlayVisible] = useState(false);
|
|
28
|
-
const [currentIndex, setCurrentIndex] = useState(0);
|
|
29
|
-
const timerRef = useRef(undefined);
|
|
30
|
-
const isTransitioning = useRef(false);
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
if (!slideshow || availableImages.length <= 1)
|
|
33
|
-
return;
|
|
34
|
-
const timeout = window.setTimeout(() => {
|
|
35
|
-
setSlideshowStarted(true);
|
|
36
|
-
}, slideshowInterval);
|
|
37
|
-
return () => window.clearTimeout(timeout);
|
|
38
|
-
}, [slideshow, availableImages.length, slideshowInterval]);
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
if (!slideshowStarted || availableImages.length <= 1)
|
|
41
|
-
return;
|
|
42
|
-
if (timerRef.current)
|
|
43
|
-
window.clearTimeout(timerRef.current);
|
|
44
|
-
const cycleImages = () => {
|
|
45
|
-
if (isTransitioning.current)
|
|
46
|
-
return;
|
|
47
|
-
isTransitioning.current = true;
|
|
48
|
-
const nextIdx = (currentIndex + 1) % availableImages.length;
|
|
49
|
-
const nextImage = availableImages[nextIdx];
|
|
50
|
-
if (!nextImage) {
|
|
51
|
-
isTransitioning.current = false;
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
setOverlayImage(nextImage);
|
|
55
|
-
window.setTimeout(() => {
|
|
56
|
-
setOverlayVisible(true);
|
|
57
|
-
window.setTimeout(() => {
|
|
58
|
-
setCurrentIndex(nextIdx);
|
|
59
|
-
setOverlayVisible(false);
|
|
60
|
-
isTransitioning.current = false;
|
|
61
|
-
timerRef.current = window.setTimeout(cycleImages, slideshowInterval);
|
|
62
|
-
}, transitionDuration);
|
|
63
|
-
}, 100);
|
|
64
|
-
};
|
|
65
|
-
cycleImages();
|
|
66
|
-
return () => {
|
|
67
|
-
if (timerRef.current)
|
|
68
|
-
window.clearTimeout(timerRef.current);
|
|
69
|
-
};
|
|
70
|
-
}, [slideshowStarted, availableImages, currentIndex, slideshowInterval, transitionDuration]);
|
|
71
|
-
if (validatedImages.length === 0 || !firstImage) {
|
|
72
|
-
return _jsx("div", { className: className });
|
|
1
|
+
import { useMemo, useState, useRef, useEffect } from 'react';
|
|
2
|
+
import { defineConfig, cx } from 'cva';
|
|
3
|
+
import { twMerge } from 'fluid-tailwindcss/tailwind-merge';
|
|
4
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
// src/components/background-slideshow.tsx
|
|
7
|
+
var { cva, compose } = defineConfig({
|
|
8
|
+
hooks: {
|
|
9
|
+
onComplete: (className) => {
|
|
10
|
+
return twMerge(className);
|
|
73
11
|
}
|
|
74
|
-
|
|
75
|
-
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
var cn = (...inputs) => twMerge(cx(inputs));
|
|
15
|
+
var Picture = ({
|
|
16
|
+
alt,
|
|
17
|
+
baseUrl,
|
|
18
|
+
className,
|
|
19
|
+
formats,
|
|
20
|
+
imgClassName,
|
|
21
|
+
placeholder = "{format}",
|
|
22
|
+
sizes = "(max-width: 480px) 480px, (max-width: 768px) 600px, (max-width: 1200px) 1024px, 1920px"
|
|
23
|
+
}) => {
|
|
24
|
+
const imageFormats = formats || [
|
|
25
|
+
{ size: "480x360", width: 480 },
|
|
26
|
+
{ size: "600x600", width: 600 },
|
|
27
|
+
{ size: "1024x768", width: 1024 },
|
|
28
|
+
{ size: "1920x1440", width: 1920 }
|
|
29
|
+
];
|
|
30
|
+
if (imageFormats.length === 0) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
const isSimpleImage = imageFormats.length === 1 && imageFormats[0]?.size === "" || !baseUrl.includes(placeholder);
|
|
34
|
+
if (isSimpleImage) {
|
|
35
|
+
return /* @__PURE__ */ jsx(
|
|
36
|
+
"img",
|
|
37
|
+
{
|
|
38
|
+
alt,
|
|
39
|
+
className: cn(className, imgClassName),
|
|
40
|
+
src: baseUrl
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
const srcSet = imageFormats.map(({ size, width }) => {
|
|
45
|
+
const url = baseUrl.replace(placeholder, size);
|
|
46
|
+
return `${url} ${width}w`;
|
|
47
|
+
}).join(", ");
|
|
48
|
+
const defaultFormat = imageFormats[0];
|
|
49
|
+
const defaultSrc = defaultFormat ? baseUrl.replace(placeholder, defaultFormat.size) : baseUrl;
|
|
50
|
+
return /* @__PURE__ */ jsxs("picture", { className, children: [
|
|
51
|
+
/* @__PURE__ */ jsx(
|
|
52
|
+
"source",
|
|
53
|
+
{
|
|
54
|
+
sizes,
|
|
55
|
+
srcSet
|
|
56
|
+
}
|
|
57
|
+
),
|
|
58
|
+
/* @__PURE__ */ jsx(
|
|
59
|
+
"img",
|
|
60
|
+
{
|
|
61
|
+
alt,
|
|
62
|
+
className: cn(imgClassName),
|
|
63
|
+
src: defaultSrc
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
] });
|
|
67
|
+
};
|
|
68
|
+
function BackgroundSlideshow({
|
|
69
|
+
baseUrl,
|
|
70
|
+
className = "",
|
|
71
|
+
imgClassName = "",
|
|
72
|
+
locale,
|
|
73
|
+
pictureClassName = "",
|
|
74
|
+
images = [],
|
|
75
|
+
slideshow = true,
|
|
76
|
+
slideshowInterval = 6e3,
|
|
77
|
+
transitionDuration = 6e3,
|
|
78
|
+
filter
|
|
79
|
+
}) {
|
|
80
|
+
const validatedImages = useMemo(() => {
|
|
81
|
+
return images.map((img) => {
|
|
82
|
+
if (typeof img !== "object" || img === null) return null;
|
|
83
|
+
return {
|
|
84
|
+
at: img.at || {},
|
|
85
|
+
fn: img.fn || "",
|
|
86
|
+
hu: img.hu || 0,
|
|
87
|
+
id: img.id || "",
|
|
88
|
+
po: img.po || false
|
|
89
|
+
};
|
|
90
|
+
}).filter((img) => img !== null);
|
|
91
|
+
}, [images]);
|
|
92
|
+
const availableImages = useMemo(() => {
|
|
93
|
+
const filtered = filter ? validatedImages.filter(filter) : validatedImages;
|
|
94
|
+
return filtered.length > 0 ? filtered : validatedImages;
|
|
95
|
+
}, [validatedImages, filter]);
|
|
96
|
+
const firstImage = availableImages[0] || null;
|
|
97
|
+
const [slideshowStarted, setSlideshowStarted] = useState(false);
|
|
98
|
+
const [overlayImage, setOverlayImage] = useState(null);
|
|
99
|
+
const [overlayVisible, setOverlayVisible] = useState(false);
|
|
100
|
+
const [currentIndex, setCurrentIndex] = useState(0);
|
|
101
|
+
const timerRef = useRef(void 0);
|
|
102
|
+
const isTransitioning = useRef(false);
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (!slideshow || availableImages.length <= 1) return;
|
|
105
|
+
const timeout = window.setTimeout(() => {
|
|
106
|
+
setSlideshowStarted(true);
|
|
107
|
+
}, slideshowInterval);
|
|
108
|
+
return () => window.clearTimeout(timeout);
|
|
109
|
+
}, [slideshow, availableImages.length, slideshowInterval]);
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
if (!slideshowStarted || availableImages.length <= 1) return;
|
|
112
|
+
if (timerRef.current) window.clearTimeout(timerRef.current);
|
|
113
|
+
const cycleImages = () => {
|
|
114
|
+
if (isTransitioning.current) return;
|
|
115
|
+
isTransitioning.current = true;
|
|
116
|
+
const nextIdx = (currentIndex + 1) % availableImages.length;
|
|
117
|
+
const nextImage = availableImages[nextIdx];
|
|
118
|
+
if (!nextImage) {
|
|
119
|
+
isTransitioning.current = false;
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
setOverlayImage(nextImage);
|
|
123
|
+
window.setTimeout(() => {
|
|
124
|
+
setOverlayVisible(true);
|
|
125
|
+
window.setTimeout(() => {
|
|
126
|
+
setCurrentIndex(nextIdx);
|
|
127
|
+
setOverlayVisible(false);
|
|
128
|
+
isTransitioning.current = false;
|
|
129
|
+
timerRef.current = window.setTimeout(cycleImages, slideshowInterval);
|
|
130
|
+
}, transitionDuration);
|
|
131
|
+
}, 100);
|
|
132
|
+
};
|
|
133
|
+
cycleImages();
|
|
134
|
+
return () => {
|
|
135
|
+
if (timerRef.current) window.clearTimeout(timerRef.current);
|
|
136
|
+
};
|
|
137
|
+
}, [slideshowStarted, availableImages, currentIndex, slideshowInterval, transitionDuration]);
|
|
138
|
+
if (validatedImages.length === 0 || !firstImage) {
|
|
139
|
+
return /* @__PURE__ */ jsx("div", { className });
|
|
140
|
+
}
|
|
141
|
+
const baseImage = availableImages[currentIndex] || firstImage;
|
|
142
|
+
return /* @__PURE__ */ jsxs("div", { className, children: [
|
|
143
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 w-full h-full", children: /* @__PURE__ */ jsx(
|
|
144
|
+
Picture,
|
|
145
|
+
{
|
|
146
|
+
alt: baseImage.at[locale] || "",
|
|
147
|
+
baseUrl: baseUrl.replace("{id}", baseImage.id).replace("{fn}", baseImage.fn),
|
|
148
|
+
className: pictureClassName,
|
|
149
|
+
formats: [{ size: "", width: 1080 }],
|
|
150
|
+
imgClassName,
|
|
151
|
+
placeholder: ""
|
|
152
|
+
}
|
|
153
|
+
) }),
|
|
154
|
+
overlayImage && /* @__PURE__ */ jsx(
|
|
155
|
+
"div",
|
|
156
|
+
{
|
|
157
|
+
className: `absolute inset-0 w-full h-full transition-opacity ${overlayVisible ? "opacity-100" : "opacity-0"} ${transitionDuration <= 3e3 ? "duration-3000" : transitionDuration <= 4e3 ? "duration-4000" : transitionDuration <= 5e3 ? "duration-5000" : "duration-6000"}`,
|
|
158
|
+
children: /* @__PURE__ */ jsx(
|
|
159
|
+
Picture,
|
|
160
|
+
{
|
|
161
|
+
alt: overlayImage.at[locale] || "",
|
|
162
|
+
baseUrl: baseUrl.replace("{id}", overlayImage.id).replace("{fn}", overlayImage.fn),
|
|
163
|
+
className: pictureClassName,
|
|
164
|
+
formats: [{ size: "", width: 1080 }],
|
|
165
|
+
imgClassName,
|
|
166
|
+
placeholder: ""
|
|
167
|
+
}
|
|
168
|
+
)
|
|
169
|
+
}
|
|
170
|
+
)
|
|
171
|
+
] });
|
|
76
172
|
}
|
|
173
|
+
|
|
174
|
+
export { BackgroundSlideshow };
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { SVGProps } from 'react';
|
|
3
|
+
|
|
4
|
+
interface BlurryGradientProps extends SVGProps<SVGSVGElement> {
|
|
3
5
|
primaryColor: string;
|
|
4
6
|
secondaryColor: string;
|
|
5
7
|
neutralColor: string;
|
|
8
|
+
/**
|
|
9
|
+
* Accessible description for the gradient (for screen readers)
|
|
10
|
+
* @default 'Decorative blurry gradient'
|
|
11
|
+
*/
|
|
6
12
|
description?: string;
|
|
7
13
|
}
|
|
8
|
-
|
|
9
|
-
|
|
14
|
+
declare const BlurryGradient: (props: BlurryGradientProps) => react_jsx_runtime.JSX.Element;
|
|
15
|
+
|
|
16
|
+
export { BlurryGradient, type BlurryGradientProps };
|
|
@@ -1,6 +1,122 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
// src/components/blurry-gradient.tsx
|
|
4
|
+
var BlurryGradient = (props) => {
|
|
5
|
+
const { description = "Decorative blurry gradient", ...svgProps } = props;
|
|
6
|
+
const titleId = "blurryGradientTitle";
|
|
7
|
+
return /* @__PURE__ */ jsxs(
|
|
8
|
+
"svg",
|
|
9
|
+
{
|
|
10
|
+
"aria-labelledby": titleId,
|
|
11
|
+
preserveAspectRatio: "none",
|
|
12
|
+
role: "img",
|
|
13
|
+
viewBox: "0 0 1000 1000",
|
|
14
|
+
...svgProps,
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ jsx("title", { id: titleId, children: description }),
|
|
17
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
|
|
18
|
+
"filter",
|
|
19
|
+
{
|
|
20
|
+
colorInterpolationFilters: "sRGB",
|
|
21
|
+
filterUnits: "userSpaceOnUse",
|
|
22
|
+
height: "120%",
|
|
23
|
+
width: "120%",
|
|
24
|
+
x: "-10%",
|
|
25
|
+
y: "-10%",
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ jsx(
|
|
28
|
+
"feFlood",
|
|
29
|
+
{
|
|
30
|
+
floodOpacity: "0",
|
|
31
|
+
result: "BackgroundImageFix"
|
|
32
|
+
}
|
|
33
|
+
),
|
|
34
|
+
/* @__PURE__ */ jsx(
|
|
35
|
+
"feBlend",
|
|
36
|
+
{
|
|
37
|
+
in: "SourceGraphic",
|
|
38
|
+
in2: "BackgroundImageFix",
|
|
39
|
+
mode: "normal",
|
|
40
|
+
result: "shape"
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ jsx(
|
|
44
|
+
"feGaussianBlur",
|
|
45
|
+
{
|
|
46
|
+
result: "effect1_foregroundBlur",
|
|
47
|
+
stdDeviation: "161"
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
) }),
|
|
53
|
+
/* @__PURE__ */ jsx(
|
|
54
|
+
"rect",
|
|
55
|
+
{
|
|
56
|
+
fill: props.primaryColor,
|
|
57
|
+
height: "1000",
|
|
58
|
+
width: "1000"
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
/* @__PURE__ */ jsxs("g", { filter: "url(#blurryGradient)", children: [
|
|
62
|
+
/* @__PURE__ */ jsx(
|
|
63
|
+
"circle",
|
|
64
|
+
{
|
|
65
|
+
cx: "730",
|
|
66
|
+
cy: "559",
|
|
67
|
+
fill: props.secondaryColor,
|
|
68
|
+
r: "357"
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
/* @__PURE__ */ jsx(
|
|
72
|
+
"circle",
|
|
73
|
+
{
|
|
74
|
+
cx: "316",
|
|
75
|
+
cy: "248",
|
|
76
|
+
fill: props.primaryColor,
|
|
77
|
+
r: "357"
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
/* @__PURE__ */ jsx(
|
|
81
|
+
"circle",
|
|
82
|
+
{
|
|
83
|
+
cx: "509",
|
|
84
|
+
cy: "410",
|
|
85
|
+
fill: props.neutralColor,
|
|
86
|
+
r: "357"
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
/* @__PURE__ */ jsx(
|
|
90
|
+
"circle",
|
|
91
|
+
{
|
|
92
|
+
cx: "633",
|
|
93
|
+
cy: "232",
|
|
94
|
+
fill: props.secondaryColor,
|
|
95
|
+
r: "357"
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
/* @__PURE__ */ jsx(
|
|
99
|
+
"circle",
|
|
100
|
+
{
|
|
101
|
+
cx: "156",
|
|
102
|
+
cy: "82",
|
|
103
|
+
fill: props.primaryColor,
|
|
104
|
+
r: "357"
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
/* @__PURE__ */ jsx(
|
|
108
|
+
"circle",
|
|
109
|
+
{
|
|
110
|
+
cx: "150",
|
|
111
|
+
cy: "389",
|
|
112
|
+
fill: props.neutralColor,
|
|
113
|
+
r: "357"
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
] })
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
);
|
|
6
120
|
};
|
|
121
|
+
|
|
122
|
+
export { BlurryGradient };
|
package/dist/components/box.d.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
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, ElementType } from 'react';
|
|
5
|
+
|
|
3
6
|
declare const box: (props?: ({
|
|
4
|
-
variant?: "
|
|
7
|
+
variant?: "grid" | "main" | "primary" | "aside" | "code" | "container" | "flex" | "section" | 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
|
+
interface BoxProps extends ComponentProps<'div'>, VariantProps<typeof box> {
|
|
13
16
|
as?: ElementType;
|
|
14
17
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
declare const Box: ({ as: Component, children, className, variant, ...props }: BoxProps) => react_jsx_runtime.JSX.Element;
|
|
19
|
+
|
|
20
|
+
export { Box, type BoxProps };
|
package/dist/components/box.js
CHANGED
|
@@ -1,25 +1,50 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
flex: ['flex'],
|
|
13
|
-
grid: ['u-grid'],
|
|
14
|
-
main: [],
|
|
15
|
-
primary: [],
|
|
16
|
-
section: ['u-grid', 'content-start'],
|
|
17
|
-
},
|
|
18
|
-
},
|
|
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
|
+
}
|
|
19
12
|
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
var box = cva({
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
variant: "primary"
|
|
16
|
+
},
|
|
17
|
+
variants: {
|
|
18
|
+
variant: {
|
|
19
|
+
aside: [],
|
|
20
|
+
code: ["font-monospace", "overflow-scroll"],
|
|
21
|
+
container: ["u-container"],
|
|
22
|
+
flex: ["flex"],
|
|
23
|
+
grid: ["u-grid"],
|
|
24
|
+
main: [],
|
|
25
|
+
primary: [],
|
|
26
|
+
section: ["u-grid", "content-start"]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
var Box = ({
|
|
31
|
+
as: Component = "div",
|
|
32
|
+
children,
|
|
33
|
+
className,
|
|
34
|
+
variant,
|
|
35
|
+
...props
|
|
36
|
+
}) => {
|
|
37
|
+
return /* @__PURE__ */ jsx(
|
|
38
|
+
Component,
|
|
39
|
+
{
|
|
40
|
+
className: box({
|
|
41
|
+
className,
|
|
42
|
+
variant
|
|
43
|
+
}),
|
|
44
|
+
...props,
|
|
45
|
+
children
|
|
46
|
+
}
|
|
47
|
+
);
|
|
25
48
|
};
|
|
49
|
+
|
|
50
|
+
export { Box };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes } from 'react';
|
|
3
|
+
import { EmblaOptionsType, EmblaCarouselType } from 'embla-carousel';
|
|
4
|
+
|
|
5
|
+
type CarouselApi = EmblaCarouselType;
|
|
4
6
|
interface CarouselContextValue {
|
|
5
7
|
api: CarouselApi | undefined;
|
|
6
8
|
scrollPrev: () => void;
|
|
@@ -14,13 +16,13 @@ interface CarouselProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
14
16
|
setApi?: (api: CarouselApi) => void;
|
|
15
17
|
orientation?: 'horizontal' | 'vertical';
|
|
16
18
|
}
|
|
17
|
-
declare const Carousel:
|
|
18
|
-
declare const CarouselContent:
|
|
19
|
+
declare const Carousel: react.ForwardRefExoticComponent<CarouselProps & react.RefAttributes<HTMLDivElement>>;
|
|
20
|
+
declare const CarouselContent: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>;
|
|
19
21
|
interface CarouselItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
20
22
|
'aria-label'?: string;
|
|
21
23
|
}
|
|
22
|
-
declare const CarouselItem:
|
|
23
|
-
declare const CarouselPrevious:
|
|
24
|
-
declare const CarouselNext:
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
declare const CarouselItem: react.ForwardRefExoticComponent<CarouselItemProps & react.RefAttributes<HTMLDivElement>>;
|
|
25
|
+
declare const CarouselPrevious: react.ForwardRefExoticComponent<HTMLAttributes<HTMLButtonElement> & react.RefAttributes<HTMLButtonElement>>;
|
|
26
|
+
declare const CarouselNext: react.ForwardRefExoticComponent<HTMLAttributes<HTMLButtonElement> & react.RefAttributes<HTMLButtonElement>>;
|
|
27
|
+
|
|
28
|
+
export { Carousel, type CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, useCarousel };
|