@bigtablet/design-system 3.30.2 → 3.32.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,9 +1,9 @@
1
1
  "use client";
2
2
  import './index.css';
3
- import * as React21 from 'react';
3
+ import * as React22 from 'react';
4
4
  import { createContext, useState, useRef, useCallback, useEffect, useMemo, useContext, useId, Fragment as Fragment$1, useImperativeHandle, useLayoutEffect } from 'react';
5
5
  import { useSpring, animated } from '@react-spring/web';
6
- import { ChevronDown, ChevronRight, Globe, ChevronLeft, Check, EyeOff, Eye, ArrowUp, ArrowDown, ArrowUpDown, Search, XCircle, AlertTriangle, CheckCircle2, Info, Bell, Calendar, Image, X, TriangleAlert } from 'lucide-react';
6
+ import { ChevronDown, XCircle, AlertTriangle, CheckCircle2, Info, X, ChevronRight, Globe, ChevronLeft, Check, EyeOff, Eye, ArrowUp, ArrowDown, ArrowUpDown, Search, Bell, Calendar, Image, Copy, TriangleAlert } from 'lucide-react';
7
7
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
8
  import { createPortal } from 'react-dom';
9
9
 
@@ -81,11 +81,11 @@ function registerOverlay(onEscape) {
81
81
  };
82
82
  }
83
83
  function useOverlayEscape(active, onEscape) {
84
- const handlerRef = React21.useRef(onEscape);
85
- React21.useEffect(() => {
84
+ const handlerRef = React22.useRef(onEscape);
85
+ React22.useEffect(() => {
86
86
  handlerRef.current = onEscape;
87
87
  });
88
- React21.useEffect(() => {
88
+ React22.useEffect(() => {
89
89
  if (!active) return;
90
90
  return registerOverlay(() => handlerRef.current());
91
91
  }, [active]);
@@ -302,7 +302,7 @@ function useAnchoredPosition({
302
302
  gap,
303
303
  padding
304
304
  }) {
305
- const [state, setState] = React21.useState({
305
+ const [state, setState] = React22.useState({
306
306
  x: 0,
307
307
  y: 0,
308
308
  placement,
@@ -362,6 +362,113 @@ function useAnchoredPosition({
362
362
  }, [open, placement, align, gap, padding, anchorRef, floatingRef]);
363
363
  return state;
364
364
  }
365
+ async function copyText(text) {
366
+ let apiError;
367
+ if (typeof navigator !== "undefined" && navigator.clipboard?.writeText) {
368
+ try {
369
+ await navigator.clipboard.writeText(text);
370
+ return;
371
+ } catch (error) {
372
+ apiError = error;
373
+ }
374
+ }
375
+ if (typeof document === "undefined") {
376
+ throw apiError ?? new Error("Clipboard is not available");
377
+ }
378
+ if (!execCopy(text)) {
379
+ throw apiError ?? new Error("Copy command was rejected");
380
+ }
381
+ }
382
+ function execCopy(text) {
383
+ const active = document.activeElement;
384
+ const selection = document.getSelection();
385
+ const ranges = selection ? (
386
+ // 복제해 둔다 - 스펙상 getRangeAt 은 선택에 묶인 라이브 Range 라 엔진에 따라 select() 때 같이 바뀐다
387
+ Array.from({ length: selection.rangeCount }, (_, i) => selection.getRangeAt(i).cloneRange())
388
+ ) : [];
389
+ const textarea = document.createElement("textarea");
390
+ textarea.value = text;
391
+ textarea.setAttribute("readonly", "");
392
+ textarea.style.cssText = "position:fixed;top:0;left:-9999px;opacity:0;font-size:12pt";
393
+ document.body.appendChild(textarea);
394
+ let ok = false;
395
+ try {
396
+ textarea.select();
397
+ try {
398
+ textarea.setSelectionRange(0, text.length);
399
+ } catch {
400
+ }
401
+ ok = document.execCommand("copy");
402
+ } catch {
403
+ ok = false;
404
+ } finally {
405
+ textarea.remove();
406
+ active?.focus?.({ preventScroll: true });
407
+ if (selection) {
408
+ selection.removeAllRanges();
409
+ for (const range3 of ranges) selection.addRange(range3);
410
+ }
411
+ }
412
+ return ok;
413
+ }
414
+ function useClipboard({
415
+ resetAfter = 2e3,
416
+ onCopy,
417
+ onError
418
+ } = {}) {
419
+ const callbacks = React22.useRef({ onCopy, onError });
420
+ callbacks.current = { onCopy, onError };
421
+ const [status, setStatus] = React22.useState("idle");
422
+ const [error, setError] = React22.useState(null);
423
+ const timer = React22.useRef(void 0);
424
+ const seq = React22.useRef(0);
425
+ const alive = React22.useRef(true);
426
+ React22.useEffect(() => {
427
+ alive.current = true;
428
+ return () => {
429
+ alive.current = false;
430
+ clearTimeout(timer.current);
431
+ };
432
+ }, []);
433
+ const reset = React22.useCallback(() => {
434
+ seq.current++;
435
+ clearTimeout(timer.current);
436
+ setStatus("idle");
437
+ setError(null);
438
+ }, []);
439
+ const copy = React22.useCallback(
440
+ async (text) => {
441
+ const id = ++seq.current;
442
+ clearTimeout(timer.current);
443
+ setStatus("copying");
444
+ setError(null);
445
+ let ok = true;
446
+ let failure = null;
447
+ let value = "";
448
+ try {
449
+ value = typeof text === "function" ? text() : text;
450
+ await copyText(value);
451
+ } catch (e) {
452
+ ok = false;
453
+ failure = e;
454
+ }
455
+ if (!alive.current || id !== seq.current) return ok;
456
+ if (ok) callbacks.current.onCopy?.(value);
457
+ else callbacks.current.onError?.(failure);
458
+ setStatus(ok ? "copied" : "error");
459
+ setError(failure);
460
+ if (resetAfter > 0) {
461
+ timer.current = setTimeout(() => {
462
+ setStatus("idle");
463
+ setError(null);
464
+ }, resetAfter);
465
+ }
466
+ return ok;
467
+ },
468
+ [resetAfter]
469
+ );
470
+ return { copy, status, error, reset };
471
+ }
365
472
  var SKIP_AUTOFOCUS_ATTR = "data-focus-trap-skip-autofocus";
366
473
  var FOCUSABLE_SELECTORS = [
367
474
  "a[href]",
@@ -372,8 +479,8 @@ var FOCUSABLE_SELECTORS = [
372
479
  '[tabindex]:not([tabindex="-1"])'
373
480
  ].join(", ");
374
481
  function useFocusTrap(containerRef, isActive, options) {
375
- const previousActiveElement = React21.useRef(null);
376
- React21.useEffect(() => {
482
+ const previousActiveElement = React22.useRef(null);
483
+ React22.useEffect(() => {
377
484
  if (!isActive) return;
378
485
  const container = containerRef.current;
379
486
  if (!container) return;
@@ -431,8 +538,8 @@ function useFocusTrap(containerRef, isActive, options) {
431
538
  }, [isActive, containerRef]);
432
539
  }
433
540
  function useIsMounted() {
434
- const [mounted, setMounted] = React21.useState(false);
435
- React21.useEffect(() => {
541
+ const [mounted, setMounted] = React22.useState(false);
542
+ React22.useEffect(() => {
436
543
  setMounted(true);
437
544
  }, []);
438
545
  return mounted;
@@ -466,13 +573,13 @@ function getServerSnapshot() {
466
573
  return false;
467
574
  }
468
575
  function useReducedMotion() {
469
- return React21.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
576
+ return React22.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
470
577
  }
471
578
  function useSpringHover({
472
579
  scale = 1.02,
473
580
  lift = -2
474
581
  } = {}) {
475
- const [hovered, setHovered] = React21.useState(false);
582
+ const [hovered, setHovered] = React22.useState(false);
476
583
  const reduced = useReducedMotion();
477
584
  const style = useSpring({
478
585
  transform: hovered ? `translateY(${lift}px) scale(${scale})` : "translateY(0px) scale(1)",
@@ -746,9 +853,9 @@ var Accordion = ({
746
853
  ...props
747
854
  }) => {
748
855
  const isControlled = controlledKeys !== void 0;
749
- const [internalKeys, setInternalKeys] = React21.useState(defaultOpenKeys);
856
+ const [internalKeys, setInternalKeys] = React22.useState(defaultOpenKeys);
750
857
  const open = isControlled ? controlledKeys ?? [] : internalKeys;
751
- const idPrefix = React21.useId();
858
+ const idPrefix = React22.useId();
752
859
  const toggle = (key) => {
753
860
  const isOpen = open.includes(key);
754
861
  const next = isOpen ? open.filter((k) => k !== key) : multiple ? [...open, key] : [key];
@@ -813,7 +920,7 @@ var Avatar = ({
813
920
  style,
814
921
  ...props
815
922
  }) => {
816
- const [failedSrc, setFailedSrc] = React21.useState(null);
923
+ const [failedSrc, setFailedSrc] = React22.useState(null);
817
924
  const showImage = src && failedSrc !== src;
818
925
  const initials = getInitials(name);
819
926
  return (
@@ -994,6 +1101,9 @@ var EmptyState = ({
994
1101
  // src/ui/system/locale-provider/messages.ts
995
1102
  var ko = {
996
1103
  "chip.remove": "{label} \uC81C\uAC70",
1104
+ "copyButton.copied": "\uBCF5\uC0AC\uB428",
1105
+ "copyButton.copy": "\uBCF5\uC0AC",
1106
+ "copyButton.failed": "\uBCF5\uC0AC\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4",
997
1107
  "dataView.clearSelection": "\uC120\uD0DD \uD574\uC81C",
998
1108
  "dataView.empty": "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4",
999
1109
  "dataView.errorTitle": "\uBD88\uB7EC\uC624\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4",
@@ -1007,6 +1117,7 @@ var ko = {
1007
1117
  "alert.cancel": "\uCDE8\uC18C",
1008
1118
  "alert.confirm": "\uD655\uC778",
1009
1119
  "errorState.title": "\uBB38\uC81C\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4",
1120
+ "inlineAlert.dismiss": "\uC54C\uB9BC \uB2EB\uAE30",
1010
1121
  "spinner.label": "\uB85C\uB529 \uC911",
1011
1122
  "toast.close": "\uB2EB\uAE30",
1012
1123
  "toast.region": "\uC54C\uB9BC",
@@ -1032,6 +1143,8 @@ var ko = {
1032
1143
  "dropdown.selectedSummary": "{count}\uAC1C \uC120\uD0DD",
1033
1144
  "fileInput.label": "\uD30C\uC77C \uC120\uD0DD",
1034
1145
  "fileInput.removeImage": "\uC774\uBBF8\uC9C0 \uC81C\uAC70",
1146
+ "filterBar.reset": "\uCD08\uAE30\uD654",
1147
+ "filterBar.submit": "\uAC80\uC0C9",
1035
1148
  "imageCropper.hint": "\uB4DC\uB798\uADF8(\uB610\uB294 \uBC29\uD5A5\uD0A4)\uB85C \uC704\uCE58, \uD720\xB7\uC2AC\uB77C\uC774\uB354\uB85C \uBC30\uC728\uC744 \uB9DE\uCD94\uC138\uC694.",
1036
1149
  "imageCropper.label": "\uC774\uBBF8\uC9C0 \uC704\uCE58\uC640 \uBC30\uC728 \uC870\uC815",
1037
1150
  "imageCropper.noPanHint": "\uC774\uBBF8\uC9C0\uAC00 \uBDF0\uD3EC\uD2B8\uB97C \uB531 \uCC44\uC6CC \uC774\uB3D9 \uC5EC\uC720\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.",
@@ -1065,6 +1178,9 @@ var ko = {
1065
1178
  };
1066
1179
  var en = {
1067
1180
  "chip.remove": "Remove {label}",
1181
+ "copyButton.copied": "Copied",
1182
+ "copyButton.copy": "Copy",
1183
+ "copyButton.failed": "Couldn't copy",
1068
1184
  "dataView.clearSelection": "Clear selection",
1069
1185
  "dataView.empty": "No data",
1070
1186
  "dataView.errorTitle": "Could not load",
@@ -1078,6 +1194,7 @@ var en = {
1078
1194
  "alert.cancel": "Cancel",
1079
1195
  "alert.confirm": "OK",
1080
1196
  "errorState.title": "Something went wrong",
1197
+ "inlineAlert.dismiss": "Dismiss",
1081
1198
  "spinner.label": "Loading",
1082
1199
  "toast.close": "Close",
1083
1200
  "toast.region": "Notifications",
@@ -1103,6 +1220,8 @@ var en = {
1103
1220
  "dropdown.selectedSummary": "{count} selected",
1104
1221
  "fileInput.label": "Choose file",
1105
1222
  "fileInput.removeImage": "Remove image",
1223
+ "filterBar.reset": "Reset",
1224
+ "filterBar.submit": "Search",
1106
1225
  "imageCropper.hint": "Drag (or use arrow keys) to move, wheel or slider to zoom.",
1107
1226
  "imageCropper.label": "Adjust image position and zoom",
1108
1227
  "imageCropper.noPanHint": "The image fills the viewport exactly, so there is no room to move it.",
@@ -1202,6 +1321,48 @@ var ErrorState = ({
1202
1321
  }
1203
1322
  );
1204
1323
  };
1324
+ var TONE_ICON = {
1325
+ neutral: Info,
1326
+ info: Info,
1327
+ success: CheckCircle2,
1328
+ warning: AlertTriangle,
1329
+ error: XCircle
1330
+ };
1331
+ var InlineAlert = ({
1332
+ tone = "info",
1333
+ title,
1334
+ children,
1335
+ icon,
1336
+ action,
1337
+ onDismiss,
1338
+ dismissLabel: dismissLabelProp,
1339
+ className,
1340
+ ...props
1341
+ }) => {
1342
+ const t = useLocaleText();
1343
+ const dismissLabel = dismissLabelProp ?? t("inlineAlert.dismiss");
1344
+ const ToneIcon = TONE_ICON[tone];
1345
+ const leading = icon === void 0 ? /* @__PURE__ */ jsx(ToneIcon, { size: iconSize.md }) : icon;
1346
+ return /* @__PURE__ */ jsxs("div", { className: cn("inline_alert", `inline_alert_tone_${tone}`, className), ...props, children: [
1347
+ leading != null && /* @__PURE__ */ jsx("span", { className: "inline_alert_icon", "aria-hidden": "true", children: leading }),
1348
+ /* @__PURE__ */ jsxs("div", { className: "inline_alert_content", children: [
1349
+ title != null && /* @__PURE__ */ jsx("div", { className: "inline_alert_title", children: title }),
1350
+ children != null && /* @__PURE__ */ jsx("div", { className: "inline_alert_description", children }),
1351
+ action != null && /* @__PURE__ */ jsx("div", { className: "inline_alert_action", children: action })
1352
+ ] }),
1353
+ onDismiss && /* @__PURE__ */ jsx(
1354
+ "button",
1355
+ {
1356
+ type: "button",
1357
+ className: "inline_alert_dismiss",
1358
+ "aria-label": dismissLabel,
1359
+ onClick: onDismiss,
1360
+ children: /* @__PURE__ */ jsx(X, { size: iconSize.sm, "aria-hidden": "true" })
1361
+ }
1362
+ )
1363
+ ] });
1364
+ };
1365
+ InlineAlert.displayName = "InlineAlert";
1205
1366
  var BottomNav = ({
1206
1367
  ariaLabel: ariaLabelProp,
1207
1368
  className,
@@ -1307,11 +1468,11 @@ var Breadcrumb = ({
1307
1468
  };
1308
1469
  var MENU_GAP = 4;
1309
1470
  var Menu = ({ items, trigger, align = "start" }) => {
1310
- const [open, setOpen] = React21.useState(false);
1311
- const wrapperRef = React21.useRef(null);
1312
- const menuRef = React21.useRef(null);
1313
- const itemRefs = React21.useRef([]);
1314
- const menuId = React21.useId();
1471
+ const [open, setOpen] = React22.useState(false);
1472
+ const wrapperRef = React22.useRef(null);
1473
+ const menuRef = React22.useRef(null);
1474
+ const itemRefs = React22.useRef([]);
1475
+ const menuId = React22.useId();
1315
1476
  const pos = useAnchoredPosition({
1316
1477
  open,
1317
1478
  anchorRef: wrapperRef,
@@ -1321,7 +1482,7 @@ var Menu = ({ items, trigger, align = "start" }) => {
1321
1482
  gap: MENU_GAP,
1322
1483
  padding: 8
1323
1484
  });
1324
- React21.useEffect(() => {
1485
+ React22.useEffect(() => {
1325
1486
  if (!open || !pos.ready || !pos.anchorHidden) return;
1326
1487
  const focusInMenu = !!menuRef.current?.contains(document.activeElement);
1327
1488
  setOpen(false);
@@ -1333,7 +1494,7 @@ var Menu = ({ items, trigger, align = "start" }) => {
1333
1494
  visible: open,
1334
1495
  from: pos.placement === "top" ? `translateY(${MENU_GAP}px)` : `translateY(-${MENU_GAP}px)`
1335
1496
  });
1336
- React21.useEffect(() => {
1497
+ React22.useEffect(() => {
1337
1498
  if (!open) return;
1338
1499
  const handleClick = (e) => {
1339
1500
  const target = e.target;
@@ -1350,7 +1511,7 @@ var Menu = ({ items, trigger, align = "start" }) => {
1350
1511
  document.removeEventListener("keydown", handleEsc);
1351
1512
  };
1352
1513
  }, [open]);
1353
- React21.useEffect(() => {
1514
+ React22.useEffect(() => {
1354
1515
  const active = document.activeElement;
1355
1516
  if (!open || active && itemRefs.current.includes(active)) return;
1356
1517
  const first = items.findIndex((it) => !it.disabled);
@@ -1399,7 +1560,7 @@ var Menu = ({ items, trigger, align = "start" }) => {
1399
1560
  break;
1400
1561
  }
1401
1562
  };
1402
- const triggerWithProps = React21.cloneElement(
1563
+ const triggerWithProps = React22.cloneElement(
1403
1564
  trigger,
1404
1565
  {
1405
1566
  onClick: () => setOpen((o) => !o),
@@ -1702,9 +1863,9 @@ var Sidebar = ({
1702
1863
  const t = useLocaleText();
1703
1864
  const toggleLabel = toggleLabelProp ?? t("sidebar.toggle");
1704
1865
  const isControlled = collapsedProp !== void 0;
1705
- const [internalCollapsed, setInternalCollapsed] = React21.useState(defaultCollapsed);
1866
+ const [internalCollapsed, setInternalCollapsed] = React22.useState(defaultCollapsed);
1706
1867
  const collapsed = isControlled ? collapsedProp : internalCollapsed;
1707
- const toggle = React21.useCallback(() => {
1868
+ const toggle = React22.useCallback(() => {
1708
1869
  const next = !collapsed;
1709
1870
  if (!isControlled) setInternalCollapsed(next);
1710
1871
  onCollapsedChange?.(next);
@@ -1855,9 +2016,9 @@ var Stepper = ({
1855
2016
  }) });
1856
2017
  };
1857
2018
  Stepper.displayName = "Stepper";
1858
- var TabsContext = React21.createContext(null);
2019
+ var TabsContext = React22.createContext(null);
1859
2020
  function useTabsContext() {
1860
- const ctx = React21.useContext(TabsContext);
2021
+ const ctx = React22.useContext(TabsContext);
1861
2022
  if (!ctx) {
1862
2023
  throw new Error(
1863
2024
  '[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>'
@@ -1876,18 +2037,18 @@ var Tabs = ({
1876
2037
  ...props
1877
2038
  }) => {
1878
2039
  const isControlled = controlledValue !== void 0;
1879
- const [internalValue, setInternalValue] = React21.useState(defaultValue);
2040
+ const [internalValue, setInternalValue] = React22.useState(defaultValue);
1880
2041
  const value = isControlled ? controlledValue : internalValue;
1881
- const setValue = React21.useCallback(
2042
+ const setValue = React22.useCallback(
1882
2043
  (v) => {
1883
2044
  if (!isControlled) setInternalValue(v);
1884
2045
  onValueChange?.(v);
1885
2046
  },
1886
2047
  [isControlled, onValueChange]
1887
2048
  );
1888
- const orderRef = React21.useRef([]);
1889
- const [firstTabValue, setFirstTabValue] = React21.useState();
1890
- const registerTab = React21.useCallback((v) => {
2049
+ const orderRef = React22.useRef([]);
2050
+ const [firstTabValue, setFirstTabValue] = React22.useState();
2051
+ const registerTab = React22.useCallback((v) => {
1891
2052
  if (!orderRef.current.includes(v)) {
1892
2053
  orderRef.current = [...orderRef.current, v];
1893
2054
  setFirstTabValue(orderRef.current[0]);
@@ -1897,8 +2058,8 @@ var Tabs = ({
1897
2058
  setFirstTabValue(orderRef.current[0]);
1898
2059
  };
1899
2060
  }, []);
1900
- const idPrefix = React21.useId();
1901
- const ctx = React21.useMemo(
2061
+ const idPrefix = React22.useId();
2062
+ const ctx = React22.useMemo(
1902
2063
  () => ({ value, setValue, variant, size, idPrefix, registerTab, firstTabValue }),
1903
2064
  [value, setValue, variant, size, idPrefix, registerTab, firstTabValue]
1904
2065
  );
@@ -1913,9 +2074,9 @@ var Tabs = ({
1913
2074
  };
1914
2075
  var TabList = ({ ariaLabel, className, children, ...props }) => {
1915
2076
  const { variant } = useTabsContext();
1916
- const listRef = React21.useRef(null);
1917
- const [indicator, setIndicator] = React21.useState(null);
1918
- const [hasMounted, setHasMounted] = React21.useState(false);
2077
+ const listRef = React22.useRef(null);
2078
+ const [indicator, setIndicator] = React22.useState(null);
2079
+ const [hasMounted, setHasMounted] = React22.useState(false);
1919
2080
  useSafeLayoutEffect(() => {
1920
2081
  const list = listRef.current;
1921
2082
  if (!list) return;
@@ -1980,7 +2141,7 @@ var Tab = ({ value, className, children, onClick, onKeyDown, ...props }) => {
1980
2141
  const panelId = `${ctx.idPrefix}-panel-${value}`;
1981
2142
  const tabId = `${ctx.idPrefix}-tab-${value}`;
1982
2143
  const { registerTab } = ctx;
1983
- React21.useEffect(() => registerTab(value), [registerTab, value]);
2144
+ React22.useEffect(() => registerTab(value), [registerTab, value]);
1984
2145
  const handleClick = (e) => {
1985
2146
  ctx.setValue(value);
1986
2147
  onClick?.(e);
@@ -2067,15 +2228,15 @@ var Popover = ({
2067
2228
  className
2068
2229
  }) => {
2069
2230
  const isControlled = openProp !== void 0;
2070
- const [internalOpen, setInternalOpen] = React21.useState(defaultOpen);
2231
+ const [internalOpen, setInternalOpen] = React22.useState(defaultOpen);
2071
2232
  const open = isControlled ? openProp : internalOpen;
2072
- const [shouldRender, setShouldRender] = React21.useState(open ?? false);
2233
+ const [shouldRender, setShouldRender] = React22.useState(open ?? false);
2073
2234
  if (open && !shouldRender) setShouldRender(true);
2074
- const wrapperRef = React21.useRef(null);
2075
- const positionRef = React21.useRef(null);
2076
- const popoverRef = React21.useRef(null);
2077
- const popoverId = React21.useId();
2078
- const setOpen = React21.useCallback(
2235
+ const wrapperRef = React22.useRef(null);
2236
+ const positionRef = React22.useRef(null);
2237
+ const popoverRef = React22.useRef(null);
2238
+ const popoverId = React22.useId();
2239
+ const setOpen = React22.useCallback(
2079
2240
  (next) => {
2080
2241
  if (!isControlled) setInternalOpen(next);
2081
2242
  onOpenChange?.(next);
@@ -2108,7 +2269,7 @@ var Popover = ({
2108
2269
  onExitComplete: () => setShouldRender(false)
2109
2270
  });
2110
2271
  useFocusTrap(popoverRef, open && pos.ready);
2111
- React21.useEffect(() => {
2272
+ React22.useEffect(() => {
2112
2273
  if (!open) return;
2113
2274
  const handleClick = (e) => {
2114
2275
  const target = e.target;
@@ -2122,7 +2283,7 @@ var Popover = ({
2122
2283
  useOverlayEscape(open, () => {
2123
2284
  setOpen(false);
2124
2285
  });
2125
- const triggerWithProps = React21.cloneElement(
2286
+ const triggerWithProps = React22.cloneElement(
2126
2287
  trigger,
2127
2288
  {
2128
2289
  onClick: (e) => {
@@ -2181,30 +2342,30 @@ var Tooltip = ({
2181
2342
  disabled = false,
2182
2343
  children
2183
2344
  }) => {
2184
- const [open, setOpen] = React21.useState(false);
2185
- const [shouldRender, setShouldRender] = React21.useState(false);
2345
+ const [open, setOpen] = React22.useState(false);
2346
+ const [shouldRender, setShouldRender] = React22.useState(false);
2186
2347
  if (open && !shouldRender) setShouldRender(true);
2187
- const timerRef = React21.useRef(null);
2188
- const tooltipId = React21.useId();
2189
- const wrapperRef = React21.useRef(null);
2190
- const positionRef = React21.useRef(null);
2348
+ const timerRef = React22.useRef(null);
2349
+ const tooltipId = React22.useId();
2350
+ const wrapperRef = React22.useRef(null);
2351
+ const positionRef = React22.useRef(null);
2191
2352
  const HIDE_DELAY = 120;
2192
- const show = React21.useCallback(() => {
2353
+ const show = React22.useCallback(() => {
2193
2354
  if (timerRef.current) clearTimeout(timerRef.current);
2194
2355
  timerRef.current = setTimeout(() => setOpen(true), delay);
2195
2356
  }, [delay]);
2196
- const hideNow = React21.useCallback(() => {
2357
+ const hideNow = React22.useCallback(() => {
2197
2358
  if (timerRef.current) clearTimeout(timerRef.current);
2198
2359
  setOpen(false);
2199
2360
  }, []);
2200
- const hide = React21.useCallback(() => {
2361
+ const hide = React22.useCallback(() => {
2201
2362
  if (timerRef.current) clearTimeout(timerRef.current);
2202
2363
  timerRef.current = setTimeout(() => setOpen(false), HIDE_DELAY);
2203
2364
  }, []);
2204
- const cancelHide = React21.useCallback(() => {
2365
+ const cancelHide = React22.useCallback(() => {
2205
2366
  if (timerRef.current) clearTimeout(timerRef.current);
2206
2367
  }, []);
2207
- React21.useEffect(() => {
2368
+ React22.useEffect(() => {
2208
2369
  return () => {
2209
2370
  if (timerRef.current) clearTimeout(timerRef.current);
2210
2371
  };
@@ -2218,7 +2379,7 @@ var Tooltip = ({
2218
2379
  gap: TOOLTIP_GAP,
2219
2380
  padding: 8
2220
2381
  });
2221
- React21.useEffect(() => {
2382
+ React22.useEffect(() => {
2222
2383
  if (open && pos.ready && pos.anchorHidden) hideNow();
2223
2384
  }, [open, pos.ready, pos.anchorHidden, hideNow]);
2224
2385
  const fromTransform = (() => {
@@ -2240,7 +2401,7 @@ var Tooltip = ({
2240
2401
  });
2241
2402
  const child = children;
2242
2403
  const childProps = child.props;
2243
- const trigger = React21.cloneElement(child, {
2404
+ const trigger = React22.cloneElement(child, {
2244
2405
  onMouseEnter: (e) => {
2245
2406
  childProps.onMouseEnter?.(e);
2246
2407
  show();
@@ -2300,9 +2461,10 @@ var Tooltip = ({
2300
2461
 
2301
2462
  // src/styles/a11y/index.ts
2302
2463
  var a11y = {
2303
- focusRing: "0 0 0 3px rgba(0, 0, 0, 0.15)",
2304
- focusRingError: "0 0 0 3px rgba(239, 68, 68, 0.15)",
2305
- focusRingSuccess: "0 0 0 3px rgba(16, 185, 129, 0.15)",
2464
+ // light 테마 값 - dark 를 따라가려면 `cssVars.a11y`
2465
+ focusRing: "0 0 0 2px #FFFFFF, 0 0 0 4px #121212",
2466
+ focusRingError: "0 0 0 2px #FFFFFF, 0 0 0 4px #B91C1C",
2467
+ focusRingSuccess: "0 0 0 2px #FFFFFF, 0 0 0 4px #047857",
2306
2468
  tapMinSize: "44px",
2307
2469
  tapTarget: {
2308
2470
  dense: "32px",
@@ -2311,6 +2473,12 @@ var a11y = {
2311
2473
  spacious: "56px"
2312
2474
  }
2313
2475
  };
2476
+ var controlHeight = {
2477
+ sm: a11y.tapTarget.dense,
2478
+ md: a11y.tapTarget.compact,
2479
+ lg: a11y.tapTarget.comfortable,
2480
+ xl: a11y.tapTarget.spacious
2481
+ };
2314
2482
 
2315
2483
  // src/styles/border-width/index.ts
2316
2484
  var baseBorderWidth = {
@@ -2356,11 +2524,35 @@ var baseColors = {
2356
2524
  neutral950: "#0A0A0A",
2357
2525
  // caption 전용 AA 값 (neutral_500 과 분리 — SCSS _index.scss 와 동일)
2358
2526
  textCaptionLight: "#6F6F6F",
2527
+ textCaptionDark: "#808080",
2359
2528
  // status — SCSS _index.scss 와 동일한 AA 통과(red/green/amber/blue-700) 값
2360
2529
  statusError: "#B91C1C",
2361
2530
  statusSuccess: "#047857",
2362
2531
  statusWarning: "#B45309",
2363
2532
  statusInfo: "#1D4ED8",
2533
+ // status - dark 테마에서 surface 위 직접 쓰는 밝은 값
2534
+ statusErrorDarkText: "#F87171",
2535
+ statusSuccessDarkText: "#4ADE80",
2536
+ statusWarningDarkText: "#FBBF24",
2537
+ statusInfoDarkText: "#60A5FA",
2538
+ // status container (연한 tint 배경) - light / dark
2539
+ statusErrorContainerLight: "#FEE2E2",
2540
+ statusSuccessContainerLight: "#DCFCE7",
2541
+ statusWarningContainerLight: "#FEF3C7",
2542
+ statusInfoContainerLight: "#DBEAFE",
2543
+ statusErrorContainerDark: "rgba(127, 29, 29, 0.35)",
2544
+ statusSuccessContainerDark: "rgba(6, 78, 59, 0.35)",
2545
+ statusWarningContainerDark: "rgba(120, 53, 15, 0.35)",
2546
+ statusInfoContainerDark: "rgba(30, 58, 138, 0.35)",
2547
+ // status on-container - dark (light 는 status* 와 같다)
2548
+ statusErrorOnContainerDark: "#FCA5A5",
2549
+ statusSuccessOnContainerDark: "#86EFAC",
2550
+ statusWarningOnContainerDark: "#FCD34D",
2551
+ statusInfoOnContainerDark: "#93C5FD",
2552
+ // skeleton - light (neutral 스케일 밖의 off-white)
2553
+ skeletonBase: "#F3F3F3",
2554
+ skeletonWave: "#F0F0F0",
2555
+ skeletonHighlight: "#FAFAFA",
2364
2556
  alphaBlack5: "rgba(0, 0, 0, 0.05)",
2365
2557
  alphaBlack8: "rgba(0, 0, 0, 0.08)",
2366
2558
  alphaBlack12: "rgba(26, 26, 26, 0.12)",
@@ -2368,12 +2560,14 @@ var baseColors = {
2368
2560
  alphaBlack50: "rgba(0, 0, 0, 0.50)",
2369
2561
  alphaWhite5: "rgba(255, 255, 255, 0.05)",
2370
2562
  alphaWhite8: "rgba(255, 255, 255, 0.08)",
2371
- alphaWhite12: "rgba(255, 255, 255, 0.12)"
2563
+ alphaWhite12: "rgba(255, 255, 255, 0.12)",
2564
+ alphaWhite38: "rgba(255, 255, 255, 0.38)"
2372
2565
  };
2373
2566
  var colors = {
2374
2567
  brand: {
2375
2568
  primary: baseColors.brandPrimary,
2376
- onPrimary: baseColors.neutral0
2569
+ onPrimary: baseColors.neutral0,
2570
+ primaryContainer: baseColors.alphaBlack5
2377
2571
  },
2378
2572
  text: {
2379
2573
  heading: baseColors.neutral900,
@@ -2394,8 +2588,10 @@ var colors = {
2394
2588
  state: {
2395
2589
  hoverOnLight: baseColors.alphaBlack5,
2396
2590
  pressedOnLight: baseColors.alphaBlack12,
2591
+ focusOnLight: baseColors.alphaBlack8,
2397
2592
  hoverOnDark: baseColors.alphaWhite5,
2398
- pressedOnDark: baseColors.alphaWhite12
2593
+ pressedOnDark: baseColors.alphaWhite12,
2594
+ focusOnDark: baseColors.alphaWhite8
2399
2595
  },
2400
2596
  border: {
2401
2597
  default: baseColors.neutral200,
@@ -2408,7 +2604,27 @@ var colors = {
2408
2604
  error: baseColors.statusError,
2409
2605
  success: baseColors.statusSuccess,
2410
2606
  warning: baseColors.statusWarning,
2411
- info: baseColors.statusInfo
2607
+ info: baseColors.statusInfo,
2608
+ // solid 배경 위 텍스트
2609
+ errorOnDefault: baseColors.neutral0,
2610
+ successOnDefault: baseColors.neutral0,
2611
+ warningOnDefault: baseColors.neutral0,
2612
+ infoOnDefault: baseColors.neutral0,
2613
+ // 연한 tint 배경 (soft variant)
2614
+ errorContainer: baseColors.statusErrorContainerLight,
2615
+ successContainer: baseColors.statusSuccessContainerLight,
2616
+ warningContainer: baseColors.statusWarningContainerLight,
2617
+ infoContainer: baseColors.statusInfoContainerLight,
2618
+ // tint 배경 위 텍스트
2619
+ errorOnContainer: baseColors.statusError,
2620
+ successOnContainer: baseColors.statusSuccess,
2621
+ warningOnContainer: baseColors.statusWarning,
2622
+ infoOnContainer: baseColors.statusInfo,
2623
+ // 앱 surface 위 직접 텍스트 (dark 에서 밝은 값으로 바뀐다)
2624
+ errorOnSurface: baseColors.statusError,
2625
+ successOnSurface: baseColors.statusSuccess,
2626
+ warningOnSurface: baseColors.statusWarning,
2627
+ infoOnSurface: baseColors.statusInfo
2412
2628
  },
2413
2629
  // Accent (brand 검정 기반 - light=검정, dark=흰색 반전)
2414
2630
  accent: {
@@ -2418,6 +2634,11 @@ var colors = {
2418
2634
  default: baseColors.brandPrimary,
2419
2635
  strong: baseColors.neutral900,
2420
2636
  onSurface: baseColors.neutral0
2637
+ },
2638
+ skeleton: {
2639
+ base: baseColors.skeletonBase,
2640
+ wave: baseColors.skeletonWave,
2641
+ highlight: baseColors.skeletonHighlight
2421
2642
  }
2422
2643
  };
2423
2644
 
@@ -2430,6 +2651,23 @@ var elevation = {
2430
2651
  level5: "0 8px 10px -5px rgba(0, 0, 0, 0.20), 0 20px 20px 0px rgba(0, 0, 0, 0.12)"
2431
2652
  };
2432
2653
 
2654
+ // src/styles/css-vars.ts
2655
+ var kebab = (key) => key.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
2656
+ var varsOf = (source, prefix) => Object.fromEntries(
2657
+ Object.keys(source).map((key) => [key, `var(--bt-${prefix}${kebab(key)})`])
2658
+ );
2659
+ var cssVars = {
2660
+ colors: Object.fromEntries(
2661
+ Object.entries(colors).map(([group, values]) => [group, varsOf(values, `color-${group}-`)])
2662
+ ),
2663
+ elevation: varsOf(elevation, "elevation-"),
2664
+ a11y: {
2665
+ focusRing: "var(--bt-focus-ring)",
2666
+ focusRingError: "var(--bt-focus-ring-error)",
2667
+ focusRingSuccess: "var(--bt-focus-ring-success)"
2668
+ }
2669
+ };
2670
+
2433
2671
  // src/styles/motion/index.ts
2434
2672
  var motion = {
2435
2673
  transition: {
@@ -2502,12 +2740,13 @@ var spacing = {
2502
2740
 
2503
2741
  // src/styles/skeleton/index.ts
2504
2742
  var skeleton = {
2743
+ // SCSS `$color_skeleton_*` 의 light 값과 같다. dark 테마를 따라가려면 `cssVars.colors.skeleton`.
2505
2744
  color: {
2506
- base: baseColors.neutral50,
2507
- wave: baseColors.neutral200,
2508
- highlight: baseColors.neutral0
2745
+ base: baseColors.skeletonBase,
2746
+ wave: baseColors.skeletonWave,
2747
+ highlight: baseColors.skeletonHighlight
2509
2748
  },
2510
- gradient: `linear-gradient(90deg, ${baseColors.neutral50} 25%, ${baseColors.neutral0} 37%, ${baseColors.neutral200} 63%)`,
2749
+ gradient: `linear-gradient(90deg, ${baseColors.skeletonBase} 25%, ${baseColors.skeletonHighlight} 37%, ${baseColors.skeletonWave} 63%)`,
2511
2750
  radius: {
2512
2751
  sm: radius.sm,
2513
2752
  md: radius.md,
@@ -3464,7 +3703,7 @@ var Pagination = ({
3464
3703
  const emit = onPageChange ?? onChange;
3465
3704
  const prevDisabled = page <= 1;
3466
3705
  const nextDisabled = page >= totalPages;
3467
- const items = React21.useMemo(() => getPaginationItems(page, totalPages), [page, totalPages]);
3706
+ const items = React22.useMemo(() => getPaginationItems(page, totalPages), [page, totalPages]);
3468
3707
  return /* @__PURE__ */ jsxs("nav", { className: "pagination", "aria-label": navLabel, children: [
3469
3708
  /* @__PURE__ */ jsx(
3470
3709
  "button",
@@ -3544,12 +3783,12 @@ var Checkbox = ({
3544
3783
  ref,
3545
3784
  ...props
3546
3785
  }) => {
3547
- const inputRef = React21.useRef(null);
3548
- React21.useImperativeHandle(
3786
+ const inputRef = React22.useRef(null);
3787
+ React22.useImperativeHandle(
3549
3788
  ref,
3550
3789
  () => inputRef.current
3551
3790
  );
3552
- React21.useEffect(() => {
3791
+ React22.useEffect(() => {
3553
3792
  if (!inputRef.current) return;
3554
3793
  inputRef.current.indeterminate = Boolean(indeterminate);
3555
3794
  }, [indeterminate]);
@@ -3623,7 +3862,7 @@ var Table = ({
3623
3862
  stickyHeader && "table_sticky_header",
3624
3863
  className
3625
3864
  );
3626
- const wrapperRef = React21.useRef(null);
3865
+ const wrapperRef = React22.useRef(null);
3627
3866
  useSafeLayoutEffect(() => {
3628
3867
  const el = wrapperRef.current;
3629
3868
  if (!el) return;
@@ -3651,7 +3890,7 @@ var Table = ({
3651
3890
  };
3652
3891
  }, []);
3653
3892
  const isRowClickable = Boolean(onRowClick);
3654
- React21.useEffect(() => {
3893
+ React22.useEffect(() => {
3655
3894
  if (!isRowClickable) return;
3656
3895
  const handleKeyDown2 = (e) => {
3657
3896
  if (e.key !== "ArrowDown" || e.defaultPrevented) return;
@@ -3696,8 +3935,8 @@ var Table = ({
3696
3935
  const isEmpty = !isLoading && data.length === 0;
3697
3936
  const getRowKey = (item, index) => rowKey?.(item) ?? String(index);
3698
3937
  const allRowKeys = selectable ? data.map((item, index) => getRowKey(item, index)) : [];
3699
- const rowClickHintId = React21.useId();
3700
- const selectedSet = React21.useMemo(() => new Set(selectedKeys ?? []), [selectedKeys]);
3938
+ const rowClickHintId = React22.useId();
3939
+ const selectedSet = React22.useMemo(() => new Set(selectedKeys ?? []), [selectedKeys]);
3701
3940
  const selectedCount = allRowKeys.filter((key) => selectedSet.has(key)).length;
3702
3941
  const isAllSelected = allRowKeys.length > 0 && selectedCount === allRowKeys.length;
3703
3942
  const isSomeSelected = selectedCount > 0 && !isAllSelected;
@@ -4182,8 +4421,8 @@ var MediaCard = ({
4182
4421
  );
4183
4422
  };
4184
4423
  var Prose = ({ size = "md", className, children, ref, ...props }) => {
4185
- const rootRef = React21.useRef(null);
4186
- React21.useImperativeHandle(ref, () => rootRef.current, []);
4424
+ const rootRef = React22.useRef(null);
4425
+ React22.useImperativeHandle(ref, () => rootRef.current, []);
4187
4426
  useSafeLayoutEffect(() => {
4188
4427
  const root = rootRef.current;
4189
4428
  if (!root) return;
@@ -4223,6 +4462,23 @@ var Prose = ({ size = "md", className, children, ref, ...props }) => {
4223
4462
  return /* @__PURE__ */ jsx("div", { ref: rootRef, className: cn("prose", `prose_size_${size}`, className), ...props, children });
4224
4463
  };
4225
4464
  Prose.displayName = "Prose";
4465
+ var Spinner = ({ size = 24, ariaLabel: ariaLabelProp }) => {
4466
+ const t = useLocaleText();
4467
+ const ariaLabel = ariaLabelProp ?? t("spinner.label");
4468
+ return /* @__PURE__ */ jsx(
4469
+ "span",
4470
+ {
4471
+ className: "spinner",
4472
+ style: { width: size, height: size },
4473
+ role: "status",
4474
+ "aria-label": ariaLabel,
4475
+ children: Array.from({ length: 12 }, (_, i) => (
4476
+ // biome-ignore lint/suspicious/noArrayIndexKey: static 12 bars, index is stable key
4477
+ /* @__PURE__ */ jsx("span", { className: "spinner_bar", "aria-hidden": "true" }, i)
4478
+ ))
4479
+ }
4480
+ );
4481
+ };
4226
4482
  var ICONS = {
4227
4483
  info: /* @__PURE__ */ jsx(Info, { size: iconSize.lg, "aria-hidden": "true" }),
4228
4484
  success: /* @__PURE__ */ jsx(CheckCircle2, { size: iconSize.lg, "aria-hidden": "true" }),
@@ -4230,6 +4486,7 @@ var ICONS = {
4230
4486
  error: /* @__PURE__ */ jsx(XCircle, { size: iconSize.lg, "aria-hidden": "true" })
4231
4487
  };
4232
4488
  var AlertContext = createContext(null);
4489
+ var useConfirm = () => useAlert().confirm;
4233
4490
  var useAlert = () => {
4234
4491
  const context = useContext(AlertContext);
4235
4492
  if (!context) {
@@ -4241,9 +4498,31 @@ var useAlert = () => {
4241
4498
  };
4242
4499
  var AlertProvider = ({ children }) => {
4243
4500
  const [alertState, setAlertState] = useState({ isOpen: false });
4244
- const showAlert = useCallback((options) => {
4245
- setAlertState({ ...options, isOpen: true });
4501
+ const [pending, setPending] = useState(false);
4502
+ const resolveRef = React22.useRef(null);
4503
+ const tokenRef = React22.useRef(0);
4504
+ const settle = useCallback((ok) => {
4505
+ const resolve = resolveRef.current;
4506
+ resolveRef.current = null;
4507
+ resolve?.(ok);
4246
4508
  }, []);
4509
+ React22.useEffect(() => () => settle(false), [settle]);
4510
+ const showAlert = useCallback(
4511
+ (options) => {
4512
+ settle(false);
4513
+ tokenRef.current++;
4514
+ setPending(false);
4515
+ setAlertState({ ...options, isOpen: true });
4516
+ },
4517
+ [settle]
4518
+ );
4519
+ const confirm = useCallback(
4520
+ (options) => new Promise((resolve) => {
4521
+ showAlert({ ...options, showCancel: true });
4522
+ resolveRef.current = resolve;
4523
+ }),
4524
+ [showAlert]
4525
+ );
4247
4526
  const handleClose = useCallback(() => {
4248
4527
  setAlertState((prev) => ({ ...prev, isOpen: false }));
4249
4528
  }, []);
@@ -4251,22 +4530,43 @@ var AlertProvider = ({ children }) => {
4251
4530
  setAlertState((prev) => prev.isOpen ? prev : { isOpen: false });
4252
4531
  }, []);
4253
4532
  const handleConfirm = useCallback(() => {
4254
- alertState.onConfirm?.();
4533
+ if (pending) return;
4534
+ const token = tokenRef.current;
4535
+ const result = alertState.onConfirm?.();
4536
+ if (result && typeof result.then === "function") {
4537
+ setPending(true);
4538
+ result.then(
4539
+ () => {
4540
+ if (token !== tokenRef.current) return;
4541
+ setPending(false);
4542
+ settle(true);
4543
+ handleClose();
4544
+ },
4545
+ () => {
4546
+ if (token === tokenRef.current) setPending(false);
4547
+ }
4548
+ );
4549
+ return;
4550
+ }
4551
+ settle(true);
4255
4552
  handleClose();
4256
- }, [alertState.onConfirm, handleClose]);
4553
+ }, [alertState.onConfirm, handleClose, pending, settle]);
4257
4554
  const handleCancel = useCallback(() => {
4555
+ if (pending) return;
4258
4556
  alertState.onCancel?.();
4557
+ settle(false);
4259
4558
  handleClose();
4260
- }, [alertState.onCancel, handleClose]);
4261
- return /* @__PURE__ */ jsxs(AlertContext.Provider, { value: { showAlert }, children: [
4559
+ }, [alertState.onCancel, handleClose, pending, settle]);
4560
+ return /* @__PURE__ */ jsxs(AlertContext.Provider, { value: { showAlert, confirm }, children: [
4262
4561
  children,
4263
4562
  /* @__PURE__ */ jsx(
4264
4563
  AlertModal,
4265
4564
  {
4266
4565
  ...alertState,
4566
+ pending,
4267
4567
  onConfirm: handleConfirm,
4268
4568
  onCancel: handleCancel,
4269
- onClose: handleClose,
4569
+ onClose: handleCancel,
4270
4570
  onExited: handleExited
4271
4571
  }
4272
4572
  )
@@ -4284,6 +4584,7 @@ var AlertModal = ({
4284
4584
  actionsAlign = "right",
4285
4585
  showIcon = false,
4286
4586
  closeOnOverlay = true,
4587
+ pending = false,
4287
4588
  onConfirm,
4288
4589
  onCancel,
4289
4590
  onClose,
@@ -4293,10 +4594,10 @@ var AlertModal = ({
4293
4594
  const confirmText = confirmTextProp ?? t("alert.confirm");
4294
4595
  const cancelText = cancelTextProp ?? t("alert.cancel");
4295
4596
  const dismiss = onCancel ?? onClose;
4296
- const panelRef = React21.useRef(null);
4297
- const pressedOverlayRef = React21.useRef(false);
4298
- const titleId = React21.useId();
4299
- const messageId = React21.useId();
4597
+ const panelRef = React22.useRef(null);
4598
+ const pressedOverlayRef = React22.useRef(false);
4599
+ const titleId = React22.useId();
4600
+ const messageId = React22.useId();
4300
4601
  const [shouldRender, setShouldRender] = useState(isOpen);
4301
4602
  useFocusTrap(panelRef, isOpen);
4302
4603
  useOverlayEscape(isOpen, () => dismiss());
@@ -4322,7 +4623,7 @@ var AlertModal = ({
4322
4623
  immediate: reduced,
4323
4624
  config: OVERLAY_SPRING_CONFIG
4324
4625
  });
4325
- React21.useEffect(() => {
4626
+ React22.useEffect(() => {
4326
4627
  if (!shouldRender) return;
4327
4628
  lockBodyScroll();
4328
4629
  return () => {
@@ -4361,6 +4662,7 @@ var AlertModal = ({
4361
4662
  },
4362
4663
  role: "alertdialog",
4363
4664
  "aria-modal": "true",
4665
+ "aria-busy": pending || void 0,
4364
4666
  "aria-labelledby": title ? titleId : void 0,
4365
4667
  "aria-describedby": message ? messageId : void 0,
4366
4668
  children: [
@@ -4370,7 +4672,17 @@ var AlertModal = ({
4370
4672
  ] }),
4371
4673
  message && /* @__PURE__ */ jsx("div", { className: "alert_message", id: messageId, children: message }),
4372
4674
  /* @__PURE__ */ jsxs("div", { className: cn("alert_actions", `alert_actions_${actionsAlign}`), children: [
4373
- showCancel && /* @__PURE__ */ jsx(Button, { variant: cancelVariant, size: "md", radius: "md", onClick: onCancel, children: cancelText }),
4675
+ showCancel && /* @__PURE__ */ jsx(
4676
+ Button,
4677
+ {
4678
+ variant: cancelVariant,
4679
+ size: "md",
4680
+ radius: "md",
4681
+ "aria-disabled": pending || void 0,
4682
+ onClick: onCancel,
4683
+ children: cancelText
4684
+ }
4685
+ ),
4374
4686
  /* @__PURE__ */ jsx(
4375
4687
  Button,
4376
4688
  {
@@ -4378,6 +4690,8 @@ var AlertModal = ({
4378
4690
  danger: destructive,
4379
4691
  size: "md",
4380
4692
  radius: "md",
4693
+ "aria-disabled": pending || void 0,
4694
+ leadingIcon: pending ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: /* @__PURE__ */ jsx(Spinner, { size: 16 }) }) : void 0,
4381
4695
  onClick: onConfirm,
4382
4696
  children: confirmText
4383
4697
  }
@@ -4424,24 +4738,7 @@ var LinearProgress = ({
4424
4738
  }
4425
4739
  );
4426
4740
  };
4427
- var Spinner = ({ size = 24, ariaLabel: ariaLabelProp }) => {
4428
- const t = useLocaleText();
4429
- const ariaLabel = ariaLabelProp ?? t("spinner.label");
4430
- return /* @__PURE__ */ jsx(
4431
- "span",
4432
- {
4433
- className: "spinner",
4434
- style: { width: size, height: size },
4435
- role: "status",
4436
- "aria-label": ariaLabel,
4437
- children: Array.from({ length: 12 }, (_, i) => (
4438
- // biome-ignore lint/suspicious/noArrayIndexKey: static 12 bars, index is stable key
4439
- /* @__PURE__ */ jsx("span", { className: "spinner_bar", "aria-hidden": "true" }, i)
4440
- ))
4441
- }
4442
- );
4443
- };
4444
- var ToastContext = React21.createContext(null);
4741
+ var ToastContext = React22.createContext(null);
4445
4742
  var VARIANT_ICONS = {
4446
4743
  success: /* @__PURE__ */ jsx(CheckCircle2, { size: iconSize.md }),
4447
4744
  error: /* @__PURE__ */ jsx(XCircle, { size: iconSize.md }),
@@ -4450,9 +4747,9 @@ var VARIANT_ICONS = {
4450
4747
  default: /* @__PURE__ */ jsx(Bell, { size: iconSize.md })
4451
4748
  };
4452
4749
  var ToastItemComponent = ({ item, onRemove, closeAriaLabel }) => {
4453
- const [visible, setVisible] = React21.useState(true);
4454
- const closingRef = React21.useRef(false);
4455
- const rootRef = React21.useRef(null);
4750
+ const [visible, setVisible] = React22.useState(true);
4751
+ const closingRef = React22.useRef(false);
4752
+ const rootRef = React22.useRef(null);
4456
4753
  const style = useSpringPresence({
4457
4754
  visible,
4458
4755
  from: "translateX(20px)",
@@ -4472,12 +4769,12 @@ var ToastItemComponent = ({ item, onRemove, closeAriaLabel }) => {
4472
4769
  onRemove(item.id);
4473
4770
  }
4474
4771
  });
4475
- const close = React21.useCallback(() => {
4772
+ const close = React22.useCallback(() => {
4476
4773
  if (closingRef.current) return;
4477
4774
  closingRef.current = true;
4478
4775
  setVisible(false);
4479
4776
  }, []);
4480
- React21.useEffect(() => {
4777
+ React22.useEffect(() => {
4481
4778
  if (item.dismissing) close();
4482
4779
  }, [item.dismissing, close]);
4483
4780
  const autoDismisses = Number.isFinite(item.duration);
@@ -4523,9 +4820,9 @@ var ToastProvider = ({
4523
4820
  const t = useLocaleText();
4524
4821
  const closeAriaLabel = closeAriaLabelProp ?? t("toast.close");
4525
4822
  const regionLabel = regionLabelProp ?? t("toast.region");
4526
- const [toasts, setToasts] = React21.useState([]);
4823
+ const [toasts, setToasts] = React22.useState([]);
4527
4824
  const isMounted = useIsMounted();
4528
- const addToast = React21.useCallback(
4825
+ const addToast = React22.useCallback(
4529
4826
  (message, variant, options = {}) => {
4530
4827
  const { duration = 3e3, action } = options;
4531
4828
  const id = `toast_${++toastSeq}`;
@@ -4540,14 +4837,14 @@ var ToastProvider = ({
4540
4837
  },
4541
4838
  [maxCount]
4542
4839
  );
4543
- const dismissToast = React21.useCallback((id) => {
4840
+ const dismissToast = React22.useCallback((id) => {
4544
4841
  setToasts(
4545
4842
  (prev) => prev.map(
4546
4843
  (toast) => toast.id === id && !toast.dismissing ? { ...toast, dismissing: true } : toast
4547
4844
  )
4548
4845
  );
4549
4846
  }, []);
4550
- const updateToast = React21.useCallback((id, patch) => {
4847
+ const updateToast = React22.useCallback((id, patch) => {
4551
4848
  setToasts(
4552
4849
  (prev) => prev.map((toast) => {
4553
4850
  if (toast.id !== id || toast.dismissing) return toast;
@@ -4560,10 +4857,10 @@ var ToastProvider = ({
4560
4857
  })
4561
4858
  );
4562
4859
  }, []);
4563
- const removeToast = React21.useCallback((id) => {
4860
+ const removeToast = React22.useCallback((id) => {
4564
4861
  setToasts((prev) => prev.filter((t2) => t2.id !== id));
4565
4862
  }, []);
4566
- const contextValue = React21.useMemo(
4863
+ const contextValue = React22.useMemo(
4567
4864
  () => ({ addToast, dismissToast, updateToast }),
4568
4865
  [addToast, dismissToast, updateToast]
4569
4866
  );
@@ -4862,6 +5159,258 @@ var Combobox = ({
4862
5159
  )
4863
5160
  ] });
4864
5161
  };
5162
+ var ROWS = 6;
5163
+ var pad = (n) => String(n).padStart(2, "0");
5164
+ var format2 = ({ year, month, day }) => `${year}-${pad(month)}-${pad(day)}`;
5165
+ var formatMonth = ({ year, month }) => `${year}-${pad(month)}`;
5166
+ var parse = (value) => {
5167
+ const m = /^(\d{4})-(\d{2})(?:-(\d{2}))?$/.exec(value ?? "");
5168
+ if (!m) return null;
5169
+ const year = Number(m[1]);
5170
+ const month = Number(m[2]);
5171
+ const day = m[3] ? Number(m[3]) : 1;
5172
+ if (month < 1 || month > 12 || day < 1 || day > daysIn(year, month)) return null;
5173
+ return { year, month, day };
5174
+ };
5175
+ var toDate = ({ year, month, day }) => new Date(year, month - 1, day);
5176
+ var fromDate = (d) => ({
5177
+ year: d.getFullYear(),
5178
+ month: d.getMonth() + 1,
5179
+ day: d.getDate()
5180
+ });
5181
+ var sameDay = (a, b) => !!a && !!b && a.year === b.year && a.month === b.month && a.day === b.day;
5182
+ var compare = (a, b) => a.year - b.year || a.month - b.month || a.day - b.day;
5183
+ var monthIndex = (y, m) => y * 12 + (m - 1);
5184
+ var daysIn = (y, m) => new Date(y, m, 0).getDate();
5185
+ var addDays = (date, n) => {
5186
+ const d = toDate(date);
5187
+ d.setDate(d.getDate() + n);
5188
+ return fromDate(d);
5189
+ };
5190
+ var addMonths = (date, n) => {
5191
+ const idx = monthIndex(date.year, date.month) + n;
5192
+ const year = Math.floor(idx / 12);
5193
+ const month = idx % 12 + 1;
5194
+ return { year, month, day: Math.min(date.day, daysIn(year, month)) };
5195
+ };
5196
+ var DateCalendar = ({
5197
+ value: valueProp,
5198
+ defaultValue,
5199
+ onValueChange,
5200
+ month: monthProp,
5201
+ defaultMonth,
5202
+ onMonthChange,
5203
+ min: minProp,
5204
+ max: maxProp,
5205
+ isDateDisabled,
5206
+ today: todayProp,
5207
+ weekStartsOn = 0,
5208
+ renderDay,
5209
+ describeDay,
5210
+ prevMonthLabel,
5211
+ nextMonthLabel,
5212
+ className,
5213
+ ...props
5214
+ }) => {
5215
+ const t = useLocaleText();
5216
+ const intlLocale = useLocaleName() === "en" ? "en-US" : "ko-KR";
5217
+ const prevLabel = prevMonthLabel ?? t("datePicker.prevMonth");
5218
+ const nextLabel = nextMonthLabel ?? t("datePicker.nextMonth");
5219
+ const isControlled = valueProp !== void 0;
5220
+ const [innerValue, setInnerValue] = React22.useState(defaultValue ?? null);
5221
+ const selected = parse(isControlled ? valueProp : innerValue);
5222
+ const today = parse(todayProp) ?? fromDate(/* @__PURE__ */ new Date());
5223
+ const min = parse(minProp);
5224
+ const max = parse(maxProp);
5225
+ const minIdx = min ? monthIndex(min.year, min.month) : Number.NEGATIVE_INFINITY;
5226
+ const maxIdx = max ? monthIndex(max.year, max.month) : Number.POSITIVE_INFINITY;
5227
+ const clampToRange = (date) => {
5228
+ if (min && compare(date, min) < 0) return min;
5229
+ if (max && compare(date, max) > 0) return max;
5230
+ return date;
5231
+ };
5232
+ const isDisabled = (date) => !!min && compare(date, min) < 0 || !!max && compare(date, max) > 0 || !!isDateDisabled?.(format2(date));
5233
+ const pickInMonth = (m) => {
5234
+ const inMonth = (d) => !!d && d.year === m.year && d.month === m.month;
5235
+ if (inMonth(selected)) return selected;
5236
+ if (inMonth(today)) return today;
5237
+ return { ...m, day: 1 };
5238
+ };
5239
+ const [focused, setFocused] = React22.useState(() => {
5240
+ const startMonth = parse(monthProp ?? defaultMonth);
5241
+ return clampToRange(startMonth ? pickInMonth(startMonth) : selected ?? today);
5242
+ });
5243
+ const gridRef = React22.useRef(null);
5244
+ const moveFocusRef = React22.useRef(false);
5245
+ React22.useEffect(() => {
5246
+ if (!moveFocusRef.current) return;
5247
+ moveFocusRef.current = false;
5248
+ gridRef.current?.querySelector('button[tabindex="0"]')?.focus();
5249
+ });
5250
+ const pendingRef = React22.useRef(null);
5251
+ const syncedMonthRef = React22.useRef(monthProp);
5252
+ const controlledMonth = parse(monthProp);
5253
+ if (controlledMonth && syncedMonthRef.current !== monthProp) {
5254
+ syncedMonthRef.current = monthProp;
5255
+ const pending = pendingRef.current;
5256
+ pendingRef.current = null;
5257
+ const hit = pending && pending.date.year === controlledMonth.year && pending.date.month === controlledMonth.month;
5258
+ moveFocusRef.current = !!hit && pending.viaKeyboard;
5259
+ setFocused(clampToRange(hit ? pending.date : pickInMonth(controlledMonth)));
5260
+ }
5261
+ const selectedKey = selected ? format2(selected) : null;
5262
+ const syncedValueRef = React22.useRef(selectedKey);
5263
+ if (syncedValueRef.current !== selectedKey) {
5264
+ syncedValueRef.current = selectedKey;
5265
+ if (selected && monthProp === void 0 && (selected.year !== focused.year || selected.month !== focused.month)) {
5266
+ setFocused(clampToRange(selected));
5267
+ }
5268
+ }
5269
+ const view = { year: focused.year, month: focused.month };
5270
+ const viewIdx = monthIndex(view.year, view.month);
5271
+ const titleId = React22.useId();
5272
+ const fmt = React22.useMemo(
5273
+ () => ({
5274
+ title: new Intl.DateTimeFormat(intlLocale, { year: "numeric", month: "long" }),
5275
+ weekdayShort: new Intl.DateTimeFormat(intlLocale, { weekday: "narrow" }),
5276
+ weekdayLong: new Intl.DateTimeFormat(intlLocale, { weekday: "long" }),
5277
+ full: new Intl.DateTimeFormat(intlLocale, { dateStyle: "full" })
5278
+ }),
5279
+ [intlLocale]
5280
+ );
5281
+ const weekdays = Array.from({ length: 7 }, (_, i) => {
5282
+ const d = new Date(2026, 9, 4 + (weekStartsOn + i) % 7);
5283
+ return { short: fmt.weekdayShort.format(d), long: fmt.weekdayLong.format(d) };
5284
+ });
5285
+ const lead = (new Date(view.year, view.month - 1, 1).getDay() - weekStartsOn + 7) % 7;
5286
+ const total = daysIn(view.year, view.month);
5287
+ const cells = Array.from({ length: ROWS * 7 }, (_, i) => {
5288
+ const day = i - lead + 1;
5289
+ return day >= 1 && day <= total ? { ...view, day } : null;
5290
+ });
5291
+ const focusDate = (next, viaKeyboard) => {
5292
+ const target = clampToRange(next);
5293
+ if (target.year !== focused.year || target.month !== focused.month) {
5294
+ onMonthChange?.(formatMonth(target));
5295
+ if (monthProp !== void 0) {
5296
+ pendingRef.current = { date: target, viaKeyboard };
5297
+ return;
5298
+ }
5299
+ }
5300
+ moveFocusRef.current = viaKeyboard;
5301
+ setFocused(target);
5302
+ };
5303
+ const handleKeyDown2 = (e) => {
5304
+ if (e.altKey || e.ctrlKey || e.metaKey) return;
5305
+ const offset = (toDate(focused).getDay() - weekStartsOn + 7) % 7;
5306
+ const moves = {
5307
+ ArrowLeft: () => addDays(focused, -1),
5308
+ ArrowRight: () => addDays(focused, 1),
5309
+ ArrowUp: () => addDays(focused, -7),
5310
+ ArrowDown: () => addDays(focused, 7),
5311
+ Home: () => addDays(focused, -offset),
5312
+ End: () => addDays(focused, 6 - offset),
5313
+ PageUp: () => addMonths(focused, e.shiftKey ? -12 : -1),
5314
+ PageDown: () => addMonths(focused, e.shiftKey ? 12 : 1)
5315
+ };
5316
+ const move = moves[e.key];
5317
+ if (!move) return;
5318
+ e.preventDefault();
5319
+ focusDate(move(), true);
5320
+ };
5321
+ const select = (date) => {
5322
+ const next = format2(date);
5323
+ if (!isControlled) setInnerValue(next);
5324
+ onValueChange?.(next);
5325
+ };
5326
+ return /* @__PURE__ */ jsxs("div", { className: cn("date_calendar", className), ...props, children: [
5327
+ /* @__PURE__ */ jsxs("div", { className: "date_calendar_header", children: [
5328
+ /* @__PURE__ */ jsx(
5329
+ "button",
5330
+ {
5331
+ type: "button",
5332
+ className: "date_calendar_nav",
5333
+ "aria-label": prevLabel,
5334
+ onClick: () => focusDate(addMonths(focused, -1), false),
5335
+ disabled: viewIdx <= minIdx,
5336
+ "data-focus-trap-skip-autofocus": "",
5337
+ children: /* @__PURE__ */ jsx(ChevronLeft, { size: iconSize.md, "aria-hidden": "true" })
5338
+ }
5339
+ ),
5340
+ /* @__PURE__ */ jsx("span", { className: "date_calendar_title", id: titleId, "aria-live": "polite", children: fmt.title.format(new Date(view.year, view.month - 1, 1)) }),
5341
+ /* @__PURE__ */ jsx(
5342
+ "button",
5343
+ {
5344
+ type: "button",
5345
+ className: "date_calendar_nav",
5346
+ "aria-label": nextLabel,
5347
+ onClick: () => focusDate(addMonths(focused, 1), false),
5348
+ disabled: viewIdx >= maxIdx,
5349
+ "data-focus-trap-skip-autofocus": "",
5350
+ children: /* @__PURE__ */ jsx(ChevronRight, { size: iconSize.md, "aria-hidden": "true" })
5351
+ }
5352
+ )
5353
+ ] }),
5354
+ /* @__PURE__ */ jsxs("table", { ref: gridRef, className: "date_calendar_grid", role: "grid", "aria-labelledby": titleId, children: [
5355
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: weekdays.map((w) => /* @__PURE__ */ jsx("th", { scope: "col", abbr: w.long, className: "date_calendar_weekday", children: w.short }, w.long)) }) }),
5356
+ /* @__PURE__ */ jsx("tbody", { children: Array.from({ length: ROWS }, (_, row) => (
5357
+ // biome-ignore lint/suspicious/noArrayIndexKey: 줄은 위치 자체가 정체성이다(달이 바뀌어도 6줄)
5358
+ /* @__PURE__ */ jsx("tr", { children: cells.slice(row * 7, row * 7 + 7).map((cell, col) => {
5359
+ if (!cell) {
5360
+ return /* @__PURE__ */ jsx("td", { className: "date_calendar_cell" }, `empty-${col}`);
5361
+ }
5362
+ const disabled = isDisabled(cell);
5363
+ const isSelected = sameDay(cell, selected);
5364
+ const isToday = sameDay(cell, today);
5365
+ const iso = format2(cell);
5366
+ const description = describeDay?.(iso);
5367
+ const decoration = renderDay?.(iso, {
5368
+ selected: isSelected,
5369
+ today: isToday,
5370
+ disabled
5371
+ });
5372
+ return (
5373
+ // biome-ignore lint/a11y/useFocusableInteractive: 포커스는 칸 안 button 이 받는다 - 칸과 버튼이 둘 다 받으면 Tab 이 달력 안에서 두 번 멈춘다
5374
+ /* @__PURE__ */ jsx(
5375
+ "td",
5376
+ {
5377
+ role: "gridcell",
5378
+ "aria-selected": isSelected,
5379
+ className: "date_calendar_cell",
5380
+ children: /* @__PURE__ */ jsxs(
5381
+ "button",
5382
+ {
5383
+ type: "button",
5384
+ className: cn("date_calendar_day", {
5385
+ date_calendar_day_selected: isSelected,
5386
+ date_calendar_day_today: isToday
5387
+ }),
5388
+ tabIndex: sameDay(cell, focused) ? 0 : -1,
5389
+ "data-focus-trap-skip-autofocus": sameDay(cell, focused) ? void 0 : "",
5390
+ "aria-label": [String(cell.day), fmt.full.format(toDate(cell)), description].filter(Boolean).join(", "),
5391
+ "aria-current": isToday ? "date" : void 0,
5392
+ "aria-disabled": disabled || void 0,
5393
+ onClick: () => {
5394
+ focusDate(cell, false);
5395
+ if (!disabled) select(cell);
5396
+ },
5397
+ onKeyDown: handleKeyDown2,
5398
+ children: [
5399
+ cell.day,
5400
+ decoration != null && /* @__PURE__ */ jsx("span", { className: "date_calendar_decoration", "aria-hidden": "true", children: decoration })
5401
+ ]
5402
+ }
5403
+ )
5404
+ },
5405
+ cell.day
5406
+ )
5407
+ );
5408
+ }) }, row)
5409
+ )) })
5410
+ ] })
5411
+ ] });
5412
+ };
5413
+ DateCalendar.displayName = "DateCalendar";
4865
5414
  var normalizeForSearch = (s) => s.toLowerCase().replace(/\s+/g, "");
4866
5415
  var Dropdown = (props) => {
4867
5416
  const t = useLocaleText();
@@ -5151,180 +5700,13 @@ var Dropdown = (props) => {
5151
5700
  )
5152
5701
  ] });
5153
5702
  };
5154
- var WEEK = [0, 1, 2, 3, 4, 5, 6];
5155
- var ROWS = 6;
5156
- var toDate = ({ year, month, day }) => new Date(year, month - 1, day);
5157
- var fromDate = (d) => ({
5158
- year: d.getFullYear(),
5159
- month: d.getMonth() + 1,
5160
- day: d.getDate()
5161
- });
5162
- var sameDay = (a, b) => !!a && !!b && a.year === b.year && a.month === b.month && a.day === b.day;
5163
- var monthIndex = (y, m) => y * 12 + (m - 1);
5164
- var daysIn = (y, m) => new Date(y, m, 0).getDate();
5165
- var addDays = (date, n) => {
5166
- const d = toDate(date);
5167
- d.setDate(d.getDate() + n);
5168
- return fromDate(d);
5169
- };
5170
- var addMonths = (date, n) => {
5171
- const idx = monthIndex(date.year, date.month) + n;
5172
- const year = Math.floor(idx / 12);
5173
- const month = idx % 12 + 1;
5174
- return { year, month, day: Math.min(date.day, daysIn(year, month)) };
5175
- };
5176
- var DateCalendar = ({
5177
- selected,
5178
- today,
5179
- isSelectable,
5180
- minMonth,
5181
- maxMonth,
5182
- intlLocale,
5183
- prevLabel,
5184
- nextLabel,
5185
- onSelect
5186
- }) => {
5187
- const minIdx = monthIndex(minMonth.year, minMonth.month);
5188
- const maxIdx = monthIndex(maxMonth.year, maxMonth.month);
5189
- const clampToRange = React21.useCallback(
5190
- (date) => {
5191
- const idx = monthIndex(date.year, date.month);
5192
- if (idx < minIdx) return { ...minMonth, day: 1 };
5193
- if (idx > maxIdx) return { ...maxMonth, day: daysIn(maxMonth.year, maxMonth.month) };
5194
- return date;
5195
- },
5196
- [minIdx, maxIdx, minMonth, maxMonth]
5197
- );
5198
- const [focused, setFocused] = React21.useState(() => clampToRange(selected ?? today));
5199
- const view = { year: focused.year, month: focused.month };
5200
- const viewIdx = monthIndex(view.year, view.month);
5201
- const gridRef = React21.useRef(null);
5202
- const moveFocusRef = React21.useRef(false);
5203
- React21.useEffect(() => {
5204
- if (!moveFocusRef.current) return;
5205
- moveFocusRef.current = false;
5206
- gridRef.current?.querySelector('button[tabindex="0"]')?.focus();
5207
- });
5208
- const titleId = React21.useId();
5209
- const fmt = React21.useMemo(
5210
- () => ({
5211
- title: new Intl.DateTimeFormat(intlLocale, { year: "numeric", month: "long" }),
5212
- weekdayShort: new Intl.DateTimeFormat(intlLocale, { weekday: "narrow" }),
5213
- weekdayLong: new Intl.DateTimeFormat(intlLocale, { weekday: "long" }),
5214
- full: new Intl.DateTimeFormat(intlLocale, { dateStyle: "full" })
5215
- }),
5216
- [intlLocale]
5217
- );
5218
- const weekdays = WEEK.map((i) => {
5219
- const d = new Date(2026, 9, 4 + i);
5220
- return { short: fmt.weekdayShort.format(d), long: fmt.weekdayLong.format(d) };
5221
- });
5222
- const firstWeekday = new Date(view.year, view.month - 1, 1).getDay();
5223
- const total = daysIn(view.year, view.month);
5224
- const cells = Array.from({ length: ROWS * 7 }, (_, i) => {
5225
- const day = i - firstWeekday + 1;
5226
- return day >= 1 && day <= total ? { ...view, day } : null;
5227
- });
5228
- const moveTo = (next) => {
5229
- moveFocusRef.current = true;
5230
- setFocused(clampToRange(next));
5231
- };
5232
- const goMonth = (n) => setFocused((f) => clampToRange(addMonths(f, n)));
5233
- const handleKeyDown2 = (e) => {
5234
- if (e.altKey || e.ctrlKey || e.metaKey) return;
5235
- const weekday = toDate(focused).getDay();
5236
- const moves = {
5237
- ArrowLeft: () => addDays(focused, -1),
5238
- ArrowRight: () => addDays(focused, 1),
5239
- ArrowUp: () => addDays(focused, -7),
5240
- ArrowDown: () => addDays(focused, 7),
5241
- Home: () => addDays(focused, -weekday),
5242
- End: () => addDays(focused, 6 - weekday),
5243
- PageUp: () => addMonths(focused, e.shiftKey ? -12 : -1),
5244
- PageDown: () => addMonths(focused, e.shiftKey ? 12 : 1)
5245
- };
5246
- const move = moves[e.key];
5247
- if (!move) return;
5248
- e.preventDefault();
5249
- moveTo(move());
5250
- };
5251
- return /* @__PURE__ */ jsxs("div", { className: "date_calendar", children: [
5252
- /* @__PURE__ */ jsxs("div", { className: "date_calendar_header", children: [
5253
- /* @__PURE__ */ jsx(
5254
- "button",
5255
- {
5256
- type: "button",
5257
- className: "date_calendar_nav",
5258
- "aria-label": prevLabel,
5259
- onClick: () => goMonth(-1),
5260
- disabled: viewIdx <= minIdx,
5261
- "data-focus-trap-skip-autofocus": "",
5262
- children: /* @__PURE__ */ jsx(ChevronLeft, { size: iconSize.md, "aria-hidden": "true" })
5263
- }
5264
- ),
5265
- /* @__PURE__ */ jsx("span", { className: "date_calendar_title", id: titleId, "aria-live": "polite", children: fmt.title.format(new Date(view.year, view.month - 1, 1)) }),
5266
- /* @__PURE__ */ jsx(
5267
- "button",
5268
- {
5269
- type: "button",
5270
- className: "date_calendar_nav",
5271
- "aria-label": nextLabel,
5272
- onClick: () => goMonth(1),
5273
- disabled: viewIdx >= maxIdx,
5274
- "data-focus-trap-skip-autofocus": "",
5275
- children: /* @__PURE__ */ jsx(ChevronRight, { size: iconSize.md, "aria-hidden": "true" })
5276
- }
5277
- )
5278
- ] }),
5279
- /* @__PURE__ */ jsxs("table", { ref: gridRef, className: "date_calendar_grid", role: "grid", "aria-labelledby": titleId, children: [
5280
- /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: weekdays.map((w) => /* @__PURE__ */ jsx("th", { scope: "col", abbr: w.long, className: "date_calendar_weekday", children: w.short }, w.long)) }) }),
5281
- /* @__PURE__ */ jsx("tbody", { children: Array.from({ length: ROWS }, (_, row) => (
5282
- // biome-ignore lint/suspicious/noArrayIndexKey: 줄은 위치 자체가 정체성이다(달이 바뀌어도 6줄)
5283
- /* @__PURE__ */ jsx("tr", { children: cells.slice(row * 7, row * 7 + 7).map((cell, col) => {
5284
- if (!cell) {
5285
- return /* @__PURE__ */ jsx("td", { className: "date_calendar_cell" }, `empty-${col}`);
5286
- }
5287
- const selectable = isSelectable(cell);
5288
- const isSelected = sameDay(cell, selected);
5289
- return (
5290
- // biome-ignore lint/a11y/useFocusableInteractive: 포커스는 칸 안 button 이 받는다 - 칸과 버튼이 둘 다 받으면 Tab 이 달력 안에서 두 번 멈춘다
5291
- /* @__PURE__ */ jsx(
5292
- "td",
5293
- {
5294
- role: "gridcell",
5295
- "aria-selected": isSelected,
5296
- className: "date_calendar_cell",
5297
- children: /* @__PURE__ */ jsx(
5298
- "button",
5299
- {
5300
- type: "button",
5301
- className: cn("date_calendar_day", {
5302
- date_calendar_day_selected: isSelected,
5303
- date_calendar_day_today: sameDay(cell, today)
5304
- }),
5305
- tabIndex: sameDay(cell, focused) ? 0 : -1,
5306
- "data-focus-trap-skip-autofocus": sameDay(cell, focused) ? void 0 : "",
5307
- "aria-label": fmt.full.format(toDate(cell)),
5308
- "aria-current": sameDay(cell, today) ? "date" : void 0,
5309
- "aria-disabled": selectable ? void 0 : true,
5310
- onClick: () => {
5311
- setFocused(cell);
5312
- if (selectable) onSelect(cell);
5313
- },
5314
- onKeyDown: handleKeyDown2,
5315
- children: cell.day
5316
- }
5317
- )
5318
- },
5319
- cell.day
5320
- )
5321
- );
5322
- }) }, row)
5323
- )) })
5324
- ] })
5325
- ] });
5703
+ var pad2 = (n) => String(n).padStart(2, "0");
5704
+ var toIso = ({ year, month, day }) => `${year}-${pad2(month)}-${pad2(day)}`;
5705
+ var fromIso = (iso) => {
5706
+ const [year = 0, month = 0, day = 0] = iso.split("-").map(Number);
5707
+ return { year, month, day };
5326
5708
  };
5327
- var pad = (n) => String(n).padStart(2, "0");
5709
+ var pad3 = (n) => String(n).padStart(2, "0");
5328
5710
  var getDaysInMonth = (year, month) => new Date(year, month, 0).getDate();
5329
5711
  var normalizeWidth = (v) => typeof v === "number" ? `${v}px` : v;
5330
5712
  var range2 = (start, end) => Array.from({ length: end - start + 1 }, (_, i) => start + i);
@@ -5359,9 +5741,9 @@ var DatePicker = ({
5359
5741
  const selectableRangeUntilTodaySrText = selectableRangeUntilTodaySrTextProp ?? t("datePicker.rangeUntilTodaySr");
5360
5742
  const field = useFieldControl();
5361
5743
  const isRequired = field ? field.required || void 0 : required || void 0;
5362
- const groupId = React21.useId();
5363
- const constraintId = React21.useId();
5364
- const { todayYear, todayMonth, todayDay } = React21.useMemo(() => {
5744
+ const groupId = React22.useId();
5745
+ const constraintId = React22.useId();
5746
+ const { todayYear, todayMonth, todayDay } = React22.useMemo(() => {
5365
5747
  const now = /* @__PURE__ */ new Date();
5366
5748
  return {
5367
5749
  todayYear: now.getFullYear(),
@@ -5370,7 +5752,7 @@ var DatePicker = ({
5370
5752
  };
5371
5753
  }, []);
5372
5754
  const endYear = endYearProp ?? todayYear + 10;
5373
- const parsed = React21.useMemo(() => {
5755
+ const parsed = React22.useMemo(() => {
5374
5756
  if (!value) return { year: 0, month: 0, day: 0 };
5375
5757
  const [y, m, d] = value.split("-").map(Number);
5376
5758
  return {
@@ -5379,7 +5761,7 @@ var DatePicker = ({
5379
5761
  day: d || 0
5380
5762
  };
5381
5763
  }, [value]);
5382
- const min = React21.useMemo(() => {
5764
+ const min = React22.useMemo(() => {
5383
5765
  if (!minDate) return { year: 0, month: 0, day: 0 };
5384
5766
  const [y, m, d] = minDate.split("-").map(Number);
5385
5767
  return {
@@ -5392,7 +5774,7 @@ var DatePicker = ({
5392
5774
  const maxYear = selectableRange === "until-today" ? todayYear : endYear;
5393
5775
  const minMonth = min.year > 0 && year === min.year ? Math.min(12, Math.max(1, min.month)) : 1;
5394
5776
  const maxMonth = selectableRange === "until-today" && year === todayYear ? todayMonth : 12;
5395
- const dayBoundsFor = React21.useCallback(
5777
+ const dayBoundsFor = React22.useCallback(
5396
5778
  (yy, mm) => {
5397
5779
  if (!yy || !mm) return { min: 1, max: 31 };
5398
5780
  const daysInMonth = getDaysInMonth(yy, mm);
@@ -5402,37 +5784,37 @@ var DatePicker = ({
5402
5784
  },
5403
5785
  [min.year, min.month, min.day, selectableRange, todayYear, todayMonth, todayDay]
5404
5786
  );
5405
- const { min: minDay, max: maxDay } = React21.useMemo(
5787
+ const { min: minDay, max: maxDay } = React22.useMemo(
5406
5788
  () => dayBoundsFor(year, month),
5407
5789
  [dayBoundsFor, year, month]
5408
5790
  );
5409
5791
  const hasSelectableDay = maxDay >= minDay;
5410
5792
  const minYear = min.year > 0 ? Math.max(startYear, min.year) : startYear;
5411
- const yearOptions = React21.useMemo(
5793
+ const yearOptions = React22.useMemo(
5412
5794
  () => range2(minYear, maxYear).map((y) => ({
5413
5795
  value: String(y),
5414
5796
  label: String(y)
5415
5797
  })),
5416
5798
  [minYear, maxYear]
5417
5799
  );
5418
- const monthOptions = React21.useMemo(
5800
+ const monthOptions = React22.useMemo(
5419
5801
  () => range2(minMonth, maxMonth).filter((m) => {
5420
5802
  const bounds = dayBoundsFor(year, m);
5421
5803
  return bounds.max >= bounds.min;
5422
5804
  }).map((m) => ({
5423
5805
  value: String(m),
5424
- label: pad(m)
5806
+ label: pad3(m)
5425
5807
  })),
5426
5808
  [minMonth, maxMonth, dayBoundsFor, year]
5427
5809
  );
5428
- const dayOptions = React21.useMemo(
5810
+ const dayOptions = React22.useMemo(
5429
5811
  () => hasSelectableDay ? range2(minDay, maxDay).map((d) => ({
5430
5812
  value: String(d),
5431
- label: pad(d)
5813
+ label: pad3(d)
5432
5814
  })) : [],
5433
5815
  [minDay, maxDay, hasSelectableDay]
5434
5816
  );
5435
- const withinRange = React21.useCallback(
5817
+ const withinRange = React22.useCallback(
5436
5818
  (yy, mm, dd) => {
5437
5819
  const point = yy * 1e4 + mm * 100 + dd;
5438
5820
  if (min.year > 0) {
@@ -5447,24 +5829,24 @@ var DatePicker = ({
5447
5829
  },
5448
5830
  [min.year, min.month, min.day, selectableRange, todayYear, todayMonth, todayDay]
5449
5831
  );
5450
- const emit = React21.useCallback(
5832
+ const emit = React22.useCallback(
5451
5833
  (yy, mm, dd) => {
5452
5834
  const cb = onValueChange ?? onChange;
5453
5835
  if (mode === "year-month") {
5454
5836
  const monthBounds = dayBoundsFor(yy, mm);
5455
5837
  if (monthBounds.max < monthBounds.min) return;
5456
- cb?.(`${yy}-${pad(mm)}`);
5838
+ cb?.(`${yy}-${pad3(mm)}`);
5457
5839
  return;
5458
5840
  }
5459
5841
  const bounds = dayBoundsFor(yy, mm);
5460
5842
  if (bounds.max < bounds.min) return;
5461
5843
  const safeDay = Math.min(Math.max(dd ?? bounds.min, bounds.min), bounds.max);
5462
5844
  if (!withinRange(yy, mm, safeDay)) return;
5463
- cb?.(`${yy}-${pad(mm)}-${pad(safeDay)}`);
5845
+ cb?.(`${yy}-${pad3(mm)}-${pad3(safeDay)}`);
5464
5846
  },
5465
5847
  [mode, onValueChange, onChange, dayBoundsFor, withinRange]
5466
5848
  );
5467
- const handleYearChange = React21.useCallback(
5849
+ const handleYearChange = React22.useCallback(
5468
5850
  (raw) => {
5469
5851
  if (!raw) return;
5470
5852
  const newYear = Number(raw);
@@ -5481,14 +5863,14 @@ var DatePicker = ({
5481
5863
  },
5482
5864
  [month, day, min.year, min.month, selectableRange, todayYear, todayMonth, emit]
5483
5865
  );
5484
- const handleMonthChange = React21.useCallback(
5866
+ const handleMonthChange = React22.useCallback(
5485
5867
  (raw) => {
5486
5868
  if (!raw || !year) return;
5487
5869
  emit(year, Number(raw), day || void 0);
5488
5870
  },
5489
5871
  [year, day, emit]
5490
5872
  );
5491
- const handleDayChange = React21.useCallback(
5873
+ const handleDayChange = React22.useCallback(
5492
5874
  (raw) => {
5493
5875
  if (!raw || !year || !month) return;
5494
5876
  emit(year, month, Number(raw));
@@ -5622,9 +6004,9 @@ var CalendarField = ({
5622
6004
  nextLabel,
5623
6005
  onSelect
5624
6006
  }) => {
5625
- const [open, setOpen] = React21.useState(false);
5626
- const valueId = React21.useId();
5627
- const valueText = React21.useMemo(() => {
6007
+ const [open, setOpen] = React22.useState(false);
6008
+ const valueId = React22.useId();
6009
+ const valueText = React22.useMemo(() => {
5628
6010
  if (!selected) return null;
5629
6011
  const options = intlLocale.startsWith("ko") ? { year: "numeric", month: "2-digit", day: "2-digit", weekday: "short" } : { year: "numeric", month: "short", day: "numeric", weekday: "short" };
5630
6012
  return new Intl.DateTimeFormat(intlLocale, options).format(
@@ -5668,16 +6050,15 @@ var CalendarField = ({
5668
6050
  content: /* @__PURE__ */ jsx(
5669
6051
  DateCalendar,
5670
6052
  {
5671
- selected,
5672
- today,
5673
- isSelectable,
5674
- minMonth,
5675
- maxMonth,
5676
- intlLocale,
5677
- prevLabel,
5678
- nextLabel,
5679
- onSelect: (date) => {
5680
- onSelect(date);
6053
+ value: selected ? toIso(selected) : null,
6054
+ today: toIso(today),
6055
+ min: toIso({ ...minMonth, day: 1 }),
6056
+ max: toIso({ ...maxMonth, day: new Date(maxMonth.year, maxMonth.month, 0).getDate() }),
6057
+ isDateDisabled: (iso) => !isSelectable(fromIso(iso)),
6058
+ prevMonthLabel: prevLabel,
6059
+ nextMonthLabel: nextLabel,
6060
+ onValueChange: (iso) => {
6061
+ onSelect(fromIso(iso));
5681
6062
  setOpen(false);
5682
6063
  }
5683
6064
  }
@@ -5780,13 +6161,13 @@ var FileInput = ({
5780
6161
  }) => {
5781
6162
  const t = useLocaleText();
5782
6163
  const label = labelProp ?? t("fileInput.label");
5783
- const generatedInputId = React21.useId();
5784
- const helperId = React21.useId();
6164
+ const generatedInputId = React22.useId();
6165
+ const helperId = React22.useId();
5785
6166
  const field = useFieldControl();
5786
6167
  const inputId = field?.inputId ?? generatedInputId;
5787
- const inputRef = React21.useRef(null);
5788
- const [previewUrls, setPreviewUrls] = React21.useState([]);
5789
- const previewUrlsRef = React21.useRef([]);
6168
+ const inputRef = React22.useRef(null);
6169
+ const [previewUrls, setPreviewUrls] = React22.useState([]);
6170
+ const previewUrlsRef = React22.useRef([]);
5790
6171
  const isPreviewVariant = variant === "preview";
5791
6172
  const showPreview = isPreviewVariant || preview;
5792
6173
  const handleChange = (e) => {
@@ -5828,7 +6209,7 @@ var FileInput = ({
5828
6209
  }
5829
6210
  onFiles?.(null);
5830
6211
  };
5831
- React21.useEffect(() => {
6212
+ React22.useEffect(() => {
5832
6213
  return () => {
5833
6214
  for (const url of previewUrlsRef.current) {
5834
6215
  URL.revokeObjectURL(url);
@@ -5892,6 +6273,68 @@ var FileInput = ({
5892
6273
  )) })
5893
6274
  ] });
5894
6275
  };
6276
+ var FilterBar = ({
6277
+ children,
6278
+ submitMode = "submit",
6279
+ onSubmit,
6280
+ onReset,
6281
+ canSubmit = true,
6282
+ canReset = true,
6283
+ loading = false,
6284
+ disabled = false,
6285
+ submitLabel: submitLabelProp,
6286
+ resetLabel: resetLabelProp,
6287
+ fieldMinWidth = 200,
6288
+ className,
6289
+ style,
6290
+ ...props
6291
+ }) => {
6292
+ const t = useLocaleText();
6293
+ const submitLabel = submitLabelProp ?? t("filterBar.submit");
6294
+ const resetLabel = resetLabelProp ?? t("filterBar.reset");
6295
+ const submitBlocked = disabled || loading || !canSubmit;
6296
+ const showSubmit = submitMode === "submit";
6297
+ const showActions = Boolean(onReset) || showSubmit;
6298
+ return (
6299
+ // biome-ignore lint/a11y/useSemanticElements: `<search>` 는 Safari 17 · Chrome 118 부터라 그 이전엔 랜드마크가 사라진다. form 에 role 을 두면 aria-label 과 form 속성이 한 요소에 모인다
6300
+ /* @__PURE__ */ jsxs(
6301
+ "form",
6302
+ {
6303
+ ...props,
6304
+ noValidate: true,
6305
+ role: "search",
6306
+ "aria-busy": loading || void 0,
6307
+ className: cn("filter_bar", className),
6308
+ style: {
6309
+ ...style,
6310
+ "--filter-bar-field-min": typeof fieldMinWidth === "number" ? `${fieldMinWidth}px` : fieldMinWidth
6311
+ },
6312
+ onSubmit: (e) => {
6313
+ e.preventDefault();
6314
+ if (!showSubmit) return;
6315
+ if (!submitBlocked) onSubmit?.();
6316
+ },
6317
+ children: [
6318
+ /* @__PURE__ */ jsx("div", { className: "filter_bar_fields", children }),
6319
+ showActions ? /* @__PURE__ */ jsxs("div", { className: "filter_bar_actions", children: [
6320
+ onReset ? /* @__PURE__ */ jsx(Button, { type: "button", variant: "text", disabled: disabled || !canReset, onClick: onReset, children: resetLabel }) : null,
6321
+ showSubmit ? /* @__PURE__ */ jsx(
6322
+ Button,
6323
+ {
6324
+ type: "submit",
6325
+ disabled: disabled || !canSubmit,
6326
+ "aria-disabled": loading || void 0,
6327
+ leadingIcon: loading ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: /* @__PURE__ */ jsx(Spinner, { size: 16 }) }) : void 0,
6328
+ children: submitLabel
6329
+ }
6330
+ ) : null
6331
+ ] }) : null
6332
+ ]
6333
+ }
6334
+ )
6335
+ );
6336
+ };
6337
+ FilterBar.displayName = "FilterBar";
5895
6338
 
5896
6339
  // src/ui/forms/image-cropper/crop.util.ts
5897
6340
  var getCoverScale = (image, viewportSize) => Math.max(viewportSize / image.width, viewportSize / image.height);
@@ -6236,17 +6679,19 @@ var OtpInput = ({
6236
6679
  }) => {
6237
6680
  const t = useLocaleText();
6238
6681
  const ariaLabel = ariaLabelProp ?? t("otpInput.label");
6239
- const inputsRef = React21.useRef([]);
6240
- const isTypingRef = React21.useRef(false);
6241
- const typingTimerRef = React21.useRef(void 0);
6242
- React21.useEffect(() => {
6682
+ const inputsRef = React22.useRef([]);
6683
+ const isTypingRef = React22.useRef(false);
6684
+ const typingTimerRef = React22.useRef(void 0);
6685
+ React22.useEffect(() => {
6243
6686
  if (autoFocus) inputsRef.current[0]?.focus();
6244
6687
  }, [autoFocus]);
6245
- const digits = React21.useMemo(() => {
6688
+ const digits = React22.useMemo(() => {
6246
6689
  const chars = value.split("").slice(0, length);
6247
6690
  while (chars.length < length) chars.push("");
6248
6691
  return chars;
6249
6692
  }, [value, length]);
6693
+ const firstEmpty = digits.indexOf("");
6694
+ const tabStop = firstEmpty === -1 ? length - 1 : firstEmpty;
6250
6695
  const focusInput = (index) => {
6251
6696
  inputsRef.current[index]?.focus();
6252
6697
  };
@@ -6277,10 +6722,9 @@ var OtpInput = ({
6277
6722
  }, 50);
6278
6723
  }
6279
6724
  };
6280
- React21.useEffect(() => () => clearTimeout(typingTimerRef.current), []);
6725
+ React22.useEffect(() => () => clearTimeout(typingTimerRef.current), []);
6281
6726
  const handleFocus = (index) => {
6282
6727
  if (isTypingRef.current) return;
6283
- const firstEmpty = digits.indexOf("");
6284
6728
  if (firstEmpty !== -1 && firstEmpty < index) {
6285
6729
  focusInput(firstEmpty);
6286
6730
  }
@@ -6319,7 +6763,7 @@ var OtpInput = ({
6319
6763
  focusInput(nextIndex);
6320
6764
  };
6321
6765
  const rootClassName = cn("otp_input", className);
6322
- const supportingId = React21.useId();
6766
+ const supportingId = React22.useId();
6323
6767
  const field = useFieldControl();
6324
6768
  return (
6325
6769
  // biome-ignore lint/a11y/useSemanticElements: <fieldset> would force border/legend styles; role=group is the WAI-ARIA equivalent for OTP grouping
@@ -6343,6 +6787,7 @@ var OtpInput = ({
6343
6787
  maxLength: 1,
6344
6788
  autoComplete: i === 0 ? "one-time-code" : "off",
6345
6789
  value: digit,
6790
+ tabIndex: i === tabStop ? 0 : -1,
6346
6791
  onChange: (e) => handleChange(i, e),
6347
6792
  onFocus: () => handleFocus(i),
6348
6793
  onKeyDown: (e) => handleKeyDown2(i, e),
@@ -6374,9 +6819,9 @@ var OtpInput = ({
6374
6819
  );
6375
6820
  };
6376
6821
  OtpInput.displayName = "OtpInput";
6377
- var RadioGroupContext = React21.createContext(null);
6822
+ var RadioGroupContext = React22.createContext(null);
6378
6823
  function useRadioGroupContext() {
6379
- return React21.useContext(RadioGroupContext);
6824
+ return React22.useContext(RadioGroupContext);
6380
6825
  }
6381
6826
  var RadioGroup = ({
6382
6827
  value: controlledValue,
@@ -6394,23 +6839,23 @@ var RadioGroup = ({
6394
6839
  ...props
6395
6840
  }) => {
6396
6841
  const isControlled = controlledValue !== void 0;
6397
- const [internalValue, setInternalValue] = React21.useState(defaultValue);
6842
+ const [internalValue, setInternalValue] = React22.useState(defaultValue);
6398
6843
  const value = isControlled ? controlledValue : internalValue;
6399
- const generatedName = React21.useId();
6844
+ const generatedName = React22.useId();
6400
6845
  const name = nameProp ?? generatedName;
6401
- const idPrefix = React21.useId();
6846
+ const idPrefix = React22.useId();
6402
6847
  const field = useFieldControl();
6403
6848
  const labelId = label ? `${idPrefix}-label` : void 0;
6404
6849
  const helperId = supportingText ? `${idPrefix}-help` : void 0;
6405
6850
  const { ariaProps, restProps } = splitAriaProps(props);
6406
- const onChange = React21.useCallback(
6851
+ const onChange = React22.useCallback(
6407
6852
  (next) => {
6408
6853
  if (!isControlled) setInternalValue(next);
6409
6854
  onValueChange?.(next);
6410
6855
  },
6411
6856
  [isControlled, onValueChange]
6412
6857
  );
6413
- const ctx = React21.useMemo(
6858
+ const ctx = React22.useMemo(
6414
6859
  () => ({ name, value, onChange, size, disabled }),
6415
6860
  [name, value, onChange, size, disabled]
6416
6861
  );
@@ -6491,6 +6936,101 @@ var Radio = ({
6491
6936
  ] });
6492
6937
  };
6493
6938
  Radio.displayName = "Radio";
6939
+ var SegmentedControl = ({
6940
+ items,
6941
+ value: controlledValue,
6942
+ defaultValue,
6943
+ onValueChange,
6944
+ name: nameProp,
6945
+ size = "md",
6946
+ fullWidth = false,
6947
+ disabled = false,
6948
+ required = false,
6949
+ className,
6950
+ onKeyDown: onKeyDownProp,
6951
+ ...props
6952
+ }) => {
6953
+ const isControlled = controlledValue !== void 0;
6954
+ const [internalValue, setInternalValue] = React22.useState(defaultValue);
6955
+ const value = isControlled ? controlledValue : internalValue;
6956
+ const generatedName = React22.useId();
6957
+ const name = nameProp ?? generatedName;
6958
+ const field = useFieldControl();
6959
+ const { ariaProps, restProps } = splitAriaProps(props);
6960
+ const isRequired = required || !!field?.required;
6961
+ const select = (next) => {
6962
+ if (!isControlled) setInternalValue(next);
6963
+ onValueChange?.(next);
6964
+ };
6965
+ const onKeyDown = (e) => {
6966
+ onKeyDownProp?.(e);
6967
+ if (e.defaultPrevented || e.key !== "Home" && e.key !== "End") return;
6968
+ const enabled = items.filter((item) => !(disabled || item.disabled));
6969
+ const target = e.key === "Home" ? enabled[0] : enabled.at(-1);
6970
+ if (!target) return;
6971
+ e.preventDefault();
6972
+ select(target.value);
6973
+ const input = e.currentTarget.querySelector(
6974
+ `input[value="${CSS.escape(target.value)}"]`
6975
+ );
6976
+ input?.focus();
6977
+ };
6978
+ return /* @__PURE__ */ jsx(
6979
+ "div",
6980
+ {
6981
+ role: "radiogroup",
6982
+ ...restProps,
6983
+ ...ariaProps,
6984
+ "aria-labelledby": field?.labelId ?? ariaProps["aria-labelledby"],
6985
+ "aria-describedby": field?.describedBy ?? ariaProps["aria-describedby"],
6986
+ "aria-invalid": field ? field.invalid || void 0 : ariaProps["aria-invalid"],
6987
+ "aria-required": isRequired || void 0,
6988
+ "aria-disabled": disabled || void 0,
6989
+ className: cn(
6990
+ "segmented_control",
6991
+ `segmented_control_size_${size}`,
6992
+ fullWidth && "segmented_control_full_width",
6993
+ disabled && "segmented_control_disabled",
6994
+ className
6995
+ ),
6996
+ onKeyDown,
6997
+ children: items.map((item) => {
6998
+ const selected = item.value === value;
6999
+ const itemDisabled = disabled || !!item.disabled;
7000
+ return /* @__PURE__ */ jsxs(
7001
+ "label",
7002
+ {
7003
+ className: cn(
7004
+ "segmented_control_item",
7005
+ selected && "segmented_control_item_selected",
7006
+ itemDisabled && "segmented_control_item_disabled"
7007
+ ),
7008
+ children: [
7009
+ /* @__PURE__ */ jsx(
7010
+ "input",
7011
+ {
7012
+ type: "radio",
7013
+ className: "segmented_control_input",
7014
+ name,
7015
+ value: item.value,
7016
+ checked: selected,
7017
+ disabled: itemDisabled,
7018
+ required: isRequired,
7019
+ "aria-label": item.ariaLabel,
7020
+ onChange: () => select(item.value)
7021
+ }
7022
+ ),
7023
+ item.icon && /* @__PURE__ */ jsx("span", { className: "segmented_control_icon", "aria-hidden": "true", children: item.icon }),
7024
+ item.label != null && /* @__PURE__ */ jsx("span", { className: "segmented_control_label", children: item.label })
7025
+ ]
7026
+ },
7027
+ item.value
7028
+ );
7029
+ })
7030
+ }
7031
+ );
7032
+ };
7033
+ SegmentedControl.displayName = "SegmentedControl";
6494
7034
  var SEPARATORS = /[,\t\n\r]+/;
6495
7035
  var splitTags = (text) => text.split(SEPARATORS).map((part) => part.trim()).filter(Boolean);
6496
7036
  var TagInput = ({
@@ -6777,7 +7317,7 @@ var toMinutes = (value) => {
6777
7317
  if (h < 0 || h > 23 || m < 0 || m > 59) return null;
6778
7318
  return h * 60 + m;
6779
7319
  };
6780
- var pad2 = (n) => String(n).padStart(2, "0");
7320
+ var pad4 = (n) => String(n).padStart(2, "0");
6781
7321
  var TimePicker = ({
6782
7322
  label,
6783
7323
  value,
@@ -6796,27 +7336,27 @@ var TimePicker = ({
6796
7336
  const minuteLabel = minuteLabelProp ?? t("timePicker.minute");
6797
7337
  const field = useFieldControl();
6798
7338
  const isRequired = field ? field.required || void 0 : required || void 0;
6799
- const groupId = React21.useId();
6800
- const constraintId = React21.useId();
7339
+ const groupId = React22.useId();
7340
+ const constraintId = React22.useId();
6801
7341
  const min = toMinutes(minTime) ?? 0;
6802
7342
  const max = toMinutes(maxTime) ?? 23 * 60 + 59;
6803
7343
  const parsed = toMinutes(value);
6804
7344
  const hour = parsed === null ? null : Math.floor(parsed / 60);
6805
7345
  const minute = parsed === null ? null : parsed % 60;
6806
- const hourOptions = React21.useMemo(() => {
7346
+ const hourOptions = React22.useMemo(() => {
6807
7347
  const first = Math.floor(min / 60);
6808
7348
  const last = Math.floor(max / 60);
6809
7349
  return Array.from({ length: Math.max(0, last - first + 1) }, (_, i) => {
6810
7350
  const h = first + i;
6811
- return { value: String(h), label: pad2(h) };
7351
+ return { value: String(h), label: pad4(h) };
6812
7352
  });
6813
7353
  }, [min, max]);
6814
- const minuteOptions = React21.useMemo(() => {
7354
+ const minuteOptions = React22.useMemo(() => {
6815
7355
  if (hour === null) return [];
6816
7356
  const step = Math.max(1, Math.floor(minuteStep));
6817
- 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) }));
7357
+ 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: pad4(m) }));
6818
7358
  }, [hour, minuteStep, min, max]);
6819
- const emit = (h, m) => onValueChange(`${pad2(h)}:${pad2(m)}`);
7359
+ const emit = (h, m) => onValueChange(`${pad4(h)}:${pad4(m)}`);
6820
7360
  const handleHourChange = (raw) => {
6821
7361
  if (!raw) return;
6822
7362
  const h = Number(raw);
@@ -6901,7 +7441,7 @@ var Toggle = ({
6901
7441
  ...props
6902
7442
  }) => {
6903
7443
  const isControlled = checked !== void 0;
6904
- const [innerChecked, setInnerChecked] = React21.useState(!!defaultChecked);
7444
+ const [innerChecked, setInnerChecked] = React22.useState(!!defaultChecked);
6905
7445
  const isOn = isControlled ? !!checked : innerChecked;
6906
7446
  const handleToggle = (e) => {
6907
7447
  props.onClick?.(e);
@@ -6956,6 +7496,59 @@ var IconButton = ({
6956
7496
  );
6957
7497
  return /* @__PURE__ */ jsx("button", { ref, type, className: buttonClassName, ...props, children: /* @__PURE__ */ jsx("span", { className: "icon_button_icon", "aria-hidden": "true", children: icon }) });
6958
7498
  };
7499
+ var CopyButton = ({
7500
+ text,
7501
+ label: labelProp,
7502
+ copiedLabel: copiedLabelProp,
7503
+ failedLabel: failedLabelProp,
7504
+ iconOnly = false,
7505
+ size = "sm",
7506
+ variant = "outline",
7507
+ resetAfter = 2e3,
7508
+ onCopy,
7509
+ onError,
7510
+ className,
7511
+ ...props
7512
+ }) => {
7513
+ const t = useLocaleText();
7514
+ const label = labelProp ?? t("copyButton.copy");
7515
+ const copiedLabel = copiedLabelProp ?? t("copyButton.copied");
7516
+ const failedLabel = failedLabelProp ?? t("copyButton.failed");
7517
+ const { copy, status } = useClipboard({ resetAfter, onCopy, onError });
7518
+ const copied = status === "copied";
7519
+ const handleClick = () => {
7520
+ void copy(text);
7521
+ };
7522
+ const icon = copied ? /* @__PURE__ */ jsx(Check, { size: iconSize.sm }) : /* @__PURE__ */ jsx(Copy, { size: iconSize.sm });
7523
+ const message = copied ? copiedLabel : status === "error" ? failedLabel : "";
7524
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
7525
+ iconOnly ? /* @__PURE__ */ jsx(
7526
+ IconButton,
7527
+ {
7528
+ ...props,
7529
+ size,
7530
+ icon,
7531
+ "aria-label": label,
7532
+ className,
7533
+ onClick: handleClick
7534
+ }
7535
+ ) : /* @__PURE__ */ jsx(
7536
+ Button,
7537
+ {
7538
+ ...props,
7539
+ size,
7540
+ variant,
7541
+ leadingIcon: icon,
7542
+ "aria-label": label,
7543
+ className,
7544
+ onClick: handleClick,
7545
+ children: /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: copied ? copiedLabel : label })
7546
+ }
7547
+ ),
7548
+ /* @__PURE__ */ jsx("span", { className: "copy_button_status", role: "status", children: message })
7549
+ ] });
7550
+ };
7551
+ CopyButton.displayName = "CopyButton";
6959
7552
  var SLIDE_FROM = {
6960
7553
  left: "translateX(-100%)",
6961
7554
  right: "translateX(100%)",
@@ -6982,16 +7575,16 @@ var Drawer = ({
6982
7575
  }) => {
6983
7576
  const t = useLocaleText();
6984
7577
  const closeLabel = closeLabelProp ?? t("drawer.close");
6985
- const lastContentRef = React21.useRef({ children, title, footer });
7578
+ const lastContentRef = React22.useRef({ children, title, footer });
6986
7579
  if (open) lastContentRef.current = { children, title, footer };
6987
7580
  const content = open ? { children, title, footer } : lastContentRef.current;
6988
7581
  const overlayDismissible = dismissible ?? closeOnOverlay;
6989
7582
  const escapeDismissible = dismissible ?? true;
6990
- const panelRef = React21.useRef(null);
6991
- const bodyRef = React21.useRef(null);
6992
- const pressedOverlayRef = React21.useRef(false);
6993
- const titleId = React21.useId();
6994
- const [shouldRender, setShouldRender] = React21.useState(open);
7583
+ const panelRef = React22.useRef(null);
7584
+ const bodyRef = React22.useRef(null);
7585
+ const pressedOverlayRef = React22.useRef(false);
7586
+ const titleId = React22.useId();
7587
+ const [shouldRender, setShouldRender] = React22.useState(open);
6995
7588
  const instant = useReducedMotion() || disableAnimation;
6996
7589
  const isMounted = useIsMounted();
6997
7590
  useFocusTrap(panelRef, open && isMounted, {
@@ -7002,13 +7595,13 @@ var Drawer = ({
7002
7595
  if (escapeDismissible) onClose?.();
7003
7596
  });
7004
7597
  if (open && !shouldRender) setShouldRender(true);
7005
- const renderingRef = React21.useRef(shouldRender);
7006
- const onExitedRef = React21.useRef(onExited);
7598
+ const renderingRef = React22.useRef(shouldRender);
7599
+ const onExitedRef = React22.useRef(onExited);
7007
7600
  useSafeLayoutEffect(() => {
7008
7601
  renderingRef.current = shouldRender;
7009
7602
  onExitedRef.current = onExited;
7010
7603
  });
7011
- const finishExit = React21.useCallback(() => {
7604
+ const finishExit = React22.useCallback(() => {
7012
7605
  if (!renderingRef.current) return;
7013
7606
  renderingRef.current = false;
7014
7607
  setShouldRender(false);
@@ -7025,7 +7618,7 @@ var Drawer = ({
7025
7618
  }
7026
7619
  });
7027
7620
  const overlayOpacity = overlayStyle.opacity;
7028
- React21.useEffect(() => {
7621
+ React22.useEffect(() => {
7029
7622
  if (open || !shouldRender) return;
7030
7623
  const frame = requestAnimationFrame(() => {
7031
7624
  if (!overlayOpacity.isAnimating && overlayOpacity.get() === 0) finishExit();
@@ -7040,7 +7633,7 @@ var Drawer = ({
7040
7633
  immediate: instant,
7041
7634
  config: OVERLAY_SPRING_CONFIG
7042
7635
  });
7043
- React21.useEffect(() => {
7636
+ React22.useEffect(() => {
7044
7637
  if (!shouldRender) return;
7045
7638
  lockBodyScroll();
7046
7639
  return () => {
@@ -7128,16 +7721,16 @@ var Modal = ({
7128
7721
  }) => {
7129
7722
  const t = useLocaleText();
7130
7723
  const closeLabel = closeLabelProp ?? t("modal.close");
7131
- const lastContentRef = React21.useRef({ children, title, description, footer });
7724
+ const lastContentRef = React22.useRef({ children, title, description, footer });
7132
7725
  if (open) lastContentRef.current = { children, title, description, footer };
7133
7726
  const content = open ? { children, title, description, footer } : lastContentRef.current;
7134
7727
  const overlayDismissible = dismissible ?? closeOnOverlay;
7135
7728
  const escapeDismissible = dismissible ?? true;
7136
- const panelRef = React21.useRef(null);
7137
- const bodyRef = React21.useRef(null);
7138
- const pressedOverlayRef = React21.useRef(false);
7139
- const titleId = React21.useId();
7140
- const [shouldRender, setShouldRender] = React21.useState(open);
7729
+ const panelRef = React22.useRef(null);
7730
+ const bodyRef = React22.useRef(null);
7731
+ const pressedOverlayRef = React22.useRef(false);
7732
+ const titleId = React22.useId();
7733
+ const [shouldRender, setShouldRender] = React22.useState(open);
7141
7734
  const isMounted = useIsMounted();
7142
7735
  useFocusTrap(panelRef, open && isMounted, {
7143
7736
  preferWithin: bodyRef,
@@ -7168,7 +7761,7 @@ var Modal = ({
7168
7761
  immediate: reduced,
7169
7762
  config: OVERLAY_SPRING_CONFIG
7170
7763
  });
7171
- React21.useEffect(() => {
7764
+ React22.useEffect(() => {
7172
7765
  if (!shouldRender) return;
7173
7766
  lockBodyScroll();
7174
7767
  return () => {
@@ -7230,9 +7823,9 @@ var Modal = ({
7230
7823
  document.body
7231
7824
  );
7232
7825
  };
7233
- var ThemeContext = React21.createContext(null);
7826
+ var ThemeContext = React22.createContext(null);
7234
7827
  var useTheme = () => {
7235
- const ctx = React21.useContext(ThemeContext);
7828
+ const ctx = React22.useContext(ThemeContext);
7236
7829
  if (!ctx) {
7237
7830
  throw new Error(
7238
7831
  '[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>'
@@ -7256,15 +7849,15 @@ var ThemeProvider = ({
7256
7849
  targetSelector,
7257
7850
  children
7258
7851
  }) => {
7259
- const [mode, setModeState] = React21.useState(defaultMode);
7260
- const [systemDark, setSystemDark] = React21.useState(false);
7261
- React21.useEffect(() => {
7852
+ const [mode, setModeState] = React22.useState(defaultMode);
7853
+ const [systemDark, setSystemDark] = React22.useState(false);
7854
+ React22.useEffect(() => {
7262
7855
  setModeState(readStored(storageKey) ?? defaultMode);
7263
7856
  if (isClient) {
7264
7857
  setSystemDark(window.matchMedia("(prefers-color-scheme: dark)").matches);
7265
7858
  }
7266
7859
  }, [storageKey, defaultMode]);
7267
- React21.useEffect(() => {
7860
+ React22.useEffect(() => {
7268
7861
  if (!isClient) return;
7269
7862
  const mq = window.matchMedia("(prefers-color-scheme: dark)");
7270
7863
  const handler = (e) => setSystemDark(e.matches);
@@ -7272,7 +7865,7 @@ var ThemeProvider = ({
7272
7865
  return () => mq.removeEventListener("change", handler);
7273
7866
  }, []);
7274
7867
  const resolved = mode === "system" ? systemDark ? "dark" : "light" : mode;
7275
- React21.useEffect(() => {
7868
+ React22.useEffect(() => {
7276
7869
  if (!isClient) return;
7277
7870
  const target = targetSelector ? document.querySelector(targetSelector) : document.documentElement;
7278
7871
  if (!target) return;
@@ -7282,7 +7875,7 @@ var ThemeProvider = ({
7282
7875
  target.setAttribute("data-theme", mode);
7283
7876
  }
7284
7877
  }, [mode, targetSelector]);
7285
- const setMode = React21.useCallback(
7878
+ const setMode = React22.useCallback(
7286
7879
  (next) => {
7287
7880
  setModeState(next);
7288
7881
  if (storageKey && isClient) {
@@ -7294,7 +7887,7 @@ var ThemeProvider = ({
7294
7887
  },
7295
7888
  [storageKey]
7296
7889
  );
7297
- const value = React21.useMemo(
7890
+ const value = React22.useMemo(
7298
7891
  () => ({ mode, resolved, setMode }),
7299
7892
  [mode, resolved, setMode]
7300
7893
  );
@@ -7449,4 +8042,4 @@ var Stack = ({
7449
8042
  );
7450
8043
  };
7451
8044
 
7452
- export { Accordion, AlertProvider, AppShell, Avatar, Badge, BottomNav, BottomNavItem, BottomNavSpacer, Breadcrumb, Button, Card, Checkbox, Chip, Combobox, Container, DataView, DatePicker, DateRangePicker, DescriptionList, Divider, Drawer, Dropdown, EmptyState, ErrorState, Field, FileInput, Form, Grid, Hero, Icon, IconButton, ImageCropper, LinearProgress, ListItem, LocaleProvider, MediaCard, Menu, Modal, NavBar, NavLink, OtpInput, PageHeader, Pagination, Popover, Prose, Radio, RadioGroup, Section, Sidebar, SidebarItem, SidebarSection, Skeleton, Spinner, Stack, Stat, Stepper, Tab, TabList, TabPanel, Table, Tabs, TagInput, TextField, Textarea, ThemeProvider, TimePicker, Timeline, ToastProvider, Toggle, Tooltip, TopLoading, a11y, baseBorderWidth, baseColors, baseTypography, borderWidth, breakpoints, catalogs, cn, colors, elevation, en, iconSize, ko, motion, opacity, radius, skeleton, spacing, typography, useAlert, useFieldControl, useFocusTrap, useListboxPopup, useLocaleName, useLocaleText, useRadioGroupContext, useReducedMotion, useSpringHover, useSpringPresence, useTheme, useToast, zIndex };
8045
+ export { Accordion, AlertProvider, AppShell, Avatar, Badge, BottomNav, BottomNavItem, BottomNavSpacer, Breadcrumb, Button, Card, Checkbox, Chip, Combobox, Container, CopyButton, DataView, DateCalendar, DatePicker, DateRangePicker, DescriptionList, Divider, Drawer, Dropdown, EmptyState, ErrorState, Field, FileInput, FilterBar, Form, Grid, Hero, Icon, IconButton, ImageCropper, InlineAlert, LinearProgress, ListItem, LocaleProvider, MediaCard, Menu, Modal, NavBar, NavLink, OtpInput, PageHeader, Pagination, Popover, Prose, Radio, RadioGroup, Section, SegmentedControl, Sidebar, SidebarItem, SidebarSection, Skeleton, Spinner, Stack, Stat, Stepper, Tab, TabList, TabPanel, Table, Tabs, TagInput, TextField, Textarea, ThemeProvider, TimePicker, Timeline, ToastProvider, Toggle, Tooltip, TopLoading, a11y, baseBorderWidth, baseColors, baseTypography, borderWidth, breakpoints, catalogs, cn, colors, controlHeight, copyText, cssVars, elevation, en, iconSize, ko, motion, opacity, radius, skeleton, spacing, typography, useAlert, useClipboard, useConfirm, useFieldControl, useFocusTrap, useListboxPopup, useLocaleName, useLocaleText, useRadioGroupContext, useReducedMotion, useSpringHover, useSpringPresence, useTheme, useToast, zIndex };