@bigtablet/design-system 3.22.0 → 3.23.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.d.ts +37 -4
- package/dist/index.js +122 -56
- package/dist/vanilla/bigtablet.min.js +12 -12
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1633,6 +1633,18 @@ interface DataViewProps<T extends object> extends Omit<React$1.HTMLAttributes<HT
|
|
|
1633
1633
|
onRowClick?: (row: T, index: number) => void;
|
|
1634
1634
|
/** 표의 접근성 이름 */
|
|
1635
1635
|
ariaLabel?: string;
|
|
1636
|
+
/** 전체 선택 체크박스의 라벨 (기본값: `Table` 의 기본 라벨) */
|
|
1637
|
+
selectAllAriaLabel?: string;
|
|
1638
|
+
/**
|
|
1639
|
+
* 행 선택 체크박스의 라벨. 인자는 `pagination.pageSize` 를 반영한 **전체 순번**(0-based)이다.
|
|
1640
|
+
* 기본값은 순번만 읽어 주므로, 행을 이름으로 구분하려면 바깥 `rows` 를 닫아 넘긴다.
|
|
1641
|
+
* @example
|
|
1642
|
+
* ```tsx
|
|
1643
|
+
* const offset = (page - 1) * SIZE;
|
|
1644
|
+
* selectRowAriaLabel={(index) => `${rows[index - offset].name} 선택`}
|
|
1645
|
+
* ```
|
|
1646
|
+
*/
|
|
1647
|
+
selectRowAriaLabel?: (index: number) => string;
|
|
1636
1648
|
/** 선택 액션 줄의 안내 문구 (기본값: (n) => `${n}개 선택됨`) */
|
|
1637
1649
|
selectionSummary?: (count: number) => string;
|
|
1638
1650
|
/** 선택 해제 버튼 라벨 */
|
|
@@ -1664,7 +1676,7 @@ interface DataViewProps<T extends object> extends Omit<React$1.HTMLAttributes<HT
|
|
|
1664
1676
|
* />
|
|
1665
1677
|
* ```
|
|
1666
1678
|
*/
|
|
1667
|
-
declare const DataView: <T extends object>({ query, columns, rowKey, toolbar, selectionActions, pagination, empty, sort, onSortChange, onRowClick, ariaLabel, selectionSummary: selectionSummaryProp, clearSelectionLabel: clearSelectionLabelProp, errorTitle: errorTitleProp, retryLabel: retryLabelProp, className, ...props }: DataViewProps<T>) => React$1.JSX.Element;
|
|
1679
|
+
declare const DataView: <T extends object>({ query, columns, rowKey, toolbar, selectionActions, pagination, empty, sort, onSortChange, onRowClick, ariaLabel, selectAllAriaLabel, selectRowAriaLabel, selectionSummary: selectionSummaryProp, clearSelectionLabel: clearSelectionLabelProp, errorTitle: errorTitleProp, retryLabel: retryLabelProp, className, ...props }: DataViewProps<T>) => React$1.JSX.Element;
|
|
1668
1680
|
|
|
1669
1681
|
interface DividerProps extends React$1.HTMLAttributes<HTMLHRElement> {
|
|
1670
1682
|
/** 구분선 두께 (기본값: "standard") */
|
|
@@ -2100,6 +2112,11 @@ interface DatePickerBaseProps {
|
|
|
2100
2112
|
selectableRange?: SelectableRange;
|
|
2101
2113
|
/** 비활성화 여부 */
|
|
2102
2114
|
disabled?: boolean;
|
|
2115
|
+
/**
|
|
2116
|
+
* 필수 입력 여부. `Field` 안에서는 `Field` 의 `required` 가 이긴다.
|
|
2117
|
+
* `role="group"` 에는 `aria-required` 를 붙일 수 없어 안쪽 컨트롤마다 내려보낸다.
|
|
2118
|
+
*/
|
|
2119
|
+
required?: boolean;
|
|
2103
2120
|
/** 데이트 피커가 컨테이너의 전체 너비를 차지할지 여부 */
|
|
2104
2121
|
fullWidth?: boolean;
|
|
2105
2122
|
/**
|
|
@@ -2138,7 +2155,7 @@ type DatePickerProps = DatePickerBaseProps & DatePickerCallbacks;
|
|
|
2138
2155
|
* 연/월/일 선택형 데이트 피커를 렌더링한다.
|
|
2139
2156
|
* 내부적으로 DS Dropdown 3개를 조합해 드롭다운 UX 일관성을 유지한다.
|
|
2140
2157
|
*/
|
|
2141
|
-
declare const DatePicker: ({ label, value, onValueChange, onChange, mode, startYear, endYear: endYearProp, minDate, selectableRange, disabled, fullWidth, width, yearLabel: yearLabelProp, monthLabel: monthLabelProp, dayLabel: dayLabelProp, minDateSrFormat: minDateSrFormatProp, selectableRangeUntilTodaySrText: selectableRangeUntilTodaySrTextProp, }: DatePickerProps) => React$1.JSX.Element;
|
|
2158
|
+
declare const DatePicker: ({ label, value, onValueChange, onChange, mode, startYear, endYear: endYearProp, minDate, selectableRange, disabled, required, fullWidth, width, yearLabel: yearLabelProp, monthLabel: monthLabelProp, dayLabel: dayLabelProp, minDateSrFormat: minDateSrFormatProp, selectableRangeUntilTodaySrText: selectableRangeUntilTodaySrTextProp, }: DatePickerProps) => React$1.JSX.Element;
|
|
2142
2159
|
|
|
2143
2160
|
interface DateRange {
|
|
2144
2161
|
/** 시작일 (`"YYYY-MM-DD"`). 아직 고르지 않았으면 undefined */
|
|
@@ -2165,6 +2182,11 @@ interface DateRangePickerProps {
|
|
|
2165
2182
|
selectableRange?: "all" | "until-today";
|
|
2166
2183
|
/** 비활성 여부 */
|
|
2167
2184
|
disabled?: boolean;
|
|
2185
|
+
/**
|
|
2186
|
+
* 필수 입력 여부. `Field` 안에서는 `Field` 의 `required` 가 이긴다.
|
|
2187
|
+
* `role="group"` 에는 `aria-required` 를 붙일 수 없어 안쪽 컨트롤마다 내려보낸다.
|
|
2188
|
+
*/
|
|
2189
|
+
required?: boolean;
|
|
2168
2190
|
/** 전체 너비 차지 (기본값: true) */
|
|
2169
2191
|
fullWidth?: boolean;
|
|
2170
2192
|
}
|
|
@@ -2185,7 +2207,7 @@ interface DateRangePickerProps {
|
|
|
2185
2207
|
* </Field>
|
|
2186
2208
|
* ```
|
|
2187
2209
|
*/
|
|
2188
|
-
declare const DateRangePicker: ({ value, onValueChange, startLabel: startLabelProp, endLabel: endLabelProp, startYear, endYear, minDate, selectableRange, disabled, fullWidth, }: DateRangePickerProps) => React$1.JSX.Element;
|
|
2210
|
+
declare const DateRangePicker: ({ value, onValueChange, startLabel: startLabelProp, endLabel: endLabelProp, startYear, endYear, minDate, selectableRange, disabled, required, fullWidth, }: DateRangePickerProps) => React$1.JSX.Element;
|
|
2189
2211
|
|
|
2190
2212
|
type DropdownSize = "sm" | "md" | "lg";
|
|
2191
2213
|
/**
|
|
@@ -2219,6 +2241,12 @@ interface DropdownCommonProps {
|
|
|
2219
2241
|
options: DropdownOption[];
|
|
2220
2242
|
/** 비활성화 여부 */
|
|
2221
2243
|
disabled?: boolean;
|
|
2244
|
+
/**
|
|
2245
|
+
* 필수 입력 여부. `Field` 안에서는 `Field` 의 `required` 가 이긴다.
|
|
2246
|
+
* `role="group"` 은 `aria-required` 를 받지 못하므로 DatePicker·TimePicker 가 안쪽
|
|
2247
|
+
* Dropdown 마다 이 prop 으로 필수 여부를 내려보낸다.
|
|
2248
|
+
*/
|
|
2249
|
+
required?: boolean;
|
|
2222
2250
|
/** 드롭다운 크기 */
|
|
2223
2251
|
size?: DropdownSize;
|
|
2224
2252
|
/**
|
|
@@ -2857,6 +2885,11 @@ interface TimePickerProps {
|
|
|
2857
2885
|
maxTime?: string;
|
|
2858
2886
|
/** 비활성 여부 */
|
|
2859
2887
|
disabled?: boolean;
|
|
2888
|
+
/**
|
|
2889
|
+
* 필수 입력 여부. `Field` 안에서는 `Field` 의 `required` 가 이긴다.
|
|
2890
|
+
* `role="group"` 에는 `aria-required` 를 붙일 수 없어 안쪽 컨트롤마다 내려보낸다.
|
|
2891
|
+
*/
|
|
2892
|
+
required?: boolean;
|
|
2860
2893
|
/** 전체 너비 차지 (기본값: true) */
|
|
2861
2894
|
fullWidth?: boolean;
|
|
2862
2895
|
/** 시 select 의 라벨/placeholder */
|
|
@@ -2883,7 +2916,7 @@ interface TimePickerProps {
|
|
|
2883
2916
|
* </Field>
|
|
2884
2917
|
* ```
|
|
2885
2918
|
*/
|
|
2886
|
-
declare const TimePicker: ({ label, value, onValueChange, minuteStep, minTime, maxTime, disabled, fullWidth, hourLabel: hourLabelProp, minuteLabel: minuteLabelProp, }: TimePickerProps) => React$1.JSX.Element;
|
|
2919
|
+
declare const TimePicker: ({ label, value, onValueChange, minuteStep, minTime, maxTime, disabled, required, fullWidth, hourLabel: hourLabelProp, minuteLabel: minuteLabelProp, }: TimePickerProps) => React$1.JSX.Element;
|
|
2887
2920
|
|
|
2888
2921
|
interface ToggleProps extends Omit<React$1.ButtonHTMLAttributes<HTMLButtonElement>, "onChange"> {
|
|
2889
2922
|
/** 제어형 토글 상태 */
|
package/dist/index.js
CHANGED
|
@@ -29,6 +29,29 @@ var cn = (...classes) => {
|
|
|
29
29
|
}
|
|
30
30
|
return classNames.join(" ");
|
|
31
31
|
};
|
|
32
|
+
|
|
33
|
+
// src/utils/key-activation.ts
|
|
34
|
+
function keyActivationProps({
|
|
35
|
+
onClick,
|
|
36
|
+
role,
|
|
37
|
+
disabled,
|
|
38
|
+
onKeyDown
|
|
39
|
+
}) {
|
|
40
|
+
const resolvedRole = role ?? (onClick ? "button" : void 0);
|
|
41
|
+
const isInteractive = !!onClick && !disabled;
|
|
42
|
+
return {
|
|
43
|
+
role: resolvedRole,
|
|
44
|
+
tabIndex: isInteractive ? 0 : void 0,
|
|
45
|
+
onKeyDown: (event) => {
|
|
46
|
+
onKeyDown?.(event);
|
|
47
|
+
if (!isInteractive || event.defaultPrevented || event.repeat) return;
|
|
48
|
+
if (event.key === "Enter" || event.key === " " && resolvedRole === "button") {
|
|
49
|
+
event.preventDefault();
|
|
50
|
+
event.currentTarget.click();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
32
55
|
var stack = [];
|
|
33
56
|
var handleKeyDown = (e) => {
|
|
34
57
|
if (e.key !== "Escape") return;
|
|
@@ -171,6 +194,16 @@ function springEnterFrom(reduced, transform) {
|
|
|
171
194
|
var OVERLAY_PANEL_CLOSED_TRANSFORM = "scale(0.96) translateY(-4px)";
|
|
172
195
|
var OVERLAY_PANEL_OPEN_TRANSFORM = "scale(1) translateY(0px)";
|
|
173
196
|
var OVERLAY_SPRING_CONFIG = { tension: 280, friction: 28, clamp: true };
|
|
197
|
+
|
|
198
|
+
// src/utils/split-aria-props.ts
|
|
199
|
+
function splitAriaProps(props) {
|
|
200
|
+
const ariaProps = {};
|
|
201
|
+
const restProps = {};
|
|
202
|
+
for (const key of Object.keys(props)) {
|
|
203
|
+
(key.startsWith("aria-") ? ariaProps : restProps)[key] = props[key];
|
|
204
|
+
}
|
|
205
|
+
return { ariaProps, restProps };
|
|
206
|
+
}
|
|
174
207
|
var useSafeLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
|
175
208
|
|
|
176
209
|
// src/utils/use-anchored-position.ts
|
|
@@ -358,8 +391,10 @@ function useFocusTrap(containerRef, isActive, options) {
|
|
|
358
391
|
if (initialTarget) {
|
|
359
392
|
initialTarget.focus();
|
|
360
393
|
} else {
|
|
361
|
-
container.
|
|
362
|
-
|
|
394
|
+
if (!container.hasAttribute("tabindex")) {
|
|
395
|
+
container.setAttribute("tabindex", "-1");
|
|
396
|
+
wasTabIndexAdded = true;
|
|
397
|
+
}
|
|
363
398
|
container.focus();
|
|
364
399
|
}
|
|
365
400
|
const handleKeyDown2 = (e) => {
|
|
@@ -2689,7 +2724,11 @@ var Card = ({
|
|
|
2689
2724
|
{ card_bordered: bordered, card_interactive: interactive },
|
|
2690
2725
|
className
|
|
2691
2726
|
);
|
|
2692
|
-
const
|
|
2727
|
+
const activation = keyActivationProps({
|
|
2728
|
+
onClick: props.onClick,
|
|
2729
|
+
role: props.role,
|
|
2730
|
+
onKeyDown: props.onKeyDown
|
|
2731
|
+
});
|
|
2693
2732
|
return (
|
|
2694
2733
|
// biome-ignore lint/a11y/noStaticElementInteractions: onClick 이 있을 때만 role=button + tabIndex 를 붙인다 (ListItem 과 같은 규칙)
|
|
2695
2734
|
/* @__PURE__ */ jsxs(
|
|
@@ -2697,18 +2736,10 @@ var Card = ({
|
|
|
2697
2736
|
{
|
|
2698
2737
|
ref,
|
|
2699
2738
|
className: cardClassName,
|
|
2700
|
-
role:
|
|
2701
|
-
tabIndex:
|
|
2739
|
+
role: activation.role,
|
|
2740
|
+
tabIndex: activation.tabIndex,
|
|
2702
2741
|
...props,
|
|
2703
|
-
onKeyDown:
|
|
2704
|
-
props.onKeyDown?.(e);
|
|
2705
|
-
if (!props.onClick || e.defaultPrevented || e.repeat) return;
|
|
2706
|
-
const activates = e.key === "Enter" || e.key === " " && resolvedRole === "button";
|
|
2707
|
-
if (activates) {
|
|
2708
|
-
e.preventDefault();
|
|
2709
|
-
e.currentTarget.click();
|
|
2710
|
-
}
|
|
2711
|
-
},
|
|
2742
|
+
onKeyDown: activation.onKeyDown,
|
|
2712
2743
|
children: [
|
|
2713
2744
|
heading ? /* @__PURE__ */ jsx(HeadingTag, { className: "card_title", children: heading }) : null,
|
|
2714
2745
|
/* @__PURE__ */ jsx("div", { className: "card_body", children }),
|
|
@@ -3505,7 +3536,7 @@ var Table = ({
|
|
|
3505
3536
|
onRowClick && "table_row_clickable",
|
|
3506
3537
|
isSelected && "table_row_selected"
|
|
3507
3538
|
),
|
|
3508
|
-
"aria-selected": isSelected ? "true" : void 0,
|
|
3539
|
+
"aria-selected": selectable ? isSelected ? "true" : "false" : void 0,
|
|
3509
3540
|
"aria-describedby": onRowClick && rowClickHint ? rowClickHintId : void 0,
|
|
3510
3541
|
tabIndex: onRowClick ? 0 : void 0,
|
|
3511
3542
|
onClick: onRowClick ? () => onRowClick(item, rowIndex) : void 0,
|
|
@@ -3567,6 +3598,8 @@ var DataView = ({
|
|
|
3567
3598
|
onSortChange,
|
|
3568
3599
|
onRowClick,
|
|
3569
3600
|
ariaLabel,
|
|
3601
|
+
selectAllAriaLabel,
|
|
3602
|
+
selectRowAriaLabel,
|
|
3570
3603
|
selectionSummary: selectionSummaryProp,
|
|
3571
3604
|
clearSelectionLabel: clearSelectionLabelProp,
|
|
3572
3605
|
errorTitle: errorTitleProp,
|
|
@@ -3658,6 +3691,8 @@ var DataView = ({
|
|
|
3658
3691
|
onRowClick,
|
|
3659
3692
|
ariaLabel,
|
|
3660
3693
|
selectable: true,
|
|
3694
|
+
selectAllAriaLabel,
|
|
3695
|
+
selectRowAriaLabel,
|
|
3661
3696
|
rowKey,
|
|
3662
3697
|
selectedKeys,
|
|
3663
3698
|
onSelectionChange: setSelectedKeys
|
|
@@ -3776,25 +3811,26 @@ var ListItem = ({
|
|
|
3776
3811
|
onClick && "list_item_interactive",
|
|
3777
3812
|
className
|
|
3778
3813
|
);
|
|
3814
|
+
const activation = keyActivationProps({
|
|
3815
|
+
onClick,
|
|
3816
|
+
role: props.role,
|
|
3817
|
+
disabled,
|
|
3818
|
+
onKeyDown: props.onKeyDown
|
|
3819
|
+
});
|
|
3779
3820
|
return (
|
|
3780
3821
|
// biome-ignore lint/a11y/noStaticElementInteractions: optional interactive list item - role=button + tabIndex set conditionally based on onClick
|
|
3822
|
+
// biome-ignore lint/a11y/useAriaPropsSupportedByRole: role 은 keyActivationProps 가 주므로 정적 분석이 못 본다 - onClick 이 있으면 role=button 이고 aria-pressed 는 그때만 붙는다
|
|
3781
3823
|
/* @__PURE__ */ jsx(
|
|
3782
3824
|
"div",
|
|
3783
3825
|
{
|
|
3784
3826
|
className: rootClassName,
|
|
3785
3827
|
onClick: disabled ? void 0 : onClick,
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
3789
|
-
e.preventDefault();
|
|
3790
|
-
e.currentTarget.click();
|
|
3791
|
-
}
|
|
3792
|
-
},
|
|
3793
|
-
role: onClick ? "button" : void 0,
|
|
3794
|
-
tabIndex: onClick && !disabled ? 0 : void 0,
|
|
3828
|
+
role: activation.role,
|
|
3829
|
+
tabIndex: activation.tabIndex,
|
|
3795
3830
|
"aria-disabled": disabled || void 0,
|
|
3796
3831
|
"aria-pressed": onClick && selected !== void 0 ? selected : void 0,
|
|
3797
3832
|
...props,
|
|
3833
|
+
onKeyDown: activation.onKeyDown,
|
|
3798
3834
|
children: /* @__PURE__ */ jsxs("div", { className: "list_item_state_layer", children: [
|
|
3799
3835
|
leadingElement && /* @__PURE__ */ jsx("div", { className: "list_item_leading", children: leadingElement }),
|
|
3800
3836
|
/* @__PURE__ */ jsxs("div", { className: "list_item_content", children: [
|
|
@@ -3835,7 +3871,11 @@ var MediaCard = ({
|
|
|
3835
3871
|
const isOverlay = imagePosition === "overlay";
|
|
3836
3872
|
const cardStyle = isOverlay && aspectRatio ? { aspectRatio } : void 0;
|
|
3837
3873
|
const wrapStyle = !isOverlay && aspectRatio ? { aspectRatio } : void 0;
|
|
3838
|
-
const
|
|
3874
|
+
const activation = keyActivationProps({
|
|
3875
|
+
onClick: props.onClick,
|
|
3876
|
+
role: props.role,
|
|
3877
|
+
onKeyDown: props.onKeyDown
|
|
3878
|
+
});
|
|
3839
3879
|
return (
|
|
3840
3880
|
// biome-ignore lint/a11y/noStaticElementInteractions: onClick 이 있을 때만 role=button + tabIndex 를 붙인다 (ListItem 과 같은 규칙)
|
|
3841
3881
|
/* @__PURE__ */ jsxs(
|
|
@@ -3843,18 +3883,10 @@ var MediaCard = ({
|
|
|
3843
3883
|
{
|
|
3844
3884
|
className: cardClassName,
|
|
3845
3885
|
style: cardStyle,
|
|
3846
|
-
role:
|
|
3847
|
-
tabIndex:
|
|
3886
|
+
role: activation.role,
|
|
3887
|
+
tabIndex: activation.tabIndex,
|
|
3848
3888
|
...props,
|
|
3849
|
-
onKeyDown:
|
|
3850
|
-
props.onKeyDown?.(e);
|
|
3851
|
-
if (!props.onClick || e.defaultPrevented || e.repeat) return;
|
|
3852
|
-
const activates = e.key === "Enter" || e.key === " " && resolvedRole === "button";
|
|
3853
|
-
if (activates) {
|
|
3854
|
-
e.preventDefault();
|
|
3855
|
-
e.currentTarget.click();
|
|
3856
|
-
}
|
|
3857
|
-
},
|
|
3889
|
+
onKeyDown: activation.onKeyDown,
|
|
3858
3890
|
children: [
|
|
3859
3891
|
/* @__PURE__ */ jsxs("div", { className: "media_card_image_wrap", style: wrapStyle, children: [
|
|
3860
3892
|
/* @__PURE__ */ jsx("img", { className: "media_card_image", src: image.src, alt: image.alt, loading: "lazy" }),
|
|
@@ -4167,6 +4199,9 @@ var ToastItemComponent = ({ item, onRemove, closeAriaLabel }) => {
|
|
|
4167
4199
|
closingRef.current = true;
|
|
4168
4200
|
setVisible(false);
|
|
4169
4201
|
}, []);
|
|
4202
|
+
React20.useEffect(() => {
|
|
4203
|
+
if (item.dismissing) close();
|
|
4204
|
+
}, [item.dismissing, close]);
|
|
4170
4205
|
return /* @__PURE__ */ jsxs(
|
|
4171
4206
|
animated.div,
|
|
4172
4207
|
{
|
|
@@ -4205,8 +4240,14 @@ var ToastProvider = ({
|
|
|
4205
4240
|
const isMounted = useIsMounted();
|
|
4206
4241
|
const addToast = React20.useCallback(
|
|
4207
4242
|
(message, variant, duration = 3e3) => {
|
|
4243
|
+
if (maxCount <= 0) return;
|
|
4208
4244
|
const id = `toast_${++toastSeq}`;
|
|
4209
|
-
setToasts((prev) =>
|
|
4245
|
+
setToasts((prev) => {
|
|
4246
|
+
const next = [{ id, message, variant, duration }, ...prev];
|
|
4247
|
+
return next.map(
|
|
4248
|
+
(toast, index) => index >= maxCount && !toast.dismissing ? { ...toast, dismissing: true } : toast
|
|
4249
|
+
);
|
|
4250
|
+
});
|
|
4210
4251
|
},
|
|
4211
4252
|
[maxCount]
|
|
4212
4253
|
);
|
|
@@ -4321,6 +4362,8 @@ var Combobox = ({
|
|
|
4321
4362
|
const generatedId = useId();
|
|
4322
4363
|
const field = useFieldControl();
|
|
4323
4364
|
const inputId = field?.inputId ?? generatedId;
|
|
4365
|
+
const { ariaProps, restProps } = splitAriaProps(props);
|
|
4366
|
+
const labelledBy = field?.labelId ?? ariaProps["aria-labelledby"];
|
|
4324
4367
|
const listId = `${inputId}-listbox`;
|
|
4325
4368
|
const [query, setQuery] = useState("");
|
|
4326
4369
|
const [options, setOptions] = useState(defaultOptions);
|
|
@@ -4395,7 +4438,7 @@ var Combobox = ({
|
|
|
4395
4438
|
visible: isOpen,
|
|
4396
4439
|
from: popup.dropUp ? "translateY(4px)" : "translateY(-4px)"
|
|
4397
4440
|
});
|
|
4398
|
-
return /* @__PURE__ */ jsxs("div", { ref: popup.wrapperRef, className: rootClassName, ...
|
|
4441
|
+
return /* @__PURE__ */ jsxs("div", { ref: popup.wrapperRef, className: rootClassName, ...restProps, children: [
|
|
4399
4442
|
/* @__PURE__ */ jsxs("div", { className: "combobox_control", children: [
|
|
4400
4443
|
/* @__PURE__ */ jsx(
|
|
4401
4444
|
"input",
|
|
@@ -4403,6 +4446,7 @@ var Combobox = ({
|
|
|
4403
4446
|
id: inputId,
|
|
4404
4447
|
className: "combobox_input",
|
|
4405
4448
|
role: "combobox",
|
|
4449
|
+
...ariaProps,
|
|
4406
4450
|
type: "text",
|
|
4407
4451
|
autoComplete: "off",
|
|
4408
4452
|
disabled,
|
|
@@ -4412,11 +4456,11 @@ var Combobox = ({
|
|
|
4412
4456
|
"aria-controls": isOpen && hasList ? listId : void 0,
|
|
4413
4457
|
"aria-autocomplete": "list",
|
|
4414
4458
|
"aria-activedescendant": isOpen && activeIndex >= 0 && options[activeIndex] ? `${listId}-${options[activeIndex].value}` : void 0,
|
|
4415
|
-
"aria-labelledby":
|
|
4416
|
-
"aria-label":
|
|
4417
|
-
"aria-describedby": field?.describedBy,
|
|
4418
|
-
"aria-invalid": field
|
|
4419
|
-
"aria-required": field
|
|
4459
|
+
"aria-labelledby": labelledBy,
|
|
4460
|
+
"aria-label": labelledBy ? void 0 : ariaLabel ?? ariaProps["aria-label"],
|
|
4461
|
+
"aria-describedby": field?.describedBy ?? ariaProps["aria-describedby"],
|
|
4462
|
+
"aria-invalid": field ? field.invalid || void 0 : ariaProps["aria-invalid"],
|
|
4463
|
+
"aria-required": field ? field.required || void 0 : ariaProps["aria-required"],
|
|
4420
4464
|
onChange: (event) => {
|
|
4421
4465
|
setQuery(event.target.value);
|
|
4422
4466
|
if (!isOpen) setIsOpen(true);
|
|
@@ -4507,6 +4551,7 @@ var Dropdown = (props) => {
|
|
|
4507
4551
|
placeholder: placeholderProp,
|
|
4508
4552
|
options,
|
|
4509
4553
|
disabled,
|
|
4554
|
+
required,
|
|
4510
4555
|
size = "md",
|
|
4511
4556
|
variant = "outline",
|
|
4512
4557
|
className,
|
|
@@ -4656,7 +4701,7 @@ var Dropdown = (props) => {
|
|
|
4656
4701
|
"aria-activedescendant": !searchable && isOpen && activeIndex >= 0 && visibleOptions[activeIndex] ? `${dropdownId}_option_${activeIndex}` : void 0,
|
|
4657
4702
|
"aria-describedby": field?.describedBy,
|
|
4658
4703
|
"aria-invalid": field?.invalid || void 0,
|
|
4659
|
-
"aria-required": field
|
|
4704
|
+
"aria-required": field ? field.required || void 0 : required || void 0,
|
|
4660
4705
|
"aria-controls": isOpen ? `${dropdownId}_listbox` : void 0,
|
|
4661
4706
|
onClick: () => !disabled && setIsOpen((o) => !o),
|
|
4662
4707
|
onKeyDown: onControlKeyDown,
|
|
@@ -4716,7 +4761,7 @@ var Dropdown = (props) => {
|
|
|
4716
4761
|
role: "combobox",
|
|
4717
4762
|
"aria-autocomplete": "list",
|
|
4718
4763
|
"aria-expanded": isOpen,
|
|
4719
|
-
"aria-required": field
|
|
4764
|
+
"aria-required": field ? field.required || void 0 : required || void 0,
|
|
4720
4765
|
"aria-controls": `${dropdownId}_listbox`,
|
|
4721
4766
|
"aria-activedescendant": activeIndex >= 0 && visibleOptions[activeIndex] ? `${dropdownId}_option_${activeIndex}` : void 0,
|
|
4722
4767
|
value: searchText,
|
|
@@ -4803,6 +4848,7 @@ var DatePicker = ({
|
|
|
4803
4848
|
minDate,
|
|
4804
4849
|
selectableRange = "all",
|
|
4805
4850
|
disabled,
|
|
4851
|
+
required,
|
|
4806
4852
|
fullWidth = true,
|
|
4807
4853
|
width,
|
|
4808
4854
|
yearLabel: yearLabelProp,
|
|
@@ -4818,6 +4864,7 @@ var DatePicker = ({
|
|
|
4818
4864
|
const minDateSrFormat = minDateSrFormatProp ?? t("datePicker.minDateSr");
|
|
4819
4865
|
const selectableRangeUntilTodaySrText = selectableRangeUntilTodaySrTextProp ?? t("datePicker.rangeUntilTodaySr");
|
|
4820
4866
|
const field = useFieldControl();
|
|
4867
|
+
const isRequired = field ? field.required || void 0 : required || void 0;
|
|
4821
4868
|
const groupId = React20.useId();
|
|
4822
4869
|
const constraintId = React20.useId();
|
|
4823
4870
|
const { todayYear, todayMonth, todayDay } = React20.useMemo(() => {
|
|
@@ -4985,6 +5032,7 @@ var DatePicker = ({
|
|
|
4985
5032
|
options: yearOptions,
|
|
4986
5033
|
value: year ? String(year) : null,
|
|
4987
5034
|
onValueChange: handleYearChange,
|
|
5035
|
+
required: isRequired,
|
|
4988
5036
|
disabled
|
|
4989
5037
|
}
|
|
4990
5038
|
),
|
|
@@ -4998,6 +5046,7 @@ var DatePicker = ({
|
|
|
4998
5046
|
options: monthOptions,
|
|
4999
5047
|
value: month ? String(month) : null,
|
|
5000
5048
|
onValueChange: handleMonthChange,
|
|
5049
|
+
required: isRequired,
|
|
5001
5050
|
disabled: disabled || !year
|
|
5002
5051
|
}
|
|
5003
5052
|
),
|
|
@@ -5011,6 +5060,7 @@ var DatePicker = ({
|
|
|
5011
5060
|
options: dayOptions,
|
|
5012
5061
|
value: day ? String(day) : null,
|
|
5013
5062
|
onValueChange: handleDayChange,
|
|
5063
|
+
required: isRequired,
|
|
5014
5064
|
disabled: disabled || !month
|
|
5015
5065
|
}
|
|
5016
5066
|
)
|
|
@@ -5029,12 +5079,14 @@ var DateRangePicker = ({
|
|
|
5029
5079
|
minDate,
|
|
5030
5080
|
selectableRange = "all",
|
|
5031
5081
|
disabled,
|
|
5082
|
+
required,
|
|
5032
5083
|
fullWidth = true
|
|
5033
5084
|
}) => {
|
|
5034
5085
|
const t = useLocaleText();
|
|
5035
5086
|
const startLabel = startLabelProp ?? t("dateRange.start");
|
|
5036
5087
|
const endLabel = endLabelProp ?? t("dateRange.end");
|
|
5037
5088
|
const field = useFieldControl();
|
|
5089
|
+
const isRequired = field ? field.required || void 0 : required || void 0;
|
|
5038
5090
|
const start = value?.start;
|
|
5039
5091
|
const end = value?.end;
|
|
5040
5092
|
const handleStartChange = (next) => {
|
|
@@ -5070,6 +5122,7 @@ var DateRangePicker = ({
|
|
|
5070
5122
|
endYear,
|
|
5071
5123
|
minDate,
|
|
5072
5124
|
selectableRange,
|
|
5125
|
+
required: isRequired,
|
|
5073
5126
|
disabled,
|
|
5074
5127
|
fullWidth: true
|
|
5075
5128
|
}
|
|
@@ -5084,6 +5137,7 @@ var DateRangePicker = ({
|
|
|
5084
5137
|
endYear,
|
|
5085
5138
|
minDate: endMinDate,
|
|
5086
5139
|
selectableRange,
|
|
5140
|
+
required: isRequired,
|
|
5087
5141
|
disabled: disabled || !start,
|
|
5088
5142
|
fullWidth: true
|
|
5089
5143
|
}
|
|
@@ -5184,6 +5238,7 @@ var FileInput = ({
|
|
|
5184
5238
|
accept: isPreviewVariant ? accept ?? "image/*" : accept,
|
|
5185
5239
|
"aria-describedby": [field?.describedBy, supportingText ? helperId : void 0].filter(Boolean).join(" ") || void 0,
|
|
5186
5240
|
"aria-invalid": field?.invalid || void 0,
|
|
5241
|
+
required: field ? field.required || void 0 : props.required,
|
|
5187
5242
|
onChange: handleChange
|
|
5188
5243
|
}
|
|
5189
5244
|
),
|
|
@@ -5679,6 +5734,7 @@ var OtpInput = ({
|
|
|
5679
5734
|
disabled,
|
|
5680
5735
|
"aria-label": t("otpInput.digit", { index: i + 1 }),
|
|
5681
5736
|
"aria-invalid": error || field?.invalid || void 0,
|
|
5737
|
+
"aria-required": field?.required || void 0,
|
|
5682
5738
|
"aria-describedby": [field?.describedBy, supportingText ? supportingId : void 0].filter(Boolean).join(" ") || void 0,
|
|
5683
5739
|
className: cn(
|
|
5684
5740
|
"otp_input_box",
|
|
@@ -5730,6 +5786,7 @@ var RadioGroup = ({
|
|
|
5730
5786
|
const field = useFieldControl();
|
|
5731
5787
|
const labelId = label ? `${idPrefix}-label` : void 0;
|
|
5732
5788
|
const helperId = supportingText ? `${idPrefix}-help` : void 0;
|
|
5789
|
+
const { ariaProps, restProps } = splitAriaProps(props);
|
|
5733
5790
|
const onChange = React20.useCallback(
|
|
5734
5791
|
(next) => {
|
|
5735
5792
|
if (!isControlled) setInternalValue(next);
|
|
@@ -5750,17 +5807,18 @@ var RadioGroup = ({
|
|
|
5750
5807
|
error && "radio_group_error",
|
|
5751
5808
|
className
|
|
5752
5809
|
),
|
|
5753
|
-
...
|
|
5810
|
+
...restProps,
|
|
5754
5811
|
children: [
|
|
5755
5812
|
label && /* @__PURE__ */ jsx("span", { id: labelId, className: "radio_group_label", children: label }),
|
|
5756
5813
|
/* @__PURE__ */ jsx(
|
|
5757
5814
|
"div",
|
|
5758
5815
|
{
|
|
5759
5816
|
role: "radiogroup",
|
|
5760
|
-
|
|
5761
|
-
"aria-
|
|
5762
|
-
"aria-
|
|
5763
|
-
"aria-
|
|
5817
|
+
...ariaProps,
|
|
5818
|
+
"aria-labelledby": field?.labelId ?? labelId ?? ariaProps["aria-labelledby"],
|
|
5819
|
+
"aria-describedby": field?.describedBy ?? helperId ?? ariaProps["aria-describedby"],
|
|
5820
|
+
"aria-invalid": error || (field ? field.invalid || void 0 : ariaProps["aria-invalid"]),
|
|
5821
|
+
"aria-required": field ? field.required || void 0 : ariaProps["aria-required"],
|
|
5764
5822
|
className: "radio_group_options",
|
|
5765
5823
|
children
|
|
5766
5824
|
}
|
|
@@ -5838,6 +5896,8 @@ var TagInput = ({
|
|
|
5838
5896
|
const generatedId = useId();
|
|
5839
5897
|
const field = useFieldControl();
|
|
5840
5898
|
const inputId = field?.inputId ?? generatedId;
|
|
5899
|
+
const { ariaProps, restProps } = splitAriaProps(props);
|
|
5900
|
+
const labelledBy = field?.labelId ?? ariaProps["aria-labelledby"];
|
|
5841
5901
|
const isControlled = value !== void 0;
|
|
5842
5902
|
const [innerTags, setInnerTags] = useState(defaultValue);
|
|
5843
5903
|
const tags = isControlled ? value : innerTags;
|
|
@@ -5916,7 +5976,7 @@ var TagInput = ({
|
|
|
5916
5976
|
{ tag_input_full_width: fullWidth, tag_input_disabled: disabled },
|
|
5917
5977
|
className
|
|
5918
5978
|
);
|
|
5919
|
-
return /* @__PURE__ */ jsxs("div", { className: rootClassName, ...
|
|
5979
|
+
return /* @__PURE__ */ jsxs("div", { className: rootClassName, ...restProps, children: [
|
|
5920
5980
|
/* @__PURE__ */ jsxs("div", { className: "tag_input_control", onClick: () => inputRef.current?.focus(), children: [
|
|
5921
5981
|
tags.length > 0 && /* @__PURE__ */ jsx("ul", { className: "tag_input_tags", children: tags.map((tag, index) => (
|
|
5922
5982
|
/* biome-ignore lint/suspicious/noArrayIndexKey: allowDuplicates 면 같은 라벨이 여러 개라 값만으로는 구분되지 않는다 */
|
|
@@ -5943,11 +6003,12 @@ var TagInput = ({
|
|
|
5943
6003
|
disabled,
|
|
5944
6004
|
readOnly: isFull,
|
|
5945
6005
|
placeholder: isFull ? "" : placeholder,
|
|
5946
|
-
|
|
5947
|
-
"aria-
|
|
5948
|
-
"aria-
|
|
5949
|
-
"aria-
|
|
5950
|
-
"aria-
|
|
6006
|
+
...ariaProps,
|
|
6007
|
+
"aria-labelledby": labelledBy,
|
|
6008
|
+
"aria-label": labelledBy ? void 0 : ariaLabel ?? ariaProps["aria-label"],
|
|
6009
|
+
"aria-describedby": field?.describedBy ?? ariaProps["aria-describedby"],
|
|
6010
|
+
"aria-invalid": field ? field.invalid || void 0 : ariaProps["aria-invalid"],
|
|
6011
|
+
"aria-required": field ? field.required || void 0 : ariaProps["aria-required"],
|
|
5951
6012
|
onChange: (event) => setDraft(event.target.value),
|
|
5952
6013
|
onKeyDown,
|
|
5953
6014
|
onPaste,
|
|
@@ -6108,6 +6169,7 @@ var TimePicker = ({
|
|
|
6108
6169
|
minTime,
|
|
6109
6170
|
maxTime,
|
|
6110
6171
|
disabled,
|
|
6172
|
+
required,
|
|
6111
6173
|
fullWidth = true,
|
|
6112
6174
|
hourLabel: hourLabelProp,
|
|
6113
6175
|
minuteLabel: minuteLabelProp
|
|
@@ -6116,6 +6178,7 @@ var TimePicker = ({
|
|
|
6116
6178
|
const hourLabel = hourLabelProp ?? t("timePicker.hour");
|
|
6117
6179
|
const minuteLabel = minuteLabelProp ?? t("timePicker.minute");
|
|
6118
6180
|
const field = useFieldControl();
|
|
6181
|
+
const isRequired = field ? field.required || void 0 : required || void 0;
|
|
6119
6182
|
const groupId = React20.useId();
|
|
6120
6183
|
const constraintId = React20.useId();
|
|
6121
6184
|
const min = toMinutes(minTime) ?? 0;
|
|
@@ -6182,6 +6245,7 @@ var TimePicker = ({
|
|
|
6182
6245
|
options: hourOptions,
|
|
6183
6246
|
value: hour === null ? null : String(hour),
|
|
6184
6247
|
onValueChange: handleHourChange,
|
|
6248
|
+
required: isRequired,
|
|
6185
6249
|
disabled
|
|
6186
6250
|
}
|
|
6187
6251
|
),
|
|
@@ -6195,6 +6259,7 @@ var TimePicker = ({
|
|
|
6195
6259
|
options: minuteOptions,
|
|
6196
6260
|
value: minute === null ? null : String(minute),
|
|
6197
6261
|
onValueChange: handleMinuteChange,
|
|
6262
|
+
required: isRequired,
|
|
6198
6263
|
disabled: disabled || hour === null
|
|
6199
6264
|
}
|
|
6200
6265
|
)
|
|
@@ -6245,6 +6310,7 @@ var Toggle = ({
|
|
|
6245
6310
|
id: field?.inputId ?? props.id,
|
|
6246
6311
|
"aria-describedby": field?.describedBy ?? props["aria-describedby"],
|
|
6247
6312
|
"aria-invalid": field ? field.invalid || void 0 : props["aria-invalid"],
|
|
6313
|
+
"aria-required": field ? field.required || void 0 : props["aria-required"],
|
|
6248
6314
|
"aria-labelledby": field?.labelId,
|
|
6249
6315
|
"aria-label": field?.labelId ? void 0 : ariaLabel,
|
|
6250
6316
|
disabled,
|
|
@@ -5,31 +5,31 @@
|
|
|
5
5
|
* @version 1.0.0
|
|
6
6
|
* @license Bigtablet Inc. Open Source License - see LICENSE at the repo root
|
|
7
7
|
* (https://github.com/Bigtablet/.github/blob/main/BIGTABLET_LICENSE.md)
|
|
8
|
-
*/((A,x)=>{typeof exports=="object"&&typeof module<"u"?module.exports=x():typeof define=="function"&&define.amd?define(x):(A=A||self,A.Bigtablet=x());})(void 0,()=>{function A(t="bt"){return `${t}_${Math.random().toString(36).substring(2,9)}`}function x(t){return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function w(t,l,i,a){return t.addEventListener(l,i,a),()=>t.removeEventListener(l,i,a)}function L(t,l=document){return l.querySelector(t)}function _(t,l=document){return Array.from(l.querySelectorAll(t))}let R=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function Q(){let t=document.createElement("div");t.style.cssText="position:fixed;top:0;left:0;right:0;height:0;visibility:hidden;pointer-events:none",document.documentElement.appendChild(t);let l=t.getBoundingClientRect().width;return t.remove(),l<=0?0:Math.max(0,window.innerWidth-l)}let C=[];function z(t){if(t.key!=="Escape")return;let l=C[C.length-1];l&&(t.stopImmediatePropagation(),l());}function me(){}function J(t){C.length===0&&document.addEventListener("keydown",z),C.push(t);let l=false;return ()=>{if(l)return;l=true;let i=C.lastIndexOf(t);i!==-1&&C.splice(i,1),C.length===0&&document.removeEventListener("keydown",z);}}function Z(t,l){let i=l.dataset.btOriginalScrollbarWidthVar;i?t.style.setProperty("--bt-scrollbar-width",i):t.style.removeProperty("--bt-scrollbar-width");}function ee(){let t=document.body,l=document.documentElement,i=parseInt(t.dataset.btOpenModals||"0",10);if(i===0){let a=Q();if(t.dataset.btOriginalOverflow=t.style.overflow,t.dataset.btOriginalOverflowX=t.style.overflowX,t.dataset.btOriginalOverflowY=t.style.overflowY,t.dataset.btOriginalHtmlOverflow=l.style.overflow,t.dataset.btOriginalHtmlOverflowX=l.style.overflowX,t.dataset.btOriginalHtmlOverflowY=l.style.overflowY,t.dataset.btOriginalGutter=l.style.scrollbarGutter,t.dataset.btOriginalPaddingRight=t.style.paddingRight,t.dataset.btOriginalScrollbarWidthVar=l.style.getPropertyValue("--bt-scrollbar-width"),a>0&&l.style.setProperty("--bt-scrollbar-width",`${a}px`),t.style.overflow="hidden",l.style.overflow="hidden",a>0){l.style.scrollbarGutter="auto";let f=parseFloat(window.getComputedStyle(t).paddingRight)||0;t.style.paddingRight=`${f+a}px`,Q()>0&&(t.style.paddingRight=t.dataset.btOriginalPaddingRight||"",Z(l,t));}l.setAttribute("data-bt-scroll-locked","");}t.dataset.btOpenModals=String(i+1);}function W(){let t=document.body,l=document.documentElement,i=parseInt(t.dataset.btOpenModals||"1",10)-1;i<=0?(t.style.overflow=t.dataset.btOriginalOverflow||"",t.style.overflowX=t.dataset.btOriginalOverflowX||"",t.style.overflowY=t.dataset.btOriginalOverflowY||"",l.style.overflow=t.dataset.btOriginalHtmlOverflow||"",l.style.overflowX=t.dataset.btOriginalHtmlOverflowX||"",l.style.overflowY=t.dataset.btOriginalHtmlOverflowY||"",t.style.paddingRight=t.dataset.btOriginalPaddingRight||"",l.style.scrollbarGutter=t.dataset.btOriginalGutter||"",l.removeAttribute("data-bt-scroll-locked"),Z(l,t),delete t.dataset.btOpenModals,delete t.dataset.btOriginalOverflow,delete t.dataset.btOriginalOverflowX,delete t.dataset.btOriginalOverflowY,delete t.dataset.btOriginalHtmlOverflow,delete t.dataset.btOriginalHtmlOverflowX,delete t.dataset.btOriginalHtmlOverflowY,delete t.dataset.btOriginalGutter,delete t.dataset.btOriginalPaddingRight,delete t.dataset.btOriginalScrollbarWidthVar):t.dataset.btOpenModals=String(i);}function te(t){return String(t).toLowerCase().replace(/\s+/g,"")}function ne(t){if(t!==void 0)return t!=="false"}let ve='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>',ye='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg>';function ie(t,l={}){let i=typeof t=="string"?L(t):t;if(!i)return null;let a={placeholder:"Select...",disabled:false,multiple:false,searchable:false,searchPlaceholder:"\uAC80\uC0C9\u2026",emptyText:"\uACB0\uACFC \uC5C6\uC74C",selectedSummary:e=>`${e}\uAC1C \uC120\uD0DD`,onValueChange:null,...l};if(l.multiple===void 0){let e=ne(i.dataset.multiple);e!==void 0&&(a.multiple=e);}if(l.searchable===void 0){let e=ne(i.dataset.searchable);e!==void 0&&(a.searchable=e);}if(l.searchPlaceholder===void 0&&i.dataset.searchPlaceholder&&(a.searchPlaceholder=i.dataset.searchPlaceholder),l.emptyText===void 0&&i.dataset.emptyText&&(a.emptyText=i.dataset.emptyText),l.placeholder===void 0&&i.dataset.placeholder)a.placeholder=i.dataset.placeholder;else if(l.placeholder===void 0){let e=i.querySelector(".bt-dropdown__placeholder")?.textContent.trim();e&&(a.placeholder=e);}let f=a.multiple===true,b=a.searchable===true,n={isOpen:false,value:null,values:[],activeIndex:-1,options:[],visible:[],committedQuery:""},v=false,y=i.id||A("dropdown"),r=i.querySelector(".bt-dropdown__control"),s=i.querySelector(".bt-dropdown__list");if(!r||!s)return console.warn("Dropdown: Missing required elements (.bt-dropdown__control, .bt-dropdown__list)"),null;let c=s.querySelector(".bt-dropdown__options");if(!c)if(b){let e=s,o=Array.from(e.classList).filter(m=>m.startsWith("bt-dropdown__list")),d=document.createElement("div");d.className=o.join(" "),e.classList.remove(...o),e.classList.add("bt-dropdown__options"),e.style.display="",e.parentNode.insertBefore(d,e),d.appendChild(e),c=e,s=d;}else c=s;(r.disabled||r.classList.contains("is-disabled"))&&(a.disabled=true),r.disabled=a.disabled,r.setAttribute("aria-disabled",a.disabled?"true":"false"),r.classList.toggle("is-disabled",a.disabled);let h=()=>_(".bt-dropdown__option",c).map(e=>({value:e.dataset.value!==void 0?e.dataset.value:e.textContent.trim(),label:e.textContent.trim(),disabled:e.classList.contains("is-disabled")})),g;if(i.dataset.options)try{let e=JSON.parse(i.dataset.options);Array.isArray(e)?g=e:console.warn("Dropdown: data-options is not a JSON array");}catch(e){console.warn("Dropdown: invalid JSON in data-options",e);}g===void 0&&(g=Array.isArray(a.options)?a.options:h()),n.options=g;let u=_(".bt-dropdown__option",c);if(u.length===0&&n.options.length>0){let e=c.tagName==="UL"||c.tagName==="OL"?"li":"div";n.options.forEach(o=>{let d=document.createElement(e);d.className="bt-dropdown__option",o.disabled&&d.classList.add("is-disabled"),d.dataset.value=o.value,d.textContent=o.label,c.appendChild(d);}),u=_(".bt-dropdown__option",c);}c.id=c.id||`${y}_listbox`,c.setAttribute("role","listbox"),f&&c.setAttribute("aria-multiselectable","true"),r.setAttribute("aria-haspopup","listbox"),r.setAttribute("aria-expanded","false"),r.setAttribute("aria-controls",c.id),b?r.removeAttribute("role"):r.setAttribute("role","combobox"),u.forEach((e,o)=>{if(e.id=e.id||`${y}_option_${o}`,e.setAttribute("role","option"),e.setAttribute("aria-selected","false"),n.options[o]?.disabled&&e.setAttribute("aria-disabled","true"),f&&!e.querySelector(".bt-dropdown__option-check")){let d=document.createElement("span");d.className="bt-dropdown__option-check",d.setAttribute("aria-hidden","true"),d.innerHTML=ye,e.insertBefore(d,e.firstChild);}});let p=null,O=null;if(b){let e=s.querySelector(".bt-dropdown__search");if(!e){e=document.createElement("div"),e.className="bt-dropdown__search";let o=document.createElement("span");o.className="bt-dropdown__search-icon",o.setAttribute("aria-hidden","true"),o.innerHTML=ve,e.appendChild(o),s.insertBefore(e,s.firstChild);}if(p=e.querySelector(".bt-dropdown__search-input"),p||(p=document.createElement("input"),p.type="text",p.className="bt-dropdown__search-input",p.autocomplete="off",e.appendChild(p)),p.placeholder=a.searchPlaceholder,p.setAttribute("aria-label",a.searchPlaceholder),p.setAttribute("role","combobox"),p.setAttribute("aria-autocomplete","list"),p.setAttribute("aria-expanded","false"),p.setAttribute("aria-controls",c.id),O=c.querySelector(".bt-dropdown__empty"),!O){let o=c.tagName==="UL"||c.tagName==="OL"?"li":"div";O=document.createElement(o),O.className="bt-dropdown__empty",c.appendChild(O);}O.textContent=a.emptyText,O.hidden=true;}let H=()=>b?p:r,E=_('input[type="hidden"]',i),M=a.name||i.dataset.name||E[0]?.name||null;if(E.length===0&&M){let e=document.createElement("input");e.type="hidden",e.name=M,i.appendChild(e),E.push(e);}function xe(){if(!M)return;let e=f?n.values.map(o=>o==null?"":String(o)):[n.value==null?"":String(n.value)];for(;E.length>e.length;)E.pop().remove();for(;E.length<e.length;){let o=document.createElement("input");o.type="hidden",o.name=M,i.appendChild(o),E.push(o);}E.forEach((o,d)=>{o.value=e[d];});}function U(e){return n.options.find(o=>String(o.value)===String(e))}function X(e){return e===void 0?false:f?n.values.some(o=>String(o)===String(e)):n.value!=null&&String(n.value)===String(e)}function Ae(){return n.values.map(U).filter(Boolean)}function Y(){let e=r.querySelector(".bt-dropdown__value, .bt-dropdown__placeholder");if(e){let o=a.placeholder,d=false;if(f)d=n.values.length>0,d&&(o=a.selectedSummary(n.values.length));else {let m=U(n.value);d=!!m,m&&(o=m.label);}e.textContent=o,e.classList.toggle("bt-dropdown__value",d),e.classList.toggle("bt-dropdown__placeholder",!d);}u.forEach((o,d)=>{let m=X(n.options[d]?.value);o.classList.toggle("is-selected",m),o.setAttribute("aria-selected",m?"true":"false");}),xe();}function T(e){f?(n.values=e==null?[]:Array.isArray(e)?e.slice():[e],Y(),a.onValueChange&&a.onValueChange(n.values.slice(),Ae())):(n.value=Array.isArray(e)?e[0]??null:e,Y(),a.onValueChange&&a.onValueChange(n.value,U(n.value)??null));}function Ee(e){let o=X(e.value)?n.values.filter(d=>String(d)!==String(e.value)):[...n.values,e.value];T(o);}function $(){let e=null,o=null;u.forEach((m,I)=>{let N=I===n.activeIndex;m.classList.toggle("is-active",N),N&&(e=m.id,o=m);}),o?.scrollIntoView?.({block:"nearest"});let d=H();d&&(e?d.setAttribute("aria-activedescendant",e):d.removeAttribute("aria-activedescendant"));}function se(){return n.visible.find(e=>!n.options[e]?.disabled)??-1}function q(){let e=b?te(n.committedQuery):"";n.visible=[],u.forEach((o,d)=>{let m=n.options[d]?.label??o.textContent,I=e===""||te(m).includes(e);o.hidden=!I,I&&n.visible.push(d);}),O&&(O.hidden=n.visible.length>0),n.isOpen?n.visible.includes(n.activeIndex)||(n.activeIndex=se()):n.activeIndex=-1,$();}let D=null,B=null;function re(){D||(D={parent:s.parentNode,next:s.nextSibling},document.body.appendChild(s));let e=r.getBoundingClientRect(),o=4,d=8,m=window.innerWidth-d*2;s.style.minWidth=`${Math.min(e.width,m)}px`,s.style.maxWidth=`${m}px`;let I=s.offsetWidth,N=window.innerHeight-d*2;s.style.maxHeight="";let be=s.offsetHeight,j=Math.min(be,N);be>N&&(s.style.maxHeight=`${N}px`);let ge=window.innerHeight-e.bottom-o-d,Ie=e.top-o-d,he=j>ge&&Ie>ge;s.classList.toggle("bt-dropdown__list--up",he),s.style.left=`${de(e.left,I,window.innerWidth,d)}px`;let Ne=he?e.top-o-j:e.bottom+o;s.style.top=`${de(Ne,j,window.innerHeight,d)}px`;}function de(e,o,d,m){return Math.max(m,Math.min(e,d-m-o))}function Ce(){if(B)return;let e=0,o=()=>{e||(e=requestAnimationFrame(()=>{e=0,n.isOpen&&re();}));};window.addEventListener("scroll",o,true),window.addEventListener("resize",o),B=()=>{e&&cancelAnimationFrame(e),window.removeEventListener("scroll",o,true),window.removeEventListener("resize",o),B=null;};}function ce(){B?.(),D&&(D.parent?.insertBefore(s,D.next),D=null,s.style.left="",s.style.top="",s.style.minWidth="",s.style.maxWidth="",s.style.maxHeight="");}function k(){if(a.disabled||r.disabled)return;n.isOpen=true,r.classList.add("is-open"),r.setAttribute("aria-expanded","true"),s.style.display="block",p&&p.setAttribute("aria-expanded","true"),re(),Ce(),n.activeIndex=n.options.findIndex(o=>X(o.value)&&!o.disabled),q(),p&&p.focus();let e=r.querySelector(".bt-dropdown__icon");e&&e.classList.add("is-open");}function P(){n.isOpen=false,r.classList.remove("is-open"),r.setAttribute("aria-expanded","false"),r.removeAttribute("aria-activedescendant"),s.style.display="none",ce(),p&&(p.value="",p.setAttribute("aria-expanded","false"),p.removeAttribute("aria-activedescendant")),n.committedQuery="",v=false,n.activeIndex=-1,q();let e=r.querySelector(".bt-dropdown__icon");e&&e.classList.remove("is-open");}function F(){let e=n.isOpen;P(),e&&b&&r.focus();}function ue(){n.isOpen?P():k();}function V(e){let o=n.visible.filter(m=>!n.options[m]?.disabled);if(o.length===0)return;let d=o.indexOf(n.activeIndex);n.activeIndex=d===-1?e===1?o[0]:o[o.length-1]:o[(d+e+o.length)%o.length],$();}function fe(e){let o=n.options[e];!o||o.disabled||(f?Ee(o):(T(o.value),F()));}function pe(){n.visible.includes(n.activeIndex)&&fe(n.activeIndex);}function ke(e){e.preventDefault(),ue();}function Se(e){if(!a.disabled)switch(e.key){case " ":case "Enter":e.preventDefault(),n.isOpen?pe():k();break;case "ArrowDown":e.preventDefault(),n.isOpen?V(1):k();break;case "ArrowUp":e.preventDefault(),n.isOpen?V(-1):k();break;case "Home":e.preventDefault(),k(),n.activeIndex=se(),$();break;case "End":e.preventDefault(),k();for(let o=n.visible.length-1;o>=0;o--)if(!n.options[n.visible[o]]?.disabled){n.activeIndex=n.visible[o],$();break}break;case "Escape":e.preventDefault(),P();break;case "Tab":P();break}}function Le(e){if(!(e.isComposing||e.keyCode===229))switch(e.key){case "ArrowDown":e.preventDefault(),V(1);break;case "ArrowUp":e.preventDefault(),V(-1);break;case "Enter":e.preventDefault(),pe();break;case "Escape":e.preventDefault(),F();break;case "Tab":F();break}}function Te(e){!i.contains(e.target)&&!s.contains(e.target)&&P();}function De(e){return o=>{o.preventDefault(),fe(e);}}function Pe(e){return ()=>{n.options[e]?.disabled||(n.activeIndex=e,$());}}let S=[w(r,"click",ke),w(r,"keydown",Se),w(document,"mousedown",Te)];u.forEach((e,o)=>{S.push(w(e,"click",De(o))),S.push(w(e,"mouseenter",Pe(o)));}),p&&(S.push(w(p,"compositionstart",()=>{v=true;})),S.push(w(p,"compositionend",e=>{v=false,n.committedQuery=e.target.value,q();})),S.push(w(p,"input",e=>{v||(n.committedQuery=e.target.value,q());})),S.push(w(p,"keydown",Le)));let G=E.map(e=>e.value).filter(e=>e!=="");if(s.style.display="none",q(),Y(),f){let e=Array.isArray(a.defaultValue)?a.defaultValue:a.defaultValue!=null?[a.defaultValue]:G;e.length>0&&T(e);}else a.defaultValue!=null?T(a.defaultValue):G[0]&&T(G[0]);return {getValue:()=>f?n.values.slice():n.value,setValue:T,open:k,close:P,toggle:ue,setDisabled:e=>{a.disabled=e,r.disabled=e,r.setAttribute("aria-disabled",e?"true":"false"),r.classList.toggle("is-disabled",e);},destroy:()=>{ce(),S.forEach(e=>{e();});}}}function ae(t,l={}){let i=typeof t=="string"?L(t):t;if(!i)return null;let a={closeOnOverlay:true,closeOnEscape:true,onOpen:null,onClose:null,...l},f={isOpen:false},b=i.querySelector(".bt-modal__panel"),n=null,v=false,y=null;if(b&&(b.setAttribute("role","dialog"),b.setAttribute("aria-modal","true"),!b.hasAttribute("aria-label")&&!b.hasAttribute("aria-labelledby"))){let u=b.querySelector(".bt-modal__header");u?(u.id=u.id||A("modal_title"),b.setAttribute("aria-labelledby",u.id)):b.setAttribute("aria-label","Dialog");}function r(){if(!f.isOpen){if(f.isOpen=true,i.classList.add("is-open"),ee(),y=J(a.closeOnEscape?s:me),n=document.activeElement,b){let u=b.querySelector(R);u?u.focus():(b.setAttribute("tabindex","-1"),v=true,b.focus());}a.onOpen&&a.onOpen();}}function s(){f.isOpen&&(f.isOpen=false,i.classList.remove("is-open"),y&&(y(),y=null),W(),v&&b&&(b.removeAttribute("tabindex"),v=false),n&&typeof n.focus=="function"&&n.focus(),n=null,a.onClose&&a.onClose());}function c(u){a.closeOnOverlay&&u.target===i&&s();}function h(u){if(f.isOpen&&u.key==="Tab"&&b){let p=_(R,b);if(p.length===0){u.preventDefault();return}let O=p[0],H=p[p.length-1];u.shiftKey&&document.activeElement===O?(u.preventDefault(),H.focus()):!u.shiftKey&&document.activeElement===H&&(u.preventDefault(),O.focus());}}let g=[w(i,"click",c),w(document,"keydown",h)];return _("[data-modal-close]",i).forEach(u=>{g.push(w(u,"click",s));}),{isOpen:()=>f.isOpen,open:r,close:s,toggle:()=>f.isOpen?s():r(),destroy:()=>{g.forEach(u=>{u();}),f.isOpen&&(f.isOpen=false,y&&(y(),y=null),W());}}}let we="bt-button--filled",_e="bt-button--outline";function Oe(t={}){let l={title:"",message:"",variant:"info",confirmText:"\uD655\uC778",cancelText:"\uCDE8\uC18C",showCancel:false,destructive:false,actionsAlign:"right",closeOnOverlay:true,onConfirm:null,onCancel:null,...t},i=document.createElement("div");i.className=`bt-alert__overlay bt-alert--${l.variant} is-open`,i.innerHTML=`
|
|
8
|
+
*/((E,A)=>{typeof exports=="object"&&typeof module<"u"?module.exports=A():typeof define=="function"&&define.amd?define(A):(E=E||self,E.Bigtablet=A());})(void 0,()=>{function E(t="bt"){return `${t}_${Math.random().toString(36).substring(2,9)}`}function A(t){return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function w(t,l,i,a){return t.addEventListener(l,i,a),()=>t.removeEventListener(l,i,a)}function L(t,l=document){return l.querySelector(t)}function _(t,l=document){return Array.from(l.querySelectorAll(t))}let R=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function j(){let t=document.createElement("div");t.style.cssText="position:fixed;top:0;left:0;right:0;height:0;visibility:hidden;pointer-events:none",document.documentElement.appendChild(t);let l=t.getBoundingClientRect().width;return t.remove(),l<=0?0:Math.max(0,window.innerWidth-l)}let C=[];function Q(t){if(t.key!=="Escape")return;let l=C[C.length-1];l&&(t.stopImmediatePropagation(),l());}function me(){}function z(t){C.length===0&&document.addEventListener("keydown",Q),C.push(t);let l=false;return ()=>{if(l)return;l=true;let i=C.lastIndexOf(t);i!==-1&&C.splice(i,1),C.length===0&&document.removeEventListener("keydown",Q);}}function J(t,l){let i=l.dataset.btOriginalScrollbarWidthVar;i?t.style.setProperty("--bt-scrollbar-width",i):t.style.removeProperty("--bt-scrollbar-width");}function Z(){let t=document.body,l=document.documentElement,i=parseInt(t.dataset.btOpenModals||"0",10);if(i===0){let a=j();if(t.dataset.btOriginalOverflow=t.style.overflow,t.dataset.btOriginalOverflowX=t.style.overflowX,t.dataset.btOriginalOverflowY=t.style.overflowY,t.dataset.btOriginalHtmlOverflow=l.style.overflow,t.dataset.btOriginalHtmlOverflowX=l.style.overflowX,t.dataset.btOriginalHtmlOverflowY=l.style.overflowY,t.dataset.btOriginalGutter=l.style.scrollbarGutter,t.dataset.btOriginalPaddingRight=t.style.paddingRight,t.dataset.btOriginalScrollbarWidthVar=l.style.getPropertyValue("--bt-scrollbar-width"),a>0&&l.style.setProperty("--bt-scrollbar-width",`${a}px`),t.style.overflow="hidden",l.style.overflow="hidden",a>0){l.style.scrollbarGutter="auto";let f=parseFloat(window.getComputedStyle(t).paddingRight)||0;t.style.paddingRight=`${f+a}px`,j()>0&&(t.style.paddingRight=t.dataset.btOriginalPaddingRight||"",J(l,t));}l.setAttribute("data-bt-scroll-locked","");}t.dataset.btOpenModals=String(i+1);}function ee(){let t=document.body,l=document.documentElement,i=parseInt(t.dataset.btOpenModals||"1",10)-1;i<=0?(t.style.overflow=t.dataset.btOriginalOverflow||"",t.style.overflowX=t.dataset.btOriginalOverflowX||"",t.style.overflowY=t.dataset.btOriginalOverflowY||"",l.style.overflow=t.dataset.btOriginalHtmlOverflow||"",l.style.overflowX=t.dataset.btOriginalHtmlOverflowX||"",l.style.overflowY=t.dataset.btOriginalHtmlOverflowY||"",t.style.paddingRight=t.dataset.btOriginalPaddingRight||"",l.style.scrollbarGutter=t.dataset.btOriginalGutter||"",l.removeAttribute("data-bt-scroll-locked"),J(l,t),delete t.dataset.btOpenModals,delete t.dataset.btOriginalOverflow,delete t.dataset.btOriginalOverflowX,delete t.dataset.btOriginalOverflowY,delete t.dataset.btOriginalHtmlOverflow,delete t.dataset.btOriginalHtmlOverflowX,delete t.dataset.btOriginalHtmlOverflowY,delete t.dataset.btOriginalGutter,delete t.dataset.btOriginalPaddingRight,delete t.dataset.btOriginalScrollbarWidthVar):t.dataset.btOpenModals=String(i);}function te(t){return String(t).toLowerCase().replace(/\s+/g,"")}function ne(t){if(t!==void 0)return t!=="false"}let ve='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>',ye='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg>';function ie(t,l={}){let i=typeof t=="string"?L(t):t;if(!i)return null;let a={placeholder:"Select...",disabled:false,multiple:false,searchable:false,searchPlaceholder:"\uAC80\uC0C9\u2026",emptyText:"\uACB0\uACFC \uC5C6\uC74C",selectedSummary:e=>`${e}\uAC1C \uC120\uD0DD`,onValueChange:null,...l};if(l.multiple===void 0){let e=ne(i.dataset.multiple);e!==void 0&&(a.multiple=e);}if(l.searchable===void 0){let e=ne(i.dataset.searchable);e!==void 0&&(a.searchable=e);}if(l.searchPlaceholder===void 0&&i.dataset.searchPlaceholder&&(a.searchPlaceholder=i.dataset.searchPlaceholder),l.emptyText===void 0&&i.dataset.emptyText&&(a.emptyText=i.dataset.emptyText),l.placeholder===void 0&&i.dataset.placeholder)a.placeholder=i.dataset.placeholder;else if(l.placeholder===void 0){let e=i.querySelector(".bt-dropdown__placeholder")?.textContent.trim();e&&(a.placeholder=e);}let f=a.multiple===true,p=a.searchable===true,n={isOpen:false,value:null,values:[],activeIndex:-1,options:[],visible:[],committedQuery:""},v=false,y=i.id||E("dropdown"),r=i.querySelector(".bt-dropdown__control"),s=i.querySelector(".bt-dropdown__list");if(!r||!s)return console.warn("Dropdown: Missing required elements (.bt-dropdown__control, .bt-dropdown__list)"),null;let c=s.querySelector(".bt-dropdown__options");if(!c)if(p){let e=s,o=Array.from(e.classList).filter(m=>m.startsWith("bt-dropdown__list")),u=document.createElement("div");u.className=o.join(" "),e.classList.remove(...o),e.classList.add("bt-dropdown__options"),e.style.display="",e.parentNode.insertBefore(u,e),u.appendChild(e),c=e,s=u;}else c=s;(r.disabled||r.classList.contains("is-disabled"))&&(a.disabled=true),r.disabled=a.disabled,r.setAttribute("aria-disabled",a.disabled?"true":"false"),r.classList.toggle("is-disabled",a.disabled);let g=()=>_(".bt-dropdown__option",c).map(e=>({value:e.dataset.value!==void 0?e.dataset.value:e.textContent.trim(),label:e.textContent.trim(),disabled:e.classList.contains("is-disabled")})),b;if(i.dataset.options)try{let e=JSON.parse(i.dataset.options);Array.isArray(e)?b=e:console.warn("Dropdown: data-options is not a JSON array");}catch(e){console.warn("Dropdown: invalid JSON in data-options",e);}b===void 0&&(b=Array.isArray(a.options)?a.options:g()),n.options=b;let h=_(".bt-dropdown__option",c);if(h.length===0&&n.options.length>0){let e=c.tagName==="UL"||c.tagName==="OL"?"li":"div";n.options.forEach(o=>{let u=document.createElement(e);u.className="bt-dropdown__option",o.disabled&&u.classList.add("is-disabled"),u.dataset.value=o.value,u.textContent=o.label,c.appendChild(u);}),h=_(".bt-dropdown__option",c);}c.id=c.id||`${y}_listbox`,c.setAttribute("role","listbox"),f&&c.setAttribute("aria-multiselectable","true"),r.setAttribute("aria-haspopup","listbox"),r.setAttribute("aria-expanded","false"),r.setAttribute("aria-controls",c.id),p?r.removeAttribute("role"):r.setAttribute("role","combobox"),h.forEach((e,o)=>{if(e.id=e.id||`${y}_option_${o}`,e.setAttribute("role","option"),e.setAttribute("aria-selected","false"),n.options[o]?.disabled&&e.setAttribute("aria-disabled","true"),f&&!e.querySelector(".bt-dropdown__option-check")){let u=document.createElement("span");u.className="bt-dropdown__option-check",u.setAttribute("aria-hidden","true"),u.innerHTML=ye,e.insertBefore(u,e.firstChild);}});let d=null,O=null;if(p){let e=s.querySelector(".bt-dropdown__search");if(!e){e=document.createElement("div"),e.className="bt-dropdown__search";let o=document.createElement("span");o.className="bt-dropdown__search-icon",o.setAttribute("aria-hidden","true"),o.innerHTML=ve,e.appendChild(o),s.insertBefore(e,s.firstChild);}if(d=e.querySelector(".bt-dropdown__search-input"),d||(d=document.createElement("input"),d.type="text",d.className="bt-dropdown__search-input",d.autocomplete="off",e.appendChild(d)),d.placeholder=a.searchPlaceholder,d.setAttribute("aria-label",a.searchPlaceholder),d.setAttribute("role","combobox"),d.setAttribute("aria-autocomplete","list"),d.setAttribute("aria-expanded","false"),d.setAttribute("aria-controls",c.id),O=c.querySelector(".bt-dropdown__empty"),!O){let o=c.tagName==="UL"||c.tagName==="OL"?"li":"div";O=document.createElement(o),O.className="bt-dropdown__empty",c.appendChild(O);}O.textContent=a.emptyText,O.hidden=true;}let H=()=>p?d:r,x=_('input[type="hidden"]',i),M=a.name||i.dataset.name||x[0]?.name||null;if(x.length===0&&M){let e=document.createElement("input");e.type="hidden",e.name=M,i.appendChild(e),x.push(e);}function xe(){if(!M)return;let e=f?n.values.map(o=>o==null?"":String(o)):[n.value==null?"":String(n.value)];for(;x.length>e.length;)x.pop().remove();for(;x.length<e.length;){let o=document.createElement("input");o.type="hidden",o.name=M,i.appendChild(o),x.push(o);}x.forEach((o,u)=>{o.value=e[u];});}function K(e){return n.options.find(o=>String(o.value)===String(e))}function U(e){return e===void 0?false:f?n.values.some(o=>String(o)===String(e)):n.value!=null&&String(n.value)===String(e)}function Ae(){return n.values.map(K).filter(Boolean)}function X(){let e=r.querySelector(".bt-dropdown__value, .bt-dropdown__placeholder");if(e){let o=a.placeholder,u=false;if(f)u=n.values.length>0,u&&(o=a.selectedSummary(n.values.length));else {let m=K(n.value);u=!!m,m&&(o=m.label);}e.textContent=o,e.classList.toggle("bt-dropdown__value",u),e.classList.toggle("bt-dropdown__placeholder",!u);}h.forEach((o,u)=>{let m=U(n.options[u]?.value);o.classList.toggle("is-selected",m),o.setAttribute("aria-selected",m?"true":"false");}),xe();}function T(e){f?(n.values=e==null?[]:Array.isArray(e)?e.slice():[e],X(),a.onValueChange&&a.onValueChange(n.values.slice(),Ae())):(n.value=Array.isArray(e)?e[0]??null:e,X(),a.onValueChange&&a.onValueChange(n.value,K(n.value)??null));}function Ee(e){let o=U(e.value)?n.values.filter(u=>String(u)!==String(e.value)):[...n.values,e.value];T(o);}function $(){let e=null,o=null;h.forEach((m,I)=>{let N=I===n.activeIndex;m.classList.toggle("is-active",N),N&&(e=m.id,o=m);}),o?.scrollIntoView?.({block:"nearest"});let u=H();u&&(e?u.setAttribute("aria-activedescendant",e):u.removeAttribute("aria-activedescendant"));}function se(){return n.visible.find(e=>!n.options[e]?.disabled)??-1}function q(){let e=p?te(n.committedQuery):"";n.visible=[],h.forEach((o,u)=>{let m=n.options[u]?.label??o.textContent,I=e===""||te(m).includes(e);o.hidden=!I,I&&n.visible.push(u);}),O&&(O.hidden=n.visible.length>0),n.isOpen?n.visible.includes(n.activeIndex)||(n.activeIndex=se()):n.activeIndex=-1,$();}let D=null,B=null;function re(){D||(D={parent:s.parentNode,next:s.nextSibling},document.body.appendChild(s));let e=r.getBoundingClientRect(),o=4,u=8,m=window.innerWidth-u*2;s.style.minWidth=`${Math.min(e.width,m)}px`,s.style.maxWidth=`${m}px`;let I=s.offsetWidth,N=window.innerHeight-u*2;s.style.maxHeight="";let be=s.offsetHeight,G=Math.min(be,N);be>N&&(s.style.maxHeight=`${N}px`);let ge=window.innerHeight-e.bottom-o-u,Ie=e.top-o-u,he=G>ge&&Ie>ge;s.classList.toggle("bt-dropdown__list--up",he),s.style.left=`${de(e.left,I,window.innerWidth,u)}px`;let Ne=he?e.top-o-G:e.bottom+o;s.style.top=`${de(Ne,G,window.innerHeight,u)}px`;}function de(e,o,u,m){return Math.max(m,Math.min(e,u-m-o))}function Ce(){if(B)return;let e=0,o=()=>{e||(e=requestAnimationFrame(()=>{e=0,n.isOpen&&re();}));};window.addEventListener("scroll",o,true),window.addEventListener("resize",o),B=()=>{e&&cancelAnimationFrame(e),window.removeEventListener("scroll",o,true),window.removeEventListener("resize",o),B=null;};}function ce(){B?.(),D&&(D.parent?.insertBefore(s,D.next),D=null,s.style.left="",s.style.top="",s.style.minWidth="",s.style.maxWidth="",s.style.maxHeight="");}function k(){if(a.disabled||r.disabled)return;n.isOpen=true,r.classList.add("is-open"),r.setAttribute("aria-expanded","true"),s.style.display="block",d&&d.setAttribute("aria-expanded","true"),re(),Ce(),n.activeIndex=n.options.findIndex(o=>U(o.value)&&!o.disabled),q(),d&&d.focus();let e=r.querySelector(".bt-dropdown__icon");e&&e.classList.add("is-open");}function P(){n.isOpen=false,r.classList.remove("is-open"),r.setAttribute("aria-expanded","false"),r.removeAttribute("aria-activedescendant"),s.style.display="none",ce(),d&&(d.value="",d.setAttribute("aria-expanded","false"),d.removeAttribute("aria-activedescendant")),n.committedQuery="",v=false,n.activeIndex=-1,q();let e=r.querySelector(".bt-dropdown__icon");e&&e.classList.remove("is-open");}function Y(){let e=n.isOpen;P(),e&&p&&r.focus();}function ue(){n.isOpen?P():k();}function V(e){let o=n.visible.filter(m=>!n.options[m]?.disabled);if(o.length===0)return;let u=o.indexOf(n.activeIndex);n.activeIndex=u===-1?e===1?o[0]:o[o.length-1]:o[(u+e+o.length)%o.length],$();}function fe(e){let o=n.options[e];!o||o.disabled||(f?Ee(o):(T(o.value),Y()));}function pe(){n.visible.includes(n.activeIndex)&&fe(n.activeIndex);}function ke(e){e.preventDefault(),ue();}function Se(e){if(!a.disabled)switch(e.key){case " ":case "Enter":e.preventDefault(),n.isOpen?pe():k();break;case "ArrowDown":e.preventDefault(),n.isOpen?V(1):k();break;case "ArrowUp":e.preventDefault(),n.isOpen?V(-1):k();break;case "Home":e.preventDefault(),k(),n.activeIndex=se(),$();break;case "End":e.preventDefault(),k();for(let o=n.visible.length-1;o>=0;o--)if(!n.options[n.visible[o]]?.disabled){n.activeIndex=n.visible[o],$();break}break;case "Escape":e.preventDefault(),P();break;case "Tab":P();break}}function Le(e){if(!(e.isComposing||e.keyCode===229))switch(e.key){case "ArrowDown":e.preventDefault(),V(1);break;case "ArrowUp":e.preventDefault(),V(-1);break;case "Enter":e.preventDefault(),pe();break;case "Escape":e.preventDefault(),Y();break;case "Tab":Y();break}}function Te(e){!i.contains(e.target)&&!s.contains(e.target)&&P();}function De(e){return o=>{o.preventDefault(),fe(e);}}function Pe(e){return ()=>{n.options[e]?.disabled||(n.activeIndex=e,$());}}let S=[w(r,"click",ke),w(r,"keydown",Se),w(document,"mousedown",Te)];h.forEach((e,o)=>{S.push(w(e,"click",De(o))),S.push(w(e,"mouseenter",Pe(o)));}),d&&(S.push(w(d,"compositionstart",()=>{v=true;})),S.push(w(d,"compositionend",e=>{v=false,n.committedQuery=e.target.value,q();})),S.push(w(d,"input",e=>{v||(n.committedQuery=e.target.value,q());})),S.push(w(d,"keydown",Le)));let F=x.map(e=>e.value).filter(e=>e!=="");if(s.style.display="none",q(),X(),f){let e=Array.isArray(a.defaultValue)?a.defaultValue:a.defaultValue!=null?[a.defaultValue]:F;e.length>0&&T(e);}else a.defaultValue!=null?T(a.defaultValue):F[0]&&T(F[0]);return {getValue:()=>f?n.values.slice():n.value,setValue:T,open:k,close:P,toggle:ue,setDisabled:e=>{a.disabled=e,r.disabled=e,r.setAttribute("aria-disabled",e?"true":"false"),r.classList.toggle("is-disabled",e);},destroy:()=>{ce(),S.forEach(e=>{e();});}}}function ae(t,l={}){let i=typeof t=="string"?L(t):t;if(!i)return null;let a={closeOnOverlay:true,closeOnEscape:true,onOpen:null,onClose:null,...l},f={isOpen:false},p=i.querySelector(".bt-modal__panel"),n=null,v=false,y=null;if(p&&(p.setAttribute("role","dialog"),p.setAttribute("aria-modal","true"),!p.hasAttribute("aria-label")&&!p.hasAttribute("aria-labelledby"))){let d=p.querySelector(".bt-modal__header");d?(d.id=d.id||E("modal_title"),p.setAttribute("aria-labelledby",d.id)):p.setAttribute("aria-label","Dialog");}function r(){if(!f.isOpen){if(f.isOpen=true,i.classList.add("is-open"),Z(),y=z(a.closeOnEscape?c:me),n=document.activeElement,p){let d=p.querySelector(R);d?d.focus():(p.hasAttribute("tabindex")||(p.setAttribute("tabindex","-1"),v=true),p.focus());}a.onOpen&&a.onOpen();}}function s(){f.isOpen=false,i.classList.remove("is-open"),y&&(y(),y=null),ee(),v&&p&&(p.removeAttribute("tabindex"),v=false),n&&typeof n.focus=="function"&&n.focus(),n=null;}function c(){f.isOpen&&(s(),a.onClose&&a.onClose());}function g(d){a.closeOnOverlay&&d.target===i&&c();}function b(d){if(f.isOpen&&d.key==="Tab"&&p){let O=_(R,p);if(O.length===0){d.preventDefault();return}let H=O[0],x=O[O.length-1];d.shiftKey&&document.activeElement===H?(d.preventDefault(),x.focus()):!d.shiftKey&&document.activeElement===x&&(d.preventDefault(),H.focus());}}let h=[w(i,"click",g),w(document,"keydown",b)];return _("[data-modal-close]",i).forEach(d=>{h.push(w(d,"click",c));}),{isOpen:()=>f.isOpen,open:r,close:c,toggle:()=>f.isOpen?c():r(),destroy:()=>{h.forEach(d=>{d();}),f.isOpen&&s();}}}let we="bt-button--filled",_e="bt-button--outline";function Oe(t={}){let l={title:"",message:"",variant:"info",confirmText:"\uD655\uC778",cancelText:"\uCDE8\uC18C",showCancel:false,destructive:false,actionsAlign:"right",closeOnOverlay:true,onConfirm:null,onCancel:null,...t},i=document.createElement("div");i.className=`bt-alert__overlay bt-alert--${l.variant} is-open`,i.innerHTML=`
|
|
9
9
|
<div class="bt-alert__modal">
|
|
10
|
-
${l.title?`<div class="bt-alert__title">${
|
|
11
|
-
<div class="bt-alert__message">${
|
|
10
|
+
${l.title?`<div class="bt-alert__title">${A(l.title)}</div>`:""}
|
|
11
|
+
<div class="bt-alert__message">${A(l.message)}</div>
|
|
12
12
|
<div class="bt-alert__actions" style="justify-content: ${l.actionsAlign==="left"?"flex-start":l.actionsAlign==="center"?"center":"flex-end"}">
|
|
13
|
-
${l.showCancel?`<button class="bt-button bt-button--md ${_e}" data-alert-cancel>${
|
|
14
|
-
<button class="bt-button bt-button--md ${we}${l.destructive?" bt-button--danger":""}" data-alert-confirm>${
|
|
13
|
+
${l.showCancel?`<button class="bt-button bt-button--md ${_e}" data-alert-cancel>${A(l.cancelText)}</button>`:""}
|
|
14
|
+
<button class="bt-button bt-button--md ${we}${l.destructive?" bt-button--danger":""}" data-alert-confirm>${A(l.confirmText)}</button>
|
|
15
15
|
</div>
|
|
16
16
|
</div>
|
|
17
|
-
`;let a=i.querySelector(".bt-alert__modal");if(a){a.setAttribute("role","alertdialog"),a.setAttribute("aria-modal","true");let
|
|
17
|
+
`;let a=i.querySelector(".bt-alert__modal");if(a){a.setAttribute("role","alertdialog"),a.setAttribute("aria-modal","true");let g=i.querySelector(".bt-alert__title"),b=i.querySelector(".bt-alert__message");g&&(g.id=E("alert_title"),a.setAttribute("aria-labelledby",g.id)),b&&(b.id=E("alert_message"),a.setAttribute("aria-describedby",b.id));}let f=document.activeElement;document.body.appendChild(i),Z();let p=true,n=z(y);function v(){p&&(p=false,n(),document.removeEventListener("keydown",c),i.classList.remove("is-open"),f&&typeof f.focus=="function"&&f.focus(),setTimeout(()=>{i.remove(),ee();},200));}function y(){p&&(l.onCancel&&l.onCancel(),v());}let r=i.querySelector("[data-alert-confirm]"),s=i.querySelector("[data-alert-cancel]");r&&r.addEventListener("click",()=>{l.onConfirm&&l.onConfirm(),v();}),s&&s.addEventListener("click",()=>{l.onCancel&&l.onCancel(),v();}),i.addEventListener("click",g=>{l.closeOnOverlay&&g.target===i&&y();});function c(g){if(g.key==="Tab"&&a){let b=_(R,a);if(b.length===0){g.preventDefault();return}let h=b[0],d=b[b.length-1];g.shiftKey&&document.activeElement===h?(g.preventDefault(),d.focus()):!g.shiftKey&&document.activeElement===d&&(g.preventDefault(),h.focus());}}return document.addEventListener("keydown",c),r&&r.focus(),{close:v}}function oe(t,l={}){let i=typeof t=="string"?L(t):t;if(!i)return null;let a={defaultChecked:false,disabled:false,onCheckedChange:null,...l},f={checked:a.defaultChecked||i.classList.contains("bt-toggle--on")};i.disabled&&(a.disabled=true),i.disabled=a.disabled,i.hasAttribute("role")||i.setAttribute("role","switch"),i.tagName==="BUTTON"&&!i.hasAttribute("type")&&i.setAttribute("type","button");let p=a.name||i.dataset.name||null,n=i.querySelector('input[type="hidden"]')||(p&&i.parentNode?Array.from(i.parentNode.children).find(s=>s.tagName==="INPUT"&&s.type==="hidden"&&s.name===p):null);!n&&p&&(n=document.createElement("input"),n.type="hidden",n.name=p,i.tagName==="BUTTON"&&i.parentNode?i.parentNode.insertBefore(n,i.nextSibling):i.appendChild(n));function v(s){f.checked=s,i.classList.toggle("bt-toggle--on",s),i.setAttribute("aria-checked",s?"true":"false"),n&&(n.value=s?"true":"false"),a.onCheckedChange&&a.onCheckedChange(s);}function y(){!a.disabled&&!i.disabled&&v(!f.checked);}let r=w(i,"click",y);if(n&&!f.checked){let s=String(n.value).trim().toLowerCase();(s==="true"||s==="1"||s==="on"||s==="y"||s==="yes")&&(f.checked=true);}return i.classList.toggle("bt-toggle--on",f.checked),i.setAttribute("aria-checked",f.checked?"true":"false"),n&&(n.value=f.checked?"true":"false"),{isChecked:()=>f.checked,setChecked:v,toggle:y,setDisabled:s=>{a.disabled=s,i.disabled=s;},destroy:()=>r()}}function le(t,l={}){let i=typeof t=="string"?L(t):t;if(!i)return null;let a={page:1,totalPages:1,sibling:2,onPageChange:null,...l};function f(r,s){let c=[];for(let g=r;g<=s;g++)c.push(g);return c}function p(r,s){if(s<=7)return f(1,s);let c=[],g=s,b=a.sibling;if(r<=b+2){for(let h of f(1,b+3))c.push(h);return c.push("ellipsis"),c.push(g),c}if(r>=g-b-1){c.push(1),c.push("ellipsis");for(let h of f(g-b-2,g))c.push(h);return c}c.push(1),c.push("ellipsis");for(let h of f(r-b,r+b))c.push(h);return c.push("ellipsis"),c.push(g),c}function n(){let r=p(a.page,a.totalPages),s=`
|
|
18
18
|
<button class="bt-pagination__item" ${a.page<=1?"disabled":""} data-action="prev" aria-label="Previous page">
|
|
19
19
|
\u2039
|
|
20
20
|
</button>
|
|
21
21
|
<div class="bt-pagination__pages">
|
|
22
|
-
`;r.forEach((
|
|
22
|
+
`;r.forEach((b,h)=>{if(b==="ellipsis")s+='<span class="bt-pagination__ellipsis" aria-hidden="true">\u2026</span>';else {let d=b===a.page;s+=`
|
|
23
23
|
<button
|
|
24
|
-
class="bt-pagination__page${
|
|
25
|
-
data-page="${
|
|
26
|
-
${
|
|
24
|
+
class="bt-pagination__page${d?" bt-pagination__page--active":""}"
|
|
25
|
+
data-page="${A(b)}"
|
|
26
|
+
${d?'aria-current="page"':""}
|
|
27
27
|
>
|
|
28
|
-
${
|
|
28
|
+
${A(b)}
|
|
29
29
|
</button>
|
|
30
30
|
`;}}),s+=`
|
|
31
31
|
</div>
|
|
32
32
|
<button class="bt-pagination__item" ${a.page>=a.totalPages?"disabled":""} data-action="next" aria-label="Next page">
|
|
33
33
|
\u203A
|
|
34
34
|
</button>
|
|
35
|
-
`,i.innerHTML=s,_("[data-page]",i).forEach(
|
|
35
|
+
`,i.innerHTML=s,_("[data-page]",i).forEach(b=>{b.addEventListener("click",()=>{let h=parseInt(b.dataset.page,10);v(h);});});let c=i.querySelector('[data-action="prev"]'),g=i.querySelector('[data-action="next"]');c&&c.addEventListener("click",()=>v(a.page-1)),g&&g.addEventListener("click",()=>v(a.page+1));}function v(r){r<1||r>a.totalPages||r===a.page||(a.page=r,n(),a.onPageChange&&a.onPageChange(r));}function y(r){a.totalPages=r,a.page>r&&(a.page=r),n();}return n(),{getPage:()=>a.page,setPage:v,setTotalPages:y,render:n}}function W(){_("[data-bt-dropdown]").forEach(t=>{t._btDropdown||(t._btDropdown=ie(t));}),_("[data-bt-modal]").forEach(t=>{t._btModal||(t._btModal=ae(t));}),_("[data-bt-modal-open]").forEach(t=>{if(t.dataset.btBound)return;let l=t.dataset.btModalOpen,i=L(`#${l}`);i?._btModal&&(t.dataset.btBound="true",t.addEventListener("click",()=>i._btModal.open()));}),_("[data-bt-toggle]").forEach(t=>{t._btToggle||(t._btToggle=oe(t));}),_("[data-bt-pagination]").forEach(t=>{if(!t._btPagination){let l=parseInt(t.dataset.page,10)||1,i=parseInt(t.dataset.totalPages,10)||1;t._btPagination=le(t,{page:l,totalPages:i});}});}return typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",W):W()),{Dropdown:ie,Modal:ae,Alert:Oe,Toggle:oe,Pagination:le,init:W,generateId:E,$:L,$$:_,on:w,version:"1.0.0"}});})();
|