@regardio/react 0.4.7 → 0.5.1

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 (202) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +5 -5
  3. package/dist/{components/background-slideshow.js → background-slideshow/index.js} +2 -11
  4. package/dist/{components/blurry-gradient.js → blurry-gradient/index.js} +15 -9
  5. package/dist/{components/carousel.d.ts → carousel/index.d.ts} +17 -9
  6. package/dist/{components/carousel.js → carousel/index.js} +34 -30
  7. package/dist/{components/countdown.js → countdown/index.js} +2 -11
  8. package/dist/{components/generic-error.js → generic-error/index.js} +1 -1
  9. package/dist/grid/index.d.ts +1196 -0
  10. package/dist/grid/index.js +239 -0
  11. package/dist/heading/index.d.ts +24 -0
  12. package/dist/{components/heading.js → heading/index.js} +15 -34
  13. package/dist/highlight/index.d.ts +13 -0
  14. package/dist/{components/highlight.js → highlight/index.js} +9 -17
  15. package/dist/hooks/{use-current-route-data.js → use-current-route-data/index.js} +1 -1
  16. package/dist/hooks/{use-focus-search.js → use-focus-search/index.js} +1 -1
  17. package/dist/hooks/{use-matches-data.js → use-matches-data/index.js} +1 -1
  18. package/dist/hooks/{use-media-query.js → use-media-query/index.js} +1 -1
  19. package/dist/hooks/{use-mobile.js → use-mobile/index.js} +1 -1
  20. package/dist/hooks/use-nonce/index.d.ts +6 -0
  21. package/dist/hooks/use-nonce/index.js +8 -0
  22. package/dist/hooks/{use-orientation.d.ts → use-orientation/index.d.ts} +1 -1
  23. package/dist/hooks/{use-orientation.js → use-orientation/index.js} +1 -1
  24. package/dist/hooks/{use-user.js → use-user/index.js} +1 -1
  25. package/dist/{components/icon-button.js → icon-button/index.js} +1 -1
  26. package/dist/{components/if.js → if/index.js} +1 -1
  27. package/dist/{components/iframe.js → iframe/index.js} +2 -11
  28. package/dist/{components/link.d.ts → link/index.d.ts} +19 -13
  29. package/dist/{components/link.js → link/index.js} +31 -36
  30. package/dist/list/index.d.ts +69 -0
  31. package/dist/list/index.js +65 -0
  32. package/dist/{components/markdown-container.js → markdown-container/index.js} +3 -67
  33. package/dist/{components/password-input.js → password-input/index.js} +2 -11
  34. package/dist/{components/picture.js → picture/index.js} +2 -11
  35. package/dist/{components/protected-email.d.ts → protected-email/index.d.ts} +1 -1
  36. package/dist/{components/protected-email.js → protected-email/index.js} +1 -1
  37. package/dist/text/index.d.ts +20 -0
  38. package/dist/text/index.js +38 -0
  39. package/dist/utils/author/index.d.ts +3 -0
  40. package/dist/utils/author/index.js +33 -0
  41. package/dist/utils/text/index.d.ts +15 -0
  42. package/dist/utils/text/index.js +73 -0
  43. package/package.json +92 -121
  44. package/src/{stories/BackgroundSlideshow.stories.tsx → background-slideshow/background-slideshow.stories.tsx} +1 -1
  45. package/src/{components → background-slideshow}/background-slideshow.tsx +3 -1
  46. package/src/background-slideshow/index.ts +2 -0
  47. package/src/{stories/BlurryGradient.stories.tsx → blurry-gradient/blurry-gradient.stories.tsx} +1 -1
  48. package/src/{components → blurry-gradient}/blurry-gradient.tsx +14 -8
  49. package/src/blurry-gradient/index.ts +2 -0
  50. package/src/carousel/carousel-content.tsx +16 -0
  51. package/src/carousel/carousel-item.tsx +23 -0
  52. package/src/carousel/carousel-next.tsx +22 -0
  53. package/src/carousel/carousel-previous.tsx +22 -0
  54. package/src/{components/carousel.tsx → carousel/carousel-root.tsx} +8 -78
  55. package/src/carousel/carousel.stories.tsx +89 -0
  56. package/src/carousel/index.parts.ts +5 -0
  57. package/src/carousel/index.ts +4 -0
  58. package/src/{stories/Countdown.stories.tsx → countdown/countdown.stories.tsx} +1 -1
  59. package/src/{components → countdown}/countdown.tsx +3 -7
  60. package/src/countdown/index.ts +1 -0
  61. package/src/{stories/GenericError.stories.tsx → generic-error/generic-error.stories.tsx} +1 -1
  62. package/src/{components → generic-error}/generic-error.tsx +2 -0
  63. package/src/generic-error/index.ts +2 -0
  64. package/src/grid/grid-item.tsx +188 -0
  65. package/src/grid/grid-root.tsx +72 -0
  66. package/src/grid/grid.stories.tsx +236 -0
  67. package/src/grid/index.parts.ts +2 -0
  68. package/src/grid/index.ts +5 -0
  69. package/src/{stories/Heading.stories.tsx → heading/heading.stories.tsx} +1 -1
  70. package/src/{components → heading}/heading.tsx +17 -25
  71. package/src/heading/index.ts +2 -0
  72. package/src/{stories/Highlight.stories.tsx → highlight/highlight.stories.tsx} +1 -1
  73. package/src/{components → highlight}/highlight.tsx +13 -9
  74. package/src/highlight/index.ts +2 -0
  75. package/src/hooks/use-current-route-data/index.ts +1 -0
  76. package/src/hooks/use-focus-search/index.ts +1 -0
  77. package/src/hooks/use-matches-data/index.ts +1 -0
  78. package/src/hooks/use-media-query/index.ts +1 -0
  79. package/src/hooks/use-mobile/index.ts +1 -0
  80. package/src/hooks/use-nonce/index.ts +1 -0
  81. package/src/hooks/use-orientation/index.ts +1 -0
  82. package/src/hooks/use-user/index.ts +2 -0
  83. package/src/{stories/IconButton.stories.tsx → icon-button/icon-button.stories.tsx} +1 -1
  84. package/src/icon-button/index.ts +2 -0
  85. package/src/{stories/If.stories.tsx → if/if.stories.tsx} +1 -1
  86. package/src/if/index.ts +1 -0
  87. package/src/{stories/Iframe.stories.tsx → iframe/iframe.stories.tsx} +1 -1
  88. package/src/{components → iframe}/iframe.tsx +1 -1
  89. package/src/iframe/index.ts +2 -0
  90. package/src/link/index.ts +2 -0
  91. package/src/{stories/Link.stories.tsx → link/link.stories.tsx} +1 -1
  92. package/src/{components → link}/link.tsx +39 -28
  93. package/src/list/index.parts.ts +2 -0
  94. package/src/list/index.ts +4 -0
  95. package/src/list/list-item.tsx +63 -0
  96. package/src/list/list-root-context.ts +21 -0
  97. package/src/list/list-root.tsx +81 -0
  98. package/src/list/list.css +32 -0
  99. package/src/list/list.stories.tsx +119 -0
  100. package/src/list/list.test.tsx +168 -0
  101. package/src/markdown-container/index.ts +2 -0
  102. package/src/{stories/MarkdownContainer.stories.tsx → markdown-container/markdown-container.stories.tsx} +1 -1
  103. package/src/{components → markdown-container}/markdown-container.tsx +3 -1
  104. package/src/password-input/index.ts +2 -0
  105. package/src/{stories/PasswordInput.stories.tsx → password-input/password-input.stories.tsx} +1 -1
  106. package/src/{components → password-input}/password-input.tsx +4 -4
  107. package/src/picture/index.ts +2 -0
  108. package/src/{stories/Picture.stories.tsx → picture/picture.stories.tsx} +1 -1
  109. package/src/{components → picture}/picture.tsx +2 -4
  110. package/src/protected-email/index.ts +2 -0
  111. package/src/{stories/ProtectedEmail.stories.tsx → protected-email/protected-email.stories.tsx} +1 -1
  112. package/src/{components → protected-email}/protected-email.tsx +3 -1
  113. package/src/tailwind.css +10 -0
  114. package/src/text/index.ts +2 -0
  115. package/src/{stories/Text.stories.tsx → text/text.stories.tsx} +1 -1
  116. package/src/text/text.tsx +46 -0
  117. package/src/utils/author/author.tsx +36 -0
  118. package/src/utils/author/index.ts +1 -0
  119. package/src/utils/text/index.ts +1 -0
  120. package/src/utils/text/text.tsx +103 -0
  121. package/dist/components/box.d.ts +0 -20
  122. package/dist/components/box.js +0 -50
  123. package/dist/components/definition-list.d.ts +0 -43
  124. package/dist/components/definition-list.js +0 -89
  125. package/dist/components/heading.d.ts +0 -27
  126. package/dist/components/highlight.d.ts +0 -19
  127. package/dist/components/item.d.ts +0 -70
  128. package/dist/components/item.js +0 -512
  129. package/dist/components/leaflet-map.d.ts +0 -34
  130. package/dist/components/leaflet-map.js +0 -201
  131. package/dist/components/list-item.d.ts +0 -19
  132. package/dist/components/list-item.js +0 -37
  133. package/dist/components/maptiler-map.d.ts +0 -27
  134. package/dist/components/maptiler-map.js +0 -129
  135. package/dist/components/text.d.ts +0 -20
  136. package/dist/components/text.js +0 -45
  137. package/dist/components/unordered-list.d.ts +0 -19
  138. package/dist/components/unordered-list.js +0 -39
  139. package/dist/hooks/use-nonce.d.ts +0 -12
  140. package/dist/hooks/use-nonce.js +0 -13
  141. package/dist/utils/author.d.ts +0 -9
  142. package/dist/utils/author.js +0 -55
  143. package/dist/utils/cn.d.ts +0 -9
  144. package/dist/utils/cn.js +0 -14
  145. package/dist/utils/is-route-active.d.ts +0 -19
  146. package/dist/utils/is-route-active.js +0 -56
  147. package/dist/utils/text.d.ts +0 -24
  148. package/dist/utils/text.js +0 -127
  149. package/src/components/box.tsx +0 -45
  150. package/src/components/definition-list.tsx +0 -90
  151. package/src/components/item.tsx +0 -340
  152. package/src/components/leaflet-map.tsx +0 -294
  153. package/src/components/link.test.tsx +0 -387
  154. package/src/components/list-item.tsx +0 -30
  155. package/src/components/maptiler-map.tsx +0 -181
  156. package/src/components/text.tsx +0 -38
  157. package/src/components/unordered-list.tsx +0 -32
  158. package/src/hooks/use-nonce.test.ts +0 -35
  159. package/src/stories/Box.stories.tsx +0 -83
  160. package/src/stories/Carousel.stories.tsx +0 -95
  161. package/src/stories/DefinitionList.stories.tsx +0 -51
  162. package/src/stories/Item.stories.tsx +0 -79
  163. package/src/stories/ListItem.stories.tsx +0 -38
  164. package/src/stories/UnorderedList.stories.tsx +0 -73
  165. package/src/styles/tailwind.css +0 -7
  166. package/src/test-setup.ts +0 -1
  167. package/src/utils/author.test.ts +0 -54
  168. package/src/utils/author.tsx +0 -73
  169. package/src/utils/cn.test.ts +0 -48
  170. package/src/utils/cn.ts +0 -14
  171. package/src/utils/is-route-active.test.ts +0 -80
  172. package/src/utils/is-route-active.ts +0 -100
  173. package/src/utils/text.test.ts +0 -152
  174. package/src/utils/text.tsx +0 -209
  175. package/src/vite-env.d.ts +0 -1
  176. /package/dist/{components/background-slideshow.d.ts → background-slideshow/index.d.ts} +0 -0
  177. /package/dist/{components/blurry-gradient.d.ts → blurry-gradient/index.d.ts} +0 -0
  178. /package/dist/{components/countdown.d.ts → countdown/index.d.ts} +0 -0
  179. /package/dist/{components/generic-error.d.ts → generic-error/index.d.ts} +0 -0
  180. /package/dist/hooks/{use-current-route-data.d.ts → use-current-route-data/index.d.ts} +0 -0
  181. /package/dist/hooks/{use-focus-search.d.ts → use-focus-search/index.d.ts} +0 -0
  182. /package/dist/hooks/{use-matches-data.d.ts → use-matches-data/index.d.ts} +0 -0
  183. /package/dist/hooks/{use-media-query.d.ts → use-media-query/index.d.ts} +0 -0
  184. /package/dist/hooks/{use-mobile.d.ts → use-mobile/index.d.ts} +0 -0
  185. /package/dist/hooks/{use-user.d.ts → use-user/index.d.ts} +0 -0
  186. /package/dist/{components/icon-button.d.ts → icon-button/index.d.ts} +0 -0
  187. /package/dist/{components/if.d.ts → if/index.d.ts} +0 -0
  188. /package/dist/{components/iframe.d.ts → iframe/index.d.ts} +0 -0
  189. /package/dist/{components/markdown-container.d.ts → markdown-container/index.d.ts} +0 -0
  190. /package/dist/{components/password-input.d.ts → password-input/index.d.ts} +0 -0
  191. /package/dist/{components/picture.d.ts → picture/index.d.ts} +0 -0
  192. /package/src/hooks/{use-current-route-data.ts → use-current-route-data/use-current-route-data.ts} +0 -0
  193. /package/src/hooks/{use-focus-search.ts → use-focus-search/use-focus-search.ts} +0 -0
  194. /package/src/hooks/{use-matches-data.ts → use-matches-data/use-matches-data.ts} +0 -0
  195. /package/src/hooks/{use-media-query.ts → use-media-query/use-media-query.ts} +0 -0
  196. /package/src/hooks/{use-mobile.ts → use-mobile/use-mobile.ts} +0 -0
  197. /package/src/hooks/{use-nonce.ts → use-nonce/use-nonce.ts} +0 -0
  198. /package/src/hooks/{use-orientation.ts → use-orientation/use-orientation.ts} +0 -0
  199. /package/src/hooks/{use-user.tsx → use-user/use-user.tsx} +0 -0
  200. /package/src/{components → icon-button}/icon-button.tsx +0 -0
  201. /package/src/{components → if}/if.tsx +0 -0
  202. /package/src/{styles/storybook.css → storybook.css} +0 -0
@@ -0,0 +1,69 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ComponentPropsWithoutRef, ReactNode, ForwardedRef } from 'react';
3
+
4
+ type ListItemElement = 'li' | 'dd' | 'dt' | 'div' | 'span';
5
+ type ListItemProps<T extends ListItemElement = 'li'> = Omit<ComponentPropsWithoutRef<T>, 'children'> & {
6
+ /**
7
+ * The element type to render.
8
+ * Falls back to the defaultItemElement from ListRoot context, or 'li'.
9
+ */
10
+ render?: T;
11
+ /**
12
+ * The content of the list item.
13
+ */
14
+ children?: ReactNode;
15
+ };
16
+ declare function ListItemImpl<T extends ListItemElement = 'li'>(props: ListItemProps<T>, ref: ForwardedRef<HTMLElement>): react_jsx_runtime.JSX.Element;
17
+ declare const ListItem: <T extends ListItemElement = "li">(props: ListItemProps<T> & {
18
+ ref?: ForwardedRef<HTMLElement>;
19
+ }) => ReturnType<typeof ListItemImpl>;
20
+ declare namespace ListItem {
21
+ type Props<T extends ListItemElement = 'li'> = ListItemProps<T>;
22
+ }
23
+
24
+ interface ListRootContextValue {
25
+ /**
26
+ * Default element type for list items.
27
+ * @default 'li'
28
+ */
29
+ defaultItemElement: 'li' | 'dd' | 'dt' | 'div' | 'span';
30
+ /**
31
+ * Default className to apply to all list items.
32
+ */
33
+ defaultItemClassName?: string;
34
+ }
35
+
36
+ type ListRootElement = 'ul' | 'ol' | 'dl' | 'div' | 'menu' | 'nav';
37
+ type ListRootProps<T extends ListRootElement = 'ul'> = Omit<ComponentPropsWithoutRef<T>, 'children'> & {
38
+ /**
39
+ * The element type to render.
40
+ * @default 'ul'
41
+ */
42
+ render?: T;
43
+ /**
44
+ * The content of the list.
45
+ */
46
+ children?: ReactNode;
47
+ /**
48
+ * Default element type for list items.
49
+ * When render is 'dl', defaults to 'dd'. Otherwise defaults to 'li'.
50
+ */
51
+ defaultItemElement?: ListRootContextValue['defaultItemElement'];
52
+ /**
53
+ * Default className to apply to all list items.
54
+ */
55
+ defaultItemClassName?: string;
56
+ };
57
+ declare function ListRootImpl<T extends ListRootElement = 'ul'>(props: ListRootProps<T>, ref: ForwardedRef<HTMLElement>): react_jsx_runtime.JSX.Element;
58
+ declare const ListRoot: <T extends ListRootElement = "ul">(props: ListRootProps<T> & {
59
+ ref?: ForwardedRef<HTMLElement>;
60
+ }) => ReturnType<typeof ListRootImpl>;
61
+ declare namespace ListRoot {
62
+ type Props<T extends ListRootElement = 'ul'> = ListRootProps<T>;
63
+ }
64
+
65
+ declare namespace index_parts {
66
+ export { ListItem as Item, ListRoot as Root };
67
+ }
68
+
69
+ export { index_parts as List, type ListItemProps, type ListRootContextValue, type ListRootProps };
@@ -0,0 +1,65 @@
1
+ import { createContext, forwardRef, useMemo, useContext } from 'react';
2
+ import { jsx } from 'react/jsx-runtime';
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+
10
+ // src/list/index.parts.ts
11
+ var index_parts_exports = {};
12
+ __export(index_parts_exports, {
13
+ Item: () => ListItem,
14
+ Root: () => ListRoot
15
+ });
16
+ var ListRootContext = createContext(void 0);
17
+ function useListRootContext() {
18
+ return useContext(ListRootContext);
19
+ }
20
+ function ListItemImpl(props, ref) {
21
+ const context = useListRootContext();
22
+ const { render, children, className, ...elementProps } = props;
23
+ const resolvedElement = render ?? context?.defaultItemElement ?? "li";
24
+ const resolvedClassName = context?.defaultItemClassName ? className ? `${context.defaultItemClassName} ${className}` : context.defaultItemClassName : className;
25
+ const Component = resolvedElement;
26
+ return /* @__PURE__ */ jsx(
27
+ Component,
28
+ {
29
+ className: resolvedClassName,
30
+ ref,
31
+ ...elementProps,
32
+ children
33
+ }
34
+ );
35
+ }
36
+ var ListItem = forwardRef(ListItemImpl);
37
+ function ListRootImpl(props, ref) {
38
+ const {
39
+ render = "ul",
40
+ children,
41
+ defaultItemElement,
42
+ defaultItemClassName,
43
+ ...elementProps
44
+ } = props;
45
+ const resolvedDefaultItemElement = defaultItemElement ?? (render === "dl" ? "dd" : "li");
46
+ const contextValue = useMemo(
47
+ () => ({
48
+ defaultItemClassName,
49
+ defaultItemElement: resolvedDefaultItemElement
50
+ }),
51
+ [resolvedDefaultItemElement, defaultItemClassName]
52
+ );
53
+ const Component = render;
54
+ return /* @__PURE__ */ jsx(ListRootContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
55
+ Component,
56
+ {
57
+ ref,
58
+ ...elementProps,
59
+ children
60
+ }
61
+ ) });
62
+ }
63
+ var ListRoot = forwardRef(ListRootImpl);
64
+
65
+ export { index_parts_exports as List };
@@ -1,22 +1,11 @@
1
1
  import { MDXProvider } from '@mdx-js/react';
2
+ import { cn } from '@regardio/tailwind/utils';
2
3
  import Markdown from 'markdown-to-jsx';
3
- import { defineConfig, cx } from 'cva';
4
- import { twMerge } from 'fluid-tailwindcss/tailwind-merge';
4
+ import { typographicQuotes, replaceShyInString } from '@regardio/js/text';
5
5
  import React, { isValidElement, cloneElement } from 'react';
6
6
  import { jsx } from 'react/jsx-runtime';
7
7
 
8
- // src/components/markdown-container.tsx
9
- var { cva, compose } = defineConfig({
10
- hooks: {
11
- onComplete: (className) => {
12
- return twMerge(className);
13
- }
14
- }
15
- });
16
- var cn = (...inputs) => twMerge(cx(inputs));
17
- function replaceShyInString(input) {
18
- return input.replace(/&shy;/g, "\xAD");
19
- }
8
+ // src/markdown-container/markdown-container.tsx
20
9
  function replaceShyInReactNode(node) {
21
10
  if (typeof node === "string") {
22
11
  return node.replace(/\u00AD/g, "");
@@ -43,59 +32,6 @@ function shy(input) {
43
32
  }
44
33
  return replaceShyInReactNode(input);
45
34
  }
46
- var quoteStyles = {
47
- cs: { close: "\u201D", closeSingle: "\u2019", open: "\u201E", openSingle: "\u201A" },
48
- // Danish, Norwegian - » « › ‹
49
- da: { close: "\xAB", closeSingle: "\u203A", open: "\xBB", openSingle: "\u2039" },
50
- // German (Germany, Austria) - „ " ‚ '
51
- de: { close: "\u201D", closeSingle: "\u2019", open: "\u201E", openSingle: "\u201A" },
52
- // German (Switzerland) - « » ‹ ›
53
- "de-ch": { close: "\xBB", closeSingle: "\u203A", open: "\xAB", openSingle: "\u2039" },
54
- // English (US, UK, etc.) - " " ' '
55
- en: { close: "\u201D", closeSingle: "\u2019", open: "\u201C", openSingle: "\u2018" },
56
- // Spanish, Italian, Portuguese - « » " "
57
- es: { close: "\xBB", closeSingle: "\u201D", open: "\xAB", openSingle: "\u201C" },
58
- fi: { close: "\u201D", closeSingle: "\u2019", open: "\u201D", openSingle: "\u2019" },
59
- // French - « » ‹ › (with spaces)
60
- fr: { close: " \xBB", closeSingle: " \u203A", open: "\xAB ", openSingle: "\u2039 " },
61
- hu: { close: "\u201D", closeSingle: "\u2019", open: "\u201E", openSingle: "\u201A" },
62
- it: { close: "\xBB", closeSingle: "\u201D", open: "\xAB", openSingle: "\u201C" },
63
- // Japanese - 「 」 『 』
64
- ja: { close: "\u300D", closeSingle: "\u300F", open: "\u300C", openSingle: "\u300E" },
65
- // Dutch - ' ' ' '
66
- nl: { close: "\u2019", closeSingle: "\u2019", open: "\u2018", openSingle: "\u2018" },
67
- no: { close: "\xAB", closeSingle: "\u203A", open: "\xBB", openSingle: "\u2039" },
68
- // Polish, Czech, Hungarian - „ " ‚ '
69
- pl: { close: "\u201D", closeSingle: "\u2019", open: "\u201E", openSingle: "\u201A" },
70
- pt: { close: "\xBB", closeSingle: "\u201D", open: "\xAB", openSingle: "\u201C" },
71
- // Russian - « » ‚ '
72
- ru: { close: "\xBB", closeSingle: "\u2019", open: "\xAB", openSingle: "\u201A" },
73
- // Swedish, Finnish - " " ' '
74
- sv: { close: "\u201D", closeSingle: "\u2019", open: "\u201D", openSingle: "\u2019" },
75
- // Chinese - 「 」 『 』
76
- zh: { close: "\u300D", closeSingle: "\u300F", open: "\u300C", openSingle: "\u300E" }
77
- };
78
- function getQuoteStyle(locale) {
79
- const normalized = locale.toLowerCase();
80
- const exactMatch = quoteStyles[normalized];
81
- if (exactMatch) {
82
- return exactMatch;
83
- }
84
- const baseLanguage = normalized.split("-")[0];
85
- if (baseLanguage) {
86
- const baseMatch = quoteStyles[baseLanguage];
87
- if (baseMatch) {
88
- return baseMatch;
89
- }
90
- }
91
- return quoteStyles.en;
92
- }
93
- function typographicQuotes(text, locale) {
94
- const style = getQuoteStyle(locale);
95
- let result = text.replace(/"([^"]*)"/g, `${style.open}$1${style.close}`);
96
- result = result.replace(/'([^']*)'/g, `${style.openSingle}$1${style.closeSingle}`);
97
- return result;
98
- }
99
35
  function replaceSpecialChars(text, locale) {
100
36
  return shy(typographicQuotes(text, locale));
101
37
  }
@@ -1,19 +1,10 @@
1
1
  import { Button } from '@base-ui/react/button';
2
2
  import { Input } from '@base-ui/react/input';
3
+ import { cn } from '@regardio/tailwind/utils';
3
4
  import { useState } from 'react';
4
- import { defineConfig, cx } from 'cva';
5
- import { twMerge } from 'fluid-tailwindcss/tailwind-merge';
6
5
  import { jsxs, jsx } from 'react/jsx-runtime';
7
6
 
8
- // src/components/password-input.tsx
9
- var { cva, compose } = defineConfig({
10
- hooks: {
11
- onComplete: (className) => {
12
- return twMerge(className);
13
- }
14
- }
15
- });
16
- var cn = (...inputs) => twMerge(cx(inputs));
7
+ // src/password-input/password-input.tsx
17
8
  var PasswordInput = ({ className, ...props }) => {
18
9
  const [showPassword, setShowPassword] = useState(false);
19
10
  const togglePasswordVisibility = () => {
@@ -1,16 +1,7 @@
1
- import { defineConfig, cx } from 'cva';
2
- import { twMerge } from 'fluid-tailwindcss/tailwind-merge';
1
+ import { cn } from '@regardio/tailwind/utils';
3
2
  import { jsx, jsxs } from 'react/jsx-runtime';
4
3
 
5
- // src/utils/cn.ts
6
- var { cva, compose } = defineConfig({
7
- hooks: {
8
- onComplete: (className) => {
9
- return twMerge(className);
10
- }
11
- }
12
- });
13
- var cn = (...inputs) => twMerge(cx(inputs));
4
+ // src/picture/picture.tsx
14
5
  var screenSizeVariants = {
15
6
  lg: 1280,
16
7
  max: 1920,
@@ -17,4 +17,4 @@ interface ProtectedEmailProps {
17
17
  */
18
18
  declare function ProtectedEmail({ username, domain, text, className }: ProtectedEmailProps): react_jsx_runtime.JSX.Element;
19
19
 
20
- export { ProtectedEmail };
20
+ export { ProtectedEmail, type ProtectedEmailProps };
@@ -1,7 +1,7 @@
1
1
  import { useState, useEffect } from 'react';
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
 
4
- // src/components/protected-email.tsx
4
+ // src/protected-email/protected-email.tsx
5
5
  function ProtectedEmail({ username, domain, text, className }) {
6
6
  const [mounted, setMounted] = useState(false);
7
7
  useEffect(() => {
@@ -0,0 +1,20 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ComponentProps } from 'react';
3
+
4
+ declare const themeColorVariants: {
5
+ readonly primary: readonly [];
6
+ };
7
+ declare const textVariants: {
8
+ readonly code: readonly ["font-light", "font-monospace"];
9
+ readonly primary: readonly [];
10
+ readonly subtitle: readonly ["text-lg"];
11
+ };
12
+ type TextThemeColor = keyof typeof themeColorVariants;
13
+ type TextVariant = keyof typeof textVariants;
14
+ interface TextProps extends ComponentProps<'p'> {
15
+ themeColor?: TextThemeColor;
16
+ variant?: TextVariant;
17
+ }
18
+ declare const Text: ({ children, className, variant, themeColor }: TextProps) => react_jsx_runtime.JSX.Element;
19
+
20
+ export { Text, type TextProps };
@@ -0,0 +1,38 @@
1
+ import { tv } from '@regardio/tailwind/utils';
2
+ import { jsx } from 'react/jsx-runtime';
3
+
4
+ // src/text/text.tsx
5
+ var themeColorVariants = {
6
+ primary: []
7
+ };
8
+ var textVariants = {
9
+ code: ["font-light", "font-monospace"],
10
+ primary: [],
11
+ subtitle: ["text-lg"]
12
+ };
13
+ var text = tv({
14
+ base: ["relative", "block"],
15
+ defaultVariants: {
16
+ themeColor: "primary",
17
+ variant: "primary"
18
+ },
19
+ variants: {
20
+ themeColor: themeColorVariants,
21
+ variant: textVariants
22
+ }
23
+ });
24
+ var Text = ({ children, className, variant, themeColor }) => {
25
+ return /* @__PURE__ */ jsx(
26
+ "div",
27
+ {
28
+ className: text({
29
+ className,
30
+ themeColor,
31
+ variant
32
+ }),
33
+ children
34
+ }
35
+ );
36
+ };
37
+
38
+ export { Text };
@@ -0,0 +1,3 @@
1
+ declare function generateLinkFromAuthorString(input: string): React.ReactNode;
2
+
3
+ export { generateLinkFromAuthorString };
@@ -0,0 +1,33 @@
1
+ import { parseAuthorString } from '@regardio/js/text';
2
+ import { jsx } from 'react/jsx-runtime';
3
+
4
+ // src/utils/author/author.tsx
5
+ function generateLinkFromAuthorString(input) {
6
+ const match = parseAuthorString(input);
7
+ if (match.name) {
8
+ if (match.email) {
9
+ return /* @__PURE__ */ jsx(
10
+ "a",
11
+ {
12
+ className: "u-email p-name",
13
+ href: `mailto:${match.email}`,
14
+ children: match.name
15
+ }
16
+ );
17
+ }
18
+ if (match.url && (match.url.startsWith("/") || match.url.startsWith("http"))) {
19
+ return /* @__PURE__ */ jsx(
20
+ "a",
21
+ {
22
+ className: "u-url p-name",
23
+ href: match.url,
24
+ children: match.name
25
+ }
26
+ );
27
+ }
28
+ return /* @__PURE__ */ jsx("span", { className: "p-name", children: match.name });
29
+ }
30
+ return;
31
+ }
32
+
33
+ export { generateLinkFromAuthorString };
@@ -0,0 +1,15 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ declare const lowerCaseSzett: (text: ReactNode | string, _returnType?: "string") => ReactNode;
4
+ declare function shy(input: string | ReactNode | null): string | ReactNode | null;
5
+ /**
6
+ * Replace special characters in text: typographic quotes and soft hyphens.
7
+ * This is a React-aware version that handles ReactNode trees.
8
+ */
9
+ declare function replaceSpecialChars(text: string, locale: string): string | ReactNode | null;
10
+ /**
11
+ * Wrap sentences in span elements
12
+ */
13
+ declare function wrapSentences(text: string): ReactNode;
14
+
15
+ export { lowerCaseSzett, replaceSpecialChars, shy, wrapSentences };
@@ -0,0 +1,73 @@
1
+ import { replaceShyInString, typographicQuotes, splitIntoSentences } from '@regardio/js/text';
2
+ import React, { isValidElement, cloneElement } from 'react';
3
+ import { jsx, jsxs } from 'react/jsx-runtime';
4
+
5
+ // src/utils/text/text.tsx
6
+ var lowerCaseSzett = (text, _returnType) => {
7
+ const processString = (str) => {
8
+ const parts = str.split(/(ß)/g);
9
+ return parts.map(
10
+ (part, index) => part === "\xDF" ? /* @__PURE__ */ jsx(
11
+ "span",
12
+ {
13
+ className: "lowercase",
14
+ children: part
15
+ },
16
+ index.toString()
17
+ ) : part
18
+ );
19
+ };
20
+ if (typeof text === "string") {
21
+ return processString(text);
22
+ }
23
+ if (isValidElement(text)) {
24
+ const element = text;
25
+ const { children, ...props } = element.props;
26
+ return cloneElement(element, {
27
+ ...props,
28
+ children: lowerCaseSzett(children)
29
+ });
30
+ }
31
+ if (Array.isArray(text)) {
32
+ return text.map((child, index) => /* @__PURE__ */ jsx(React.Fragment, { children: lowerCaseSzett(child) }, index.toString()));
33
+ }
34
+ return text;
35
+ };
36
+ function replaceShyInReactNode(node) {
37
+ if (typeof node === "string") {
38
+ return node.replace(/\u00AD/g, "");
39
+ }
40
+ if (isValidElement(node)) {
41
+ const element = node;
42
+ const { children, ...props } = element.props;
43
+ return cloneElement(element, {
44
+ ...props,
45
+ children: replaceShyInReactNode(children)
46
+ });
47
+ }
48
+ if (Array.isArray(node)) {
49
+ return node.map((child, index) => /* @__PURE__ */ jsx(React.Fragment, { children: replaceShyInReactNode(child) }, index.toString()));
50
+ }
51
+ return node;
52
+ }
53
+ function shy(input) {
54
+ if (input === null) {
55
+ return null;
56
+ }
57
+ if (typeof input === "string") {
58
+ return replaceShyInString(input);
59
+ }
60
+ return replaceShyInReactNode(input);
61
+ }
62
+ function replaceSpecialChars(text, locale) {
63
+ return shy(typographicQuotes(text, locale));
64
+ }
65
+ function wrapSentences(text) {
66
+ const sentences = splitIntoSentences(text);
67
+ return sentences.map((sentence, index) => /* @__PURE__ */ jsxs("span", { children: [
68
+ sentence,
69
+ " "
70
+ ] }, index.toString()));
71
+ }
72
+
73
+ export { lowerCaseSzett, replaceSpecialChars, shy, wrapSentences };