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