@x-plat/design-system 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AutoResizeTextArea/index.cjs +14 -5
- package/dist/components/AutoResizeTextArea/index.css +15 -0
- package/dist/components/AutoResizeTextArea/index.d.cts +5 -0
- package/dist/components/AutoResizeTextArea/index.d.ts +5 -0
- package/dist/components/AutoResizeTextArea/index.js +14 -5
- package/dist/components/Badge/index.cjs +5 -1
- package/dist/components/Badge/index.css +1 -0
- package/dist/components/Badge/index.d.cts +1 -0
- package/dist/components/Badge/index.d.ts +1 -0
- package/dist/components/Badge/index.js +5 -1
- package/dist/components/Box/index.d.cts +3 -0
- package/dist/components/Box/index.d.ts +3 -0
- package/dist/components/Chart/index.cjs +7 -6
- package/dist/components/Chart/index.d.cts +12 -1
- package/dist/components/Chart/index.d.ts +12 -1
- package/dist/components/Chart/index.js +7 -6
- package/dist/components/ChatInput/index.cjs +20 -7
- package/dist/components/ChatInput/index.css +15 -0
- package/dist/components/ChatInput/index.d.cts +10 -0
- package/dist/components/ChatInput/index.d.ts +10 -0
- package/dist/components/ChatInput/index.js +20 -7
- package/dist/components/CheckBox/index.cjs +14 -5
- package/dist/components/CheckBox/index.css +17 -0
- package/dist/components/CheckBox/index.d.cts +10 -2
- package/dist/components/CheckBox/index.d.ts +10 -2
- package/dist/components/CheckBox/index.js +14 -5
- package/dist/components/Chip/index.d.cts +2 -0
- package/dist/components/Chip/index.d.ts +2 -0
- package/dist/components/DatePicker/index.cjs +181 -65
- package/dist/components/DatePicker/index.css +19 -0
- package/dist/components/DatePicker/index.js +181 -65
- package/dist/components/Drawer/index.cjs +83 -4
- package/dist/components/Drawer/index.d.cts +1 -0
- package/dist/components/Drawer/index.d.ts +1 -0
- package/dist/components/Drawer/index.js +83 -4
- package/dist/components/Dropdown/index.cjs +35 -7
- package/dist/components/Dropdown/index.js +35 -7
- package/dist/components/Editor/index.cjs +178 -21
- package/dist/components/Editor/index.js +178 -21
- package/dist/components/FieldMessage/index.cjs +8 -3
- package/dist/components/FieldMessage/index.css +15 -0
- package/dist/components/FieldMessage/index.d.cts +11 -4
- package/dist/components/FieldMessage/index.d.ts +11 -4
- package/dist/components/FieldMessage/index.js +8 -3
- package/dist/components/FileUpload/index.cjs +8 -3
- package/dist/components/FileUpload/index.css +15 -0
- package/dist/components/FileUpload/index.d.cts +6 -0
- package/dist/components/FileUpload/index.d.ts +6 -0
- package/dist/components/FileUpload/index.js +8 -3
- package/dist/components/ImageSelector/index.cjs +8 -3
- package/dist/components/ImageSelector/index.css +15 -0
- package/dist/components/ImageSelector/index.d.cts +3 -0
- package/dist/components/ImageSelector/index.d.ts +3 -0
- package/dist/components/ImageSelector/index.js +8 -3
- package/dist/components/Input/index.cjs +15 -5
- package/dist/components/Input/index.css +15 -0
- package/dist/components/Input/index.d.cts +8 -0
- package/dist/components/Input/index.d.ts +8 -0
- package/dist/components/Input/index.js +15 -5
- package/dist/components/Modal/index.cjs +84 -5
- package/dist/components/Modal/index.js +84 -5
- package/dist/components/NotificationBadge/index.cjs +5 -1
- package/dist/components/NotificationBadge/index.css +1 -0
- package/dist/components/NotificationBadge/index.d.cts +6 -2
- package/dist/components/NotificationBadge/index.d.ts +6 -2
- package/dist/components/NotificationBadge/index.js +5 -1
- package/dist/components/Pagination/index.cjs +6 -2
- package/dist/components/Pagination/index.css +1 -0
- package/dist/components/Pagination/index.d.cts +13 -2
- package/dist/components/Pagination/index.d.ts +13 -2
- package/dist/components/Pagination/index.js +6 -2
- package/dist/components/PopOver/index.cjs +34 -6
- package/dist/components/PopOver/index.js +34 -6
- package/dist/components/Progress/index.cjs +6 -2
- package/dist/components/Progress/index.css +1 -0
- package/dist/components/Progress/index.d.cts +11 -2
- package/dist/components/Progress/index.d.ts +11 -2
- package/dist/components/Progress/index.js +6 -2
- package/dist/components/Radio/index.cjs +14 -5
- package/dist/components/Radio/index.css +17 -0
- package/dist/components/Radio/index.d.cts +11 -2
- package/dist/components/Radio/index.d.ts +11 -2
- package/dist/components/Radio/index.js +14 -5
- package/dist/components/Select/index.cjs +99 -31
- package/dist/components/Select/index.css +54 -0
- package/dist/components/Select/index.d.cts +16 -1
- package/dist/components/Select/index.d.ts +16 -1
- package/dist/components/Select/index.js +99 -31
- package/dist/components/Skeleton/index.d.cts +3 -0
- package/dist/components/Skeleton/index.d.ts +3 -0
- package/dist/components/Spinner/index.cjs +6 -2
- package/dist/components/Spinner/index.css +1 -0
- package/dist/components/Spinner/index.d.cts +8 -2
- package/dist/components/Spinner/index.d.ts +8 -2
- package/dist/components/Spinner/index.js +6 -2
- package/dist/components/Stat/index.cjs +84 -0
- package/dist/components/Stat/index.css +96 -0
- package/dist/components/Stat/index.d.cts +37 -0
- package/dist/components/Stat/index.d.ts +37 -0
- package/dist/components/Stat/index.js +57 -0
- package/dist/components/Steps/index.cjs +6 -2
- package/dist/components/Steps/index.css +11 -0
- package/dist/components/Steps/index.d.cts +9 -2
- package/dist/components/Steps/index.d.ts +9 -2
- package/dist/components/Steps/index.js +6 -2
- package/dist/components/Switch/index.cjs +20 -7
- package/dist/components/Switch/index.css +17 -0
- package/dist/components/Switch/index.d.cts +15 -2
- package/dist/components/Switch/index.d.ts +15 -2
- package/dist/components/Switch/index.js +20 -7
- package/dist/components/Tab/index.cjs +51 -26
- package/dist/components/Tab/index.css +4 -0
- package/dist/components/Tab/index.d.cts +12 -1
- package/dist/components/Tab/index.d.ts +12 -1
- package/dist/components/Tab/index.js +51 -26
- package/dist/components/Tag/index.cjs +5 -3
- package/dist/components/Tag/index.d.cts +12 -2
- package/dist/components/Tag/index.d.ts +12 -2
- package/dist/components/Tag/index.js +5 -3
- package/dist/components/TextArea/index.cjs +14 -4
- package/dist/components/TextArea/index.css +15 -0
- package/dist/components/TextArea/index.d.cts +7 -0
- package/dist/components/TextArea/index.d.ts +7 -0
- package/dist/components/TextArea/index.js +14 -4
- package/dist/components/TimePicker/index.cjs +448 -0
- package/dist/components/TimePicker/index.css +172 -0
- package/dist/components/TimePicker/index.d.cts +42 -0
- package/dist/components/TimePicker/index.d.ts +42 -0
- package/dist/components/TimePicker/index.js +411 -0
- package/dist/components/Tooltip/index.cjs +4 -2
- package/dist/components/Tooltip/index.d.cts +11 -1
- package/dist/components/Tooltip/index.d.ts +11 -1
- package/dist/components/Tooltip/index.js +4 -2
- package/dist/components/index.cjs +916 -385
- package/dist/components/index.css +296 -0
- package/dist/components/index.d.cts +3 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +914 -385
- package/dist/index.cjs +940 -409
- package/dist/index.css +296 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +938 -409
- package/dist/status-njWqQWFV.d.cts +20 -0
- package/dist/status-njWqQWFV.d.ts +20 -0
- package/guidelines/AGENT_PROMPT.md +18 -3
- package/guidelines/Guidelines.md +3 -0
- package/guidelines/components/card.md +3 -3
- package/guidelines/components/editor.md +86 -0
- package/guidelines/components/feedback.md +1 -1
- package/guidelines/components/form.md +19 -0
- package/guidelines/components/navigation.md +16 -15
- package/guidelines/components/overlay.md +43 -4
- package/guidelines/components/stat.md +31 -0
- package/guidelines/components/time-picker.md +49 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -320,6 +320,7 @@ __export(index_exports, {
|
|
|
320
320
|
Spinner: () => Spinner_default,
|
|
321
321
|
SquareIcon: () => SquareIcon_default,
|
|
322
322
|
StarIcon: () => StarIcon_default,
|
|
323
|
+
Stat: () => Stat_default,
|
|
323
324
|
Steps: () => Steps_default,
|
|
324
325
|
StopCircleIcon: () => StopCircleIcon_default,
|
|
325
326
|
SuccessIcon: () => SuccessIcon_default,
|
|
@@ -344,6 +345,7 @@ __export(index_exports, {
|
|
|
344
345
|
ThermometerIcon: () => ThermometerIcon_default,
|
|
345
346
|
ThumbsDownIcon: () => ThumbsDownIcon_default,
|
|
346
347
|
ThumbsUpIcon: () => ThumbsUpIcon_default,
|
|
348
|
+
TimePicker: () => TimePicker_default,
|
|
347
349
|
ToastProvider: () => ToastProvider,
|
|
348
350
|
ToggleLeftIcon: () => ToggleLeftIcon_default,
|
|
349
351
|
ToggleRightIcon: () => ToggleRightIcon_default,
|
|
@@ -6029,11 +6031,16 @@ var FieldMessage = (props) => {
|
|
|
6029
6031
|
FieldMessage.displayName = "FieldMessage";
|
|
6030
6032
|
var FieldMessage_default = FieldMessage;
|
|
6031
6033
|
var Field = (props) => {
|
|
6032
|
-
const { validations, children } = props;
|
|
6033
|
-
|
|
6034
|
+
const { label, required = false, htmlFor, validations, children } = props;
|
|
6035
|
+
const hasMessages = !!validations && validations.length > 0;
|
|
6036
|
+
if (!label && !hasMessages) return /* @__PURE__ */ (0, import_jsx_runtime297.jsx)(import_jsx_runtime297.Fragment, { children });
|
|
6034
6037
|
return /* @__PURE__ */ (0, import_jsx_runtime297.jsxs)("div", { className: "lib-xplat-field", children: [
|
|
6038
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime297.jsxs)("label", { className: "lib-xplat-field-label", htmlFor, children: [
|
|
6039
|
+
label,
|
|
6040
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime297.jsx)("span", { className: "required", "aria-hidden": "true", children: "*" })
|
|
6041
|
+
] }),
|
|
6035
6042
|
children,
|
|
6036
|
-
/* @__PURE__ */ (0, import_jsx_runtime297.jsx)(FieldMessage, { validations })
|
|
6043
|
+
hasMessages && /* @__PURE__ */ (0, import_jsx_runtime297.jsx)(FieldMessage, { validations })
|
|
6037
6044
|
] });
|
|
6038
6045
|
};
|
|
6039
6046
|
Field.displayName = "Field";
|
|
@@ -6044,7 +6051,9 @@ var import_jsx_runtime298 = require("react/jsx-runtime");
|
|
|
6044
6051
|
var MAX_HEIGHT = 400;
|
|
6045
6052
|
var AutoResizeTextArea = import_react2.default.forwardRef(
|
|
6046
6053
|
(props, ref) => {
|
|
6047
|
-
const { value, className, onChange, disabled, bare = false, validations, ...textareaProps } = props;
|
|
6054
|
+
const { value, className, onChange, disabled, bare = false, validations, label, required, ...textareaProps } = props;
|
|
6055
|
+
const autoId = import_react2.default.useId();
|
|
6056
|
+
const fieldId = props.id ?? autoId;
|
|
6048
6057
|
const localRef = import_react2.default.useRef(null);
|
|
6049
6058
|
const setRefs = (el) => {
|
|
6050
6059
|
localRef.current = el;
|
|
@@ -6078,6 +6087,7 @@ var AutoResizeTextArea = import_react2.default.forwardRef(
|
|
|
6078
6087
|
"aria-invalid": hasError(validations) || void 0,
|
|
6079
6088
|
...textareaProps,
|
|
6080
6089
|
ref: setRefs,
|
|
6090
|
+
id: fieldId,
|
|
6081
6091
|
className,
|
|
6082
6092
|
disabled,
|
|
6083
6093
|
value,
|
|
@@ -6091,12 +6101,13 @@ var AutoResizeTextArea = import_react2.default.forwardRef(
|
|
|
6091
6101
|
"aria-invalid": hasError(validations) || void 0,
|
|
6092
6102
|
...textareaProps,
|
|
6093
6103
|
ref: setRefs,
|
|
6104
|
+
id: fieldId,
|
|
6094
6105
|
disabled,
|
|
6095
6106
|
value,
|
|
6096
6107
|
onChange: handleChange
|
|
6097
6108
|
}
|
|
6098
6109
|
) }) });
|
|
6099
|
-
return /* @__PURE__ */ (0, import_jsx_runtime298.jsx)(Field, { validations, children: control });
|
|
6110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime298.jsx)(Field, { validations, label, required, htmlFor: fieldId, children: control });
|
|
6100
6111
|
}
|
|
6101
6112
|
);
|
|
6102
6113
|
AutoResizeTextArea.displayName = "AutoResizeTextArea";
|
|
@@ -7255,7 +7266,8 @@ var ChartLegend = ({ data, labels, type }) => {
|
|
|
7255
7266
|
}) });
|
|
7256
7267
|
};
|
|
7257
7268
|
var Chart = import_react6.default.memo((props) => {
|
|
7258
|
-
const { type, data, labels, tooltip: showTooltip = true, tooltipType = "light" } = props;
|
|
7269
|
+
const { variant, type, data, labels, tooltip: showTooltip = true, tooltipType = "light" } = props;
|
|
7270
|
+
const shape = variant ?? type ?? "line";
|
|
7259
7271
|
const { tooltip, show, hide, move, containerRef } = useChartTooltip(showTooltip);
|
|
7260
7272
|
const { width, height } = useChartSize(containerRef);
|
|
7261
7273
|
const stableData = import_react6.default.useMemo(() => data, [JSON.stringify(data)]);
|
|
@@ -7264,11 +7276,11 @@ var Chart = import_react6.default.memo((props) => {
|
|
|
7264
7276
|
const animate = useChartAnimation(containerRef, dataKey);
|
|
7265
7277
|
const ready = width > 0 && height > 0;
|
|
7266
7278
|
return /* @__PURE__ */ (0, import_jsx_runtime306.jsxs)("div", { className: "lib-xplat-chart", ref: containerRef, children: [
|
|
7267
|
-
ready &&
|
|
7268
|
-
ready &&
|
|
7269
|
-
ready &&
|
|
7270
|
-
ready &&
|
|
7271
|
-
ready &&
|
|
7279
|
+
ready && shape === "line" && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(LineChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
7280
|
+
ready && shape === "curve" && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(CurveChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
7281
|
+
ready && shape === "bar" && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(BarChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
7282
|
+
ready && shape === "pie" && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
7283
|
+
ready && shape === "doughnut" && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, isDoughnut: true, onHover: show, onMove: move, onLeave: hide }),
|
|
7272
7284
|
ready && (type === "pie" || type === "doughnut") && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(ChartLegend, { data: stableData, labels: stableLabels, type }),
|
|
7273
7285
|
tooltip.visible && tooltip.content && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(ChartTooltip, { x: tooltip.x, y: tooltip.y, containerWidth: width, containerHeight: height, tooltipType, children: tooltip.content })
|
|
7274
7286
|
] });
|
|
@@ -7313,8 +7325,11 @@ var ChatInput = import_react7.default.forwardRef(
|
|
|
7313
7325
|
buttonType = "primary",
|
|
7314
7326
|
onSubmit,
|
|
7315
7327
|
onChange,
|
|
7316
|
-
validations
|
|
7328
|
+
validations,
|
|
7329
|
+
label,
|
|
7330
|
+
required
|
|
7317
7331
|
} = props;
|
|
7332
|
+
const fieldId = import_react7.default.useId();
|
|
7318
7333
|
const isControlled = valueProp !== void 0;
|
|
7319
7334
|
const [internalValue, setInternalValue] = import_react7.default.useState("");
|
|
7320
7335
|
const value = isControlled ? valueProp : internalValue;
|
|
@@ -7339,6 +7354,7 @@ var ChatInput = import_react7.default.forwardRef(
|
|
|
7339
7354
|
/* @__PURE__ */ (0, import_jsx_runtime308.jsx)(
|
|
7340
7355
|
AutoResizeTextArea_default,
|
|
7341
7356
|
{
|
|
7357
|
+
id: fieldId,
|
|
7342
7358
|
ref,
|
|
7343
7359
|
bare: true,
|
|
7344
7360
|
className: "chat-input-textarea",
|
|
@@ -7363,7 +7379,7 @@ var ChatInput = import_react7.default.forwardRef(
|
|
|
7363
7379
|
}
|
|
7364
7380
|
)
|
|
7365
7381
|
] });
|
|
7366
|
-
return /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(Field, { validations, children: control });
|
|
7382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(Field, { validations, label, required, htmlFor: fieldId, children: control });
|
|
7367
7383
|
}
|
|
7368
7384
|
);
|
|
7369
7385
|
ChatInput.displayName = "ChatInput";
|
|
@@ -7388,6 +7404,9 @@ var import_tokens_core = require("@x-plat/tokens-core");
|
|
|
7388
7404
|
// src/tokens/index.ts
|
|
7389
7405
|
var import_tokens_core2 = require("@x-plat/tokens-core");
|
|
7390
7406
|
|
|
7407
|
+
// src/tokens/interface/status.ts
|
|
7408
|
+
var normalizeStatus = (value) => value === "brand" ? "primary" : value;
|
|
7409
|
+
|
|
7391
7410
|
// src/components/CheckBox/CheckBox.tsx
|
|
7392
7411
|
var import_jsx_runtime309 = require("react/jsx-runtime");
|
|
7393
7412
|
var CheckBox = (props) => {
|
|
@@ -7398,10 +7417,11 @@ var CheckBox = (props) => {
|
|
|
7398
7417
|
onChange,
|
|
7399
7418
|
disabled,
|
|
7400
7419
|
size = "md",
|
|
7401
|
-
type = "
|
|
7420
|
+
type = "primary",
|
|
7402
7421
|
validations,
|
|
7403
7422
|
...rest
|
|
7404
7423
|
} = props;
|
|
7424
|
+
const statusType = normalizeStatus(type);
|
|
7405
7425
|
const handleChange = (e) => {
|
|
7406
7426
|
if (onChange) onChange(e);
|
|
7407
7427
|
};
|
|
@@ -7409,7 +7429,7 @@ var CheckBox = (props) => {
|
|
|
7409
7429
|
const checkedClasses = `checked`;
|
|
7410
7430
|
const disabledClasses = "disabled";
|
|
7411
7431
|
const boxClasses = disabled ? disabledClasses : checked ? checkedClasses : uncheckedClasses;
|
|
7412
|
-
const control = /* @__PURE__ */ (0, import_jsx_runtime309.jsxs)("label", { className: clsx_default("lib-xplat-checkbox", size,
|
|
7432
|
+
const control = /* @__PURE__ */ (0, import_jsx_runtime309.jsxs)("label", { className: clsx_default("lib-xplat-checkbox", size, statusType, className), children: [
|
|
7413
7433
|
/* @__PURE__ */ (0, import_jsx_runtime309.jsx)(
|
|
7414
7434
|
"input",
|
|
7415
7435
|
{
|
|
@@ -7443,7 +7463,7 @@ Chip.displayName = "Chip";
|
|
|
7443
7463
|
var Chip_default = Chip;
|
|
7444
7464
|
|
|
7445
7465
|
// src/components/DatePicker/InputDatePicker/index.tsx
|
|
7446
|
-
var
|
|
7466
|
+
var import_react13 = __toESM(require("react"), 1);
|
|
7447
7467
|
|
|
7448
7468
|
// src/components/Input/Input.tsx
|
|
7449
7469
|
var import_react8 = __toESM(require("react"), 1);
|
|
@@ -7541,8 +7561,12 @@ var Input = import_react8.default.forwardRef((props, ref) => {
|
|
|
7541
7561
|
suffix,
|
|
7542
7562
|
disabled,
|
|
7543
7563
|
validations,
|
|
7564
|
+
label,
|
|
7565
|
+
required,
|
|
7544
7566
|
...inputProps
|
|
7545
7567
|
} = props;
|
|
7568
|
+
const autoId = import_react8.default.useId();
|
|
7569
|
+
const fieldId = inputProps.id ?? autoId;
|
|
7546
7570
|
const localValue = formatValue(type, value);
|
|
7547
7571
|
const handleChange = (e) => {
|
|
7548
7572
|
let val = e.target.value;
|
|
@@ -7558,7 +7582,7 @@ var Input = import_react8.default.forwardRef((props, ref) => {
|
|
|
7558
7582
|
onChange(event);
|
|
7559
7583
|
}
|
|
7560
7584
|
};
|
|
7561
|
-
return /* @__PURE__ */ (0, import_jsx_runtime311.jsxs)("div", { className: clsx_default("lib-xplat-input-wrap", className), children: [
|
|
7585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(Field, { label, required, htmlFor: fieldId, children: /* @__PURE__ */ (0, import_jsx_runtime311.jsxs)("div", { className: clsx_default("lib-xplat-input-wrap", className), children: [
|
|
7562
7586
|
/* @__PURE__ */ (0, import_jsx_runtime311.jsxs)(
|
|
7563
7587
|
"div",
|
|
7564
7588
|
{
|
|
@@ -7569,6 +7593,7 @@ var Input = import_react8.default.forwardRef((props, ref) => {
|
|
|
7569
7593
|
{
|
|
7570
7594
|
...inputProps,
|
|
7571
7595
|
ref,
|
|
7596
|
+
id: fieldId,
|
|
7572
7597
|
disabled,
|
|
7573
7598
|
type: type === "number" ? "text" : type,
|
|
7574
7599
|
value: localValue,
|
|
@@ -7581,7 +7606,7 @@ var Input = import_react8.default.forwardRef((props, ref) => {
|
|
|
7581
7606
|
}
|
|
7582
7607
|
),
|
|
7583
7608
|
/* @__PURE__ */ (0, import_jsx_runtime311.jsx)(FieldMessage_default, { validations })
|
|
7584
|
-
] });
|
|
7609
|
+
] }) });
|
|
7585
7610
|
});
|
|
7586
7611
|
Input.displayName = "Input";
|
|
7587
7612
|
var Input_default = Input;
|
|
@@ -7611,16 +7636,96 @@ PasswordInput.displayName = "PasswordInput";
|
|
|
7611
7636
|
var PasswordInput_default = PasswordInput;
|
|
7612
7637
|
|
|
7613
7638
|
// src/components/Modal/Modal.tsx
|
|
7614
|
-
var
|
|
7639
|
+
var import_react11 = __toESM(require("react"), 1);
|
|
7615
7640
|
var import_react_dom = require("react-dom");
|
|
7641
|
+
|
|
7642
|
+
// src/tokens/hooks/useOverlayKeyboard.ts
|
|
7643
|
+
var import_react10 = __toESM(require("react"), 1);
|
|
7644
|
+
var FOCUSABLE = [
|
|
7645
|
+
"a[href]",
|
|
7646
|
+
"button:not([disabled])",
|
|
7647
|
+
"input:not([disabled]):not([type='hidden'])",
|
|
7648
|
+
"select:not([disabled])",
|
|
7649
|
+
"textarea:not([disabled])",
|
|
7650
|
+
"[tabindex]:not([tabindex='-1'])"
|
|
7651
|
+
].join(",");
|
|
7652
|
+
var focusableIn = (el) => Array.from(el.querySelectorAll(FOCUSABLE)).filter(
|
|
7653
|
+
// 화면에 없는 것은 제외 (display:none 등)
|
|
7654
|
+
(n) => n.offsetWidth > 0 || n.offsetHeight > 0 || n === document.activeElement
|
|
7655
|
+
);
|
|
7656
|
+
var useEscapeKey = (enabled, onEscape) => {
|
|
7657
|
+
import_react10.default.useEffect(() => {
|
|
7658
|
+
if (!enabled) return;
|
|
7659
|
+
const onKey = (e) => {
|
|
7660
|
+
if (e.key !== "Escape") return;
|
|
7661
|
+
if (e.defaultPrevented) return;
|
|
7662
|
+
e.preventDefault();
|
|
7663
|
+
onEscape();
|
|
7664
|
+
};
|
|
7665
|
+
document.addEventListener("keydown", onKey);
|
|
7666
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
7667
|
+
}, [enabled, onEscape]);
|
|
7668
|
+
};
|
|
7669
|
+
var useFocusTrap = (containerRef, enabled, options = {}) => {
|
|
7670
|
+
const { trap = false, initialFocus } = options;
|
|
7671
|
+
const restoreRef = import_react10.default.useRef(null);
|
|
7672
|
+
import_react10.default.useEffect(() => {
|
|
7673
|
+
if (!enabled) return;
|
|
7674
|
+
restoreRef.current = document.activeElement;
|
|
7675
|
+
const raf = requestAnimationFrame(() => {
|
|
7676
|
+
const el = containerRef.current;
|
|
7677
|
+
if (!el) return;
|
|
7678
|
+
const target = initialFocus?.current ?? focusableIn(el)[0] ?? el;
|
|
7679
|
+
if (!target.hasAttribute("tabindex") && !focusableIn(el).includes(target)) {
|
|
7680
|
+
target.setAttribute("tabindex", "-1");
|
|
7681
|
+
}
|
|
7682
|
+
target.focus({ preventScroll: true });
|
|
7683
|
+
});
|
|
7684
|
+
return () => {
|
|
7685
|
+
cancelAnimationFrame(raf);
|
|
7686
|
+
const prev = restoreRef.current;
|
|
7687
|
+
if (prev && document.contains(prev)) prev.focus({ preventScroll: true });
|
|
7688
|
+
};
|
|
7689
|
+
}, [enabled, containerRef, initialFocus]);
|
|
7690
|
+
import_react10.default.useEffect(() => {
|
|
7691
|
+
if (!enabled || !trap) return;
|
|
7692
|
+
const onKey = (e) => {
|
|
7693
|
+
if (e.key !== "Tab") return;
|
|
7694
|
+
const el = containerRef.current;
|
|
7695
|
+
if (!el) return;
|
|
7696
|
+
const items = focusableIn(el);
|
|
7697
|
+
if (items.length === 0) {
|
|
7698
|
+
e.preventDefault();
|
|
7699
|
+
return;
|
|
7700
|
+
}
|
|
7701
|
+
const first = items[0];
|
|
7702
|
+
const last = items[items.length - 1];
|
|
7703
|
+
const active = document.activeElement;
|
|
7704
|
+
if (e.shiftKey && (active === first || !el.contains(active))) {
|
|
7705
|
+
e.preventDefault();
|
|
7706
|
+
last.focus();
|
|
7707
|
+
} else if (!e.shiftKey && (active === last || !el.contains(active))) {
|
|
7708
|
+
e.preventDefault();
|
|
7709
|
+
first.focus();
|
|
7710
|
+
}
|
|
7711
|
+
};
|
|
7712
|
+
document.addEventListener("keydown", onKey);
|
|
7713
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
7714
|
+
}, [enabled, trap, containerRef]);
|
|
7715
|
+
};
|
|
7716
|
+
|
|
7717
|
+
// src/components/Modal/Modal.tsx
|
|
7616
7718
|
var import_jsx_runtime313 = require("react/jsx-runtime");
|
|
7617
7719
|
var ANIMATION_DURATION_MS = 200;
|
|
7618
7720
|
var Modal = (props) => {
|
|
7619
7721
|
const { isOpen, onClose, children } = props;
|
|
7620
|
-
const [mounted, setMounted] =
|
|
7621
|
-
const [visible, setVisible] =
|
|
7622
|
-
const [settled, setSettled] =
|
|
7623
|
-
|
|
7722
|
+
const [mounted, setMounted] = import_react11.default.useState(false);
|
|
7723
|
+
const [visible, setVisible] = import_react11.default.useState(false);
|
|
7724
|
+
const [settled, setSettled] = import_react11.default.useState(false);
|
|
7725
|
+
const boxRef = import_react11.default.useRef(null);
|
|
7726
|
+
useEscapeKey(isOpen, onClose);
|
|
7727
|
+
useFocusTrap(boxRef, isOpen && mounted, { trap: true });
|
|
7728
|
+
import_react11.default.useEffect(() => {
|
|
7624
7729
|
if (isOpen) {
|
|
7625
7730
|
setMounted(true);
|
|
7626
7731
|
const show = setTimeout(() => setVisible(true), 1);
|
|
@@ -7647,6 +7752,7 @@ var Modal = (props) => {
|
|
|
7647
7752
|
children: /* @__PURE__ */ (0, import_jsx_runtime313.jsx)(
|
|
7648
7753
|
"div",
|
|
7649
7754
|
{
|
|
7755
|
+
ref: boxRef,
|
|
7650
7756
|
className: clsx_default("lib-xplat-modal", "modal-box", stateClass, settled && "settled"),
|
|
7651
7757
|
role: "dialog",
|
|
7652
7758
|
"aria-modal": "true",
|
|
@@ -7663,9 +7769,9 @@ Modal.displayName = "Modal";
|
|
|
7663
7769
|
var Modal_default = Modal;
|
|
7664
7770
|
|
|
7665
7771
|
// src/components/DatePicker/SingleDatePicker/index.tsx
|
|
7666
|
-
var
|
|
7772
|
+
var import_react12 = __toESM(require("react"), 1);
|
|
7667
7773
|
var import_jsx_runtime314 = require("react/jsx-runtime");
|
|
7668
|
-
var DayCell2 =
|
|
7774
|
+
var DayCell2 = import_react12.default.memo(
|
|
7669
7775
|
({
|
|
7670
7776
|
day,
|
|
7671
7777
|
disabled,
|
|
@@ -7717,26 +7823,26 @@ var SingleDatePicker = (props) => {
|
|
|
7717
7823
|
initialYear,
|
|
7718
7824
|
initialMonth
|
|
7719
7825
|
);
|
|
7720
|
-
const [pickerMode, setPickerMode] =
|
|
7721
|
-
const [yearRangeStart, setYearRangeStart] =
|
|
7826
|
+
const [pickerMode, setPickerMode] = import_react12.default.useState("days");
|
|
7827
|
+
const [yearRangeStart, setYearRangeStart] = import_react12.default.useState(
|
|
7722
7828
|
Math.floor((initialYear ?? (/* @__PURE__ */ new Date()).getFullYear()) / 12) * 12
|
|
7723
7829
|
);
|
|
7724
|
-
const minTime =
|
|
7830
|
+
const minTime = import_react12.default.useMemo(
|
|
7725
7831
|
() => minDate ? new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()).getTime() : -Infinity,
|
|
7726
7832
|
[minDate]
|
|
7727
7833
|
);
|
|
7728
|
-
const maxTime =
|
|
7834
|
+
const maxTime = import_react12.default.useMemo(
|
|
7729
7835
|
() => maxDate ? new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate()).getTime() : Infinity,
|
|
7730
7836
|
[maxDate]
|
|
7731
7837
|
);
|
|
7732
|
-
const highlightSet =
|
|
7838
|
+
const highlightSet = import_react12.default.useMemo(() => {
|
|
7733
7839
|
const set = /* @__PURE__ */ new Set();
|
|
7734
7840
|
for (const h of highlightDates) {
|
|
7735
7841
|
set.add(`${h.getFullYear()}-${h.getMonth()}-${h.getDate()}`);
|
|
7736
7842
|
}
|
|
7737
7843
|
return set;
|
|
7738
7844
|
}, [highlightDates]);
|
|
7739
|
-
const handleSelect =
|
|
7845
|
+
const handleSelect = import_react12.default.useCallback(
|
|
7740
7846
|
(date) => {
|
|
7741
7847
|
onChange?.(date);
|
|
7742
7848
|
},
|
|
@@ -7865,8 +7971,8 @@ var formatDate = (date) => {
|
|
|
7865
7971
|
};
|
|
7866
7972
|
var InputDatePicker = (props) => {
|
|
7867
7973
|
const { value, onChange, minDate, maxDate, disabled, locale = "ko", placeholder } = props;
|
|
7868
|
-
const [isOpen, setIsOpen] =
|
|
7869
|
-
const [tempDate, setTempDate] =
|
|
7974
|
+
const [isOpen, setIsOpen] = import_react13.default.useState(false);
|
|
7975
|
+
const [tempDate, setTempDate] = import_react13.default.useState(value ?? /* @__PURE__ */ new Date());
|
|
7870
7976
|
const handleOpen = () => {
|
|
7871
7977
|
if (disabled) return;
|
|
7872
7978
|
setTempDate(value ?? /* @__PURE__ */ new Date());
|
|
@@ -7915,23 +8021,27 @@ InputDatePicker.displayName = "InputDatePicker";
|
|
|
7915
8021
|
var InputDatePicker_default = InputDatePicker;
|
|
7916
8022
|
|
|
7917
8023
|
// src/components/DatePicker/PopupPicker/index.tsx
|
|
7918
|
-
var
|
|
8024
|
+
var import_react17 = __toESM(require("react"), 1);
|
|
7919
8025
|
|
|
7920
8026
|
// src/components/DatePicker/RangePicker/index.tsx
|
|
7921
|
-
var
|
|
8027
|
+
var import_react16 = __toESM(require("react"), 1);
|
|
7922
8028
|
|
|
7923
8029
|
// src/components/Tab/Tab.tsx
|
|
7924
|
-
var
|
|
8030
|
+
var import_react15 = __toESM(require("react"), 1);
|
|
7925
8031
|
|
|
7926
8032
|
// src/components/Tab/TabItem.tsx
|
|
7927
|
-
var
|
|
8033
|
+
var import_react14 = __toESM(require("react"), 1);
|
|
7928
8034
|
var import_jsx_runtime316 = require("react/jsx-runtime");
|
|
7929
|
-
var TabItem =
|
|
8035
|
+
var TabItem = import_react14.default.forwardRef((props, ref) => {
|
|
7930
8036
|
const { isActive: isActive2, title, onClick } = props;
|
|
7931
8037
|
return /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(
|
|
7932
|
-
"
|
|
8038
|
+
"button",
|
|
7933
8039
|
{
|
|
7934
8040
|
ref,
|
|
8041
|
+
type: "button",
|
|
8042
|
+
role: "tab",
|
|
8043
|
+
"aria-selected": isActive2,
|
|
8044
|
+
tabIndex: isActive2 ? 0 : -1,
|
|
7935
8045
|
className: clsx_default("tab-item", isActive2 ? "active" : null),
|
|
7936
8046
|
onClick,
|
|
7937
8047
|
children: title
|
|
@@ -7944,45 +8054,66 @@ var TabItem_default = TabItem;
|
|
|
7944
8054
|
// src/components/Tab/Tab.tsx
|
|
7945
8055
|
var import_jsx_runtime317 = require("react/jsx-runtime");
|
|
7946
8056
|
var Tab = (props) => {
|
|
7947
|
-
const { activeIndex, onChange, tabs, type, size = "md" } = props;
|
|
7948
|
-
const
|
|
8057
|
+
const { activeIndex, onChange, tabs, variant, type, size = "md" } = props;
|
|
8058
|
+
const shape = variant ?? type ?? "default";
|
|
8059
|
+
const [underlineStyle, setUnderlineStyle] = import_react15.default.useState({
|
|
7949
8060
|
left: 0,
|
|
7950
8061
|
width: 0
|
|
7951
8062
|
});
|
|
7952
|
-
const itemRefs =
|
|
8063
|
+
const itemRefs = import_react15.default.useRef([]);
|
|
8064
|
+
const handleKeyDown = (e) => {
|
|
8065
|
+
const last = tabs.length - 1;
|
|
8066
|
+
let next = null;
|
|
8067
|
+
if (e.key === "ArrowRight") next = activeIndex >= last ? 0 : activeIndex + 1;
|
|
8068
|
+
else if (e.key === "ArrowLeft") next = activeIndex <= 0 ? last : activeIndex - 1;
|
|
8069
|
+
else if (e.key === "Home") next = 0;
|
|
8070
|
+
else if (e.key === "End") next = last;
|
|
8071
|
+
if (next === null) return;
|
|
8072
|
+
e.preventDefault();
|
|
8073
|
+
onChange(tabs[next], next);
|
|
8074
|
+
itemRefs.current[next]?.focus();
|
|
8075
|
+
};
|
|
7953
8076
|
const handleChangeActiveTab = (tabItem, tabIdx) => {
|
|
7954
8077
|
onChange(tabItem, tabIdx);
|
|
7955
8078
|
};
|
|
7956
|
-
|
|
8079
|
+
import_react15.default.useEffect(() => {
|
|
7957
8080
|
const el = itemRefs.current[activeIndex];
|
|
7958
8081
|
if (el) {
|
|
7959
8082
|
setUnderlineStyle({ left: el.offsetLeft, width: el.offsetWidth });
|
|
7960
8083
|
}
|
|
7961
8084
|
}, [activeIndex, tabs.length]);
|
|
7962
|
-
return /* @__PURE__ */ (0, import_jsx_runtime317.jsxs)(
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
{
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
|
|
8085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime317.jsxs)(
|
|
8086
|
+
"div",
|
|
8087
|
+
{
|
|
8088
|
+
className: clsx_default("lib-xplat-tab", `type-${shape}`, size),
|
|
8089
|
+
role: "tablist",
|
|
8090
|
+
onKeyDown: handleKeyDown,
|
|
8091
|
+
children: [
|
|
8092
|
+
tabs.map((tab, idx) => /* @__PURE__ */ (0, import_jsx_runtime317.jsx)(
|
|
8093
|
+
TabItem_default,
|
|
8094
|
+
{
|
|
8095
|
+
onClick: () => handleChangeActiveTab(tab, idx),
|
|
8096
|
+
isActive: activeIndex === idx,
|
|
8097
|
+
ref: (el) => {
|
|
8098
|
+
itemRefs.current[idx] = el;
|
|
8099
|
+
},
|
|
8100
|
+
title: tab.title
|
|
8101
|
+
},
|
|
8102
|
+
`${tab.value}_${idx}`
|
|
8103
|
+
)),
|
|
8104
|
+
shape === "toggle" && /* @__PURE__ */ (0, import_jsx_runtime317.jsx)(
|
|
8105
|
+
"div",
|
|
8106
|
+
{
|
|
8107
|
+
className: "tab-toggle-underline",
|
|
8108
|
+
style: {
|
|
8109
|
+
left: underlineStyle.left,
|
|
8110
|
+
width: underlineStyle.width
|
|
8111
|
+
}
|
|
8112
|
+
}
|
|
8113
|
+
)
|
|
8114
|
+
]
|
|
8115
|
+
}
|
|
8116
|
+
);
|
|
7986
8117
|
};
|
|
7987
8118
|
Tab.displayName = "Tab";
|
|
7988
8119
|
var Tab_default = Tab;
|
|
@@ -7998,7 +8129,7 @@ var RangePicker = (props) => {
|
|
|
7998
8129
|
maxDate,
|
|
7999
8130
|
locale = "ko"
|
|
8000
8131
|
} = props;
|
|
8001
|
-
const [activeTab, setActiveTab] =
|
|
8132
|
+
const [activeTab, setActiveTab] = import_react16.default.useState("start");
|
|
8002
8133
|
const handleStartChange = (date) => {
|
|
8003
8134
|
if (!date) return;
|
|
8004
8135
|
const newStart = date > endDate ? endDate : date;
|
|
@@ -8083,7 +8214,7 @@ var RangePicker_default = RangePicker;
|
|
|
8083
8214
|
var import_jsx_runtime319 = require("react/jsx-runtime");
|
|
8084
8215
|
var PopupPicker = (props) => {
|
|
8085
8216
|
const { component, type, locale } = props;
|
|
8086
|
-
const [isOpen, setIsOpen] =
|
|
8217
|
+
const [isOpen, setIsOpen] = import_react17.default.useState(false);
|
|
8087
8218
|
const handleClick = () => setIsOpen(true);
|
|
8088
8219
|
const handleClose = () => setIsOpen(false);
|
|
8089
8220
|
const handleSingleChange = (date) => {
|
|
@@ -8092,7 +8223,7 @@ var PopupPicker = (props) => {
|
|
|
8092
8223
|
handleClose();
|
|
8093
8224
|
};
|
|
8094
8225
|
return /* @__PURE__ */ (0, import_jsx_runtime319.jsxs)("div", { className: "lib-xplat-popup-datepicker", children: [
|
|
8095
|
-
|
|
8226
|
+
import_react17.default.cloneElement(component, { onClick: handleClick }),
|
|
8096
8227
|
/* @__PURE__ */ (0, import_jsx_runtime319.jsx)(Modal_default, { isOpen, onClose: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime319.jsxs)("div", { className: clsx_default("lib-xplat-popup-datepicker-card", type === "range" && "range-mode"), children: [
|
|
8097
8228
|
/* @__PURE__ */ (0, import_jsx_runtime319.jsxs)("div", { className: "popup-datepicker-content", children: [
|
|
8098
8229
|
type === "single" && /* @__PURE__ */ (0, import_jsx_runtime319.jsx)(
|
|
@@ -8151,15 +8282,18 @@ Divider.displayName = "Divider";
|
|
|
8151
8282
|
var Divider_default = Divider;
|
|
8152
8283
|
|
|
8153
8284
|
// src/components/Drawer/Drawer.tsx
|
|
8154
|
-
var
|
|
8285
|
+
var import_react18 = __toESM(require("react"), 1);
|
|
8155
8286
|
var import_react_dom2 = require("react-dom");
|
|
8156
8287
|
var import_jsx_runtime321 = require("react/jsx-runtime");
|
|
8157
8288
|
var ANIMATION_DURATION_MS2 = 250;
|
|
8158
8289
|
var Drawer = (props) => {
|
|
8159
8290
|
const { isOpen, onClose, placement = "right", size = "md", title, children } = props;
|
|
8160
|
-
const [mounted, setMounted] =
|
|
8161
|
-
const [visible, setVisible] =
|
|
8162
|
-
|
|
8291
|
+
const [mounted, setMounted] = import_react18.default.useState(false);
|
|
8292
|
+
const [visible, setVisible] = import_react18.default.useState(false);
|
|
8293
|
+
const panelRef = import_react18.default.useRef(null);
|
|
8294
|
+
useEscapeKey(isOpen, onClose);
|
|
8295
|
+
useFocusTrap(panelRef, isOpen && mounted, { trap: true });
|
|
8296
|
+
import_react18.default.useEffect(() => {
|
|
8163
8297
|
if (isOpen) {
|
|
8164
8298
|
setMounted(true);
|
|
8165
8299
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -8181,6 +8315,7 @@ var Drawer = (props) => {
|
|
|
8181
8315
|
children: /* @__PURE__ */ (0, import_jsx_runtime321.jsxs)(
|
|
8182
8316
|
"div",
|
|
8183
8317
|
{
|
|
8318
|
+
ref: panelRef,
|
|
8184
8319
|
className: clsx_default("lib-xplat-drawer", placement, size, stateClass),
|
|
8185
8320
|
role: "dialog",
|
|
8186
8321
|
"aria-modal": "true",
|
|
@@ -8203,7 +8338,7 @@ Drawer.displayName = "Drawer";
|
|
|
8203
8338
|
var Drawer_default = Drawer;
|
|
8204
8339
|
|
|
8205
8340
|
// src/components/Dropdown/Dropdown.tsx
|
|
8206
|
-
var
|
|
8341
|
+
var import_react21 = __toESM(require("react"), 1);
|
|
8207
8342
|
|
|
8208
8343
|
// src/tokens/hooks/Portal.tsx
|
|
8209
8344
|
var import_react_dom3 = __toESM(require("react-dom"), 1);
|
|
@@ -8215,13 +8350,13 @@ Portal.displayName = "Portal";
|
|
|
8215
8350
|
var Portal_default = Portal;
|
|
8216
8351
|
|
|
8217
8352
|
// src/tokens/hooks/useAutoPosition.ts
|
|
8218
|
-
var
|
|
8353
|
+
var import_react19 = __toESM(require("react"), 1);
|
|
8219
8354
|
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
8220
|
-
const [position, setPosition] =
|
|
8355
|
+
const [position, setPosition] = import_react19.default.useState({
|
|
8221
8356
|
position: {},
|
|
8222
8357
|
direction: "bottom"
|
|
8223
8358
|
});
|
|
8224
|
-
const calculatePosition =
|
|
8359
|
+
const calculatePosition = import_react19.default.useCallback(() => {
|
|
8225
8360
|
if (!triggerRef.current || !popRef.current) return;
|
|
8226
8361
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
8227
8362
|
const popW = popRef.current.offsetWidth;
|
|
@@ -8248,13 +8383,13 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
8248
8383
|
direction
|
|
8249
8384
|
});
|
|
8250
8385
|
}, [triggerRef, popRef]);
|
|
8251
|
-
|
|
8386
|
+
import_react19.default.useLayoutEffect(() => {
|
|
8252
8387
|
if (!enabled) return;
|
|
8253
8388
|
calculatePosition();
|
|
8254
8389
|
const raf = requestAnimationFrame(calculatePosition);
|
|
8255
8390
|
return () => cancelAnimationFrame(raf);
|
|
8256
8391
|
}, [calculatePosition, enabled]);
|
|
8257
|
-
|
|
8392
|
+
import_react19.default.useEffect(() => {
|
|
8258
8393
|
if (!enabled || !popRef.current) return;
|
|
8259
8394
|
const observer = new ResizeObserver(() => {
|
|
8260
8395
|
calculatePosition();
|
|
@@ -8262,7 +8397,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
8262
8397
|
observer.observe(popRef.current);
|
|
8263
8398
|
return () => observer.disconnect();
|
|
8264
8399
|
}, [calculatePosition, enabled, popRef]);
|
|
8265
|
-
|
|
8400
|
+
import_react19.default.useEffect(() => {
|
|
8266
8401
|
if (!enabled) return;
|
|
8267
8402
|
window.addEventListener("resize", calculatePosition);
|
|
8268
8403
|
window.addEventListener("scroll", calculatePosition, true);
|
|
@@ -8276,9 +8411,9 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
8276
8411
|
var useAutoPosition_default = useAutoPosition;
|
|
8277
8412
|
|
|
8278
8413
|
// src/tokens/hooks/useClickOutside.ts
|
|
8279
|
-
var
|
|
8414
|
+
var import_react20 = __toESM(require("react"), 1);
|
|
8280
8415
|
var useClickOutside = (refs, handler, enabled = true) => {
|
|
8281
|
-
|
|
8416
|
+
import_react20.default.useEffect(() => {
|
|
8282
8417
|
if (!enabled) return;
|
|
8283
8418
|
const refArray = Array.isArray(refs) ? refs : [refs];
|
|
8284
8419
|
const listener = (event) => {
|
|
@@ -8304,14 +8439,18 @@ var useClickOutside_default = useClickOutside;
|
|
|
8304
8439
|
var import_jsx_runtime322 = require("react/jsx-runtime");
|
|
8305
8440
|
var Dropdown = (props) => {
|
|
8306
8441
|
const { items, children } = props;
|
|
8307
|
-
const [isOpen, setIsOpen] =
|
|
8308
|
-
const [mounted, setMounted] =
|
|
8309
|
-
const [visible, setVisible] =
|
|
8310
|
-
const triggerRef =
|
|
8311
|
-
const menuRef =
|
|
8442
|
+
const [isOpen, setIsOpen] = import_react21.default.useState(false);
|
|
8443
|
+
const [mounted, setMounted] = import_react21.default.useState(false);
|
|
8444
|
+
const [visible, setVisible] = import_react21.default.useState(false);
|
|
8445
|
+
const triggerRef = import_react21.default.useRef(null);
|
|
8446
|
+
const menuRef = import_react21.default.useRef(null);
|
|
8312
8447
|
const { position, direction } = useAutoPosition_default(triggerRef, menuRef, mounted);
|
|
8313
8448
|
useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false), isOpen);
|
|
8314
|
-
|
|
8449
|
+
useEscapeKey(isOpen, () => {
|
|
8450
|
+
setIsOpen(false);
|
|
8451
|
+
triggerRef.current?.focus({ preventScroll: true });
|
|
8452
|
+
});
|
|
8453
|
+
import_react21.default.useEffect(() => {
|
|
8315
8454
|
if (isOpen) {
|
|
8316
8455
|
setMounted(true);
|
|
8317
8456
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -8365,7 +8504,7 @@ Dropdown.displayName = "Dropdown";
|
|
|
8365
8504
|
var Dropdown_default = Dropdown;
|
|
8366
8505
|
|
|
8367
8506
|
// src/components/Editor/Editor.tsx
|
|
8368
|
-
var
|
|
8507
|
+
var import_react22 = __toESM(require("react"), 1);
|
|
8369
8508
|
var import_jsx_runtime323 = require("react/jsx-runtime");
|
|
8370
8509
|
var DEFAULT_TOOLBAR = [
|
|
8371
8510
|
"bold",
|
|
@@ -8415,6 +8554,15 @@ var ALLOWED_ATTRS = {
|
|
|
8415
8554
|
a: ["href", "target", "rel"],
|
|
8416
8555
|
img: ["src", "alt"]
|
|
8417
8556
|
};
|
|
8557
|
+
var DROP_WITH_CONTENT = /* @__PURE__ */ new Set([
|
|
8558
|
+
"script",
|
|
8559
|
+
"style",
|
|
8560
|
+
"noscript",
|
|
8561
|
+
"iframe",
|
|
8562
|
+
"object",
|
|
8563
|
+
"embed",
|
|
8564
|
+
"template"
|
|
8565
|
+
]);
|
|
8418
8566
|
var sanitizeHtml = (input) => {
|
|
8419
8567
|
const doc = new DOMParser().parseFromString(`<div>${input}</div>`, "text/html");
|
|
8420
8568
|
const root = doc.body.firstElementChild;
|
|
@@ -8423,6 +8571,10 @@ var sanitizeHtml = (input) => {
|
|
|
8423
8571
|
const children = Array.from(node.children);
|
|
8424
8572
|
for (const child of children) {
|
|
8425
8573
|
const tag = child.tagName.toLowerCase();
|
|
8574
|
+
if (DROP_WITH_CONTENT.has(tag)) {
|
|
8575
|
+
node.removeChild(child);
|
|
8576
|
+
continue;
|
|
8577
|
+
}
|
|
8426
8578
|
if (!ALLOWED_TAGS.has(tag)) {
|
|
8427
8579
|
while (child.firstChild) node.insertBefore(child.firstChild, child);
|
|
8428
8580
|
node.removeChild(child);
|
|
@@ -8473,26 +8625,30 @@ var Editor = (props) => {
|
|
|
8473
8625
|
onImageUpload,
|
|
8474
8626
|
minHeight = 200
|
|
8475
8627
|
} = props;
|
|
8476
|
-
const editorRef =
|
|
8477
|
-
const lastRangeRef =
|
|
8478
|
-
const composingRef =
|
|
8479
|
-
const [isFocused, setIsFocused] =
|
|
8480
|
-
const [isEmpty, setIsEmpty] =
|
|
8481
|
-
const [activeFormats, setActiveFormats] =
|
|
8482
|
-
const [slashOpen, setSlashOpen] =
|
|
8483
|
-
const [slashFilter, setSlashFilter] =
|
|
8484
|
-
const [slashIdx, setSlashIdx] =
|
|
8485
|
-
const [slashPos, setSlashPos] =
|
|
8486
|
-
const slashStartRangeRef =
|
|
8487
|
-
const [linkOpen, setLinkOpen] =
|
|
8488
|
-
const [linkValue, setLinkValue] =
|
|
8489
|
-
const [linkPos, setLinkPos] =
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8628
|
+
const editorRef = import_react22.default.useRef(null);
|
|
8629
|
+
const lastRangeRef = import_react22.default.useRef(null);
|
|
8630
|
+
const composingRef = import_react22.default.useRef(false);
|
|
8631
|
+
const [isFocused, setIsFocused] = import_react22.default.useState(false);
|
|
8632
|
+
const [isEmpty, setIsEmpty] = import_react22.default.useState(!value);
|
|
8633
|
+
const [activeFormats, setActiveFormats] = import_react22.default.useState(/* @__PURE__ */ new Set());
|
|
8634
|
+
const [slashOpen, setSlashOpen] = import_react22.default.useState(false);
|
|
8635
|
+
const [slashFilter, setSlashFilter] = import_react22.default.useState("");
|
|
8636
|
+
const [slashIdx, setSlashIdx] = import_react22.default.useState(0);
|
|
8637
|
+
const [slashPos, setSlashPos] = import_react22.default.useState({ top: 0, left: 0 });
|
|
8638
|
+
const slashStartRangeRef = import_react22.default.useRef(null);
|
|
8639
|
+
const [linkOpen, setLinkOpen] = import_react22.default.useState(false);
|
|
8640
|
+
const [linkValue, setLinkValue] = import_react22.default.useState("");
|
|
8641
|
+
const [linkPos, setLinkPos] = import_react22.default.useState({ top: 0, left: 0 });
|
|
8642
|
+
const lastEmittedRef = import_react22.default.useRef(null);
|
|
8643
|
+
import_react22.default.useEffect(() => {
|
|
8644
|
+
const el = editorRef.current;
|
|
8645
|
+
if (!el) return;
|
|
8646
|
+
if (value === lastEmittedRef.current) return;
|
|
8647
|
+
if (el.innerHTML === value) return;
|
|
8648
|
+
el.innerHTML = sanitizeHtml(value || "");
|
|
8649
|
+
if (!el.firstChild) el.innerHTML = "<p><br></p>";
|
|
8650
|
+
lastEmittedRef.current = null;
|
|
8651
|
+
updateEmpty();
|
|
8496
8652
|
}, [value]);
|
|
8497
8653
|
const updateEmpty = () => {
|
|
8498
8654
|
const el = editorRef.current;
|
|
@@ -8508,10 +8664,19 @@ var Editor = (props) => {
|
|
|
8508
8664
|
}
|
|
8509
8665
|
};
|
|
8510
8666
|
const restoreSelection = () => {
|
|
8511
|
-
|
|
8667
|
+
const range = lastRangeRef.current;
|
|
8668
|
+
if (!range) return;
|
|
8669
|
+
if (!editorRef.current?.contains(range.startContainer)) {
|
|
8670
|
+
lastRangeRef.current = null;
|
|
8671
|
+
return;
|
|
8672
|
+
}
|
|
8512
8673
|
const sel = window.getSelection();
|
|
8513
|
-
|
|
8514
|
-
|
|
8674
|
+
try {
|
|
8675
|
+
sel?.removeAllRanges();
|
|
8676
|
+
sel?.addRange(range);
|
|
8677
|
+
} catch {
|
|
8678
|
+
lastRangeRef.current = null;
|
|
8679
|
+
}
|
|
8515
8680
|
};
|
|
8516
8681
|
const updateActiveFormats = () => {
|
|
8517
8682
|
if (!editorRef.current) return;
|
|
@@ -8540,6 +8705,96 @@ var Editor = (props) => {
|
|
|
8540
8705
|
const setBlock = (tag) => {
|
|
8541
8706
|
exec("formatBlock", tag);
|
|
8542
8707
|
};
|
|
8708
|
+
const closestPre = () => {
|
|
8709
|
+
const sel = window.getSelection();
|
|
8710
|
+
const node = sel?.anchorNode;
|
|
8711
|
+
if (!node || !editorRef.current?.contains(node)) return null;
|
|
8712
|
+
const el = node.nodeType === Node.ELEMENT_NODE ? node : node.parentElement;
|
|
8713
|
+
return el?.closest("pre") ?? null;
|
|
8714
|
+
};
|
|
8715
|
+
const insertCodeBlock = () => {
|
|
8716
|
+
const el = editorRef.current;
|
|
8717
|
+
const sel = window.getSelection();
|
|
8718
|
+
if (!el || !sel || sel.rangeCount === 0) return;
|
|
8719
|
+
const existing = closestPre();
|
|
8720
|
+
if (existing) {
|
|
8721
|
+
const p = document.createElement("p");
|
|
8722
|
+
p.textContent = existing.textContent || "";
|
|
8723
|
+
if (!p.textContent) p.innerHTML = "<br>";
|
|
8724
|
+
existing.replaceWith(p);
|
|
8725
|
+
placeCaretAtEnd(p);
|
|
8726
|
+
handleInput();
|
|
8727
|
+
return;
|
|
8728
|
+
}
|
|
8729
|
+
const range = sel.getRangeAt(0);
|
|
8730
|
+
const frag = range.cloneContents();
|
|
8731
|
+
const holder = document.createElement("div");
|
|
8732
|
+
holder.appendChild(frag);
|
|
8733
|
+
const BLOCK = /^(p|div|h[1-6]|li|blockquote|pre|tr)$/i;
|
|
8734
|
+
const linesOf = (node) => {
|
|
8735
|
+
const out = [];
|
|
8736
|
+
let cur = "";
|
|
8737
|
+
for (const child of Array.from(node.childNodes)) {
|
|
8738
|
+
if (child.nodeType === Node.TEXT_NODE) {
|
|
8739
|
+
cur += child.textContent || "";
|
|
8740
|
+
} else if (child.nodeName === "BR") {
|
|
8741
|
+
out.push(cur);
|
|
8742
|
+
cur = "";
|
|
8743
|
+
} else if (BLOCK.test(child.nodeName)) {
|
|
8744
|
+
if (cur) {
|
|
8745
|
+
out.push(cur);
|
|
8746
|
+
cur = "";
|
|
8747
|
+
}
|
|
8748
|
+
const sub = linesOf(child);
|
|
8749
|
+
out.push(...sub.length > 0 ? sub : [""]);
|
|
8750
|
+
} else {
|
|
8751
|
+
cur += linesOf(child).join("\n");
|
|
8752
|
+
}
|
|
8753
|
+
}
|
|
8754
|
+
if (cur) out.push(cur);
|
|
8755
|
+
return out;
|
|
8756
|
+
};
|
|
8757
|
+
const text = linesOf(holder).join("\n").replace(/\n+$/, "");
|
|
8758
|
+
const pre = document.createElement("pre");
|
|
8759
|
+
const code = document.createElement("code");
|
|
8760
|
+
code.textContent = text || "";
|
|
8761
|
+
pre.appendChild(code);
|
|
8762
|
+
range.deleteContents();
|
|
8763
|
+
range.insertNode(pre);
|
|
8764
|
+
ensureParagraphAfter(pre);
|
|
8765
|
+
placeCaretAtEnd(code);
|
|
8766
|
+
handleInput();
|
|
8767
|
+
};
|
|
8768
|
+
const insertTextAtCaret = (text) => {
|
|
8769
|
+
const sel = window.getSelection();
|
|
8770
|
+
if (!sel || sel.rangeCount === 0) return;
|
|
8771
|
+
const range = sel.getRangeAt(0);
|
|
8772
|
+
range.deleteContents();
|
|
8773
|
+
const node = document.createTextNode(text);
|
|
8774
|
+
range.insertNode(node);
|
|
8775
|
+
range.setStartAfter(node);
|
|
8776
|
+
range.collapse(true);
|
|
8777
|
+
sel.removeAllRanges();
|
|
8778
|
+
sel.addRange(range);
|
|
8779
|
+
handleInput();
|
|
8780
|
+
};
|
|
8781
|
+
const ensureParagraphAfter = (node) => {
|
|
8782
|
+
const next = node.nextElementSibling;
|
|
8783
|
+
if (next && next.tagName === "P") return;
|
|
8784
|
+
const p = document.createElement("p");
|
|
8785
|
+
p.innerHTML = "<br>";
|
|
8786
|
+
node.after(p);
|
|
8787
|
+
};
|
|
8788
|
+
const placeCaretAtEnd = (node) => {
|
|
8789
|
+
const sel = window.getSelection();
|
|
8790
|
+
if (!sel) return;
|
|
8791
|
+
const r2 = document.createRange();
|
|
8792
|
+
r2.selectNodeContents(node);
|
|
8793
|
+
r2.collapse(false);
|
|
8794
|
+
sel.removeAllRanges();
|
|
8795
|
+
sel.addRange(r2);
|
|
8796
|
+
editorRef.current?.focus();
|
|
8797
|
+
};
|
|
8543
8798
|
const insertDivider = () => {
|
|
8544
8799
|
exec("insertHorizontalRule");
|
|
8545
8800
|
const el = editorRef.current;
|
|
@@ -8586,7 +8841,9 @@ var Editor = (props) => {
|
|
|
8586
8841
|
const range = sel.getRangeAt(0);
|
|
8587
8842
|
slashStartRangeRef.current = range.cloneRange();
|
|
8588
8843
|
const rect = range.getBoundingClientRect();
|
|
8589
|
-
const
|
|
8844
|
+
const editorEl = editorRef.current;
|
|
8845
|
+
if (!editorEl) return;
|
|
8846
|
+
const editorRect = editorEl.getBoundingClientRect();
|
|
8590
8847
|
setSlashPos({
|
|
8591
8848
|
top: rect.bottom - editorRect.top + 4,
|
|
8592
8849
|
left: rect.left - editorRect.left
|
|
@@ -8601,7 +8858,7 @@ var Editor = (props) => {
|
|
|
8601
8858
|
setSlashIdx(0);
|
|
8602
8859
|
slashStartRangeRef.current = null;
|
|
8603
8860
|
};
|
|
8604
|
-
const filteredSlashItems =
|
|
8861
|
+
const filteredSlashItems = import_react22.default.useMemo(() => {
|
|
8605
8862
|
if (!slashFilter) return SLASH_ITEMS;
|
|
8606
8863
|
const f = slashFilter.toLowerCase();
|
|
8607
8864
|
return SLASH_ITEMS.filter((it) => it.label.toLowerCase().includes(f) || it.key.includes(f));
|
|
@@ -8644,7 +8901,7 @@ var Editor = (props) => {
|
|
|
8644
8901
|
setBlock("blockquote");
|
|
8645
8902
|
break;
|
|
8646
8903
|
case "code-block":
|
|
8647
|
-
|
|
8904
|
+
insertCodeBlock();
|
|
8648
8905
|
break;
|
|
8649
8906
|
case "divider":
|
|
8650
8907
|
insertDivider();
|
|
@@ -8662,7 +8919,9 @@ var Editor = (props) => {
|
|
|
8662
8919
|
if (!sel || sel.rangeCount === 0) return;
|
|
8663
8920
|
const range = sel.getRangeAt(0);
|
|
8664
8921
|
const rect = range.getBoundingClientRect();
|
|
8665
|
-
const
|
|
8922
|
+
const editorEl2 = editorRef.current;
|
|
8923
|
+
if (!editorEl2) return;
|
|
8924
|
+
const editorRect = editorEl2.getBoundingClientRect();
|
|
8666
8925
|
setLinkPos({
|
|
8667
8926
|
top: rect.bottom - editorRect.top + 4,
|
|
8668
8927
|
left: rect.left - editorRect.left
|
|
@@ -8695,13 +8954,13 @@ var Editor = (props) => {
|
|
|
8695
8954
|
if (node.nodeType !== Node.TEXT_NODE) return false;
|
|
8696
8955
|
const text = (node.textContent || "").slice(0, range.startOffset);
|
|
8697
8956
|
const patterns = [
|
|
8698
|
-
[
|
|
8699
|
-
[
|
|
8700
|
-
[
|
|
8701
|
-
[
|
|
8702
|
-
[
|
|
8703
|
-
[/^1
|
|
8704
|
-
[
|
|
8957
|
+
[/^###$/, () => setBlock("h3")],
|
|
8958
|
+
[/^##$/, () => setBlock("h2")],
|
|
8959
|
+
[/^#$/, () => setBlock("h1")],
|
|
8960
|
+
[/^-$/, () => exec("insertUnorderedList")],
|
|
8961
|
+
[/^\*$/, () => exec("insertUnorderedList")],
|
|
8962
|
+
[/^1\.$/, () => exec("insertOrderedList")],
|
|
8963
|
+
[/^>$/, () => setBlock("blockquote")]
|
|
8705
8964
|
];
|
|
8706
8965
|
for (const [re, fn] of patterns) {
|
|
8707
8966
|
if (re.test(text)) {
|
|
@@ -8721,7 +8980,9 @@ var Editor = (props) => {
|
|
|
8721
8980
|
if (composingRef.current) return;
|
|
8722
8981
|
const el = editorRef.current;
|
|
8723
8982
|
if (!el) return;
|
|
8724
|
-
|
|
8983
|
+
const html = el.innerHTML;
|
|
8984
|
+
lastEmittedRef.current = html;
|
|
8985
|
+
onChange?.(html);
|
|
8725
8986
|
updateEmpty();
|
|
8726
8987
|
updateActiveFormats();
|
|
8727
8988
|
if (slashOpen) {
|
|
@@ -8749,6 +9010,31 @@ var Editor = (props) => {
|
|
|
8749
9010
|
};
|
|
8750
9011
|
const handleKeyDown = (e) => {
|
|
8751
9012
|
if (readOnly) return;
|
|
9013
|
+
if (composingRef.current || e.nativeEvent.isComposing || e.keyCode === 229) return;
|
|
9014
|
+
const pre = closestPre();
|
|
9015
|
+
if (pre && !slashOpen) {
|
|
9016
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
9017
|
+
const text = pre.textContent || "";
|
|
9018
|
+
if (text.endsWith("\n\n")) {
|
|
9019
|
+
e.preventDefault();
|
|
9020
|
+
const code = pre.querySelector("code") ?? pre;
|
|
9021
|
+
code.textContent = text.replace(/\n\n$/, "");
|
|
9022
|
+
ensureParagraphAfter(pre);
|
|
9023
|
+
const next = pre.nextElementSibling;
|
|
9024
|
+
if (next) placeCaretAtEnd(next);
|
|
9025
|
+
handleInput();
|
|
9026
|
+
return;
|
|
9027
|
+
}
|
|
9028
|
+
e.preventDefault();
|
|
9029
|
+
insertTextAtCaret("\n");
|
|
9030
|
+
return;
|
|
9031
|
+
}
|
|
9032
|
+
if (e.key === "Tab") {
|
|
9033
|
+
e.preventDefault();
|
|
9034
|
+
insertTextAtCaret(" ");
|
|
9035
|
+
return;
|
|
9036
|
+
}
|
|
9037
|
+
}
|
|
8752
9038
|
if (slashOpen) {
|
|
8753
9039
|
if (e.key === "ArrowDown") {
|
|
8754
9040
|
e.preventDefault();
|
|
@@ -8795,6 +9081,7 @@ var Editor = (props) => {
|
|
|
8795
9081
|
return;
|
|
8796
9082
|
}
|
|
8797
9083
|
}
|
|
9084
|
+
if (pre) return;
|
|
8798
9085
|
if (enableSlashCommand && e.key === "/") {
|
|
8799
9086
|
setTimeout(openSlashMenu, 0);
|
|
8800
9087
|
}
|
|
@@ -8807,8 +9094,12 @@ var Editor = (props) => {
|
|
|
8807
9094
|
const handlePaste = (e) => {
|
|
8808
9095
|
if (readOnly) return;
|
|
8809
9096
|
e.preventDefault();
|
|
8810
|
-
const html = e.clipboardData.getData("text/html");
|
|
8811
9097
|
const text = e.clipboardData.getData("text/plain");
|
|
9098
|
+
if (closestPre()) {
|
|
9099
|
+
insertTextAtCaret(text);
|
|
9100
|
+
return;
|
|
9101
|
+
}
|
|
9102
|
+
const html = e.clipboardData.getData("text/html");
|
|
8812
9103
|
const clean = html ? sanitizeHtml(html) : escapeHtml(text);
|
|
8813
9104
|
document.execCommand("insertHTML", false, clean);
|
|
8814
9105
|
handleInput();
|
|
@@ -8832,6 +9123,7 @@ var Editor = (props) => {
|
|
|
8832
9123
|
updateActiveFormats();
|
|
8833
9124
|
};
|
|
8834
9125
|
const onToolbarAction = (item) => {
|
|
9126
|
+
if (closestPre() && item !== "code-block") return;
|
|
8835
9127
|
switch (item) {
|
|
8836
9128
|
case "bold":
|
|
8837
9129
|
exec("bold");
|
|
@@ -8873,7 +9165,7 @@ var Editor = (props) => {
|
|
|
8873
9165
|
setBlock("blockquote");
|
|
8874
9166
|
break;
|
|
8875
9167
|
case "code-block":
|
|
8876
|
-
|
|
9168
|
+
insertCodeBlock();
|
|
8877
9169
|
break;
|
|
8878
9170
|
case "link":
|
|
8879
9171
|
openLinkEditor();
|
|
@@ -8903,6 +9195,10 @@ var Editor = (props) => {
|
|
|
8903
9195
|
ref: editorRef,
|
|
8904
9196
|
contentEditable: !readOnly,
|
|
8905
9197
|
suppressContentEditableWarning: true,
|
|
9198
|
+
role: "textbox",
|
|
9199
|
+
"aria-multiline": "true",
|
|
9200
|
+
"aria-readonly": readOnly || void 0,
|
|
9201
|
+
"aria-label": placeholder,
|
|
8906
9202
|
className: "lib-xplat-editor__editable",
|
|
8907
9203
|
onInput: handleInput,
|
|
8908
9204
|
onKeyDown: handleKeyDown,
|
|
@@ -8994,7 +9290,7 @@ var EditorToolbar = ({ items, active, onAction }) => {
|
|
|
8994
9290
|
)) });
|
|
8995
9291
|
};
|
|
8996
9292
|
var SlashMenu = ({ position, items, activeIndex, onSelect, onClose }) => {
|
|
8997
|
-
|
|
9293
|
+
import_react22.default.useEffect(() => {
|
|
8998
9294
|
const handleClickOutside = (e) => {
|
|
8999
9295
|
const target = e.target;
|
|
9000
9296
|
const menu = document.querySelector(".lib-xplat-editor__slash-menu");
|
|
@@ -9028,8 +9324,8 @@ var SlashMenu = ({ position, items, activeIndex, onSelect, onClose }) => {
|
|
|
9028
9324
|
);
|
|
9029
9325
|
};
|
|
9030
9326
|
var LinkPopover = ({ position, value, onChange, onConfirm, onClose }) => {
|
|
9031
|
-
const inputRef =
|
|
9032
|
-
|
|
9327
|
+
const inputRef = import_react22.default.useRef(null);
|
|
9328
|
+
import_react22.default.useEffect(() => {
|
|
9033
9329
|
inputRef.current?.focus();
|
|
9034
9330
|
}, []);
|
|
9035
9331
|
return /* @__PURE__ */ (0, import_jsx_runtime323.jsxs)(
|
|
@@ -9087,7 +9383,7 @@ EmptyState.displayName = "EmptyState";
|
|
|
9087
9383
|
var EmptyState_default = EmptyState;
|
|
9088
9384
|
|
|
9089
9385
|
// src/components/FileUpload/FileUpload.tsx
|
|
9090
|
-
var
|
|
9386
|
+
var import_react23 = __toESM(require("react"), 1);
|
|
9091
9387
|
var import_jsx_runtime325 = require("react/jsx-runtime");
|
|
9092
9388
|
var FileUpload = (props) => {
|
|
9093
9389
|
const {
|
|
@@ -9099,8 +9395,8 @@ var FileUpload = (props) => {
|
|
|
9099
9395
|
description,
|
|
9100
9396
|
validations
|
|
9101
9397
|
} = props;
|
|
9102
|
-
const [isDragOver, setIsDragOver] =
|
|
9103
|
-
const inputRef =
|
|
9398
|
+
const [isDragOver, setIsDragOver] = import_react23.default.useState(false);
|
|
9399
|
+
const inputRef = import_react23.default.useRef(null);
|
|
9104
9400
|
const handleFiles = (fileList) => {
|
|
9105
9401
|
let files = Array.from(fileList);
|
|
9106
9402
|
if (maxSize) {
|
|
@@ -9162,10 +9458,10 @@ FileUpload.displayName = "FileUpload";
|
|
|
9162
9458
|
var FileUpload_default = FileUpload;
|
|
9163
9459
|
|
|
9164
9460
|
// src/components/HtmlTypeWriter/HtmlTypeWriter.tsx
|
|
9165
|
-
var
|
|
9461
|
+
var import_react25 = __toESM(require("react"), 1);
|
|
9166
9462
|
|
|
9167
9463
|
// src/components/HtmlTypeWriter/utils.ts
|
|
9168
|
-
var
|
|
9464
|
+
var import_react24 = __toESM(require("react"), 1);
|
|
9169
9465
|
var voidTags = /* @__PURE__ */ new Set([
|
|
9170
9466
|
"br",
|
|
9171
9467
|
"img",
|
|
@@ -9233,15 +9529,15 @@ var convertNodeToReactWithRange = (node, typedLen, rangeMap) => {
|
|
|
9233
9529
|
props[attr.name] = attr.value;
|
|
9234
9530
|
});
|
|
9235
9531
|
if (voidTags.has(tag)) {
|
|
9236
|
-
return
|
|
9532
|
+
return import_react24.default.createElement(tag, props);
|
|
9237
9533
|
}
|
|
9238
9534
|
const children = Array.from(element.childNodes).map((child) => convertNodeToReactWithRange(child, typedLen, rangeMap)).filter((n) => n != null);
|
|
9239
|
-
return
|
|
9535
|
+
return import_react24.default.createElement(tag, props, ...children);
|
|
9240
9536
|
};
|
|
9241
9537
|
var htmlToReactProgressive = (root, typedLen, rangeMap) => {
|
|
9242
9538
|
const nodes = Array.from(root.childNodes).map((child, idx) => {
|
|
9243
9539
|
const node = convertNodeToReactWithRange(child, typedLen, rangeMap);
|
|
9244
|
-
return node == null ? null :
|
|
9540
|
+
return node == null ? null : import_react24.default.createElement(import_react24.default.Fragment, { key: idx }, node);
|
|
9245
9541
|
}).filter(Boolean);
|
|
9246
9542
|
return nodes.length === 0 ? null : nodes;
|
|
9247
9543
|
};
|
|
@@ -9254,20 +9550,20 @@ var HtmlTypeWriter = ({
|
|
|
9254
9550
|
onDone,
|
|
9255
9551
|
onChange
|
|
9256
9552
|
}) => {
|
|
9257
|
-
const [typedLen, setTypedLen] =
|
|
9258
|
-
const doneCalledRef =
|
|
9259
|
-
const { doc, rangeMap, totalLength } =
|
|
9553
|
+
const [typedLen, setTypedLen] = import_react25.default.useState(0);
|
|
9554
|
+
const doneCalledRef = import_react25.default.useRef(false);
|
|
9555
|
+
const { doc, rangeMap, totalLength } = import_react25.default.useMemo(() => {
|
|
9260
9556
|
if (typeof window === "undefined") return { doc: null, rangeMap: /* @__PURE__ */ new Map(), totalLength: 0 };
|
|
9261
9557
|
const decoded = decodeHtmlEntities(html);
|
|
9262
9558
|
const doc2 = new DOMParser().parseFromString(decoded, "text/html");
|
|
9263
9559
|
const { rangeMap: rangeMap2, totalLength: totalLength2 } = buildRangeMap(doc2.body);
|
|
9264
9560
|
return { doc: doc2, rangeMap: rangeMap2, totalLength: totalLength2 };
|
|
9265
9561
|
}, [html]);
|
|
9266
|
-
|
|
9562
|
+
import_react25.default.useEffect(() => {
|
|
9267
9563
|
setTypedLen(0);
|
|
9268
9564
|
doneCalledRef.current = false;
|
|
9269
9565
|
}, [html]);
|
|
9270
|
-
|
|
9566
|
+
import_react25.default.useEffect(() => {
|
|
9271
9567
|
if (!totalLength) return;
|
|
9272
9568
|
if (typedLen >= totalLength) return;
|
|
9273
9569
|
const timer = window.setInterval(() => {
|
|
@@ -9275,18 +9571,18 @@ var HtmlTypeWriter = ({
|
|
|
9275
9571
|
}, duration);
|
|
9276
9572
|
return () => window.clearInterval(timer);
|
|
9277
9573
|
}, [typedLen, totalLength, duration]);
|
|
9278
|
-
|
|
9574
|
+
import_react25.default.useEffect(() => {
|
|
9279
9575
|
if (typedLen > 0 && typedLen < totalLength) {
|
|
9280
9576
|
onChange?.();
|
|
9281
9577
|
}
|
|
9282
9578
|
}, [typedLen, totalLength, onChange]);
|
|
9283
|
-
|
|
9579
|
+
import_react25.default.useEffect(() => {
|
|
9284
9580
|
if (typedLen === totalLength && totalLength > 0 && !doneCalledRef.current) {
|
|
9285
9581
|
doneCalledRef.current = true;
|
|
9286
9582
|
onDone?.();
|
|
9287
9583
|
}
|
|
9288
9584
|
}, [typedLen, totalLength, onDone]);
|
|
9289
|
-
const parsed =
|
|
9585
|
+
const parsed = import_react25.default.useMemo(
|
|
9290
9586
|
() => doc ? htmlToReactProgressive(doc.body, typedLen, rangeMap) : null,
|
|
9291
9587
|
[doc, typedLen, rangeMap]
|
|
9292
9588
|
);
|
|
@@ -9296,12 +9592,12 @@ HtmlTypeWriter.displayName = "HtmlTypeWriter";
|
|
|
9296
9592
|
var HtmlTypeWriter_default = HtmlTypeWriter;
|
|
9297
9593
|
|
|
9298
9594
|
// src/components/ImageSelector/ImageSelector.tsx
|
|
9299
|
-
var
|
|
9595
|
+
var import_react26 = __toESM(require("react"), 1);
|
|
9300
9596
|
var import_jsx_runtime327 = require("react/jsx-runtime");
|
|
9301
9597
|
var ImageSelector = (props) => {
|
|
9302
9598
|
const { value, label, onChange, validations } = props;
|
|
9303
|
-
const [previewUrl, setPreviewUrl] =
|
|
9304
|
-
|
|
9599
|
+
const [previewUrl, setPreviewUrl] = import_react26.default.useState();
|
|
9600
|
+
import_react26.default.useEffect(() => {
|
|
9305
9601
|
if (!value) {
|
|
9306
9602
|
setPreviewUrl(void 0);
|
|
9307
9603
|
return;
|
|
@@ -9310,7 +9606,7 @@ var ImageSelector = (props) => {
|
|
|
9310
9606
|
setPreviewUrl(url);
|
|
9311
9607
|
return () => URL.revokeObjectURL(url);
|
|
9312
9608
|
}, [value]);
|
|
9313
|
-
const inputRef =
|
|
9609
|
+
const inputRef = import_react26.default.useRef(null);
|
|
9314
9610
|
const handleFileChange = (e) => {
|
|
9315
9611
|
const selectedFile = e.target.files?.[0];
|
|
9316
9612
|
if (selectedFile) {
|
|
@@ -9398,11 +9694,12 @@ var NotificationBadge = (props) => {
|
|
|
9398
9694
|
dot = false,
|
|
9399
9695
|
size = "md"
|
|
9400
9696
|
} = props;
|
|
9697
|
+
const statusType = normalizeStatus(type);
|
|
9401
9698
|
const showBadge = dot || count !== void 0 && count > 0;
|
|
9402
9699
|
const displayCount = count !== void 0 && count > maxCount ? `${maxCount}+` : count;
|
|
9403
9700
|
return /* @__PURE__ */ (0, import_jsx_runtime330.jsxs)("div", { className: clsx_default("lib-xplat-notification-badge", size), children: [
|
|
9404
9701
|
children,
|
|
9405
|
-
showBadge && /* @__PURE__ */ (0, import_jsx_runtime330.jsx)("span", { className: clsx_default("badge-indicator",
|
|
9702
|
+
showBadge && /* @__PURE__ */ (0, import_jsx_runtime330.jsx)("span", { className: clsx_default("badge-indicator", statusType, { dot }), children: !dot && displayCount })
|
|
9406
9703
|
] });
|
|
9407
9704
|
};
|
|
9408
9705
|
NotificationBadge.displayName = "NotificationBadge";
|
|
@@ -9443,8 +9740,9 @@ var Pagination = (props) => {
|
|
|
9443
9740
|
siblingCount = 1,
|
|
9444
9741
|
onChange,
|
|
9445
9742
|
size = "md",
|
|
9446
|
-
type = "
|
|
9743
|
+
type = "primary"
|
|
9447
9744
|
} = props;
|
|
9745
|
+
const statusType = normalizeStatus(type);
|
|
9448
9746
|
const totalPages = Math.max(1, Math.ceil(total / pageSize));
|
|
9449
9747
|
const pages = getPageRange(current, totalPages, siblingCount);
|
|
9450
9748
|
const handleClick = (page) => {
|
|
@@ -9452,7 +9750,7 @@ var Pagination = (props) => {
|
|
|
9452
9750
|
onChange?.(page);
|
|
9453
9751
|
}
|
|
9454
9752
|
};
|
|
9455
|
-
return /* @__PURE__ */ (0, import_jsx_runtime331.jsxs)("nav", { className: clsx_default("lib-xplat-pagination", size,
|
|
9753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime331.jsxs)("nav", { className: clsx_default("lib-xplat-pagination", size, statusType), "aria-label": "\uD398\uC774\uC9C0 \uB124\uBE44\uAC8C\uC774\uC158", children: [
|
|
9456
9754
|
/* @__PURE__ */ (0, import_jsx_runtime331.jsx)(
|
|
9457
9755
|
"button",
|
|
9458
9756
|
{
|
|
@@ -9491,17 +9789,21 @@ Pagination.displayName = "Pagination";
|
|
|
9491
9789
|
var Pagination_default = Pagination;
|
|
9492
9790
|
|
|
9493
9791
|
// src/components/PopOver/PopOver.tsx
|
|
9494
|
-
var
|
|
9792
|
+
var import_react27 = __toESM(require("react"), 1);
|
|
9495
9793
|
var import_jsx_runtime332 = require("react/jsx-runtime");
|
|
9496
9794
|
var PopOver = (props) => {
|
|
9497
9795
|
const { children, isOpen, onClose, PopOverEl } = props;
|
|
9498
|
-
const popRef =
|
|
9499
|
-
const triggerRef =
|
|
9500
|
-
const [localOpen, setLocalOpen] =
|
|
9501
|
-
const [eventTrigger, setEventTrigger] =
|
|
9796
|
+
const popRef = import_react27.default.useRef(null);
|
|
9797
|
+
const triggerRef = import_react27.default.useRef(null);
|
|
9798
|
+
const [localOpen, setLocalOpen] = import_react27.default.useState(false);
|
|
9799
|
+
const [eventTrigger, setEventTrigger] = import_react27.default.useState(false);
|
|
9502
9800
|
useClickOutside_default([popRef, triggerRef], onClose, isOpen);
|
|
9801
|
+
useEscapeKey(isOpen, () => {
|
|
9802
|
+
onClose();
|
|
9803
|
+
triggerRef.current?.focus({ preventScroll: true });
|
|
9804
|
+
});
|
|
9503
9805
|
const position = useAutoPosition_default(triggerRef, popRef, localOpen);
|
|
9504
|
-
|
|
9806
|
+
import_react27.default.useEffect(() => {
|
|
9505
9807
|
if (isOpen) {
|
|
9506
9808
|
setLocalOpen(isOpen);
|
|
9507
9809
|
setTimeout(() => {
|
|
@@ -9553,11 +9855,12 @@ var Progress = (props) => {
|
|
|
9553
9855
|
value,
|
|
9554
9856
|
max = 100,
|
|
9555
9857
|
size = "md",
|
|
9556
|
-
type = "
|
|
9858
|
+
type = "primary",
|
|
9557
9859
|
showLabel = false
|
|
9558
9860
|
} = props;
|
|
9861
|
+
const statusType = normalizeStatus(type);
|
|
9559
9862
|
const percentage = Math.min(100, Math.max(0, value / max * 100));
|
|
9560
|
-
return /* @__PURE__ */ (0, import_jsx_runtime333.jsxs)("div", { className: clsx_default("lib-xplat-progress", size,
|
|
9863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime333.jsxs)("div", { className: clsx_default("lib-xplat-progress", size, statusType), children: [
|
|
9561
9864
|
/* @__PURE__ */ (0, import_jsx_runtime333.jsx)(
|
|
9562
9865
|
"div",
|
|
9563
9866
|
{
|
|
@@ -9585,12 +9888,12 @@ Progress.displayName = "Progress";
|
|
|
9585
9888
|
var Progress_default = Progress;
|
|
9586
9889
|
|
|
9587
9890
|
// src/components/Radio/RadioGroupContext.tsx
|
|
9588
|
-
var
|
|
9589
|
-
var RadioGroupContext =
|
|
9891
|
+
var import_react28 = __toESM(require("react"), 1);
|
|
9892
|
+
var RadioGroupContext = import_react28.default.createContext(
|
|
9590
9893
|
null
|
|
9591
9894
|
);
|
|
9592
9895
|
var useRadioGroupContext = () => {
|
|
9593
|
-
return
|
|
9896
|
+
return import_react28.default.useContext(RadioGroupContext);
|
|
9594
9897
|
};
|
|
9595
9898
|
var RadioGroupContext_default = RadioGroupContext;
|
|
9596
9899
|
|
|
@@ -9602,10 +9905,11 @@ var Radio = (props) => {
|
|
|
9602
9905
|
className,
|
|
9603
9906
|
value,
|
|
9604
9907
|
size: sizeProp,
|
|
9605
|
-
type = "
|
|
9908
|
+
type = "primary",
|
|
9606
9909
|
validations,
|
|
9607
9910
|
...rest
|
|
9608
9911
|
} = props;
|
|
9912
|
+
const statusType = normalizeStatus(type);
|
|
9609
9913
|
const context = useRadioGroupContext();
|
|
9610
9914
|
const size = sizeProp ?? context?.size ?? "md";
|
|
9611
9915
|
const isGroup = !!context;
|
|
@@ -9621,7 +9925,7 @@ var Radio = (props) => {
|
|
|
9621
9925
|
className: clsx_default(
|
|
9622
9926
|
"lib-xplat-radio",
|
|
9623
9927
|
size,
|
|
9624
|
-
|
|
9928
|
+
statusType,
|
|
9625
9929
|
localChecked ? "checked" : void 0,
|
|
9626
9930
|
className
|
|
9627
9931
|
),
|
|
@@ -9665,19 +9969,19 @@ RadioGroup.displayName = "RadioGroup";
|
|
|
9665
9969
|
var RadioGroup_default = RadioGroup;
|
|
9666
9970
|
|
|
9667
9971
|
// src/components/Select/Select.tsx
|
|
9668
|
-
var
|
|
9972
|
+
var import_react31 = __toESM(require("react"), 1);
|
|
9669
9973
|
|
|
9670
9974
|
// src/components/Select/context.ts
|
|
9671
|
-
var
|
|
9672
|
-
var SelectContext =
|
|
9975
|
+
var import_react29 = __toESM(require("react"), 1);
|
|
9976
|
+
var SelectContext = import_react29.default.createContext(null);
|
|
9673
9977
|
var context_default = SelectContext;
|
|
9674
9978
|
|
|
9675
9979
|
// src/components/Select/SelectItem.tsx
|
|
9676
|
-
var
|
|
9980
|
+
var import_react30 = __toESM(require("react"), 1);
|
|
9677
9981
|
var import_jsx_runtime336 = require("react/jsx-runtime");
|
|
9678
9982
|
var SelectItem = (props) => {
|
|
9679
9983
|
const { children, value, onClick, disabled = false } = props;
|
|
9680
|
-
const ctx =
|
|
9984
|
+
const ctx = import_react30.default.useContext(context_default);
|
|
9681
9985
|
const handleClick = (e) => {
|
|
9682
9986
|
e.preventDefault();
|
|
9683
9987
|
e.stopPropagation();
|
|
@@ -9717,32 +10021,37 @@ var SelectRoot = (props) => {
|
|
|
9717
10021
|
onChange,
|
|
9718
10022
|
children,
|
|
9719
10023
|
disabled = false,
|
|
10024
|
+
searchable = false,
|
|
10025
|
+
searchPlaceholder = "\uAC80\uC0C9",
|
|
9720
10026
|
error = false,
|
|
9721
10027
|
validations,
|
|
10028
|
+
label,
|
|
10029
|
+
required,
|
|
9722
10030
|
size = "md"
|
|
9723
10031
|
} = props;
|
|
9724
|
-
const
|
|
9725
|
-
|
|
10032
|
+
const fieldId = import_react31.default.useId();
|
|
10033
|
+
const itemChildren = import_react31.default.Children.toArray(children).filter(
|
|
10034
|
+
(child) => import_react31.default.isValidElement(child) && child.type === SelectItem_default
|
|
9726
10035
|
);
|
|
9727
10036
|
const isControlled = valueProp !== void 0;
|
|
9728
|
-
const [isOpen, setOpen] =
|
|
9729
|
-
const [uncontrolledLabel, setUncontrolledLabel] =
|
|
9730
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
9731
|
-
const controlledLabel =
|
|
10037
|
+
const [isOpen, setOpen] = import_react31.default.useState(false);
|
|
10038
|
+
const [uncontrolledLabel, setUncontrolledLabel] = import_react31.default.useState(null);
|
|
10039
|
+
const [uncontrolledValue, setUncontrolledValue] = import_react31.default.useState(void 0);
|
|
10040
|
+
const controlledLabel = import_react31.default.useMemo(() => {
|
|
9732
10041
|
if (!isControlled) return null;
|
|
9733
10042
|
const match = itemChildren.find((child) => child.props.value === valueProp);
|
|
9734
10043
|
return match ? match.props.children : null;
|
|
9735
10044
|
}, [isControlled, valueProp, itemChildren]);
|
|
9736
10045
|
const selectedLabel = isControlled ? controlledLabel : uncontrolledLabel;
|
|
9737
10046
|
const selectedValue = isControlled ? valueProp : uncontrolledValue;
|
|
9738
|
-
const triggerRef =
|
|
9739
|
-
const contentRef =
|
|
9740
|
-
const [mounted, setMounted] =
|
|
9741
|
-
const [visible, setVisible] =
|
|
9742
|
-
|
|
10047
|
+
const triggerRef = import_react31.default.useRef(null);
|
|
10048
|
+
const contentRef = import_react31.default.useRef(null);
|
|
10049
|
+
const [mounted, setMounted] = import_react31.default.useState(false);
|
|
10050
|
+
const [visible, setVisible] = import_react31.default.useState(false);
|
|
10051
|
+
import_react31.default.useEffect(() => {
|
|
9743
10052
|
if (disabled && isOpen) setOpen(false);
|
|
9744
10053
|
}, [disabled, isOpen]);
|
|
9745
|
-
|
|
10054
|
+
import_react31.default.useEffect(() => {
|
|
9746
10055
|
if (isOpen) {
|
|
9747
10056
|
setMounted(true);
|
|
9748
10057
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -9752,22 +10061,42 @@ var SelectRoot = (props) => {
|
|
|
9752
10061
|
const t = setTimeout(() => setMounted(false), ANIMATION_DURATION_MS3);
|
|
9753
10062
|
return () => clearTimeout(t);
|
|
9754
10063
|
}, [isOpen]);
|
|
9755
|
-
const
|
|
9756
|
-
const
|
|
9757
|
-
|
|
10064
|
+
const [query, setQuery] = import_react31.default.useState("");
|
|
10065
|
+
const textOf = (node) => {
|
|
10066
|
+
if (node === null || node === void 0 || typeof node === "boolean") return "";
|
|
10067
|
+
if (typeof node === "string" || typeof node === "number") return String(node);
|
|
10068
|
+
if (Array.isArray(node)) return node.map(textOf).join("");
|
|
10069
|
+
if (import_react31.default.isValidElement(node)) return textOf(node.props.children);
|
|
10070
|
+
return "";
|
|
10071
|
+
};
|
|
10072
|
+
const visibleItems = import_react31.default.useMemo(() => {
|
|
10073
|
+
if (!searchable || !query.trim()) return itemChildren;
|
|
10074
|
+
const q = query.trim().toLowerCase();
|
|
10075
|
+
return itemChildren.filter((c) => textOf(c.props.children).toLowerCase().includes(q));
|
|
10076
|
+
}, [searchable, query, itemChildren]);
|
|
10077
|
+
const open = import_react31.default.useCallback(() => setOpen(true), []);
|
|
10078
|
+
const close = import_react31.default.useCallback(() => {
|
|
10079
|
+
setOpen(false);
|
|
10080
|
+
setQuery("");
|
|
10081
|
+
}, []);
|
|
10082
|
+
const toggle = import_react31.default.useCallback(() => setOpen((prev) => !prev), []);
|
|
9758
10083
|
useClickOutside_default([contentRef, triggerRef], close, isOpen);
|
|
10084
|
+
useEscapeKey(isOpen, () => {
|
|
10085
|
+
close();
|
|
10086
|
+
triggerRef.current?.focus({ preventScroll: true });
|
|
10087
|
+
});
|
|
9759
10088
|
const position = useAutoPosition_default(triggerRef, contentRef, mounted);
|
|
9760
|
-
const setSelected =
|
|
9761
|
-
(
|
|
10089
|
+
const setSelected = import_react31.default.useCallback(
|
|
10090
|
+
(label2, itemValue) => {
|
|
9762
10091
|
if (!isControlled) {
|
|
9763
|
-
setUncontrolledLabel(
|
|
10092
|
+
setUncontrolledLabel(label2);
|
|
9764
10093
|
setUncontrolledValue(itemValue);
|
|
9765
10094
|
}
|
|
9766
|
-
onChange?.(itemValue,
|
|
10095
|
+
onChange?.(itemValue, label2);
|
|
9767
10096
|
},
|
|
9768
10097
|
[isControlled, onChange]
|
|
9769
10098
|
);
|
|
9770
|
-
const ctxValue =
|
|
10099
|
+
const ctxValue = import_react31.default.useMemo(
|
|
9771
10100
|
() => ({
|
|
9772
10101
|
isOpen,
|
|
9773
10102
|
mounted,
|
|
@@ -9803,6 +10132,7 @@ var SelectRoot = (props) => {
|
|
|
9803
10132
|
/* @__PURE__ */ (0, import_jsx_runtime337.jsxs)(
|
|
9804
10133
|
"div",
|
|
9805
10134
|
{
|
|
10135
|
+
id: fieldId,
|
|
9806
10136
|
ref: triggerRef,
|
|
9807
10137
|
className: clsx_default(
|
|
9808
10138
|
"select-trigger",
|
|
@@ -9845,20 +10175,33 @@ var SelectRoot = (props) => {
|
|
|
9845
10175
|
]
|
|
9846
10176
|
}
|
|
9847
10177
|
),
|
|
9848
|
-
mounted && /* @__PURE__ */ (0, import_jsx_runtime337.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime337.
|
|
10178
|
+
mounted && /* @__PURE__ */ (0, import_jsx_runtime337.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime337.jsxs)(
|
|
9849
10179
|
"div",
|
|
9850
10180
|
{
|
|
9851
10181
|
className: clsx_default("lib-xplat-select-content", size, position.direction, stateClass),
|
|
9852
10182
|
ref: contentRef,
|
|
9853
10183
|
style: { ...position.position, width: triggerRef.current?.offsetWidth },
|
|
9854
10184
|
role: "listbox",
|
|
9855
|
-
children:
|
|
10185
|
+
children: [
|
|
10186
|
+
searchable && /* @__PURE__ */ (0, import_jsx_runtime337.jsx)("div", { className: "select-search", children: /* @__PURE__ */ (0, import_jsx_runtime337.jsx)(
|
|
10187
|
+
"input",
|
|
10188
|
+
{
|
|
10189
|
+
type: "text",
|
|
10190
|
+
value: query,
|
|
10191
|
+
placeholder: searchPlaceholder,
|
|
10192
|
+
onChange: (e) => setQuery(e.target.value),
|
|
10193
|
+
autoFocus: true,
|
|
10194
|
+
"aria-label": searchPlaceholder
|
|
10195
|
+
}
|
|
10196
|
+
) }),
|
|
10197
|
+
/* @__PURE__ */ (0, import_jsx_runtime337.jsx)(context_default.Provider, { value: ctxValue, children: visibleItems.length > 0 ? visibleItems : /* @__PURE__ */ (0, import_jsx_runtime337.jsx)("div", { className: "select-empty", children: "\uACB0\uACFC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4" }) })
|
|
10198
|
+
]
|
|
9856
10199
|
}
|
|
9857
10200
|
) })
|
|
9858
10201
|
]
|
|
9859
10202
|
}
|
|
9860
10203
|
) });
|
|
9861
|
-
return /* @__PURE__ */ (0, import_jsx_runtime337.jsx)(Field, { validations, children: control });
|
|
10204
|
+
return /* @__PURE__ */ (0, import_jsx_runtime337.jsx)(Field, { validations, label, required, htmlFor: fieldId, children: control });
|
|
9862
10205
|
};
|
|
9863
10206
|
SelectRoot.displayName = "Select";
|
|
9864
10207
|
var Select = Object.assign(SelectRoot, {
|
|
@@ -9900,12 +10243,13 @@ var import_jsx_runtime339 = require("react/jsx-runtime");
|
|
|
9900
10243
|
var Spinner = (props) => {
|
|
9901
10244
|
const {
|
|
9902
10245
|
size = "md",
|
|
9903
|
-
type = "
|
|
10246
|
+
type = "primary"
|
|
9904
10247
|
} = props;
|
|
10248
|
+
const statusType = normalizeStatus(type);
|
|
9905
10249
|
return /* @__PURE__ */ (0, import_jsx_runtime339.jsx)(
|
|
9906
10250
|
"div",
|
|
9907
10251
|
{
|
|
9908
|
-
className: clsx_default("lib-xplat-spinner", size,
|
|
10252
|
+
className: clsx_default("lib-xplat-spinner", size, statusType),
|
|
9909
10253
|
role: "status",
|
|
9910
10254
|
"aria-label": "\uB85C\uB529 \uC911",
|
|
9911
10255
|
children: /* @__PURE__ */ (0, import_jsx_runtime339.jsxs)("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
@@ -9937,21 +10281,58 @@ var Spinner = (props) => {
|
|
|
9937
10281
|
Spinner.displayName = "Spinner";
|
|
9938
10282
|
var Spinner_default = Spinner;
|
|
9939
10283
|
|
|
9940
|
-
// src/components/
|
|
10284
|
+
// src/components/Stat/Stat.tsx
|
|
9941
10285
|
var import_jsx_runtime340 = require("react/jsx-runtime");
|
|
10286
|
+
var ARROW = {
|
|
10287
|
+
up: "\u25B2",
|
|
10288
|
+
down: "\u25BC",
|
|
10289
|
+
flat: "\u2014"
|
|
10290
|
+
};
|
|
10291
|
+
var Stat = (props) => {
|
|
10292
|
+
const {
|
|
10293
|
+
label,
|
|
10294
|
+
value,
|
|
10295
|
+
unit,
|
|
10296
|
+
description,
|
|
10297
|
+
trend,
|
|
10298
|
+
icon,
|
|
10299
|
+
size = "md",
|
|
10300
|
+
type = "primary"
|
|
10301
|
+
} = props;
|
|
10302
|
+
const statusType = normalizeStatus(type);
|
|
10303
|
+
return /* @__PURE__ */ (0, import_jsx_runtime340.jsxs)("div", { className: clsx_default("lib-xplat-stat", size, statusType), children: [
|
|
10304
|
+
/* @__PURE__ */ (0, import_jsx_runtime340.jsx)("div", { className: "stat-label", children: label }),
|
|
10305
|
+
/* @__PURE__ */ (0, import_jsx_runtime340.jsxs)("div", { className: "stat-value-row", children: [
|
|
10306
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime340.jsx)("span", { className: "stat-icon", children: icon }),
|
|
10307
|
+
/* @__PURE__ */ (0, import_jsx_runtime340.jsx)("span", { className: "stat-value", children: value }),
|
|
10308
|
+
unit && /* @__PURE__ */ (0, import_jsx_runtime340.jsx)("span", { className: "stat-unit", children: unit }),
|
|
10309
|
+
trend && /* @__PURE__ */ (0, import_jsx_runtime340.jsxs)("span", { className: clsx_default("stat-trend", trend.direction), children: [
|
|
10310
|
+
/* @__PURE__ */ (0, import_jsx_runtime340.jsx)("span", { "aria-hidden": "true", children: ARROW[trend.direction] }),
|
|
10311
|
+
trend.value
|
|
10312
|
+
] })
|
|
10313
|
+
] }),
|
|
10314
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime340.jsx)("div", { className: "stat-description", children: description })
|
|
10315
|
+
] });
|
|
10316
|
+
};
|
|
10317
|
+
Stat.displayName = "Stat";
|
|
10318
|
+
var Stat_default = Stat;
|
|
10319
|
+
|
|
10320
|
+
// src/components/Steps/Steps.tsx
|
|
10321
|
+
var import_jsx_runtime341 = require("react/jsx-runtime");
|
|
9942
10322
|
var Steps = (props) => {
|
|
9943
10323
|
const {
|
|
9944
10324
|
items,
|
|
9945
10325
|
current,
|
|
9946
|
-
type = "
|
|
10326
|
+
type = "primary"
|
|
9947
10327
|
} = props;
|
|
9948
|
-
|
|
10328
|
+
const statusType = normalizeStatus(type);
|
|
10329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime341.jsx)("div", { className: clsx_default("lib-xplat-steps", statusType), children: items.map((item, index) => {
|
|
9949
10330
|
const status = index < current ? "completed" : index === current ? "active" : "pending";
|
|
9950
|
-
return /* @__PURE__ */ (0,
|
|
9951
|
-
/* @__PURE__ */ (0,
|
|
9952
|
-
/* @__PURE__ */ (0,
|
|
9953
|
-
/* @__PURE__ */ (0,
|
|
9954
|
-
item.description && /* @__PURE__ */ (0,
|
|
10331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime341.jsxs)("div", { className: clsx_default("step-item", status), children: [
|
|
10332
|
+
/* @__PURE__ */ (0, import_jsx_runtime341.jsx)("div", { className: "step-circle", children: status === "completed" ? /* @__PURE__ */ (0, import_jsx_runtime341.jsx)(CheckIcon_default, {}) : /* @__PURE__ */ (0, import_jsx_runtime341.jsx)("span", { children: index + 1 }) }),
|
|
10333
|
+
/* @__PURE__ */ (0, import_jsx_runtime341.jsxs)("div", { className: "step-content", children: [
|
|
10334
|
+
/* @__PURE__ */ (0, import_jsx_runtime341.jsx)("span", { className: "step-title", children: item.title }),
|
|
10335
|
+
item.description && /* @__PURE__ */ (0, import_jsx_runtime341.jsx)("span", { className: "step-description", children: item.description })
|
|
9955
10336
|
] })
|
|
9956
10337
|
] }, index);
|
|
9957
10338
|
}) });
|
|
@@ -9960,8 +10341,8 @@ Steps.displayName = "Steps";
|
|
|
9960
10341
|
var Steps_default = Steps;
|
|
9961
10342
|
|
|
9962
10343
|
// src/components/Swiper/Swiper.tsx
|
|
9963
|
-
var
|
|
9964
|
-
var
|
|
10344
|
+
var import_react32 = __toESM(require("react"), 1);
|
|
10345
|
+
var import_jsx_runtime342 = require("react/jsx-runtime");
|
|
9965
10346
|
var Swiper = (props) => {
|
|
9966
10347
|
const {
|
|
9967
10348
|
auto = false,
|
|
@@ -9985,26 +10366,26 @@ var Swiper = (props) => {
|
|
|
9985
10366
|
const maxIndex = Math.max(0, totalSlides - viewItemCount);
|
|
9986
10367
|
const useLoop = loop && canSlide;
|
|
9987
10368
|
const cloneCount = useLoop ? totalSlides : 0;
|
|
9988
|
-
const extendedItems =
|
|
10369
|
+
const extendedItems = import_react32.default.useMemo(() => {
|
|
9989
10370
|
if (!useLoop) return items;
|
|
9990
10371
|
return [...items, ...items, ...items];
|
|
9991
10372
|
}, [items, useLoop]);
|
|
9992
10373
|
const initialIdx = Math.max(0, Math.min(indexProp ?? 0, maxIndex));
|
|
9993
|
-
const [innerIndex, setInnerIndex] =
|
|
10374
|
+
const [innerIndex, setInnerIndex] = import_react32.default.useState(
|
|
9994
10375
|
useLoop ? cloneCount + initialIdx : initialIdx
|
|
9995
10376
|
);
|
|
9996
|
-
const [isDragging, setIsDragging] =
|
|
9997
|
-
const [dragOffset, setDragOffset] =
|
|
9998
|
-
const [animated, setAnimated] =
|
|
9999
|
-
const [containerWidth, setContainerWidth] =
|
|
10000
|
-
const containerRef =
|
|
10001
|
-
const startXRef =
|
|
10002
|
-
const startTimeRef =
|
|
10003
|
-
const autoplayTimerRef =
|
|
10004
|
-
const resumeTimeoutRef =
|
|
10005
|
-
const [paused, setPaused] =
|
|
10006
|
-
const initializedRef =
|
|
10007
|
-
|
|
10377
|
+
const [isDragging, setIsDragging] = import_react32.default.useState(false);
|
|
10378
|
+
const [dragOffset, setDragOffset] = import_react32.default.useState(0);
|
|
10379
|
+
const [animated, setAnimated] = import_react32.default.useState(false);
|
|
10380
|
+
const [containerWidth, setContainerWidth] = import_react32.default.useState(0);
|
|
10381
|
+
const containerRef = import_react32.default.useRef(null);
|
|
10382
|
+
const startXRef = import_react32.default.useRef(0);
|
|
10383
|
+
const startTimeRef = import_react32.default.useRef(0);
|
|
10384
|
+
const autoplayTimerRef = import_react32.default.useRef(null);
|
|
10385
|
+
const resumeTimeoutRef = import_react32.default.useRef(null);
|
|
10386
|
+
const [paused, setPaused] = import_react32.default.useState(false);
|
|
10387
|
+
const initializedRef = import_react32.default.useRef(false);
|
|
10388
|
+
import_react32.default.useEffect(() => {
|
|
10008
10389
|
const el = containerRef.current;
|
|
10009
10390
|
if (!el) return;
|
|
10010
10391
|
const ro = new ResizeObserver((entries) => {
|
|
@@ -10027,7 +10408,7 @@ var Swiper = (props) => {
|
|
|
10027
10408
|
return ((inner - cloneCount) % totalSlides + totalSlides) % totalSlides;
|
|
10028
10409
|
};
|
|
10029
10410
|
const realIndex = getRealIndex(innerIndex);
|
|
10030
|
-
const moveToInner =
|
|
10411
|
+
const moveToInner = import_react32.default.useCallback(
|
|
10031
10412
|
(idx, withAnim = true) => {
|
|
10032
10413
|
if (!useLoop) {
|
|
10033
10414
|
setAnimated(withAnim);
|
|
@@ -10055,7 +10436,7 @@ var Swiper = (props) => {
|
|
|
10055
10436
|
},
|
|
10056
10437
|
[useLoop, cloneCount, totalSlides]
|
|
10057
10438
|
);
|
|
10058
|
-
const handleTransitionEnd =
|
|
10439
|
+
const handleTransitionEnd = import_react32.default.useCallback(() => {
|
|
10059
10440
|
if (!useLoop) return;
|
|
10060
10441
|
const real = getRealIndex(innerIndex);
|
|
10061
10442
|
const canonical = cloneCount + real;
|
|
@@ -10065,7 +10446,7 @@ var Swiper = (props) => {
|
|
|
10065
10446
|
}
|
|
10066
10447
|
onChange?.(Math.min(real, maxIndex));
|
|
10067
10448
|
}, [useLoop, innerIndex, cloneCount, totalSlides, maxIndex, onChange]);
|
|
10068
|
-
const slideTo =
|
|
10449
|
+
const slideTo = import_react32.default.useCallback(
|
|
10069
10450
|
(logicalIndex) => {
|
|
10070
10451
|
if (!canSlide) return;
|
|
10071
10452
|
const clamped = useLoop ? logicalIndex : Math.max(0, Math.min(logicalIndex, maxIndex));
|
|
@@ -10075,7 +10456,7 @@ var Swiper = (props) => {
|
|
|
10075
10456
|
},
|
|
10076
10457
|
[canSlide, useLoop, cloneCount, maxIndex, onChange, moveToInner]
|
|
10077
10458
|
);
|
|
10078
|
-
const slideNext =
|
|
10459
|
+
const slideNext = import_react32.default.useCallback(() => {
|
|
10079
10460
|
if (!canSlide) return;
|
|
10080
10461
|
const nextInner = innerIndex + slideBy;
|
|
10081
10462
|
if (useLoop) {
|
|
@@ -10084,7 +10465,7 @@ var Swiper = (props) => {
|
|
|
10084
10465
|
moveToInner(Math.min(nextInner, maxIndex), true);
|
|
10085
10466
|
}
|
|
10086
10467
|
}, [canSlide, useLoop, innerIndex, slideBy, maxIndex, moveToInner]);
|
|
10087
|
-
const slidePrev =
|
|
10468
|
+
const slidePrev = import_react32.default.useCallback(() => {
|
|
10088
10469
|
if (!canSlide) return;
|
|
10089
10470
|
const prevInner = innerIndex - slideBy;
|
|
10090
10471
|
if (useLoop) {
|
|
@@ -10093,7 +10474,7 @@ var Swiper = (props) => {
|
|
|
10093
10474
|
moveToInner(Math.max(prevInner, 0), true);
|
|
10094
10475
|
}
|
|
10095
10476
|
}, [canSlide, useLoop, innerIndex, slideBy, moveToInner]);
|
|
10096
|
-
|
|
10477
|
+
import_react32.default.useEffect(() => {
|
|
10097
10478
|
if (indexProp === void 0) return;
|
|
10098
10479
|
const clamped = Math.max(0, Math.min(indexProp, maxIndex));
|
|
10099
10480
|
const target = useLoop ? cloneCount + clamped : clamped;
|
|
@@ -10101,12 +10482,12 @@ var Swiper = (props) => {
|
|
|
10101
10482
|
moveToInner(target, true);
|
|
10102
10483
|
}
|
|
10103
10484
|
}, [indexProp]);
|
|
10104
|
-
|
|
10485
|
+
import_react32.default.useImperativeHandle(swiperRef, () => ({
|
|
10105
10486
|
slidePrev,
|
|
10106
10487
|
slideNext,
|
|
10107
10488
|
slideTo
|
|
10108
10489
|
}));
|
|
10109
|
-
|
|
10490
|
+
import_react32.default.useEffect(() => {
|
|
10110
10491
|
if (!auto || !canSlide || paused) return;
|
|
10111
10492
|
autoplayTimerRef.current = setInterval(slideNext, autoplayDelay);
|
|
10112
10493
|
return () => {
|
|
@@ -10132,7 +10513,7 @@ var Swiper = (props) => {
|
|
|
10132
10513
|
resumeTimeoutRef.current = null;
|
|
10133
10514
|
}, pauseOnInteraction);
|
|
10134
10515
|
};
|
|
10135
|
-
|
|
10516
|
+
import_react32.default.useEffect(() => {
|
|
10136
10517
|
return () => {
|
|
10137
10518
|
if (resumeTimeoutRef.current) clearTimeout(resumeTimeoutRef.current);
|
|
10138
10519
|
};
|
|
@@ -10150,7 +10531,7 @@ var Swiper = (props) => {
|
|
|
10150
10531
|
startXRef.current = getClientX(e);
|
|
10151
10532
|
startTimeRef.current = Date.now();
|
|
10152
10533
|
};
|
|
10153
|
-
|
|
10534
|
+
import_react32.default.useEffect(() => {
|
|
10154
10535
|
if (!isDragging) return;
|
|
10155
10536
|
const handleMove = (e) => {
|
|
10156
10537
|
setDragOffset(getClientX(e) - startXRef.current);
|
|
@@ -10189,8 +10570,8 @@ var Swiper = (props) => {
|
|
|
10189
10570
|
}, [isDragging, dragOffset, innerIndex, useLoop, maxIndex, slideStep, moveToInner]);
|
|
10190
10571
|
const slideWidthPercent = 100 / viewItemCount;
|
|
10191
10572
|
const gapAdjust = spaceBetween * (viewItemCount - 1) / viewItemCount;
|
|
10192
|
-
const slideElements =
|
|
10193
|
-
() => extendedItems.map((item, idx) => /* @__PURE__ */ (0,
|
|
10573
|
+
const slideElements = import_react32.default.useMemo(
|
|
10574
|
+
() => extendedItems.map((item, idx) => /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(
|
|
10194
10575
|
"div",
|
|
10195
10576
|
{
|
|
10196
10577
|
className: "lib-xplat-swiper__slide",
|
|
@@ -10209,15 +10590,15 @@ var Swiper = (props) => {
|
|
|
10209
10590
|
Math.floor(realIndex / slideBy),
|
|
10210
10591
|
totalSteps - 1
|
|
10211
10592
|
);
|
|
10212
|
-
return /* @__PURE__ */ (0,
|
|
10213
|
-
/* @__PURE__ */ (0,
|
|
10593
|
+
return /* @__PURE__ */ (0, import_jsx_runtime342.jsxs)("div", { className: "lib-xplat-swiper", ref: containerRef, children: [
|
|
10594
|
+
/* @__PURE__ */ (0, import_jsx_runtime342.jsx)(
|
|
10214
10595
|
"div",
|
|
10215
10596
|
{
|
|
10216
10597
|
className: "lib-xplat-swiper__viewport",
|
|
10217
10598
|
onMouseDown: handleDragStart,
|
|
10218
10599
|
onTouchStart: handleDragStart,
|
|
10219
10600
|
onDragStart: (e) => e.preventDefault(),
|
|
10220
|
-
children: /* @__PURE__ */ (0,
|
|
10601
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(
|
|
10221
10602
|
"div",
|
|
10222
10603
|
{
|
|
10223
10604
|
className: clsx_default(
|
|
@@ -10235,7 +10616,7 @@ var Swiper = (props) => {
|
|
|
10235
10616
|
)
|
|
10236
10617
|
}
|
|
10237
10618
|
),
|
|
10238
|
-
showProgress && canSlide && /* @__PURE__ */ (0,
|
|
10619
|
+
showProgress && canSlide && /* @__PURE__ */ (0, import_jsx_runtime342.jsx)("div", { className: "lib-xplat-swiper__progress", children: /* @__PURE__ */ (0, import_jsx_runtime342.jsx)("div", { className: "lib-xplat-swiper__progress-track", children: /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(
|
|
10239
10620
|
"span",
|
|
10240
10621
|
{
|
|
10241
10622
|
className: "lib-xplat-swiper__progress-fill",
|
|
@@ -10245,7 +10626,7 @@ var Swiper = (props) => {
|
|
|
10245
10626
|
}
|
|
10246
10627
|
}
|
|
10247
10628
|
) }) }),
|
|
10248
|
-
canSlide && /* @__PURE__ */ (0,
|
|
10629
|
+
canSlide && /* @__PURE__ */ (0, import_jsx_runtime342.jsx)("div", { className: "lib-xplat-swiper__dots", children: Array.from({ length: totalSteps }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(
|
|
10249
10630
|
"button",
|
|
10250
10631
|
{
|
|
10251
10632
|
className: clsx_default(
|
|
@@ -10263,21 +10644,25 @@ Swiper.displayName = "Swiper";
|
|
|
10263
10644
|
var Swiper_default = Swiper;
|
|
10264
10645
|
|
|
10265
10646
|
// src/components/Switch/Switch.tsx
|
|
10266
|
-
var
|
|
10267
|
-
var
|
|
10647
|
+
var import_react33 = __toESM(require("react"), 1);
|
|
10648
|
+
var import_jsx_runtime343 = require("react/jsx-runtime");
|
|
10268
10649
|
var KNOB_TRANSITION_MS = 250;
|
|
10269
10650
|
var Switch = (props) => {
|
|
10270
10651
|
const {
|
|
10271
10652
|
value,
|
|
10272
10653
|
size = "md",
|
|
10273
|
-
type = "
|
|
10654
|
+
type = "primary",
|
|
10274
10655
|
disabled,
|
|
10275
10656
|
onChange,
|
|
10276
|
-
validations
|
|
10657
|
+
validations,
|
|
10658
|
+
label,
|
|
10659
|
+
required
|
|
10277
10660
|
} = props;
|
|
10278
|
-
const
|
|
10279
|
-
const
|
|
10280
|
-
|
|
10661
|
+
const fieldId = import_react33.default.useId();
|
|
10662
|
+
const statusType = normalizeStatus(type);
|
|
10663
|
+
const [isAnimating, setIsAnimating] = import_react33.default.useState(false);
|
|
10664
|
+
const timeoutRef = import_react33.default.useRef(null);
|
|
10665
|
+
import_react33.default.useEffect(() => {
|
|
10281
10666
|
return () => {
|
|
10282
10667
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
10283
10668
|
};
|
|
@@ -10292,13 +10677,14 @@ var Switch = (props) => {
|
|
|
10292
10677
|
timeoutRef.current = null;
|
|
10293
10678
|
}, KNOB_TRANSITION_MS);
|
|
10294
10679
|
};
|
|
10295
|
-
const control = /* @__PURE__ */ (0,
|
|
10680
|
+
const control = /* @__PURE__ */ (0, import_jsx_runtime343.jsx)(
|
|
10296
10681
|
"div",
|
|
10297
10682
|
{
|
|
10683
|
+
id: fieldId,
|
|
10298
10684
|
className: clsx_default(
|
|
10299
10685
|
"lib-xplat-switch",
|
|
10300
10686
|
size,
|
|
10301
|
-
|
|
10687
|
+
statusType,
|
|
10302
10688
|
value ? "checked" : void 0,
|
|
10303
10689
|
disabled && "disabled",
|
|
10304
10690
|
isAnimating && "animating"
|
|
@@ -10306,26 +10692,26 @@ var Switch = (props) => {
|
|
|
10306
10692
|
onClick: handleClick,
|
|
10307
10693
|
"aria-invalid": hasError(validations) || void 0,
|
|
10308
10694
|
"aria-disabled": disabled || isAnimating,
|
|
10309
|
-
children: /* @__PURE__ */ (0,
|
|
10695
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime343.jsx)("div", { className: clsx_default("knob", value ? "checked" : void 0) })
|
|
10310
10696
|
}
|
|
10311
10697
|
);
|
|
10312
|
-
return /* @__PURE__ */ (0,
|
|
10698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime343.jsx)(Field, { validations, label, required, htmlFor: fieldId, children: control });
|
|
10313
10699
|
};
|
|
10314
10700
|
Switch.displayName = "Switch";
|
|
10315
10701
|
var Switch_default = Switch;
|
|
10316
10702
|
|
|
10317
10703
|
// src/components/Table/TableContext.tsx
|
|
10318
|
-
var
|
|
10319
|
-
var TableContext =
|
|
10704
|
+
var import_react34 = __toESM(require("react"), 1);
|
|
10705
|
+
var TableContext = import_react34.default.createContext(null);
|
|
10320
10706
|
var useTableContext = () => {
|
|
10321
|
-
const ctx =
|
|
10707
|
+
const ctx = import_react34.default.useContext(TableContext);
|
|
10322
10708
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
10323
10709
|
return ctx;
|
|
10324
10710
|
};
|
|
10325
10711
|
var TableContext_default = TableContext;
|
|
10326
10712
|
|
|
10327
10713
|
// src/components/Table/Table.tsx
|
|
10328
|
-
var
|
|
10714
|
+
var import_jsx_runtime344 = require("react/jsx-runtime");
|
|
10329
10715
|
var Table = (props) => {
|
|
10330
10716
|
const {
|
|
10331
10717
|
children,
|
|
@@ -10335,7 +10721,7 @@ var Table = (props) => {
|
|
|
10335
10721
|
headerSticky = false,
|
|
10336
10722
|
stickyShadow = true
|
|
10337
10723
|
} = props;
|
|
10338
|
-
return /* @__PURE__ */ (0,
|
|
10724
|
+
return /* @__PURE__ */ (0, import_jsx_runtime344.jsx)("div", { className: `lib-xplat-table-wrapper ${size}`, children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
10339
10725
|
TableContext_default.Provider,
|
|
10340
10726
|
{
|
|
10341
10727
|
value: {
|
|
@@ -10344,7 +10730,7 @@ var Table = (props) => {
|
|
|
10344
10730
|
headerSticky,
|
|
10345
10731
|
stickyShadow
|
|
10346
10732
|
},
|
|
10347
|
-
children: /* @__PURE__ */ (0,
|
|
10733
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)("table", { className: "lib-xplat-table", children })
|
|
10348
10734
|
}
|
|
10349
10735
|
) });
|
|
10350
10736
|
};
|
|
@@ -10352,41 +10738,41 @@ Table.displayName = "Table";
|
|
|
10352
10738
|
var Table_default = Table;
|
|
10353
10739
|
|
|
10354
10740
|
// src/components/Table/TableBody.tsx
|
|
10355
|
-
var
|
|
10741
|
+
var import_jsx_runtime345 = require("react/jsx-runtime");
|
|
10356
10742
|
var TableBody = (props) => {
|
|
10357
10743
|
const { children } = props;
|
|
10358
|
-
return /* @__PURE__ */ (0,
|
|
10744
|
+
return /* @__PURE__ */ (0, import_jsx_runtime345.jsx)("tbody", { children });
|
|
10359
10745
|
};
|
|
10360
10746
|
TableBody.displayName = "TableBody";
|
|
10361
10747
|
var TableBody_default = TableBody;
|
|
10362
10748
|
|
|
10363
10749
|
// src/components/Table/TableCell.tsx
|
|
10364
|
-
var
|
|
10750
|
+
var import_react37 = __toESM(require("react"), 1);
|
|
10365
10751
|
|
|
10366
10752
|
// src/components/Table/TableHeadContext.tsx
|
|
10367
|
-
var
|
|
10368
|
-
var TableHeadContext =
|
|
10753
|
+
var import_react35 = __toESM(require("react"), 1);
|
|
10754
|
+
var TableHeadContext = import_react35.default.createContext(
|
|
10369
10755
|
null
|
|
10370
10756
|
);
|
|
10371
10757
|
var useTableHeadContext = () => {
|
|
10372
|
-
const ctx =
|
|
10758
|
+
const ctx = import_react35.default.useContext(TableHeadContext);
|
|
10373
10759
|
return ctx;
|
|
10374
10760
|
};
|
|
10375
10761
|
var TableHeadContext_default = TableHeadContext;
|
|
10376
10762
|
|
|
10377
10763
|
// src/components/Table/TableRowContext.tsx
|
|
10378
|
-
var
|
|
10379
|
-
var TableRowContext =
|
|
10764
|
+
var import_react36 = __toESM(require("react"), 1);
|
|
10765
|
+
var TableRowContext = import_react36.default.createContext(null);
|
|
10380
10766
|
var useTableRowContext = () => {
|
|
10381
|
-
const ctx =
|
|
10767
|
+
const ctx = import_react36.default.useContext(TableRowContext);
|
|
10382
10768
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
10383
10769
|
return ctx;
|
|
10384
10770
|
};
|
|
10385
10771
|
var TableRowContext_default = TableRowContext;
|
|
10386
10772
|
|
|
10387
10773
|
// src/components/Table/TableCell.tsx
|
|
10388
|
-
var
|
|
10389
|
-
var TableCell =
|
|
10774
|
+
var import_jsx_runtime346 = require("react/jsx-runtime");
|
|
10775
|
+
var TableCell = import_react37.default.memo((props) => {
|
|
10390
10776
|
const {
|
|
10391
10777
|
children,
|
|
10392
10778
|
align = "center",
|
|
@@ -10400,9 +10786,9 @@ var TableCell = import_react36.default.memo((props) => {
|
|
|
10400
10786
|
const { registerStickyCell, stickyCells } = useTableRowContext();
|
|
10401
10787
|
const { stickyShadow } = useTableContext();
|
|
10402
10788
|
const headContext = useTableHeadContext();
|
|
10403
|
-
const [left, setLeft] =
|
|
10404
|
-
const cellRef =
|
|
10405
|
-
const calculateLeft =
|
|
10789
|
+
const [left, setLeft] = import_react37.default.useState(0);
|
|
10790
|
+
const cellRef = import_react37.default.useRef(null);
|
|
10791
|
+
const calculateLeft = import_react37.default.useCallback(() => {
|
|
10406
10792
|
if (!cellRef.current) return 0;
|
|
10407
10793
|
let totalLeft = 0;
|
|
10408
10794
|
for (const ref of stickyCells) {
|
|
@@ -10411,7 +10797,7 @@ var TableCell = import_react36.default.memo((props) => {
|
|
|
10411
10797
|
}
|
|
10412
10798
|
return totalLeft;
|
|
10413
10799
|
}, [stickyCells]);
|
|
10414
|
-
|
|
10800
|
+
import_react37.default.useEffect(() => {
|
|
10415
10801
|
if (!isSticky || !cellRef.current) return;
|
|
10416
10802
|
registerStickyCell(cellRef);
|
|
10417
10803
|
setLeft(calculateLeft());
|
|
@@ -10430,7 +10816,7 @@ var TableCell = import_react36.default.memo((props) => {
|
|
|
10430
10816
|
const CellTag = isHeaderCell ? "th" : "td";
|
|
10431
10817
|
const isLastSticky = isSticky && stickyCells[stickyCells.length - 1] === cellRef;
|
|
10432
10818
|
const enableHover = headContext && headContext.cellHover;
|
|
10433
|
-
return /* @__PURE__ */ (0,
|
|
10819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime346.jsx)(
|
|
10434
10820
|
CellTag,
|
|
10435
10821
|
{
|
|
10436
10822
|
ref: cellRef,
|
|
@@ -10457,21 +10843,21 @@ TableCell.displayName = "TableCell";
|
|
|
10457
10843
|
var TableCell_default = TableCell;
|
|
10458
10844
|
|
|
10459
10845
|
// src/components/Table/TableHead.tsx
|
|
10460
|
-
var
|
|
10846
|
+
var import_jsx_runtime347 = require("react/jsx-runtime");
|
|
10461
10847
|
var TableHead = ({
|
|
10462
10848
|
children,
|
|
10463
10849
|
cellHover = false
|
|
10464
10850
|
}) => {
|
|
10465
10851
|
const { headerSticky } = useTableContext();
|
|
10466
|
-
return /* @__PURE__ */ (0,
|
|
10852
|
+
return /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(TableHeadContext_default.Provider, { value: { cellHover }, children: /* @__PURE__ */ (0, import_jsx_runtime347.jsx)("thead", { className: clsx_default(headerSticky ? "table-sticky" : null), children }) });
|
|
10467
10853
|
};
|
|
10468
10854
|
TableHead.displayName = "TableHead";
|
|
10469
10855
|
var TableHead_default = TableHead;
|
|
10470
10856
|
|
|
10471
10857
|
// src/components/Table/TableRow.tsx
|
|
10472
|
-
var
|
|
10473
|
-
var
|
|
10474
|
-
var TableRow =
|
|
10858
|
+
var import_react38 = __toESM(require("react"), 1);
|
|
10859
|
+
var import_jsx_runtime348 = require("react/jsx-runtime");
|
|
10860
|
+
var TableRow = import_react38.default.memo((props) => {
|
|
10475
10861
|
const {
|
|
10476
10862
|
children,
|
|
10477
10863
|
type = "secondary",
|
|
@@ -10480,14 +10866,14 @@ var TableRow = import_react37.default.memo((props) => {
|
|
|
10480
10866
|
onClick
|
|
10481
10867
|
} = props;
|
|
10482
10868
|
const { rowBorderUse } = useTableContext();
|
|
10483
|
-
const [stickyCells, setStickyCells] =
|
|
10869
|
+
const [stickyCells, setStickyCells] = import_react38.default.useState([]);
|
|
10484
10870
|
const registerStickyCell = (ref) => {
|
|
10485
10871
|
setStickyCells((prev) => {
|
|
10486
10872
|
if (prev.includes(ref)) return prev;
|
|
10487
10873
|
return [...prev, ref];
|
|
10488
10874
|
});
|
|
10489
10875
|
};
|
|
10490
|
-
return /* @__PURE__ */ (0,
|
|
10876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(TableRowContext_default.Provider, { value: { stickyCells, registerStickyCell }, children: /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(
|
|
10491
10877
|
"tr",
|
|
10492
10878
|
{
|
|
10493
10879
|
className: clsx_default(
|
|
@@ -10511,29 +10897,31 @@ TableRow.displayName = "TableRow";
|
|
|
10511
10897
|
var TableRow_default = TableRow;
|
|
10512
10898
|
|
|
10513
10899
|
// src/components/Tag/Tag.tsx
|
|
10514
|
-
var
|
|
10900
|
+
var import_jsx_runtime349 = require("react/jsx-runtime");
|
|
10515
10901
|
var Tag = (props) => {
|
|
10516
10902
|
const {
|
|
10517
10903
|
children,
|
|
10518
|
-
|
|
10904
|
+
variant,
|
|
10905
|
+
type,
|
|
10519
10906
|
onClose,
|
|
10520
10907
|
size = "md",
|
|
10521
10908
|
disabled = false,
|
|
10522
10909
|
colorIndex
|
|
10523
10910
|
} = props;
|
|
10524
|
-
|
|
10911
|
+
const shape = variant ?? type ?? "neutral";
|
|
10912
|
+
return /* @__PURE__ */ (0, import_jsx_runtime349.jsxs)(
|
|
10525
10913
|
"span",
|
|
10526
10914
|
{
|
|
10527
10915
|
className: clsx_default(
|
|
10528
10916
|
"lib-xplat-tag",
|
|
10529
|
-
|
|
10917
|
+
shape,
|
|
10530
10918
|
size,
|
|
10531
|
-
|
|
10919
|
+
shape === "categorical" && colorIndex !== void 0 && `cat-${colorIndex}`,
|
|
10532
10920
|
disabled && "disabled"
|
|
10533
10921
|
),
|
|
10534
10922
|
children: [
|
|
10535
|
-
/* @__PURE__ */ (0,
|
|
10536
|
-
onClose && /* @__PURE__ */ (0,
|
|
10923
|
+
/* @__PURE__ */ (0, import_jsx_runtime349.jsx)("span", { className: "tag-label", children }),
|
|
10924
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime349.jsx)("button", { className: "tag-close", onClick: onClose, "aria-label": "\uC0AD\uC81C", disabled, children: /* @__PURE__ */ (0, import_jsx_runtime349.jsx)(XIcon_default, {}) })
|
|
10537
10925
|
]
|
|
10538
10926
|
}
|
|
10539
10927
|
);
|
|
@@ -10542,24 +10930,29 @@ Tag.displayName = "Tag";
|
|
|
10542
10930
|
var Tag_default = Tag;
|
|
10543
10931
|
|
|
10544
10932
|
// src/components/TextArea/TextArea.tsx
|
|
10545
|
-
var
|
|
10546
|
-
var
|
|
10547
|
-
var TextArea =
|
|
10933
|
+
var import_react39 = __toESM(require("react"), 1);
|
|
10934
|
+
var import_jsx_runtime350 = require("react/jsx-runtime");
|
|
10935
|
+
var TextArea = import_react39.default.forwardRef(
|
|
10548
10936
|
(props, ref) => {
|
|
10549
10937
|
const {
|
|
10550
10938
|
className,
|
|
10551
10939
|
size = "md",
|
|
10552
10940
|
validations,
|
|
10941
|
+
label,
|
|
10942
|
+
required,
|
|
10553
10943
|
resize = "vertical",
|
|
10554
10944
|
rows = 3,
|
|
10555
10945
|
disabled,
|
|
10556
10946
|
...textareaProps
|
|
10557
10947
|
} = props;
|
|
10558
|
-
const
|
|
10948
|
+
const autoId = import_react39.default.useId();
|
|
10949
|
+
const fieldId = props.id ?? autoId;
|
|
10950
|
+
const control = /* @__PURE__ */ (0, import_jsx_runtime350.jsx)("div", { className: clsx_default("lib-xplat-textarea-wrap", className), children: /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
|
|
10559
10951
|
"textarea",
|
|
10560
10952
|
{
|
|
10561
10953
|
...textareaProps,
|
|
10562
10954
|
ref,
|
|
10955
|
+
id: fieldId,
|
|
10563
10956
|
rows,
|
|
10564
10957
|
disabled,
|
|
10565
10958
|
"aria-invalid": hasError(validations) || void 0,
|
|
@@ -10567,32 +10960,166 @@ var TextArea = import_react38.default.forwardRef(
|
|
|
10567
10960
|
style: { resize }
|
|
10568
10961
|
}
|
|
10569
10962
|
) });
|
|
10570
|
-
return /* @__PURE__ */ (0,
|
|
10963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(Field, { validations, label, required, htmlFor: fieldId, children: control });
|
|
10571
10964
|
}
|
|
10572
10965
|
);
|
|
10573
10966
|
TextArea.displayName = "TextArea";
|
|
10574
10967
|
var TextArea_default = TextArea;
|
|
10575
10968
|
|
|
10969
|
+
// src/components/TimePicker/TimePicker.tsx
|
|
10970
|
+
var import_react40 = __toESM(require("react"), 1);
|
|
10971
|
+
var import_jsx_runtime351 = require("react/jsx-runtime");
|
|
10972
|
+
var ANIMATION_DURATION_MS4 = 200;
|
|
10973
|
+
var toMinutes = (hhmm) => {
|
|
10974
|
+
if (!hhmm) return null;
|
|
10975
|
+
const m = /^(\d{1,2}):(\d{2})$/.exec(hhmm.trim());
|
|
10976
|
+
if (!m) return null;
|
|
10977
|
+
const h = Number(m[1]);
|
|
10978
|
+
const min = Number(m[2]);
|
|
10979
|
+
if (h > 23 || min > 59) return null;
|
|
10980
|
+
return h * 60 + min;
|
|
10981
|
+
};
|
|
10982
|
+
var toHHmm = (minutes) => `${String(Math.floor(minutes / 60)).padStart(2, "0")}:${String(minutes % 60).padStart(2, "0")}`;
|
|
10983
|
+
var display = (hhmm, use12Hours) => {
|
|
10984
|
+
if (!use12Hours) return hhmm;
|
|
10985
|
+
const total = toMinutes(hhmm);
|
|
10986
|
+
if (total === null) return hhmm;
|
|
10987
|
+
const h24 = Math.floor(total / 60);
|
|
10988
|
+
const mm = String(total % 60).padStart(2, "0");
|
|
10989
|
+
const period = h24 < 12 ? "\uC624\uC804" : "\uC624\uD6C4";
|
|
10990
|
+
const h12 = h24 % 12 === 0 ? 12 : h24 % 12;
|
|
10991
|
+
return `${period} ${h12}:${mm}`;
|
|
10992
|
+
};
|
|
10993
|
+
var TimePicker = (props) => {
|
|
10994
|
+
const {
|
|
10995
|
+
value,
|
|
10996
|
+
onChange,
|
|
10997
|
+
step = 30,
|
|
10998
|
+
min,
|
|
10999
|
+
max,
|
|
11000
|
+
use12Hours = false,
|
|
11001
|
+
placeholder = "\uC2DC\uAC01 \uC120\uD0DD",
|
|
11002
|
+
disabled = false,
|
|
11003
|
+
size = "md",
|
|
11004
|
+
label,
|
|
11005
|
+
required,
|
|
11006
|
+
validations
|
|
11007
|
+
} = props;
|
|
11008
|
+
const fieldId = import_react40.default.useId();
|
|
11009
|
+
const triggerRef = import_react40.default.useRef(null);
|
|
11010
|
+
const contentRef = import_react40.default.useRef(null);
|
|
11011
|
+
const [isOpen, setOpen] = import_react40.default.useState(false);
|
|
11012
|
+
const [mounted, setMounted] = import_react40.default.useState(false);
|
|
11013
|
+
const [visible, setVisible] = import_react40.default.useState(false);
|
|
11014
|
+
const options = import_react40.default.useMemo(() => {
|
|
11015
|
+
const safeStep = step > 0 && step <= 720 ? step : 30;
|
|
11016
|
+
const lo = toMinutes(min) ?? 0;
|
|
11017
|
+
const hi = toMinutes(max) ?? 24 * 60 - 1;
|
|
11018
|
+
const out = [];
|
|
11019
|
+
for (let t = lo; t <= hi; t += safeStep) out.push(toHHmm(t));
|
|
11020
|
+
return out;
|
|
11021
|
+
}, [step, min, max]);
|
|
11022
|
+
const close = import_react40.default.useCallback(() => setOpen(false), []);
|
|
11023
|
+
useClickOutside_default([triggerRef, contentRef], close, isOpen);
|
|
11024
|
+
useEscapeKey(isOpen, () => {
|
|
11025
|
+
close();
|
|
11026
|
+
triggerRef.current?.focus({ preventScroll: true });
|
|
11027
|
+
});
|
|
11028
|
+
const position = useAutoPosition_default(triggerRef, contentRef, mounted);
|
|
11029
|
+
import_react40.default.useEffect(() => {
|
|
11030
|
+
if (disabled && isOpen) setOpen(false);
|
|
11031
|
+
}, [disabled, isOpen]);
|
|
11032
|
+
import_react40.default.useEffect(() => {
|
|
11033
|
+
if (isOpen) {
|
|
11034
|
+
setMounted(true);
|
|
11035
|
+
const t2 = setTimeout(() => setVisible(true), 1);
|
|
11036
|
+
return () => clearTimeout(t2);
|
|
11037
|
+
}
|
|
11038
|
+
setVisible(false);
|
|
11039
|
+
const t = setTimeout(() => setMounted(false), ANIMATION_DURATION_MS4);
|
|
11040
|
+
return () => clearTimeout(t);
|
|
11041
|
+
}, [isOpen]);
|
|
11042
|
+
const pick = (hhmm) => {
|
|
11043
|
+
onChange?.(hhmm);
|
|
11044
|
+
close();
|
|
11045
|
+
triggerRef.current?.focus({ preventScroll: true });
|
|
11046
|
+
};
|
|
11047
|
+
const control = /* @__PURE__ */ (0, import_jsx_runtime351.jsxs)("div", { className: clsx_default("lib-xplat-time-picker", size, disabled && "disabled"), children: [
|
|
11048
|
+
/* @__PURE__ */ (0, import_jsx_runtime351.jsx)(
|
|
11049
|
+
"div",
|
|
11050
|
+
{
|
|
11051
|
+
id: fieldId,
|
|
11052
|
+
ref: triggerRef,
|
|
11053
|
+
className: clsx_default("time-picker-trigger", hasError(validations) && "error"),
|
|
11054
|
+
role: "combobox",
|
|
11055
|
+
"aria-expanded": isOpen,
|
|
11056
|
+
"aria-haspopup": "listbox",
|
|
11057
|
+
"aria-invalid": hasError(validations) || void 0,
|
|
11058
|
+
tabIndex: disabled ? void 0 : 0,
|
|
11059
|
+
onClick: () => !disabled && setOpen((p) => !p),
|
|
11060
|
+
onKeyDown: (e) => {
|
|
11061
|
+
if (disabled) return;
|
|
11062
|
+
if (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") {
|
|
11063
|
+
e.preventDefault();
|
|
11064
|
+
setOpen(true);
|
|
11065
|
+
}
|
|
11066
|
+
},
|
|
11067
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime351.jsx)("span", { className: clsx_default("time-picker-value", !value && "placeholder"), children: value ? display(value, use12Hours) : placeholder })
|
|
11068
|
+
}
|
|
11069
|
+
),
|
|
11070
|
+
mounted && /* @__PURE__ */ (0, import_jsx_runtime351.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime351.jsx)(
|
|
11071
|
+
"div",
|
|
11072
|
+
{
|
|
11073
|
+
ref: contentRef,
|
|
11074
|
+
className: clsx_default("lib-xplat-time-picker-content", size, visible ? "enter" : "exit"),
|
|
11075
|
+
style: { ...position.position, width: triggerRef.current?.offsetWidth },
|
|
11076
|
+
role: "listbox",
|
|
11077
|
+
children: options.map((t) => /* @__PURE__ */ (0, import_jsx_runtime351.jsx)(
|
|
11078
|
+
"div",
|
|
11079
|
+
{
|
|
11080
|
+
className: clsx_default("time-picker-item", t === value && "is-selected"),
|
|
11081
|
+
role: "option",
|
|
11082
|
+
"aria-selected": t === value,
|
|
11083
|
+
tabIndex: 0,
|
|
11084
|
+
onClick: () => pick(t),
|
|
11085
|
+
onKeyDown: (e) => {
|
|
11086
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
11087
|
+
e.preventDefault();
|
|
11088
|
+
pick(t);
|
|
11089
|
+
}
|
|
11090
|
+
},
|
|
11091
|
+
children: display(t, use12Hours)
|
|
11092
|
+
},
|
|
11093
|
+
t
|
|
11094
|
+
))
|
|
11095
|
+
}
|
|
11096
|
+
) })
|
|
11097
|
+
] });
|
|
11098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime351.jsx)(Field, { validations, label, required, htmlFor: fieldId, children: control });
|
|
11099
|
+
};
|
|
11100
|
+
TimePicker.displayName = "TimePicker";
|
|
11101
|
+
var TimePicker_default = TimePicker;
|
|
11102
|
+
|
|
10576
11103
|
// src/components/Toast/Toast.tsx
|
|
10577
|
-
var
|
|
11104
|
+
var import_react41 = __toESM(require("react"), 1);
|
|
10578
11105
|
var import_react_dom4 = require("react-dom");
|
|
10579
|
-
var
|
|
10580
|
-
var ToastContext =
|
|
11106
|
+
var import_jsx_runtime352 = require("react/jsx-runtime");
|
|
11107
|
+
var ToastContext = import_react41.default.createContext(null);
|
|
10581
11108
|
var useToast = () => {
|
|
10582
|
-
const ctx =
|
|
11109
|
+
const ctx = import_react41.default.useContext(ToastContext);
|
|
10583
11110
|
if (!ctx) throw new Error("useToast must be used within ToastProvider");
|
|
10584
11111
|
return ctx;
|
|
10585
11112
|
};
|
|
10586
11113
|
var EXIT_DURATION = 300;
|
|
10587
11114
|
var ToastItemComponent = ({ item, isExiting, onClose }) => {
|
|
10588
|
-
const ref =
|
|
10589
|
-
const [height, setHeight] =
|
|
10590
|
-
|
|
11115
|
+
const ref = import_react41.default.useRef(null);
|
|
11116
|
+
const [height, setHeight] = import_react41.default.useState(void 0);
|
|
11117
|
+
import_react41.default.useEffect(() => {
|
|
10591
11118
|
if (ref.current && !isExiting) {
|
|
10592
11119
|
setHeight(ref.current.offsetHeight);
|
|
10593
11120
|
}
|
|
10594
11121
|
}, [isExiting]);
|
|
10595
|
-
return /* @__PURE__ */ (0,
|
|
11122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime352.jsx)(
|
|
10596
11123
|
"div",
|
|
10597
11124
|
{
|
|
10598
11125
|
className: clsx_default("lib-xplat-toast-wrapper", { exit: isExiting }),
|
|
@@ -10600,15 +11127,15 @@ var ToastItemComponent = ({ item, isExiting, onClose }) => {
|
|
|
10600
11127
|
maxHeight: isExiting ? 0 : height ?? "none",
|
|
10601
11128
|
marginBottom: isExiting ? 0 : void 0
|
|
10602
11129
|
},
|
|
10603
|
-
children: /* @__PURE__ */ (0,
|
|
11130
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime352.jsxs)(
|
|
10604
11131
|
"div",
|
|
10605
11132
|
{
|
|
10606
11133
|
ref,
|
|
10607
11134
|
className: clsx_default("lib-xplat-toast", item.type, { exit: isExiting }),
|
|
10608
11135
|
role: "alert",
|
|
10609
11136
|
children: [
|
|
10610
|
-
/* @__PURE__ */ (0,
|
|
10611
|
-
/* @__PURE__ */ (0,
|
|
11137
|
+
/* @__PURE__ */ (0, import_jsx_runtime352.jsx)("span", { className: "message", children: item.message }),
|
|
11138
|
+
/* @__PURE__ */ (0, import_jsx_runtime352.jsx)("button", { className: "close-btn", onClick: onClose, "aria-label": "\uB2EB\uAE30", children: "\xD7" })
|
|
10612
11139
|
]
|
|
10613
11140
|
}
|
|
10614
11141
|
)
|
|
@@ -10619,13 +11146,13 @@ var ToastProvider = ({
|
|
|
10619
11146
|
children,
|
|
10620
11147
|
position = "top-right"
|
|
10621
11148
|
}) => {
|
|
10622
|
-
const [toasts, setToasts] =
|
|
10623
|
-
const [removing, setRemoving] =
|
|
10624
|
-
const [mounted, setMounted] =
|
|
10625
|
-
|
|
11149
|
+
const [toasts, setToasts] = import_react41.default.useState([]);
|
|
11150
|
+
const [removing, setRemoving] = import_react41.default.useState(/* @__PURE__ */ new Set());
|
|
11151
|
+
const [mounted, setMounted] = import_react41.default.useState(false);
|
|
11152
|
+
import_react41.default.useEffect(() => {
|
|
10626
11153
|
setMounted(true);
|
|
10627
11154
|
}, []);
|
|
10628
|
-
const remove =
|
|
11155
|
+
const remove = import_react41.default.useCallback((id) => {
|
|
10629
11156
|
setRemoving((prev) => new Set(prev).add(id));
|
|
10630
11157
|
setTimeout(() => {
|
|
10631
11158
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
@@ -10636,7 +11163,7 @@ var ToastProvider = ({
|
|
|
10636
11163
|
});
|
|
10637
11164
|
}, EXIT_DURATION);
|
|
10638
11165
|
}, []);
|
|
10639
|
-
const toast =
|
|
11166
|
+
const toast = import_react41.default.useCallback(
|
|
10640
11167
|
(type, message, duration = 3e3) => {
|
|
10641
11168
|
const id = `${Date.now()}-${Math.random()}`;
|
|
10642
11169
|
setToasts((prev) => [...prev, { id, type, message }]);
|
|
@@ -10646,10 +11173,10 @@ var ToastProvider = ({
|
|
|
10646
11173
|
},
|
|
10647
11174
|
[remove]
|
|
10648
11175
|
);
|
|
10649
|
-
return /* @__PURE__ */ (0,
|
|
11176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime352.jsxs)(ToastContext.Provider, { value: { toast }, children: [
|
|
10650
11177
|
children,
|
|
10651
11178
|
mounted && (0, import_react_dom4.createPortal)(
|
|
10652
|
-
/* @__PURE__ */ (0,
|
|
11179
|
+
/* @__PURE__ */ (0, import_jsx_runtime352.jsx)("div", { className: clsx_default("lib-xplat-toast-container", position), children: toasts.map((t) => /* @__PURE__ */ (0, import_jsx_runtime352.jsx)(
|
|
10653
11180
|
ToastItemComponent,
|
|
10654
11181
|
{
|
|
10655
11182
|
item: t,
|
|
@@ -10665,8 +11192,8 @@ var ToastProvider = ({
|
|
|
10665
11192
|
ToastProvider.displayName = "ToastProvider";
|
|
10666
11193
|
|
|
10667
11194
|
// src/components/Tooltip/Tooltip.tsx
|
|
10668
|
-
var
|
|
10669
|
-
var
|
|
11195
|
+
var import_react42 = __toESM(require("react"), 1);
|
|
11196
|
+
var import_jsx_runtime353 = require("react/jsx-runtime");
|
|
10670
11197
|
var OFFSET = 12;
|
|
10671
11198
|
var GAP = 8;
|
|
10672
11199
|
var SHOW_DELAY = 300;
|
|
@@ -10675,18 +11202,20 @@ var Tooltip = (props) => {
|
|
|
10675
11202
|
children,
|
|
10676
11203
|
title,
|
|
10677
11204
|
description,
|
|
10678
|
-
|
|
11205
|
+
variant,
|
|
11206
|
+
type,
|
|
10679
11207
|
follow = false,
|
|
10680
11208
|
disabled = false
|
|
10681
11209
|
} = props;
|
|
10682
|
-
const
|
|
10683
|
-
const
|
|
10684
|
-
const
|
|
10685
|
-
const [
|
|
10686
|
-
const
|
|
10687
|
-
const
|
|
10688
|
-
const
|
|
10689
|
-
const
|
|
11210
|
+
const shape = variant ?? type ?? "dark";
|
|
11211
|
+
const triggerRef = import_react42.default.useRef(null);
|
|
11212
|
+
const tooltipRef = import_react42.default.useRef(null);
|
|
11213
|
+
const [visible, setVisible] = import_react42.default.useState(false);
|
|
11214
|
+
const [pos, setPos] = import_react42.default.useState({ left: 0, top: 0 });
|
|
11215
|
+
const delayTimer = import_react42.default.useRef(0);
|
|
11216
|
+
const rafRef = import_react42.default.useRef(0);
|
|
11217
|
+
const cursor = import_react42.default.useRef(null);
|
|
11218
|
+
const clamp = import_react42.default.useCallback((left, top, w, h) => {
|
|
10690
11219
|
const vw = window.innerWidth;
|
|
10691
11220
|
const vh = window.innerHeight;
|
|
10692
11221
|
return {
|
|
@@ -10694,7 +11223,7 @@ var Tooltip = (props) => {
|
|
|
10694
11223
|
top: Math.min(Math.max(GAP, top), Math.max(GAP, vh - h - GAP))
|
|
10695
11224
|
};
|
|
10696
11225
|
}, []);
|
|
10697
|
-
const placeAtCursor =
|
|
11226
|
+
const placeAtCursor = import_react42.default.useCallback((x, y) => {
|
|
10698
11227
|
const el = tooltipRef.current;
|
|
10699
11228
|
if (!el) return;
|
|
10700
11229
|
const w = el.offsetWidth;
|
|
@@ -10705,7 +11234,7 @@ var Tooltip = (props) => {
|
|
|
10705
11234
|
if (top < GAP) top = y + OFFSET;
|
|
10706
11235
|
setPos(clamp(left, top, w, h));
|
|
10707
11236
|
}, [clamp]);
|
|
10708
|
-
const placeAtTrigger =
|
|
11237
|
+
const placeAtTrigger = import_react42.default.useCallback(() => {
|
|
10709
11238
|
const el = tooltipRef.current;
|
|
10710
11239
|
const trigger = triggerRef.current;
|
|
10711
11240
|
if (!el || !trigger) return;
|
|
@@ -10717,19 +11246,19 @@ var Tooltip = (props) => {
|
|
|
10717
11246
|
const left = rect.left + rect.width / 2 - w / 2;
|
|
10718
11247
|
setPos(clamp(left, top, w, h));
|
|
10719
11248
|
}, [clamp]);
|
|
10720
|
-
const reposition =
|
|
11249
|
+
const reposition = import_react42.default.useCallback(() => {
|
|
10721
11250
|
if (follow && cursor.current) {
|
|
10722
11251
|
placeAtCursor(cursor.current.x, cursor.current.y);
|
|
10723
11252
|
} else {
|
|
10724
11253
|
placeAtTrigger();
|
|
10725
11254
|
}
|
|
10726
11255
|
}, [follow, placeAtCursor, placeAtTrigger]);
|
|
10727
|
-
const handleMouseEnter =
|
|
11256
|
+
const handleMouseEnter = import_react42.default.useCallback((e) => {
|
|
10728
11257
|
if (disabled) return;
|
|
10729
11258
|
cursor.current = { x: e.clientX, y: e.clientY };
|
|
10730
11259
|
delayTimer.current = window.setTimeout(() => setVisible(true), SHOW_DELAY);
|
|
10731
11260
|
}, [disabled]);
|
|
10732
|
-
const handleMouseMove =
|
|
11261
|
+
const handleMouseMove = import_react42.default.useCallback((e) => {
|
|
10733
11262
|
cursor.current = { x: e.clientX, y: e.clientY };
|
|
10734
11263
|
if (!visible || !follow) return;
|
|
10735
11264
|
cancelAnimationFrame(rafRef.current);
|
|
@@ -10737,25 +11266,25 @@ var Tooltip = (props) => {
|
|
|
10737
11266
|
if (cursor.current) placeAtCursor(cursor.current.x, cursor.current.y);
|
|
10738
11267
|
});
|
|
10739
11268
|
}, [visible, follow, placeAtCursor]);
|
|
10740
|
-
const close =
|
|
11269
|
+
const close = import_react42.default.useCallback(() => {
|
|
10741
11270
|
window.clearTimeout(delayTimer.current);
|
|
10742
11271
|
cancelAnimationFrame(rafRef.current);
|
|
10743
11272
|
setVisible(false);
|
|
10744
11273
|
}, []);
|
|
10745
|
-
const handleMouseLeave =
|
|
11274
|
+
const handleMouseLeave = import_react42.default.useCallback(() => {
|
|
10746
11275
|
cursor.current = null;
|
|
10747
11276
|
close();
|
|
10748
11277
|
}, [close]);
|
|
10749
|
-
const handleFocus =
|
|
11278
|
+
const handleFocus = import_react42.default.useCallback(() => {
|
|
10750
11279
|
if (disabled) return;
|
|
10751
11280
|
cursor.current = null;
|
|
10752
11281
|
setVisible(true);
|
|
10753
11282
|
}, [disabled]);
|
|
10754
|
-
|
|
11283
|
+
import_react42.default.useLayoutEffect(() => {
|
|
10755
11284
|
if (!visible) return;
|
|
10756
11285
|
reposition();
|
|
10757
11286
|
}, [visible, reposition]);
|
|
10758
|
-
|
|
11287
|
+
import_react42.default.useEffect(() => {
|
|
10759
11288
|
if (!visible || follow) return;
|
|
10760
11289
|
const onChange = () => placeAtTrigger();
|
|
10761
11290
|
window.addEventListener("scroll", onChange, true);
|
|
@@ -10765,12 +11294,12 @@ var Tooltip = (props) => {
|
|
|
10765
11294
|
window.removeEventListener("resize", onChange);
|
|
10766
11295
|
};
|
|
10767
11296
|
}, [visible, follow, placeAtTrigger]);
|
|
10768
|
-
|
|
11297
|
+
import_react42.default.useEffect(() => () => {
|
|
10769
11298
|
window.clearTimeout(delayTimer.current);
|
|
10770
11299
|
cancelAnimationFrame(rafRef.current);
|
|
10771
11300
|
}, []);
|
|
10772
|
-
if (!title && !description) return /* @__PURE__ */ (0,
|
|
10773
|
-
return /* @__PURE__ */ (0,
|
|
11301
|
+
if (!title && !description) return /* @__PURE__ */ (0, import_jsx_runtime353.jsx)(import_jsx_runtime353.Fragment, { children });
|
|
11302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime353.jsxs)(
|
|
10774
11303
|
"div",
|
|
10775
11304
|
{
|
|
10776
11305
|
ref: triggerRef,
|
|
@@ -10783,16 +11312,16 @@ var Tooltip = (props) => {
|
|
|
10783
11312
|
onBlur: close,
|
|
10784
11313
|
children: [
|
|
10785
11314
|
children,
|
|
10786
|
-
visible && /* @__PURE__ */ (0,
|
|
11315
|
+
visible && /* @__PURE__ */ (0, import_jsx_runtime353.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime353.jsxs)(
|
|
10787
11316
|
"div",
|
|
10788
11317
|
{
|
|
10789
11318
|
ref: tooltipRef,
|
|
10790
11319
|
role: "tooltip",
|
|
10791
|
-
className: clsx_default("lib-xplat-tooltip",
|
|
11320
|
+
className: clsx_default("lib-xplat-tooltip", shape),
|
|
10792
11321
|
style: { position: "fixed", left: pos.left, top: pos.top },
|
|
10793
11322
|
children: [
|
|
10794
|
-
title && /* @__PURE__ */ (0,
|
|
10795
|
-
description && /* @__PURE__ */ (0,
|
|
11323
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime353.jsx)("div", { className: "tooltip-title", children: title }),
|
|
11324
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime353.jsx)("div", { className: "tooltip-desc", children: description })
|
|
10796
11325
|
]
|
|
10797
11326
|
}
|
|
10798
11327
|
) })
|
|
@@ -10804,11 +11333,11 @@ Tooltip.displayName = "Tooltip";
|
|
|
10804
11333
|
var Tooltip_default = Tooltip;
|
|
10805
11334
|
|
|
10806
11335
|
// src/components/Video/Video.tsx
|
|
10807
|
-
var
|
|
10808
|
-
var
|
|
10809
|
-
var PipIcon = () => /* @__PURE__ */ (0,
|
|
10810
|
-
/* @__PURE__ */ (0,
|
|
10811
|
-
/* @__PURE__ */ (0,
|
|
11336
|
+
var import_react43 = __toESM(require("react"), 1);
|
|
11337
|
+
var import_jsx_runtime354 = require("react/jsx-runtime");
|
|
11338
|
+
var PipIcon = () => /* @__PURE__ */ (0, import_jsx_runtime354.jsxs)("svg", { viewBox: "0 0 24 24", width: "1em", height: "1em", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
11339
|
+
/* @__PURE__ */ (0, import_jsx_runtime354.jsx)("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
|
|
11340
|
+
/* @__PURE__ */ (0, import_jsx_runtime354.jsx)("rect", { x: "12", y: "11", width: "7", height: "6", rx: "1", fill: "currentColor" })
|
|
10812
11341
|
] });
|
|
10813
11342
|
var formatTime = (sec) => {
|
|
10814
11343
|
if (!Number.isFinite(sec) || sec < 0) return "0:00";
|
|
@@ -10816,7 +11345,7 @@ var formatTime = (sec) => {
|
|
|
10816
11345
|
const s = Math.floor(sec % 60);
|
|
10817
11346
|
return `${m}:${s.toString().padStart(2, "0")}`;
|
|
10818
11347
|
};
|
|
10819
|
-
var Video =
|
|
11348
|
+
var Video = import_react43.default.forwardRef((props, ref) => {
|
|
10820
11349
|
const {
|
|
10821
11350
|
src,
|
|
10822
11351
|
poster,
|
|
@@ -10840,21 +11369,21 @@ var Video = import_react41.default.forwardRef((props, ref) => {
|
|
|
10840
11369
|
children,
|
|
10841
11370
|
...rest
|
|
10842
11371
|
} = props;
|
|
10843
|
-
const containerRef =
|
|
10844
|
-
const videoRef =
|
|
10845
|
-
const [isPlaying, setIsPlaying] =
|
|
10846
|
-
const [isLoaded, setIsLoaded] =
|
|
10847
|
-
const [currentTime, setCurrentTime] =
|
|
10848
|
-
const [duration, setDuration] =
|
|
10849
|
-
const [buffered, setBuffered] =
|
|
10850
|
-
const [volume, setVolume] =
|
|
10851
|
-
const [isMuted, setIsMuted] =
|
|
10852
|
-
const [isFullscreen, setIsFullscreen] =
|
|
10853
|
-
const [playbackRate, setPlaybackRate] =
|
|
10854
|
-
const [rateMenuOpen, setRateMenuOpen] =
|
|
10855
|
-
const [captionsOn, setCaptionsOn] =
|
|
10856
|
-
const [isPip, setIsPip] =
|
|
10857
|
-
const setRefs =
|
|
11372
|
+
const containerRef = import_react43.default.useRef(null);
|
|
11373
|
+
const videoRef = import_react43.default.useRef(null);
|
|
11374
|
+
const [isPlaying, setIsPlaying] = import_react43.default.useState(Boolean(autoPlay));
|
|
11375
|
+
const [isLoaded, setIsLoaded] = import_react43.default.useState(false);
|
|
11376
|
+
const [currentTime, setCurrentTime] = import_react43.default.useState(0);
|
|
11377
|
+
const [duration, setDuration] = import_react43.default.useState(0);
|
|
11378
|
+
const [buffered, setBuffered] = import_react43.default.useState(0);
|
|
11379
|
+
const [volume, setVolume] = import_react43.default.useState(1);
|
|
11380
|
+
const [isMuted, setIsMuted] = import_react43.default.useState(Boolean(muted));
|
|
11381
|
+
const [isFullscreen, setIsFullscreen] = import_react43.default.useState(false);
|
|
11382
|
+
const [playbackRate, setPlaybackRate] = import_react43.default.useState(1);
|
|
11383
|
+
const [rateMenuOpen, setRateMenuOpen] = import_react43.default.useState(false);
|
|
11384
|
+
const [captionsOn, setCaptionsOn] = import_react43.default.useState(false);
|
|
11385
|
+
const [isPip, setIsPip] = import_react43.default.useState(false);
|
|
11386
|
+
const setRefs = import_react43.default.useCallback(
|
|
10858
11387
|
(el) => {
|
|
10859
11388
|
videoRef.current = el;
|
|
10860
11389
|
if (typeof ref === "function") ref(el);
|
|
@@ -10862,14 +11391,14 @@ var Video = import_react41.default.forwardRef((props, ref) => {
|
|
|
10862
11391
|
},
|
|
10863
11392
|
[ref]
|
|
10864
11393
|
);
|
|
10865
|
-
|
|
11394
|
+
import_react43.default.useEffect(() => {
|
|
10866
11395
|
const onFsChange = () => {
|
|
10867
11396
|
setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
10868
11397
|
};
|
|
10869
11398
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
10870
11399
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
10871
11400
|
}, []);
|
|
10872
|
-
|
|
11401
|
+
import_react43.default.useEffect(() => {
|
|
10873
11402
|
const v = videoRef.current;
|
|
10874
11403
|
if (!v) return;
|
|
10875
11404
|
const onEnter = () => setIsPip(true);
|
|
@@ -10983,13 +11512,13 @@ var Video = import_react41.default.forwardRef((props, ref) => {
|
|
|
10983
11512
|
const volumePct = (isMuted ? 0 : volume) * 100;
|
|
10984
11513
|
const VolumeGlyph = isMuted || volume === 0 ? VolumeXIcon_default : volume < 0.5 ? VolumeIcon_default : Volume2Icon_default;
|
|
10985
11514
|
const pipSupported = typeof document !== "undefined" && "pictureInPictureEnabled" in document && document.pictureInPictureEnabled;
|
|
10986
|
-
return /* @__PURE__ */ (0,
|
|
11515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime354.jsxs)(
|
|
10987
11516
|
"div",
|
|
10988
11517
|
{
|
|
10989
11518
|
ref: containerRef,
|
|
10990
11519
|
className: clsx_default("lib-xplat-video", showControls && "has-controls"),
|
|
10991
11520
|
children: [
|
|
10992
|
-
/* @__PURE__ */ (0,
|
|
11521
|
+
/* @__PURE__ */ (0, import_jsx_runtime354.jsx)(
|
|
10993
11522
|
"video",
|
|
10994
11523
|
{
|
|
10995
11524
|
ref: setRefs,
|
|
@@ -11010,7 +11539,7 @@ var Video = import_react41.default.forwardRef((props, ref) => {
|
|
|
11010
11539
|
children
|
|
11011
11540
|
}
|
|
11012
11541
|
),
|
|
11013
|
-
showCenterPlay && /* @__PURE__ */ (0,
|
|
11542
|
+
showCenterPlay && /* @__PURE__ */ (0, import_jsx_runtime354.jsx)(
|
|
11014
11543
|
"button",
|
|
11015
11544
|
{
|
|
11016
11545
|
type: "button",
|
|
@@ -11022,11 +11551,11 @@ var Video = import_react41.default.forwardRef((props, ref) => {
|
|
|
11022
11551
|
onClick: togglePlay,
|
|
11023
11552
|
"aria-label": isPlaying ? "\uC77C\uC2DC\uC815\uC9C0" : "\uC7AC\uC0DD",
|
|
11024
11553
|
tabIndex: -1,
|
|
11025
|
-
children: /* @__PURE__ */ (0,
|
|
11554
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime354.jsx)("span", { className: "center-play-icon", children: /* @__PURE__ */ (0, import_jsx_runtime354.jsx)(PlayCircleIcon_default, {}) })
|
|
11026
11555
|
}
|
|
11027
11556
|
),
|
|
11028
|
-
showControls && /* @__PURE__ */ (0,
|
|
11029
|
-
/* @__PURE__ */ (0,
|
|
11557
|
+
showControls && /* @__PURE__ */ (0, import_jsx_runtime354.jsxs)("div", { className: "controls", onClick: (e) => e.stopPropagation(), children: [
|
|
11558
|
+
/* @__PURE__ */ (0, import_jsx_runtime354.jsx)(
|
|
11030
11559
|
"input",
|
|
11031
11560
|
{
|
|
11032
11561
|
type: "range",
|
|
@@ -11043,29 +11572,29 @@ var Video = import_react41.default.forwardRef((props, ref) => {
|
|
|
11043
11572
|
}
|
|
11044
11573
|
}
|
|
11045
11574
|
),
|
|
11046
|
-
/* @__PURE__ */ (0,
|
|
11047
|
-
/* @__PURE__ */ (0,
|
|
11575
|
+
/* @__PURE__ */ (0, import_jsx_runtime354.jsxs)("div", { className: "controls-row", children: [
|
|
11576
|
+
/* @__PURE__ */ (0, import_jsx_runtime354.jsx)(
|
|
11048
11577
|
"button",
|
|
11049
11578
|
{
|
|
11050
11579
|
type: "button",
|
|
11051
11580
|
className: "control-btn",
|
|
11052
11581
|
onClick: togglePlay,
|
|
11053
11582
|
"aria-label": isPlaying ? "\uC77C\uC2DC\uC815\uC9C0" : "\uC7AC\uC0DD",
|
|
11054
|
-
children: isPlaying ? /* @__PURE__ */ (0,
|
|
11583
|
+
children: isPlaying ? /* @__PURE__ */ (0, import_jsx_runtime354.jsx)(PauseIcon_default, {}) : /* @__PURE__ */ (0, import_jsx_runtime354.jsx)(PlayIcon_default, {})
|
|
11055
11584
|
}
|
|
11056
11585
|
),
|
|
11057
|
-
/* @__PURE__ */ (0,
|
|
11058
|
-
/* @__PURE__ */ (0,
|
|
11586
|
+
/* @__PURE__ */ (0, import_jsx_runtime354.jsxs)("div", { className: "volume-group", children: [
|
|
11587
|
+
/* @__PURE__ */ (0, import_jsx_runtime354.jsx)(
|
|
11059
11588
|
"button",
|
|
11060
11589
|
{
|
|
11061
11590
|
type: "button",
|
|
11062
11591
|
className: "control-btn",
|
|
11063
11592
|
onClick: toggleMute,
|
|
11064
11593
|
"aria-label": isMuted ? "\uC74C\uC18C\uAC70 \uD574\uC81C" : "\uC74C\uC18C\uAC70",
|
|
11065
|
-
children: /* @__PURE__ */ (0,
|
|
11594
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime354.jsx)(VolumeGlyph, {})
|
|
11066
11595
|
}
|
|
11067
11596
|
),
|
|
11068
|
-
/* @__PURE__ */ (0,
|
|
11597
|
+
/* @__PURE__ */ (0, import_jsx_runtime354.jsx)(
|
|
11069
11598
|
"input",
|
|
11070
11599
|
{
|
|
11071
11600
|
type: "range",
|
|
@@ -11080,14 +11609,14 @@ var Video = import_react41.default.forwardRef((props, ref) => {
|
|
|
11080
11609
|
}
|
|
11081
11610
|
)
|
|
11082
11611
|
] }),
|
|
11083
|
-
/* @__PURE__ */ (0,
|
|
11612
|
+
/* @__PURE__ */ (0, import_jsx_runtime354.jsxs)("span", { className: "time", children: [
|
|
11084
11613
|
formatTime(currentTime),
|
|
11085
11614
|
" / ",
|
|
11086
11615
|
formatTime(duration)
|
|
11087
11616
|
] }),
|
|
11088
|
-
/* @__PURE__ */ (0,
|
|
11089
|
-
playbackRates && playbackRates.length > 0 && /* @__PURE__ */ (0,
|
|
11090
|
-
/* @__PURE__ */ (0,
|
|
11617
|
+
/* @__PURE__ */ (0, import_jsx_runtime354.jsx)("div", { className: "controls-spacer" }),
|
|
11618
|
+
playbackRates && playbackRates.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime354.jsxs)("div", { className: clsx_default("rate-group", rateMenuOpen && "is-open"), children: [
|
|
11619
|
+
/* @__PURE__ */ (0, import_jsx_runtime354.jsxs)(
|
|
11091
11620
|
"button",
|
|
11092
11621
|
{
|
|
11093
11622
|
type: "button",
|
|
@@ -11101,7 +11630,7 @@ var Video = import_react41.default.forwardRef((props, ref) => {
|
|
|
11101
11630
|
]
|
|
11102
11631
|
}
|
|
11103
11632
|
),
|
|
11104
|
-
rateMenuOpen && /* @__PURE__ */ (0,
|
|
11633
|
+
rateMenuOpen && /* @__PURE__ */ (0, import_jsx_runtime354.jsx)("ul", { className: "rate-menu", role: "menu", children: playbackRates.map((r2) => /* @__PURE__ */ (0, import_jsx_runtime354.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime354.jsxs)(
|
|
11105
11634
|
"button",
|
|
11106
11635
|
{
|
|
11107
11636
|
type: "button",
|
|
@@ -11115,7 +11644,7 @@ var Video = import_react41.default.forwardRef((props, ref) => {
|
|
|
11115
11644
|
}
|
|
11116
11645
|
) }, r2)) })
|
|
11117
11646
|
] }),
|
|
11118
|
-
showCaptions && /* @__PURE__ */ (0,
|
|
11647
|
+
showCaptions && /* @__PURE__ */ (0, import_jsx_runtime354.jsx)(
|
|
11119
11648
|
"button",
|
|
11120
11649
|
{
|
|
11121
11650
|
type: "button",
|
|
@@ -11123,37 +11652,37 @@ var Video = import_react41.default.forwardRef((props, ref) => {
|
|
|
11123
11652
|
onClick: toggleCaptions,
|
|
11124
11653
|
"aria-label": captionsOn ? "\uC790\uB9C9 \uB044\uAE30" : "\uC790\uB9C9 \uCF1C\uAE30",
|
|
11125
11654
|
"aria-pressed": captionsOn,
|
|
11126
|
-
children: /* @__PURE__ */ (0,
|
|
11655
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime354.jsx)(TypeIcon_default, {})
|
|
11127
11656
|
}
|
|
11128
11657
|
),
|
|
11129
|
-
showPip && pipSupported && /* @__PURE__ */ (0,
|
|
11658
|
+
showPip && pipSupported && /* @__PURE__ */ (0, import_jsx_runtime354.jsx)(
|
|
11130
11659
|
"button",
|
|
11131
11660
|
{
|
|
11132
11661
|
type: "button",
|
|
11133
11662
|
className: clsx_default("control-btn", isPip && "is-active"),
|
|
11134
11663
|
onClick: togglePip,
|
|
11135
11664
|
"aria-label": isPip ? "PIP \uC885\uB8CC" : "PIP",
|
|
11136
|
-
children: /* @__PURE__ */ (0,
|
|
11665
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime354.jsx)(PipIcon, {})
|
|
11137
11666
|
}
|
|
11138
11667
|
),
|
|
11139
|
-
showDownload && /* @__PURE__ */ (0,
|
|
11668
|
+
showDownload && /* @__PURE__ */ (0, import_jsx_runtime354.jsx)(
|
|
11140
11669
|
"a",
|
|
11141
11670
|
{
|
|
11142
11671
|
className: "control-btn",
|
|
11143
11672
|
href: src,
|
|
11144
11673
|
download: downloadFileName ?? true,
|
|
11145
11674
|
"aria-label": "\uB2E4\uC6B4\uB85C\uB4DC",
|
|
11146
|
-
children: /* @__PURE__ */ (0,
|
|
11675
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime354.jsx)(DownloadIcon_default, {})
|
|
11147
11676
|
}
|
|
11148
11677
|
),
|
|
11149
|
-
/* @__PURE__ */ (0,
|
|
11678
|
+
/* @__PURE__ */ (0, import_jsx_runtime354.jsx)(
|
|
11150
11679
|
"button",
|
|
11151
11680
|
{
|
|
11152
11681
|
type: "button",
|
|
11153
11682
|
className: "control-btn",
|
|
11154
11683
|
onClick: toggleFullscreen,
|
|
11155
11684
|
"aria-label": isFullscreen ? "\uC804\uCCB4\uD654\uBA74 \uC885\uB8CC" : "\uC804\uCCB4\uD654\uBA74",
|
|
11156
|
-
children: isFullscreen ? /* @__PURE__ */ (0,
|
|
11685
|
+
children: isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime354.jsx)(MinimizeIcon_default, {}) : /* @__PURE__ */ (0, import_jsx_runtime354.jsx)(MaximizeIcon_default, {})
|
|
11157
11686
|
}
|
|
11158
11687
|
)
|
|
11159
11688
|
] })
|
|
@@ -11166,7 +11695,7 @@ Video.displayName = "Video";
|
|
|
11166
11695
|
var Video_default = Video;
|
|
11167
11696
|
|
|
11168
11697
|
// src/layout/Grid/FullGrid/FullGrid.tsx
|
|
11169
|
-
var
|
|
11698
|
+
var import_jsx_runtime355 = require("react/jsx-runtime");
|
|
11170
11699
|
var GAP_MAP = {
|
|
11171
11700
|
none: "var(--spacing-space-none)",
|
|
11172
11701
|
xs: "var(--spacing-space-1)",
|
|
@@ -11179,13 +11708,13 @@ var GAP_MAP = {
|
|
|
11179
11708
|
var FullGrid = (props) => {
|
|
11180
11709
|
const { children, gap } = props;
|
|
11181
11710
|
const style = gap != null ? { gap: GAP_MAP[gap] } : void 0;
|
|
11182
|
-
return /* @__PURE__ */ (0,
|
|
11711
|
+
return /* @__PURE__ */ (0, import_jsx_runtime355.jsx)("div", { className: "lib-xplat-full-grid", style, children });
|
|
11183
11712
|
};
|
|
11184
11713
|
FullGrid.displayName = "FullGrid";
|
|
11185
11714
|
var FullGrid_default = FullGrid;
|
|
11186
11715
|
|
|
11187
11716
|
// src/layout/Grid/FullScreen/FullScreen.tsx
|
|
11188
|
-
var
|
|
11717
|
+
var import_jsx_runtime356 = require("react/jsx-runtime");
|
|
11189
11718
|
var GAP_MAP2 = {
|
|
11190
11719
|
none: "var(--spacing-space-none)",
|
|
11191
11720
|
xs: "var(--spacing-space-1)",
|
|
@@ -11198,13 +11727,13 @@ var GAP_MAP2 = {
|
|
|
11198
11727
|
var FullScreen = (props) => {
|
|
11199
11728
|
const { children, gap } = props;
|
|
11200
11729
|
const style = gap != null ? { gap: GAP_MAP2[gap] } : void 0;
|
|
11201
|
-
return /* @__PURE__ */ (0,
|
|
11730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime356.jsx)("div", { className: "lib-xplat-full-screen", style, children });
|
|
11202
11731
|
};
|
|
11203
11732
|
FullScreen.displayName = "FullScreen";
|
|
11204
11733
|
var FullScreen_default = FullScreen;
|
|
11205
11734
|
|
|
11206
11735
|
// src/layout/Grid/Item/Item.tsx
|
|
11207
|
-
var
|
|
11736
|
+
var import_jsx_runtime357 = require("react/jsx-runtime");
|
|
11208
11737
|
var calculateSpans = (column) => {
|
|
11209
11738
|
const spans = {};
|
|
11210
11739
|
let inherited = column.default;
|
|
@@ -11221,35 +11750,35 @@ var GridItem = ({ column, children, className }) => {
|
|
|
11221
11750
|
Object.entries(spans).forEach(([key, value]) => {
|
|
11222
11751
|
style[`--column-${key}`] = value;
|
|
11223
11752
|
});
|
|
11224
|
-
return /* @__PURE__ */ (0,
|
|
11753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime357.jsx)("div", { className: clsx_default("lib-xplat-grid-item", className), style, children });
|
|
11225
11754
|
};
|
|
11226
11755
|
GridItem.displayName = "GridItem";
|
|
11227
11756
|
var Item_default = GridItem;
|
|
11228
11757
|
|
|
11229
11758
|
// src/layout/Header/Header.tsx
|
|
11230
|
-
var
|
|
11759
|
+
var import_jsx_runtime358 = require("react/jsx-runtime");
|
|
11231
11760
|
var Header = ({
|
|
11232
11761
|
logo,
|
|
11233
11762
|
centerContent,
|
|
11234
11763
|
rightContent
|
|
11235
11764
|
}) => {
|
|
11236
|
-
return /* @__PURE__ */ (0,
|
|
11237
|
-
/* @__PURE__ */ (0,
|
|
11238
|
-
/* @__PURE__ */ (0,
|
|
11239
|
-
/* @__PURE__ */ (0,
|
|
11765
|
+
return /* @__PURE__ */ (0, import_jsx_runtime358.jsxs)("div", { className: "lib-xplat-layout-header", children: [
|
|
11766
|
+
/* @__PURE__ */ (0, import_jsx_runtime358.jsx)("div", { children: logo }),
|
|
11767
|
+
/* @__PURE__ */ (0, import_jsx_runtime358.jsx)("div", { children: centerContent }),
|
|
11768
|
+
/* @__PURE__ */ (0, import_jsx_runtime358.jsx)("div", { children: rightContent })
|
|
11240
11769
|
] });
|
|
11241
11770
|
};
|
|
11242
11771
|
Header.displayName = "Header";
|
|
11243
11772
|
var Header_default = Header;
|
|
11244
11773
|
|
|
11245
11774
|
// src/layout/Layout/Layout.tsx
|
|
11246
|
-
var
|
|
11775
|
+
var import_jsx_runtime359 = require("react/jsx-runtime");
|
|
11247
11776
|
var Layout = (props) => {
|
|
11248
11777
|
const { header, sideBar, children } = props;
|
|
11249
|
-
return /* @__PURE__ */ (0,
|
|
11250
|
-
sideBar && /* @__PURE__ */ (0,
|
|
11251
|
-
/* @__PURE__ */ (0,
|
|
11252
|
-
header && /* @__PURE__ */ (0,
|
|
11778
|
+
return /* @__PURE__ */ (0, import_jsx_runtime359.jsx)("div", { className: "lib-xplat-layout", children: /* @__PURE__ */ (0, import_jsx_runtime359.jsxs)("div", { className: "lib-xplat-layout-content-wrapper", children: [
|
|
11779
|
+
sideBar && /* @__PURE__ */ (0, import_jsx_runtime359.jsx)(import_jsx_runtime359.Fragment, { children: sideBar }),
|
|
11780
|
+
/* @__PURE__ */ (0, import_jsx_runtime359.jsxs)("div", { className: "lib-xplat-layout-content", children: [
|
|
11781
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime359.jsx)("div", { className: "lib-xplat-layout-conent-header", children: header }),
|
|
11253
11782
|
children
|
|
11254
11783
|
] })
|
|
11255
11784
|
] }) });
|
|
@@ -11258,31 +11787,31 @@ Layout.displayName = "Layout";
|
|
|
11258
11787
|
var Layout_default = Layout;
|
|
11259
11788
|
|
|
11260
11789
|
// src/layout/SideBar/SideBar.tsx
|
|
11261
|
-
var
|
|
11790
|
+
var import_react45 = __toESM(require("react"), 1);
|
|
11262
11791
|
|
|
11263
11792
|
// src/layout/SideBar/SideBarContext.tsx
|
|
11264
|
-
var
|
|
11265
|
-
var SideBarContext =
|
|
11793
|
+
var import_react44 = __toESM(require("react"), 1);
|
|
11794
|
+
var SideBarContext = import_react44.default.createContext(null);
|
|
11266
11795
|
var useSideBarContext = () => {
|
|
11267
|
-
const ctx =
|
|
11796
|
+
const ctx = import_react44.default.useContext(SideBarContext);
|
|
11268
11797
|
if (!ctx) throw new Error("Error");
|
|
11269
11798
|
return ctx;
|
|
11270
11799
|
};
|
|
11271
11800
|
var SideBarContext_default = SideBarContext;
|
|
11272
11801
|
|
|
11273
11802
|
// src/layout/SideBar/SideBar.tsx
|
|
11274
|
-
var
|
|
11803
|
+
var import_jsx_runtime360 = require("react/jsx-runtime");
|
|
11275
11804
|
var SideBar = (props) => {
|
|
11276
11805
|
const { children, className } = props;
|
|
11277
|
-
const [isOpen, setIsOpen] =
|
|
11806
|
+
const [isOpen, setIsOpen] = import_react45.default.useState(true);
|
|
11278
11807
|
const handleSwitchSideBar = () => {
|
|
11279
11808
|
setIsOpen((prev) => !prev);
|
|
11280
11809
|
};
|
|
11281
|
-
return /* @__PURE__ */ (0,
|
|
11810
|
+
return /* @__PURE__ */ (0, import_jsx_runtime360.jsx)(
|
|
11282
11811
|
SideBarContext_default.Provider,
|
|
11283
11812
|
{
|
|
11284
11813
|
value: { isSidebarOpen: isOpen, handleSwitchSideBar },
|
|
11285
|
-
children: /* @__PURE__ */ (0,
|
|
11814
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime360.jsx)(
|
|
11286
11815
|
"div",
|
|
11287
11816
|
{
|
|
11288
11817
|
className: clsx_default(
|
|
@@ -11590,6 +12119,7 @@ var SideBar_default = SideBar;
|
|
|
11590
12119
|
Spinner,
|
|
11591
12120
|
SquareIcon,
|
|
11592
12121
|
StarIcon,
|
|
12122
|
+
Stat,
|
|
11593
12123
|
Steps,
|
|
11594
12124
|
StopCircleIcon,
|
|
11595
12125
|
SuccessIcon,
|
|
@@ -11614,6 +12144,7 @@ var SideBar_default = SideBar;
|
|
|
11614
12144
|
ThermometerIcon,
|
|
11615
12145
|
ThumbsDownIcon,
|
|
11616
12146
|
ThumbsUpIcon,
|
|
12147
|
+
TimePicker,
|
|
11617
12148
|
ToastProvider,
|
|
11618
12149
|
ToggleLeftIcon,
|
|
11619
12150
|
ToggleRightIcon,
|