@x-plat/design-system 0.14.19 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Dropdown/index.cjs +48 -18
- package/dist/components/Dropdown/index.js +48 -18
- package/dist/components/PopOver/index.cjs +47 -17
- package/dist/components/PopOver/index.js +47 -17
- package/dist/components/Select/index.cjs +67 -37
- package/dist/components/Select/index.js +67 -37
- package/dist/components/Table/index.cjs +17 -10
- package/dist/components/Table/index.js +17 -10
- package/dist/components/TimePicker/index.cjs +52 -22
- package/dist/components/TimePicker/index.js +52 -22
- package/dist/components/Tooltip/index.cjs +2 -2
- package/dist/components/Tooltip/index.js +2 -2
- package/dist/components/index.cjs +266 -226
- package/dist/components/index.js +266 -226
- package/dist/index.cjs +271 -231
- package/dist/index.js +271 -231
- package/package.json +1 -1
|
@@ -3236,8 +3236,10 @@ var import_react11 = __toESM(require("react"), 1);
|
|
|
3236
3236
|
var import_react10 = __toESM(require("react"), 1);
|
|
3237
3237
|
var findScrollParent = (el) => {
|
|
3238
3238
|
for (let p = el.parentElement; p; p = p.parentElement) {
|
|
3239
|
-
|
|
3240
|
-
|
|
3239
|
+
if (p.dataset.xplatOverlayEscape !== void 0) continue;
|
|
3240
|
+
const { overflowY } = getComputedStyle(p);
|
|
3241
|
+
if (!/(auto|scroll)/.test(overflowY)) continue;
|
|
3242
|
+
if (p.scrollHeight > p.clientHeight) return p;
|
|
3241
3243
|
}
|
|
3242
3244
|
return null;
|
|
3243
3245
|
};
|
|
@@ -3333,8 +3335,9 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3333
3335
|
);
|
|
3334
3336
|
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
3335
3337
|
const maxHeight = frozenMaxRef.current;
|
|
3336
|
-
|
|
3337
|
-
pop.style.
|
|
3338
|
+
const hostRect = (pop.offsetParent ?? pop.parentElement)?.getBoundingClientRect();
|
|
3339
|
+
pop.style.top = `${top - (hostRect?.top ?? 0)}px`;
|
|
3340
|
+
pop.style.left = `${left - (hostRect?.left ?? 0)}px`;
|
|
3338
3341
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
3339
3342
|
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";
|
|
3340
3343
|
directionRef.current = next;
|
|
@@ -4136,13 +4139,13 @@ Drawer.displayName = "Drawer";
|
|
|
4136
4139
|
var Drawer_default = Drawer;
|
|
4137
4140
|
|
|
4138
4141
|
// src/components/Dropdown/Dropdown.tsx
|
|
4139
|
-
var
|
|
4142
|
+
var import_react22 = __toESM(require("react"), 1);
|
|
4140
4143
|
|
|
4141
4144
|
// src/tokens/hooks/Portal.tsx
|
|
4142
4145
|
var import_react_dom3 = __toESM(require("react-dom"), 1);
|
|
4143
|
-
var Portal = ({ children }) => {
|
|
4146
|
+
var Portal = ({ children, container }) => {
|
|
4144
4147
|
if (typeof document === "undefined") return null;
|
|
4145
|
-
return import_react_dom3.default.createPortal(children, document.body);
|
|
4148
|
+
return import_react_dom3.default.createPortal(children, container ?? document.body);
|
|
4146
4149
|
};
|
|
4147
4150
|
Portal.displayName = "Portal";
|
|
4148
4151
|
var Portal_default = Portal;
|
|
@@ -4172,15 +4175,42 @@ var useClickOutside = (refs, handler, enabled = true) => {
|
|
|
4172
4175
|
};
|
|
4173
4176
|
var useClickOutside_default = useClickOutside;
|
|
4174
4177
|
|
|
4178
|
+
// src/tokens/hooks/useOverlayHost.ts
|
|
4179
|
+
var import_react21 = __toESM(require("react"), 1);
|
|
4180
|
+
var useOverlayHost = (triggerRef, enabled) => {
|
|
4181
|
+
const [host, setHost] = import_react21.default.useState(null);
|
|
4182
|
+
import_react21.default.useLayoutEffect(() => {
|
|
4183
|
+
if (!enabled || !triggerRef.current) {
|
|
4184
|
+
setHost(null);
|
|
4185
|
+
return;
|
|
4186
|
+
}
|
|
4187
|
+
const el = document.createElement("div");
|
|
4188
|
+
el.dataset.xplatOverlayHost = "";
|
|
4189
|
+
el.style.position = "relative";
|
|
4190
|
+
el.style.width = "0";
|
|
4191
|
+
el.style.height = "0";
|
|
4192
|
+
const parent = findScrollParent(triggerRef.current) ?? document.body;
|
|
4193
|
+
parent.appendChild(el);
|
|
4194
|
+
setHost(el);
|
|
4195
|
+
return () => {
|
|
4196
|
+
el.remove();
|
|
4197
|
+
setHost(null);
|
|
4198
|
+
};
|
|
4199
|
+
}, [enabled, triggerRef]);
|
|
4200
|
+
return host;
|
|
4201
|
+
};
|
|
4202
|
+
var useOverlayHost_default = useOverlayHost;
|
|
4203
|
+
|
|
4175
4204
|
// src/components/Dropdown/Dropdown.tsx
|
|
4176
4205
|
var import_jsx_runtime322 = require("react/jsx-runtime");
|
|
4177
4206
|
var Dropdown = (props) => {
|
|
4178
4207
|
const { items, children } = props;
|
|
4179
|
-
const [isOpen, setIsOpen] =
|
|
4180
|
-
const [mounted, setMounted] =
|
|
4181
|
-
const [visible, setVisible] =
|
|
4182
|
-
const triggerRef =
|
|
4183
|
-
const menuRef =
|
|
4208
|
+
const [isOpen, setIsOpen] = import_react22.default.useState(false);
|
|
4209
|
+
const [mounted, setMounted] = import_react22.default.useState(false);
|
|
4210
|
+
const [visible, setVisible] = import_react22.default.useState(false);
|
|
4211
|
+
const triggerRef = import_react22.default.useRef(null);
|
|
4212
|
+
const menuRef = import_react22.default.useRef(null);
|
|
4213
|
+
const host = useOverlayHost_default(triggerRef, mounted);
|
|
4184
4214
|
useAutoPosition_default(triggerRef, menuRef, mounted);
|
|
4185
4215
|
useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false), isOpen);
|
|
4186
4216
|
useCloseWhenFocusHidden(isOpen, triggerRef, menuRef, () => setIsOpen(false));
|
|
@@ -4188,7 +4218,7 @@ var Dropdown = (props) => {
|
|
|
4188
4218
|
setIsOpen(false);
|
|
4189
4219
|
triggerRef.current?.focus({ preventScroll: true });
|
|
4190
4220
|
});
|
|
4191
|
-
|
|
4221
|
+
import_react22.default.useEffect(() => {
|
|
4192
4222
|
if (isOpen) {
|
|
4193
4223
|
setMounted(true);
|
|
4194
4224
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -4213,7 +4243,7 @@ var Dropdown = (props) => {
|
|
|
4213
4243
|
children
|
|
4214
4244
|
}
|
|
4215
4245
|
),
|
|
4216
|
-
mounted && /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
|
|
4246
|
+
mounted && /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(Portal_default, { container: host, children: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
|
|
4217
4247
|
"div",
|
|
4218
4248
|
{
|
|
4219
4249
|
ref: menuRef,
|
|
@@ -4241,7 +4271,7 @@ Dropdown.displayName = "Dropdown";
|
|
|
4241
4271
|
var Dropdown_default = Dropdown;
|
|
4242
4272
|
|
|
4243
4273
|
// src/components/Editor/Editor.tsx
|
|
4244
|
-
var
|
|
4274
|
+
var import_react23 = __toESM(require("react"), 1);
|
|
4245
4275
|
|
|
4246
4276
|
// src/components/Editor/highlight.ts
|
|
4247
4277
|
var CODE_LANGUAGES = [
|
|
@@ -4512,22 +4542,22 @@ var Editor = (props) => {
|
|
|
4512
4542
|
onImageUpload,
|
|
4513
4543
|
minHeight = 200
|
|
4514
4544
|
} = props;
|
|
4515
|
-
const editorRef =
|
|
4516
|
-
const lastRangeRef =
|
|
4517
|
-
const composingRef =
|
|
4518
|
-
const [isFocused, setIsFocused] =
|
|
4519
|
-
const [isEmpty, setIsEmpty] =
|
|
4520
|
-
const [activeFormats, setActiveFormats] =
|
|
4521
|
-
const [slashOpen, setSlashOpen] =
|
|
4522
|
-
const [slashFilter, setSlashFilter] =
|
|
4523
|
-
const [slashIdx, setSlashIdx] =
|
|
4524
|
-
const [slashPos, setSlashPos] =
|
|
4525
|
-
const slashStartRangeRef =
|
|
4526
|
-
const [linkOpen, setLinkOpen] =
|
|
4527
|
-
const [linkValue, setLinkValue] =
|
|
4528
|
-
const [linkPos, setLinkPos] =
|
|
4529
|
-
const lastEmittedRef =
|
|
4530
|
-
|
|
4545
|
+
const editorRef = import_react23.default.useRef(null);
|
|
4546
|
+
const lastRangeRef = import_react23.default.useRef(null);
|
|
4547
|
+
const composingRef = import_react23.default.useRef(false);
|
|
4548
|
+
const [isFocused, setIsFocused] = import_react23.default.useState(false);
|
|
4549
|
+
const [isEmpty, setIsEmpty] = import_react23.default.useState(!value);
|
|
4550
|
+
const [activeFormats, setActiveFormats] = import_react23.default.useState(/* @__PURE__ */ new Set());
|
|
4551
|
+
const [slashOpen, setSlashOpen] = import_react23.default.useState(false);
|
|
4552
|
+
const [slashFilter, setSlashFilter] = import_react23.default.useState("");
|
|
4553
|
+
const [slashIdx, setSlashIdx] = import_react23.default.useState(0);
|
|
4554
|
+
const [slashPos, setSlashPos] = import_react23.default.useState({ top: 0, left: 0 });
|
|
4555
|
+
const slashStartRangeRef = import_react23.default.useRef(null);
|
|
4556
|
+
const [linkOpen, setLinkOpen] = import_react23.default.useState(false);
|
|
4557
|
+
const [linkValue, setLinkValue] = import_react23.default.useState("");
|
|
4558
|
+
const [linkPos, setLinkPos] = import_react23.default.useState({ top: 0, left: 0 });
|
|
4559
|
+
const lastEmittedRef = import_react23.default.useRef(null);
|
|
4560
|
+
import_react23.default.useEffect(() => {
|
|
4531
4561
|
const el = editorRef.current;
|
|
4532
4562
|
if (!el) return;
|
|
4533
4563
|
if (value === lastEmittedRef.current) return;
|
|
@@ -4609,10 +4639,10 @@ var Editor = (props) => {
|
|
|
4609
4639
|
const current = String(document.queryCommandValue("formatBlock") || "").toLowerCase();
|
|
4610
4640
|
setBlock(current === tag ? "p" : tag);
|
|
4611
4641
|
};
|
|
4612
|
-
const historyRef =
|
|
4613
|
-
const historyIdxRef =
|
|
4614
|
-
const lastPushAtRef =
|
|
4615
|
-
const isRestoringRef =
|
|
4642
|
+
const historyRef = import_react23.default.useRef([]);
|
|
4643
|
+
const historyIdxRef = import_react23.default.useRef(-1);
|
|
4644
|
+
const lastPushAtRef = import_react23.default.useRef(0);
|
|
4645
|
+
const isRestoringRef = import_react23.default.useRef(false);
|
|
4616
4646
|
const caretOffset = (rootEl) => {
|
|
4617
4647
|
const el = rootEl ?? editorRef.current;
|
|
4618
4648
|
const sel = window.getSelection();
|
|
@@ -4689,8 +4719,8 @@ var Editor = (props) => {
|
|
|
4689
4719
|
const cls = Array.from(pre.classList).find((c) => c.startsWith("lang-"));
|
|
4690
4720
|
return cls?.slice(5) ?? "plain";
|
|
4691
4721
|
};
|
|
4692
|
-
const [codeLang, setCodeLang] =
|
|
4693
|
-
const highlightRafRef =
|
|
4722
|
+
const [codeLang, setCodeLang] = import_react23.default.useState("plain");
|
|
4723
|
+
const highlightRafRef = import_react23.default.useRef(0);
|
|
4694
4724
|
const rehighlight = (pre) => {
|
|
4695
4725
|
if (composingRef.current) return;
|
|
4696
4726
|
const code = pre.querySelector("code");
|
|
@@ -5035,7 +5065,7 @@ var Editor = (props) => {
|
|
|
5035
5065
|
setSlashIdx(0);
|
|
5036
5066
|
slashStartRangeRef.current = null;
|
|
5037
5067
|
};
|
|
5038
|
-
const filteredSlashItems =
|
|
5068
|
+
const filteredSlashItems = import_react23.default.useMemo(() => {
|
|
5039
5069
|
if (!slashFilter) return SLASH_ITEMS;
|
|
5040
5070
|
const f = slashFilter.toLowerCase();
|
|
5041
5071
|
return SLASH_ITEMS.filter((it) => it.label.toLowerCase().includes(f) || it.key.includes(f));
|
|
@@ -5300,7 +5330,7 @@ var Editor = (props) => {
|
|
|
5300
5330
|
}
|
|
5301
5331
|
}
|
|
5302
5332
|
};
|
|
5303
|
-
const plainPasteRef =
|
|
5333
|
+
const plainPasteRef = import_react23.default.useRef(false);
|
|
5304
5334
|
const handlePaste = (e) => {
|
|
5305
5335
|
if (readOnly) return;
|
|
5306
5336
|
e.preventDefault();
|
|
@@ -5601,7 +5631,7 @@ var EditorToolbar = ({
|
|
|
5601
5631
|
] });
|
|
5602
5632
|
};
|
|
5603
5633
|
var SlashMenu = ({ position, items, activeIndex, onSelect, onClose }) => {
|
|
5604
|
-
|
|
5634
|
+
import_react23.default.useEffect(() => {
|
|
5605
5635
|
const handleClickOutside = (e) => {
|
|
5606
5636
|
const target = e.target;
|
|
5607
5637
|
const menu = document.querySelector(".lib-xplat-editor__slash-menu");
|
|
@@ -5635,8 +5665,8 @@ var SlashMenu = ({ position, items, activeIndex, onSelect, onClose }) => {
|
|
|
5635
5665
|
);
|
|
5636
5666
|
};
|
|
5637
5667
|
var LinkPopover = ({ position, value, onChange, onConfirm, onClose }) => {
|
|
5638
|
-
const inputRef =
|
|
5639
|
-
|
|
5668
|
+
const inputRef = import_react23.default.useRef(null);
|
|
5669
|
+
import_react23.default.useEffect(() => {
|
|
5640
5670
|
inputRef.current?.focus();
|
|
5641
5671
|
}, []);
|
|
5642
5672
|
return /* @__PURE__ */ (0, import_jsx_runtime323.jsxs)(
|
|
@@ -5694,7 +5724,7 @@ EmptyState.displayName = "EmptyState";
|
|
|
5694
5724
|
var EmptyState_default = EmptyState;
|
|
5695
5725
|
|
|
5696
5726
|
// src/components/FileUpload/FileUpload.tsx
|
|
5697
|
-
var
|
|
5727
|
+
var import_react24 = __toESM(require("react"), 1);
|
|
5698
5728
|
var import_jsx_runtime325 = require("react/jsx-runtime");
|
|
5699
5729
|
var FileUpload = (props) => {
|
|
5700
5730
|
const {
|
|
@@ -5708,9 +5738,9 @@ var FileUpload = (props) => {
|
|
|
5708
5738
|
label,
|
|
5709
5739
|
required
|
|
5710
5740
|
} = props;
|
|
5711
|
-
const fieldId =
|
|
5712
|
-
const [isDragOver, setIsDragOver] =
|
|
5713
|
-
const inputRef =
|
|
5741
|
+
const fieldId = import_react24.default.useId();
|
|
5742
|
+
const [isDragOver, setIsDragOver] = import_react24.default.useState(false);
|
|
5743
|
+
const inputRef = import_react24.default.useRef(null);
|
|
5714
5744
|
const handleFiles = (fileList) => {
|
|
5715
5745
|
let files = Array.from(fileList);
|
|
5716
5746
|
if (maxSize) {
|
|
@@ -5773,10 +5803,10 @@ FileUpload.displayName = "FileUpload";
|
|
|
5773
5803
|
var FileUpload_default = FileUpload;
|
|
5774
5804
|
|
|
5775
5805
|
// src/components/HtmlTypeWriter/HtmlTypeWriter.tsx
|
|
5776
|
-
var
|
|
5806
|
+
var import_react26 = __toESM(require("react"), 1);
|
|
5777
5807
|
|
|
5778
5808
|
// src/components/HtmlTypeWriter/utils.ts
|
|
5779
|
-
var
|
|
5809
|
+
var import_react25 = __toESM(require("react"), 1);
|
|
5780
5810
|
var voidTags = /* @__PURE__ */ new Set([
|
|
5781
5811
|
"br",
|
|
5782
5812
|
"img",
|
|
@@ -5844,15 +5874,15 @@ var convertNodeToReactWithRange = (node, typedLen, rangeMap) => {
|
|
|
5844
5874
|
props[attr.name] = attr.value;
|
|
5845
5875
|
});
|
|
5846
5876
|
if (voidTags.has(tag)) {
|
|
5847
|
-
return
|
|
5877
|
+
return import_react25.default.createElement(tag, props);
|
|
5848
5878
|
}
|
|
5849
5879
|
const children = Array.from(element.childNodes).map((child) => convertNodeToReactWithRange(child, typedLen, rangeMap)).filter((n) => n != null);
|
|
5850
|
-
return
|
|
5880
|
+
return import_react25.default.createElement(tag, props, ...children);
|
|
5851
5881
|
};
|
|
5852
5882
|
var htmlToReactProgressive = (root, typedLen, rangeMap) => {
|
|
5853
5883
|
const nodes = Array.from(root.childNodes).map((child, idx) => {
|
|
5854
5884
|
const node = convertNodeToReactWithRange(child, typedLen, rangeMap);
|
|
5855
|
-
return node == null ? null :
|
|
5885
|
+
return node == null ? null : import_react25.default.createElement(import_react25.default.Fragment, { key: idx }, node);
|
|
5856
5886
|
}).filter(Boolean);
|
|
5857
5887
|
return nodes.length === 0 ? null : nodes;
|
|
5858
5888
|
};
|
|
@@ -5865,20 +5895,20 @@ var HtmlTypeWriter = ({
|
|
|
5865
5895
|
onDone,
|
|
5866
5896
|
onChange
|
|
5867
5897
|
}) => {
|
|
5868
|
-
const [typedLen, setTypedLen] =
|
|
5869
|
-
const doneCalledRef =
|
|
5870
|
-
const { doc, rangeMap, totalLength } =
|
|
5898
|
+
const [typedLen, setTypedLen] = import_react26.default.useState(0);
|
|
5899
|
+
const doneCalledRef = import_react26.default.useRef(false);
|
|
5900
|
+
const { doc, rangeMap, totalLength } = import_react26.default.useMemo(() => {
|
|
5871
5901
|
if (typeof window === "undefined") return { doc: null, rangeMap: /* @__PURE__ */ new Map(), totalLength: 0 };
|
|
5872
5902
|
const decoded = decodeHtmlEntities(html);
|
|
5873
5903
|
const doc2 = new DOMParser().parseFromString(decoded, "text/html");
|
|
5874
5904
|
const { rangeMap: rangeMap2, totalLength: totalLength2 } = buildRangeMap(doc2.body);
|
|
5875
5905
|
return { doc: doc2, rangeMap: rangeMap2, totalLength: totalLength2 };
|
|
5876
5906
|
}, [html]);
|
|
5877
|
-
|
|
5907
|
+
import_react26.default.useEffect(() => {
|
|
5878
5908
|
setTypedLen(0);
|
|
5879
5909
|
doneCalledRef.current = false;
|
|
5880
5910
|
}, [html]);
|
|
5881
|
-
|
|
5911
|
+
import_react26.default.useEffect(() => {
|
|
5882
5912
|
if (!totalLength) return;
|
|
5883
5913
|
if (typedLen >= totalLength) return;
|
|
5884
5914
|
const timer = window.setInterval(() => {
|
|
@@ -5886,18 +5916,18 @@ var HtmlTypeWriter = ({
|
|
|
5886
5916
|
}, duration);
|
|
5887
5917
|
return () => window.clearInterval(timer);
|
|
5888
5918
|
}, [typedLen, totalLength, duration]);
|
|
5889
|
-
|
|
5919
|
+
import_react26.default.useEffect(() => {
|
|
5890
5920
|
if (typedLen > 0 && typedLen < totalLength) {
|
|
5891
5921
|
onChange?.();
|
|
5892
5922
|
}
|
|
5893
5923
|
}, [typedLen, totalLength, onChange]);
|
|
5894
|
-
|
|
5924
|
+
import_react26.default.useEffect(() => {
|
|
5895
5925
|
if (typedLen === totalLength && totalLength > 0 && !doneCalledRef.current) {
|
|
5896
5926
|
doneCalledRef.current = true;
|
|
5897
5927
|
onDone?.();
|
|
5898
5928
|
}
|
|
5899
5929
|
}, [typedLen, totalLength, onDone]);
|
|
5900
|
-
const parsed =
|
|
5930
|
+
const parsed = import_react26.default.useMemo(
|
|
5901
5931
|
() => doc ? htmlToReactProgressive(doc.body, typedLen, rangeMap) : null,
|
|
5902
5932
|
[doc, typedLen, rangeMap]
|
|
5903
5933
|
);
|
|
@@ -5907,13 +5937,13 @@ HtmlTypeWriter.displayName = "HtmlTypeWriter";
|
|
|
5907
5937
|
var HtmlTypeWriter_default = HtmlTypeWriter;
|
|
5908
5938
|
|
|
5909
5939
|
// src/components/ImageSelector/ImageSelector.tsx
|
|
5910
|
-
var
|
|
5940
|
+
var import_react27 = __toESM(require("react"), 1);
|
|
5911
5941
|
var import_jsx_runtime327 = require("react/jsx-runtime");
|
|
5912
5942
|
var ImageSelector = (props) => {
|
|
5913
5943
|
const { value, placeholder, onChange, validations, label, required } = props;
|
|
5914
|
-
const fieldId =
|
|
5915
|
-
const [previewUrl, setPreviewUrl] =
|
|
5916
|
-
|
|
5944
|
+
const fieldId = import_react27.default.useId();
|
|
5945
|
+
const [previewUrl, setPreviewUrl] = import_react27.default.useState();
|
|
5946
|
+
import_react27.default.useEffect(() => {
|
|
5917
5947
|
if (!value) {
|
|
5918
5948
|
setPreviewUrl(void 0);
|
|
5919
5949
|
return;
|
|
@@ -5922,7 +5952,7 @@ var ImageSelector = (props) => {
|
|
|
5922
5952
|
setPreviewUrl(url);
|
|
5923
5953
|
return () => URL.revokeObjectURL(url);
|
|
5924
5954
|
}, [value]);
|
|
5925
|
-
const inputRef =
|
|
5955
|
+
const inputRef = import_react27.default.useRef(null);
|
|
5926
5956
|
const handleFileChange = (e) => {
|
|
5927
5957
|
const selectedFile = e.target.files?.[0];
|
|
5928
5958
|
if (selectedFile) {
|
|
@@ -6105,22 +6135,23 @@ Pagination.displayName = "Pagination";
|
|
|
6105
6135
|
var Pagination_default = Pagination;
|
|
6106
6136
|
|
|
6107
6137
|
// src/components/PopOver/PopOver.tsx
|
|
6108
|
-
var
|
|
6138
|
+
var import_react28 = __toESM(require("react"), 1);
|
|
6109
6139
|
var import_jsx_runtime332 = require("react/jsx-runtime");
|
|
6110
6140
|
var PopOver = (props) => {
|
|
6111
6141
|
const { children, isOpen, onClose, PopOverEl } = props;
|
|
6112
|
-
const popRef =
|
|
6113
|
-
const triggerRef =
|
|
6114
|
-
const [localOpen, setLocalOpen] =
|
|
6115
|
-
const [eventTrigger, setEventTrigger] =
|
|
6142
|
+
const popRef = import_react28.default.useRef(null);
|
|
6143
|
+
const triggerRef = import_react28.default.useRef(null);
|
|
6144
|
+
const [localOpen, setLocalOpen] = import_react28.default.useState(false);
|
|
6145
|
+
const [eventTrigger, setEventTrigger] = import_react28.default.useState(false);
|
|
6116
6146
|
useClickOutside_default([popRef, triggerRef], onClose, isOpen);
|
|
6117
6147
|
useCloseWhenFocusHidden(isOpen, triggerRef, popRef, onClose);
|
|
6118
6148
|
useEscapeKey(isOpen, () => {
|
|
6119
6149
|
onClose();
|
|
6120
6150
|
triggerRef.current?.focus({ preventScroll: true });
|
|
6121
6151
|
});
|
|
6152
|
+
const host = useOverlayHost_default(triggerRef, localOpen);
|
|
6122
6153
|
useAutoPosition_default(triggerRef, popRef, localOpen);
|
|
6123
|
-
|
|
6154
|
+
import_react28.default.useEffect(() => {
|
|
6124
6155
|
if (isOpen) {
|
|
6125
6156
|
setLocalOpen(isOpen);
|
|
6126
6157
|
setTimeout(() => {
|
|
@@ -6143,7 +6174,7 @@ var PopOver = (props) => {
|
|
|
6143
6174
|
},
|
|
6144
6175
|
children: [
|
|
6145
6176
|
children,
|
|
6146
|
-
localOpen && /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(
|
|
6177
|
+
localOpen && /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(Portal_default, { container: host, children: /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(
|
|
6147
6178
|
"div",
|
|
6148
6179
|
{
|
|
6149
6180
|
className: clsx_default(
|
|
@@ -6201,12 +6232,12 @@ Progress.displayName = "Progress";
|
|
|
6201
6232
|
var Progress_default = Progress;
|
|
6202
6233
|
|
|
6203
6234
|
// src/components/Radio/RadioGroupContext.tsx
|
|
6204
|
-
var
|
|
6205
|
-
var RadioGroupContext =
|
|
6235
|
+
var import_react29 = __toESM(require("react"), 1);
|
|
6236
|
+
var RadioGroupContext = import_react29.default.createContext(
|
|
6206
6237
|
null
|
|
6207
6238
|
);
|
|
6208
6239
|
var useRadioGroupContext = () => {
|
|
6209
|
-
return
|
|
6240
|
+
return import_react29.default.useContext(RadioGroupContext);
|
|
6210
6241
|
};
|
|
6211
6242
|
var RadioGroupContext_default = RadioGroupContext;
|
|
6212
6243
|
|
|
@@ -6282,19 +6313,19 @@ RadioGroup.displayName = "RadioGroup";
|
|
|
6282
6313
|
var RadioGroup_default = RadioGroup;
|
|
6283
6314
|
|
|
6284
6315
|
// src/components/Select/Select.tsx
|
|
6285
|
-
var
|
|
6316
|
+
var import_react32 = __toESM(require("react"), 1);
|
|
6286
6317
|
|
|
6287
6318
|
// src/components/Select/context.ts
|
|
6288
|
-
var
|
|
6289
|
-
var SelectContext =
|
|
6319
|
+
var import_react30 = __toESM(require("react"), 1);
|
|
6320
|
+
var SelectContext = import_react30.default.createContext(null);
|
|
6290
6321
|
var context_default = SelectContext;
|
|
6291
6322
|
|
|
6292
6323
|
// src/components/Select/SelectItem.tsx
|
|
6293
|
-
var
|
|
6324
|
+
var import_react31 = __toESM(require("react"), 1);
|
|
6294
6325
|
var import_jsx_runtime336 = require("react/jsx-runtime");
|
|
6295
6326
|
var SelectItem = (props) => {
|
|
6296
6327
|
const { children, value, onClick, disabled = false } = props;
|
|
6297
|
-
const ctx =
|
|
6328
|
+
const ctx = import_react31.default.useContext(context_default);
|
|
6298
6329
|
const handleClick = (e) => {
|
|
6299
6330
|
e.preventDefault();
|
|
6300
6331
|
e.stopPropagation();
|
|
@@ -6344,29 +6375,29 @@ var SelectRoot = (props) => {
|
|
|
6344
6375
|
required,
|
|
6345
6376
|
size = "md"
|
|
6346
6377
|
} = props;
|
|
6347
|
-
const fieldId =
|
|
6348
|
-
const itemChildren =
|
|
6349
|
-
(child) =>
|
|
6378
|
+
const fieldId = import_react32.default.useId();
|
|
6379
|
+
const itemChildren = import_react32.default.Children.toArray(children).filter(
|
|
6380
|
+
(child) => import_react32.default.isValidElement(child) && child.type === SelectItem_default
|
|
6350
6381
|
);
|
|
6351
6382
|
const isControlled = valueProp !== void 0;
|
|
6352
|
-
const [isOpen, setOpen] =
|
|
6353
|
-
const [uncontrolledLabel, setUncontrolledLabel] =
|
|
6354
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
6355
|
-
const controlledLabel =
|
|
6383
|
+
const [isOpen, setOpen] = import_react32.default.useState(false);
|
|
6384
|
+
const [uncontrolledLabel, setUncontrolledLabel] = import_react32.default.useState(null);
|
|
6385
|
+
const [uncontrolledValue, setUncontrolledValue] = import_react32.default.useState(void 0);
|
|
6386
|
+
const controlledLabel = import_react32.default.useMemo(() => {
|
|
6356
6387
|
if (!isControlled) return null;
|
|
6357
6388
|
const match = itemChildren.find((child) => child.props.value === valueProp);
|
|
6358
6389
|
return match ? match.props.children : null;
|
|
6359
6390
|
}, [isControlled, valueProp, itemChildren]);
|
|
6360
6391
|
const selectedLabel = isControlled ? controlledLabel : uncontrolledLabel;
|
|
6361
6392
|
const selectedValue = isControlled ? valueProp : uncontrolledValue;
|
|
6362
|
-
const triggerRef =
|
|
6363
|
-
const contentRef =
|
|
6364
|
-
const [mounted, setMounted] =
|
|
6365
|
-
const [visible, setVisible] =
|
|
6366
|
-
|
|
6393
|
+
const triggerRef = import_react32.default.useRef(null);
|
|
6394
|
+
const contentRef = import_react32.default.useRef(null);
|
|
6395
|
+
const [mounted, setMounted] = import_react32.default.useState(false);
|
|
6396
|
+
const [visible, setVisible] = import_react32.default.useState(false);
|
|
6397
|
+
import_react32.default.useEffect(() => {
|
|
6367
6398
|
if (disabled && isOpen) setOpen(false);
|
|
6368
6399
|
}, [disabled, isOpen]);
|
|
6369
|
-
|
|
6400
|
+
import_react32.default.useEffect(() => {
|
|
6370
6401
|
if (isOpen) {
|
|
6371
6402
|
setMounted(true);
|
|
6372
6403
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -6376,33 +6407,34 @@ var SelectRoot = (props) => {
|
|
|
6376
6407
|
const t = setTimeout(() => setMounted(false), ANIMATION_DURATION_MS3);
|
|
6377
6408
|
return () => clearTimeout(t);
|
|
6378
6409
|
}, [isOpen]);
|
|
6379
|
-
const [query, setQuery] =
|
|
6410
|
+
const [query, setQuery] = import_react32.default.useState("");
|
|
6380
6411
|
const textOf = (node) => {
|
|
6381
6412
|
if (node === null || node === void 0 || typeof node === "boolean") return "";
|
|
6382
6413
|
if (typeof node === "string" || typeof node === "number") return String(node);
|
|
6383
6414
|
if (Array.isArray(node)) return node.map(textOf).join("");
|
|
6384
|
-
if (
|
|
6415
|
+
if (import_react32.default.isValidElement(node)) return textOf(node.props.children);
|
|
6385
6416
|
return "";
|
|
6386
6417
|
};
|
|
6387
|
-
const visibleItems =
|
|
6418
|
+
const visibleItems = import_react32.default.useMemo(() => {
|
|
6388
6419
|
if (!searchable || !query.trim()) return itemChildren;
|
|
6389
6420
|
const q = query.trim().toLowerCase();
|
|
6390
6421
|
return itemChildren.filter((c) => textOf(c.props.children).toLowerCase().includes(q));
|
|
6391
6422
|
}, [searchable, query, itemChildren]);
|
|
6392
|
-
const open =
|
|
6393
|
-
const close =
|
|
6423
|
+
const open = import_react32.default.useCallback(() => setOpen(true), []);
|
|
6424
|
+
const close = import_react32.default.useCallback(() => {
|
|
6394
6425
|
setOpen(false);
|
|
6395
6426
|
setQuery("");
|
|
6396
6427
|
}, []);
|
|
6397
|
-
const toggle =
|
|
6428
|
+
const toggle = import_react32.default.useCallback(() => setOpen((prev) => !prev), []);
|
|
6398
6429
|
useClickOutside_default([contentRef, triggerRef], close, isOpen);
|
|
6399
6430
|
useCloseWhenFocusHidden(isOpen, triggerRef, contentRef, close);
|
|
6400
6431
|
useEscapeKey(isOpen, () => {
|
|
6401
6432
|
close();
|
|
6402
6433
|
triggerRef.current?.focus({ preventScroll: true });
|
|
6403
6434
|
});
|
|
6435
|
+
const host = useOverlayHost_default(triggerRef, mounted);
|
|
6404
6436
|
useAutoPosition_default(triggerRef, contentRef, mounted);
|
|
6405
|
-
const setSelected =
|
|
6437
|
+
const setSelected = import_react32.default.useCallback(
|
|
6406
6438
|
(label2, itemValue) => {
|
|
6407
6439
|
if (!isControlled) {
|
|
6408
6440
|
setUncontrolledLabel(label2);
|
|
@@ -6412,7 +6444,7 @@ var SelectRoot = (props) => {
|
|
|
6412
6444
|
},
|
|
6413
6445
|
[isControlled, onChange]
|
|
6414
6446
|
);
|
|
6415
|
-
const ctxValue =
|
|
6447
|
+
const ctxValue = import_react32.default.useMemo(
|
|
6416
6448
|
() => ({
|
|
6417
6449
|
isOpen,
|
|
6418
6450
|
mounted,
|
|
@@ -6491,7 +6523,7 @@ var SelectRoot = (props) => {
|
|
|
6491
6523
|
]
|
|
6492
6524
|
}
|
|
6493
6525
|
),
|
|
6494
|
-
mounted && /* @__PURE__ */ (0, import_jsx_runtime337.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime337.jsxs)(
|
|
6526
|
+
mounted && /* @__PURE__ */ (0, import_jsx_runtime337.jsx)(Portal_default, { container: host, children: /* @__PURE__ */ (0, import_jsx_runtime337.jsxs)(
|
|
6495
6527
|
"div",
|
|
6496
6528
|
{
|
|
6497
6529
|
className: clsx_default("lib-xplat-select-content", size, stateClass),
|
|
@@ -6657,7 +6689,7 @@ Steps.displayName = "Steps";
|
|
|
6657
6689
|
var Steps_default = Steps;
|
|
6658
6690
|
|
|
6659
6691
|
// src/components/Swiper/Swiper.tsx
|
|
6660
|
-
var
|
|
6692
|
+
var import_react33 = __toESM(require("react"), 1);
|
|
6661
6693
|
var import_jsx_runtime342 = require("react/jsx-runtime");
|
|
6662
6694
|
var Swiper = (props) => {
|
|
6663
6695
|
const {
|
|
@@ -6682,26 +6714,26 @@ var Swiper = (props) => {
|
|
|
6682
6714
|
const maxIndex = Math.max(0, totalSlides - viewItemCount);
|
|
6683
6715
|
const useLoop = loop && canSlide;
|
|
6684
6716
|
const cloneCount = useLoop ? totalSlides : 0;
|
|
6685
|
-
const extendedItems =
|
|
6717
|
+
const extendedItems = import_react33.default.useMemo(() => {
|
|
6686
6718
|
if (!useLoop) return items;
|
|
6687
6719
|
return [...items, ...items, ...items];
|
|
6688
6720
|
}, [items, useLoop]);
|
|
6689
6721
|
const initialIdx = Math.max(0, Math.min(indexProp ?? 0, maxIndex));
|
|
6690
|
-
const [innerIndex, setInnerIndex] =
|
|
6722
|
+
const [innerIndex, setInnerIndex] = import_react33.default.useState(
|
|
6691
6723
|
useLoop ? cloneCount + initialIdx : initialIdx
|
|
6692
6724
|
);
|
|
6693
|
-
const [isDragging, setIsDragging] =
|
|
6694
|
-
const [dragOffset, setDragOffset] =
|
|
6695
|
-
const [animated, setAnimated] =
|
|
6696
|
-
const [containerWidth, setContainerWidth] =
|
|
6697
|
-
const containerRef =
|
|
6698
|
-
const startXRef =
|
|
6699
|
-
const startTimeRef =
|
|
6700
|
-
const autoplayTimerRef =
|
|
6701
|
-
const resumeTimeoutRef =
|
|
6702
|
-
const [paused, setPaused] =
|
|
6703
|
-
const initializedRef =
|
|
6704
|
-
|
|
6725
|
+
const [isDragging, setIsDragging] = import_react33.default.useState(false);
|
|
6726
|
+
const [dragOffset, setDragOffset] = import_react33.default.useState(0);
|
|
6727
|
+
const [animated, setAnimated] = import_react33.default.useState(false);
|
|
6728
|
+
const [containerWidth, setContainerWidth] = import_react33.default.useState(0);
|
|
6729
|
+
const containerRef = import_react33.default.useRef(null);
|
|
6730
|
+
const startXRef = import_react33.default.useRef(0);
|
|
6731
|
+
const startTimeRef = import_react33.default.useRef(0);
|
|
6732
|
+
const autoplayTimerRef = import_react33.default.useRef(null);
|
|
6733
|
+
const resumeTimeoutRef = import_react33.default.useRef(null);
|
|
6734
|
+
const [paused, setPaused] = import_react33.default.useState(false);
|
|
6735
|
+
const initializedRef = import_react33.default.useRef(false);
|
|
6736
|
+
import_react33.default.useEffect(() => {
|
|
6705
6737
|
const el = containerRef.current;
|
|
6706
6738
|
if (!el) return;
|
|
6707
6739
|
const ro = new ResizeObserver((entries) => {
|
|
@@ -6724,7 +6756,7 @@ var Swiper = (props) => {
|
|
|
6724
6756
|
return ((inner - cloneCount) % totalSlides + totalSlides) % totalSlides;
|
|
6725
6757
|
};
|
|
6726
6758
|
const realIndex = getRealIndex(innerIndex);
|
|
6727
|
-
const moveToInner =
|
|
6759
|
+
const moveToInner = import_react33.default.useCallback(
|
|
6728
6760
|
(idx, withAnim = true) => {
|
|
6729
6761
|
if (!useLoop) {
|
|
6730
6762
|
setAnimated(withAnim);
|
|
@@ -6752,7 +6784,7 @@ var Swiper = (props) => {
|
|
|
6752
6784
|
},
|
|
6753
6785
|
[useLoop, cloneCount, totalSlides]
|
|
6754
6786
|
);
|
|
6755
|
-
const handleTransitionEnd =
|
|
6787
|
+
const handleTransitionEnd = import_react33.default.useCallback(() => {
|
|
6756
6788
|
if (!useLoop) return;
|
|
6757
6789
|
const real = getRealIndex(innerIndex);
|
|
6758
6790
|
const canonical = cloneCount + real;
|
|
@@ -6762,7 +6794,7 @@ var Swiper = (props) => {
|
|
|
6762
6794
|
}
|
|
6763
6795
|
onChange?.(Math.min(real, maxIndex));
|
|
6764
6796
|
}, [useLoop, innerIndex, cloneCount, totalSlides, maxIndex, onChange]);
|
|
6765
|
-
const slideTo =
|
|
6797
|
+
const slideTo = import_react33.default.useCallback(
|
|
6766
6798
|
(logicalIndex) => {
|
|
6767
6799
|
if (!canSlide) return;
|
|
6768
6800
|
const clamped = useLoop ? logicalIndex : Math.max(0, Math.min(logicalIndex, maxIndex));
|
|
@@ -6772,7 +6804,7 @@ var Swiper = (props) => {
|
|
|
6772
6804
|
},
|
|
6773
6805
|
[canSlide, useLoop, cloneCount, maxIndex, onChange, moveToInner]
|
|
6774
6806
|
);
|
|
6775
|
-
const slideNext =
|
|
6807
|
+
const slideNext = import_react33.default.useCallback(() => {
|
|
6776
6808
|
if (!canSlide) return;
|
|
6777
6809
|
const nextInner = innerIndex + slideBy;
|
|
6778
6810
|
if (useLoop) {
|
|
@@ -6781,7 +6813,7 @@ var Swiper = (props) => {
|
|
|
6781
6813
|
moveToInner(Math.min(nextInner, maxIndex), true);
|
|
6782
6814
|
}
|
|
6783
6815
|
}, [canSlide, useLoop, innerIndex, slideBy, maxIndex, moveToInner]);
|
|
6784
|
-
const slidePrev =
|
|
6816
|
+
const slidePrev = import_react33.default.useCallback(() => {
|
|
6785
6817
|
if (!canSlide) return;
|
|
6786
6818
|
const prevInner = innerIndex - slideBy;
|
|
6787
6819
|
if (useLoop) {
|
|
@@ -6790,7 +6822,7 @@ var Swiper = (props) => {
|
|
|
6790
6822
|
moveToInner(Math.max(prevInner, 0), true);
|
|
6791
6823
|
}
|
|
6792
6824
|
}, [canSlide, useLoop, innerIndex, slideBy, moveToInner]);
|
|
6793
|
-
|
|
6825
|
+
import_react33.default.useEffect(() => {
|
|
6794
6826
|
if (indexProp === void 0) return;
|
|
6795
6827
|
const clamped = Math.max(0, Math.min(indexProp, maxIndex));
|
|
6796
6828
|
const target = useLoop ? cloneCount + clamped : clamped;
|
|
@@ -6798,12 +6830,12 @@ var Swiper = (props) => {
|
|
|
6798
6830
|
moveToInner(target, true);
|
|
6799
6831
|
}
|
|
6800
6832
|
}, [indexProp]);
|
|
6801
|
-
|
|
6833
|
+
import_react33.default.useImperativeHandle(swiperRef, () => ({
|
|
6802
6834
|
slidePrev,
|
|
6803
6835
|
slideNext,
|
|
6804
6836
|
slideTo
|
|
6805
6837
|
}));
|
|
6806
|
-
|
|
6838
|
+
import_react33.default.useEffect(() => {
|
|
6807
6839
|
if (!auto || !canSlide || paused) return;
|
|
6808
6840
|
autoplayTimerRef.current = setInterval(slideNext, autoplayDelay);
|
|
6809
6841
|
return () => {
|
|
@@ -6829,7 +6861,7 @@ var Swiper = (props) => {
|
|
|
6829
6861
|
resumeTimeoutRef.current = null;
|
|
6830
6862
|
}, pauseOnInteraction);
|
|
6831
6863
|
};
|
|
6832
|
-
|
|
6864
|
+
import_react33.default.useEffect(() => {
|
|
6833
6865
|
return () => {
|
|
6834
6866
|
if (resumeTimeoutRef.current) clearTimeout(resumeTimeoutRef.current);
|
|
6835
6867
|
};
|
|
@@ -6847,7 +6879,7 @@ var Swiper = (props) => {
|
|
|
6847
6879
|
startXRef.current = getClientX(e);
|
|
6848
6880
|
startTimeRef.current = Date.now();
|
|
6849
6881
|
};
|
|
6850
|
-
|
|
6882
|
+
import_react33.default.useEffect(() => {
|
|
6851
6883
|
if (!isDragging) return;
|
|
6852
6884
|
const handleMove = (e) => {
|
|
6853
6885
|
setDragOffset(getClientX(e) - startXRef.current);
|
|
@@ -6886,7 +6918,7 @@ var Swiper = (props) => {
|
|
|
6886
6918
|
}, [isDragging, dragOffset, innerIndex, useLoop, maxIndex, slideStep, moveToInner]);
|
|
6887
6919
|
const slideWidthPercent = 100 / viewItemCount;
|
|
6888
6920
|
const gapAdjust = spaceBetween * (viewItemCount - 1) / viewItemCount;
|
|
6889
|
-
const slideElements =
|
|
6921
|
+
const slideElements = import_react33.default.useMemo(
|
|
6890
6922
|
() => extendedItems.map((item, idx) => /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(
|
|
6891
6923
|
"div",
|
|
6892
6924
|
{
|
|
@@ -6960,7 +6992,7 @@ Swiper.displayName = "Swiper";
|
|
|
6960
6992
|
var Swiper_default = Swiper;
|
|
6961
6993
|
|
|
6962
6994
|
// src/components/Switch/Switch.tsx
|
|
6963
|
-
var
|
|
6995
|
+
var import_react34 = __toESM(require("react"), 1);
|
|
6964
6996
|
var import_jsx_runtime343 = require("react/jsx-runtime");
|
|
6965
6997
|
var KNOB_TRANSITION_MS = 250;
|
|
6966
6998
|
var Switch = (props) => {
|
|
@@ -6974,11 +7006,11 @@ var Switch = (props) => {
|
|
|
6974
7006
|
label,
|
|
6975
7007
|
required
|
|
6976
7008
|
} = props;
|
|
6977
|
-
const fieldId =
|
|
7009
|
+
const fieldId = import_react34.default.useId();
|
|
6978
7010
|
const statusType = normalizeStatus(type);
|
|
6979
|
-
const [isAnimating, setIsAnimating] =
|
|
6980
|
-
const timeoutRef =
|
|
6981
|
-
|
|
7011
|
+
const [isAnimating, setIsAnimating] = import_react34.default.useState(false);
|
|
7012
|
+
const timeoutRef = import_react34.default.useRef(null);
|
|
7013
|
+
import_react34.default.useEffect(() => {
|
|
6982
7014
|
return () => {
|
|
6983
7015
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
6984
7016
|
};
|
|
@@ -7017,10 +7049,10 @@ Switch.displayName = "Switch";
|
|
|
7017
7049
|
var Switch_default = Switch;
|
|
7018
7050
|
|
|
7019
7051
|
// src/components/Table/TableContext.tsx
|
|
7020
|
-
var
|
|
7021
|
-
var TableContext =
|
|
7052
|
+
var import_react35 = __toESM(require("react"), 1);
|
|
7053
|
+
var TableContext = import_react35.default.createContext(null);
|
|
7022
7054
|
var useTableContext = () => {
|
|
7023
|
-
const ctx =
|
|
7055
|
+
const ctx = import_react35.default.useContext(TableContext);
|
|
7024
7056
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
7025
7057
|
return ctx;
|
|
7026
7058
|
};
|
|
@@ -7037,18 +7069,25 @@ var Table = (props) => {
|
|
|
7037
7069
|
headerSticky = false,
|
|
7038
7070
|
stickyShadow = true
|
|
7039
7071
|
} = props;
|
|
7040
|
-
return /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
7041
|
-
|
|
7072
|
+
return /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
7073
|
+
"div",
|
|
7042
7074
|
{
|
|
7043
|
-
|
|
7044
|
-
|
|
7045
|
-
|
|
7046
|
-
|
|
7047
|
-
|
|
7048
|
-
|
|
7049
|
-
|
|
7075
|
+
className: `lib-xplat-table-wrapper ${size}`,
|
|
7076
|
+
"data-xplat-overlay-escape": "",
|
|
7077
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
7078
|
+
TableContext_default.Provider,
|
|
7079
|
+
{
|
|
7080
|
+
value: {
|
|
7081
|
+
rowBorderUse,
|
|
7082
|
+
colBorderUse,
|
|
7083
|
+
headerSticky,
|
|
7084
|
+
stickyShadow
|
|
7085
|
+
},
|
|
7086
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)("table", { className: "lib-xplat-table", children })
|
|
7087
|
+
}
|
|
7088
|
+
)
|
|
7050
7089
|
}
|
|
7051
|
-
)
|
|
7090
|
+
);
|
|
7052
7091
|
};
|
|
7053
7092
|
Table.displayName = "Table";
|
|
7054
7093
|
var Table_default = Table;
|
|
@@ -7063,24 +7102,24 @@ TableBody.displayName = "TableBody";
|
|
|
7063
7102
|
var TableBody_default = TableBody;
|
|
7064
7103
|
|
|
7065
7104
|
// src/components/Table/TableCell.tsx
|
|
7066
|
-
var
|
|
7105
|
+
var import_react38 = __toESM(require("react"), 1);
|
|
7067
7106
|
|
|
7068
7107
|
// src/components/Table/TableHeadContext.tsx
|
|
7069
|
-
var
|
|
7070
|
-
var TableHeadContext =
|
|
7108
|
+
var import_react36 = __toESM(require("react"), 1);
|
|
7109
|
+
var TableHeadContext = import_react36.default.createContext(
|
|
7071
7110
|
null
|
|
7072
7111
|
);
|
|
7073
7112
|
var useTableHeadContext = () => {
|
|
7074
|
-
const ctx =
|
|
7113
|
+
const ctx = import_react36.default.useContext(TableHeadContext);
|
|
7075
7114
|
return ctx;
|
|
7076
7115
|
};
|
|
7077
7116
|
var TableHeadContext_default = TableHeadContext;
|
|
7078
7117
|
|
|
7079
7118
|
// src/components/Table/TableRowContext.tsx
|
|
7080
|
-
var
|
|
7081
|
-
var TableRowContext =
|
|
7119
|
+
var import_react37 = __toESM(require("react"), 1);
|
|
7120
|
+
var TableRowContext = import_react37.default.createContext(null);
|
|
7082
7121
|
var useTableRowContext = () => {
|
|
7083
|
-
const ctx =
|
|
7122
|
+
const ctx = import_react37.default.useContext(TableRowContext);
|
|
7084
7123
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
7085
7124
|
return ctx;
|
|
7086
7125
|
};
|
|
@@ -7088,7 +7127,7 @@ var TableRowContext_default = TableRowContext;
|
|
|
7088
7127
|
|
|
7089
7128
|
// src/components/Table/TableCell.tsx
|
|
7090
7129
|
var import_jsx_runtime346 = require("react/jsx-runtime");
|
|
7091
|
-
var TableCell =
|
|
7130
|
+
var TableCell = import_react38.default.memo((props) => {
|
|
7092
7131
|
const {
|
|
7093
7132
|
children,
|
|
7094
7133
|
align = "center",
|
|
@@ -7102,9 +7141,9 @@ var TableCell = import_react37.default.memo((props) => {
|
|
|
7102
7141
|
const { registerStickyCell, stickyCells } = useTableRowContext();
|
|
7103
7142
|
const { stickyShadow } = useTableContext();
|
|
7104
7143
|
const headContext = useTableHeadContext();
|
|
7105
|
-
const [left, setLeft] =
|
|
7106
|
-
const cellRef =
|
|
7107
|
-
const calculateLeft =
|
|
7144
|
+
const [left, setLeft] = import_react38.default.useState(0);
|
|
7145
|
+
const cellRef = import_react38.default.useRef(null);
|
|
7146
|
+
const calculateLeft = import_react38.default.useCallback(() => {
|
|
7108
7147
|
if (!cellRef.current) return 0;
|
|
7109
7148
|
let totalLeft = 0;
|
|
7110
7149
|
for (const ref of stickyCells) {
|
|
@@ -7113,7 +7152,7 @@ var TableCell = import_react37.default.memo((props) => {
|
|
|
7113
7152
|
}
|
|
7114
7153
|
return totalLeft;
|
|
7115
7154
|
}, [stickyCells]);
|
|
7116
|
-
|
|
7155
|
+
import_react38.default.useEffect(() => {
|
|
7117
7156
|
if (!isSticky || !cellRef.current) return;
|
|
7118
7157
|
registerStickyCell(cellRef);
|
|
7119
7158
|
setLeft(calculateLeft());
|
|
@@ -7171,9 +7210,9 @@ TableHead.displayName = "TableHead";
|
|
|
7171
7210
|
var TableHead_default = TableHead;
|
|
7172
7211
|
|
|
7173
7212
|
// src/components/Table/TableRow.tsx
|
|
7174
|
-
var
|
|
7213
|
+
var import_react39 = __toESM(require("react"), 1);
|
|
7175
7214
|
var import_jsx_runtime348 = require("react/jsx-runtime");
|
|
7176
|
-
var TableRow =
|
|
7215
|
+
var TableRow = import_react39.default.memo((props) => {
|
|
7177
7216
|
const {
|
|
7178
7217
|
children,
|
|
7179
7218
|
type = "secondary",
|
|
@@ -7182,7 +7221,7 @@ var TableRow = import_react38.default.memo((props) => {
|
|
|
7182
7221
|
onClick
|
|
7183
7222
|
} = props;
|
|
7184
7223
|
const { rowBorderUse } = useTableContext();
|
|
7185
|
-
const [stickyCells, setStickyCells] =
|
|
7224
|
+
const [stickyCells, setStickyCells] = import_react39.default.useState([]);
|
|
7186
7225
|
const registerStickyCell = (ref) => {
|
|
7187
7226
|
setStickyCells((prev) => {
|
|
7188
7227
|
if (prev.includes(ref)) return prev;
|
|
@@ -7246,9 +7285,9 @@ Tag.displayName = "Tag";
|
|
|
7246
7285
|
var Tag_default = Tag;
|
|
7247
7286
|
|
|
7248
7287
|
// src/components/TextArea/TextArea.tsx
|
|
7249
|
-
var
|
|
7288
|
+
var import_react40 = __toESM(require("react"), 1);
|
|
7250
7289
|
var import_jsx_runtime350 = require("react/jsx-runtime");
|
|
7251
|
-
var TextArea =
|
|
7290
|
+
var TextArea = import_react40.default.forwardRef(
|
|
7252
7291
|
(props, ref) => {
|
|
7253
7292
|
const {
|
|
7254
7293
|
className,
|
|
@@ -7261,7 +7300,7 @@ var TextArea = import_react39.default.forwardRef(
|
|
|
7261
7300
|
disabled,
|
|
7262
7301
|
...textareaProps
|
|
7263
7302
|
} = props;
|
|
7264
|
-
const autoId =
|
|
7303
|
+
const autoId = import_react40.default.useId();
|
|
7265
7304
|
const fieldId = props.id ?? autoId;
|
|
7266
7305
|
const control = /* @__PURE__ */ (0, import_jsx_runtime350.jsx)("div", { className: clsx_default("lib-xplat-textarea-wrap", className), children: /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
|
|
7267
7306
|
"textarea",
|
|
@@ -7283,7 +7322,7 @@ TextArea.displayName = "TextArea";
|
|
|
7283
7322
|
var TextArea_default = TextArea;
|
|
7284
7323
|
|
|
7285
7324
|
// src/components/TimePicker/TimePicker.tsx
|
|
7286
|
-
var
|
|
7325
|
+
var import_react41 = __toESM(require("react"), 1);
|
|
7287
7326
|
var import_jsx_runtime351 = require("react/jsx-runtime");
|
|
7288
7327
|
var ANIMATION_DURATION_MS4 = 200;
|
|
7289
7328
|
var toMinutes = (hhmm) => {
|
|
@@ -7321,13 +7360,13 @@ var TimePicker = (props) => {
|
|
|
7321
7360
|
required,
|
|
7322
7361
|
validations
|
|
7323
7362
|
} = props;
|
|
7324
|
-
const fieldId =
|
|
7325
|
-
const triggerRef =
|
|
7326
|
-
const contentRef =
|
|
7327
|
-
const [isOpen, setOpen] =
|
|
7328
|
-
const [mounted, setMounted] =
|
|
7329
|
-
const [visible, setVisible] =
|
|
7330
|
-
const options =
|
|
7363
|
+
const fieldId = import_react41.default.useId();
|
|
7364
|
+
const triggerRef = import_react41.default.useRef(null);
|
|
7365
|
+
const contentRef = import_react41.default.useRef(null);
|
|
7366
|
+
const [isOpen, setOpen] = import_react41.default.useState(false);
|
|
7367
|
+
const [mounted, setMounted] = import_react41.default.useState(false);
|
|
7368
|
+
const [visible, setVisible] = import_react41.default.useState(false);
|
|
7369
|
+
const options = import_react41.default.useMemo(() => {
|
|
7331
7370
|
const safeStep = step > 0 && step <= 720 ? step : 30;
|
|
7332
7371
|
const lo = toMinutes(min) ?? 0;
|
|
7333
7372
|
const hi = toMinutes(max) ?? 24 * 60 - 1;
|
|
@@ -7335,18 +7374,19 @@ var TimePicker = (props) => {
|
|
|
7335
7374
|
for (let t = lo; t <= hi; t += safeStep) out.push(toHHmm(t));
|
|
7336
7375
|
return out;
|
|
7337
7376
|
}, [step, min, max]);
|
|
7338
|
-
const close =
|
|
7377
|
+
const close = import_react41.default.useCallback(() => setOpen(false), []);
|
|
7339
7378
|
useClickOutside_default([triggerRef, contentRef], close, isOpen);
|
|
7340
7379
|
useCloseWhenFocusHidden(isOpen, triggerRef, contentRef, close);
|
|
7341
7380
|
useEscapeKey(isOpen, () => {
|
|
7342
7381
|
close();
|
|
7343
7382
|
triggerRef.current?.focus({ preventScroll: true });
|
|
7344
7383
|
});
|
|
7384
|
+
const host = useOverlayHost_default(triggerRef, mounted);
|
|
7345
7385
|
useAutoPosition_default(triggerRef, contentRef, mounted);
|
|
7346
|
-
|
|
7386
|
+
import_react41.default.useEffect(() => {
|
|
7347
7387
|
if (disabled && isOpen) setOpen(false);
|
|
7348
7388
|
}, [disabled, isOpen]);
|
|
7349
|
-
|
|
7389
|
+
import_react41.default.useEffect(() => {
|
|
7350
7390
|
if (isOpen) {
|
|
7351
7391
|
setMounted(true);
|
|
7352
7392
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -7384,7 +7424,7 @@ var TimePicker = (props) => {
|
|
|
7384
7424
|
children: /* @__PURE__ */ (0, import_jsx_runtime351.jsx)("span", { className: clsx_default("time-picker-value", !value && "placeholder"), children: value ? display(value, use12Hours) : placeholder })
|
|
7385
7425
|
}
|
|
7386
7426
|
),
|
|
7387
|
-
mounted && /* @__PURE__ */ (0, import_jsx_runtime351.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime351.jsx)(
|
|
7427
|
+
mounted && /* @__PURE__ */ (0, import_jsx_runtime351.jsx)(Portal_default, { container: host, children: /* @__PURE__ */ (0, import_jsx_runtime351.jsx)(
|
|
7388
7428
|
"div",
|
|
7389
7429
|
{
|
|
7390
7430
|
ref: contentRef,
|
|
@@ -7418,20 +7458,20 @@ TimePicker.displayName = "TimePicker";
|
|
|
7418
7458
|
var TimePicker_default = TimePicker;
|
|
7419
7459
|
|
|
7420
7460
|
// src/components/Toast/Toast.tsx
|
|
7421
|
-
var
|
|
7461
|
+
var import_react42 = __toESM(require("react"), 1);
|
|
7422
7462
|
var import_react_dom4 = require("react-dom");
|
|
7423
7463
|
var import_jsx_runtime352 = require("react/jsx-runtime");
|
|
7424
|
-
var ToastContext =
|
|
7464
|
+
var ToastContext = import_react42.default.createContext(null);
|
|
7425
7465
|
var useToast = () => {
|
|
7426
|
-
const ctx =
|
|
7466
|
+
const ctx = import_react42.default.useContext(ToastContext);
|
|
7427
7467
|
if (!ctx) throw new Error("useToast must be used within ToastProvider");
|
|
7428
7468
|
return ctx;
|
|
7429
7469
|
};
|
|
7430
7470
|
var EXIT_DURATION = 300;
|
|
7431
7471
|
var ToastItemComponent = ({ item, isExiting, onClose }) => {
|
|
7432
|
-
const ref =
|
|
7433
|
-
const [height, setHeight] =
|
|
7434
|
-
|
|
7472
|
+
const ref = import_react42.default.useRef(null);
|
|
7473
|
+
const [height, setHeight] = import_react42.default.useState(void 0);
|
|
7474
|
+
import_react42.default.useEffect(() => {
|
|
7435
7475
|
if (ref.current && !isExiting) {
|
|
7436
7476
|
setHeight(ref.current.offsetHeight);
|
|
7437
7477
|
}
|
|
@@ -7463,13 +7503,13 @@ var ToastProvider = ({
|
|
|
7463
7503
|
children,
|
|
7464
7504
|
position = "top-right"
|
|
7465
7505
|
}) => {
|
|
7466
|
-
const [toasts, setToasts] =
|
|
7467
|
-
const [removing, setRemoving] =
|
|
7468
|
-
const [mounted, setMounted] =
|
|
7469
|
-
|
|
7506
|
+
const [toasts, setToasts] = import_react42.default.useState([]);
|
|
7507
|
+
const [removing, setRemoving] = import_react42.default.useState(/* @__PURE__ */ new Set());
|
|
7508
|
+
const [mounted, setMounted] = import_react42.default.useState(false);
|
|
7509
|
+
import_react42.default.useEffect(() => {
|
|
7470
7510
|
setMounted(true);
|
|
7471
7511
|
}, []);
|
|
7472
|
-
const remove =
|
|
7512
|
+
const remove = import_react42.default.useCallback((id) => {
|
|
7473
7513
|
setRemoving((prev) => new Set(prev).add(id));
|
|
7474
7514
|
setTimeout(() => {
|
|
7475
7515
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
@@ -7480,7 +7520,7 @@ var ToastProvider = ({
|
|
|
7480
7520
|
});
|
|
7481
7521
|
}, EXIT_DURATION);
|
|
7482
7522
|
}, []);
|
|
7483
|
-
const toast =
|
|
7523
|
+
const toast = import_react42.default.useCallback(
|
|
7484
7524
|
(type, message, duration = 3e3) => {
|
|
7485
7525
|
const id = `${Date.now()}-${Math.random()}`;
|
|
7486
7526
|
setToasts((prev) => [...prev, { id, type, message }]);
|
|
@@ -7533,7 +7573,7 @@ ToggleChip.displayName = "ToggleChip";
|
|
|
7533
7573
|
var ToggleChip_default = ToggleChip;
|
|
7534
7574
|
|
|
7535
7575
|
// src/components/Tooltip/Tooltip.tsx
|
|
7536
|
-
var
|
|
7576
|
+
var import_react43 = __toESM(require("react"), 1);
|
|
7537
7577
|
var import_jsx_runtime354 = require("react/jsx-runtime");
|
|
7538
7578
|
var OFFSET = 12;
|
|
7539
7579
|
var GAP = 8;
|
|
@@ -7549,14 +7589,14 @@ var Tooltip = (props) => {
|
|
|
7549
7589
|
disabled = false
|
|
7550
7590
|
} = props;
|
|
7551
7591
|
const shape = variant ?? type ?? "dark";
|
|
7552
|
-
const triggerRef =
|
|
7553
|
-
const tooltipRef =
|
|
7554
|
-
const [visible, setVisible] =
|
|
7555
|
-
const [pos, setPos] =
|
|
7556
|
-
const delayTimer =
|
|
7557
|
-
const rafRef =
|
|
7558
|
-
const cursor =
|
|
7559
|
-
const clamp =
|
|
7592
|
+
const triggerRef = import_react43.default.useRef(null);
|
|
7593
|
+
const tooltipRef = import_react43.default.useRef(null);
|
|
7594
|
+
const [visible, setVisible] = import_react43.default.useState(false);
|
|
7595
|
+
const [pos, setPos] = import_react43.default.useState({ left: 0, top: 0 });
|
|
7596
|
+
const delayTimer = import_react43.default.useRef(0);
|
|
7597
|
+
const rafRef = import_react43.default.useRef(0);
|
|
7598
|
+
const cursor = import_react43.default.useRef(null);
|
|
7599
|
+
const clamp = import_react43.default.useCallback((left, top, w, h) => {
|
|
7560
7600
|
const vw = window.innerWidth;
|
|
7561
7601
|
const vh = window.innerHeight;
|
|
7562
7602
|
return {
|
|
@@ -7564,7 +7604,7 @@ var Tooltip = (props) => {
|
|
|
7564
7604
|
top: Math.min(Math.max(GAP, top), Math.max(GAP, vh - h - GAP))
|
|
7565
7605
|
};
|
|
7566
7606
|
}, []);
|
|
7567
|
-
const placeAtCursor =
|
|
7607
|
+
const placeAtCursor = import_react43.default.useCallback((x, y) => {
|
|
7568
7608
|
const el = tooltipRef.current;
|
|
7569
7609
|
if (!el) return;
|
|
7570
7610
|
const w = el.offsetWidth;
|
|
@@ -7575,7 +7615,7 @@ var Tooltip = (props) => {
|
|
|
7575
7615
|
if (top < GAP) top = y + OFFSET;
|
|
7576
7616
|
setPos(clamp(left, top, w, h));
|
|
7577
7617
|
}, [clamp]);
|
|
7578
|
-
const placeAtTrigger =
|
|
7618
|
+
const placeAtTrigger = import_react43.default.useCallback(() => {
|
|
7579
7619
|
const el = tooltipRef.current;
|
|
7580
7620
|
const trigger = triggerRef.current;
|
|
7581
7621
|
if (!el || !trigger) return;
|
|
@@ -7587,19 +7627,19 @@ var Tooltip = (props) => {
|
|
|
7587
7627
|
const left = rect.left + rect.width / 2 - w / 2;
|
|
7588
7628
|
setPos(clamp(left, top, w, h));
|
|
7589
7629
|
}, [clamp]);
|
|
7590
|
-
const reposition =
|
|
7630
|
+
const reposition = import_react43.default.useCallback(() => {
|
|
7591
7631
|
if (follow && cursor.current) {
|
|
7592
7632
|
placeAtCursor(cursor.current.x, cursor.current.y);
|
|
7593
7633
|
} else {
|
|
7594
7634
|
placeAtTrigger();
|
|
7595
7635
|
}
|
|
7596
7636
|
}, [follow, placeAtCursor, placeAtTrigger]);
|
|
7597
|
-
const handleMouseEnter =
|
|
7637
|
+
const handleMouseEnter = import_react43.default.useCallback((e) => {
|
|
7598
7638
|
if (disabled) return;
|
|
7599
7639
|
cursor.current = { x: e.clientX, y: e.clientY };
|
|
7600
7640
|
delayTimer.current = window.setTimeout(() => setVisible(true), SHOW_DELAY);
|
|
7601
7641
|
}, [disabled]);
|
|
7602
|
-
const handleMouseMove =
|
|
7642
|
+
const handleMouseMove = import_react43.default.useCallback((e) => {
|
|
7603
7643
|
cursor.current = { x: e.clientX, y: e.clientY };
|
|
7604
7644
|
if (!visible || !follow) return;
|
|
7605
7645
|
cancelAnimationFrame(rafRef.current);
|
|
@@ -7607,25 +7647,25 @@ var Tooltip = (props) => {
|
|
|
7607
7647
|
if (cursor.current) placeAtCursor(cursor.current.x, cursor.current.y);
|
|
7608
7648
|
});
|
|
7609
7649
|
}, [visible, follow, placeAtCursor]);
|
|
7610
|
-
const close =
|
|
7650
|
+
const close = import_react43.default.useCallback(() => {
|
|
7611
7651
|
window.clearTimeout(delayTimer.current);
|
|
7612
7652
|
cancelAnimationFrame(rafRef.current);
|
|
7613
7653
|
setVisible(false);
|
|
7614
7654
|
}, []);
|
|
7615
|
-
const handleMouseLeave =
|
|
7655
|
+
const handleMouseLeave = import_react43.default.useCallback(() => {
|
|
7616
7656
|
cursor.current = null;
|
|
7617
7657
|
close();
|
|
7618
7658
|
}, [close]);
|
|
7619
|
-
const handleFocus =
|
|
7659
|
+
const handleFocus = import_react43.default.useCallback(() => {
|
|
7620
7660
|
if (disabled) return;
|
|
7621
7661
|
cursor.current = null;
|
|
7622
7662
|
setVisible(true);
|
|
7623
7663
|
}, [disabled]);
|
|
7624
|
-
|
|
7664
|
+
import_react43.default.useLayoutEffect(() => {
|
|
7625
7665
|
if (!visible) return;
|
|
7626
7666
|
reposition();
|
|
7627
7667
|
}, [visible, reposition]);
|
|
7628
|
-
|
|
7668
|
+
import_react43.default.useEffect(() => {
|
|
7629
7669
|
if (!visible || follow) return;
|
|
7630
7670
|
const onChange = () => placeAtTrigger();
|
|
7631
7671
|
window.addEventListener("scroll", onChange, true);
|
|
@@ -7635,7 +7675,7 @@ var Tooltip = (props) => {
|
|
|
7635
7675
|
window.removeEventListener("resize", onChange);
|
|
7636
7676
|
};
|
|
7637
7677
|
}, [visible, follow, placeAtTrigger]);
|
|
7638
|
-
|
|
7678
|
+
import_react43.default.useEffect(() => () => {
|
|
7639
7679
|
window.clearTimeout(delayTimer.current);
|
|
7640
7680
|
cancelAnimationFrame(rafRef.current);
|
|
7641
7681
|
}, []);
|
|
@@ -7674,7 +7714,7 @@ Tooltip.displayName = "Tooltip";
|
|
|
7674
7714
|
var Tooltip_default = Tooltip;
|
|
7675
7715
|
|
|
7676
7716
|
// src/components/Video/Video.tsx
|
|
7677
|
-
var
|
|
7717
|
+
var import_react44 = __toESM(require("react"), 1);
|
|
7678
7718
|
var import_jsx_runtime355 = require("react/jsx-runtime");
|
|
7679
7719
|
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: [
|
|
7680
7720
|
/* @__PURE__ */ (0, import_jsx_runtime355.jsx)("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
|
|
@@ -7686,7 +7726,7 @@ var formatTime = (sec) => {
|
|
|
7686
7726
|
const s = Math.floor(sec % 60);
|
|
7687
7727
|
return `${m}:${s.toString().padStart(2, "0")}`;
|
|
7688
7728
|
};
|
|
7689
|
-
var Video =
|
|
7729
|
+
var Video = import_react44.default.forwardRef((props, ref) => {
|
|
7690
7730
|
const {
|
|
7691
7731
|
src,
|
|
7692
7732
|
poster,
|
|
@@ -7710,21 +7750,21 @@ var Video = import_react43.default.forwardRef((props, ref) => {
|
|
|
7710
7750
|
children,
|
|
7711
7751
|
...rest
|
|
7712
7752
|
} = props;
|
|
7713
|
-
const containerRef =
|
|
7714
|
-
const videoRef =
|
|
7715
|
-
const [isPlaying, setIsPlaying] =
|
|
7716
|
-
const [isLoaded, setIsLoaded] =
|
|
7717
|
-
const [currentTime, setCurrentTime] =
|
|
7718
|
-
const [duration, setDuration] =
|
|
7719
|
-
const [buffered, setBuffered] =
|
|
7720
|
-
const [volume, setVolume] =
|
|
7721
|
-
const [isMuted, setIsMuted] =
|
|
7722
|
-
const [isFullscreen, setIsFullscreen] =
|
|
7723
|
-
const [playbackRate, setPlaybackRate] =
|
|
7724
|
-
const [rateMenuOpen, setRateMenuOpen] =
|
|
7725
|
-
const [captionsOn, setCaptionsOn] =
|
|
7726
|
-
const [isPip, setIsPip] =
|
|
7727
|
-
const setRefs =
|
|
7753
|
+
const containerRef = import_react44.default.useRef(null);
|
|
7754
|
+
const videoRef = import_react44.default.useRef(null);
|
|
7755
|
+
const [isPlaying, setIsPlaying] = import_react44.default.useState(Boolean(autoPlay));
|
|
7756
|
+
const [isLoaded, setIsLoaded] = import_react44.default.useState(false);
|
|
7757
|
+
const [currentTime, setCurrentTime] = import_react44.default.useState(0);
|
|
7758
|
+
const [duration, setDuration] = import_react44.default.useState(0);
|
|
7759
|
+
const [buffered, setBuffered] = import_react44.default.useState(0);
|
|
7760
|
+
const [volume, setVolume] = import_react44.default.useState(1);
|
|
7761
|
+
const [isMuted, setIsMuted] = import_react44.default.useState(Boolean(muted));
|
|
7762
|
+
const [isFullscreen, setIsFullscreen] = import_react44.default.useState(false);
|
|
7763
|
+
const [playbackRate, setPlaybackRate] = import_react44.default.useState(1);
|
|
7764
|
+
const [rateMenuOpen, setRateMenuOpen] = import_react44.default.useState(false);
|
|
7765
|
+
const [captionsOn, setCaptionsOn] = import_react44.default.useState(false);
|
|
7766
|
+
const [isPip, setIsPip] = import_react44.default.useState(false);
|
|
7767
|
+
const setRefs = import_react44.default.useCallback(
|
|
7728
7768
|
(el) => {
|
|
7729
7769
|
videoRef.current = el;
|
|
7730
7770
|
if (typeof ref === "function") ref(el);
|
|
@@ -7732,14 +7772,14 @@ var Video = import_react43.default.forwardRef((props, ref) => {
|
|
|
7732
7772
|
},
|
|
7733
7773
|
[ref]
|
|
7734
7774
|
);
|
|
7735
|
-
|
|
7775
|
+
import_react44.default.useEffect(() => {
|
|
7736
7776
|
const onFsChange = () => {
|
|
7737
7777
|
setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
7738
7778
|
};
|
|
7739
7779
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
7740
7780
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
7741
7781
|
}, []);
|
|
7742
|
-
|
|
7782
|
+
import_react44.default.useEffect(() => {
|
|
7743
7783
|
const v = videoRef.current;
|
|
7744
7784
|
if (!v) return;
|
|
7745
7785
|
const onEnter = () => setIsPip(true);
|