@xsolla/xui-multi-select 0.136.0 → 0.138.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 +172 -43
- package/native/index.js.map +1 -1
- package/native/index.mjs +144 -15
- package/native/index.mjs.map +1 -1
- package/package.json +5 -5
- package/web/index.js +262 -56
- package/web/index.js.map +1 -1
- package/web/index.mjs +227 -21
- 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.138.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.138.0",
|
|
14
|
+
"@xsolla/xui-core": "0.138.0",
|
|
15
|
+
"@xsolla/xui-dropdown": "0.138.0",
|
|
16
|
+
"@xsolla/xui-primitives-core": "0.138.0"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"react": ">=16.8.0",
|
package/web/index.js
CHANGED
|
@@ -35,13 +35,85 @@ __export(index_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(index_exports);
|
|
36
36
|
|
|
37
37
|
// src/MultiSelect.tsx
|
|
38
|
-
var
|
|
38
|
+
var import_react11 = require("react");
|
|
39
39
|
|
|
40
40
|
// ../primitives-web/src/Box.tsx
|
|
41
|
-
var
|
|
41
|
+
var import_react2 = __toESM(require("react"));
|
|
42
42
|
var import_styled_components = __toESM(require("styled-components"));
|
|
43
|
+
|
|
44
|
+
// ../primitives-web/src/filterDOMProps.ts
|
|
45
|
+
var import_react = __toESM(require("react"));
|
|
46
|
+
|
|
47
|
+
// ../../node_modules/@emotion/memoize/dist/memoize.esm.js
|
|
48
|
+
function memoize(fn) {
|
|
49
|
+
var cache = {};
|
|
50
|
+
return function(arg) {
|
|
51
|
+
if (cache[arg] === void 0) cache[arg] = fn(arg);
|
|
52
|
+
return cache[arg];
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
var memoize_esm_default = memoize;
|
|
56
|
+
|
|
57
|
+
// ../../node_modules/@emotion/is-prop-valid/dist/is-prop-valid.esm.js
|
|
58
|
+
var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|inert|itemProp|itemScope|itemType|itemID|itemRef|on|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/;
|
|
59
|
+
var index = memoize_esm_default(
|
|
60
|
+
function(prop) {
|
|
61
|
+
return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111 && prop.charCodeAt(1) === 110 && prop.charCodeAt(2) < 91;
|
|
62
|
+
}
|
|
63
|
+
/* Z+1 */
|
|
64
|
+
);
|
|
65
|
+
var is_prop_valid_esm_default = index;
|
|
66
|
+
|
|
67
|
+
// ../primitives-web/src/filterDOMProps.ts
|
|
68
|
+
var ADDITIONAL_BLOCKED_PROPS = /* @__PURE__ */ new Set([
|
|
69
|
+
// RN-only event handlers (pass isPropValid's on* pattern)
|
|
70
|
+
"onPress",
|
|
71
|
+
"onChangeText",
|
|
72
|
+
"onLayout",
|
|
73
|
+
"onMoveShouldSetResponder",
|
|
74
|
+
"onResponderGrant",
|
|
75
|
+
"onResponderMove",
|
|
76
|
+
"onResponderRelease",
|
|
77
|
+
"onResponderTerminate",
|
|
78
|
+
// SVG attributes that pass isPropValid
|
|
79
|
+
"strokeWidth",
|
|
80
|
+
// CSS properties that pass isPropValid but are used as component props
|
|
81
|
+
"overflow",
|
|
82
|
+
"cursor",
|
|
83
|
+
"fontSize",
|
|
84
|
+
"fontWeight",
|
|
85
|
+
"fontFamily",
|
|
86
|
+
"textDecoration"
|
|
87
|
+
]);
|
|
88
|
+
function shouldForwardProp(key) {
|
|
89
|
+
if (ADDITIONAL_BLOCKED_PROPS.has(key)) return false;
|
|
90
|
+
return is_prop_valid_esm_default(key);
|
|
91
|
+
}
|
|
92
|
+
function createFilteredElement(defaultTag) {
|
|
93
|
+
const Component = import_react.default.forwardRef(
|
|
94
|
+
({ children, elementType, ...props }, ref) => {
|
|
95
|
+
const Tag2 = elementType || defaultTag;
|
|
96
|
+
const htmlProps = {};
|
|
97
|
+
for (const key of Object.keys(props)) {
|
|
98
|
+
if (shouldForwardProp(key)) {
|
|
99
|
+
htmlProps[key] = props[key];
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return import_react.default.createElement(
|
|
103
|
+
Tag2,
|
|
104
|
+
{ ref, ...htmlProps },
|
|
105
|
+
children
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
Component.displayName = `Filtered(${defaultTag})`;
|
|
110
|
+
return Component;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// ../primitives-web/src/Box.tsx
|
|
43
114
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
44
|
-
var
|
|
115
|
+
var FilteredDiv = createFilteredElement("div");
|
|
116
|
+
var StyledBox = (0, import_styled_components.default)(FilteredDiv)`
|
|
45
117
|
display: flex;
|
|
46
118
|
box-sizing: border-box;
|
|
47
119
|
background-color: ${(props) => props.backgroundColor || "transparent"};
|
|
@@ -128,7 +200,7 @@ var StyledBox = import_styled_components.default.div`
|
|
|
128
200
|
${(props) => props.pressStyle?.backgroundColor && `background-color: ${props.pressStyle.backgroundColor};`}
|
|
129
201
|
}
|
|
130
202
|
`;
|
|
131
|
-
var Box =
|
|
203
|
+
var Box = import_react2.default.forwardRef(
|
|
132
204
|
({
|
|
133
205
|
children,
|
|
134
206
|
onPress,
|
|
@@ -153,6 +225,8 @@ var Box = import_react.default.forwardRef(
|
|
|
153
225
|
type,
|
|
154
226
|
disabled,
|
|
155
227
|
id,
|
|
228
|
+
testID,
|
|
229
|
+
"data-testid": dataTestId,
|
|
156
230
|
...props
|
|
157
231
|
}, ref) => {
|
|
158
232
|
if (as === "img" && src) {
|
|
@@ -180,7 +254,7 @@ var Box = import_react.default.forwardRef(
|
|
|
180
254
|
StyledBox,
|
|
181
255
|
{
|
|
182
256
|
ref,
|
|
183
|
-
as,
|
|
257
|
+
elementType: as,
|
|
184
258
|
id,
|
|
185
259
|
type: as === "button" ? type || "button" : void 0,
|
|
186
260
|
disabled: as === "button" ? disabled : void 0,
|
|
@@ -200,6 +274,7 @@ var Box = import_react.default.forwardRef(
|
|
|
200
274
|
"aria-controls": ariaControls,
|
|
201
275
|
"aria-live": ariaLive,
|
|
202
276
|
tabIndex: tabIndex !== void 0 ? tabIndex : void 0,
|
|
277
|
+
"data-testid": dataTestId || testID,
|
|
203
278
|
...props,
|
|
204
279
|
children
|
|
205
280
|
}
|
|
@@ -211,7 +286,8 @@ Box.displayName = "Box";
|
|
|
211
286
|
// ../primitives-web/src/Text.tsx
|
|
212
287
|
var import_styled_components2 = __toESM(require("styled-components"));
|
|
213
288
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
214
|
-
var
|
|
289
|
+
var FilteredSpan = createFilteredElement("span");
|
|
290
|
+
var StyledText = (0, import_styled_components2.default)(FilteredSpan)`
|
|
215
291
|
color: ${(props) => props.color || "inherit"};
|
|
216
292
|
font-size: ${(props) => typeof props.fontSize === "number" ? `${props.fontSize}px` : props.fontSize || "inherit"};
|
|
217
293
|
font-weight: ${(props) => props.fontWeight || "normal"};
|
|
@@ -244,7 +320,8 @@ var Text = ({
|
|
|
244
320
|
// ../primitives-web/src/Icon.tsx
|
|
245
321
|
var import_styled_components3 = __toESM(require("styled-components"));
|
|
246
322
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
247
|
-
var
|
|
323
|
+
var FilteredDiv2 = createFilteredElement("div");
|
|
324
|
+
var StyledIcon = (0, import_styled_components3.default)(FilteredDiv2)`
|
|
248
325
|
display: flex;
|
|
249
326
|
align-items: center;
|
|
250
327
|
justify-content: center;
|
|
@@ -267,7 +344,7 @@ var Icon = ({ children, ...props }) => {
|
|
|
267
344
|
var import_xui_core4 = require("@xsolla/xui-core");
|
|
268
345
|
|
|
269
346
|
// src/MultiSelectControl.tsx
|
|
270
|
-
var
|
|
347
|
+
var import_react9 = require("react");
|
|
271
348
|
var import_xui_core3 = require("@xsolla/xui-core");
|
|
272
349
|
|
|
273
350
|
// ../icons-base/dist/web/index.mjs
|
|
@@ -715,11 +792,12 @@ var lineContent113 = `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.
|
|
|
715
792
|
var Remove = (props) => /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(BaseIcon, { ...props, solidContent: solidContent113, lineContent: lineContent113 });
|
|
716
793
|
|
|
717
794
|
// src/useMultiSelectControl.tsx
|
|
718
|
-
var
|
|
795
|
+
var import_react8 = require("react");
|
|
719
796
|
|
|
720
797
|
// ../tag/dist/web/index.mjs
|
|
721
|
-
var
|
|
798
|
+
var import_react6 = __toESM(require("react"), 1);
|
|
722
799
|
var import_styled_components6 = __toESM(require("styled-components"), 1);
|
|
800
|
+
var import_react7 = __toESM(require("react"), 1);
|
|
723
801
|
var import_jsx_runtime393 = require("react/jsx-runtime");
|
|
724
802
|
var import_styled_components7 = __toESM(require("styled-components"), 1);
|
|
725
803
|
var import_jsx_runtime394 = require("react/jsx-runtime");
|
|
@@ -728,20 +806,21 @@ var import_jsx_runtime395 = require("react/jsx-runtime");
|
|
|
728
806
|
var import_xui_core = require("@xsolla/xui-core");
|
|
729
807
|
|
|
730
808
|
// ../icons/dist/web/index.mjs
|
|
809
|
+
var import_react5 = __toESM(require("react"), 1);
|
|
731
810
|
var import_styled_components5 = __toESM(require("styled-components"), 1);
|
|
732
811
|
var import_jsx_runtime391 = require("react/jsx-runtime");
|
|
733
812
|
|
|
734
813
|
// ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
|
|
735
|
-
var
|
|
814
|
+
var import_react4 = require("react");
|
|
736
815
|
|
|
737
816
|
// ../../node_modules/lucide-react/dist/esm/shared/src/utils.js
|
|
738
817
|
var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
739
|
-
var mergeClasses = (...classes) => classes.filter((className,
|
|
740
|
-
return Boolean(className) && className.trim() !== "" && array.indexOf(className) ===
|
|
818
|
+
var mergeClasses = (...classes) => classes.filter((className, index4, array) => {
|
|
819
|
+
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index4;
|
|
741
820
|
}).join(" ").trim();
|
|
742
821
|
|
|
743
822
|
// ../../node_modules/lucide-react/dist/esm/Icon.js
|
|
744
|
-
var
|
|
823
|
+
var import_react3 = require("react");
|
|
745
824
|
|
|
746
825
|
// ../../node_modules/lucide-react/dist/esm/defaultAttributes.js
|
|
747
826
|
var defaultAttributes = {
|
|
@@ -757,7 +836,7 @@ var defaultAttributes = {
|
|
|
757
836
|
};
|
|
758
837
|
|
|
759
838
|
// ../../node_modules/lucide-react/dist/esm/Icon.js
|
|
760
|
-
var Icon2 = (0,
|
|
839
|
+
var Icon2 = (0, import_react3.forwardRef)(
|
|
761
840
|
({
|
|
762
841
|
color = "currentColor",
|
|
763
842
|
size = 24,
|
|
@@ -768,7 +847,7 @@ var Icon2 = (0, import_react2.forwardRef)(
|
|
|
768
847
|
iconNode,
|
|
769
848
|
...rest
|
|
770
849
|
}, ref) => {
|
|
771
|
-
return (0,
|
|
850
|
+
return (0, import_react3.createElement)(
|
|
772
851
|
"svg",
|
|
773
852
|
{
|
|
774
853
|
ref,
|
|
@@ -781,7 +860,7 @@ var Icon2 = (0, import_react2.forwardRef)(
|
|
|
781
860
|
...rest
|
|
782
861
|
},
|
|
783
862
|
[
|
|
784
|
-
...iconNode.map(([tag, attrs]) => (0,
|
|
863
|
+
...iconNode.map(([tag, attrs]) => (0, import_react3.createElement)(tag, attrs)),
|
|
785
864
|
...Array.isArray(children) ? children : [children]
|
|
786
865
|
]
|
|
787
866
|
);
|
|
@@ -790,8 +869,8 @@ var Icon2 = (0, import_react2.forwardRef)(
|
|
|
790
869
|
|
|
791
870
|
// ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
|
|
792
871
|
var createLucideIcon = (iconName, iconNode) => {
|
|
793
|
-
const Component = (0,
|
|
794
|
-
({ className, ...props }, ref) => (0,
|
|
872
|
+
const Component = (0, import_react4.forwardRef)(
|
|
873
|
+
({ className, ...props }, ref) => (0, import_react4.createElement)(Icon2, {
|
|
795
874
|
ref,
|
|
796
875
|
iconNode,
|
|
797
876
|
className: mergeClasses(`lucide-${toKebabCase(iconName)}`, className),
|
|
@@ -810,7 +889,68 @@ var X = createLucideIcon("X", [
|
|
|
810
889
|
|
|
811
890
|
// ../icons/dist/web/index.mjs
|
|
812
891
|
var import_jsx_runtime392 = require("react/jsx-runtime");
|
|
813
|
-
|
|
892
|
+
function memoize2(fn) {
|
|
893
|
+
var cache = {};
|
|
894
|
+
return function(arg) {
|
|
895
|
+
if (cache[arg] === void 0) cache[arg] = fn(arg);
|
|
896
|
+
return cache[arg];
|
|
897
|
+
};
|
|
898
|
+
}
|
|
899
|
+
var memoize_esm_default2 = memoize2;
|
|
900
|
+
var reactPropsRegex2 = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|inert|itemProp|itemScope|itemType|itemID|itemRef|on|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/;
|
|
901
|
+
var index2 = memoize_esm_default2(
|
|
902
|
+
function(prop) {
|
|
903
|
+
return reactPropsRegex2.test(prop) || prop.charCodeAt(0) === 111 && prop.charCodeAt(1) === 110 && prop.charCodeAt(2) < 91;
|
|
904
|
+
}
|
|
905
|
+
/* Z+1 */
|
|
906
|
+
);
|
|
907
|
+
var is_prop_valid_esm_default2 = index2;
|
|
908
|
+
var ADDITIONAL_BLOCKED_PROPS2 = /* @__PURE__ */ new Set([
|
|
909
|
+
// RN-only event handlers (pass isPropValid's on* pattern)
|
|
910
|
+
"onPress",
|
|
911
|
+
"onChangeText",
|
|
912
|
+
"onLayout",
|
|
913
|
+
"onMoveShouldSetResponder",
|
|
914
|
+
"onResponderGrant",
|
|
915
|
+
"onResponderMove",
|
|
916
|
+
"onResponderRelease",
|
|
917
|
+
"onResponderTerminate",
|
|
918
|
+
// SVG attributes that pass isPropValid
|
|
919
|
+
"strokeWidth",
|
|
920
|
+
// CSS properties that pass isPropValid but are used as component props
|
|
921
|
+
"overflow",
|
|
922
|
+
"cursor",
|
|
923
|
+
"fontSize",
|
|
924
|
+
"fontWeight",
|
|
925
|
+
"fontFamily",
|
|
926
|
+
"textDecoration"
|
|
927
|
+
]);
|
|
928
|
+
function shouldForwardProp2(key) {
|
|
929
|
+
if (ADDITIONAL_BLOCKED_PROPS2.has(key)) return false;
|
|
930
|
+
return is_prop_valid_esm_default2(key);
|
|
931
|
+
}
|
|
932
|
+
function createFilteredElement2(defaultTag) {
|
|
933
|
+
const Component = import_react5.default.forwardRef(
|
|
934
|
+
({ children, elementType, ...props }, ref) => {
|
|
935
|
+
const Tag2 = elementType || defaultTag;
|
|
936
|
+
const htmlProps = {};
|
|
937
|
+
for (const key of Object.keys(props)) {
|
|
938
|
+
if (shouldForwardProp2(key)) {
|
|
939
|
+
htmlProps[key] = props[key];
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
return import_react5.default.createElement(
|
|
943
|
+
Tag2,
|
|
944
|
+
{ ref, ...htmlProps },
|
|
945
|
+
children
|
|
946
|
+
);
|
|
947
|
+
}
|
|
948
|
+
);
|
|
949
|
+
Component.displayName = `Filtered(${defaultTag})`;
|
|
950
|
+
return Component;
|
|
951
|
+
}
|
|
952
|
+
var FilteredDiv3 = createFilteredElement2("div");
|
|
953
|
+
var StyledIcon3 = (0, import_styled_components5.default)(FilteredDiv3)`
|
|
814
954
|
display: flex;
|
|
815
955
|
align-items: center;
|
|
816
956
|
justify-content: center;
|
|
@@ -832,7 +972,68 @@ var X2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime392.jsx)(Icon3, { ...p
|
|
|
832
972
|
|
|
833
973
|
// ../tag/dist/web/index.mjs
|
|
834
974
|
var import_jsx_runtime396 = require("react/jsx-runtime");
|
|
835
|
-
|
|
975
|
+
function memoize3(fn) {
|
|
976
|
+
var cache = {};
|
|
977
|
+
return function(arg) {
|
|
978
|
+
if (cache[arg] === void 0) cache[arg] = fn(arg);
|
|
979
|
+
return cache[arg];
|
|
980
|
+
};
|
|
981
|
+
}
|
|
982
|
+
var memoize_esm_default3 = memoize3;
|
|
983
|
+
var reactPropsRegex3 = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|inert|itemProp|itemScope|itemType|itemID|itemRef|on|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/;
|
|
984
|
+
var index3 = memoize_esm_default3(
|
|
985
|
+
function(prop) {
|
|
986
|
+
return reactPropsRegex3.test(prop) || prop.charCodeAt(0) === 111 && prop.charCodeAt(1) === 110 && prop.charCodeAt(2) < 91;
|
|
987
|
+
}
|
|
988
|
+
/* Z+1 */
|
|
989
|
+
);
|
|
990
|
+
var is_prop_valid_esm_default3 = index3;
|
|
991
|
+
var ADDITIONAL_BLOCKED_PROPS3 = /* @__PURE__ */ new Set([
|
|
992
|
+
// RN-only event handlers (pass isPropValid's on* pattern)
|
|
993
|
+
"onPress",
|
|
994
|
+
"onChangeText",
|
|
995
|
+
"onLayout",
|
|
996
|
+
"onMoveShouldSetResponder",
|
|
997
|
+
"onResponderGrant",
|
|
998
|
+
"onResponderMove",
|
|
999
|
+
"onResponderRelease",
|
|
1000
|
+
"onResponderTerminate",
|
|
1001
|
+
// SVG attributes that pass isPropValid
|
|
1002
|
+
"strokeWidth",
|
|
1003
|
+
// CSS properties that pass isPropValid but are used as component props
|
|
1004
|
+
"overflow",
|
|
1005
|
+
"cursor",
|
|
1006
|
+
"fontSize",
|
|
1007
|
+
"fontWeight",
|
|
1008
|
+
"fontFamily",
|
|
1009
|
+
"textDecoration"
|
|
1010
|
+
]);
|
|
1011
|
+
function shouldForwardProp3(key) {
|
|
1012
|
+
if (ADDITIONAL_BLOCKED_PROPS3.has(key)) return false;
|
|
1013
|
+
return is_prop_valid_esm_default3(key);
|
|
1014
|
+
}
|
|
1015
|
+
function createFilteredElement3(defaultTag) {
|
|
1016
|
+
const Component = import_react7.default.forwardRef(
|
|
1017
|
+
({ children, elementType, ...props }, ref) => {
|
|
1018
|
+
const Tag2 = elementType || defaultTag;
|
|
1019
|
+
const htmlProps = {};
|
|
1020
|
+
for (const key of Object.keys(props)) {
|
|
1021
|
+
if (shouldForwardProp3(key)) {
|
|
1022
|
+
htmlProps[key] = props[key];
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
return import_react7.default.createElement(
|
|
1026
|
+
Tag2,
|
|
1027
|
+
{ ref, ...htmlProps },
|
|
1028
|
+
children
|
|
1029
|
+
);
|
|
1030
|
+
}
|
|
1031
|
+
);
|
|
1032
|
+
Component.displayName = `Filtered(${defaultTag})`;
|
|
1033
|
+
return Component;
|
|
1034
|
+
}
|
|
1035
|
+
var FilteredDiv4 = createFilteredElement3("div");
|
|
1036
|
+
var StyledBox2 = (0, import_styled_components6.default)(FilteredDiv4)`
|
|
836
1037
|
display: flex;
|
|
837
1038
|
box-sizing: border-box;
|
|
838
1039
|
background-color: ${(props) => props.backgroundColor || "transparent"};
|
|
@@ -919,7 +1120,7 @@ var StyledBox2 = import_styled_components6.default.div`
|
|
|
919
1120
|
${(props) => props.pressStyle?.backgroundColor && `background-color: ${props.pressStyle.backgroundColor};`}
|
|
920
1121
|
}
|
|
921
1122
|
`;
|
|
922
|
-
var Box2 =
|
|
1123
|
+
var Box2 = import_react6.default.forwardRef(
|
|
923
1124
|
({
|
|
924
1125
|
children,
|
|
925
1126
|
onPress,
|
|
@@ -944,6 +1145,8 @@ var Box2 = import_react4.default.forwardRef(
|
|
|
944
1145
|
type,
|
|
945
1146
|
disabled,
|
|
946
1147
|
id,
|
|
1148
|
+
testID,
|
|
1149
|
+
"data-testid": dataTestId,
|
|
947
1150
|
...props
|
|
948
1151
|
}, ref) => {
|
|
949
1152
|
if (as === "img" && src) {
|
|
@@ -971,7 +1174,7 @@ var Box2 = import_react4.default.forwardRef(
|
|
|
971
1174
|
StyledBox2,
|
|
972
1175
|
{
|
|
973
1176
|
ref,
|
|
974
|
-
as,
|
|
1177
|
+
elementType: as,
|
|
975
1178
|
id,
|
|
976
1179
|
type: as === "button" ? type || "button" : void 0,
|
|
977
1180
|
disabled: as === "button" ? disabled : void 0,
|
|
@@ -991,6 +1194,7 @@ var Box2 = import_react4.default.forwardRef(
|
|
|
991
1194
|
"aria-controls": ariaControls,
|
|
992
1195
|
"aria-live": ariaLive,
|
|
993
1196
|
tabIndex: tabIndex !== void 0 ? tabIndex : void 0,
|
|
1197
|
+
"data-testid": dataTestId || testID,
|
|
994
1198
|
...props,
|
|
995
1199
|
children
|
|
996
1200
|
}
|
|
@@ -998,7 +1202,8 @@ var Box2 = import_react4.default.forwardRef(
|
|
|
998
1202
|
}
|
|
999
1203
|
);
|
|
1000
1204
|
Box2.displayName = "Box";
|
|
1001
|
-
var
|
|
1205
|
+
var FilteredSpan2 = createFilteredElement3("span");
|
|
1206
|
+
var StyledText2 = (0, import_styled_components7.default)(FilteredSpan2)`
|
|
1002
1207
|
color: ${(props) => props.color || "inherit"};
|
|
1003
1208
|
font-size: ${(props) => typeof props.fontSize === "number" ? `${props.fontSize}px` : props.fontSize || "inherit"};
|
|
1004
1209
|
font-weight: ${(props) => props.fontWeight || "normal"};
|
|
@@ -1027,7 +1232,8 @@ var Text2 = ({
|
|
|
1027
1232
|
}
|
|
1028
1233
|
);
|
|
1029
1234
|
};
|
|
1030
|
-
var
|
|
1235
|
+
var FilteredDiv22 = createFilteredElement3("div");
|
|
1236
|
+
var StyledIcon4 = (0, import_styled_components8.default)(FilteredDiv22)`
|
|
1031
1237
|
display: flex;
|
|
1032
1238
|
align-items: center;
|
|
1033
1239
|
justify-content: center;
|
|
@@ -1175,15 +1381,15 @@ var useMultiSelectControl = ({
|
|
|
1175
1381
|
themeProductContext
|
|
1176
1382
|
}) => {
|
|
1177
1383
|
const { theme } = (0, import_xui_core2.useResolvedTheme)({ themeMode, themeProductContext });
|
|
1178
|
-
const displayStateRef = (0,
|
|
1179
|
-
const savedWidthsRef = (0,
|
|
1180
|
-
const itemsRef = (0,
|
|
1181
|
-
const [itemsWidth, setItemsWidth] = (0,
|
|
1182
|
-
const [selectedContent, setSelectedContent] = (0,
|
|
1384
|
+
const displayStateRef = (0, import_react8.useRef)(0 /* Placeholder */);
|
|
1385
|
+
const savedWidthsRef = (0, import_react8.useRef)(null);
|
|
1386
|
+
const itemsRef = (0, import_react8.useRef)(null);
|
|
1387
|
+
const [itemsWidth, setItemsWidth] = (0, import_react8.useState)(0);
|
|
1388
|
+
const [selectedContent, setSelectedContent] = (0, import_react8.useState)(
|
|
1183
1389
|
null
|
|
1184
1390
|
);
|
|
1185
1391
|
const isPlaceholder = !selectedItems || selectedItems.length === 0;
|
|
1186
|
-
(0,
|
|
1392
|
+
(0, import_react8.useEffect)(() => {
|
|
1187
1393
|
if (!containerRef.current) return;
|
|
1188
1394
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
1189
1395
|
for (const entry of entries) {
|
|
@@ -1193,7 +1399,7 @@ var useMultiSelectControl = ({
|
|
|
1193
1399
|
resizeObserver.observe(containerRef.current);
|
|
1194
1400
|
return () => resizeObserver.disconnect();
|
|
1195
1401
|
}, [containerRef]);
|
|
1196
|
-
const widthsDependencies = (0,
|
|
1402
|
+
const widthsDependencies = (0, import_react8.useMemo)(
|
|
1197
1403
|
() => ({
|
|
1198
1404
|
stateList: stateList.map((item) => item.value),
|
|
1199
1405
|
variant,
|
|
@@ -1267,9 +1473,9 @@ var useMultiSelectControl = ({
|
|
|
1267
1473
|
const countText = displayStateRef.current === 1 /* PreRender */ ? `+${itemsList.length}` : `+${itemsList.length - displayedItems.length}`;
|
|
1268
1474
|
displayedItems.push({ value: COUNT_ITEM_VALUE, label: countText });
|
|
1269
1475
|
}
|
|
1270
|
-
const content = displayedItems.map((item,
|
|
1476
|
+
const content = displayedItems.map((item, index4) => {
|
|
1271
1477
|
const isCount = item.value === COUNT_ITEM_VALUE;
|
|
1272
|
-
const isReducable =
|
|
1478
|
+
const isReducable = index4 === 0 && displayStateRef.current === 3 /* Render */ && displayedItemsCount === 0 || flexible;
|
|
1273
1479
|
if (variant === "tag") {
|
|
1274
1480
|
return /* @__PURE__ */ (0, import_jsx_runtime397.jsx)(
|
|
1275
1481
|
Box,
|
|
@@ -1300,7 +1506,7 @@ var useMultiSelectControl = ({
|
|
|
1300
1506
|
);
|
|
1301
1507
|
}
|
|
1302
1508
|
const isCountItem = hasHidden;
|
|
1303
|
-
const needsComma =
|
|
1509
|
+
const needsComma = index4 < displayedItems.length - 2 || index4 < displayedItems.length - 1 && !isCountItem;
|
|
1304
1510
|
return /* @__PURE__ */ (0, import_jsx_runtime397.jsxs)(
|
|
1305
1511
|
Text,
|
|
1306
1512
|
{
|
|
@@ -1336,11 +1542,11 @@ var useMultiSelectControl = ({
|
|
|
1336
1542
|
const countItemWidth = countEl.getBoundingClientRect().width;
|
|
1337
1543
|
const columnGap = parseInt(getComputedStyle(itemsRef.current).columnGap || "0", 10) || 0;
|
|
1338
1544
|
const tagsWidths = {};
|
|
1339
|
-
let
|
|
1545
|
+
let index4 = 0;
|
|
1340
1546
|
for (const el of allItems) {
|
|
1341
|
-
const key =
|
|
1547
|
+
const key = index4 < allItems.length - 1 ? stateList[index4].value : COUNT_ITEM_VALUE;
|
|
1342
1548
|
tagsWidths[key] = el.getBoundingClientRect().width;
|
|
1343
|
-
|
|
1549
|
+
index4++;
|
|
1344
1550
|
}
|
|
1345
1551
|
savedWidthsRef.current = {
|
|
1346
1552
|
tagsWidths,
|
|
@@ -1351,7 +1557,7 @@ var useMultiSelectControl = ({
|
|
|
1351
1557
|
displayStateRef.current = 3 /* Render */;
|
|
1352
1558
|
setItemsRender();
|
|
1353
1559
|
};
|
|
1354
|
-
(0,
|
|
1560
|
+
(0, import_react8.useEffect)(() => {
|
|
1355
1561
|
if (isPlaceholder) {
|
|
1356
1562
|
displayStateRef.current = 0 /* Placeholder */;
|
|
1357
1563
|
setPlaceholder();
|
|
@@ -1385,7 +1591,7 @@ var useMultiSelectControl = ({
|
|
|
1385
1591
|
widthsDependencies,
|
|
1386
1592
|
stateList
|
|
1387
1593
|
]);
|
|
1388
|
-
(0,
|
|
1594
|
+
(0, import_react8.useEffect)(() => {
|
|
1389
1595
|
if (displayStateRef.current !== 2 /* Calculation */) return;
|
|
1390
1596
|
const rafId = requestAnimationFrame(() => {
|
|
1391
1597
|
if (displayStateRef.current === 2 /* Calculation */) {
|
|
@@ -1404,7 +1610,7 @@ var useMultiSelectControl = ({
|
|
|
1404
1610
|
|
|
1405
1611
|
// src/MultiSelectControl.tsx
|
|
1406
1612
|
var import_jsx_runtime398 = require("react/jsx-runtime");
|
|
1407
|
-
var MultiSelectControl = (0,
|
|
1613
|
+
var MultiSelectControl = (0, import_react9.forwardRef)(
|
|
1408
1614
|
({
|
|
1409
1615
|
variant = "tag",
|
|
1410
1616
|
flexible = true,
|
|
@@ -1432,7 +1638,7 @@ var MultiSelectControl = (0, import_react6.forwardRef)(
|
|
|
1432
1638
|
const inputColors = theme.colors.control.input;
|
|
1433
1639
|
const state = externalState || (disabled ? "disable" : "default");
|
|
1434
1640
|
const isDisable = state === "disable" || disabled;
|
|
1435
|
-
const containerRef = (0,
|
|
1641
|
+
const containerRef = (0, import_react9.useRef)(null);
|
|
1436
1642
|
const { itemsRef, selectedContent, isCalculating } = useMultiSelectControl({
|
|
1437
1643
|
variant,
|
|
1438
1644
|
flexible,
|
|
@@ -1555,7 +1761,7 @@ var MultiSelectControl = (0, import_react6.forwardRef)(
|
|
|
1555
1761
|
MultiSelectControl.displayName = "MultiSelectControl";
|
|
1556
1762
|
|
|
1557
1763
|
// src/useMultiSelect.ts
|
|
1558
|
-
var
|
|
1764
|
+
var import_react10 = require("react");
|
|
1559
1765
|
var initialState = {
|
|
1560
1766
|
values: [],
|
|
1561
1767
|
selectedItems: [],
|
|
@@ -1566,12 +1772,12 @@ var useMultiSelect = ({
|
|
|
1566
1772
|
value = [],
|
|
1567
1773
|
onChange
|
|
1568
1774
|
}) => {
|
|
1569
|
-
const [state, setState] = (0,
|
|
1570
|
-
const optionsRef = (0,
|
|
1571
|
-
(0,
|
|
1775
|
+
const [state, setState] = (0, import_react10.useState)(initialState);
|
|
1776
|
+
const optionsRef = (0, import_react10.useRef)(options);
|
|
1777
|
+
(0, import_react10.useEffect)(() => {
|
|
1572
1778
|
optionsRef.current = options;
|
|
1573
1779
|
}, [options]);
|
|
1574
|
-
(0,
|
|
1780
|
+
(0, import_react10.useEffect)(() => {
|
|
1575
1781
|
const selectedItems = options.filter((opt) => value.includes(opt.value));
|
|
1576
1782
|
setState((prevState) => ({
|
|
1577
1783
|
...prevState,
|
|
@@ -1579,7 +1785,7 @@ var useMultiSelect = ({
|
|
|
1579
1785
|
selectedItems
|
|
1580
1786
|
}));
|
|
1581
1787
|
}, [options, value]);
|
|
1582
|
-
const onChoose = (0,
|
|
1788
|
+
const onChoose = (0, import_react10.useCallback)(
|
|
1583
1789
|
(selectedIds) => {
|
|
1584
1790
|
const newValues = optionsRef.current.filter((opt) => selectedIds.includes(String(opt.value))).map((opt) => opt.value);
|
|
1585
1791
|
const newSelectedItems = optionsRef.current.filter(
|
|
@@ -1594,7 +1800,7 @@ var useMultiSelect = ({
|
|
|
1594
1800
|
},
|
|
1595
1801
|
[onChange]
|
|
1596
1802
|
);
|
|
1597
|
-
const onRemove = (0,
|
|
1803
|
+
const onRemove = (0, import_react10.useCallback)(
|
|
1598
1804
|
(value2, event) => {
|
|
1599
1805
|
event?.stopPropagation();
|
|
1600
1806
|
setState((prev) => {
|
|
@@ -1612,7 +1818,7 @@ var useMultiSelect = ({
|
|
|
1612
1818
|
},
|
|
1613
1819
|
[onChange]
|
|
1614
1820
|
);
|
|
1615
|
-
const onRemoveAll = (0,
|
|
1821
|
+
const onRemoveAll = (0, import_react10.useCallback)(() => {
|
|
1616
1822
|
setState((prevState) => ({
|
|
1617
1823
|
...prevState,
|
|
1618
1824
|
values: [],
|
|
@@ -1620,13 +1826,13 @@ var useMultiSelect = ({
|
|
|
1620
1826
|
}));
|
|
1621
1827
|
onChange?.([]);
|
|
1622
1828
|
}, [onChange]);
|
|
1623
|
-
const onSelectClick = (0,
|
|
1829
|
+
const onSelectClick = (0, import_react10.useCallback)(() => {
|
|
1624
1830
|
setState((prevState) => ({
|
|
1625
1831
|
...prevState,
|
|
1626
1832
|
isOpen: !prevState.isOpen
|
|
1627
1833
|
}));
|
|
1628
1834
|
}, []);
|
|
1629
|
-
const onClose = (0,
|
|
1835
|
+
const onClose = (0, import_react10.useCallback)(() => {
|
|
1630
1836
|
setState((prevState) => ({
|
|
1631
1837
|
...prevState,
|
|
1632
1838
|
isOpen: false
|
|
@@ -1647,7 +1853,7 @@ var useMultiSelect = ({
|
|
|
1647
1853
|
|
|
1648
1854
|
// src/MultiSelect.tsx
|
|
1649
1855
|
var import_jsx_runtime399 = require("react/jsx-runtime");
|
|
1650
|
-
var MultiSelect = (0,
|
|
1856
|
+
var MultiSelect = (0, import_react11.forwardRef)(
|
|
1651
1857
|
({
|
|
1652
1858
|
options,
|
|
1653
1859
|
errorMessage,
|
|
@@ -1669,8 +1875,8 @@ var MultiSelect = (0, import_react8.forwardRef)(
|
|
|
1669
1875
|
themeProductContext
|
|
1670
1876
|
}, ref) => {
|
|
1671
1877
|
const { theme } = (0, import_xui_core4.useResolvedTheme)({ themeMode, themeProductContext });
|
|
1672
|
-
const controlRef = (0,
|
|
1673
|
-
const menuRef = (0,
|
|
1878
|
+
const controlRef = (0, import_react11.useRef)(null);
|
|
1879
|
+
const menuRef = (0, import_react11.useRef)(null);
|
|
1674
1880
|
const sizeStyles = theme.sizing.input(size);
|
|
1675
1881
|
const state = externalState || (disabled ? "disable" : "default");
|
|
1676
1882
|
const isDisable = state === "disable" || disabled;
|
|
@@ -1691,7 +1897,7 @@ var MultiSelect = (0, import_react8.forwardRef)(
|
|
|
1691
1897
|
value,
|
|
1692
1898
|
onChange
|
|
1693
1899
|
});
|
|
1694
|
-
(0,
|
|
1900
|
+
(0, import_react11.useEffect)(() => {
|
|
1695
1901
|
if (isDisable) {
|
|
1696
1902
|
onClose();
|
|
1697
1903
|
}
|