@bigtablet/design-system 3.21.0 → 3.22.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.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import './index.css';
3
- import * as React11 from 'react';
3
+ import * as React20 from 'react';
4
4
  import { createContext, useState, useRef, useCallback, useEffect, useMemo, useContext, useId, Fragment, useImperativeHandle, useLayoutEffect } from 'react';
5
5
  import { useSpring, animated } from '@react-spring/web';
6
6
  import { ChevronDown, ChevronRight, Globe, ChevronLeft, EyeOff, Eye, ArrowUp, ArrowDown, ArrowUpDown, Search, XCircle, AlertTriangle, CheckCircle2, Info, Bell, Check, Image, X, TriangleAlert } from 'lucide-react';
@@ -58,11 +58,11 @@ function registerOverlay(onEscape) {
58
58
  };
59
59
  }
60
60
  function useOverlayEscape(active, onEscape) {
61
- const handlerRef = React11.useRef(onEscape);
62
- React11.useEffect(() => {
61
+ const handlerRef = React20.useRef(onEscape);
62
+ React20.useEffect(() => {
63
63
  handlerRef.current = onEscape;
64
64
  });
65
- React11.useEffect(() => {
65
+ React20.useEffect(() => {
66
66
  if (!active) return;
67
67
  return registerOverlay(() => handlerRef.current());
68
68
  }, [active]);
@@ -71,6 +71,11 @@ function useOverlayEscape(active, onEscape) {
71
71
  // src/utils/scroll-lock.ts
72
72
  var COUNTER = "openModals";
73
73
  var PREV_OVERFLOW = "originalOverflow";
74
+ var PREV_OVERFLOW_X = "originalOverflowX";
75
+ var PREV_OVERFLOW_Y = "originalOverflowY";
76
+ var PREV_HTML_OVERFLOW = "originalHtmlOverflow";
77
+ var PREV_HTML_OVERFLOW_X = "originalHtmlOverflowX";
78
+ var PREV_HTML_OVERFLOW_Y = "originalHtmlOverflowY";
74
79
  var PREV_GUTTER = "originalScrollbarGutter";
75
80
  var PREV_PADDING_RIGHT = "originalPaddingRight";
76
81
  var PREV_SCROLLBAR_WIDTH_VAR = "originalScrollbarWidthVar";
@@ -101,6 +106,11 @@ function lockBodyScroll() {
101
106
  if (open === 0) {
102
107
  const inset = measureViewportInset();
103
108
  body.dataset[PREV_OVERFLOW] = body.style.overflow;
109
+ body.dataset[PREV_OVERFLOW_X] = body.style.overflowX;
110
+ body.dataset[PREV_OVERFLOW_Y] = body.style.overflowY;
111
+ body.dataset[PREV_HTML_OVERFLOW] = html.style.overflow;
112
+ body.dataset[PREV_HTML_OVERFLOW_X] = html.style.overflowX;
113
+ body.dataset[PREV_HTML_OVERFLOW_Y] = html.style.overflowY;
104
114
  body.dataset[PREV_GUTTER] = html.style.scrollbarGutter;
105
115
  body.dataset[PREV_PADDING_RIGHT] = body.style.paddingRight;
106
116
  body.dataset[PREV_SCROLLBAR_WIDTH_VAR] = html.style.getPropertyValue(SCROLLBAR_WIDTH_VAR);
@@ -108,6 +118,7 @@ function lockBodyScroll() {
108
118
  html.style.setProperty(SCROLLBAR_WIDTH_VAR, `${inset}px`);
109
119
  }
110
120
  body.style.overflow = "hidden";
121
+ html.style.overflow = "hidden";
111
122
  if (inset > 0) {
112
123
  html.style.scrollbarGutter = "auto";
113
124
  const current = Number.parseFloat(window.getComputedStyle(body).paddingRight) || 0;
@@ -128,12 +139,22 @@ function unlockBodyScroll() {
128
139
  const remaining = Number.parseInt(body.dataset[COUNTER] || "1", 10) - 1;
129
140
  if (remaining <= 0) {
130
141
  body.style.overflow = body.dataset[PREV_OVERFLOW] || "";
142
+ body.style.overflowX = body.dataset[PREV_OVERFLOW_X] || "";
143
+ body.style.overflowY = body.dataset[PREV_OVERFLOW_Y] || "";
144
+ html.style.overflow = body.dataset[PREV_HTML_OVERFLOW] || "";
145
+ html.style.overflowX = body.dataset[PREV_HTML_OVERFLOW_X] || "";
146
+ html.style.overflowY = body.dataset[PREV_HTML_OVERFLOW_Y] || "";
131
147
  body.style.paddingRight = body.dataset[PREV_PADDING_RIGHT] || "";
132
148
  html.style.scrollbarGutter = body.dataset[PREV_GUTTER] || "";
133
149
  html.removeAttribute(LOCKED_ATTR);
134
150
  restoreScrollbarWidthVar(html, body);
135
151
  delete body.dataset[COUNTER];
136
152
  delete body.dataset[PREV_OVERFLOW];
153
+ delete body.dataset[PREV_OVERFLOW_X];
154
+ delete body.dataset[PREV_OVERFLOW_Y];
155
+ delete body.dataset[PREV_HTML_OVERFLOW];
156
+ delete body.dataset[PREV_HTML_OVERFLOW_X];
157
+ delete body.dataset[PREV_HTML_OVERFLOW_Y];
137
158
  delete body.dataset[PREV_GUTTER];
138
159
  delete body.dataset[PREV_PADDING_RIGHT];
139
160
  delete body.dataset[PREV_SCROLLBAR_WIDTH_VAR];
@@ -248,7 +269,7 @@ function useAnchoredPosition({
248
269
  gap,
249
270
  padding
250
271
  }) {
251
- const [state, setState] = React11.useState({
272
+ const [state, setState] = React20.useState({
252
273
  x: 0,
253
274
  y: 0,
254
275
  placement,
@@ -317,9 +338,9 @@ var FOCUSABLE_SELECTORS = [
317
338
  "textarea:not([disabled])",
318
339
  '[tabindex]:not([tabindex="-1"])'
319
340
  ].join(", ");
320
- function useFocusTrap(containerRef, isActive) {
321
- const previousActiveElement = React11.useRef(null);
322
- React11.useEffect(() => {
341
+ function useFocusTrap(containerRef, isActive, options) {
342
+ const previousActiveElement = React20.useRef(null);
343
+ React20.useEffect(() => {
323
344
  if (!isActive) return;
324
345
  const container = containerRef.current;
325
346
  if (!container) return;
@@ -329,7 +350,11 @@ function useFocusTrap(containerRef, isActive) {
329
350
  };
330
351
  let wasTabIndexAdded = false;
331
352
  const focusableElements = getFocusableElements();
332
- const initialTarget = Array.from(focusableElements).find((el) => !el.hasAttribute(SKIP_AUTOFOCUS_ATTR)) ?? focusableElements[0];
353
+ const preferredRoot = options?.preferWithin?.current;
354
+ const preferred = preferredRoot ? Array.from(preferredRoot.querySelectorAll(FOCUSABLE_SELECTORS)).find(
355
+ (el) => !el.hasAttribute(SKIP_AUTOFOCUS_ATTR)
356
+ ) ?? null : null;
357
+ const initialTarget = preferred ?? Array.from(focusableElements).find((el) => !el.hasAttribute(SKIP_AUTOFOCUS_ATTR)) ?? focusableElements[0];
333
358
  if (initialTarget) {
334
359
  initialTarget.focus();
335
360
  } else {
@@ -358,9 +383,9 @@ function useFocusTrap(containerRef, isActive) {
358
383
  }
359
384
  }
360
385
  };
361
- document.addEventListener("keydown", handleKeyDown2);
386
+ container.addEventListener("keydown", handleKeyDown2);
362
387
  return () => {
363
- document.removeEventListener("keydown", handleKeyDown2);
388
+ container.removeEventListener("keydown", handleKeyDown2);
364
389
  if (wasTabIndexAdded) {
365
390
  container.removeAttribute("tabindex");
366
391
  }
@@ -369,8 +394,8 @@ function useFocusTrap(containerRef, isActive) {
369
394
  }, [isActive, containerRef]);
370
395
  }
371
396
  function useIsMounted() {
372
- const [mounted, setMounted] = React11.useState(false);
373
- React11.useEffect(() => {
397
+ const [mounted, setMounted] = React20.useState(false);
398
+ React20.useEffect(() => {
374
399
  setMounted(true);
375
400
  }, []);
376
401
  return mounted;
@@ -404,13 +429,13 @@ function getServerSnapshot() {
404
429
  return false;
405
430
  }
406
431
  function useReducedMotion() {
407
- return React11.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
432
+ return React20.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
408
433
  }
409
434
  function useSpringHover({
410
435
  scale = 1.02,
411
436
  lift = -2
412
437
  } = {}) {
413
- const [hovered, setHovered] = React11.useState(false);
438
+ const [hovered, setHovered] = React20.useState(false);
414
439
  const reduced = useReducedMotion();
415
440
  const style = useSpring({
416
441
  transform: hovered ? `translateY(${lift}px) scale(${scale})` : "translateY(0px) scale(1)",
@@ -471,6 +496,7 @@ function useListboxPopup({
471
496
  }) {
472
497
  const [isOpen, setIsOpen] = useState(false);
473
498
  const [activeIndex, setActiveIndex] = useState(-1);
499
+ const pendingActiveRef = useRef(null);
474
500
  const wrapperRef = useRef(null);
475
501
  const triggerRef = useRef(null);
476
502
  const listRef = useRef(null);
@@ -480,6 +506,7 @@ function useListboxPopup({
480
506
  if (returnFocusOnClose) triggerRef.current?.focus();
481
507
  }, [returnFocusOnClose]);
482
508
  useEffect(() => {
509
+ if (!isOpen) return;
483
510
  const handleOutsideClick = (event) => {
484
511
  const target = event.target;
485
512
  if (wrapperRef.current?.contains(target) || panelRef.current?.contains(target)) return;
@@ -487,7 +514,7 @@ function useListboxPopup({
487
514
  };
488
515
  document.addEventListener("mousedown", handleOutsideClick);
489
516
  return () => document.removeEventListener("mousedown", handleOutsideClick);
490
- }, []);
517
+ }, [isOpen]);
491
518
  const moveActive = useCallback(
492
519
  (dir) => {
493
520
  if (items.length === 0) return;
@@ -543,11 +570,13 @@ function useListboxPopup({
543
570
  break;
544
571
  case "Home":
545
572
  event.preventDefault();
573
+ if (!isOpen) pendingActiveRef.current = firstEnabled();
546
574
  setIsOpen(true);
547
575
  setActiveIndex(firstEnabled());
548
576
  break;
549
577
  case "End":
550
578
  event.preventDefault();
579
+ if (!isOpen) pendingActiveRef.current = lastEnabled();
551
580
  setIsOpen(true);
552
581
  setActiveIndex(lastEnabled());
553
582
  break;
@@ -592,9 +621,23 @@ function useListboxPopup({
592
621
  );
593
622
  useEffect(() => {
594
623
  if (!isOpen) return;
624
+ const pending = pendingActiveRef.current;
625
+ pendingActiveRef.current = null;
626
+ if (pending !== null && pending >= 0) {
627
+ setActiveIndex(pending);
628
+ return;
629
+ }
595
630
  const preferred = initialActiveIndex?.(items) ?? -1;
596
631
  setActiveIndex(preferred >= 0 ? preferred : items.findIndex((o) => !o.disabled));
597
- }, [isOpen, items]);
632
+ }, [isOpen]);
633
+ useEffect(() => {
634
+ if (!isOpen) return;
635
+ setActiveIndex((current) => {
636
+ if (current >= 0 && current < items.length && !items[current]?.disabled) return current;
637
+ const preferred = initialActiveIndex?.(items) ?? -1;
638
+ return preferred >= 0 ? preferred : items.findIndex((o) => !o.disabled);
639
+ });
640
+ }, [isOpen, items, initialActiveIndex]);
598
641
  useEffect(() => {
599
642
  if (!isOpen || activeIndex < 0) return;
600
643
  const list = listRef.current;
@@ -663,19 +706,19 @@ var Accordion = ({
663
706
  ...props
664
707
  }) => {
665
708
  const isControlled = controlledKeys !== void 0;
666
- const [internalKeys, setInternalKeys] = React11.useState(defaultOpenKeys);
709
+ const [internalKeys, setInternalKeys] = React20.useState(defaultOpenKeys);
667
710
  const open = isControlled ? controlledKeys ?? [] : internalKeys;
668
- const idPrefix = React11.useId();
711
+ const idPrefix = React20.useId();
669
712
  const toggle = (key) => {
670
713
  const isOpen = open.includes(key);
671
714
  const next = isOpen ? open.filter((k) => k !== key) : multiple ? [...open, key] : [key];
672
715
  if (!isControlled) setInternalKeys(next);
673
716
  (onValueChange ?? onChange)?.(next);
674
717
  };
675
- return /* @__PURE__ */ jsx("div", { className: cn("accordion", className), ...props, children: items.map((item) => {
718
+ return /* @__PURE__ */ jsx("div", { className: cn("accordion", className), ...props, children: items.map((item, index) => {
676
719
  const isOpen = open.includes(item.key);
677
- const headerId = `${idPrefix}-${item.key}-header`;
678
- const panelId = `${idPrefix}-${item.key}-panel`;
720
+ const headerId = `${idPrefix}-${index}-header`;
721
+ const panelId = `${idPrefix}-${index}-panel`;
679
722
  return /* @__PURE__ */ jsxs("div", { className: cn("accordion_item", isOpen && "accordion_item_open"), children: [
680
723
  /* @__PURE__ */ jsx("h3", { className: "accordion_header", children: /* @__PURE__ */ jsxs(
681
724
  "button",
@@ -731,8 +774,8 @@ var Avatar = ({
731
774
  style,
732
775
  ...props
733
776
  }) => {
734
- const [imgFailed, setImgFailed] = React11.useState(false);
735
- const showImage = src && !imgFailed;
777
+ const [failedSrc, setFailedSrc] = React20.useState(null);
778
+ const showImage = src && failedSrc !== src;
736
779
  const initials = getInitials(name);
737
780
  return /* @__PURE__ */ jsx(
738
781
  "span",
@@ -745,7 +788,7 @@ var Avatar = ({
745
788
  ...props,
746
789
  children: showImage ? (
747
790
  // biome-ignore lint/performance/noImgElement: DS is framework-agnostic - consumers wrap with next/image
748
- /* @__PURE__ */ jsx("img", { src, alt: name, onError: () => setImgFailed(true), className: "avatar_image" })
791
+ /* @__PURE__ */ jsx("img", { src, alt: name, onError: () => setFailedSrc(src ?? null), className: "avatar_image" })
749
792
  ) : /* @__PURE__ */ jsx("span", { className: "avatar_initials", "aria-hidden": "true", children: initials })
750
793
  }
751
794
  );
@@ -1199,11 +1242,11 @@ var Breadcrumb = ({
1199
1242
  };
1200
1243
  var MENU_GAP = 4;
1201
1244
  var Menu = ({ items, trigger, align = "start" }) => {
1202
- const [open, setOpen] = React11.useState(false);
1203
- const wrapperRef = React11.useRef(null);
1204
- const menuRef = React11.useRef(null);
1205
- const itemRefs = React11.useRef([]);
1206
- const menuId = React11.useId();
1245
+ const [open, setOpen] = React20.useState(false);
1246
+ const wrapperRef = React20.useRef(null);
1247
+ const menuRef = React20.useRef(null);
1248
+ const itemRefs = React20.useRef([]);
1249
+ const menuId = React20.useId();
1207
1250
  const pos = useAnchoredPosition({
1208
1251
  open,
1209
1252
  anchorRef: wrapperRef,
@@ -1213,7 +1256,7 @@ var Menu = ({ items, trigger, align = "start" }) => {
1213
1256
  gap: MENU_GAP,
1214
1257
  padding: 8
1215
1258
  });
1216
- React11.useEffect(() => {
1259
+ React20.useEffect(() => {
1217
1260
  if (!open || !pos.ready || !pos.anchorHidden) return;
1218
1261
  const focusInMenu = !!menuRef.current?.contains(document.activeElement);
1219
1262
  setOpen(false);
@@ -1225,7 +1268,7 @@ var Menu = ({ items, trigger, align = "start" }) => {
1225
1268
  visible: open,
1226
1269
  from: pos.placement === "top" ? `translateY(${MENU_GAP}px)` : `translateY(-${MENU_GAP}px)`
1227
1270
  });
1228
- React11.useEffect(() => {
1271
+ React20.useEffect(() => {
1229
1272
  if (!open) return;
1230
1273
  const handleClick = (e) => {
1231
1274
  const target = e.target;
@@ -1242,7 +1285,7 @@ var Menu = ({ items, trigger, align = "start" }) => {
1242
1285
  document.removeEventListener("keydown", handleEsc);
1243
1286
  };
1244
1287
  }, [open]);
1245
- React11.useEffect(() => {
1288
+ React20.useEffect(() => {
1246
1289
  const active = document.activeElement;
1247
1290
  if (!open || active && itemRefs.current.includes(active)) return;
1248
1291
  const first = items.findIndex((it) => !it.disabled);
@@ -1289,7 +1332,7 @@ var Menu = ({ items, trigger, align = "start" }) => {
1289
1332
  break;
1290
1333
  }
1291
1334
  };
1292
- const triggerWithProps = React11.cloneElement(
1335
+ const triggerWithProps = React20.cloneElement(
1293
1336
  trigger,
1294
1337
  {
1295
1338
  onClick: () => setOpen((o) => !o),
@@ -1336,6 +1379,7 @@ var Menu = ({ items, trigger, align = "start" }) => {
1336
1379
  ),
1337
1380
  onClick: () => {
1338
1381
  if (item.disabled) return;
1382
+ wrapperRef.current?.querySelector("[aria-haspopup]")?.focus();
1339
1383
  item.onSelect?.();
1340
1384
  setOpen(false);
1341
1385
  },
@@ -1387,7 +1431,9 @@ var NavBar = ({
1387
1431
  mo.observe(links, {
1388
1432
  subtree: true,
1389
1433
  attributes: true,
1390
- attributeFilter: ["class", "aria-current"]
1434
+ attributeFilter: ["class", "aria-current"],
1435
+ childList: true,
1436
+ characterData: true
1391
1437
  });
1392
1438
  const ro = typeof ResizeObserver !== "undefined" ? new ResizeObserver(update) : null;
1393
1439
  ro?.observe(links);
@@ -1498,11 +1544,13 @@ var LocaleSwitcher = ({ locale }) => {
1498
1544
  wrapperRef.current?.querySelector("[aria-haspopup]")?.focus();
1499
1545
  break;
1500
1546
  case "Tab":
1547
+ wrapperRef.current?.querySelector("[aria-haspopup]")?.focus();
1501
1548
  setOpen(false);
1502
1549
  break;
1503
1550
  }
1504
1551
  };
1505
1552
  const handleSelect = (value) => {
1553
+ wrapperRef.current?.querySelector("[aria-haspopup]")?.focus();
1506
1554
  (locale.onValueChange ?? locale.onChange)?.(value);
1507
1555
  setOpen(false);
1508
1556
  };
@@ -1578,9 +1626,9 @@ var Sidebar = ({
1578
1626
  const t = useLocaleText();
1579
1627
  const toggleLabel = toggleLabelProp ?? t("sidebar.toggle");
1580
1628
  const isControlled = collapsedProp !== void 0;
1581
- const [internalCollapsed, setInternalCollapsed] = React11.useState(defaultCollapsed);
1629
+ const [internalCollapsed, setInternalCollapsed] = React20.useState(defaultCollapsed);
1582
1630
  const collapsed = isControlled ? collapsedProp : internalCollapsed;
1583
- const toggle = React11.useCallback(() => {
1631
+ const toggle = React20.useCallback(() => {
1584
1632
  const next = !collapsed;
1585
1633
  if (!isControlled) setInternalCollapsed(next);
1586
1634
  onCollapsedChange?.(next);
@@ -1682,9 +1730,9 @@ var SidebarSection = ({ label, className, children, ...props }) => {
1682
1730
  children
1683
1731
  ] });
1684
1732
  };
1685
- var TabsContext = React11.createContext(null);
1733
+ var TabsContext = React20.createContext(null);
1686
1734
  function useTabsContext() {
1687
- const ctx = React11.useContext(TabsContext);
1735
+ const ctx = React20.useContext(TabsContext);
1688
1736
  if (!ctx) {
1689
1737
  throw new Error(
1690
1738
  '[Bigtablet DS] <Tab>, <TabList>, <TabPanel>\uC740 \uBC18\uB4DC\uC2DC <Tabs> \uC548\uC5D0 \uC788\uC5B4\uC57C \uD569\uB2C8\uB2E4.\n\n\uC62C\uBC14\uB978 \uC0AC\uC6A9 \uC608:\n <Tabs defaultValue="a">\n <TabList>\n <Tab value="a">A</Tab>\n </TabList>\n <TabPanel value="a">...</TabPanel>\n </Tabs>'
@@ -1703,18 +1751,18 @@ var Tabs = ({
1703
1751
  ...props
1704
1752
  }) => {
1705
1753
  const isControlled = controlledValue !== void 0;
1706
- const [internalValue, setInternalValue] = React11.useState(defaultValue);
1754
+ const [internalValue, setInternalValue] = React20.useState(defaultValue);
1707
1755
  const value = isControlled ? controlledValue : internalValue;
1708
- const setValue = React11.useCallback(
1756
+ const setValue = React20.useCallback(
1709
1757
  (v) => {
1710
1758
  if (!isControlled) setInternalValue(v);
1711
1759
  onValueChange?.(v);
1712
1760
  },
1713
1761
  [isControlled, onValueChange]
1714
1762
  );
1715
- const orderRef = React11.useRef([]);
1716
- const [firstTabValue, setFirstTabValue] = React11.useState();
1717
- const registerTab = React11.useCallback((v) => {
1763
+ const orderRef = React20.useRef([]);
1764
+ const [firstTabValue, setFirstTabValue] = React20.useState();
1765
+ const registerTab = React20.useCallback((v) => {
1718
1766
  if (!orderRef.current.includes(v)) {
1719
1767
  orderRef.current = [...orderRef.current, v];
1720
1768
  setFirstTabValue(orderRef.current[0]);
@@ -1724,8 +1772,8 @@ var Tabs = ({
1724
1772
  setFirstTabValue(orderRef.current[0]);
1725
1773
  };
1726
1774
  }, []);
1727
- const idPrefix = React11.useId();
1728
- const ctx = React11.useMemo(
1775
+ const idPrefix = React20.useId();
1776
+ const ctx = React20.useMemo(
1729
1777
  () => ({ value, setValue, variant, size, idPrefix, registerTab, firstTabValue }),
1730
1778
  [value, setValue, variant, size, idPrefix, registerTab, firstTabValue]
1731
1779
  );
@@ -1740,9 +1788,9 @@ var Tabs = ({
1740
1788
  };
1741
1789
  var TabList = ({ ariaLabel, className, children, ...props }) => {
1742
1790
  const { variant } = useTabsContext();
1743
- const listRef = React11.useRef(null);
1744
- const [indicator, setIndicator] = React11.useState(null);
1745
- const [hasMounted, setHasMounted] = React11.useState(false);
1791
+ const listRef = React20.useRef(null);
1792
+ const [indicator, setIndicator] = React20.useState(null);
1793
+ const [hasMounted, setHasMounted] = React20.useState(false);
1746
1794
  useSafeLayoutEffect(() => {
1747
1795
  const list = listRef.current;
1748
1796
  if (!list) return;
@@ -1760,7 +1808,9 @@ var TabList = ({ ariaLabel, className, children, ...props }) => {
1760
1808
  mo.observe(list, {
1761
1809
  subtree: true,
1762
1810
  attributes: true,
1763
- attributeFilter: ["aria-selected"]
1811
+ attributeFilter: ["aria-selected"],
1812
+ childList: true,
1813
+ characterData: true
1764
1814
  });
1765
1815
  const ro = typeof ResizeObserver !== "undefined" ? new ResizeObserver(update) : null;
1766
1816
  ro?.observe(list);
@@ -1805,7 +1855,7 @@ var Tab = ({ value, className, children, onClick, onKeyDown, ...props }) => {
1805
1855
  const panelId = `${ctx.idPrefix}-panel-${value}`;
1806
1856
  const tabId = `${ctx.idPrefix}-tab-${value}`;
1807
1857
  const { registerTab } = ctx;
1808
- React11.useEffect(() => registerTab(value), [registerTab, value]);
1858
+ React20.useEffect(() => registerTab(value), [registerTab, value]);
1809
1859
  const handleClick = (e) => {
1810
1860
  ctx.setValue(value);
1811
1861
  onClick?.(e);
@@ -1891,15 +1941,15 @@ var Popover = ({
1891
1941
  className
1892
1942
  }) => {
1893
1943
  const isControlled = openProp !== void 0;
1894
- const [internalOpen, setInternalOpen] = React11.useState(defaultOpen);
1944
+ const [internalOpen, setInternalOpen] = React20.useState(defaultOpen);
1895
1945
  const open = isControlled ? openProp : internalOpen;
1896
- const [shouldRender, setShouldRender] = React11.useState(open ?? false);
1946
+ const [shouldRender, setShouldRender] = React20.useState(open ?? false);
1897
1947
  if (open && !shouldRender) setShouldRender(true);
1898
- const wrapperRef = React11.useRef(null);
1899
- const positionRef = React11.useRef(null);
1900
- const popoverRef = React11.useRef(null);
1901
- const popoverId = React11.useId();
1902
- const setOpen = React11.useCallback(
1948
+ const wrapperRef = React20.useRef(null);
1949
+ const positionRef = React20.useRef(null);
1950
+ const popoverRef = React20.useRef(null);
1951
+ const popoverId = React20.useId();
1952
+ const setOpen = React20.useCallback(
1903
1953
  (next) => {
1904
1954
  if (!isControlled) setInternalOpen(next);
1905
1955
  onOpenChange?.(next);
@@ -1932,7 +1982,7 @@ var Popover = ({
1932
1982
  onExitComplete: () => setShouldRender(false)
1933
1983
  });
1934
1984
  useFocusTrap(popoverRef, open);
1935
- React11.useEffect(() => {
1985
+ React20.useEffect(() => {
1936
1986
  if (!open) return;
1937
1987
  const handleClick = (e) => {
1938
1988
  const target = e.target;
@@ -1946,7 +1996,7 @@ var Popover = ({
1946
1996
  useOverlayEscape(open, () => {
1947
1997
  setOpen(false);
1948
1998
  });
1949
- const triggerWithProps = React11.cloneElement(
1999
+ const triggerWithProps = React20.cloneElement(
1950
2000
  trigger,
1951
2001
  {
1952
2002
  onClick: (e) => {
@@ -2005,30 +2055,30 @@ var Tooltip = ({
2005
2055
  disabled = false,
2006
2056
  children
2007
2057
  }) => {
2008
- const [open, setOpen] = React11.useState(false);
2009
- const [shouldRender, setShouldRender] = React11.useState(false);
2058
+ const [open, setOpen] = React20.useState(false);
2059
+ const [shouldRender, setShouldRender] = React20.useState(false);
2010
2060
  if (open && !shouldRender) setShouldRender(true);
2011
- const timerRef = React11.useRef(null);
2012
- const tooltipId = React11.useId();
2013
- const wrapperRef = React11.useRef(null);
2014
- const positionRef = React11.useRef(null);
2061
+ const timerRef = React20.useRef(null);
2062
+ const tooltipId = React20.useId();
2063
+ const wrapperRef = React20.useRef(null);
2064
+ const positionRef = React20.useRef(null);
2015
2065
  const HIDE_DELAY = 120;
2016
- const show = React11.useCallback(() => {
2066
+ const show = React20.useCallback(() => {
2017
2067
  if (timerRef.current) clearTimeout(timerRef.current);
2018
2068
  timerRef.current = setTimeout(() => setOpen(true), delay);
2019
2069
  }, [delay]);
2020
- const hideNow = React11.useCallback(() => {
2070
+ const hideNow = React20.useCallback(() => {
2021
2071
  if (timerRef.current) clearTimeout(timerRef.current);
2022
2072
  setOpen(false);
2023
2073
  }, []);
2024
- const hide = React11.useCallback(() => {
2074
+ const hide = React20.useCallback(() => {
2025
2075
  if (timerRef.current) clearTimeout(timerRef.current);
2026
2076
  timerRef.current = setTimeout(() => setOpen(false), HIDE_DELAY);
2027
2077
  }, []);
2028
- const cancelHide = React11.useCallback(() => {
2078
+ const cancelHide = React20.useCallback(() => {
2029
2079
  if (timerRef.current) clearTimeout(timerRef.current);
2030
2080
  }, []);
2031
- React11.useEffect(() => {
2081
+ React20.useEffect(() => {
2032
2082
  return () => {
2033
2083
  if (timerRef.current) clearTimeout(timerRef.current);
2034
2084
  };
@@ -2042,7 +2092,7 @@ var Tooltip = ({
2042
2092
  gap: TOOLTIP_GAP,
2043
2093
  padding: 8
2044
2094
  });
2045
- React11.useEffect(() => {
2095
+ React20.useEffect(() => {
2046
2096
  if (open && pos.ready && pos.anchorHidden) hideNow();
2047
2097
  }, [open, pos.ready, pos.anchorHidden, hideNow]);
2048
2098
  const fromTransform = (() => {
@@ -2064,7 +2114,7 @@ var Tooltip = ({
2064
2114
  });
2065
2115
  const child = children;
2066
2116
  const childProps = child.props;
2067
- const trigger = React11.cloneElement(child, {
2117
+ const trigger = React20.cloneElement(child, {
2068
2118
  onMouseEnter: (e) => {
2069
2119
  childProps.onMouseEnter?.(e);
2070
2120
  show();
@@ -2639,11 +2689,34 @@ var Card = ({
2639
2689
  { card_bordered: bordered, card_interactive: interactive },
2640
2690
  className
2641
2691
  );
2642
- return /* @__PURE__ */ jsxs("div", { ref, className: cardClassName, ...props, children: [
2643
- heading ? /* @__PURE__ */ jsx(HeadingTag, { className: "card_title", children: heading }) : null,
2644
- /* @__PURE__ */ jsx("div", { className: "card_body", children }),
2645
- footer ? /* @__PURE__ */ jsx("div", { className: cn("card_footer", `card_footer_${footerAlign}`), children: footer }) : null
2646
- ] });
2692
+ const resolvedRole = props.role ?? (props.onClick ? "button" : void 0);
2693
+ return (
2694
+ // biome-ignore lint/a11y/noStaticElementInteractions: onClick 이 있을 때만 role=button + tabIndex 를 붙인다 (ListItem 과 같은 규칙)
2695
+ /* @__PURE__ */ jsxs(
2696
+ "div",
2697
+ {
2698
+ ref,
2699
+ className: cardClassName,
2700
+ role: resolvedRole,
2701
+ tabIndex: props.onClick ? 0 : void 0,
2702
+ ...props,
2703
+ onKeyDown: (e) => {
2704
+ props.onKeyDown?.(e);
2705
+ if (!props.onClick || e.defaultPrevented || e.repeat) return;
2706
+ const activates = e.key === "Enter" || e.key === " " && resolvedRole === "button";
2707
+ if (activates) {
2708
+ e.preventDefault();
2709
+ e.currentTarget.click();
2710
+ }
2711
+ },
2712
+ children: [
2713
+ heading ? /* @__PURE__ */ jsx(HeadingTag, { className: "card_title", children: heading }) : null,
2714
+ /* @__PURE__ */ jsx("div", { className: "card_body", children }),
2715
+ footer ? /* @__PURE__ */ jsx("div", { className: cn("card_footer", `card_footer_${footerAlign}`), children: footer }) : null
2716
+ ]
2717
+ }
2718
+ )
2719
+ );
2647
2720
  };
2648
2721
  var CheckIcon = () => /* @__PURE__ */ jsx(
2649
2722
  "svg",
@@ -2903,20 +2976,18 @@ var TextField = ({
2903
2976
  const clearLabel = clearLabelProp ?? t("textField.clear");
2904
2977
  const generatedId = useId();
2905
2978
  const field = useFieldControl();
2906
- const inputId = id ?? field?.inputId ?? generatedId;
2907
- const helperId = supportingText ? `${inputId}-help` : void 0;
2908
- const describedBy = field?.describedBy ?? helperId;
2979
+ const inputId = field?.inputId ?? id ?? generatedId;
2980
+ const helperId = supportingText ? `${generatedId}-help` : void 0;
2981
+ const describedBy = [field?.describedBy, helperId, props["aria-describedby"]].filter(Boolean).join(" ") || void 0;
2909
2982
  const isControlled = value !== void 0;
2910
2983
  const applyTransform = (nextValue) => transformValue ? transformValue(nextValue) : nextValue;
2911
2984
  const [innerValue, setInnerValue] = useState(() => applyTransform(value ?? defaultValue ?? ""));
2912
2985
  const isComposingRef = useRef(false);
2913
2986
  const lastEmittedValueRef = useRef(innerValue);
2914
- const [prevValue, setPrevValue] = useState(value);
2915
- if (isControlled && value !== prevValue && !isComposingRef.current) {
2916
- setPrevValue(value);
2917
- const nextValue = applyTransform(value ?? "");
2918
- setInnerValue(nextValue);
2919
- lastEmittedValueRef.current = nextValue;
2987
+ const nextControlledValue = applyTransform(value ?? "");
2988
+ if (isControlled && !isComposingRef.current && nextControlledValue !== innerValue) {
2989
+ setInnerValue(nextControlledValue);
2990
+ lastEmittedValueRef.current = nextControlledValue;
2920
2991
  }
2921
2992
  const emit = useCallback(
2922
2993
  (nextValue) => {
@@ -2988,14 +3059,14 @@ var TextField = ({
2988
3059
  children: /* @__PURE__ */ jsx(
2989
3060
  "input",
2990
3061
  {
3062
+ ...props,
2991
3063
  id: inputId,
2992
3064
  ref,
2993
3065
  className: cn("text_field_input", identifier && "text_field_input_identifier"),
2994
- "aria-invalid": isError,
3066
+ "aria-invalid": field ? isError : props["aria-invalid"] ?? isError,
2995
3067
  "aria-describedby": describedBy,
2996
- "aria-required": field?.required || void 0,
2997
- "aria-label": !showLabel ? label : void 0,
2998
- ...props,
3068
+ "aria-required": field ? field.required || void 0 : props["aria-required"],
3069
+ "aria-label": (!showLabel ? label : void 0) ?? props["aria-label"],
2999
3070
  type: resolvedType,
3000
3071
  value: innerValue,
3001
3072
  onCompositionStart: () => {
@@ -3141,7 +3212,7 @@ var Pagination = ({
3141
3212
  const emit = onPageChange ?? onChange;
3142
3213
  const prevDisabled = page <= 1;
3143
3214
  const nextDisabled = page >= totalPages;
3144
- const items = React11.useMemo(() => getPaginationItems(page, totalPages), [page, totalPages]);
3215
+ const items = React20.useMemo(() => getPaginationItems(page, totalPages), [page, totalPages]);
3145
3216
  return /* @__PURE__ */ jsxs("nav", { className: "pagination", "aria-label": navLabel, children: [
3146
3217
  /* @__PURE__ */ jsx(
3147
3218
  "button",
@@ -3221,12 +3292,12 @@ var Checkbox = ({
3221
3292
  ref,
3222
3293
  ...props
3223
3294
  }) => {
3224
- const inputRef = React11.useRef(null);
3225
- React11.useImperativeHandle(
3295
+ const inputRef = React20.useRef(null);
3296
+ React20.useImperativeHandle(
3226
3297
  ref,
3227
3298
  () => inputRef.current
3228
3299
  );
3229
- React11.useEffect(() => {
3300
+ React20.useEffect(() => {
3230
3301
  if (!inputRef.current) return;
3231
3302
  inputRef.current.indeterminate = Boolean(indeterminate);
3232
3303
  }, [indeterminate]);
@@ -3247,8 +3318,8 @@ var Checkbox = ({
3247
3318
  className: "checkbox_input",
3248
3319
  id: field?.inputId ?? props.id,
3249
3320
  "aria-describedby": field?.describedBy ?? props["aria-describedby"],
3250
- "aria-required": field?.required || void 0,
3251
- "aria-invalid": error || void 0
3321
+ "aria-required": field ? field.required || void 0 : props["aria-required"],
3322
+ "aria-invalid": error || (field ? field.invalid || void 0 : props["aria-invalid"])
3252
3323
  }
3253
3324
  ),
3254
3325
  /* @__PURE__ */ jsx("span", { className: "checkbox_state_layer", "aria-hidden": "true", children: /* @__PURE__ */ jsx("span", { className: "checkbox_icon" }) }),
@@ -3274,6 +3345,7 @@ var Table = ({
3274
3345
  onSortChange,
3275
3346
  selectAllAriaLabel: selectAllAriaLabelProp,
3276
3347
  selectRowAriaLabel: selectRowAriaLabelProp,
3348
+ rowIndexOffset = 0,
3277
3349
  selectable = false,
3278
3350
  rowKey,
3279
3351
  selectedKeys,
@@ -3284,17 +3356,45 @@ var Table = ({
3284
3356
  const emptyMessage = emptyMessageProp === void 0 ? t("table.empty") : emptyMessageProp;
3285
3357
  const selectAllAriaLabel = selectAllAriaLabelProp ?? t("table.selectAll");
3286
3358
  const selectRowAriaLabel = selectRowAriaLabelProp ?? ((index) => t("table.selectRow", { index: index + 1 }));
3359
+ const toGlobalIndex = (rowIndex) => rowIndex + rowIndexOffset;
3287
3360
  const wrapperClassName = cn(
3288
3361
  "table_wrapper",
3289
3362
  `table_size_${size}`,
3290
3363
  stickyHeader && "table_sticky_header",
3291
3364
  className
3292
3365
  );
3366
+ const wrapperRef = React20.useRef(null);
3367
+ useSafeLayoutEffect(() => {
3368
+ const el = wrapperRef.current;
3369
+ if (!el) return;
3370
+ const sync = () => {
3371
+ const scrolls = el.scrollWidth > el.clientWidth || el.scrollHeight > el.clientHeight;
3372
+ if (scrolls) el.setAttribute("tabindex", "0");
3373
+ else el.removeAttribute("tabindex");
3374
+ };
3375
+ sync();
3376
+ const resizeObserver = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(sync);
3377
+ resizeObserver?.observe(el);
3378
+ const mutationObserver = typeof MutationObserver === "undefined" ? null : new MutationObserver(() => {
3379
+ sync();
3380
+ });
3381
+ mutationObserver?.observe(el, {
3382
+ childList: true,
3383
+ subtree: true,
3384
+ characterData: true,
3385
+ attributes: true,
3386
+ attributeFilter: ["style", "class"]
3387
+ });
3388
+ return () => {
3389
+ resizeObserver?.disconnect();
3390
+ mutationObserver?.disconnect();
3391
+ };
3392
+ }, []);
3293
3393
  const isEmpty = !isLoading && data.length === 0;
3294
3394
  const getRowKey = (item, index) => rowKey?.(item) ?? String(index);
3295
3395
  const allRowKeys = selectable ? data.map((item, index) => getRowKey(item, index)) : [];
3296
- const rowClickHintId = React11.useId();
3297
- const selectedSet = React11.useMemo(() => new Set(selectedKeys ?? []), [selectedKeys]);
3396
+ const rowClickHintId = React20.useId();
3397
+ const selectedSet = React20.useMemo(() => new Set(selectedKeys ?? []), [selectedKeys]);
3298
3398
  const selectedCount = allRowKeys.filter((key) => selectedSet.has(key)).length;
3299
3399
  const isAllSelected = allRowKeys.length > 0 && selectedCount === allRowKeys.length;
3300
3400
  const isSomeSelected = selectedCount > 0 && !isAllSelected;
@@ -3312,7 +3412,7 @@ var Table = ({
3312
3412
  const next = sort?.key !== key ? { key, direction: "asc" } : sort.direction === "asc" ? { key, direction: "desc" } : void 0;
3313
3413
  onSortChange?.(next);
3314
3414
  };
3315
- return /* @__PURE__ */ jsxs("div", { className: wrapperClassName, children: [
3415
+ return /* @__PURE__ */ jsxs("div", { ref: wrapperRef, className: wrapperClassName, children: [
3316
3416
  /* @__PURE__ */ jsxs("table", { className: "table", "aria-label": ariaLabel, "aria-busy": isLoading || void 0, children: [
3317
3417
  /* @__PURE__ */ jsx("thead", { className: "table_thead", children: /* @__PURE__ */ jsxs("tr", { children: [
3318
3418
  selectable && /* @__PURE__ */ jsx("th", { scope: "col", className: "table_th table_th_checkbox", children: /* @__PURE__ */ jsx(
@@ -3425,7 +3525,7 @@ var Table = ({
3425
3525
  children: /* @__PURE__ */ jsx(
3426
3526
  Checkbox,
3427
3527
  {
3428
- "aria-label": selectRowAriaLabel(rowIndex),
3528
+ "aria-label": selectRowAriaLabel(toGlobalIndex(rowIndex)),
3429
3529
  checked: isSelected,
3430
3530
  onChange: () => handleToggleRow(rowIdentity)
3431
3531
  }
@@ -3484,6 +3584,18 @@ var DataView = ({
3484
3584
  const selectionBarId = useId();
3485
3585
  const selectable = !!selectionActions?.length;
3486
3586
  const rows = query.data ?? [];
3587
+ const hasPagination = !!pagination;
3588
+ const rowIndexOffset = pagination?.pageSize !== void 0 ? Math.max(0, (pagination.page - 1) * pagination.pageSize) : 0;
3589
+ const needsSelectionPrune = selectable && !hasPagination;
3590
+ const visibleKeySignature = needsSelectionPrune ? JSON.stringify(rows.map(rowKey)) : "";
3591
+ useEffect(() => {
3592
+ if (!needsSelectionPrune) return;
3593
+ const visible = new Set(rows.map(rowKey));
3594
+ setSelectedKeys((prev) => {
3595
+ const next = prev.filter((key) => visible.has(key));
3596
+ return next.length === prev.length ? prev : next;
3597
+ });
3598
+ }, [visibleKeySignature, needsSelectionPrune]);
3487
3599
  const showEmpty = !query.isLoading && !query.error && rows.length === 0;
3488
3600
  if (query.error) {
3489
3601
  return /* @__PURE__ */ jsx("div", { className: cn("data_view", className), ...props, children: /* @__PURE__ */ jsx(
@@ -3539,6 +3651,7 @@ var DataView = ({
3539
3651
  columns,
3540
3652
  data: rows,
3541
3653
  keyExtractor: rowKey,
3654
+ rowIndexOffset,
3542
3655
  isLoading: query.isLoading,
3543
3656
  sort,
3544
3657
  onSortChange,
@@ -3556,6 +3669,7 @@ var DataView = ({
3556
3669
  columns,
3557
3670
  data: rows,
3558
3671
  keyExtractor: rowKey,
3672
+ rowIndexOffset,
3559
3673
  isLoading: query.isLoading,
3560
3674
  sort,
3561
3675
  onSortChange,
@@ -3670,7 +3784,7 @@ var ListItem = ({
3670
3784
  className: rootClassName,
3671
3785
  onClick: disabled ? void 0 : onClick,
3672
3786
  onKeyDown: (e) => {
3673
- if (disabled || !onClick) return;
3787
+ if (disabled || !onClick || e.repeat) return;
3674
3788
  if (e.key === "Enter" || e.key === " ") {
3675
3789
  e.preventDefault();
3676
3790
  e.currentTarget.click();
@@ -3721,39 +3835,81 @@ var MediaCard = ({
3721
3835
  const isOverlay = imagePosition === "overlay";
3722
3836
  const cardStyle = isOverlay && aspectRatio ? { aspectRatio } : void 0;
3723
3837
  const wrapStyle = !isOverlay && aspectRatio ? { aspectRatio } : void 0;
3724
- return /* @__PURE__ */ jsxs("div", { className: cardClassName, style: cardStyle, ...props, children: [
3725
- /* @__PURE__ */ jsxs("div", { className: "media_card_image_wrap", style: wrapStyle, children: [
3726
- /* @__PURE__ */ jsx("img", { className: "media_card_image", src: image.src, alt: image.alt, loading: "lazy" }),
3727
- isOverlay && /* @__PURE__ */ jsx("div", { className: "media_card_overlay", "aria-hidden": "true" })
3728
- ] }),
3729
- /* @__PURE__ */ jsxs("div", { className: "media_card_body", children: [
3730
- eyebrow && /* @__PURE__ */ jsx("div", { className: "media_card_eyebrow", children: eyebrow }),
3731
- heading && /* @__PURE__ */ jsx(HeadingTag, { className: "media_card_heading", children: heading }),
3732
- children && /* @__PURE__ */ jsx("div", { className: "media_card_content", children }),
3733
- meta && /* @__PURE__ */ jsx("div", { className: "media_card_meta", children: meta })
3734
- ] })
3735
- ] });
3838
+ const resolvedRole = props.role ?? (props.onClick ? "button" : void 0);
3839
+ return (
3840
+ // biome-ignore lint/a11y/noStaticElementInteractions: onClick 이 있을 때만 role=button + tabIndex 를 붙인다 (ListItem 과 같은 규칙)
3841
+ /* @__PURE__ */ jsxs(
3842
+ "div",
3843
+ {
3844
+ className: cardClassName,
3845
+ style: cardStyle,
3846
+ role: resolvedRole,
3847
+ tabIndex: props.onClick ? 0 : void 0,
3848
+ ...props,
3849
+ onKeyDown: (e) => {
3850
+ props.onKeyDown?.(e);
3851
+ if (!props.onClick || e.defaultPrevented || e.repeat) return;
3852
+ const activates = e.key === "Enter" || e.key === " " && resolvedRole === "button";
3853
+ if (activates) {
3854
+ e.preventDefault();
3855
+ e.currentTarget.click();
3856
+ }
3857
+ },
3858
+ children: [
3859
+ /* @__PURE__ */ jsxs("div", { className: "media_card_image_wrap", style: wrapStyle, children: [
3860
+ /* @__PURE__ */ jsx("img", { className: "media_card_image", src: image.src, alt: image.alt, loading: "lazy" }),
3861
+ isOverlay && /* @__PURE__ */ jsx("div", { className: "media_card_overlay", "aria-hidden": "true" })
3862
+ ] }),
3863
+ /* @__PURE__ */ jsxs("div", { className: "media_card_body", children: [
3864
+ eyebrow && /* @__PURE__ */ jsx("div", { className: "media_card_eyebrow", children: eyebrow }),
3865
+ heading && /* @__PURE__ */ jsx(HeadingTag, { className: "media_card_heading", children: heading }),
3866
+ children && /* @__PURE__ */ jsx("div", { className: "media_card_content", children }),
3867
+ meta && /* @__PURE__ */ jsx("div", { className: "media_card_meta", children: meta })
3868
+ ] })
3869
+ ]
3870
+ }
3871
+ )
3872
+ );
3736
3873
  };
3737
3874
  var Prose = ({ size = "md", className, children, ref, ...props }) => {
3738
- const rootRef = React11.useRef(null);
3739
- React11.useImperativeHandle(ref, () => rootRef.current, []);
3875
+ const rootRef = React20.useRef(null);
3876
+ React20.useImperativeHandle(ref, () => rootRef.current, []);
3740
3877
  useSafeLayoutEffect(() => {
3741
3878
  const root = rootRef.current;
3742
3879
  if (!root) return;
3743
- const targets = Array.from(root.querySelectorAll("pre, table"));
3880
+ const hasResizeObserver = typeof ResizeObserver !== "undefined";
3881
+ const observed = /* @__PURE__ */ new Set();
3882
+ let resizeObserver = null;
3744
3883
  const sync = () => {
3884
+ const targets = new Set(root.querySelectorAll("pre, table"));
3885
+ for (const el of observed) {
3886
+ if (targets.has(el)) continue;
3887
+ resizeObserver?.unobserve(el);
3888
+ observed.delete(el);
3889
+ }
3745
3890
  for (const el of targets) {
3746
3891
  if (el.scrollWidth > el.clientWidth) el.setAttribute("tabindex", "0");
3747
3892
  else el.removeAttribute("tabindex");
3893
+ if (resizeObserver && !observed.has(el)) {
3894
+ resizeObserver.observe(el);
3895
+ observed.add(el);
3896
+ }
3748
3897
  }
3749
3898
  };
3899
+ if (hasResizeObserver) {
3900
+ resizeObserver = new ResizeObserver(sync);
3901
+ resizeObserver.observe(root);
3902
+ }
3750
3903
  sync();
3751
- if (typeof ResizeObserver === "undefined") return;
3752
- const observer = new ResizeObserver(sync);
3753
- observer.observe(root);
3754
- for (const el of targets) observer.observe(el);
3755
- return () => observer.disconnect();
3756
- }, [children]);
3904
+ const mutationObserver = typeof MutationObserver === "undefined" ? null : new MutationObserver(() => {
3905
+ sync();
3906
+ });
3907
+ mutationObserver?.observe(root, { childList: true, subtree: true, characterData: true });
3908
+ return () => {
3909
+ resizeObserver?.disconnect();
3910
+ mutationObserver?.disconnect();
3911
+ };
3912
+ }, []);
3757
3913
  return /* @__PURE__ */ jsx("div", { ref: rootRef, className: cn("prose", `prose_size_${size}`, className), ...props, children });
3758
3914
  };
3759
3915
  Prose.displayName = "Prose";
@@ -3781,6 +3937,9 @@ var AlertProvider = ({ children }) => {
3781
3937
  const handleClose = useCallback(() => {
3782
3938
  setAlertState((prev) => ({ ...prev, isOpen: false }));
3783
3939
  }, []);
3940
+ const handleExited = useCallback(() => {
3941
+ setAlertState((prev) => prev.isOpen ? prev : { isOpen: false });
3942
+ }, []);
3784
3943
  const handleConfirm = useCallback(() => {
3785
3944
  alertState.onConfirm?.();
3786
3945
  handleClose();
@@ -3797,7 +3956,8 @@ var AlertProvider = ({ children }) => {
3797
3956
  ...alertState,
3798
3957
  onConfirm: handleConfirm,
3799
3958
  onCancel: handleCancel,
3800
- onClose: handleClose
3959
+ onClose: handleClose,
3960
+ onExited: handleExited
3801
3961
  }
3802
3962
  )
3803
3963
  ] });
@@ -3816,15 +3976,17 @@ var AlertModal = ({
3816
3976
  closeOnOverlay = true,
3817
3977
  onConfirm,
3818
3978
  onCancel,
3819
- onClose
3979
+ onClose,
3980
+ onExited
3820
3981
  }) => {
3821
3982
  const t = useLocaleText();
3822
3983
  const confirmText = confirmTextProp ?? t("alert.confirm");
3823
3984
  const cancelText = cancelTextProp ?? t("alert.cancel");
3824
3985
  const dismiss = onCancel ?? onClose;
3825
- const panelRef = React11.useRef(null);
3826
- const titleId = React11.useId();
3827
- const messageId = React11.useId();
3986
+ const panelRef = React20.useRef(null);
3987
+ const pressedOverlayRef = React20.useRef(false);
3988
+ const titleId = React20.useId();
3989
+ const messageId = React20.useId();
3828
3990
  const [shouldRender, setShouldRender] = useState(isOpen);
3829
3991
  useFocusTrap(panelRef, isOpen);
3830
3992
  useOverlayEscape(isOpen, () => dismiss());
@@ -3836,7 +3998,9 @@ var AlertModal = ({
3836
3998
  immediate: reduced,
3837
3999
  config: OVERLAY_SPRING_CONFIG,
3838
4000
  onRest: (result) => {
3839
- if (!isOpen && result.finished) setShouldRender(false);
4001
+ if (isOpen || !result.finished) return;
4002
+ setShouldRender(false);
4003
+ onExited?.();
3840
4004
  }
3841
4005
  });
3842
4006
  const panelStyle = useSpring({
@@ -3848,7 +4012,7 @@ var AlertModal = ({
3848
4012
  immediate: reduced,
3849
4013
  config: OVERLAY_SPRING_CONFIG
3850
4014
  });
3851
- React11.useEffect(() => {
4015
+ React20.useEffect(() => {
3852
4016
  if (!shouldRender) return;
3853
4017
  lockBodyScroll();
3854
4018
  return () => {
@@ -3866,7 +4030,15 @@ var AlertModal = ({
3866
4030
  className: "alert_overlay",
3867
4031
  style: overlayStyle,
3868
4032
  role: "presentation",
3869
- onClick: () => closeOnOverlay && dismiss(),
4033
+ onPointerDown: (e) => {
4034
+ pressedOverlayRef.current = e.target === e.currentTarget;
4035
+ },
4036
+ onClick: (e) => {
4037
+ if (!closeOnOverlay) return;
4038
+ if (e.target !== e.currentTarget) return;
4039
+ if (!pressedOverlayRef.current) return;
4040
+ dismiss();
4041
+ },
3870
4042
  children: /* @__PURE__ */ jsxs(
3871
4043
  animated.div,
3872
4044
  {
@@ -3923,7 +4095,7 @@ var LinearProgress = ({
3923
4095
  {
3924
4096
  className: cn("linear_progress", className),
3925
4097
  role: "progressbar",
3926
- "aria-valuenow": currentStep,
4098
+ "aria-valuenow": clampedStep,
3927
4099
  "aria-valuemin": 0,
3928
4100
  "aria-valuemax": totalSteps,
3929
4101
  ...props,
@@ -3959,7 +4131,7 @@ var Spinner = ({ size = 24, ariaLabel: ariaLabelProp }) => {
3959
4131
  }
3960
4132
  );
3961
4133
  };
3962
- var ToastContext = React11.createContext(null);
4134
+ var ToastContext = React20.createContext(null);
3963
4135
  var VARIANT_ICONS = {
3964
4136
  success: /* @__PURE__ */ jsx(CheckCircle2, { size: iconSize.md }),
3965
4137
  error: /* @__PURE__ */ jsx(XCircle, { size: iconSize.md }),
@@ -3968,9 +4140,9 @@ var VARIANT_ICONS = {
3968
4140
  default: /* @__PURE__ */ jsx(Bell, { size: iconSize.md })
3969
4141
  };
3970
4142
  var ToastItemComponent = ({ item, onRemove, closeAriaLabel }) => {
3971
- const [visible, setVisible] = React11.useState(true);
3972
- const closingRef = React11.useRef(false);
3973
- const rootRef = React11.useRef(null);
4143
+ const [visible, setVisible] = React20.useState(true);
4144
+ const closingRef = React20.useRef(false);
4145
+ const rootRef = React20.useRef(null);
3974
4146
  const style = useSpringPresence({
3975
4147
  visible,
3976
4148
  from: "translateX(20px)",
@@ -3990,7 +4162,7 @@ var ToastItemComponent = ({ item, onRemove, closeAriaLabel }) => {
3990
4162
  onRemove(item.id);
3991
4163
  }
3992
4164
  });
3993
- const close = React11.useCallback(() => {
4165
+ const close = React20.useCallback(() => {
3994
4166
  if (closingRef.current) return;
3995
4167
  closingRef.current = true;
3996
4168
  setVisible(false);
@@ -4019,6 +4191,7 @@ var ToastItemComponent = ({ item, onRemove, closeAriaLabel }) => {
4019
4191
  }
4020
4192
  );
4021
4193
  };
4194
+ var toastSeq = 0;
4022
4195
  var ToastProvider = ({
4023
4196
  children,
4024
4197
  maxCount = 5,
@@ -4028,19 +4201,19 @@ var ToastProvider = ({
4028
4201
  const t = useLocaleText();
4029
4202
  const closeAriaLabel = closeAriaLabelProp ?? t("toast.close");
4030
4203
  const regionLabel = regionLabelProp ?? t("toast.region");
4031
- const [toasts, setToasts] = React11.useState([]);
4204
+ const [toasts, setToasts] = React20.useState([]);
4032
4205
  const isMounted = useIsMounted();
4033
- const addToast = React11.useCallback(
4206
+ const addToast = React20.useCallback(
4034
4207
  (message, variant, duration = 3e3) => {
4035
- const id = crypto.randomUUID();
4208
+ const id = `toast_${++toastSeq}`;
4036
4209
  setToasts((prev) => [{ id, message, variant, duration }, ...prev].slice(0, maxCount));
4037
4210
  },
4038
4211
  [maxCount]
4039
4212
  );
4040
- const removeToast = React11.useCallback((id) => {
4213
+ const removeToast = React20.useCallback((id) => {
4041
4214
  setToasts((prev) => prev.filter((t2) => t2.id !== id));
4042
4215
  }, []);
4043
- const contextValue = React11.useMemo(() => ({ addToast }), [addToast]);
4216
+ const contextValue = React20.useMemo(() => ({ addToast }), [addToast]);
4044
4217
  return /* @__PURE__ */ jsxs(ToastContext.Provider, { value: contextValue, children: [
4045
4218
  children,
4046
4219
  isMounted && createPortal(
@@ -4178,6 +4351,10 @@ var Combobox = ({
4178
4351
  });
4179
4352
  const { isOpen, setIsOpen, close, activeIndex, setActiveIndex } = popup;
4180
4353
  closeRef.current = close;
4354
+ const onSearchRef = useRef(onSearch);
4355
+ useEffect(() => {
4356
+ onSearchRef.current = onSearch;
4357
+ });
4181
4358
  useEffect(() => {
4182
4359
  if (!isOpen) return;
4183
4360
  if (query === "") {
@@ -4190,7 +4367,7 @@ var Combobox = ({
4190
4367
  const seq = ++requestSeq.current;
4191
4368
  setIsLoading(true);
4192
4369
  const timer = setTimeout(() => {
4193
- onSearch(query).then((result) => {
4370
+ onSearchRef.current(query).then((result) => {
4194
4371
  if (seq !== requestSeq.current) return;
4195
4372
  setOptions(result);
4196
4373
  setHasSearched(true);
@@ -4204,7 +4381,7 @@ var Combobox = ({
4204
4381
  });
4205
4382
  }, debounceMs);
4206
4383
  return () => clearTimeout(timer);
4207
- }, [query, isOpen, debounceMs, onSearch]);
4384
+ }, [query, isOpen, debounceMs]);
4208
4385
  const rootClassName = cn(
4209
4386
  "combobox",
4210
4387
  `combobox_size_${size}`,
@@ -4641,9 +4818,9 @@ var DatePicker = ({
4641
4818
  const minDateSrFormat = minDateSrFormatProp ?? t("datePicker.minDateSr");
4642
4819
  const selectableRangeUntilTodaySrText = selectableRangeUntilTodaySrTextProp ?? t("datePicker.rangeUntilTodaySr");
4643
4820
  const field = useFieldControl();
4644
- const groupId = React11.useId();
4645
- const constraintId = React11.useId();
4646
- const { todayYear, todayMonth, todayDay } = React11.useMemo(() => {
4821
+ const groupId = React20.useId();
4822
+ const constraintId = React20.useId();
4823
+ const { todayYear, todayMonth, todayDay } = React20.useMemo(() => {
4647
4824
  const now = /* @__PURE__ */ new Date();
4648
4825
  return {
4649
4826
  todayYear: now.getFullYear(),
@@ -4652,7 +4829,7 @@ var DatePicker = ({
4652
4829
  };
4653
4830
  }, []);
4654
4831
  const endYear = endYearProp ?? todayYear + 10;
4655
- const parsed = React11.useMemo(() => {
4832
+ const parsed = React20.useMemo(() => {
4656
4833
  if (!value) return { year: 0, month: 0, day: 0 };
4657
4834
  const [y, m, d] = value.split("-").map(Number);
4658
4835
  return {
@@ -4661,7 +4838,7 @@ var DatePicker = ({
4661
4838
  day: d || 0
4662
4839
  };
4663
4840
  }, [value]);
4664
- const min = React11.useMemo(() => {
4841
+ const min = React20.useMemo(() => {
4665
4842
  if (!minDate) return { year: 0, month: 0, day: 0 };
4666
4843
  const [y, m, d] = minDate.split("-").map(Number);
4667
4844
  return {
@@ -4674,56 +4851,79 @@ var DatePicker = ({
4674
4851
  const maxYear = selectableRange === "until-today" ? todayYear : endYear;
4675
4852
  const minMonth = min.year > 0 && year === min.year ? Math.min(12, Math.max(1, min.month)) : 1;
4676
4853
  const maxMonth = selectableRange === "until-today" && year === todayYear ? todayMonth : 12;
4677
- const minDay = Math.min(
4678
- 31,
4679
- Math.max(
4680
- 1,
4681
- min.year > 0 && min.month > 0 && year === min.year && month === min.month ? min.day : 1
4682
- )
4854
+ const dayBoundsFor = React20.useCallback(
4855
+ (yy, mm) => {
4856
+ if (!yy || !mm) return { min: 1, max: 31 };
4857
+ const daysInMonth = getDaysInMonth(yy, mm);
4858
+ const lo = min.year > 0 && min.month > 0 && yy === min.year && mm === min.month ? Math.min(daysInMonth, Math.max(1, min.day)) : 1;
4859
+ const hi = selectableRange === "until-today" && yy === todayYear && mm === todayMonth ? Math.min(daysInMonth, todayDay) : daysInMonth;
4860
+ return { min: lo, max: hi };
4861
+ },
4862
+ [min.year, min.month, min.day, selectableRange, todayYear, todayMonth, todayDay]
4683
4863
  );
4684
- const maxDay = React11.useMemo(() => {
4685
- if (!year || !month) return 31;
4686
- const daysInMonth = getDaysInMonth(year, month);
4687
- if (selectableRange === "until-today" && year === todayYear && month === todayMonth) {
4688
- return Math.min(daysInMonth, todayDay);
4689
- }
4690
- return daysInMonth;
4691
- }, [year, month, selectableRange, todayYear, todayMonth, todayDay]);
4864
+ const { min: minDay, max: maxDay } = React20.useMemo(
4865
+ () => dayBoundsFor(year, month),
4866
+ [dayBoundsFor, year, month]
4867
+ );
4868
+ const hasSelectableDay = maxDay >= minDay;
4692
4869
  const minYear = min.year > 0 ? Math.max(startYear, min.year) : startYear;
4693
- const yearOptions = React11.useMemo(
4694
- () => range2(minYear, Math.max(minYear, maxYear)).map((y) => ({
4870
+ const yearOptions = React20.useMemo(
4871
+ () => range2(minYear, maxYear).map((y) => ({
4695
4872
  value: String(y),
4696
4873
  label: String(y)
4697
4874
  })),
4698
4875
  [minYear, maxYear]
4699
4876
  );
4700
- const monthOptions = React11.useMemo(
4701
- () => range2(minMonth, Math.max(minMonth, maxMonth)).map((m) => ({
4877
+ const monthOptions = React20.useMemo(
4878
+ () => range2(minMonth, maxMonth).filter((m) => {
4879
+ const bounds = dayBoundsFor(year, m);
4880
+ return bounds.max >= bounds.min;
4881
+ }).map((m) => ({
4702
4882
  value: String(m),
4703
4883
  label: pad(m)
4704
4884
  })),
4705
- [minMonth, maxMonth]
4885
+ [minMonth, maxMonth, dayBoundsFor, year]
4706
4886
  );
4707
- const dayOptions = React11.useMemo(
4708
- () => range2(minDay, Math.max(minDay, maxDay)).map((d) => ({
4887
+ const dayOptions = React20.useMemo(
4888
+ () => hasSelectableDay ? range2(minDay, maxDay).map((d) => ({
4709
4889
  value: String(d),
4710
4890
  label: pad(d)
4711
- })),
4712
- [minDay, maxDay]
4891
+ })) : [],
4892
+ [minDay, maxDay, hasSelectableDay]
4893
+ );
4894
+ const withinRange = React20.useCallback(
4895
+ (yy, mm, dd) => {
4896
+ const point = yy * 1e4 + mm * 100 + dd;
4897
+ if (min.year > 0) {
4898
+ const floor = min.year * 1e4 + Math.max(1, min.month) * 100 + Math.max(1, min.day);
4899
+ if (point < floor) return false;
4900
+ }
4901
+ if (selectableRange === "until-today") {
4902
+ const ceiling = todayYear * 1e4 + todayMonth * 100 + todayDay;
4903
+ if (point > ceiling) return false;
4904
+ }
4905
+ return true;
4906
+ },
4907
+ [min.year, min.month, min.day, selectableRange, todayYear, todayMonth, todayDay]
4713
4908
  );
4714
- const emit = React11.useCallback(
4909
+ const emit = React20.useCallback(
4715
4910
  (yy, mm, dd) => {
4716
4911
  const cb = onValueChange ?? onChange;
4717
4912
  if (mode === "year-month") {
4913
+ const monthBounds = dayBoundsFor(yy, mm);
4914
+ if (monthBounds.max < monthBounds.min) return;
4718
4915
  cb?.(`${yy}-${pad(mm)}`);
4719
4916
  return;
4720
4917
  }
4721
- const safeDay = Math.min(dd ?? 1, getDaysInMonth(yy, mm));
4918
+ const bounds = dayBoundsFor(yy, mm);
4919
+ if (bounds.max < bounds.min) return;
4920
+ const safeDay = Math.min(Math.max(dd ?? bounds.min, bounds.min), bounds.max);
4921
+ if (!withinRange(yy, mm, safeDay)) return;
4722
4922
  cb?.(`${yy}-${pad(mm)}-${pad(safeDay)}`);
4723
4923
  },
4724
- [mode, onValueChange, onChange]
4924
+ [mode, onValueChange, onChange, dayBoundsFor, withinRange]
4725
4925
  );
4726
- const handleYearChange = React11.useCallback(
4926
+ const handleYearChange = React20.useCallback(
4727
4927
  (raw) => {
4728
4928
  if (!raw) return;
4729
4929
  const newYear = Number(raw);
@@ -4740,14 +4940,14 @@ var DatePicker = ({
4740
4940
  },
4741
4941
  [month, day, min.year, min.month, selectableRange, todayYear, todayMonth, emit]
4742
4942
  );
4743
- const handleMonthChange = React11.useCallback(
4943
+ const handleMonthChange = React20.useCallback(
4744
4944
  (raw) => {
4745
4945
  if (!raw || !year) return;
4746
4946
  emit(year, Number(raw), day || void 0);
4747
4947
  },
4748
4948
  [year, day, emit]
4749
4949
  );
4750
- const handleDayChange = React11.useCallback(
4950
+ const handleDayChange = React20.useCallback(
4751
4951
  (raw) => {
4752
4952
  if (!raw || !year || !month) return;
4753
4953
  emit(year, month, Number(raw));
@@ -4909,13 +5109,13 @@ var FileInput = ({
4909
5109
  }) => {
4910
5110
  const t = useLocaleText();
4911
5111
  const label = labelProp ?? t("fileInput.label");
4912
- const generatedInputId = React11.useId();
4913
- const helperId = React11.useId();
5112
+ const generatedInputId = React20.useId();
5113
+ const helperId = React20.useId();
4914
5114
  const field = useFieldControl();
4915
5115
  const inputId = field?.inputId ?? generatedInputId;
4916
- const inputRef = React11.useRef(null);
4917
- const [previewUrls, setPreviewUrls] = React11.useState([]);
4918
- const previewUrlsRef = React11.useRef([]);
5116
+ const inputRef = React20.useRef(null);
5117
+ const [previewUrls, setPreviewUrls] = React20.useState([]);
5118
+ const previewUrlsRef = React20.useRef([]);
4919
5119
  const isPreviewVariant = variant === "preview";
4920
5120
  const showPreview = isPreviewVariant || preview;
4921
5121
  const handleChange = (e) => {
@@ -4956,7 +5156,7 @@ var FileInput = ({
4956
5156
  }
4957
5157
  onFiles?.(null);
4958
5158
  };
4959
- React11.useEffect(() => {
5159
+ React20.useEffect(() => {
4960
5160
  return () => {
4961
5161
  for (const url of previewUrlsRef.current) {
4962
5162
  URL.revokeObjectURL(url);
@@ -4982,7 +5182,7 @@ var FileInput = ({
4982
5182
  className: "file_input_control",
4983
5183
  disabled,
4984
5184
  accept: isPreviewVariant ? accept ?? "image/*" : accept,
4985
- "aria-describedby": field?.describedBy ?? (supportingText ? helperId : void 0),
5185
+ "aria-describedby": [field?.describedBy, supportingText ? helperId : void 0].filter(Boolean).join(" ") || void 0,
4986
5186
  "aria-invalid": field?.invalid || void 0,
4987
5187
  onChange: handleChange
4988
5188
  }
@@ -5270,6 +5470,7 @@ function ImageCropper({
5270
5470
  "aria-labelledby": field?.labelId,
5271
5471
  "aria-label": field?.labelId ? void 0 : label,
5272
5472
  "aria-describedby": [field?.describedBy, hintId].filter(Boolean).join(" "),
5473
+ "aria-invalid": field?.invalid || void 0,
5273
5474
  tabIndex: imageSize ? 0 : -1,
5274
5475
  onPointerDown: handlePointerDown,
5275
5476
  onPointerMove: handlePointerMove,
@@ -5362,12 +5563,13 @@ var OtpInput = ({
5362
5563
  }) => {
5363
5564
  const t = useLocaleText();
5364
5565
  const ariaLabel = ariaLabelProp ?? t("otpInput.label");
5365
- const inputsRef = React11.useRef([]);
5366
- const isTypingRef = React11.useRef(false);
5367
- React11.useEffect(() => {
5566
+ const inputsRef = React20.useRef([]);
5567
+ const isTypingRef = React20.useRef(false);
5568
+ const typingTimerRef = React20.useRef(void 0);
5569
+ React20.useEffect(() => {
5368
5570
  if (autoFocus) inputsRef.current[0]?.focus();
5369
5571
  }, [autoFocus]);
5370
- const digits = React11.useMemo(() => {
5572
+ const digits = React20.useMemo(() => {
5371
5573
  const chars = value.split("").slice(0, length);
5372
5574
  while (chars.length < length) chars.push("");
5373
5575
  return chars;
@@ -5396,11 +5598,13 @@ var OtpInput = ({
5396
5598
  if (nextDigit && index < length - 1) {
5397
5599
  isTypingRef.current = true;
5398
5600
  focusInput(index + 1);
5399
- setTimeout(() => {
5601
+ clearTimeout(typingTimerRef.current);
5602
+ typingTimerRef.current = setTimeout(() => {
5400
5603
  isTypingRef.current = false;
5401
5604
  }, 50);
5402
5605
  }
5403
5606
  };
5607
+ React20.useEffect(() => () => clearTimeout(typingTimerRef.current), []);
5404
5608
  const handleFocus = (index) => {
5405
5609
  if (isTypingRef.current) return;
5406
5610
  const firstEmpty = digits.indexOf("");
@@ -5444,7 +5648,7 @@ var OtpInput = ({
5444
5648
  focusInput(nextIndex);
5445
5649
  };
5446
5650
  const rootClassName = cn("otp_input", className);
5447
- const supportingId = React11.useId();
5651
+ const supportingId = React20.useId();
5448
5652
  const field = useFieldControl();
5449
5653
  return (
5450
5654
  // biome-ignore lint/a11y/useSemanticElements: <fieldset> would force border/legend styles; role=group is the WAI-ARIA equivalent for OTP grouping
@@ -5475,7 +5679,7 @@ var OtpInput = ({
5475
5679
  disabled,
5476
5680
  "aria-label": t("otpInput.digit", { index: i + 1 }),
5477
5681
  "aria-invalid": error || field?.invalid || void 0,
5478
- "aria-describedby": field?.describedBy ?? (supportingText ? supportingId : void 0),
5682
+ "aria-describedby": [field?.describedBy, supportingText ? supportingId : void 0].filter(Boolean).join(" ") || void 0,
5479
5683
  className: cn(
5480
5684
  "otp_input_box",
5481
5685
  error && "otp_input_box_error",
@@ -5498,9 +5702,9 @@ var OtpInput = ({
5498
5702
  );
5499
5703
  };
5500
5704
  OtpInput.displayName = "OtpInput";
5501
- var RadioGroupContext = React11.createContext(null);
5705
+ var RadioGroupContext = React20.createContext(null);
5502
5706
  function useRadioGroupContext() {
5503
- return React11.useContext(RadioGroupContext);
5707
+ return React20.useContext(RadioGroupContext);
5504
5708
  }
5505
5709
  var RadioGroup = ({
5506
5710
  value: controlledValue,
@@ -5518,22 +5722,22 @@ var RadioGroup = ({
5518
5722
  ...props
5519
5723
  }) => {
5520
5724
  const isControlled = controlledValue !== void 0;
5521
- const [internalValue, setInternalValue] = React11.useState(defaultValue);
5725
+ const [internalValue, setInternalValue] = React20.useState(defaultValue);
5522
5726
  const value = isControlled ? controlledValue : internalValue;
5523
- const generatedName = React11.useId();
5727
+ const generatedName = React20.useId();
5524
5728
  const name = nameProp ?? generatedName;
5525
- const idPrefix = React11.useId();
5729
+ const idPrefix = React20.useId();
5526
5730
  const field = useFieldControl();
5527
5731
  const labelId = label ? `${idPrefix}-label` : void 0;
5528
5732
  const helperId = supportingText ? `${idPrefix}-help` : void 0;
5529
- const onChange = React11.useCallback(
5733
+ const onChange = React20.useCallback(
5530
5734
  (next) => {
5531
5735
  if (!isControlled) setInternalValue(next);
5532
5736
  onValueChange?.(next);
5533
5737
  },
5534
5738
  [isControlled, onValueChange]
5535
5739
  );
5536
- const ctx = React11.useMemo(
5740
+ const ctx = React20.useMemo(
5537
5741
  () => ({ name, value, onChange, size, disabled }),
5538
5742
  [name, value, onChange, size, disabled]
5539
5743
  );
@@ -5594,17 +5798,18 @@ var Radio = ({
5594
5798
  /* @__PURE__ */ jsx(
5595
5799
  "input",
5596
5800
  {
5801
+ ...props,
5597
5802
  ref,
5598
5803
  type: "radio",
5599
5804
  className: "radio_input",
5600
5805
  id: field?.inputId ?? props.id,
5601
5806
  "aria-describedby": field?.describedBy ?? props["aria-describedby"],
5807
+ "aria-invalid": field ? field.invalid || void 0 : props["aria-invalid"],
5602
5808
  value,
5603
5809
  name,
5604
5810
  disabled,
5605
5811
  checked: resolvedChecked,
5606
- onChange: handleChange,
5607
- ...props
5812
+ onChange: handleChange
5608
5813
  }
5609
5814
  ),
5610
5815
  /* @__PURE__ */ jsx("span", { className: "radio_state_layer", "aria-hidden": "true", children: /* @__PURE__ */ jsx("span", { className: "radio_dot" }) }),
@@ -5787,9 +5992,9 @@ var Textarea = ({
5787
5992
  }) => {
5788
5993
  const generatedId = useId();
5789
5994
  const field = useFieldControl();
5790
- const inputId = id ?? field?.inputId ?? generatedId;
5791
- const helperId = supportingText ? `${inputId}-help` : void 0;
5792
- const describedBy = field?.describedBy ?? helperId;
5995
+ const inputId = field?.inputId ?? id ?? generatedId;
5996
+ const helperId = supportingText ? `${generatedId}-help` : void 0;
5997
+ const describedBy = [field?.describedBy, helperId, props["aria-describedby"]].filter(Boolean).join(" ") || void 0;
5793
5998
  const isControlled = value !== void 0;
5794
5999
  const applyTransform = (nextValue) => transformValue ? transformValue(nextValue) : nextValue;
5795
6000
  const [innerValue, setInnerValue] = useState(() => applyTransform(value ?? defaultValue ?? ""));
@@ -5797,12 +6002,10 @@ var Textarea = ({
5797
6002
  const innerRef = useRef(null);
5798
6003
  const lastEmittedValueRef = useRef(innerValue);
5799
6004
  const autoGrow = minRows !== void 0 || maxRows !== void 0;
5800
- const [prevValue, setPrevValue] = useState(value);
5801
- if (isControlled && value !== prevValue && !isComposingRef.current) {
5802
- setPrevValue(value);
5803
- const nextValue = applyTransform(value ?? "");
5804
- setInnerValue(nextValue);
5805
- lastEmittedValueRef.current = nextValue;
6005
+ const nextControlledValue = applyTransform(value ?? "");
6006
+ if (isControlled && !isComposingRef.current && nextControlledValue !== innerValue) {
6007
+ setInnerValue(nextControlledValue);
6008
+ lastEmittedValueRef.current = nextControlledValue;
5806
6009
  }
5807
6010
  const setRefs = useCallback(
5808
6011
  (node) => {
@@ -5848,17 +6051,17 @@ var Textarea = ({
5848
6051
  /* @__PURE__ */ jsx("div", { className: "textarea_input_wrap", children: /* @__PURE__ */ jsx(
5849
6052
  "textarea",
5850
6053
  {
6054
+ ...props,
5851
6055
  id: inputId,
5852
6056
  ref: setRefs,
5853
6057
  className: "textarea_input",
5854
6058
  style: { resize: autoGrow ? "none" : resize },
5855
6059
  rows: autoGrow ? minRows ?? rows : rows,
5856
6060
  maxLength,
5857
- "aria-invalid": !!error || !!field?.invalid,
6061
+ "aria-invalid": field ? !!error || field.invalid : props["aria-invalid"] ?? !!error,
5858
6062
  "aria-describedby": describedBy,
5859
- "aria-required": field?.required || void 0,
5860
- "aria-label": !showLabel ? label : void 0,
5861
- ...props,
6063
+ "aria-required": field ? field.required || void 0 : props["aria-required"],
6064
+ "aria-label": (!showLabel ? label : void 0) ?? props["aria-label"],
5862
6065
  value: innerValue,
5863
6066
  onCompositionStart: () => {
5864
6067
  isComposingRef.current = true;
@@ -5913,14 +6116,14 @@ var TimePicker = ({
5913
6116
  const hourLabel = hourLabelProp ?? t("timePicker.hour");
5914
6117
  const minuteLabel = minuteLabelProp ?? t("timePicker.minute");
5915
6118
  const field = useFieldControl();
5916
- const groupId = React11.useId();
5917
- const constraintId = React11.useId();
6119
+ const groupId = React20.useId();
6120
+ const constraintId = React20.useId();
5918
6121
  const min = toMinutes(minTime) ?? 0;
5919
6122
  const max = toMinutes(maxTime) ?? 23 * 60 + 59;
5920
6123
  const parsed = toMinutes(value);
5921
6124
  const hour = parsed === null ? null : Math.floor(parsed / 60);
5922
6125
  const minute = parsed === null ? null : parsed % 60;
5923
- const hourOptions = React11.useMemo(() => {
6126
+ const hourOptions = React20.useMemo(() => {
5924
6127
  const first = Math.floor(min / 60);
5925
6128
  const last = Math.floor(max / 60);
5926
6129
  return Array.from({ length: Math.max(0, last - first + 1) }, (_, i) => {
@@ -5928,7 +6131,7 @@ var TimePicker = ({
5928
6131
  return { value: String(h), label: pad2(h) };
5929
6132
  });
5930
6133
  }, [min, max]);
5931
- const minuteOptions = React11.useMemo(() => {
6134
+ const minuteOptions = React20.useMemo(() => {
5932
6135
  if (hour === null) return [];
5933
6136
  const step = Math.max(1, Math.floor(minuteStep));
5934
6137
  return Array.from({ length: Math.ceil(60 / step) }, (_, i) => i * step).filter((m) => m < 60).filter((m) => hour * 60 + m >= min && hour * 60 + m <= max).map((m) => ({ value: String(m), label: pad2(m) }));
@@ -6015,7 +6218,7 @@ var Toggle = ({
6015
6218
  ...props
6016
6219
  }) => {
6017
6220
  const isControlled = checked !== void 0;
6018
- const [innerChecked, setInnerChecked] = React11.useState(!!defaultChecked);
6221
+ const [innerChecked, setInnerChecked] = React20.useState(!!defaultChecked);
6019
6222
  const isOn = isControlled ? !!checked : innerChecked;
6020
6223
  const handleToggle = (e) => {
6021
6224
  props.onClick?.(e);
@@ -6041,6 +6244,7 @@ var Toggle = ({
6041
6244
  "aria-checked": isOn,
6042
6245
  id: field?.inputId ?? props.id,
6043
6246
  "aria-describedby": field?.describedBy ?? props["aria-describedby"],
6247
+ "aria-invalid": field ? field.invalid || void 0 : props["aria-invalid"],
6044
6248
  "aria-labelledby": field?.labelId,
6045
6249
  "aria-label": field?.labelId ? void 0 : ariaLabel,
6046
6250
  disabled,
@@ -6092,26 +6296,30 @@ var Drawer = ({
6092
6296
  }) => {
6093
6297
  const t = useLocaleText();
6094
6298
  const closeLabel = closeLabelProp ?? t("drawer.close");
6095
- const lastContentRef = React11.useRef({ children, title, footer });
6299
+ const lastContentRef = React20.useRef({ children, title, footer });
6096
6300
  if (open) lastContentRef.current = { children, title, footer };
6097
6301
  const content = open ? { children, title, footer } : lastContentRef.current;
6098
6302
  const overlayDismissible = dismissible ?? closeOnOverlay;
6099
6303
  const escapeDismissible = dismissible ?? true;
6100
- const panelRef = React11.useRef(null);
6101
- const pressedOverlayRef = React11.useRef(false);
6102
- const titleId = React11.useId();
6103
- const [shouldRender, setShouldRender] = React11.useState(open);
6304
+ const panelRef = React20.useRef(null);
6305
+ const bodyRef = React20.useRef(null);
6306
+ const pressedOverlayRef = React20.useRef(false);
6307
+ const titleId = React20.useId();
6308
+ const [shouldRender, setShouldRender] = React20.useState(open);
6104
6309
  const reduced = useReducedMotion();
6105
6310
  const isMounted = useIsMounted();
6106
- useFocusTrap(panelRef, open && isMounted);
6311
+ useFocusTrap(panelRef, open && isMounted, { preferWithin: bodyRef });
6107
6312
  useOverlayEscape(open && isMounted, () => {
6108
6313
  if (escapeDismissible) onClose?.();
6109
6314
  });
6110
6315
  if (open && !shouldRender) setShouldRender(true);
6111
- const overlayStyle = useSpringPresence({
6112
- visible: open,
6113
- from: "translateY(0px)",
6114
- onExitComplete: () => {
6316
+ const overlayStyle = useSpring({
6317
+ ...springEnterFrom(reduced),
6318
+ to: { opacity: open ? 1 : 0 },
6319
+ immediate: reduced,
6320
+ config: OVERLAY_SPRING_CONFIG,
6321
+ onRest: (result) => {
6322
+ if (open || !result.finished) return;
6115
6323
  setShouldRender(false);
6116
6324
  onExited?.();
6117
6325
  }
@@ -6124,7 +6332,7 @@ var Drawer = ({
6124
6332
  immediate: reduced,
6125
6333
  config: { tension: 280, friction: 28, clamp: !open }
6126
6334
  });
6127
- React11.useEffect(() => {
6335
+ React20.useEffect(() => {
6128
6336
  if (!shouldRender) return;
6129
6337
  lockBodyScroll();
6130
6338
  return () => {
@@ -6171,7 +6379,7 @@ var Drawer = ({
6171
6379
  content.children && // 본문이 스크롤 컨테이너라 키보드로도 스크롤할 수 있어야 한다(axe
6172
6380
  // `scrollable-region-focusable`). 다만 초기 포커스 대상에서는 제외한다 - 안쪽에
6173
6381
  // 첫 입력이 있는데 빈 wrapper 에 포커스가 놓이면 열자마자 어디에 있는지 알 수 없다.
6174
- /* @__PURE__ */ jsx("div", { className: "drawer_body", tabIndex: 0, "data-focus-trap-skip-autofocus": "", children: content.children }),
6382
+ /* @__PURE__ */ jsx("div", { ref: bodyRef, className: "drawer_body", tabIndex: 0, "data-focus-trap-skip-autofocus": "", children: content.children }),
6175
6383
  content.footer && /* @__PURE__ */ jsx("div", { className: "drawer_footer", children: content.footer })
6176
6384
  ]
6177
6385
  }
@@ -6202,17 +6410,18 @@ var Modal = ({
6202
6410
  }) => {
6203
6411
  const t = useLocaleText();
6204
6412
  const closeLabel = closeLabelProp ?? t("modal.close");
6205
- const lastContentRef = React11.useRef({ children, title, description, footer });
6413
+ const lastContentRef = React20.useRef({ children, title, description, footer });
6206
6414
  if (open) lastContentRef.current = { children, title, description, footer };
6207
6415
  const content = open ? { children, title, description, footer } : lastContentRef.current;
6208
6416
  const overlayDismissible = dismissible ?? closeOnOverlay;
6209
6417
  const escapeDismissible = dismissible ?? true;
6210
- const panelRef = React11.useRef(null);
6211
- const pressedOverlayRef = React11.useRef(false);
6212
- const titleId = React11.useId();
6213
- const [shouldRender, setShouldRender] = React11.useState(open);
6418
+ const panelRef = React20.useRef(null);
6419
+ const bodyRef = React20.useRef(null);
6420
+ const pressedOverlayRef = React20.useRef(false);
6421
+ const titleId = React20.useId();
6422
+ const [shouldRender, setShouldRender] = React20.useState(open);
6214
6423
  const isMounted = useIsMounted();
6215
- useFocusTrap(panelRef, open && isMounted);
6424
+ useFocusTrap(panelRef, open && isMounted, { preferWithin: bodyRef });
6216
6425
  useOverlayEscape(open && isMounted, () => {
6217
6426
  if (escapeDismissible) onClose?.();
6218
6427
  });
@@ -6238,7 +6447,7 @@ var Modal = ({
6238
6447
  immediate: reduced,
6239
6448
  config: OVERLAY_SPRING_CONFIG
6240
6449
  });
6241
- React11.useEffect(() => {
6450
+ React20.useEffect(() => {
6242
6451
  if (!shouldRender) return;
6243
6452
  lockBodyScroll();
6244
6453
  return () => {
@@ -6290,7 +6499,7 @@ var Modal = ({
6290
6499
  // 스크롤 가능한 영역은 키보드로도 스크롤할 수 있어야 한다 (WCAG 2.1.1) - 포커스
6291
6500
  // 가능해야 화살표 키가 먹는다.
6292
6501
  // biome-ignore lint/a11y/noNoninteractiveTabindex: scrollable region needs keyboard scroll
6293
- /* @__PURE__ */ jsx("div", { className: "modal_body", tabIndex: 0, "data-focus-trap-skip-autofocus": "", children: content.children }),
6502
+ /* @__PURE__ */ jsx("div", { ref: bodyRef, className: "modal_body", tabIndex: 0, "data-focus-trap-skip-autofocus": "", children: content.children }),
6294
6503
  content.footer && /* @__PURE__ */ jsx("div", { className: cn("modal_footer", `modal_footer_${footerAlign}`), children: content.footer })
6295
6504
  ]
6296
6505
  }
@@ -6300,9 +6509,9 @@ var Modal = ({
6300
6509
  document.body
6301
6510
  );
6302
6511
  };
6303
- var ThemeContext = React11.createContext(null);
6512
+ var ThemeContext = React20.createContext(null);
6304
6513
  var useTheme = () => {
6305
- const ctx = React11.useContext(ThemeContext);
6514
+ const ctx = React20.useContext(ThemeContext);
6306
6515
  if (!ctx) {
6307
6516
  throw new Error(
6308
6517
  '[Bigtablet DS] useTheme\uB294 <ThemeProvider> \uC548\uC5D0\uC11C\uB9CC \uC0AC\uC6A9 \uAC00\uB2A5\uD569\uB2C8\uB2E4.\n\n\uC571 \uCD5C\uC0C1\uB2E8\uC5D0 <ThemeProvider>\uB85C \uAC10\uC2F8\uC8FC\uC138\uC694:\n <ThemeProvider mode="system">\n <YourApp />\n </ThemeProvider>'
@@ -6326,15 +6535,15 @@ var ThemeProvider = ({
6326
6535
  targetSelector,
6327
6536
  children
6328
6537
  }) => {
6329
- const [mode, setModeState] = React11.useState(defaultMode);
6330
- const [systemDark, setSystemDark] = React11.useState(false);
6331
- React11.useEffect(() => {
6538
+ const [mode, setModeState] = React20.useState(defaultMode);
6539
+ const [systemDark, setSystemDark] = React20.useState(false);
6540
+ React20.useEffect(() => {
6332
6541
  setModeState(readStored(storageKey) ?? defaultMode);
6333
6542
  if (isClient) {
6334
6543
  setSystemDark(window.matchMedia("(prefers-color-scheme: dark)").matches);
6335
6544
  }
6336
6545
  }, [storageKey, defaultMode]);
6337
- React11.useEffect(() => {
6546
+ React20.useEffect(() => {
6338
6547
  if (!isClient) return;
6339
6548
  const mq = window.matchMedia("(prefers-color-scheme: dark)");
6340
6549
  const handler = (e) => setSystemDark(e.matches);
@@ -6342,7 +6551,7 @@ var ThemeProvider = ({
6342
6551
  return () => mq.removeEventListener("change", handler);
6343
6552
  }, []);
6344
6553
  const resolved = mode === "system" ? systemDark ? "dark" : "light" : mode;
6345
- React11.useEffect(() => {
6554
+ React20.useEffect(() => {
6346
6555
  if (!isClient) return;
6347
6556
  const target = targetSelector ? document.querySelector(targetSelector) : document.documentElement;
6348
6557
  if (!target) return;
@@ -6352,7 +6561,7 @@ var ThemeProvider = ({
6352
6561
  target.setAttribute("data-theme", mode);
6353
6562
  }
6354
6563
  }, [mode, targetSelector]);
6355
- const setMode = React11.useCallback(
6564
+ const setMode = React20.useCallback(
6356
6565
  (next) => {
6357
6566
  setModeState(next);
6358
6567
  if (storageKey && isClient) {
@@ -6364,7 +6573,7 @@ var ThemeProvider = ({
6364
6573
  },
6365
6574
  [storageKey]
6366
6575
  );
6367
- const value = React11.useMemo(
6576
+ const value = React20.useMemo(
6368
6577
  () => ({ mode, resolved, setMode }),
6369
6578
  [mode, resolved, setMode]
6370
6579
  );