@rinzai/zen 0.11.0 → 0.14.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 (289) hide show
  1. package/README.md +37 -7
  2. package/dist/accordion/index.d.ts +41 -0
  3. package/dist/accordion/index.d.ts.map +1 -0
  4. package/dist/accordion/index.js +81 -0
  5. package/dist/animated-number/index.d.ts +3 -2
  6. package/dist/animated-number/index.d.ts.map +1 -1
  7. package/dist/animated-number/index.js +40 -38
  8. package/dist/avatar/index.d.ts +7 -2
  9. package/dist/avatar/index.d.ts.map +1 -1
  10. package/dist/avatar/index.js +17 -11
  11. package/dist/backdrop/index.d.ts +4 -4
  12. package/dist/backdrop/index.d.ts.map +1 -1
  13. package/dist/backdrop/index.js +41 -39
  14. package/dist/badge/index.d.ts +4 -2
  15. package/dist/badge/index.d.ts.map +1 -1
  16. package/dist/badge/index.js +20 -11
  17. package/dist/base.css +4 -0
  18. package/dist/breadcrumbs/index.d.ts +1 -1
  19. package/dist/breadcrumbs/index.d.ts.map +1 -1
  20. package/dist/breadcrumbs/index.js +25 -24
  21. package/dist/button/index.d.ts +3 -3
  22. package/dist/button/index.d.ts.map +1 -1
  23. package/dist/button/index.js +16 -11
  24. package/dist/button-group/index.d.ts +13 -0
  25. package/dist/button-group/index.d.ts.map +1 -0
  26. package/dist/button-group/index.js +14 -0
  27. package/dist/calendar/index.d.ts +15 -8
  28. package/dist/calendar/index.d.ts.map +1 -1
  29. package/dist/calendar/index.js +97 -91
  30. package/dist/calendar-heatmap/index.d.ts +7 -5
  31. package/dist/calendar-heatmap/index.d.ts.map +1 -1
  32. package/dist/calendar-heatmap/index.js +32 -30
  33. package/dist/canvas/geometry.js +0 -1
  34. package/dist/canvas/index.d.ts +6 -6
  35. package/dist/canvas/index.d.ts.map +1 -1
  36. package/dist/canvas/index.js +135 -133
  37. package/dist/carousel/index.d.ts +27 -0
  38. package/dist/carousel/index.d.ts.map +1 -0
  39. package/dist/carousel/index.js +162 -0
  40. package/dist/chart/index.d.ts +5 -4
  41. package/dist/chart/index.d.ts.map +1 -1
  42. package/dist/chart/index.js +137 -135
  43. package/dist/chart/palette.js +0 -1
  44. package/dist/checkbox/index.d.ts +3 -3
  45. package/dist/checkbox/index.d.ts.map +1 -1
  46. package/dist/checkbox/index.js +33 -30
  47. package/dist/chip/index.js +1 -1
  48. package/dist/code-block/index.d.ts.map +1 -1
  49. package/dist/code-block/index.js +27 -25
  50. package/dist/code-input/index.d.ts.map +1 -1
  51. package/dist/code-input/index.js +30 -24
  52. package/dist/collapse/index.d.ts +4 -3
  53. package/dist/collapse/index.d.ts.map +1 -1
  54. package/dist/collapse/index.js +42 -39
  55. package/dist/color-picker/index.d.ts +14 -7
  56. package/dist/color-picker/index.d.ts.map +1 -1
  57. package/dist/color-picker/index.js +139 -128
  58. package/dist/combobox/index.d.ts +14 -6
  59. package/dist/combobox/index.d.ts.map +1 -1
  60. package/dist/combobox/index.js +158 -146
  61. package/dist/command-palette/index.d.ts +4 -3
  62. package/dist/command-palette/index.d.ts.map +1 -1
  63. package/dist/command-palette/index.js +60 -57
  64. package/dist/confirm-dialog/index.d.ts +6 -7
  65. package/dist/confirm-dialog/index.d.ts.map +1 -1
  66. package/dist/confirm-dialog/index.js +20 -16
  67. package/dist/date-picker/index.d.ts +23 -14
  68. package/dist/date-picker/index.d.ts.map +1 -1
  69. package/dist/date-picker/index.js +109 -93
  70. package/dist/dialog/index.d.ts +3 -4
  71. package/dist/dialog/index.d.ts.map +1 -1
  72. package/dist/dialog/index.js +58 -55
  73. package/dist/disclosure/index.d.ts +8 -0
  74. package/dist/disclosure/index.d.ts.map +1 -1
  75. package/dist/disclosure/index.js +31 -32
  76. package/dist/editable-cell/index.d.ts +4 -5
  77. package/dist/editable-cell/index.d.ts.map +1 -1
  78. package/dist/editable-cell/index.js +23 -22
  79. package/dist/field/index.d.ts +8 -8
  80. package/dist/field/index.d.ts.map +1 -1
  81. package/dist/field/index.js +20 -18
  82. package/dist/filter-bar/index.d.ts +2 -2
  83. package/dist/filter-bar/index.d.ts.map +1 -1
  84. package/dist/filter-bar/index.js +38 -36
  85. package/dist/header/index.d.ts +1 -1
  86. package/dist/header/index.d.ts.map +1 -1
  87. package/dist/header/index.js +13 -11
  88. package/dist/hover-card/index.d.ts +32 -0
  89. package/dist/hover-card/index.d.ts.map +1 -0
  90. package/dist/hover-card/index.js +84 -0
  91. package/dist/icon-picker/index.d.ts +16 -5
  92. package/dist/icon-picker/index.d.ts.map +1 -1
  93. package/dist/icon-picker/index.js +42 -47
  94. package/dist/icons/micro/plus.d.ts +3 -0
  95. package/dist/icons/micro/plus.d.ts.map +1 -0
  96. package/dist/icons/micro/plus.js +17 -0
  97. package/dist/index.d.ts +37 -24
  98. package/dist/index.d.ts.map +1 -1
  99. package/dist/input/index.d.ts +5 -1
  100. package/dist/input/index.d.ts.map +1 -1
  101. package/dist/input/index.js +9 -9
  102. package/dist/input-group/index.d.ts +4 -1
  103. package/dist/input-group/index.d.ts.map +1 -1
  104. package/dist/input-group/index.js +14 -14
  105. package/dist/keypad/index.d.ts +9 -7
  106. package/dist/keypad/index.d.ts.map +1 -1
  107. package/dist/keypad/index.js +22 -19
  108. package/dist/lib.js +112 -97
  109. package/dist/load-more/index.d.ts +4 -2
  110. package/dist/load-more/index.d.ts.map +1 -1
  111. package/dist/load-more/index.js +26 -23
  112. package/dist/locale-provider/index.d.ts +23 -0
  113. package/dist/locale-provider/index.d.ts.map +1 -0
  114. package/dist/locale-provider/index.js +35 -0
  115. package/dist/menu/index.d.ts +62 -9
  116. package/dist/menu/index.d.ts.map +1 -1
  117. package/dist/menu/index.js +371 -128
  118. package/dist/meter/index.d.ts +2 -2
  119. package/dist/meter/index.d.ts.map +1 -1
  120. package/dist/meter/index.js +4 -4
  121. package/dist/money-input/index.d.ts +20 -10
  122. package/dist/money-input/index.d.ts.map +1 -1
  123. package/dist/money-input/index.js +199 -190
  124. package/dist/month-picker/index.d.ts +17 -10
  125. package/dist/month-picker/index.d.ts.map +1 -1
  126. package/dist/month-picker/index.js +97 -86
  127. package/dist/navigation-menu/index.d.ts +42 -0
  128. package/dist/navigation-menu/index.d.ts.map +1 -0
  129. package/dist/navigation-menu/index.js +144 -0
  130. package/dist/number-field/index.d.ts +50 -0
  131. package/dist/number-field/index.d.ts.map +1 -0
  132. package/dist/number-field/index.js +133 -0
  133. package/dist/page-header/index.d.ts +4 -3
  134. package/dist/page-header/index.d.ts.map +1 -1
  135. package/dist/page-header/index.js +2 -1
  136. package/dist/pagination/index.d.ts +1 -1
  137. package/dist/pagination/index.d.ts.map +1 -1
  138. package/dist/pagination/index.js +35 -33
  139. package/dist/progress-ring/index.d.ts +4 -3
  140. package/dist/progress-ring/index.d.ts.map +1 -1
  141. package/dist/progress-ring/index.js +11 -10
  142. package/dist/radio-cards/index.d.ts +9 -5
  143. package/dist/radio-cards/index.d.ts.map +1 -1
  144. package/dist/radio-cards/index.js +26 -24
  145. package/dist/radio-group/index.d.ts +9 -8
  146. package/dist/radio-group/index.d.ts.map +1 -1
  147. package/dist/radio-group/index.js +35 -34
  148. package/dist/range-slider/index.d.ts +10 -4
  149. package/dist/range-slider/index.d.ts.map +1 -1
  150. package/dist/range-slider/index.js +43 -31
  151. package/dist/repeat-picker/index.d.ts +13 -6
  152. package/dist/repeat-picker/index.d.ts.map +1 -1
  153. package/dist/repeat-picker/index.js +73 -61
  154. package/dist/resizable/index.d.ts +29 -0
  155. package/dist/resizable/index.d.ts.map +1 -0
  156. package/dist/resizable/index.js +135 -0
  157. package/dist/segmented/index.d.ts +8 -5
  158. package/dist/segmented/index.d.ts.map +1 -1
  159. package/dist/segmented/index.js +36 -34
  160. package/dist/select/index.d.ts +9 -3
  161. package/dist/select/index.d.ts.map +1 -1
  162. package/dist/select/index.js +99 -96
  163. package/dist/separator/index.d.ts +14 -0
  164. package/dist/separator/index.d.ts.map +1 -0
  165. package/dist/separator/index.js +15 -0
  166. package/dist/side-nav/index.js +1 -1
  167. package/dist/skeleton/index.d.ts +4 -4
  168. package/dist/skeleton/index.d.ts.map +1 -1
  169. package/dist/skeleton/index.js +4 -3
  170. package/dist/slider/index.d.ts +6 -3
  171. package/dist/slider/index.d.ts.map +1 -1
  172. package/dist/slider/index.js +29 -23
  173. package/dist/sortable/index.d.ts +10 -20
  174. package/dist/sortable/index.d.ts.map +1 -1
  175. package/dist/sortable/index.js +72 -134
  176. package/dist/sortable/shared.d.ts +56 -0
  177. package/dist/sortable/shared.d.ts.map +1 -0
  178. package/dist/sortable/shared.js +104 -0
  179. package/dist/sortable/tree-model.d.ts +46 -0
  180. package/dist/sortable/tree-model.d.ts.map +1 -0
  181. package/dist/sortable/tree-model.js +87 -0
  182. package/dist/sortable/tree.d.ts +31 -0
  183. package/dist/sortable/tree.d.ts.map +1 -0
  184. package/dist/sortable/tree.js +150 -0
  185. package/dist/sparkline/index.d.ts +1 -1
  186. package/dist/sparkline/index.d.ts.map +1 -1
  187. package/dist/sparkline/index.js +26 -25
  188. package/dist/spinner/index.d.ts +4 -3
  189. package/dist/spinner/index.d.ts.map +1 -1
  190. package/dist/spinner/index.js +2 -1
  191. package/dist/status-pill/index.d.ts.map +1 -1
  192. package/dist/status-pill/index.js +1 -1
  193. package/dist/stepper/index.d.ts +1 -1
  194. package/dist/stepper/index.d.ts.map +1 -1
  195. package/dist/stepper/index.js +31 -30
  196. package/dist/tab-bar/index.js +1 -1
  197. package/dist/table/index.d.ts +5 -5
  198. package/dist/table/index.d.ts.map +1 -1
  199. package/dist/table/index.js +66 -64
  200. package/dist/table/selection.d.ts +2 -2
  201. package/dist/table/selection.d.ts.map +1 -1
  202. package/dist/table/selection.js +41 -38
  203. package/dist/table/swipe.d.ts +1 -1
  204. package/dist/table/swipe.d.ts.map +1 -1
  205. package/dist/table/swipe.js +1 -1
  206. package/dist/table-of-contents/index.d.ts +4 -2
  207. package/dist/table-of-contents/index.d.ts.map +1 -1
  208. package/dist/table-of-contents/index.js +27 -25
  209. package/dist/tabs/index.d.ts.map +1 -1
  210. package/dist/tabs/index.js +90 -88
  211. package/dist/tag-input/index.d.ts +3 -1
  212. package/dist/tag-input/index.d.ts.map +1 -1
  213. package/dist/tag-input/index.js +61 -52
  214. package/dist/theme-toggle/index.d.ts +9 -8
  215. package/dist/theme-toggle/index.d.ts.map +1 -1
  216. package/dist/theme-toggle/index.js +30 -28
  217. package/dist/theme.css +90 -12
  218. package/dist/time-field/index.d.ts +31 -0
  219. package/dist/time-field/index.d.ts.map +1 -0
  220. package/dist/time-field/index.js +175 -0
  221. package/dist/timeline/index.js +1 -1
  222. package/dist/toast/index.d.ts +1 -1
  223. package/dist/toast/index.d.ts.map +1 -1
  224. package/dist/toast/index.js +127 -125
  225. package/dist/toggle/index.d.ts +2 -2
  226. package/dist/toggle/index.d.ts.map +1 -1
  227. package/dist/toggle/index.js +8 -6
  228. package/dist/toggle-group/index.d.ts +35 -0
  229. package/dist/toggle-group/index.d.ts.map +1 -0
  230. package/dist/toggle-group/index.js +53 -0
  231. package/dist/toolbar/index.d.ts +19 -0
  232. package/dist/toolbar/index.d.ts.map +1 -0
  233. package/dist/toolbar/index.js +36 -0
  234. package/dist/tooltip/index.d.ts.map +1 -1
  235. package/dist/tooltip/index.js +40 -74
  236. package/dist/tree/index.d.ts.map +1 -1
  237. package/dist/tree/index.js +105 -102
  238. package/dist/trend/index.d.ts +2 -2
  239. package/dist/trend/index.d.ts.map +1 -1
  240. package/dist/trend/index.js +20 -19
  241. package/dist/utils/color.js +0 -1
  242. package/dist/utils/cva.js +0 -1
  243. package/dist/utils/cx.js +0 -1
  244. package/dist/utils/date.d.ts +6 -0
  245. package/dist/utils/date.d.ts.map +1 -1
  246. package/dist/utils/date.js +1 -2
  247. package/dist/utils/direction.d.ts +7 -0
  248. package/dist/utils/direction.d.ts.map +1 -0
  249. package/dist/utils/direction.js +6 -0
  250. package/dist/utils/form-value.d.ts +15 -0
  251. package/dist/utils/form-value.d.ts.map +1 -0
  252. package/dist/utils/form-value.js +29 -0
  253. package/dist/utils/fx.js +0 -1
  254. package/dist/utils/merge.js +0 -1
  255. package/dist/utils/messages.d.ts +137 -0
  256. package/dist/utils/messages.d.ts.map +1 -0
  257. package/dist/utils/messages.js +133 -0
  258. package/dist/utils/money.js +0 -1
  259. package/dist/utils/month.js +0 -1
  260. package/dist/utils/motion.js +0 -1
  261. package/dist/utils/refs.d.ts +6 -0
  262. package/dist/utils/refs.d.ts.map +1 -0
  263. package/dist/utils/refs.js +13 -0
  264. package/dist/utils/repeat.d.ts +3 -1
  265. package/dist/utils/repeat.d.ts.map +1 -1
  266. package/dist/utils/repeat.js +28 -25
  267. package/dist/utils/roving.d.ts +17 -0
  268. package/dist/utils/roving.d.ts.map +1 -0
  269. package/dist/utils/roving.js +35 -0
  270. package/dist/utils/section-link.js +0 -1
  271. package/dist/utils/slot.d.ts.map +1 -1
  272. package/dist/utils/slot.js +7 -11
  273. package/dist/utils/status-icons.js +7 -7
  274. package/dist/utils/styles.d.ts +9 -2
  275. package/dist/utils/styles.d.ts.map +1 -1
  276. package/dist/utils/styles.js +6 -3
  277. package/dist/utils/theme-wave.js +0 -1
  278. package/dist/utils/theme.js +0 -1
  279. package/dist/utils/useAnchoredPopup.d.ts +7 -4
  280. package/dist/utils/useAnchoredPopup.d.ts.map +1 -1
  281. package/dist/utils/useAnchoredPopup.js +18 -11
  282. package/dist/utils/useControllable.d.ts +9 -0
  283. package/dist/utils/useControllable.d.ts.map +1 -0
  284. package/dist/utils/useControllable.js +15 -0
  285. package/dist/utils/useHoverPopup.d.ts +39 -0
  286. package/dist/utils/useHoverPopup.d.ts.map +1 -0
  287. package/dist/utils/useHoverPopup.js +64 -0
  288. package/dist/zen.css +1 -1
  289. package/package.json +1 -1
@@ -4,107 +4,73 @@ import { useGraphicsMode as t } from "../utils/graphics.js";
4
4
  import { Slot as n } from "../utils/slot.js";
5
5
  import { anchorFor as r, anchoredStyle as i, useAnchorFallback as a } from "../utils/useAnchoredPopup.js";
6
6
  import { POPUP as o } from "../utils/styles.js";
7
- import { createContext as s, useCallback as c, useContext as l, useEffect as u, useId as d, useMemo as f, useRef as p } from "react";
8
- import { jsx as m } from "react/jsx-runtime";
7
+ import { useHoverPopup as s } from "../utils/useHoverPopup.js";
8
+ import { createContext as c, useContext as l, useRef as u } from "react";
9
+ import { jsx as d } from "react/jsx-runtime";
9
10
  //#region packages/tooltip/index.tsx
10
- var h = s(null);
11
- function g(e) {
12
- let t = l(h);
11
+ var f = c(null);
12
+ function p(e) {
13
+ let t = l(f);
13
14
  if (!t) throw Error(`<${e}> must be inside <Tooltip>`);
14
15
  return t;
15
16
  }
16
- function _({ children: e }) {
17
+ function m({ children: e }) {
17
18
  t();
18
- let n = `zen__tooltip-${d().replace(/[^\w-]/g, "")}`, r = p(null), i = p(0), o = c(() => {
19
- clearTimeout(i.current);
20
- try {
21
- r.current?.showPopover?.();
22
- } catch {}
23
- }, []), s = c(() => {
24
- clearTimeout(i.current);
25
- try {
26
- r.current?.hidePopover?.();
27
- } catch {}
28
- }, []), l = c(() => {
29
- clearTimeout(i.current), i.current = window.setTimeout(s, 100);
30
- }, [s]);
31
- u(() => () => clearTimeout(i.current), []), a(r);
32
- let g = f(() => ({
33
- id: n,
34
- ref: r,
35
- show: o,
36
- hide: s,
37
- hideSoon: l
38
- }), [
39
- n,
40
- o,
41
- s,
42
- l
43
- ]);
44
- return /* @__PURE__ */ m(h.Provider, {
45
- value: g,
19
+ let n = s("zen__tooltip");
20
+ return /* @__PURE__ */ d(f.Provider, {
21
+ value: n,
46
22
  children: e
47
23
  });
48
24
  }
49
- function v({ asChild: e, style: t, onPointerEnter: i, onPointerLeave: a, onFocus: o, onBlur: s, onKeyDown: c, children: l, ...u }) {
50
- let d = g("TooltipTrigger"), f = {
51
- "aria-describedby": d.id,
25
+ function h({ asChild: e, style: t, onPointerEnter: i, onPointerLeave: a, onFocus: o, onBlur: s, onKeyDown: c, children: l, ...u }) {
26
+ let f = p("TooltipTrigger"), m = {
27
+ "aria-describedby": f.id,
52
28
  ...u,
53
- ...r(d.id),
29
+ ...r(f.id),
54
30
  style: {
55
- ...r(d.id).style,
31
+ ...r(f.id).style,
56
32
  ...t
57
33
  },
58
- onPointerEnter: (e) => {
59
- i?.(e), e.pointerType === "mouse" && d.show();
60
- },
61
- onPointerLeave: (e) => {
62
- a?.(e), d.hideSoon();
63
- },
64
- onFocus: (e) => {
65
- o?.(e), e.currentTarget.matches(":focus-visible") && d.show();
66
- },
67
- onBlur: (e) => {
68
- s?.(e), d.hide();
69
- },
70
- onKeyDown: (e) => {
71
- c?.(e), e.key === "Escape" && d.hide();
72
- }
34
+ ...f.triggerProps({
35
+ onPointerEnter: i,
36
+ onPointerLeave: a,
37
+ onFocus: o,
38
+ onBlur: s,
39
+ onKeyDown: c
40
+ })
73
41
  };
74
- return e ? /* @__PURE__ */ m(n, {
75
- ...f,
42
+ return e ? /* @__PURE__ */ d(n, {
43
+ ...m,
76
44
  children: l
77
- }) : /* @__PURE__ */ m("button", {
45
+ }) : /* @__PURE__ */ d("button", {
78
46
  type: "button",
79
- ...f,
47
+ ...m,
80
48
  children: l
81
49
  });
82
50
  }
83
- function y({ align: t = "center", offset: n = 5, className: r, style: a, onPointerEnter: s, onPointerLeave: c, children: l, ...u }) {
84
- let d = g("TooltipContent");
85
- return /* @__PURE__ */ m("div", {
86
- ...u,
87
- ref: d.ref,
88
- id: d.id,
51
+ function g({ align: t = "center", offset: n = 5, className: r, style: s, onPointerEnter: c, onPointerLeave: l, children: f, ...m }) {
52
+ let h = p("TooltipContent"), g = u(null);
53
+ return a(g), /* @__PURE__ */ d("div", {
54
+ ...m,
55
+ ref: g,
56
+ id: h.id,
89
57
  role: "tooltip",
90
58
  popover: "manual",
91
- onPointerEnter: (e) => {
92
- s?.(e), d.show();
93
- },
94
- onPointerLeave: (e) => {
95
- c?.(e), d.hideSoon();
96
- },
59
+ ...h.contentProps({
60
+ onPointerEnter: c,
61
+ onPointerLeave: l
62
+ }),
97
63
  style: {
98
- ...i(d.id, {
64
+ ...i(h.id, {
99
65
  align: t,
100
66
  offset: n,
101
67
  width: "at-least"
102
68
  }),
103
- ...a
69
+ ...s
104
70
  },
105
71
  className: e("zen__popover fixed z-50 overflow-visible p-0", o, r),
106
- children: l
72
+ children: f
107
73
  });
108
74
  }
109
75
  //#endregion
110
- export { y as TooltipContent, v as TooltipTrigger, _ as default };
76
+ export { g as TooltipContent, h as TooltipTrigger, m as default };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/tree/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,cAAc,EAAY,MAAM,YAAY,CAAC;AAGjE,OAAO,EACH,cAAc,EACd,aAAa,EACb,UAAU,EACV,aAAa,EACb,SAAS,EAKZ,MAAM,OAAO,CAAC;AAEf,iCAAiC;AACjC,MAAM,WAAW,WAAW,CAAC,CAAC;IAC1B,IAAI,EAAE,CAAC,CAAC;IACR,GAAG,EAAE,MAAM,CAAC;IACZ,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,+EAA+E;IAC/E,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,eAAsB,EAAE,SAAc,EAAE,EAAE,cAAc,CAAC,CAAC,CAAC;;kBA+D3F,MAAM;sBAvDU,MAAM;kBAuJzB,MAAM;oBACJ,MAAM;IACtB,yCAAyC;;IAEzC,wBAAwB;;IAExB,kCAAkC;;;;oBAzCf,WAAW,CAAC,CAAC,CAAC;;;;;;;;qBAQpB,UAAU,CAAC,WAAW,CAAC;uBAGrB,aAAa,CAAC,WAAW,CAAC;;eAOK,aAAa;4BACvC;YAAE,aAAa,EAAE,MAAM,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AAC,EAAE,OAAO,CAAC;IAC1B,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,CAAE,SAAQ,cAAc,CAAC,IAAI,CAAC;IACzD,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;CACjB;AAED,MAAM,WAAW,cAAc,CAAC,CAAC;IAC7B,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IACd,+BAA+B;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC;IAC/E,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACxB"}
@@ -1,156 +1,159 @@
1
1
  "use client";
2
- import { cx as e } from "../utils/cx.js";
3
- import { reducedMotion as t } from "../utils/motion.js";
4
- import { TableCell as n, TableRow as r } from "../table/index.js";
5
- import i from "../icons/micro/chevron-right.js";
6
- import { useCallback as a, useMemo as o, useRef as s, useState as c } from "react";
7
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
2
+ import e from "../icons/micro/chevron-right.js";
3
+ import { cx as t } from "../utils/cx.js";
4
+ import { readingKey as n } from "../utils/direction.js";
5
+ import { useMessages as r } from "../locale-provider/index.js";
6
+ import { reducedMotion as i } from "../utils/motion.js";
7
+ import { TableCell as a, TableRow as o } from "../table/index.js";
8
+ import { useCallback as s, useMemo as c, useRef as l, useState as u } from "react";
9
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
8
10
  //#region packages/tree/index.tsx
9
- function d({ items: n, getKey: r, getChildren: i, defaultExpanded: l = !0, rowHeight: u = 36 }) {
10
- let [d, f] = c(() => /* @__PURE__ */ new Set()), [p, m] = c(null), [h, g] = c(null), _ = s(null), v = a((e) => d.has(e) !== l, [d, l]), y = o(() => {
11
- let e = [], t = (n, a, o) => {
12
- n.forEach((s, c) => {
13
- let l = r(s), u = i(s), d = !!u?.length, f = d && v(l);
14
- e.push({
11
+ function p({ items: e, getKey: r, getChildren: a, defaultExpanded: o = !0, rowHeight: d = 36 }) {
12
+ let [f, p] = u(() => /* @__PURE__ */ new Set()), [m, h] = u(null), [g, _] = u(null), v = l(null), y = s((e) => f.has(e) !== o, [f, o]), b = c(() => {
13
+ let t = [], n = (e, i, o) => {
14
+ e.forEach((s, c) => {
15
+ let l = r(s), u = a(s), d = !!u?.length, f = d && y(l);
16
+ t.push({
15
17
  item: s,
16
18
  key: l,
17
- depth: a,
19
+ depth: i,
18
20
  parentKey: o,
19
21
  hasChildren: d,
20
22
  expanded: f,
21
23
  position: c + 1,
22
- siblings: n.length
23
- }), f && t(u, a + 1, l);
24
+ siblings: e.length
25
+ }), f && n(u, i + 1, l);
24
26
  });
25
27
  };
26
- return t(n, 0, null), e;
28
+ return n(e, 0, null), t;
27
29
  }, [
28
- n,
30
+ e,
29
31
  r,
30
- i,
31
- v
32
- ]), b = () => {
33
- let e = [], t = (n) => {
34
- for (let a of n) {
35
- let n = i(a);
36
- n?.length && (e.push(r(a)), t(n));
32
+ a,
33
+ y
34
+ ]), x = () => {
35
+ let t = [], n = (e) => {
36
+ for (let i of e) {
37
+ let e = a(i);
38
+ e?.length && (t.push(r(i)), n(e));
37
39
  }
38
40
  };
39
- return t(n), e;
40
- }, x = a((e, t) => f((n) => {
41
+ return n(e), t;
42
+ }, S = s((e, t) => p((n) => {
41
43
  let r = new Set(n);
42
- return t === l ? r.delete(e) : r.add(e), r;
43
- }), [l]), S = (e) => {
44
- let n = () => {
44
+ return t === o ? r.delete(e) : r.add(e), r;
45
+ }), [o]), C = (e) => {
46
+ let t = () => {
45
47
  let t = Date.now();
46
- m({
48
+ h({
47
49
  key: e,
48
50
  at: t
49
- }), setTimeout(() => m((e) => e?.at === t ? null : e), 320);
51
+ }), setTimeout(() => h((e) => e?.at === t ? null : e), 320);
50
52
  };
51
- if (h === e) _.current = null, g(null), n();
52
- else if (!v(e)) n(), x(e, !0);
53
- else if (t()) x(e, !1);
53
+ if (g === e) v.current = null, _(null), t();
54
+ else if (!y(e)) t(), S(e, !0);
55
+ else if (i()) S(e, !1);
54
56
  else {
55
- g(e);
57
+ _(e);
56
58
  let t = () => {
57
- _.current === t && (x(e, !1), g((t) => t === e ? null : t), _.current = null);
59
+ v.current === t && (S(e, !1), _((t) => t === e ? null : t), v.current = null);
58
60
  };
59
- _.current = t, setTimeout(t, 500);
61
+ v.current = t, setTimeout(t, 500);
60
62
  }
61
- }, [C, w] = c(null), T = y.some((e) => e.key === C) ? C : y[0]?.key ?? null, E = (e) => e.expanded && h !== e.key, D = (e, t) => {
63
+ }, [w, T] = u(null), E = b.some((e) => e.key === w) ? w : b[0]?.key ?? null, D = (e) => e.expanded && g !== e.key, O = (e, t) => {
62
64
  if (t.target !== t.currentTarget) return;
63
- let n = y.indexOf(e), r;
64
- if (t.key === "ArrowDown") r = y[n + 1];
65
- else if (t.key === "ArrowUp") r = y[n - 1];
66
- else if (t.key === "Home") r = y[0];
67
- else if (t.key === "End") r = y.at(-1);
68
- else if (t.key === "ArrowRight" && e.hasChildren) E(e) ? r = y[n + 1] : S(e.key);
69
- else if (t.key === "ArrowLeft") E(e) ? S(e.key) : r = y.find((t) => t.key === e.parentKey);
65
+ let r = b.indexOf(e), i, a = n(t.key, t.currentTarget);
66
+ if (a === "ArrowDown") i = b[r + 1];
67
+ else if (a === "ArrowUp") i = b[r - 1];
68
+ else if (a === "Home") i = b[0];
69
+ else if (a === "End") i = b.at(-1);
70
+ else if (a === "ArrowRight" && e.hasChildren) D(e) ? i = b[r + 1] : C(e.key);
71
+ else if (a === "ArrowLeft") D(e) ? C(e.key) : i = b.find((t) => t.key === e.parentKey);
70
72
  else return;
71
- t.preventDefault(), r && t.currentTarget.closest("[role=\"treegrid\"], table")?.querySelector(`[data-tree-key="${CSS.escape(r.key)}"]`)?.focus();
73
+ t.preventDefault(), i && t.currentTarget.closest("[role=\"treegrid\"], table")?.querySelector(`[data-tree-key="${CSS.escape(i.key)}"]`)?.focus();
72
74
  };
73
75
  return {
74
- rows: y,
75
- toggle: S,
76
- isExpanded: v,
77
- expand: (e) => x(e, !0),
78
- collapse: (e) => x(e, !1),
79
- expandAll: () => f(l ? /* @__PURE__ */ new Set() : new Set(b())),
80
- collapseAll: () => f(l ? new Set(b()) : /* @__PURE__ */ new Set()),
76
+ rows: b,
77
+ toggle: C,
78
+ isExpanded: y,
79
+ expand: (e) => S(e, !0),
80
+ collapse: (e) => S(e, !1),
81
+ expandAll: () => p(o ? /* @__PURE__ */ new Set() : new Set(x())),
82
+ collapseAll: () => p(o ? new Set(x()) : /* @__PURE__ */ new Set()),
81
83
  tableProps: { role: "treegrid" },
82
- rowProps: (t) => ({
83
- "aria-level": t.depth + 1,
84
- "aria-expanded": t.hasChildren ? E(t) : void 0,
85
- "aria-posinset": t.position,
86
- "aria-setsize": t.siblings,
87
- "data-depth": t.depth,
88
- "data-tree-key": t.key,
89
- tabIndex: t.key === T ? 0 : -1,
90
- onFocus: (e) => {
91
- e.target === e.currentTarget && w(t.key);
84
+ rowProps: (e) => ({
85
+ "aria-level": e.depth + 1,
86
+ "aria-expanded": e.hasChildren ? D(e) : void 0,
87
+ "aria-posinset": e.position,
88
+ "aria-setsize": e.siblings,
89
+ "data-depth": e.depth,
90
+ "data-tree-key": e.key,
91
+ tabIndex: e.key === E ? 0 : -1,
92
+ onFocus: (t) => {
93
+ t.target === t.currentTarget && T(e.key);
92
94
  },
93
- onKeyDown: (e) => D(t, e),
94
- className: e("outline-hidden focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring/60", p && t.parentKey === p.key && "zen__tree-row-enter", h && t.parentKey === h && "zen__tree-row-exit"),
95
- style: { "--row-h": `${u - 1}px` },
96
- onAnimationEnd: (e) => {
97
- e.animationName === "zen-row-close" && h && t.parentKey === h && _.current?.();
95
+ onKeyDown: (t) => O(e, t),
96
+ className: t("outline-hidden focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring/60", m && e.parentKey === m.key && "zen__tree-row-enter", g && e.parentKey === g && "zen__tree-row-exit"),
97
+ style: { "--row-h": `${d - 1}px` },
98
+ onAnimationEnd: (t) => {
99
+ t.animationName === "zen-row-close" && g && e.parentKey === g && v.current?.();
98
100
  }
99
101
  }),
100
102
  toggleProps: (e) => ({
101
- expanded: E(e),
102
- onToggle: () => S(e.key),
103
+ expanded: D(e),
104
+ onToggle: () => C(e.key),
103
105
  tabIndex: -1
104
106
  }),
105
- rowHeight: u
107
+ rowHeight: d
106
108
  };
107
109
  }
108
- function f({ row: t, tree: n, className: i, style: a, onFocus: o, onKeyDown: s, ...c }) {
109
- let u = n.rowProps(t);
110
- return /* @__PURE__ */ l(r, {
110
+ function m({ row: e, tree: n, className: r, style: i, onFocus: a, onKeyDown: s, ...c }) {
111
+ let l = n.rowProps(e);
112
+ return /* @__PURE__ */ d(o, {
111
113
  ...c,
112
- ...u,
114
+ ...l,
113
115
  onFocus: (e) => {
114
- o?.(e), u.onFocus(e);
116
+ a?.(e), l.onFocus(e);
115
117
  },
116
118
  onKeyDown: (e) => {
117
- s?.(e), e.defaultPrevented || u.onKeyDown(e);
119
+ s?.(e), e.defaultPrevented || l.onKeyDown(e);
118
120
  },
119
- className: e(u.className, i),
121
+ className: t(l.className, r),
120
122
  style: {
121
- ...u.style,
122
- ...a
123
+ ...l.style,
124
+ ...i
123
125
  }
124
126
  });
125
127
  }
126
- function p({ numeric: t, className: r, children: i, ...a }) {
127
- return /* @__PURE__ */ l(n, {
128
- numeric: t,
129
- className: e("py-0 whitespace-nowrap", r),
130
- ...a,
131
- children: /* @__PURE__ */ l("div", {
132
- className: e("zen__tree-cell flex h-[var(--row-h)] items-center", t && "justify-end"),
133
- children: i
128
+ function h({ numeric: e, className: n, children: r, ...i }) {
129
+ return /* @__PURE__ */ d(a, {
130
+ numeric: e,
131
+ className: t("py-0 whitespace-nowrap", n),
132
+ ...i,
133
+ children: /* @__PURE__ */ d("div", {
134
+ className: t("zen__tree-cell flex h-[var(--row-h)] items-center", e && "justify-end"),
135
+ children: r
134
136
  })
135
137
  });
136
138
  }
137
- function m({ row: t, tree: n, indent: r = 20, children: i, className: a }) {
138
- return /* @__PURE__ */ u("div", {
139
- className: e("flex min-w-0 flex-1 items-center gap-1", a),
140
- style: { paddingLeft: t.depth * r },
141
- children: [t.hasChildren ? /* @__PURE__ */ l(h, { ...n.toggleProps(t) }) : /* @__PURE__ */ l("span", { className: "-ml-1 w-6 shrink-0" }), i]
139
+ function g({ row: e, tree: n, indent: r = 20, children: i, className: a }) {
140
+ return /* @__PURE__ */ f("div", {
141
+ className: t("flex min-w-0 flex-1 items-center gap-1", a),
142
+ style: { paddingLeft: e.depth * r },
143
+ children: [e.hasChildren ? /* @__PURE__ */ d(_, { ...n.toggleProps(e) }) : /* @__PURE__ */ d("span", { className: "-ms-1 w-6 shrink-0" }), i]
142
144
  });
143
145
  }
144
- function h({ expanded: t, onToggle: n, className: r, ...a }) {
145
- return /* @__PURE__ */ l("button", {
146
+ function _({ expanded: n, onToggle: i, className: a, ...o }) {
147
+ let s = r();
148
+ return /* @__PURE__ */ d("button", {
146
149
  type: "button",
147
- onClick: n,
148
- "aria-label": t ? "Collapse" : "Expand",
149
- "aria-expanded": t,
150
- className: e("text-muted-foreground hover:bg-tint/[0.08] hover:text-foreground focus-visible:ring-ring/50 -ml-1 grid size-6 shrink-0 cursor-pointer place-items-center rounded-md outline-hidden transition-colors focus-visible:ring-2", r),
151
- ...a,
152
- children: /* @__PURE__ */ l(i, { className: e("zen__tree-chevron size-4 transition-transform duration-200 ease-out", t && "rotate-90") })
150
+ onClick: i,
151
+ "aria-label": n ? s.collapse : s.expand,
152
+ "aria-expanded": n,
153
+ className: t("text-muted-foreground hover:bg-tint/[0.08] hover:text-foreground -ms-1 grid size-6 shrink-0 cursor-pointer place-items-center rounded-md outline-hidden transition-colors focus-ring", a),
154
+ ...o,
155
+ children: /* @__PURE__ */ d(e, { className: t("zen__tree-chevron size-4 transition-transform duration-200 ease-out rtl:-scale-x-100", n && "rotate-90 rtl:-rotate-90") })
153
156
  });
154
157
  }
155
158
  //#endregion
156
- export { p as TreeCell, m as TreeLabel, f as TreeRow, h as TreeToggle, d as useTree };
159
+ export { h as TreeCell, g as TreeLabel, m as TreeRow, _ as TreeToggle, p as useTree };
@@ -5,13 +5,13 @@ import { ComponentProps } from 'react';
5
5
  * the change as a fraction (0.12 for 12%); children follow it, muted, e.g.
6
6
  * "vs last month".
7
7
  */
8
- export default function Trend({ value, good, locale, format, className, children, ...rest }: TrendProps): import('react').JSX.Element;
8
+ export default function Trend({ value, good, locale: localeProp, format: formatProp, className, children, ...rest }: TrendProps): import('react').JSX.Element;
9
9
  export interface TrendProps extends ComponentProps<'span'> {
10
10
  /** The change as a fraction: 0.12 is 12% up, -0.05 is 5% down. */
11
11
  value: number;
12
12
  /** Which way is good news (default `up`); spending would be `down`. */
13
13
  good?: 'up' | 'down';
14
- /** For the default percent format. */
14
+ /** For the default percent format. Defaults to the LocaleProvider's. */
15
15
  locale?: string;
16
16
  /** How the change reads, e.g. as money instead of a percent. */
17
17
  format?: (value: number) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/trend/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC1B,KAAK,EACL,IAAW,EACX,MAAM,EACN,MAGK,EACL,SAAS,EACT,QAAQ,EACR,GAAG,IAAI,EACV,EAAE,UAAU,+BAsBZ;AAED,MAAM,WAAW,UAAW,SAAQ,cAAc,CAAC,MAAM,CAAC;IACtD,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IACrB,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CACtC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/trend/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC1B,KAAK,EACL,IAAW,EACX,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,UAAU,EAClB,SAAS,EACT,QAAQ,EACR,GAAG,IAAI,EACV,EAAE,UAAU,+BA+BZ;AAED,MAAM,WAAW,UAAW,SAAQ,cAAc,CAAC,MAAM,CAAC;IACtD,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IACrB,wEAAwE;IACxE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CACtC"}
@@ -1,27 +1,28 @@
1
1
  "use client";
2
2
  import { cx as e } from "../utils/cx.js";
3
- import t from "../icons/micro/arrow-trending-down.js";
4
- import n from "../icons/micro/arrow-trending-up.js";
5
- import { jsx as r, jsxs as i } from "react/jsx-runtime";
3
+ import { useLocale as t } from "../locale-provider/index.js";
4
+ import n from "../icons/micro/arrow-trending-down.js";
5
+ import r from "../icons/micro/arrow-trending-up.js";
6
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
7
  //#region packages/trend/index.tsx
7
- function a({ value: a, good: o = "up", locale: s, format: c = (e) => new Intl.NumberFormat(s, {
8
- style: "percent",
9
- maximumFractionDigits: 1,
10
- signDisplay: "exceptZero"
11
- }).format(e), className: l, children: u, ...d }) {
12
- let f = a > 0 ? "up" : a < 0 ? "down" : "flat", p = f === "up" ? n : f === "down" ? t : null;
13
- return /* @__PURE__ */ i("span", {
14
- className: e("zen__trend inline-flex items-center gap-1.5 text-xs", l),
15
- ...d,
16
- children: [/* @__PURE__ */ i("span", {
17
- "data-direction": f,
18
- className: e("inline-flex items-center gap-0.5 rounded-md border px-1.5 py-0.5 font-medium whitespace-nowrap tabular-nums", f === "flat" ? "border-tint/10 bg-tint/[0.06] text-muted-foreground" : f === o ? "border-glow/30 bg-glow/10 text-primary" : "border-destructive/40 bg-destructive/10 text-destructive"),
19
- children: [p && /* @__PURE__ */ r(p, { className: "size-3.5" }), c(a)]
20
- }), u && /* @__PURE__ */ r("span", {
8
+ function o({ value: o, good: s = "up", locale: c, format: l, className: u, children: d, ...f }) {
9
+ let p = t(c), m = l ?? ((e) => new Intl.NumberFormat(p, {
10
+ style: "percent",
11
+ maximumFractionDigits: 1,
12
+ signDisplay: "exceptZero"
13
+ }).format(e)), h = o > 0 ? "up" : o < 0 ? "down" : "flat", g = h === "up" ? r : h === "down" ? n : null;
14
+ return /* @__PURE__ */ a("span", {
15
+ className: e("zen__trend inline-flex items-center gap-1.5 text-xs", u),
16
+ ...f,
17
+ children: [/* @__PURE__ */ a("span", {
18
+ "data-direction": h,
19
+ className: e("inline-flex items-center gap-0.5 rounded-md border px-1.5 py-0.5 font-medium whitespace-nowrap tabular-nums", h === "flat" ? "border-tint/10 bg-tint/[0.06] text-muted-foreground" : h === s ? "border-glow/30 bg-glow/10 text-primary" : "border-destructive/40 bg-destructive/10 text-destructive"),
20
+ children: [g && /* @__PURE__ */ i(g, { className: "size-3.5" }), m(o)]
21
+ }), d && /* @__PURE__ */ i("span", {
21
22
  className: "text-muted-foreground",
22
- children: u
23
+ children: d
23
24
  })]
24
25
  });
25
26
  }
26
27
  //#endregion
27
- export { a as default };
28
+ export { o as default };
@@ -1,4 +1,3 @@
1
- "use client";
2
1
  //#region packages/utils/color.ts
3
2
  var e = (e) => Math.min(1, Math.max(0, e));
4
3
  function t(e) {
package/dist/utils/cva.js CHANGED
@@ -1,4 +1,3 @@
1
- "use client";
2
1
  import { cx as e } from "./cx.js";
3
2
  //#region packages/utils/cva.ts
4
3
  var t = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, n = (n, r) => (i) => {
package/dist/utils/cx.js CHANGED
@@ -1,4 +1,3 @@
1
- "use client";
2
1
  import { mergeClasses as e } from "./merge.js";
3
2
  //#region packages/utils/cx.ts
4
3
  var t = (...t) => e(n(t)), n = (e) => e.reduce((e, t) => t == null || t === !1 ? e : typeof t == "string" || typeof t == "number" ? e + " " + t : Array.isArray(t) ? e + " " + n(t) : typeof t == "object" ? e + " " + Object.entries(t).reduce((e, [t, n]) => n == null || n === !1 ? e : typeof n == "string" || typeof n == "number" ? e + " " + t + "-" + n : typeof n == "boolean" && n ? e + " " + t : e, "") : e, "");
@@ -70,4 +70,10 @@ export declare function weekdayNames(locale: string, style?: 'narrow' | 'short'
70
70
  export declare function weekStart(locale: string): number;
71
71
  /** "Sep 3 – 10, 2026" (or the locale's equivalent), sharing what the two dates have in common. */
72
72
  export declare function formatDateRange(start: DateString, end: DateString, locale: string, style?: Exclude<DateStyle, 'full'>): string;
73
+ /**
74
+ * Engines' ICU versions differ in thin and narrow no-break spaces (Node 24
75
+ * writes "5\u2009–\u200912 Oct", Chrome "5 – 12 Oct"). Plain spaces make text
76
+ * rendered on the server match the browser's, so hydration doesn't fail.
77
+ */
78
+ export declare const plainSpaces: (text: string) => string;
73
79
  //# sourceMappingURL=date.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../packages/utils/date.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,SAAS,CAA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U,GAAG,MAAM,CAElD;AAED,qCAAqC;AACrC,wBAAgB,KAAK,CAAC,GAAG,GAAE,IAAiB,GAAG,UAAU,CAExD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,YAAY,SAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAY/D;AAED,8DAA8D;AAC9D,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,GAAG,MAAM,CAEpE;AAED,oHAAoH;AACpH,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAQrE;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,GAAE,SAAoB,GAAG,MAAM,CAEhG;AAED,sDAAsD;AACtD,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,GAAE,QAAQ,GAAG,OAAO,GAAG,MAAgB,GAAG,MAAM,EAAE,CAGnG;AAUD,0FAA0F;AAC1F,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAahD;AAED,kGAAkG;AAClG,wBAAgB,eAAe,CAC3B,KAAK,EAAE,UAAU,EACjB,GAAG,EAAE,UAAU,EACf,MAAM,EAAE,MAAM,EACd,KAAK,GAAE,OAAO,CAAC,SAAS,EAAE,MAAM,CAAY,GAC7C,MAAM,CAER;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,WAAyC,CAAC"}
@@ -1,4 +1,3 @@
1
- "use client";
2
1
  //#region packages/utils/date.ts
3
2
  var e = /^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;
4
3
  function t(t) {
@@ -100,4 +99,4 @@ function _(e, t, r, i = "medium") {
100
99
  }
101
100
  var v = (e) => e.replace(/[\u2009\u202f]/g, " ");
102
101
  //#endregion
103
- export { i as addDays, a as addMonthsToDate, l as commonRanges, n as dayIndex, s as dayOfWeek, u as daysBetween, o as daysInMonth, f as formatDate, _ as formatDateRange, r as fromDayIndex, t as isDate, c as today, g as weekStart, p as weekdayNames };
102
+ export { i as addDays, a as addMonthsToDate, l as commonRanges, n as dayIndex, s as dayOfWeek, u as daysBetween, o as daysInMonth, f as formatDate, _ as formatDateRange, r as fromDayIndex, t as isDate, v as plainSpaces, c as today, g as weekStart, p as weekdayNames };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The key as if the text ran left to right: in right-to-left text ArrowLeft
3
+ * and ArrowRight swap, so "next" follows the reading order. Read from the
4
+ * element's laid-out direction, so a `dir` anywhere above it (or CSS) counts.
5
+ */
6
+ export declare function readingKey(key: string, element: Element): string;
7
+ //# sourceMappingURL=direction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"direction.d.ts","sourceRoot":"","sources":["../../packages/utils/direction.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAGhE"}
@@ -0,0 +1,6 @@
1
+ //#region packages/utils/direction.ts
2
+ function e(e, t) {
3
+ return e !== "ArrowLeft" && e !== "ArrowRight" || getComputedStyle(t).direction !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : "ArrowLeft";
4
+ }
5
+ //#endregion
6
+ export { e as readingKey };
@@ -0,0 +1,15 @@
1
+ import { RefObject } from 'react';
2
+ /** Calls `onReset` when the form the element is in is reset. */
3
+ export declare function useFormReset(element: RefObject<HTMLInputElement | null>, onReset: (() => void) | undefined): void;
4
+ /**
5
+ * A custom control's part in a form: hidden inputs carrying its value under
6
+ * `name` (one per item for a list, as a native multiple select submits), so
7
+ * FormData and native submission see it, and `onReset` when the form is reset
8
+ * (to go back to the control's first value).
9
+ */
10
+ export declare function FormValue({ name, value, onReset, }: {
11
+ name?: string;
12
+ value: string | readonly string[];
13
+ onReset?: () => void;
14
+ }): import('react').JSX.Element | null;
15
+ //# sourceMappingURL=form-value.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-value.d.ts","sourceRoot":"","sources":["../../packages/utils/form-value.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAqB,MAAM,OAAO,CAAC;AAErD,gEAAgE;AAChE,wBAAgB,YAAY,CAAC,OAAO,EAAE,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,QAY1G;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,EACtB,IAAI,EACJ,KAAK,EACL,OAAO,GACV,EAAE;IACC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;IAClC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB,sCAaA"}
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import { useEffect as e, useRef as t } from "react";
3
+ import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
4
+ //#region packages/utils/form-value.tsx
5
+ function a(n, r) {
6
+ let i = t(r);
7
+ e(() => {
8
+ i.current = r;
9
+ }), e(() => {
10
+ let e = n.current?.form;
11
+ if (!e) return;
12
+ let t = () => i.current?.();
13
+ return e.addEventListener("reset", t), () => e.removeEventListener("reset", t);
14
+ });
15
+ }
16
+ function o({ name: e, value: o, onReset: s }) {
17
+ let c = t(null);
18
+ return a(c, s), e ? /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ r("input", {
19
+ ref: c,
20
+ type: "hidden",
21
+ disabled: !0
22
+ }), (typeof o == "string" ? [o] : o).map((t, n) => /* @__PURE__ */ r("input", {
23
+ type: "hidden",
24
+ name: e,
25
+ value: t
26
+ }, n))] }) : null;
27
+ }
28
+ //#endregion
29
+ export { o as FormValue, a as useFormReset };
package/dist/utils/fx.js CHANGED
@@ -1,4 +1,3 @@
1
- "use client";
2
1
  import { minorDigits as e } from "./money.js";
3
2
  //#region packages/utils/fx.ts
4
3
  var t = class extends Error {};