@rinzai/zen 0.15.0 → 0.16.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 (78) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/animated-number/index.js +14 -14
  3. package/dist/breadcrumbs/index.js +14 -14
  4. package/dist/calendar/index.js +29 -29
  5. package/dist/calendar-heatmap/index.js +12 -12
  6. package/dist/canvas/index.js +19 -19
  7. package/dist/carousel/index.js +24 -24
  8. package/dist/chart/index.js +7 -7
  9. package/dist/code-block/index.js +5 -5
  10. package/dist/collapse/index.js +6 -6
  11. package/dist/color-picker/index.js +10 -10
  12. package/dist/combobox/index.js +61 -61
  13. package/dist/command-palette/index.js +5 -5
  14. package/dist/confirm-dialog/index.js +4 -4
  15. package/dist/date-picker/index.js +15 -15
  16. package/dist/dialog/index.d.ts.map +1 -1
  17. package/dist/dialog/index.js +45 -65
  18. package/dist/docs/README.md +4 -4
  19. package/dist/docs/locale-provider.md +1 -1
  20. package/dist/docs/menu.md +54 -1
  21. package/dist/docs/seek-bar.md +30 -1
  22. package/dist/docs/sortable.md +63 -1
  23. package/dist/docs/tooltip.md +45 -3
  24. package/dist/filter-bar/index.js +6 -6
  25. package/dist/header/index.js +6 -6
  26. package/dist/icon-picker/index.js +5 -5
  27. package/dist/keypad/index.js +5 -5
  28. package/dist/lib.js +7 -7
  29. package/dist/load-more/index.js +5 -5
  30. package/dist/menu/index.d.ts +7 -1
  31. package/dist/menu/index.d.ts.map +1 -1
  32. package/dist/menu/index.js +217 -174
  33. package/dist/money-input/index.js +54 -54
  34. package/dist/month-picker/index.js +11 -11
  35. package/dist/number-field/index.js +5 -5
  36. package/dist/pagination/index.js +12 -12
  37. package/dist/range-slider/index.js +11 -11
  38. package/dist/repeat-picker/index.js +5 -5
  39. package/dist/resizable/index.js +22 -22
  40. package/dist/seek-bar/index.d.ts +3 -1
  41. package/dist/seek-bar/index.d.ts.map +1 -1
  42. package/dist/seek-bar/index.js +41 -40
  43. package/dist/select/index.js +21 -21
  44. package/dist/sortable/index.d.ts +13 -1
  45. package/dist/sortable/index.d.ts.map +1 -1
  46. package/dist/sortable/index.js +74 -55
  47. package/dist/sortable/shared.js +14 -14
  48. package/dist/sortable/tree.js +17 -17
  49. package/dist/sparkline/index.js +4 -4
  50. package/dist/stepper/index.js +13 -13
  51. package/dist/table/index.js +26 -26
  52. package/dist/table/selection.js +9 -9
  53. package/dist/table-of-contents/index.js +11 -11
  54. package/dist/tag-input/index.js +5 -5
  55. package/dist/theme-toggle/index.js +4 -4
  56. package/dist/theme.css +103 -0
  57. package/dist/time-field/index.js +21 -21
  58. package/dist/toast/index.d.ts.map +1 -1
  59. package/dist/toast/index.js +41 -41
  60. package/dist/tooltip/index.d.ts +9 -3
  61. package/dist/tooltip/index.d.ts.map +1 -1
  62. package/dist/tooltip/index.js +19 -16
  63. package/dist/tree/index.js +34 -34
  64. package/dist/trend/index.js +5 -5
  65. package/dist/utils/messages.d.ts +1 -0
  66. package/dist/utils/messages.d.ts.map +1 -1
  67. package/dist/utils/messages.js +1 -0
  68. package/dist/utils/swipe.d.ts +7 -0
  69. package/dist/utils/swipe.d.ts.map +1 -1
  70. package/dist/utils/swipe.js +45 -25
  71. package/dist/utils/useAnchoredPopup.d.ts +2 -1
  72. package/dist/utils/useAnchoredPopup.d.ts.map +1 -1
  73. package/dist/utils/useAnchoredPopup.js +9 -5
  74. package/dist/utils/useVirtualList.d.ts +6 -1
  75. package/dist/utils/useVirtualList.d.ts.map +1 -1
  76. package/dist/utils/useVirtualList.js +12 -12
  77. package/dist/zen.css +1 -1
  78. package/package.json +1 -1
@@ -1,17 +1,17 @@
1
1
  "use client";
2
- import e from "../icons/micro/check.js";
3
- import { cx as t } from "../utils/cx.js";
4
- import { useMessages as n } from "../locale-provider/index.js";
2
+ import { useMessages as e } from "../locale-provider/index.js";
3
+ import t from "../icons/micro/check.js";
4
+ import { cx as n } from "../utils/cx.js";
5
5
  import { Children as r, isValidElement as i } from "react";
6
6
  import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
7
  //#region packages/stepper/index.tsx
8
8
  function s({ value: s, className: c, children: l, "aria-label": u, ...d }) {
9
- let f = n(), p = u ?? f.progress, m = r.toArray(l).filter(i);
9
+ let f = e(), p = u ?? f.progress, m = r.toArray(l).filter(i);
10
10
  return /* @__PURE__ */ a("ol", {
11
11
  "aria-label": p,
12
- className: t("zen__stepper flex w-full items-start", c),
12
+ className: n("zen__stepper flex w-full items-start", c),
13
13
  ...d,
14
- children: m.map((n, r) => {
14
+ children: m.map((e, r) => {
15
15
  let i = r < s ? "done" : r === s ? "current" : "upcoming";
16
16
  return /* @__PURE__ */ o("li", {
17
17
  "data-state": i,
@@ -21,26 +21,26 @@ function s({ value: s, className: c, children: l, "aria-label": u, ...d }) {
21
21
  r > 0 && /* @__PURE__ */ a("span", {
22
22
  "aria-hidden": !0,
23
23
  className: "bg-tint/10 absolute start-[calc(-50%+1.25rem)] end-[calc(50%+1.25rem)] top-3.5 h-px overflow-hidden",
24
- children: /* @__PURE__ */ a("span", { className: t("bg-primary ease-out-soft block h-full origin-left transition-transform rtl:origin-right duration-500", i === "upcoming" && "scale-x-0") })
24
+ children: /* @__PURE__ */ a("span", { className: n("bg-primary ease-out-soft block h-full origin-left transition-transform rtl:origin-right duration-500", i === "upcoming" && "scale-x-0") })
25
25
  }),
26
26
  /* @__PURE__ */ a("span", {
27
27
  "aria-hidden": !0,
28
- className: t("grid size-7 place-items-center rounded-full text-xs font-semibold tabular-nums transition-[background-color,color,box-shadow] duration-300", i === "upcoming" && "bg-tint/[0.05] text-muted-foreground shadow-[inset_0_0_0_1px_oklch(var(--tint)/0.12)]", i === "current" && "bg-primary/15 text-foreground shadow-[inset_0_0_0_1px_oklch(var(--primary)/0.5),0_0_18px_-2px_oklch(var(--glow)/calc(0.7*var(--glow-k)))]", i === "done" && "bg-primary text-primary-foreground"),
29
- children: i === "done" ? /* @__PURE__ */ a(e, { className: "size-3.5" }) : r + 1
28
+ className: n("grid size-7 place-items-center rounded-full text-xs font-semibold tabular-nums transition-[background-color,color,box-shadow] duration-300", i === "upcoming" && "bg-tint/[0.05] text-muted-foreground shadow-[inset_0_0_0_1px_oklch(var(--tint)/0.12)]", i === "current" && "bg-primary/15 text-foreground shadow-[inset_0_0_0_1px_oklch(var(--primary)/0.5),0_0_18px_-2px_oklch(var(--glow)/calc(0.7*var(--glow-k)))]", i === "done" && "bg-primary text-primary-foreground"),
29
+ children: i === "done" ? /* @__PURE__ */ a(t, { className: "size-3.5" }) : r + 1
30
30
  }),
31
- n,
31
+ e,
32
32
  /* @__PURE__ */ a("span", {
33
33
  className: "sr-only",
34
34
  children: i === "done" ? ", done" : i === "upcoming" ? ", not started" : ""
35
35
  })
36
36
  ]
37
- }, n.key ?? r);
37
+ }, e.key ?? r);
38
38
  })
39
39
  });
40
40
  }
41
- function c({ description: e, className: n, children: r }) {
41
+ function c({ description: e, className: t, children: r }) {
42
42
  return /* @__PURE__ */ o("span", {
43
- className: t("flex flex-col gap-0.5 px-1", n),
43
+ className: n("flex flex-col gap-0.5 px-1", t),
44
44
  children: [/* @__PURE__ */ a("span", {
45
45
  className: "text-muted-foreground group-data-[state=current]/step:text-foreground group-data-[state=done]/step:text-foreground text-sm font-medium",
46
46
  children: r
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { cx as e } from "../utils/cx.js";
3
- import { useMessages as t } from "../locale-provider/index.js";
2
+ import { useMessages as e } from "../locale-provider/index.js";
3
+ import { cx as t } from "../utils/cx.js";
4
4
  import { reducedMotion as n } from "../utils/motion.js";
5
5
  import r from "../icons/chevron-down.js";
6
6
  import i from "../icons/chevron-up.js";
@@ -9,7 +9,7 @@ import { TableSwipeAction as l, TableSwipeRow as u } from "./swipe.js";
9
9
  import { useCallback as d, useEffect as f, useLayoutEffect as p, useMemo as m, useRef as h, useState as g } from "react";
10
10
  import { jsx as _, jsxs as v } from "react/jsx-runtime";
11
11
  //#region packages/table/index.tsx
12
- function y({ label: t, className: n, ref: r, onScroll: i, ...a }) {
12
+ function y({ label: e, className: n, ref: r, onScroll: i, ...a }) {
13
13
  let o = h(null), s = d(() => {
14
14
  let e = o.current;
15
15
  if (!e) return;
@@ -23,7 +23,7 @@ function y({ label: t, className: n, ref: r, onScroll: i, ...a }) {
23
23
  let t = typeof ResizeObserver > "u" ? null : new ResizeObserver(s);
24
24
  return t?.observe(e), e.firstElementChild && t?.observe(e.firstElementChild), () => t?.disconnect();
25
25
  }, [s]), /* @__PURE__ */ _("div", {
26
- className: e("zen__table-panel glass glow-edge isolate flex flex-col overflow-hidden rounded-xl", n),
26
+ className: t("zen__table-panel glass glow-edge isolate flex flex-col overflow-hidden rounded-xl", n),
27
27
  children: /* @__PURE__ */ _("div", {
28
28
  ref: (e) => {
29
29
  o.current = e, typeof r == "function" ? r(e) : r && (r.current = e);
@@ -31,23 +31,23 @@ function y({ label: t, className: n, ref: r, onScroll: i, ...a }) {
31
31
  onScroll: (e) => {
32
32
  s(), i?.(e);
33
33
  },
34
- role: t ? "region" : void 0,
35
- "aria-label": t,
36
- tabIndex: t ? 0 : void 0,
34
+ role: e ? "region" : void 0,
35
+ "aria-label": e,
36
+ tabIndex: e ? 0 : void 0,
37
37
  className: "zen__table-container focus-ring relative min-h-0 overflow-auto rounded-[inherit] outline-hidden will-change-scroll focus-visible:ring-inset",
38
38
  ...a
39
39
  })
40
40
  });
41
41
  }
42
- function b({ className: t, ...n }) {
42
+ function b({ className: e, ...n }) {
43
43
  return /* @__PURE__ */ _("table", {
44
- className: e("zen__table w-full border-separate border-spacing-0 text-sm", t),
44
+ className: t("zen__table w-full border-separate border-spacing-0 text-sm", e),
45
45
  ...n
46
46
  });
47
47
  }
48
- function x({ className: t, ...n }) {
48
+ function x({ className: e, ...n }) {
49
49
  return /* @__PURE__ */ _("thead", {
50
- className: e("zen__sticky-top sticky top-0 z-20", t),
50
+ className: t("zen__sticky-top sticky top-0 z-20", e),
51
51
  ...n
52
52
  });
53
53
  }
@@ -113,29 +113,29 @@ var w = typeof window > "u" ? f : p, T = {
113
113
  duration: 260,
114
114
  easing: "ease-out"
115
115
  };
116
- function O({ className: t, ...n }) {
116
+ function O({ className: e, ...n }) {
117
117
  return /* @__PURE__ */ _("tfoot", {
118
- className: e("zen__sticky-bottom sticky bottom-0 z-20", t),
118
+ className: t("zen__sticky-bottom sticky bottom-0 z-20", e),
119
119
  ...n
120
120
  });
121
121
  }
122
- function k({ selected: t, className: n, ...r }) {
122
+ function k({ selected: e, className: n, ...r }) {
123
123
  return /* @__PURE__ */ _("tr", {
124
- "data-selected": t || void 0,
125
- className: e("group", n),
124
+ "data-selected": e || void 0,
125
+ className: t("group", n),
126
126
  ...r
127
127
  });
128
128
  }
129
- function A({ numeric: t, sticky: n, sortDirection: a, onSort: o, scope: s = "col", className: c, children: l, ...u }) {
129
+ function A({ numeric: e, sticky: n, sortDirection: a, onSort: o, scope: s = "col", className: c, children: l, ...u }) {
130
130
  return /* @__PURE__ */ _("th", {
131
131
  scope: s,
132
132
  "aria-sort": a === "asc" ? "ascending" : a === "desc" ? "descending" : void 0,
133
- className: e("border-tint/[0.07] text-muted-foreground border-b px-3 py-2.5 align-middle text-xs leading-5 font-medium tracking-wider whitespace-nowrap uppercase", n === "start" && "zen__sticky-start sticky start-0 z-10", t ? "text-end" : "text-start", c),
133
+ className: t("border-tint/[0.07] text-muted-foreground border-b px-3 py-2.5 align-middle text-xs leading-5 font-medium tracking-wider whitespace-nowrap uppercase", n === "start" && "zen__sticky-start sticky start-0 z-10", e ? "text-end" : "text-start", c),
134
134
  ...u,
135
135
  children: o ? /* @__PURE__ */ v("button", {
136
136
  type: "button",
137
137
  onClick: o,
138
- className: e("hover:text-foreground touch-target inline-flex cursor-pointer items-center gap-1 align-middle leading-5 tracking-wider uppercase", t && "flex-row-reverse"),
138
+ className: t("hover:text-foreground touch-target inline-flex cursor-pointer items-center gap-1 align-middle leading-5 tracking-wider uppercase", e && "flex-row-reverse"),
139
139
  children: [l, /* @__PURE__ */ _("span", {
140
140
  "aria-hidden": !0,
141
141
  className: "inline-flex w-3",
@@ -150,15 +150,15 @@ function A({ numeric: t, sticky: n, sortDirection: a, onSort: o, scope: s = "col
150
150
  }) : l
151
151
  });
152
152
  }
153
- function j({ numeric: t, sticky: n, className: r, ...i }) {
153
+ function j({ numeric: e, sticky: n, className: r, ...i }) {
154
154
  return /* @__PURE__ */ _("td", {
155
- className: e("border-tint/[0.045] border-b px-3 py-2.5 transition-colors duration-150", "group-hover:[background-image:linear-gradient(oklch(var(--tint)/0.035),oklch(var(--tint)/0.035))]", "group-data-selected:[background-image:linear-gradient(oklch(var(--primary)/0.09),oklch(var(--primary)/0.09))]", n === "start" && "zen__sticky-start sticky start-0 z-10 shadow-[inset_-1px_0_0_oklch(var(--tint)/0.06)] rtl:shadow-[inset_1px_0_0_oklch(var(--tint)/0.06)]", t && "text-end tabular-nums", r),
155
+ className: t("border-tint/[0.045] border-b px-3 py-2.5 transition-colors duration-150", "group-hover:[background-image:linear-gradient(oklch(var(--tint)/0.035),oklch(var(--tint)/0.035))]", "group-data-selected:[background-image:linear-gradient(oklch(var(--primary)/0.09),oklch(var(--primary)/0.09))]", n === "start" && "zen__sticky-start sticky start-0 z-10 shadow-[inset_-1px_0_0_oklch(var(--tint)/0.06)] rtl:shadow-[inset_1px_0_0_oklch(var(--tint)/0.06)]", e && "text-end tabular-nums", r),
156
156
  ...i
157
157
  });
158
158
  }
159
- function M({ numeric: t, sticky: n, className: r, ...i }) {
159
+ function M({ numeric: e, sticky: n, className: r, ...i }) {
160
160
  return /* @__PURE__ */ _("td", {
161
- className: e("border-tint/[0.07] h-9 border-t px-3 font-medium whitespace-nowrap", n === "start" && "zen__sticky-start sticky start-0 z-10 shadow-[inset_-1px_0_0_oklch(var(--tint)/0.06)] rtl:shadow-[inset_1px_0_0_oklch(var(--tint)/0.06)]", t && "text-end tabular-nums", r),
161
+ className: t("border-tint/[0.07] h-9 border-t px-3 font-medium whitespace-nowrap", n === "start" && "zen__sticky-start sticky start-0 z-10 shadow-[inset_-1px_0_0_oklch(var(--tint)/0.06)] rtl:shadow-[inset_1px_0_0_oklch(var(--tint)/0.06)]", e && "text-end tabular-nums", r),
162
162
  ...i
163
163
  });
164
164
  }
@@ -176,10 +176,10 @@ function N({ height: e, colSpan: t }) {
176
176
  })
177
177
  });
178
178
  }
179
- function P({ colSpan: e, children: n }) {
180
- let r = t();
179
+ function P({ colSpan: t, children: n }) {
180
+ let r = e();
181
181
  return /* @__PURE__ */ _("tr", { children: /* @__PURE__ */ _("td", {
182
- colSpan: e,
182
+ colSpan: t,
183
183
  className: "text-muted-foreground px-3 py-8 text-center",
184
184
  children: n ?? r.nothingHere
185
185
  }) });
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { cx as e } from "../utils/cx.js";
3
- import { useMessages as t } from "../locale-provider/index.js";
2
+ import { useMessages as e } from "../locale-provider/index.js";
3
+ import { cx as t } from "../utils/cx.js";
4
4
  import n from "../icons/micro/x-mark.js";
5
5
  import r from "../checkbox/index.js";
6
6
  import { useRef as i, useState as a } from "react";
@@ -29,13 +29,13 @@ function c(e) {
29
29
  })
30
30
  };
31
31
  }
32
- function l({ checked: t, onSelect: n, label: i, className: a, ...s }) {
32
+ function l({ checked: e, onSelect: n, label: i, className: a, ...s }) {
33
33
  return /* @__PURE__ */ o("td", {
34
- className: e("border-tint/[0.045] w-10 border-b py-2.5 ps-3 pe-0", a),
34
+ className: t("border-tint/[0.045] w-10 border-b py-2.5 ps-3 pe-0", a),
35
35
  ...s,
36
36
  children: /* @__PURE__ */ o(r, {
37
37
  "aria-label": i,
38
- checked: t,
38
+ checked: e,
39
39
  onClick: (e) => n(e.currentTarget.checked, e.shiftKey),
40
40
  onCheckedChange: () => {},
41
41
  className: "touch-target grid"
@@ -43,9 +43,9 @@ function l({ checked: t, onSelect: n, label: i, className: a, ...s }) {
43
43
  });
44
44
  }
45
45
  function u({ checked: n, indeterminate: i, onSelect: a, label: s, className: c, ...l }) {
46
- let u = t(), d = s ?? u.selectAll;
46
+ let u = e(), d = s ?? u.selectAll;
47
47
  return /* @__PURE__ */ o("th", {
48
- className: e("w-10 py-2.5 ps-3 pe-0", c),
48
+ className: t("w-10 py-2.5 ps-3 pe-0", c),
49
49
  ...l,
50
50
  children: /* @__PURE__ */ o(r, {
51
51
  "aria-label": d,
@@ -57,11 +57,11 @@ function u({ checked: n, indeterminate: i, onSelect: a, label: s, className: c,
57
57
  });
58
58
  }
59
59
  function d({ count: r, onClear: i, label: a, clearLabel: c, className: l, children: u }) {
60
- let d = t(), f = a ?? d.selectedCount, p = c ?? d.clearSelection;
60
+ let d = e(), f = a ?? d.selectedCount, p = c ?? d.clearSelection;
61
61
  return r === 0 ? null : /* @__PURE__ */ s("div", {
62
62
  role: "toolbar",
63
63
  "aria-label": d.selection,
64
- className: e("zen__selection-bar glass glass-blur glow-edge fixed inset-x-0 bottom-6 z-40 mx-auto flex w-fit max-w-[calc(100vw-2rem)] items-center gap-2 rounded-2xl py-2 ps-4 pe-2 shadow-[0_12px_40px_-12px_oklch(0_0_0/0.6)]", l),
64
+ className: t("zen__selection-bar glass glass-blur glow-edge fixed inset-x-0 bottom-6 z-40 mx-auto flex w-fit max-w-[calc(100vw-2rem)] items-center gap-2 rounded-2xl py-2 ps-4 pe-2 shadow-[0_12px_40px_-12px_oklch(0_0_0/0.6)]", l),
65
65
  children: [
66
66
  /* @__PURE__ */ o("span", {
67
67
  className: "text-sm font-medium whitespace-nowrap tabular-nums",
@@ -1,12 +1,12 @@
1
1
  "use client";
2
- import { cx as e } from "../utils/cx.js";
3
- import { useMessages as t } from "../locale-provider/index.js";
2
+ import { useMessages as e } from "../locale-provider/index.js";
3
+ import { cx as t } from "../utils/cx.js";
4
4
  import { followSectionLink as n } from "../utils/section-link.js";
5
5
  import { useEffect as r, useState as i } from "react";
6
6
  import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
7
  //#region packages/table-of-contents/index.tsx
8
8
  function s({ items: s, title: c, className: l, ...u }) {
9
- let d = t(), f = c ?? d.onThisPage, [p, m] = i();
9
+ let d = e(), f = c ?? d.onThisPage, [p, m] = i();
10
10
  return r(() => {
11
11
  if (typeof IntersectionObserver > "u") return;
12
12
  let e = s.map((e) => document.getElementById(e.id)).filter((e) => !!e), t = /* @__PURE__ */ new Set(), n = new IntersectionObserver((e) => {
@@ -18,22 +18,22 @@ function s({ items: s, title: c, className: l, ...u }) {
18
18
  }, [s]), s.length ? /* @__PURE__ */ o("nav", {
19
19
  "aria-label": f || d.onThisPage,
20
20
  ...u,
21
- className: e("zen__toc flex flex-col gap-3", l),
21
+ className: t("zen__toc flex flex-col gap-3", l),
22
22
  children: [f && /* @__PURE__ */ a("p", {
23
23
  className: "text-muted-foreground text-2xs mt-0! tracking-widest uppercase",
24
24
  children: f
25
25
  }), /* @__PURE__ */ a("ul", {
26
26
  className: "border-tint/[0.07] flex flex-col gap-2 border-l text-sm",
27
- children: s.map((t) => /* @__PURE__ */ a("li", {
28
- className: e("-ms-px", t.depth === 2 && "ps-3"),
27
+ children: s.map((e) => /* @__PURE__ */ a("li", {
28
+ className: t("-ms-px", e.depth === 2 && "ps-3"),
29
29
  children: /* @__PURE__ */ a("a", {
30
- href: `#${t.id}`,
30
+ href: `#${e.id}`,
31
31
  onClick: n,
32
- "aria-current": t.id === p ? "location" : void 0,
33
- className: e("text-muted-foreground hover:text-foreground block border-s border-transparent ps-3 transition-colors pointer-coarse:py-1.5", "aria-[current=location]:border-primary aria-[current=location]:text-foreground"),
34
- children: t.label
32
+ "aria-current": e.id === p ? "location" : void 0,
33
+ className: t("text-muted-foreground hover:text-foreground block border-s border-transparent ps-3 transition-colors pointer-coarse:py-1.5", "aria-[current=location]:border-primary aria-[current=location]:text-foreground"),
34
+ children: e.label
35
35
  })
36
- }, t.id))
36
+ }, e.id))
37
37
  })]
38
38
  }) : null;
39
39
  }
@@ -1,7 +1,7 @@
1
1
  "use client";
2
- import { cx as e } from "../utils/cx.js";
3
- import { useControllable as t } from "../utils/useControllable.js";
4
- import { useMessages as n } from "../locale-provider/index.js";
2
+ import { useMessages as e } from "../locale-provider/index.js";
3
+ import { cx as t } from "../utils/cx.js";
4
+ import { useControllable as n } from "../utils/useControllable.js";
5
5
  import { useFieldProps as r } from "../field/index.js";
6
6
  import { FIELD as i } from "../utils/styles.js";
7
7
  import { FormValue as a } from "../utils/form-value.js";
@@ -10,7 +10,7 @@ import { useLayoutEffect as s, useRef as c, useState as l } from "react";
10
10
  import { jsx as u, jsxs as d } from "react/jsx-runtime";
11
11
  //#region packages/tag-input/index.tsx
12
12
  function f({ value: f, defaultValue: p = [], onValueChange: m, validate: h, removeLabel: g, className: _, disabled: v, name: y, ...b }) {
13
- let x = n(), S = g ?? x.remove, [C, w, T] = t(f, p, m), [E, D] = l(""), O = r(b), k = c(null), A = C.length;
13
+ let x = e(), S = g ?? x.remove, [C, w, T] = n(f, p, m), [E, D] = l(""), O = r(b), k = c(null), A = C.length;
14
14
  s(() => {
15
15
  let e = k.current;
16
16
  e?.parentElement?.contains(document.activeElement) && (e.scrollTop = e.scrollHeight);
@@ -21,7 +21,7 @@ function f({ value: f, defaultValue: p = [], onValueChange: m, validate: h, remo
21
21
  t.length !== C.length && w(t);
22
22
  };
23
23
  return /* @__PURE__ */ d("div", {
24
- className: e("zen__tag-input", i, "flex h-auto max-h-36 min-h-10 w-full cursor-text flex-col gap-1.5 py-1.5", "has-[input:focus-visible]:border-glow/60 has-[input:focus-visible]:bg-tint/[0.05] has-[input:focus-visible]:shadow-glow-focus has-[input:focus-visible]:[--glow-border-color:transparent]", v && "cursor-not-allowed opacity-50", _),
24
+ className: t("zen__tag-input", i, "flex h-auto max-h-36 min-h-10 w-full cursor-text flex-col gap-1.5 py-1.5", "has-[input:focus-visible]:border-glow/60 has-[input:focus-visible]:bg-tint/[0.05] has-[input:focus-visible]:shadow-glow-focus has-[input:focus-visible]:[--glow-border-color:transparent]", v && "cursor-not-allowed opacity-50", _),
25
25
  onClick: (e) => e.currentTarget.querySelector("input")?.focus(),
26
26
  children: [
27
27
  A > 0 && /* @__PURE__ */ u("div", {
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { cx as e } from "../utils/cx.js";
3
- import { useMessages as t } from "../locale-provider/index.js";
2
+ import { useMessages as e } from "../locale-provider/index.js";
3
+ import { cx as t } from "../utils/cx.js";
4
4
  import n from "../icons/micro/moon.js";
5
5
  import r from "../icons/micro/sun.js";
6
6
  import { prepareThemeWave as i, themeWave as a } from "../utils/theme-wave.js";
@@ -25,7 +25,7 @@ function f(e) {
25
25
  }
26
26
  var p = () => document.documentElement.classList.contains("light") ? "light" : "dark";
27
27
  function m({ value: l, onValueChange: u, target: m, storageKey: h = "theme", className: g, ..._ }) {
28
- let v = o(f, p, () => "dark"), y = l ?? v, b = y === "dark" ? "light" : "dark", x = t();
28
+ let v = o(f, p, () => "dark"), y = l ?? v, b = y === "dark" ? "light" : "dark", x = e();
29
29
  return /* @__PURE__ */ s("button", {
30
30
  type: "button",
31
31
  "aria-label": b === "dark" ? x.switchToDark : x.switchToLight,
@@ -44,7 +44,7 @@ function m({ value: l, onValueChange: u, target: m, storageKey: h = "theme", cla
44
44
  u?.(b), d.forEach((e) => e());
45
45
  });
46
46
  }, e.currentTarget, m?.current),
47
- className: e("zen__theme-toggle text-muted-foreground hover:bg-tint/[0.06] hover:text-foreground grid size-10 cursor-pointer place-items-center rounded-lg outline-hidden focus-ring", g),
47
+ className: t("zen__theme-toggle text-muted-foreground hover:bg-tint/[0.06] hover:text-foreground grid size-10 cursor-pointer place-items-center rounded-lg outline-hidden focus-ring", g),
48
48
  children: s(y === "dark" ? n : r, { className: "size-4" })
49
49
  });
50
50
  }
package/dist/theme.css CHANGED
@@ -1156,6 +1156,109 @@ html.zen-theme-closing::view-transition-old(zen-theme-area) {
1156
1156
  translate: -100% 0;
1157
1157
  }
1158
1158
  }
1159
+ /*
1160
+ * A menu as a bottom sheet on phones (MenuContent's `sheet`): across the
1161
+ * bottom of the screen over a scrim, sliding up and following a finger
1162
+ * swiping it back down. A submenu slides in over it from the side, and the
1163
+ * menu moves aside; it slides back out the same way, or goes down with the
1164
+ * menu. Anchoring is set inline, hence !important. --zen-sheet tells the
1165
+ * scripts it's a sheet now (no opening submenus on hover).
1166
+ */
1167
+ @media (width < theme(--breakpoint-md)) {
1168
+ .zen__popover[data-zen-sheet] {
1169
+ --zen-sheet: 1;
1170
+ position: fixed;
1171
+ position-area: none !important;
1172
+ position-try-fallbacks: none !important;
1173
+ position-visibility: always;
1174
+ /* Edge to edge, over a scrollbar's gutter too. */
1175
+ inset: auto auto 0 0 !important;
1176
+ justify-self: auto !important;
1177
+ width: 100vw !important;
1178
+ min-width: 0 !important;
1179
+ max-height: 85dvh;
1180
+ overflow-y: auto;
1181
+ overscroll-behavior: contain;
1182
+ margin: 0 !important;
1183
+ padding: 0.5rem 0.5rem calc(0.75rem + env(safe-area-inset-bottom));
1184
+ border-width: 1px 0 0;
1185
+ border-radius: 1rem 1rem 0 0;
1186
+ background-color: oklch(var(--card) / 0.9);
1187
+ pointer-events: auto;
1188
+ translate: var(--zen-swipe, 0 0);
1189
+ will-change: translate;
1190
+ transition:
1191
+ translate 320ms var(--ease-out-soft),
1192
+ opacity 200ms,
1193
+ overlay 320ms allow-discrete,
1194
+ display 320ms allow-discrete;
1195
+ }
1196
+ .zen__popover[data-zen-sheet]:not(:popover-open) {
1197
+ translate: 0 100%;
1198
+ }
1199
+ .zen__popover:popover-open .zen__popover[data-zen-sheet][data-zen-beside]:not(:popover-open) {
1200
+ translate: 100% 0;
1201
+ }
1202
+ .zen__popover:popover-open .zen__popover[data-zen-sheet][data-zen-beside]:not(:popover-open):dir(rtl) {
1203
+ translate: -100% 0;
1204
+ }
1205
+ /* Under an open submenu (in the top layer, so it's not moved with it). */
1206
+ .zen__popover[data-zen-sheet]:popover-open:has(.zen__popover[data-zen-sheet]:popover-open) {
1207
+ translate: -30% 0;
1208
+ opacity: 0;
1209
+ pointer-events: none;
1210
+ }
1211
+ .zen__popover[data-zen-sheet]:popover-open:has(.zen__popover[data-zen-sheet]:popover-open):dir(rtl) {
1212
+ translate: 30% 0;
1213
+ }
1214
+ .zen__popover[data-zen-sheet] [role^='menuitem'] {
1215
+ min-height: 3rem;
1216
+ }
1217
+ .zen__popover[data-zen-sheet] .zen__sheet-only {
1218
+ display: revert-layer;
1219
+ }
1220
+ .zen__popover[data-zen-sheet]::backdrop {
1221
+ background: var(--backdrop-scrim, oklch(0 0 0 / 0.5));
1222
+ opacity: calc(1 - var(--zen-swipe-progress, 0));
1223
+ transition:
1224
+ opacity 200ms,
1225
+ overlay 320ms allow-discrete,
1226
+ display 320ms allow-discrete;
1227
+ }
1228
+ .zen__popover[data-zen-sheet]:not(:popover-open)::backdrop {
1229
+ opacity: 0;
1230
+ }
1231
+ /* The menu's scrim is behind a submenu already. */
1232
+ .zen__popover[data-zen-sheet][data-zen-beside]::backdrop {
1233
+ background: none;
1234
+ }
1235
+ .zen__popover[data-zen-sheet][data-swiping],
1236
+ .zen__popover[data-zen-sheet][data-swiping]::backdrop {
1237
+ transition: none;
1238
+ user-select: none;
1239
+ }
1240
+ :root:has(.zen__popover[data-zen-sheet]:popover-open) {
1241
+ overflow: hidden;
1242
+ }
1243
+ @starting-style {
1244
+ .zen__popover[data-zen-sheet]:popover-open {
1245
+ translate: 0 100%;
1246
+ }
1247
+ .zen__popover[data-zen-sheet][data-zen-beside]:popover-open {
1248
+ translate: 100% 0;
1249
+ }
1250
+ .zen__popover[data-zen-sheet][data-zen-beside]:popover-open:dir(rtl) {
1251
+ translate: -100% 0;
1252
+ }
1253
+ .zen__popover[data-zen-sheet]:popover-open::backdrop {
1254
+ opacity: 0;
1255
+ }
1256
+ }
1257
+ }
1258
+ /* What only a sheet shows: its grip, a submenu's way back. */
1259
+ .zen__sheet-only {
1260
+ display: none;
1261
+ }
1159
1262
  /*
1160
1263
  * The page behind a modal dialog doesn't scroll. Hiding the overflow removes
1161
1264
  * the scrollbar, so where the page had one (Dialog sets data-zen-scrollbar),
@@ -1,8 +1,8 @@
1
1
  "use client";
2
- import { cx as e } from "../utils/cx.js";
3
- import { readingKey as t } from "../utils/direction.js";
4
- import { useControllable as n } from "../utils/useControllable.js";
5
- import { useLocale as r, useMessages as i } from "../locale-provider/index.js";
2
+ import { useLocale as e, useMessages as t } from "../locale-provider/index.js";
3
+ import { cx as n } from "../utils/cx.js";
4
+ import { readingKey as r } from "../utils/direction.js";
5
+ import { useControllable as i } from "../utils/useControllable.js";
6
6
  import { useField as a } from "../field/index.js";
7
7
  import { FIELD_SIZE as o, FIELD_WITHIN as s } from "../utils/styles.js";
8
8
  import { FormValue as c } from "../utils/form-value.js";
@@ -11,21 +11,21 @@ import { useMemo as u, useRef as d, useState as f } from "react";
11
11
  import { jsx as p, jsxs as m } from "react/jsx-runtime";
12
12
  //#region packages/time-field/index.tsx
13
13
  function h({ value: l, defaultValue: h = null, onValueChange: _, step: v = 1, locale: y, name: b, size: x = "default", invalid: S, disabled: C, className: w, onMouseDown: T, ...E }) {
14
- let D = i(), O = a(), k = r(y), A = u(() => new g(k), [k]), [j, M, N] = n(l, h, _), [P, F] = f(null), I = P ?? A.split(j), L = d(""), R = (e) => {
14
+ let D = t(), O = a(), k = e(y), A = u(() => new g(k), [k]), [j, M, N] = i(l, h, _), [P, F] = f(null), I = P ?? A.split(j), L = d(""), R = (e) => {
15
15
  let t = A.join(e);
16
16
  F(t === null ? e : null), t !== j && M(t);
17
- }, z = (e, n) => {
18
- let r = t(e.key, e.currentTarget), i = (t) => {
17
+ }, z = (e, t) => {
18
+ let n = r(e.key, e.currentTarget), i = (t) => {
19
19
  let n = [...e.currentTarget.parentElement.querySelectorAll("[role=spinbutton]")];
20
20
  n[n.indexOf(e.currentTarget) + t]?.focus();
21
21
  };
22
- if (r === "ArrowLeft" || r === "ArrowRight") return e.preventDefault(), i(r === "ArrowLeft" ? -1 : 1);
23
- if (r === "ArrowUp" || r === "ArrowDown") return e.preventDefault(), L.current = "", R(A.step(I, n, r === "ArrowUp" ? 1 : -1, v));
24
- if (r === "Backspace" || r === "Delete") return e.preventDefault(), L.current = "", R({
22
+ if (n === "ArrowLeft" || n === "ArrowRight") return e.preventDefault(), i(n === "ArrowLeft" ? -1 : 1);
23
+ if (n === "ArrowUp" || n === "ArrowDown") return e.preventDefault(), L.current = "", R(A.step(I, t, n === "ArrowUp" ? 1 : -1, v));
24
+ if (n === "Backspace" || n === "Delete") return e.preventDefault(), L.current = "", R({
25
25
  ...I,
26
- [n === "dayPeriod" ? "period" : n]: null
26
+ [t === "dayPeriod" ? "period" : t]: null
27
27
  });
28
- if (n === "dayPeriod") {
28
+ if (t === "dayPeriod") {
29
29
  let t = A.periodFor(e.key);
30
30
  return t === null ? void 0 : (e.preventDefault(), R({
31
31
  ...I,
@@ -35,18 +35,18 @@ function h({ value: l, defaultValue: h = null, onValueChange: _, step: v = 1, lo
35
35
  let a = A.digit(e.key);
36
36
  if (a === null) return;
37
37
  e.preventDefault();
38
- let { n: o, done: s } = A.type(n, L.current + a);
38
+ let { n: o, done: s } = A.type(t, L.current + a);
39
39
  L.current = s ? "" : L.current + a, R({
40
40
  ...I,
41
- [n]: o
41
+ [t]: o
42
42
  }), s && i(1);
43
- }, B = A.order.map((t, n) => {
44
- if (t.type === "literal") return /* @__PURE__ */ p("span", {
43
+ }, B = A.order.map((e, t) => {
44
+ if (e.type === "literal") return /* @__PURE__ */ p("span", {
45
45
  "aria-hidden": !0,
46
46
  className: "text-muted-foreground whitespace-pre",
47
- children: t.value
48
- }, n);
49
- let r = t.type, i = r === "dayPeriod" ? I.period : I[r], a = {
47
+ children: e.value
48
+ }, t);
49
+ let r = e.type, i = r === "dayPeriod" ? I.period : I[r], a = {
50
50
  hour: D.hour,
51
51
  minute: D.minute,
52
52
  dayPeriod: D.dayPeriod
@@ -62,7 +62,7 @@ function h({ value: l, defaultValue: h = null, onValueChange: _, step: v = 1, lo
62
62
  "aria-disabled": C || void 0,
63
63
  onKeyDown: C ? void 0 : (e) => z(e, r),
64
64
  onFocus: () => L.current = "",
65
- className: e("zen__time-segment rounded-sm px-0.5 tabular-nums outline-hidden caret-transparent select-none", "focus:bg-primary/20 focus:text-foreground", o === null && "text-muted-foreground"),
65
+ className: n("zen__time-segment rounded-sm px-0.5 tabular-nums outline-hidden caret-transparent select-none", "focus:bg-primary/20 focus:text-foreground", o === null && "text-muted-foreground"),
66
66
  children: o ?? "––"
67
67
  }, r);
68
68
  });
@@ -75,7 +75,7 @@ function h({ value: l, defaultValue: h = null, onValueChange: _, step: v = 1, lo
75
75
  onMouseDown: (e) => {
76
76
  T?.(e), !(e.defaultPrevented || e.target.closest("[role=spinbutton]")) && (e.preventDefault(), e.currentTarget.querySelector("[role=spinbutton]")?.focus());
77
77
  },
78
- className: e("zen__time-field", s, o[x], "w-fit cursor-text gap-0", C && "bg-muted text-muted-foreground cursor-not-allowed opacity-50", "data-invalid:border-destructive", w),
78
+ className: n("zen__time-field", s, o[x], "w-fit cursor-text gap-0", C && "bg-muted text-muted-foreground cursor-not-allowed opacity-50", "data-invalid:border-destructive", w),
79
79
  children: [B, /* @__PURE__ */ p(c, {
80
80
  name: b,
81
81
  value: j ?? "",
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/toast/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAIH,SAAS,EACT,SAAS,EAMZ,MAAM,OAAO,CAAC;AAKf,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAE5D,MAAM,WAAW,YAAY;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,sCAAsC;IACtC,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;IAChD,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AA4BD,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,EAAE,kBAAkB,+BA+JhG;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,QAO/E;AAYD,+EAA+E;AAC/E,wBAAgB,QAAQ,YAhNoB,MAAM,YAAY,YAAY,KAAK,MAAM,CAoNpF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/toast/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAIH,SAAS,EACT,SAAS,EAMZ,MAAM,OAAO,CAAC;AAKf,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAE5D,MAAM,WAAW,YAAY;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,sCAAsC;IACtC,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;IAChD,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AA4BD,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,EAAE,kBAAkB,+BAiKhG;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,QAO/E;AAYD,+EAA+E;AAC/E,wBAAgB,QAAQ,YAlNoB,MAAM,YAAY,YAAY,KAAK,MAAM,CAsNpF"}