@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
@@ -0,0 +1,34 @@
1
+ //#region src/background-slideshow/background-slideshow.d.ts
2
+ type ImageData = {
3
+ at: Record<string, string>;
4
+ fn: string;
5
+ hu: number;
6
+ id: string;
7
+ po: boolean;
8
+ };
9
+ interface BackgroundSlideshowProps {
10
+ baseUrl: string;
11
+ className?: string;
12
+ imgClassName?: string;
13
+ locale: string;
14
+ pictureClassName?: string;
15
+ images: ImageData[];
16
+ filter?: (image: ImageData) => boolean;
17
+ slideshow?: boolean;
18
+ slideshowInterval?: number;
19
+ transitionDuration?: number;
20
+ }
21
+ declare function BackgroundSlideshow({
22
+ baseUrl,
23
+ className,
24
+ imgClassName,
25
+ locale,
26
+ pictureClassName,
27
+ images,
28
+ slideshow,
29
+ slideshowInterval,
30
+ transitionDuration,
31
+ filter
32
+ }: BackgroundSlideshowProps): React.JSX.Element;
33
+ //#endregion
34
+ export { BackgroundSlideshow, type BackgroundSlideshowProps, type ImageData };
@@ -0,0 +1,110 @@
1
+ import { t as Picture } from "../picture-DkX3W5zl.mjs";
2
+ import { useEffect, useMemo, useRef, useState } from "react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+
5
+ //#region src/background-slideshow/background-slideshow.tsx
6
+ function BackgroundSlideshow({ baseUrl, className = "", imgClassName = "", locale, pictureClassName = "", images = [], slideshow = true, slideshowInterval = 6e3, transitionDuration = 6e3, filter }) {
7
+ const validatedImages = useMemo(() => {
8
+ return images.map((img) => {
9
+ if (typeof img !== "object" || img === null) return null;
10
+ return {
11
+ at: img.at || {},
12
+ fn: img.fn || "",
13
+ hu: img.hu || 0,
14
+ id: img.id || "",
15
+ po: img.po || false
16
+ };
17
+ }).filter((img) => img !== null);
18
+ }, [images]);
19
+ const availableImages = useMemo(() => {
20
+ const filtered = filter ? validatedImages.filter(filter) : validatedImages;
21
+ return filtered.length > 0 ? filtered : validatedImages;
22
+ }, [validatedImages, filter]);
23
+ const firstImage = availableImages[0] || null;
24
+ const [slideshowStarted, setSlideshowStarted] = useState(false);
25
+ const [overlayImage, setOverlayImage] = useState(null);
26
+ const [overlayVisible, setOverlayVisible] = useState(false);
27
+ const [currentIndex, setCurrentIndex] = useState(0);
28
+ const timerRef = useRef(void 0);
29
+ const isTransitioning = useRef(false);
30
+ useEffect(() => {
31
+ if (!slideshow || availableImages.length <= 1) return;
32
+ const timeout = window.setTimeout(() => {
33
+ setSlideshowStarted(true);
34
+ }, slideshowInterval);
35
+ return () => window.clearTimeout(timeout);
36
+ }, [
37
+ slideshow,
38
+ availableImages.length,
39
+ slideshowInterval
40
+ ]);
41
+ useEffect(() => {
42
+ if (!slideshowStarted || availableImages.length <= 1) return;
43
+ if (timerRef.current) window.clearTimeout(timerRef.current);
44
+ const cycleImages = () => {
45
+ if (isTransitioning.current) return;
46
+ isTransitioning.current = true;
47
+ const nextIdx = (currentIndex + 1) % availableImages.length;
48
+ const nextImage = availableImages[nextIdx];
49
+ if (!nextImage) {
50
+ isTransitioning.current = false;
51
+ return;
52
+ }
53
+ setOverlayImage(nextImage);
54
+ window.setTimeout(() => {
55
+ setOverlayVisible(true);
56
+ window.setTimeout(() => {
57
+ setCurrentIndex(nextIdx);
58
+ setOverlayVisible(false);
59
+ isTransitioning.current = false;
60
+ timerRef.current = window.setTimeout(cycleImages, slideshowInterval);
61
+ }, transitionDuration);
62
+ }, 100);
63
+ };
64
+ cycleImages();
65
+ return () => {
66
+ if (timerRef.current) window.clearTimeout(timerRef.current);
67
+ };
68
+ }, [
69
+ slideshowStarted,
70
+ availableImages,
71
+ currentIndex,
72
+ slideshowInterval,
73
+ transitionDuration
74
+ ]);
75
+ if (validatedImages.length === 0 || !firstImage) return /* @__PURE__ */ jsx("div", { className });
76
+ const baseImage = availableImages[currentIndex] || firstImage;
77
+ return /* @__PURE__ */ jsxs("div", {
78
+ className,
79
+ children: [/* @__PURE__ */ jsx("div", {
80
+ className: "absolute inset-0 w-full h-full",
81
+ children: /* @__PURE__ */ jsx(Picture, {
82
+ alt: baseImage.at[locale] || "",
83
+ baseUrl: baseUrl.replace("{id}", baseImage.id).replace("{fn}", baseImage.fn),
84
+ className: pictureClassName,
85
+ formats: [{
86
+ size: "",
87
+ width: 1080
88
+ }],
89
+ imgClassName,
90
+ placeholder: ""
91
+ })
92
+ }), overlayImage && /* @__PURE__ */ jsx("div", {
93
+ 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"}`,
94
+ children: /* @__PURE__ */ jsx(Picture, {
95
+ alt: overlayImage.at[locale] || "",
96
+ baseUrl: baseUrl.replace("{id}", overlayImage.id).replace("{fn}", overlayImage.fn),
97
+ className: pictureClassName,
98
+ formats: [{
99
+ size: "",
100
+ width: 1080
101
+ }],
102
+ imgClassName,
103
+ placeholder: ""
104
+ })
105
+ })]
106
+ });
107
+ }
108
+
109
+ //#endregion
110
+ export { BackgroundSlideshow };
@@ -0,0 +1,16 @@
1
+ import { SVGProps } from "react";
2
+
3
+ //#region src/blurry-gradient/blurry-gradient.d.ts
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.Element;
15
+ //#endregion
16
+ export { BlurryGradient, type BlurryGradientProps };
@@ -0,0 +1,93 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+
3
+ //#region src/blurry-gradient/blurry-gradient.tsx
4
+ const BlurryGradient = (props) => {
5
+ const { description = "Decorative blurry gradient", neutralColor, primaryColor, secondaryColor, ...svgProps } = props;
6
+ const titleId = "blurryGradientTitle";
7
+ return /* @__PURE__ */ jsxs("svg", {
8
+ "aria-labelledby": titleId,
9
+ preserveAspectRatio: "none",
10
+ role: "img",
11
+ viewBox: "0 0 1000 1000",
12
+ ...svgProps,
13
+ children: [
14
+ /* @__PURE__ */ jsx("title", {
15
+ id: titleId,
16
+ children: description
17
+ }),
18
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("filter", {
19
+ colorInterpolationFilters: "sRGB",
20
+ filterUnits: "userSpaceOnUse",
21
+ height: "120%",
22
+ width: "120%",
23
+ x: "-10%",
24
+ y: "-10%",
25
+ children: [
26
+ /* @__PURE__ */ jsx("feFlood", {
27
+ floodOpacity: "0",
28
+ result: "BackgroundImageFix"
29
+ }),
30
+ /* @__PURE__ */ jsx("feBlend", {
31
+ in: "SourceGraphic",
32
+ in2: "BackgroundImageFix",
33
+ mode: "normal",
34
+ result: "shape"
35
+ }),
36
+ /* @__PURE__ */ jsx("feGaussianBlur", {
37
+ result: "effect1_foregroundBlur",
38
+ stdDeviation: "161"
39
+ })
40
+ ]
41
+ }) }),
42
+ /* @__PURE__ */ jsx("rect", {
43
+ fill: primaryColor,
44
+ height: "1000",
45
+ width: "1000"
46
+ }),
47
+ /* @__PURE__ */ jsxs("g", {
48
+ filter: "url(#blurryGradient)",
49
+ children: [
50
+ /* @__PURE__ */ jsx("circle", {
51
+ cx: "730",
52
+ cy: "559",
53
+ fill: secondaryColor,
54
+ r: "357"
55
+ }),
56
+ /* @__PURE__ */ jsx("circle", {
57
+ cx: "316",
58
+ cy: "248",
59
+ fill: primaryColor,
60
+ r: "357"
61
+ }),
62
+ /* @__PURE__ */ jsx("circle", {
63
+ cx: "509",
64
+ cy: "410",
65
+ fill: neutralColor,
66
+ r: "357"
67
+ }),
68
+ /* @__PURE__ */ jsx("circle", {
69
+ cx: "633",
70
+ cy: "232",
71
+ fill: secondaryColor,
72
+ r: "357"
73
+ }),
74
+ /* @__PURE__ */ jsx("circle", {
75
+ cx: "156",
76
+ cy: "82",
77
+ fill: primaryColor,
78
+ r: "357"
79
+ }),
80
+ /* @__PURE__ */ jsx("circle", {
81
+ cx: "150",
82
+ cy: "389",
83
+ fill: neutralColor,
84
+ r: "357"
85
+ })
86
+ ]
87
+ })
88
+ ]
89
+ });
90
+ };
91
+
92
+ //#endregion
93
+ export { BlurryGradient };
@@ -0,0 +1,2 @@
1
+ import { i as ButtonVariant, n as ButtonProps, r as ButtonSize, t as Button } from "../index-C_evL5vG.mjs";
2
+ export { Button, ButtonProps, ButtonSize, ButtonVariant };
@@ -0,0 +1,3 @@
1
+ import { t as Button } from "../button-BiSQpBbc.mjs";
2
+
3
+ export { Button };
@@ -0,0 +1,129 @@
1
+ import { tv } from "@regardio/tailwind/utils";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { Button } from "@base-ui/react/button";
4
+
5
+ //#region src/button/button.tsx
6
+ const buttonVariants = {
7
+ destructive: [
8
+ "bg-red-600",
9
+ "text-white",
10
+ "border-red-600",
11
+ "hover:bg-red-700",
12
+ "hover:border-red-700",
13
+ "focus-visible:ring-2",
14
+ "focus-visible:ring-red-500",
15
+ "focus-visible:ring-offset-2"
16
+ ],
17
+ ghost: [
18
+ "bg-transparent",
19
+ "text-gray-900",
20
+ "border-transparent",
21
+ "hover:bg-gray-100",
22
+ "hover:border-transparent",
23
+ "focus-visible:ring-2",
24
+ "focus-visible:ring-gray-500",
25
+ "focus-visible:ring-offset-2"
26
+ ],
27
+ outline: [
28
+ "bg-transparent",
29
+ "text-gray-900",
30
+ "border-gray-300",
31
+ "hover:bg-gray-50",
32
+ "hover:border-gray-400",
33
+ "focus-visible:ring-2",
34
+ "focus-visible:ring-gray-500",
35
+ "focus-visible:ring-offset-2"
36
+ ],
37
+ primary: [
38
+ "bg-blue-600",
39
+ "text-white",
40
+ "border-blue-600",
41
+ "hover:bg-blue-700",
42
+ "hover:border-blue-700",
43
+ "focus-visible:ring-2",
44
+ "focus-visible:ring-blue-500",
45
+ "focus-visible:ring-offset-2"
46
+ ],
47
+ secondary: [
48
+ "bg-gray-100",
49
+ "text-gray-900",
50
+ "border-gray-300",
51
+ "hover:bg-gray-200",
52
+ "hover:border-gray-400",
53
+ "focus-visible:ring-2",
54
+ "focus-visible:ring-gray-500",
55
+ "focus-visible:ring-offset-2"
56
+ ]
57
+ };
58
+ const button = tv({
59
+ base: [
60
+ "inline-flex",
61
+ "items-center",
62
+ "justify-center",
63
+ "border",
64
+ "transition-colors",
65
+ "duration-200",
66
+ "ease-in-out",
67
+ "disabled:opacity-50",
68
+ "disabled:cursor-not-allowed",
69
+ "disabled:pointer-events-none"
70
+ ],
71
+ defaultVariants: {
72
+ size: "md",
73
+ variant: "primary"
74
+ },
75
+ variants: {
76
+ size: {
77
+ "2xl": [
78
+ "px-10",
79
+ "py-5",
80
+ "text-2xl",
81
+ "font-medium",
82
+ "rounded-lg"
83
+ ],
84
+ lg: [
85
+ "px-6",
86
+ "py-3",
87
+ "text-lg",
88
+ "font-medium",
89
+ "rounded-lg"
90
+ ],
91
+ md: [
92
+ "px-4",
93
+ "py-2",
94
+ "text-base",
95
+ "font-medium",
96
+ "rounded-md"
97
+ ],
98
+ sm: [
99
+ "px-3",
100
+ "py-1.5",
101
+ "text-sm",
102
+ "font-medium",
103
+ "rounded-md"
104
+ ],
105
+ xl: [
106
+ "px-8",
107
+ "py-4",
108
+ "text-xl",
109
+ "font-medium",
110
+ "rounded-lg"
111
+ ]
112
+ },
113
+ variant: buttonVariants
114
+ }
115
+ });
116
+ const Button$1 = ({ children, className, variant, size, ...props }) => {
117
+ return /* @__PURE__ */ jsx(Button, {
118
+ className: button({
119
+ className,
120
+ size,
121
+ variant
122
+ }),
123
+ ...props,
124
+ children
125
+ });
126
+ };
127
+
128
+ //#endregion
129
+ export { Button$1 as t };
@@ -0,0 +1,74 @@
1
+ import { HTMLAttributes } from "react";
2
+ import { EmblaCarouselType, EmblaOptionsType } from "embla-carousel";
3
+
4
+ //#region src/carousel/carousel-item.d.ts
5
+ interface CarouselItemProps extends HTMLAttributes<HTMLDivElement> {
6
+ "aria-label"?: string;
7
+ ref?: React.Ref<HTMLDivElement>;
8
+ }
9
+ declare const CarouselItem: ({
10
+ className,
11
+ ref,
12
+ ...props
13
+ }: CarouselItemProps) => React.JSX.Element;
14
+ //#endregion
15
+ //#region src/carousel/carousel-root.d.ts
16
+ type CarouselApi = EmblaCarouselType;
17
+ interface CarouselContextValue {
18
+ api: CarouselApi | undefined;
19
+ scrollPrev: () => void;
20
+ scrollNext: () => void;
21
+ canScrollPrev: boolean;
22
+ canScrollNext: boolean;
23
+ }
24
+ declare function useCarousel(): CarouselContextValue;
25
+ interface CarouselRootProps extends HTMLAttributes<HTMLDivElement> {
26
+ opts?: EmblaOptionsType;
27
+ setApi?: (api: CarouselApi) => void;
28
+ orientation?: "horizontal" | "vertical";
29
+ ref?: React.Ref<HTMLDivElement>;
30
+ }
31
+ declare const CarouselRoot: ({
32
+ children,
33
+ className,
34
+ opts,
35
+ orientation,
36
+ setApi,
37
+ ref,
38
+ ...props
39
+ }: CarouselRootProps) => React.JSX.Element;
40
+ //#endregion
41
+ //#region src/carousel/carousel-content.d.ts
42
+ interface CarouselContentProps extends HTMLAttributes<HTMLDivElement> {
43
+ ref?: React.Ref<HTMLDivElement>;
44
+ }
45
+ declare const CarouselContent: ({
46
+ className,
47
+ ref,
48
+ ...props
49
+ }: CarouselContentProps) => React.JSX.Element;
50
+ //#endregion
51
+ //#region src/carousel/carousel-next.d.ts
52
+ interface CarouselNextProps extends HTMLAttributes<HTMLButtonElement> {
53
+ ref?: React.Ref<HTMLButtonElement>;
54
+ }
55
+ declare const CarouselNext: ({
56
+ className,
57
+ ref,
58
+ ...props
59
+ }: CarouselNextProps) => React.JSX.Element;
60
+ //#endregion
61
+ //#region src/carousel/carousel-previous.d.ts
62
+ interface CarouselPreviousProps extends HTMLAttributes<HTMLButtonElement> {
63
+ ref?: React.Ref<HTMLButtonElement>;
64
+ }
65
+ declare const CarouselPrevious: ({
66
+ className,
67
+ ref,
68
+ ...props
69
+ }: CarouselPreviousProps) => React.JSX.Element;
70
+ declare namespace index_parts_d_exports {
71
+ export { CarouselContent as Content, CarouselItem as Item, CarouselNext as Next, CarouselPrevious as Previous, CarouselRoot as Root };
72
+ }
73
+ //#endregion
74
+ export { index_parts_d_exports as Carousel, type CarouselApi, type CarouselItemProps, type CarouselRootProps, useCarousel };
@@ -0,0 +1,136 @@
1
+ import { t as __exportAll } from "../chunk-BTpB_u-K.mjs";
2
+ import { t as Button } from "../button-BiSQpBbc.mjs";
3
+ import { createContext, useCallback, useContext, useEffect, useState } from "react";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import useEmblaCarousel from "embla-carousel-react";
6
+
7
+ //#region src/carousel/carousel-root.tsx
8
+ const CarouselContext = createContext(null);
9
+ function useCarousel() {
10
+ const context = useContext(CarouselContext);
11
+ if (!context) throw new Error("useCarousel must be used within a <Carousel.Root />");
12
+ return context;
13
+ }
14
+ const CarouselRoot = function CarouselRoot({ children, className, opts, orientation = "horizontal", setApi, ref, ...props }) {
15
+ const [emblaRef, emblaApi] = useEmblaCarousel({
16
+ ...opts,
17
+ axis: orientation === "horizontal" ? "x" : "y"
18
+ });
19
+ const [canScrollPrev, setCanScrollPrev] = useState(false);
20
+ const [canScrollNext, setCanScrollNext] = useState(false);
21
+ const onSelect = useCallback((api) => {
22
+ if (!api) return;
23
+ setCanScrollPrev(api.canScrollPrev());
24
+ setCanScrollNext(api.canScrollNext());
25
+ }, []);
26
+ const scrollPrev = useCallback(() => {
27
+ emblaApi?.scrollPrev();
28
+ }, [emblaApi]);
29
+ const scrollNext = useCallback(() => {
30
+ emblaApi?.scrollNext();
31
+ }, [emblaApi]);
32
+ const handleKeyDown = useCallback((event) => {
33
+ if (event.key === "ArrowLeft") {
34
+ event.preventDefault();
35
+ scrollPrev();
36
+ } else if (event.key === "ArrowRight") {
37
+ event.preventDefault();
38
+ scrollNext();
39
+ }
40
+ }, [scrollPrev, scrollNext]);
41
+ useEffect(() => {
42
+ if (!emblaApi || !setApi) return;
43
+ setApi(emblaApi);
44
+ }, [emblaApi, setApi]);
45
+ useEffect(() => {
46
+ if (!emblaApi) return;
47
+ onSelect(emblaApi);
48
+ emblaApi.on("reInit", onSelect);
49
+ emblaApi.on("select", onSelect);
50
+ return () => {
51
+ emblaApi?.off("select", onSelect);
52
+ };
53
+ }, [emblaApi, onSelect]);
54
+ return /* @__PURE__ */ jsx(CarouselContext.Provider, {
55
+ value: {
56
+ api: emblaApi,
57
+ canScrollNext,
58
+ canScrollPrev,
59
+ scrollNext,
60
+ scrollPrev
61
+ },
62
+ children: /* @__PURE__ */ jsx("section", {
63
+ "aria-label": "Carousel",
64
+ "aria-roledescription": "carousel",
65
+ className,
66
+ onKeyDownCapture: handleKeyDown,
67
+ ref,
68
+ ...props,
69
+ children: /* @__PURE__ */ jsx("div", {
70
+ ref: emblaRef,
71
+ children: /* @__PURE__ */ jsx("div", { children })
72
+ })
73
+ })
74
+ });
75
+ };
76
+
77
+ //#endregion
78
+ //#region src/carousel/carousel-content.tsx
79
+ const CarouselContent = function CarouselContent({ className, ref, ...props }) {
80
+ return /* @__PURE__ */ jsx("div", {
81
+ className,
82
+ ref,
83
+ ...props
84
+ });
85
+ };
86
+
87
+ //#endregion
88
+ //#region src/carousel/carousel-item.tsx
89
+ const CarouselItem = function CarouselItem({ className, ref, ...props }) {
90
+ return /* @__PURE__ */ jsx("div", {
91
+ "aria-roledescription": "slide",
92
+ className,
93
+ ref,
94
+ role: "group",
95
+ ...props
96
+ });
97
+ };
98
+
99
+ //#endregion
100
+ //#region src/carousel/carousel-next.tsx
101
+ const CarouselNext = function CarouselNext({ className, ref, ...props }) {
102
+ const { canScrollNext, scrollNext } = useCarousel();
103
+ return /* @__PURE__ */ jsx(Button, {
104
+ className,
105
+ disabled: !canScrollNext,
106
+ onClick: scrollNext,
107
+ ref,
108
+ ...props
109
+ });
110
+ };
111
+
112
+ //#endregion
113
+ //#region src/carousel/carousel-previous.tsx
114
+ const CarouselPrevious = function CarouselPrevious({ className, ref, ...props }) {
115
+ const { canScrollPrev, scrollPrev } = useCarousel();
116
+ return /* @__PURE__ */ jsx(Button, {
117
+ className,
118
+ disabled: !canScrollPrev,
119
+ onClick: scrollPrev,
120
+ ref,
121
+ ...props
122
+ });
123
+ };
124
+
125
+ //#endregion
126
+ //#region src/carousel/index.parts.ts
127
+ var index_parts_exports = /* @__PURE__ */ __exportAll({
128
+ Content: () => CarouselContent,
129
+ Item: () => CarouselItem,
130
+ Next: () => CarouselNext,
131
+ Previous: () => CarouselPrevious,
132
+ Root: () => CarouselRoot
133
+ });
134
+
135
+ //#endregion
136
+ export { index_parts_exports as Carousel, useCarousel };
@@ -0,0 +1,28 @@
1
+ import { ComponentProps } from "react";
2
+ import { Checkbox as Checkbox$1 } from "@base-ui/react/checkbox";
3
+
4
+ //#region src/checkbox/checkbox.d.ts
5
+ type CheckboxSize = "sm" | "md" | "lg";
6
+ interface CheckboxRootProps extends Omit<ComponentProps<typeof Checkbox$1.Root>, "className"> {
7
+ className?: string;
8
+ size?: CheckboxSize;
9
+ }
10
+ interface CheckboxIndicatorProps extends Omit<ComponentProps<typeof Checkbox$1.Indicator>, "className"> {
11
+ className?: string;
12
+ }
13
+ declare const CheckboxRoot: ({
14
+ className,
15
+ size,
16
+ ...props
17
+ }: CheckboxRootProps) => React.JSX.Element;
18
+ declare const CheckboxIndicator: ({
19
+ className,
20
+ children,
21
+ ...props
22
+ }: CheckboxIndicatorProps) => React.JSX.Element;
23
+ declare const Checkbox: {
24
+ Indicator: typeof CheckboxIndicator;
25
+ Root: typeof CheckboxRoot;
26
+ };
27
+ //#endregion
28
+ export { Checkbox, CheckboxIndicator, type CheckboxIndicatorProps, CheckboxRoot, type CheckboxRootProps, type CheckboxSize };
@@ -0,0 +1,70 @@
1
+ import { tv } from "@regardio/tailwind/utils";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { Checkbox as Checkbox$1 } from "@base-ui/react/checkbox";
4
+
5
+ //#region src/checkbox/checkbox.tsx
6
+ const checkboxRoot = tv({
7
+ base: [
8
+ "h-4",
9
+ "w-4",
10
+ "rounded",
11
+ "border",
12
+ "border-gray-300",
13
+ "bg-white",
14
+ "focus:outline-none",
15
+ "focus:ring-2",
16
+ "focus:ring-blue-500",
17
+ "focus:ring-offset-2",
18
+ "disabled:cursor-not-allowed",
19
+ "disabled:opacity-50",
20
+ "data-[checked]:bg-blue-600",
21
+ "data-[checked]:border-blue-600",
22
+ "transition-colors",
23
+ "duration-200",
24
+ "cursor-pointer"
25
+ ],
26
+ defaultVariants: { size: "md" },
27
+ variants: { size: {
28
+ lg: ["h-5", "w-5"],
29
+ md: ["h-4", "w-4"],
30
+ sm: ["h-3", "w-3"]
31
+ } }
32
+ });
33
+ const checkboxIndicator = tv({ base: [
34
+ "flex",
35
+ "items-center",
36
+ "justify-center",
37
+ "text-white",
38
+ "data-[unchecked]:invisible"
39
+ ] });
40
+ const CheckboxRoot = ({ className, size = "md", ...props }) => {
41
+ return /* @__PURE__ */ jsx(Checkbox$1.Root, {
42
+ className: checkboxRoot({
43
+ className,
44
+ size
45
+ }),
46
+ ...props
47
+ });
48
+ };
49
+ const CheckboxIndicator = ({ className, children, ...props }) => {
50
+ return /* @__PURE__ */ jsx(Checkbox$1.Indicator, {
51
+ className: checkboxIndicator({ className }),
52
+ ...props,
53
+ children: children || /* @__PURE__ */ jsx("svg", {
54
+ fill: "none",
55
+ height: "12",
56
+ stroke: "currentColor",
57
+ strokeWidth: "2",
58
+ viewBox: "0 0 12 12",
59
+ width: "12",
60
+ children: /* @__PURE__ */ jsx("polyline", { points: "2,6 5,9 10,3" })
61
+ })
62
+ });
63
+ };
64
+ const Checkbox = {
65
+ Indicator: CheckboxIndicator,
66
+ Root: CheckboxRoot
67
+ };
68
+
69
+ //#endregion
70
+ export { Checkbox, CheckboxIndicator, CheckboxRoot };