@x-plat/design-system 0.14.19 → 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 +44 -16
- package/dist/components/Dropdown/index.js +44 -16
- package/dist/components/PopOver/index.cjs +43 -15
- package/dist/components/PopOver/index.js +43 -15
- package/dist/components/Select/index.cjs +63 -35
- package/dist/components/Select/index.js +63 -35
- package/dist/components/TimePicker/index.cjs +48 -20
- package/dist/components/TimePicker/index.js +48 -20
- package/dist/components/Tooltip/index.cjs +2 -2
- package/dist/components/Tooltip/index.js +2 -2
- package/dist/components/index.cjs +245 -214
- package/dist/components/index.js +245 -214
- package/dist/index.cjs +250 -219
- package/dist/index.js +250 -219
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7745,8 +7745,9 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
7745
7745
|
);
|
|
7746
7746
|
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
7747
7747
|
const maxHeight = frozenMaxRef.current;
|
|
7748
|
-
|
|
7749
|
-
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`;
|
|
7750
7751
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
7751
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";
|
|
7752
7753
|
directionRef.current = next;
|
|
@@ -8548,13 +8549,13 @@ Drawer.displayName = "Drawer";
|
|
|
8548
8549
|
var Drawer_default = Drawer;
|
|
8549
8550
|
|
|
8550
8551
|
// src/components/Dropdown/Dropdown.tsx
|
|
8551
|
-
var
|
|
8552
|
+
var import_react22 = __toESM(require("react"), 1);
|
|
8552
8553
|
|
|
8553
8554
|
// src/tokens/hooks/Portal.tsx
|
|
8554
8555
|
var import_react_dom3 = __toESM(require("react-dom"), 1);
|
|
8555
|
-
var Portal = ({ children }) => {
|
|
8556
|
+
var Portal = ({ children, container }) => {
|
|
8556
8557
|
if (typeof document === "undefined") return null;
|
|
8557
|
-
return import_react_dom3.default.createPortal(children, document.body);
|
|
8558
|
+
return import_react_dom3.default.createPortal(children, container ?? document.body);
|
|
8558
8559
|
};
|
|
8559
8560
|
Portal.displayName = "Portal";
|
|
8560
8561
|
var Portal_default = Portal;
|
|
@@ -8584,15 +8585,42 @@ var useClickOutside = (refs, handler, enabled = true) => {
|
|
|
8584
8585
|
};
|
|
8585
8586
|
var useClickOutside_default = useClickOutside;
|
|
8586
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
|
+
|
|
8587
8614
|
// src/components/Dropdown/Dropdown.tsx
|
|
8588
8615
|
var import_jsx_runtime322 = require("react/jsx-runtime");
|
|
8589
8616
|
var Dropdown = (props) => {
|
|
8590
8617
|
const { items, children } = props;
|
|
8591
|
-
const [isOpen, setIsOpen] =
|
|
8592
|
-
const [mounted, setMounted] =
|
|
8593
|
-
const [visible, setVisible] =
|
|
8594
|
-
const triggerRef =
|
|
8595
|
-
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);
|
|
8596
8624
|
useAutoPosition_default(triggerRef, menuRef, mounted);
|
|
8597
8625
|
useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false), isOpen);
|
|
8598
8626
|
useCloseWhenFocusHidden(isOpen, triggerRef, menuRef, () => setIsOpen(false));
|
|
@@ -8600,7 +8628,7 @@ var Dropdown = (props) => {
|
|
|
8600
8628
|
setIsOpen(false);
|
|
8601
8629
|
triggerRef.current?.focus({ preventScroll: true });
|
|
8602
8630
|
});
|
|
8603
|
-
|
|
8631
|
+
import_react22.default.useEffect(() => {
|
|
8604
8632
|
if (isOpen) {
|
|
8605
8633
|
setMounted(true);
|
|
8606
8634
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -8625,7 +8653,7 @@ var Dropdown = (props) => {
|
|
|
8625
8653
|
children
|
|
8626
8654
|
}
|
|
8627
8655
|
),
|
|
8628
|
-
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)(
|
|
8629
8657
|
"div",
|
|
8630
8658
|
{
|
|
8631
8659
|
ref: menuRef,
|
|
@@ -8653,7 +8681,7 @@ Dropdown.displayName = "Dropdown";
|
|
|
8653
8681
|
var Dropdown_default = Dropdown;
|
|
8654
8682
|
|
|
8655
8683
|
// src/components/Editor/Editor.tsx
|
|
8656
|
-
var
|
|
8684
|
+
var import_react23 = __toESM(require("react"), 1);
|
|
8657
8685
|
|
|
8658
8686
|
// src/components/Editor/highlight.ts
|
|
8659
8687
|
var CODE_LANGUAGES = [
|
|
@@ -8924,22 +8952,22 @@ var Editor = (props) => {
|
|
|
8924
8952
|
onImageUpload,
|
|
8925
8953
|
minHeight = 200
|
|
8926
8954
|
} = 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
|
-
|
|
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(() => {
|
|
8943
8971
|
const el = editorRef.current;
|
|
8944
8972
|
if (!el) return;
|
|
8945
8973
|
if (value === lastEmittedRef.current) return;
|
|
@@ -9021,10 +9049,10 @@ var Editor = (props) => {
|
|
|
9021
9049
|
const current = String(document.queryCommandValue("formatBlock") || "").toLowerCase();
|
|
9022
9050
|
setBlock(current === tag ? "p" : tag);
|
|
9023
9051
|
};
|
|
9024
|
-
const historyRef =
|
|
9025
|
-
const historyIdxRef =
|
|
9026
|
-
const lastPushAtRef =
|
|
9027
|
-
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);
|
|
9028
9056
|
const caretOffset = (rootEl) => {
|
|
9029
9057
|
const el = rootEl ?? editorRef.current;
|
|
9030
9058
|
const sel = window.getSelection();
|
|
@@ -9101,8 +9129,8 @@ var Editor = (props) => {
|
|
|
9101
9129
|
const cls = Array.from(pre.classList).find((c) => c.startsWith("lang-"));
|
|
9102
9130
|
return cls?.slice(5) ?? "plain";
|
|
9103
9131
|
};
|
|
9104
|
-
const [codeLang, setCodeLang] =
|
|
9105
|
-
const highlightRafRef =
|
|
9132
|
+
const [codeLang, setCodeLang] = import_react23.default.useState("plain");
|
|
9133
|
+
const highlightRafRef = import_react23.default.useRef(0);
|
|
9106
9134
|
const rehighlight = (pre) => {
|
|
9107
9135
|
if (composingRef.current) return;
|
|
9108
9136
|
const code = pre.querySelector("code");
|
|
@@ -9447,7 +9475,7 @@ var Editor = (props) => {
|
|
|
9447
9475
|
setSlashIdx(0);
|
|
9448
9476
|
slashStartRangeRef.current = null;
|
|
9449
9477
|
};
|
|
9450
|
-
const filteredSlashItems =
|
|
9478
|
+
const filteredSlashItems = import_react23.default.useMemo(() => {
|
|
9451
9479
|
if (!slashFilter) return SLASH_ITEMS;
|
|
9452
9480
|
const f = slashFilter.toLowerCase();
|
|
9453
9481
|
return SLASH_ITEMS.filter((it) => it.label.toLowerCase().includes(f) || it.key.includes(f));
|
|
@@ -9712,7 +9740,7 @@ var Editor = (props) => {
|
|
|
9712
9740
|
}
|
|
9713
9741
|
}
|
|
9714
9742
|
};
|
|
9715
|
-
const plainPasteRef =
|
|
9743
|
+
const plainPasteRef = import_react23.default.useRef(false);
|
|
9716
9744
|
const handlePaste = (e) => {
|
|
9717
9745
|
if (readOnly) return;
|
|
9718
9746
|
e.preventDefault();
|
|
@@ -10013,7 +10041,7 @@ var EditorToolbar = ({
|
|
|
10013
10041
|
] });
|
|
10014
10042
|
};
|
|
10015
10043
|
var SlashMenu = ({ position, items, activeIndex, onSelect, onClose }) => {
|
|
10016
|
-
|
|
10044
|
+
import_react23.default.useEffect(() => {
|
|
10017
10045
|
const handleClickOutside = (e) => {
|
|
10018
10046
|
const target = e.target;
|
|
10019
10047
|
const menu = document.querySelector(".lib-xplat-editor__slash-menu");
|
|
@@ -10047,8 +10075,8 @@ var SlashMenu = ({ position, items, activeIndex, onSelect, onClose }) => {
|
|
|
10047
10075
|
);
|
|
10048
10076
|
};
|
|
10049
10077
|
var LinkPopover = ({ position, value, onChange, onConfirm, onClose }) => {
|
|
10050
|
-
const inputRef =
|
|
10051
|
-
|
|
10078
|
+
const inputRef = import_react23.default.useRef(null);
|
|
10079
|
+
import_react23.default.useEffect(() => {
|
|
10052
10080
|
inputRef.current?.focus();
|
|
10053
10081
|
}, []);
|
|
10054
10082
|
return /* @__PURE__ */ (0, import_jsx_runtime323.jsxs)(
|
|
@@ -10106,7 +10134,7 @@ EmptyState.displayName = "EmptyState";
|
|
|
10106
10134
|
var EmptyState_default = EmptyState;
|
|
10107
10135
|
|
|
10108
10136
|
// src/components/FileUpload/FileUpload.tsx
|
|
10109
|
-
var
|
|
10137
|
+
var import_react24 = __toESM(require("react"), 1);
|
|
10110
10138
|
var import_jsx_runtime325 = require("react/jsx-runtime");
|
|
10111
10139
|
var FileUpload = (props) => {
|
|
10112
10140
|
const {
|
|
@@ -10120,9 +10148,9 @@ var FileUpload = (props) => {
|
|
|
10120
10148
|
label,
|
|
10121
10149
|
required
|
|
10122
10150
|
} = props;
|
|
10123
|
-
const fieldId =
|
|
10124
|
-
const [isDragOver, setIsDragOver] =
|
|
10125
|
-
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);
|
|
10126
10154
|
const handleFiles = (fileList) => {
|
|
10127
10155
|
let files = Array.from(fileList);
|
|
10128
10156
|
if (maxSize) {
|
|
@@ -10185,10 +10213,10 @@ FileUpload.displayName = "FileUpload";
|
|
|
10185
10213
|
var FileUpload_default = FileUpload;
|
|
10186
10214
|
|
|
10187
10215
|
// src/components/HtmlTypeWriter/HtmlTypeWriter.tsx
|
|
10188
|
-
var
|
|
10216
|
+
var import_react26 = __toESM(require("react"), 1);
|
|
10189
10217
|
|
|
10190
10218
|
// src/components/HtmlTypeWriter/utils.ts
|
|
10191
|
-
var
|
|
10219
|
+
var import_react25 = __toESM(require("react"), 1);
|
|
10192
10220
|
var voidTags = /* @__PURE__ */ new Set([
|
|
10193
10221
|
"br",
|
|
10194
10222
|
"img",
|
|
@@ -10256,15 +10284,15 @@ var convertNodeToReactWithRange = (node, typedLen, rangeMap) => {
|
|
|
10256
10284
|
props[attr.name] = attr.value;
|
|
10257
10285
|
});
|
|
10258
10286
|
if (voidTags.has(tag)) {
|
|
10259
|
-
return
|
|
10287
|
+
return import_react25.default.createElement(tag, props);
|
|
10260
10288
|
}
|
|
10261
10289
|
const children = Array.from(element.childNodes).map((child) => convertNodeToReactWithRange(child, typedLen, rangeMap)).filter((n) => n != null);
|
|
10262
|
-
return
|
|
10290
|
+
return import_react25.default.createElement(tag, props, ...children);
|
|
10263
10291
|
};
|
|
10264
10292
|
var htmlToReactProgressive = (root, typedLen, rangeMap) => {
|
|
10265
10293
|
const nodes = Array.from(root.childNodes).map((child, idx) => {
|
|
10266
10294
|
const node = convertNodeToReactWithRange(child, typedLen, rangeMap);
|
|
10267
|
-
return node == null ? null :
|
|
10295
|
+
return node == null ? null : import_react25.default.createElement(import_react25.default.Fragment, { key: idx }, node);
|
|
10268
10296
|
}).filter(Boolean);
|
|
10269
10297
|
return nodes.length === 0 ? null : nodes;
|
|
10270
10298
|
};
|
|
@@ -10277,20 +10305,20 @@ var HtmlTypeWriter = ({
|
|
|
10277
10305
|
onDone,
|
|
10278
10306
|
onChange
|
|
10279
10307
|
}) => {
|
|
10280
|
-
const [typedLen, setTypedLen] =
|
|
10281
|
-
const doneCalledRef =
|
|
10282
|
-
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(() => {
|
|
10283
10311
|
if (typeof window === "undefined") return { doc: null, rangeMap: /* @__PURE__ */ new Map(), totalLength: 0 };
|
|
10284
10312
|
const decoded = decodeHtmlEntities(html);
|
|
10285
10313
|
const doc2 = new DOMParser().parseFromString(decoded, "text/html");
|
|
10286
10314
|
const { rangeMap: rangeMap2, totalLength: totalLength2 } = buildRangeMap(doc2.body);
|
|
10287
10315
|
return { doc: doc2, rangeMap: rangeMap2, totalLength: totalLength2 };
|
|
10288
10316
|
}, [html]);
|
|
10289
|
-
|
|
10317
|
+
import_react26.default.useEffect(() => {
|
|
10290
10318
|
setTypedLen(0);
|
|
10291
10319
|
doneCalledRef.current = false;
|
|
10292
10320
|
}, [html]);
|
|
10293
|
-
|
|
10321
|
+
import_react26.default.useEffect(() => {
|
|
10294
10322
|
if (!totalLength) return;
|
|
10295
10323
|
if (typedLen >= totalLength) return;
|
|
10296
10324
|
const timer = window.setInterval(() => {
|
|
@@ -10298,18 +10326,18 @@ var HtmlTypeWriter = ({
|
|
|
10298
10326
|
}, duration);
|
|
10299
10327
|
return () => window.clearInterval(timer);
|
|
10300
10328
|
}, [typedLen, totalLength, duration]);
|
|
10301
|
-
|
|
10329
|
+
import_react26.default.useEffect(() => {
|
|
10302
10330
|
if (typedLen > 0 && typedLen < totalLength) {
|
|
10303
10331
|
onChange?.();
|
|
10304
10332
|
}
|
|
10305
10333
|
}, [typedLen, totalLength, onChange]);
|
|
10306
|
-
|
|
10334
|
+
import_react26.default.useEffect(() => {
|
|
10307
10335
|
if (typedLen === totalLength && totalLength > 0 && !doneCalledRef.current) {
|
|
10308
10336
|
doneCalledRef.current = true;
|
|
10309
10337
|
onDone?.();
|
|
10310
10338
|
}
|
|
10311
10339
|
}, [typedLen, totalLength, onDone]);
|
|
10312
|
-
const parsed =
|
|
10340
|
+
const parsed = import_react26.default.useMemo(
|
|
10313
10341
|
() => doc ? htmlToReactProgressive(doc.body, typedLen, rangeMap) : null,
|
|
10314
10342
|
[doc, typedLen, rangeMap]
|
|
10315
10343
|
);
|
|
@@ -10319,13 +10347,13 @@ HtmlTypeWriter.displayName = "HtmlTypeWriter";
|
|
|
10319
10347
|
var HtmlTypeWriter_default = HtmlTypeWriter;
|
|
10320
10348
|
|
|
10321
10349
|
// src/components/ImageSelector/ImageSelector.tsx
|
|
10322
|
-
var
|
|
10350
|
+
var import_react27 = __toESM(require("react"), 1);
|
|
10323
10351
|
var import_jsx_runtime327 = require("react/jsx-runtime");
|
|
10324
10352
|
var ImageSelector = (props) => {
|
|
10325
10353
|
const { value, placeholder, onChange, validations, label, required } = props;
|
|
10326
|
-
const fieldId =
|
|
10327
|
-
const [previewUrl, setPreviewUrl] =
|
|
10328
|
-
|
|
10354
|
+
const fieldId = import_react27.default.useId();
|
|
10355
|
+
const [previewUrl, setPreviewUrl] = import_react27.default.useState();
|
|
10356
|
+
import_react27.default.useEffect(() => {
|
|
10329
10357
|
if (!value) {
|
|
10330
10358
|
setPreviewUrl(void 0);
|
|
10331
10359
|
return;
|
|
@@ -10334,7 +10362,7 @@ var ImageSelector = (props) => {
|
|
|
10334
10362
|
setPreviewUrl(url);
|
|
10335
10363
|
return () => URL.revokeObjectURL(url);
|
|
10336
10364
|
}, [value]);
|
|
10337
|
-
const inputRef =
|
|
10365
|
+
const inputRef = import_react27.default.useRef(null);
|
|
10338
10366
|
const handleFileChange = (e) => {
|
|
10339
10367
|
const selectedFile = e.target.files?.[0];
|
|
10340
10368
|
if (selectedFile) {
|
|
@@ -10517,22 +10545,23 @@ Pagination.displayName = "Pagination";
|
|
|
10517
10545
|
var Pagination_default = Pagination;
|
|
10518
10546
|
|
|
10519
10547
|
// src/components/PopOver/PopOver.tsx
|
|
10520
|
-
var
|
|
10548
|
+
var import_react28 = __toESM(require("react"), 1);
|
|
10521
10549
|
var import_jsx_runtime332 = require("react/jsx-runtime");
|
|
10522
10550
|
var PopOver = (props) => {
|
|
10523
10551
|
const { children, isOpen, onClose, PopOverEl } = props;
|
|
10524
|
-
const popRef =
|
|
10525
|
-
const triggerRef =
|
|
10526
|
-
const [localOpen, setLocalOpen] =
|
|
10527
|
-
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);
|
|
10528
10556
|
useClickOutside_default([popRef, triggerRef], onClose, isOpen);
|
|
10529
10557
|
useCloseWhenFocusHidden(isOpen, triggerRef, popRef, onClose);
|
|
10530
10558
|
useEscapeKey(isOpen, () => {
|
|
10531
10559
|
onClose();
|
|
10532
10560
|
triggerRef.current?.focus({ preventScroll: true });
|
|
10533
10561
|
});
|
|
10562
|
+
const host = useOverlayHost_default(triggerRef, localOpen);
|
|
10534
10563
|
useAutoPosition_default(triggerRef, popRef, localOpen);
|
|
10535
|
-
|
|
10564
|
+
import_react28.default.useEffect(() => {
|
|
10536
10565
|
if (isOpen) {
|
|
10537
10566
|
setLocalOpen(isOpen);
|
|
10538
10567
|
setTimeout(() => {
|
|
@@ -10555,7 +10584,7 @@ var PopOver = (props) => {
|
|
|
10555
10584
|
},
|
|
10556
10585
|
children: [
|
|
10557
10586
|
children,
|
|
10558
|
-
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)(
|
|
10559
10588
|
"div",
|
|
10560
10589
|
{
|
|
10561
10590
|
className: clsx_default(
|
|
@@ -10613,12 +10642,12 @@ Progress.displayName = "Progress";
|
|
|
10613
10642
|
var Progress_default = Progress;
|
|
10614
10643
|
|
|
10615
10644
|
// src/components/Radio/RadioGroupContext.tsx
|
|
10616
|
-
var
|
|
10617
|
-
var RadioGroupContext =
|
|
10645
|
+
var import_react29 = __toESM(require("react"), 1);
|
|
10646
|
+
var RadioGroupContext = import_react29.default.createContext(
|
|
10618
10647
|
null
|
|
10619
10648
|
);
|
|
10620
10649
|
var useRadioGroupContext = () => {
|
|
10621
|
-
return
|
|
10650
|
+
return import_react29.default.useContext(RadioGroupContext);
|
|
10622
10651
|
};
|
|
10623
10652
|
var RadioGroupContext_default = RadioGroupContext;
|
|
10624
10653
|
|
|
@@ -10694,19 +10723,19 @@ RadioGroup.displayName = "RadioGroup";
|
|
|
10694
10723
|
var RadioGroup_default = RadioGroup;
|
|
10695
10724
|
|
|
10696
10725
|
// src/components/Select/Select.tsx
|
|
10697
|
-
var
|
|
10726
|
+
var import_react32 = __toESM(require("react"), 1);
|
|
10698
10727
|
|
|
10699
10728
|
// src/components/Select/context.ts
|
|
10700
|
-
var
|
|
10701
|
-
var SelectContext =
|
|
10729
|
+
var import_react30 = __toESM(require("react"), 1);
|
|
10730
|
+
var SelectContext = import_react30.default.createContext(null);
|
|
10702
10731
|
var context_default = SelectContext;
|
|
10703
10732
|
|
|
10704
10733
|
// src/components/Select/SelectItem.tsx
|
|
10705
|
-
var
|
|
10734
|
+
var import_react31 = __toESM(require("react"), 1);
|
|
10706
10735
|
var import_jsx_runtime336 = require("react/jsx-runtime");
|
|
10707
10736
|
var SelectItem = (props) => {
|
|
10708
10737
|
const { children, value, onClick, disabled = false } = props;
|
|
10709
|
-
const ctx =
|
|
10738
|
+
const ctx = import_react31.default.useContext(context_default);
|
|
10710
10739
|
const handleClick = (e) => {
|
|
10711
10740
|
e.preventDefault();
|
|
10712
10741
|
e.stopPropagation();
|
|
@@ -10756,29 +10785,29 @@ var SelectRoot = (props) => {
|
|
|
10756
10785
|
required,
|
|
10757
10786
|
size = "md"
|
|
10758
10787
|
} = props;
|
|
10759
|
-
const fieldId =
|
|
10760
|
-
const itemChildren =
|
|
10761
|
-
(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
|
|
10762
10791
|
);
|
|
10763
10792
|
const isControlled = valueProp !== void 0;
|
|
10764
|
-
const [isOpen, setOpen] =
|
|
10765
|
-
const [uncontrolledLabel, setUncontrolledLabel] =
|
|
10766
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
10767
|
-
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(() => {
|
|
10768
10797
|
if (!isControlled) return null;
|
|
10769
10798
|
const match = itemChildren.find((child) => child.props.value === valueProp);
|
|
10770
10799
|
return match ? match.props.children : null;
|
|
10771
10800
|
}, [isControlled, valueProp, itemChildren]);
|
|
10772
10801
|
const selectedLabel = isControlled ? controlledLabel : uncontrolledLabel;
|
|
10773
10802
|
const selectedValue = isControlled ? valueProp : uncontrolledValue;
|
|
10774
|
-
const triggerRef =
|
|
10775
|
-
const contentRef =
|
|
10776
|
-
const [mounted, setMounted] =
|
|
10777
|
-
const [visible, setVisible] =
|
|
10778
|
-
|
|
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(() => {
|
|
10779
10808
|
if (disabled && isOpen) setOpen(false);
|
|
10780
10809
|
}, [disabled, isOpen]);
|
|
10781
|
-
|
|
10810
|
+
import_react32.default.useEffect(() => {
|
|
10782
10811
|
if (isOpen) {
|
|
10783
10812
|
setMounted(true);
|
|
10784
10813
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -10788,33 +10817,34 @@ var SelectRoot = (props) => {
|
|
|
10788
10817
|
const t = setTimeout(() => setMounted(false), ANIMATION_DURATION_MS3);
|
|
10789
10818
|
return () => clearTimeout(t);
|
|
10790
10819
|
}, [isOpen]);
|
|
10791
|
-
const [query, setQuery] =
|
|
10820
|
+
const [query, setQuery] = import_react32.default.useState("");
|
|
10792
10821
|
const textOf = (node) => {
|
|
10793
10822
|
if (node === null || node === void 0 || typeof node === "boolean") return "";
|
|
10794
10823
|
if (typeof node === "string" || typeof node === "number") return String(node);
|
|
10795
10824
|
if (Array.isArray(node)) return node.map(textOf).join("");
|
|
10796
|
-
if (
|
|
10825
|
+
if (import_react32.default.isValidElement(node)) return textOf(node.props.children);
|
|
10797
10826
|
return "";
|
|
10798
10827
|
};
|
|
10799
|
-
const visibleItems =
|
|
10828
|
+
const visibleItems = import_react32.default.useMemo(() => {
|
|
10800
10829
|
if (!searchable || !query.trim()) return itemChildren;
|
|
10801
10830
|
const q = query.trim().toLowerCase();
|
|
10802
10831
|
return itemChildren.filter((c) => textOf(c.props.children).toLowerCase().includes(q));
|
|
10803
10832
|
}, [searchable, query, itemChildren]);
|
|
10804
|
-
const open =
|
|
10805
|
-
const close =
|
|
10833
|
+
const open = import_react32.default.useCallback(() => setOpen(true), []);
|
|
10834
|
+
const close = import_react32.default.useCallback(() => {
|
|
10806
10835
|
setOpen(false);
|
|
10807
10836
|
setQuery("");
|
|
10808
10837
|
}, []);
|
|
10809
|
-
const toggle =
|
|
10838
|
+
const toggle = import_react32.default.useCallback(() => setOpen((prev) => !prev), []);
|
|
10810
10839
|
useClickOutside_default([contentRef, triggerRef], close, isOpen);
|
|
10811
10840
|
useCloseWhenFocusHidden(isOpen, triggerRef, contentRef, close);
|
|
10812
10841
|
useEscapeKey(isOpen, () => {
|
|
10813
10842
|
close();
|
|
10814
10843
|
triggerRef.current?.focus({ preventScroll: true });
|
|
10815
10844
|
});
|
|
10845
|
+
const host = useOverlayHost_default(triggerRef, mounted);
|
|
10816
10846
|
useAutoPosition_default(triggerRef, contentRef, mounted);
|
|
10817
|
-
const setSelected =
|
|
10847
|
+
const setSelected = import_react32.default.useCallback(
|
|
10818
10848
|
(label2, itemValue) => {
|
|
10819
10849
|
if (!isControlled) {
|
|
10820
10850
|
setUncontrolledLabel(label2);
|
|
@@ -10824,7 +10854,7 @@ var SelectRoot = (props) => {
|
|
|
10824
10854
|
},
|
|
10825
10855
|
[isControlled, onChange]
|
|
10826
10856
|
);
|
|
10827
|
-
const ctxValue =
|
|
10857
|
+
const ctxValue = import_react32.default.useMemo(
|
|
10828
10858
|
() => ({
|
|
10829
10859
|
isOpen,
|
|
10830
10860
|
mounted,
|
|
@@ -10903,7 +10933,7 @@ var SelectRoot = (props) => {
|
|
|
10903
10933
|
]
|
|
10904
10934
|
}
|
|
10905
10935
|
),
|
|
10906
|
-
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)(
|
|
10907
10937
|
"div",
|
|
10908
10938
|
{
|
|
10909
10939
|
className: clsx_default("lib-xplat-select-content", size, stateClass),
|
|
@@ -11069,7 +11099,7 @@ Steps.displayName = "Steps";
|
|
|
11069
11099
|
var Steps_default = Steps;
|
|
11070
11100
|
|
|
11071
11101
|
// src/components/Swiper/Swiper.tsx
|
|
11072
|
-
var
|
|
11102
|
+
var import_react33 = __toESM(require("react"), 1);
|
|
11073
11103
|
var import_jsx_runtime342 = require("react/jsx-runtime");
|
|
11074
11104
|
var Swiper = (props) => {
|
|
11075
11105
|
const {
|
|
@@ -11094,26 +11124,26 @@ var Swiper = (props) => {
|
|
|
11094
11124
|
const maxIndex = Math.max(0, totalSlides - viewItemCount);
|
|
11095
11125
|
const useLoop = loop && canSlide;
|
|
11096
11126
|
const cloneCount = useLoop ? totalSlides : 0;
|
|
11097
|
-
const extendedItems =
|
|
11127
|
+
const extendedItems = import_react33.default.useMemo(() => {
|
|
11098
11128
|
if (!useLoop) return items;
|
|
11099
11129
|
return [...items, ...items, ...items];
|
|
11100
11130
|
}, [items, useLoop]);
|
|
11101
11131
|
const initialIdx = Math.max(0, Math.min(indexProp ?? 0, maxIndex));
|
|
11102
|
-
const [innerIndex, setInnerIndex] =
|
|
11132
|
+
const [innerIndex, setInnerIndex] = import_react33.default.useState(
|
|
11103
11133
|
useLoop ? cloneCount + initialIdx : initialIdx
|
|
11104
11134
|
);
|
|
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
|
-
|
|
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(() => {
|
|
11117
11147
|
const el = containerRef.current;
|
|
11118
11148
|
if (!el) return;
|
|
11119
11149
|
const ro = new ResizeObserver((entries) => {
|
|
@@ -11136,7 +11166,7 @@ var Swiper = (props) => {
|
|
|
11136
11166
|
return ((inner - cloneCount) % totalSlides + totalSlides) % totalSlides;
|
|
11137
11167
|
};
|
|
11138
11168
|
const realIndex = getRealIndex(innerIndex);
|
|
11139
|
-
const moveToInner =
|
|
11169
|
+
const moveToInner = import_react33.default.useCallback(
|
|
11140
11170
|
(idx, withAnim = true) => {
|
|
11141
11171
|
if (!useLoop) {
|
|
11142
11172
|
setAnimated(withAnim);
|
|
@@ -11164,7 +11194,7 @@ var Swiper = (props) => {
|
|
|
11164
11194
|
},
|
|
11165
11195
|
[useLoop, cloneCount, totalSlides]
|
|
11166
11196
|
);
|
|
11167
|
-
const handleTransitionEnd =
|
|
11197
|
+
const handleTransitionEnd = import_react33.default.useCallback(() => {
|
|
11168
11198
|
if (!useLoop) return;
|
|
11169
11199
|
const real = getRealIndex(innerIndex);
|
|
11170
11200
|
const canonical = cloneCount + real;
|
|
@@ -11174,7 +11204,7 @@ var Swiper = (props) => {
|
|
|
11174
11204
|
}
|
|
11175
11205
|
onChange?.(Math.min(real, maxIndex));
|
|
11176
11206
|
}, [useLoop, innerIndex, cloneCount, totalSlides, maxIndex, onChange]);
|
|
11177
|
-
const slideTo =
|
|
11207
|
+
const slideTo = import_react33.default.useCallback(
|
|
11178
11208
|
(logicalIndex) => {
|
|
11179
11209
|
if (!canSlide) return;
|
|
11180
11210
|
const clamped = useLoop ? logicalIndex : Math.max(0, Math.min(logicalIndex, maxIndex));
|
|
@@ -11184,7 +11214,7 @@ var Swiper = (props) => {
|
|
|
11184
11214
|
},
|
|
11185
11215
|
[canSlide, useLoop, cloneCount, maxIndex, onChange, moveToInner]
|
|
11186
11216
|
);
|
|
11187
|
-
const slideNext =
|
|
11217
|
+
const slideNext = import_react33.default.useCallback(() => {
|
|
11188
11218
|
if (!canSlide) return;
|
|
11189
11219
|
const nextInner = innerIndex + slideBy;
|
|
11190
11220
|
if (useLoop) {
|
|
@@ -11193,7 +11223,7 @@ var Swiper = (props) => {
|
|
|
11193
11223
|
moveToInner(Math.min(nextInner, maxIndex), true);
|
|
11194
11224
|
}
|
|
11195
11225
|
}, [canSlide, useLoop, innerIndex, slideBy, maxIndex, moveToInner]);
|
|
11196
|
-
const slidePrev =
|
|
11226
|
+
const slidePrev = import_react33.default.useCallback(() => {
|
|
11197
11227
|
if (!canSlide) return;
|
|
11198
11228
|
const prevInner = innerIndex - slideBy;
|
|
11199
11229
|
if (useLoop) {
|
|
@@ -11202,7 +11232,7 @@ var Swiper = (props) => {
|
|
|
11202
11232
|
moveToInner(Math.max(prevInner, 0), true);
|
|
11203
11233
|
}
|
|
11204
11234
|
}, [canSlide, useLoop, innerIndex, slideBy, moveToInner]);
|
|
11205
|
-
|
|
11235
|
+
import_react33.default.useEffect(() => {
|
|
11206
11236
|
if (indexProp === void 0) return;
|
|
11207
11237
|
const clamped = Math.max(0, Math.min(indexProp, maxIndex));
|
|
11208
11238
|
const target = useLoop ? cloneCount + clamped : clamped;
|
|
@@ -11210,12 +11240,12 @@ var Swiper = (props) => {
|
|
|
11210
11240
|
moveToInner(target, true);
|
|
11211
11241
|
}
|
|
11212
11242
|
}, [indexProp]);
|
|
11213
|
-
|
|
11243
|
+
import_react33.default.useImperativeHandle(swiperRef, () => ({
|
|
11214
11244
|
slidePrev,
|
|
11215
11245
|
slideNext,
|
|
11216
11246
|
slideTo
|
|
11217
11247
|
}));
|
|
11218
|
-
|
|
11248
|
+
import_react33.default.useEffect(() => {
|
|
11219
11249
|
if (!auto || !canSlide || paused) return;
|
|
11220
11250
|
autoplayTimerRef.current = setInterval(slideNext, autoplayDelay);
|
|
11221
11251
|
return () => {
|
|
@@ -11241,7 +11271,7 @@ var Swiper = (props) => {
|
|
|
11241
11271
|
resumeTimeoutRef.current = null;
|
|
11242
11272
|
}, pauseOnInteraction);
|
|
11243
11273
|
};
|
|
11244
|
-
|
|
11274
|
+
import_react33.default.useEffect(() => {
|
|
11245
11275
|
return () => {
|
|
11246
11276
|
if (resumeTimeoutRef.current) clearTimeout(resumeTimeoutRef.current);
|
|
11247
11277
|
};
|
|
@@ -11259,7 +11289,7 @@ var Swiper = (props) => {
|
|
|
11259
11289
|
startXRef.current = getClientX(e);
|
|
11260
11290
|
startTimeRef.current = Date.now();
|
|
11261
11291
|
};
|
|
11262
|
-
|
|
11292
|
+
import_react33.default.useEffect(() => {
|
|
11263
11293
|
if (!isDragging) return;
|
|
11264
11294
|
const handleMove = (e) => {
|
|
11265
11295
|
setDragOffset(getClientX(e) - startXRef.current);
|
|
@@ -11298,7 +11328,7 @@ var Swiper = (props) => {
|
|
|
11298
11328
|
}, [isDragging, dragOffset, innerIndex, useLoop, maxIndex, slideStep, moveToInner]);
|
|
11299
11329
|
const slideWidthPercent = 100 / viewItemCount;
|
|
11300
11330
|
const gapAdjust = spaceBetween * (viewItemCount - 1) / viewItemCount;
|
|
11301
|
-
const slideElements =
|
|
11331
|
+
const slideElements = import_react33.default.useMemo(
|
|
11302
11332
|
() => extendedItems.map((item, idx) => /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(
|
|
11303
11333
|
"div",
|
|
11304
11334
|
{
|
|
@@ -11372,7 +11402,7 @@ Swiper.displayName = "Swiper";
|
|
|
11372
11402
|
var Swiper_default = Swiper;
|
|
11373
11403
|
|
|
11374
11404
|
// src/components/Switch/Switch.tsx
|
|
11375
|
-
var
|
|
11405
|
+
var import_react34 = __toESM(require("react"), 1);
|
|
11376
11406
|
var import_jsx_runtime343 = require("react/jsx-runtime");
|
|
11377
11407
|
var KNOB_TRANSITION_MS = 250;
|
|
11378
11408
|
var Switch = (props) => {
|
|
@@ -11386,11 +11416,11 @@ var Switch = (props) => {
|
|
|
11386
11416
|
label,
|
|
11387
11417
|
required
|
|
11388
11418
|
} = props;
|
|
11389
|
-
const fieldId =
|
|
11419
|
+
const fieldId = import_react34.default.useId();
|
|
11390
11420
|
const statusType = normalizeStatus(type);
|
|
11391
|
-
const [isAnimating, setIsAnimating] =
|
|
11392
|
-
const timeoutRef =
|
|
11393
|
-
|
|
11421
|
+
const [isAnimating, setIsAnimating] = import_react34.default.useState(false);
|
|
11422
|
+
const timeoutRef = import_react34.default.useRef(null);
|
|
11423
|
+
import_react34.default.useEffect(() => {
|
|
11394
11424
|
return () => {
|
|
11395
11425
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
11396
11426
|
};
|
|
@@ -11429,10 +11459,10 @@ Switch.displayName = "Switch";
|
|
|
11429
11459
|
var Switch_default = Switch;
|
|
11430
11460
|
|
|
11431
11461
|
// src/components/Table/TableContext.tsx
|
|
11432
|
-
var
|
|
11433
|
-
var TableContext =
|
|
11462
|
+
var import_react35 = __toESM(require("react"), 1);
|
|
11463
|
+
var TableContext = import_react35.default.createContext(null);
|
|
11434
11464
|
var useTableContext = () => {
|
|
11435
|
-
const ctx =
|
|
11465
|
+
const ctx = import_react35.default.useContext(TableContext);
|
|
11436
11466
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
11437
11467
|
return ctx;
|
|
11438
11468
|
};
|
|
@@ -11475,24 +11505,24 @@ TableBody.displayName = "TableBody";
|
|
|
11475
11505
|
var TableBody_default = TableBody;
|
|
11476
11506
|
|
|
11477
11507
|
// src/components/Table/TableCell.tsx
|
|
11478
|
-
var
|
|
11508
|
+
var import_react38 = __toESM(require("react"), 1);
|
|
11479
11509
|
|
|
11480
11510
|
// src/components/Table/TableHeadContext.tsx
|
|
11481
|
-
var
|
|
11482
|
-
var TableHeadContext =
|
|
11511
|
+
var import_react36 = __toESM(require("react"), 1);
|
|
11512
|
+
var TableHeadContext = import_react36.default.createContext(
|
|
11483
11513
|
null
|
|
11484
11514
|
);
|
|
11485
11515
|
var useTableHeadContext = () => {
|
|
11486
|
-
const ctx =
|
|
11516
|
+
const ctx = import_react36.default.useContext(TableHeadContext);
|
|
11487
11517
|
return ctx;
|
|
11488
11518
|
};
|
|
11489
11519
|
var TableHeadContext_default = TableHeadContext;
|
|
11490
11520
|
|
|
11491
11521
|
// src/components/Table/TableRowContext.tsx
|
|
11492
|
-
var
|
|
11493
|
-
var TableRowContext =
|
|
11522
|
+
var import_react37 = __toESM(require("react"), 1);
|
|
11523
|
+
var TableRowContext = import_react37.default.createContext(null);
|
|
11494
11524
|
var useTableRowContext = () => {
|
|
11495
|
-
const ctx =
|
|
11525
|
+
const ctx = import_react37.default.useContext(TableRowContext);
|
|
11496
11526
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
11497
11527
|
return ctx;
|
|
11498
11528
|
};
|
|
@@ -11500,7 +11530,7 @@ var TableRowContext_default = TableRowContext;
|
|
|
11500
11530
|
|
|
11501
11531
|
// src/components/Table/TableCell.tsx
|
|
11502
11532
|
var import_jsx_runtime346 = require("react/jsx-runtime");
|
|
11503
|
-
var TableCell =
|
|
11533
|
+
var TableCell = import_react38.default.memo((props) => {
|
|
11504
11534
|
const {
|
|
11505
11535
|
children,
|
|
11506
11536
|
align = "center",
|
|
@@ -11514,9 +11544,9 @@ var TableCell = import_react37.default.memo((props) => {
|
|
|
11514
11544
|
const { registerStickyCell, stickyCells } = useTableRowContext();
|
|
11515
11545
|
const { stickyShadow } = useTableContext();
|
|
11516
11546
|
const headContext = useTableHeadContext();
|
|
11517
|
-
const [left, setLeft] =
|
|
11518
|
-
const cellRef =
|
|
11519
|
-
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(() => {
|
|
11520
11550
|
if (!cellRef.current) return 0;
|
|
11521
11551
|
let totalLeft = 0;
|
|
11522
11552
|
for (const ref of stickyCells) {
|
|
@@ -11525,7 +11555,7 @@ var TableCell = import_react37.default.memo((props) => {
|
|
|
11525
11555
|
}
|
|
11526
11556
|
return totalLeft;
|
|
11527
11557
|
}, [stickyCells]);
|
|
11528
|
-
|
|
11558
|
+
import_react38.default.useEffect(() => {
|
|
11529
11559
|
if (!isSticky || !cellRef.current) return;
|
|
11530
11560
|
registerStickyCell(cellRef);
|
|
11531
11561
|
setLeft(calculateLeft());
|
|
@@ -11583,9 +11613,9 @@ TableHead.displayName = "TableHead";
|
|
|
11583
11613
|
var TableHead_default = TableHead;
|
|
11584
11614
|
|
|
11585
11615
|
// src/components/Table/TableRow.tsx
|
|
11586
|
-
var
|
|
11616
|
+
var import_react39 = __toESM(require("react"), 1);
|
|
11587
11617
|
var import_jsx_runtime348 = require("react/jsx-runtime");
|
|
11588
|
-
var TableRow =
|
|
11618
|
+
var TableRow = import_react39.default.memo((props) => {
|
|
11589
11619
|
const {
|
|
11590
11620
|
children,
|
|
11591
11621
|
type = "secondary",
|
|
@@ -11594,7 +11624,7 @@ var TableRow = import_react38.default.memo((props) => {
|
|
|
11594
11624
|
onClick
|
|
11595
11625
|
} = props;
|
|
11596
11626
|
const { rowBorderUse } = useTableContext();
|
|
11597
|
-
const [stickyCells, setStickyCells] =
|
|
11627
|
+
const [stickyCells, setStickyCells] = import_react39.default.useState([]);
|
|
11598
11628
|
const registerStickyCell = (ref) => {
|
|
11599
11629
|
setStickyCells((prev) => {
|
|
11600
11630
|
if (prev.includes(ref)) return prev;
|
|
@@ -11658,9 +11688,9 @@ Tag.displayName = "Tag";
|
|
|
11658
11688
|
var Tag_default = Tag;
|
|
11659
11689
|
|
|
11660
11690
|
// src/components/TextArea/TextArea.tsx
|
|
11661
|
-
var
|
|
11691
|
+
var import_react40 = __toESM(require("react"), 1);
|
|
11662
11692
|
var import_jsx_runtime350 = require("react/jsx-runtime");
|
|
11663
|
-
var TextArea =
|
|
11693
|
+
var TextArea = import_react40.default.forwardRef(
|
|
11664
11694
|
(props, ref) => {
|
|
11665
11695
|
const {
|
|
11666
11696
|
className,
|
|
@@ -11673,7 +11703,7 @@ var TextArea = import_react39.default.forwardRef(
|
|
|
11673
11703
|
disabled,
|
|
11674
11704
|
...textareaProps
|
|
11675
11705
|
} = props;
|
|
11676
|
-
const autoId =
|
|
11706
|
+
const autoId = import_react40.default.useId();
|
|
11677
11707
|
const fieldId = props.id ?? autoId;
|
|
11678
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)(
|
|
11679
11709
|
"textarea",
|
|
@@ -11695,7 +11725,7 @@ TextArea.displayName = "TextArea";
|
|
|
11695
11725
|
var TextArea_default = TextArea;
|
|
11696
11726
|
|
|
11697
11727
|
// src/components/TimePicker/TimePicker.tsx
|
|
11698
|
-
var
|
|
11728
|
+
var import_react41 = __toESM(require("react"), 1);
|
|
11699
11729
|
var import_jsx_runtime351 = require("react/jsx-runtime");
|
|
11700
11730
|
var ANIMATION_DURATION_MS4 = 200;
|
|
11701
11731
|
var toMinutes = (hhmm) => {
|
|
@@ -11733,13 +11763,13 @@ var TimePicker = (props) => {
|
|
|
11733
11763
|
required,
|
|
11734
11764
|
validations
|
|
11735
11765
|
} = 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 =
|
|
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(() => {
|
|
11743
11773
|
const safeStep = step > 0 && step <= 720 ? step : 30;
|
|
11744
11774
|
const lo = toMinutes(min) ?? 0;
|
|
11745
11775
|
const hi = toMinutes(max) ?? 24 * 60 - 1;
|
|
@@ -11747,18 +11777,19 @@ var TimePicker = (props) => {
|
|
|
11747
11777
|
for (let t = lo; t <= hi; t += safeStep) out.push(toHHmm(t));
|
|
11748
11778
|
return out;
|
|
11749
11779
|
}, [step, min, max]);
|
|
11750
|
-
const close =
|
|
11780
|
+
const close = import_react41.default.useCallback(() => setOpen(false), []);
|
|
11751
11781
|
useClickOutside_default([triggerRef, contentRef], close, isOpen);
|
|
11752
11782
|
useCloseWhenFocusHidden(isOpen, triggerRef, contentRef, close);
|
|
11753
11783
|
useEscapeKey(isOpen, () => {
|
|
11754
11784
|
close();
|
|
11755
11785
|
triggerRef.current?.focus({ preventScroll: true });
|
|
11756
11786
|
});
|
|
11787
|
+
const host = useOverlayHost_default(triggerRef, mounted);
|
|
11757
11788
|
useAutoPosition_default(triggerRef, contentRef, mounted);
|
|
11758
|
-
|
|
11789
|
+
import_react41.default.useEffect(() => {
|
|
11759
11790
|
if (disabled && isOpen) setOpen(false);
|
|
11760
11791
|
}, [disabled, isOpen]);
|
|
11761
|
-
|
|
11792
|
+
import_react41.default.useEffect(() => {
|
|
11762
11793
|
if (isOpen) {
|
|
11763
11794
|
setMounted(true);
|
|
11764
11795
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -11796,7 +11827,7 @@ var TimePicker = (props) => {
|
|
|
11796
11827
|
children: /* @__PURE__ */ (0, import_jsx_runtime351.jsx)("span", { className: clsx_default("time-picker-value", !value && "placeholder"), children: value ? display(value, use12Hours) : placeholder })
|
|
11797
11828
|
}
|
|
11798
11829
|
),
|
|
11799
|
-
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)(
|
|
11800
11831
|
"div",
|
|
11801
11832
|
{
|
|
11802
11833
|
ref: contentRef,
|
|
@@ -11830,20 +11861,20 @@ TimePicker.displayName = "TimePicker";
|
|
|
11830
11861
|
var TimePicker_default = TimePicker;
|
|
11831
11862
|
|
|
11832
11863
|
// src/components/Toast/Toast.tsx
|
|
11833
|
-
var
|
|
11864
|
+
var import_react42 = __toESM(require("react"), 1);
|
|
11834
11865
|
var import_react_dom4 = require("react-dom");
|
|
11835
11866
|
var import_jsx_runtime352 = require("react/jsx-runtime");
|
|
11836
|
-
var ToastContext =
|
|
11867
|
+
var ToastContext = import_react42.default.createContext(null);
|
|
11837
11868
|
var useToast = () => {
|
|
11838
|
-
const ctx =
|
|
11869
|
+
const ctx = import_react42.default.useContext(ToastContext);
|
|
11839
11870
|
if (!ctx) throw new Error("useToast must be used within ToastProvider");
|
|
11840
11871
|
return ctx;
|
|
11841
11872
|
};
|
|
11842
11873
|
var EXIT_DURATION = 300;
|
|
11843
11874
|
var ToastItemComponent = ({ item, isExiting, onClose }) => {
|
|
11844
|
-
const ref =
|
|
11845
|
-
const [height, setHeight] =
|
|
11846
|
-
|
|
11875
|
+
const ref = import_react42.default.useRef(null);
|
|
11876
|
+
const [height, setHeight] = import_react42.default.useState(void 0);
|
|
11877
|
+
import_react42.default.useEffect(() => {
|
|
11847
11878
|
if (ref.current && !isExiting) {
|
|
11848
11879
|
setHeight(ref.current.offsetHeight);
|
|
11849
11880
|
}
|
|
@@ -11875,13 +11906,13 @@ var ToastProvider = ({
|
|
|
11875
11906
|
children,
|
|
11876
11907
|
position = "top-right"
|
|
11877
11908
|
}) => {
|
|
11878
|
-
const [toasts, setToasts] =
|
|
11879
|
-
const [removing, setRemoving] =
|
|
11880
|
-
const [mounted, setMounted] =
|
|
11881
|
-
|
|
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(() => {
|
|
11882
11913
|
setMounted(true);
|
|
11883
11914
|
}, []);
|
|
11884
|
-
const remove =
|
|
11915
|
+
const remove = import_react42.default.useCallback((id) => {
|
|
11885
11916
|
setRemoving((prev) => new Set(prev).add(id));
|
|
11886
11917
|
setTimeout(() => {
|
|
11887
11918
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
@@ -11892,7 +11923,7 @@ var ToastProvider = ({
|
|
|
11892
11923
|
});
|
|
11893
11924
|
}, EXIT_DURATION);
|
|
11894
11925
|
}, []);
|
|
11895
|
-
const toast =
|
|
11926
|
+
const toast = import_react42.default.useCallback(
|
|
11896
11927
|
(type, message, duration = 3e3) => {
|
|
11897
11928
|
const id = `${Date.now()}-${Math.random()}`;
|
|
11898
11929
|
setToasts((prev) => [...prev, { id, type, message }]);
|
|
@@ -11945,7 +11976,7 @@ ToggleChip.displayName = "ToggleChip";
|
|
|
11945
11976
|
var ToggleChip_default = ToggleChip;
|
|
11946
11977
|
|
|
11947
11978
|
// src/components/Tooltip/Tooltip.tsx
|
|
11948
|
-
var
|
|
11979
|
+
var import_react43 = __toESM(require("react"), 1);
|
|
11949
11980
|
var import_jsx_runtime354 = require("react/jsx-runtime");
|
|
11950
11981
|
var OFFSET = 12;
|
|
11951
11982
|
var GAP = 8;
|
|
@@ -11961,14 +11992,14 @@ var Tooltip = (props) => {
|
|
|
11961
11992
|
disabled = false
|
|
11962
11993
|
} = props;
|
|
11963
11994
|
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 =
|
|
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) => {
|
|
11972
12003
|
const vw = window.innerWidth;
|
|
11973
12004
|
const vh = window.innerHeight;
|
|
11974
12005
|
return {
|
|
@@ -11976,7 +12007,7 @@ var Tooltip = (props) => {
|
|
|
11976
12007
|
top: Math.min(Math.max(GAP, top), Math.max(GAP, vh - h - GAP))
|
|
11977
12008
|
};
|
|
11978
12009
|
}, []);
|
|
11979
|
-
const placeAtCursor =
|
|
12010
|
+
const placeAtCursor = import_react43.default.useCallback((x, y) => {
|
|
11980
12011
|
const el = tooltipRef.current;
|
|
11981
12012
|
if (!el) return;
|
|
11982
12013
|
const w = el.offsetWidth;
|
|
@@ -11987,7 +12018,7 @@ var Tooltip = (props) => {
|
|
|
11987
12018
|
if (top < GAP) top = y + OFFSET;
|
|
11988
12019
|
setPos(clamp(left, top, w, h));
|
|
11989
12020
|
}, [clamp]);
|
|
11990
|
-
const placeAtTrigger =
|
|
12021
|
+
const placeAtTrigger = import_react43.default.useCallback(() => {
|
|
11991
12022
|
const el = tooltipRef.current;
|
|
11992
12023
|
const trigger = triggerRef.current;
|
|
11993
12024
|
if (!el || !trigger) return;
|
|
@@ -11999,19 +12030,19 @@ var Tooltip = (props) => {
|
|
|
11999
12030
|
const left = rect.left + rect.width / 2 - w / 2;
|
|
12000
12031
|
setPos(clamp(left, top, w, h));
|
|
12001
12032
|
}, [clamp]);
|
|
12002
|
-
const reposition =
|
|
12033
|
+
const reposition = import_react43.default.useCallback(() => {
|
|
12003
12034
|
if (follow && cursor.current) {
|
|
12004
12035
|
placeAtCursor(cursor.current.x, cursor.current.y);
|
|
12005
12036
|
} else {
|
|
12006
12037
|
placeAtTrigger();
|
|
12007
12038
|
}
|
|
12008
12039
|
}, [follow, placeAtCursor, placeAtTrigger]);
|
|
12009
|
-
const handleMouseEnter =
|
|
12040
|
+
const handleMouseEnter = import_react43.default.useCallback((e) => {
|
|
12010
12041
|
if (disabled) return;
|
|
12011
12042
|
cursor.current = { x: e.clientX, y: e.clientY };
|
|
12012
12043
|
delayTimer.current = window.setTimeout(() => setVisible(true), SHOW_DELAY);
|
|
12013
12044
|
}, [disabled]);
|
|
12014
|
-
const handleMouseMove =
|
|
12045
|
+
const handleMouseMove = import_react43.default.useCallback((e) => {
|
|
12015
12046
|
cursor.current = { x: e.clientX, y: e.clientY };
|
|
12016
12047
|
if (!visible || !follow) return;
|
|
12017
12048
|
cancelAnimationFrame(rafRef.current);
|
|
@@ -12019,25 +12050,25 @@ var Tooltip = (props) => {
|
|
|
12019
12050
|
if (cursor.current) placeAtCursor(cursor.current.x, cursor.current.y);
|
|
12020
12051
|
});
|
|
12021
12052
|
}, [visible, follow, placeAtCursor]);
|
|
12022
|
-
const close =
|
|
12053
|
+
const close = import_react43.default.useCallback(() => {
|
|
12023
12054
|
window.clearTimeout(delayTimer.current);
|
|
12024
12055
|
cancelAnimationFrame(rafRef.current);
|
|
12025
12056
|
setVisible(false);
|
|
12026
12057
|
}, []);
|
|
12027
|
-
const handleMouseLeave =
|
|
12058
|
+
const handleMouseLeave = import_react43.default.useCallback(() => {
|
|
12028
12059
|
cursor.current = null;
|
|
12029
12060
|
close();
|
|
12030
12061
|
}, [close]);
|
|
12031
|
-
const handleFocus =
|
|
12062
|
+
const handleFocus = import_react43.default.useCallback(() => {
|
|
12032
12063
|
if (disabled) return;
|
|
12033
12064
|
cursor.current = null;
|
|
12034
12065
|
setVisible(true);
|
|
12035
12066
|
}, [disabled]);
|
|
12036
|
-
|
|
12067
|
+
import_react43.default.useLayoutEffect(() => {
|
|
12037
12068
|
if (!visible) return;
|
|
12038
12069
|
reposition();
|
|
12039
12070
|
}, [visible, reposition]);
|
|
12040
|
-
|
|
12071
|
+
import_react43.default.useEffect(() => {
|
|
12041
12072
|
if (!visible || follow) return;
|
|
12042
12073
|
const onChange = () => placeAtTrigger();
|
|
12043
12074
|
window.addEventListener("scroll", onChange, true);
|
|
@@ -12047,7 +12078,7 @@ var Tooltip = (props) => {
|
|
|
12047
12078
|
window.removeEventListener("resize", onChange);
|
|
12048
12079
|
};
|
|
12049
12080
|
}, [visible, follow, placeAtTrigger]);
|
|
12050
|
-
|
|
12081
|
+
import_react43.default.useEffect(() => () => {
|
|
12051
12082
|
window.clearTimeout(delayTimer.current);
|
|
12052
12083
|
cancelAnimationFrame(rafRef.current);
|
|
12053
12084
|
}, []);
|
|
@@ -12086,7 +12117,7 @@ Tooltip.displayName = "Tooltip";
|
|
|
12086
12117
|
var Tooltip_default = Tooltip;
|
|
12087
12118
|
|
|
12088
12119
|
// src/components/Video/Video.tsx
|
|
12089
|
-
var
|
|
12120
|
+
var import_react44 = __toESM(require("react"), 1);
|
|
12090
12121
|
var import_jsx_runtime355 = require("react/jsx-runtime");
|
|
12091
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: [
|
|
12092
12123
|
/* @__PURE__ */ (0, import_jsx_runtime355.jsx)("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
|
|
@@ -12098,7 +12129,7 @@ var formatTime = (sec) => {
|
|
|
12098
12129
|
const s = Math.floor(sec % 60);
|
|
12099
12130
|
return `${m}:${s.toString().padStart(2, "0")}`;
|
|
12100
12131
|
};
|
|
12101
|
-
var Video =
|
|
12132
|
+
var Video = import_react44.default.forwardRef((props, ref) => {
|
|
12102
12133
|
const {
|
|
12103
12134
|
src,
|
|
12104
12135
|
poster,
|
|
@@ -12122,21 +12153,21 @@ var Video = import_react43.default.forwardRef((props, ref) => {
|
|
|
12122
12153
|
children,
|
|
12123
12154
|
...rest
|
|
12124
12155
|
} = 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 =
|
|
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(
|
|
12140
12171
|
(el) => {
|
|
12141
12172
|
videoRef.current = el;
|
|
12142
12173
|
if (typeof ref === "function") ref(el);
|
|
@@ -12144,14 +12175,14 @@ var Video = import_react43.default.forwardRef((props, ref) => {
|
|
|
12144
12175
|
},
|
|
12145
12176
|
[ref]
|
|
12146
12177
|
);
|
|
12147
|
-
|
|
12178
|
+
import_react44.default.useEffect(() => {
|
|
12148
12179
|
const onFsChange = () => {
|
|
12149
12180
|
setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
12150
12181
|
};
|
|
12151
12182
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
12152
12183
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
12153
12184
|
}, []);
|
|
12154
|
-
|
|
12185
|
+
import_react44.default.useEffect(() => {
|
|
12155
12186
|
const v = videoRef.current;
|
|
12156
12187
|
if (!v) return;
|
|
12157
12188
|
const onEnter = () => setIsPip(true);
|
|
@@ -12540,13 +12571,13 @@ Layout.displayName = "Layout";
|
|
|
12540
12571
|
var Layout_default = Layout;
|
|
12541
12572
|
|
|
12542
12573
|
// src/layout/SideBar/SideBar.tsx
|
|
12543
|
-
var
|
|
12574
|
+
var import_react46 = __toESM(require("react"), 1);
|
|
12544
12575
|
|
|
12545
12576
|
// src/layout/SideBar/SideBarContext.tsx
|
|
12546
|
-
var
|
|
12547
|
-
var SideBarContext =
|
|
12577
|
+
var import_react45 = __toESM(require("react"), 1);
|
|
12578
|
+
var SideBarContext = import_react45.default.createContext(null);
|
|
12548
12579
|
var useSideBarContext = () => {
|
|
12549
|
-
const ctx =
|
|
12580
|
+
const ctx = import_react45.default.useContext(SideBarContext);
|
|
12550
12581
|
if (!ctx) throw new Error("Error");
|
|
12551
12582
|
return ctx;
|
|
12552
12583
|
};
|
|
@@ -12556,7 +12587,7 @@ var SideBarContext_default = SideBarContext;
|
|
|
12556
12587
|
var import_jsx_runtime361 = require("react/jsx-runtime");
|
|
12557
12588
|
var SideBar = (props) => {
|
|
12558
12589
|
const { children, className } = props;
|
|
12559
|
-
const [isOpen, setIsOpen] =
|
|
12590
|
+
const [isOpen, setIsOpen] = import_react46.default.useState(true);
|
|
12560
12591
|
const handleSwitchSideBar = () => {
|
|
12561
12592
|
setIsOpen((prev) => !prev);
|
|
12562
12593
|
};
|