@bigtablet/design-system 3.23.1 → 3.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +194 -0
- package/dist/index.d.ts +181 -64
- package/dist/index.js +230 -93
- package/dist/vanilla/bigtablet.min.js +1 -1
- package/package.json +6 -3
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import './index.css';
|
|
3
3
|
import * as React20 from 'react';
|
|
4
|
-
import { createContext, useState, useRef, useCallback, useEffect, useMemo, useContext, useId, Fragment, useImperativeHandle, useLayoutEffect } from 'react';
|
|
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, EyeOff, Eye, ArrowUp, ArrowDown, ArrowUpDown, Search, XCircle, AlertTriangle, CheckCircle2, Info, Bell,
|
|
7
|
-
import { jsx, jsxs, Fragment
|
|
6
|
+
import { ChevronDown, ChevronRight, Globe, ChevronLeft, Check, EyeOff, Eye, ArrowUp, ArrowDown, ArrowUpDown, Search, XCircle, AlertTriangle, CheckCircle2, Info, Bell, Image, X, TriangleAlert } from 'lucide-react';
|
|
7
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
8
|
import { createPortal } from 'react-dom';
|
|
9
9
|
|
|
10
10
|
// src/utils/cn.ts
|
|
@@ -54,7 +54,7 @@ function keyActivationProps({
|
|
|
54
54
|
}
|
|
55
55
|
var stack = [];
|
|
56
56
|
var handleKeyDown = (e) => {
|
|
57
|
-
if (e.key !== "Escape") return;
|
|
57
|
+
if (e.key !== "Escape" || e.defaultPrevented) return;
|
|
58
58
|
const top = stack[stack.length - 1];
|
|
59
59
|
if (!top) return;
|
|
60
60
|
e.stopImmediatePropagation();
|
|
@@ -186,15 +186,6 @@ function unlockBodyScroll() {
|
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
// src/utils/spring-motion.ts
|
|
190
|
-
function springEnterFrom(reduced, transform) {
|
|
191
|
-
if (reduced) return {};
|
|
192
|
-
return { from: transform === void 0 ? { opacity: 0 } : { opacity: 0, transform } };
|
|
193
|
-
}
|
|
194
|
-
var OVERLAY_PANEL_CLOSED_TRANSFORM = "scale(0.96) translateY(-4px)";
|
|
195
|
-
var OVERLAY_PANEL_OPEN_TRANSFORM = "scale(1) translateY(0px)";
|
|
196
|
-
var OVERLAY_SPRING_CONFIG = { tension: 280, friction: 28, clamp: true };
|
|
197
|
-
|
|
198
189
|
// src/utils/split-aria-props.ts
|
|
199
190
|
function splitAriaProps(props) {
|
|
200
191
|
const ariaProps = {};
|
|
@@ -204,6 +195,15 @@ function splitAriaProps(props) {
|
|
|
204
195
|
}
|
|
205
196
|
return { ariaProps, restProps };
|
|
206
197
|
}
|
|
198
|
+
|
|
199
|
+
// src/utils/spring-motion.ts
|
|
200
|
+
function springEnterFrom(reduced, transform) {
|
|
201
|
+
if (reduced) return {};
|
|
202
|
+
return { from: transform === void 0 ? { opacity: 0 } : { opacity: 0, transform } };
|
|
203
|
+
}
|
|
204
|
+
var OVERLAY_PANEL_CLOSED_TRANSFORM = "scale(0.96) translateY(-4px)";
|
|
205
|
+
var OVERLAY_PANEL_OPEN_TRANSFORM = "scale(1) translateY(0px)";
|
|
206
|
+
var OVERLAY_SPRING_CONFIG = { tension: 280, friction: 28, clamp: true };
|
|
207
207
|
var useSafeLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
|
208
208
|
|
|
209
209
|
// src/utils/use-anchored-position.ts
|
|
@@ -387,7 +387,9 @@ function useFocusTrap(containerRef, isActive, options) {
|
|
|
387
387
|
const preferred = preferredRoot ? Array.from(preferredRoot.querySelectorAll(FOCUSABLE_SELECTORS)).find(
|
|
388
388
|
(el) => !el.hasAttribute(SKIP_AUTOFOCUS_ATTR)
|
|
389
389
|
) ?? null : null;
|
|
390
|
-
const
|
|
390
|
+
const explicit = options?.initialFocus?.current;
|
|
391
|
+
const explicitTarget = explicit && container.contains(explicit) && explicit.matches(FOCUSABLE_SELECTORS) ? explicit : null;
|
|
392
|
+
const initialTarget = explicitTarget ?? preferred ?? Array.from(focusableElements).find((el) => !el.hasAttribute(SKIP_AUTOFOCUS_ATTR)) ?? focusableElements[0];
|
|
391
393
|
if (initialTarget) {
|
|
392
394
|
initialTarget.focus();
|
|
393
395
|
} else {
|
|
@@ -616,6 +618,7 @@ function useListboxPopup({
|
|
|
616
618
|
setActiveIndex(lastEnabled());
|
|
617
619
|
break;
|
|
618
620
|
case "Escape":
|
|
621
|
+
if (!isOpen) break;
|
|
619
622
|
event.preventDefault();
|
|
620
623
|
setIsOpen(false);
|
|
621
624
|
break;
|
|
@@ -644,6 +647,7 @@ function useListboxPopup({
|
|
|
644
647
|
commitActive();
|
|
645
648
|
break;
|
|
646
649
|
case "Escape":
|
|
650
|
+
if (!isOpen) break;
|
|
647
651
|
event.preventDefault();
|
|
648
652
|
close();
|
|
649
653
|
break;
|
|
@@ -652,7 +656,7 @@ function useListboxPopup({
|
|
|
652
656
|
break;
|
|
653
657
|
}
|
|
654
658
|
},
|
|
655
|
-
[disabled, moveActive, commitActive, close]
|
|
659
|
+
[disabled, isOpen, moveActive, commitActive, close]
|
|
656
660
|
);
|
|
657
661
|
useEffect(() => {
|
|
658
662
|
if (!isOpen) return;
|
|
@@ -779,10 +783,9 @@ var Accordion = ({
|
|
|
779
783
|
}
|
|
780
784
|
) }),
|
|
781
785
|
/* @__PURE__ */ jsx(
|
|
782
|
-
"
|
|
786
|
+
"section",
|
|
783
787
|
{
|
|
784
788
|
id: panelId,
|
|
785
|
-
role: "region",
|
|
786
789
|
"aria-labelledby": headerId,
|
|
787
790
|
"aria-hidden": !isOpen,
|
|
788
791
|
inert: !isOpen,
|
|
@@ -812,20 +815,31 @@ var Avatar = ({
|
|
|
812
815
|
const [failedSrc, setFailedSrc] = React20.useState(null);
|
|
813
816
|
const showImage = src && failedSrc !== src;
|
|
814
817
|
const initials = getInitials(name);
|
|
815
|
-
return
|
|
816
|
-
"
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
818
|
+
return (
|
|
819
|
+
// biome-ignore lint/a11y/useAriaPropsSupportedByRole: aria-label 은 role="img" 일 때만 붙는다 - 삼항을 린터가 따라가지 못한다
|
|
820
|
+
/* @__PURE__ */ jsx(
|
|
821
|
+
"span",
|
|
822
|
+
{
|
|
823
|
+
className: cn("avatar", `avatar_size_${size}`, `avatar_shape_${shape}`, className),
|
|
824
|
+
style: { background: !showImage ? bgColor : void 0, ...style },
|
|
825
|
+
role: showImage || !name ? void 0 : "img",
|
|
826
|
+
"aria-label": showImage ? void 0 : name || void 0,
|
|
827
|
+
"aria-hidden": !showImage && !name ? true : void 0,
|
|
828
|
+
...props,
|
|
829
|
+
children: showImage ? (
|
|
830
|
+
// biome-ignore lint/performance/noImgElement: DS is framework-agnostic - consumers wrap with next/image
|
|
831
|
+
/* @__PURE__ */ jsx(
|
|
832
|
+
"img",
|
|
833
|
+
{
|
|
834
|
+
src,
|
|
835
|
+
alt: name,
|
|
836
|
+
onError: () => setFailedSrc(src ?? null),
|
|
837
|
+
className: "avatar_image"
|
|
838
|
+
}
|
|
839
|
+
)
|
|
840
|
+
) : /* @__PURE__ */ jsx("span", { className: "avatar_initials", "aria-hidden": "true", children: initials })
|
|
841
|
+
}
|
|
842
|
+
)
|
|
829
843
|
);
|
|
830
844
|
};
|
|
831
845
|
var Badge = ({
|
|
@@ -1039,6 +1053,8 @@ var ko = {
|
|
|
1039
1053
|
"pagination.next": "\uB2E4\uC74C \uD398\uC774\uC9C0",
|
|
1040
1054
|
"pagination.prev": "\uC774\uC804 \uD398\uC774\uC9C0",
|
|
1041
1055
|
"sidebar.toggle": "\uC0AC\uC774\uB4DC\uBC14 \uD1A0\uAE00",
|
|
1056
|
+
"stepper.current": "\uD604\uC7AC \uB2E8\uACC4",
|
|
1057
|
+
"stepper.done": "\uC644\uB8CC",
|
|
1042
1058
|
"drawer.close": "\uB2EB\uAE30",
|
|
1043
1059
|
"modal.close": "\uB2EB\uAE30"
|
|
1044
1060
|
};
|
|
@@ -1104,6 +1120,8 @@ var en = {
|
|
|
1104
1120
|
"pagination.next": "Next page",
|
|
1105
1121
|
"pagination.prev": "Previous page",
|
|
1106
1122
|
"sidebar.toggle": "Toggle sidebar",
|
|
1123
|
+
"stepper.current": "Current step",
|
|
1124
|
+
"stepper.done": "Completed",
|
|
1107
1125
|
"drawer.close": "Close",
|
|
1108
1126
|
"modal.close": "Close"
|
|
1109
1127
|
};
|
|
@@ -1196,7 +1214,7 @@ var BottomNavItem = (props) => {
|
|
|
1196
1214
|
const ariaCurrent = active ? "page" : void 0;
|
|
1197
1215
|
const anchorRest = rest;
|
|
1198
1216
|
const Tag = as ?? (anchorRest.href != null ? "a" : "button");
|
|
1199
|
-
const content = /* @__PURE__ */ jsxs(Fragment
|
|
1217
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1200
1218
|
/* @__PURE__ */ jsxs("span", { className: "bottom_nav_item_icon", "aria-hidden": "true", children: [
|
|
1201
1219
|
icon,
|
|
1202
1220
|
badge && /* @__PURE__ */ jsx("span", { className: "bottom_nav_item_badge", children: badge })
|
|
@@ -1246,7 +1264,10 @@ var BottomNavItem = (props) => {
|
|
|
1246
1264
|
}
|
|
1247
1265
|
);
|
|
1248
1266
|
};
|
|
1249
|
-
var BottomNavSpacer = ({
|
|
1267
|
+
var BottomNavSpacer = ({
|
|
1268
|
+
className,
|
|
1269
|
+
...props
|
|
1270
|
+
}) => {
|
|
1250
1271
|
return /* @__PURE__ */ jsx("div", { className: cn("bottom_nav_spacer", className), "aria-hidden": "true", ...props });
|
|
1251
1272
|
};
|
|
1252
1273
|
var Breadcrumb = ({
|
|
@@ -1607,24 +1628,33 @@ var LocaleSwitcher = ({ locale }) => {
|
|
|
1607
1628
|
]
|
|
1608
1629
|
}
|
|
1609
1630
|
),
|
|
1610
|
-
open && /* @__PURE__ */ jsx(
|
|
1611
|
-
"
|
|
1631
|
+
open && /* @__PURE__ */ jsx(
|
|
1632
|
+
"ul",
|
|
1612
1633
|
{
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
role: "
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1634
|
+
id: menuId,
|
|
1635
|
+
role: "menu",
|
|
1636
|
+
className: "nav_bar_locale_menu",
|
|
1637
|
+
onKeyDown: handleMenuKeyDown,
|
|
1638
|
+
children: locale.options.map((opt, index) => /* @__PURE__ */ jsx("li", { role: "none", children: /* @__PURE__ */ jsx(
|
|
1639
|
+
"button",
|
|
1640
|
+
{
|
|
1641
|
+
ref: (el) => {
|
|
1642
|
+
itemRefs.current[index] = el;
|
|
1643
|
+
},
|
|
1644
|
+
type: "button",
|
|
1645
|
+
role: "menuitemradio",
|
|
1646
|
+
"aria-checked": opt.value === locale.current,
|
|
1647
|
+
tabIndex: -1,
|
|
1648
|
+
className: cn(
|
|
1649
|
+
"nav_bar_locale_item",
|
|
1650
|
+
opt.value === locale.current && "nav_bar_locale_item_active"
|
|
1651
|
+
),
|
|
1652
|
+
onClick: () => handleSelect(opt.value),
|
|
1653
|
+
children: opt.label
|
|
1654
|
+
}
|
|
1655
|
+
) }, opt.value))
|
|
1626
1656
|
}
|
|
1627
|
-
)
|
|
1657
|
+
)
|
|
1628
1658
|
] });
|
|
1629
1659
|
};
|
|
1630
1660
|
var NavLink = (props) => {
|
|
@@ -1713,7 +1743,7 @@ var SidebarItem = (props) => {
|
|
|
1713
1743
|
const ariaCurrent = active ? "page" : void 0;
|
|
1714
1744
|
const anchorRest = rest;
|
|
1715
1745
|
const Tag = as ?? (anchorRest.href != null ? "a" : "button");
|
|
1716
|
-
const inner = /* @__PURE__ */ jsxs(Fragment
|
|
1746
|
+
const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1717
1747
|
icon && /* @__PURE__ */ jsx("span", { className: "sidebar_item_icon", "aria-hidden": "true", children: icon }),
|
|
1718
1748
|
/* @__PURE__ */ jsx("span", { className: "sidebar_item_label", children }),
|
|
1719
1749
|
trailing && /* @__PURE__ */ jsx("span", { className: "sidebar_item_trailing", children: trailing })
|
|
@@ -1765,6 +1795,55 @@ var SidebarSection = ({ label, className, children, ...props }) => {
|
|
|
1765
1795
|
children
|
|
1766
1796
|
] });
|
|
1767
1797
|
};
|
|
1798
|
+
var Stepper = ({
|
|
1799
|
+
steps,
|
|
1800
|
+
current,
|
|
1801
|
+
orientation = "horizontal",
|
|
1802
|
+
onStepClick,
|
|
1803
|
+
className,
|
|
1804
|
+
ref,
|
|
1805
|
+
...props
|
|
1806
|
+
}) => {
|
|
1807
|
+
const t = useLocaleText();
|
|
1808
|
+
return /* @__PURE__ */ jsx("ol", { ref, className: cn("stepper", `stepper_${orientation}`, className), ...props, children: steps.map((step, index) => {
|
|
1809
|
+
const status = index < current ? "done" : index === current ? "active" : "pending";
|
|
1810
|
+
const clickable = !!onStepClick && status === "done";
|
|
1811
|
+
const statusText = status === "done" ? t("stepper.done") : status === "active" ? t("stepper.current") : null;
|
|
1812
|
+
const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1813
|
+
/* @__PURE__ */ jsx("span", { className: "stepper_indicator", "aria-hidden": "true", children: status === "done" ? /* @__PURE__ */ jsx(Check, { size: iconSize.sm }) : index + 1 }),
|
|
1814
|
+
/* @__PURE__ */ jsxs("span", { className: "stepper_text", children: [
|
|
1815
|
+
/* @__PURE__ */ jsxs("span", { className: "stepper_label", children: [
|
|
1816
|
+
step.label,
|
|
1817
|
+
statusText && /* @__PURE__ */ jsxs("span", { className: "stepper_sr_only", children: [
|
|
1818
|
+
" ",
|
|
1819
|
+
statusText
|
|
1820
|
+
] })
|
|
1821
|
+
] }),
|
|
1822
|
+
step.description !== void 0 && step.description !== null && /* @__PURE__ */ jsx("span", { className: "stepper_description", children: step.description })
|
|
1823
|
+
] })
|
|
1824
|
+
] });
|
|
1825
|
+
return /* @__PURE__ */ jsx(
|
|
1826
|
+
"li",
|
|
1827
|
+
{
|
|
1828
|
+
className: cn("stepper_step", `stepper_step_${status}`),
|
|
1829
|
+
"aria-current": status === "active" ? "step" : void 0,
|
|
1830
|
+
children: onStepClick ? /* @__PURE__ */ jsx(
|
|
1831
|
+
"button",
|
|
1832
|
+
{
|
|
1833
|
+
type: "button",
|
|
1834
|
+
className: "stepper_content stepper_button",
|
|
1835
|
+
"aria-disabled": clickable ? void 0 : true,
|
|
1836
|
+
tabIndex: clickable ? void 0 : -1,
|
|
1837
|
+
onClick: clickable ? () => onStepClick(index, step) : void 0,
|
|
1838
|
+
children: inner
|
|
1839
|
+
}
|
|
1840
|
+
) : /* @__PURE__ */ jsx("span", { className: "stepper_content", children: inner })
|
|
1841
|
+
},
|
|
1842
|
+
step.id
|
|
1843
|
+
);
|
|
1844
|
+
}) });
|
|
1845
|
+
};
|
|
1846
|
+
Stepper.displayName = "Stepper";
|
|
1768
1847
|
var TabsContext = React20.createContext(null);
|
|
1769
1848
|
function useTabsContext() {
|
|
1770
1849
|
const ctx = React20.useContext(TabsContext);
|
|
@@ -2173,6 +2252,7 @@ var Tooltip = ({
|
|
|
2173
2252
|
return /* @__PURE__ */ jsxs("span", { className: "tooltip_wrapper", ref: wrapperRef, children: [
|
|
2174
2253
|
trigger,
|
|
2175
2254
|
shouldRender && typeof document !== "undefined" && createPortal(
|
|
2255
|
+
// biome-ignore lint/a11y/noStaticElementInteractions: 포인터 호버로 열림을 유지할 뿐인 WCAG 1.4.13 처리 - 조작 대상이 아니다
|
|
2176
2256
|
/* @__PURE__ */ jsx(
|
|
2177
2257
|
"span",
|
|
2178
2258
|
{
|
|
@@ -3156,7 +3236,7 @@ var Button = (props) => {
|
|
|
3156
3236
|
disabled && "button_disabled",
|
|
3157
3237
|
className
|
|
3158
3238
|
);
|
|
3159
|
-
const content = /* @__PURE__ */ jsxs(Fragment
|
|
3239
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3160
3240
|
leadingIcon && /* @__PURE__ */ jsx("span", { className: "button_icon", "aria-hidden": "true", children: leadingIcon }),
|
|
3161
3241
|
children && /* @__PURE__ */ jsx("span", { className: "button_label", children }),
|
|
3162
3242
|
trailingIcon && /* @__PURE__ */ jsx("span", { className: "button_icon", "aria-hidden": "true", children: trailingIcon })
|
|
@@ -3386,7 +3466,7 @@ var Table = ({
|
|
|
3386
3466
|
const rowClickHint = rowClickHintProp ?? t("table.rowClickHint");
|
|
3387
3467
|
const emptyMessage = emptyMessageProp === void 0 ? t("table.empty") : emptyMessageProp;
|
|
3388
3468
|
const selectAllAriaLabel = selectAllAriaLabelProp ?? t("table.selectAll");
|
|
3389
|
-
const selectRowAriaLabel = selectRowAriaLabelProp ?? ((index) => t("table.selectRow", { index: index + 1 }));
|
|
3469
|
+
const selectRowAriaLabel = selectRowAriaLabelProp ?? ((index, _row) => t("table.selectRow", { index: index + 1 }));
|
|
3390
3470
|
const toGlobalIndex = (rowIndex) => rowIndex + rowIndexOffset;
|
|
3391
3471
|
const wrapperClassName = cn(
|
|
3392
3472
|
"table_wrapper",
|
|
@@ -3556,7 +3636,7 @@ var Table = ({
|
|
|
3556
3636
|
children: /* @__PURE__ */ jsx(
|
|
3557
3637
|
Checkbox,
|
|
3558
3638
|
{
|
|
3559
|
-
"aria-label": selectRowAriaLabel(toGlobalIndex(rowIndex)),
|
|
3639
|
+
"aria-label": selectRowAriaLabel(toGlobalIndex(rowIndex), item),
|
|
3560
3640
|
checked: isSelected,
|
|
3561
3641
|
onChange: () => handleToggleRow(rowIdentity)
|
|
3562
3642
|
}
|
|
@@ -4202,29 +4282,38 @@ var ToastItemComponent = ({ item, onRemove, closeAriaLabel }) => {
|
|
|
4202
4282
|
React20.useEffect(() => {
|
|
4203
4283
|
if (item.dismissing) close();
|
|
4204
4284
|
}, [item.dismissing, close]);
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
className: "
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4285
|
+
const autoDismisses = Number.isFinite(item.duration);
|
|
4286
|
+
const liveRole = item.variant === "error" ? "alert" : "status";
|
|
4287
|
+
return /* @__PURE__ */ jsxs(animated.div, { ref: rootRef, className: "toast_item", style, children: [
|
|
4288
|
+
/* @__PURE__ */ jsxs("div", { className: "toast_live", role: liveRole, children: [
|
|
4289
|
+
/* @__PURE__ */ jsx("span", { className: `toast_icon toast_icon_${item.variant}`, "aria-hidden": "true", children: VARIANT_ICONS[item.variant] }),
|
|
4290
|
+
/* @__PURE__ */ jsx("span", { className: "toast_message", children: item.message })
|
|
4291
|
+
] }, liveRole),
|
|
4292
|
+
item.action && /* @__PURE__ */ jsx(
|
|
4293
|
+
"button",
|
|
4294
|
+
{
|
|
4295
|
+
type: "button",
|
|
4296
|
+
className: "toast_action",
|
|
4297
|
+
onClick: () => {
|
|
4298
|
+
if (closingRef.current) return;
|
|
4299
|
+
item.action?.onClick();
|
|
4300
|
+
close();
|
|
4301
|
+
},
|
|
4302
|
+
children: item.action.label
|
|
4303
|
+
}
|
|
4304
|
+
),
|
|
4305
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "toast_close", onClick: close, "aria-label": closeAriaLabel, children: /* @__PURE__ */ jsx(X, { size: iconSize.xs }) }),
|
|
4306
|
+
autoDismisses && /* @__PURE__ */ jsx(
|
|
4307
|
+
"div",
|
|
4308
|
+
{
|
|
4309
|
+
className: `toast_progress toast_progress_${item.variant}`,
|
|
4310
|
+
style: { "--toast-duration": `${item.duration}ms` },
|
|
4311
|
+
onAnimationEnd: close,
|
|
4312
|
+
"aria-hidden": "true"
|
|
4313
|
+
},
|
|
4314
|
+
item.duration
|
|
4315
|
+
)
|
|
4316
|
+
] });
|
|
4228
4317
|
};
|
|
4229
4318
|
var toastSeq = 0;
|
|
4230
4319
|
var ToastProvider = ({
|
|
@@ -4239,22 +4328,47 @@ var ToastProvider = ({
|
|
|
4239
4328
|
const [toasts, setToasts] = React20.useState([]);
|
|
4240
4329
|
const isMounted = useIsMounted();
|
|
4241
4330
|
const addToast = React20.useCallback(
|
|
4242
|
-
(message, variant,
|
|
4243
|
-
|
|
4331
|
+
(message, variant, options = {}) => {
|
|
4332
|
+
const { duration = 3e3, action } = options;
|
|
4244
4333
|
const id = `toast_${++toastSeq}`;
|
|
4334
|
+
if (maxCount <= 0) return id;
|
|
4245
4335
|
setToasts((prev) => {
|
|
4246
|
-
const next = [{ id, message, variant, duration }, ...prev];
|
|
4336
|
+
const next = [{ id, message, variant, duration, action }, ...prev];
|
|
4247
4337
|
return next.map(
|
|
4248
4338
|
(toast, index) => index >= maxCount && !toast.dismissing ? { ...toast, dismissing: true } : toast
|
|
4249
4339
|
);
|
|
4250
4340
|
});
|
|
4341
|
+
return id;
|
|
4251
4342
|
},
|
|
4252
4343
|
[maxCount]
|
|
4253
4344
|
);
|
|
4345
|
+
const dismissToast = React20.useCallback((id) => {
|
|
4346
|
+
setToasts(
|
|
4347
|
+
(prev) => prev.map(
|
|
4348
|
+
(toast) => toast.id === id && !toast.dismissing ? { ...toast, dismissing: true } : toast
|
|
4349
|
+
)
|
|
4350
|
+
);
|
|
4351
|
+
}, []);
|
|
4352
|
+
const updateToast = React20.useCallback((id, patch) => {
|
|
4353
|
+
setToasts(
|
|
4354
|
+
(prev) => prev.map((toast) => {
|
|
4355
|
+
if (toast.id !== id || toast.dismissing) return toast;
|
|
4356
|
+
const { action, ...rest } = patch;
|
|
4357
|
+
return {
|
|
4358
|
+
...toast,
|
|
4359
|
+
...rest,
|
|
4360
|
+
action: action === null ? void 0 : action ?? toast.action
|
|
4361
|
+
};
|
|
4362
|
+
})
|
|
4363
|
+
);
|
|
4364
|
+
}, []);
|
|
4254
4365
|
const removeToast = React20.useCallback((id) => {
|
|
4255
4366
|
setToasts((prev) => prev.filter((t2) => t2.id !== id));
|
|
4256
4367
|
}, []);
|
|
4257
|
-
const contextValue = React20.useMemo(
|
|
4368
|
+
const contextValue = React20.useMemo(
|
|
4369
|
+
() => ({ addToast, dismissToast, updateToast }),
|
|
4370
|
+
[addToast, dismissToast, updateToast]
|
|
4371
|
+
);
|
|
4258
4372
|
return /* @__PURE__ */ jsxs(ToastContext.Provider, { value: contextValue, children: [
|
|
4259
4373
|
children,
|
|
4260
4374
|
isMounted && createPortal(
|
|
@@ -4282,6 +4396,7 @@ var ToastProvider = ({
|
|
|
4282
4396
|
)
|
|
4283
4397
|
] });
|
|
4284
4398
|
};
|
|
4399
|
+
var toOptions = (durationOrOptions) => typeof durationOrOptions === "number" ? { duration: durationOrOptions } : durationOrOptions;
|
|
4285
4400
|
var useToast = () => {
|
|
4286
4401
|
const ctx = useContext(ToastContext);
|
|
4287
4402
|
if (!ctx) {
|
|
@@ -4290,16 +4405,20 @@ var useToast = () => {
|
|
|
4290
4405
|
);
|
|
4291
4406
|
}
|
|
4292
4407
|
return {
|
|
4293
|
-
/** 성공 메시지를
|
|
4294
|
-
success: (message,
|
|
4408
|
+
/** 성공 메시지를 표시한다. 두 번째 인자는 ms 또는 `{ duration, action }` */
|
|
4409
|
+
success: (message, options) => ctx.addToast(message, "success", toOptions(options)),
|
|
4295
4410
|
/** 오류 메시지를 표시한다 */
|
|
4296
|
-
error: (message,
|
|
4411
|
+
error: (message, options) => ctx.addToast(message, "error", toOptions(options)),
|
|
4297
4412
|
/** 경고 메시지를 표시한다 */
|
|
4298
|
-
warning: (message,
|
|
4413
|
+
warning: (message, options) => ctx.addToast(message, "warning", toOptions(options)),
|
|
4299
4414
|
/** 정보 메시지를 표시한다 */
|
|
4300
|
-
info: (message,
|
|
4415
|
+
info: (message, options) => ctx.addToast(message, "info", toOptions(options)),
|
|
4301
4416
|
/** 기본 메시지를 표시한다 */
|
|
4302
|
-
message: (message,
|
|
4417
|
+
message: (message, options) => ctx.addToast(message, "default", toOptions(options)),
|
|
4418
|
+
/** id 의 토스트를 닫는다 - 닫기 버튼과 같은 퇴출 모션 */
|
|
4419
|
+
dismiss: ctx.dismissToast,
|
|
4420
|
+
/** id 의 토스트 내용을 바꾼다 - "업로드 중…" 을 "완료" 로 */
|
|
4421
|
+
update: ctx.updateToast
|
|
4303
4422
|
};
|
|
4304
4423
|
};
|
|
4305
4424
|
var TopLoading = ({
|
|
@@ -4394,6 +4513,9 @@ var Combobox = ({
|
|
|
4394
4513
|
});
|
|
4395
4514
|
const { isOpen, setIsOpen, close, activeIndex, setActiveIndex } = popup;
|
|
4396
4515
|
closeRef.current = close;
|
|
4516
|
+
useEffect(() => {
|
|
4517
|
+
if (!isOpen) setQuery("");
|
|
4518
|
+
}, [isOpen]);
|
|
4397
4519
|
const onSearchRef = useRef(onSearch);
|
|
4398
4520
|
useEffect(() => {
|
|
4399
4521
|
onSearchRef.current = onSearch;
|
|
@@ -4626,8 +4748,6 @@ var Dropdown = (props) => {
|
|
|
4626
4748
|
closePanel();
|
|
4627
4749
|
}
|
|
4628
4750
|
},
|
|
4629
|
-
// closePanel 은 아래 훅에서 오므로 선언 순서상 참조만 한다 (렌더마다 동일 참조).
|
|
4630
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies: closePanel 은 훅 결과라 아래에서 정의된다
|
|
4631
4751
|
[multiple, toggleMultiple, selectSingle]
|
|
4632
4752
|
);
|
|
4633
4753
|
const {
|
|
@@ -4794,7 +4914,7 @@ var Dropdown = (props) => {
|
|
|
4794
4914
|
children: visibleOptions.length === 0 ? searchable && /* @__PURE__ */ jsx("div", { className: "dropdown_empty", children: emptyText }) : visibleOptions.map((opt, i) => {
|
|
4795
4915
|
const selected = selectedValues.includes(opt.value);
|
|
4796
4916
|
const active = i === activeIndex;
|
|
4797
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4917
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
4798
4918
|
/* @__PURE__ */ jsxs(
|
|
4799
4919
|
"div",
|
|
4800
4920
|
{
|
|
@@ -6355,6 +6475,7 @@ var Drawer = ({
|
|
|
6355
6475
|
showCloseIcon = true,
|
|
6356
6476
|
closeLabel: closeLabelProp,
|
|
6357
6477
|
ariaLabel,
|
|
6478
|
+
initialFocusRef,
|
|
6358
6479
|
onExited,
|
|
6359
6480
|
children,
|
|
6360
6481
|
className,
|
|
@@ -6374,7 +6495,10 @@ var Drawer = ({
|
|
|
6374
6495
|
const [shouldRender, setShouldRender] = React20.useState(open);
|
|
6375
6496
|
const reduced = useReducedMotion();
|
|
6376
6497
|
const isMounted = useIsMounted();
|
|
6377
|
-
useFocusTrap(panelRef, open && isMounted, {
|
|
6498
|
+
useFocusTrap(panelRef, open && isMounted, {
|
|
6499
|
+
preferWithin: bodyRef,
|
|
6500
|
+
initialFocus: initialFocusRef
|
|
6501
|
+
});
|
|
6378
6502
|
useOverlayEscape(open && isMounted, () => {
|
|
6379
6503
|
if (escapeDismissible) onClose?.();
|
|
6380
6504
|
});
|
|
@@ -6445,7 +6569,16 @@ var Drawer = ({
|
|
|
6445
6569
|
content.children && // 본문이 스크롤 컨테이너라 키보드로도 스크롤할 수 있어야 한다(axe
|
|
6446
6570
|
// `scrollable-region-focusable`). 다만 초기 포커스 대상에서는 제외한다 - 안쪽에
|
|
6447
6571
|
// 첫 입력이 있는데 빈 wrapper 에 포커스가 놓이면 열자마자 어디에 있는지 알 수 없다.
|
|
6448
|
-
/* @__PURE__ */ jsx(
|
|
6572
|
+
/* @__PURE__ */ jsx(
|
|
6573
|
+
"div",
|
|
6574
|
+
{
|
|
6575
|
+
ref: bodyRef,
|
|
6576
|
+
className: "drawer_body",
|
|
6577
|
+
tabIndex: 0,
|
|
6578
|
+
"data-focus-trap-skip-autofocus": "",
|
|
6579
|
+
children: content.children
|
|
6580
|
+
}
|
|
6581
|
+
),
|
|
6449
6582
|
content.footer && /* @__PURE__ */ jsx("div", { className: "drawer_footer", children: content.footer })
|
|
6450
6583
|
]
|
|
6451
6584
|
}
|
|
@@ -6471,6 +6604,7 @@ var Modal = ({
|
|
|
6471
6604
|
children,
|
|
6472
6605
|
className,
|
|
6473
6606
|
ariaLabel,
|
|
6607
|
+
initialFocusRef,
|
|
6474
6608
|
onExited,
|
|
6475
6609
|
...props
|
|
6476
6610
|
}) => {
|
|
@@ -6487,7 +6621,10 @@ var Modal = ({
|
|
|
6487
6621
|
const titleId = React20.useId();
|
|
6488
6622
|
const [shouldRender, setShouldRender] = React20.useState(open);
|
|
6489
6623
|
const isMounted = useIsMounted();
|
|
6490
|
-
useFocusTrap(panelRef, open && isMounted, {
|
|
6624
|
+
useFocusTrap(panelRef, open && isMounted, {
|
|
6625
|
+
preferWithin: bodyRef,
|
|
6626
|
+
initialFocus: initialFocusRef
|
|
6627
|
+
});
|
|
6491
6628
|
useOverlayEscape(open && isMounted, () => {
|
|
6492
6629
|
if (escapeDismissible) onClose?.();
|
|
6493
6630
|
});
|
|
@@ -6794,4 +6931,4 @@ var Stack = ({
|
|
|
6794
6931
|
);
|
|
6795
6932
|
};
|
|
6796
6933
|
|
|
6797
|
-
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, 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 };
|
|
6934
|
+
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 };
|