@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/index.js CHANGED
@@ -7237,8 +7237,10 @@ import React11 from "react";
7237
7237
  import React10 from "react";
7238
7238
  var findScrollParent = (el) => {
7239
7239
  for (let p = el.parentElement; p; p = p.parentElement) {
7240
- const { overflowY, overflowX } = getComputedStyle(p);
7241
- if (/(auto|scroll)/.test(overflowY) || /(auto|scroll)/.test(overflowX)) return p;
7240
+ if (p.dataset.xplatOverlayEscape !== void 0) continue;
7241
+ const { overflowY } = getComputedStyle(p);
7242
+ if (!/(auto|scroll)/.test(overflowY)) continue;
7243
+ if (p.scrollHeight > p.clientHeight) return p;
7242
7244
  }
7243
7245
  return null;
7244
7246
  };
@@ -7334,8 +7336,9 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
7334
7336
  );
7335
7337
  if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
7336
7338
  const maxHeight = frozenMaxRef.current;
7337
- pop.style.top = `${top + window.scrollY}px`;
7338
- pop.style.left = `${left + window.scrollX}px`;
7339
+ const hostRect = (pop.offsetParent ?? pop.parentElement)?.getBoundingClientRect();
7340
+ pop.style.top = `${top - (hostRect?.top ?? 0)}px`;
7341
+ pop.style.left = `${left - (hostRect?.left ?? 0)}px`;
7339
7342
  pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
7340
7343
  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";
7341
7344
  directionRef.current = next;
@@ -8137,13 +8140,13 @@ Drawer.displayName = "Drawer";
8137
8140
  var Drawer_default = Drawer;
8138
8141
 
8139
8142
  // src/components/Dropdown/Dropdown.tsx
8140
- import React21 from "react";
8143
+ import React22 from "react";
8141
8144
 
8142
8145
  // src/tokens/hooks/Portal.tsx
8143
8146
  import ReactDOM from "react-dom";
8144
- var Portal = ({ children }) => {
8147
+ var Portal = ({ children, container }) => {
8145
8148
  if (typeof document === "undefined") return null;
8146
- return ReactDOM.createPortal(children, document.body);
8149
+ return ReactDOM.createPortal(children, container ?? document.body);
8147
8150
  };
8148
8151
  Portal.displayName = "Portal";
8149
8152
  var Portal_default = Portal;
@@ -8173,15 +8176,42 @@ var useClickOutside = (refs, handler, enabled = true) => {
8173
8176
  };
8174
8177
  var useClickOutside_default = useClickOutside;
8175
8178
 
8179
+ // src/tokens/hooks/useOverlayHost.ts
8180
+ import React21 from "react";
8181
+ var useOverlayHost = (triggerRef, enabled) => {
8182
+ const [host, setHost] = React21.useState(null);
8183
+ React21.useLayoutEffect(() => {
8184
+ if (!enabled || !triggerRef.current) {
8185
+ setHost(null);
8186
+ return;
8187
+ }
8188
+ const el = document.createElement("div");
8189
+ el.dataset.xplatOverlayHost = "";
8190
+ el.style.position = "relative";
8191
+ el.style.width = "0";
8192
+ el.style.height = "0";
8193
+ const parent = findScrollParent(triggerRef.current) ?? document.body;
8194
+ parent.appendChild(el);
8195
+ setHost(el);
8196
+ return () => {
8197
+ el.remove();
8198
+ setHost(null);
8199
+ };
8200
+ }, [enabled, triggerRef]);
8201
+ return host;
8202
+ };
8203
+ var useOverlayHost_default = useOverlayHost;
8204
+
8176
8205
  // src/components/Dropdown/Dropdown.tsx
8177
8206
  import { jsx as jsx322, jsxs as jsxs206 } from "react/jsx-runtime";
8178
8207
  var Dropdown = (props) => {
8179
8208
  const { items, children } = props;
8180
- const [isOpen, setIsOpen] = React21.useState(false);
8181
- const [mounted, setMounted] = React21.useState(false);
8182
- const [visible, setVisible] = React21.useState(false);
8183
- const triggerRef = React21.useRef(null);
8184
- const menuRef = React21.useRef(null);
8209
+ const [isOpen, setIsOpen] = React22.useState(false);
8210
+ const [mounted, setMounted] = React22.useState(false);
8211
+ const [visible, setVisible] = React22.useState(false);
8212
+ const triggerRef = React22.useRef(null);
8213
+ const menuRef = React22.useRef(null);
8214
+ const host = useOverlayHost_default(triggerRef, mounted);
8185
8215
  useAutoPosition_default(triggerRef, menuRef, mounted);
8186
8216
  useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false), isOpen);
8187
8217
  useCloseWhenFocusHidden(isOpen, triggerRef, menuRef, () => setIsOpen(false));
@@ -8189,7 +8219,7 @@ var Dropdown = (props) => {
8189
8219
  setIsOpen(false);
8190
8220
  triggerRef.current?.focus({ preventScroll: true });
8191
8221
  });
8192
- React21.useEffect(() => {
8222
+ React22.useEffect(() => {
8193
8223
  if (isOpen) {
8194
8224
  setMounted(true);
8195
8225
  const t2 = setTimeout(() => setVisible(true), 1);
@@ -8214,7 +8244,7 @@ var Dropdown = (props) => {
8214
8244
  children
8215
8245
  }
8216
8246
  ),
8217
- mounted && /* @__PURE__ */ jsx322(Portal_default, { children: /* @__PURE__ */ jsx322(
8247
+ mounted && /* @__PURE__ */ jsx322(Portal_default, { container: host, children: /* @__PURE__ */ jsx322(
8218
8248
  "div",
8219
8249
  {
8220
8250
  ref: menuRef,
@@ -8242,7 +8272,7 @@ Dropdown.displayName = "Dropdown";
8242
8272
  var Dropdown_default = Dropdown;
8243
8273
 
8244
8274
  // src/components/Editor/Editor.tsx
8245
- import React22 from "react";
8275
+ import React23 from "react";
8246
8276
 
8247
8277
  // src/components/Editor/highlight.ts
8248
8278
  var CODE_LANGUAGES = [
@@ -8513,22 +8543,22 @@ var Editor = (props) => {
8513
8543
  onImageUpload,
8514
8544
  minHeight = 200
8515
8545
  } = props;
8516
- const editorRef = React22.useRef(null);
8517
- const lastRangeRef = React22.useRef(null);
8518
- const composingRef = React22.useRef(false);
8519
- const [isFocused, setIsFocused] = React22.useState(false);
8520
- const [isEmpty, setIsEmpty] = React22.useState(!value);
8521
- const [activeFormats, setActiveFormats] = React22.useState(/* @__PURE__ */ new Set());
8522
- const [slashOpen, setSlashOpen] = React22.useState(false);
8523
- const [slashFilter, setSlashFilter] = React22.useState("");
8524
- const [slashIdx, setSlashIdx] = React22.useState(0);
8525
- const [slashPos, setSlashPos] = React22.useState({ top: 0, left: 0 });
8526
- const slashStartRangeRef = React22.useRef(null);
8527
- const [linkOpen, setLinkOpen] = React22.useState(false);
8528
- const [linkValue, setLinkValue] = React22.useState("");
8529
- const [linkPos, setLinkPos] = React22.useState({ top: 0, left: 0 });
8530
- const lastEmittedRef = React22.useRef(null);
8531
- React22.useEffect(() => {
8546
+ const editorRef = React23.useRef(null);
8547
+ const lastRangeRef = React23.useRef(null);
8548
+ const composingRef = React23.useRef(false);
8549
+ const [isFocused, setIsFocused] = React23.useState(false);
8550
+ const [isEmpty, setIsEmpty] = React23.useState(!value);
8551
+ const [activeFormats, setActiveFormats] = React23.useState(/* @__PURE__ */ new Set());
8552
+ const [slashOpen, setSlashOpen] = React23.useState(false);
8553
+ const [slashFilter, setSlashFilter] = React23.useState("");
8554
+ const [slashIdx, setSlashIdx] = React23.useState(0);
8555
+ const [slashPos, setSlashPos] = React23.useState({ top: 0, left: 0 });
8556
+ const slashStartRangeRef = React23.useRef(null);
8557
+ const [linkOpen, setLinkOpen] = React23.useState(false);
8558
+ const [linkValue, setLinkValue] = React23.useState("");
8559
+ const [linkPos, setLinkPos] = React23.useState({ top: 0, left: 0 });
8560
+ const lastEmittedRef = React23.useRef(null);
8561
+ React23.useEffect(() => {
8532
8562
  const el = editorRef.current;
8533
8563
  if (!el) return;
8534
8564
  if (value === lastEmittedRef.current) return;
@@ -8610,10 +8640,10 @@ var Editor = (props) => {
8610
8640
  const current = String(document.queryCommandValue("formatBlock") || "").toLowerCase();
8611
8641
  setBlock(current === tag ? "p" : tag);
8612
8642
  };
8613
- const historyRef = React22.useRef([]);
8614
- const historyIdxRef = React22.useRef(-1);
8615
- const lastPushAtRef = React22.useRef(0);
8616
- const isRestoringRef = React22.useRef(false);
8643
+ const historyRef = React23.useRef([]);
8644
+ const historyIdxRef = React23.useRef(-1);
8645
+ const lastPushAtRef = React23.useRef(0);
8646
+ const isRestoringRef = React23.useRef(false);
8617
8647
  const caretOffset = (rootEl) => {
8618
8648
  const el = rootEl ?? editorRef.current;
8619
8649
  const sel = window.getSelection();
@@ -8690,8 +8720,8 @@ var Editor = (props) => {
8690
8720
  const cls = Array.from(pre.classList).find((c) => c.startsWith("lang-"));
8691
8721
  return cls?.slice(5) ?? "plain";
8692
8722
  };
8693
- const [codeLang, setCodeLang] = React22.useState("plain");
8694
- const highlightRafRef = React22.useRef(0);
8723
+ const [codeLang, setCodeLang] = React23.useState("plain");
8724
+ const highlightRafRef = React23.useRef(0);
8695
8725
  const rehighlight = (pre) => {
8696
8726
  if (composingRef.current) return;
8697
8727
  const code = pre.querySelector("code");
@@ -9036,7 +9066,7 @@ var Editor = (props) => {
9036
9066
  setSlashIdx(0);
9037
9067
  slashStartRangeRef.current = null;
9038
9068
  };
9039
- const filteredSlashItems = React22.useMemo(() => {
9069
+ const filteredSlashItems = React23.useMemo(() => {
9040
9070
  if (!slashFilter) return SLASH_ITEMS;
9041
9071
  const f = slashFilter.toLowerCase();
9042
9072
  return SLASH_ITEMS.filter((it) => it.label.toLowerCase().includes(f) || it.key.includes(f));
@@ -9301,7 +9331,7 @@ var Editor = (props) => {
9301
9331
  }
9302
9332
  }
9303
9333
  };
9304
- const plainPasteRef = React22.useRef(false);
9334
+ const plainPasteRef = React23.useRef(false);
9305
9335
  const handlePaste = (e) => {
9306
9336
  if (readOnly) return;
9307
9337
  e.preventDefault();
@@ -9602,7 +9632,7 @@ var EditorToolbar = ({
9602
9632
  ] });
9603
9633
  };
9604
9634
  var SlashMenu = ({ position, items, activeIndex, onSelect, onClose }) => {
9605
- React22.useEffect(() => {
9635
+ React23.useEffect(() => {
9606
9636
  const handleClickOutside = (e) => {
9607
9637
  const target = e.target;
9608
9638
  const menu = document.querySelector(".lib-xplat-editor__slash-menu");
@@ -9636,8 +9666,8 @@ var SlashMenu = ({ position, items, activeIndex, onSelect, onClose }) => {
9636
9666
  );
9637
9667
  };
9638
9668
  var LinkPopover = ({ position, value, onChange, onConfirm, onClose }) => {
9639
- const inputRef = React22.useRef(null);
9640
- React22.useEffect(() => {
9669
+ const inputRef = React23.useRef(null);
9670
+ React23.useEffect(() => {
9641
9671
  inputRef.current?.focus();
9642
9672
  }, []);
9643
9673
  return /* @__PURE__ */ jsxs207(
@@ -9695,7 +9725,7 @@ EmptyState.displayName = "EmptyState";
9695
9725
  var EmptyState_default = EmptyState;
9696
9726
 
9697
9727
  // src/components/FileUpload/FileUpload.tsx
9698
- import React23 from "react";
9728
+ import React24 from "react";
9699
9729
  import { jsx as jsx325, jsxs as jsxs209 } from "react/jsx-runtime";
9700
9730
  var FileUpload = (props) => {
9701
9731
  const {
@@ -9709,9 +9739,9 @@ var FileUpload = (props) => {
9709
9739
  label,
9710
9740
  required
9711
9741
  } = props;
9712
- const fieldId = React23.useId();
9713
- const [isDragOver, setIsDragOver] = React23.useState(false);
9714
- const inputRef = React23.useRef(null);
9742
+ const fieldId = React24.useId();
9743
+ const [isDragOver, setIsDragOver] = React24.useState(false);
9744
+ const inputRef = React24.useRef(null);
9715
9745
  const handleFiles = (fileList) => {
9716
9746
  let files = Array.from(fileList);
9717
9747
  if (maxSize) {
@@ -9774,10 +9804,10 @@ FileUpload.displayName = "FileUpload";
9774
9804
  var FileUpload_default = FileUpload;
9775
9805
 
9776
9806
  // src/components/HtmlTypeWriter/HtmlTypeWriter.tsx
9777
- import React25 from "react";
9807
+ import React26 from "react";
9778
9808
 
9779
9809
  // src/components/HtmlTypeWriter/utils.ts
9780
- import React24 from "react";
9810
+ import React25 from "react";
9781
9811
  var voidTags = /* @__PURE__ */ new Set([
9782
9812
  "br",
9783
9813
  "img",
@@ -9845,15 +9875,15 @@ var convertNodeToReactWithRange = (node, typedLen, rangeMap) => {
9845
9875
  props[attr.name] = attr.value;
9846
9876
  });
9847
9877
  if (voidTags.has(tag)) {
9848
- return React24.createElement(tag, props);
9878
+ return React25.createElement(tag, props);
9849
9879
  }
9850
9880
  const children = Array.from(element.childNodes).map((child) => convertNodeToReactWithRange(child, typedLen, rangeMap)).filter((n) => n != null);
9851
- return React24.createElement(tag, props, ...children);
9881
+ return React25.createElement(tag, props, ...children);
9852
9882
  };
9853
9883
  var htmlToReactProgressive = (root, typedLen, rangeMap) => {
9854
9884
  const nodes = Array.from(root.childNodes).map((child, idx) => {
9855
9885
  const node = convertNodeToReactWithRange(child, typedLen, rangeMap);
9856
- return node == null ? null : React24.createElement(React24.Fragment, { key: idx }, node);
9886
+ return node == null ? null : React25.createElement(React25.Fragment, { key: idx }, node);
9857
9887
  }).filter(Boolean);
9858
9888
  return nodes.length === 0 ? null : nodes;
9859
9889
  };
@@ -9866,20 +9896,20 @@ var HtmlTypeWriter = ({
9866
9896
  onDone,
9867
9897
  onChange
9868
9898
  }) => {
9869
- const [typedLen, setTypedLen] = React25.useState(0);
9870
- const doneCalledRef = React25.useRef(false);
9871
- const { doc, rangeMap, totalLength } = React25.useMemo(() => {
9899
+ const [typedLen, setTypedLen] = React26.useState(0);
9900
+ const doneCalledRef = React26.useRef(false);
9901
+ const { doc, rangeMap, totalLength } = React26.useMemo(() => {
9872
9902
  if (typeof window === "undefined") return { doc: null, rangeMap: /* @__PURE__ */ new Map(), totalLength: 0 };
9873
9903
  const decoded = decodeHtmlEntities(html);
9874
9904
  const doc2 = new DOMParser().parseFromString(decoded, "text/html");
9875
9905
  const { rangeMap: rangeMap2, totalLength: totalLength2 } = buildRangeMap(doc2.body);
9876
9906
  return { doc: doc2, rangeMap: rangeMap2, totalLength: totalLength2 };
9877
9907
  }, [html]);
9878
- React25.useEffect(() => {
9908
+ React26.useEffect(() => {
9879
9909
  setTypedLen(0);
9880
9910
  doneCalledRef.current = false;
9881
9911
  }, [html]);
9882
- React25.useEffect(() => {
9912
+ React26.useEffect(() => {
9883
9913
  if (!totalLength) return;
9884
9914
  if (typedLen >= totalLength) return;
9885
9915
  const timer = window.setInterval(() => {
@@ -9887,18 +9917,18 @@ var HtmlTypeWriter = ({
9887
9917
  }, duration);
9888
9918
  return () => window.clearInterval(timer);
9889
9919
  }, [typedLen, totalLength, duration]);
9890
- React25.useEffect(() => {
9920
+ React26.useEffect(() => {
9891
9921
  if (typedLen > 0 && typedLen < totalLength) {
9892
9922
  onChange?.();
9893
9923
  }
9894
9924
  }, [typedLen, totalLength, onChange]);
9895
- React25.useEffect(() => {
9925
+ React26.useEffect(() => {
9896
9926
  if (typedLen === totalLength && totalLength > 0 && !doneCalledRef.current) {
9897
9927
  doneCalledRef.current = true;
9898
9928
  onDone?.();
9899
9929
  }
9900
9930
  }, [typedLen, totalLength, onDone]);
9901
- const parsed = React25.useMemo(
9931
+ const parsed = React26.useMemo(
9902
9932
  () => doc ? htmlToReactProgressive(doc.body, typedLen, rangeMap) : null,
9903
9933
  [doc, typedLen, rangeMap]
9904
9934
  );
@@ -9908,13 +9938,13 @@ HtmlTypeWriter.displayName = "HtmlTypeWriter";
9908
9938
  var HtmlTypeWriter_default = HtmlTypeWriter;
9909
9939
 
9910
9940
  // src/components/ImageSelector/ImageSelector.tsx
9911
- import React26 from "react";
9941
+ import React27 from "react";
9912
9942
  import { jsx as jsx327, jsxs as jsxs210 } from "react/jsx-runtime";
9913
9943
  var ImageSelector = (props) => {
9914
9944
  const { value, placeholder, onChange, validations, label, required } = props;
9915
- const fieldId = React26.useId();
9916
- const [previewUrl, setPreviewUrl] = React26.useState();
9917
- React26.useEffect(() => {
9945
+ const fieldId = React27.useId();
9946
+ const [previewUrl, setPreviewUrl] = React27.useState();
9947
+ React27.useEffect(() => {
9918
9948
  if (!value) {
9919
9949
  setPreviewUrl(void 0);
9920
9950
  return;
@@ -9923,7 +9953,7 @@ var ImageSelector = (props) => {
9923
9953
  setPreviewUrl(url);
9924
9954
  return () => URL.revokeObjectURL(url);
9925
9955
  }, [value]);
9926
- const inputRef = React26.useRef(null);
9956
+ const inputRef = React27.useRef(null);
9927
9957
  const handleFileChange = (e) => {
9928
9958
  const selectedFile = e.target.files?.[0];
9929
9959
  if (selectedFile) {
@@ -10106,22 +10136,23 @@ Pagination.displayName = "Pagination";
10106
10136
  var Pagination_default = Pagination;
10107
10137
 
10108
10138
  // src/components/PopOver/PopOver.tsx
10109
- import React27 from "react";
10139
+ import React28 from "react";
10110
10140
  import { jsx as jsx332, jsxs as jsxs213 } from "react/jsx-runtime";
10111
10141
  var PopOver = (props) => {
10112
10142
  const { children, isOpen, onClose, PopOverEl } = props;
10113
- const popRef = React27.useRef(null);
10114
- const triggerRef = React27.useRef(null);
10115
- const [localOpen, setLocalOpen] = React27.useState(false);
10116
- const [eventTrigger, setEventTrigger] = React27.useState(false);
10143
+ const popRef = React28.useRef(null);
10144
+ const triggerRef = React28.useRef(null);
10145
+ const [localOpen, setLocalOpen] = React28.useState(false);
10146
+ const [eventTrigger, setEventTrigger] = React28.useState(false);
10117
10147
  useClickOutside_default([popRef, triggerRef], onClose, isOpen);
10118
10148
  useCloseWhenFocusHidden(isOpen, triggerRef, popRef, onClose);
10119
10149
  useEscapeKey(isOpen, () => {
10120
10150
  onClose();
10121
10151
  triggerRef.current?.focus({ preventScroll: true });
10122
10152
  });
10153
+ const host = useOverlayHost_default(triggerRef, localOpen);
10123
10154
  useAutoPosition_default(triggerRef, popRef, localOpen);
10124
- React27.useEffect(() => {
10155
+ React28.useEffect(() => {
10125
10156
  if (isOpen) {
10126
10157
  setLocalOpen(isOpen);
10127
10158
  setTimeout(() => {
@@ -10144,7 +10175,7 @@ var PopOver = (props) => {
10144
10175
  },
10145
10176
  children: [
10146
10177
  children,
10147
- localOpen && /* @__PURE__ */ jsx332(Portal_default, { children: /* @__PURE__ */ jsx332(
10178
+ localOpen && /* @__PURE__ */ jsx332(Portal_default, { container: host, children: /* @__PURE__ */ jsx332(
10148
10179
  "div",
10149
10180
  {
10150
10181
  className: clsx_default(
@@ -10202,12 +10233,12 @@ Progress.displayName = "Progress";
10202
10233
  var Progress_default = Progress;
10203
10234
 
10204
10235
  // src/components/Radio/RadioGroupContext.tsx
10205
- import React28 from "react";
10206
- var RadioGroupContext = React28.createContext(
10236
+ import React29 from "react";
10237
+ var RadioGroupContext = React29.createContext(
10207
10238
  null
10208
10239
  );
10209
10240
  var useRadioGroupContext = () => {
10210
- return React28.useContext(RadioGroupContext);
10241
+ return React29.useContext(RadioGroupContext);
10211
10242
  };
10212
10243
  var RadioGroupContext_default = RadioGroupContext;
10213
10244
 
@@ -10283,19 +10314,19 @@ RadioGroup.displayName = "RadioGroup";
10283
10314
  var RadioGroup_default = RadioGroup;
10284
10315
 
10285
10316
  // src/components/Select/Select.tsx
10286
- import React31 from "react";
10317
+ import React32 from "react";
10287
10318
 
10288
10319
  // src/components/Select/context.ts
10289
- import React29 from "react";
10290
- var SelectContext = React29.createContext(null);
10320
+ import React30 from "react";
10321
+ var SelectContext = React30.createContext(null);
10291
10322
  var context_default = SelectContext;
10292
10323
 
10293
10324
  // src/components/Select/SelectItem.tsx
10294
- import React30 from "react";
10325
+ import React31 from "react";
10295
10326
  import { jsx as jsx336 } from "react/jsx-runtime";
10296
10327
  var SelectItem = (props) => {
10297
10328
  const { children, value, onClick, disabled = false } = props;
10298
- const ctx = React30.useContext(context_default);
10329
+ const ctx = React31.useContext(context_default);
10299
10330
  const handleClick = (e) => {
10300
10331
  e.preventDefault();
10301
10332
  e.stopPropagation();
@@ -10345,29 +10376,29 @@ var SelectRoot = (props) => {
10345
10376
  required,
10346
10377
  size = "md"
10347
10378
  } = props;
10348
- const fieldId = React31.useId();
10349
- const itemChildren = React31.Children.toArray(children).filter(
10350
- (child) => React31.isValidElement(child) && child.type === SelectItem_default
10379
+ const fieldId = React32.useId();
10380
+ const itemChildren = React32.Children.toArray(children).filter(
10381
+ (child) => React32.isValidElement(child) && child.type === SelectItem_default
10351
10382
  );
10352
10383
  const isControlled = valueProp !== void 0;
10353
- const [isOpen, setOpen] = React31.useState(false);
10354
- const [uncontrolledLabel, setUncontrolledLabel] = React31.useState(null);
10355
- const [uncontrolledValue, setUncontrolledValue] = React31.useState(void 0);
10356
- const controlledLabel = React31.useMemo(() => {
10384
+ const [isOpen, setOpen] = React32.useState(false);
10385
+ const [uncontrolledLabel, setUncontrolledLabel] = React32.useState(null);
10386
+ const [uncontrolledValue, setUncontrolledValue] = React32.useState(void 0);
10387
+ const controlledLabel = React32.useMemo(() => {
10357
10388
  if (!isControlled) return null;
10358
10389
  const match = itemChildren.find((child) => child.props.value === valueProp);
10359
10390
  return match ? match.props.children : null;
10360
10391
  }, [isControlled, valueProp, itemChildren]);
10361
10392
  const selectedLabel = isControlled ? controlledLabel : uncontrolledLabel;
10362
10393
  const selectedValue = isControlled ? valueProp : uncontrolledValue;
10363
- const triggerRef = React31.useRef(null);
10364
- const contentRef = React31.useRef(null);
10365
- const [mounted, setMounted] = React31.useState(false);
10366
- const [visible, setVisible] = React31.useState(false);
10367
- React31.useEffect(() => {
10394
+ const triggerRef = React32.useRef(null);
10395
+ const contentRef = React32.useRef(null);
10396
+ const [mounted, setMounted] = React32.useState(false);
10397
+ const [visible, setVisible] = React32.useState(false);
10398
+ React32.useEffect(() => {
10368
10399
  if (disabled && isOpen) setOpen(false);
10369
10400
  }, [disabled, isOpen]);
10370
- React31.useEffect(() => {
10401
+ React32.useEffect(() => {
10371
10402
  if (isOpen) {
10372
10403
  setMounted(true);
10373
10404
  const t2 = setTimeout(() => setVisible(true), 1);
@@ -10377,33 +10408,34 @@ var SelectRoot = (props) => {
10377
10408
  const t = setTimeout(() => setMounted(false), ANIMATION_DURATION_MS3);
10378
10409
  return () => clearTimeout(t);
10379
10410
  }, [isOpen]);
10380
- const [query, setQuery] = React31.useState("");
10411
+ const [query, setQuery] = React32.useState("");
10381
10412
  const textOf = (node) => {
10382
10413
  if (node === null || node === void 0 || typeof node === "boolean") return "";
10383
10414
  if (typeof node === "string" || typeof node === "number") return String(node);
10384
10415
  if (Array.isArray(node)) return node.map(textOf).join("");
10385
- if (React31.isValidElement(node)) return textOf(node.props.children);
10416
+ if (React32.isValidElement(node)) return textOf(node.props.children);
10386
10417
  return "";
10387
10418
  };
10388
- const visibleItems = React31.useMemo(() => {
10419
+ const visibleItems = React32.useMemo(() => {
10389
10420
  if (!searchable || !query.trim()) return itemChildren;
10390
10421
  const q = query.trim().toLowerCase();
10391
10422
  return itemChildren.filter((c) => textOf(c.props.children).toLowerCase().includes(q));
10392
10423
  }, [searchable, query, itemChildren]);
10393
- const open = React31.useCallback(() => setOpen(true), []);
10394
- const close = React31.useCallback(() => {
10424
+ const open = React32.useCallback(() => setOpen(true), []);
10425
+ const close = React32.useCallback(() => {
10395
10426
  setOpen(false);
10396
10427
  setQuery("");
10397
10428
  }, []);
10398
- const toggle = React31.useCallback(() => setOpen((prev) => !prev), []);
10429
+ const toggle = React32.useCallback(() => setOpen((prev) => !prev), []);
10399
10430
  useClickOutside_default([contentRef, triggerRef], close, isOpen);
10400
10431
  useCloseWhenFocusHidden(isOpen, triggerRef, contentRef, close);
10401
10432
  useEscapeKey(isOpen, () => {
10402
10433
  close();
10403
10434
  triggerRef.current?.focus({ preventScroll: true });
10404
10435
  });
10436
+ const host = useOverlayHost_default(triggerRef, mounted);
10405
10437
  useAutoPosition_default(triggerRef, contentRef, mounted);
10406
- const setSelected = React31.useCallback(
10438
+ const setSelected = React32.useCallback(
10407
10439
  (label2, itemValue) => {
10408
10440
  if (!isControlled) {
10409
10441
  setUncontrolledLabel(label2);
@@ -10413,7 +10445,7 @@ var SelectRoot = (props) => {
10413
10445
  },
10414
10446
  [isControlled, onChange]
10415
10447
  );
10416
- const ctxValue = React31.useMemo(
10448
+ const ctxValue = React32.useMemo(
10417
10449
  () => ({
10418
10450
  isOpen,
10419
10451
  mounted,
@@ -10492,7 +10524,7 @@ var SelectRoot = (props) => {
10492
10524
  ]
10493
10525
  }
10494
10526
  ),
10495
- mounted && /* @__PURE__ */ jsx337(Portal_default, { children: /* @__PURE__ */ jsxs216(
10527
+ mounted && /* @__PURE__ */ jsx337(Portal_default, { container: host, children: /* @__PURE__ */ jsxs216(
10496
10528
  "div",
10497
10529
  {
10498
10530
  className: clsx_default("lib-xplat-select-content", size, stateClass),
@@ -10658,7 +10690,7 @@ Steps.displayName = "Steps";
10658
10690
  var Steps_default = Steps;
10659
10691
 
10660
10692
  // src/components/Swiper/Swiper.tsx
10661
- import React32 from "react";
10693
+ import React33 from "react";
10662
10694
  import { jsx as jsx342, jsxs as jsxs220 } from "react/jsx-runtime";
10663
10695
  var Swiper = (props) => {
10664
10696
  const {
@@ -10683,26 +10715,26 @@ var Swiper = (props) => {
10683
10715
  const maxIndex = Math.max(0, totalSlides - viewItemCount);
10684
10716
  const useLoop = loop && canSlide;
10685
10717
  const cloneCount = useLoop ? totalSlides : 0;
10686
- const extendedItems = React32.useMemo(() => {
10718
+ const extendedItems = React33.useMemo(() => {
10687
10719
  if (!useLoop) return items;
10688
10720
  return [...items, ...items, ...items];
10689
10721
  }, [items, useLoop]);
10690
10722
  const initialIdx = Math.max(0, Math.min(indexProp ?? 0, maxIndex));
10691
- const [innerIndex, setInnerIndex] = React32.useState(
10723
+ const [innerIndex, setInnerIndex] = React33.useState(
10692
10724
  useLoop ? cloneCount + initialIdx : initialIdx
10693
10725
  );
10694
- const [isDragging, setIsDragging] = React32.useState(false);
10695
- const [dragOffset, setDragOffset] = React32.useState(0);
10696
- const [animated, setAnimated] = React32.useState(false);
10697
- const [containerWidth, setContainerWidth] = React32.useState(0);
10698
- const containerRef = React32.useRef(null);
10699
- const startXRef = React32.useRef(0);
10700
- const startTimeRef = React32.useRef(0);
10701
- const autoplayTimerRef = React32.useRef(null);
10702
- const resumeTimeoutRef = React32.useRef(null);
10703
- const [paused, setPaused] = React32.useState(false);
10704
- const initializedRef = React32.useRef(false);
10705
- React32.useEffect(() => {
10726
+ const [isDragging, setIsDragging] = React33.useState(false);
10727
+ const [dragOffset, setDragOffset] = React33.useState(0);
10728
+ const [animated, setAnimated] = React33.useState(false);
10729
+ const [containerWidth, setContainerWidth] = React33.useState(0);
10730
+ const containerRef = React33.useRef(null);
10731
+ const startXRef = React33.useRef(0);
10732
+ const startTimeRef = React33.useRef(0);
10733
+ const autoplayTimerRef = React33.useRef(null);
10734
+ const resumeTimeoutRef = React33.useRef(null);
10735
+ const [paused, setPaused] = React33.useState(false);
10736
+ const initializedRef = React33.useRef(false);
10737
+ React33.useEffect(() => {
10706
10738
  const el = containerRef.current;
10707
10739
  if (!el) return;
10708
10740
  const ro = new ResizeObserver((entries) => {
@@ -10725,7 +10757,7 @@ var Swiper = (props) => {
10725
10757
  return ((inner - cloneCount) % totalSlides + totalSlides) % totalSlides;
10726
10758
  };
10727
10759
  const realIndex = getRealIndex(innerIndex);
10728
- const moveToInner = React32.useCallback(
10760
+ const moveToInner = React33.useCallback(
10729
10761
  (idx, withAnim = true) => {
10730
10762
  if (!useLoop) {
10731
10763
  setAnimated(withAnim);
@@ -10753,7 +10785,7 @@ var Swiper = (props) => {
10753
10785
  },
10754
10786
  [useLoop, cloneCount, totalSlides]
10755
10787
  );
10756
- const handleTransitionEnd = React32.useCallback(() => {
10788
+ const handleTransitionEnd = React33.useCallback(() => {
10757
10789
  if (!useLoop) return;
10758
10790
  const real = getRealIndex(innerIndex);
10759
10791
  const canonical = cloneCount + real;
@@ -10763,7 +10795,7 @@ var Swiper = (props) => {
10763
10795
  }
10764
10796
  onChange?.(Math.min(real, maxIndex));
10765
10797
  }, [useLoop, innerIndex, cloneCount, totalSlides, maxIndex, onChange]);
10766
- const slideTo = React32.useCallback(
10798
+ const slideTo = React33.useCallback(
10767
10799
  (logicalIndex) => {
10768
10800
  if (!canSlide) return;
10769
10801
  const clamped = useLoop ? logicalIndex : Math.max(0, Math.min(logicalIndex, maxIndex));
@@ -10773,7 +10805,7 @@ var Swiper = (props) => {
10773
10805
  },
10774
10806
  [canSlide, useLoop, cloneCount, maxIndex, onChange, moveToInner]
10775
10807
  );
10776
- const slideNext = React32.useCallback(() => {
10808
+ const slideNext = React33.useCallback(() => {
10777
10809
  if (!canSlide) return;
10778
10810
  const nextInner = innerIndex + slideBy;
10779
10811
  if (useLoop) {
@@ -10782,7 +10814,7 @@ var Swiper = (props) => {
10782
10814
  moveToInner(Math.min(nextInner, maxIndex), true);
10783
10815
  }
10784
10816
  }, [canSlide, useLoop, innerIndex, slideBy, maxIndex, moveToInner]);
10785
- const slidePrev = React32.useCallback(() => {
10817
+ const slidePrev = React33.useCallback(() => {
10786
10818
  if (!canSlide) return;
10787
10819
  const prevInner = innerIndex - slideBy;
10788
10820
  if (useLoop) {
@@ -10791,7 +10823,7 @@ var Swiper = (props) => {
10791
10823
  moveToInner(Math.max(prevInner, 0), true);
10792
10824
  }
10793
10825
  }, [canSlide, useLoop, innerIndex, slideBy, moveToInner]);
10794
- React32.useEffect(() => {
10826
+ React33.useEffect(() => {
10795
10827
  if (indexProp === void 0) return;
10796
10828
  const clamped = Math.max(0, Math.min(indexProp, maxIndex));
10797
10829
  const target = useLoop ? cloneCount + clamped : clamped;
@@ -10799,12 +10831,12 @@ var Swiper = (props) => {
10799
10831
  moveToInner(target, true);
10800
10832
  }
10801
10833
  }, [indexProp]);
10802
- React32.useImperativeHandle(swiperRef, () => ({
10834
+ React33.useImperativeHandle(swiperRef, () => ({
10803
10835
  slidePrev,
10804
10836
  slideNext,
10805
10837
  slideTo
10806
10838
  }));
10807
- React32.useEffect(() => {
10839
+ React33.useEffect(() => {
10808
10840
  if (!auto || !canSlide || paused) return;
10809
10841
  autoplayTimerRef.current = setInterval(slideNext, autoplayDelay);
10810
10842
  return () => {
@@ -10830,7 +10862,7 @@ var Swiper = (props) => {
10830
10862
  resumeTimeoutRef.current = null;
10831
10863
  }, pauseOnInteraction);
10832
10864
  };
10833
- React32.useEffect(() => {
10865
+ React33.useEffect(() => {
10834
10866
  return () => {
10835
10867
  if (resumeTimeoutRef.current) clearTimeout(resumeTimeoutRef.current);
10836
10868
  };
@@ -10848,7 +10880,7 @@ var Swiper = (props) => {
10848
10880
  startXRef.current = getClientX(e);
10849
10881
  startTimeRef.current = Date.now();
10850
10882
  };
10851
- React32.useEffect(() => {
10883
+ React33.useEffect(() => {
10852
10884
  if (!isDragging) return;
10853
10885
  const handleMove = (e) => {
10854
10886
  setDragOffset(getClientX(e) - startXRef.current);
@@ -10887,7 +10919,7 @@ var Swiper = (props) => {
10887
10919
  }, [isDragging, dragOffset, innerIndex, useLoop, maxIndex, slideStep, moveToInner]);
10888
10920
  const slideWidthPercent = 100 / viewItemCount;
10889
10921
  const gapAdjust = spaceBetween * (viewItemCount - 1) / viewItemCount;
10890
- const slideElements = React32.useMemo(
10922
+ const slideElements = React33.useMemo(
10891
10923
  () => extendedItems.map((item, idx) => /* @__PURE__ */ jsx342(
10892
10924
  "div",
10893
10925
  {
@@ -10961,7 +10993,7 @@ Swiper.displayName = "Swiper";
10961
10993
  var Swiper_default = Swiper;
10962
10994
 
10963
10995
  // src/components/Switch/Switch.tsx
10964
- import React33 from "react";
10996
+ import React34 from "react";
10965
10997
  import { jsx as jsx343 } from "react/jsx-runtime";
10966
10998
  var KNOB_TRANSITION_MS = 250;
10967
10999
  var Switch = (props) => {
@@ -10975,11 +11007,11 @@ var Switch = (props) => {
10975
11007
  label,
10976
11008
  required
10977
11009
  } = props;
10978
- const fieldId = React33.useId();
11010
+ const fieldId = React34.useId();
10979
11011
  const statusType = normalizeStatus(type);
10980
- const [isAnimating, setIsAnimating] = React33.useState(false);
10981
- const timeoutRef = React33.useRef(null);
10982
- React33.useEffect(() => {
11012
+ const [isAnimating, setIsAnimating] = React34.useState(false);
11013
+ const timeoutRef = React34.useRef(null);
11014
+ React34.useEffect(() => {
10983
11015
  return () => {
10984
11016
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
10985
11017
  };
@@ -11018,10 +11050,10 @@ Switch.displayName = "Switch";
11018
11050
  var Switch_default = Switch;
11019
11051
 
11020
11052
  // src/components/Table/TableContext.tsx
11021
- import React34 from "react";
11022
- var TableContext = React34.createContext(null);
11053
+ import React35 from "react";
11054
+ var TableContext = React35.createContext(null);
11023
11055
  var useTableContext = () => {
11024
- const ctx = React34.useContext(TableContext);
11056
+ const ctx = React35.useContext(TableContext);
11025
11057
  if (!ctx) throw new Error("Table components must be used inside <Table>");
11026
11058
  return ctx;
11027
11059
  };
@@ -11038,18 +11070,25 @@ var Table = (props) => {
11038
11070
  headerSticky = false,
11039
11071
  stickyShadow = true
11040
11072
  } = props;
11041
- return /* @__PURE__ */ jsx344("div", { className: `lib-xplat-table-wrapper ${size}`, children: /* @__PURE__ */ jsx344(
11042
- TableContext_default.Provider,
11073
+ return /* @__PURE__ */ jsx344(
11074
+ "div",
11043
11075
  {
11044
- value: {
11045
- rowBorderUse,
11046
- colBorderUse,
11047
- headerSticky,
11048
- stickyShadow
11049
- },
11050
- children: /* @__PURE__ */ jsx344("table", { className: "lib-xplat-table", children })
11076
+ className: `lib-xplat-table-wrapper ${size}`,
11077
+ "data-xplat-overlay-escape": "",
11078
+ children: /* @__PURE__ */ jsx344(
11079
+ TableContext_default.Provider,
11080
+ {
11081
+ value: {
11082
+ rowBorderUse,
11083
+ colBorderUse,
11084
+ headerSticky,
11085
+ stickyShadow
11086
+ },
11087
+ children: /* @__PURE__ */ jsx344("table", { className: "lib-xplat-table", children })
11088
+ }
11089
+ )
11051
11090
  }
11052
- ) });
11091
+ );
11053
11092
  };
11054
11093
  Table.displayName = "Table";
11055
11094
  var Table_default = Table;
@@ -11064,24 +11103,24 @@ TableBody.displayName = "TableBody";
11064
11103
  var TableBody_default = TableBody;
11065
11104
 
11066
11105
  // src/components/Table/TableCell.tsx
11067
- import React37 from "react";
11106
+ import React38 from "react";
11068
11107
 
11069
11108
  // src/components/Table/TableHeadContext.tsx
11070
- import React35 from "react";
11071
- var TableHeadContext = React35.createContext(
11109
+ import React36 from "react";
11110
+ var TableHeadContext = React36.createContext(
11072
11111
  null
11073
11112
  );
11074
11113
  var useTableHeadContext = () => {
11075
- const ctx = React35.useContext(TableHeadContext);
11114
+ const ctx = React36.useContext(TableHeadContext);
11076
11115
  return ctx;
11077
11116
  };
11078
11117
  var TableHeadContext_default = TableHeadContext;
11079
11118
 
11080
11119
  // src/components/Table/TableRowContext.tsx
11081
- import React36 from "react";
11082
- var TableRowContext = React36.createContext(null);
11120
+ import React37 from "react";
11121
+ var TableRowContext = React37.createContext(null);
11083
11122
  var useTableRowContext = () => {
11084
- const ctx = React36.useContext(TableRowContext);
11123
+ const ctx = React37.useContext(TableRowContext);
11085
11124
  if (!ctx) throw new Error("Table components must be used inside <Table>");
11086
11125
  return ctx;
11087
11126
  };
@@ -11089,7 +11128,7 @@ var TableRowContext_default = TableRowContext;
11089
11128
 
11090
11129
  // src/components/Table/TableCell.tsx
11091
11130
  import { jsx as jsx346 } from "react/jsx-runtime";
11092
- var TableCell = React37.memo((props) => {
11131
+ var TableCell = React38.memo((props) => {
11093
11132
  const {
11094
11133
  children,
11095
11134
  align = "center",
@@ -11103,9 +11142,9 @@ var TableCell = React37.memo((props) => {
11103
11142
  const { registerStickyCell, stickyCells } = useTableRowContext();
11104
11143
  const { stickyShadow } = useTableContext();
11105
11144
  const headContext = useTableHeadContext();
11106
- const [left, setLeft] = React37.useState(0);
11107
- const cellRef = React37.useRef(null);
11108
- const calculateLeft = React37.useCallback(() => {
11145
+ const [left, setLeft] = React38.useState(0);
11146
+ const cellRef = React38.useRef(null);
11147
+ const calculateLeft = React38.useCallback(() => {
11109
11148
  if (!cellRef.current) return 0;
11110
11149
  let totalLeft = 0;
11111
11150
  for (const ref of stickyCells) {
@@ -11114,7 +11153,7 @@ var TableCell = React37.memo((props) => {
11114
11153
  }
11115
11154
  return totalLeft;
11116
11155
  }, [stickyCells]);
11117
- React37.useEffect(() => {
11156
+ React38.useEffect(() => {
11118
11157
  if (!isSticky || !cellRef.current) return;
11119
11158
  registerStickyCell(cellRef);
11120
11159
  setLeft(calculateLeft());
@@ -11172,9 +11211,9 @@ TableHead.displayName = "TableHead";
11172
11211
  var TableHead_default = TableHead;
11173
11212
 
11174
11213
  // src/components/Table/TableRow.tsx
11175
- import React38 from "react";
11214
+ import React39 from "react";
11176
11215
  import { jsx as jsx348 } from "react/jsx-runtime";
11177
- var TableRow = React38.memo((props) => {
11216
+ var TableRow = React39.memo((props) => {
11178
11217
  const {
11179
11218
  children,
11180
11219
  type = "secondary",
@@ -11183,7 +11222,7 @@ var TableRow = React38.memo((props) => {
11183
11222
  onClick
11184
11223
  } = props;
11185
11224
  const { rowBorderUse } = useTableContext();
11186
- const [stickyCells, setStickyCells] = React38.useState([]);
11225
+ const [stickyCells, setStickyCells] = React39.useState([]);
11187
11226
  const registerStickyCell = (ref) => {
11188
11227
  setStickyCells((prev) => {
11189
11228
  if (prev.includes(ref)) return prev;
@@ -11247,9 +11286,9 @@ Tag.displayName = "Tag";
11247
11286
  var Tag_default = Tag;
11248
11287
 
11249
11288
  // src/components/TextArea/TextArea.tsx
11250
- import React39 from "react";
11289
+ import React40 from "react";
11251
11290
  import { jsx as jsx350 } from "react/jsx-runtime";
11252
- var TextArea = React39.forwardRef(
11291
+ var TextArea = React40.forwardRef(
11253
11292
  (props, ref) => {
11254
11293
  const {
11255
11294
  className,
@@ -11262,7 +11301,7 @@ var TextArea = React39.forwardRef(
11262
11301
  disabled,
11263
11302
  ...textareaProps
11264
11303
  } = props;
11265
- const autoId = React39.useId();
11304
+ const autoId = React40.useId();
11266
11305
  const fieldId = props.id ?? autoId;
11267
11306
  const control = /* @__PURE__ */ jsx350("div", { className: clsx_default("lib-xplat-textarea-wrap", className), children: /* @__PURE__ */ jsx350(
11268
11307
  "textarea",
@@ -11284,7 +11323,7 @@ TextArea.displayName = "TextArea";
11284
11323
  var TextArea_default = TextArea;
11285
11324
 
11286
11325
  // src/components/TimePicker/TimePicker.tsx
11287
- import React40 from "react";
11326
+ import React41 from "react";
11288
11327
  import { jsx as jsx351, jsxs as jsxs222 } from "react/jsx-runtime";
11289
11328
  var ANIMATION_DURATION_MS4 = 200;
11290
11329
  var toMinutes = (hhmm) => {
@@ -11322,13 +11361,13 @@ var TimePicker = (props) => {
11322
11361
  required,
11323
11362
  validations
11324
11363
  } = props;
11325
- const fieldId = React40.useId();
11326
- const triggerRef = React40.useRef(null);
11327
- const contentRef = React40.useRef(null);
11328
- const [isOpen, setOpen] = React40.useState(false);
11329
- const [mounted, setMounted] = React40.useState(false);
11330
- const [visible, setVisible] = React40.useState(false);
11331
- const options = React40.useMemo(() => {
11364
+ const fieldId = React41.useId();
11365
+ const triggerRef = React41.useRef(null);
11366
+ const contentRef = React41.useRef(null);
11367
+ const [isOpen, setOpen] = React41.useState(false);
11368
+ const [mounted, setMounted] = React41.useState(false);
11369
+ const [visible, setVisible] = React41.useState(false);
11370
+ const options = React41.useMemo(() => {
11332
11371
  const safeStep = step > 0 && step <= 720 ? step : 30;
11333
11372
  const lo = toMinutes(min) ?? 0;
11334
11373
  const hi = toMinutes(max) ?? 24 * 60 - 1;
@@ -11336,18 +11375,19 @@ var TimePicker = (props) => {
11336
11375
  for (let t = lo; t <= hi; t += safeStep) out.push(toHHmm(t));
11337
11376
  return out;
11338
11377
  }, [step, min, max]);
11339
- const close = React40.useCallback(() => setOpen(false), []);
11378
+ const close = React41.useCallback(() => setOpen(false), []);
11340
11379
  useClickOutside_default([triggerRef, contentRef], close, isOpen);
11341
11380
  useCloseWhenFocusHidden(isOpen, triggerRef, contentRef, close);
11342
11381
  useEscapeKey(isOpen, () => {
11343
11382
  close();
11344
11383
  triggerRef.current?.focus({ preventScroll: true });
11345
11384
  });
11385
+ const host = useOverlayHost_default(triggerRef, mounted);
11346
11386
  useAutoPosition_default(triggerRef, contentRef, mounted);
11347
- React40.useEffect(() => {
11387
+ React41.useEffect(() => {
11348
11388
  if (disabled && isOpen) setOpen(false);
11349
11389
  }, [disabled, isOpen]);
11350
- React40.useEffect(() => {
11390
+ React41.useEffect(() => {
11351
11391
  if (isOpen) {
11352
11392
  setMounted(true);
11353
11393
  const t2 = setTimeout(() => setVisible(true), 1);
@@ -11385,7 +11425,7 @@ var TimePicker = (props) => {
11385
11425
  children: /* @__PURE__ */ jsx351("span", { className: clsx_default("time-picker-value", !value && "placeholder"), children: value ? display(value, use12Hours) : placeholder })
11386
11426
  }
11387
11427
  ),
11388
- mounted && /* @__PURE__ */ jsx351(Portal_default, { children: /* @__PURE__ */ jsx351(
11428
+ mounted && /* @__PURE__ */ jsx351(Portal_default, { container: host, children: /* @__PURE__ */ jsx351(
11389
11429
  "div",
11390
11430
  {
11391
11431
  ref: contentRef,
@@ -11419,20 +11459,20 @@ TimePicker.displayName = "TimePicker";
11419
11459
  var TimePicker_default = TimePicker;
11420
11460
 
11421
11461
  // src/components/Toast/Toast.tsx
11422
- import React41 from "react";
11462
+ import React42 from "react";
11423
11463
  import { createPortal as createPortal3 } from "react-dom";
11424
11464
  import { jsx as jsx352, jsxs as jsxs223 } from "react/jsx-runtime";
11425
- var ToastContext = React41.createContext(null);
11465
+ var ToastContext = React42.createContext(null);
11426
11466
  var useToast = () => {
11427
- const ctx = React41.useContext(ToastContext);
11467
+ const ctx = React42.useContext(ToastContext);
11428
11468
  if (!ctx) throw new Error("useToast must be used within ToastProvider");
11429
11469
  return ctx;
11430
11470
  };
11431
11471
  var EXIT_DURATION = 300;
11432
11472
  var ToastItemComponent = ({ item, isExiting, onClose }) => {
11433
- const ref = React41.useRef(null);
11434
- const [height, setHeight] = React41.useState(void 0);
11435
- React41.useEffect(() => {
11473
+ const ref = React42.useRef(null);
11474
+ const [height, setHeight] = React42.useState(void 0);
11475
+ React42.useEffect(() => {
11436
11476
  if (ref.current && !isExiting) {
11437
11477
  setHeight(ref.current.offsetHeight);
11438
11478
  }
@@ -11464,13 +11504,13 @@ var ToastProvider = ({
11464
11504
  children,
11465
11505
  position = "top-right"
11466
11506
  }) => {
11467
- const [toasts, setToasts] = React41.useState([]);
11468
- const [removing, setRemoving] = React41.useState(/* @__PURE__ */ new Set());
11469
- const [mounted, setMounted] = React41.useState(false);
11470
- React41.useEffect(() => {
11507
+ const [toasts, setToasts] = React42.useState([]);
11508
+ const [removing, setRemoving] = React42.useState(/* @__PURE__ */ new Set());
11509
+ const [mounted, setMounted] = React42.useState(false);
11510
+ React42.useEffect(() => {
11471
11511
  setMounted(true);
11472
11512
  }, []);
11473
- const remove = React41.useCallback((id) => {
11513
+ const remove = React42.useCallback((id) => {
11474
11514
  setRemoving((prev) => new Set(prev).add(id));
11475
11515
  setTimeout(() => {
11476
11516
  setToasts((prev) => prev.filter((t) => t.id !== id));
@@ -11481,7 +11521,7 @@ var ToastProvider = ({
11481
11521
  });
11482
11522
  }, EXIT_DURATION);
11483
11523
  }, []);
11484
- const toast = React41.useCallback(
11524
+ const toast = React42.useCallback(
11485
11525
  (type, message, duration = 3e3) => {
11486
11526
  const id = `${Date.now()}-${Math.random()}`;
11487
11527
  setToasts((prev) => [...prev, { id, type, message }]);
@@ -11534,7 +11574,7 @@ ToggleChip.displayName = "ToggleChip";
11534
11574
  var ToggleChip_default = ToggleChip;
11535
11575
 
11536
11576
  // src/components/Tooltip/Tooltip.tsx
11537
- import React42 from "react";
11577
+ import React43 from "react";
11538
11578
  import { Fragment as Fragment6, jsx as jsx354, jsxs as jsxs224 } from "react/jsx-runtime";
11539
11579
  var OFFSET = 12;
11540
11580
  var GAP = 8;
@@ -11550,14 +11590,14 @@ var Tooltip = (props) => {
11550
11590
  disabled = false
11551
11591
  } = props;
11552
11592
  const shape = variant ?? type ?? "dark";
11553
- const triggerRef = React42.useRef(null);
11554
- const tooltipRef = React42.useRef(null);
11555
- const [visible, setVisible] = React42.useState(false);
11556
- const [pos, setPos] = React42.useState({ left: 0, top: 0 });
11557
- const delayTimer = React42.useRef(0);
11558
- const rafRef = React42.useRef(0);
11559
- const cursor = React42.useRef(null);
11560
- const clamp = React42.useCallback((left, top, w, h) => {
11593
+ const triggerRef = React43.useRef(null);
11594
+ const tooltipRef = React43.useRef(null);
11595
+ const [visible, setVisible] = React43.useState(false);
11596
+ const [pos, setPos] = React43.useState({ left: 0, top: 0 });
11597
+ const delayTimer = React43.useRef(0);
11598
+ const rafRef = React43.useRef(0);
11599
+ const cursor = React43.useRef(null);
11600
+ const clamp = React43.useCallback((left, top, w, h) => {
11561
11601
  const vw = window.innerWidth;
11562
11602
  const vh = window.innerHeight;
11563
11603
  return {
@@ -11565,7 +11605,7 @@ var Tooltip = (props) => {
11565
11605
  top: Math.min(Math.max(GAP, top), Math.max(GAP, vh - h - GAP))
11566
11606
  };
11567
11607
  }, []);
11568
- const placeAtCursor = React42.useCallback((x, y) => {
11608
+ const placeAtCursor = React43.useCallback((x, y) => {
11569
11609
  const el = tooltipRef.current;
11570
11610
  if (!el) return;
11571
11611
  const w = el.offsetWidth;
@@ -11576,7 +11616,7 @@ var Tooltip = (props) => {
11576
11616
  if (top < GAP) top = y + OFFSET;
11577
11617
  setPos(clamp(left, top, w, h));
11578
11618
  }, [clamp]);
11579
- const placeAtTrigger = React42.useCallback(() => {
11619
+ const placeAtTrigger = React43.useCallback(() => {
11580
11620
  const el = tooltipRef.current;
11581
11621
  const trigger = triggerRef.current;
11582
11622
  if (!el || !trigger) return;
@@ -11588,19 +11628,19 @@ var Tooltip = (props) => {
11588
11628
  const left = rect.left + rect.width / 2 - w / 2;
11589
11629
  setPos(clamp(left, top, w, h));
11590
11630
  }, [clamp]);
11591
- const reposition = React42.useCallback(() => {
11631
+ const reposition = React43.useCallback(() => {
11592
11632
  if (follow && cursor.current) {
11593
11633
  placeAtCursor(cursor.current.x, cursor.current.y);
11594
11634
  } else {
11595
11635
  placeAtTrigger();
11596
11636
  }
11597
11637
  }, [follow, placeAtCursor, placeAtTrigger]);
11598
- const handleMouseEnter = React42.useCallback((e) => {
11638
+ const handleMouseEnter = React43.useCallback((e) => {
11599
11639
  if (disabled) return;
11600
11640
  cursor.current = { x: e.clientX, y: e.clientY };
11601
11641
  delayTimer.current = window.setTimeout(() => setVisible(true), SHOW_DELAY);
11602
11642
  }, [disabled]);
11603
- const handleMouseMove = React42.useCallback((e) => {
11643
+ const handleMouseMove = React43.useCallback((e) => {
11604
11644
  cursor.current = { x: e.clientX, y: e.clientY };
11605
11645
  if (!visible || !follow) return;
11606
11646
  cancelAnimationFrame(rafRef.current);
@@ -11608,25 +11648,25 @@ var Tooltip = (props) => {
11608
11648
  if (cursor.current) placeAtCursor(cursor.current.x, cursor.current.y);
11609
11649
  });
11610
11650
  }, [visible, follow, placeAtCursor]);
11611
- const close = React42.useCallback(() => {
11651
+ const close = React43.useCallback(() => {
11612
11652
  window.clearTimeout(delayTimer.current);
11613
11653
  cancelAnimationFrame(rafRef.current);
11614
11654
  setVisible(false);
11615
11655
  }, []);
11616
- const handleMouseLeave = React42.useCallback(() => {
11656
+ const handleMouseLeave = React43.useCallback(() => {
11617
11657
  cursor.current = null;
11618
11658
  close();
11619
11659
  }, [close]);
11620
- const handleFocus = React42.useCallback(() => {
11660
+ const handleFocus = React43.useCallback(() => {
11621
11661
  if (disabled) return;
11622
11662
  cursor.current = null;
11623
11663
  setVisible(true);
11624
11664
  }, [disabled]);
11625
- React42.useLayoutEffect(() => {
11665
+ React43.useLayoutEffect(() => {
11626
11666
  if (!visible) return;
11627
11667
  reposition();
11628
11668
  }, [visible, reposition]);
11629
- React42.useEffect(() => {
11669
+ React43.useEffect(() => {
11630
11670
  if (!visible || follow) return;
11631
11671
  const onChange = () => placeAtTrigger();
11632
11672
  window.addEventListener("scroll", onChange, true);
@@ -11636,7 +11676,7 @@ var Tooltip = (props) => {
11636
11676
  window.removeEventListener("resize", onChange);
11637
11677
  };
11638
11678
  }, [visible, follow, placeAtTrigger]);
11639
- React42.useEffect(() => () => {
11679
+ React43.useEffect(() => () => {
11640
11680
  window.clearTimeout(delayTimer.current);
11641
11681
  cancelAnimationFrame(rafRef.current);
11642
11682
  }, []);
@@ -11675,7 +11715,7 @@ Tooltip.displayName = "Tooltip";
11675
11715
  var Tooltip_default = Tooltip;
11676
11716
 
11677
11717
  // src/components/Video/Video.tsx
11678
- import React43 from "react";
11718
+ import React44 from "react";
11679
11719
  import { jsx as jsx355, jsxs as jsxs225 } from "react/jsx-runtime";
11680
11720
  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: [
11681
11721
  /* @__PURE__ */ jsx355("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
@@ -11687,7 +11727,7 @@ var formatTime = (sec) => {
11687
11727
  const s = Math.floor(sec % 60);
11688
11728
  return `${m}:${s.toString().padStart(2, "0")}`;
11689
11729
  };
11690
- var Video = React43.forwardRef((props, ref) => {
11730
+ var Video = React44.forwardRef((props, ref) => {
11691
11731
  const {
11692
11732
  src,
11693
11733
  poster,
@@ -11711,21 +11751,21 @@ var Video = React43.forwardRef((props, ref) => {
11711
11751
  children,
11712
11752
  ...rest
11713
11753
  } = props;
11714
- const containerRef = React43.useRef(null);
11715
- const videoRef = React43.useRef(null);
11716
- const [isPlaying, setIsPlaying] = React43.useState(Boolean(autoPlay));
11717
- const [isLoaded, setIsLoaded] = React43.useState(false);
11718
- const [currentTime, setCurrentTime] = React43.useState(0);
11719
- const [duration, setDuration] = React43.useState(0);
11720
- const [buffered, setBuffered] = React43.useState(0);
11721
- const [volume, setVolume] = React43.useState(1);
11722
- const [isMuted, setIsMuted] = React43.useState(Boolean(muted));
11723
- const [isFullscreen, setIsFullscreen] = React43.useState(false);
11724
- const [playbackRate, setPlaybackRate] = React43.useState(1);
11725
- const [rateMenuOpen, setRateMenuOpen] = React43.useState(false);
11726
- const [captionsOn, setCaptionsOn] = React43.useState(false);
11727
- const [isPip, setIsPip] = React43.useState(false);
11728
- const setRefs = React43.useCallback(
11754
+ const containerRef = React44.useRef(null);
11755
+ const videoRef = React44.useRef(null);
11756
+ const [isPlaying, setIsPlaying] = React44.useState(Boolean(autoPlay));
11757
+ const [isLoaded, setIsLoaded] = React44.useState(false);
11758
+ const [currentTime, setCurrentTime] = React44.useState(0);
11759
+ const [duration, setDuration] = React44.useState(0);
11760
+ const [buffered, setBuffered] = React44.useState(0);
11761
+ const [volume, setVolume] = React44.useState(1);
11762
+ const [isMuted, setIsMuted] = React44.useState(Boolean(muted));
11763
+ const [isFullscreen, setIsFullscreen] = React44.useState(false);
11764
+ const [playbackRate, setPlaybackRate] = React44.useState(1);
11765
+ const [rateMenuOpen, setRateMenuOpen] = React44.useState(false);
11766
+ const [captionsOn, setCaptionsOn] = React44.useState(false);
11767
+ const [isPip, setIsPip] = React44.useState(false);
11768
+ const setRefs = React44.useCallback(
11729
11769
  (el) => {
11730
11770
  videoRef.current = el;
11731
11771
  if (typeof ref === "function") ref(el);
@@ -11733,14 +11773,14 @@ var Video = React43.forwardRef((props, ref) => {
11733
11773
  },
11734
11774
  [ref]
11735
11775
  );
11736
- React43.useEffect(() => {
11776
+ React44.useEffect(() => {
11737
11777
  const onFsChange = () => {
11738
11778
  setIsFullscreen(document.fullscreenElement === containerRef.current);
11739
11779
  };
11740
11780
  document.addEventListener("fullscreenchange", onFsChange);
11741
11781
  return () => document.removeEventListener("fullscreenchange", onFsChange);
11742
11782
  }, []);
11743
- React43.useEffect(() => {
11783
+ React44.useEffect(() => {
11744
11784
  const v = videoRef.current;
11745
11785
  if (!v) return;
11746
11786
  const onEnter = () => setIsPip(true);
@@ -12129,13 +12169,13 @@ Layout.displayName = "Layout";
12129
12169
  var Layout_default = Layout;
12130
12170
 
12131
12171
  // src/layout/SideBar/SideBar.tsx
12132
- import React45 from "react";
12172
+ import React46 from "react";
12133
12173
 
12134
12174
  // src/layout/SideBar/SideBarContext.tsx
12135
- import React44 from "react";
12136
- var SideBarContext = React44.createContext(null);
12175
+ import React45 from "react";
12176
+ var SideBarContext = React45.createContext(null);
12137
12177
  var useSideBarContext = () => {
12138
- const ctx = React44.useContext(SideBarContext);
12178
+ const ctx = React45.useContext(SideBarContext);
12139
12179
  if (!ctx) throw new Error("Error");
12140
12180
  return ctx;
12141
12181
  };
@@ -12145,7 +12185,7 @@ var SideBarContext_default = SideBarContext;
12145
12185
  import { jsx as jsx361 } from "react/jsx-runtime";
12146
12186
  var SideBar = (props) => {
12147
12187
  const { children, className } = props;
12148
- const [isOpen, setIsOpen] = React45.useState(true);
12188
+ const [isOpen, setIsOpen] = React46.useState(true);
12149
12189
  const handleSwitchSideBar = () => {
12150
12190
  setIsOpen((prev) => !prev);
12151
12191
  };