@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,71 @@
1
+ import { n as replaceSpecialChars } from "../text-CPlUND-Z.mjs";
2
+ import { cn } from "@regardio/tailwind/utils";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { MDXProvider } from "@mdx-js/react";
5
+ import Markdown from "markdown-to-jsx";
6
+
7
+ //#region src/markdown-container/markdown-container.tsx
8
+ const doubleNewlineRegex = /\n\n+/;
9
+ function processTextOutsideMDXComponents(text, locale) {
10
+ const mdxTagRegex = /(<\/?[A-Za-z][^>]*>)/g;
11
+ return text.split(mdxTagRegex).map((part) => mdxTagRegex.test(part) ? part : replaceSpecialChars(part, locale)).join("");
12
+ }
13
+ function transformLink(to) {
14
+ const targetDomainSubstring = "regard";
15
+ if (typeof to === "string") try {
16
+ const url = new URL(to);
17
+ if (url.hostname.includes(targetDomainSubstring)) return url.pathname + (url.search ?? "") + (url.hash ?? "");
18
+ return to;
19
+ } catch {
20
+ return to;
21
+ }
22
+ else if (to?.pathname) return to.pathname + (to.search ?? "") + (to.hash ?? "");
23
+ return "";
24
+ }
25
+ const truncateText = (text, maxSentences, maxCharacters, maxParagraphs) => {
26
+ if (maxSentences === void 0 && maxCharacters === void 0 && maxParagraphs === void 0) return text;
27
+ const paragraphs = text.split(doubleNewlineRegex);
28
+ let truncatedText = "";
29
+ let charCount = 0;
30
+ let sentenceCount = 0;
31
+ let paragraphCount = 0;
32
+ for (const paragraph of paragraphs) {
33
+ if (maxParagraphs !== void 0 && paragraphCount >= maxParagraphs) break;
34
+ const sentenceRegex = /(?<!\.\.\.)(?<!\b\w\.)\.(?:\s+|\n+)/g;
35
+ const parts = paragraph.split(sentenceRegex);
36
+ const delimiters = paragraph.match(sentenceRegex) || [];
37
+ for (let i = 0; i < parts.length; i++) {
38
+ const part = parts[i];
39
+ const delimiter = delimiters[i] || "";
40
+ if (part !== void 0) if ((maxSentences === void 0 || sentenceCount < maxSentences) && (maxCharacters === void 0 || charCount + part.length + delimiter.length <= maxCharacters)) {
41
+ truncatedText += part + delimiter;
42
+ charCount += part.length + delimiter.length;
43
+ if (delimiter.includes(".")) sentenceCount++;
44
+ } else break;
45
+ }
46
+ paragraphCount++;
47
+ if (maxSentences !== void 0 && sentenceCount >= maxSentences || maxCharacters !== void 0 && charCount >= maxCharacters) break;
48
+ if (paragraphCount < paragraphs.length) truncatedText += "\n\n";
49
+ }
50
+ return truncatedText.trim();
51
+ };
52
+ const MarkdownContainer = (props) => {
53
+ let processedText = processTextOutsideMDXComponents(props.children?.toString() || "", props.locale);
54
+ if (Number.isInteger(props.sentences) || Number.isInteger(props.characters) || Number.isInteger(props.paragraphs)) processedText = truncateText(processedText, props.sentences, props.characters, props.paragraphs);
55
+ return /* @__PURE__ */ jsx(MDXProvider, {
56
+ components: props.mdxComponents,
57
+ children: /* @__PURE__ */ jsx(Markdown, {
58
+ className: cn("markdown", props.className),
59
+ options: {
60
+ disableParsingRawHTML: false,
61
+ forceWrapper: true,
62
+ tagfilter: false,
63
+ ...props.markdownOverrides ? { overrides: props.markdownOverrides } : {}
64
+ },
65
+ children: processedText
66
+ })
67
+ });
68
+ };
69
+
70
+ //#endregion
71
+ export { MarkdownContainer, transformLink };
@@ -0,0 +1,24 @@
1
+ import { t as Input } from "../index-Bm-tWhsb.mjs";
2
+ import * as react_jsx_runtime28 from "react/jsx-runtime";
3
+
4
+ //#region src/password-input/password-input.d.ts
5
+ declare const passwordInputVariants: {
6
+ readonly default: readonly [];
7
+ readonly withToggle: readonly [];
8
+ };
9
+ type PasswordInputVariant = keyof typeof passwordInputVariants;
10
+ interface PasswordInputProps extends Omit<React.ComponentProps<typeof Input>, 'type' | 'variant'> {
11
+ className?: string;
12
+ variant?: PasswordInputVariant;
13
+ inputVariant?: 'default' | 'error' | 'success';
14
+ showToggle?: boolean;
15
+ }
16
+ declare const PasswordInput: ({
17
+ className,
18
+ variant,
19
+ inputVariant,
20
+ showToggle,
21
+ ...props
22
+ }: PasswordInputProps) => react_jsx_runtime28.JSX.Element;
23
+ //#endregion
24
+ export { PasswordInput, type PasswordInputProps };
@@ -0,0 +1,92 @@
1
+ import { t as Button } from "../button-BiSQpBbc.mjs";
2
+ import { t as Input } from "../input-CtR6aRVi.mjs";
3
+ import { useState } from "react";
4
+ import { tv } from "@regardio/tailwind/utils";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+
7
+ //#region src/password-input/password-input.tsx
8
+ const passwordInput = tv({
9
+ base: ["relative"],
10
+ defaultVariants: { variant: "default" },
11
+ variants: { variant: {
12
+ default: [],
13
+ withToggle: []
14
+ } }
15
+ });
16
+ const toggleButton = tv({ base: [
17
+ "absolute",
18
+ "right-3",
19
+ "top-1/2",
20
+ "-translate-y-1/2",
21
+ "flex",
22
+ "h-5",
23
+ "w-5",
24
+ "cursor-pointer",
25
+ "items-center",
26
+ "justify-center",
27
+ "text-gray-500",
28
+ "hover:text-gray-700",
29
+ "focus:outline-none",
30
+ "focus:ring-2",
31
+ "focus:ring-blue-500",
32
+ "focus:ring-offset-2",
33
+ "rounded",
34
+ "transition-colors",
35
+ "duration-200"
36
+ ] });
37
+ const PasswordInput = ({ className, variant = "default", inputVariant = "default", showToggle = true, ...props }) => {
38
+ const [showPassword, setShowPassword] = useState(false);
39
+ const togglePasswordVisibility = () => {
40
+ setShowPassword(!showPassword);
41
+ };
42
+ return /* @__PURE__ */ jsxs("div", {
43
+ className: passwordInput({
44
+ className,
45
+ variant
46
+ }),
47
+ children: [/* @__PURE__ */ jsx(Input, {
48
+ autoComplete: "off",
49
+ className: showToggle ? "pr-10" : "",
50
+ type: showPassword ? "text" : "password",
51
+ variant: inputVariant,
52
+ ...props
53
+ }), showToggle && /* @__PURE__ */ jsx(Button, {
54
+ "aria-label": showPassword ? "Hide password" : "Show password",
55
+ className: toggleButton(),
56
+ onClick: togglePasswordVisibility,
57
+ size: "sm",
58
+ variant: "ghost",
59
+ children: showPassword ? /* @__PURE__ */ jsx("svg", {
60
+ className: "h-4 w-4",
61
+ fill: "none",
62
+ stroke: "currentColor",
63
+ viewBox: "0 0 24 24",
64
+ children: /* @__PURE__ */ jsx("path", {
65
+ d: "M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21",
66
+ strokeLinecap: "round",
67
+ strokeLinejoin: "round",
68
+ strokeWidth: 2
69
+ })
70
+ }) : /* @__PURE__ */ jsxs("svg", {
71
+ className: "h-4 w-4",
72
+ fill: "none",
73
+ stroke: "currentColor",
74
+ viewBox: "0 0 24 24",
75
+ children: [/* @__PURE__ */ jsx("path", {
76
+ d: "M15 12a3 3 0 11-6 0 3 3 0 016 0z",
77
+ strokeLinecap: "round",
78
+ strokeLinejoin: "round",
79
+ strokeWidth: 2
80
+ }), /* @__PURE__ */ jsx("path", {
81
+ d: "M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z",
82
+ strokeLinecap: "round",
83
+ strokeLinejoin: "round",
84
+ strokeWidth: 2
85
+ })]
86
+ })
87
+ })]
88
+ });
89
+ };
90
+
91
+ //#endregion
92
+ export { PasswordInput };
@@ -1,26 +1,27 @@
1
- import react__default from 'react';
1
+ import React from "react";
2
2
 
3
+ //#region src/picture/picture.d.ts
3
4
  declare const screenSizeVariants: {
4
- readonly lg: 1280;
5
- readonly max: 1920;
6
- readonly md: 960;
7
- readonly min: 360;
8
- readonly sm: 640;
9
- readonly xl: 1600;
10
- readonly xs: 480;
5
+ readonly lg: 1280;
6
+ readonly max: 1920;
7
+ readonly md: 960;
8
+ readonly min: 360;
9
+ readonly sm: 640;
10
+ readonly xl: 1600;
11
+ readonly xs: 480;
11
12
  };
12
13
  type ImageFormat = {
13
- size: string;
14
- width: number;
14
+ size: string;
15
+ width: number;
15
16
  };
16
17
  interface PictureProps {
17
- alt: string;
18
- baseUrl: string;
19
- className?: string;
20
- formats?: ImageFormat[];
21
- imgClassName?: string;
22
- placeholder?: string;
23
- sizes?: string;
18
+ alt: string;
19
+ baseUrl: string;
20
+ className?: string;
21
+ formats?: ImageFormat[];
22
+ imgClassName?: string;
23
+ placeholder?: string;
24
+ sizes?: string;
24
25
  }
25
26
  /**
26
27
  * Generic Picture component that works with any image provider
@@ -33,6 +34,6 @@ interface PictureProps {
33
34
  * @param placeholder - Placeholder to replace in baseUrl (default: '{format}')
34
35
  * @param sizes - Custom sizes attribute
35
36
  */
36
- declare const Picture: react__default.FC<PictureProps>;
37
-
38
- export { type ImageFormat, Picture, type PictureProps, screenSizeVariants };
37
+ declare const Picture: React.FC<PictureProps>;
38
+ //#endregion
39
+ export { type ImageFormat, Picture, type PictureProps, screenSizeVariants };
@@ -0,0 +1,3 @@
1
+ import { n as screenSizeVariants, t as Picture } from "../picture-DkX3W5zl.mjs";
2
+
3
+ export { Picture, screenSizeVariants };
@@ -0,0 +1,69 @@
1
+ import { cn } from "@regardio/tailwind/utils";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+
4
+ //#region src/picture/picture.tsx
5
+ const screenSizeVariants = {
6
+ lg: 1280,
7
+ max: 1920,
8
+ md: 960,
9
+ min: 360,
10
+ sm: 640,
11
+ xl: 1600,
12
+ xs: 480
13
+ };
14
+ /**
15
+ * Generic Picture component that works with any image provider
16
+ *
17
+ * @param alt - Alt text for the image
18
+ * @param baseUrl - Base URL with optional placeholder (e.g., 'https://example.com/images/{format}/image.jpg')
19
+ * @param className - Optional class for the picture element
20
+ * @param formats - Custom formats with size and width
21
+ * @param imgClassName - Optional class for the img element
22
+ * @param placeholder - Placeholder to replace in baseUrl (default: '{format}')
23
+ * @param sizes - Custom sizes attribute
24
+ */
25
+ const Picture = ({ alt, baseUrl, className, formats, imgClassName, placeholder = "{format}", sizes = "(max-width: 480px) 480px, (max-width: 768px) 600px, (max-width: 1200px) 1024px, 1920px" }) => {
26
+ const imageFormats = formats || [
27
+ {
28
+ size: "480x360",
29
+ width: 480
30
+ },
31
+ {
32
+ size: "600x600",
33
+ width: 600
34
+ },
35
+ {
36
+ size: "1024x768",
37
+ width: 1024
38
+ },
39
+ {
40
+ size: "1920x1440",
41
+ width: 1920
42
+ }
43
+ ];
44
+ if (imageFormats.length === 0) return null;
45
+ if (imageFormats.length === 1 && imageFormats[0]?.size === "" || !baseUrl.includes(placeholder)) return /* @__PURE__ */ jsx("img", {
46
+ alt,
47
+ className: cn(className, imgClassName),
48
+ src: baseUrl
49
+ });
50
+ const srcSet = imageFormats.map(({ size, width }) => {
51
+ return `${baseUrl.replace(placeholder, size)} ${width}w`;
52
+ }).join(", ");
53
+ const defaultFormat = imageFormats[0];
54
+ const defaultSrc = defaultFormat ? baseUrl.replace(placeholder, defaultFormat.size) : baseUrl;
55
+ return /* @__PURE__ */ jsxs("picture", {
56
+ className,
57
+ children: [/* @__PURE__ */ jsx("source", {
58
+ sizes,
59
+ srcSet
60
+ }), /* @__PURE__ */ jsx("img", {
61
+ alt,
62
+ className: cn(imgClassName),
63
+ src: defaultSrc
64
+ })]
65
+ });
66
+ };
67
+
68
+ //#endregion
69
+ export { screenSizeVariants as n, Picture as t };
@@ -1,10 +1,11 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
2
 
3
+ //#region src/protected-email/protected-email.d.ts
3
4
  interface ProtectedEmailProps {
4
- username: string;
5
- domain: string;
6
- text?: string;
7
- className?: string;
5
+ username: string;
6
+ domain: string;
7
+ text?: string;
8
+ className?: string;
8
9
  }
9
10
  /**
10
11
  * ProtectedEmail component that obfuscates email addresses to protect from scrapers.
@@ -15,6 +16,11 @@ interface ProtectedEmailProps {
15
16
  * @param text - Optional display text (defaults to username(at)domain)
16
17
  * @param className - Optional CSS class name
17
18
  */
18
- declare function ProtectedEmail({ username, domain, text, className }: ProtectedEmailProps): react_jsx_runtime.JSX.Element;
19
-
20
- export { ProtectedEmail, type ProtectedEmailProps };
19
+ declare function ProtectedEmail({
20
+ username,
21
+ domain,
22
+ text,
23
+ className
24
+ }: ProtectedEmailProps): react_jsx_runtime0.JSX.Element;
25
+ //#endregion
26
+ export { ProtectedEmail, type ProtectedEmailProps };
@@ -0,0 +1,37 @@
1
+ import { useEffect, useState } from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+
4
+ //#region src/protected-email/protected-email.tsx
5
+ /**
6
+ * ProtectedEmail component that obfuscates email addresses to protect from scrapers.
7
+ * The email is only assembled client-side with JavaScript, making it harder for scrapers to extract.
8
+ *
9
+ * @param username - The part before the @ symbol
10
+ * @param domain - The part after the @ symbol
11
+ * @param text - Optional display text (defaults to username(at)domain)
12
+ * @param className - Optional CSS class name
13
+ */
14
+ function ProtectedEmail({ username, domain, text, className }) {
15
+ const [mounted, setMounted] = useState(false);
16
+ useEffect(() => {
17
+ setMounted(true);
18
+ }, []);
19
+ const fallbackText = text || `${username}(at)${domain}`;
20
+ const handleClick = (e) => {
21
+ if (mounted) {
22
+ window.location.href = `mailto:${username}@${domain}`;
23
+ e.preventDefault();
24
+ }
25
+ };
26
+ return /* @__PURE__ */ jsx("a", {
27
+ "aria-label": `Email address: ${username} at ${domain}`,
28
+ className,
29
+ "data-email-protected": "true",
30
+ href: mounted ? "#email-protected" : void 0,
31
+ onClick: handleClick,
32
+ children: fallbackText
33
+ });
34
+ }
35
+
36
+ //#endregion
37
+ export { ProtectedEmail };
@@ -0,0 +1,37 @@
1
+ import { ComponentProps } from "react";
2
+ import * as react_jsx_runtime24 from "react/jsx-runtime";
3
+ import { Radio as Radio$1 } from "@base-ui/react/radio";
4
+
5
+ //#region src/radio/radio.d.ts
6
+ type RadioSize = 'sm' | 'md' | 'lg';
7
+ interface RadioRootProps extends Omit<ComponentProps<typeof Radio$1.Root>, 'className'> {
8
+ className?: string;
9
+ size?: RadioSize;
10
+ }
11
+ interface RadioIndicatorProps extends Omit<ComponentProps<typeof Radio$1.Indicator>, 'className'> {
12
+ className?: string;
13
+ }
14
+ declare const RadioRoot: ({
15
+ className,
16
+ size,
17
+ ...props
18
+ }: RadioRootProps) => react_jsx_runtime24.JSX.Element;
19
+ declare const RadioIndicator: ({
20
+ className,
21
+ children,
22
+ ...props
23
+ }: RadioIndicatorProps) => react_jsx_runtime24.JSX.Element;
24
+ declare const Radio: {
25
+ Indicator: ({
26
+ className,
27
+ children,
28
+ ...props
29
+ }: RadioIndicatorProps) => react_jsx_runtime24.JSX.Element;
30
+ Root: ({
31
+ className,
32
+ size,
33
+ ...props
34
+ }: RadioRootProps) => react_jsx_runtime24.JSX.Element;
35
+ };
36
+ //#endregion
37
+ export { Radio, RadioIndicator, type RadioIndicatorProps, RadioRoot, type RadioRootProps, type RadioSize };
@@ -0,0 +1,72 @@
1
+ import { tv } from "@regardio/tailwind/utils";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { Radio as Radio$1 } from "@base-ui/react/radio";
4
+
5
+ //#region src/radio/radio.tsx
6
+ const radioRoot = tv({
7
+ base: [
8
+ "h-4",
9
+ "w-4",
10
+ "rounded-full",
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 radioIndicator = tv({ base: [
34
+ "flex",
35
+ "items-center",
36
+ "justify-center",
37
+ "text-white",
38
+ "data-[unchecked]:invisible"
39
+ ] });
40
+ const RadioRoot = ({ className, size = "md", ...props }) => {
41
+ return /* @__PURE__ */ jsx(Radio$1.Root, {
42
+ className: radioRoot({
43
+ className,
44
+ size
45
+ }),
46
+ ...props
47
+ });
48
+ };
49
+ const RadioIndicator = ({ className, children, ...props }) => {
50
+ return /* @__PURE__ */ jsx(Radio$1.Indicator, {
51
+ className: radioIndicator({ className }),
52
+ ...props,
53
+ children: children || /* @__PURE__ */ jsx("svg", {
54
+ fill: "currentColor",
55
+ height: "8",
56
+ viewBox: "0 0 8 8",
57
+ width: "8",
58
+ children: /* @__PURE__ */ jsx("circle", {
59
+ cx: "4",
60
+ cy: "4",
61
+ r: "3"
62
+ })
63
+ })
64
+ });
65
+ };
66
+ const Radio = {
67
+ Indicator: RadioIndicator,
68
+ Root: RadioRoot
69
+ };
70
+
71
+ //#endregion
72
+ export { Radio, RadioIndicator, RadioRoot };
@@ -0,0 +1,17 @@
1
+ import { ComponentProps } from "react";
2
+ import * as react_jsx_runtime29 from "react/jsx-runtime";
3
+ import { RadioGroup as RadioGroup$1 } from "@base-ui/react/radio-group";
4
+
5
+ //#region src/radio-group/radio-group.d.ts
6
+ type RadioGroupOrientation = 'horizontal' | 'vertical';
7
+ interface RadioGroupProps extends Omit<ComponentProps<typeof RadioGroup$1>, 'className'> {
8
+ className?: string;
9
+ orientation?: RadioGroupOrientation;
10
+ }
11
+ declare const RadioGroup: ({
12
+ className,
13
+ orientation,
14
+ ...props
15
+ }: RadioGroupProps) => react_jsx_runtime29.JSX.Element;
16
+ //#endregion
17
+ export { RadioGroup, type RadioGroupOrientation, type RadioGroupProps };
@@ -0,0 +1,29 @@
1
+ import { tv } from "@regardio/tailwind/utils";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { RadioGroup as RadioGroup$1 } from "@base-ui/react/radio-group";
4
+
5
+ //#region src/radio-group/radio-group.tsx
6
+ const radioGroup = tv({
7
+ base: [
8
+ "flex",
9
+ "flex-col",
10
+ "gap-2"
11
+ ],
12
+ defaultVariants: { orientation: "vertical" },
13
+ variants: { orientation: {
14
+ horizontal: ["flex-row", "gap-4"],
15
+ vertical: ["flex-col", "gap-2"]
16
+ } }
17
+ });
18
+ const RadioGroup = ({ className, orientation = "vertical", ...props }) => {
19
+ return /* @__PURE__ */ jsx(RadioGroup$1, {
20
+ className: radioGroup({
21
+ className,
22
+ orientation
23
+ }),
24
+ ...props
25
+ });
26
+ };
27
+
28
+ //#endregion
29
+ export { RadioGroup };
@@ -0,0 +1,85 @@
1
+ import { ComponentProps } from "react";
2
+ import * as react_jsx_runtime31 from "react/jsx-runtime";
3
+ import { Slider as Slider$1 } from "@base-ui/react/slider";
4
+
5
+ //#region src/slider/slider.d.ts
6
+ type SliderSize = 'sm' | 'md' | 'lg';
7
+ interface SliderRootProps extends Omit<ComponentProps<typeof Slider$1.Root>, 'className'> {
8
+ className?: string;
9
+ size?: SliderSize;
10
+ }
11
+ interface SliderControlProps extends Omit<ComponentProps<typeof Slider$1.Control>, 'className'> {
12
+ className?: string;
13
+ }
14
+ interface SliderTrackProps extends Omit<ComponentProps<typeof Slider$1.Track>, 'className'> {
15
+ className?: string;
16
+ size?: SliderSize;
17
+ }
18
+ interface SliderIndicatorProps extends Omit<ComponentProps<typeof Slider$1.Indicator>, 'className'> {
19
+ className?: string;
20
+ }
21
+ interface SliderThumbProps extends Omit<ComponentProps<typeof Slider$1.Thumb>, 'className'> {
22
+ className?: string;
23
+ size?: SliderSize;
24
+ }
25
+ interface SliderValueProps extends Omit<ComponentProps<typeof Slider$1.Value>, 'className'> {
26
+ className?: string;
27
+ }
28
+ declare const SliderRoot: ({
29
+ className,
30
+ size,
31
+ ...props
32
+ }: SliderRootProps) => react_jsx_runtime31.JSX.Element;
33
+ declare const SliderControl: ({
34
+ className,
35
+ ...props
36
+ }: SliderControlProps) => react_jsx_runtime31.JSX.Element;
37
+ declare const SliderTrack: ({
38
+ className,
39
+ size,
40
+ ...props
41
+ }: SliderTrackProps) => react_jsx_runtime31.JSX.Element;
42
+ declare const SliderIndicator: ({
43
+ className,
44
+ ...props
45
+ }: SliderIndicatorProps) => react_jsx_runtime31.JSX.Element;
46
+ declare const SliderThumb: ({
47
+ className,
48
+ size,
49
+ ...props
50
+ }: SliderThumbProps) => react_jsx_runtime31.JSX.Element;
51
+ declare const SliderValue: ({
52
+ className,
53
+ ...props
54
+ }: SliderValueProps) => react_jsx_runtime31.JSX.Element;
55
+ declare const Slider: {
56
+ Control: ({
57
+ className,
58
+ ...props
59
+ }: SliderControlProps) => react_jsx_runtime31.JSX.Element;
60
+ Indicator: ({
61
+ className,
62
+ ...props
63
+ }: SliderIndicatorProps) => react_jsx_runtime31.JSX.Element;
64
+ Root: ({
65
+ className,
66
+ size,
67
+ ...props
68
+ }: SliderRootProps) => react_jsx_runtime31.JSX.Element;
69
+ Thumb: ({
70
+ className,
71
+ size,
72
+ ...props
73
+ }: SliderThumbProps) => react_jsx_runtime31.JSX.Element;
74
+ Track: ({
75
+ className,
76
+ size,
77
+ ...props
78
+ }: SliderTrackProps) => react_jsx_runtime31.JSX.Element;
79
+ Value: ({
80
+ className,
81
+ ...props
82
+ }: SliderValueProps) => react_jsx_runtime31.JSX.Element;
83
+ };
84
+ //#endregion
85
+ export { Slider, SliderControl, type SliderControlProps, SliderIndicator, type SliderIndicatorProps, SliderRoot, type SliderRootProps, type SliderSize, SliderThumb, type SliderThumbProps, SliderTrack, type SliderTrackProps, SliderValue, type SliderValueProps };