@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/native/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-native/src/Box.tsx
|
|
41
41
|
var import_react_native = require("react-native");
|
|
@@ -302,7 +302,7 @@ var Icon = ({ children, color, size }) => {
|
|
|
302
302
|
var import_xui_core4 = require("@xsolla/xui-core");
|
|
303
303
|
|
|
304
304
|
// src/MultiSelectControl.tsx
|
|
305
|
-
var
|
|
305
|
+
var import_react8 = require("react");
|
|
306
306
|
var import_xui_core3 = require("@xsolla/xui-core");
|
|
307
307
|
|
|
308
308
|
// ../icons-base/dist/web/index.mjs
|
|
@@ -750,11 +750,12 @@ var lineContent113 = `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.
|
|
|
750
750
|
var Remove = (props) => /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(BaseIcon, { ...props, solidContent: solidContent113, lineContent: lineContent113 });
|
|
751
751
|
|
|
752
752
|
// src/useMultiSelectControl.tsx
|
|
753
|
-
var
|
|
753
|
+
var import_react7 = require("react");
|
|
754
754
|
|
|
755
755
|
// ../tag/dist/web/index.mjs
|
|
756
|
-
var
|
|
756
|
+
var import_react5 = __toESM(require("react"), 1);
|
|
757
757
|
var import_styled_components3 = __toESM(require("styled-components"), 1);
|
|
758
|
+
var import_react6 = __toESM(require("react"), 1);
|
|
758
759
|
var import_jsx_runtime393 = require("react/jsx-runtime");
|
|
759
760
|
var import_styled_components4 = __toESM(require("styled-components"), 1);
|
|
760
761
|
var import_jsx_runtime394 = require("react/jsx-runtime");
|
|
@@ -763,6 +764,7 @@ var import_jsx_runtime395 = require("react/jsx-runtime");
|
|
|
763
764
|
var import_xui_core = require("@xsolla/xui-core");
|
|
764
765
|
|
|
765
766
|
// ../icons/dist/web/index.mjs
|
|
767
|
+
var import_react4 = __toESM(require("react"), 1);
|
|
766
768
|
var import_styled_components2 = __toESM(require("styled-components"), 1);
|
|
767
769
|
var import_jsx_runtime391 = require("react/jsx-runtime");
|
|
768
770
|
|
|
@@ -771,8 +773,8 @@ var import_react3 = require("react");
|
|
|
771
773
|
|
|
772
774
|
// ../../node_modules/lucide-react/dist/esm/shared/src/utils.js
|
|
773
775
|
var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
774
|
-
var mergeClasses = (...classes) => classes.filter((className,
|
|
775
|
-
return Boolean(className) && className.trim() !== "" && array.indexOf(className) ===
|
|
776
|
+
var mergeClasses = (...classes) => classes.filter((className, index3, array) => {
|
|
777
|
+
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index3;
|
|
776
778
|
}).join(" ").trim();
|
|
777
779
|
|
|
778
780
|
// ../../node_modules/lucide-react/dist/esm/Icon.js
|
|
@@ -845,7 +847,68 @@ var X = createLucideIcon("X", [
|
|
|
845
847
|
|
|
846
848
|
// ../icons/dist/web/index.mjs
|
|
847
849
|
var import_jsx_runtime392 = require("react/jsx-runtime");
|
|
848
|
-
|
|
850
|
+
function memoize(fn) {
|
|
851
|
+
var cache = {};
|
|
852
|
+
return function(arg) {
|
|
853
|
+
if (cache[arg] === void 0) cache[arg] = fn(arg);
|
|
854
|
+
return cache[arg];
|
|
855
|
+
};
|
|
856
|
+
}
|
|
857
|
+
var memoize_esm_default = memoize;
|
|
858
|
+
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)-.*))$/;
|
|
859
|
+
var index = memoize_esm_default(
|
|
860
|
+
function(prop) {
|
|
861
|
+
return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111 && prop.charCodeAt(1) === 110 && prop.charCodeAt(2) < 91;
|
|
862
|
+
}
|
|
863
|
+
/* Z+1 */
|
|
864
|
+
);
|
|
865
|
+
var is_prop_valid_esm_default = index;
|
|
866
|
+
var ADDITIONAL_BLOCKED_PROPS = /* @__PURE__ */ new Set([
|
|
867
|
+
// RN-only event handlers (pass isPropValid's on* pattern)
|
|
868
|
+
"onPress",
|
|
869
|
+
"onChangeText",
|
|
870
|
+
"onLayout",
|
|
871
|
+
"onMoveShouldSetResponder",
|
|
872
|
+
"onResponderGrant",
|
|
873
|
+
"onResponderMove",
|
|
874
|
+
"onResponderRelease",
|
|
875
|
+
"onResponderTerminate",
|
|
876
|
+
// SVG attributes that pass isPropValid
|
|
877
|
+
"strokeWidth",
|
|
878
|
+
// CSS properties that pass isPropValid but are used as component props
|
|
879
|
+
"overflow",
|
|
880
|
+
"cursor",
|
|
881
|
+
"fontSize",
|
|
882
|
+
"fontWeight",
|
|
883
|
+
"fontFamily",
|
|
884
|
+
"textDecoration"
|
|
885
|
+
]);
|
|
886
|
+
function shouldForwardProp(key) {
|
|
887
|
+
if (ADDITIONAL_BLOCKED_PROPS.has(key)) return false;
|
|
888
|
+
return is_prop_valid_esm_default(key);
|
|
889
|
+
}
|
|
890
|
+
function createFilteredElement(defaultTag) {
|
|
891
|
+
const Component = import_react4.default.forwardRef(
|
|
892
|
+
({ children, elementType, ...props }, ref) => {
|
|
893
|
+
const Tag2 = elementType || defaultTag;
|
|
894
|
+
const htmlProps = {};
|
|
895
|
+
for (const key of Object.keys(props)) {
|
|
896
|
+
if (shouldForwardProp(key)) {
|
|
897
|
+
htmlProps[key] = props[key];
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
return import_react4.default.createElement(
|
|
901
|
+
Tag2,
|
|
902
|
+
{ ref, ...htmlProps },
|
|
903
|
+
children
|
|
904
|
+
);
|
|
905
|
+
}
|
|
906
|
+
);
|
|
907
|
+
Component.displayName = `Filtered(${defaultTag})`;
|
|
908
|
+
return Component;
|
|
909
|
+
}
|
|
910
|
+
var FilteredDiv = createFilteredElement("div");
|
|
911
|
+
var StyledIcon2 = (0, import_styled_components2.default)(FilteredDiv)`
|
|
849
912
|
display: flex;
|
|
850
913
|
align-items: center;
|
|
851
914
|
justify-content: center;
|
|
@@ -867,7 +930,68 @@ var X2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime392.jsx)(Icon3, { ...p
|
|
|
867
930
|
|
|
868
931
|
// ../tag/dist/web/index.mjs
|
|
869
932
|
var import_jsx_runtime396 = require("react/jsx-runtime");
|
|
870
|
-
|
|
933
|
+
function memoize2(fn) {
|
|
934
|
+
var cache = {};
|
|
935
|
+
return function(arg) {
|
|
936
|
+
if (cache[arg] === void 0) cache[arg] = fn(arg);
|
|
937
|
+
return cache[arg];
|
|
938
|
+
};
|
|
939
|
+
}
|
|
940
|
+
var memoize_esm_default2 = memoize2;
|
|
941
|
+
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)-.*))$/;
|
|
942
|
+
var index2 = memoize_esm_default2(
|
|
943
|
+
function(prop) {
|
|
944
|
+
return reactPropsRegex2.test(prop) || prop.charCodeAt(0) === 111 && prop.charCodeAt(1) === 110 && prop.charCodeAt(2) < 91;
|
|
945
|
+
}
|
|
946
|
+
/* Z+1 */
|
|
947
|
+
);
|
|
948
|
+
var is_prop_valid_esm_default2 = index2;
|
|
949
|
+
var ADDITIONAL_BLOCKED_PROPS2 = /* @__PURE__ */ new Set([
|
|
950
|
+
// RN-only event handlers (pass isPropValid's on* pattern)
|
|
951
|
+
"onPress",
|
|
952
|
+
"onChangeText",
|
|
953
|
+
"onLayout",
|
|
954
|
+
"onMoveShouldSetResponder",
|
|
955
|
+
"onResponderGrant",
|
|
956
|
+
"onResponderMove",
|
|
957
|
+
"onResponderRelease",
|
|
958
|
+
"onResponderTerminate",
|
|
959
|
+
// SVG attributes that pass isPropValid
|
|
960
|
+
"strokeWidth",
|
|
961
|
+
// CSS properties that pass isPropValid but are used as component props
|
|
962
|
+
"overflow",
|
|
963
|
+
"cursor",
|
|
964
|
+
"fontSize",
|
|
965
|
+
"fontWeight",
|
|
966
|
+
"fontFamily",
|
|
967
|
+
"textDecoration"
|
|
968
|
+
]);
|
|
969
|
+
function shouldForwardProp2(key) {
|
|
970
|
+
if (ADDITIONAL_BLOCKED_PROPS2.has(key)) return false;
|
|
971
|
+
return is_prop_valid_esm_default2(key);
|
|
972
|
+
}
|
|
973
|
+
function createFilteredElement2(defaultTag) {
|
|
974
|
+
const Component = import_react6.default.forwardRef(
|
|
975
|
+
({ children, elementType, ...props }, ref) => {
|
|
976
|
+
const Tag2 = elementType || defaultTag;
|
|
977
|
+
const htmlProps = {};
|
|
978
|
+
for (const key of Object.keys(props)) {
|
|
979
|
+
if (shouldForwardProp2(key)) {
|
|
980
|
+
htmlProps[key] = props[key];
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
return import_react6.default.createElement(
|
|
984
|
+
Tag2,
|
|
985
|
+
{ ref, ...htmlProps },
|
|
986
|
+
children
|
|
987
|
+
);
|
|
988
|
+
}
|
|
989
|
+
);
|
|
990
|
+
Component.displayName = `Filtered(${defaultTag})`;
|
|
991
|
+
return Component;
|
|
992
|
+
}
|
|
993
|
+
var FilteredDiv2 = createFilteredElement2("div");
|
|
994
|
+
var StyledBox = (0, import_styled_components3.default)(FilteredDiv2)`
|
|
871
995
|
display: flex;
|
|
872
996
|
box-sizing: border-box;
|
|
873
997
|
background-color: ${(props) => props.backgroundColor || "transparent"};
|
|
@@ -954,7 +1078,7 @@ var StyledBox = import_styled_components3.default.div`
|
|
|
954
1078
|
${(props) => props.pressStyle?.backgroundColor && `background-color: ${props.pressStyle.backgroundColor};`}
|
|
955
1079
|
}
|
|
956
1080
|
`;
|
|
957
|
-
var Box2 =
|
|
1081
|
+
var Box2 = import_react5.default.forwardRef(
|
|
958
1082
|
({
|
|
959
1083
|
children,
|
|
960
1084
|
onPress,
|
|
@@ -979,6 +1103,8 @@ var Box2 = import_react4.default.forwardRef(
|
|
|
979
1103
|
type,
|
|
980
1104
|
disabled,
|
|
981
1105
|
id,
|
|
1106
|
+
testID,
|
|
1107
|
+
"data-testid": dataTestId,
|
|
982
1108
|
...props
|
|
983
1109
|
}, ref) => {
|
|
984
1110
|
if (as === "img" && src) {
|
|
@@ -1006,7 +1132,7 @@ var Box2 = import_react4.default.forwardRef(
|
|
|
1006
1132
|
StyledBox,
|
|
1007
1133
|
{
|
|
1008
1134
|
ref,
|
|
1009
|
-
as,
|
|
1135
|
+
elementType: as,
|
|
1010
1136
|
id,
|
|
1011
1137
|
type: as === "button" ? type || "button" : void 0,
|
|
1012
1138
|
disabled: as === "button" ? disabled : void 0,
|
|
@@ -1026,6 +1152,7 @@ var Box2 = import_react4.default.forwardRef(
|
|
|
1026
1152
|
"aria-controls": ariaControls,
|
|
1027
1153
|
"aria-live": ariaLive,
|
|
1028
1154
|
tabIndex: tabIndex !== void 0 ? tabIndex : void 0,
|
|
1155
|
+
"data-testid": dataTestId || testID,
|
|
1029
1156
|
...props,
|
|
1030
1157
|
children
|
|
1031
1158
|
}
|
|
@@ -1033,7 +1160,8 @@ var Box2 = import_react4.default.forwardRef(
|
|
|
1033
1160
|
}
|
|
1034
1161
|
);
|
|
1035
1162
|
Box2.displayName = "Box";
|
|
1036
|
-
var
|
|
1163
|
+
var FilteredSpan = createFilteredElement2("span");
|
|
1164
|
+
var StyledText = (0, import_styled_components4.default)(FilteredSpan)`
|
|
1037
1165
|
color: ${(props) => props.color || "inherit"};
|
|
1038
1166
|
font-size: ${(props) => typeof props.fontSize === "number" ? `${props.fontSize}px` : props.fontSize || "inherit"};
|
|
1039
1167
|
font-weight: ${(props) => props.fontWeight || "normal"};
|
|
@@ -1062,7 +1190,8 @@ var Text2 = ({
|
|
|
1062
1190
|
}
|
|
1063
1191
|
);
|
|
1064
1192
|
};
|
|
1065
|
-
var
|
|
1193
|
+
var FilteredDiv22 = createFilteredElement2("div");
|
|
1194
|
+
var StyledIcon3 = (0, import_styled_components5.default)(FilteredDiv22)`
|
|
1066
1195
|
display: flex;
|
|
1067
1196
|
align-items: center;
|
|
1068
1197
|
justify-content: center;
|
|
@@ -1210,15 +1339,15 @@ var useMultiSelectControl = ({
|
|
|
1210
1339
|
themeProductContext
|
|
1211
1340
|
}) => {
|
|
1212
1341
|
const { theme } = (0, import_xui_core2.useResolvedTheme)({ themeMode, themeProductContext });
|
|
1213
|
-
const displayStateRef = (0,
|
|
1214
|
-
const savedWidthsRef = (0,
|
|
1215
|
-
const itemsRef = (0,
|
|
1216
|
-
const [itemsWidth, setItemsWidth] = (0,
|
|
1217
|
-
const [selectedContent, setSelectedContent] = (0,
|
|
1342
|
+
const displayStateRef = (0, import_react7.useRef)(0 /* Placeholder */);
|
|
1343
|
+
const savedWidthsRef = (0, import_react7.useRef)(null);
|
|
1344
|
+
const itemsRef = (0, import_react7.useRef)(null);
|
|
1345
|
+
const [itemsWidth, setItemsWidth] = (0, import_react7.useState)(0);
|
|
1346
|
+
const [selectedContent, setSelectedContent] = (0, import_react7.useState)(
|
|
1218
1347
|
null
|
|
1219
1348
|
);
|
|
1220
1349
|
const isPlaceholder = !selectedItems || selectedItems.length === 0;
|
|
1221
|
-
(0,
|
|
1350
|
+
(0, import_react7.useEffect)(() => {
|
|
1222
1351
|
if (!containerRef.current) return;
|
|
1223
1352
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
1224
1353
|
for (const entry of entries) {
|
|
@@ -1228,7 +1357,7 @@ var useMultiSelectControl = ({
|
|
|
1228
1357
|
resizeObserver.observe(containerRef.current);
|
|
1229
1358
|
return () => resizeObserver.disconnect();
|
|
1230
1359
|
}, [containerRef]);
|
|
1231
|
-
const widthsDependencies = (0,
|
|
1360
|
+
const widthsDependencies = (0, import_react7.useMemo)(
|
|
1232
1361
|
() => ({
|
|
1233
1362
|
stateList: stateList.map((item) => item.value),
|
|
1234
1363
|
variant,
|
|
@@ -1302,9 +1431,9 @@ var useMultiSelectControl = ({
|
|
|
1302
1431
|
const countText = displayStateRef.current === 1 /* PreRender */ ? `+${itemsList.length}` : `+${itemsList.length - displayedItems.length}`;
|
|
1303
1432
|
displayedItems.push({ value: COUNT_ITEM_VALUE, label: countText });
|
|
1304
1433
|
}
|
|
1305
|
-
const content = displayedItems.map((item,
|
|
1434
|
+
const content = displayedItems.map((item, index3) => {
|
|
1306
1435
|
const isCount = item.value === COUNT_ITEM_VALUE;
|
|
1307
|
-
const isReducable =
|
|
1436
|
+
const isReducable = index3 === 0 && displayStateRef.current === 3 /* Render */ && displayedItemsCount === 0 || flexible;
|
|
1308
1437
|
if (variant === "tag") {
|
|
1309
1438
|
return /* @__PURE__ */ (0, import_jsx_runtime397.jsx)(
|
|
1310
1439
|
Box,
|
|
@@ -1335,7 +1464,7 @@ var useMultiSelectControl = ({
|
|
|
1335
1464
|
);
|
|
1336
1465
|
}
|
|
1337
1466
|
const isCountItem = hasHidden;
|
|
1338
|
-
const needsComma =
|
|
1467
|
+
const needsComma = index3 < displayedItems.length - 2 || index3 < displayedItems.length - 1 && !isCountItem;
|
|
1339
1468
|
return /* @__PURE__ */ (0, import_jsx_runtime397.jsxs)(
|
|
1340
1469
|
Text,
|
|
1341
1470
|
{
|
|
@@ -1371,11 +1500,11 @@ var useMultiSelectControl = ({
|
|
|
1371
1500
|
const countItemWidth = countEl.getBoundingClientRect().width;
|
|
1372
1501
|
const columnGap = parseInt(getComputedStyle(itemsRef.current).columnGap || "0", 10) || 0;
|
|
1373
1502
|
const tagsWidths = {};
|
|
1374
|
-
let
|
|
1503
|
+
let index3 = 0;
|
|
1375
1504
|
for (const el of allItems) {
|
|
1376
|
-
const key =
|
|
1505
|
+
const key = index3 < allItems.length - 1 ? stateList[index3].value : COUNT_ITEM_VALUE;
|
|
1377
1506
|
tagsWidths[key] = el.getBoundingClientRect().width;
|
|
1378
|
-
|
|
1507
|
+
index3++;
|
|
1379
1508
|
}
|
|
1380
1509
|
savedWidthsRef.current = {
|
|
1381
1510
|
tagsWidths,
|
|
@@ -1386,7 +1515,7 @@ var useMultiSelectControl = ({
|
|
|
1386
1515
|
displayStateRef.current = 3 /* Render */;
|
|
1387
1516
|
setItemsRender();
|
|
1388
1517
|
};
|
|
1389
|
-
(0,
|
|
1518
|
+
(0, import_react7.useEffect)(() => {
|
|
1390
1519
|
if (isPlaceholder) {
|
|
1391
1520
|
displayStateRef.current = 0 /* Placeholder */;
|
|
1392
1521
|
setPlaceholder();
|
|
@@ -1420,7 +1549,7 @@ var useMultiSelectControl = ({
|
|
|
1420
1549
|
widthsDependencies,
|
|
1421
1550
|
stateList
|
|
1422
1551
|
]);
|
|
1423
|
-
(0,
|
|
1552
|
+
(0, import_react7.useEffect)(() => {
|
|
1424
1553
|
if (displayStateRef.current !== 2 /* Calculation */) return;
|
|
1425
1554
|
const rafId = requestAnimationFrame(() => {
|
|
1426
1555
|
if (displayStateRef.current === 2 /* Calculation */) {
|
|
@@ -1439,7 +1568,7 @@ var useMultiSelectControl = ({
|
|
|
1439
1568
|
|
|
1440
1569
|
// src/MultiSelectControl.tsx
|
|
1441
1570
|
var import_jsx_runtime398 = require("react/jsx-runtime");
|
|
1442
|
-
var MultiSelectControl = (0,
|
|
1571
|
+
var MultiSelectControl = (0, import_react8.forwardRef)(
|
|
1443
1572
|
({
|
|
1444
1573
|
variant = "tag",
|
|
1445
1574
|
flexible = true,
|
|
@@ -1467,7 +1596,7 @@ var MultiSelectControl = (0, import_react6.forwardRef)(
|
|
|
1467
1596
|
const inputColors = theme.colors.control.input;
|
|
1468
1597
|
const state = externalState || (disabled ? "disable" : "default");
|
|
1469
1598
|
const isDisable = state === "disable" || disabled;
|
|
1470
|
-
const containerRef = (0,
|
|
1599
|
+
const containerRef = (0, import_react8.useRef)(null);
|
|
1471
1600
|
const { itemsRef, selectedContent, isCalculating } = useMultiSelectControl({
|
|
1472
1601
|
variant,
|
|
1473
1602
|
flexible,
|
|
@@ -1590,7 +1719,7 @@ var MultiSelectControl = (0, import_react6.forwardRef)(
|
|
|
1590
1719
|
MultiSelectControl.displayName = "MultiSelectControl";
|
|
1591
1720
|
|
|
1592
1721
|
// src/useMultiSelect.ts
|
|
1593
|
-
var
|
|
1722
|
+
var import_react9 = require("react");
|
|
1594
1723
|
var initialState = {
|
|
1595
1724
|
values: [],
|
|
1596
1725
|
selectedItems: [],
|
|
@@ -1601,12 +1730,12 @@ var useMultiSelect = ({
|
|
|
1601
1730
|
value = [],
|
|
1602
1731
|
onChange
|
|
1603
1732
|
}) => {
|
|
1604
|
-
const [state, setState] = (0,
|
|
1605
|
-
const optionsRef = (0,
|
|
1606
|
-
(0,
|
|
1733
|
+
const [state, setState] = (0, import_react9.useState)(initialState);
|
|
1734
|
+
const optionsRef = (0, import_react9.useRef)(options);
|
|
1735
|
+
(0, import_react9.useEffect)(() => {
|
|
1607
1736
|
optionsRef.current = options;
|
|
1608
1737
|
}, [options]);
|
|
1609
|
-
(0,
|
|
1738
|
+
(0, import_react9.useEffect)(() => {
|
|
1610
1739
|
const selectedItems = options.filter((opt) => value.includes(opt.value));
|
|
1611
1740
|
setState((prevState) => ({
|
|
1612
1741
|
...prevState,
|
|
@@ -1614,7 +1743,7 @@ var useMultiSelect = ({
|
|
|
1614
1743
|
selectedItems
|
|
1615
1744
|
}));
|
|
1616
1745
|
}, [options, value]);
|
|
1617
|
-
const onChoose = (0,
|
|
1746
|
+
const onChoose = (0, import_react9.useCallback)(
|
|
1618
1747
|
(selectedIds) => {
|
|
1619
1748
|
const newValues = optionsRef.current.filter((opt) => selectedIds.includes(String(opt.value))).map((opt) => opt.value);
|
|
1620
1749
|
const newSelectedItems = optionsRef.current.filter(
|
|
@@ -1629,7 +1758,7 @@ var useMultiSelect = ({
|
|
|
1629
1758
|
},
|
|
1630
1759
|
[onChange]
|
|
1631
1760
|
);
|
|
1632
|
-
const onRemove = (0,
|
|
1761
|
+
const onRemove = (0, import_react9.useCallback)(
|
|
1633
1762
|
(value2, event) => {
|
|
1634
1763
|
event?.stopPropagation();
|
|
1635
1764
|
setState((prev) => {
|
|
@@ -1647,7 +1776,7 @@ var useMultiSelect = ({
|
|
|
1647
1776
|
},
|
|
1648
1777
|
[onChange]
|
|
1649
1778
|
);
|
|
1650
|
-
const onRemoveAll = (0,
|
|
1779
|
+
const onRemoveAll = (0, import_react9.useCallback)(() => {
|
|
1651
1780
|
setState((prevState) => ({
|
|
1652
1781
|
...prevState,
|
|
1653
1782
|
values: [],
|
|
@@ -1655,13 +1784,13 @@ var useMultiSelect = ({
|
|
|
1655
1784
|
}));
|
|
1656
1785
|
onChange?.([]);
|
|
1657
1786
|
}, [onChange]);
|
|
1658
|
-
const onSelectClick = (0,
|
|
1787
|
+
const onSelectClick = (0, import_react9.useCallback)(() => {
|
|
1659
1788
|
setState((prevState) => ({
|
|
1660
1789
|
...prevState,
|
|
1661
1790
|
isOpen: !prevState.isOpen
|
|
1662
1791
|
}));
|
|
1663
1792
|
}, []);
|
|
1664
|
-
const onClose = (0,
|
|
1793
|
+
const onClose = (0, import_react9.useCallback)(() => {
|
|
1665
1794
|
setState((prevState) => ({
|
|
1666
1795
|
...prevState,
|
|
1667
1796
|
isOpen: false
|
|
@@ -1682,7 +1811,7 @@ var useMultiSelect = ({
|
|
|
1682
1811
|
|
|
1683
1812
|
// src/MultiSelect.tsx
|
|
1684
1813
|
var import_jsx_runtime399 = require("react/jsx-runtime");
|
|
1685
|
-
var MultiSelect = (0,
|
|
1814
|
+
var MultiSelect = (0, import_react10.forwardRef)(
|
|
1686
1815
|
({
|
|
1687
1816
|
options,
|
|
1688
1817
|
errorMessage,
|
|
@@ -1704,8 +1833,8 @@ var MultiSelect = (0, import_react8.forwardRef)(
|
|
|
1704
1833
|
themeProductContext
|
|
1705
1834
|
}, ref) => {
|
|
1706
1835
|
const { theme } = (0, import_xui_core4.useResolvedTheme)({ themeMode, themeProductContext });
|
|
1707
|
-
const controlRef = (0,
|
|
1708
|
-
const menuRef = (0,
|
|
1836
|
+
const controlRef = (0, import_react10.useRef)(null);
|
|
1837
|
+
const menuRef = (0, import_react10.useRef)(null);
|
|
1709
1838
|
const sizeStyles = theme.sizing.input(size);
|
|
1710
1839
|
const state = externalState || (disabled ? "disable" : "default");
|
|
1711
1840
|
const isDisable = state === "disable" || disabled;
|
|
@@ -1726,7 +1855,7 @@ var MultiSelect = (0, import_react8.forwardRef)(
|
|
|
1726
1855
|
value,
|
|
1727
1856
|
onChange
|
|
1728
1857
|
});
|
|
1729
|
-
(0,
|
|
1858
|
+
(0, import_react10.useEffect)(() => {
|
|
1730
1859
|
if (isDisable) {
|
|
1731
1860
|
onClose();
|
|
1732
1861
|
}
|