@bigtablet/design-system 3.29.1 → 3.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +173 -0
- package/dist/index.d.ts +15 -1
- package/dist/index.js +464 -157
- package/package.json +1 -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 React21 from 'react';
|
|
4
4
|
import { createContext, useState, useRef, useCallback, useEffect, useMemo, useContext, useId, Fragment as Fragment$1, useImperativeHandle, useLayoutEffect } from 'react';
|
|
5
5
|
import { useSpring, animated } from '@react-spring/web';
|
|
6
|
-
import { ChevronDown, ChevronRight, Globe, ChevronLeft, Check, EyeOff, Eye, ArrowUp, ArrowDown, ArrowUpDown, Search, XCircle, AlertTriangle, CheckCircle2, Info, Bell, Image, X, TriangleAlert } from 'lucide-react';
|
|
6
|
+
import { ChevronDown, ChevronRight, Globe, ChevronLeft, Check, EyeOff, Eye, ArrowUp, ArrowDown, ArrowUpDown, Search, XCircle, AlertTriangle, CheckCircle2, Info, Bell, Calendar, Image, X, TriangleAlert } from 'lucide-react';
|
|
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 = React21.useRef(onEscape);
|
|
85
|
+
React21.useEffect(() => {
|
|
86
86
|
handlerRef.current = onEscape;
|
|
87
87
|
});
|
|
88
|
-
|
|
88
|
+
React21.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] = React21.useState({
|
|
306
306
|
x: 0,
|
|
307
307
|
y: 0,
|
|
308
308
|
placement,
|
|
@@ -372,8 +372,8 @@ var FOCUSABLE_SELECTORS = [
|
|
|
372
372
|
'[tabindex]:not([tabindex="-1"])'
|
|
373
373
|
].join(", ");
|
|
374
374
|
function useFocusTrap(containerRef, isActive, options) {
|
|
375
|
-
const previousActiveElement =
|
|
376
|
-
|
|
375
|
+
const previousActiveElement = React21.useRef(null);
|
|
376
|
+
React21.useEffect(() => {
|
|
377
377
|
if (!isActive) return;
|
|
378
378
|
const container = containerRef.current;
|
|
379
379
|
if (!container) return;
|
|
@@ -431,8 +431,8 @@ function useFocusTrap(containerRef, isActive, options) {
|
|
|
431
431
|
}, [isActive, containerRef]);
|
|
432
432
|
}
|
|
433
433
|
function useIsMounted() {
|
|
434
|
-
const [mounted, setMounted] =
|
|
435
|
-
|
|
434
|
+
const [mounted, setMounted] = React21.useState(false);
|
|
435
|
+
React21.useEffect(() => {
|
|
436
436
|
setMounted(true);
|
|
437
437
|
}, []);
|
|
438
438
|
return mounted;
|
|
@@ -466,13 +466,13 @@ function getServerSnapshot() {
|
|
|
466
466
|
return false;
|
|
467
467
|
}
|
|
468
468
|
function useReducedMotion() {
|
|
469
|
-
return
|
|
469
|
+
return React21.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
470
470
|
}
|
|
471
471
|
function useSpringHover({
|
|
472
472
|
scale = 1.02,
|
|
473
473
|
lift = -2
|
|
474
474
|
} = {}) {
|
|
475
|
-
const [hovered, setHovered] =
|
|
475
|
+
const [hovered, setHovered] = React21.useState(false);
|
|
476
476
|
const reduced = useReducedMotion();
|
|
477
477
|
const style = useSpring({
|
|
478
478
|
transform: hovered ? `translateY(${lift}px) scale(${scale})` : "translateY(0px) scale(1)",
|
|
@@ -746,9 +746,9 @@ var Accordion = ({
|
|
|
746
746
|
...props
|
|
747
747
|
}) => {
|
|
748
748
|
const isControlled = controlledKeys !== void 0;
|
|
749
|
-
const [internalKeys, setInternalKeys] =
|
|
749
|
+
const [internalKeys, setInternalKeys] = React21.useState(defaultOpenKeys);
|
|
750
750
|
const open = isControlled ? controlledKeys ?? [] : internalKeys;
|
|
751
|
-
const idPrefix =
|
|
751
|
+
const idPrefix = React21.useId();
|
|
752
752
|
const toggle = (key) => {
|
|
753
753
|
const isOpen = open.includes(key);
|
|
754
754
|
const next = isOpen ? open.filter((k) => k !== key) : multiple ? [...open, key] : [key];
|
|
@@ -813,7 +813,7 @@ var Avatar = ({
|
|
|
813
813
|
style,
|
|
814
814
|
...props
|
|
815
815
|
}) => {
|
|
816
|
-
const [failedSrc, setFailedSrc] =
|
|
816
|
+
const [failedSrc, setFailedSrc] = React21.useState(null);
|
|
817
817
|
const showImage = src && failedSrc !== src;
|
|
818
818
|
const initials = getInitials(name);
|
|
819
819
|
return (
|
|
@@ -1015,9 +1015,13 @@ var ko = {
|
|
|
1015
1015
|
"combobox.idle": "\uAC80\uC0C9\uC5B4\uB97C \uC785\uB825\uD558\uC138\uC694",
|
|
1016
1016
|
"combobox.loading": "\uAC80\uC0C9 \uC911",
|
|
1017
1017
|
"combobox.placeholder": "\uAC80\uC0C9\uD574\uC11C \uC120\uD0DD",
|
|
1018
|
+
"datePicker.calendar": "\uB2EC\uB825",
|
|
1018
1019
|
"datePicker.day": "\uC77C",
|
|
1019
1020
|
"datePicker.minDateSr": "\uCD5C\uC18C \uB0A0\uC9DC: {date}",
|
|
1020
1021
|
"datePicker.month": "\uC6D4",
|
|
1022
|
+
"datePicker.nextMonth": "\uB2E4\uC74C \uB2EC",
|
|
1023
|
+
"datePicker.placeholder": "\uB0A0\uC9DC \uC120\uD0DD",
|
|
1024
|
+
"datePicker.prevMonth": "\uC774\uC804 \uB2EC",
|
|
1021
1025
|
"datePicker.rangeUntilTodaySr": "\uC624\uB298\uAE4C\uC9C0 \uC120\uD0DD \uAC00\uB2A5",
|
|
1022
1026
|
"datePicker.year": "\uB144",
|
|
1023
1027
|
"dateRange.end": "\uC885\uB8CC\uC77C",
|
|
@@ -1082,9 +1086,13 @@ var en = {
|
|
|
1082
1086
|
"combobox.idle": "Type to search",
|
|
1083
1087
|
"combobox.loading": "Searching",
|
|
1084
1088
|
"combobox.placeholder": "Search to select",
|
|
1089
|
+
"datePicker.calendar": "Calendar",
|
|
1085
1090
|
"datePicker.day": "Day",
|
|
1086
1091
|
"datePicker.minDateSr": "Earliest date: {date}",
|
|
1087
1092
|
"datePicker.month": "Month",
|
|
1093
|
+
"datePicker.nextMonth": "Next month",
|
|
1094
|
+
"datePicker.placeholder": "Select date",
|
|
1095
|
+
"datePicker.prevMonth": "Previous month",
|
|
1088
1096
|
"datePicker.rangeUntilTodaySr": "Selectable up to today",
|
|
1089
1097
|
"datePicker.year": "Year",
|
|
1090
1098
|
"dateRange.end": "End date",
|
|
@@ -1299,11 +1307,11 @@ var Breadcrumb = ({
|
|
|
1299
1307
|
};
|
|
1300
1308
|
var MENU_GAP = 4;
|
|
1301
1309
|
var Menu = ({ items, trigger, align = "start" }) => {
|
|
1302
|
-
const [open, setOpen] =
|
|
1303
|
-
const wrapperRef =
|
|
1304
|
-
const menuRef =
|
|
1305
|
-
const itemRefs =
|
|
1306
|
-
const menuId =
|
|
1310
|
+
const [open, setOpen] = React21.useState(false);
|
|
1311
|
+
const wrapperRef = React21.useRef(null);
|
|
1312
|
+
const menuRef = React21.useRef(null);
|
|
1313
|
+
const itemRefs = React21.useRef([]);
|
|
1314
|
+
const menuId = React21.useId();
|
|
1307
1315
|
const pos = useAnchoredPosition({
|
|
1308
1316
|
open,
|
|
1309
1317
|
anchorRef: wrapperRef,
|
|
@@ -1313,7 +1321,7 @@ var Menu = ({ items, trigger, align = "start" }) => {
|
|
|
1313
1321
|
gap: MENU_GAP,
|
|
1314
1322
|
padding: 8
|
|
1315
1323
|
});
|
|
1316
|
-
|
|
1324
|
+
React21.useEffect(() => {
|
|
1317
1325
|
if (!open || !pos.ready || !pos.anchorHidden) return;
|
|
1318
1326
|
const focusInMenu = !!menuRef.current?.contains(document.activeElement);
|
|
1319
1327
|
setOpen(false);
|
|
@@ -1325,7 +1333,7 @@ var Menu = ({ items, trigger, align = "start" }) => {
|
|
|
1325
1333
|
visible: open,
|
|
1326
1334
|
from: pos.placement === "top" ? `translateY(${MENU_GAP}px)` : `translateY(-${MENU_GAP}px)`
|
|
1327
1335
|
});
|
|
1328
|
-
|
|
1336
|
+
React21.useEffect(() => {
|
|
1329
1337
|
if (!open) return;
|
|
1330
1338
|
const handleClick = (e) => {
|
|
1331
1339
|
const target = e.target;
|
|
@@ -1342,7 +1350,7 @@ var Menu = ({ items, trigger, align = "start" }) => {
|
|
|
1342
1350
|
document.removeEventListener("keydown", handleEsc);
|
|
1343
1351
|
};
|
|
1344
1352
|
}, [open]);
|
|
1345
|
-
|
|
1353
|
+
React21.useEffect(() => {
|
|
1346
1354
|
const active = document.activeElement;
|
|
1347
1355
|
if (!open || active && itemRefs.current.includes(active)) return;
|
|
1348
1356
|
const first = items.findIndex((it) => !it.disabled);
|
|
@@ -1391,7 +1399,7 @@ var Menu = ({ items, trigger, align = "start" }) => {
|
|
|
1391
1399
|
break;
|
|
1392
1400
|
}
|
|
1393
1401
|
};
|
|
1394
|
-
const triggerWithProps =
|
|
1402
|
+
const triggerWithProps = React21.cloneElement(
|
|
1395
1403
|
trigger,
|
|
1396
1404
|
{
|
|
1397
1405
|
onClick: () => setOpen((o) => !o),
|
|
@@ -1694,9 +1702,9 @@ var Sidebar = ({
|
|
|
1694
1702
|
const t = useLocaleText();
|
|
1695
1703
|
const toggleLabel = toggleLabelProp ?? t("sidebar.toggle");
|
|
1696
1704
|
const isControlled = collapsedProp !== void 0;
|
|
1697
|
-
const [internalCollapsed, setInternalCollapsed] =
|
|
1705
|
+
const [internalCollapsed, setInternalCollapsed] = React21.useState(defaultCollapsed);
|
|
1698
1706
|
const collapsed = isControlled ? collapsedProp : internalCollapsed;
|
|
1699
|
-
const toggle =
|
|
1707
|
+
const toggle = React21.useCallback(() => {
|
|
1700
1708
|
const next = !collapsed;
|
|
1701
1709
|
if (!isControlled) setInternalCollapsed(next);
|
|
1702
1710
|
onCollapsedChange?.(next);
|
|
@@ -1847,9 +1855,9 @@ var Stepper = ({
|
|
|
1847
1855
|
}) });
|
|
1848
1856
|
};
|
|
1849
1857
|
Stepper.displayName = "Stepper";
|
|
1850
|
-
var TabsContext =
|
|
1858
|
+
var TabsContext = React21.createContext(null);
|
|
1851
1859
|
function useTabsContext() {
|
|
1852
|
-
const ctx =
|
|
1860
|
+
const ctx = React21.useContext(TabsContext);
|
|
1853
1861
|
if (!ctx) {
|
|
1854
1862
|
throw new Error(
|
|
1855
1863
|
'[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>'
|
|
@@ -1868,18 +1876,18 @@ var Tabs = ({
|
|
|
1868
1876
|
...props
|
|
1869
1877
|
}) => {
|
|
1870
1878
|
const isControlled = controlledValue !== void 0;
|
|
1871
|
-
const [internalValue, setInternalValue] =
|
|
1879
|
+
const [internalValue, setInternalValue] = React21.useState(defaultValue);
|
|
1872
1880
|
const value = isControlled ? controlledValue : internalValue;
|
|
1873
|
-
const setValue =
|
|
1881
|
+
const setValue = React21.useCallback(
|
|
1874
1882
|
(v) => {
|
|
1875
1883
|
if (!isControlled) setInternalValue(v);
|
|
1876
1884
|
onValueChange?.(v);
|
|
1877
1885
|
},
|
|
1878
1886
|
[isControlled, onValueChange]
|
|
1879
1887
|
);
|
|
1880
|
-
const orderRef =
|
|
1881
|
-
const [firstTabValue, setFirstTabValue] =
|
|
1882
|
-
const registerTab =
|
|
1888
|
+
const orderRef = React21.useRef([]);
|
|
1889
|
+
const [firstTabValue, setFirstTabValue] = React21.useState();
|
|
1890
|
+
const registerTab = React21.useCallback((v) => {
|
|
1883
1891
|
if (!orderRef.current.includes(v)) {
|
|
1884
1892
|
orderRef.current = [...orderRef.current, v];
|
|
1885
1893
|
setFirstTabValue(orderRef.current[0]);
|
|
@@ -1889,8 +1897,8 @@ var Tabs = ({
|
|
|
1889
1897
|
setFirstTabValue(orderRef.current[0]);
|
|
1890
1898
|
};
|
|
1891
1899
|
}, []);
|
|
1892
|
-
const idPrefix =
|
|
1893
|
-
const ctx =
|
|
1900
|
+
const idPrefix = React21.useId();
|
|
1901
|
+
const ctx = React21.useMemo(
|
|
1894
1902
|
() => ({ value, setValue, variant, size, idPrefix, registerTab, firstTabValue }),
|
|
1895
1903
|
[value, setValue, variant, size, idPrefix, registerTab, firstTabValue]
|
|
1896
1904
|
);
|
|
@@ -1905,9 +1913,9 @@ var Tabs = ({
|
|
|
1905
1913
|
};
|
|
1906
1914
|
var TabList = ({ ariaLabel, className, children, ...props }) => {
|
|
1907
1915
|
const { variant } = useTabsContext();
|
|
1908
|
-
const listRef =
|
|
1909
|
-
const [indicator, setIndicator] =
|
|
1910
|
-
const [hasMounted, setHasMounted] =
|
|
1916
|
+
const listRef = React21.useRef(null);
|
|
1917
|
+
const [indicator, setIndicator] = React21.useState(null);
|
|
1918
|
+
const [hasMounted, setHasMounted] = React21.useState(false);
|
|
1911
1919
|
useSafeLayoutEffect(() => {
|
|
1912
1920
|
const list = listRef.current;
|
|
1913
1921
|
if (!list) return;
|
|
@@ -1972,7 +1980,7 @@ var Tab = ({ value, className, children, onClick, onKeyDown, ...props }) => {
|
|
|
1972
1980
|
const panelId = `${ctx.idPrefix}-panel-${value}`;
|
|
1973
1981
|
const tabId = `${ctx.idPrefix}-tab-${value}`;
|
|
1974
1982
|
const { registerTab } = ctx;
|
|
1975
|
-
|
|
1983
|
+
React21.useEffect(() => registerTab(value), [registerTab, value]);
|
|
1976
1984
|
const handleClick = (e) => {
|
|
1977
1985
|
ctx.setValue(value);
|
|
1978
1986
|
onClick?.(e);
|
|
@@ -2059,15 +2067,15 @@ var Popover = ({
|
|
|
2059
2067
|
className
|
|
2060
2068
|
}) => {
|
|
2061
2069
|
const isControlled = openProp !== void 0;
|
|
2062
|
-
const [internalOpen, setInternalOpen] =
|
|
2070
|
+
const [internalOpen, setInternalOpen] = React21.useState(defaultOpen);
|
|
2063
2071
|
const open = isControlled ? openProp : internalOpen;
|
|
2064
|
-
const [shouldRender, setShouldRender] =
|
|
2072
|
+
const [shouldRender, setShouldRender] = React21.useState(open ?? false);
|
|
2065
2073
|
if (open && !shouldRender) setShouldRender(true);
|
|
2066
|
-
const wrapperRef =
|
|
2067
|
-
const positionRef =
|
|
2068
|
-
const popoverRef =
|
|
2069
|
-
const popoverId =
|
|
2070
|
-
const setOpen =
|
|
2074
|
+
const wrapperRef = React21.useRef(null);
|
|
2075
|
+
const positionRef = React21.useRef(null);
|
|
2076
|
+
const popoverRef = React21.useRef(null);
|
|
2077
|
+
const popoverId = React21.useId();
|
|
2078
|
+
const setOpen = React21.useCallback(
|
|
2071
2079
|
(next) => {
|
|
2072
2080
|
if (!isControlled) setInternalOpen(next);
|
|
2073
2081
|
onOpenChange?.(next);
|
|
@@ -2099,8 +2107,8 @@ var Popover = ({
|
|
|
2099
2107
|
from: fromTransform,
|
|
2100
2108
|
onExitComplete: () => setShouldRender(false)
|
|
2101
2109
|
});
|
|
2102
|
-
useFocusTrap(popoverRef, open);
|
|
2103
|
-
|
|
2110
|
+
useFocusTrap(popoverRef, open && pos.ready);
|
|
2111
|
+
React21.useEffect(() => {
|
|
2104
2112
|
if (!open) return;
|
|
2105
2113
|
const handleClick = (e) => {
|
|
2106
2114
|
const target = e.target;
|
|
@@ -2114,7 +2122,7 @@ var Popover = ({
|
|
|
2114
2122
|
useOverlayEscape(open, () => {
|
|
2115
2123
|
setOpen(false);
|
|
2116
2124
|
});
|
|
2117
|
-
const triggerWithProps =
|
|
2125
|
+
const triggerWithProps = React21.cloneElement(
|
|
2118
2126
|
trigger,
|
|
2119
2127
|
{
|
|
2120
2128
|
onClick: (e) => {
|
|
@@ -2173,30 +2181,30 @@ var Tooltip = ({
|
|
|
2173
2181
|
disabled = false,
|
|
2174
2182
|
children
|
|
2175
2183
|
}) => {
|
|
2176
|
-
const [open, setOpen] =
|
|
2177
|
-
const [shouldRender, setShouldRender] =
|
|
2184
|
+
const [open, setOpen] = React21.useState(false);
|
|
2185
|
+
const [shouldRender, setShouldRender] = React21.useState(false);
|
|
2178
2186
|
if (open && !shouldRender) setShouldRender(true);
|
|
2179
|
-
const timerRef =
|
|
2180
|
-
const tooltipId =
|
|
2181
|
-
const wrapperRef =
|
|
2182
|
-
const positionRef =
|
|
2187
|
+
const timerRef = React21.useRef(null);
|
|
2188
|
+
const tooltipId = React21.useId();
|
|
2189
|
+
const wrapperRef = React21.useRef(null);
|
|
2190
|
+
const positionRef = React21.useRef(null);
|
|
2183
2191
|
const HIDE_DELAY = 120;
|
|
2184
|
-
const show =
|
|
2192
|
+
const show = React21.useCallback(() => {
|
|
2185
2193
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
2186
2194
|
timerRef.current = setTimeout(() => setOpen(true), delay);
|
|
2187
2195
|
}, [delay]);
|
|
2188
|
-
const hideNow =
|
|
2196
|
+
const hideNow = React21.useCallback(() => {
|
|
2189
2197
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
2190
2198
|
setOpen(false);
|
|
2191
2199
|
}, []);
|
|
2192
|
-
const hide =
|
|
2200
|
+
const hide = React21.useCallback(() => {
|
|
2193
2201
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
2194
2202
|
timerRef.current = setTimeout(() => setOpen(false), HIDE_DELAY);
|
|
2195
2203
|
}, []);
|
|
2196
|
-
const cancelHide =
|
|
2204
|
+
const cancelHide = React21.useCallback(() => {
|
|
2197
2205
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
2198
2206
|
}, []);
|
|
2199
|
-
|
|
2207
|
+
React21.useEffect(() => {
|
|
2200
2208
|
return () => {
|
|
2201
2209
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
2202
2210
|
};
|
|
@@ -2210,7 +2218,7 @@ var Tooltip = ({
|
|
|
2210
2218
|
gap: TOOLTIP_GAP,
|
|
2211
2219
|
padding: 8
|
|
2212
2220
|
});
|
|
2213
|
-
|
|
2221
|
+
React21.useEffect(() => {
|
|
2214
2222
|
if (open && pos.ready && pos.anchorHidden) hideNow();
|
|
2215
2223
|
}, [open, pos.ready, pos.anchorHidden, hideNow]);
|
|
2216
2224
|
const fromTransform = (() => {
|
|
@@ -2232,7 +2240,7 @@ var Tooltip = ({
|
|
|
2232
2240
|
});
|
|
2233
2241
|
const child = children;
|
|
2234
2242
|
const childProps = child.props;
|
|
2235
|
-
const trigger =
|
|
2243
|
+
const trigger = React21.cloneElement(child, {
|
|
2236
2244
|
onMouseEnter: (e) => {
|
|
2237
2245
|
childProps.onMouseEnter?.(e);
|
|
2238
2246
|
show();
|
|
@@ -3456,7 +3464,7 @@ var Pagination = ({
|
|
|
3456
3464
|
const emit = onPageChange ?? onChange;
|
|
3457
3465
|
const prevDisabled = page <= 1;
|
|
3458
3466
|
const nextDisabled = page >= totalPages;
|
|
3459
|
-
const items =
|
|
3467
|
+
const items = React21.useMemo(() => getPaginationItems(page, totalPages), [page, totalPages]);
|
|
3460
3468
|
return /* @__PURE__ */ jsxs("nav", { className: "pagination", "aria-label": navLabel, children: [
|
|
3461
3469
|
/* @__PURE__ */ jsx(
|
|
3462
3470
|
"button",
|
|
@@ -3536,12 +3544,12 @@ var Checkbox = ({
|
|
|
3536
3544
|
ref,
|
|
3537
3545
|
...props
|
|
3538
3546
|
}) => {
|
|
3539
|
-
const inputRef =
|
|
3540
|
-
|
|
3547
|
+
const inputRef = React21.useRef(null);
|
|
3548
|
+
React21.useImperativeHandle(
|
|
3541
3549
|
ref,
|
|
3542
3550
|
() => inputRef.current
|
|
3543
3551
|
);
|
|
3544
|
-
|
|
3552
|
+
React21.useEffect(() => {
|
|
3545
3553
|
if (!inputRef.current) return;
|
|
3546
3554
|
inputRef.current.indeterminate = Boolean(indeterminate);
|
|
3547
3555
|
}, [indeterminate]);
|
|
@@ -3615,7 +3623,7 @@ var Table = ({
|
|
|
3615
3623
|
stickyHeader && "table_sticky_header",
|
|
3616
3624
|
className
|
|
3617
3625
|
);
|
|
3618
|
-
const wrapperRef =
|
|
3626
|
+
const wrapperRef = React21.useRef(null);
|
|
3619
3627
|
useSafeLayoutEffect(() => {
|
|
3620
3628
|
const el = wrapperRef.current;
|
|
3621
3629
|
if (!el) return;
|
|
@@ -3643,7 +3651,7 @@ var Table = ({
|
|
|
3643
3651
|
};
|
|
3644
3652
|
}, []);
|
|
3645
3653
|
const isRowClickable = Boolean(onRowClick);
|
|
3646
|
-
|
|
3654
|
+
React21.useEffect(() => {
|
|
3647
3655
|
if (!isRowClickable) return;
|
|
3648
3656
|
const handleKeyDown2 = (e) => {
|
|
3649
3657
|
if (e.key !== "ArrowDown" || e.defaultPrevented) return;
|
|
@@ -3688,8 +3696,8 @@ var Table = ({
|
|
|
3688
3696
|
const isEmpty = !isLoading && data.length === 0;
|
|
3689
3697
|
const getRowKey = (item, index) => rowKey?.(item) ?? String(index);
|
|
3690
3698
|
const allRowKeys = selectable ? data.map((item, index) => getRowKey(item, index)) : [];
|
|
3691
|
-
const rowClickHintId =
|
|
3692
|
-
const selectedSet =
|
|
3699
|
+
const rowClickHintId = React21.useId();
|
|
3700
|
+
const selectedSet = React21.useMemo(() => new Set(selectedKeys ?? []), [selectedKeys]);
|
|
3693
3701
|
const selectedCount = allRowKeys.filter((key) => selectedSet.has(key)).length;
|
|
3694
3702
|
const isAllSelected = allRowKeys.length > 0 && selectedCount === allRowKeys.length;
|
|
3695
3703
|
const isSomeSelected = selectedCount > 0 && !isAllSelected;
|
|
@@ -4174,8 +4182,8 @@ var MediaCard = ({
|
|
|
4174
4182
|
);
|
|
4175
4183
|
};
|
|
4176
4184
|
var Prose = ({ size = "md", className, children, ref, ...props }) => {
|
|
4177
|
-
const rootRef =
|
|
4178
|
-
|
|
4185
|
+
const rootRef = React21.useRef(null);
|
|
4186
|
+
React21.useImperativeHandle(ref, () => rootRef.current, []);
|
|
4179
4187
|
useSafeLayoutEffect(() => {
|
|
4180
4188
|
const root = rootRef.current;
|
|
4181
4189
|
if (!root) return;
|
|
@@ -4285,10 +4293,10 @@ var AlertModal = ({
|
|
|
4285
4293
|
const confirmText = confirmTextProp ?? t("alert.confirm");
|
|
4286
4294
|
const cancelText = cancelTextProp ?? t("alert.cancel");
|
|
4287
4295
|
const dismiss = onCancel ?? onClose;
|
|
4288
|
-
const panelRef =
|
|
4289
|
-
const pressedOverlayRef =
|
|
4290
|
-
const titleId =
|
|
4291
|
-
const messageId =
|
|
4296
|
+
const panelRef = React21.useRef(null);
|
|
4297
|
+
const pressedOverlayRef = React21.useRef(false);
|
|
4298
|
+
const titleId = React21.useId();
|
|
4299
|
+
const messageId = React21.useId();
|
|
4292
4300
|
const [shouldRender, setShouldRender] = useState(isOpen);
|
|
4293
4301
|
useFocusTrap(panelRef, isOpen);
|
|
4294
4302
|
useOverlayEscape(isOpen, () => dismiss());
|
|
@@ -4314,7 +4322,7 @@ var AlertModal = ({
|
|
|
4314
4322
|
immediate: reduced,
|
|
4315
4323
|
config: OVERLAY_SPRING_CONFIG
|
|
4316
4324
|
});
|
|
4317
|
-
|
|
4325
|
+
React21.useEffect(() => {
|
|
4318
4326
|
if (!shouldRender) return;
|
|
4319
4327
|
lockBodyScroll();
|
|
4320
4328
|
return () => {
|
|
@@ -4433,7 +4441,7 @@ var Spinner = ({ size = 24, ariaLabel: ariaLabelProp }) => {
|
|
|
4433
4441
|
}
|
|
4434
4442
|
);
|
|
4435
4443
|
};
|
|
4436
|
-
var ToastContext =
|
|
4444
|
+
var ToastContext = React21.createContext(null);
|
|
4437
4445
|
var VARIANT_ICONS = {
|
|
4438
4446
|
success: /* @__PURE__ */ jsx(CheckCircle2, { size: iconSize.md }),
|
|
4439
4447
|
error: /* @__PURE__ */ jsx(XCircle, { size: iconSize.md }),
|
|
@@ -4442,9 +4450,9 @@ var VARIANT_ICONS = {
|
|
|
4442
4450
|
default: /* @__PURE__ */ jsx(Bell, { size: iconSize.md })
|
|
4443
4451
|
};
|
|
4444
4452
|
var ToastItemComponent = ({ item, onRemove, closeAriaLabel }) => {
|
|
4445
|
-
const [visible, setVisible] =
|
|
4446
|
-
const closingRef =
|
|
4447
|
-
const rootRef =
|
|
4453
|
+
const [visible, setVisible] = React21.useState(true);
|
|
4454
|
+
const closingRef = React21.useRef(false);
|
|
4455
|
+
const rootRef = React21.useRef(null);
|
|
4448
4456
|
const style = useSpringPresence({
|
|
4449
4457
|
visible,
|
|
4450
4458
|
from: "translateX(20px)",
|
|
@@ -4464,12 +4472,12 @@ var ToastItemComponent = ({ item, onRemove, closeAriaLabel }) => {
|
|
|
4464
4472
|
onRemove(item.id);
|
|
4465
4473
|
}
|
|
4466
4474
|
});
|
|
4467
|
-
const close =
|
|
4475
|
+
const close = React21.useCallback(() => {
|
|
4468
4476
|
if (closingRef.current) return;
|
|
4469
4477
|
closingRef.current = true;
|
|
4470
4478
|
setVisible(false);
|
|
4471
4479
|
}, []);
|
|
4472
|
-
|
|
4480
|
+
React21.useEffect(() => {
|
|
4473
4481
|
if (item.dismissing) close();
|
|
4474
4482
|
}, [item.dismissing, close]);
|
|
4475
4483
|
const autoDismisses = Number.isFinite(item.duration);
|
|
@@ -4515,9 +4523,9 @@ var ToastProvider = ({
|
|
|
4515
4523
|
const t = useLocaleText();
|
|
4516
4524
|
const closeAriaLabel = closeAriaLabelProp ?? t("toast.close");
|
|
4517
4525
|
const regionLabel = regionLabelProp ?? t("toast.region");
|
|
4518
|
-
const [toasts, setToasts] =
|
|
4526
|
+
const [toasts, setToasts] = React21.useState([]);
|
|
4519
4527
|
const isMounted = useIsMounted();
|
|
4520
|
-
const addToast =
|
|
4528
|
+
const addToast = React21.useCallback(
|
|
4521
4529
|
(message, variant, options = {}) => {
|
|
4522
4530
|
const { duration = 3e3, action } = options;
|
|
4523
4531
|
const id = `toast_${++toastSeq}`;
|
|
@@ -4532,14 +4540,14 @@ var ToastProvider = ({
|
|
|
4532
4540
|
},
|
|
4533
4541
|
[maxCount]
|
|
4534
4542
|
);
|
|
4535
|
-
const dismissToast =
|
|
4543
|
+
const dismissToast = React21.useCallback((id) => {
|
|
4536
4544
|
setToasts(
|
|
4537
4545
|
(prev) => prev.map(
|
|
4538
4546
|
(toast) => toast.id === id && !toast.dismissing ? { ...toast, dismissing: true } : toast
|
|
4539
4547
|
)
|
|
4540
4548
|
);
|
|
4541
4549
|
}, []);
|
|
4542
|
-
const updateToast =
|
|
4550
|
+
const updateToast = React21.useCallback((id, patch) => {
|
|
4543
4551
|
setToasts(
|
|
4544
4552
|
(prev) => prev.map((toast) => {
|
|
4545
4553
|
if (toast.id !== id || toast.dismissing) return toast;
|
|
@@ -4552,10 +4560,10 @@ var ToastProvider = ({
|
|
|
4552
4560
|
})
|
|
4553
4561
|
);
|
|
4554
4562
|
}, []);
|
|
4555
|
-
const removeToast =
|
|
4563
|
+
const removeToast = React21.useCallback((id) => {
|
|
4556
4564
|
setToasts((prev) => prev.filter((t2) => t2.id !== id));
|
|
4557
4565
|
}, []);
|
|
4558
|
-
const contextValue =
|
|
4566
|
+
const contextValue = React21.useMemo(
|
|
4559
4567
|
() => ({ addToast, dismissToast, updateToast }),
|
|
4560
4568
|
[addToast, dismissToast, updateToast]
|
|
4561
4569
|
);
|
|
@@ -5143,6 +5151,179 @@ var Dropdown = (props) => {
|
|
|
5143
5151
|
)
|
|
5144
5152
|
] });
|
|
5145
5153
|
};
|
|
5154
|
+
var WEEK = [0, 1, 2, 3, 4, 5, 6];
|
|
5155
|
+
var ROWS = 6;
|
|
5156
|
+
var toDate = ({ year, month, day }) => new Date(year, month - 1, day);
|
|
5157
|
+
var fromDate = (d) => ({
|
|
5158
|
+
year: d.getFullYear(),
|
|
5159
|
+
month: d.getMonth() + 1,
|
|
5160
|
+
day: d.getDate()
|
|
5161
|
+
});
|
|
5162
|
+
var sameDay = (a, b) => !!a && !!b && a.year === b.year && a.month === b.month && a.day === b.day;
|
|
5163
|
+
var monthIndex = (y, m) => y * 12 + (m - 1);
|
|
5164
|
+
var daysIn = (y, m) => new Date(y, m, 0).getDate();
|
|
5165
|
+
var addDays = (date, n) => {
|
|
5166
|
+
const d = toDate(date);
|
|
5167
|
+
d.setDate(d.getDate() + n);
|
|
5168
|
+
return fromDate(d);
|
|
5169
|
+
};
|
|
5170
|
+
var addMonths = (date, n) => {
|
|
5171
|
+
const idx = monthIndex(date.year, date.month) + n;
|
|
5172
|
+
const year = Math.floor(idx / 12);
|
|
5173
|
+
const month = idx % 12 + 1;
|
|
5174
|
+
return { year, month, day: Math.min(date.day, daysIn(year, month)) };
|
|
5175
|
+
};
|
|
5176
|
+
var DateCalendar = ({
|
|
5177
|
+
selected,
|
|
5178
|
+
today,
|
|
5179
|
+
isSelectable,
|
|
5180
|
+
minMonth,
|
|
5181
|
+
maxMonth,
|
|
5182
|
+
intlLocale,
|
|
5183
|
+
prevLabel,
|
|
5184
|
+
nextLabel,
|
|
5185
|
+
onSelect
|
|
5186
|
+
}) => {
|
|
5187
|
+
const minIdx = monthIndex(minMonth.year, minMonth.month);
|
|
5188
|
+
const maxIdx = monthIndex(maxMonth.year, maxMonth.month);
|
|
5189
|
+
const clampToRange = React21.useCallback(
|
|
5190
|
+
(date) => {
|
|
5191
|
+
const idx = monthIndex(date.year, date.month);
|
|
5192
|
+
if (idx < minIdx) return { ...minMonth, day: 1 };
|
|
5193
|
+
if (idx > maxIdx) return { ...maxMonth, day: daysIn(maxMonth.year, maxMonth.month) };
|
|
5194
|
+
return date;
|
|
5195
|
+
},
|
|
5196
|
+
[minIdx, maxIdx, minMonth, maxMonth]
|
|
5197
|
+
);
|
|
5198
|
+
const [focused, setFocused] = React21.useState(() => clampToRange(selected ?? today));
|
|
5199
|
+
const view = { year: focused.year, month: focused.month };
|
|
5200
|
+
const viewIdx = monthIndex(view.year, view.month);
|
|
5201
|
+
const gridRef = React21.useRef(null);
|
|
5202
|
+
const moveFocusRef = React21.useRef(false);
|
|
5203
|
+
React21.useEffect(() => {
|
|
5204
|
+
if (!moveFocusRef.current) return;
|
|
5205
|
+
moveFocusRef.current = false;
|
|
5206
|
+
gridRef.current?.querySelector('button[tabindex="0"]')?.focus();
|
|
5207
|
+
});
|
|
5208
|
+
const titleId = React21.useId();
|
|
5209
|
+
const fmt = React21.useMemo(
|
|
5210
|
+
() => ({
|
|
5211
|
+
title: new Intl.DateTimeFormat(intlLocale, { year: "numeric", month: "long" }),
|
|
5212
|
+
weekdayShort: new Intl.DateTimeFormat(intlLocale, { weekday: "narrow" }),
|
|
5213
|
+
weekdayLong: new Intl.DateTimeFormat(intlLocale, { weekday: "long" }),
|
|
5214
|
+
full: new Intl.DateTimeFormat(intlLocale, { dateStyle: "full" })
|
|
5215
|
+
}),
|
|
5216
|
+
[intlLocale]
|
|
5217
|
+
);
|
|
5218
|
+
const weekdays = WEEK.map((i) => {
|
|
5219
|
+
const d = new Date(2026, 9, 4 + i);
|
|
5220
|
+
return { short: fmt.weekdayShort.format(d), long: fmt.weekdayLong.format(d) };
|
|
5221
|
+
});
|
|
5222
|
+
const firstWeekday = new Date(view.year, view.month - 1, 1).getDay();
|
|
5223
|
+
const total = daysIn(view.year, view.month);
|
|
5224
|
+
const cells = Array.from({ length: ROWS * 7 }, (_, i) => {
|
|
5225
|
+
const day = i - firstWeekday + 1;
|
|
5226
|
+
return day >= 1 && day <= total ? { ...view, day } : null;
|
|
5227
|
+
});
|
|
5228
|
+
const moveTo = (next) => {
|
|
5229
|
+
moveFocusRef.current = true;
|
|
5230
|
+
setFocused(clampToRange(next));
|
|
5231
|
+
};
|
|
5232
|
+
const goMonth = (n) => setFocused((f) => clampToRange(addMonths(f, n)));
|
|
5233
|
+
const handleKeyDown2 = (e) => {
|
|
5234
|
+
if (e.altKey || e.ctrlKey || e.metaKey) return;
|
|
5235
|
+
const weekday = toDate(focused).getDay();
|
|
5236
|
+
const moves = {
|
|
5237
|
+
ArrowLeft: () => addDays(focused, -1),
|
|
5238
|
+
ArrowRight: () => addDays(focused, 1),
|
|
5239
|
+
ArrowUp: () => addDays(focused, -7),
|
|
5240
|
+
ArrowDown: () => addDays(focused, 7),
|
|
5241
|
+
Home: () => addDays(focused, -weekday),
|
|
5242
|
+
End: () => addDays(focused, 6 - weekday),
|
|
5243
|
+
PageUp: () => addMonths(focused, e.shiftKey ? -12 : -1),
|
|
5244
|
+
PageDown: () => addMonths(focused, e.shiftKey ? 12 : 1)
|
|
5245
|
+
};
|
|
5246
|
+
const move = moves[e.key];
|
|
5247
|
+
if (!move) return;
|
|
5248
|
+
e.preventDefault();
|
|
5249
|
+
moveTo(move());
|
|
5250
|
+
};
|
|
5251
|
+
return /* @__PURE__ */ jsxs("div", { className: "date_calendar", children: [
|
|
5252
|
+
/* @__PURE__ */ jsxs("div", { className: "date_calendar_header", children: [
|
|
5253
|
+
/* @__PURE__ */ jsx(
|
|
5254
|
+
"button",
|
|
5255
|
+
{
|
|
5256
|
+
type: "button",
|
|
5257
|
+
className: "date_calendar_nav",
|
|
5258
|
+
"aria-label": prevLabel,
|
|
5259
|
+
onClick: () => goMonth(-1),
|
|
5260
|
+
disabled: viewIdx <= minIdx,
|
|
5261
|
+
"data-focus-trap-skip-autofocus": "",
|
|
5262
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { size: iconSize.md, "aria-hidden": "true" })
|
|
5263
|
+
}
|
|
5264
|
+
),
|
|
5265
|
+
/* @__PURE__ */ jsx("span", { className: "date_calendar_title", id: titleId, "aria-live": "polite", children: fmt.title.format(new Date(view.year, view.month - 1, 1)) }),
|
|
5266
|
+
/* @__PURE__ */ jsx(
|
|
5267
|
+
"button",
|
|
5268
|
+
{
|
|
5269
|
+
type: "button",
|
|
5270
|
+
className: "date_calendar_nav",
|
|
5271
|
+
"aria-label": nextLabel,
|
|
5272
|
+
onClick: () => goMonth(1),
|
|
5273
|
+
disabled: viewIdx >= maxIdx,
|
|
5274
|
+
"data-focus-trap-skip-autofocus": "",
|
|
5275
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { size: iconSize.md, "aria-hidden": "true" })
|
|
5276
|
+
}
|
|
5277
|
+
)
|
|
5278
|
+
] }),
|
|
5279
|
+
/* @__PURE__ */ jsxs("table", { ref: gridRef, className: "date_calendar_grid", role: "grid", "aria-labelledby": titleId, children: [
|
|
5280
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: weekdays.map((w) => /* @__PURE__ */ jsx("th", { scope: "col", abbr: w.long, className: "date_calendar_weekday", children: w.short }, w.long)) }) }),
|
|
5281
|
+
/* @__PURE__ */ jsx("tbody", { children: Array.from({ length: ROWS }, (_, row) => (
|
|
5282
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: 줄은 위치 자체가 정체성이다(달이 바뀌어도 6줄)
|
|
5283
|
+
/* @__PURE__ */ jsx("tr", { children: cells.slice(row * 7, row * 7 + 7).map((cell, col) => {
|
|
5284
|
+
if (!cell) {
|
|
5285
|
+
return /* @__PURE__ */ jsx("td", { className: "date_calendar_cell" }, `empty-${col}`);
|
|
5286
|
+
}
|
|
5287
|
+
const selectable = isSelectable(cell);
|
|
5288
|
+
const isSelected = sameDay(cell, selected);
|
|
5289
|
+
return (
|
|
5290
|
+
// biome-ignore lint/a11y/useFocusableInteractive: 포커스는 칸 안 button 이 받는다 - 칸과 버튼이 둘 다 받으면 Tab 이 달력 안에서 두 번 멈춘다
|
|
5291
|
+
/* @__PURE__ */ jsx(
|
|
5292
|
+
"td",
|
|
5293
|
+
{
|
|
5294
|
+
role: "gridcell",
|
|
5295
|
+
"aria-selected": isSelected,
|
|
5296
|
+
className: "date_calendar_cell",
|
|
5297
|
+
children: /* @__PURE__ */ jsx(
|
|
5298
|
+
"button",
|
|
5299
|
+
{
|
|
5300
|
+
type: "button",
|
|
5301
|
+
className: cn("date_calendar_day", {
|
|
5302
|
+
date_calendar_day_selected: isSelected,
|
|
5303
|
+
date_calendar_day_today: sameDay(cell, today)
|
|
5304
|
+
}),
|
|
5305
|
+
tabIndex: sameDay(cell, focused) ? 0 : -1,
|
|
5306
|
+
"data-focus-trap-skip-autofocus": sameDay(cell, focused) ? void 0 : "",
|
|
5307
|
+
"aria-label": fmt.full.format(toDate(cell)),
|
|
5308
|
+
"aria-current": sameDay(cell, today) ? "date" : void 0,
|
|
5309
|
+
"aria-disabled": selectable ? void 0 : true,
|
|
5310
|
+
onClick: () => {
|
|
5311
|
+
setFocused(cell);
|
|
5312
|
+
if (selectable) onSelect(cell);
|
|
5313
|
+
},
|
|
5314
|
+
onKeyDown: handleKeyDown2,
|
|
5315
|
+
children: cell.day
|
|
5316
|
+
}
|
|
5317
|
+
)
|
|
5318
|
+
},
|
|
5319
|
+
cell.day
|
|
5320
|
+
)
|
|
5321
|
+
);
|
|
5322
|
+
}) }, row)
|
|
5323
|
+
)) })
|
|
5324
|
+
] })
|
|
5325
|
+
] });
|
|
5326
|
+
};
|
|
5146
5327
|
var pad = (n) => String(n).padStart(2, "0");
|
|
5147
5328
|
var getDaysInMonth = (year, month) => new Date(year, month, 0).getDate();
|
|
5148
5329
|
var normalizeWidth = (v) => typeof v === "number" ? `${v}px` : v;
|
|
@@ -5153,6 +5334,8 @@ var DatePicker = ({
|
|
|
5153
5334
|
onValueChange,
|
|
5154
5335
|
onChange,
|
|
5155
5336
|
mode = "year-month-day",
|
|
5337
|
+
variant = "dropdown",
|
|
5338
|
+
placeholder: placeholderProp,
|
|
5156
5339
|
startYear = 1950,
|
|
5157
5340
|
endYear: endYearProp,
|
|
5158
5341
|
minDate,
|
|
@@ -5168,6 +5351,7 @@ var DatePicker = ({
|
|
|
5168
5351
|
selectableRangeUntilTodaySrText: selectableRangeUntilTodaySrTextProp
|
|
5169
5352
|
}) => {
|
|
5170
5353
|
const t = useLocaleText();
|
|
5354
|
+
const localeName = useLocaleName();
|
|
5171
5355
|
const yearLabel = yearLabelProp ?? t("datePicker.year");
|
|
5172
5356
|
const monthLabel = monthLabelProp ?? t("datePicker.month");
|
|
5173
5357
|
const dayLabel = dayLabelProp ?? t("datePicker.day");
|
|
@@ -5175,9 +5359,9 @@ var DatePicker = ({
|
|
|
5175
5359
|
const selectableRangeUntilTodaySrText = selectableRangeUntilTodaySrTextProp ?? t("datePicker.rangeUntilTodaySr");
|
|
5176
5360
|
const field = useFieldControl();
|
|
5177
5361
|
const isRequired = field ? field.required || void 0 : required || void 0;
|
|
5178
|
-
const groupId =
|
|
5179
|
-
const constraintId =
|
|
5180
|
-
const { todayYear, todayMonth, todayDay } =
|
|
5362
|
+
const groupId = React21.useId();
|
|
5363
|
+
const constraintId = React21.useId();
|
|
5364
|
+
const { todayYear, todayMonth, todayDay } = React21.useMemo(() => {
|
|
5181
5365
|
const now = /* @__PURE__ */ new Date();
|
|
5182
5366
|
return {
|
|
5183
5367
|
todayYear: now.getFullYear(),
|
|
@@ -5186,7 +5370,7 @@ var DatePicker = ({
|
|
|
5186
5370
|
};
|
|
5187
5371
|
}, []);
|
|
5188
5372
|
const endYear = endYearProp ?? todayYear + 10;
|
|
5189
|
-
const parsed =
|
|
5373
|
+
const parsed = React21.useMemo(() => {
|
|
5190
5374
|
if (!value) return { year: 0, month: 0, day: 0 };
|
|
5191
5375
|
const [y, m, d] = value.split("-").map(Number);
|
|
5192
5376
|
return {
|
|
@@ -5195,7 +5379,7 @@ var DatePicker = ({
|
|
|
5195
5379
|
day: d || 0
|
|
5196
5380
|
};
|
|
5197
5381
|
}, [value]);
|
|
5198
|
-
const min =
|
|
5382
|
+
const min = React21.useMemo(() => {
|
|
5199
5383
|
if (!minDate) return { year: 0, month: 0, day: 0 };
|
|
5200
5384
|
const [y, m, d] = minDate.split("-").map(Number);
|
|
5201
5385
|
return {
|
|
@@ -5208,7 +5392,7 @@ var DatePicker = ({
|
|
|
5208
5392
|
const maxYear = selectableRange === "until-today" ? todayYear : endYear;
|
|
5209
5393
|
const minMonth = min.year > 0 && year === min.year ? Math.min(12, Math.max(1, min.month)) : 1;
|
|
5210
5394
|
const maxMonth = selectableRange === "until-today" && year === todayYear ? todayMonth : 12;
|
|
5211
|
-
const dayBoundsFor =
|
|
5395
|
+
const dayBoundsFor = React21.useCallback(
|
|
5212
5396
|
(yy, mm) => {
|
|
5213
5397
|
if (!yy || !mm) return { min: 1, max: 31 };
|
|
5214
5398
|
const daysInMonth = getDaysInMonth(yy, mm);
|
|
@@ -5218,20 +5402,20 @@ var DatePicker = ({
|
|
|
5218
5402
|
},
|
|
5219
5403
|
[min.year, min.month, min.day, selectableRange, todayYear, todayMonth, todayDay]
|
|
5220
5404
|
);
|
|
5221
|
-
const { min: minDay, max: maxDay } =
|
|
5405
|
+
const { min: minDay, max: maxDay } = React21.useMemo(
|
|
5222
5406
|
() => dayBoundsFor(year, month),
|
|
5223
5407
|
[dayBoundsFor, year, month]
|
|
5224
5408
|
);
|
|
5225
5409
|
const hasSelectableDay = maxDay >= minDay;
|
|
5226
5410
|
const minYear = min.year > 0 ? Math.max(startYear, min.year) : startYear;
|
|
5227
|
-
const yearOptions =
|
|
5411
|
+
const yearOptions = React21.useMemo(
|
|
5228
5412
|
() => range2(minYear, maxYear).map((y) => ({
|
|
5229
5413
|
value: String(y),
|
|
5230
5414
|
label: String(y)
|
|
5231
5415
|
})),
|
|
5232
5416
|
[minYear, maxYear]
|
|
5233
5417
|
);
|
|
5234
|
-
const monthOptions =
|
|
5418
|
+
const monthOptions = React21.useMemo(
|
|
5235
5419
|
() => range2(minMonth, maxMonth).filter((m) => {
|
|
5236
5420
|
const bounds = dayBoundsFor(year, m);
|
|
5237
5421
|
return bounds.max >= bounds.min;
|
|
@@ -5241,14 +5425,14 @@ var DatePicker = ({
|
|
|
5241
5425
|
})),
|
|
5242
5426
|
[minMonth, maxMonth, dayBoundsFor, year]
|
|
5243
5427
|
);
|
|
5244
|
-
const dayOptions =
|
|
5428
|
+
const dayOptions = React21.useMemo(
|
|
5245
5429
|
() => hasSelectableDay ? range2(minDay, maxDay).map((d) => ({
|
|
5246
5430
|
value: String(d),
|
|
5247
5431
|
label: pad(d)
|
|
5248
5432
|
})) : [],
|
|
5249
5433
|
[minDay, maxDay, hasSelectableDay]
|
|
5250
5434
|
);
|
|
5251
|
-
const withinRange =
|
|
5435
|
+
const withinRange = React21.useCallback(
|
|
5252
5436
|
(yy, mm, dd) => {
|
|
5253
5437
|
const point = yy * 1e4 + mm * 100 + dd;
|
|
5254
5438
|
if (min.year > 0) {
|
|
@@ -5263,7 +5447,7 @@ var DatePicker = ({
|
|
|
5263
5447
|
},
|
|
5264
5448
|
[min.year, min.month, min.day, selectableRange, todayYear, todayMonth, todayDay]
|
|
5265
5449
|
);
|
|
5266
|
-
const emit =
|
|
5450
|
+
const emit = React21.useCallback(
|
|
5267
5451
|
(yy, mm, dd) => {
|
|
5268
5452
|
const cb = onValueChange ?? onChange;
|
|
5269
5453
|
if (mode === "year-month") {
|
|
@@ -5280,7 +5464,7 @@ var DatePicker = ({
|
|
|
5280
5464
|
},
|
|
5281
5465
|
[mode, onValueChange, onChange, dayBoundsFor, withinRange]
|
|
5282
5466
|
);
|
|
5283
|
-
const handleYearChange =
|
|
5467
|
+
const handleYearChange = React21.useCallback(
|
|
5284
5468
|
(raw) => {
|
|
5285
5469
|
if (!raw) return;
|
|
5286
5470
|
const newYear = Number(raw);
|
|
@@ -5297,14 +5481,14 @@ var DatePicker = ({
|
|
|
5297
5481
|
},
|
|
5298
5482
|
[month, day, min.year, min.month, selectableRange, todayYear, todayMonth, emit]
|
|
5299
5483
|
);
|
|
5300
|
-
const handleMonthChange =
|
|
5484
|
+
const handleMonthChange = React21.useCallback(
|
|
5301
5485
|
(raw) => {
|
|
5302
5486
|
if (!raw || !year) return;
|
|
5303
5487
|
emit(year, Number(raw), day || void 0);
|
|
5304
5488
|
},
|
|
5305
5489
|
[year, day, emit]
|
|
5306
5490
|
);
|
|
5307
|
-
const handleDayChange =
|
|
5491
|
+
const handleDayChange = React21.useCallback(
|
|
5308
5492
|
(raw) => {
|
|
5309
5493
|
if (!raw || !year || !month) return;
|
|
5310
5494
|
emit(year, month, Number(raw));
|
|
@@ -5320,6 +5504,41 @@ var DatePicker = ({
|
|
|
5320
5504
|
if (minDate) constraintParts.push(minDateSrFormat.replace("{date}", minDate));
|
|
5321
5505
|
if (selectableRange === "until-today") constraintParts.push(selectableRangeUntilTodaySrText);
|
|
5322
5506
|
const constraintDesc = constraintParts.join(". ");
|
|
5507
|
+
if (variant === "calendar" && mode === "year-month-day") {
|
|
5508
|
+
return /* @__PURE__ */ jsx(
|
|
5509
|
+
CalendarField,
|
|
5510
|
+
{
|
|
5511
|
+
rootClassName,
|
|
5512
|
+
containerStyle,
|
|
5513
|
+
label,
|
|
5514
|
+
labelId: field?.labelId ?? (label ? groupId : void 0),
|
|
5515
|
+
describedBy: [field?.describedBy, constraintDesc ? constraintId : void 0].filter(Boolean).join(" ") || void 0,
|
|
5516
|
+
invalid: field?.invalid,
|
|
5517
|
+
inputId: field?.inputId,
|
|
5518
|
+
groupId,
|
|
5519
|
+
constraintId,
|
|
5520
|
+
constraintDesc,
|
|
5521
|
+
disabled,
|
|
5522
|
+
selected: year && month && day ? { year, month, day } : null,
|
|
5523
|
+
today: { year: todayYear, month: todayMonth, day: todayDay },
|
|
5524
|
+
isSelectable: ({ year: yy, month: mm, day: dd }) => yy >= minYear && yy <= maxYear && withinRange(yy, mm, dd),
|
|
5525
|
+
minMonth: {
|
|
5526
|
+
year: minYear,
|
|
5527
|
+
month: min.year > 0 && minYear === min.year ? Math.max(1, min.month) : 1
|
|
5528
|
+
},
|
|
5529
|
+
maxMonth: {
|
|
5530
|
+
year: maxYear,
|
|
5531
|
+
month: selectableRange === "until-today" && maxYear === todayYear ? todayMonth : 12
|
|
5532
|
+
},
|
|
5533
|
+
intlLocale: localeName === "en" ? "en-US" : "ko-KR",
|
|
5534
|
+
placeholder: placeholderProp ?? t("datePicker.placeholder"),
|
|
5535
|
+
dialogLabel: label ?? t("datePicker.calendar"),
|
|
5536
|
+
prevLabel: t("datePicker.prevMonth"),
|
|
5537
|
+
nextLabel: t("datePicker.nextMonth"),
|
|
5538
|
+
onSelect: (d) => emit(d.year, d.month, d.day)
|
|
5539
|
+
}
|
|
5540
|
+
);
|
|
5541
|
+
}
|
|
5323
5542
|
return /* @__PURE__ */ jsxs("div", { className: rootClassName, style: containerStyle, children: [
|
|
5324
5543
|
label && /* @__PURE__ */ jsx("span", { className: "date_picker_label", id: groupId, children: label }),
|
|
5325
5544
|
constraintDesc && /* @__PURE__ */ jsx("span", { id: constraintId, className: "date_picker_sr_only", children: constraintDesc }),
|
|
@@ -5379,6 +5598,94 @@ var DatePicker = ({
|
|
|
5379
5598
|
)
|
|
5380
5599
|
] });
|
|
5381
5600
|
};
|
|
5601
|
+
var CalendarField = ({
|
|
5602
|
+
rootClassName,
|
|
5603
|
+
containerStyle,
|
|
5604
|
+
label,
|
|
5605
|
+
labelId,
|
|
5606
|
+
describedBy,
|
|
5607
|
+
invalid,
|
|
5608
|
+
inputId,
|
|
5609
|
+
groupId,
|
|
5610
|
+
constraintId,
|
|
5611
|
+
constraintDesc,
|
|
5612
|
+
disabled,
|
|
5613
|
+
selected,
|
|
5614
|
+
today,
|
|
5615
|
+
isSelectable,
|
|
5616
|
+
minMonth,
|
|
5617
|
+
maxMonth,
|
|
5618
|
+
intlLocale,
|
|
5619
|
+
placeholder,
|
|
5620
|
+
dialogLabel,
|
|
5621
|
+
prevLabel,
|
|
5622
|
+
nextLabel,
|
|
5623
|
+
onSelect
|
|
5624
|
+
}) => {
|
|
5625
|
+
const [open, setOpen] = React21.useState(false);
|
|
5626
|
+
const valueId = React21.useId();
|
|
5627
|
+
const valueText = React21.useMemo(() => {
|
|
5628
|
+
if (!selected) return null;
|
|
5629
|
+
const options = intlLocale.startsWith("ko") ? { year: "numeric", month: "2-digit", day: "2-digit", weekday: "short" } : { year: "numeric", month: "short", day: "numeric", weekday: "short" };
|
|
5630
|
+
return new Intl.DateTimeFormat(intlLocale, options).format(
|
|
5631
|
+
new Date(selected.year, selected.month - 1, selected.day)
|
|
5632
|
+
);
|
|
5633
|
+
}, [selected, intlLocale]);
|
|
5634
|
+
return /* @__PURE__ */ jsxs("div", { className: cn(rootClassName, "date_picker_calendar"), style: containerStyle, children: [
|
|
5635
|
+
label && /* @__PURE__ */ jsx("span", { className: "date_picker_label", id: groupId, children: label }),
|
|
5636
|
+
constraintDesc && /* @__PURE__ */ jsx("span", { id: constraintId, className: "date_picker_sr_only", children: constraintDesc }),
|
|
5637
|
+
/* @__PURE__ */ jsx(
|
|
5638
|
+
Popover,
|
|
5639
|
+
{
|
|
5640
|
+
open: open && !disabled,
|
|
5641
|
+
onOpenChange: setOpen,
|
|
5642
|
+
placement: "bottom",
|
|
5643
|
+
"aria-label": dialogLabel,
|
|
5644
|
+
className: "date_picker_popover",
|
|
5645
|
+
trigger: /* @__PURE__ */ jsxs(
|
|
5646
|
+
"button",
|
|
5647
|
+
{
|
|
5648
|
+
type: "button",
|
|
5649
|
+
id: inputId,
|
|
5650
|
+
className: "date_picker_trigger",
|
|
5651
|
+
disabled,
|
|
5652
|
+
"aria-labelledby": [labelId, valueId].filter(Boolean).join(" "),
|
|
5653
|
+
"aria-describedby": describedBy,
|
|
5654
|
+
"aria-invalid": invalid || void 0,
|
|
5655
|
+
children: [
|
|
5656
|
+
/* @__PURE__ */ jsx(Calendar, { size: iconSize.md, "aria-hidden": "true", className: "date_picker_trigger_icon" }),
|
|
5657
|
+
/* @__PURE__ */ jsx(
|
|
5658
|
+
"span",
|
|
5659
|
+
{
|
|
5660
|
+
id: valueId,
|
|
5661
|
+
className: valueText ? "date_picker_trigger_value" : "date_picker_trigger_placeholder",
|
|
5662
|
+
children: valueText ?? placeholder
|
|
5663
|
+
}
|
|
5664
|
+
)
|
|
5665
|
+
]
|
|
5666
|
+
}
|
|
5667
|
+
),
|
|
5668
|
+
content: /* @__PURE__ */ jsx(
|
|
5669
|
+
DateCalendar,
|
|
5670
|
+
{
|
|
5671
|
+
selected,
|
|
5672
|
+
today,
|
|
5673
|
+
isSelectable,
|
|
5674
|
+
minMonth,
|
|
5675
|
+
maxMonth,
|
|
5676
|
+
intlLocale,
|
|
5677
|
+
prevLabel,
|
|
5678
|
+
nextLabel,
|
|
5679
|
+
onSelect: (date) => {
|
|
5680
|
+
onSelect(date);
|
|
5681
|
+
setOpen(false);
|
|
5682
|
+
}
|
|
5683
|
+
}
|
|
5684
|
+
)
|
|
5685
|
+
}
|
|
5686
|
+
)
|
|
5687
|
+
] });
|
|
5688
|
+
};
|
|
5382
5689
|
var DateRangePicker = ({
|
|
5383
5690
|
value,
|
|
5384
5691
|
onValueChange,
|
|
@@ -5473,13 +5780,13 @@ var FileInput = ({
|
|
|
5473
5780
|
}) => {
|
|
5474
5781
|
const t = useLocaleText();
|
|
5475
5782
|
const label = labelProp ?? t("fileInput.label");
|
|
5476
|
-
const generatedInputId =
|
|
5477
|
-
const helperId =
|
|
5783
|
+
const generatedInputId = React21.useId();
|
|
5784
|
+
const helperId = React21.useId();
|
|
5478
5785
|
const field = useFieldControl();
|
|
5479
5786
|
const inputId = field?.inputId ?? generatedInputId;
|
|
5480
|
-
const inputRef =
|
|
5481
|
-
const [previewUrls, setPreviewUrls] =
|
|
5482
|
-
const previewUrlsRef =
|
|
5787
|
+
const inputRef = React21.useRef(null);
|
|
5788
|
+
const [previewUrls, setPreviewUrls] = React21.useState([]);
|
|
5789
|
+
const previewUrlsRef = React21.useRef([]);
|
|
5483
5790
|
const isPreviewVariant = variant === "preview";
|
|
5484
5791
|
const showPreview = isPreviewVariant || preview;
|
|
5485
5792
|
const handleChange = (e) => {
|
|
@@ -5521,7 +5828,7 @@ var FileInput = ({
|
|
|
5521
5828
|
}
|
|
5522
5829
|
onFiles?.(null);
|
|
5523
5830
|
};
|
|
5524
|
-
|
|
5831
|
+
React21.useEffect(() => {
|
|
5525
5832
|
return () => {
|
|
5526
5833
|
for (const url of previewUrlsRef.current) {
|
|
5527
5834
|
URL.revokeObjectURL(url);
|
|
@@ -5929,13 +6236,13 @@ var OtpInput = ({
|
|
|
5929
6236
|
}) => {
|
|
5930
6237
|
const t = useLocaleText();
|
|
5931
6238
|
const ariaLabel = ariaLabelProp ?? t("otpInput.label");
|
|
5932
|
-
const inputsRef =
|
|
5933
|
-
const isTypingRef =
|
|
5934
|
-
const typingTimerRef =
|
|
5935
|
-
|
|
6239
|
+
const inputsRef = React21.useRef([]);
|
|
6240
|
+
const isTypingRef = React21.useRef(false);
|
|
6241
|
+
const typingTimerRef = React21.useRef(void 0);
|
|
6242
|
+
React21.useEffect(() => {
|
|
5936
6243
|
if (autoFocus) inputsRef.current[0]?.focus();
|
|
5937
6244
|
}, [autoFocus]);
|
|
5938
|
-
const digits =
|
|
6245
|
+
const digits = React21.useMemo(() => {
|
|
5939
6246
|
const chars = value.split("").slice(0, length);
|
|
5940
6247
|
while (chars.length < length) chars.push("");
|
|
5941
6248
|
return chars;
|
|
@@ -5970,7 +6277,7 @@ var OtpInput = ({
|
|
|
5970
6277
|
}, 50);
|
|
5971
6278
|
}
|
|
5972
6279
|
};
|
|
5973
|
-
|
|
6280
|
+
React21.useEffect(() => () => clearTimeout(typingTimerRef.current), []);
|
|
5974
6281
|
const handleFocus = (index) => {
|
|
5975
6282
|
if (isTypingRef.current) return;
|
|
5976
6283
|
const firstEmpty = digits.indexOf("");
|
|
@@ -6012,7 +6319,7 @@ var OtpInput = ({
|
|
|
6012
6319
|
focusInput(nextIndex);
|
|
6013
6320
|
};
|
|
6014
6321
|
const rootClassName = cn("otp_input", className);
|
|
6015
|
-
const supportingId =
|
|
6322
|
+
const supportingId = React21.useId();
|
|
6016
6323
|
const field = useFieldControl();
|
|
6017
6324
|
return (
|
|
6018
6325
|
// biome-ignore lint/a11y/useSemanticElements: <fieldset> would force border/legend styles; role=group is the WAI-ARIA equivalent for OTP grouping
|
|
@@ -6067,9 +6374,9 @@ var OtpInput = ({
|
|
|
6067
6374
|
);
|
|
6068
6375
|
};
|
|
6069
6376
|
OtpInput.displayName = "OtpInput";
|
|
6070
|
-
var RadioGroupContext =
|
|
6377
|
+
var RadioGroupContext = React21.createContext(null);
|
|
6071
6378
|
function useRadioGroupContext() {
|
|
6072
|
-
return
|
|
6379
|
+
return React21.useContext(RadioGroupContext);
|
|
6073
6380
|
}
|
|
6074
6381
|
var RadioGroup = ({
|
|
6075
6382
|
value: controlledValue,
|
|
@@ -6087,23 +6394,23 @@ var RadioGroup = ({
|
|
|
6087
6394
|
...props
|
|
6088
6395
|
}) => {
|
|
6089
6396
|
const isControlled = controlledValue !== void 0;
|
|
6090
|
-
const [internalValue, setInternalValue] =
|
|
6397
|
+
const [internalValue, setInternalValue] = React21.useState(defaultValue);
|
|
6091
6398
|
const value = isControlled ? controlledValue : internalValue;
|
|
6092
|
-
const generatedName =
|
|
6399
|
+
const generatedName = React21.useId();
|
|
6093
6400
|
const name = nameProp ?? generatedName;
|
|
6094
|
-
const idPrefix =
|
|
6401
|
+
const idPrefix = React21.useId();
|
|
6095
6402
|
const field = useFieldControl();
|
|
6096
6403
|
const labelId = label ? `${idPrefix}-label` : void 0;
|
|
6097
6404
|
const helperId = supportingText ? `${idPrefix}-help` : void 0;
|
|
6098
6405
|
const { ariaProps, restProps } = splitAriaProps(props);
|
|
6099
|
-
const onChange =
|
|
6406
|
+
const onChange = React21.useCallback(
|
|
6100
6407
|
(next) => {
|
|
6101
6408
|
if (!isControlled) setInternalValue(next);
|
|
6102
6409
|
onValueChange?.(next);
|
|
6103
6410
|
},
|
|
6104
6411
|
[isControlled, onValueChange]
|
|
6105
6412
|
);
|
|
6106
|
-
const ctx =
|
|
6413
|
+
const ctx = React21.useMemo(
|
|
6107
6414
|
() => ({ name, value, onChange, size, disabled }),
|
|
6108
6415
|
[name, value, onChange, size, disabled]
|
|
6109
6416
|
);
|
|
@@ -6129,7 +6436,7 @@ var RadioGroup = ({
|
|
|
6129
6436
|
"aria-invalid": error || (field ? field.invalid || void 0 : ariaProps["aria-invalid"]),
|
|
6130
6437
|
"aria-required": field ? field.required || void 0 : ariaProps["aria-required"],
|
|
6131
6438
|
className: "radio_group_options",
|
|
6132
|
-
children
|
|
6439
|
+
children: /* @__PURE__ */ jsx(FieldControlBoundary, { children })
|
|
6133
6440
|
}
|
|
6134
6441
|
),
|
|
6135
6442
|
supportingText && /* @__PURE__ */ jsx("div", { id: helperId, className: "radio_group_helper", children: supportingText })
|
|
@@ -6489,14 +6796,14 @@ var TimePicker = ({
|
|
|
6489
6796
|
const minuteLabel = minuteLabelProp ?? t("timePicker.minute");
|
|
6490
6797
|
const field = useFieldControl();
|
|
6491
6798
|
const isRequired = field ? field.required || void 0 : required || void 0;
|
|
6492
|
-
const groupId =
|
|
6493
|
-
const constraintId =
|
|
6799
|
+
const groupId = React21.useId();
|
|
6800
|
+
const constraintId = React21.useId();
|
|
6494
6801
|
const min = toMinutes(minTime) ?? 0;
|
|
6495
6802
|
const max = toMinutes(maxTime) ?? 23 * 60 + 59;
|
|
6496
6803
|
const parsed = toMinutes(value);
|
|
6497
6804
|
const hour = parsed === null ? null : Math.floor(parsed / 60);
|
|
6498
6805
|
const minute = parsed === null ? null : parsed % 60;
|
|
6499
|
-
const hourOptions =
|
|
6806
|
+
const hourOptions = React21.useMemo(() => {
|
|
6500
6807
|
const first = Math.floor(min / 60);
|
|
6501
6808
|
const last = Math.floor(max / 60);
|
|
6502
6809
|
return Array.from({ length: Math.max(0, last - first + 1) }, (_, i) => {
|
|
@@ -6504,7 +6811,7 @@ var TimePicker = ({
|
|
|
6504
6811
|
return { value: String(h), label: pad2(h) };
|
|
6505
6812
|
});
|
|
6506
6813
|
}, [min, max]);
|
|
6507
|
-
const minuteOptions =
|
|
6814
|
+
const minuteOptions = React21.useMemo(() => {
|
|
6508
6815
|
if (hour === null) return [];
|
|
6509
6816
|
const step = Math.max(1, Math.floor(minuteStep));
|
|
6510
6817
|
return Array.from({ length: Math.ceil(60 / step) }, (_, i) => i * step).filter((m) => m < 60).filter((m) => hour * 60 + m >= min && hour * 60 + m <= max).map((m) => ({ value: String(m), label: pad2(m) }));
|
|
@@ -6594,7 +6901,7 @@ var Toggle = ({
|
|
|
6594
6901
|
...props
|
|
6595
6902
|
}) => {
|
|
6596
6903
|
const isControlled = checked !== void 0;
|
|
6597
|
-
const [innerChecked, setInnerChecked] =
|
|
6904
|
+
const [innerChecked, setInnerChecked] = React21.useState(!!defaultChecked);
|
|
6598
6905
|
const isOn = isControlled ? !!checked : innerChecked;
|
|
6599
6906
|
const handleToggle = (e) => {
|
|
6600
6907
|
props.onClick?.(e);
|
|
@@ -6675,16 +6982,16 @@ var Drawer = ({
|
|
|
6675
6982
|
}) => {
|
|
6676
6983
|
const t = useLocaleText();
|
|
6677
6984
|
const closeLabel = closeLabelProp ?? t("drawer.close");
|
|
6678
|
-
const lastContentRef =
|
|
6985
|
+
const lastContentRef = React21.useRef({ children, title, footer });
|
|
6679
6986
|
if (open) lastContentRef.current = { children, title, footer };
|
|
6680
6987
|
const content = open ? { children, title, footer } : lastContentRef.current;
|
|
6681
6988
|
const overlayDismissible = dismissible ?? closeOnOverlay;
|
|
6682
6989
|
const escapeDismissible = dismissible ?? true;
|
|
6683
|
-
const panelRef =
|
|
6684
|
-
const bodyRef =
|
|
6685
|
-
const pressedOverlayRef =
|
|
6686
|
-
const titleId =
|
|
6687
|
-
const [shouldRender, setShouldRender] =
|
|
6990
|
+
const panelRef = React21.useRef(null);
|
|
6991
|
+
const bodyRef = React21.useRef(null);
|
|
6992
|
+
const pressedOverlayRef = React21.useRef(false);
|
|
6993
|
+
const titleId = React21.useId();
|
|
6994
|
+
const [shouldRender, setShouldRender] = React21.useState(open);
|
|
6688
6995
|
const instant = useReducedMotion() || disableAnimation;
|
|
6689
6996
|
const isMounted = useIsMounted();
|
|
6690
6997
|
useFocusTrap(panelRef, open && isMounted, {
|
|
@@ -6695,13 +7002,13 @@ var Drawer = ({
|
|
|
6695
7002
|
if (escapeDismissible) onClose?.();
|
|
6696
7003
|
});
|
|
6697
7004
|
if (open && !shouldRender) setShouldRender(true);
|
|
6698
|
-
const renderingRef =
|
|
6699
|
-
const onExitedRef =
|
|
7005
|
+
const renderingRef = React21.useRef(shouldRender);
|
|
7006
|
+
const onExitedRef = React21.useRef(onExited);
|
|
6700
7007
|
useSafeLayoutEffect(() => {
|
|
6701
7008
|
renderingRef.current = shouldRender;
|
|
6702
7009
|
onExitedRef.current = onExited;
|
|
6703
7010
|
});
|
|
6704
|
-
const finishExit =
|
|
7011
|
+
const finishExit = React21.useCallback(() => {
|
|
6705
7012
|
if (!renderingRef.current) return;
|
|
6706
7013
|
renderingRef.current = false;
|
|
6707
7014
|
setShouldRender(false);
|
|
@@ -6718,7 +7025,7 @@ var Drawer = ({
|
|
|
6718
7025
|
}
|
|
6719
7026
|
});
|
|
6720
7027
|
const overlayOpacity = overlayStyle.opacity;
|
|
6721
|
-
|
|
7028
|
+
React21.useEffect(() => {
|
|
6722
7029
|
if (open || !shouldRender) return;
|
|
6723
7030
|
const frame = requestAnimationFrame(() => {
|
|
6724
7031
|
if (!overlayOpacity.isAnimating && overlayOpacity.get() === 0) finishExit();
|
|
@@ -6733,7 +7040,7 @@ var Drawer = ({
|
|
|
6733
7040
|
immediate: instant,
|
|
6734
7041
|
config: OVERLAY_SPRING_CONFIG
|
|
6735
7042
|
});
|
|
6736
|
-
|
|
7043
|
+
React21.useEffect(() => {
|
|
6737
7044
|
if (!shouldRender) return;
|
|
6738
7045
|
lockBodyScroll();
|
|
6739
7046
|
return () => {
|
|
@@ -6821,16 +7128,16 @@ var Modal = ({
|
|
|
6821
7128
|
}) => {
|
|
6822
7129
|
const t = useLocaleText();
|
|
6823
7130
|
const closeLabel = closeLabelProp ?? t("modal.close");
|
|
6824
|
-
const lastContentRef =
|
|
7131
|
+
const lastContentRef = React21.useRef({ children, title, description, footer });
|
|
6825
7132
|
if (open) lastContentRef.current = { children, title, description, footer };
|
|
6826
7133
|
const content = open ? { children, title, description, footer } : lastContentRef.current;
|
|
6827
7134
|
const overlayDismissible = dismissible ?? closeOnOverlay;
|
|
6828
7135
|
const escapeDismissible = dismissible ?? true;
|
|
6829
|
-
const panelRef =
|
|
6830
|
-
const bodyRef =
|
|
6831
|
-
const pressedOverlayRef =
|
|
6832
|
-
const titleId =
|
|
6833
|
-
const [shouldRender, setShouldRender] =
|
|
7136
|
+
const panelRef = React21.useRef(null);
|
|
7137
|
+
const bodyRef = React21.useRef(null);
|
|
7138
|
+
const pressedOverlayRef = React21.useRef(false);
|
|
7139
|
+
const titleId = React21.useId();
|
|
7140
|
+
const [shouldRender, setShouldRender] = React21.useState(open);
|
|
6834
7141
|
const isMounted = useIsMounted();
|
|
6835
7142
|
useFocusTrap(panelRef, open && isMounted, {
|
|
6836
7143
|
preferWithin: bodyRef,
|
|
@@ -6861,7 +7168,7 @@ var Modal = ({
|
|
|
6861
7168
|
immediate: reduced,
|
|
6862
7169
|
config: OVERLAY_SPRING_CONFIG
|
|
6863
7170
|
});
|
|
6864
|
-
|
|
7171
|
+
React21.useEffect(() => {
|
|
6865
7172
|
if (!shouldRender) return;
|
|
6866
7173
|
lockBodyScroll();
|
|
6867
7174
|
return () => {
|
|
@@ -6923,9 +7230,9 @@ var Modal = ({
|
|
|
6923
7230
|
document.body
|
|
6924
7231
|
);
|
|
6925
7232
|
};
|
|
6926
|
-
var ThemeContext =
|
|
7233
|
+
var ThemeContext = React21.createContext(null);
|
|
6927
7234
|
var useTheme = () => {
|
|
6928
|
-
const ctx =
|
|
7235
|
+
const ctx = React21.useContext(ThemeContext);
|
|
6929
7236
|
if (!ctx) {
|
|
6930
7237
|
throw new Error(
|
|
6931
7238
|
'[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>'
|
|
@@ -6949,15 +7256,15 @@ var ThemeProvider = ({
|
|
|
6949
7256
|
targetSelector,
|
|
6950
7257
|
children
|
|
6951
7258
|
}) => {
|
|
6952
|
-
const [mode, setModeState] =
|
|
6953
|
-
const [systemDark, setSystemDark] =
|
|
6954
|
-
|
|
7259
|
+
const [mode, setModeState] = React21.useState(defaultMode);
|
|
7260
|
+
const [systemDark, setSystemDark] = React21.useState(false);
|
|
7261
|
+
React21.useEffect(() => {
|
|
6955
7262
|
setModeState(readStored(storageKey) ?? defaultMode);
|
|
6956
7263
|
if (isClient) {
|
|
6957
7264
|
setSystemDark(window.matchMedia("(prefers-color-scheme: dark)").matches);
|
|
6958
7265
|
}
|
|
6959
7266
|
}, [storageKey, defaultMode]);
|
|
6960
|
-
|
|
7267
|
+
React21.useEffect(() => {
|
|
6961
7268
|
if (!isClient) return;
|
|
6962
7269
|
const mq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
6963
7270
|
const handler = (e) => setSystemDark(e.matches);
|
|
@@ -6965,7 +7272,7 @@ var ThemeProvider = ({
|
|
|
6965
7272
|
return () => mq.removeEventListener("change", handler);
|
|
6966
7273
|
}, []);
|
|
6967
7274
|
const resolved = mode === "system" ? systemDark ? "dark" : "light" : mode;
|
|
6968
|
-
|
|
7275
|
+
React21.useEffect(() => {
|
|
6969
7276
|
if (!isClient) return;
|
|
6970
7277
|
const target = targetSelector ? document.querySelector(targetSelector) : document.documentElement;
|
|
6971
7278
|
if (!target) return;
|
|
@@ -6975,7 +7282,7 @@ var ThemeProvider = ({
|
|
|
6975
7282
|
target.setAttribute("data-theme", mode);
|
|
6976
7283
|
}
|
|
6977
7284
|
}, [mode, targetSelector]);
|
|
6978
|
-
const setMode =
|
|
7285
|
+
const setMode = React21.useCallback(
|
|
6979
7286
|
(next) => {
|
|
6980
7287
|
setModeState(next);
|
|
6981
7288
|
if (storageKey && isClient) {
|
|
@@ -6987,7 +7294,7 @@ var ThemeProvider = ({
|
|
|
6987
7294
|
},
|
|
6988
7295
|
[storageKey]
|
|
6989
7296
|
);
|
|
6990
|
-
const value =
|
|
7297
|
+
const value = React21.useMemo(
|
|
6991
7298
|
() => ({ mode, resolved, setMode }),
|
|
6992
7299
|
[mode, resolved, setMode]
|
|
6993
7300
|
);
|