@regardio/react 0.5.7 → 0.7.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.
Files changed (214) hide show
  1. package/dist/background-slideshow/index.d.mts +34 -0
  2. package/dist/background-slideshow/index.mjs +110 -0
  3. package/dist/blurry-gradient/index.d.mts +16 -0
  4. package/dist/blurry-gradient/index.mjs +93 -0
  5. package/dist/button/index.d.mts +2 -0
  6. package/dist/button/index.mjs +3 -0
  7. package/dist/button-BiSQpBbc.mjs +129 -0
  8. package/dist/carousel/index.d.mts +74 -0
  9. package/dist/carousel/index.mjs +136 -0
  10. package/dist/checkbox/index.d.mts +28 -0
  11. package/dist/checkbox/index.mjs +70 -0
  12. package/dist/checkbox-group/index.d.mts +16 -0
  13. package/dist/checkbox-group/index.mjs +29 -0
  14. package/dist/chunk-BTpB_u-K.mjs +18 -0
  15. package/dist/countdown/index.d.mts +4 -0
  16. package/dist/countdown/index.mjs +58 -0
  17. package/dist/field/index.d.mts +68 -0
  18. package/dist/field/index.mjs +115 -0
  19. package/dist/fieldset/index.d.mts +34 -0
  20. package/dist/fieldset/index.mjs +61 -0
  21. package/dist/form/index.d.mts +21 -0
  22. package/dist/form/index.mjs +31 -0
  23. package/dist/generic-error/index.d.mts +44 -0
  24. package/dist/generic-error/index.mjs +57 -0
  25. package/dist/grid/index.d.mts +101 -0
  26. package/dist/grid/index.mjs +219 -0
  27. package/dist/heading/index.d.mts +27 -0
  28. package/dist/heading/index.mjs +28 -0
  29. package/dist/highlight/index.d.mts +17 -0
  30. package/dist/highlight/index.mjs +35 -0
  31. package/dist/hooks/use-current-route-data.d.mts +8 -0
  32. package/dist/hooks/use-current-route-data.mjs +22 -0
  33. package/dist/hooks/{use-focus-search.d.ts → use-focus-search.d.mts} +4 -3
  34. package/dist/hooks/use-focus-search.mjs +23 -0
  35. package/dist/hooks/use-matches-data.d.mts +10 -0
  36. package/dist/hooks/use-matches-data.mjs +23 -0
  37. package/dist/hooks/use-media-query.d.mts +9 -0
  38. package/dist/hooks/use-media-query.mjs +28 -0
  39. package/dist/hooks/use-mobile.d.mts +4 -0
  40. package/dist/hooks/use-mobile.mjs +22 -0
  41. package/dist/hooks/use-nonce.d.mts +6 -0
  42. package/dist/hooks/use-nonce.mjs +13 -0
  43. package/dist/hooks/use-orientation.d.mts +12 -0
  44. package/dist/hooks/use-orientation.mjs +32 -0
  45. package/dist/hooks/use-user.d.mts +53 -0
  46. package/dist/hooks/use-user.mjs +39 -0
  47. package/dist/icon-button/index.d.mts +28 -0
  48. package/dist/icon-button/index.mjs +36 -0
  49. package/dist/if/index.d.mts +13 -0
  50. package/dist/if/index.mjs +21 -0
  51. package/dist/iframe/index.d.mts +11 -0
  52. package/dist/iframe/index.mjs +15 -0
  53. package/dist/index-Bj5_XfEC.d.mts +29 -0
  54. package/dist/index-C_evL5vG.d.mts +35 -0
  55. package/dist/input/index.d.mts +2 -0
  56. package/dist/input/index.mjs +3 -0
  57. package/dist/input-CtR6aRVi.mjs +73 -0
  58. package/dist/link/index.d.mts +71 -0
  59. package/dist/link/index.mjs +129 -0
  60. package/dist/list/index.d.mts +72 -0
  61. package/dist/list/index.mjs +54 -0
  62. package/dist/markdown-container/index.d.mts +23 -0
  63. package/dist/markdown-container/index.mjs +71 -0
  64. package/dist/password-input/index.d.mts +23 -0
  65. package/dist/password-input/index.mjs +92 -0
  66. package/dist/picture/index.d.mts +39 -0
  67. package/dist/picture/index.mjs +3 -0
  68. package/dist/picture-DkX3W5zl.mjs +69 -0
  69. package/dist/protected-email/index.d.mts +24 -0
  70. package/dist/protected-email/index.mjs +37 -0
  71. package/dist/radio/index.d.mts +28 -0
  72. package/dist/radio/index.mjs +72 -0
  73. package/dist/radio-group/index.d.mts +16 -0
  74. package/dist/radio-group/index.mjs +29 -0
  75. package/dist/slider/index.d.mts +63 -0
  76. package/dist/slider/index.mjs +133 -0
  77. package/dist/switch/index.d.mts +29 -0
  78. package/dist/switch/index.mjs +87 -0
  79. package/dist/text/index.d.mts +25 -0
  80. package/dist/text/index.mjs +32 -0
  81. package/dist/text-EQC4zJbE.mjs +52 -0
  82. package/dist/toggle/index.d.mts +25 -0
  83. package/dist/toggle/index.mjs +82 -0
  84. package/dist/utils/author/index.d.mts +4 -0
  85. package/dist/utils/author/index.mjs +26 -0
  86. package/dist/utils/text/{index.d.ts → index.d.mts} +9 -8
  87. package/dist/utils/text/index.mjs +3 -0
  88. package/package.json +131 -83
  89. package/src/background-slideshow/background-slideshow.tsx +1 -2
  90. package/src/blurry-gradient/blurry-gradient.tsx +1 -1
  91. package/src/button/button.stories.tsx +161 -0
  92. package/src/button/button.test.tsx +73 -0
  93. package/src/button/button.tsx +118 -0
  94. package/src/button/index.ts +2 -0
  95. package/src/carousel/carousel-content.tsx +17 -14
  96. package/src/carousel/carousel-item.tsx +18 -18
  97. package/src/carousel/carousel-next.tsx +22 -17
  98. package/src/carousel/carousel-previous.tsx +22 -17
  99. package/src/carousel/carousel-root.tsx +91 -86
  100. package/src/checkbox/checkbox.stories.tsx +118 -0
  101. package/src/checkbox/checkbox.tsx +102 -0
  102. package/src/checkbox/index.ts +2 -0
  103. package/src/checkbox-group/checkbox-group.tsx +40 -0
  104. package/src/checkbox-group/index.ts +2 -0
  105. package/src/countdown/countdown.tsx +1 -1
  106. package/src/field/field.stories.tsx +105 -0
  107. package/src/field/field.test.tsx +61 -0
  108. package/src/field/field.tsx +186 -0
  109. package/src/field/index.ts +12 -0
  110. package/src/fieldset/fieldset.stories.tsx +204 -0
  111. package/src/fieldset/fieldset.test.tsx +63 -0
  112. package/src/fieldset/fieldset.tsx +86 -0
  113. package/src/fieldset/index.ts +7 -0
  114. package/src/form/form.stories.tsx +230 -0
  115. package/src/form/form.test.tsx +68 -0
  116. package/src/form/form.tsx +38 -0
  117. package/src/form/index.ts +2 -0
  118. package/src/generic-error/generic-error.tsx +2 -3
  119. package/src/grid/grid-item.tsx +77 -36
  120. package/src/grid/grid-root.tsx +49 -22
  121. package/src/heading/heading.tsx +7 -3
  122. package/src/highlight/highlight.tsx +1 -1
  123. package/src/hooks/use-current-route-data.ts +4 -2
  124. package/src/hooks/use-focus-search.ts +3 -1
  125. package/src/hooks/use-matches-data.ts +2 -0
  126. package/src/hooks/use-media-query.ts +2 -0
  127. package/src/hooks/use-mobile.ts +3 -1
  128. package/src/hooks/use-nonce.ts +3 -3
  129. package/src/hooks/use-orientation.ts +2 -0
  130. package/src/hooks/use-user.tsx +3 -2
  131. package/src/icon-button/icon-button.stories.tsx +128 -7
  132. package/src/icon-button/icon-button.test.tsx +152 -0
  133. package/src/icon-button/icon-button.tsx +43 -9
  134. package/src/if/if.tsx +3 -1
  135. package/src/input/index.ts +2 -0
  136. package/src/input/input.stories.tsx +151 -0
  137. package/src/input/input.test.tsx +65 -0
  138. package/src/input/input.tsx +113 -0
  139. package/src/link/link.tsx +4 -3
  140. package/src/list/list-item.tsx +10 -13
  141. package/src/list/list-root-context.ts +3 -3
  142. package/src/list/list-root.tsx +10 -13
  143. package/src/password-input/index.ts +1 -1
  144. package/src/password-input/password-input.tsx +104 -27
  145. package/src/protected-email/protected-email.tsx +6 -1
  146. package/src/radio/index.ts +2 -0
  147. package/src/radio/radio.tsx +103 -0
  148. package/src/radio-group/index.ts +2 -0
  149. package/src/radio-group/radio-group.tsx +40 -0
  150. package/src/slider/index.ts +18 -0
  151. package/src/slider/slider.tsx +201 -0
  152. package/src/switch/index.ts +2 -0
  153. package/src/switch/switch.stories.tsx +118 -0
  154. package/src/switch/switch.tsx +112 -0
  155. package/src/text/text.tsx +6 -1
  156. package/src/toggle/index.ts +2 -0
  157. package/src/toggle/toggle.stories.tsx +232 -0
  158. package/src/toggle/toggle.test.tsx +149 -0
  159. package/src/toggle/toggle.tsx +88 -0
  160. package/src/utils/text/text.tsx +8 -16
  161. package/dist/background-slideshow/index.d.ts +0 -24
  162. package/dist/background-slideshow/index.js +0 -165
  163. package/dist/blurry-gradient/index.d.ts +0 -16
  164. package/dist/blurry-gradient/index.js +0 -128
  165. package/dist/carousel/index.d.ts +0 -36
  166. package/dist/carousel/index.js +0 -171
  167. package/dist/countdown/index.d.ts +0 -5
  168. package/dist/countdown/index.js +0 -73
  169. package/dist/generic-error/index.d.ts +0 -43
  170. package/dist/generic-error/index.js +0 -47
  171. package/dist/grid/index.d.ts +0 -1196
  172. package/dist/grid/index.js +0 -239
  173. package/dist/heading/index.d.ts +0 -24
  174. package/dist/heading/index.js +0 -99
  175. package/dist/highlight/index.d.ts +0 -13
  176. package/dist/highlight/index.js +0 -59
  177. package/dist/hooks/use-current-route-data.d.ts +0 -7
  178. package/dist/hooks/use-current-route-data.js +0 -16
  179. package/dist/hooks/use-focus-search.js +0 -19
  180. package/dist/hooks/use-matches-data.d.ts +0 -9
  181. package/dist/hooks/use-matches-data.js +0 -15
  182. package/dist/hooks/use-media-query.d.ts +0 -8
  183. package/dist/hooks/use-media-query.js +0 -20
  184. package/dist/hooks/use-mobile.d.ts +0 -3
  185. package/dist/hooks/use-mobile.js +0 -19
  186. package/dist/hooks/use-nonce.d.ts +0 -7
  187. package/dist/hooks/use-nonce.js +0 -8
  188. package/dist/hooks/use-orientation.d.ts +0 -11
  189. package/dist/hooks/use-orientation.js +0 -29
  190. package/dist/hooks/use-user.d.ts +0 -50
  191. package/dist/hooks/use-user.js +0 -25
  192. package/dist/icon-button/index.d.ts +0 -9
  193. package/dist/icon-button/index.js +0 -17
  194. package/dist/if/index.d.ts +0 -10
  195. package/dist/if/index.js +0 -24
  196. package/dist/iframe/index.d.ts +0 -10
  197. package/dist/iframe/index.js +0 -17
  198. package/dist/link/index.d.ts +0 -55
  199. package/dist/link/index.js +0 -195
  200. package/dist/list/index.d.ts +0 -69
  201. package/dist/list/index.js +0 -65
  202. package/dist/markdown-container/index.d.ts +0 -22
  203. package/dist/markdown-container/index.js +0 -128
  204. package/dist/password-input/index.d.ts +0 -11
  205. package/dist/password-input/index.js +0 -46
  206. package/dist/picture/index.d.ts +0 -38
  207. package/dist/picture/index.js +0 -68
  208. package/dist/protected-email/index.d.ts +0 -20
  209. package/dist/protected-email/index.js +0 -30
  210. package/dist/text/index.d.ts +0 -20
  211. package/dist/text/index.js +0 -38
  212. package/dist/utils/author/index.d.ts +0 -3
  213. package/dist/utils/author/index.js +0 -33
  214. package/dist/utils/text/index.js +0 -73
@@ -1,5 +1,5 @@
1
1
  import { replaceShyInString, splitIntoSentences, typographicQuotes } from '@regardio/js/text';
2
- import React, { cloneElement, isValidElement, type ReactElement, type ReactNode } from 'react';
2
+ import { cloneElement, Fragment, isValidElement, type ReactElement, type ReactNode } from 'react';
3
3
 
4
4
  export const lowerCaseSzett = (text: ReactNode | string, _returnType?: 'string'): ReactNode => {
5
5
  // Helper function to process strings
@@ -24,21 +24,18 @@ export const lowerCaseSzett = (text: ReactNode | string, _returnType?: 'string')
24
24
  return processString(text);
25
25
  }
26
26
 
27
- // Handle valid React elements with correct type assertion
27
+ // Handle valid React elements
28
28
  if (isValidElement(text)) {
29
29
  const element = text as ReactElement<{ children?: ReactNode }>;
30
- const { children, ...props } = element.props;
30
+ const { children } = element.props;
31
31
 
32
- return cloneElement(element, {
33
- ...props,
34
- children: lowerCaseSzett(children),
35
- });
32
+ return cloneElement(element, element.props, lowerCaseSzett(children));
36
33
  }
37
34
 
38
35
  // Handle arrays
39
36
  if (Array.isArray(text)) {
40
37
  return text.map((child, index) => (
41
- <React.Fragment key={index.toString()}>{lowerCaseSzett(child as ReactNode)}</React.Fragment>
38
+ <Fragment key={index.toString()}>{lowerCaseSzett(child as ReactNode)}</Fragment>
42
39
  ));
43
40
  }
44
41
 
@@ -55,19 +52,14 @@ function replaceShyInReactNode(node: ReactNode): ReactNode {
55
52
 
56
53
  if (isValidElement(node)) {
57
54
  const element = node as ReactElement<{ children?: ReactNode }>;
58
- const { children, ...props } = element.props;
55
+ const { children } = element.props;
59
56
 
60
- return cloneElement(element, {
61
- ...props,
62
- children: replaceShyInReactNode(children),
63
- });
57
+ return cloneElement(element, element.props, replaceShyInReactNode(children));
64
58
  }
65
59
 
66
60
  if (Array.isArray(node)) {
67
61
  return node.map((child, index) => (
68
- <React.Fragment key={index.toString()}>
69
- {replaceShyInReactNode(child as ReactNode)}
70
- </React.Fragment>
62
+ <Fragment key={index.toString()}>{replaceShyInReactNode(child as ReactNode)}</Fragment>
71
63
  ));
72
64
  }
73
65
 
@@ -1,24 +0,0 @@
1
- import { ReactElement } from 'react';
2
-
3
- type ImageData = {
4
- at: Record<string, string>;
5
- fn: string;
6
- hu: number;
7
- id: string;
8
- po: boolean;
9
- };
10
- interface BackgroundSlideshowProps {
11
- baseUrl: string;
12
- className?: string;
13
- imgClassName?: string;
14
- locale: string;
15
- pictureClassName?: string;
16
- images: ImageData[];
17
- filter?: (image: ImageData) => boolean;
18
- slideshow?: boolean;
19
- slideshowInterval?: number;
20
- transitionDuration?: number;
21
- }
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,165 +0,0 @@
1
- import { useMemo, useState, useRef, useEffect } from 'react';
2
- import { cn } from '@regardio/tailwind/utils';
3
- import { jsx, jsxs } from 'react/jsx-runtime';
4
-
5
- // src/background-slideshow/background-slideshow.tsx
6
- var Picture = ({
7
- alt,
8
- baseUrl,
9
- className,
10
- formats,
11
- imgClassName,
12
- placeholder = "{format}",
13
- sizes = "(max-width: 480px) 480px, (max-width: 768px) 600px, (max-width: 1200px) 1024px, 1920px"
14
- }) => {
15
- const imageFormats = formats || [
16
- { size: "480x360", width: 480 },
17
- { size: "600x600", width: 600 },
18
- { size: "1024x768", width: 1024 },
19
- { size: "1920x1440", width: 1920 }
20
- ];
21
- if (imageFormats.length === 0) {
22
- return null;
23
- }
24
- const isSimpleImage = imageFormats.length === 1 && imageFormats[0]?.size === "" || !baseUrl.includes(placeholder);
25
- if (isSimpleImage) {
26
- return /* @__PURE__ */ jsx(
27
- "img",
28
- {
29
- alt,
30
- className: cn(className, imgClassName),
31
- src: baseUrl
32
- }
33
- );
34
- }
35
- const srcSet = imageFormats.map(({ size, width }) => {
36
- const url = baseUrl.replace(placeholder, size);
37
- return `${url} ${width}w`;
38
- }).join(", ");
39
- const defaultFormat = imageFormats[0];
40
- const defaultSrc = defaultFormat ? baseUrl.replace(placeholder, defaultFormat.size) : baseUrl;
41
- return /* @__PURE__ */ jsxs("picture", { className, children: [
42
- /* @__PURE__ */ jsx(
43
- "source",
44
- {
45
- sizes,
46
- srcSet
47
- }
48
- ),
49
- /* @__PURE__ */ jsx(
50
- "img",
51
- {
52
- alt,
53
- className: cn(imgClassName),
54
- src: defaultSrc
55
- }
56
- )
57
- ] });
58
- };
59
- function BackgroundSlideshow({
60
- baseUrl,
61
- className = "",
62
- imgClassName = "",
63
- locale,
64
- pictureClassName = "",
65
- images = [],
66
- slideshow = true,
67
- slideshowInterval = 6e3,
68
- transitionDuration = 6e3,
69
- filter
70
- }) {
71
- const validatedImages = useMemo(() => {
72
- return images.map((img) => {
73
- if (typeof img !== "object" || img === null) return null;
74
- return {
75
- at: img.at || {},
76
- fn: img.fn || "",
77
- hu: img.hu || 0,
78
- id: img.id || "",
79
- po: img.po || false
80
- };
81
- }).filter((img) => img !== null);
82
- }, [images]);
83
- const availableImages = useMemo(() => {
84
- const filtered = filter ? validatedImages.filter(filter) : validatedImages;
85
- return filtered.length > 0 ? filtered : validatedImages;
86
- }, [validatedImages, filter]);
87
- const firstImage = availableImages[0] || null;
88
- const [slideshowStarted, setSlideshowStarted] = useState(false);
89
- const [overlayImage, setOverlayImage] = useState(null);
90
- const [overlayVisible, setOverlayVisible] = useState(false);
91
- const [currentIndex, setCurrentIndex] = useState(0);
92
- const timerRef = useRef(void 0);
93
- const isTransitioning = useRef(false);
94
- useEffect(() => {
95
- if (!slideshow || availableImages.length <= 1) return;
96
- const timeout = window.setTimeout(() => {
97
- setSlideshowStarted(true);
98
- }, slideshowInterval);
99
- return () => window.clearTimeout(timeout);
100
- }, [slideshow, availableImages.length, slideshowInterval]);
101
- useEffect(() => {
102
- if (!slideshowStarted || availableImages.length <= 1) return;
103
- if (timerRef.current) window.clearTimeout(timerRef.current);
104
- const cycleImages = () => {
105
- if (isTransitioning.current) return;
106
- isTransitioning.current = true;
107
- const nextIdx = (currentIndex + 1) % availableImages.length;
108
- const nextImage = availableImages[nextIdx];
109
- if (!nextImage) {
110
- isTransitioning.current = false;
111
- return;
112
- }
113
- setOverlayImage(nextImage);
114
- window.setTimeout(() => {
115
- setOverlayVisible(true);
116
- window.setTimeout(() => {
117
- setCurrentIndex(nextIdx);
118
- setOverlayVisible(false);
119
- isTransitioning.current = false;
120
- timerRef.current = window.setTimeout(cycleImages, slideshowInterval);
121
- }, transitionDuration);
122
- }, 100);
123
- };
124
- cycleImages();
125
- return () => {
126
- if (timerRef.current) window.clearTimeout(timerRef.current);
127
- };
128
- }, [slideshowStarted, availableImages, currentIndex, slideshowInterval, transitionDuration]);
129
- if (validatedImages.length === 0 || !firstImage) {
130
- return /* @__PURE__ */ jsx("div", { className });
131
- }
132
- const baseImage = availableImages[currentIndex] || firstImage;
133
- return /* @__PURE__ */ jsxs("div", { className, children: [
134
- /* @__PURE__ */ jsx("div", { className: "absolute inset-0 w-full h-full", children: /* @__PURE__ */ jsx(
135
- Picture,
136
- {
137
- alt: baseImage.at[locale] || "",
138
- baseUrl: baseUrl.replace("{id}", baseImage.id).replace("{fn}", baseImage.fn),
139
- className: pictureClassName,
140
- formats: [{ size: "", width: 1080 }],
141
- imgClassName,
142
- placeholder: ""
143
- }
144
- ) }),
145
- overlayImage && /* @__PURE__ */ jsx(
146
- "div",
147
- {
148
- 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"}`,
149
- children: /* @__PURE__ */ jsx(
150
- Picture,
151
- {
152
- alt: overlayImage.at[locale] || "",
153
- baseUrl: baseUrl.replace("{id}", overlayImage.id).replace("{fn}", overlayImage.fn),
154
- className: pictureClassName,
155
- formats: [{ size: "", width: 1080 }],
156
- imgClassName,
157
- placeholder: ""
158
- }
159
- )
160
- }
161
- )
162
- ] });
163
- }
164
-
165
- export { BackgroundSlideshow };
@@ -1,16 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { SVGProps } from 'react';
3
-
4
- interface BlurryGradientProps extends SVGProps<SVGSVGElement> {
5
- primaryColor: string;
6
- secondaryColor: string;
7
- neutralColor: string;
8
- /**
9
- * Accessible description for the gradient (for screen readers)
10
- * @default 'Decorative blurry gradient'
11
- */
12
- description?: string;
13
- }
14
- declare const BlurryGradient: (props: BlurryGradientProps) => react_jsx_runtime.JSX.Element;
15
-
16
- export { BlurryGradient, type BlurryGradientProps };
@@ -1,128 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
-
3
- // src/blurry-gradient/blurry-gradient.tsx
4
- var BlurryGradient = (props) => {
5
- const {
6
- description = "Decorative blurry gradient",
7
- neutralColor,
8
- primaryColor,
9
- secondaryColor,
10
- ...svgProps
11
- } = props;
12
- const titleId = "blurryGradientTitle";
13
- return /* @__PURE__ */ jsxs(
14
- "svg",
15
- {
16
- "aria-labelledby": titleId,
17
- preserveAspectRatio: "none",
18
- role: "img",
19
- viewBox: "0 0 1000 1000",
20
- ...svgProps,
21
- children: [
22
- /* @__PURE__ */ jsx("title", { id: titleId, children: description }),
23
- /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
24
- "filter",
25
- {
26
- colorInterpolationFilters: "sRGB",
27
- filterUnits: "userSpaceOnUse",
28
- height: "120%",
29
- width: "120%",
30
- x: "-10%",
31
- y: "-10%",
32
- children: [
33
- /* @__PURE__ */ jsx(
34
- "feFlood",
35
- {
36
- floodOpacity: "0",
37
- result: "BackgroundImageFix"
38
- }
39
- ),
40
- /* @__PURE__ */ jsx(
41
- "feBlend",
42
- {
43
- in: "SourceGraphic",
44
- in2: "BackgroundImageFix",
45
- mode: "normal",
46
- result: "shape"
47
- }
48
- ),
49
- /* @__PURE__ */ jsx(
50
- "feGaussianBlur",
51
- {
52
- result: "effect1_foregroundBlur",
53
- stdDeviation: "161"
54
- }
55
- )
56
- ]
57
- }
58
- ) }),
59
- /* @__PURE__ */ jsx(
60
- "rect",
61
- {
62
- fill: primaryColor,
63
- height: "1000",
64
- width: "1000"
65
- }
66
- ),
67
- /* @__PURE__ */ jsxs("g", { filter: "url(#blurryGradient)", children: [
68
- /* @__PURE__ */ jsx(
69
- "circle",
70
- {
71
- cx: "730",
72
- cy: "559",
73
- fill: secondaryColor,
74
- r: "357"
75
- }
76
- ),
77
- /* @__PURE__ */ jsx(
78
- "circle",
79
- {
80
- cx: "316",
81
- cy: "248",
82
- fill: primaryColor,
83
- r: "357"
84
- }
85
- ),
86
- /* @__PURE__ */ jsx(
87
- "circle",
88
- {
89
- cx: "509",
90
- cy: "410",
91
- fill: neutralColor,
92
- r: "357"
93
- }
94
- ),
95
- /* @__PURE__ */ jsx(
96
- "circle",
97
- {
98
- cx: "633",
99
- cy: "232",
100
- fill: secondaryColor,
101
- r: "357"
102
- }
103
- ),
104
- /* @__PURE__ */ jsx(
105
- "circle",
106
- {
107
- cx: "156",
108
- cy: "82",
109
- fill: primaryColor,
110
- r: "357"
111
- }
112
- ),
113
- /* @__PURE__ */ jsx(
114
- "circle",
115
- {
116
- cx: "150",
117
- cy: "389",
118
- fill: neutralColor,
119
- r: "357"
120
- }
121
- )
122
- ] })
123
- ]
124
- }
125
- );
126
- };
127
-
128
- export { BlurryGradient };
@@ -1,36 +0,0 @@
1
- import * as react from 'react';
2
- import { HTMLAttributes } from 'react';
3
- import { EmblaCarouselType, EmblaOptionsType } from 'embla-carousel';
4
-
5
- interface CarouselItemProps extends HTMLAttributes<HTMLDivElement> {
6
- 'aria-label'?: string;
7
- }
8
- declare const CarouselItem: react.ForwardRefExoticComponent<CarouselItemProps & react.RefAttributes<HTMLDivElement>>;
9
-
10
- type CarouselApi = EmblaCarouselType;
11
- interface CarouselContextValue {
12
- api: CarouselApi | undefined;
13
- scrollPrev: () => void;
14
- scrollNext: () => void;
15
- canScrollPrev: boolean;
16
- canScrollNext: boolean;
17
- }
18
- declare function useCarousel(): CarouselContextValue;
19
- interface CarouselRootProps extends HTMLAttributes<HTMLDivElement> {
20
- opts?: EmblaOptionsType;
21
- setApi?: (api: CarouselApi) => void;
22
- orientation?: 'horizontal' | 'vertical';
23
- }
24
- declare const CarouselRoot: react.ForwardRefExoticComponent<CarouselRootProps & react.RefAttributes<HTMLDivElement>>;
25
-
26
- declare const CarouselContent: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>;
27
-
28
- declare const CarouselNext: react.ForwardRefExoticComponent<HTMLAttributes<HTMLButtonElement> & react.RefAttributes<HTMLButtonElement>>;
29
-
30
- declare const CarouselPrevious: react.ForwardRefExoticComponent<HTMLAttributes<HTMLButtonElement> & react.RefAttributes<HTMLButtonElement>>;
31
-
32
- declare namespace index_parts {
33
- export { CarouselContent as Content, CarouselItem as Item, CarouselNext as Next, CarouselPrevious as Previous, CarouselRoot as Root };
34
- }
35
-
36
- export { index_parts as Carousel, type CarouselApi, type CarouselItemProps, type CarouselRootProps, useCarousel };
@@ -1,171 +0,0 @@
1
- import useEmblaCarousel from 'embla-carousel-react';
2
- import { createContext, forwardRef, useState, useCallback, useEffect, useContext } from 'react';
3
- import { jsx } from 'react/jsx-runtime';
4
-
5
- var __defProp = Object.defineProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var CarouselContext = createContext(null);
11
- function useCarousel() {
12
- const context = useContext(CarouselContext);
13
- if (!context) {
14
- throw new Error("useCarousel must be used within a <Carousel.Root />");
15
- }
16
- return context;
17
- }
18
- var CarouselRoot = forwardRef(
19
- ({ children, className, opts, orientation = "horizontal", setApi, ...props }, ref) => {
20
- const [emblaRef, emblaApi] = useEmblaCarousel({
21
- ...opts,
22
- axis: orientation === "horizontal" ? "x" : "y"
23
- });
24
- const [canScrollPrev, setCanScrollPrev] = useState(false);
25
- const [canScrollNext, setCanScrollNext] = useState(false);
26
- const onSelect = useCallback((api) => {
27
- if (!api) {
28
- return;
29
- }
30
- setCanScrollPrev(api.canScrollPrev());
31
- setCanScrollNext(api.canScrollNext());
32
- }, []);
33
- const scrollPrev = useCallback(() => {
34
- emblaApi?.scrollPrev();
35
- }, [emblaApi]);
36
- const scrollNext = useCallback(() => {
37
- emblaApi?.scrollNext();
38
- }, [emblaApi]);
39
- const handleKeyDown = useCallback(
40
- (event) => {
41
- if (event.key === "ArrowLeft") {
42
- event.preventDefault();
43
- scrollPrev();
44
- } else if (event.key === "ArrowRight") {
45
- event.preventDefault();
46
- scrollNext();
47
- }
48
- },
49
- [scrollPrev, scrollNext]
50
- );
51
- useEffect(() => {
52
- if (!emblaApi || !setApi) {
53
- return;
54
- }
55
- setApi(emblaApi);
56
- }, [emblaApi, setApi]);
57
- useEffect(() => {
58
- if (!emblaApi) {
59
- return;
60
- }
61
- onSelect(emblaApi);
62
- emblaApi.on("reInit", onSelect);
63
- emblaApi.on("select", onSelect);
64
- return () => {
65
- emblaApi?.off("select", onSelect);
66
- };
67
- }, [emblaApi, onSelect]);
68
- return /* @__PURE__ */ jsx(
69
- CarouselContext.Provider,
70
- {
71
- value: {
72
- api: emblaApi,
73
- canScrollNext,
74
- canScrollPrev,
75
- scrollNext,
76
- scrollPrev
77
- },
78
- children: /* @__PURE__ */ jsx(
79
- "section",
80
- {
81
- "aria-label": "Carousel",
82
- "aria-roledescription": "carousel",
83
- className,
84
- onKeyDownCapture: handleKeyDown,
85
- ref,
86
- ...props,
87
- children: /* @__PURE__ */ jsx("div", { ref: emblaRef, children: /* @__PURE__ */ jsx("div", { children }) })
88
- }
89
- )
90
- }
91
- );
92
- }
93
- );
94
- CarouselRoot.displayName = "CarouselRoot";
95
-
96
- // src/carousel/index.parts.ts
97
- var index_parts_exports = {};
98
- __export(index_parts_exports, {
99
- Content: () => CarouselContent,
100
- Item: () => CarouselItem,
101
- Next: () => CarouselNext,
102
- Previous: () => CarouselPrevious,
103
- Root: () => CarouselRoot
104
- });
105
- var CarouselContent = forwardRef(
106
- ({ className, ...props }, ref) => {
107
- return /* @__PURE__ */ jsx(
108
- "div",
109
- {
110
- className,
111
- ref,
112
- ...props
113
- }
114
- );
115
- }
116
- );
117
- CarouselContent.displayName = "CarouselContent";
118
- var CarouselItem = forwardRef(
119
- ({ className, ...props }, ref) => {
120
- return (
121
- // biome-ignore lint/a11y/useSemanticElements: False positive
122
- /* @__PURE__ */ jsx(
123
- "div",
124
- {
125
- "aria-roledescription": "slide",
126
- className,
127
- ref,
128
- role: "group",
129
- ...props
130
- }
131
- )
132
- );
133
- }
134
- );
135
- CarouselItem.displayName = "CarouselItem";
136
- var CarouselNext = forwardRef(
137
- ({ className, ...props }, ref) => {
138
- const { canScrollNext, scrollNext } = useCarousel();
139
- return /* @__PURE__ */ jsx(
140
- "button",
141
- {
142
- className,
143
- disabled: !canScrollNext,
144
- onClick: scrollNext,
145
- ref,
146
- type: "button",
147
- ...props
148
- }
149
- );
150
- }
151
- );
152
- CarouselNext.displayName = "CarouselNext";
153
- var CarouselPrevious = forwardRef(
154
- ({ className, ...props }, ref) => {
155
- const { canScrollPrev, scrollPrev } = useCarousel();
156
- return /* @__PURE__ */ jsx(
157
- "button",
158
- {
159
- className,
160
- disabled: !canScrollPrev,
161
- onClick: scrollPrev,
162
- ref,
163
- type: "button",
164
- ...props
165
- }
166
- );
167
- }
168
- );
169
- CarouselPrevious.displayName = "CarouselPrevious";
170
-
171
- export { index_parts_exports as Carousel, useCarousel };
@@ -1,5 +0,0 @@
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,73 +0,0 @@
1
- import { cn } from '@regardio/tailwind/utils';
2
- import { useState, useEffect } from 'react';
3
- import { jsx } from 'react/jsx-runtime';
4
-
5
- // src/countdown/countdown.tsx
6
- function Countdown() {
7
- const [timerValue, setTimerValue] = useState(0);
8
- const [isMounted, setIsMounted] = useState(false);
9
- useEffect(() => {
10
- setIsMounted(true);
11
- const intervalId = setInterval(() => {
12
- setTimerValue((prevValue) => {
13
- return prevValue + 1;
14
- });
15
- }, 1e3);
16
- return () => {
17
- return clearInterval(intervalId);
18
- };
19
- }, []);
20
- return /* @__PURE__ */ jsx(
21
- "div",
22
- {
23
- className: cn(
24
- "before:absolute",
25
- "before:bg-white",
26
- 'before:content-[""]',
27
- "before:h-[180px]",
28
- "before:rounded-full",
29
- "before:w-[180px]",
30
- "flex",
31
- "h-[240px]",
32
- "items-center",
33
- "justify-center",
34
- "relative",
35
- "rounded-full",
36
- "w-[240px]"
37
- ),
38
- style: {
39
- background: `conic-gradient(
40
- transparent ${6 * (isMounted ? timerValue : 0)}deg,
41
- hsl(var(--red-500)) 0deg,
42
- hsl(var(--red-500)) 15deg,
43
- hsl(var(--coral-500)) 15deg,
44
- hsl(var(--coral-500)) 45deg,
45
- hsl(var(--orange-500)) 45deg,
46
- hsl(var(--orange-500)) 75deg,
47
- hsl(var(--yellow-500)) 75deg,
48
- hsl(var(--yellow-500)) 105deg,
49
- hsl(var(--olive-500)) 105deg,
50
- hsl(var(--olive-500)) 135deg,
51
- hsl(var(--lime-500)) 135deg,
52
- hsl(var(--lime-500)) 165deg,
53
- hsl(var(--green-500)) 165deg,
54
- hsl(var(--green-500)) 195deg,
55
- hsl(var(--teal-500)) 195deg,
56
- hsl(var(--teal-500)) 225deg,
57
- hsl(var(--cyan-500)) 225deg,
58
- hsl(var(--cyan-500)) 255deg,
59
- hsl(var(--blue-500)) 255deg,
60
- hsl(var(--blue-500)) 285deg,
61
- hsl(var(--purple-500)) 285deg,
62
- hsl(var(--purple-500)) 315deg,
63
- hsl(var(--pink-500)) 315deg,
64
- hsl(var(--pink-500)) 345deg,
65
- hsl(var(--red-500)) 345deg
66
- )`
67
- },
68
- children: /* @__PURE__ */ jsx("span", { className: cn("text-foreground", "relative", "text-3xl", "font-bold"), children: isMounted ? timerValue < 10 ? `0${timerValue}` : timerValue : 0 })
69
- }
70
- );
71
- }
72
-
73
- export { Countdown };