@xsolla/xui-multi-select 0.132.0 → 0.133.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/native/index.js +243 -35
- package/native/index.js.map +1 -1
- package/native/index.mjs +215 -7
- package/native/index.mjs.map +1 -1
- package/package.json +5 -5
- package/web/index.js +243 -35
- package/web/index.js.map +1 -1
- package/web/index.mjs +215 -7
- package/web/index.mjs.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xsolla/xui-multi-select",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.133.0",
|
|
4
4
|
"main": "./web/index.js",
|
|
5
5
|
"module": "./web/index.mjs",
|
|
6
6
|
"types": "./web/index.d.ts",
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
"build:native": "PLATFORM=native tsup"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@xsolla/xui-checkbox": "0.
|
|
14
|
-
"@xsolla/xui-core": "0.
|
|
15
|
-
"@xsolla/xui-dropdown": "0.
|
|
16
|
-
"@xsolla/xui-primitives-core": "0.
|
|
13
|
+
"@xsolla/xui-checkbox": "0.133.0",
|
|
14
|
+
"@xsolla/xui-core": "0.133.0",
|
|
15
|
+
"@xsolla/xui-dropdown": "0.133.0",
|
|
16
|
+
"@xsolla/xui-primitives-core": "0.133.0"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"react": ">=16.8.0",
|
package/web/index.js
CHANGED
|
@@ -35,7 +35,7 @@ __export(index_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(index_exports);
|
|
36
36
|
|
|
37
37
|
// src/MultiSelect.tsx
|
|
38
|
-
var
|
|
38
|
+
var import_react10 = require("react");
|
|
39
39
|
|
|
40
40
|
// ../primitives-web/src/Box.tsx
|
|
41
41
|
var import_react = __toESM(require("react"));
|
|
@@ -267,7 +267,7 @@ var Icon = ({ children, ...props }) => {
|
|
|
267
267
|
var import_xui_core4 = require("@xsolla/xui-core");
|
|
268
268
|
|
|
269
269
|
// src/MultiSelectControl.tsx
|
|
270
|
-
var
|
|
270
|
+
var import_react8 = require("react");
|
|
271
271
|
var import_xui_core3 = require("@xsolla/xui-core");
|
|
272
272
|
|
|
273
273
|
// ../icons-base/dist/web/index.mjs
|
|
@@ -715,11 +715,12 @@ var lineContent113 = `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.
|
|
|
715
715
|
var Remove = (props) => /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(BaseIcon, { ...props, solidContent: solidContent113, lineContent: lineContent113 });
|
|
716
716
|
|
|
717
717
|
// src/useMultiSelectControl.tsx
|
|
718
|
-
var
|
|
718
|
+
var import_react7 = require("react");
|
|
719
719
|
|
|
720
720
|
// ../tag/dist/web/index.mjs
|
|
721
|
-
var
|
|
721
|
+
var import_react5 = __toESM(require("react"), 1);
|
|
722
722
|
var import_styled_components6 = __toESM(require("styled-components"), 1);
|
|
723
|
+
var import_react6 = __toESM(require("react"), 1);
|
|
723
724
|
var import_jsx_runtime393 = require("react/jsx-runtime");
|
|
724
725
|
var import_styled_components7 = __toESM(require("styled-components"), 1);
|
|
725
726
|
var import_jsx_runtime394 = require("react/jsx-runtime");
|
|
@@ -728,6 +729,7 @@ var import_jsx_runtime395 = require("react/jsx-runtime");
|
|
|
728
729
|
var import_xui_core = require("@xsolla/xui-core");
|
|
729
730
|
|
|
730
731
|
// ../icons/dist/web/index.mjs
|
|
732
|
+
var import_react4 = __toESM(require("react"), 1);
|
|
731
733
|
var import_styled_components5 = __toESM(require("styled-components"), 1);
|
|
732
734
|
var import_jsx_runtime391 = require("react/jsx-runtime");
|
|
733
735
|
|
|
@@ -810,7 +812,109 @@ var X = createLucideIcon("X", [
|
|
|
810
812
|
|
|
811
813
|
// ../icons/dist/web/index.mjs
|
|
812
814
|
var import_jsx_runtime392 = require("react/jsx-runtime");
|
|
813
|
-
var
|
|
815
|
+
var NON_HTML_PROPS = /* @__PURE__ */ new Set([
|
|
816
|
+
// BoxProps — layout & styling
|
|
817
|
+
"backgroundColor",
|
|
818
|
+
"borderColor",
|
|
819
|
+
"borderWidth",
|
|
820
|
+
"borderBottomWidth",
|
|
821
|
+
"borderBottomColor",
|
|
822
|
+
"borderTopWidth",
|
|
823
|
+
"borderTopColor",
|
|
824
|
+
"borderLeftWidth",
|
|
825
|
+
"borderLeftColor",
|
|
826
|
+
"borderRightWidth",
|
|
827
|
+
"borderRightColor",
|
|
828
|
+
"borderRadius",
|
|
829
|
+
"borderStyle",
|
|
830
|
+
"flexDirection",
|
|
831
|
+
"flexWrap",
|
|
832
|
+
"alignItems",
|
|
833
|
+
"justifyContent",
|
|
834
|
+
"alignSelf",
|
|
835
|
+
"flex",
|
|
836
|
+
"flexShrink",
|
|
837
|
+
"gap",
|
|
838
|
+
"position",
|
|
839
|
+
"top",
|
|
840
|
+
"bottom",
|
|
841
|
+
"left",
|
|
842
|
+
"right",
|
|
843
|
+
"outline",
|
|
844
|
+
"overflow",
|
|
845
|
+
"overflowX",
|
|
846
|
+
"overflowY",
|
|
847
|
+
"zIndex",
|
|
848
|
+
"cursor",
|
|
849
|
+
"padding",
|
|
850
|
+
"paddingHorizontal",
|
|
851
|
+
"paddingVertical",
|
|
852
|
+
"paddingTop",
|
|
853
|
+
"paddingBottom",
|
|
854
|
+
"paddingLeft",
|
|
855
|
+
"paddingRight",
|
|
856
|
+
"margin",
|
|
857
|
+
"marginTop",
|
|
858
|
+
"marginBottom",
|
|
859
|
+
"marginLeft",
|
|
860
|
+
"marginRight",
|
|
861
|
+
"minWidth",
|
|
862
|
+
"minHeight",
|
|
863
|
+
"maxWidth",
|
|
864
|
+
"maxHeight",
|
|
865
|
+
"hoverStyle",
|
|
866
|
+
"pressStyle",
|
|
867
|
+
"focusStyle",
|
|
868
|
+
"outlineColor",
|
|
869
|
+
"outlineWidth",
|
|
870
|
+
"outlineOffset",
|
|
871
|
+
"outlineStyle",
|
|
872
|
+
// BoxProps — RN-only
|
|
873
|
+
"onPress",
|
|
874
|
+
"onLayout",
|
|
875
|
+
"onMoveShouldSetResponder",
|
|
876
|
+
"onResponderGrant",
|
|
877
|
+
"onResponderMove",
|
|
878
|
+
"onResponderRelease",
|
|
879
|
+
"onResponderTerminate",
|
|
880
|
+
"testID",
|
|
881
|
+
// Box — custom element type
|
|
882
|
+
"elementType",
|
|
883
|
+
// TextProps
|
|
884
|
+
"fontSize",
|
|
885
|
+
"fontWeight",
|
|
886
|
+
"fontFamily",
|
|
887
|
+
"lineHeight",
|
|
888
|
+
"whiteSpace",
|
|
889
|
+
"textAlign",
|
|
890
|
+
"textDecoration",
|
|
891
|
+
"numberOfLines",
|
|
892
|
+
"letterSpacing",
|
|
893
|
+
"textTransform",
|
|
894
|
+
// SpinnerProps
|
|
895
|
+
"strokeWidth",
|
|
896
|
+
// DividerProps
|
|
897
|
+
"vertical",
|
|
898
|
+
"dashStroke"
|
|
899
|
+
]);
|
|
900
|
+
function createFilteredElement(defaultTag) {
|
|
901
|
+
const Component = import_react4.default.forwardRef(
|
|
902
|
+
({ children, elementType, ...props }, ref) => {
|
|
903
|
+
const Tag2 = elementType || defaultTag;
|
|
904
|
+
const htmlProps = {};
|
|
905
|
+
for (const key of Object.keys(props)) {
|
|
906
|
+
if (!NON_HTML_PROPS.has(key)) {
|
|
907
|
+
htmlProps[key] = props[key];
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
return import_react4.default.createElement(Tag2, { ref, ...htmlProps }, children);
|
|
911
|
+
}
|
|
912
|
+
);
|
|
913
|
+
Component.displayName = `Filtered(${defaultTag})`;
|
|
914
|
+
return Component;
|
|
915
|
+
}
|
|
916
|
+
var FilteredDiv = createFilteredElement("div");
|
|
917
|
+
var StyledIcon3 = (0, import_styled_components5.default)(FilteredDiv)`
|
|
814
918
|
display: flex;
|
|
815
919
|
align-items: center;
|
|
816
920
|
justify-content: center;
|
|
@@ -832,7 +936,109 @@ var X2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime392.jsx)(Icon3, { ...p
|
|
|
832
936
|
|
|
833
937
|
// ../tag/dist/web/index.mjs
|
|
834
938
|
var import_jsx_runtime396 = require("react/jsx-runtime");
|
|
835
|
-
var
|
|
939
|
+
var NON_HTML_PROPS2 = /* @__PURE__ */ new Set([
|
|
940
|
+
// BoxProps — layout & styling
|
|
941
|
+
"backgroundColor",
|
|
942
|
+
"borderColor",
|
|
943
|
+
"borderWidth",
|
|
944
|
+
"borderBottomWidth",
|
|
945
|
+
"borderBottomColor",
|
|
946
|
+
"borderTopWidth",
|
|
947
|
+
"borderTopColor",
|
|
948
|
+
"borderLeftWidth",
|
|
949
|
+
"borderLeftColor",
|
|
950
|
+
"borderRightWidth",
|
|
951
|
+
"borderRightColor",
|
|
952
|
+
"borderRadius",
|
|
953
|
+
"borderStyle",
|
|
954
|
+
"flexDirection",
|
|
955
|
+
"flexWrap",
|
|
956
|
+
"alignItems",
|
|
957
|
+
"justifyContent",
|
|
958
|
+
"alignSelf",
|
|
959
|
+
"flex",
|
|
960
|
+
"flexShrink",
|
|
961
|
+
"gap",
|
|
962
|
+
"position",
|
|
963
|
+
"top",
|
|
964
|
+
"bottom",
|
|
965
|
+
"left",
|
|
966
|
+
"right",
|
|
967
|
+
"outline",
|
|
968
|
+
"overflow",
|
|
969
|
+
"overflowX",
|
|
970
|
+
"overflowY",
|
|
971
|
+
"zIndex",
|
|
972
|
+
"cursor",
|
|
973
|
+
"padding",
|
|
974
|
+
"paddingHorizontal",
|
|
975
|
+
"paddingVertical",
|
|
976
|
+
"paddingTop",
|
|
977
|
+
"paddingBottom",
|
|
978
|
+
"paddingLeft",
|
|
979
|
+
"paddingRight",
|
|
980
|
+
"margin",
|
|
981
|
+
"marginTop",
|
|
982
|
+
"marginBottom",
|
|
983
|
+
"marginLeft",
|
|
984
|
+
"marginRight",
|
|
985
|
+
"minWidth",
|
|
986
|
+
"minHeight",
|
|
987
|
+
"maxWidth",
|
|
988
|
+
"maxHeight",
|
|
989
|
+
"hoverStyle",
|
|
990
|
+
"pressStyle",
|
|
991
|
+
"focusStyle",
|
|
992
|
+
"outlineColor",
|
|
993
|
+
"outlineWidth",
|
|
994
|
+
"outlineOffset",
|
|
995
|
+
"outlineStyle",
|
|
996
|
+
// BoxProps — RN-only
|
|
997
|
+
"onPress",
|
|
998
|
+
"onLayout",
|
|
999
|
+
"onMoveShouldSetResponder",
|
|
1000
|
+
"onResponderGrant",
|
|
1001
|
+
"onResponderMove",
|
|
1002
|
+
"onResponderRelease",
|
|
1003
|
+
"onResponderTerminate",
|
|
1004
|
+
"testID",
|
|
1005
|
+
// Box — custom element type
|
|
1006
|
+
"elementType",
|
|
1007
|
+
// TextProps
|
|
1008
|
+
"fontSize",
|
|
1009
|
+
"fontWeight",
|
|
1010
|
+
"fontFamily",
|
|
1011
|
+
"lineHeight",
|
|
1012
|
+
"whiteSpace",
|
|
1013
|
+
"textAlign",
|
|
1014
|
+
"textDecoration",
|
|
1015
|
+
"numberOfLines",
|
|
1016
|
+
"letterSpacing",
|
|
1017
|
+
"textTransform",
|
|
1018
|
+
// SpinnerProps
|
|
1019
|
+
"strokeWidth",
|
|
1020
|
+
// DividerProps
|
|
1021
|
+
"vertical",
|
|
1022
|
+
"dashStroke"
|
|
1023
|
+
]);
|
|
1024
|
+
function createFilteredElement2(defaultTag) {
|
|
1025
|
+
const Component = import_react6.default.forwardRef(
|
|
1026
|
+
({ children, elementType, ...props }, ref) => {
|
|
1027
|
+
const Tag2 = elementType || defaultTag;
|
|
1028
|
+
const htmlProps = {};
|
|
1029
|
+
for (const key of Object.keys(props)) {
|
|
1030
|
+
if (!NON_HTML_PROPS2.has(key)) {
|
|
1031
|
+
htmlProps[key] = props[key];
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
return import_react6.default.createElement(Tag2, { ref, ...htmlProps }, children);
|
|
1035
|
+
}
|
|
1036
|
+
);
|
|
1037
|
+
Component.displayName = `Filtered(${defaultTag})`;
|
|
1038
|
+
return Component;
|
|
1039
|
+
}
|
|
1040
|
+
var FilteredDiv2 = createFilteredElement2("div");
|
|
1041
|
+
var StyledBox2 = (0, import_styled_components6.default)(FilteredDiv2)`
|
|
836
1042
|
display: flex;
|
|
837
1043
|
box-sizing: border-box;
|
|
838
1044
|
background-color: ${(props) => props.backgroundColor || "transparent"};
|
|
@@ -919,7 +1125,7 @@ var StyledBox2 = import_styled_components6.default.div`
|
|
|
919
1125
|
${(props) => props.pressStyle?.backgroundColor && `background-color: ${props.pressStyle.backgroundColor};`}
|
|
920
1126
|
}
|
|
921
1127
|
`;
|
|
922
|
-
var Box2 =
|
|
1128
|
+
var Box2 = import_react5.default.forwardRef(
|
|
923
1129
|
({
|
|
924
1130
|
children,
|
|
925
1131
|
onPress,
|
|
@@ -971,7 +1177,7 @@ var Box2 = import_react4.default.forwardRef(
|
|
|
971
1177
|
StyledBox2,
|
|
972
1178
|
{
|
|
973
1179
|
ref,
|
|
974
|
-
as,
|
|
1180
|
+
elementType: as,
|
|
975
1181
|
id,
|
|
976
1182
|
type: as === "button" ? type || "button" : void 0,
|
|
977
1183
|
disabled: as === "button" ? disabled : void 0,
|
|
@@ -998,7 +1204,8 @@ var Box2 = import_react4.default.forwardRef(
|
|
|
998
1204
|
}
|
|
999
1205
|
);
|
|
1000
1206
|
Box2.displayName = "Box";
|
|
1001
|
-
var
|
|
1207
|
+
var FilteredSpan = createFilteredElement2("span");
|
|
1208
|
+
var StyledText2 = (0, import_styled_components7.default)(FilteredSpan)`
|
|
1002
1209
|
color: ${(props) => props.color || "inherit"};
|
|
1003
1210
|
font-size: ${(props) => typeof props.fontSize === "number" ? `${props.fontSize}px` : props.fontSize || "inherit"};
|
|
1004
1211
|
font-weight: ${(props) => props.fontWeight || "normal"};
|
|
@@ -1027,7 +1234,8 @@ var Text2 = ({
|
|
|
1027
1234
|
}
|
|
1028
1235
|
);
|
|
1029
1236
|
};
|
|
1030
|
-
var
|
|
1237
|
+
var FilteredDiv22 = createFilteredElement2("div");
|
|
1238
|
+
var StyledIcon4 = (0, import_styled_components8.default)(FilteredDiv22)`
|
|
1031
1239
|
display: flex;
|
|
1032
1240
|
align-items: center;
|
|
1033
1241
|
justify-content: center;
|
|
@@ -1199,15 +1407,15 @@ var useMultiSelectControl = ({
|
|
|
1199
1407
|
themeProductContext
|
|
1200
1408
|
}) => {
|
|
1201
1409
|
const { theme } = (0, import_xui_core2.useResolvedTheme)({ themeMode, themeProductContext });
|
|
1202
|
-
const displayStateRef = (0,
|
|
1203
|
-
const savedWidthsRef = (0,
|
|
1204
|
-
const itemsRef = (0,
|
|
1205
|
-
const [itemsWidth, setItemsWidth] = (0,
|
|
1206
|
-
const [selectedContent, setSelectedContent] = (0,
|
|
1410
|
+
const displayStateRef = (0, import_react7.useRef)(0 /* Placeholder */);
|
|
1411
|
+
const savedWidthsRef = (0, import_react7.useRef)(null);
|
|
1412
|
+
const itemsRef = (0, import_react7.useRef)(null);
|
|
1413
|
+
const [itemsWidth, setItemsWidth] = (0, import_react7.useState)(0);
|
|
1414
|
+
const [selectedContent, setSelectedContent] = (0, import_react7.useState)(
|
|
1207
1415
|
null
|
|
1208
1416
|
);
|
|
1209
1417
|
const isPlaceholder = !selectedItems || selectedItems.length === 0;
|
|
1210
|
-
(0,
|
|
1418
|
+
(0, import_react7.useEffect)(() => {
|
|
1211
1419
|
if (!containerRef.current) return;
|
|
1212
1420
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
1213
1421
|
for (const entry of entries) {
|
|
@@ -1217,7 +1425,7 @@ var useMultiSelectControl = ({
|
|
|
1217
1425
|
resizeObserver.observe(containerRef.current);
|
|
1218
1426
|
return () => resizeObserver.disconnect();
|
|
1219
1427
|
}, [containerRef]);
|
|
1220
|
-
const widthsDependencies = (0,
|
|
1428
|
+
const widthsDependencies = (0, import_react7.useMemo)(
|
|
1221
1429
|
() => ({
|
|
1222
1430
|
stateList: stateList.map((item) => item.value),
|
|
1223
1431
|
variant,
|
|
@@ -1375,7 +1583,7 @@ var useMultiSelectControl = ({
|
|
|
1375
1583
|
displayStateRef.current = 3 /* Render */;
|
|
1376
1584
|
setItemsRender();
|
|
1377
1585
|
};
|
|
1378
|
-
(0,
|
|
1586
|
+
(0, import_react7.useEffect)(() => {
|
|
1379
1587
|
if (isPlaceholder) {
|
|
1380
1588
|
displayStateRef.current = 0 /* Placeholder */;
|
|
1381
1589
|
setPlaceholder();
|
|
@@ -1409,7 +1617,7 @@ var useMultiSelectControl = ({
|
|
|
1409
1617
|
widthsDependencies,
|
|
1410
1618
|
stateList
|
|
1411
1619
|
]);
|
|
1412
|
-
(0,
|
|
1620
|
+
(0, import_react7.useEffect)(() => {
|
|
1413
1621
|
if (displayStateRef.current !== 2 /* Calculation */) return;
|
|
1414
1622
|
const rafId = requestAnimationFrame(() => {
|
|
1415
1623
|
if (displayStateRef.current === 2 /* Calculation */) {
|
|
@@ -1428,7 +1636,7 @@ var useMultiSelectControl = ({
|
|
|
1428
1636
|
|
|
1429
1637
|
// src/MultiSelectControl.tsx
|
|
1430
1638
|
var import_jsx_runtime398 = require("react/jsx-runtime");
|
|
1431
|
-
var MultiSelectControl = (0,
|
|
1639
|
+
var MultiSelectControl = (0, import_react8.forwardRef)(
|
|
1432
1640
|
({
|
|
1433
1641
|
variant = "tag",
|
|
1434
1642
|
flexible = true,
|
|
@@ -1456,7 +1664,7 @@ var MultiSelectControl = (0, import_react6.forwardRef)(
|
|
|
1456
1664
|
const inputColors = theme.colors.control.input;
|
|
1457
1665
|
const state = externalState || (disabled ? "disable" : "default");
|
|
1458
1666
|
const isDisable = state === "disable" || disabled;
|
|
1459
|
-
const containerRef = (0,
|
|
1667
|
+
const containerRef = (0, import_react8.useRef)(null);
|
|
1460
1668
|
const { itemsRef, selectedContent, isCalculating } = useMultiSelectControl({
|
|
1461
1669
|
variant,
|
|
1462
1670
|
flexible,
|
|
@@ -1579,7 +1787,7 @@ var MultiSelectControl = (0, import_react6.forwardRef)(
|
|
|
1579
1787
|
MultiSelectControl.displayName = "MultiSelectControl";
|
|
1580
1788
|
|
|
1581
1789
|
// src/useMultiSelect.ts
|
|
1582
|
-
var
|
|
1790
|
+
var import_react9 = require("react");
|
|
1583
1791
|
var initialState = {
|
|
1584
1792
|
values: [],
|
|
1585
1793
|
selectedItems: [],
|
|
@@ -1590,12 +1798,12 @@ var useMultiSelect = ({
|
|
|
1590
1798
|
value = [],
|
|
1591
1799
|
onChange
|
|
1592
1800
|
}) => {
|
|
1593
|
-
const [state, setState] = (0,
|
|
1594
|
-
const optionsRef = (0,
|
|
1595
|
-
(0,
|
|
1801
|
+
const [state, setState] = (0, import_react9.useState)(initialState);
|
|
1802
|
+
const optionsRef = (0, import_react9.useRef)(options);
|
|
1803
|
+
(0, import_react9.useEffect)(() => {
|
|
1596
1804
|
optionsRef.current = options;
|
|
1597
1805
|
}, [options]);
|
|
1598
|
-
(0,
|
|
1806
|
+
(0, import_react9.useEffect)(() => {
|
|
1599
1807
|
const selectedItems = options.filter((opt) => value.includes(opt.value));
|
|
1600
1808
|
setState((prevState) => ({
|
|
1601
1809
|
...prevState,
|
|
@@ -1603,7 +1811,7 @@ var useMultiSelect = ({
|
|
|
1603
1811
|
selectedItems
|
|
1604
1812
|
}));
|
|
1605
1813
|
}, [options, value]);
|
|
1606
|
-
const onChoose = (0,
|
|
1814
|
+
const onChoose = (0, import_react9.useCallback)(
|
|
1607
1815
|
(selectedIds) => {
|
|
1608
1816
|
const newValues = optionsRef.current.filter((opt) => selectedIds.includes(String(opt.value))).map((opt) => opt.value);
|
|
1609
1817
|
const newSelectedItems = optionsRef.current.filter(
|
|
@@ -1618,7 +1826,7 @@ var useMultiSelect = ({
|
|
|
1618
1826
|
},
|
|
1619
1827
|
[onChange]
|
|
1620
1828
|
);
|
|
1621
|
-
const onRemove = (0,
|
|
1829
|
+
const onRemove = (0, import_react9.useCallback)(
|
|
1622
1830
|
(value2, event) => {
|
|
1623
1831
|
event?.stopPropagation();
|
|
1624
1832
|
setState((prev) => {
|
|
@@ -1636,7 +1844,7 @@ var useMultiSelect = ({
|
|
|
1636
1844
|
},
|
|
1637
1845
|
[onChange]
|
|
1638
1846
|
);
|
|
1639
|
-
const onRemoveAll = (0,
|
|
1847
|
+
const onRemoveAll = (0, import_react9.useCallback)(() => {
|
|
1640
1848
|
setState((prevState) => ({
|
|
1641
1849
|
...prevState,
|
|
1642
1850
|
values: [],
|
|
@@ -1644,13 +1852,13 @@ var useMultiSelect = ({
|
|
|
1644
1852
|
}));
|
|
1645
1853
|
onChange?.([]);
|
|
1646
1854
|
}, [onChange]);
|
|
1647
|
-
const onSelectClick = (0,
|
|
1855
|
+
const onSelectClick = (0, import_react9.useCallback)(() => {
|
|
1648
1856
|
setState((prevState) => ({
|
|
1649
1857
|
...prevState,
|
|
1650
1858
|
isOpen: !prevState.isOpen
|
|
1651
1859
|
}));
|
|
1652
1860
|
}, []);
|
|
1653
|
-
const onClose = (0,
|
|
1861
|
+
const onClose = (0, import_react9.useCallback)(() => {
|
|
1654
1862
|
setState((prevState) => ({
|
|
1655
1863
|
...prevState,
|
|
1656
1864
|
isOpen: false
|
|
@@ -1671,7 +1879,7 @@ var useMultiSelect = ({
|
|
|
1671
1879
|
|
|
1672
1880
|
// src/MultiSelect.tsx
|
|
1673
1881
|
var import_jsx_runtime399 = require("react/jsx-runtime");
|
|
1674
|
-
var MultiSelect = (0,
|
|
1882
|
+
var MultiSelect = (0, import_react10.forwardRef)(
|
|
1675
1883
|
({
|
|
1676
1884
|
options,
|
|
1677
1885
|
errorMessage,
|
|
@@ -1693,8 +1901,8 @@ var MultiSelect = (0, import_react8.forwardRef)(
|
|
|
1693
1901
|
themeProductContext
|
|
1694
1902
|
}, ref) => {
|
|
1695
1903
|
const { theme } = (0, import_xui_core4.useResolvedTheme)({ themeMode, themeProductContext });
|
|
1696
|
-
const controlRef = (0,
|
|
1697
|
-
const menuRef = (0,
|
|
1904
|
+
const controlRef = (0, import_react10.useRef)(null);
|
|
1905
|
+
const menuRef = (0, import_react10.useRef)(null);
|
|
1698
1906
|
const sizeStyles = theme.sizing.input(size);
|
|
1699
1907
|
const state = externalState || (disabled ? "disable" : "default");
|
|
1700
1908
|
const isDisable = state === "disable" || disabled;
|
|
@@ -1715,7 +1923,7 @@ var MultiSelect = (0, import_react8.forwardRef)(
|
|
|
1715
1923
|
value,
|
|
1716
1924
|
onChange
|
|
1717
1925
|
});
|
|
1718
|
-
(0,
|
|
1926
|
+
(0, import_react10.useEffect)(() => {
|
|
1719
1927
|
if (isDisable) {
|
|
1720
1928
|
onClose();
|
|
1721
1929
|
}
|