@regardio/react 0.5.5 → 0.6.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 (182) hide show
  1. package/dist/background-slideshow/index.d.mts +36 -0
  2. package/dist/background-slideshow/index.mjs +110 -0
  3. package/dist/blurry-gradient/index.d.mts +17 -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 +40 -0
  9. package/dist/carousel/index.mjs +141 -0
  10. package/dist/checkbox/index.d.mts +37 -0
  11. package/dist/checkbox/index.mjs +70 -0
  12. package/dist/checkbox-group/index.d.mts +17 -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 +6 -0
  16. package/dist/countdown/index.mjs +58 -0
  17. package/dist/field/index.d.mts +66 -0
  18. package/dist/field/index.mjs +115 -0
  19. package/dist/fieldset/index.d.mts +33 -0
  20. package/dist/fieldset/index.mjs +61 -0
  21. package/dist/form/index.d.mts +22 -0
  22. package/dist/form/index.mjs +31 -0
  23. package/dist/generic-error/{index.d.ts → index.d.mts} +22 -18
  24. package/dist/generic-error/index.mjs +57 -0
  25. package/dist/grid/index.d.mts +1197 -0
  26. package/dist/grid/index.mjs +221 -0
  27. package/dist/heading/index.d.mts +31 -0
  28. package/dist/heading/index.mjs +29 -0
  29. package/dist/highlight/index.d.mts +18 -0
  30. package/dist/highlight/index.mjs +35 -0
  31. package/dist/hooks/{use-current-route-data.d.ts → use-current-route-data.d.mts} +3 -2
  32. package/dist/hooks/use-current-route-data.mjs +20 -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 +21 -0
  35. package/dist/hooks/{use-matches-data.d.ts → use-matches-data.d.mts} +3 -2
  36. package/dist/hooks/use-matches-data.mjs +21 -0
  37. package/dist/hooks/{use-media-query.d.ts → use-media-query.d.mts} +3 -2
  38. package/dist/hooks/use-media-query.mjs +26 -0
  39. package/dist/hooks/use-mobile.d.mts +4 -0
  40. package/dist/hooks/use-mobile.mjs +20 -0
  41. package/dist/hooks/use-nonce.d.mts +8 -0
  42. package/dist/hooks/use-nonce.mjs +13 -0
  43. package/dist/hooks/{use-orientation.d.ts → use-orientation.d.mts} +3 -2
  44. package/dist/hooks/use-orientation.mjs +30 -0
  45. package/dist/hooks/use-user.d.mts +55 -0
  46. package/dist/hooks/use-user.mjs +39 -0
  47. package/dist/icon-button/index.d.mts +29 -0
  48. package/dist/icon-button/index.mjs +36 -0
  49. package/dist/if/index.d.mts +15 -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-Bm-tWhsb.d.mts +30 -0
  54. package/dist/index-YT2CkvL6.d.mts +36 -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 +73 -0
  59. package/dist/link/index.mjs +129 -0
  60. package/dist/list/index.d.mts +71 -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 +24 -0
  65. package/dist/password-input/index.mjs +92 -0
  66. package/dist/picture/{index.d.ts → index.d.mts} +21 -20
  67. package/dist/picture/index.mjs +3 -0
  68. package/dist/picture-DkX3W5zl.mjs +69 -0
  69. package/dist/protected-email/{index.d.ts → index.d.mts} +14 -8
  70. package/dist/protected-email/index.mjs +37 -0
  71. package/dist/radio/index.d.mts +37 -0
  72. package/dist/radio/index.mjs +72 -0
  73. package/dist/radio-group/index.d.mts +17 -0
  74. package/dist/radio-group/index.mjs +29 -0
  75. package/dist/slider/index.d.mts +85 -0
  76. package/dist/slider/index.mjs +133 -0
  77. package/dist/switch/index.d.mts +38 -0
  78. package/dist/switch/index.mjs +87 -0
  79. package/dist/text/index.d.mts +26 -0
  80. package/dist/text/index.mjs +32 -0
  81. package/dist/text-CPlUND-Z.mjs +58 -0
  82. package/dist/toggle/index.d.mts +59 -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} +4 -3
  87. package/dist/utils/text/index.mjs +3 -0
  88. package/package.json +17 -129
  89. package/src/button/button.stories.tsx +161 -0
  90. package/src/button/button.test.tsx +73 -0
  91. package/src/button/button.tsx +112 -0
  92. package/src/button/index.ts +2 -0
  93. package/src/carousel/carousel-next.tsx +2 -2
  94. package/src/carousel/carousel-previous.tsx +2 -2
  95. package/src/checkbox/checkbox.stories.tsx +118 -0
  96. package/src/checkbox/checkbox.tsx +91 -0
  97. package/src/checkbox/index.ts +2 -0
  98. package/src/checkbox-group/checkbox-group.tsx +40 -0
  99. package/src/checkbox-group/index.ts +2 -0
  100. package/src/field/field.stories.tsx +105 -0
  101. package/src/field/field.test.tsx +61 -0
  102. package/src/field/field.tsx +165 -0
  103. package/src/field/index.ts +12 -0
  104. package/src/fieldset/fieldset.stories.tsx +204 -0
  105. package/src/fieldset/fieldset.test.tsx +63 -0
  106. package/src/fieldset/fieldset.tsx +75 -0
  107. package/src/fieldset/index.ts +7 -0
  108. package/src/form/form.stories.tsx +230 -0
  109. package/src/form/form.test.tsx +68 -0
  110. package/src/form/form.tsx +38 -0
  111. package/src/form/index.ts +2 -0
  112. package/src/icon-button/icon-button.stories.tsx +128 -7
  113. package/src/icon-button/icon-button.test.tsx +152 -0
  114. package/src/icon-button/icon-button.tsx +43 -9
  115. package/src/input/index.ts +2 -0
  116. package/src/input/input.stories.tsx +151 -0
  117. package/src/input/input.test.tsx +65 -0
  118. package/src/input/input.tsx +113 -0
  119. package/src/link/link.test.tsx +169 -0
  120. package/src/password-input/index.ts +1 -1
  121. package/src/password-input/password-input.tsx +104 -27
  122. package/src/radio/index.ts +2 -0
  123. package/src/radio/radio.tsx +92 -0
  124. package/src/radio-group/index.ts +2 -0
  125. package/src/radio-group/radio-group.tsx +36 -0
  126. package/src/slider/index.ts +18 -0
  127. package/src/slider/slider.tsx +179 -0
  128. package/src/switch/index.ts +2 -0
  129. package/src/switch/switch.stories.tsx +118 -0
  130. package/src/switch/switch.tsx +101 -0
  131. package/src/toggle/index.ts +2 -0
  132. package/src/toggle/toggle.stories.tsx +232 -0
  133. package/src/toggle/toggle.test.tsx +149 -0
  134. package/src/toggle/toggle.tsx +88 -0
  135. package/src/utils/text/text.test.tsx +110 -0
  136. package/dist/background-slideshow/index.d.ts +0 -24
  137. package/dist/background-slideshow/index.js +0 -165
  138. package/dist/blurry-gradient/index.d.ts +0 -16
  139. package/dist/blurry-gradient/index.js +0 -128
  140. package/dist/carousel/index.d.ts +0 -36
  141. package/dist/carousel/index.js +0 -171
  142. package/dist/countdown/index.d.ts +0 -5
  143. package/dist/countdown/index.js +0 -73
  144. package/dist/generic-error/index.js +0 -47
  145. package/dist/grid/index.d.ts +0 -1196
  146. package/dist/grid/index.js +0 -239
  147. package/dist/heading/index.d.ts +0 -24
  148. package/dist/heading/index.js +0 -99
  149. package/dist/highlight/index.d.ts +0 -13
  150. package/dist/highlight/index.js +0 -59
  151. package/dist/hooks/use-current-route-data.js +0 -16
  152. package/dist/hooks/use-focus-search.js +0 -19
  153. package/dist/hooks/use-matches-data.js +0 -15
  154. package/dist/hooks/use-media-query.js +0 -20
  155. package/dist/hooks/use-mobile.d.ts +0 -3
  156. package/dist/hooks/use-mobile.js +0 -19
  157. package/dist/hooks/use-nonce.d.ts +0 -7
  158. package/dist/hooks/use-nonce.js +0 -8
  159. package/dist/hooks/use-orientation.js +0 -29
  160. package/dist/hooks/use-user.d.ts +0 -50
  161. package/dist/hooks/use-user.js +0 -25
  162. package/dist/icon-button/index.d.ts +0 -9
  163. package/dist/icon-button/index.js +0 -17
  164. package/dist/if/index.d.ts +0 -10
  165. package/dist/if/index.js +0 -24
  166. package/dist/iframe/index.d.ts +0 -10
  167. package/dist/iframe/index.js +0 -17
  168. package/dist/link/index.d.ts +0 -55
  169. package/dist/link/index.js +0 -195
  170. package/dist/list/index.d.ts +0 -69
  171. package/dist/list/index.js +0 -65
  172. package/dist/markdown-container/index.d.ts +0 -22
  173. package/dist/markdown-container/index.js +0 -128
  174. package/dist/password-input/index.d.ts +0 -11
  175. package/dist/password-input/index.js +0 -46
  176. package/dist/picture/index.js +0 -68
  177. package/dist/protected-email/index.js +0 -30
  178. package/dist/text/index.d.ts +0 -20
  179. package/dist/text/index.js +0 -38
  180. package/dist/utils/author/index.d.ts +0 -3
  181. package/dist/utils/author/index.js +0 -33
  182. package/dist/utils/text/index.js +0 -73
@@ -0,0 +1,36 @@
1
+ import { ReactElement } from "react";
2
+
3
+ //#region src/background-slideshow/background-slideshow.d.ts
4
+ type ImageData = {
5
+ at: Record<string, string>;
6
+ fn: string;
7
+ hu: number;
8
+ id: string;
9
+ po: boolean;
10
+ };
11
+ interface BackgroundSlideshowProps {
12
+ baseUrl: string;
13
+ className?: string;
14
+ imgClassName?: string;
15
+ locale: string;
16
+ pictureClassName?: string;
17
+ images: ImageData[];
18
+ filter?: (image: ImageData) => boolean;
19
+ slideshow?: boolean;
20
+ slideshowInterval?: number;
21
+ transitionDuration?: number;
22
+ }
23
+ declare function BackgroundSlideshow({
24
+ baseUrl,
25
+ className,
26
+ imgClassName,
27
+ locale,
28
+ pictureClassName,
29
+ images,
30
+ slideshow,
31
+ slideshowInterval,
32
+ transitionDuration,
33
+ filter
34
+ }: BackgroundSlideshowProps): ReactElement;
35
+ //#endregion
36
+ 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,17 @@
1
+ import { SVGProps } from "react";
2
+ import * as react_jsx_runtime11 from "react/jsx-runtime";
3
+
4
+ //#region src/blurry-gradient/blurry-gradient.d.ts
5
+ interface BlurryGradientProps extends SVGProps<SVGSVGElement> {
6
+ primaryColor: string;
7
+ secondaryColor: string;
8
+ neutralColor: string;
9
+ /**
10
+ * Accessible description for the gradient (for screen readers)
11
+ * @default 'Decorative blurry gradient'
12
+ */
13
+ description?: string;
14
+ }
15
+ declare const BlurryGradient: (props: BlurryGradientProps) => react_jsx_runtime11.JSX.Element;
16
+ //#endregion
17
+ 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-YT2CkvL6.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,40 @@
1
+ import * as react11 from "react";
2
+ import { HTMLAttributes } from "react";
3
+ import { EmblaCarouselType, EmblaOptionsType } from "embla-carousel";
4
+
5
+ //#region src/carousel/carousel-item.d.ts
6
+ interface CarouselItemProps extends HTMLAttributes<HTMLDivElement> {
7
+ 'aria-label'?: string;
8
+ }
9
+ declare const CarouselItem: react11.ForwardRefExoticComponent<CarouselItemProps & react11.RefAttributes<HTMLDivElement>>;
10
+ //#endregion
11
+ //#region src/carousel/carousel-root.d.ts
12
+ type CarouselApi = EmblaCarouselType;
13
+ interface CarouselContextValue {
14
+ api: CarouselApi | undefined;
15
+ scrollPrev: () => void;
16
+ scrollNext: () => void;
17
+ canScrollPrev: boolean;
18
+ canScrollNext: boolean;
19
+ }
20
+ declare function useCarousel(): CarouselContextValue;
21
+ interface CarouselRootProps extends HTMLAttributes<HTMLDivElement> {
22
+ opts?: EmblaOptionsType;
23
+ setApi?: (api: CarouselApi) => void;
24
+ orientation?: 'horizontal' | 'vertical';
25
+ }
26
+ declare const CarouselRoot: react11.ForwardRefExoticComponent<CarouselRootProps & react11.RefAttributes<HTMLDivElement>>;
27
+ //#endregion
28
+ //#region src/carousel/carousel-content.d.ts
29
+ declare const CarouselContent: react11.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & react11.RefAttributes<HTMLDivElement>>;
30
+ //#endregion
31
+ //#region src/carousel/carousel-next.d.ts
32
+ declare const CarouselNext: react11.ForwardRefExoticComponent<HTMLAttributes<HTMLButtonElement> & react11.RefAttributes<HTMLButtonElement>>;
33
+ //#endregion
34
+ //#region src/carousel/carousel-previous.d.ts
35
+ declare const CarouselPrevious: react11.ForwardRefExoticComponent<HTMLAttributes<HTMLButtonElement> & react11.RefAttributes<HTMLButtonElement>>;
36
+ declare namespace index_parts_d_exports {
37
+ export { CarouselContent as Content, CarouselItem as Item, CarouselNext as Next, CarouselPrevious as Previous, CarouselRoot as Root };
38
+ }
39
+ //#endregion
40
+ export { index_parts_d_exports as Carousel, type CarouselApi, type CarouselItemProps, type CarouselRootProps, useCarousel };
@@ -0,0 +1,141 @@
1
+ import { t as __exportAll } from "../chunk-BTpB_u-K.mjs";
2
+ import { t as Button } from "../button-BiSQpBbc.mjs";
3
+ import { createContext, forwardRef, 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 = forwardRef(({ children, className, opts, orientation = "horizontal", setApi, ...props }, ref) => {
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
+ CarouselRoot.displayName = "CarouselRoot";
77
+
78
+ //#endregion
79
+ //#region src/carousel/carousel-content.tsx
80
+ const CarouselContent = forwardRef(({ className, ...props }, ref) => {
81
+ return /* @__PURE__ */ jsx("div", {
82
+ className,
83
+ ref,
84
+ ...props
85
+ });
86
+ });
87
+ CarouselContent.displayName = "CarouselContent";
88
+
89
+ //#endregion
90
+ //#region src/carousel/carousel-item.tsx
91
+ const CarouselItem = forwardRef(({ className, ...props }, ref) => {
92
+ return /* @__PURE__ */ jsx("div", {
93
+ "aria-roledescription": "slide",
94
+ className,
95
+ ref,
96
+ role: "group",
97
+ ...props
98
+ });
99
+ });
100
+ CarouselItem.displayName = "CarouselItem";
101
+
102
+ //#endregion
103
+ //#region src/carousel/carousel-next.tsx
104
+ const CarouselNext = forwardRef(({ className, ...props }, ref) => {
105
+ const { canScrollNext, scrollNext } = useCarousel();
106
+ return /* @__PURE__ */ jsx(Button, {
107
+ className,
108
+ disabled: !canScrollNext,
109
+ onClick: scrollNext,
110
+ ref,
111
+ ...props
112
+ });
113
+ });
114
+ CarouselNext.displayName = "CarouselNext";
115
+
116
+ //#endregion
117
+ //#region src/carousel/carousel-previous.tsx
118
+ const CarouselPrevious = forwardRef(({ className, ...props }, ref) => {
119
+ const { canScrollPrev, scrollPrev } = useCarousel();
120
+ return /* @__PURE__ */ jsx(Button, {
121
+ className,
122
+ disabled: !canScrollPrev,
123
+ onClick: scrollPrev,
124
+ ref,
125
+ ...props
126
+ });
127
+ });
128
+ CarouselPrevious.displayName = "CarouselPrevious";
129
+
130
+ //#endregion
131
+ //#region src/carousel/index.parts.ts
132
+ var index_parts_exports = /* @__PURE__ */ __exportAll({
133
+ Content: () => CarouselContent,
134
+ Item: () => CarouselItem,
135
+ Next: () => CarouselNext,
136
+ Previous: () => CarouselPrevious,
137
+ Root: () => CarouselRoot
138
+ });
139
+
140
+ //#endregion
141
+ export { index_parts_exports as Carousel, useCarousel };
@@ -0,0 +1,37 @@
1
+ import { ComponentProps } from "react";
2
+ import * as react_jsx_runtime7 from "react/jsx-runtime";
3
+ import { Checkbox as Checkbox$1 } from "@base-ui/react/checkbox";
4
+
5
+ //#region src/checkbox/checkbox.d.ts
6
+ type CheckboxSize = 'sm' | 'md' | 'lg';
7
+ interface CheckboxRootProps extends Omit<ComponentProps<typeof Checkbox$1.Root>, 'className'> {
8
+ className?: string;
9
+ size?: CheckboxSize;
10
+ }
11
+ interface CheckboxIndicatorProps extends Omit<ComponentProps<typeof Checkbox$1.Indicator>, 'className'> {
12
+ className?: string;
13
+ }
14
+ declare const CheckboxRoot: ({
15
+ className,
16
+ size,
17
+ ...props
18
+ }: CheckboxRootProps) => react_jsx_runtime7.JSX.Element;
19
+ declare const CheckboxIndicator: ({
20
+ className,
21
+ children,
22
+ ...props
23
+ }: CheckboxIndicatorProps) => react_jsx_runtime7.JSX.Element;
24
+ declare const Checkbox: {
25
+ Indicator: ({
26
+ className,
27
+ children,
28
+ ...props
29
+ }: CheckboxIndicatorProps) => react_jsx_runtime7.JSX.Element;
30
+ Root: ({
31
+ className,
32
+ size,
33
+ ...props
34
+ }: CheckboxRootProps) => react_jsx_runtime7.JSX.Element;
35
+ };
36
+ //#endregion
37
+ 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 };