@unifiedsoftware/react-ui 1.0.20 → 1.0.22
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 +14 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.js +299 -197
- package/dist/index.mjs +255 -157
- package/package.json +3 -2
package/dist/index.mjs
CHANGED
|
@@ -51,7 +51,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
// src/components/Autocomplete/Autocomplete.tsx
|
|
54
|
-
import { useEffect as
|
|
54
|
+
import { useEffect as useEffect15, useMemo as useMemo3, useRef as useRef11, useState as useState11 } from "react";
|
|
55
55
|
|
|
56
56
|
// src/constants/index.ts
|
|
57
57
|
var PREFIX_CLS = "us-";
|
|
@@ -383,6 +383,87 @@ function useElementSize(options) {
|
|
|
383
383
|
}
|
|
384
384
|
var useElementSize_default = useElementSize;
|
|
385
385
|
|
|
386
|
+
// src/hooks/useResizeObserver/useResizeObserver.ts
|
|
387
|
+
import { useEffect as useEffect9 } from "react";
|
|
388
|
+
function hasResizeObserver() {
|
|
389
|
+
return typeof window.ResizeObserver !== "undefined";
|
|
390
|
+
}
|
|
391
|
+
function useResizeObserver(options) {
|
|
392
|
+
const { ref, onResize } = options;
|
|
393
|
+
useEffect9(() => {
|
|
394
|
+
const element = ref == null ? void 0 : ref.current;
|
|
395
|
+
if (!element) {
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
if (!hasResizeObserver()) {
|
|
399
|
+
window.addEventListener("resize", onResize);
|
|
400
|
+
return () => {
|
|
401
|
+
window.removeEventListener("resize", onResize);
|
|
402
|
+
};
|
|
403
|
+
} else {
|
|
404
|
+
const resizeObserver = new window.ResizeObserver((entries) => {
|
|
405
|
+
if (!entries.length) {
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
onResize();
|
|
409
|
+
});
|
|
410
|
+
resizeObserver.observe(element);
|
|
411
|
+
return () => {
|
|
412
|
+
if (element) {
|
|
413
|
+
resizeObserver.unobserve(element);
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
}, [ref, onResize]);
|
|
418
|
+
}
|
|
419
|
+
var useResizeObserver_default = useResizeObserver;
|
|
420
|
+
|
|
421
|
+
// src/hooks/useEffectEvent/useEffectEvent.ts
|
|
422
|
+
import { useCallback as useCallback3, useLayoutEffect as useLayoutEffect2, useRef as useRef4 } from "react";
|
|
423
|
+
function useEffectEvent(fn) {
|
|
424
|
+
const ref = useRef4(null);
|
|
425
|
+
useLayoutEffect2(() => {
|
|
426
|
+
ref.current = fn;
|
|
427
|
+
}, [fn]);
|
|
428
|
+
return useCallback3((...args) => {
|
|
429
|
+
const f = ref.current;
|
|
430
|
+
return f(...args);
|
|
431
|
+
}, []);
|
|
432
|
+
}
|
|
433
|
+
var useEffectEvent_default = useEffectEvent;
|
|
434
|
+
|
|
435
|
+
// src/hooks/useValueEffect/useValueEffect.ts
|
|
436
|
+
import { useLayoutEffect as useLayoutEffect3, useRef as useRef5, useState as useState7 } from "react";
|
|
437
|
+
function useValueEffect(defaultValue) {
|
|
438
|
+
const [value, setValue] = useState7(defaultValue);
|
|
439
|
+
const effect = useRef5(null);
|
|
440
|
+
const nextRef = useEffectEvent_default(() => {
|
|
441
|
+
if (!effect.current)
|
|
442
|
+
return;
|
|
443
|
+
const newValue = effect.current.next();
|
|
444
|
+
if (newValue.done) {
|
|
445
|
+
effect.current = null;
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
if (value === newValue.value) {
|
|
449
|
+
nextRef();
|
|
450
|
+
} else {
|
|
451
|
+
setValue(newValue.value);
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
useLayoutEffect3(() => {
|
|
455
|
+
if (effect.current) {
|
|
456
|
+
nextRef();
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
const queue = useEffectEvent_default((fn) => {
|
|
460
|
+
effect.current = fn(value);
|
|
461
|
+
nextRef();
|
|
462
|
+
});
|
|
463
|
+
return [value, queue];
|
|
464
|
+
}
|
|
465
|
+
var useValueEffect_default = useValueEffect;
|
|
466
|
+
|
|
386
467
|
// src/icons/ChevronDownIcon.tsx
|
|
387
468
|
import { forwardRef } from "react";
|
|
388
469
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -659,7 +740,7 @@ var Button = forwardRef6(
|
|
|
659
740
|
);
|
|
660
741
|
|
|
661
742
|
// src/components/Popover/Popover.tsx
|
|
662
|
-
import { Children as Children2, cloneElement as cloneElement2, useEffect as
|
|
743
|
+
import { Children as Children2, cloneElement as cloneElement2, useEffect as useEffect10, useRef as useRef6, useState as useState8 } from "react";
|
|
663
744
|
|
|
664
745
|
// src/components/Portal/Portal.tsx
|
|
665
746
|
import { forwardRef as forwardRef7 } from "react";
|
|
@@ -738,9 +819,9 @@ var Popover = (props) => {
|
|
|
738
819
|
onToggle,
|
|
739
820
|
onAfterClose
|
|
740
821
|
} = props;
|
|
741
|
-
const triggerRef =
|
|
742
|
-
const contentRef =
|
|
743
|
-
const [internalOpen, setInternalOpen] =
|
|
822
|
+
const triggerRef = useRef6(null);
|
|
823
|
+
const contentRef = useRef6(null);
|
|
824
|
+
const [internalOpen, setInternalOpen] = useState8(props.isOpen || false);
|
|
744
825
|
const [trigger, content] = Children2.toArray(children);
|
|
745
826
|
const prefixCls = PREFIX_CLS;
|
|
746
827
|
const handleOpen = () => {
|
|
@@ -764,7 +845,7 @@ var Popover = (props) => {
|
|
|
764
845
|
setInternalOpen((prevState) => !prevState);
|
|
765
846
|
}
|
|
766
847
|
};
|
|
767
|
-
|
|
848
|
+
useEffect10(() => {
|
|
768
849
|
setInternalOpen(isOpen || false);
|
|
769
850
|
}, [isOpen]);
|
|
770
851
|
return /* @__PURE__ */ jsxs6(
|
|
@@ -805,8 +886,8 @@ var Popover = (props) => {
|
|
|
805
886
|
var Popover_default = Popover;
|
|
806
887
|
|
|
807
888
|
// src/components/Popover/PopoverContent.tsx
|
|
808
|
-
import { forwardRef as forwardRef9, useCallback as
|
|
809
|
-
import { jsx as jsx9
|
|
889
|
+
import { forwardRef as forwardRef9, useCallback as useCallback4, useEffect as useEffect11, useRef as useRef7, useState as useState9 } from "react";
|
|
890
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
810
891
|
function getScrollParent(node) {
|
|
811
892
|
if (node == null) {
|
|
812
893
|
return null;
|
|
@@ -821,8 +902,8 @@ var PopoverContent = forwardRef9((props, ref) => {
|
|
|
821
902
|
const _a = props, { children, style, className, onClick } = _a, rest = __objRest(_a, ["children", "style", "className", "onClick"]);
|
|
822
903
|
const { triggerRef, contentRef, target, onClose } = usePopover();
|
|
823
904
|
const prefixCls = PREFIX_CLS;
|
|
824
|
-
const menuListRef =
|
|
825
|
-
const [contentStyle, setContentStyle] =
|
|
905
|
+
const menuListRef = useRef7(null);
|
|
906
|
+
const [contentStyle, setContentStyle] = useState9({
|
|
826
907
|
position: "absolute",
|
|
827
908
|
top: 0,
|
|
828
909
|
left: 0,
|
|
@@ -845,7 +926,7 @@ var PopoverContent = forwardRef9((props, ref) => {
|
|
|
845
926
|
ev.stopPropagation();
|
|
846
927
|
onClick == null ? void 0 : onClick(ev);
|
|
847
928
|
};
|
|
848
|
-
const handleSize =
|
|
929
|
+
const handleSize = useCallback4(() => {
|
|
849
930
|
var _a2, _b;
|
|
850
931
|
const popoverRect = (_a2 = contentRef.current) == null ? void 0 : _a2.getBoundingClientRect();
|
|
851
932
|
const triggerClientRect = (_b = triggerRef.current) == null ? void 0 : _b.getBoundingClientRect();
|
|
@@ -876,7 +957,7 @@ var PopoverContent = forwardRef9((props, ref) => {
|
|
|
876
957
|
});
|
|
877
958
|
setContentStyle(style2);
|
|
878
959
|
}, []);
|
|
879
|
-
|
|
960
|
+
useEffect11(() => {
|
|
880
961
|
handleSize();
|
|
881
962
|
containerEl.addEventListener("scroll", handleSize);
|
|
882
963
|
window.addEventListener("orientationchange", handleSize);
|
|
@@ -885,7 +966,7 @@ var PopoverContent = forwardRef9((props, ref) => {
|
|
|
885
966
|
window.removeEventListener("orientationchange", handleSize);
|
|
886
967
|
};
|
|
887
968
|
}, []);
|
|
888
|
-
return /* @__PURE__ */
|
|
969
|
+
return /* @__PURE__ */ jsx9(
|
|
889
970
|
"div",
|
|
890
971
|
__spreadProps(__spreadValues({
|
|
891
972
|
ref: mergeRefs_default(menuListRef, ref),
|
|
@@ -893,10 +974,7 @@ var PopoverContent = forwardRef9((props, ref) => {
|
|
|
893
974
|
style: __spreadValues(__spreadValues({}, style), contentStyle),
|
|
894
975
|
onClick: handleClick
|
|
895
976
|
}, rest), {
|
|
896
|
-
children
|
|
897
|
-
/* @__PURE__ */ jsx9("div", { className: `${prefixCls}popover__overlay` }),
|
|
898
|
-
children
|
|
899
|
-
]
|
|
977
|
+
children
|
|
900
978
|
})
|
|
901
979
|
);
|
|
902
980
|
});
|
|
@@ -923,7 +1001,7 @@ var PopoverTrigger = forwardRef10((props, ref) => {
|
|
|
923
1001
|
var PopoverTrigger_default = PopoverTrigger;
|
|
924
1002
|
|
|
925
1003
|
// src/components/Autocomplete/AutocompleteContent.tsx
|
|
926
|
-
import { Fragment as
|
|
1004
|
+
import { Fragment as Fragment3, useEffect as useEffect13, useRef as useRef9 } from "react";
|
|
927
1005
|
|
|
928
1006
|
// src/components/List/List.tsx
|
|
929
1007
|
import { forwardRef as forwardRef11 } from "react";
|
|
@@ -939,7 +1017,7 @@ var List_default = List;
|
|
|
939
1017
|
import { forwardRef as forwardRef15 } from "react";
|
|
940
1018
|
|
|
941
1019
|
// src/components/Collapse/Collapse.tsx
|
|
942
|
-
import { Children as Children4, useEffect as
|
|
1020
|
+
import { Children as Children4, useEffect as useEffect12, useRef as useRef8, useState as useState10 } from "react";
|
|
943
1021
|
|
|
944
1022
|
// src/components/Collapse/CollapseContext.tsx
|
|
945
1023
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
@@ -954,11 +1032,11 @@ var useCollapse = () => {
|
|
|
954
1032
|
var CollapseContext_default = CollapseContext;
|
|
955
1033
|
|
|
956
1034
|
// src/components/Collapse/Collapse.tsx
|
|
957
|
-
import { jsxs as
|
|
1035
|
+
import { jsxs as jsxs7 } from "react/jsx-runtime";
|
|
958
1036
|
var Collapse = ({ children, isOpen, onOpen, onClose, onToggle }) => {
|
|
959
|
-
const collapseRef =
|
|
960
|
-
const [selfIsOpen, setSelfIsOpen] =
|
|
961
|
-
const [heightAuto, setHeightAuto] =
|
|
1037
|
+
const collapseRef = useRef8(null);
|
|
1038
|
+
const [selfIsOpen, setSelfIsOpen] = useState10(isOpen != null ? isOpen : false);
|
|
1039
|
+
const [heightAuto, setHeightAuto] = useState10(false);
|
|
962
1040
|
const [trigger, content] = Children4.toArray(children);
|
|
963
1041
|
const handleOpen = () => {
|
|
964
1042
|
setSelfIsOpen(true);
|
|
@@ -972,7 +1050,7 @@ var Collapse = ({ children, isOpen, onOpen, onClose, onToggle }) => {
|
|
|
972
1050
|
setSelfIsOpen((prevState) => !prevState);
|
|
973
1051
|
onToggle == null ? void 0 : onToggle();
|
|
974
1052
|
};
|
|
975
|
-
|
|
1053
|
+
useEffect12(() => {
|
|
976
1054
|
if (isOpen !== void 0) {
|
|
977
1055
|
setSelfIsOpen(isOpen);
|
|
978
1056
|
}
|
|
@@ -984,7 +1062,7 @@ var Collapse = ({ children, isOpen, onOpen, onClose, onToggle }) => {
|
|
|
984
1062
|
}
|
|
985
1063
|
}, 100);
|
|
986
1064
|
}, [isOpen]);
|
|
987
|
-
return /* @__PURE__ */
|
|
1065
|
+
return /* @__PURE__ */ jsxs7(
|
|
988
1066
|
CollapseContext_default.Provider,
|
|
989
1067
|
{
|
|
990
1068
|
value: {
|
|
@@ -1047,11 +1125,12 @@ var CollapseTrigger_default = CollapseTrigger;
|
|
|
1047
1125
|
|
|
1048
1126
|
// src/components/List/ListItem.tsx
|
|
1049
1127
|
import { forwardRef as forwardRef14 } from "react";
|
|
1050
|
-
import { jsx as jsx11, jsxs as
|
|
1128
|
+
import { Fragment, jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1051
1129
|
var ListItem = forwardRef14(
|
|
1052
1130
|
(_a, ref) => {
|
|
1053
1131
|
var _b = _a, {
|
|
1054
1132
|
as: Component = "div",
|
|
1133
|
+
children,
|
|
1055
1134
|
className,
|
|
1056
1135
|
title,
|
|
1057
1136
|
subtitle,
|
|
@@ -1066,6 +1145,7 @@ var ListItem = forwardRef14(
|
|
|
1066
1145
|
onClick
|
|
1067
1146
|
} = _b, rest = __objRest(_b, [
|
|
1068
1147
|
"as",
|
|
1148
|
+
"children",
|
|
1069
1149
|
"className",
|
|
1070
1150
|
"title",
|
|
1071
1151
|
"subtitle",
|
|
@@ -1084,7 +1164,7 @@ var ListItem = forwardRef14(
|
|
|
1084
1164
|
const handleClick = (event) => {
|
|
1085
1165
|
onClick == null ? void 0 : onClick(event);
|
|
1086
1166
|
};
|
|
1087
|
-
return /* @__PURE__ */
|
|
1167
|
+
return /* @__PURE__ */ jsxs8(
|
|
1088
1168
|
Component,
|
|
1089
1169
|
__spreadProps(__spreadValues({
|
|
1090
1170
|
ref,
|
|
@@ -1105,7 +1185,7 @@ var ListItem = forwardRef14(
|
|
|
1105
1185
|
children: [
|
|
1106
1186
|
hoverable && /* @__PURE__ */ jsx11("div", { className: `${prefixCls}overlay` }),
|
|
1107
1187
|
startContent && /* @__PURE__ */ jsx11("div", { className: `${prefixCls}list-item__start-content`, children: startContent }),
|
|
1108
|
-
/* @__PURE__ */
|
|
1188
|
+
/* @__PURE__ */ jsx11("div", { className: `${prefixCls}list-item__content`, children: title || subtitle ? /* @__PURE__ */ jsxs8(Fragment, { children: [
|
|
1109
1189
|
/* @__PURE__ */ jsx11("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 })),
|
|
1110
1190
|
/* @__PURE__ */ jsx11(
|
|
1111
1191
|
"span",
|
|
@@ -1114,7 +1194,7 @@ var ListItem = forwardRef14(
|
|
|
1114
1194
|
children: subtitle
|
|
1115
1195
|
})
|
|
1116
1196
|
)
|
|
1117
|
-
] }),
|
|
1197
|
+
] }) : children }),
|
|
1118
1198
|
endContent && /* @__PURE__ */ jsx11("div", { className: `${prefixCls}list-item__end-content`, children: endContent })
|
|
1119
1199
|
]
|
|
1120
1200
|
})
|
|
@@ -1124,7 +1204,7 @@ var ListItem = forwardRef14(
|
|
|
1124
1204
|
var ListItem_default = ListItem;
|
|
1125
1205
|
|
|
1126
1206
|
// src/components/List/ListGroup.tsx
|
|
1127
|
-
import { Fragment, jsx as jsx12, jsxs as
|
|
1207
|
+
import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1128
1208
|
var ListGroup = forwardRef15(
|
|
1129
1209
|
(_a, ref) => {
|
|
1130
1210
|
var _b = _a, {
|
|
@@ -1150,16 +1230,16 @@ var ListGroup = forwardRef15(
|
|
|
1150
1230
|
]);
|
|
1151
1231
|
const disclosure = isOpen !== void 0 ? { isOpen, onOpen, onClose, onToggle } : useDisclosure_default();
|
|
1152
1232
|
const prefixCls = PREFIX_CLS;
|
|
1153
|
-
return /* @__PURE__ */ jsx12("div", { className: `${prefixCls}list-group`, children: /* @__PURE__ */
|
|
1233
|
+
return /* @__PURE__ */ jsx12("div", { className: `${prefixCls}list-group`, children: /* @__PURE__ */ jsxs9(Collapse_default, __spreadProps(__spreadValues({}, disclosure), { children: [
|
|
1154
1234
|
/* @__PURE__ */ jsx12(CollapseTrigger_default, { children: /* @__PURE__ */ jsx12(
|
|
1155
1235
|
ListItem_default,
|
|
1156
1236
|
__spreadValues({
|
|
1157
1237
|
ref,
|
|
1158
|
-
startContent: expandVisible && expandPosition === "start" ? /* @__PURE__ */
|
|
1238
|
+
startContent: expandVisible && expandPosition === "start" ? /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
1159
1239
|
/* @__PURE__ */ jsx12(Icon_default, { children: disclosure.isOpen ? /* @__PURE__ */ jsx12(ChevronUpIcon_default, {}) : /* @__PURE__ */ jsx12(ChevronDownIcon_default, {}) }),
|
|
1160
1240
|
startContent
|
|
1161
1241
|
] }) : startContent,
|
|
1162
|
-
endContent: expandVisible && expandPosition === "end" ? /* @__PURE__ */
|
|
1242
|
+
endContent: expandVisible && expandPosition === "end" ? /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
1163
1243
|
endContent,
|
|
1164
1244
|
/* @__PURE__ */ jsx12(Icon_default, { children: disclosure.isOpen ? /* @__PURE__ */ jsx12(ChevronUpIcon_default, {}) : /* @__PURE__ */ jsx12(ChevronDownIcon_default, {}) })
|
|
1165
1245
|
] }) : endContent
|
|
@@ -1248,14 +1328,14 @@ var AutocompleteContext_default = AutocompleteContext;
|
|
|
1248
1328
|
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1249
1329
|
var AutocompleteContent = () => {
|
|
1250
1330
|
const { data, values, offset, setOffset, keyField, textField, onItemSelect, renderItem } = useAutocomplete();
|
|
1251
|
-
const parentRef =
|
|
1331
|
+
const parentRef = useRef9(null);
|
|
1252
1332
|
const { isOpen } = usePopover();
|
|
1253
1333
|
const handleItemSelect = (item) => {
|
|
1254
1334
|
var _a;
|
|
1255
1335
|
onItemSelect(item);
|
|
1256
1336
|
setOffset(((_a = parentRef.current) == null ? void 0 : _a.scrollHeight) || 0);
|
|
1257
1337
|
};
|
|
1258
|
-
|
|
1338
|
+
useEffect13(() => {
|
|
1259
1339
|
var _a;
|
|
1260
1340
|
if (!isOpen)
|
|
1261
1341
|
return;
|
|
@@ -1270,7 +1350,7 @@ var AutocompleteContent = () => {
|
|
|
1270
1350
|
width: `100%`,
|
|
1271
1351
|
position: "relative"
|
|
1272
1352
|
},
|
|
1273
|
-
children: /* @__PURE__ */ jsx14(List_default, { children: renderItem ? data.map((item) => /* @__PURE__ */ jsx14(
|
|
1353
|
+
children: /* @__PURE__ */ jsx14(List_default, { children: renderItem ? data.map((item) => /* @__PURE__ */ jsx14(Fragment3, { children: renderItem(item, {
|
|
1274
1354
|
title: "",
|
|
1275
1355
|
selected: values.includes(item[keyField]),
|
|
1276
1356
|
hoverable: true,
|
|
@@ -1291,7 +1371,7 @@ var AutocompleteContent = () => {
|
|
|
1291
1371
|
var AutocompleteContent_default = AutocompleteContent;
|
|
1292
1372
|
|
|
1293
1373
|
// src/components/Autocomplete/AutocompleteVirtual.tsx
|
|
1294
|
-
import { Fragment as
|
|
1374
|
+
import { Fragment as Fragment4, useEffect as useEffect14, useRef as useRef10 } from "react";
|
|
1295
1375
|
|
|
1296
1376
|
// src/components/Autocomplete/utils.ts
|
|
1297
1377
|
var valueToValues = (value) => {
|
|
@@ -1305,18 +1385,20 @@ var valuesToValue = (values) => {
|
|
|
1305
1385
|
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1306
1386
|
var AutocompleteVirtual = () => {
|
|
1307
1387
|
const { data, values, keyField, textField, virtual, onItemSelect, renderItem } = useAutocomplete();
|
|
1308
|
-
const parentRef =
|
|
1388
|
+
const parentRef = useRef10(null);
|
|
1309
1389
|
const virtualizer = useVirtualizer_default(__spreadProps(__spreadValues({}, virtual), { count: data.length, parentRef }));
|
|
1310
1390
|
const { isOpen } = usePopover();
|
|
1311
1391
|
const handleItemSelect = (item) => {
|
|
1312
1392
|
onItemSelect(item);
|
|
1313
1393
|
};
|
|
1314
|
-
|
|
1394
|
+
useEffect14(() => {
|
|
1315
1395
|
if (!isOpen)
|
|
1316
1396
|
return;
|
|
1317
1397
|
const value = valuesToValue(values);
|
|
1318
1398
|
const index = data.findIndex((item) => item[keyField] === value);
|
|
1319
|
-
|
|
1399
|
+
if (index !== -1) {
|
|
1400
|
+
virtualizer.scrollToIndex(index, { align: "start" });
|
|
1401
|
+
}
|
|
1320
1402
|
}, [isOpen]);
|
|
1321
1403
|
if (!virtual)
|
|
1322
1404
|
return null;
|
|
@@ -1376,7 +1458,7 @@ var AutocompleteVirtual = () => {
|
|
|
1376
1458
|
);
|
|
1377
1459
|
}
|
|
1378
1460
|
if (renderItem) {
|
|
1379
|
-
return /* @__PURE__ */ jsx15(
|
|
1461
|
+
return /* @__PURE__ */ jsx15(Fragment4, { children: renderItem(item, {
|
|
1380
1462
|
title: "",
|
|
1381
1463
|
selected: values.includes(item[keyField]),
|
|
1382
1464
|
hoverable: true,
|
|
@@ -1418,7 +1500,7 @@ var AutocompleteVirtual = () => {
|
|
|
1418
1500
|
var AutocompleteVirtual_default = AutocompleteVirtual;
|
|
1419
1501
|
|
|
1420
1502
|
// src/components/Autocomplete/Autocomplete.tsx
|
|
1421
|
-
import { jsx as jsx16, jsxs as
|
|
1503
|
+
import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1422
1504
|
var Autocomplete = (props) => {
|
|
1423
1505
|
const {
|
|
1424
1506
|
data,
|
|
@@ -1431,6 +1513,7 @@ var Autocomplete = (props) => {
|
|
|
1431
1513
|
disclosure: disclosureProp,
|
|
1432
1514
|
virtual,
|
|
1433
1515
|
placeholder,
|
|
1516
|
+
className,
|
|
1434
1517
|
style,
|
|
1435
1518
|
startContent,
|
|
1436
1519
|
endContent,
|
|
@@ -1439,18 +1522,18 @@ var Autocomplete = (props) => {
|
|
|
1439
1522
|
} = props;
|
|
1440
1523
|
const disclosure = disclosureProp !== void 0 ? disclosureProp : useDisclosure_default();
|
|
1441
1524
|
const prefixCls = PREFIX_CLS;
|
|
1442
|
-
const inputRef =
|
|
1443
|
-
const [filter, setFilter] =
|
|
1444
|
-
const [search, setSearch] =
|
|
1445
|
-
const [isSearch, setIsSearch] =
|
|
1446
|
-
const [focus, setFocus] =
|
|
1525
|
+
const inputRef = useRef11(null);
|
|
1526
|
+
const [filter, setFilter] = useState11("");
|
|
1527
|
+
const [search, setSearch] = useState11("");
|
|
1528
|
+
const [isSearch, setIsSearch] = useState11(false);
|
|
1529
|
+
const [focus, setFocus] = useState11(false);
|
|
1447
1530
|
const values = useMemo3(() => {
|
|
1448
1531
|
return valueToValues(valueProp);
|
|
1449
1532
|
}, [valueProp]);
|
|
1450
1533
|
const items = useMemo3(() => {
|
|
1451
1534
|
return data.filter((item) => values.includes(item[keyField]));
|
|
1452
1535
|
}, [data, values]);
|
|
1453
|
-
const [offset, setOffset] =
|
|
1536
|
+
const [offset, setOffset] = useState11(0);
|
|
1454
1537
|
const handleClick = () => {
|
|
1455
1538
|
var _a;
|
|
1456
1539
|
(_a = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _a.focus();
|
|
@@ -1536,7 +1619,7 @@ var Autocomplete = (props) => {
|
|
|
1536
1619
|
}
|
|
1537
1620
|
}
|
|
1538
1621
|
};
|
|
1539
|
-
|
|
1622
|
+
useEffect15(() => {
|
|
1540
1623
|
if (isSearch)
|
|
1541
1624
|
return;
|
|
1542
1625
|
if (!props.isMultiple) {
|
|
@@ -1546,7 +1629,7 @@ var Autocomplete = (props) => {
|
|
|
1546
1629
|
}
|
|
1547
1630
|
}
|
|
1548
1631
|
}, [items]);
|
|
1549
|
-
|
|
1632
|
+
useEffect15(() => {
|
|
1550
1633
|
const values2 = valueToValues(valueProp);
|
|
1551
1634
|
const value = values2[0];
|
|
1552
1635
|
if (value === void 0) {
|
|
@@ -1570,7 +1653,7 @@ var Autocomplete = (props) => {
|
|
|
1570
1653
|
setOffset,
|
|
1571
1654
|
renderItem
|
|
1572
1655
|
},
|
|
1573
|
-
children: /* @__PURE__ */
|
|
1656
|
+
children: /* @__PURE__ */ jsxs10(
|
|
1574
1657
|
Popover_default,
|
|
1575
1658
|
__spreadProps(__spreadValues({
|
|
1576
1659
|
target: true
|
|
@@ -1580,13 +1663,17 @@ var Autocomplete = (props) => {
|
|
|
1580
1663
|
onClose: handleClose,
|
|
1581
1664
|
autoClose: "outside",
|
|
1582
1665
|
children: [
|
|
1583
|
-
/* @__PURE__ */ jsx16(PopoverTrigger_default, { children: /* @__PURE__ */
|
|
1666
|
+
/* @__PURE__ */ jsx16(PopoverTrigger_default, { children: /* @__PURE__ */ jsxs10(
|
|
1584
1667
|
"div",
|
|
1585
1668
|
{
|
|
1586
|
-
className: clsx_default(
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1669
|
+
className: clsx_default(
|
|
1670
|
+
`${prefixCls}input ${prefixCls}input--filterable`,
|
|
1671
|
+
{
|
|
1672
|
+
[`${prefixCls}input--focus`]: focus,
|
|
1673
|
+
[`${prefixCls}input--disabled`]: disabled
|
|
1674
|
+
},
|
|
1675
|
+
className
|
|
1676
|
+
),
|
|
1590
1677
|
style,
|
|
1591
1678
|
onClick: handleClick,
|
|
1592
1679
|
onFocus: () => {
|
|
@@ -1597,7 +1684,7 @@ var Autocomplete = (props) => {
|
|
|
1597
1684
|
},
|
|
1598
1685
|
children: [
|
|
1599
1686
|
/* @__PURE__ */ jsx16("div", { className: `${prefixCls}outline` }),
|
|
1600
|
-
/* @__PURE__ */
|
|
1687
|
+
/* @__PURE__ */ jsxs10("div", { className: `${prefixCls}input__content`, children: [
|
|
1601
1688
|
startContent && /* @__PURE__ */ jsx16("div", { className: `${prefixCls}input__start-content`, children: startContent }),
|
|
1602
1689
|
/* @__PURE__ */ jsx16(
|
|
1603
1690
|
"input",
|
|
@@ -1610,7 +1697,7 @@ var Autocomplete = (props) => {
|
|
|
1610
1697
|
onChange: handleFilterChange
|
|
1611
1698
|
}
|
|
1612
1699
|
),
|
|
1613
|
-
/* @__PURE__ */
|
|
1700
|
+
/* @__PURE__ */ jsxs10("div", { className: `${prefixCls}input__end-content`, children: [
|
|
1614
1701
|
endContent,
|
|
1615
1702
|
loading ? /* @__PURE__ */ jsx16(Icon_default, { children: /* @__PURE__ */ jsx16(LoaderIcon_default, { className: `${prefixCls}animation-spin` }) }) : /* @__PURE__ */ jsx16(Button, { color: "secondary", variant: "plain", size: "xs", iconOnly: true, onClick: handleClear, children: /* @__PURE__ */ jsx16(Icon_default, { children: /* @__PURE__ */ jsx16(CloseIcon_default, {}) }) }),
|
|
1616
1703
|
/* @__PURE__ */ jsx16("div", { style: { pointerEvents: "none" }, children: /* @__PURE__ */ jsx16(Icon_default, { children: disclosure.isOpen ? /* @__PURE__ */ jsx16(ChevronUpIcon_default, {}) : /* @__PURE__ */ jsx16(ChevronDownIcon_default, {}) }) })
|
|
@@ -1630,12 +1717,12 @@ var Autocomplete_default = Autocomplete;
|
|
|
1630
1717
|
|
|
1631
1718
|
// src/components/Backdrop/Backdrop.tsx
|
|
1632
1719
|
import clsx6 from "clsx";
|
|
1633
|
-
import { forwardRef as forwardRef17, useRef as
|
|
1720
|
+
import { forwardRef as forwardRef17, useRef as useRef12 } from "react";
|
|
1634
1721
|
import { mergeRefs as mergeRefs2 } from "react-merge-refs";
|
|
1635
|
-
import { jsx as jsx17, jsxs as
|
|
1722
|
+
import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1636
1723
|
var Backdrop = forwardRef17((props, ref) => {
|
|
1637
1724
|
const _a = props, { children, className, isOpen, onClose } = _a, rest = __objRest(_a, ["children", "className", "isOpen", "onClose"]);
|
|
1638
|
-
const nodeRef =
|
|
1725
|
+
const nodeRef = useRef12(null);
|
|
1639
1726
|
return /* @__PURE__ */ jsx17(
|
|
1640
1727
|
Transition_default,
|
|
1641
1728
|
{
|
|
@@ -1646,7 +1733,7 @@ var Backdrop = forwardRef17((props, ref) => {
|
|
|
1646
1733
|
leave: 300,
|
|
1647
1734
|
mountOnEnter: true,
|
|
1648
1735
|
unmountOnExit: true,
|
|
1649
|
-
children: /* @__PURE__ */ jsx17(Portal_default, { children: /* @__PURE__ */
|
|
1736
|
+
children: /* @__PURE__ */ jsx17(Portal_default, { children: /* @__PURE__ */ jsxs11(
|
|
1650
1737
|
"div",
|
|
1651
1738
|
__spreadProps(__spreadValues({
|
|
1652
1739
|
ref: mergeRefs2([ref, nodeRef]),
|
|
@@ -1666,9 +1753,9 @@ var Backdrop_default = Backdrop;
|
|
|
1666
1753
|
|
|
1667
1754
|
// src/components/Badge/Badge.tsx
|
|
1668
1755
|
import clsx7 from "clsx";
|
|
1669
|
-
import { jsx as jsx18, jsxs as
|
|
1756
|
+
import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1670
1757
|
var Badge = ({ children, placement, content }) => {
|
|
1671
|
-
return /* @__PURE__ */
|
|
1758
|
+
return /* @__PURE__ */ jsxs12("div", { className: clsx7(`${PREFIX_CLS}badge-wrapper`), children: [
|
|
1672
1759
|
children,
|
|
1673
1760
|
/* @__PURE__ */ jsx18(
|
|
1674
1761
|
"div",
|
|
@@ -1695,14 +1782,14 @@ var Card_default = Card;
|
|
|
1695
1782
|
|
|
1696
1783
|
// src/components/Card/CardHeader.tsx
|
|
1697
1784
|
import { forwardRef as forwardRef19 } from "react";
|
|
1698
|
-
import { jsx as jsx20, jsxs as
|
|
1785
|
+
import { jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1699
1786
|
var CardHeader = forwardRef19(
|
|
1700
1787
|
(_a, ref) => {
|
|
1701
1788
|
var _b = _a, { as: Component = "div", className, title, subtitle, startContent, endContent } = _b, rest = __objRest(_b, ["as", "className", "title", "subtitle", "startContent", "endContent"]);
|
|
1702
1789
|
const prefixCls = PREFIX_CLS;
|
|
1703
|
-
return /* @__PURE__ */
|
|
1790
|
+
return /* @__PURE__ */ jsxs13(Component, __spreadProps(__spreadValues({ ref, className: clsx_default(`${prefixCls}card-header`, className) }, rest), { children: [
|
|
1704
1791
|
startContent && /* @__PURE__ */ jsx20("div", { className: `${prefixCls}card-header__start-content`, children: startContent }),
|
|
1705
|
-
/* @__PURE__ */
|
|
1792
|
+
/* @__PURE__ */ jsxs13("div", { className: `${prefixCls}card-header__content`, children: [
|
|
1706
1793
|
/* @__PURE__ */ jsx20("div", { className: `${prefixCls}card-header__title`, children: title }),
|
|
1707
1794
|
subtitle && /* @__PURE__ */ jsx20("div", { className: `${prefixCls}card-header__subtitle`, children: subtitle })
|
|
1708
1795
|
] }),
|
|
@@ -1715,11 +1802,11 @@ var CardHeader_default = CardHeader;
|
|
|
1715
1802
|
// src/components/Chip/Chip.tsx
|
|
1716
1803
|
import clsx8 from "clsx";
|
|
1717
1804
|
import { forwardRef as forwardRef20 } from "react";
|
|
1718
|
-
import { jsx as jsx21, jsxs as
|
|
1805
|
+
import { jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1719
1806
|
var Chip = forwardRef20(
|
|
1720
1807
|
(_a, ref) => {
|
|
1721
1808
|
var _b = _a, { as: Component = "div", children, className, variant = "text", color = "primary", size = "md" } = _b, rest = __objRest(_b, ["as", "children", "className", "variant", "color", "size"]);
|
|
1722
|
-
return /* @__PURE__ */
|
|
1809
|
+
return /* @__PURE__ */ jsxs14(
|
|
1723
1810
|
Component,
|
|
1724
1811
|
__spreadProps(__spreadValues({
|
|
1725
1812
|
ref,
|
|
@@ -1746,16 +1833,16 @@ var Chip_default = Chip;
|
|
|
1746
1833
|
|
|
1747
1834
|
// src/components/Drawer/Drawer.tsx
|
|
1748
1835
|
import clsx9 from "clsx";
|
|
1749
|
-
import { forwardRef as forwardRef21, useRef as
|
|
1836
|
+
import { forwardRef as forwardRef21, useRef as useRef13 } from "react";
|
|
1750
1837
|
import { mergeRefs as mergeRefs3 } from "react-merge-refs";
|
|
1751
|
-
import { jsx as jsx22, jsxs as
|
|
1838
|
+
import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1752
1839
|
var Drawer = forwardRef21((props, ref) => {
|
|
1753
1840
|
const { children, className, isOpen, size = "md", position = "left", onClose } = props;
|
|
1754
|
-
const nodeRef =
|
|
1841
|
+
const nodeRef = useRef13(null);
|
|
1755
1842
|
const handleClose = () => {
|
|
1756
1843
|
onClose();
|
|
1757
1844
|
};
|
|
1758
|
-
return /* @__PURE__ */ jsx22(Backdrop_default, { isOpen, onClose: handleClose, children: /* @__PURE__ */ jsx22(Transition_default, { nodeRef, isOpen, name: `${PREFIX_CLS}drawer`, enter: 600, leave: 300, unmountOnExit: true, children: /* @__PURE__ */
|
|
1845
|
+
return /* @__PURE__ */ jsx22(Backdrop_default, { isOpen, onClose: handleClose, children: /* @__PURE__ */ jsx22(Transition_default, { nodeRef, isOpen, name: `${PREFIX_CLS}drawer`, enter: 600, leave: 300, unmountOnExit: true, children: /* @__PURE__ */ jsxs15(
|
|
1759
1846
|
"div",
|
|
1760
1847
|
{
|
|
1761
1848
|
ref: mergeRefs3([ref, nodeRef]),
|
|
@@ -1778,7 +1865,7 @@ var Drawer_default = Drawer;
|
|
|
1778
1865
|
|
|
1779
1866
|
// src/components/Menu/Menu.tsx
|
|
1780
1867
|
import clsx13 from "clsx";
|
|
1781
|
-
import { useEffect as
|
|
1868
|
+
import { useEffect as useEffect17, useMemo as useMemo6, useState as useState12 } from "react";
|
|
1782
1869
|
|
|
1783
1870
|
// src/components/Menu/MenuContext.tsx
|
|
1784
1871
|
import { createContext as createContext4, useContext as useContext4 } from "react";
|
|
@@ -1798,7 +1885,7 @@ import { useMemo as useMemo5 } from "react";
|
|
|
1798
1885
|
|
|
1799
1886
|
// src/components/Menu/MenuItem.tsx
|
|
1800
1887
|
import clsx10 from "clsx";
|
|
1801
|
-
import { forwardRef as forwardRef22, useContext as useContext6, useEffect as
|
|
1888
|
+
import { forwardRef as forwardRef22, useContext as useContext6, useEffect as useEffect16 } from "react";
|
|
1802
1889
|
|
|
1803
1890
|
// src/components/Menu/MenuValueContext.tsx
|
|
1804
1891
|
import { createContext as createContext5, useContext as useContext5 } from "react";
|
|
@@ -1813,7 +1900,7 @@ var useMenuItemValue = () => {
|
|
|
1813
1900
|
var MenuValueContext_default = MenuValueContext;
|
|
1814
1901
|
|
|
1815
1902
|
// src/components/Menu/MenuItem.tsx
|
|
1816
|
-
import { jsx as jsx23, jsxs as
|
|
1903
|
+
import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1817
1904
|
var MenuItem = forwardRef22((props, ref) => {
|
|
1818
1905
|
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"]);
|
|
1819
1906
|
const { value: menuValue, originalValue, navMode, onChange, onOpen, onItemSelect } = useMenu();
|
|
@@ -1827,13 +1914,13 @@ var MenuItem = forwardRef22((props, ref) => {
|
|
|
1827
1914
|
onClick == null ? void 0 : onClick(event);
|
|
1828
1915
|
onItemSelect == null ? void 0 : onItemSelect(props);
|
|
1829
1916
|
};
|
|
1830
|
-
|
|
1917
|
+
useEffect16(() => {
|
|
1831
1918
|
if (navMode === "automatic" && originalValue.length > 0 && originalValue[originalValue.length - 1] === value) {
|
|
1832
1919
|
onOpen(values);
|
|
1833
1920
|
onChange(mergedValues);
|
|
1834
1921
|
}
|
|
1835
1922
|
}, [value, originalValue, navMode]);
|
|
1836
|
-
return /* @__PURE__ */
|
|
1923
|
+
return /* @__PURE__ */ jsxs16(
|
|
1837
1924
|
Component,
|
|
1838
1925
|
__spreadProps(__spreadValues({
|
|
1839
1926
|
ref,
|
|
@@ -1889,7 +1976,7 @@ var addOrRemoveValueInArray = (array, value) => {
|
|
|
1889
1976
|
};
|
|
1890
1977
|
|
|
1891
1978
|
// src/components/Menu/MenuSubmenu.tsx
|
|
1892
|
-
import { jsx as jsx24, jsxs as
|
|
1979
|
+
import { jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1893
1980
|
var MenuSubmenu = (_a) => {
|
|
1894
1981
|
var _b = _a, {
|
|
1895
1982
|
children,
|
|
@@ -1938,8 +2025,8 @@ var MenuSubmenu = (_a) => {
|
|
|
1938
2025
|
}
|
|
1939
2026
|
onClick == null ? void 0 : onClick(event);
|
|
1940
2027
|
};
|
|
1941
|
-
return /* @__PURE__ */ jsx24(MenuValueContext_default.Provider, { value: mergedValues, children: /* @__PURE__ */ jsx24("div", { className: clsx11(`${PREFIX_CLS}menu-submenu`), children: /* @__PURE__ */
|
|
1942
|
-
/* @__PURE__ */ jsx24(CollapseTrigger_default, { children: /* @__PURE__ */
|
|
2028
|
+
return /* @__PURE__ */ jsx24(MenuValueContext_default.Provider, { value: mergedValues, children: /* @__PURE__ */ jsx24("div", { className: clsx11(`${PREFIX_CLS}menu-submenu`), children: /* @__PURE__ */ jsxs17(Collapse_default, { isOpen, children: [
|
|
2029
|
+
/* @__PURE__ */ jsx24(CollapseTrigger_default, { children: /* @__PURE__ */ jsxs17(
|
|
1943
2030
|
"div",
|
|
1944
2031
|
__spreadProps(__spreadValues({
|
|
1945
2032
|
className: clsx11(
|
|
@@ -1976,7 +2063,7 @@ var MenuSubmenu = (_a) => {
|
|
|
1976
2063
|
var MenuSubmenu_default = MenuSubmenu;
|
|
1977
2064
|
|
|
1978
2065
|
// src/components/Menu/MenuGroup.tsx
|
|
1979
|
-
import { Fragment as
|
|
2066
|
+
import { Fragment as Fragment5, jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1980
2067
|
var MenuGroup = (_a) => {
|
|
1981
2068
|
var _b = _a, {
|
|
1982
2069
|
children,
|
|
@@ -2001,8 +2088,8 @@ var MenuGroup = (_a) => {
|
|
|
2001
2088
|
return type === "item" ? /* @__PURE__ */ jsx25(MenuItem_default, __spreadValues({}, item), index) : type === "submenu" ? /* @__PURE__ */ jsx25(MenuSubmenu_default, __spreadValues({}, item), index) : /* @__PURE__ */ jsx25(MenuItem_default, __spreadValues({}, item), index);
|
|
2002
2089
|
});
|
|
2003
2090
|
}, [items]);
|
|
2004
|
-
return /* @__PURE__ */
|
|
2005
|
-
/* @__PURE__ */
|
|
2091
|
+
return /* @__PURE__ */ jsxs18(Fragment5, { children: [
|
|
2092
|
+
/* @__PURE__ */ jsxs18(
|
|
2006
2093
|
"div",
|
|
2007
2094
|
__spreadProps(__spreadValues({
|
|
2008
2095
|
className: clsx12(`${PREFIX_CLS}menu-group`, className),
|
|
@@ -2048,8 +2135,8 @@ var Menu = (_a) => {
|
|
|
2048
2135
|
"onItemSelect"
|
|
2049
2136
|
]);
|
|
2050
2137
|
var _a2;
|
|
2051
|
-
const [selfValue, setSelfValue] =
|
|
2052
|
-
const [selfOpenValues, setSelfOpenValues] =
|
|
2138
|
+
const [selfValue, setSelfValue] = useState12((_a2 = valueProp != null ? valueProp : defaultValue) != null ? _a2 : []);
|
|
2139
|
+
const [selfOpenValues, setSelfOpenValues] = useState12(openValuesProp != null ? openValuesProp : []);
|
|
2053
2140
|
const content = useMemo6(() => {
|
|
2054
2141
|
return items == null ? void 0 : items.map((_a3, index) => {
|
|
2055
2142
|
var _b2 = _a3, { type } = _b2, item = __objRest(_b2, ["type"]);
|
|
@@ -2073,12 +2160,12 @@ var Menu = (_a) => {
|
|
|
2073
2160
|
const handleItemSelect = (props) => {
|
|
2074
2161
|
onItemSelect == null ? void 0 : onItemSelect(props);
|
|
2075
2162
|
};
|
|
2076
|
-
|
|
2163
|
+
useEffect17(() => {
|
|
2077
2164
|
if (valueProp !== void 0 && navMode !== "automatic") {
|
|
2078
2165
|
setSelfValue(valueProp);
|
|
2079
2166
|
}
|
|
2080
2167
|
}, [valueProp]);
|
|
2081
|
-
|
|
2168
|
+
useEffect17(() => {
|
|
2082
2169
|
if (openValuesProp !== void 0) {
|
|
2083
2170
|
setSelfOpenValues(openValuesProp);
|
|
2084
2171
|
}
|
|
@@ -2114,7 +2201,8 @@ var Accordion = forwardRef23((props, ref) => {
|
|
|
2114
2201
|
var Accordion_default = Accordion;
|
|
2115
2202
|
|
|
2116
2203
|
// src/components/Accordion/AccordionItem.tsx
|
|
2117
|
-
import { createContext as createContext6, forwardRef as forwardRef24, useContext as useContext8,
|
|
2204
|
+
import { createContext as createContext6, forwardRef as forwardRef24, useContext as useContext8, useState as useState13 } from "react";
|
|
2205
|
+
import { v4 as uuid } from "uuid";
|
|
2118
2206
|
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
2119
2207
|
var AccordionItemContext = createContext6(null);
|
|
2120
2208
|
var useAccordionItem = () => {
|
|
@@ -2126,28 +2214,28 @@ var useAccordionItem = () => {
|
|
|
2126
2214
|
};
|
|
2127
2215
|
var AccordionItem = forwardRef24((props, ref) => {
|
|
2128
2216
|
const _a = props, { children, className, value: valueProp } = _a, rest = __objRest(_a, ["children", "className", "value"]);
|
|
2129
|
-
const
|
|
2130
|
-
const { isOpen, onOpen, onClose, onToggle } = useDisclosure_default({ defaultValue: true });
|
|
2131
|
-
const id = useId();
|
|
2217
|
+
const [id] = useState13(uuid());
|
|
2132
2218
|
const value = valueProp != null ? valueProp : id;
|
|
2219
|
+
const { isOpen, onOpen, onClose, onToggle } = useDisclosure_default({ defaultValue: true });
|
|
2220
|
+
const prefixCls = PREFIX_CLS;
|
|
2133
2221
|
return /* @__PURE__ */ jsx28(AccordionItemContext.Provider, { value: { value }, children: /* @__PURE__ */ jsx28("div", __spreadProps(__spreadValues({ ref, className: clsx_default(`${prefixCls}accordion-item`, className) }, rest), { children: /* @__PURE__ */ jsx28(Collapse_default, { isOpen, onOpen, onClose, onToggle, children }) })) });
|
|
2134
2222
|
});
|
|
2135
2223
|
var AccordionItem_default = AccordionItem;
|
|
2136
2224
|
|
|
2137
2225
|
// src/components/Accordion/AccordionHeader.tsx
|
|
2138
2226
|
import { forwardRef as forwardRef25 } from "react";
|
|
2139
|
-
import { jsx as jsx29, jsxs as
|
|
2227
|
+
import { jsx as jsx29, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2140
2228
|
var AccordionHeader = forwardRef25((props, ref) => {
|
|
2141
2229
|
const _a = props, { className, title, subtitle, startContent, endContent } = _a, rest = __objRest(_a, ["className", "title", "subtitle", "startContent", "endContent"]);
|
|
2142
2230
|
const prefixCls = PREFIX_CLS;
|
|
2143
2231
|
const { isOpen } = useCollapse();
|
|
2144
|
-
return /* @__PURE__ */ jsx29(CollapseTrigger_default, { children: /* @__PURE__ */
|
|
2232
|
+
return /* @__PURE__ */ jsx29(CollapseTrigger_default, { children: /* @__PURE__ */ jsxs19("div", __spreadProps(__spreadValues({ ref, className: clsx_default(`${prefixCls}accordion-header`, className) }, rest), { children: [
|
|
2145
2233
|
startContent && /* @__PURE__ */ jsx29("div", { className: `${prefixCls}accordion-header__start-content`, children: startContent }),
|
|
2146
|
-
/* @__PURE__ */
|
|
2234
|
+
/* @__PURE__ */ jsxs19("div", { className: `${prefixCls}accordion-header__content`, children: [
|
|
2147
2235
|
/* @__PURE__ */ jsx29("div", { className: `${prefixCls}accordion-header__title`, children: title }),
|
|
2148
2236
|
subtitle && /* @__PURE__ */ jsx29("div", { className: `${prefixCls}accordion-header__subtitle`, children: subtitle })
|
|
2149
2237
|
] }),
|
|
2150
|
-
/* @__PURE__ */ jsx29("div", { className: `${prefixCls}accordion-header__end-content`, children: /* @__PURE__ */
|
|
2238
|
+
/* @__PURE__ */ jsx29("div", { className: `${prefixCls}accordion-header__end-content`, children: /* @__PURE__ */ jsxs19("div", { className: "us-d-flex us-items-center us-gap-1", children: [
|
|
2151
2239
|
endContent,
|
|
2152
2240
|
/* @__PURE__ */ jsx29(Button, { type: "button", variant: "text", color: "secondary", size: "sm", iconOnly: true, children: /* @__PURE__ */ jsx29(Icon_default, { children: isOpen ? /* @__PURE__ */ jsx29(ChevronUpIcon_default, {}) : /* @__PURE__ */ jsx29(ChevronDownIcon_default, {}) }) })
|
|
2153
2241
|
] }) })
|
|
@@ -2178,7 +2266,8 @@ var AccordionContent_default = AccordionContent;
|
|
|
2178
2266
|
// src/components/Tabs/Tab.tsx
|
|
2179
2267
|
import clsx14 from "clsx";
|
|
2180
2268
|
import mergeRefs4 from "merge-refs";
|
|
2181
|
-
import { forwardRef as forwardRef28, useEffect as
|
|
2269
|
+
import { forwardRef as forwardRef28, useEffect as useEffect18, useRef as useRef14, useState as useState14 } from "react";
|
|
2270
|
+
import { v4 as uuid2 } from "uuid";
|
|
2182
2271
|
|
|
2183
2272
|
// src/components/Tabs/TabsContext.ts
|
|
2184
2273
|
import { createContext as createContext7, useContext as useContext9 } from "react";
|
|
@@ -2192,7 +2281,7 @@ var useTabs = () => {
|
|
|
2192
2281
|
};
|
|
2193
2282
|
|
|
2194
2283
|
// src/components/Tabs/Tab.tsx
|
|
2195
|
-
import { jsx as jsx32, jsxs as
|
|
2284
|
+
import { jsx as jsx32, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2196
2285
|
var Tab = forwardRef28(
|
|
2197
2286
|
(_a, ref) => {
|
|
2198
2287
|
var _b = _a, {
|
|
@@ -2218,11 +2307,11 @@ var Tab = forwardRef28(
|
|
|
2218
2307
|
"disabled",
|
|
2219
2308
|
"onClick"
|
|
2220
2309
|
]);
|
|
2221
|
-
const
|
|
2222
|
-
const
|
|
2310
|
+
const prefixCls = PREFIX_CLS;
|
|
2311
|
+
const tabRef = useRef14(null);
|
|
2312
|
+
const [id] = useState14(uuid2());
|
|
2223
2313
|
const value = valueProp != null ? valueProp : id;
|
|
2224
2314
|
const _a2 = useTabs(), { onClose, registerItem } = _a2, tabs = __objRest(_a2, ["onClose", "registerItem"]);
|
|
2225
|
-
const prefixCls = PREFIX_CLS;
|
|
2226
2315
|
const handleClick = (event) => {
|
|
2227
2316
|
const previousTab = tabs.previousTabRef.current;
|
|
2228
2317
|
const currentTab = tabRef.current;
|
|
@@ -2261,13 +2350,13 @@ var Tab = forwardRef28(
|
|
|
2261
2350
|
event.stopPropagation();
|
|
2262
2351
|
onClose(value);
|
|
2263
2352
|
};
|
|
2264
|
-
|
|
2353
|
+
useEffect18(() => {
|
|
2265
2354
|
registerItem({ value, disabled });
|
|
2266
2355
|
if (value === tabs.value) {
|
|
2267
2356
|
tabs.previousTabRef.current = tabRef.current;
|
|
2268
2357
|
}
|
|
2269
2358
|
}, [value, tabs.value]);
|
|
2270
|
-
return /* @__PURE__ */
|
|
2359
|
+
return /* @__PURE__ */ jsxs20(
|
|
2271
2360
|
Component,
|
|
2272
2361
|
__spreadProps(__spreadValues({
|
|
2273
2362
|
ref: mergeRefs4(tabRef, ref, (el) => tabs.tabRefs.current[value] = el),
|
|
@@ -2281,10 +2370,10 @@ var Tab = forwardRef28(
|
|
|
2281
2370
|
}, rest), {
|
|
2282
2371
|
children: [
|
|
2283
2372
|
/* @__PURE__ */ jsx32("div", { className: `${prefixCls}overlay`, children: /* @__PURE__ */ jsx32("div", { className: `${prefixCls}overlay__surface` }) }),
|
|
2284
|
-
/* @__PURE__ */
|
|
2373
|
+
/* @__PURE__ */ jsxs20("div", { className: `${prefixCls}tab__content`, children: [
|
|
2285
2374
|
startContent && /* @__PURE__ */ jsx32("div", { className: `${prefixCls}tab__start-content`, children: startContent }),
|
|
2286
2375
|
children,
|
|
2287
|
-
endContent || closable && /* @__PURE__ */
|
|
2376
|
+
endContent || closable && /* @__PURE__ */ jsxs20("div", { className: `${prefixCls}tab__end-content`, children: [
|
|
2288
2377
|
endContent,
|
|
2289
2378
|
closable && /* @__PURE__ */ jsx32(Button, { variant: "text", color: "secondary", iconOnly: true, size: "xs", onClick: handleClose, children: /* @__PURE__ */ jsx32(Icon_default, { children: /* @__PURE__ */ jsx32(CloseIcon_default, {}) }) })
|
|
2290
2379
|
] })
|
|
@@ -2298,8 +2387,8 @@ var Tab = forwardRef28(
|
|
|
2298
2387
|
|
|
2299
2388
|
// src/components/Tabs/Tabs.tsx
|
|
2300
2389
|
import clsx15 from "clsx";
|
|
2301
|
-
import { useEffect as
|
|
2302
|
-
import { jsx as jsx33, jsxs as
|
|
2390
|
+
import { useEffect as useEffect19, useRef as useRef15, useState as useState15 } from "react";
|
|
2391
|
+
import { jsx as jsx33, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2303
2392
|
var Tabs = (_a) => {
|
|
2304
2393
|
var _b = _a, {
|
|
2305
2394
|
children,
|
|
@@ -2318,11 +2407,11 @@ var Tabs = (_a) => {
|
|
|
2318
2407
|
"onChange",
|
|
2319
2408
|
"onClose"
|
|
2320
2409
|
]);
|
|
2321
|
-
const tabsRef =
|
|
2322
|
-
const tabRefs =
|
|
2323
|
-
const previousTabRef =
|
|
2324
|
-
const [selfValue, setSelfValue] =
|
|
2325
|
-
const [items, setItems] =
|
|
2410
|
+
const tabsRef = useRef15(null);
|
|
2411
|
+
const tabRefs = useRef15({});
|
|
2412
|
+
const previousTabRef = useRef15(null);
|
|
2413
|
+
const [selfValue, setSelfValue] = useState15(value != null ? value : defaultValue);
|
|
2414
|
+
const [items, setItems] = useState15([]);
|
|
2326
2415
|
const registerItem = (item) => {
|
|
2327
2416
|
setItems((prevItems) => {
|
|
2328
2417
|
const index = prevItems.findIndex((item2) => item2.value);
|
|
@@ -2349,19 +2438,19 @@ var Tabs = (_a) => {
|
|
|
2349
2438
|
const handleClose = (value2) => {
|
|
2350
2439
|
onClose == null ? void 0 : onClose(value2);
|
|
2351
2440
|
};
|
|
2352
|
-
|
|
2441
|
+
useEffect19(() => {
|
|
2353
2442
|
if (value !== void 0) {
|
|
2354
2443
|
setSelfValue(value);
|
|
2355
2444
|
scrollToTab(value);
|
|
2356
2445
|
}
|
|
2357
2446
|
}, [value]);
|
|
2358
|
-
|
|
2447
|
+
useEffect19(() => {
|
|
2359
2448
|
if (value === void 0) {
|
|
2360
2449
|
const item = items.find((tab) => !tab.disabled);
|
|
2361
2450
|
setSelfValue(item == null ? void 0 : item.value);
|
|
2362
2451
|
}
|
|
2363
2452
|
}, [value, items]);
|
|
2364
|
-
return /* @__PURE__ */
|
|
2453
|
+
return /* @__PURE__ */ jsxs21(
|
|
2365
2454
|
TabsContext.Provider,
|
|
2366
2455
|
{
|
|
2367
2456
|
value: { previousTabRef, tabRefs, value: selfValue, onChange: handleChange, onClose: handleClose, registerItem },
|
|
@@ -2383,7 +2472,7 @@ var Tabs = (_a) => {
|
|
|
2383
2472
|
|
|
2384
2473
|
// src/components/Toolbar/Toolbar.tsx
|
|
2385
2474
|
import clsx16 from "clsx";
|
|
2386
|
-
import { Fragment as
|
|
2475
|
+
import { Fragment as Fragment6, jsx as jsx34, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2387
2476
|
var Toolbar = (props) => {
|
|
2388
2477
|
const _a = props, {
|
|
2389
2478
|
children,
|
|
@@ -2407,11 +2496,11 @@ var Toolbar = (props) => {
|
|
|
2407
2496
|
"subtitle"
|
|
2408
2497
|
]);
|
|
2409
2498
|
const prefixCls = PREFIX_CLS;
|
|
2410
|
-
return /* @__PURE__ */
|
|
2499
|
+
return /* @__PURE__ */ jsxs22("div", __spreadProps(__spreadValues({ className: clsx16(`${prefixCls}toolbar`, { [`${prefixCls}toolbar--${size}`]: size }, className) }, rest), { children: [
|
|
2411
2500
|
/* @__PURE__ */ jsx34("div", { className: `${prefixCls}outline-b` }),
|
|
2412
|
-
/* @__PURE__ */
|
|
2501
|
+
/* @__PURE__ */ jsxs22("div", { className: clsx16(`${prefixCls}toolbar__container`), children: [
|
|
2413
2502
|
startContent ? /* @__PURE__ */ jsx34("div", { className: clsx16(`${prefixCls}toolbar__start-content`), children: startContent }) : startAction && /* @__PURE__ */ jsx34("div", { className: clsx16(`${prefixCls}toolbar__start-action`), children: startAction }),
|
|
2414
|
-
/* @__PURE__ */ jsx34("div", { className: clsx16(`${prefixCls}toolbar__content`), children: title || subtitle ? /* @__PURE__ */
|
|
2503
|
+
/* @__PURE__ */ jsx34("div", { className: clsx16(`${prefixCls}toolbar__content`), children: title || subtitle ? /* @__PURE__ */ jsxs22(Fragment6, { children: [
|
|
2415
2504
|
title && /* @__PURE__ */ jsx34("div", { className: clsx16(`${prefixCls}toolbar__title`), children: title }),
|
|
2416
2505
|
subtitle && /* @__PURE__ */ jsx34("div", { className: clsx16(`${prefixCls}toolbar__subtitle`), children: subtitle })
|
|
2417
2506
|
] }) : children }),
|
|
@@ -2422,13 +2511,13 @@ var Toolbar = (props) => {
|
|
|
2422
2511
|
var Toolbar_default = Toolbar;
|
|
2423
2512
|
|
|
2424
2513
|
// src/components/TextInput/TextInput.tsx
|
|
2425
|
-
import { forwardRef as forwardRef29, useRef as
|
|
2426
|
-
import { jsx as jsx35, jsxs as
|
|
2514
|
+
import { forwardRef as forwardRef29, useRef as useRef16, useState as useState16 } from "react";
|
|
2515
|
+
import { jsx as jsx35, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2427
2516
|
var TextInput = forwardRef29(
|
|
2428
2517
|
(_a, ref) => {
|
|
2429
2518
|
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"]);
|
|
2430
|
-
const [focus, setFocus] =
|
|
2431
|
-
const selfInputRef =
|
|
2519
|
+
const [focus, setFocus] = useState16(false);
|
|
2520
|
+
const selfInputRef = useRef16(null);
|
|
2432
2521
|
const prefixCls = PREFIX_CLS;
|
|
2433
2522
|
const handleChange = (event) => {
|
|
2434
2523
|
onChange == null ? void 0 : onChange(event);
|
|
@@ -2438,7 +2527,7 @@ var TextInput = forwardRef29(
|
|
|
2438
2527
|
onClick == null ? void 0 : onClick(event);
|
|
2439
2528
|
(_a2 = selfInputRef == null ? void 0 : selfInputRef.current) == null ? void 0 : _a2.focus();
|
|
2440
2529
|
};
|
|
2441
|
-
return /* @__PURE__ */
|
|
2530
|
+
return /* @__PURE__ */ jsxs23(
|
|
2442
2531
|
"div",
|
|
2443
2532
|
{
|
|
2444
2533
|
ref,
|
|
@@ -2457,7 +2546,7 @@ var TextInput = forwardRef29(
|
|
|
2457
2546
|
onClick: handleClick,
|
|
2458
2547
|
children: [
|
|
2459
2548
|
/* @__PURE__ */ jsx35("div", { className: `${prefixCls}outline` }),
|
|
2460
|
-
/* @__PURE__ */
|
|
2549
|
+
/* @__PURE__ */ jsxs23("div", { className: `${prefixCls}input__content`, children: [
|
|
2461
2550
|
startContent && /* @__PURE__ */ jsx35("div", { className: `${prefixCls}input__start-content`, children: startContent }),
|
|
2462
2551
|
/* @__PURE__ */ jsx35(
|
|
2463
2552
|
"input",
|
|
@@ -2481,8 +2570,8 @@ var TextInput_default = TextInput;
|
|
|
2481
2570
|
|
|
2482
2571
|
// src/components/Switch/Switch.tsx
|
|
2483
2572
|
import clsx17 from "clsx";
|
|
2484
|
-
import { forwardRef as forwardRef30, useEffect as
|
|
2485
|
-
import { jsx as jsx36, jsxs as
|
|
2573
|
+
import { forwardRef as forwardRef30, useEffect as useEffect20, useState as useState17 } from "react";
|
|
2574
|
+
import { jsx as jsx36, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2486
2575
|
var Switch = forwardRef30(
|
|
2487
2576
|
(_a, ref) => {
|
|
2488
2577
|
var _b = _a, {
|
|
@@ -2506,7 +2595,7 @@ var Switch = forwardRef30(
|
|
|
2506
2595
|
"onCheckedChange",
|
|
2507
2596
|
"disabled"
|
|
2508
2597
|
]);
|
|
2509
|
-
const [selftChecked, setSelfChecked] =
|
|
2598
|
+
const [selftChecked, setSelfChecked] = useState17(checkedProp);
|
|
2510
2599
|
const prefixCls = PREFIX_CLS;
|
|
2511
2600
|
const handleChange = (event) => {
|
|
2512
2601
|
const { value: value2, checked } = event.target;
|
|
@@ -2514,12 +2603,12 @@ var Switch = forwardRef30(
|
|
|
2514
2603
|
onChange == null ? void 0 : onChange(value2);
|
|
2515
2604
|
onCheckedChangeProp == null ? void 0 : onCheckedChangeProp(checked);
|
|
2516
2605
|
};
|
|
2517
|
-
|
|
2606
|
+
useEffect20(() => {
|
|
2518
2607
|
if (checkedProp !== void 0) {
|
|
2519
2608
|
setSelfChecked(checkedProp);
|
|
2520
2609
|
}
|
|
2521
2610
|
}, [checkedProp]);
|
|
2522
|
-
return /* @__PURE__ */
|
|
2611
|
+
return /* @__PURE__ */ jsxs24(
|
|
2523
2612
|
"label",
|
|
2524
2613
|
__spreadProps(__spreadValues({
|
|
2525
2614
|
ref,
|
|
@@ -2552,10 +2641,10 @@ var Switch = forwardRef30(
|
|
|
2552
2641
|
var Switch_default = Switch;
|
|
2553
2642
|
|
|
2554
2643
|
// src/components/Select/Select.tsx
|
|
2555
|
-
import { useEffect as
|
|
2644
|
+
import { useEffect as useEffect23, useMemo as useMemo7, useRef as useRef19, useState as useState18 } from "react";
|
|
2556
2645
|
|
|
2557
2646
|
// src/components/Select/SelectContent.tsx
|
|
2558
|
-
import { Fragment as
|
|
2647
|
+
import { Fragment as Fragment7, useEffect as useEffect21, useRef as useRef17 } from "react";
|
|
2559
2648
|
|
|
2560
2649
|
// src/components/Select/SelectContext.tsx
|
|
2561
2650
|
import { createContext as createContext8, useContext as useContext10 } from "react";
|
|
@@ -2573,14 +2662,14 @@ var SelectContext_default = SelectContext;
|
|
|
2573
2662
|
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
2574
2663
|
var SelectContent = () => {
|
|
2575
2664
|
const { data, values, offset, setOffset, keyField, textField, onItemSelect, renderItem } = useSelect();
|
|
2576
|
-
const parentRef =
|
|
2665
|
+
const parentRef = useRef17(null);
|
|
2577
2666
|
const { isOpen } = usePopover();
|
|
2578
2667
|
const handleItemSelect = (item) => {
|
|
2579
2668
|
var _a;
|
|
2580
2669
|
onItemSelect(item);
|
|
2581
2670
|
setOffset(((_a = parentRef.current) == null ? void 0 : _a.scrollHeight) || 0);
|
|
2582
2671
|
};
|
|
2583
|
-
|
|
2672
|
+
useEffect21(() => {
|
|
2584
2673
|
var _a;
|
|
2585
2674
|
if (!isOpen)
|
|
2586
2675
|
return;
|
|
@@ -2595,7 +2684,7 @@ var SelectContent = () => {
|
|
|
2595
2684
|
width: `100%`,
|
|
2596
2685
|
position: "relative"
|
|
2597
2686
|
},
|
|
2598
|
-
children: /* @__PURE__ */ jsx37(List_default, { children: renderItem ? data.map((item) => /* @__PURE__ */ jsx37(
|
|
2687
|
+
children: /* @__PURE__ */ jsx37(List_default, { children: renderItem ? data.map((item) => /* @__PURE__ */ jsx37(Fragment7, { children: renderItem(item, {
|
|
2599
2688
|
title: "",
|
|
2600
2689
|
selected: values.includes(item[keyField]),
|
|
2601
2690
|
hoverable: true,
|
|
@@ -2616,7 +2705,7 @@ var SelectContent = () => {
|
|
|
2616
2705
|
var SelectContent_default = SelectContent;
|
|
2617
2706
|
|
|
2618
2707
|
// src/components/Select/SelectVirtual.tsx
|
|
2619
|
-
import { Fragment as
|
|
2708
|
+
import { Fragment as Fragment8, useEffect as useEffect22, useRef as useRef18 } from "react";
|
|
2620
2709
|
|
|
2621
2710
|
// src/components/Select/utils.ts
|
|
2622
2711
|
var valueToValues2 = (value) => {
|
|
@@ -2630,13 +2719,13 @@ var valuesToValue2 = (values) => {
|
|
|
2630
2719
|
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
2631
2720
|
var SelectVirtual = () => {
|
|
2632
2721
|
const { data, values, keyField, textField, virtual, onItemSelect, renderItem } = useSelect();
|
|
2633
|
-
const parentRef =
|
|
2722
|
+
const parentRef = useRef18(null);
|
|
2634
2723
|
const virtualizer = useVirtualizer_default(__spreadProps(__spreadValues({}, virtual), { count: data.length, parentRef }));
|
|
2635
2724
|
const { isOpen } = usePopover();
|
|
2636
2725
|
const handleItemSelect = (item) => {
|
|
2637
2726
|
onItemSelect(item);
|
|
2638
2727
|
};
|
|
2639
|
-
|
|
2728
|
+
useEffect22(() => {
|
|
2640
2729
|
if (!isOpen)
|
|
2641
2730
|
return;
|
|
2642
2731
|
const value = valuesToValue2(values);
|
|
@@ -2701,7 +2790,7 @@ var SelectVirtual = () => {
|
|
|
2701
2790
|
);
|
|
2702
2791
|
}
|
|
2703
2792
|
if (renderItem) {
|
|
2704
|
-
return /* @__PURE__ */ jsx38(
|
|
2793
|
+
return /* @__PURE__ */ jsx38(Fragment8, { children: renderItem(item, {
|
|
2705
2794
|
title: "",
|
|
2706
2795
|
selected: values.includes(item[keyField]),
|
|
2707
2796
|
hoverable: true,
|
|
@@ -2743,7 +2832,7 @@ var SelectVirtual = () => {
|
|
|
2743
2832
|
var SelectVirtual_default = SelectVirtual;
|
|
2744
2833
|
|
|
2745
2834
|
// src/components/Select/Select.tsx
|
|
2746
|
-
import { jsx as jsx39, jsxs as
|
|
2835
|
+
import { jsx as jsx39, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2747
2836
|
var Select = (props) => {
|
|
2748
2837
|
const {
|
|
2749
2838
|
data,
|
|
@@ -2756,6 +2845,7 @@ var Select = (props) => {
|
|
|
2756
2845
|
disclosure: disclosureProp,
|
|
2757
2846
|
virtual,
|
|
2758
2847
|
placeholder,
|
|
2848
|
+
className,
|
|
2759
2849
|
style,
|
|
2760
2850
|
startContent,
|
|
2761
2851
|
endContent,
|
|
@@ -2763,17 +2853,17 @@ var Select = (props) => {
|
|
|
2763
2853
|
} = props;
|
|
2764
2854
|
const disclosure = disclosureProp !== void 0 ? disclosureProp : useDisclosure_default();
|
|
2765
2855
|
const prefixCls = PREFIX_CLS;
|
|
2766
|
-
const inputRef =
|
|
2767
|
-
const [search, setSearch] =
|
|
2768
|
-
const [isSearch, setIsSearch] =
|
|
2769
|
-
const [focus, setFocus] =
|
|
2856
|
+
const inputRef = useRef19(null);
|
|
2857
|
+
const [search, setSearch] = useState18("");
|
|
2858
|
+
const [isSearch, setIsSearch] = useState18(false);
|
|
2859
|
+
const [focus, setFocus] = useState18(false);
|
|
2770
2860
|
const values = useMemo7(() => {
|
|
2771
2861
|
return valueToValues2(valueProp);
|
|
2772
2862
|
}, [valueProp]);
|
|
2773
2863
|
const items = useMemo7(() => {
|
|
2774
2864
|
return data.filter((item) => values.includes(item[keyField]));
|
|
2775
2865
|
}, [data, values]);
|
|
2776
|
-
const [offset, setOffset] =
|
|
2866
|
+
const [offset, setOffset] = useState18(0);
|
|
2777
2867
|
const handleClick = () => {
|
|
2778
2868
|
var _a;
|
|
2779
2869
|
(_a = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _a.focus();
|
|
@@ -2848,7 +2938,7 @@ var Select = (props) => {
|
|
|
2848
2938
|
}
|
|
2849
2939
|
}
|
|
2850
2940
|
};
|
|
2851
|
-
|
|
2941
|
+
useEffect23(() => {
|
|
2852
2942
|
if (isSearch)
|
|
2853
2943
|
return;
|
|
2854
2944
|
if (!props.isMultiple) {
|
|
@@ -2858,7 +2948,7 @@ var Select = (props) => {
|
|
|
2858
2948
|
}
|
|
2859
2949
|
}
|
|
2860
2950
|
}, [items]);
|
|
2861
|
-
|
|
2951
|
+
useEffect23(() => {
|
|
2862
2952
|
const values2 = valueToValues2(valueProp);
|
|
2863
2953
|
const value = values2[0];
|
|
2864
2954
|
if (value === void 0) {
|
|
@@ -2881,7 +2971,7 @@ var Select = (props) => {
|
|
|
2881
2971
|
setOffset,
|
|
2882
2972
|
renderItem
|
|
2883
2973
|
},
|
|
2884
|
-
children: /* @__PURE__ */
|
|
2974
|
+
children: /* @__PURE__ */ jsxs25(
|
|
2885
2975
|
Popover_default,
|
|
2886
2976
|
__spreadProps(__spreadValues({
|
|
2887
2977
|
target: true
|
|
@@ -2891,13 +2981,17 @@ var Select = (props) => {
|
|
|
2891
2981
|
onClose: handleClose,
|
|
2892
2982
|
autoClose: "outside",
|
|
2893
2983
|
children: [
|
|
2894
|
-
/* @__PURE__ */ jsx39(PopoverTrigger_default, { children: /* @__PURE__ */
|
|
2984
|
+
/* @__PURE__ */ jsx39(PopoverTrigger_default, { children: /* @__PURE__ */ jsxs25(
|
|
2895
2985
|
"div",
|
|
2896
2986
|
{
|
|
2897
|
-
className: clsx_default(
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2987
|
+
className: clsx_default(
|
|
2988
|
+
`${prefixCls}input`,
|
|
2989
|
+
{
|
|
2990
|
+
[`${prefixCls}input--focus`]: focus,
|
|
2991
|
+
[`${prefixCls}input--disabled`]: disabled
|
|
2992
|
+
},
|
|
2993
|
+
className
|
|
2994
|
+
),
|
|
2901
2995
|
style,
|
|
2902
2996
|
onClick: handleClick,
|
|
2903
2997
|
onFocus: () => {
|
|
@@ -2909,10 +3003,10 @@ var Select = (props) => {
|
|
|
2909
3003
|
children: [
|
|
2910
3004
|
/* @__PURE__ */ jsx39("input", { type: "text", ref: inputRef, style: { position: "absolute", opacity: 0 } }),
|
|
2911
3005
|
/* @__PURE__ */ jsx39("div", { className: `${prefixCls}outline` }),
|
|
2912
|
-
/* @__PURE__ */
|
|
3006
|
+
/* @__PURE__ */ jsxs25("div", { className: `${prefixCls}input__content`, children: [
|
|
2913
3007
|
startContent && /* @__PURE__ */ jsx39("div", { className: `${prefixCls}input__start-content`, children: startContent }),
|
|
2914
3008
|
/* @__PURE__ */ jsx39("div", { className: `${prefixCls}input__field`, children: search || placeholder }),
|
|
2915
|
-
/* @__PURE__ */
|
|
3009
|
+
/* @__PURE__ */ jsxs25("div", { className: `${prefixCls}input__end-content`, children: [
|
|
2916
3010
|
endContent,
|
|
2917
3011
|
loading ? /* @__PURE__ */ jsx39(Icon_default, { children: /* @__PURE__ */ jsx39(LoaderIcon_default, { className: `${prefixCls}animation-spin` }) }) : /* @__PURE__ */ jsx39(Button, { color: "secondary", variant: "plain", size: "xs", iconOnly: true, onClick: handleClear, children: /* @__PURE__ */ jsx39(Icon_default, { children: /* @__PURE__ */ jsx39(CloseIcon_default, {}) }) }),
|
|
2918
3012
|
/* @__PURE__ */ jsx39("div", { style: { pointerEvents: "none" }, children: /* @__PURE__ */ jsx39(Icon_default, { children: disclosure.isOpen ? /* @__PURE__ */ jsx39(ChevronUpIcon_default, {}) : /* @__PURE__ */ jsx39(ChevronDownIcon_default, {}) }) })
|
|
@@ -2932,11 +3026,11 @@ var Select_default = Select;
|
|
|
2932
3026
|
|
|
2933
3027
|
// src/components/Field/Field.tsx
|
|
2934
3028
|
import { forwardRef as forwardRef31 } from "react";
|
|
2935
|
-
import { jsx as jsx40, jsxs as
|
|
3029
|
+
import { jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2936
3030
|
var Field = forwardRef31(({ children, label }, ref) => {
|
|
2937
3031
|
{
|
|
2938
3032
|
const prefixCls = PREFIX_CLS;
|
|
2939
|
-
return /* @__PURE__ */
|
|
3033
|
+
return /* @__PURE__ */ jsxs26("div", { ref, className: clsx_default(`${prefixCls}field`), children: [
|
|
2940
3034
|
/* @__PURE__ */ jsx40("div", { className: `${prefixCls}field__label`, children: label }),
|
|
2941
3035
|
/* @__PURE__ */ jsx40("div", { className: `${prefixCls}field__content`, children })
|
|
2942
3036
|
] });
|
|
@@ -2985,12 +3079,14 @@ export {
|
|
|
2985
3079
|
assignRef,
|
|
2986
3080
|
clsx_default as clsx,
|
|
2987
3081
|
getOpenValuesByPathname,
|
|
3082
|
+
hasResizeObserver,
|
|
2988
3083
|
mergeRefs_default as mergeRefs,
|
|
2989
3084
|
scrollToItem,
|
|
2990
3085
|
useAccordionItem,
|
|
2991
3086
|
useCollapse,
|
|
2992
3087
|
useDebounce_default as useDebounce,
|
|
2993
3088
|
useDisclosure_default as useDisclosure,
|
|
3089
|
+
useEffectEvent_default as useEffectEvent,
|
|
2994
3090
|
useElementSize_default as useElementSize,
|
|
2995
3091
|
useInfiniteQuery_default as useInfiniteQuery,
|
|
2996
3092
|
useLocalStorage,
|
|
@@ -2998,6 +3094,8 @@ export {
|
|
|
2998
3094
|
useMenuItemValue,
|
|
2999
3095
|
useOnClickOutside_default as useOnClickOutside,
|
|
3000
3096
|
usePrevious,
|
|
3097
|
+
useResizeObserver_default as useResizeObserver,
|
|
3001
3098
|
useStep,
|
|
3099
|
+
useValueEffect_default as useValueEffect,
|
|
3002
3100
|
useVirtualizer_default as useVirtualizer
|
|
3003
3101
|
};
|