@x-plat/design-system 0.5.49 → 0.5.51
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/Button/index.css +6 -3
- package/dist/components/DatePicker/index.css +14 -7
- package/dist/components/Editor/index.cjs +760 -0
- package/dist/components/Editor/index.css +247 -0
- package/dist/components/Editor/index.d.cts +29 -0
- package/dist/components/Editor/index.d.ts +29 -0
- package/dist/components/Editor/index.js +727 -0
- package/dist/components/Input/index.css +8 -4
- package/dist/components/Select/index.css +10 -5
- package/dist/components/TextArea/index.css +3 -0
- package/dist/components/index.cjs +1002 -293
- package/dist/components/index.css +275 -12
- package/dist/components/index.d.cts +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1001 -293
- package/dist/index.cjs +1026 -317
- package/dist/index.css +275 -12
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1025 -317
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -155,6 +155,7 @@ __export(index_exports, {
|
|
|
155
155
|
Edit2Icon: () => Edit2Icon_default,
|
|
156
156
|
Edit3Icon: () => Edit3Icon_default,
|
|
157
157
|
EditIcon: () => EditIcon_default,
|
|
158
|
+
Editor: () => Editor_default,
|
|
158
159
|
EmptyState: () => EmptyState_default,
|
|
159
160
|
ErrorIcon: () => ErrorIcon_default,
|
|
160
161
|
ExternalLinkIcon: () => ExternalLinkIcon_default,
|
|
@@ -6496,14 +6497,14 @@ var CardTabRoot = (props) => {
|
|
|
6496
6497
|
);
|
|
6497
6498
|
return /* @__PURE__ */ (0, import_jsx_runtime304.jsxs)("div", { className: clsx_default("lib-xplat-card-tab", size), children: [
|
|
6498
6499
|
/* @__PURE__ */ (0, import_jsx_runtime304.jsx)("div", { className: "card-tab-bar", children: tabs.map((tab) => {
|
|
6499
|
-
const
|
|
6500
|
+
const isActive2 = tab.value === activeValue;
|
|
6500
6501
|
return /* @__PURE__ */ (0, import_jsx_runtime304.jsx)(
|
|
6501
6502
|
"button",
|
|
6502
6503
|
{
|
|
6503
|
-
className: clsx_default("card-tab-trigger",
|
|
6504
|
+
className: clsx_default("card-tab-trigger", isActive2 && "active"),
|
|
6504
6505
|
onClick: () => handleTabClick(tab),
|
|
6505
6506
|
role: "tab",
|
|
6506
|
-
"aria-selected":
|
|
6507
|
+
"aria-selected": isActive2,
|
|
6507
6508
|
children: tab.title
|
|
6508
6509
|
},
|
|
6509
6510
|
tab.value
|
|
@@ -7878,12 +7879,12 @@ var import_react15 = __toESM(require("react"), 1);
|
|
|
7878
7879
|
var import_react14 = __toESM(require("react"), 1);
|
|
7879
7880
|
var import_jsx_runtime317 = require("react/jsx-runtime");
|
|
7880
7881
|
var TabItem = import_react14.default.forwardRef((props, ref) => {
|
|
7881
|
-
const { isActive, title, onClick } = props;
|
|
7882
|
+
const { isActive: isActive2, title, onClick } = props;
|
|
7882
7883
|
return /* @__PURE__ */ (0, import_jsx_runtime317.jsx)(
|
|
7883
7884
|
"div",
|
|
7884
7885
|
{
|
|
7885
7886
|
ref,
|
|
7886
|
-
className: clsx_default("tab-item",
|
|
7887
|
+
className: clsx_default("tab-item", isActive2 ? "active" : null),
|
|
7887
7888
|
onClick,
|
|
7888
7889
|
children: title
|
|
7889
7890
|
}
|
|
@@ -8306,24 +8307,731 @@ var Dropdown = (props) => {
|
|
|
8306
8307
|
Dropdown.displayName = "Dropdown";
|
|
8307
8308
|
var Dropdown_default = Dropdown;
|
|
8308
8309
|
|
|
8309
|
-
// src/components/
|
|
8310
|
+
// src/components/Editor/Editor.tsx
|
|
8311
|
+
var import_react22 = __toESM(require("react"), 1);
|
|
8310
8312
|
var import_jsx_runtime324 = require("react/jsx-runtime");
|
|
8313
|
+
var DEFAULT_TOOLBAR = [
|
|
8314
|
+
"bold",
|
|
8315
|
+
"italic",
|
|
8316
|
+
"underline",
|
|
8317
|
+
"strikethrough",
|
|
8318
|
+
"code",
|
|
8319
|
+
"heading",
|
|
8320
|
+
"list",
|
|
8321
|
+
"ordered-list",
|
|
8322
|
+
"blockquote",
|
|
8323
|
+
"code-block",
|
|
8324
|
+
"link",
|
|
8325
|
+
"image",
|
|
8326
|
+
"divider"
|
|
8327
|
+
];
|
|
8328
|
+
var ALLOWED_TAGS = /* @__PURE__ */ new Set([
|
|
8329
|
+
"p",
|
|
8330
|
+
"br",
|
|
8331
|
+
"h1",
|
|
8332
|
+
"h2",
|
|
8333
|
+
"h3",
|
|
8334
|
+
"h4",
|
|
8335
|
+
"h5",
|
|
8336
|
+
"h6",
|
|
8337
|
+
"ul",
|
|
8338
|
+
"ol",
|
|
8339
|
+
"li",
|
|
8340
|
+
"blockquote",
|
|
8341
|
+
"pre",
|
|
8342
|
+
"code",
|
|
8343
|
+
"strong",
|
|
8344
|
+
"b",
|
|
8345
|
+
"em",
|
|
8346
|
+
"i",
|
|
8347
|
+
"u",
|
|
8348
|
+
"s",
|
|
8349
|
+
"strike",
|
|
8350
|
+
"del",
|
|
8351
|
+
"a",
|
|
8352
|
+
"img",
|
|
8353
|
+
"hr",
|
|
8354
|
+
"span",
|
|
8355
|
+
"div"
|
|
8356
|
+
]);
|
|
8357
|
+
var ALLOWED_ATTRS = {
|
|
8358
|
+
a: ["href", "target", "rel"],
|
|
8359
|
+
img: ["src", "alt"]
|
|
8360
|
+
};
|
|
8361
|
+
var sanitizeHtml = (input) => {
|
|
8362
|
+
const doc = new DOMParser().parseFromString(`<div>${input}</div>`, "text/html");
|
|
8363
|
+
const root = doc.body.firstElementChild;
|
|
8364
|
+
if (!root) return "";
|
|
8365
|
+
const walk = (node) => {
|
|
8366
|
+
const children = Array.from(node.children);
|
|
8367
|
+
for (const child of children) {
|
|
8368
|
+
const tag = child.tagName.toLowerCase();
|
|
8369
|
+
if (!ALLOWED_TAGS.has(tag)) {
|
|
8370
|
+
while (child.firstChild) node.insertBefore(child.firstChild, child);
|
|
8371
|
+
node.removeChild(child);
|
|
8372
|
+
continue;
|
|
8373
|
+
}
|
|
8374
|
+
const allowed = ALLOWED_ATTRS[tag] || [];
|
|
8375
|
+
for (const attr of Array.from(child.attributes)) {
|
|
8376
|
+
if (!allowed.includes(attr.name)) {
|
|
8377
|
+
child.removeAttribute(attr.name);
|
|
8378
|
+
}
|
|
8379
|
+
if (attr.name === "href" || attr.name === "src") {
|
|
8380
|
+
const val = attr.value.trim().toLowerCase();
|
|
8381
|
+
if (val.startsWith("javascript:") || val.startsWith("data:text/html")) {
|
|
8382
|
+
child.removeAttribute(attr.name);
|
|
8383
|
+
}
|
|
8384
|
+
}
|
|
8385
|
+
}
|
|
8386
|
+
walk(child);
|
|
8387
|
+
}
|
|
8388
|
+
};
|
|
8389
|
+
walk(root);
|
|
8390
|
+
return root.innerHTML;
|
|
8391
|
+
};
|
|
8392
|
+
var escapeHtml = (text) => {
|
|
8393
|
+
const div = document.createElement("div");
|
|
8394
|
+
div.textContent = text;
|
|
8395
|
+
return div.innerHTML.replace(/\n/g, "<br>");
|
|
8396
|
+
};
|
|
8397
|
+
var SLASH_ITEMS = [
|
|
8398
|
+
{ key: "paragraph", label: "\uB2E8\uB77D", hint: "\uAE30\uBCF8 \uD14D\uC2A4\uD2B8" },
|
|
8399
|
+
{ key: "heading", label: "\uC81C\uBAA9 1", hint: "\uD070 \uC81C\uBAA9" },
|
|
8400
|
+
{ key: "list", label: "\uAE00\uBA38\uB9AC \uAE30\uD638 \uBAA9\uB85D", hint: "\u2022 \uD56D\uBAA9" },
|
|
8401
|
+
{ key: "ordered-list", label: "\uBC88\uD638 \uB9E4\uAE30\uAE30 \uBAA9\uB85D", hint: "1. \uD56D\uBAA9" },
|
|
8402
|
+
{ key: "blockquote", label: "\uC778\uC6A9", hint: "" },
|
|
8403
|
+
{ key: "code-block", label: "\uCF54\uB4DC \uBE14\uB85D", hint: "" },
|
|
8404
|
+
{ key: "divider", label: "\uAD6C\uBD84\uC120", hint: "\u2500" },
|
|
8405
|
+
{ key: "image", label: "\uC774\uBBF8\uC9C0", hint: "" }
|
|
8406
|
+
];
|
|
8407
|
+
var Editor = (props) => {
|
|
8408
|
+
const {
|
|
8409
|
+
value = "",
|
|
8410
|
+
onChange,
|
|
8411
|
+
placeholder = "\uB0B4\uC6A9\uC744 \uC785\uB825\uD558\uC138\uC694",
|
|
8412
|
+
readOnly = false,
|
|
8413
|
+
toolbar = DEFAULT_TOOLBAR,
|
|
8414
|
+
enableSlashCommand = true,
|
|
8415
|
+
enableMarkdownShortcuts = true,
|
|
8416
|
+
onImageUpload,
|
|
8417
|
+
minHeight = 200
|
|
8418
|
+
} = props;
|
|
8419
|
+
const editorRef = import_react22.default.useRef(null);
|
|
8420
|
+
const lastRangeRef = import_react22.default.useRef(null);
|
|
8421
|
+
const composingRef = import_react22.default.useRef(false);
|
|
8422
|
+
const [isFocused, setIsFocused] = import_react22.default.useState(false);
|
|
8423
|
+
const [isEmpty, setIsEmpty] = import_react22.default.useState(!value);
|
|
8424
|
+
const [activeFormats, setActiveFormats] = import_react22.default.useState(/* @__PURE__ */ new Set());
|
|
8425
|
+
const [slashOpen, setSlashOpen] = import_react22.default.useState(false);
|
|
8426
|
+
const [slashFilter, setSlashFilter] = import_react22.default.useState("");
|
|
8427
|
+
const [slashIdx, setSlashIdx] = import_react22.default.useState(0);
|
|
8428
|
+
const [slashPos, setSlashPos] = import_react22.default.useState({ top: 0, left: 0 });
|
|
8429
|
+
const slashStartRangeRef = import_react22.default.useRef(null);
|
|
8430
|
+
const [linkOpen, setLinkOpen] = import_react22.default.useState(false);
|
|
8431
|
+
const [linkValue, setLinkValue] = import_react22.default.useState("");
|
|
8432
|
+
const [linkPos, setLinkPos] = import_react22.default.useState({ top: 0, left: 0 });
|
|
8433
|
+
import_react22.default.useEffect(() => {
|
|
8434
|
+
if (!editorRef.current) return;
|
|
8435
|
+
if (editorRef.current.innerHTML !== value) {
|
|
8436
|
+
editorRef.current.innerHTML = sanitizeHtml(value || "");
|
|
8437
|
+
updateEmpty();
|
|
8438
|
+
}
|
|
8439
|
+
}, [value]);
|
|
8440
|
+
const updateEmpty = () => {
|
|
8441
|
+
const el = editorRef.current;
|
|
8442
|
+
if (!el) return;
|
|
8443
|
+
const text = el.textContent || "";
|
|
8444
|
+
const childCount = el.children.length;
|
|
8445
|
+
setIsEmpty(text.length === 0 && childCount <= 1);
|
|
8446
|
+
};
|
|
8447
|
+
const saveSelection = () => {
|
|
8448
|
+
const sel = window.getSelection();
|
|
8449
|
+
if (sel && sel.rangeCount > 0 && editorRef.current?.contains(sel.anchorNode)) {
|
|
8450
|
+
lastRangeRef.current = sel.getRangeAt(0).cloneRange();
|
|
8451
|
+
}
|
|
8452
|
+
};
|
|
8453
|
+
const restoreSelection = () => {
|
|
8454
|
+
if (!lastRangeRef.current) return;
|
|
8455
|
+
const sel = window.getSelection();
|
|
8456
|
+
sel?.removeAllRanges();
|
|
8457
|
+
sel?.addRange(lastRangeRef.current);
|
|
8458
|
+
};
|
|
8459
|
+
const updateActiveFormats = () => {
|
|
8460
|
+
if (!editorRef.current) return;
|
|
8461
|
+
const sel = window.getSelection();
|
|
8462
|
+
if (!sel || !editorRef.current.contains(sel.anchorNode)) return;
|
|
8463
|
+
const next = /* @__PURE__ */ new Set();
|
|
8464
|
+
try {
|
|
8465
|
+
if (document.queryCommandState("bold")) next.add("bold");
|
|
8466
|
+
if (document.queryCommandState("italic")) next.add("italic");
|
|
8467
|
+
if (document.queryCommandState("underline")) next.add("underline");
|
|
8468
|
+
if (document.queryCommandState("strikethrough")) next.add("strikethrough");
|
|
8469
|
+
if (document.queryCommandState("insertUnorderedList")) next.add("list");
|
|
8470
|
+
if (document.queryCommandState("insertOrderedList")) next.add("ordered-list");
|
|
8471
|
+
const block = String(document.queryCommandValue("formatBlock") || "").toLowerCase();
|
|
8472
|
+
if (block) next.add(`block:${block}`);
|
|
8473
|
+
} catch {
|
|
8474
|
+
}
|
|
8475
|
+
setActiveFormats(next);
|
|
8476
|
+
};
|
|
8477
|
+
const exec = (cmd, val) => {
|
|
8478
|
+
document.execCommand(cmd, false, val);
|
|
8479
|
+
editorRef.current?.focus();
|
|
8480
|
+
updateActiveFormats();
|
|
8481
|
+
handleInput();
|
|
8482
|
+
};
|
|
8483
|
+
const setBlock = (tag) => {
|
|
8484
|
+
exec("formatBlock", tag);
|
|
8485
|
+
};
|
|
8486
|
+
const insertDivider = () => {
|
|
8487
|
+
exec("insertHorizontalRule");
|
|
8488
|
+
const el = editorRef.current;
|
|
8489
|
+
if (el && el.lastElementChild?.tagName === "HR") {
|
|
8490
|
+
const p = document.createElement("p");
|
|
8491
|
+
p.innerHTML = "<br>";
|
|
8492
|
+
el.appendChild(p);
|
|
8493
|
+
handleInput();
|
|
8494
|
+
}
|
|
8495
|
+
};
|
|
8496
|
+
const insertImageByUrl = (url) => {
|
|
8497
|
+
if (!url) return;
|
|
8498
|
+
exec("insertImage", url);
|
|
8499
|
+
};
|
|
8500
|
+
const triggerImageUpload = async () => {
|
|
8501
|
+
if (!onImageUpload) {
|
|
8502
|
+
const url = window.prompt("\uC774\uBBF8\uC9C0 URL");
|
|
8503
|
+
if (url) {
|
|
8504
|
+
restoreSelection();
|
|
8505
|
+
insertImageByUrl(url);
|
|
8506
|
+
}
|
|
8507
|
+
return;
|
|
8508
|
+
}
|
|
8509
|
+
const input = document.createElement("input");
|
|
8510
|
+
input.type = "file";
|
|
8511
|
+
input.accept = "image/*";
|
|
8512
|
+
input.onchange = async () => {
|
|
8513
|
+
const file = input.files?.[0];
|
|
8514
|
+
if (!file) return;
|
|
8515
|
+
try {
|
|
8516
|
+
const url = await onImageUpload(file);
|
|
8517
|
+
restoreSelection();
|
|
8518
|
+
insertImageByUrl(url);
|
|
8519
|
+
} catch (err) {
|
|
8520
|
+
console.error("\uC774\uBBF8\uC9C0 \uC5C5\uB85C\uB4DC \uC2E4\uD328:", err);
|
|
8521
|
+
}
|
|
8522
|
+
};
|
|
8523
|
+
input.click();
|
|
8524
|
+
};
|
|
8525
|
+
const openSlashMenu = () => {
|
|
8526
|
+
if (!enableSlashCommand) return;
|
|
8527
|
+
const sel = window.getSelection();
|
|
8528
|
+
if (!sel || sel.rangeCount === 0) return;
|
|
8529
|
+
const range = sel.getRangeAt(0);
|
|
8530
|
+
slashStartRangeRef.current = range.cloneRange();
|
|
8531
|
+
const rect = range.getBoundingClientRect();
|
|
8532
|
+
const editorRect = editorRef.current.getBoundingClientRect();
|
|
8533
|
+
setSlashPos({
|
|
8534
|
+
top: rect.bottom - editorRect.top + 4,
|
|
8535
|
+
left: rect.left - editorRect.left
|
|
8536
|
+
});
|
|
8537
|
+
setSlashFilter("");
|
|
8538
|
+
setSlashIdx(0);
|
|
8539
|
+
setSlashOpen(true);
|
|
8540
|
+
};
|
|
8541
|
+
const closeSlashMenu = () => {
|
|
8542
|
+
setSlashOpen(false);
|
|
8543
|
+
setSlashFilter("");
|
|
8544
|
+
setSlashIdx(0);
|
|
8545
|
+
slashStartRangeRef.current = null;
|
|
8546
|
+
};
|
|
8547
|
+
const filteredSlashItems = import_react22.default.useMemo(() => {
|
|
8548
|
+
if (!slashFilter) return SLASH_ITEMS;
|
|
8549
|
+
const f = slashFilter.toLowerCase();
|
|
8550
|
+
return SLASH_ITEMS.filter((it) => it.label.toLowerCase().includes(f) || it.key.includes(f));
|
|
8551
|
+
}, [slashFilter]);
|
|
8552
|
+
const removeSlashTrigger = () => {
|
|
8553
|
+
const sel = window.getSelection();
|
|
8554
|
+
if (!sel || sel.rangeCount === 0) return;
|
|
8555
|
+
const range = sel.getRangeAt(0);
|
|
8556
|
+
const node = range.startContainer;
|
|
8557
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
8558
|
+
const text = node.textContent || "";
|
|
8559
|
+
const idx = text.lastIndexOf("/");
|
|
8560
|
+
if (idx >= 0) {
|
|
8561
|
+
node.textContent = text.slice(0, idx) + text.slice(range.startOffset);
|
|
8562
|
+
const newRange = document.createRange();
|
|
8563
|
+
newRange.setStart(node, idx);
|
|
8564
|
+
newRange.collapse(true);
|
|
8565
|
+
sel.removeAllRanges();
|
|
8566
|
+
sel.addRange(newRange);
|
|
8567
|
+
}
|
|
8568
|
+
}
|
|
8569
|
+
};
|
|
8570
|
+
const applySlashItem = (item) => {
|
|
8571
|
+
removeSlashTrigger();
|
|
8572
|
+
closeSlashMenu();
|
|
8573
|
+
switch (item.key) {
|
|
8574
|
+
case "paragraph":
|
|
8575
|
+
setBlock("p");
|
|
8576
|
+
break;
|
|
8577
|
+
case "heading":
|
|
8578
|
+
setBlock("h2");
|
|
8579
|
+
break;
|
|
8580
|
+
case "list":
|
|
8581
|
+
exec("insertUnorderedList");
|
|
8582
|
+
break;
|
|
8583
|
+
case "ordered-list":
|
|
8584
|
+
exec("insertOrderedList");
|
|
8585
|
+
break;
|
|
8586
|
+
case "blockquote":
|
|
8587
|
+
setBlock("blockquote");
|
|
8588
|
+
break;
|
|
8589
|
+
case "code-block":
|
|
8590
|
+
setBlock("pre");
|
|
8591
|
+
break;
|
|
8592
|
+
case "divider":
|
|
8593
|
+
insertDivider();
|
|
8594
|
+
break;
|
|
8595
|
+
case "image":
|
|
8596
|
+
triggerImageUpload();
|
|
8597
|
+
break;
|
|
8598
|
+
default:
|
|
8599
|
+
break;
|
|
8600
|
+
}
|
|
8601
|
+
};
|
|
8602
|
+
const openLinkEditor = () => {
|
|
8603
|
+
saveSelection();
|
|
8604
|
+
const sel = window.getSelection();
|
|
8605
|
+
if (!sel || sel.rangeCount === 0) return;
|
|
8606
|
+
const range = sel.getRangeAt(0);
|
|
8607
|
+
const rect = range.getBoundingClientRect();
|
|
8608
|
+
const editorRect = editorRef.current.getBoundingClientRect();
|
|
8609
|
+
setLinkPos({
|
|
8610
|
+
top: rect.bottom - editorRect.top + 4,
|
|
8611
|
+
left: rect.left - editorRect.left
|
|
8612
|
+
});
|
|
8613
|
+
const anchor = sel.anchorNode?.parentElement?.closest("a");
|
|
8614
|
+
setLinkValue(anchor?.getAttribute("href") || "");
|
|
8615
|
+
setLinkOpen(true);
|
|
8616
|
+
};
|
|
8617
|
+
const applyLink = () => {
|
|
8618
|
+
restoreSelection();
|
|
8619
|
+
if (linkValue) {
|
|
8620
|
+
exec("createLink", linkValue);
|
|
8621
|
+
const sel = window.getSelection();
|
|
8622
|
+
const anchor = sel?.anchorNode?.parentElement?.closest("a");
|
|
8623
|
+
if (anchor) {
|
|
8624
|
+
anchor.setAttribute("target", "_blank");
|
|
8625
|
+
anchor.setAttribute("rel", "noopener noreferrer");
|
|
8626
|
+
}
|
|
8627
|
+
} else {
|
|
8628
|
+
exec("unlink");
|
|
8629
|
+
}
|
|
8630
|
+
setLinkOpen(false);
|
|
8631
|
+
};
|
|
8632
|
+
const tryMarkdownShortcut = () => {
|
|
8633
|
+
if (!enableMarkdownShortcuts) return false;
|
|
8634
|
+
const sel = window.getSelection();
|
|
8635
|
+
if (!sel || sel.rangeCount === 0) return false;
|
|
8636
|
+
const range = sel.getRangeAt(0);
|
|
8637
|
+
const node = range.startContainer;
|
|
8638
|
+
if (node.nodeType !== Node.TEXT_NODE) return false;
|
|
8639
|
+
const text = (node.textContent || "").slice(0, range.startOffset);
|
|
8640
|
+
const patterns = [
|
|
8641
|
+
[/^###\s$/, () => setBlock("h3")],
|
|
8642
|
+
[/^##\s$/, () => setBlock("h2")],
|
|
8643
|
+
[/^#\s$/, () => setBlock("h1")],
|
|
8644
|
+
[/^-\s$/, () => exec("insertUnorderedList")],
|
|
8645
|
+
[/^\*\s$/, () => exec("insertUnorderedList")],
|
|
8646
|
+
[/^1\.\s$/, () => exec("insertOrderedList")],
|
|
8647
|
+
[/^>\s$/, () => setBlock("blockquote")]
|
|
8648
|
+
];
|
|
8649
|
+
for (const [re, fn] of patterns) {
|
|
8650
|
+
if (re.test(text)) {
|
|
8651
|
+
node.textContent = (node.textContent || "").slice(range.startOffset);
|
|
8652
|
+
const newRange = document.createRange();
|
|
8653
|
+
newRange.setStart(node, 0);
|
|
8654
|
+
newRange.collapse(true);
|
|
8655
|
+
sel.removeAllRanges();
|
|
8656
|
+
sel.addRange(newRange);
|
|
8657
|
+
fn();
|
|
8658
|
+
return true;
|
|
8659
|
+
}
|
|
8660
|
+
}
|
|
8661
|
+
return false;
|
|
8662
|
+
};
|
|
8663
|
+
const handleInput = () => {
|
|
8664
|
+
if (composingRef.current) return;
|
|
8665
|
+
const el = editorRef.current;
|
|
8666
|
+
if (!el) return;
|
|
8667
|
+
onChange?.(el.innerHTML);
|
|
8668
|
+
updateEmpty();
|
|
8669
|
+
updateActiveFormats();
|
|
8670
|
+
if (slashOpen) {
|
|
8671
|
+
const sel = window.getSelection();
|
|
8672
|
+
if (sel && sel.rangeCount > 0) {
|
|
8673
|
+
const range = sel.getRangeAt(0);
|
|
8674
|
+
const node = range.startContainer;
|
|
8675
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
8676
|
+
const text = node.textContent || "";
|
|
8677
|
+
const lastSlash = text.lastIndexOf("/", range.startOffset - 1);
|
|
8678
|
+
if (lastSlash >= 0) {
|
|
8679
|
+
const filter = text.slice(lastSlash + 1, range.startOffset);
|
|
8680
|
+
if (filter.includes(" ") || filter.includes("\n")) {
|
|
8681
|
+
closeSlashMenu();
|
|
8682
|
+
} else {
|
|
8683
|
+
setSlashFilter(filter);
|
|
8684
|
+
setSlashIdx(0);
|
|
8685
|
+
}
|
|
8686
|
+
} else {
|
|
8687
|
+
closeSlashMenu();
|
|
8688
|
+
}
|
|
8689
|
+
}
|
|
8690
|
+
}
|
|
8691
|
+
}
|
|
8692
|
+
};
|
|
8693
|
+
const handleKeyDown = (e) => {
|
|
8694
|
+
if (readOnly) return;
|
|
8695
|
+
if (slashOpen) {
|
|
8696
|
+
if (e.key === "ArrowDown") {
|
|
8697
|
+
e.preventDefault();
|
|
8698
|
+
setSlashIdx((i) => Math.min(i + 1, filteredSlashItems.length - 1));
|
|
8699
|
+
return;
|
|
8700
|
+
}
|
|
8701
|
+
if (e.key === "ArrowUp") {
|
|
8702
|
+
e.preventDefault();
|
|
8703
|
+
setSlashIdx((i) => Math.max(i - 1, 0));
|
|
8704
|
+
return;
|
|
8705
|
+
}
|
|
8706
|
+
if (e.key === "Enter") {
|
|
8707
|
+
e.preventDefault();
|
|
8708
|
+
const item = filteredSlashItems[slashIdx];
|
|
8709
|
+
if (item) applySlashItem(item);
|
|
8710
|
+
return;
|
|
8711
|
+
}
|
|
8712
|
+
if (e.key === "Escape") {
|
|
8713
|
+
e.preventDefault();
|
|
8714
|
+
closeSlashMenu();
|
|
8715
|
+
return;
|
|
8716
|
+
}
|
|
8717
|
+
}
|
|
8718
|
+
if ((e.metaKey || e.ctrlKey) && !e.shiftKey && !e.altKey) {
|
|
8719
|
+
const k = e.key.toLowerCase();
|
|
8720
|
+
if (k === "b") {
|
|
8721
|
+
e.preventDefault();
|
|
8722
|
+
exec("bold");
|
|
8723
|
+
return;
|
|
8724
|
+
}
|
|
8725
|
+
if (k === "i") {
|
|
8726
|
+
e.preventDefault();
|
|
8727
|
+
exec("italic");
|
|
8728
|
+
return;
|
|
8729
|
+
}
|
|
8730
|
+
if (k === "u") {
|
|
8731
|
+
e.preventDefault();
|
|
8732
|
+
exec("underline");
|
|
8733
|
+
return;
|
|
8734
|
+
}
|
|
8735
|
+
if (k === "k") {
|
|
8736
|
+
e.preventDefault();
|
|
8737
|
+
openLinkEditor();
|
|
8738
|
+
return;
|
|
8739
|
+
}
|
|
8740
|
+
}
|
|
8741
|
+
if (enableSlashCommand && e.key === "/") {
|
|
8742
|
+
setTimeout(openSlashMenu, 0);
|
|
8743
|
+
}
|
|
8744
|
+
if (enableMarkdownShortcuts && e.key === " ") {
|
|
8745
|
+
if (tryMarkdownShortcut()) {
|
|
8746
|
+
e.preventDefault();
|
|
8747
|
+
}
|
|
8748
|
+
}
|
|
8749
|
+
};
|
|
8750
|
+
const handlePaste = (e) => {
|
|
8751
|
+
if (readOnly) return;
|
|
8752
|
+
e.preventDefault();
|
|
8753
|
+
const html = e.clipboardData.getData("text/html");
|
|
8754
|
+
const text = e.clipboardData.getData("text/plain");
|
|
8755
|
+
const clean = html ? sanitizeHtml(html) : escapeHtml(text);
|
|
8756
|
+
document.execCommand("insertHTML", false, clean);
|
|
8757
|
+
handleInput();
|
|
8758
|
+
};
|
|
8759
|
+
const handleCompositionStart = () => {
|
|
8760
|
+
composingRef.current = true;
|
|
8761
|
+
};
|
|
8762
|
+
const handleCompositionEnd = () => {
|
|
8763
|
+
composingRef.current = false;
|
|
8764
|
+
handleInput();
|
|
8765
|
+
};
|
|
8766
|
+
const handleFocus = () => {
|
|
8767
|
+
setIsFocused(true);
|
|
8768
|
+
updateActiveFormats();
|
|
8769
|
+
};
|
|
8770
|
+
const handleBlur = () => {
|
|
8771
|
+
setIsFocused(false);
|
|
8772
|
+
saveSelection();
|
|
8773
|
+
};
|
|
8774
|
+
const handleSelectionUpdate = () => {
|
|
8775
|
+
updateActiveFormats();
|
|
8776
|
+
};
|
|
8777
|
+
const onToolbarAction = (item) => {
|
|
8778
|
+
switch (item) {
|
|
8779
|
+
case "bold":
|
|
8780
|
+
exec("bold");
|
|
8781
|
+
break;
|
|
8782
|
+
case "italic":
|
|
8783
|
+
exec("italic");
|
|
8784
|
+
break;
|
|
8785
|
+
case "underline":
|
|
8786
|
+
exec("underline");
|
|
8787
|
+
break;
|
|
8788
|
+
case "strikethrough":
|
|
8789
|
+
exec("strikethrough");
|
|
8790
|
+
break;
|
|
8791
|
+
case "code": {
|
|
8792
|
+
const sel = window.getSelection();
|
|
8793
|
+
if (!sel || sel.rangeCount === 0 || sel.isCollapsed) return;
|
|
8794
|
+
const range = sel.getRangeAt(0);
|
|
8795
|
+
const code = document.createElement("code");
|
|
8796
|
+
try {
|
|
8797
|
+
range.surroundContents(code);
|
|
8798
|
+
} catch {
|
|
8799
|
+
const frag = range.extractContents();
|
|
8800
|
+
code.appendChild(frag);
|
|
8801
|
+
range.insertNode(code);
|
|
8802
|
+
}
|
|
8803
|
+
handleInput();
|
|
8804
|
+
break;
|
|
8805
|
+
}
|
|
8806
|
+
case "heading":
|
|
8807
|
+
setBlock("h2");
|
|
8808
|
+
break;
|
|
8809
|
+
case "list":
|
|
8810
|
+
exec("insertUnorderedList");
|
|
8811
|
+
break;
|
|
8812
|
+
case "ordered-list":
|
|
8813
|
+
exec("insertOrderedList");
|
|
8814
|
+
break;
|
|
8815
|
+
case "blockquote":
|
|
8816
|
+
setBlock("blockquote");
|
|
8817
|
+
break;
|
|
8818
|
+
case "code-block":
|
|
8819
|
+
setBlock("pre");
|
|
8820
|
+
break;
|
|
8821
|
+
case "link":
|
|
8822
|
+
openLinkEditor();
|
|
8823
|
+
break;
|
|
8824
|
+
case "image":
|
|
8825
|
+
triggerImageUpload();
|
|
8826
|
+
break;
|
|
8827
|
+
case "divider":
|
|
8828
|
+
insertDivider();
|
|
8829
|
+
break;
|
|
8830
|
+
}
|
|
8831
|
+
};
|
|
8832
|
+
return /* @__PURE__ */ (0, import_jsx_runtime324.jsxs)("div", { className: clsx_default("lib-xplat-editor", isFocused && "focused", readOnly && "readonly"), children: [
|
|
8833
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime324.jsx)(
|
|
8834
|
+
EditorToolbar,
|
|
8835
|
+
{
|
|
8836
|
+
items: toolbar,
|
|
8837
|
+
active: activeFormats,
|
|
8838
|
+
onAction: onToolbarAction
|
|
8839
|
+
}
|
|
8840
|
+
),
|
|
8841
|
+
/* @__PURE__ */ (0, import_jsx_runtime324.jsxs)("div", { className: "lib-xplat-editor__content", style: { minHeight }, children: [
|
|
8842
|
+
isEmpty && !isFocused && /* @__PURE__ */ (0, import_jsx_runtime324.jsx)("div", { className: "lib-xplat-editor__placeholder", children: placeholder }),
|
|
8843
|
+
/* @__PURE__ */ (0, import_jsx_runtime324.jsx)(
|
|
8844
|
+
"div",
|
|
8845
|
+
{
|
|
8846
|
+
ref: editorRef,
|
|
8847
|
+
contentEditable: !readOnly,
|
|
8848
|
+
suppressContentEditableWarning: true,
|
|
8849
|
+
className: "lib-xplat-editor__editable",
|
|
8850
|
+
onInput: handleInput,
|
|
8851
|
+
onKeyDown: handleKeyDown,
|
|
8852
|
+
onKeyUp: handleSelectionUpdate,
|
|
8853
|
+
onMouseUp: handleSelectionUpdate,
|
|
8854
|
+
onPaste: handlePaste,
|
|
8855
|
+
onCompositionStart: handleCompositionStart,
|
|
8856
|
+
onCompositionEnd: handleCompositionEnd,
|
|
8857
|
+
onFocus: handleFocus,
|
|
8858
|
+
onBlur: handleBlur,
|
|
8859
|
+
spellCheck: true
|
|
8860
|
+
}
|
|
8861
|
+
),
|
|
8862
|
+
slashOpen && filteredSlashItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime324.jsx)(
|
|
8863
|
+
SlashMenu,
|
|
8864
|
+
{
|
|
8865
|
+
position: slashPos,
|
|
8866
|
+
items: filteredSlashItems,
|
|
8867
|
+
activeIndex: slashIdx,
|
|
8868
|
+
onSelect: applySlashItem,
|
|
8869
|
+
onClose: closeSlashMenu
|
|
8870
|
+
}
|
|
8871
|
+
),
|
|
8872
|
+
linkOpen && /* @__PURE__ */ (0, import_jsx_runtime324.jsx)(
|
|
8873
|
+
LinkPopover,
|
|
8874
|
+
{
|
|
8875
|
+
position: linkPos,
|
|
8876
|
+
value: linkValue,
|
|
8877
|
+
onChange: setLinkValue,
|
|
8878
|
+
onConfirm: applyLink,
|
|
8879
|
+
onClose: () => setLinkOpen(false)
|
|
8880
|
+
}
|
|
8881
|
+
)
|
|
8882
|
+
] })
|
|
8883
|
+
] });
|
|
8884
|
+
};
|
|
8885
|
+
Editor.displayName = "Editor";
|
|
8886
|
+
var Editor_default = Editor;
|
|
8887
|
+
var TOOLBAR_LABEL = {
|
|
8888
|
+
bold: "B",
|
|
8889
|
+
italic: "I",
|
|
8890
|
+
underline: "U",
|
|
8891
|
+
strikethrough: "S",
|
|
8892
|
+
code: "<>",
|
|
8893
|
+
heading: "H",
|
|
8894
|
+
list: "\u2022",
|
|
8895
|
+
"ordered-list": "1.",
|
|
8896
|
+
blockquote: "\u275D",
|
|
8897
|
+
"code-block": "[ ]",
|
|
8898
|
+
link: "\u{1F517}",
|
|
8899
|
+
image: "\u{1F5BC}",
|
|
8900
|
+
divider: "\u2014"
|
|
8901
|
+
};
|
|
8902
|
+
var TOOLBAR_TITLE = {
|
|
8903
|
+
bold: "\uAD75\uAC8C (\u2318B)",
|
|
8904
|
+
italic: "\uAE30\uC6B8\uC784 (\u2318I)",
|
|
8905
|
+
underline: "\uBC11\uC904 (\u2318U)",
|
|
8906
|
+
strikethrough: "\uCDE8\uC18C\uC120",
|
|
8907
|
+
code: "\uC778\uB77C\uC778 \uCF54\uB4DC",
|
|
8908
|
+
heading: "\uC81C\uBAA9",
|
|
8909
|
+
list: "\uAE00\uBA38\uB9AC \uAE30\uD638 \uBAA9\uB85D",
|
|
8910
|
+
"ordered-list": "\uBC88\uD638 \uB9E4\uAE30\uAE30 \uBAA9\uB85D",
|
|
8911
|
+
blockquote: "\uC778\uC6A9",
|
|
8912
|
+
"code-block": "\uCF54\uB4DC \uBE14\uB85D",
|
|
8913
|
+
link: "\uB9C1\uD06C (\u2318K)",
|
|
8914
|
+
image: "\uC774\uBBF8\uC9C0",
|
|
8915
|
+
divider: "\uAD6C\uBD84\uC120"
|
|
8916
|
+
};
|
|
8917
|
+
var isActive = (item, active) => {
|
|
8918
|
+
if (item === "heading") return active.has("block:h1") || active.has("block:h2") || active.has("block:h3");
|
|
8919
|
+
if (item === "blockquote") return active.has("block:blockquote");
|
|
8920
|
+
if (item === "code-block") return active.has("block:pre");
|
|
8921
|
+
return active.has(item);
|
|
8922
|
+
};
|
|
8923
|
+
var EditorToolbar = ({ items, active, onAction }) => {
|
|
8924
|
+
return /* @__PURE__ */ (0, import_jsx_runtime324.jsx)("div", { className: "lib-xplat-editor__toolbar", children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime324.jsx)(
|
|
8925
|
+
"button",
|
|
8926
|
+
{
|
|
8927
|
+
type: "button",
|
|
8928
|
+
className: clsx_default("lib-xplat-editor__toolbar-btn", isActive(item, active) && "active"),
|
|
8929
|
+
title: TOOLBAR_TITLE[item],
|
|
8930
|
+
onMouseDown: (e) => {
|
|
8931
|
+
e.preventDefault();
|
|
8932
|
+
onAction(item);
|
|
8933
|
+
},
|
|
8934
|
+
children: TOOLBAR_LABEL[item]
|
|
8935
|
+
},
|
|
8936
|
+
item
|
|
8937
|
+
)) });
|
|
8938
|
+
};
|
|
8939
|
+
var SlashMenu = ({ position, items, activeIndex, onSelect, onClose }) => {
|
|
8940
|
+
import_react22.default.useEffect(() => {
|
|
8941
|
+
const handleClickOutside = (e) => {
|
|
8942
|
+
const target = e.target;
|
|
8943
|
+
const menu = document.querySelector(".lib-xplat-editor__slash-menu");
|
|
8944
|
+
if (menu && !menu.contains(target)) onClose();
|
|
8945
|
+
};
|
|
8946
|
+
window.addEventListener("mousedown", handleClickOutside);
|
|
8947
|
+
return () => window.removeEventListener("mousedown", handleClickOutside);
|
|
8948
|
+
}, [onClose]);
|
|
8949
|
+
return /* @__PURE__ */ (0, import_jsx_runtime324.jsx)(
|
|
8950
|
+
"div",
|
|
8951
|
+
{
|
|
8952
|
+
className: "lib-xplat-editor__slash-menu",
|
|
8953
|
+
style: { top: position.top, left: position.left },
|
|
8954
|
+
children: items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime324.jsxs)(
|
|
8955
|
+
"button",
|
|
8956
|
+
{
|
|
8957
|
+
type: "button",
|
|
8958
|
+
className: clsx_default("lib-xplat-editor__slash-item", i === activeIndex && "active"),
|
|
8959
|
+
onMouseDown: (e) => {
|
|
8960
|
+
e.preventDefault();
|
|
8961
|
+
onSelect(item);
|
|
8962
|
+
},
|
|
8963
|
+
children: [
|
|
8964
|
+
/* @__PURE__ */ (0, import_jsx_runtime324.jsx)("span", { className: "label", children: item.label }),
|
|
8965
|
+
item.hint && /* @__PURE__ */ (0, import_jsx_runtime324.jsx)("span", { className: "hint", children: item.hint })
|
|
8966
|
+
]
|
|
8967
|
+
},
|
|
8968
|
+
item.key
|
|
8969
|
+
))
|
|
8970
|
+
}
|
|
8971
|
+
);
|
|
8972
|
+
};
|
|
8973
|
+
var LinkPopover = ({ position, value, onChange, onConfirm, onClose }) => {
|
|
8974
|
+
const inputRef = import_react22.default.useRef(null);
|
|
8975
|
+
import_react22.default.useEffect(() => {
|
|
8976
|
+
inputRef.current?.focus();
|
|
8977
|
+
}, []);
|
|
8978
|
+
return /* @__PURE__ */ (0, import_jsx_runtime324.jsxs)(
|
|
8979
|
+
"div",
|
|
8980
|
+
{
|
|
8981
|
+
className: "lib-xplat-editor__link-popover",
|
|
8982
|
+
style: { top: position.top, left: position.left },
|
|
8983
|
+
children: [
|
|
8984
|
+
/* @__PURE__ */ (0, import_jsx_runtime324.jsx)(
|
|
8985
|
+
"input",
|
|
8986
|
+
{
|
|
8987
|
+
ref: inputRef,
|
|
8988
|
+
type: "url",
|
|
8989
|
+
placeholder: "https://",
|
|
8990
|
+
value,
|
|
8991
|
+
onChange: (e) => onChange(e.target.value),
|
|
8992
|
+
onKeyDown: (e) => {
|
|
8993
|
+
if (e.key === "Enter") {
|
|
8994
|
+
e.preventDefault();
|
|
8995
|
+
onConfirm();
|
|
8996
|
+
}
|
|
8997
|
+
if (e.key === "Escape") {
|
|
8998
|
+
e.preventDefault();
|
|
8999
|
+
onClose();
|
|
9000
|
+
}
|
|
9001
|
+
}
|
|
9002
|
+
}
|
|
9003
|
+
),
|
|
9004
|
+
/* @__PURE__ */ (0, import_jsx_runtime324.jsx)("button", { type: "button", onMouseDown: (e) => {
|
|
9005
|
+
e.preventDefault();
|
|
9006
|
+
onConfirm();
|
|
9007
|
+
}, children: "\uC801\uC6A9" }),
|
|
9008
|
+
/* @__PURE__ */ (0, import_jsx_runtime324.jsx)("button", { type: "button", onMouseDown: (e) => {
|
|
9009
|
+
e.preventDefault();
|
|
9010
|
+
onClose();
|
|
9011
|
+
}, children: "\uCDE8\uC18C" })
|
|
9012
|
+
]
|
|
9013
|
+
}
|
|
9014
|
+
);
|
|
9015
|
+
};
|
|
9016
|
+
|
|
9017
|
+
// src/components/EmptyState/EmptyState.tsx
|
|
9018
|
+
var import_jsx_runtime325 = require("react/jsx-runtime");
|
|
8311
9019
|
var EmptyState = (props) => {
|
|
8312
9020
|
const { icon, title = "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4", description, action } = props;
|
|
8313
|
-
return /* @__PURE__ */ (0,
|
|
8314
|
-
icon && /* @__PURE__ */ (0,
|
|
8315
|
-
!icon && /* @__PURE__ */ (0,
|
|
8316
|
-
/* @__PURE__ */ (0,
|
|
8317
|
-
description && /* @__PURE__ */ (0,
|
|
8318
|
-
action && /* @__PURE__ */ (0,
|
|
9021
|
+
return /* @__PURE__ */ (0, import_jsx_runtime325.jsxs)("div", { className: "lib-xplat-empty-state", children: [
|
|
9022
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime325.jsx)("div", { className: "empty-icon", children: icon }),
|
|
9023
|
+
!icon && /* @__PURE__ */ (0, import_jsx_runtime325.jsx)("div", { className: "empty-icon", children: /* @__PURE__ */ (0, import_jsx_runtime325.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime325.jsx)("path", { d: "M20 6h-8l-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z" }) }) }),
|
|
9024
|
+
/* @__PURE__ */ (0, import_jsx_runtime325.jsx)("p", { className: "empty-title", children: title }),
|
|
9025
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime325.jsx)("p", { className: "empty-description", children: description }),
|
|
9026
|
+
action && /* @__PURE__ */ (0, import_jsx_runtime325.jsx)("div", { className: "empty-action", children: action })
|
|
8319
9027
|
] });
|
|
8320
9028
|
};
|
|
8321
9029
|
EmptyState.displayName = "EmptyState";
|
|
8322
9030
|
var EmptyState_default = EmptyState;
|
|
8323
9031
|
|
|
8324
9032
|
// src/components/FileUpload/FileUpload.tsx
|
|
8325
|
-
var
|
|
8326
|
-
var
|
|
9033
|
+
var import_react23 = __toESM(require("react"), 1);
|
|
9034
|
+
var import_jsx_runtime326 = require("react/jsx-runtime");
|
|
8327
9035
|
var FileUpload = (props) => {
|
|
8328
9036
|
const {
|
|
8329
9037
|
accept,
|
|
@@ -8333,8 +9041,8 @@ var FileUpload = (props) => {
|
|
|
8333
9041
|
label = "\uD30C\uC77C\uC744 \uB4DC\uB798\uADF8\uD558\uAC70\uB098 \uD074\uB9AD\uD558\uC5EC \uC5C5\uB85C\uB4DC",
|
|
8334
9042
|
description
|
|
8335
9043
|
} = props;
|
|
8336
|
-
const [isDragOver, setIsDragOver] =
|
|
8337
|
-
const inputRef =
|
|
9044
|
+
const [isDragOver, setIsDragOver] = import_react23.default.useState(false);
|
|
9045
|
+
const inputRef = import_react23.default.useRef(null);
|
|
8338
9046
|
const handleFiles = (fileList) => {
|
|
8339
9047
|
let files = Array.from(fileList);
|
|
8340
9048
|
if (maxSize) {
|
|
@@ -8364,7 +9072,7 @@ var FileUpload = (props) => {
|
|
|
8364
9072
|
handleFiles(e.target.files);
|
|
8365
9073
|
}
|
|
8366
9074
|
};
|
|
8367
|
-
return /* @__PURE__ */ (0,
|
|
9075
|
+
return /* @__PURE__ */ (0, import_jsx_runtime326.jsxs)(
|
|
8368
9076
|
"div",
|
|
8369
9077
|
{
|
|
8370
9078
|
className: clsx_default("lib-xplat-file-upload", { "drag-over": isDragOver }),
|
|
@@ -8373,7 +9081,7 @@ var FileUpload = (props) => {
|
|
|
8373
9081
|
onDragLeave: handleDragLeave,
|
|
8374
9082
|
onClick: () => inputRef.current?.click(),
|
|
8375
9083
|
children: [
|
|
8376
|
-
/* @__PURE__ */ (0,
|
|
9084
|
+
/* @__PURE__ */ (0, import_jsx_runtime326.jsx)(
|
|
8377
9085
|
"input",
|
|
8378
9086
|
{
|
|
8379
9087
|
ref: inputRef,
|
|
@@ -8383,9 +9091,9 @@ var FileUpload = (props) => {
|
|
|
8383
9091
|
onChange: handleChange
|
|
8384
9092
|
}
|
|
8385
9093
|
),
|
|
8386
|
-
/* @__PURE__ */ (0,
|
|
8387
|
-
/* @__PURE__ */ (0,
|
|
8388
|
-
description && /* @__PURE__ */ (0,
|
|
9094
|
+
/* @__PURE__ */ (0, import_jsx_runtime326.jsx)("div", { className: "upload-icon", children: /* @__PURE__ */ (0, import_jsx_runtime326.jsx)(UploadIcon_default, {}) }),
|
|
9095
|
+
/* @__PURE__ */ (0, import_jsx_runtime326.jsx)("p", { className: "upload-label", children: label }),
|
|
9096
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime326.jsx)("p", { className: "upload-description", children: description })
|
|
8389
9097
|
]
|
|
8390
9098
|
}
|
|
8391
9099
|
);
|
|
@@ -8394,10 +9102,10 @@ FileUpload.displayName = "FileUpload";
|
|
|
8394
9102
|
var FileUpload_default = FileUpload;
|
|
8395
9103
|
|
|
8396
9104
|
// src/components/HtmlTypeWriter/HtmlTypeWriter.tsx
|
|
8397
|
-
var
|
|
9105
|
+
var import_react25 = __toESM(require("react"), 1);
|
|
8398
9106
|
|
|
8399
9107
|
// src/components/HtmlTypeWriter/utils.ts
|
|
8400
|
-
var
|
|
9108
|
+
var import_react24 = __toESM(require("react"), 1);
|
|
8401
9109
|
var voidTags = /* @__PURE__ */ new Set([
|
|
8402
9110
|
"br",
|
|
8403
9111
|
"img",
|
|
@@ -8465,41 +9173,41 @@ var convertNodeToReactWithRange = (node, typedLen, rangeMap) => {
|
|
|
8465
9173
|
props[attr.name] = attr.value;
|
|
8466
9174
|
});
|
|
8467
9175
|
if (voidTags.has(tag)) {
|
|
8468
|
-
return
|
|
9176
|
+
return import_react24.default.createElement(tag, props);
|
|
8469
9177
|
}
|
|
8470
9178
|
const children = Array.from(element.childNodes).map((child) => convertNodeToReactWithRange(child, typedLen, rangeMap)).filter((n) => n != null);
|
|
8471
|
-
return
|
|
9179
|
+
return import_react24.default.createElement(tag, props, ...children);
|
|
8472
9180
|
};
|
|
8473
9181
|
var htmlToReactProgressive = (root, typedLen, rangeMap) => {
|
|
8474
9182
|
const nodes = Array.from(root.childNodes).map((child, idx) => {
|
|
8475
9183
|
const node = convertNodeToReactWithRange(child, typedLen, rangeMap);
|
|
8476
|
-
return node == null ? null :
|
|
9184
|
+
return node == null ? null : import_react24.default.createElement(import_react24.default.Fragment, { key: idx }, node);
|
|
8477
9185
|
}).filter(Boolean);
|
|
8478
9186
|
return nodes.length === 0 ? null : nodes;
|
|
8479
9187
|
};
|
|
8480
9188
|
|
|
8481
9189
|
// src/components/HtmlTypeWriter/HtmlTypeWriter.tsx
|
|
8482
|
-
var
|
|
9190
|
+
var import_jsx_runtime327 = require("react/jsx-runtime");
|
|
8483
9191
|
var HtmlTypeWriter = ({
|
|
8484
9192
|
html,
|
|
8485
9193
|
duration = 20,
|
|
8486
9194
|
onDone,
|
|
8487
9195
|
onChange
|
|
8488
9196
|
}) => {
|
|
8489
|
-
const [typedLen, setTypedLen] =
|
|
8490
|
-
const doneCalledRef =
|
|
8491
|
-
const { doc, rangeMap, totalLength } =
|
|
9197
|
+
const [typedLen, setTypedLen] = import_react25.default.useState(0);
|
|
9198
|
+
const doneCalledRef = import_react25.default.useRef(false);
|
|
9199
|
+
const { doc, rangeMap, totalLength } = import_react25.default.useMemo(() => {
|
|
8492
9200
|
if (typeof window === "undefined") return { doc: null, rangeMap: /* @__PURE__ */ new Map(), totalLength: 0 };
|
|
8493
9201
|
const decoded = decodeHtmlEntities(html);
|
|
8494
9202
|
const doc2 = new DOMParser().parseFromString(decoded, "text/html");
|
|
8495
9203
|
const { rangeMap: rangeMap2, totalLength: totalLength2 } = buildRangeMap(doc2.body);
|
|
8496
9204
|
return { doc: doc2, rangeMap: rangeMap2, totalLength: totalLength2 };
|
|
8497
9205
|
}, [html]);
|
|
8498
|
-
|
|
9206
|
+
import_react25.default.useEffect(() => {
|
|
8499
9207
|
setTypedLen(0);
|
|
8500
9208
|
doneCalledRef.current = false;
|
|
8501
9209
|
}, [html]);
|
|
8502
|
-
|
|
9210
|
+
import_react25.default.useEffect(() => {
|
|
8503
9211
|
if (!totalLength) return;
|
|
8504
9212
|
if (typedLen >= totalLength) return;
|
|
8505
9213
|
const timer = window.setInterval(() => {
|
|
@@ -8507,33 +9215,33 @@ var HtmlTypeWriter = ({
|
|
|
8507
9215
|
}, duration);
|
|
8508
9216
|
return () => window.clearInterval(timer);
|
|
8509
9217
|
}, [typedLen, totalLength, duration]);
|
|
8510
|
-
|
|
9218
|
+
import_react25.default.useEffect(() => {
|
|
8511
9219
|
if (typedLen > 0 && typedLen < totalLength) {
|
|
8512
9220
|
onChange?.();
|
|
8513
9221
|
}
|
|
8514
9222
|
}, [typedLen, totalLength, onChange]);
|
|
8515
|
-
|
|
9223
|
+
import_react25.default.useEffect(() => {
|
|
8516
9224
|
if (typedLen === totalLength && totalLength > 0 && !doneCalledRef.current) {
|
|
8517
9225
|
doneCalledRef.current = true;
|
|
8518
9226
|
onDone?.();
|
|
8519
9227
|
}
|
|
8520
9228
|
}, [typedLen, totalLength, onDone]);
|
|
8521
|
-
const parsed =
|
|
9229
|
+
const parsed = import_react25.default.useMemo(
|
|
8522
9230
|
() => doc ? htmlToReactProgressive(doc.body, typedLen, rangeMap) : null,
|
|
8523
9231
|
[doc, typedLen, rangeMap]
|
|
8524
9232
|
);
|
|
8525
|
-
return /* @__PURE__ */ (0,
|
|
9233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime327.jsx)("div", { className: "lib-xplat-htmlTypewriter", children: parsed });
|
|
8526
9234
|
};
|
|
8527
9235
|
HtmlTypeWriter.displayName = "HtmlTypeWriter";
|
|
8528
9236
|
var HtmlTypeWriter_default = HtmlTypeWriter;
|
|
8529
9237
|
|
|
8530
9238
|
// src/components/ImageSelector/ImageSelector.tsx
|
|
8531
|
-
var
|
|
8532
|
-
var
|
|
9239
|
+
var import_react26 = __toESM(require("react"), 1);
|
|
9240
|
+
var import_jsx_runtime328 = require("react/jsx-runtime");
|
|
8533
9241
|
var ImageSelector = (props) => {
|
|
8534
9242
|
const { value, label, onChange } = props;
|
|
8535
|
-
const [previewUrl, setPreviewUrl] =
|
|
8536
|
-
|
|
9243
|
+
const [previewUrl, setPreviewUrl] = import_react26.default.useState();
|
|
9244
|
+
import_react26.default.useEffect(() => {
|
|
8537
9245
|
if (!value) {
|
|
8538
9246
|
setPreviewUrl(void 0);
|
|
8539
9247
|
return;
|
|
@@ -8542,7 +9250,7 @@ var ImageSelector = (props) => {
|
|
|
8542
9250
|
setPreviewUrl(url);
|
|
8543
9251
|
return () => URL.revokeObjectURL(url);
|
|
8544
9252
|
}, [value]);
|
|
8545
|
-
const inputRef =
|
|
9253
|
+
const inputRef = import_react26.default.useRef(null);
|
|
8546
9254
|
const handleFileChange = (e) => {
|
|
8547
9255
|
const selectedFile = e.target.files?.[0];
|
|
8548
9256
|
if (selectedFile) {
|
|
@@ -8555,8 +9263,8 @@ var ImageSelector = (props) => {
|
|
|
8555
9263
|
const handleOpenFileDialog = () => {
|
|
8556
9264
|
inputRef.current?.click();
|
|
8557
9265
|
};
|
|
8558
|
-
return /* @__PURE__ */ (0,
|
|
8559
|
-
/* @__PURE__ */ (0,
|
|
9266
|
+
return /* @__PURE__ */ (0, import_jsx_runtime328.jsxs)("div", { className: `lib-xplat-imageselector${value ? "" : " none-value"}`, children: [
|
|
9267
|
+
/* @__PURE__ */ (0, import_jsx_runtime328.jsx)(
|
|
8560
9268
|
"input",
|
|
8561
9269
|
{
|
|
8562
9270
|
type: "file",
|
|
@@ -8566,13 +9274,13 @@ var ImageSelector = (props) => {
|
|
|
8566
9274
|
ref: inputRef
|
|
8567
9275
|
}
|
|
8568
9276
|
),
|
|
8569
|
-
value && /* @__PURE__ */ (0,
|
|
8570
|
-
/* @__PURE__ */ (0,
|
|
8571
|
-
/* @__PURE__ */ (0,
|
|
9277
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime328.jsxs)("div", { className: "action-bar", children: [
|
|
9278
|
+
/* @__PURE__ */ (0, import_jsx_runtime328.jsx)("div", { className: "icon-wrapper", onClick: handleOpenFileDialog, children: /* @__PURE__ */ (0, import_jsx_runtime328.jsx)(UploadIcon_default, {}) }),
|
|
9279
|
+
/* @__PURE__ */ (0, import_jsx_runtime328.jsx)("div", { className: "icon-wrapper", onClick: handleDeleteFile, children: /* @__PURE__ */ (0, import_jsx_runtime328.jsx)(DeleteIcon_default, {}) })
|
|
8572
9280
|
] }),
|
|
8573
|
-
/* @__PURE__ */ (0,
|
|
8574
|
-
/* @__PURE__ */ (0,
|
|
8575
|
-
/* @__PURE__ */ (0,
|
|
9281
|
+
/* @__PURE__ */ (0, import_jsx_runtime328.jsx)("div", { className: "content", children: previewUrl ? /* @__PURE__ */ (0, import_jsx_runtime328.jsx)("img", { src: previewUrl, alt: "preview" }) : /* @__PURE__ */ (0, import_jsx_runtime328.jsxs)("div", { className: "skeleton", onClick: handleOpenFileDialog, children: [
|
|
9282
|
+
/* @__PURE__ */ (0, import_jsx_runtime328.jsx)("div", { className: "icon-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime328.jsx)(ImageIcon_default, {}) }),
|
|
9283
|
+
/* @__PURE__ */ (0, import_jsx_runtime328.jsx)("div", { className: "label", children: label || "\uC774\uBBF8\uC9C0 \uCD94\uAC00\uD558\uAE30" })
|
|
8576
9284
|
] }) })
|
|
8577
9285
|
] });
|
|
8578
9286
|
};
|
|
@@ -8580,7 +9288,7 @@ ImageSelector.displayName = "ImageSelector";
|
|
|
8580
9288
|
var ImageSelector_default = ImageSelector;
|
|
8581
9289
|
|
|
8582
9290
|
// src/components/Pagination/Pagination.tsx
|
|
8583
|
-
var
|
|
9291
|
+
var import_jsx_runtime329 = require("react/jsx-runtime");
|
|
8584
9292
|
var getPageRange = (current, totalPages, siblingCount) => {
|
|
8585
9293
|
const totalNumbers = siblingCount * 2 + 5;
|
|
8586
9294
|
if (totalPages <= totalNumbers) {
|
|
@@ -8623,19 +9331,19 @@ var Pagination = (props) => {
|
|
|
8623
9331
|
onChange?.(page);
|
|
8624
9332
|
}
|
|
8625
9333
|
};
|
|
8626
|
-
return /* @__PURE__ */ (0,
|
|
8627
|
-
/* @__PURE__ */ (0,
|
|
9334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime329.jsxs)("nav", { className: clsx_default("lib-xplat-pagination", size, type), "aria-label": "\uD398\uC774\uC9C0 \uB124\uBE44\uAC8C\uC774\uC158", children: [
|
|
9335
|
+
/* @__PURE__ */ (0, import_jsx_runtime329.jsx)(
|
|
8628
9336
|
"button",
|
|
8629
9337
|
{
|
|
8630
9338
|
className: "page-btn prev",
|
|
8631
9339
|
disabled: current <= 1,
|
|
8632
9340
|
onClick: () => handleClick(current - 1),
|
|
8633
9341
|
"aria-label": "\uC774\uC804 \uD398\uC774\uC9C0",
|
|
8634
|
-
children: /* @__PURE__ */ (0,
|
|
9342
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime329.jsx)(ChevronLeftIcon_default, {})
|
|
8635
9343
|
}
|
|
8636
9344
|
),
|
|
8637
9345
|
pages.map(
|
|
8638
|
-
(page, i) => page === "..." ? /* @__PURE__ */ (0,
|
|
9346
|
+
(page, i) => page === "..." ? /* @__PURE__ */ (0, import_jsx_runtime329.jsx)("span", { className: "dots", children: "..." }, `dots-${i}`) : /* @__PURE__ */ (0, import_jsx_runtime329.jsx)(
|
|
8639
9347
|
"button",
|
|
8640
9348
|
{
|
|
8641
9349
|
className: clsx_default("page-btn", { active: page === current }),
|
|
@@ -8646,14 +9354,14 @@ var Pagination = (props) => {
|
|
|
8646
9354
|
page
|
|
8647
9355
|
)
|
|
8648
9356
|
),
|
|
8649
|
-
/* @__PURE__ */ (0,
|
|
9357
|
+
/* @__PURE__ */ (0, import_jsx_runtime329.jsx)(
|
|
8650
9358
|
"button",
|
|
8651
9359
|
{
|
|
8652
9360
|
className: "page-btn next",
|
|
8653
9361
|
disabled: current >= totalPages,
|
|
8654
9362
|
onClick: () => handleClick(current + 1),
|
|
8655
9363
|
"aria-label": "\uB2E4\uC74C \uD398\uC774\uC9C0",
|
|
8656
|
-
children: /* @__PURE__ */ (0,
|
|
9364
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime329.jsx)(ChevronRightIcon_default, {})
|
|
8657
9365
|
}
|
|
8658
9366
|
)
|
|
8659
9367
|
] });
|
|
@@ -8662,17 +9370,17 @@ Pagination.displayName = "Pagination";
|
|
|
8662
9370
|
var Pagination_default = Pagination;
|
|
8663
9371
|
|
|
8664
9372
|
// src/components/PopOver/PopOver.tsx
|
|
8665
|
-
var
|
|
8666
|
-
var
|
|
9373
|
+
var import_react27 = __toESM(require("react"), 1);
|
|
9374
|
+
var import_jsx_runtime330 = require("react/jsx-runtime");
|
|
8667
9375
|
var PopOver = (props) => {
|
|
8668
9376
|
const { children, isOpen, onClose, PopOverEl } = props;
|
|
8669
|
-
const popRef =
|
|
8670
|
-
const triggerRef =
|
|
8671
|
-
const [localOpen, setLocalOpen] =
|
|
8672
|
-
const [eventTrigger, setEventTrigger] =
|
|
9377
|
+
const popRef = import_react27.default.useRef(null);
|
|
9378
|
+
const triggerRef = import_react27.default.useRef(null);
|
|
9379
|
+
const [localOpen, setLocalOpen] = import_react27.default.useState(false);
|
|
9380
|
+
const [eventTrigger, setEventTrigger] = import_react27.default.useState(false);
|
|
8673
9381
|
useClickOutside_default([popRef, triggerRef], onClose, isOpen);
|
|
8674
9382
|
const position = useAutoPosition_default(triggerRef, popRef, localOpen);
|
|
8675
|
-
|
|
9383
|
+
import_react27.default.useEffect(() => {
|
|
8676
9384
|
if (isOpen) {
|
|
8677
9385
|
setLocalOpen(isOpen);
|
|
8678
9386
|
setTimeout(() => {
|
|
@@ -8685,7 +9393,7 @@ var PopOver = (props) => {
|
|
|
8685
9393
|
}, 200);
|
|
8686
9394
|
}
|
|
8687
9395
|
}, [isOpen]);
|
|
8688
|
-
return /* @__PURE__ */ (0,
|
|
9396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime330.jsxs)(
|
|
8689
9397
|
"div",
|
|
8690
9398
|
{
|
|
8691
9399
|
className: "lib-xplat-pop-over",
|
|
@@ -8695,7 +9403,7 @@ var PopOver = (props) => {
|
|
|
8695
9403
|
},
|
|
8696
9404
|
children: [
|
|
8697
9405
|
children,
|
|
8698
|
-
localOpen && /* @__PURE__ */ (0,
|
|
9406
|
+
localOpen && /* @__PURE__ */ (0, import_jsx_runtime330.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime330.jsx)(
|
|
8699
9407
|
"div",
|
|
8700
9408
|
{
|
|
8701
9409
|
className: clsx_default(
|
|
@@ -8718,7 +9426,7 @@ PopOver.displayName = "PopOver";
|
|
|
8718
9426
|
var PopOver_default = PopOver;
|
|
8719
9427
|
|
|
8720
9428
|
// src/components/Progress/Progress.tsx
|
|
8721
|
-
var
|
|
9429
|
+
var import_jsx_runtime331 = require("react/jsx-runtime");
|
|
8722
9430
|
var Progress = (props) => {
|
|
8723
9431
|
const {
|
|
8724
9432
|
value,
|
|
@@ -8728,8 +9436,8 @@ var Progress = (props) => {
|
|
|
8728
9436
|
showLabel = false
|
|
8729
9437
|
} = props;
|
|
8730
9438
|
const percentage = Math.min(100, Math.max(0, value / max * 100));
|
|
8731
|
-
return /* @__PURE__ */ (0,
|
|
8732
|
-
/* @__PURE__ */ (0,
|
|
9439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime331.jsxs)("div", { className: clsx_default("lib-xplat-progress", size, type), children: [
|
|
9440
|
+
/* @__PURE__ */ (0, import_jsx_runtime331.jsx)(
|
|
8733
9441
|
"div",
|
|
8734
9442
|
{
|
|
8735
9443
|
className: "track",
|
|
@@ -8737,7 +9445,7 @@ var Progress = (props) => {
|
|
|
8737
9445
|
"aria-valuenow": value,
|
|
8738
9446
|
"aria-valuemin": 0,
|
|
8739
9447
|
"aria-valuemax": max,
|
|
8740
|
-
children: /* @__PURE__ */ (0,
|
|
9448
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime331.jsx)(
|
|
8741
9449
|
"div",
|
|
8742
9450
|
{
|
|
8743
9451
|
className: "bar",
|
|
@@ -8746,7 +9454,7 @@ var Progress = (props) => {
|
|
|
8746
9454
|
)
|
|
8747
9455
|
}
|
|
8748
9456
|
),
|
|
8749
|
-
showLabel && /* @__PURE__ */ (0,
|
|
9457
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime331.jsxs)("span", { className: "label", children: [
|
|
8750
9458
|
Math.round(percentage),
|
|
8751
9459
|
"%"
|
|
8752
9460
|
] })
|
|
@@ -8756,17 +9464,17 @@ Progress.displayName = "Progress";
|
|
|
8756
9464
|
var Progress_default = Progress;
|
|
8757
9465
|
|
|
8758
9466
|
// src/components/Radio/RadioGroupContext.tsx
|
|
8759
|
-
var
|
|
8760
|
-
var RadioGroupContext =
|
|
9467
|
+
var import_react28 = __toESM(require("react"), 1);
|
|
9468
|
+
var RadioGroupContext = import_react28.default.createContext(
|
|
8761
9469
|
null
|
|
8762
9470
|
);
|
|
8763
9471
|
var useRadioGroupContext = () => {
|
|
8764
|
-
return
|
|
9472
|
+
return import_react28.default.useContext(RadioGroupContext);
|
|
8765
9473
|
};
|
|
8766
9474
|
var RadioGroupContext_default = RadioGroupContext;
|
|
8767
9475
|
|
|
8768
9476
|
// src/components/Radio/Radio.tsx
|
|
8769
|
-
var
|
|
9477
|
+
var import_jsx_runtime332 = require("react/jsx-runtime");
|
|
8770
9478
|
var Radio = (props) => {
|
|
8771
9479
|
const {
|
|
8772
9480
|
label,
|
|
@@ -8784,7 +9492,7 @@ var Radio = (props) => {
|
|
|
8784
9492
|
value,
|
|
8785
9493
|
onChange: rest.onChange
|
|
8786
9494
|
};
|
|
8787
|
-
return /* @__PURE__ */ (0,
|
|
9495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime332.jsxs)(
|
|
8788
9496
|
"label",
|
|
8789
9497
|
{
|
|
8790
9498
|
className: clsx_default(
|
|
@@ -8794,18 +9502,18 @@ var Radio = (props) => {
|
|
|
8794
9502
|
localChecked ? "checked" : void 0
|
|
8795
9503
|
),
|
|
8796
9504
|
children: [
|
|
8797
|
-
/* @__PURE__ */ (0,
|
|
8798
|
-
/* @__PURE__ */ (0,
|
|
9505
|
+
/* @__PURE__ */ (0, import_jsx_runtime332.jsx)("input", { ...rest, ...inputProps, checked: localChecked, type: "radio" }),
|
|
9506
|
+
/* @__PURE__ */ (0, import_jsx_runtime332.jsx)(
|
|
8799
9507
|
"div",
|
|
8800
9508
|
{
|
|
8801
9509
|
className: clsx_default(
|
|
8802
9510
|
"circle",
|
|
8803
9511
|
localChecked ? "checked" : void 0
|
|
8804
9512
|
),
|
|
8805
|
-
children: localChecked && /* @__PURE__ */ (0,
|
|
9513
|
+
children: localChecked && /* @__PURE__ */ (0, import_jsx_runtime332.jsx)("div", { className: "inner-circle" })
|
|
8806
9514
|
}
|
|
8807
9515
|
),
|
|
8808
|
-
label && /* @__PURE__ */ (0,
|
|
9516
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime332.jsx)("span", { children: label })
|
|
8809
9517
|
]
|
|
8810
9518
|
}
|
|
8811
9519
|
);
|
|
@@ -8814,28 +9522,28 @@ Radio.displayName = "Radio";
|
|
|
8814
9522
|
var Radio_default = Radio;
|
|
8815
9523
|
|
|
8816
9524
|
// src/components/Radio/RadioGroup.tsx
|
|
8817
|
-
var
|
|
9525
|
+
var import_jsx_runtime333 = require("react/jsx-runtime");
|
|
8818
9526
|
var RadioGroup = (props) => {
|
|
8819
9527
|
const { children, ...rest } = props;
|
|
8820
|
-
return /* @__PURE__ */ (0,
|
|
9528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime333.jsx)(import_jsx_runtime333.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime333.jsx)(RadioGroupContext_default.Provider, { value: rest, children }) });
|
|
8821
9529
|
};
|
|
8822
9530
|
RadioGroup.displayName = "RadioGroup";
|
|
8823
9531
|
var RadioGroup_default = RadioGroup;
|
|
8824
9532
|
|
|
8825
9533
|
// src/components/Select/Select.tsx
|
|
8826
|
-
var
|
|
9534
|
+
var import_react31 = __toESM(require("react"), 1);
|
|
8827
9535
|
|
|
8828
9536
|
// src/components/Select/context.ts
|
|
8829
|
-
var
|
|
8830
|
-
var SelectContext =
|
|
9537
|
+
var import_react29 = __toESM(require("react"), 1);
|
|
9538
|
+
var SelectContext = import_react29.default.createContext(null);
|
|
8831
9539
|
var context_default = SelectContext;
|
|
8832
9540
|
|
|
8833
9541
|
// src/components/Select/SelectItem.tsx
|
|
8834
|
-
var
|
|
8835
|
-
var
|
|
9542
|
+
var import_react30 = __toESM(require("react"), 1);
|
|
9543
|
+
var import_jsx_runtime334 = require("react/jsx-runtime");
|
|
8836
9544
|
var SelectItem = (props) => {
|
|
8837
9545
|
const { children, value, onClick, disabled = false } = props;
|
|
8838
|
-
const ctx =
|
|
9546
|
+
const ctx = import_react30.default.useContext(context_default);
|
|
8839
9547
|
const handleClick = (e) => {
|
|
8840
9548
|
e.preventDefault();
|
|
8841
9549
|
e.stopPropagation();
|
|
@@ -8844,7 +9552,7 @@ var SelectItem = (props) => {
|
|
|
8844
9552
|
ctx?.close();
|
|
8845
9553
|
onClick?.();
|
|
8846
9554
|
};
|
|
8847
|
-
return /* @__PURE__ */ (0,
|
|
9555
|
+
return /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(
|
|
8848
9556
|
"div",
|
|
8849
9557
|
{
|
|
8850
9558
|
className: clsx_default("select-item", disabled && "disabled"),
|
|
@@ -8865,7 +9573,7 @@ SelectItem.displayName = "Select.Item";
|
|
|
8865
9573
|
var SelectItem_default = SelectItem;
|
|
8866
9574
|
|
|
8867
9575
|
// src/components/Select/Select.tsx
|
|
8868
|
-
var
|
|
9576
|
+
var import_jsx_runtime335 = require("react/jsx-runtime");
|
|
8869
9577
|
var ANIMATION_DURATION_MS3 = 200;
|
|
8870
9578
|
var SelectRoot = (props) => {
|
|
8871
9579
|
const {
|
|
@@ -8877,26 +9585,26 @@ var SelectRoot = (props) => {
|
|
|
8877
9585
|
error = false,
|
|
8878
9586
|
size = "md"
|
|
8879
9587
|
} = props;
|
|
8880
|
-
const itemChildren =
|
|
8881
|
-
(child) =>
|
|
9588
|
+
const itemChildren = import_react31.default.Children.toArray(children).filter(
|
|
9589
|
+
(child) => import_react31.default.isValidElement(child) && child.type === SelectItem_default
|
|
8882
9590
|
);
|
|
8883
9591
|
const isControlled = valueProp !== void 0;
|
|
8884
|
-
const [isOpen, setOpen] =
|
|
8885
|
-
const [uncontrolledLabel, setUncontrolledLabel] =
|
|
8886
|
-
const controlledLabel =
|
|
9592
|
+
const [isOpen, setOpen] = import_react31.default.useState(false);
|
|
9593
|
+
const [uncontrolledLabel, setUncontrolledLabel] = import_react31.default.useState(null);
|
|
9594
|
+
const controlledLabel = import_react31.default.useMemo(() => {
|
|
8887
9595
|
if (!isControlled) return null;
|
|
8888
9596
|
const match = itemChildren.find((child) => child.props.value === valueProp);
|
|
8889
9597
|
return match ? match.props.children : null;
|
|
8890
9598
|
}, [isControlled, valueProp, itemChildren]);
|
|
8891
9599
|
const selectedLabel = isControlled ? controlledLabel : uncontrolledLabel;
|
|
8892
|
-
const triggerRef =
|
|
8893
|
-
const contentRef =
|
|
8894
|
-
const [mounted, setMounted] =
|
|
8895
|
-
const [visible, setVisible] =
|
|
8896
|
-
|
|
9600
|
+
const triggerRef = import_react31.default.useRef(null);
|
|
9601
|
+
const contentRef = import_react31.default.useRef(null);
|
|
9602
|
+
const [mounted, setMounted] = import_react31.default.useState(false);
|
|
9603
|
+
const [visible, setVisible] = import_react31.default.useState(false);
|
|
9604
|
+
import_react31.default.useEffect(() => {
|
|
8897
9605
|
if (disabled && isOpen) setOpen(false);
|
|
8898
9606
|
}, [disabled, isOpen]);
|
|
8899
|
-
|
|
9607
|
+
import_react31.default.useEffect(() => {
|
|
8900
9608
|
if (isOpen) {
|
|
8901
9609
|
setMounted(true);
|
|
8902
9610
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -8906,12 +9614,12 @@ var SelectRoot = (props) => {
|
|
|
8906
9614
|
const t = setTimeout(() => setMounted(false), ANIMATION_DURATION_MS3);
|
|
8907
9615
|
return () => clearTimeout(t);
|
|
8908
9616
|
}, [isOpen]);
|
|
8909
|
-
const open =
|
|
8910
|
-
const close =
|
|
8911
|
-
const toggle =
|
|
9617
|
+
const open = import_react31.default.useCallback(() => setOpen(true), []);
|
|
9618
|
+
const close = import_react31.default.useCallback(() => setOpen(false), []);
|
|
9619
|
+
const toggle = import_react31.default.useCallback(() => setOpen((prev) => !prev), []);
|
|
8912
9620
|
useClickOutside_default([contentRef, triggerRef], close, isOpen);
|
|
8913
9621
|
const position = useAutoPosition_default(triggerRef, contentRef, mounted);
|
|
8914
|
-
const setSelected =
|
|
9622
|
+
const setSelected = import_react31.default.useCallback(
|
|
8915
9623
|
(label, itemValue) => {
|
|
8916
9624
|
if (!isControlled) {
|
|
8917
9625
|
setUncontrolledLabel(label);
|
|
@@ -8920,7 +9628,7 @@ var SelectRoot = (props) => {
|
|
|
8920
9628
|
},
|
|
8921
9629
|
[isControlled, onChange]
|
|
8922
9630
|
);
|
|
8923
|
-
const ctxValue =
|
|
9631
|
+
const ctxValue = import_react31.default.useMemo(
|
|
8924
9632
|
() => ({
|
|
8925
9633
|
isOpen,
|
|
8926
9634
|
mounted,
|
|
@@ -8941,7 +9649,7 @@ var SelectRoot = (props) => {
|
|
|
8941
9649
|
if (disabled) return;
|
|
8942
9650
|
toggle();
|
|
8943
9651
|
};
|
|
8944
|
-
return /* @__PURE__ */ (0,
|
|
9652
|
+
return /* @__PURE__ */ (0, import_jsx_runtime335.jsx)(context_default.Provider, { value: ctxValue, children: /* @__PURE__ */ (0, import_jsx_runtime335.jsxs)(
|
|
8945
9653
|
"div",
|
|
8946
9654
|
{
|
|
8947
9655
|
className: clsx_default(
|
|
@@ -8952,7 +9660,7 @@ var SelectRoot = (props) => {
|
|
|
8952
9660
|
mounted && "is-open"
|
|
8953
9661
|
),
|
|
8954
9662
|
children: [
|
|
8955
|
-
/* @__PURE__ */ (0,
|
|
9663
|
+
/* @__PURE__ */ (0, import_jsx_runtime335.jsxs)(
|
|
8956
9664
|
"div",
|
|
8957
9665
|
{
|
|
8958
9666
|
ref: triggerRef,
|
|
@@ -8976,7 +9684,7 @@ var SelectRoot = (props) => {
|
|
|
8976
9684
|
}
|
|
8977
9685
|
},
|
|
8978
9686
|
children: [
|
|
8979
|
-
/* @__PURE__ */ (0,
|
|
9687
|
+
/* @__PURE__ */ (0, import_jsx_runtime335.jsx)(
|
|
8980
9688
|
"span",
|
|
8981
9689
|
{
|
|
8982
9690
|
className: clsx_default(
|
|
@@ -8986,25 +9694,25 @@ var SelectRoot = (props) => {
|
|
|
8986
9694
|
children: selectedLabel ?? placeholder
|
|
8987
9695
|
}
|
|
8988
9696
|
),
|
|
8989
|
-
/* @__PURE__ */ (0,
|
|
9697
|
+
/* @__PURE__ */ (0, import_jsx_runtime335.jsx)(
|
|
8990
9698
|
"span",
|
|
8991
9699
|
{
|
|
8992
9700
|
className: clsx_default("select-trigger-icon", isOpen && "open"),
|
|
8993
9701
|
"aria-hidden": true,
|
|
8994
|
-
children: /* @__PURE__ */ (0,
|
|
9702
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime335.jsx)(ChevronDownIcon_default, {})
|
|
8995
9703
|
}
|
|
8996
9704
|
)
|
|
8997
9705
|
]
|
|
8998
9706
|
}
|
|
8999
9707
|
),
|
|
9000
|
-
mounted && /* @__PURE__ */ (0,
|
|
9708
|
+
mounted && /* @__PURE__ */ (0, import_jsx_runtime335.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime335.jsx)(
|
|
9001
9709
|
"div",
|
|
9002
9710
|
{
|
|
9003
9711
|
className: clsx_default("lib-xplat-select-content", position.direction, stateClass),
|
|
9004
9712
|
ref: contentRef,
|
|
9005
9713
|
style: { ...position.position, width: triggerRef.current?.offsetWidth },
|
|
9006
9714
|
role: "listbox",
|
|
9007
|
-
children: /* @__PURE__ */ (0,
|
|
9715
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime335.jsx)(context_default.Provider, { value: ctxValue, children: itemChildren })
|
|
9008
9716
|
}
|
|
9009
9717
|
) })
|
|
9010
9718
|
]
|
|
@@ -9018,7 +9726,7 @@ var Select = Object.assign(SelectRoot, {
|
|
|
9018
9726
|
var Select_default = Select;
|
|
9019
9727
|
|
|
9020
9728
|
// src/components/Skeleton/Skeleton.tsx
|
|
9021
|
-
var
|
|
9729
|
+
var import_jsx_runtime336 = require("react/jsx-runtime");
|
|
9022
9730
|
var SIZE_MAP = {
|
|
9023
9731
|
xs: "var(--spacing-size-1)",
|
|
9024
9732
|
sm: "var(--spacing-size-2)",
|
|
@@ -9034,7 +9742,7 @@ var Skeleton = (props) => {
|
|
|
9034
9742
|
...width != null && { width: SIZE_MAP[width] },
|
|
9035
9743
|
...height != null && { height: SIZE_MAP[height] }
|
|
9036
9744
|
};
|
|
9037
|
-
return /* @__PURE__ */ (0,
|
|
9745
|
+
return /* @__PURE__ */ (0, import_jsx_runtime336.jsx)(
|
|
9038
9746
|
"div",
|
|
9039
9747
|
{
|
|
9040
9748
|
className: clsx_default("lib-xplat-skeleton", variant),
|
|
@@ -9047,20 +9755,20 @@ Skeleton.displayName = "Skeleton";
|
|
|
9047
9755
|
var Skeleton_default = Skeleton;
|
|
9048
9756
|
|
|
9049
9757
|
// src/components/Spinner/Spinner.tsx
|
|
9050
|
-
var
|
|
9758
|
+
var import_jsx_runtime337 = require("react/jsx-runtime");
|
|
9051
9759
|
var Spinner = (props) => {
|
|
9052
9760
|
const {
|
|
9053
9761
|
size = "md",
|
|
9054
9762
|
type = "brand"
|
|
9055
9763
|
} = props;
|
|
9056
|
-
return /* @__PURE__ */ (0,
|
|
9764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime337.jsx)(
|
|
9057
9765
|
"div",
|
|
9058
9766
|
{
|
|
9059
9767
|
className: clsx_default("lib-xplat-spinner", size, type),
|
|
9060
9768
|
role: "status",
|
|
9061
9769
|
"aria-label": "\uB85C\uB529 \uC911",
|
|
9062
|
-
children: /* @__PURE__ */ (0,
|
|
9063
|
-
/* @__PURE__ */ (0,
|
|
9770
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime337.jsxs)("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
9771
|
+
/* @__PURE__ */ (0, import_jsx_runtime337.jsx)(
|
|
9064
9772
|
"circle",
|
|
9065
9773
|
{
|
|
9066
9774
|
className: "track",
|
|
@@ -9070,7 +9778,7 @@ var Spinner = (props) => {
|
|
|
9070
9778
|
strokeWidth: "3"
|
|
9071
9779
|
}
|
|
9072
9780
|
),
|
|
9073
|
-
/* @__PURE__ */ (0,
|
|
9781
|
+
/* @__PURE__ */ (0, import_jsx_runtime337.jsx)(
|
|
9074
9782
|
"circle",
|
|
9075
9783
|
{
|
|
9076
9784
|
className: "indicator",
|
|
@@ -9089,20 +9797,20 @@ Spinner.displayName = "Spinner";
|
|
|
9089
9797
|
var Spinner_default = Spinner;
|
|
9090
9798
|
|
|
9091
9799
|
// src/components/Steps/Steps.tsx
|
|
9092
|
-
var
|
|
9800
|
+
var import_jsx_runtime338 = require("react/jsx-runtime");
|
|
9093
9801
|
var Steps = (props) => {
|
|
9094
9802
|
const {
|
|
9095
9803
|
items,
|
|
9096
9804
|
current,
|
|
9097
9805
|
type = "brand"
|
|
9098
9806
|
} = props;
|
|
9099
|
-
return /* @__PURE__ */ (0,
|
|
9807
|
+
return /* @__PURE__ */ (0, import_jsx_runtime338.jsx)("div", { className: clsx_default("lib-xplat-steps", type), children: items.map((item, index) => {
|
|
9100
9808
|
const status = index < current ? "completed" : index === current ? "active" : "pending";
|
|
9101
|
-
return /* @__PURE__ */ (0,
|
|
9102
|
-
/* @__PURE__ */ (0,
|
|
9103
|
-
/* @__PURE__ */ (0,
|
|
9104
|
-
/* @__PURE__ */ (0,
|
|
9105
|
-
item.description && /* @__PURE__ */ (0,
|
|
9809
|
+
return /* @__PURE__ */ (0, import_jsx_runtime338.jsxs)("div", { className: clsx_default("step-item", status), children: [
|
|
9810
|
+
/* @__PURE__ */ (0, import_jsx_runtime338.jsx)("div", { className: "step-circle", children: status === "completed" ? /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(CheckIcon_default, {}) : /* @__PURE__ */ (0, import_jsx_runtime338.jsx)("span", { children: index + 1 }) }),
|
|
9811
|
+
/* @__PURE__ */ (0, import_jsx_runtime338.jsxs)("div", { className: "step-content", children: [
|
|
9812
|
+
/* @__PURE__ */ (0, import_jsx_runtime338.jsx)("span", { className: "step-title", children: item.title }),
|
|
9813
|
+
item.description && /* @__PURE__ */ (0, import_jsx_runtime338.jsx)("span", { className: "step-description", children: item.description })
|
|
9106
9814
|
] })
|
|
9107
9815
|
] }, index);
|
|
9108
9816
|
}) });
|
|
@@ -9111,8 +9819,8 @@ Steps.displayName = "Steps";
|
|
|
9111
9819
|
var Steps_default = Steps;
|
|
9112
9820
|
|
|
9113
9821
|
// src/components/Swiper/Swiper.tsx
|
|
9114
|
-
var
|
|
9115
|
-
var
|
|
9822
|
+
var import_react32 = __toESM(require("react"), 1);
|
|
9823
|
+
var import_jsx_runtime339 = require("react/jsx-runtime");
|
|
9116
9824
|
var Swiper = (props) => {
|
|
9117
9825
|
const {
|
|
9118
9826
|
auto = false,
|
|
@@ -9136,25 +9844,25 @@ var Swiper = (props) => {
|
|
|
9136
9844
|
const maxIndex = Math.max(0, totalSlides - viewItemCount);
|
|
9137
9845
|
const useLoop = loop && canSlide;
|
|
9138
9846
|
const cloneCount = useLoop ? totalSlides : 0;
|
|
9139
|
-
const extendedItems =
|
|
9847
|
+
const extendedItems = import_react32.default.useMemo(() => {
|
|
9140
9848
|
if (!useLoop) return items;
|
|
9141
9849
|
return [...items, ...items, ...items];
|
|
9142
9850
|
}, [items, useLoop]);
|
|
9143
9851
|
const initialIdx = Math.max(0, Math.min(indexProp ?? 0, maxIndex));
|
|
9144
|
-
const [innerIndex, setInnerIndex] =
|
|
9852
|
+
const [innerIndex, setInnerIndex] = import_react32.default.useState(
|
|
9145
9853
|
useLoop ? cloneCount + initialIdx : initialIdx
|
|
9146
9854
|
);
|
|
9147
|
-
const [isDragging, setIsDragging] =
|
|
9148
|
-
const [dragOffset, setDragOffset] =
|
|
9149
|
-
const [animated, setAnimated] =
|
|
9150
|
-
const [containerWidth, setContainerWidth] =
|
|
9151
|
-
const containerRef =
|
|
9152
|
-
const startXRef =
|
|
9153
|
-
const startTimeRef =
|
|
9154
|
-
const autoplayTimerRef =
|
|
9155
|
-
const resumeTimeoutRef =
|
|
9156
|
-
const [paused, setPaused] =
|
|
9157
|
-
|
|
9855
|
+
const [isDragging, setIsDragging] = import_react32.default.useState(false);
|
|
9856
|
+
const [dragOffset, setDragOffset] = import_react32.default.useState(0);
|
|
9857
|
+
const [animated, setAnimated] = import_react32.default.useState(true);
|
|
9858
|
+
const [containerWidth, setContainerWidth] = import_react32.default.useState(0);
|
|
9859
|
+
const containerRef = import_react32.default.useRef(null);
|
|
9860
|
+
const startXRef = import_react32.default.useRef(0);
|
|
9861
|
+
const startTimeRef = import_react32.default.useRef(0);
|
|
9862
|
+
const autoplayTimerRef = import_react32.default.useRef(null);
|
|
9863
|
+
const resumeTimeoutRef = import_react32.default.useRef(null);
|
|
9864
|
+
const [paused, setPaused] = import_react32.default.useState(false);
|
|
9865
|
+
import_react32.default.useEffect(() => {
|
|
9158
9866
|
const el = containerRef.current;
|
|
9159
9867
|
if (!el) return;
|
|
9160
9868
|
const ro = new ResizeObserver((entries) => {
|
|
@@ -9173,7 +9881,7 @@ var Swiper = (props) => {
|
|
|
9173
9881
|
return ((inner - cloneCount) % totalSlides + totalSlides) % totalSlides;
|
|
9174
9882
|
};
|
|
9175
9883
|
const realIndex = getRealIndex(innerIndex);
|
|
9176
|
-
const moveToInner =
|
|
9884
|
+
const moveToInner = import_react32.default.useCallback(
|
|
9177
9885
|
(idx, withAnim = true) => {
|
|
9178
9886
|
if (!useLoop) {
|
|
9179
9887
|
setAnimated(withAnim);
|
|
@@ -9201,7 +9909,7 @@ var Swiper = (props) => {
|
|
|
9201
9909
|
},
|
|
9202
9910
|
[useLoop, cloneCount, totalSlides]
|
|
9203
9911
|
);
|
|
9204
|
-
const handleTransitionEnd =
|
|
9912
|
+
const handleTransitionEnd = import_react32.default.useCallback(() => {
|
|
9205
9913
|
if (!useLoop) return;
|
|
9206
9914
|
const real = getRealIndex(innerIndex);
|
|
9207
9915
|
const canonical = cloneCount + real;
|
|
@@ -9211,7 +9919,7 @@ var Swiper = (props) => {
|
|
|
9211
9919
|
}
|
|
9212
9920
|
onChange?.(Math.min(real, maxIndex));
|
|
9213
9921
|
}, [useLoop, innerIndex, cloneCount, totalSlides, maxIndex, onChange]);
|
|
9214
|
-
const slideTo =
|
|
9922
|
+
const slideTo = import_react32.default.useCallback(
|
|
9215
9923
|
(logicalIndex) => {
|
|
9216
9924
|
if (!canSlide) return;
|
|
9217
9925
|
const clamped = useLoop ? logicalIndex : Math.max(0, Math.min(logicalIndex, maxIndex));
|
|
@@ -9221,7 +9929,7 @@ var Swiper = (props) => {
|
|
|
9221
9929
|
},
|
|
9222
9930
|
[canSlide, useLoop, cloneCount, maxIndex, onChange, moveToInner]
|
|
9223
9931
|
);
|
|
9224
|
-
const slideNext =
|
|
9932
|
+
const slideNext = import_react32.default.useCallback(() => {
|
|
9225
9933
|
if (!canSlide) return;
|
|
9226
9934
|
const nextInner = innerIndex + slideBy;
|
|
9227
9935
|
if (useLoop) {
|
|
@@ -9230,7 +9938,7 @@ var Swiper = (props) => {
|
|
|
9230
9938
|
moveToInner(Math.min(nextInner, maxIndex), true);
|
|
9231
9939
|
}
|
|
9232
9940
|
}, [canSlide, useLoop, innerIndex, slideBy, maxIndex, moveToInner]);
|
|
9233
|
-
const slidePrev =
|
|
9941
|
+
const slidePrev = import_react32.default.useCallback(() => {
|
|
9234
9942
|
if (!canSlide) return;
|
|
9235
9943
|
const prevInner = innerIndex - slideBy;
|
|
9236
9944
|
if (useLoop) {
|
|
@@ -9239,7 +9947,7 @@ var Swiper = (props) => {
|
|
|
9239
9947
|
moveToInner(Math.max(prevInner, 0), true);
|
|
9240
9948
|
}
|
|
9241
9949
|
}, [canSlide, useLoop, innerIndex, slideBy, moveToInner]);
|
|
9242
|
-
|
|
9950
|
+
import_react32.default.useEffect(() => {
|
|
9243
9951
|
if (indexProp === void 0) return;
|
|
9244
9952
|
const clamped = Math.max(0, Math.min(indexProp, maxIndex));
|
|
9245
9953
|
const target = useLoop ? cloneCount + clamped : clamped;
|
|
@@ -9247,12 +9955,12 @@ var Swiper = (props) => {
|
|
|
9247
9955
|
moveToInner(target, true);
|
|
9248
9956
|
}
|
|
9249
9957
|
}, [indexProp]);
|
|
9250
|
-
|
|
9958
|
+
import_react32.default.useImperativeHandle(swiperRef, () => ({
|
|
9251
9959
|
slidePrev,
|
|
9252
9960
|
slideNext,
|
|
9253
9961
|
slideTo
|
|
9254
9962
|
}));
|
|
9255
|
-
|
|
9963
|
+
import_react32.default.useEffect(() => {
|
|
9256
9964
|
if (!auto || !canSlide || paused) return;
|
|
9257
9965
|
autoplayTimerRef.current = setInterval(slideNext, autoplayDelay);
|
|
9258
9966
|
return () => {
|
|
@@ -9278,7 +9986,7 @@ var Swiper = (props) => {
|
|
|
9278
9986
|
resumeTimeoutRef.current = null;
|
|
9279
9987
|
}, pauseOnInteraction);
|
|
9280
9988
|
};
|
|
9281
|
-
|
|
9989
|
+
import_react32.default.useEffect(() => {
|
|
9282
9990
|
return () => {
|
|
9283
9991
|
if (resumeTimeoutRef.current) clearTimeout(resumeTimeoutRef.current);
|
|
9284
9992
|
};
|
|
@@ -9296,7 +10004,7 @@ var Swiper = (props) => {
|
|
|
9296
10004
|
startXRef.current = getClientX(e);
|
|
9297
10005
|
startTimeRef.current = Date.now();
|
|
9298
10006
|
};
|
|
9299
|
-
|
|
10007
|
+
import_react32.default.useEffect(() => {
|
|
9300
10008
|
if (!isDragging) return;
|
|
9301
10009
|
const handleMove = (e) => {
|
|
9302
10010
|
setDragOffset(getClientX(e) - startXRef.current);
|
|
@@ -9335,8 +10043,8 @@ var Swiper = (props) => {
|
|
|
9335
10043
|
}, [isDragging, dragOffset, innerIndex, useLoop, maxIndex, slideStep, moveToInner]);
|
|
9336
10044
|
const slideWidthPercent = 100 / viewItemCount;
|
|
9337
10045
|
const gapAdjust = spaceBetween * (viewItemCount - 1) / viewItemCount;
|
|
9338
|
-
const slideElements =
|
|
9339
|
-
() => extendedItems.map((item, idx) => /* @__PURE__ */ (0,
|
|
10046
|
+
const slideElements = import_react32.default.useMemo(
|
|
10047
|
+
() => extendedItems.map((item, idx) => /* @__PURE__ */ (0, import_jsx_runtime339.jsx)(
|
|
9340
10048
|
"div",
|
|
9341
10049
|
{
|
|
9342
10050
|
className: "lib-xplat-swiper__slide",
|
|
@@ -9355,14 +10063,14 @@ var Swiper = (props) => {
|
|
|
9355
10063
|
Math.floor(realIndex / slideBy),
|
|
9356
10064
|
totalSteps - 1
|
|
9357
10065
|
);
|
|
9358
|
-
return /* @__PURE__ */ (0,
|
|
9359
|
-
/* @__PURE__ */ (0,
|
|
10066
|
+
return /* @__PURE__ */ (0, import_jsx_runtime339.jsxs)("div", { className: "lib-xplat-swiper", ref: containerRef, children: [
|
|
10067
|
+
/* @__PURE__ */ (0, import_jsx_runtime339.jsx)(
|
|
9360
10068
|
"div",
|
|
9361
10069
|
{
|
|
9362
10070
|
className: "lib-xplat-swiper__viewport",
|
|
9363
10071
|
onMouseDown: handleDragStart,
|
|
9364
10072
|
onTouchStart: handleDragStart,
|
|
9365
|
-
children: /* @__PURE__ */ (0,
|
|
10073
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime339.jsx)(
|
|
9366
10074
|
"div",
|
|
9367
10075
|
{
|
|
9368
10076
|
className: clsx_default(
|
|
@@ -9380,7 +10088,7 @@ var Swiper = (props) => {
|
|
|
9380
10088
|
)
|
|
9381
10089
|
}
|
|
9382
10090
|
),
|
|
9383
|
-
showProgress && canSlide && /* @__PURE__ */ (0,
|
|
10091
|
+
showProgress && canSlide && /* @__PURE__ */ (0, import_jsx_runtime339.jsx)("div", { className: "lib-xplat-swiper__progress", children: /* @__PURE__ */ (0, import_jsx_runtime339.jsx)("div", { className: "lib-xplat-swiper__progress-track", children: /* @__PURE__ */ (0, import_jsx_runtime339.jsx)(
|
|
9384
10092
|
"span",
|
|
9385
10093
|
{
|
|
9386
10094
|
className: "lib-xplat-swiper__progress-fill",
|
|
@@ -9390,7 +10098,7 @@ var Swiper = (props) => {
|
|
|
9390
10098
|
}
|
|
9391
10099
|
}
|
|
9392
10100
|
) }) }),
|
|
9393
|
-
canSlide && /* @__PURE__ */ (0,
|
|
10101
|
+
canSlide && /* @__PURE__ */ (0, import_jsx_runtime339.jsx)("div", { className: "lib-xplat-swiper__dots", children: Array.from({ length: totalSteps }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime339.jsx)(
|
|
9394
10102
|
"button",
|
|
9395
10103
|
{
|
|
9396
10104
|
className: clsx_default(
|
|
@@ -9408,8 +10116,8 @@ Swiper.displayName = "Swiper";
|
|
|
9408
10116
|
var Swiper_default = Swiper;
|
|
9409
10117
|
|
|
9410
10118
|
// src/components/Switch/Switch.tsx
|
|
9411
|
-
var
|
|
9412
|
-
var
|
|
10119
|
+
var import_react33 = __toESM(require("react"), 1);
|
|
10120
|
+
var import_jsx_runtime340 = require("react/jsx-runtime");
|
|
9413
10121
|
var KNOB_TRANSITION_MS = 250;
|
|
9414
10122
|
var Switch = (props) => {
|
|
9415
10123
|
const {
|
|
@@ -9419,9 +10127,9 @@ var Switch = (props) => {
|
|
|
9419
10127
|
disabled,
|
|
9420
10128
|
onChange
|
|
9421
10129
|
} = props;
|
|
9422
|
-
const [isAnimating, setIsAnimating] =
|
|
9423
|
-
const timeoutRef =
|
|
9424
|
-
|
|
10130
|
+
const [isAnimating, setIsAnimating] = import_react33.default.useState(false);
|
|
10131
|
+
const timeoutRef = import_react33.default.useRef(null);
|
|
10132
|
+
import_react33.default.useEffect(() => {
|
|
9425
10133
|
return () => {
|
|
9426
10134
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
9427
10135
|
};
|
|
@@ -9436,7 +10144,7 @@ var Switch = (props) => {
|
|
|
9436
10144
|
timeoutRef.current = null;
|
|
9437
10145
|
}, KNOB_TRANSITION_MS);
|
|
9438
10146
|
};
|
|
9439
|
-
return /* @__PURE__ */ (0,
|
|
10147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime340.jsx)(
|
|
9440
10148
|
"div",
|
|
9441
10149
|
{
|
|
9442
10150
|
className: clsx_default(
|
|
@@ -9449,7 +10157,7 @@ var Switch = (props) => {
|
|
|
9449
10157
|
),
|
|
9450
10158
|
onClick: handleClick,
|
|
9451
10159
|
"aria-disabled": disabled || isAnimating,
|
|
9452
|
-
children: /* @__PURE__ */ (0,
|
|
10160
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime340.jsx)("div", { className: clsx_default("knob", value ? "checked" : void 0) })
|
|
9453
10161
|
}
|
|
9454
10162
|
);
|
|
9455
10163
|
};
|
|
@@ -9457,17 +10165,17 @@ Switch.displayName = "Switch";
|
|
|
9457
10165
|
var Switch_default = Switch;
|
|
9458
10166
|
|
|
9459
10167
|
// src/components/Table/TableContext.tsx
|
|
9460
|
-
var
|
|
9461
|
-
var TableContext =
|
|
10168
|
+
var import_react34 = __toESM(require("react"), 1);
|
|
10169
|
+
var TableContext = import_react34.default.createContext(null);
|
|
9462
10170
|
var useTableContext = () => {
|
|
9463
|
-
const ctx =
|
|
10171
|
+
const ctx = import_react34.default.useContext(TableContext);
|
|
9464
10172
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
9465
10173
|
return ctx;
|
|
9466
10174
|
};
|
|
9467
10175
|
var TableContext_default = TableContext;
|
|
9468
10176
|
|
|
9469
10177
|
// src/components/Table/Table.tsx
|
|
9470
|
-
var
|
|
10178
|
+
var import_jsx_runtime341 = require("react/jsx-runtime");
|
|
9471
10179
|
var Table = (props) => {
|
|
9472
10180
|
const {
|
|
9473
10181
|
children,
|
|
@@ -9477,7 +10185,7 @@ var Table = (props) => {
|
|
|
9477
10185
|
headerSticky = false,
|
|
9478
10186
|
stickyShadow = true
|
|
9479
10187
|
} = props;
|
|
9480
|
-
return /* @__PURE__ */ (0,
|
|
10188
|
+
return /* @__PURE__ */ (0, import_jsx_runtime341.jsx)("div", { className: `lib-xplat-table-wrapper ${size}`, children: /* @__PURE__ */ (0, import_jsx_runtime341.jsx)(
|
|
9481
10189
|
TableContext_default.Provider,
|
|
9482
10190
|
{
|
|
9483
10191
|
value: {
|
|
@@ -9486,7 +10194,7 @@ var Table = (props) => {
|
|
|
9486
10194
|
headerSticky,
|
|
9487
10195
|
stickyShadow
|
|
9488
10196
|
},
|
|
9489
|
-
children: /* @__PURE__ */ (0,
|
|
10197
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime341.jsx)("table", { className: "lib-xplat-table", children })
|
|
9490
10198
|
}
|
|
9491
10199
|
) });
|
|
9492
10200
|
};
|
|
@@ -9494,41 +10202,41 @@ Table.displayName = "Table";
|
|
|
9494
10202
|
var Table_default = Table;
|
|
9495
10203
|
|
|
9496
10204
|
// src/components/Table/TableBody.tsx
|
|
9497
|
-
var
|
|
10205
|
+
var import_jsx_runtime342 = require("react/jsx-runtime");
|
|
9498
10206
|
var TableBody = (props) => {
|
|
9499
10207
|
const { children } = props;
|
|
9500
|
-
return /* @__PURE__ */ (0,
|
|
10208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime342.jsx)("tbody", { children });
|
|
9501
10209
|
};
|
|
9502
10210
|
TableBody.displayName = "TableBody";
|
|
9503
10211
|
var TableBody_default = TableBody;
|
|
9504
10212
|
|
|
9505
10213
|
// src/components/Table/TableCell.tsx
|
|
9506
|
-
var
|
|
10214
|
+
var import_react37 = __toESM(require("react"), 1);
|
|
9507
10215
|
|
|
9508
10216
|
// src/components/Table/TableHeadContext.tsx
|
|
9509
|
-
var
|
|
9510
|
-
var TableHeadContext =
|
|
10217
|
+
var import_react35 = __toESM(require("react"), 1);
|
|
10218
|
+
var TableHeadContext = import_react35.default.createContext(
|
|
9511
10219
|
null
|
|
9512
10220
|
);
|
|
9513
10221
|
var useTableHeadContext = () => {
|
|
9514
|
-
const ctx =
|
|
10222
|
+
const ctx = import_react35.default.useContext(TableHeadContext);
|
|
9515
10223
|
return ctx;
|
|
9516
10224
|
};
|
|
9517
10225
|
var TableHeadContext_default = TableHeadContext;
|
|
9518
10226
|
|
|
9519
10227
|
// src/components/Table/TableRowContext.tsx
|
|
9520
|
-
var
|
|
9521
|
-
var TableRowContext =
|
|
10228
|
+
var import_react36 = __toESM(require("react"), 1);
|
|
10229
|
+
var TableRowContext = import_react36.default.createContext(null);
|
|
9522
10230
|
var useTableRowContext = () => {
|
|
9523
|
-
const ctx =
|
|
10231
|
+
const ctx = import_react36.default.useContext(TableRowContext);
|
|
9524
10232
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
9525
10233
|
return ctx;
|
|
9526
10234
|
};
|
|
9527
10235
|
var TableRowContext_default = TableRowContext;
|
|
9528
10236
|
|
|
9529
10237
|
// src/components/Table/TableCell.tsx
|
|
9530
|
-
var
|
|
9531
|
-
var TableCell =
|
|
10238
|
+
var import_jsx_runtime343 = require("react/jsx-runtime");
|
|
10239
|
+
var TableCell = import_react37.default.memo((props) => {
|
|
9532
10240
|
const {
|
|
9533
10241
|
children,
|
|
9534
10242
|
align = "center",
|
|
@@ -9540,9 +10248,9 @@ var TableCell = import_react36.default.memo((props) => {
|
|
|
9540
10248
|
const { registerStickyCell, stickyCells } = useTableRowContext();
|
|
9541
10249
|
const { stickyShadow } = useTableContext();
|
|
9542
10250
|
const headContext = useTableHeadContext();
|
|
9543
|
-
const [left, setLeft] =
|
|
9544
|
-
const cellRef =
|
|
9545
|
-
const calculateLeft =
|
|
10251
|
+
const [left, setLeft] = import_react37.default.useState(0);
|
|
10252
|
+
const cellRef = import_react37.default.useRef(null);
|
|
10253
|
+
const calculateLeft = import_react37.default.useCallback(() => {
|
|
9546
10254
|
if (!cellRef.current) return 0;
|
|
9547
10255
|
let totalLeft = 0;
|
|
9548
10256
|
for (const ref of stickyCells) {
|
|
@@ -9551,7 +10259,7 @@ var TableCell = import_react36.default.memo((props) => {
|
|
|
9551
10259
|
}
|
|
9552
10260
|
return totalLeft;
|
|
9553
10261
|
}, [stickyCells]);
|
|
9554
|
-
|
|
10262
|
+
import_react37.default.useEffect(() => {
|
|
9555
10263
|
if (!isSticky || !cellRef.current) return;
|
|
9556
10264
|
registerStickyCell(cellRef);
|
|
9557
10265
|
setLeft(calculateLeft());
|
|
@@ -9569,7 +10277,7 @@ var TableCell = import_react36.default.memo((props) => {
|
|
|
9569
10277
|
const CellTag = cellRef.current?.tagName === "TH" ? "th" : "td";
|
|
9570
10278
|
const isLastSticky = isSticky && stickyCells[stickyCells.length - 1] === cellRef;
|
|
9571
10279
|
const enableHover = headContext && headContext.cellHover;
|
|
9572
|
-
return /* @__PURE__ */ (0,
|
|
10280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime343.jsx)(
|
|
9573
10281
|
CellTag,
|
|
9574
10282
|
{
|
|
9575
10283
|
ref: cellRef,
|
|
@@ -9594,21 +10302,21 @@ TableCell.displayName = "TableCell";
|
|
|
9594
10302
|
var TableCell_default = TableCell;
|
|
9595
10303
|
|
|
9596
10304
|
// src/components/Table/TableHead.tsx
|
|
9597
|
-
var
|
|
10305
|
+
var import_jsx_runtime344 = require("react/jsx-runtime");
|
|
9598
10306
|
var TableHead = ({
|
|
9599
10307
|
children,
|
|
9600
10308
|
cellHover = false
|
|
9601
10309
|
}) => {
|
|
9602
10310
|
const { headerSticky } = useTableContext();
|
|
9603
|
-
return /* @__PURE__ */ (0,
|
|
10311
|
+
return /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(TableHeadContext_default.Provider, { value: { cellHover }, children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)("thead", { className: clsx_default(headerSticky ? "table-sticky" : null), children }) });
|
|
9604
10312
|
};
|
|
9605
10313
|
TableHead.displayName = "TableHead";
|
|
9606
10314
|
var TableHead_default = TableHead;
|
|
9607
10315
|
|
|
9608
10316
|
// src/components/Table/TableRow.tsx
|
|
9609
|
-
var
|
|
9610
|
-
var
|
|
9611
|
-
var TableRow =
|
|
10317
|
+
var import_react38 = __toESM(require("react"), 1);
|
|
10318
|
+
var import_jsx_runtime345 = require("react/jsx-runtime");
|
|
10319
|
+
var TableRow = import_react38.default.memo((props) => {
|
|
9612
10320
|
const {
|
|
9613
10321
|
children,
|
|
9614
10322
|
type = "secondary",
|
|
@@ -9617,14 +10325,14 @@ var TableRow = import_react37.default.memo((props) => {
|
|
|
9617
10325
|
onClick
|
|
9618
10326
|
} = props;
|
|
9619
10327
|
const { rowBorderUse } = useTableContext();
|
|
9620
|
-
const [stickyCells, setStickyCells] =
|
|
10328
|
+
const [stickyCells, setStickyCells] = import_react38.default.useState([]);
|
|
9621
10329
|
const registerStickyCell = (ref) => {
|
|
9622
10330
|
setStickyCells((prev) => {
|
|
9623
10331
|
if (prev.includes(ref)) return prev;
|
|
9624
10332
|
return [...prev, ref];
|
|
9625
10333
|
});
|
|
9626
10334
|
};
|
|
9627
|
-
return /* @__PURE__ */ (0,
|
|
10335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime345.jsx)(TableRowContext_default.Provider, { value: { stickyCells, registerStickyCell }, children: /* @__PURE__ */ (0, import_jsx_runtime345.jsx)(
|
|
9628
10336
|
"tr",
|
|
9629
10337
|
{
|
|
9630
10338
|
className: clsx_default(
|
|
@@ -9648,7 +10356,7 @@ TableRow.displayName = "TableRow";
|
|
|
9648
10356
|
var TableRow_default = TableRow;
|
|
9649
10357
|
|
|
9650
10358
|
// src/components/Tag/Tag.tsx
|
|
9651
|
-
var
|
|
10359
|
+
var import_jsx_runtime346 = require("react/jsx-runtime");
|
|
9652
10360
|
var Tag = (props) => {
|
|
9653
10361
|
const {
|
|
9654
10362
|
children,
|
|
@@ -9658,7 +10366,7 @@ var Tag = (props) => {
|
|
|
9658
10366
|
disabled = false,
|
|
9659
10367
|
colorIndex
|
|
9660
10368
|
} = props;
|
|
9661
|
-
return /* @__PURE__ */ (0,
|
|
10369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime346.jsxs)(
|
|
9662
10370
|
"span",
|
|
9663
10371
|
{
|
|
9664
10372
|
className: clsx_default(
|
|
@@ -9669,8 +10377,8 @@ var Tag = (props) => {
|
|
|
9669
10377
|
disabled && "disabled"
|
|
9670
10378
|
),
|
|
9671
10379
|
children: [
|
|
9672
|
-
/* @__PURE__ */ (0,
|
|
9673
|
-
onClose && /* @__PURE__ */ (0,
|
|
10380
|
+
/* @__PURE__ */ (0, import_jsx_runtime346.jsx)("span", { className: "tag-label", children }),
|
|
10381
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime346.jsx)("button", { className: "tag-close", onClick: onClose, "aria-label": "\uC0AD\uC81C", disabled, children: /* @__PURE__ */ (0, import_jsx_runtime346.jsx)(XIcon_default, {}) })
|
|
9674
10382
|
]
|
|
9675
10383
|
}
|
|
9676
10384
|
);
|
|
@@ -9679,12 +10387,12 @@ Tag.displayName = "Tag";
|
|
|
9679
10387
|
var Tag_default = Tag;
|
|
9680
10388
|
|
|
9681
10389
|
// src/components/TextArea/TextArea.tsx
|
|
9682
|
-
var
|
|
9683
|
-
var
|
|
9684
|
-
var TextArea =
|
|
10390
|
+
var import_react39 = __toESM(require("react"), 1);
|
|
10391
|
+
var import_jsx_runtime347 = require("react/jsx-runtime");
|
|
10392
|
+
var TextArea = import_react39.default.forwardRef(
|
|
9685
10393
|
(props, ref) => {
|
|
9686
10394
|
const { value, onChange, disabled, ...textareaProps } = props;
|
|
9687
|
-
const localRef =
|
|
10395
|
+
const localRef = import_react39.default.useRef(null);
|
|
9688
10396
|
const setRefs = (el) => {
|
|
9689
10397
|
localRef.current = el;
|
|
9690
10398
|
if (!ref) return;
|
|
@@ -9704,21 +10412,21 @@ var TextArea = import_react38.default.forwardRef(
|
|
|
9704
10412
|
onChange(event);
|
|
9705
10413
|
}
|
|
9706
10414
|
};
|
|
9707
|
-
|
|
10415
|
+
import_react39.default.useEffect(() => {
|
|
9708
10416
|
const el = localRef.current;
|
|
9709
10417
|
if (!el) return;
|
|
9710
10418
|
el.style.height = "0px";
|
|
9711
10419
|
const nextHeight = Math.min(el.scrollHeight, 400);
|
|
9712
10420
|
el.style.height = `${nextHeight}px`;
|
|
9713
10421
|
}, [value]);
|
|
9714
|
-
return /* @__PURE__ */ (0,
|
|
10422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime347.jsx)("div", { className: "lib-xplat-textarea-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(
|
|
9715
10423
|
"div",
|
|
9716
10424
|
{
|
|
9717
10425
|
className: clsx_default(
|
|
9718
10426
|
"lib-xplat-textarea",
|
|
9719
10427
|
disabled ? "disabled" : void 0
|
|
9720
10428
|
),
|
|
9721
|
-
children: /* @__PURE__ */ (0,
|
|
10429
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(
|
|
9722
10430
|
"textarea",
|
|
9723
10431
|
{
|
|
9724
10432
|
...textareaProps,
|
|
@@ -9736,25 +10444,25 @@ TextArea.displayName = "TextArea";
|
|
|
9736
10444
|
var TextArea_default = TextArea;
|
|
9737
10445
|
|
|
9738
10446
|
// src/components/Toast/Toast.tsx
|
|
9739
|
-
var
|
|
10447
|
+
var import_react40 = __toESM(require("react"), 1);
|
|
9740
10448
|
var import_react_dom4 = require("react-dom");
|
|
9741
|
-
var
|
|
9742
|
-
var ToastContext =
|
|
10449
|
+
var import_jsx_runtime348 = require("react/jsx-runtime");
|
|
10450
|
+
var ToastContext = import_react40.default.createContext(null);
|
|
9743
10451
|
var useToast = () => {
|
|
9744
|
-
const ctx =
|
|
10452
|
+
const ctx = import_react40.default.useContext(ToastContext);
|
|
9745
10453
|
if (!ctx) throw new Error("useToast must be used within ToastProvider");
|
|
9746
10454
|
return ctx;
|
|
9747
10455
|
};
|
|
9748
10456
|
var EXIT_DURATION = 300;
|
|
9749
10457
|
var ToastItemComponent = ({ item, isExiting, onClose }) => {
|
|
9750
|
-
const ref =
|
|
9751
|
-
const [height, setHeight] =
|
|
9752
|
-
|
|
10458
|
+
const ref = import_react40.default.useRef(null);
|
|
10459
|
+
const [height, setHeight] = import_react40.default.useState(void 0);
|
|
10460
|
+
import_react40.default.useEffect(() => {
|
|
9753
10461
|
if (ref.current && !isExiting) {
|
|
9754
10462
|
setHeight(ref.current.offsetHeight);
|
|
9755
10463
|
}
|
|
9756
10464
|
}, [isExiting]);
|
|
9757
|
-
return /* @__PURE__ */ (0,
|
|
10465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(
|
|
9758
10466
|
"div",
|
|
9759
10467
|
{
|
|
9760
10468
|
className: clsx_default("lib-xplat-toast-wrapper", { exit: isExiting }),
|
|
@@ -9762,15 +10470,15 @@ var ToastItemComponent = ({ item, isExiting, onClose }) => {
|
|
|
9762
10470
|
maxHeight: isExiting ? 0 : height ?? "none",
|
|
9763
10471
|
marginBottom: isExiting ? 0 : void 0
|
|
9764
10472
|
},
|
|
9765
|
-
children: /* @__PURE__ */ (0,
|
|
10473
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime348.jsxs)(
|
|
9766
10474
|
"div",
|
|
9767
10475
|
{
|
|
9768
10476
|
ref,
|
|
9769
10477
|
className: clsx_default("lib-xplat-toast", item.type, { exit: isExiting }),
|
|
9770
10478
|
role: "alert",
|
|
9771
10479
|
children: [
|
|
9772
|
-
/* @__PURE__ */ (0,
|
|
9773
|
-
/* @__PURE__ */ (0,
|
|
10480
|
+
/* @__PURE__ */ (0, import_jsx_runtime348.jsx)("span", { className: "message", children: item.message }),
|
|
10481
|
+
/* @__PURE__ */ (0, import_jsx_runtime348.jsx)("button", { className: "close-btn", onClick: onClose, "aria-label": "\uB2EB\uAE30", children: "\xD7" })
|
|
9774
10482
|
]
|
|
9775
10483
|
}
|
|
9776
10484
|
)
|
|
@@ -9781,13 +10489,13 @@ var ToastProvider = ({
|
|
|
9781
10489
|
children,
|
|
9782
10490
|
position = "top-right"
|
|
9783
10491
|
}) => {
|
|
9784
|
-
const [toasts, setToasts] =
|
|
9785
|
-
const [removing, setRemoving] =
|
|
9786
|
-
const [mounted, setMounted] =
|
|
9787
|
-
|
|
10492
|
+
const [toasts, setToasts] = import_react40.default.useState([]);
|
|
10493
|
+
const [removing, setRemoving] = import_react40.default.useState(/* @__PURE__ */ new Set());
|
|
10494
|
+
const [mounted, setMounted] = import_react40.default.useState(false);
|
|
10495
|
+
import_react40.default.useEffect(() => {
|
|
9788
10496
|
setMounted(true);
|
|
9789
10497
|
}, []);
|
|
9790
|
-
const remove =
|
|
10498
|
+
const remove = import_react40.default.useCallback((id) => {
|
|
9791
10499
|
setRemoving((prev) => new Set(prev).add(id));
|
|
9792
10500
|
setTimeout(() => {
|
|
9793
10501
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
@@ -9798,7 +10506,7 @@ var ToastProvider = ({
|
|
|
9798
10506
|
});
|
|
9799
10507
|
}, EXIT_DURATION);
|
|
9800
10508
|
}, []);
|
|
9801
|
-
const toast =
|
|
10509
|
+
const toast = import_react40.default.useCallback(
|
|
9802
10510
|
(type, message, duration = 3e3) => {
|
|
9803
10511
|
const id = `${Date.now()}-${Math.random()}`;
|
|
9804
10512
|
setToasts((prev) => [...prev, { id, type, message }]);
|
|
@@ -9808,10 +10516,10 @@ var ToastProvider = ({
|
|
|
9808
10516
|
},
|
|
9809
10517
|
[remove]
|
|
9810
10518
|
);
|
|
9811
|
-
return /* @__PURE__ */ (0,
|
|
10519
|
+
return /* @__PURE__ */ (0, import_jsx_runtime348.jsxs)(ToastContext.Provider, { value: { toast }, children: [
|
|
9812
10520
|
children,
|
|
9813
10521
|
mounted && (0, import_react_dom4.createPortal)(
|
|
9814
|
-
/* @__PURE__ */ (0,
|
|
10522
|
+
/* @__PURE__ */ (0, import_jsx_runtime348.jsx)("div", { className: clsx_default("lib-xplat-toast-container", position), children: toasts.map((t) => /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(
|
|
9815
10523
|
ToastItemComponent,
|
|
9816
10524
|
{
|
|
9817
10525
|
item: t,
|
|
@@ -9827,8 +10535,8 @@ var ToastProvider = ({
|
|
|
9827
10535
|
ToastProvider.displayName = "ToastProvider";
|
|
9828
10536
|
|
|
9829
10537
|
// src/components/Tooltip/Tooltip.tsx
|
|
9830
|
-
var
|
|
9831
|
-
var
|
|
10538
|
+
var import_react41 = __toESM(require("react"), 1);
|
|
10539
|
+
var import_jsx_runtime349 = require("react/jsx-runtime");
|
|
9832
10540
|
var OFFSET = 12;
|
|
9833
10541
|
var SHOW_DELAY = 300;
|
|
9834
10542
|
var Tooltip = (props) => {
|
|
@@ -9839,12 +10547,12 @@ var Tooltip = (props) => {
|
|
|
9839
10547
|
children,
|
|
9840
10548
|
disabled = false
|
|
9841
10549
|
} = props;
|
|
9842
|
-
const triggerRef =
|
|
9843
|
-
const tooltipRef =
|
|
9844
|
-
const [visible, setVisible] =
|
|
9845
|
-
const [pos, setPos] =
|
|
9846
|
-
const delayTimer =
|
|
9847
|
-
const calculatePos =
|
|
10550
|
+
const triggerRef = import_react41.default.useRef(null);
|
|
10551
|
+
const tooltipRef = import_react41.default.useRef(null);
|
|
10552
|
+
const [visible, setVisible] = import_react41.default.useState(false);
|
|
10553
|
+
const [pos, setPos] = import_react41.default.useState({ left: 0, top: 0 });
|
|
10554
|
+
const delayTimer = import_react41.default.useRef(0);
|
|
10555
|
+
const calculatePos = import_react41.default.useCallback((clientX, clientY) => {
|
|
9848
10556
|
const el = tooltipRef.current;
|
|
9849
10557
|
if (!el) return;
|
|
9850
10558
|
const w = el.offsetWidth;
|
|
@@ -9857,38 +10565,38 @@ var Tooltip = (props) => {
|
|
|
9857
10565
|
if (left < 8) left = 8;
|
|
9858
10566
|
setPos({ left, top });
|
|
9859
10567
|
}, []);
|
|
9860
|
-
const handleMouseEnter =
|
|
10568
|
+
const handleMouseEnter = import_react41.default.useCallback(() => {
|
|
9861
10569
|
if (disabled) return;
|
|
9862
10570
|
delayTimer.current = window.setTimeout(() => {
|
|
9863
10571
|
setVisible(true);
|
|
9864
10572
|
}, SHOW_DELAY);
|
|
9865
10573
|
}, [disabled]);
|
|
9866
|
-
const handleMouseMove =
|
|
10574
|
+
const handleMouseMove = import_react41.default.useCallback((e) => {
|
|
9867
10575
|
if (!visible) return;
|
|
9868
10576
|
calculatePos(e.clientX, e.clientY);
|
|
9869
10577
|
}, [visible, calculatePos]);
|
|
9870
|
-
const handleMouseLeave =
|
|
10578
|
+
const handleMouseLeave = import_react41.default.useCallback(() => {
|
|
9871
10579
|
window.clearTimeout(delayTimer.current);
|
|
9872
10580
|
setVisible(false);
|
|
9873
10581
|
}, []);
|
|
9874
|
-
const handleClick =
|
|
10582
|
+
const handleClick = import_react41.default.useCallback(() => {
|
|
9875
10583
|
window.clearTimeout(delayTimer.current);
|
|
9876
10584
|
setVisible(false);
|
|
9877
10585
|
}, []);
|
|
9878
|
-
const handleFocus =
|
|
10586
|
+
const handleFocus = import_react41.default.useCallback(() => {
|
|
9879
10587
|
if (disabled) return;
|
|
9880
10588
|
setVisible(true);
|
|
9881
10589
|
}, [disabled]);
|
|
9882
|
-
const handleBlur =
|
|
10590
|
+
const handleBlur = import_react41.default.useCallback(() => {
|
|
9883
10591
|
setVisible(false);
|
|
9884
10592
|
}, []);
|
|
9885
|
-
|
|
10593
|
+
import_react41.default.useLayoutEffect(() => {
|
|
9886
10594
|
if (!visible || !triggerRef.current) return;
|
|
9887
10595
|
const rect = triggerRef.current.getBoundingClientRect();
|
|
9888
10596
|
calculatePos(rect.right, rect.top);
|
|
9889
10597
|
}, [visible, calculatePos]);
|
|
9890
|
-
if (!title && !description) return /* @__PURE__ */ (0,
|
|
9891
|
-
return /* @__PURE__ */ (0,
|
|
10598
|
+
if (!title && !description) return /* @__PURE__ */ (0, import_jsx_runtime349.jsx)(import_jsx_runtime349.Fragment, { children });
|
|
10599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime349.jsxs)(
|
|
9892
10600
|
"div",
|
|
9893
10601
|
{
|
|
9894
10602
|
ref: triggerRef,
|
|
@@ -9901,15 +10609,15 @@ var Tooltip = (props) => {
|
|
|
9901
10609
|
onBlur: handleBlur,
|
|
9902
10610
|
children: [
|
|
9903
10611
|
children,
|
|
9904
|
-
visible && /* @__PURE__ */ (0,
|
|
10612
|
+
visible && /* @__PURE__ */ (0, import_jsx_runtime349.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime349.jsxs)(
|
|
9905
10613
|
"div",
|
|
9906
10614
|
{
|
|
9907
10615
|
ref: tooltipRef,
|
|
9908
10616
|
className: clsx_default("lib-xplat-tooltip", type),
|
|
9909
10617
|
style: { position: "fixed", left: pos.left, top: pos.top },
|
|
9910
10618
|
children: [
|
|
9911
|
-
title && /* @__PURE__ */ (0,
|
|
9912
|
-
description && /* @__PURE__ */ (0,
|
|
10619
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime349.jsx)("div", { className: "tooltip-title", children: title }),
|
|
10620
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime349.jsx)("div", { className: "tooltip-desc", children: description })
|
|
9913
10621
|
]
|
|
9914
10622
|
}
|
|
9915
10623
|
) })
|
|
@@ -9921,11 +10629,11 @@ Tooltip.displayName = "Tooltip";
|
|
|
9921
10629
|
var Tooltip_default = Tooltip;
|
|
9922
10630
|
|
|
9923
10631
|
// src/components/Video/Video.tsx
|
|
9924
|
-
var
|
|
9925
|
-
var
|
|
9926
|
-
var PipIcon = () => /* @__PURE__ */ (0,
|
|
9927
|
-
/* @__PURE__ */ (0,
|
|
9928
|
-
/* @__PURE__ */ (0,
|
|
10632
|
+
var import_react42 = __toESM(require("react"), 1);
|
|
10633
|
+
var import_jsx_runtime350 = require("react/jsx-runtime");
|
|
10634
|
+
var PipIcon = () => /* @__PURE__ */ (0, import_jsx_runtime350.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: [
|
|
10635
|
+
/* @__PURE__ */ (0, import_jsx_runtime350.jsx)("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
|
|
10636
|
+
/* @__PURE__ */ (0, import_jsx_runtime350.jsx)("rect", { x: "12", y: "11", width: "7", height: "6", rx: "1", fill: "currentColor" })
|
|
9929
10637
|
] });
|
|
9930
10638
|
var formatTime = (sec) => {
|
|
9931
10639
|
if (!Number.isFinite(sec) || sec < 0) return "0:00";
|
|
@@ -9933,7 +10641,7 @@ var formatTime = (sec) => {
|
|
|
9933
10641
|
const s = Math.floor(sec % 60);
|
|
9934
10642
|
return `${m}:${s.toString().padStart(2, "0")}`;
|
|
9935
10643
|
};
|
|
9936
|
-
var Video =
|
|
10644
|
+
var Video = import_react42.default.forwardRef((props, ref) => {
|
|
9937
10645
|
const {
|
|
9938
10646
|
src,
|
|
9939
10647
|
poster,
|
|
@@ -9957,21 +10665,21 @@ var Video = import_react41.default.forwardRef((props, ref) => {
|
|
|
9957
10665
|
children,
|
|
9958
10666
|
...rest
|
|
9959
10667
|
} = props;
|
|
9960
|
-
const containerRef =
|
|
9961
|
-
const videoRef =
|
|
9962
|
-
const [isPlaying, setIsPlaying] =
|
|
9963
|
-
const [isLoaded, setIsLoaded] =
|
|
9964
|
-
const [currentTime, setCurrentTime] =
|
|
9965
|
-
const [duration, setDuration] =
|
|
9966
|
-
const [buffered, setBuffered] =
|
|
9967
|
-
const [volume, setVolume] =
|
|
9968
|
-
const [isMuted, setIsMuted] =
|
|
9969
|
-
const [isFullscreen, setIsFullscreen] =
|
|
9970
|
-
const [playbackRate, setPlaybackRate] =
|
|
9971
|
-
const [rateMenuOpen, setRateMenuOpen] =
|
|
9972
|
-
const [captionsOn, setCaptionsOn] =
|
|
9973
|
-
const [isPip, setIsPip] =
|
|
9974
|
-
const setRefs =
|
|
10668
|
+
const containerRef = import_react42.default.useRef(null);
|
|
10669
|
+
const videoRef = import_react42.default.useRef(null);
|
|
10670
|
+
const [isPlaying, setIsPlaying] = import_react42.default.useState(Boolean(autoPlay));
|
|
10671
|
+
const [isLoaded, setIsLoaded] = import_react42.default.useState(false);
|
|
10672
|
+
const [currentTime, setCurrentTime] = import_react42.default.useState(0);
|
|
10673
|
+
const [duration, setDuration] = import_react42.default.useState(0);
|
|
10674
|
+
const [buffered, setBuffered] = import_react42.default.useState(0);
|
|
10675
|
+
const [volume, setVolume] = import_react42.default.useState(1);
|
|
10676
|
+
const [isMuted, setIsMuted] = import_react42.default.useState(Boolean(muted));
|
|
10677
|
+
const [isFullscreen, setIsFullscreen] = import_react42.default.useState(false);
|
|
10678
|
+
const [playbackRate, setPlaybackRate] = import_react42.default.useState(1);
|
|
10679
|
+
const [rateMenuOpen, setRateMenuOpen] = import_react42.default.useState(false);
|
|
10680
|
+
const [captionsOn, setCaptionsOn] = import_react42.default.useState(false);
|
|
10681
|
+
const [isPip, setIsPip] = import_react42.default.useState(false);
|
|
10682
|
+
const setRefs = import_react42.default.useCallback(
|
|
9975
10683
|
(el) => {
|
|
9976
10684
|
videoRef.current = el;
|
|
9977
10685
|
if (typeof ref === "function") ref(el);
|
|
@@ -9979,14 +10687,14 @@ var Video = import_react41.default.forwardRef((props, ref) => {
|
|
|
9979
10687
|
},
|
|
9980
10688
|
[ref]
|
|
9981
10689
|
);
|
|
9982
|
-
|
|
10690
|
+
import_react42.default.useEffect(() => {
|
|
9983
10691
|
const onFsChange = () => {
|
|
9984
10692
|
setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
9985
10693
|
};
|
|
9986
10694
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
9987
10695
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
9988
10696
|
}, []);
|
|
9989
|
-
|
|
10697
|
+
import_react42.default.useEffect(() => {
|
|
9990
10698
|
const v = videoRef.current;
|
|
9991
10699
|
if (!v) return;
|
|
9992
10700
|
const onEnter = () => setIsPip(true);
|
|
@@ -10100,13 +10808,13 @@ var Video = import_react41.default.forwardRef((props, ref) => {
|
|
|
10100
10808
|
const volumePct = (isMuted ? 0 : volume) * 100;
|
|
10101
10809
|
const VolumeGlyph = isMuted || volume === 0 ? VolumeXIcon_default : volume < 0.5 ? VolumeIcon_default : Volume2Icon_default;
|
|
10102
10810
|
const pipSupported = typeof document !== "undefined" && "pictureInPictureEnabled" in document && document.pictureInPictureEnabled;
|
|
10103
|
-
return /* @__PURE__ */ (0,
|
|
10811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime350.jsxs)(
|
|
10104
10812
|
"div",
|
|
10105
10813
|
{
|
|
10106
10814
|
ref: containerRef,
|
|
10107
10815
|
className: clsx_default("lib-xplat-video", showControls && "has-controls"),
|
|
10108
10816
|
children: [
|
|
10109
|
-
/* @__PURE__ */ (0,
|
|
10817
|
+
/* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
|
|
10110
10818
|
"video",
|
|
10111
10819
|
{
|
|
10112
10820
|
ref: setRefs,
|
|
@@ -10127,7 +10835,7 @@ var Video = import_react41.default.forwardRef((props, ref) => {
|
|
|
10127
10835
|
children
|
|
10128
10836
|
}
|
|
10129
10837
|
),
|
|
10130
|
-
showCenterPlay && /* @__PURE__ */ (0,
|
|
10838
|
+
showCenterPlay && /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
|
|
10131
10839
|
"button",
|
|
10132
10840
|
{
|
|
10133
10841
|
type: "button",
|
|
@@ -10139,11 +10847,11 @@ var Video = import_react41.default.forwardRef((props, ref) => {
|
|
|
10139
10847
|
onClick: togglePlay,
|
|
10140
10848
|
"aria-label": isPlaying ? "\uC77C\uC2DC\uC815\uC9C0" : "\uC7AC\uC0DD",
|
|
10141
10849
|
tabIndex: -1,
|
|
10142
|
-
children: /* @__PURE__ */ (0,
|
|
10850
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime350.jsx)("span", { className: "center-play-icon", children: /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(PlayCircleIcon_default, {}) })
|
|
10143
10851
|
}
|
|
10144
10852
|
),
|
|
10145
|
-
showControls && /* @__PURE__ */ (0,
|
|
10146
|
-
/* @__PURE__ */ (0,
|
|
10853
|
+
showControls && /* @__PURE__ */ (0, import_jsx_runtime350.jsxs)("div", { className: "controls", onClick: (e) => e.stopPropagation(), children: [
|
|
10854
|
+
/* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
|
|
10147
10855
|
"input",
|
|
10148
10856
|
{
|
|
10149
10857
|
type: "range",
|
|
@@ -10160,29 +10868,29 @@ var Video = import_react41.default.forwardRef((props, ref) => {
|
|
|
10160
10868
|
}
|
|
10161
10869
|
}
|
|
10162
10870
|
),
|
|
10163
|
-
/* @__PURE__ */ (0,
|
|
10164
|
-
/* @__PURE__ */ (0,
|
|
10871
|
+
/* @__PURE__ */ (0, import_jsx_runtime350.jsxs)("div", { className: "controls-row", children: [
|
|
10872
|
+
/* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
|
|
10165
10873
|
"button",
|
|
10166
10874
|
{
|
|
10167
10875
|
type: "button",
|
|
10168
10876
|
className: "control-btn",
|
|
10169
10877
|
onClick: togglePlay,
|
|
10170
10878
|
"aria-label": isPlaying ? "\uC77C\uC2DC\uC815\uC9C0" : "\uC7AC\uC0DD",
|
|
10171
|
-
children: isPlaying ? /* @__PURE__ */ (0,
|
|
10879
|
+
children: isPlaying ? /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(PauseIcon_default, {}) : /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(PlayIcon_default, {})
|
|
10172
10880
|
}
|
|
10173
10881
|
),
|
|
10174
|
-
/* @__PURE__ */ (0,
|
|
10175
|
-
/* @__PURE__ */ (0,
|
|
10882
|
+
/* @__PURE__ */ (0, import_jsx_runtime350.jsxs)("div", { className: "volume-group", children: [
|
|
10883
|
+
/* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
|
|
10176
10884
|
"button",
|
|
10177
10885
|
{
|
|
10178
10886
|
type: "button",
|
|
10179
10887
|
className: "control-btn",
|
|
10180
10888
|
onClick: toggleMute,
|
|
10181
10889
|
"aria-label": isMuted ? "\uC74C\uC18C\uAC70 \uD574\uC81C" : "\uC74C\uC18C\uAC70",
|
|
10182
|
-
children: /* @__PURE__ */ (0,
|
|
10890
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(VolumeGlyph, {})
|
|
10183
10891
|
}
|
|
10184
10892
|
),
|
|
10185
|
-
/* @__PURE__ */ (0,
|
|
10893
|
+
/* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
|
|
10186
10894
|
"input",
|
|
10187
10895
|
{
|
|
10188
10896
|
type: "range",
|
|
@@ -10197,14 +10905,14 @@ var Video = import_react41.default.forwardRef((props, ref) => {
|
|
|
10197
10905
|
}
|
|
10198
10906
|
)
|
|
10199
10907
|
] }),
|
|
10200
|
-
/* @__PURE__ */ (0,
|
|
10908
|
+
/* @__PURE__ */ (0, import_jsx_runtime350.jsxs)("span", { className: "time", children: [
|
|
10201
10909
|
formatTime(currentTime),
|
|
10202
10910
|
" / ",
|
|
10203
10911
|
formatTime(duration)
|
|
10204
10912
|
] }),
|
|
10205
|
-
/* @__PURE__ */ (0,
|
|
10206
|
-
playbackRates && playbackRates.length > 0 && /* @__PURE__ */ (0,
|
|
10207
|
-
/* @__PURE__ */ (0,
|
|
10913
|
+
/* @__PURE__ */ (0, import_jsx_runtime350.jsx)("div", { className: "controls-spacer" }),
|
|
10914
|
+
playbackRates && playbackRates.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime350.jsxs)("div", { className: clsx_default("rate-group", rateMenuOpen && "is-open"), children: [
|
|
10915
|
+
/* @__PURE__ */ (0, import_jsx_runtime350.jsxs)(
|
|
10208
10916
|
"button",
|
|
10209
10917
|
{
|
|
10210
10918
|
type: "button",
|
|
@@ -10218,7 +10926,7 @@ var Video = import_react41.default.forwardRef((props, ref) => {
|
|
|
10218
10926
|
]
|
|
10219
10927
|
}
|
|
10220
10928
|
),
|
|
10221
|
-
rateMenuOpen && /* @__PURE__ */ (0,
|
|
10929
|
+
rateMenuOpen && /* @__PURE__ */ (0, import_jsx_runtime350.jsx)("ul", { className: "rate-menu", role: "menu", children: playbackRates.map((r2) => /* @__PURE__ */ (0, import_jsx_runtime350.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime350.jsxs)(
|
|
10222
10930
|
"button",
|
|
10223
10931
|
{
|
|
10224
10932
|
type: "button",
|
|
@@ -10232,7 +10940,7 @@ var Video = import_react41.default.forwardRef((props, ref) => {
|
|
|
10232
10940
|
}
|
|
10233
10941
|
) }, r2)) })
|
|
10234
10942
|
] }),
|
|
10235
|
-
showCaptions && /* @__PURE__ */ (0,
|
|
10943
|
+
showCaptions && /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
|
|
10236
10944
|
"button",
|
|
10237
10945
|
{
|
|
10238
10946
|
type: "button",
|
|
@@ -10240,37 +10948,37 @@ var Video = import_react41.default.forwardRef((props, ref) => {
|
|
|
10240
10948
|
onClick: toggleCaptions,
|
|
10241
10949
|
"aria-label": captionsOn ? "\uC790\uB9C9 \uB044\uAE30" : "\uC790\uB9C9 \uCF1C\uAE30",
|
|
10242
10950
|
"aria-pressed": captionsOn,
|
|
10243
|
-
children: /* @__PURE__ */ (0,
|
|
10951
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(TypeIcon_default, {})
|
|
10244
10952
|
}
|
|
10245
10953
|
),
|
|
10246
|
-
showPip && pipSupported && /* @__PURE__ */ (0,
|
|
10954
|
+
showPip && pipSupported && /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
|
|
10247
10955
|
"button",
|
|
10248
10956
|
{
|
|
10249
10957
|
type: "button",
|
|
10250
10958
|
className: clsx_default("control-btn", isPip && "is-active"),
|
|
10251
10959
|
onClick: togglePip,
|
|
10252
10960
|
"aria-label": isPip ? "PIP \uC885\uB8CC" : "PIP",
|
|
10253
|
-
children: /* @__PURE__ */ (0,
|
|
10961
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(PipIcon, {})
|
|
10254
10962
|
}
|
|
10255
10963
|
),
|
|
10256
|
-
showDownload && /* @__PURE__ */ (0,
|
|
10964
|
+
showDownload && /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
|
|
10257
10965
|
"a",
|
|
10258
10966
|
{
|
|
10259
10967
|
className: "control-btn",
|
|
10260
10968
|
href: src,
|
|
10261
10969
|
download: downloadFileName ?? true,
|
|
10262
10970
|
"aria-label": "\uB2E4\uC6B4\uB85C\uB4DC",
|
|
10263
|
-
children: /* @__PURE__ */ (0,
|
|
10971
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(DownloadIcon_default, {})
|
|
10264
10972
|
}
|
|
10265
10973
|
),
|
|
10266
|
-
/* @__PURE__ */ (0,
|
|
10974
|
+
/* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
|
|
10267
10975
|
"button",
|
|
10268
10976
|
{
|
|
10269
10977
|
type: "button",
|
|
10270
10978
|
className: "control-btn",
|
|
10271
10979
|
onClick: toggleFullscreen,
|
|
10272
10980
|
"aria-label": isFullscreen ? "\uC804\uCCB4\uD654\uBA74 \uC885\uB8CC" : "\uC804\uCCB4\uD654\uBA74",
|
|
10273
|
-
children: isFullscreen ? /* @__PURE__ */ (0,
|
|
10981
|
+
children: isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(MinimizeIcon_default, {}) : /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(MaximizeIcon_default, {})
|
|
10274
10982
|
}
|
|
10275
10983
|
)
|
|
10276
10984
|
] })
|
|
@@ -10283,7 +10991,7 @@ Video.displayName = "Video";
|
|
|
10283
10991
|
var Video_default = Video;
|
|
10284
10992
|
|
|
10285
10993
|
// src/layout/Grid/FullGrid/FullGrid.tsx
|
|
10286
|
-
var
|
|
10994
|
+
var import_jsx_runtime351 = require("react/jsx-runtime");
|
|
10287
10995
|
var GAP_MAP = {
|
|
10288
10996
|
none: "var(--spacing-space-none)",
|
|
10289
10997
|
xs: "var(--spacing-space-1)",
|
|
@@ -10296,13 +11004,13 @@ var GAP_MAP = {
|
|
|
10296
11004
|
var FullGrid = (props) => {
|
|
10297
11005
|
const { children, gap } = props;
|
|
10298
11006
|
const style = gap != null ? { gap: GAP_MAP[gap] } : void 0;
|
|
10299
|
-
return /* @__PURE__ */ (0,
|
|
11007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime351.jsx)("div", { className: "lib-xplat-full-grid", style, children });
|
|
10300
11008
|
};
|
|
10301
11009
|
FullGrid.displayName = "FullGrid";
|
|
10302
11010
|
var FullGrid_default = FullGrid;
|
|
10303
11011
|
|
|
10304
11012
|
// src/layout/Grid/FullScreen/FullScreen.tsx
|
|
10305
|
-
var
|
|
11013
|
+
var import_jsx_runtime352 = require("react/jsx-runtime");
|
|
10306
11014
|
var GAP_MAP2 = {
|
|
10307
11015
|
none: "var(--spacing-space-none)",
|
|
10308
11016
|
xs: "var(--spacing-space-1)",
|
|
@@ -10315,13 +11023,13 @@ var GAP_MAP2 = {
|
|
|
10315
11023
|
var FullScreen = (props) => {
|
|
10316
11024
|
const { children, gap } = props;
|
|
10317
11025
|
const style = gap != null ? { gap: GAP_MAP2[gap] } : void 0;
|
|
10318
|
-
return /* @__PURE__ */ (0,
|
|
11026
|
+
return /* @__PURE__ */ (0, import_jsx_runtime352.jsx)("div", { className: "lib-xplat-full-screen", style, children });
|
|
10319
11027
|
};
|
|
10320
11028
|
FullScreen.displayName = "FullScreen";
|
|
10321
11029
|
var FullScreen_default = FullScreen;
|
|
10322
11030
|
|
|
10323
11031
|
// src/layout/Grid/Item/Item.tsx
|
|
10324
|
-
var
|
|
11032
|
+
var import_jsx_runtime353 = require("react/jsx-runtime");
|
|
10325
11033
|
var calculateSpans = (column) => {
|
|
10326
11034
|
const spans = {};
|
|
10327
11035
|
let inherited = column.default;
|
|
@@ -10338,35 +11046,35 @@ var GridItem = ({ column, children, className }) => {
|
|
|
10338
11046
|
Object.entries(spans).forEach(([key, value]) => {
|
|
10339
11047
|
style[`--column-${key}`] = value;
|
|
10340
11048
|
});
|
|
10341
|
-
return /* @__PURE__ */ (0,
|
|
11049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime353.jsx)("div", { className: clsx_default("lib-xplat-grid-item", className), style, children });
|
|
10342
11050
|
};
|
|
10343
11051
|
GridItem.displayName = "GridItem";
|
|
10344
11052
|
var Item_default = GridItem;
|
|
10345
11053
|
|
|
10346
11054
|
// src/layout/Header/Header.tsx
|
|
10347
|
-
var
|
|
11055
|
+
var import_jsx_runtime354 = require("react/jsx-runtime");
|
|
10348
11056
|
var Header = ({
|
|
10349
11057
|
logo,
|
|
10350
11058
|
centerContent,
|
|
10351
11059
|
rightContent
|
|
10352
11060
|
}) => {
|
|
10353
|
-
return /* @__PURE__ */ (0,
|
|
10354
|
-
/* @__PURE__ */ (0,
|
|
10355
|
-
/* @__PURE__ */ (0,
|
|
10356
|
-
/* @__PURE__ */ (0,
|
|
11061
|
+
return /* @__PURE__ */ (0, import_jsx_runtime354.jsxs)("div", { className: "lib-xplat-layout-header", children: [
|
|
11062
|
+
/* @__PURE__ */ (0, import_jsx_runtime354.jsx)("div", { children: logo }),
|
|
11063
|
+
/* @__PURE__ */ (0, import_jsx_runtime354.jsx)("div", { children: centerContent }),
|
|
11064
|
+
/* @__PURE__ */ (0, import_jsx_runtime354.jsx)("div", { children: rightContent })
|
|
10357
11065
|
] });
|
|
10358
11066
|
};
|
|
10359
11067
|
Header.displayName = "Header";
|
|
10360
11068
|
var Header_default = Header;
|
|
10361
11069
|
|
|
10362
11070
|
// src/layout/Layout/Layout.tsx
|
|
10363
|
-
var
|
|
11071
|
+
var import_jsx_runtime355 = require("react/jsx-runtime");
|
|
10364
11072
|
var Layout = (props) => {
|
|
10365
11073
|
const { header, sideBar, children } = props;
|
|
10366
|
-
return /* @__PURE__ */ (0,
|
|
10367
|
-
sideBar && /* @__PURE__ */ (0,
|
|
10368
|
-
/* @__PURE__ */ (0,
|
|
10369
|
-
header && /* @__PURE__ */ (0,
|
|
11074
|
+
return /* @__PURE__ */ (0, import_jsx_runtime355.jsx)("div", { className: "lib-xplat-layout", children: /* @__PURE__ */ (0, import_jsx_runtime355.jsxs)("div", { className: "lib-xplat-layout-content-wrapper", children: [
|
|
11075
|
+
sideBar && /* @__PURE__ */ (0, import_jsx_runtime355.jsx)(import_jsx_runtime355.Fragment, { children: sideBar }),
|
|
11076
|
+
/* @__PURE__ */ (0, import_jsx_runtime355.jsxs)("div", { className: "lib-xplat-layout-content", children: [
|
|
11077
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime355.jsx)("div", { className: "lib-xplat-layout-conent-header", children: header }),
|
|
10370
11078
|
children
|
|
10371
11079
|
] })
|
|
10372
11080
|
] }) });
|
|
@@ -10375,31 +11083,31 @@ Layout.displayName = "Layout";
|
|
|
10375
11083
|
var Layout_default = Layout;
|
|
10376
11084
|
|
|
10377
11085
|
// src/layout/SideBar/SideBar.tsx
|
|
10378
|
-
var
|
|
11086
|
+
var import_react44 = __toESM(require("react"), 1);
|
|
10379
11087
|
|
|
10380
11088
|
// src/layout/SideBar/SideBarContext.tsx
|
|
10381
|
-
var
|
|
10382
|
-
var SideBarContext =
|
|
11089
|
+
var import_react43 = __toESM(require("react"), 1);
|
|
11090
|
+
var SideBarContext = import_react43.default.createContext(null);
|
|
10383
11091
|
var useSideBarContext = () => {
|
|
10384
|
-
const ctx =
|
|
11092
|
+
const ctx = import_react43.default.useContext(SideBarContext);
|
|
10385
11093
|
if (!ctx) throw new Error("Error");
|
|
10386
11094
|
return ctx;
|
|
10387
11095
|
};
|
|
10388
11096
|
var SideBarContext_default = SideBarContext;
|
|
10389
11097
|
|
|
10390
11098
|
// src/layout/SideBar/SideBar.tsx
|
|
10391
|
-
var
|
|
11099
|
+
var import_jsx_runtime356 = require("react/jsx-runtime");
|
|
10392
11100
|
var SideBar = (props) => {
|
|
10393
11101
|
const { children, className } = props;
|
|
10394
|
-
const [isOpen, setIsOpen] =
|
|
11102
|
+
const [isOpen, setIsOpen] = import_react44.default.useState(true);
|
|
10395
11103
|
const handleSwitchSideBar = () => {
|
|
10396
11104
|
setIsOpen((prev) => !prev);
|
|
10397
11105
|
};
|
|
10398
|
-
return /* @__PURE__ */ (0,
|
|
11106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime356.jsx)(
|
|
10399
11107
|
SideBarContext_default.Provider,
|
|
10400
11108
|
{
|
|
10401
11109
|
value: { isSidebarOpen: isOpen, handleSwitchSideBar },
|
|
10402
|
-
children: /* @__PURE__ */ (0,
|
|
11110
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime356.jsx)(
|
|
10403
11111
|
"div",
|
|
10404
11112
|
{
|
|
10405
11113
|
className: clsx_default(
|
|
@@ -10542,6 +11250,7 @@ var SideBar_default = SideBar;
|
|
|
10542
11250
|
Edit2Icon,
|
|
10543
11251
|
Edit3Icon,
|
|
10544
11252
|
EditIcon,
|
|
11253
|
+
Editor,
|
|
10545
11254
|
EmptyState,
|
|
10546
11255
|
ErrorIcon,
|
|
10547
11256
|
ExternalLinkIcon,
|