@x-plat/design-system 0.14.18 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Dropdown/index.cjs +54 -17
- package/dist/components/Dropdown/index.js +54 -17
- package/dist/components/PopOver/index.cjs +53 -16
- package/dist/components/PopOver/index.js +53 -16
- package/dist/components/Select/index.cjs +73 -36
- package/dist/components/Select/index.js +73 -36
- package/dist/components/TimePicker/index.cjs +58 -21
- package/dist/components/TimePicker/index.js +58 -21
- package/dist/components/Tooltip/index.cjs +2 -2
- package/dist/components/Tooltip/index.js +2 -2
- package/dist/components/index.cjs +255 -215
- package/dist/components/index.js +255 -215
- package/dist/index.cjs +260 -220
- package/dist/index.js +260 -220
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7702,10 +7702,16 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
7702
7702
|
const scrollParentRef = import_react10.default.useRef(null);
|
|
7703
7703
|
const placedRef = import_react10.default.useRef(false);
|
|
7704
7704
|
const frozenMaxRef = import_react10.default.useRef(void 0);
|
|
7705
|
+
const cssCapRef = import_react10.default.useRef(void 0);
|
|
7705
7706
|
const calculatePosition = import_react10.default.useCallback((remeasure = false) => {
|
|
7706
7707
|
const pop = popRef.current;
|
|
7707
7708
|
if (!triggerRef.current || !pop) return;
|
|
7708
7709
|
if (remeasure) frozenMaxRef.current = void 0;
|
|
7710
|
+
if (cssCapRef.current === void 0) {
|
|
7711
|
+
pop.style.maxHeight = "";
|
|
7712
|
+
const raw = getComputedStyle(pop).maxHeight;
|
|
7713
|
+
cssCapRef.current = raw === "none" ? null : Number.parseFloat(raw) || null;
|
|
7714
|
+
}
|
|
7709
7715
|
if (remeasure || !sizeRef.current) {
|
|
7710
7716
|
sizeRef.current = {
|
|
7711
7717
|
w: pop.offsetWidth,
|
|
@@ -7727,8 +7733,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
7727
7733
|
};
|
|
7728
7734
|
const first = !placedRef.current;
|
|
7729
7735
|
if (first) pop.style.transition = "none";
|
|
7736
|
+
const cap = cssCapRef.current;
|
|
7737
|
+
const desiredH = cap == null ? popH : Math.min(popH, cap);
|
|
7730
7738
|
const frozen = frozenMaxRef.current;
|
|
7731
|
-
const effectiveH = frozen == null ?
|
|
7739
|
+
const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
|
|
7732
7740
|
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
7733
7741
|
triggerRect,
|
|
7734
7742
|
popW,
|
|
@@ -7737,8 +7745,9 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
7737
7745
|
);
|
|
7738
7746
|
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
7739
7747
|
const maxHeight = frozenMaxRef.current;
|
|
7740
|
-
|
|
7741
|
-
pop.style.
|
|
7748
|
+
const hostRect = (pop.offsetParent ?? pop.parentElement)?.getBoundingClientRect();
|
|
7749
|
+
pop.style.top = `${top - (hostRect?.top ?? 0)}px`;
|
|
7750
|
+
pop.style.left = `${left - (hostRect?.left ?? 0)}px`;
|
|
7742
7751
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
7743
7752
|
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";
|
|
7744
7753
|
directionRef.current = next;
|
|
@@ -7756,6 +7765,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
7756
7765
|
scrollParentRef.current = null;
|
|
7757
7766
|
placedRef.current = false;
|
|
7758
7767
|
frozenMaxRef.current = void 0;
|
|
7768
|
+
cssCapRef.current = void 0;
|
|
7759
7769
|
return;
|
|
7760
7770
|
}
|
|
7761
7771
|
if (triggerRef.current) {
|
|
@@ -8539,13 +8549,13 @@ Drawer.displayName = "Drawer";
|
|
|
8539
8549
|
var Drawer_default = Drawer;
|
|
8540
8550
|
|
|
8541
8551
|
// src/components/Dropdown/Dropdown.tsx
|
|
8542
|
-
var
|
|
8552
|
+
var import_react22 = __toESM(require("react"), 1);
|
|
8543
8553
|
|
|
8544
8554
|
// src/tokens/hooks/Portal.tsx
|
|
8545
8555
|
var import_react_dom3 = __toESM(require("react-dom"), 1);
|
|
8546
|
-
var Portal = ({ children }) => {
|
|
8556
|
+
var Portal = ({ children, container }) => {
|
|
8547
8557
|
if (typeof document === "undefined") return null;
|
|
8548
|
-
return import_react_dom3.default.createPortal(children, document.body);
|
|
8558
|
+
return import_react_dom3.default.createPortal(children, container ?? document.body);
|
|
8549
8559
|
};
|
|
8550
8560
|
Portal.displayName = "Portal";
|
|
8551
8561
|
var Portal_default = Portal;
|
|
@@ -8575,15 +8585,42 @@ var useClickOutside = (refs, handler, enabled = true) => {
|
|
|
8575
8585
|
};
|
|
8576
8586
|
var useClickOutside_default = useClickOutside;
|
|
8577
8587
|
|
|
8588
|
+
// src/tokens/hooks/useOverlayHost.ts
|
|
8589
|
+
var import_react21 = __toESM(require("react"), 1);
|
|
8590
|
+
var useOverlayHost = (triggerRef, enabled) => {
|
|
8591
|
+
const [host, setHost] = import_react21.default.useState(null);
|
|
8592
|
+
import_react21.default.useLayoutEffect(() => {
|
|
8593
|
+
if (!enabled || !triggerRef.current) {
|
|
8594
|
+
setHost(null);
|
|
8595
|
+
return;
|
|
8596
|
+
}
|
|
8597
|
+
const el = document.createElement("div");
|
|
8598
|
+
el.dataset.xplatOverlayHost = "";
|
|
8599
|
+
el.style.position = "relative";
|
|
8600
|
+
el.style.width = "0";
|
|
8601
|
+
el.style.height = "0";
|
|
8602
|
+
const parent = findScrollParent(triggerRef.current) ?? document.body;
|
|
8603
|
+
parent.appendChild(el);
|
|
8604
|
+
setHost(el);
|
|
8605
|
+
return () => {
|
|
8606
|
+
el.remove();
|
|
8607
|
+
setHost(null);
|
|
8608
|
+
};
|
|
8609
|
+
}, [enabled, triggerRef]);
|
|
8610
|
+
return host;
|
|
8611
|
+
};
|
|
8612
|
+
var useOverlayHost_default = useOverlayHost;
|
|
8613
|
+
|
|
8578
8614
|
// src/components/Dropdown/Dropdown.tsx
|
|
8579
8615
|
var import_jsx_runtime322 = require("react/jsx-runtime");
|
|
8580
8616
|
var Dropdown = (props) => {
|
|
8581
8617
|
const { items, children } = props;
|
|
8582
|
-
const [isOpen, setIsOpen] =
|
|
8583
|
-
const [mounted, setMounted] =
|
|
8584
|
-
const [visible, setVisible] =
|
|
8585
|
-
const triggerRef =
|
|
8586
|
-
const menuRef =
|
|
8618
|
+
const [isOpen, setIsOpen] = import_react22.default.useState(false);
|
|
8619
|
+
const [mounted, setMounted] = import_react22.default.useState(false);
|
|
8620
|
+
const [visible, setVisible] = import_react22.default.useState(false);
|
|
8621
|
+
const triggerRef = import_react22.default.useRef(null);
|
|
8622
|
+
const menuRef = import_react22.default.useRef(null);
|
|
8623
|
+
const host = useOverlayHost_default(triggerRef, mounted);
|
|
8587
8624
|
useAutoPosition_default(triggerRef, menuRef, mounted);
|
|
8588
8625
|
useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false), isOpen);
|
|
8589
8626
|
useCloseWhenFocusHidden(isOpen, triggerRef, menuRef, () => setIsOpen(false));
|
|
@@ -8591,7 +8628,7 @@ var Dropdown = (props) => {
|
|
|
8591
8628
|
setIsOpen(false);
|
|
8592
8629
|
triggerRef.current?.focus({ preventScroll: true });
|
|
8593
8630
|
});
|
|
8594
|
-
|
|
8631
|
+
import_react22.default.useEffect(() => {
|
|
8595
8632
|
if (isOpen) {
|
|
8596
8633
|
setMounted(true);
|
|
8597
8634
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -8616,7 +8653,7 @@ var Dropdown = (props) => {
|
|
|
8616
8653
|
children
|
|
8617
8654
|
}
|
|
8618
8655
|
),
|
|
8619
|
-
mounted && /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
|
|
8656
|
+
mounted && /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(Portal_default, { container: host, children: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
|
|
8620
8657
|
"div",
|
|
8621
8658
|
{
|
|
8622
8659
|
ref: menuRef,
|
|
@@ -8644,7 +8681,7 @@ Dropdown.displayName = "Dropdown";
|
|
|
8644
8681
|
var Dropdown_default = Dropdown;
|
|
8645
8682
|
|
|
8646
8683
|
// src/components/Editor/Editor.tsx
|
|
8647
|
-
var
|
|
8684
|
+
var import_react23 = __toESM(require("react"), 1);
|
|
8648
8685
|
|
|
8649
8686
|
// src/components/Editor/highlight.ts
|
|
8650
8687
|
var CODE_LANGUAGES = [
|
|
@@ -8915,22 +8952,22 @@ var Editor = (props) => {
|
|
|
8915
8952
|
onImageUpload,
|
|
8916
8953
|
minHeight = 200
|
|
8917
8954
|
} = props;
|
|
8918
|
-
const editorRef =
|
|
8919
|
-
const lastRangeRef =
|
|
8920
|
-
const composingRef =
|
|
8921
|
-
const [isFocused, setIsFocused] =
|
|
8922
|
-
const [isEmpty, setIsEmpty] =
|
|
8923
|
-
const [activeFormats, setActiveFormats] =
|
|
8924
|
-
const [slashOpen, setSlashOpen] =
|
|
8925
|
-
const [slashFilter, setSlashFilter] =
|
|
8926
|
-
const [slashIdx, setSlashIdx] =
|
|
8927
|
-
const [slashPos, setSlashPos] =
|
|
8928
|
-
const slashStartRangeRef =
|
|
8929
|
-
const [linkOpen, setLinkOpen] =
|
|
8930
|
-
const [linkValue, setLinkValue] =
|
|
8931
|
-
const [linkPos, setLinkPos] =
|
|
8932
|
-
const lastEmittedRef =
|
|
8933
|
-
|
|
8955
|
+
const editorRef = import_react23.default.useRef(null);
|
|
8956
|
+
const lastRangeRef = import_react23.default.useRef(null);
|
|
8957
|
+
const composingRef = import_react23.default.useRef(false);
|
|
8958
|
+
const [isFocused, setIsFocused] = import_react23.default.useState(false);
|
|
8959
|
+
const [isEmpty, setIsEmpty] = import_react23.default.useState(!value);
|
|
8960
|
+
const [activeFormats, setActiveFormats] = import_react23.default.useState(/* @__PURE__ */ new Set());
|
|
8961
|
+
const [slashOpen, setSlashOpen] = import_react23.default.useState(false);
|
|
8962
|
+
const [slashFilter, setSlashFilter] = import_react23.default.useState("");
|
|
8963
|
+
const [slashIdx, setSlashIdx] = import_react23.default.useState(0);
|
|
8964
|
+
const [slashPos, setSlashPos] = import_react23.default.useState({ top: 0, left: 0 });
|
|
8965
|
+
const slashStartRangeRef = import_react23.default.useRef(null);
|
|
8966
|
+
const [linkOpen, setLinkOpen] = import_react23.default.useState(false);
|
|
8967
|
+
const [linkValue, setLinkValue] = import_react23.default.useState("");
|
|
8968
|
+
const [linkPos, setLinkPos] = import_react23.default.useState({ top: 0, left: 0 });
|
|
8969
|
+
const lastEmittedRef = import_react23.default.useRef(null);
|
|
8970
|
+
import_react23.default.useEffect(() => {
|
|
8934
8971
|
const el = editorRef.current;
|
|
8935
8972
|
if (!el) return;
|
|
8936
8973
|
if (value === lastEmittedRef.current) return;
|
|
@@ -9012,10 +9049,10 @@ var Editor = (props) => {
|
|
|
9012
9049
|
const current = String(document.queryCommandValue("formatBlock") || "").toLowerCase();
|
|
9013
9050
|
setBlock(current === tag ? "p" : tag);
|
|
9014
9051
|
};
|
|
9015
|
-
const historyRef =
|
|
9016
|
-
const historyIdxRef =
|
|
9017
|
-
const lastPushAtRef =
|
|
9018
|
-
const isRestoringRef =
|
|
9052
|
+
const historyRef = import_react23.default.useRef([]);
|
|
9053
|
+
const historyIdxRef = import_react23.default.useRef(-1);
|
|
9054
|
+
const lastPushAtRef = import_react23.default.useRef(0);
|
|
9055
|
+
const isRestoringRef = import_react23.default.useRef(false);
|
|
9019
9056
|
const caretOffset = (rootEl) => {
|
|
9020
9057
|
const el = rootEl ?? editorRef.current;
|
|
9021
9058
|
const sel = window.getSelection();
|
|
@@ -9092,8 +9129,8 @@ var Editor = (props) => {
|
|
|
9092
9129
|
const cls = Array.from(pre.classList).find((c) => c.startsWith("lang-"));
|
|
9093
9130
|
return cls?.slice(5) ?? "plain";
|
|
9094
9131
|
};
|
|
9095
|
-
const [codeLang, setCodeLang] =
|
|
9096
|
-
const highlightRafRef =
|
|
9132
|
+
const [codeLang, setCodeLang] = import_react23.default.useState("plain");
|
|
9133
|
+
const highlightRafRef = import_react23.default.useRef(0);
|
|
9097
9134
|
const rehighlight = (pre) => {
|
|
9098
9135
|
if (composingRef.current) return;
|
|
9099
9136
|
const code = pre.querySelector("code");
|
|
@@ -9438,7 +9475,7 @@ var Editor = (props) => {
|
|
|
9438
9475
|
setSlashIdx(0);
|
|
9439
9476
|
slashStartRangeRef.current = null;
|
|
9440
9477
|
};
|
|
9441
|
-
const filteredSlashItems =
|
|
9478
|
+
const filteredSlashItems = import_react23.default.useMemo(() => {
|
|
9442
9479
|
if (!slashFilter) return SLASH_ITEMS;
|
|
9443
9480
|
const f = slashFilter.toLowerCase();
|
|
9444
9481
|
return SLASH_ITEMS.filter((it) => it.label.toLowerCase().includes(f) || it.key.includes(f));
|
|
@@ -9703,7 +9740,7 @@ var Editor = (props) => {
|
|
|
9703
9740
|
}
|
|
9704
9741
|
}
|
|
9705
9742
|
};
|
|
9706
|
-
const plainPasteRef =
|
|
9743
|
+
const plainPasteRef = import_react23.default.useRef(false);
|
|
9707
9744
|
const handlePaste = (e) => {
|
|
9708
9745
|
if (readOnly) return;
|
|
9709
9746
|
e.preventDefault();
|
|
@@ -10004,7 +10041,7 @@ var EditorToolbar = ({
|
|
|
10004
10041
|
] });
|
|
10005
10042
|
};
|
|
10006
10043
|
var SlashMenu = ({ position, items, activeIndex, onSelect, onClose }) => {
|
|
10007
|
-
|
|
10044
|
+
import_react23.default.useEffect(() => {
|
|
10008
10045
|
const handleClickOutside = (e) => {
|
|
10009
10046
|
const target = e.target;
|
|
10010
10047
|
const menu = document.querySelector(".lib-xplat-editor__slash-menu");
|
|
@@ -10038,8 +10075,8 @@ var SlashMenu = ({ position, items, activeIndex, onSelect, onClose }) => {
|
|
|
10038
10075
|
);
|
|
10039
10076
|
};
|
|
10040
10077
|
var LinkPopover = ({ position, value, onChange, onConfirm, onClose }) => {
|
|
10041
|
-
const inputRef =
|
|
10042
|
-
|
|
10078
|
+
const inputRef = import_react23.default.useRef(null);
|
|
10079
|
+
import_react23.default.useEffect(() => {
|
|
10043
10080
|
inputRef.current?.focus();
|
|
10044
10081
|
}, []);
|
|
10045
10082
|
return /* @__PURE__ */ (0, import_jsx_runtime323.jsxs)(
|
|
@@ -10097,7 +10134,7 @@ EmptyState.displayName = "EmptyState";
|
|
|
10097
10134
|
var EmptyState_default = EmptyState;
|
|
10098
10135
|
|
|
10099
10136
|
// src/components/FileUpload/FileUpload.tsx
|
|
10100
|
-
var
|
|
10137
|
+
var import_react24 = __toESM(require("react"), 1);
|
|
10101
10138
|
var import_jsx_runtime325 = require("react/jsx-runtime");
|
|
10102
10139
|
var FileUpload = (props) => {
|
|
10103
10140
|
const {
|
|
@@ -10111,9 +10148,9 @@ var FileUpload = (props) => {
|
|
|
10111
10148
|
label,
|
|
10112
10149
|
required
|
|
10113
10150
|
} = props;
|
|
10114
|
-
const fieldId =
|
|
10115
|
-
const [isDragOver, setIsDragOver] =
|
|
10116
|
-
const inputRef =
|
|
10151
|
+
const fieldId = import_react24.default.useId();
|
|
10152
|
+
const [isDragOver, setIsDragOver] = import_react24.default.useState(false);
|
|
10153
|
+
const inputRef = import_react24.default.useRef(null);
|
|
10117
10154
|
const handleFiles = (fileList) => {
|
|
10118
10155
|
let files = Array.from(fileList);
|
|
10119
10156
|
if (maxSize) {
|
|
@@ -10176,10 +10213,10 @@ FileUpload.displayName = "FileUpload";
|
|
|
10176
10213
|
var FileUpload_default = FileUpload;
|
|
10177
10214
|
|
|
10178
10215
|
// src/components/HtmlTypeWriter/HtmlTypeWriter.tsx
|
|
10179
|
-
var
|
|
10216
|
+
var import_react26 = __toESM(require("react"), 1);
|
|
10180
10217
|
|
|
10181
10218
|
// src/components/HtmlTypeWriter/utils.ts
|
|
10182
|
-
var
|
|
10219
|
+
var import_react25 = __toESM(require("react"), 1);
|
|
10183
10220
|
var voidTags = /* @__PURE__ */ new Set([
|
|
10184
10221
|
"br",
|
|
10185
10222
|
"img",
|
|
@@ -10247,15 +10284,15 @@ var convertNodeToReactWithRange = (node, typedLen, rangeMap) => {
|
|
|
10247
10284
|
props[attr.name] = attr.value;
|
|
10248
10285
|
});
|
|
10249
10286
|
if (voidTags.has(tag)) {
|
|
10250
|
-
return
|
|
10287
|
+
return import_react25.default.createElement(tag, props);
|
|
10251
10288
|
}
|
|
10252
10289
|
const children = Array.from(element.childNodes).map((child) => convertNodeToReactWithRange(child, typedLen, rangeMap)).filter((n) => n != null);
|
|
10253
|
-
return
|
|
10290
|
+
return import_react25.default.createElement(tag, props, ...children);
|
|
10254
10291
|
};
|
|
10255
10292
|
var htmlToReactProgressive = (root, typedLen, rangeMap) => {
|
|
10256
10293
|
const nodes = Array.from(root.childNodes).map((child, idx) => {
|
|
10257
10294
|
const node = convertNodeToReactWithRange(child, typedLen, rangeMap);
|
|
10258
|
-
return node == null ? null :
|
|
10295
|
+
return node == null ? null : import_react25.default.createElement(import_react25.default.Fragment, { key: idx }, node);
|
|
10259
10296
|
}).filter(Boolean);
|
|
10260
10297
|
return nodes.length === 0 ? null : nodes;
|
|
10261
10298
|
};
|
|
@@ -10268,20 +10305,20 @@ var HtmlTypeWriter = ({
|
|
|
10268
10305
|
onDone,
|
|
10269
10306
|
onChange
|
|
10270
10307
|
}) => {
|
|
10271
|
-
const [typedLen, setTypedLen] =
|
|
10272
|
-
const doneCalledRef =
|
|
10273
|
-
const { doc, rangeMap, totalLength } =
|
|
10308
|
+
const [typedLen, setTypedLen] = import_react26.default.useState(0);
|
|
10309
|
+
const doneCalledRef = import_react26.default.useRef(false);
|
|
10310
|
+
const { doc, rangeMap, totalLength } = import_react26.default.useMemo(() => {
|
|
10274
10311
|
if (typeof window === "undefined") return { doc: null, rangeMap: /* @__PURE__ */ new Map(), totalLength: 0 };
|
|
10275
10312
|
const decoded = decodeHtmlEntities(html);
|
|
10276
10313
|
const doc2 = new DOMParser().parseFromString(decoded, "text/html");
|
|
10277
10314
|
const { rangeMap: rangeMap2, totalLength: totalLength2 } = buildRangeMap(doc2.body);
|
|
10278
10315
|
return { doc: doc2, rangeMap: rangeMap2, totalLength: totalLength2 };
|
|
10279
10316
|
}, [html]);
|
|
10280
|
-
|
|
10317
|
+
import_react26.default.useEffect(() => {
|
|
10281
10318
|
setTypedLen(0);
|
|
10282
10319
|
doneCalledRef.current = false;
|
|
10283
10320
|
}, [html]);
|
|
10284
|
-
|
|
10321
|
+
import_react26.default.useEffect(() => {
|
|
10285
10322
|
if (!totalLength) return;
|
|
10286
10323
|
if (typedLen >= totalLength) return;
|
|
10287
10324
|
const timer = window.setInterval(() => {
|
|
@@ -10289,18 +10326,18 @@ var HtmlTypeWriter = ({
|
|
|
10289
10326
|
}, duration);
|
|
10290
10327
|
return () => window.clearInterval(timer);
|
|
10291
10328
|
}, [typedLen, totalLength, duration]);
|
|
10292
|
-
|
|
10329
|
+
import_react26.default.useEffect(() => {
|
|
10293
10330
|
if (typedLen > 0 && typedLen < totalLength) {
|
|
10294
10331
|
onChange?.();
|
|
10295
10332
|
}
|
|
10296
10333
|
}, [typedLen, totalLength, onChange]);
|
|
10297
|
-
|
|
10334
|
+
import_react26.default.useEffect(() => {
|
|
10298
10335
|
if (typedLen === totalLength && totalLength > 0 && !doneCalledRef.current) {
|
|
10299
10336
|
doneCalledRef.current = true;
|
|
10300
10337
|
onDone?.();
|
|
10301
10338
|
}
|
|
10302
10339
|
}, [typedLen, totalLength, onDone]);
|
|
10303
|
-
const parsed =
|
|
10340
|
+
const parsed = import_react26.default.useMemo(
|
|
10304
10341
|
() => doc ? htmlToReactProgressive(doc.body, typedLen, rangeMap) : null,
|
|
10305
10342
|
[doc, typedLen, rangeMap]
|
|
10306
10343
|
);
|
|
@@ -10310,13 +10347,13 @@ HtmlTypeWriter.displayName = "HtmlTypeWriter";
|
|
|
10310
10347
|
var HtmlTypeWriter_default = HtmlTypeWriter;
|
|
10311
10348
|
|
|
10312
10349
|
// src/components/ImageSelector/ImageSelector.tsx
|
|
10313
|
-
var
|
|
10350
|
+
var import_react27 = __toESM(require("react"), 1);
|
|
10314
10351
|
var import_jsx_runtime327 = require("react/jsx-runtime");
|
|
10315
10352
|
var ImageSelector = (props) => {
|
|
10316
10353
|
const { value, placeholder, onChange, validations, label, required } = props;
|
|
10317
|
-
const fieldId =
|
|
10318
|
-
const [previewUrl, setPreviewUrl] =
|
|
10319
|
-
|
|
10354
|
+
const fieldId = import_react27.default.useId();
|
|
10355
|
+
const [previewUrl, setPreviewUrl] = import_react27.default.useState();
|
|
10356
|
+
import_react27.default.useEffect(() => {
|
|
10320
10357
|
if (!value) {
|
|
10321
10358
|
setPreviewUrl(void 0);
|
|
10322
10359
|
return;
|
|
@@ -10325,7 +10362,7 @@ var ImageSelector = (props) => {
|
|
|
10325
10362
|
setPreviewUrl(url);
|
|
10326
10363
|
return () => URL.revokeObjectURL(url);
|
|
10327
10364
|
}, [value]);
|
|
10328
|
-
const inputRef =
|
|
10365
|
+
const inputRef = import_react27.default.useRef(null);
|
|
10329
10366
|
const handleFileChange = (e) => {
|
|
10330
10367
|
const selectedFile = e.target.files?.[0];
|
|
10331
10368
|
if (selectedFile) {
|
|
@@ -10508,22 +10545,23 @@ Pagination.displayName = "Pagination";
|
|
|
10508
10545
|
var Pagination_default = Pagination;
|
|
10509
10546
|
|
|
10510
10547
|
// src/components/PopOver/PopOver.tsx
|
|
10511
|
-
var
|
|
10548
|
+
var import_react28 = __toESM(require("react"), 1);
|
|
10512
10549
|
var import_jsx_runtime332 = require("react/jsx-runtime");
|
|
10513
10550
|
var PopOver = (props) => {
|
|
10514
10551
|
const { children, isOpen, onClose, PopOverEl } = props;
|
|
10515
|
-
const popRef =
|
|
10516
|
-
const triggerRef =
|
|
10517
|
-
const [localOpen, setLocalOpen] =
|
|
10518
|
-
const [eventTrigger, setEventTrigger] =
|
|
10552
|
+
const popRef = import_react28.default.useRef(null);
|
|
10553
|
+
const triggerRef = import_react28.default.useRef(null);
|
|
10554
|
+
const [localOpen, setLocalOpen] = import_react28.default.useState(false);
|
|
10555
|
+
const [eventTrigger, setEventTrigger] = import_react28.default.useState(false);
|
|
10519
10556
|
useClickOutside_default([popRef, triggerRef], onClose, isOpen);
|
|
10520
10557
|
useCloseWhenFocusHidden(isOpen, triggerRef, popRef, onClose);
|
|
10521
10558
|
useEscapeKey(isOpen, () => {
|
|
10522
10559
|
onClose();
|
|
10523
10560
|
triggerRef.current?.focus({ preventScroll: true });
|
|
10524
10561
|
});
|
|
10562
|
+
const host = useOverlayHost_default(triggerRef, localOpen);
|
|
10525
10563
|
useAutoPosition_default(triggerRef, popRef, localOpen);
|
|
10526
|
-
|
|
10564
|
+
import_react28.default.useEffect(() => {
|
|
10527
10565
|
if (isOpen) {
|
|
10528
10566
|
setLocalOpen(isOpen);
|
|
10529
10567
|
setTimeout(() => {
|
|
@@ -10546,7 +10584,7 @@ var PopOver = (props) => {
|
|
|
10546
10584
|
},
|
|
10547
10585
|
children: [
|
|
10548
10586
|
children,
|
|
10549
|
-
localOpen && /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(
|
|
10587
|
+
localOpen && /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(Portal_default, { container: host, children: /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(
|
|
10550
10588
|
"div",
|
|
10551
10589
|
{
|
|
10552
10590
|
className: clsx_default(
|
|
@@ -10604,12 +10642,12 @@ Progress.displayName = "Progress";
|
|
|
10604
10642
|
var Progress_default = Progress;
|
|
10605
10643
|
|
|
10606
10644
|
// src/components/Radio/RadioGroupContext.tsx
|
|
10607
|
-
var
|
|
10608
|
-
var RadioGroupContext =
|
|
10645
|
+
var import_react29 = __toESM(require("react"), 1);
|
|
10646
|
+
var RadioGroupContext = import_react29.default.createContext(
|
|
10609
10647
|
null
|
|
10610
10648
|
);
|
|
10611
10649
|
var useRadioGroupContext = () => {
|
|
10612
|
-
return
|
|
10650
|
+
return import_react29.default.useContext(RadioGroupContext);
|
|
10613
10651
|
};
|
|
10614
10652
|
var RadioGroupContext_default = RadioGroupContext;
|
|
10615
10653
|
|
|
@@ -10685,19 +10723,19 @@ RadioGroup.displayName = "RadioGroup";
|
|
|
10685
10723
|
var RadioGroup_default = RadioGroup;
|
|
10686
10724
|
|
|
10687
10725
|
// src/components/Select/Select.tsx
|
|
10688
|
-
var
|
|
10726
|
+
var import_react32 = __toESM(require("react"), 1);
|
|
10689
10727
|
|
|
10690
10728
|
// src/components/Select/context.ts
|
|
10691
|
-
var
|
|
10692
|
-
var SelectContext =
|
|
10729
|
+
var import_react30 = __toESM(require("react"), 1);
|
|
10730
|
+
var SelectContext = import_react30.default.createContext(null);
|
|
10693
10731
|
var context_default = SelectContext;
|
|
10694
10732
|
|
|
10695
10733
|
// src/components/Select/SelectItem.tsx
|
|
10696
|
-
var
|
|
10734
|
+
var import_react31 = __toESM(require("react"), 1);
|
|
10697
10735
|
var import_jsx_runtime336 = require("react/jsx-runtime");
|
|
10698
10736
|
var SelectItem = (props) => {
|
|
10699
10737
|
const { children, value, onClick, disabled = false } = props;
|
|
10700
|
-
const ctx =
|
|
10738
|
+
const ctx = import_react31.default.useContext(context_default);
|
|
10701
10739
|
const handleClick = (e) => {
|
|
10702
10740
|
e.preventDefault();
|
|
10703
10741
|
e.stopPropagation();
|
|
@@ -10747,29 +10785,29 @@ var SelectRoot = (props) => {
|
|
|
10747
10785
|
required,
|
|
10748
10786
|
size = "md"
|
|
10749
10787
|
} = props;
|
|
10750
|
-
const fieldId =
|
|
10751
|
-
const itemChildren =
|
|
10752
|
-
(child) =>
|
|
10788
|
+
const fieldId = import_react32.default.useId();
|
|
10789
|
+
const itemChildren = import_react32.default.Children.toArray(children).filter(
|
|
10790
|
+
(child) => import_react32.default.isValidElement(child) && child.type === SelectItem_default
|
|
10753
10791
|
);
|
|
10754
10792
|
const isControlled = valueProp !== void 0;
|
|
10755
|
-
const [isOpen, setOpen] =
|
|
10756
|
-
const [uncontrolledLabel, setUncontrolledLabel] =
|
|
10757
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
10758
|
-
const controlledLabel =
|
|
10793
|
+
const [isOpen, setOpen] = import_react32.default.useState(false);
|
|
10794
|
+
const [uncontrolledLabel, setUncontrolledLabel] = import_react32.default.useState(null);
|
|
10795
|
+
const [uncontrolledValue, setUncontrolledValue] = import_react32.default.useState(void 0);
|
|
10796
|
+
const controlledLabel = import_react32.default.useMemo(() => {
|
|
10759
10797
|
if (!isControlled) return null;
|
|
10760
10798
|
const match = itemChildren.find((child) => child.props.value === valueProp);
|
|
10761
10799
|
return match ? match.props.children : null;
|
|
10762
10800
|
}, [isControlled, valueProp, itemChildren]);
|
|
10763
10801
|
const selectedLabel = isControlled ? controlledLabel : uncontrolledLabel;
|
|
10764
10802
|
const selectedValue = isControlled ? valueProp : uncontrolledValue;
|
|
10765
|
-
const triggerRef =
|
|
10766
|
-
const contentRef =
|
|
10767
|
-
const [mounted, setMounted] =
|
|
10768
|
-
const [visible, setVisible] =
|
|
10769
|
-
|
|
10803
|
+
const triggerRef = import_react32.default.useRef(null);
|
|
10804
|
+
const contentRef = import_react32.default.useRef(null);
|
|
10805
|
+
const [mounted, setMounted] = import_react32.default.useState(false);
|
|
10806
|
+
const [visible, setVisible] = import_react32.default.useState(false);
|
|
10807
|
+
import_react32.default.useEffect(() => {
|
|
10770
10808
|
if (disabled && isOpen) setOpen(false);
|
|
10771
10809
|
}, [disabled, isOpen]);
|
|
10772
|
-
|
|
10810
|
+
import_react32.default.useEffect(() => {
|
|
10773
10811
|
if (isOpen) {
|
|
10774
10812
|
setMounted(true);
|
|
10775
10813
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -10779,33 +10817,34 @@ var SelectRoot = (props) => {
|
|
|
10779
10817
|
const t = setTimeout(() => setMounted(false), ANIMATION_DURATION_MS3);
|
|
10780
10818
|
return () => clearTimeout(t);
|
|
10781
10819
|
}, [isOpen]);
|
|
10782
|
-
const [query, setQuery] =
|
|
10820
|
+
const [query, setQuery] = import_react32.default.useState("");
|
|
10783
10821
|
const textOf = (node) => {
|
|
10784
10822
|
if (node === null || node === void 0 || typeof node === "boolean") return "";
|
|
10785
10823
|
if (typeof node === "string" || typeof node === "number") return String(node);
|
|
10786
10824
|
if (Array.isArray(node)) return node.map(textOf).join("");
|
|
10787
|
-
if (
|
|
10825
|
+
if (import_react32.default.isValidElement(node)) return textOf(node.props.children);
|
|
10788
10826
|
return "";
|
|
10789
10827
|
};
|
|
10790
|
-
const visibleItems =
|
|
10828
|
+
const visibleItems = import_react32.default.useMemo(() => {
|
|
10791
10829
|
if (!searchable || !query.trim()) return itemChildren;
|
|
10792
10830
|
const q = query.trim().toLowerCase();
|
|
10793
10831
|
return itemChildren.filter((c) => textOf(c.props.children).toLowerCase().includes(q));
|
|
10794
10832
|
}, [searchable, query, itemChildren]);
|
|
10795
|
-
const open =
|
|
10796
|
-
const close =
|
|
10833
|
+
const open = import_react32.default.useCallback(() => setOpen(true), []);
|
|
10834
|
+
const close = import_react32.default.useCallback(() => {
|
|
10797
10835
|
setOpen(false);
|
|
10798
10836
|
setQuery("");
|
|
10799
10837
|
}, []);
|
|
10800
|
-
const toggle =
|
|
10838
|
+
const toggle = import_react32.default.useCallback(() => setOpen((prev) => !prev), []);
|
|
10801
10839
|
useClickOutside_default([contentRef, triggerRef], close, isOpen);
|
|
10802
10840
|
useCloseWhenFocusHidden(isOpen, triggerRef, contentRef, close);
|
|
10803
10841
|
useEscapeKey(isOpen, () => {
|
|
10804
10842
|
close();
|
|
10805
10843
|
triggerRef.current?.focus({ preventScroll: true });
|
|
10806
10844
|
});
|
|
10845
|
+
const host = useOverlayHost_default(triggerRef, mounted);
|
|
10807
10846
|
useAutoPosition_default(triggerRef, contentRef, mounted);
|
|
10808
|
-
const setSelected =
|
|
10847
|
+
const setSelected = import_react32.default.useCallback(
|
|
10809
10848
|
(label2, itemValue) => {
|
|
10810
10849
|
if (!isControlled) {
|
|
10811
10850
|
setUncontrolledLabel(label2);
|
|
@@ -10815,7 +10854,7 @@ var SelectRoot = (props) => {
|
|
|
10815
10854
|
},
|
|
10816
10855
|
[isControlled, onChange]
|
|
10817
10856
|
);
|
|
10818
|
-
const ctxValue =
|
|
10857
|
+
const ctxValue = import_react32.default.useMemo(
|
|
10819
10858
|
() => ({
|
|
10820
10859
|
isOpen,
|
|
10821
10860
|
mounted,
|
|
@@ -10894,7 +10933,7 @@ var SelectRoot = (props) => {
|
|
|
10894
10933
|
]
|
|
10895
10934
|
}
|
|
10896
10935
|
),
|
|
10897
|
-
mounted && /* @__PURE__ */ (0, import_jsx_runtime337.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime337.jsxs)(
|
|
10936
|
+
mounted && /* @__PURE__ */ (0, import_jsx_runtime337.jsx)(Portal_default, { container: host, children: /* @__PURE__ */ (0, import_jsx_runtime337.jsxs)(
|
|
10898
10937
|
"div",
|
|
10899
10938
|
{
|
|
10900
10939
|
className: clsx_default("lib-xplat-select-content", size, stateClass),
|
|
@@ -11060,7 +11099,7 @@ Steps.displayName = "Steps";
|
|
|
11060
11099
|
var Steps_default = Steps;
|
|
11061
11100
|
|
|
11062
11101
|
// src/components/Swiper/Swiper.tsx
|
|
11063
|
-
var
|
|
11102
|
+
var import_react33 = __toESM(require("react"), 1);
|
|
11064
11103
|
var import_jsx_runtime342 = require("react/jsx-runtime");
|
|
11065
11104
|
var Swiper = (props) => {
|
|
11066
11105
|
const {
|
|
@@ -11085,26 +11124,26 @@ var Swiper = (props) => {
|
|
|
11085
11124
|
const maxIndex = Math.max(0, totalSlides - viewItemCount);
|
|
11086
11125
|
const useLoop = loop && canSlide;
|
|
11087
11126
|
const cloneCount = useLoop ? totalSlides : 0;
|
|
11088
|
-
const extendedItems =
|
|
11127
|
+
const extendedItems = import_react33.default.useMemo(() => {
|
|
11089
11128
|
if (!useLoop) return items;
|
|
11090
11129
|
return [...items, ...items, ...items];
|
|
11091
11130
|
}, [items, useLoop]);
|
|
11092
11131
|
const initialIdx = Math.max(0, Math.min(indexProp ?? 0, maxIndex));
|
|
11093
|
-
const [innerIndex, setInnerIndex] =
|
|
11132
|
+
const [innerIndex, setInnerIndex] = import_react33.default.useState(
|
|
11094
11133
|
useLoop ? cloneCount + initialIdx : initialIdx
|
|
11095
11134
|
);
|
|
11096
|
-
const [isDragging, setIsDragging] =
|
|
11097
|
-
const [dragOffset, setDragOffset] =
|
|
11098
|
-
const [animated, setAnimated] =
|
|
11099
|
-
const [containerWidth, setContainerWidth] =
|
|
11100
|
-
const containerRef =
|
|
11101
|
-
const startXRef =
|
|
11102
|
-
const startTimeRef =
|
|
11103
|
-
const autoplayTimerRef =
|
|
11104
|
-
const resumeTimeoutRef =
|
|
11105
|
-
const [paused, setPaused] =
|
|
11106
|
-
const initializedRef =
|
|
11107
|
-
|
|
11135
|
+
const [isDragging, setIsDragging] = import_react33.default.useState(false);
|
|
11136
|
+
const [dragOffset, setDragOffset] = import_react33.default.useState(0);
|
|
11137
|
+
const [animated, setAnimated] = import_react33.default.useState(false);
|
|
11138
|
+
const [containerWidth, setContainerWidth] = import_react33.default.useState(0);
|
|
11139
|
+
const containerRef = import_react33.default.useRef(null);
|
|
11140
|
+
const startXRef = import_react33.default.useRef(0);
|
|
11141
|
+
const startTimeRef = import_react33.default.useRef(0);
|
|
11142
|
+
const autoplayTimerRef = import_react33.default.useRef(null);
|
|
11143
|
+
const resumeTimeoutRef = import_react33.default.useRef(null);
|
|
11144
|
+
const [paused, setPaused] = import_react33.default.useState(false);
|
|
11145
|
+
const initializedRef = import_react33.default.useRef(false);
|
|
11146
|
+
import_react33.default.useEffect(() => {
|
|
11108
11147
|
const el = containerRef.current;
|
|
11109
11148
|
if (!el) return;
|
|
11110
11149
|
const ro = new ResizeObserver((entries) => {
|
|
@@ -11127,7 +11166,7 @@ var Swiper = (props) => {
|
|
|
11127
11166
|
return ((inner - cloneCount) % totalSlides + totalSlides) % totalSlides;
|
|
11128
11167
|
};
|
|
11129
11168
|
const realIndex = getRealIndex(innerIndex);
|
|
11130
|
-
const moveToInner =
|
|
11169
|
+
const moveToInner = import_react33.default.useCallback(
|
|
11131
11170
|
(idx, withAnim = true) => {
|
|
11132
11171
|
if (!useLoop) {
|
|
11133
11172
|
setAnimated(withAnim);
|
|
@@ -11155,7 +11194,7 @@ var Swiper = (props) => {
|
|
|
11155
11194
|
},
|
|
11156
11195
|
[useLoop, cloneCount, totalSlides]
|
|
11157
11196
|
);
|
|
11158
|
-
const handleTransitionEnd =
|
|
11197
|
+
const handleTransitionEnd = import_react33.default.useCallback(() => {
|
|
11159
11198
|
if (!useLoop) return;
|
|
11160
11199
|
const real = getRealIndex(innerIndex);
|
|
11161
11200
|
const canonical = cloneCount + real;
|
|
@@ -11165,7 +11204,7 @@ var Swiper = (props) => {
|
|
|
11165
11204
|
}
|
|
11166
11205
|
onChange?.(Math.min(real, maxIndex));
|
|
11167
11206
|
}, [useLoop, innerIndex, cloneCount, totalSlides, maxIndex, onChange]);
|
|
11168
|
-
const slideTo =
|
|
11207
|
+
const slideTo = import_react33.default.useCallback(
|
|
11169
11208
|
(logicalIndex) => {
|
|
11170
11209
|
if (!canSlide) return;
|
|
11171
11210
|
const clamped = useLoop ? logicalIndex : Math.max(0, Math.min(logicalIndex, maxIndex));
|
|
@@ -11175,7 +11214,7 @@ var Swiper = (props) => {
|
|
|
11175
11214
|
},
|
|
11176
11215
|
[canSlide, useLoop, cloneCount, maxIndex, onChange, moveToInner]
|
|
11177
11216
|
);
|
|
11178
|
-
const slideNext =
|
|
11217
|
+
const slideNext = import_react33.default.useCallback(() => {
|
|
11179
11218
|
if (!canSlide) return;
|
|
11180
11219
|
const nextInner = innerIndex + slideBy;
|
|
11181
11220
|
if (useLoop) {
|
|
@@ -11184,7 +11223,7 @@ var Swiper = (props) => {
|
|
|
11184
11223
|
moveToInner(Math.min(nextInner, maxIndex), true);
|
|
11185
11224
|
}
|
|
11186
11225
|
}, [canSlide, useLoop, innerIndex, slideBy, maxIndex, moveToInner]);
|
|
11187
|
-
const slidePrev =
|
|
11226
|
+
const slidePrev = import_react33.default.useCallback(() => {
|
|
11188
11227
|
if (!canSlide) return;
|
|
11189
11228
|
const prevInner = innerIndex - slideBy;
|
|
11190
11229
|
if (useLoop) {
|
|
@@ -11193,7 +11232,7 @@ var Swiper = (props) => {
|
|
|
11193
11232
|
moveToInner(Math.max(prevInner, 0), true);
|
|
11194
11233
|
}
|
|
11195
11234
|
}, [canSlide, useLoop, innerIndex, slideBy, moveToInner]);
|
|
11196
|
-
|
|
11235
|
+
import_react33.default.useEffect(() => {
|
|
11197
11236
|
if (indexProp === void 0) return;
|
|
11198
11237
|
const clamped = Math.max(0, Math.min(indexProp, maxIndex));
|
|
11199
11238
|
const target = useLoop ? cloneCount + clamped : clamped;
|
|
@@ -11201,12 +11240,12 @@ var Swiper = (props) => {
|
|
|
11201
11240
|
moveToInner(target, true);
|
|
11202
11241
|
}
|
|
11203
11242
|
}, [indexProp]);
|
|
11204
|
-
|
|
11243
|
+
import_react33.default.useImperativeHandle(swiperRef, () => ({
|
|
11205
11244
|
slidePrev,
|
|
11206
11245
|
slideNext,
|
|
11207
11246
|
slideTo
|
|
11208
11247
|
}));
|
|
11209
|
-
|
|
11248
|
+
import_react33.default.useEffect(() => {
|
|
11210
11249
|
if (!auto || !canSlide || paused) return;
|
|
11211
11250
|
autoplayTimerRef.current = setInterval(slideNext, autoplayDelay);
|
|
11212
11251
|
return () => {
|
|
@@ -11232,7 +11271,7 @@ var Swiper = (props) => {
|
|
|
11232
11271
|
resumeTimeoutRef.current = null;
|
|
11233
11272
|
}, pauseOnInteraction);
|
|
11234
11273
|
};
|
|
11235
|
-
|
|
11274
|
+
import_react33.default.useEffect(() => {
|
|
11236
11275
|
return () => {
|
|
11237
11276
|
if (resumeTimeoutRef.current) clearTimeout(resumeTimeoutRef.current);
|
|
11238
11277
|
};
|
|
@@ -11250,7 +11289,7 @@ var Swiper = (props) => {
|
|
|
11250
11289
|
startXRef.current = getClientX(e);
|
|
11251
11290
|
startTimeRef.current = Date.now();
|
|
11252
11291
|
};
|
|
11253
|
-
|
|
11292
|
+
import_react33.default.useEffect(() => {
|
|
11254
11293
|
if (!isDragging) return;
|
|
11255
11294
|
const handleMove = (e) => {
|
|
11256
11295
|
setDragOffset(getClientX(e) - startXRef.current);
|
|
@@ -11289,7 +11328,7 @@ var Swiper = (props) => {
|
|
|
11289
11328
|
}, [isDragging, dragOffset, innerIndex, useLoop, maxIndex, slideStep, moveToInner]);
|
|
11290
11329
|
const slideWidthPercent = 100 / viewItemCount;
|
|
11291
11330
|
const gapAdjust = spaceBetween * (viewItemCount - 1) / viewItemCount;
|
|
11292
|
-
const slideElements =
|
|
11331
|
+
const slideElements = import_react33.default.useMemo(
|
|
11293
11332
|
() => extendedItems.map((item, idx) => /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(
|
|
11294
11333
|
"div",
|
|
11295
11334
|
{
|
|
@@ -11363,7 +11402,7 @@ Swiper.displayName = "Swiper";
|
|
|
11363
11402
|
var Swiper_default = Swiper;
|
|
11364
11403
|
|
|
11365
11404
|
// src/components/Switch/Switch.tsx
|
|
11366
|
-
var
|
|
11405
|
+
var import_react34 = __toESM(require("react"), 1);
|
|
11367
11406
|
var import_jsx_runtime343 = require("react/jsx-runtime");
|
|
11368
11407
|
var KNOB_TRANSITION_MS = 250;
|
|
11369
11408
|
var Switch = (props) => {
|
|
@@ -11377,11 +11416,11 @@ var Switch = (props) => {
|
|
|
11377
11416
|
label,
|
|
11378
11417
|
required
|
|
11379
11418
|
} = props;
|
|
11380
|
-
const fieldId =
|
|
11419
|
+
const fieldId = import_react34.default.useId();
|
|
11381
11420
|
const statusType = normalizeStatus(type);
|
|
11382
|
-
const [isAnimating, setIsAnimating] =
|
|
11383
|
-
const timeoutRef =
|
|
11384
|
-
|
|
11421
|
+
const [isAnimating, setIsAnimating] = import_react34.default.useState(false);
|
|
11422
|
+
const timeoutRef = import_react34.default.useRef(null);
|
|
11423
|
+
import_react34.default.useEffect(() => {
|
|
11385
11424
|
return () => {
|
|
11386
11425
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
11387
11426
|
};
|
|
@@ -11420,10 +11459,10 @@ Switch.displayName = "Switch";
|
|
|
11420
11459
|
var Switch_default = Switch;
|
|
11421
11460
|
|
|
11422
11461
|
// src/components/Table/TableContext.tsx
|
|
11423
|
-
var
|
|
11424
|
-
var TableContext =
|
|
11462
|
+
var import_react35 = __toESM(require("react"), 1);
|
|
11463
|
+
var TableContext = import_react35.default.createContext(null);
|
|
11425
11464
|
var useTableContext = () => {
|
|
11426
|
-
const ctx =
|
|
11465
|
+
const ctx = import_react35.default.useContext(TableContext);
|
|
11427
11466
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
11428
11467
|
return ctx;
|
|
11429
11468
|
};
|
|
@@ -11466,24 +11505,24 @@ TableBody.displayName = "TableBody";
|
|
|
11466
11505
|
var TableBody_default = TableBody;
|
|
11467
11506
|
|
|
11468
11507
|
// src/components/Table/TableCell.tsx
|
|
11469
|
-
var
|
|
11508
|
+
var import_react38 = __toESM(require("react"), 1);
|
|
11470
11509
|
|
|
11471
11510
|
// src/components/Table/TableHeadContext.tsx
|
|
11472
|
-
var
|
|
11473
|
-
var TableHeadContext =
|
|
11511
|
+
var import_react36 = __toESM(require("react"), 1);
|
|
11512
|
+
var TableHeadContext = import_react36.default.createContext(
|
|
11474
11513
|
null
|
|
11475
11514
|
);
|
|
11476
11515
|
var useTableHeadContext = () => {
|
|
11477
|
-
const ctx =
|
|
11516
|
+
const ctx = import_react36.default.useContext(TableHeadContext);
|
|
11478
11517
|
return ctx;
|
|
11479
11518
|
};
|
|
11480
11519
|
var TableHeadContext_default = TableHeadContext;
|
|
11481
11520
|
|
|
11482
11521
|
// src/components/Table/TableRowContext.tsx
|
|
11483
|
-
var
|
|
11484
|
-
var TableRowContext =
|
|
11522
|
+
var import_react37 = __toESM(require("react"), 1);
|
|
11523
|
+
var TableRowContext = import_react37.default.createContext(null);
|
|
11485
11524
|
var useTableRowContext = () => {
|
|
11486
|
-
const ctx =
|
|
11525
|
+
const ctx = import_react37.default.useContext(TableRowContext);
|
|
11487
11526
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
11488
11527
|
return ctx;
|
|
11489
11528
|
};
|
|
@@ -11491,7 +11530,7 @@ var TableRowContext_default = TableRowContext;
|
|
|
11491
11530
|
|
|
11492
11531
|
// src/components/Table/TableCell.tsx
|
|
11493
11532
|
var import_jsx_runtime346 = require("react/jsx-runtime");
|
|
11494
|
-
var TableCell =
|
|
11533
|
+
var TableCell = import_react38.default.memo((props) => {
|
|
11495
11534
|
const {
|
|
11496
11535
|
children,
|
|
11497
11536
|
align = "center",
|
|
@@ -11505,9 +11544,9 @@ var TableCell = import_react37.default.memo((props) => {
|
|
|
11505
11544
|
const { registerStickyCell, stickyCells } = useTableRowContext();
|
|
11506
11545
|
const { stickyShadow } = useTableContext();
|
|
11507
11546
|
const headContext = useTableHeadContext();
|
|
11508
|
-
const [left, setLeft] =
|
|
11509
|
-
const cellRef =
|
|
11510
|
-
const calculateLeft =
|
|
11547
|
+
const [left, setLeft] = import_react38.default.useState(0);
|
|
11548
|
+
const cellRef = import_react38.default.useRef(null);
|
|
11549
|
+
const calculateLeft = import_react38.default.useCallback(() => {
|
|
11511
11550
|
if (!cellRef.current) return 0;
|
|
11512
11551
|
let totalLeft = 0;
|
|
11513
11552
|
for (const ref of stickyCells) {
|
|
@@ -11516,7 +11555,7 @@ var TableCell = import_react37.default.memo((props) => {
|
|
|
11516
11555
|
}
|
|
11517
11556
|
return totalLeft;
|
|
11518
11557
|
}, [stickyCells]);
|
|
11519
|
-
|
|
11558
|
+
import_react38.default.useEffect(() => {
|
|
11520
11559
|
if (!isSticky || !cellRef.current) return;
|
|
11521
11560
|
registerStickyCell(cellRef);
|
|
11522
11561
|
setLeft(calculateLeft());
|
|
@@ -11574,9 +11613,9 @@ TableHead.displayName = "TableHead";
|
|
|
11574
11613
|
var TableHead_default = TableHead;
|
|
11575
11614
|
|
|
11576
11615
|
// src/components/Table/TableRow.tsx
|
|
11577
|
-
var
|
|
11616
|
+
var import_react39 = __toESM(require("react"), 1);
|
|
11578
11617
|
var import_jsx_runtime348 = require("react/jsx-runtime");
|
|
11579
|
-
var TableRow =
|
|
11618
|
+
var TableRow = import_react39.default.memo((props) => {
|
|
11580
11619
|
const {
|
|
11581
11620
|
children,
|
|
11582
11621
|
type = "secondary",
|
|
@@ -11585,7 +11624,7 @@ var TableRow = import_react38.default.memo((props) => {
|
|
|
11585
11624
|
onClick
|
|
11586
11625
|
} = props;
|
|
11587
11626
|
const { rowBorderUse } = useTableContext();
|
|
11588
|
-
const [stickyCells, setStickyCells] =
|
|
11627
|
+
const [stickyCells, setStickyCells] = import_react39.default.useState([]);
|
|
11589
11628
|
const registerStickyCell = (ref) => {
|
|
11590
11629
|
setStickyCells((prev) => {
|
|
11591
11630
|
if (prev.includes(ref)) return prev;
|
|
@@ -11649,9 +11688,9 @@ Tag.displayName = "Tag";
|
|
|
11649
11688
|
var Tag_default = Tag;
|
|
11650
11689
|
|
|
11651
11690
|
// src/components/TextArea/TextArea.tsx
|
|
11652
|
-
var
|
|
11691
|
+
var import_react40 = __toESM(require("react"), 1);
|
|
11653
11692
|
var import_jsx_runtime350 = require("react/jsx-runtime");
|
|
11654
|
-
var TextArea =
|
|
11693
|
+
var TextArea = import_react40.default.forwardRef(
|
|
11655
11694
|
(props, ref) => {
|
|
11656
11695
|
const {
|
|
11657
11696
|
className,
|
|
@@ -11664,7 +11703,7 @@ var TextArea = import_react39.default.forwardRef(
|
|
|
11664
11703
|
disabled,
|
|
11665
11704
|
...textareaProps
|
|
11666
11705
|
} = props;
|
|
11667
|
-
const autoId =
|
|
11706
|
+
const autoId = import_react40.default.useId();
|
|
11668
11707
|
const fieldId = props.id ?? autoId;
|
|
11669
11708
|
const control = /* @__PURE__ */ (0, import_jsx_runtime350.jsx)("div", { className: clsx_default("lib-xplat-textarea-wrap", className), children: /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
|
|
11670
11709
|
"textarea",
|
|
@@ -11686,7 +11725,7 @@ TextArea.displayName = "TextArea";
|
|
|
11686
11725
|
var TextArea_default = TextArea;
|
|
11687
11726
|
|
|
11688
11727
|
// src/components/TimePicker/TimePicker.tsx
|
|
11689
|
-
var
|
|
11728
|
+
var import_react41 = __toESM(require("react"), 1);
|
|
11690
11729
|
var import_jsx_runtime351 = require("react/jsx-runtime");
|
|
11691
11730
|
var ANIMATION_DURATION_MS4 = 200;
|
|
11692
11731
|
var toMinutes = (hhmm) => {
|
|
@@ -11724,13 +11763,13 @@ var TimePicker = (props) => {
|
|
|
11724
11763
|
required,
|
|
11725
11764
|
validations
|
|
11726
11765
|
} = props;
|
|
11727
|
-
const fieldId =
|
|
11728
|
-
const triggerRef =
|
|
11729
|
-
const contentRef =
|
|
11730
|
-
const [isOpen, setOpen] =
|
|
11731
|
-
const [mounted, setMounted] =
|
|
11732
|
-
const [visible, setVisible] =
|
|
11733
|
-
const options =
|
|
11766
|
+
const fieldId = import_react41.default.useId();
|
|
11767
|
+
const triggerRef = import_react41.default.useRef(null);
|
|
11768
|
+
const contentRef = import_react41.default.useRef(null);
|
|
11769
|
+
const [isOpen, setOpen] = import_react41.default.useState(false);
|
|
11770
|
+
const [mounted, setMounted] = import_react41.default.useState(false);
|
|
11771
|
+
const [visible, setVisible] = import_react41.default.useState(false);
|
|
11772
|
+
const options = import_react41.default.useMemo(() => {
|
|
11734
11773
|
const safeStep = step > 0 && step <= 720 ? step : 30;
|
|
11735
11774
|
const lo = toMinutes(min) ?? 0;
|
|
11736
11775
|
const hi = toMinutes(max) ?? 24 * 60 - 1;
|
|
@@ -11738,18 +11777,19 @@ var TimePicker = (props) => {
|
|
|
11738
11777
|
for (let t = lo; t <= hi; t += safeStep) out.push(toHHmm(t));
|
|
11739
11778
|
return out;
|
|
11740
11779
|
}, [step, min, max]);
|
|
11741
|
-
const close =
|
|
11780
|
+
const close = import_react41.default.useCallback(() => setOpen(false), []);
|
|
11742
11781
|
useClickOutside_default([triggerRef, contentRef], close, isOpen);
|
|
11743
11782
|
useCloseWhenFocusHidden(isOpen, triggerRef, contentRef, close);
|
|
11744
11783
|
useEscapeKey(isOpen, () => {
|
|
11745
11784
|
close();
|
|
11746
11785
|
triggerRef.current?.focus({ preventScroll: true });
|
|
11747
11786
|
});
|
|
11787
|
+
const host = useOverlayHost_default(triggerRef, mounted);
|
|
11748
11788
|
useAutoPosition_default(triggerRef, contentRef, mounted);
|
|
11749
|
-
|
|
11789
|
+
import_react41.default.useEffect(() => {
|
|
11750
11790
|
if (disabled && isOpen) setOpen(false);
|
|
11751
11791
|
}, [disabled, isOpen]);
|
|
11752
|
-
|
|
11792
|
+
import_react41.default.useEffect(() => {
|
|
11753
11793
|
if (isOpen) {
|
|
11754
11794
|
setMounted(true);
|
|
11755
11795
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -11787,7 +11827,7 @@ var TimePicker = (props) => {
|
|
|
11787
11827
|
children: /* @__PURE__ */ (0, import_jsx_runtime351.jsx)("span", { className: clsx_default("time-picker-value", !value && "placeholder"), children: value ? display(value, use12Hours) : placeholder })
|
|
11788
11828
|
}
|
|
11789
11829
|
),
|
|
11790
|
-
mounted && /* @__PURE__ */ (0, import_jsx_runtime351.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime351.jsx)(
|
|
11830
|
+
mounted && /* @__PURE__ */ (0, import_jsx_runtime351.jsx)(Portal_default, { container: host, children: /* @__PURE__ */ (0, import_jsx_runtime351.jsx)(
|
|
11791
11831
|
"div",
|
|
11792
11832
|
{
|
|
11793
11833
|
ref: contentRef,
|
|
@@ -11821,20 +11861,20 @@ TimePicker.displayName = "TimePicker";
|
|
|
11821
11861
|
var TimePicker_default = TimePicker;
|
|
11822
11862
|
|
|
11823
11863
|
// src/components/Toast/Toast.tsx
|
|
11824
|
-
var
|
|
11864
|
+
var import_react42 = __toESM(require("react"), 1);
|
|
11825
11865
|
var import_react_dom4 = require("react-dom");
|
|
11826
11866
|
var import_jsx_runtime352 = require("react/jsx-runtime");
|
|
11827
|
-
var ToastContext =
|
|
11867
|
+
var ToastContext = import_react42.default.createContext(null);
|
|
11828
11868
|
var useToast = () => {
|
|
11829
|
-
const ctx =
|
|
11869
|
+
const ctx = import_react42.default.useContext(ToastContext);
|
|
11830
11870
|
if (!ctx) throw new Error("useToast must be used within ToastProvider");
|
|
11831
11871
|
return ctx;
|
|
11832
11872
|
};
|
|
11833
11873
|
var EXIT_DURATION = 300;
|
|
11834
11874
|
var ToastItemComponent = ({ item, isExiting, onClose }) => {
|
|
11835
|
-
const ref =
|
|
11836
|
-
const [height, setHeight] =
|
|
11837
|
-
|
|
11875
|
+
const ref = import_react42.default.useRef(null);
|
|
11876
|
+
const [height, setHeight] = import_react42.default.useState(void 0);
|
|
11877
|
+
import_react42.default.useEffect(() => {
|
|
11838
11878
|
if (ref.current && !isExiting) {
|
|
11839
11879
|
setHeight(ref.current.offsetHeight);
|
|
11840
11880
|
}
|
|
@@ -11866,13 +11906,13 @@ var ToastProvider = ({
|
|
|
11866
11906
|
children,
|
|
11867
11907
|
position = "top-right"
|
|
11868
11908
|
}) => {
|
|
11869
|
-
const [toasts, setToasts] =
|
|
11870
|
-
const [removing, setRemoving] =
|
|
11871
|
-
const [mounted, setMounted] =
|
|
11872
|
-
|
|
11909
|
+
const [toasts, setToasts] = import_react42.default.useState([]);
|
|
11910
|
+
const [removing, setRemoving] = import_react42.default.useState(/* @__PURE__ */ new Set());
|
|
11911
|
+
const [mounted, setMounted] = import_react42.default.useState(false);
|
|
11912
|
+
import_react42.default.useEffect(() => {
|
|
11873
11913
|
setMounted(true);
|
|
11874
11914
|
}, []);
|
|
11875
|
-
const remove =
|
|
11915
|
+
const remove = import_react42.default.useCallback((id) => {
|
|
11876
11916
|
setRemoving((prev) => new Set(prev).add(id));
|
|
11877
11917
|
setTimeout(() => {
|
|
11878
11918
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
@@ -11883,7 +11923,7 @@ var ToastProvider = ({
|
|
|
11883
11923
|
});
|
|
11884
11924
|
}, EXIT_DURATION);
|
|
11885
11925
|
}, []);
|
|
11886
|
-
const toast =
|
|
11926
|
+
const toast = import_react42.default.useCallback(
|
|
11887
11927
|
(type, message, duration = 3e3) => {
|
|
11888
11928
|
const id = `${Date.now()}-${Math.random()}`;
|
|
11889
11929
|
setToasts((prev) => [...prev, { id, type, message }]);
|
|
@@ -11936,7 +11976,7 @@ ToggleChip.displayName = "ToggleChip";
|
|
|
11936
11976
|
var ToggleChip_default = ToggleChip;
|
|
11937
11977
|
|
|
11938
11978
|
// src/components/Tooltip/Tooltip.tsx
|
|
11939
|
-
var
|
|
11979
|
+
var import_react43 = __toESM(require("react"), 1);
|
|
11940
11980
|
var import_jsx_runtime354 = require("react/jsx-runtime");
|
|
11941
11981
|
var OFFSET = 12;
|
|
11942
11982
|
var GAP = 8;
|
|
@@ -11952,14 +11992,14 @@ var Tooltip = (props) => {
|
|
|
11952
11992
|
disabled = false
|
|
11953
11993
|
} = props;
|
|
11954
11994
|
const shape = variant ?? type ?? "dark";
|
|
11955
|
-
const triggerRef =
|
|
11956
|
-
const tooltipRef =
|
|
11957
|
-
const [visible, setVisible] =
|
|
11958
|
-
const [pos, setPos] =
|
|
11959
|
-
const delayTimer =
|
|
11960
|
-
const rafRef =
|
|
11961
|
-
const cursor =
|
|
11962
|
-
const clamp =
|
|
11995
|
+
const triggerRef = import_react43.default.useRef(null);
|
|
11996
|
+
const tooltipRef = import_react43.default.useRef(null);
|
|
11997
|
+
const [visible, setVisible] = import_react43.default.useState(false);
|
|
11998
|
+
const [pos, setPos] = import_react43.default.useState({ left: 0, top: 0 });
|
|
11999
|
+
const delayTimer = import_react43.default.useRef(0);
|
|
12000
|
+
const rafRef = import_react43.default.useRef(0);
|
|
12001
|
+
const cursor = import_react43.default.useRef(null);
|
|
12002
|
+
const clamp = import_react43.default.useCallback((left, top, w, h) => {
|
|
11963
12003
|
const vw = window.innerWidth;
|
|
11964
12004
|
const vh = window.innerHeight;
|
|
11965
12005
|
return {
|
|
@@ -11967,7 +12007,7 @@ var Tooltip = (props) => {
|
|
|
11967
12007
|
top: Math.min(Math.max(GAP, top), Math.max(GAP, vh - h - GAP))
|
|
11968
12008
|
};
|
|
11969
12009
|
}, []);
|
|
11970
|
-
const placeAtCursor =
|
|
12010
|
+
const placeAtCursor = import_react43.default.useCallback((x, y) => {
|
|
11971
12011
|
const el = tooltipRef.current;
|
|
11972
12012
|
if (!el) return;
|
|
11973
12013
|
const w = el.offsetWidth;
|
|
@@ -11978,7 +12018,7 @@ var Tooltip = (props) => {
|
|
|
11978
12018
|
if (top < GAP) top = y + OFFSET;
|
|
11979
12019
|
setPos(clamp(left, top, w, h));
|
|
11980
12020
|
}, [clamp]);
|
|
11981
|
-
const placeAtTrigger =
|
|
12021
|
+
const placeAtTrigger = import_react43.default.useCallback(() => {
|
|
11982
12022
|
const el = tooltipRef.current;
|
|
11983
12023
|
const trigger = triggerRef.current;
|
|
11984
12024
|
if (!el || !trigger) return;
|
|
@@ -11990,19 +12030,19 @@ var Tooltip = (props) => {
|
|
|
11990
12030
|
const left = rect.left + rect.width / 2 - w / 2;
|
|
11991
12031
|
setPos(clamp(left, top, w, h));
|
|
11992
12032
|
}, [clamp]);
|
|
11993
|
-
const reposition =
|
|
12033
|
+
const reposition = import_react43.default.useCallback(() => {
|
|
11994
12034
|
if (follow && cursor.current) {
|
|
11995
12035
|
placeAtCursor(cursor.current.x, cursor.current.y);
|
|
11996
12036
|
} else {
|
|
11997
12037
|
placeAtTrigger();
|
|
11998
12038
|
}
|
|
11999
12039
|
}, [follow, placeAtCursor, placeAtTrigger]);
|
|
12000
|
-
const handleMouseEnter =
|
|
12040
|
+
const handleMouseEnter = import_react43.default.useCallback((e) => {
|
|
12001
12041
|
if (disabled) return;
|
|
12002
12042
|
cursor.current = { x: e.clientX, y: e.clientY };
|
|
12003
12043
|
delayTimer.current = window.setTimeout(() => setVisible(true), SHOW_DELAY);
|
|
12004
12044
|
}, [disabled]);
|
|
12005
|
-
const handleMouseMove =
|
|
12045
|
+
const handleMouseMove = import_react43.default.useCallback((e) => {
|
|
12006
12046
|
cursor.current = { x: e.clientX, y: e.clientY };
|
|
12007
12047
|
if (!visible || !follow) return;
|
|
12008
12048
|
cancelAnimationFrame(rafRef.current);
|
|
@@ -12010,25 +12050,25 @@ var Tooltip = (props) => {
|
|
|
12010
12050
|
if (cursor.current) placeAtCursor(cursor.current.x, cursor.current.y);
|
|
12011
12051
|
});
|
|
12012
12052
|
}, [visible, follow, placeAtCursor]);
|
|
12013
|
-
const close =
|
|
12053
|
+
const close = import_react43.default.useCallback(() => {
|
|
12014
12054
|
window.clearTimeout(delayTimer.current);
|
|
12015
12055
|
cancelAnimationFrame(rafRef.current);
|
|
12016
12056
|
setVisible(false);
|
|
12017
12057
|
}, []);
|
|
12018
|
-
const handleMouseLeave =
|
|
12058
|
+
const handleMouseLeave = import_react43.default.useCallback(() => {
|
|
12019
12059
|
cursor.current = null;
|
|
12020
12060
|
close();
|
|
12021
12061
|
}, [close]);
|
|
12022
|
-
const handleFocus =
|
|
12062
|
+
const handleFocus = import_react43.default.useCallback(() => {
|
|
12023
12063
|
if (disabled) return;
|
|
12024
12064
|
cursor.current = null;
|
|
12025
12065
|
setVisible(true);
|
|
12026
12066
|
}, [disabled]);
|
|
12027
|
-
|
|
12067
|
+
import_react43.default.useLayoutEffect(() => {
|
|
12028
12068
|
if (!visible) return;
|
|
12029
12069
|
reposition();
|
|
12030
12070
|
}, [visible, reposition]);
|
|
12031
|
-
|
|
12071
|
+
import_react43.default.useEffect(() => {
|
|
12032
12072
|
if (!visible || follow) return;
|
|
12033
12073
|
const onChange = () => placeAtTrigger();
|
|
12034
12074
|
window.addEventListener("scroll", onChange, true);
|
|
@@ -12038,7 +12078,7 @@ var Tooltip = (props) => {
|
|
|
12038
12078
|
window.removeEventListener("resize", onChange);
|
|
12039
12079
|
};
|
|
12040
12080
|
}, [visible, follow, placeAtTrigger]);
|
|
12041
|
-
|
|
12081
|
+
import_react43.default.useEffect(() => () => {
|
|
12042
12082
|
window.clearTimeout(delayTimer.current);
|
|
12043
12083
|
cancelAnimationFrame(rafRef.current);
|
|
12044
12084
|
}, []);
|
|
@@ -12077,7 +12117,7 @@ Tooltip.displayName = "Tooltip";
|
|
|
12077
12117
|
var Tooltip_default = Tooltip;
|
|
12078
12118
|
|
|
12079
12119
|
// src/components/Video/Video.tsx
|
|
12080
|
-
var
|
|
12120
|
+
var import_react44 = __toESM(require("react"), 1);
|
|
12081
12121
|
var import_jsx_runtime355 = require("react/jsx-runtime");
|
|
12082
12122
|
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: [
|
|
12083
12123
|
/* @__PURE__ */ (0, import_jsx_runtime355.jsx)("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
|
|
@@ -12089,7 +12129,7 @@ var formatTime = (sec) => {
|
|
|
12089
12129
|
const s = Math.floor(sec % 60);
|
|
12090
12130
|
return `${m}:${s.toString().padStart(2, "0")}`;
|
|
12091
12131
|
};
|
|
12092
|
-
var Video =
|
|
12132
|
+
var Video = import_react44.default.forwardRef((props, ref) => {
|
|
12093
12133
|
const {
|
|
12094
12134
|
src,
|
|
12095
12135
|
poster,
|
|
@@ -12113,21 +12153,21 @@ var Video = import_react43.default.forwardRef((props, ref) => {
|
|
|
12113
12153
|
children,
|
|
12114
12154
|
...rest
|
|
12115
12155
|
} = props;
|
|
12116
|
-
const containerRef =
|
|
12117
|
-
const videoRef =
|
|
12118
|
-
const [isPlaying, setIsPlaying] =
|
|
12119
|
-
const [isLoaded, setIsLoaded] =
|
|
12120
|
-
const [currentTime, setCurrentTime] =
|
|
12121
|
-
const [duration, setDuration] =
|
|
12122
|
-
const [buffered, setBuffered] =
|
|
12123
|
-
const [volume, setVolume] =
|
|
12124
|
-
const [isMuted, setIsMuted] =
|
|
12125
|
-
const [isFullscreen, setIsFullscreen] =
|
|
12126
|
-
const [playbackRate, setPlaybackRate] =
|
|
12127
|
-
const [rateMenuOpen, setRateMenuOpen] =
|
|
12128
|
-
const [captionsOn, setCaptionsOn] =
|
|
12129
|
-
const [isPip, setIsPip] =
|
|
12130
|
-
const setRefs =
|
|
12156
|
+
const containerRef = import_react44.default.useRef(null);
|
|
12157
|
+
const videoRef = import_react44.default.useRef(null);
|
|
12158
|
+
const [isPlaying, setIsPlaying] = import_react44.default.useState(Boolean(autoPlay));
|
|
12159
|
+
const [isLoaded, setIsLoaded] = import_react44.default.useState(false);
|
|
12160
|
+
const [currentTime, setCurrentTime] = import_react44.default.useState(0);
|
|
12161
|
+
const [duration, setDuration] = import_react44.default.useState(0);
|
|
12162
|
+
const [buffered, setBuffered] = import_react44.default.useState(0);
|
|
12163
|
+
const [volume, setVolume] = import_react44.default.useState(1);
|
|
12164
|
+
const [isMuted, setIsMuted] = import_react44.default.useState(Boolean(muted));
|
|
12165
|
+
const [isFullscreen, setIsFullscreen] = import_react44.default.useState(false);
|
|
12166
|
+
const [playbackRate, setPlaybackRate] = import_react44.default.useState(1);
|
|
12167
|
+
const [rateMenuOpen, setRateMenuOpen] = import_react44.default.useState(false);
|
|
12168
|
+
const [captionsOn, setCaptionsOn] = import_react44.default.useState(false);
|
|
12169
|
+
const [isPip, setIsPip] = import_react44.default.useState(false);
|
|
12170
|
+
const setRefs = import_react44.default.useCallback(
|
|
12131
12171
|
(el) => {
|
|
12132
12172
|
videoRef.current = el;
|
|
12133
12173
|
if (typeof ref === "function") ref(el);
|
|
@@ -12135,14 +12175,14 @@ var Video = import_react43.default.forwardRef((props, ref) => {
|
|
|
12135
12175
|
},
|
|
12136
12176
|
[ref]
|
|
12137
12177
|
);
|
|
12138
|
-
|
|
12178
|
+
import_react44.default.useEffect(() => {
|
|
12139
12179
|
const onFsChange = () => {
|
|
12140
12180
|
setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
12141
12181
|
};
|
|
12142
12182
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
12143
12183
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
12144
12184
|
}, []);
|
|
12145
|
-
|
|
12185
|
+
import_react44.default.useEffect(() => {
|
|
12146
12186
|
const v = videoRef.current;
|
|
12147
12187
|
if (!v) return;
|
|
12148
12188
|
const onEnter = () => setIsPip(true);
|
|
@@ -12531,13 +12571,13 @@ Layout.displayName = "Layout";
|
|
|
12531
12571
|
var Layout_default = Layout;
|
|
12532
12572
|
|
|
12533
12573
|
// src/layout/SideBar/SideBar.tsx
|
|
12534
|
-
var
|
|
12574
|
+
var import_react46 = __toESM(require("react"), 1);
|
|
12535
12575
|
|
|
12536
12576
|
// src/layout/SideBar/SideBarContext.tsx
|
|
12537
|
-
var
|
|
12538
|
-
var SideBarContext =
|
|
12577
|
+
var import_react45 = __toESM(require("react"), 1);
|
|
12578
|
+
var SideBarContext = import_react45.default.createContext(null);
|
|
12539
12579
|
var useSideBarContext = () => {
|
|
12540
|
-
const ctx =
|
|
12580
|
+
const ctx = import_react45.default.useContext(SideBarContext);
|
|
12541
12581
|
if (!ctx) throw new Error("Error");
|
|
12542
12582
|
return ctx;
|
|
12543
12583
|
};
|
|
@@ -12547,7 +12587,7 @@ var SideBarContext_default = SideBarContext;
|
|
|
12547
12587
|
var import_jsx_runtime361 = require("react/jsx-runtime");
|
|
12548
12588
|
var SideBar = (props) => {
|
|
12549
12589
|
const { children, className } = props;
|
|
12550
|
-
const [isOpen, setIsOpen] =
|
|
12590
|
+
const [isOpen, setIsOpen] = import_react46.default.useState(true);
|
|
12551
12591
|
const handleSwitchSideBar = () => {
|
|
12552
12592
|
setIsOpen((prev) => !prev);
|
|
12553
12593
|
};
|