@bigtablet/design-system 3.30.1 → 3.31.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/README.md +2 -2
- package/dist/index.css +570 -223
- package/dist/index.d.ts +388 -10
- package/dist/index.js +968 -385
- package/dist/styles/a11y/_index.scss +9 -0
- package/docs/AGENT_GUIDE.md +12 -0
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import './index.css';
|
|
3
|
-
import * as
|
|
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,
|
|
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 =
|
|
85
|
-
|
|
84
|
+
const handlerRef = React22.useRef(onEscape);
|
|
85
|
+
React22.useEffect(() => {
|
|
86
86
|
handlerRef.current = onEscape;
|
|
87
87
|
});
|
|
88
|
-
|
|
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] =
|
|
305
|
+
const [state, setState] = React22.useState({
|
|
306
306
|
x: 0,
|
|
307
307
|
y: 0,
|
|
308
308
|
placement,
|
|
@@ -362,6 +362,109 @@ 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
|
+
textarea.select();
|
|
395
|
+
let ok = false;
|
|
396
|
+
try {
|
|
397
|
+
ok = document.execCommand("copy");
|
|
398
|
+
} catch {
|
|
399
|
+
ok = false;
|
|
400
|
+
} finally {
|
|
401
|
+
textarea.remove();
|
|
402
|
+
active?.focus?.({ preventScroll: true });
|
|
403
|
+
if (selection) {
|
|
404
|
+
selection.removeAllRanges();
|
|
405
|
+
for (const range3 of ranges) selection.addRange(range3);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
return ok;
|
|
409
|
+
}
|
|
410
|
+
function useClipboard({
|
|
411
|
+
resetAfter = 2e3,
|
|
412
|
+
onCopy,
|
|
413
|
+
onError
|
|
414
|
+
} = {}) {
|
|
415
|
+
const callbacks = React22.useRef({ onCopy, onError });
|
|
416
|
+
callbacks.current = { onCopy, onError };
|
|
417
|
+
const [status, setStatus] = React22.useState("idle");
|
|
418
|
+
const [error, setError] = React22.useState(null);
|
|
419
|
+
const timer = React22.useRef(void 0);
|
|
420
|
+
const seq = React22.useRef(0);
|
|
421
|
+
const alive = React22.useRef(true);
|
|
422
|
+
React22.useEffect(() => {
|
|
423
|
+
alive.current = true;
|
|
424
|
+
return () => {
|
|
425
|
+
alive.current = false;
|
|
426
|
+
clearTimeout(timer.current);
|
|
427
|
+
};
|
|
428
|
+
}, []);
|
|
429
|
+
const reset = React22.useCallback(() => {
|
|
430
|
+
seq.current++;
|
|
431
|
+
clearTimeout(timer.current);
|
|
432
|
+
setStatus("idle");
|
|
433
|
+
setError(null);
|
|
434
|
+
}, []);
|
|
435
|
+
const copy = React22.useCallback(
|
|
436
|
+
async (text) => {
|
|
437
|
+
const id = ++seq.current;
|
|
438
|
+
clearTimeout(timer.current);
|
|
439
|
+
setStatus("copying");
|
|
440
|
+
setError(null);
|
|
441
|
+
let ok = true;
|
|
442
|
+
let failure = null;
|
|
443
|
+
let value = "";
|
|
444
|
+
try {
|
|
445
|
+
value = typeof text === "function" ? text() : text;
|
|
446
|
+
await copyText(value);
|
|
447
|
+
} catch (e) {
|
|
448
|
+
ok = false;
|
|
449
|
+
failure = e;
|
|
450
|
+
}
|
|
451
|
+
if (!alive.current || id !== seq.current) return ok;
|
|
452
|
+
if (ok) callbacks.current.onCopy?.(value);
|
|
453
|
+
else callbacks.current.onError?.(failure);
|
|
454
|
+
setStatus(ok ? "copied" : "error");
|
|
455
|
+
setError(failure);
|
|
456
|
+
if (resetAfter > 0) {
|
|
457
|
+
timer.current = setTimeout(() => {
|
|
458
|
+
setStatus("idle");
|
|
459
|
+
setError(null);
|
|
460
|
+
}, resetAfter);
|
|
461
|
+
}
|
|
462
|
+
return ok;
|
|
463
|
+
},
|
|
464
|
+
[resetAfter]
|
|
465
|
+
);
|
|
466
|
+
return { copy, status, error, reset };
|
|
467
|
+
}
|
|
365
468
|
var SKIP_AUTOFOCUS_ATTR = "data-focus-trap-skip-autofocus";
|
|
366
469
|
var FOCUSABLE_SELECTORS = [
|
|
367
470
|
"a[href]",
|
|
@@ -372,8 +475,8 @@ var FOCUSABLE_SELECTORS = [
|
|
|
372
475
|
'[tabindex]:not([tabindex="-1"])'
|
|
373
476
|
].join(", ");
|
|
374
477
|
function useFocusTrap(containerRef, isActive, options) {
|
|
375
|
-
const previousActiveElement =
|
|
376
|
-
|
|
478
|
+
const previousActiveElement = React22.useRef(null);
|
|
479
|
+
React22.useEffect(() => {
|
|
377
480
|
if (!isActive) return;
|
|
378
481
|
const container = containerRef.current;
|
|
379
482
|
if (!container) return;
|
|
@@ -431,8 +534,8 @@ function useFocusTrap(containerRef, isActive, options) {
|
|
|
431
534
|
}, [isActive, containerRef]);
|
|
432
535
|
}
|
|
433
536
|
function useIsMounted() {
|
|
434
|
-
const [mounted, setMounted] =
|
|
435
|
-
|
|
537
|
+
const [mounted, setMounted] = React22.useState(false);
|
|
538
|
+
React22.useEffect(() => {
|
|
436
539
|
setMounted(true);
|
|
437
540
|
}, []);
|
|
438
541
|
return mounted;
|
|
@@ -466,13 +569,13 @@ function getServerSnapshot() {
|
|
|
466
569
|
return false;
|
|
467
570
|
}
|
|
468
571
|
function useReducedMotion() {
|
|
469
|
-
return
|
|
572
|
+
return React22.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
470
573
|
}
|
|
471
574
|
function useSpringHover({
|
|
472
575
|
scale = 1.02,
|
|
473
576
|
lift = -2
|
|
474
577
|
} = {}) {
|
|
475
|
-
const [hovered, setHovered] =
|
|
578
|
+
const [hovered, setHovered] = React22.useState(false);
|
|
476
579
|
const reduced = useReducedMotion();
|
|
477
580
|
const style = useSpring({
|
|
478
581
|
transform: hovered ? `translateY(${lift}px) scale(${scale})` : "translateY(0px) scale(1)",
|
|
@@ -746,9 +849,9 @@ var Accordion = ({
|
|
|
746
849
|
...props
|
|
747
850
|
}) => {
|
|
748
851
|
const isControlled = controlledKeys !== void 0;
|
|
749
|
-
const [internalKeys, setInternalKeys] =
|
|
852
|
+
const [internalKeys, setInternalKeys] = React22.useState(defaultOpenKeys);
|
|
750
853
|
const open = isControlled ? controlledKeys ?? [] : internalKeys;
|
|
751
|
-
const idPrefix =
|
|
854
|
+
const idPrefix = React22.useId();
|
|
752
855
|
const toggle = (key) => {
|
|
753
856
|
const isOpen = open.includes(key);
|
|
754
857
|
const next = isOpen ? open.filter((k) => k !== key) : multiple ? [...open, key] : [key];
|
|
@@ -813,7 +916,7 @@ var Avatar = ({
|
|
|
813
916
|
style,
|
|
814
917
|
...props
|
|
815
918
|
}) => {
|
|
816
|
-
const [failedSrc, setFailedSrc] =
|
|
919
|
+
const [failedSrc, setFailedSrc] = React22.useState(null);
|
|
817
920
|
const showImage = src && failedSrc !== src;
|
|
818
921
|
const initials = getInitials(name);
|
|
819
922
|
return (
|
|
@@ -994,6 +1097,9 @@ var EmptyState = ({
|
|
|
994
1097
|
// src/ui/system/locale-provider/messages.ts
|
|
995
1098
|
var ko = {
|
|
996
1099
|
"chip.remove": "{label} \uC81C\uAC70",
|
|
1100
|
+
"copyButton.copied": "\uBCF5\uC0AC\uB428",
|
|
1101
|
+
"copyButton.copy": "\uBCF5\uC0AC",
|
|
1102
|
+
"copyButton.failed": "\uBCF5\uC0AC\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4",
|
|
997
1103
|
"dataView.clearSelection": "\uC120\uD0DD \uD574\uC81C",
|
|
998
1104
|
"dataView.empty": "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4",
|
|
999
1105
|
"dataView.errorTitle": "\uBD88\uB7EC\uC624\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4",
|
|
@@ -1007,6 +1113,7 @@ var ko = {
|
|
|
1007
1113
|
"alert.cancel": "\uCDE8\uC18C",
|
|
1008
1114
|
"alert.confirm": "\uD655\uC778",
|
|
1009
1115
|
"errorState.title": "\uBB38\uC81C\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4",
|
|
1116
|
+
"inlineAlert.dismiss": "\uC54C\uB9BC \uB2EB\uAE30",
|
|
1010
1117
|
"spinner.label": "\uB85C\uB529 \uC911",
|
|
1011
1118
|
"toast.close": "\uB2EB\uAE30",
|
|
1012
1119
|
"toast.region": "\uC54C\uB9BC",
|
|
@@ -1032,6 +1139,8 @@ var ko = {
|
|
|
1032
1139
|
"dropdown.selectedSummary": "{count}\uAC1C \uC120\uD0DD",
|
|
1033
1140
|
"fileInput.label": "\uD30C\uC77C \uC120\uD0DD",
|
|
1034
1141
|
"fileInput.removeImage": "\uC774\uBBF8\uC9C0 \uC81C\uAC70",
|
|
1142
|
+
"filterBar.reset": "\uCD08\uAE30\uD654",
|
|
1143
|
+
"filterBar.submit": "\uAC80\uC0C9",
|
|
1035
1144
|
"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
1145
|
"imageCropper.label": "\uC774\uBBF8\uC9C0 \uC704\uCE58\uC640 \uBC30\uC728 \uC870\uC815",
|
|
1037
1146
|
"imageCropper.noPanHint": "\uC774\uBBF8\uC9C0\uAC00 \uBDF0\uD3EC\uD2B8\uB97C \uB531 \uCC44\uC6CC \uC774\uB3D9 \uC5EC\uC720\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.",
|
|
@@ -1065,6 +1174,9 @@ var ko = {
|
|
|
1065
1174
|
};
|
|
1066
1175
|
var en = {
|
|
1067
1176
|
"chip.remove": "Remove {label}",
|
|
1177
|
+
"copyButton.copied": "Copied",
|
|
1178
|
+
"copyButton.copy": "Copy",
|
|
1179
|
+
"copyButton.failed": "Couldn't copy",
|
|
1068
1180
|
"dataView.clearSelection": "Clear selection",
|
|
1069
1181
|
"dataView.empty": "No data",
|
|
1070
1182
|
"dataView.errorTitle": "Could not load",
|
|
@@ -1078,6 +1190,7 @@ var en = {
|
|
|
1078
1190
|
"alert.cancel": "Cancel",
|
|
1079
1191
|
"alert.confirm": "OK",
|
|
1080
1192
|
"errorState.title": "Something went wrong",
|
|
1193
|
+
"inlineAlert.dismiss": "Dismiss",
|
|
1081
1194
|
"spinner.label": "Loading",
|
|
1082
1195
|
"toast.close": "Close",
|
|
1083
1196
|
"toast.region": "Notifications",
|
|
@@ -1103,6 +1216,8 @@ var en = {
|
|
|
1103
1216
|
"dropdown.selectedSummary": "{count} selected",
|
|
1104
1217
|
"fileInput.label": "Choose file",
|
|
1105
1218
|
"fileInput.removeImage": "Remove image",
|
|
1219
|
+
"filterBar.reset": "Reset",
|
|
1220
|
+
"filterBar.submit": "Search",
|
|
1106
1221
|
"imageCropper.hint": "Drag (or use arrow keys) to move, wheel or slider to zoom.",
|
|
1107
1222
|
"imageCropper.label": "Adjust image position and zoom",
|
|
1108
1223
|
"imageCropper.noPanHint": "The image fills the viewport exactly, so there is no room to move it.",
|
|
@@ -1202,6 +1317,48 @@ var ErrorState = ({
|
|
|
1202
1317
|
}
|
|
1203
1318
|
);
|
|
1204
1319
|
};
|
|
1320
|
+
var TONE_ICON = {
|
|
1321
|
+
neutral: Info,
|
|
1322
|
+
info: Info,
|
|
1323
|
+
success: CheckCircle2,
|
|
1324
|
+
warning: AlertTriangle,
|
|
1325
|
+
error: XCircle
|
|
1326
|
+
};
|
|
1327
|
+
var InlineAlert = ({
|
|
1328
|
+
tone = "info",
|
|
1329
|
+
title,
|
|
1330
|
+
children,
|
|
1331
|
+
icon,
|
|
1332
|
+
action,
|
|
1333
|
+
onDismiss,
|
|
1334
|
+
dismissLabel: dismissLabelProp,
|
|
1335
|
+
className,
|
|
1336
|
+
...props
|
|
1337
|
+
}) => {
|
|
1338
|
+
const t = useLocaleText();
|
|
1339
|
+
const dismissLabel = dismissLabelProp ?? t("inlineAlert.dismiss");
|
|
1340
|
+
const ToneIcon = TONE_ICON[tone];
|
|
1341
|
+
const leading = icon === void 0 ? /* @__PURE__ */ jsx(ToneIcon, { size: iconSize.md }) : icon;
|
|
1342
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("inline_alert", `inline_alert_tone_${tone}`, className), ...props, children: [
|
|
1343
|
+
leading != null && /* @__PURE__ */ jsx("span", { className: "inline_alert_icon", "aria-hidden": "true", children: leading }),
|
|
1344
|
+
/* @__PURE__ */ jsxs("div", { className: "inline_alert_content", children: [
|
|
1345
|
+
title != null && /* @__PURE__ */ jsx("div", { className: "inline_alert_title", children: title }),
|
|
1346
|
+
children != null && /* @__PURE__ */ jsx("div", { className: "inline_alert_description", children }),
|
|
1347
|
+
action != null && /* @__PURE__ */ jsx("div", { className: "inline_alert_action", children: action })
|
|
1348
|
+
] }),
|
|
1349
|
+
onDismiss && /* @__PURE__ */ jsx(
|
|
1350
|
+
"button",
|
|
1351
|
+
{
|
|
1352
|
+
type: "button",
|
|
1353
|
+
className: "inline_alert_dismiss",
|
|
1354
|
+
"aria-label": dismissLabel,
|
|
1355
|
+
onClick: onDismiss,
|
|
1356
|
+
children: /* @__PURE__ */ jsx(X, { size: iconSize.sm, "aria-hidden": "true" })
|
|
1357
|
+
}
|
|
1358
|
+
)
|
|
1359
|
+
] });
|
|
1360
|
+
};
|
|
1361
|
+
InlineAlert.displayName = "InlineAlert";
|
|
1205
1362
|
var BottomNav = ({
|
|
1206
1363
|
ariaLabel: ariaLabelProp,
|
|
1207
1364
|
className,
|
|
@@ -1307,11 +1464,11 @@ var Breadcrumb = ({
|
|
|
1307
1464
|
};
|
|
1308
1465
|
var MENU_GAP = 4;
|
|
1309
1466
|
var Menu = ({ items, trigger, align = "start" }) => {
|
|
1310
|
-
const [open, setOpen] =
|
|
1311
|
-
const wrapperRef =
|
|
1312
|
-
const menuRef =
|
|
1313
|
-
const itemRefs =
|
|
1314
|
-
const menuId =
|
|
1467
|
+
const [open, setOpen] = React22.useState(false);
|
|
1468
|
+
const wrapperRef = React22.useRef(null);
|
|
1469
|
+
const menuRef = React22.useRef(null);
|
|
1470
|
+
const itemRefs = React22.useRef([]);
|
|
1471
|
+
const menuId = React22.useId();
|
|
1315
1472
|
const pos = useAnchoredPosition({
|
|
1316
1473
|
open,
|
|
1317
1474
|
anchorRef: wrapperRef,
|
|
@@ -1321,7 +1478,7 @@ var Menu = ({ items, trigger, align = "start" }) => {
|
|
|
1321
1478
|
gap: MENU_GAP,
|
|
1322
1479
|
padding: 8
|
|
1323
1480
|
});
|
|
1324
|
-
|
|
1481
|
+
React22.useEffect(() => {
|
|
1325
1482
|
if (!open || !pos.ready || !pos.anchorHidden) return;
|
|
1326
1483
|
const focusInMenu = !!menuRef.current?.contains(document.activeElement);
|
|
1327
1484
|
setOpen(false);
|
|
@@ -1333,7 +1490,7 @@ var Menu = ({ items, trigger, align = "start" }) => {
|
|
|
1333
1490
|
visible: open,
|
|
1334
1491
|
from: pos.placement === "top" ? `translateY(${MENU_GAP}px)` : `translateY(-${MENU_GAP}px)`
|
|
1335
1492
|
});
|
|
1336
|
-
|
|
1493
|
+
React22.useEffect(() => {
|
|
1337
1494
|
if (!open) return;
|
|
1338
1495
|
const handleClick = (e) => {
|
|
1339
1496
|
const target = e.target;
|
|
@@ -1350,7 +1507,7 @@ var Menu = ({ items, trigger, align = "start" }) => {
|
|
|
1350
1507
|
document.removeEventListener("keydown", handleEsc);
|
|
1351
1508
|
};
|
|
1352
1509
|
}, [open]);
|
|
1353
|
-
|
|
1510
|
+
React22.useEffect(() => {
|
|
1354
1511
|
const active = document.activeElement;
|
|
1355
1512
|
if (!open || active && itemRefs.current.includes(active)) return;
|
|
1356
1513
|
const first = items.findIndex((it) => !it.disabled);
|
|
@@ -1399,7 +1556,7 @@ var Menu = ({ items, trigger, align = "start" }) => {
|
|
|
1399
1556
|
break;
|
|
1400
1557
|
}
|
|
1401
1558
|
};
|
|
1402
|
-
const triggerWithProps =
|
|
1559
|
+
const triggerWithProps = React22.cloneElement(
|
|
1403
1560
|
trigger,
|
|
1404
1561
|
{
|
|
1405
1562
|
onClick: () => setOpen((o) => !o),
|
|
@@ -1702,9 +1859,9 @@ var Sidebar = ({
|
|
|
1702
1859
|
const t = useLocaleText();
|
|
1703
1860
|
const toggleLabel = toggleLabelProp ?? t("sidebar.toggle");
|
|
1704
1861
|
const isControlled = collapsedProp !== void 0;
|
|
1705
|
-
const [internalCollapsed, setInternalCollapsed] =
|
|
1862
|
+
const [internalCollapsed, setInternalCollapsed] = React22.useState(defaultCollapsed);
|
|
1706
1863
|
const collapsed = isControlled ? collapsedProp : internalCollapsed;
|
|
1707
|
-
const toggle =
|
|
1864
|
+
const toggle = React22.useCallback(() => {
|
|
1708
1865
|
const next = !collapsed;
|
|
1709
1866
|
if (!isControlled) setInternalCollapsed(next);
|
|
1710
1867
|
onCollapsedChange?.(next);
|
|
@@ -1855,9 +2012,9 @@ var Stepper = ({
|
|
|
1855
2012
|
}) });
|
|
1856
2013
|
};
|
|
1857
2014
|
Stepper.displayName = "Stepper";
|
|
1858
|
-
var TabsContext =
|
|
2015
|
+
var TabsContext = React22.createContext(null);
|
|
1859
2016
|
function useTabsContext() {
|
|
1860
|
-
const ctx =
|
|
2017
|
+
const ctx = React22.useContext(TabsContext);
|
|
1861
2018
|
if (!ctx) {
|
|
1862
2019
|
throw new Error(
|
|
1863
2020
|
'[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 +2033,18 @@ var Tabs = ({
|
|
|
1876
2033
|
...props
|
|
1877
2034
|
}) => {
|
|
1878
2035
|
const isControlled = controlledValue !== void 0;
|
|
1879
|
-
const [internalValue, setInternalValue] =
|
|
2036
|
+
const [internalValue, setInternalValue] = React22.useState(defaultValue);
|
|
1880
2037
|
const value = isControlled ? controlledValue : internalValue;
|
|
1881
|
-
const setValue =
|
|
2038
|
+
const setValue = React22.useCallback(
|
|
1882
2039
|
(v) => {
|
|
1883
2040
|
if (!isControlled) setInternalValue(v);
|
|
1884
2041
|
onValueChange?.(v);
|
|
1885
2042
|
},
|
|
1886
2043
|
[isControlled, onValueChange]
|
|
1887
2044
|
);
|
|
1888
|
-
const orderRef =
|
|
1889
|
-
const [firstTabValue, setFirstTabValue] =
|
|
1890
|
-
const registerTab =
|
|
2045
|
+
const orderRef = React22.useRef([]);
|
|
2046
|
+
const [firstTabValue, setFirstTabValue] = React22.useState();
|
|
2047
|
+
const registerTab = React22.useCallback((v) => {
|
|
1891
2048
|
if (!orderRef.current.includes(v)) {
|
|
1892
2049
|
orderRef.current = [...orderRef.current, v];
|
|
1893
2050
|
setFirstTabValue(orderRef.current[0]);
|
|
@@ -1897,8 +2054,8 @@ var Tabs = ({
|
|
|
1897
2054
|
setFirstTabValue(orderRef.current[0]);
|
|
1898
2055
|
};
|
|
1899
2056
|
}, []);
|
|
1900
|
-
const idPrefix =
|
|
1901
|
-
const ctx =
|
|
2057
|
+
const idPrefix = React22.useId();
|
|
2058
|
+
const ctx = React22.useMemo(
|
|
1902
2059
|
() => ({ value, setValue, variant, size, idPrefix, registerTab, firstTabValue }),
|
|
1903
2060
|
[value, setValue, variant, size, idPrefix, registerTab, firstTabValue]
|
|
1904
2061
|
);
|
|
@@ -1913,9 +2070,9 @@ var Tabs = ({
|
|
|
1913
2070
|
};
|
|
1914
2071
|
var TabList = ({ ariaLabel, className, children, ...props }) => {
|
|
1915
2072
|
const { variant } = useTabsContext();
|
|
1916
|
-
const listRef =
|
|
1917
|
-
const [indicator, setIndicator] =
|
|
1918
|
-
const [hasMounted, setHasMounted] =
|
|
2073
|
+
const listRef = React22.useRef(null);
|
|
2074
|
+
const [indicator, setIndicator] = React22.useState(null);
|
|
2075
|
+
const [hasMounted, setHasMounted] = React22.useState(false);
|
|
1919
2076
|
useSafeLayoutEffect(() => {
|
|
1920
2077
|
const list = listRef.current;
|
|
1921
2078
|
if (!list) return;
|
|
@@ -1980,7 +2137,7 @@ var Tab = ({ value, className, children, onClick, onKeyDown, ...props }) => {
|
|
|
1980
2137
|
const panelId = `${ctx.idPrefix}-panel-${value}`;
|
|
1981
2138
|
const tabId = `${ctx.idPrefix}-tab-${value}`;
|
|
1982
2139
|
const { registerTab } = ctx;
|
|
1983
|
-
|
|
2140
|
+
React22.useEffect(() => registerTab(value), [registerTab, value]);
|
|
1984
2141
|
const handleClick = (e) => {
|
|
1985
2142
|
ctx.setValue(value);
|
|
1986
2143
|
onClick?.(e);
|
|
@@ -2067,15 +2224,15 @@ var Popover = ({
|
|
|
2067
2224
|
className
|
|
2068
2225
|
}) => {
|
|
2069
2226
|
const isControlled = openProp !== void 0;
|
|
2070
|
-
const [internalOpen, setInternalOpen] =
|
|
2227
|
+
const [internalOpen, setInternalOpen] = React22.useState(defaultOpen);
|
|
2071
2228
|
const open = isControlled ? openProp : internalOpen;
|
|
2072
|
-
const [shouldRender, setShouldRender] =
|
|
2229
|
+
const [shouldRender, setShouldRender] = React22.useState(open ?? false);
|
|
2073
2230
|
if (open && !shouldRender) setShouldRender(true);
|
|
2074
|
-
const wrapperRef =
|
|
2075
|
-
const positionRef =
|
|
2076
|
-
const popoverRef =
|
|
2077
|
-
const popoverId =
|
|
2078
|
-
const setOpen =
|
|
2231
|
+
const wrapperRef = React22.useRef(null);
|
|
2232
|
+
const positionRef = React22.useRef(null);
|
|
2233
|
+
const popoverRef = React22.useRef(null);
|
|
2234
|
+
const popoverId = React22.useId();
|
|
2235
|
+
const setOpen = React22.useCallback(
|
|
2079
2236
|
(next) => {
|
|
2080
2237
|
if (!isControlled) setInternalOpen(next);
|
|
2081
2238
|
onOpenChange?.(next);
|
|
@@ -2108,7 +2265,7 @@ var Popover = ({
|
|
|
2108
2265
|
onExitComplete: () => setShouldRender(false)
|
|
2109
2266
|
});
|
|
2110
2267
|
useFocusTrap(popoverRef, open && pos.ready);
|
|
2111
|
-
|
|
2268
|
+
React22.useEffect(() => {
|
|
2112
2269
|
if (!open) return;
|
|
2113
2270
|
const handleClick = (e) => {
|
|
2114
2271
|
const target = e.target;
|
|
@@ -2122,7 +2279,7 @@ var Popover = ({
|
|
|
2122
2279
|
useOverlayEscape(open, () => {
|
|
2123
2280
|
setOpen(false);
|
|
2124
2281
|
});
|
|
2125
|
-
const triggerWithProps =
|
|
2282
|
+
const triggerWithProps = React22.cloneElement(
|
|
2126
2283
|
trigger,
|
|
2127
2284
|
{
|
|
2128
2285
|
onClick: (e) => {
|
|
@@ -2181,30 +2338,30 @@ var Tooltip = ({
|
|
|
2181
2338
|
disabled = false,
|
|
2182
2339
|
children
|
|
2183
2340
|
}) => {
|
|
2184
|
-
const [open, setOpen] =
|
|
2185
|
-
const [shouldRender, setShouldRender] =
|
|
2341
|
+
const [open, setOpen] = React22.useState(false);
|
|
2342
|
+
const [shouldRender, setShouldRender] = React22.useState(false);
|
|
2186
2343
|
if (open && !shouldRender) setShouldRender(true);
|
|
2187
|
-
const timerRef =
|
|
2188
|
-
const tooltipId =
|
|
2189
|
-
const wrapperRef =
|
|
2190
|
-
const positionRef =
|
|
2344
|
+
const timerRef = React22.useRef(null);
|
|
2345
|
+
const tooltipId = React22.useId();
|
|
2346
|
+
const wrapperRef = React22.useRef(null);
|
|
2347
|
+
const positionRef = React22.useRef(null);
|
|
2191
2348
|
const HIDE_DELAY = 120;
|
|
2192
|
-
const show =
|
|
2349
|
+
const show = React22.useCallback(() => {
|
|
2193
2350
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
2194
2351
|
timerRef.current = setTimeout(() => setOpen(true), delay);
|
|
2195
2352
|
}, [delay]);
|
|
2196
|
-
const hideNow =
|
|
2353
|
+
const hideNow = React22.useCallback(() => {
|
|
2197
2354
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
2198
2355
|
setOpen(false);
|
|
2199
2356
|
}, []);
|
|
2200
|
-
const hide =
|
|
2357
|
+
const hide = React22.useCallback(() => {
|
|
2201
2358
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
2202
2359
|
timerRef.current = setTimeout(() => setOpen(false), HIDE_DELAY);
|
|
2203
2360
|
}, []);
|
|
2204
|
-
const cancelHide =
|
|
2361
|
+
const cancelHide = React22.useCallback(() => {
|
|
2205
2362
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
2206
2363
|
}, []);
|
|
2207
|
-
|
|
2364
|
+
React22.useEffect(() => {
|
|
2208
2365
|
return () => {
|
|
2209
2366
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
2210
2367
|
};
|
|
@@ -2218,7 +2375,7 @@ var Tooltip = ({
|
|
|
2218
2375
|
gap: TOOLTIP_GAP,
|
|
2219
2376
|
padding: 8
|
|
2220
2377
|
});
|
|
2221
|
-
|
|
2378
|
+
React22.useEffect(() => {
|
|
2222
2379
|
if (open && pos.ready && pos.anchorHidden) hideNow();
|
|
2223
2380
|
}, [open, pos.ready, pos.anchorHidden, hideNow]);
|
|
2224
2381
|
const fromTransform = (() => {
|
|
@@ -2240,7 +2397,7 @@ var Tooltip = ({
|
|
|
2240
2397
|
});
|
|
2241
2398
|
const child = children;
|
|
2242
2399
|
const childProps = child.props;
|
|
2243
|
-
const trigger =
|
|
2400
|
+
const trigger = React22.cloneElement(child, {
|
|
2244
2401
|
onMouseEnter: (e) => {
|
|
2245
2402
|
childProps.onMouseEnter?.(e);
|
|
2246
2403
|
show();
|
|
@@ -2300,9 +2457,10 @@ var Tooltip = ({
|
|
|
2300
2457
|
|
|
2301
2458
|
// src/styles/a11y/index.ts
|
|
2302
2459
|
var a11y = {
|
|
2460
|
+
// light 테마 값 - dark 를 따라가려면 `cssVars.a11y`
|
|
2303
2461
|
focusRing: "0 0 0 3px rgba(0, 0, 0, 0.15)",
|
|
2304
|
-
focusRingError: "0 0 0 3px rgba(239, 68, 68, 0.
|
|
2305
|
-
focusRingSuccess: "0 0 0 3px rgba(16, 185, 129, 0.
|
|
2462
|
+
focusRingError: "0 0 0 3px rgba(239, 68, 68, 0.30)",
|
|
2463
|
+
focusRingSuccess: "0 0 0 3px rgba(16, 185, 129, 0.30)",
|
|
2306
2464
|
tapMinSize: "44px",
|
|
2307
2465
|
tapTarget: {
|
|
2308
2466
|
dense: "32px",
|
|
@@ -2311,6 +2469,12 @@ var a11y = {
|
|
|
2311
2469
|
spacious: "56px"
|
|
2312
2470
|
}
|
|
2313
2471
|
};
|
|
2472
|
+
var controlHeight = {
|
|
2473
|
+
sm: a11y.tapTarget.dense,
|
|
2474
|
+
md: a11y.tapTarget.compact,
|
|
2475
|
+
lg: a11y.tapTarget.comfortable,
|
|
2476
|
+
xl: a11y.tapTarget.spacious
|
|
2477
|
+
};
|
|
2314
2478
|
|
|
2315
2479
|
// src/styles/border-width/index.ts
|
|
2316
2480
|
var baseBorderWidth = {
|
|
@@ -2356,11 +2520,35 @@ var baseColors = {
|
|
|
2356
2520
|
neutral950: "#0A0A0A",
|
|
2357
2521
|
// caption 전용 AA 값 (neutral_500 과 분리 — SCSS _index.scss 와 동일)
|
|
2358
2522
|
textCaptionLight: "#6F6F6F",
|
|
2523
|
+
textCaptionDark: "#808080",
|
|
2359
2524
|
// status — SCSS _index.scss 와 동일한 AA 통과(red/green/amber/blue-700) 값
|
|
2360
2525
|
statusError: "#B91C1C",
|
|
2361
2526
|
statusSuccess: "#047857",
|
|
2362
2527
|
statusWarning: "#B45309",
|
|
2363
2528
|
statusInfo: "#1D4ED8",
|
|
2529
|
+
// status - dark 테마에서 surface 위 직접 쓰는 밝은 값
|
|
2530
|
+
statusErrorDarkText: "#F87171",
|
|
2531
|
+
statusSuccessDarkText: "#4ADE80",
|
|
2532
|
+
statusWarningDarkText: "#FBBF24",
|
|
2533
|
+
statusInfoDarkText: "#60A5FA",
|
|
2534
|
+
// status container (연한 tint 배경) - light / dark
|
|
2535
|
+
statusErrorContainerLight: "#FEE2E2",
|
|
2536
|
+
statusSuccessContainerLight: "#DCFCE7",
|
|
2537
|
+
statusWarningContainerLight: "#FEF3C7",
|
|
2538
|
+
statusInfoContainerLight: "#DBEAFE",
|
|
2539
|
+
statusErrorContainerDark: "rgba(127, 29, 29, 0.35)",
|
|
2540
|
+
statusSuccessContainerDark: "rgba(6, 78, 59, 0.35)",
|
|
2541
|
+
statusWarningContainerDark: "rgba(120, 53, 15, 0.35)",
|
|
2542
|
+
statusInfoContainerDark: "rgba(30, 58, 138, 0.35)",
|
|
2543
|
+
// status on-container - dark (light 는 status* 와 같다)
|
|
2544
|
+
statusErrorOnContainerDark: "#FCA5A5",
|
|
2545
|
+
statusSuccessOnContainerDark: "#86EFAC",
|
|
2546
|
+
statusWarningOnContainerDark: "#FCD34D",
|
|
2547
|
+
statusInfoOnContainerDark: "#93C5FD",
|
|
2548
|
+
// skeleton - light (neutral 스케일 밖의 off-white)
|
|
2549
|
+
skeletonBase: "#F3F3F3",
|
|
2550
|
+
skeletonWave: "#F0F0F0",
|
|
2551
|
+
skeletonHighlight: "#FAFAFA",
|
|
2364
2552
|
alphaBlack5: "rgba(0, 0, 0, 0.05)",
|
|
2365
2553
|
alphaBlack8: "rgba(0, 0, 0, 0.08)",
|
|
2366
2554
|
alphaBlack12: "rgba(26, 26, 26, 0.12)",
|
|
@@ -2368,12 +2556,14 @@ var baseColors = {
|
|
|
2368
2556
|
alphaBlack50: "rgba(0, 0, 0, 0.50)",
|
|
2369
2557
|
alphaWhite5: "rgba(255, 255, 255, 0.05)",
|
|
2370
2558
|
alphaWhite8: "rgba(255, 255, 255, 0.08)",
|
|
2371
|
-
alphaWhite12: "rgba(255, 255, 255, 0.12)"
|
|
2559
|
+
alphaWhite12: "rgba(255, 255, 255, 0.12)",
|
|
2560
|
+
alphaWhite38: "rgba(255, 255, 255, 0.38)"
|
|
2372
2561
|
};
|
|
2373
2562
|
var colors = {
|
|
2374
2563
|
brand: {
|
|
2375
2564
|
primary: baseColors.brandPrimary,
|
|
2376
|
-
onPrimary: baseColors.neutral0
|
|
2565
|
+
onPrimary: baseColors.neutral0,
|
|
2566
|
+
primaryContainer: baseColors.alphaBlack5
|
|
2377
2567
|
},
|
|
2378
2568
|
text: {
|
|
2379
2569
|
heading: baseColors.neutral900,
|
|
@@ -2394,8 +2584,10 @@ var colors = {
|
|
|
2394
2584
|
state: {
|
|
2395
2585
|
hoverOnLight: baseColors.alphaBlack5,
|
|
2396
2586
|
pressedOnLight: baseColors.alphaBlack12,
|
|
2587
|
+
focusOnLight: baseColors.alphaBlack8,
|
|
2397
2588
|
hoverOnDark: baseColors.alphaWhite5,
|
|
2398
|
-
pressedOnDark: baseColors.alphaWhite12
|
|
2589
|
+
pressedOnDark: baseColors.alphaWhite12,
|
|
2590
|
+
focusOnDark: baseColors.alphaWhite8
|
|
2399
2591
|
},
|
|
2400
2592
|
border: {
|
|
2401
2593
|
default: baseColors.neutral200,
|
|
@@ -2408,7 +2600,27 @@ var colors = {
|
|
|
2408
2600
|
error: baseColors.statusError,
|
|
2409
2601
|
success: baseColors.statusSuccess,
|
|
2410
2602
|
warning: baseColors.statusWarning,
|
|
2411
|
-
info: baseColors.statusInfo
|
|
2603
|
+
info: baseColors.statusInfo,
|
|
2604
|
+
// solid 배경 위 텍스트
|
|
2605
|
+
errorOnDefault: baseColors.neutral0,
|
|
2606
|
+
successOnDefault: baseColors.neutral0,
|
|
2607
|
+
warningOnDefault: baseColors.neutral0,
|
|
2608
|
+
infoOnDefault: baseColors.neutral0,
|
|
2609
|
+
// 연한 tint 배경 (soft variant)
|
|
2610
|
+
errorContainer: baseColors.statusErrorContainerLight,
|
|
2611
|
+
successContainer: baseColors.statusSuccessContainerLight,
|
|
2612
|
+
warningContainer: baseColors.statusWarningContainerLight,
|
|
2613
|
+
infoContainer: baseColors.statusInfoContainerLight,
|
|
2614
|
+
// tint 배경 위 텍스트
|
|
2615
|
+
errorOnContainer: baseColors.statusError,
|
|
2616
|
+
successOnContainer: baseColors.statusSuccess,
|
|
2617
|
+
warningOnContainer: baseColors.statusWarning,
|
|
2618
|
+
infoOnContainer: baseColors.statusInfo,
|
|
2619
|
+
// 앱 surface 위 직접 텍스트 (dark 에서 밝은 값으로 바뀐다)
|
|
2620
|
+
errorOnSurface: baseColors.statusError,
|
|
2621
|
+
successOnSurface: baseColors.statusSuccess,
|
|
2622
|
+
warningOnSurface: baseColors.statusWarning,
|
|
2623
|
+
infoOnSurface: baseColors.statusInfo
|
|
2412
2624
|
},
|
|
2413
2625
|
// Accent (brand 검정 기반 - light=검정, dark=흰색 반전)
|
|
2414
2626
|
accent: {
|
|
@@ -2418,6 +2630,11 @@ var colors = {
|
|
|
2418
2630
|
default: baseColors.brandPrimary,
|
|
2419
2631
|
strong: baseColors.neutral900,
|
|
2420
2632
|
onSurface: baseColors.neutral0
|
|
2633
|
+
},
|
|
2634
|
+
skeleton: {
|
|
2635
|
+
base: baseColors.skeletonBase,
|
|
2636
|
+
wave: baseColors.skeletonWave,
|
|
2637
|
+
highlight: baseColors.skeletonHighlight
|
|
2421
2638
|
}
|
|
2422
2639
|
};
|
|
2423
2640
|
|
|
@@ -2430,6 +2647,23 @@ var elevation = {
|
|
|
2430
2647
|
level5: "0 8px 10px -5px rgba(0, 0, 0, 0.20), 0 20px 20px 0px rgba(0, 0, 0, 0.12)"
|
|
2431
2648
|
};
|
|
2432
2649
|
|
|
2650
|
+
// src/styles/css-vars.ts
|
|
2651
|
+
var kebab = (key) => key.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
|
|
2652
|
+
var varsOf = (source, prefix) => Object.fromEntries(
|
|
2653
|
+
Object.keys(source).map((key) => [key, `var(--bt-${prefix}${kebab(key)})`])
|
|
2654
|
+
);
|
|
2655
|
+
var cssVars = {
|
|
2656
|
+
colors: Object.fromEntries(
|
|
2657
|
+
Object.entries(colors).map(([group, values]) => [group, varsOf(values, `color-${group}-`)])
|
|
2658
|
+
),
|
|
2659
|
+
elevation: varsOf(elevation, "elevation-"),
|
|
2660
|
+
a11y: {
|
|
2661
|
+
focusRing: "var(--bt-focus-ring)",
|
|
2662
|
+
focusRingError: "var(--bt-focus-ring-error)",
|
|
2663
|
+
focusRingSuccess: "var(--bt-focus-ring-success)"
|
|
2664
|
+
}
|
|
2665
|
+
};
|
|
2666
|
+
|
|
2433
2667
|
// src/styles/motion/index.ts
|
|
2434
2668
|
var motion = {
|
|
2435
2669
|
transition: {
|
|
@@ -2502,12 +2736,13 @@ var spacing = {
|
|
|
2502
2736
|
|
|
2503
2737
|
// src/styles/skeleton/index.ts
|
|
2504
2738
|
var skeleton = {
|
|
2739
|
+
// SCSS `$color_skeleton_*` 의 light 값과 같다. dark 테마를 따라가려면 `cssVars.colors.skeleton`.
|
|
2505
2740
|
color: {
|
|
2506
|
-
base: baseColors.
|
|
2507
|
-
wave: baseColors.
|
|
2508
|
-
highlight: baseColors.
|
|
2741
|
+
base: baseColors.skeletonBase,
|
|
2742
|
+
wave: baseColors.skeletonWave,
|
|
2743
|
+
highlight: baseColors.skeletonHighlight
|
|
2509
2744
|
},
|
|
2510
|
-
gradient: `linear-gradient(90deg, ${baseColors.
|
|
2745
|
+
gradient: `linear-gradient(90deg, ${baseColors.skeletonBase} 25%, ${baseColors.skeletonHighlight} 37%, ${baseColors.skeletonWave} 63%)`,
|
|
2511
2746
|
radius: {
|
|
2512
2747
|
sm: radius.sm,
|
|
2513
2748
|
md: radius.md,
|
|
@@ -3464,7 +3699,7 @@ var Pagination = ({
|
|
|
3464
3699
|
const emit = onPageChange ?? onChange;
|
|
3465
3700
|
const prevDisabled = page <= 1;
|
|
3466
3701
|
const nextDisabled = page >= totalPages;
|
|
3467
|
-
const items =
|
|
3702
|
+
const items = React22.useMemo(() => getPaginationItems(page, totalPages), [page, totalPages]);
|
|
3468
3703
|
return /* @__PURE__ */ jsxs("nav", { className: "pagination", "aria-label": navLabel, children: [
|
|
3469
3704
|
/* @__PURE__ */ jsx(
|
|
3470
3705
|
"button",
|
|
@@ -3544,12 +3779,12 @@ var Checkbox = ({
|
|
|
3544
3779
|
ref,
|
|
3545
3780
|
...props
|
|
3546
3781
|
}) => {
|
|
3547
|
-
const inputRef =
|
|
3548
|
-
|
|
3782
|
+
const inputRef = React22.useRef(null);
|
|
3783
|
+
React22.useImperativeHandle(
|
|
3549
3784
|
ref,
|
|
3550
3785
|
() => inputRef.current
|
|
3551
3786
|
);
|
|
3552
|
-
|
|
3787
|
+
React22.useEffect(() => {
|
|
3553
3788
|
if (!inputRef.current) return;
|
|
3554
3789
|
inputRef.current.indeterminate = Boolean(indeterminate);
|
|
3555
3790
|
}, [indeterminate]);
|
|
@@ -3623,7 +3858,7 @@ var Table = ({
|
|
|
3623
3858
|
stickyHeader && "table_sticky_header",
|
|
3624
3859
|
className
|
|
3625
3860
|
);
|
|
3626
|
-
const wrapperRef =
|
|
3861
|
+
const wrapperRef = React22.useRef(null);
|
|
3627
3862
|
useSafeLayoutEffect(() => {
|
|
3628
3863
|
const el = wrapperRef.current;
|
|
3629
3864
|
if (!el) return;
|
|
@@ -3651,7 +3886,7 @@ var Table = ({
|
|
|
3651
3886
|
};
|
|
3652
3887
|
}, []);
|
|
3653
3888
|
const isRowClickable = Boolean(onRowClick);
|
|
3654
|
-
|
|
3889
|
+
React22.useEffect(() => {
|
|
3655
3890
|
if (!isRowClickable) return;
|
|
3656
3891
|
const handleKeyDown2 = (e) => {
|
|
3657
3892
|
if (e.key !== "ArrowDown" || e.defaultPrevented) return;
|
|
@@ -3696,8 +3931,8 @@ var Table = ({
|
|
|
3696
3931
|
const isEmpty = !isLoading && data.length === 0;
|
|
3697
3932
|
const getRowKey = (item, index) => rowKey?.(item) ?? String(index);
|
|
3698
3933
|
const allRowKeys = selectable ? data.map((item, index) => getRowKey(item, index)) : [];
|
|
3699
|
-
const rowClickHintId =
|
|
3700
|
-
const selectedSet =
|
|
3934
|
+
const rowClickHintId = React22.useId();
|
|
3935
|
+
const selectedSet = React22.useMemo(() => new Set(selectedKeys ?? []), [selectedKeys]);
|
|
3701
3936
|
const selectedCount = allRowKeys.filter((key) => selectedSet.has(key)).length;
|
|
3702
3937
|
const isAllSelected = allRowKeys.length > 0 && selectedCount === allRowKeys.length;
|
|
3703
3938
|
const isSomeSelected = selectedCount > 0 && !isAllSelected;
|
|
@@ -4182,8 +4417,8 @@ var MediaCard = ({
|
|
|
4182
4417
|
);
|
|
4183
4418
|
};
|
|
4184
4419
|
var Prose = ({ size = "md", className, children, ref, ...props }) => {
|
|
4185
|
-
const rootRef =
|
|
4186
|
-
|
|
4420
|
+
const rootRef = React22.useRef(null);
|
|
4421
|
+
React22.useImperativeHandle(ref, () => rootRef.current, []);
|
|
4187
4422
|
useSafeLayoutEffect(() => {
|
|
4188
4423
|
const root = rootRef.current;
|
|
4189
4424
|
if (!root) return;
|
|
@@ -4223,6 +4458,23 @@ var Prose = ({ size = "md", className, children, ref, ...props }) => {
|
|
|
4223
4458
|
return /* @__PURE__ */ jsx("div", { ref: rootRef, className: cn("prose", `prose_size_${size}`, className), ...props, children });
|
|
4224
4459
|
};
|
|
4225
4460
|
Prose.displayName = "Prose";
|
|
4461
|
+
var Spinner = ({ size = 24, ariaLabel: ariaLabelProp }) => {
|
|
4462
|
+
const t = useLocaleText();
|
|
4463
|
+
const ariaLabel = ariaLabelProp ?? t("spinner.label");
|
|
4464
|
+
return /* @__PURE__ */ jsx(
|
|
4465
|
+
"span",
|
|
4466
|
+
{
|
|
4467
|
+
className: "spinner",
|
|
4468
|
+
style: { width: size, height: size },
|
|
4469
|
+
role: "status",
|
|
4470
|
+
"aria-label": ariaLabel,
|
|
4471
|
+
children: Array.from({ length: 12 }, (_, i) => (
|
|
4472
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: static 12 bars, index is stable key
|
|
4473
|
+
/* @__PURE__ */ jsx("span", { className: "spinner_bar", "aria-hidden": "true" }, i)
|
|
4474
|
+
))
|
|
4475
|
+
}
|
|
4476
|
+
);
|
|
4477
|
+
};
|
|
4226
4478
|
var ICONS = {
|
|
4227
4479
|
info: /* @__PURE__ */ jsx(Info, { size: iconSize.lg, "aria-hidden": "true" }),
|
|
4228
4480
|
success: /* @__PURE__ */ jsx(CheckCircle2, { size: iconSize.lg, "aria-hidden": "true" }),
|
|
@@ -4230,6 +4482,7 @@ var ICONS = {
|
|
|
4230
4482
|
error: /* @__PURE__ */ jsx(XCircle, { size: iconSize.lg, "aria-hidden": "true" })
|
|
4231
4483
|
};
|
|
4232
4484
|
var AlertContext = createContext(null);
|
|
4485
|
+
var useConfirm = () => useAlert().confirm;
|
|
4233
4486
|
var useAlert = () => {
|
|
4234
4487
|
const context = useContext(AlertContext);
|
|
4235
4488
|
if (!context) {
|
|
@@ -4241,9 +4494,31 @@ var useAlert = () => {
|
|
|
4241
4494
|
};
|
|
4242
4495
|
var AlertProvider = ({ children }) => {
|
|
4243
4496
|
const [alertState, setAlertState] = useState({ isOpen: false });
|
|
4244
|
-
const
|
|
4245
|
-
|
|
4497
|
+
const [pending, setPending] = useState(false);
|
|
4498
|
+
const resolveRef = React22.useRef(null);
|
|
4499
|
+
const tokenRef = React22.useRef(0);
|
|
4500
|
+
const settle = useCallback((ok) => {
|
|
4501
|
+
const resolve = resolveRef.current;
|
|
4502
|
+
resolveRef.current = null;
|
|
4503
|
+
resolve?.(ok);
|
|
4246
4504
|
}, []);
|
|
4505
|
+
React22.useEffect(() => () => settle(false), [settle]);
|
|
4506
|
+
const showAlert = useCallback(
|
|
4507
|
+
(options) => {
|
|
4508
|
+
settle(false);
|
|
4509
|
+
tokenRef.current++;
|
|
4510
|
+
setPending(false);
|
|
4511
|
+
setAlertState({ ...options, isOpen: true });
|
|
4512
|
+
},
|
|
4513
|
+
[settle]
|
|
4514
|
+
);
|
|
4515
|
+
const confirm = useCallback(
|
|
4516
|
+
(options) => new Promise((resolve) => {
|
|
4517
|
+
showAlert({ ...options, showCancel: true });
|
|
4518
|
+
resolveRef.current = resolve;
|
|
4519
|
+
}),
|
|
4520
|
+
[showAlert]
|
|
4521
|
+
);
|
|
4247
4522
|
const handleClose = useCallback(() => {
|
|
4248
4523
|
setAlertState((prev) => ({ ...prev, isOpen: false }));
|
|
4249
4524
|
}, []);
|
|
@@ -4251,22 +4526,43 @@ var AlertProvider = ({ children }) => {
|
|
|
4251
4526
|
setAlertState((prev) => prev.isOpen ? prev : { isOpen: false });
|
|
4252
4527
|
}, []);
|
|
4253
4528
|
const handleConfirm = useCallback(() => {
|
|
4254
|
-
|
|
4529
|
+
if (pending) return;
|
|
4530
|
+
const token = tokenRef.current;
|
|
4531
|
+
const result = alertState.onConfirm?.();
|
|
4532
|
+
if (result && typeof result.then === "function") {
|
|
4533
|
+
setPending(true);
|
|
4534
|
+
result.then(
|
|
4535
|
+
() => {
|
|
4536
|
+
if (token !== tokenRef.current) return;
|
|
4537
|
+
setPending(false);
|
|
4538
|
+
settle(true);
|
|
4539
|
+
handleClose();
|
|
4540
|
+
},
|
|
4541
|
+
() => {
|
|
4542
|
+
if (token === tokenRef.current) setPending(false);
|
|
4543
|
+
}
|
|
4544
|
+
);
|
|
4545
|
+
return;
|
|
4546
|
+
}
|
|
4547
|
+
settle(true);
|
|
4255
4548
|
handleClose();
|
|
4256
|
-
}, [alertState.onConfirm, handleClose]);
|
|
4549
|
+
}, [alertState.onConfirm, handleClose, pending, settle]);
|
|
4257
4550
|
const handleCancel = useCallback(() => {
|
|
4551
|
+
if (pending) return;
|
|
4258
4552
|
alertState.onCancel?.();
|
|
4553
|
+
settle(false);
|
|
4259
4554
|
handleClose();
|
|
4260
|
-
}, [alertState.onCancel, handleClose]);
|
|
4261
|
-
return /* @__PURE__ */ jsxs(AlertContext.Provider, { value: { showAlert }, children: [
|
|
4555
|
+
}, [alertState.onCancel, handleClose, pending, settle]);
|
|
4556
|
+
return /* @__PURE__ */ jsxs(AlertContext.Provider, { value: { showAlert, confirm }, children: [
|
|
4262
4557
|
children,
|
|
4263
4558
|
/* @__PURE__ */ jsx(
|
|
4264
4559
|
AlertModal,
|
|
4265
4560
|
{
|
|
4266
4561
|
...alertState,
|
|
4562
|
+
pending,
|
|
4267
4563
|
onConfirm: handleConfirm,
|
|
4268
4564
|
onCancel: handleCancel,
|
|
4269
|
-
onClose:
|
|
4565
|
+
onClose: handleCancel,
|
|
4270
4566
|
onExited: handleExited
|
|
4271
4567
|
}
|
|
4272
4568
|
)
|
|
@@ -4284,6 +4580,7 @@ var AlertModal = ({
|
|
|
4284
4580
|
actionsAlign = "right",
|
|
4285
4581
|
showIcon = false,
|
|
4286
4582
|
closeOnOverlay = true,
|
|
4583
|
+
pending = false,
|
|
4287
4584
|
onConfirm,
|
|
4288
4585
|
onCancel,
|
|
4289
4586
|
onClose,
|
|
@@ -4293,10 +4590,10 @@ var AlertModal = ({
|
|
|
4293
4590
|
const confirmText = confirmTextProp ?? t("alert.confirm");
|
|
4294
4591
|
const cancelText = cancelTextProp ?? t("alert.cancel");
|
|
4295
4592
|
const dismiss = onCancel ?? onClose;
|
|
4296
|
-
const panelRef =
|
|
4297
|
-
const pressedOverlayRef =
|
|
4298
|
-
const titleId =
|
|
4299
|
-
const messageId =
|
|
4593
|
+
const panelRef = React22.useRef(null);
|
|
4594
|
+
const pressedOverlayRef = React22.useRef(false);
|
|
4595
|
+
const titleId = React22.useId();
|
|
4596
|
+
const messageId = React22.useId();
|
|
4300
4597
|
const [shouldRender, setShouldRender] = useState(isOpen);
|
|
4301
4598
|
useFocusTrap(panelRef, isOpen);
|
|
4302
4599
|
useOverlayEscape(isOpen, () => dismiss());
|
|
@@ -4322,7 +4619,7 @@ var AlertModal = ({
|
|
|
4322
4619
|
immediate: reduced,
|
|
4323
4620
|
config: OVERLAY_SPRING_CONFIG
|
|
4324
4621
|
});
|
|
4325
|
-
|
|
4622
|
+
React22.useEffect(() => {
|
|
4326
4623
|
if (!shouldRender) return;
|
|
4327
4624
|
lockBodyScroll();
|
|
4328
4625
|
return () => {
|
|
@@ -4361,6 +4658,7 @@ var AlertModal = ({
|
|
|
4361
4658
|
},
|
|
4362
4659
|
role: "alertdialog",
|
|
4363
4660
|
"aria-modal": "true",
|
|
4661
|
+
"aria-busy": pending || void 0,
|
|
4364
4662
|
"aria-labelledby": title ? titleId : void 0,
|
|
4365
4663
|
"aria-describedby": message ? messageId : void 0,
|
|
4366
4664
|
children: [
|
|
@@ -4370,7 +4668,17 @@ var AlertModal = ({
|
|
|
4370
4668
|
] }),
|
|
4371
4669
|
message && /* @__PURE__ */ jsx("div", { className: "alert_message", id: messageId, children: message }),
|
|
4372
4670
|
/* @__PURE__ */ jsxs("div", { className: cn("alert_actions", `alert_actions_${actionsAlign}`), children: [
|
|
4373
|
-
showCancel && /* @__PURE__ */ jsx(
|
|
4671
|
+
showCancel && /* @__PURE__ */ jsx(
|
|
4672
|
+
Button,
|
|
4673
|
+
{
|
|
4674
|
+
variant: cancelVariant,
|
|
4675
|
+
size: "md",
|
|
4676
|
+
radius: "md",
|
|
4677
|
+
"aria-disabled": pending || void 0,
|
|
4678
|
+
onClick: onCancel,
|
|
4679
|
+
children: cancelText
|
|
4680
|
+
}
|
|
4681
|
+
),
|
|
4374
4682
|
/* @__PURE__ */ jsx(
|
|
4375
4683
|
Button,
|
|
4376
4684
|
{
|
|
@@ -4378,6 +4686,8 @@ var AlertModal = ({
|
|
|
4378
4686
|
danger: destructive,
|
|
4379
4687
|
size: "md",
|
|
4380
4688
|
radius: "md",
|
|
4689
|
+
"aria-disabled": pending || void 0,
|
|
4690
|
+
leadingIcon: pending ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: /* @__PURE__ */ jsx(Spinner, { size: 16 }) }) : void 0,
|
|
4381
4691
|
onClick: onConfirm,
|
|
4382
4692
|
children: confirmText
|
|
4383
4693
|
}
|
|
@@ -4424,24 +4734,7 @@ var LinearProgress = ({
|
|
|
4424
4734
|
}
|
|
4425
4735
|
);
|
|
4426
4736
|
};
|
|
4427
|
-
var
|
|
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);
|
|
4737
|
+
var ToastContext = React22.createContext(null);
|
|
4445
4738
|
var VARIANT_ICONS = {
|
|
4446
4739
|
success: /* @__PURE__ */ jsx(CheckCircle2, { size: iconSize.md }),
|
|
4447
4740
|
error: /* @__PURE__ */ jsx(XCircle, { size: iconSize.md }),
|
|
@@ -4450,9 +4743,9 @@ var VARIANT_ICONS = {
|
|
|
4450
4743
|
default: /* @__PURE__ */ jsx(Bell, { size: iconSize.md })
|
|
4451
4744
|
};
|
|
4452
4745
|
var ToastItemComponent = ({ item, onRemove, closeAriaLabel }) => {
|
|
4453
|
-
const [visible, setVisible] =
|
|
4454
|
-
const closingRef =
|
|
4455
|
-
const rootRef =
|
|
4746
|
+
const [visible, setVisible] = React22.useState(true);
|
|
4747
|
+
const closingRef = React22.useRef(false);
|
|
4748
|
+
const rootRef = React22.useRef(null);
|
|
4456
4749
|
const style = useSpringPresence({
|
|
4457
4750
|
visible,
|
|
4458
4751
|
from: "translateX(20px)",
|
|
@@ -4472,12 +4765,12 @@ var ToastItemComponent = ({ item, onRemove, closeAriaLabel }) => {
|
|
|
4472
4765
|
onRemove(item.id);
|
|
4473
4766
|
}
|
|
4474
4767
|
});
|
|
4475
|
-
const close =
|
|
4768
|
+
const close = React22.useCallback(() => {
|
|
4476
4769
|
if (closingRef.current) return;
|
|
4477
4770
|
closingRef.current = true;
|
|
4478
4771
|
setVisible(false);
|
|
4479
4772
|
}, []);
|
|
4480
|
-
|
|
4773
|
+
React22.useEffect(() => {
|
|
4481
4774
|
if (item.dismissing) close();
|
|
4482
4775
|
}, [item.dismissing, close]);
|
|
4483
4776
|
const autoDismisses = Number.isFinite(item.duration);
|
|
@@ -4523,9 +4816,9 @@ var ToastProvider = ({
|
|
|
4523
4816
|
const t = useLocaleText();
|
|
4524
4817
|
const closeAriaLabel = closeAriaLabelProp ?? t("toast.close");
|
|
4525
4818
|
const regionLabel = regionLabelProp ?? t("toast.region");
|
|
4526
|
-
const [toasts, setToasts] =
|
|
4819
|
+
const [toasts, setToasts] = React22.useState([]);
|
|
4527
4820
|
const isMounted = useIsMounted();
|
|
4528
|
-
const addToast =
|
|
4821
|
+
const addToast = React22.useCallback(
|
|
4529
4822
|
(message, variant, options = {}) => {
|
|
4530
4823
|
const { duration = 3e3, action } = options;
|
|
4531
4824
|
const id = `toast_${++toastSeq}`;
|
|
@@ -4540,14 +4833,14 @@ var ToastProvider = ({
|
|
|
4540
4833
|
},
|
|
4541
4834
|
[maxCount]
|
|
4542
4835
|
);
|
|
4543
|
-
const dismissToast =
|
|
4836
|
+
const dismissToast = React22.useCallback((id) => {
|
|
4544
4837
|
setToasts(
|
|
4545
4838
|
(prev) => prev.map(
|
|
4546
4839
|
(toast) => toast.id === id && !toast.dismissing ? { ...toast, dismissing: true } : toast
|
|
4547
4840
|
)
|
|
4548
4841
|
);
|
|
4549
4842
|
}, []);
|
|
4550
|
-
const updateToast =
|
|
4843
|
+
const updateToast = React22.useCallback((id, patch) => {
|
|
4551
4844
|
setToasts(
|
|
4552
4845
|
(prev) => prev.map((toast) => {
|
|
4553
4846
|
if (toast.id !== id || toast.dismissing) return toast;
|
|
@@ -4560,10 +4853,10 @@ var ToastProvider = ({
|
|
|
4560
4853
|
})
|
|
4561
4854
|
);
|
|
4562
4855
|
}, []);
|
|
4563
|
-
const removeToast =
|
|
4856
|
+
const removeToast = React22.useCallback((id) => {
|
|
4564
4857
|
setToasts((prev) => prev.filter((t2) => t2.id !== id));
|
|
4565
4858
|
}, []);
|
|
4566
|
-
const contextValue =
|
|
4859
|
+
const contextValue = React22.useMemo(
|
|
4567
4860
|
() => ({ addToast, dismissToast, updateToast }),
|
|
4568
4861
|
[addToast, dismissToast, updateToast]
|
|
4569
4862
|
);
|
|
@@ -4862,6 +5155,258 @@ var Combobox = ({
|
|
|
4862
5155
|
)
|
|
4863
5156
|
] });
|
|
4864
5157
|
};
|
|
5158
|
+
var ROWS = 6;
|
|
5159
|
+
var pad = (n) => String(n).padStart(2, "0");
|
|
5160
|
+
var format2 = ({ year, month, day }) => `${year}-${pad(month)}-${pad(day)}`;
|
|
5161
|
+
var formatMonth = ({ year, month }) => `${year}-${pad(month)}`;
|
|
5162
|
+
var parse = (value) => {
|
|
5163
|
+
const m = /^(\d{4})-(\d{2})(?:-(\d{2}))?$/.exec(value ?? "");
|
|
5164
|
+
if (!m) return null;
|
|
5165
|
+
const year = Number(m[1]);
|
|
5166
|
+
const month = Number(m[2]);
|
|
5167
|
+
const day = m[3] ? Number(m[3]) : 1;
|
|
5168
|
+
if (month < 1 || month > 12 || day < 1 || day > daysIn(year, month)) return null;
|
|
5169
|
+
return { year, month, day };
|
|
5170
|
+
};
|
|
5171
|
+
var toDate = ({ year, month, day }) => new Date(year, month - 1, day);
|
|
5172
|
+
var fromDate = (d) => ({
|
|
5173
|
+
year: d.getFullYear(),
|
|
5174
|
+
month: d.getMonth() + 1,
|
|
5175
|
+
day: d.getDate()
|
|
5176
|
+
});
|
|
5177
|
+
var sameDay = (a, b) => !!a && !!b && a.year === b.year && a.month === b.month && a.day === b.day;
|
|
5178
|
+
var compare = (a, b) => a.year - b.year || a.month - b.month || a.day - b.day;
|
|
5179
|
+
var monthIndex = (y, m) => y * 12 + (m - 1);
|
|
5180
|
+
var daysIn = (y, m) => new Date(y, m, 0).getDate();
|
|
5181
|
+
var addDays = (date, n) => {
|
|
5182
|
+
const d = toDate(date);
|
|
5183
|
+
d.setDate(d.getDate() + n);
|
|
5184
|
+
return fromDate(d);
|
|
5185
|
+
};
|
|
5186
|
+
var addMonths = (date, n) => {
|
|
5187
|
+
const idx = monthIndex(date.year, date.month) + n;
|
|
5188
|
+
const year = Math.floor(idx / 12);
|
|
5189
|
+
const month = idx % 12 + 1;
|
|
5190
|
+
return { year, month, day: Math.min(date.day, daysIn(year, month)) };
|
|
5191
|
+
};
|
|
5192
|
+
var DateCalendar = ({
|
|
5193
|
+
value: valueProp,
|
|
5194
|
+
defaultValue,
|
|
5195
|
+
onValueChange,
|
|
5196
|
+
month: monthProp,
|
|
5197
|
+
defaultMonth,
|
|
5198
|
+
onMonthChange,
|
|
5199
|
+
min: minProp,
|
|
5200
|
+
max: maxProp,
|
|
5201
|
+
isDateDisabled,
|
|
5202
|
+
today: todayProp,
|
|
5203
|
+
weekStartsOn = 0,
|
|
5204
|
+
renderDay,
|
|
5205
|
+
describeDay,
|
|
5206
|
+
prevMonthLabel,
|
|
5207
|
+
nextMonthLabel,
|
|
5208
|
+
className,
|
|
5209
|
+
...props
|
|
5210
|
+
}) => {
|
|
5211
|
+
const t = useLocaleText();
|
|
5212
|
+
const intlLocale = useLocaleName() === "en" ? "en-US" : "ko-KR";
|
|
5213
|
+
const prevLabel = prevMonthLabel ?? t("datePicker.prevMonth");
|
|
5214
|
+
const nextLabel = nextMonthLabel ?? t("datePicker.nextMonth");
|
|
5215
|
+
const isControlled = valueProp !== void 0;
|
|
5216
|
+
const [innerValue, setInnerValue] = React22.useState(defaultValue ?? null);
|
|
5217
|
+
const selected = parse(isControlled ? valueProp : innerValue);
|
|
5218
|
+
const today = parse(todayProp) ?? fromDate(/* @__PURE__ */ new Date());
|
|
5219
|
+
const min = parse(minProp);
|
|
5220
|
+
const max = parse(maxProp);
|
|
5221
|
+
const minIdx = min ? monthIndex(min.year, min.month) : Number.NEGATIVE_INFINITY;
|
|
5222
|
+
const maxIdx = max ? monthIndex(max.year, max.month) : Number.POSITIVE_INFINITY;
|
|
5223
|
+
const clampToRange = (date) => {
|
|
5224
|
+
if (min && compare(date, min) < 0) return min;
|
|
5225
|
+
if (max && compare(date, max) > 0) return max;
|
|
5226
|
+
return date;
|
|
5227
|
+
};
|
|
5228
|
+
const isDisabled = (date) => !!min && compare(date, min) < 0 || !!max && compare(date, max) > 0 || !!isDateDisabled?.(format2(date));
|
|
5229
|
+
const pickInMonth = (m) => {
|
|
5230
|
+
const inMonth = (d) => !!d && d.year === m.year && d.month === m.month;
|
|
5231
|
+
if (inMonth(selected)) return selected;
|
|
5232
|
+
if (inMonth(today)) return today;
|
|
5233
|
+
return { ...m, day: 1 };
|
|
5234
|
+
};
|
|
5235
|
+
const [focused, setFocused] = React22.useState(() => {
|
|
5236
|
+
const startMonth = parse(monthProp ?? defaultMonth);
|
|
5237
|
+
return clampToRange(startMonth ? pickInMonth(startMonth) : selected ?? today);
|
|
5238
|
+
});
|
|
5239
|
+
const gridRef = React22.useRef(null);
|
|
5240
|
+
const moveFocusRef = React22.useRef(false);
|
|
5241
|
+
React22.useEffect(() => {
|
|
5242
|
+
if (!moveFocusRef.current) return;
|
|
5243
|
+
moveFocusRef.current = false;
|
|
5244
|
+
gridRef.current?.querySelector('button[tabindex="0"]')?.focus();
|
|
5245
|
+
});
|
|
5246
|
+
const pendingRef = React22.useRef(null);
|
|
5247
|
+
const syncedMonthRef = React22.useRef(monthProp);
|
|
5248
|
+
const controlledMonth = parse(monthProp);
|
|
5249
|
+
if (controlledMonth && syncedMonthRef.current !== monthProp) {
|
|
5250
|
+
syncedMonthRef.current = monthProp;
|
|
5251
|
+
const pending = pendingRef.current;
|
|
5252
|
+
pendingRef.current = null;
|
|
5253
|
+
const hit = pending && pending.date.year === controlledMonth.year && pending.date.month === controlledMonth.month;
|
|
5254
|
+
moveFocusRef.current = !!hit && pending.viaKeyboard;
|
|
5255
|
+
setFocused(clampToRange(hit ? pending.date : pickInMonth(controlledMonth)));
|
|
5256
|
+
}
|
|
5257
|
+
const selectedKey = selected ? format2(selected) : null;
|
|
5258
|
+
const syncedValueRef = React22.useRef(selectedKey);
|
|
5259
|
+
if (syncedValueRef.current !== selectedKey) {
|
|
5260
|
+
syncedValueRef.current = selectedKey;
|
|
5261
|
+
if (selected && monthProp === void 0 && (selected.year !== focused.year || selected.month !== focused.month)) {
|
|
5262
|
+
setFocused(clampToRange(selected));
|
|
5263
|
+
}
|
|
5264
|
+
}
|
|
5265
|
+
const view = { year: focused.year, month: focused.month };
|
|
5266
|
+
const viewIdx = monthIndex(view.year, view.month);
|
|
5267
|
+
const titleId = React22.useId();
|
|
5268
|
+
const fmt = React22.useMemo(
|
|
5269
|
+
() => ({
|
|
5270
|
+
title: new Intl.DateTimeFormat(intlLocale, { year: "numeric", month: "long" }),
|
|
5271
|
+
weekdayShort: new Intl.DateTimeFormat(intlLocale, { weekday: "narrow" }),
|
|
5272
|
+
weekdayLong: new Intl.DateTimeFormat(intlLocale, { weekday: "long" }),
|
|
5273
|
+
full: new Intl.DateTimeFormat(intlLocale, { dateStyle: "full" })
|
|
5274
|
+
}),
|
|
5275
|
+
[intlLocale]
|
|
5276
|
+
);
|
|
5277
|
+
const weekdays = Array.from({ length: 7 }, (_, i) => {
|
|
5278
|
+
const d = new Date(2026, 9, 4 + (weekStartsOn + i) % 7);
|
|
5279
|
+
return { short: fmt.weekdayShort.format(d), long: fmt.weekdayLong.format(d) };
|
|
5280
|
+
});
|
|
5281
|
+
const lead = (new Date(view.year, view.month - 1, 1).getDay() - weekStartsOn + 7) % 7;
|
|
5282
|
+
const total = daysIn(view.year, view.month);
|
|
5283
|
+
const cells = Array.from({ length: ROWS * 7 }, (_, i) => {
|
|
5284
|
+
const day = i - lead + 1;
|
|
5285
|
+
return day >= 1 && day <= total ? { ...view, day } : null;
|
|
5286
|
+
});
|
|
5287
|
+
const focusDate = (next, viaKeyboard) => {
|
|
5288
|
+
const target = clampToRange(next);
|
|
5289
|
+
if (target.year !== focused.year || target.month !== focused.month) {
|
|
5290
|
+
onMonthChange?.(formatMonth(target));
|
|
5291
|
+
if (monthProp !== void 0) {
|
|
5292
|
+
pendingRef.current = { date: target, viaKeyboard };
|
|
5293
|
+
return;
|
|
5294
|
+
}
|
|
5295
|
+
}
|
|
5296
|
+
moveFocusRef.current = viaKeyboard;
|
|
5297
|
+
setFocused(target);
|
|
5298
|
+
};
|
|
5299
|
+
const handleKeyDown2 = (e) => {
|
|
5300
|
+
if (e.altKey || e.ctrlKey || e.metaKey) return;
|
|
5301
|
+
const offset = (toDate(focused).getDay() - weekStartsOn + 7) % 7;
|
|
5302
|
+
const moves = {
|
|
5303
|
+
ArrowLeft: () => addDays(focused, -1),
|
|
5304
|
+
ArrowRight: () => addDays(focused, 1),
|
|
5305
|
+
ArrowUp: () => addDays(focused, -7),
|
|
5306
|
+
ArrowDown: () => addDays(focused, 7),
|
|
5307
|
+
Home: () => addDays(focused, -offset),
|
|
5308
|
+
End: () => addDays(focused, 6 - offset),
|
|
5309
|
+
PageUp: () => addMonths(focused, e.shiftKey ? -12 : -1),
|
|
5310
|
+
PageDown: () => addMonths(focused, e.shiftKey ? 12 : 1)
|
|
5311
|
+
};
|
|
5312
|
+
const move = moves[e.key];
|
|
5313
|
+
if (!move) return;
|
|
5314
|
+
e.preventDefault();
|
|
5315
|
+
focusDate(move(), true);
|
|
5316
|
+
};
|
|
5317
|
+
const select = (date) => {
|
|
5318
|
+
const next = format2(date);
|
|
5319
|
+
if (!isControlled) setInnerValue(next);
|
|
5320
|
+
onValueChange?.(next);
|
|
5321
|
+
};
|
|
5322
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("date_calendar", className), ...props, children: [
|
|
5323
|
+
/* @__PURE__ */ jsxs("div", { className: "date_calendar_header", children: [
|
|
5324
|
+
/* @__PURE__ */ jsx(
|
|
5325
|
+
"button",
|
|
5326
|
+
{
|
|
5327
|
+
type: "button",
|
|
5328
|
+
className: "date_calendar_nav",
|
|
5329
|
+
"aria-label": prevLabel,
|
|
5330
|
+
onClick: () => focusDate(addMonths(focused, -1), false),
|
|
5331
|
+
disabled: viewIdx <= minIdx,
|
|
5332
|
+
"data-focus-trap-skip-autofocus": "",
|
|
5333
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { size: iconSize.md, "aria-hidden": "true" })
|
|
5334
|
+
}
|
|
5335
|
+
),
|
|
5336
|
+
/* @__PURE__ */ jsx("span", { className: "date_calendar_title", id: titleId, "aria-live": "polite", children: fmt.title.format(new Date(view.year, view.month - 1, 1)) }),
|
|
5337
|
+
/* @__PURE__ */ jsx(
|
|
5338
|
+
"button",
|
|
5339
|
+
{
|
|
5340
|
+
type: "button",
|
|
5341
|
+
className: "date_calendar_nav",
|
|
5342
|
+
"aria-label": nextLabel,
|
|
5343
|
+
onClick: () => focusDate(addMonths(focused, 1), false),
|
|
5344
|
+
disabled: viewIdx >= maxIdx,
|
|
5345
|
+
"data-focus-trap-skip-autofocus": "",
|
|
5346
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { size: iconSize.md, "aria-hidden": "true" })
|
|
5347
|
+
}
|
|
5348
|
+
)
|
|
5349
|
+
] }),
|
|
5350
|
+
/* @__PURE__ */ jsxs("table", { ref: gridRef, className: "date_calendar_grid", role: "grid", "aria-labelledby": titleId, children: [
|
|
5351
|
+
/* @__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)) }) }),
|
|
5352
|
+
/* @__PURE__ */ jsx("tbody", { children: Array.from({ length: ROWS }, (_, row) => (
|
|
5353
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: 줄은 위치 자체가 정체성이다(달이 바뀌어도 6줄)
|
|
5354
|
+
/* @__PURE__ */ jsx("tr", { children: cells.slice(row * 7, row * 7 + 7).map((cell, col) => {
|
|
5355
|
+
if (!cell) {
|
|
5356
|
+
return /* @__PURE__ */ jsx("td", { className: "date_calendar_cell" }, `empty-${col}`);
|
|
5357
|
+
}
|
|
5358
|
+
const disabled = isDisabled(cell);
|
|
5359
|
+
const isSelected = sameDay(cell, selected);
|
|
5360
|
+
const isToday = sameDay(cell, today);
|
|
5361
|
+
const iso = format2(cell);
|
|
5362
|
+
const description = describeDay?.(iso);
|
|
5363
|
+
const decoration = renderDay?.(iso, {
|
|
5364
|
+
selected: isSelected,
|
|
5365
|
+
today: isToday,
|
|
5366
|
+
disabled
|
|
5367
|
+
});
|
|
5368
|
+
return (
|
|
5369
|
+
// biome-ignore lint/a11y/useFocusableInteractive: 포커스는 칸 안 button 이 받는다 - 칸과 버튼이 둘 다 받으면 Tab 이 달력 안에서 두 번 멈춘다
|
|
5370
|
+
/* @__PURE__ */ jsx(
|
|
5371
|
+
"td",
|
|
5372
|
+
{
|
|
5373
|
+
role: "gridcell",
|
|
5374
|
+
"aria-selected": isSelected,
|
|
5375
|
+
className: "date_calendar_cell",
|
|
5376
|
+
children: /* @__PURE__ */ jsxs(
|
|
5377
|
+
"button",
|
|
5378
|
+
{
|
|
5379
|
+
type: "button",
|
|
5380
|
+
className: cn("date_calendar_day", {
|
|
5381
|
+
date_calendar_day_selected: isSelected,
|
|
5382
|
+
date_calendar_day_today: isToday
|
|
5383
|
+
}),
|
|
5384
|
+
tabIndex: sameDay(cell, focused) ? 0 : -1,
|
|
5385
|
+
"data-focus-trap-skip-autofocus": sameDay(cell, focused) ? void 0 : "",
|
|
5386
|
+
"aria-label": [fmt.full.format(toDate(cell)), description].filter(Boolean).join(", "),
|
|
5387
|
+
"aria-current": isToday ? "date" : void 0,
|
|
5388
|
+
"aria-disabled": disabled || void 0,
|
|
5389
|
+
onClick: () => {
|
|
5390
|
+
focusDate(cell, false);
|
|
5391
|
+
if (!disabled) select(cell);
|
|
5392
|
+
},
|
|
5393
|
+
onKeyDown: handleKeyDown2,
|
|
5394
|
+
children: [
|
|
5395
|
+
cell.day,
|
|
5396
|
+
decoration != null && /* @__PURE__ */ jsx("span", { className: "date_calendar_decoration", "aria-hidden": "true", children: decoration })
|
|
5397
|
+
]
|
|
5398
|
+
}
|
|
5399
|
+
)
|
|
5400
|
+
},
|
|
5401
|
+
cell.day
|
|
5402
|
+
)
|
|
5403
|
+
);
|
|
5404
|
+
}) }, row)
|
|
5405
|
+
)) })
|
|
5406
|
+
] })
|
|
5407
|
+
] });
|
|
5408
|
+
};
|
|
5409
|
+
DateCalendar.displayName = "DateCalendar";
|
|
4865
5410
|
var normalizeForSearch = (s) => s.toLowerCase().replace(/\s+/g, "");
|
|
4866
5411
|
var Dropdown = (props) => {
|
|
4867
5412
|
const t = useLocaleText();
|
|
@@ -5151,180 +5696,13 @@ var Dropdown = (props) => {
|
|
|
5151
5696
|
)
|
|
5152
5697
|
] });
|
|
5153
5698
|
};
|
|
5154
|
-
var
|
|
5155
|
-
var
|
|
5156
|
-
var
|
|
5157
|
-
|
|
5158
|
-
year
|
|
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
|
-
] });
|
|
5699
|
+
var pad2 = (n) => String(n).padStart(2, "0");
|
|
5700
|
+
var toIso = ({ year, month, day }) => `${year}-${pad2(month)}-${pad2(day)}`;
|
|
5701
|
+
var fromIso = (iso) => {
|
|
5702
|
+
const [year = 0, month = 0, day = 0] = iso.split("-").map(Number);
|
|
5703
|
+
return { year, month, day };
|
|
5326
5704
|
};
|
|
5327
|
-
var
|
|
5705
|
+
var pad3 = (n) => String(n).padStart(2, "0");
|
|
5328
5706
|
var getDaysInMonth = (year, month) => new Date(year, month, 0).getDate();
|
|
5329
5707
|
var normalizeWidth = (v) => typeof v === "number" ? `${v}px` : v;
|
|
5330
5708
|
var range2 = (start, end) => Array.from({ length: end - start + 1 }, (_, i) => start + i);
|
|
@@ -5359,9 +5737,9 @@ var DatePicker = ({
|
|
|
5359
5737
|
const selectableRangeUntilTodaySrText = selectableRangeUntilTodaySrTextProp ?? t("datePicker.rangeUntilTodaySr");
|
|
5360
5738
|
const field = useFieldControl();
|
|
5361
5739
|
const isRequired = field ? field.required || void 0 : required || void 0;
|
|
5362
|
-
const groupId =
|
|
5363
|
-
const constraintId =
|
|
5364
|
-
const { todayYear, todayMonth, todayDay } =
|
|
5740
|
+
const groupId = React22.useId();
|
|
5741
|
+
const constraintId = React22.useId();
|
|
5742
|
+
const { todayYear, todayMonth, todayDay } = React22.useMemo(() => {
|
|
5365
5743
|
const now = /* @__PURE__ */ new Date();
|
|
5366
5744
|
return {
|
|
5367
5745
|
todayYear: now.getFullYear(),
|
|
@@ -5370,7 +5748,7 @@ var DatePicker = ({
|
|
|
5370
5748
|
};
|
|
5371
5749
|
}, []);
|
|
5372
5750
|
const endYear = endYearProp ?? todayYear + 10;
|
|
5373
|
-
const parsed =
|
|
5751
|
+
const parsed = React22.useMemo(() => {
|
|
5374
5752
|
if (!value) return { year: 0, month: 0, day: 0 };
|
|
5375
5753
|
const [y, m, d] = value.split("-").map(Number);
|
|
5376
5754
|
return {
|
|
@@ -5379,7 +5757,7 @@ var DatePicker = ({
|
|
|
5379
5757
|
day: d || 0
|
|
5380
5758
|
};
|
|
5381
5759
|
}, [value]);
|
|
5382
|
-
const min =
|
|
5760
|
+
const min = React22.useMemo(() => {
|
|
5383
5761
|
if (!minDate) return { year: 0, month: 0, day: 0 };
|
|
5384
5762
|
const [y, m, d] = minDate.split("-").map(Number);
|
|
5385
5763
|
return {
|
|
@@ -5392,7 +5770,7 @@ var DatePicker = ({
|
|
|
5392
5770
|
const maxYear = selectableRange === "until-today" ? todayYear : endYear;
|
|
5393
5771
|
const minMonth = min.year > 0 && year === min.year ? Math.min(12, Math.max(1, min.month)) : 1;
|
|
5394
5772
|
const maxMonth = selectableRange === "until-today" && year === todayYear ? todayMonth : 12;
|
|
5395
|
-
const dayBoundsFor =
|
|
5773
|
+
const dayBoundsFor = React22.useCallback(
|
|
5396
5774
|
(yy, mm) => {
|
|
5397
5775
|
if (!yy || !mm) return { min: 1, max: 31 };
|
|
5398
5776
|
const daysInMonth = getDaysInMonth(yy, mm);
|
|
@@ -5402,37 +5780,37 @@ var DatePicker = ({
|
|
|
5402
5780
|
},
|
|
5403
5781
|
[min.year, min.month, min.day, selectableRange, todayYear, todayMonth, todayDay]
|
|
5404
5782
|
);
|
|
5405
|
-
const { min: minDay, max: maxDay } =
|
|
5783
|
+
const { min: minDay, max: maxDay } = React22.useMemo(
|
|
5406
5784
|
() => dayBoundsFor(year, month),
|
|
5407
5785
|
[dayBoundsFor, year, month]
|
|
5408
5786
|
);
|
|
5409
5787
|
const hasSelectableDay = maxDay >= minDay;
|
|
5410
5788
|
const minYear = min.year > 0 ? Math.max(startYear, min.year) : startYear;
|
|
5411
|
-
const yearOptions =
|
|
5789
|
+
const yearOptions = React22.useMemo(
|
|
5412
5790
|
() => range2(minYear, maxYear).map((y) => ({
|
|
5413
5791
|
value: String(y),
|
|
5414
5792
|
label: String(y)
|
|
5415
5793
|
})),
|
|
5416
5794
|
[minYear, maxYear]
|
|
5417
5795
|
);
|
|
5418
|
-
const monthOptions =
|
|
5796
|
+
const monthOptions = React22.useMemo(
|
|
5419
5797
|
() => range2(minMonth, maxMonth).filter((m) => {
|
|
5420
5798
|
const bounds = dayBoundsFor(year, m);
|
|
5421
5799
|
return bounds.max >= bounds.min;
|
|
5422
5800
|
}).map((m) => ({
|
|
5423
5801
|
value: String(m),
|
|
5424
|
-
label:
|
|
5802
|
+
label: pad3(m)
|
|
5425
5803
|
})),
|
|
5426
5804
|
[minMonth, maxMonth, dayBoundsFor, year]
|
|
5427
5805
|
);
|
|
5428
|
-
const dayOptions =
|
|
5806
|
+
const dayOptions = React22.useMemo(
|
|
5429
5807
|
() => hasSelectableDay ? range2(minDay, maxDay).map((d) => ({
|
|
5430
5808
|
value: String(d),
|
|
5431
|
-
label:
|
|
5809
|
+
label: pad3(d)
|
|
5432
5810
|
})) : [],
|
|
5433
5811
|
[minDay, maxDay, hasSelectableDay]
|
|
5434
5812
|
);
|
|
5435
|
-
const withinRange =
|
|
5813
|
+
const withinRange = React22.useCallback(
|
|
5436
5814
|
(yy, mm, dd) => {
|
|
5437
5815
|
const point = yy * 1e4 + mm * 100 + dd;
|
|
5438
5816
|
if (min.year > 0) {
|
|
@@ -5447,24 +5825,24 @@ var DatePicker = ({
|
|
|
5447
5825
|
},
|
|
5448
5826
|
[min.year, min.month, min.day, selectableRange, todayYear, todayMonth, todayDay]
|
|
5449
5827
|
);
|
|
5450
|
-
const emit =
|
|
5828
|
+
const emit = React22.useCallback(
|
|
5451
5829
|
(yy, mm, dd) => {
|
|
5452
5830
|
const cb = onValueChange ?? onChange;
|
|
5453
5831
|
if (mode === "year-month") {
|
|
5454
5832
|
const monthBounds = dayBoundsFor(yy, mm);
|
|
5455
5833
|
if (monthBounds.max < monthBounds.min) return;
|
|
5456
|
-
cb?.(`${yy}-${
|
|
5834
|
+
cb?.(`${yy}-${pad3(mm)}`);
|
|
5457
5835
|
return;
|
|
5458
5836
|
}
|
|
5459
5837
|
const bounds = dayBoundsFor(yy, mm);
|
|
5460
5838
|
if (bounds.max < bounds.min) return;
|
|
5461
5839
|
const safeDay = Math.min(Math.max(dd ?? bounds.min, bounds.min), bounds.max);
|
|
5462
5840
|
if (!withinRange(yy, mm, safeDay)) return;
|
|
5463
|
-
cb?.(`${yy}-${
|
|
5841
|
+
cb?.(`${yy}-${pad3(mm)}-${pad3(safeDay)}`);
|
|
5464
5842
|
},
|
|
5465
5843
|
[mode, onValueChange, onChange, dayBoundsFor, withinRange]
|
|
5466
5844
|
);
|
|
5467
|
-
const handleYearChange =
|
|
5845
|
+
const handleYearChange = React22.useCallback(
|
|
5468
5846
|
(raw) => {
|
|
5469
5847
|
if (!raw) return;
|
|
5470
5848
|
const newYear = Number(raw);
|
|
@@ -5481,14 +5859,14 @@ var DatePicker = ({
|
|
|
5481
5859
|
},
|
|
5482
5860
|
[month, day, min.year, min.month, selectableRange, todayYear, todayMonth, emit]
|
|
5483
5861
|
);
|
|
5484
|
-
const handleMonthChange =
|
|
5862
|
+
const handleMonthChange = React22.useCallback(
|
|
5485
5863
|
(raw) => {
|
|
5486
5864
|
if (!raw || !year) return;
|
|
5487
5865
|
emit(year, Number(raw), day || void 0);
|
|
5488
5866
|
},
|
|
5489
5867
|
[year, day, emit]
|
|
5490
5868
|
);
|
|
5491
|
-
const handleDayChange =
|
|
5869
|
+
const handleDayChange = React22.useCallback(
|
|
5492
5870
|
(raw) => {
|
|
5493
5871
|
if (!raw || !year || !month) return;
|
|
5494
5872
|
emit(year, month, Number(raw));
|
|
@@ -5622,9 +6000,9 @@ var CalendarField = ({
|
|
|
5622
6000
|
nextLabel,
|
|
5623
6001
|
onSelect
|
|
5624
6002
|
}) => {
|
|
5625
|
-
const [open, setOpen] =
|
|
5626
|
-
const valueId =
|
|
5627
|
-
const valueText =
|
|
6003
|
+
const [open, setOpen] = React22.useState(false);
|
|
6004
|
+
const valueId = React22.useId();
|
|
6005
|
+
const valueText = React22.useMemo(() => {
|
|
5628
6006
|
if (!selected) return null;
|
|
5629
6007
|
const options = intlLocale.startsWith("ko") ? { year: "numeric", month: "2-digit", day: "2-digit", weekday: "short" } : { year: "numeric", month: "short", day: "numeric", weekday: "short" };
|
|
5630
6008
|
return new Intl.DateTimeFormat(intlLocale, options).format(
|
|
@@ -5668,16 +6046,15 @@ var CalendarField = ({
|
|
|
5668
6046
|
content: /* @__PURE__ */ jsx(
|
|
5669
6047
|
DateCalendar,
|
|
5670
6048
|
{
|
|
5671
|
-
selected,
|
|
5672
|
-
today,
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
onSelect(date);
|
|
6049
|
+
value: selected ? toIso(selected) : null,
|
|
6050
|
+
today: toIso(today),
|
|
6051
|
+
min: toIso({ ...minMonth, day: 1 }),
|
|
6052
|
+
max: toIso({ ...maxMonth, day: new Date(maxMonth.year, maxMonth.month, 0).getDate() }),
|
|
6053
|
+
isDateDisabled: (iso) => !isSelectable(fromIso(iso)),
|
|
6054
|
+
prevMonthLabel: prevLabel,
|
|
6055
|
+
nextMonthLabel: nextLabel,
|
|
6056
|
+
onValueChange: (iso) => {
|
|
6057
|
+
onSelect(fromIso(iso));
|
|
5681
6058
|
setOpen(false);
|
|
5682
6059
|
}
|
|
5683
6060
|
}
|
|
@@ -5780,13 +6157,13 @@ var FileInput = ({
|
|
|
5780
6157
|
}) => {
|
|
5781
6158
|
const t = useLocaleText();
|
|
5782
6159
|
const label = labelProp ?? t("fileInput.label");
|
|
5783
|
-
const generatedInputId =
|
|
5784
|
-
const helperId =
|
|
6160
|
+
const generatedInputId = React22.useId();
|
|
6161
|
+
const helperId = React22.useId();
|
|
5785
6162
|
const field = useFieldControl();
|
|
5786
6163
|
const inputId = field?.inputId ?? generatedInputId;
|
|
5787
|
-
const inputRef =
|
|
5788
|
-
const [previewUrls, setPreviewUrls] =
|
|
5789
|
-
const previewUrlsRef =
|
|
6164
|
+
const inputRef = React22.useRef(null);
|
|
6165
|
+
const [previewUrls, setPreviewUrls] = React22.useState([]);
|
|
6166
|
+
const previewUrlsRef = React22.useRef([]);
|
|
5790
6167
|
const isPreviewVariant = variant === "preview";
|
|
5791
6168
|
const showPreview = isPreviewVariant || preview;
|
|
5792
6169
|
const handleChange = (e) => {
|
|
@@ -5828,7 +6205,7 @@ var FileInput = ({
|
|
|
5828
6205
|
}
|
|
5829
6206
|
onFiles?.(null);
|
|
5830
6207
|
};
|
|
5831
|
-
|
|
6208
|
+
React22.useEffect(() => {
|
|
5832
6209
|
return () => {
|
|
5833
6210
|
for (const url of previewUrlsRef.current) {
|
|
5834
6211
|
URL.revokeObjectURL(url);
|
|
@@ -5892,6 +6269,64 @@ var FileInput = ({
|
|
|
5892
6269
|
)) })
|
|
5893
6270
|
] });
|
|
5894
6271
|
};
|
|
6272
|
+
var FilterBar = ({
|
|
6273
|
+
children,
|
|
6274
|
+
onSubmit,
|
|
6275
|
+
onReset,
|
|
6276
|
+
canSubmit = true,
|
|
6277
|
+
canReset = true,
|
|
6278
|
+
loading = false,
|
|
6279
|
+
disabled = false,
|
|
6280
|
+
submitLabel: submitLabelProp,
|
|
6281
|
+
resetLabel: resetLabelProp,
|
|
6282
|
+
fieldMinWidth = 200,
|
|
6283
|
+
className,
|
|
6284
|
+
style,
|
|
6285
|
+
...props
|
|
6286
|
+
}) => {
|
|
6287
|
+
const t = useLocaleText();
|
|
6288
|
+
const submitLabel = submitLabelProp ?? t("filterBar.submit");
|
|
6289
|
+
const resetLabel = resetLabelProp ?? t("filterBar.reset");
|
|
6290
|
+
const submitBlocked = disabled || loading || !canSubmit;
|
|
6291
|
+
return (
|
|
6292
|
+
// biome-ignore lint/a11y/useSemanticElements: `<search>` 는 Safari 17 · Chrome 118 부터라 그 이전엔 랜드마크가 사라진다. form 에 role 을 두면 aria-label 과 form 속성이 한 요소에 모인다
|
|
6293
|
+
/* @__PURE__ */ jsxs(
|
|
6294
|
+
"form",
|
|
6295
|
+
{
|
|
6296
|
+
...props,
|
|
6297
|
+
noValidate: true,
|
|
6298
|
+
role: "search",
|
|
6299
|
+
"aria-busy": loading || void 0,
|
|
6300
|
+
className: cn("filter_bar", className),
|
|
6301
|
+
style: {
|
|
6302
|
+
...style,
|
|
6303
|
+
"--filter-bar-field-min": typeof fieldMinWidth === "number" ? `${fieldMinWidth}px` : fieldMinWidth
|
|
6304
|
+
},
|
|
6305
|
+
onSubmit: (e) => {
|
|
6306
|
+
e.preventDefault();
|
|
6307
|
+
if (!submitBlocked) onSubmit();
|
|
6308
|
+
},
|
|
6309
|
+
children: [
|
|
6310
|
+
/* @__PURE__ */ jsx("div", { className: "filter_bar_fields", children }),
|
|
6311
|
+
/* @__PURE__ */ jsxs("div", { className: "filter_bar_actions", children: [
|
|
6312
|
+
onReset && /* @__PURE__ */ jsx(Button, { type: "button", variant: "text", disabled: disabled || !canReset, onClick: onReset, children: resetLabel }),
|
|
6313
|
+
/* @__PURE__ */ jsx(
|
|
6314
|
+
Button,
|
|
6315
|
+
{
|
|
6316
|
+
type: "submit",
|
|
6317
|
+
disabled: disabled || !canSubmit,
|
|
6318
|
+
"aria-disabled": loading || void 0,
|
|
6319
|
+
leadingIcon: loading ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: /* @__PURE__ */ jsx(Spinner, { size: 16 }) }) : void 0,
|
|
6320
|
+
children: submitLabel
|
|
6321
|
+
}
|
|
6322
|
+
)
|
|
6323
|
+
] })
|
|
6324
|
+
]
|
|
6325
|
+
}
|
|
6326
|
+
)
|
|
6327
|
+
);
|
|
6328
|
+
};
|
|
6329
|
+
FilterBar.displayName = "FilterBar";
|
|
5895
6330
|
|
|
5896
6331
|
// src/ui/forms/image-cropper/crop.util.ts
|
|
5897
6332
|
var getCoverScale = (image, viewportSize) => Math.max(viewportSize / image.width, viewportSize / image.height);
|
|
@@ -6236,13 +6671,13 @@ var OtpInput = ({
|
|
|
6236
6671
|
}) => {
|
|
6237
6672
|
const t = useLocaleText();
|
|
6238
6673
|
const ariaLabel = ariaLabelProp ?? t("otpInput.label");
|
|
6239
|
-
const inputsRef =
|
|
6240
|
-
const isTypingRef =
|
|
6241
|
-
const typingTimerRef =
|
|
6242
|
-
|
|
6674
|
+
const inputsRef = React22.useRef([]);
|
|
6675
|
+
const isTypingRef = React22.useRef(false);
|
|
6676
|
+
const typingTimerRef = React22.useRef(void 0);
|
|
6677
|
+
React22.useEffect(() => {
|
|
6243
6678
|
if (autoFocus) inputsRef.current[0]?.focus();
|
|
6244
6679
|
}, [autoFocus]);
|
|
6245
|
-
const digits =
|
|
6680
|
+
const digits = React22.useMemo(() => {
|
|
6246
6681
|
const chars = value.split("").slice(0, length);
|
|
6247
6682
|
while (chars.length < length) chars.push("");
|
|
6248
6683
|
return chars;
|
|
@@ -6277,7 +6712,7 @@ var OtpInput = ({
|
|
|
6277
6712
|
}, 50);
|
|
6278
6713
|
}
|
|
6279
6714
|
};
|
|
6280
|
-
|
|
6715
|
+
React22.useEffect(() => () => clearTimeout(typingTimerRef.current), []);
|
|
6281
6716
|
const handleFocus = (index) => {
|
|
6282
6717
|
if (isTypingRef.current) return;
|
|
6283
6718
|
const firstEmpty = digits.indexOf("");
|
|
@@ -6319,7 +6754,7 @@ var OtpInput = ({
|
|
|
6319
6754
|
focusInput(nextIndex);
|
|
6320
6755
|
};
|
|
6321
6756
|
const rootClassName = cn("otp_input", className);
|
|
6322
|
-
const supportingId =
|
|
6757
|
+
const supportingId = React22.useId();
|
|
6323
6758
|
const field = useFieldControl();
|
|
6324
6759
|
return (
|
|
6325
6760
|
// biome-ignore lint/a11y/useSemanticElements: <fieldset> would force border/legend styles; role=group is the WAI-ARIA equivalent for OTP grouping
|
|
@@ -6374,9 +6809,9 @@ var OtpInput = ({
|
|
|
6374
6809
|
);
|
|
6375
6810
|
};
|
|
6376
6811
|
OtpInput.displayName = "OtpInput";
|
|
6377
|
-
var RadioGroupContext =
|
|
6812
|
+
var RadioGroupContext = React22.createContext(null);
|
|
6378
6813
|
function useRadioGroupContext() {
|
|
6379
|
-
return
|
|
6814
|
+
return React22.useContext(RadioGroupContext);
|
|
6380
6815
|
}
|
|
6381
6816
|
var RadioGroup = ({
|
|
6382
6817
|
value: controlledValue,
|
|
@@ -6394,23 +6829,23 @@ var RadioGroup = ({
|
|
|
6394
6829
|
...props
|
|
6395
6830
|
}) => {
|
|
6396
6831
|
const isControlled = controlledValue !== void 0;
|
|
6397
|
-
const [internalValue, setInternalValue] =
|
|
6832
|
+
const [internalValue, setInternalValue] = React22.useState(defaultValue);
|
|
6398
6833
|
const value = isControlled ? controlledValue : internalValue;
|
|
6399
|
-
const generatedName =
|
|
6834
|
+
const generatedName = React22.useId();
|
|
6400
6835
|
const name = nameProp ?? generatedName;
|
|
6401
|
-
const idPrefix =
|
|
6836
|
+
const idPrefix = React22.useId();
|
|
6402
6837
|
const field = useFieldControl();
|
|
6403
6838
|
const labelId = label ? `${idPrefix}-label` : void 0;
|
|
6404
6839
|
const helperId = supportingText ? `${idPrefix}-help` : void 0;
|
|
6405
6840
|
const { ariaProps, restProps } = splitAriaProps(props);
|
|
6406
|
-
const onChange =
|
|
6841
|
+
const onChange = React22.useCallback(
|
|
6407
6842
|
(next) => {
|
|
6408
6843
|
if (!isControlled) setInternalValue(next);
|
|
6409
6844
|
onValueChange?.(next);
|
|
6410
6845
|
},
|
|
6411
6846
|
[isControlled, onValueChange]
|
|
6412
6847
|
);
|
|
6413
|
-
const ctx =
|
|
6848
|
+
const ctx = React22.useMemo(
|
|
6414
6849
|
() => ({ name, value, onChange, size, disabled }),
|
|
6415
6850
|
[name, value, onChange, size, disabled]
|
|
6416
6851
|
);
|
|
@@ -6491,6 +6926,101 @@ var Radio = ({
|
|
|
6491
6926
|
] });
|
|
6492
6927
|
};
|
|
6493
6928
|
Radio.displayName = "Radio";
|
|
6929
|
+
var SegmentedControl = ({
|
|
6930
|
+
items,
|
|
6931
|
+
value: controlledValue,
|
|
6932
|
+
defaultValue,
|
|
6933
|
+
onValueChange,
|
|
6934
|
+
name: nameProp,
|
|
6935
|
+
size = "md",
|
|
6936
|
+
fullWidth = false,
|
|
6937
|
+
disabled = false,
|
|
6938
|
+
required = false,
|
|
6939
|
+
className,
|
|
6940
|
+
onKeyDown: onKeyDownProp,
|
|
6941
|
+
...props
|
|
6942
|
+
}) => {
|
|
6943
|
+
const isControlled = controlledValue !== void 0;
|
|
6944
|
+
const [internalValue, setInternalValue] = React22.useState(defaultValue);
|
|
6945
|
+
const value = isControlled ? controlledValue : internalValue;
|
|
6946
|
+
const generatedName = React22.useId();
|
|
6947
|
+
const name = nameProp ?? generatedName;
|
|
6948
|
+
const field = useFieldControl();
|
|
6949
|
+
const { ariaProps, restProps } = splitAriaProps(props);
|
|
6950
|
+
const isRequired = required || !!field?.required;
|
|
6951
|
+
const select = (next) => {
|
|
6952
|
+
if (!isControlled) setInternalValue(next);
|
|
6953
|
+
onValueChange?.(next);
|
|
6954
|
+
};
|
|
6955
|
+
const onKeyDown = (e) => {
|
|
6956
|
+
onKeyDownProp?.(e);
|
|
6957
|
+
if (e.defaultPrevented || e.key !== "Home" && e.key !== "End") return;
|
|
6958
|
+
const enabled = items.filter((item) => !(disabled || item.disabled));
|
|
6959
|
+
const target = e.key === "Home" ? enabled[0] : enabled.at(-1);
|
|
6960
|
+
if (!target) return;
|
|
6961
|
+
e.preventDefault();
|
|
6962
|
+
select(target.value);
|
|
6963
|
+
const input = e.currentTarget.querySelector(
|
|
6964
|
+
`input[value="${CSS.escape(target.value)}"]`
|
|
6965
|
+
);
|
|
6966
|
+
input?.focus();
|
|
6967
|
+
};
|
|
6968
|
+
return /* @__PURE__ */ jsx(
|
|
6969
|
+
"div",
|
|
6970
|
+
{
|
|
6971
|
+
role: "radiogroup",
|
|
6972
|
+
...restProps,
|
|
6973
|
+
...ariaProps,
|
|
6974
|
+
"aria-labelledby": field?.labelId ?? ariaProps["aria-labelledby"],
|
|
6975
|
+
"aria-describedby": field?.describedBy ?? ariaProps["aria-describedby"],
|
|
6976
|
+
"aria-invalid": field ? field.invalid || void 0 : ariaProps["aria-invalid"],
|
|
6977
|
+
"aria-required": isRequired || void 0,
|
|
6978
|
+
"aria-disabled": disabled || void 0,
|
|
6979
|
+
className: cn(
|
|
6980
|
+
"segmented_control",
|
|
6981
|
+
`segmented_control_size_${size}`,
|
|
6982
|
+
fullWidth && "segmented_control_full_width",
|
|
6983
|
+
disabled && "segmented_control_disabled",
|
|
6984
|
+
className
|
|
6985
|
+
),
|
|
6986
|
+
onKeyDown,
|
|
6987
|
+
children: items.map((item) => {
|
|
6988
|
+
const selected = item.value === value;
|
|
6989
|
+
const itemDisabled = disabled || !!item.disabled;
|
|
6990
|
+
return /* @__PURE__ */ jsxs(
|
|
6991
|
+
"label",
|
|
6992
|
+
{
|
|
6993
|
+
className: cn(
|
|
6994
|
+
"segmented_control_item",
|
|
6995
|
+
selected && "segmented_control_item_selected",
|
|
6996
|
+
itemDisabled && "segmented_control_item_disabled"
|
|
6997
|
+
),
|
|
6998
|
+
children: [
|
|
6999
|
+
/* @__PURE__ */ jsx(
|
|
7000
|
+
"input",
|
|
7001
|
+
{
|
|
7002
|
+
type: "radio",
|
|
7003
|
+
className: "segmented_control_input",
|
|
7004
|
+
name,
|
|
7005
|
+
value: item.value,
|
|
7006
|
+
checked: selected,
|
|
7007
|
+
disabled: itemDisabled,
|
|
7008
|
+
required: isRequired,
|
|
7009
|
+
"aria-label": item.ariaLabel,
|
|
7010
|
+
onChange: () => select(item.value)
|
|
7011
|
+
}
|
|
7012
|
+
),
|
|
7013
|
+
item.icon && /* @__PURE__ */ jsx("span", { className: "segmented_control_icon", "aria-hidden": "true", children: item.icon }),
|
|
7014
|
+
item.label != null && /* @__PURE__ */ jsx("span", { className: "segmented_control_label", children: item.label })
|
|
7015
|
+
]
|
|
7016
|
+
},
|
|
7017
|
+
item.value
|
|
7018
|
+
);
|
|
7019
|
+
})
|
|
7020
|
+
}
|
|
7021
|
+
);
|
|
7022
|
+
};
|
|
7023
|
+
SegmentedControl.displayName = "SegmentedControl";
|
|
6494
7024
|
var SEPARATORS = /[,\t\n\r]+/;
|
|
6495
7025
|
var splitTags = (text) => text.split(SEPARATORS).map((part) => part.trim()).filter(Boolean);
|
|
6496
7026
|
var TagInput = ({
|
|
@@ -6777,7 +7307,7 @@ var toMinutes = (value) => {
|
|
|
6777
7307
|
if (h < 0 || h > 23 || m < 0 || m > 59) return null;
|
|
6778
7308
|
return h * 60 + m;
|
|
6779
7309
|
};
|
|
6780
|
-
var
|
|
7310
|
+
var pad4 = (n) => String(n).padStart(2, "0");
|
|
6781
7311
|
var TimePicker = ({
|
|
6782
7312
|
label,
|
|
6783
7313
|
value,
|
|
@@ -6796,27 +7326,27 @@ var TimePicker = ({
|
|
|
6796
7326
|
const minuteLabel = minuteLabelProp ?? t("timePicker.minute");
|
|
6797
7327
|
const field = useFieldControl();
|
|
6798
7328
|
const isRequired = field ? field.required || void 0 : required || void 0;
|
|
6799
|
-
const groupId =
|
|
6800
|
-
const constraintId =
|
|
7329
|
+
const groupId = React22.useId();
|
|
7330
|
+
const constraintId = React22.useId();
|
|
6801
7331
|
const min = toMinutes(minTime) ?? 0;
|
|
6802
7332
|
const max = toMinutes(maxTime) ?? 23 * 60 + 59;
|
|
6803
7333
|
const parsed = toMinutes(value);
|
|
6804
7334
|
const hour = parsed === null ? null : Math.floor(parsed / 60);
|
|
6805
7335
|
const minute = parsed === null ? null : parsed % 60;
|
|
6806
|
-
const hourOptions =
|
|
7336
|
+
const hourOptions = React22.useMemo(() => {
|
|
6807
7337
|
const first = Math.floor(min / 60);
|
|
6808
7338
|
const last = Math.floor(max / 60);
|
|
6809
7339
|
return Array.from({ length: Math.max(0, last - first + 1) }, (_, i) => {
|
|
6810
7340
|
const h = first + i;
|
|
6811
|
-
return { value: String(h), label:
|
|
7341
|
+
return { value: String(h), label: pad4(h) };
|
|
6812
7342
|
});
|
|
6813
7343
|
}, [min, max]);
|
|
6814
|
-
const minuteOptions =
|
|
7344
|
+
const minuteOptions = React22.useMemo(() => {
|
|
6815
7345
|
if (hour === null) return [];
|
|
6816
7346
|
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:
|
|
7347
|
+
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
7348
|
}, [hour, minuteStep, min, max]);
|
|
6819
|
-
const emit = (h, m) => onValueChange(`${
|
|
7349
|
+
const emit = (h, m) => onValueChange(`${pad4(h)}:${pad4(m)}`);
|
|
6820
7350
|
const handleHourChange = (raw) => {
|
|
6821
7351
|
if (!raw) return;
|
|
6822
7352
|
const h = Number(raw);
|
|
@@ -6901,7 +7431,7 @@ var Toggle = ({
|
|
|
6901
7431
|
...props
|
|
6902
7432
|
}) => {
|
|
6903
7433
|
const isControlled = checked !== void 0;
|
|
6904
|
-
const [innerChecked, setInnerChecked] =
|
|
7434
|
+
const [innerChecked, setInnerChecked] = React22.useState(!!defaultChecked);
|
|
6905
7435
|
const isOn = isControlled ? !!checked : innerChecked;
|
|
6906
7436
|
const handleToggle = (e) => {
|
|
6907
7437
|
props.onClick?.(e);
|
|
@@ -6956,6 +7486,59 @@ var IconButton = ({
|
|
|
6956
7486
|
);
|
|
6957
7487
|
return /* @__PURE__ */ jsx("button", { ref, type, className: buttonClassName, ...props, children: /* @__PURE__ */ jsx("span", { className: "icon_button_icon", "aria-hidden": "true", children: icon }) });
|
|
6958
7488
|
};
|
|
7489
|
+
var CopyButton = ({
|
|
7490
|
+
text,
|
|
7491
|
+
label: labelProp,
|
|
7492
|
+
copiedLabel: copiedLabelProp,
|
|
7493
|
+
failedLabel: failedLabelProp,
|
|
7494
|
+
iconOnly = false,
|
|
7495
|
+
size = "sm",
|
|
7496
|
+
variant = "outline",
|
|
7497
|
+
resetAfter = 2e3,
|
|
7498
|
+
onCopy,
|
|
7499
|
+
onError,
|
|
7500
|
+
className,
|
|
7501
|
+
...props
|
|
7502
|
+
}) => {
|
|
7503
|
+
const t = useLocaleText();
|
|
7504
|
+
const label = labelProp ?? t("copyButton.copy");
|
|
7505
|
+
const copiedLabel = copiedLabelProp ?? t("copyButton.copied");
|
|
7506
|
+
const failedLabel = failedLabelProp ?? t("copyButton.failed");
|
|
7507
|
+
const { copy, status } = useClipboard({ resetAfter, onCopy, onError });
|
|
7508
|
+
const copied = status === "copied";
|
|
7509
|
+
const handleClick = () => {
|
|
7510
|
+
void copy(text);
|
|
7511
|
+
};
|
|
7512
|
+
const icon = copied ? /* @__PURE__ */ jsx(Check, { size: iconSize.sm }) : /* @__PURE__ */ jsx(Copy, { size: iconSize.sm });
|
|
7513
|
+
const message = copied ? copiedLabel : status === "error" ? failedLabel : "";
|
|
7514
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7515
|
+
iconOnly ? /* @__PURE__ */ jsx(
|
|
7516
|
+
IconButton,
|
|
7517
|
+
{
|
|
7518
|
+
...props,
|
|
7519
|
+
size,
|
|
7520
|
+
icon,
|
|
7521
|
+
"aria-label": label,
|
|
7522
|
+
className,
|
|
7523
|
+
onClick: handleClick
|
|
7524
|
+
}
|
|
7525
|
+
) : /* @__PURE__ */ jsx(
|
|
7526
|
+
Button,
|
|
7527
|
+
{
|
|
7528
|
+
...props,
|
|
7529
|
+
size,
|
|
7530
|
+
variant,
|
|
7531
|
+
leadingIcon: icon,
|
|
7532
|
+
"aria-label": label,
|
|
7533
|
+
className,
|
|
7534
|
+
onClick: handleClick,
|
|
7535
|
+
children: /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: copied ? copiedLabel : label })
|
|
7536
|
+
}
|
|
7537
|
+
),
|
|
7538
|
+
/* @__PURE__ */ jsx("span", { className: "copy_button_status", role: "status", children: message })
|
|
7539
|
+
] });
|
|
7540
|
+
};
|
|
7541
|
+
CopyButton.displayName = "CopyButton";
|
|
6959
7542
|
var SLIDE_FROM = {
|
|
6960
7543
|
left: "translateX(-100%)",
|
|
6961
7544
|
right: "translateX(100%)",
|
|
@@ -6982,16 +7565,16 @@ var Drawer = ({
|
|
|
6982
7565
|
}) => {
|
|
6983
7566
|
const t = useLocaleText();
|
|
6984
7567
|
const closeLabel = closeLabelProp ?? t("drawer.close");
|
|
6985
|
-
const lastContentRef =
|
|
7568
|
+
const lastContentRef = React22.useRef({ children, title, footer });
|
|
6986
7569
|
if (open) lastContentRef.current = { children, title, footer };
|
|
6987
7570
|
const content = open ? { children, title, footer } : lastContentRef.current;
|
|
6988
7571
|
const overlayDismissible = dismissible ?? closeOnOverlay;
|
|
6989
7572
|
const escapeDismissible = dismissible ?? true;
|
|
6990
|
-
const panelRef =
|
|
6991
|
-
const bodyRef =
|
|
6992
|
-
const pressedOverlayRef =
|
|
6993
|
-
const titleId =
|
|
6994
|
-
const [shouldRender, setShouldRender] =
|
|
7573
|
+
const panelRef = React22.useRef(null);
|
|
7574
|
+
const bodyRef = React22.useRef(null);
|
|
7575
|
+
const pressedOverlayRef = React22.useRef(false);
|
|
7576
|
+
const titleId = React22.useId();
|
|
7577
|
+
const [shouldRender, setShouldRender] = React22.useState(open);
|
|
6995
7578
|
const instant = useReducedMotion() || disableAnimation;
|
|
6996
7579
|
const isMounted = useIsMounted();
|
|
6997
7580
|
useFocusTrap(panelRef, open && isMounted, {
|
|
@@ -7002,13 +7585,13 @@ var Drawer = ({
|
|
|
7002
7585
|
if (escapeDismissible) onClose?.();
|
|
7003
7586
|
});
|
|
7004
7587
|
if (open && !shouldRender) setShouldRender(true);
|
|
7005
|
-
const renderingRef =
|
|
7006
|
-
const onExitedRef =
|
|
7588
|
+
const renderingRef = React22.useRef(shouldRender);
|
|
7589
|
+
const onExitedRef = React22.useRef(onExited);
|
|
7007
7590
|
useSafeLayoutEffect(() => {
|
|
7008
7591
|
renderingRef.current = shouldRender;
|
|
7009
7592
|
onExitedRef.current = onExited;
|
|
7010
7593
|
});
|
|
7011
|
-
const finishExit =
|
|
7594
|
+
const finishExit = React22.useCallback(() => {
|
|
7012
7595
|
if (!renderingRef.current) return;
|
|
7013
7596
|
renderingRef.current = false;
|
|
7014
7597
|
setShouldRender(false);
|
|
@@ -7025,7 +7608,7 @@ var Drawer = ({
|
|
|
7025
7608
|
}
|
|
7026
7609
|
});
|
|
7027
7610
|
const overlayOpacity = overlayStyle.opacity;
|
|
7028
|
-
|
|
7611
|
+
React22.useEffect(() => {
|
|
7029
7612
|
if (open || !shouldRender) return;
|
|
7030
7613
|
const frame = requestAnimationFrame(() => {
|
|
7031
7614
|
if (!overlayOpacity.isAnimating && overlayOpacity.get() === 0) finishExit();
|
|
@@ -7040,7 +7623,7 @@ var Drawer = ({
|
|
|
7040
7623
|
immediate: instant,
|
|
7041
7624
|
config: OVERLAY_SPRING_CONFIG
|
|
7042
7625
|
});
|
|
7043
|
-
|
|
7626
|
+
React22.useEffect(() => {
|
|
7044
7627
|
if (!shouldRender) return;
|
|
7045
7628
|
lockBodyScroll();
|
|
7046
7629
|
return () => {
|
|
@@ -7128,16 +7711,16 @@ var Modal = ({
|
|
|
7128
7711
|
}) => {
|
|
7129
7712
|
const t = useLocaleText();
|
|
7130
7713
|
const closeLabel = closeLabelProp ?? t("modal.close");
|
|
7131
|
-
const lastContentRef =
|
|
7714
|
+
const lastContentRef = React22.useRef({ children, title, description, footer });
|
|
7132
7715
|
if (open) lastContentRef.current = { children, title, description, footer };
|
|
7133
7716
|
const content = open ? { children, title, description, footer } : lastContentRef.current;
|
|
7134
7717
|
const overlayDismissible = dismissible ?? closeOnOverlay;
|
|
7135
7718
|
const escapeDismissible = dismissible ?? true;
|
|
7136
|
-
const panelRef =
|
|
7137
|
-
const bodyRef =
|
|
7138
|
-
const pressedOverlayRef =
|
|
7139
|
-
const titleId =
|
|
7140
|
-
const [shouldRender, setShouldRender] =
|
|
7719
|
+
const panelRef = React22.useRef(null);
|
|
7720
|
+
const bodyRef = React22.useRef(null);
|
|
7721
|
+
const pressedOverlayRef = React22.useRef(false);
|
|
7722
|
+
const titleId = React22.useId();
|
|
7723
|
+
const [shouldRender, setShouldRender] = React22.useState(open);
|
|
7141
7724
|
const isMounted = useIsMounted();
|
|
7142
7725
|
useFocusTrap(panelRef, open && isMounted, {
|
|
7143
7726
|
preferWithin: bodyRef,
|
|
@@ -7168,7 +7751,7 @@ var Modal = ({
|
|
|
7168
7751
|
immediate: reduced,
|
|
7169
7752
|
config: OVERLAY_SPRING_CONFIG
|
|
7170
7753
|
});
|
|
7171
|
-
|
|
7754
|
+
React22.useEffect(() => {
|
|
7172
7755
|
if (!shouldRender) return;
|
|
7173
7756
|
lockBodyScroll();
|
|
7174
7757
|
return () => {
|
|
@@ -7230,9 +7813,9 @@ var Modal = ({
|
|
|
7230
7813
|
document.body
|
|
7231
7814
|
);
|
|
7232
7815
|
};
|
|
7233
|
-
var ThemeContext =
|
|
7816
|
+
var ThemeContext = React22.createContext(null);
|
|
7234
7817
|
var useTheme = () => {
|
|
7235
|
-
const ctx =
|
|
7818
|
+
const ctx = React22.useContext(ThemeContext);
|
|
7236
7819
|
if (!ctx) {
|
|
7237
7820
|
throw new Error(
|
|
7238
7821
|
'[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 +7839,15 @@ var ThemeProvider = ({
|
|
|
7256
7839
|
targetSelector,
|
|
7257
7840
|
children
|
|
7258
7841
|
}) => {
|
|
7259
|
-
const [mode, setModeState] =
|
|
7260
|
-
const [systemDark, setSystemDark] =
|
|
7261
|
-
|
|
7842
|
+
const [mode, setModeState] = React22.useState(defaultMode);
|
|
7843
|
+
const [systemDark, setSystemDark] = React22.useState(false);
|
|
7844
|
+
React22.useEffect(() => {
|
|
7262
7845
|
setModeState(readStored(storageKey) ?? defaultMode);
|
|
7263
7846
|
if (isClient) {
|
|
7264
7847
|
setSystemDark(window.matchMedia("(prefers-color-scheme: dark)").matches);
|
|
7265
7848
|
}
|
|
7266
7849
|
}, [storageKey, defaultMode]);
|
|
7267
|
-
|
|
7850
|
+
React22.useEffect(() => {
|
|
7268
7851
|
if (!isClient) return;
|
|
7269
7852
|
const mq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
7270
7853
|
const handler = (e) => setSystemDark(e.matches);
|
|
@@ -7272,7 +7855,7 @@ var ThemeProvider = ({
|
|
|
7272
7855
|
return () => mq.removeEventListener("change", handler);
|
|
7273
7856
|
}, []);
|
|
7274
7857
|
const resolved = mode === "system" ? systemDark ? "dark" : "light" : mode;
|
|
7275
|
-
|
|
7858
|
+
React22.useEffect(() => {
|
|
7276
7859
|
if (!isClient) return;
|
|
7277
7860
|
const target = targetSelector ? document.querySelector(targetSelector) : document.documentElement;
|
|
7278
7861
|
if (!target) return;
|
|
@@ -7282,7 +7865,7 @@ var ThemeProvider = ({
|
|
|
7282
7865
|
target.setAttribute("data-theme", mode);
|
|
7283
7866
|
}
|
|
7284
7867
|
}, [mode, targetSelector]);
|
|
7285
|
-
const setMode =
|
|
7868
|
+
const setMode = React22.useCallback(
|
|
7286
7869
|
(next) => {
|
|
7287
7870
|
setModeState(next);
|
|
7288
7871
|
if (storageKey && isClient) {
|
|
@@ -7294,7 +7877,7 @@ var ThemeProvider = ({
|
|
|
7294
7877
|
},
|
|
7295
7878
|
[storageKey]
|
|
7296
7879
|
);
|
|
7297
|
-
const value =
|
|
7880
|
+
const value = React22.useMemo(
|
|
7298
7881
|
() => ({ mode, resolved, setMode }),
|
|
7299
7882
|
[mode, resolved, setMode]
|
|
7300
7883
|
);
|
|
@@ -7449,4 +8032,4 @@ var Stack = ({
|
|
|
7449
8032
|
);
|
|
7450
8033
|
};
|
|
7451
8034
|
|
|
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 };
|
|
8035
|
+
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 };
|