@rinzai/zen 0.6.0 → 0.7.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 (173) hide show
  1. package/LICENSE +27 -0
  2. package/README.md +12 -4
  3. package/dist/alert/index.d.ts +21 -0
  4. package/dist/alert/index.d.ts.map +1 -0
  5. package/dist/alert/index.js +49 -0
  6. package/dist/button/index.d.ts +2 -1
  7. package/dist/button/index.d.ts.map +1 -1
  8. package/dist/button/index.js +43 -12
  9. package/dist/calendar/index.d.ts.map +1 -1
  10. package/dist/calendar/index.js +86 -85
  11. package/dist/chart/donut.d.ts +4 -1
  12. package/dist/chart/donut.d.ts.map +1 -1
  13. package/dist/chart/donut.js +81 -60
  14. package/dist/chart/index.d.ts +8 -2
  15. package/dist/chart/index.d.ts.map +1 -1
  16. package/dist/chart/index.js +151 -139
  17. package/dist/chart/palette.d.ts +11 -0
  18. package/dist/chart/palette.d.ts.map +1 -0
  19. package/dist/chart/palette.js +9 -0
  20. package/dist/chart/tooltip.d.ts +6 -2
  21. package/dist/chart/tooltip.d.ts.map +1 -1
  22. package/dist/chart/tooltip.js +6 -6
  23. package/dist/checkbox/index.d.ts.map +1 -1
  24. package/dist/checkbox/index.js +28 -44
  25. package/dist/chip/index.js +1 -1
  26. package/dist/code-block/index.js +1 -1
  27. package/dist/combobox/index.d.ts.map +1 -1
  28. package/dist/combobox/index.js +93 -91
  29. package/dist/date-picker/index.d.ts.map +1 -1
  30. package/dist/date-picker/index.js +24 -38
  31. package/dist/disclosure/index.js +1 -1
  32. package/dist/editable-cell/index.js +1 -1
  33. package/dist/field/index.d.ts +1 -1
  34. package/dist/field/index.d.ts.map +1 -1
  35. package/dist/field/index.js +33 -32
  36. package/dist/header/index.d.ts +9 -1
  37. package/dist/header/index.d.ts.map +1 -1
  38. package/dist/header/index.js +17 -9
  39. package/dist/icons/arrow-left.d.ts +3 -0
  40. package/dist/icons/arrow-left.d.ts.map +1 -0
  41. package/dist/icons/arrow-right.d.ts +3 -0
  42. package/dist/icons/arrow-right.d.ts.map +1 -0
  43. package/dist/icons/bars.d.ts +3 -0
  44. package/dist/icons/bars.d.ts.map +1 -0
  45. package/dist/icons/calendar.d.ts +3 -0
  46. package/dist/icons/calendar.d.ts.map +1 -0
  47. package/dist/icons/chart-bar.d.ts +3 -0
  48. package/dist/icons/chart-bar.d.ts.map +1 -0
  49. package/dist/icons/chevron-down.d.ts.map +1 -1
  50. package/dist/icons/chevron-down.js +4 -2
  51. package/dist/icons/chevron-left.d.ts.map +1 -1
  52. package/dist/icons/chevron-left.js +4 -2
  53. package/dist/icons/chevron-right.d.ts.map +1 -1
  54. package/dist/icons/chevron-right.js +4 -2
  55. package/dist/icons/chevron-up.d.ts.map +1 -1
  56. package/dist/icons/chevron-up.js +4 -2
  57. package/dist/icons/ellipsis.d.ts +0 -1
  58. package/dist/icons/ellipsis.d.ts.map +1 -1
  59. package/dist/icons/flag.d.ts +3 -0
  60. package/dist/icons/flag.d.ts.map +1 -0
  61. package/dist/icons/list-bullet.d.ts +3 -0
  62. package/dist/icons/list-bullet.d.ts.map +1 -0
  63. package/dist/icons/lock.d.ts +3 -0
  64. package/dist/icons/lock.d.ts.map +1 -0
  65. package/dist/icons/logout.d.ts +3 -0
  66. package/dist/icons/logout.d.ts.map +1 -0
  67. package/dist/icons/micro/calendar.d.ts +3 -0
  68. package/dist/icons/micro/calendar.d.ts.map +1 -0
  69. package/dist/icons/micro/calendar.js +21 -0
  70. package/dist/icons/micro/check.d.ts +3 -0
  71. package/dist/icons/micro/check.d.ts.map +1 -0
  72. package/dist/icons/micro/check.js +21 -0
  73. package/dist/icons/micro/chevron-down.d.ts +3 -0
  74. package/dist/icons/micro/chevron-down.d.ts.map +1 -0
  75. package/dist/icons/micro/chevron-down.js +21 -0
  76. package/dist/icons/micro/chevron-right.d.ts +3 -0
  77. package/dist/icons/micro/chevron-right.d.ts.map +1 -0
  78. package/dist/icons/micro/chevron-right.js +21 -0
  79. package/dist/icons/micro/exclamation-triangle.d.ts +3 -0
  80. package/dist/icons/micro/exclamation-triangle.d.ts.map +1 -0
  81. package/dist/icons/micro/exclamation-triangle.js +21 -0
  82. package/dist/icons/micro/information-circle.d.ts +3 -0
  83. package/dist/icons/micro/information-circle.d.ts.map +1 -0
  84. package/dist/icons/micro/information-circle.js +21 -0
  85. package/dist/icons/micro/minus.d.ts +3 -0
  86. package/dist/icons/micro/minus.d.ts.map +1 -0
  87. package/dist/icons/micro/minus.js +17 -0
  88. package/dist/icons/micro/moon.d.ts +3 -0
  89. package/dist/icons/micro/moon.d.ts.map +1 -0
  90. package/dist/icons/micro/moon.js +17 -0
  91. package/dist/icons/micro/sun.d.ts +3 -0
  92. package/dist/icons/micro/sun.d.ts.map +1 -0
  93. package/dist/icons/micro/sun.js +17 -0
  94. package/dist/icons/micro/x-mark.d.ts +3 -0
  95. package/dist/icons/micro/x-mark.d.ts.map +1 -0
  96. package/dist/icons/micro/x-mark.js +17 -0
  97. package/dist/icons/search.d.ts.map +1 -1
  98. package/dist/icons/search.js +4 -2
  99. package/dist/icons/settings.d.ts +3 -0
  100. package/dist/icons/settings.d.ts.map +1 -0
  101. package/dist/icons/squares.d.ts +3 -0
  102. package/dist/icons/squares.d.ts.map +1 -0
  103. package/dist/icons/table.d.ts +3 -0
  104. package/dist/icons/table.d.ts.map +1 -0
  105. package/dist/icons/x-mark.d.ts.map +1 -1
  106. package/dist/icons/x-mark.js +4 -2
  107. package/dist/index.d.ts +6 -4
  108. package/dist/index.d.ts.map +1 -1
  109. package/dist/lib.js +56 -61
  110. package/dist/menu/index.d.ts.map +1 -1
  111. package/dist/menu/index.js +67 -60
  112. package/dist/meter/index.d.ts +4 -3
  113. package/dist/meter/index.d.ts.map +1 -1
  114. package/dist/meter/index.js +9 -8
  115. package/dist/money-input/index.d.ts +7 -8
  116. package/dist/money-input/index.d.ts.map +1 -1
  117. package/dist/money-input/index.js +37 -19
  118. package/dist/month-picker/index.d.ts.map +1 -1
  119. package/dist/month-picker/index.js +55 -55
  120. package/dist/pills/index.d.ts +1 -1
  121. package/dist/pills/index.d.ts.map +1 -1
  122. package/dist/pills/index.js +6 -2
  123. package/dist/popover/index.d.ts.map +1 -1
  124. package/dist/popover/index.js +15 -13
  125. package/dist/select/index.d.ts.map +1 -1
  126. package/dist/select/index.js +96 -102
  127. package/dist/slider/index.d.ts.map +1 -1
  128. package/dist/slider/index.js +1 -1
  129. package/dist/status-pill/index.d.ts +18 -0
  130. package/dist/status-pill/index.d.ts.map +1 -0
  131. package/dist/status-pill/index.js +25 -0
  132. package/dist/tab-bar/index.js +1 -1
  133. package/dist/table/index.js +1 -1
  134. package/dist/tabs/index.d.ts.map +1 -1
  135. package/dist/tabs/index.js +9 -5
  136. package/dist/theme-toggle/index.d.ts +2 -1
  137. package/dist/theme-toggle/index.d.ts.map +1 -1
  138. package/dist/theme-toggle/index.js +35 -32
  139. package/dist/theme.css +81 -19
  140. package/dist/toast/index.d.ts.map +1 -1
  141. package/dist/toast/index.js +119 -106
  142. package/dist/tooltip/index.d.ts.map +1 -1
  143. package/dist/tooltip/index.js +45 -43
  144. package/dist/tree/index.d.ts +22 -3
  145. package/dist/tree/index.d.ts.map +1 -1
  146. package/dist/tree/index.js +76 -56
  147. package/dist/utils/date.d.ts +6 -4
  148. package/dist/utils/date.d.ts.map +1 -1
  149. package/dist/utils/date.js +18 -16
  150. package/dist/utils/field-chevron.d.ts.map +1 -1
  151. package/dist/utils/field-chevron.js +5 -14
  152. package/dist/utils/status-icons.d.ts +1 -1
  153. package/dist/utils/status-icons.d.ts.map +1 -1
  154. package/dist/utils/status-icons.js +11 -41
  155. package/dist/utils/styles.d.ts +9 -3
  156. package/dist/utils/styles.d.ts.map +1 -1
  157. package/dist/utils/styles.js +2 -2
  158. package/dist/utils/theme-wave.d.ts +24 -0
  159. package/dist/utils/theme-wave.d.ts.map +1 -0
  160. package/dist/utils/theme-wave.js +219 -0
  161. package/dist/utils/typeahead.d.ts +12 -0
  162. package/dist/utils/typeahead.d.ts.map +1 -0
  163. package/dist/utils/typeahead.js +19 -0
  164. package/dist/utils/useAnchoredPopup.d.ts +23 -7
  165. package/dist/utils/useAnchoredPopup.d.ts.map +1 -1
  166. package/dist/utils/useAnchoredPopup.js +86 -30
  167. package/dist/zen.css +1 -1
  168. package/package.json +2 -1
  169. package/dist/icons/ellipsis.js +0 -31
  170. package/dist/icons/index.d.ts +0 -9
  171. package/dist/icons/index.d.ts.map +0 -1
  172. package/dist/icons/status.d.ts +0 -2
  173. package/dist/icons/status.d.ts.map +0 -1
@@ -2,86 +2,87 @@
2
2
  import { cx as e } from "../utils/cx.js";
3
3
  import { useGraphicsMode as t } from "../utils/graphics.js";
4
4
  import { Slot as n } from "../utils/slot.js";
5
- import { anchoredStyle as r } from "../utils/useAnchoredPopup.js";
6
- import { POPUP as i } from "../utils/styles.js";
7
- import { createContext as a, useCallback as o, useContext as s, useEffect as c, useId as l, useMemo as u, useRef as d } from "react";
8
- import { jsx as f } from "react/jsx-runtime";
5
+ import { anchorFor as r, anchoredStyle as i, useAnchorFallback as a } from "../utils/useAnchoredPopup.js";
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";
9
9
  //#region packages/tooltip/index.tsx
10
- var p = a(null);
11
- function m(e) {
12
- let t = s(p);
10
+ var h = s(null);
11
+ function g(e) {
12
+ let t = l(h);
13
13
  if (!t) throw Error(`<${e}> must be inside <Tooltip>`);
14
14
  return t;
15
15
  }
16
- function h({ children: e }) {
16
+ function _({ children: e }) {
17
17
  t();
18
- let n = `zen__tooltip-${l().replace(/[^\w-]/g, "")}`, r = d(null), i = d(0), a = o(() => {
18
+ let n = `zen__tooltip-${d().replace(/[^\w-]/g, "")}`, r = p(null), i = p(0), o = c(() => {
19
19
  clearTimeout(i.current);
20
20
  try {
21
21
  r.current?.showPopover?.();
22
22
  } catch {}
23
- }, []), s = o(() => {
23
+ }, []), s = c(() => {
24
24
  clearTimeout(i.current);
25
25
  try {
26
26
  r.current?.hidePopover?.();
27
27
  } catch {}
28
- }, []), m = o(() => {
28
+ }, []), l = c(() => {
29
29
  clearTimeout(i.current), i.current = window.setTimeout(s, 100);
30
30
  }, [s]);
31
- c(() => () => clearTimeout(i.current), []);
32
- let h = u(() => ({
31
+ u(() => () => clearTimeout(i.current), []), a(r);
32
+ let g = f(() => ({
33
33
  id: n,
34
34
  ref: r,
35
- show: a,
35
+ show: o,
36
36
  hide: s,
37
- hideSoon: m
37
+ hideSoon: l
38
38
  }), [
39
39
  n,
40
- a,
40
+ o,
41
41
  s,
42
- m
42
+ l
43
43
  ]);
44
- return /* @__PURE__ */ f(p.Provider, {
45
- value: h,
44
+ return /* @__PURE__ */ m(h.Provider, {
45
+ value: g,
46
46
  children: e
47
47
  });
48
48
  }
49
- function g({ asChild: e, style: t, onPointerEnter: r, onPointerLeave: i, onFocus: a, onBlur: o, onKeyDown: s, children: c, ...l }) {
50
- let u = m("TooltipTrigger"), d = {
51
- "aria-describedby": u.id,
52
- ...l,
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,
52
+ ...u,
53
+ ...r(d.id),
53
54
  style: {
54
- anchorName: `--${u.id}`,
55
+ ...r(d.id).style,
55
56
  ...t
56
57
  },
57
58
  onPointerEnter: (e) => {
58
- r?.(e), e.pointerType === "mouse" && u.show();
59
+ i?.(e), e.pointerType === "mouse" && d.show();
59
60
  },
60
61
  onPointerLeave: (e) => {
61
- i?.(e), u.hideSoon();
62
+ a?.(e), d.hideSoon();
62
63
  },
63
64
  onFocus: (e) => {
64
- a?.(e), e.currentTarget.matches(":focus-visible") && u.show();
65
+ o?.(e), e.currentTarget.matches(":focus-visible") && d.show();
65
66
  },
66
67
  onBlur: (e) => {
67
- o?.(e), u.hide();
68
+ s?.(e), d.hide();
68
69
  },
69
70
  onKeyDown: (e) => {
70
- s?.(e), e.key === "Escape" && u.hide();
71
+ c?.(e), e.key === "Escape" && d.hide();
71
72
  }
72
73
  };
73
- return e ? /* @__PURE__ */ f(n, {
74
- ...d,
75
- children: c
76
- }) : /* @__PURE__ */ f("button", {
74
+ return e ? /* @__PURE__ */ m(n, {
75
+ ...f,
76
+ children: l
77
+ }) : /* @__PURE__ */ m("button", {
77
78
  type: "button",
78
- ...d,
79
- children: c
79
+ ...f,
80
+ children: l
80
81
  });
81
82
  }
82
- function _({ align: t = "center", offset: n = 5, className: a, style: o, onPointerEnter: s, onPointerLeave: c, children: l, ...u }) {
83
- let d = m("TooltipContent");
84
- return /* @__PURE__ */ f("div", {
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", {
85
86
  ...u,
86
87
  ref: d.ref,
87
88
  id: d.id,
@@ -94,15 +95,16 @@ function _({ align: t = "center", offset: n = 5, className: a, style: o, onPoint
94
95
  c?.(e), d.hideSoon();
95
96
  },
96
97
  style: {
97
- ...r(d.id, {
98
+ ...i(d.id, {
98
99
  align: t,
99
- offset: n
100
+ offset: n,
101
+ width: "at-least"
100
102
  }),
101
- ...o
103
+ ...a
102
104
  },
103
- className: e("zen__popover fixed z-50 w-[anchor-size(width)] min-w-max overflow-visible p-0", i, a),
105
+ className: e("zen__popover fixed z-50 overflow-visible p-0", o, r),
104
106
  children: l
105
107
  });
106
108
  }
107
109
  //#endregion
108
- export { _ as TooltipContent, g as TooltipTrigger, h as default };
110
+ export { y as TooltipContent, v as TooltipTrigger, _ as default };
@@ -1,5 +1,5 @@
1
1
  import { TableCellProps } from '../table';
2
- import { ComponentProps, CSSProperties, ReactNode } from 'react';
2
+ import { ComponentProps, CSSProperties, FocusEvent, KeyboardEvent, ReactNode } from 'react';
3
3
  /** One visible row of a tree. */
4
4
  export interface TreeRowData<T> {
5
5
  item: T;
@@ -9,11 +9,19 @@ export interface TreeRowData<T> {
9
9
  parentKey: string | null;
10
10
  hasChildren: boolean;
11
11
  expanded: boolean;
12
+ /** Its place among its siblings (1-based), and how many siblings there are. */
13
+ position: number;
14
+ siblings: number;
12
15
  }
13
16
  /**
14
17
  * Headless tree for tables and lists: turns nested items into the rows that
15
18
  * are visible (children of collapsed rows are skipped), and expands/collapses
16
19
  * them. With the Tree* parts, children grow in and shrink away smoothly.
20
+ *
21
+ * Put `tree.tableProps` on the Table: it's then a tree grid (WAI-ARIA), one tab
22
+ * stop whose rows the keyboard moves between. Up and Down go row to row, Home
23
+ * and End to the first and last, Right opens a row (or goes to its first
24
+ * child), Left closes it (or goes to its parent).
17
25
  */
18
26
  export declare function useTree<T>({ items, getKey, getChildren, defaultExpanded, rowHeight }: UseTreeOptions<T>): {
19
27
  rows: TreeRowData<T>[];
@@ -25,10 +33,20 @@ export declare function useTree<T>({ items, getKey, getChildren, defaultExpanded
25
33
  expandAll: () => void;
26
34
  /** Closes every row. */
27
35
  collapseAll: () => void;
36
+ /** For the Table: a tree grid. */
37
+ tableProps: {
38
+ role: "treegrid";
39
+ };
28
40
  rowProps: (row: TreeRowData<T>) => {
29
41
  'aria-level': number;
30
42
  'aria-expanded': boolean | undefined;
43
+ 'aria-posinset': number;
44
+ 'aria-setsize': number;
31
45
  'data-depth': number;
46
+ 'data-tree-key': string;
47
+ tabIndex: number;
48
+ onFocus: (e: FocusEvent<HTMLElement>) => void;
49
+ onKeyDown: (e: KeyboardEvent<HTMLElement>) => void;
32
50
  className: string;
33
51
  style: CSSProperties;
34
52
  onAnimationEnd: (e: {
@@ -38,12 +56,13 @@ export declare function useTree<T>({ items, getKey, getChildren, defaultExpanded
38
56
  toggleProps: (row: TreeRowData<T>) => {
39
57
  expanded: boolean;
40
58
  onToggle: () => void;
59
+ tabIndex: number;
41
60
  };
42
61
  rowHeight: number;
43
62
  };
44
63
  export type Tree<T> = ReturnType<typeof useTree<T>>;
45
- /** A table row wired to useTree: tree semantics (aria-level, aria-expanded) and the open/close animation. */
46
- export declare function TreeRow<T>({ row, tree, className, style, ...rest }: TreeRowProps<T>): import('react').JSX.Element;
64
+ /** A table row wired to useTree: tree semantics, the keyboard and the open/close animation. */
65
+ export declare function TreeRow<T>({ row, tree, className, style, onFocus, onKeyDown, ...rest }: TreeRowProps<T>): import('react').JSX.Element;
47
66
  /** A cell in a TreeRow: its content sits in a box whose height animates as groups open and close. */
48
67
  export declare function TreeCell({ numeric, className, children, ...rest }: TableCellProps): import('react').JSX.Element;
49
68
  /** The first column's content: indented by depth, with the row's toggle (or a spacer, so labels line up). */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/tree/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,cAAc,EAAY,MAAM,YAAY,CAAC;AAEjE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,SAAS,EAA0C,MAAM,OAAO,CAAC;AAEzG,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;CACrB;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,eAAsB,EAAE,SAAc,EAAE,EAAE,cAAc,CAAC,CAAC,CAAC;;kBA2D3F,MAAM;sBAnDU,MAAM;kBA8GzB,MAAM;oBACJ,MAAM;IACtB,yCAAyC;;IAEzC,wBAAwB;;oBA7BL,WAAW,CAAC,CAAC,CAAC;;;;;eASa,aAAa;4BACvC;YAAE,aAAa,EAAE,MAAM,CAAA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AAsD;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,39 +1,42 @@
1
1
  "use client";
2
2
  import { cx as e } from "../utils/cx.js";
3
3
  import { TableCell as t, TableRow as n } from "../table/index.js";
4
- import { useCallback as r, useMemo as i, useRef as a, useState as o } from "react";
5
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
4
+ import r from "../icons/micro/chevron-right.js";
5
+ import { useCallback as i, useMemo as a, useRef as o, useState as s } from "react";
6
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
6
7
  //#region packages/tree/index.tsx
7
- function l({ items: t, getKey: n, getChildren: s, defaultExpanded: c = !0, rowHeight: l = 36 }) {
8
- let [u, d] = o(() => /* @__PURE__ */ new Set()), [f, p] = o(null), [m, h] = o(null), g = a(null), _ = r((e) => u.has(e) !== c, [u, c]), v = i(() => {
9
- let e = [], r = (t, i, a) => {
10
- for (let o of t) {
11
- let t = n(o), c = s(o), l = !!c?.length, u = l && _(t);
8
+ function u({ items: t, getKey: n, getChildren: r, defaultExpanded: c = !0, rowHeight: l = 36 }) {
9
+ let [u, d] = s(() => /* @__PURE__ */ new Set()), [f, p] = s(null), [m, h] = s(null), g = o(null), _ = i((e) => u.has(e) !== c, [u, c]), v = a(() => {
10
+ let e = [], i = (t, a, o) => {
11
+ t.forEach((s, c) => {
12
+ let l = n(s), u = r(s), d = !!u?.length, f = d && _(l);
12
13
  e.push({
13
- item: o,
14
- key: t,
15
- depth: i,
16
- parentKey: a,
17
- hasChildren: l,
18
- expanded: u
19
- }), u && r(c, i + 1, t);
20
- }
14
+ item: s,
15
+ key: l,
16
+ depth: a,
17
+ parentKey: o,
18
+ hasChildren: d,
19
+ expanded: f,
20
+ position: c + 1,
21
+ siblings: t.length
22
+ }), f && i(u, a + 1, l);
23
+ });
21
24
  };
22
- return r(t, 0, null), e;
25
+ return i(t, 0, null), e;
23
26
  }, [
24
27
  t,
25
28
  n,
26
- s,
29
+ r,
27
30
  _
28
31
  ]), y = () => {
29
- let e = [], r = (t) => {
30
- for (let i of t) {
31
- let t = s(i);
32
- t?.length && (e.push(n(i)), r(t));
32
+ let e = [], i = (t) => {
33
+ for (let a of t) {
34
+ let t = r(a);
35
+ t?.length && (e.push(n(a)), i(t));
33
36
  }
34
37
  };
35
- return r(t), e;
36
- }, b = r((e, t) => d((n) => {
38
+ return i(t), e;
39
+ }, b = i((e, t) => d((n) => {
37
40
  let r = new Set(n);
38
41
  return t === c ? r.delete(e) : r.add(e), r;
39
42
  }), [c]), x = () => typeof window < "u" && (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches || document.documentElement.classList.contains("reduce-motion")), S = (e) => {
@@ -54,6 +57,17 @@ function l({ items: t, getKey: n, getChildren: s, defaultExpanded: c = !0, rowHe
54
57
  };
55
58
  g.current = t, setTimeout(t, 500);
56
59
  }
60
+ }, [C, w] = s(null), T = v.some((e) => e.key === C) ? C : v[0]?.key ?? null, E = (e) => e.expanded && m !== e.key, D = (e, t) => {
61
+ if (t.target !== t.currentTarget) return;
62
+ let n = v.indexOf(e), r;
63
+ if (t.key === "ArrowDown") r = v[n + 1];
64
+ else if (t.key === "ArrowUp") r = v[n - 1];
65
+ else if (t.key === "Home") r = v[0];
66
+ else if (t.key === "End") r = v.at(-1);
67
+ else if (t.key === "ArrowRight" && e.hasChildren) E(e) ? r = v[n + 1] : S(e.key);
68
+ else if (t.key === "ArrowLeft") E(e) ? S(e.key) : r = v.find((t) => t.key === e.parentKey);
69
+ else return;
70
+ t.preventDefault(), r && t.currentTarget.closest("[role=\"treegrid\"], table")?.querySelector(`[data-tree-key="${CSS.escape(r.key)}"]`)?.focus();
57
71
  };
58
72
  return {
59
73
  rows: v,
@@ -63,73 +77,79 @@ function l({ items: t, getKey: n, getChildren: s, defaultExpanded: c = !0, rowHe
63
77
  collapse: (e) => b(e, !1),
64
78
  expandAll: () => d(c ? /* @__PURE__ */ new Set() : new Set(y())),
65
79
  collapseAll: () => d(c ? new Set(y()) : /* @__PURE__ */ new Set()),
80
+ tableProps: { role: "treegrid" },
66
81
  rowProps: (t) => ({
67
82
  "aria-level": t.depth + 1,
68
- "aria-expanded": t.hasChildren ? t.expanded : void 0,
83
+ "aria-expanded": t.hasChildren ? E(t) : void 0,
84
+ "aria-posinset": t.position,
85
+ "aria-setsize": t.siblings,
69
86
  "data-depth": t.depth,
70
- className: e(f && t.parentKey === f.key && "zen__tree-row-enter", m && t.parentKey === m && "zen__tree-row-exit"),
87
+ "data-tree-key": t.key,
88
+ tabIndex: t.key === T ? 0 : -1,
89
+ onFocus: (e) => {
90
+ e.target === e.currentTarget && w(t.key);
91
+ },
92
+ onKeyDown: (e) => D(t, e),
93
+ className: e("outline-hidden focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring/60", f && t.parentKey === f.key && "zen__tree-row-enter", m && t.parentKey === m && "zen__tree-row-exit"),
71
94
  style: { "--row-h": `${l - 1}px` },
72
95
  onAnimationEnd: (e) => {
73
96
  e.animationName === "zen-row-close" && m && t.parentKey === m && g.current?.();
74
97
  }
75
98
  }),
76
99
  toggleProps: (e) => ({
77
- expanded: e.expanded && m !== e.key,
78
- onToggle: () => S(e.key)
100
+ expanded: E(e),
101
+ onToggle: () => S(e.key),
102
+ tabIndex: -1
79
103
  }),
80
104
  rowHeight: l
81
105
  };
82
106
  }
83
- function u({ row: t, tree: r, className: i, style: a, ...o }) {
84
- let c = r.rowProps(t);
85
- return /* @__PURE__ */ s(n, {
86
- ...o,
87
- ...c,
88
- className: e(c.className, i),
107
+ function d({ row: t, tree: r, className: i, style: a, onFocus: o, onKeyDown: s, ...l }) {
108
+ let u = r.rowProps(t);
109
+ return /* @__PURE__ */ c(n, {
110
+ ...l,
111
+ ...u,
112
+ onFocus: (e) => {
113
+ o?.(e), u.onFocus(e);
114
+ },
115
+ onKeyDown: (e) => {
116
+ s?.(e), e.defaultPrevented || u.onKeyDown(e);
117
+ },
118
+ className: e(u.className, i),
89
119
  style: {
90
- ...c.style,
120
+ ...u.style,
91
121
  ...a
92
122
  }
93
123
  });
94
124
  }
95
- function d({ numeric: n, className: r, children: i, ...a }) {
96
- return /* @__PURE__ */ s(t, {
125
+ function f({ numeric: n, className: r, children: i, ...a }) {
126
+ return /* @__PURE__ */ c(t, {
97
127
  numeric: n,
98
128
  className: e("py-0 whitespace-nowrap", r),
99
129
  ...a,
100
- children: /* @__PURE__ */ s("div", {
130
+ children: /* @__PURE__ */ c("div", {
101
131
  className: e("zen__tree-cell flex h-[var(--row-h)] items-center", n && "justify-end"),
102
132
  children: i
103
133
  })
104
134
  });
105
135
  }
106
- function f({ row: t, tree: n, indent: r = 20, children: i, className: a }) {
107
- return /* @__PURE__ */ c("div", {
136
+ function p({ row: t, tree: n, indent: r = 20, children: i, className: a }) {
137
+ return /* @__PURE__ */ l("div", {
108
138
  className: e("flex min-w-0 flex-1 items-center gap-1", a),
109
139
  style: { paddingLeft: t.depth * r },
110
- children: [t.hasChildren ? /* @__PURE__ */ s(p, { ...n.toggleProps(t) }) : /* @__PURE__ */ s("span", { className: "-ml-1 w-6 shrink-0" }), i]
140
+ children: [t.hasChildren ? /* @__PURE__ */ c(m, { ...n.toggleProps(t) }) : /* @__PURE__ */ c("span", { className: "-ml-1 w-6 shrink-0" }), i]
111
141
  });
112
142
  }
113
- function p({ expanded: t, onToggle: n, className: r, ...i }) {
114
- return /* @__PURE__ */ s("button", {
143
+ function m({ expanded: t, onToggle: n, className: i, ...a }) {
144
+ return /* @__PURE__ */ c("button", {
115
145
  type: "button",
116
146
  onClick: n,
117
147
  "aria-label": t ? "Collapse" : "Expand",
118
148
  "aria-expanded": t,
119
- 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 place-items-center rounded-md outline-hidden transition-colors focus-visible:ring-2", r),
120
- ...i,
121
- children: /* @__PURE__ */ s("svg", {
122
- viewBox: "0 0 16 16",
123
- fill: "none",
124
- stroke: "currentColor",
125
- strokeWidth: "2",
126
- strokeLinecap: "round",
127
- strokeLinejoin: "round",
128
- "aria-hidden": !0,
129
- className: e("size-4 transition-transform duration-200 ease-out", t && "rotate-90"),
130
- children: /* @__PURE__ */ s("path", { d: "m6 3.5 4.5 4.5L6 12.5" })
131
- })
149
+ 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", i),
150
+ ...a,
151
+ children: /* @__PURE__ */ c(r, { className: e("size-4 transition-transform duration-200 ease-out", t && "rotate-90") })
132
152
  });
133
153
  }
134
154
  //#endregion
135
- export { d as TreeCell, f as TreeLabel, u as TreeRow, p as TreeToggle, l as useTree };
155
+ export { f as TreeCell, p as TreeLabel, d as TreeRow, m as TreeToggle, u as useTree };
@@ -23,15 +23,17 @@ export declare function dayOfWeek(date: DateString): number;
23
23
  export declare function today(now?: Date): DateString;
24
24
  /** Days from `from` to `to` (negative if `to` is earlier). */
25
25
  export declare function daysBetween(from: DateString, to: DateString): number;
26
+ /** How much of a date to show; `day` is the day and month without the year ("Sep 3"), for dates within the year. */
27
+ export type DateStyle = 'day' | 'short' | 'medium' | 'long' | 'full';
26
28
  /**
27
- * "Sep 30, 2026" (or the locale's equivalent) by default; `short` is
28
- * "9/30/26", `long` "September 30, 2026", `full` adds the weekday.
29
+ * "Sep 30, 2026" (or the locale's equivalent) by default; `day` is "Sep 30",
30
+ * `short` "9/30/26", `long` "September 30, 2026", `full` adds the weekday.
29
31
  */
30
- export declare function formatDate(date: DateString, locale: string, style?: 'short' | 'medium' | 'long' | 'full'): string;
32
+ export declare function formatDate(date: DateString, locale: string, style?: DateStyle): string;
31
33
  /** Short weekday names for a locale, Sunday first. */
32
34
  export declare function weekdayNames(locale: string, style?: 'narrow' | 'short' | 'long'): string[];
33
35
  /** The first day of the week for a locale: 0 for Sunday, 1 for Monday, 6 for Saturday. */
34
36
  export declare function weekStart(locale: string): number;
35
37
  /** "Sep 3 – 10, 2026" (or the locale's equivalent), sharing what the two dates have in common. */
36
- export declare function formatDateRange(start: DateString, end: DateString, locale: string, style?: 'short' | 'medium' | 'long'): string;
38
+ export declare function formatDateRange(start: DateString, end: DateString, locale: string, style?: Exclude<DateStyle, 'full'>): string;
37
39
  //# 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,CAAC;AAErC;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC,6EAA6E;AAC7E,MAAM,WAAW,SAAS;IACtB,KAAK,EAAE,UAAU,CAAC;IAClB,GAAG,EAAE,UAAU,GAAG,IAAI,CAAC;CAC1B;AAID,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAI1D;AAED,0EAA0E;AAC1E,wBAAgB,QAAQ,CAAC,IAA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,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"}
@@ -33,36 +33,38 @@ function c(e = /* @__PURE__ */ new Date()) {
33
33
  function l(e, t) {
34
34
  return n(t) - n(e);
35
35
  }
36
- function u(e, t, r = "medium") {
37
- return g(new Intl.DateTimeFormat(t, {
38
- dateStyle: r,
39
- timeZone: "UTC"
40
- }).format(n(e) * 864e5));
36
+ var u = (e, t) => new Intl.DateTimeFormat(e, t === "day" ? {
37
+ day: "numeric",
38
+ month: "short",
39
+ timeZone: "UTC"
40
+ } : {
41
+ dateStyle: t,
42
+ timeZone: "UTC"
43
+ });
44
+ function d(e, t, r = "medium") {
45
+ return _(u(t, r).format(n(e) * 864e5));
41
46
  }
42
- function d(e, t = "short") {
47
+ function f(e, t = "short") {
43
48
  let n = new Intl.DateTimeFormat(e, {
44
49
  weekday: t,
45
50
  timeZone: "UTC"
46
51
  });
47
52
  return Array.from({ length: 7 }, (e, t) => n.format(Date.UTC(2023, 0, 1 + t)));
48
53
  }
49
- var f = new Set("AG AS BD BR BS BT BW BZ CA CN CO DM DO ET GT GU HK HN ID IL IN JM JP KE KH KR LA MH MM MO MT MX MZ NI NP PA PE PH PK PR PT PY SA SG SV TH TT TW UM US VE VI WS YE ZA ZW".split(" ")), p = new Set("AE AF BH DJ DZ EG IQ IR JO KW LY OM QA SD SY".split(" "));
50
- function m(e) {
54
+ var p = new Set("AG AS BD BR BS BT BW BZ CA CN CO DM DO ET GT GU HK HN ID IL IN JM JP KE KH KR LA MH MM MO MT MX MZ NI NP PA PE PH PK PR PT PY SA SG SV TH TT TW UM US VE VI WS YE ZA ZW".split(" ")), m = new Set("AE AF BH DJ DZ EG IQ IR JO KW LY OM QA SD SY".split(" "));
55
+ function h(e) {
51
56
  try {
52
57
  let t = new Intl.Locale(e), n = t.getWeekInfo?.() ?? t.weekInfo;
53
58
  if (n) return n.firstDay % 7;
54
59
  let r = t.maximize().region ?? "";
55
- return f.has(r) ? 0 : p.has(r) ? 6 : 1;
60
+ return p.has(r) ? 0 : m.has(r) ? 6 : 1;
56
61
  } catch {
57
62
  return 1;
58
63
  }
59
64
  }
60
- function h(e, t, r, i = "medium") {
61
- return g(new Intl.DateTimeFormat(r, {
62
- dateStyle: i,
63
- timeZone: "UTC"
64
- }).formatRange(n(e) * 864e5, n(t) * 864e5));
65
+ function g(e, t, r, i = "medium") {
66
+ return _(u(r, i).formatRange(n(e) * 864e5, n(t) * 864e5));
65
67
  }
66
- var g = (e) => e.replace(/[\u2009\u202f]/g, " ");
68
+ var _ = (e) => e.replace(/[\u2009\u202f]/g, " ");
67
69
  //#endregion
68
- export { i as addDays, a as addMonthsToDate, n as dayIndex, s as dayOfWeek, l as daysBetween, o as daysInMonth, u as formatDate, h as formatDateRange, r as fromDayIndex, t as isDate, c as today, m as weekStart, d as weekdayNames };
70
+ export { i as addDays, a as addMonthsToDate, n as dayIndex, s as dayOfWeek, l as daysBetween, o as daysInMonth, d as formatDate, g as formatDateRange, r as fromDayIndex, t as isDate, c as today, h as weekStart, f as weekdayNames };
@@ -1 +1 @@
1
- {"version":3,"file":"field-chevron.d.ts","sourceRoot":"","sources":["../../packages/utils/field-chevron.tsx"],"names":[],"mappings":"AAEA,2FAA2F;AAC3F,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,+BAmBvF"}
1
+ {"version":3,"file":"field-chevron.d.ts","sourceRoot":"","sources":["../../packages/utils/field-chevron.tsx"],"names":[],"mappings":"AAIA,2FAA2F;AAC3F,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,+BAUvF"}
@@ -1,19 +1,10 @@
1
1
  "use client";
2
2
  import { cx as e } from "./cx.js";
3
- import { jsx as t } from "react/jsx-runtime";
3
+ import t from "../icons/micro/chevron-down.js";
4
+ import { jsx as n } from "react/jsx-runtime";
4
5
  //#region packages/utils/field-chevron.tsx
5
- function n({ open: n, className: r }) {
6
- return /* @__PURE__ */ t("svg", {
7
- viewBox: "0 0 16 16",
8
- fill: "none",
9
- stroke: "currentColor",
10
- strokeWidth: "1.6",
11
- strokeLinecap: "round",
12
- strokeLinejoin: "round",
13
- "aria-hidden": !0,
14
- className: e("text-muted-foreground size-4 shrink-0 transition-transform duration-300", n && "rotate-180", r),
15
- children: /* @__PURE__ */ t("path", { d: "m4 6 4 4 4-4" })
16
- });
6
+ function r({ open: r, className: i }) {
7
+ return /* @__PURE__ */ n(t, { className: e("text-muted-foreground size-4 shrink-0 transition-transform duration-300", r && "rotate-180", i) });
17
8
  }
18
9
  //#endregion
19
- export { n as FieldChevron };
10
+ export { r as FieldChevron };
@@ -1,4 +1,4 @@
1
- /** Small 16px status icons in the current text colour (toasts, field errors). */
1
+ /** Small status icons in the current text colour (toasts, field errors): Heroicons' micro set. */
2
2
  export declare function CheckIcon({ className }: {
3
3
  className?: string;
4
4
  }): import('react').JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"status-icons.d.ts","sourceRoot":"","sources":["../../packages/utils/status-icons.tsx"],"names":[],"mappings":"AAEA,iFAAiF;AACjF,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,+BAe9D;AAED,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,+BAgB9D;AAED,wBAAgB,QAAQ,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,+BAe7D"}
1
+ {"version":3,"file":"status-icons.d.ts","sourceRoot":"","sources":["../../packages/utils/status-icons.tsx"],"names":[],"mappings":"AAMA,kGAAkG;AAClG,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,+BAE9D;AAED,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,+BAE9D;AAED,wBAAgB,QAAQ,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,+BAE7D"}
@@ -1,48 +1,18 @@
1
1
  "use client";
2
2
  import { cx as e } from "./cx.js";
3
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
+ import t from "../icons/micro/check.js";
4
+ import n from "../icons/micro/exclamation-triangle.js";
5
+ import r from "../icons/micro/information-circle.js";
6
+ import { jsx as i } from "react/jsx-runtime";
4
7
  //#region packages/utils/status-icons.tsx
5
- function r({ className: n }) {
6
- return /* @__PURE__ */ t("svg", {
7
- viewBox: "0 0 16 16",
8
- fill: "none",
9
- stroke: "currentColor",
10
- strokeWidth: "2",
11
- strokeLinecap: "round",
12
- strokeLinejoin: "round",
13
- className: e("size-3.5", n),
14
- "aria-hidden": !0,
15
- children: /* @__PURE__ */ t("path", { d: "m3.5 8.5 3 3 6-7" })
16
- });
8
+ function a({ className: n }) {
9
+ return /* @__PURE__ */ i(t, { className: e("size-3.5", n) });
17
10
  }
18
- function i({ className: r }) {
19
- return /* @__PURE__ */ n("svg", {
20
- viewBox: "0 0 16 16",
21
- fill: "none",
22
- stroke: "currentColor",
23
- strokeWidth: "1.8",
24
- strokeLinecap: "round",
25
- strokeLinejoin: "round",
26
- className: e("size-3.5", r),
27
- "aria-hidden": !0,
28
- children: [/* @__PURE__ */ t("path", { d: "M8 2.2 1.6 13.3h12.8L8 2.2Z" }), /* @__PURE__ */ t("path", { d: "M8 6.5v3M8 11.6v.1" })]
29
- });
11
+ function o({ className: t }) {
12
+ return /* @__PURE__ */ i(n, { className: e("size-3.5", t) });
30
13
  }
31
- function a({ className: r }) {
32
- return /* @__PURE__ */ n("svg", {
33
- viewBox: "0 0 16 16",
34
- fill: "none",
35
- stroke: "currentColor",
36
- strokeWidth: "1.8",
37
- strokeLinecap: "round",
38
- className: e("size-3.5", r),
39
- "aria-hidden": !0,
40
- children: [/* @__PURE__ */ t("circle", {
41
- cx: "8",
42
- cy: "8",
43
- r: "6.3"
44
- }), /* @__PURE__ */ t("path", { d: "M8 7.3v3.8M8 4.9v.1" })]
45
- });
14
+ function s({ className: t }) {
15
+ return /* @__PURE__ */ i(r, { className: e("size-3.5", t) });
46
16
  }
47
17
  //#endregion
48
- export { i as AlertIcon, r as CheckIcon, a as InfoIcon };
18
+ export { o as AlertIcon, a as CheckIcon, s as InfoIcon };