twico-ui 1.45.0 → 1.46.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.
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var React54 = require('react');
4
+ var React55 = require('react');
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var reactDom = require('react-dom');
7
7
 
@@ -23,14 +23,14 @@ function _interopNamespace(e) {
23
23
  return Object.freeze(n);
24
24
  }
25
25
 
26
- var React54__namespace = /*#__PURE__*/_interopNamespace(React54);
26
+ var React55__namespace = /*#__PURE__*/_interopNamespace(React55);
27
27
 
28
28
  // components/TwicoProvider.jsx
29
- var SUPPORTS_STYLE_HOIST = parseInt(String(React54__namespace.version), 10) >= 19;
30
- var NonceContext = React54__namespace.createContext(void 0);
29
+ var SUPPORTS_STYLE_HOIST = parseInt(String(React55__namespace.version), 10) >= 19;
30
+ var NonceContext = React55__namespace.createContext(void 0);
31
31
  function useScopedStyles(id, css) {
32
- const nonce = React54__namespace.useContext(NonceContext);
33
- React54__namespace.useInsertionEffect(() => {
32
+ const nonce = React55__namespace.useContext(NonceContext);
33
+ React55__namespace.useInsertionEffect(() => {
34
34
  if (SUPPORTS_STYLE_HOIST) return;
35
35
  if (typeof document === "undefined") return;
36
36
  if (!css) return;
@@ -46,12 +46,12 @@ function useScopedStyles(id, css) {
46
46
  }
47
47
  if (el.textContent !== css) el.textContent = css;
48
48
  }, [id, css, nonce]);
49
- return SUPPORTS_STYLE_HOIST && css ? React54__namespace.createElement("style", { href: id, precedence: "twc-ui" }, css) : null;
49
+ return SUPPORTS_STYLE_HOIST && css ? React55__namespace.createElement("style", { href: id, precedence: "twc-ui" }, css) : null;
50
50
  }
51
51
 
52
52
  // components/TwicoProvider.jsx
53
53
  function TwicoProvider({ nonce, children }) {
54
- return React54__namespace.default.createElement(NonceContext.Provider, { value: nonce }, children);
54
+ return React55__namespace.default.createElement(NonceContext.Provider, { value: nonce }, children);
55
55
  }
56
56
  var GROUPS = { colors: "color", space: "space", radius: "radius", font: "font", shadow: "shadow", motion: "" };
57
57
  function createTheme(partial = {}) {
@@ -71,8 +71,8 @@ function toVars(theme) {
71
71
  return Object.keys(theme).some((k) => k.startsWith("--")) ? theme : createTheme(theme);
72
72
  }
73
73
  function ThemeProvider({ theme, mode = "inline", className = "", style, children, ...rest }) {
74
- const vars = React54__namespace.default.useMemo(() => toVars(theme), [theme]);
75
- const uid = React54__namespace.default.useId();
74
+ const vars = React55__namespace.default.useMemo(() => toVars(theme), [theme]);
75
+ const uid = React55__namespace.default.useId();
76
76
  const scopeId = `twc-theme-${uid.replace(/[^a-zA-Z0-9]/g, "")}`;
77
77
  const css = mode === "stylesheet" ? `[data-twc-theme="${scopeId}"] { ${Object.entries(vars).map(([k, v]) => `${k}: ${v};`).join(" ")} }` : "";
78
78
  const __twcStyles = useScopedStyles(mode === "stylesheet" ? scopeId : "twc-theme-noop", css);
@@ -94,7 +94,7 @@ var FORM_CSS = `
94
94
  .twc-form { display: flex; flex-direction: column; gap: var(--space-4); font-family: var(--font-sans); }
95
95
  .twc-form__fieldset { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: inherit; }
96
96
  `;
97
- var Form = React54__namespace.default.forwardRef(function Form2({
97
+ var Form = /* @__PURE__ */ React55__namespace.default.forwardRef(function Form2({
98
98
  onSubmit,
99
99
  preventDefault = true,
100
100
  loading = false,
@@ -125,18 +125,16 @@ var Form = React54__namespace.default.forwardRef(function Form2({
125
125
  }
126
126
  );
127
127
  });
128
- Form.displayName = "Form";
129
128
  var VH_CSS = `
130
129
  .twc-visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
131
130
  `;
132
- var VisuallyHidden = React54__namespace.default.forwardRef(function VisuallyHidden2({ as: Tag2 = "span", className = "", children, ...rest }, ref) {
131
+ var VisuallyHidden = /* @__PURE__ */ React55__namespace.default.forwardRef(function VisuallyHidden2({ as: Tag2 = "span", className = "", children, ...rest }, ref) {
133
132
  const __twcStyles = useScopedStyles("twc-visually-hidden-styles", VH_CSS);
134
133
  return /* @__PURE__ */ jsxRuntime.jsxs(Tag2, { ref, className: `twc-visually-hidden ${className}`.trim(), ...rest, children: [
135
134
  __twcStyles,
136
135
  children
137
136
  ] });
138
137
  });
139
- VisuallyHidden.displayName = "VisuallyHidden";
140
138
 
141
139
  // components/_warn.js
142
140
  var seen = /* @__PURE__ */ new Set();
@@ -149,7 +147,7 @@ function warnOnce(key, message) {
149
147
 
150
148
  // components/_overlay.js
151
149
  var canUseDOM = typeof window !== "undefined" && typeof document !== "undefined";
152
- var useIsoLayoutEffect = canUseDOM ? React54__namespace.default.useLayoutEffect : React54__namespace.default.useEffect;
150
+ var useIsoLayoutEffect = canUseDOM ? React55__namespace.default.useLayoutEffect : React55__namespace.default.useEffect;
153
151
  var FOCUSABLE = 'a[href]:not([tabindex="-1"]), button:not([disabled]):not([tabindex="-1"]), textarea:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([tabindex="-1"]), select:not([disabled]):not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])';
154
152
  var CONTROL_TAGS = "|button|input|select|textarea|";
155
153
  var ROLE_OK = "|button|link|menuitem|menuitemcheckbox|menuitemradio|combobox|tab|treeitem|checkbox|switch|option|";
@@ -163,7 +161,7 @@ function triggerIsControl(el) {
163
161
  }
164
162
  var NATIVE_CONTROL = "button,a[href],summary,input,select,textarea";
165
163
  function useTriggerAudit(ref, name) {
166
- React54__namespace.default.useEffect(() => {
164
+ React55__namespace.default.useEffect(() => {
167
165
  const el = ref.current && ref.current.firstElementChild;
168
166
  if (!el) return;
169
167
  if (el.classList.contains("twc-tooltip-wrap")) {
@@ -178,7 +176,7 @@ function useTriggerAudit(ref, name) {
178
176
  }, []);
179
177
  }
180
178
  function useFocusTrap(ref, active = true, { restoreFocus = true, initialFocus } = {}) {
181
- React54__namespace.default.useEffect(() => {
179
+ React55__namespace.default.useEffect(() => {
182
180
  if (!active || !canUseDOM) return void 0;
183
181
  const node = ref.current;
184
182
  if (!node) return void 0;
@@ -189,7 +187,7 @@ function useFocusTrap(ref, active = true, { restoreFocus = true, initialFocus }
189
187
  if (restoreFocus && prevFocused && typeof prevFocused.focus === "function") prevFocused.focus();
190
188
  };
191
189
  }, [active]);
192
- React54__namespace.default.useEffect(() => {
190
+ React55__namespace.default.useEffect(() => {
193
191
  if (!active || !canUseDOM) return void 0;
194
192
  const node = ref.current;
195
193
  const onKey = (e) => {
@@ -216,7 +214,7 @@ function useFocusTrap(ref, active = true, { restoreFocus = true, initialFocus }
216
214
  }, [active]);
217
215
  }
218
216
  function usePortal() {
219
- return React54__namespace.default.useCallback((node) => {
217
+ return React55__namespace.default.useCallback((node) => {
220
218
  if (typeof document === "undefined") return null;
221
219
  return typeof reactDom.createPortal === "function" ? reactDom.createPortal(node, document.body) : node;
222
220
  }, []);
@@ -246,8 +244,8 @@ function useScrollLock(locked = true) {
246
244
  var __layerSeq = 0;
247
245
  var __openLayers = /* @__PURE__ */ new Set();
248
246
  function useLayer(active) {
249
- const depth = React54__namespace.default.useRef(0);
250
- React54__namespace.default.useEffect(() => {
247
+ const depth = React55__namespace.default.useRef(0);
248
+ React55__namespace.default.useEffect(() => {
251
249
  if (!active) return void 0;
252
250
  const d = ++__layerSeq;
253
251
  depth.current = d;
@@ -256,10 +254,10 @@ function useLayer(active) {
256
254
  __openLayers.delete(d);
257
255
  };
258
256
  }, [active]);
259
- return React54__namespace.default.useCallback(() => __openLayers.size === 0 || depth.current === Math.max(...__openLayers), []);
257
+ return React55__namespace.default.useCallback(() => __openLayers.size === 0 || depth.current === Math.max(...__openLayers), []);
260
258
  }
261
259
  function useInertBackground(ref, active) {
262
- React54__namespace.default.useEffect(() => {
260
+ React55__namespace.default.useEffect(() => {
263
261
  if (!active || !canUseDOM) return void 0;
264
262
  const node = ref.current;
265
263
  if (!node) return void 0;
@@ -294,7 +292,7 @@ function getColorSchemeScript({ storageKey = "twico-theme", attribute = "class",
294
292
  return `(function(){try{var k=${k},a=${a},d=${d},t=localStorage.getItem(k);if(t!=='light'){if(t!=='dark'){t=d?d:(window.matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light');}}if(a==='class'){document.documentElement.classList.toggle('dark',t==='dark');}else{document.documentElement.setAttribute(a,t);}}catch(e){}})();`;
295
293
  }
296
294
  function ColorSchemeScript({ storageKey = "twico-theme", attribute = "class", nonce, defaultScheme }) {
297
- return React54__namespace.default.createElement("script", { nonce }, getColorSchemeScript({ storageKey, attribute, defaultScheme }));
295
+ return React55__namespace.default.createElement("script", { nonce }, getColorSchemeScript({ storageKey, attribute, defaultScheme }));
298
296
  }
299
297
  var KBD_CSS = `
300
298
  .twc-kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; padding: 2px 6px;
@@ -302,14 +300,13 @@ var KBD_CSS = `
302
300
  background: var(--color-surface-sunken); border: var(--border-thin) solid var(--color-border);
303
301
  border-bottom-width: 2px; border-radius: var(--radius-sm); }
304
302
  `;
305
- var Kbd = React54__namespace.default.forwardRef(function Kbd2({ className = "", children, ...rest }, ref) {
303
+ var Kbd = /* @__PURE__ */ React55__namespace.default.forwardRef(function Kbd2({ className = "", children, ...rest }, ref) {
306
304
  const __twcStyles = useScopedStyles("twc-kbd-styles", KBD_CSS);
307
305
  return /* @__PURE__ */ jsxRuntime.jsxs("kbd", { ref, className: `twc-kbd ${className}`.trim(), ...rest, children: [
308
306
  __twcStyles,
309
307
  children
310
308
  ] });
311
309
  });
312
- Kbd.displayName = "Kbd";
313
310
  var PRE_CSS = `
314
311
  .twc-pre { margin: 0; padding: var(--space-4); overflow-x: auto; max-width: 100%;
315
312
  font-family: var(--font-mono); font-size: var(--text-sm); line-height: var(--leading-normal);
@@ -317,14 +314,13 @@ var PRE_CSS = `
317
314
  border: var(--border-thin) solid var(--color-border); border-radius: var(--radius-lg);
318
315
  white-space: pre; -webkit-overflow-scrolling: touch; }
319
316
  `;
320
- var Pre = React54__namespace.default.forwardRef(function Pre2({ className = "", children, ...rest }, ref) {
317
+ var Pre = /* @__PURE__ */ React55__namespace.default.forwardRef(function Pre2({ className = "", children, ...rest }, ref) {
321
318
  const __twcStyles = useScopedStyles("twc-pre-styles", PRE_CSS);
322
319
  return /* @__PURE__ */ jsxRuntime.jsxs("pre", { ref, className: `twc-pre ${className}`.trim(), ...rest, children: [
323
320
  __twcStyles,
324
321
  children
325
322
  ] });
326
323
  });
327
- Pre.displayName = "Pre";
328
324
  var ANCHOR_CSS = `
329
325
  .twc-anchor { color: var(--color-primary-subtle-fg); text-decoration: none; border-radius: var(--radius-sm);
330
326
  transition: color var(--duration-fast) var(--ease-standard); }
@@ -337,7 +333,7 @@ function safeHref(url) {
337
333
  const s = String(url).replace(/[\x00-\x20]+/g, "").toLowerCase();
338
334
  return s.startsWith("javascript:") || s.startsWith("data:") || s.startsWith("vbscript:") ? void 0 : url;
339
335
  }
340
- var Anchor = React54__namespace.default.forwardRef(function Anchor2({ as: Tag2 = "a", href, external = false, className = "", children, ...rest }, ref) {
336
+ var Anchor = /* @__PURE__ */ React55__namespace.default.forwardRef(function Anchor2({ as: Tag2 = "a", href, external = false, className = "", children, ...rest }, ref) {
341
337
  const __twcStyles = useScopedStyles("twc-anchor-styles", ANCHOR_CSS);
342
338
  const extra = external ? { target: "_blank", rel: "noopener noreferrer" } : {};
343
339
  return /* @__PURE__ */ jsxRuntime.jsxs(Tag2, { ref, className: `twc-anchor ${className}`.trim(), href: Tag2 === "a" ? safeHref(href) : href, ...extra, ...rest, children: [
@@ -346,14 +342,13 @@ var Anchor = React54__namespace.default.forwardRef(function Anchor2({ as: Tag2 =
346
342
  external ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-anchor__ext", "aria-hidden": "true", children: "\u2197" }) : null
347
343
  ] });
348
344
  });
349
- Anchor.displayName = "Anchor";
350
345
  var LABEL_CSS = `
351
346
  .twc-label { font-size: var(--text-sm); font-weight: var(--font-semibold); color: var(--color-text); display: inline-flex; gap: 4px; align-items: center; }
352
347
  .twc-label[data-size="sm"] { font-size: var(--text-xs); }
353
348
  .twc-label[data-size="lg"] { font-size: var(--text-base); }
354
349
  .twc-label__req { color: var(--color-danger); }
355
350
  `;
356
- var Label = React54__namespace.default.forwardRef(function Label2({ htmlFor, required = false, size = "md", className = "", children, ...rest }, ref) {
351
+ var Label = /* @__PURE__ */ React55__namespace.default.forwardRef(function Label2({ htmlFor, required = false, size = "md", className = "", children, ...rest }, ref) {
357
352
  const __twcStyles = useScopedStyles("twc-label-styles", LABEL_CSS);
358
353
  return /* @__PURE__ */ jsxRuntime.jsxs("label", { ref, htmlFor, className: `twc-label ${className}`.trim(), "data-size": size, ...rest, children: [
359
354
  __twcStyles,
@@ -361,12 +356,11 @@ var Label = React54__namespace.default.forwardRef(function Label2({ htmlFor, req
361
356
  required ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-label__req", "aria-hidden": "true", children: "*" }) : null
362
357
  ] });
363
358
  });
364
- Label.displayName = "Label";
365
359
  var IMAGE_CSS = `
366
360
  .twc-image { display: block; max-width: 100%; }
367
361
  .twc-image[data-fit] { width: 100%; height: 100%; }
368
362
  `;
369
- var Image = React54__namespace.default.forwardRef(function Image2({
363
+ var Image = /* @__PURE__ */ React55__namespace.default.forwardRef(function Image2({
370
364
  src,
371
365
  alt,
372
366
  fit,
@@ -382,7 +376,7 @@ var Image = React54__namespace.default.forwardRef(function Image2({
382
376
  ...rest
383
377
  }, ref) {
384
378
  const __twcStyles = useScopedStyles("twc-image-styles", IMAGE_CSS);
385
- const [failed, setFailed] = React54__namespace.default.useState(false);
379
+ const [failed, setFailed] = React55__namespace.default.useState(false);
386
380
  const shownSrc = failed && fallback ? fallback : src;
387
381
  const s = {
388
382
  objectFit: fit,
@@ -421,7 +415,6 @@ var Image = React54__namespace.default.forwardRef(function Image2({
421
415
  )
422
416
  ] });
423
417
  });
424
- Image.displayName = "Image";
425
418
  var ICONBTN_CSS = `
426
419
  .twc-iconbtn {
427
420
  --_sz: var(--control-h-md);
@@ -491,7 +484,7 @@ function safeHref2(url) {
491
484
  const s = String(url).replace(/[\x00-\x20]+/g, "").toLowerCase();
492
485
  return s.startsWith("javascript:") || s.startsWith("data:") || s.startsWith("vbscript:") ? void 0 : url;
493
486
  }
494
- function IconButton({
487
+ var IconButton = /* @__PURE__ */ React55__namespace.default.forwardRef(function IconButton2({
495
488
  children,
496
489
  icon,
497
490
  variant = "ghost",
@@ -508,7 +501,7 @@ function IconButton({
508
501
  "aria-label": ariaLabel,
509
502
  onClick,
510
503
  ...rest
511
- }) {
504
+ }, ref) {
512
505
  const __twcStyles = useScopedStyles("twc-iconbtn-styles", ICONBTN_CSS);
513
506
  const Tag2 = as;
514
507
  const inert = Tag2 === "a" && disabled;
@@ -516,6 +509,7 @@ function IconButton({
516
509
  return /* @__PURE__ */ jsxRuntime.jsxs(
517
510
  Tag2,
518
511
  {
512
+ ref,
519
513
  className: `twc-iconbtn ${className}`,
520
514
  "data-variant": variant,
521
515
  "data-tone": tone,
@@ -537,7 +531,7 @@ function IconButton({
537
531
  ]
538
532
  }
539
533
  );
540
- }
534
+ });
541
535
 
542
536
  // components/_compose.js
543
537
  function compose(theirs, ours) {
@@ -613,14 +607,14 @@ function Tooltip({
613
607
  }) {
614
608
  const __twcStyles = useScopedStyles("twc-tooltip-styles", TOOLTIP_CSS);
615
609
  const anchored = anchor !== void 0;
616
- const id = React54__namespace.default.useId();
617
- const [showU, setShowU] = React54__namespace.default.useState(false);
610
+ const id = React55__namespace.default.useId();
611
+ const [showU, setShowU] = React55__namespace.default.useState(false);
618
612
  const show = anchored ? !!openProp : showU;
619
- const [coords, setCoords] = React54__namespace.default.useState(null);
620
- const timer = React54__namespace.default.useRef(null);
621
- const closeTimer = React54__namespace.default.useRef(null);
622
- const wrapRef = React54__namespace.default.useRef(null);
623
- const tipRef = React54__namespace.default.useRef(null);
613
+ const [coords, setCoords] = React55__namespace.default.useState(null);
614
+ const timer = React55__namespace.default.useRef(null);
615
+ const closeTimer = React55__namespace.default.useRef(null);
616
+ const wrapRef = React55__namespace.default.useRef(null);
617
+ const tipRef = React55__namespace.default.useRef(null);
624
618
  const open = () => {
625
619
  clearTimeout(closeTimer.current);
626
620
  clearTimeout(timer.current);
@@ -631,11 +625,11 @@ function Tooltip({
631
625
  clearTimeout(closeTimer.current);
632
626
  closeTimer.current = setTimeout(() => setShowU(false), 120);
633
627
  };
634
- React54__namespace.default.useEffect(() => () => {
628
+ React55__namespace.default.useEffect(() => () => {
635
629
  clearTimeout(timer.current);
636
630
  clearTimeout(closeTimer.current);
637
631
  }, []);
638
- const place = React54__namespace.default.useCallback(() => {
632
+ const place = React55__namespace.default.useCallback(() => {
639
633
  const el = anchored ? anchor : wrapRef.current;
640
634
  if (!el || !el.getBoundingClientRect) return;
641
635
  const r2 = el.getBoundingClientRect();
@@ -670,10 +664,10 @@ function Tooltip({
670
664
  setCoords({ ...base, left: c, bottom: Math.round(vh - r2.top + gap), arrowX: arrowX(c) });
671
665
  }
672
666
  }, [placement, anchored, anchor]);
673
- React54__namespace.default.useEffect(() => {
667
+ React55__namespace.default.useEffect(() => {
674
668
  place();
675
669
  }, [place]);
676
- React54__namespace.default.useEffect(() => {
670
+ React55__namespace.default.useEffect(() => {
677
671
  if (!show) return void 0;
678
672
  place();
679
673
  const onMove = () => place();
@@ -684,7 +678,7 @@ function Tooltip({
684
678
  window.removeEventListener("resize", onMove);
685
679
  };
686
680
  }, [show, place]);
687
- React54__namespace.default.useEffect(() => {
681
+ React55__namespace.default.useEffect(() => {
688
682
  if (!show || anchored) return;
689
683
  const onKeyDown = (e) => {
690
684
  if (e.key === "Escape") {
@@ -728,7 +722,7 @@ function Tooltip({
728
722
  bubble
729
723
  ] });
730
724
  const describedBy = show ? id : void 0;
731
- const trigger = React54__namespace.default.isValidElement(children) && children.type !== React54__namespace.default.Fragment ? React54__namespace.default.cloneElement(children, {
725
+ const trigger = React55__namespace.default.isValidElement(children) && children.type !== React55__namespace.default.Fragment ? React55__namespace.default.cloneElement(children, {
732
726
  "aria-describedby": [children.props["aria-describedby"], describedBy].filter(Boolean).join(" ") || void 0
733
727
  }) : /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-describedby": describedBy, children });
734
728
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -777,7 +771,7 @@ var IcoReset = /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 24 24", fi
777
771
  /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 12a9 9 0 1 0 9-9 9 9 0 0 0-6.3 2.6L3 8" }),
778
772
  /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 3v5h5" })
779
773
  ] });
780
- var ImageViewer = /* @__PURE__ */ React54__namespace.default.forwardRef(function ImageViewer2({
774
+ var ImageViewer = /* @__PURE__ */ React55__namespace.default.forwardRef(function ImageViewer2({
781
775
  src,
782
776
  alt,
783
777
  minZoom = 1,
@@ -796,16 +790,16 @@ var ImageViewer = /* @__PURE__ */ React54__namespace.default.forwardRef(function
796
790
  ...rest
797
791
  }, ref) {
798
792
  const __twcStyles = useScopedStyles("twc-imageviewer-styles", IV_CSS);
799
- const stageRef = React54__namespace.default.useRef(null);
800
- const natRef = React54__namespace.default.useRef({ w: 0, h: 0 });
801
- const [internalZoom, setInternalZoom] = React54__namespace.default.useState(clamp(defaultZoom, minZoom, maxZoom));
793
+ const stageRef = React55__namespace.default.useRef(null);
794
+ const natRef = React55__namespace.default.useRef({ w: 0, h: 0 });
795
+ const [internalZoom, setInternalZoom] = React55__namespace.default.useState(clamp(defaultZoom, minZoom, maxZoom));
802
796
  const zoomControlled = zoomProp !== void 0;
803
797
  const zoom = clamp(zoomControlled ? zoomProp : internalZoom, minZoom, maxZoom);
804
- const [offset, setOffset] = React54__namespace.default.useState({ x: 0, y: 0 });
805
- const [dragging, setDragging] = React54__namespace.default.useState(false);
806
- const zoomRef = React54__namespace.default.useRef(zoom);
798
+ const [offset, setOffset] = React55__namespace.default.useState({ x: 0, y: 0 });
799
+ const [dragging, setDragging] = React55__namespace.default.useState(false);
800
+ const zoomRef = React55__namespace.default.useRef(zoom);
807
801
  zoomRef.current = zoom;
808
- const offsetRef = React54__namespace.default.useRef(offset);
802
+ const offsetRef = React55__namespace.default.useRef(offset);
809
803
  offsetRef.current = offset;
810
804
  const applyZoom = (next) => {
811
805
  const z = clamp(next, minZoom, maxZoom);
@@ -855,12 +849,12 @@ var ImageViewer = /* @__PURE__ */ React54__namespace.default.forwardRef(function
855
849
  if (r2) zoomAt(r2.left + r2.width / 2, r2.top + r2.height / 2, next);
856
850
  else if (applyZoom(next) <= minZoom) setOffset({ x: 0, y: 0 });
857
851
  };
858
- const mountedRef = React54__namespace.default.useRef(false);
859
- React54__namespace.default.useEffect(() => {
852
+ const mountedRef = React55__namespace.default.useRef(false);
853
+ React55__namespace.default.useEffect(() => {
860
854
  if (mountedRef.current) reset();
861
855
  else mountedRef.current = true;
862
856
  }, [src]);
863
- React54__namespace.default.useEffect(() => {
857
+ React55__namespace.default.useEffect(() => {
864
858
  const stage = stageRef.current;
865
859
  if (!stage) return void 0;
866
860
  const onWheel = (e) => {
@@ -871,9 +865,9 @@ var ImageViewer = /* @__PURE__ */ React54__namespace.default.forwardRef(function
871
865
  stage.addEventListener("wheel", onWheel, { passive: false });
872
866
  return () => stage.removeEventListener("wheel", onWheel);
873
867
  }, [step, minZoom, maxZoom, fit]);
874
- const pointers = React54__namespace.default.useRef(/* @__PURE__ */ new Map());
875
- const pinchRef = React54__namespace.default.useRef(null);
876
- const panRef = React54__namespace.default.useRef(null);
868
+ const pointers = React55__namespace.default.useRef(/* @__PURE__ */ new Map());
869
+ const pinchRef = React55__namespace.default.useRef(null);
870
+ const panRef = React55__namespace.default.useRef(null);
877
871
  const onPointerDown = (e) => {
878
872
  pointers.current.set(e.pointerId, { x: e.clientX, y: e.clientY });
879
873
  e.currentTarget.setPointerCapture?.(e.pointerId);
@@ -925,13 +919,13 @@ var ImageViewer = /* @__PURE__ */ React54__namespace.default.forwardRef(function
925
919
  };
926
920
  const canZoomIn = zoom < maxZoom, canZoomOut = zoom > minZoom;
927
921
  const api = { zoom, zoomIn: () => zoomFromCenter(zoom + step), zoomOut: () => zoomFromCenter(zoom - step), reset, canZoomIn, canZoomOut };
928
- React54__namespace.default.useImperativeHandle(ref, () => api);
929
- const onStateChangeRef = React54__namespace.default.useRef(onStateChange);
922
+ React55__namespace.default.useImperativeHandle(ref, () => api);
923
+ const onStateChangeRef = React55__namespace.default.useRef(onStateChange);
930
924
  onStateChangeRef.current = onStateChange;
931
- React54__namespace.default.useEffect(() => {
925
+ React55__namespace.default.useEffect(() => {
932
926
  onStateChangeRef.current?.({ zoom, canZoomIn, canZoomOut });
933
927
  }, [zoom, canZoomIn, canZoomOut]);
934
- React54__namespace.default.useEffect(() => {
928
+ React55__namespace.default.useEffect(() => {
935
929
  setOffset((o) => clampOffset(o, zoomRef.current));
936
930
  }, [fit]);
937
931
  const defaultControls = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-iv__controls", children: [
@@ -1025,11 +1019,11 @@ function Accordion({
1025
1019
  ...rest
1026
1020
  }) {
1027
1021
  const __twcStyles = useScopedStyles("twc-accordion-styles", ACCORDION_CSS);
1028
- const rootRef = React54__namespace.default.useRef(null);
1029
- const [internal, setInternal] = React54__namespace.default.useState(() => new Set(defaultOpen));
1022
+ const rootRef = React55__namespace.default.useRef(null);
1023
+ const [internal, setInternal] = React55__namespace.default.useState(() => new Set(defaultOpen));
1030
1024
  const open = openProp !== void 0 ? new Set(openProp) : internal;
1031
- const baseId = React54__namespace.default.useId();
1032
- const [ever, setEver] = React54__namespace.default.useState(() => new Set(open));
1025
+ const baseId = React55__namespace.default.useId();
1026
+ const [ever, setEver] = React55__namespace.default.useState(() => new Set(open));
1033
1027
  const defer = mountOnOpen || unmountOnClose;
1034
1028
  let mounted = ever;
1035
1029
  if (defer) {
@@ -1041,7 +1035,7 @@ function Accordion({
1041
1035
  }
1042
1036
  }
1043
1037
  const openKey = defer ? JSON.stringify([...open].sort()) : "";
1044
- React54__namespace.default.useEffect(() => {
1038
+ React55__namespace.default.useEffect(() => {
1045
1039
  if (!unmountOnClose) return void 0;
1046
1040
  const drop = [...ever].filter((v) => !open.has(v));
1047
1041
  if (!drop.length) return void 0;
@@ -1246,7 +1240,7 @@ function Avatar({
1246
1240
  ...rest
1247
1241
  }) {
1248
1242
  const __twcStyles = useScopedStyles("twc-avatar-styles", AVATAR_CSS);
1249
- const [errored, setErrored] = React54__namespace.default.useState(false);
1243
+ const [errored, setErrored] = React55__namespace.default.useState(false);
1250
1244
  const cleanSrc = safeSrc(src);
1251
1245
  const showImg = cleanSrc && !errored;
1252
1246
  const _statusLabel = status ? statusLabel ?? statusLabels?.[status] ?? STATUS_LABELS[status] : void 0;
@@ -1328,28 +1322,28 @@ function Menu({
1328
1322
  ...rest
1329
1323
  }) {
1330
1324
  const __twcStyles = useScopedStyles("twc-menu-styles", MENU_CSS);
1331
- const _tp = React54__namespace.default.isValidElement(trigger) ? trigger.props : {};
1325
+ const _tp = React55__namespace.default.isValidElement(trigger) ? trigger.props : {};
1332
1326
  const triggerDisabled = _tp.disabled === true || _tp["aria-disabled"] === true || _tp["aria-disabled"] === "true";
1333
- const [openState, setOpenState] = React54__namespace.default.useState(defaultOpen);
1334
- const [render, setRender] = React54__namespace.default.useState(false);
1335
- const [pos, setPos] = React54__namespace.default.useState(null);
1336
- const [active, setActive] = React54__namespace.default.useState(-1);
1337
- const wrapRef = React54__namespace.default.useRef(null);
1327
+ const [openState, setOpenState] = React55__namespace.default.useState(defaultOpen);
1328
+ const [render, setRender] = React55__namespace.default.useState(false);
1329
+ const [pos, setPos] = React55__namespace.default.useState(null);
1330
+ const [active, setActive] = React55__namespace.default.useState(-1);
1331
+ const wrapRef = React55__namespace.default.useRef(null);
1338
1332
  useTriggerAudit(wrapRef, "Menu");
1339
- const menuRef = React54__namespace.default.useRef(null);
1340
- const typeBufRef = React54__namespace.default.useRef("");
1341
- const typeTimerRef = React54__namespace.default.useRef(null);
1342
- const menuId = React54__namespace.default.useId();
1333
+ const menuRef = React55__namespace.default.useRef(null);
1334
+ const typeBufRef = React55__namespace.default.useRef("");
1335
+ const typeTimerRef = React55__namespace.default.useRef(null);
1336
+ const menuId = React55__namespace.default.useId();
1343
1337
  const headerId = `${menuId}-header`;
1344
1338
  const controlled = openProp !== void 0;
1345
1339
  const open = controlled ? !!openProp : openState;
1346
- const openRef = React54__namespace.default.useRef(open);
1340
+ const openRef = React55__namespace.default.useRef(open);
1347
1341
  openRef.current = open;
1348
- const controlledRef = React54__namespace.default.useRef(controlled);
1342
+ const controlledRef = React55__namespace.default.useRef(controlled);
1349
1343
  controlledRef.current = controlled;
1350
- const onOpenChangeRef = React54__namespace.default.useRef(onOpenChange);
1344
+ const onOpenChangeRef = React55__namespace.default.useRef(onOpenChange);
1351
1345
  onOpenChangeRef.current = onOpenChange;
1352
- const setOpen = React54__namespace.default.useCallback((next) => {
1346
+ const setOpen = React55__namespace.default.useCallback((next) => {
1353
1347
  const value = typeof next === "function" ? next(openRef.current) : next;
1354
1348
  if (value === openRef.current) return;
1355
1349
  if (!controlledRef.current) setOpenState(value);
@@ -1357,7 +1351,7 @@ function Menu({
1357
1351
  }, []);
1358
1352
  const RD = { createPortal: typeof reactDom.createPortal === "function" ? reactDom.createPortal : typeof window !== "undefined" && window.ReactDOM && window.ReactDOM.createPortal };
1359
1353
  const interactiveIdx = items.map((it, i) => !it.separator && !it.heading ? i : -1).filter((i) => i >= 0);
1360
- const place = React54__namespace.default.useCallback(() => {
1354
+ const place = React55__namespace.default.useCallback(() => {
1361
1355
  const t = wrapRef.current;
1362
1356
  if (!t) return;
1363
1357
  const r2 = t.getBoundingClientRect();
@@ -1373,7 +1367,7 @@ function Menu({
1373
1367
  setPos({ top, bottom, left, width: w, flip, maxHeight: Math.max(120, avail) });
1374
1368
  }, [align, width]);
1375
1369
  const isTop = useLayer(open && render);
1376
- React54__namespace.default.useEffect(() => {
1370
+ React55__namespace.default.useEffect(() => {
1377
1371
  if (!open) return;
1378
1372
  place();
1379
1373
  const onMove = () => place();
@@ -1392,18 +1386,18 @@ function Menu({
1392
1386
  document.removeEventListener("mousedown", onDown);
1393
1387
  };
1394
1388
  }, [open, place, isTop]);
1395
- const kbdRef = React54__namespace.default.useRef(false);
1396
- React54__namespace.default.useEffect(() => {
1389
+ const kbdRef = React55__namespace.default.useRef(false);
1390
+ React55__namespace.default.useEffect(() => {
1397
1391
  if (!open || !render || active < 0 || !kbdRef.current) return;
1398
1392
  kbdRef.current = false;
1399
1393
  const el = document.getElementById(`${menuId}-item-${active}`);
1400
1394
  if (el) el.focus();
1401
1395
  }, [open, render, active, menuId]);
1402
- const focusTrigger = React54__namespace.default.useCallback(() => {
1396
+ const focusTrigger = React55__namespace.default.useCallback(() => {
1403
1397
  const t = wrapRef.current && wrapRef.current.querySelector('button, a[href], [role="button"], [tabindex]');
1404
1398
  if (t) t.focus();
1405
1399
  }, []);
1406
- React54__namespace.default.useEffect(() => {
1400
+ React55__namespace.default.useEffect(() => {
1407
1401
  if (open) return;
1408
1402
  kbdRef.current = false;
1409
1403
  setActive(-1);
@@ -1411,7 +1405,7 @@ function Menu({
1411
1405
  if (!m || typeof document === "undefined" || !m.contains(document.activeElement)) return;
1412
1406
  focusTrigger();
1413
1407
  }, [open, focusTrigger]);
1414
- React54__namespace.default.useEffect(() => {
1408
+ React55__namespace.default.useEffect(() => {
1415
1409
  if (open) {
1416
1410
  setRender(true);
1417
1411
  return;
@@ -1544,8 +1538,8 @@ function Menu({
1544
1538
  ]
1545
1539
  }
1546
1540
  ) : null;
1547
- const fix = React54__namespace.default.isValidElement(trigger) && !triggerIsControl(trigger) ? { role: "button" } : null;
1548
- const triggerEl = React54__namespace.default.isValidElement(trigger) ? React54__namespace.default.cloneElement(trigger, {
1541
+ const fix = React55__namespace.default.isValidElement(trigger) && !triggerIsControl(trigger) ? { role: "button" } : null;
1542
+ const triggerEl = React55__namespace.default.isValidElement(trigger) ? React55__namespace.default.cloneElement(trigger, {
1549
1543
  onClick: (e) => {
1550
1544
  trigger.props.onClick?.(e);
1551
1545
  toggle();
@@ -1736,7 +1730,7 @@ function Breadcrumb({
1736
1730
  ...rest
1737
1731
  }) {
1738
1732
  const __twcStyles = useScopedStyles("twc-breadcrumb-styles", BREADCRUMB_CSS);
1739
- const [expanded, setExpanded] = React54__namespace.default.useState(false);
1733
+ const [expanded, setExpanded] = React55__namespace.default.useState(false);
1740
1734
  const sep = separator || /* @__PURE__ */ jsxRuntime.jsx(ChevronSep, {});
1741
1735
  let display = items;
1742
1736
  if (maxItems > 0 && items.length > maxItems && !expanded) {
@@ -1749,7 +1743,7 @@ function Breadcrumb({
1749
1743
  __twcStyles,
1750
1744
  display.map((it, i) => {
1751
1745
  const last = i === display.length - 1;
1752
- return /* @__PURE__ */ jsxRuntime.jsxs(React54__namespace.default.Fragment, { children: [
1746
+ return /* @__PURE__ */ jsxRuntime.jsxs(React55__namespace.default.Fragment, { children: [
1753
1747
  it.ellipsis ? /* @__PURE__ */ jsxRuntime.jsx("button", { className: "twc-breadcrumb__ellipsis", "aria-label": "Show more", onClick: () => setExpanded(true), children: "\u2026" }) : last ? /* @__PURE__ */ jsxRuntime.jsxs(
1754
1748
  "span",
1755
1749
  {
@@ -1898,7 +1892,7 @@ function safeHref5(url) {
1898
1892
  const s = String(url).replace(/[\x00-\x20]+/g, "").toLowerCase();
1899
1893
  return s.startsWith("javascript:") || s.startsWith("data:") || s.startsWith("vbscript:") ? void 0 : url;
1900
1894
  }
1901
- function Button({
1895
+ var Button = /* @__PURE__ */ React55__namespace.default.forwardRef(function Button2({
1902
1896
  children,
1903
1897
  variant = "solid",
1904
1898
  tone = "primary",
@@ -1916,9 +1910,9 @@ function Button({
1916
1910
  className = "",
1917
1911
  onClick,
1918
1912
  ...rest
1919
- }) {
1913
+ }, ref) {
1920
1914
  const __twcStyles = useScopedStyles("twc-btn-styles", CSS2);
1921
- const [ripples, setRipples] = React54__namespace.default.useState([]);
1915
+ const [ripples, setRipples] = React55__namespace.default.useState([]);
1922
1916
  const Tag2 = as;
1923
1917
  const inert = Tag2 === "a" && (disabled || loading);
1924
1918
  const softDisabled = disabled && focusableWhenDisabled && !loading && Tag2 === "button";
@@ -1940,6 +1934,7 @@ function Button({
1940
1934
  return /* @__PURE__ */ jsxRuntime.jsxs(
1941
1935
  Tag2,
1942
1936
  {
1937
+ ref,
1943
1938
  className: `twc-btn ${className}`,
1944
1939
  "data-variant": variant,
1945
1940
  "data-tone": tone,
@@ -1975,7 +1970,7 @@ function Button({
1975
1970
  ]
1976
1971
  }
1977
1972
  );
1978
- }
1973
+ });
1979
1974
  var UNITLESS = /* @__PURE__ */ new Set([
1980
1975
  "animationIterationCount",
1981
1976
  "aspectRatio",
@@ -2148,9 +2143,9 @@ function buildSx(sx, uid) {
2148
2143
  return { flatStyle, css };
2149
2144
  }
2150
2145
  function useSx(sx) {
2151
- const rawId = React54__namespace.default.useId();
2146
+ const rawId = React55__namespace.default.useId();
2152
2147
  const uid = `sx${rawId.replace(/[^a-zA-Z0-9]/g, "")}`;
2153
- const { flatStyle, css } = React54__namespace.default.useMemo(() => buildSx(sx, uid), [sx, uid]);
2148
+ const { flatStyle, css } = React55__namespace.default.useMemo(() => buildSx(sx, uid), [sx, uid]);
2154
2149
  const styleNode = useScopedStyles(`twc-sx-${uid}`, css);
2155
2150
  return { flatStyle, styleNode, sxAttr: css ? uid : void 0 };
2156
2151
  }
@@ -2286,14 +2281,14 @@ function Carousel({
2286
2281
  ...rest
2287
2282
  }) {
2288
2283
  const __twcStyles = useScopedStyles("twc-carousel-styles", CAROUSEL_CSS);
2289
- const slides = React54__namespace.default.Children.toArray(children);
2284
+ const slides = React55__namespace.default.Children.toArray(children);
2290
2285
  const count = slides.length;
2291
- const [internal, setInternal] = React54__namespace.default.useState(defaultIndex);
2286
+ const [internal, setInternal] = React55__namespace.default.useState(defaultIndex);
2292
2287
  const index = indexProp !== void 0 ? indexProp : internal;
2293
- const [paused, setPaused] = React54__namespace.default.useState(false);
2294
- const [userPaused, setUserPaused] = React54__namespace.default.useState(false);
2295
- const [prefersReduced, setPrefersReduced] = React54__namespace.default.useState(false);
2296
- React54__namespace.default.useEffect(() => {
2288
+ const [paused, setPaused] = React55__namespace.default.useState(false);
2289
+ const [userPaused, setUserPaused] = React55__namespace.default.useState(false);
2290
+ const [prefersReduced, setPrefersReduced] = React55__namespace.default.useState(false);
2291
+ React55__namespace.default.useEffect(() => {
2297
2292
  if (typeof window === "undefined" || !window.matchMedia) return void 0;
2298
2293
  const mql = window.matchMedia("(prefers-reduced-motion: reduce)");
2299
2294
  const on = () => setPrefersReduced(mql.matches);
@@ -2301,16 +2296,16 @@ function Carousel({
2301
2296
  mql.addEventListener("change", on);
2302
2297
  return () => mql.removeEventListener("change", on);
2303
2298
  }, []);
2304
- const setIndex = React54__namespace.default.useCallback((i) => {
2299
+ const setIndex = React55__namespace.default.useCallback((i) => {
2305
2300
  if (indexProp === void 0) setInternal(i);
2306
2301
  onIndexChange?.(i);
2307
2302
  }, [indexProp, onIndexChange]);
2308
- const go = React54__namespace.default.useCallback((i) => {
2303
+ const go = React55__namespace.default.useCallback((i) => {
2309
2304
  if (count <= 0) return;
2310
2305
  setIndex(loop ? (i % count + count) % count : Math.min(Math.max(i, 0), count - 1));
2311
2306
  }, [count, loop, setIndex]);
2312
2307
  const autoRotating = autoPlay && !paused && !userPaused && !prefersReduced && count > 1;
2313
- React54__namespace.default.useEffect(() => {
2308
+ React55__namespace.default.useEffect(() => {
2314
2309
  if (!autoRotating) return void 0;
2315
2310
  const t = setInterval(() => {
2316
2311
  const next = loop ? (index + 1) % count : index + 1 >= count ? index : index + 1;
@@ -2570,7 +2565,7 @@ var CHART_BASE_CSS = `
2570
2565
  }
2571
2566
  `;
2572
2567
  function ChartTable({ id, caption, columns, rows }) {
2573
- const h = React54__namespace.default.createElement;
2568
+ const h = React55__namespace.default.createElement;
2574
2569
  return h(
2575
2570
  "table",
2576
2571
  { className: "twc-chart__sr", id },
@@ -2600,7 +2595,7 @@ function ChartTable({ id, caption, columns, rows }) {
2600
2595
  );
2601
2596
  }
2602
2597
  function ChartLegend({ items, onToggle, hidden, onFocus, onBlur }) {
2603
- const h = React54__namespace.default.createElement;
2598
+ const h = React55__namespace.default.createElement;
2604
2599
  return h(
2605
2600
  "div",
2606
2601
  { className: "twc-chart__legend" },
@@ -2631,23 +2626,23 @@ function ChartLegend({ items, onToggle, hidden, onFocus, onBlur }) {
2631
2626
  );
2632
2627
  }
2633
2628
  function useChartTooltip() {
2634
- const containerRef = React54__namespace.default.useRef(null);
2635
- const [tip, setTip] = React54__namespace.default.useState(null);
2636
- const show = React54__namespace.default.useCallback((content, e) => {
2629
+ const containerRef = React55__namespace.default.useRef(null);
2630
+ const [tip, setTip] = React55__namespace.default.useState(null);
2631
+ const show = React55__namespace.default.useCallback((content, e) => {
2637
2632
  const el = containerRef.current;
2638
2633
  const rect = el && el.getBoundingClientRect ? el.getBoundingClientRect() : null;
2639
2634
  const left = rect ? e.clientX - rect.left : 0;
2640
2635
  const top = rect ? e.clientY - rect.top : 0;
2641
2636
  setTip({ title: content.title, items: content.items || [], left, top });
2642
2637
  }, []);
2643
- const hide = React54__namespace.default.useCallback(() => setTip(null), []);
2638
+ const hide = React55__namespace.default.useCallback(() => setTip(null), []);
2644
2639
  return { containerRef, tip, show, hide };
2645
2640
  }
2646
2641
  function ChartTooltip({ tip }) {
2647
- const h = React54__namespace.default.createElement;
2648
- const ref = React54__namespace.default.useRef(null);
2649
- const [pos, setPos] = React54__namespace.default.useState({ dx: 0, below: false });
2650
- React54__namespace.default.useLayoutEffect(() => {
2642
+ const h = React55__namespace.default.createElement;
2643
+ const ref = React55__namespace.default.useRef(null);
2644
+ const [pos, setPos] = React55__namespace.default.useState({ dx: 0, below: false });
2645
+ React55__namespace.default.useLayoutEffect(() => {
2651
2646
  const el = ref.current;
2652
2647
  if (!tip || !el) return;
2653
2648
  const parent = el.offsetParent;
@@ -2724,17 +2719,17 @@ function Chart({
2724
2719
  }) {
2725
2720
  const baseStyles = useScopedStyles("twc-chart-base", CHART_BASE_CSS);
2726
2721
  const styles = useScopedStyles("twc-chart-styles", CHART_CSS);
2727
- const uid = React54__namespace.default.useId();
2722
+ const uid = React55__namespace.default.useId();
2728
2723
  const gid = uid.replace(/[^a-zA-Z0-9]/g, "");
2729
2724
  const tableId = tableFallback ? `${uid}-table` : void 0;
2730
2725
  const { containerRef, tip, show, hide } = useChartTooltip();
2731
- const [hidden, setHidden] = React54__namespace.default.useState(() => /* @__PURE__ */ new Set());
2732
- const [focusSeries, setFocusSeries] = React54__namespace.default.useState(null);
2733
- const [selected, setSelected] = React54__namespace.default.useState(null);
2734
- const [hoverIdx, setHoverIdx] = React54__namespace.default.useState(null);
2735
- const [zoom, setZoom] = React54__namespace.default.useState(null);
2736
- const [drag, setDrag] = React54__namespace.default.useState(null);
2737
- const svgRef = React54__namespace.default.useRef(null);
2726
+ const [hidden, setHidden] = React55__namespace.default.useState(() => /* @__PURE__ */ new Set());
2727
+ const [focusSeries, setFocusSeries] = React55__namespace.default.useState(null);
2728
+ const [selected, setSelected] = React55__namespace.default.useState(null);
2729
+ const [hoverIdx, setHoverIdx] = React55__namespace.default.useState(null);
2730
+ const [zoom, setZoom] = React55__namespace.default.useState(null);
2731
+ const [drag, setDrag] = React55__namespace.default.useState(null);
2732
+ const svgRef = React55__namespace.default.useRef(null);
2738
2733
  const isBar = type === "bar" || type === "column";
2739
2734
  const isArea = type === "area";
2740
2735
  const crv = smooth ? "smooth" : curve;
@@ -2839,7 +2834,7 @@ function Chart({
2839
2834
  onDataClick({ label: d.label, series: null, seriesIndex: -1, value: void 0, index: baseIdx + idx, row: d });
2840
2835
  selectMark(`${idx}:*`);
2841
2836
  };
2842
- React54__namespace.default.useEffect(() => {
2837
+ React55__namespace.default.useEffect(() => {
2843
2838
  if (!zoomable) return void 0;
2844
2839
  const svg = svgRef.current;
2845
2840
  if (!svg) return void 0;
@@ -3149,12 +3144,12 @@ function PieChart({
3149
3144
  }) {
3150
3145
  const baseStyles = useScopedStyles("twc-chart-base", CHART_BASE_CSS);
3151
3146
  const styles = useScopedStyles("twc-piechart-styles", CHART_CSS2);
3152
- const uid = React54__namespace.default.useId();
3147
+ const uid = React55__namespace.default.useId();
3153
3148
  const tableId = tableFallback ? `${uid}-table` : void 0;
3154
3149
  const { containerRef, tip, show, hide } = useChartTooltip();
3155
- const [active, setActive] = React54__namespace.default.useState(null);
3156
- const [focus, setFocus] = React54__namespace.default.useState(null);
3157
- const [selected, setSelected] = React54__namespace.default.useState(null);
3150
+ const [active, setActive] = React55__namespace.default.useState(null);
3151
+ const [focus, setFocus] = React55__namespace.default.useState(null);
3152
+ const [selected, setSelected] = React55__namespace.default.useState(null);
3158
3153
  const clickable = !!onDataClick;
3159
3154
  const rows = data || [];
3160
3155
  const fmt = valueFormat || fmtNumber;
@@ -3303,11 +3298,11 @@ function Gauge({
3303
3298
  }) {
3304
3299
  const baseStyles = useScopedStyles("twc-chart-base", CHART_BASE_CSS);
3305
3300
  const styles = useScopedStyles("twc-gauge-styles", GAUGE_CSS);
3306
- const uid = React54__namespace.default.useId();
3301
+ const uid = React55__namespace.default.useId();
3307
3302
  const tableId = tableFallback ? `${uid}-table` : void 0;
3308
3303
  const { containerRef, tip, show, hide } = useChartTooltip();
3309
- const [selected, setSelected] = React54__namespace.default.useState(null);
3310
- const [focus, setFocus] = React54__namespace.default.useState(null);
3304
+ const [selected, setSelected] = React55__namespace.default.useState(null);
3305
+ const [focus, setFocus] = React55__namespace.default.useState(null);
3311
3306
  const fmt = valueFormat || ((n) => String(Math.round(Number(n) || 0)));
3312
3307
  const cx = size / 2, cy = size / 2;
3313
3308
  const span = endAngle - startAngle;
@@ -3468,11 +3463,11 @@ function Sparkline({
3468
3463
  }) {
3469
3464
  const baseStyles = useScopedStyles("twc-chart-base", CHART_BASE_CSS);
3470
3465
  const styles = useScopedStyles("twc-sparkline-styles", SPARK_CSS);
3471
- const uid = React54__namespace.default.useId();
3466
+ const uid = React55__namespace.default.useId();
3472
3467
  const tableId = tableFallback ? `${uid}-table` : void 0;
3473
3468
  const { containerRef, tip, show, hide } = useChartTooltip();
3474
- const [hover, setHover] = React54__namespace.default.useState(null);
3475
- const [selected, setSelected] = React54__namespace.default.useState(null);
3469
+ const [hover, setHover] = React55__namespace.default.useState(null);
3470
+ const [selected, setSelected] = React55__namespace.default.useState(null);
3476
3471
  const clickable = !!onDataClick;
3477
3472
  const kind = area ? "area" : type;
3478
3473
  const isBar = kind === "bar";
@@ -3672,17 +3667,17 @@ function ScatterChart({
3672
3667
  }) {
3673
3668
  const baseStyles = useScopedStyles("twc-chart-base", CHART_BASE_CSS);
3674
3669
  const styles = useScopedStyles("twc-scatter-styles", SCATTER_CSS);
3675
- const uid = React54__namespace.default.useId();
3670
+ const uid = React55__namespace.default.useId();
3676
3671
  const gid = uid.replace(/[^a-zA-Z0-9]/g, "");
3677
3672
  const clipId = `twc-sc-clip-${gid}`;
3678
3673
  const tableId = tableFallback ? `${uid}-table` : void 0;
3679
3674
  const { containerRef, tip, show, hide } = useChartTooltip();
3680
- const [focus, setFocus] = React54__namespace.default.useState(null);
3681
- const [selected, setSelected] = React54__namespace.default.useState(null);
3682
- const [zoom, setZoom] = React54__namespace.default.useState(null);
3683
- const [drag, setDrag] = React54__namespace.default.useState(null);
3684
- const svgRef = React54__namespace.default.useRef(null);
3685
- const movedRef = React54__namespace.default.useRef(false);
3675
+ const [focus, setFocus] = React55__namespace.default.useState(null);
3676
+ const [selected, setSelected] = React55__namespace.default.useState(null);
3677
+ const [zoom, setZoom] = React55__namespace.default.useState(null);
3678
+ const [drag, setDrag] = React55__namespace.default.useState(null);
3679
+ const svgRef = React55__namespace.default.useRef(null);
3680
+ const movedRef = React55__namespace.default.useRef(false);
3686
3681
  const list = Array.isArray(series) ? series : [];
3687
3682
  const vFmt = valueFormat || fmtNumber;
3688
3683
  const xFmt = xFormat || vFmt;
@@ -3855,7 +3850,7 @@ function ScatterChart({
3855
3850
  selectPoint(hit.key);
3856
3851
  }
3857
3852
  };
3858
- React54__namespace.default.useEffect(() => {
3853
+ React55__namespace.default.useEffect(() => {
3859
3854
  if (!canZoom) return void 0;
3860
3855
  const svg = svgRef.current;
3861
3856
  if (!svg) return void 0;
@@ -4041,11 +4036,11 @@ function RadarChart({
4041
4036
  }) {
4042
4037
  const baseStyles = useScopedStyles("twc-chart-base", CHART_BASE_CSS);
4043
4038
  const styles = useScopedStyles("twc-radarchart-styles", CHART_CSS3);
4044
- const uid = React54__namespace.default.useId();
4039
+ const uid = React55__namespace.default.useId();
4045
4040
  const tableId = tableFallback ? `${uid}-table` : void 0;
4046
4041
  const { containerRef, tip, show, hide } = useChartTooltip();
4047
- const [focus, setFocus] = React54__namespace.default.useState(null);
4048
- const [selected, setSelected] = React54__namespace.default.useState(null);
4042
+ const [focus, setFocus] = React55__namespace.default.useState(null);
4043
+ const [selected, setSelected] = React55__namespace.default.useState(null);
4049
4044
  const rows = data || [];
4050
4045
  const keys = series && series.length ? series : ["value"];
4051
4046
  const fmt = valueFormat || fmtNumber;
@@ -4195,12 +4190,12 @@ function PolarAreaChart({
4195
4190
  }) {
4196
4191
  const baseStyles = useScopedStyles("twc-chart-base", CHART_BASE_CSS);
4197
4192
  const styles = useScopedStyles("twc-polar-styles", CHART_CSS4);
4198
- const uid = React54__namespace.default.useId();
4193
+ const uid = React55__namespace.default.useId();
4199
4194
  const tableId = tableFallback ? `${uid}-table` : void 0;
4200
4195
  const { containerRef, tip, show, hide } = useChartTooltip();
4201
- const [active, setActive] = React54__namespace.default.useState(null);
4202
- const [focus, setFocus] = React54__namespace.default.useState(null);
4203
- const [selected, setSelected] = React54__namespace.default.useState(null);
4196
+ const [active, setActive] = React55__namespace.default.useState(null);
4197
+ const [focus, setFocus] = React55__namespace.default.useState(null);
4198
+ const [selected, setSelected] = React55__namespace.default.useState(null);
4204
4199
  const rows = data || [];
4205
4200
  const n = rows.length;
4206
4201
  const fmt = valueFormat || fmtNumber;
@@ -4350,15 +4345,15 @@ function Heatmap({
4350
4345
  }) {
4351
4346
  const baseStyles = useScopedStyles("twc-chart-base", CHART_BASE_CSS);
4352
4347
  const styles = useScopedStyles("twc-heatmap-styles", HEATMAP_CSS);
4353
- const uid = React54__namespace.default.useId();
4348
+ const uid = React55__namespace.default.useId();
4354
4349
  const tableId = tableFallback ? `${uid}-table` : void 0;
4355
4350
  const { containerRef, tip, show, hide } = useChartTooltip();
4356
- const [hovered, setHovered] = React54__namespace.default.useState(null);
4357
- const [selected, setSelected] = React54__namespace.default.useState(null);
4358
- const [zoom, setZoom] = React54__namespace.default.useState(null);
4359
- const [drag, setDrag] = React54__namespace.default.useState(null);
4360
- const svgRef = React54__namespace.default.useRef(null);
4361
- const movedRef = React54__namespace.default.useRef(false);
4351
+ const [hovered, setHovered] = React55__namespace.default.useState(null);
4352
+ const [selected, setSelected] = React55__namespace.default.useState(null);
4353
+ const [zoom, setZoom] = React55__namespace.default.useState(null);
4354
+ const [drag, setDrag] = React55__namespace.default.useState(null);
4355
+ const svgRef = React55__namespace.default.useRef(null);
4356
+ const movedRef = React55__namespace.default.useRef(false);
4362
4357
  const clickable = !!onDataClick;
4363
4358
  const selectMark = (key) => setSelected((s) => s === key ? null : key);
4364
4359
  const rows = Array.isArray(data) ? data : [];
@@ -4521,7 +4516,7 @@ function Heatmap({
4521
4516
  selectMark(cell.key);
4522
4517
  }
4523
4518
  };
4524
- React54__namespace.default.useEffect(() => {
4519
+ React55__namespace.default.useEffect(() => {
4525
4520
  if (!canZoom) return void 0;
4526
4521
  const svg = svgRef.current;
4527
4522
  if (!svg) return void 0;
@@ -4691,11 +4686,11 @@ function FunnelChart({
4691
4686
  }) {
4692
4687
  const baseStyles = useScopedStyles("twc-chart-base", CHART_BASE_CSS);
4693
4688
  const styles = useScopedStyles("twc-funnel-styles", FUNNEL_CSS);
4694
- const uid = React54__namespace.default.useId();
4689
+ const uid = React55__namespace.default.useId();
4695
4690
  const tableId = tableFallback ? `${uid}-table` : void 0;
4696
4691
  const { containerRef, tip, show, hide } = useChartTooltip();
4697
- const [active, setActive] = React54__namespace.default.useState(null);
4698
- const [selected, setSelected] = React54__namespace.default.useState(null);
4692
+ const [active, setActive] = React55__namespace.default.useState(null);
4693
+ const [selected, setSelected] = React55__namespace.default.useState(null);
4699
4694
  const clickable = !!onDataClick;
4700
4695
  const rows = data || [];
4701
4696
  const n = rows.length;
@@ -4813,11 +4808,11 @@ function Treemap({
4813
4808
  }) {
4814
4809
  const baseStyles = useScopedStyles("twc-chart-base", CHART_BASE_CSS);
4815
4810
  const styles = useScopedStyles("twc-treemap-styles", TREEMAP_CSS);
4816
- const uid = React54__namespace.default.useId();
4811
+ const uid = React55__namespace.default.useId();
4817
4812
  const tableId = tableFallback ? `${uid}-table` : void 0;
4818
4813
  const { containerRef, tip, show, hide } = useChartTooltip();
4819
- const [hovered, setHovered] = React54__namespace.default.useState(null);
4820
- const [selected, setSelected] = React54__namespace.default.useState(null);
4814
+ const [hovered, setHovered] = React55__namespace.default.useState(null);
4815
+ const [selected, setSelected] = React55__namespace.default.useState(null);
4821
4816
  const rows = data || [];
4822
4817
  const fmt = valueFormat || fmtNumber;
4823
4818
  const svgAriaLabel = ariaLabelProp ?? ariaLabel ?? "treemap";
@@ -4975,13 +4970,13 @@ function Candlestick({
4975
4970
  }) {
4976
4971
  const baseStyles = useScopedStyles("twc-chart-base", CHART_BASE_CSS);
4977
4972
  const styles = useScopedStyles("twc-candlestick-styles", CANDLE_CSS);
4978
- const uid = React54__namespace.default.useId();
4973
+ const uid = React55__namespace.default.useId();
4979
4974
  const tableId = tableFallback ? `${uid}-table` : void 0;
4980
4975
  const { containerRef, tip, show, hide } = useChartTooltip();
4981
- const [selected, setSelected] = React54__namespace.default.useState(null);
4982
- const [zoom, setZoom] = React54__namespace.default.useState(null);
4983
- const [drag, setDrag] = React54__namespace.default.useState(null);
4984
- const svgRef = React54__namespace.default.useRef(null);
4976
+ const [selected, setSelected] = React55__namespace.default.useState(null);
4977
+ const [zoom, setZoom] = React55__namespace.default.useState(null);
4978
+ const [drag, setDrag] = React55__namespace.default.useState(null);
4979
+ const svgRef = React55__namespace.default.useRef(null);
4985
4980
  const fmt = valueFormat || fmtNumber;
4986
4981
  const clickable = !!onDataClick;
4987
4982
  const allRows = data || [];
@@ -5082,7 +5077,7 @@ function Candlestick({
5082
5077
  clickCandle(rows[idx], baseIdx + idx);
5083
5078
  selectMark(baseIdx + idx);
5084
5079
  };
5085
- React54__namespace.default.useEffect(() => {
5080
+ React55__namespace.default.useEffect(() => {
5086
5081
  if (!zoomable) return void 0;
5087
5082
  const svg = svgRef.current;
5088
5083
  if (!svg) return void 0;
@@ -5278,13 +5273,13 @@ function Boxplot({
5278
5273
  }) {
5279
5274
  const baseStyles = useScopedStyles("twc-chart-base", CHART_BASE_CSS);
5280
5275
  const styles = useScopedStyles("twc-boxplot-styles", CHART_CSS5);
5281
- const uid = React54__namespace.default.useId();
5276
+ const uid = React55__namespace.default.useId();
5282
5277
  const tableId = tableFallback ? `${uid}-table` : void 0;
5283
5278
  const { containerRef, tip, show, hide } = useChartTooltip();
5284
- const [selected, setSelected] = React54__namespace.default.useState(null);
5285
- const [zoom, setZoom] = React54__namespace.default.useState(null);
5286
- const [drag, setDrag] = React54__namespace.default.useState(null);
5287
- const svgRef = React54__namespace.default.useRef(null);
5279
+ const [selected, setSelected] = React55__namespace.default.useState(null);
5280
+ const [zoom, setZoom] = React55__namespace.default.useState(null);
5281
+ const [drag, setDrag] = React55__namespace.default.useState(null);
5282
+ const svgRef = React55__namespace.default.useRef(null);
5288
5283
  const allRows = data || [];
5289
5284
  const baseIdx = zoom ? zoom.s : 0;
5290
5285
  const rows = zoom ? allRows.slice(zoom.s, zoom.e + 1) : allRows;
@@ -5384,7 +5379,7 @@ function Boxplot({
5384
5379
  if (idx == null) return;
5385
5380
  clickBox(rows[idx], idx);
5386
5381
  };
5387
- React54__namespace.default.useEffect(() => {
5382
+ React55__namespace.default.useEffect(() => {
5388
5383
  if (!zoomable) return void 0;
5389
5384
  const svg = svgRef.current;
5390
5385
  if (!svg) return void 0;
@@ -5545,13 +5540,13 @@ function RangeChart({
5545
5540
  }) {
5546
5541
  const baseStyles = useScopedStyles("twc-chart-base", CHART_BASE_CSS);
5547
5542
  const styles = useScopedStyles("twc-rangechart-styles", RANGE_CSS);
5548
- const uid = React54__namespace.default.useId();
5543
+ const uid = React55__namespace.default.useId();
5549
5544
  const tableId = tableFallback ? `${uid}-table` : void 0;
5550
5545
  const { containerRef, tip, show, hide } = useChartTooltip();
5551
- const [selected, setSelected] = React54__namespace.default.useState(null);
5552
- const [zoom, setZoom] = React54__namespace.default.useState(null);
5553
- const [drag, setDrag] = React54__namespace.default.useState(null);
5554
- const svgRef = React54__namespace.default.useRef(null);
5546
+ const [selected, setSelected] = React55__namespace.default.useState(null);
5547
+ const [zoom, setZoom] = React55__namespace.default.useState(null);
5548
+ const [drag, setDrag] = React55__namespace.default.useState(null);
5549
+ const svgRef = React55__namespace.default.useRef(null);
5555
5550
  const isArea = type === "area";
5556
5551
  const clickable = !!onDataClick;
5557
5552
  const fmt = valueFormat || fmtNumber;
@@ -5646,7 +5641,7 @@ function RangeChart({
5646
5641
  if (idx == null) return;
5647
5642
  clickAt(idx);
5648
5643
  };
5649
- React54__namespace.default.useEffect(() => {
5644
+ React55__namespace.default.useEffect(() => {
5650
5645
  if (!zoomable) return void 0;
5651
5646
  const svg = svgRef.current;
5652
5647
  if (!svg) return void 0;
@@ -5834,7 +5829,25 @@ function RangeChart({
5834
5829
  function labelText7(label) {
5835
5830
  return typeof label === "string" || typeof label === "number" ? String(label) : "";
5836
5831
  }
5837
- function Checkbox({
5832
+ function useMergedRef(...refs) {
5833
+ return React55__namespace.useCallback((node) => {
5834
+ const cleanups = [];
5835
+ for (const r2 of refs) {
5836
+ if (typeof r2 === "function") {
5837
+ const cleanup = r2(node);
5838
+ if (typeof cleanup === "function") cleanups.push(cleanup);
5839
+ } else if (r2 && typeof r2 === "object") {
5840
+ r2.current = node;
5841
+ }
5842
+ }
5843
+ if (cleanups.length === 0) return void 0;
5844
+ return () => {
5845
+ for (const r2 of refs) if (r2 && typeof r2 === "object") r2.current = null;
5846
+ for (const cleanup of cleanups) cleanup();
5847
+ };
5848
+ }, refs);
5849
+ }
5850
+ var Checkbox = /* @__PURE__ */ React55__namespace.default.forwardRef(function Checkbox2({
5838
5851
  label,
5839
5852
  description,
5840
5853
  error,
@@ -5849,7 +5862,7 @@ function Checkbox({
5849
5862
  className = "",
5850
5863
  onChange,
5851
5864
  ...rest
5852
- }) {
5865
+ }, forwardedRef) {
5853
5866
  const __twcStyles = useScopedStyles("twc-checkbox-styles", `
5854
5867
  .twc-check { display: inline-flex; align-items: flex-start; gap: var(--space-2-5); cursor: pointer; font-family: var(--font-sans); }
5855
5868
  /* tone \u2192 accent set (default primary). Mirrors Button's --_accent model; Badge's tone vocabulary. */
@@ -5890,13 +5903,14 @@ function Checkbox({
5890
5903
  .twc-field { display: flex; flex-direction: column; gap: var(--space-1-5); font-family: var(--font-sans); }
5891
5904
  .twc-field__error { font-size: var(--text-xs); color: var(--color-danger-subtle-fg); font-weight: var(--font-medium); }
5892
5905
  `);
5893
- const autoId = React54__namespace.default.useId();
5906
+ const autoId = React55__namespace.default.useId();
5894
5907
  const fieldId = id || autoId;
5895
5908
  const errId = `${fieldId}-error`;
5896
5909
  const invalid = Boolean(error);
5897
- const ref = React54__namespace.default.useRef(null);
5910
+ const ref = React55__namespace.default.useRef(null);
5911
+ const setRef = useMergedRef(ref, forwardedRef);
5898
5912
  const mixed = indeterminate && !checked;
5899
- React54__namespace.default.useEffect(() => {
5913
+ React55__namespace.default.useEffect(() => {
5900
5914
  if (ref.current) ref.current.indeterminate = mixed;
5901
5915
  }, [mixed]);
5902
5916
  if (process.env.NODE_ENV !== "production" && !label && !description && !rest["aria-label"] && !rest["aria-labelledby"]) {
@@ -5908,7 +5922,7 @@ function Checkbox({
5908
5922
  /* @__PURE__ */ jsxRuntime.jsx(
5909
5923
  "input",
5910
5924
  {
5911
- ref,
5925
+ ref: setRef,
5912
5926
  id: fieldId,
5913
5927
  type: "checkbox",
5914
5928
  className: "twc-check__input",
@@ -5938,7 +5952,7 @@ function Checkbox({
5938
5952
  control,
5939
5953
  /* @__PURE__ */ jsxRuntime.jsx("span", { id: errId, className: "twc-field__error", children: error })
5940
5954
  ] });
5941
- }
5955
+ });
5942
5956
  var FIELD_CSS = `
5943
5957
  .twc-field { display: flex; flex-direction: column; gap: var(--space-1-5); font-family: var(--font-sans); }
5944
5958
  .twc-field__label { font-size: var(--text-sm); font-weight: var(--font-semibold); color: var(--color-text); display: flex; gap: 4px; align-items: center; }
@@ -6056,22 +6070,22 @@ function ColorPicker({
6056
6070
  }) {
6057
6071
  const __twcStyles0 = useScopedStyles("twc-field-styles", FIELD_CSS);
6058
6072
  const __twcStyles1 = useScopedStyles("twc-colorpicker-styles", COLORPICKER_CSS);
6059
- const [internal, setInternal] = React54__namespace.default.useState(defaultValue);
6073
+ const [internal, setInternal] = React55__namespace.default.useState(defaultValue);
6060
6074
  const hex = (value !== void 0 ? value : internal) || "#000000";
6061
6075
  const hexRe = alpha ? /^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i : /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;
6062
- const lastValidRef = React54__namespace.default.useRef(hex);
6076
+ const lastValidRef = React55__namespace.default.useRef(hex);
6063
6077
  if (hexRe.test(hex)) lastValidRef.current = hex;
6064
- const [open, setOpen] = React54__namespace.default.useState(false);
6065
- const [hsv, setHsv] = React54__namespace.default.useState(() => hexToHsv(hex) || { h: 239, s: 60, v: 94, a: 1 });
6066
- const [coords, setCoords] = React54__namespace.default.useState(null);
6067
- const wrapRef = React54__namespace.default.useRef(null);
6068
- const triggerRef = React54__namespace.default.useRef(null);
6069
- const popRef = React54__namespace.default.useRef(null);
6070
- const areaRef = React54__namespace.default.useRef(null);
6071
- const hueRef = React54__namespace.default.useRef(null);
6072
- const alphaRef = React54__namespace.default.useRef(null);
6078
+ const [open, setOpen] = React55__namespace.default.useState(false);
6079
+ const [hsv, setHsv] = React55__namespace.default.useState(() => hexToHsv(hex) || { h: 239, s: 60, v: 94, a: 1 });
6080
+ const [coords, setCoords] = React55__namespace.default.useState(null);
6081
+ const wrapRef = React55__namespace.default.useRef(null);
6082
+ const triggerRef = React55__namespace.default.useRef(null);
6083
+ const popRef = React55__namespace.default.useRef(null);
6084
+ const areaRef = React55__namespace.default.useRef(null);
6085
+ const hueRef = React55__namespace.default.useRef(null);
6086
+ const alphaRef = React55__namespace.default.useRef(null);
6073
6087
  const POP_W = 240;
6074
- const place = React54__namespace.default.useCallback(() => {
6088
+ const place = React55__namespace.default.useCallback(() => {
6075
6089
  const el = triggerRef.current;
6076
6090
  if (!el) return;
6077
6091
  const r2 = el.getBoundingClientRect();
@@ -6082,7 +6096,7 @@ function ColorPicker({
6082
6096
  left = Math.max(8, left);
6083
6097
  setCoords({ left, top: flip ? void 0 : Math.round(r2.bottom + 6), bottom: flip ? Math.round(vh - r2.top + 6) : void 0 });
6084
6098
  }, []);
6085
- React54__namespace.default.useEffect(() => {
6099
+ React55__namespace.default.useEffect(() => {
6086
6100
  if (!open) return void 0;
6087
6101
  place();
6088
6102
  const onMove = () => place();
@@ -6100,17 +6114,17 @@ function ColorPicker({
6100
6114
  ro?.disconnect();
6101
6115
  };
6102
6116
  }, [open, place]);
6103
- const labelId = React54__namespace.default.useId();
6117
+ const labelId = React55__namespace.default.useId();
6104
6118
  const descId = `${labelId}-desc`;
6105
6119
  const invalid = Boolean(error);
6106
- React54__namespace.default.useEffect(() => {
6120
+ React55__namespace.default.useEffect(() => {
6107
6121
  if (disabled) setOpen(false);
6108
6122
  }, [disabled]);
6109
- React54__namespace.default.useEffect(() => {
6123
+ React55__namespace.default.useEffect(() => {
6110
6124
  const v = hexToHsv(hex);
6111
6125
  if (v && hsvToHex(v.h, v.s, v.v).toLowerCase() !== hsvToHex(hsv.h, hsv.s, hsv.v).toLowerCase()) setHsv(v);
6112
6126
  }, [hex]);
6113
- React54__namespace.default.useEffect(() => {
6127
+ React55__namespace.default.useEffect(() => {
6114
6128
  if (!open) return;
6115
6129
  const onDown = (e) => {
6116
6130
  if (wrapRef.current && wrapRef.current.contains(e.target)) return;
@@ -6460,7 +6474,7 @@ function ensureVisible(list, el) {
6460
6474
  if (top < list.scrollTop) list.scrollTop = top - 4;
6461
6475
  else if (bottom > list.scrollTop + list.clientHeight) list.scrollTop = bottom - list.clientHeight + 4;
6462
6476
  }
6463
- function Combobox({
6477
+ var Combobox = /* @__PURE__ */ React55__namespace.default.forwardRef(function Combobox2({
6464
6478
  label,
6465
6479
  hint,
6466
6480
  error,
@@ -6493,38 +6507,39 @@ function Combobox({
6493
6507
  onFocus,
6494
6508
  onKeyDown,
6495
6509
  ...rest
6496
- }) {
6510
+ }, ref) {
6497
6511
  const __twcStyles = useScopedStyles("twc-combo-styles", COMBO_CSS);
6498
6512
  if (virtualizedProp && (wrapOptions || renderOption)) warnOnce("combobox-var-height-virtualized", "twico-ui Combobox: `wrapOptions`/`renderOption` disable `virtualized` \u2014 those rows aren't a fixed height.");
6499
6513
  const virtualized = virtualizedProp && !wrapOptions && !renderOption;
6500
- const groups = React54__namespace.default.useMemo(() => normalizeGroups(options), [options]);
6501
- const flat = React54__namespace.default.useMemo(() => groups.flatMap((g) => g.options), [groups]);
6502
- const autoId = React54__namespace.default.useId();
6514
+ const groups = React55__namespace.default.useMemo(() => normalizeGroups(options), [options]);
6515
+ const flat = React55__namespace.default.useMemo(() => groups.flatMap((g) => g.options), [groups]);
6516
+ const autoId = React55__namespace.default.useId();
6503
6517
  const fieldId = id || autoId;
6504
- const [internal, setInternal] = React54__namespace.default.useState(defaultValue);
6518
+ const [internal, setInternal] = React55__namespace.default.useState(defaultValue);
6505
6519
  const current = value !== void 0 ? value : internal;
6506
6520
  const selected = flat.find((o) => o.value === current);
6507
- const [open, setOpen] = React54__namespace.default.useState(false);
6508
- const [query, setQuery] = React54__namespace.default.useState("");
6509
- const [active, setActive] = React54__namespace.default.useState(0);
6510
- const [coords, setCoords] = React54__namespace.default.useState(null);
6511
- const [scrollTop, setScrollTop] = React54__namespace.default.useState(0);
6512
- const [listH, setListH] = React54__namespace.default.useState(260);
6513
- const wrapRef = React54__namespace.default.useRef(null);
6514
- const controlRef = React54__namespace.default.useRef(null);
6515
- const inputRef = React54__namespace.default.useRef(null);
6516
- const popRef = React54__namespace.default.useRef(null);
6517
- const listRef = React54__namespace.default.useRef(null);
6518
- const activeRef = React54__namespace.default.useRef(null);
6519
- const fGroups = React54__namespace.default.useMemo(() => {
6521
+ const [open, setOpen] = React55__namespace.default.useState(false);
6522
+ const [query, setQuery] = React55__namespace.default.useState("");
6523
+ const [active, setActive] = React55__namespace.default.useState(0);
6524
+ const [coords, setCoords] = React55__namespace.default.useState(null);
6525
+ const [scrollTop, setScrollTop] = React55__namespace.default.useState(0);
6526
+ const [listH, setListH] = React55__namespace.default.useState(260);
6527
+ const wrapRef = React55__namespace.default.useRef(null);
6528
+ const controlRef = React55__namespace.default.useRef(null);
6529
+ const inputRef = React55__namespace.default.useRef(null);
6530
+ const setInputRef = useMergedRef(inputRef, ref);
6531
+ const popRef = React55__namespace.default.useRef(null);
6532
+ const listRef = React55__namespace.default.useRef(null);
6533
+ const activeRef = React55__namespace.default.useRef(null);
6534
+ const fGroups = React55__namespace.default.useMemo(() => {
6520
6535
  const q = query.trim();
6521
6536
  const fn = filter === false ? null : typeof filter === "function" ? filter : matches;
6522
6537
  return groups.map((g) => ({ group: g.group, options: fn ? g.options.filter((o) => fn(o, q)) : g.options })).filter((g) => g.options.length);
6523
6538
  }, [groups, query, filter]);
6524
- const visible = React54__namespace.default.useMemo(() => fGroups.flatMap((g) => g.options), [fGroups]);
6525
- const rowH = React54__namespace.default.useMemo(() => visible.some((o) => o.description) ? 48 : 36, [visible]);
6539
+ const visible = React55__namespace.default.useMemo(() => fGroups.flatMap((g) => g.options), [fGroups]);
6540
+ const rowH = React55__namespace.default.useMemo(() => visible.some((o) => o.description) ? 48 : 36, [visible]);
6526
6541
  const GROUP_H = 30;
6527
- const { rows, totalH } = React54__namespace.default.useMemo(() => {
6542
+ const { rows, totalH } = React55__namespace.default.useMemo(() => {
6528
6543
  if (!virtualized) return { rows: [], totalH: 0 };
6529
6544
  const rows2 = [];
6530
6545
  let off = 0;
@@ -6550,7 +6565,7 @@ function Combobox({
6550
6565
  }
6551
6566
  return from;
6552
6567
  };
6553
- const place = React54__namespace.default.useCallback(() => {
6568
+ const place = React55__namespace.default.useCallback(() => {
6554
6569
  const el = controlRef.current;
6555
6570
  if (!el) return;
6556
6571
  const r2 = el.getBoundingClientRect();
@@ -6565,7 +6580,7 @@ function Combobox({
6565
6580
  flip
6566
6581
  });
6567
6582
  }, [placement, minWidth]);
6568
- React54__namespace.default.useEffect(() => {
6583
+ React55__namespace.default.useEffect(() => {
6569
6584
  if (!open || !portal) return;
6570
6585
  place();
6571
6586
  const onMove = () => place();
@@ -6583,7 +6598,7 @@ function Combobox({
6583
6598
  ro?.disconnect();
6584
6599
  };
6585
6600
  }, [open, portal, place]);
6586
- React54__namespace.default.useEffect(() => {
6601
+ React55__namespace.default.useEffect(() => {
6587
6602
  if (!open) return;
6588
6603
  const onDown = (e) => {
6589
6604
  if (wrapRef.current && wrapRef.current.contains(e.target)) return;
@@ -6593,33 +6608,33 @@ function Combobox({
6593
6608
  document.addEventListener("mousedown", onDown);
6594
6609
  return () => document.removeEventListener("mousedown", onDown);
6595
6610
  }, [open]);
6596
- React54__namespace.default.useEffect(() => {
6611
+ React55__namespace.default.useEffect(() => {
6597
6612
  setActive(0);
6598
6613
  }, [query]);
6599
- React54__namespace.default.useEffect(() => {
6614
+ React55__namespace.default.useEffect(() => {
6600
6615
  if (visible.length === 0) return;
6601
6616
  setActive((a) => Math.min(a, visible.length - 1));
6602
6617
  }, [visible.length]);
6603
- const onOpenChangeRef = React54__namespace.default.useRef(onOpenChange);
6618
+ const onOpenChangeRef = React55__namespace.default.useRef(onOpenChange);
6604
6619
  onOpenChangeRef.current = onOpenChange;
6605
- const prevOpenRef = React54__namespace.default.useRef(open);
6606
- React54__namespace.default.useEffect(() => {
6620
+ const prevOpenRef = React55__namespace.default.useRef(open);
6621
+ React55__namespace.default.useEffect(() => {
6607
6622
  if (prevOpenRef.current !== open) {
6608
6623
  prevOpenRef.current = open;
6609
6624
  onOpenChangeRef.current?.(open);
6610
6625
  }
6611
6626
  }, [open]);
6612
- React54__namespace.default.useEffect(() => {
6627
+ React55__namespace.default.useEffect(() => {
6613
6628
  if (!open) return;
6614
6629
  const idx = visible.findIndex((o) => o.value === current);
6615
6630
  setActive(idx >= 0 ? idx : 0);
6616
6631
  }, [open]);
6617
- React54__namespace.default.useEffect(() => {
6632
+ React55__namespace.default.useEffect(() => {
6618
6633
  if (!open || !virtualized) return;
6619
6634
  const el = listRef.current;
6620
6635
  if (el && el.clientHeight) setListH(el.clientHeight);
6621
6636
  }, [open, virtualized]);
6622
- React54__namespace.default.useEffect(() => {
6637
+ React55__namespace.default.useEffect(() => {
6623
6638
  if (!open) return;
6624
6639
  if (!virtualized) {
6625
6640
  ensureVisible(listRef.current, activeRef.current);
@@ -6748,7 +6763,7 @@ function Combobox({
6748
6763
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "twc-pop__group", role: "presentation", children: r2.label }, `g${r2.gi}`)
6749
6764
  ) : renderRow(r2.o, r2.idx)),
6750
6765
  vBottom > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { "aria-hidden": "true", style: { height: vBottom } }) : null
6751
- ] }) : fGroups.map((g, gi) => /* @__PURE__ */ jsxRuntime.jsxs(React54__namespace.default.Fragment, { children: [
6766
+ ] }) : fGroups.map((g, gi) => /* @__PURE__ */ jsxRuntime.jsxs(React55__namespace.default.Fragment, { children: [
6752
6767
  g.group ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "twc-pop__group", role: "presentation", children: g.group }) : null,
6753
6768
  g.options.map((o) => {
6754
6769
  counter += 1;
@@ -6806,7 +6821,7 @@ function Combobox({
6806
6821
  /* @__PURE__ */ jsxRuntime.jsx(
6807
6822
  "input",
6808
6823
  {
6809
- ref: inputRef,
6824
+ ref: setInputRef,
6810
6825
  id: fieldId,
6811
6826
  className: "twc-cb__input",
6812
6827
  role: "combobox",
@@ -6861,7 +6876,7 @@ function Combobox({
6861
6876
  ] }),
6862
6877
  error ? /* @__PURE__ */ jsxRuntime.jsx("span", { id: descId, className: "twc-field__error", children: error }) : hint ? /* @__PURE__ */ jsxRuntime.jsx("span", { id: descId, className: "twc-field__hint", children: hint }) : null
6863
6878
  ] });
6864
- }
6879
+ });
6865
6880
  var COMMAND_CSS = `
6866
6881
  .twc-cmdk__overlay { position: fixed; inset: 0; z-index: var(--z-modal); background: var(--color-overlay); backdrop-filter: blur(3px);
6867
6882
  display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
@@ -6912,14 +6927,14 @@ function CommandPalette({
6912
6927
  }) {
6913
6928
  const __twcStyles = useScopedStyles("twc-cmdk-styles", COMMAND_CSS);
6914
6929
  const renderPortal = usePortal();
6915
- const [query, setQuery] = React54__namespace.default.useState("");
6916
- const [active, setActive] = React54__namespace.default.useState(0);
6917
- const inputRef = React54__namespace.default.useRef(null);
6918
- const listRef = React54__namespace.default.useRef(null);
6919
- const paletteRef = React54__namespace.default.useRef(null);
6920
- const baseId = React54__namespace.default.useId();
6921
- const [mounted, setMounted] = React54__namespace.default.useState(open);
6922
- React54__namespace.default.useEffect(() => {
6930
+ const [query, setQuery] = React55__namespace.default.useState("");
6931
+ const [active, setActive] = React55__namespace.default.useState(0);
6932
+ const inputRef = React55__namespace.default.useRef(null);
6933
+ const listRef = React55__namespace.default.useRef(null);
6934
+ const paletteRef = React55__namespace.default.useRef(null);
6935
+ const baseId = React55__namespace.default.useId();
6936
+ const [mounted, setMounted] = React55__namespace.default.useState(open);
6937
+ React55__namespace.default.useEffect(() => {
6923
6938
  if (open) {
6924
6939
  setMounted(true);
6925
6940
  return;
@@ -6928,7 +6943,7 @@ function CommandPalette({
6928
6943
  return () => clearTimeout(t);
6929
6944
  }, [open]);
6930
6945
  useScrollLock(open);
6931
- React54__namespace.default.useEffect(() => {
6946
+ React55__namespace.default.useEffect(() => {
6932
6947
  if (open) {
6933
6948
  setQuery("");
6934
6949
  setActive(0);
@@ -6936,7 +6951,7 @@ function CommandPalette({
6936
6951
  }, [open]);
6937
6952
  useFocusTrap(paletteRef, open && mounted);
6938
6953
  const isTop = useLayer(open && mounted);
6939
- React54__namespace.default.useEffect(() => {
6954
+ React55__namespace.default.useEffect(() => {
6940
6955
  if (!open) return void 0;
6941
6956
  const onKey = (e) => {
6942
6957
  if (e.defaultPrevented || !isTop()) return;
@@ -6949,7 +6964,7 @@ function CommandPalette({
6949
6964
  return () => document.removeEventListener("keydown", onKey);
6950
6965
  }, [open, onClose, isTop]);
6951
6966
  const q = query.trim().toLowerCase();
6952
- const filtered = React54__namespace.default.useMemo(() => commands.filter(
6967
+ const filtered = React55__namespace.default.useMemo(() => commands.filter(
6953
6968
  (c) => !q || c.label.toLowerCase().includes(q) || (c.keywords || "").toLowerCase().includes(q) || (c.group || "").toLowerCase().includes(q)
6954
6969
  ), [commands, q]);
6955
6970
  const groups = [];
@@ -6964,7 +6979,7 @@ function CommandPalette({
6964
6979
  g.items.push(c);
6965
6980
  flat.push(c);
6966
6981
  });
6967
- React54__namespace.default.useEffect(() => {
6982
+ React55__namespace.default.useEffect(() => {
6968
6983
  setActive(0);
6969
6984
  }, [query]);
6970
6985
  const run = (cmd) => {
@@ -6984,7 +6999,7 @@ function CommandPalette({
6984
6999
  if (cmd) run(cmd);
6985
7000
  }
6986
7001
  }
6987
- React54__namespace.default.useEffect(() => {
7002
+ React55__namespace.default.useEffect(() => {
6988
7003
  const node = listRef.current?.querySelector('[data-active="true"]');
6989
7004
  if (node) node.scrollIntoView({ block: "nearest" });
6990
7005
  }, [active]);
@@ -7174,13 +7189,13 @@ function Currency({
7174
7189
  const prec = precision != null ? precision : meta.precision;
7175
7190
  const sym = symbol != null ? symbol : meta.symbol;
7176
7191
  const cur = code != null ? code : meta.code;
7177
- const autoId = React54__namespace.default.useId();
7192
+ const autoId = React55__namespace.default.useId();
7178
7193
  const fieldId = id || autoId;
7179
7194
  const invalid = Boolean(error);
7180
7195
  const controlled = value !== void 0;
7181
- const [internal, setInternal] = React54__namespace.default.useState(() => clampPrecision(String(defaultValue ?? ""), prec));
7196
+ const [internal, setInternal] = React55__namespace.default.useState(() => clampPrecision(String(defaultValue ?? ""), prec));
7182
7197
  const shown = controlled ? clampPrecision(String(value ?? ""), prec) : internal;
7183
- React54__namespace.default.useEffect(() => {
7198
+ React55__namespace.default.useEffect(() => {
7184
7199
  if (!controlled) return;
7185
7200
  const raw = String(value ?? "");
7186
7201
  if (shown !== raw) {
@@ -7188,7 +7203,7 @@ function Currency({
7188
7203
  onValueChange?.(shown === "" || Number.isNaN(n) ? null : n, shown);
7189
7204
  }
7190
7205
  }, [controlled, shown, value]);
7191
- React54__namespace.default.useEffect(() => {
7206
+ React55__namespace.default.useEffect(() => {
7192
7207
  if (controlled) return;
7193
7208
  const next = clampPrecision(internal, prec);
7194
7209
  if (next === internal) return;
@@ -7247,8 +7262,8 @@ function Currency({
7247
7262
  ] });
7248
7263
  }
7249
7264
  function useFallbackName(ref, hasOwnName) {
7250
- const [needsFallback, setNeedsFallback] = React54__namespace.default.useState(false);
7251
- const useIso2 = typeof document !== "undefined" ? React54__namespace.default.useLayoutEffect : React54__namespace.default.useEffect;
7265
+ const [needsFallback, setNeedsFallback] = React55__namespace.default.useState(false);
7266
+ const useIso2 = typeof document !== "undefined" ? React55__namespace.default.useLayoutEffect : React55__namespace.default.useEffect;
7252
7267
  useIso2(() => {
7253
7268
  if (hasOwnName) {
7254
7269
  setNeedsFallback(false);
@@ -7375,7 +7390,7 @@ function ensureVisible2(list, el) {
7375
7390
  if (top < list.scrollTop) list.scrollTop = top - 4;
7376
7391
  else if (bottom > list.scrollTop + list.clientHeight) list.scrollTop = bottom - list.clientHeight + 4;
7377
7392
  }
7378
- function Select({
7393
+ var Select = /* @__PURE__ */ React55__namespace.default.forwardRef(function Select2({
7379
7394
  label,
7380
7395
  hint,
7381
7396
  error,
@@ -7406,46 +7421,47 @@ function Select({
7406
7421
  onClick,
7407
7422
  onKeyDown,
7408
7423
  ...rest
7409
- }) {
7424
+ }, ref) {
7410
7425
  const __twcStyles = useScopedStyles("twc-select-styles", SELECT_CSS);
7411
7426
  if (virtualizedProp && renderOption) warnOnce("select-renderoption-virtualized", "twico-ui Select: `renderOption` disables `virtualized` \u2014 custom rows aren't a fixed height.");
7412
7427
  const virtualized = virtualizedProp && !renderOption;
7413
- const bufferRef = React54__namespace.default.useRef("");
7414
- const bufferTimerRef = React54__namespace.default.useRef(null);
7415
- const groups = React54__namespace.default.useMemo(() => normalizeGroups2(options), [options]);
7416
- const flat = React54__namespace.default.useMemo(() => groups.flatMap((g) => g.options), [groups]);
7417
- const autoId = React54__namespace.default.useId();
7428
+ const bufferRef = React55__namespace.default.useRef("");
7429
+ const bufferTimerRef = React55__namespace.default.useRef(null);
7430
+ const groups = React55__namespace.default.useMemo(() => normalizeGroups2(options), [options]);
7431
+ const flat = React55__namespace.default.useMemo(() => groups.flatMap((g) => g.options), [groups]);
7432
+ const autoId = React55__namespace.default.useId();
7418
7433
  const fieldId = id || autoId;
7419
- const [internal, setInternal] = React54__namespace.default.useState(defaultValue);
7434
+ const [internal, setInternal] = React55__namespace.default.useState(defaultValue);
7420
7435
  const current = value !== void 0 ? value : internal;
7421
- const [open, setOpen] = React54__namespace.default.useState(false);
7422
- const [render, setRender] = React54__namespace.default.useState(false);
7423
- const [active, setActive] = React54__namespace.default.useState(0);
7424
- const [coords, setCoords] = React54__namespace.default.useState(null);
7425
- const [query, setQuery] = React54__namespace.default.useState("");
7426
- const [scrollTop, setScrollTop] = React54__namespace.default.useState(0);
7427
- const [listH, setListH] = React54__namespace.default.useState(260);
7428
- const wrapRef = React54__namespace.default.useRef(null);
7429
- const triggerRef = React54__namespace.default.useRef(null);
7430
- const popRef = React54__namespace.default.useRef(null);
7431
- const listRef = React54__namespace.default.useRef(null);
7432
- const activeRef = React54__namespace.default.useRef(null);
7433
- const searchRef = React54__namespace.default.useRef(null);
7436
+ const [open, setOpen] = React55__namespace.default.useState(false);
7437
+ const [render, setRender] = React55__namespace.default.useState(false);
7438
+ const [active, setActive] = React55__namespace.default.useState(0);
7439
+ const [coords, setCoords] = React55__namespace.default.useState(null);
7440
+ const [query, setQuery] = React55__namespace.default.useState("");
7441
+ const [scrollTop, setScrollTop] = React55__namespace.default.useState(0);
7442
+ const [listH, setListH] = React55__namespace.default.useState(260);
7443
+ const wrapRef = React55__namespace.default.useRef(null);
7444
+ const triggerRef = React55__namespace.default.useRef(null);
7445
+ const setTriggerRef = useMergedRef(triggerRef, ref);
7446
+ const popRef = React55__namespace.default.useRef(null);
7447
+ const listRef = React55__namespace.default.useRef(null);
7448
+ const activeRef = React55__namespace.default.useRef(null);
7449
+ const searchRef = React55__namespace.default.useRef(null);
7434
7450
  const showSearch = searchable === void 0 ? flat.length > 5 : searchable;
7435
- const fGroupsLive = React54__namespace.default.useMemo(() => {
7451
+ const fGroupsLive = React55__namespace.default.useMemo(() => {
7436
7452
  const q = query.trim().toLowerCase();
7437
7453
  if (!q) return groups;
7438
7454
  return groups.map((g) => ({ group: g.group, options: g.options.filter((o) => o.label.toLowerCase().includes(q) || o.description && o.description.toLowerCase().includes(q)) })).filter((g) => g.options.length);
7439
7455
  }, [groups, query]);
7440
- const fGroupsFrozen = React54__namespace.default.useRef(fGroupsLive);
7441
- React54__namespace.default.useEffect(() => {
7456
+ const fGroupsFrozen = React55__namespace.default.useRef(fGroupsLive);
7457
+ React55__namespace.default.useEffect(() => {
7442
7458
  if (open) fGroupsFrozen.current = fGroupsLive;
7443
7459
  }, [open, fGroupsLive]);
7444
7460
  const fGroups = open ? fGroupsLive : fGroupsFrozen.current;
7445
- const visible = React54__namespace.default.useMemo(() => fGroups.flatMap((g) => g.options), [fGroups]);
7446
- const rowH = React54__namespace.default.useMemo(() => visible.some((o) => o.description) ? 48 : 36, [visible]);
7461
+ const visible = React55__namespace.default.useMemo(() => fGroups.flatMap((g) => g.options), [fGroups]);
7462
+ const rowH = React55__namespace.default.useMemo(() => visible.some((o) => o.description) ? 48 : 36, [visible]);
7447
7463
  const GROUP_H = 30;
7448
- const { rows, totalH } = React54__namespace.default.useMemo(() => {
7464
+ const { rows, totalH } = React55__namespace.default.useMemo(() => {
7449
7465
  if (!virtualized) return { rows: [], totalH: 0 };
7450
7466
  const rows2 = [];
7451
7467
  let off = 0;
@@ -7472,7 +7488,7 @@ function Select({
7472
7488
  }
7473
7489
  return from;
7474
7490
  };
7475
- const place = React54__namespace.default.useCallback(() => {
7491
+ const place = React55__namespace.default.useCallback(() => {
7476
7492
  const el = triggerRef.current;
7477
7493
  if (!el) return;
7478
7494
  const r2 = el.getBoundingClientRect();
@@ -7488,7 +7504,7 @@ function Select({
7488
7504
  flip
7489
7505
  });
7490
7506
  }, [placement, minWidth, matchTriggerWidth]);
7491
- React54__namespace.default.useEffect(() => {
7507
+ React55__namespace.default.useEffect(() => {
7492
7508
  if (!open || !portal) return;
7493
7509
  place();
7494
7510
  const onMove = () => place();
@@ -7506,7 +7522,7 @@ function Select({
7506
7522
  ro?.disconnect();
7507
7523
  };
7508
7524
  }, [open, portal, place]);
7509
- React54__namespace.default.useEffect(() => {
7525
+ React55__namespace.default.useEffect(() => {
7510
7526
  if (!open) return;
7511
7527
  const idx = flat.findIndex((o) => o.value === current);
7512
7528
  setActive(idx >= 0 ? idx : 0);
@@ -7521,19 +7537,19 @@ function Select({
7521
7537
  document.addEventListener("mousedown", onDown);
7522
7538
  return () => document.removeEventListener("mousedown", onDown);
7523
7539
  }, [open]);
7524
- React54__namespace.default.useEffect(() => {
7540
+ React55__namespace.default.useEffect(() => {
7525
7541
  setActive(0);
7526
7542
  }, [query]);
7527
- React54__namespace.default.useEffect(() => {
7543
+ React55__namespace.default.useEffect(() => {
7528
7544
  if (visible.length === 0) return;
7529
7545
  setActive((a) => Math.min(a, visible.length - 1));
7530
7546
  }, [visible.length]);
7531
- React54__namespace.default.useEffect(() => {
7547
+ React55__namespace.default.useEffect(() => {
7532
7548
  if (!open || !virtualized) return;
7533
7549
  const el = listRef.current;
7534
7550
  if (el && el.clientHeight) setListH(el.clientHeight);
7535
7551
  }, [open, virtualized, render]);
7536
- React54__namespace.default.useEffect(() => {
7552
+ React55__namespace.default.useEffect(() => {
7537
7553
  if (!open) return;
7538
7554
  if (!virtualized) {
7539
7555
  ensureVisible2(listRef.current, activeRef.current);
@@ -7550,7 +7566,7 @@ function Select({
7550
7566
  if (next !== el.scrollTop) el.scrollTop = next;
7551
7567
  setScrollTop(next);
7552
7568
  }, [active, open, virtualized, rows, listH]);
7553
- React54__namespace.default.useEffect(() => {
7569
+ React55__namespace.default.useEffect(() => {
7554
7570
  if (open) {
7555
7571
  setRender(true);
7556
7572
  return;
@@ -7559,8 +7575,8 @@ function Select({
7559
7575
  const t = setTimeout(() => setRender(false), 170);
7560
7576
  return () => clearTimeout(t);
7561
7577
  }, [open]);
7562
- const prevOpen = React54__namespace.default.useRef(false);
7563
- React54__namespace.default.useEffect(() => {
7578
+ const prevOpen = React55__namespace.default.useRef(false);
7579
+ React55__namespace.default.useEffect(() => {
7564
7580
  if (prevOpen.current && !open) {
7565
7581
  const ae = typeof document !== "undefined" ? document.activeElement : null;
7566
7582
  if (popRef.current && ae && popRef.current.contains(ae)) triggerRef.current?.focus();
@@ -7713,7 +7729,7 @@ function Select({
7713
7729
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "twc-pop__group", role: "presentation", children: r2.label }, `g${r2.gi}`)
7714
7730
  ) : renderRow(r2.o, r2.idx)),
7715
7731
  vBottom > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { "aria-hidden": "true", style: { height: vBottom } }) : null
7716
- ] }) : fGroups.map((g, gi) => /* @__PURE__ */ jsxRuntime.jsxs(React54__namespace.default.Fragment, { children: [
7732
+ ] }) : fGroups.map((g, gi) => /* @__PURE__ */ jsxRuntime.jsxs(React55__namespace.default.Fragment, { children: [
7717
7733
  g.group ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "twc-pop__group", role: "presentation", children: g.group }) : null,
7718
7734
  g.options.map((o) => {
7719
7735
  counter += 1;
@@ -7760,7 +7776,7 @@ function Select({
7760
7776
  {
7761
7777
  type: "button",
7762
7778
  id: fieldId,
7763
- ref: triggerRef,
7779
+ ref: setTriggerRef,
7764
7780
  className: "twc-sel__trigger",
7765
7781
  "data-size": size,
7766
7782
  "data-tone": tone,
@@ -7798,7 +7814,7 @@ function Select({
7798
7814
  ] }),
7799
7815
  error ? /* @__PURE__ */ jsxRuntime.jsx("span", { id: descId, className: "twc-field__error", children: error }) : hint ? /* @__PURE__ */ jsxRuntime.jsx("span", { id: descId, className: "twc-field__hint", children: hint }) : null
7800
7816
  ] });
7801
- }
7817
+ });
7802
7818
  var CURF_CSS = `
7803
7819
  /* Shared input shell (self-contained \u2014 CurrencyField must not depend on the
7804
7820
  Currency component being rendered on the same page to get these styles). */
@@ -7875,21 +7891,21 @@ function CurrencyField({
7875
7891
  ...rest
7876
7892
  }) {
7877
7893
  const __twcStyles = useScopedStyles("twc-curf-styles", CURF_CSS);
7878
- const autoId = React54__namespace.default.useId();
7894
+ const autoId = React55__namespace.default.useId();
7879
7895
  const fieldId = id || autoId;
7880
7896
  const invalid = Boolean(error);
7881
7897
  const curControlled = currency !== void 0;
7882
- const [curInternal, setCurInternal] = React54__namespace.default.useState(defaultCurrency);
7898
+ const [curInternal, setCurInternal] = React55__namespace.default.useState(defaultCurrency);
7883
7899
  const cur = curControlled ? currency : curInternal;
7884
7900
  const meta = CURRENCIES[cur] || CURRENCIES.USD;
7885
7901
  const prec = meta.precision;
7886
7902
  const valControlled = value !== void 0;
7887
- const [valInternal, setValInternal] = React54__namespace.default.useState(() => clampPrecision(String(defaultValue ?? ""), prec));
7903
+ const [valInternal, setValInternal] = React55__namespace.default.useState(() => clampPrecision(String(defaultValue ?? ""), prec));
7888
7904
  const shown = valControlled ? clampPrecision(String(value ?? ""), prec) : valInternal;
7889
7905
  const descId = `${fieldId}-desc`;
7890
7906
  const describedBy = [error || hint ? descId : null, rest["aria-describedby"]].filter(Boolean).join(" ") || void 0;
7891
7907
  const ariaInvalid = invalid ? true : rest["aria-invalid"] ?? void 0;
7892
- React54__namespace.default.useEffect(() => {
7908
+ React55__namespace.default.useEffect(() => {
7893
7909
  if (!valControlled) {
7894
7910
  const clamped = clampPrecision(valInternal, prec);
7895
7911
  if (clamped !== valInternal) {
@@ -7905,7 +7921,7 @@ function CurrencyField({
7905
7921
  }
7906
7922
  }
7907
7923
  }, [prec, cur, shown, value, valControlled, valInternal]);
7908
- const options = React54__namespace.default.useMemo(() => {
7924
+ const options = React55__namespace.default.useMemo(() => {
7909
7925
  if (!currencies) return CURRENCY_OPTIONS;
7910
7926
  return currencies.map((c) => typeof c === "string" ? { value: c, label: `${c} \u2014 ${(CURRENCIES[c] || {}).label || c}` } : c);
7911
7927
  }, [currencies]);
@@ -8053,7 +8069,7 @@ var INPUT_EXTRA_CSS = `
8053
8069
  .twc-field__count { margin-inline-start: auto; font-size: var(--text-xs); color: var(--color-text-muted); font-variant-numeric: tabular-nums; flex: none; }
8054
8070
  .twc-field__count[data-danger="true"] { color: var(--color-danger-subtle-fg); }
8055
8071
  `;
8056
- function Input({
8072
+ var Input = /* @__PURE__ */ React55__namespace.default.forwardRef(function Input2({
8057
8073
  label,
8058
8074
  hint,
8059
8075
  error,
@@ -8071,16 +8087,16 @@ function Input({
8071
8087
  id,
8072
8088
  className = "",
8073
8089
  ...rest
8074
- }) {
8090
+ }, ref) {
8075
8091
  const __twcStyles = useScopedStyles("twc-field-styles", FIELD_CSS2);
8076
8092
  const __twcExtra = useScopedStyles("twc-input-extra-styles", INPUT_EXTRA_CSS);
8077
- const autoId = React54__namespace.default.useId();
8093
+ const autoId = React55__namespace.default.useId();
8078
8094
  const fieldId = id || autoId;
8079
8095
  const descId = `${fieldId}-desc`;
8080
8096
  const countId = `${fieldId}-count`;
8081
8097
  const invalid = Boolean(error);
8082
8098
  const countControlled = rest.value !== void 0;
8083
- const [len2, setLen] = React54__namespace.default.useState(() => String(rest.defaultValue ?? "").length);
8099
+ const [len2, setLen] = React55__namespace.default.useState(() => String(rest.defaultValue ?? "").length);
8084
8100
  const count = countControlled ? String(rest.value ?? "").length : len2;
8085
8101
  const max = rest.maxLength;
8086
8102
  const showCounter = showCount && max != null;
@@ -8089,13 +8105,20 @@ function Input({
8089
8105
  rest.onChange?.(e);
8090
8106
  if ((showCount || clearable) && !countControlled) setLen(e.target.value.length);
8091
8107
  };
8092
- const inputRef = React54__namespace.default.useRef(null);
8093
- const userRef = rest.ref;
8094
- const setRef = React54__namespace.default.useCallback((node) => {
8108
+ const inputRef = React55__namespace.default.useRef(null);
8109
+ const setRef = React55__namespace.default.useCallback((node) => {
8095
8110
  inputRef.current = node;
8096
- if (typeof userRef === "function") userRef(node);
8097
- else if (userRef && typeof userRef === "object") userRef.current = node;
8098
- }, [userRef]);
8111
+ if (typeof ref === "function") {
8112
+ const cleanup = ref(node);
8113
+ if (typeof cleanup === "function") return () => {
8114
+ inputRef.current = null;
8115
+ cleanup();
8116
+ };
8117
+ } else if (ref && typeof ref === "object") {
8118
+ ref.current = node;
8119
+ }
8120
+ return void 0;
8121
+ }, [ref]);
8099
8122
  const clearField = () => {
8100
8123
  const el = inputRef.current;
8101
8124
  if (!el) return;
@@ -8109,7 +8132,7 @@ function Input({
8109
8132
  const ariaInvalid = invalid ? true : rest["aria-invalid"] ?? void 0;
8110
8133
  const describedBy = [error || hint ? descId : null, showCounter ? countId : null, rest["aria-describedby"]].filter(Boolean).join(" ") || void 0;
8111
8134
  const isPassword = type === "password";
8112
- const [revealed, setRevealed] = React54__namespace.default.useState(false);
8135
+ const [revealed, setRevealed] = React55__namespace.default.useState(false);
8113
8136
  const effectiveType = isPassword && revealed ? "text" : type;
8114
8137
  const suffix = rightIcon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-input__affix", children: rightIcon }) : isPassword ? /* @__PURE__ */ jsxRuntime.jsx(
8115
8138
  "button",
@@ -8174,7 +8197,7 @@ function Input({
8174
8197
  ] }) : null
8175
8198
  ] }) : null
8176
8199
  ] });
8177
- }
8200
+ });
8178
8201
  var MULTI_CSS = `
8179
8202
  .twc-field { display: flex; flex-direction: column; gap: var(--space-1-5); font-family: var(--font-sans); }
8180
8203
  .twc-field__label { font-size: var(--text-sm); font-weight: var(--font-semibold); color: var(--color-text); display: flex; gap: 4px; align-items: center; }
@@ -8291,7 +8314,7 @@ function ensureVisible3(list, el) {
8291
8314
  if (top < list.scrollTop) list.scrollTop = top - 4;
8292
8315
  else if (bottom > list.scrollTop + list.clientHeight) list.scrollTop = bottom - list.clientHeight + 4;
8293
8316
  }
8294
- function MultiSelect({
8317
+ var MultiSelect = /* @__PURE__ */ React55__namespace.default.forwardRef(function MultiSelect2({
8295
8318
  label,
8296
8319
  hint,
8297
8320
  error,
@@ -8323,37 +8346,38 @@ function MultiSelect({
8323
8346
  onFocus,
8324
8347
  onKeyDown,
8325
8348
  ...rest
8326
- }) {
8349
+ }, ref) {
8327
8350
  const __twcStyles = useScopedStyles("twc-ms-styles", MULTI_CSS);
8328
8351
  if (virtualizedProp && renderOption) warnOnce("multiselect-renderoption-virtualized", "twico-ui MultiSelect: `renderOption` disables `virtualized` \u2014 custom rows aren't a fixed height.");
8329
8352
  const virtualized = virtualizedProp && !renderOption;
8330
- const groups = React54__namespace.default.useMemo(() => normalizeGroups3(options), [options]);
8331
- const flat = React54__namespace.default.useMemo(() => groups.flatMap((g) => g.options), [groups]);
8332
- const autoId = React54__namespace.default.useId();
8353
+ const groups = React55__namespace.default.useMemo(() => normalizeGroups3(options), [options]);
8354
+ const flat = React55__namespace.default.useMemo(() => groups.flatMap((g) => g.options), [groups]);
8355
+ const autoId = React55__namespace.default.useId();
8333
8356
  const fieldId = id || autoId;
8334
- const [internal, setInternal] = React54__namespace.default.useState(defaultValue);
8357
+ const [internal, setInternal] = React55__namespace.default.useState(defaultValue);
8335
8358
  const selected = value !== void 0 ? value : internal;
8336
- const [open, setOpen] = React54__namespace.default.useState(false);
8337
- const [query, setQuery] = React54__namespace.default.useState("");
8338
- const [active, setActive] = React54__namespace.default.useState(0);
8339
- const [coords, setCoords] = React54__namespace.default.useState(null);
8340
- const [scrollTop, setScrollTop] = React54__namespace.default.useState(0);
8341
- const [listH, setListH] = React54__namespace.default.useState(260);
8342
- const wrapRef = React54__namespace.default.useRef(null);
8343
- const controlRef = React54__namespace.default.useRef(null);
8344
- const inputRef = React54__namespace.default.useRef(null);
8345
- const popRef = React54__namespace.default.useRef(null);
8346
- const listRef = React54__namespace.default.useRef(null);
8347
- const activeRef = React54__namespace.default.useRef(null);
8348
- const fGroups = React54__namespace.default.useMemo(() => {
8359
+ const [open, setOpen] = React55__namespace.default.useState(false);
8360
+ const [query, setQuery] = React55__namespace.default.useState("");
8361
+ const [active, setActive] = React55__namespace.default.useState(0);
8362
+ const [coords, setCoords] = React55__namespace.default.useState(null);
8363
+ const [scrollTop, setScrollTop] = React55__namespace.default.useState(0);
8364
+ const [listH, setListH] = React55__namespace.default.useState(260);
8365
+ const wrapRef = React55__namespace.default.useRef(null);
8366
+ const controlRef = React55__namespace.default.useRef(null);
8367
+ const inputRef = React55__namespace.default.useRef(null);
8368
+ const setInputRef = useMergedRef(inputRef, ref);
8369
+ const popRef = React55__namespace.default.useRef(null);
8370
+ const listRef = React55__namespace.default.useRef(null);
8371
+ const activeRef = React55__namespace.default.useRef(null);
8372
+ const fGroups = React55__namespace.default.useMemo(() => {
8349
8373
  const q = query.trim();
8350
8374
  const fn = filter === false ? null : typeof filter === "function" ? filter : matches2;
8351
8375
  return groups.map((g) => ({ group: g.group, options: fn ? g.options.filter((o) => fn(o, q)) : g.options })).filter((g) => g.options.length);
8352
8376
  }, [groups, query, filter]);
8353
- const visible = React54__namespace.default.useMemo(() => fGroups.flatMap((g) => g.options), [fGroups]);
8354
- const rowH = React54__namespace.default.useMemo(() => visible.some((o) => o.description) ? 48 : 36, [visible]);
8377
+ const visible = React55__namespace.default.useMemo(() => fGroups.flatMap((g) => g.options), [fGroups]);
8378
+ const rowH = React55__namespace.default.useMemo(() => visible.some((o) => o.description) ? 48 : 36, [visible]);
8355
8379
  const GROUP_H = 30;
8356
- const { rows, totalH } = React54__namespace.default.useMemo(() => {
8380
+ const { rows, totalH } = React55__namespace.default.useMemo(() => {
8357
8381
  if (!virtualized) return { rows: [], totalH: 0 };
8358
8382
  const rows2 = [];
8359
8383
  let off = 0;
@@ -8381,7 +8405,7 @@ function MultiSelect({
8381
8405
  }
8382
8406
  return from;
8383
8407
  };
8384
- const place = React54__namespace.default.useCallback(() => {
8408
+ const place = React55__namespace.default.useCallback(() => {
8385
8409
  const el = controlRef.current;
8386
8410
  if (!el) return;
8387
8411
  const r2 = el.getBoundingClientRect();
@@ -8396,7 +8420,7 @@ function MultiSelect({
8396
8420
  flip
8397
8421
  });
8398
8422
  }, [placement, minWidth]);
8399
- React54__namespace.default.useEffect(() => {
8423
+ React55__namespace.default.useEffect(() => {
8400
8424
  if (!open || !portal) return;
8401
8425
  place();
8402
8426
  const onMove = () => place();
@@ -8414,7 +8438,7 @@ function MultiSelect({
8414
8438
  ro?.disconnect();
8415
8439
  };
8416
8440
  }, [open, portal, place]);
8417
- React54__namespace.default.useEffect(() => {
8441
+ React55__namespace.default.useEffect(() => {
8418
8442
  if (!open) return;
8419
8443
  const onDown = (e) => {
8420
8444
  if (wrapRef.current && wrapRef.current.contains(e.target)) return;
@@ -8425,19 +8449,19 @@ function MultiSelect({
8425
8449
  document.addEventListener("mousedown", onDown);
8426
8450
  return () => document.removeEventListener("mousedown", onDown);
8427
8451
  }, [open]);
8428
- React54__namespace.default.useEffect(() => {
8452
+ React55__namespace.default.useEffect(() => {
8429
8453
  setActive(0);
8430
8454
  }, [query]);
8431
- React54__namespace.default.useEffect(() => {
8455
+ React55__namespace.default.useEffect(() => {
8432
8456
  if (visible.length === 0) return;
8433
8457
  setActive((a) => Math.min(a, visible.length - 1));
8434
8458
  }, [visible.length]);
8435
- React54__namespace.default.useEffect(() => {
8459
+ React55__namespace.default.useEffect(() => {
8436
8460
  if (!open || !virtualized) return;
8437
8461
  const el = listRef.current;
8438
8462
  if (el && el.clientHeight) setListH(el.clientHeight);
8439
8463
  }, [open, virtualized]);
8440
- React54__namespace.default.useEffect(() => {
8464
+ React55__namespace.default.useEffect(() => {
8441
8465
  if (!open) return;
8442
8466
  if (!virtualized) {
8443
8467
  ensureVisible3(listRef.current, activeRef.current);
@@ -8561,7 +8585,7 @@ function MultiSelect({
8561
8585
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "twc-pop__group", role: "presentation", children: r2.label }, `g${r2.gi}`)
8562
8586
  ) : renderRow(r2.o, r2.idx)),
8563
8587
  vBottom > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { "aria-hidden": "true", style: { height: vBottom } }) : null
8564
- ] }) : fGroups.map((g, gi) => /* @__PURE__ */ jsxRuntime.jsxs(React54__namespace.default.Fragment, { children: [
8588
+ ] }) : fGroups.map((g, gi) => /* @__PURE__ */ jsxRuntime.jsxs(React55__namespace.default.Fragment, { children: [
8565
8589
  g.group ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "twc-pop__group", role: "presentation", children: g.group }) : null,
8566
8590
  g.options.map((o) => {
8567
8591
  counter += 1;
@@ -8634,7 +8658,7 @@ function MultiSelect({
8634
8658
  /* @__PURE__ */ jsxRuntime.jsx(
8635
8659
  "input",
8636
8660
  {
8637
- ref: inputRef,
8661
+ ref: setInputRef,
8638
8662
  id: fieldId,
8639
8663
  className: "twc-ms__input",
8640
8664
  role: "combobox",
@@ -8693,7 +8717,7 @@ function MultiSelect({
8693
8717
  ] }),
8694
8718
  error ? /* @__PURE__ */ jsxRuntime.jsx("span", { id: descId, className: "twc-field__error", children: error }) : hint ? /* @__PURE__ */ jsxRuntime.jsx("span", { id: descId, className: "twc-field__hint", children: hint }) : null
8695
8719
  ] });
8696
- }
8720
+ });
8697
8721
  var PAGINATION_CSS = `
8698
8722
  .twc-pagination { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-sans); }
8699
8723
  .twc-page {
@@ -8768,7 +8792,7 @@ function Pagination({
8768
8792
  }
8769
8793
  const jumperEnabled = showPageJumper ?? showJumper;
8770
8794
  const __twcStyles = useScopedStyles("twc-pagination-styles", PAGINATION_CSS);
8771
- const [internal, setInternal] = React54__namespace.default.useState(defaultPage);
8795
+ const [internal, setInternal] = React55__namespace.default.useState(defaultPage);
8772
8796
  const page = pageProp !== void 0 ? pageProp : internal;
8773
8797
  const pages = buildPages(page, total, siblings, boundaries);
8774
8798
  const go = (p) => {
@@ -8776,7 +8800,7 @@ function Pagination({
8776
8800
  if (pageProp === void 0) setInternal(p);
8777
8801
  onChange?.(p);
8778
8802
  };
8779
- const [jump, setJump] = React54__namespace.default.useState("");
8803
+ const [jump, setJump] = React55__namespace.default.useState("");
8780
8804
  const submitJump = () => {
8781
8805
  const n = parseInt(jump, 10);
8782
8806
  if (!Number.isNaN(n)) go(Math.min(Math.max(n, 1), total));
@@ -9534,6 +9558,12 @@ th.twc-dt__rownum .twc-dt__th-inner { padding-inline: 8px; gap: 2px; justify-con
9534
9558
  .twc-dt__batch-x:hover { background: color-mix(in srgb, var(--color-primary) 20%, transparent); }
9535
9559
  .twc-dt__batch-x svg { width: 16px; height: 16px; }
9536
9560
  .twc-dt__batch-count { font-size: var(--text-sm); font-weight: var(--font-bold); color: var(--color-primary-subtle-fg); white-space: nowrap; }
9561
+ /* #492: the host's running total, sitting with the count it qualifies. Same colour as the count,
9562
+ differentiated by WEIGHT rather than by a lighter token: this bar is --color-primary-subtle, and
9563
+ --color-text-subtle on that is 4.26:1, under the 4.5:1 needed for normal text. */
9564
+ .twc-dt__batch-summary { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm);
9565
+ color: var(--color-primary-subtle-fg); white-space: nowrap; }
9566
+ .twc-dt__batch-summary::before { content: ""; width: var(--border-thin); height: 14px; background: currentColor; opacity: 0.35; }
9537
9567
  .twc-dt__batch-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
9538
9568
  .twc-dt__batch-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
9539
9569
  border: var(--border-thin) solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface);
@@ -9653,27 +9683,27 @@ function renderCombined(srcCols, row, cfg) {
9653
9683
  const v = getColVal(sc, row);
9654
9684
  if (v == null || v === "") return;
9655
9685
  const disp = sc.valueFormatter ? sc.valueFormatter(v, row) : v;
9656
- const label = cfg.labels ? React54__namespace.default.createElement("span", { className: "twc-dt__combine-label" }, colLabel(sc) + ": ") : null;
9657
- if (count > 0 && cfg.layout !== "stack") nodes.push(React54__namespace.default.createElement("span", { key: "sep" + idx, className: "twc-dt__combine-sep", "aria-hidden": "true" }, cfg.separator));
9658
- nodes.push(React54__namespace.default.createElement("span", { key: idx, className: "twc-dt__combine-item" }, label, disp));
9686
+ const label = cfg.labels ? React55__namespace.default.createElement("span", { className: "twc-dt__combine-label" }, colLabel(sc) + ": ") : null;
9687
+ if (count > 0 && cfg.layout !== "stack") nodes.push(React55__namespace.default.createElement("span", { key: "sep" + idx, className: "twc-dt__combine-sep", "aria-hidden": "true" }, cfg.separator));
9688
+ nodes.push(React55__namespace.default.createElement("span", { key: idx, className: "twc-dt__combine-item" }, label, disp));
9659
9689
  count++;
9660
9690
  });
9661
9691
  if (!nodes.length) return "";
9662
- return React54__namespace.default.createElement("span", { className: cfg.layout === "stack" ? "twc-dt__combine twc-dt__combine--stack" : "twc-dt__combine" }, nodes);
9692
+ return React55__namespace.default.createElement("span", { className: cfg.layout === "stack" ? "twc-dt__combine twc-dt__combine--stack" : "twc-dt__combine" }, nodes);
9663
9693
  }
9664
9694
  var diffValueNode = (col, v, row) => col.renderCell ? col.renderCell(v, row) : col.valueFormatter ? col.valueFormatter(v, row) : v == null ? "" : v;
9665
9695
  function renderDiffCell(col, val, row) {
9666
9696
  const meta = row && row.__diffMeta;
9667
9697
  if (!meta) return diffValueNode(col, val, row);
9668
- if (meta.op === "removed") return React54__namespace.default.createElement("span", { className: "twc-dt__diff-old" }, diffValueNode(col, getColVal(col, meta.from), meta.from));
9669
- if (meta.op === "added") return React54__namespace.default.createElement("span", { className: "twc-dt__diff-new" }, diffValueNode(col, getColVal(col, meta.to), meta.to));
9698
+ if (meta.op === "removed") return React55__namespace.default.createElement("span", { className: "twc-dt__diff-old" }, diffValueNode(col, getColVal(col, meta.from), meta.from));
9699
+ if (meta.op === "added") return React55__namespace.default.createElement("span", { className: "twc-dt__diff-new" }, diffValueNode(col, getColVal(col, meta.to), meta.to));
9670
9700
  if (meta.op === "modified" && meta.changed.has(col.field)) {
9671
- return React54__namespace.default.createElement(
9701
+ return React55__namespace.default.createElement(
9672
9702
  "span",
9673
9703
  { className: "twc-dt__diff-change" },
9674
- React54__namespace.default.createElement("span", { className: "twc-dt__diff-old" }, diffValueNode(col, getColVal(col, meta.from), meta.from)),
9675
- React54__namespace.default.createElement("span", { className: "twc-dt__diff-arrow", "aria-hidden": "true" }, "\u2192"),
9676
- React54__namespace.default.createElement("span", { className: "twc-dt__diff-new" }, diffValueNode(col, getColVal(col, meta.to), meta.to))
9704
+ React55__namespace.default.createElement("span", { className: "twc-dt__diff-old" }, diffValueNode(col, getColVal(col, meta.from), meta.from)),
9705
+ React55__namespace.default.createElement("span", { className: "twc-dt__diff-arrow", "aria-hidden": "true" }, "\u2192"),
9706
+ React55__namespace.default.createElement("span", { className: "twc-dt__diff-new" }, diffValueNode(col, getColVal(col, meta.to), meta.to))
9677
9707
  );
9678
9708
  }
9679
9709
  return diffValueNode(col, val, row);
@@ -9690,7 +9720,7 @@ var DIFF_OP_COLUMN = {
9690
9720
  resizable: true,
9691
9721
  wrappable: false,
9692
9722
  hideable: false,
9693
- renderCell: (v) => v && DIFF_OPS[v] ? React54__namespace.default.createElement(Badge, { size: "sm", variant: "soft", tone: DIFF_OPS[v].tone }, DIFF_OPS[v].label) : null,
9723
+ renderCell: (v) => v && DIFF_OPS[v] ? React55__namespace.default.createElement(Badge, { size: "sm", variant: "soft", tone: DIFF_OPS[v].tone }, DIFF_OPS[v].label) : null,
9694
9724
  exportValue: (v) => v && DIFF_OPS[v] ? DIFF_OPS[v].label : ""
9695
9725
  };
9696
9726
  function testFilter(raw, op, target, type) {
@@ -9763,9 +9793,9 @@ function runDatatableQuery(rows, query, options = {}) {
9763
9793
  return { rows: page, total, filtered: out };
9764
9794
  }
9765
9795
  function useFloating() {
9766
- const [pos, setPos] = React54__namespace.default.useState(null);
9767
- const cfg = React54__namespace.default.useRef(null);
9768
- const place = React54__namespace.default.useCallback(() => {
9796
+ const [pos, setPos] = React55__namespace.default.useState(null);
9797
+ const cfg = React55__namespace.default.useRef(null);
9798
+ const place = React55__namespace.default.useCallback(() => {
9769
9799
  const c = cfg.current;
9770
9800
  if (!c || !c.el || !c.el.isConnected) return null;
9771
9801
  const r2 = c.el.getBoundingClientRect();
@@ -9776,17 +9806,17 @@ function useFloating() {
9776
9806
  const top = r2.bottom + 6;
9777
9807
  return { top, left, width: c.width, anchorX: r2.left + r2.width / 2, maxHeight: Math.max(180, vh - top - M) };
9778
9808
  }, []);
9779
- const open = React54__namespace.default.useCallback((el, align = "left", width = 220) => {
9809
+ const open = React55__namespace.default.useCallback((el, align = "left", width = 220) => {
9780
9810
  cfg.current = { el, align, width };
9781
9811
  const p = place();
9782
9812
  if (p) setPos(p);
9783
9813
  }, [place]);
9784
- const close = React54__namespace.default.useCallback(() => {
9814
+ const close = React55__namespace.default.useCallback(() => {
9785
9815
  cfg.current = null;
9786
9816
  setPos(null);
9787
9817
  }, []);
9788
9818
  const isOpen = pos != null;
9789
- React54__namespace.default.useEffect(() => {
9819
+ React55__namespace.default.useEffect(() => {
9790
9820
  if (!isOpen) return void 0;
9791
9821
  const update = () => {
9792
9822
  const p = place();
@@ -9810,11 +9840,11 @@ function Caret({ pos }) {
9810
9840
  return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__caret", style: { left } });
9811
9841
  }
9812
9842
  function AsyncFilterValue({ col, value, onChange }) {
9813
- const [opts, setOpts] = React54__namespace.default.useState([]);
9814
- const [loading, setLoading] = React54__namespace.default.useState(false);
9815
- const reqRef = React54__namespace.default.useRef(0);
9816
- const debRef = React54__namespace.default.useRef();
9817
- const load = React54__namespace.default.useCallback((query) => {
9843
+ const [opts, setOpts] = React55__namespace.default.useState([]);
9844
+ const [loading, setLoading] = React55__namespace.default.useState(false);
9845
+ const reqRef = React55__namespace.default.useRef(0);
9846
+ const debRef = React55__namespace.default.useRef();
9847
+ const load = React55__namespace.default.useCallback((query) => {
9818
9848
  const id = ++reqRef.current;
9819
9849
  setLoading(true);
9820
9850
  Promise.resolve(col.loadValueOptions(query)).then(
@@ -9829,16 +9859,16 @@ function AsyncFilterValue({ col, value, onChange }) {
9829
9859
  }
9830
9860
  );
9831
9861
  }, [col]);
9832
- React54__namespace.default.useEffect(() => {
9862
+ React55__namespace.default.useEffect(() => {
9833
9863
  load("");
9834
9864
  return () => clearTimeout(debRef.current);
9835
9865
  }, [load]);
9836
- const onInput = React54__namespace.default.useCallback((q) => {
9866
+ const onInput = React55__namespace.default.useCallback((q) => {
9837
9867
  clearTimeout(debRef.current);
9838
9868
  debRef.current = setTimeout(() => load(q), 250);
9839
9869
  }, [load]);
9840
9870
  const selected = Array.isArray(value) ? value : [];
9841
- const merged = React54__namespace.default.useMemo(() => {
9871
+ const merged = React55__namespace.default.useMemo(() => {
9842
9872
  const seen2 = new Set(opts.map((o) => o.value));
9843
9873
  return [...selected.filter((v) => !seen2.has(v)).map((v) => ({ value: v, label: String(v) })), ...opts];
9844
9874
  }, [opts, selected]);
@@ -9857,9 +9887,9 @@ function AsyncFilterValue({ col, value, onChange }) {
9857
9887
  );
9858
9888
  }
9859
9889
  function EditCell({ col, value, options, onChange, onCommit, onCommitValue, onCancel, onKeyDown }) {
9860
- const ref = React54__namespace.default.useRef(null);
9890
+ const ref = React55__namespace.default.useRef(null);
9861
9891
  const isSelect = col.editType === "select" || options && col.editType !== "text";
9862
- React54__namespace.default.useEffect(() => {
9892
+ React55__namespace.default.useEffect(() => {
9863
9893
  if (isSelect) {
9864
9894
  const t = setTimeout(() => ref.current?.querySelector(".twc-sel__trigger")?.click(), 0);
9865
9895
  return () => clearTimeout(t);
@@ -10034,6 +10064,7 @@ function Datatable({
10034
10064
  onColumnVisibilityChange,
10035
10065
  batchActions = [],
10036
10066
  onRowSelectionChange,
10067
+ selectionSummary,
10037
10068
  getRowStyle,
10038
10069
  getRowClassName,
10039
10070
  showExport = false,
@@ -10124,21 +10155,21 @@ function Datatable({
10124
10155
  }) {
10125
10156
  const __twcStyles = useScopedStyles("twc-dt-styles", DT_CSS);
10126
10157
  const isDiff = !!diff;
10127
- const [diffOnly, setDiffOnly] = React54__namespace.default.useState(diff && diff.onlyChanged !== void 0 ? diff.onlyChanged : true);
10158
+ const [diffOnly, setDiffOnly] = React55__namespace.default.useState(diff && diff.onlyChanged !== void 0 ? diff.onlyChanged : true);
10128
10159
  const diffRowKey = diff && diff.rowKey || rowKeyProp || ((r2) => r2 == null ? r2 : r2.id);
10129
- const diffData = React54__namespace.default.useMemo(
10160
+ const diffData = React55__namespace.default.useMemo(
10130
10161
  () => isDiff ? classifyDiff(diff.from || [], diff.to || [], columnsProp, diffRowKey, { moveDetection: diff.moveDetection, compare: diff.compare }) : null,
10131
10162
  [isDiff, diff, columnsProp]
10132
10163
  // eslint-disable-line react-hooks/exhaustive-deps
10133
10164
  );
10134
- const onClassifiedRef = React54__namespace.default.useRef(diff && diff.onClassified);
10165
+ const onClassifiedRef = React55__namespace.default.useRef(diff && diff.onClassified);
10135
10166
  onClassifiedRef.current = diff && diff.onClassified;
10136
- React54__namespace.default.useEffect(() => {
10167
+ React55__namespace.default.useEffect(() => {
10137
10168
  if (diffData && onClassifiedRef.current) onClassifiedRef.current(diffData.counts);
10138
10169
  }, [diffData]);
10139
- const diffRowKeyFn = React54__namespace.default.useCallback((r2) => r2.__diffKey, []);
10140
- const [userCombine, setUserCombine] = React54__namespace.default.useState({});
10141
- const columns = React54__namespace.default.useMemo(
10170
+ const diffRowKeyFn = React55__namespace.default.useCallback((r2) => r2.__diffKey, []);
10171
+ const [userCombine, setUserCombine] = React55__namespace.default.useState({});
10172
+ const columns = React55__namespace.default.useMemo(
10142
10173
  () => {
10143
10174
  if (!isDiff) return columnsProp;
10144
10175
  const byField = {};
@@ -10151,12 +10182,12 @@ function Datatable({
10151
10182
  },
10152
10183
  [isDiff, columnsProp, userCombine]
10153
10184
  );
10154
- const rows = React54__namespace.default.useMemo(
10185
+ const rows = React55__namespace.default.useMemo(
10155
10186
  () => isDiff ? diffData.rows.filter((r2) => !diffOnly || r2.op !== "unchanged").map((r2) => ({ ...r2.to || r2.from, __diffop: r2.op, __diffMeta: r2, __diffKey: r2.key })) : rowsProp,
10156
10187
  [isDiff, diffData, diffOnly, rowsProp]
10157
10188
  );
10158
10189
  const rowKey = isDiff ? diffRowKeyFn : rowKeyProp;
10159
- const cols = React54__namespace.default.useMemo(() => {
10190
+ const cols = React55__namespace.default.useMemo(() => {
10160
10191
  const seenFields = /* @__PURE__ */ new Map();
10161
10192
  for (const c of columns) {
10162
10193
  if (!c || c.field == null) continue;
@@ -10224,9 +10255,9 @@ function Datatable({
10224
10255
  }
10225
10256
  return out;
10226
10257
  }, [columns, rowPinning, userCombine, defaultColumn]);
10227
- const _autoKey = React54__namespace.default.useRef();
10258
+ const _autoKey = React55__namespace.default.useRef();
10228
10259
  if (!_autoKey.current) _autoKey.current = { map: /* @__PURE__ */ new WeakMap(), n: 0 };
10229
- const keyOf = React54__namespace.default.useCallback(rowKey || ((r2, i) => {
10260
+ const keyOf = React55__namespace.default.useCallback(rowKey || ((r2, i) => {
10230
10261
  if (r2 != null && r2.id != null) return r2.id;
10231
10262
  if (r2 != null && typeof r2 === "object") {
10232
10263
  const m = _autoKey.current.map;
@@ -10239,19 +10270,19 @@ function Datatable({
10239
10270
  }
10240
10271
  return i;
10241
10272
  }), [rowKey]);
10242
- const [sort, setSort] = React54__namespace.default.useState(null);
10243
- const [filters, setFilters] = React54__namespace.default.useState([]);
10273
+ const [sort, setSort] = React55__namespace.default.useState(null);
10274
+ const [filters, setFilters] = React55__namespace.default.useState([]);
10244
10275
  const filterLogicControlled = filterLogicProp !== void 0;
10245
- const [filterLogicInternal, setFilterLogicInternal] = React54__namespace.default.useState(defaultFilterLogic === "or" ? "or" : "and");
10276
+ const [filterLogicInternal, setFilterLogicInternal] = React55__namespace.default.useState(defaultFilterLogic === "or" ? "or" : "and");
10246
10277
  const filterLogic = filterLogicControlled ? filterLogicProp === "or" ? "or" : "and" : filterLogicInternal;
10247
10278
  const setFilterLogic = (next) => {
10248
10279
  const v = next === "or" ? "or" : "and";
10249
10280
  if (!filterLogicControlled) setFilterLogicInternal(v);
10250
10281
  onFilterLogicChange?.(v);
10251
10282
  };
10252
- const [hidden, setHidden] = React54__namespace.default.useState(() => /* @__PURE__ */ new Set());
10253
- const [showRowNum, setShowRowNum] = React54__namespace.default.useState(rowNumbers);
10254
- const [wrapped, setWrapped] = React54__namespace.default.useState(() => new Set((columns || []).filter((c) => c.wrapText).map((c) => c.field)));
10283
+ const [hidden, setHidden] = React55__namespace.default.useState(() => /* @__PURE__ */ new Set());
10284
+ const [showRowNum, setShowRowNum] = React55__namespace.default.useState(rowNumbers);
10285
+ const [wrapped, setWrapped] = React55__namespace.default.useState(() => new Set((columns || []).filter((c) => c.wrapText).map((c) => c.field)));
10255
10286
  const toggleWrap = (field) => setWrapped((w) => {
10256
10287
  const n = new Set(w);
10257
10288
  n.has(field) ? n.delete(field) : n.add(field);
@@ -10293,7 +10324,7 @@ function Datatable({
10293
10324
  });
10294
10325
  closeCombineEditor();
10295
10326
  };
10296
- const [pins, setPins] = React54__namespace.default.useState(() => {
10327
+ const [pins, setPins] = React55__namespace.default.useState(() => {
10297
10328
  const left = [], right = [];
10298
10329
  columns.forEach((c) => {
10299
10330
  if (c.pinned === "left") left.push(c.field);
@@ -10301,23 +10332,23 @@ function Datatable({
10301
10332
  });
10302
10333
  return { left, right };
10303
10334
  });
10304
- const [density, setDensity] = React54__namespace.default.useState(densityProp);
10305
- const [internalQuick, setInternalQuick] = React54__namespace.default.useState("");
10335
+ const [density, setDensity] = React55__namespace.default.useState(densityProp);
10336
+ const [internalQuick, setInternalQuick] = React55__namespace.default.useState("");
10306
10337
  const quick = quickFilter !== void 0 ? quickFilter : internalQuick;
10307
10338
  const commitQuick = (v) => {
10308
10339
  onQuickFilterChange?.(v);
10309
10340
  if (quickFilter === void 0) setInternalQuick(v);
10310
10341
  commitPage(0);
10311
10342
  };
10312
- const [selected, setSelected] = React54__namespace.default.useState(() => /* @__PURE__ */ new Set());
10313
- const [activeRow, setActiveRow] = React54__namespace.default.useState(null);
10343
+ const [selected, setSelected] = React55__namespace.default.useState(() => /* @__PURE__ */ new Set());
10344
+ const [activeRow, setActiveRow] = React55__namespace.default.useState(null);
10314
10345
  const activeRowControlled = activeRowId !== void 0;
10315
10346
  const activeRowVal = activeRowControlled ? activeRowId : activeRow;
10316
- const [internalActiveCell, setInternalActiveCell] = React54__namespace.default.useState(null);
10347
+ const [internalActiveCell, setInternalActiveCell] = React55__namespace.default.useState(null);
10317
10348
  const activeCellControlled = activeCell !== void 0;
10318
10349
  const activeCellVal = activeCellControlled ? activeCell : internalActiveCell;
10319
- const selfCellSigRef = React54__namespace.default.useRef(null);
10320
- const jumpAppliedRef = React54__namespace.default.useRef(null);
10350
+ const selfCellSigRef = React55__namespace.default.useRef(null);
10351
+ const jumpAppliedRef = React55__namespace.default.useRef(null);
10321
10352
  const commitActiveCell = (next) => {
10322
10353
  const sig = next ? next.key + "\0" + next.field : null;
10323
10354
  selfCellSigRef.current = sig;
@@ -10325,10 +10356,10 @@ function Datatable({
10325
10356
  onActiveCellChange?.(next);
10326
10357
  if (!activeCellControlled) setInternalActiveCell(next);
10327
10358
  };
10328
- const [anchorCell, setAnchorCell] = React54__namespace.default.useState(null);
10329
- const gridId = React54__namespace.default.useId();
10330
- const [internalPage, setInternalPage] = React54__namespace.default.useState(0);
10331
- const [internalRpp, setInternalRpp] = React54__namespace.default.useState(pageSize > 0 ? pageSize : 10);
10359
+ const [anchorCell, setAnchorCell] = React55__namespace.default.useState(null);
10360
+ const gridId = React55__namespace.default.useId();
10361
+ const [internalPage, setInternalPage] = React55__namespace.default.useState(0);
10362
+ const [internalRpp, setInternalRpp] = React55__namespace.default.useState(pageSize > 0 ? pageSize : 10);
10332
10363
  const pageControlled = page !== void 0;
10333
10364
  const pageSizeControlled = onPageSizeChange !== void 0;
10334
10365
  const pageVal = pageControlled ? page : internalPage;
@@ -10342,42 +10373,42 @@ function Datatable({
10342
10373
  if (!pageSizeControlled) setInternalRpp(next);
10343
10374
  commitPage(0);
10344
10375
  };
10345
- const [colQuery, setColQuery] = React54__namespace.default.useState("");
10346
- const [widths, setWidths] = React54__namespace.default.useState({});
10347
- const [order, setOrder] = React54__namespace.default.useState(() => columns.map((c) => c.field));
10348
- const [drag, setDrag] = React54__namespace.default.useState({ from: null, over: null, after: false });
10349
- const [aggOn, setAggOn] = React54__namespace.default.useState(showAggregation);
10350
- const [focus, setFocus] = React54__namespace.default.useState({ r: 0, c: 0 });
10351
- const [interacting, setInteracting] = React54__namespace.default.useState(null);
10352
- const gridRef = React54__namespace.default.useRef(null);
10353
- const [groupBy, setGroupBy] = React54__namespace.default.useState(rowGrouping || []);
10354
- const [internalCollapsed, setInternalCollapsed] = React54__namespace.default.useState(() => new Set(defaultCollapsedGroups));
10376
+ const [colQuery, setColQuery] = React55__namespace.default.useState("");
10377
+ const [widths, setWidths] = React55__namespace.default.useState({});
10378
+ const [order, setOrder] = React55__namespace.default.useState(() => columns.map((c) => c.field));
10379
+ const [drag, setDrag] = React55__namespace.default.useState({ from: null, over: null, after: false });
10380
+ const [aggOn, setAggOn] = React55__namespace.default.useState(showAggregation);
10381
+ const [focus, setFocus] = React55__namespace.default.useState({ r: 0, c: 0 });
10382
+ const [interacting, setInteracting] = React55__namespace.default.useState(null);
10383
+ const gridRef = React55__namespace.default.useRef(null);
10384
+ const [groupBy, setGroupBy] = React55__namespace.default.useState(rowGrouping || []);
10385
+ const [internalCollapsed, setInternalCollapsed] = React55__namespace.default.useState(() => new Set(defaultCollapsedGroups));
10355
10386
  const collapsedControlled = collapsedGroups !== void 0;
10356
- const collapsedSet = React54__namespace.default.useMemo(() => new Set(collapsedControlled ? collapsedGroups : internalCollapsed), [collapsedControlled, collapsedGroups, internalCollapsed]);
10357
- const collapsedKey = React54__namespace.default.useMemo(() => [...collapsedSet].sort().join("\0"), [collapsedSet]);
10358
- const [internalExpanded, setInternalExpanded] = React54__namespace.default.useState(() => /* @__PURE__ */ new Set());
10387
+ const collapsedSet = React55__namespace.default.useMemo(() => new Set(collapsedControlled ? collapsedGroups : internalCollapsed), [collapsedControlled, collapsedGroups, internalCollapsed]);
10388
+ const collapsedKey = React55__namespace.default.useMemo(() => [...collapsedSet].sort().join("\0"), [collapsedSet]);
10389
+ const [internalExpanded, setInternalExpanded] = React55__namespace.default.useState(() => /* @__PURE__ */ new Set());
10359
10390
  const expandControlled = expandedRowIds !== void 0;
10360
- const expandedSet = React54__namespace.default.useMemo(
10391
+ const expandedSet = React55__namespace.default.useMemo(
10361
10392
  () => new Set(expandControlled ? expandedRowIds : internalExpanded),
10362
10393
  [expandControlled, expandedRowIds, internalExpanded]
10363
10394
  );
10364
- const expandedKey = React54__namespace.default.useMemo(() => JSON.stringify([...expandedSet].sort()), [expandedSet]);
10365
- const [pinnedRows, setPinnedRows] = React54__namespace.default.useState({ top: [], bottom: [] });
10366
- const [headH, setHeadH] = React54__namespace.default.useState(41);
10367
- const theadRef = React54__namespace.default.useRef(null);
10368
- const [rowOrder, setRowOrder] = React54__namespace.default.useState(null);
10369
- React54__namespace.default.useEffect(() => {
10395
+ const expandedKey = React55__namespace.default.useMemo(() => JSON.stringify([...expandedSet].sort()), [expandedSet]);
10396
+ const [pinnedRows, setPinnedRows] = React55__namespace.default.useState({ top: [], bottom: [] });
10397
+ const [headH, setHeadH] = React55__namespace.default.useState(41);
10398
+ const theadRef = React55__namespace.default.useRef(null);
10399
+ const [rowOrder, setRowOrder] = React55__namespace.default.useState(null);
10400
+ React55__namespace.default.useEffect(() => {
10370
10401
  if (serverMode) setRowOrder(null);
10371
10402
  }, [rows, serverMode]);
10372
- const [rowHeights, setRowHeights] = React54__namespace.default.useState({});
10373
- const [rowDrag, setRowDrag] = React54__namespace.default.useState({ from: null, over: null, after: false });
10374
- const [rowGrab, setRowGrab] = React54__namespace.default.useState(null);
10375
- const [reorderMsg, setReorderMsg] = React54__namespace.default.useState("");
10376
- const rowFocusRef = React54__namespace.default.useRef(null);
10377
- const [fWidths, setFWidths] = React54__namespace.default.useState({});
10378
- const [fPanelSize, setFPanelSize] = React54__namespace.default.useState(null);
10379
- const [batchNameW, setBatchNameW] = React54__namespace.default.useState(null);
10380
- const [popSizes, setPopSizes] = React54__namespace.default.useState({});
10403
+ const [rowHeights, setRowHeights] = React55__namespace.default.useState({});
10404
+ const [rowDrag, setRowDrag] = React55__namespace.default.useState({ from: null, over: null, after: false });
10405
+ const [rowGrab, setRowGrab] = React55__namespace.default.useState(null);
10406
+ const [reorderMsg, setReorderMsg] = React55__namespace.default.useState("");
10407
+ const rowFocusRef = React55__namespace.default.useRef(null);
10408
+ const [fWidths, setFWidths] = React55__namespace.default.useState({});
10409
+ const [fPanelSize, setFPanelSize] = React55__namespace.default.useState(null);
10410
+ const [batchNameW, setBatchNameW] = React55__namespace.default.useState(null);
10411
+ const [popSizes, setPopSizes] = React55__namespace.default.useState({});
10381
10412
  const serializeState = () => ({
10382
10413
  filters: filters.map(({ id, ...f }) => f),
10383
10414
  // strip the internal row id
@@ -10462,11 +10493,11 @@ function Datatable({
10462
10493
  if (Array.isArray(s.grouping)) setGroupBy(s.grouping.filter((f) => known.has(f)));
10463
10494
  if (Array.isArray(s.collapsedGroups) && !collapsedControlled) setInternalCollapsed(new Set(s.collapsedGroups.filter((k) => typeof k === "string")));
10464
10495
  };
10465
- const stateReadyRef = React54__namespace.default.useRef(false);
10466
- const stateRestoredRef = React54__namespace.default.useRef(false);
10467
- const onStateChangeRef = React54__namespace.default.useRef(onStateChange);
10496
+ const stateReadyRef = React55__namespace.default.useRef(false);
10497
+ const stateRestoredRef = React55__namespace.default.useRef(false);
10498
+ const onStateChangeRef = React55__namespace.default.useRef(onStateChange);
10468
10499
  onStateChangeRef.current = onStateChange;
10469
- React54__namespace.default.useEffect(() => {
10500
+ React55__namespace.default.useEffect(() => {
10470
10501
  if (!stateReadyRef.current) return void 0;
10471
10502
  if (!stateKey && !onStateChange) return void 0;
10472
10503
  const state = serializeState();
@@ -10492,7 +10523,7 @@ function Datatable({
10492
10523
  if (saved) applyState(saved);
10493
10524
  stateRestoredRef.current = true;
10494
10525
  };
10495
- React54__namespace.default.useEffect(() => {
10526
+ React55__namespace.default.useEffect(() => {
10496
10527
  if (columns.length) {
10497
10528
  restoreState();
10498
10529
  stateReadyRef.current = true;
@@ -10501,14 +10532,14 @@ function Datatable({
10501
10532
  stateReadyRef.current = false;
10502
10533
  };
10503
10534
  }, []);
10504
- React54__namespace.default.useEffect(() => {
10535
+ React55__namespace.default.useEffect(() => {
10505
10536
  if (stateRestoredRef.current || !columns.length) return;
10506
10537
  restoreState();
10507
10538
  stateReadyRef.current = true;
10508
10539
  }, [columns.length]);
10509
- const rootRef = React54__namespace.default.useRef(null);
10510
- const [compact, setCompact] = React54__namespace.default.useState(false);
10511
- React54__namespace.default.useEffect(() => {
10540
+ const rootRef = React55__namespace.default.useRef(null);
10541
+ const [compact, setCompact] = React55__namespace.default.useState(false);
10542
+ React55__namespace.default.useEffect(() => {
10512
10543
  const el = rootRef.current;
10513
10544
  if (!el) return void 0;
10514
10545
  const measure = () => setCompact((el.clientWidth || 0) < 720);
@@ -10521,13 +10552,13 @@ function Datatable({
10521
10552
  else if (typeof window !== "undefined") window.removeEventListener("resize", measure);
10522
10553
  };
10523
10554
  }, []);
10524
- const scrollRef = React54__namespace.default.useRef(null);
10525
- const filterPanelRef = React54__namespace.default.useRef(null);
10526
- const measureCanvas = React54__namespace.default.useRef(null);
10527
- const [scrollTop, setScrollTop] = React54__namespace.default.useState(0);
10528
- const [viewportH, setViewportH] = React54__namespace.default.useState(0);
10529
- const [ovTip, setOvTip] = React54__namespace.default.useState(null);
10530
- const ovTimer = React54__namespace.default.useRef(null);
10555
+ const scrollRef = React55__namespace.default.useRef(null);
10556
+ const filterPanelRef = React55__namespace.default.useRef(null);
10557
+ const measureCanvas = React55__namespace.default.useRef(null);
10558
+ const [scrollTop, setScrollTop] = React55__namespace.default.useState(0);
10559
+ const [viewportH, setViewportH] = React55__namespace.default.useState(0);
10560
+ const [ovTip, setOvTip] = React55__namespace.default.useState(null);
10561
+ const ovTimer = React55__namespace.default.useRef(null);
10531
10562
  const hideOverflowTip = () => {
10532
10563
  clearTimeout(ovTimer.current);
10533
10564
  setOvTip((t) => t ? null : t);
@@ -10551,8 +10582,8 @@ function Datatable({
10551
10582
  if (el && el.scrollWidth > el.clientWidth + 1) setOvTip({ anchor: el, text: el.getAttribute("data-ovtext") });
10552
10583
  else hideOverflowTip();
10553
10584
  };
10554
- React54__namespace.default.useEffect(() => () => clearTimeout(ovTimer.current), []);
10555
- React54__namespace.default.useEffect(() => {
10585
+ React55__namespace.default.useEffect(() => () => clearTimeout(ovTimer.current), []);
10586
+ React55__namespace.default.useEffect(() => {
10556
10587
  if (!ovTip) return void 0;
10557
10588
  const onKey = (e) => {
10558
10589
  if (e.key === "Escape") setOvTip(null);
@@ -10560,8 +10591,8 @@ function Datatable({
10560
10591
  document.addEventListener("keydown", onKey);
10561
10592
  return () => document.removeEventListener("keydown", onKey);
10562
10593
  }, [ovTip]);
10563
- const [pivotOn, setPivotOn] = React54__namespace.default.useState(pivotMode);
10564
- const [aggConfig, setAggConfig] = React54__namespace.default.useState(() => {
10594
+ const [pivotOn, setPivotOn] = React55__namespace.default.useState(pivotMode);
10595
+ const [aggConfig, setAggConfig] = React55__namespace.default.useState(() => {
10565
10596
  const m = {};
10566
10597
  (columns || []).forEach((c) => {
10567
10598
  if (typeof c.aggregation === "string") m[c.field] = c.aggregation;
@@ -10569,26 +10600,26 @@ function Datatable({
10569
10600
  return m;
10570
10601
  });
10571
10602
  const aggOf = (c) => aggConfig[c.field] || (typeof c.aggregation === "function" ? c.aggregation : null);
10572
- const [pivotConfig, setPivotConfig] = React54__namespace.default.useState(() => ({
10603
+ const [pivotConfig, setPivotConfig] = React55__namespace.default.useState(() => ({
10573
10604
  rows: pivot && pivot.rows || [],
10574
10605
  columns: pivot && pivot.columns || [],
10575
10606
  values: pivot && pivot.values || []
10576
10607
  }));
10577
10608
  const pivotActive = pivotOn && pivotConfig.rows.length > 0 && pivotConfig.values.length > 0;
10578
- React54__namespace.default.useEffect(() => {
10609
+ React55__namespace.default.useEffect(() => {
10579
10610
  setOrder((prev) => mergeColOrder(prev, columns.map((c) => c.field).filter(Boolean)));
10580
10611
  }, [columns]);
10581
- const densityPropRef = React54__namespace.default.useRef(densityProp);
10582
- React54__namespace.default.useEffect(() => {
10612
+ const densityPropRef = React55__namespace.default.useRef(densityProp);
10613
+ React55__namespace.default.useEffect(() => {
10583
10614
  if (densityPropRef.current === densityProp) return;
10584
10615
  densityPropRef.current = densityProp;
10585
10616
  setDensity(densityProp);
10586
10617
  }, [densityProp]);
10587
- React54__namespace.default.useEffect(() => {
10618
+ React55__namespace.default.useEffect(() => {
10588
10619
  setAggOn(showAggregation);
10589
10620
  }, [showAggregation]);
10590
- const pageSizePropRef = React54__namespace.default.useRef(pageSize);
10591
- React54__namespace.default.useEffect(() => {
10621
+ const pageSizePropRef = React55__namespace.default.useRef(pageSize);
10622
+ React55__namespace.default.useEffect(() => {
10592
10623
  if (pageSizePropRef.current === pageSize) return;
10593
10624
  pageSizePropRef.current = pageSize;
10594
10625
  if (pageSizeControlled) return;
@@ -10596,8 +10627,8 @@ function Datatable({
10596
10627
  setInternalPage(0);
10597
10628
  }, [pageSize]);
10598
10629
  const rowGroupingKey = (rowGrouping || []).join("\0");
10599
- const rowGroupingKeyRef = React54__namespace.default.useRef(rowGroupingKey);
10600
- React54__namespace.default.useEffect(() => {
10630
+ const rowGroupingKeyRef = React55__namespace.default.useRef(rowGroupingKey);
10631
+ React55__namespace.default.useEffect(() => {
10601
10632
  if (rowGroupingKeyRef.current === rowGroupingKey) return;
10602
10633
  rowGroupingKeyRef.current = rowGroupingKey;
10603
10634
  setGroupBy(rowGrouping || []);
@@ -10615,29 +10646,29 @@ function Datatable({
10615
10646
  };
10616
10647
  const intrinsicWidth = (c) => c.width === "auto" ? autoWidth(c) : typeof c.width === "number" ? c.width : 160;
10617
10648
  const widthOf = (c) => clampWidth(widths[c.field] ?? intrinsicWidth(c), c);
10618
- const [colMenu, setColMenu] = React54__namespace.default.useState(null);
10649
+ const [colMenu, setColMenu] = React55__namespace.default.useState(null);
10619
10650
  const [menuPos, openMenu, closeMenu] = useFloating();
10620
- const [panel, setPanel] = React54__namespace.default.useState(null);
10651
+ const [panel, setPanel] = React55__namespace.default.useState(null);
10621
10652
  const [panelPos, openPanel, closePanel] = useFloating();
10622
- const [combineTarget, setCombineTarget] = React54__namespace.default.useState(null);
10623
- const [combineDraft, setCombineDraft] = React54__namespace.default.useState(null);
10624
- const combinePanelRef = React54__namespace.default.useRef(null);
10625
- React54__namespace.default.useEffect(() => {
10653
+ const [combineTarget, setCombineTarget] = React55__namespace.default.useState(null);
10654
+ const [combineDraft, setCombineDraft] = React55__namespace.default.useState(null);
10655
+ const combinePanelRef = React55__namespace.default.useRef(null);
10656
+ React55__namespace.default.useEffect(() => {
10626
10657
  if (panel === "combine" && combinePanelRef.current) {
10627
10658
  const el = combinePanelRef.current.querySelector('[role="switch"], button, [tabindex]');
10628
10659
  (el || combinePanelRef.current).focus?.();
10629
10660
  }
10630
10661
  }, [panel]);
10631
- const [rowMenu, setRowMenu] = React54__namespace.default.useState(null);
10662
+ const [rowMenu, setRowMenu] = React55__namespace.default.useState(null);
10632
10663
  const [rowMenuPos, openRowMenu, closeRowMenu] = useFloating();
10633
- const [exportOpen, setExportOpen] = React54__namespace.default.useState(false);
10664
+ const [exportOpen, setExportOpen] = React55__namespace.default.useState(false);
10634
10665
  const [exportPos, openExport, closeExport] = useFloating();
10635
- const menuTriggerRef = React54__namespace.default.useRef(null);
10636
- const colMenuRef = React54__namespace.default.useRef(null);
10637
- const rowMenuRef = React54__namespace.default.useRef(null);
10638
- const exportMenuRef = React54__namespace.default.useRef(null);
10639
- const quickSearchRef = React54__namespace.default.useRef(null);
10640
- const colSearchRef = React54__namespace.default.useRef(null);
10666
+ const menuTriggerRef = React55__namespace.default.useRef(null);
10667
+ const colMenuRef = React55__namespace.default.useRef(null);
10668
+ const rowMenuRef = React55__namespace.default.useRef(null);
10669
+ const exportMenuRef = React55__namespace.default.useRef(null);
10670
+ const quickSearchRef = React55__namespace.default.useRef(null);
10671
+ const colSearchRef = React55__namespace.default.useRef(null);
10641
10672
  function focusFirstItem(container) {
10642
10673
  if (!container) return;
10643
10674
  const first = container.querySelector('[role="menuitem"]:not([disabled])');
@@ -10676,16 +10707,16 @@ function Datatable({
10676
10707
  restoreTriggerFocus();
10677
10708
  }
10678
10709
  }
10679
- React54__namespace.default.useEffect(() => {
10710
+ React55__namespace.default.useEffect(() => {
10680
10711
  if (colMenu) focusFirstItem(colMenuRef.current);
10681
10712
  }, [colMenu]);
10682
- React54__namespace.default.useEffect(() => {
10713
+ React55__namespace.default.useEffect(() => {
10683
10714
  if (rowMenu) focusFirstItem(rowMenuRef.current);
10684
10715
  }, [rowMenu]);
10685
- React54__namespace.default.useEffect(() => {
10716
+ React55__namespace.default.useEffect(() => {
10686
10717
  if (exportOpen) focusFirstItem(exportMenuRef.current);
10687
10718
  }, [exportOpen]);
10688
- React54__namespace.default.useEffect(() => {
10719
+ React55__namespace.default.useEffect(() => {
10689
10720
  if (!colMenu && !panel && !rowMenu) return;
10690
10721
  const closeAll = () => {
10691
10722
  setColMenu(null);
@@ -10708,7 +10739,7 @@ function Datatable({
10708
10739
  document.removeEventListener("keydown", onKey);
10709
10740
  };
10710
10741
  }, [colMenu, panel, rowMenu]);
10711
- React54__namespace.default.useEffect(() => {
10742
+ React55__namespace.default.useEffect(() => {
10712
10743
  if (!exportOpen) return;
10713
10744
  const close = () => {
10714
10745
  setExportOpen(false);
@@ -10727,37 +10758,37 @@ function Datatable({
10727
10758
  document.removeEventListener("keydown", onKey);
10728
10759
  };
10729
10760
  }, [exportOpen]);
10730
- const colByField = React54__namespace.default.useMemo(() => Object.fromEntries(cols.map((c) => [c.field, c])), [cols]);
10761
+ const colByField = React55__namespace.default.useMemo(() => Object.fromEntries(cols.map((c) => [c.field, c])), [cols]);
10731
10762
  const fieldLabel = (f) => colLabel(colByField[f] || { field: f });
10732
- const combineSources = React54__namespace.default.useMemo(() => {
10763
+ const combineSources = React55__namespace.default.useMemo(() => {
10733
10764
  const s = /* @__PURE__ */ new Set();
10734
10765
  for (const cfg of Object.values(userCombine)) (cfg && cfg.fields ? cfg.fields : []).slice(1).forEach((f) => s.add(f));
10735
10766
  return s;
10736
10767
  }, [userCombine]);
10737
- const stackCombineTargets = React54__namespace.default.useMemo(
10768
+ const stackCombineTargets = React55__namespace.default.useMemo(
10738
10769
  () => new Set(cols.filter((c) => {
10739
10770
  const cfg = combineCfg(userCombine[c.field] || c.combine);
10740
10771
  return cfg && cfg.layout === "stack";
10741
10772
  }).map((c) => c.field)),
10742
10773
  [cols, userCombine]
10743
10774
  );
10744
- const effectiveHidden = React54__namespace.default.useMemo(() => combineSources.size ? /* @__PURE__ */ new Set([...hidden, ...combineSources]) : hidden, [hidden, combineSources]);
10745
- const effectiveWrapped = React54__namespace.default.useMemo(() => stackCombineTargets.size ? /* @__PURE__ */ new Set([...wrapped, ...stackCombineTargets]) : wrapped, [wrapped, stackCombineTargets]);
10746
- const visibleCols = React54__namespace.default.useMemo(() => cols.filter((c) => !effectiveHidden.has(c.field)), [cols, effectiveHidden]);
10775
+ const effectiveHidden = React55__namespace.default.useMemo(() => combineSources.size ? /* @__PURE__ */ new Set([...hidden, ...combineSources]) : hidden, [hidden, combineSources]);
10776
+ const effectiveWrapped = React55__namespace.default.useMemo(() => stackCombineTargets.size ? /* @__PURE__ */ new Set([...wrapped, ...stackCombineTargets]) : wrapped, [wrapped, stackCombineTargets]);
10777
+ const visibleCols = React55__namespace.default.useMemo(() => cols.filter((c) => !effectiveHidden.has(c.field)), [cols, effectiveHidden]);
10747
10778
  const colFieldsKey = JSON.stringify(
10748
10779
  cols.filter((c) => typeof c.field === "string" && c.type !== "actions").map((c) => c.field)
10749
10780
  );
10750
- const colFields = React54__namespace.default.useMemo(() => JSON.parse(colFieldsKey), [colFieldsKey]);
10781
+ const colFields = React55__namespace.default.useMemo(() => JSON.parse(colFieldsKey), [colFieldsKey]);
10751
10782
  const hiddenKey = JSON.stringify([...hidden].filter((f) => typeof f === "string").sort());
10752
- const visibleColumns = React54__namespace.default.useMemo(() => {
10783
+ const visibleColumns = React55__namespace.default.useMemo(() => {
10753
10784
  const h = new Set(JSON.parse(hiddenKey));
10754
10785
  return colFields.filter((f) => !h.has(f));
10755
10786
  }, [colFields, hiddenKey]);
10756
- const hiddenColumns = React54__namespace.default.useMemo(() => {
10787
+ const hiddenColumns = React55__namespace.default.useMemo(() => {
10757
10788
  const h = new Set(JSON.parse(hiddenKey));
10758
10789
  return colFields.filter((f) => h.has(f));
10759
10790
  }, [colFields, hiddenKey]);
10760
- const ordered = React54__namespace.default.useMemo(() => {
10791
+ const ordered = React55__namespace.default.useMemo(() => {
10761
10792
  const orderIdx = (f) => {
10762
10793
  const i = order.indexOf(f);
10763
10794
  return i === -1 ? 9999 : i;
@@ -10776,8 +10807,8 @@ function Datatable({
10776
10807
  const EXP_W = hasExpandCol ? 44 : 0;
10777
10808
  const numLeft = EXP_W + CHK_W;
10778
10809
  const leadW = numLeft + (showRowNum ? NUM_W : 0);
10779
- const visLeft = React54__namespace.default.useMemo(() => pins.left.filter((f) => colByField[f] && !effectiveHidden.has(f)), [pins.left, colByField, effectiveHidden]);
10780
- const visRight = React54__namespace.default.useMemo(() => pins.right.filter((f) => colByField[f] && !effectiveHidden.has(f)), [pins.right, colByField, effectiveHidden]);
10810
+ const visLeft = React55__namespace.default.useMemo(() => pins.left.filter((f) => colByField[f] && !effectiveHidden.has(f)), [pins.left, colByField, effectiveHidden]);
10811
+ const visRight = React55__namespace.default.useMemo(() => pins.right.filter((f) => colByField[f] && !effectiveHidden.has(f)), [pins.right, colByField, effectiveHidden]);
10781
10812
  const stickyOf = (field) => {
10782
10813
  if (visLeft.includes(field)) {
10783
10814
  let off = leadW;
@@ -10800,7 +10831,7 @@ function Datatable({
10800
10831
  }
10801
10832
  return {};
10802
10833
  };
10803
- const processed = React54__namespace.default.useMemo(() => {
10834
+ const processed = React55__namespace.default.useMemo(() => {
10804
10835
  if (serverMode) {
10805
10836
  if (rowOrder) {
10806
10837
  const idx = new Map(rowOrder.map((k, i) => [k, i]));
@@ -10842,14 +10873,14 @@ function Datatable({
10842
10873
  const serverTotal = rowCount == null ? processed.length : rowCount;
10843
10874
  const totalRows = serverMode ? serverTotal : processed.length;
10844
10875
  const totalPages = paginated ? Math.max(1, Math.ceil(totalRows / sizeVal)) : 1;
10845
- const paged = React54__namespace.default.useMemo(
10876
+ const paged = React55__namespace.default.useMemo(
10846
10877
  () => !paginated || serverMode ? processed : processed.slice(pageVal * sizeVal, pageVal * sizeVal + sizeVal),
10847
10878
  [processed, paginated, serverMode, pageVal, sizeVal]
10848
10879
  );
10849
- React54__namespace.default.useEffect(() => {
10880
+ React55__namespace.default.useEffect(() => {
10850
10881
  if (pageVal > totalPages - 1) commitPage(0);
10851
10882
  }, [totalPages]);
10852
- const treeRows = React54__namespace.default.useMemo(() => {
10883
+ const treeRows = React55__namespace.default.useMemo(() => {
10853
10884
  if (serverMode || typeof getSubRows !== "function") return null;
10854
10885
  const out = [];
10855
10886
  const seen2 = /* @__PURE__ */ new Set();
@@ -10863,12 +10894,12 @@ function Datatable({
10863
10894
  for (const r2 of paged) walk(r2, 0);
10864
10895
  return out;
10865
10896
  }, [serverMode, getSubRows, paged, expandedSet, keyOf]);
10866
- const depthByKey = React54__namespace.default.useMemo(() => {
10897
+ const depthByKey = React55__namespace.default.useMemo(() => {
10867
10898
  const m = /* @__PURE__ */ new Map();
10868
10899
  if (treeRows) for (const t of treeRows) m.set(keyOf(t.row), t.depth);
10869
10900
  return m;
10870
10901
  }, [treeRows, keyOf]);
10871
- const treeSeqByKey = React54__namespace.default.useMemo(() => {
10902
+ const treeSeqByKey = React55__namespace.default.useMemo(() => {
10872
10903
  if (!treeRows) return null;
10873
10904
  const m = /* @__PURE__ */ new Map();
10874
10905
  const seen2 = /* @__PURE__ */ new Set();
@@ -10883,7 +10914,7 @@ function Datatable({
10883
10914
  for (const r2 of processed) walk(r2);
10884
10915
  return m;
10885
10916
  }, [treeRows, processed, expandedSet, getSubRows, keyOf]);
10886
- const activeGroupBy = React54__namespace.default.useMemo(() => groupBy.filter((f) => colByField[f]), [groupBy, colByField]);
10917
+ const activeGroupBy = React55__namespace.default.useMemo(() => groupBy.filter((f) => colByField[f]), [groupBy, colByField]);
10887
10918
  function subtotalText(rowsIn) {
10888
10919
  const parts = [];
10889
10920
  for (const c of ordered) {
@@ -10910,7 +10941,7 @@ function Datatable({
10910
10941
  if (agg === "max") return Math.max(...nums);
10911
10942
  return null;
10912
10943
  }
10913
- const displayItems = React54__namespace.default.useMemo(() => {
10944
+ const displayItems = React55__namespace.default.useMemo(() => {
10914
10945
  if (!activeGroupBy.length) return null;
10915
10946
  const build = (rowsIn, depth, prefix) => {
10916
10947
  if (depth >= activeGroupBy.length) return rowsIn.map((row) => ({ kind: "leaf", row }));
@@ -10933,7 +10964,7 @@ function Datatable({
10933
10964
  };
10934
10965
  return build(paged, 0, "");
10935
10966
  }, [activeGroupBy, collapsedSet, paged, ordered, aggOn]);
10936
- const leafRows = React54__namespace.default.useMemo(
10967
+ const leafRows = React55__namespace.default.useMemo(
10937
10968
  () => displayItems ? displayItems.filter((i) => i.kind === "leaf").map((i) => i.row) : treeRows ? treeRows.map((t) => t.row) : paged,
10938
10969
  [displayItems, treeRows, paged]
10939
10970
  );
@@ -10963,7 +10994,7 @@ function Datatable({
10963
10994
  return { top, bottom };
10964
10995
  });
10965
10996
  }
10966
- React54__namespace.default.useEffect(() => {
10997
+ React55__namespace.default.useEffect(() => {
10967
10998
  if (!rowPinning) return;
10968
10999
  const measure = () => {
10969
11000
  if (theadRef.current) setHeadH(theadRef.current.offsetHeight || 41);
@@ -10977,18 +11008,18 @@ function Datatable({
10977
11008
  const pinnedTopRows = canPinRows ? pinnedRows.top.map((k) => leafRows.find((r2, i) => keyOf(r2, i) === k)).filter(Boolean) : [];
10978
11009
  const pinnedBottomRows = canPinRows ? pinnedRows.bottom.map((k) => leafRows.find((r2, i) => keyOf(r2, i) === k)).filter(Boolean) : [];
10979
11010
  const middleRows = canPinRows ? leafRows.filter((r2, i) => !pinSideOf(keyOf(r2, i))) : leafRows;
10980
- const keyIndex = React54__namespace.default.useMemo(() => {
11011
+ const keyIndex = React55__namespace.default.useMemo(() => {
10981
11012
  const m = /* @__PURE__ */ new Map();
10982
11013
  leafRows.forEach((r2, i) => m.set(keyOf(r2, i), i));
10983
11014
  return m;
10984
11015
  }, [leafRows]);
10985
- const keyIndexMid = React54__namespace.default.useMemo(() => {
11016
+ const keyIndexMid = React55__namespace.default.useMemo(() => {
10986
11017
  const m = /* @__PURE__ */ new Map();
10987
11018
  middleRows.forEach((r2, i) => m.set(keyOf(r2, keyIndex.get(keyOf(r2)) ?? i), i));
10988
11019
  return m;
10989
11020
  }, [middleRows, keyIndex]);
10990
- const cellColIndex = React54__namespace.default.useCallback((field) => ordered.findIndex((c) => c.field === field), [ordered]);
10991
- const cellRect = React54__namespace.default.useMemo(() => {
11021
+ const cellColIndex = React55__namespace.default.useCallback((field) => ordered.findIndex((c) => c.field === field), [ordered]);
11022
+ const cellRect = React55__namespace.default.useMemo(() => {
10992
11023
  if (selectionMode !== "cell" || !activeCellVal) return null;
10993
11024
  const ar = keyIndex.get(activeCellVal.key), ac = cellColIndex(activeCellVal.field);
10994
11025
  if (ar == null || ac < 0) return null;
@@ -10998,15 +11029,15 @@ function Datatable({
10998
11029
  const c0 = nc < 0 ? ac : Math.min(ac, nc), c1 = nc < 0 ? ac : Math.max(ac, nc);
10999
11030
  return { r0, r1, c0, c1 };
11000
11031
  }, [selectionMode, activeCellVal, anchorCell, keyIndex, cellColIndex]);
11001
- const activeCellId = React54__namespace.default.useMemo(() => {
11032
+ const activeCellId = React55__namespace.default.useMemo(() => {
11002
11033
  if (selectionMode !== "cell" || !activeCellVal) return void 0;
11003
11034
  const ar = keyIndex.get(activeCellVal.key), ac = cellColIndex(activeCellVal.field);
11004
11035
  return ar == null || ac < 0 ? void 0 : `${gridId}-${ar}-${ac}`;
11005
11036
  }, [selectionMode, activeCellVal, keyIndex, cellColIndex, gridId]);
11006
- const onCellSelRef = React54__namespace.default.useRef(onCellSelectionChange);
11037
+ const onCellSelRef = React55__namespace.default.useRef(onCellSelectionChange);
11007
11038
  onCellSelRef.current = onCellSelectionChange;
11008
- const prevSelSigRef = React54__namespace.default.useRef("");
11009
- React54__namespace.default.useEffect(() => {
11039
+ const prevSelSigRef = React55__namespace.default.useRef("");
11040
+ React55__namespace.default.useEffect(() => {
11010
11041
  const cb = onCellSelRef.current;
11011
11042
  if (selectionMode !== "cell" || !cb) return;
11012
11043
  const cells = [];
@@ -11099,7 +11130,7 @@ function Datatable({
11099
11130
  setReorderMsg("Reorder cancelled.");
11100
11131
  }
11101
11132
  }
11102
- React54__namespace.default.useEffect(() => {
11133
+ React55__namespace.default.useEffect(() => {
11103
11134
  if (rowFocusRef.current == null) return;
11104
11135
  const key = rowFocusRef.current;
11105
11136
  rowFocusRef.current = null;
@@ -11111,7 +11142,7 @@ function Datatable({
11111
11142
  });
11112
11143
  const estRowH = rowHeight ?? (density === "compact" ? 36 : density === "comfortable" ? 56 : 44);
11113
11144
  const virtualizing = virtualized && !paginated && !activeGroupBy.length && !loading;
11114
- React54__namespace.default.useEffect(() => {
11145
+ React55__namespace.default.useEffect(() => {
11115
11146
  if (!virtualizing) return;
11116
11147
  const el = scrollRef.current;
11117
11148
  if (!el) return;
@@ -11121,13 +11152,13 @@ function Datatable({
11121
11152
  if (ro) ro.observe(el);
11122
11153
  return () => ro && ro.disconnect();
11123
11154
  }, [virtualizing, height]);
11124
- const onScrollVirtual = React54__namespace.default.useCallback((e) => {
11155
+ const onScrollVirtual = React55__namespace.default.useCallback((e) => {
11125
11156
  setScrollTop(e.currentTarget.scrollTop);
11126
11157
  }, []);
11127
11158
  const vh = viewportH || (typeof height === "number" ? height : 440);
11128
- const rowHRef = React54__namespace.default.useRef(/* @__PURE__ */ new Map());
11129
- const [measureTick, setMeasureTick] = React54__namespace.default.useState(0);
11130
- const offsets = React54__namespace.default.useMemo(() => {
11159
+ const rowHRef = React55__namespace.default.useRef(/* @__PURE__ */ new Map());
11160
+ const [measureTick, setMeasureTick] = React55__namespace.default.useState(0);
11161
+ const offsets = React55__namespace.default.useMemo(() => {
11131
11162
  if (!virtualizing) return null;
11132
11163
  const total = middleRows.length;
11133
11164
  const arr = new Float64Array(total + 1);
@@ -11137,7 +11168,7 @@ function Datatable({
11137
11168
  }
11138
11169
  return arr;
11139
11170
  }, [virtualizing, middleRows, estRowH, measureTick]);
11140
- const vWindow = React54__namespace.default.useMemo(() => {
11171
+ const vWindow = React55__namespace.default.useMemo(() => {
11141
11172
  if (!virtualizing || !offsets) return null;
11142
11173
  const total = middleRows.length;
11143
11174
  const totalH = offsets[total];
@@ -11166,7 +11197,7 @@ function Datatable({
11166
11197
  if (start > end) start = end;
11167
11198
  return { start, end, padTop: offsets[start], padBottom: Math.max(0, totalH - offsets[end]) };
11168
11199
  }, [virtualizing, offsets, middleRows.length, vh, scrollTop, overscan]);
11169
- React54__namespace.default.useLayoutEffect(() => {
11200
+ React55__namespace.default.useLayoutEffect(() => {
11170
11201
  if (!virtualizing) return;
11171
11202
  const el = scrollRef.current;
11172
11203
  if (!el) return;
@@ -11181,9 +11212,9 @@ function Datatable({
11181
11212
  }
11182
11213
  if (changed) setMeasureTick((t) => t + 1);
11183
11214
  });
11184
- const onServerChangeRef = React54__namespace.default.useRef(onServerChange);
11215
+ const onServerChangeRef = React55__namespace.default.useRef(onServerChange);
11185
11216
  onServerChangeRef.current = onServerChange;
11186
- React54__namespace.default.useEffect(() => {
11217
+ React55__namespace.default.useEffect(() => {
11187
11218
  if (!serverMode) return;
11188
11219
  const t = setTimeout(() => {
11189
11220
  onServerChangeRef.current?.({
@@ -11203,10 +11234,10 @@ function Datatable({
11203
11234
  }, 250);
11204
11235
  return () => clearTimeout(t);
11205
11236
  }, [serverMode, pageVal, sizeVal, sort, filters, filterLogic, quick, visibleColumns, hiddenColumns, treeExpandedKey]);
11206
- const onColVisRef = React54__namespace.default.useRef(onColumnVisibilityChange);
11237
+ const onColVisRef = React55__namespace.default.useRef(onColumnVisibilityChange);
11207
11238
  onColVisRef.current = onColumnVisibilityChange;
11208
- const lastVisibleKey = React54__namespace.default.useRef(null);
11209
- React54__namespace.default.useEffect(() => {
11239
+ const lastVisibleKey = React55__namespace.default.useRef(null);
11240
+ React55__namespace.default.useEffect(() => {
11210
11241
  const key = JSON.stringify(visibleColumns);
11211
11242
  if (lastVisibleKey.current === null) {
11212
11243
  lastVisibleKey.current = key;
@@ -11238,7 +11269,7 @@ function Datatable({
11238
11269
  return n;
11239
11270
  });
11240
11271
  }
11241
- const movableMidFields = React54__namespace.default.useMemo(
11272
+ const movableMidFields = React55__namespace.default.useMemo(
11242
11273
  () => ordered.filter((c) => !pins.left.includes(c.field) && !pins.right.includes(c.field) && c.reorderable !== false).map((c) => c.field),
11243
11274
  [ordered, pins]
11244
11275
  );
@@ -11273,7 +11304,7 @@ function Datatable({
11273
11304
  }
11274
11305
  return [...seen2.values()].sort((a, b) => String(a.label).localeCompare(String(b.label)));
11275
11306
  }
11276
- const [resizing, setResizing] = React54__namespace.default.useState(false);
11307
+ const [resizing, setResizing] = React55__namespace.default.useState(false);
11277
11308
  function startResize(e, field) {
11278
11309
  e.preventDefault();
11279
11310
  e.stopPropagation();
@@ -11380,7 +11411,7 @@ function Datatable({
11380
11411
  if (!agg) return null;
11381
11412
  if (aggregationValues && col.field in aggregationValues) {
11382
11413
  const pre = aggregationValues[col.field];
11383
- if (pre && typeof pre === "object" && !React54__namespace.default.isValidElement(pre)) {
11414
+ if (pre && typeof pre === "object" && !React55__namespace.default.isValidElement(pre)) {
11384
11415
  if (typeof agg === "string" && agg in pre) return pre[agg];
11385
11416
  } else {
11386
11417
  return pre;
@@ -11585,10 +11616,10 @@ function Datatable({
11585
11616
  }
11586
11617
  }
11587
11618
  }
11588
- React54__namespace.default.useEffect(() => {
11619
+ React55__namespace.default.useEffect(() => {
11589
11620
  setFocus((f) => ({ r: Math.min(f.r, Math.max(0, leafRows.length - 1)), c: Math.min(f.c, Math.max(0, ordered.length - 1)) }));
11590
11621
  }, [leafRows.length, ordered.length, pageVal]);
11591
- React54__namespace.default.useLayoutEffect(() => {
11622
+ React55__namespace.default.useLayoutEffect(() => {
11592
11623
  if (cellNavigation !== "widget") return;
11593
11624
  const grid = gridRef.current;
11594
11625
  if (!grid) return;
@@ -11603,12 +11634,12 @@ function Datatable({
11603
11634
  td.tabIndex = active && ws.length === 0 ? 0 : -1;
11604
11635
  });
11605
11636
  }, [cellNavigation, focus.r, focus.c, leafRows, ordered, pageVal, interacting, hidden, pins, scrollTop, loading, measureTick, viewportH, pinnedRows]);
11606
- const selectedRows = React54__namespace.default.useMemo(() => rows.filter((r2, i) => selected.has(keyOf(r2, i))), [rows, selected]);
11607
- const selKeys = React54__namespace.default.useMemo(() => [...selected], [selected]);
11608
- const onRowSelRef = React54__namespace.default.useRef(onRowSelectionChange);
11637
+ const selectedRows = React55__namespace.default.useMemo(() => rows.filter((r2, i) => selected.has(keyOf(r2, i))), [rows, selected]);
11638
+ const selKeys = React55__namespace.default.useMemo(() => [...selected], [selected]);
11639
+ const onRowSelRef = React55__namespace.default.useRef(onRowSelectionChange);
11609
11640
  onRowSelRef.current = onRowSelectionChange;
11610
- const prevRowSelSigRef = React54__namespace.default.useRef("");
11611
- React54__namespace.default.useEffect(() => {
11641
+ const prevRowSelSigRef = React55__namespace.default.useRef("");
11642
+ React55__namespace.default.useEffect(() => {
11612
11643
  const cb = onRowSelRef.current;
11613
11644
  if (!cb) return;
11614
11645
  const sig = selKeys.join(",");
@@ -11617,7 +11648,7 @@ function Datatable({
11617
11648
  cb(selKeys, selectedRows);
11618
11649
  }, [selKeys, selectedRows]);
11619
11650
  const revealRowRi = activeRowVal != null ? keyIndex.get(activeRowVal) : void 0;
11620
- React54__namespace.default.useEffect(() => {
11651
+ React55__namespace.default.useEffect(() => {
11621
11652
  if (!activeRowControlled || !scrollActiveRowIntoView || activeRowId == null) return;
11622
11653
  const el = gridRef.current && gridRef.current.querySelector('.twc-dt__row[data-active="true"]');
11623
11654
  if (el && el.scrollIntoView) el.scrollIntoView({ block: "nearest" });
@@ -11627,11 +11658,11 @@ function Datatable({
11627
11658
  const revealInline = scrollActiveCellIntoView && typeof scrollActiveCellIntoView === "object" && scrollActiveCellIntoView.inline === "center" ? "center" : "nearest";
11628
11659
  const revealRi = activeCellVal ? keyIndex.get(activeCellVal.key) : void 0;
11629
11660
  const revealCi = activeCellVal ? cellColIndex(activeCellVal.field) : -1;
11630
- const revealOffsetsRef = React54__namespace.default.useRef(offsets);
11661
+ const revealOffsetsRef = React55__namespace.default.useRef(offsets);
11631
11662
  revealOffsetsRef.current = offsets;
11632
- const revealMidRef = React54__namespace.default.useRef(keyIndexMid);
11663
+ const revealMidRef = React55__namespace.default.useRef(keyIndexMid);
11633
11664
  revealMidRef.current = keyIndexMid;
11634
- React54__namespace.default.useEffect(() => {
11665
+ React55__namespace.default.useEffect(() => {
11635
11666
  if (!revealOn || !activeCellVal) return void 0;
11636
11667
  const block = revealBlock, inline = revealInline;
11637
11668
  const ri = revealRi, ci = revealCi;
@@ -11677,7 +11708,7 @@ function Datatable({
11677
11708
  if (raf) cancelAnimationFrame(raf);
11678
11709
  };
11679
11710
  }, [activeCellVal?.key, activeCellVal?.field, revealOn, revealBlock, revealInline, revealRi, revealCi, virtualizing, headH, loading]);
11680
- React54__namespace.default.useEffect(() => {
11711
+ React55__namespace.default.useEffect(() => {
11681
11712
  if (!activeCellControlled || !activeCellVal) {
11682
11713
  jumpAppliedRef.current = null;
11683
11714
  return;
@@ -11695,11 +11726,11 @@ function Datatable({
11695
11726
  function clearSelection() {
11696
11727
  setSelected(/* @__PURE__ */ new Set());
11697
11728
  }
11698
- const [editing, setEditing] = React54__namespace.default.useState(null);
11699
- const stagedEditRef = React54__namespace.default.useRef(null);
11700
- const onEditingChangeRef = React54__namespace.default.useRef(onEditingChange);
11729
+ const [editing, setEditing] = React55__namespace.default.useState(null);
11730
+ const stagedEditRef = React55__namespace.default.useRef(null);
11731
+ const onEditingChangeRef = React55__namespace.default.useRef(onEditingChange);
11701
11732
  onEditingChangeRef.current = onEditingChange;
11702
- const editStoppedRef = React54__namespace.default.useRef(false);
11733
+ const editStoppedRef = React55__namespace.default.useRef(false);
11703
11734
  const isColEditable = (c) => c.type !== "actions" && c.editable !== false && (c.editable === true || typeof c.editable === "function" || c.renderEditCell != null || editMode);
11704
11735
  const isCellEditable = (c, row) => isColEditable(c) && (typeof c.editable !== "function" || !!c.editable(row, { field: c.field }));
11705
11736
  function applyRowUpdate(rowKey2, updated, orig, field) {
@@ -11760,7 +11791,7 @@ function Datatable({
11760
11791
  }
11761
11792
  }
11762
11793
  const batchEditKey = batchEditFields ? batchEditFields.join("\0") : "";
11763
- const batchEditableCols = React54__namespace.default.useMemo(
11794
+ const batchEditableCols = React55__namespace.default.useMemo(
11764
11795
  () => {
11765
11796
  const base = cols.filter((c) => c.type !== "actions" && (c.editable ?? (editMode && c.editable !== false)));
11766
11797
  return batchEditFields ? base.filter((c) => batchEditFields.includes(c.field)) : base;
@@ -11768,7 +11799,7 @@ function Datatable({
11768
11799
  [cols, editMode, batchEditKey]
11769
11800
  // eslint-disable-line react-hooks/exhaustive-deps
11770
11801
  );
11771
- const batchSel = React54__namespace.default.useMemo(() => {
11802
+ const batchSel = React55__namespace.default.useMemo(() => {
11772
11803
  if (!selected.size) return EMPTY_BATCH_SEL;
11773
11804
  const testable = [], resolved = /* @__PURE__ */ new Set();
11774
11805
  const take = (r2, i) => {
@@ -11789,18 +11820,18 @@ function Datatable({
11789
11820
  }
11790
11821
  return { testable, hasUntestable };
11791
11822
  }, [rows, leafRows, selected, serverMode]);
11792
- const batchEditableColsSel = React54__namespace.default.useMemo(
11823
+ const batchEditableColsSel = React55__namespace.default.useMemo(
11793
11824
  () => batchEditableCols.filter((c) => typeof c.editable !== "function" || batchSel.hasUntestable || batchSel.testable.some((r2) => c.editable(r2, { field: c.field }))),
11794
11825
  [batchEditableCols, batchSel]
11795
11826
  );
11796
11827
  const hasBatchEditor = showBatchEdit && batchEditableCols.length > 0;
11797
- const [batchEdit, setBatchEdit] = React54__namespace.default.useState(null);
11828
+ const [batchEdit, setBatchEdit] = React55__namespace.default.useState(null);
11798
11829
  const [batchEditPos, openBatchEdit, closeBatchEdit] = useFloating();
11799
11830
  function openBatchEditor(el) {
11800
11831
  setBatchEdit({ fields: {}, values: {} });
11801
11832
  openBatchEdit(el, "left", 320);
11802
11833
  }
11803
- React54__namespace.default.useEffect(() => {
11834
+ React55__namespace.default.useEffect(() => {
11804
11835
  if (!batchEdit) return;
11805
11836
  const close = () => {
11806
11837
  setBatchEdit(null);
@@ -11819,7 +11850,7 @@ function Datatable({
11819
11850
  document.removeEventListener("keydown", onKey);
11820
11851
  };
11821
11852
  }, [batchEdit]);
11822
- React54__namespace.default.useEffect(() => {
11853
+ React55__namespace.default.useEffect(() => {
11823
11854
  if (batchEdit && selected.size === 0) {
11824
11855
  setBatchEdit(null);
11825
11856
  closeBatchEdit();
@@ -11889,17 +11920,17 @@ function Datatable({
11889
11920
  setBatchEdit(null);
11890
11921
  closeBatchEdit();
11891
11922
  }
11892
- const [clipboardMsg, setClipboardMsg] = React54__namespace.default.useState("");
11893
- const clipboardRef = React54__namespace.default.useRef(null);
11894
- const [clipFx, setClipFx] = React54__namespace.default.useState(null);
11895
- const clipFxTimer = React54__namespace.default.useRef(null);
11896
- const onCellsCopyRef = React54__namespace.default.useRef(onCellsCopy);
11923
+ const [clipboardMsg, setClipboardMsg] = React55__namespace.default.useState("");
11924
+ const clipboardRef = React55__namespace.default.useRef(null);
11925
+ const [clipFx, setClipFx] = React55__namespace.default.useState(null);
11926
+ const clipFxTimer = React55__namespace.default.useRef(null);
11927
+ const onCellsCopyRef = React55__namespace.default.useRef(onCellsCopy);
11897
11928
  onCellsCopyRef.current = onCellsCopy;
11898
- const onCellsPasteRef = React54__namespace.default.useRef(onCellsPaste);
11929
+ const onCellsPasteRef = React55__namespace.default.useRef(onCellsPaste);
11899
11930
  onCellsPasteRef.current = onCellsPaste;
11900
- const onCellsCommitRef = React54__namespace.default.useRef(onCellsCommit);
11931
+ const onCellsCommitRef = React55__namespace.default.useRef(onCellsCommit);
11901
11932
  onCellsCommitRef.current = onCellsCommit;
11902
- React54__namespace.default.useEffect(() => () => {
11933
+ React55__namespace.default.useEffect(() => () => {
11903
11934
  if (clipFxTimer.current) clearTimeout(clipFxTimer.current);
11904
11935
  }, []);
11905
11936
  const announceClip = (msg, rect) => {
@@ -12068,7 +12099,7 @@ function Datatable({
12068
12099
  e.preventDefault();
12069
12100
  applyPastedText(text);
12070
12101
  };
12071
- React54__namespace.default.useEffect(() => {
12102
+ React55__namespace.default.useEffect(() => {
12072
12103
  if (!editing) return;
12073
12104
  const onDown = (e) => {
12074
12105
  if (e.target.closest(".twc-dt__editor-wrap") || e.target.closest(".twc-pop")) return;
@@ -12160,10 +12191,10 @@ function Datatable({
12160
12191
  ] });
12161
12192
  }
12162
12193
  const tableMinWidth = leadW + ordered.reduce((a, c) => a + widthOf(c), 0);
12163
- const filterableCols = React54__namespace.default.useMemo(() => cols.filter((c) => c.filterable), [cols]);
12194
+ const filterableCols = React55__namespace.default.useMemo(() => cols.filter((c) => c.filterable), [cols]);
12164
12195
  const columnsShown = showColumns !== void 0 ? showColumns : cols.some((c) => c.hideable) || rowNumbers;
12165
12196
  const filtersShown = showFilters !== void 0 ? showFilters : filterableCols.length > 0;
12166
- React54__namespace.default.useEffect(() => {
12197
+ React55__namespace.default.useEffect(() => {
12167
12198
  const el = filterPanelRef.current;
12168
12199
  if (panel !== "filters" || !el || typeof document === "undefined") return void 0;
12169
12200
  const measure = () => {
@@ -12625,7 +12656,7 @@ function Datatable({
12625
12656
  const reorderable = canReorderRows && !pinSide;
12626
12657
  const grabbed = rowGrab && rowGrab.key === k;
12627
12658
  const grabTarget = rowGrab && !grabbed && midIdx != null && rowGrab.index === midIdx ? rowGrab.index >= keyIndexMid.get(rowGrab.key) ? "after" : "before" : void 0;
12628
- return /* @__PURE__ */ jsxRuntime.jsxs(React54__namespace.default.Fragment, { children: [
12659
+ return /* @__PURE__ */ jsxRuntime.jsxs(React55__namespace.default.Fragment, { children: [
12629
12660
  /* @__PURE__ */ jsxRuntime.jsxs(
12630
12661
  "tr",
12631
12662
  {
@@ -12903,13 +12934,13 @@ function Datatable({
12903
12934
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `twc-dt ${className}`, ref: rootRef, "data-density": density, "data-resizing": resizing || void 0, "data-editing": editing ? "" : void 0, ...rest, children: [
12904
12935
  __twcStyles,
12905
12936
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__toolbar", "data-compact": compact || void 0, children: [
12906
- toolbarActions != null ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "twc-dt__toolbar-actions", children: toolbarActions }) : null,
12907
12937
  (batchActions.length || hasBatchEditor) && selected.size > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__batch", children: [
12908
12938
  /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "twc-dt__batch-x", onClick: clearSelection, "aria-label": "Clear selection", children: /* @__PURE__ */ jsxRuntime.jsx(Svg, { d: I.x }) }),
12909
12939
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "twc-dt__batch-count", children: [
12910
12940
  selected.size,
12911
12941
  " selected"
12912
12942
  ] }),
12943
+ selectionSummary != null ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__batch-summary", children: typeof selectionSummary === "function" ? selectionSummary(selKeys, selectedRows) : selectionSummary }) : null,
12913
12944
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__batch-actions", children: [
12914
12945
  hasBatchEditor ? /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "twc-dt__batch-btn", onClick: (e) => openBatchEditor(e.currentTarget), children: [
12915
12946
  /* @__PURE__ */ jsxRuntime.jsx(Svg, { d: I.pencil }),
@@ -13104,6 +13135,7 @@ function Datatable({
13104
13135
  }
13105
13136
  )
13106
13137
  ] }) : null,
13138
+ toolbarActions != null ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "twc-dt__toolbar-actions", children: toolbarActions }) : null,
13107
13139
  searchable ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-dt__search", children: [
13108
13140
  /* @__PURE__ */ jsxRuntime.jsx(Svg, { d: I.search }),
13109
13141
  /* @__PURE__ */ jsxRuntime.jsx("input", { ref: quickSearchRef, placeholder: "Search\u2026", "aria-label": "Search rows", value: quick, onChange: (e) => commitQuick(e.target.value) }),
@@ -14283,7 +14315,7 @@ function safeHref7(url) {
14283
14315
  const s = String(url).replace(/[\x00-\x20]+/g, "").toLowerCase();
14284
14316
  return s.startsWith("javascript:") || s.startsWith("data:") || s.startsWith("vbscript:") ? void 0 : url;
14285
14317
  }
14286
- var Grid = React54__namespace.default.forwardRef(function Grid2({
14318
+ var Grid = /* @__PURE__ */ React55__namespace.default.forwardRef(function Grid2({
14287
14319
  as: Tag2 = "div",
14288
14320
  columns,
14289
14321
  minChildWidth,
@@ -14303,7 +14335,7 @@ var Grid = React54__namespace.default.forwardRef(function Grid2({
14303
14335
  }, ref) {
14304
14336
  const { flatStyle, styleNode, sxAttr } = useSx(sx);
14305
14337
  const responsive = columns != null && typeof columns === "object";
14306
- const uid = React54__namespace.default.useId();
14338
+ const uid = React55__namespace.default.useId();
14307
14339
  const gridId = responsive ? `g${uid.replace(/[^a-zA-Z0-9]/g, "")}` : null;
14308
14340
  let css = "";
14309
14341
  if (responsive) {
@@ -14349,7 +14381,6 @@ var Grid = React54__namespace.default.forwardRef(function Grid2({
14349
14381
  }
14350
14382
  );
14351
14383
  });
14352
- Grid.displayName = "Grid";
14353
14384
  var CARDGRID_CSS = `
14354
14385
  .twc-cardgrid { font-family: var(--font-sans); display: flex; flex-direction: column; gap: var(--space-3); }
14355
14386
  .twc-cardgrid__label { font-size: var(--text-sm); font-weight: var(--font-semibold); color: var(--color-text); }
@@ -14393,6 +14424,11 @@ var CARDGRID_CSS = `
14393
14424
  padding: var(--space-2) var(--space-3); border: var(--border-thin) solid var(--color-primary-border);
14394
14425
  background: var(--color-primary-subtle); border-radius: var(--radius-md); }
14395
14426
  .twc-cardgrid__batch-count { font-size: var(--text-sm); font-weight: var(--font-semibold); color: var(--color-primary-subtle-fg); }
14427
+ /* #492: same slot, same contract as Datatable. Weight, not a lighter token - this bar is
14428
+ --color-primary-subtle, where --color-text-subtle is 4.26:1 and fails normal-text contrast. */
14429
+ .twc-cardgrid__batch-summary { display: inline-flex; align-items: center; gap: var(--space-2);
14430
+ font-size: var(--text-sm); color: var(--color-primary-subtle-fg); }
14431
+ .twc-cardgrid__batch-summary::before { content: ""; width: var(--border-thin); height: 14px; background: currentColor; opacity: 0.35; }
14396
14432
  .twc-cardgrid__batch-actions { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-inline-start: auto; }
14397
14433
  .twc-cardgrid__batch-btn { display: inline-flex; align-items: center; gap: var(--space-2); height: var(--control-h-sm);
14398
14434
  padding-inline: var(--space-3); border: var(--border-thin) solid var(--color-border); background: var(--color-surface);
@@ -14448,6 +14484,7 @@ function CardGrid({
14448
14484
  // the whole point, and it was the only Datatable affordance CardGrid lacked.
14449
14485
  checkboxSelection = false,
14450
14486
  batchActions = [],
14487
+ selectionSummary,
14451
14488
  onRowSelectionChange,
14452
14489
  selectionPlacement = "top-start",
14453
14490
  selectionLabel,
@@ -14460,15 +14497,15 @@ function CardGrid({
14460
14497
  ...rest
14461
14498
  }) {
14462
14499
  const styles = useScopedStyles("twc-cardgrid-styles", CARDGRID_CSS);
14463
- const autoId = React54__namespace.default.useId();
14500
+ const autoId = React55__namespace.default.useId();
14464
14501
  const fieldId = id || autoId;
14465
- const [internalPage, setInternalPage] = React54__namespace.default.useState(defaultPage);
14502
+ const [internalPage, setInternalPage] = React55__namespace.default.useState(defaultPage);
14466
14503
  const pageVal = page !== void 0 ? page : internalPage;
14467
14504
  const commitPage = (p) => {
14468
14505
  onPageChange?.(p);
14469
14506
  if (page === void 0) setInternalPage(p);
14470
14507
  };
14471
- const [internalSize, setInternalSize] = React54__namespace.default.useState(pageSize > 0 ? pageSize : 12);
14508
+ const [internalSize, setInternalSize] = React55__namespace.default.useState(pageSize > 0 ? pageSize : 12);
14472
14509
  const sizeControlled = onPageSizeChange !== void 0;
14473
14510
  const sizeVal = sizeControlled ? pageSize > 0 ? pageSize : 12 : internalSize;
14474
14511
  const commitSize = (n) => {
@@ -14476,17 +14513,17 @@ function CardGrid({
14476
14513
  if (!sizeControlled) setInternalSize(n);
14477
14514
  commitPage(0);
14478
14515
  };
14479
- React54__namespace.default.useEffect(() => {
14516
+ React55__namespace.default.useEffect(() => {
14480
14517
  if (!sizeControlled) setInternalSize(pageSize > 0 ? pageSize : 12);
14481
14518
  }, [pageSize]);
14482
- const [internalQuick, setInternalQuick] = React54__namespace.default.useState(defaultQuickFilter);
14519
+ const [internalQuick, setInternalQuick] = React55__namespace.default.useState(defaultQuickFilter);
14483
14520
  const quickVal = quickFilter !== void 0 ? quickFilter : internalQuick;
14484
14521
  const commitQuick = (q) => {
14485
14522
  onQuickFilterChange?.(q);
14486
14523
  if (quickFilter === void 0) setInternalQuick(q);
14487
14524
  commitPage(0);
14488
14525
  };
14489
- const [internalSort, setInternalSort] = React54__namespace.default.useState(defaultSort);
14526
+ const [internalSort, setInternalSort] = React55__namespace.default.useState(defaultSort);
14490
14527
  const sortVal = sort !== void 0 ? sort : internalSort;
14491
14528
  const commitSort = (s) => {
14492
14529
  onSortChange?.(s);
@@ -14494,8 +14531,8 @@ function CardGrid({
14494
14531
  commitPage(0);
14495
14532
  };
14496
14533
  const filtersKey = JSON.stringify(filters);
14497
- const mounted = React54__namespace.default.useRef(false);
14498
- React54__namespace.default.useEffect(() => {
14534
+ const mounted = React55__namespace.default.useRef(false);
14535
+ React55__namespace.default.useEffect(() => {
14499
14536
  if (!mounted.current) {
14500
14537
  mounted.current = true;
14501
14538
  return;
@@ -14512,36 +14549,36 @@ function CardGrid({
14512
14549
  const pageKnowable = !(serverMode && rowCount == null) && !loading;
14513
14550
  const shownPage = pageKnowable ? Math.min(pageVal, lastPage) : pageVal;
14514
14551
  const pageRows = serverMode ? rows : paginated && shownPage !== pageVal ? client.filtered.slice(shownPage * sizeVal, shownPage * sizeVal + sizeVal) : client.rows;
14515
- const clampedFiltersKey = React54__namespace.default.useRef(filtersKey);
14516
- React54__namespace.default.useEffect(() => {
14552
+ const clampedFiltersKey = React55__namespace.default.useRef(filtersKey);
14553
+ React55__namespace.default.useEffect(() => {
14517
14554
  if (clampedFiltersKey.current !== filtersKey) {
14518
14555
  clampedFiltersKey.current = filtersKey;
14519
14556
  return;
14520
14557
  }
14521
14558
  if (pageKnowable && pageVal > lastPage) commitPage(lastPage);
14522
14559
  }, [lastPage, pageVal, pageKnowable, filtersKey]);
14523
- const onServerChangeRef = React54__namespace.default.useRef(onServerChange);
14560
+ const onServerChangeRef = React55__namespace.default.useRef(onServerChange);
14524
14561
  onServerChangeRef.current = onServerChange;
14525
14562
  const queryKey = JSON.stringify(query);
14526
- React54__namespace.default.useEffect(() => {
14563
+ React55__namespace.default.useEffect(() => {
14527
14564
  if (!serverMode) return void 0;
14528
14565
  const t = setTimeout(() => onServerChangeRef.current?.(JSON.parse(queryKey)), 250);
14529
14566
  return () => clearTimeout(t);
14530
14567
  }, [serverMode, queryKey]);
14531
14568
  const keyOf = typeof rowKey === "function" ? rowKey : (r2) => r2 && r2[rowKey];
14532
- const [selected, setSelected] = React54__namespace.default.useState(() => /* @__PURE__ */ new Set());
14569
+ const [selected, setSelected] = React55__namespace.default.useState(() => /* @__PURE__ */ new Set());
14533
14570
  const retainCap = retainSelectedRows === true ? 1e3 : retainSelectedRows || 0;
14534
- const retainedRef = React54__namespace.default.useRef(/* @__PURE__ */ new Map());
14535
- const selKeys = React54__namespace.default.useMemo(() => [...selected], [selected]);
14536
- const selectedRows = React54__namespace.default.useMemo(() => {
14571
+ const retainedRef = React55__namespace.default.useRef(/* @__PURE__ */ new Map());
14572
+ const selKeys = React55__namespace.default.useMemo(() => [...selected], [selected]);
14573
+ const selectedRows = React55__namespace.default.useMemo(() => {
14537
14574
  const onPage = new Map(pageRows.map((r2, i) => [keyOf(r2, i), r2]));
14538
14575
  return selKeys.map((k) => onPage.get(k) ?? retainedRef.current.get(k)).filter((r2) => r2 !== void 0);
14539
14576
  }, [selKeys, pageRows]);
14540
- const clearSelection = React54__namespace.default.useCallback(() => {
14577
+ const clearSelection = React55__namespace.default.useCallback(() => {
14541
14578
  retainedRef.current.clear();
14542
14579
  setSelected(/* @__PURE__ */ new Set());
14543
14580
  }, []);
14544
- const toggleKey = React54__namespace.default.useCallback((key, row) => {
14581
+ const toggleKey = React55__namespace.default.useCallback((key, row) => {
14545
14582
  setSelected((prev) => {
14546
14583
  const next = new Set(prev);
14547
14584
  if (next.has(key)) {
@@ -14574,10 +14611,10 @@ function CardGrid({
14574
14611
  return next;
14575
14612
  });
14576
14613
  };
14577
- const onSelRef = React54__namespace.default.useRef(onRowSelectionChange);
14614
+ const onSelRef = React55__namespace.default.useRef(onRowSelectionChange);
14578
14615
  onSelRef.current = onRowSelectionChange;
14579
- const prevSelSigRef = React54__namespace.default.useRef(null);
14580
- React54__namespace.default.useEffect(() => {
14616
+ const prevSelSigRef = React55__namespace.default.useRef(null);
14617
+ React55__namespace.default.useEffect(() => {
14581
14618
  const cb = onSelRef.current;
14582
14619
  if (!cb) return;
14583
14620
  const sig = selKeys.join(",");
@@ -14655,6 +14692,7 @@ function CardGrid({
14655
14692
  selected.size,
14656
14693
  " selected"
14657
14694
  ] }),
14695
+ selectionSummary != null ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-cardgrid__batch-summary", children: typeof selectionSummary === "function" ? selectionSummary(selKeys, selectedRows) : selectionSummary }) : null,
14658
14696
  showSelectAll && pageRows.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "twc-cardgrid__selall", children: [
14659
14697
  /* @__PURE__ */ jsxRuntime.jsx(
14660
14698
  Checkbox,
@@ -14790,8 +14828,8 @@ function DiffTable({
14790
14828
  className = "",
14791
14829
  ...rest
14792
14830
  }) {
14793
- const dtColumns = React54__namespace.default.useMemo(() => columns.map(toDatatableColumn), [columns]);
14794
- const diff = React54__namespace.default.useMemo(
14831
+ const dtColumns = React55__namespace.default.useMemo(() => columns.map(toDatatableColumn), [columns]);
14832
+ const diff = React55__namespace.default.useMemo(
14795
14833
  () => ({ from, to, rowKey, onlyChanged, showToggle, showSummary, moveDetection, compare, toggleLabel }),
14796
14834
  [from, to, rowKey, onlyChanged, showToggle, showSummary, moveDetection, compare, toggleLabel]
14797
14835
  );
@@ -14948,26 +14986,26 @@ function DatePicker({
14948
14986
  }) {
14949
14987
  const __twcStyles0 = useScopedStyles("twc-field-styles", FIELD_CSS3);
14950
14988
  const __twcStyles1 = useScopedStyles("twc-datepicker-styles", DATEPICKER_CSS);
14951
- const autoId = React54__namespace.default.useId();
14989
+ const autoId = React55__namespace.default.useId();
14952
14990
  const fieldId = id || autoId;
14953
14991
  const descId = `${fieldId}-desc`;
14954
14992
  const invalid = Boolean(error);
14955
- const [internal, setInternal] = React54__namespace.default.useState(defaultValue);
14993
+ const [internal, setInternal] = React55__namespace.default.useState(defaultValue);
14956
14994
  const selected = value !== void 0 ? value : internal;
14957
- const [open, setOpen] = React54__namespace.default.useState(false);
14958
- const [view, setView] = React54__namespace.default.useState(selected || /* @__PURE__ */ new Date());
14959
- const [mode, setMode] = React54__namespace.default.useState("days");
14960
- const [focusDate, setFocusDate] = React54__namespace.default.useState(null);
14961
- const [focusMonth, setFocusMonth] = React54__namespace.default.useState(null);
14962
- const [focusYear, setFocusYear] = React54__namespace.default.useState(null);
14963
- const [editText, setEditText] = React54__namespace.default.useState(null);
14964
- const [coords, setCoords] = React54__namespace.default.useState(null);
14965
- const wrapRef = React54__namespace.default.useRef(null);
14966
- const triggerRef = React54__namespace.default.useRef(null);
14967
- const popRef = React54__namespace.default.useRef(null);
14968
- const gridRef = React54__namespace.default.useRef(null);
14995
+ const [open, setOpen] = React55__namespace.default.useState(false);
14996
+ const [view, setView] = React55__namespace.default.useState(selected || /* @__PURE__ */ new Date());
14997
+ const [mode, setMode] = React55__namespace.default.useState("days");
14998
+ const [focusDate, setFocusDate] = React55__namespace.default.useState(null);
14999
+ const [focusMonth, setFocusMonth] = React55__namespace.default.useState(null);
15000
+ const [focusYear, setFocusYear] = React55__namespace.default.useState(null);
15001
+ const [editText, setEditText] = React55__namespace.default.useState(null);
15002
+ const [coords, setCoords] = React55__namespace.default.useState(null);
15003
+ const wrapRef = React55__namespace.default.useRef(null);
15004
+ const triggerRef = React55__namespace.default.useRef(null);
15005
+ const popRef = React55__namespace.default.useRef(null);
15006
+ const gridRef = React55__namespace.default.useRef(null);
14969
15007
  const POP_W = 280;
14970
- const place = React54__namespace.default.useCallback(() => {
15008
+ const place = React55__namespace.default.useCallback(() => {
14971
15009
  const el = triggerRef.current;
14972
15010
  if (!el) return;
14973
15011
  const r2 = el.getBoundingClientRect();
@@ -14978,7 +15016,7 @@ function DatePicker({
14978
15016
  left = Math.max(8, left);
14979
15017
  setCoords({ left, top: flip ? void 0 : Math.round(r2.bottom + 6), bottom: flip ? Math.round(vh - r2.top + 6) : void 0 });
14980
15018
  }, []);
14981
- React54__namespace.default.useEffect(() => {
15019
+ React55__namespace.default.useEffect(() => {
14982
15020
  if (!open) return void 0;
14983
15021
  place();
14984
15022
  const onMove = () => place();
@@ -14996,7 +15034,7 @@ function DatePicker({
14996
15034
  ro?.disconnect();
14997
15035
  };
14998
15036
  }, [open, place]);
14999
- React54__namespace.default.useEffect(() => {
15037
+ React55__namespace.default.useEffect(() => {
15000
15038
  if (!open) return;
15001
15039
  setView(selected || /* @__PURE__ */ new Date());
15002
15040
  setMode("days");
@@ -15017,9 +15055,9 @@ function DatePicker({
15017
15055
  };
15018
15056
  }, [open]);
15019
15057
  useFocusTrap(popRef, open && !!coords, { initialFocus: () => gridRef.current?.querySelector('[tabindex="0"]') });
15020
- const months = React54__namespace.default.useMemo(() => locale === void 0 ? MONTHS : monthNames(locale), [locale]);
15021
- const monthsShort = React54__namespace.default.useMemo(() => locale === void 0 ? MONTHS.map((n) => n.slice(0, 3)) : monthShortNames(locale), [locale]);
15022
- const dows = React54__namespace.default.useMemo(
15058
+ const months = React55__namespace.default.useMemo(() => locale === void 0 ? MONTHS : monthNames(locale), [locale]);
15059
+ const monthsShort = React55__namespace.default.useMemo(() => locale === void 0 ? MONTHS.map((n) => n.slice(0, 3)) : monthShortNames(locale), [locale]);
15060
+ const dows = React55__namespace.default.useMemo(
15023
15061
  () => locale === void 0 ? Array.from({ length: 7 }, (_, i) => DOW[(i + weekStartsOn) % 7]) : weekdayNames(locale, weekStartsOn),
15024
15062
  [locale, weekStartsOn]
15025
15063
  );
@@ -15074,11 +15112,11 @@ function DatePicker({
15074
15112
  };
15075
15113
  const cells = Array.from({ length: 42 }, (_, i) => new Date(gridStart.getFullYear(), gridStart.getMonth(), gridStart.getDate() + i));
15076
15114
  const tabbableDate = (focusDate && cells.some((c) => sameDay(c, focusDate)) ? focusDate : null) || (selected && cells.some((c) => sameDay(c, selected)) ? selected : null) || (cells.some((c) => sameDay(c, today)) ? today : null) || new Date(y, m, 1);
15077
- React54__namespace.default.useEffect(() => {
15115
+ React55__namespace.default.useEffect(() => {
15078
15116
  if (!open || mode !== "days" || !focusDate) return;
15079
15117
  gridRef.current?.querySelector(`[data-key="${keyOf(focusDate)}"]`)?.focus();
15080
15118
  }, [focusDate, open, mode]);
15081
- React54__namespace.default.useEffect(() => {
15119
+ React55__namespace.default.useEffect(() => {
15082
15120
  if (!open || mode !== "months" || focusMonth == null) return;
15083
15121
  gridRef.current?.querySelector(`[data-mo="${focusMonth}"]`)?.focus();
15084
15122
  }, [focusMonth, open, mode]);
@@ -15102,7 +15140,7 @@ function DatePicker({
15102
15140
  }
15103
15141
  setFocusMonth(next);
15104
15142
  };
15105
- React54__namespace.default.useEffect(() => {
15143
+ React55__namespace.default.useEffect(() => {
15106
15144
  if (!open || mode !== "years" || focusYear == null) return;
15107
15145
  gridRef.current?.querySelector(`[data-yr="${focusYear}"]`)?.focus();
15108
15146
  }, [focusYear, open, mode]);
@@ -15509,29 +15547,29 @@ function DateRangePicker({
15509
15547
  }) {
15510
15548
  const __twcStyles0 = useScopedStyles("twc-field-styles", FIELD_CSS4);
15511
15549
  const __twcStyles1 = useScopedStyles("twc-drp-styles", RANGE_CSS2);
15512
- const [internal, setInternal] = React54__namespace.default.useState(defaultValue);
15550
+ const [internal, setInternal] = React55__namespace.default.useState(defaultValue);
15513
15551
  const range2 = value !== void 0 ? value : internal;
15514
- const [open, setOpen] = React54__namespace.default.useState(false);
15515
- const [view, setView] = React54__namespace.default.useState(range2.start || /* @__PURE__ */ new Date());
15516
- const [hover, setHover] = React54__namespace.default.useState(null);
15517
- const [focusDate, setFocusDate] = React54__namespace.default.useState(null);
15518
- const [mode, setMode] = React54__namespace.default.useState("days");
15519
- const [focusMonth, setFocusMonth] = React54__namespace.default.useState(null);
15520
- const [focusYear, setFocusYear] = React54__namespace.default.useState(null);
15521
- const [editText, setEditText] = React54__namespace.default.useState(null);
15522
- const [coords, setCoords] = React54__namespace.default.useState(null);
15523
- const wrapRef = React54__namespace.default.useRef(null);
15524
- const triggerRef = React54__namespace.default.useRef(null);
15525
- const popRef = React54__namespace.default.useRef(null);
15526
- const gridRef = React54__namespace.default.useRef(null);
15527
- const labelId = React54__namespace.default.useId();
15552
+ const [open, setOpen] = React55__namespace.default.useState(false);
15553
+ const [view, setView] = React55__namespace.default.useState(range2.start || /* @__PURE__ */ new Date());
15554
+ const [hover, setHover] = React55__namespace.default.useState(null);
15555
+ const [focusDate, setFocusDate] = React55__namespace.default.useState(null);
15556
+ const [mode, setMode] = React55__namespace.default.useState("days");
15557
+ const [focusMonth, setFocusMonth] = React55__namespace.default.useState(null);
15558
+ const [focusYear, setFocusYear] = React55__namespace.default.useState(null);
15559
+ const [editText, setEditText] = React55__namespace.default.useState(null);
15560
+ const [coords, setCoords] = React55__namespace.default.useState(null);
15561
+ const wrapRef = React55__namespace.default.useRef(null);
15562
+ const triggerRef = React55__namespace.default.useRef(null);
15563
+ const popRef = React55__namespace.default.useRef(null);
15564
+ const gridRef = React55__namespace.default.useRef(null);
15565
+ const labelId = React55__namespace.default.useId();
15528
15566
  const descId = `${labelId}-desc`;
15529
15567
  const invalid = Boolean(error);
15530
- React54__namespace.default.useEffect(() => {
15568
+ React55__namespace.default.useEffect(() => {
15531
15569
  if (disabled) setOpen(false);
15532
15570
  }, [disabled]);
15533
15571
  const POP_W = 420;
15534
- const place = React54__namespace.default.useCallback(() => {
15572
+ const place = React55__namespace.default.useCallback(() => {
15535
15573
  const el = triggerRef.current;
15536
15574
  if (!el) return;
15537
15575
  const r2 = el.getBoundingClientRect();
@@ -15542,7 +15580,7 @@ function DateRangePicker({
15542
15580
  left = Math.max(8, left);
15543
15581
  setCoords({ left, top: flip ? void 0 : Math.round(r2.bottom + 6), bottom: flip ? Math.round(vh - r2.top + 6) : void 0 });
15544
15582
  }, []);
15545
- React54__namespace.default.useEffect(() => {
15583
+ React55__namespace.default.useEffect(() => {
15546
15584
  if (!open) return void 0;
15547
15585
  place();
15548
15586
  const onMove = () => place();
@@ -15560,7 +15598,7 @@ function DateRangePicker({
15560
15598
  ro?.disconnect();
15561
15599
  };
15562
15600
  }, [open, place]);
15563
- React54__namespace.default.useEffect(() => {
15601
+ React55__namespace.default.useEffect(() => {
15564
15602
  if (!open) return;
15565
15603
  const onDown = (e) => {
15566
15604
  if (wrapRef.current && wrapRef.current.contains(e.target)) return;
@@ -15624,20 +15662,20 @@ function DateRangePicker({
15624
15662
  const last = new Date(d.getFullYear(), d.getMonth() + n + 1, 0);
15625
15663
  return new Date(last.getFullYear(), last.getMonth(), Math.min(d.getDate(), last.getDate()));
15626
15664
  };
15627
- React54__namespace.default.useEffect(() => {
15665
+ React55__namespace.default.useEffect(() => {
15628
15666
  if (!open) {
15629
15667
  setFocusDate(null);
15630
15668
  setHover(null);
15631
15669
  setMode("days");
15632
15670
  }
15633
15671
  }, [open]);
15634
- React54__namespace.default.useEffect(() => {
15672
+ React55__namespace.default.useEffect(() => {
15635
15673
  if (open && mode === "months" && focusMonth != null) gridRef.current?.querySelector(`[data-mo="${focusMonth}"]`)?.focus();
15636
15674
  }, [focusMonth, open, mode]);
15637
- React54__namespace.default.useEffect(() => {
15675
+ React55__namespace.default.useEffect(() => {
15638
15676
  if (open && mode === "years" && focusYear != null) gridRef.current?.querySelector(`[data-yr="${focusYear}"]`)?.focus();
15639
15677
  }, [focusYear, open, mode]);
15640
- React54__namespace.default.useEffect(() => {
15678
+ React55__namespace.default.useEffect(() => {
15641
15679
  if (!open || !focusDate) return;
15642
15680
  gridRef.current?.querySelector(`[data-key="${keyOf(focusDate)}"]`)?.focus();
15643
15681
  }, [focusDate, open]);
@@ -15722,9 +15760,9 @@ function DateRangePicker({
15722
15760
  if (r2.start) setView(r2.start);
15723
15761
  setOpen(false);
15724
15762
  };
15725
- const months = React54__namespace.default.useMemo(() => locale === void 0 ? MONTHS2 : monthNames2(locale), [locale]);
15726
- const monthsShort = React54__namespace.default.useMemo(() => months.map((n) => n.slice(0, 3)), [months]);
15727
- const dows = React54__namespace.default.useMemo(
15763
+ const months = React55__namespace.default.useMemo(() => locale === void 0 ? MONTHS2 : monthNames2(locale), [locale]);
15764
+ const monthsShort = React55__namespace.default.useMemo(() => months.map((n) => n.slice(0, 3)), [months]);
15765
+ const dows = React55__namespace.default.useMemo(
15728
15766
  () => locale === void 0 ? Array.from({ length: 7 }, (_, i) => DOW2[(i + weekStartsOn) % 7]) : weekdayNames2(locale, weekStartsOn),
15729
15767
  [locale, weekStartsOn]
15730
15768
  );
@@ -16079,19 +16117,19 @@ function TimePicker({
16079
16117
  }) {
16080
16118
  const __twcStyles0 = useScopedStyles("twc-field-styles", FIELD_CSS5);
16081
16119
  const __twcStyles1 = useScopedStyles("twc-timepicker-styles", TIMEPICKER_CSS);
16082
- const autoId = React54__namespace.default.useId();
16120
+ const autoId = React55__namespace.default.useId();
16083
16121
  const fieldId = id || autoId;
16084
16122
  const descId = `${fieldId}-desc`;
16085
16123
  const invalid = Boolean(error);
16086
- const [internal, setInternal] = React54__namespace.default.useState(defaultValue);
16124
+ const [internal, setInternal] = React55__namespace.default.useState(defaultValue);
16087
16125
  const selected = value !== void 0 ? value : internal;
16088
- const [open, setOpen] = React54__namespace.default.useState(false);
16089
- const [editText, setEditText] = React54__namespace.default.useState(null);
16090
- const [coords, setCoords] = React54__namespace.default.useState(null);
16091
- const wrapRef = React54__namespace.default.useRef(null);
16092
- const triggerRef = React54__namespace.default.useRef(null);
16093
- const popRef = React54__namespace.default.useRef(null);
16094
- const place = React54__namespace.default.useCallback(() => {
16126
+ const [open, setOpen] = React55__namespace.default.useState(false);
16127
+ const [editText, setEditText] = React55__namespace.default.useState(null);
16128
+ const [coords, setCoords] = React55__namespace.default.useState(null);
16129
+ const wrapRef = React55__namespace.default.useRef(null);
16130
+ const triggerRef = React55__namespace.default.useRef(null);
16131
+ const popRef = React55__namespace.default.useRef(null);
16132
+ const place = React55__namespace.default.useCallback(() => {
16095
16133
  const el = triggerRef.current;
16096
16134
  if (!el) return;
16097
16135
  const r2 = el.getBoundingClientRect();
@@ -16102,7 +16140,7 @@ function TimePicker({
16102
16140
  left = Math.max(8, left);
16103
16141
  setCoords({ left, top: flip ? void 0 : Math.round(r2.bottom + 6), bottom: flip ? Math.round(vh - r2.top + 6) : void 0 });
16104
16142
  }, []);
16105
- React54__namespace.default.useEffect(() => {
16143
+ React55__namespace.default.useEffect(() => {
16106
16144
  if (!open) return void 0;
16107
16145
  place();
16108
16146
  const onMove = () => place();
@@ -16120,7 +16158,7 @@ function TimePicker({
16120
16158
  ro?.disconnect();
16121
16159
  };
16122
16160
  }, [open, place]);
16123
- React54__namespace.default.useEffect(() => {
16161
+ React55__namespace.default.useEffect(() => {
16124
16162
  if (!open) return void 0;
16125
16163
  const onDown = (e) => {
16126
16164
  if (wrapRef.current && wrapRef.current.contains(e.target)) return;
@@ -16140,7 +16178,7 @@ function TimePicker({
16140
16178
  useFocusTrap(popRef, open && !!coords, {
16141
16179
  initialFocus: () => popRef.current?.querySelector('.twc-tp__opt[data-selected="true"]') || popRef.current?.querySelector('.twc-tp__opt[tabindex="0"]')
16142
16180
  });
16143
- React54__namespace.default.useEffect(() => {
16181
+ React55__namespace.default.useEffect(() => {
16144
16182
  if (!open || !coords) return;
16145
16183
  popRef.current?.querySelectorAll('.twc-tp__opt[data-selected="true"]').forEach((el) => el.scrollIntoView({ block: "center" }));
16146
16184
  }, [open, coords]);
@@ -16488,10 +16526,10 @@ function DateTimePicker({
16488
16526
  }) {
16489
16527
  const __twcStyles0 = useScopedStyles("twc-field-styles", FIELD_CSS6);
16490
16528
  const __twcStyles1 = useScopedStyles("twc-datetimepicker-styles", DTP_CSS);
16491
- const autoId = React54__namespace.default.useId();
16529
+ const autoId = React55__namespace.default.useId();
16492
16530
  const fieldId = id || autoId;
16493
16531
  const descId = `${fieldId}-desc`;
16494
- const [internal, setInternal] = React54__namespace.default.useState(defaultValue);
16532
+ const [internal, setInternal] = React55__namespace.default.useState(defaultValue);
16495
16533
  const selected = value !== void 0 ? value : internal;
16496
16534
  const commitVal = (d) => {
16497
16535
  if (value === void 0) setInternal(d);
@@ -16635,11 +16673,11 @@ function FilterBar({
16635
16673
  ...rest
16636
16674
  }) {
16637
16675
  const styles = useScopedStyles("twc-filterbar-styles", FILTERBAR_CSS);
16638
- const autoId = React54__namespace.default.useId();
16676
+ const autoId = React55__namespace.default.useId();
16639
16677
  const fieldId = id || autoId;
16640
- const [internal, setInternal] = React54__namespace.default.useState(defaultValue);
16678
+ const [internal, setInternal] = React55__namespace.default.useState(defaultValue);
16641
16679
  const clauses = value !== void 0 ? value : internal;
16642
- const values = React54__namespace.default.useMemo(() => clausesToValues(fields, clauses), [fields, clauses]);
16680
+ const values = React55__namespace.default.useMemo(() => clausesToValues(fields, clauses), [fields, clauses]);
16643
16681
  const emit = (nextValues) => {
16644
16682
  const next = valuesToClauses(fields, nextValues);
16645
16683
  if (value === void 0) setInternal(next);
@@ -16823,14 +16861,14 @@ function Dialog({
16823
16861
  className = "",
16824
16862
  ...rest
16825
16863
  }) {
16826
- const autoId = React54__namespace.default.useId();
16864
+ const autoId = React55__namespace.default.useId();
16827
16865
  const titleId = `${autoId}-title`;
16828
16866
  const descId = `${autoId}-desc`;
16829
- const dialogRef = React54__namespace.default.useRef(null);
16867
+ const dialogRef = React55__namespace.default.useRef(null);
16830
16868
  const __twcStyles = useScopedStyles("twc-dialog-styles", DIALOG_CSS);
16831
16869
  const renderPortal = usePortal();
16832
- const [mounted, setMounted] = React54__namespace.default.useState(open);
16833
- React54__namespace.default.useEffect(() => {
16870
+ const [mounted, setMounted] = React55__namespace.default.useState(open);
16871
+ React55__namespace.default.useEffect(() => {
16834
16872
  if (open) {
16835
16873
  setMounted(true);
16836
16874
  return;
@@ -16842,7 +16880,7 @@ function Dialog({
16842
16880
  useInertBackground(dialogRef, open && mounted);
16843
16881
  useFocusTrap(dialogRef, open && mounted);
16844
16882
  const isTop = useLayer(open && mounted);
16845
- React54__namespace.default.useEffect(() => {
16883
+ React55__namespace.default.useEffect(() => {
16846
16884
  if (!open) return void 0;
16847
16885
  const onKey = (e) => {
16848
16886
  if (e.defaultPrevented || !isTop()) return;
@@ -16995,14 +17033,14 @@ function Drawer({
16995
17033
  style,
16996
17034
  ...rest
16997
17035
  }) {
16998
- const autoId = React54__namespace.default.useId();
17036
+ const autoId = React55__namespace.default.useId();
16999
17037
  const titleId = `${autoId}-title`;
17000
17038
  const descId = `${autoId}-desc`;
17001
- const panelRef = React54__namespace.default.useRef(null);
17039
+ const panelRef = React55__namespace.default.useRef(null);
17002
17040
  const __twcStyles = useScopedStyles("twc-drawer-styles", DRAWER_CSS);
17003
17041
  const renderPortal = usePortal();
17004
- const [mounted, setMounted] = React54__namespace.default.useState(open);
17005
- React54__namespace.default.useEffect(() => {
17042
+ const [mounted, setMounted] = React55__namespace.default.useState(open);
17043
+ React55__namespace.default.useEffect(() => {
17006
17044
  if (open) {
17007
17045
  setMounted(true);
17008
17046
  return;
@@ -17014,7 +17052,7 @@ function Drawer({
17014
17052
  useInertBackground(panelRef, open && mounted);
17015
17053
  useFocusTrap(panelRef, open && mounted);
17016
17054
  const isTop = useLayer(open && mounted);
17017
- React54__namespace.default.useEffect(() => {
17055
+ React55__namespace.default.useEffect(() => {
17018
17056
  if (!open) return void 0;
17019
17057
  const onKey = (e) => {
17020
17058
  if (e.defaultPrevented || !isTop()) return;
@@ -17104,11 +17142,11 @@ function Field({
17104
17142
  ...rest
17105
17143
  }) {
17106
17144
  const __twcStyles = useScopedStyles("twc-field-styles", FIELD_CSS7);
17107
- const autoId = React54__namespace.default.useId();
17145
+ const autoId = React55__namespace.default.useId();
17108
17146
  const fieldId = id || autoId;
17109
17147
  const descId = `${fieldId}-desc`;
17110
17148
  const hasMsg = Boolean(error || hint);
17111
- const control = React54__namespace.default.isValidElement(children) ? React54__namespace.default.cloneElement(children, {
17149
+ const control = React55__namespace.default.isValidElement(children) ? React55__namespace.default.cloneElement(children, {
17112
17150
  "aria-describedby": [children.props["aria-describedby"], hasMsg ? descId : null].filter(Boolean).join(" ") || void 0,
17113
17151
  "aria-invalid": children.props["aria-invalid"] !== void 0 ? children.props["aria-invalid"] : error ? true : void 0
17114
17152
  }) : children;
@@ -17208,7 +17246,7 @@ function fmtSize(bytes) {
17208
17246
  if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(1) + " KB";
17209
17247
  return (bytes / (1024 * 1024)).toFixed(1) + " MB";
17210
17248
  }
17211
- var FileUpload = React54__namespace.default.forwardRef(function FileUpload2({
17249
+ var FileUpload = /* @__PURE__ */ React55__namespace.default.forwardRef(function FileUpload2({
17212
17250
  accept,
17213
17251
  multiple = false,
17214
17252
  disabled = false,
@@ -17233,12 +17271,12 @@ var FileUpload = React54__namespace.default.forwardRef(function FileUpload2({
17233
17271
  ...rest
17234
17272
  }, ref) {
17235
17273
  const __twcStyles = useScopedStyles("twc-upload-styles", UPLOAD_CSS);
17236
- const [internal, setInternal] = React54__namespace.default.useState(defaultValue);
17274
+ const [internal, setInternal] = React55__namespace.default.useState(defaultValue);
17237
17275
  const files = value !== void 0 ? value : internal;
17238
- const [drag, setDrag] = React54__namespace.default.useState(false);
17239
- const inputRef = React54__namespace.default.useRef(null);
17240
- React54__namespace.default.useImperativeHandle(ref, () => ({ open: () => inputRef.current?.click() }), []);
17241
- const autoId = React54__namespace.default.useId();
17276
+ const [drag, setDrag] = React55__namespace.default.useState(false);
17277
+ const inputRef = React55__namespace.default.useRef(null);
17278
+ React55__namespace.default.useImperativeHandle(ref, () => ({ open: () => inputRef.current?.click() }), []);
17279
+ const autoId = React55__namespace.default.useId();
17242
17280
  const fieldId = id || autoId;
17243
17281
  const descId = `${fieldId}-desc`;
17244
17282
  const labelId = `${fieldId}-label`;
@@ -17281,7 +17319,7 @@ var FileUpload = React54__namespace.default.forwardRef(function FileUpload2({
17281
17319
  )
17282
17320
  );
17283
17321
  if (trigger) {
17284
- const triggerEl = React54__namespace.default.isValidElement(trigger) && error ? React54__namespace.default.cloneElement(trigger, {
17322
+ const triggerEl = React55__namespace.default.isValidElement(trigger) && error ? React55__namespace.default.cloneElement(trigger, {
17285
17323
  "aria-describedby": [trigger.props["aria-describedby"], descId].filter(Boolean).join(" ") || void 0
17286
17324
  }) : trigger;
17287
17325
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `twc-upload ${className}`, "data-size": size, ...rest, children: [
@@ -17375,7 +17413,6 @@ var FileUpload = React54__namespace.default.forwardRef(function FileUpload2({
17375
17413
  error ? /* @__PURE__ */ jsxRuntime.jsx("span", { id: descId, className: "twc-field__error", children: error }) : null
17376
17414
  ] });
17377
17415
  });
17378
- FileUpload.displayName = "FileUpload";
17379
17416
  var TOGGLEGROUP_CSS = `
17380
17417
  .twc-togglegroup { display: inline-flex; gap: var(--space-1); }
17381
17418
  .twc-togglegroup[data-orientation="vertical"] { flex-direction: column; align-items: stretch; }
@@ -17397,10 +17434,10 @@ function ToggleGroup({
17397
17434
  ...rest
17398
17435
  }) {
17399
17436
  const __twcStyles = useScopedStyles("twc-togglegroup-styles", TOGGLEGROUP_CSS);
17400
- const groupRef = React54__namespace.default.useRef(null);
17437
+ const groupRef = React55__namespace.default.useRef(null);
17401
17438
  const multiple = type === "multiple";
17402
- const [focusedIdx, setFocusedIdx] = React54__namespace.default.useState(null);
17403
- const [internal, setInternal] = React54__namespace.default.useState(defaultValue !== void 0 ? defaultValue : multiple ? [] : null);
17439
+ const [focusedIdx, setFocusedIdx] = React55__namespace.default.useState(null);
17440
+ const [internal, setInternal] = React55__namespace.default.useState(defaultValue !== void 0 ? defaultValue : multiple ? [] : null);
17404
17441
  const current = value !== void 0 ? value : internal;
17405
17442
  const isSelected = (v) => multiple ? Array.isArray(current) && current.includes(v) : current === v;
17406
17443
  const commit = (next) => {
@@ -17521,15 +17558,15 @@ function Kanban({
17521
17558
  ...rest
17522
17559
  }) {
17523
17560
  const __twcStyles = useScopedStyles("twc-kanban-styles", KANBAN_CSS);
17524
- const [internal, setInternal] = React54__namespace.default.useState(cards ?? defaultCards ?? []);
17561
+ const [internal, setInternal] = React55__namespace.default.useState(cards ?? defaultCards ?? []);
17525
17562
  const items = cards !== void 0 ? cards : internal;
17526
- const [drag, setDrag] = React54__namespace.default.useState(null);
17527
- const [overCol, setOverCol] = React54__namespace.default.useState(null);
17528
- const [grab, setGrab] = React54__namespace.default.useState(null);
17529
- const [announce, setAnnounce] = React54__namespace.default.useState("");
17530
- const rootRef = React54__namespace.default.useRef(null);
17531
- const focusIdRef = React54__namespace.default.useRef(null);
17532
- React54__namespace.default.useEffect(() => {
17563
+ const [drag, setDrag] = React55__namespace.default.useState(null);
17564
+ const [overCol, setOverCol] = React55__namespace.default.useState(null);
17565
+ const [grab, setGrab] = React55__namespace.default.useState(null);
17566
+ const [announce, setAnnounce] = React55__namespace.default.useState("");
17567
+ const rootRef = React55__namespace.default.useRef(null);
17568
+ const focusIdRef = React55__namespace.default.useRef(null);
17569
+ React55__namespace.default.useEffect(() => {
17533
17570
  if (focusIdRef.current == null) return void 0;
17534
17571
  const raf = requestAnimationFrame(() => {
17535
17572
  const id = focusIdRef.current;
@@ -17848,22 +17885,22 @@ function Popover({
17848
17885
  ...rest
17849
17886
  }) {
17850
17887
  const __twcStyles = useScopedStyles("twc-popover-styles", POPOVER_CSS);
17851
- const [openState, setOpenState] = React54__namespace.default.useState(defaultOpen);
17852
- const [render, setRender] = React54__namespace.default.useState(false);
17853
- const [pos, setPos] = React54__namespace.default.useState(null);
17854
- const wrapRef = React54__namespace.default.useRef(null);
17888
+ const [openState, setOpenState] = React55__namespace.default.useState(defaultOpen);
17889
+ const [render, setRender] = React55__namespace.default.useState(false);
17890
+ const [pos, setPos] = React55__namespace.default.useState(null);
17891
+ const wrapRef = React55__namespace.default.useRef(null);
17855
17892
  useTriggerAudit(wrapRef, "Popover");
17856
- const popRef = React54__namespace.default.useRef(null);
17857
- const popId = React54__namespace.default.useId();
17893
+ const popRef = React55__namespace.default.useRef(null);
17894
+ const popId = React55__namespace.default.useId();
17858
17895
  const controlled = openProp !== void 0;
17859
17896
  const open = controlled ? !!openProp : openState;
17860
- const openRef = React54__namespace.default.useRef(open);
17897
+ const openRef = React55__namespace.default.useRef(open);
17861
17898
  openRef.current = open;
17862
- const controlledRef = React54__namespace.default.useRef(controlled);
17899
+ const controlledRef = React55__namespace.default.useRef(controlled);
17863
17900
  controlledRef.current = controlled;
17864
- const onOpenChangeRef = React54__namespace.default.useRef(onOpenChange);
17901
+ const onOpenChangeRef = React55__namespace.default.useRef(onOpenChange);
17865
17902
  onOpenChangeRef.current = onOpenChange;
17866
- const setOpen = React54__namespace.default.useCallback((next) => {
17903
+ const setOpen = React55__namespace.default.useCallback((next) => {
17867
17904
  const value = typeof next === "function" ? next(openRef.current) : next;
17868
17905
  if (value === openRef.current) return;
17869
17906
  if (!controlledRef.current) setOpenState(value);
@@ -17871,7 +17908,7 @@ function Popover({
17871
17908
  }, []);
17872
17909
  const toggle = () => setOpen((o) => !o);
17873
17910
  const RD = { createPortal: typeof reactDom.createPortal === "function" ? reactDom.createPortal : typeof window !== "undefined" && window.ReactDOM && window.ReactDOM.createPortal };
17874
- const place = React54__namespace.default.useCallback(() => {
17911
+ const place = React55__namespace.default.useCallback(() => {
17875
17912
  const t = wrapRef.current;
17876
17913
  if (!t) return;
17877
17914
  const r2 = t.getBoundingClientRect();
@@ -17909,7 +17946,7 @@ function Popover({
17909
17946
  setPos({ top, left, width: w, flip: false, arrow, maxHeight: vh - 2 * M });
17910
17947
  }, [placement, align, width]);
17911
17948
  const isTop = useLayer(open && render);
17912
- React54__namespace.default.useEffect(() => {
17949
+ React55__namespace.default.useEffect(() => {
17913
17950
  if (!open) return;
17914
17951
  place();
17915
17952
  const onMove = () => place();
@@ -17936,7 +17973,7 @@ function Popover({
17936
17973
  document.removeEventListener("keydown", onKey);
17937
17974
  };
17938
17975
  }, [open, place, isTop]);
17939
- React54__namespace.default.useEffect(() => {
17976
+ React55__namespace.default.useEffect(() => {
17940
17977
  if (open) {
17941
17978
  setRender(true);
17942
17979
  return;
@@ -17944,12 +17981,12 @@ function Popover({
17944
17981
  const t = setTimeout(() => setRender(false), 170);
17945
17982
  return () => clearTimeout(t);
17946
17983
  }, [open]);
17947
- React54__namespace.default.useEffect(() => {
17984
+ React55__namespace.default.useEffect(() => {
17948
17985
  if (render && open) place();
17949
17986
  }, [render, place]);
17950
- const restoreRef = React54__namespace.default.useRef(null);
17951
- const needFocusRef = React54__namespace.default.useRef(false);
17952
- React54__namespace.default.useEffect(() => {
17987
+ const restoreRef = React55__namespace.default.useRef(null);
17988
+ const needFocusRef = React55__namespace.default.useRef(false);
17989
+ React55__namespace.default.useEffect(() => {
17953
17990
  if (open) {
17954
17991
  restoreRef.current = document.activeElement;
17955
17992
  needFocusRef.current = true;
@@ -17985,7 +18022,7 @@ function Popover({
17985
18022
  }
17986
18023
  ) : null;
17987
18024
  const fix = {};
17988
- if (React54__namespace.default.isValidElement(trigger)) {
18025
+ if (React55__namespace.default.isValidElement(trigger)) {
17989
18026
  if (!triggerIsControl(trigger)) fix.role = "button";
17990
18027
  fix.onKeyDown = (e) => {
17991
18028
  trigger.props.onKeyDown?.(e);
@@ -17997,7 +18034,7 @@ function Popover({
17997
18034
  }
17998
18035
  };
17999
18036
  }
18000
- const triggerEl = React54__namespace.default.isValidElement(trigger) ? React54__namespace.default.cloneElement(trigger, {
18037
+ const triggerEl = React55__namespace.default.isValidElement(trigger) ? React55__namespace.default.cloneElement(trigger, {
18001
18038
  onClick: (e) => {
18002
18039
  trigger.props.onClick?.(e);
18003
18040
  toggle();
@@ -18044,7 +18081,7 @@ function Progress({
18044
18081
  className = "",
18045
18082
  ...rest
18046
18083
  }) {
18047
- const labelId = React54__namespace.default.useId();
18084
+ const labelId = React55__namespace.default.useId();
18048
18085
  const { "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, ...restProps } = rest;
18049
18086
  const __twcStyles = useScopedStyles("twc-progress-styles", `
18050
18087
  .twc-progress-wrap { display: flex; flex-direction: column; gap: 6px; font-family: var(--font-sans); }
@@ -18115,7 +18152,7 @@ function Progress({
18115
18152
  ] })
18116
18153
  );
18117
18154
  }
18118
- function Radio({
18155
+ var Radio = /* @__PURE__ */ React55__namespace.default.forwardRef(function Radio2({
18119
18156
  label,
18120
18157
  description,
18121
18158
  error,
@@ -18131,7 +18168,7 @@ function Radio({
18131
18168
  className = "",
18132
18169
  onChange,
18133
18170
  ...rest
18134
- }) {
18171
+ }, ref) {
18135
18172
  const __twcStyles = useScopedStyles("twc-radio-styles", `
18136
18173
  .twc-radio { display: inline-flex; align-items: flex-start; gap: var(--space-2-5); cursor: pointer; font-family: var(--font-sans); }
18137
18174
  /* tone \u2192 accent set (default primary). Mirrors Button's --_accent model; Badge's tone vocabulary. */
@@ -18171,7 +18208,7 @@ function Radio({
18171
18208
  .twc-field { display: flex; flex-direction: column; gap: var(--space-1-5); font-family: var(--font-sans); }
18172
18209
  .twc-field__error { font-size: var(--text-xs); color: var(--color-danger-subtle-fg); font-weight: var(--font-medium); }
18173
18210
  `);
18174
- const autoId = React54__namespace.default.useId();
18211
+ const autoId = React55__namespace.default.useId();
18175
18212
  const fieldId = id || autoId;
18176
18213
  const errId = `${fieldId}-error`;
18177
18214
  const invalid = Boolean(error);
@@ -18184,6 +18221,7 @@ function Radio({
18184
18221
  /* @__PURE__ */ jsxRuntime.jsx(
18185
18222
  "input",
18186
18223
  {
18224
+ ref,
18187
18225
  id: fieldId,
18188
18226
  type: "radio",
18189
18227
  className: "twc-radio__input",
@@ -18214,7 +18252,7 @@ function Radio({
18214
18252
  control,
18215
18253
  /* @__PURE__ */ jsxRuntime.jsx("span", { id: errId, className: "twc-field__error", children: error })
18216
18254
  ] });
18217
- }
18255
+ });
18218
18256
  var RADIO_GROUP_CSS = `
18219
18257
  .twc-field { display: flex; flex-direction: column; gap: var(--space-1-5); font-family: var(--font-sans); }
18220
18258
  .twc-field__label { font-size: var(--text-sm); font-weight: var(--font-semibold); color: var(--color-text); display: flex; gap: 4px; align-items: center; }
@@ -18244,13 +18282,13 @@ function RadioGroup({
18244
18282
  ...rest
18245
18283
  }) {
18246
18284
  const __twcStyles = useScopedStyles("twc-radio-group-styles", RADIO_GROUP_CSS);
18247
- const autoId = React54__namespace.default.useId();
18285
+ const autoId = React55__namespace.default.useId();
18248
18286
  const fieldId = id || autoId;
18249
18287
  const labelId = `${fieldId}-label`;
18250
18288
  const descId = `${fieldId}-desc`;
18251
18289
  const groupName = name || `${fieldId}-name`;
18252
18290
  const invalid = Boolean(error);
18253
- const [internal, setInternal] = React54__namespace.default.useState(defaultValue);
18291
+ const [internal, setInternal] = React55__namespace.default.useState(defaultValue);
18254
18292
  const current = value !== void 0 ? value : internal;
18255
18293
  const select = (v) => {
18256
18294
  if (value === void 0) setInternal(v);
@@ -18271,10 +18309,10 @@ function RadioGroup({
18271
18309
  tone
18272
18310
  },
18273
18311
  o.value
18274
- )) : React54__namespace.default.Children.map(children, (child) => {
18275
- if (!React54__namespace.default.isValidElement(child)) return child;
18312
+ )) : React55__namespace.default.Children.map(children, (child) => {
18313
+ if (!React55__namespace.default.isValidElement(child)) return child;
18276
18314
  const v = child.props.value;
18277
- return React54__namespace.default.cloneElement(child, {
18315
+ return React55__namespace.default.cloneElement(child, {
18278
18316
  name: child.props.name ?? groupName,
18279
18317
  checked: child.props.checked ?? current === v,
18280
18318
  onChange: child.props.onChange ?? (() => select(v)),
@@ -18354,12 +18392,12 @@ function Rating({
18354
18392
  ...rest
18355
18393
  }) {
18356
18394
  const __twcStyles = useScopedStyles("twc-rating-styles", RATING_CSS);
18357
- const [internal, setInternal] = React54__namespace.default.useState(defaultValue);
18358
- const [hover, setHover] = React54__namespace.default.useState(0);
18395
+ const [internal, setInternal] = React55__namespace.default.useState(defaultValue);
18396
+ const [hover, setHover] = React55__namespace.default.useState(0);
18359
18397
  const val = value !== void 0 ? value : internal;
18360
18398
  const shown = hover || val;
18361
18399
  const interactive = !readOnly && !disabled;
18362
- const btnRefs = React54__namespace.default.useRef([]);
18400
+ const btnRefs = React55__namespace.default.useRef([]);
18363
18401
  const tabStar = Math.min(count, Math.max(1, Math.round(val) || 1));
18364
18402
  const fmt = (v) => format ? format(v) : Number.isInteger(v) ? String(v) : v.toFixed(1);
18365
18403
  if (process.env.NODE_ENV !== "production" && interactive && !Number.isInteger(val)) {
@@ -18564,24 +18602,24 @@ function Sidebar({
18564
18602
  ...rest
18565
18603
  }) {
18566
18604
  const __twcStyles = useScopedStyles("twc-sidebar-styles", SIDEBAR_CSS);
18567
- const navId = React54__namespace.default.useId();
18568
- const panelRef = React54__namespace.default.useRef(null);
18605
+ const navId = React55__namespace.default.useId();
18606
+ const panelRef = React55__namespace.default.useRef(null);
18569
18607
  const renderPortal = usePortal();
18570
- const [internal, setInternal] = React54__namespace.default.useState(defaultCollapsed);
18608
+ const [internal, setInternal] = React55__namespace.default.useState(defaultCollapsed);
18571
18609
  const collapsed = collapsedProp !== void 0 ? collapsedProp : internal;
18572
18610
  const toggle = () => {
18573
18611
  const next = !collapsed;
18574
18612
  if (collapsedProp === void 0) setInternal(next);
18575
18613
  onCollapsedChange?.(next);
18576
18614
  };
18577
- const [openInternal, setOpenInternal] = React54__namespace.default.useState(defaultOpen);
18615
+ const [openInternal, setOpenInternal] = React55__namespace.default.useState(defaultOpen);
18578
18616
  const open = openProp !== void 0 ? openProp : openInternal;
18579
18617
  const setOpen = (next) => {
18580
18618
  if (openProp === void 0) setOpenInternal(next);
18581
18619
  onOpenChange?.(next);
18582
18620
  };
18583
- const [mounted, setMounted] = React54__namespace.default.useState(open);
18584
- React54__namespace.default.useEffect(() => {
18621
+ const [mounted, setMounted] = React55__namespace.default.useState(open);
18622
+ React55__namespace.default.useEffect(() => {
18585
18623
  if (!overlay) return void 0;
18586
18624
  if (open) {
18587
18625
  setMounted(true);
@@ -18590,7 +18628,7 @@ function Sidebar({
18590
18628
  const t = setTimeout(() => setMounted(false), 170);
18591
18629
  return () => clearTimeout(t);
18592
18630
  }, [overlay, open]);
18593
- React54__namespace.default.useEffect(() => {
18631
+ React55__namespace.default.useEffect(() => {
18594
18632
  if (!overlay || !open) return void 0;
18595
18633
  const prev = document.body.style.overflow;
18596
18634
  document.body.style.overflow = "hidden";
@@ -18599,7 +18637,7 @@ function Sidebar({
18599
18637
  };
18600
18638
  }, [overlay, open]);
18601
18639
  useFocusTrap(panelRef, overlay && open && mounted);
18602
- React54__namespace.default.useEffect(() => {
18640
+ React55__namespace.default.useEffect(() => {
18603
18641
  if (!overlay || !open) return void 0;
18604
18642
  const onKey = (e) => {
18605
18643
  if (e.key === "Escape") {
@@ -18651,7 +18689,7 @@ function Sidebar({
18651
18689
  const body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
18652
18690
  __twcStyles,
18653
18691
  brand ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "twc-sidebar__head", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-sidebar__brand", children: brand }) }) : null,
18654
- /* @__PURE__ */ jsxRuntime.jsx("nav", { id: navId, className: "twc-sidebar__nav", "aria-label": navLabel, children: groups.map((g, gi) => /* @__PURE__ */ jsxRuntime.jsxs(React54__namespace.default.Fragment, { children: [
18692
+ /* @__PURE__ */ jsxRuntime.jsx("nav", { id: navId, className: "twc-sidebar__nav", "aria-label": navLabel, children: groups.map((g, gi) => /* @__PURE__ */ jsxRuntime.jsxs(React55__namespace.default.Fragment, { children: [
18655
18693
  g.section != null ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "twc-sidebar__section", id: g.sid, children: g.section }) : null,
18656
18694
  /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "twc-sidebar__list", ...g.section != null ? { "aria-labelledby": g.sid } : {}, children: g.entries.map(({ it, i }) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: renderItem(it) }, i)) })
18657
18695
  ] }, gi)) }),
@@ -18837,10 +18875,10 @@ function Slider({
18837
18875
  return Math.min(max, Math.max(min, Math.round(stepped * 1e6) / 1e6));
18838
18876
  };
18839
18877
  const __twcStyles = useScopedStyles("twc-slider-styles", SLIDER_CSS);
18840
- const autoId = React54__namespace.default.useId();
18878
+ const autoId = React55__namespace.default.useId();
18841
18879
  const fieldId = id || autoId;
18842
18880
  const isRange = range2 || Array.isArray(value) || Array.isArray(defaultValue);
18843
- const [internal, setInternal] = React54__namespace.default.useState(() => {
18881
+ const [internal, setInternal] = React55__namespace.default.useState(() => {
18844
18882
  if (isRange) {
18845
18883
  const dv = Array.isArray(defaultValue) ? defaultValue : [min, max];
18846
18884
  return [clampSnap(dv[0]), clampSnap(dv[1])];
@@ -18850,9 +18888,9 @@ function Slider({
18850
18888
  const rawVal = value !== void 0 ? value : internal;
18851
18889
  const clampedVals = (isRange ? [Number(rawVal[0]), Number(rawVal[1])] : [Number(rawVal)]).map((v) => Math.min(max, Math.max(min, Number.isFinite(v) ? v : min)));
18852
18890
  const indices = isRange ? [0, 1] : [0];
18853
- const trackRef = React54__namespace.default.useRef(null);
18854
- const [dragging, setDragging] = React54__namespace.default.useState(false);
18855
- const [typed, setTyped] = React54__namespace.default.useState({});
18891
+ const trackRef = React55__namespace.default.useRef(null);
18892
+ const [dragging, setDragging] = React55__namespace.default.useState(false);
18893
+ const [typed, setTyped] = React55__namespace.default.useState({});
18856
18894
  const fmt = (v) => formatValue ? formatValue(v) : v.toFixed(decimals);
18857
18895
  const valueTextFor = (v) => {
18858
18896
  if (getAriaValueText) return getAriaValueText(v);
@@ -18904,8 +18942,8 @@ function Slider({
18904
18942
  const ratio = Math.min(1, Math.max(0, (clientX - r2.left) / r2.width));
18905
18943
  return clampSnap(min + ratio * (max - min));
18906
18944
  };
18907
- const dragCleanupRef = React54__namespace.default.useRef(null);
18908
- React54__namespace.default.useEffect(() => () => dragCleanupRef.current?.(), []);
18945
+ const dragCleanupRef = React55__namespace.default.useRef(null);
18946
+ React55__namespace.default.useEffect(() => () => dragCleanupRef.current?.(), []);
18909
18947
  function onPointerDown(e) {
18910
18948
  if (disabled) return;
18911
18949
  e.preventDefault();
@@ -18954,7 +18992,7 @@ function Slider({
18954
18992
  name ? clampedVals.map((v, i) => /* @__PURE__ */ jsxRuntime.jsx("input", { type: "hidden", name, value: v, disabled: disabled || void 0 }, i)) : null,
18955
18993
  label || showValue || editable ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twc-slider__head", children: [
18956
18994
  label ? /* @__PURE__ */ jsxRuntime.jsx("label", { className: "twc-slider__label", id: labelId, children: label }) : /* @__PURE__ */ jsxRuntime.jsx("span", {}),
18957
- editable ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-slider__inputs", children: indices.map((i) => /* @__PURE__ */ jsxRuntime.jsxs(React54__namespace.default.Fragment, { children: [
18995
+ editable ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-slider__inputs", children: indices.map((i) => /* @__PURE__ */ jsxRuntime.jsxs(React55__namespace.default.Fragment, { children: [
18958
18996
  i > 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-slider__input-sep", "aria-hidden": "true", children: "\u2013" }) : null,
18959
18997
  /* @__PURE__ */ jsxRuntime.jsx(
18960
18998
  "input",
@@ -19167,7 +19205,7 @@ function Stepper({
19167
19205
  ...rest
19168
19206
  }) {
19169
19207
  const __twcStyles = useScopedStyles("twc-stepper-styles", STEPPER_CSS);
19170
- const [activeInternal, setActiveInternal] = React54__namespace.default.useState(defaultActive);
19208
+ const [activeInternal, setActiveInternal] = React55__namespace.default.useState(defaultActive);
19171
19209
  const active = activeProp !== void 0 ? activeProp : activeInternal;
19172
19210
  const handleStep = (i) => {
19173
19211
  if (activeProp === void 0) setActiveInternal(i);
@@ -19247,7 +19285,7 @@ function Stepper({
19247
19285
  })
19248
19286
  ] });
19249
19287
  }
19250
- function Switch({
19288
+ var Switch = /* @__PURE__ */ React55__namespace.default.forwardRef(function Switch2({
19251
19289
  label,
19252
19290
  description,
19253
19291
  error,
@@ -19261,7 +19299,7 @@ function Switch({
19261
19299
  className = "",
19262
19300
  onChange,
19263
19301
  ...rest
19264
- }) {
19302
+ }, ref) {
19265
19303
  const __twcStyles = useScopedStyles("twc-switch-styles", `
19266
19304
  /* tone \u2192 accent set (default primary). Mirrors Button's --_accent model; Badge's tone vocabulary. */
19267
19305
  .twc-switch { --_accent: var(--color-primary); --_accent-fg: var(--color-primary-fg); --_accent-subtle: var(--color-primary-subtle); --_accent-subtle-fg: var(--color-primary-subtle-fg); --_accent-border: var(--color-primary-border); }
@@ -19314,7 +19352,7 @@ function Switch({
19314
19352
  .twc-field { display: flex; flex-direction: column; gap: var(--space-1-5); font-family: var(--font-sans); }
19315
19353
  .twc-field__error { font-size: var(--text-xs); color: var(--color-danger-subtle-fg); font-weight: var(--font-medium); }
19316
19354
  `);
19317
- const autoId = React54__namespace.default.useId();
19355
+ const autoId = React55__namespace.default.useId();
19318
19356
  const fieldId = id || autoId;
19319
19357
  const errId = `${fieldId}-error`;
19320
19358
  const invalid = Boolean(error);
@@ -19327,6 +19365,7 @@ function Switch({
19327
19365
  /* @__PURE__ */ jsxRuntime.jsx(
19328
19366
  "input",
19329
19367
  {
19368
+ ref,
19330
19369
  id: fieldId,
19331
19370
  type: "checkbox",
19332
19371
  role: "switch",
@@ -19356,7 +19395,7 @@ function Switch({
19356
19395
  control,
19357
19396
  /* @__PURE__ */ jsxRuntime.jsx("span", { id: errId, className: "twc-field__error", children: error })
19358
19397
  ] });
19359
- }
19398
+ });
19360
19399
  var TABLE_CSS = `
19361
19400
  .twc-table-wrap { width: 100%; overflow-x: auto; border-radius: var(--radius-lg); border: var(--border-thin) solid var(--color-border); background: var(--color-surface); }
19362
19401
  .twc-table { width: 100%; border-collapse: collapse; font-family: var(--font-sans); font-size: var(--text-sm); color: var(--color-text); }
@@ -19422,14 +19461,14 @@ function Table({
19422
19461
  ...rest
19423
19462
  }) {
19424
19463
  const __twcStyles = useScopedStyles("twc-table-styles", TABLE_CSS);
19425
- const cols = React54__namespace.default.useMemo(
19464
+ const cols = React55__namespace.default.useMemo(
19426
19465
  () => (columns || []).map((c) => ({ ...c, header: c.headerName, render: c.renderCell })),
19427
19466
  [columns]
19428
19467
  );
19429
19468
  const dataRows = rowsProp || [];
19430
- const [internalSort, setInternalSort] = React54__namespace.default.useState(defaultSort || { field: null, dir: "asc" });
19469
+ const [internalSort, setInternalSort] = React55__namespace.default.useState(defaultSort || { field: null, dir: "asc" });
19431
19470
  const sort = (sortProp !== void 0 ? sortProp : internalSort) || { field: null, dir: "asc" };
19432
- const rows = React54__namespace.default.useMemo(() => {
19471
+ const rows = React55__namespace.default.useMemo(() => {
19433
19472
  if (!sortable || !sort.field) return dataRows;
19434
19473
  const col = cols.find((c) => c.field === sort.field);
19435
19474
  if (!col) return dataRows;
@@ -19581,15 +19620,15 @@ function Tabs({
19581
19620
  }) {
19582
19621
  const vertical = orientation === "vertical";
19583
19622
  const __twcStyles = useScopedStyles("twc-tabs-styles", TABS_CSS);
19584
- const [internal, setInternal] = React54__namespace.default.useState(defaultValue ?? items[0]?.value);
19623
+ const [internal, setInternal] = React55__namespace.default.useState(defaultValue ?? items[0]?.value);
19585
19624
  const active = value ?? internal;
19586
- const listRef = React54__namespace.default.useRef(null);
19587
- const [ind, setInd] = React54__namespace.default.useState({ left: 0, width: 0, top: 0, height: 0 });
19588
- const baseId = React54__namespace.default.useId();
19625
+ const listRef = React55__namespace.default.useRef(null);
19626
+ const [ind, setInd] = React55__namespace.default.useState({ left: 0, width: 0, top: 0, height: 0 });
19627
+ const baseId = React55__namespace.default.useId();
19589
19628
  const tabIdAt = (i) => `${baseId}-tab-${i}`;
19590
19629
  const panelId = `${baseId}-panel`;
19591
19630
  const activeIndex = items.findIndex((it) => it.value === active);
19592
- const updateIndicator = React54__namespace.default.useCallback(() => {
19631
+ const updateIndicator = React55__namespace.default.useCallback(() => {
19593
19632
  const list = listRef.current;
19594
19633
  if (!list) return;
19595
19634
  const el = list.querySelector('[data-active="true"]');
@@ -19598,10 +19637,10 @@ function Tabs({
19598
19637
  if (!vertical) el.scrollIntoView?.({ inline: "nearest", block: "nearest" });
19599
19638
  }
19600
19639
  }, [vertical]);
19601
- React54__namespace.default.useEffect(() => {
19640
+ React55__namespace.default.useEffect(() => {
19602
19641
  updateIndicator();
19603
19642
  }, [active, updateIndicator, items, orientation]);
19604
- React54__namespace.default.useEffect(() => {
19643
+ React55__namespace.default.useEffect(() => {
19605
19644
  const r2 = () => updateIndicator();
19606
19645
  window.addEventListener("resize", r2);
19607
19646
  if (typeof document !== "undefined" && document.fonts && document.fonts.ready) {
@@ -19747,7 +19786,7 @@ function Tag({
19747
19786
  }, "aria-label": _removeLabel, type: "button", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.4", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18 6 6 18M6 6l12 12" }) }) }) : null
19748
19787
  ] });
19749
19788
  }
19750
- var useIso = typeof document !== "undefined" ? React54__namespace.default.useLayoutEffect : React54__namespace.default.useEffect;
19789
+ var useIso = typeof document !== "undefined" ? React55__namespace.default.useLayoutEffect : React55__namespace.default.useEffect;
19751
19790
  var TEXTAREA_CSS = `
19752
19791
  .twc-field { display: flex; flex-direction: column; gap: var(--space-1-5); font-family: var(--font-sans); }
19753
19792
  .twc-field__label { font-size: var(--text-sm); font-weight: var(--font-semibold); color: var(--color-text); display: flex; gap: 4px; align-items: center; }
@@ -19796,7 +19835,7 @@ var TEXTAREA_CSS = `
19796
19835
  .twc-field__count { margin-inline-start: auto; font-size: var(--text-xs); color: var(--color-text-muted); font-variant-numeric: tabular-nums; flex: none; }
19797
19836
  .twc-field__count[data-danger="true"] { color: var(--color-danger-subtle-fg); }
19798
19837
  `;
19799
- var Textarea = React54__namespace.default.forwardRef(function Textarea2({
19838
+ var Textarea = /* @__PURE__ */ React55__namespace.default.forwardRef(function Textarea2({
19800
19839
  label,
19801
19840
  hint,
19802
19841
  error,
@@ -19815,19 +19854,19 @@ var Textarea = React54__namespace.default.forwardRef(function Textarea2({
19815
19854
  ...rest
19816
19855
  }, ref) {
19817
19856
  const __twcStyles = useScopedStyles("twc-textarea-styles", TEXTAREA_CSS);
19818
- const autoId = React54__namespace.default.useId();
19857
+ const autoId = React55__namespace.default.useId();
19819
19858
  const fieldId = id || autoId;
19820
19859
  const descId = `${fieldId}-desc`;
19821
19860
  const countId = `${fieldId}-count`;
19822
19861
  const invalid = Boolean(error);
19823
- const innerRef = React54__namespace.default.useRef(null);
19862
+ const innerRef = React55__namespace.default.useRef(null);
19824
19863
  const setRef = (el) => {
19825
19864
  innerRef.current = el;
19826
19865
  if (typeof ref === "function") ref(el);
19827
19866
  else if (ref) ref.current = el;
19828
19867
  };
19829
19868
  const countControlled = rest.value !== void 0;
19830
- const [len2, setLen] = React54__namespace.default.useState(() => String(rest.defaultValue ?? "").length);
19869
+ const [len2, setLen] = React55__namespace.default.useState(() => String(rest.defaultValue ?? "").length);
19831
19870
  const count = countControlled ? String(rest.value ?? "").length : len2;
19832
19871
  const max = rest.maxLength;
19833
19872
  const showCounter = showCount && max != null;
@@ -20029,19 +20068,19 @@ function Toast({
20029
20068
  }) {
20030
20069
  const resolvedTone = tone === "neutral" ? "default" : tone;
20031
20070
  const __twcStyles = useScopedStyles("twc-toast-styles", TOAST_CSS);
20032
- const onCloseRef = React54__namespace.default.useRef(onClose);
20033
- React54__namespace.default.useEffect(() => {
20071
+ const onCloseRef = React55__namespace.default.useRef(onClose);
20072
+ React55__namespace.default.useEffect(() => {
20034
20073
  onCloseRef.current = onClose;
20035
20074
  }, [onClose]);
20036
- const timer = React54__namespace.default.useRef();
20037
- const stop = React54__namespace.default.useCallback(() => clearTimeout(timer.current), []);
20038
- const start = React54__namespace.default.useCallback(() => {
20075
+ const timer = React55__namespace.default.useRef();
20076
+ const stop = React55__namespace.default.useCallback(() => clearTimeout(timer.current), []);
20077
+ const start = React55__namespace.default.useCallback(() => {
20039
20078
  stop();
20040
20079
  if (duration && duration !== Infinity && onCloseRef.current) {
20041
20080
  timer.current = setTimeout(() => onCloseRef.current && onCloseRef.current(), duration);
20042
20081
  }
20043
20082
  }, [duration, stop]);
20044
- React54__namespace.default.useEffect(() => {
20083
+ React55__namespace.default.useEffect(() => {
20045
20084
  start();
20046
20085
  return stop;
20047
20086
  }, [start, stop]);
@@ -20086,32 +20125,32 @@ function Toast({
20086
20125
  }
20087
20126
  function ToastViewport({ children, limit, className = "", ...rest }) {
20088
20127
  const __twcStyles = useScopedStyles("twc-toast-styles", TOAST_CSS);
20089
- const shown = limit && limit > 0 ? React54__namespace.default.Children.toArray(children).slice(-limit) : children;
20128
+ const shown = limit && limit > 0 ? React55__namespace.default.Children.toArray(children).slice(-limit) : children;
20090
20129
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `twc-toast-viewport ${className}`, role: "region", "aria-label": "Notifications", ...rest, children: [
20091
20130
  __twcStyles,
20092
20131
  shown
20093
20132
  ] });
20094
20133
  }
20095
- var ToastContext = React54__namespace.default.createContext(null);
20134
+ var ToastContext = React55__namespace.default.createContext(null);
20096
20135
  function useToast() {
20097
- const ctx = React54__namespace.default.useContext(ToastContext);
20136
+ const ctx = React55__namespace.default.useContext(ToastContext);
20098
20137
  if (!ctx) throw new Error("useToast must be used within a <ToastProvider>.");
20099
20138
  return ctx;
20100
20139
  }
20101
20140
  function ToastProvider({ children, limit = 4, duration = 4500, ...viewportProps }) {
20102
- const [toasts, setToasts] = React54__namespace.default.useState([]);
20103
- const [politeMsg, setPoliteMsg] = React54__namespace.default.useState("");
20104
- const [assertiveMsg, setAssertiveMsg] = React54__namespace.default.useState("");
20105
- const idRef = React54__namespace.default.useRef(0);
20106
- const limitRef = React54__namespace.default.useRef(limit);
20107
- React54__namespace.default.useEffect(() => {
20141
+ const [toasts, setToasts] = React55__namespace.default.useState([]);
20142
+ const [politeMsg, setPoliteMsg] = React55__namespace.default.useState("");
20143
+ const [assertiveMsg, setAssertiveMsg] = React55__namespace.default.useState("");
20144
+ const idRef = React55__namespace.default.useRef(0);
20145
+ const limitRef = React55__namespace.default.useRef(limit);
20146
+ React55__namespace.default.useEffect(() => {
20108
20147
  limitRef.current = limit;
20109
20148
  }, [limit]);
20110
- const dismiss = React54__namespace.default.useCallback((id) => {
20149
+ const dismiss = React55__namespace.default.useCallback((id) => {
20111
20150
  setToasts((s) => s.filter((t) => t.id !== id));
20112
20151
  }, []);
20113
- const clear = React54__namespace.default.useCallback(() => setToasts([]), []);
20114
- const api = React54__namespace.default.useMemo(() => {
20152
+ const clear = React55__namespace.default.useCallback(() => setToasts([]), []);
20153
+ const api = React55__namespace.default.useMemo(() => {
20115
20154
  const push = (opts) => {
20116
20155
  const id = idRef.current += 1;
20117
20156
  const next = typeof opts === "string" ? { title: opts } : opts && typeof opts === "object" ? opts : {};
@@ -20138,7 +20177,7 @@ function ToastProvider({ children, limit = 4, duration = 4500, ...viewportProps
20138
20177
  toast.show = withTone("default");
20139
20178
  return { toast, dismiss, clear };
20140
20179
  }, [dismiss, clear]);
20141
- const value = React54__namespace.default.useMemo(() => ({ ...api, toasts }), [api, toasts]);
20180
+ const value = React55__namespace.default.useMemo(() => ({ ...api, toasts }), [api, toasts]);
20142
20181
  return /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Provider, { value, children: [
20143
20182
  children,
20144
20183
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "twc-toast-sr", "aria-live": "polite", "aria-atomic": "true", children: politeMsg }),
@@ -20252,13 +20291,13 @@ function TreeView({
20252
20291
  }) {
20253
20292
  const nodes = items;
20254
20293
  const __twcStyles = useScopedStyles("twc-tree-styles", TREE_CSS);
20255
- const [expInternal, setExpInternal] = React54__namespace.default.useState(() => new Set(defaultExpanded));
20294
+ const [expInternal, setExpInternal] = React55__namespace.default.useState(() => new Set(defaultExpanded));
20256
20295
  const expanded = expandedProp !== void 0 ? new Set(expandedProp) : expInternal;
20257
- const [selInternal, setSelInternal] = React54__namespace.default.useState(defaultSelectedId);
20296
+ const [selInternal, setSelInternal] = React55__namespace.default.useState(defaultSelectedId);
20258
20297
  const selectedId = selectedProp !== void 0 ? selectedProp : selInternal;
20259
- const [focusId, setFocusId] = React54__namespace.default.useState(null);
20260
- const rowRefs = React54__namespace.default.useRef(/* @__PURE__ */ new Map());
20261
- const taRef = React54__namespace.default.useRef({ str: "", t: 0 });
20298
+ const [focusId, setFocusId] = React55__namespace.default.useState(null);
20299
+ const rowRefs = React55__namespace.default.useRef(/* @__PURE__ */ new Map());
20300
+ const taRef = React55__namespace.default.useRef({ str: "", t: 0 });
20262
20301
  const toggle = (id) => {
20263
20302
  const n = new Set(expanded);
20264
20303
  n.has(id) ? n.delete(id) : n.add(id);
@@ -20396,7 +20435,7 @@ function AppShell({
20396
20435
  ...rest
20397
20436
  }) {
20398
20437
  const __twcStyles = useScopedStyles("twc-shell-styles", SHELL_CSS);
20399
- const wiredSidebar = React54__namespace.default.isValidElement(sidebar) && (sidebarOpen !== void 0 || onSidebarOpenChange !== void 0) ? React54__namespace.default.cloneElement(sidebar, {
20438
+ const wiredSidebar = React55__namespace.default.isValidElement(sidebar) && (sidebarOpen !== void 0 || onSidebarOpenChange !== void 0) ? React55__namespace.default.cloneElement(sidebar, {
20400
20439
  overlay: sidebar.props.overlay !== void 0 ? sidebar.props.overlay : true,
20401
20440
  open: sidebar.props.open !== void 0 ? sidebar.props.open : sidebarOpen,
20402
20441
  onOpenChange: sidebar.props.onOpenChange !== void 0 ? sidebar.props.onOpenChange : onSidebarOpenChange
@@ -20431,7 +20470,7 @@ function safeHref9(url) {
20431
20470
  const s = String(url).replace(/[\x00-\x20]+/g, "").toLowerCase();
20432
20471
  return s.startsWith("javascript:") || s.startsWith("data:") || s.startsWith("vbscript:") ? void 0 : url;
20433
20472
  }
20434
- var Box = React54__namespace.default.forwardRef(function Box2({
20473
+ var Box = /* @__PURE__ */ React55__namespace.default.forwardRef(function Box2({
20435
20474
  as: Tag2 = "div",
20436
20475
  p,
20437
20476
  px,
@@ -20480,14 +20519,13 @@ var Box = React54__namespace.default.forwardRef(function Box2({
20480
20519
  children
20481
20520
  ] });
20482
20521
  });
20483
- Box.displayName = "Box";
20484
20522
  var SIZES = { sm: 640, md: 768, lg: 1024, xl: 1280, full: "100%" };
20485
20523
  function safeHref10(url) {
20486
20524
  if (url == null) return void 0;
20487
20525
  const s = String(url).replace(/[\x00-\x20]+/g, "").toLowerCase();
20488
20526
  return s.startsWith("javascript:") || s.startsWith("data:") || s.startsWith("vbscript:") ? void 0 : url;
20489
20527
  }
20490
- var Container = React54__namespace.default.forwardRef(function Container2({
20528
+ var Container = /* @__PURE__ */ React55__namespace.default.forwardRef(function Container2({
20491
20529
  as: Tag2 = "div",
20492
20530
  size = "lg",
20493
20531
  padded = true,
@@ -20524,7 +20562,6 @@ var Container = React54__namespace.default.forwardRef(function Container2({
20524
20562
  }
20525
20563
  );
20526
20564
  });
20527
- Container.displayName = "Container";
20528
20565
  function space2(v) {
20529
20566
  if (v == null) return void 0;
20530
20567
  if (typeof v === "number") return `var(--space-${String(v).replace(".", "-")})`;
@@ -20535,7 +20572,7 @@ function safeHref11(url) {
20535
20572
  const s = String(url).replace(/[\x00-\x20]+/g, "").toLowerCase();
20536
20573
  return s.startsWith("javascript:") || s.startsWith("data:") || s.startsWith("vbscript:") ? void 0 : url;
20537
20574
  }
20538
- var Stack = React54__namespace.default.forwardRef(function Stack2({
20575
+ var Stack = /* @__PURE__ */ React55__namespace.default.forwardRef(function Stack2({
20539
20576
  as: Tag2 = "div",
20540
20577
  direction = "column",
20541
20578
  gap = 4,
@@ -20559,7 +20596,7 @@ var Stack = React54__namespace.default.forwardRef(function Stack2({
20559
20596
  }, ref) {
20560
20597
  const { flatStyle, styleNode, sxAttr } = useSx(sx);
20561
20598
  if (Tag2 === "a" && rest.href != null) rest.href = safeHref11(rest.href);
20562
- const kids = divider != null ? React54__namespace.default.Children.toArray(children).flatMap((child, i, arr) => i < arr.length - 1 ? [child, /* @__PURE__ */ jsxRuntime.jsx(React54__namespace.default.Fragment, { children: divider }, `twc-stack-div-${i}`)] : [child]) : children;
20599
+ const kids = divider != null ? React55__namespace.default.Children.toArray(children).flatMap((child, i, arr) => i < arr.length - 1 ? [child, /* @__PURE__ */ jsxRuntime.jsx(React55__namespace.default.Fragment, { children: divider }, `twc-stack-div-${i}`)] : [child]) : children;
20563
20600
  return /* @__PURE__ */ jsxRuntime.jsxs(
20564
20601
  Tag2,
20565
20602
  {
@@ -20589,7 +20626,6 @@ var Stack = React54__namespace.default.forwardRef(function Stack2({
20589
20626
  }
20590
20627
  );
20591
20628
  });
20592
- Stack.displayName = "Stack";
20593
20629
  var CODE_CSS = `
20594
20630
  .twc-code {
20595
20631
  font-family: var(--font-mono); font-size: 0.875em;
@@ -20618,7 +20654,7 @@ function safeHref12(url) {
20618
20654
  const s = String(url).replace(/[\x00-\x20]+/g, "").toLowerCase();
20619
20655
  return s.startsWith("javascript:") || s.startsWith("data:") || s.startsWith("vbscript:") ? void 0 : url;
20620
20656
  }
20621
- function Code({
20657
+ var Code = /* @__PURE__ */ React55__namespace.default.forwardRef(function Code2({
20622
20658
  as,
20623
20659
  block = false,
20624
20660
  copyable = false,
@@ -20627,14 +20663,15 @@ function Code({
20627
20663
  className = "",
20628
20664
  children,
20629
20665
  ...rest
20630
- }) {
20666
+ }, ref) {
20631
20667
  const __twcStyles = useScopedStyles("twc-code-styles", CODE_CSS);
20632
20668
  const Tag2 = as ?? (block ? "pre" : "code");
20633
20669
  if (Tag2 === "a" && rest.href != null) rest.href = safeHref12(rest.href);
20634
- const rootRef = React54__namespace.default.useRef(null);
20635
- const [copied, setCopied] = React54__namespace.default.useState(false);
20636
- const timerRef = React54__namespace.default.useRef(null);
20637
- React54__namespace.default.useEffect(() => () => clearTimeout(timerRef.current), []);
20670
+ const rootRef = React55__namespace.default.useRef(null);
20671
+ const setRootRef = useMergedRef(rootRef, ref);
20672
+ const [copied, setCopied] = React55__namespace.default.useState(false);
20673
+ const timerRef = React55__namespace.default.useRef(null);
20674
+ React55__namespace.default.useEffect(() => () => clearTimeout(timerRef.current), []);
20638
20675
  const doCopy = () => {
20639
20676
  const text = typeof children === "string" ? children : rootRef.current?.textContent ?? "";
20640
20677
  const flash = () => {
@@ -20667,7 +20704,7 @@ function Code({
20667
20704
  }
20668
20705
  execFallback();
20669
20706
  };
20670
- return /* @__PURE__ */ jsxRuntime.jsxs(Tag2, { ref: rootRef, className: `twc-code ${className}`.trim(), "data-block": block || void 0, ...rest, children: [
20707
+ return /* @__PURE__ */ jsxRuntime.jsxs(Tag2, { ref: setRootRef, className: `twc-code ${className}`.trim(), "data-block": block || void 0, ...rest, children: [
20671
20708
  __twcStyles,
20672
20709
  copyable ? /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "twc-code__copy", "aria-label": copied ? copiedLabel : copyLabel, onClick: doCopy, children: copied ? /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.4", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m20 6-11 11-5-5" }) }) : /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
20673
20710
  /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
@@ -20675,14 +20712,14 @@ function Code({
20675
20712
  ] }) }) : null,
20676
20713
  children
20677
20714
  ] });
20678
- }
20715
+ });
20679
20716
  var LEVEL_SIZE = { 1: "4xl", 2: "2xl", 3: "xl", 4: "lg", 5: "base", 6: "sm" };
20680
20717
  function safeHref13(url) {
20681
20718
  if (url == null) return void 0;
20682
20719
  const s = String(url).replace(/[\x00-\x20]+/g, "").toLowerCase();
20683
20720
  return s.startsWith("javascript:") || s.startsWith("data:") || s.startsWith("vbscript:") ? void 0 : url;
20684
20721
  }
20685
- var Heading = React54__namespace.default.forwardRef(function Heading2({
20722
+ var Heading = /* @__PURE__ */ React55__namespace.default.forwardRef(function Heading2({
20686
20723
  as,
20687
20724
  level = 2,
20688
20725
  size,
@@ -20730,7 +20767,6 @@ var Heading = React54__namespace.default.forwardRef(function Heading2({
20730
20767
  }
20731
20768
  );
20732
20769
  });
20733
- Heading.displayName = "Heading";
20734
20770
  var TONE = {
20735
20771
  default: "--color-text",
20736
20772
  muted: "--color-text-muted",
@@ -20751,7 +20787,7 @@ function safeHref14(url) {
20751
20787
  const s = String(url).replace(/[\x00-\x20]+/g, "").toLowerCase();
20752
20788
  return s.startsWith("javascript:") || s.startsWith("data:") || s.startsWith("vbscript:") ? void 0 : url;
20753
20789
  }
20754
- var Text = React54__namespace.default.forwardRef(function Text2({
20790
+ var Text = /* @__PURE__ */ React55__namespace.default.forwardRef(function Text2({
20755
20791
  as: Tag2 = "p",
20756
20792
  size = "base",
20757
20793
  tone = "default",
@@ -20797,47 +20833,46 @@ var Text = React54__namespace.default.forwardRef(function Text2({
20797
20833
  }
20798
20834
  );
20799
20835
  });
20800
- Text.displayName = "Text";
20801
20836
  var canUseDOM2 = typeof window !== "undefined" && typeof document !== "undefined";
20802
- var useIsomorphicLayoutEffect = canUseDOM2 ? React54__namespace.default.useLayoutEffect : React54__namespace.default.useEffect;
20837
+ var useIsomorphicLayoutEffect = canUseDOM2 ? React55__namespace.default.useLayoutEffect : React55__namespace.default.useEffect;
20803
20838
  function useMounted() {
20804
- const [mounted, setMounted] = React54__namespace.default.useState(false);
20805
- React54__namespace.default.useEffect(() => {
20839
+ const [mounted, setMounted] = React55__namespace.default.useState(false);
20840
+ React55__namespace.default.useEffect(() => {
20806
20841
  setMounted(true);
20807
20842
  }, []);
20808
20843
  return mounted;
20809
20844
  }
20810
20845
  function usePrevious(value) {
20811
- const ref = React54__namespace.default.useRef(void 0);
20812
- React54__namespace.default.useEffect(() => {
20846
+ const ref = React55__namespace.default.useRef(void 0);
20847
+ React55__namespace.default.useEffect(() => {
20813
20848
  ref.current = value;
20814
20849
  }, [value]);
20815
20850
  return ref.current;
20816
20851
  }
20817
20852
  function useToggle(initial = false) {
20818
- const [on, setOn] = React54__namespace.default.useState(initial);
20819
- const toggle = React54__namespace.default.useCallback((next) => {
20853
+ const [on, setOn] = React55__namespace.default.useState(initial);
20854
+ const toggle = React55__namespace.default.useCallback((next) => {
20820
20855
  setOn((prev) => typeof next === "boolean" ? next : !prev);
20821
20856
  }, []);
20822
20857
  return [on, toggle, setOn];
20823
20858
  }
20824
20859
  function useDisclosure(initial = false) {
20825
- const [open, setOpen] = React54__namespace.default.useState(initial);
20826
- const onOpen = React54__namespace.default.useCallback(() => setOpen(true), []);
20827
- const onClose = React54__namespace.default.useCallback(() => setOpen(false), []);
20828
- const onToggle = React54__namespace.default.useCallback(() => setOpen((p) => !p), []);
20860
+ const [open, setOpen] = React55__namespace.default.useState(initial);
20861
+ const onOpen = React55__namespace.default.useCallback(() => setOpen(true), []);
20862
+ const onClose = React55__namespace.default.useCallback(() => setOpen(false), []);
20863
+ const onToggle = React55__namespace.default.useCallback(() => setOpen((p) => !p), []);
20829
20864
  return { open, onOpen, onClose, onToggle, setOpen };
20830
20865
  }
20831
20866
  function useControllableState({ value, defaultValue, onChange } = {}) {
20832
20867
  const isControlled = value !== void 0;
20833
- const [uncontrolled, setUncontrolled] = React54__namespace.default.useState(defaultValue);
20868
+ const [uncontrolled, setUncontrolled] = React55__namespace.default.useState(defaultValue);
20834
20869
  const current = isControlled ? value : uncontrolled;
20835
- const ref = React54__namespace.default.useRef({ current, isControlled, onChange });
20870
+ const ref = React55__namespace.default.useRef({ current, isControlled, onChange });
20836
20871
  useIsomorphicLayoutEffect(() => {
20837
20872
  ref.current = { current, isControlled, onChange };
20838
20873
  });
20839
- const wasControlled = React54__namespace.default.useRef(isControlled);
20840
- React54__namespace.default.useEffect(() => {
20874
+ const wasControlled = React55__namespace.default.useRef(isControlled);
20875
+ React55__namespace.default.useEffect(() => {
20841
20876
  if (wasControlled.current !== isControlled) {
20842
20877
  warnOnce(
20843
20878
  "useControllableState:switch",
@@ -20846,7 +20881,7 @@ function useControllableState({ value, defaultValue, onChange } = {}) {
20846
20881
  wasControlled.current = isControlled;
20847
20882
  }
20848
20883
  });
20849
- const setValue = React54__namespace.default.useCallback((next) => {
20884
+ const setValue = React55__namespace.default.useCallback((next) => {
20850
20885
  const { current: cur, isControlled: ctrl, onChange: cb } = ref.current;
20851
20886
  const resolved = typeof next === "function" ? next(cur) : next;
20852
20887
  if (resolved === cur) return;
@@ -20857,7 +20892,7 @@ function useControllableState({ value, defaultValue, onChange } = {}) {
20857
20892
  }
20858
20893
  function useMediaQuery(query, { defaultValue = false, initializeWithValue = false } = {}) {
20859
20894
  const get = () => canUseDOM2 ? window.matchMedia(query).matches : defaultValue;
20860
- const [matches3, setMatches] = React54__namespace.default.useState(initializeWithValue ? get : defaultValue);
20895
+ const [matches3, setMatches] = React55__namespace.default.useState(initializeWithValue ? get : defaultValue);
20861
20896
  useIsomorphicLayoutEffect(() => {
20862
20897
  if (!canUseDOM2) return void 0;
20863
20898
  const mql = window.matchMedia(query);
@@ -20873,7 +20908,7 @@ function usePrefersReducedMotion() {
20873
20908
  }
20874
20909
  function useColorScheme({ storageKey = "twico-theme", attribute = "class", element, disableTransitionsOnChange = true, initializeWithValue = false } = {}) {
20875
20910
  const getTarget = () => element || (canUseDOM2 ? document.documentElement : null);
20876
- const firstApply = React54__namespace.default.useRef(true);
20911
+ const firstApply = React55__namespace.default.useRef(true);
20877
20912
  const read = () => {
20878
20913
  if (!canUseDOM2) return "light";
20879
20914
  try {
@@ -20883,8 +20918,8 @@ function useColorScheme({ storageKey = "twico-theme", attribute = "class", eleme
20883
20918
  }
20884
20919
  return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
20885
20920
  };
20886
- const [theme, setThemeState] = React54__namespace.default.useState(initializeWithValue ? read : "light");
20887
- const apply = React54__namespace.default.useCallback(
20921
+ const [theme, setThemeState] = React55__namespace.default.useState(initializeWithValue ? read : "light");
20922
+ const apply = React55__namespace.default.useCallback(
20888
20923
  (t) => {
20889
20924
  const target = getTarget();
20890
20925
  if (!target) return;
@@ -20907,7 +20942,7 @@ function useColorScheme({ storageKey = "twico-theme", attribute = "class", eleme
20907
20942
  },
20908
20943
  [attribute, element, disableTransitionsOnChange]
20909
20944
  );
20910
- const resolved = React54__namespace.default.useRef(false);
20945
+ const resolved = React55__namespace.default.useRef(false);
20911
20946
  useIsomorphicLayoutEffect(() => {
20912
20947
  if (!resolved.current) {
20913
20948
  resolved.current = true;
@@ -20920,11 +20955,11 @@ function useColorScheme({ storageKey = "twico-theme", attribute = "class", eleme
20920
20955
  }
20921
20956
  apply(theme);
20922
20957
  }, [theme, apply]);
20923
- const themeRef = React54__namespace.default.useRef(theme);
20958
+ const themeRef = React55__namespace.default.useRef(theme);
20924
20959
  useIsomorphicLayoutEffect(() => {
20925
20960
  themeRef.current = theme;
20926
20961
  }, [theme]);
20927
- const setTheme = React54__namespace.default.useCallback(
20962
+ const setTheme = React55__namespace.default.useCallback(
20928
20963
  (t) => {
20929
20964
  setThemeState(t);
20930
20965
  try {
@@ -20935,10 +20970,10 @@ function useColorScheme({ storageKey = "twico-theme", attribute = "class", eleme
20935
20970
  },
20936
20971
  [storageKey]
20937
20972
  );
20938
- const toggle = React54__namespace.default.useCallback(() => {
20973
+ const toggle = React55__namespace.default.useCallback(() => {
20939
20974
  setTheme(themeRef.current === "dark" ? "light" : "dark");
20940
20975
  }, [setTheme]);
20941
- React54__namespace.default.useEffect(() => {
20976
+ React55__namespace.default.useEffect(() => {
20942
20977
  if (!canUseDOM2) return void 0;
20943
20978
  const sync = () => setThemeState(read());
20944
20979
  const onStorage = (e) => {
@@ -20954,14 +20989,14 @@ function useColorScheme({ storageKey = "twico-theme", attribute = "class", eleme
20954
20989
  return { theme, setTheme, toggle, isDark: theme === "dark" };
20955
20990
  }
20956
20991
  function useEventListener(eventName, handler, element, options) {
20957
- const saved = React54__namespace.default.useRef(handler);
20992
+ const saved = React55__namespace.default.useRef(handler);
20958
20993
  useIsomorphicLayoutEffect(() => {
20959
20994
  saved.current = handler;
20960
20995
  }, [handler]);
20961
20996
  const capture = typeof options === "boolean" ? options : options && options.capture;
20962
20997
  const passive = typeof options === "object" && options ? options.passive : void 0;
20963
20998
  const once = typeof options === "object" && options ? options.once : void 0;
20964
- React54__namespace.default.useEffect(() => {
20999
+ React55__namespace.default.useEffect(() => {
20965
21000
  const target = element && element.current || element || (canUseDOM2 ? window : null);
20966
21001
  if (!target || !target.addEventListener) return void 0;
20967
21002
  const opts = typeof options === "boolean" ? options : { capture, passive, once };
@@ -20971,11 +21006,11 @@ function useEventListener(eventName, handler, element, options) {
20971
21006
  }, [eventName, element, capture, passive, once]);
20972
21007
  }
20973
21008
  function useClickOutside(ref, handler, events = ["mousedown", "touchstart"]) {
20974
- const saved = React54__namespace.default.useRef(handler);
21009
+ const saved = React55__namespace.default.useRef(handler);
20975
21010
  useIsomorphicLayoutEffect(() => {
20976
21011
  saved.current = handler;
20977
21012
  }, [handler]);
20978
- React54__namespace.default.useEffect(() => {
21013
+ React55__namespace.default.useEffect(() => {
20979
21014
  if (!canUseDOM2) return void 0;
20980
21015
  const listener = (e) => {
20981
21016
  const el = ref && ref.current;
@@ -21010,12 +21045,12 @@ function useLocalStorage(key, initialValue, { initializeWithValue = false } = {}
21010
21045
  return initialValue;
21011
21046
  }
21012
21047
  };
21013
- const [stored, setStored] = React54__namespace.default.useState(initializeWithValue ? read : initialValue);
21048
+ const [stored, setStored] = React55__namespace.default.useState(initializeWithValue ? read : initialValue);
21014
21049
  useIsomorphicLayoutEffect(() => {
21015
21050
  if (!canUseDOM2) return;
21016
21051
  setStored(read());
21017
21052
  }, [key]);
21018
- const setValue = React54__namespace.default.useCallback(
21053
+ const setValue = React55__namespace.default.useCallback(
21019
21054
  (value) => {
21020
21055
  setStored((prev) => {
21021
21056
  const next = typeof value === "function" ? value(prev) : value;
@@ -21054,9 +21089,9 @@ function legacyCopy(text) {
21054
21089
  }
21055
21090
  }
21056
21091
  function useCopyToClipboard(timeout = 1500) {
21057
- const [copied, setCopied] = React54__namespace.default.useState(false);
21058
- const [copyTick, setCopyTick] = React54__namespace.default.useState(0);
21059
- const copy = React54__namespace.default.useCallback(async (text) => {
21092
+ const [copied, setCopied] = React55__namespace.default.useState(false);
21093
+ const [copyTick, setCopyTick] = React55__namespace.default.useState(0);
21094
+ const copy = React55__namespace.default.useCallback(async (text) => {
21060
21095
  if (!canUseDOM2) {
21061
21096
  setCopied(false);
21062
21097
  return false;
@@ -21075,7 +21110,7 @@ function useCopyToClipboard(timeout = 1500) {
21075
21110
  if (ok) setCopyTick((t) => t + 1);
21076
21111
  return ok;
21077
21112
  }, []);
21078
- React54__namespace.default.useEffect(() => {
21113
+ React55__namespace.default.useEffect(() => {
21079
21114
  if (!copied) return void 0;
21080
21115
  const t = setTimeout(() => setCopied(false), timeout);
21081
21116
  return () => clearTimeout(t);
@@ -21083,23 +21118,23 @@ function useCopyToClipboard(timeout = 1500) {
21083
21118
  return { copied, copy };
21084
21119
  }
21085
21120
  function useDebouncedValue(value, delay = 200) {
21086
- const [debounced, setDebounced] = React54__namespace.default.useState(value);
21087
- React54__namespace.default.useEffect(() => {
21121
+ const [debounced, setDebounced] = React55__namespace.default.useState(value);
21122
+ React55__namespace.default.useEffect(() => {
21088
21123
  const t = setTimeout(() => setDebounced(value), delay);
21089
21124
  return () => clearTimeout(t);
21090
21125
  }, [value, delay]);
21091
21126
  return debounced;
21092
21127
  }
21093
21128
  function useDebouncedCallback(callback, delay = 200) {
21094
- const saved = React54__namespace.default.useRef(callback);
21095
- const timer = React54__namespace.default.useRef(null);
21129
+ const saved = React55__namespace.default.useRef(callback);
21130
+ const timer = React55__namespace.default.useRef(null);
21096
21131
  useIsomorphicLayoutEffect(() => {
21097
21132
  saved.current = callback;
21098
21133
  }, [callback]);
21099
- React54__namespace.default.useEffect(() => () => {
21134
+ React55__namespace.default.useEffect(() => () => {
21100
21135
  if (timer.current) clearTimeout(timer.current);
21101
21136
  }, []);
21102
- return React54__namespace.default.useCallback(
21137
+ return React55__namespace.default.useCallback(
21103
21138
  (...args) => {
21104
21139
  if (timer.current) clearTimeout(timer.current);
21105
21140
  timer.current = setTimeout(() => saved.current(...args), delay);
@@ -21108,22 +21143,22 @@ function useDebouncedCallback(callback, delay = 200) {
21108
21143
  );
21109
21144
  }
21110
21145
  function useInterval(callback, delay) {
21111
- const saved = React54__namespace.default.useRef(callback);
21146
+ const saved = React55__namespace.default.useRef(callback);
21112
21147
  useIsomorphicLayoutEffect(() => {
21113
21148
  saved.current = callback;
21114
21149
  }, [callback]);
21115
- React54__namespace.default.useEffect(() => {
21150
+ React55__namespace.default.useEffect(() => {
21116
21151
  if (delay == null) return void 0;
21117
21152
  const id = setInterval(() => saved.current(), delay);
21118
21153
  return () => clearInterval(id);
21119
21154
  }, [delay]);
21120
21155
  }
21121
21156
  function useTimeout(callback, delay) {
21122
- const saved = React54__namespace.default.useRef(callback);
21157
+ const saved = React55__namespace.default.useRef(callback);
21123
21158
  useIsomorphicLayoutEffect(() => {
21124
21159
  saved.current = callback;
21125
21160
  }, [callback]);
21126
- React54__namespace.default.useEffect(() => {
21161
+ React55__namespace.default.useEffect(() => {
21127
21162
  if (delay == null) return void 0;
21128
21163
  const id = setTimeout(() => saved.current(), delay);
21129
21164
  return () => clearTimeout(id);
@@ -21134,7 +21169,7 @@ function useWindowSize({ initializeWithValue = false } = {}) {
21134
21169
  width: canUseDOM2 ? window.innerWidth : 0,
21135
21170
  height: canUseDOM2 ? window.innerHeight : 0
21136
21171
  });
21137
- const [size, setSize] = React54__namespace.default.useState(initializeWithValue ? get : { width: 0, height: 0 });
21172
+ const [size, setSize] = React55__namespace.default.useState(initializeWithValue ? get : { width: 0, height: 0 });
21138
21173
  useIsomorphicLayoutEffect(() => {
21139
21174
  if (!canUseDOM2) return void 0;
21140
21175
  const onResize = () => setSize({ width: window.innerWidth, height: window.innerHeight });
@@ -21145,8 +21180,8 @@ function useWindowSize({ initializeWithValue = false } = {}) {
21145
21180
  return size;
21146
21181
  }
21147
21182
  function useHover(ref) {
21148
- const [hovered, setHovered] = React54__namespace.default.useState(false);
21149
- React54__namespace.default.useEffect(() => {
21183
+ const [hovered, setHovered] = React55__namespace.default.useState(false);
21184
+ React55__namespace.default.useEffect(() => {
21150
21185
  const el = ref && ref.current;
21151
21186
  if (!el) return void 0;
21152
21187
  const on = () => setHovered(true);
@@ -21162,8 +21197,8 @@ function useHover(ref) {
21162
21197
  }
21163
21198
  function useIntersectionObserver(ref, options = {}) {
21164
21199
  const { root = null, rootMargin = "0px", threshold = 0 } = options;
21165
- const [entry, setEntry] = React54__namespace.default.useState(null);
21166
- React54__namespace.default.useEffect(() => {
21200
+ const [entry, setEntry] = React55__namespace.default.useState(null);
21201
+ React55__namespace.default.useEffect(() => {
21167
21202
  const el = ref && ref.current;
21168
21203
  if (!canUseDOM2 || !el || typeof IntersectionObserver === "undefined") return void 0;
21169
21204
  const obs = new IntersectionObserver(([e]) => setEntry(e), { root, rootMargin, threshold });
@@ -21173,20 +21208,20 @@ function useIntersectionObserver(ref, options = {}) {
21173
21208
  return entry;
21174
21209
  }
21175
21210
  function useId(prefix = "twc") {
21176
- const raw = React54__namespace.default.useId();
21211
+ const raw = React55__namespace.default.useId();
21177
21212
  return prefix ? `${prefix}-${raw.replace(/:/g, "")}` : raw;
21178
21213
  }
21179
21214
  var useFocusTrap2 = useFocusTrap;
21180
21215
  var usePortal2 = usePortal;
21181
21216
  var useScrollLock2 = useScrollLock;
21182
21217
  function useFilePicker({ accept, multiple = false, maxSize, maxFiles, onFiles, onReject } = {}) {
21183
- const inputRef = React54__namespace.default.useRef(null);
21184
- const cbRef = React54__namespace.default.useRef({ onFiles, onReject });
21218
+ const inputRef = React55__namespace.default.useRef(null);
21219
+ const cbRef = React55__namespace.default.useRef({ onFiles, onReject });
21185
21220
  cbRef.current = { onFiles, onReject };
21186
- const open = React54__namespace.default.useCallback(() => {
21221
+ const open = React55__namespace.default.useCallback(() => {
21187
21222
  inputRef.current?.click();
21188
21223
  }, []);
21189
- const getInputProps = React54__namespace.default.useCallback(() => ({
21224
+ const getInputProps = React55__namespace.default.useCallback(() => ({
21190
21225
  ref: inputRef,
21191
21226
  type: "file",
21192
21227
  accept,