@x-plat/design-system 0.14.19 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Dropdown/index.cjs +48 -18
- package/dist/components/Dropdown/index.js +48 -18
- package/dist/components/PopOver/index.cjs +47 -17
- package/dist/components/PopOver/index.js +47 -17
- package/dist/components/Select/index.cjs +67 -37
- package/dist/components/Select/index.js +67 -37
- package/dist/components/Table/index.cjs +17 -10
- package/dist/components/Table/index.js +17 -10
- package/dist/components/TimePicker/index.cjs +52 -22
- package/dist/components/TimePicker/index.js +52 -22
- package/dist/components/Tooltip/index.cjs +2 -2
- package/dist/components/Tooltip/index.js +2 -2
- package/dist/components/index.cjs +266 -226
- package/dist/components/index.js +266 -226
- package/dist/index.cjs +271 -231
- package/dist/index.js +271 -231
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7648,8 +7648,10 @@ var import_react11 = __toESM(require("react"), 1);
|
|
|
7648
7648
|
var import_react10 = __toESM(require("react"), 1);
|
|
7649
7649
|
var findScrollParent = (el) => {
|
|
7650
7650
|
for (let p = el.parentElement; p; p = p.parentElement) {
|
|
7651
|
-
|
|
7652
|
-
|
|
7651
|
+
if (p.dataset.xplatOverlayEscape !== void 0) continue;
|
|
7652
|
+
const { overflowY } = getComputedStyle(p);
|
|
7653
|
+
if (!/(auto|scroll)/.test(overflowY)) continue;
|
|
7654
|
+
if (p.scrollHeight > p.clientHeight) return p;
|
|
7653
7655
|
}
|
|
7654
7656
|
return null;
|
|
7655
7657
|
};
|
|
@@ -7745,8 +7747,9 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
7745
7747
|
);
|
|
7746
7748
|
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
7747
7749
|
const maxHeight = frozenMaxRef.current;
|
|
7748
|
-
|
|
7749
|
-
pop.style.
|
|
7750
|
+
const hostRect = (pop.offsetParent ?? pop.parentElement)?.getBoundingClientRect();
|
|
7751
|
+
pop.style.top = `${top - (hostRect?.top ?? 0)}px`;
|
|
7752
|
+
pop.style.left = `${left - (hostRect?.left ?? 0)}px`;
|
|
7750
7753
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
7751
7754
|
pop.style.clipPath = over.top || over.right || over.bottom || over.left ? `inset(${over.top}px ${over.right}px ${over.bottom}px ${over.left}px)` : "none";
|
|
7752
7755
|
directionRef.current = next;
|
|
@@ -8548,13 +8551,13 @@ Drawer.displayName = "Drawer";
|
|
|
8548
8551
|
var Drawer_default = Drawer;
|
|
8549
8552
|
|
|
8550
8553
|
// src/components/Dropdown/Dropdown.tsx
|
|
8551
|
-
var
|
|
8554
|
+
var import_react22 = __toESM(require("react"), 1);
|
|
8552
8555
|
|
|
8553
8556
|
// src/tokens/hooks/Portal.tsx
|
|
8554
8557
|
var import_react_dom3 = __toESM(require("react-dom"), 1);
|
|
8555
|
-
var Portal = ({ children }) => {
|
|
8558
|
+
var Portal = ({ children, container }) => {
|
|
8556
8559
|
if (typeof document === "undefined") return null;
|
|
8557
|
-
return import_react_dom3.default.createPortal(children, document.body);
|
|
8560
|
+
return import_react_dom3.default.createPortal(children, container ?? document.body);
|
|
8558
8561
|
};
|
|
8559
8562
|
Portal.displayName = "Portal";
|
|
8560
8563
|
var Portal_default = Portal;
|
|
@@ -8584,15 +8587,42 @@ var useClickOutside = (refs, handler, enabled = true) => {
|
|
|
8584
8587
|
};
|
|
8585
8588
|
var useClickOutside_default = useClickOutside;
|
|
8586
8589
|
|
|
8590
|
+
// src/tokens/hooks/useOverlayHost.ts
|
|
8591
|
+
var import_react21 = __toESM(require("react"), 1);
|
|
8592
|
+
var useOverlayHost = (triggerRef, enabled) => {
|
|
8593
|
+
const [host, setHost] = import_react21.default.useState(null);
|
|
8594
|
+
import_react21.default.useLayoutEffect(() => {
|
|
8595
|
+
if (!enabled || !triggerRef.current) {
|
|
8596
|
+
setHost(null);
|
|
8597
|
+
return;
|
|
8598
|
+
}
|
|
8599
|
+
const el = document.createElement("div");
|
|
8600
|
+
el.dataset.xplatOverlayHost = "";
|
|
8601
|
+
el.style.position = "relative";
|
|
8602
|
+
el.style.width = "0";
|
|
8603
|
+
el.style.height = "0";
|
|
8604
|
+
const parent = findScrollParent(triggerRef.current) ?? document.body;
|
|
8605
|
+
parent.appendChild(el);
|
|
8606
|
+
setHost(el);
|
|
8607
|
+
return () => {
|
|
8608
|
+
el.remove();
|
|
8609
|
+
setHost(null);
|
|
8610
|
+
};
|
|
8611
|
+
}, [enabled, triggerRef]);
|
|
8612
|
+
return host;
|
|
8613
|
+
};
|
|
8614
|
+
var useOverlayHost_default = useOverlayHost;
|
|
8615
|
+
|
|
8587
8616
|
// src/components/Dropdown/Dropdown.tsx
|
|
8588
8617
|
var import_jsx_runtime322 = require("react/jsx-runtime");
|
|
8589
8618
|
var Dropdown = (props) => {
|
|
8590
8619
|
const { items, children } = props;
|
|
8591
|
-
const [isOpen, setIsOpen] =
|
|
8592
|
-
const [mounted, setMounted] =
|
|
8593
|
-
const [visible, setVisible] =
|
|
8594
|
-
const triggerRef =
|
|
8595
|
-
const menuRef =
|
|
8620
|
+
const [isOpen, setIsOpen] = import_react22.default.useState(false);
|
|
8621
|
+
const [mounted, setMounted] = import_react22.default.useState(false);
|
|
8622
|
+
const [visible, setVisible] = import_react22.default.useState(false);
|
|
8623
|
+
const triggerRef = import_react22.default.useRef(null);
|
|
8624
|
+
const menuRef = import_react22.default.useRef(null);
|
|
8625
|
+
const host = useOverlayHost_default(triggerRef, mounted);
|
|
8596
8626
|
useAutoPosition_default(triggerRef, menuRef, mounted);
|
|
8597
8627
|
useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false), isOpen);
|
|
8598
8628
|
useCloseWhenFocusHidden(isOpen, triggerRef, menuRef, () => setIsOpen(false));
|
|
@@ -8600,7 +8630,7 @@ var Dropdown = (props) => {
|
|
|
8600
8630
|
setIsOpen(false);
|
|
8601
8631
|
triggerRef.current?.focus({ preventScroll: true });
|
|
8602
8632
|
});
|
|
8603
|
-
|
|
8633
|
+
import_react22.default.useEffect(() => {
|
|
8604
8634
|
if (isOpen) {
|
|
8605
8635
|
setMounted(true);
|
|
8606
8636
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -8625,7 +8655,7 @@ var Dropdown = (props) => {
|
|
|
8625
8655
|
children
|
|
8626
8656
|
}
|
|
8627
8657
|
),
|
|
8628
|
-
mounted && /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
|
|
8658
|
+
mounted && /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(Portal_default, { container: host, children: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
|
|
8629
8659
|
"div",
|
|
8630
8660
|
{
|
|
8631
8661
|
ref: menuRef,
|
|
@@ -8653,7 +8683,7 @@ Dropdown.displayName = "Dropdown";
|
|
|
8653
8683
|
var Dropdown_default = Dropdown;
|
|
8654
8684
|
|
|
8655
8685
|
// src/components/Editor/Editor.tsx
|
|
8656
|
-
var
|
|
8686
|
+
var import_react23 = __toESM(require("react"), 1);
|
|
8657
8687
|
|
|
8658
8688
|
// src/components/Editor/highlight.ts
|
|
8659
8689
|
var CODE_LANGUAGES = [
|
|
@@ -8924,22 +8954,22 @@ var Editor = (props) => {
|
|
|
8924
8954
|
onImageUpload,
|
|
8925
8955
|
minHeight = 200
|
|
8926
8956
|
} = props;
|
|
8927
|
-
const editorRef =
|
|
8928
|
-
const lastRangeRef =
|
|
8929
|
-
const composingRef =
|
|
8930
|
-
const [isFocused, setIsFocused] =
|
|
8931
|
-
const [isEmpty, setIsEmpty] =
|
|
8932
|
-
const [activeFormats, setActiveFormats] =
|
|
8933
|
-
const [slashOpen, setSlashOpen] =
|
|
8934
|
-
const [slashFilter, setSlashFilter] =
|
|
8935
|
-
const [slashIdx, setSlashIdx] =
|
|
8936
|
-
const [slashPos, setSlashPos] =
|
|
8937
|
-
const slashStartRangeRef =
|
|
8938
|
-
const [linkOpen, setLinkOpen] =
|
|
8939
|
-
const [linkValue, setLinkValue] =
|
|
8940
|
-
const [linkPos, setLinkPos] =
|
|
8941
|
-
const lastEmittedRef =
|
|
8942
|
-
|
|
8957
|
+
const editorRef = import_react23.default.useRef(null);
|
|
8958
|
+
const lastRangeRef = import_react23.default.useRef(null);
|
|
8959
|
+
const composingRef = import_react23.default.useRef(false);
|
|
8960
|
+
const [isFocused, setIsFocused] = import_react23.default.useState(false);
|
|
8961
|
+
const [isEmpty, setIsEmpty] = import_react23.default.useState(!value);
|
|
8962
|
+
const [activeFormats, setActiveFormats] = import_react23.default.useState(/* @__PURE__ */ new Set());
|
|
8963
|
+
const [slashOpen, setSlashOpen] = import_react23.default.useState(false);
|
|
8964
|
+
const [slashFilter, setSlashFilter] = import_react23.default.useState("");
|
|
8965
|
+
const [slashIdx, setSlashIdx] = import_react23.default.useState(0);
|
|
8966
|
+
const [slashPos, setSlashPos] = import_react23.default.useState({ top: 0, left: 0 });
|
|
8967
|
+
const slashStartRangeRef = import_react23.default.useRef(null);
|
|
8968
|
+
const [linkOpen, setLinkOpen] = import_react23.default.useState(false);
|
|
8969
|
+
const [linkValue, setLinkValue] = import_react23.default.useState("");
|
|
8970
|
+
const [linkPos, setLinkPos] = import_react23.default.useState({ top: 0, left: 0 });
|
|
8971
|
+
const lastEmittedRef = import_react23.default.useRef(null);
|
|
8972
|
+
import_react23.default.useEffect(() => {
|
|
8943
8973
|
const el = editorRef.current;
|
|
8944
8974
|
if (!el) return;
|
|
8945
8975
|
if (value === lastEmittedRef.current) return;
|
|
@@ -9021,10 +9051,10 @@ var Editor = (props) => {
|
|
|
9021
9051
|
const current = String(document.queryCommandValue("formatBlock") || "").toLowerCase();
|
|
9022
9052
|
setBlock(current === tag ? "p" : tag);
|
|
9023
9053
|
};
|
|
9024
|
-
const historyRef =
|
|
9025
|
-
const historyIdxRef =
|
|
9026
|
-
const lastPushAtRef =
|
|
9027
|
-
const isRestoringRef =
|
|
9054
|
+
const historyRef = import_react23.default.useRef([]);
|
|
9055
|
+
const historyIdxRef = import_react23.default.useRef(-1);
|
|
9056
|
+
const lastPushAtRef = import_react23.default.useRef(0);
|
|
9057
|
+
const isRestoringRef = import_react23.default.useRef(false);
|
|
9028
9058
|
const caretOffset = (rootEl) => {
|
|
9029
9059
|
const el = rootEl ?? editorRef.current;
|
|
9030
9060
|
const sel = window.getSelection();
|
|
@@ -9101,8 +9131,8 @@ var Editor = (props) => {
|
|
|
9101
9131
|
const cls = Array.from(pre.classList).find((c) => c.startsWith("lang-"));
|
|
9102
9132
|
return cls?.slice(5) ?? "plain";
|
|
9103
9133
|
};
|
|
9104
|
-
const [codeLang, setCodeLang] =
|
|
9105
|
-
const highlightRafRef =
|
|
9134
|
+
const [codeLang, setCodeLang] = import_react23.default.useState("plain");
|
|
9135
|
+
const highlightRafRef = import_react23.default.useRef(0);
|
|
9106
9136
|
const rehighlight = (pre) => {
|
|
9107
9137
|
if (composingRef.current) return;
|
|
9108
9138
|
const code = pre.querySelector("code");
|
|
@@ -9447,7 +9477,7 @@ var Editor = (props) => {
|
|
|
9447
9477
|
setSlashIdx(0);
|
|
9448
9478
|
slashStartRangeRef.current = null;
|
|
9449
9479
|
};
|
|
9450
|
-
const filteredSlashItems =
|
|
9480
|
+
const filteredSlashItems = import_react23.default.useMemo(() => {
|
|
9451
9481
|
if (!slashFilter) return SLASH_ITEMS;
|
|
9452
9482
|
const f = slashFilter.toLowerCase();
|
|
9453
9483
|
return SLASH_ITEMS.filter((it) => it.label.toLowerCase().includes(f) || it.key.includes(f));
|
|
@@ -9712,7 +9742,7 @@ var Editor = (props) => {
|
|
|
9712
9742
|
}
|
|
9713
9743
|
}
|
|
9714
9744
|
};
|
|
9715
|
-
const plainPasteRef =
|
|
9745
|
+
const plainPasteRef = import_react23.default.useRef(false);
|
|
9716
9746
|
const handlePaste = (e) => {
|
|
9717
9747
|
if (readOnly) return;
|
|
9718
9748
|
e.preventDefault();
|
|
@@ -10013,7 +10043,7 @@ var EditorToolbar = ({
|
|
|
10013
10043
|
] });
|
|
10014
10044
|
};
|
|
10015
10045
|
var SlashMenu = ({ position, items, activeIndex, onSelect, onClose }) => {
|
|
10016
|
-
|
|
10046
|
+
import_react23.default.useEffect(() => {
|
|
10017
10047
|
const handleClickOutside = (e) => {
|
|
10018
10048
|
const target = e.target;
|
|
10019
10049
|
const menu = document.querySelector(".lib-xplat-editor__slash-menu");
|
|
@@ -10047,8 +10077,8 @@ var SlashMenu = ({ position, items, activeIndex, onSelect, onClose }) => {
|
|
|
10047
10077
|
);
|
|
10048
10078
|
};
|
|
10049
10079
|
var LinkPopover = ({ position, value, onChange, onConfirm, onClose }) => {
|
|
10050
|
-
const inputRef =
|
|
10051
|
-
|
|
10080
|
+
const inputRef = import_react23.default.useRef(null);
|
|
10081
|
+
import_react23.default.useEffect(() => {
|
|
10052
10082
|
inputRef.current?.focus();
|
|
10053
10083
|
}, []);
|
|
10054
10084
|
return /* @__PURE__ */ (0, import_jsx_runtime323.jsxs)(
|
|
@@ -10106,7 +10136,7 @@ EmptyState.displayName = "EmptyState";
|
|
|
10106
10136
|
var EmptyState_default = EmptyState;
|
|
10107
10137
|
|
|
10108
10138
|
// src/components/FileUpload/FileUpload.tsx
|
|
10109
|
-
var
|
|
10139
|
+
var import_react24 = __toESM(require("react"), 1);
|
|
10110
10140
|
var import_jsx_runtime325 = require("react/jsx-runtime");
|
|
10111
10141
|
var FileUpload = (props) => {
|
|
10112
10142
|
const {
|
|
@@ -10120,9 +10150,9 @@ var FileUpload = (props) => {
|
|
|
10120
10150
|
label,
|
|
10121
10151
|
required
|
|
10122
10152
|
} = props;
|
|
10123
|
-
const fieldId =
|
|
10124
|
-
const [isDragOver, setIsDragOver] =
|
|
10125
|
-
const inputRef =
|
|
10153
|
+
const fieldId = import_react24.default.useId();
|
|
10154
|
+
const [isDragOver, setIsDragOver] = import_react24.default.useState(false);
|
|
10155
|
+
const inputRef = import_react24.default.useRef(null);
|
|
10126
10156
|
const handleFiles = (fileList) => {
|
|
10127
10157
|
let files = Array.from(fileList);
|
|
10128
10158
|
if (maxSize) {
|
|
@@ -10185,10 +10215,10 @@ FileUpload.displayName = "FileUpload";
|
|
|
10185
10215
|
var FileUpload_default = FileUpload;
|
|
10186
10216
|
|
|
10187
10217
|
// src/components/HtmlTypeWriter/HtmlTypeWriter.tsx
|
|
10188
|
-
var
|
|
10218
|
+
var import_react26 = __toESM(require("react"), 1);
|
|
10189
10219
|
|
|
10190
10220
|
// src/components/HtmlTypeWriter/utils.ts
|
|
10191
|
-
var
|
|
10221
|
+
var import_react25 = __toESM(require("react"), 1);
|
|
10192
10222
|
var voidTags = /* @__PURE__ */ new Set([
|
|
10193
10223
|
"br",
|
|
10194
10224
|
"img",
|
|
@@ -10256,15 +10286,15 @@ var convertNodeToReactWithRange = (node, typedLen, rangeMap) => {
|
|
|
10256
10286
|
props[attr.name] = attr.value;
|
|
10257
10287
|
});
|
|
10258
10288
|
if (voidTags.has(tag)) {
|
|
10259
|
-
return
|
|
10289
|
+
return import_react25.default.createElement(tag, props);
|
|
10260
10290
|
}
|
|
10261
10291
|
const children = Array.from(element.childNodes).map((child) => convertNodeToReactWithRange(child, typedLen, rangeMap)).filter((n) => n != null);
|
|
10262
|
-
return
|
|
10292
|
+
return import_react25.default.createElement(tag, props, ...children);
|
|
10263
10293
|
};
|
|
10264
10294
|
var htmlToReactProgressive = (root, typedLen, rangeMap) => {
|
|
10265
10295
|
const nodes = Array.from(root.childNodes).map((child, idx) => {
|
|
10266
10296
|
const node = convertNodeToReactWithRange(child, typedLen, rangeMap);
|
|
10267
|
-
return node == null ? null :
|
|
10297
|
+
return node == null ? null : import_react25.default.createElement(import_react25.default.Fragment, { key: idx }, node);
|
|
10268
10298
|
}).filter(Boolean);
|
|
10269
10299
|
return nodes.length === 0 ? null : nodes;
|
|
10270
10300
|
};
|
|
@@ -10277,20 +10307,20 @@ var HtmlTypeWriter = ({
|
|
|
10277
10307
|
onDone,
|
|
10278
10308
|
onChange
|
|
10279
10309
|
}) => {
|
|
10280
|
-
const [typedLen, setTypedLen] =
|
|
10281
|
-
const doneCalledRef =
|
|
10282
|
-
const { doc, rangeMap, totalLength } =
|
|
10310
|
+
const [typedLen, setTypedLen] = import_react26.default.useState(0);
|
|
10311
|
+
const doneCalledRef = import_react26.default.useRef(false);
|
|
10312
|
+
const { doc, rangeMap, totalLength } = import_react26.default.useMemo(() => {
|
|
10283
10313
|
if (typeof window === "undefined") return { doc: null, rangeMap: /* @__PURE__ */ new Map(), totalLength: 0 };
|
|
10284
10314
|
const decoded = decodeHtmlEntities(html);
|
|
10285
10315
|
const doc2 = new DOMParser().parseFromString(decoded, "text/html");
|
|
10286
10316
|
const { rangeMap: rangeMap2, totalLength: totalLength2 } = buildRangeMap(doc2.body);
|
|
10287
10317
|
return { doc: doc2, rangeMap: rangeMap2, totalLength: totalLength2 };
|
|
10288
10318
|
}, [html]);
|
|
10289
|
-
|
|
10319
|
+
import_react26.default.useEffect(() => {
|
|
10290
10320
|
setTypedLen(0);
|
|
10291
10321
|
doneCalledRef.current = false;
|
|
10292
10322
|
}, [html]);
|
|
10293
|
-
|
|
10323
|
+
import_react26.default.useEffect(() => {
|
|
10294
10324
|
if (!totalLength) return;
|
|
10295
10325
|
if (typedLen >= totalLength) return;
|
|
10296
10326
|
const timer = window.setInterval(() => {
|
|
@@ -10298,18 +10328,18 @@ var HtmlTypeWriter = ({
|
|
|
10298
10328
|
}, duration);
|
|
10299
10329
|
return () => window.clearInterval(timer);
|
|
10300
10330
|
}, [typedLen, totalLength, duration]);
|
|
10301
|
-
|
|
10331
|
+
import_react26.default.useEffect(() => {
|
|
10302
10332
|
if (typedLen > 0 && typedLen < totalLength) {
|
|
10303
10333
|
onChange?.();
|
|
10304
10334
|
}
|
|
10305
10335
|
}, [typedLen, totalLength, onChange]);
|
|
10306
|
-
|
|
10336
|
+
import_react26.default.useEffect(() => {
|
|
10307
10337
|
if (typedLen === totalLength && totalLength > 0 && !doneCalledRef.current) {
|
|
10308
10338
|
doneCalledRef.current = true;
|
|
10309
10339
|
onDone?.();
|
|
10310
10340
|
}
|
|
10311
10341
|
}, [typedLen, totalLength, onDone]);
|
|
10312
|
-
const parsed =
|
|
10342
|
+
const parsed = import_react26.default.useMemo(
|
|
10313
10343
|
() => doc ? htmlToReactProgressive(doc.body, typedLen, rangeMap) : null,
|
|
10314
10344
|
[doc, typedLen, rangeMap]
|
|
10315
10345
|
);
|
|
@@ -10319,13 +10349,13 @@ HtmlTypeWriter.displayName = "HtmlTypeWriter";
|
|
|
10319
10349
|
var HtmlTypeWriter_default = HtmlTypeWriter;
|
|
10320
10350
|
|
|
10321
10351
|
// src/components/ImageSelector/ImageSelector.tsx
|
|
10322
|
-
var
|
|
10352
|
+
var import_react27 = __toESM(require("react"), 1);
|
|
10323
10353
|
var import_jsx_runtime327 = require("react/jsx-runtime");
|
|
10324
10354
|
var ImageSelector = (props) => {
|
|
10325
10355
|
const { value, placeholder, onChange, validations, label, required } = props;
|
|
10326
|
-
const fieldId =
|
|
10327
|
-
const [previewUrl, setPreviewUrl] =
|
|
10328
|
-
|
|
10356
|
+
const fieldId = import_react27.default.useId();
|
|
10357
|
+
const [previewUrl, setPreviewUrl] = import_react27.default.useState();
|
|
10358
|
+
import_react27.default.useEffect(() => {
|
|
10329
10359
|
if (!value) {
|
|
10330
10360
|
setPreviewUrl(void 0);
|
|
10331
10361
|
return;
|
|
@@ -10334,7 +10364,7 @@ var ImageSelector = (props) => {
|
|
|
10334
10364
|
setPreviewUrl(url);
|
|
10335
10365
|
return () => URL.revokeObjectURL(url);
|
|
10336
10366
|
}, [value]);
|
|
10337
|
-
const inputRef =
|
|
10367
|
+
const inputRef = import_react27.default.useRef(null);
|
|
10338
10368
|
const handleFileChange = (e) => {
|
|
10339
10369
|
const selectedFile = e.target.files?.[0];
|
|
10340
10370
|
if (selectedFile) {
|
|
@@ -10517,22 +10547,23 @@ Pagination.displayName = "Pagination";
|
|
|
10517
10547
|
var Pagination_default = Pagination;
|
|
10518
10548
|
|
|
10519
10549
|
// src/components/PopOver/PopOver.tsx
|
|
10520
|
-
var
|
|
10550
|
+
var import_react28 = __toESM(require("react"), 1);
|
|
10521
10551
|
var import_jsx_runtime332 = require("react/jsx-runtime");
|
|
10522
10552
|
var PopOver = (props) => {
|
|
10523
10553
|
const { children, isOpen, onClose, PopOverEl } = props;
|
|
10524
|
-
const popRef =
|
|
10525
|
-
const triggerRef =
|
|
10526
|
-
const [localOpen, setLocalOpen] =
|
|
10527
|
-
const [eventTrigger, setEventTrigger] =
|
|
10554
|
+
const popRef = import_react28.default.useRef(null);
|
|
10555
|
+
const triggerRef = import_react28.default.useRef(null);
|
|
10556
|
+
const [localOpen, setLocalOpen] = import_react28.default.useState(false);
|
|
10557
|
+
const [eventTrigger, setEventTrigger] = import_react28.default.useState(false);
|
|
10528
10558
|
useClickOutside_default([popRef, triggerRef], onClose, isOpen);
|
|
10529
10559
|
useCloseWhenFocusHidden(isOpen, triggerRef, popRef, onClose);
|
|
10530
10560
|
useEscapeKey(isOpen, () => {
|
|
10531
10561
|
onClose();
|
|
10532
10562
|
triggerRef.current?.focus({ preventScroll: true });
|
|
10533
10563
|
});
|
|
10564
|
+
const host = useOverlayHost_default(triggerRef, localOpen);
|
|
10534
10565
|
useAutoPosition_default(triggerRef, popRef, localOpen);
|
|
10535
|
-
|
|
10566
|
+
import_react28.default.useEffect(() => {
|
|
10536
10567
|
if (isOpen) {
|
|
10537
10568
|
setLocalOpen(isOpen);
|
|
10538
10569
|
setTimeout(() => {
|
|
@@ -10555,7 +10586,7 @@ var PopOver = (props) => {
|
|
|
10555
10586
|
},
|
|
10556
10587
|
children: [
|
|
10557
10588
|
children,
|
|
10558
|
-
localOpen && /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(
|
|
10589
|
+
localOpen && /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(Portal_default, { container: host, children: /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(
|
|
10559
10590
|
"div",
|
|
10560
10591
|
{
|
|
10561
10592
|
className: clsx_default(
|
|
@@ -10613,12 +10644,12 @@ Progress.displayName = "Progress";
|
|
|
10613
10644
|
var Progress_default = Progress;
|
|
10614
10645
|
|
|
10615
10646
|
// src/components/Radio/RadioGroupContext.tsx
|
|
10616
|
-
var
|
|
10617
|
-
var RadioGroupContext =
|
|
10647
|
+
var import_react29 = __toESM(require("react"), 1);
|
|
10648
|
+
var RadioGroupContext = import_react29.default.createContext(
|
|
10618
10649
|
null
|
|
10619
10650
|
);
|
|
10620
10651
|
var useRadioGroupContext = () => {
|
|
10621
|
-
return
|
|
10652
|
+
return import_react29.default.useContext(RadioGroupContext);
|
|
10622
10653
|
};
|
|
10623
10654
|
var RadioGroupContext_default = RadioGroupContext;
|
|
10624
10655
|
|
|
@@ -10694,19 +10725,19 @@ RadioGroup.displayName = "RadioGroup";
|
|
|
10694
10725
|
var RadioGroup_default = RadioGroup;
|
|
10695
10726
|
|
|
10696
10727
|
// src/components/Select/Select.tsx
|
|
10697
|
-
var
|
|
10728
|
+
var import_react32 = __toESM(require("react"), 1);
|
|
10698
10729
|
|
|
10699
10730
|
// src/components/Select/context.ts
|
|
10700
|
-
var
|
|
10701
|
-
var SelectContext =
|
|
10731
|
+
var import_react30 = __toESM(require("react"), 1);
|
|
10732
|
+
var SelectContext = import_react30.default.createContext(null);
|
|
10702
10733
|
var context_default = SelectContext;
|
|
10703
10734
|
|
|
10704
10735
|
// src/components/Select/SelectItem.tsx
|
|
10705
|
-
var
|
|
10736
|
+
var import_react31 = __toESM(require("react"), 1);
|
|
10706
10737
|
var import_jsx_runtime336 = require("react/jsx-runtime");
|
|
10707
10738
|
var SelectItem = (props) => {
|
|
10708
10739
|
const { children, value, onClick, disabled = false } = props;
|
|
10709
|
-
const ctx =
|
|
10740
|
+
const ctx = import_react31.default.useContext(context_default);
|
|
10710
10741
|
const handleClick = (e) => {
|
|
10711
10742
|
e.preventDefault();
|
|
10712
10743
|
e.stopPropagation();
|
|
@@ -10756,29 +10787,29 @@ var SelectRoot = (props) => {
|
|
|
10756
10787
|
required,
|
|
10757
10788
|
size = "md"
|
|
10758
10789
|
} = props;
|
|
10759
|
-
const fieldId =
|
|
10760
|
-
const itemChildren =
|
|
10761
|
-
(child) =>
|
|
10790
|
+
const fieldId = import_react32.default.useId();
|
|
10791
|
+
const itemChildren = import_react32.default.Children.toArray(children).filter(
|
|
10792
|
+
(child) => import_react32.default.isValidElement(child) && child.type === SelectItem_default
|
|
10762
10793
|
);
|
|
10763
10794
|
const isControlled = valueProp !== void 0;
|
|
10764
|
-
const [isOpen, setOpen] =
|
|
10765
|
-
const [uncontrolledLabel, setUncontrolledLabel] =
|
|
10766
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
10767
|
-
const controlledLabel =
|
|
10795
|
+
const [isOpen, setOpen] = import_react32.default.useState(false);
|
|
10796
|
+
const [uncontrolledLabel, setUncontrolledLabel] = import_react32.default.useState(null);
|
|
10797
|
+
const [uncontrolledValue, setUncontrolledValue] = import_react32.default.useState(void 0);
|
|
10798
|
+
const controlledLabel = import_react32.default.useMemo(() => {
|
|
10768
10799
|
if (!isControlled) return null;
|
|
10769
10800
|
const match = itemChildren.find((child) => child.props.value === valueProp);
|
|
10770
10801
|
return match ? match.props.children : null;
|
|
10771
10802
|
}, [isControlled, valueProp, itemChildren]);
|
|
10772
10803
|
const selectedLabel = isControlled ? controlledLabel : uncontrolledLabel;
|
|
10773
10804
|
const selectedValue = isControlled ? valueProp : uncontrolledValue;
|
|
10774
|
-
const triggerRef =
|
|
10775
|
-
const contentRef =
|
|
10776
|
-
const [mounted, setMounted] =
|
|
10777
|
-
const [visible, setVisible] =
|
|
10778
|
-
|
|
10805
|
+
const triggerRef = import_react32.default.useRef(null);
|
|
10806
|
+
const contentRef = import_react32.default.useRef(null);
|
|
10807
|
+
const [mounted, setMounted] = import_react32.default.useState(false);
|
|
10808
|
+
const [visible, setVisible] = import_react32.default.useState(false);
|
|
10809
|
+
import_react32.default.useEffect(() => {
|
|
10779
10810
|
if (disabled && isOpen) setOpen(false);
|
|
10780
10811
|
}, [disabled, isOpen]);
|
|
10781
|
-
|
|
10812
|
+
import_react32.default.useEffect(() => {
|
|
10782
10813
|
if (isOpen) {
|
|
10783
10814
|
setMounted(true);
|
|
10784
10815
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -10788,33 +10819,34 @@ var SelectRoot = (props) => {
|
|
|
10788
10819
|
const t = setTimeout(() => setMounted(false), ANIMATION_DURATION_MS3);
|
|
10789
10820
|
return () => clearTimeout(t);
|
|
10790
10821
|
}, [isOpen]);
|
|
10791
|
-
const [query, setQuery] =
|
|
10822
|
+
const [query, setQuery] = import_react32.default.useState("");
|
|
10792
10823
|
const textOf = (node) => {
|
|
10793
10824
|
if (node === null || node === void 0 || typeof node === "boolean") return "";
|
|
10794
10825
|
if (typeof node === "string" || typeof node === "number") return String(node);
|
|
10795
10826
|
if (Array.isArray(node)) return node.map(textOf).join("");
|
|
10796
|
-
if (
|
|
10827
|
+
if (import_react32.default.isValidElement(node)) return textOf(node.props.children);
|
|
10797
10828
|
return "";
|
|
10798
10829
|
};
|
|
10799
|
-
const visibleItems =
|
|
10830
|
+
const visibleItems = import_react32.default.useMemo(() => {
|
|
10800
10831
|
if (!searchable || !query.trim()) return itemChildren;
|
|
10801
10832
|
const q = query.trim().toLowerCase();
|
|
10802
10833
|
return itemChildren.filter((c) => textOf(c.props.children).toLowerCase().includes(q));
|
|
10803
10834
|
}, [searchable, query, itemChildren]);
|
|
10804
|
-
const open =
|
|
10805
|
-
const close =
|
|
10835
|
+
const open = import_react32.default.useCallback(() => setOpen(true), []);
|
|
10836
|
+
const close = import_react32.default.useCallback(() => {
|
|
10806
10837
|
setOpen(false);
|
|
10807
10838
|
setQuery("");
|
|
10808
10839
|
}, []);
|
|
10809
|
-
const toggle =
|
|
10840
|
+
const toggle = import_react32.default.useCallback(() => setOpen((prev) => !prev), []);
|
|
10810
10841
|
useClickOutside_default([contentRef, triggerRef], close, isOpen);
|
|
10811
10842
|
useCloseWhenFocusHidden(isOpen, triggerRef, contentRef, close);
|
|
10812
10843
|
useEscapeKey(isOpen, () => {
|
|
10813
10844
|
close();
|
|
10814
10845
|
triggerRef.current?.focus({ preventScroll: true });
|
|
10815
10846
|
});
|
|
10847
|
+
const host = useOverlayHost_default(triggerRef, mounted);
|
|
10816
10848
|
useAutoPosition_default(triggerRef, contentRef, mounted);
|
|
10817
|
-
const setSelected =
|
|
10849
|
+
const setSelected = import_react32.default.useCallback(
|
|
10818
10850
|
(label2, itemValue) => {
|
|
10819
10851
|
if (!isControlled) {
|
|
10820
10852
|
setUncontrolledLabel(label2);
|
|
@@ -10824,7 +10856,7 @@ var SelectRoot = (props) => {
|
|
|
10824
10856
|
},
|
|
10825
10857
|
[isControlled, onChange]
|
|
10826
10858
|
);
|
|
10827
|
-
const ctxValue =
|
|
10859
|
+
const ctxValue = import_react32.default.useMemo(
|
|
10828
10860
|
() => ({
|
|
10829
10861
|
isOpen,
|
|
10830
10862
|
mounted,
|
|
@@ -10903,7 +10935,7 @@ var SelectRoot = (props) => {
|
|
|
10903
10935
|
]
|
|
10904
10936
|
}
|
|
10905
10937
|
),
|
|
10906
|
-
mounted && /* @__PURE__ */ (0, import_jsx_runtime337.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime337.jsxs)(
|
|
10938
|
+
mounted && /* @__PURE__ */ (0, import_jsx_runtime337.jsx)(Portal_default, { container: host, children: /* @__PURE__ */ (0, import_jsx_runtime337.jsxs)(
|
|
10907
10939
|
"div",
|
|
10908
10940
|
{
|
|
10909
10941
|
className: clsx_default("lib-xplat-select-content", size, stateClass),
|
|
@@ -11069,7 +11101,7 @@ Steps.displayName = "Steps";
|
|
|
11069
11101
|
var Steps_default = Steps;
|
|
11070
11102
|
|
|
11071
11103
|
// src/components/Swiper/Swiper.tsx
|
|
11072
|
-
var
|
|
11104
|
+
var import_react33 = __toESM(require("react"), 1);
|
|
11073
11105
|
var import_jsx_runtime342 = require("react/jsx-runtime");
|
|
11074
11106
|
var Swiper = (props) => {
|
|
11075
11107
|
const {
|
|
@@ -11094,26 +11126,26 @@ var Swiper = (props) => {
|
|
|
11094
11126
|
const maxIndex = Math.max(0, totalSlides - viewItemCount);
|
|
11095
11127
|
const useLoop = loop && canSlide;
|
|
11096
11128
|
const cloneCount = useLoop ? totalSlides : 0;
|
|
11097
|
-
const extendedItems =
|
|
11129
|
+
const extendedItems = import_react33.default.useMemo(() => {
|
|
11098
11130
|
if (!useLoop) return items;
|
|
11099
11131
|
return [...items, ...items, ...items];
|
|
11100
11132
|
}, [items, useLoop]);
|
|
11101
11133
|
const initialIdx = Math.max(0, Math.min(indexProp ?? 0, maxIndex));
|
|
11102
|
-
const [innerIndex, setInnerIndex] =
|
|
11134
|
+
const [innerIndex, setInnerIndex] = import_react33.default.useState(
|
|
11103
11135
|
useLoop ? cloneCount + initialIdx : initialIdx
|
|
11104
11136
|
);
|
|
11105
|
-
const [isDragging, setIsDragging] =
|
|
11106
|
-
const [dragOffset, setDragOffset] =
|
|
11107
|
-
const [animated, setAnimated] =
|
|
11108
|
-
const [containerWidth, setContainerWidth] =
|
|
11109
|
-
const containerRef =
|
|
11110
|
-
const startXRef =
|
|
11111
|
-
const startTimeRef =
|
|
11112
|
-
const autoplayTimerRef =
|
|
11113
|
-
const resumeTimeoutRef =
|
|
11114
|
-
const [paused, setPaused] =
|
|
11115
|
-
const initializedRef =
|
|
11116
|
-
|
|
11137
|
+
const [isDragging, setIsDragging] = import_react33.default.useState(false);
|
|
11138
|
+
const [dragOffset, setDragOffset] = import_react33.default.useState(0);
|
|
11139
|
+
const [animated, setAnimated] = import_react33.default.useState(false);
|
|
11140
|
+
const [containerWidth, setContainerWidth] = import_react33.default.useState(0);
|
|
11141
|
+
const containerRef = import_react33.default.useRef(null);
|
|
11142
|
+
const startXRef = import_react33.default.useRef(0);
|
|
11143
|
+
const startTimeRef = import_react33.default.useRef(0);
|
|
11144
|
+
const autoplayTimerRef = import_react33.default.useRef(null);
|
|
11145
|
+
const resumeTimeoutRef = import_react33.default.useRef(null);
|
|
11146
|
+
const [paused, setPaused] = import_react33.default.useState(false);
|
|
11147
|
+
const initializedRef = import_react33.default.useRef(false);
|
|
11148
|
+
import_react33.default.useEffect(() => {
|
|
11117
11149
|
const el = containerRef.current;
|
|
11118
11150
|
if (!el) return;
|
|
11119
11151
|
const ro = new ResizeObserver((entries) => {
|
|
@@ -11136,7 +11168,7 @@ var Swiper = (props) => {
|
|
|
11136
11168
|
return ((inner - cloneCount) % totalSlides + totalSlides) % totalSlides;
|
|
11137
11169
|
};
|
|
11138
11170
|
const realIndex = getRealIndex(innerIndex);
|
|
11139
|
-
const moveToInner =
|
|
11171
|
+
const moveToInner = import_react33.default.useCallback(
|
|
11140
11172
|
(idx, withAnim = true) => {
|
|
11141
11173
|
if (!useLoop) {
|
|
11142
11174
|
setAnimated(withAnim);
|
|
@@ -11164,7 +11196,7 @@ var Swiper = (props) => {
|
|
|
11164
11196
|
},
|
|
11165
11197
|
[useLoop, cloneCount, totalSlides]
|
|
11166
11198
|
);
|
|
11167
|
-
const handleTransitionEnd =
|
|
11199
|
+
const handleTransitionEnd = import_react33.default.useCallback(() => {
|
|
11168
11200
|
if (!useLoop) return;
|
|
11169
11201
|
const real = getRealIndex(innerIndex);
|
|
11170
11202
|
const canonical = cloneCount + real;
|
|
@@ -11174,7 +11206,7 @@ var Swiper = (props) => {
|
|
|
11174
11206
|
}
|
|
11175
11207
|
onChange?.(Math.min(real, maxIndex));
|
|
11176
11208
|
}, [useLoop, innerIndex, cloneCount, totalSlides, maxIndex, onChange]);
|
|
11177
|
-
const slideTo =
|
|
11209
|
+
const slideTo = import_react33.default.useCallback(
|
|
11178
11210
|
(logicalIndex) => {
|
|
11179
11211
|
if (!canSlide) return;
|
|
11180
11212
|
const clamped = useLoop ? logicalIndex : Math.max(0, Math.min(logicalIndex, maxIndex));
|
|
@@ -11184,7 +11216,7 @@ var Swiper = (props) => {
|
|
|
11184
11216
|
},
|
|
11185
11217
|
[canSlide, useLoop, cloneCount, maxIndex, onChange, moveToInner]
|
|
11186
11218
|
);
|
|
11187
|
-
const slideNext =
|
|
11219
|
+
const slideNext = import_react33.default.useCallback(() => {
|
|
11188
11220
|
if (!canSlide) return;
|
|
11189
11221
|
const nextInner = innerIndex + slideBy;
|
|
11190
11222
|
if (useLoop) {
|
|
@@ -11193,7 +11225,7 @@ var Swiper = (props) => {
|
|
|
11193
11225
|
moveToInner(Math.min(nextInner, maxIndex), true);
|
|
11194
11226
|
}
|
|
11195
11227
|
}, [canSlide, useLoop, innerIndex, slideBy, maxIndex, moveToInner]);
|
|
11196
|
-
const slidePrev =
|
|
11228
|
+
const slidePrev = import_react33.default.useCallback(() => {
|
|
11197
11229
|
if (!canSlide) return;
|
|
11198
11230
|
const prevInner = innerIndex - slideBy;
|
|
11199
11231
|
if (useLoop) {
|
|
@@ -11202,7 +11234,7 @@ var Swiper = (props) => {
|
|
|
11202
11234
|
moveToInner(Math.max(prevInner, 0), true);
|
|
11203
11235
|
}
|
|
11204
11236
|
}, [canSlide, useLoop, innerIndex, slideBy, moveToInner]);
|
|
11205
|
-
|
|
11237
|
+
import_react33.default.useEffect(() => {
|
|
11206
11238
|
if (indexProp === void 0) return;
|
|
11207
11239
|
const clamped = Math.max(0, Math.min(indexProp, maxIndex));
|
|
11208
11240
|
const target = useLoop ? cloneCount + clamped : clamped;
|
|
@@ -11210,12 +11242,12 @@ var Swiper = (props) => {
|
|
|
11210
11242
|
moveToInner(target, true);
|
|
11211
11243
|
}
|
|
11212
11244
|
}, [indexProp]);
|
|
11213
|
-
|
|
11245
|
+
import_react33.default.useImperativeHandle(swiperRef, () => ({
|
|
11214
11246
|
slidePrev,
|
|
11215
11247
|
slideNext,
|
|
11216
11248
|
slideTo
|
|
11217
11249
|
}));
|
|
11218
|
-
|
|
11250
|
+
import_react33.default.useEffect(() => {
|
|
11219
11251
|
if (!auto || !canSlide || paused) return;
|
|
11220
11252
|
autoplayTimerRef.current = setInterval(slideNext, autoplayDelay);
|
|
11221
11253
|
return () => {
|
|
@@ -11241,7 +11273,7 @@ var Swiper = (props) => {
|
|
|
11241
11273
|
resumeTimeoutRef.current = null;
|
|
11242
11274
|
}, pauseOnInteraction);
|
|
11243
11275
|
};
|
|
11244
|
-
|
|
11276
|
+
import_react33.default.useEffect(() => {
|
|
11245
11277
|
return () => {
|
|
11246
11278
|
if (resumeTimeoutRef.current) clearTimeout(resumeTimeoutRef.current);
|
|
11247
11279
|
};
|
|
@@ -11259,7 +11291,7 @@ var Swiper = (props) => {
|
|
|
11259
11291
|
startXRef.current = getClientX(e);
|
|
11260
11292
|
startTimeRef.current = Date.now();
|
|
11261
11293
|
};
|
|
11262
|
-
|
|
11294
|
+
import_react33.default.useEffect(() => {
|
|
11263
11295
|
if (!isDragging) return;
|
|
11264
11296
|
const handleMove = (e) => {
|
|
11265
11297
|
setDragOffset(getClientX(e) - startXRef.current);
|
|
@@ -11298,7 +11330,7 @@ var Swiper = (props) => {
|
|
|
11298
11330
|
}, [isDragging, dragOffset, innerIndex, useLoop, maxIndex, slideStep, moveToInner]);
|
|
11299
11331
|
const slideWidthPercent = 100 / viewItemCount;
|
|
11300
11332
|
const gapAdjust = spaceBetween * (viewItemCount - 1) / viewItemCount;
|
|
11301
|
-
const slideElements =
|
|
11333
|
+
const slideElements = import_react33.default.useMemo(
|
|
11302
11334
|
() => extendedItems.map((item, idx) => /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(
|
|
11303
11335
|
"div",
|
|
11304
11336
|
{
|
|
@@ -11372,7 +11404,7 @@ Swiper.displayName = "Swiper";
|
|
|
11372
11404
|
var Swiper_default = Swiper;
|
|
11373
11405
|
|
|
11374
11406
|
// src/components/Switch/Switch.tsx
|
|
11375
|
-
var
|
|
11407
|
+
var import_react34 = __toESM(require("react"), 1);
|
|
11376
11408
|
var import_jsx_runtime343 = require("react/jsx-runtime");
|
|
11377
11409
|
var KNOB_TRANSITION_MS = 250;
|
|
11378
11410
|
var Switch = (props) => {
|
|
@@ -11386,11 +11418,11 @@ var Switch = (props) => {
|
|
|
11386
11418
|
label,
|
|
11387
11419
|
required
|
|
11388
11420
|
} = props;
|
|
11389
|
-
const fieldId =
|
|
11421
|
+
const fieldId = import_react34.default.useId();
|
|
11390
11422
|
const statusType = normalizeStatus(type);
|
|
11391
|
-
const [isAnimating, setIsAnimating] =
|
|
11392
|
-
const timeoutRef =
|
|
11393
|
-
|
|
11423
|
+
const [isAnimating, setIsAnimating] = import_react34.default.useState(false);
|
|
11424
|
+
const timeoutRef = import_react34.default.useRef(null);
|
|
11425
|
+
import_react34.default.useEffect(() => {
|
|
11394
11426
|
return () => {
|
|
11395
11427
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
11396
11428
|
};
|
|
@@ -11429,10 +11461,10 @@ Switch.displayName = "Switch";
|
|
|
11429
11461
|
var Switch_default = Switch;
|
|
11430
11462
|
|
|
11431
11463
|
// src/components/Table/TableContext.tsx
|
|
11432
|
-
var
|
|
11433
|
-
var TableContext =
|
|
11464
|
+
var import_react35 = __toESM(require("react"), 1);
|
|
11465
|
+
var TableContext = import_react35.default.createContext(null);
|
|
11434
11466
|
var useTableContext = () => {
|
|
11435
|
-
const ctx =
|
|
11467
|
+
const ctx = import_react35.default.useContext(TableContext);
|
|
11436
11468
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
11437
11469
|
return ctx;
|
|
11438
11470
|
};
|
|
@@ -11449,18 +11481,25 @@ var Table = (props) => {
|
|
|
11449
11481
|
headerSticky = false,
|
|
11450
11482
|
stickyShadow = true
|
|
11451
11483
|
} = props;
|
|
11452
|
-
return /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
11453
|
-
|
|
11484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
11485
|
+
"div",
|
|
11454
11486
|
{
|
|
11455
|
-
|
|
11456
|
-
|
|
11457
|
-
|
|
11458
|
-
|
|
11459
|
-
|
|
11460
|
-
|
|
11461
|
-
|
|
11487
|
+
className: `lib-xplat-table-wrapper ${size}`,
|
|
11488
|
+
"data-xplat-overlay-escape": "",
|
|
11489
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
11490
|
+
TableContext_default.Provider,
|
|
11491
|
+
{
|
|
11492
|
+
value: {
|
|
11493
|
+
rowBorderUse,
|
|
11494
|
+
colBorderUse,
|
|
11495
|
+
headerSticky,
|
|
11496
|
+
stickyShadow
|
|
11497
|
+
},
|
|
11498
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)("table", { className: "lib-xplat-table", children })
|
|
11499
|
+
}
|
|
11500
|
+
)
|
|
11462
11501
|
}
|
|
11463
|
-
)
|
|
11502
|
+
);
|
|
11464
11503
|
};
|
|
11465
11504
|
Table.displayName = "Table";
|
|
11466
11505
|
var Table_default = Table;
|
|
@@ -11475,24 +11514,24 @@ TableBody.displayName = "TableBody";
|
|
|
11475
11514
|
var TableBody_default = TableBody;
|
|
11476
11515
|
|
|
11477
11516
|
// src/components/Table/TableCell.tsx
|
|
11478
|
-
var
|
|
11517
|
+
var import_react38 = __toESM(require("react"), 1);
|
|
11479
11518
|
|
|
11480
11519
|
// src/components/Table/TableHeadContext.tsx
|
|
11481
|
-
var
|
|
11482
|
-
var TableHeadContext =
|
|
11520
|
+
var import_react36 = __toESM(require("react"), 1);
|
|
11521
|
+
var TableHeadContext = import_react36.default.createContext(
|
|
11483
11522
|
null
|
|
11484
11523
|
);
|
|
11485
11524
|
var useTableHeadContext = () => {
|
|
11486
|
-
const ctx =
|
|
11525
|
+
const ctx = import_react36.default.useContext(TableHeadContext);
|
|
11487
11526
|
return ctx;
|
|
11488
11527
|
};
|
|
11489
11528
|
var TableHeadContext_default = TableHeadContext;
|
|
11490
11529
|
|
|
11491
11530
|
// src/components/Table/TableRowContext.tsx
|
|
11492
|
-
var
|
|
11493
|
-
var TableRowContext =
|
|
11531
|
+
var import_react37 = __toESM(require("react"), 1);
|
|
11532
|
+
var TableRowContext = import_react37.default.createContext(null);
|
|
11494
11533
|
var useTableRowContext = () => {
|
|
11495
|
-
const ctx =
|
|
11534
|
+
const ctx = import_react37.default.useContext(TableRowContext);
|
|
11496
11535
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
11497
11536
|
return ctx;
|
|
11498
11537
|
};
|
|
@@ -11500,7 +11539,7 @@ var TableRowContext_default = TableRowContext;
|
|
|
11500
11539
|
|
|
11501
11540
|
// src/components/Table/TableCell.tsx
|
|
11502
11541
|
var import_jsx_runtime346 = require("react/jsx-runtime");
|
|
11503
|
-
var TableCell =
|
|
11542
|
+
var TableCell = import_react38.default.memo((props) => {
|
|
11504
11543
|
const {
|
|
11505
11544
|
children,
|
|
11506
11545
|
align = "center",
|
|
@@ -11514,9 +11553,9 @@ var TableCell = import_react37.default.memo((props) => {
|
|
|
11514
11553
|
const { registerStickyCell, stickyCells } = useTableRowContext();
|
|
11515
11554
|
const { stickyShadow } = useTableContext();
|
|
11516
11555
|
const headContext = useTableHeadContext();
|
|
11517
|
-
const [left, setLeft] =
|
|
11518
|
-
const cellRef =
|
|
11519
|
-
const calculateLeft =
|
|
11556
|
+
const [left, setLeft] = import_react38.default.useState(0);
|
|
11557
|
+
const cellRef = import_react38.default.useRef(null);
|
|
11558
|
+
const calculateLeft = import_react38.default.useCallback(() => {
|
|
11520
11559
|
if (!cellRef.current) return 0;
|
|
11521
11560
|
let totalLeft = 0;
|
|
11522
11561
|
for (const ref of stickyCells) {
|
|
@@ -11525,7 +11564,7 @@ var TableCell = import_react37.default.memo((props) => {
|
|
|
11525
11564
|
}
|
|
11526
11565
|
return totalLeft;
|
|
11527
11566
|
}, [stickyCells]);
|
|
11528
|
-
|
|
11567
|
+
import_react38.default.useEffect(() => {
|
|
11529
11568
|
if (!isSticky || !cellRef.current) return;
|
|
11530
11569
|
registerStickyCell(cellRef);
|
|
11531
11570
|
setLeft(calculateLeft());
|
|
@@ -11583,9 +11622,9 @@ TableHead.displayName = "TableHead";
|
|
|
11583
11622
|
var TableHead_default = TableHead;
|
|
11584
11623
|
|
|
11585
11624
|
// src/components/Table/TableRow.tsx
|
|
11586
|
-
var
|
|
11625
|
+
var import_react39 = __toESM(require("react"), 1);
|
|
11587
11626
|
var import_jsx_runtime348 = require("react/jsx-runtime");
|
|
11588
|
-
var TableRow =
|
|
11627
|
+
var TableRow = import_react39.default.memo((props) => {
|
|
11589
11628
|
const {
|
|
11590
11629
|
children,
|
|
11591
11630
|
type = "secondary",
|
|
@@ -11594,7 +11633,7 @@ var TableRow = import_react38.default.memo((props) => {
|
|
|
11594
11633
|
onClick
|
|
11595
11634
|
} = props;
|
|
11596
11635
|
const { rowBorderUse } = useTableContext();
|
|
11597
|
-
const [stickyCells, setStickyCells] =
|
|
11636
|
+
const [stickyCells, setStickyCells] = import_react39.default.useState([]);
|
|
11598
11637
|
const registerStickyCell = (ref) => {
|
|
11599
11638
|
setStickyCells((prev) => {
|
|
11600
11639
|
if (prev.includes(ref)) return prev;
|
|
@@ -11658,9 +11697,9 @@ Tag.displayName = "Tag";
|
|
|
11658
11697
|
var Tag_default = Tag;
|
|
11659
11698
|
|
|
11660
11699
|
// src/components/TextArea/TextArea.tsx
|
|
11661
|
-
var
|
|
11700
|
+
var import_react40 = __toESM(require("react"), 1);
|
|
11662
11701
|
var import_jsx_runtime350 = require("react/jsx-runtime");
|
|
11663
|
-
var TextArea =
|
|
11702
|
+
var TextArea = import_react40.default.forwardRef(
|
|
11664
11703
|
(props, ref) => {
|
|
11665
11704
|
const {
|
|
11666
11705
|
className,
|
|
@@ -11673,7 +11712,7 @@ var TextArea = import_react39.default.forwardRef(
|
|
|
11673
11712
|
disabled,
|
|
11674
11713
|
...textareaProps
|
|
11675
11714
|
} = props;
|
|
11676
|
-
const autoId =
|
|
11715
|
+
const autoId = import_react40.default.useId();
|
|
11677
11716
|
const fieldId = props.id ?? autoId;
|
|
11678
11717
|
const control = /* @__PURE__ */ (0, import_jsx_runtime350.jsx)("div", { className: clsx_default("lib-xplat-textarea-wrap", className), children: /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
|
|
11679
11718
|
"textarea",
|
|
@@ -11695,7 +11734,7 @@ TextArea.displayName = "TextArea";
|
|
|
11695
11734
|
var TextArea_default = TextArea;
|
|
11696
11735
|
|
|
11697
11736
|
// src/components/TimePicker/TimePicker.tsx
|
|
11698
|
-
var
|
|
11737
|
+
var import_react41 = __toESM(require("react"), 1);
|
|
11699
11738
|
var import_jsx_runtime351 = require("react/jsx-runtime");
|
|
11700
11739
|
var ANIMATION_DURATION_MS4 = 200;
|
|
11701
11740
|
var toMinutes = (hhmm) => {
|
|
@@ -11733,13 +11772,13 @@ var TimePicker = (props) => {
|
|
|
11733
11772
|
required,
|
|
11734
11773
|
validations
|
|
11735
11774
|
} = props;
|
|
11736
|
-
const fieldId =
|
|
11737
|
-
const triggerRef =
|
|
11738
|
-
const contentRef =
|
|
11739
|
-
const [isOpen, setOpen] =
|
|
11740
|
-
const [mounted, setMounted] =
|
|
11741
|
-
const [visible, setVisible] =
|
|
11742
|
-
const options =
|
|
11775
|
+
const fieldId = import_react41.default.useId();
|
|
11776
|
+
const triggerRef = import_react41.default.useRef(null);
|
|
11777
|
+
const contentRef = import_react41.default.useRef(null);
|
|
11778
|
+
const [isOpen, setOpen] = import_react41.default.useState(false);
|
|
11779
|
+
const [mounted, setMounted] = import_react41.default.useState(false);
|
|
11780
|
+
const [visible, setVisible] = import_react41.default.useState(false);
|
|
11781
|
+
const options = import_react41.default.useMemo(() => {
|
|
11743
11782
|
const safeStep = step > 0 && step <= 720 ? step : 30;
|
|
11744
11783
|
const lo = toMinutes(min) ?? 0;
|
|
11745
11784
|
const hi = toMinutes(max) ?? 24 * 60 - 1;
|
|
@@ -11747,18 +11786,19 @@ var TimePicker = (props) => {
|
|
|
11747
11786
|
for (let t = lo; t <= hi; t += safeStep) out.push(toHHmm(t));
|
|
11748
11787
|
return out;
|
|
11749
11788
|
}, [step, min, max]);
|
|
11750
|
-
const close =
|
|
11789
|
+
const close = import_react41.default.useCallback(() => setOpen(false), []);
|
|
11751
11790
|
useClickOutside_default([triggerRef, contentRef], close, isOpen);
|
|
11752
11791
|
useCloseWhenFocusHidden(isOpen, triggerRef, contentRef, close);
|
|
11753
11792
|
useEscapeKey(isOpen, () => {
|
|
11754
11793
|
close();
|
|
11755
11794
|
triggerRef.current?.focus({ preventScroll: true });
|
|
11756
11795
|
});
|
|
11796
|
+
const host = useOverlayHost_default(triggerRef, mounted);
|
|
11757
11797
|
useAutoPosition_default(triggerRef, contentRef, mounted);
|
|
11758
|
-
|
|
11798
|
+
import_react41.default.useEffect(() => {
|
|
11759
11799
|
if (disabled && isOpen) setOpen(false);
|
|
11760
11800
|
}, [disabled, isOpen]);
|
|
11761
|
-
|
|
11801
|
+
import_react41.default.useEffect(() => {
|
|
11762
11802
|
if (isOpen) {
|
|
11763
11803
|
setMounted(true);
|
|
11764
11804
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -11796,7 +11836,7 @@ var TimePicker = (props) => {
|
|
|
11796
11836
|
children: /* @__PURE__ */ (0, import_jsx_runtime351.jsx)("span", { className: clsx_default("time-picker-value", !value && "placeholder"), children: value ? display(value, use12Hours) : placeholder })
|
|
11797
11837
|
}
|
|
11798
11838
|
),
|
|
11799
|
-
mounted && /* @__PURE__ */ (0, import_jsx_runtime351.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime351.jsx)(
|
|
11839
|
+
mounted && /* @__PURE__ */ (0, import_jsx_runtime351.jsx)(Portal_default, { container: host, children: /* @__PURE__ */ (0, import_jsx_runtime351.jsx)(
|
|
11800
11840
|
"div",
|
|
11801
11841
|
{
|
|
11802
11842
|
ref: contentRef,
|
|
@@ -11830,20 +11870,20 @@ TimePicker.displayName = "TimePicker";
|
|
|
11830
11870
|
var TimePicker_default = TimePicker;
|
|
11831
11871
|
|
|
11832
11872
|
// src/components/Toast/Toast.tsx
|
|
11833
|
-
var
|
|
11873
|
+
var import_react42 = __toESM(require("react"), 1);
|
|
11834
11874
|
var import_react_dom4 = require("react-dom");
|
|
11835
11875
|
var import_jsx_runtime352 = require("react/jsx-runtime");
|
|
11836
|
-
var ToastContext =
|
|
11876
|
+
var ToastContext = import_react42.default.createContext(null);
|
|
11837
11877
|
var useToast = () => {
|
|
11838
|
-
const ctx =
|
|
11878
|
+
const ctx = import_react42.default.useContext(ToastContext);
|
|
11839
11879
|
if (!ctx) throw new Error("useToast must be used within ToastProvider");
|
|
11840
11880
|
return ctx;
|
|
11841
11881
|
};
|
|
11842
11882
|
var EXIT_DURATION = 300;
|
|
11843
11883
|
var ToastItemComponent = ({ item, isExiting, onClose }) => {
|
|
11844
|
-
const ref =
|
|
11845
|
-
const [height, setHeight] =
|
|
11846
|
-
|
|
11884
|
+
const ref = import_react42.default.useRef(null);
|
|
11885
|
+
const [height, setHeight] = import_react42.default.useState(void 0);
|
|
11886
|
+
import_react42.default.useEffect(() => {
|
|
11847
11887
|
if (ref.current && !isExiting) {
|
|
11848
11888
|
setHeight(ref.current.offsetHeight);
|
|
11849
11889
|
}
|
|
@@ -11875,13 +11915,13 @@ var ToastProvider = ({
|
|
|
11875
11915
|
children,
|
|
11876
11916
|
position = "top-right"
|
|
11877
11917
|
}) => {
|
|
11878
|
-
const [toasts, setToasts] =
|
|
11879
|
-
const [removing, setRemoving] =
|
|
11880
|
-
const [mounted, setMounted] =
|
|
11881
|
-
|
|
11918
|
+
const [toasts, setToasts] = import_react42.default.useState([]);
|
|
11919
|
+
const [removing, setRemoving] = import_react42.default.useState(/* @__PURE__ */ new Set());
|
|
11920
|
+
const [mounted, setMounted] = import_react42.default.useState(false);
|
|
11921
|
+
import_react42.default.useEffect(() => {
|
|
11882
11922
|
setMounted(true);
|
|
11883
11923
|
}, []);
|
|
11884
|
-
const remove =
|
|
11924
|
+
const remove = import_react42.default.useCallback((id) => {
|
|
11885
11925
|
setRemoving((prev) => new Set(prev).add(id));
|
|
11886
11926
|
setTimeout(() => {
|
|
11887
11927
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
@@ -11892,7 +11932,7 @@ var ToastProvider = ({
|
|
|
11892
11932
|
});
|
|
11893
11933
|
}, EXIT_DURATION);
|
|
11894
11934
|
}, []);
|
|
11895
|
-
const toast =
|
|
11935
|
+
const toast = import_react42.default.useCallback(
|
|
11896
11936
|
(type, message, duration = 3e3) => {
|
|
11897
11937
|
const id = `${Date.now()}-${Math.random()}`;
|
|
11898
11938
|
setToasts((prev) => [...prev, { id, type, message }]);
|
|
@@ -11945,7 +11985,7 @@ ToggleChip.displayName = "ToggleChip";
|
|
|
11945
11985
|
var ToggleChip_default = ToggleChip;
|
|
11946
11986
|
|
|
11947
11987
|
// src/components/Tooltip/Tooltip.tsx
|
|
11948
|
-
var
|
|
11988
|
+
var import_react43 = __toESM(require("react"), 1);
|
|
11949
11989
|
var import_jsx_runtime354 = require("react/jsx-runtime");
|
|
11950
11990
|
var OFFSET = 12;
|
|
11951
11991
|
var GAP = 8;
|
|
@@ -11961,14 +12001,14 @@ var Tooltip = (props) => {
|
|
|
11961
12001
|
disabled = false
|
|
11962
12002
|
} = props;
|
|
11963
12003
|
const shape = variant ?? type ?? "dark";
|
|
11964
|
-
const triggerRef =
|
|
11965
|
-
const tooltipRef =
|
|
11966
|
-
const [visible, setVisible] =
|
|
11967
|
-
const [pos, setPos] =
|
|
11968
|
-
const delayTimer =
|
|
11969
|
-
const rafRef =
|
|
11970
|
-
const cursor =
|
|
11971
|
-
const clamp =
|
|
12004
|
+
const triggerRef = import_react43.default.useRef(null);
|
|
12005
|
+
const tooltipRef = import_react43.default.useRef(null);
|
|
12006
|
+
const [visible, setVisible] = import_react43.default.useState(false);
|
|
12007
|
+
const [pos, setPos] = import_react43.default.useState({ left: 0, top: 0 });
|
|
12008
|
+
const delayTimer = import_react43.default.useRef(0);
|
|
12009
|
+
const rafRef = import_react43.default.useRef(0);
|
|
12010
|
+
const cursor = import_react43.default.useRef(null);
|
|
12011
|
+
const clamp = import_react43.default.useCallback((left, top, w, h) => {
|
|
11972
12012
|
const vw = window.innerWidth;
|
|
11973
12013
|
const vh = window.innerHeight;
|
|
11974
12014
|
return {
|
|
@@ -11976,7 +12016,7 @@ var Tooltip = (props) => {
|
|
|
11976
12016
|
top: Math.min(Math.max(GAP, top), Math.max(GAP, vh - h - GAP))
|
|
11977
12017
|
};
|
|
11978
12018
|
}, []);
|
|
11979
|
-
const placeAtCursor =
|
|
12019
|
+
const placeAtCursor = import_react43.default.useCallback((x, y) => {
|
|
11980
12020
|
const el = tooltipRef.current;
|
|
11981
12021
|
if (!el) return;
|
|
11982
12022
|
const w = el.offsetWidth;
|
|
@@ -11987,7 +12027,7 @@ var Tooltip = (props) => {
|
|
|
11987
12027
|
if (top < GAP) top = y + OFFSET;
|
|
11988
12028
|
setPos(clamp(left, top, w, h));
|
|
11989
12029
|
}, [clamp]);
|
|
11990
|
-
const placeAtTrigger =
|
|
12030
|
+
const placeAtTrigger = import_react43.default.useCallback(() => {
|
|
11991
12031
|
const el = tooltipRef.current;
|
|
11992
12032
|
const trigger = triggerRef.current;
|
|
11993
12033
|
if (!el || !trigger) return;
|
|
@@ -11999,19 +12039,19 @@ var Tooltip = (props) => {
|
|
|
11999
12039
|
const left = rect.left + rect.width / 2 - w / 2;
|
|
12000
12040
|
setPos(clamp(left, top, w, h));
|
|
12001
12041
|
}, [clamp]);
|
|
12002
|
-
const reposition =
|
|
12042
|
+
const reposition = import_react43.default.useCallback(() => {
|
|
12003
12043
|
if (follow && cursor.current) {
|
|
12004
12044
|
placeAtCursor(cursor.current.x, cursor.current.y);
|
|
12005
12045
|
} else {
|
|
12006
12046
|
placeAtTrigger();
|
|
12007
12047
|
}
|
|
12008
12048
|
}, [follow, placeAtCursor, placeAtTrigger]);
|
|
12009
|
-
const handleMouseEnter =
|
|
12049
|
+
const handleMouseEnter = import_react43.default.useCallback((e) => {
|
|
12010
12050
|
if (disabled) return;
|
|
12011
12051
|
cursor.current = { x: e.clientX, y: e.clientY };
|
|
12012
12052
|
delayTimer.current = window.setTimeout(() => setVisible(true), SHOW_DELAY);
|
|
12013
12053
|
}, [disabled]);
|
|
12014
|
-
const handleMouseMove =
|
|
12054
|
+
const handleMouseMove = import_react43.default.useCallback((e) => {
|
|
12015
12055
|
cursor.current = { x: e.clientX, y: e.clientY };
|
|
12016
12056
|
if (!visible || !follow) return;
|
|
12017
12057
|
cancelAnimationFrame(rafRef.current);
|
|
@@ -12019,25 +12059,25 @@ var Tooltip = (props) => {
|
|
|
12019
12059
|
if (cursor.current) placeAtCursor(cursor.current.x, cursor.current.y);
|
|
12020
12060
|
});
|
|
12021
12061
|
}, [visible, follow, placeAtCursor]);
|
|
12022
|
-
const close =
|
|
12062
|
+
const close = import_react43.default.useCallback(() => {
|
|
12023
12063
|
window.clearTimeout(delayTimer.current);
|
|
12024
12064
|
cancelAnimationFrame(rafRef.current);
|
|
12025
12065
|
setVisible(false);
|
|
12026
12066
|
}, []);
|
|
12027
|
-
const handleMouseLeave =
|
|
12067
|
+
const handleMouseLeave = import_react43.default.useCallback(() => {
|
|
12028
12068
|
cursor.current = null;
|
|
12029
12069
|
close();
|
|
12030
12070
|
}, [close]);
|
|
12031
|
-
const handleFocus =
|
|
12071
|
+
const handleFocus = import_react43.default.useCallback(() => {
|
|
12032
12072
|
if (disabled) return;
|
|
12033
12073
|
cursor.current = null;
|
|
12034
12074
|
setVisible(true);
|
|
12035
12075
|
}, [disabled]);
|
|
12036
|
-
|
|
12076
|
+
import_react43.default.useLayoutEffect(() => {
|
|
12037
12077
|
if (!visible) return;
|
|
12038
12078
|
reposition();
|
|
12039
12079
|
}, [visible, reposition]);
|
|
12040
|
-
|
|
12080
|
+
import_react43.default.useEffect(() => {
|
|
12041
12081
|
if (!visible || follow) return;
|
|
12042
12082
|
const onChange = () => placeAtTrigger();
|
|
12043
12083
|
window.addEventListener("scroll", onChange, true);
|
|
@@ -12047,7 +12087,7 @@ var Tooltip = (props) => {
|
|
|
12047
12087
|
window.removeEventListener("resize", onChange);
|
|
12048
12088
|
};
|
|
12049
12089
|
}, [visible, follow, placeAtTrigger]);
|
|
12050
|
-
|
|
12090
|
+
import_react43.default.useEffect(() => () => {
|
|
12051
12091
|
window.clearTimeout(delayTimer.current);
|
|
12052
12092
|
cancelAnimationFrame(rafRef.current);
|
|
12053
12093
|
}, []);
|
|
@@ -12086,7 +12126,7 @@ Tooltip.displayName = "Tooltip";
|
|
|
12086
12126
|
var Tooltip_default = Tooltip;
|
|
12087
12127
|
|
|
12088
12128
|
// src/components/Video/Video.tsx
|
|
12089
|
-
var
|
|
12129
|
+
var import_react44 = __toESM(require("react"), 1);
|
|
12090
12130
|
var import_jsx_runtime355 = require("react/jsx-runtime");
|
|
12091
12131
|
var PipIcon = () => /* @__PURE__ */ (0, import_jsx_runtime355.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: [
|
|
12092
12132
|
/* @__PURE__ */ (0, import_jsx_runtime355.jsx)("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
|
|
@@ -12098,7 +12138,7 @@ var formatTime = (sec) => {
|
|
|
12098
12138
|
const s = Math.floor(sec % 60);
|
|
12099
12139
|
return `${m}:${s.toString().padStart(2, "0")}`;
|
|
12100
12140
|
};
|
|
12101
|
-
var Video =
|
|
12141
|
+
var Video = import_react44.default.forwardRef((props, ref) => {
|
|
12102
12142
|
const {
|
|
12103
12143
|
src,
|
|
12104
12144
|
poster,
|
|
@@ -12122,21 +12162,21 @@ var Video = import_react43.default.forwardRef((props, ref) => {
|
|
|
12122
12162
|
children,
|
|
12123
12163
|
...rest
|
|
12124
12164
|
} = props;
|
|
12125
|
-
const containerRef =
|
|
12126
|
-
const videoRef =
|
|
12127
|
-
const [isPlaying, setIsPlaying] =
|
|
12128
|
-
const [isLoaded, setIsLoaded] =
|
|
12129
|
-
const [currentTime, setCurrentTime] =
|
|
12130
|
-
const [duration, setDuration] =
|
|
12131
|
-
const [buffered, setBuffered] =
|
|
12132
|
-
const [volume, setVolume] =
|
|
12133
|
-
const [isMuted, setIsMuted] =
|
|
12134
|
-
const [isFullscreen, setIsFullscreen] =
|
|
12135
|
-
const [playbackRate, setPlaybackRate] =
|
|
12136
|
-
const [rateMenuOpen, setRateMenuOpen] =
|
|
12137
|
-
const [captionsOn, setCaptionsOn] =
|
|
12138
|
-
const [isPip, setIsPip] =
|
|
12139
|
-
const setRefs =
|
|
12165
|
+
const containerRef = import_react44.default.useRef(null);
|
|
12166
|
+
const videoRef = import_react44.default.useRef(null);
|
|
12167
|
+
const [isPlaying, setIsPlaying] = import_react44.default.useState(Boolean(autoPlay));
|
|
12168
|
+
const [isLoaded, setIsLoaded] = import_react44.default.useState(false);
|
|
12169
|
+
const [currentTime, setCurrentTime] = import_react44.default.useState(0);
|
|
12170
|
+
const [duration, setDuration] = import_react44.default.useState(0);
|
|
12171
|
+
const [buffered, setBuffered] = import_react44.default.useState(0);
|
|
12172
|
+
const [volume, setVolume] = import_react44.default.useState(1);
|
|
12173
|
+
const [isMuted, setIsMuted] = import_react44.default.useState(Boolean(muted));
|
|
12174
|
+
const [isFullscreen, setIsFullscreen] = import_react44.default.useState(false);
|
|
12175
|
+
const [playbackRate, setPlaybackRate] = import_react44.default.useState(1);
|
|
12176
|
+
const [rateMenuOpen, setRateMenuOpen] = import_react44.default.useState(false);
|
|
12177
|
+
const [captionsOn, setCaptionsOn] = import_react44.default.useState(false);
|
|
12178
|
+
const [isPip, setIsPip] = import_react44.default.useState(false);
|
|
12179
|
+
const setRefs = import_react44.default.useCallback(
|
|
12140
12180
|
(el) => {
|
|
12141
12181
|
videoRef.current = el;
|
|
12142
12182
|
if (typeof ref === "function") ref(el);
|
|
@@ -12144,14 +12184,14 @@ var Video = import_react43.default.forwardRef((props, ref) => {
|
|
|
12144
12184
|
},
|
|
12145
12185
|
[ref]
|
|
12146
12186
|
);
|
|
12147
|
-
|
|
12187
|
+
import_react44.default.useEffect(() => {
|
|
12148
12188
|
const onFsChange = () => {
|
|
12149
12189
|
setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
12150
12190
|
};
|
|
12151
12191
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
12152
12192
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
12153
12193
|
}, []);
|
|
12154
|
-
|
|
12194
|
+
import_react44.default.useEffect(() => {
|
|
12155
12195
|
const v = videoRef.current;
|
|
12156
12196
|
if (!v) return;
|
|
12157
12197
|
const onEnter = () => setIsPip(true);
|
|
@@ -12540,13 +12580,13 @@ Layout.displayName = "Layout";
|
|
|
12540
12580
|
var Layout_default = Layout;
|
|
12541
12581
|
|
|
12542
12582
|
// src/layout/SideBar/SideBar.tsx
|
|
12543
|
-
var
|
|
12583
|
+
var import_react46 = __toESM(require("react"), 1);
|
|
12544
12584
|
|
|
12545
12585
|
// src/layout/SideBar/SideBarContext.tsx
|
|
12546
|
-
var
|
|
12547
|
-
var SideBarContext =
|
|
12586
|
+
var import_react45 = __toESM(require("react"), 1);
|
|
12587
|
+
var SideBarContext = import_react45.default.createContext(null);
|
|
12548
12588
|
var useSideBarContext = () => {
|
|
12549
|
-
const ctx =
|
|
12589
|
+
const ctx = import_react45.default.useContext(SideBarContext);
|
|
12550
12590
|
if (!ctx) throw new Error("Error");
|
|
12551
12591
|
return ctx;
|
|
12552
12592
|
};
|
|
@@ -12556,7 +12596,7 @@ var SideBarContext_default = SideBarContext;
|
|
|
12556
12596
|
var import_jsx_runtime361 = require("react/jsx-runtime");
|
|
12557
12597
|
var SideBar = (props) => {
|
|
12558
12598
|
const { children, className } = props;
|
|
12559
|
-
const [isOpen, setIsOpen] =
|
|
12599
|
+
const [isOpen, setIsOpen] = import_react46.default.useState(true);
|
|
12560
12600
|
const handleSwitchSideBar = () => {
|
|
12561
12601
|
setIsOpen((prev) => !prev);
|
|
12562
12602
|
};
|