@astra-kit/ui 0.0.0-stage → 0.0.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 (304) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/LICENSE.md +21 -0
  3. package/README.md +384 -2
  4. package/THIRD_PARTY_NOTICES.md +31 -0
  5. package/assets/fonts/geist-LICENSE.txt +93 -0
  6. package/assets/fonts/geist-latin-variable.woff2 +0 -0
  7. package/assets/fonts/ibm-plex-mono-latin-400.woff2 +0 -0
  8. package/assets/fonts/ibm-plex-mono-latin-500.woff2 +0 -0
  9. package/assets/fonts/ibmplexmono-LICENSE.txt +93 -0
  10. package/assets/fonts/inter-LICENSE.txt +93 -0
  11. package/assets/fonts/inter-latin-variable.woff2 +0 -0
  12. package/dist/adapters/unpic-image.d.ts +3 -0
  13. package/dist/adapters/unpic-image.js +98 -0
  14. package/dist/components/account-menu.d.ts +67 -0
  15. package/dist/components/account-menu.js +440 -0
  16. package/dist/components/action-button.d.ts +25 -0
  17. package/dist/components/action-button.js +264 -0
  18. package/dist/components/alert.d.ts +31 -0
  19. package/dist/components/alert.js +503 -0
  20. package/dist/components/animated-collapse.d.ts +19 -0
  21. package/dist/components/animated-collapse.js +170 -0
  22. package/dist/components/animated-count.d.ts +13 -0
  23. package/dist/components/animated-count.js +105 -0
  24. package/dist/components/animated-list-item.d.ts +25 -0
  25. package/dist/components/animated-list-item.js +134 -0
  26. package/dist/components/animated-theme-toggler.d.ts +12 -0
  27. package/dist/components/animated-theme-toggler.js +200 -0
  28. package/dist/components/avatar.d.ts +65 -0
  29. package/dist/components/avatar.js +463 -0
  30. package/dist/components/badge.d.ts +21 -0
  31. package/dist/components/badge.js +297 -0
  32. package/dist/components/button-interaction.d.ts +23 -0
  33. package/dist/components/button-interaction.js +22 -0
  34. package/dist/components/button-label.d.ts +8 -0
  35. package/dist/components/button-label.js +203 -0
  36. package/dist/components/button.d.ts +23 -0
  37. package/dist/components/button.js +145 -0
  38. package/dist/components/calendar.d.ts +47 -0
  39. package/dist/components/calendar.js +155 -0
  40. package/dist/components/card.d.ts +38 -0
  41. package/dist/components/card.js +904 -0
  42. package/dist/components/carousel.d.ts +71 -0
  43. package/dist/components/carousel.js +585 -0
  44. package/dist/components/checkbox.d.ts +15 -0
  45. package/dist/components/checkbox.js +324 -0
  46. package/dist/components/control-button.d.ts +16 -0
  47. package/dist/components/control-button.js +215 -0
  48. package/dist/components/data-table.d.ts +118 -0
  49. package/dist/components/data-table.js +895 -0
  50. package/dist/components/dialog-surface.d.ts +49 -0
  51. package/dist/components/dialog-surface.js +220 -0
  52. package/dist/components/dialog.d.ts +92 -0
  53. package/dist/components/dialog.js +320 -0
  54. package/dist/components/dropdown-menu.d.ts +57 -0
  55. package/dist/components/dropdown-menu.js +107 -0
  56. package/dist/components/field.d.ts +53 -0
  57. package/dist/components/field.js +710 -0
  58. package/dist/components/file-upload.d.ts +88 -0
  59. package/dist/components/file-upload.js +776 -0
  60. package/dist/components/filter-presets-bar.d.ts +73 -0
  61. package/dist/components/filter-presets-bar.js +510 -0
  62. package/dist/components/filter-query-bar.d.ts +21 -0
  63. package/dist/components/filter-query-bar.js +881 -0
  64. package/dist/components/filter-query-grammar.d.ts +188 -0
  65. package/dist/components/filter-query-grammar.js +875 -0
  66. package/dist/components/form.d.ts +29 -0
  67. package/dist/components/form.js +330 -0
  68. package/dist/components/highlighter.d.ts +15 -0
  69. package/dist/components/highlighter.js +152 -0
  70. package/dist/components/hover-card.d.ts +50 -0
  71. package/dist/components/hover-card.js +80 -0
  72. package/dist/components/input-group.d.ts +16 -0
  73. package/dist/components/input-group.js +277 -0
  74. package/dist/components/input.d.ts +17 -0
  75. package/dist/components/input.js +120 -0
  76. package/dist/components/label.d.ts +4 -0
  77. package/dist/components/label.js +43 -0
  78. package/dist/components/link.d.ts +9 -0
  79. package/dist/components/link.js +43 -0
  80. package/dist/components/morph-text.d.ts +14 -0
  81. package/dist/components/morph-text.js +210 -0
  82. package/dist/components/pagination.d.ts +59 -0
  83. package/dist/components/pagination.js +190 -0
  84. package/dist/components/popover.d.ts +17 -0
  85. package/dist/components/popover.js +40 -0
  86. package/dist/components/presence-swap.d.ts +22 -0
  87. package/dist/components/presence-swap.js +209 -0
  88. package/dist/components/primitives/alert-dialog.d.ts +68 -0
  89. package/dist/components/primitives/alert-dialog.js +629 -0
  90. package/dist/components/primitives/avatar.d.ts +46 -0
  91. package/dist/components/primitives/avatar.js +265 -0
  92. package/dist/components/primitives/calendar.d.ts +37 -0
  93. package/dist/components/primitives/calendar.js +1250 -0
  94. package/dist/components/primitives/carousel.d.ts +106 -0
  95. package/dist/components/primitives/carousel.js +928 -0
  96. package/dist/components/primitives/dialog.d.ts +62 -0
  97. package/dist/components/primitives/dialog.js +490 -0
  98. package/dist/components/primitives/dropdown-menu-items.d.ts +59 -0
  99. package/dist/components/primitives/dropdown-menu-items.js +265 -0
  100. package/dist/components/primitives/dropdown-menu.d.ts +64 -0
  101. package/dist/components/primitives/dropdown-menu.js +560 -0
  102. package/dist/components/primitives/hover-card.d.ts +50 -0
  103. package/dist/components/primitives/hover-card.js +507 -0
  104. package/dist/components/primitives/pagination.d.ts +65 -0
  105. package/dist/components/primitives/pagination.js +373 -0
  106. package/dist/components/primitives/popover.d.ts +22 -0
  107. package/dist/components/primitives/popover.js +213 -0
  108. package/dist/components/primitives/select.d.ts +37 -0
  109. package/dist/components/primitives/select.js +428 -0
  110. package/dist/components/primitives/tooltip.d.ts +30 -0
  111. package/dist/components/primitives/tooltip.js +277 -0
  112. package/dist/components/progress-ring.d.ts +20 -0
  113. package/dist/components/progress-ring.js +53 -0
  114. package/dist/components/radio-group.d.ts +34 -0
  115. package/dist/components/radio-group.js +392 -0
  116. package/dist/components/reaction-button.d.ts +30 -0
  117. package/dist/components/reaction-button.js +189 -0
  118. package/dist/components/rich-link-editor.d.ts +25 -0
  119. package/dist/components/rich-link-editor.js +320 -0
  120. package/dist/components/rich-markdown-content.d.ts +10 -0
  121. package/dist/components/rich-markdown-content.js +56 -0
  122. package/dist/components/rich-text-content.d.ts +19 -0
  123. package/dist/components/rich-text-content.js +26 -0
  124. package/dist/components/select.d.ts +55 -0
  125. package/dist/components/select.js +188 -0
  126. package/dist/components/separator.d.ts +3 -0
  127. package/dist/components/separator.js +48 -0
  128. package/dist/components/sheet.d.ts +19 -0
  129. package/dist/components/sheet.js +420 -0
  130. package/dist/components/sidebar-panel-context.d.ts +17 -0
  131. package/dist/components/sidebar-panel-context.js +14 -0
  132. package/dist/components/sidebar.d.ts +195 -0
  133. package/dist/components/sidebar.js +2041 -0
  134. package/dist/components/skeleton.d.ts +23 -0
  135. package/dist/components/skeleton.js +334 -0
  136. package/dist/components/split-button.d.ts +36 -0
  137. package/dist/components/split-button.js +306 -0
  138. package/dist/components/svgs/whatsappIcon.d.ts +3 -0
  139. package/dist/components/svgs/whatsappIcon.js +14 -0
  140. package/dist/components/switch.d.ts +13 -0
  141. package/dist/components/switch.js +444 -0
  142. package/dist/components/table.d.ts +10 -0
  143. package/dist/components/table.js +298 -0
  144. package/dist/components/tabs.d.ts +36 -0
  145. package/dist/components/tabs.js +636 -0
  146. package/dist/components/textarea.d.ts +16 -0
  147. package/dist/components/textarea.js +111 -0
  148. package/dist/components/themed-toaster.d.ts +7 -0
  149. package/dist/components/themed-toaster.js +86 -0
  150. package/dist/components/toaster.d.ts +12 -0
  151. package/dist/components/toaster.js +62 -0
  152. package/dist/components/tooltip.d.ts +43 -0
  153. package/dist/components/tooltip.js +65 -0
  154. package/dist/components/typing-animation.d.ts +34 -0
  155. package/dist/components/typing-animation.js +389 -0
  156. package/dist/constants/action-button.d.ts +20 -0
  157. package/dist/constants/action-button.js +17 -0
  158. package/dist/constants/alert.d.ts +16 -0
  159. package/dist/constants/alert.js +13 -0
  160. package/dist/constants/avatar.d.ts +38 -0
  161. package/dist/constants/avatar.js +32 -0
  162. package/dist/constants/badge.d.ts +6 -0
  163. package/dist/constants/badge.js +6 -0
  164. package/dist/constants/button.d.ts +16 -0
  165. package/dist/constants/button.js +16 -0
  166. package/dist/constants/calendar.d.ts +36 -0
  167. package/dist/constants/calendar.js +34 -0
  168. package/dist/constants/card.d.ts +23 -0
  169. package/dist/constants/card.js +20 -0
  170. package/dist/constants/carousel.d.ts +55 -0
  171. package/dist/constants/carousel.js +74 -0
  172. package/dist/constants/checkbox.d.ts +17 -0
  173. package/dist/constants/checkbox.js +17 -0
  174. package/dist/constants/dialog.d.ts +11 -0
  175. package/dist/constants/dialog.js +10 -0
  176. package/dist/constants/dropdown-menu.d.ts +10 -0
  177. package/dist/constants/dropdown-menu.js +37 -0
  178. package/dist/constants/field.d.ts +24 -0
  179. package/dist/constants/field.js +24 -0
  180. package/dist/constants/hover-card.d.ts +37 -0
  181. package/dist/constants/hover-card.js +85 -0
  182. package/dist/constants/morph-text.d.ts +13 -0
  183. package/dist/constants/morph-text.js +13 -0
  184. package/dist/constants/motion.d.ts +12 -0
  185. package/dist/constants/motion.js +12 -0
  186. package/dist/constants/pagination.d.ts +20 -0
  187. package/dist/constants/pagination.js +20 -0
  188. package/dist/constants/popover.d.ts +7 -0
  189. package/dist/constants/popover.js +33 -0
  190. package/dist/constants/radio-group.d.ts +10 -0
  191. package/dist/constants/radio-group.js +10 -0
  192. package/dist/constants/select.d.ts +7 -0
  193. package/dist/constants/select.js +34 -0
  194. package/dist/constants/sidebar.d.ts +9 -0
  195. package/dist/constants/sidebar.js +17 -0
  196. package/dist/constants/skeleton.d.ts +17 -0
  197. package/dist/constants/skeleton.js +17 -0
  198. package/dist/constants/split-button.d.ts +7 -0
  199. package/dist/constants/split-button.js +5 -0
  200. package/dist/constants/switch.d.ts +33 -0
  201. package/dist/constants/switch.js +41 -0
  202. package/dist/constants/tabs.d.ts +17 -0
  203. package/dist/constants/tabs.js +17 -0
  204. package/dist/constants/toast.d.ts +3 -0
  205. package/dist/constants/toast.js +3 -0
  206. package/dist/constants/tooltip.d.ts +13 -0
  207. package/dist/constants/tooltip.js +52 -0
  208. package/dist/hooks/use-horizontal-swipe.d.ts +23 -0
  209. package/dist/hooks/use-horizontal-swipe.js +80 -0
  210. package/dist/hooks/use-is-hydrated.d.ts +6 -0
  211. package/dist/hooks/use-is-hydrated.js +20 -0
  212. package/dist/hooks/use-mobile.d.ts +1 -0
  213. package/dist/hooks/use-mobile.js +19 -0
  214. package/dist/hooks/use-prefers-reduced-motion.d.ts +2 -0
  215. package/dist/hooks/use-prefers-reduced-motion.js +27 -0
  216. package/dist/hooks/use-rich-link-editor.d.ts +55 -0
  217. package/dist/hooks/use-rich-link-editor.js +515 -0
  218. package/dist/hooks/use-sidebar-persistence.d.ts +6 -0
  219. package/dist/hooks/use-sidebar-persistence.js +52 -0
  220. package/dist/hooks/use-today.d.ts +7 -0
  221. package/dist/hooks/use-today.js +50 -0
  222. package/dist/hooks/use-viewer-time-zone.d.ts +6 -0
  223. package/dist/hooks/use-viewer-time-zone.js +20 -0
  224. package/dist/hooks.d.ts +11 -0
  225. package/dist/hooks.js +11 -0
  226. package/dist/index.d.ts +71 -0
  227. package/dist/index.js +69 -0
  228. package/dist/lib/browser-clipboard.d.ts +13 -0
  229. package/dist/lib/browser-clipboard.js +48 -0
  230. package/dist/lib/column-filter-value.d.ts +12 -0
  231. package/dist/lib/column-filter-value.js +52 -0
  232. package/dist/lib/file-acceptance.d.ts +43 -0
  233. package/dist/lib/file-acceptance.js +107 -0
  234. package/dist/lib/format-file-size.d.ts +16 -0
  235. package/dist/lib/format-file-size.js +34 -0
  236. package/dist/lib/fuzzy-search.d.ts +17 -0
  237. package/dist/lib/fuzzy-search.js +183 -0
  238. package/dist/lib/horizontal-swipe.d.ts +23 -0
  239. package/dist/lib/horizontal-swipe.js +29 -0
  240. package/dist/lib/image-dimensions.d.ts +2 -0
  241. package/dist/lib/image-dimensions.js +7 -0
  242. package/dist/lib/name-initials.d.ts +7 -0
  243. package/dist/lib/name-initials.js +11 -0
  244. package/dist/lib/rich-text/link-markdown-constants.d.ts +147 -0
  245. package/dist/lib/rich-text/link-markdown-constants.js +458 -0
  246. package/dist/lib/rich-text/link-markdown-types.d.ts +53 -0
  247. package/dist/lib/rich-text/link-markdown-types.js +1 -0
  248. package/dist/lib/rich-text/link-markdown.d.ts +193 -0
  249. package/dist/lib/rich-text/link-markdown.js +592 -0
  250. package/dist/lib/rich-text/rich-markdown.d.ts +41 -0
  251. package/dist/lib/rich-text/rich-markdown.js +105 -0
  252. package/dist/lib/rich-text/rich-text-editor-dom.d.ts +26 -0
  253. package/dist/lib/rich-text/rich-text-editor-dom.js +79 -0
  254. package/dist/lib/toast-layer.d.ts +24 -0
  255. package/dist/lib/toast-layer.js +76 -0
  256. package/dist/lib/utils.d.ts +2 -0
  257. package/dist/lib/utils.js +2 -0
  258. package/dist/lib/year-month-filter.d.ts +16 -0
  259. package/dist/lib/year-month-filter.js +46 -0
  260. package/dist/motion/arc-floating-slot.d.ts +40 -0
  261. package/dist/motion/arc-floating-slot.js +177 -0
  262. package/dist/motion/arc-press.d.ts +6 -0
  263. package/dist/motion/arc-press.js +59 -0
  264. package/dist/motion/arc-swap.d.ts +22 -0
  265. package/dist/motion/arc-swap.js +49 -0
  266. package/dist/motion/arc-tokens.d.ts +53 -0
  267. package/dist/motion/arc-tokens.js +73 -0
  268. package/dist/motion/glide-indicator.d.ts +69 -0
  269. package/dist/motion/glide-indicator.js +309 -0
  270. package/dist/motion/glide-slot.d.ts +9 -0
  271. package/dist/motion/glide-slot.js +71 -0
  272. package/dist/motion/motion-slot.d.ts +12 -0
  273. package/dist/motion/motion-slot.js +376 -0
  274. package/dist/motion/overlay-warmth.d.ts +24 -0
  275. package/dist/motion/overlay-warmth.js +70 -0
  276. package/dist/motion/presence.d.ts +40 -0
  277. package/dist/motion/presence.js +101 -0
  278. package/dist/motion/surface-keyframes.d.ts +24 -0
  279. package/dist/motion/surface-keyframes.js +141 -0
  280. package/dist/motion/tokens.d.ts +81 -0
  281. package/dist/motion/tokens.js +67 -0
  282. package/dist/motion/use-attached-element.d.ts +7 -0
  283. package/dist/motion/use-attached-element.js +22 -0
  284. package/dist/motion/use-morph-width.d.ts +13 -0
  285. package/dist/motion/use-morph-width.js +59 -0
  286. package/dist/next.d.ts +14 -0
  287. package/dist/next.js +79 -0
  288. package/dist/providers/astra-ui-provider.d.ts +27 -0
  289. package/dist/providers/astra-ui-provider.js +100 -0
  290. package/dist/providers/native-provider.d.ts +4 -0
  291. package/dist/providers/native-provider.js +45 -0
  292. package/dist/sonner.d.ts +7 -0
  293. package/dist/sonner.js +8 -0
  294. package/dist/styles.css +2 -0
  295. package/dist/tanstack.d.ts +11 -0
  296. package/dist/tanstack.js +50 -0
  297. package/dist/theme.d.ts +3 -0
  298. package/dist/theme.js +1 -0
  299. package/dist/types/data-table.d.ts +27 -0
  300. package/dist/types/data-table.js +1 -0
  301. package/fonts.css +5 -0
  302. package/package.json +450 -4
  303. package/styles.css +4 -0
  304. package/theme.css +248 -0
@@ -0,0 +1,710 @@
1
+ "use client";
2
+ import { c as _c } from "react/compiler-runtime";
3
+ /**
4
+ * Labelled field with animated helper and error rows, adapted from Arc's Input and Textarea (https://uiarc.dev),
5
+ * Copyright (c) 2026 Elia Kuratli, MIT License. The full license text ships in THIRD_PARTY_NOTICES.md.
6
+ * Internal: shared by `Input` and `Textarea`, which render it only when they receive a label, description or error.
7
+ */
8
+ import { useEffect, useId, useRef, useState } from "react";
9
+ import { AnimatePresence, motion } from "motion/react";
10
+ import { FIELD_MESSAGE_DIGIT_OFFSET_EM, FIELD_MESSAGE_ID_SUFFIX, FIELD_MESSAGE_COMPONENT_SEPARATOR_PATTERN, FIELD_MESSAGE_DECIMAL_COMMA, FIELD_MESSAGE_GROUP_SEPARATOR_PATTERN, FIELD_MESSAGE_NUMBER_PATTERN, FIELD_MESSAGE_WORD_OFFSET_EM } from "../constants/field.js";
11
+ import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion.js";
12
+ import { cn } from "../lib/utils.js";
13
+ import { ARC_BLUR, ARC_DURATION, ARC_EASE, ARC_SPRING_MORPH, ARC_SPRING_SMOOTH, ARC_SPRING_SNAPPY } from "../motion/arc-tokens.js";
14
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
15
+ const digitVariants = {
16
+ enter: (direction) => ({
17
+ opacity: 0,
18
+ y: `${direction * FIELD_MESSAGE_DIGIT_OFFSET_EM}em`,
19
+ filter: `blur(${ARC_BLUR.subtle}px)`
20
+ }),
21
+ center: {
22
+ opacity: 1,
23
+ y: 0,
24
+ filter: "blur(0px)"
25
+ },
26
+ exit: (direction) => ({
27
+ opacity: 0,
28
+ y: `${-direction * FIELD_MESSAGE_DIGIT_OFFSET_EM}em`,
29
+ filter: `blur(${ARC_BLUR.subtle}px)`
30
+ })
31
+ };
32
+ const instantTransition = { duration: 0 };
33
+ /**
34
+ * Arc `spring.snappy` without its bounce: a rolled digit must land on its line, since even the small overshoot of the
35
+ * bouncy preset pushes it past rest toward the side it came from.
36
+ */
37
+ const digitRollSpring = {
38
+ ...ARC_SPRING_SNAPPY,
39
+ bounce: 0
40
+ };
41
+ /**
42
+ * Reads one component of a count as a number, in English or Spanish formatting: grouping separators are dropped and
43
+ * a decimal comma becomes a point.
44
+ * @param component - A count, or one side of a time or ratio.
45
+ * @returns Its numeric value.
46
+ */
47
+ function parseCountComponent(component) {
48
+ return parseFloat(component.replace(FIELD_MESSAGE_GROUP_SEPARATOR_PATTERN, "").replace(FIELD_MESSAGE_DECIMAL_COMMA, "."));
49
+ }
50
+ /**
51
+ * Tells whether a count went down. Times and ratios compare component by component from the left, so `0:10` to
52
+ * `0:09` counts as a decrease.
53
+ * @param next - The new count.
54
+ * @param previous - The count shown before.
55
+ * @returns `true` when `next` is smaller than `previous`.
56
+ */
57
+ function isCountDecrease(next, previous) {
58
+ const nextComponents = next.split(FIELD_MESSAGE_COMPONENT_SEPARATOR_PATTERN).map(parseCountComponent);
59
+ const previousComponents = previous.split(FIELD_MESSAGE_COMPONENT_SEPARATOR_PATTERN).map(parseCountComponent);
60
+ for (let index = 0; index < Math.min(nextComponents.length, previousComponents.length); index++) {
61
+ if (nextComponents[index] !== previousComponents[index]) return nextComponents[index] < previousComponents[index];
62
+ }
63
+ return false;
64
+ }
65
+ /**
66
+ * Keys each word by its text and how many times that text appeared before it, so a word keeps its key when copy is
67
+ * inserted or removed before it and only the words that really changed animate. Counts are keyed by their order
68
+ * among counts instead of their value, so a changing count rolls its digits instead of being replaced.
69
+ * @param words - Words of the message in reading order.
70
+ * @returns The words with their keys.
71
+ */
72
+ function keyWords(words) {
73
+ const occurrences = new Map();
74
+ return words.map((word) => {
75
+ const isCount = FIELD_MESSAGE_NUMBER_PATTERN.test(word);
76
+ const identity = isCount ? "#" : `w:${word}`;
77
+ const occurrence = occurrences.get(identity) ?? 0;
78
+ occurrences.set(identity, occurrence + 1);
79
+ return {
80
+ word,
81
+ isCount,
82
+ key: `${identity}:${occurrence}`
83
+ };
84
+ });
85
+ }
86
+ /**
87
+ * A count in the copy, such as "12 caracteres", rolls only the digits that changed, up when it grows and down when
88
+ * it shrinks; a gained or lost digit opens or closes its width.
89
+ */
90
+ function RollingNumber(t0) {
91
+ const $ = _c(14);
92
+ const { word } = t0;
93
+ const reduceMotion = usePrefersReducedMotion();
94
+ let t1;
95
+ if ($[0] !== word) {
96
+ t1 = {
97
+ word,
98
+ direction: 1
99
+ };
100
+ $[0] = word;
101
+ $[1] = t1;
102
+ } else {
103
+ t1 = $[1];
104
+ }
105
+ const [shown, setShown] = useState(t1);
106
+ if (shown.word !== word) {
107
+ setShown({
108
+ word,
109
+ direction: isCountDecrease(word, shown.word) ? -1 : 1
110
+ });
111
+ }
112
+ let T0;
113
+ let t2;
114
+ let t3;
115
+ if ($[2] !== reduceMotion || $[3] !== shown.direction || $[4] !== word) {
116
+ const characters = word.split("");
117
+ let t4;
118
+ if ($[8] !== reduceMotion) {
119
+ t4 = reduceMotion ? instantTransition : {
120
+ y: digitRollSpring,
121
+ width: ARC_SPRING_MORPH,
122
+ opacity: { duration: ARC_DURATION.fast },
123
+ filter: { duration: ARC_DURATION.fast }
124
+ };
125
+ $[8] = reduceMotion;
126
+ $[9] = t4;
127
+ } else {
128
+ t4 = $[9];
129
+ }
130
+ const transition = t4;
131
+ T0 = AnimatePresence;
132
+ t2 = false;
133
+ t3 = characters.map((character, index) => /* @__PURE__ */ _jsx(motion.span, {
134
+ className: "relative inline-flex justify-center tabular-nums",
135
+ initial: reduceMotion ? false : {
136
+ width: 0,
137
+ opacity: 0
138
+ },
139
+ animate: {
140
+ width: "auto",
141
+ opacity: 1
142
+ },
143
+ exit: {
144
+ width: 0,
145
+ opacity: 0
146
+ },
147
+ transition,
148
+ children: /* @__PURE__ */ _jsx(AnimatePresence, {
149
+ initial: false,
150
+ mode: "popLayout",
151
+ custom: shown.direction,
152
+ children: /* @__PURE__ */ _jsx(motion.span, {
153
+ className: "inline-block",
154
+ custom: shown.direction,
155
+ variants: digitVariants,
156
+ initial: reduceMotion ? false : "enter",
157
+ animate: "center",
158
+ exit: "exit",
159
+ transition,
160
+ children: character
161
+ }, character)
162
+ })
163
+ }, characters.length - index));
164
+ $[2] = reduceMotion;
165
+ $[3] = shown.direction;
166
+ $[4] = word;
167
+ $[5] = T0;
168
+ $[6] = t2;
169
+ $[7] = t3;
170
+ } else {
171
+ T0 = $[5];
172
+ t2 = $[6];
173
+ t3 = $[7];
174
+ }
175
+ let t4;
176
+ if ($[10] !== T0 || $[11] !== t2 || $[12] !== t3) {
177
+ t4 = /* @__PURE__ */ _jsx(T0, {
178
+ initial: t2,
179
+ children: t3
180
+ });
181
+ $[10] = T0;
182
+ $[11] = t2;
183
+ $[12] = t3;
184
+ $[13] = t4;
185
+ } else {
186
+ t4 = $[13];
187
+ }
188
+ return t4;
189
+ }
190
+ /** Changed words rise in and unblur while unchanged words hold still, and counts roll. Assistive tech reads the plain copy. */
191
+ function MotionText(t0) {
192
+ const $ = _c(23);
193
+ const { text } = t0;
194
+ const reduceMotion = usePrefersReducedMotion();
195
+ let T0;
196
+ let t1;
197
+ let t2;
198
+ let t3;
199
+ let t4;
200
+ let t5;
201
+ let t6;
202
+ if ($[0] !== reduceMotion || $[1] !== text) {
203
+ const words = text.split(" ");
204
+ if ($[9] !== text) {
205
+ t6 = /* @__PURE__ */ _jsx("span", {
206
+ className: "sr-only",
207
+ children: text
208
+ });
209
+ $[9] = text;
210
+ $[10] = t6;
211
+ } else {
212
+ t6 = $[10];
213
+ }
214
+ t4 = "relative block";
215
+ t5 = "true";
216
+ T0 = AnimatePresence;
217
+ t1 = false;
218
+ t2 = "popLayout";
219
+ t3 = keyWords(words).map((t7, index) => {
220
+ const { word, isCount, key } = t7;
221
+ return /* @__PURE__ */ _jsxs(motion.span, {
222
+ className: "inline-block whitespace-pre",
223
+ initial: reduceMotion ? false : {
224
+ opacity: 0,
225
+ y: `${FIELD_MESSAGE_WORD_OFFSET_EM.enter}em`,
226
+ filter: `blur(${ARC_BLUR.soft}px)`
227
+ },
228
+ animate: {
229
+ opacity: 1,
230
+ y: 0,
231
+ filter: "blur(0px)"
232
+ },
233
+ exit: reduceMotion ? {
234
+ opacity: 0,
235
+ transition: instantTransition
236
+ } : {
237
+ opacity: 0,
238
+ y: `${FIELD_MESSAGE_WORD_OFFSET_EM.exit}em`,
239
+ filter: `blur(${ARC_BLUR.subtle}px)`,
240
+ transition: {
241
+ duration: ARC_DURATION.exit,
242
+ ease: [...ARC_EASE.standard]
243
+ }
244
+ },
245
+ transition: reduceMotion ? instantTransition : {
246
+ duration: ARC_DURATION.standard,
247
+ ease: [...ARC_EASE.enter]
248
+ },
249
+ children: [isCount ? /* @__PURE__ */ _jsx(RollingNumber, { word }) : word, index < words.length - 1 ? " " : null]
250
+ }, key);
251
+ });
252
+ $[0] = reduceMotion;
253
+ $[1] = text;
254
+ $[2] = T0;
255
+ $[3] = t1;
256
+ $[4] = t2;
257
+ $[5] = t3;
258
+ $[6] = t4;
259
+ $[7] = t5;
260
+ $[8] = t6;
261
+ } else {
262
+ T0 = $[2];
263
+ t1 = $[3];
264
+ t2 = $[4];
265
+ t3 = $[5];
266
+ t4 = $[6];
267
+ t5 = $[7];
268
+ t6 = $[8];
269
+ }
270
+ let t7;
271
+ if ($[11] !== T0 || $[12] !== t1 || $[13] !== t2 || $[14] !== t3) {
272
+ t7 = /* @__PURE__ */ _jsx(T0, {
273
+ initial: t1,
274
+ mode: t2,
275
+ children: t3
276
+ });
277
+ $[11] = T0;
278
+ $[12] = t1;
279
+ $[13] = t2;
280
+ $[14] = t3;
281
+ $[15] = t7;
282
+ } else {
283
+ t7 = $[15];
284
+ }
285
+ let t8;
286
+ if ($[16] !== t4 || $[17] !== t5 || $[18] !== t7) {
287
+ t8 = /* @__PURE__ */ _jsx("span", {
288
+ className: t4,
289
+ "aria-hidden": t5,
290
+ children: t7
291
+ });
292
+ $[16] = t4;
293
+ $[17] = t5;
294
+ $[18] = t7;
295
+ $[19] = t8;
296
+ } else {
297
+ t8 = $[19];
298
+ }
299
+ let t9;
300
+ if ($[20] !== t6 || $[21] !== t8) {
301
+ t9 = /* @__PURE__ */ _jsxs(_Fragment, { children: [t6, t8] });
302
+ $[20] = t6;
303
+ $[21] = t8;
304
+ $[22] = t9;
305
+ } else {
306
+ t9 = $[22];
307
+ }
308
+ return t9;
309
+ }
310
+ /**
311
+ * A helper or error row: it opens its height on a smooth spring, then the words settle in. The row tracks the
312
+ * measured copy, so a longer message that wraps opens its next line instead of snapping.
313
+ */
314
+ function MessageRow(t0) {
315
+ const $ = _c(36);
316
+ const { id, text, className, alert: t1 } = t0;
317
+ const alert = t1 === undefined ? false : t1;
318
+ const reduceMotion = usePrefersReducedMotion();
319
+ const copyRef = useRef(null);
320
+ const [height, setHeight] = useState("auto");
321
+ let t2;
322
+ let t3;
323
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
324
+ t2 = () => {
325
+ const copyElement = copyRef.current;
326
+ if (!copyElement || typeof ResizeObserver === "undefined") {
327
+ return;
328
+ }
329
+ const observer = new ResizeObserver((t4) => {
330
+ const [entry] = t4;
331
+ if (entry) {
332
+ setHeight(entry.borderBoxSize?.[0]?.blockSize ?? copyElement.offsetHeight);
333
+ }
334
+ });
335
+ observer.observe(copyElement);
336
+ return () => observer.disconnect();
337
+ };
338
+ t3 = [];
339
+ $[0] = t2;
340
+ $[1] = t3;
341
+ } else {
342
+ t2 = $[0];
343
+ t3 = $[1];
344
+ }
345
+ useEffect(t2, t3);
346
+ let t4;
347
+ if ($[2] !== reduceMotion) {
348
+ t4 = reduceMotion ? false : {
349
+ height: 0,
350
+ opacity: 0
351
+ };
352
+ $[2] = reduceMotion;
353
+ $[3] = t4;
354
+ } else {
355
+ t4 = $[3];
356
+ }
357
+ let t5;
358
+ if ($[4] !== height) {
359
+ t5 = {
360
+ height,
361
+ opacity: 1
362
+ };
363
+ $[4] = height;
364
+ $[5] = t5;
365
+ } else {
366
+ t5 = $[5];
367
+ }
368
+ let t6;
369
+ if ($[6] !== reduceMotion) {
370
+ t6 = reduceMotion ? instantTransition : {
371
+ height: ARC_SPRING_SMOOTH,
372
+ opacity: { duration: ARC_DURATION.instant }
373
+ };
374
+ $[6] = reduceMotion;
375
+ $[7] = t6;
376
+ } else {
377
+ t6 = $[7];
378
+ }
379
+ let t7;
380
+ if ($[8] !== t6) {
381
+ t7 = {
382
+ height: 0,
383
+ opacity: 0,
384
+ transition: t6
385
+ };
386
+ $[8] = t6;
387
+ $[9] = t7;
388
+ } else {
389
+ t7 = $[9];
390
+ }
391
+ let t8;
392
+ if ($[10] !== reduceMotion) {
393
+ t8 = reduceMotion ? instantTransition : {
394
+ height: ARC_SPRING_SMOOTH,
395
+ opacity: { duration: ARC_DURATION.fast }
396
+ };
397
+ $[10] = reduceMotion;
398
+ $[11] = t8;
399
+ } else {
400
+ t8 = $[11];
401
+ }
402
+ const t9 = alert ? "field-error" : "field-description";
403
+ let t10;
404
+ if ($[12] !== className) {
405
+ t10 = cn("block pt-(--space-2) text-xs leading-(--leading-body)", className);
406
+ $[12] = className;
407
+ $[13] = t10;
408
+ } else {
409
+ t10 = $[13];
410
+ }
411
+ const t11 = alert ? "alert" : undefined;
412
+ let t12;
413
+ if ($[14] !== reduceMotion) {
414
+ t12 = reduceMotion ? false : {
415
+ y: `${FIELD_MESSAGE_WORD_OFFSET_EM.enter}em`,
416
+ filter: `blur(${ARC_BLUR.soft}px)`
417
+ };
418
+ $[14] = reduceMotion;
419
+ $[15] = t12;
420
+ } else {
421
+ t12 = $[15];
422
+ }
423
+ let t13;
424
+ if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
425
+ t13 = {
426
+ y: 0,
427
+ filter: "blur(0px)"
428
+ };
429
+ $[16] = t13;
430
+ } else {
431
+ t13 = $[16];
432
+ }
433
+ const t14 = reduceMotion ? 0 : ARC_DURATION.standard;
434
+ let t15;
435
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
436
+ t15 = [...ARC_EASE.enter];
437
+ $[17] = t15;
438
+ } else {
439
+ t15 = $[17];
440
+ }
441
+ let t16;
442
+ if ($[18] !== t14) {
443
+ t16 = {
444
+ duration: t14,
445
+ ease: t15
446
+ };
447
+ $[18] = t14;
448
+ $[19] = t16;
449
+ } else {
450
+ t16 = $[19];
451
+ }
452
+ let t17;
453
+ if ($[20] !== text) {
454
+ t17 = /* @__PURE__ */ _jsx(MotionText, { text });
455
+ $[20] = text;
456
+ $[21] = t17;
457
+ } else {
458
+ t17 = $[21];
459
+ }
460
+ let t18;
461
+ if ($[22] !== id || $[23] !== t10 || $[24] !== t11 || $[25] !== t12 || $[26] !== t16 || $[27] !== t17 || $[28] !== t9) {
462
+ t18 = /* @__PURE__ */ _jsx(motion.span, {
463
+ ref: copyRef,
464
+ id,
465
+ "data-slot": t9,
466
+ className: t10,
467
+ role: t11,
468
+ initial: t12,
469
+ animate: t13,
470
+ transition: t16,
471
+ children: t17
472
+ });
473
+ $[22] = id;
474
+ $[23] = t10;
475
+ $[24] = t11;
476
+ $[25] = t12;
477
+ $[26] = t16;
478
+ $[27] = t17;
479
+ $[28] = t9;
480
+ $[29] = t18;
481
+ } else {
482
+ t18 = $[29];
483
+ }
484
+ let t19;
485
+ if ($[30] !== t18 || $[31] !== t4 || $[32] !== t5 || $[33] !== t7 || $[34] !== t8) {
486
+ t19 = /* @__PURE__ */ _jsx(motion.span, {
487
+ className: "block overflow-hidden",
488
+ initial: t4,
489
+ animate: t5,
490
+ exit: t7,
491
+ transition: t8,
492
+ children: t18
493
+ });
494
+ $[30] = t18;
495
+ $[31] = t4;
496
+ $[32] = t5;
497
+ $[33] = t7;
498
+ $[34] = t8;
499
+ $[35] = t19;
500
+ } else {
501
+ t19 = $[35];
502
+ }
503
+ return t19;
504
+ }
505
+ /** Mounts a message row while there is copy, and closes it when the copy goes away. */
506
+ function FieldMessage(t0) {
507
+ const $ = _c(8);
508
+ let props;
509
+ let text;
510
+ if ($[0] !== t0) {
511
+ ({text, ...props} = t0);
512
+ $[0] = t0;
513
+ $[1] = props;
514
+ $[2] = text;
515
+ } else {
516
+ props = $[1];
517
+ text = $[2];
518
+ }
519
+ let t1;
520
+ if ($[3] !== props || $[4] !== text) {
521
+ t1 = text ? /* @__PURE__ */ _jsx(MessageRow, {
522
+ text,
523
+ ...props
524
+ }, "message") : null;
525
+ $[3] = props;
526
+ $[4] = text;
527
+ $[5] = t1;
528
+ } else {
529
+ t1 = $[5];
530
+ }
531
+ let t2;
532
+ if ($[6] !== t1) {
533
+ t2 = /* @__PURE__ */ _jsx(AnimatePresence, {
534
+ initial: false,
535
+ children: t1
536
+ });
537
+ $[6] = t1;
538
+ $[7] = t2;
539
+ } else {
540
+ t2 = $[7];
541
+ }
542
+ return t2;
543
+ }
544
+ /**
545
+ * Resolves the control id (the caller's or a generated one) and merges the helper and error ids into the caller's
546
+ * `aria-describedby`. An error always marks the control invalid.
547
+ * @param options - Field copy and the caller's id and ARIA attributes.
548
+ * @returns The ids and ARIA attributes for the control.
549
+ */
550
+ export function useFieldAria(t0) {
551
+ const $ = _c(15);
552
+ let aria;
553
+ let description;
554
+ let error;
555
+ let id;
556
+ if ($[0] !== t0) {
557
+ ({id, description, error, ...aria} = t0);
558
+ $[0] = t0;
559
+ $[1] = aria;
560
+ $[2] = description;
561
+ $[3] = error;
562
+ $[4] = id;
563
+ } else {
564
+ aria = $[1];
565
+ description = $[2];
566
+ error = $[3];
567
+ id = $[4];
568
+ }
569
+ const generatedId = useId();
570
+ const controlId = id ?? generatedId;
571
+ const descriptionId = `${controlId}-${FIELD_MESSAGE_ID_SUFFIX.description}`;
572
+ const errorId = `${controlId}-${FIELD_MESSAGE_ID_SUFFIX.error}`;
573
+ const t1 = aria["aria-describedby"];
574
+ const t2 = description ? descriptionId : undefined;
575
+ const t3 = error ? errorId : undefined;
576
+ let t4;
577
+ if ($[5] !== t1 || $[6] !== t2 || $[7] !== t3) {
578
+ t4 = [
579
+ t1,
580
+ t2,
581
+ t3
582
+ ].filter(Boolean);
583
+ $[5] = t1;
584
+ $[6] = t2;
585
+ $[7] = t3;
586
+ $[8] = t4;
587
+ } else {
588
+ t4 = $[8];
589
+ }
590
+ const describedBy = t4.join(" ");
591
+ const t5 = describedBy || undefined;
592
+ const t6 = error ? true : aria["aria-invalid"];
593
+ let t7;
594
+ if ($[9] !== controlId || $[10] !== descriptionId || $[11] !== errorId || $[12] !== t5 || $[13] !== t6) {
595
+ t7 = {
596
+ controlId,
597
+ descriptionId,
598
+ errorId,
599
+ "aria-describedby": t5,
600
+ "aria-invalid": t6
601
+ };
602
+ $[9] = controlId;
603
+ $[10] = descriptionId;
604
+ $[11] = errorId;
605
+ $[12] = t5;
606
+ $[13] = t6;
607
+ $[14] = t7;
608
+ } else {
609
+ t7 = $[14];
610
+ }
611
+ return t7;
612
+ }
613
+ /** Props that turn a bare control into a labelled field. */
614
+ const FIELD_COPY_PROPS = [
615
+ "label",
616
+ "description",
617
+ "error"
618
+ ];
619
+ /**
620
+ * Tells whether a control renders as a labelled field. It looks at which props were passed, not at their values, so a
621
+ * field whose error or description comes and goes keeps the same tree and its control never remounts (losing an
622
+ * uncontrolled value or the focus) when validation appears.
623
+ * @param props - Props passed to the control.
624
+ * @returns `true` when the caller passed `label`, `description` or `error`, even as `undefined`.
625
+ */
626
+ export function usesFieldCopy(props) {
627
+ return FIELD_COPY_PROPS.some((propName) => propName in props);
628
+ }
629
+ /**
630
+ * Arc's field layout: label, control, then the helper and error rows. There is no row gap, because grid tracks clamp
631
+ * a negative margin at zero and a closed row would still pay it; each row carries its own space instead. The wrapper
632
+ * keeps the bare control's full-width contract, so a field fills a flex row like the control alone does.
633
+ */
634
+ export function Field(t0) {
635
+ const $ = _c(18);
636
+ const { label, hideLabel: t1, description, error, aria, className, children } = t0;
637
+ const hideLabel = t1 === undefined ? false : t1;
638
+ let t2;
639
+ if ($[0] !== className) {
640
+ t2 = cn("grid w-full min-w-0", className);
641
+ $[0] = className;
642
+ $[1] = t2;
643
+ } else {
644
+ t2 = $[1];
645
+ }
646
+ let t3;
647
+ if ($[2] !== aria.controlId || $[3] !== hideLabel || $[4] !== label) {
648
+ t3 = label ? /* @__PURE__ */ _jsx("label", {
649
+ "data-slot": "field-label",
650
+ htmlFor: aria.controlId,
651
+ className: hideLabel ? "sr-only" : "mb-(--space-2) text-sm leading-(--leading-body) font-medium text-foreground",
652
+ children: label
653
+ }) : null;
654
+ $[2] = aria.controlId;
655
+ $[3] = hideLabel;
656
+ $[4] = label;
657
+ $[5] = t3;
658
+ } else {
659
+ t3 = $[5];
660
+ }
661
+ let t4;
662
+ if ($[6] !== aria.descriptionId || $[7] !== description) {
663
+ t4 = /* @__PURE__ */ _jsx(FieldMessage, {
664
+ id: aria.descriptionId,
665
+ text: description,
666
+ className: "text-text-muted"
667
+ });
668
+ $[6] = aria.descriptionId;
669
+ $[7] = description;
670
+ $[8] = t4;
671
+ } else {
672
+ t4 = $[8];
673
+ }
674
+ let t5;
675
+ if ($[9] !== aria.errorId || $[10] !== error) {
676
+ t5 = /* @__PURE__ */ _jsx(FieldMessage, {
677
+ id: aria.errorId,
678
+ text: error,
679
+ className: "text-danger",
680
+ alert: true
681
+ });
682
+ $[9] = aria.errorId;
683
+ $[10] = error;
684
+ $[11] = t5;
685
+ } else {
686
+ t5 = $[11];
687
+ }
688
+ let t6;
689
+ if ($[12] !== children || $[13] !== t2 || $[14] !== t3 || $[15] !== t4 || $[16] !== t5) {
690
+ t6 = /* @__PURE__ */ _jsxs("div", {
691
+ "data-slot": "field",
692
+ className: t2,
693
+ children: [
694
+ t3,
695
+ children,
696
+ t4,
697
+ t5
698
+ ]
699
+ });
700
+ $[12] = children;
701
+ $[13] = t2;
702
+ $[14] = t3;
703
+ $[15] = t4;
704
+ $[16] = t5;
705
+ $[17] = t6;
706
+ } else {
707
+ t6 = $[17];
708
+ }
709
+ return t6;
710
+ }