@x-plat/design-system 0.14.19 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Dropdown/index.cjs +44 -16
- package/dist/components/Dropdown/index.js +44 -16
- package/dist/components/PopOver/index.cjs +43 -15
- package/dist/components/PopOver/index.js +43 -15
- package/dist/components/Select/index.cjs +63 -35
- package/dist/components/Select/index.js +63 -35
- package/dist/components/TimePicker/index.cjs +48 -20
- package/dist/components/TimePicker/index.js +48 -20
- package/dist/components/Tooltip/index.cjs +2 -2
- package/dist/components/Tooltip/index.js +2 -2
- package/dist/components/index.cjs +245 -214
- package/dist/components/index.js +245 -214
- package/dist/index.cjs +250 -219
- package/dist/index.js +250 -219
- package/package.json +1 -1
package/dist/components/index.js
CHANGED
|
@@ -3231,8 +3231,9 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3231
3231
|
);
|
|
3232
3232
|
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
3233
3233
|
const maxHeight = frozenMaxRef.current;
|
|
3234
|
-
|
|
3235
|
-
pop.style.
|
|
3234
|
+
const hostRect = (pop.offsetParent ?? pop.parentElement)?.getBoundingClientRect();
|
|
3235
|
+
pop.style.top = `${top - (hostRect?.top ?? 0)}px`;
|
|
3236
|
+
pop.style.left = `${left - (hostRect?.left ?? 0)}px`;
|
|
3236
3237
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
3237
3238
|
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";
|
|
3238
3239
|
directionRef.current = next;
|
|
@@ -4034,13 +4035,13 @@ Drawer.displayName = "Drawer";
|
|
|
4034
4035
|
var Drawer_default = Drawer;
|
|
4035
4036
|
|
|
4036
4037
|
// src/components/Dropdown/Dropdown.tsx
|
|
4037
|
-
import
|
|
4038
|
+
import React22 from "react";
|
|
4038
4039
|
|
|
4039
4040
|
// src/tokens/hooks/Portal.tsx
|
|
4040
4041
|
import ReactDOM from "react-dom";
|
|
4041
|
-
var Portal = ({ children }) => {
|
|
4042
|
+
var Portal = ({ children, container }) => {
|
|
4042
4043
|
if (typeof document === "undefined") return null;
|
|
4043
|
-
return ReactDOM.createPortal(children, document.body);
|
|
4044
|
+
return ReactDOM.createPortal(children, container ?? document.body);
|
|
4044
4045
|
};
|
|
4045
4046
|
Portal.displayName = "Portal";
|
|
4046
4047
|
var Portal_default = Portal;
|
|
@@ -4070,15 +4071,42 @@ var useClickOutside = (refs, handler, enabled = true) => {
|
|
|
4070
4071
|
};
|
|
4071
4072
|
var useClickOutside_default = useClickOutside;
|
|
4072
4073
|
|
|
4074
|
+
// src/tokens/hooks/useOverlayHost.ts
|
|
4075
|
+
import React21 from "react";
|
|
4076
|
+
var useOverlayHost = (triggerRef, enabled) => {
|
|
4077
|
+
const [host, setHost] = React21.useState(null);
|
|
4078
|
+
React21.useLayoutEffect(() => {
|
|
4079
|
+
if (!enabled || !triggerRef.current) {
|
|
4080
|
+
setHost(null);
|
|
4081
|
+
return;
|
|
4082
|
+
}
|
|
4083
|
+
const el = document.createElement("div");
|
|
4084
|
+
el.dataset.xplatOverlayHost = "";
|
|
4085
|
+
el.style.position = "relative";
|
|
4086
|
+
el.style.width = "0";
|
|
4087
|
+
el.style.height = "0";
|
|
4088
|
+
const parent = findScrollParent(triggerRef.current) ?? document.body;
|
|
4089
|
+
parent.appendChild(el);
|
|
4090
|
+
setHost(el);
|
|
4091
|
+
return () => {
|
|
4092
|
+
el.remove();
|
|
4093
|
+
setHost(null);
|
|
4094
|
+
};
|
|
4095
|
+
}, [enabled, triggerRef]);
|
|
4096
|
+
return host;
|
|
4097
|
+
};
|
|
4098
|
+
var useOverlayHost_default = useOverlayHost;
|
|
4099
|
+
|
|
4073
4100
|
// src/components/Dropdown/Dropdown.tsx
|
|
4074
4101
|
import { jsx as jsx322, jsxs as jsxs206 } from "react/jsx-runtime";
|
|
4075
4102
|
var Dropdown = (props) => {
|
|
4076
4103
|
const { items, children } = props;
|
|
4077
|
-
const [isOpen, setIsOpen] =
|
|
4078
|
-
const [mounted, setMounted] =
|
|
4079
|
-
const [visible, setVisible] =
|
|
4080
|
-
const triggerRef =
|
|
4081
|
-
const menuRef =
|
|
4104
|
+
const [isOpen, setIsOpen] = React22.useState(false);
|
|
4105
|
+
const [mounted, setMounted] = React22.useState(false);
|
|
4106
|
+
const [visible, setVisible] = React22.useState(false);
|
|
4107
|
+
const triggerRef = React22.useRef(null);
|
|
4108
|
+
const menuRef = React22.useRef(null);
|
|
4109
|
+
const host = useOverlayHost_default(triggerRef, mounted);
|
|
4082
4110
|
useAutoPosition_default(triggerRef, menuRef, mounted);
|
|
4083
4111
|
useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false), isOpen);
|
|
4084
4112
|
useCloseWhenFocusHidden(isOpen, triggerRef, menuRef, () => setIsOpen(false));
|
|
@@ -4086,7 +4114,7 @@ var Dropdown = (props) => {
|
|
|
4086
4114
|
setIsOpen(false);
|
|
4087
4115
|
triggerRef.current?.focus({ preventScroll: true });
|
|
4088
4116
|
});
|
|
4089
|
-
|
|
4117
|
+
React22.useEffect(() => {
|
|
4090
4118
|
if (isOpen) {
|
|
4091
4119
|
setMounted(true);
|
|
4092
4120
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -4111,7 +4139,7 @@ var Dropdown = (props) => {
|
|
|
4111
4139
|
children
|
|
4112
4140
|
}
|
|
4113
4141
|
),
|
|
4114
|
-
mounted && /* @__PURE__ */ jsx322(Portal_default, { children: /* @__PURE__ */ jsx322(
|
|
4142
|
+
mounted && /* @__PURE__ */ jsx322(Portal_default, { container: host, children: /* @__PURE__ */ jsx322(
|
|
4115
4143
|
"div",
|
|
4116
4144
|
{
|
|
4117
4145
|
ref: menuRef,
|
|
@@ -4139,7 +4167,7 @@ Dropdown.displayName = "Dropdown";
|
|
|
4139
4167
|
var Dropdown_default = Dropdown;
|
|
4140
4168
|
|
|
4141
4169
|
// src/components/Editor/Editor.tsx
|
|
4142
|
-
import
|
|
4170
|
+
import React23 from "react";
|
|
4143
4171
|
|
|
4144
4172
|
// src/components/Editor/highlight.ts
|
|
4145
4173
|
var CODE_LANGUAGES = [
|
|
@@ -4410,22 +4438,22 @@ var Editor = (props) => {
|
|
|
4410
4438
|
onImageUpload,
|
|
4411
4439
|
minHeight = 200
|
|
4412
4440
|
} = props;
|
|
4413
|
-
const editorRef =
|
|
4414
|
-
const lastRangeRef =
|
|
4415
|
-
const composingRef =
|
|
4416
|
-
const [isFocused, setIsFocused] =
|
|
4417
|
-
const [isEmpty, setIsEmpty] =
|
|
4418
|
-
const [activeFormats, setActiveFormats] =
|
|
4419
|
-
const [slashOpen, setSlashOpen] =
|
|
4420
|
-
const [slashFilter, setSlashFilter] =
|
|
4421
|
-
const [slashIdx, setSlashIdx] =
|
|
4422
|
-
const [slashPos, setSlashPos] =
|
|
4423
|
-
const slashStartRangeRef =
|
|
4424
|
-
const [linkOpen, setLinkOpen] =
|
|
4425
|
-
const [linkValue, setLinkValue] =
|
|
4426
|
-
const [linkPos, setLinkPos] =
|
|
4427
|
-
const lastEmittedRef =
|
|
4428
|
-
|
|
4441
|
+
const editorRef = React23.useRef(null);
|
|
4442
|
+
const lastRangeRef = React23.useRef(null);
|
|
4443
|
+
const composingRef = React23.useRef(false);
|
|
4444
|
+
const [isFocused, setIsFocused] = React23.useState(false);
|
|
4445
|
+
const [isEmpty, setIsEmpty] = React23.useState(!value);
|
|
4446
|
+
const [activeFormats, setActiveFormats] = React23.useState(/* @__PURE__ */ new Set());
|
|
4447
|
+
const [slashOpen, setSlashOpen] = React23.useState(false);
|
|
4448
|
+
const [slashFilter, setSlashFilter] = React23.useState("");
|
|
4449
|
+
const [slashIdx, setSlashIdx] = React23.useState(0);
|
|
4450
|
+
const [slashPos, setSlashPos] = React23.useState({ top: 0, left: 0 });
|
|
4451
|
+
const slashStartRangeRef = React23.useRef(null);
|
|
4452
|
+
const [linkOpen, setLinkOpen] = React23.useState(false);
|
|
4453
|
+
const [linkValue, setLinkValue] = React23.useState("");
|
|
4454
|
+
const [linkPos, setLinkPos] = React23.useState({ top: 0, left: 0 });
|
|
4455
|
+
const lastEmittedRef = React23.useRef(null);
|
|
4456
|
+
React23.useEffect(() => {
|
|
4429
4457
|
const el = editorRef.current;
|
|
4430
4458
|
if (!el) return;
|
|
4431
4459
|
if (value === lastEmittedRef.current) return;
|
|
@@ -4507,10 +4535,10 @@ var Editor = (props) => {
|
|
|
4507
4535
|
const current = String(document.queryCommandValue("formatBlock") || "").toLowerCase();
|
|
4508
4536
|
setBlock(current === tag ? "p" : tag);
|
|
4509
4537
|
};
|
|
4510
|
-
const historyRef =
|
|
4511
|
-
const historyIdxRef =
|
|
4512
|
-
const lastPushAtRef =
|
|
4513
|
-
const isRestoringRef =
|
|
4538
|
+
const historyRef = React23.useRef([]);
|
|
4539
|
+
const historyIdxRef = React23.useRef(-1);
|
|
4540
|
+
const lastPushAtRef = React23.useRef(0);
|
|
4541
|
+
const isRestoringRef = React23.useRef(false);
|
|
4514
4542
|
const caretOffset = (rootEl) => {
|
|
4515
4543
|
const el = rootEl ?? editorRef.current;
|
|
4516
4544
|
const sel = window.getSelection();
|
|
@@ -4587,8 +4615,8 @@ var Editor = (props) => {
|
|
|
4587
4615
|
const cls = Array.from(pre.classList).find((c) => c.startsWith("lang-"));
|
|
4588
4616
|
return cls?.slice(5) ?? "plain";
|
|
4589
4617
|
};
|
|
4590
|
-
const [codeLang, setCodeLang] =
|
|
4591
|
-
const highlightRafRef =
|
|
4618
|
+
const [codeLang, setCodeLang] = React23.useState("plain");
|
|
4619
|
+
const highlightRafRef = React23.useRef(0);
|
|
4592
4620
|
const rehighlight = (pre) => {
|
|
4593
4621
|
if (composingRef.current) return;
|
|
4594
4622
|
const code = pre.querySelector("code");
|
|
@@ -4933,7 +4961,7 @@ var Editor = (props) => {
|
|
|
4933
4961
|
setSlashIdx(0);
|
|
4934
4962
|
slashStartRangeRef.current = null;
|
|
4935
4963
|
};
|
|
4936
|
-
const filteredSlashItems =
|
|
4964
|
+
const filteredSlashItems = React23.useMemo(() => {
|
|
4937
4965
|
if (!slashFilter) return SLASH_ITEMS;
|
|
4938
4966
|
const f = slashFilter.toLowerCase();
|
|
4939
4967
|
return SLASH_ITEMS.filter((it) => it.label.toLowerCase().includes(f) || it.key.includes(f));
|
|
@@ -5198,7 +5226,7 @@ var Editor = (props) => {
|
|
|
5198
5226
|
}
|
|
5199
5227
|
}
|
|
5200
5228
|
};
|
|
5201
|
-
const plainPasteRef =
|
|
5229
|
+
const plainPasteRef = React23.useRef(false);
|
|
5202
5230
|
const handlePaste = (e) => {
|
|
5203
5231
|
if (readOnly) return;
|
|
5204
5232
|
e.preventDefault();
|
|
@@ -5499,7 +5527,7 @@ var EditorToolbar = ({
|
|
|
5499
5527
|
] });
|
|
5500
5528
|
};
|
|
5501
5529
|
var SlashMenu = ({ position, items, activeIndex, onSelect, onClose }) => {
|
|
5502
|
-
|
|
5530
|
+
React23.useEffect(() => {
|
|
5503
5531
|
const handleClickOutside = (e) => {
|
|
5504
5532
|
const target = e.target;
|
|
5505
5533
|
const menu = document.querySelector(".lib-xplat-editor__slash-menu");
|
|
@@ -5533,8 +5561,8 @@ var SlashMenu = ({ position, items, activeIndex, onSelect, onClose }) => {
|
|
|
5533
5561
|
);
|
|
5534
5562
|
};
|
|
5535
5563
|
var LinkPopover = ({ position, value, onChange, onConfirm, onClose }) => {
|
|
5536
|
-
const inputRef =
|
|
5537
|
-
|
|
5564
|
+
const inputRef = React23.useRef(null);
|
|
5565
|
+
React23.useEffect(() => {
|
|
5538
5566
|
inputRef.current?.focus();
|
|
5539
5567
|
}, []);
|
|
5540
5568
|
return /* @__PURE__ */ jsxs207(
|
|
@@ -5592,7 +5620,7 @@ EmptyState.displayName = "EmptyState";
|
|
|
5592
5620
|
var EmptyState_default = EmptyState;
|
|
5593
5621
|
|
|
5594
5622
|
// src/components/FileUpload/FileUpload.tsx
|
|
5595
|
-
import
|
|
5623
|
+
import React24 from "react";
|
|
5596
5624
|
import { jsx as jsx325, jsxs as jsxs209 } from "react/jsx-runtime";
|
|
5597
5625
|
var FileUpload = (props) => {
|
|
5598
5626
|
const {
|
|
@@ -5606,9 +5634,9 @@ var FileUpload = (props) => {
|
|
|
5606
5634
|
label,
|
|
5607
5635
|
required
|
|
5608
5636
|
} = props;
|
|
5609
|
-
const fieldId =
|
|
5610
|
-
const [isDragOver, setIsDragOver] =
|
|
5611
|
-
const inputRef =
|
|
5637
|
+
const fieldId = React24.useId();
|
|
5638
|
+
const [isDragOver, setIsDragOver] = React24.useState(false);
|
|
5639
|
+
const inputRef = React24.useRef(null);
|
|
5612
5640
|
const handleFiles = (fileList) => {
|
|
5613
5641
|
let files = Array.from(fileList);
|
|
5614
5642
|
if (maxSize) {
|
|
@@ -5671,10 +5699,10 @@ FileUpload.displayName = "FileUpload";
|
|
|
5671
5699
|
var FileUpload_default = FileUpload;
|
|
5672
5700
|
|
|
5673
5701
|
// src/components/HtmlTypeWriter/HtmlTypeWriter.tsx
|
|
5674
|
-
import
|
|
5702
|
+
import React26 from "react";
|
|
5675
5703
|
|
|
5676
5704
|
// src/components/HtmlTypeWriter/utils.ts
|
|
5677
|
-
import
|
|
5705
|
+
import React25 from "react";
|
|
5678
5706
|
var voidTags = /* @__PURE__ */ new Set([
|
|
5679
5707
|
"br",
|
|
5680
5708
|
"img",
|
|
@@ -5742,15 +5770,15 @@ var convertNodeToReactWithRange = (node, typedLen, rangeMap) => {
|
|
|
5742
5770
|
props[attr.name] = attr.value;
|
|
5743
5771
|
});
|
|
5744
5772
|
if (voidTags.has(tag)) {
|
|
5745
|
-
return
|
|
5773
|
+
return React25.createElement(tag, props);
|
|
5746
5774
|
}
|
|
5747
5775
|
const children = Array.from(element.childNodes).map((child) => convertNodeToReactWithRange(child, typedLen, rangeMap)).filter((n) => n != null);
|
|
5748
|
-
return
|
|
5776
|
+
return React25.createElement(tag, props, ...children);
|
|
5749
5777
|
};
|
|
5750
5778
|
var htmlToReactProgressive = (root, typedLen, rangeMap) => {
|
|
5751
5779
|
const nodes = Array.from(root.childNodes).map((child, idx) => {
|
|
5752
5780
|
const node = convertNodeToReactWithRange(child, typedLen, rangeMap);
|
|
5753
|
-
return node == null ? null :
|
|
5781
|
+
return node == null ? null : React25.createElement(React25.Fragment, { key: idx }, node);
|
|
5754
5782
|
}).filter(Boolean);
|
|
5755
5783
|
return nodes.length === 0 ? null : nodes;
|
|
5756
5784
|
};
|
|
@@ -5763,20 +5791,20 @@ var HtmlTypeWriter = ({
|
|
|
5763
5791
|
onDone,
|
|
5764
5792
|
onChange
|
|
5765
5793
|
}) => {
|
|
5766
|
-
const [typedLen, setTypedLen] =
|
|
5767
|
-
const doneCalledRef =
|
|
5768
|
-
const { doc, rangeMap, totalLength } =
|
|
5794
|
+
const [typedLen, setTypedLen] = React26.useState(0);
|
|
5795
|
+
const doneCalledRef = React26.useRef(false);
|
|
5796
|
+
const { doc, rangeMap, totalLength } = React26.useMemo(() => {
|
|
5769
5797
|
if (typeof window === "undefined") return { doc: null, rangeMap: /* @__PURE__ */ new Map(), totalLength: 0 };
|
|
5770
5798
|
const decoded = decodeHtmlEntities(html);
|
|
5771
5799
|
const doc2 = new DOMParser().parseFromString(decoded, "text/html");
|
|
5772
5800
|
const { rangeMap: rangeMap2, totalLength: totalLength2 } = buildRangeMap(doc2.body);
|
|
5773
5801
|
return { doc: doc2, rangeMap: rangeMap2, totalLength: totalLength2 };
|
|
5774
5802
|
}, [html]);
|
|
5775
|
-
|
|
5803
|
+
React26.useEffect(() => {
|
|
5776
5804
|
setTypedLen(0);
|
|
5777
5805
|
doneCalledRef.current = false;
|
|
5778
5806
|
}, [html]);
|
|
5779
|
-
|
|
5807
|
+
React26.useEffect(() => {
|
|
5780
5808
|
if (!totalLength) return;
|
|
5781
5809
|
if (typedLen >= totalLength) return;
|
|
5782
5810
|
const timer = window.setInterval(() => {
|
|
@@ -5784,18 +5812,18 @@ var HtmlTypeWriter = ({
|
|
|
5784
5812
|
}, duration);
|
|
5785
5813
|
return () => window.clearInterval(timer);
|
|
5786
5814
|
}, [typedLen, totalLength, duration]);
|
|
5787
|
-
|
|
5815
|
+
React26.useEffect(() => {
|
|
5788
5816
|
if (typedLen > 0 && typedLen < totalLength) {
|
|
5789
5817
|
onChange?.();
|
|
5790
5818
|
}
|
|
5791
5819
|
}, [typedLen, totalLength, onChange]);
|
|
5792
|
-
|
|
5820
|
+
React26.useEffect(() => {
|
|
5793
5821
|
if (typedLen === totalLength && totalLength > 0 && !doneCalledRef.current) {
|
|
5794
5822
|
doneCalledRef.current = true;
|
|
5795
5823
|
onDone?.();
|
|
5796
5824
|
}
|
|
5797
5825
|
}, [typedLen, totalLength, onDone]);
|
|
5798
|
-
const parsed =
|
|
5826
|
+
const parsed = React26.useMemo(
|
|
5799
5827
|
() => doc ? htmlToReactProgressive(doc.body, typedLen, rangeMap) : null,
|
|
5800
5828
|
[doc, typedLen, rangeMap]
|
|
5801
5829
|
);
|
|
@@ -5805,13 +5833,13 @@ HtmlTypeWriter.displayName = "HtmlTypeWriter";
|
|
|
5805
5833
|
var HtmlTypeWriter_default = HtmlTypeWriter;
|
|
5806
5834
|
|
|
5807
5835
|
// src/components/ImageSelector/ImageSelector.tsx
|
|
5808
|
-
import
|
|
5836
|
+
import React27 from "react";
|
|
5809
5837
|
import { jsx as jsx327, jsxs as jsxs210 } from "react/jsx-runtime";
|
|
5810
5838
|
var ImageSelector = (props) => {
|
|
5811
5839
|
const { value, placeholder, onChange, validations, label, required } = props;
|
|
5812
|
-
const fieldId =
|
|
5813
|
-
const [previewUrl, setPreviewUrl] =
|
|
5814
|
-
|
|
5840
|
+
const fieldId = React27.useId();
|
|
5841
|
+
const [previewUrl, setPreviewUrl] = React27.useState();
|
|
5842
|
+
React27.useEffect(() => {
|
|
5815
5843
|
if (!value) {
|
|
5816
5844
|
setPreviewUrl(void 0);
|
|
5817
5845
|
return;
|
|
@@ -5820,7 +5848,7 @@ var ImageSelector = (props) => {
|
|
|
5820
5848
|
setPreviewUrl(url);
|
|
5821
5849
|
return () => URL.revokeObjectURL(url);
|
|
5822
5850
|
}, [value]);
|
|
5823
|
-
const inputRef =
|
|
5851
|
+
const inputRef = React27.useRef(null);
|
|
5824
5852
|
const handleFileChange = (e) => {
|
|
5825
5853
|
const selectedFile = e.target.files?.[0];
|
|
5826
5854
|
if (selectedFile) {
|
|
@@ -6003,22 +6031,23 @@ Pagination.displayName = "Pagination";
|
|
|
6003
6031
|
var Pagination_default = Pagination;
|
|
6004
6032
|
|
|
6005
6033
|
// src/components/PopOver/PopOver.tsx
|
|
6006
|
-
import
|
|
6034
|
+
import React28 from "react";
|
|
6007
6035
|
import { jsx as jsx332, jsxs as jsxs213 } from "react/jsx-runtime";
|
|
6008
6036
|
var PopOver = (props) => {
|
|
6009
6037
|
const { children, isOpen, onClose, PopOverEl } = props;
|
|
6010
|
-
const popRef =
|
|
6011
|
-
const triggerRef =
|
|
6012
|
-
const [localOpen, setLocalOpen] =
|
|
6013
|
-
const [eventTrigger, setEventTrigger] =
|
|
6038
|
+
const popRef = React28.useRef(null);
|
|
6039
|
+
const triggerRef = React28.useRef(null);
|
|
6040
|
+
const [localOpen, setLocalOpen] = React28.useState(false);
|
|
6041
|
+
const [eventTrigger, setEventTrigger] = React28.useState(false);
|
|
6014
6042
|
useClickOutside_default([popRef, triggerRef], onClose, isOpen);
|
|
6015
6043
|
useCloseWhenFocusHidden(isOpen, triggerRef, popRef, onClose);
|
|
6016
6044
|
useEscapeKey(isOpen, () => {
|
|
6017
6045
|
onClose();
|
|
6018
6046
|
triggerRef.current?.focus({ preventScroll: true });
|
|
6019
6047
|
});
|
|
6048
|
+
const host = useOverlayHost_default(triggerRef, localOpen);
|
|
6020
6049
|
useAutoPosition_default(triggerRef, popRef, localOpen);
|
|
6021
|
-
|
|
6050
|
+
React28.useEffect(() => {
|
|
6022
6051
|
if (isOpen) {
|
|
6023
6052
|
setLocalOpen(isOpen);
|
|
6024
6053
|
setTimeout(() => {
|
|
@@ -6041,7 +6070,7 @@ var PopOver = (props) => {
|
|
|
6041
6070
|
},
|
|
6042
6071
|
children: [
|
|
6043
6072
|
children,
|
|
6044
|
-
localOpen && /* @__PURE__ */ jsx332(Portal_default, { children: /* @__PURE__ */ jsx332(
|
|
6073
|
+
localOpen && /* @__PURE__ */ jsx332(Portal_default, { container: host, children: /* @__PURE__ */ jsx332(
|
|
6045
6074
|
"div",
|
|
6046
6075
|
{
|
|
6047
6076
|
className: clsx_default(
|
|
@@ -6099,12 +6128,12 @@ Progress.displayName = "Progress";
|
|
|
6099
6128
|
var Progress_default = Progress;
|
|
6100
6129
|
|
|
6101
6130
|
// src/components/Radio/RadioGroupContext.tsx
|
|
6102
|
-
import
|
|
6103
|
-
var RadioGroupContext =
|
|
6131
|
+
import React29 from "react";
|
|
6132
|
+
var RadioGroupContext = React29.createContext(
|
|
6104
6133
|
null
|
|
6105
6134
|
);
|
|
6106
6135
|
var useRadioGroupContext = () => {
|
|
6107
|
-
return
|
|
6136
|
+
return React29.useContext(RadioGroupContext);
|
|
6108
6137
|
};
|
|
6109
6138
|
var RadioGroupContext_default = RadioGroupContext;
|
|
6110
6139
|
|
|
@@ -6180,19 +6209,19 @@ RadioGroup.displayName = "RadioGroup";
|
|
|
6180
6209
|
var RadioGroup_default = RadioGroup;
|
|
6181
6210
|
|
|
6182
6211
|
// src/components/Select/Select.tsx
|
|
6183
|
-
import
|
|
6212
|
+
import React32 from "react";
|
|
6184
6213
|
|
|
6185
6214
|
// src/components/Select/context.ts
|
|
6186
|
-
import
|
|
6187
|
-
var SelectContext =
|
|
6215
|
+
import React30 from "react";
|
|
6216
|
+
var SelectContext = React30.createContext(null);
|
|
6188
6217
|
var context_default = SelectContext;
|
|
6189
6218
|
|
|
6190
6219
|
// src/components/Select/SelectItem.tsx
|
|
6191
|
-
import
|
|
6220
|
+
import React31 from "react";
|
|
6192
6221
|
import { jsx as jsx336 } from "react/jsx-runtime";
|
|
6193
6222
|
var SelectItem = (props) => {
|
|
6194
6223
|
const { children, value, onClick, disabled = false } = props;
|
|
6195
|
-
const ctx =
|
|
6224
|
+
const ctx = React31.useContext(context_default);
|
|
6196
6225
|
const handleClick = (e) => {
|
|
6197
6226
|
e.preventDefault();
|
|
6198
6227
|
e.stopPropagation();
|
|
@@ -6242,29 +6271,29 @@ var SelectRoot = (props) => {
|
|
|
6242
6271
|
required,
|
|
6243
6272
|
size = "md"
|
|
6244
6273
|
} = props;
|
|
6245
|
-
const fieldId =
|
|
6246
|
-
const itemChildren =
|
|
6247
|
-
(child) =>
|
|
6274
|
+
const fieldId = React32.useId();
|
|
6275
|
+
const itemChildren = React32.Children.toArray(children).filter(
|
|
6276
|
+
(child) => React32.isValidElement(child) && child.type === SelectItem_default
|
|
6248
6277
|
);
|
|
6249
6278
|
const isControlled = valueProp !== void 0;
|
|
6250
|
-
const [isOpen, setOpen] =
|
|
6251
|
-
const [uncontrolledLabel, setUncontrolledLabel] =
|
|
6252
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
6253
|
-
const controlledLabel =
|
|
6279
|
+
const [isOpen, setOpen] = React32.useState(false);
|
|
6280
|
+
const [uncontrolledLabel, setUncontrolledLabel] = React32.useState(null);
|
|
6281
|
+
const [uncontrolledValue, setUncontrolledValue] = React32.useState(void 0);
|
|
6282
|
+
const controlledLabel = React32.useMemo(() => {
|
|
6254
6283
|
if (!isControlled) return null;
|
|
6255
6284
|
const match = itemChildren.find((child) => child.props.value === valueProp);
|
|
6256
6285
|
return match ? match.props.children : null;
|
|
6257
6286
|
}, [isControlled, valueProp, itemChildren]);
|
|
6258
6287
|
const selectedLabel = isControlled ? controlledLabel : uncontrolledLabel;
|
|
6259
6288
|
const selectedValue = isControlled ? valueProp : uncontrolledValue;
|
|
6260
|
-
const triggerRef =
|
|
6261
|
-
const contentRef =
|
|
6262
|
-
const [mounted, setMounted] =
|
|
6263
|
-
const [visible, setVisible] =
|
|
6264
|
-
|
|
6289
|
+
const triggerRef = React32.useRef(null);
|
|
6290
|
+
const contentRef = React32.useRef(null);
|
|
6291
|
+
const [mounted, setMounted] = React32.useState(false);
|
|
6292
|
+
const [visible, setVisible] = React32.useState(false);
|
|
6293
|
+
React32.useEffect(() => {
|
|
6265
6294
|
if (disabled && isOpen) setOpen(false);
|
|
6266
6295
|
}, [disabled, isOpen]);
|
|
6267
|
-
|
|
6296
|
+
React32.useEffect(() => {
|
|
6268
6297
|
if (isOpen) {
|
|
6269
6298
|
setMounted(true);
|
|
6270
6299
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -6274,33 +6303,34 @@ var SelectRoot = (props) => {
|
|
|
6274
6303
|
const t = setTimeout(() => setMounted(false), ANIMATION_DURATION_MS3);
|
|
6275
6304
|
return () => clearTimeout(t);
|
|
6276
6305
|
}, [isOpen]);
|
|
6277
|
-
const [query, setQuery] =
|
|
6306
|
+
const [query, setQuery] = React32.useState("");
|
|
6278
6307
|
const textOf = (node) => {
|
|
6279
6308
|
if (node === null || node === void 0 || typeof node === "boolean") return "";
|
|
6280
6309
|
if (typeof node === "string" || typeof node === "number") return String(node);
|
|
6281
6310
|
if (Array.isArray(node)) return node.map(textOf).join("");
|
|
6282
|
-
if (
|
|
6311
|
+
if (React32.isValidElement(node)) return textOf(node.props.children);
|
|
6283
6312
|
return "";
|
|
6284
6313
|
};
|
|
6285
|
-
const visibleItems =
|
|
6314
|
+
const visibleItems = React32.useMemo(() => {
|
|
6286
6315
|
if (!searchable || !query.trim()) return itemChildren;
|
|
6287
6316
|
const q = query.trim().toLowerCase();
|
|
6288
6317
|
return itemChildren.filter((c) => textOf(c.props.children).toLowerCase().includes(q));
|
|
6289
6318
|
}, [searchable, query, itemChildren]);
|
|
6290
|
-
const open =
|
|
6291
|
-
const close =
|
|
6319
|
+
const open = React32.useCallback(() => setOpen(true), []);
|
|
6320
|
+
const close = React32.useCallback(() => {
|
|
6292
6321
|
setOpen(false);
|
|
6293
6322
|
setQuery("");
|
|
6294
6323
|
}, []);
|
|
6295
|
-
const toggle =
|
|
6324
|
+
const toggle = React32.useCallback(() => setOpen((prev) => !prev), []);
|
|
6296
6325
|
useClickOutside_default([contentRef, triggerRef], close, isOpen);
|
|
6297
6326
|
useCloseWhenFocusHidden(isOpen, triggerRef, contentRef, close);
|
|
6298
6327
|
useEscapeKey(isOpen, () => {
|
|
6299
6328
|
close();
|
|
6300
6329
|
triggerRef.current?.focus({ preventScroll: true });
|
|
6301
6330
|
});
|
|
6331
|
+
const host = useOverlayHost_default(triggerRef, mounted);
|
|
6302
6332
|
useAutoPosition_default(triggerRef, contentRef, mounted);
|
|
6303
|
-
const setSelected =
|
|
6333
|
+
const setSelected = React32.useCallback(
|
|
6304
6334
|
(label2, itemValue) => {
|
|
6305
6335
|
if (!isControlled) {
|
|
6306
6336
|
setUncontrolledLabel(label2);
|
|
@@ -6310,7 +6340,7 @@ var SelectRoot = (props) => {
|
|
|
6310
6340
|
},
|
|
6311
6341
|
[isControlled, onChange]
|
|
6312
6342
|
);
|
|
6313
|
-
const ctxValue =
|
|
6343
|
+
const ctxValue = React32.useMemo(
|
|
6314
6344
|
() => ({
|
|
6315
6345
|
isOpen,
|
|
6316
6346
|
mounted,
|
|
@@ -6389,7 +6419,7 @@ var SelectRoot = (props) => {
|
|
|
6389
6419
|
]
|
|
6390
6420
|
}
|
|
6391
6421
|
),
|
|
6392
|
-
mounted && /* @__PURE__ */ jsx337(Portal_default, { children: /* @__PURE__ */ jsxs216(
|
|
6422
|
+
mounted && /* @__PURE__ */ jsx337(Portal_default, { container: host, children: /* @__PURE__ */ jsxs216(
|
|
6393
6423
|
"div",
|
|
6394
6424
|
{
|
|
6395
6425
|
className: clsx_default("lib-xplat-select-content", size, stateClass),
|
|
@@ -6555,7 +6585,7 @@ Steps.displayName = "Steps";
|
|
|
6555
6585
|
var Steps_default = Steps;
|
|
6556
6586
|
|
|
6557
6587
|
// src/components/Swiper/Swiper.tsx
|
|
6558
|
-
import
|
|
6588
|
+
import React33 from "react";
|
|
6559
6589
|
import { jsx as jsx342, jsxs as jsxs220 } from "react/jsx-runtime";
|
|
6560
6590
|
var Swiper = (props) => {
|
|
6561
6591
|
const {
|
|
@@ -6580,26 +6610,26 @@ var Swiper = (props) => {
|
|
|
6580
6610
|
const maxIndex = Math.max(0, totalSlides - viewItemCount);
|
|
6581
6611
|
const useLoop = loop && canSlide;
|
|
6582
6612
|
const cloneCount = useLoop ? totalSlides : 0;
|
|
6583
|
-
const extendedItems =
|
|
6613
|
+
const extendedItems = React33.useMemo(() => {
|
|
6584
6614
|
if (!useLoop) return items;
|
|
6585
6615
|
return [...items, ...items, ...items];
|
|
6586
6616
|
}, [items, useLoop]);
|
|
6587
6617
|
const initialIdx = Math.max(0, Math.min(indexProp ?? 0, maxIndex));
|
|
6588
|
-
const [innerIndex, setInnerIndex] =
|
|
6618
|
+
const [innerIndex, setInnerIndex] = React33.useState(
|
|
6589
6619
|
useLoop ? cloneCount + initialIdx : initialIdx
|
|
6590
6620
|
);
|
|
6591
|
-
const [isDragging, setIsDragging] =
|
|
6592
|
-
const [dragOffset, setDragOffset] =
|
|
6593
|
-
const [animated, setAnimated] =
|
|
6594
|
-
const [containerWidth, setContainerWidth] =
|
|
6595
|
-
const containerRef =
|
|
6596
|
-
const startXRef =
|
|
6597
|
-
const startTimeRef =
|
|
6598
|
-
const autoplayTimerRef =
|
|
6599
|
-
const resumeTimeoutRef =
|
|
6600
|
-
const [paused, setPaused] =
|
|
6601
|
-
const initializedRef =
|
|
6602
|
-
|
|
6621
|
+
const [isDragging, setIsDragging] = React33.useState(false);
|
|
6622
|
+
const [dragOffset, setDragOffset] = React33.useState(0);
|
|
6623
|
+
const [animated, setAnimated] = React33.useState(false);
|
|
6624
|
+
const [containerWidth, setContainerWidth] = React33.useState(0);
|
|
6625
|
+
const containerRef = React33.useRef(null);
|
|
6626
|
+
const startXRef = React33.useRef(0);
|
|
6627
|
+
const startTimeRef = React33.useRef(0);
|
|
6628
|
+
const autoplayTimerRef = React33.useRef(null);
|
|
6629
|
+
const resumeTimeoutRef = React33.useRef(null);
|
|
6630
|
+
const [paused, setPaused] = React33.useState(false);
|
|
6631
|
+
const initializedRef = React33.useRef(false);
|
|
6632
|
+
React33.useEffect(() => {
|
|
6603
6633
|
const el = containerRef.current;
|
|
6604
6634
|
if (!el) return;
|
|
6605
6635
|
const ro = new ResizeObserver((entries) => {
|
|
@@ -6622,7 +6652,7 @@ var Swiper = (props) => {
|
|
|
6622
6652
|
return ((inner - cloneCount) % totalSlides + totalSlides) % totalSlides;
|
|
6623
6653
|
};
|
|
6624
6654
|
const realIndex = getRealIndex(innerIndex);
|
|
6625
|
-
const moveToInner =
|
|
6655
|
+
const moveToInner = React33.useCallback(
|
|
6626
6656
|
(idx, withAnim = true) => {
|
|
6627
6657
|
if (!useLoop) {
|
|
6628
6658
|
setAnimated(withAnim);
|
|
@@ -6650,7 +6680,7 @@ var Swiper = (props) => {
|
|
|
6650
6680
|
},
|
|
6651
6681
|
[useLoop, cloneCount, totalSlides]
|
|
6652
6682
|
);
|
|
6653
|
-
const handleTransitionEnd =
|
|
6683
|
+
const handleTransitionEnd = React33.useCallback(() => {
|
|
6654
6684
|
if (!useLoop) return;
|
|
6655
6685
|
const real = getRealIndex(innerIndex);
|
|
6656
6686
|
const canonical = cloneCount + real;
|
|
@@ -6660,7 +6690,7 @@ var Swiper = (props) => {
|
|
|
6660
6690
|
}
|
|
6661
6691
|
onChange?.(Math.min(real, maxIndex));
|
|
6662
6692
|
}, [useLoop, innerIndex, cloneCount, totalSlides, maxIndex, onChange]);
|
|
6663
|
-
const slideTo =
|
|
6693
|
+
const slideTo = React33.useCallback(
|
|
6664
6694
|
(logicalIndex) => {
|
|
6665
6695
|
if (!canSlide) return;
|
|
6666
6696
|
const clamped = useLoop ? logicalIndex : Math.max(0, Math.min(logicalIndex, maxIndex));
|
|
@@ -6670,7 +6700,7 @@ var Swiper = (props) => {
|
|
|
6670
6700
|
},
|
|
6671
6701
|
[canSlide, useLoop, cloneCount, maxIndex, onChange, moveToInner]
|
|
6672
6702
|
);
|
|
6673
|
-
const slideNext =
|
|
6703
|
+
const slideNext = React33.useCallback(() => {
|
|
6674
6704
|
if (!canSlide) return;
|
|
6675
6705
|
const nextInner = innerIndex + slideBy;
|
|
6676
6706
|
if (useLoop) {
|
|
@@ -6679,7 +6709,7 @@ var Swiper = (props) => {
|
|
|
6679
6709
|
moveToInner(Math.min(nextInner, maxIndex), true);
|
|
6680
6710
|
}
|
|
6681
6711
|
}, [canSlide, useLoop, innerIndex, slideBy, maxIndex, moveToInner]);
|
|
6682
|
-
const slidePrev =
|
|
6712
|
+
const slidePrev = React33.useCallback(() => {
|
|
6683
6713
|
if (!canSlide) return;
|
|
6684
6714
|
const prevInner = innerIndex - slideBy;
|
|
6685
6715
|
if (useLoop) {
|
|
@@ -6688,7 +6718,7 @@ var Swiper = (props) => {
|
|
|
6688
6718
|
moveToInner(Math.max(prevInner, 0), true);
|
|
6689
6719
|
}
|
|
6690
6720
|
}, [canSlide, useLoop, innerIndex, slideBy, moveToInner]);
|
|
6691
|
-
|
|
6721
|
+
React33.useEffect(() => {
|
|
6692
6722
|
if (indexProp === void 0) return;
|
|
6693
6723
|
const clamped = Math.max(0, Math.min(indexProp, maxIndex));
|
|
6694
6724
|
const target = useLoop ? cloneCount + clamped : clamped;
|
|
@@ -6696,12 +6726,12 @@ var Swiper = (props) => {
|
|
|
6696
6726
|
moveToInner(target, true);
|
|
6697
6727
|
}
|
|
6698
6728
|
}, [indexProp]);
|
|
6699
|
-
|
|
6729
|
+
React33.useImperativeHandle(swiperRef, () => ({
|
|
6700
6730
|
slidePrev,
|
|
6701
6731
|
slideNext,
|
|
6702
6732
|
slideTo
|
|
6703
6733
|
}));
|
|
6704
|
-
|
|
6734
|
+
React33.useEffect(() => {
|
|
6705
6735
|
if (!auto || !canSlide || paused) return;
|
|
6706
6736
|
autoplayTimerRef.current = setInterval(slideNext, autoplayDelay);
|
|
6707
6737
|
return () => {
|
|
@@ -6727,7 +6757,7 @@ var Swiper = (props) => {
|
|
|
6727
6757
|
resumeTimeoutRef.current = null;
|
|
6728
6758
|
}, pauseOnInteraction);
|
|
6729
6759
|
};
|
|
6730
|
-
|
|
6760
|
+
React33.useEffect(() => {
|
|
6731
6761
|
return () => {
|
|
6732
6762
|
if (resumeTimeoutRef.current) clearTimeout(resumeTimeoutRef.current);
|
|
6733
6763
|
};
|
|
@@ -6745,7 +6775,7 @@ var Swiper = (props) => {
|
|
|
6745
6775
|
startXRef.current = getClientX(e);
|
|
6746
6776
|
startTimeRef.current = Date.now();
|
|
6747
6777
|
};
|
|
6748
|
-
|
|
6778
|
+
React33.useEffect(() => {
|
|
6749
6779
|
if (!isDragging) return;
|
|
6750
6780
|
const handleMove = (e) => {
|
|
6751
6781
|
setDragOffset(getClientX(e) - startXRef.current);
|
|
@@ -6784,7 +6814,7 @@ var Swiper = (props) => {
|
|
|
6784
6814
|
}, [isDragging, dragOffset, innerIndex, useLoop, maxIndex, slideStep, moveToInner]);
|
|
6785
6815
|
const slideWidthPercent = 100 / viewItemCount;
|
|
6786
6816
|
const gapAdjust = spaceBetween * (viewItemCount - 1) / viewItemCount;
|
|
6787
|
-
const slideElements =
|
|
6817
|
+
const slideElements = React33.useMemo(
|
|
6788
6818
|
() => extendedItems.map((item, idx) => /* @__PURE__ */ jsx342(
|
|
6789
6819
|
"div",
|
|
6790
6820
|
{
|
|
@@ -6858,7 +6888,7 @@ Swiper.displayName = "Swiper";
|
|
|
6858
6888
|
var Swiper_default = Swiper;
|
|
6859
6889
|
|
|
6860
6890
|
// src/components/Switch/Switch.tsx
|
|
6861
|
-
import
|
|
6891
|
+
import React34 from "react";
|
|
6862
6892
|
import { jsx as jsx343 } from "react/jsx-runtime";
|
|
6863
6893
|
var KNOB_TRANSITION_MS = 250;
|
|
6864
6894
|
var Switch = (props) => {
|
|
@@ -6872,11 +6902,11 @@ var Switch = (props) => {
|
|
|
6872
6902
|
label,
|
|
6873
6903
|
required
|
|
6874
6904
|
} = props;
|
|
6875
|
-
const fieldId =
|
|
6905
|
+
const fieldId = React34.useId();
|
|
6876
6906
|
const statusType = normalizeStatus(type);
|
|
6877
|
-
const [isAnimating, setIsAnimating] =
|
|
6878
|
-
const timeoutRef =
|
|
6879
|
-
|
|
6907
|
+
const [isAnimating, setIsAnimating] = React34.useState(false);
|
|
6908
|
+
const timeoutRef = React34.useRef(null);
|
|
6909
|
+
React34.useEffect(() => {
|
|
6880
6910
|
return () => {
|
|
6881
6911
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
6882
6912
|
};
|
|
@@ -6915,10 +6945,10 @@ Switch.displayName = "Switch";
|
|
|
6915
6945
|
var Switch_default = Switch;
|
|
6916
6946
|
|
|
6917
6947
|
// src/components/Table/TableContext.tsx
|
|
6918
|
-
import
|
|
6919
|
-
var TableContext =
|
|
6948
|
+
import React35 from "react";
|
|
6949
|
+
var TableContext = React35.createContext(null);
|
|
6920
6950
|
var useTableContext = () => {
|
|
6921
|
-
const ctx =
|
|
6951
|
+
const ctx = React35.useContext(TableContext);
|
|
6922
6952
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
6923
6953
|
return ctx;
|
|
6924
6954
|
};
|
|
@@ -6961,24 +6991,24 @@ TableBody.displayName = "TableBody";
|
|
|
6961
6991
|
var TableBody_default = TableBody;
|
|
6962
6992
|
|
|
6963
6993
|
// src/components/Table/TableCell.tsx
|
|
6964
|
-
import
|
|
6994
|
+
import React38 from "react";
|
|
6965
6995
|
|
|
6966
6996
|
// src/components/Table/TableHeadContext.tsx
|
|
6967
|
-
import
|
|
6968
|
-
var TableHeadContext =
|
|
6997
|
+
import React36 from "react";
|
|
6998
|
+
var TableHeadContext = React36.createContext(
|
|
6969
6999
|
null
|
|
6970
7000
|
);
|
|
6971
7001
|
var useTableHeadContext = () => {
|
|
6972
|
-
const ctx =
|
|
7002
|
+
const ctx = React36.useContext(TableHeadContext);
|
|
6973
7003
|
return ctx;
|
|
6974
7004
|
};
|
|
6975
7005
|
var TableHeadContext_default = TableHeadContext;
|
|
6976
7006
|
|
|
6977
7007
|
// src/components/Table/TableRowContext.tsx
|
|
6978
|
-
import
|
|
6979
|
-
var TableRowContext =
|
|
7008
|
+
import React37 from "react";
|
|
7009
|
+
var TableRowContext = React37.createContext(null);
|
|
6980
7010
|
var useTableRowContext = () => {
|
|
6981
|
-
const ctx =
|
|
7011
|
+
const ctx = React37.useContext(TableRowContext);
|
|
6982
7012
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
6983
7013
|
return ctx;
|
|
6984
7014
|
};
|
|
@@ -6986,7 +7016,7 @@ var TableRowContext_default = TableRowContext;
|
|
|
6986
7016
|
|
|
6987
7017
|
// src/components/Table/TableCell.tsx
|
|
6988
7018
|
import { jsx as jsx346 } from "react/jsx-runtime";
|
|
6989
|
-
var TableCell =
|
|
7019
|
+
var TableCell = React38.memo((props) => {
|
|
6990
7020
|
const {
|
|
6991
7021
|
children,
|
|
6992
7022
|
align = "center",
|
|
@@ -7000,9 +7030,9 @@ var TableCell = React37.memo((props) => {
|
|
|
7000
7030
|
const { registerStickyCell, stickyCells } = useTableRowContext();
|
|
7001
7031
|
const { stickyShadow } = useTableContext();
|
|
7002
7032
|
const headContext = useTableHeadContext();
|
|
7003
|
-
const [left, setLeft] =
|
|
7004
|
-
const cellRef =
|
|
7005
|
-
const calculateLeft =
|
|
7033
|
+
const [left, setLeft] = React38.useState(0);
|
|
7034
|
+
const cellRef = React38.useRef(null);
|
|
7035
|
+
const calculateLeft = React38.useCallback(() => {
|
|
7006
7036
|
if (!cellRef.current) return 0;
|
|
7007
7037
|
let totalLeft = 0;
|
|
7008
7038
|
for (const ref of stickyCells) {
|
|
@@ -7011,7 +7041,7 @@ var TableCell = React37.memo((props) => {
|
|
|
7011
7041
|
}
|
|
7012
7042
|
return totalLeft;
|
|
7013
7043
|
}, [stickyCells]);
|
|
7014
|
-
|
|
7044
|
+
React38.useEffect(() => {
|
|
7015
7045
|
if (!isSticky || !cellRef.current) return;
|
|
7016
7046
|
registerStickyCell(cellRef);
|
|
7017
7047
|
setLeft(calculateLeft());
|
|
@@ -7069,9 +7099,9 @@ TableHead.displayName = "TableHead";
|
|
|
7069
7099
|
var TableHead_default = TableHead;
|
|
7070
7100
|
|
|
7071
7101
|
// src/components/Table/TableRow.tsx
|
|
7072
|
-
import
|
|
7102
|
+
import React39 from "react";
|
|
7073
7103
|
import { jsx as jsx348 } from "react/jsx-runtime";
|
|
7074
|
-
var TableRow =
|
|
7104
|
+
var TableRow = React39.memo((props) => {
|
|
7075
7105
|
const {
|
|
7076
7106
|
children,
|
|
7077
7107
|
type = "secondary",
|
|
@@ -7080,7 +7110,7 @@ var TableRow = React38.memo((props) => {
|
|
|
7080
7110
|
onClick
|
|
7081
7111
|
} = props;
|
|
7082
7112
|
const { rowBorderUse } = useTableContext();
|
|
7083
|
-
const [stickyCells, setStickyCells] =
|
|
7113
|
+
const [stickyCells, setStickyCells] = React39.useState([]);
|
|
7084
7114
|
const registerStickyCell = (ref) => {
|
|
7085
7115
|
setStickyCells((prev) => {
|
|
7086
7116
|
if (prev.includes(ref)) return prev;
|
|
@@ -7144,9 +7174,9 @@ Tag.displayName = "Tag";
|
|
|
7144
7174
|
var Tag_default = Tag;
|
|
7145
7175
|
|
|
7146
7176
|
// src/components/TextArea/TextArea.tsx
|
|
7147
|
-
import
|
|
7177
|
+
import React40 from "react";
|
|
7148
7178
|
import { jsx as jsx350 } from "react/jsx-runtime";
|
|
7149
|
-
var TextArea =
|
|
7179
|
+
var TextArea = React40.forwardRef(
|
|
7150
7180
|
(props, ref) => {
|
|
7151
7181
|
const {
|
|
7152
7182
|
className,
|
|
@@ -7159,7 +7189,7 @@ var TextArea = React39.forwardRef(
|
|
|
7159
7189
|
disabled,
|
|
7160
7190
|
...textareaProps
|
|
7161
7191
|
} = props;
|
|
7162
|
-
const autoId =
|
|
7192
|
+
const autoId = React40.useId();
|
|
7163
7193
|
const fieldId = props.id ?? autoId;
|
|
7164
7194
|
const control = /* @__PURE__ */ jsx350("div", { className: clsx_default("lib-xplat-textarea-wrap", className), children: /* @__PURE__ */ jsx350(
|
|
7165
7195
|
"textarea",
|
|
@@ -7181,7 +7211,7 @@ TextArea.displayName = "TextArea";
|
|
|
7181
7211
|
var TextArea_default = TextArea;
|
|
7182
7212
|
|
|
7183
7213
|
// src/components/TimePicker/TimePicker.tsx
|
|
7184
|
-
import
|
|
7214
|
+
import React41 from "react";
|
|
7185
7215
|
import { jsx as jsx351, jsxs as jsxs222 } from "react/jsx-runtime";
|
|
7186
7216
|
var ANIMATION_DURATION_MS4 = 200;
|
|
7187
7217
|
var toMinutes = (hhmm) => {
|
|
@@ -7219,13 +7249,13 @@ var TimePicker = (props) => {
|
|
|
7219
7249
|
required,
|
|
7220
7250
|
validations
|
|
7221
7251
|
} = props;
|
|
7222
|
-
const fieldId =
|
|
7223
|
-
const triggerRef =
|
|
7224
|
-
const contentRef =
|
|
7225
|
-
const [isOpen, setOpen] =
|
|
7226
|
-
const [mounted, setMounted] =
|
|
7227
|
-
const [visible, setVisible] =
|
|
7228
|
-
const options =
|
|
7252
|
+
const fieldId = React41.useId();
|
|
7253
|
+
const triggerRef = React41.useRef(null);
|
|
7254
|
+
const contentRef = React41.useRef(null);
|
|
7255
|
+
const [isOpen, setOpen] = React41.useState(false);
|
|
7256
|
+
const [mounted, setMounted] = React41.useState(false);
|
|
7257
|
+
const [visible, setVisible] = React41.useState(false);
|
|
7258
|
+
const options = React41.useMemo(() => {
|
|
7229
7259
|
const safeStep = step > 0 && step <= 720 ? step : 30;
|
|
7230
7260
|
const lo = toMinutes(min) ?? 0;
|
|
7231
7261
|
const hi = toMinutes(max) ?? 24 * 60 - 1;
|
|
@@ -7233,18 +7263,19 @@ var TimePicker = (props) => {
|
|
|
7233
7263
|
for (let t = lo; t <= hi; t += safeStep) out.push(toHHmm(t));
|
|
7234
7264
|
return out;
|
|
7235
7265
|
}, [step, min, max]);
|
|
7236
|
-
const close =
|
|
7266
|
+
const close = React41.useCallback(() => setOpen(false), []);
|
|
7237
7267
|
useClickOutside_default([triggerRef, contentRef], close, isOpen);
|
|
7238
7268
|
useCloseWhenFocusHidden(isOpen, triggerRef, contentRef, close);
|
|
7239
7269
|
useEscapeKey(isOpen, () => {
|
|
7240
7270
|
close();
|
|
7241
7271
|
triggerRef.current?.focus({ preventScroll: true });
|
|
7242
7272
|
});
|
|
7273
|
+
const host = useOverlayHost_default(triggerRef, mounted);
|
|
7243
7274
|
useAutoPosition_default(triggerRef, contentRef, mounted);
|
|
7244
|
-
|
|
7275
|
+
React41.useEffect(() => {
|
|
7245
7276
|
if (disabled && isOpen) setOpen(false);
|
|
7246
7277
|
}, [disabled, isOpen]);
|
|
7247
|
-
|
|
7278
|
+
React41.useEffect(() => {
|
|
7248
7279
|
if (isOpen) {
|
|
7249
7280
|
setMounted(true);
|
|
7250
7281
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -7282,7 +7313,7 @@ var TimePicker = (props) => {
|
|
|
7282
7313
|
children: /* @__PURE__ */ jsx351("span", { className: clsx_default("time-picker-value", !value && "placeholder"), children: value ? display(value, use12Hours) : placeholder })
|
|
7283
7314
|
}
|
|
7284
7315
|
),
|
|
7285
|
-
mounted && /* @__PURE__ */ jsx351(Portal_default, { children: /* @__PURE__ */ jsx351(
|
|
7316
|
+
mounted && /* @__PURE__ */ jsx351(Portal_default, { container: host, children: /* @__PURE__ */ jsx351(
|
|
7286
7317
|
"div",
|
|
7287
7318
|
{
|
|
7288
7319
|
ref: contentRef,
|
|
@@ -7316,20 +7347,20 @@ TimePicker.displayName = "TimePicker";
|
|
|
7316
7347
|
var TimePicker_default = TimePicker;
|
|
7317
7348
|
|
|
7318
7349
|
// src/components/Toast/Toast.tsx
|
|
7319
|
-
import
|
|
7350
|
+
import React42 from "react";
|
|
7320
7351
|
import { createPortal as createPortal3 } from "react-dom";
|
|
7321
7352
|
import { jsx as jsx352, jsxs as jsxs223 } from "react/jsx-runtime";
|
|
7322
|
-
var ToastContext =
|
|
7353
|
+
var ToastContext = React42.createContext(null);
|
|
7323
7354
|
var useToast = () => {
|
|
7324
|
-
const ctx =
|
|
7355
|
+
const ctx = React42.useContext(ToastContext);
|
|
7325
7356
|
if (!ctx) throw new Error("useToast must be used within ToastProvider");
|
|
7326
7357
|
return ctx;
|
|
7327
7358
|
};
|
|
7328
7359
|
var EXIT_DURATION = 300;
|
|
7329
7360
|
var ToastItemComponent = ({ item, isExiting, onClose }) => {
|
|
7330
|
-
const ref =
|
|
7331
|
-
const [height, setHeight] =
|
|
7332
|
-
|
|
7361
|
+
const ref = React42.useRef(null);
|
|
7362
|
+
const [height, setHeight] = React42.useState(void 0);
|
|
7363
|
+
React42.useEffect(() => {
|
|
7333
7364
|
if (ref.current && !isExiting) {
|
|
7334
7365
|
setHeight(ref.current.offsetHeight);
|
|
7335
7366
|
}
|
|
@@ -7361,13 +7392,13 @@ var ToastProvider = ({
|
|
|
7361
7392
|
children,
|
|
7362
7393
|
position = "top-right"
|
|
7363
7394
|
}) => {
|
|
7364
|
-
const [toasts, setToasts] =
|
|
7365
|
-
const [removing, setRemoving] =
|
|
7366
|
-
const [mounted, setMounted] =
|
|
7367
|
-
|
|
7395
|
+
const [toasts, setToasts] = React42.useState([]);
|
|
7396
|
+
const [removing, setRemoving] = React42.useState(/* @__PURE__ */ new Set());
|
|
7397
|
+
const [mounted, setMounted] = React42.useState(false);
|
|
7398
|
+
React42.useEffect(() => {
|
|
7368
7399
|
setMounted(true);
|
|
7369
7400
|
}, []);
|
|
7370
|
-
const remove =
|
|
7401
|
+
const remove = React42.useCallback((id) => {
|
|
7371
7402
|
setRemoving((prev) => new Set(prev).add(id));
|
|
7372
7403
|
setTimeout(() => {
|
|
7373
7404
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
@@ -7378,7 +7409,7 @@ var ToastProvider = ({
|
|
|
7378
7409
|
});
|
|
7379
7410
|
}, EXIT_DURATION);
|
|
7380
7411
|
}, []);
|
|
7381
|
-
const toast =
|
|
7412
|
+
const toast = React42.useCallback(
|
|
7382
7413
|
(type, message, duration = 3e3) => {
|
|
7383
7414
|
const id = `${Date.now()}-${Math.random()}`;
|
|
7384
7415
|
setToasts((prev) => [...prev, { id, type, message }]);
|
|
@@ -7431,7 +7462,7 @@ ToggleChip.displayName = "ToggleChip";
|
|
|
7431
7462
|
var ToggleChip_default = ToggleChip;
|
|
7432
7463
|
|
|
7433
7464
|
// src/components/Tooltip/Tooltip.tsx
|
|
7434
|
-
import
|
|
7465
|
+
import React43 from "react";
|
|
7435
7466
|
import { Fragment as Fragment6, jsx as jsx354, jsxs as jsxs224 } from "react/jsx-runtime";
|
|
7436
7467
|
var OFFSET = 12;
|
|
7437
7468
|
var GAP = 8;
|
|
@@ -7447,14 +7478,14 @@ var Tooltip = (props) => {
|
|
|
7447
7478
|
disabled = false
|
|
7448
7479
|
} = props;
|
|
7449
7480
|
const shape = variant ?? type ?? "dark";
|
|
7450
|
-
const triggerRef =
|
|
7451
|
-
const tooltipRef =
|
|
7452
|
-
const [visible, setVisible] =
|
|
7453
|
-
const [pos, setPos] =
|
|
7454
|
-
const delayTimer =
|
|
7455
|
-
const rafRef =
|
|
7456
|
-
const cursor =
|
|
7457
|
-
const clamp =
|
|
7481
|
+
const triggerRef = React43.useRef(null);
|
|
7482
|
+
const tooltipRef = React43.useRef(null);
|
|
7483
|
+
const [visible, setVisible] = React43.useState(false);
|
|
7484
|
+
const [pos, setPos] = React43.useState({ left: 0, top: 0 });
|
|
7485
|
+
const delayTimer = React43.useRef(0);
|
|
7486
|
+
const rafRef = React43.useRef(0);
|
|
7487
|
+
const cursor = React43.useRef(null);
|
|
7488
|
+
const clamp = React43.useCallback((left, top, w, h) => {
|
|
7458
7489
|
const vw = window.innerWidth;
|
|
7459
7490
|
const vh = window.innerHeight;
|
|
7460
7491
|
return {
|
|
@@ -7462,7 +7493,7 @@ var Tooltip = (props) => {
|
|
|
7462
7493
|
top: Math.min(Math.max(GAP, top), Math.max(GAP, vh - h - GAP))
|
|
7463
7494
|
};
|
|
7464
7495
|
}, []);
|
|
7465
|
-
const placeAtCursor =
|
|
7496
|
+
const placeAtCursor = React43.useCallback((x, y) => {
|
|
7466
7497
|
const el = tooltipRef.current;
|
|
7467
7498
|
if (!el) return;
|
|
7468
7499
|
const w = el.offsetWidth;
|
|
@@ -7473,7 +7504,7 @@ var Tooltip = (props) => {
|
|
|
7473
7504
|
if (top < GAP) top = y + OFFSET;
|
|
7474
7505
|
setPos(clamp(left, top, w, h));
|
|
7475
7506
|
}, [clamp]);
|
|
7476
|
-
const placeAtTrigger =
|
|
7507
|
+
const placeAtTrigger = React43.useCallback(() => {
|
|
7477
7508
|
const el = tooltipRef.current;
|
|
7478
7509
|
const trigger = triggerRef.current;
|
|
7479
7510
|
if (!el || !trigger) return;
|
|
@@ -7485,19 +7516,19 @@ var Tooltip = (props) => {
|
|
|
7485
7516
|
const left = rect.left + rect.width / 2 - w / 2;
|
|
7486
7517
|
setPos(clamp(left, top, w, h));
|
|
7487
7518
|
}, [clamp]);
|
|
7488
|
-
const reposition =
|
|
7519
|
+
const reposition = React43.useCallback(() => {
|
|
7489
7520
|
if (follow && cursor.current) {
|
|
7490
7521
|
placeAtCursor(cursor.current.x, cursor.current.y);
|
|
7491
7522
|
} else {
|
|
7492
7523
|
placeAtTrigger();
|
|
7493
7524
|
}
|
|
7494
7525
|
}, [follow, placeAtCursor, placeAtTrigger]);
|
|
7495
|
-
const handleMouseEnter =
|
|
7526
|
+
const handleMouseEnter = React43.useCallback((e) => {
|
|
7496
7527
|
if (disabled) return;
|
|
7497
7528
|
cursor.current = { x: e.clientX, y: e.clientY };
|
|
7498
7529
|
delayTimer.current = window.setTimeout(() => setVisible(true), SHOW_DELAY);
|
|
7499
7530
|
}, [disabled]);
|
|
7500
|
-
const handleMouseMove =
|
|
7531
|
+
const handleMouseMove = React43.useCallback((e) => {
|
|
7501
7532
|
cursor.current = { x: e.clientX, y: e.clientY };
|
|
7502
7533
|
if (!visible || !follow) return;
|
|
7503
7534
|
cancelAnimationFrame(rafRef.current);
|
|
@@ -7505,25 +7536,25 @@ var Tooltip = (props) => {
|
|
|
7505
7536
|
if (cursor.current) placeAtCursor(cursor.current.x, cursor.current.y);
|
|
7506
7537
|
});
|
|
7507
7538
|
}, [visible, follow, placeAtCursor]);
|
|
7508
|
-
const close =
|
|
7539
|
+
const close = React43.useCallback(() => {
|
|
7509
7540
|
window.clearTimeout(delayTimer.current);
|
|
7510
7541
|
cancelAnimationFrame(rafRef.current);
|
|
7511
7542
|
setVisible(false);
|
|
7512
7543
|
}, []);
|
|
7513
|
-
const handleMouseLeave =
|
|
7544
|
+
const handleMouseLeave = React43.useCallback(() => {
|
|
7514
7545
|
cursor.current = null;
|
|
7515
7546
|
close();
|
|
7516
7547
|
}, [close]);
|
|
7517
|
-
const handleFocus =
|
|
7548
|
+
const handleFocus = React43.useCallback(() => {
|
|
7518
7549
|
if (disabled) return;
|
|
7519
7550
|
cursor.current = null;
|
|
7520
7551
|
setVisible(true);
|
|
7521
7552
|
}, [disabled]);
|
|
7522
|
-
|
|
7553
|
+
React43.useLayoutEffect(() => {
|
|
7523
7554
|
if (!visible) return;
|
|
7524
7555
|
reposition();
|
|
7525
7556
|
}, [visible, reposition]);
|
|
7526
|
-
|
|
7557
|
+
React43.useEffect(() => {
|
|
7527
7558
|
if (!visible || follow) return;
|
|
7528
7559
|
const onChange = () => placeAtTrigger();
|
|
7529
7560
|
window.addEventListener("scroll", onChange, true);
|
|
@@ -7533,7 +7564,7 @@ var Tooltip = (props) => {
|
|
|
7533
7564
|
window.removeEventListener("resize", onChange);
|
|
7534
7565
|
};
|
|
7535
7566
|
}, [visible, follow, placeAtTrigger]);
|
|
7536
|
-
|
|
7567
|
+
React43.useEffect(() => () => {
|
|
7537
7568
|
window.clearTimeout(delayTimer.current);
|
|
7538
7569
|
cancelAnimationFrame(rafRef.current);
|
|
7539
7570
|
}, []);
|
|
@@ -7572,7 +7603,7 @@ Tooltip.displayName = "Tooltip";
|
|
|
7572
7603
|
var Tooltip_default = Tooltip;
|
|
7573
7604
|
|
|
7574
7605
|
// src/components/Video/Video.tsx
|
|
7575
|
-
import
|
|
7606
|
+
import React44 from "react";
|
|
7576
7607
|
import { jsx as jsx355, jsxs as jsxs225 } from "react/jsx-runtime";
|
|
7577
7608
|
var PipIcon = () => /* @__PURE__ */ jsxs225("svg", { viewBox: "0 0 24 24", width: "1em", height: "1em", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
7578
7609
|
/* @__PURE__ */ jsx355("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
|
|
@@ -7584,7 +7615,7 @@ var formatTime = (sec) => {
|
|
|
7584
7615
|
const s = Math.floor(sec % 60);
|
|
7585
7616
|
return `${m}:${s.toString().padStart(2, "0")}`;
|
|
7586
7617
|
};
|
|
7587
|
-
var Video =
|
|
7618
|
+
var Video = React44.forwardRef((props, ref) => {
|
|
7588
7619
|
const {
|
|
7589
7620
|
src,
|
|
7590
7621
|
poster,
|
|
@@ -7608,21 +7639,21 @@ var Video = React43.forwardRef((props, ref) => {
|
|
|
7608
7639
|
children,
|
|
7609
7640
|
...rest
|
|
7610
7641
|
} = props;
|
|
7611
|
-
const containerRef =
|
|
7612
|
-
const videoRef =
|
|
7613
|
-
const [isPlaying, setIsPlaying] =
|
|
7614
|
-
const [isLoaded, setIsLoaded] =
|
|
7615
|
-
const [currentTime, setCurrentTime] =
|
|
7616
|
-
const [duration, setDuration] =
|
|
7617
|
-
const [buffered, setBuffered] =
|
|
7618
|
-
const [volume, setVolume] =
|
|
7619
|
-
const [isMuted, setIsMuted] =
|
|
7620
|
-
const [isFullscreen, setIsFullscreen] =
|
|
7621
|
-
const [playbackRate, setPlaybackRate] =
|
|
7622
|
-
const [rateMenuOpen, setRateMenuOpen] =
|
|
7623
|
-
const [captionsOn, setCaptionsOn] =
|
|
7624
|
-
const [isPip, setIsPip] =
|
|
7625
|
-
const setRefs =
|
|
7642
|
+
const containerRef = React44.useRef(null);
|
|
7643
|
+
const videoRef = React44.useRef(null);
|
|
7644
|
+
const [isPlaying, setIsPlaying] = React44.useState(Boolean(autoPlay));
|
|
7645
|
+
const [isLoaded, setIsLoaded] = React44.useState(false);
|
|
7646
|
+
const [currentTime, setCurrentTime] = React44.useState(0);
|
|
7647
|
+
const [duration, setDuration] = React44.useState(0);
|
|
7648
|
+
const [buffered, setBuffered] = React44.useState(0);
|
|
7649
|
+
const [volume, setVolume] = React44.useState(1);
|
|
7650
|
+
const [isMuted, setIsMuted] = React44.useState(Boolean(muted));
|
|
7651
|
+
const [isFullscreen, setIsFullscreen] = React44.useState(false);
|
|
7652
|
+
const [playbackRate, setPlaybackRate] = React44.useState(1);
|
|
7653
|
+
const [rateMenuOpen, setRateMenuOpen] = React44.useState(false);
|
|
7654
|
+
const [captionsOn, setCaptionsOn] = React44.useState(false);
|
|
7655
|
+
const [isPip, setIsPip] = React44.useState(false);
|
|
7656
|
+
const setRefs = React44.useCallback(
|
|
7626
7657
|
(el) => {
|
|
7627
7658
|
videoRef.current = el;
|
|
7628
7659
|
if (typeof ref === "function") ref(el);
|
|
@@ -7630,14 +7661,14 @@ var Video = React43.forwardRef((props, ref) => {
|
|
|
7630
7661
|
},
|
|
7631
7662
|
[ref]
|
|
7632
7663
|
);
|
|
7633
|
-
|
|
7664
|
+
React44.useEffect(() => {
|
|
7634
7665
|
const onFsChange = () => {
|
|
7635
7666
|
setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
7636
7667
|
};
|
|
7637
7668
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
7638
7669
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
7639
7670
|
}, []);
|
|
7640
|
-
|
|
7671
|
+
React44.useEffect(() => {
|
|
7641
7672
|
const v = videoRef.current;
|
|
7642
7673
|
if (!v) return;
|
|
7643
7674
|
const onEnter = () => setIsPip(true);
|