@xsolla/xui-multi-select 0.216.0 → 0.217.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/README.md +82 -3
- package/native/index.d.mts +43 -2
- package/native/index.d.ts +43 -2
- package/native/index.js +179 -757
- package/native/index.js.map +1 -1
- package/native/index.mjs +143 -721
- package/native/index.mjs.map +1 -1
- package/package.json +7 -6
- package/web/index.d.mts +43 -2
- package/web/index.d.ts +43 -2
- package/web/index.js +180 -758
- package/web/index.js.map +1 -1
- package/web/index.mjs +141 -719
- 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_react5 = require("react");
|
|
39
39
|
|
|
40
40
|
// ../../foundation/primitives-native/src/Box.tsx
|
|
41
41
|
var import_react_native = require("react-native");
|
|
@@ -373,656 +373,19 @@ var Icon = ({
|
|
|
373
373
|
var isWeb = false;
|
|
374
374
|
|
|
375
375
|
// src/MultiSelect.tsx
|
|
376
|
-
var
|
|
376
|
+
var import_xui_core3 = require("@xsolla/xui-core");
|
|
377
377
|
var import_xui_icons_base2 = require("@xsolla/xui-icons-base");
|
|
378
378
|
|
|
379
379
|
// src/MultiSelectControl.tsx
|
|
380
|
-
var
|
|
381
|
-
var
|
|
380
|
+
var import_react3 = require("react");
|
|
381
|
+
var import_xui_core2 = require("@xsolla/xui-core");
|
|
382
382
|
var import_xui_icons_base = require("@xsolla/xui-icons-base");
|
|
383
383
|
|
|
384
384
|
// src/useMultiSelectControl.tsx
|
|
385
|
-
var
|
|
386
|
-
|
|
387
|
-
// ../tag/dist/web/index.mjs
|
|
388
|
-
var import_react5 = __toESM(require("react"), 1);
|
|
389
|
-
var import_styled_components2 = __toESM(require("styled-components"), 1);
|
|
390
|
-
var import_react6 = __toESM(require("react"), 1);
|
|
391
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
392
|
-
var import_styled_components3 = __toESM(require("styled-components"), 1);
|
|
393
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
394
|
-
var import_styled_components4 = __toESM(require("styled-components"), 1);
|
|
395
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
385
|
+
var import_react2 = require("react");
|
|
386
|
+
var import_xui_tag = require("@xsolla/xui-tag");
|
|
396
387
|
var import_xui_core = require("@xsolla/xui-core");
|
|
397
|
-
|
|
398
|
-
// ../../foundation/icons/dist/web/index.mjs
|
|
399
|
-
var import_react4 = __toESM(require("react"), 1);
|
|
400
|
-
var import_styled_components = __toESM(require("styled-components"), 1);
|
|
401
388
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
402
|
-
|
|
403
|
-
// ../../../node_modules/lucide-react/dist/esm/createLucideIcon.js
|
|
404
|
-
var import_react3 = require("react");
|
|
405
|
-
|
|
406
|
-
// ../../../node_modules/lucide-react/dist/esm/shared/src/utils.js
|
|
407
|
-
var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
408
|
-
var mergeClasses = (...classes) => classes.filter((className, index3, array) => {
|
|
409
|
-
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index3;
|
|
410
|
-
}).join(" ").trim();
|
|
411
|
-
|
|
412
|
-
// ../../../node_modules/lucide-react/dist/esm/Icon.js
|
|
413
|
-
var import_react2 = require("react");
|
|
414
|
-
|
|
415
|
-
// ../../../node_modules/lucide-react/dist/esm/defaultAttributes.js
|
|
416
|
-
var defaultAttributes = {
|
|
417
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
418
|
-
width: 24,
|
|
419
|
-
height: 24,
|
|
420
|
-
viewBox: "0 0 24 24",
|
|
421
|
-
fill: "none",
|
|
422
|
-
stroke: "currentColor",
|
|
423
|
-
strokeWidth: 2,
|
|
424
|
-
strokeLinecap: "round",
|
|
425
|
-
strokeLinejoin: "round"
|
|
426
|
-
};
|
|
427
|
-
|
|
428
|
-
// ../../../node_modules/lucide-react/dist/esm/Icon.js
|
|
429
|
-
var Icon2 = (0, import_react2.forwardRef)(
|
|
430
|
-
({
|
|
431
|
-
color = "currentColor",
|
|
432
|
-
size = 24,
|
|
433
|
-
strokeWidth = 2,
|
|
434
|
-
absoluteStrokeWidth,
|
|
435
|
-
className = "",
|
|
436
|
-
children,
|
|
437
|
-
iconNode,
|
|
438
|
-
...rest
|
|
439
|
-
}, ref) => {
|
|
440
|
-
return (0, import_react2.createElement)(
|
|
441
|
-
"svg",
|
|
442
|
-
{
|
|
443
|
-
ref,
|
|
444
|
-
...defaultAttributes,
|
|
445
|
-
width: size,
|
|
446
|
-
height: size,
|
|
447
|
-
stroke: color,
|
|
448
|
-
strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
|
|
449
|
-
className: mergeClasses("lucide", className),
|
|
450
|
-
...rest
|
|
451
|
-
},
|
|
452
|
-
[
|
|
453
|
-
...iconNode.map(([tag, attrs]) => (0, import_react2.createElement)(tag, attrs)),
|
|
454
|
-
...Array.isArray(children) ? children : [children]
|
|
455
|
-
]
|
|
456
|
-
);
|
|
457
|
-
}
|
|
458
|
-
);
|
|
459
|
-
|
|
460
|
-
// ../../../node_modules/lucide-react/dist/esm/createLucideIcon.js
|
|
461
|
-
var createLucideIcon = (iconName, iconNode) => {
|
|
462
|
-
const Component = (0, import_react3.forwardRef)(
|
|
463
|
-
({ className, ...props }, ref) => (0, import_react3.createElement)(Icon2, {
|
|
464
|
-
ref,
|
|
465
|
-
iconNode,
|
|
466
|
-
className: mergeClasses(`lucide-${toKebabCase(iconName)}`, className),
|
|
467
|
-
...props
|
|
468
|
-
})
|
|
469
|
-
);
|
|
470
|
-
Component.displayName = `${iconName}`;
|
|
471
|
-
return Component;
|
|
472
|
-
};
|
|
473
|
-
|
|
474
|
-
// ../../../node_modules/lucide-react/dist/esm/icons/x.js
|
|
475
|
-
var X = createLucideIcon("X", [
|
|
476
|
-
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
477
|
-
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
478
|
-
]);
|
|
479
|
-
|
|
480
|
-
// ../../foundation/icons/dist/web/index.mjs
|
|
481
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
482
|
-
function memoize(fn) {
|
|
483
|
-
var cache = {};
|
|
484
|
-
return function(arg) {
|
|
485
|
-
if (cache[arg] === void 0) cache[arg] = fn(arg);
|
|
486
|
-
return cache[arg];
|
|
487
|
-
};
|
|
488
|
-
}
|
|
489
|
-
var memoize_esm_default = memoize;
|
|
490
|
-
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)-.*))$/;
|
|
491
|
-
var index = memoize_esm_default(
|
|
492
|
-
function(prop) {
|
|
493
|
-
return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111 && prop.charCodeAt(1) === 110 && prop.charCodeAt(2) < 91;
|
|
494
|
-
}
|
|
495
|
-
/* Z+1 */
|
|
496
|
-
);
|
|
497
|
-
var is_prop_valid_esm_default = index;
|
|
498
|
-
var ADDITIONAL_BLOCKED_PROPS = /* @__PURE__ */ new Set([
|
|
499
|
-
// RN-only event handlers (pass isPropValid's on* pattern)
|
|
500
|
-
"onPress",
|
|
501
|
-
"onChangeText",
|
|
502
|
-
"onLayout",
|
|
503
|
-
"onMoveShouldSetResponder",
|
|
504
|
-
"onResponderGrant",
|
|
505
|
-
"onResponderMove",
|
|
506
|
-
"onResponderRelease",
|
|
507
|
-
"onResponderTerminate",
|
|
508
|
-
// SVG attributes that pass isPropValid
|
|
509
|
-
"strokeWidth",
|
|
510
|
-
// CSS properties that pass isPropValid but are used as component props
|
|
511
|
-
"overflow",
|
|
512
|
-
"opacity",
|
|
513
|
-
"cursor",
|
|
514
|
-
"fontSize",
|
|
515
|
-
"fontWeight",
|
|
516
|
-
"fontFamily",
|
|
517
|
-
"textDecoration",
|
|
518
|
-
// Cross-platform layout prop that Text consumes as CSS, never as an
|
|
519
|
-
// attribute. Pinned explicitly because it is now spread into the styled
|
|
520
|
-
// component rather than destructured away before it can reach the DOM.
|
|
521
|
-
"numberOfLines"
|
|
522
|
-
]);
|
|
523
|
-
function shouldForwardProp(key) {
|
|
524
|
-
if (ADDITIONAL_BLOCKED_PROPS.has(key)) return false;
|
|
525
|
-
return is_prop_valid_esm_default(key);
|
|
526
|
-
}
|
|
527
|
-
function createFilteredElement(defaultTag) {
|
|
528
|
-
const Component = import_react4.default.forwardRef(
|
|
529
|
-
({ children, elementType, ...props }, ref) => {
|
|
530
|
-
const Tag2 = elementType || defaultTag;
|
|
531
|
-
const htmlProps = {};
|
|
532
|
-
for (const key of Object.keys(props)) {
|
|
533
|
-
if (shouldForwardProp(key)) {
|
|
534
|
-
htmlProps[key] = props[key];
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
return import_react4.default.createElement(
|
|
538
|
-
Tag2,
|
|
539
|
-
{ ref, ...htmlProps },
|
|
540
|
-
children
|
|
541
|
-
);
|
|
542
|
-
}
|
|
543
|
-
);
|
|
544
|
-
Component.displayName = `Filtered(${defaultTag})`;
|
|
545
|
-
return Component;
|
|
546
|
-
}
|
|
547
|
-
var FilteredDiv = createFilteredElement("div");
|
|
548
|
-
var StyledIcon = (0, import_styled_components.default)(FilteredDiv)`
|
|
549
|
-
display: flex;
|
|
550
|
-
align-items: center;
|
|
551
|
-
justify-content: center;
|
|
552
|
-
width: ${(props) => typeof props.size === "number" ? `${props.size}px` : props.size || "24px"};
|
|
553
|
-
height: ${(props) => typeof props.size === "number" ? `${props.size}px` : props.size || "24px"};
|
|
554
|
-
color: ${(props) => props.color || "currentColor"};
|
|
555
|
-
|
|
556
|
-
/* Icons paint themselves — each icon's own SVG sets its fill/stroke
|
|
557
|
-
(icons-base via inline "fill: currentColor", Lucide via "fill"/"stroke"
|
|
558
|
-
attributes). Do not add fill/stroke here: it re-strokes fill-based icons
|
|
559
|
-
and thickens the glyph. See FEP-877. */
|
|
560
|
-
svg {
|
|
561
|
-
width: 100%;
|
|
562
|
-
height: 100%;
|
|
563
|
-
}
|
|
564
|
-
`;
|
|
565
|
-
var Icon3 = ({
|
|
566
|
-
children,
|
|
567
|
-
testID,
|
|
568
|
-
"data-testid": dataTestId,
|
|
569
|
-
...props
|
|
570
|
-
}) => {
|
|
571
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(StyledIcon, { "data-testid": dataTestId || testID, ...props, children });
|
|
572
|
-
};
|
|
573
|
-
var X2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon3, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(X, { size: "100%" }) });
|
|
574
|
-
|
|
575
|
-
// ../tag/dist/web/index.mjs
|
|
576
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
577
|
-
function memoize2(fn) {
|
|
578
|
-
var cache = {};
|
|
579
|
-
return function(arg) {
|
|
580
|
-
if (cache[arg] === void 0) cache[arg] = fn(arg);
|
|
581
|
-
return cache[arg];
|
|
582
|
-
};
|
|
583
|
-
}
|
|
584
|
-
var memoize_esm_default2 = memoize2;
|
|
585
|
-
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)-.*))$/;
|
|
586
|
-
var index2 = memoize_esm_default2(
|
|
587
|
-
function(prop) {
|
|
588
|
-
return reactPropsRegex2.test(prop) || prop.charCodeAt(0) === 111 && prop.charCodeAt(1) === 110 && prop.charCodeAt(2) < 91;
|
|
589
|
-
}
|
|
590
|
-
/* Z+1 */
|
|
591
|
-
);
|
|
592
|
-
var is_prop_valid_esm_default2 = index2;
|
|
593
|
-
var ADDITIONAL_BLOCKED_PROPS2 = /* @__PURE__ */ new Set([
|
|
594
|
-
// RN-only event handlers (pass isPropValid's on* pattern)
|
|
595
|
-
"onPress",
|
|
596
|
-
"onChangeText",
|
|
597
|
-
"onLayout",
|
|
598
|
-
"onMoveShouldSetResponder",
|
|
599
|
-
"onResponderGrant",
|
|
600
|
-
"onResponderMove",
|
|
601
|
-
"onResponderRelease",
|
|
602
|
-
"onResponderTerminate",
|
|
603
|
-
// SVG attributes that pass isPropValid
|
|
604
|
-
"strokeWidth",
|
|
605
|
-
// CSS properties that pass isPropValid but are used as component props
|
|
606
|
-
"overflow",
|
|
607
|
-
"opacity",
|
|
608
|
-
"cursor",
|
|
609
|
-
"fontSize",
|
|
610
|
-
"fontWeight",
|
|
611
|
-
"fontFamily",
|
|
612
|
-
"textDecoration",
|
|
613
|
-
// Cross-platform layout prop that Text consumes as CSS, never as an
|
|
614
|
-
// attribute. Pinned explicitly because it is now spread into the styled
|
|
615
|
-
// component rather than destructured away before it can reach the DOM.
|
|
616
|
-
"numberOfLines"
|
|
617
|
-
]);
|
|
618
|
-
function shouldForwardProp2(key) {
|
|
619
|
-
if (ADDITIONAL_BLOCKED_PROPS2.has(key)) return false;
|
|
620
|
-
return is_prop_valid_esm_default2(key);
|
|
621
|
-
}
|
|
622
|
-
function createFilteredElement2(defaultTag) {
|
|
623
|
-
const Component = import_react6.default.forwardRef(
|
|
624
|
-
({ children, elementType, ...props }, ref) => {
|
|
625
|
-
const Tag2 = elementType || defaultTag;
|
|
626
|
-
const htmlProps = {};
|
|
627
|
-
for (const key of Object.keys(props)) {
|
|
628
|
-
if (shouldForwardProp2(key)) {
|
|
629
|
-
htmlProps[key] = props[key];
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
return import_react6.default.createElement(
|
|
633
|
-
Tag2,
|
|
634
|
-
{ ref, ...htmlProps },
|
|
635
|
-
children
|
|
636
|
-
);
|
|
637
|
-
}
|
|
638
|
-
);
|
|
639
|
-
Component.displayName = `Filtered(${defaultTag})`;
|
|
640
|
-
return Component;
|
|
641
|
-
}
|
|
642
|
-
var FilteredDiv2 = createFilteredElement2("div");
|
|
643
|
-
var StyledBox = (0, import_styled_components2.default)(FilteredDiv2)`
|
|
644
|
-
display: flex;
|
|
645
|
-
box-sizing: border-box;
|
|
646
|
-
background-color: ${(props) => props.backgroundColor || "transparent"};
|
|
647
|
-
border-color: ${(props) => props.borderColor || "transparent"};
|
|
648
|
-
border-width: ${(props) => typeof props.borderWidth === "number" ? `${props.borderWidth}px` : props.borderWidth || 0};
|
|
649
|
-
|
|
650
|
-
${(props) => props.borderBottomWidth !== void 0 && `
|
|
651
|
-
border-bottom-width: ${typeof props.borderBottomWidth === "number" ? `${props.borderBottomWidth}px` : props.borderBottomWidth};
|
|
652
|
-
border-bottom-color: ${props.borderBottomColor || props.borderColor || "transparent"};
|
|
653
|
-
border-bottom-style: solid;
|
|
654
|
-
`}
|
|
655
|
-
${(props) => props.borderTopWidth !== void 0 && `
|
|
656
|
-
border-top-width: ${typeof props.borderTopWidth === "number" ? `${props.borderTopWidth}px` : props.borderTopWidth};
|
|
657
|
-
border-top-color: ${props.borderTopColor || props.borderColor || "transparent"};
|
|
658
|
-
border-top-style: solid;
|
|
659
|
-
`}
|
|
660
|
-
${(props) => props.borderLeftWidth !== void 0 && `
|
|
661
|
-
border-left-width: ${typeof props.borderLeftWidth === "number" ? `${props.borderLeftWidth}px` : props.borderLeftWidth};
|
|
662
|
-
border-left-color: ${props.borderLeftColor || props.borderColor || "transparent"};
|
|
663
|
-
border-left-style: solid;
|
|
664
|
-
`}
|
|
665
|
-
${(props) => props.borderRightWidth !== void 0 && `
|
|
666
|
-
border-right-width: ${typeof props.borderRightWidth === "number" ? `${props.borderRightWidth}px` : props.borderRightWidth};
|
|
667
|
-
border-right-color: ${props.borderRightColor || props.borderColor || "transparent"};
|
|
668
|
-
border-right-style: solid;
|
|
669
|
-
`}
|
|
670
|
-
|
|
671
|
-
border-style: ${(props) => props.borderStyle || (props.borderWidth || props.borderBottomWidth || props.borderTopWidth || props.borderLeftWidth || props.borderRightWidth ? "solid" : "none")};
|
|
672
|
-
border-radius: ${(props) => typeof props.borderRadius === "number" ? `${props.borderRadius}px` : props.borderRadius || 0};
|
|
673
|
-
height: ${(props) => typeof props.height === "number" ? `${props.height}px` : props.height || "auto"};
|
|
674
|
-
width: ${(props) => typeof props.width === "number" ? `${props.width}px` : props.width || "auto"};
|
|
675
|
-
min-width: ${(props) => typeof props.minWidth === "number" ? `${props.minWidth}px` : props.minWidth || "auto"};
|
|
676
|
-
min-height: ${(props) => typeof props.minHeight === "number" ? `${props.minHeight}px` : props.minHeight || "auto"};
|
|
677
|
-
max-width: ${(props) => typeof props.maxWidth === "number" ? `${props.maxWidth}px` : props.maxWidth || "none"};
|
|
678
|
-
max-height: ${(props) => typeof props.maxHeight === "number" ? `${props.maxHeight}px` : props.maxHeight || "none"};
|
|
679
|
-
|
|
680
|
-
padding: ${(props) => typeof props.padding === "number" ? `${props.padding}px` : props.padding || 0};
|
|
681
|
-
${(props) => props.paddingHorizontal && `
|
|
682
|
-
padding-left: ${typeof props.paddingHorizontal === "number" ? `${props.paddingHorizontal}px` : props.paddingHorizontal};
|
|
683
|
-
padding-right: ${typeof props.paddingHorizontal === "number" ? `${props.paddingHorizontal}px` : props.paddingHorizontal};
|
|
684
|
-
`}
|
|
685
|
-
${(props) => props.paddingVertical && `
|
|
686
|
-
padding-top: ${typeof props.paddingVertical === "number" ? `${props.paddingVertical}px` : props.paddingVertical};
|
|
687
|
-
padding-bottom: ${typeof props.paddingVertical === "number" ? `${props.paddingVertical}px` : props.paddingVertical};
|
|
688
|
-
`}
|
|
689
|
-
${(props) => props.paddingTop !== void 0 && `padding-top: ${typeof props.paddingTop === "number" ? `${props.paddingTop}px` : props.paddingTop};`}
|
|
690
|
-
${(props) => props.paddingBottom !== void 0 && `padding-bottom: ${typeof props.paddingBottom === "number" ? `${props.paddingBottom}px` : props.paddingBottom};`}
|
|
691
|
-
${(props) => props.paddingLeft !== void 0 && `padding-left: ${typeof props.paddingLeft === "number" ? `${props.paddingLeft}px` : props.paddingLeft};`}
|
|
692
|
-
${(props) => props.paddingRight !== void 0 && `padding-right: ${typeof props.paddingRight === "number" ? `${props.paddingRight}px` : props.paddingRight};`}
|
|
693
|
-
|
|
694
|
-
margin: ${(props) => typeof props.margin === "number" ? `${props.margin}px` : props.margin || 0};
|
|
695
|
-
${(props) => props.marginTop !== void 0 && `margin-top: ${typeof props.marginTop === "number" ? `${props.marginTop}px` : props.marginTop};`}
|
|
696
|
-
${(props) => props.marginBottom !== void 0 && `margin-bottom: ${typeof props.marginBottom === "number" ? `${props.marginBottom}px` : props.marginBottom};`}
|
|
697
|
-
${(props) => props.marginLeft !== void 0 && `margin-left: ${typeof props.marginLeft === "number" ? `${props.marginLeft}px` : props.marginLeft};`}
|
|
698
|
-
${(props) => props.marginRight !== void 0 && `margin-right: ${typeof props.marginRight === "number" ? `${props.marginRight}px` : props.marginRight};`}
|
|
699
|
-
|
|
700
|
-
flex-direction: ${(props) => props.flexDirection || "column"};
|
|
701
|
-
flex-wrap: ${(props) => props.flexWrap || "nowrap"};
|
|
702
|
-
align-items: ${(props) => props.alignItems || "stretch"};
|
|
703
|
-
justify-content: ${(props) => props.justifyContent || "flex-start"};
|
|
704
|
-
cursor: ${(props) => props.cursor ? props.cursor : props.onClick || props.onPress ? "pointer" : "inherit"};
|
|
705
|
-
position: ${(props) => props.position || "static"};
|
|
706
|
-
top: ${(props) => typeof props.top === "number" ? `${props.top}px` : props.top};
|
|
707
|
-
bottom: ${(props) => typeof props.bottom === "number" ? `${props.bottom}px` : props.bottom};
|
|
708
|
-
left: ${(props) => typeof props.left === "number" ? `${props.left}px` : props.left};
|
|
709
|
-
right: ${(props) => typeof props.right === "number" ? `${props.right}px` : props.right};
|
|
710
|
-
flex: ${(props) => props.flex};
|
|
711
|
-
flex-shrink: ${(props) => props.flexShrink ?? 1};
|
|
712
|
-
gap: ${(props) => typeof props.gap === "number" ? `${props.gap}px` : props.gap || 0};
|
|
713
|
-
align-self: ${(props) => props.alignSelf || "auto"};
|
|
714
|
-
/* Only emit overflow-x/y when explicitly set. Defaulting them to
|
|
715
|
-
visible after overflow would override the shorthand and break
|
|
716
|
-
clipping (e.g. OtherCard bottom-right promo image). */
|
|
717
|
-
overflow: ${(props) => props.overflow || "visible"};
|
|
718
|
-
${(props) => props.overflowX != null ? `overflow-x: ${props.overflowX};` : ""}
|
|
719
|
-
${(props) => props.overflowY != null ? `overflow-y: ${props.overflowY};` : ""}
|
|
720
|
-
z-index: ${(props) => props.zIndex};
|
|
721
|
-
opacity: ${(props) => props.opacity != null ? props.opacity : props.disabled ? 0.5 : 1};
|
|
722
|
-
pointer-events: ${(props) => props.disabled ? "none" : "auto"};
|
|
723
|
-
|
|
724
|
-
/* \`background\` is emitted before \`background-color\` so a caller passing
|
|
725
|
-
both still gets backgroundColor as the winner. Use the shorthand for a
|
|
726
|
-
layered fill (e.g. an overlay tint over a resting surface colour), which
|
|
727
|
-
a single background-color cannot express. */
|
|
728
|
-
&:hover {
|
|
729
|
-
${(props) => props.hoverStyle?.background && `background: ${props.hoverStyle.background};`}
|
|
730
|
-
${(props) => props.hoverStyle?.backgroundColor && `background-color: ${props.hoverStyle.backgroundColor};`}
|
|
731
|
-
${(props) => props.hoverStyle?.borderColor && `border-color: ${props.hoverStyle.borderColor};`}
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
&:active {
|
|
735
|
-
${(props) => props.pressStyle?.background && `background: ${props.pressStyle.background};`}
|
|
736
|
-
${(props) => props.pressStyle?.backgroundColor && `background-color: ${props.pressStyle.backgroundColor};`}
|
|
737
|
-
}
|
|
738
|
-
`;
|
|
739
|
-
var Box2 = import_react5.default.forwardRef(
|
|
740
|
-
({
|
|
741
|
-
children,
|
|
742
|
-
onPress,
|
|
743
|
-
onKeyDown,
|
|
744
|
-
onKeyUp,
|
|
745
|
-
role,
|
|
746
|
-
"aria-label": ariaLabel,
|
|
747
|
-
"aria-labelledby": ariaLabelledBy,
|
|
748
|
-
"aria-current": ariaCurrent,
|
|
749
|
-
"aria-disabled": ariaDisabled,
|
|
750
|
-
"aria-live": ariaLive,
|
|
751
|
-
"aria-busy": ariaBusy,
|
|
752
|
-
"aria-describedby": ariaDescribedBy,
|
|
753
|
-
"aria-expanded": ariaExpanded,
|
|
754
|
-
"aria-haspopup": ariaHasPopup,
|
|
755
|
-
"aria-pressed": ariaPressed,
|
|
756
|
-
"aria-controls": ariaControls,
|
|
757
|
-
tabIndex,
|
|
758
|
-
as,
|
|
759
|
-
src,
|
|
760
|
-
alt,
|
|
761
|
-
onError,
|
|
762
|
-
onLoad,
|
|
763
|
-
type,
|
|
764
|
-
disabled,
|
|
765
|
-
id,
|
|
766
|
-
testID,
|
|
767
|
-
"data-testid": dataTestId,
|
|
768
|
-
...props
|
|
769
|
-
}, ref) => {
|
|
770
|
-
if (as === "img" && src) {
|
|
771
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
772
|
-
"img",
|
|
773
|
-
{
|
|
774
|
-
src,
|
|
775
|
-
alt: alt || "",
|
|
776
|
-
onError,
|
|
777
|
-
onLoad,
|
|
778
|
-
"data-testid": dataTestId || testID,
|
|
779
|
-
style: {
|
|
780
|
-
display: "block",
|
|
781
|
-
objectFit: "cover",
|
|
782
|
-
width: typeof props.width === "number" ? `${props.width}px` : props.width,
|
|
783
|
-
height: typeof props.height === "number" ? `${props.height}px` : props.height,
|
|
784
|
-
borderRadius: typeof props.borderRadius === "number" ? `${props.borderRadius}px` : props.borderRadius,
|
|
785
|
-
position: props.position,
|
|
786
|
-
top: typeof props.top === "number" ? `${props.top}px` : props.top,
|
|
787
|
-
left: typeof props.left === "number" ? `${props.left}px` : props.left,
|
|
788
|
-
right: typeof props.right === "number" ? `${props.right}px` : props.right,
|
|
789
|
-
bottom: typeof props.bottom === "number" ? `${props.bottom}px` : props.bottom,
|
|
790
|
-
...props.style
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
);
|
|
794
|
-
}
|
|
795
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
796
|
-
StyledBox,
|
|
797
|
-
{
|
|
798
|
-
ref,
|
|
799
|
-
elementType: as,
|
|
800
|
-
id,
|
|
801
|
-
type: as === "button" ? type || "button" : void 0,
|
|
802
|
-
disabled: as === "button" ? disabled : void 0,
|
|
803
|
-
onClick: onPress,
|
|
804
|
-
onKeyDown,
|
|
805
|
-
onKeyUp,
|
|
806
|
-
role,
|
|
807
|
-
"aria-label": ariaLabel,
|
|
808
|
-
"aria-labelledby": ariaLabelledBy,
|
|
809
|
-
"aria-current": ariaCurrent,
|
|
810
|
-
"aria-disabled": ariaDisabled,
|
|
811
|
-
"aria-busy": ariaBusy,
|
|
812
|
-
"aria-describedby": ariaDescribedBy,
|
|
813
|
-
"aria-expanded": ariaExpanded,
|
|
814
|
-
"aria-haspopup": ariaHasPopup,
|
|
815
|
-
"aria-pressed": ariaPressed,
|
|
816
|
-
"aria-controls": ariaControls,
|
|
817
|
-
"aria-live": ariaLive,
|
|
818
|
-
tabIndex: tabIndex !== void 0 ? tabIndex : void 0,
|
|
819
|
-
"data-testid": dataTestId || testID,
|
|
820
|
-
...props,
|
|
821
|
-
children
|
|
822
|
-
}
|
|
823
|
-
);
|
|
824
|
-
}
|
|
825
|
-
);
|
|
826
|
-
Box2.displayName = "Box";
|
|
827
|
-
var truncationStyles = (numberOfLines) => {
|
|
828
|
-
if (!numberOfLines || numberOfLines < 1) return "";
|
|
829
|
-
if (numberOfLines === 1) {
|
|
830
|
-
return `
|
|
831
|
-
display: block;
|
|
832
|
-
max-width: 100%;
|
|
833
|
-
min-width: 0;
|
|
834
|
-
overflow: hidden;
|
|
835
|
-
text-overflow: ellipsis;
|
|
836
|
-
white-space: nowrap;
|
|
837
|
-
`;
|
|
838
|
-
}
|
|
839
|
-
return `
|
|
840
|
-
display: -webkit-box;
|
|
841
|
-
-webkit-box-orient: vertical;
|
|
842
|
-
-webkit-line-clamp: ${numberOfLines};
|
|
843
|
-
line-clamp: ${numberOfLines};
|
|
844
|
-
max-width: 100%;
|
|
845
|
-
min-width: 0;
|
|
846
|
-
overflow: hidden;
|
|
847
|
-
`;
|
|
848
|
-
};
|
|
849
|
-
var FilteredSpan = createFilteredElement2("span");
|
|
850
|
-
var StyledText = (0, import_styled_components3.default)(FilteredSpan)`
|
|
851
|
-
color: ${(props) => props.color || "inherit"};
|
|
852
|
-
font-size: ${(props) => typeof props.fontSize === "number" ? `${props.fontSize}px` : props.fontSize || "inherit"};
|
|
853
|
-
font-weight: ${(props) => props.fontWeight || "normal"};
|
|
854
|
-
font-family: ${(props) => props.fontFamily || '"Aktiv Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'};
|
|
855
|
-
line-height: ${(props) => typeof props.lineHeight === "number" ? `${props.lineHeight}px` : props.lineHeight || "inherit"};
|
|
856
|
-
white-space: ${(props) => props.whiteSpace || "normal"};
|
|
857
|
-
text-align: ${(props) => props.textAlign || "inherit"};
|
|
858
|
-
text-decoration: ${(props) => props.textDecoration || "none"};
|
|
859
|
-
|
|
860
|
-
/* Keep last: single-line truncation has to win over white-space above. */
|
|
861
|
-
${(props) => truncationStyles(props.numberOfLines)}
|
|
862
|
-
`;
|
|
863
|
-
var Text2 = ({
|
|
864
|
-
style,
|
|
865
|
-
className,
|
|
866
|
-
id,
|
|
867
|
-
role,
|
|
868
|
-
testID,
|
|
869
|
-
"data-testid": dataTestId,
|
|
870
|
-
...props
|
|
871
|
-
}) => {
|
|
872
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
873
|
-
StyledText,
|
|
874
|
-
{
|
|
875
|
-
...props,
|
|
876
|
-
style,
|
|
877
|
-
className,
|
|
878
|
-
id,
|
|
879
|
-
role,
|
|
880
|
-
"data-testid": dataTestId || testID
|
|
881
|
-
}
|
|
882
|
-
);
|
|
883
|
-
};
|
|
884
|
-
var FilteredDiv22 = createFilteredElement2("div");
|
|
885
|
-
var StyledIcon2 = (0, import_styled_components4.default)(FilteredDiv22)`
|
|
886
|
-
display: flex;
|
|
887
|
-
align-items: center;
|
|
888
|
-
justify-content: center;
|
|
889
|
-
width: ${(props) => typeof props.size === "number" ? `${props.size}px` : props.size || "24px"};
|
|
890
|
-
height: ${(props) => typeof props.size === "number" ? `${props.size}px` : props.size || "24px"};
|
|
891
|
-
color: ${(props) => props.color || "currentColor"};
|
|
892
|
-
|
|
893
|
-
/* Icons paint themselves — each icon's own SVG sets its fill/stroke
|
|
894
|
-
(icons-base via inline "fill: currentColor", Lucide via "fill"/"stroke"
|
|
895
|
-
attributes). Do not add fill/stroke here: it re-strokes fill-based icons
|
|
896
|
-
and thickens the glyph. See FEP-877. */
|
|
897
|
-
svg {
|
|
898
|
-
width: 100%;
|
|
899
|
-
height: 100%;
|
|
900
|
-
}
|
|
901
|
-
`;
|
|
902
|
-
var Icon4 = ({
|
|
903
|
-
children,
|
|
904
|
-
testID,
|
|
905
|
-
"data-testid": dataTestId,
|
|
906
|
-
...props
|
|
907
|
-
}) => {
|
|
908
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(StyledIcon2, { "data-testid": dataTestId || testID, ...props, children });
|
|
909
|
-
};
|
|
910
|
-
var Tag = ({
|
|
911
|
-
size = "md",
|
|
912
|
-
tone = "primary",
|
|
913
|
-
type = "solid",
|
|
914
|
-
children,
|
|
915
|
-
iconLeft,
|
|
916
|
-
iconRight,
|
|
917
|
-
onRemove,
|
|
918
|
-
testID,
|
|
919
|
-
themeMode,
|
|
920
|
-
themeProductContext
|
|
921
|
-
}) => {
|
|
922
|
-
const { theme } = (0, import_xui_core.useResolvedTheme)({ themeMode, themeProductContext });
|
|
923
|
-
const sizeStyles = theme.sizing.tag(size);
|
|
924
|
-
const resolveColors = () => {
|
|
925
|
-
const isOutlined = type === "outlined";
|
|
926
|
-
switch (tone) {
|
|
927
|
-
case "primary":
|
|
928
|
-
return {
|
|
929
|
-
bg: isOutlined ? "transparent" : theme.colors.background.primary,
|
|
930
|
-
text: theme.colors.content.primary,
|
|
931
|
-
border: theme.colors.border.secondary
|
|
932
|
-
};
|
|
933
|
-
case "brand":
|
|
934
|
-
return {
|
|
935
|
-
bg: isOutlined ? "transparent" : theme.colors.background.brand.primary,
|
|
936
|
-
text: isOutlined ? theme.colors.content.brand.primary : theme.colors.content.on.brand,
|
|
937
|
-
border: theme.colors.border.brand
|
|
938
|
-
};
|
|
939
|
-
case "brandExtra":
|
|
940
|
-
return {
|
|
941
|
-
bg: isOutlined ? "transparent" : theme.colors.background.brandExtra.primary,
|
|
942
|
-
text: isOutlined ? theme.colors.content.brandExtra.primary : theme.colors.content.on.brandExtra,
|
|
943
|
-
border: theme.colors.border.brandExtra
|
|
944
|
-
};
|
|
945
|
-
case "success":
|
|
946
|
-
return {
|
|
947
|
-
bg: isOutlined ? "transparent" : theme.colors.background.success.primary,
|
|
948
|
-
text: isOutlined ? theme.colors.content.success.primary : theme.colors.content.on.success,
|
|
949
|
-
border: theme.colors.border.success
|
|
950
|
-
};
|
|
951
|
-
case "warning":
|
|
952
|
-
return {
|
|
953
|
-
bg: isOutlined ? "transparent" : theme.colors.background.warning.primary,
|
|
954
|
-
text: isOutlined ? theme.colors.content.warning.primary : theme.colors.content.on.warning,
|
|
955
|
-
border: theme.colors.border.warning
|
|
956
|
-
};
|
|
957
|
-
case "alert":
|
|
958
|
-
return {
|
|
959
|
-
bg: isOutlined ? "transparent" : theme.colors.background.alert.primary,
|
|
960
|
-
text: isOutlined ? theme.colors.content.alert.primary : theme.colors.content.on.alert,
|
|
961
|
-
border: theme.colors.border.alert
|
|
962
|
-
};
|
|
963
|
-
case "neutral":
|
|
964
|
-
return {
|
|
965
|
-
bg: isOutlined ? "transparent" : theme.colors.background.neutral.primary,
|
|
966
|
-
text: isOutlined ? theme.colors.content.neutral.primary : theme.colors.content.on.neutral,
|
|
967
|
-
border: theme.colors.border.neutral
|
|
968
|
-
};
|
|
969
|
-
default:
|
|
970
|
-
return {
|
|
971
|
-
bg: isOutlined ? "transparent" : theme.colors.background.primary,
|
|
972
|
-
text: theme.colors.content.primary,
|
|
973
|
-
border: theme.colors.border.secondary
|
|
974
|
-
};
|
|
975
|
-
}
|
|
976
|
-
};
|
|
977
|
-
const { bg, text, border } = resolveColors();
|
|
978
|
-
const isIconOnly = !children && (!!iconLeft || !!iconRight);
|
|
979
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
980
|
-
Box2,
|
|
981
|
-
{
|
|
982
|
-
testID,
|
|
983
|
-
backgroundColor: bg,
|
|
984
|
-
borderRadius: sizeStyles.radius,
|
|
985
|
-
height: sizeStyles.height,
|
|
986
|
-
width: isIconOnly ? sizeStyles.height : void 0,
|
|
987
|
-
paddingHorizontal: isIconOnly ? 0 : sizeStyles.padding,
|
|
988
|
-
flexDirection: "row",
|
|
989
|
-
alignItems: "center",
|
|
990
|
-
justifyContent: "center",
|
|
991
|
-
gap: sizeStyles.gap,
|
|
992
|
-
borderWidth: sizeStyles.borderWidth,
|
|
993
|
-
borderColor: border,
|
|
994
|
-
borderStyle: "solid",
|
|
995
|
-
style: {
|
|
996
|
-
overflow: "hidden",
|
|
997
|
-
textOverflow: "ellipsis",
|
|
998
|
-
whiteSpace: "nowrap"
|
|
999
|
-
},
|
|
1000
|
-
children: [
|
|
1001
|
-
iconLeft && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon4, { size: sizeStyles.iconSize, color: text, children: iconLeft }),
|
|
1002
|
-
children && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1003
|
-
Text2,
|
|
1004
|
-
{
|
|
1005
|
-
color: text,
|
|
1006
|
-
fontSize: sizeStyles.fontSize,
|
|
1007
|
-
fontWeight: "500",
|
|
1008
|
-
whiteSpace: "nowrap",
|
|
1009
|
-
style: {
|
|
1010
|
-
overflow: "hidden",
|
|
1011
|
-
textOverflow: "ellipsis"
|
|
1012
|
-
},
|
|
1013
|
-
children
|
|
1014
|
-
}
|
|
1015
|
-
),
|
|
1016
|
-
iconRight && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon4, { size: sizeStyles.iconSize, color: text, children: iconRight }),
|
|
1017
|
-
onRemove && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box2, { onPress: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(X2, { size: sizeStyles.iconSize, color: text }) })
|
|
1018
|
-
]
|
|
1019
|
-
}
|
|
1020
|
-
);
|
|
1021
|
-
};
|
|
1022
|
-
|
|
1023
|
-
// src/useMultiSelectControl.tsx
|
|
1024
|
-
var import_xui_core2 = require("@xsolla/xui-core");
|
|
1025
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1026
389
|
var COUNT_ITEM_VALUE = "count-item";
|
|
1027
390
|
var useMultiSelectControl = ({
|
|
1028
391
|
variant,
|
|
@@ -1038,16 +401,16 @@ var useMultiSelectControl = ({
|
|
|
1038
401
|
themeMode,
|
|
1039
402
|
themeProductContext
|
|
1040
403
|
}) => {
|
|
1041
|
-
const { theme } = (0,
|
|
1042
|
-
const displayStateRef = (0,
|
|
1043
|
-
const savedWidthsRef = (0,
|
|
1044
|
-
const itemsRef = (0,
|
|
1045
|
-
const [itemsWidth, setItemsWidth] = (0,
|
|
1046
|
-
const [selectedContent, setSelectedContent] = (0,
|
|
404
|
+
const { theme } = (0, import_xui_core.useResolvedTheme)({ themeMode, themeProductContext });
|
|
405
|
+
const displayStateRef = (0, import_react2.useRef)(0 /* Placeholder */);
|
|
406
|
+
const savedWidthsRef = (0, import_react2.useRef)(null);
|
|
407
|
+
const itemsRef = (0, import_react2.useRef)(null);
|
|
408
|
+
const [itemsWidth, setItemsWidth] = (0, import_react2.useState)(0);
|
|
409
|
+
const [selectedContent, setSelectedContent] = (0, import_react2.useState)(
|
|
1047
410
|
null
|
|
1048
411
|
);
|
|
1049
412
|
const isPlaceholder = !selectedItems || selectedItems.length === 0;
|
|
1050
|
-
(0,
|
|
413
|
+
(0, import_react2.useEffect)(() => {
|
|
1051
414
|
if (!containerRef.current) return;
|
|
1052
415
|
let rafId = null;
|
|
1053
416
|
const syncItemsWidth = () => {
|
|
@@ -1067,12 +430,13 @@ var useMultiSelectControl = ({
|
|
|
1067
430
|
resizeObserver.disconnect();
|
|
1068
431
|
};
|
|
1069
432
|
}, [containerRef]);
|
|
1070
|
-
const widthsDependencies = (0,
|
|
433
|
+
const widthsDependencies = (0, import_react2.useMemo)(
|
|
1071
434
|
() => ({
|
|
1072
435
|
stateList: stateList.map((item) => item.value),
|
|
1073
436
|
variant,
|
|
1074
437
|
size,
|
|
1075
|
-
removeTagsButtons
|
|
438
|
+
removeTagsButtons,
|
|
439
|
+
lockedList: stateList.filter((item) => item.removable === false).map((item) => item.value)
|
|
1076
440
|
}),
|
|
1077
441
|
[stateList, variant, size, removeTagsButtons]
|
|
1078
442
|
);
|
|
@@ -1085,16 +449,23 @@ var useMultiSelectControl = ({
|
|
|
1085
449
|
return true;
|
|
1086
450
|
if (prev.stateList.length !== widthsDependencies.stateList.length)
|
|
1087
451
|
return true;
|
|
452
|
+
if (prev.lockedList.length !== widthsDependencies.lockedList.length)
|
|
453
|
+
return true;
|
|
1088
454
|
let i = 0;
|
|
1089
455
|
for (const v of prev.stateList) {
|
|
1090
456
|
if (v !== widthsDependencies.stateList[i]) return true;
|
|
1091
457
|
i++;
|
|
1092
458
|
}
|
|
459
|
+
let j = 0;
|
|
460
|
+
for (const v of prev.lockedList) {
|
|
461
|
+
if (v !== widthsDependencies.lockedList[j]) return true;
|
|
462
|
+
j++;
|
|
463
|
+
}
|
|
1093
464
|
return false;
|
|
1094
465
|
};
|
|
1095
466
|
const setPlaceholder = () => {
|
|
1096
467
|
setSelectedContent(
|
|
1097
|
-
/* @__PURE__ */ (0,
|
|
468
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1098
469
|
Text,
|
|
1099
470
|
{
|
|
1100
471
|
color: theme.colors.control.input.placeholder,
|
|
@@ -1141,28 +512,30 @@ var useMultiSelectControl = ({
|
|
|
1141
512
|
const countText = displayStateRef.current === 1 /* PreRender */ ? `+${itemsList.length}` : `+${itemsList.length - displayedItems.length}`;
|
|
1142
513
|
displayedItems.push({ value: COUNT_ITEM_VALUE, label: countText });
|
|
1143
514
|
}
|
|
1144
|
-
const content = displayedItems.map((item,
|
|
515
|
+
const content = displayedItems.map((item, index) => {
|
|
1145
516
|
const isCount = item.value === COUNT_ITEM_VALUE;
|
|
1146
|
-
const
|
|
517
|
+
const isLocked = !isCount && item.removable === false;
|
|
518
|
+
const canRemove = !isCount && !isLocked;
|
|
519
|
+
const isReducable = index === 0 && displayStateRef.current === 3 /* Render */ && displayedItemsCount === 0 || flexible;
|
|
1147
520
|
if (variant === "tag") {
|
|
1148
|
-
return /* @__PURE__ */ (0,
|
|
521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1149
522
|
Box,
|
|
1150
523
|
{
|
|
1151
|
-
onPress:
|
|
524
|
+
onPress: canRemove ? (e) => {
|
|
1152
525
|
e.stopPropagation();
|
|
1153
526
|
if (!disabled) removeValue(item.value, e);
|
|
1154
527
|
} : void 0,
|
|
1155
528
|
style: {
|
|
1156
529
|
minWidth: isReducable ? 0 : "fit-content",
|
|
1157
530
|
opacity: disabled ? 0.5 : 1,
|
|
1158
|
-
cursor: disabled || isCount ? "not-allowed" : "pointer"
|
|
531
|
+
cursor: isLocked ? "default" : disabled || isCount ? "not-allowed" : "pointer"
|
|
1159
532
|
},
|
|
1160
|
-
children: /* @__PURE__ */ (0,
|
|
1161
|
-
Tag,
|
|
533
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
534
|
+
import_xui_tag.Tag,
|
|
1162
535
|
{
|
|
1163
536
|
size,
|
|
1164
537
|
tone: "primary",
|
|
1165
|
-
onRemove: removeTagsButtons &&
|
|
538
|
+
onRemove: removeTagsButtons && canRemove ? (e) => {
|
|
1166
539
|
e?.stopPropagation();
|
|
1167
540
|
if (!disabled) removeValue(item.value, e);
|
|
1168
541
|
} : void 0,
|
|
@@ -1174,8 +547,8 @@ var useMultiSelectControl = ({
|
|
|
1174
547
|
);
|
|
1175
548
|
}
|
|
1176
549
|
const isCountItem = hasHidden;
|
|
1177
|
-
const needsComma =
|
|
1178
|
-
return /* @__PURE__ */ (0,
|
|
550
|
+
const needsComma = index < displayedItems.length - 2 || index < displayedItems.length - 1 && !isCountItem;
|
|
551
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1179
552
|
Text,
|
|
1180
553
|
{
|
|
1181
554
|
color: theme.colors.content.primary,
|
|
@@ -1210,11 +583,11 @@ var useMultiSelectControl = ({
|
|
|
1210
583
|
const countItemWidth = countEl.getBoundingClientRect().width;
|
|
1211
584
|
const columnGap = parseInt(getComputedStyle(itemsRef.current).columnGap || "0", 10) || 0;
|
|
1212
585
|
const tagsWidths = {};
|
|
1213
|
-
let
|
|
586
|
+
let index = 0;
|
|
1214
587
|
for (const el of allItems) {
|
|
1215
|
-
const key =
|
|
588
|
+
const key = index < allItems.length - 1 ? stateList[index].value : COUNT_ITEM_VALUE;
|
|
1216
589
|
tagsWidths[key] = el.getBoundingClientRect().width;
|
|
1217
|
-
|
|
590
|
+
index++;
|
|
1218
591
|
}
|
|
1219
592
|
savedWidthsRef.current = {
|
|
1220
593
|
tagsWidths,
|
|
@@ -1225,7 +598,7 @@ var useMultiSelectControl = ({
|
|
|
1225
598
|
displayStateRef.current = 3 /* Render */;
|
|
1226
599
|
setItemsRender();
|
|
1227
600
|
};
|
|
1228
|
-
(0,
|
|
601
|
+
(0, import_react2.useEffect)(() => {
|
|
1229
602
|
if (isPlaceholder) {
|
|
1230
603
|
displayStateRef.current = 0 /* Placeholder */;
|
|
1231
604
|
setPlaceholder();
|
|
@@ -1259,7 +632,7 @@ var useMultiSelectControl = ({
|
|
|
1259
632
|
widthsDependencies,
|
|
1260
633
|
stateList
|
|
1261
634
|
]);
|
|
1262
|
-
(0,
|
|
635
|
+
(0, import_react2.useEffect)(() => {
|
|
1263
636
|
if (displayStateRef.current !== 2 /* Calculation */) return;
|
|
1264
637
|
const rafId = requestAnimationFrame(() => {
|
|
1265
638
|
if (displayStateRef.current === 2 /* Calculation */) {
|
|
@@ -1277,8 +650,8 @@ var useMultiSelectControl = ({
|
|
|
1277
650
|
};
|
|
1278
651
|
|
|
1279
652
|
// src/MultiSelectControl.tsx
|
|
1280
|
-
var
|
|
1281
|
-
var MultiSelectControl = (0,
|
|
653
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
654
|
+
var MultiSelectControl = (0, import_react3.forwardRef)(
|
|
1282
655
|
({
|
|
1283
656
|
variant = "tag",
|
|
1284
657
|
flexible = true,
|
|
@@ -1302,12 +675,12 @@ var MultiSelectControl = (0, import_react8.forwardRef)(
|
|
|
1302
675
|
themeMode,
|
|
1303
676
|
themeProductContext
|
|
1304
677
|
}, ref) => {
|
|
1305
|
-
const { theme } = (0,
|
|
678
|
+
const { theme } = (0, import_xui_core2.useResolvedTheme)({ themeMode, themeProductContext });
|
|
1306
679
|
const sizeStyles = theme.sizing.input(size);
|
|
1307
680
|
const inputColors = theme.colors.control.input;
|
|
1308
681
|
const state = externalState || (disabled ? "disable" : "default");
|
|
1309
682
|
const isDisable = state === "disable" || disabled;
|
|
1310
|
-
const containerRef = (0,
|
|
683
|
+
const containerRef = (0, import_react3.useRef)(null);
|
|
1311
684
|
const { itemsRef, selectedContent, isCalculating } = useMultiSelectControl({
|
|
1312
685
|
variant,
|
|
1313
686
|
flexible,
|
|
@@ -1337,7 +710,7 @@ var MultiSelectControl = (0, import_react8.forwardRef)(
|
|
|
1337
710
|
borderColor = inputColors.borderHover;
|
|
1338
711
|
}
|
|
1339
712
|
const iconColor = isDisable ? inputColors.textDisable : inputColors.placeholder;
|
|
1340
|
-
return /* @__PURE__ */ (0,
|
|
713
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1341
714
|
Box,
|
|
1342
715
|
{
|
|
1343
716
|
ref,
|
|
@@ -1365,7 +738,7 @@ var MultiSelectControl = (0, import_react8.forwardRef)(
|
|
|
1365
738
|
borderColor: inputColors.borderHover
|
|
1366
739
|
} : void 0,
|
|
1367
740
|
children: [
|
|
1368
|
-
/* @__PURE__ */ (0,
|
|
741
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1369
742
|
Box,
|
|
1370
743
|
{
|
|
1371
744
|
ref: containerRef,
|
|
@@ -1375,8 +748,8 @@ var MultiSelectControl = (0, import_react8.forwardRef)(
|
|
|
1375
748
|
gap: 8,
|
|
1376
749
|
style: { minWidth: 0 },
|
|
1377
750
|
children: [
|
|
1378
|
-
iconLeft && /* @__PURE__ */ (0,
|
|
1379
|
-
/* @__PURE__ */ (0,
|
|
751
|
+
iconLeft && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { size: sizeStyles.iconSize, color: iconColor, variant: "line", children: iconLeft }),
|
|
752
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1380
753
|
Box,
|
|
1381
754
|
{
|
|
1382
755
|
ref: itemsRef,
|
|
@@ -1392,8 +765,8 @@ var MultiSelectControl = (0, import_react8.forwardRef)(
|
|
|
1392
765
|
]
|
|
1393
766
|
}
|
|
1394
767
|
),
|
|
1395
|
-
/* @__PURE__ */ (0,
|
|
1396
|
-
extraClear && selectedItems.length > 0 && !isDisable && /* @__PURE__ */ (0,
|
|
768
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box, { flexDirection: "row", alignItems: "center", gap: 4, children: [
|
|
769
|
+
extraClear && selectedItems.length > 0 && !isDisable && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1397
770
|
Box,
|
|
1398
771
|
{
|
|
1399
772
|
onPress: (e) => {
|
|
@@ -1401,11 +774,11 @@ var MultiSelectControl = (0, import_react8.forwardRef)(
|
|
|
1401
774
|
removeAllValues();
|
|
1402
775
|
},
|
|
1403
776
|
style: { cursor: "pointer" },
|
|
1404
|
-
children: /* @__PURE__ */ (0,
|
|
777
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_xui_icons_base.Remove, { size: 18, color: iconColor, variant: "line" })
|
|
1405
778
|
}
|
|
1406
779
|
),
|
|
1407
|
-
isError && /* @__PURE__ */ (0,
|
|
1408
|
-
iconRight ? iconRight : isOpen ? /* @__PURE__ */ (0,
|
|
780
|
+
isError && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_xui_icons_base.ExclamationMarkCr, { size: 18, color: theme.colors.content.alert.primary }),
|
|
781
|
+
iconRight ? iconRight : isOpen ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_xui_icons_base.ChevronUp, { size: 18, color: iconColor, variant: "line" }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_xui_icons_base.ChevronDown, { size: 18, color: iconColor, variant: "line" })
|
|
1409
782
|
] })
|
|
1410
783
|
]
|
|
1411
784
|
}
|
|
@@ -1415,23 +788,28 @@ var MultiSelectControl = (0, import_react8.forwardRef)(
|
|
|
1415
788
|
MultiSelectControl.displayName = "MultiSelectControl";
|
|
1416
789
|
|
|
1417
790
|
// src/useMultiSelect.ts
|
|
1418
|
-
var
|
|
791
|
+
var import_react4 = require("react");
|
|
1419
792
|
var initialState = {
|
|
1420
793
|
values: [],
|
|
1421
794
|
selectedItems: [],
|
|
1422
795
|
isOpen: false
|
|
1423
796
|
};
|
|
797
|
+
var isLockedOption = (option) => option.removable === false;
|
|
1424
798
|
var useMultiSelect = ({
|
|
1425
799
|
options,
|
|
1426
800
|
value = [],
|
|
1427
801
|
onChange
|
|
1428
802
|
}) => {
|
|
1429
|
-
const [state, setState] = (0,
|
|
1430
|
-
const optionsRef = (0,
|
|
1431
|
-
(0,
|
|
803
|
+
const [state, setState] = (0, import_react4.useState)(initialState);
|
|
804
|
+
const optionsRef = (0, import_react4.useRef)(options);
|
|
805
|
+
const valuesRef = (0, import_react4.useRef)(value);
|
|
806
|
+
(0, import_react4.useEffect)(() => {
|
|
1432
807
|
optionsRef.current = options;
|
|
1433
808
|
}, [options]);
|
|
1434
|
-
(0,
|
|
809
|
+
(0, import_react4.useEffect)(() => {
|
|
810
|
+
valuesRef.current = state.values;
|
|
811
|
+
}, [state.values]);
|
|
812
|
+
(0, import_react4.useEffect)(() => {
|
|
1435
813
|
const selectedItems = options.filter((opt) => value.includes(opt.value));
|
|
1436
814
|
setState((prevState) => ({
|
|
1437
815
|
...prevState,
|
|
@@ -1439,9 +817,15 @@ var useMultiSelect = ({
|
|
|
1439
817
|
selectedItems
|
|
1440
818
|
}));
|
|
1441
819
|
}, [options, value]);
|
|
1442
|
-
const
|
|
820
|
+
const getLockedSelectedValues = () => optionsRef.current.filter(
|
|
821
|
+
(opt) => isLockedOption(opt) && valuesRef.current.includes(opt.value)
|
|
822
|
+
).map((opt) => opt.value);
|
|
823
|
+
const onChoose = (0, import_react4.useCallback)(
|
|
1443
824
|
(selectedIds) => {
|
|
1444
|
-
const
|
|
825
|
+
const lockedValues = getLockedSelectedValues();
|
|
826
|
+
const newValues = optionsRef.current.filter(
|
|
827
|
+
(opt) => selectedIds.includes(String(opt.value)) || lockedValues.includes(opt.value)
|
|
828
|
+
).map((opt) => opt.value);
|
|
1445
829
|
const newSelectedItems = optionsRef.current.filter(
|
|
1446
830
|
(opt) => newValues.includes(opt.value)
|
|
1447
831
|
);
|
|
@@ -1454,9 +838,11 @@ var useMultiSelect = ({
|
|
|
1454
838
|
},
|
|
1455
839
|
[onChange]
|
|
1456
840
|
);
|
|
1457
|
-
const onRemove = (0,
|
|
841
|
+
const onRemove = (0, import_react4.useCallback)(
|
|
1458
842
|
(value2, event) => {
|
|
1459
843
|
event?.stopPropagation();
|
|
844
|
+
const option = optionsRef.current.find((opt) => opt.value === value2);
|
|
845
|
+
if (option && isLockedOption(option)) return;
|
|
1460
846
|
setState((prev) => {
|
|
1461
847
|
const newValues = prev.values.filter((v) => v !== value2);
|
|
1462
848
|
const newSelectedItems = optionsRef.current.filter(
|
|
@@ -1472,21 +858,25 @@ var useMultiSelect = ({
|
|
|
1472
858
|
},
|
|
1473
859
|
[onChange]
|
|
1474
860
|
);
|
|
1475
|
-
const onRemoveAll = (0,
|
|
861
|
+
const onRemoveAll = (0, import_react4.useCallback)(() => {
|
|
862
|
+
const keptValues = getLockedSelectedValues();
|
|
863
|
+
const keptItems = optionsRef.current.filter(
|
|
864
|
+
(opt) => keptValues.includes(opt.value)
|
|
865
|
+
);
|
|
1476
866
|
setState((prevState) => ({
|
|
1477
867
|
...prevState,
|
|
1478
|
-
values:
|
|
1479
|
-
selectedItems:
|
|
868
|
+
values: keptValues,
|
|
869
|
+
selectedItems: keptItems
|
|
1480
870
|
}));
|
|
1481
|
-
onChange?.(
|
|
871
|
+
onChange?.(keptValues);
|
|
1482
872
|
}, [onChange]);
|
|
1483
|
-
const onSelectClick = (0,
|
|
873
|
+
const onSelectClick = (0, import_react4.useCallback)(() => {
|
|
1484
874
|
setState((prevState) => ({
|
|
1485
875
|
...prevState,
|
|
1486
876
|
isOpen: !prevState.isOpen
|
|
1487
877
|
}));
|
|
1488
878
|
}, []);
|
|
1489
|
-
const onClose = (0,
|
|
879
|
+
const onClose = (0, import_react4.useCallback)(() => {
|
|
1490
880
|
setState((prevState) => ({
|
|
1491
881
|
...prevState,
|
|
1492
882
|
isOpen: false
|
|
@@ -1506,13 +896,15 @@ var useMultiSelect = ({
|
|
|
1506
896
|
};
|
|
1507
897
|
|
|
1508
898
|
// src/Portal.native.tsx
|
|
1509
|
-
var
|
|
1510
|
-
var Portal = ({ children }) => /* @__PURE__ */ (0,
|
|
899
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
900
|
+
var Portal = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children });
|
|
1511
901
|
|
|
1512
902
|
// src/MultiSelect.tsx
|
|
1513
|
-
var
|
|
903
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1514
904
|
var EXTERNAL_MENU_MIN_WIDTH_DEFAULT = 540;
|
|
1515
|
-
var
|
|
905
|
+
var SEARCH_ROW_HEIGHT = 60;
|
|
906
|
+
var SELECT_ALL_ROW_HEIGHT = 37;
|
|
907
|
+
var MultiSelect = (0, import_react5.forwardRef)(
|
|
1516
908
|
({
|
|
1517
909
|
options,
|
|
1518
910
|
errorMessage,
|
|
@@ -1538,19 +930,22 @@ var MultiSelect = (0, import_react10.forwardRef)(
|
|
|
1538
930
|
searchable = false,
|
|
1539
931
|
searchPlaceholder = "Search",
|
|
1540
932
|
noOptionsMessage = "No results",
|
|
933
|
+
selectAll = false,
|
|
934
|
+
selectAllLabel = "Select all",
|
|
935
|
+
deselectAllLabel = "Deselect all",
|
|
1541
936
|
testID,
|
|
1542
937
|
themeMode,
|
|
1543
938
|
themeProductContext
|
|
1544
939
|
}, ref) => {
|
|
1545
|
-
const { theme } = (0,
|
|
1546
|
-
const modalId = (0,
|
|
1547
|
-
const overlayLayer = (0,
|
|
1548
|
-
const controlRef = (0,
|
|
1549
|
-
const menuRef = (0,
|
|
1550
|
-
const containerRef = (0,
|
|
1551
|
-
const searchInputRef = (0,
|
|
1552
|
-
const [menuPosition, setMenuPosition] = (0,
|
|
1553
|
-
const [searchValue, setSearchValue] = (0,
|
|
940
|
+
const { theme } = (0, import_xui_core3.useResolvedTheme)({ themeMode, themeProductContext });
|
|
941
|
+
const modalId = (0, import_xui_core3.useModalId)();
|
|
942
|
+
const overlayLayer = (0, import_xui_core3.useOverlayLayer)();
|
|
943
|
+
const controlRef = (0, import_react5.useRef)(null);
|
|
944
|
+
const menuRef = (0, import_react5.useRef)(null);
|
|
945
|
+
const containerRef = (0, import_react5.useRef)(null);
|
|
946
|
+
const searchInputRef = (0, import_react5.useRef)(null);
|
|
947
|
+
const [menuPosition, setMenuPosition] = (0, import_react5.useState)(null);
|
|
948
|
+
const [searchValue, setSearchValue] = (0, import_react5.useState)("");
|
|
1554
949
|
const sizeStyles = theme.sizing.input(size);
|
|
1555
950
|
const inputColors = theme.colors.control.input;
|
|
1556
951
|
const state = externalState || (disabled ? "disable" : "default");
|
|
@@ -1572,39 +967,50 @@ var MultiSelect = (0, import_react10.forwardRef)(
|
|
|
1572
967
|
value,
|
|
1573
968
|
onChange
|
|
1574
969
|
});
|
|
1575
|
-
(0,
|
|
970
|
+
(0, import_react5.useEffect)(() => {
|
|
1576
971
|
if (isDisable || !dropdownMenu) {
|
|
1577
972
|
onClose();
|
|
1578
973
|
}
|
|
1579
974
|
}, [isDisable, dropdownMenu, onClose]);
|
|
1580
|
-
(0,
|
|
975
|
+
(0, import_react5.useEffect)(() => {
|
|
1581
976
|
if (isOpen && searchable && isWeb) {
|
|
1582
977
|
searchInputRef.current?.focus();
|
|
1583
978
|
}
|
|
1584
979
|
}, [isOpen, searchable]);
|
|
1585
|
-
(0,
|
|
980
|
+
(0, import_react5.useEffect)(() => {
|
|
1586
981
|
if (!isOpen) setSearchValue("");
|
|
1587
982
|
}, [isOpen]);
|
|
1588
983
|
const getOptionText = (opt) => typeof opt.label === "string" ? opt.label : String(opt.value);
|
|
1589
984
|
const filteredOptions = searchable && searchValue ? options.filter(
|
|
1590
985
|
(opt) => getOptionText(opt).toLowerCase().includes(searchValue.toLowerCase())
|
|
1591
986
|
) : options;
|
|
987
|
+
const selectedIds = values.map(String);
|
|
1592
988
|
const menuItems = filteredOptions.map((opt) => {
|
|
1593
989
|
const id = String(opt.value);
|
|
1594
|
-
const checked =
|
|
990
|
+
const checked = selectedIds.includes(id);
|
|
1595
991
|
return {
|
|
1596
992
|
id,
|
|
1597
993
|
children: opt.label,
|
|
1598
994
|
checked,
|
|
1599
|
-
disabled: opt.disabled
|
|
995
|
+
disabled: opt.disabled,
|
|
996
|
+
locked: opt.removable === false
|
|
1600
997
|
};
|
|
1601
998
|
});
|
|
1602
999
|
const handleItemToggle = (id, checked) => {
|
|
1603
|
-
const
|
|
1604
|
-
if (
|
|
1605
|
-
|
|
1000
|
+
const option = options.find((opt) => String(opt.value) === id);
|
|
1001
|
+
if (option === void 0) return;
|
|
1002
|
+
if (!checked && option.removable === false) return;
|
|
1003
|
+
const newValues = checked ? [...values, option.value] : values.filter((v) => v !== option.value);
|
|
1606
1004
|
onChoose(newValues.map(String));
|
|
1607
1005
|
};
|
|
1006
|
+
const selectAllTargets = filteredOptions.filter((opt) => !opt.disabled);
|
|
1007
|
+
const showSelectAll = selectAll && dropdownMenu && selectAllTargets.length > 0;
|
|
1008
|
+
const areAllTargetsSelected = showSelectAll && selectAllTargets.every((opt) => selectedIds.includes(String(opt.value)));
|
|
1009
|
+
const handleSelectAllToggle = () => {
|
|
1010
|
+
const targetIds = selectAllTargets.map((opt) => String(opt.value));
|
|
1011
|
+
const nextIds = areAllTargetsSelected ? selectedIds.filter((id) => !targetIds.includes(id)) : Array.from(/* @__PURE__ */ new Set([...selectedIds, ...targetIds]));
|
|
1012
|
+
onChoose(nextIds);
|
|
1013
|
+
};
|
|
1608
1014
|
const controlMenuOpen = dropdownMenu ? isOpen : Boolean(menuOpen);
|
|
1609
1015
|
const controlOnClick = dropdownMenu ? onSelectClick : onTriggerPress;
|
|
1610
1016
|
const isScrollOverflow = optionOverflow === "scroll";
|
|
@@ -1623,7 +1029,8 @@ var MultiSelect = (0, import_react10.forwardRef)(
|
|
|
1623
1029
|
overflow: "hidden",
|
|
1624
1030
|
textOverflow: "ellipsis"
|
|
1625
1031
|
};
|
|
1626
|
-
(0
|
|
1032
|
+
const optionsListMaxHeight = maxHeight - (searchable ? SEARCH_ROW_HEIGHT : 0) - (showSelectAll ? SELECT_ALL_ROW_HEIGHT : 0);
|
|
1033
|
+
(0, import_react5.useEffect)(() => {
|
|
1627
1034
|
if (!isWeb || !controlMenuOpen || isDisable || !dropdownMenu) return;
|
|
1628
1035
|
let rafId = null;
|
|
1629
1036
|
const repositionMenu = () => {
|
|
@@ -1649,7 +1056,7 @@ var MultiSelect = (0, import_react10.forwardRef)(
|
|
|
1649
1056
|
window.removeEventListener("scroll", scheduleUpdate, true);
|
|
1650
1057
|
};
|
|
1651
1058
|
}, [controlMenuOpen, dropdownMenu, isDisable]);
|
|
1652
|
-
(0,
|
|
1059
|
+
(0, import_react5.useEffect)(() => {
|
|
1653
1060
|
if (!isWeb || !dropdownMenu || !isOpen || isDisable) return;
|
|
1654
1061
|
const handleOutsideMouseDown = (event) => {
|
|
1655
1062
|
const path = typeof event.composedPath === "function" ? event.composedPath() : [];
|
|
@@ -1666,8 +1073,8 @@ var MultiSelect = (0, import_react10.forwardRef)(
|
|
|
1666
1073
|
minWidth: menuMinWidth ?? EXTERNAL_MENU_MIN_WIDTH_DEFAULT,
|
|
1667
1074
|
boxSizing: "border-box"
|
|
1668
1075
|
} : void 0;
|
|
1669
|
-
const dropdown = dropdownMenu && isOpen && !isDisable && (!isWeb || menuPosition) && /* @__PURE__ */ (0,
|
|
1670
|
-
!isWeb && /* @__PURE__ */ (0,
|
|
1076
|
+
const dropdown = dropdownMenu && isOpen && !isDisable && (!isWeb || menuPosition) && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1077
|
+
!isWeb && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1671
1078
|
Box,
|
|
1672
1079
|
{
|
|
1673
1080
|
"data-modal-id": modalId,
|
|
@@ -1677,13 +1084,13 @@ var MultiSelect = (0, import_react10.forwardRef)(
|
|
|
1677
1084
|
left: 0,
|
|
1678
1085
|
right: 0,
|
|
1679
1086
|
bottom: 0,
|
|
1680
|
-
zIndex: overlayLayer +
|
|
1087
|
+
zIndex: overlayLayer + import_xui_core3.LAYER_OFFSET.menu,
|
|
1681
1088
|
cursor: "default"
|
|
1682
1089
|
},
|
|
1683
1090
|
onPress: onClose
|
|
1684
1091
|
}
|
|
1685
1092
|
),
|
|
1686
|
-
/* @__PURE__ */ (0,
|
|
1093
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1687
1094
|
Box,
|
|
1688
1095
|
{
|
|
1689
1096
|
ref: menuRef,
|
|
@@ -1702,18 +1109,18 @@ var MultiSelect = (0, import_react10.forwardRef)(
|
|
|
1702
1109
|
right: isWeb ? void 0 : 0,
|
|
1703
1110
|
width: isWeb ? menuPosition?.width : void 0,
|
|
1704
1111
|
marginTop: isWeb ? void 0 : 4,
|
|
1705
|
-
zIndex: overlayLayer +
|
|
1112
|
+
zIndex: overlayLayer + import_xui_core3.LAYER_OFFSET.popover,
|
|
1706
1113
|
boxShadow: theme.shadow.popover
|
|
1707
1114
|
},
|
|
1708
1115
|
children: [
|
|
1709
|
-
searchable && isWeb && /* @__PURE__ */ (0,
|
|
1116
|
+
searchable && isWeb && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1710
1117
|
Box,
|
|
1711
1118
|
{
|
|
1712
1119
|
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
1713
1120
|
paddingVertical: sizeStyles.paddingVertical,
|
|
1714
1121
|
borderBottomWidth: 1,
|
|
1715
1122
|
borderColor: theme.colors.border.secondary,
|
|
1716
|
-
children: /* @__PURE__ */ (0,
|
|
1123
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1717
1124
|
Box,
|
|
1718
1125
|
{
|
|
1719
1126
|
flexDirection: "row",
|
|
@@ -1721,15 +1128,15 @@ var MultiSelect = (0, import_react10.forwardRef)(
|
|
|
1721
1128
|
gap: sizeStyles.paddingHorizontal / 2,
|
|
1722
1129
|
paddingHorizontal: 4,
|
|
1723
1130
|
children: [
|
|
1724
|
-
/* @__PURE__ */ (0,
|
|
1131
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1725
1132
|
Icon,
|
|
1726
1133
|
{
|
|
1727
1134
|
size: sizeStyles.iconSize - 2,
|
|
1728
1135
|
color: inputColors.placeholder,
|
|
1729
|
-
children: /* @__PURE__ */ (0,
|
|
1136
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_xui_icons_base2.Search, {})
|
|
1730
1137
|
}
|
|
1731
1138
|
),
|
|
1732
|
-
/* @__PURE__ */ (0,
|
|
1139
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1733
1140
|
Box,
|
|
1734
1141
|
{
|
|
1735
1142
|
as: "input",
|
|
@@ -1756,23 +1163,52 @@ var MultiSelect = (0, import_react10.forwardRef)(
|
|
|
1756
1163
|
)
|
|
1757
1164
|
}
|
|
1758
1165
|
),
|
|
1759
|
-
/* @__PURE__ */ (0,
|
|
1166
|
+
showSelectAll && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1167
|
+
Box,
|
|
1168
|
+
{
|
|
1169
|
+
role: "button",
|
|
1170
|
+
"aria-label": areAllTargetsSelected ? deselectAllLabel : selectAllLabel,
|
|
1171
|
+
testID: testID ? `${testID}-select-all` : void 0,
|
|
1172
|
+
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
1173
|
+
paddingVertical: 8,
|
|
1174
|
+
borderBottomWidth: 1,
|
|
1175
|
+
borderColor: theme.colors.border.secondary,
|
|
1176
|
+
flexDirection: "row",
|
|
1177
|
+
alignItems: "center",
|
|
1178
|
+
onPress: handleSelectAllToggle,
|
|
1179
|
+
hoverStyle: {
|
|
1180
|
+
backgroundColor: theme.colors.control.input.bgHover
|
|
1181
|
+
},
|
|
1182
|
+
style: { cursor: "pointer" },
|
|
1183
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1184
|
+
Text,
|
|
1185
|
+
{
|
|
1186
|
+
color: theme.colors.content.brand.primary,
|
|
1187
|
+
fontSize: sizeStyles.fontSize,
|
|
1188
|
+
fontWeight: "500",
|
|
1189
|
+
numberOfLines: 1,
|
|
1190
|
+
children: areAllTargetsSelected ? deselectAllLabel : selectAllLabel
|
|
1191
|
+
}
|
|
1192
|
+
)
|
|
1193
|
+
}
|
|
1194
|
+
),
|
|
1195
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1760
1196
|
Box,
|
|
1761
1197
|
{
|
|
1762
1198
|
paddingVertical: 4,
|
|
1763
1199
|
style: {
|
|
1764
|
-
maxHeight:
|
|
1200
|
+
maxHeight: optionsListMaxHeight,
|
|
1765
1201
|
overflowY: "auto",
|
|
1766
1202
|
overflowX: optionListOverflowX,
|
|
1767
1203
|
scrollbarWidth: "none"
|
|
1768
1204
|
},
|
|
1769
|
-
children: menuItems.length === 0 ? /* @__PURE__ */ (0,
|
|
1205
|
+
children: menuItems.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1770
1206
|
Box,
|
|
1771
1207
|
{
|
|
1772
1208
|
paddingVertical: sizeStyles.paddingVertical * 2,
|
|
1773
1209
|
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
1774
1210
|
alignItems: "center",
|
|
1775
|
-
children: /* @__PURE__ */ (0,
|
|
1211
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1776
1212
|
Text,
|
|
1777
1213
|
{
|
|
1778
1214
|
color: theme.colors.content.tertiary,
|
|
@@ -1784,14 +1220,15 @@ var MultiSelect = (0, import_react10.forwardRef)(
|
|
|
1784
1220
|
) : menuItems.map((item, _index) => {
|
|
1785
1221
|
const brandColors = theme.colors.control.brand.primary;
|
|
1786
1222
|
const contentColors = theme.colors.content;
|
|
1787
|
-
|
|
1223
|
+
const isInert = item.locked && item.checked;
|
|
1224
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1788
1225
|
Box,
|
|
1789
1226
|
{
|
|
1790
1227
|
testID,
|
|
1791
1228
|
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
1792
1229
|
paddingVertical: 8,
|
|
1793
1230
|
onPress: () => {
|
|
1794
|
-
if (!item.disabled) {
|
|
1231
|
+
if (!item.disabled && !isInert) {
|
|
1795
1232
|
handleItemToggle(item.id, !item.checked);
|
|
1796
1233
|
}
|
|
1797
1234
|
},
|
|
@@ -1803,11 +1240,11 @@ var MultiSelect = (0, import_react10.forwardRef)(
|
|
|
1803
1240
|
backgroundColor: theme.colors.control.input.bgHover
|
|
1804
1241
|
} : void 0,
|
|
1805
1242
|
style: {
|
|
1806
|
-
cursor: item.disabled ? "not-allowed" : "pointer",
|
|
1243
|
+
cursor: item.disabled ? "not-allowed" : isInert ? "default" : "pointer",
|
|
1807
1244
|
opacity: item.disabled ? 0.5 : 1,
|
|
1808
1245
|
minWidth: optionRowMinWidth
|
|
1809
1246
|
},
|
|
1810
|
-
children: /* @__PURE__ */ (0,
|
|
1247
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1811
1248
|
Text,
|
|
1812
1249
|
{
|
|
1813
1250
|
color: item.checked ? contentColors.on.brand : theme.colors.content.secondary,
|
|
@@ -1828,7 +1265,7 @@ var MultiSelect = (0, import_react10.forwardRef)(
|
|
|
1828
1265
|
}
|
|
1829
1266
|
)
|
|
1830
1267
|
] });
|
|
1831
|
-
return /* @__PURE__ */ (0,
|
|
1268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1832
1269
|
Box,
|
|
1833
1270
|
{
|
|
1834
1271
|
ref: containerRef,
|
|
@@ -1837,7 +1274,7 @@ var MultiSelect = (0, import_react10.forwardRef)(
|
|
|
1837
1274
|
gap: sizeStyles.fieldGap,
|
|
1838
1275
|
style: externalFieldLayout,
|
|
1839
1276
|
children: [
|
|
1840
|
-
label && /* @__PURE__ */ (0,
|
|
1277
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1841
1278
|
Text,
|
|
1842
1279
|
{
|
|
1843
1280
|
color: theme.colors.content.secondary,
|
|
@@ -1846,7 +1283,7 @@ var MultiSelect = (0, import_react10.forwardRef)(
|
|
|
1846
1283
|
children: label
|
|
1847
1284
|
}
|
|
1848
1285
|
),
|
|
1849
|
-
/* @__PURE__ */ (0,
|
|
1286
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1850
1287
|
Box,
|
|
1851
1288
|
{
|
|
1852
1289
|
ref,
|
|
@@ -1855,7 +1292,7 @@ var MultiSelect = (0, import_react10.forwardRef)(
|
|
|
1855
1292
|
...externalFieldLayout ? { width: "100%" } : {}
|
|
1856
1293
|
},
|
|
1857
1294
|
children: [
|
|
1858
|
-
/* @__PURE__ */ (0,
|
|
1295
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1859
1296
|
MultiSelectControl,
|
|
1860
1297
|
{
|
|
1861
1298
|
ref: controlRef,
|
|
@@ -1880,11 +1317,11 @@ var MultiSelect = (0, import_react10.forwardRef)(
|
|
|
1880
1317
|
extraClear
|
|
1881
1318
|
}
|
|
1882
1319
|
),
|
|
1883
|
-
isWeb ? /* @__PURE__ */ (0,
|
|
1320
|
+
isWeb ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Portal, { children: dropdown }) : dropdown
|
|
1884
1321
|
]
|
|
1885
1322
|
}
|
|
1886
1323
|
),
|
|
1887
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
1324
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1888
1325
|
Text,
|
|
1889
1326
|
{
|
|
1890
1327
|
color: theme.colors.content.alert.primary,
|
|
@@ -1903,19 +1340,4 @@ MultiSelect.displayName = "MultiSelect";
|
|
|
1903
1340
|
0 && (module.exports = {
|
|
1904
1341
|
MultiSelect
|
|
1905
1342
|
});
|
|
1906
|
-
/*! Bundled license information:
|
|
1907
|
-
|
|
1908
|
-
lucide-react/dist/esm/shared/src/utils.js:
|
|
1909
|
-
lucide-react/dist/esm/defaultAttributes.js:
|
|
1910
|
-
lucide-react/dist/esm/Icon.js:
|
|
1911
|
-
lucide-react/dist/esm/createLucideIcon.js:
|
|
1912
|
-
lucide-react/dist/esm/icons/x.js:
|
|
1913
|
-
lucide-react/dist/esm/lucide-react.js:
|
|
1914
|
-
(**
|
|
1915
|
-
* @license lucide-react v0.470.0 - ISC
|
|
1916
|
-
*
|
|
1917
|
-
* This source code is licensed under the ISC license.
|
|
1918
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
1919
|
-
*)
|
|
1920
|
-
*/
|
|
1921
1343
|
//# sourceMappingURL=index.js.map
|