@unifiedsoftware/react-ui 1.0.17 → 1.0.19

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.mjs CHANGED
@@ -29,22 +29,45 @@ var __objRest = (source, exclude) => {
29
29
  }
30
30
  return target;
31
31
  };
32
+ var __async = (__this, __arguments, generator) => {
33
+ return new Promise((resolve, reject) => {
34
+ var fulfilled = (value) => {
35
+ try {
36
+ step(generator.next(value));
37
+ } catch (e) {
38
+ reject(e);
39
+ }
40
+ };
41
+ var rejected = (value) => {
42
+ try {
43
+ step(generator.throw(value));
44
+ } catch (e) {
45
+ reject(e);
46
+ }
47
+ };
48
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
49
+ step((generator = generator.apply(__this, __arguments)).next());
50
+ });
51
+ };
32
52
 
33
53
  // src/components/Backdrop/Backdrop.tsx
34
54
  import clsx2 from "clsx";
35
- import { forwardRef as forwardRef3, useRef as useRef2 } from "react";
55
+ import { forwardRef as forwardRef3, useRef } from "react";
36
56
  import { mergeRefs } from "react-merge-refs";
37
57
 
38
58
  // src/constants/index.ts
39
59
  var PREFIX_CLS = "us-";
40
60
 
41
61
  // src/components/Portal/Portal.tsx
42
- import { forwardRef, useRef } from "react";
43
- import { Portal as ReactPortal } from "react-portal";
62
+ import { forwardRef } from "react";
63
+ import { createPortal } from "react-dom";
44
64
  import { jsx } from "react/jsx-runtime";
45
- var Portal = forwardRef(({ children }, ref) => {
46
- const portalRef = useRef(null);
47
- return /* @__PURE__ */ jsx(ReactPortal, { ref: portalRef, node: document.body, children: /* @__PURE__ */ jsx("div", { className: `${PREFIX_CLS}potal`, children }) });
65
+ var Portal = forwardRef(({ children, container }, ref) => {
66
+ const prefixCls = PREFIX_CLS;
67
+ return createPortal(
68
+ /* @__PURE__ */ jsx("div", { ref, className: `${prefixCls}portal`, children }),
69
+ container || document.body
70
+ );
48
71
  });
49
72
  var Portal_default = Portal;
50
73
 
@@ -87,7 +110,7 @@ var Transition_default = Transition;
87
110
  import { jsx as jsx3, jsxs } from "react/jsx-runtime";
88
111
  var Backdrop = forwardRef3((props, ref) => {
89
112
  const _a = props, { children, className, isOpen, onClose } = _a, rest = __objRest(_a, ["children", "className", "isOpen", "onClose"]);
90
- const nodeRef = useRef2(null);
113
+ const nodeRef = useRef(null);
91
114
  return /* @__PURE__ */ jsx3(
92
115
  Transition_default,
93
116
  {
@@ -137,7 +160,7 @@ var Badge_default = Badge;
137
160
 
138
161
  // src/components/Button/Button.tsx
139
162
  import clsx5 from "clsx";
140
- import { forwardRef as forwardRef8 } from "react";
163
+ import { forwardRef as forwardRef9 } from "react";
141
164
 
142
165
  // src/icons/ChevronDownIcon.tsx
143
166
  import { forwardRef as forwardRef4 } from "react";
@@ -216,10 +239,38 @@ var LoaderIcon = forwardRef6((props, ref) => {
216
239
  });
217
240
  var LoaderIcon_default = LoaderIcon;
218
241
 
242
+ // src/icons/CloseIcon.tsx
243
+ import { forwardRef as forwardRef7 } from "react";
244
+ import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
245
+ var CloseIcon = forwardRef7((props, ref) => {
246
+ return /* @__PURE__ */ jsxs6(
247
+ "svg",
248
+ __spreadProps(__spreadValues({
249
+ ref,
250
+ xmlns: "http://www.w3.org/2000/svg",
251
+ width: "24",
252
+ height: "24",
253
+ viewBox: "0 0 24 24",
254
+ strokeWidth: "2",
255
+ stroke: "currentColor",
256
+ fill: "none",
257
+ strokeLinecap: "round",
258
+ strokeLinejoin: "round"
259
+ }, props), {
260
+ children: [
261
+ /* @__PURE__ */ jsx8("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
262
+ /* @__PURE__ */ jsx8("path", { d: "M18 6l-12 12" }),
263
+ /* @__PURE__ */ jsx8("path", { d: "M6 6l12 12" })
264
+ ]
265
+ })
266
+ );
267
+ });
268
+ var CloseIcon_default = CloseIcon;
269
+
219
270
  // src/components/Icon/Icon.tsx
220
271
  import clsx4 from "clsx";
221
- import { Children, cloneElement, forwardRef as forwardRef7 } from "react";
222
- var Icon = forwardRef7(({ children, size }, ref) => {
272
+ import { Children, cloneElement, forwardRef as forwardRef8 } from "react";
273
+ var Icon = forwardRef8(({ children, size }, ref) => {
223
274
  const child = Children.only(children);
224
275
  return cloneElement(child, __spreadProps(__spreadValues({
225
276
  ref
@@ -230,8 +281,8 @@ var Icon = forwardRef7(({ children, size }, ref) => {
230
281
  var Icon_default = Icon;
231
282
 
232
283
  // src/components/Button/Button.tsx
233
- import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
234
- var Button = forwardRef8(
284
+ import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
285
+ var Button = forwardRef9(
235
286
  (_a, ref) => {
236
287
  var _b = _a, {
237
288
  as: Component = "button",
@@ -262,19 +313,20 @@ var Button = forwardRef8(
262
313
  "loading",
263
314
  "disabled"
264
315
  ]);
265
- return /* @__PURE__ */ jsxs6(
316
+ const prefixCls = PREFIX_CLS;
317
+ return /* @__PURE__ */ jsxs7(
266
318
  Component,
267
319
  __spreadProps(__spreadValues({
268
320
  ref,
269
321
  className: clsx5(
270
- `${PREFIX_CLS}button`,
322
+ `${prefixCls}button`,
271
323
  {
272
- [`${PREFIX_CLS}button--${variant}`]: variant,
273
- [`${PREFIX_CLS}button--${color}`]: color,
274
- [`${PREFIX_CLS}button--${size}`]: size,
275
- [`${PREFIX_CLS}button--block`]: block,
276
- [`${PREFIX_CLS}button--icon-only`]: iconOnly,
277
- [`${PREFIX_CLS}button--disabled`]: disabled
324
+ [`${prefixCls}button--${variant}`]: variant,
325
+ [`${prefixCls}button--${color}`]: color,
326
+ [`${prefixCls}button--${size}`]: size,
327
+ [`${prefixCls}button--block`]: block,
328
+ [`${prefixCls}button--icon-only`]: iconOnly,
329
+ [`${prefixCls}button--disabled`]: disabled
278
330
  },
279
331
  className
280
332
  ),
@@ -282,10 +334,10 @@ var Button = forwardRef8(
282
334
  disabled
283
335
  }, rest), {
284
336
  children: [
285
- /* @__PURE__ */ jsx8("div", { className: `${PREFIX_CLS}overlay` }),
286
- /* @__PURE__ */ jsx8("div", { className: `${PREFIX_CLS}outline` }),
287
- loading ? /* @__PURE__ */ jsx8(Icon_default, { children: /* @__PURE__ */ jsx8(LoaderIcon_default, { className: `${PREFIX_CLS}animation-spin` }) }) : startContent,
288
- /* @__PURE__ */ jsx8("div", { className: `${PREFIX_CLS}button__content`, children }),
337
+ /* @__PURE__ */ jsx9("div", { className: `${prefixCls}overlay` }),
338
+ /* @__PURE__ */ jsx9("div", { className: `${prefixCls}outline` }),
339
+ loading ? /* @__PURE__ */ jsx9(Icon_default, { children: /* @__PURE__ */ jsx9(LoaderIcon_default, { className: `${prefixCls}animation-spin` }) }) : startContent,
340
+ /* @__PURE__ */ jsx9("div", { className: `${prefixCls}button__content`, children }),
289
341
  endContent
290
342
  ]
291
343
  })
@@ -294,7 +346,32 @@ var Button = forwardRef8(
294
346
  );
295
347
 
296
348
  // src/components/Card/Card.tsx
297
- import { forwardRef as forwardRef9 } from "react";
349
+ import { forwardRef as forwardRef10 } from "react";
350
+
351
+ // src/utils/scroll.ts
352
+ var scrollToItem = (parentElement, currentElement) => {
353
+ const parentRect = parentElement.getBoundingClientRect();
354
+ const currentRect = currentElement.getBoundingClientRect();
355
+ const behavior = "smooth";
356
+ const previousElement = currentElement.previousSibling;
357
+ const previousRect = (previousElement == null ? void 0 : previousElement.getBoundingClientRect()) || currentRect;
358
+ if (parentRect.left > previousRect.left) {
359
+ let offset = 0;
360
+ if (previousElement) {
361
+ offset = previousRect.left - parentRect.left + parentElement.scrollLeft + previousRect.width / 4;
362
+ }
363
+ parentElement.scrollTo({ behavior, left: offset });
364
+ }
365
+ const nextElement = currentElement.nextSibling;
366
+ const nextRect = (nextElement == null ? void 0 : nextElement.getBoundingClientRect()) || currentRect;
367
+ if (parentRect.right < nextRect.right) {
368
+ let offset = parentElement.scrollWidth;
369
+ if (nextElement) {
370
+ offset = nextRect.right - parentRect.right + parentElement.scrollLeft - nextRect.width / 4;
371
+ }
372
+ parentElement.scrollTo({ behavior, left: offset });
373
+ }
374
+ };
298
375
 
299
376
  // src/utils/clsx.ts
300
377
  function toVal(mix) {
@@ -336,54 +413,52 @@ function clsx6(...inputs) {
336
413
  }
337
414
  var clsx_default = clsx6;
338
415
 
339
- // src/utils/scroll.ts
340
- var scrollToItem = (parentElement, currentElement) => {
341
- const parentRect = parentElement.getBoundingClientRect();
342
- const currentRect = currentElement.getBoundingClientRect();
343
- const behavior = "smooth";
344
- const previousElement = currentElement.previousSibling;
345
- const previousRect = (previousElement == null ? void 0 : previousElement.getBoundingClientRect()) || currentRect;
346
- if (parentRect.left > previousRect.left) {
347
- let offset = 0;
348
- if (previousElement) {
349
- offset = previousRect.left - parentRect.left + parentElement.scrollLeft + previousRect.width / 4;
350
- }
351
- parentElement.scrollTo({ behavior, left: offset });
416
+ // src/utils/mergeRefs.ts
417
+ function assignRef(ref, value) {
418
+ if (ref == null)
419
+ return;
420
+ if (typeof ref === "function") {
421
+ ref(value);
422
+ return;
352
423
  }
353
- const nextElement = currentElement.nextSibling;
354
- const nextRect = (nextElement == null ? void 0 : nextElement.getBoundingClientRect()) || currentRect;
355
- if (parentRect.right < nextRect.right) {
356
- let offset = parentElement.scrollWidth;
357
- if (nextElement) {
358
- offset = nextRect.right - parentRect.right + parentElement.scrollLeft - nextRect.width / 4;
359
- }
360
- parentElement.scrollTo({ behavior, left: offset });
424
+ try {
425
+ ref.current = value;
426
+ } catch (error) {
427
+ throw new Error(`Cannot assign value '${value}' to ref '${ref}'`);
361
428
  }
362
- };
429
+ }
430
+ function mergeRefs2(...refs) {
431
+ return (node) => {
432
+ refs.forEach((ref) => {
433
+ assignRef(ref, node);
434
+ });
435
+ };
436
+ }
437
+ var mergeRefs_default = mergeRefs2;
363
438
 
364
439
  // src/components/Card/Card.tsx
365
- import { jsx as jsx9 } from "react/jsx-runtime";
366
- var Card = forwardRef9((_a, ref) => {
440
+ import { jsx as jsx10 } from "react/jsx-runtime";
441
+ var Card = forwardRef10((_a, ref) => {
367
442
  var _b = _a, { as: Component = "div", children, className } = _b, rest = __objRest(_b, ["as", "children", "className"]);
368
443
  const prefixCls = PREFIX_CLS;
369
- return /* @__PURE__ */ jsx9(Component, __spreadProps(__spreadValues({ ref, className: clsx_default(`${prefixCls}card`, className) }, rest), { children }));
444
+ return /* @__PURE__ */ jsx10(Component, __spreadProps(__spreadValues({ ref, className: clsx_default(`${prefixCls}card`, className) }, rest), { children }));
370
445
  });
371
446
  var Card_default = Card;
372
447
 
373
448
  // src/components/Card/CardHeader.tsx
374
- import { forwardRef as forwardRef10 } from "react";
375
- import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
376
- var CardHeader = forwardRef10(
449
+ import { forwardRef as forwardRef11 } from "react";
450
+ import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
451
+ var CardHeader = forwardRef11(
377
452
  (_a, ref) => {
378
453
  var _b = _a, { as: Component = "div", className, title, subtitle, startContent, endContent } = _b, rest = __objRest(_b, ["as", "className", "title", "subtitle", "startContent", "endContent"]);
379
454
  const prefixCls = PREFIX_CLS;
380
- return /* @__PURE__ */ jsxs7(Component, __spreadProps(__spreadValues({ ref, className: clsx_default(`${prefixCls}card-header`, className) }, rest), { children: [
381
- startContent && /* @__PURE__ */ jsx10("div", { className: `${prefixCls}card-header__start-content`, children: startContent }),
382
- /* @__PURE__ */ jsxs7("div", { className: `${prefixCls}card-header__content`, children: [
383
- /* @__PURE__ */ jsx10("div", { className: `${prefixCls}card-header__title`, children: title }),
384
- subtitle && /* @__PURE__ */ jsx10("div", { className: `${prefixCls}card-header__subtitle`, children: subtitle })
455
+ return /* @__PURE__ */ jsxs8(Component, __spreadProps(__spreadValues({ ref, className: clsx_default(`${prefixCls}card-header`, className) }, rest), { children: [
456
+ startContent && /* @__PURE__ */ jsx11("div", { className: `${prefixCls}card-header__start-content`, children: startContent }),
457
+ /* @__PURE__ */ jsxs8("div", { className: `${prefixCls}card-header__content`, children: [
458
+ /* @__PURE__ */ jsx11("div", { className: `${prefixCls}card-header__title`, children: title }),
459
+ subtitle && /* @__PURE__ */ jsx11("div", { className: `${prefixCls}card-header__subtitle`, children: subtitle })
385
460
  ] }),
386
- endContent && /* @__PURE__ */ jsx10("div", { className: `${prefixCls}card-header__end-content`, children: endContent })
461
+ endContent && /* @__PURE__ */ jsx11("div", { className: `${prefixCls}card-header__end-content`, children: endContent })
387
462
  ] }));
388
463
  }
389
464
  );
@@ -391,12 +466,12 @@ var CardHeader_default = CardHeader;
391
466
 
392
467
  // src/components/Chip/Chip.tsx
393
468
  import clsx7 from "clsx";
394
- import { forwardRef as forwardRef11 } from "react";
395
- import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
396
- var Chip = forwardRef11(
469
+ import { forwardRef as forwardRef12 } from "react";
470
+ import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
471
+ var Chip = forwardRef12(
397
472
  (_a, ref) => {
398
473
  var _b = _a, { as: Component = "div", children, className, variant, color, size } = _b, rest = __objRest(_b, ["as", "children", "className", "variant", "color", "size"]);
399
- return /* @__PURE__ */ jsxs8(
474
+ return /* @__PURE__ */ jsxs9(
400
475
  Component,
401
476
  __spreadProps(__spreadValues({
402
477
  ref,
@@ -411,8 +486,8 @@ var Chip = forwardRef11(
411
486
  )
412
487
  }, rest), {
413
488
  children: [
414
- /* @__PURE__ */ jsx11("div", { className: clsx7(`${PREFIX_CLS}overlay`) }),
415
- /* @__PURE__ */ jsx11("div", { className: `${PREFIX_CLS}outline` }),
489
+ /* @__PURE__ */ jsx12("div", { className: clsx7(`${PREFIX_CLS}overlay`) }),
490
+ /* @__PURE__ */ jsx12("div", { className: `${PREFIX_CLS}outline` }),
416
491
  children
417
492
  ]
418
493
  })
@@ -422,7 +497,7 @@ var Chip = forwardRef11(
422
497
  var Chip_default = Chip;
423
498
 
424
499
  // src/components/Collapse/Collapse.tsx
425
- import { Children as Children2, useEffect, useRef as useRef3, useState } from "react";
500
+ import { Children as Children2, useEffect, useRef as useRef2, useState } from "react";
426
501
 
427
502
  // src/components/Collapse/CollapseContext.tsx
428
503
  import { createContext, useContext } from "react";
@@ -437,9 +512,9 @@ var useCollapse = () => {
437
512
  var CollapseContext_default = CollapseContext;
438
513
 
439
514
  // src/components/Collapse/Collapse.tsx
440
- import { jsxs as jsxs9 } from "react/jsx-runtime";
515
+ import { jsxs as jsxs10 } from "react/jsx-runtime";
441
516
  var Collapse = ({ children, isOpen, onOpen, onClose, onToggle }) => {
442
- const collapseRef = useRef3(null);
517
+ const collapseRef = useRef2(null);
443
518
  const [selfIsOpen, setSelfIsOpen] = useState(isOpen != null ? isOpen : false);
444
519
  const [heightAuto, setHeightAuto] = useState(false);
445
520
  const [trigger, content] = Children2.toArray(children);
@@ -467,7 +542,7 @@ var Collapse = ({ children, isOpen, onOpen, onClose, onToggle }) => {
467
542
  }
468
543
  }, 100);
469
544
  }, [isOpen]);
470
- return /* @__PURE__ */ jsxs9(
545
+ return /* @__PURE__ */ jsxs10(
471
546
  CollapseContext_default.Provider,
472
547
  {
473
548
  value: {
@@ -489,8 +564,8 @@ var Collapse_default = Collapse;
489
564
 
490
565
  // src/components/Collapse/CollapseContent.tsx
491
566
  import clsx8 from "clsx";
492
- import { Children as Children3, cloneElement as cloneElement2, forwardRef as forwardRef12 } from "react";
493
- var CollapseContent = forwardRef12(({ children }, ref) => {
567
+ import { Children as Children3, cloneElement as cloneElement2, forwardRef as forwardRef13 } from "react";
568
+ var CollapseContent = forwardRef13(({ children }, ref) => {
494
569
  var _a, _b;
495
570
  const { collapseRef, isOpen, heightAuto } = useCollapse();
496
571
  const child = Children3.only(children);
@@ -510,8 +585,8 @@ var CollapseContent = forwardRef12(({ children }, ref) => {
510
585
  var CollapseContent_default = CollapseContent;
511
586
 
512
587
  // src/components/Collapse/CollapseTrigger.tsx
513
- import { Children as Children4, cloneElement as cloneElement3, forwardRef as forwardRef13 } from "react";
514
- var CollapseTrigger = forwardRef13(({ children }, ref) => {
588
+ import { Children as Children4, cloneElement as cloneElement3, forwardRef as forwardRef14 } from "react";
589
+ var CollapseTrigger = forwardRef14(({ children }, ref) => {
515
590
  const { collapseRef, onToggle } = useCollapse();
516
591
  const child = Children4.only(children);
517
592
  const _a = child.props, { onClick } = _a, rest = __objRest(_a, ["onClick"]);
@@ -530,19 +605,19 @@ var CollapseTrigger_default = CollapseTrigger;
530
605
 
531
606
  // src/components/Drawer/Drawer.tsx
532
607
  import clsx9 from "clsx";
533
- import { forwardRef as forwardRef14, useRef as useRef4 } from "react";
534
- import { mergeRefs as mergeRefs2 } from "react-merge-refs";
535
- import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
536
- var Drawer = forwardRef14((props, ref) => {
608
+ import { forwardRef as forwardRef15, useRef as useRef3 } from "react";
609
+ import { mergeRefs as mergeRefs3 } from "react-merge-refs";
610
+ import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
611
+ var Drawer = forwardRef15((props, ref) => {
537
612
  const { children, className, isOpen, size = "md", position = "left", onClose } = props;
538
- const nodeRef = useRef4(null);
613
+ const nodeRef = useRef3(null);
539
614
  const handleClose = () => {
540
615
  onClose();
541
616
  };
542
- return /* @__PURE__ */ jsx12(Backdrop_default, { isOpen, onClose: handleClose, children: /* @__PURE__ */ jsx12(Transition_default, { nodeRef, isOpen, name: `${PREFIX_CLS}drawer`, enter: 600, leave: 300, unmountOnExit: true, children: /* @__PURE__ */ jsxs10(
617
+ return /* @__PURE__ */ jsx13(Backdrop_default, { isOpen, onClose: handleClose, children: /* @__PURE__ */ jsx13(Transition_default, { nodeRef, isOpen, name: `${PREFIX_CLS}drawer`, enter: 600, leave: 300, unmountOnExit: true, children: /* @__PURE__ */ jsxs11(
543
618
  "div",
544
619
  {
545
- ref: mergeRefs2([ref, nodeRef]),
620
+ ref: mergeRefs3([ref, nodeRef]),
546
621
  className: clsx9(
547
622
  `${PREFIX_CLS}drawer`,
548
623
  {
@@ -552,7 +627,7 @@ var Drawer = forwardRef14((props, ref) => {
552
627
  className
553
628
  ),
554
629
  children: [
555
- /* @__PURE__ */ jsx12("div", { className: `${PREFIX_CLS}drawer__overlay` }),
630
+ /* @__PURE__ */ jsx13("div", { className: `${PREFIX_CLS}drawer__overlay` }),
556
631
  children
557
632
  ]
558
633
  }
@@ -582,7 +657,7 @@ import { useMemo as useMemo2 } from "react";
582
657
 
583
658
  // src/components/Menu/MenuItem.tsx
584
659
  import clsx10 from "clsx";
585
- import { forwardRef as forwardRef15, useContext as useContext4, useEffect as useEffect2 } from "react";
660
+ import { forwardRef as forwardRef16, useContext as useContext4, useEffect as useEffect2 } from "react";
586
661
 
587
662
  // src/components/Menu/MenuValueContext.tsx
588
663
  import { createContext as createContext3, useContext as useContext3 } from "react";
@@ -597,12 +672,13 @@ var useMenuItemValue = () => {
597
672
  var MenuValueContext_default = MenuValueContext;
598
673
 
599
674
  // src/components/Menu/MenuItem.tsx
600
- import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
601
- var MenuItem = forwardRef15((props, ref) => {
675
+ import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
676
+ var MenuItem = forwardRef16((props, ref) => {
602
677
  const _a = props, { as: Component = "div", className, style, value, title, icon, level = 1, disabled, onClick } = _a, rest = __objRest(_a, ["as", "className", "style", "value", "title", "icon", "level", "disabled", "onClick"]);
603
678
  const { value: menuValue, originalValue, navMode, onChange, onOpen, onItemSelect } = useMenu();
604
679
  const values = useContext4(MenuValueContext_default);
605
680
  const mergedValues = [...values, value];
681
+ const isSelected = menuValue[level - 1] === value;
606
682
  const handleClick = (event) => {
607
683
  if (value !== void 0) {
608
684
  onChange(mergedValues);
@@ -616,14 +692,14 @@ var MenuItem = forwardRef15((props, ref) => {
616
692
  onChange(mergedValues);
617
693
  }
618
694
  }, [value, originalValue, navMode]);
619
- return /* @__PURE__ */ jsxs11(
695
+ return /* @__PURE__ */ jsxs12(
620
696
  Component,
621
697
  __spreadProps(__spreadValues({
622
698
  ref,
623
699
  className: clsx10(
624
700
  `${PREFIX_CLS}menu-item`,
625
701
  {
626
- [`${PREFIX_CLS}menu-item--selected`]: menuValue.includes(value),
702
+ [`${PREFIX_CLS}menu-item--selected`]: isSelected,
627
703
  [`${PREFIX_CLS}menu-item--disabled`]: disabled
628
704
  },
629
705
  className
@@ -634,9 +710,9 @@ var MenuItem = forwardRef15((props, ref) => {
634
710
  onClick: handleClick
635
711
  }, rest), {
636
712
  children: [
637
- /* @__PURE__ */ jsx13("div", { className: `${PREFIX_CLS}overlay`, children: /* @__PURE__ */ jsx13("div", { className: `${PREFIX_CLS}overlay__surface` }) }),
638
- icon && /* @__PURE__ */ jsx13("div", { className: `${PREFIX_CLS}menu-item__icon`, children: icon }),
639
- /* @__PURE__ */ jsx13("div", { className: `${PREFIX_CLS}menu-item__content`, children: /* @__PURE__ */ jsx13("span", { className: `${PREFIX_CLS}menu-item__title`, children: title }) })
713
+ /* @__PURE__ */ jsx14("div", { className: `${PREFIX_CLS}overlay`, children: /* @__PURE__ */ jsx14("div", { className: `${PREFIX_CLS}overlay__surface` }) }),
714
+ icon && /* @__PURE__ */ jsx14("div", { className: `${PREFIX_CLS}menu-item__icon`, children: icon }),
715
+ /* @__PURE__ */ jsx14("div", { className: `${PREFIX_CLS}menu-item__content`, children: /* @__PURE__ */ jsx14("span", { className: `${PREFIX_CLS}menu-item__title`, children: title }) })
640
716
  ]
641
717
  })
642
718
  );
@@ -672,7 +748,7 @@ var addOrRemoveValueInArray = (array, value) => {
672
748
  };
673
749
 
674
750
  // src/components/Menu/MenuSubmenu.tsx
675
- import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
751
+ import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
676
752
  var MenuSubmenu = (_a) => {
677
753
  var _b = _a, {
678
754
  children,
@@ -699,10 +775,11 @@ var MenuSubmenu = (_a) => {
699
775
  const values = useContext5(MenuValueContext_default);
700
776
  const isOpen = openValues.includes(value);
701
777
  const mergedValues = [...values, value];
778
+ const isSelected = menuValue[level - 1] === value;
702
779
  const content = useMemo(() => {
703
780
  return items == null ? void 0 : items.map((_a2, index) => {
704
781
  var _b2 = _a2, { type } = _b2, item = __objRest(_b2, ["type"]);
705
- return type === "item" ? /* @__PURE__ */ jsx14(MenuItem_default, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index) : type === "submenu" ? /* @__PURE__ */ jsx14(MenuSubmenu, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index) : type === "group" ? /* @__PURE__ */ jsx14(MenuGroup_default, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index) : /* @__PURE__ */ jsx14(MenuItem_default, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index);
782
+ return type === "item" ? /* @__PURE__ */ jsx15(MenuItem_default, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index) : type === "submenu" ? /* @__PURE__ */ jsx15(MenuSubmenu, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index) : type === "group" ? /* @__PURE__ */ jsx15(MenuGroup_default, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index) : /* @__PURE__ */ jsx15(MenuItem_default, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index);
706
783
  });
707
784
  }, [items]);
708
785
  const handleClick = (event) => {
@@ -720,14 +797,14 @@ var MenuSubmenu = (_a) => {
720
797
  }
721
798
  onClick == null ? void 0 : onClick(event);
722
799
  };
723
- return /* @__PURE__ */ jsx14(MenuValueContext_default.Provider, { value: mergedValues, children: /* @__PURE__ */ jsx14("div", { className: clsx11(`${PREFIX_CLS}menu-submenu`), children: /* @__PURE__ */ jsxs12(Collapse_default, { isOpen, children: [
724
- /* @__PURE__ */ jsx14(CollapseTrigger_default, { children: /* @__PURE__ */ jsxs12(
800
+ return /* @__PURE__ */ jsx15(MenuValueContext_default.Provider, { value: mergedValues, children: /* @__PURE__ */ jsx15("div", { className: clsx11(`${PREFIX_CLS}menu-submenu`), children: /* @__PURE__ */ jsxs13(Collapse_default, { isOpen, children: [
801
+ /* @__PURE__ */ jsx15(CollapseTrigger_default, { children: /* @__PURE__ */ jsxs13(
725
802
  "div",
726
803
  __spreadProps(__spreadValues({
727
804
  className: clsx11(
728
805
  `${PREFIX_CLS}menu-item`,
729
806
  {
730
- [`${PREFIX_CLS}menu-item--selected`]: menuValue.includes(value) || items && mergedValues.includes(menuValue)
807
+ [`${PREFIX_CLS}menu-item--selected`]: isSelected || items && mergedValues.includes(menuValue)
731
808
  },
732
809
  className
733
810
  ),
@@ -737,14 +814,14 @@ var MenuSubmenu = (_a) => {
737
814
  onClick: handleClick
738
815
  }, rest), {
739
816
  children: [
740
- /* @__PURE__ */ jsx14("div", { className: `${PREFIX_CLS}overlay`, children: /* @__PURE__ */ jsx14("div", { className: `${PREFIX_CLS}overlay__surface` }) }),
741
- icon && /* @__PURE__ */ jsx14("div", { className: `${PREFIX_CLS}menu-item__icon`, children: icon }),
742
- /* @__PURE__ */ jsx14("div", { className: `${PREFIX_CLS}menu-item__content`, children: /* @__PURE__ */ jsx14("span", { className: `${PREFIX_CLS}menu-item__title`, children: title }) }),
743
- /* @__PURE__ */ jsx14("div", { className: `${PREFIX_CLS}menu-item__icon`, children: isOpen ? /* @__PURE__ */ jsx14(ChevronUpIcon_default, { className: `${PREFIX_CLS}icon` }) : /* @__PURE__ */ jsx14(ChevronDownIcon_default, { className: `${PREFIX_CLS}icon` }) })
817
+ /* @__PURE__ */ jsx15("div", { className: `${PREFIX_CLS}overlay`, children: /* @__PURE__ */ jsx15("div", { className: `${PREFIX_CLS}overlay__surface` }) }),
818
+ icon && /* @__PURE__ */ jsx15("div", { className: `${PREFIX_CLS}menu-item__icon`, children: icon }),
819
+ /* @__PURE__ */ jsx15("div", { className: `${PREFIX_CLS}menu-item__content`, children: /* @__PURE__ */ jsx15("span", { className: `${PREFIX_CLS}menu-item__title`, children: title }) }),
820
+ /* @__PURE__ */ jsx15("div", { className: `${PREFIX_CLS}menu-item__icon`, children: isOpen ? /* @__PURE__ */ jsx15(ChevronUpIcon_default, { className: `${PREFIX_CLS}icon` }) : /* @__PURE__ */ jsx15(ChevronDownIcon_default, { className: `${PREFIX_CLS}icon` }) })
744
821
  ]
745
822
  })
746
823
  ) }),
747
- /* @__PURE__ */ jsx14(CollapseContent_default, { children: /* @__PURE__ */ jsx14(
824
+ /* @__PURE__ */ jsx15(CollapseContent_default, { children: /* @__PURE__ */ jsx15(
748
825
  "ul",
749
826
  {
750
827
  className: clsx11(`${PREFIX_CLS}menu`, {
@@ -758,7 +835,7 @@ var MenuSubmenu = (_a) => {
758
835
  var MenuSubmenu_default = MenuSubmenu;
759
836
 
760
837
  // src/components/Menu/MenuGroup.tsx
761
- import { Fragment, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
838
+ import { Fragment, jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
762
839
  var MenuGroup = (_a) => {
763
840
  var _b = _a, {
764
841
  children,
@@ -780,11 +857,11 @@ var MenuGroup = (_a) => {
780
857
  const content = useMemo2(() => {
781
858
  return items == null ? void 0 : items.map((_a2, index) => {
782
859
  var _b2 = _a2, { type } = _b2, item = __objRest(_b2, ["type"]);
783
- return type === "item" ? /* @__PURE__ */ jsx15(MenuItem_default, __spreadValues({}, item), index) : type === "submenu" ? /* @__PURE__ */ jsx15(MenuSubmenu_default, __spreadValues({}, item), index) : /* @__PURE__ */ jsx15(MenuItem_default, __spreadValues({}, item), index);
860
+ return type === "item" ? /* @__PURE__ */ jsx16(MenuItem_default, __spreadValues({}, item), index) : type === "submenu" ? /* @__PURE__ */ jsx16(MenuSubmenu_default, __spreadValues({}, item), index) : /* @__PURE__ */ jsx16(MenuItem_default, __spreadValues({}, item), index);
784
861
  });
785
862
  }, [items]);
786
- return /* @__PURE__ */ jsxs13(Fragment, { children: [
787
- /* @__PURE__ */ jsxs13(
863
+ return /* @__PURE__ */ jsxs14(Fragment, { children: [
864
+ /* @__PURE__ */ jsxs14(
788
865
  "div",
789
866
  __spreadProps(__spreadValues({
790
867
  className: clsx12(`${PREFIX_CLS}menu-group`, className),
@@ -793,8 +870,8 @@ var MenuGroup = (_a) => {
793
870
  }, style)
794
871
  }, rest), {
795
872
  children: [
796
- icon && /* @__PURE__ */ jsx15("div", { className: `${PREFIX_CLS}menu-group__icon`, children: icon }),
797
- /* @__PURE__ */ jsx15("div", { className: `${PREFIX_CLS}menu-group__content`, children: /* @__PURE__ */ jsx15("span", { className: `${PREFIX_CLS}menu-group__title`, children: title }) })
873
+ icon && /* @__PURE__ */ jsx16("div", { className: `${PREFIX_CLS}menu-group__icon`, children: icon }),
874
+ /* @__PURE__ */ jsx16("div", { className: `${PREFIX_CLS}menu-group__content`, children: /* @__PURE__ */ jsx16("span", { className: `${PREFIX_CLS}menu-group__title`, children: title }) })
798
875
  ]
799
876
  })
800
877
  ),
@@ -804,7 +881,7 @@ var MenuGroup = (_a) => {
804
881
  var MenuGroup_default = MenuGroup;
805
882
 
806
883
  // src/components/Menu/Menu.tsx
807
- import { jsx as jsx16 } from "react/jsx-runtime";
884
+ import { jsx as jsx17 } from "react/jsx-runtime";
808
885
  var Menu = (_a) => {
809
886
  var _b = _a, {
810
887
  children,
@@ -835,7 +912,7 @@ var Menu = (_a) => {
835
912
  const content = useMemo3(() => {
836
913
  return items == null ? void 0 : items.map((_a3, index) => {
837
914
  var _b2 = _a3, { type } = _b2, item = __objRest(_b2, ["type"]);
838
- return type === "item" ? /* @__PURE__ */ jsx16(MenuItem_default, __spreadValues({}, item), index) : type === "submenu" ? /* @__PURE__ */ jsx16(MenuSubmenu_default, __spreadValues({}, item), index) : type === "group" ? /* @__PURE__ */ jsx16(MenuGroup_default, __spreadValues({}, item), index) : /* @__PURE__ */ jsx16(MenuItem_default, __spreadValues({}, item), index);
915
+ return type === "item" ? /* @__PURE__ */ jsx17(MenuItem_default, __spreadValues({}, item), index) : type === "submenu" ? /* @__PURE__ */ jsx17(MenuSubmenu_default, __spreadValues({}, item), index) : type === "group" ? /* @__PURE__ */ jsx17(MenuGroup_default, __spreadValues({}, item), index) : /* @__PURE__ */ jsx17(MenuItem_default, __spreadValues({}, item), index);
839
916
  });
840
917
  }, [items]);
841
918
  const handleChange = (value) => {
@@ -865,7 +942,7 @@ var Menu = (_a) => {
865
942
  setSelfOpenValues(openValuesProp);
866
943
  }
867
944
  }, [openValuesProp]);
868
- return /* @__PURE__ */ jsx16(
945
+ return /* @__PURE__ */ jsx17(
869
946
  MenuContext_default.Provider,
870
947
  {
871
948
  value: {
@@ -878,7 +955,7 @@ var Menu = (_a) => {
878
955
  onChange: handleChange,
879
956
  onItemSelect: handleItemSelect
880
957
  },
881
- children: /* @__PURE__ */ jsx16("div", __spreadProps(__spreadValues({ className: clsx13(`${PREFIX_CLS}menu`) }, rest), { children: content || children }))
958
+ children: /* @__PURE__ */ jsx17("div", __spreadProps(__spreadValues({ className: clsx13(`${PREFIX_CLS}menu`) }, rest), { children: content || children }))
882
959
  }
883
960
  );
884
961
  };
@@ -886,23 +963,23 @@ Menu.displayName = "Menu";
886
963
  var Menu_default = Menu;
887
964
 
888
965
  // src/components/Accordion/Accordion.tsx
889
- import { forwardRef as forwardRef16 } from "react";
890
- import { jsx as jsx17 } from "react/jsx-runtime";
891
- var Accordion = forwardRef16((props, ref) => {
966
+ import { forwardRef as forwardRef17 } from "react";
967
+ import { jsx as jsx18 } from "react/jsx-runtime";
968
+ var Accordion = forwardRef17((props, ref) => {
892
969
  const _a = props, { children, className } = _a, rest = __objRest(_a, ["children", "className"]);
893
970
  const prefixCls = PREFIX_CLS;
894
- return /* @__PURE__ */ jsx17("div", __spreadProps(__spreadValues({ ref, className: clsx_default(`${prefixCls}accordion`, className) }, rest), { children }));
971
+ return /* @__PURE__ */ jsx18("div", __spreadProps(__spreadValues({ ref, className: clsx_default(`${prefixCls}accordion`, className) }, rest), { children }));
895
972
  });
896
973
  var Accordion_default = Accordion;
897
974
 
898
975
  // src/components/Accordion/AccordionItem.tsx
899
- import { createContext as createContext4, forwardRef as forwardRef17, useContext as useContext6, useId } from "react";
976
+ import { createContext as createContext4, forwardRef as forwardRef18, useContext as useContext6, useId } from "react";
900
977
 
901
978
  // src/hooks/useLocalStorage.tsx
902
979
  import { useCallback, useEffect as useEffect5, useState as useState3 } from "react";
903
980
 
904
981
  // src/hooks/useEventListener.tsx
905
- import { useRef as useRef5 } from "react";
982
+ import { useRef as useRef4 } from "react";
906
983
 
907
984
  // src/hooks/useIsomorphicLayoutEffect.tsx
908
985
  import { useEffect as useEffect4, useLayoutEffect } from "react";
@@ -911,7 +988,7 @@ var useIsomorphicLayoutEffect_default = useIsomorphicLayoutEffect;
911
988
 
912
989
  // src/hooks/useEventListener.tsx
913
990
  function useEventListener(handler) {
914
- const savedHandler = useRef5(handler);
991
+ const savedHandler = useRef4(handler);
915
992
  useIsomorphicLayoutEffect_default(() => {
916
993
  savedHandler.current = handler;
917
994
  }, [handler]);
@@ -968,9 +1045,9 @@ function parseJSON(value) {
968
1045
  }
969
1046
 
970
1047
  // src/hooks/usePrevious.tsx
971
- import { useEffect as useEffect6, useRef as useRef6 } from "react";
1048
+ import { useEffect as useEffect6, useRef as useRef5 } from "react";
972
1049
  var usePrevious = (value) => {
973
- const ref = useRef6();
1050
+ const ref = useRef5();
974
1051
  useEffect6(() => {
975
1052
  ref.current = value;
976
1053
  });
@@ -979,7 +1056,7 @@ var usePrevious = (value) => {
979
1056
 
980
1057
  // src/hooks/useDisclosure.ts
981
1058
  import { useState as useState4 } from "react";
982
- var useDisclosure = ({ defaultValue } = {}) => {
1059
+ function useDisclosure({ defaultValue } = {}) {
983
1060
  const [isOpen, setIsOpen] = useState4(defaultValue || false);
984
1061
  const onOpen = () => {
985
1062
  setIsOpen(true);
@@ -996,9 +1073,27 @@ var useDisclosure = ({ defaultValue } = {}) => {
996
1073
  onClose,
997
1074
  onToggle
998
1075
  };
999
- };
1076
+ }
1000
1077
  var useDisclosure_default = useDisclosure;
1001
1078
 
1079
+ // src/hooks/useOnClickOutside.tsx
1080
+ import { useEffect as useEffect7 } from "react";
1081
+ var useOnClickOutside = (ref, handler) => {
1082
+ useEffect7(() => {
1083
+ const listener = (event) => {
1084
+ if (!ref.current || ref.current.contains(event.target)) {
1085
+ return;
1086
+ }
1087
+ handler(event);
1088
+ };
1089
+ document.addEventListener("click", listener);
1090
+ return () => {
1091
+ document.removeEventListener("click", listener);
1092
+ };
1093
+ }, [ref, handler]);
1094
+ };
1095
+ var useOnClickOutside_default = useOnClickOutside;
1096
+
1002
1097
  // src/hooks/useStep.tsx
1003
1098
  import { useCallback as useCallback2, useMemo as useMemo4, useState as useState5 } from "react";
1004
1099
  var useStep = (maxStep) => {
@@ -1042,8 +1137,129 @@ var useStep = (maxStep) => {
1042
1137
  ];
1043
1138
  };
1044
1139
 
1140
+ // src/hooks/useDebounce.ts
1141
+ import { useEffect as useEffect8, useState as useState6 } from "react";
1142
+ function useDebounce(value, delay) {
1143
+ const [debouncedValue, setDebouncedValue] = useState6(value);
1144
+ useEffect8(() => {
1145
+ const timer = setTimeout(() => setDebouncedValue(value), delay || 500);
1146
+ return () => {
1147
+ clearTimeout(timer);
1148
+ };
1149
+ }, [value, delay]);
1150
+ return debouncedValue;
1151
+ }
1152
+ var useDebounce_default = useDebounce;
1153
+
1154
+ // src/hooks/useInfiniteQuery/useInfiniteQuery.ts
1155
+ import { useEffect as useEffect9, useState as useState7 } from "react";
1156
+
1157
+ // src/hooks/useInfiniteQuery/types.ts
1158
+ var QueryStatus = /* @__PURE__ */ ((QueryStatus2) => {
1159
+ QueryStatus2[QueryStatus2["IDLE"] = 0] = "IDLE";
1160
+ QueryStatus2[QueryStatus2["LOADING"] = 1] = "LOADING";
1161
+ QueryStatus2[QueryStatus2["SUCCESS"] = 2] = "SUCCESS";
1162
+ QueryStatus2[QueryStatus2["ERROR"] = 3] = "ERROR";
1163
+ return QueryStatus2;
1164
+ })(QueryStatus || {});
1165
+
1166
+ // src/hooks/useInfiniteQuery/useInfiniteQuery.ts
1167
+ function useInfiniteQuery(options, deps = []) {
1168
+ const [status, setStatus] = useState7(0 /* IDLE */);
1169
+ const [data, setData] = useState7({ pages: [] });
1170
+ const [error, setError] = useState7();
1171
+ const [hasNextPage, setHasNextPage] = useState7(true);
1172
+ const [isFetchingNextPage, setIsFetchingNextPage] = useState7(false);
1173
+ const fetchNextPage = () => __async(this, null, function* () {
1174
+ try {
1175
+ setStatus(1 /* LOADING */);
1176
+ setError(void 0);
1177
+ setIsFetchingNextPage(true);
1178
+ const lastIndex = data.pages.length - 1;
1179
+ const page = options.getNextPage(data.pages[lastIndex], data.pages);
1180
+ const newPage = yield options.query({ page });
1181
+ const newData = { pages: [...data.pages, newPage] };
1182
+ setData(newData);
1183
+ const newLastIndex = newData.pages.length - 1;
1184
+ const nextPage = options.getNextPage(newData.pages[newLastIndex], newData.pages);
1185
+ setHasNextPage(nextPage !== void 0);
1186
+ setIsFetchingNextPage(false);
1187
+ setStatus(2 /* SUCCESS */);
1188
+ } catch (error2) {
1189
+ setError(error2);
1190
+ setStatus(3 /* ERROR */);
1191
+ }
1192
+ });
1193
+ useEffect9(() => {
1194
+ const fetchData = () => __async(this, null, function* () {
1195
+ try {
1196
+ setStatus(1 /* LOADING */);
1197
+ setError(void 0);
1198
+ setIsFetchingNextPage(true);
1199
+ const page = void 0;
1200
+ const newPage = yield options.query({ page });
1201
+ setData({ pages: [newPage] });
1202
+ const nextPage = options.getNextPage(newPage, [newPage]);
1203
+ setHasNextPage(nextPage !== void 0);
1204
+ setIsFetchingNextPage(false);
1205
+ setStatus(2 /* SUCCESS */);
1206
+ } catch (error2) {
1207
+ setError(error2);
1208
+ setStatus(3 /* ERROR */);
1209
+ }
1210
+ });
1211
+ fetchData();
1212
+ }, deps);
1213
+ return { status, data, error, hasNextPage, isFetchingNextPage, fetchNextPage };
1214
+ }
1215
+ var useInfiniteQuery_default = useInfiniteQuery;
1216
+
1217
+ // src/hooks/useElementSize/useElementSize.ts
1218
+ import { useEffect as useEffect10, useMemo as useMemo5, useRef as useRef6, useState as useState8 } from "react";
1219
+ var defaultState = {
1220
+ width: 0,
1221
+ height: 0
1222
+ };
1223
+ function useElementSize(options) {
1224
+ var _a;
1225
+ const frameID = useRef6(0);
1226
+ const [resize, setResize] = useState8(defaultState);
1227
+ const observer = useMemo5(
1228
+ () => typeof window !== "undefined" ? new ResizeObserver((entries) => {
1229
+ const entry = entries[0];
1230
+ if (entry) {
1231
+ cancelAnimationFrame(frameID.current);
1232
+ frameID.current = requestAnimationFrame(() => {
1233
+ var _a2, _b, _c;
1234
+ const target = (_b = (_a2 = options.ref) == null ? void 0 : _a2.current) != null ? _b : options.target;
1235
+ if (target) {
1236
+ (_c = options.callback) == null ? void 0 : _c.call(options, resize);
1237
+ setResize({ width: entry.contentRect.width, height: entry.contentRect.height });
1238
+ }
1239
+ });
1240
+ }
1241
+ }) : null,
1242
+ []
1243
+ );
1244
+ useEffect10(() => {
1245
+ var _a2, _b;
1246
+ const target = (_b = (_a2 = options.ref) == null ? void 0 : _a2.current) != null ? _b : options.target;
1247
+ if (target) {
1248
+ observer == null ? void 0 : observer.observe(target);
1249
+ }
1250
+ return () => {
1251
+ observer == null ? void 0 : observer.disconnect();
1252
+ if (frameID.current) {
1253
+ cancelAnimationFrame(frameID.current);
1254
+ }
1255
+ };
1256
+ }, [(_a = options.ref) == null ? void 0 : _a.current, options.target]);
1257
+ return resize;
1258
+ }
1259
+ var useElementSize_default = useElementSize;
1260
+
1045
1261
  // src/components/Accordion/AccordionItem.tsx
1046
- import { jsx as jsx18 } from "react/jsx-runtime";
1262
+ import { jsx as jsx19 } from "react/jsx-runtime";
1047
1263
  var AccordionItemContext = createContext4(null);
1048
1264
  var useAccordionItem = () => {
1049
1265
  const context = useContext6(AccordionItemContext);
@@ -1052,61 +1268,61 @@ var useAccordionItem = () => {
1052
1268
  }
1053
1269
  return context;
1054
1270
  };
1055
- var AccordionItem = forwardRef17((props, ref) => {
1271
+ var AccordionItem = forwardRef18((props, ref) => {
1056
1272
  const _a = props, { children, className, value: valueProp } = _a, rest = __objRest(_a, ["children", "className", "value"]);
1057
1273
  const prefixCls = PREFIX_CLS;
1058
1274
  const { isOpen, onOpen, onClose, onToggle } = useDisclosure_default({ defaultValue: true });
1059
1275
  const id = useId();
1060
1276
  const value = valueProp != null ? valueProp : id;
1061
- return /* @__PURE__ */ jsx18(AccordionItemContext.Provider, { value: { value }, children: /* @__PURE__ */ jsx18("div", __spreadProps(__spreadValues({ ref, className: clsx_default(`${prefixCls}accordion-item`, className) }, rest), { children: /* @__PURE__ */ jsx18(Collapse_default, { isOpen, onOpen, onClose, onToggle, children }) })) });
1277
+ return /* @__PURE__ */ jsx19(AccordionItemContext.Provider, { value: { value }, children: /* @__PURE__ */ jsx19("div", __spreadProps(__spreadValues({ ref, className: clsx_default(`${prefixCls}accordion-item`, className) }, rest), { children: /* @__PURE__ */ jsx19(Collapse_default, { isOpen, onOpen, onClose, onToggle, children }) })) });
1062
1278
  });
1063
1279
  var AccordionItem_default = AccordionItem;
1064
1280
 
1065
1281
  // src/components/Accordion/AccordionHeader.tsx
1066
- import { forwardRef as forwardRef18 } from "react";
1067
- import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
1068
- var AccordionHeader = forwardRef18((props, ref) => {
1282
+ import { forwardRef as forwardRef19 } from "react";
1283
+ import { jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
1284
+ var AccordionHeader = forwardRef19((props, ref) => {
1069
1285
  const _a = props, { className, title, subtitle, startContent, endContent } = _a, rest = __objRest(_a, ["className", "title", "subtitle", "startContent", "endContent"]);
1070
1286
  const prefixCls = PREFIX_CLS;
1071
1287
  const { isOpen } = useCollapse();
1072
- return /* @__PURE__ */ jsx19(CollapseTrigger_default, { children: /* @__PURE__ */ jsxs14("div", __spreadProps(__spreadValues({ ref, className: clsx_default(`${prefixCls}accordion-header`, className) }, rest), { children: [
1073
- startContent && /* @__PURE__ */ jsx19("div", { className: `${prefixCls}accordion-header__start-content`, children: startContent }),
1074
- /* @__PURE__ */ jsxs14("div", { className: `${prefixCls}accordion-header__content`, children: [
1075
- /* @__PURE__ */ jsx19("div", { className: `${prefixCls}accordion-header__title`, children: title }),
1076
- subtitle && /* @__PURE__ */ jsx19("div", { className: `${prefixCls}accordion-header__subtitle`, children: subtitle })
1288
+ return /* @__PURE__ */ jsx20(CollapseTrigger_default, { children: /* @__PURE__ */ jsxs15("div", __spreadProps(__spreadValues({ ref, className: clsx_default(`${prefixCls}accordion-header`, className) }, rest), { children: [
1289
+ startContent && /* @__PURE__ */ jsx20("div", { className: `${prefixCls}accordion-header__start-content`, children: startContent }),
1290
+ /* @__PURE__ */ jsxs15("div", { className: `${prefixCls}accordion-header__content`, children: [
1291
+ /* @__PURE__ */ jsx20("div", { className: `${prefixCls}accordion-header__title`, children: title }),
1292
+ subtitle && /* @__PURE__ */ jsx20("div", { className: `${prefixCls}accordion-header__subtitle`, children: subtitle })
1077
1293
  ] }),
1078
- /* @__PURE__ */ jsx19("div", { className: `${prefixCls}accordion-header__end-content`, children: /* @__PURE__ */ jsxs14("div", { className: "us-d-flex us-items-center us-gap-1", children: [
1294
+ /* @__PURE__ */ jsx20("div", { className: `${prefixCls}accordion-header__end-content`, children: /* @__PURE__ */ jsxs15("div", { className: "us-d-flex us-items-center us-gap-1", children: [
1079
1295
  endContent,
1080
- /* @__PURE__ */ jsx19(Button, { type: "button", variant: "text", color: "secondary", size: "sm", iconOnly: true, children: /* @__PURE__ */ jsx19(Icon_default, { children: isOpen ? /* @__PURE__ */ jsx19(ChevronUpIcon_default, {}) : /* @__PURE__ */ jsx19(ChevronDownIcon_default, {}) }) })
1296
+ /* @__PURE__ */ jsx20(Button, { type: "button", variant: "text", color: "secondary", size: "sm", iconOnly: true, children: /* @__PURE__ */ jsx20(Icon_default, { children: isOpen ? /* @__PURE__ */ jsx20(ChevronUpIcon_default, {}) : /* @__PURE__ */ jsx20(ChevronDownIcon_default, {}) }) })
1081
1297
  ] }) })
1082
1298
  ] })) });
1083
1299
  });
1084
1300
  var AccordionHeader_default = AccordionHeader;
1085
1301
 
1086
1302
  // src/components/Accordion/AccordionPanel.tsx
1087
- import { forwardRef as forwardRef19 } from "react";
1088
- import { jsx as jsx20 } from "react/jsx-runtime";
1089
- var AccordionPanel = forwardRef19((_a, ref) => {
1303
+ import { forwardRef as forwardRef20 } from "react";
1304
+ import { jsx as jsx21 } from "react/jsx-runtime";
1305
+ var AccordionPanel = forwardRef20((_a, ref) => {
1090
1306
  var _b = _a, { children, className } = _b, rest = __objRest(_b, ["children", "className"]);
1091
1307
  const prefixCls = PREFIX_CLS;
1092
- return /* @__PURE__ */ jsx20(CollapseContent_default, { children: /* @__PURE__ */ jsx20("div", { ref, children: /* @__PURE__ */ jsx20("div", __spreadProps(__spreadValues({ className: clsx_default(`${prefixCls}accordion-panel`, className) }, rest), { children })) }) });
1308
+ return /* @__PURE__ */ jsx21(CollapseContent_default, { children: /* @__PURE__ */ jsx21("div", { ref, children: /* @__PURE__ */ jsx21("div", __spreadProps(__spreadValues({ className: clsx_default(`${prefixCls}accordion-panel`, className) }, rest), { children })) }) });
1093
1309
  });
1094
1310
  var AccordionPanel_default = AccordionPanel;
1095
1311
 
1096
1312
  // src/components/Accordion/AccordionContent.tsx
1097
- import { forwardRef as forwardRef20 } from "react";
1098
- import { jsx as jsx21 } from "react/jsx-runtime";
1099
- var AccordionContent = forwardRef20((_a, ref) => {
1313
+ import { forwardRef as forwardRef21 } from "react";
1314
+ import { jsx as jsx22 } from "react/jsx-runtime";
1315
+ var AccordionContent = forwardRef21((_a, ref) => {
1100
1316
  var _b = _a, { children, className } = _b, rest = __objRest(_b, ["children", "className"]);
1101
1317
  const prefixCls = PREFIX_CLS;
1102
- return /* @__PURE__ */ jsx21(CollapseContent_default, { children: /* @__PURE__ */ jsx21("div", { ref, children: /* @__PURE__ */ jsx21("div", __spreadProps(__spreadValues({ className: clsx_default(`${prefixCls}accordion-content`, className) }, rest), { children })) }) });
1318
+ return /* @__PURE__ */ jsx22(CollapseContent_default, { children: /* @__PURE__ */ jsx22("div", { ref, children: /* @__PURE__ */ jsx22("div", __spreadProps(__spreadValues({ className: clsx_default(`${prefixCls}accordion-content`, className) }, rest), { children })) }) });
1103
1319
  });
1104
1320
  var AccordionContent_default = AccordionContent;
1105
1321
 
1106
1322
  // src/components/Tabs/Tab.tsx
1107
1323
  import clsx14 from "clsx";
1108
- import mergeRefs3 from "merge-refs";
1109
- import { forwardRef as forwardRef21, useEffect as useEffect7, useId as useId2, useRef as useRef7 } from "react";
1324
+ import mergeRefs4 from "merge-refs";
1325
+ import { forwardRef as forwardRef22, useEffect as useEffect11, useId as useId2, useRef as useRef7 } from "react";
1110
1326
 
1111
1327
  // ../../../node_modules/react-icons/lib/esm/iconBase.js
1112
1328
  import React3 from "react";
@@ -1206,8 +1422,8 @@ var useTabs = () => {
1206
1422
  };
1207
1423
 
1208
1424
  // src/components/Tabs/Tab.tsx
1209
- import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
1210
- var Tab = forwardRef21(
1425
+ import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
1426
+ var Tab = forwardRef22(
1211
1427
  (_a, ref) => {
1212
1428
  var _b = _a, {
1213
1429
  as: Component = "div",
@@ -1270,16 +1486,16 @@ var Tab = forwardRef21(
1270
1486
  event.stopPropagation();
1271
1487
  onClose(value);
1272
1488
  };
1273
- useEffect7(() => {
1489
+ useEffect11(() => {
1274
1490
  registerItem({ value, disabled });
1275
1491
  if (value === tabs.value) {
1276
1492
  tabs.previousTabRef.current = tabRef.current;
1277
1493
  }
1278
1494
  }, [value, tabs.value]);
1279
- return /* @__PURE__ */ jsxs15(
1495
+ return /* @__PURE__ */ jsxs16(
1280
1496
  Component,
1281
1497
  __spreadProps(__spreadValues({
1282
- ref: mergeRefs3(tabRef, ref, (el) => tabs.tabRefs.current[value] = el),
1498
+ ref: mergeRefs4(tabRef, ref, (el) => tabs.tabRefs.current[value] = el),
1283
1499
  className: clsx14(
1284
1500
  `${PREFIX_CLS}tab`,
1285
1501
  { [`${PREFIX_CLS}tab--selected`]: value === tabs.value, [`${PREFIX_CLS}tab--disabled`]: disabled },
@@ -1289,12 +1505,12 @@ var Tab = forwardRef21(
1289
1505
  onClick: handleClick
1290
1506
  }, rest), {
1291
1507
  children: [
1292
- /* @__PURE__ */ jsx22("div", { className: `${PREFIX_CLS}overlay`, children: /* @__PURE__ */ jsx22("div", { className: `${PREFIX_CLS}overlay__surface` }) }),
1293
- /* @__PURE__ */ jsxs15("div", { className: `${PREFIX_CLS}tab__content`, children: [
1508
+ /* @__PURE__ */ jsx23("div", { className: `${PREFIX_CLS}overlay`, children: /* @__PURE__ */ jsx23("div", { className: `${PREFIX_CLS}overlay__surface` }) }),
1509
+ /* @__PURE__ */ jsxs16("div", { className: `${PREFIX_CLS}tab__content`, children: [
1294
1510
  children,
1295
- closable && /* @__PURE__ */ jsx22(Button, { variant: "text", color: "secondary", iconOnly: true, size: "xs", onClick: handleClose, children: /* @__PURE__ */ jsx22(Icon_default, { children: /* @__PURE__ */ jsx22(TbX, {}) }) })
1511
+ closable && /* @__PURE__ */ jsx23(Button, { variant: "text", color: "secondary", iconOnly: true, size: "xs", onClick: handleClose, children: /* @__PURE__ */ jsx23(Icon_default, { children: /* @__PURE__ */ jsx23(TbX, {}) }) })
1296
1512
  ] }),
1297
- /* @__PURE__ */ jsx22("div", { className: `${PREFIX_CLS}tab__indicator` })
1513
+ /* @__PURE__ */ jsx23("div", { className: `${PREFIX_CLS}tab__indicator` })
1298
1514
  ]
1299
1515
  })
1300
1516
  );
@@ -1303,8 +1519,8 @@ var Tab = forwardRef21(
1303
1519
 
1304
1520
  // src/components/Tabs/Tabs.tsx
1305
1521
  import clsx15 from "clsx";
1306
- import { useEffect as useEffect8, useRef as useRef8, useState as useState6 } from "react";
1307
- import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
1522
+ import { useEffect as useEffect12, useRef as useRef8, useState as useState9 } from "react";
1523
+ import { jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
1308
1524
  var Tabs = (_a) => {
1309
1525
  var _b = _a, {
1310
1526
  children,
@@ -1326,8 +1542,8 @@ var Tabs = (_a) => {
1326
1542
  const tabsRef = useRef8(null);
1327
1543
  const tabRefs = useRef8({});
1328
1544
  const previousTabRef = useRef8(null);
1329
- const [selfValue, setSelfValue] = useState6(value != null ? value : defaultValue);
1330
- const [items, setItems] = useState6([]);
1545
+ const [selfValue, setSelfValue] = useState9(value != null ? value : defaultValue);
1546
+ const [items, setItems] = useState9([]);
1331
1547
  const registerItem = (item) => {
1332
1548
  setItems((prevItems) => {
1333
1549
  const index = prevItems.findIndex((item2) => item2.value);
@@ -1354,24 +1570,24 @@ var Tabs = (_a) => {
1354
1570
  const handleClose = (value2) => {
1355
1571
  onClose == null ? void 0 : onClose(value2);
1356
1572
  };
1357
- useEffect8(() => {
1573
+ useEffect12(() => {
1358
1574
  if (value !== void 0) {
1359
1575
  setSelfValue(value);
1360
1576
  scrollToTab(value);
1361
1577
  }
1362
1578
  }, [value]);
1363
- useEffect8(() => {
1579
+ useEffect12(() => {
1364
1580
  if (value === void 0) {
1365
1581
  const item = items.find((tab) => !tab.disabled);
1366
1582
  setSelfValue(item == null ? void 0 : item.value);
1367
1583
  }
1368
1584
  }, [value, items]);
1369
- return /* @__PURE__ */ jsxs16(
1585
+ return /* @__PURE__ */ jsxs17(
1370
1586
  TabsContext.Provider,
1371
1587
  {
1372
1588
  value: { previousTabRef, tabRefs, value: selfValue, onChange: handleChange, onClose: handleClose, registerItem },
1373
1589
  children: [
1374
- /* @__PURE__ */ jsx23(
1590
+ /* @__PURE__ */ jsx24(
1375
1591
  "div",
1376
1592
  __spreadProps(__spreadValues({
1377
1593
  ref: tabsRef,
@@ -1380,7 +1596,7 @@ var Tabs = (_a) => {
1380
1596
  children
1381
1597
  })
1382
1598
  ),
1383
- /* @__PURE__ */ jsx23("div", { className: `${PREFIX_CLS}divider` })
1599
+ /* @__PURE__ */ jsx24("div", { className: `${PREFIX_CLS}divider` })
1384
1600
  ]
1385
1601
  }
1386
1602
  );
@@ -1388,53 +1604,156 @@ var Tabs = (_a) => {
1388
1604
 
1389
1605
  // src/components/Toolbar/Toolbar.tsx
1390
1606
  import clsx16 from "clsx";
1391
- import { Fragment as Fragment2, jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
1607
+ import { Fragment as Fragment2, jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
1392
1608
  var Toolbar = (props) => {
1393
1609
  const _a = props, { children, className, size = "md", startAction, endAction, title, subtitle } = _a, rest = __objRest(_a, ["children", "className", "size", "startAction", "endAction", "title", "subtitle"]);
1394
- return /* @__PURE__ */ jsxs17("div", __spreadProps(__spreadValues({ className: clsx16(`${PREFIX_CLS}toolbar`, { [`${PREFIX_CLS}toolbar--${size}`]: size }, className) }, rest), { children: [
1395
- /* @__PURE__ */ jsx24("div", { className: `${PREFIX_CLS}outline-b` }),
1396
- /* @__PURE__ */ jsxs17("div", { className: clsx16(`${PREFIX_CLS}toolbar__container`), children: [
1397
- startAction && /* @__PURE__ */ jsx24("div", { className: clsx16(`${PREFIX_CLS}toolbar__start-action`), children: startAction }),
1398
- /* @__PURE__ */ jsx24("div", { className: clsx16(`${PREFIX_CLS}toolbar__content`), children: title || subtitle ? /* @__PURE__ */ jsxs17(Fragment2, { children: [
1399
- title && /* @__PURE__ */ jsx24("div", { className: clsx16(`${PREFIX_CLS}toolbar__title`), children: title }),
1400
- subtitle && /* @__PURE__ */ jsx24("div", { className: clsx16(`${PREFIX_CLS}toolbar__subtitle`), children: subtitle })
1610
+ return /* @__PURE__ */ jsxs18("div", __spreadProps(__spreadValues({ className: clsx16(`${PREFIX_CLS}toolbar`, { [`${PREFIX_CLS}toolbar--${size}`]: size }, className) }, rest), { children: [
1611
+ /* @__PURE__ */ jsx25("div", { className: `${PREFIX_CLS}outline-b` }),
1612
+ /* @__PURE__ */ jsxs18("div", { className: clsx16(`${PREFIX_CLS}toolbar__container`), children: [
1613
+ startAction && /* @__PURE__ */ jsx25("div", { className: clsx16(`${PREFIX_CLS}toolbar__start-action`), children: startAction }),
1614
+ /* @__PURE__ */ jsx25("div", { className: clsx16(`${PREFIX_CLS}toolbar__content`), children: title || subtitle ? /* @__PURE__ */ jsxs18(Fragment2, { children: [
1615
+ title && /* @__PURE__ */ jsx25("div", { className: clsx16(`${PREFIX_CLS}toolbar__title`), children: title }),
1616
+ subtitle && /* @__PURE__ */ jsx25("div", { className: clsx16(`${PREFIX_CLS}toolbar__subtitle`), children: subtitle })
1401
1617
  ] }) : children }),
1402
- endAction && /* @__PURE__ */ jsx24("div", { className: clsx16(`${PREFIX_CLS}toolbar__trailing`), children: endAction })
1618
+ endAction && /* @__PURE__ */ jsx25("div", { className: clsx16(`${PREFIX_CLS}toolbar__trailing`), children: endAction })
1403
1619
  ] })
1404
1620
  ] }));
1405
1621
  };
1406
1622
  var Toolbar_default = Toolbar;
1407
1623
 
1408
1624
  // src/components/ScrollArea/ScrollArea.tsx
1409
- import { Children as Children5, cloneElement as cloneElement4, forwardRef as forwardRef22 } from "react";
1410
- var ScrollArea = forwardRef22(({ children, direction = "vertical" }, ref) => {
1411
- const child = Children5.only(children);
1625
+ import { forwardRef as forwardRef23 } from "react";
1626
+ import { Scrollbars } from "react-custom-scrollbars-2";
1627
+ import { jsx as jsx26 } from "react/jsx-runtime";
1628
+ var ScrollArea = forwardRef23(({ children, height, style }, ref) => {
1412
1629
  const prefixCls = PREFIX_CLS;
1413
- return cloneElement4(child, __spreadProps(__spreadValues({
1414
- ref
1415
- }, child.props), {
1416
- className: clsx_default(
1417
- `${prefixCls}scroll-area`,
1418
- { [`${prefixCls}scroll-area--${direction}`]: direction },
1419
- child.props.className
1420
- )
1421
- }));
1630
+ const renderView = (props) => {
1631
+ return /* @__PURE__ */ jsx26("div", __spreadProps(__spreadValues({}, props), { className: clsx_default(`${prefixCls}scroll-area__view`, props.className) }));
1632
+ };
1633
+ const renderTrackHorizontal = (props) => {
1634
+ return /* @__PURE__ */ jsx26(
1635
+ "div",
1636
+ __spreadProps(__spreadValues({}, props), {
1637
+ className: clsx_default(`${prefixCls}scroll-area__track ${prefixCls}scroll-area__track--horizontal`, props.className)
1638
+ })
1639
+ );
1640
+ };
1641
+ const renderTrackVertical = (props) => {
1642
+ return /* @__PURE__ */ jsx26(
1643
+ "div",
1644
+ __spreadProps(__spreadValues({}, props), {
1645
+ className: clsx_default(`${prefixCls}scroll-area__track ${prefixCls}scroll-area__track--vertical`, props.className)
1646
+ })
1647
+ );
1648
+ };
1649
+ const renderThumbHorizontal = (props) => {
1650
+ return /* @__PURE__ */ jsx26(
1651
+ "div",
1652
+ __spreadProps(__spreadValues({}, props), {
1653
+ className: clsx_default(`${prefixCls}scroll-area__thumb ${prefixCls}scroll-area__thumb--horizontal`, props.className)
1654
+ })
1655
+ );
1656
+ };
1657
+ const renderThumbVertical = (props) => {
1658
+ return /* @__PURE__ */ jsx26(
1659
+ "div",
1660
+ __spreadProps(__spreadValues({}, props), {
1661
+ className: clsx_default(`${prefixCls}scroll-area__thumb ${prefixCls}scroll-area__thumb--vertical`, props.className)
1662
+ })
1663
+ );
1664
+ };
1665
+ return /* @__PURE__ */ jsx26(
1666
+ Scrollbars,
1667
+ {
1668
+ height,
1669
+ autoHide: true,
1670
+ className: `${prefixCls}scroll-area`,
1671
+ renderTrackHorizontal,
1672
+ renderTrackVertical,
1673
+ renderThumbHorizontal,
1674
+ renderThumbVertical,
1675
+ renderView,
1676
+ style,
1677
+ ref: (node) => {
1678
+ node && assignRef(ref, node.container.firstElementChild);
1679
+ },
1680
+ children
1681
+ }
1682
+ );
1422
1683
  });
1423
1684
  var ScrollArea_default = ScrollArea;
1424
1685
 
1686
+ // src/components/TextInput/TextInput.tsx
1687
+ import { forwardRef as forwardRef24, useRef as useRef9, useState as useState10 } from "react";
1688
+ import { jsx as jsx27, jsxs as jsxs19 } from "react/jsx-runtime";
1689
+ var TextInput = forwardRef24(
1690
+ (_a, ref) => {
1691
+ var _b = _a, { className, value, defaultValue, disabled, inputRef, startContent, endContent, style, onChange, onClick } = _b, rest = __objRest(_b, ["className", "value", "defaultValue", "disabled", "inputRef", "startContent", "endContent", "style", "onChange", "onClick"]);
1692
+ const [focus, setFocus] = useState10(false);
1693
+ const selfInputRef = useRef9(null);
1694
+ const prefixCls = PREFIX_CLS;
1695
+ const handleChange = (event) => {
1696
+ onChange == null ? void 0 : onChange(event);
1697
+ };
1698
+ const handleClick = (event) => {
1699
+ var _a2;
1700
+ onClick == null ? void 0 : onClick(event);
1701
+ (_a2 = selfInputRef == null ? void 0 : selfInputRef.current) == null ? void 0 : _a2.focus();
1702
+ };
1703
+ return /* @__PURE__ */ jsxs19(
1704
+ "div",
1705
+ {
1706
+ ref,
1707
+ className: clsx_default(
1708
+ `${prefixCls}input`,
1709
+ { [`${prefixCls}input--focus`]: focus, [`${prefixCls}input--disabled`]: disabled },
1710
+ className
1711
+ ),
1712
+ style,
1713
+ onFocus: () => {
1714
+ setFocus(true);
1715
+ },
1716
+ onBlur: () => {
1717
+ setFocus(false);
1718
+ },
1719
+ onClick: handleClick,
1720
+ children: [
1721
+ /* @__PURE__ */ jsx27("div", { className: `${prefixCls}outline` }),
1722
+ /* @__PURE__ */ jsxs19("div", { className: `${prefixCls}input__content`, children: [
1723
+ startContent && /* @__PURE__ */ jsx27("div", { className: `${prefixCls}input__start-content`, children: startContent }),
1724
+ /* @__PURE__ */ jsx27(
1725
+ "input",
1726
+ __spreadValues({
1727
+ ref: mergeRefs_default(selfInputRef, inputRef),
1728
+ className: `${prefixCls}input__field`,
1729
+ value,
1730
+ defaultValue,
1731
+ disabled,
1732
+ onChange: handleChange
1733
+ }, rest)
1734
+ ),
1735
+ endContent && /* @__PURE__ */ jsx27("div", { className: `${prefixCls}input__end-content`, children: endContent })
1736
+ ] })
1737
+ ]
1738
+ }
1739
+ );
1740
+ }
1741
+ );
1742
+ var TextInput_default = TextInput;
1743
+
1425
1744
  // src/components/Select/SelectClient.tsx
1426
1745
  import { filterBy } from "@progress/kendo-data-query";
1427
1746
  import {
1428
1747
  ComboBox
1429
1748
  } from "@progress/kendo-react-dropdowns";
1430
- import { useEffect as useEffect9, useRef as useRef9, useState as useState7 } from "react";
1431
- import { jsx as jsx25 } from "react/jsx-runtime";
1749
+ import { useEffect as useEffect13, useRef as useRef10, useState as useState11 } from "react";
1750
+ import { jsx as jsx28 } from "react/jsx-runtime";
1432
1751
  var SelectClient = ({
1433
1752
  value: valueProp,
1434
1753
  data: propData,
1435
1754
  filter: filterProp,
1436
- keyField: keyField2 = "key",
1437
- textField: textField3 = "text",
1755
+ keyField = "key",
1756
+ textField: textField2 = "text",
1438
1757
  placeholder,
1439
1758
  virtual,
1440
1759
  filterable,
@@ -1444,8 +1763,8 @@ var SelectClient = ({
1444
1763
  onChange,
1445
1764
  onFilterChange
1446
1765
  }) => {
1447
- const [value, setValue] = useState7(valueProp);
1448
- const [filter, setFilter] = useState7(filterProp);
1766
+ const [value, setValue] = useState11(valueProp);
1767
+ const [filter, setFilter] = useState11(filterProp);
1449
1768
  const handleChange = (event) => {
1450
1769
  const value2 = event.target.value || null;
1451
1770
  if (valueProp !== void 0) {
@@ -1454,17 +1773,17 @@ var SelectClient = ({
1454
1773
  setValue(value2);
1455
1774
  }
1456
1775
  };
1457
- const pageSize3 = virtual == null ? void 0 : virtual.pageSize;
1458
- const filteredData = useRef9([]);
1459
- const [state, setState] = useState7({
1776
+ const pageSize2 = virtual == null ? void 0 : virtual.pageSize;
1777
+ const filteredData = useRef10([]);
1778
+ const [state, setState] = useState11({
1460
1779
  skip: 0,
1461
1780
  total: propData.total,
1462
- subsetData: propData.items.slice(0, pageSize3)
1781
+ subsetData: propData.items.slice(0, pageSize2)
1463
1782
  });
1464
1783
  const handleFilterChange = (event) => {
1465
- if (pageSize3) {
1784
+ if (pageSize2) {
1466
1785
  filteredData.current = filterBy(propData.items.slice(), event.filter);
1467
- const data = filteredData.current.slice(0, pageSize3);
1786
+ const data = filteredData.current.slice(0, pageSize2);
1468
1787
  setState({
1469
1788
  subsetData: data,
1470
1789
  skip: 0,
@@ -1479,39 +1798,39 @@ var SelectClient = ({
1479
1798
  }
1480
1799
  };
1481
1800
  const handlePageChange = (event) => {
1482
- if (pageSize3) {
1801
+ if (pageSize2) {
1483
1802
  const skip = event.page.skip;
1484
1803
  const take = event.page.take;
1485
1804
  const newSubsetData = filteredData.current.slice(skip, skip + take);
1486
1805
  setState(__spreadProps(__spreadValues({}, state), { subsetData: newSubsetData, skip }));
1487
1806
  }
1488
1807
  };
1489
- useEffect9(() => {
1808
+ useEffect13(() => {
1490
1809
  if (valueProp !== void 0) {
1491
1810
  setValue(valueProp);
1492
1811
  }
1493
1812
  }, [valueProp]);
1494
- useEffect9(() => {
1813
+ useEffect13(() => {
1495
1814
  setFilter(filterProp);
1496
1815
  }, [filterProp]);
1497
- useEffect9(() => {
1498
- if (pageSize3) {
1816
+ useEffect13(() => {
1817
+ if (pageSize2) {
1499
1818
  filteredData.current = propData.items.slice();
1500
1819
  }
1501
1820
  }, [propData]);
1502
- return /* @__PURE__ */ jsx25(
1821
+ return /* @__PURE__ */ jsx28(
1503
1822
  ComboBox,
1504
1823
  {
1505
1824
  value,
1506
- data: pageSize3 ? state.subsetData : propData.items,
1825
+ data: pageSize2 ? state.subsetData : propData.items,
1507
1826
  placeholder,
1508
- dataItemKey: keyField2,
1509
- textField: textField3,
1827
+ dataItemKey: keyField,
1828
+ textField: textField2,
1510
1829
  filterable,
1511
1830
  filter,
1512
- virtual: pageSize3 ? {
1831
+ virtual: pageSize2 ? {
1513
1832
  total: state.total,
1514
- pageSize: pageSize3,
1833
+ pageSize: pageSize2,
1515
1834
  skip: state.skip
1516
1835
  } : void 0,
1517
1836
  disabled,
@@ -1529,8 +1848,8 @@ var SelectClient_default = SelectClient;
1529
1848
  import {
1530
1849
  ComboBox as ComboBox2
1531
1850
  } from "@progress/kendo-react-dropdowns";
1532
- import { cloneElement as cloneElement5, useCallback as useCallback3, useEffect as useEffect10, useRef as useRef10, useState as useState8 } from "react";
1533
- import { jsx as jsx26 } from "react/jsx-runtime";
1851
+ import { cloneElement as cloneElement4, useCallback as useCallback3, useEffect as useEffect14, useRef as useRef11, useState as useState12 } from "react";
1852
+ import { jsx as jsx29 } from "react/jsx-runtime";
1534
1853
  var textField = "ContactName";
1535
1854
  var emptyItem = { [textField]: "loading ...", CustomerID: 0 };
1536
1855
  var pageSize = 10;
@@ -1541,8 +1860,8 @@ while (loadingData.length < pageSize) {
1541
1860
  var SelectServer = ({
1542
1861
  data: dataProp,
1543
1862
  value: valueProp,
1544
- keyField: keyField2 = "key",
1545
- textField: textField3 = "text",
1863
+ keyField = "key",
1864
+ textField: textField2 = "text",
1546
1865
  placeholder,
1547
1866
  virtual,
1548
1867
  filterable,
@@ -1557,17 +1876,17 @@ var SelectServer = ({
1557
1876
  renderItem
1558
1877
  }) => {
1559
1878
  var _a;
1560
- const dataCaching = useRef10([]);
1561
- const pendingRequest = useRef10();
1562
- const requestStarted = useRef10(false);
1563
- const emptyItem3 = { [keyField2]: 0, [textField3]: "loading ..." };
1564
- const [loadingData3, setLoadingData] = useState8([]);
1565
- const [data, setData] = useState8(dataProp.items);
1566
- const [total, setTotal] = useState8(0);
1567
- const [value, setValue] = useState8(valueProp);
1568
- const [filter, setFilter] = useState8(filterProp);
1569
- const pageSize3 = (_a = virtual == null ? void 0 : virtual.pageSize) != null ? _a : 10;
1570
- const skipRef = useRef10(0);
1879
+ const dataCaching = useRef11([]);
1880
+ const pendingRequest = useRef11();
1881
+ const requestStarted = useRef11(false);
1882
+ const emptyItem2 = { [keyField]: 0, [textField2]: "loading ..." };
1883
+ const [loadingData2, setLoadingData] = useState12([]);
1884
+ const [data, setData] = useState12(dataProp.items);
1885
+ const [total, setTotal] = useState12(0);
1886
+ const [value, setValue] = useState12(valueProp);
1887
+ const [filter, setFilter] = useState12(filterProp);
1888
+ const pageSize2 = (_a = virtual == null ? void 0 : virtual.pageSize) != null ? _a : 10;
1889
+ const skipRef = useRef11(0);
1571
1890
  const resetCach = () => {
1572
1891
  dataCaching.current.length = 0;
1573
1892
  };
@@ -1607,11 +1926,11 @@ var SelectServer = ({
1607
1926
  }
1608
1927
  resetCach();
1609
1928
  requestData({ skip: 0, filter: filter2 });
1610
- setData(loadingData3);
1929
+ setData(loadingData2);
1611
1930
  skipRef.current = 0;
1612
1931
  }, []);
1613
1932
  const shouldRequestData = useCallback3((skip) => {
1614
- for (let i = 0; i < pageSize3; i++) {
1933
+ for (let i = 0; i < pageSize2; i++) {
1615
1934
  if (!dataCaching.current[skip + i]) {
1616
1935
  return true;
1617
1936
  }
@@ -1620,8 +1939,8 @@ var SelectServer = ({
1620
1939
  }, []);
1621
1940
  const getCachedData = useCallback3((skip) => {
1622
1941
  const data2 = [];
1623
- for (let i = 0; i < pageSize3; i++) {
1624
- data2.push(dataCaching.current[i + skip] || emptyItem3);
1942
+ for (let i = 0; i < pageSize2; i++) {
1943
+ data2.push(dataCaching.current[i + skip] || emptyItem2);
1625
1944
  }
1626
1945
  return data2;
1627
1946
  }, []);
@@ -1641,7 +1960,7 @@ var SelectServer = ({
1641
1960
  );
1642
1961
  const handleChange = useCallback3((event) => {
1643
1962
  const value2 = event.target.value;
1644
- if (value2 && value2[textField3] === emptyItem3[textField3]) {
1963
+ if (value2 && value2[textField2] === emptyItem2[textField2]) {
1645
1964
  return;
1646
1965
  }
1647
1966
  if (valueProp !== void 0) {
@@ -1653,48 +1972,48 @@ var SelectServer = ({
1653
1972
  const handleItemRender = (li, itemProps) => {
1654
1973
  const itemChildren = renderItem == null ? void 0 : renderItem(itemProps.dataItem);
1655
1974
  if (!itemChildren)
1656
- return cloneElement5(li, li.props);
1657
- return cloneElement5(li, li.props, itemChildren);
1975
+ return cloneElement4(li, li.props);
1976
+ return cloneElement4(li, li.props, itemChildren);
1658
1977
  };
1659
- useEffect10(() => {
1660
- const pageSize4 = 10;
1661
- const loadingData4 = [];
1662
- while (loadingData4.length < pageSize4) {
1663
- loadingData4.push(emptyItem3);
1978
+ useEffect14(() => {
1979
+ const pageSize3 = 10;
1980
+ const loadingData3 = [];
1981
+ while (loadingData3.length < pageSize3) {
1982
+ loadingData3.push(emptyItem2);
1664
1983
  }
1665
- setLoadingData(loadingData4);
1984
+ setLoadingData(loadingData3);
1666
1985
  }, []);
1667
- useEffect10(() => {
1986
+ useEffect14(() => {
1668
1987
  if (valueProp !== void 0) {
1669
1988
  setValue(valueProp);
1670
1989
  }
1671
1990
  }, [valueProp]);
1672
- useEffect10(() => {
1991
+ useEffect14(() => {
1673
1992
  if (filterProp !== void 0) {
1674
1993
  setFilter(filterProp);
1675
1994
  }
1676
1995
  }, [filterProp]);
1677
- useEffect10(() => {
1996
+ useEffect14(() => {
1678
1997
  requestData({ skip: 0, filter });
1679
1998
  return () => {
1680
1999
  resetCach();
1681
2000
  };
1682
2001
  }, [filter, requestData]);
1683
- useEffect10(() => {
2002
+ useEffect14(() => {
1684
2003
  setData(dataProp.items);
1685
2004
  }, [dataProp]);
1686
- return /* @__PURE__ */ jsx26(
2005
+ return /* @__PURE__ */ jsx29(
1687
2006
  ComboBox2,
1688
2007
  {
1689
2008
  data,
1690
2009
  value,
1691
2010
  placeholder,
1692
- dataItemKey: keyField2,
1693
- textField: textField3,
2011
+ dataItemKey: keyField,
2012
+ textField: textField2,
1694
2013
  filterable,
1695
2014
  onFilterChange: handleFilterChange,
1696
2015
  virtual: {
1697
- pageSize: pageSize3,
2016
+ pageSize: pageSize2,
1698
2017
  skip: skipRef.current,
1699
2018
  total
1700
2019
  },
@@ -1710,21 +2029,21 @@ var SelectServer = ({
1710
2029
  var SelectServer_default = SelectServer;
1711
2030
 
1712
2031
  // src/components/Select/Select.tsx
1713
- import { jsx as jsx27 } from "react/jsx-runtime";
2032
+ import { jsx as jsx30 } from "react/jsx-runtime";
1714
2033
  var Select = (props) => {
1715
- return props.filterMode === "client" ? /* @__PURE__ */ jsx27(SelectClient_default, __spreadValues({}, props)) : /* @__PURE__ */ jsx27(SelectServer_default, __spreadValues({}, props));
2034
+ return props.filterMode === "client" ? /* @__PURE__ */ jsx30(SelectClient_default, __spreadValues({}, props)) : /* @__PURE__ */ jsx30(SelectServer_default, __spreadValues({}, props));
1716
2035
  };
1717
2036
  var Select_default = Select;
1718
2037
 
1719
2038
  // src/components/Switch/Switch.tsx
1720
2039
  import clsx17 from "clsx";
1721
- import { forwardRef as forwardRef23, useEffect as useEffect11, useState as useState9 } from "react";
1722
- import { jsx as jsx28, jsxs as jsxs18 } from "react/jsx-runtime";
1723
- var Switch = forwardRef23(
2040
+ import { forwardRef as forwardRef25, useEffect as useEffect15, useState as useState13 } from "react";
2041
+ import { jsx as jsx31, jsxs as jsxs20 } from "react/jsx-runtime";
2042
+ var Switch = forwardRef25(
1724
2043
  (_a, ref) => {
1725
2044
  var _b = _a, { name, value: valueProp, defaultValue, onChange: onChangeProp, disabled } = _b, rest = __objRest(_b, ["name", "value", "defaultValue", "onChange", "disabled"]);
1726
2045
  var _a2;
1727
- const [selftValue, setSelfValue] = useState9((_a2 = valueProp != null ? valueProp : defaultValue) != null ? _a2 : false);
2046
+ const [selftValue, setSelfValue] = useState13((_a2 = valueProp != null ? valueProp : defaultValue) != null ? _a2 : false);
1728
2047
  const handleChange = () => {
1729
2048
  if (disabled) {
1730
2049
  return;
@@ -1732,12 +2051,12 @@ var Switch = forwardRef23(
1732
2051
  onChangeProp == null ? void 0 : onChangeProp(!selftValue);
1733
2052
  setSelfValue(!selftValue);
1734
2053
  };
1735
- useEffect11(() => {
2054
+ useEffect15(() => {
1736
2055
  if (valueProp !== void 0) {
1737
2056
  setSelfValue(valueProp);
1738
2057
  }
1739
2058
  }, [valueProp]);
1740
- return /* @__PURE__ */ jsxs18(
2059
+ return /* @__PURE__ */ jsxs20(
1741
2060
  "label",
1742
2061
  {
1743
2062
  htmlFor: name,
@@ -1745,7 +2064,7 @@ var Switch = forwardRef23(
1745
2064
  [`${PREFIX_CLS}switch--checked`]: !!selftValue
1746
2065
  }),
1747
2066
  children: [
1748
- /* @__PURE__ */ jsx28(
2067
+ /* @__PURE__ */ jsx31(
1749
2068
  "input",
1750
2069
  __spreadValues({
1751
2070
  type: "checkbox",
@@ -1757,7 +2076,7 @@ var Switch = forwardRef23(
1757
2076
  onChange: handleChange
1758
2077
  }, rest)
1759
2078
  ),
1760
- /* @__PURE__ */ jsx28("div", { className: `${PREFIX_CLS}switch__thumb` })
2079
+ /* @__PURE__ */ jsx31("div", { className: `${PREFIX_CLS}switch__thumb` })
1761
2080
  ]
1762
2081
  }
1763
2082
  );
@@ -1765,330 +2084,271 @@ var Switch = forwardRef23(
1765
2084
  );
1766
2085
  var Switch_default = Switch;
1767
2086
 
1768
- // src/components/MultiSelect/MultiSelectClient.tsx
1769
- import { filterBy as filterBy2 } from "@progress/kendo-data-query";
1770
- import {
1771
- MultiSelect
1772
- } from "@progress/kendo-react-dropdowns";
1773
- import { useEffect as useEffect12, useRef as useRef11, useState as useState10 } from "react";
1774
- import { jsx as jsx29 } from "react/jsx-runtime";
1775
- var textField2 = "text";
1776
- var keyField = "key";
1777
- var emptyItem2 = { [textField2]: "loading ...", [keyField]: 0 };
1778
- var pageSize2 = 10;
1779
- var loadingData2 = [];
1780
- while (loadingData2.length < pageSize2) {
1781
- loadingData2.push(__spreadValues({}, emptyItem2));
1782
- }
1783
- var SelectClient2 = ({
1784
- data: dataProp,
1785
- value: valueProp,
1786
- keyField: keyField2 = "key",
1787
- textField: textField3 = "text",
1788
- placeholder,
1789
- virtual,
1790
- filterable,
1791
- filter: filterProp,
1792
- disabled,
1793
- loading,
1794
- className,
1795
- onChange,
1796
- onFilterChange
1797
- }) => {
1798
- const [value, setValue] = useState10(valueProp);
1799
- const [filter, setFilter] = useState10(filterProp);
1800
- const handleChange = (event) => {
1801
- onChange(event.target.value);
2087
+ // src/components/Combobox/Combobox.tsx
2088
+ import { useEffect as useEffect20, useMemo as useMemo6, useRef as useRef16, useState as useState16 } from "react";
2089
+
2090
+ // src/components/Popover/Popover.tsx
2091
+ import { Children as Children5, cloneElement as cloneElement5, useEffect as useEffect16, useRef as useRef12, useState as useState14 } from "react";
2092
+
2093
+ // src/components/Popover/constans.ts
2094
+ var POPOVER_TRANSITION_DURATION_LEAVE = 150;
2095
+
2096
+ // src/components/Popover/PopoverContext.tsx
2097
+ import { createContext as createContext6, useContext as useContext8 } from "react";
2098
+ var PopoverContext = createContext6(null);
2099
+ var usePopover = () => {
2100
+ const context = useContext8(PopoverContext);
2101
+ if (!context) {
2102
+ throw new Error("`usePopover` must be used within a `<Popover />`");
2103
+ }
2104
+ return context;
2105
+ };
2106
+ var PopoverContext_default = PopoverContext;
2107
+
2108
+ // src/components/Popover/Popover.tsx
2109
+ import { jsx as jsx32, jsxs as jsxs21 } from "react/jsx-runtime";
2110
+ var Popover = (props) => {
2111
+ const { children, target, autoClose = true, triggerClosable = true, isOpen, onOpen, onClose, onToggle } = props;
2112
+ const triggerRef = useRef12(null);
2113
+ const contentRef = useRef12(null);
2114
+ const [internalOpen, setInternalOpen] = useState14(props.isOpen || false);
2115
+ const [trigger, content] = Children5.toArray(children);
2116
+ const prefixCls = PREFIX_CLS;
2117
+ const handleOpen = () => {
2118
+ if (isOpen !== void 0) {
2119
+ onOpen == null ? void 0 : onOpen();
2120
+ } else {
2121
+ setInternalOpen(true);
2122
+ }
1802
2123
  };
1803
- const pageSize3 = virtual == null ? void 0 : virtual.pageSize;
1804
- const filteredData = useRef11([]);
1805
- const [state, setState] = useState10({
1806
- skip: 0,
1807
- total: dataProp.total,
1808
- subsetData: dataProp.items.slice(0, pageSize3)
1809
- });
1810
- const handleFilterChange = (event) => {
1811
- if (pageSize3) {
1812
- filteredData.current = filterBy2(dataProp.items.slice(), event.filter);
1813
- const data = filteredData.current.slice(0, pageSize3);
1814
- setState({
1815
- subsetData: data,
1816
- skip: 0,
1817
- total: filteredData.current.length
1818
- });
2124
+ const handleClose = () => {
2125
+ if (isOpen !== void 0) {
2126
+ onClose == null ? void 0 : onClose();
2127
+ } else {
2128
+ setInternalOpen(false);
1819
2129
  }
1820
- onFilterChange == null ? void 0 : onFilterChange(event.filter.value);
1821
2130
  };
1822
- const pageChange = (event) => {
1823
- if (pageSize3) {
1824
- const skip = event.page.skip;
1825
- const take = event.page.take;
1826
- const newSubsetData = filteredData.current.slice(skip, skip + take);
1827
- setState(__spreadProps(__spreadValues({}, state), { subsetData: newSubsetData, skip }));
2131
+ const handleToggle = () => {
2132
+ if (isOpen !== void 0) {
2133
+ onToggle == null ? void 0 : onToggle();
2134
+ } else {
2135
+ setInternalOpen((prevState) => !prevState);
1828
2136
  }
1829
2137
  };
1830
- useEffect12(() => {
1831
- setValue(valueProp);
1832
- }, [valueProp]);
1833
- useEffect12(() => {
1834
- setFilter(filterProp);
1835
- }, [filterProp]);
1836
- useEffect12(() => {
1837
- if (pageSize3) {
1838
- filteredData.current = dataProp.items.slice();
1839
- }
1840
- }, [dataProp]);
1841
- return /* @__PURE__ */ jsx29(
1842
- MultiSelect,
2138
+ useEffect16(() => {
2139
+ setInternalOpen(isOpen || false);
2140
+ }, [isOpen]);
2141
+ return /* @__PURE__ */ jsxs21(
2142
+ PopoverContext_default.Provider,
1843
2143
  {
1844
- value,
1845
- data: pageSize3 ? state.subsetData : dataProp.items,
1846
- placeholder,
1847
- dataItemKey: keyField2,
1848
- textField: textField3,
1849
- filterable,
1850
- filter,
1851
- virtual: pageSize3 ? {
1852
- total: state.total,
1853
- pageSize: pageSize3,
1854
- skip: state.skip
1855
- } : void 0,
1856
- disabled,
1857
- loading,
1858
- className,
1859
- onChange: handleChange,
1860
- onFilterChange: handleFilterChange,
1861
- onPageChange: pageChange
2144
+ value: {
2145
+ triggerRef,
2146
+ contentRef,
2147
+ target,
2148
+ isOpen: internalOpen,
2149
+ autoClose,
2150
+ triggerClosable,
2151
+ onOpen: handleOpen,
2152
+ onClose: handleClose,
2153
+ onToggle: handleToggle
2154
+ },
2155
+ children: [
2156
+ trigger,
2157
+ /* @__PURE__ */ jsx32(
2158
+ Transition_default,
2159
+ {
2160
+ nodeRef: contentRef,
2161
+ isOpen: internalOpen,
2162
+ enter: 300,
2163
+ leave: POPOVER_TRANSITION_DURATION_LEAVE,
2164
+ name: `${prefixCls}popover`,
2165
+ unmountOnExit: true,
2166
+ children: /* @__PURE__ */ jsx32(Portal_default, { children: cloneElement5(Children5.only(content), __spreadProps(__spreadValues({}, content.props), {
2167
+ ref: contentRef
2168
+ })) })
2169
+ }
2170
+ )
2171
+ ]
1862
2172
  }
1863
2173
  );
1864
2174
  };
1865
- var MultiSelectClient_default = SelectClient2;
1866
-
1867
- // src/components/MultiSelect/MultiSelectServer.tsx
1868
- import {
1869
- MultiSelect as MultiSelect2
1870
- } from "@progress/kendo-react-dropdowns";
1871
- import { useCallback as useCallback4, useEffect as useEffect13, useRef as useRef12, useState as useState11 } from "react";
1872
- import { jsx as jsx30 } from "react/jsx-runtime";
1873
- var MultiSelectServer = ({
1874
- data: dataProp,
1875
- value: valueProp,
1876
- keyField: keyField2 = "key",
1877
- textField: textField3 = "text",
1878
- placeholder,
1879
- virtual,
1880
- filterable,
1881
- filter: filterProp = "",
1882
- disabled,
1883
- loading,
1884
- className,
1885
- onDataChange,
1886
- onChange,
1887
- onFilterChange,
1888
- getData
1889
- }) => {
1890
- var _a;
1891
- const dataCaching = useRef12([]);
1892
- const pendingRequest = useRef12();
1893
- const requestStarted = useRef12(false);
1894
- const emptyItem3 = { [keyField2]: 0, [textField3]: "loading ..." };
1895
- const [loadingData3, setLoadingData] = useState11([]);
1896
- const [data, setData] = useState11(dataProp.items);
1897
- const [total, setTotal] = useState11(0);
1898
- const [value, setValue] = useState11(valueProp);
1899
- const [filter, setFilter] = useState11(filterProp);
1900
- const pageSize3 = (_a = virtual == null ? void 0 : virtual.pageSize) != null ? _a : 10;
1901
- const skipRef = useRef12(0);
1902
- const resetCach = () => {
1903
- dataCaching.current.length = 0;
1904
- };
1905
- const requestData = useCallback4(
1906
- (state) => {
1907
- if (requestStarted.current) {
1908
- clearTimeout(pendingRequest.current);
1909
- pendingRequest.current = setTimeout(() => {
1910
- requestData(state);
1911
- }, 50);
1912
- return;
1913
- }
1914
- requestStarted.current = true;
1915
- getData(state).then(({ items, total: total2 }) => {
1916
- const { skip } = state;
1917
- items.forEach((item, index) => {
1918
- dataCaching.current[index + skip] = item;
1919
- });
1920
- if (skip === skipRef.current) {
1921
- setData(items);
1922
- setTotal(total2);
1923
- onDataChange == null ? void 0 : onDataChange({ items, total: total2 });
1924
- }
1925
- requestStarted.current = false;
1926
- }).catch(() => {
1927
- requestStarted.current = false;
1928
- });
1929
- },
1930
- [getData]
1931
- );
1932
- const handleFilterChange = useCallback4((event) => {
1933
- const filter2 = event.filter.value;
1934
- resetCach();
1935
- requestData({ skip: 0, filter: filter2 });
1936
- setData(loadingData3);
1937
- skipRef.current = 0;
1938
- setFilter(filter2);
1939
- onFilterChange == null ? void 0 : onFilterChange(filter2);
1940
- }, []);
1941
- const shouldRequestData = useCallback4((skip) => {
1942
- for (let i = 0; i < pageSize3; i++) {
1943
- if (!dataCaching.current[skip + i]) {
1944
- return true;
1945
- }
1946
- }
1947
- return false;
1948
- }, []);
1949
- const getCachedData = useCallback4((skip) => {
1950
- const data2 = [];
1951
- for (let i = 0; i < pageSize3; i++) {
1952
- data2.push(dataCaching.current[i + skip] || emptyItem3);
2175
+ var Popover_default = Popover;
2176
+
2177
+ // src/components/Popover/PopoverContent.tsx
2178
+ import { forwardRef as forwardRef26, useCallback as useCallback4, useEffect as useEffect17, useRef as useRef13, useState as useState15 } from "react";
2179
+ import { jsx as jsx33, jsxs as jsxs22 } from "react/jsx-runtime";
2180
+ function getScrollParent(node) {
2181
+ if (node == null) {
2182
+ return null;
2183
+ }
2184
+ if (node.scrollHeight > node.clientHeight) {
2185
+ return node;
2186
+ } else {
2187
+ return getScrollParent(node.parentNode);
2188
+ }
2189
+ }
2190
+ var PopoverContent = forwardRef26((props, ref) => {
2191
+ const _a = props, { children, style, className, onClick } = _a, rest = __objRest(_a, ["children", "style", "className", "onClick"]);
2192
+ const { triggerRef, contentRef, target, onClose } = usePopover();
2193
+ const prefixCls = PREFIX_CLS;
2194
+ const menuListRef = useRef13(null);
2195
+ const [contentStyle, setContentStyle] = useState15({
2196
+ position: "absolute",
2197
+ top: 0,
2198
+ left: 0,
2199
+ visibility: "hidden"
2200
+ });
2201
+ const containerEl = getScrollParent(triggerRef.current) || window;
2202
+ useElementSize_default({
2203
+ target: containerEl,
2204
+ callback: () => {
2205
+ handleSize();
1953
2206
  }
1954
- return data2;
1955
- }, []);
1956
- const pageChange = useCallback4(
1957
- (event) => {
1958
- const newSkip = event.page.skip;
1959
- if (shouldRequestData(newSkip)) {
1960
- requestData({ skip: newSkip, filter });
1961
- }
1962
- const data2 = getCachedData(newSkip);
1963
- setData(data2);
1964
- skipRef.current = newSkip;
1965
- },
1966
- [getCachedData, requestData, shouldRequestData, filter]
1967
- );
1968
- const handleChange = useCallback4((event) => {
1969
- const value2 = event.target.value;
1970
- if (value2 && value2[textField3] === emptyItem3[textField3]) {
2207
+ });
2208
+ useOnClickOutside_default(contentRef, (event) => {
2209
+ const el = triggerRef.current;
2210
+ if (!el || el.contains(event.target))
2211
+ return;
2212
+ onClose();
2213
+ });
2214
+ const handleClick = (ev) => {
2215
+ ev.stopPropagation();
2216
+ onClick == null ? void 0 : onClick(ev);
2217
+ };
2218
+ const handleSize = useCallback4(() => {
2219
+ var _a2, _b;
2220
+ console.log(containerEl);
2221
+ const popoverRect = (_a2 = contentRef.current) == null ? void 0 : _a2.getBoundingClientRect();
2222
+ const triggerClientRect = (_b = triggerRef.current) == null ? void 0 : _b.getBoundingClientRect();
2223
+ if (!popoverRect || !triggerClientRect || !containerEl) {
1971
2224
  return;
1972
2225
  }
1973
- setValue(value2);
1974
- onChange(value2);
1975
- }, []);
1976
- useEffect13(() => {
1977
- const pageSize4 = 10;
1978
- const loadingData4 = [];
1979
- while (loadingData4.length < pageSize4) {
1980
- loadingData4.push(emptyItem3);
1981
- }
1982
- setLoadingData(loadingData4);
2226
+ const container = { innerWidth: window.innerWidth, innerHeight: window.innerHeight };
2227
+ const triggerRect = {
2228
+ width: triggerClientRect.width,
2229
+ height: triggerClientRect.height,
2230
+ top: triggerClientRect.top + window.scrollY,
2231
+ bottom: triggerClientRect.top + triggerClientRect.height + window.scrollY,
2232
+ left: triggerClientRect.left + window.scrollX,
2233
+ right: triggerClientRect.left + triggerClientRect.width + window.scrollX
2234
+ };
2235
+ const outsideX = triggerRect.left + popoverRect.width > container.innerWidth;
2236
+ const outsideY = triggerRect.top + popoverRect.height > container.innerHeight + window.scrollY;
2237
+ const style2 = __spreadProps(__spreadValues({}, target && {
2238
+ width: triggerRect.width,
2239
+ minWidth: "auto"
2240
+ }), {
2241
+ position: "absolute",
2242
+ top: outsideY ? void 0 : triggerRect.bottom,
2243
+ bottom: outsideY ? container.innerHeight - triggerRect.top : void 0,
2244
+ left: outsideX ? void 0 : triggerRect.left,
2245
+ right: outsideX ? container.innerWidth - triggerRect.right : void 0,
2246
+ visibility: void 0
2247
+ });
2248
+ setContentStyle(style2);
1983
2249
  }, []);
1984
- useEffect13(() => {
1985
- setData(dataProp.items);
1986
- }, [dataProp]);
1987
- useEffect13(() => {
1988
- setValue(valueProp);
1989
- }, [valueProp]);
1990
- useEffect13(() => {
1991
- setFilter(filterProp);
1992
- }, [filterProp]);
1993
- useEffect13(() => {
1994
- requestData({ skip: 0, filter });
2250
+ useEffect17(() => {
2251
+ handleSize();
2252
+ containerEl.addEventListener("scroll", handleSize);
2253
+ window.addEventListener("orientationchange", handleSize);
1995
2254
  return () => {
1996
- resetCach();
2255
+ containerEl.removeEventListener("scroll", handleSize);
2256
+ window.removeEventListener("orientationchange", handleSize);
1997
2257
  };
1998
- }, [filter, requestData]);
1999
- return /* @__PURE__ */ jsx30(
2000
- MultiSelect2,
2001
- {
2002
- data,
2003
- value,
2004
- placeholder,
2005
- dataItemKey: keyField2,
2006
- textField: textField3,
2007
- filterable,
2008
- onFilterChange: handleFilterChange,
2009
- virtual: {
2010
- pageSize: pageSize3,
2011
- skip: skipRef.current,
2012
- total
2013
- },
2014
- disabled,
2015
- loading,
2016
- className,
2017
- onChange: handleChange,
2018
- onPageChange: pageChange
2019
- }
2258
+ }, []);
2259
+ return /* @__PURE__ */ jsxs22(
2260
+ "div",
2261
+ __spreadProps(__spreadValues({
2262
+ ref: mergeRefs_default(menuListRef, ref),
2263
+ className: clsx_default(`${prefixCls}popover`, className),
2264
+ style: __spreadValues(__spreadValues({}, style), contentStyle),
2265
+ onClick: handleClick
2266
+ }, rest), {
2267
+ children: [
2268
+ /* @__PURE__ */ jsx33("div", { className: `${prefixCls}popover__overlay` }),
2269
+ children
2270
+ ]
2271
+ })
2020
2272
  );
2021
- };
2022
- var MultiSelectServer_default = MultiSelectServer;
2023
-
2024
- // src/components/MultiSelect/MultiSelect.tsx
2025
- import { jsx as jsx31 } from "react/jsx-runtime";
2026
- var MultiSelect3 = (props) => {
2027
- return props.filterMode === "client" ? /* @__PURE__ */ jsx31(MultiSelectClient_default, __spreadValues({}, props)) : /* @__PURE__ */ jsx31(MultiSelectServer_default, __spreadValues({}, props));
2028
- };
2029
- var MultiSelect_default = MultiSelect3;
2030
-
2031
- // src/components/Field/Field.tsx
2032
- import { forwardRef as forwardRef24 } from "react";
2033
- import { jsx as jsx32, jsxs as jsxs19 } from "react/jsx-runtime";
2034
- var Field = forwardRef24(({ children, label }, ref) => {
2035
- {
2036
- const prefixCls = PREFIX_CLS;
2037
- return /* @__PURE__ */ jsxs19("div", { ref, className: clsx_default(`${prefixCls}field`), children: [
2038
- /* @__PURE__ */ jsx32("div", { className: `${prefixCls}field__label`, children: label }),
2039
- /* @__PURE__ */ jsx32("div", { className: `${prefixCls}field__content`, children })
2040
- ] });
2041
- }
2042
2273
  });
2043
- var Field_default = Field;
2274
+ var PopoverContent_default = PopoverContent;
2275
+
2276
+ // src/components/Popover/PopoverTrigger.tsx
2277
+ import { Children as Children6, cloneElement as cloneElement6, forwardRef as forwardRef27 } from "react";
2278
+ var PopoverTrigger = forwardRef27((props, ref) => {
2279
+ const _a = props, { children, onClick } = _a, rest = __objRest(_a, ["children", "onClick"]);
2280
+ const { isOpen, triggerRef, triggerClosable, onToggle } = usePopover();
2281
+ const child = Children6.only(typeof children === "function" ? children(isOpen) : children);
2282
+ const handleClick = (ev) => {
2283
+ var _a2, _b;
2284
+ ev.preventDefault();
2285
+ triggerClosable && onToggle();
2286
+ onClick == null ? void 0 : onClick(ev);
2287
+ (_b = (_a2 = child.props).onClick) == null ? void 0 : _b.call(_a2, ev);
2288
+ };
2289
+ return cloneElement6(child, __spreadProps(__spreadValues(__spreadValues({}, child.props), rest), {
2290
+ ref: mergeRefs_default(ref, triggerRef),
2291
+ onClick: handleClick
2292
+ }));
2293
+ });
2294
+ var PopoverTrigger_default = PopoverTrigger;
2295
+
2296
+ // src/components/Combobox/ComboboxContent.tsx
2297
+ import { Fragment as Fragment4, useEffect as useEffect18, useRef as useRef14 } from "react";
2044
2298
 
2045
2299
  // src/components/List/List.tsx
2046
- import { forwardRef as forwardRef25 } from "react";
2047
- import { jsx as jsx33 } from "react/jsx-runtime";
2048
- var List = forwardRef25((_a, ref) => {
2300
+ import { forwardRef as forwardRef28 } from "react";
2301
+ import { jsx as jsx34 } from "react/jsx-runtime";
2302
+ var List = forwardRef28((_a, ref) => {
2049
2303
  var _b = _a, { as: Component = "div", children } = _b, rest = __objRest(_b, ["as", "children"]);
2050
- return /* @__PURE__ */ jsx33(Component, __spreadProps(__spreadValues({ ref, className: "us-list" }, rest), { children }));
2304
+ const prefixCls = PREFIX_CLS;
2305
+ return /* @__PURE__ */ jsx34(Component, __spreadProps(__spreadValues({ ref, className: `${prefixCls}list` }, rest), { children }));
2051
2306
  });
2052
2307
  var List_default = List;
2053
2308
 
2054
2309
  // src/components/List/ListGroup.tsx
2055
- import { forwardRef as forwardRef27 } from "react";
2310
+ import { forwardRef as forwardRef30 } from "react";
2056
2311
 
2057
2312
  // src/components/List/ListItem.tsx
2058
- import { forwardRef as forwardRef26 } from "react";
2059
- import { jsx as jsx34, jsxs as jsxs20 } from "react/jsx-runtime";
2060
- var ListItem = forwardRef26(
2313
+ import { forwardRef as forwardRef29 } from "react";
2314
+ import { jsx as jsx35, jsxs as jsxs23 } from "react/jsx-runtime";
2315
+ var ListItem = forwardRef29(
2061
2316
  (_a, ref) => {
2062
2317
  var _b = _a, {
2063
2318
  as: Component = "div",
2064
2319
  className,
2065
2320
  title,
2321
+ subtitle,
2066
2322
  startContent,
2067
2323
  endContent,
2068
2324
  level = 1,
2069
2325
  hoverable,
2070
2326
  selected,
2071
2327
  disabled,
2328
+ slotProps,
2072
2329
  style,
2073
2330
  onClick
2074
2331
  } = _b, rest = __objRest(_b, [
2075
2332
  "as",
2076
2333
  "className",
2077
2334
  "title",
2335
+ "subtitle",
2078
2336
  "startContent",
2079
2337
  "endContent",
2080
2338
  "level",
2081
2339
  "hoverable",
2082
2340
  "selected",
2083
2341
  "disabled",
2342
+ "slotProps",
2084
2343
  "style",
2085
2344
  "onClick"
2086
2345
  ]);
2346
+ var _a2, _b2;
2087
2347
  const prefixCls = PREFIX_CLS;
2088
2348
  const handleClick = (event) => {
2089
2349
  onClick == null ? void 0 : onClick(event);
2090
2350
  };
2091
- return /* @__PURE__ */ jsxs20(
2351
+ return /* @__PURE__ */ jsxs23(
2092
2352
  Component,
2093
2353
  __spreadProps(__spreadValues({
2094
2354
  ref,
@@ -2107,10 +2367,19 @@ var ListItem = forwardRef26(
2107
2367
  onClick: handleClick
2108
2368
  }, rest), {
2109
2369
  children: [
2110
- hoverable && /* @__PURE__ */ jsx34("div", { className: `${prefixCls}overlay` }),
2111
- startContent && /* @__PURE__ */ jsx34("div", { className: `${prefixCls}list-item__start-content`, children: startContent }),
2112
- /* @__PURE__ */ jsx34("div", { className: `${prefixCls}list-item__content`, children: /* @__PURE__ */ jsx34("span", { className: `${prefixCls}list-item__title`, children: title }) }),
2113
- endContent && /* @__PURE__ */ jsx34("div", { className: `${prefixCls}list-item__end-content`, children: endContent })
2370
+ hoverable && /* @__PURE__ */ jsx35("div", { className: `${prefixCls}overlay` }),
2371
+ startContent && /* @__PURE__ */ jsx35("div", { className: `${prefixCls}list-item__start-content`, children: startContent }),
2372
+ /* @__PURE__ */ jsxs23("div", { className: `${prefixCls}list-item__content`, children: [
2373
+ /* @__PURE__ */ jsx35("span", __spreadProps(__spreadValues({}, slotProps == null ? void 0 : slotProps.title), { className: clsx_default(`${prefixCls}list-item__title`, (_a2 = slotProps == null ? void 0 : slotProps.title) == null ? void 0 : _a2.className), children: title })),
2374
+ /* @__PURE__ */ jsx35(
2375
+ "span",
2376
+ __spreadProps(__spreadValues({}, slotProps == null ? void 0 : slotProps.subtitle), {
2377
+ className: clsx_default(`${prefixCls}list-item__subtitle`, (_b2 = slotProps == null ? void 0 : slotProps.subtitle) == null ? void 0 : _b2.className),
2378
+ children: subtitle
2379
+ })
2380
+ )
2381
+ ] }),
2382
+ endContent && /* @__PURE__ */ jsx35("div", { className: `${prefixCls}list-item__end-content`, children: endContent })
2114
2383
  ]
2115
2384
  })
2116
2385
  );
@@ -2119,8 +2388,8 @@ var ListItem = forwardRef26(
2119
2388
  var ListItem_default = ListItem;
2120
2389
 
2121
2390
  // src/components/List/ListGroup.tsx
2122
- import { Fragment as Fragment3, jsx as jsx35, jsxs as jsxs21 } from "react/jsx-runtime";
2123
- var ListGroup = forwardRef27(
2391
+ import { Fragment as Fragment3, jsx as jsx36, jsxs as jsxs24 } from "react/jsx-runtime";
2392
+ var ListGroup = forwardRef30(
2124
2393
  (_a, ref) => {
2125
2394
  var _b = _a, {
2126
2395
  children,
@@ -2144,26 +2413,416 @@ var ListGroup = forwardRef27(
2144
2413
  "onToggle"
2145
2414
  ]);
2146
2415
  const disclosure = isOpen !== void 0 ? { isOpen, onOpen, onClose, onToggle } : useDisclosure_default();
2147
- return /* @__PURE__ */ jsx35("div", { className: "us-list-group", children: /* @__PURE__ */ jsxs21(Collapse_default, __spreadProps(__spreadValues({}, disclosure), { children: [
2148
- /* @__PURE__ */ jsx35(CollapseTrigger_default, { children: /* @__PURE__ */ jsx35(
2416
+ const prefixCls = PREFIX_CLS;
2417
+ return /* @__PURE__ */ jsx36("div", { className: `${prefixCls}list-group`, children: /* @__PURE__ */ jsxs24(Collapse_default, __spreadProps(__spreadValues({}, disclosure), { children: [
2418
+ /* @__PURE__ */ jsx36(CollapseTrigger_default, { children: /* @__PURE__ */ jsx36(
2149
2419
  ListItem_default,
2150
2420
  __spreadValues({
2151
2421
  ref,
2152
- startContent: /* @__PURE__ */ jsxs21(Fragment3, { children: [
2153
- expandVisible && expandPosition === "start" && /* @__PURE__ */ jsx35(Icon_default, { children: disclosure.isOpen ? /* @__PURE__ */ jsx35(ChevronUpIcon_default, {}) : /* @__PURE__ */ jsx35(ChevronDownIcon_default, {}) }),
2422
+ startContent: expandVisible && expandPosition === "start" ? /* @__PURE__ */ jsxs24(Fragment3, { children: [
2423
+ /* @__PURE__ */ jsx36(Icon_default, { children: disclosure.isOpen ? /* @__PURE__ */ jsx36(ChevronUpIcon_default, {}) : /* @__PURE__ */ jsx36(ChevronDownIcon_default, {}) }),
2154
2424
  startContent
2155
- ] }),
2156
- endContent: /* @__PURE__ */ jsxs21(Fragment3, { children: [
2425
+ ] }) : startContent,
2426
+ endContent: expandVisible && expandPosition === "end" ? /* @__PURE__ */ jsxs24(Fragment3, { children: [
2157
2427
  endContent,
2158
- expandVisible && expandPosition === "end" && /* @__PURE__ */ jsx35(Icon_default, { children: disclosure.isOpen ? /* @__PURE__ */ jsx35(ChevronUpIcon_default, {}) : /* @__PURE__ */ jsx35(ChevronDownIcon_default, {}) })
2159
- ] })
2428
+ /* @__PURE__ */ jsx36(Icon_default, { children: disclosure.isOpen ? /* @__PURE__ */ jsx36(ChevronUpIcon_default, {}) : /* @__PURE__ */ jsx36(ChevronDownIcon_default, {}) })
2429
+ ] }) : endContent
2160
2430
  }, rest)
2161
2431
  ) }),
2162
- /* @__PURE__ */ jsx35(CollapseContent_default, { children: /* @__PURE__ */ jsx35("div", { children: /* @__PURE__ */ jsx35(List_default, { children }) }) })
2432
+ /* @__PURE__ */ jsx36(CollapseContent_default, { children: /* @__PURE__ */ jsx36("div", { children: /* @__PURE__ */ jsx36(List_default, { children }) }) })
2163
2433
  ] })) });
2164
2434
  }
2165
2435
  );
2166
2436
  var ListGroup_default = ListGroup;
2437
+
2438
+ // src/components/Combobox/ComboboxContext.tsx
2439
+ import { createContext as createContext7, useContext as useContext9 } from "react";
2440
+ var ComboboxContext = createContext7(null);
2441
+ var useCombobox = () => {
2442
+ const context = useContext9(ComboboxContext);
2443
+ if (!context) {
2444
+ throw new Error("`useCombobox` must be used within a `<Combobox />`");
2445
+ }
2446
+ return context;
2447
+ };
2448
+ var ComboboxContext_default = ComboboxContext;
2449
+
2450
+ // src/components/Combobox/ComboboxContent.tsx
2451
+ import { jsx as jsx37 } from "react/jsx-runtime";
2452
+ var ComboboxContent = () => {
2453
+ const { data, values, offset, setOffset, keyField, textField: textField2, onItemSelect, renderItem } = useCombobox();
2454
+ const parentRef = useRef14(null);
2455
+ const { isOpen } = usePopover();
2456
+ const handleItemSelect = (item) => {
2457
+ var _a;
2458
+ onItemSelect(item);
2459
+ setOffset(((_a = parentRef.current) == null ? void 0 : _a.scrollHeight) || 0);
2460
+ };
2461
+ useEffect18(() => {
2462
+ var _a;
2463
+ if (!isOpen)
2464
+ return;
2465
+ (_a = parentRef.current) == null ? void 0 : _a.scrollTo({ top: offset });
2466
+ }, [isOpen]);
2467
+ return /* @__PURE__ */ jsx37(
2468
+ ScrollArea_default,
2469
+ {
2470
+ ref: parentRef,
2471
+ height: 200,
2472
+ style: {
2473
+ height: `200px`,
2474
+ width: `100%`,
2475
+ position: "relative"
2476
+ },
2477
+ children: /* @__PURE__ */ jsx37(List_default, { children: renderItem ? data.map((item) => /* @__PURE__ */ jsx37(Fragment4, { children: renderItem(item, {
2478
+ title: "",
2479
+ selected: values.includes(item[keyField]),
2480
+ hoverable: true,
2481
+ onClick: () => handleItemSelect(item)
2482
+ }) }, item[keyField])) : data.map((item) => /* @__PURE__ */ jsx37(
2483
+ ListItem_default,
2484
+ {
2485
+ title: item[textField2],
2486
+ selected: values.includes(item[keyField]),
2487
+ hoverable: true,
2488
+ onClick: () => handleItemSelect(item)
2489
+ },
2490
+ item[keyField]
2491
+ )) })
2492
+ }
2493
+ );
2494
+ };
2495
+ var ComboboxContent_default = ComboboxContent;
2496
+
2497
+ // src/components/Combobox/ComboboxVirtual.tsx
2498
+ import { useVirtualizer } from "@tanstack/react-virtual";
2499
+ import { Fragment as Fragment5, useEffect as useEffect19, useRef as useRef15 } from "react";
2500
+
2501
+ // src/components/Combobox/utils.ts
2502
+ var valueToValues = (value) => {
2503
+ return Array.isArray(value) ? value : value !== void 0 ? [value] : [];
2504
+ };
2505
+ var valuesToValue = (values) => {
2506
+ return Array.isArray(values) ? values.length !== 0 ? values[0] : void 0 : values;
2507
+ };
2508
+
2509
+ // src/components/Combobox/ComboboxVirtual.tsx
2510
+ import { jsx as jsx38 } from "react/jsx-runtime";
2511
+ var ComboboxVirtual = () => {
2512
+ const { data, values, keyField, textField: textField2, virtual, onItemSelect, renderItem } = useCombobox();
2513
+ const parentRef = useRef15(null);
2514
+ const { isOpen } = usePopover();
2515
+ const rowVirtualizer = useVirtualizer({
2516
+ count: virtual.count ? virtual.count : virtual.hasNextPage ? data.length + 1 : data.length,
2517
+ getScrollElement: () => parentRef.current,
2518
+ estimateSize: virtual.estimateSize,
2519
+ overscan: 5
2520
+ });
2521
+ const handleItemSelect = (item) => {
2522
+ onItemSelect(item);
2523
+ };
2524
+ useEffect19(() => {
2525
+ if (!isOpen)
2526
+ return;
2527
+ const value = valuesToValue(values);
2528
+ const index = data.findIndex((item) => item[keyField] === value);
2529
+ rowVirtualizer.scrollToIndex(index, { align: "start" });
2530
+ }, [isOpen]);
2531
+ useEffect19(() => {
2532
+ var _a;
2533
+ const [lastItem] = [...rowVirtualizer.getVirtualItems()].reverse();
2534
+ if (!lastItem) {
2535
+ return;
2536
+ }
2537
+ if (lastItem.index >= data.length - 1 && virtual.hasNextPage && !virtual.isFetchingNextPage) {
2538
+ (_a = virtual.onFetchNextPage) == null ? void 0 : _a.call(virtual);
2539
+ }
2540
+ }, [
2541
+ virtual.hasNextPage,
2542
+ virtual.onFetchNextPage,
2543
+ data.length,
2544
+ virtual.isFetchingNextPage,
2545
+ rowVirtualizer.getVirtualItems()
2546
+ ]);
2547
+ return /* @__PURE__ */ jsx38(
2548
+ ScrollArea_default,
2549
+ {
2550
+ ref: parentRef,
2551
+ height: 200,
2552
+ style: {
2553
+ height: `200px`,
2554
+ width: `100%`,
2555
+ position: "relative"
2556
+ },
2557
+ children: /* @__PURE__ */ jsx38(
2558
+ "div",
2559
+ {
2560
+ style: {
2561
+ height: `${rowVirtualizer.getTotalSize()}px`,
2562
+ width: "100%",
2563
+ position: "relative"
2564
+ },
2565
+ children: /* @__PURE__ */ jsx38(List_default, { children: rowVirtualizer.getVirtualItems().map((virtualRow) => {
2566
+ const isLoaderRow = virtualRow.index > data.length - 1;
2567
+ const item = data[virtualRow.index];
2568
+ if (isLoaderRow) {
2569
+ return /* @__PURE__ */ jsx38(
2570
+ ListItem_default,
2571
+ {
2572
+ ref: rowVirtualizer.measureElement,
2573
+ title: virtual.hasNextPage ? "Loading..." : "Nothing more to load",
2574
+ style: {
2575
+ position: "absolute",
2576
+ top: 0,
2577
+ left: 0,
2578
+ width: "100%",
2579
+ height: `${virtualRow.size}px`,
2580
+ transform: `translateY(${virtualRow.start}px)`
2581
+ }
2582
+ },
2583
+ virtualRow.index
2584
+ );
2585
+ }
2586
+ if (!item) {
2587
+ return /* @__PURE__ */ jsx38(
2588
+ ListItem_default,
2589
+ {
2590
+ ref: rowVirtualizer.measureElement,
2591
+ title: `Item ${virtualRow.index} not found`,
2592
+ style: {
2593
+ position: "absolute",
2594
+ top: 0,
2595
+ left: 0,
2596
+ width: "100%",
2597
+ height: `${virtualRow.size}px`,
2598
+ transform: `translateY(${virtualRow.start}px)`
2599
+ }
2600
+ },
2601
+ virtualRow.index
2602
+ );
2603
+ }
2604
+ if (renderItem) {
2605
+ return /* @__PURE__ */ jsx38(Fragment5, { children: renderItem(item, {
2606
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2607
+ // @ts-ignore
2608
+ ref: rowVirtualizer.measureElement,
2609
+ title: "",
2610
+ selected: values.includes(item[keyField]),
2611
+ hoverable: true,
2612
+ style: {
2613
+ position: "absolute",
2614
+ top: 0,
2615
+ left: 0,
2616
+ width: "100%",
2617
+ height: `${virtualRow.size}px`,
2618
+ transform: `translateY(${virtualRow.start}px)`
2619
+ },
2620
+ onClick: () => handleItemSelect(item)
2621
+ }) }, virtualRow.index);
2622
+ }
2623
+ return /* @__PURE__ */ jsx38(
2624
+ ListItem_default,
2625
+ {
2626
+ ref: rowVirtualizer.measureElement,
2627
+ title: item[textField2],
2628
+ selected: values.includes(item[keyField]),
2629
+ hoverable: true,
2630
+ style: {
2631
+ position: "absolute",
2632
+ top: 0,
2633
+ left: 0,
2634
+ width: "100%",
2635
+ height: `${virtualRow.size}px`,
2636
+ transform: `translateY(${virtualRow.start}px)`
2637
+ },
2638
+ onClick: () => handleItemSelect(item)
2639
+ },
2640
+ virtualRow.index
2641
+ );
2642
+ }) })
2643
+ }
2644
+ )
2645
+ }
2646
+ );
2647
+ };
2648
+ var ComboboxVirtual_default = ComboboxVirtual;
2649
+
2650
+ // src/components/Combobox/Combobox.tsx
2651
+ import { jsx as jsx39, jsxs as jsxs25 } from "react/jsx-runtime";
2652
+ var Combobox = (props) => {
2653
+ const {
2654
+ data,
2655
+ value: valueProp,
2656
+ keyField = "key",
2657
+ textField: textField2 = "text",
2658
+ isMultiple = false,
2659
+ disabled,
2660
+ loading,
2661
+ disclosure: disclosureProp,
2662
+ virtual,
2663
+ placeholder,
2664
+ style,
2665
+ onChange,
2666
+ onFilterChange,
2667
+ renderItem
2668
+ } = props;
2669
+ const disclosure = disclosureProp !== void 0 ? disclosureProp : useDisclosure_default();
2670
+ const prefixCls = PREFIX_CLS;
2671
+ const inputRef = useRef16(null);
2672
+ const [filter, setFilter] = useState16("");
2673
+ const [search, setSearch] = useState16("");
2674
+ const [isSearch, setIsSearch] = useState16(false);
2675
+ const values = useMemo6(() => {
2676
+ return valueToValues(valueProp);
2677
+ }, [valueProp]);
2678
+ const items = useMemo6(() => {
2679
+ return data.filter((item) => values.includes(item[keyField]));
2680
+ }, [data, values]);
2681
+ const [offset, setOffset] = useState16(0);
2682
+ const handleFocus = () => {
2683
+ };
2684
+ const handleChange = (values2) => {
2685
+ var _a, _b, _c, _d;
2686
+ if (props.isMultiple) {
2687
+ const items2 = data.filter((item) => values2.includes(item[keyField]));
2688
+ (_a = props.onChange) == null ? void 0 : _a.call(props, items2);
2689
+ (_b = props.onValueChange) == null ? void 0 : _b.call(props, values2);
2690
+ } else {
2691
+ const newValue = valuesToValue(values2);
2692
+ let item;
2693
+ if (newValue !== void 0) {
2694
+ item = data.find((item2) => item2[keyField] === newValue);
2695
+ }
2696
+ (_c = props.onChange) == null ? void 0 : _c.call(props, item);
2697
+ (_d = props.onValueChange) == null ? void 0 : _d.call(props, newValue);
2698
+ }
2699
+ };
2700
+ const handleClear = (event) => {
2701
+ event.stopPropagation();
2702
+ setIsSearch(true);
2703
+ setSearch("");
2704
+ onFilterChange == null ? void 0 : onFilterChange("");
2705
+ onChange == null ? void 0 : onChange(valuesToValue([]));
2706
+ setIsSearch(false);
2707
+ };
2708
+ const handleFilterChange = (event) => {
2709
+ !disclosure.isOpen && disclosure.onOpen();
2710
+ setIsSearch(true);
2711
+ setSearch(event.target.value);
2712
+ onFilterChange == null ? void 0 : onFilterChange(event.target.value);
2713
+ };
2714
+ const handleItemSelect = (item) => {
2715
+ var _a;
2716
+ const newValue = item[keyField];
2717
+ if (props.isMultiple) {
2718
+ const newValues = [...values];
2719
+ const valueIndex = values.indexOf(newValue);
2720
+ if (valueIndex === -1) {
2721
+ newValues.push(newValue);
2722
+ } else {
2723
+ newValues.splice(valueIndex, 1);
2724
+ }
2725
+ handleChange(newValues);
2726
+ } else {
2727
+ const value = valuesToValue(values);
2728
+ if (value !== newValue) {
2729
+ handleChange([newValue]);
2730
+ }
2731
+ }
2732
+ if (isSearch) {
2733
+ setFilter(search);
2734
+ }
2735
+ setIsSearch(false);
2736
+ (_a = inputRef.current) == null ? void 0 : _a.focus();
2737
+ disclosure.onClose();
2738
+ };
2739
+ const handleClose = () => {
2740
+ disclosure.onClose();
2741
+ if (!props.isMultiple) {
2742
+ if (isSearch) {
2743
+ const item = items[0];
2744
+ if (item !== void 0) {
2745
+ setSearch(item[textField2]);
2746
+ onFilterChange == null ? void 0 : onFilterChange(filter);
2747
+ } else {
2748
+ setSearch("");
2749
+ onFilterChange == null ? void 0 : onFilterChange(filter);
2750
+ }
2751
+ setIsSearch(false);
2752
+ }
2753
+ }
2754
+ };
2755
+ useEffect20(() => {
2756
+ if (isSearch)
2757
+ return;
2758
+ if (!props.isMultiple) {
2759
+ const item = items[0];
2760
+ if (item !== void 0) {
2761
+ setSearch(item[textField2]);
2762
+ }
2763
+ }
2764
+ }, [items]);
2765
+ useEffect20(() => {
2766
+ const values2 = valueToValues(valueProp);
2767
+ const value = values2[0];
2768
+ if (value === void 0) {
2769
+ setSearch("");
2770
+ onFilterChange == null ? void 0 : onFilterChange("");
2771
+ }
2772
+ }, [valueProp]);
2773
+ return /* @__PURE__ */ jsx39(
2774
+ ComboboxContext_default.Provider,
2775
+ {
2776
+ value: {
2777
+ data,
2778
+ values,
2779
+ keyField,
2780
+ textField: textField2,
2781
+ isMultiple,
2782
+ virtual,
2783
+ onChange: handleChange,
2784
+ onItemSelect: handleItemSelect,
2785
+ offset,
2786
+ setOffset,
2787
+ renderItem
2788
+ },
2789
+ children: /* @__PURE__ */ jsxs25(Popover_default, __spreadProps(__spreadValues({ target: true }, disclosure), { isOpen: disclosure.isOpen, onClose: handleClose, autoClose: "outside", children: [
2790
+ /* @__PURE__ */ jsx39(PopoverTrigger_default, { children: /* @__PURE__ */ jsx39(
2791
+ TextInput_default,
2792
+ {
2793
+ inputRef,
2794
+ value: search,
2795
+ placeholder,
2796
+ endContent: /* @__PURE__ */ jsxs25("div", { className: `${prefixCls}d-flex ${prefixCls}items-center ${prefixCls}gap-1`, children: [
2797
+ loading ? /* @__PURE__ */ jsx39(Icon_default, { children: /* @__PURE__ */ jsx39(LoaderIcon_default, { className: `${prefixCls}animation-spin` }) }) : /* @__PURE__ */ jsx39(Button, { color: "secondary", variant: "plain", size: "xs", iconOnly: true, onClick: handleClear, children: /* @__PURE__ */ jsx39(Icon_default, { children: /* @__PURE__ */ jsx39(CloseIcon_default, {}) }) }),
2798
+ /* @__PURE__ */ jsx39("div", { style: { pointerEvents: "none" }, children: /* @__PURE__ */ jsx39(Icon_default, { children: disclosure.isOpen ? /* @__PURE__ */ jsx39(ChevronUpIcon_default, {}) : /* @__PURE__ */ jsx39(ChevronDownIcon_default, {}) }) })
2799
+ ] }),
2800
+ disabled,
2801
+ style,
2802
+ onChange: handleFilterChange,
2803
+ onFocus: handleFocus
2804
+ }
2805
+ ) }),
2806
+ /* @__PURE__ */ jsx39(PopoverContent_default, { children: /* @__PURE__ */ jsx39("div", { children: virtual ? /* @__PURE__ */ jsx39(ComboboxVirtual_default, {}) : /* @__PURE__ */ jsx39(ComboboxContent_default, {}) }) })
2807
+ ] }))
2808
+ }
2809
+ );
2810
+ };
2811
+ var Combobox_default = Combobox;
2812
+
2813
+ // src/components/Field/Field.tsx
2814
+ import { forwardRef as forwardRef31 } from "react";
2815
+ import { jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
2816
+ var Field = forwardRef31(({ children, label }, ref) => {
2817
+ {
2818
+ const prefixCls = PREFIX_CLS;
2819
+ return /* @__PURE__ */ jsxs26("div", { ref, className: clsx_default(`${prefixCls}field`), children: [
2820
+ /* @__PURE__ */ jsx40("div", { className: `${prefixCls}field__label`, children: label }),
2821
+ /* @__PURE__ */ jsx40("div", { className: `${prefixCls}field__content`, children })
2822
+ ] });
2823
+ }
2824
+ });
2825
+ var Field_default = Field;
2167
2826
  export {
2168
2827
  Accordion_default as Accordion,
2169
2828
  AccordionContent_default as AccordionContent,
@@ -2180,6 +2839,7 @@ export {
2180
2839
  CollapseContent_default as CollapseContent,
2181
2840
  CollapseContext_default as CollapseContext,
2182
2841
  CollapseTrigger_default as CollapseTrigger,
2842
+ Combobox_default as Combobox,
2183
2843
  Drawer_default as Drawer,
2184
2844
  Field_default as Field,
2185
2845
  Icon_default as Icon,
@@ -2192,22 +2852,31 @@ export {
2192
2852
  MenuItem_default as MenuItem,
2193
2853
  MenuSubmenu_default as MenuSubmenu,
2194
2854
  MenuValueContext_default as MenuValueContext,
2195
- MultiSelect_default as MultiSelect,
2196
2855
  Portal_default as Portal,
2856
+ QueryStatus,
2197
2857
  ScrollArea_default as ScrollArea,
2198
2858
  Select_default as Select,
2199
2859
  Switch_default as Switch,
2200
2860
  Tab,
2201
2861
  Tabs,
2862
+ TextInput_default as TextInput,
2202
2863
  Toolbar_default as Toolbar,
2203
2864
  Transition_default as Transition,
2865
+ assignRef,
2866
+ clsx_default as clsx,
2204
2867
  getOpenValuesByPathname,
2868
+ mergeRefs_default as mergeRefs,
2869
+ scrollToItem,
2205
2870
  useAccordionItem,
2206
2871
  useCollapse,
2872
+ useDebounce_default as useDebounce,
2207
2873
  useDisclosure_default as useDisclosure,
2874
+ useElementSize_default as useElementSize,
2875
+ useInfiniteQuery_default as useInfiniteQuery,
2208
2876
  useLocalStorage,
2209
2877
  useMenu,
2210
2878
  useMenuItemValue,
2879
+ useOnClickOutside_default as useOnClickOutside,
2211
2880
  usePrevious,
2212
2881
  useStep
2213
2882
  };