@regardio/react 0.3.3 → 0.4.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 (334) hide show
  1. package/dist/components/background-slideshow.d.ts +7 -5
  2. package/dist/components/background-slideshow.js +172 -74
  3. package/dist/components/blurry-gradient.d.ts +11 -4
  4. package/dist/components/blurry-gradient.js +121 -5
  5. package/dist/components/box.d.ts +12 -9
  6. package/dist/components/box.js +48 -23
  7. package/dist/components/carousel.d.ts +12 -10
  8. package/dist/components/carousel.js +146 -66
  9. package/dist/components/countdown.d.ts +5 -2
  10. package/dist/components/countdown.js +55 -21
  11. package/dist/components/definition-list.d.ts +19 -16
  12. package/dist/components/definition-list.js +83 -51
  13. package/dist/components/generic-error.d.ts +25 -5
  14. package/dist/components/generic-error.js +42 -34
  15. package/dist/components/heading.d.ts +13 -10
  16. package/dist/components/heading.js +114 -25
  17. package/dist/components/highlight.d.ts +11 -8
  18. package/dist/components/highlight.js +65 -17
  19. package/dist/components/icon-button.d.ts +7 -4
  20. package/dist/components/icon-button.js +16 -5
  21. package/dist/components/if.d.ts +6 -4
  22. package/dist/components/if.js +22 -14
  23. package/dist/components/iframe.d.ts +6 -4
  24. package/dist/components/iframe.js +26 -3
  25. package/dist/components/item.d.ts +17 -14
  26. package/dist/components/item.js +504 -301
  27. package/dist/components/leaflet-map.d.ts +5 -4
  28. package/dist/components/leaflet-map.js +192 -186
  29. package/dist/components/link.d.ts +24 -16
  30. package/dist/components/link.js +191 -102
  31. package/dist/components/list-item.d.ts +11 -8
  32. package/dist/components/list-item.js +35 -17
  33. package/dist/components/maptiler-map.d.ts +5 -4
  34. package/dist/components/maptiler-map.js +125 -112
  35. package/dist/components/markdown-container.d.ts +10 -8
  36. package/dist/components/markdown-container.js +181 -82
  37. package/dist/components/password-input.d.ts +7 -5
  38. package/dist/components/password-input.js +50 -8
  39. package/dist/components/picture.d.ts +19 -7
  40. package/dist/components/picture.js +75 -34
  41. package/dist/components/protected-email.d.ts +14 -3
  42. package/dist/components/protected-email.js +29 -15
  43. package/dist/components/text.d.ts +12 -9
  44. package/dist/components/text.js +42 -24
  45. package/dist/components/unordered-list.d.ts +11 -8
  46. package/dist/components/unordered-list.js +37 -19
  47. package/dist/hooks/use-current-route-data.d.ts +7 -2
  48. package/dist/hooks/use-current-route-data.js +13 -9
  49. package/dist/hooks/use-focus-search.d.ts +6 -3
  50. package/dist/hooks/use-focus-search.js +17 -13
  51. package/dist/hooks/use-matches-data.d.ts +9 -2
  52. package/dist/hooks/use-matches-data.js +12 -8
  53. package/dist/hooks/use-media-query.d.ts +8 -2
  54. package/dist/hooks/use-media-query.js +19 -15
  55. package/dist/hooks/use-mobile.d.ts +3 -2
  56. package/dist/hooks/use-mobile.js +18 -14
  57. package/dist/hooks/use-nonce.d.ts +12 -5
  58. package/dist/hooks/use-nonce.js +11 -7
  59. package/dist/hooks/use-orientation.d.ts +11 -3
  60. package/dist/hooks/use-orientation.js +28 -24
  61. package/dist/hooks/use-user.d.ts +43 -8
  62. package/dist/hooks/use-user.js +21 -13
  63. package/dist/utils/author.d.ts +4 -4
  64. package/dist/utils/author.js +49 -31
  65. package/dist/utils/cn.d.ts +8 -4
  66. package/dist/utils/cn.js +12 -8
  67. package/dist/utils/is-route-active.d.ts +19 -3
  68. package/dist/utils/is-route-active.js +45 -43
  69. package/dist/utils/locale.d.ts +66 -4
  70. package/dist/utils/locale.js +33 -22
  71. package/dist/utils/text.d.ts +24 -7
  72. package/dist/utils/text.js +114 -89
  73. package/package.json +4 -3
  74. package/dist/components/background-slideshow.d.ts.map +0 -1
  75. package/dist/components/blurry-gradient.d.ts.map +0 -1
  76. package/dist/components/box.d.ts.map +0 -1
  77. package/dist/components/carousel.d.ts.map +0 -1
  78. package/dist/components/countdown.d.ts.map +0 -1
  79. package/dist/components/definition-list.d.ts.map +0 -1
  80. package/dist/components/generic-error.d.ts.map +0 -1
  81. package/dist/components/heading.d.ts.map +0 -1
  82. package/dist/components/highlight.d.ts.map +0 -1
  83. package/dist/components/icon-button.d.ts.map +0 -1
  84. package/dist/components/if.d.ts.map +0 -1
  85. package/dist/components/iframe.d.ts.map +0 -1
  86. package/dist/components/item.d.ts.map +0 -1
  87. package/dist/components/leaflet-map.d.ts.map +0 -1
  88. package/dist/components/link.d.ts.map +0 -1
  89. package/dist/components/link.test.d.ts +0 -2
  90. package/dist/components/link.test.d.ts.map +0 -1
  91. package/dist/components/link.test.js +0 -204
  92. package/dist/components/list-item.d.ts.map +0 -1
  93. package/dist/components/maptiler-map.d.ts.map +0 -1
  94. package/dist/components/markdown-container.d.ts.map +0 -1
  95. package/dist/components/password-input.d.ts.map +0 -1
  96. package/dist/components/picture.d.ts.map +0 -1
  97. package/dist/components/protected-email.d.ts.map +0 -1
  98. package/dist/components/text.d.ts.map +0 -1
  99. package/dist/components/unordered-list.d.ts.map +0 -1
  100. package/dist/hooks/use-current-route-data.d.ts.map +0 -1
  101. package/dist/hooks/use-focus-search.d.ts.map +0 -1
  102. package/dist/hooks/use-matches-data.d.ts.map +0 -1
  103. package/dist/hooks/use-media-query.d.ts.map +0 -1
  104. package/dist/hooks/use-mobile.d.ts.map +0 -1
  105. package/dist/hooks/use-nonce.d.ts.map +0 -1
  106. package/dist/hooks/use-nonce.test.d.ts +0 -2
  107. package/dist/hooks/use-nonce.test.d.ts.map +0 -1
  108. package/dist/hooks/use-nonce.test.js +0 -27
  109. package/dist/hooks/use-orientation.d.ts.map +0 -1
  110. package/dist/hooks/use-user.d.ts.map +0 -1
  111. package/dist/shadcn/accordion.d.ts +0 -25
  112. package/dist/shadcn/accordion.d.ts.map +0 -1
  113. package/dist/shadcn/accordion.js +0 -45
  114. package/dist/shadcn/alert-dialog.d.ts +0 -73
  115. package/dist/shadcn/alert-dialog.d.ts.map +0 -1
  116. package/dist/shadcn/alert-dialog.js +0 -93
  117. package/dist/shadcn/alert.d.ts +0 -34
  118. package/dist/shadcn/alert.d.ts.map +0 -1
  119. package/dist/shadcn/alert.js +0 -42
  120. package/dist/shadcn/aspect-ratio.d.ts +0 -6
  121. package/dist/shadcn/aspect-ratio.d.ts.map +0 -1
  122. package/dist/shadcn/aspect-ratio.js +0 -7
  123. package/dist/shadcn/avatar.d.ts +0 -16
  124. package/dist/shadcn/avatar.d.ts.map +0 -1
  125. package/dist/shadcn/avatar.js +0 -27
  126. package/dist/shadcn/badge.d.ts +0 -29
  127. package/dist/shadcn/badge.d.ts.map +0 -1
  128. package/dist/shadcn/badge.js +0 -29
  129. package/dist/shadcn/breadcrumb.d.ts +0 -42
  130. package/dist/shadcn/breadcrumb.d.ts.map +0 -1
  131. package/dist/shadcn/breadcrumb.js +0 -74
  132. package/dist/shadcn/button.d.ts +0 -38
  133. package/dist/shadcn/button.d.ts.map +0 -1
  134. package/dist/shadcn/button.js +0 -38
  135. package/dist/shadcn/calendar.d.ts +0 -23
  136. package/dist/shadcn/calendar.d.ts.map +0 -1
  137. package/dist/shadcn/calendar.js +0 -163
  138. package/dist/shadcn/card.d.ts +0 -31
  139. package/dist/shadcn/card.d.ts.map +0 -1
  140. package/dist/shadcn/card.js +0 -55
  141. package/dist/shadcn/carousel.d.ts +0 -51
  142. package/dist/shadcn/carousel.d.ts.map +0 -1
  143. package/dist/shadcn/carousel.js +0 -161
  144. package/dist/shadcn/chart.d.ts +0 -103
  145. package/dist/shadcn/chart.d.ts.map +0 -1
  146. package/dist/shadcn/chart.js +0 -248
  147. package/dist/shadcn/checkbox.d.ts +0 -8
  148. package/dist/shadcn/checkbox.d.ts.map +0 -1
  149. package/dist/shadcn/checkbox.js +0 -22
  150. package/dist/shadcn/collapsible.d.ts +0 -16
  151. package/dist/shadcn/collapsible.d.ts.map +0 -1
  152. package/dist/shadcn/collapsible.js +0 -19
  153. package/dist/shadcn/command.d.ts +0 -61
  154. package/dist/shadcn/command.d.ts.map +0 -1
  155. package/dist/shadcn/command.js +0 -123
  156. package/dist/shadcn/context-menu.d.ts +0 -107
  157. package/dist/shadcn/context-menu.d.ts.map +0 -1
  158. package/dist/shadcn/context-menu.js +0 -151
  159. package/dist/shadcn/dialog.d.ts +0 -57
  160. package/dist/shadcn/dialog.d.ts.map +0 -1
  161. package/dist/shadcn/dialog.js +0 -96
  162. package/dist/shadcn/drawer.d.ts +0 -54
  163. package/dist/shadcn/drawer.d.ts.map +0 -1
  164. package/dist/shadcn/drawer.js +0 -96
  165. package/dist/shadcn/dropdown-menu.d.ts +0 -110
  166. package/dist/shadcn/dropdown-menu.d.ts.map +0 -1
  167. package/dist/shadcn/dropdown-menu.js +0 -152
  168. package/dist/shadcn/form.d.ts +0 -59
  169. package/dist/shadcn/form.d.ts.map +0 -1
  170. package/dist/shadcn/form.js +0 -99
  171. package/dist/shadcn/hover-card.d.ts +0 -20
  172. package/dist/shadcn/hover-card.d.ts.map +0 -1
  173. package/dist/shadcn/hover-card.js +0 -26
  174. package/dist/shadcn/input-otp.d.ts +0 -25
  175. package/dist/shadcn/input-otp.d.ts.map +0 -1
  176. package/dist/shadcn/input-otp.js +0 -54
  177. package/dist/shadcn/input.d.ts +0 -14
  178. package/dist/shadcn/input.d.ts.map +0 -1
  179. package/dist/shadcn/input.js +0 -48
  180. package/dist/shadcn/label.d.ts +0 -8
  181. package/dist/shadcn/label.d.ts.map +0 -1
  182. package/dist/shadcn/label.js +0 -16
  183. package/dist/shadcn/menubar.d.ts +0 -108
  184. package/dist/shadcn/menubar.d.ts.map +0 -1
  185. package/dist/shadcn/menubar.js +0 -174
  186. package/dist/shadcn/navigation-menu.d.ts +0 -79
  187. package/dist/shadcn/navigation-menu.d.ts.map +0 -1
  188. package/dist/shadcn/navigation-menu.js +0 -108
  189. package/dist/shadcn/pagination.d.ts +0 -45
  190. package/dist/shadcn/pagination.d.ts.map +0 -1
  191. package/dist/shadcn/pagination.js +0 -83
  192. package/dist/shadcn/popover.d.ts +0 -19
  193. package/dist/shadcn/popover.d.ts.map +0 -1
  194. package/dist/shadcn/popover.js +0 -29
  195. package/dist/shadcn/progress.d.ts +0 -9
  196. package/dist/shadcn/progress.d.ts.map +0 -1
  197. package/dist/shadcn/progress.js +0 -17
  198. package/dist/shadcn/radio-group.d.ts +0 -12
  199. package/dist/shadcn/radio-group.d.ts.map +0 -1
  200. package/dist/shadcn/radio-group.js +0 -32
  201. package/dist/shadcn/resizable.d.ts +0 -20
  202. package/dist/shadcn/resizable.d.ts.map +0 -1
  203. package/dist/shadcn/resizable.js +0 -32
  204. package/dist/shadcn/scroll-area.d.ts +0 -16
  205. package/dist/shadcn/scroll-area.d.ts.map +0 -1
  206. package/dist/shadcn/scroll-area.js +0 -40
  207. package/dist/shadcn/select.d.ts +0 -63
  208. package/dist/shadcn/select.d.ts.map +0 -1
  209. package/dist/shadcn/select.js +0 -120
  210. package/dist/shadcn/separator.d.ts +0 -10
  211. package/dist/shadcn/separator.d.ts.map +0 -1
  212. package/dist/shadcn/separator.js +0 -18
  213. package/dist/shadcn/sheet.d.ts +0 -48
  214. package/dist/shadcn/sheet.d.ts.map +0 -1
  215. package/dist/shadcn/sheet.js +0 -99
  216. package/dist/shadcn/sidebar.d.ts +0 -200
  217. package/dist/shadcn/sidebar.d.ts.map +0 -1
  218. package/dist/shadcn/sidebar.js +0 -528
  219. package/dist/shadcn/skeleton.d.ts +0 -6
  220. package/dist/shadcn/skeleton.d.ts.map +0 -1
  221. package/dist/shadcn/skeleton.js +0 -11
  222. package/dist/shadcn/slider.d.ts +0 -12
  223. package/dist/shadcn/slider.d.ts.map +0 -1
  224. package/dist/shadcn/slider.js +0 -50
  225. package/dist/shadcn/sonner.d.ts +0 -7
  226. package/dist/shadcn/sonner.d.ts.map +0 -1
  227. package/dist/shadcn/sonner.js +0 -20
  228. package/dist/shadcn/switch.d.ts +0 -8
  229. package/dist/shadcn/switch.d.ts.map +0 -1
  230. package/dist/shadcn/switch.js +0 -22
  231. package/dist/shadcn/table.d.ts +0 -35
  232. package/dist/shadcn/table.d.ts.map +0 -1
  233. package/dist/shadcn/table.js +0 -73
  234. package/dist/shadcn/tabs.d.ts +0 -20
  235. package/dist/shadcn/tabs.d.ts.map +0 -1
  236. package/dist/shadcn/tabs.js +0 -40
  237. package/dist/shadcn/textarea.d.ts +0 -7
  238. package/dist/shadcn/textarea.d.ts.map +0 -1
  239. package/dist/shadcn/textarea.js +0 -14
  240. package/dist/shadcn/toggle-group.d.ts +0 -22
  241. package/dist/shadcn/toggle-group.d.ts.map +0 -1
  242. package/dist/shadcn/toggle-group.js +0 -43
  243. package/dist/shadcn/toggle.d.ts +0 -29
  244. package/dist/shadcn/toggle.d.ts.map +0 -1
  245. package/dist/shadcn/toggle.js +0 -31
  246. package/dist/shadcn/tooltip.d.ts +0 -20
  247. package/dist/shadcn/tooltip.d.ts.map +0 -1
  248. package/dist/shadcn/tooltip.js +0 -40
  249. package/dist/stories/BackgroundSlideshow.stories.d.ts +0 -9
  250. package/dist/stories/BackgroundSlideshow.stories.d.ts.map +0 -1
  251. package/dist/stories/BackgroundSlideshow.stories.js +0 -60
  252. package/dist/stories/BlurryGradient.stories.d.ts +0 -11
  253. package/dist/stories/BlurryGradient.stories.d.ts.map +0 -1
  254. package/dist/stories/BlurryGradient.stories.js +0 -53
  255. package/dist/stories/Box.stories.d.ts +0 -13
  256. package/dist/stories/Box.stories.d.ts.map +0 -1
  257. package/dist/stories/Box.stories.js +0 -50
  258. package/dist/stories/Carousel.stories.d.ts +0 -9
  259. package/dist/stories/Carousel.stories.d.ts.map +0 -1
  260. package/dist/stories/Carousel.stories.js +0 -30
  261. package/dist/stories/Countdown.stories.d.ts +0 -7
  262. package/dist/stories/Countdown.stories.d.ts.map +0 -1
  263. package/dist/stories/Countdown.stories.js +0 -11
  264. package/dist/stories/DefinitionList.stories.d.ts +0 -9
  265. package/dist/stories/DefinitionList.stories.d.ts.map +0 -1
  266. package/dist/stories/DefinitionList.stories.js +0 -20
  267. package/dist/stories/GenericError.stories.d.ts +0 -9
  268. package/dist/stories/GenericError.stories.d.ts.map +0 -1
  269. package/dist/stories/GenericError.stories.js +0 -39
  270. package/dist/stories/Heading.stories.d.ts +0 -15
  271. package/dist/stories/Heading.stories.d.ts.map +0 -1
  272. package/dist/stories/Heading.stories.js +0 -61
  273. package/dist/stories/Highlight.stories.d.ts +0 -8
  274. package/dist/stories/Highlight.stories.d.ts.map +0 -1
  275. package/dist/stories/Highlight.stories.js +0 -19
  276. package/dist/stories/IconButton.stories.d.ts +0 -10
  277. package/dist/stories/IconButton.stories.d.ts.map +0 -1
  278. package/dist/stories/IconButton.stories.js +0 -32
  279. package/dist/stories/If.stories.d.ts +0 -13
  280. package/dist/stories/If.stories.d.ts.map +0 -1
  281. package/dist/stories/If.stories.js +0 -54
  282. package/dist/stories/Iframe.stories.d.ts +0 -8
  283. package/dist/stories/Iframe.stories.d.ts.map +0 -1
  284. package/dist/stories/Iframe.stories.js +0 -23
  285. package/dist/stories/Item.stories.d.ts +0 -10
  286. package/dist/stories/Item.stories.d.ts.map +0 -1
  287. package/dist/stories/Item.stories.js +0 -32
  288. package/dist/stories/Link.stories.d.ts +0 -10
  289. package/dist/stories/Link.stories.d.ts.map +0 -1
  290. package/dist/stories/Link.stories.js +0 -36
  291. package/dist/stories/ListItem.stories.d.ts +0 -9
  292. package/dist/stories/ListItem.stories.d.ts.map +0 -1
  293. package/dist/stories/ListItem.stories.js +0 -26
  294. package/dist/stories/MarkdownContainer.stories.d.ts +0 -11
  295. package/dist/stories/MarkdownContainer.stories.d.ts.map +0 -1
  296. package/dist/stories/MarkdownContainer.stories.js +0 -66
  297. package/dist/stories/PasswordInput.stories.d.ts +0 -9
  298. package/dist/stories/PasswordInput.stories.d.ts.map +0 -1
  299. package/dist/stories/PasswordInput.stories.js +0 -27
  300. package/dist/stories/Picture.stories.d.ts +0 -10
  301. package/dist/stories/Picture.stories.d.ts.map +0 -1
  302. package/dist/stories/Picture.stories.js +0 -46
  303. package/dist/stories/ProtectedEmail.stories.d.ts +0 -10
  304. package/dist/stories/ProtectedEmail.stories.d.ts.map +0 -1
  305. package/dist/stories/ProtectedEmail.stories.js +0 -34
  306. package/dist/stories/Text.stories.d.ts +0 -10
  307. package/dist/stories/Text.stories.d.ts.map +0 -1
  308. package/dist/stories/Text.stories.js +0 -31
  309. package/dist/stories/UnorderedList.stories.d.ts +0 -10
  310. package/dist/stories/UnorderedList.stories.d.ts.map +0 -1
  311. package/dist/stories/UnorderedList.stories.js +0 -24
  312. package/dist/test-setup.d.ts +0 -2
  313. package/dist/test-setup.d.ts.map +0 -1
  314. package/dist/test-setup.js +0 -1
  315. package/dist/utils/author.d.ts.map +0 -1
  316. package/dist/utils/author.test.d.ts +0 -2
  317. package/dist/utils/author.test.d.ts.map +0 -1
  318. package/dist/utils/author.test.js +0 -46
  319. package/dist/utils/cn.d.ts.map +0 -1
  320. package/dist/utils/cn.test.d.ts +0 -2
  321. package/dist/utils/cn.test.d.ts.map +0 -1
  322. package/dist/utils/cn.test.js +0 -33
  323. package/dist/utils/is-route-active.d.ts.map +0 -1
  324. package/dist/utils/is-route-active.test.d.ts +0 -2
  325. package/dist/utils/is-route-active.test.d.ts.map +0 -1
  326. package/dist/utils/is-route-active.test.js +0 -61
  327. package/dist/utils/locale.d.ts.map +0 -1
  328. package/dist/utils/locale.test.d.ts +0 -2
  329. package/dist/utils/locale.test.d.ts.map +0 -1
  330. package/dist/utils/locale.test.js +0 -99
  331. package/dist/utils/text.d.ts.map +0 -1
  332. package/dist/utils/text.test.d.ts +0 -2
  333. package/dist/utils/text.test.d.ts.map +0 -1
  334. package/dist/utils/text.test.js +0 -122
@@ -1,93 +1,192 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  import { MDXProvider } from '@mdx-js/react';
3
- import Markdown, {} from 'markdown-to-jsx';
4
- import { cn } from '../utils/cn';
5
- import { replaceSpecialChars } from '../utils/text';
6
- const doubleNewlineRegex = /\n\n+/;
7
- function processTextOutsideMDXComponents(text, locale) {
8
- const mdxTagRegex = /(<\/?[A-Za-z][^>]*>)/g;
9
- return text
10
- .split(mdxTagRegex)
11
- .map((part) => (mdxTagRegex.test(part) ? part : replaceSpecialChars(part, locale)))
12
- .join('');
2
+ import Markdown from 'markdown-to-jsx';
3
+ import { defineConfig, cx } from 'cva';
4
+ import { twMerge } from 'fluid-tailwindcss/tailwind-merge';
5
+ import React, { isValidElement, cloneElement } from 'react';
6
+ import { jsx } from 'react/jsx-runtime';
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");
13
19
  }
14
- export function transformLink(to) {
15
- const targetDomainSubstring = 'regard';
16
- if (typeof to === 'string') {
17
- try {
18
- const url = new URL(to);
19
- if (url.hostname.includes(targetDomainSubstring)) {
20
- return url.pathname + (url.search ?? '') + (url.hash ?? '');
21
- }
22
- return to;
23
- }
24
- catch {
25
- return to;
26
- }
20
+ function replaceShyInReactNode(node) {
21
+ if (typeof node === "string") {
22
+ return node.replace(/\u00AD/g, "");
23
+ }
24
+ if (isValidElement(node)) {
25
+ const element = node;
26
+ const { children, ...props } = element.props;
27
+ return cloneElement(element, {
28
+ ...props,
29
+ children: replaceShyInReactNode(children)
30
+ });
31
+ }
32
+ if (Array.isArray(node)) {
33
+ return node.map((child, index) => /* @__PURE__ */ jsx(React.Fragment, { children: replaceShyInReactNode(child) }, index.toString()));
34
+ }
35
+ return node;
36
+ }
37
+ function shy(input) {
38
+ if (input === null) {
39
+ return null;
40
+ }
41
+ if (typeof input === "string") {
42
+ return replaceShyInString(input);
43
+ }
44
+ return replaceShyInReactNode(input);
45
+ }
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;
27
89
  }
28
- else if (to?.pathname) {
29
- return to.pathname + (to.search ?? '') + (to.hash ?? '');
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
+ function replaceSpecialChars(text, locale) {
100
+ return shy(typographicQuotes(text, locale));
101
+ }
102
+ var doubleNewlineRegex = /\n\n+/;
103
+ function processTextOutsideMDXComponents(text, locale) {
104
+ const mdxTagRegex = /(<\/?[A-Za-z][^>]*>)/g;
105
+ return text.split(mdxTagRegex).map((part) => mdxTagRegex.test(part) ? part : replaceSpecialChars(part, locale)).join("");
106
+ }
107
+ function transformLink(to) {
108
+ const targetDomainSubstring = "regard";
109
+ if (typeof to === "string") {
110
+ try {
111
+ const url = new URL(to);
112
+ if (url.hostname.includes(targetDomainSubstring)) {
113
+ return url.pathname + (url.search ?? "") + (url.hash ?? "");
114
+ }
115
+ return to;
116
+ } catch {
117
+ return to;
30
118
  }
31
- return '';
119
+ } else if (to?.pathname) {
120
+ return to.pathname + (to.search ?? "") + (to.hash ?? "");
121
+ }
122
+ return "";
32
123
  }
33
- const truncateText = (text, maxSentences, maxCharacters, maxParagraphs) => {
34
- if (maxSentences === undefined && maxCharacters === undefined && maxParagraphs === undefined) {
35
- return text;
124
+ var truncateText = (text, maxSentences, maxCharacters, maxParagraphs) => {
125
+ if (maxSentences === void 0 && maxCharacters === void 0 && maxParagraphs === void 0) {
126
+ return text;
127
+ }
128
+ const paragraphs = text.split(doubleNewlineRegex);
129
+ let truncatedText = "";
130
+ let charCount = 0;
131
+ let sentenceCount = 0;
132
+ let paragraphCount = 0;
133
+ for (const paragraph of paragraphs) {
134
+ if (maxParagraphs !== void 0 && paragraphCount >= maxParagraphs) {
135
+ break;
36
136
  }
37
- const paragraphs = text.split(doubleNewlineRegex);
38
- let truncatedText = '';
39
- let charCount = 0;
40
- let sentenceCount = 0;
41
- let paragraphCount = 0;
42
- for (const paragraph of paragraphs) {
43
- if (maxParagraphs !== undefined && paragraphCount >= maxParagraphs) {
44
- break;
45
- }
46
- const sentenceRegex = /(?<!\.\.\.)(?<!\b\w\.)\.(?:\s+|\n+)/g;
47
- const parts = paragraph.split(sentenceRegex);
48
- const delimiters = paragraph.match(sentenceRegex) || [];
49
- for (let i = 0; i < parts.length; i++) {
50
- const part = parts[i];
51
- const delimiter = delimiters[i] || '';
52
- if (part !== undefined) {
53
- if ((maxSentences === undefined || sentenceCount < maxSentences) &&
54
- (maxCharacters === undefined ||
55
- charCount + part.length + delimiter.length <= maxCharacters)) {
56
- truncatedText += part + delimiter;
57
- charCount += part.length + delimiter.length;
58
- if (delimiter.includes('.')) {
59
- sentenceCount++;
60
- }
61
- }
62
- else {
63
- break;
64
- }
65
- }
66
- }
67
- paragraphCount++;
68
- if ((maxSentences !== undefined && sentenceCount >= maxSentences) ||
69
- (maxCharacters !== undefined && charCount >= maxCharacters)) {
70
- break;
71
- }
72
- if (paragraphCount < paragraphs.length) {
73
- truncatedText += '\n\n';
137
+ const sentenceRegex = /(?<!\.\.\.)(?<!\b\w\.)\.(?:\s+|\n+)/g;
138
+ const parts = paragraph.split(sentenceRegex);
139
+ const delimiters = paragraph.match(sentenceRegex) || [];
140
+ for (let i = 0; i < parts.length; i++) {
141
+ const part = parts[i];
142
+ const delimiter = delimiters[i] || "";
143
+ if (part !== void 0) {
144
+ if ((maxSentences === void 0 || sentenceCount < maxSentences) && (maxCharacters === void 0 || charCount + part.length + delimiter.length <= maxCharacters)) {
145
+ truncatedText += part + delimiter;
146
+ charCount += part.length + delimiter.length;
147
+ if (delimiter.includes(".")) {
148
+ sentenceCount++;
149
+ }
150
+ } else {
151
+ break;
74
152
  }
153
+ }
154
+ }
155
+ paragraphCount++;
156
+ if (maxSentences !== void 0 && sentenceCount >= maxSentences || maxCharacters !== void 0 && charCount >= maxCharacters) {
157
+ break;
158
+ }
159
+ if (paragraphCount < paragraphs.length) {
160
+ truncatedText += "\n\n";
75
161
  }
76
- return truncatedText.trim();
162
+ }
163
+ return truncatedText.trim();
77
164
  };
78
- export const MarkdownContainer = (props) => {
79
- const rawText = props.children?.toString() || '';
80
- let processedText = processTextOutsideMDXComponents(rawText, props.locale);
81
- const shouldTruncate = Number.isInteger(props.sentences) ||
82
- Number.isInteger(props.characters) ||
83
- Number.isInteger(props.paragraphs);
84
- if (shouldTruncate) {
85
- processedText = truncateText(processedText, props.sentences, props.characters, props.paragraphs);
165
+ var MarkdownContainer = (props) => {
166
+ const rawText = props.children?.toString() || "";
167
+ let processedText = processTextOutsideMDXComponents(rawText, props.locale);
168
+ const shouldTruncate = Number.isInteger(props.sentences) || Number.isInteger(props.characters) || Number.isInteger(props.paragraphs);
169
+ if (shouldTruncate) {
170
+ processedText = truncateText(
171
+ processedText,
172
+ props.sentences,
173
+ props.characters,
174
+ props.paragraphs
175
+ );
176
+ }
177
+ return /* @__PURE__ */ jsx(MDXProvider, { components: props.mdxComponents, children: /* @__PURE__ */ jsx(
178
+ Markdown,
179
+ {
180
+ className: cn("markdown", props.className),
181
+ options: {
182
+ disableParsingRawHTML: false,
183
+ forceWrapper: true,
184
+ tagfilter: false,
185
+ ...props.markdownOverrides ? { overrides: props.markdownOverrides } : {}
186
+ },
187
+ children: processedText
86
188
  }
87
- return (_jsx(MDXProvider, { components: props.mdxComponents, children: _jsx(Markdown, { className: cn('markdown', props.className), options: {
88
- disableParsingRawHTML: false,
89
- forceWrapper: true,
90
- tagfilter: false,
91
- ...(props.markdownOverrides ? { overrides: props.markdownOverrides } : {}),
92
- }, children: processedText }) }));
189
+ ) });
93
190
  };
191
+
192
+ export { MarkdownContainer, transformLink };
@@ -1,9 +1,11 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
1
2
  import { Input } from '@base-ui/react/input';
2
- export interface InputProps extends React.ComponentPropsWithoutRef<typeof Input> {
3
+
4
+ interface InputProps extends React.ComponentPropsWithoutRef<typeof Input> {
3
5
  }
4
- export interface PasswordInputProps extends InputProps {
6
+ interface PasswordInputProps extends InputProps {
5
7
  className?: string;
6
8
  }
7
- declare const PasswordInput: ({ className, ...props }: PasswordInputProps) => import("react/jsx-runtime").JSX.Element;
8
- export { PasswordInput };
9
- //# sourceMappingURL=password-input.d.ts.map
9
+ declare const PasswordInput: ({ className, ...props }: PasswordInputProps) => react_jsx_runtime.JSX.Element;
10
+
11
+ export { type InputProps, PasswordInput, type PasswordInputProps };
@@ -1,13 +1,55 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
1
  import { Button } from '@base-ui/react/button';
3
2
  import { Input } from '@base-ui/react/input';
4
3
  import { useState } from 'react';
5
- import { cn } from '../utils/cn';
6
- const PasswordInput = ({ className, ...props }) => {
7
- const [showPassword, setShowPassword] = useState(false);
8
- const togglePasswordVisibility = () => {
9
- setShowPassword(!showPassword);
10
- };
11
- return (_jsxs("div", { className: 'relative', children: [_jsx(Input, { autoComplete: 'off', className: cn(className), type: showPassword ? 'text' : 'password', ...props }), _jsx(Button, { className: cn('absolute', 'right-[14px]', 'top-[35px]', 'flex', 'h-6', 'w-[20px]', 'cursor-pointer', 'flex-col', 'items-end', 'justify-center', 'text-gray-500'), onClick: togglePasswordVisibility, children: showPassword ? 'Off' : 'On' })] }));
4
+ import { defineConfig, cx } from 'cva';
5
+ import { twMerge } from 'fluid-tailwindcss/tailwind-merge';
6
+ import { jsxs, jsx } from 'react/jsx-runtime';
7
+
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));
17
+ var PasswordInput = ({ className, ...props }) => {
18
+ const [showPassword, setShowPassword] = useState(false);
19
+ const togglePasswordVisibility = () => {
20
+ setShowPassword(!showPassword);
21
+ };
22
+ return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
23
+ /* @__PURE__ */ jsx(
24
+ Input,
25
+ {
26
+ autoComplete: "off",
27
+ className: cn(className),
28
+ type: showPassword ? "text" : "password",
29
+ ...props
30
+ }
31
+ ),
32
+ /* @__PURE__ */ jsx(
33
+ Button,
34
+ {
35
+ className: cn(
36
+ "absolute",
37
+ "right-[14px]",
38
+ "top-[35px]",
39
+ "flex",
40
+ "h-6",
41
+ "w-[20px]",
42
+ "cursor-pointer",
43
+ "flex-col",
44
+ "items-end",
45
+ "justify-center",
46
+ "text-gray-500"
47
+ ),
48
+ onClick: togglePasswordVisibility,
49
+ children: showPassword ? "Off" : "On"
50
+ }
51
+ )
52
+ ] });
12
53
  };
54
+
13
55
  export { PasswordInput };
@@ -1,5 +1,6 @@
1
- import type React from 'react';
2
- export declare const screenSizeVariants: {
1
+ import react__default from 'react';
2
+
3
+ declare const screenSizeVariants: {
3
4
  readonly lg: 1280;
4
5
  readonly max: 1920;
5
6
  readonly md: 960;
@@ -8,11 +9,11 @@ export declare const screenSizeVariants: {
8
9
  readonly xl: 1600;
9
10
  readonly xs: 480;
10
11
  };
11
- export type ImageFormat = {
12
+ type ImageFormat = {
12
13
  size: string;
13
14
  width: number;
14
15
  };
15
- export interface PictureProps {
16
+ interface PictureProps {
16
17
  alt: string;
17
18
  baseUrl: string;
18
19
  className?: string;
@@ -21,6 +22,17 @@ export interface PictureProps {
21
22
  placeholder?: string;
22
23
  sizes?: string;
23
24
  }
24
- declare const Picture: React.FC<PictureProps>;
25
- export { Picture };
26
- //# sourceMappingURL=picture.d.ts.map
25
+ /**
26
+ * Generic Picture component that works with any image provider
27
+ *
28
+ * @param alt - Alt text for the image
29
+ * @param baseUrl - Base URL with optional placeholder (e.g., 'https://example.com/images/{format}/image.jpg')
30
+ * @param className - Optional class for the picture element
31
+ * @param formats - Custom formats with size and width
32
+ * @param imgClassName - Optional class for the img element
33
+ * @param placeholder - Placeholder to replace in baseUrl (default: '{format}')
34
+ * @param sizes - Custom sizes attribute
35
+ */
36
+ declare const Picture: react__default.FC<PictureProps>;
37
+
38
+ export { type ImageFormat, Picture, type PictureProps, screenSizeVariants };
@@ -1,36 +1,77 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { cn } from '../utils/cn';
3
- export const screenSizeVariants = {
4
- lg: 1280,
5
- max: 1920,
6
- md: 960,
7
- min: 360,
8
- sm: 640,
9
- xl: 1600,
10
- xs: 480,
11
- };
12
- const Picture = ({ alt, baseUrl, className, formats, imgClassName, placeholder = '{format}', sizes = '(max-width: 480px) 480px, (max-width: 768px) 600px, (max-width: 1200px) 1024px, 1920px', }) => {
13
- const imageFormats = formats || [
14
- { size: '480x360', width: 480 },
15
- { size: '600x600', width: 600 },
16
- { size: '1024x768', width: 1024 },
17
- { size: '1920x1440', width: 1920 },
18
- ];
19
- if (imageFormats.length === 0) {
20
- return null;
21
- }
22
- const isSimpleImage = (imageFormats.length === 1 && imageFormats[0]?.size === '') || !baseUrl.includes(placeholder);
23
- if (isSimpleImage) {
24
- return (_jsx("img", { alt: alt, className: cn(className, imgClassName), src: baseUrl }));
1
+ import { defineConfig, cx } from 'cva';
2
+ import { twMerge } from 'fluid-tailwindcss/tailwind-merge';
3
+ import { jsx, jsxs } from 'react/jsx-runtime';
4
+
5
+ // src/utils/cn.ts
6
+ var { cva, compose } = defineConfig({
7
+ hooks: {
8
+ onComplete: (className) => {
9
+ return twMerge(className);
25
10
  }
26
- const srcSet = imageFormats
27
- .map(({ size, width }) => {
28
- const url = baseUrl.replace(placeholder, size);
29
- return `${url} ${width}w`;
30
- })
31
- .join(', ');
32
- const defaultFormat = imageFormats[0];
33
- const defaultSrc = defaultFormat ? baseUrl.replace(placeholder, defaultFormat.size) : baseUrl;
34
- return (_jsxs("picture", { className: className, children: [_jsx("source", { sizes: sizes, srcSet: srcSet }), _jsx("img", { alt: alt, className: cn(imgClassName), src: defaultSrc })] }));
11
+ }
12
+ });
13
+ var cn = (...inputs) => twMerge(cx(inputs));
14
+ var screenSizeVariants = {
15
+ lg: 1280,
16
+ max: 1920,
17
+ md: 960,
18
+ min: 360,
19
+ sm: 640,
20
+ xl: 1600,
21
+ xs: 480
22
+ };
23
+ var Picture = ({
24
+ alt,
25
+ baseUrl,
26
+ className,
27
+ formats,
28
+ imgClassName,
29
+ placeholder = "{format}",
30
+ sizes = "(max-width: 480px) 480px, (max-width: 768px) 600px, (max-width: 1200px) 1024px, 1920px"
31
+ }) => {
32
+ const imageFormats = formats || [
33
+ { size: "480x360", width: 480 },
34
+ { size: "600x600", width: 600 },
35
+ { size: "1024x768", width: 1024 },
36
+ { size: "1920x1440", width: 1920 }
37
+ ];
38
+ if (imageFormats.length === 0) {
39
+ return null;
40
+ }
41
+ const isSimpleImage = imageFormats.length === 1 && imageFormats[0]?.size === "" || !baseUrl.includes(placeholder);
42
+ if (isSimpleImage) {
43
+ return /* @__PURE__ */ jsx(
44
+ "img",
45
+ {
46
+ alt,
47
+ className: cn(className, imgClassName),
48
+ src: baseUrl
49
+ }
50
+ );
51
+ }
52
+ const srcSet = imageFormats.map(({ size, width }) => {
53
+ const url = baseUrl.replace(placeholder, size);
54
+ return `${url} ${width}w`;
55
+ }).join(", ");
56
+ const defaultFormat = imageFormats[0];
57
+ const defaultSrc = defaultFormat ? baseUrl.replace(placeholder, defaultFormat.size) : baseUrl;
58
+ return /* @__PURE__ */ jsxs("picture", { className, children: [
59
+ /* @__PURE__ */ jsx(
60
+ "source",
61
+ {
62
+ sizes,
63
+ srcSet
64
+ }
65
+ ),
66
+ /* @__PURE__ */ jsx(
67
+ "img",
68
+ {
69
+ alt,
70
+ className: cn(imgClassName),
71
+ src: defaultSrc
72
+ }
73
+ )
74
+ ] });
35
75
  };
36
- export { Picture };
76
+
77
+ export { Picture, screenSizeVariants };
@@ -1,9 +1,20 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
1
3
  interface ProtectedEmailProps {
2
4
  username: string;
3
5
  domain: string;
4
6
  text?: string;
5
7
  className?: string;
6
8
  }
7
- export declare function ProtectedEmail({ username, domain, text, className }: ProtectedEmailProps): import("react/jsx-runtime").JSX.Element;
8
- export {};
9
- //# sourceMappingURL=protected-email.d.ts.map
9
+ /**
10
+ * ProtectedEmail component that obfuscates email addresses to protect from scrapers.
11
+ * The email is only assembled client-side with JavaScript, making it harder for scrapers to extract.
12
+ *
13
+ * @param username - The part before the @ symbol
14
+ * @param domain - The part after the @ symbol
15
+ * @param text - Optional display text (defaults to username(at)domain)
16
+ * @param className - Optional CSS class name
17
+ */
18
+ declare function ProtectedEmail({ username, domain, text, className }: ProtectedEmailProps): react_jsx_runtime.JSX.Element;
19
+
20
+ export { ProtectedEmail };
@@ -1,16 +1,30 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useEffect, useState } from 'react';
3
- export function ProtectedEmail({ username, domain, text, className }) {
4
- const [mounted, setMounted] = useState(false);
5
- useEffect(() => {
6
- setMounted(true);
7
- }, []);
8
- const fallbackText = text || `${username}(at)${domain}`;
9
- const handleClick = (e) => {
10
- if (mounted) {
11
- window.location.href = `mailto:${username}@${domain}`;
12
- e.preventDefault();
13
- }
14
- };
15
- return (_jsx("a", { "aria-label": `Email address: ${username} at ${domain}`, className: className, "data-email-protected": "true", href: mounted ? '#email-protected' : undefined, onClick: handleClick, children: fallbackText }));
1
+ import { useState, useEffect } from 'react';
2
+ import { jsx } from 'react/jsx-runtime';
3
+
4
+ // src/components/protected-email.tsx
5
+ function ProtectedEmail({ username, domain, text, className }) {
6
+ const [mounted, setMounted] = useState(false);
7
+ useEffect(() => {
8
+ setMounted(true);
9
+ }, []);
10
+ const fallbackText = text || `${username}(at)${domain}`;
11
+ const handleClick = (e) => {
12
+ if (mounted) {
13
+ window.location.href = `mailto:${username}@${domain}`;
14
+ e.preventDefault();
15
+ }
16
+ };
17
+ return /* @__PURE__ */ jsx(
18
+ "a",
19
+ {
20
+ "aria-label": `Email address: ${username} at ${domain}`,
21
+ className,
22
+ "data-email-protected": "true",
23
+ href: mounted ? "#email-protected" : void 0,
24
+ onClick: handleClick,
25
+ children: fallbackText
26
+ }
27
+ );
16
28
  }
29
+
30
+ export { ProtectedEmail };
@@ -1,17 +1,20 @@
1
- import type { ComponentProps } from 'react';
2
- import { type VariantProps } from '../utils/cn';
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as cva from 'cva';
3
+ import { VariantProps } from 'cva';
4
+ import { ComponentProps } from 'react';
5
+
3
6
  declare const text: (props?: ({
4
7
  themeColor?: "primary" | undefined;
5
- variant?: "code" | "primary" | "subtitle" | undefined;
8
+ variant?: "primary" | "code" | "subtitle" | undefined;
6
9
  } & ({
7
- class?: import("cva").ClassValue;
10
+ class?: cva.ClassValue;
8
11
  className?: never;
9
12
  } | {
10
13
  class?: never;
11
- className?: import("cva").ClassValue;
14
+ className?: cva.ClassValue;
12
15
  })) | undefined) => string;
13
- export interface TextProps extends ComponentProps<'p'>, VariantProps<typeof text> {
16
+ interface TextProps extends ComponentProps<'p'>, VariantProps<typeof text> {
14
17
  }
15
- export declare const Text: (props: TextProps) => import("react/jsx-runtime").JSX.Element;
16
- export {};
17
- //# sourceMappingURL=text.d.ts.map
18
+ declare const Text: (props: TextProps) => react_jsx_runtime.JSX.Element;
19
+
20
+ export { Text, type TextProps };