@cascivo/react 0.7.1 → 0.9.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.
@@ -2,25 +2,25 @@
2
2
 
3
3
  import e from "./date-picker.module.js";
4
4
  import { batch as t, cn as n, createMachine as r, useMachine as i, useSignal as a, useSignalEffect as o, useSignals as s } from "@cascivo/core";
5
- import { builtin as c, currentLocale as l, t as u } from "@cascivo/i18n";
6
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
7
- import { useId as p, useRef as m } from "react";
5
+ import { builtin as c, currentLocale as ee, t as l } from "@cascivo/i18n";
6
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
7
+ import { useId as f, useRef as te } from "react";
8
8
  //#region ../components/src/date-picker/date-picker.tsx
9
- var h = r({
9
+ var p = r({
10
10
  initial: "closed",
11
11
  states: {
12
12
  closed: { on: { OPEN: "open" } },
13
13
  open: { on: { CLOSE: "closed" } }
14
14
  }
15
15
  });
16
- function ee(e) {
16
+ function ne(e) {
17
17
  try {
18
18
  let t = new Intl.Locale(e).weekInfo;
19
19
  if (t) return t.firstDay % 7;
20
20
  } catch {}
21
21
  return 1;
22
22
  }
23
- function g(e, t, n) {
23
+ function m(e, t, n) {
24
24
  let r = new Date(Date.UTC(e, t, 1)), i = new Date(Date.UTC(e, t + 1, 0)), a = (r.getUTCDay() - n + 7) % 7, o = [];
25
25
  for (let e = 0; e < a; e++) o.push(null);
26
26
  for (let n = 1; n <= i.getUTCDate(); n++) o.push(new Date(Date.UTC(e, t, n)));
@@ -29,170 +29,170 @@ function g(e, t, n) {
29
29
  for (let e = 0; e < o.length; e += 7) s.push(o.slice(e, e + 7));
30
30
  return s;
31
31
  }
32
- function _(e, t) {
32
+ function h(e, t) {
33
33
  return new Intl.DateTimeFormat(t).format(e);
34
34
  }
35
- function v(e) {
35
+ function g(e) {
36
36
  return e.toISOString().slice(0, 10);
37
37
  }
38
- function y(e) {
38
+ function _(e) {
39
39
  let [t, n, r] = e.split("-").map(Number);
40
40
  return new Date(Date.UTC(t, n - 1, r));
41
41
  }
42
- function b({ value: r, defaultValue: b, onChange: x, min: S, max: C, clearable: w = !1, label: T, hint: E, error: D, size: O = "md", disabled: k = !1, labels: A, className: j, id: M }) {
42
+ function v({ value: r, defaultValue: v, onValueChange: y, onChange: b, min: x, max: S, clearable: C = !1, label: w, hint: T, error: E, size: D = "md", disabled: O = !1, labels: k, className: re, id: A }) {
43
43
  s();
44
- let [N, P] = i(h), F = p(), I = M ?? `cascade-date-picker-${F}`, L = `${F}-grid`, R = l(), z = A?.placeholder ?? u(c.datePicker.placeholder), te = A?.previousMonth ?? u(c.datePicker.previousMonth), ne = A?.nextMonth ?? u(c.datePicker.nextMonth), B = A?.clear ?? u(c.datePicker.clear), V = /* @__PURE__ */ new Date(), H = v(V), U = a(r ?? b);
45
- r !== void 0 && (U.value = r);
46
- let W = a(U.value ? y(U.value).getUTCFullYear() : V.getUTCFullYear()), G = a(U.value ? y(U.value).getUTCMonth() : V.getUTCMonth()), K = a(U.value), q = m(null);
44
+ let [j, M] = i(p), N = f(), P = A ?? `cascade-date-picker-${N}`, F = `${N}-grid`, I = ee(), ie = k?.placeholder ?? l(c.datePicker.placeholder), ae = k?.previousMonth ?? l(c.datePicker.previousMonth), L = k?.nextMonth ?? l(c.datePicker.nextMonth), R = k?.clear ?? l(c.datePicker.clear), z = /* @__PURE__ */ new Date(), B = g(z), V = a(r ?? v);
45
+ r !== void 0 && (V.value = r);
46
+ let H = a(V.value ? _(V.value).getUTCFullYear() : z.getUTCFullYear()), U = a(V.value ? _(V.value).getUTCMonth() : z.getUTCMonth()), W = a(V.value), G = te(null);
47
47
  o(() => {
48
- if (N.value !== "open") return;
48
+ if (j.value !== "open") return;
49
49
  let e = (e) => {
50
- q.current && !q.current.contains(e.target) && P("CLOSE");
50
+ G.current && !G.current.contains(e.target) && M("CLOSE");
51
51
  };
52
52
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
53
53
  });
54
- let J = () => {
55
- k || P("OPEN");
56
- }, Y = () => P("CLOSE"), X = (e) => {
57
- S && e < S || C && e > C || (r === void 0 && (U.value = e), x?.(e), Y());
58
- }, re = (e) => {
59
- e.stopPropagation(), r === void 0 && (U.value = void 0), x?.(void 0);
60
- }, ie = () => {
61
- G.value === 0 ? t(() => {
62
- W.value--, G.value = 11;
63
- }) : G.value--;
64
- }, ae = () => {
65
- G.value === 11 ? t(() => {
66
- W.value++, G.value = 0;
67
- }) : G.value++;
68
- }, Z = ee(R), oe = g(W.value, G.value, Z), se = new Intl.DateTimeFormat(R, { weekday: "short" }), ce = Array.from({ length: 7 }, (e, t) => {
69
- let n = new Date(Date.UTC(2024, 0, 7 + Z + t));
70
- return se.format(n);
71
- }), Q = new Intl.DateTimeFormat(R, {
54
+ let K = () => {
55
+ O || M("OPEN");
56
+ }, q = () => M("CLOSE"), J = y ?? b, Y = (e) => {
57
+ x && e < x || S && e > S || (r === void 0 && (V.value = e), J?.(e), q());
58
+ }, oe = (e) => {
59
+ e.stopPropagation(), r === void 0 && (V.value = void 0), J?.(void 0);
60
+ }, se = () => {
61
+ U.value === 0 ? t(() => {
62
+ H.value--, U.value = 11;
63
+ }) : U.value--;
64
+ }, ce = () => {
65
+ U.value === 11 ? t(() => {
66
+ H.value++, U.value = 0;
67
+ }) : U.value++;
68
+ }, X = ne(I), Z = m(H.value, U.value, X), le = new Intl.DateTimeFormat(I, { weekday: "short" }), ue = Array.from({ length: 7 }, (e, t) => {
69
+ let n = new Date(Date.UTC(2024, 0, 7 + X + t));
70
+ return le.format(n);
71
+ }), Q = new Intl.DateTimeFormat(I, {
72
72
  month: "long",
73
73
  year: "numeric"
74
- }).format(new Date(Date.UTC(W.value, G.value, 1))), le = (e) => {
75
- let n = K.value;
74
+ }).format(new Date(Date.UTC(H.value, U.value, 1))), de = (e) => {
75
+ let n = W.value;
76
76
  if (!n) return;
77
- let r = y(n), i;
77
+ let r = _(n), i;
78
78
  if (e.key === "ArrowRight") i = new Date(Date.UTC(r.getUTCFullYear(), r.getUTCMonth(), r.getUTCDate() + 1));
79
79
  else if (e.key === "ArrowLeft") i = new Date(Date.UTC(r.getUTCFullYear(), r.getUTCMonth(), r.getUTCDate() - 1));
80
80
  else if (e.key === "ArrowDown") i = new Date(Date.UTC(r.getUTCFullYear(), r.getUTCMonth(), r.getUTCDate() + 7));
81
81
  else if (e.key === "ArrowUp") i = new Date(Date.UTC(r.getUTCFullYear(), r.getUTCMonth(), r.getUTCDate() - 7));
82
82
  else if (e.key === "Enter" || e.key === " ") {
83
- e.preventDefault(), X(n);
83
+ e.preventDefault(), Y(n);
84
84
  return;
85
85
  } else if (e.key === "Escape") {
86
- Y();
86
+ q();
87
87
  return;
88
88
  } else return;
89
89
  if (e.preventDefault(), i) {
90
- let e = v(i);
91
- if (S && e < S || C && e > C) return;
92
- K.value = e, t(() => {
93
- W.value = i.getUTCFullYear(), G.value = i.getUTCMonth();
90
+ let e = g(i);
91
+ if (x && e < x || S && e > S) return;
92
+ W.value = e, t(() => {
93
+ H.value = i.getUTCFullYear(), U.value = i.getUTCMonth();
94
94
  });
95
95
  }
96
- }, $ = U.value ? _(y(U.value), R) : "";
97
- return /* @__PURE__ */ f("div", {
98
- ref: q,
99
- className: n(e.wrapper, j),
100
- "data-state": D ? "error" : N.value,
101
- "data-size": O,
96
+ }, $ = V.value ? h(_(V.value), I) : "";
97
+ return /* @__PURE__ */ d("div", {
98
+ ref: G,
99
+ className: n(e.wrapper, re),
100
+ "data-state": E ? "error" : j.value,
101
+ "data-size": D,
102
102
  children: [
103
- T && /* @__PURE__ */ d("label", {
103
+ w && /* @__PURE__ */ u("label", {
104
104
  className: e.label,
105
- htmlFor: I,
106
- children: T
105
+ htmlFor: P,
106
+ children: w
107
107
  }),
108
- /* @__PURE__ */ f("div", {
108
+ /* @__PURE__ */ d("div", {
109
109
  className: e.field,
110
- children: [/* @__PURE__ */ f("button", {
111
- id: I,
110
+ children: [/* @__PURE__ */ d("button", {
111
+ id: P,
112
112
  type: "button",
113
113
  role: "combobox",
114
- "aria-expanded": N.value === "open",
115
- "aria-controls": L,
114
+ "aria-expanded": j.value === "open",
115
+ "aria-controls": F,
116
116
  "aria-haspopup": "dialog",
117
- "aria-invalid": D ? !0 : void 0,
118
- "aria-describedby": D ? `${F}-error` : E ? `${F}-hint` : void 0,
117
+ "aria-invalid": E ? !0 : void 0,
118
+ "aria-describedby": E ? `${N}-error` : T ? `${N}-hint` : void 0,
119
119
  className: e.trigger,
120
- disabled: k,
121
- onClick: N.value === "open" ? Y : J,
122
- children: [/* @__PURE__ */ d("span", {
120
+ disabled: O,
121
+ onClick: j.value === "open" ? q : K,
122
+ children: [/* @__PURE__ */ u("span", {
123
123
  className: n(e.value, $ ? void 0 : e.placeholder),
124
- children: $ || z
125
- }), /* @__PURE__ */ d("span", {
124
+ children: $ || ie
125
+ }), /* @__PURE__ */ u("span", {
126
126
  className: e.icon,
127
127
  "aria-hidden": "true",
128
128
  children: "📅"
129
129
  })]
130
- }), w && U.value !== void 0 && /* @__PURE__ */ d("button", {
130
+ }), C && V.value !== void 0 && /* @__PURE__ */ u("button", {
131
131
  type: "button",
132
132
  className: e.clear,
133
- "aria-label": B,
134
- onClick: re,
133
+ "aria-label": R,
134
+ onClick: oe,
135
135
  children: "✕"
136
136
  })]
137
137
  }),
138
- /* @__PURE__ */ f("div", {
139
- id: L,
138
+ /* @__PURE__ */ d("div", {
139
+ id: F,
140
140
  role: "dialog",
141
141
  "aria-label": Q,
142
142
  className: e.calendar,
143
- "data-state": N.value,
144
- onKeyDown: le,
145
- children: [/* @__PURE__ */ f("div", {
143
+ "data-state": j.value,
144
+ onKeyDown: de,
145
+ children: [/* @__PURE__ */ d("div", {
146
146
  className: e.header,
147
147
  children: [
148
- /* @__PURE__ */ d("button", {
148
+ /* @__PURE__ */ u("button", {
149
149
  type: "button",
150
150
  className: e.navButton,
151
- "aria-label": te,
152
- onClick: ie,
151
+ "aria-label": ae,
152
+ onClick: se,
153
153
  children: "‹"
154
154
  }),
155
- /* @__PURE__ */ d("span", {
155
+ /* @__PURE__ */ u("span", {
156
156
  className: e.monthLabel,
157
157
  "aria-live": "polite",
158
158
  children: Q
159
159
  }),
160
- /* @__PURE__ */ d("button", {
160
+ /* @__PURE__ */ u("button", {
161
161
  type: "button",
162
162
  className: e.navButton,
163
- "aria-label": ne,
164
- onClick: ae,
163
+ "aria-label": L,
164
+ onClick: ce,
165
165
  children: "›"
166
166
  })
167
167
  ]
168
- }), /* @__PURE__ */ f("table", {
168
+ }), /* @__PURE__ */ d("table", {
169
169
  role: "grid",
170
170
  className: e.grid,
171
- children: [/* @__PURE__ */ d("thead", { children: /* @__PURE__ */ d("tr", { children: ce.map((t) => /* @__PURE__ */ d("th", {
171
+ children: [/* @__PURE__ */ u("thead", { children: /* @__PURE__ */ u("tr", { children: ue.map((t) => /* @__PURE__ */ u("th", {
172
172
  className: e.weekday,
173
173
  abbr: t,
174
174
  scope: "col",
175
175
  children: t
176
- }, t)) }) }), /* @__PURE__ */ d("tbody", { children: oe.map((t, n) => /* @__PURE__ */ d("tr", { children: t.map((t, n) => {
177
- if (!t) return /* @__PURE__ */ d("td", { className: e.empty }, n);
178
- let r = v(t), i = r === U.value, a = r === H, o = r === K.value, s = S !== void 0 && r < S || C !== void 0 && r > C;
179
- return /* @__PURE__ */ d("td", {
176
+ }, t)) }) }), /* @__PURE__ */ u("tbody", { children: Z.map((t, n) => /* @__PURE__ */ u("tr", { children: t.map((t, n) => {
177
+ if (!t) return /* @__PURE__ */ u("td", { className: e.empty }, n);
178
+ let r = g(t), i = r === V.value, a = r === B, o = r === W.value, s = x !== void 0 && r < x || S !== void 0 && r > S;
179
+ return /* @__PURE__ */ u("td", {
180
180
  className: e.cell,
181
- children: /* @__PURE__ */ d("button", {
181
+ children: /* @__PURE__ */ u("button", {
182
182
  type: "button",
183
183
  className: e.day,
184
184
  tabIndex: o ? 0 : -1,
185
185
  "aria-pressed": i,
186
- "aria-label": _(t, R),
186
+ "aria-label": h(t, I),
187
187
  "aria-current": a ? "date" : void 0,
188
188
  "aria-disabled": s || void 0,
189
189
  "data-selected": i || void 0,
190
190
  "data-today": a || void 0,
191
191
  onClick: () => {
192
- s || X(r);
192
+ s || Y(r);
193
193
  },
194
194
  onFocus: () => {
195
- K.value = r;
195
+ W.value = r;
196
196
  },
197
197
  children: t.getUTCDate()
198
198
  })
@@ -200,19 +200,19 @@ function b({ value: r, defaultValue: b, onChange: x, min: S, max: C, clearable:
200
200
  }) }, n)) })]
201
201
  })]
202
202
  }),
203
- D && /* @__PURE__ */ d("span", {
204
- id: `${F}-error`,
203
+ E && /* @__PURE__ */ u("span", {
204
+ id: `${N}-error`,
205
205
  className: e.error,
206
206
  role: "alert",
207
- children: D
207
+ children: E
208
208
  }),
209
- !D && E && /* @__PURE__ */ d("span", {
210
- id: `${F}-hint`,
209
+ !E && T && /* @__PURE__ */ u("span", {
210
+ id: `${N}-hint`,
211
211
  className: e.hint,
212
- children: E
212
+ children: T
213
213
  })
214
214
  ]
215
215
  });
216
216
  }
217
217
  //#endregion
218
- export { b as DatePicker };
218
+ export { v as DatePicker };
@@ -4,28 +4,28 @@ import e from "./filter.module.js";
4
4
  import { useControllableSignal as t, useSignals as n } from "@cascivo/core";
5
5
  import { jsx as r } from "react/jsx-runtime";
6
6
  //#region ../components/src/filter/filter.tsx
7
- function i({ options: i, value: a, defaultValue: o = [], onChange: s, multi: c = !1, variant: l = "pill", className: u, ...d }) {
7
+ function i({ options: i, value: a, defaultValue: o = [], onValueChange: s, onChange: c, multi: l = !1, variant: u = "pill", className: d, ...f }) {
8
8
  n();
9
- let [f, p] = t({
9
+ let [p, m] = t({
10
10
  value: a,
11
11
  defaultValue: o,
12
- onChange: s
12
+ onChange: s ?? c
13
13
  });
14
- function m(e) {
15
- let t = f.value, n;
16
- n = c ? t.includes(e) ? t.filter((t) => t !== e) : [...t, e] : t.includes(e) ? [] : [e], p(n);
14
+ function h(e) {
15
+ let t = p.value, n;
16
+ n = l ? t.includes(e) ? t.filter((t) => t !== e) : [...t, e] : t.includes(e) ? [] : [e], m(n);
17
17
  }
18
18
  return /* @__PURE__ */ r("div", {
19
19
  role: "group",
20
- className: [e.filter, u].filter(Boolean).join(" "),
21
- "data-variant": l,
22
- ...d,
20
+ className: [e.filter, d].filter(Boolean).join(" "),
21
+ "data-variant": u,
22
+ ...f,
23
23
  children: i.map((t) => /* @__PURE__ */ r("button", {
24
24
  type: "button",
25
25
  className: e.item,
26
- "data-selected": f.value.includes(t.value) || void 0,
27
- onClick: () => m(t.value),
28
- "aria-pressed": f.value.includes(t.value),
26
+ "data-selected": p.value.includes(t.value) || void 0,
27
+ onClick: () => h(t.value),
28
+ "aria-pressed": p.value.includes(t.value),
29
29
  children: t.label
30
30
  }, t.value))
31
31
  });
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ErrorBoundary, FocusScope, Portal, RovingOrientation, Signal, SuspenseBoundary } from "@cascivo/core";
1
+ import { ErrorBoundary, FocusScope, LinkComponent, LinkComponentProps, Portal, RovingOrientation, Signal, SuspenseBoundary, getLinkComponent, setLinkComponent } from "@cascivo/core";
2
2
  import { AnchorHTMLAttributes, ButtonHTMLAttributes, FormHTMLAttributes, HTMLAttributes, ImgHTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, LiHTMLAttributes, MouseEvent, ReactElement, ReactNode, RefObject, SelectHTMLAttributes, TextareaHTMLAttributes, TimeHTMLAttributes } from "react";
3
3
 
4
4
  interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
@@ -151,6 +151,9 @@ declare function Alert({
151
151
  interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {
152
152
  src?: string;
153
153
  alt?: string;
154
+ /** Full name — used to derive initials for the fallback and as the accessible label. */
155
+ name?: string;
156
+ /** Explicit fallback text (initials/glyph). Overrides initials derived from `name`. */
154
157
  fallback?: string;
155
158
  size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
156
159
  status?: 'online' | 'offline' | 'busy';
@@ -158,6 +161,7 @@ interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {
158
161
  declare function Avatar({
159
162
  src,
160
163
  alt,
164
+ name,
161
165
  fallback,
162
166
  size,
163
167
  status,
@@ -331,6 +335,9 @@ declare function RadioGroup({
331
335
  interface ToggleProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange'> {
332
336
  checked?: boolean;
333
337
  defaultChecked?: boolean;
338
+ /** Called with the new checked state when the switch is toggled. */
339
+ onValueChange?: (checked: boolean) => void;
340
+ /** @deprecated Use `onValueChange` — it receives the same `checked` boolean. */
334
341
  onChange?: (checked: boolean) => void;
335
342
  /**
336
343
  * Renders a **visible** text label beside the switch that also becomes its
@@ -344,6 +351,7 @@ interface ToggleProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onC
344
351
  declare function Toggle({
345
352
  checked,
346
353
  defaultChecked,
354
+ onValueChange,
347
355
  onChange,
348
356
  label,
349
357
  size,
@@ -648,7 +656,13 @@ interface SideNavLinkProps {
648
656
  'data-state'?: 'active' | undefined;
649
657
  'data-tone'?: Exclude<SideNavTone, 'default'> | undefined;
650
658
  tabIndex?: number | undefined;
651
- onClick: (e: MouseEvent<HTMLAnchorElement>) => void;
659
+ /**
660
+ * Always provided by cascivo when it builds the bag; only calls
661
+ * `preventDefault()` for a disabled item, otherwise inert. Optional on the type
662
+ * so it composes cleanly — spread it onto a router `<Link>`, which layers its own
663
+ * click handling on top.
664
+ */
665
+ onClick?: (e: MouseEvent<HTMLAnchorElement>) => void;
652
666
  }
653
667
  /** A selectable/navigable sub-item (link when `href` is set, action when `onSelect` is set). */
654
668
  interface SideNavLinkSubItem {
@@ -693,7 +707,8 @@ interface SideNavItem {
693
707
  * the default layout), and `linkProps` is the anchor prop bag cascivo would spread
694
708
  * onto the `<a>` (including active-state and a11y attributes) — spread it onto your
695
709
  * router `<Link>` to preserve them. For a global router integration prefer
696
- * `setLinkComponent` from `@cascivo/core` over a per-item hatch.
710
+ * `setLinkComponent` (from `@cascivo/react`, or `@cascivo/core` for copied source)
711
+ * over a per-item hatch.
697
712
  */
698
713
  render?: (ctx: {
699
714
  collapsed: boolean;
@@ -919,6 +934,9 @@ declare function OverflowMenu({
919
934
  interface SearchProps {
920
935
  value?: string;
921
936
  defaultValue?: string;
937
+ /** Called with the current text on every keystroke. */
938
+ onValueChange?: (value: string) => void;
939
+ /** @deprecated Use `onValueChange` — it receives the same string. */
922
940
  onChange?: (value: string) => void;
923
941
  onSearch?: (value: string) => void;
924
942
  debounceMs?: number;
@@ -933,6 +951,7 @@ interface SearchProps {
933
951
  declare function Search({
934
952
  value,
935
953
  defaultValue,
954
+ onValueChange,
936
955
  onChange,
937
956
  onSearch,
938
957
  debounceMs,
@@ -947,6 +966,9 @@ declare function Search({
947
966
  interface NumberInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'value' | 'defaultValue' | 'onChange' | 'min' | 'max' | 'step'> {
948
967
  value?: number | null;
949
968
  defaultValue?: number;
969
+ /** Called with the new numeric value (or null when cleared). */
970
+ onValueChange?: (value: number | null) => void;
971
+ /** @deprecated Use `onValueChange` — it receives the same `number | null`. */
950
972
  onChange?: (value: number | null) => void;
951
973
  min?: number;
952
974
  max?: number;
@@ -963,6 +985,7 @@ interface NumberInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, '
963
985
  declare function NumberInput({
964
986
  value,
965
987
  defaultValue,
988
+ onValueChange,
966
989
  onChange,
967
990
  min,
968
991
  max,
@@ -1246,6 +1269,9 @@ interface ComboboxProps {
1246
1269
  options: ComboboxOption[];
1247
1270
  value?: string;
1248
1271
  defaultValue?: string;
1272
+ /** Called with the selected option value (or undefined when cleared). */
1273
+ onValueChange?: (value: string | undefined) => void;
1274
+ /** @deprecated Use `onValueChange` — it receives the same `string | undefined`. */
1249
1275
  onChange?: (value: string | undefined) => void;
1250
1276
  clearable?: boolean;
1251
1277
  searchable?: boolean;
@@ -1262,6 +1288,7 @@ declare function Combobox({
1262
1288
  options,
1263
1289
  value,
1264
1290
  defaultValue,
1291
+ onValueChange,
1265
1292
  onChange,
1266
1293
  clearable,
1267
1294
  searchable,
@@ -1283,6 +1310,9 @@ interface DatePickerLabels {
1283
1310
  interface DatePickerProps {
1284
1311
  value?: string;
1285
1312
  defaultValue?: string;
1313
+ /** Called with the selected ISO date string (or undefined when cleared). */
1314
+ onValueChange?: (value: string | undefined) => void;
1315
+ /** @deprecated Use `onValueChange` — it receives the same ISO `string | undefined`. */
1286
1316
  onChange?: (value: string | undefined) => void;
1287
1317
  min?: string;
1288
1318
  max?: string;
@@ -1299,6 +1329,7 @@ interface DatePickerProps {
1299
1329
  declare function DatePicker({
1300
1330
  value,
1301
1331
  defaultValue,
1332
+ onValueChange,
1302
1333
  onChange,
1303
1334
  min,
1304
1335
  max,
@@ -1358,6 +1389,9 @@ declare function FileUploader({
1358
1389
  interface TimePickerProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'value' | 'defaultValue' | 'onChange' | 'min' | 'max' | 'step'> {
1359
1390
  value?: string;
1360
1391
  defaultValue?: string;
1392
+ /** Called with the new `HH:MM` time string when the value changes. */
1393
+ onValueChange?: (value: string) => void;
1394
+ /** @deprecated Use `onValueChange` — it receives the same time string. */
1361
1395
  onChange?: (value: string) => void;
1362
1396
  min?: string;
1363
1397
  max?: string;
@@ -1370,6 +1404,7 @@ interface TimePickerProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 's
1370
1404
  declare function TimePicker({
1371
1405
  value,
1372
1406
  defaultValue,
1407
+ onValueChange,
1373
1408
  onChange,
1374
1409
  min,
1375
1410
  max,
@@ -2310,6 +2345,9 @@ interface FilterProps {
2310
2345
  options: FilterOption[];
2311
2346
  value?: string[];
2312
2347
  defaultValue?: string[];
2348
+ /** Called with the selected values whenever the selection changes. */
2349
+ onValueChange?: (selected: string[]) => void;
2350
+ /** @deprecated Use `onValueChange` — it receives the same `string[]`. */
2313
2351
  onChange?: (selected: string[]) => void;
2314
2352
  multi?: boolean;
2315
2353
  variant?: FilterVariant;
@@ -2320,6 +2358,7 @@ declare function Filter({
2320
2358
  options,
2321
2359
  value,
2322
2360
  defaultValue,
2361
+ onValueChange,
2323
2362
  onChange,
2324
2363
  multi,
2325
2364
  variant,
@@ -3196,6 +3235,9 @@ interface SwapProps {
3196
3235
  on: React.ReactNode;
3197
3236
  off: React.ReactNode;
3198
3237
  checked?: boolean;
3238
+ /** Called with the new checked state when the swap is toggled. */
3239
+ onValueChange?: (checked: boolean) => void;
3240
+ /** @deprecated Use `onValueChange` — it receives the same `checked` boolean. */
3199
3241
  onChange?: (checked: boolean) => void;
3200
3242
  mode?: SwapMode;
3201
3243
  'aria-label'?: string;
@@ -3205,6 +3247,7 @@ declare function Swap({
3205
3247
  on,
3206
3248
  off,
3207
3249
  checked,
3250
+ onValueChange,
3208
3251
  onChange,
3209
3252
  mode,
3210
3253
  className,
@@ -3360,8 +3403,11 @@ declare function setTheme(next: string): void;
3360
3403
  declare function useTheme(): readonly [Signal<string>, (next: string) => void];
3361
3404
  interface ThemeProviderProps {
3362
3405
  /**
3363
- * Theme to use when nothing is persisted yet. Falls back to the visitor's OS
3364
- * `prefers-color-scheme` (light/dark), then to `'light'`.
3406
+ * Theme to use when nothing is persisted yet. When set, it **wins over** the
3407
+ * visitor's OS `prefers-color-scheme` — pass it for a "dark by default" or
3408
+ * custom-theme (`'midnight'`, …) app. Omit it to follow the OS (light/dark),
3409
+ * falling back to `'light'`. Precedence: persisted value > `defaultTheme` (if
3410
+ * set) > OS preference > `'light'`.
3365
3411
  */
3366
3412
  defaultTheme?: string;
3367
3413
  /**
@@ -3408,11 +3454,23 @@ declare function ThemeProvider({
3408
3454
  * SSR or a hard reload. Pass the same `storageKey`/`attribute`/`defaultTheme`
3409
3455
  * you give {@link ThemeProvider}.
3410
3456
  *
3457
+ * Precedence matches {@link ThemeProvider}: persisted value > `defaultTheme`
3458
+ * (if set) > OS `prefers-color-scheme` > `'light'`. Passing `defaultTheme`
3459
+ * suppresses the OS check, so a "dark by default" app stays dark on a light-OS
3460
+ * visitor.
3461
+ *
3462
+ * The script sets `data-theme` **before** React hydrates, so add
3463
+ * `suppressHydrationWarning` to the element that carries the attribute (usually
3464
+ * `<html>`) — the mutation is intentional, and without the flag React 19 logs a
3465
+ * hydration mismatch.
3466
+ *
3411
3467
  * ```tsx
3412
3468
  * // Next.js app/layout.tsx
3413
- * <head>
3414
- * <script dangerouslySetInnerHTML={{ __html: themePreloadScript() }} />
3415
- * </head>
3469
+ * <html suppressHydrationWarning>
3470
+ * <head>
3471
+ * <script dangerouslySetInnerHTML={{ __html: themePreloadScript({ defaultTheme: 'dark' }) }} />
3472
+ * </head>
3473
+ * </html>
3416
3474
  * ```
3417
3475
  */
3418
3476
  declare function themePreloadScript(options?: {
@@ -3420,4 +3478,4 @@ declare function themePreloadScript(options?: {
3420
3478
  attribute?: string;
3421
3479
  defaultTheme?: string;
3422
3480
  }): string;
3423
- export { Accordion, AccordionContent, AccordionItem, AccordionItemProps, AccordionProps, AccordionTrigger, ActionSheet, ActionSheetAction, ActionSheetProps, Alert, AlertDialog, AlertDialogLabels, AlertDialogProps, AlertProps, AppShell, AppShellProps, AspectRatio, AspectRatioProps, AutoGrid, AutoGridProps, Avatar, AvatarGroup, AvatarGroupLabels, AvatarGroupProps, AvatarProps, Badge, BadgeProps, Blockquote, BlockquoteProps, BottomSheet, BottomSheetProps, Breadcrumb, BreadcrumbItem, BreadcrumbProps, Button, ButtonGroup, ButtonGroupProps, ButtonProps, Calendar, CalendarLabels, CalendarProps, Card, CardContent, CardContentProps, CardFooter, CardFooterProps, CardHeader, CardHeaderProps, CardProps, CardTitle, CardTitleProps, Carousel, CarouselLabels, CarouselProps, Center, CenterProps, ChatBubble, ChatBubbleProps, ChatBubbleSide, Checkbox, CheckboxCard, CheckboxCardProps, CheckboxProps, Code, type CodeLang, CodeProps, CodeSnippet, CodeSnippetProps, Collapsible, CollapsibleProps, ColorPicker, ColorPickerLabels, ColorPickerProps, Column, Columns, ColumnsProps, Combobox, ComboboxLabels, ComboboxOption, ComboboxProps, CommandAction, CommandGroup, CommandItem, CommandMenu, CommandMenuProps, CommandPage, CommandScope, CommandStatus, Comparison, ComparisonProps, ContainedList, ContainedListItem, ContainedListItemProps, ContainedListProps, ContextMenu, ContextMenuItem, ContextMenuItemProps, ContextMenuProps, CopyButton, CopyButtonProps, DataList, DataListItem, DataListProps, DataTable, DataTableLabels, DataTableProps, DatePicker, DatePickerLabels, DatePickerProps, DateRange, DateRangePicker, DateRangePickerLabels, DateRangePickerProps, DateRangePreset, Dock, DockItem, DockProps, Drawer, DrawerProps, Dropdown, DropdownItem, DropdownProps, Editable, EditableProps, EmptyState, EmptyStateProps, ErrorBoundary, Fab, FabAction, FabProps, Field, FieldProps, FileUploader, FileUploaderLabels, FileUploaderProps, Filter, FilterOption, FilterProps, FilterVariant, Flex, FlexProps, FocusScope, Form, FormConfig, FormProps, FormStore, FuzzyMatch, Grid, GridAlign, GridItem, GridItemProps, GridProps, Header, HeaderLabels, HeaderLink, HeaderPanel, HeaderPanelLabels, HeaderPanelProps, HeaderProps, Heading, HeadingLevel, HeadingProps, HeadingSize, HoverCard, HoverCardContent, HoverCardContentProps, HoverCardProps, HoverCardTrigger, HoverCardTriggerProps, IconButton, IconButtonProps, Image, ImageProps, Indicator, IndicatorPlacement, IndicatorProps, InlineLoading, InlineLoadingProps, InlineLoadingStatus, Input, InputGroup, InputGroupAddon, type InputGroupAddonProps, type InputGroupProps, InputProps, Item, ItemActions, ItemActionsProps, ItemContent, ItemContentProps, ItemDescription, ItemDescriptionProps, ItemMedia, ItemMediaProps, ItemProps, ItemTitle, ItemTitleProps, Join, JoinOrientation, JoinProps, Kbd, KbdProps, Label, LabelProps, Link, LinkProps, List, ListItem, ListItemProps, ListProps, LogLevel, LogLine, LogViewer, LogViewerLabels, LogViewerProps, Menu, MenuButton, MenuButtonItem, MenuButtonProps, MenuItem, MenuItemProps, MenuProps, MenuSeparator, MenuTrigger, MenuTriggerProps, Menubar, MenubarItem, MenubarMenu, MenubarProps, Modal, ModalProps, MultiSelect, MultiSelectLabels, MultiSelectOption, MultiSelectProps, NativeSelect, NativeSelectOption, NativeSelectProps, NavigationMenu, NavigationMenuItem, NavigationMenuProps, Notification, NotificationProps, NotificationVariant, NumberInput, NumberInputProps, OtpInput, OtpInputProps, OverflowMenu, OverflowMenuItem, OverflowMenuProps, Pagination, PaginationLabels, PaginationProps, PasswordInput, PasswordInputLabels, PasswordInputProps, Popover, PopoverContent, PopoverContentProps, PopoverProps, PopoverTrigger, PopoverTriggerProps, Portal, Progress, ProgressBar, ProgressBarProps, ProgressCircle, ProgressCircleProps, ProgressIndicator, ProgressIndicatorProps, ProgressProps, ProgressSize, ProgressStep, ProgressVariant, Prose, ProseProps, PullToRefresh, PullToRefreshProps, QrCode, QrCodeProps, RadialProgress, RadialProgressProps, RadialProgressSize, RadialProgressVariant, Radio, RadioCard, RadioCardGroup, RadioCardGroupProps, RadioCardProps, RadioGroup, RadioGroupProps, RadioProps, RatingGroup, RatingGroupLabels, RatingGroupProps, RelativeTime, RelativeTimeProps, Resizable, ResizableProps, Responsive, ScrollArea, ScrollAreaProps, Search, SearchProps, SegmentedControl, SegmentedControlOption, SegmentedControlProps, Select, SelectOption, SelectProps, Separator, SeparatorProps, Sheet, SheetProps, ShellHeader, ShellHeaderAction, ShellHeaderBrand, ShellHeaderLabels, ShellHeaderNavItem, ShellHeaderNavLink, ShellHeaderNavMenu, ShellHeaderNavMenuItem, ShellHeaderProps, SideNav, SideNavGroup, SideNavItem, SideNavLinkProps, SideNavLinkSubItem, SideNavProps, SideNavSubItem, SideNavTone, Skeleton, SkeletonProps, SkipNavLink, SkipNavLinkProps, SkipNavTarget, SkipNavTargetProps, Slider, SliderProps, SortDirection, SortState, Spacer, SpacerProps, Spinner, SpinnerProps, Stack, StackProps, type StandardSchemaV1, Stat, StatProps, Status, StatusProps, Step, StepState, Steps, StepsProps, StructuredList, StructuredListItem, StructuredListProps, SuspenseBoundary, Swap, SwapMode, SwapProps, SwipeAction, SwipeItem, SwipeItemProps, Switcher, SwitcherEntry, SwitcherLink, SwitcherProps, Tabs, TabsContent, TabsContentProps, TabsList, TabsProps, TabsTrigger, TabsTriggerProps, Tag$1 as Tag, TagProps, TagsInput, TagsInputProps, Text, TextProps, Textarea, TextareaProps, ThemeProvider, type ThemeProviderProps, Tile, TileProps, TimePicker, TimePickerProps, Timeline, TimelineItem, TimelineProps, ToastOptions, ToastProvider, ToastVariant, Toc, TocItem, TocProps, Toggle, ToggleGroup, ToggleGroupItem, ToggleGroupProps, ToggleProps, Toggletip, ToggletipPlacement, ToggletipProps, Tooltip, TooltipProps, TreeNode, TreeView, TreeViewProps, UploaderFile, type UsePopoverOptions, type UsePopoverReturn, type UseTocFromRegionOptions, User, UserProps, VisuallyHidden, VisuallyHiddenProps, createForm, dismissAllToasts, fuzzyMatch, fuzzyScore, setTheme, themePreloadScript, treeViewMessages, useForm, usePopover, useTheme, useToast, useTocFromRegion };
3481
+ export { Accordion, AccordionContent, AccordionItem, AccordionItemProps, AccordionProps, AccordionTrigger, ActionSheet, ActionSheetAction, ActionSheetProps, Alert, AlertDialog, AlertDialogLabels, AlertDialogProps, AlertProps, AppShell, AppShellProps, AspectRatio, AspectRatioProps, AutoGrid, AutoGridProps, Avatar, AvatarGroup, AvatarGroupLabels, AvatarGroupProps, AvatarProps, Badge, BadgeProps, Blockquote, BlockquoteProps, BottomSheet, BottomSheetProps, Breadcrumb, BreadcrumbItem, BreadcrumbProps, Button, ButtonGroup, ButtonGroupProps, ButtonProps, Calendar, CalendarLabels, CalendarProps, Card, CardContent, CardContentProps, CardFooter, CardFooterProps, CardHeader, CardHeaderProps, CardProps, CardTitle, CardTitleProps, Carousel, CarouselLabels, CarouselProps, Center, CenterProps, ChatBubble, ChatBubbleProps, ChatBubbleSide, Checkbox, CheckboxCard, CheckboxCardProps, CheckboxProps, Code, type CodeLang, CodeProps, CodeSnippet, CodeSnippetProps, Collapsible, CollapsibleProps, ColorPicker, ColorPickerLabels, ColorPickerProps, Column, Columns, ColumnsProps, Combobox, ComboboxLabels, ComboboxOption, ComboboxProps, CommandAction, CommandGroup, CommandItem, CommandMenu, CommandMenuProps, CommandPage, CommandScope, CommandStatus, Comparison, ComparisonProps, ContainedList, ContainedListItem, ContainedListItemProps, ContainedListProps, ContextMenu, ContextMenuItem, ContextMenuItemProps, ContextMenuProps, CopyButton, CopyButtonProps, DataList, DataListItem, DataListProps, DataTable, DataTableLabels, DataTableProps, DatePicker, DatePickerLabels, DatePickerProps, DateRange, DateRangePicker, DateRangePickerLabels, DateRangePickerProps, DateRangePreset, Dock, DockItem, DockProps, Drawer, DrawerProps, Dropdown, DropdownItem, DropdownProps, Editable, EditableProps, EmptyState, EmptyStateProps, ErrorBoundary, Fab, FabAction, FabProps, Field, FieldProps, FileUploader, FileUploaderLabels, FileUploaderProps, Filter, FilterOption, FilterProps, FilterVariant, Flex, FlexProps, FocusScope, Form, FormConfig, FormProps, FormStore, FuzzyMatch, Grid, GridAlign, GridItem, GridItemProps, GridProps, Header, HeaderLabels, HeaderLink, HeaderPanel, HeaderPanelLabels, HeaderPanelProps, HeaderProps, Heading, HeadingLevel, HeadingProps, HeadingSize, HoverCard, HoverCardContent, HoverCardContentProps, HoverCardProps, HoverCardTrigger, HoverCardTriggerProps, IconButton, IconButtonProps, Image, ImageProps, Indicator, IndicatorPlacement, IndicatorProps, InlineLoading, InlineLoadingProps, InlineLoadingStatus, Input, InputGroup, InputGroupAddon, type InputGroupAddonProps, type InputGroupProps, InputProps, Item, ItemActions, ItemActionsProps, ItemContent, ItemContentProps, ItemDescription, ItemDescriptionProps, ItemMedia, ItemMediaProps, ItemProps, ItemTitle, ItemTitleProps, Join, JoinOrientation, JoinProps, Kbd, KbdProps, Label, LabelProps, Link, type LinkComponent, type LinkComponentProps, LinkProps, List, ListItem, ListItemProps, ListProps, LogLevel, LogLine, LogViewer, LogViewerLabels, LogViewerProps, Menu, MenuButton, MenuButtonItem, MenuButtonProps, MenuItem, MenuItemProps, MenuProps, MenuSeparator, MenuTrigger, MenuTriggerProps, Menubar, MenubarItem, MenubarMenu, MenubarProps, Modal, ModalProps, MultiSelect, MultiSelectLabels, MultiSelectOption, MultiSelectProps, NativeSelect, NativeSelectOption, NativeSelectProps, NavigationMenu, NavigationMenuItem, NavigationMenuProps, Notification, NotificationProps, NotificationVariant, NumberInput, NumberInputProps, OtpInput, OtpInputProps, OverflowMenu, OverflowMenuItem, OverflowMenuProps, Pagination, PaginationLabels, PaginationProps, PasswordInput, PasswordInputLabels, PasswordInputProps, Popover, PopoverContent, PopoverContentProps, PopoverProps, PopoverTrigger, PopoverTriggerProps, Portal, Progress, ProgressBar, ProgressBarProps, ProgressCircle, ProgressCircleProps, ProgressIndicator, ProgressIndicatorProps, ProgressProps, ProgressSize, ProgressStep, ProgressVariant, Prose, ProseProps, PullToRefresh, PullToRefreshProps, QrCode, QrCodeProps, RadialProgress, RadialProgressProps, RadialProgressSize, RadialProgressVariant, Radio, RadioCard, RadioCardGroup, RadioCardGroupProps, RadioCardProps, RadioGroup, RadioGroupProps, RadioProps, RatingGroup, RatingGroupLabels, RatingGroupProps, RelativeTime, RelativeTimeProps, Resizable, ResizableProps, Responsive, ScrollArea, ScrollAreaProps, Search, SearchProps, SegmentedControl, SegmentedControlOption, SegmentedControlProps, Select, SelectOption, SelectProps, Separator, SeparatorProps, Sheet, SheetProps, ShellHeader, ShellHeaderAction, ShellHeaderBrand, ShellHeaderLabels, ShellHeaderNavItem, ShellHeaderNavLink, ShellHeaderNavMenu, ShellHeaderNavMenuItem, ShellHeaderProps, SideNav, SideNavGroup, SideNavItem, SideNavLinkProps, SideNavLinkSubItem, SideNavProps, SideNavSubItem, SideNavTone, Skeleton, SkeletonProps, SkipNavLink, SkipNavLinkProps, SkipNavTarget, SkipNavTargetProps, Slider, SliderProps, SortDirection, SortState, Spacer, SpacerProps, Spinner, SpinnerProps, Stack, StackProps, type StandardSchemaV1, Stat, StatProps, Status, StatusProps, Step, StepState, Steps, StepsProps, StructuredList, StructuredListItem, StructuredListProps, SuspenseBoundary, Swap, SwapMode, SwapProps, SwipeAction, SwipeItem, SwipeItemProps, Switcher, SwitcherEntry, SwitcherLink, SwitcherProps, Tabs, TabsContent, TabsContentProps, TabsList, TabsProps, TabsTrigger, TabsTriggerProps, Tag$1 as Tag, TagProps, TagsInput, TagsInputProps, Text, TextProps, Textarea, TextareaProps, ThemeProvider, type ThemeProviderProps, Tile, TileProps, TimePicker, TimePickerProps, Timeline, TimelineItem, TimelineProps, ToastOptions, ToastProvider, ToastVariant, Toc, TocItem, TocProps, Toggle, ToggleGroup, ToggleGroupItem, ToggleGroupProps, ToggleProps, Toggletip, ToggletipPlacement, ToggletipProps, Tooltip, TooltipProps, TreeNode, TreeView, TreeViewProps, UploaderFile, type UsePopoverOptions, type UsePopoverReturn, type UseTocFromRegionOptions, User, UserProps, VisuallyHidden, VisuallyHiddenProps, createForm, dismissAllToasts, fuzzyMatch, fuzzyScore, getLinkComponent, setLinkComponent, setTheme, themePreloadScript, treeViewMessages, useForm, usePopover, useTheme, useToast, useTocFromRegion };
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ 'use client';
2
+ export * from './react/src/index.js';