@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.d.mts +188 -118
- package/dist/index.d.ts +188 -118
- package/dist/index.js +1283 -600
- package/dist/index.mjs +1204 -535
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -55,6 +55,26 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
55
55
|
mod
|
|
56
56
|
));
|
|
57
57
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
58
|
+
var __async = (__this, __arguments, generator) => {
|
|
59
|
+
return new Promise((resolve, reject) => {
|
|
60
|
+
var fulfilled = (value) => {
|
|
61
|
+
try {
|
|
62
|
+
step(generator.next(value));
|
|
63
|
+
} catch (e) {
|
|
64
|
+
reject(e);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
var rejected = (value) => {
|
|
68
|
+
try {
|
|
69
|
+
step(generator.throw(value));
|
|
70
|
+
} catch (e) {
|
|
71
|
+
reject(e);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
75
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
76
|
+
});
|
|
77
|
+
};
|
|
58
78
|
|
|
59
79
|
// src/index.ts
|
|
60
80
|
var src_exports = {};
|
|
@@ -74,6 +94,7 @@ __export(src_exports, {
|
|
|
74
94
|
CollapseContent: () => CollapseContent_default,
|
|
75
95
|
CollapseContext: () => CollapseContext_default,
|
|
76
96
|
CollapseTrigger: () => CollapseTrigger_default,
|
|
97
|
+
Combobox: () => Combobox_default,
|
|
77
98
|
Drawer: () => Drawer_default,
|
|
78
99
|
Field: () => Field_default,
|
|
79
100
|
Icon: () => Icon_default,
|
|
@@ -86,22 +107,31 @@ __export(src_exports, {
|
|
|
86
107
|
MenuItem: () => MenuItem_default,
|
|
87
108
|
MenuSubmenu: () => MenuSubmenu_default,
|
|
88
109
|
MenuValueContext: () => MenuValueContext_default,
|
|
89
|
-
MultiSelect: () => MultiSelect_default,
|
|
90
110
|
Portal: () => Portal_default,
|
|
111
|
+
QueryStatus: () => QueryStatus,
|
|
91
112
|
ScrollArea: () => ScrollArea_default,
|
|
92
113
|
Select: () => Select_default,
|
|
93
114
|
Switch: () => Switch_default,
|
|
94
115
|
Tab: () => Tab,
|
|
95
116
|
Tabs: () => Tabs,
|
|
117
|
+
TextInput: () => TextInput_default,
|
|
96
118
|
Toolbar: () => Toolbar_default,
|
|
97
119
|
Transition: () => Transition_default,
|
|
120
|
+
assignRef: () => assignRef,
|
|
121
|
+
clsx: () => clsx_default,
|
|
98
122
|
getOpenValuesByPathname: () => getOpenValuesByPathname,
|
|
123
|
+
mergeRefs: () => mergeRefs_default,
|
|
124
|
+
scrollToItem: () => scrollToItem,
|
|
99
125
|
useAccordionItem: () => useAccordionItem,
|
|
100
126
|
useCollapse: () => useCollapse,
|
|
127
|
+
useDebounce: () => useDebounce_default,
|
|
101
128
|
useDisclosure: () => useDisclosure_default,
|
|
129
|
+
useElementSize: () => useElementSize_default,
|
|
130
|
+
useInfiniteQuery: () => useInfiniteQuery_default,
|
|
102
131
|
useLocalStorage: () => useLocalStorage,
|
|
103
132
|
useMenu: () => useMenu,
|
|
104
133
|
useMenuItemValue: () => useMenuItemValue,
|
|
134
|
+
useOnClickOutside: () => useOnClickOutside_default,
|
|
105
135
|
usePrevious: () => usePrevious,
|
|
106
136
|
useStep: () => useStep
|
|
107
137
|
});
|
|
@@ -117,11 +147,14 @@ var PREFIX_CLS = "us-";
|
|
|
117
147
|
|
|
118
148
|
// src/components/Portal/Portal.tsx
|
|
119
149
|
var import_react = require("react");
|
|
120
|
-
var
|
|
150
|
+
var import_react_dom = require("react-dom");
|
|
121
151
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
122
|
-
var Portal = (0, import_react.forwardRef)(({ children }, ref) => {
|
|
123
|
-
const
|
|
124
|
-
return
|
|
152
|
+
var Portal = (0, import_react.forwardRef)(({ children, container }, ref) => {
|
|
153
|
+
const prefixCls = PREFIX_CLS;
|
|
154
|
+
return (0, import_react_dom.createPortal)(
|
|
155
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref, className: `${prefixCls}portal`, children }),
|
|
156
|
+
container || document.body
|
|
157
|
+
);
|
|
125
158
|
});
|
|
126
159
|
var Portal_default = Portal;
|
|
127
160
|
|
|
@@ -214,7 +247,7 @@ var Badge_default = Badge;
|
|
|
214
247
|
|
|
215
248
|
// src/components/Button/Button.tsx
|
|
216
249
|
var import_clsx5 = __toESM(require("clsx"));
|
|
217
|
-
var
|
|
250
|
+
var import_react9 = require("react");
|
|
218
251
|
|
|
219
252
|
// src/icons/ChevronDownIcon.tsx
|
|
220
253
|
var import_react4 = require("react");
|
|
@@ -293,12 +326,40 @@ var LoaderIcon = (0, import_react6.forwardRef)((props, ref) => {
|
|
|
293
326
|
});
|
|
294
327
|
var LoaderIcon_default = LoaderIcon;
|
|
295
328
|
|
|
329
|
+
// src/icons/CloseIcon.tsx
|
|
330
|
+
var import_react7 = require("react");
|
|
331
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
332
|
+
var CloseIcon = (0, import_react7.forwardRef)((props, ref) => {
|
|
333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
334
|
+
"svg",
|
|
335
|
+
__spreadProps(__spreadValues({
|
|
336
|
+
ref,
|
|
337
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
338
|
+
width: "24",
|
|
339
|
+
height: "24",
|
|
340
|
+
viewBox: "0 0 24 24",
|
|
341
|
+
strokeWidth: "2",
|
|
342
|
+
stroke: "currentColor",
|
|
343
|
+
fill: "none",
|
|
344
|
+
strokeLinecap: "round",
|
|
345
|
+
strokeLinejoin: "round"
|
|
346
|
+
}, props), {
|
|
347
|
+
children: [
|
|
348
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
349
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M18 6l-12 12" }),
|
|
350
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M6 6l12 12" })
|
|
351
|
+
]
|
|
352
|
+
})
|
|
353
|
+
);
|
|
354
|
+
});
|
|
355
|
+
var CloseIcon_default = CloseIcon;
|
|
356
|
+
|
|
296
357
|
// src/components/Icon/Icon.tsx
|
|
297
358
|
var import_clsx4 = __toESM(require("clsx"));
|
|
298
|
-
var
|
|
299
|
-
var Icon = (0,
|
|
300
|
-
const child =
|
|
301
|
-
return (0,
|
|
359
|
+
var import_react8 = require("react");
|
|
360
|
+
var Icon = (0, import_react8.forwardRef)(({ children, size }, ref) => {
|
|
361
|
+
const child = import_react8.Children.only(children);
|
|
362
|
+
return (0, import_react8.cloneElement)(child, __spreadProps(__spreadValues({
|
|
302
363
|
ref
|
|
303
364
|
}, child.props), {
|
|
304
365
|
className: (0, import_clsx4.default)(`${PREFIX_CLS}icon`, { [`${PREFIX_CLS}font-size-${size}`]: size }, child.props.className)
|
|
@@ -307,8 +368,8 @@ var Icon = (0, import_react7.forwardRef)(({ children, size }, ref) => {
|
|
|
307
368
|
var Icon_default = Icon;
|
|
308
369
|
|
|
309
370
|
// src/components/Button/Button.tsx
|
|
310
|
-
var
|
|
311
|
-
var Button = (0,
|
|
371
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
372
|
+
var Button = (0, import_react9.forwardRef)(
|
|
312
373
|
(_a, ref) => {
|
|
313
374
|
var _b = _a, {
|
|
314
375
|
as: Component = "button",
|
|
@@ -339,19 +400,20 @@ var Button = (0, import_react8.forwardRef)(
|
|
|
339
400
|
"loading",
|
|
340
401
|
"disabled"
|
|
341
402
|
]);
|
|
342
|
-
|
|
403
|
+
const prefixCls = PREFIX_CLS;
|
|
404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
343
405
|
Component,
|
|
344
406
|
__spreadProps(__spreadValues({
|
|
345
407
|
ref,
|
|
346
408
|
className: (0, import_clsx5.default)(
|
|
347
|
-
`${
|
|
409
|
+
`${prefixCls}button`,
|
|
348
410
|
{
|
|
349
|
-
[`${
|
|
350
|
-
[`${
|
|
351
|
-
[`${
|
|
352
|
-
[`${
|
|
353
|
-
[`${
|
|
354
|
-
[`${
|
|
411
|
+
[`${prefixCls}button--${variant}`]: variant,
|
|
412
|
+
[`${prefixCls}button--${color}`]: color,
|
|
413
|
+
[`${prefixCls}button--${size}`]: size,
|
|
414
|
+
[`${prefixCls}button--block`]: block,
|
|
415
|
+
[`${prefixCls}button--icon-only`]: iconOnly,
|
|
416
|
+
[`${prefixCls}button--disabled`]: disabled
|
|
355
417
|
},
|
|
356
418
|
className
|
|
357
419
|
),
|
|
@@ -359,10 +421,10 @@ var Button = (0, import_react8.forwardRef)(
|
|
|
359
421
|
disabled
|
|
360
422
|
}, rest), {
|
|
361
423
|
children: [
|
|
362
|
-
/* @__PURE__ */ (0,
|
|
363
|
-
/* @__PURE__ */ (0,
|
|
364
|
-
loading ? /* @__PURE__ */ (0,
|
|
365
|
-
/* @__PURE__ */ (0,
|
|
424
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `${prefixCls}overlay` }),
|
|
425
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `${prefixCls}outline` }),
|
|
426
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon_default, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(LoaderIcon_default, { className: `${prefixCls}animation-spin` }) }) : startContent,
|
|
427
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `${prefixCls}button__content`, children }),
|
|
366
428
|
endContent
|
|
367
429
|
]
|
|
368
430
|
})
|
|
@@ -371,7 +433,32 @@ var Button = (0, import_react8.forwardRef)(
|
|
|
371
433
|
);
|
|
372
434
|
|
|
373
435
|
// src/components/Card/Card.tsx
|
|
374
|
-
var
|
|
436
|
+
var import_react10 = require("react");
|
|
437
|
+
|
|
438
|
+
// src/utils/scroll.ts
|
|
439
|
+
var scrollToItem = (parentElement, currentElement) => {
|
|
440
|
+
const parentRect = parentElement.getBoundingClientRect();
|
|
441
|
+
const currentRect = currentElement.getBoundingClientRect();
|
|
442
|
+
const behavior = "smooth";
|
|
443
|
+
const previousElement = currentElement.previousSibling;
|
|
444
|
+
const previousRect = (previousElement == null ? void 0 : previousElement.getBoundingClientRect()) || currentRect;
|
|
445
|
+
if (parentRect.left > previousRect.left) {
|
|
446
|
+
let offset = 0;
|
|
447
|
+
if (previousElement) {
|
|
448
|
+
offset = previousRect.left - parentRect.left + parentElement.scrollLeft + previousRect.width / 4;
|
|
449
|
+
}
|
|
450
|
+
parentElement.scrollTo({ behavior, left: offset });
|
|
451
|
+
}
|
|
452
|
+
const nextElement = currentElement.nextSibling;
|
|
453
|
+
const nextRect = (nextElement == null ? void 0 : nextElement.getBoundingClientRect()) || currentRect;
|
|
454
|
+
if (parentRect.right < nextRect.right) {
|
|
455
|
+
let offset = parentElement.scrollWidth;
|
|
456
|
+
if (nextElement) {
|
|
457
|
+
offset = nextRect.right - parentRect.right + parentElement.scrollLeft - nextRect.width / 4;
|
|
458
|
+
}
|
|
459
|
+
parentElement.scrollTo({ behavior, left: offset });
|
|
460
|
+
}
|
|
461
|
+
};
|
|
375
462
|
|
|
376
463
|
// src/utils/clsx.ts
|
|
377
464
|
function toVal(mix) {
|
|
@@ -413,54 +500,52 @@ function clsx6(...inputs) {
|
|
|
413
500
|
}
|
|
414
501
|
var clsx_default = clsx6;
|
|
415
502
|
|
|
416
|
-
// src/utils/
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
if (parentRect.left > previousRect.left) {
|
|
424
|
-
let offset = 0;
|
|
425
|
-
if (previousElement) {
|
|
426
|
-
offset = previousRect.left - parentRect.left + parentElement.scrollLeft + previousRect.width / 4;
|
|
427
|
-
}
|
|
428
|
-
parentElement.scrollTo({ behavior, left: offset });
|
|
503
|
+
// src/utils/mergeRefs.ts
|
|
504
|
+
function assignRef(ref, value) {
|
|
505
|
+
if (ref == null)
|
|
506
|
+
return;
|
|
507
|
+
if (typeof ref === "function") {
|
|
508
|
+
ref(value);
|
|
509
|
+
return;
|
|
429
510
|
}
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
if (nextElement) {
|
|
435
|
-
offset = nextRect.right - parentRect.right + parentElement.scrollLeft - nextRect.width / 4;
|
|
436
|
-
}
|
|
437
|
-
parentElement.scrollTo({ behavior, left: offset });
|
|
511
|
+
try {
|
|
512
|
+
ref.current = value;
|
|
513
|
+
} catch (error) {
|
|
514
|
+
throw new Error(`Cannot assign value '${value}' to ref '${ref}'`);
|
|
438
515
|
}
|
|
439
|
-
}
|
|
516
|
+
}
|
|
517
|
+
function mergeRefs2(...refs) {
|
|
518
|
+
return (node) => {
|
|
519
|
+
refs.forEach((ref) => {
|
|
520
|
+
assignRef(ref, node);
|
|
521
|
+
});
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
var mergeRefs_default = mergeRefs2;
|
|
440
525
|
|
|
441
526
|
// src/components/Card/Card.tsx
|
|
442
|
-
var
|
|
443
|
-
var Card = (0,
|
|
527
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
528
|
+
var Card = (0, import_react10.forwardRef)((_a, ref) => {
|
|
444
529
|
var _b = _a, { as: Component = "div", children, className } = _b, rest = __objRest(_b, ["as", "children", "className"]);
|
|
445
530
|
const prefixCls = PREFIX_CLS;
|
|
446
|
-
return /* @__PURE__ */ (0,
|
|
531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Component, __spreadProps(__spreadValues({ ref, className: clsx_default(`${prefixCls}card`, className) }, rest), { children }));
|
|
447
532
|
});
|
|
448
533
|
var Card_default = Card;
|
|
449
534
|
|
|
450
535
|
// src/components/Card/CardHeader.tsx
|
|
451
|
-
var
|
|
452
|
-
var
|
|
453
|
-
var CardHeader = (0,
|
|
536
|
+
var import_react11 = require("react");
|
|
537
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
538
|
+
var CardHeader = (0, import_react11.forwardRef)(
|
|
454
539
|
(_a, ref) => {
|
|
455
540
|
var _b = _a, { as: Component = "div", className, title, subtitle, startContent, endContent } = _b, rest = __objRest(_b, ["as", "className", "title", "subtitle", "startContent", "endContent"]);
|
|
456
541
|
const prefixCls = PREFIX_CLS;
|
|
457
|
-
return /* @__PURE__ */ (0,
|
|
458
|
-
startContent && /* @__PURE__ */ (0,
|
|
459
|
-
/* @__PURE__ */ (0,
|
|
460
|
-
/* @__PURE__ */ (0,
|
|
461
|
-
subtitle && /* @__PURE__ */ (0,
|
|
542
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Component, __spreadProps(__spreadValues({ ref, className: clsx_default(`${prefixCls}card-header`, className) }, rest), { children: [
|
|
543
|
+
startContent && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: `${prefixCls}card-header__start-content`, children: startContent }),
|
|
544
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: `${prefixCls}card-header__content`, children: [
|
|
545
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: `${prefixCls}card-header__title`, children: title }),
|
|
546
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: `${prefixCls}card-header__subtitle`, children: subtitle })
|
|
462
547
|
] }),
|
|
463
|
-
endContent && /* @__PURE__ */ (0,
|
|
548
|
+
endContent && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: `${prefixCls}card-header__end-content`, children: endContent })
|
|
464
549
|
] }));
|
|
465
550
|
}
|
|
466
551
|
);
|
|
@@ -468,12 +553,12 @@ var CardHeader_default = CardHeader;
|
|
|
468
553
|
|
|
469
554
|
// src/components/Chip/Chip.tsx
|
|
470
555
|
var import_clsx7 = __toESM(require("clsx"));
|
|
471
|
-
var
|
|
472
|
-
var
|
|
473
|
-
var Chip = (0,
|
|
556
|
+
var import_react12 = require("react");
|
|
557
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
558
|
+
var Chip = (0, import_react12.forwardRef)(
|
|
474
559
|
(_a, ref) => {
|
|
475
560
|
var _b = _a, { as: Component = "div", children, className, variant, color, size } = _b, rest = __objRest(_b, ["as", "children", "className", "variant", "color", "size"]);
|
|
476
|
-
return /* @__PURE__ */ (0,
|
|
561
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
477
562
|
Component,
|
|
478
563
|
__spreadProps(__spreadValues({
|
|
479
564
|
ref,
|
|
@@ -488,8 +573,8 @@ var Chip = (0, import_react11.forwardRef)(
|
|
|
488
573
|
)
|
|
489
574
|
}, rest), {
|
|
490
575
|
children: [
|
|
491
|
-
/* @__PURE__ */ (0,
|
|
492
|
-
/* @__PURE__ */ (0,
|
|
576
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: (0, import_clsx7.default)(`${PREFIX_CLS}overlay`) }),
|
|
577
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `${PREFIX_CLS}outline` }),
|
|
493
578
|
children
|
|
494
579
|
]
|
|
495
580
|
})
|
|
@@ -499,13 +584,13 @@ var Chip = (0, import_react11.forwardRef)(
|
|
|
499
584
|
var Chip_default = Chip;
|
|
500
585
|
|
|
501
586
|
// src/components/Collapse/Collapse.tsx
|
|
502
|
-
var
|
|
587
|
+
var import_react14 = require("react");
|
|
503
588
|
|
|
504
589
|
// src/components/Collapse/CollapseContext.tsx
|
|
505
|
-
var
|
|
506
|
-
var CollapseContext = (0,
|
|
590
|
+
var import_react13 = require("react");
|
|
591
|
+
var CollapseContext = (0, import_react13.createContext)(null);
|
|
507
592
|
var useCollapse = () => {
|
|
508
|
-
const context = (0,
|
|
593
|
+
const context = (0, import_react13.useContext)(CollapseContext);
|
|
509
594
|
if (!context) {
|
|
510
595
|
throw new Error("`useCollapse` must be used within a `<Collapse />`");
|
|
511
596
|
}
|
|
@@ -514,12 +599,12 @@ var useCollapse = () => {
|
|
|
514
599
|
var CollapseContext_default = CollapseContext;
|
|
515
600
|
|
|
516
601
|
// src/components/Collapse/Collapse.tsx
|
|
517
|
-
var
|
|
602
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
518
603
|
var Collapse = ({ children, isOpen, onOpen, onClose, onToggle }) => {
|
|
519
|
-
const collapseRef = (0,
|
|
520
|
-
const [selfIsOpen, setSelfIsOpen] = (0,
|
|
521
|
-
const [heightAuto, setHeightAuto] = (0,
|
|
522
|
-
const [trigger, content] =
|
|
604
|
+
const collapseRef = (0, import_react14.useRef)(null);
|
|
605
|
+
const [selfIsOpen, setSelfIsOpen] = (0, import_react14.useState)(isOpen != null ? isOpen : false);
|
|
606
|
+
const [heightAuto, setHeightAuto] = (0, import_react14.useState)(false);
|
|
607
|
+
const [trigger, content] = import_react14.Children.toArray(children);
|
|
523
608
|
const handleOpen = () => {
|
|
524
609
|
setSelfIsOpen(true);
|
|
525
610
|
onOpen == null ? void 0 : onOpen();
|
|
@@ -532,7 +617,7 @@ var Collapse = ({ children, isOpen, onOpen, onClose, onToggle }) => {
|
|
|
532
617
|
setSelfIsOpen((prevState) => !prevState);
|
|
533
618
|
onToggle == null ? void 0 : onToggle();
|
|
534
619
|
};
|
|
535
|
-
(0,
|
|
620
|
+
(0, import_react14.useEffect)(() => {
|
|
536
621
|
if (isOpen !== void 0) {
|
|
537
622
|
setSelfIsOpen(isOpen);
|
|
538
623
|
}
|
|
@@ -544,7 +629,7 @@ var Collapse = ({ children, isOpen, onOpen, onClose, onToggle }) => {
|
|
|
544
629
|
}
|
|
545
630
|
}, 100);
|
|
546
631
|
}, [isOpen]);
|
|
547
|
-
return /* @__PURE__ */ (0,
|
|
632
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
548
633
|
CollapseContext_default.Provider,
|
|
549
634
|
{
|
|
550
635
|
value: {
|
|
@@ -566,12 +651,12 @@ var Collapse_default = Collapse;
|
|
|
566
651
|
|
|
567
652
|
// src/components/Collapse/CollapseContent.tsx
|
|
568
653
|
var import_clsx8 = __toESM(require("clsx"));
|
|
569
|
-
var
|
|
570
|
-
var CollapseContent = (0,
|
|
654
|
+
var import_react15 = require("react");
|
|
655
|
+
var CollapseContent = (0, import_react15.forwardRef)(({ children }, ref) => {
|
|
571
656
|
var _a, _b;
|
|
572
657
|
const { collapseRef, isOpen, heightAuto } = useCollapse();
|
|
573
|
-
const child =
|
|
574
|
-
return (0,
|
|
658
|
+
const child = import_react15.Children.only(children);
|
|
659
|
+
return (0, import_react15.cloneElement)(child, __spreadProps(__spreadValues({}, child.props), {
|
|
575
660
|
ref: (node) => {
|
|
576
661
|
collapseRef.current = node;
|
|
577
662
|
if (ref !== null) {
|
|
@@ -587,12 +672,12 @@ var CollapseContent = (0, import_react14.forwardRef)(({ children }, ref) => {
|
|
|
587
672
|
var CollapseContent_default = CollapseContent;
|
|
588
673
|
|
|
589
674
|
// src/components/Collapse/CollapseTrigger.tsx
|
|
590
|
-
var
|
|
591
|
-
var CollapseTrigger = (0,
|
|
675
|
+
var import_react16 = require("react");
|
|
676
|
+
var CollapseTrigger = (0, import_react16.forwardRef)(({ children }, ref) => {
|
|
592
677
|
const { collapseRef, onToggle } = useCollapse();
|
|
593
|
-
const child =
|
|
678
|
+
const child = import_react16.Children.only(children);
|
|
594
679
|
const _a = child.props, { onClick } = _a, rest = __objRest(_a, ["onClick"]);
|
|
595
|
-
return (0,
|
|
680
|
+
return (0, import_react16.cloneElement)(child, __spreadValues({
|
|
596
681
|
ref,
|
|
597
682
|
onClick: (event) => {
|
|
598
683
|
if (!collapseRef.current) {
|
|
@@ -607,16 +692,16 @@ var CollapseTrigger_default = CollapseTrigger;
|
|
|
607
692
|
|
|
608
693
|
// src/components/Drawer/Drawer.tsx
|
|
609
694
|
var import_clsx9 = __toESM(require("clsx"));
|
|
610
|
-
var
|
|
695
|
+
var import_react17 = require("react");
|
|
611
696
|
var import_react_merge_refs2 = require("react-merge-refs");
|
|
612
|
-
var
|
|
613
|
-
var Drawer = (0,
|
|
697
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
698
|
+
var Drawer = (0, import_react17.forwardRef)((props, ref) => {
|
|
614
699
|
const { children, className, isOpen, size = "md", position = "left", onClose } = props;
|
|
615
|
-
const nodeRef = (0,
|
|
700
|
+
const nodeRef = (0, import_react17.useRef)(null);
|
|
616
701
|
const handleClose = () => {
|
|
617
702
|
onClose();
|
|
618
703
|
};
|
|
619
|
-
return /* @__PURE__ */ (0,
|
|
704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Backdrop_default, { isOpen, onClose: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Transition_default, { nodeRef, isOpen, name: `${PREFIX_CLS}drawer`, enter: 600, leave: 300, unmountOnExit: true, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
620
705
|
"div",
|
|
621
706
|
{
|
|
622
707
|
ref: (0, import_react_merge_refs2.mergeRefs)([ref, nodeRef]),
|
|
@@ -629,7 +714,7 @@ var Drawer = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
629
714
|
className
|
|
630
715
|
),
|
|
631
716
|
children: [
|
|
632
|
-
/* @__PURE__ */ (0,
|
|
717
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: `${PREFIX_CLS}drawer__overlay` }),
|
|
633
718
|
children
|
|
634
719
|
]
|
|
635
720
|
}
|
|
@@ -639,13 +724,13 @@ var Drawer_default = Drawer;
|
|
|
639
724
|
|
|
640
725
|
// src/components/Menu/Menu.tsx
|
|
641
726
|
var import_clsx13 = __toESM(require("clsx"));
|
|
642
|
-
var
|
|
727
|
+
var import_react23 = require("react");
|
|
643
728
|
|
|
644
729
|
// src/components/Menu/MenuContext.tsx
|
|
645
|
-
var
|
|
646
|
-
var MenuContext = (0,
|
|
730
|
+
var import_react18 = require("react");
|
|
731
|
+
var MenuContext = (0, import_react18.createContext)(null);
|
|
647
732
|
var useMenu = () => {
|
|
648
|
-
const context = (0,
|
|
733
|
+
const context = (0, import_react18.useContext)(MenuContext);
|
|
649
734
|
if (!context) {
|
|
650
735
|
throw new Error("`useMenu` must be used within a `<Menu />`");
|
|
651
736
|
}
|
|
@@ -655,17 +740,17 @@ var MenuContext_default = MenuContext;
|
|
|
655
740
|
|
|
656
741
|
// src/components/Menu/MenuGroup.tsx
|
|
657
742
|
var import_clsx12 = __toESM(require("clsx"));
|
|
658
|
-
var
|
|
743
|
+
var import_react22 = require("react");
|
|
659
744
|
|
|
660
745
|
// src/components/Menu/MenuItem.tsx
|
|
661
746
|
var import_clsx10 = __toESM(require("clsx"));
|
|
662
|
-
var
|
|
747
|
+
var import_react20 = require("react");
|
|
663
748
|
|
|
664
749
|
// src/components/Menu/MenuValueContext.tsx
|
|
665
|
-
var
|
|
666
|
-
var MenuValueContext = (0,
|
|
750
|
+
var import_react19 = require("react");
|
|
751
|
+
var MenuValueContext = (0, import_react19.createContext)([]);
|
|
667
752
|
var useMenuItemValue = () => {
|
|
668
|
-
const context = (0,
|
|
753
|
+
const context = (0, import_react19.useContext)(MenuValueContext);
|
|
669
754
|
if (!context) {
|
|
670
755
|
throw new Error("`useMenuValue` must be used within a `<MenuValueContext.Provider />`");
|
|
671
756
|
}
|
|
@@ -674,12 +759,13 @@ var useMenuItemValue = () => {
|
|
|
674
759
|
var MenuValueContext_default = MenuValueContext;
|
|
675
760
|
|
|
676
761
|
// src/components/Menu/MenuItem.tsx
|
|
677
|
-
var
|
|
678
|
-
var MenuItem = (0,
|
|
762
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
763
|
+
var MenuItem = (0, import_react20.forwardRef)((props, ref) => {
|
|
679
764
|
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"]);
|
|
680
765
|
const { value: menuValue, originalValue, navMode, onChange, onOpen, onItemSelect } = useMenu();
|
|
681
|
-
const values = (0,
|
|
766
|
+
const values = (0, import_react20.useContext)(MenuValueContext_default);
|
|
682
767
|
const mergedValues = [...values, value];
|
|
768
|
+
const isSelected = menuValue[level - 1] === value;
|
|
683
769
|
const handleClick = (event) => {
|
|
684
770
|
if (value !== void 0) {
|
|
685
771
|
onChange(mergedValues);
|
|
@@ -687,20 +773,20 @@ var MenuItem = (0, import_react19.forwardRef)((props, ref) => {
|
|
|
687
773
|
onClick == null ? void 0 : onClick(event);
|
|
688
774
|
onItemSelect == null ? void 0 : onItemSelect(props);
|
|
689
775
|
};
|
|
690
|
-
(0,
|
|
776
|
+
(0, import_react20.useEffect)(() => {
|
|
691
777
|
if (navMode === "automatic" && originalValue.length > 0 && originalValue[originalValue.length - 1] === value) {
|
|
692
778
|
onOpen(values);
|
|
693
779
|
onChange(mergedValues);
|
|
694
780
|
}
|
|
695
781
|
}, [value, originalValue, navMode]);
|
|
696
|
-
return /* @__PURE__ */ (0,
|
|
782
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
697
783
|
Component,
|
|
698
784
|
__spreadProps(__spreadValues({
|
|
699
785
|
ref,
|
|
700
786
|
className: (0, import_clsx10.default)(
|
|
701
787
|
`${PREFIX_CLS}menu-item`,
|
|
702
788
|
{
|
|
703
|
-
[`${PREFIX_CLS}menu-item--selected`]:
|
|
789
|
+
[`${PREFIX_CLS}menu-item--selected`]: isSelected,
|
|
704
790
|
[`${PREFIX_CLS}menu-item--disabled`]: disabled
|
|
705
791
|
},
|
|
706
792
|
className
|
|
@@ -711,9 +797,9 @@ var MenuItem = (0, import_react19.forwardRef)((props, ref) => {
|
|
|
711
797
|
onClick: handleClick
|
|
712
798
|
}, rest), {
|
|
713
799
|
children: [
|
|
714
|
-
/* @__PURE__ */ (0,
|
|
715
|
-
icon && /* @__PURE__ */ (0,
|
|
716
|
-
/* @__PURE__ */ (0,
|
|
800
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: `${PREFIX_CLS}overlay`, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: `${PREFIX_CLS}overlay__surface` }) }),
|
|
801
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: `${PREFIX_CLS}menu-item__icon`, children: icon }),
|
|
802
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: `${PREFIX_CLS}menu-item__content`, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: `${PREFIX_CLS}menu-item__title`, children: title }) })
|
|
717
803
|
]
|
|
718
804
|
})
|
|
719
805
|
);
|
|
@@ -723,7 +809,7 @@ var MenuItem_default = MenuItem;
|
|
|
723
809
|
|
|
724
810
|
// src/components/Menu/MenuSubmenu.tsx
|
|
725
811
|
var import_clsx11 = __toESM(require("clsx"));
|
|
726
|
-
var
|
|
812
|
+
var import_react21 = require("react");
|
|
727
813
|
|
|
728
814
|
// src/components/Menu/utils.ts
|
|
729
815
|
var getOpenValuesByPathname = (pathname) => {
|
|
@@ -749,7 +835,7 @@ var addOrRemoveValueInArray = (array, value) => {
|
|
|
749
835
|
};
|
|
750
836
|
|
|
751
837
|
// src/components/Menu/MenuSubmenu.tsx
|
|
752
|
-
var
|
|
838
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
753
839
|
var MenuSubmenu = (_a) => {
|
|
754
840
|
var _b = _a, {
|
|
755
841
|
children,
|
|
@@ -773,13 +859,14 @@ var MenuSubmenu = (_a) => {
|
|
|
773
859
|
"onClick"
|
|
774
860
|
]);
|
|
775
861
|
const { value: menuValue, openValues, expandMode, onOpen } = useMenu();
|
|
776
|
-
const values = (0,
|
|
862
|
+
const values = (0, import_react21.useContext)(MenuValueContext_default);
|
|
777
863
|
const isOpen = openValues.includes(value);
|
|
778
864
|
const mergedValues = [...values, value];
|
|
779
|
-
const
|
|
865
|
+
const isSelected = menuValue[level - 1] === value;
|
|
866
|
+
const content = (0, import_react21.useMemo)(() => {
|
|
780
867
|
return items == null ? void 0 : items.map((_a2, index) => {
|
|
781
868
|
var _b2 = _a2, { type } = _b2, item = __objRest(_b2, ["type"]);
|
|
782
|
-
return type === "item" ? /* @__PURE__ */ (0,
|
|
869
|
+
return type === "item" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MenuItem_default, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index) : type === "submenu" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MenuSubmenu, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index) : type === "group" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MenuGroup_default, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MenuItem_default, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index);
|
|
783
870
|
});
|
|
784
871
|
}, [items]);
|
|
785
872
|
const handleClick = (event) => {
|
|
@@ -797,14 +884,14 @@ var MenuSubmenu = (_a) => {
|
|
|
797
884
|
}
|
|
798
885
|
onClick == null ? void 0 : onClick(event);
|
|
799
886
|
};
|
|
800
|
-
return /* @__PURE__ */ (0,
|
|
801
|
-
/* @__PURE__ */ (0,
|
|
887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MenuValueContext_default.Provider, { value: mergedValues, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: (0, import_clsx11.default)(`${PREFIX_CLS}menu-submenu`), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Collapse_default, { isOpen, children: [
|
|
888
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CollapseTrigger_default, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
802
889
|
"div",
|
|
803
890
|
__spreadProps(__spreadValues({
|
|
804
891
|
className: (0, import_clsx11.default)(
|
|
805
892
|
`${PREFIX_CLS}menu-item`,
|
|
806
893
|
{
|
|
807
|
-
[`${PREFIX_CLS}menu-item--selected`]:
|
|
894
|
+
[`${PREFIX_CLS}menu-item--selected`]: isSelected || items && mergedValues.includes(menuValue)
|
|
808
895
|
},
|
|
809
896
|
className
|
|
810
897
|
),
|
|
@@ -814,14 +901,14 @@ var MenuSubmenu = (_a) => {
|
|
|
814
901
|
onClick: handleClick
|
|
815
902
|
}, rest), {
|
|
816
903
|
children: [
|
|
817
|
-
/* @__PURE__ */ (0,
|
|
818
|
-
icon && /* @__PURE__ */ (0,
|
|
819
|
-
/* @__PURE__ */ (0,
|
|
820
|
-
/* @__PURE__ */ (0,
|
|
904
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: `${PREFIX_CLS}overlay`, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: `${PREFIX_CLS}overlay__surface` }) }),
|
|
905
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: `${PREFIX_CLS}menu-item__icon`, children: icon }),
|
|
906
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: `${PREFIX_CLS}menu-item__content`, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: `${PREFIX_CLS}menu-item__title`, children: title }) }),
|
|
907
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: `${PREFIX_CLS}menu-item__icon`, children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ChevronUpIcon_default, { className: `${PREFIX_CLS}icon` }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ChevronDownIcon_default, { className: `${PREFIX_CLS}icon` }) })
|
|
821
908
|
]
|
|
822
909
|
})
|
|
823
910
|
) }),
|
|
824
|
-
/* @__PURE__ */ (0,
|
|
911
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CollapseContent_default, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
825
912
|
"ul",
|
|
826
913
|
{
|
|
827
914
|
className: (0, import_clsx11.default)(`${PREFIX_CLS}menu`, {
|
|
@@ -835,7 +922,7 @@ var MenuSubmenu = (_a) => {
|
|
|
835
922
|
var MenuSubmenu_default = MenuSubmenu;
|
|
836
923
|
|
|
837
924
|
// src/components/Menu/MenuGroup.tsx
|
|
838
|
-
var
|
|
925
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
839
926
|
var MenuGroup = (_a) => {
|
|
840
927
|
var _b = _a, {
|
|
841
928
|
children,
|
|
@@ -854,14 +941,14 @@ var MenuGroup = (_a) => {
|
|
|
854
941
|
"level",
|
|
855
942
|
"items"
|
|
856
943
|
]);
|
|
857
|
-
const content = (0,
|
|
944
|
+
const content = (0, import_react22.useMemo)(() => {
|
|
858
945
|
return items == null ? void 0 : items.map((_a2, index) => {
|
|
859
946
|
var _b2 = _a2, { type } = _b2, item = __objRest(_b2, ["type"]);
|
|
860
|
-
return type === "item" ? /* @__PURE__ */ (0,
|
|
947
|
+
return type === "item" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(MenuItem_default, __spreadValues({}, item), index) : type === "submenu" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(MenuSubmenu_default, __spreadValues({}, item), index) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(MenuItem_default, __spreadValues({}, item), index);
|
|
861
948
|
});
|
|
862
949
|
}, [items]);
|
|
863
|
-
return /* @__PURE__ */ (0,
|
|
864
|
-
/* @__PURE__ */ (0,
|
|
950
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
951
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
865
952
|
"div",
|
|
866
953
|
__spreadProps(__spreadValues({
|
|
867
954
|
className: (0, import_clsx12.default)(`${PREFIX_CLS}menu-group`, className),
|
|
@@ -870,8 +957,8 @@ var MenuGroup = (_a) => {
|
|
|
870
957
|
}, style)
|
|
871
958
|
}, rest), {
|
|
872
959
|
children: [
|
|
873
|
-
icon && /* @__PURE__ */ (0,
|
|
874
|
-
/* @__PURE__ */ (0,
|
|
960
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: `${PREFIX_CLS}menu-group__icon`, children: icon }),
|
|
961
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: `${PREFIX_CLS}menu-group__content`, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: `${PREFIX_CLS}menu-group__title`, children: title }) })
|
|
875
962
|
]
|
|
876
963
|
})
|
|
877
964
|
),
|
|
@@ -881,7 +968,7 @@ var MenuGroup = (_a) => {
|
|
|
881
968
|
var MenuGroup_default = MenuGroup;
|
|
882
969
|
|
|
883
970
|
// src/components/Menu/Menu.tsx
|
|
884
|
-
var
|
|
971
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
885
972
|
var Menu = (_a) => {
|
|
886
973
|
var _b = _a, {
|
|
887
974
|
children,
|
|
@@ -907,12 +994,12 @@ var Menu = (_a) => {
|
|
|
907
994
|
"onItemSelect"
|
|
908
995
|
]);
|
|
909
996
|
var _a2;
|
|
910
|
-
const [selfValue, setSelfValue] = (0,
|
|
911
|
-
const [selfOpenValues, setSelfOpenValues] = (0,
|
|
912
|
-
const content = (0,
|
|
997
|
+
const [selfValue, setSelfValue] = (0, import_react23.useState)((_a2 = valueProp != null ? valueProp : defaultValue) != null ? _a2 : []);
|
|
998
|
+
const [selfOpenValues, setSelfOpenValues] = (0, import_react23.useState)(openValuesProp != null ? openValuesProp : []);
|
|
999
|
+
const content = (0, import_react23.useMemo)(() => {
|
|
913
1000
|
return items == null ? void 0 : items.map((_a3, index) => {
|
|
914
1001
|
var _b2 = _a3, { type } = _b2, item = __objRest(_b2, ["type"]);
|
|
915
|
-
return type === "item" ? /* @__PURE__ */ (0,
|
|
1002
|
+
return type === "item" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MenuItem_default, __spreadValues({}, item), index) : type === "submenu" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MenuSubmenu_default, __spreadValues({}, item), index) : type === "group" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MenuGroup_default, __spreadValues({}, item), index) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MenuItem_default, __spreadValues({}, item), index);
|
|
916
1003
|
});
|
|
917
1004
|
}, [items]);
|
|
918
1005
|
const handleChange = (value) => {
|
|
@@ -932,17 +1019,17 @@ var Menu = (_a) => {
|
|
|
932
1019
|
const handleItemSelect = (props) => {
|
|
933
1020
|
onItemSelect == null ? void 0 : onItemSelect(props);
|
|
934
1021
|
};
|
|
935
|
-
(0,
|
|
1022
|
+
(0, import_react23.useEffect)(() => {
|
|
936
1023
|
if (valueProp !== void 0 && navMode !== "automatic") {
|
|
937
1024
|
setSelfValue(valueProp);
|
|
938
1025
|
}
|
|
939
1026
|
}, [valueProp]);
|
|
940
|
-
(0,
|
|
1027
|
+
(0, import_react23.useEffect)(() => {
|
|
941
1028
|
if (openValuesProp !== void 0) {
|
|
942
1029
|
setSelfOpenValues(openValuesProp);
|
|
943
1030
|
}
|
|
944
1031
|
}, [openValuesProp]);
|
|
945
|
-
return /* @__PURE__ */ (0,
|
|
1032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
946
1033
|
MenuContext_default.Provider,
|
|
947
1034
|
{
|
|
948
1035
|
value: {
|
|
@@ -955,7 +1042,7 @@ var Menu = (_a) => {
|
|
|
955
1042
|
onChange: handleChange,
|
|
956
1043
|
onItemSelect: handleItemSelect
|
|
957
1044
|
},
|
|
958
|
-
children: /* @__PURE__ */ (0,
|
|
1045
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", __spreadProps(__spreadValues({ className: (0, import_clsx13.default)(`${PREFIX_CLS}menu`) }, rest), { children: content || children }))
|
|
959
1046
|
}
|
|
960
1047
|
);
|
|
961
1048
|
};
|
|
@@ -963,32 +1050,32 @@ Menu.displayName = "Menu";
|
|
|
963
1050
|
var Menu_default = Menu;
|
|
964
1051
|
|
|
965
1052
|
// src/components/Accordion/Accordion.tsx
|
|
966
|
-
var
|
|
967
|
-
var
|
|
968
|
-
var Accordion = (0,
|
|
1053
|
+
var import_react24 = require("react");
|
|
1054
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1055
|
+
var Accordion = (0, import_react24.forwardRef)((props, ref) => {
|
|
969
1056
|
const _a = props, { children, className } = _a, rest = __objRest(_a, ["children", "className"]);
|
|
970
1057
|
const prefixCls = PREFIX_CLS;
|
|
971
|
-
return /* @__PURE__ */ (0,
|
|
1058
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", __spreadProps(__spreadValues({ ref, className: clsx_default(`${prefixCls}accordion`, className) }, rest), { children }));
|
|
972
1059
|
});
|
|
973
1060
|
var Accordion_default = Accordion;
|
|
974
1061
|
|
|
975
1062
|
// src/components/Accordion/AccordionItem.tsx
|
|
976
|
-
var
|
|
1063
|
+
var import_react35 = require("react");
|
|
977
1064
|
|
|
978
1065
|
// src/hooks/useLocalStorage.tsx
|
|
979
|
-
var
|
|
1066
|
+
var import_react27 = require("react");
|
|
980
1067
|
|
|
981
1068
|
// src/hooks/useEventListener.tsx
|
|
982
|
-
var
|
|
1069
|
+
var import_react26 = require("react");
|
|
983
1070
|
|
|
984
1071
|
// src/hooks/useIsomorphicLayoutEffect.tsx
|
|
985
|
-
var
|
|
986
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ?
|
|
1072
|
+
var import_react25 = require("react");
|
|
1073
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? import_react25.useLayoutEffect : import_react25.useEffect;
|
|
987
1074
|
var useIsomorphicLayoutEffect_default = useIsomorphicLayoutEffect;
|
|
988
1075
|
|
|
989
1076
|
// src/hooks/useEventListener.tsx
|
|
990
1077
|
function useEventListener(handler) {
|
|
991
|
-
const savedHandler = (0,
|
|
1078
|
+
const savedHandler = (0, import_react26.useRef)(handler);
|
|
992
1079
|
useIsomorphicLayoutEffect_default(() => {
|
|
993
1080
|
savedHandler.current = handler;
|
|
994
1081
|
}, [handler]);
|
|
@@ -997,7 +1084,7 @@ var useEventListener_default = useEventListener;
|
|
|
997
1084
|
|
|
998
1085
|
// src/hooks/useLocalStorage.tsx
|
|
999
1086
|
function useLocalStorage(key, initialValue) {
|
|
1000
|
-
const readValue = (0,
|
|
1087
|
+
const readValue = (0, import_react27.useCallback)(() => {
|
|
1001
1088
|
if (typeof window === "undefined") {
|
|
1002
1089
|
return initialValue;
|
|
1003
1090
|
}
|
|
@@ -1009,8 +1096,8 @@ function useLocalStorage(key, initialValue) {
|
|
|
1009
1096
|
return initialValue;
|
|
1010
1097
|
}
|
|
1011
1098
|
}, [initialValue, key]);
|
|
1012
|
-
const [storedValue, setStoredValue] = (0,
|
|
1013
|
-
const setValue = (0,
|
|
1099
|
+
const [storedValue, setStoredValue] = (0, import_react27.useState)(readValue);
|
|
1100
|
+
const setValue = (0, import_react27.useCallback)(
|
|
1014
1101
|
(value) => {
|
|
1015
1102
|
if (typeof window == "undefined") {
|
|
1016
1103
|
console.warn(`Tried setting localStorage key \u201C${key}\u201D even though environment is not a client`);
|
|
@@ -1026,10 +1113,10 @@ function useLocalStorage(key, initialValue) {
|
|
|
1026
1113
|
},
|
|
1027
1114
|
[key, storedValue]
|
|
1028
1115
|
);
|
|
1029
|
-
(0,
|
|
1116
|
+
(0, import_react27.useEffect)(() => {
|
|
1030
1117
|
setStoredValue(readValue());
|
|
1031
1118
|
}, []);
|
|
1032
|
-
const handleStorageChange = (0,
|
|
1119
|
+
const handleStorageChange = (0, import_react27.useCallback)(() => {
|
|
1033
1120
|
setStoredValue(readValue());
|
|
1034
1121
|
}, [readValue]);
|
|
1035
1122
|
useEventListener_default("storage", handleStorageChange);
|
|
@@ -1045,19 +1132,19 @@ function parseJSON(value) {
|
|
|
1045
1132
|
}
|
|
1046
1133
|
|
|
1047
1134
|
// src/hooks/usePrevious.tsx
|
|
1048
|
-
var
|
|
1135
|
+
var import_react28 = require("react");
|
|
1049
1136
|
var usePrevious = (value) => {
|
|
1050
|
-
const ref = (0,
|
|
1051
|
-
(0,
|
|
1137
|
+
const ref = (0, import_react28.useRef)();
|
|
1138
|
+
(0, import_react28.useEffect)(() => {
|
|
1052
1139
|
ref.current = value;
|
|
1053
1140
|
});
|
|
1054
1141
|
return ref.current;
|
|
1055
1142
|
};
|
|
1056
1143
|
|
|
1057
1144
|
// src/hooks/useDisclosure.ts
|
|
1058
|
-
var
|
|
1059
|
-
|
|
1060
|
-
const [isOpen, setIsOpen] = (0,
|
|
1145
|
+
var import_react29 = require("react");
|
|
1146
|
+
function useDisclosure({ defaultValue } = {}) {
|
|
1147
|
+
const [isOpen, setIsOpen] = (0, import_react29.useState)(defaultValue || false);
|
|
1061
1148
|
const onOpen = () => {
|
|
1062
1149
|
setIsOpen(true);
|
|
1063
1150
|
};
|
|
@@ -1073,16 +1160,34 @@ var useDisclosure = ({ defaultValue } = {}) => {
|
|
|
1073
1160
|
onClose,
|
|
1074
1161
|
onToggle
|
|
1075
1162
|
};
|
|
1076
|
-
}
|
|
1163
|
+
}
|
|
1077
1164
|
var useDisclosure_default = useDisclosure;
|
|
1078
1165
|
|
|
1166
|
+
// src/hooks/useOnClickOutside.tsx
|
|
1167
|
+
var import_react30 = require("react");
|
|
1168
|
+
var useOnClickOutside = (ref, handler) => {
|
|
1169
|
+
(0, import_react30.useEffect)(() => {
|
|
1170
|
+
const listener = (event) => {
|
|
1171
|
+
if (!ref.current || ref.current.contains(event.target)) {
|
|
1172
|
+
return;
|
|
1173
|
+
}
|
|
1174
|
+
handler(event);
|
|
1175
|
+
};
|
|
1176
|
+
document.addEventListener("click", listener);
|
|
1177
|
+
return () => {
|
|
1178
|
+
document.removeEventListener("click", listener);
|
|
1179
|
+
};
|
|
1180
|
+
}, [ref, handler]);
|
|
1181
|
+
};
|
|
1182
|
+
var useOnClickOutside_default = useOnClickOutside;
|
|
1183
|
+
|
|
1079
1184
|
// src/hooks/useStep.tsx
|
|
1080
|
-
var
|
|
1185
|
+
var import_react31 = require("react");
|
|
1081
1186
|
var useStep = (maxStep) => {
|
|
1082
|
-
const [currentStep, setCurrentStep] = (0,
|
|
1083
|
-
const canGoToNextStep = (0,
|
|
1084
|
-
const canGoToPrevStep = (0,
|
|
1085
|
-
const setStep = (0,
|
|
1187
|
+
const [currentStep, setCurrentStep] = (0, import_react31.useState)(1);
|
|
1188
|
+
const canGoToNextStep = (0, import_react31.useMemo)(() => currentStep + 1 <= maxStep, [currentStep, maxStep]);
|
|
1189
|
+
const canGoToPrevStep = (0, import_react31.useMemo)(() => currentStep - 1 >= 1, [currentStep]);
|
|
1190
|
+
const setStep = (0, import_react31.useCallback)(
|
|
1086
1191
|
(step) => {
|
|
1087
1192
|
const newStep = step instanceof Function ? step(currentStep) : step;
|
|
1088
1193
|
if (newStep >= 1 && newStep <= maxStep) {
|
|
@@ -1093,17 +1198,17 @@ var useStep = (maxStep) => {
|
|
|
1093
1198
|
},
|
|
1094
1199
|
[maxStep, currentStep]
|
|
1095
1200
|
);
|
|
1096
|
-
const goToNextStep = (0,
|
|
1201
|
+
const goToNextStep = (0, import_react31.useCallback)(() => {
|
|
1097
1202
|
if (canGoToNextStep) {
|
|
1098
1203
|
setCurrentStep((step) => step + 1);
|
|
1099
1204
|
}
|
|
1100
1205
|
}, [canGoToNextStep]);
|
|
1101
|
-
const goToPrevStep = (0,
|
|
1206
|
+
const goToPrevStep = (0, import_react31.useCallback)(() => {
|
|
1102
1207
|
if (canGoToPrevStep) {
|
|
1103
1208
|
setCurrentStep((step) => step - 1);
|
|
1104
1209
|
}
|
|
1105
1210
|
}, [canGoToPrevStep]);
|
|
1106
|
-
const reset = (0,
|
|
1211
|
+
const reset = (0, import_react31.useCallback)(() => {
|
|
1107
1212
|
setCurrentStep(1);
|
|
1108
1213
|
}, []);
|
|
1109
1214
|
return [
|
|
@@ -1119,77 +1224,198 @@ var useStep = (maxStep) => {
|
|
|
1119
1224
|
];
|
|
1120
1225
|
};
|
|
1121
1226
|
|
|
1227
|
+
// src/hooks/useDebounce.ts
|
|
1228
|
+
var import_react32 = require("react");
|
|
1229
|
+
function useDebounce(value, delay) {
|
|
1230
|
+
const [debouncedValue, setDebouncedValue] = (0, import_react32.useState)(value);
|
|
1231
|
+
(0, import_react32.useEffect)(() => {
|
|
1232
|
+
const timer = setTimeout(() => setDebouncedValue(value), delay || 500);
|
|
1233
|
+
return () => {
|
|
1234
|
+
clearTimeout(timer);
|
|
1235
|
+
};
|
|
1236
|
+
}, [value, delay]);
|
|
1237
|
+
return debouncedValue;
|
|
1238
|
+
}
|
|
1239
|
+
var useDebounce_default = useDebounce;
|
|
1240
|
+
|
|
1241
|
+
// src/hooks/useInfiniteQuery/useInfiniteQuery.ts
|
|
1242
|
+
var import_react33 = require("react");
|
|
1243
|
+
|
|
1244
|
+
// src/hooks/useInfiniteQuery/types.ts
|
|
1245
|
+
var QueryStatus = /* @__PURE__ */ ((QueryStatus2) => {
|
|
1246
|
+
QueryStatus2[QueryStatus2["IDLE"] = 0] = "IDLE";
|
|
1247
|
+
QueryStatus2[QueryStatus2["LOADING"] = 1] = "LOADING";
|
|
1248
|
+
QueryStatus2[QueryStatus2["SUCCESS"] = 2] = "SUCCESS";
|
|
1249
|
+
QueryStatus2[QueryStatus2["ERROR"] = 3] = "ERROR";
|
|
1250
|
+
return QueryStatus2;
|
|
1251
|
+
})(QueryStatus || {});
|
|
1252
|
+
|
|
1253
|
+
// src/hooks/useInfiniteQuery/useInfiniteQuery.ts
|
|
1254
|
+
function useInfiniteQuery(options, deps = []) {
|
|
1255
|
+
const [status, setStatus] = (0, import_react33.useState)(0 /* IDLE */);
|
|
1256
|
+
const [data, setData] = (0, import_react33.useState)({ pages: [] });
|
|
1257
|
+
const [error, setError] = (0, import_react33.useState)();
|
|
1258
|
+
const [hasNextPage, setHasNextPage] = (0, import_react33.useState)(true);
|
|
1259
|
+
const [isFetchingNextPage, setIsFetchingNextPage] = (0, import_react33.useState)(false);
|
|
1260
|
+
const fetchNextPage = () => __async(this, null, function* () {
|
|
1261
|
+
try {
|
|
1262
|
+
setStatus(1 /* LOADING */);
|
|
1263
|
+
setError(void 0);
|
|
1264
|
+
setIsFetchingNextPage(true);
|
|
1265
|
+
const lastIndex = data.pages.length - 1;
|
|
1266
|
+
const page = options.getNextPage(data.pages[lastIndex], data.pages);
|
|
1267
|
+
const newPage = yield options.query({ page });
|
|
1268
|
+
const newData = { pages: [...data.pages, newPage] };
|
|
1269
|
+
setData(newData);
|
|
1270
|
+
const newLastIndex = newData.pages.length - 1;
|
|
1271
|
+
const nextPage = options.getNextPage(newData.pages[newLastIndex], newData.pages);
|
|
1272
|
+
setHasNextPage(nextPage !== void 0);
|
|
1273
|
+
setIsFetchingNextPage(false);
|
|
1274
|
+
setStatus(2 /* SUCCESS */);
|
|
1275
|
+
} catch (error2) {
|
|
1276
|
+
setError(error2);
|
|
1277
|
+
setStatus(3 /* ERROR */);
|
|
1278
|
+
}
|
|
1279
|
+
});
|
|
1280
|
+
(0, import_react33.useEffect)(() => {
|
|
1281
|
+
const fetchData = () => __async(this, null, function* () {
|
|
1282
|
+
try {
|
|
1283
|
+
setStatus(1 /* LOADING */);
|
|
1284
|
+
setError(void 0);
|
|
1285
|
+
setIsFetchingNextPage(true);
|
|
1286
|
+
const page = void 0;
|
|
1287
|
+
const newPage = yield options.query({ page });
|
|
1288
|
+
setData({ pages: [newPage] });
|
|
1289
|
+
const nextPage = options.getNextPage(newPage, [newPage]);
|
|
1290
|
+
setHasNextPage(nextPage !== void 0);
|
|
1291
|
+
setIsFetchingNextPage(false);
|
|
1292
|
+
setStatus(2 /* SUCCESS */);
|
|
1293
|
+
} catch (error2) {
|
|
1294
|
+
setError(error2);
|
|
1295
|
+
setStatus(3 /* ERROR */);
|
|
1296
|
+
}
|
|
1297
|
+
});
|
|
1298
|
+
fetchData();
|
|
1299
|
+
}, deps);
|
|
1300
|
+
return { status, data, error, hasNextPage, isFetchingNextPage, fetchNextPage };
|
|
1301
|
+
}
|
|
1302
|
+
var useInfiniteQuery_default = useInfiniteQuery;
|
|
1303
|
+
|
|
1304
|
+
// src/hooks/useElementSize/useElementSize.ts
|
|
1305
|
+
var import_react34 = require("react");
|
|
1306
|
+
var defaultState = {
|
|
1307
|
+
width: 0,
|
|
1308
|
+
height: 0
|
|
1309
|
+
};
|
|
1310
|
+
function useElementSize(options) {
|
|
1311
|
+
var _a;
|
|
1312
|
+
const frameID = (0, import_react34.useRef)(0);
|
|
1313
|
+
const [resize, setResize] = (0, import_react34.useState)(defaultState);
|
|
1314
|
+
const observer = (0, import_react34.useMemo)(
|
|
1315
|
+
() => typeof window !== "undefined" ? new ResizeObserver((entries) => {
|
|
1316
|
+
const entry = entries[0];
|
|
1317
|
+
if (entry) {
|
|
1318
|
+
cancelAnimationFrame(frameID.current);
|
|
1319
|
+
frameID.current = requestAnimationFrame(() => {
|
|
1320
|
+
var _a2, _b, _c;
|
|
1321
|
+
const target = (_b = (_a2 = options.ref) == null ? void 0 : _a2.current) != null ? _b : options.target;
|
|
1322
|
+
if (target) {
|
|
1323
|
+
(_c = options.callback) == null ? void 0 : _c.call(options, resize);
|
|
1324
|
+
setResize({ width: entry.contentRect.width, height: entry.contentRect.height });
|
|
1325
|
+
}
|
|
1326
|
+
});
|
|
1327
|
+
}
|
|
1328
|
+
}) : null,
|
|
1329
|
+
[]
|
|
1330
|
+
);
|
|
1331
|
+
(0, import_react34.useEffect)(() => {
|
|
1332
|
+
var _a2, _b;
|
|
1333
|
+
const target = (_b = (_a2 = options.ref) == null ? void 0 : _a2.current) != null ? _b : options.target;
|
|
1334
|
+
if (target) {
|
|
1335
|
+
observer == null ? void 0 : observer.observe(target);
|
|
1336
|
+
}
|
|
1337
|
+
return () => {
|
|
1338
|
+
observer == null ? void 0 : observer.disconnect();
|
|
1339
|
+
if (frameID.current) {
|
|
1340
|
+
cancelAnimationFrame(frameID.current);
|
|
1341
|
+
}
|
|
1342
|
+
};
|
|
1343
|
+
}, [(_a = options.ref) == null ? void 0 : _a.current, options.target]);
|
|
1344
|
+
return resize;
|
|
1345
|
+
}
|
|
1346
|
+
var useElementSize_default = useElementSize;
|
|
1347
|
+
|
|
1122
1348
|
// src/components/Accordion/AccordionItem.tsx
|
|
1123
|
-
var
|
|
1124
|
-
var AccordionItemContext = (0,
|
|
1349
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1350
|
+
var AccordionItemContext = (0, import_react35.createContext)(null);
|
|
1125
1351
|
var useAccordionItem = () => {
|
|
1126
|
-
const context = (0,
|
|
1352
|
+
const context = (0, import_react35.useContext)(AccordionItemContext);
|
|
1127
1353
|
if (!context) {
|
|
1128
1354
|
throw new Error("`useAccordionItem` must be used within a `<AccordionItem />`");
|
|
1129
1355
|
}
|
|
1130
1356
|
return context;
|
|
1131
1357
|
};
|
|
1132
|
-
var AccordionItem = (0,
|
|
1358
|
+
var AccordionItem = (0, import_react35.forwardRef)((props, ref) => {
|
|
1133
1359
|
const _a = props, { children, className, value: valueProp } = _a, rest = __objRest(_a, ["children", "className", "value"]);
|
|
1134
1360
|
const prefixCls = PREFIX_CLS;
|
|
1135
1361
|
const { isOpen, onOpen, onClose, onToggle } = useDisclosure_default({ defaultValue: true });
|
|
1136
|
-
const id = (0,
|
|
1362
|
+
const id = (0, import_react35.useId)();
|
|
1137
1363
|
const value = valueProp != null ? valueProp : id;
|
|
1138
|
-
return /* @__PURE__ */ (0,
|
|
1364
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AccordionItemContext.Provider, { value: { value }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", __spreadProps(__spreadValues({ ref, className: clsx_default(`${prefixCls}accordion-item`, className) }, rest), { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Collapse_default, { isOpen, onOpen, onClose, onToggle, children }) })) });
|
|
1139
1365
|
});
|
|
1140
1366
|
var AccordionItem_default = AccordionItem;
|
|
1141
1367
|
|
|
1142
1368
|
// src/components/Accordion/AccordionHeader.tsx
|
|
1143
|
-
var
|
|
1144
|
-
var
|
|
1145
|
-
var AccordionHeader = (0,
|
|
1369
|
+
var import_react36 = require("react");
|
|
1370
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1371
|
+
var AccordionHeader = (0, import_react36.forwardRef)((props, ref) => {
|
|
1146
1372
|
const _a = props, { className, title, subtitle, startContent, endContent } = _a, rest = __objRest(_a, ["className", "title", "subtitle", "startContent", "endContent"]);
|
|
1147
1373
|
const prefixCls = PREFIX_CLS;
|
|
1148
1374
|
const { isOpen } = useCollapse();
|
|
1149
|
-
return /* @__PURE__ */ (0,
|
|
1150
|
-
startContent && /* @__PURE__ */ (0,
|
|
1151
|
-
/* @__PURE__ */ (0,
|
|
1152
|
-
/* @__PURE__ */ (0,
|
|
1153
|
-
subtitle && /* @__PURE__ */ (0,
|
|
1375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CollapseTrigger_default, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", __spreadProps(__spreadValues({ ref, className: clsx_default(`${prefixCls}accordion-header`, className) }, rest), { children: [
|
|
1376
|
+
startContent && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: `${prefixCls}accordion-header__start-content`, children: startContent }),
|
|
1377
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `${prefixCls}accordion-header__content`, children: [
|
|
1378
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: `${prefixCls}accordion-header__title`, children: title }),
|
|
1379
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: `${prefixCls}accordion-header__subtitle`, children: subtitle })
|
|
1154
1380
|
] }),
|
|
1155
|
-
/* @__PURE__ */ (0,
|
|
1381
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: `${prefixCls}accordion-header__end-content`, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "us-d-flex us-items-center us-gap-1", children: [
|
|
1156
1382
|
endContent,
|
|
1157
|
-
/* @__PURE__ */ (0,
|
|
1383
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Button, { type: "button", variant: "text", color: "secondary", size: "sm", iconOnly: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon_default, { children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ChevronUpIcon_default, {}) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ChevronDownIcon_default, {}) }) })
|
|
1158
1384
|
] }) })
|
|
1159
1385
|
] })) });
|
|
1160
1386
|
});
|
|
1161
1387
|
var AccordionHeader_default = AccordionHeader;
|
|
1162
1388
|
|
|
1163
1389
|
// src/components/Accordion/AccordionPanel.tsx
|
|
1164
|
-
var
|
|
1165
|
-
var
|
|
1166
|
-
var AccordionPanel = (0,
|
|
1390
|
+
var import_react37 = require("react");
|
|
1391
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1392
|
+
var AccordionPanel = (0, import_react37.forwardRef)((_a, ref) => {
|
|
1167
1393
|
var _b = _a, { children, className } = _b, rest = __objRest(_b, ["children", "className"]);
|
|
1168
1394
|
const prefixCls = PREFIX_CLS;
|
|
1169
|
-
return /* @__PURE__ */ (0,
|
|
1395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CollapseContent_default, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { ref, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", __spreadProps(__spreadValues({ className: clsx_default(`${prefixCls}accordion-panel`, className) }, rest), { children })) }) });
|
|
1170
1396
|
});
|
|
1171
1397
|
var AccordionPanel_default = AccordionPanel;
|
|
1172
1398
|
|
|
1173
1399
|
// src/components/Accordion/AccordionContent.tsx
|
|
1174
|
-
var
|
|
1175
|
-
var
|
|
1176
|
-
var AccordionContent = (0,
|
|
1400
|
+
var import_react38 = require("react");
|
|
1401
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1402
|
+
var AccordionContent = (0, import_react38.forwardRef)((_a, ref) => {
|
|
1177
1403
|
var _b = _a, { children, className } = _b, rest = __objRest(_b, ["children", "className"]);
|
|
1178
1404
|
const prefixCls = PREFIX_CLS;
|
|
1179
|
-
return /* @__PURE__ */ (0,
|
|
1405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CollapseContent_default, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { ref, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", __spreadProps(__spreadValues({ className: clsx_default(`${prefixCls}accordion-content`, className) }, rest), { children })) }) });
|
|
1180
1406
|
});
|
|
1181
1407
|
var AccordionContent_default = AccordionContent;
|
|
1182
1408
|
|
|
1183
1409
|
// src/components/Tabs/Tab.tsx
|
|
1184
1410
|
var import_clsx15 = __toESM(require("clsx"));
|
|
1185
1411
|
var import_merge_refs = __toESM(require("merge-refs"));
|
|
1186
|
-
var
|
|
1412
|
+
var import_react42 = require("react");
|
|
1187
1413
|
|
|
1188
1414
|
// ../../../node_modules/react-icons/lib/esm/iconBase.js
|
|
1189
|
-
var
|
|
1415
|
+
var import_react40 = __toESM(require("react"));
|
|
1190
1416
|
|
|
1191
1417
|
// ../../../node_modules/react-icons/lib/esm/iconContext.js
|
|
1192
|
-
var
|
|
1418
|
+
var import_react39 = __toESM(require("react"));
|
|
1193
1419
|
var DefaultContext = {
|
|
1194
1420
|
color: void 0,
|
|
1195
1421
|
size: void 0,
|
|
@@ -1197,7 +1423,7 @@ var DefaultContext = {
|
|
|
1197
1423
|
style: void 0,
|
|
1198
1424
|
attr: void 0
|
|
1199
1425
|
};
|
|
1200
|
-
var IconContext =
|
|
1426
|
+
var IconContext = import_react39.default.createContext && import_react39.default.createContext(DefaultContext);
|
|
1201
1427
|
|
|
1202
1428
|
// ../../../node_modules/react-icons/lib/esm/iconBase.js
|
|
1203
1429
|
var __assign = function() {
|
|
@@ -1226,14 +1452,14 @@ var __rest = function(s, e) {
|
|
|
1226
1452
|
};
|
|
1227
1453
|
function Tree2Element(tree) {
|
|
1228
1454
|
return tree && tree.map(function(node, i) {
|
|
1229
|
-
return
|
|
1455
|
+
return import_react40.default.createElement(node.tag, __assign({
|
|
1230
1456
|
key: i
|
|
1231
1457
|
}, node.attr), Tree2Element(node.child));
|
|
1232
1458
|
});
|
|
1233
1459
|
}
|
|
1234
1460
|
function GenIcon(data) {
|
|
1235
1461
|
return function(props) {
|
|
1236
|
-
return
|
|
1462
|
+
return import_react40.default.createElement(IconBase, __assign({
|
|
1237
1463
|
attr: __assign({}, data.attr)
|
|
1238
1464
|
}, props), Tree2Element(data.child));
|
|
1239
1465
|
};
|
|
@@ -1247,7 +1473,7 @@ function IconBase(props) {
|
|
|
1247
1473
|
className = conf.className;
|
|
1248
1474
|
if (props.className)
|
|
1249
1475
|
className = (className ? className + " " : "") + props.className;
|
|
1250
|
-
return
|
|
1476
|
+
return import_react40.default.createElement("svg", __assign({
|
|
1251
1477
|
stroke: "currentColor",
|
|
1252
1478
|
fill: "currentColor",
|
|
1253
1479
|
strokeWidth: "0"
|
|
@@ -1259,9 +1485,9 @@ function IconBase(props) {
|
|
|
1259
1485
|
height: computedSize,
|
|
1260
1486
|
width: computedSize,
|
|
1261
1487
|
xmlns: "http://www.w3.org/2000/svg"
|
|
1262
|
-
}), title &&
|
|
1488
|
+
}), title && import_react40.default.createElement("title", null, title), props.children);
|
|
1263
1489
|
};
|
|
1264
|
-
return IconContext !== void 0 ?
|
|
1490
|
+
return IconContext !== void 0 ? import_react40.default.createElement(IconContext.Consumer, null, function(conf) {
|
|
1265
1491
|
return elem(conf);
|
|
1266
1492
|
}) : elem(DefaultContext);
|
|
1267
1493
|
}
|
|
@@ -1272,10 +1498,10 @@ function TbX(props) {
|
|
|
1272
1498
|
}
|
|
1273
1499
|
|
|
1274
1500
|
// src/components/Tabs/TabsContext.ts
|
|
1275
|
-
var
|
|
1276
|
-
var TabsContext = (0,
|
|
1501
|
+
var import_react41 = require("react");
|
|
1502
|
+
var TabsContext = (0, import_react41.createContext)(null);
|
|
1277
1503
|
var useTabs = () => {
|
|
1278
|
-
const context = (0,
|
|
1504
|
+
const context = (0, import_react41.useContext)(TabsContext);
|
|
1279
1505
|
if (!context) {
|
|
1280
1506
|
throw new Error("`useTabs` must be used within a `<Tabs />`");
|
|
1281
1507
|
}
|
|
@@ -1283,8 +1509,8 @@ var useTabs = () => {
|
|
|
1283
1509
|
};
|
|
1284
1510
|
|
|
1285
1511
|
// src/components/Tabs/Tab.tsx
|
|
1286
|
-
var
|
|
1287
|
-
var Tab = (0,
|
|
1512
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1513
|
+
var Tab = (0, import_react42.forwardRef)(
|
|
1288
1514
|
(_a, ref) => {
|
|
1289
1515
|
var _b = _a, {
|
|
1290
1516
|
as: Component = "div",
|
|
@@ -1305,8 +1531,8 @@ var Tab = (0, import_react37.forwardRef)(
|
|
|
1305
1531
|
"disabled",
|
|
1306
1532
|
"onClick"
|
|
1307
1533
|
]);
|
|
1308
|
-
const tabRef = (0,
|
|
1309
|
-
const id = (0,
|
|
1534
|
+
const tabRef = (0, import_react42.useRef)(null);
|
|
1535
|
+
const id = (0, import_react42.useId)();
|
|
1310
1536
|
const value = valueProp != null ? valueProp : id;
|
|
1311
1537
|
const _a2 = useTabs(), { onClose, registerItem } = _a2, tabs = __objRest(_a2, ["onClose", "registerItem"]);
|
|
1312
1538
|
const handleClick = (event) => {
|
|
@@ -1347,13 +1573,13 @@ var Tab = (0, import_react37.forwardRef)(
|
|
|
1347
1573
|
event.stopPropagation();
|
|
1348
1574
|
onClose(value);
|
|
1349
1575
|
};
|
|
1350
|
-
(0,
|
|
1576
|
+
(0, import_react42.useEffect)(() => {
|
|
1351
1577
|
registerItem({ value, disabled });
|
|
1352
1578
|
if (value === tabs.value) {
|
|
1353
1579
|
tabs.previousTabRef.current = tabRef.current;
|
|
1354
1580
|
}
|
|
1355
1581
|
}, [value, tabs.value]);
|
|
1356
|
-
return /* @__PURE__ */ (0,
|
|
1582
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1357
1583
|
Component,
|
|
1358
1584
|
__spreadProps(__spreadValues({
|
|
1359
1585
|
ref: (0, import_merge_refs.default)(tabRef, ref, (el) => tabs.tabRefs.current[value] = el),
|
|
@@ -1366,12 +1592,12 @@ var Tab = (0, import_react37.forwardRef)(
|
|
|
1366
1592
|
onClick: handleClick
|
|
1367
1593
|
}, rest), {
|
|
1368
1594
|
children: [
|
|
1369
|
-
/* @__PURE__ */ (0,
|
|
1370
|
-
/* @__PURE__ */ (0,
|
|
1595
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `${PREFIX_CLS}overlay`, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `${PREFIX_CLS}overlay__surface` }) }),
|
|
1596
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: `${PREFIX_CLS}tab__content`, children: [
|
|
1371
1597
|
children,
|
|
1372
|
-
closable && /* @__PURE__ */ (0,
|
|
1598
|
+
closable && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Button, { variant: "text", color: "secondary", iconOnly: true, size: "xs", onClick: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Icon_default, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TbX, {}) }) })
|
|
1373
1599
|
] }),
|
|
1374
|
-
/* @__PURE__ */ (0,
|
|
1600
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `${PREFIX_CLS}tab__indicator` })
|
|
1375
1601
|
]
|
|
1376
1602
|
})
|
|
1377
1603
|
);
|
|
@@ -1380,8 +1606,8 @@ var Tab = (0, import_react37.forwardRef)(
|
|
|
1380
1606
|
|
|
1381
1607
|
// src/components/Tabs/Tabs.tsx
|
|
1382
1608
|
var import_clsx16 = __toESM(require("clsx"));
|
|
1383
|
-
var
|
|
1384
|
-
var
|
|
1609
|
+
var import_react43 = require("react");
|
|
1610
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1385
1611
|
var Tabs = (_a) => {
|
|
1386
1612
|
var _b = _a, {
|
|
1387
1613
|
children,
|
|
@@ -1400,11 +1626,11 @@ var Tabs = (_a) => {
|
|
|
1400
1626
|
"onChange",
|
|
1401
1627
|
"onClose"
|
|
1402
1628
|
]);
|
|
1403
|
-
const tabsRef = (0,
|
|
1404
|
-
const tabRefs = (0,
|
|
1405
|
-
const previousTabRef = (0,
|
|
1406
|
-
const [selfValue, setSelfValue] = (0,
|
|
1407
|
-
const [items, setItems] = (0,
|
|
1629
|
+
const tabsRef = (0, import_react43.useRef)(null);
|
|
1630
|
+
const tabRefs = (0, import_react43.useRef)({});
|
|
1631
|
+
const previousTabRef = (0, import_react43.useRef)(null);
|
|
1632
|
+
const [selfValue, setSelfValue] = (0, import_react43.useState)(value != null ? value : defaultValue);
|
|
1633
|
+
const [items, setItems] = (0, import_react43.useState)([]);
|
|
1408
1634
|
const registerItem = (item) => {
|
|
1409
1635
|
setItems((prevItems) => {
|
|
1410
1636
|
const index = prevItems.findIndex((item2) => item2.value);
|
|
@@ -1431,24 +1657,24 @@ var Tabs = (_a) => {
|
|
|
1431
1657
|
const handleClose = (value2) => {
|
|
1432
1658
|
onClose == null ? void 0 : onClose(value2);
|
|
1433
1659
|
};
|
|
1434
|
-
(0,
|
|
1660
|
+
(0, import_react43.useEffect)(() => {
|
|
1435
1661
|
if (value !== void 0) {
|
|
1436
1662
|
setSelfValue(value);
|
|
1437
1663
|
scrollToTab(value);
|
|
1438
1664
|
}
|
|
1439
1665
|
}, [value]);
|
|
1440
|
-
(0,
|
|
1666
|
+
(0, import_react43.useEffect)(() => {
|
|
1441
1667
|
if (value === void 0) {
|
|
1442
1668
|
const item = items.find((tab) => !tab.disabled);
|
|
1443
1669
|
setSelfValue(item == null ? void 0 : item.value);
|
|
1444
1670
|
}
|
|
1445
1671
|
}, [value, items]);
|
|
1446
|
-
return /* @__PURE__ */ (0,
|
|
1672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1447
1673
|
TabsContext.Provider,
|
|
1448
1674
|
{
|
|
1449
1675
|
value: { previousTabRef, tabRefs, value: selfValue, onChange: handleChange, onClose: handleClose, registerItem },
|
|
1450
1676
|
children: [
|
|
1451
|
-
/* @__PURE__ */ (0,
|
|
1677
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1452
1678
|
"div",
|
|
1453
1679
|
__spreadProps(__spreadValues({
|
|
1454
1680
|
ref: tabsRef,
|
|
@@ -1457,7 +1683,7 @@ var Tabs = (_a) => {
|
|
|
1457
1683
|
children
|
|
1458
1684
|
})
|
|
1459
1685
|
),
|
|
1460
|
-
/* @__PURE__ */ (0,
|
|
1686
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: `${PREFIX_CLS}divider` })
|
|
1461
1687
|
]
|
|
1462
1688
|
}
|
|
1463
1689
|
);
|
|
@@ -1465,51 +1691,154 @@ var Tabs = (_a) => {
|
|
|
1465
1691
|
|
|
1466
1692
|
// src/components/Toolbar/Toolbar.tsx
|
|
1467
1693
|
var import_clsx17 = __toESM(require("clsx"));
|
|
1468
|
-
var
|
|
1694
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1469
1695
|
var Toolbar = (props) => {
|
|
1470
1696
|
const _a = props, { children, className, size = "md", startAction, endAction, title, subtitle } = _a, rest = __objRest(_a, ["children", "className", "size", "startAction", "endAction", "title", "subtitle"]);
|
|
1471
|
-
return /* @__PURE__ */ (0,
|
|
1472
|
-
/* @__PURE__ */ (0,
|
|
1473
|
-
/* @__PURE__ */ (0,
|
|
1474
|
-
startAction && /* @__PURE__ */ (0,
|
|
1475
|
-
/* @__PURE__ */ (0,
|
|
1476
|
-
title && /* @__PURE__ */ (0,
|
|
1477
|
-
subtitle && /* @__PURE__ */ (0,
|
|
1697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", __spreadProps(__spreadValues({ className: (0, import_clsx17.default)(`${PREFIX_CLS}toolbar`, { [`${PREFIX_CLS}toolbar--${size}`]: size }, className) }, rest), { children: [
|
|
1698
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: `${PREFIX_CLS}outline-b` }),
|
|
1699
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: (0, import_clsx17.default)(`${PREFIX_CLS}toolbar__container`), children: [
|
|
1700
|
+
startAction && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: (0, import_clsx17.default)(`${PREFIX_CLS}toolbar__start-action`), children: startAction }),
|
|
1701
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: (0, import_clsx17.default)(`${PREFIX_CLS}toolbar__content`), children: title || subtitle ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
1702
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: (0, import_clsx17.default)(`${PREFIX_CLS}toolbar__title`), children: title }),
|
|
1703
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: (0, import_clsx17.default)(`${PREFIX_CLS}toolbar__subtitle`), children: subtitle })
|
|
1478
1704
|
] }) : children }),
|
|
1479
|
-
endAction && /* @__PURE__ */ (0,
|
|
1705
|
+
endAction && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: (0, import_clsx17.default)(`${PREFIX_CLS}toolbar__trailing`), children: endAction })
|
|
1480
1706
|
] })
|
|
1481
1707
|
] }));
|
|
1482
1708
|
};
|
|
1483
1709
|
var Toolbar_default = Toolbar;
|
|
1484
1710
|
|
|
1485
1711
|
// src/components/ScrollArea/ScrollArea.tsx
|
|
1486
|
-
var
|
|
1487
|
-
var
|
|
1488
|
-
|
|
1712
|
+
var import_react44 = require("react");
|
|
1713
|
+
var import_react_custom_scrollbars_2 = require("react-custom-scrollbars-2");
|
|
1714
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1715
|
+
var ScrollArea = (0, import_react44.forwardRef)(({ children, height, style }, ref) => {
|
|
1489
1716
|
const prefixCls = PREFIX_CLS;
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
}
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1717
|
+
const renderView = (props) => {
|
|
1718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", __spreadProps(__spreadValues({}, props), { className: clsx_default(`${prefixCls}scroll-area__view`, props.className) }));
|
|
1719
|
+
};
|
|
1720
|
+
const renderTrackHorizontal = (props) => {
|
|
1721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1722
|
+
"div",
|
|
1723
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1724
|
+
className: clsx_default(`${prefixCls}scroll-area__track ${prefixCls}scroll-area__track--horizontal`, props.className)
|
|
1725
|
+
})
|
|
1726
|
+
);
|
|
1727
|
+
};
|
|
1728
|
+
const renderTrackVertical = (props) => {
|
|
1729
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1730
|
+
"div",
|
|
1731
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1732
|
+
className: clsx_default(`${prefixCls}scroll-area__track ${prefixCls}scroll-area__track--vertical`, props.className)
|
|
1733
|
+
})
|
|
1734
|
+
);
|
|
1735
|
+
};
|
|
1736
|
+
const renderThumbHorizontal = (props) => {
|
|
1737
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1738
|
+
"div",
|
|
1739
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1740
|
+
className: clsx_default(`${prefixCls}scroll-area__thumb ${prefixCls}scroll-area__thumb--horizontal`, props.className)
|
|
1741
|
+
})
|
|
1742
|
+
);
|
|
1743
|
+
};
|
|
1744
|
+
const renderThumbVertical = (props) => {
|
|
1745
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1746
|
+
"div",
|
|
1747
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1748
|
+
className: clsx_default(`${prefixCls}scroll-area__thumb ${prefixCls}scroll-area__thumb--vertical`, props.className)
|
|
1749
|
+
})
|
|
1750
|
+
);
|
|
1751
|
+
};
|
|
1752
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1753
|
+
import_react_custom_scrollbars_2.Scrollbars,
|
|
1754
|
+
{
|
|
1755
|
+
height,
|
|
1756
|
+
autoHide: true,
|
|
1757
|
+
className: `${prefixCls}scroll-area`,
|
|
1758
|
+
renderTrackHorizontal,
|
|
1759
|
+
renderTrackVertical,
|
|
1760
|
+
renderThumbHorizontal,
|
|
1761
|
+
renderThumbVertical,
|
|
1762
|
+
renderView,
|
|
1763
|
+
style,
|
|
1764
|
+
ref: (node) => {
|
|
1765
|
+
node && assignRef(ref, node.container.firstElementChild);
|
|
1766
|
+
},
|
|
1767
|
+
children
|
|
1768
|
+
}
|
|
1769
|
+
);
|
|
1499
1770
|
});
|
|
1500
1771
|
var ScrollArea_default = ScrollArea;
|
|
1501
1772
|
|
|
1773
|
+
// src/components/TextInput/TextInput.tsx
|
|
1774
|
+
var import_react45 = require("react");
|
|
1775
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1776
|
+
var TextInput = (0, import_react45.forwardRef)(
|
|
1777
|
+
(_a, ref) => {
|
|
1778
|
+
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"]);
|
|
1779
|
+
const [focus, setFocus] = (0, import_react45.useState)(false);
|
|
1780
|
+
const selfInputRef = (0, import_react45.useRef)(null);
|
|
1781
|
+
const prefixCls = PREFIX_CLS;
|
|
1782
|
+
const handleChange = (event) => {
|
|
1783
|
+
onChange == null ? void 0 : onChange(event);
|
|
1784
|
+
};
|
|
1785
|
+
const handleClick = (event) => {
|
|
1786
|
+
var _a2;
|
|
1787
|
+
onClick == null ? void 0 : onClick(event);
|
|
1788
|
+
(_a2 = selfInputRef == null ? void 0 : selfInputRef.current) == null ? void 0 : _a2.focus();
|
|
1789
|
+
};
|
|
1790
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
1791
|
+
"div",
|
|
1792
|
+
{
|
|
1793
|
+
ref,
|
|
1794
|
+
className: clsx_default(
|
|
1795
|
+
`${prefixCls}input`,
|
|
1796
|
+
{ [`${prefixCls}input--focus`]: focus, [`${prefixCls}input--disabled`]: disabled },
|
|
1797
|
+
className
|
|
1798
|
+
),
|
|
1799
|
+
style,
|
|
1800
|
+
onFocus: () => {
|
|
1801
|
+
setFocus(true);
|
|
1802
|
+
},
|
|
1803
|
+
onBlur: () => {
|
|
1804
|
+
setFocus(false);
|
|
1805
|
+
},
|
|
1806
|
+
onClick: handleClick,
|
|
1807
|
+
children: [
|
|
1808
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: `${prefixCls}outline` }),
|
|
1809
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: `${prefixCls}input__content`, children: [
|
|
1810
|
+
startContent && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: `${prefixCls}input__start-content`, children: startContent }),
|
|
1811
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1812
|
+
"input",
|
|
1813
|
+
__spreadValues({
|
|
1814
|
+
ref: mergeRefs_default(selfInputRef, inputRef),
|
|
1815
|
+
className: `${prefixCls}input__field`,
|
|
1816
|
+
value,
|
|
1817
|
+
defaultValue,
|
|
1818
|
+
disabled,
|
|
1819
|
+
onChange: handleChange
|
|
1820
|
+
}, rest)
|
|
1821
|
+
),
|
|
1822
|
+
endContent && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: `${prefixCls}input__end-content`, children: endContent })
|
|
1823
|
+
] })
|
|
1824
|
+
]
|
|
1825
|
+
}
|
|
1826
|
+
);
|
|
1827
|
+
}
|
|
1828
|
+
);
|
|
1829
|
+
var TextInput_default = TextInput;
|
|
1830
|
+
|
|
1502
1831
|
// src/components/Select/SelectClient.tsx
|
|
1503
1832
|
var import_kendo_data_query = require("@progress/kendo-data-query");
|
|
1504
1833
|
var import_kendo_react_dropdowns = require("@progress/kendo-react-dropdowns");
|
|
1505
|
-
var
|
|
1506
|
-
var
|
|
1834
|
+
var import_react46 = require("react");
|
|
1835
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1507
1836
|
var SelectClient = ({
|
|
1508
1837
|
value: valueProp,
|
|
1509
1838
|
data: propData,
|
|
1510
1839
|
filter: filterProp,
|
|
1511
|
-
keyField
|
|
1512
|
-
textField:
|
|
1840
|
+
keyField = "key",
|
|
1841
|
+
textField: textField2 = "text",
|
|
1513
1842
|
placeholder,
|
|
1514
1843
|
virtual,
|
|
1515
1844
|
filterable,
|
|
@@ -1519,8 +1848,8 @@ var SelectClient = ({
|
|
|
1519
1848
|
onChange,
|
|
1520
1849
|
onFilterChange
|
|
1521
1850
|
}) => {
|
|
1522
|
-
const [value, setValue] = (0,
|
|
1523
|
-
const [filter, setFilter] = (0,
|
|
1851
|
+
const [value, setValue] = (0, import_react46.useState)(valueProp);
|
|
1852
|
+
const [filter, setFilter] = (0, import_react46.useState)(filterProp);
|
|
1524
1853
|
const handleChange = (event) => {
|
|
1525
1854
|
const value2 = event.target.value || null;
|
|
1526
1855
|
if (valueProp !== void 0) {
|
|
@@ -1529,17 +1858,17 @@ var SelectClient = ({
|
|
|
1529
1858
|
setValue(value2);
|
|
1530
1859
|
}
|
|
1531
1860
|
};
|
|
1532
|
-
const
|
|
1533
|
-
const filteredData = (0,
|
|
1534
|
-
const [state, setState] = (0,
|
|
1861
|
+
const pageSize2 = virtual == null ? void 0 : virtual.pageSize;
|
|
1862
|
+
const filteredData = (0, import_react46.useRef)([]);
|
|
1863
|
+
const [state, setState] = (0, import_react46.useState)({
|
|
1535
1864
|
skip: 0,
|
|
1536
1865
|
total: propData.total,
|
|
1537
|
-
subsetData: propData.items.slice(0,
|
|
1866
|
+
subsetData: propData.items.slice(0, pageSize2)
|
|
1538
1867
|
});
|
|
1539
1868
|
const handleFilterChange = (event) => {
|
|
1540
|
-
if (
|
|
1869
|
+
if (pageSize2) {
|
|
1541
1870
|
filteredData.current = (0, import_kendo_data_query.filterBy)(propData.items.slice(), event.filter);
|
|
1542
|
-
const data = filteredData.current.slice(0,
|
|
1871
|
+
const data = filteredData.current.slice(0, pageSize2);
|
|
1543
1872
|
setState({
|
|
1544
1873
|
subsetData: data,
|
|
1545
1874
|
skip: 0,
|
|
@@ -1554,39 +1883,39 @@ var SelectClient = ({
|
|
|
1554
1883
|
}
|
|
1555
1884
|
};
|
|
1556
1885
|
const handlePageChange = (event) => {
|
|
1557
|
-
if (
|
|
1886
|
+
if (pageSize2) {
|
|
1558
1887
|
const skip = event.page.skip;
|
|
1559
1888
|
const take = event.page.take;
|
|
1560
1889
|
const newSubsetData = filteredData.current.slice(skip, skip + take);
|
|
1561
1890
|
setState(__spreadProps(__spreadValues({}, state), { subsetData: newSubsetData, skip }));
|
|
1562
1891
|
}
|
|
1563
1892
|
};
|
|
1564
|
-
(0,
|
|
1893
|
+
(0, import_react46.useEffect)(() => {
|
|
1565
1894
|
if (valueProp !== void 0) {
|
|
1566
1895
|
setValue(valueProp);
|
|
1567
1896
|
}
|
|
1568
1897
|
}, [valueProp]);
|
|
1569
|
-
(0,
|
|
1898
|
+
(0, import_react46.useEffect)(() => {
|
|
1570
1899
|
setFilter(filterProp);
|
|
1571
1900
|
}, [filterProp]);
|
|
1572
|
-
(0,
|
|
1573
|
-
if (
|
|
1901
|
+
(0, import_react46.useEffect)(() => {
|
|
1902
|
+
if (pageSize2) {
|
|
1574
1903
|
filteredData.current = propData.items.slice();
|
|
1575
1904
|
}
|
|
1576
1905
|
}, [propData]);
|
|
1577
|
-
return /* @__PURE__ */ (0,
|
|
1906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1578
1907
|
import_kendo_react_dropdowns.ComboBox,
|
|
1579
1908
|
{
|
|
1580
1909
|
value,
|
|
1581
|
-
data:
|
|
1910
|
+
data: pageSize2 ? state.subsetData : propData.items,
|
|
1582
1911
|
placeholder,
|
|
1583
|
-
dataItemKey:
|
|
1584
|
-
textField:
|
|
1912
|
+
dataItemKey: keyField,
|
|
1913
|
+
textField: textField2,
|
|
1585
1914
|
filterable,
|
|
1586
1915
|
filter,
|
|
1587
|
-
virtual:
|
|
1916
|
+
virtual: pageSize2 ? {
|
|
1588
1917
|
total: state.total,
|
|
1589
|
-
pageSize:
|
|
1918
|
+
pageSize: pageSize2,
|
|
1590
1919
|
skip: state.skip
|
|
1591
1920
|
} : void 0,
|
|
1592
1921
|
disabled,
|
|
@@ -1602,8 +1931,8 @@ var SelectClient_default = SelectClient;
|
|
|
1602
1931
|
|
|
1603
1932
|
// src/components/Select/SelectServer.tsx
|
|
1604
1933
|
var import_kendo_react_dropdowns2 = require("@progress/kendo-react-dropdowns");
|
|
1605
|
-
var
|
|
1606
|
-
var
|
|
1934
|
+
var import_react47 = require("react");
|
|
1935
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1607
1936
|
var textField = "ContactName";
|
|
1608
1937
|
var emptyItem = { [textField]: "loading ...", CustomerID: 0 };
|
|
1609
1938
|
var pageSize = 10;
|
|
@@ -1614,8 +1943,8 @@ while (loadingData.length < pageSize) {
|
|
|
1614
1943
|
var SelectServer = ({
|
|
1615
1944
|
data: dataProp,
|
|
1616
1945
|
value: valueProp,
|
|
1617
|
-
keyField
|
|
1618
|
-
textField:
|
|
1946
|
+
keyField = "key",
|
|
1947
|
+
textField: textField2 = "text",
|
|
1619
1948
|
placeholder,
|
|
1620
1949
|
virtual,
|
|
1621
1950
|
filterable,
|
|
@@ -1630,21 +1959,21 @@ var SelectServer = ({
|
|
|
1630
1959
|
renderItem
|
|
1631
1960
|
}) => {
|
|
1632
1961
|
var _a;
|
|
1633
|
-
const dataCaching = (0,
|
|
1634
|
-
const pendingRequest = (0,
|
|
1635
|
-
const requestStarted = (0,
|
|
1636
|
-
const
|
|
1637
|
-
const [
|
|
1638
|
-
const [data, setData] = (0,
|
|
1639
|
-
const [total, setTotal] = (0,
|
|
1640
|
-
const [value, setValue] = (0,
|
|
1641
|
-
const [filter, setFilter] = (0,
|
|
1642
|
-
const
|
|
1643
|
-
const skipRef = (0,
|
|
1962
|
+
const dataCaching = (0, import_react47.useRef)([]);
|
|
1963
|
+
const pendingRequest = (0, import_react47.useRef)();
|
|
1964
|
+
const requestStarted = (0, import_react47.useRef)(false);
|
|
1965
|
+
const emptyItem2 = { [keyField]: 0, [textField2]: "loading ..." };
|
|
1966
|
+
const [loadingData2, setLoadingData] = (0, import_react47.useState)([]);
|
|
1967
|
+
const [data, setData] = (0, import_react47.useState)(dataProp.items);
|
|
1968
|
+
const [total, setTotal] = (0, import_react47.useState)(0);
|
|
1969
|
+
const [value, setValue] = (0, import_react47.useState)(valueProp);
|
|
1970
|
+
const [filter, setFilter] = (0, import_react47.useState)(filterProp);
|
|
1971
|
+
const pageSize2 = (_a = virtual == null ? void 0 : virtual.pageSize) != null ? _a : 10;
|
|
1972
|
+
const skipRef = (0, import_react47.useRef)(0);
|
|
1644
1973
|
const resetCach = () => {
|
|
1645
1974
|
dataCaching.current.length = 0;
|
|
1646
1975
|
};
|
|
1647
|
-
const requestData = (0,
|
|
1976
|
+
const requestData = (0, import_react47.useCallback)(
|
|
1648
1977
|
(state) => {
|
|
1649
1978
|
const { skip } = state;
|
|
1650
1979
|
if (requestStarted.current) {
|
|
@@ -1671,7 +2000,7 @@ var SelectServer = ({
|
|
|
1671
2000
|
},
|
|
1672
2001
|
[getData]
|
|
1673
2002
|
);
|
|
1674
|
-
const handleFilterChange = (0,
|
|
2003
|
+
const handleFilterChange = (0, import_react47.useCallback)((event) => {
|
|
1675
2004
|
const filter2 = event.filter.value;
|
|
1676
2005
|
if (filterProp !== void 0) {
|
|
1677
2006
|
onFilterChange == null ? void 0 : onFilterChange(filter2);
|
|
@@ -1680,25 +2009,25 @@ var SelectServer = ({
|
|
|
1680
2009
|
}
|
|
1681
2010
|
resetCach();
|
|
1682
2011
|
requestData({ skip: 0, filter: filter2 });
|
|
1683
|
-
setData(
|
|
2012
|
+
setData(loadingData2);
|
|
1684
2013
|
skipRef.current = 0;
|
|
1685
2014
|
}, []);
|
|
1686
|
-
const shouldRequestData = (0,
|
|
1687
|
-
for (let i = 0; i <
|
|
2015
|
+
const shouldRequestData = (0, import_react47.useCallback)((skip) => {
|
|
2016
|
+
for (let i = 0; i < pageSize2; i++) {
|
|
1688
2017
|
if (!dataCaching.current[skip + i]) {
|
|
1689
2018
|
return true;
|
|
1690
2019
|
}
|
|
1691
2020
|
}
|
|
1692
2021
|
return false;
|
|
1693
2022
|
}, []);
|
|
1694
|
-
const getCachedData = (0,
|
|
2023
|
+
const getCachedData = (0, import_react47.useCallback)((skip) => {
|
|
1695
2024
|
const data2 = [];
|
|
1696
|
-
for (let i = 0; i <
|
|
1697
|
-
data2.push(dataCaching.current[i + skip] ||
|
|
2025
|
+
for (let i = 0; i < pageSize2; i++) {
|
|
2026
|
+
data2.push(dataCaching.current[i + skip] || emptyItem2);
|
|
1698
2027
|
}
|
|
1699
2028
|
return data2;
|
|
1700
2029
|
}, []);
|
|
1701
|
-
const pageChange = (0,
|
|
2030
|
+
const pageChange = (0, import_react47.useCallback)(
|
|
1702
2031
|
(event) => {
|
|
1703
2032
|
if (filter !== void 0) {
|
|
1704
2033
|
const newSkip = event.page.skip;
|
|
@@ -1712,9 +2041,9 @@ var SelectServer = ({
|
|
|
1712
2041
|
},
|
|
1713
2042
|
[getCachedData, requestData, shouldRequestData, filter]
|
|
1714
2043
|
);
|
|
1715
|
-
const handleChange = (0,
|
|
2044
|
+
const handleChange = (0, import_react47.useCallback)((event) => {
|
|
1716
2045
|
const value2 = event.target.value;
|
|
1717
|
-
if (value2 && value2[
|
|
2046
|
+
if (value2 && value2[textField2] === emptyItem2[textField2]) {
|
|
1718
2047
|
return;
|
|
1719
2048
|
}
|
|
1720
2049
|
if (valueProp !== void 0) {
|
|
@@ -1726,48 +2055,48 @@ var SelectServer = ({
|
|
|
1726
2055
|
const handleItemRender = (li, itemProps) => {
|
|
1727
2056
|
const itemChildren = renderItem == null ? void 0 : renderItem(itemProps.dataItem);
|
|
1728
2057
|
if (!itemChildren)
|
|
1729
|
-
return (0,
|
|
1730
|
-
return (0,
|
|
2058
|
+
return (0, import_react47.cloneElement)(li, li.props);
|
|
2059
|
+
return (0, import_react47.cloneElement)(li, li.props, itemChildren);
|
|
1731
2060
|
};
|
|
1732
|
-
(0,
|
|
1733
|
-
const
|
|
1734
|
-
const
|
|
1735
|
-
while (
|
|
1736
|
-
|
|
2061
|
+
(0, import_react47.useEffect)(() => {
|
|
2062
|
+
const pageSize3 = 10;
|
|
2063
|
+
const loadingData3 = [];
|
|
2064
|
+
while (loadingData3.length < pageSize3) {
|
|
2065
|
+
loadingData3.push(emptyItem2);
|
|
1737
2066
|
}
|
|
1738
|
-
setLoadingData(
|
|
2067
|
+
setLoadingData(loadingData3);
|
|
1739
2068
|
}, []);
|
|
1740
|
-
(0,
|
|
2069
|
+
(0, import_react47.useEffect)(() => {
|
|
1741
2070
|
if (valueProp !== void 0) {
|
|
1742
2071
|
setValue(valueProp);
|
|
1743
2072
|
}
|
|
1744
2073
|
}, [valueProp]);
|
|
1745
|
-
(0,
|
|
2074
|
+
(0, import_react47.useEffect)(() => {
|
|
1746
2075
|
if (filterProp !== void 0) {
|
|
1747
2076
|
setFilter(filterProp);
|
|
1748
2077
|
}
|
|
1749
2078
|
}, [filterProp]);
|
|
1750
|
-
(0,
|
|
2079
|
+
(0, import_react47.useEffect)(() => {
|
|
1751
2080
|
requestData({ skip: 0, filter });
|
|
1752
2081
|
return () => {
|
|
1753
2082
|
resetCach();
|
|
1754
2083
|
};
|
|
1755
2084
|
}, [filter, requestData]);
|
|
1756
|
-
(0,
|
|
2085
|
+
(0, import_react47.useEffect)(() => {
|
|
1757
2086
|
setData(dataProp.items);
|
|
1758
2087
|
}, [dataProp]);
|
|
1759
|
-
return /* @__PURE__ */ (0,
|
|
2088
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1760
2089
|
import_kendo_react_dropdowns2.ComboBox,
|
|
1761
2090
|
{
|
|
1762
2091
|
data,
|
|
1763
2092
|
value,
|
|
1764
2093
|
placeholder,
|
|
1765
|
-
dataItemKey:
|
|
1766
|
-
textField:
|
|
2094
|
+
dataItemKey: keyField,
|
|
2095
|
+
textField: textField2,
|
|
1767
2096
|
filterable,
|
|
1768
2097
|
onFilterChange: handleFilterChange,
|
|
1769
2098
|
virtual: {
|
|
1770
|
-
pageSize:
|
|
2099
|
+
pageSize: pageSize2,
|
|
1771
2100
|
skip: skipRef.current,
|
|
1772
2101
|
total
|
|
1773
2102
|
},
|
|
@@ -1783,21 +2112,21 @@ var SelectServer = ({
|
|
|
1783
2112
|
var SelectServer_default = SelectServer;
|
|
1784
2113
|
|
|
1785
2114
|
// src/components/Select/Select.tsx
|
|
1786
|
-
var
|
|
2115
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1787
2116
|
var Select = (props) => {
|
|
1788
|
-
return props.filterMode === "client" ? /* @__PURE__ */ (0,
|
|
2117
|
+
return props.filterMode === "client" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(SelectClient_default, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(SelectServer_default, __spreadValues({}, props));
|
|
1789
2118
|
};
|
|
1790
2119
|
var Select_default = Select;
|
|
1791
2120
|
|
|
1792
2121
|
// src/components/Switch/Switch.tsx
|
|
1793
2122
|
var import_clsx18 = __toESM(require("clsx"));
|
|
1794
|
-
var
|
|
1795
|
-
var
|
|
1796
|
-
var Switch = (0,
|
|
2123
|
+
var import_react48 = require("react");
|
|
2124
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2125
|
+
var Switch = (0, import_react48.forwardRef)(
|
|
1797
2126
|
(_a, ref) => {
|
|
1798
2127
|
var _b = _a, { name, value: valueProp, defaultValue, onChange: onChangeProp, disabled } = _b, rest = __objRest(_b, ["name", "value", "defaultValue", "onChange", "disabled"]);
|
|
1799
2128
|
var _a2;
|
|
1800
|
-
const [selftValue, setSelfValue] = (0,
|
|
2129
|
+
const [selftValue, setSelfValue] = (0, import_react48.useState)((_a2 = valueProp != null ? valueProp : defaultValue) != null ? _a2 : false);
|
|
1801
2130
|
const handleChange = () => {
|
|
1802
2131
|
if (disabled) {
|
|
1803
2132
|
return;
|
|
@@ -1805,12 +2134,12 @@ var Switch = (0, import_react42.forwardRef)(
|
|
|
1805
2134
|
onChangeProp == null ? void 0 : onChangeProp(!selftValue);
|
|
1806
2135
|
setSelfValue(!selftValue);
|
|
1807
2136
|
};
|
|
1808
|
-
(0,
|
|
2137
|
+
(0, import_react48.useEffect)(() => {
|
|
1809
2138
|
if (valueProp !== void 0) {
|
|
1810
2139
|
setSelfValue(valueProp);
|
|
1811
2140
|
}
|
|
1812
2141
|
}, [valueProp]);
|
|
1813
|
-
return /* @__PURE__ */ (0,
|
|
2142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
1814
2143
|
"label",
|
|
1815
2144
|
{
|
|
1816
2145
|
htmlFor: name,
|
|
@@ -1818,7 +2147,7 @@ var Switch = (0, import_react42.forwardRef)(
|
|
|
1818
2147
|
[`${PREFIX_CLS}switch--checked`]: !!selftValue
|
|
1819
2148
|
}),
|
|
1820
2149
|
children: [
|
|
1821
|
-
/* @__PURE__ */ (0,
|
|
2150
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
1822
2151
|
"input",
|
|
1823
2152
|
__spreadValues({
|
|
1824
2153
|
type: "checkbox",
|
|
@@ -1830,7 +2159,7 @@ var Switch = (0, import_react42.forwardRef)(
|
|
|
1830
2159
|
onChange: handleChange
|
|
1831
2160
|
}, rest)
|
|
1832
2161
|
),
|
|
1833
|
-
/* @__PURE__ */ (0,
|
|
2162
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: `${PREFIX_CLS}switch__thumb` })
|
|
1834
2163
|
]
|
|
1835
2164
|
}
|
|
1836
2165
|
);
|
|
@@ -1838,326 +2167,271 @@ var Switch = (0, import_react42.forwardRef)(
|
|
|
1838
2167
|
);
|
|
1839
2168
|
var Switch_default = Switch;
|
|
1840
2169
|
|
|
1841
|
-
// src/components/
|
|
1842
|
-
var
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
var
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
var
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
const [
|
|
1870
|
-
const
|
|
1871
|
-
const
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
const [state, setState] = (0, import_react43.useState)({
|
|
1877
|
-
skip: 0,
|
|
1878
|
-
total: dataProp.total,
|
|
1879
|
-
subsetData: dataProp.items.slice(0, pageSize3)
|
|
1880
|
-
});
|
|
1881
|
-
const handleFilterChange = (event) => {
|
|
1882
|
-
if (pageSize3) {
|
|
1883
|
-
filteredData.current = (0, import_kendo_data_query2.filterBy)(dataProp.items.slice(), event.filter);
|
|
1884
|
-
const data = filteredData.current.slice(0, pageSize3);
|
|
1885
|
-
setState({
|
|
1886
|
-
subsetData: data,
|
|
1887
|
-
skip: 0,
|
|
1888
|
-
total: filteredData.current.length
|
|
1889
|
-
});
|
|
2170
|
+
// src/components/Combobox/Combobox.tsx
|
|
2171
|
+
var import_react59 = require("react");
|
|
2172
|
+
|
|
2173
|
+
// src/components/Popover/Popover.tsx
|
|
2174
|
+
var import_react50 = require("react");
|
|
2175
|
+
|
|
2176
|
+
// src/components/Popover/constans.ts
|
|
2177
|
+
var POPOVER_TRANSITION_DURATION_LEAVE = 150;
|
|
2178
|
+
|
|
2179
|
+
// src/components/Popover/PopoverContext.tsx
|
|
2180
|
+
var import_react49 = require("react");
|
|
2181
|
+
var PopoverContext = (0, import_react49.createContext)(null);
|
|
2182
|
+
var usePopover = () => {
|
|
2183
|
+
const context = (0, import_react49.useContext)(PopoverContext);
|
|
2184
|
+
if (!context) {
|
|
2185
|
+
throw new Error("`usePopover` must be used within a `<Popover />`");
|
|
2186
|
+
}
|
|
2187
|
+
return context;
|
|
2188
|
+
};
|
|
2189
|
+
var PopoverContext_default = PopoverContext;
|
|
2190
|
+
|
|
2191
|
+
// src/components/Popover/Popover.tsx
|
|
2192
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2193
|
+
var Popover = (props) => {
|
|
2194
|
+
const { children, target, autoClose = true, triggerClosable = true, isOpen, onOpen, onClose, onToggle } = props;
|
|
2195
|
+
const triggerRef = (0, import_react50.useRef)(null);
|
|
2196
|
+
const contentRef = (0, import_react50.useRef)(null);
|
|
2197
|
+
const [internalOpen, setInternalOpen] = (0, import_react50.useState)(props.isOpen || false);
|
|
2198
|
+
const [trigger, content] = import_react50.Children.toArray(children);
|
|
2199
|
+
const prefixCls = PREFIX_CLS;
|
|
2200
|
+
const handleOpen = () => {
|
|
2201
|
+
if (isOpen !== void 0) {
|
|
2202
|
+
onOpen == null ? void 0 : onOpen();
|
|
2203
|
+
} else {
|
|
2204
|
+
setInternalOpen(true);
|
|
1890
2205
|
}
|
|
1891
|
-
onFilterChange == null ? void 0 : onFilterChange(event.filter.value);
|
|
1892
2206
|
};
|
|
1893
|
-
const
|
|
1894
|
-
if (
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
setState(__spreadProps(__spreadValues({}, state), { subsetData: newSubsetData, skip }));
|
|
2207
|
+
const handleClose = () => {
|
|
2208
|
+
if (isOpen !== void 0) {
|
|
2209
|
+
onClose == null ? void 0 : onClose();
|
|
2210
|
+
} else {
|
|
2211
|
+
setInternalOpen(false);
|
|
1899
2212
|
}
|
|
1900
2213
|
};
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
}, [filterProp]);
|
|
1907
|
-
(0, import_react43.useEffect)(() => {
|
|
1908
|
-
if (pageSize3) {
|
|
1909
|
-
filteredData.current = dataProp.items.slice();
|
|
2214
|
+
const handleToggle = () => {
|
|
2215
|
+
if (isOpen !== void 0) {
|
|
2216
|
+
onToggle == null ? void 0 : onToggle();
|
|
2217
|
+
} else {
|
|
2218
|
+
setInternalOpen((prevState) => !prevState);
|
|
1910
2219
|
}
|
|
1911
|
-
}
|
|
1912
|
-
|
|
1913
|
-
|
|
2220
|
+
};
|
|
2221
|
+
(0, import_react50.useEffect)(() => {
|
|
2222
|
+
setInternalOpen(isOpen || false);
|
|
2223
|
+
}, [isOpen]);
|
|
2224
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
2225
|
+
PopoverContext_default.Provider,
|
|
1914
2226
|
{
|
|
1915
|
-
value
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
2227
|
+
value: {
|
|
2228
|
+
triggerRef,
|
|
2229
|
+
contentRef,
|
|
2230
|
+
target,
|
|
2231
|
+
isOpen: internalOpen,
|
|
2232
|
+
autoClose,
|
|
2233
|
+
triggerClosable,
|
|
2234
|
+
onOpen: handleOpen,
|
|
2235
|
+
onClose: handleClose,
|
|
2236
|
+
onToggle: handleToggle
|
|
2237
|
+
},
|
|
2238
|
+
children: [
|
|
2239
|
+
trigger,
|
|
2240
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2241
|
+
Transition_default,
|
|
2242
|
+
{
|
|
2243
|
+
nodeRef: contentRef,
|
|
2244
|
+
isOpen: internalOpen,
|
|
2245
|
+
enter: 300,
|
|
2246
|
+
leave: POPOVER_TRANSITION_DURATION_LEAVE,
|
|
2247
|
+
name: `${prefixCls}popover`,
|
|
2248
|
+
unmountOnExit: true,
|
|
2249
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Portal_default, { children: (0, import_react50.cloneElement)(import_react50.Children.only(content), __spreadProps(__spreadValues({}, content.props), {
|
|
2250
|
+
ref: contentRef
|
|
2251
|
+
})) })
|
|
2252
|
+
}
|
|
2253
|
+
)
|
|
2254
|
+
]
|
|
1933
2255
|
}
|
|
1934
2256
|
);
|
|
1935
2257
|
};
|
|
1936
|
-
var
|
|
2258
|
+
var Popover_default = Popover;
|
|
1937
2259
|
|
|
1938
|
-
// src/components/
|
|
1939
|
-
var
|
|
1940
|
-
var
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
const
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
const [value, setValue] = (0, import_react44.useState)(valueProp);
|
|
1968
|
-
const [filter, setFilter] = (0, import_react44.useState)(filterProp);
|
|
1969
|
-
const pageSize3 = (_a = virtual == null ? void 0 : virtual.pageSize) != null ? _a : 10;
|
|
1970
|
-
const skipRef = (0, import_react44.useRef)(0);
|
|
1971
|
-
const resetCach = () => {
|
|
1972
|
-
dataCaching.current.length = 0;
|
|
1973
|
-
};
|
|
1974
|
-
const requestData = (0, import_react44.useCallback)(
|
|
1975
|
-
(state) => {
|
|
1976
|
-
if (requestStarted.current) {
|
|
1977
|
-
clearTimeout(pendingRequest.current);
|
|
1978
|
-
pendingRequest.current = setTimeout(() => {
|
|
1979
|
-
requestData(state);
|
|
1980
|
-
}, 50);
|
|
1981
|
-
return;
|
|
1982
|
-
}
|
|
1983
|
-
requestStarted.current = true;
|
|
1984
|
-
getData(state).then(({ items, total: total2 }) => {
|
|
1985
|
-
const { skip } = state;
|
|
1986
|
-
items.forEach((item, index) => {
|
|
1987
|
-
dataCaching.current[index + skip] = item;
|
|
1988
|
-
});
|
|
1989
|
-
if (skip === skipRef.current) {
|
|
1990
|
-
setData(items);
|
|
1991
|
-
setTotal(total2);
|
|
1992
|
-
onDataChange == null ? void 0 : onDataChange({ items, total: total2 });
|
|
1993
|
-
}
|
|
1994
|
-
requestStarted.current = false;
|
|
1995
|
-
}).catch(() => {
|
|
1996
|
-
requestStarted.current = false;
|
|
1997
|
-
});
|
|
1998
|
-
},
|
|
1999
|
-
[getData]
|
|
2000
|
-
);
|
|
2001
|
-
const handleFilterChange = (0, import_react44.useCallback)((event) => {
|
|
2002
|
-
const filter2 = event.filter.value;
|
|
2003
|
-
resetCach();
|
|
2004
|
-
requestData({ skip: 0, filter: filter2 });
|
|
2005
|
-
setData(loadingData3);
|
|
2006
|
-
skipRef.current = 0;
|
|
2007
|
-
setFilter(filter2);
|
|
2008
|
-
onFilterChange == null ? void 0 : onFilterChange(filter2);
|
|
2009
|
-
}, []);
|
|
2010
|
-
const shouldRequestData = (0, import_react44.useCallback)((skip) => {
|
|
2011
|
-
for (let i = 0; i < pageSize3; i++) {
|
|
2012
|
-
if (!dataCaching.current[skip + i]) {
|
|
2013
|
-
return true;
|
|
2014
|
-
}
|
|
2015
|
-
}
|
|
2016
|
-
return false;
|
|
2017
|
-
}, []);
|
|
2018
|
-
const getCachedData = (0, import_react44.useCallback)((skip) => {
|
|
2019
|
-
const data2 = [];
|
|
2020
|
-
for (let i = 0; i < pageSize3; i++) {
|
|
2021
|
-
data2.push(dataCaching.current[i + skip] || emptyItem3);
|
|
2260
|
+
// src/components/Popover/PopoverContent.tsx
|
|
2261
|
+
var import_react51 = require("react");
|
|
2262
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
2263
|
+
function getScrollParent(node) {
|
|
2264
|
+
if (node == null) {
|
|
2265
|
+
return null;
|
|
2266
|
+
}
|
|
2267
|
+
if (node.scrollHeight > node.clientHeight) {
|
|
2268
|
+
return node;
|
|
2269
|
+
} else {
|
|
2270
|
+
return getScrollParent(node.parentNode);
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
var PopoverContent = (0, import_react51.forwardRef)((props, ref) => {
|
|
2274
|
+
const _a = props, { children, style, className, onClick } = _a, rest = __objRest(_a, ["children", "style", "className", "onClick"]);
|
|
2275
|
+
const { triggerRef, contentRef, target, onClose } = usePopover();
|
|
2276
|
+
const prefixCls = PREFIX_CLS;
|
|
2277
|
+
const menuListRef = (0, import_react51.useRef)(null);
|
|
2278
|
+
const [contentStyle, setContentStyle] = (0, import_react51.useState)({
|
|
2279
|
+
position: "absolute",
|
|
2280
|
+
top: 0,
|
|
2281
|
+
left: 0,
|
|
2282
|
+
visibility: "hidden"
|
|
2283
|
+
});
|
|
2284
|
+
const containerEl = getScrollParent(triggerRef.current) || window;
|
|
2285
|
+
useElementSize_default({
|
|
2286
|
+
target: containerEl,
|
|
2287
|
+
callback: () => {
|
|
2288
|
+
handleSize();
|
|
2022
2289
|
}
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
(event)
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
const
|
|
2039
|
-
if (
|
|
2290
|
+
});
|
|
2291
|
+
useOnClickOutside_default(contentRef, (event) => {
|
|
2292
|
+
const el = triggerRef.current;
|
|
2293
|
+
if (!el || el.contains(event.target))
|
|
2294
|
+
return;
|
|
2295
|
+
onClose();
|
|
2296
|
+
});
|
|
2297
|
+
const handleClick = (ev) => {
|
|
2298
|
+
ev.stopPropagation();
|
|
2299
|
+
onClick == null ? void 0 : onClick(ev);
|
|
2300
|
+
};
|
|
2301
|
+
const handleSize = (0, import_react51.useCallback)(() => {
|
|
2302
|
+
var _a2, _b;
|
|
2303
|
+
console.log(containerEl);
|
|
2304
|
+
const popoverRect = (_a2 = contentRef.current) == null ? void 0 : _a2.getBoundingClientRect();
|
|
2305
|
+
const triggerClientRect = (_b = triggerRef.current) == null ? void 0 : _b.getBoundingClientRect();
|
|
2306
|
+
if (!popoverRect || !triggerClientRect || !containerEl) {
|
|
2040
2307
|
return;
|
|
2041
2308
|
}
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
}
|
|
2051
|
-
|
|
2309
|
+
const container = { innerWidth: window.innerWidth, innerHeight: window.innerHeight };
|
|
2310
|
+
const triggerRect = {
|
|
2311
|
+
width: triggerClientRect.width,
|
|
2312
|
+
height: triggerClientRect.height,
|
|
2313
|
+
top: triggerClientRect.top + window.scrollY,
|
|
2314
|
+
bottom: triggerClientRect.top + triggerClientRect.height + window.scrollY,
|
|
2315
|
+
left: triggerClientRect.left + window.scrollX,
|
|
2316
|
+
right: triggerClientRect.left + triggerClientRect.width + window.scrollX
|
|
2317
|
+
};
|
|
2318
|
+
const outsideX = triggerRect.left + popoverRect.width > container.innerWidth;
|
|
2319
|
+
const outsideY = triggerRect.top + popoverRect.height > container.innerHeight + window.scrollY;
|
|
2320
|
+
const style2 = __spreadProps(__spreadValues({}, target && {
|
|
2321
|
+
width: triggerRect.width,
|
|
2322
|
+
minWidth: "auto"
|
|
2323
|
+
}), {
|
|
2324
|
+
position: "absolute",
|
|
2325
|
+
top: outsideY ? void 0 : triggerRect.bottom,
|
|
2326
|
+
bottom: outsideY ? container.innerHeight - triggerRect.top : void 0,
|
|
2327
|
+
left: outsideX ? void 0 : triggerRect.left,
|
|
2328
|
+
right: outsideX ? container.innerWidth - triggerRect.right : void 0,
|
|
2329
|
+
visibility: void 0
|
|
2330
|
+
});
|
|
2331
|
+
setContentStyle(style2);
|
|
2052
2332
|
}, []);
|
|
2053
|
-
(0,
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
setValue(valueProp);
|
|
2058
|
-
}, [valueProp]);
|
|
2059
|
-
(0, import_react44.useEffect)(() => {
|
|
2060
|
-
setFilter(filterProp);
|
|
2061
|
-
}, [filterProp]);
|
|
2062
|
-
(0, import_react44.useEffect)(() => {
|
|
2063
|
-
requestData({ skip: 0, filter });
|
|
2333
|
+
(0, import_react51.useEffect)(() => {
|
|
2334
|
+
handleSize();
|
|
2335
|
+
containerEl.addEventListener("scroll", handleSize);
|
|
2336
|
+
window.addEventListener("orientationchange", handleSize);
|
|
2064
2337
|
return () => {
|
|
2065
|
-
|
|
2338
|
+
containerEl.removeEventListener("scroll", handleSize);
|
|
2339
|
+
window.removeEventListener("orientationchange", handleSize);
|
|
2066
2340
|
};
|
|
2067
|
-
}, [
|
|
2068
|
-
return /* @__PURE__ */ (0,
|
|
2069
|
-
|
|
2070
|
-
{
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
total
|
|
2082
|
-
},
|
|
2083
|
-
disabled,
|
|
2084
|
-
loading,
|
|
2085
|
-
className,
|
|
2086
|
-
onChange: handleChange,
|
|
2087
|
-
onPageChange: pageChange
|
|
2088
|
-
}
|
|
2341
|
+
}, []);
|
|
2342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
2343
|
+
"div",
|
|
2344
|
+
__spreadProps(__spreadValues({
|
|
2345
|
+
ref: mergeRefs_default(menuListRef, ref),
|
|
2346
|
+
className: clsx_default(`${prefixCls}popover`, className),
|
|
2347
|
+
style: __spreadValues(__spreadValues({}, style), contentStyle),
|
|
2348
|
+
onClick: handleClick
|
|
2349
|
+
}, rest), {
|
|
2350
|
+
children: [
|
|
2351
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: `${prefixCls}popover__overlay` }),
|
|
2352
|
+
children
|
|
2353
|
+
]
|
|
2354
|
+
})
|
|
2089
2355
|
);
|
|
2090
|
-
};
|
|
2091
|
-
var MultiSelectServer_default = MultiSelectServer;
|
|
2092
|
-
|
|
2093
|
-
// src/components/MultiSelect/MultiSelect.tsx
|
|
2094
|
-
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2095
|
-
var MultiSelect3 = (props) => {
|
|
2096
|
-
return props.filterMode === "client" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(MultiSelectClient_default, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(MultiSelectServer_default, __spreadValues({}, props));
|
|
2097
|
-
};
|
|
2098
|
-
var MultiSelect_default = MultiSelect3;
|
|
2099
|
-
|
|
2100
|
-
// src/components/Field/Field.tsx
|
|
2101
|
-
var import_react45 = require("react");
|
|
2102
|
-
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2103
|
-
var Field = (0, import_react45.forwardRef)(({ children, label }, ref) => {
|
|
2104
|
-
{
|
|
2105
|
-
const prefixCls = PREFIX_CLS;
|
|
2106
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { ref, className: clsx_default(`${prefixCls}field`), children: [
|
|
2107
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: `${prefixCls}field__label`, children: label }),
|
|
2108
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: `${prefixCls}field__content`, children })
|
|
2109
|
-
] });
|
|
2110
|
-
}
|
|
2111
2356
|
});
|
|
2112
|
-
var
|
|
2357
|
+
var PopoverContent_default = PopoverContent;
|
|
2358
|
+
|
|
2359
|
+
// src/components/Popover/PopoverTrigger.tsx
|
|
2360
|
+
var import_react52 = require("react");
|
|
2361
|
+
var PopoverTrigger = (0, import_react52.forwardRef)((props, ref) => {
|
|
2362
|
+
const _a = props, { children, onClick } = _a, rest = __objRest(_a, ["children", "onClick"]);
|
|
2363
|
+
const { isOpen, triggerRef, triggerClosable, onToggle } = usePopover();
|
|
2364
|
+
const child = import_react52.Children.only(typeof children === "function" ? children(isOpen) : children);
|
|
2365
|
+
const handleClick = (ev) => {
|
|
2366
|
+
var _a2, _b;
|
|
2367
|
+
ev.preventDefault();
|
|
2368
|
+
triggerClosable && onToggle();
|
|
2369
|
+
onClick == null ? void 0 : onClick(ev);
|
|
2370
|
+
(_b = (_a2 = child.props).onClick) == null ? void 0 : _b.call(_a2, ev);
|
|
2371
|
+
};
|
|
2372
|
+
return (0, import_react52.cloneElement)(child, __spreadProps(__spreadValues(__spreadValues({}, child.props), rest), {
|
|
2373
|
+
ref: mergeRefs_default(ref, triggerRef),
|
|
2374
|
+
onClick: handleClick
|
|
2375
|
+
}));
|
|
2376
|
+
});
|
|
2377
|
+
var PopoverTrigger_default = PopoverTrigger;
|
|
2378
|
+
|
|
2379
|
+
// src/components/Combobox/ComboboxContent.tsx
|
|
2380
|
+
var import_react57 = require("react");
|
|
2113
2381
|
|
|
2114
2382
|
// src/components/List/List.tsx
|
|
2115
|
-
var
|
|
2116
|
-
var
|
|
2117
|
-
var List = (0,
|
|
2383
|
+
var import_react53 = require("react");
|
|
2384
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2385
|
+
var List = (0, import_react53.forwardRef)((_a, ref) => {
|
|
2118
2386
|
var _b = _a, { as: Component = "div", children } = _b, rest = __objRest(_b, ["as", "children"]);
|
|
2119
|
-
|
|
2387
|
+
const prefixCls = PREFIX_CLS;
|
|
2388
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Component, __spreadProps(__spreadValues({ ref, className: `${prefixCls}list` }, rest), { children }));
|
|
2120
2389
|
});
|
|
2121
2390
|
var List_default = List;
|
|
2122
2391
|
|
|
2123
2392
|
// src/components/List/ListGroup.tsx
|
|
2124
|
-
var
|
|
2393
|
+
var import_react55 = require("react");
|
|
2125
2394
|
|
|
2126
2395
|
// src/components/List/ListItem.tsx
|
|
2127
|
-
var
|
|
2128
|
-
var
|
|
2129
|
-
var ListItem = (0,
|
|
2396
|
+
var import_react54 = require("react");
|
|
2397
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2398
|
+
var ListItem = (0, import_react54.forwardRef)(
|
|
2130
2399
|
(_a, ref) => {
|
|
2131
2400
|
var _b = _a, {
|
|
2132
2401
|
as: Component = "div",
|
|
2133
2402
|
className,
|
|
2134
2403
|
title,
|
|
2404
|
+
subtitle,
|
|
2135
2405
|
startContent,
|
|
2136
2406
|
endContent,
|
|
2137
2407
|
level = 1,
|
|
2138
2408
|
hoverable,
|
|
2139
2409
|
selected,
|
|
2140
2410
|
disabled,
|
|
2411
|
+
slotProps,
|
|
2141
2412
|
style,
|
|
2142
2413
|
onClick
|
|
2143
2414
|
} = _b, rest = __objRest(_b, [
|
|
2144
2415
|
"as",
|
|
2145
2416
|
"className",
|
|
2146
2417
|
"title",
|
|
2418
|
+
"subtitle",
|
|
2147
2419
|
"startContent",
|
|
2148
2420
|
"endContent",
|
|
2149
2421
|
"level",
|
|
2150
2422
|
"hoverable",
|
|
2151
2423
|
"selected",
|
|
2152
2424
|
"disabled",
|
|
2425
|
+
"slotProps",
|
|
2153
2426
|
"style",
|
|
2154
2427
|
"onClick"
|
|
2155
2428
|
]);
|
|
2429
|
+
var _a2, _b2;
|
|
2156
2430
|
const prefixCls = PREFIX_CLS;
|
|
2157
2431
|
const handleClick = (event) => {
|
|
2158
2432
|
onClick == null ? void 0 : onClick(event);
|
|
2159
2433
|
};
|
|
2160
|
-
return /* @__PURE__ */ (0,
|
|
2434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
2161
2435
|
Component,
|
|
2162
2436
|
__spreadProps(__spreadValues({
|
|
2163
2437
|
ref,
|
|
@@ -2176,10 +2450,19 @@ var ListItem = (0, import_react47.forwardRef)(
|
|
|
2176
2450
|
onClick: handleClick
|
|
2177
2451
|
}, rest), {
|
|
2178
2452
|
children: [
|
|
2179
|
-
hoverable && /* @__PURE__ */ (0,
|
|
2180
|
-
startContent && /* @__PURE__ */ (0,
|
|
2181
|
-
/* @__PURE__ */ (0,
|
|
2182
|
-
|
|
2453
|
+
hoverable && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: `${prefixCls}overlay` }),
|
|
2454
|
+
startContent && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: `${prefixCls}list-item__start-content`, children: startContent }),
|
|
2455
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: `${prefixCls}list-item__content`, children: [
|
|
2456
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("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 })),
|
|
2457
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2458
|
+
"span",
|
|
2459
|
+
__spreadProps(__spreadValues({}, slotProps == null ? void 0 : slotProps.subtitle), {
|
|
2460
|
+
className: clsx_default(`${prefixCls}list-item__subtitle`, (_b2 = slotProps == null ? void 0 : slotProps.subtitle) == null ? void 0 : _b2.className),
|
|
2461
|
+
children: subtitle
|
|
2462
|
+
})
|
|
2463
|
+
)
|
|
2464
|
+
] }),
|
|
2465
|
+
endContent && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: `${prefixCls}list-item__end-content`, children: endContent })
|
|
2183
2466
|
]
|
|
2184
2467
|
})
|
|
2185
2468
|
);
|
|
@@ -2188,8 +2471,8 @@ var ListItem = (0, import_react47.forwardRef)(
|
|
|
2188
2471
|
var ListItem_default = ListItem;
|
|
2189
2472
|
|
|
2190
2473
|
// src/components/List/ListGroup.tsx
|
|
2191
|
-
var
|
|
2192
|
-
var ListGroup = (0,
|
|
2474
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2475
|
+
var ListGroup = (0, import_react55.forwardRef)(
|
|
2193
2476
|
(_a, ref) => {
|
|
2194
2477
|
var _b = _a, {
|
|
2195
2478
|
children,
|
|
@@ -2213,26 +2496,416 @@ var ListGroup = (0, import_react48.forwardRef)(
|
|
|
2213
2496
|
"onToggle"
|
|
2214
2497
|
]);
|
|
2215
2498
|
const disclosure = isOpen !== void 0 ? { isOpen, onOpen, onClose, onToggle } : useDisclosure_default();
|
|
2216
|
-
|
|
2217
|
-
|
|
2499
|
+
const prefixCls = PREFIX_CLS;
|
|
2500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: `${prefixCls}list-group`, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Collapse_default, __spreadProps(__spreadValues({}, disclosure), { children: [
|
|
2501
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CollapseTrigger_default, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2218
2502
|
ListItem_default,
|
|
2219
2503
|
__spreadValues({
|
|
2220
2504
|
ref,
|
|
2221
|
-
startContent: /* @__PURE__ */ (0,
|
|
2222
|
-
|
|
2505
|
+
startContent: expandVisible && expandPosition === "start" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
2506
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Icon_default, { children: disclosure.isOpen ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ChevronUpIcon_default, {}) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ChevronDownIcon_default, {}) }),
|
|
2223
2507
|
startContent
|
|
2224
|
-
] }),
|
|
2225
|
-
endContent: /* @__PURE__ */ (0,
|
|
2508
|
+
] }) : startContent,
|
|
2509
|
+
endContent: expandVisible && expandPosition === "end" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
2226
2510
|
endContent,
|
|
2227
|
-
|
|
2228
|
-
] })
|
|
2511
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Icon_default, { children: disclosure.isOpen ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ChevronUpIcon_default, {}) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ChevronDownIcon_default, {}) })
|
|
2512
|
+
] }) : endContent
|
|
2229
2513
|
}, rest)
|
|
2230
2514
|
) }),
|
|
2231
|
-
/* @__PURE__ */ (0,
|
|
2515
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CollapseContent_default, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(List_default, { children }) }) })
|
|
2232
2516
|
] })) });
|
|
2233
2517
|
}
|
|
2234
2518
|
);
|
|
2235
2519
|
var ListGroup_default = ListGroup;
|
|
2520
|
+
|
|
2521
|
+
// src/components/Combobox/ComboboxContext.tsx
|
|
2522
|
+
var import_react56 = require("react");
|
|
2523
|
+
var ComboboxContext = (0, import_react56.createContext)(null);
|
|
2524
|
+
var useCombobox = () => {
|
|
2525
|
+
const context = (0, import_react56.useContext)(ComboboxContext);
|
|
2526
|
+
if (!context) {
|
|
2527
|
+
throw new Error("`useCombobox` must be used within a `<Combobox />`");
|
|
2528
|
+
}
|
|
2529
|
+
return context;
|
|
2530
|
+
};
|
|
2531
|
+
var ComboboxContext_default = ComboboxContext;
|
|
2532
|
+
|
|
2533
|
+
// src/components/Combobox/ComboboxContent.tsx
|
|
2534
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2535
|
+
var ComboboxContent = () => {
|
|
2536
|
+
const { data, values, offset, setOffset, keyField, textField: textField2, onItemSelect, renderItem } = useCombobox();
|
|
2537
|
+
const parentRef = (0, import_react57.useRef)(null);
|
|
2538
|
+
const { isOpen } = usePopover();
|
|
2539
|
+
const handleItemSelect = (item) => {
|
|
2540
|
+
var _a;
|
|
2541
|
+
onItemSelect(item);
|
|
2542
|
+
setOffset(((_a = parentRef.current) == null ? void 0 : _a.scrollHeight) || 0);
|
|
2543
|
+
};
|
|
2544
|
+
(0, import_react57.useEffect)(() => {
|
|
2545
|
+
var _a;
|
|
2546
|
+
if (!isOpen)
|
|
2547
|
+
return;
|
|
2548
|
+
(_a = parentRef.current) == null ? void 0 : _a.scrollTo({ top: offset });
|
|
2549
|
+
}, [isOpen]);
|
|
2550
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2551
|
+
ScrollArea_default,
|
|
2552
|
+
{
|
|
2553
|
+
ref: parentRef,
|
|
2554
|
+
height: 200,
|
|
2555
|
+
style: {
|
|
2556
|
+
height: `200px`,
|
|
2557
|
+
width: `100%`,
|
|
2558
|
+
position: "relative"
|
|
2559
|
+
},
|
|
2560
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(List_default, { children: renderItem ? data.map((item) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react57.Fragment, { children: renderItem(item, {
|
|
2561
|
+
title: "",
|
|
2562
|
+
selected: values.includes(item[keyField]),
|
|
2563
|
+
hoverable: true,
|
|
2564
|
+
onClick: () => handleItemSelect(item)
|
|
2565
|
+
}) }, item[keyField])) : data.map((item) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2566
|
+
ListItem_default,
|
|
2567
|
+
{
|
|
2568
|
+
title: item[textField2],
|
|
2569
|
+
selected: values.includes(item[keyField]),
|
|
2570
|
+
hoverable: true,
|
|
2571
|
+
onClick: () => handleItemSelect(item)
|
|
2572
|
+
},
|
|
2573
|
+
item[keyField]
|
|
2574
|
+
)) })
|
|
2575
|
+
}
|
|
2576
|
+
);
|
|
2577
|
+
};
|
|
2578
|
+
var ComboboxContent_default = ComboboxContent;
|
|
2579
|
+
|
|
2580
|
+
// src/components/Combobox/ComboboxVirtual.tsx
|
|
2581
|
+
var import_react_virtual = require("@tanstack/react-virtual");
|
|
2582
|
+
var import_react58 = require("react");
|
|
2583
|
+
|
|
2584
|
+
// src/components/Combobox/utils.ts
|
|
2585
|
+
var valueToValues = (value) => {
|
|
2586
|
+
return Array.isArray(value) ? value : value !== void 0 ? [value] : [];
|
|
2587
|
+
};
|
|
2588
|
+
var valuesToValue = (values) => {
|
|
2589
|
+
return Array.isArray(values) ? values.length !== 0 ? values[0] : void 0 : values;
|
|
2590
|
+
};
|
|
2591
|
+
|
|
2592
|
+
// src/components/Combobox/ComboboxVirtual.tsx
|
|
2593
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2594
|
+
var ComboboxVirtual = () => {
|
|
2595
|
+
const { data, values, keyField, textField: textField2, virtual, onItemSelect, renderItem } = useCombobox();
|
|
2596
|
+
const parentRef = (0, import_react58.useRef)(null);
|
|
2597
|
+
const { isOpen } = usePopover();
|
|
2598
|
+
const rowVirtualizer = (0, import_react_virtual.useVirtualizer)({
|
|
2599
|
+
count: virtual.count ? virtual.count : virtual.hasNextPage ? data.length + 1 : data.length,
|
|
2600
|
+
getScrollElement: () => parentRef.current,
|
|
2601
|
+
estimateSize: virtual.estimateSize,
|
|
2602
|
+
overscan: 5
|
|
2603
|
+
});
|
|
2604
|
+
const handleItemSelect = (item) => {
|
|
2605
|
+
onItemSelect(item);
|
|
2606
|
+
};
|
|
2607
|
+
(0, import_react58.useEffect)(() => {
|
|
2608
|
+
if (!isOpen)
|
|
2609
|
+
return;
|
|
2610
|
+
const value = valuesToValue(values);
|
|
2611
|
+
const index = data.findIndex((item) => item[keyField] === value);
|
|
2612
|
+
rowVirtualizer.scrollToIndex(index, { align: "start" });
|
|
2613
|
+
}, [isOpen]);
|
|
2614
|
+
(0, import_react58.useEffect)(() => {
|
|
2615
|
+
var _a;
|
|
2616
|
+
const [lastItem] = [...rowVirtualizer.getVirtualItems()].reverse();
|
|
2617
|
+
if (!lastItem) {
|
|
2618
|
+
return;
|
|
2619
|
+
}
|
|
2620
|
+
if (lastItem.index >= data.length - 1 && virtual.hasNextPage && !virtual.isFetchingNextPage) {
|
|
2621
|
+
(_a = virtual.onFetchNextPage) == null ? void 0 : _a.call(virtual);
|
|
2622
|
+
}
|
|
2623
|
+
}, [
|
|
2624
|
+
virtual.hasNextPage,
|
|
2625
|
+
virtual.onFetchNextPage,
|
|
2626
|
+
data.length,
|
|
2627
|
+
virtual.isFetchingNextPage,
|
|
2628
|
+
rowVirtualizer.getVirtualItems()
|
|
2629
|
+
]);
|
|
2630
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
2631
|
+
ScrollArea_default,
|
|
2632
|
+
{
|
|
2633
|
+
ref: parentRef,
|
|
2634
|
+
height: 200,
|
|
2635
|
+
style: {
|
|
2636
|
+
height: `200px`,
|
|
2637
|
+
width: `100%`,
|
|
2638
|
+
position: "relative"
|
|
2639
|
+
},
|
|
2640
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
2641
|
+
"div",
|
|
2642
|
+
{
|
|
2643
|
+
style: {
|
|
2644
|
+
height: `${rowVirtualizer.getTotalSize()}px`,
|
|
2645
|
+
width: "100%",
|
|
2646
|
+
position: "relative"
|
|
2647
|
+
},
|
|
2648
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(List_default, { children: rowVirtualizer.getVirtualItems().map((virtualRow) => {
|
|
2649
|
+
const isLoaderRow = virtualRow.index > data.length - 1;
|
|
2650
|
+
const item = data[virtualRow.index];
|
|
2651
|
+
if (isLoaderRow) {
|
|
2652
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
2653
|
+
ListItem_default,
|
|
2654
|
+
{
|
|
2655
|
+
ref: rowVirtualizer.measureElement,
|
|
2656
|
+
title: virtual.hasNextPage ? "Loading..." : "Nothing more to load",
|
|
2657
|
+
style: {
|
|
2658
|
+
position: "absolute",
|
|
2659
|
+
top: 0,
|
|
2660
|
+
left: 0,
|
|
2661
|
+
width: "100%",
|
|
2662
|
+
height: `${virtualRow.size}px`,
|
|
2663
|
+
transform: `translateY(${virtualRow.start}px)`
|
|
2664
|
+
}
|
|
2665
|
+
},
|
|
2666
|
+
virtualRow.index
|
|
2667
|
+
);
|
|
2668
|
+
}
|
|
2669
|
+
if (!item) {
|
|
2670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
2671
|
+
ListItem_default,
|
|
2672
|
+
{
|
|
2673
|
+
ref: rowVirtualizer.measureElement,
|
|
2674
|
+
title: `Item ${virtualRow.index} not found`,
|
|
2675
|
+
style: {
|
|
2676
|
+
position: "absolute",
|
|
2677
|
+
top: 0,
|
|
2678
|
+
left: 0,
|
|
2679
|
+
width: "100%",
|
|
2680
|
+
height: `${virtualRow.size}px`,
|
|
2681
|
+
transform: `translateY(${virtualRow.start}px)`
|
|
2682
|
+
}
|
|
2683
|
+
},
|
|
2684
|
+
virtualRow.index
|
|
2685
|
+
);
|
|
2686
|
+
}
|
|
2687
|
+
if (renderItem) {
|
|
2688
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react58.Fragment, { children: renderItem(item, {
|
|
2689
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2690
|
+
// @ts-ignore
|
|
2691
|
+
ref: rowVirtualizer.measureElement,
|
|
2692
|
+
title: "",
|
|
2693
|
+
selected: values.includes(item[keyField]),
|
|
2694
|
+
hoverable: true,
|
|
2695
|
+
style: {
|
|
2696
|
+
position: "absolute",
|
|
2697
|
+
top: 0,
|
|
2698
|
+
left: 0,
|
|
2699
|
+
width: "100%",
|
|
2700
|
+
height: `${virtualRow.size}px`,
|
|
2701
|
+
transform: `translateY(${virtualRow.start}px)`
|
|
2702
|
+
},
|
|
2703
|
+
onClick: () => handleItemSelect(item)
|
|
2704
|
+
}) }, virtualRow.index);
|
|
2705
|
+
}
|
|
2706
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
2707
|
+
ListItem_default,
|
|
2708
|
+
{
|
|
2709
|
+
ref: rowVirtualizer.measureElement,
|
|
2710
|
+
title: item[textField2],
|
|
2711
|
+
selected: values.includes(item[keyField]),
|
|
2712
|
+
hoverable: true,
|
|
2713
|
+
style: {
|
|
2714
|
+
position: "absolute",
|
|
2715
|
+
top: 0,
|
|
2716
|
+
left: 0,
|
|
2717
|
+
width: "100%",
|
|
2718
|
+
height: `${virtualRow.size}px`,
|
|
2719
|
+
transform: `translateY(${virtualRow.start}px)`
|
|
2720
|
+
},
|
|
2721
|
+
onClick: () => handleItemSelect(item)
|
|
2722
|
+
},
|
|
2723
|
+
virtualRow.index
|
|
2724
|
+
);
|
|
2725
|
+
}) })
|
|
2726
|
+
}
|
|
2727
|
+
)
|
|
2728
|
+
}
|
|
2729
|
+
);
|
|
2730
|
+
};
|
|
2731
|
+
var ComboboxVirtual_default = ComboboxVirtual;
|
|
2732
|
+
|
|
2733
|
+
// src/components/Combobox/Combobox.tsx
|
|
2734
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
2735
|
+
var Combobox = (props) => {
|
|
2736
|
+
const {
|
|
2737
|
+
data,
|
|
2738
|
+
value: valueProp,
|
|
2739
|
+
keyField = "key",
|
|
2740
|
+
textField: textField2 = "text",
|
|
2741
|
+
isMultiple = false,
|
|
2742
|
+
disabled,
|
|
2743
|
+
loading,
|
|
2744
|
+
disclosure: disclosureProp,
|
|
2745
|
+
virtual,
|
|
2746
|
+
placeholder,
|
|
2747
|
+
style,
|
|
2748
|
+
onChange,
|
|
2749
|
+
onFilterChange,
|
|
2750
|
+
renderItem
|
|
2751
|
+
} = props;
|
|
2752
|
+
const disclosure = disclosureProp !== void 0 ? disclosureProp : useDisclosure_default();
|
|
2753
|
+
const prefixCls = PREFIX_CLS;
|
|
2754
|
+
const inputRef = (0, import_react59.useRef)(null);
|
|
2755
|
+
const [filter, setFilter] = (0, import_react59.useState)("");
|
|
2756
|
+
const [search, setSearch] = (0, import_react59.useState)("");
|
|
2757
|
+
const [isSearch, setIsSearch] = (0, import_react59.useState)(false);
|
|
2758
|
+
const values = (0, import_react59.useMemo)(() => {
|
|
2759
|
+
return valueToValues(valueProp);
|
|
2760
|
+
}, [valueProp]);
|
|
2761
|
+
const items = (0, import_react59.useMemo)(() => {
|
|
2762
|
+
return data.filter((item) => values.includes(item[keyField]));
|
|
2763
|
+
}, [data, values]);
|
|
2764
|
+
const [offset, setOffset] = (0, import_react59.useState)(0);
|
|
2765
|
+
const handleFocus = () => {
|
|
2766
|
+
};
|
|
2767
|
+
const handleChange = (values2) => {
|
|
2768
|
+
var _a, _b, _c, _d;
|
|
2769
|
+
if (props.isMultiple) {
|
|
2770
|
+
const items2 = data.filter((item) => values2.includes(item[keyField]));
|
|
2771
|
+
(_a = props.onChange) == null ? void 0 : _a.call(props, items2);
|
|
2772
|
+
(_b = props.onValueChange) == null ? void 0 : _b.call(props, values2);
|
|
2773
|
+
} else {
|
|
2774
|
+
const newValue = valuesToValue(values2);
|
|
2775
|
+
let item;
|
|
2776
|
+
if (newValue !== void 0) {
|
|
2777
|
+
item = data.find((item2) => item2[keyField] === newValue);
|
|
2778
|
+
}
|
|
2779
|
+
(_c = props.onChange) == null ? void 0 : _c.call(props, item);
|
|
2780
|
+
(_d = props.onValueChange) == null ? void 0 : _d.call(props, newValue);
|
|
2781
|
+
}
|
|
2782
|
+
};
|
|
2783
|
+
const handleClear = (event) => {
|
|
2784
|
+
event.stopPropagation();
|
|
2785
|
+
setIsSearch(true);
|
|
2786
|
+
setSearch("");
|
|
2787
|
+
onFilterChange == null ? void 0 : onFilterChange("");
|
|
2788
|
+
onChange == null ? void 0 : onChange(valuesToValue([]));
|
|
2789
|
+
setIsSearch(false);
|
|
2790
|
+
};
|
|
2791
|
+
const handleFilterChange = (event) => {
|
|
2792
|
+
!disclosure.isOpen && disclosure.onOpen();
|
|
2793
|
+
setIsSearch(true);
|
|
2794
|
+
setSearch(event.target.value);
|
|
2795
|
+
onFilterChange == null ? void 0 : onFilterChange(event.target.value);
|
|
2796
|
+
};
|
|
2797
|
+
const handleItemSelect = (item) => {
|
|
2798
|
+
var _a;
|
|
2799
|
+
const newValue = item[keyField];
|
|
2800
|
+
if (props.isMultiple) {
|
|
2801
|
+
const newValues = [...values];
|
|
2802
|
+
const valueIndex = values.indexOf(newValue);
|
|
2803
|
+
if (valueIndex === -1) {
|
|
2804
|
+
newValues.push(newValue);
|
|
2805
|
+
} else {
|
|
2806
|
+
newValues.splice(valueIndex, 1);
|
|
2807
|
+
}
|
|
2808
|
+
handleChange(newValues);
|
|
2809
|
+
} else {
|
|
2810
|
+
const value = valuesToValue(values);
|
|
2811
|
+
if (value !== newValue) {
|
|
2812
|
+
handleChange([newValue]);
|
|
2813
|
+
}
|
|
2814
|
+
}
|
|
2815
|
+
if (isSearch) {
|
|
2816
|
+
setFilter(search);
|
|
2817
|
+
}
|
|
2818
|
+
setIsSearch(false);
|
|
2819
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
2820
|
+
disclosure.onClose();
|
|
2821
|
+
};
|
|
2822
|
+
const handleClose = () => {
|
|
2823
|
+
disclosure.onClose();
|
|
2824
|
+
if (!props.isMultiple) {
|
|
2825
|
+
if (isSearch) {
|
|
2826
|
+
const item = items[0];
|
|
2827
|
+
if (item !== void 0) {
|
|
2828
|
+
setSearch(item[textField2]);
|
|
2829
|
+
onFilterChange == null ? void 0 : onFilterChange(filter);
|
|
2830
|
+
} else {
|
|
2831
|
+
setSearch("");
|
|
2832
|
+
onFilterChange == null ? void 0 : onFilterChange(filter);
|
|
2833
|
+
}
|
|
2834
|
+
setIsSearch(false);
|
|
2835
|
+
}
|
|
2836
|
+
}
|
|
2837
|
+
};
|
|
2838
|
+
(0, import_react59.useEffect)(() => {
|
|
2839
|
+
if (isSearch)
|
|
2840
|
+
return;
|
|
2841
|
+
if (!props.isMultiple) {
|
|
2842
|
+
const item = items[0];
|
|
2843
|
+
if (item !== void 0) {
|
|
2844
|
+
setSearch(item[textField2]);
|
|
2845
|
+
}
|
|
2846
|
+
}
|
|
2847
|
+
}, [items]);
|
|
2848
|
+
(0, import_react59.useEffect)(() => {
|
|
2849
|
+
const values2 = valueToValues(valueProp);
|
|
2850
|
+
const value = values2[0];
|
|
2851
|
+
if (value === void 0) {
|
|
2852
|
+
setSearch("");
|
|
2853
|
+
onFilterChange == null ? void 0 : onFilterChange("");
|
|
2854
|
+
}
|
|
2855
|
+
}, [valueProp]);
|
|
2856
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2857
|
+
ComboboxContext_default.Provider,
|
|
2858
|
+
{
|
|
2859
|
+
value: {
|
|
2860
|
+
data,
|
|
2861
|
+
values,
|
|
2862
|
+
keyField,
|
|
2863
|
+
textField: textField2,
|
|
2864
|
+
isMultiple,
|
|
2865
|
+
virtual,
|
|
2866
|
+
onChange: handleChange,
|
|
2867
|
+
onItemSelect: handleItemSelect,
|
|
2868
|
+
offset,
|
|
2869
|
+
setOffset,
|
|
2870
|
+
renderItem
|
|
2871
|
+
},
|
|
2872
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Popover_default, __spreadProps(__spreadValues({ target: true }, disclosure), { isOpen: disclosure.isOpen, onClose: handleClose, autoClose: "outside", children: [
|
|
2873
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PopoverTrigger_default, { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2874
|
+
TextInput_default,
|
|
2875
|
+
{
|
|
2876
|
+
inputRef,
|
|
2877
|
+
value: search,
|
|
2878
|
+
placeholder,
|
|
2879
|
+
endContent: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: `${prefixCls}d-flex ${prefixCls}items-center ${prefixCls}gap-1`, children: [
|
|
2880
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon_default, { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(LoaderIcon_default, { className: `${prefixCls}animation-spin` }) }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Button, { color: "secondary", variant: "plain", size: "xs", iconOnly: true, onClick: handleClear, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon_default, { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CloseIcon_default, {}) }) }),
|
|
2881
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { style: { pointerEvents: "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon_default, { children: disclosure.isOpen ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ChevronUpIcon_default, {}) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ChevronDownIcon_default, {}) }) })
|
|
2882
|
+
] }),
|
|
2883
|
+
disabled,
|
|
2884
|
+
style,
|
|
2885
|
+
onChange: handleFilterChange,
|
|
2886
|
+
onFocus: handleFocus
|
|
2887
|
+
}
|
|
2888
|
+
) }),
|
|
2889
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PopoverContent_default, { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { children: virtual ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ComboboxVirtual_default, {}) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ComboboxContent_default, {}) }) })
|
|
2890
|
+
] }))
|
|
2891
|
+
}
|
|
2892
|
+
);
|
|
2893
|
+
};
|
|
2894
|
+
var Combobox_default = Combobox;
|
|
2895
|
+
|
|
2896
|
+
// src/components/Field/Field.tsx
|
|
2897
|
+
var import_react60 = require("react");
|
|
2898
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
2899
|
+
var Field = (0, import_react60.forwardRef)(({ children, label }, ref) => {
|
|
2900
|
+
{
|
|
2901
|
+
const prefixCls = PREFIX_CLS;
|
|
2902
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { ref, className: clsx_default(`${prefixCls}field`), children: [
|
|
2903
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: `${prefixCls}field__label`, children: label }),
|
|
2904
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: `${prefixCls}field__content`, children })
|
|
2905
|
+
] });
|
|
2906
|
+
}
|
|
2907
|
+
});
|
|
2908
|
+
var Field_default = Field;
|
|
2236
2909
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2237
2910
|
0 && (module.exports = {
|
|
2238
2911
|
Accordion,
|
|
@@ -2250,6 +2923,7 @@ var ListGroup_default = ListGroup;
|
|
|
2250
2923
|
CollapseContent,
|
|
2251
2924
|
CollapseContext,
|
|
2252
2925
|
CollapseTrigger,
|
|
2926
|
+
Combobox,
|
|
2253
2927
|
Drawer,
|
|
2254
2928
|
Field,
|
|
2255
2929
|
Icon,
|
|
@@ -2262,22 +2936,31 @@ var ListGroup_default = ListGroup;
|
|
|
2262
2936
|
MenuItem,
|
|
2263
2937
|
MenuSubmenu,
|
|
2264
2938
|
MenuValueContext,
|
|
2265
|
-
MultiSelect,
|
|
2266
2939
|
Portal,
|
|
2940
|
+
QueryStatus,
|
|
2267
2941
|
ScrollArea,
|
|
2268
2942
|
Select,
|
|
2269
2943
|
Switch,
|
|
2270
2944
|
Tab,
|
|
2271
2945
|
Tabs,
|
|
2946
|
+
TextInput,
|
|
2272
2947
|
Toolbar,
|
|
2273
2948
|
Transition,
|
|
2949
|
+
assignRef,
|
|
2950
|
+
clsx,
|
|
2274
2951
|
getOpenValuesByPathname,
|
|
2952
|
+
mergeRefs,
|
|
2953
|
+
scrollToItem,
|
|
2275
2954
|
useAccordionItem,
|
|
2276
2955
|
useCollapse,
|
|
2956
|
+
useDebounce,
|
|
2277
2957
|
useDisclosure,
|
|
2958
|
+
useElementSize,
|
|
2959
|
+
useInfiniteQuery,
|
|
2278
2960
|
useLocalStorage,
|
|
2279
2961
|
useMenu,
|
|
2280
2962
|
useMenuItemValue,
|
|
2963
|
+
useOnClickOutside,
|
|
2281
2964
|
usePrevious,
|
|
2282
2965
|
useStep
|
|
2283
2966
|
});
|