@rinzai/zen 0.6.0 → 0.6.1

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.
@@ -1,74 +1,71 @@
1
1
  "use client";
2
2
  import { cx as e } from "../utils/cx.js";
3
- import { useAnchoredPopup as t } from "../utils/useAnchoredPopup.js";
4
- import n from "../badge/index.js";
5
- import r from "../button/index.js";
6
- import { POPUP as i, TRIGGER as a } from "../utils/styles.js";
7
- import o from "../collapse/index.js";
8
- import { CheckIcon as s } from "../utils/status-icons.js";
9
- import { useField as c } from "../field/index.js";
10
- import l from "../icons/search.js";
11
- import u from "../icons/x-mark.js";
12
- import { InputGroupAddon as d, InputGroupInput as f } from "../input-group/index.js";
13
- import { FieldChevron as p } from "../utils/field-chevron.js";
14
- import { useVirtualList as m } from "../utils/useVirtualList.js";
15
- import { createContext as h, useContext as g, useEffect as _, useMemo as v, useRef as y, useState as b } from "react";
16
- import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
3
+ import { anchoredStyle as t, useAnchoredPopup as n } from "../utils/useAnchoredPopup.js";
4
+ import r from "../badge/index.js";
5
+ import i from "../button/index.js";
6
+ import { POPUP as a, TRIGGER as o } from "../utils/styles.js";
7
+ import s from "../collapse/index.js";
8
+ import { CheckIcon as c } from "../utils/status-icons.js";
9
+ import { useField as l } from "../field/index.js";
10
+ import u from "../icons/search.js";
11
+ import d from "../icons/x-mark.js";
12
+ import { InputGroupAddon as f, InputGroupInput as p } from "../input-group/index.js";
13
+ import { FieldChevron as m } from "../utils/field-chevron.js";
14
+ import { useVirtualList as h } from "../utils/useVirtualList.js";
15
+ import { createContext as g, useContext as _, useEffect as v, useMemo as y, useRef as b, useState as x } from "react";
16
+ import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
17
17
  //#region packages/combobox/index.tsx
18
- var w = h(null), T = () => {
19
- let e = g(w);
18
+ var T = g(null), E = () => {
19
+ let e = _(T);
20
20
  if (!e) throw Error("Combobox parts must be inside a Combobox");
21
21
  return e;
22
22
  };
23
- function E(e) {
24
- let { items: n, itemKey: r = (e) => e.key, itemText: i = (e) => e.text, filter: a = (e, t) => i(e).toLowerCase().includes(t.toLowerCase()), selectedItems: o = [], children: s } = e, c = e.multiple === !0, l = c ? e.value : e.value === null ? [] : [e.value], [u, d] = b(""), [f, p] = b(null), m = y(null), h = y(null), g = y(null), _ = y(35), x = v(() => u ? n.filter((e) => a(e, u)) : n, [
25
- n,
23
+ function D(e) {
24
+ let { items: t, itemKey: r = (e) => e.key, itemText: i = (e) => e.text, filter: a = (e, t) => i(e).toLowerCase().includes(t.toLowerCase()), selectedItems: o = [], children: s } = e, c = e.multiple === !0, l = c ? e.value : e.value === null ? [] : [e.value], [u, d] = x(""), [f, p] = x(null), m = b(null), h = b(null), g = b(null), _ = b(35), v = y(() => u ? t.filter((e) => a(e, u)) : t, [
25
+ t,
26
26
  u,
27
27
  a
28
- ]), C = t({
29
- offset: 5,
30
- onOpenChange: (e) => {
31
- e || (p(null), d(""), C.popupRef.current?.contains(document.activeElement) && h.current?.focus());
32
- }
33
- }), T = {
28
+ ]), S = n({ onOpenChange: (e) => {
29
+ e || (p(null), d(""), S.popupRef.current?.contains(document.activeElement) && h.current?.focus());
30
+ } }), w = {
34
31
  multiple: c,
35
32
  keyOf: r,
36
33
  textOf: i,
37
- items: n,
34
+ items: t,
38
35
  selectedItems: o,
39
- matches: x,
36
+ matches: v,
40
37
  chosen: l,
41
38
  toggle: (t) => {
42
39
  if (e.multiple === !0) {
43
40
  let n = e.value.includes(t);
44
41
  e.onValueChange(n ? e.value.filter((e) => e !== t) : [...e.value, t]);
45
- } else e.onValueChange(t), C.setOpen(!1);
42
+ } else e.onValueChange(t), S.setOpen(!1);
46
43
  },
47
44
  query: u,
48
45
  setQuery: d,
49
46
  active: f,
50
47
  setActive: p,
51
48
  create: m,
52
- popup: C,
49
+ popup: S,
53
50
  triggerRef: h,
54
51
  listRef: g,
55
- optionId: (e) => `${C.id}-option-${e}`,
52
+ optionId: (e) => `${S.id}-option-${e}`,
56
53
  itemHeight: _
57
54
  };
58
- return /* @__PURE__ */ S(w.Provider, {
59
- value: T,
55
+ return /* @__PURE__ */ C(T.Provider, {
56
+ value: w,
60
57
  children: s
61
58
  });
62
59
  }
63
- function D({ placeholder: t = "Select an Item", disabled: n, className: r, style: i, children: o, ...s }) {
64
- let l = T(), { popup: u } = l, d = c(), f = y(!1), m = () => !n && u.setOpen(!0);
65
- return /* @__PURE__ */ C("div", {
60
+ function O({ placeholder: t = "Select an Item", disabled: n, className: r, style: i, children: a, ...s }) {
61
+ let c = E(), { popup: u } = c, d = l(), f = b(!1), p = () => !n && u.setOpen(!0);
62
+ return /* @__PURE__ */ w("div", {
66
63
  id: d?.id,
67
64
  "aria-labelledby": s["aria-label"] ? void 0 : d?.labelId,
68
65
  "aria-invalid": d?.["aria-invalid"],
69
66
  ...s,
70
67
  "aria-describedby": e(d?.["aria-describedby"], s["aria-describedby"]).trim() || void 0,
71
- ref: l.triggerRef,
68
+ ref: c.triggerRef,
72
69
  role: "combobox",
73
70
  tabIndex: n ? -1 : 0,
74
71
  "aria-haspopup": "listbox",
@@ -76,6 +73,7 @@ function D({ placeholder: t = "Select an Item", disabled: n, className: r, style
76
73
  "aria-controls": u.id,
77
74
  "aria-disabled": n || void 0,
78
75
  "data-popup-open": u.triggerProps["data-popup-open"],
76
+ "data-zen-anchor": u.triggerProps["data-zen-anchor"],
79
77
  style: {
80
78
  ...u.triggerProps.style,
81
79
  ...i
@@ -84,40 +82,40 @@ function D({ placeholder: t = "Select an Item", disabled: n, className: r, style
84
82
  s.onPointerDown?.(e), f.current = u.open;
85
83
  },
86
84
  onClick: (e) => {
87
- s.onClick?.(e), e.preventDefault(), f.current ? u.setOpen(!1) : m(), f.current = !1;
85
+ s.onClick?.(e), e.preventDefault(), f.current ? u.setOpen(!1) : p(), f.current = !1;
88
86
  },
89
87
  onKeyDown: (e) => {
90
88
  s.onKeyDown?.(e), [
91
89
  "Enter",
92
90
  " ",
93
91
  "ArrowDown"
94
- ].includes(e.key) && (e.preventDefault(), m());
92
+ ].includes(e.key) && (e.preventDefault(), p());
95
93
  },
96
- className: e(a, "w-56 shrink-0", n ? "cursor-not-allowed opacity-50" : "cursor-pointer", u.open && "border-glow/60 [--glow-border-color:transparent] shadow-[0_0_0_3px_oklch(var(--glow)/0.16),0_0_24px_-6px_oklch(var(--glow)/0.6)]", r),
97
- children: [/* @__PURE__ */ S("div", {
94
+ className: e(o, "w-56 shrink-0", n ? "cursor-not-allowed opacity-50" : "cursor-pointer", u.open && "border-glow/60 [--glow-border-color:transparent] shadow-[0_0_0_3px_oklch(var(--glow)/0.16),0_0_24px_-6px_oklch(var(--glow)/0.6)]", r),
95
+ children: [/* @__PURE__ */ C("div", {
98
96
  className: e("flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm", n ? "text-muted-foreground" : "text-foreground"),
99
- children: o ?? /* @__PURE__ */ S(O, { placeholder: t })
100
- }), /* @__PURE__ */ S(p, { open: u.open })]
97
+ children: a ?? /* @__PURE__ */ C(k, { placeholder: t })
98
+ }), /* @__PURE__ */ C(m, { open: u.open })]
101
99
  });
102
100
  }
103
- function O({ placeholder: e }) {
104
- let t = T(), i = new Map([...t.selectedItems, ...t.items].map((e) => [t.keyOf(e), e])), a = t.chosen.flatMap((e) => {
105
- let n = i.has(e) ? t.textOf(i.get(e)) : void 0;
106
- return n ? [{
101
+ function k({ placeholder: e }) {
102
+ let t = E(), n = new Map([...t.selectedItems, ...t.items].map((e) => [t.keyOf(e), e])), a = t.chosen.flatMap((e) => {
103
+ let r = n.has(e) ? t.textOf(n.get(e)) : void 0;
104
+ return r ? [{
107
105
  key: e,
108
- text: n
106
+ text: r
109
107
  }] : [];
110
108
  });
111
- return a.length ? t.multiple ? /* @__PURE__ */ S(o, {
109
+ return a.length ? t.multiple ? /* @__PURE__ */ C(s, {
112
110
  items: a.map((e) => e.text),
113
111
  data: a,
114
112
  badgeVariant: "secondary",
115
113
  badgeClassName: "h-6 min-w-min gap-2",
116
114
  className: "w-full gap-1",
117
- children: (e, i, a) => /* @__PURE__ */ C(n, {
115
+ children: (e, n, a) => /* @__PURE__ */ w(r, {
118
116
  className: "flex h-6 min-w-min gap-2 pr-1",
119
117
  variant: "secondary",
120
- children: [e, /* @__PURE__ */ S(r, {
118
+ children: [e, /* @__PURE__ */ C(i, {
121
119
  "aria-label": `Remove ${e}`,
122
120
  onClick: (e) => {
123
121
  e.stopPropagation(), a && t.toggle(a.key);
@@ -125,34 +123,38 @@ function O({ placeholder: e }) {
125
123
  variant: "icon",
126
124
  size: "icon",
127
125
  className: "group relative -top-px size-4 rounded-sm p-0.5",
128
- children: /* @__PURE__ */ S(u, { className: "size-3 transition duration-300 group-hover:rotate-90" })
126
+ children: /* @__PURE__ */ C(d, { className: "size-3 transition duration-300 group-hover:rotate-90" })
129
127
  })]
130
- }, a?.key ?? i)
131
- }) : /* @__PURE__ */ S(x, { children: a[0].text }) : /* @__PURE__ */ S("span", {
128
+ }, a?.key ?? n)
129
+ }) : /* @__PURE__ */ C(S, { children: a[0].text }) : /* @__PURE__ */ C("span", {
132
130
  className: t.multiple ? "text-muted-foreground" : void 0,
133
131
  children: e
134
132
  });
135
133
  }
136
- function k({ className: t, children: n }) {
137
- let { popup: r } = T();
138
- return /* @__PURE__ */ S("div", {
139
- ...r.popupProps,
140
- className: e("zen__popover", i, "w-[anchor-size(width)] min-w-0 overflow-visible p-0", t),
141
- children: /* @__PURE__ */ S("div", {
134
+ function A({ className: n, children: r }) {
135
+ let { popup: i } = E();
136
+ return /* @__PURE__ */ C("div", {
137
+ ...i.popupProps,
138
+ style: t(i.id, {
139
+ offset: 5,
140
+ width: "match"
141
+ }),
142
+ className: e("zen__popover", a, "overflow-visible p-0", n),
143
+ children: /* @__PURE__ */ C("div", {
142
144
  className: "divide-tint/10 flex w-full flex-col divide-y overflow-hidden rounded-xl",
143
- children: n
145
+ children: r
144
146
  })
145
147
  });
146
148
  }
147
- function A({ placeholder: e = "Search", "aria-label": t = "Search options" }) {
148
- let n = T(), r = y(null);
149
- _(() => {
149
+ function j({ placeholder: e = "Search", "aria-label": t = "Search options" }) {
150
+ let n = E(), r = b(null);
151
+ v(() => {
150
152
  n.popup.open && r.current?.focus();
151
153
  }, [n.popup.open]);
152
154
  let i = n.matches.map(n.keyOf);
153
- return /* @__PURE__ */ C("div", {
155
+ return /* @__PURE__ */ w("div", {
154
156
  className: "flex h-10 grow items-center gap-2 px-3",
155
- children: [/* @__PURE__ */ S(d, { children: /* @__PURE__ */ S(l, {}) }), /* @__PURE__ */ S(f, {
157
+ children: [/* @__PURE__ */ C(f, { children: /* @__PURE__ */ C(u, {}) }), /* @__PURE__ */ C(p, {
156
158
  ref: r,
157
159
  placeholder: e,
158
160
  "aria-label": t,
@@ -166,35 +168,35 @@ function A({ placeholder: e = "Search", "aria-label": t = "Search options" }) {
166
168
  let t = n.active === null ? -1 : i.indexOf(n.active), r = (t) => {
167
169
  if (e.preventDefault(), !i.length) return;
168
170
  let r = i[(t + i.length) % i.length];
169
- n.setActive(r), j(n.listRef.current, i.indexOf(r), n.itemHeight.current);
171
+ n.setActive(r), M(n.listRef.current, i.indexOf(r), n.itemHeight.current);
170
172
  };
171
173
  e.key === "ArrowDown" ? r(t + 1) : e.key === "ArrowUp" ? r(t === -1 ? i.length - 1 : t - 1) : e.key === "Enter" && (e.preventDefault(), n.active === null ? !i.length && n.query && n.create.current && (n.create.current(n.query), n.setQuery("")) : n.toggle(n.active));
172
174
  }
173
175
  })]
174
176
  });
175
177
  }
176
- var j = (e, t, n) => {
178
+ var M = (e, t, n) => {
177
179
  if (!e || t < 0) return;
178
180
  let r = t * n;
179
181
  r < e.scrollTop ? e.scrollTop = r : r + n > e.scrollTop + e.clientHeight && (e.scrollTop = r + n - e.clientHeight);
180
- }, M = h(null);
181
- function N({ renderItem: e, itemHeight: t = 35, children: n }) {
182
- let r = T();
182
+ }, N = g(null);
183
+ function P({ renderItem: e, itemHeight: t = 35, children: n }) {
184
+ let r = E();
183
185
  r.itemHeight.current = t;
184
- let i = m({
186
+ let i = h({
185
187
  count: r.matches.length,
186
188
  itemHeight: t,
187
189
  scrollRef: r.listRef
188
190
  });
189
- return _(() => {
191
+ return v(() => {
190
192
  r.listRef.current && (r.listRef.current.scrollTop = 0);
191
- }, [r.query, r.listRef]), /* @__PURE__ */ C("ul", {
193
+ }, [r.query, r.listRef]), /* @__PURE__ */ w("ul", {
192
194
  id: `${r.popup.id}-list`,
193
195
  role: "listbox",
194
196
  "aria-multiselectable": r.multiple || void 0,
195
197
  className: "max-h-72 grow overflow-y-auto py-1 focus:ring-0 focus:outline-hidden",
196
198
  ref: r.listRef,
197
- children: [/* @__PURE__ */ S("div", {
199
+ children: [/* @__PURE__ */ C("div", {
198
200
  style: {
199
201
  height: `${i.totalSize}px`,
200
202
  width: "100%",
@@ -202,23 +204,23 @@ function N({ renderItem: e, itemHeight: t = 35, children: n }) {
202
204
  },
203
205
  children: i.items.map((t) => {
204
206
  let n = r.matches[t.index];
205
- return /* @__PURE__ */ S(M.Provider, {
207
+ return /* @__PURE__ */ C(N.Provider, {
206
208
  value: {
207
209
  start: t.start,
208
210
  size: t.size
209
211
  },
210
- children: e ? e(n) : /* @__PURE__ */ S(P, { item: n })
212
+ children: e ? e(n) : /* @__PURE__ */ C(F, { item: n })
211
213
  }, r.keyOf(n));
212
214
  })
213
215
  }), n]
214
216
  });
215
217
  }
216
- function P({ item: t, className: n, children: r }) {
217
- let i = T(), a = g(M), o = i.keyOf(t), c = i.chosen.includes(o);
218
- return /* @__PURE__ */ C("li", {
218
+ function F({ item: t, className: n, children: r }) {
219
+ let i = E(), a = _(N), o = i.keyOf(t), s = i.chosen.includes(o);
220
+ return /* @__PURE__ */ w("li", {
219
221
  id: i.optionId(o),
220
222
  role: "option",
221
- "aria-selected": c,
223
+ "aria-selected": s,
222
224
  "data-highlighted": i.active === o || void 0,
223
225
  style: a ? {
224
226
  height: `${a.size}px`,
@@ -227,28 +229,28 @@ function P({ item: t, className: n, children: r }) {
227
229
  onMouseMove: () => i.active !== o && i.setActive(o),
228
230
  onClick: () => i.toggle(o),
229
231
  className: e("hover:bg-muted data-highlighted:bg-muted grid w-full cursor-pointer grid-cols-[1rem_1fr] items-center gap-2 px-3 py-2 text-sm outline-hidden select-none", a && "absolute top-0 left-0", n),
230
- children: [/* @__PURE__ */ S("span", {
232
+ children: [/* @__PURE__ */ C("span", {
231
233
  className: "text-primary col-start-1",
232
234
  "aria-hidden": !0,
233
- children: c && /* @__PURE__ */ S(s, {})
234
- }), /* @__PURE__ */ S("span", {
235
+ children: s && /* @__PURE__ */ C(c, {})
236
+ }), /* @__PURE__ */ C("span", {
235
237
  className: "col-start-2 truncate",
236
238
  children: r ?? i.textOf(t)
237
239
  })]
238
240
  });
239
241
  }
240
- function F({ children: e = "No results found" }) {
241
- let t = T();
242
- return !t.query || t.matches.length ? null : /* @__PURE__ */ S("li", {
242
+ function I({ children: e = "No results found" }) {
243
+ let t = E();
244
+ return !t.query || t.matches.length ? null : /* @__PURE__ */ C("li", {
243
245
  className: "text-muted-foreground cursor-not-allowed px-3 py-2 text-sm",
244
246
  children: e
245
247
  });
246
248
  }
247
- function I({ onCreate: e, children: t = (e) => `Add ${e}` }) {
248
- let n = T(), { create: r } = n;
249
- return _(() => (r.current = e, () => {
249
+ function L({ onCreate: e, children: t = (e) => `Add ${e}` }) {
250
+ let n = E(), { create: r } = n;
251
+ return v(() => (r.current = e, () => {
250
252
  r.current = null;
251
- }), [r, e]), !n.query || n.matches.length ? null : /* @__PURE__ */ S("li", {
253
+ }), [r, e]), !n.query || n.matches.length ? null : /* @__PURE__ */ C("li", {
252
254
  role: "option",
253
255
  "aria-selected": !1,
254
256
  className: "hover:bg-muted cursor-pointer px-3 py-2 text-sm select-none",
@@ -259,4 +261,4 @@ function I({ onCreate: e, children: t = (e) => `Add ${e}` }) {
259
261
  });
260
262
  }
261
263
  //#endregion
262
- export { I as ComboboxCreate, F as ComboboxEmpty, P as ComboboxItem, N as ComboboxList, k as ComboboxPopup, A as ComboboxSearch, D as ComboboxTrigger, E as default };
264
+ export { L as ComboboxCreate, I as ComboboxEmpty, F as ComboboxItem, P as ComboboxList, A as ComboboxPopup, j as ComboboxSearch, O as ComboboxTrigger, D as default };
@@ -1,11 +1,12 @@
1
- import { ReactNode } from 'react';
1
+ import { ComponentProps, ReactNode } from 'react';
2
2
  /**
3
3
  * A measure against a limit, e.g. spend against a budget: a bar with a label,
4
4
  * a figure and a note. Over the limit it turns red; near it, warm. Announced
5
5
  * as a meter, with `valueText` read out instead of the bare number.
6
6
  */
7
- export default function Meter({ value, max, label, detail, hint, valueText, tone, warnAt, className, }: MeterProps): import('react').JSX.Element;
8
- export interface MeterProps {
7
+ export default function Meter({ value, max, label, detail, hint, valueText, tone, warnAt, className, ...rest }: MeterProps): import('react').JSX.Element;
8
+ /** Also takes the element's own props, e.g. `aria-label` when there's no visible label. */
9
+ export interface MeterProps extends Omit<ComponentProps<'div'>, 'children'> {
9
10
  value: number;
10
11
  /** The limit (default 100). Values past it fill the bar and turn it red. */
11
12
  max?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/meter/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAS,MAAM,OAAO,CAAC;AAEzC;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC1B,KAAK,EACL,GAAS,EACT,KAAK,EACL,MAAM,EACN,IAAI,EACJ,SAAS,EACT,IAAa,EACb,MAAa,EACb,SAAS,GACZ,EAAE,UAAU,+BAwDZ;AAED,MAAM,WAAW,UAAU;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,0CAA0C;IAC1C,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,yCAAyC;IACzC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,oFAAoF;IACpF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IACjD,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/meter/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAS,MAAM,OAAO,CAAC;AAEzD;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC1B,KAAK,EACL,GAAS,EACT,KAAK,EACL,MAAM,EACN,IAAI,EACJ,SAAS,EACT,IAAa,EACb,MAAa,EACb,SAAS,EACT,GAAG,IAAI,EACV,EAAE,UAAU,+BAyDZ;AAED,2FAA2F;AAC3F,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IACvE,KAAK,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,0CAA0C;IAC1C,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,yCAAyC;IACzC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,oFAAoF;IACpF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IACjD,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB"}
@@ -3,11 +3,12 @@ import { cx as e } from "../utils/cx.js";
3
3
  import { useId as t } from "react";
4
4
  import { jsx as n, jsxs as r } from "react/jsx-runtime";
5
5
  //#region packages/meter/index.tsx
6
- function i({ value: i, max: a = 100, label: o, detail: s, hint: c, valueText: l, tone: u = "auto", warnAt: d = .85, className: f }) {
7
- let p = t(), m = i > a, h = a > 0 ? i / a : +(i > 0), g = Math.min(100, Math.max(0, Math.round(h * 100))), _ = u === "auto" ? m ? "danger" : h >= d ? "warning" : "default" : u;
6
+ function i({ value: i, max: a = 100, label: o, detail: s, hint: c, valueText: l, tone: u = "auto", warnAt: d = .85, className: f, ...p }) {
7
+ let m = t(), h = i > a, g = a > 0 ? i / a : +(i > 0), _ = Math.min(100, Math.max(0, Math.round(g * 100))), v = u === "auto" ? h ? "danger" : g >= d ? "warning" : "default" : u;
8
8
  return /* @__PURE__ */ r("div", {
9
+ ...p,
9
10
  role: "meter",
10
- "aria-labelledby": o ? p : void 0,
11
+ "aria-labelledby": o ? m : p["aria-labelledby"],
11
12
  "aria-valuemin": 0,
12
13
  "aria-valuemax": a,
13
14
  "aria-valuenow": Math.min(i, a),
@@ -15,23 +16,23 @@ function i({ value: i, max: a = 100, label: o, detail: s, hint: c, valueText: l,
15
16
  className: e("zen__meter grid grid-cols-2 gap-y-1.5", f),
16
17
  children: [
17
18
  o && /* @__PURE__ */ n("span", {
18
- id: p,
19
+ id: m,
19
20
  className: "text-sm font-medium",
20
21
  children: o
21
22
  }),
22
23
  s && /* @__PURE__ */ n("span", {
23
- className: e("col-start-2 text-right text-sm tabular-nums", _ === "danger" ? "text-destructive" : "text-muted-foreground"),
24
+ className: e("col-start-2 text-right text-sm tabular-nums", v === "danger" ? "text-destructive" : "text-muted-foreground"),
24
25
  children: s
25
26
  }),
26
27
  /* @__PURE__ */ n("div", {
27
28
  className: "bg-muted col-span-2 h-2 overflow-hidden rounded-full",
28
29
  children: /* @__PURE__ */ n("div", {
29
- className: e("h-full rounded-full transition-[width] duration-700 ease-[cubic-bezier(0.2,0.8,0.2,1)]", _ === "danger" ? "bg-destructive shadow-[0_0_12px_oklch(var(--destructive)/0.7)]" : _ === "warning" ? "bg-accent-foreground shadow-[0_0_12px_oklch(var(--accent-foreground)/0.6)]" : "from-primary to-glow-2 bg-gradient-to-r shadow-[0_0_12px_oklch(var(--glow)/0.6)]"),
30
- style: { width: `${g}%` }
30
+ className: e("h-full rounded-full transition-[width] duration-700 ease-[cubic-bezier(0.2,0.8,0.2,1)]", v === "danger" ? "bg-destructive shadow-[0_0_12px_oklch(var(--destructive)/0.7)]" : v === "warning" ? "bg-accent-foreground shadow-[0_0_12px_oklch(var(--accent-foreground)/0.6)]" : "from-primary to-glow-2 bg-gradient-to-r shadow-[0_0_12px_oklch(var(--glow)/0.6)]"),
31
+ style: { width: `${_}%` }
31
32
  })
32
33
  }),
33
34
  c && /* @__PURE__ */ n("span", {
34
- className: e("col-span-2 text-xs", _ === "danger" ? "text-destructive" : "text-muted-foreground"),
35
+ className: e("col-span-2 text-xs", v === "danger" ? "text-destructive" : "text-muted-foreground"),
35
36
  children: c
36
37
  })
37
38
  ]
@@ -1,6 +1,6 @@
1
1
  import { ForeignAmount, RateTable } from '../utils/fx';
2
2
  import { Money } from '../utils/money';
3
- import { ChangeEvent, KeyboardEvent, ReactNode } from 'react';
3
+ import { ChangeEvent, ComponentProps, KeyboardEvent, ReactNode } from 'react';
4
4
  /**
5
5
  * Amount input in one currency. Shows grouped digits for the locale (1,52,000
6
6
  * for en-IN) and accepts shorthand: 1.5L, 2cr, 10k, 1.2m. Commits on blur or
@@ -12,7 +12,7 @@ import { ChangeEvent, KeyboardEvent, ReactNode } from 'react';
12
12
  * never sent anywhere). Replace the symbol with `start`, or build your own field
13
13
  * from useMoneyInput, MoneyCurrencyMenu and MoneyConversionHint.
14
14
  */
15
- export default function MoneyInput({ start, end, compact, disabled, id, autoFocus, className, 'aria-label': ariaLabel, ...options }: MoneyInputProps): import('react').JSX.Element;
15
+ export default function MoneyInput({ value, onChange, currency, locale, allowNegative, allowEmpty, live, onCancel, convert, start, end, compact, disabled, className, onFocus, onBlur, onKeyDown, 'aria-describedby': describedBy, ...input }: MoneyInputProps): import('react').JSX.Element;
16
16
  /**
17
17
  * The currency switch for a converting field (`convert`): shows the symbol, or
18
18
  * the code of the foreign currency being typed in, and opens a menu of your
@@ -123,18 +123,17 @@ export interface MoneyInputOptions {
123
123
  /** Let people type in another currency, converted at the rates you load. */
124
124
  convert?: CurrencyConversion;
125
125
  }
126
- export interface MoneyInputProps extends MoneyInputOptions {
126
+ /**
127
+ * Also takes the input's own props (placeholder, name, aria-*, onBlur…), except
128
+ * the value and its typing, which MoneyInput runs. className goes on the wrapper.
129
+ */
130
+ export interface MoneyInputProps extends MoneyInputOptions, Omit<ComponentProps<'input'>, keyof MoneyInputOptions | 'defaultValue' | 'type' | 'inputMode' | 'children'> {
127
131
  /** Replaces the currency symbol (or the currency switch), e.g. with your own. */
128
132
  start?: ReactNode;
129
133
  /** Content after the input, e.g. a unit or a clear button. */
130
134
  end?: ReactNode;
131
135
  /** Smaller, for editing inside table rows. */
132
136
  compact?: boolean;
133
- disabled?: boolean;
134
- id?: string;
135
- autoFocus?: boolean;
136
- className?: string;
137
- 'aria-label'?: string;
138
137
  }
139
138
  export {};
140
139
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/money-input/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAgB,KAAK,aAAa,EAAe,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAC9F,OAAO,EAA0D,KAAK,KAAK,EAAmB,MAAM,kBAAkB,CAAC;AAEvH,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,SAAS,EAAsC,MAAM,OAAO,CAAC;AAElG;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAC/B,KAAK,EACL,GAAG,EACH,OAAe,EACf,QAAgB,EAChB,EAAE,EACF,SAAS,EACT,SAAS,EACT,YAAY,EAAE,SAAS,EACvB,GAAG,OAAO,EACb,EAAE,eAAe,+BA0CjB;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AAK,CAAC,EAAE,SAAS,CAAC;IAClB,8DAA8D;IAC9D,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,8CAA8C;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB"}
@@ -10,36 +10,54 @@ import { convertMinor as v, rateBetween as y } from "../utils/fx.js";
10
10
  import { useEffect as b, useId as x, useRef as S, useState as C } from "react";
11
11
  import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
12
12
  //#region packages/money-input/index.tsx
13
- function D({ start: t, end: n, compact: r = !1, disabled: i = !1, id: a, autoFocus: o, className: s, "aria-label": c, ...l }) {
14
- let u = A(l), d = !!u.conversion?.foreign;
13
+ function D({ value: t, onChange: n, currency: r, locale: i, allowNegative: a, allowEmpty: o, live: s, onCancel: c, convert: l, start: u, end: d, compact: p = !1, disabled: _ = !1, className: v, onFocus: y, onBlur: b, onKeyDown: x, "aria-describedby": S, ...C }) {
14
+ let w = A({
15
+ value: t,
16
+ onChange: n,
17
+ currency: r,
18
+ locale: i,
19
+ allowNegative: a,
20
+ allowEmpty: o,
21
+ live: s,
22
+ onCancel: c,
23
+ convert: l
24
+ }), D = !!w.conversion?.foreign;
15
25
  return /* @__PURE__ */ E("div", {
16
- className: e("zen__money-input flex flex-col gap-1", s),
26
+ className: e("zen__money-input flex flex-col gap-1", v),
17
27
  children: [/* @__PURE__ */ E(m, {
18
- invalid: !!u.error,
19
- "data-foreign": d || void 0,
20
- className: e(r && "h-7", "data-foreign:border-primary/50"),
28
+ invalid: !!w.error,
29
+ "data-foreign": D || void 0,
30
+ className: e(p && "h-7", "data-foreign:border-primary/50"),
21
31
  children: [
22
- t ?? (u.conversion && !i ? /* @__PURE__ */ T(O, { money: u }) : /* @__PURE__ */ T(h, {
32
+ u ?? (w.conversion && !_ ? /* @__PURE__ */ T(O, { money: w }) : /* @__PURE__ */ T(h, {
23
33
  "aria-hidden": !0,
24
34
  "data-slot": "symbol",
25
- children: u.symbol
35
+ children: w.symbol
26
36
  })),
27
37
  /* @__PURE__ */ T(g, {
28
- ...u.inputProps,
29
- id: a,
30
- autoFocus: o,
31
- disabled: i,
32
- "aria-label": c,
33
- className: e("tabular-nums", r ? "text-right" : "text-left")
38
+ ...C,
39
+ ...w.inputProps,
40
+ onFocus: (e) => {
41
+ w.inputProps.onFocus(), y?.(e);
42
+ },
43
+ onBlur: (e) => {
44
+ w.inputProps.onBlur(), b?.(e);
45
+ },
46
+ onKeyDown: (e) => {
47
+ w.inputProps.onKeyDown(e), x?.(e);
48
+ },
49
+ "aria-describedby": e(w.inputProps["aria-describedby"], S) || void 0,
50
+ disabled: _,
51
+ className: e("tabular-nums", p ? "text-right" : "text-left")
34
52
  }),
35
- n
53
+ d
36
54
  ]
37
- }), u.error ? /* @__PURE__ */ E("p", {
38
- id: u.errorId,
55
+ }), w.error ? /* @__PURE__ */ E("p", {
56
+ id: w.errorId,
39
57
  role: "alert",
40
58
  className: "text-destructive mt-0! flex items-center gap-1.5 text-xs font-medium",
41
- children: [/* @__PURE__ */ T(f, { className: "shrink-0" }), u.error]
42
- }) : /* @__PURE__ */ T(k, { money: u })]
59
+ children: [/* @__PURE__ */ T(f, { className: "shrink-0" }), w.error]
60
+ }) : /* @__PURE__ */ T(k, { money: w })]
43
61
  });
44
62
  }
45
63
  function O({ money: s, className: c }) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/popover/index.tsx"],"names":[],"mappings":"AAAA,OAAe,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAMlD,OAAO,EAAE,cAAc,EAA6B,SAAS,EAAyB,MAAM,OAAO,CAAC;AAYpG;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAAE,IAAI,EAAE,WAAmB,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,YAAY,+BAclG;AAED,6GAA6G;AAC7G,wBAAgB,cAAc,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,G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,EAAE,GAAG,IAAI,EAAE,EAAE,mBAAmB,+BAcxF;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAC3B,KAAgB,EAChB,MAAU,EACV,SAAS,EACT,KAAK,EACL,QAAQ,EACR,GAAG,IAAI,EACV,EAAE,mBAAmB,+BAarB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,WAAW,+BAW7D;AAED,MAAM,WAAW,YAAY;IACzB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,kCAAkC;IAClC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,+EAA+E;IAC/E,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACxB;AAED,MAAM,WAAW,mBAAoB,SAAQ,cAAc,CAAC,QAAQ,CAAC;IACjE,mFAAmF;IACnF,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,mBAAoB,SAAQ,cAAc,CAAC,KAAK,CAAC;IAC9D,gFAAgF;IAChF,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;IACnC,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB"}
@@ -54,11 +54,12 @@ function h({ align: t = "center", offset: n = 5, className: i, style: a, childre
54
54
  style: {
55
55
  ...r(l.id, {
56
56
  align: t,
57
- offset: n
57
+ offset: n,
58
+ width: "at-least"
58
59
  }),
59
60
  ...a
60
61
  },
61
- className: e("zen__popover fixed z-50 w-[anchor-size(width)] min-w-max overflow-visible p-0", o, i),
62
+ className: e("zen__popover fixed z-50 overflow-visible p-0", o, i),
62
63
  children: s
63
64
  });
64
65
  }
package/dist/theme.css CHANGED
@@ -205,14 +205,25 @@
205
205
 
206
206
  /*
207
207
  * Built from Tailwind's backdrop utilities, which emit the standard and -webkit-
208
- * properties correctly. Phones: a live blur over scrolling content is the main
209
- * cause of jank, so touch screens get a solid tint instead.
208
+ * properties correctly. Where there's no live blur, the surface is solid: a
209
+ * translucent one lets sharp text behind show through (the blur is what hides
210
+ * it). No blur on touch screens (a live blur over scrolling content is the main
211
+ * cause of jank), without a GPU (lite graphics) and with the OS's "reduce
212
+ * transparency". The fallbacks live here, in the utilities layer, where a
213
+ * surface's own `!` background (a Dialog's) is: an unlayered !important rule
214
+ * loses to a layered one.
210
215
  */
211
216
  @utility glass-blur {
212
217
  @apply backdrop-blur-[18px] backdrop-saturate-140;
213
- /* !: glass's `background` shorthand would otherwise reset the colour. */
214
- @apply pointer-coarse:bg-card/96! pointer-coarse:backdrop-filter-none;
215
- @apply [@media(hover:none)]:bg-card/96! [@media(hover:none)]:backdrop-filter-none;
218
+ /*
219
+ * !: glass's `background` shorthand would otherwise reset the colour. [:root_&]
220
+ * adds specificity, so each fallback beats a surface's own `!` background (a
221
+ * Dialog's bg-card/90!) whatever order the rules come in.
222
+ */
223
+ @apply pointer-coarse:[:root_&]:bg-card! pointer-coarse:backdrop-filter-none;
224
+ @apply [@media(hover:none)]:[:root_&]:bg-card! [@media(hover:none)]:backdrop-filter-none;
225
+ @apply [@media(prefers-reduced-transparency:reduce)]:[:root_&]:bg-card! [@media(prefers-reduced-transparency:reduce)]:backdrop-filter-none;
226
+ @apply [html[data-zen-graphics='lite']_&]:bg-card! [html[data-zen-graphics='lite']_&]:backdrop-filter-none;
216
227
  }
217
228
 
218
229
  @utility text-glow {
@@ -250,15 +261,10 @@
250
261
  /*
251
262
  * Without hardware acceleration (html[data-zen-graphics='lite'], set by
252
263
  * utils/graphics.ts) every blur, full-screen mask and animation is drawn on the
253
- * CPU each frame. Keep the look, drop the cost: solid tints instead of live
254
- * blur (as on phones), a still backdrop, no pointer light. The OS "reduce
255
- * transparency" setting gets the same tints.
264
+ * CPU each frame. Keep the look, drop the cost: solid surfaces instead of live
265
+ * blur (as on phones; see glass-blur), a still backdrop, no pointer light. The
266
+ * OS "reduce transparency" setting gets the same.
256
267
  */
257
- html[data-zen-graphics='lite'] .glass-blur {
258
- -webkit-backdrop-filter: none !important;
259
- backdrop-filter: none !important;
260
- background: oklch(var(--card) / 0.96) !important;
261
- }
262
268
  html[data-zen-graphics='lite'] .zen__header {
263
269
  -webkit-backdrop-filter: none;
264
270
  backdrop-filter: none;
@@ -276,11 +282,6 @@ html[data-zen-graphics='lite'] :is(.zen-topo--lit, .zen-dots--lit) {
276
282
  display: none;
277
283
  }
278
284
  @media (prefers-reduced-transparency: reduce) {
279
- .glass-blur {
280
- -webkit-backdrop-filter: none !important;
281
- backdrop-filter: none !important;
282
- background: oklch(var(--card) / 0.96) !important;
283
- }
284
285
  .zen__header {
285
286
  -webkit-backdrop-filter: none;
286
287
  backdrop-filter: none;