@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
|
@@ -3290,10 +3290,16 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3290
3290
|
const scrollParentRef = import_react10.default.useRef(null);
|
|
3291
3291
|
const placedRef = import_react10.default.useRef(false);
|
|
3292
3292
|
const frozenMaxRef = import_react10.default.useRef(void 0);
|
|
3293
|
+
const cssCapRef = import_react10.default.useRef(void 0);
|
|
3293
3294
|
const calculatePosition = import_react10.default.useCallback((remeasure = false) => {
|
|
3294
3295
|
const pop = popRef.current;
|
|
3295
3296
|
if (!triggerRef.current || !pop) return;
|
|
3296
3297
|
if (remeasure) frozenMaxRef.current = void 0;
|
|
3298
|
+
if (cssCapRef.current === void 0) {
|
|
3299
|
+
pop.style.maxHeight = "";
|
|
3300
|
+
const raw = getComputedStyle(pop).maxHeight;
|
|
3301
|
+
cssCapRef.current = raw === "none" ? null : Number.parseFloat(raw) || null;
|
|
3302
|
+
}
|
|
3297
3303
|
if (remeasure || !sizeRef.current) {
|
|
3298
3304
|
sizeRef.current = {
|
|
3299
3305
|
w: pop.offsetWidth,
|
|
@@ -3315,8 +3321,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3315
3321
|
};
|
|
3316
3322
|
const first = !placedRef.current;
|
|
3317
3323
|
if (first) pop.style.transition = "none";
|
|
3324
|
+
const cap = cssCapRef.current;
|
|
3325
|
+
const desiredH = cap == null ? popH : Math.min(popH, cap);
|
|
3318
3326
|
const frozen = frozenMaxRef.current;
|
|
3319
|
-
const effectiveH = frozen == null ?
|
|
3327
|
+
const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
|
|
3320
3328
|
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
3321
3329
|
triggerRect,
|
|
3322
3330
|
popW,
|
|
@@ -3325,8 +3333,9 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3325
3333
|
);
|
|
3326
3334
|
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
3327
3335
|
const maxHeight = frozenMaxRef.current;
|
|
3328
|
-
|
|
3329
|
-
pop.style.
|
|
3336
|
+
const hostRect = (pop.offsetParent ?? pop.parentElement)?.getBoundingClientRect();
|
|
3337
|
+
pop.style.top = `${top - (hostRect?.top ?? 0)}px`;
|
|
3338
|
+
pop.style.left = `${left - (hostRect?.left ?? 0)}px`;
|
|
3330
3339
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
3331
3340
|
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";
|
|
3332
3341
|
directionRef.current = next;
|
|
@@ -3344,6 +3353,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3344
3353
|
scrollParentRef.current = null;
|
|
3345
3354
|
placedRef.current = false;
|
|
3346
3355
|
frozenMaxRef.current = void 0;
|
|
3356
|
+
cssCapRef.current = void 0;
|
|
3347
3357
|
return;
|
|
3348
3358
|
}
|
|
3349
3359
|
if (triggerRef.current) {
|
|
@@ -4127,13 +4137,13 @@ Drawer.displayName = "Drawer";
|
|
|
4127
4137
|
var Drawer_default = Drawer;
|
|
4128
4138
|
|
|
4129
4139
|
// src/components/Dropdown/Dropdown.tsx
|
|
4130
|
-
var
|
|
4140
|
+
var import_react22 = __toESM(require("react"), 1);
|
|
4131
4141
|
|
|
4132
4142
|
// src/tokens/hooks/Portal.tsx
|
|
4133
4143
|
var import_react_dom3 = __toESM(require("react-dom"), 1);
|
|
4134
|
-
var Portal = ({ children }) => {
|
|
4144
|
+
var Portal = ({ children, container }) => {
|
|
4135
4145
|
if (typeof document === "undefined") return null;
|
|
4136
|
-
return import_react_dom3.default.createPortal(children, document.body);
|
|
4146
|
+
return import_react_dom3.default.createPortal(children, container ?? document.body);
|
|
4137
4147
|
};
|
|
4138
4148
|
Portal.displayName = "Portal";
|
|
4139
4149
|
var Portal_default = Portal;
|
|
@@ -4163,15 +4173,42 @@ var useClickOutside = (refs, handler, enabled = true) => {
|
|
|
4163
4173
|
};
|
|
4164
4174
|
var useClickOutside_default = useClickOutside;
|
|
4165
4175
|
|
|
4176
|
+
// src/tokens/hooks/useOverlayHost.ts
|
|
4177
|
+
var import_react21 = __toESM(require("react"), 1);
|
|
4178
|
+
var useOverlayHost = (triggerRef, enabled) => {
|
|
4179
|
+
const [host, setHost] = import_react21.default.useState(null);
|
|
4180
|
+
import_react21.default.useLayoutEffect(() => {
|
|
4181
|
+
if (!enabled || !triggerRef.current) {
|
|
4182
|
+
setHost(null);
|
|
4183
|
+
return;
|
|
4184
|
+
}
|
|
4185
|
+
const el = document.createElement("div");
|
|
4186
|
+
el.dataset.xplatOverlayHost = "";
|
|
4187
|
+
el.style.position = "relative";
|
|
4188
|
+
el.style.width = "0";
|
|
4189
|
+
el.style.height = "0";
|
|
4190
|
+
const parent = findScrollParent(triggerRef.current) ?? document.body;
|
|
4191
|
+
parent.appendChild(el);
|
|
4192
|
+
setHost(el);
|
|
4193
|
+
return () => {
|
|
4194
|
+
el.remove();
|
|
4195
|
+
setHost(null);
|
|
4196
|
+
};
|
|
4197
|
+
}, [enabled, triggerRef]);
|
|
4198
|
+
return host;
|
|
4199
|
+
};
|
|
4200
|
+
var useOverlayHost_default = useOverlayHost;
|
|
4201
|
+
|
|
4166
4202
|
// src/components/Dropdown/Dropdown.tsx
|
|
4167
4203
|
var import_jsx_runtime322 = require("react/jsx-runtime");
|
|
4168
4204
|
var Dropdown = (props) => {
|
|
4169
4205
|
const { items, children } = props;
|
|
4170
|
-
const [isOpen, setIsOpen] =
|
|
4171
|
-
const [mounted, setMounted] =
|
|
4172
|
-
const [visible, setVisible] =
|
|
4173
|
-
const triggerRef =
|
|
4174
|
-
const menuRef =
|
|
4206
|
+
const [isOpen, setIsOpen] = import_react22.default.useState(false);
|
|
4207
|
+
const [mounted, setMounted] = import_react22.default.useState(false);
|
|
4208
|
+
const [visible, setVisible] = import_react22.default.useState(false);
|
|
4209
|
+
const triggerRef = import_react22.default.useRef(null);
|
|
4210
|
+
const menuRef = import_react22.default.useRef(null);
|
|
4211
|
+
const host = useOverlayHost_default(triggerRef, mounted);
|
|
4175
4212
|
useAutoPosition_default(triggerRef, menuRef, mounted);
|
|
4176
4213
|
useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false), isOpen);
|
|
4177
4214
|
useCloseWhenFocusHidden(isOpen, triggerRef, menuRef, () => setIsOpen(false));
|
|
@@ -4179,7 +4216,7 @@ var Dropdown = (props) => {
|
|
|
4179
4216
|
setIsOpen(false);
|
|
4180
4217
|
triggerRef.current?.focus({ preventScroll: true });
|
|
4181
4218
|
});
|
|
4182
|
-
|
|
4219
|
+
import_react22.default.useEffect(() => {
|
|
4183
4220
|
if (isOpen) {
|
|
4184
4221
|
setMounted(true);
|
|
4185
4222
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -4204,7 +4241,7 @@ var Dropdown = (props) => {
|
|
|
4204
4241
|
children
|
|
4205
4242
|
}
|
|
4206
4243
|
),
|
|
4207
|
-
mounted && /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
|
|
4244
|
+
mounted && /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(Portal_default, { container: host, children: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
|
|
4208
4245
|
"div",
|
|
4209
4246
|
{
|
|
4210
4247
|
ref: menuRef,
|
|
@@ -4232,7 +4269,7 @@ Dropdown.displayName = "Dropdown";
|
|
|
4232
4269
|
var Dropdown_default = Dropdown;
|
|
4233
4270
|
|
|
4234
4271
|
// src/components/Editor/Editor.tsx
|
|
4235
|
-
var
|
|
4272
|
+
var import_react23 = __toESM(require("react"), 1);
|
|
4236
4273
|
|
|
4237
4274
|
// src/components/Editor/highlight.ts
|
|
4238
4275
|
var CODE_LANGUAGES = [
|
|
@@ -4503,22 +4540,22 @@ var Editor = (props) => {
|
|
|
4503
4540
|
onImageUpload,
|
|
4504
4541
|
minHeight = 200
|
|
4505
4542
|
} = props;
|
|
4506
|
-
const editorRef =
|
|
4507
|
-
const lastRangeRef =
|
|
4508
|
-
const composingRef =
|
|
4509
|
-
const [isFocused, setIsFocused] =
|
|
4510
|
-
const [isEmpty, setIsEmpty] =
|
|
4511
|
-
const [activeFormats, setActiveFormats] =
|
|
4512
|
-
const [slashOpen, setSlashOpen] =
|
|
4513
|
-
const [slashFilter, setSlashFilter] =
|
|
4514
|
-
const [slashIdx, setSlashIdx] =
|
|
4515
|
-
const [slashPos, setSlashPos] =
|
|
4516
|
-
const slashStartRangeRef =
|
|
4517
|
-
const [linkOpen, setLinkOpen] =
|
|
4518
|
-
const [linkValue, setLinkValue] =
|
|
4519
|
-
const [linkPos, setLinkPos] =
|
|
4520
|
-
const lastEmittedRef =
|
|
4521
|
-
|
|
4543
|
+
const editorRef = import_react23.default.useRef(null);
|
|
4544
|
+
const lastRangeRef = import_react23.default.useRef(null);
|
|
4545
|
+
const composingRef = import_react23.default.useRef(false);
|
|
4546
|
+
const [isFocused, setIsFocused] = import_react23.default.useState(false);
|
|
4547
|
+
const [isEmpty, setIsEmpty] = import_react23.default.useState(!value);
|
|
4548
|
+
const [activeFormats, setActiveFormats] = import_react23.default.useState(/* @__PURE__ */ new Set());
|
|
4549
|
+
const [slashOpen, setSlashOpen] = import_react23.default.useState(false);
|
|
4550
|
+
const [slashFilter, setSlashFilter] = import_react23.default.useState("");
|
|
4551
|
+
const [slashIdx, setSlashIdx] = import_react23.default.useState(0);
|
|
4552
|
+
const [slashPos, setSlashPos] = import_react23.default.useState({ top: 0, left: 0 });
|
|
4553
|
+
const slashStartRangeRef = import_react23.default.useRef(null);
|
|
4554
|
+
const [linkOpen, setLinkOpen] = import_react23.default.useState(false);
|
|
4555
|
+
const [linkValue, setLinkValue] = import_react23.default.useState("");
|
|
4556
|
+
const [linkPos, setLinkPos] = import_react23.default.useState({ top: 0, left: 0 });
|
|
4557
|
+
const lastEmittedRef = import_react23.default.useRef(null);
|
|
4558
|
+
import_react23.default.useEffect(() => {
|
|
4522
4559
|
const el = editorRef.current;
|
|
4523
4560
|
if (!el) return;
|
|
4524
4561
|
if (value === lastEmittedRef.current) return;
|
|
@@ -4600,10 +4637,10 @@ var Editor = (props) => {
|
|
|
4600
4637
|
const current = String(document.queryCommandValue("formatBlock") || "").toLowerCase();
|
|
4601
4638
|
setBlock(current === tag ? "p" : tag);
|
|
4602
4639
|
};
|
|
4603
|
-
const historyRef =
|
|
4604
|
-
const historyIdxRef =
|
|
4605
|
-
const lastPushAtRef =
|
|
4606
|
-
const isRestoringRef =
|
|
4640
|
+
const historyRef = import_react23.default.useRef([]);
|
|
4641
|
+
const historyIdxRef = import_react23.default.useRef(-1);
|
|
4642
|
+
const lastPushAtRef = import_react23.default.useRef(0);
|
|
4643
|
+
const isRestoringRef = import_react23.default.useRef(false);
|
|
4607
4644
|
const caretOffset = (rootEl) => {
|
|
4608
4645
|
const el = rootEl ?? editorRef.current;
|
|
4609
4646
|
const sel = window.getSelection();
|
|
@@ -4680,8 +4717,8 @@ var Editor = (props) => {
|
|
|
4680
4717
|
const cls = Array.from(pre.classList).find((c) => c.startsWith("lang-"));
|
|
4681
4718
|
return cls?.slice(5) ?? "plain";
|
|
4682
4719
|
};
|
|
4683
|
-
const [codeLang, setCodeLang] =
|
|
4684
|
-
const highlightRafRef =
|
|
4720
|
+
const [codeLang, setCodeLang] = import_react23.default.useState("plain");
|
|
4721
|
+
const highlightRafRef = import_react23.default.useRef(0);
|
|
4685
4722
|
const rehighlight = (pre) => {
|
|
4686
4723
|
if (composingRef.current) return;
|
|
4687
4724
|
const code = pre.querySelector("code");
|
|
@@ -5026,7 +5063,7 @@ var Editor = (props) => {
|
|
|
5026
5063
|
setSlashIdx(0);
|
|
5027
5064
|
slashStartRangeRef.current = null;
|
|
5028
5065
|
};
|
|
5029
|
-
const filteredSlashItems =
|
|
5066
|
+
const filteredSlashItems = import_react23.default.useMemo(() => {
|
|
5030
5067
|
if (!slashFilter) return SLASH_ITEMS;
|
|
5031
5068
|
const f = slashFilter.toLowerCase();
|
|
5032
5069
|
return SLASH_ITEMS.filter((it) => it.label.toLowerCase().includes(f) || it.key.includes(f));
|
|
@@ -5291,7 +5328,7 @@ var Editor = (props) => {
|
|
|
5291
5328
|
}
|
|
5292
5329
|
}
|
|
5293
5330
|
};
|
|
5294
|
-
const plainPasteRef =
|
|
5331
|
+
const plainPasteRef = import_react23.default.useRef(false);
|
|
5295
5332
|
const handlePaste = (e) => {
|
|
5296
5333
|
if (readOnly) return;
|
|
5297
5334
|
e.preventDefault();
|
|
@@ -5592,7 +5629,7 @@ var EditorToolbar = ({
|
|
|
5592
5629
|
] });
|
|
5593
5630
|
};
|
|
5594
5631
|
var SlashMenu = ({ position, items, activeIndex, onSelect, onClose }) => {
|
|
5595
|
-
|
|
5632
|
+
import_react23.default.useEffect(() => {
|
|
5596
5633
|
const handleClickOutside = (e) => {
|
|
5597
5634
|
const target = e.target;
|
|
5598
5635
|
const menu = document.querySelector(".lib-xplat-editor__slash-menu");
|
|
@@ -5626,8 +5663,8 @@ var SlashMenu = ({ position, items, activeIndex, onSelect, onClose }) => {
|
|
|
5626
5663
|
);
|
|
5627
5664
|
};
|
|
5628
5665
|
var LinkPopover = ({ position, value, onChange, onConfirm, onClose }) => {
|
|
5629
|
-
const inputRef =
|
|
5630
|
-
|
|
5666
|
+
const inputRef = import_react23.default.useRef(null);
|
|
5667
|
+
import_react23.default.useEffect(() => {
|
|
5631
5668
|
inputRef.current?.focus();
|
|
5632
5669
|
}, []);
|
|
5633
5670
|
return /* @__PURE__ */ (0, import_jsx_runtime323.jsxs)(
|
|
@@ -5685,7 +5722,7 @@ EmptyState.displayName = "EmptyState";
|
|
|
5685
5722
|
var EmptyState_default = EmptyState;
|
|
5686
5723
|
|
|
5687
5724
|
// src/components/FileUpload/FileUpload.tsx
|
|
5688
|
-
var
|
|
5725
|
+
var import_react24 = __toESM(require("react"), 1);
|
|
5689
5726
|
var import_jsx_runtime325 = require("react/jsx-runtime");
|
|
5690
5727
|
var FileUpload = (props) => {
|
|
5691
5728
|
const {
|
|
@@ -5699,9 +5736,9 @@ var FileUpload = (props) => {
|
|
|
5699
5736
|
label,
|
|
5700
5737
|
required
|
|
5701
5738
|
} = props;
|
|
5702
|
-
const fieldId =
|
|
5703
|
-
const [isDragOver, setIsDragOver] =
|
|
5704
|
-
const inputRef =
|
|
5739
|
+
const fieldId = import_react24.default.useId();
|
|
5740
|
+
const [isDragOver, setIsDragOver] = import_react24.default.useState(false);
|
|
5741
|
+
const inputRef = import_react24.default.useRef(null);
|
|
5705
5742
|
const handleFiles = (fileList) => {
|
|
5706
5743
|
let files = Array.from(fileList);
|
|
5707
5744
|
if (maxSize) {
|
|
@@ -5764,10 +5801,10 @@ FileUpload.displayName = "FileUpload";
|
|
|
5764
5801
|
var FileUpload_default = FileUpload;
|
|
5765
5802
|
|
|
5766
5803
|
// src/components/HtmlTypeWriter/HtmlTypeWriter.tsx
|
|
5767
|
-
var
|
|
5804
|
+
var import_react26 = __toESM(require("react"), 1);
|
|
5768
5805
|
|
|
5769
5806
|
// src/components/HtmlTypeWriter/utils.ts
|
|
5770
|
-
var
|
|
5807
|
+
var import_react25 = __toESM(require("react"), 1);
|
|
5771
5808
|
var voidTags = /* @__PURE__ */ new Set([
|
|
5772
5809
|
"br",
|
|
5773
5810
|
"img",
|
|
@@ -5835,15 +5872,15 @@ var convertNodeToReactWithRange = (node, typedLen, rangeMap) => {
|
|
|
5835
5872
|
props[attr.name] = attr.value;
|
|
5836
5873
|
});
|
|
5837
5874
|
if (voidTags.has(tag)) {
|
|
5838
|
-
return
|
|
5875
|
+
return import_react25.default.createElement(tag, props);
|
|
5839
5876
|
}
|
|
5840
5877
|
const children = Array.from(element.childNodes).map((child) => convertNodeToReactWithRange(child, typedLen, rangeMap)).filter((n) => n != null);
|
|
5841
|
-
return
|
|
5878
|
+
return import_react25.default.createElement(tag, props, ...children);
|
|
5842
5879
|
};
|
|
5843
5880
|
var htmlToReactProgressive = (root, typedLen, rangeMap) => {
|
|
5844
5881
|
const nodes = Array.from(root.childNodes).map((child, idx) => {
|
|
5845
5882
|
const node = convertNodeToReactWithRange(child, typedLen, rangeMap);
|
|
5846
|
-
return node == null ? null :
|
|
5883
|
+
return node == null ? null : import_react25.default.createElement(import_react25.default.Fragment, { key: idx }, node);
|
|
5847
5884
|
}).filter(Boolean);
|
|
5848
5885
|
return nodes.length === 0 ? null : nodes;
|
|
5849
5886
|
};
|
|
@@ -5856,20 +5893,20 @@ var HtmlTypeWriter = ({
|
|
|
5856
5893
|
onDone,
|
|
5857
5894
|
onChange
|
|
5858
5895
|
}) => {
|
|
5859
|
-
const [typedLen, setTypedLen] =
|
|
5860
|
-
const doneCalledRef =
|
|
5861
|
-
const { doc, rangeMap, totalLength } =
|
|
5896
|
+
const [typedLen, setTypedLen] = import_react26.default.useState(0);
|
|
5897
|
+
const doneCalledRef = import_react26.default.useRef(false);
|
|
5898
|
+
const { doc, rangeMap, totalLength } = import_react26.default.useMemo(() => {
|
|
5862
5899
|
if (typeof window === "undefined") return { doc: null, rangeMap: /* @__PURE__ */ new Map(), totalLength: 0 };
|
|
5863
5900
|
const decoded = decodeHtmlEntities(html);
|
|
5864
5901
|
const doc2 = new DOMParser().parseFromString(decoded, "text/html");
|
|
5865
5902
|
const { rangeMap: rangeMap2, totalLength: totalLength2 } = buildRangeMap(doc2.body);
|
|
5866
5903
|
return { doc: doc2, rangeMap: rangeMap2, totalLength: totalLength2 };
|
|
5867
5904
|
}, [html]);
|
|
5868
|
-
|
|
5905
|
+
import_react26.default.useEffect(() => {
|
|
5869
5906
|
setTypedLen(0);
|
|
5870
5907
|
doneCalledRef.current = false;
|
|
5871
5908
|
}, [html]);
|
|
5872
|
-
|
|
5909
|
+
import_react26.default.useEffect(() => {
|
|
5873
5910
|
if (!totalLength) return;
|
|
5874
5911
|
if (typedLen >= totalLength) return;
|
|
5875
5912
|
const timer = window.setInterval(() => {
|
|
@@ -5877,18 +5914,18 @@ var HtmlTypeWriter = ({
|
|
|
5877
5914
|
}, duration);
|
|
5878
5915
|
return () => window.clearInterval(timer);
|
|
5879
5916
|
}, [typedLen, totalLength, duration]);
|
|
5880
|
-
|
|
5917
|
+
import_react26.default.useEffect(() => {
|
|
5881
5918
|
if (typedLen > 0 && typedLen < totalLength) {
|
|
5882
5919
|
onChange?.();
|
|
5883
5920
|
}
|
|
5884
5921
|
}, [typedLen, totalLength, onChange]);
|
|
5885
|
-
|
|
5922
|
+
import_react26.default.useEffect(() => {
|
|
5886
5923
|
if (typedLen === totalLength && totalLength > 0 && !doneCalledRef.current) {
|
|
5887
5924
|
doneCalledRef.current = true;
|
|
5888
5925
|
onDone?.();
|
|
5889
5926
|
}
|
|
5890
5927
|
}, [typedLen, totalLength, onDone]);
|
|
5891
|
-
const parsed =
|
|
5928
|
+
const parsed = import_react26.default.useMemo(
|
|
5892
5929
|
() => doc ? htmlToReactProgressive(doc.body, typedLen, rangeMap) : null,
|
|
5893
5930
|
[doc, typedLen, rangeMap]
|
|
5894
5931
|
);
|
|
@@ -5898,13 +5935,13 @@ HtmlTypeWriter.displayName = "HtmlTypeWriter";
|
|
|
5898
5935
|
var HtmlTypeWriter_default = HtmlTypeWriter;
|
|
5899
5936
|
|
|
5900
5937
|
// src/components/ImageSelector/ImageSelector.tsx
|
|
5901
|
-
var
|
|
5938
|
+
var import_react27 = __toESM(require("react"), 1);
|
|
5902
5939
|
var import_jsx_runtime327 = require("react/jsx-runtime");
|
|
5903
5940
|
var ImageSelector = (props) => {
|
|
5904
5941
|
const { value, placeholder, onChange, validations, label, required } = props;
|
|
5905
|
-
const fieldId =
|
|
5906
|
-
const [previewUrl, setPreviewUrl] =
|
|
5907
|
-
|
|
5942
|
+
const fieldId = import_react27.default.useId();
|
|
5943
|
+
const [previewUrl, setPreviewUrl] = import_react27.default.useState();
|
|
5944
|
+
import_react27.default.useEffect(() => {
|
|
5908
5945
|
if (!value) {
|
|
5909
5946
|
setPreviewUrl(void 0);
|
|
5910
5947
|
return;
|
|
@@ -5913,7 +5950,7 @@ var ImageSelector = (props) => {
|
|
|
5913
5950
|
setPreviewUrl(url);
|
|
5914
5951
|
return () => URL.revokeObjectURL(url);
|
|
5915
5952
|
}, [value]);
|
|
5916
|
-
const inputRef =
|
|
5953
|
+
const inputRef = import_react27.default.useRef(null);
|
|
5917
5954
|
const handleFileChange = (e) => {
|
|
5918
5955
|
const selectedFile = e.target.files?.[0];
|
|
5919
5956
|
if (selectedFile) {
|
|
@@ -6096,22 +6133,23 @@ Pagination.displayName = "Pagination";
|
|
|
6096
6133
|
var Pagination_default = Pagination;
|
|
6097
6134
|
|
|
6098
6135
|
// src/components/PopOver/PopOver.tsx
|
|
6099
|
-
var
|
|
6136
|
+
var import_react28 = __toESM(require("react"), 1);
|
|
6100
6137
|
var import_jsx_runtime332 = require("react/jsx-runtime");
|
|
6101
6138
|
var PopOver = (props) => {
|
|
6102
6139
|
const { children, isOpen, onClose, PopOverEl } = props;
|
|
6103
|
-
const popRef =
|
|
6104
|
-
const triggerRef =
|
|
6105
|
-
const [localOpen, setLocalOpen] =
|
|
6106
|
-
const [eventTrigger, setEventTrigger] =
|
|
6140
|
+
const popRef = import_react28.default.useRef(null);
|
|
6141
|
+
const triggerRef = import_react28.default.useRef(null);
|
|
6142
|
+
const [localOpen, setLocalOpen] = import_react28.default.useState(false);
|
|
6143
|
+
const [eventTrigger, setEventTrigger] = import_react28.default.useState(false);
|
|
6107
6144
|
useClickOutside_default([popRef, triggerRef], onClose, isOpen);
|
|
6108
6145
|
useCloseWhenFocusHidden(isOpen, triggerRef, popRef, onClose);
|
|
6109
6146
|
useEscapeKey(isOpen, () => {
|
|
6110
6147
|
onClose();
|
|
6111
6148
|
triggerRef.current?.focus({ preventScroll: true });
|
|
6112
6149
|
});
|
|
6150
|
+
const host = useOverlayHost_default(triggerRef, localOpen);
|
|
6113
6151
|
useAutoPosition_default(triggerRef, popRef, localOpen);
|
|
6114
|
-
|
|
6152
|
+
import_react28.default.useEffect(() => {
|
|
6115
6153
|
if (isOpen) {
|
|
6116
6154
|
setLocalOpen(isOpen);
|
|
6117
6155
|
setTimeout(() => {
|
|
@@ -6134,7 +6172,7 @@ var PopOver = (props) => {
|
|
|
6134
6172
|
},
|
|
6135
6173
|
children: [
|
|
6136
6174
|
children,
|
|
6137
|
-
localOpen && /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(
|
|
6175
|
+
localOpen && /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(Portal_default, { container: host, children: /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(
|
|
6138
6176
|
"div",
|
|
6139
6177
|
{
|
|
6140
6178
|
className: clsx_default(
|
|
@@ -6192,12 +6230,12 @@ Progress.displayName = "Progress";
|
|
|
6192
6230
|
var Progress_default = Progress;
|
|
6193
6231
|
|
|
6194
6232
|
// src/components/Radio/RadioGroupContext.tsx
|
|
6195
|
-
var
|
|
6196
|
-
var RadioGroupContext =
|
|
6233
|
+
var import_react29 = __toESM(require("react"), 1);
|
|
6234
|
+
var RadioGroupContext = import_react29.default.createContext(
|
|
6197
6235
|
null
|
|
6198
6236
|
);
|
|
6199
6237
|
var useRadioGroupContext = () => {
|
|
6200
|
-
return
|
|
6238
|
+
return import_react29.default.useContext(RadioGroupContext);
|
|
6201
6239
|
};
|
|
6202
6240
|
var RadioGroupContext_default = RadioGroupContext;
|
|
6203
6241
|
|
|
@@ -6273,19 +6311,19 @@ RadioGroup.displayName = "RadioGroup";
|
|
|
6273
6311
|
var RadioGroup_default = RadioGroup;
|
|
6274
6312
|
|
|
6275
6313
|
// src/components/Select/Select.tsx
|
|
6276
|
-
var
|
|
6314
|
+
var import_react32 = __toESM(require("react"), 1);
|
|
6277
6315
|
|
|
6278
6316
|
// src/components/Select/context.ts
|
|
6279
|
-
var
|
|
6280
|
-
var SelectContext =
|
|
6317
|
+
var import_react30 = __toESM(require("react"), 1);
|
|
6318
|
+
var SelectContext = import_react30.default.createContext(null);
|
|
6281
6319
|
var context_default = SelectContext;
|
|
6282
6320
|
|
|
6283
6321
|
// src/components/Select/SelectItem.tsx
|
|
6284
|
-
var
|
|
6322
|
+
var import_react31 = __toESM(require("react"), 1);
|
|
6285
6323
|
var import_jsx_runtime336 = require("react/jsx-runtime");
|
|
6286
6324
|
var SelectItem = (props) => {
|
|
6287
6325
|
const { children, value, onClick, disabled = false } = props;
|
|
6288
|
-
const ctx =
|
|
6326
|
+
const ctx = import_react31.default.useContext(context_default);
|
|
6289
6327
|
const handleClick = (e) => {
|
|
6290
6328
|
e.preventDefault();
|
|
6291
6329
|
e.stopPropagation();
|
|
@@ -6335,29 +6373,29 @@ var SelectRoot = (props) => {
|
|
|
6335
6373
|
required,
|
|
6336
6374
|
size = "md"
|
|
6337
6375
|
} = props;
|
|
6338
|
-
const fieldId =
|
|
6339
|
-
const itemChildren =
|
|
6340
|
-
(child) =>
|
|
6376
|
+
const fieldId = import_react32.default.useId();
|
|
6377
|
+
const itemChildren = import_react32.default.Children.toArray(children).filter(
|
|
6378
|
+
(child) => import_react32.default.isValidElement(child) && child.type === SelectItem_default
|
|
6341
6379
|
);
|
|
6342
6380
|
const isControlled = valueProp !== void 0;
|
|
6343
|
-
const [isOpen, setOpen] =
|
|
6344
|
-
const [uncontrolledLabel, setUncontrolledLabel] =
|
|
6345
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
6346
|
-
const controlledLabel =
|
|
6381
|
+
const [isOpen, setOpen] = import_react32.default.useState(false);
|
|
6382
|
+
const [uncontrolledLabel, setUncontrolledLabel] = import_react32.default.useState(null);
|
|
6383
|
+
const [uncontrolledValue, setUncontrolledValue] = import_react32.default.useState(void 0);
|
|
6384
|
+
const controlledLabel = import_react32.default.useMemo(() => {
|
|
6347
6385
|
if (!isControlled) return null;
|
|
6348
6386
|
const match = itemChildren.find((child) => child.props.value === valueProp);
|
|
6349
6387
|
return match ? match.props.children : null;
|
|
6350
6388
|
}, [isControlled, valueProp, itemChildren]);
|
|
6351
6389
|
const selectedLabel = isControlled ? controlledLabel : uncontrolledLabel;
|
|
6352
6390
|
const selectedValue = isControlled ? valueProp : uncontrolledValue;
|
|
6353
|
-
const triggerRef =
|
|
6354
|
-
const contentRef =
|
|
6355
|
-
const [mounted, setMounted] =
|
|
6356
|
-
const [visible, setVisible] =
|
|
6357
|
-
|
|
6391
|
+
const triggerRef = import_react32.default.useRef(null);
|
|
6392
|
+
const contentRef = import_react32.default.useRef(null);
|
|
6393
|
+
const [mounted, setMounted] = import_react32.default.useState(false);
|
|
6394
|
+
const [visible, setVisible] = import_react32.default.useState(false);
|
|
6395
|
+
import_react32.default.useEffect(() => {
|
|
6358
6396
|
if (disabled && isOpen) setOpen(false);
|
|
6359
6397
|
}, [disabled, isOpen]);
|
|
6360
|
-
|
|
6398
|
+
import_react32.default.useEffect(() => {
|
|
6361
6399
|
if (isOpen) {
|
|
6362
6400
|
setMounted(true);
|
|
6363
6401
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -6367,33 +6405,34 @@ var SelectRoot = (props) => {
|
|
|
6367
6405
|
const t = setTimeout(() => setMounted(false), ANIMATION_DURATION_MS3);
|
|
6368
6406
|
return () => clearTimeout(t);
|
|
6369
6407
|
}, [isOpen]);
|
|
6370
|
-
const [query, setQuery] =
|
|
6408
|
+
const [query, setQuery] = import_react32.default.useState("");
|
|
6371
6409
|
const textOf = (node) => {
|
|
6372
6410
|
if (node === null || node === void 0 || typeof node === "boolean") return "";
|
|
6373
6411
|
if (typeof node === "string" || typeof node === "number") return String(node);
|
|
6374
6412
|
if (Array.isArray(node)) return node.map(textOf).join("");
|
|
6375
|
-
if (
|
|
6413
|
+
if (import_react32.default.isValidElement(node)) return textOf(node.props.children);
|
|
6376
6414
|
return "";
|
|
6377
6415
|
};
|
|
6378
|
-
const visibleItems =
|
|
6416
|
+
const visibleItems = import_react32.default.useMemo(() => {
|
|
6379
6417
|
if (!searchable || !query.trim()) return itemChildren;
|
|
6380
6418
|
const q = query.trim().toLowerCase();
|
|
6381
6419
|
return itemChildren.filter((c) => textOf(c.props.children).toLowerCase().includes(q));
|
|
6382
6420
|
}, [searchable, query, itemChildren]);
|
|
6383
|
-
const open =
|
|
6384
|
-
const close =
|
|
6421
|
+
const open = import_react32.default.useCallback(() => setOpen(true), []);
|
|
6422
|
+
const close = import_react32.default.useCallback(() => {
|
|
6385
6423
|
setOpen(false);
|
|
6386
6424
|
setQuery("");
|
|
6387
6425
|
}, []);
|
|
6388
|
-
const toggle =
|
|
6426
|
+
const toggle = import_react32.default.useCallback(() => setOpen((prev) => !prev), []);
|
|
6389
6427
|
useClickOutside_default([contentRef, triggerRef], close, isOpen);
|
|
6390
6428
|
useCloseWhenFocusHidden(isOpen, triggerRef, contentRef, close);
|
|
6391
6429
|
useEscapeKey(isOpen, () => {
|
|
6392
6430
|
close();
|
|
6393
6431
|
triggerRef.current?.focus({ preventScroll: true });
|
|
6394
6432
|
});
|
|
6433
|
+
const host = useOverlayHost_default(triggerRef, mounted);
|
|
6395
6434
|
useAutoPosition_default(triggerRef, contentRef, mounted);
|
|
6396
|
-
const setSelected =
|
|
6435
|
+
const setSelected = import_react32.default.useCallback(
|
|
6397
6436
|
(label2, itemValue) => {
|
|
6398
6437
|
if (!isControlled) {
|
|
6399
6438
|
setUncontrolledLabel(label2);
|
|
@@ -6403,7 +6442,7 @@ var SelectRoot = (props) => {
|
|
|
6403
6442
|
},
|
|
6404
6443
|
[isControlled, onChange]
|
|
6405
6444
|
);
|
|
6406
|
-
const ctxValue =
|
|
6445
|
+
const ctxValue = import_react32.default.useMemo(
|
|
6407
6446
|
() => ({
|
|
6408
6447
|
isOpen,
|
|
6409
6448
|
mounted,
|
|
@@ -6482,7 +6521,7 @@ var SelectRoot = (props) => {
|
|
|
6482
6521
|
]
|
|
6483
6522
|
}
|
|
6484
6523
|
),
|
|
6485
|
-
mounted && /* @__PURE__ */ (0, import_jsx_runtime337.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime337.jsxs)(
|
|
6524
|
+
mounted && /* @__PURE__ */ (0, import_jsx_runtime337.jsx)(Portal_default, { container: host, children: /* @__PURE__ */ (0, import_jsx_runtime337.jsxs)(
|
|
6486
6525
|
"div",
|
|
6487
6526
|
{
|
|
6488
6527
|
className: clsx_default("lib-xplat-select-content", size, stateClass),
|
|
@@ -6648,7 +6687,7 @@ Steps.displayName = "Steps";
|
|
|
6648
6687
|
var Steps_default = Steps;
|
|
6649
6688
|
|
|
6650
6689
|
// src/components/Swiper/Swiper.tsx
|
|
6651
|
-
var
|
|
6690
|
+
var import_react33 = __toESM(require("react"), 1);
|
|
6652
6691
|
var import_jsx_runtime342 = require("react/jsx-runtime");
|
|
6653
6692
|
var Swiper = (props) => {
|
|
6654
6693
|
const {
|
|
@@ -6673,26 +6712,26 @@ var Swiper = (props) => {
|
|
|
6673
6712
|
const maxIndex = Math.max(0, totalSlides - viewItemCount);
|
|
6674
6713
|
const useLoop = loop && canSlide;
|
|
6675
6714
|
const cloneCount = useLoop ? totalSlides : 0;
|
|
6676
|
-
const extendedItems =
|
|
6715
|
+
const extendedItems = import_react33.default.useMemo(() => {
|
|
6677
6716
|
if (!useLoop) return items;
|
|
6678
6717
|
return [...items, ...items, ...items];
|
|
6679
6718
|
}, [items, useLoop]);
|
|
6680
6719
|
const initialIdx = Math.max(0, Math.min(indexProp ?? 0, maxIndex));
|
|
6681
|
-
const [innerIndex, setInnerIndex] =
|
|
6720
|
+
const [innerIndex, setInnerIndex] = import_react33.default.useState(
|
|
6682
6721
|
useLoop ? cloneCount + initialIdx : initialIdx
|
|
6683
6722
|
);
|
|
6684
|
-
const [isDragging, setIsDragging] =
|
|
6685
|
-
const [dragOffset, setDragOffset] =
|
|
6686
|
-
const [animated, setAnimated] =
|
|
6687
|
-
const [containerWidth, setContainerWidth] =
|
|
6688
|
-
const containerRef =
|
|
6689
|
-
const startXRef =
|
|
6690
|
-
const startTimeRef =
|
|
6691
|
-
const autoplayTimerRef =
|
|
6692
|
-
const resumeTimeoutRef =
|
|
6693
|
-
const [paused, setPaused] =
|
|
6694
|
-
const initializedRef =
|
|
6695
|
-
|
|
6723
|
+
const [isDragging, setIsDragging] = import_react33.default.useState(false);
|
|
6724
|
+
const [dragOffset, setDragOffset] = import_react33.default.useState(0);
|
|
6725
|
+
const [animated, setAnimated] = import_react33.default.useState(false);
|
|
6726
|
+
const [containerWidth, setContainerWidth] = import_react33.default.useState(0);
|
|
6727
|
+
const containerRef = import_react33.default.useRef(null);
|
|
6728
|
+
const startXRef = import_react33.default.useRef(0);
|
|
6729
|
+
const startTimeRef = import_react33.default.useRef(0);
|
|
6730
|
+
const autoplayTimerRef = import_react33.default.useRef(null);
|
|
6731
|
+
const resumeTimeoutRef = import_react33.default.useRef(null);
|
|
6732
|
+
const [paused, setPaused] = import_react33.default.useState(false);
|
|
6733
|
+
const initializedRef = import_react33.default.useRef(false);
|
|
6734
|
+
import_react33.default.useEffect(() => {
|
|
6696
6735
|
const el = containerRef.current;
|
|
6697
6736
|
if (!el) return;
|
|
6698
6737
|
const ro = new ResizeObserver((entries) => {
|
|
@@ -6715,7 +6754,7 @@ var Swiper = (props) => {
|
|
|
6715
6754
|
return ((inner - cloneCount) % totalSlides + totalSlides) % totalSlides;
|
|
6716
6755
|
};
|
|
6717
6756
|
const realIndex = getRealIndex(innerIndex);
|
|
6718
|
-
const moveToInner =
|
|
6757
|
+
const moveToInner = import_react33.default.useCallback(
|
|
6719
6758
|
(idx, withAnim = true) => {
|
|
6720
6759
|
if (!useLoop) {
|
|
6721
6760
|
setAnimated(withAnim);
|
|
@@ -6743,7 +6782,7 @@ var Swiper = (props) => {
|
|
|
6743
6782
|
},
|
|
6744
6783
|
[useLoop, cloneCount, totalSlides]
|
|
6745
6784
|
);
|
|
6746
|
-
const handleTransitionEnd =
|
|
6785
|
+
const handleTransitionEnd = import_react33.default.useCallback(() => {
|
|
6747
6786
|
if (!useLoop) return;
|
|
6748
6787
|
const real = getRealIndex(innerIndex);
|
|
6749
6788
|
const canonical = cloneCount + real;
|
|
@@ -6753,7 +6792,7 @@ var Swiper = (props) => {
|
|
|
6753
6792
|
}
|
|
6754
6793
|
onChange?.(Math.min(real, maxIndex));
|
|
6755
6794
|
}, [useLoop, innerIndex, cloneCount, totalSlides, maxIndex, onChange]);
|
|
6756
|
-
const slideTo =
|
|
6795
|
+
const slideTo = import_react33.default.useCallback(
|
|
6757
6796
|
(logicalIndex) => {
|
|
6758
6797
|
if (!canSlide) return;
|
|
6759
6798
|
const clamped = useLoop ? logicalIndex : Math.max(0, Math.min(logicalIndex, maxIndex));
|
|
@@ -6763,7 +6802,7 @@ var Swiper = (props) => {
|
|
|
6763
6802
|
},
|
|
6764
6803
|
[canSlide, useLoop, cloneCount, maxIndex, onChange, moveToInner]
|
|
6765
6804
|
);
|
|
6766
|
-
const slideNext =
|
|
6805
|
+
const slideNext = import_react33.default.useCallback(() => {
|
|
6767
6806
|
if (!canSlide) return;
|
|
6768
6807
|
const nextInner = innerIndex + slideBy;
|
|
6769
6808
|
if (useLoop) {
|
|
@@ -6772,7 +6811,7 @@ var Swiper = (props) => {
|
|
|
6772
6811
|
moveToInner(Math.min(nextInner, maxIndex), true);
|
|
6773
6812
|
}
|
|
6774
6813
|
}, [canSlide, useLoop, innerIndex, slideBy, maxIndex, moveToInner]);
|
|
6775
|
-
const slidePrev =
|
|
6814
|
+
const slidePrev = import_react33.default.useCallback(() => {
|
|
6776
6815
|
if (!canSlide) return;
|
|
6777
6816
|
const prevInner = innerIndex - slideBy;
|
|
6778
6817
|
if (useLoop) {
|
|
@@ -6781,7 +6820,7 @@ var Swiper = (props) => {
|
|
|
6781
6820
|
moveToInner(Math.max(prevInner, 0), true);
|
|
6782
6821
|
}
|
|
6783
6822
|
}, [canSlide, useLoop, innerIndex, slideBy, moveToInner]);
|
|
6784
|
-
|
|
6823
|
+
import_react33.default.useEffect(() => {
|
|
6785
6824
|
if (indexProp === void 0) return;
|
|
6786
6825
|
const clamped = Math.max(0, Math.min(indexProp, maxIndex));
|
|
6787
6826
|
const target = useLoop ? cloneCount + clamped : clamped;
|
|
@@ -6789,12 +6828,12 @@ var Swiper = (props) => {
|
|
|
6789
6828
|
moveToInner(target, true);
|
|
6790
6829
|
}
|
|
6791
6830
|
}, [indexProp]);
|
|
6792
|
-
|
|
6831
|
+
import_react33.default.useImperativeHandle(swiperRef, () => ({
|
|
6793
6832
|
slidePrev,
|
|
6794
6833
|
slideNext,
|
|
6795
6834
|
slideTo
|
|
6796
6835
|
}));
|
|
6797
|
-
|
|
6836
|
+
import_react33.default.useEffect(() => {
|
|
6798
6837
|
if (!auto || !canSlide || paused) return;
|
|
6799
6838
|
autoplayTimerRef.current = setInterval(slideNext, autoplayDelay);
|
|
6800
6839
|
return () => {
|
|
@@ -6820,7 +6859,7 @@ var Swiper = (props) => {
|
|
|
6820
6859
|
resumeTimeoutRef.current = null;
|
|
6821
6860
|
}, pauseOnInteraction);
|
|
6822
6861
|
};
|
|
6823
|
-
|
|
6862
|
+
import_react33.default.useEffect(() => {
|
|
6824
6863
|
return () => {
|
|
6825
6864
|
if (resumeTimeoutRef.current) clearTimeout(resumeTimeoutRef.current);
|
|
6826
6865
|
};
|
|
@@ -6838,7 +6877,7 @@ var Swiper = (props) => {
|
|
|
6838
6877
|
startXRef.current = getClientX(e);
|
|
6839
6878
|
startTimeRef.current = Date.now();
|
|
6840
6879
|
};
|
|
6841
|
-
|
|
6880
|
+
import_react33.default.useEffect(() => {
|
|
6842
6881
|
if (!isDragging) return;
|
|
6843
6882
|
const handleMove = (e) => {
|
|
6844
6883
|
setDragOffset(getClientX(e) - startXRef.current);
|
|
@@ -6877,7 +6916,7 @@ var Swiper = (props) => {
|
|
|
6877
6916
|
}, [isDragging, dragOffset, innerIndex, useLoop, maxIndex, slideStep, moveToInner]);
|
|
6878
6917
|
const slideWidthPercent = 100 / viewItemCount;
|
|
6879
6918
|
const gapAdjust = spaceBetween * (viewItemCount - 1) / viewItemCount;
|
|
6880
|
-
const slideElements =
|
|
6919
|
+
const slideElements = import_react33.default.useMemo(
|
|
6881
6920
|
() => extendedItems.map((item, idx) => /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(
|
|
6882
6921
|
"div",
|
|
6883
6922
|
{
|
|
@@ -6951,7 +6990,7 @@ Swiper.displayName = "Swiper";
|
|
|
6951
6990
|
var Swiper_default = Swiper;
|
|
6952
6991
|
|
|
6953
6992
|
// src/components/Switch/Switch.tsx
|
|
6954
|
-
var
|
|
6993
|
+
var import_react34 = __toESM(require("react"), 1);
|
|
6955
6994
|
var import_jsx_runtime343 = require("react/jsx-runtime");
|
|
6956
6995
|
var KNOB_TRANSITION_MS = 250;
|
|
6957
6996
|
var Switch = (props) => {
|
|
@@ -6965,11 +7004,11 @@ var Switch = (props) => {
|
|
|
6965
7004
|
label,
|
|
6966
7005
|
required
|
|
6967
7006
|
} = props;
|
|
6968
|
-
const fieldId =
|
|
7007
|
+
const fieldId = import_react34.default.useId();
|
|
6969
7008
|
const statusType = normalizeStatus(type);
|
|
6970
|
-
const [isAnimating, setIsAnimating] =
|
|
6971
|
-
const timeoutRef =
|
|
6972
|
-
|
|
7009
|
+
const [isAnimating, setIsAnimating] = import_react34.default.useState(false);
|
|
7010
|
+
const timeoutRef = import_react34.default.useRef(null);
|
|
7011
|
+
import_react34.default.useEffect(() => {
|
|
6973
7012
|
return () => {
|
|
6974
7013
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
6975
7014
|
};
|
|
@@ -7008,10 +7047,10 @@ Switch.displayName = "Switch";
|
|
|
7008
7047
|
var Switch_default = Switch;
|
|
7009
7048
|
|
|
7010
7049
|
// src/components/Table/TableContext.tsx
|
|
7011
|
-
var
|
|
7012
|
-
var TableContext =
|
|
7050
|
+
var import_react35 = __toESM(require("react"), 1);
|
|
7051
|
+
var TableContext = import_react35.default.createContext(null);
|
|
7013
7052
|
var useTableContext = () => {
|
|
7014
|
-
const ctx =
|
|
7053
|
+
const ctx = import_react35.default.useContext(TableContext);
|
|
7015
7054
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
7016
7055
|
return ctx;
|
|
7017
7056
|
};
|
|
@@ -7054,24 +7093,24 @@ TableBody.displayName = "TableBody";
|
|
|
7054
7093
|
var TableBody_default = TableBody;
|
|
7055
7094
|
|
|
7056
7095
|
// src/components/Table/TableCell.tsx
|
|
7057
|
-
var
|
|
7096
|
+
var import_react38 = __toESM(require("react"), 1);
|
|
7058
7097
|
|
|
7059
7098
|
// src/components/Table/TableHeadContext.tsx
|
|
7060
|
-
var
|
|
7061
|
-
var TableHeadContext =
|
|
7099
|
+
var import_react36 = __toESM(require("react"), 1);
|
|
7100
|
+
var TableHeadContext = import_react36.default.createContext(
|
|
7062
7101
|
null
|
|
7063
7102
|
);
|
|
7064
7103
|
var useTableHeadContext = () => {
|
|
7065
|
-
const ctx =
|
|
7104
|
+
const ctx = import_react36.default.useContext(TableHeadContext);
|
|
7066
7105
|
return ctx;
|
|
7067
7106
|
};
|
|
7068
7107
|
var TableHeadContext_default = TableHeadContext;
|
|
7069
7108
|
|
|
7070
7109
|
// src/components/Table/TableRowContext.tsx
|
|
7071
|
-
var
|
|
7072
|
-
var TableRowContext =
|
|
7110
|
+
var import_react37 = __toESM(require("react"), 1);
|
|
7111
|
+
var TableRowContext = import_react37.default.createContext(null);
|
|
7073
7112
|
var useTableRowContext = () => {
|
|
7074
|
-
const ctx =
|
|
7113
|
+
const ctx = import_react37.default.useContext(TableRowContext);
|
|
7075
7114
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
7076
7115
|
return ctx;
|
|
7077
7116
|
};
|
|
@@ -7079,7 +7118,7 @@ var TableRowContext_default = TableRowContext;
|
|
|
7079
7118
|
|
|
7080
7119
|
// src/components/Table/TableCell.tsx
|
|
7081
7120
|
var import_jsx_runtime346 = require("react/jsx-runtime");
|
|
7082
|
-
var TableCell =
|
|
7121
|
+
var TableCell = import_react38.default.memo((props) => {
|
|
7083
7122
|
const {
|
|
7084
7123
|
children,
|
|
7085
7124
|
align = "center",
|
|
@@ -7093,9 +7132,9 @@ var TableCell = import_react37.default.memo((props) => {
|
|
|
7093
7132
|
const { registerStickyCell, stickyCells } = useTableRowContext();
|
|
7094
7133
|
const { stickyShadow } = useTableContext();
|
|
7095
7134
|
const headContext = useTableHeadContext();
|
|
7096
|
-
const [left, setLeft] =
|
|
7097
|
-
const cellRef =
|
|
7098
|
-
const calculateLeft =
|
|
7135
|
+
const [left, setLeft] = import_react38.default.useState(0);
|
|
7136
|
+
const cellRef = import_react38.default.useRef(null);
|
|
7137
|
+
const calculateLeft = import_react38.default.useCallback(() => {
|
|
7099
7138
|
if (!cellRef.current) return 0;
|
|
7100
7139
|
let totalLeft = 0;
|
|
7101
7140
|
for (const ref of stickyCells) {
|
|
@@ -7104,7 +7143,7 @@ var TableCell = import_react37.default.memo((props) => {
|
|
|
7104
7143
|
}
|
|
7105
7144
|
return totalLeft;
|
|
7106
7145
|
}, [stickyCells]);
|
|
7107
|
-
|
|
7146
|
+
import_react38.default.useEffect(() => {
|
|
7108
7147
|
if (!isSticky || !cellRef.current) return;
|
|
7109
7148
|
registerStickyCell(cellRef);
|
|
7110
7149
|
setLeft(calculateLeft());
|
|
@@ -7162,9 +7201,9 @@ TableHead.displayName = "TableHead";
|
|
|
7162
7201
|
var TableHead_default = TableHead;
|
|
7163
7202
|
|
|
7164
7203
|
// src/components/Table/TableRow.tsx
|
|
7165
|
-
var
|
|
7204
|
+
var import_react39 = __toESM(require("react"), 1);
|
|
7166
7205
|
var import_jsx_runtime348 = require("react/jsx-runtime");
|
|
7167
|
-
var TableRow =
|
|
7206
|
+
var TableRow = import_react39.default.memo((props) => {
|
|
7168
7207
|
const {
|
|
7169
7208
|
children,
|
|
7170
7209
|
type = "secondary",
|
|
@@ -7173,7 +7212,7 @@ var TableRow = import_react38.default.memo((props) => {
|
|
|
7173
7212
|
onClick
|
|
7174
7213
|
} = props;
|
|
7175
7214
|
const { rowBorderUse } = useTableContext();
|
|
7176
|
-
const [stickyCells, setStickyCells] =
|
|
7215
|
+
const [stickyCells, setStickyCells] = import_react39.default.useState([]);
|
|
7177
7216
|
const registerStickyCell = (ref) => {
|
|
7178
7217
|
setStickyCells((prev) => {
|
|
7179
7218
|
if (prev.includes(ref)) return prev;
|
|
@@ -7237,9 +7276,9 @@ Tag.displayName = "Tag";
|
|
|
7237
7276
|
var Tag_default = Tag;
|
|
7238
7277
|
|
|
7239
7278
|
// src/components/TextArea/TextArea.tsx
|
|
7240
|
-
var
|
|
7279
|
+
var import_react40 = __toESM(require("react"), 1);
|
|
7241
7280
|
var import_jsx_runtime350 = require("react/jsx-runtime");
|
|
7242
|
-
var TextArea =
|
|
7281
|
+
var TextArea = import_react40.default.forwardRef(
|
|
7243
7282
|
(props, ref) => {
|
|
7244
7283
|
const {
|
|
7245
7284
|
className,
|
|
@@ -7252,7 +7291,7 @@ var TextArea = import_react39.default.forwardRef(
|
|
|
7252
7291
|
disabled,
|
|
7253
7292
|
...textareaProps
|
|
7254
7293
|
} = props;
|
|
7255
|
-
const autoId =
|
|
7294
|
+
const autoId = import_react40.default.useId();
|
|
7256
7295
|
const fieldId = props.id ?? autoId;
|
|
7257
7296
|
const control = /* @__PURE__ */ (0, import_jsx_runtime350.jsx)("div", { className: clsx_default("lib-xplat-textarea-wrap", className), children: /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
|
|
7258
7297
|
"textarea",
|
|
@@ -7274,7 +7313,7 @@ TextArea.displayName = "TextArea";
|
|
|
7274
7313
|
var TextArea_default = TextArea;
|
|
7275
7314
|
|
|
7276
7315
|
// src/components/TimePicker/TimePicker.tsx
|
|
7277
|
-
var
|
|
7316
|
+
var import_react41 = __toESM(require("react"), 1);
|
|
7278
7317
|
var import_jsx_runtime351 = require("react/jsx-runtime");
|
|
7279
7318
|
var ANIMATION_DURATION_MS4 = 200;
|
|
7280
7319
|
var toMinutes = (hhmm) => {
|
|
@@ -7312,13 +7351,13 @@ var TimePicker = (props) => {
|
|
|
7312
7351
|
required,
|
|
7313
7352
|
validations
|
|
7314
7353
|
} = props;
|
|
7315
|
-
const fieldId =
|
|
7316
|
-
const triggerRef =
|
|
7317
|
-
const contentRef =
|
|
7318
|
-
const [isOpen, setOpen] =
|
|
7319
|
-
const [mounted, setMounted] =
|
|
7320
|
-
const [visible, setVisible] =
|
|
7321
|
-
const options =
|
|
7354
|
+
const fieldId = import_react41.default.useId();
|
|
7355
|
+
const triggerRef = import_react41.default.useRef(null);
|
|
7356
|
+
const contentRef = import_react41.default.useRef(null);
|
|
7357
|
+
const [isOpen, setOpen] = import_react41.default.useState(false);
|
|
7358
|
+
const [mounted, setMounted] = import_react41.default.useState(false);
|
|
7359
|
+
const [visible, setVisible] = import_react41.default.useState(false);
|
|
7360
|
+
const options = import_react41.default.useMemo(() => {
|
|
7322
7361
|
const safeStep = step > 0 && step <= 720 ? step : 30;
|
|
7323
7362
|
const lo = toMinutes(min) ?? 0;
|
|
7324
7363
|
const hi = toMinutes(max) ?? 24 * 60 - 1;
|
|
@@ -7326,18 +7365,19 @@ var TimePicker = (props) => {
|
|
|
7326
7365
|
for (let t = lo; t <= hi; t += safeStep) out.push(toHHmm(t));
|
|
7327
7366
|
return out;
|
|
7328
7367
|
}, [step, min, max]);
|
|
7329
|
-
const close =
|
|
7368
|
+
const close = import_react41.default.useCallback(() => setOpen(false), []);
|
|
7330
7369
|
useClickOutside_default([triggerRef, contentRef], close, isOpen);
|
|
7331
7370
|
useCloseWhenFocusHidden(isOpen, triggerRef, contentRef, close);
|
|
7332
7371
|
useEscapeKey(isOpen, () => {
|
|
7333
7372
|
close();
|
|
7334
7373
|
triggerRef.current?.focus({ preventScroll: true });
|
|
7335
7374
|
});
|
|
7375
|
+
const host = useOverlayHost_default(triggerRef, mounted);
|
|
7336
7376
|
useAutoPosition_default(triggerRef, contentRef, mounted);
|
|
7337
|
-
|
|
7377
|
+
import_react41.default.useEffect(() => {
|
|
7338
7378
|
if (disabled && isOpen) setOpen(false);
|
|
7339
7379
|
}, [disabled, isOpen]);
|
|
7340
|
-
|
|
7380
|
+
import_react41.default.useEffect(() => {
|
|
7341
7381
|
if (isOpen) {
|
|
7342
7382
|
setMounted(true);
|
|
7343
7383
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -7375,7 +7415,7 @@ var TimePicker = (props) => {
|
|
|
7375
7415
|
children: /* @__PURE__ */ (0, import_jsx_runtime351.jsx)("span", { className: clsx_default("time-picker-value", !value && "placeholder"), children: value ? display(value, use12Hours) : placeholder })
|
|
7376
7416
|
}
|
|
7377
7417
|
),
|
|
7378
|
-
mounted && /* @__PURE__ */ (0, import_jsx_runtime351.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime351.jsx)(
|
|
7418
|
+
mounted && /* @__PURE__ */ (0, import_jsx_runtime351.jsx)(Portal_default, { container: host, children: /* @__PURE__ */ (0, import_jsx_runtime351.jsx)(
|
|
7379
7419
|
"div",
|
|
7380
7420
|
{
|
|
7381
7421
|
ref: contentRef,
|
|
@@ -7409,20 +7449,20 @@ TimePicker.displayName = "TimePicker";
|
|
|
7409
7449
|
var TimePicker_default = TimePicker;
|
|
7410
7450
|
|
|
7411
7451
|
// src/components/Toast/Toast.tsx
|
|
7412
|
-
var
|
|
7452
|
+
var import_react42 = __toESM(require("react"), 1);
|
|
7413
7453
|
var import_react_dom4 = require("react-dom");
|
|
7414
7454
|
var import_jsx_runtime352 = require("react/jsx-runtime");
|
|
7415
|
-
var ToastContext =
|
|
7455
|
+
var ToastContext = import_react42.default.createContext(null);
|
|
7416
7456
|
var useToast = () => {
|
|
7417
|
-
const ctx =
|
|
7457
|
+
const ctx = import_react42.default.useContext(ToastContext);
|
|
7418
7458
|
if (!ctx) throw new Error("useToast must be used within ToastProvider");
|
|
7419
7459
|
return ctx;
|
|
7420
7460
|
};
|
|
7421
7461
|
var EXIT_DURATION = 300;
|
|
7422
7462
|
var ToastItemComponent = ({ item, isExiting, onClose }) => {
|
|
7423
|
-
const ref =
|
|
7424
|
-
const [height, setHeight] =
|
|
7425
|
-
|
|
7463
|
+
const ref = import_react42.default.useRef(null);
|
|
7464
|
+
const [height, setHeight] = import_react42.default.useState(void 0);
|
|
7465
|
+
import_react42.default.useEffect(() => {
|
|
7426
7466
|
if (ref.current && !isExiting) {
|
|
7427
7467
|
setHeight(ref.current.offsetHeight);
|
|
7428
7468
|
}
|
|
@@ -7454,13 +7494,13 @@ var ToastProvider = ({
|
|
|
7454
7494
|
children,
|
|
7455
7495
|
position = "top-right"
|
|
7456
7496
|
}) => {
|
|
7457
|
-
const [toasts, setToasts] =
|
|
7458
|
-
const [removing, setRemoving] =
|
|
7459
|
-
const [mounted, setMounted] =
|
|
7460
|
-
|
|
7497
|
+
const [toasts, setToasts] = import_react42.default.useState([]);
|
|
7498
|
+
const [removing, setRemoving] = import_react42.default.useState(/* @__PURE__ */ new Set());
|
|
7499
|
+
const [mounted, setMounted] = import_react42.default.useState(false);
|
|
7500
|
+
import_react42.default.useEffect(() => {
|
|
7461
7501
|
setMounted(true);
|
|
7462
7502
|
}, []);
|
|
7463
|
-
const remove =
|
|
7503
|
+
const remove = import_react42.default.useCallback((id) => {
|
|
7464
7504
|
setRemoving((prev) => new Set(prev).add(id));
|
|
7465
7505
|
setTimeout(() => {
|
|
7466
7506
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
@@ -7471,7 +7511,7 @@ var ToastProvider = ({
|
|
|
7471
7511
|
});
|
|
7472
7512
|
}, EXIT_DURATION);
|
|
7473
7513
|
}, []);
|
|
7474
|
-
const toast =
|
|
7514
|
+
const toast = import_react42.default.useCallback(
|
|
7475
7515
|
(type, message, duration = 3e3) => {
|
|
7476
7516
|
const id = `${Date.now()}-${Math.random()}`;
|
|
7477
7517
|
setToasts((prev) => [...prev, { id, type, message }]);
|
|
@@ -7524,7 +7564,7 @@ ToggleChip.displayName = "ToggleChip";
|
|
|
7524
7564
|
var ToggleChip_default = ToggleChip;
|
|
7525
7565
|
|
|
7526
7566
|
// src/components/Tooltip/Tooltip.tsx
|
|
7527
|
-
var
|
|
7567
|
+
var import_react43 = __toESM(require("react"), 1);
|
|
7528
7568
|
var import_jsx_runtime354 = require("react/jsx-runtime");
|
|
7529
7569
|
var OFFSET = 12;
|
|
7530
7570
|
var GAP = 8;
|
|
@@ -7540,14 +7580,14 @@ var Tooltip = (props) => {
|
|
|
7540
7580
|
disabled = false
|
|
7541
7581
|
} = props;
|
|
7542
7582
|
const shape = variant ?? type ?? "dark";
|
|
7543
|
-
const triggerRef =
|
|
7544
|
-
const tooltipRef =
|
|
7545
|
-
const [visible, setVisible] =
|
|
7546
|
-
const [pos, setPos] =
|
|
7547
|
-
const delayTimer =
|
|
7548
|
-
const rafRef =
|
|
7549
|
-
const cursor =
|
|
7550
|
-
const clamp =
|
|
7583
|
+
const triggerRef = import_react43.default.useRef(null);
|
|
7584
|
+
const tooltipRef = import_react43.default.useRef(null);
|
|
7585
|
+
const [visible, setVisible] = import_react43.default.useState(false);
|
|
7586
|
+
const [pos, setPos] = import_react43.default.useState({ left: 0, top: 0 });
|
|
7587
|
+
const delayTimer = import_react43.default.useRef(0);
|
|
7588
|
+
const rafRef = import_react43.default.useRef(0);
|
|
7589
|
+
const cursor = import_react43.default.useRef(null);
|
|
7590
|
+
const clamp = import_react43.default.useCallback((left, top, w, h) => {
|
|
7551
7591
|
const vw = window.innerWidth;
|
|
7552
7592
|
const vh = window.innerHeight;
|
|
7553
7593
|
return {
|
|
@@ -7555,7 +7595,7 @@ var Tooltip = (props) => {
|
|
|
7555
7595
|
top: Math.min(Math.max(GAP, top), Math.max(GAP, vh - h - GAP))
|
|
7556
7596
|
};
|
|
7557
7597
|
}, []);
|
|
7558
|
-
const placeAtCursor =
|
|
7598
|
+
const placeAtCursor = import_react43.default.useCallback((x, y) => {
|
|
7559
7599
|
const el = tooltipRef.current;
|
|
7560
7600
|
if (!el) return;
|
|
7561
7601
|
const w = el.offsetWidth;
|
|
@@ -7566,7 +7606,7 @@ var Tooltip = (props) => {
|
|
|
7566
7606
|
if (top < GAP) top = y + OFFSET;
|
|
7567
7607
|
setPos(clamp(left, top, w, h));
|
|
7568
7608
|
}, [clamp]);
|
|
7569
|
-
const placeAtTrigger =
|
|
7609
|
+
const placeAtTrigger = import_react43.default.useCallback(() => {
|
|
7570
7610
|
const el = tooltipRef.current;
|
|
7571
7611
|
const trigger = triggerRef.current;
|
|
7572
7612
|
if (!el || !trigger) return;
|
|
@@ -7578,19 +7618,19 @@ var Tooltip = (props) => {
|
|
|
7578
7618
|
const left = rect.left + rect.width / 2 - w / 2;
|
|
7579
7619
|
setPos(clamp(left, top, w, h));
|
|
7580
7620
|
}, [clamp]);
|
|
7581
|
-
const reposition =
|
|
7621
|
+
const reposition = import_react43.default.useCallback(() => {
|
|
7582
7622
|
if (follow && cursor.current) {
|
|
7583
7623
|
placeAtCursor(cursor.current.x, cursor.current.y);
|
|
7584
7624
|
} else {
|
|
7585
7625
|
placeAtTrigger();
|
|
7586
7626
|
}
|
|
7587
7627
|
}, [follow, placeAtCursor, placeAtTrigger]);
|
|
7588
|
-
const handleMouseEnter =
|
|
7628
|
+
const handleMouseEnter = import_react43.default.useCallback((e) => {
|
|
7589
7629
|
if (disabled) return;
|
|
7590
7630
|
cursor.current = { x: e.clientX, y: e.clientY };
|
|
7591
7631
|
delayTimer.current = window.setTimeout(() => setVisible(true), SHOW_DELAY);
|
|
7592
7632
|
}, [disabled]);
|
|
7593
|
-
const handleMouseMove =
|
|
7633
|
+
const handleMouseMove = import_react43.default.useCallback((e) => {
|
|
7594
7634
|
cursor.current = { x: e.clientX, y: e.clientY };
|
|
7595
7635
|
if (!visible || !follow) return;
|
|
7596
7636
|
cancelAnimationFrame(rafRef.current);
|
|
@@ -7598,25 +7638,25 @@ var Tooltip = (props) => {
|
|
|
7598
7638
|
if (cursor.current) placeAtCursor(cursor.current.x, cursor.current.y);
|
|
7599
7639
|
});
|
|
7600
7640
|
}, [visible, follow, placeAtCursor]);
|
|
7601
|
-
const close =
|
|
7641
|
+
const close = import_react43.default.useCallback(() => {
|
|
7602
7642
|
window.clearTimeout(delayTimer.current);
|
|
7603
7643
|
cancelAnimationFrame(rafRef.current);
|
|
7604
7644
|
setVisible(false);
|
|
7605
7645
|
}, []);
|
|
7606
|
-
const handleMouseLeave =
|
|
7646
|
+
const handleMouseLeave = import_react43.default.useCallback(() => {
|
|
7607
7647
|
cursor.current = null;
|
|
7608
7648
|
close();
|
|
7609
7649
|
}, [close]);
|
|
7610
|
-
const handleFocus =
|
|
7650
|
+
const handleFocus = import_react43.default.useCallback(() => {
|
|
7611
7651
|
if (disabled) return;
|
|
7612
7652
|
cursor.current = null;
|
|
7613
7653
|
setVisible(true);
|
|
7614
7654
|
}, [disabled]);
|
|
7615
|
-
|
|
7655
|
+
import_react43.default.useLayoutEffect(() => {
|
|
7616
7656
|
if (!visible) return;
|
|
7617
7657
|
reposition();
|
|
7618
7658
|
}, [visible, reposition]);
|
|
7619
|
-
|
|
7659
|
+
import_react43.default.useEffect(() => {
|
|
7620
7660
|
if (!visible || follow) return;
|
|
7621
7661
|
const onChange = () => placeAtTrigger();
|
|
7622
7662
|
window.addEventListener("scroll", onChange, true);
|
|
@@ -7626,7 +7666,7 @@ var Tooltip = (props) => {
|
|
|
7626
7666
|
window.removeEventListener("resize", onChange);
|
|
7627
7667
|
};
|
|
7628
7668
|
}, [visible, follow, placeAtTrigger]);
|
|
7629
|
-
|
|
7669
|
+
import_react43.default.useEffect(() => () => {
|
|
7630
7670
|
window.clearTimeout(delayTimer.current);
|
|
7631
7671
|
cancelAnimationFrame(rafRef.current);
|
|
7632
7672
|
}, []);
|
|
@@ -7665,7 +7705,7 @@ Tooltip.displayName = "Tooltip";
|
|
|
7665
7705
|
var Tooltip_default = Tooltip;
|
|
7666
7706
|
|
|
7667
7707
|
// src/components/Video/Video.tsx
|
|
7668
|
-
var
|
|
7708
|
+
var import_react44 = __toESM(require("react"), 1);
|
|
7669
7709
|
var import_jsx_runtime355 = require("react/jsx-runtime");
|
|
7670
7710
|
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: [
|
|
7671
7711
|
/* @__PURE__ */ (0, import_jsx_runtime355.jsx)("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
|
|
@@ -7677,7 +7717,7 @@ var formatTime = (sec) => {
|
|
|
7677
7717
|
const s = Math.floor(sec % 60);
|
|
7678
7718
|
return `${m}:${s.toString().padStart(2, "0")}`;
|
|
7679
7719
|
};
|
|
7680
|
-
var Video =
|
|
7720
|
+
var Video = import_react44.default.forwardRef((props, ref) => {
|
|
7681
7721
|
const {
|
|
7682
7722
|
src,
|
|
7683
7723
|
poster,
|
|
@@ -7701,21 +7741,21 @@ var Video = import_react43.default.forwardRef((props, ref) => {
|
|
|
7701
7741
|
children,
|
|
7702
7742
|
...rest
|
|
7703
7743
|
} = props;
|
|
7704
|
-
const containerRef =
|
|
7705
|
-
const videoRef =
|
|
7706
|
-
const [isPlaying, setIsPlaying] =
|
|
7707
|
-
const [isLoaded, setIsLoaded] =
|
|
7708
|
-
const [currentTime, setCurrentTime] =
|
|
7709
|
-
const [duration, setDuration] =
|
|
7710
|
-
const [buffered, setBuffered] =
|
|
7711
|
-
const [volume, setVolume] =
|
|
7712
|
-
const [isMuted, setIsMuted] =
|
|
7713
|
-
const [isFullscreen, setIsFullscreen] =
|
|
7714
|
-
const [playbackRate, setPlaybackRate] =
|
|
7715
|
-
const [rateMenuOpen, setRateMenuOpen] =
|
|
7716
|
-
const [captionsOn, setCaptionsOn] =
|
|
7717
|
-
const [isPip, setIsPip] =
|
|
7718
|
-
const setRefs =
|
|
7744
|
+
const containerRef = import_react44.default.useRef(null);
|
|
7745
|
+
const videoRef = import_react44.default.useRef(null);
|
|
7746
|
+
const [isPlaying, setIsPlaying] = import_react44.default.useState(Boolean(autoPlay));
|
|
7747
|
+
const [isLoaded, setIsLoaded] = import_react44.default.useState(false);
|
|
7748
|
+
const [currentTime, setCurrentTime] = import_react44.default.useState(0);
|
|
7749
|
+
const [duration, setDuration] = import_react44.default.useState(0);
|
|
7750
|
+
const [buffered, setBuffered] = import_react44.default.useState(0);
|
|
7751
|
+
const [volume, setVolume] = import_react44.default.useState(1);
|
|
7752
|
+
const [isMuted, setIsMuted] = import_react44.default.useState(Boolean(muted));
|
|
7753
|
+
const [isFullscreen, setIsFullscreen] = import_react44.default.useState(false);
|
|
7754
|
+
const [playbackRate, setPlaybackRate] = import_react44.default.useState(1);
|
|
7755
|
+
const [rateMenuOpen, setRateMenuOpen] = import_react44.default.useState(false);
|
|
7756
|
+
const [captionsOn, setCaptionsOn] = import_react44.default.useState(false);
|
|
7757
|
+
const [isPip, setIsPip] = import_react44.default.useState(false);
|
|
7758
|
+
const setRefs = import_react44.default.useCallback(
|
|
7719
7759
|
(el) => {
|
|
7720
7760
|
videoRef.current = el;
|
|
7721
7761
|
if (typeof ref === "function") ref(el);
|
|
@@ -7723,14 +7763,14 @@ var Video = import_react43.default.forwardRef((props, ref) => {
|
|
|
7723
7763
|
},
|
|
7724
7764
|
[ref]
|
|
7725
7765
|
);
|
|
7726
|
-
|
|
7766
|
+
import_react44.default.useEffect(() => {
|
|
7727
7767
|
const onFsChange = () => {
|
|
7728
7768
|
setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
7729
7769
|
};
|
|
7730
7770
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
7731
7771
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
7732
7772
|
}, []);
|
|
7733
|
-
|
|
7773
|
+
import_react44.default.useEffect(() => {
|
|
7734
7774
|
const v = videoRef.current;
|
|
7735
7775
|
if (!v) return;
|
|
7736
7776
|
const onEnter = () => setIsPip(true);
|