@bigtablet/design-system 3.14.2 → 3.15.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 +12 -5
- package/dist/index.d.ts +5 -0
- package/dist/index.js +216 -300
- package/dist/styles/spacing/_index.scss +6 -0
- package/dist/styles/typography/_index.scss +3 -0
- package/dist/vanilla/bigtablet.min.js +6 -6
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import './index.css';
|
|
3
|
-
import * as
|
|
3
|
+
import * as React11 from 'react';
|
|
4
4
|
import { createContext, useRef, useState, useId, useEffect, useContext, useCallback, useMemo, Fragment, useImperativeHandle, useLayoutEffect } from 'react';
|
|
5
5
|
import { useSpring, animated } from '@react-spring/web';
|
|
6
6
|
import { ChevronDown, ChevronRight, Globe, ChevronLeft, ArrowUp, ArrowDown, ArrowUpDown, XCircle, AlertTriangle, CheckCircle2, Info, Bell, Search, Check, Image, X, EyeOff, Eye, TriangleAlert } from 'lucide-react';
|
|
@@ -58,11 +58,11 @@ function registerOverlay(onEscape) {
|
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
function useOverlayEscape(active, onEscape) {
|
|
61
|
-
const handlerRef =
|
|
62
|
-
|
|
61
|
+
const handlerRef = React11.useRef(onEscape);
|
|
62
|
+
React11.useEffect(() => {
|
|
63
63
|
handlerRef.current = onEscape;
|
|
64
64
|
});
|
|
65
|
-
|
|
65
|
+
React11.useEffect(() => {
|
|
66
66
|
if (!active) return;
|
|
67
67
|
return registerOverlay(() => handlerRef.current());
|
|
68
68
|
}, [active]);
|
|
@@ -75,14 +75,22 @@ var PREV_GUTTER = "originalScrollbarGutter";
|
|
|
75
75
|
var PREV_PADDING_RIGHT = "originalPaddingRight";
|
|
76
76
|
var PREV_SCROLLBAR_WIDTH_VAR = "originalScrollbarWidthVar";
|
|
77
77
|
var SCROLLBAR_WIDTH_VAR = "--bt-scrollbar-width";
|
|
78
|
-
var
|
|
78
|
+
var measureViewportInset = () => {
|
|
79
|
+
const probe = document.createElement("div");
|
|
80
|
+
probe.style.cssText = "position:fixed;top:0;left:0;right:0;height:0;visibility:hidden;pointer-events:none";
|
|
81
|
+
document.documentElement.appendChild(probe);
|
|
82
|
+
const width = probe.getBoundingClientRect().width;
|
|
83
|
+
probe.remove();
|
|
84
|
+
if (width <= 0) return 0;
|
|
85
|
+
return Math.max(0, window.innerWidth - width);
|
|
86
|
+
};
|
|
79
87
|
function lockBodyScroll() {
|
|
80
88
|
if (typeof document === "undefined") return;
|
|
81
89
|
const body = document.body;
|
|
82
90
|
const html = document.documentElement;
|
|
83
91
|
const open = Number.parseInt(body.dataset[COUNTER] || "0", 10);
|
|
84
92
|
if (open === 0) {
|
|
85
|
-
const scrollbarWidth =
|
|
93
|
+
const scrollbarWidth = measureViewportInset();
|
|
86
94
|
body.dataset[PREV_OVERFLOW] = body.style.overflow;
|
|
87
95
|
body.dataset[PREV_GUTTER] = html.style.scrollbarGutter;
|
|
88
96
|
body.dataset[PREV_PADDING_RIGHT] = body.style.paddingRight;
|
|
@@ -203,7 +211,7 @@ function useAnchoredPosition({
|
|
|
203
211
|
gap,
|
|
204
212
|
padding
|
|
205
213
|
}) {
|
|
206
|
-
const [state, setState] =
|
|
214
|
+
const [state, setState] = React11.useState({
|
|
207
215
|
x: 0,
|
|
208
216
|
y: 0,
|
|
209
217
|
placement,
|
|
@@ -262,8 +270,8 @@ var FOCUSABLE_SELECTORS = [
|
|
|
262
270
|
'[tabindex]:not([tabindex="-1"])'
|
|
263
271
|
].join(", ");
|
|
264
272
|
function useFocusTrap(containerRef, isActive) {
|
|
265
|
-
const previousActiveElement =
|
|
266
|
-
|
|
273
|
+
const previousActiveElement = React11.useRef(null);
|
|
274
|
+
React11.useEffect(() => {
|
|
267
275
|
if (!isActive) return;
|
|
268
276
|
const container = containerRef.current;
|
|
269
277
|
if (!container) return;
|
|
@@ -313,8 +321,8 @@ function useFocusTrap(containerRef, isActive) {
|
|
|
313
321
|
}, [isActive, containerRef]);
|
|
314
322
|
}
|
|
315
323
|
function useIsMounted() {
|
|
316
|
-
const [mounted, setMounted] =
|
|
317
|
-
|
|
324
|
+
const [mounted, setMounted] = React11.useState(false);
|
|
325
|
+
React11.useEffect(() => {
|
|
318
326
|
setMounted(true);
|
|
319
327
|
}, []);
|
|
320
328
|
return mounted;
|
|
@@ -348,13 +356,13 @@ function getServerSnapshot() {
|
|
|
348
356
|
return false;
|
|
349
357
|
}
|
|
350
358
|
function useReducedMotion() {
|
|
351
|
-
return
|
|
359
|
+
return React11.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
352
360
|
}
|
|
353
361
|
function useSpringHover({
|
|
354
362
|
scale = 1.02,
|
|
355
363
|
lift = -2
|
|
356
364
|
} = {}) {
|
|
357
|
-
const [hovered, setHovered] =
|
|
365
|
+
const [hovered, setHovered] = React11.useState(false);
|
|
358
366
|
const reduced = useReducedMotion();
|
|
359
367
|
const style = useSpring({
|
|
360
368
|
transform: hovered ? `translateY(${lift}px) scale(${scale})` : "translateY(0px) scale(1)",
|
|
@@ -421,9 +429,9 @@ var Accordion = ({
|
|
|
421
429
|
...props
|
|
422
430
|
}) => {
|
|
423
431
|
const isControlled = controlledKeys !== void 0;
|
|
424
|
-
const [internalKeys, setInternalKeys] =
|
|
432
|
+
const [internalKeys, setInternalKeys] = React11.useState(defaultOpenKeys);
|
|
425
433
|
const open = isControlled ? controlledKeys ?? [] : internalKeys;
|
|
426
|
-
const idPrefix =
|
|
434
|
+
const idPrefix = React11.useId();
|
|
427
435
|
const toggle = (key) => {
|
|
428
436
|
const isOpen = open.includes(key);
|
|
429
437
|
const next = isOpen ? open.filter((k) => k !== key) : multiple ? [...open, key] : [key];
|
|
@@ -489,7 +497,7 @@ var Avatar = ({
|
|
|
489
497
|
style,
|
|
490
498
|
...props
|
|
491
499
|
}) => {
|
|
492
|
-
const [imgFailed, setImgFailed] =
|
|
500
|
+
const [imgFailed, setImgFailed] = React11.useState(false);
|
|
493
501
|
const showImage = src && !imgFailed;
|
|
494
502
|
const initials = getInitials(name);
|
|
495
503
|
return /* @__PURE__ */ jsx(
|
|
@@ -503,15 +511,7 @@ var Avatar = ({
|
|
|
503
511
|
...props,
|
|
504
512
|
children: showImage ? (
|
|
505
513
|
// biome-ignore lint/performance/noImgElement: DS is framework-agnostic - consumers wrap with next/image
|
|
506
|
-
/* @__PURE__ */ jsx(
|
|
507
|
-
"img",
|
|
508
|
-
{
|
|
509
|
-
src,
|
|
510
|
-
alt: name,
|
|
511
|
-
onError: () => setImgFailed(true),
|
|
512
|
-
className: "avatar_image"
|
|
513
|
-
}
|
|
514
|
-
)
|
|
514
|
+
/* @__PURE__ */ jsx("img", { src, alt: name, onError: () => setImgFailed(true), className: "avatar_image" })
|
|
515
515
|
) : /* @__PURE__ */ jsx("span", { className: "avatar_initials", "aria-hidden": "true", children: initials })
|
|
516
516
|
}
|
|
517
517
|
);
|
|
@@ -614,27 +614,10 @@ var BottomNav = ({
|
|
|
614
614
|
children,
|
|
615
615
|
...props
|
|
616
616
|
}) => {
|
|
617
|
-
return /* @__PURE__ */ jsx(
|
|
618
|
-
"nav",
|
|
619
|
-
{
|
|
620
|
-
className: cn("bottom_nav", className),
|
|
621
|
-
"aria-label": ariaLabel,
|
|
622
|
-
...props,
|
|
623
|
-
children
|
|
624
|
-
}
|
|
625
|
-
);
|
|
617
|
+
return /* @__PURE__ */ jsx("nav", { className: cn("bottom_nav", className), "aria-label": ariaLabel, ...props, children });
|
|
626
618
|
};
|
|
627
619
|
var BottomNavItem = (props) => {
|
|
628
|
-
const {
|
|
629
|
-
icon,
|
|
630
|
-
label,
|
|
631
|
-
active,
|
|
632
|
-
badge,
|
|
633
|
-
as = "button",
|
|
634
|
-
className,
|
|
635
|
-
disabled,
|
|
636
|
-
...rest
|
|
637
|
-
} = props;
|
|
620
|
+
const { icon, label, active, badge, as = "button", className, disabled, ...rest } = props;
|
|
638
621
|
const classes = cn(
|
|
639
622
|
"bottom_nav_item",
|
|
640
623
|
active && "bottom_nav_item_active",
|
|
@@ -651,27 +634,24 @@ var BottomNavItem = (props) => {
|
|
|
651
634
|
] });
|
|
652
635
|
if (as === "a") {
|
|
653
636
|
const { href, onClick: onClick2, ...anchorRest } = rest;
|
|
654
|
-
return (
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
children: content
|
|
673
|
-
}
|
|
674
|
-
)
|
|
637
|
+
return /* @__PURE__ */ jsx(
|
|
638
|
+
"a",
|
|
639
|
+
{
|
|
640
|
+
className: classes,
|
|
641
|
+
href,
|
|
642
|
+
"aria-current": ariaCurrent,
|
|
643
|
+
"aria-disabled": disabled ? "true" : void 0,
|
|
644
|
+
tabIndex: disabled ? -1 : void 0,
|
|
645
|
+
onClick: (e) => {
|
|
646
|
+
if (disabled) {
|
|
647
|
+
e.preventDefault();
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
onClick2?.(e);
|
|
651
|
+
},
|
|
652
|
+
...anchorRest,
|
|
653
|
+
children: content
|
|
654
|
+
}
|
|
675
655
|
);
|
|
676
656
|
}
|
|
677
657
|
const { type, onClick, ...buttonRest } = rest;
|
|
@@ -704,30 +684,19 @@ var Breadcrumb = ({
|
|
|
704
684
|
return (
|
|
705
685
|
// biome-ignore lint/suspicious/noArrayIndexKey: breadcrumb items have stable order
|
|
706
686
|
/* @__PURE__ */ jsxs("li", { className: "breadcrumb_item", children: [
|
|
707
|
-
isLast ? /* @__PURE__ */ jsx("span", { className: "breadcrumb_current", "aria-current": "page", children: item.label }) : item.href ? (
|
|
708
|
-
// biome-ignore lint/a11y/useValidAnchor: navigation link
|
|
709
|
-
/* @__PURE__ */ jsx("a", { className: "breadcrumb_link", href: item.href, onClick: item.onClick, children: item.label })
|
|
710
|
-
) : /* @__PURE__ */ jsx(
|
|
711
|
-
"button",
|
|
712
|
-
{
|
|
713
|
-
type: "button",
|
|
714
|
-
className: "breadcrumb_link",
|
|
715
|
-
onClick: item.onClick,
|
|
716
|
-
children: item.label
|
|
717
|
-
}
|
|
718
|
-
),
|
|
687
|
+
isLast ? /* @__PURE__ */ jsx("span", { className: "breadcrumb_current", "aria-current": "page", children: item.label }) : item.href ? /* @__PURE__ */ jsx("a", { className: "breadcrumb_link", href: item.href, onClick: item.onClick, children: item.label }) : /* @__PURE__ */ jsx("button", { type: "button", className: "breadcrumb_link", onClick: item.onClick, children: item.label }),
|
|
719
688
|
!isLast && /* @__PURE__ */ jsx("span", { className: "breadcrumb_separator", "aria-hidden": "true", children: sep })
|
|
720
689
|
] }, idx)
|
|
721
690
|
);
|
|
722
691
|
}) }) });
|
|
723
692
|
};
|
|
724
693
|
var Menu = ({ items, trigger, align = "start" }) => {
|
|
725
|
-
const [open, setOpen] =
|
|
726
|
-
const wrapperRef =
|
|
727
|
-
const itemRefs =
|
|
728
|
-
const menuId =
|
|
694
|
+
const [open, setOpen] = React11.useState(false);
|
|
695
|
+
const wrapperRef = React11.useRef(null);
|
|
696
|
+
const itemRefs = React11.useRef([]);
|
|
697
|
+
const menuId = React11.useId();
|
|
729
698
|
const style = useSpringPresence({ visible: open, from: "translateY(-4px)" });
|
|
730
|
-
|
|
699
|
+
React11.useEffect(() => {
|
|
731
700
|
if (!open) return;
|
|
732
701
|
const handleClick = (e) => {
|
|
733
702
|
if (!wrapperRef.current?.contains(e.target)) setOpen(false);
|
|
@@ -742,7 +711,7 @@ var Menu = ({ items, trigger, align = "start" }) => {
|
|
|
742
711
|
document.removeEventListener("keydown", handleEsc);
|
|
743
712
|
};
|
|
744
713
|
}, [open]);
|
|
745
|
-
|
|
714
|
+
React11.useEffect(() => {
|
|
746
715
|
const active = document.activeElement;
|
|
747
716
|
if (!open || active && itemRefs.current.includes(active)) return;
|
|
748
717
|
const first = items.findIndex((it) => !it.disabled);
|
|
@@ -788,7 +757,7 @@ var Menu = ({ items, trigger, align = "start" }) => {
|
|
|
788
757
|
break;
|
|
789
758
|
}
|
|
790
759
|
};
|
|
791
|
-
const triggerWithProps =
|
|
760
|
+
const triggerWithProps = React11.cloneElement(
|
|
792
761
|
trigger,
|
|
793
762
|
{
|
|
794
763
|
onClick: () => setOpen((o) => !o),
|
|
@@ -905,10 +874,7 @@ var NavBar = ({
|
|
|
905
874
|
"span",
|
|
906
875
|
{
|
|
907
876
|
"aria-hidden": "true",
|
|
908
|
-
className: cn(
|
|
909
|
-
"nav_bar_indicator",
|
|
910
|
-
hasMounted && "nav_bar_indicator_animated"
|
|
911
|
-
),
|
|
877
|
+
className: cn("nav_bar_indicator", hasMounted && "nav_bar_indicator_animated"),
|
|
912
878
|
style: { left: indicator.left, width: indicator.width }
|
|
913
879
|
}
|
|
914
880
|
)
|
|
@@ -1009,58 +975,39 @@ var LocaleSwitcher = ({ locale }) => {
|
|
|
1009
975
|
children: [
|
|
1010
976
|
/* @__PURE__ */ jsx(Globe, { size: iconSize.sm, "aria-hidden": "true" }),
|
|
1011
977
|
!locale.hideLabel && /* @__PURE__ */ jsx("span", { className: "nav_bar_locale_label", children: currentLabel }),
|
|
1012
|
-
/* @__PURE__ */ jsx(
|
|
1013
|
-
ChevronDown,
|
|
1014
|
-
{
|
|
1015
|
-
size: iconSize.xs,
|
|
1016
|
-
"aria-hidden": "true",
|
|
1017
|
-
className: "nav_bar_locale_chevron"
|
|
1018
|
-
}
|
|
1019
|
-
)
|
|
978
|
+
/* @__PURE__ */ jsx(ChevronDown, { size: iconSize.xs, "aria-hidden": "true", className: "nav_bar_locale_chevron" })
|
|
1020
979
|
]
|
|
1021
980
|
}
|
|
1022
981
|
),
|
|
1023
|
-
open && /* @__PURE__ */ jsx(
|
|
1024
|
-
"
|
|
982
|
+
open && /* @__PURE__ */ jsx("ul", { id: menuId, role: "menu", className: "nav_bar_locale_menu", onKeyDown: handleMenuKeyDown, children: locale.options.map((opt, index) => /* @__PURE__ */ jsx("li", { role: "none", children: /* @__PURE__ */ jsx(
|
|
983
|
+
"button",
|
|
1025
984
|
{
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
tabIndex: -1,
|
|
1040
|
-
className: cn(
|
|
1041
|
-
"nav_bar_locale_item",
|
|
1042
|
-
opt.value === locale.current && "nav_bar_locale_item_active"
|
|
1043
|
-
),
|
|
1044
|
-
onClick: () => handleSelect(opt.value),
|
|
1045
|
-
children: opt.label
|
|
1046
|
-
}
|
|
1047
|
-
) }, opt.value))
|
|
985
|
+
ref: (el) => {
|
|
986
|
+
itemRefs.current[index] = el;
|
|
987
|
+
},
|
|
988
|
+
type: "button",
|
|
989
|
+
role: "menuitemradio",
|
|
990
|
+
"aria-checked": opt.value === locale.current,
|
|
991
|
+
tabIndex: -1,
|
|
992
|
+
className: cn(
|
|
993
|
+
"nav_bar_locale_item",
|
|
994
|
+
opt.value === locale.current && "nav_bar_locale_item_active"
|
|
995
|
+
),
|
|
996
|
+
onClick: () => handleSelect(opt.value),
|
|
997
|
+
children: opt.label
|
|
1048
998
|
}
|
|
1049
|
-
)
|
|
999
|
+
) }, opt.value)) })
|
|
1050
1000
|
] });
|
|
1051
1001
|
};
|
|
1052
1002
|
var NavLink = ({ active, className, children, ...props }) => {
|
|
1053
|
-
return (
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
"
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
children
|
|
1062
|
-
}
|
|
1063
|
-
)
|
|
1003
|
+
return /* @__PURE__ */ jsx(
|
|
1004
|
+
"a",
|
|
1005
|
+
{
|
|
1006
|
+
className: cn("nav_bar_link", active && "nav_bar_link_active"),
|
|
1007
|
+
"aria-current": active ? "page" : void 0,
|
|
1008
|
+
...props,
|
|
1009
|
+
children
|
|
1010
|
+
}
|
|
1064
1011
|
);
|
|
1065
1012
|
};
|
|
1066
1013
|
var Sidebar = ({
|
|
@@ -1081,9 +1028,9 @@ var Sidebar = ({
|
|
|
1081
1028
|
...props
|
|
1082
1029
|
}) => {
|
|
1083
1030
|
const isControlled = collapsedProp !== void 0;
|
|
1084
|
-
const [internalCollapsed, setInternalCollapsed] =
|
|
1031
|
+
const [internalCollapsed, setInternalCollapsed] = React11.useState(defaultCollapsed);
|
|
1085
1032
|
const collapsed = isControlled ? collapsedProp : internalCollapsed;
|
|
1086
|
-
const toggle =
|
|
1033
|
+
const toggle = React11.useCallback(() => {
|
|
1087
1034
|
const next = !collapsed;
|
|
1088
1035
|
if (!isControlled) setInternalCollapsed(next);
|
|
1089
1036
|
onCollapsedChange?.(next);
|
|
@@ -1133,22 +1080,10 @@ var SidebarItem = (props) => {
|
|
|
1133
1080
|
] });
|
|
1134
1081
|
if (as === "a") {
|
|
1135
1082
|
const { href, ...anchorRest } = rest;
|
|
1136
|
-
return (
|
|
1137
|
-
// biome-ignore lint/a11y/useValidAnchor: navigation link with optional active state
|
|
1138
|
-
/* @__PURE__ */ jsx("a", { className: classes, href, "aria-current": ariaCurrent, ...anchorRest, children: inner })
|
|
1139
|
-
);
|
|
1083
|
+
return /* @__PURE__ */ jsx("a", { className: classes, href, "aria-current": ariaCurrent, ...anchorRest, children: inner });
|
|
1140
1084
|
}
|
|
1141
1085
|
const { type, ...buttonRest } = rest;
|
|
1142
|
-
return /* @__PURE__ */ jsx(
|
|
1143
|
-
"button",
|
|
1144
|
-
{
|
|
1145
|
-
type: type ?? "button",
|
|
1146
|
-
className: classes,
|
|
1147
|
-
"aria-current": ariaCurrent,
|
|
1148
|
-
...buttonRest,
|
|
1149
|
-
children: inner
|
|
1150
|
-
}
|
|
1151
|
-
);
|
|
1086
|
+
return /* @__PURE__ */ jsx("button", { type: type ?? "button", className: classes, "aria-current": ariaCurrent, ...buttonRest, children: inner });
|
|
1152
1087
|
};
|
|
1153
1088
|
var SidebarSection = ({ label, className, children, ...props }) => {
|
|
1154
1089
|
return /* @__PURE__ */ jsxs("div", { className: cn("sidebar_section", className), ...props, children: [
|
|
@@ -1156,9 +1091,9 @@ var SidebarSection = ({ label, className, children, ...props }) => {
|
|
|
1156
1091
|
children
|
|
1157
1092
|
] });
|
|
1158
1093
|
};
|
|
1159
|
-
var TabsContext =
|
|
1094
|
+
var TabsContext = React11.createContext(null);
|
|
1160
1095
|
function useTabsContext() {
|
|
1161
|
-
const ctx =
|
|
1096
|
+
const ctx = React11.useContext(TabsContext);
|
|
1162
1097
|
if (!ctx) {
|
|
1163
1098
|
throw new Error(
|
|
1164
1099
|
'[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>'
|
|
@@ -1177,18 +1112,18 @@ var Tabs = ({
|
|
|
1177
1112
|
...props
|
|
1178
1113
|
}) => {
|
|
1179
1114
|
const isControlled = controlledValue !== void 0;
|
|
1180
|
-
const [internalValue, setInternalValue] =
|
|
1115
|
+
const [internalValue, setInternalValue] = React11.useState(defaultValue);
|
|
1181
1116
|
const value = isControlled ? controlledValue : internalValue;
|
|
1182
|
-
const setValue =
|
|
1117
|
+
const setValue = React11.useCallback(
|
|
1183
1118
|
(v) => {
|
|
1184
1119
|
if (!isControlled) setInternalValue(v);
|
|
1185
1120
|
onValueChange?.(v);
|
|
1186
1121
|
},
|
|
1187
1122
|
[isControlled, onValueChange]
|
|
1188
1123
|
);
|
|
1189
|
-
const orderRef =
|
|
1190
|
-
const [firstTabValue, setFirstTabValue] =
|
|
1191
|
-
const registerTab =
|
|
1124
|
+
const orderRef = React11.useRef([]);
|
|
1125
|
+
const [firstTabValue, setFirstTabValue] = React11.useState();
|
|
1126
|
+
const registerTab = React11.useCallback((v) => {
|
|
1192
1127
|
if (!orderRef.current.includes(v)) {
|
|
1193
1128
|
orderRef.current = [...orderRef.current, v];
|
|
1194
1129
|
setFirstTabValue(orderRef.current[0]);
|
|
@@ -1198,18 +1133,25 @@ var Tabs = ({
|
|
|
1198
1133
|
setFirstTabValue(orderRef.current[0]);
|
|
1199
1134
|
};
|
|
1200
1135
|
}, []);
|
|
1201
|
-
const idPrefix =
|
|
1202
|
-
const ctx =
|
|
1136
|
+
const idPrefix = React11.useId();
|
|
1137
|
+
const ctx = React11.useMemo(
|
|
1203
1138
|
() => ({ value, setValue, variant, size, idPrefix, registerTab, firstTabValue }),
|
|
1204
1139
|
[value, setValue, variant, size, idPrefix, registerTab, firstTabValue]
|
|
1205
1140
|
);
|
|
1206
|
-
return /* @__PURE__ */ jsx(TabsContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
|
|
1141
|
+
return /* @__PURE__ */ jsx(TabsContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
|
|
1142
|
+
"div",
|
|
1143
|
+
{
|
|
1144
|
+
className: cn("tabs", `tabs_variant_${variant}`, `tabs_size_${size}`, className),
|
|
1145
|
+
...props,
|
|
1146
|
+
children
|
|
1147
|
+
}
|
|
1148
|
+
) });
|
|
1207
1149
|
};
|
|
1208
1150
|
var TabList = ({ ariaLabel, className, children, ...props }) => {
|
|
1209
1151
|
const { variant } = useTabsContext();
|
|
1210
|
-
const listRef =
|
|
1211
|
-
const [indicator, setIndicator] =
|
|
1212
|
-
const [hasMounted, setHasMounted] =
|
|
1152
|
+
const listRef = React11.useRef(null);
|
|
1153
|
+
const [indicator, setIndicator] = React11.useState(null);
|
|
1154
|
+
const [hasMounted, setHasMounted] = React11.useState(false);
|
|
1213
1155
|
useSafeLayoutEffect(() => {
|
|
1214
1156
|
const list = listRef.current;
|
|
1215
1157
|
if (!list) return;
|
|
@@ -1272,7 +1214,7 @@ var Tab = ({ value, className, children, onClick, onKeyDown, ...props }) => {
|
|
|
1272
1214
|
const panelId = `${ctx.idPrefix}-panel-${value}`;
|
|
1273
1215
|
const tabId = `${ctx.idPrefix}-tab-${value}`;
|
|
1274
1216
|
const { registerTab } = ctx;
|
|
1275
|
-
|
|
1217
|
+
React11.useEffect(() => registerTab(value), [registerTab, value]);
|
|
1276
1218
|
const handleClick = (e) => {
|
|
1277
1219
|
ctx.setValue(value);
|
|
1278
1220
|
onClick?.(e);
|
|
@@ -1280,10 +1222,13 @@ var Tab = ({ value, className, children, onClick, onKeyDown, ...props }) => {
|
|
|
1280
1222
|
const handleKeyDown2 = (e) => {
|
|
1281
1223
|
onKeyDown?.(e);
|
|
1282
1224
|
if (e.defaultPrevented) return;
|
|
1283
|
-
if (e.key !== "ArrowLeft" && e.key !== "ArrowRight" && e.key !== "Home" && e.key !== "End")
|
|
1225
|
+
if (e.key !== "ArrowLeft" && e.key !== "ArrowRight" && e.key !== "Home" && e.key !== "End")
|
|
1226
|
+
return;
|
|
1284
1227
|
const list = e.currentTarget.closest('[role="tablist"]');
|
|
1285
1228
|
if (!list) return;
|
|
1286
|
-
const tabs = Array.from(
|
|
1229
|
+
const tabs = Array.from(
|
|
1230
|
+
list.querySelectorAll('[role="tab"]:not([disabled])')
|
|
1231
|
+
);
|
|
1287
1232
|
const currentIndex = tabs.indexOf(e.currentTarget);
|
|
1288
1233
|
if (currentIndex < 0) return;
|
|
1289
1234
|
e.preventDefault();
|
|
@@ -1355,15 +1300,15 @@ var Popover = ({
|
|
|
1355
1300
|
className
|
|
1356
1301
|
}) => {
|
|
1357
1302
|
const isControlled = openProp !== void 0;
|
|
1358
|
-
const [internalOpen, setInternalOpen] =
|
|
1303
|
+
const [internalOpen, setInternalOpen] = React11.useState(defaultOpen);
|
|
1359
1304
|
const open = isControlled ? openProp : internalOpen;
|
|
1360
|
-
const [shouldRender, setShouldRender] =
|
|
1305
|
+
const [shouldRender, setShouldRender] = React11.useState(open ?? false);
|
|
1361
1306
|
if (open && !shouldRender) setShouldRender(true);
|
|
1362
|
-
const wrapperRef =
|
|
1363
|
-
const positionRef =
|
|
1364
|
-
const popoverRef =
|
|
1365
|
-
const popoverId =
|
|
1366
|
-
const setOpen =
|
|
1307
|
+
const wrapperRef = React11.useRef(null);
|
|
1308
|
+
const positionRef = React11.useRef(null);
|
|
1309
|
+
const popoverRef = React11.useRef(null);
|
|
1310
|
+
const popoverId = React11.useId();
|
|
1311
|
+
const setOpen = React11.useCallback(
|
|
1367
1312
|
(next) => {
|
|
1368
1313
|
if (!isControlled) setInternalOpen(next);
|
|
1369
1314
|
onOpenChange?.(next);
|
|
@@ -1396,7 +1341,7 @@ var Popover = ({
|
|
|
1396
1341
|
onExitComplete: () => setShouldRender(false)
|
|
1397
1342
|
});
|
|
1398
1343
|
useFocusTrap(popoverRef, open);
|
|
1399
|
-
|
|
1344
|
+
React11.useEffect(() => {
|
|
1400
1345
|
if (!open) return;
|
|
1401
1346
|
const handleClick = (e) => {
|
|
1402
1347
|
const target = e.target;
|
|
@@ -1410,7 +1355,7 @@ var Popover = ({
|
|
|
1410
1355
|
useOverlayEscape(open, () => {
|
|
1411
1356
|
setOpen(false);
|
|
1412
1357
|
});
|
|
1413
|
-
const triggerWithProps =
|
|
1358
|
+
const triggerWithProps = React11.cloneElement(
|
|
1414
1359
|
trigger,
|
|
1415
1360
|
{
|
|
1416
1361
|
onClick: (e) => {
|
|
@@ -1469,30 +1414,30 @@ var Tooltip = ({
|
|
|
1469
1414
|
disabled = false,
|
|
1470
1415
|
children
|
|
1471
1416
|
}) => {
|
|
1472
|
-
const [open, setOpen] =
|
|
1473
|
-
const [shouldRender, setShouldRender] =
|
|
1417
|
+
const [open, setOpen] = React11.useState(false);
|
|
1418
|
+
const [shouldRender, setShouldRender] = React11.useState(false);
|
|
1474
1419
|
if (open && !shouldRender) setShouldRender(true);
|
|
1475
|
-
const timerRef =
|
|
1476
|
-
const tooltipId =
|
|
1477
|
-
const wrapperRef =
|
|
1478
|
-
const positionRef =
|
|
1420
|
+
const timerRef = React11.useRef(null);
|
|
1421
|
+
const tooltipId = React11.useId();
|
|
1422
|
+
const wrapperRef = React11.useRef(null);
|
|
1423
|
+
const positionRef = React11.useRef(null);
|
|
1479
1424
|
const HIDE_DELAY = 120;
|
|
1480
|
-
const show =
|
|
1425
|
+
const show = React11.useCallback(() => {
|
|
1481
1426
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
1482
1427
|
timerRef.current = setTimeout(() => setOpen(true), delay);
|
|
1483
1428
|
}, [delay]);
|
|
1484
|
-
const hideNow =
|
|
1429
|
+
const hideNow = React11.useCallback(() => {
|
|
1485
1430
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
1486
1431
|
setOpen(false);
|
|
1487
1432
|
}, []);
|
|
1488
|
-
const hide =
|
|
1433
|
+
const hide = React11.useCallback(() => {
|
|
1489
1434
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
1490
1435
|
timerRef.current = setTimeout(() => setOpen(false), HIDE_DELAY);
|
|
1491
1436
|
}, []);
|
|
1492
|
-
const cancelHide =
|
|
1437
|
+
const cancelHide = React11.useCallback(() => {
|
|
1493
1438
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
1494
1439
|
}, []);
|
|
1495
|
-
|
|
1440
|
+
React11.useEffect(() => {
|
|
1496
1441
|
return () => {
|
|
1497
1442
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
1498
1443
|
};
|
|
@@ -1525,7 +1470,7 @@ var Tooltip = ({
|
|
|
1525
1470
|
});
|
|
1526
1471
|
const child = children;
|
|
1527
1472
|
const childProps = child.props;
|
|
1528
|
-
const trigger =
|
|
1473
|
+
const trigger = React11.cloneElement(child, {
|
|
1529
1474
|
onMouseEnter: (e) => {
|
|
1530
1475
|
childProps.onMouseEnter?.(e);
|
|
1531
1476
|
show();
|
|
@@ -1762,13 +1707,17 @@ var spacing = {
|
|
|
1762
1707
|
"4": "4px",
|
|
1763
1708
|
"6": "6px",
|
|
1764
1709
|
"8": "8px",
|
|
1710
|
+
"10": "10px",
|
|
1765
1711
|
"12": "12px",
|
|
1766
1712
|
"16": "16px",
|
|
1767
1713
|
"20": "20px",
|
|
1768
1714
|
"24": "24px",
|
|
1769
1715
|
"32": "32px",
|
|
1770
1716
|
"40": "40px",
|
|
1771
|
-
"48": "48px"
|
|
1717
|
+
"48": "48px",
|
|
1718
|
+
"64": "64px",
|
|
1719
|
+
"96": "96px",
|
|
1720
|
+
"128": "128px"
|
|
1772
1721
|
};
|
|
1773
1722
|
|
|
1774
1723
|
// src/styles/skeleton/index.ts
|
|
@@ -1803,6 +1752,7 @@ var baseTypography = {
|
|
|
1803
1752
|
primary: "Pretendard"
|
|
1804
1753
|
},
|
|
1805
1754
|
fontSize: {
|
|
1755
|
+
"10": "10px",
|
|
1806
1756
|
"12": "12px",
|
|
1807
1757
|
"13": "13px",
|
|
1808
1758
|
"14": "14px",
|
|
@@ -2474,8 +2424,8 @@ var MediaCard = ({
|
|
|
2474
2424
|
] });
|
|
2475
2425
|
};
|
|
2476
2426
|
var Prose = ({ size = "md", className, children, ref, ...props }) => {
|
|
2477
|
-
const rootRef =
|
|
2478
|
-
|
|
2427
|
+
const rootRef = React11.useRef(null);
|
|
2428
|
+
React11.useImperativeHandle(ref, () => rootRef.current, []);
|
|
2479
2429
|
useSafeLayoutEffect(() => {
|
|
2480
2430
|
const root = rootRef.current;
|
|
2481
2431
|
if (!root) return;
|
|
@@ -2531,12 +2481,12 @@ var Checkbox = ({
|
|
|
2531
2481
|
ref,
|
|
2532
2482
|
...props
|
|
2533
2483
|
}) => {
|
|
2534
|
-
const inputRef =
|
|
2535
|
-
|
|
2484
|
+
const inputRef = React11.useRef(null);
|
|
2485
|
+
React11.useImperativeHandle(
|
|
2536
2486
|
ref,
|
|
2537
2487
|
() => inputRef.current
|
|
2538
2488
|
);
|
|
2539
|
-
|
|
2489
|
+
React11.useEffect(() => {
|
|
2540
2490
|
if (!inputRef.current) return;
|
|
2541
2491
|
inputRef.current.indeterminate = Boolean(indeterminate);
|
|
2542
2492
|
}, [indeterminate]);
|
|
@@ -2594,8 +2544,8 @@ var Table = ({
|
|
|
2594
2544
|
const isEmpty = !isLoading && data.length === 0;
|
|
2595
2545
|
const getRowKey = (item, index) => rowKey?.(item) ?? String(index);
|
|
2596
2546
|
const allRowKeys = selectable ? data.map((item, index) => getRowKey(item, index)) : [];
|
|
2597
|
-
const rowClickHintId =
|
|
2598
|
-
const selectedSet =
|
|
2547
|
+
const rowClickHintId = React11.useId();
|
|
2548
|
+
const selectedSet = React11.useMemo(() => new Set(selectedKeys ?? []), [selectedKeys]);
|
|
2599
2549
|
const selectedCount = allRowKeys.filter((key) => selectedSet.has(key)).length;
|
|
2600
2550
|
const isAllSelected = allRowKeys.length > 0 && selectedCount === allRowKeys.length;
|
|
2601
2551
|
const isSomeSelected = selectedCount > 0 && !isAllSelected;
|
|
@@ -2818,9 +2768,9 @@ var AlertModal = ({
|
|
|
2818
2768
|
onClose
|
|
2819
2769
|
}) => {
|
|
2820
2770
|
const dismiss = onCancel ?? onClose;
|
|
2821
|
-
const panelRef =
|
|
2822
|
-
const titleId =
|
|
2823
|
-
const messageId =
|
|
2771
|
+
const panelRef = React11.useRef(null);
|
|
2772
|
+
const titleId = React11.useId();
|
|
2773
|
+
const messageId = React11.useId();
|
|
2824
2774
|
const [shouldRender, setShouldRender] = useState(isOpen);
|
|
2825
2775
|
useFocusTrap(panelRef, isOpen);
|
|
2826
2776
|
useOverlayEscape(isOpen, () => dismiss());
|
|
@@ -2844,7 +2794,7 @@ var AlertModal = ({
|
|
|
2844
2794
|
immediate: reduced,
|
|
2845
2795
|
config: OVERLAY_SPRING_CONFIG
|
|
2846
2796
|
});
|
|
2847
|
-
|
|
2797
|
+
React11.useEffect(() => {
|
|
2848
2798
|
if (!shouldRender) return;
|
|
2849
2799
|
lockBodyScroll();
|
|
2850
2800
|
return unlockBodyScroll;
|
|
@@ -2927,10 +2877,7 @@ var LinearProgress = ({
|
|
|
2927
2877
|
Array.from({ length: dotCount }, (_, i) => /* @__PURE__ */ jsx(
|
|
2928
2878
|
"span",
|
|
2929
2879
|
{
|
|
2930
|
-
className: cn(
|
|
2931
|
-
"linear_progress_step",
|
|
2932
|
-
i <= clampedStep && "linear_progress_step_done"
|
|
2933
|
-
),
|
|
2880
|
+
className: cn("linear_progress_step", i <= clampedStep && "linear_progress_step_done"),
|
|
2934
2881
|
"aria-hidden": "true"
|
|
2935
2882
|
},
|
|
2936
2883
|
i
|
|
@@ -2954,7 +2901,7 @@ var Spinner = ({ size = 24, ariaLabel = "\uB85C\uB529 \uC911" }) => {
|
|
|
2954
2901
|
}
|
|
2955
2902
|
);
|
|
2956
2903
|
};
|
|
2957
|
-
var ToastContext =
|
|
2904
|
+
var ToastContext = React11.createContext(null);
|
|
2958
2905
|
var VARIANT_ICONS = {
|
|
2959
2906
|
success: /* @__PURE__ */ jsx(CheckCircle2, { size: iconSize.md }),
|
|
2960
2907
|
error: /* @__PURE__ */ jsx(XCircle, { size: iconSize.md }),
|
|
@@ -2963,9 +2910,9 @@ var VARIANT_ICONS = {
|
|
|
2963
2910
|
default: /* @__PURE__ */ jsx(Bell, { size: iconSize.md })
|
|
2964
2911
|
};
|
|
2965
2912
|
var ToastItemComponent = ({ item, onRemove, closeAriaLabel }) => {
|
|
2966
|
-
const [visible, setVisible] =
|
|
2967
|
-
const closingRef =
|
|
2968
|
-
const rootRef =
|
|
2913
|
+
const [visible, setVisible] = React11.useState(true);
|
|
2914
|
+
const closingRef = React11.useRef(false);
|
|
2915
|
+
const rootRef = React11.useRef(null);
|
|
2969
2916
|
const style = useSpringPresence({
|
|
2970
2917
|
visible,
|
|
2971
2918
|
from: "translateX(20px)",
|
|
@@ -2985,7 +2932,7 @@ var ToastItemComponent = ({ item, onRemove, closeAriaLabel }) => {
|
|
|
2985
2932
|
onRemove(item.id);
|
|
2986
2933
|
}
|
|
2987
2934
|
});
|
|
2988
|
-
const close =
|
|
2935
|
+
const close = React11.useCallback(() => {
|
|
2989
2936
|
if (closingRef.current) return;
|
|
2990
2937
|
closingRef.current = true;
|
|
2991
2938
|
setVisible(false);
|
|
@@ -3020,19 +2967,19 @@ var ToastProvider = ({
|
|
|
3020
2967
|
closeAriaLabel = "\uB2EB\uAE30",
|
|
3021
2968
|
regionLabel = "\uC54C\uB9BC"
|
|
3022
2969
|
}) => {
|
|
3023
|
-
const [toasts, setToasts] =
|
|
2970
|
+
const [toasts, setToasts] = React11.useState([]);
|
|
3024
2971
|
const isMounted = useIsMounted();
|
|
3025
|
-
const addToast =
|
|
2972
|
+
const addToast = React11.useCallback(
|
|
3026
2973
|
(message, variant, duration = 3e3) => {
|
|
3027
2974
|
const id = crypto.randomUUID();
|
|
3028
2975
|
setToasts((prev) => [{ id, message, variant, duration }, ...prev].slice(0, maxCount));
|
|
3029
2976
|
},
|
|
3030
2977
|
[maxCount]
|
|
3031
2978
|
);
|
|
3032
|
-
const removeToast =
|
|
2979
|
+
const removeToast = React11.useCallback((id) => {
|
|
3033
2980
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
3034
2981
|
}, []);
|
|
3035
|
-
const contextValue =
|
|
2982
|
+
const contextValue = React11.useMemo(() => ({ addToast }), [addToast]);
|
|
3036
2983
|
return /* @__PURE__ */ jsxs(ToastContext.Provider, { value: contextValue, children: [
|
|
3037
2984
|
children,
|
|
3038
2985
|
isMounted && createPortal(
|
|
@@ -3472,9 +3419,9 @@ var DatePicker = ({
|
|
|
3472
3419
|
minDateSrFormat = "\uCD5C\uC18C \uB0A0\uC9DC: {date}",
|
|
3473
3420
|
selectableRangeUntilTodaySrText = "\uC624\uB298\uAE4C\uC9C0 \uC120\uD0DD \uAC00\uB2A5"
|
|
3474
3421
|
}) => {
|
|
3475
|
-
const groupId =
|
|
3476
|
-
const constraintId =
|
|
3477
|
-
const { todayYear, todayMonth, todayDay } =
|
|
3422
|
+
const groupId = React11.useId();
|
|
3423
|
+
const constraintId = React11.useId();
|
|
3424
|
+
const { todayYear, todayMonth, todayDay } = React11.useMemo(() => {
|
|
3478
3425
|
const now = /* @__PURE__ */ new Date();
|
|
3479
3426
|
return {
|
|
3480
3427
|
todayYear: now.getFullYear(),
|
|
@@ -3483,7 +3430,7 @@ var DatePicker = ({
|
|
|
3483
3430
|
};
|
|
3484
3431
|
}, []);
|
|
3485
3432
|
const endYear = endYearProp ?? todayYear + 10;
|
|
3486
|
-
const parsed =
|
|
3433
|
+
const parsed = React11.useMemo(() => {
|
|
3487
3434
|
if (!value) return { year: 0, month: 0, day: 0 };
|
|
3488
3435
|
const [y, m, d] = value.split("-").map(Number);
|
|
3489
3436
|
return {
|
|
@@ -3492,7 +3439,7 @@ var DatePicker = ({
|
|
|
3492
3439
|
day: d || 0
|
|
3493
3440
|
};
|
|
3494
3441
|
}, [value]);
|
|
3495
|
-
const min =
|
|
3442
|
+
const min = React11.useMemo(() => {
|
|
3496
3443
|
if (!minDate) return { year: 0, month: 0, day: 0 };
|
|
3497
3444
|
const [y, m, d] = minDate.split("-").map(Number);
|
|
3498
3445
|
return {
|
|
@@ -3512,7 +3459,7 @@ var DatePicker = ({
|
|
|
3512
3459
|
min.year > 0 && min.month > 0 && year === min.year && month === min.month ? min.day : 1
|
|
3513
3460
|
)
|
|
3514
3461
|
);
|
|
3515
|
-
const maxDay =
|
|
3462
|
+
const maxDay = React11.useMemo(() => {
|
|
3516
3463
|
if (!year || !month) return 31;
|
|
3517
3464
|
const daysInMonth = getDaysInMonth(year, month);
|
|
3518
3465
|
if (selectableRange === "until-today" && year === todayYear && month === todayMonth) {
|
|
@@ -3520,28 +3467,28 @@ var DatePicker = ({
|
|
|
3520
3467
|
}
|
|
3521
3468
|
return daysInMonth;
|
|
3522
3469
|
}, [year, month, selectableRange, todayYear, todayMonth, todayDay]);
|
|
3523
|
-
const yearOptions =
|
|
3470
|
+
const yearOptions = React11.useMemo(
|
|
3524
3471
|
() => range(startYear, maxYear).map((y) => ({
|
|
3525
3472
|
value: String(y),
|
|
3526
3473
|
label: String(y)
|
|
3527
3474
|
})),
|
|
3528
3475
|
[startYear, maxYear]
|
|
3529
3476
|
);
|
|
3530
|
-
const monthOptions =
|
|
3477
|
+
const monthOptions = React11.useMemo(
|
|
3531
3478
|
() => range(minMonth, Math.max(minMonth, maxMonth)).map((m) => ({
|
|
3532
3479
|
value: String(m),
|
|
3533
3480
|
label: pad(m)
|
|
3534
3481
|
})),
|
|
3535
3482
|
[minMonth, maxMonth]
|
|
3536
3483
|
);
|
|
3537
|
-
const dayOptions =
|
|
3484
|
+
const dayOptions = React11.useMemo(
|
|
3538
3485
|
() => range(minDay, Math.max(minDay, maxDay)).map((d) => ({
|
|
3539
3486
|
value: String(d),
|
|
3540
3487
|
label: pad(d)
|
|
3541
3488
|
})),
|
|
3542
3489
|
[minDay, maxDay]
|
|
3543
3490
|
);
|
|
3544
|
-
const emit =
|
|
3491
|
+
const emit = React11.useCallback(
|
|
3545
3492
|
(yy, mm, dd) => {
|
|
3546
3493
|
const cb = onValueChange ?? onChange;
|
|
3547
3494
|
if (mode === "year-month") {
|
|
@@ -3553,7 +3500,7 @@ var DatePicker = ({
|
|
|
3553
3500
|
},
|
|
3554
3501
|
[mode, onValueChange, onChange]
|
|
3555
3502
|
);
|
|
3556
|
-
const handleYearChange =
|
|
3503
|
+
const handleYearChange = React11.useCallback(
|
|
3557
3504
|
(raw) => {
|
|
3558
3505
|
if (!raw) return;
|
|
3559
3506
|
const newYear = Number(raw);
|
|
@@ -3570,14 +3517,14 @@ var DatePicker = ({
|
|
|
3570
3517
|
},
|
|
3571
3518
|
[month, day, min.year, min.month, selectableRange, todayYear, todayMonth, emit]
|
|
3572
3519
|
);
|
|
3573
|
-
const handleMonthChange =
|
|
3520
|
+
const handleMonthChange = React11.useCallback(
|
|
3574
3521
|
(raw) => {
|
|
3575
3522
|
if (!raw || !year) return;
|
|
3576
3523
|
emit(year, Number(raw), day || void 0);
|
|
3577
3524
|
},
|
|
3578
3525
|
[year, day, emit]
|
|
3579
3526
|
);
|
|
3580
|
-
const handleDayChange =
|
|
3527
|
+
const handleDayChange = React11.useCallback(
|
|
3581
3528
|
(raw) => {
|
|
3582
3529
|
if (!raw || !year || !month) return;
|
|
3583
3530
|
emit(year, month, Number(raw));
|
|
@@ -3661,11 +3608,11 @@ var FileInput = ({
|
|
|
3661
3608
|
onChange,
|
|
3662
3609
|
...props
|
|
3663
3610
|
}) => {
|
|
3664
|
-
const inputId =
|
|
3665
|
-
const helperId =
|
|
3666
|
-
const inputRef =
|
|
3667
|
-
const [previewUrls, setPreviewUrls] =
|
|
3668
|
-
const previewUrlsRef =
|
|
3611
|
+
const inputId = React11.useId();
|
|
3612
|
+
const helperId = React11.useId();
|
|
3613
|
+
const inputRef = React11.useRef(null);
|
|
3614
|
+
const [previewUrls, setPreviewUrls] = React11.useState([]);
|
|
3615
|
+
const previewUrlsRef = React11.useRef([]);
|
|
3669
3616
|
const isPreviewVariant = variant === "preview";
|
|
3670
3617
|
const showPreview = isPreviewVariant || preview;
|
|
3671
3618
|
const handleChange = (e) => {
|
|
@@ -3706,7 +3653,7 @@ var FileInput = ({
|
|
|
3706
3653
|
}
|
|
3707
3654
|
onFiles?.(null);
|
|
3708
3655
|
};
|
|
3709
|
-
|
|
3656
|
+
React11.useEffect(() => {
|
|
3710
3657
|
return () => {
|
|
3711
3658
|
for (const url of previewUrlsRef.current) {
|
|
3712
3659
|
URL.revokeObjectURL(url);
|
|
@@ -3744,14 +3691,7 @@ var FileInput = ({
|
|
|
3744
3691
|
style: { width: previewSize, height: previewSize },
|
|
3745
3692
|
children: hasImage ? (
|
|
3746
3693
|
// biome-ignore lint/performance/noImgElement: framework-agnostic DS - host app should swap with next/image if needed
|
|
3747
|
-
/* @__PURE__ */ jsx(
|
|
3748
|
-
"img",
|
|
3749
|
-
{
|
|
3750
|
-
src: previewUrls[0],
|
|
3751
|
-
alt: "",
|
|
3752
|
-
className: "file_input_preview_image"
|
|
3753
|
-
}
|
|
3754
|
-
)
|
|
3694
|
+
/* @__PURE__ */ jsx("img", { src: previewUrls[0], alt: "", className: "file_input_preview_image" })
|
|
3755
3695
|
) : /* @__PURE__ */ jsxs("span", { className: "file_input_preview_empty", children: [
|
|
3756
3696
|
/* @__PURE__ */ jsx(Image, { size: iconSize.xl, "aria-hidden": "true" }),
|
|
3757
3697
|
/* @__PURE__ */ jsx("span", { className: "file_input_preview_empty_text", children: label })
|
|
@@ -3771,15 +3711,7 @@ var FileInput = ({
|
|
|
3771
3711
|
supportingText && /* @__PURE__ */ jsx("span", { id: helperId, className: "file_input_helper", children: supportingText }),
|
|
3772
3712
|
!isPreviewVariant && previewUrls.length > 0 && /* @__PURE__ */ jsx("div", { className: "file_input_preview", children: previewUrls.map((url) => (
|
|
3773
3713
|
// biome-ignore lint/performance/noImgElement: framework-agnostic DS - host app should swap with next/image if needed
|
|
3774
|
-
/* @__PURE__ */ jsx(
|
|
3775
|
-
"img",
|
|
3776
|
-
{
|
|
3777
|
-
src: url,
|
|
3778
|
-
alt: "",
|
|
3779
|
-
className: "file_input_preview_img"
|
|
3780
|
-
},
|
|
3781
|
-
url
|
|
3782
|
-
)
|
|
3714
|
+
/* @__PURE__ */ jsx("img", { src: url, alt: "", className: "file_input_preview_img" }, url)
|
|
3783
3715
|
)) })
|
|
3784
3716
|
] });
|
|
3785
3717
|
};
|
|
@@ -4115,12 +4047,12 @@ var OtpInput = ({
|
|
|
4115
4047
|
ariaLabel = "OTP \uC785\uB825",
|
|
4116
4048
|
className
|
|
4117
4049
|
}) => {
|
|
4118
|
-
const inputsRef =
|
|
4119
|
-
const isTypingRef =
|
|
4120
|
-
|
|
4050
|
+
const inputsRef = React11.useRef([]);
|
|
4051
|
+
const isTypingRef = React11.useRef(false);
|
|
4052
|
+
React11.useEffect(() => {
|
|
4121
4053
|
if (autoFocus) inputsRef.current[0]?.focus();
|
|
4122
4054
|
}, [autoFocus]);
|
|
4123
|
-
const digits =
|
|
4055
|
+
const digits = React11.useMemo(() => {
|
|
4124
4056
|
const chars = value.split("").slice(0, length);
|
|
4125
4057
|
while (chars.length < length) chars.push("");
|
|
4126
4058
|
return chars;
|
|
@@ -4197,7 +4129,7 @@ var OtpInput = ({
|
|
|
4197
4129
|
focusInput(nextIndex);
|
|
4198
4130
|
};
|
|
4199
4131
|
const rootClassName = cn("otp_input", className);
|
|
4200
|
-
const supportingId =
|
|
4132
|
+
const supportingId = React11.useId();
|
|
4201
4133
|
return (
|
|
4202
4134
|
// biome-ignore lint/a11y/useSemanticElements: <fieldset> would force border/legend styles; role=group is the WAI-ARIA equivalent for OTP grouping
|
|
4203
4135
|
/* @__PURE__ */ jsxs("div", { className: rootClassName, role: "group", "aria-label": ariaLabel, children: [
|
|
@@ -4241,9 +4173,9 @@ var OtpInput = ({
|
|
|
4241
4173
|
);
|
|
4242
4174
|
};
|
|
4243
4175
|
OtpInput.displayName = "OtpInput";
|
|
4244
|
-
var RadioGroupContext =
|
|
4176
|
+
var RadioGroupContext = React11.createContext(null);
|
|
4245
4177
|
function useRadioGroupContext() {
|
|
4246
|
-
return
|
|
4178
|
+
return React11.useContext(RadioGroupContext);
|
|
4247
4179
|
}
|
|
4248
4180
|
var RadioGroup = ({
|
|
4249
4181
|
value: controlledValue,
|
|
@@ -4261,21 +4193,21 @@ var RadioGroup = ({
|
|
|
4261
4193
|
...props
|
|
4262
4194
|
}) => {
|
|
4263
4195
|
const isControlled = controlledValue !== void 0;
|
|
4264
|
-
const [internalValue, setInternalValue] =
|
|
4196
|
+
const [internalValue, setInternalValue] = React11.useState(defaultValue);
|
|
4265
4197
|
const value = isControlled ? controlledValue : internalValue;
|
|
4266
|
-
const generatedName =
|
|
4198
|
+
const generatedName = React11.useId();
|
|
4267
4199
|
const name = nameProp ?? generatedName;
|
|
4268
|
-
const idPrefix =
|
|
4200
|
+
const idPrefix = React11.useId();
|
|
4269
4201
|
const labelId = label ? `${idPrefix}-label` : void 0;
|
|
4270
4202
|
const helperId = supportingText ? `${idPrefix}-help` : void 0;
|
|
4271
|
-
const onChange =
|
|
4203
|
+
const onChange = React11.useCallback(
|
|
4272
4204
|
(next) => {
|
|
4273
4205
|
if (!isControlled) setInternalValue(next);
|
|
4274
4206
|
onValueChange?.(next);
|
|
4275
4207
|
},
|
|
4276
4208
|
[isControlled, onValueChange]
|
|
4277
4209
|
);
|
|
4278
|
-
const ctx =
|
|
4210
|
+
const ctx = React11.useMemo(
|
|
4279
4211
|
() => ({ name, value, onChange, size, disabled }),
|
|
4280
4212
|
[name, value, onChange, size, disabled]
|
|
4281
4213
|
);
|
|
@@ -4384,9 +4316,7 @@ var Textarea = ({
|
|
|
4384
4316
|
const helperId = supportingText ? `${inputId}-help` : void 0;
|
|
4385
4317
|
const isControlled = value !== void 0;
|
|
4386
4318
|
const applyTransform = (nextValue) => transformValue ? transformValue(nextValue) : nextValue;
|
|
4387
|
-
const [innerValue, setInnerValue] = useState(
|
|
4388
|
-
() => applyTransform(value ?? defaultValue ?? "")
|
|
4389
|
-
);
|
|
4319
|
+
const [innerValue, setInnerValue] = useState(() => applyTransform(value ?? defaultValue ?? ""));
|
|
4390
4320
|
const isComposingRef = useRef(false);
|
|
4391
4321
|
const innerRef = useRef(null);
|
|
4392
4322
|
const lastEmittedValueRef = useRef(innerValue);
|
|
@@ -4647,7 +4577,7 @@ var Toggle = ({
|
|
|
4647
4577
|
...props
|
|
4648
4578
|
}) => {
|
|
4649
4579
|
const isControlled = checked !== void 0;
|
|
4650
|
-
const [innerChecked, setInnerChecked] =
|
|
4580
|
+
const [innerChecked, setInnerChecked] = React11.useState(!!defaultChecked);
|
|
4651
4581
|
const isOn = isControlled ? !!checked : innerChecked;
|
|
4652
4582
|
const handleToggle = (e) => {
|
|
4653
4583
|
props.onClick?.(e);
|
|
@@ -4737,7 +4667,7 @@ var Pagination = ({
|
|
|
4737
4667
|
const emit = onPageChange ?? onChange;
|
|
4738
4668
|
const prevDisabled = page <= 1;
|
|
4739
4669
|
const nextDisabled = page >= totalPages;
|
|
4740
|
-
const items =
|
|
4670
|
+
const items = React11.useMemo(() => getPaginationItems(page, totalPages), [page, totalPages]);
|
|
4741
4671
|
return /* @__PURE__ */ jsxs("nav", { className: "pagination", "aria-label": navLabel, children: [
|
|
4742
4672
|
/* @__PURE__ */ jsx(
|
|
4743
4673
|
"button",
|
|
@@ -4804,15 +4734,15 @@ var Drawer = ({
|
|
|
4804
4734
|
className,
|
|
4805
4735
|
...props
|
|
4806
4736
|
}) => {
|
|
4807
|
-
const lastContentRef =
|
|
4737
|
+
const lastContentRef = React11.useRef({ children, title, footer });
|
|
4808
4738
|
if (open) lastContentRef.current = { children, title, footer };
|
|
4809
4739
|
const content = open ? { children, title, footer } : lastContentRef.current;
|
|
4810
4740
|
const overlayDismissible = dismissible ?? closeOnOverlay;
|
|
4811
4741
|
const escapeDismissible = dismissible ?? true;
|
|
4812
|
-
const panelRef =
|
|
4813
|
-
const pressedOverlayRef =
|
|
4814
|
-
const titleId =
|
|
4815
|
-
const [shouldRender, setShouldRender] =
|
|
4742
|
+
const panelRef = React11.useRef(null);
|
|
4743
|
+
const pressedOverlayRef = React11.useRef(false);
|
|
4744
|
+
const titleId = React11.useId();
|
|
4745
|
+
const [shouldRender, setShouldRender] = React11.useState(open);
|
|
4816
4746
|
const reduced = useReducedMotion();
|
|
4817
4747
|
const isMounted = useIsMounted();
|
|
4818
4748
|
useFocusTrap(panelRef, open && isMounted);
|
|
@@ -4836,7 +4766,7 @@ var Drawer = ({
|
|
|
4836
4766
|
immediate: reduced,
|
|
4837
4767
|
config: { tension: 280, friction: 28, clamp: !open }
|
|
4838
4768
|
});
|
|
4839
|
-
|
|
4769
|
+
React11.useEffect(() => {
|
|
4840
4770
|
if (!open) return;
|
|
4841
4771
|
lockBodyScroll();
|
|
4842
4772
|
return unlockBodyScroll;
|
|
@@ -4876,16 +4806,7 @@ var Drawer = ({
|
|
|
4876
4806
|
if (e.key !== "Escape") e.stopPropagation();
|
|
4877
4807
|
},
|
|
4878
4808
|
children: [
|
|
4879
|
-
showCloseIcon && onClose && /* @__PURE__ */ jsx(
|
|
4880
|
-
"button",
|
|
4881
|
-
{
|
|
4882
|
-
type: "button",
|
|
4883
|
-
className: "drawer_close",
|
|
4884
|
-
onClick: onClose,
|
|
4885
|
-
"aria-label": closeLabel,
|
|
4886
|
-
children: /* @__PURE__ */ jsx(X, { size: iconSize.md, "aria-hidden": "true" })
|
|
4887
|
-
}
|
|
4888
|
-
),
|
|
4809
|
+
showCloseIcon && onClose && /* @__PURE__ */ jsx("button", { type: "button", className: "drawer_close", onClick: onClose, "aria-label": closeLabel, children: /* @__PURE__ */ jsx(X, { size: iconSize.md, "aria-hidden": "true" }) }),
|
|
4889
4810
|
content.title && /* @__PURE__ */ jsx("div", { className: "drawer_header", children: /* @__PURE__ */ jsx("h2", { id: titleId, className: "drawer_title", children: content.title }) }),
|
|
4890
4811
|
content.children && // 본문이 스크롤 컨테이너라 키보드로도 스크롤할 수 있어야 한다(axe
|
|
4891
4812
|
// `scrollable-region-focusable`). 다만 초기 포커스 대상에서는 제외한다 - 안쪽에
|
|
@@ -4919,15 +4840,15 @@ var Modal = ({
|
|
|
4919
4840
|
onExited,
|
|
4920
4841
|
...props
|
|
4921
4842
|
}) => {
|
|
4922
|
-
const lastContentRef =
|
|
4843
|
+
const lastContentRef = React11.useRef({ children, title, description, footer });
|
|
4923
4844
|
if (open) lastContentRef.current = { children, title, description, footer };
|
|
4924
4845
|
const content = open ? { children, title, description, footer } : lastContentRef.current;
|
|
4925
4846
|
const overlayDismissible = dismissible ?? closeOnOverlay;
|
|
4926
4847
|
const escapeDismissible = dismissible ?? true;
|
|
4927
|
-
const panelRef =
|
|
4928
|
-
const pressedOverlayRef =
|
|
4929
|
-
const titleId =
|
|
4930
|
-
const [shouldRender, setShouldRender] =
|
|
4848
|
+
const panelRef = React11.useRef(null);
|
|
4849
|
+
const pressedOverlayRef = React11.useRef(false);
|
|
4850
|
+
const titleId = React11.useId();
|
|
4851
|
+
const [shouldRender, setShouldRender] = React11.useState(open);
|
|
4931
4852
|
const isMounted = useIsMounted();
|
|
4932
4853
|
useFocusTrap(panelRef, open && isMounted);
|
|
4933
4854
|
useOverlayEscape(open && isMounted, () => {
|
|
@@ -4955,7 +4876,7 @@ var Modal = ({
|
|
|
4955
4876
|
immediate: reduced,
|
|
4956
4877
|
config: OVERLAY_SPRING_CONFIG
|
|
4957
4878
|
});
|
|
4958
|
-
|
|
4879
|
+
React11.useEffect(() => {
|
|
4959
4880
|
if (!open) return;
|
|
4960
4881
|
lockBodyScroll();
|
|
4961
4882
|
return unlockBodyScroll;
|
|
@@ -5015,9 +4936,9 @@ var Modal = ({
|
|
|
5015
4936
|
document.body
|
|
5016
4937
|
);
|
|
5017
4938
|
};
|
|
5018
|
-
var ThemeContext =
|
|
4939
|
+
var ThemeContext = React11.createContext(null);
|
|
5019
4940
|
var useTheme = () => {
|
|
5020
|
-
const ctx =
|
|
4941
|
+
const ctx = React11.useContext(ThemeContext);
|
|
5021
4942
|
if (!ctx) {
|
|
5022
4943
|
throw new Error(
|
|
5023
4944
|
'[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>'
|
|
@@ -5041,15 +4962,15 @@ var ThemeProvider = ({
|
|
|
5041
4962
|
targetSelector,
|
|
5042
4963
|
children
|
|
5043
4964
|
}) => {
|
|
5044
|
-
const [mode, setModeState] =
|
|
5045
|
-
const [systemDark, setSystemDark] =
|
|
5046
|
-
|
|
4965
|
+
const [mode, setModeState] = React11.useState(defaultMode);
|
|
4966
|
+
const [systemDark, setSystemDark] = React11.useState(false);
|
|
4967
|
+
React11.useEffect(() => {
|
|
5047
4968
|
setModeState(readStored(storageKey) ?? defaultMode);
|
|
5048
4969
|
if (isClient) {
|
|
5049
4970
|
setSystemDark(window.matchMedia("(prefers-color-scheme: dark)").matches);
|
|
5050
4971
|
}
|
|
5051
4972
|
}, [storageKey, defaultMode]);
|
|
5052
|
-
|
|
4973
|
+
React11.useEffect(() => {
|
|
5053
4974
|
if (!isClient) return;
|
|
5054
4975
|
const mq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
5055
4976
|
const handler = (e) => setSystemDark(e.matches);
|
|
@@ -5057,7 +4978,7 @@ var ThemeProvider = ({
|
|
|
5057
4978
|
return () => mq.removeEventListener("change", handler);
|
|
5058
4979
|
}, []);
|
|
5059
4980
|
const resolved = mode === "system" ? systemDark ? "dark" : "light" : mode;
|
|
5060
|
-
|
|
4981
|
+
React11.useEffect(() => {
|
|
5061
4982
|
if (!isClient) return;
|
|
5062
4983
|
const target = targetSelector ? document.querySelector(targetSelector) : document.documentElement;
|
|
5063
4984
|
if (!target) return;
|
|
@@ -5067,7 +4988,7 @@ var ThemeProvider = ({
|
|
|
5067
4988
|
target.setAttribute("data-theme", mode);
|
|
5068
4989
|
}
|
|
5069
4990
|
}, [mode, targetSelector]);
|
|
5070
|
-
const setMode =
|
|
4991
|
+
const setMode = React11.useCallback(
|
|
5071
4992
|
(next) => {
|
|
5072
4993
|
setModeState(next);
|
|
5073
4994
|
if (storageKey && isClient) {
|
|
@@ -5079,7 +5000,7 @@ var ThemeProvider = ({
|
|
|
5079
5000
|
},
|
|
5080
5001
|
[storageKey]
|
|
5081
5002
|
);
|
|
5082
|
-
const value =
|
|
5003
|
+
const value = React11.useMemo(
|
|
5083
5004
|
() => ({ mode, resolved, setMode }),
|
|
5084
5005
|
[mode, resolved, setMode]
|
|
5085
5006
|
);
|
|
@@ -5149,12 +5070,7 @@ var Section = ({
|
|
|
5149
5070
|
Tag,
|
|
5150
5071
|
{
|
|
5151
5072
|
ref,
|
|
5152
|
-
className: cn(
|
|
5153
|
-
"section",
|
|
5154
|
-
`section_spacing_${spacing2}`,
|
|
5155
|
-
`section_bg_${bg}`,
|
|
5156
|
-
className
|
|
5157
|
-
),
|
|
5073
|
+
className: cn("section", `section_spacing_${spacing2}`, `section_bg_${bg}`, className),
|
|
5158
5074
|
...props,
|
|
5159
5075
|
children
|
|
5160
5076
|
}
|