@true-engineering/true-react-common-ui-kit 1.9.0 → 1.11.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/dist/components/Input/Input.styles.d.ts +1 -0
- package/dist/components/Select/Select.d.ts +12 -3
- package/dist/components/Select/Select.styles.d.ts +9 -0
- package/dist/components/Select/SelectList/SelectList.d.ts +7 -4
- package/dist/components/Select/SelectList/SelectList.styles.d.ts +5 -0
- package/dist/components/Select/SelectListItem/SelectListItem.d.ts +14 -0
- package/dist/components/Select/SelectListItem/SelectListItem.styles.d.ts +2 -0
- package/dist/components/Select/constants.d.ts +2 -0
- package/dist/components/Select/helpers.d.ts +4 -1
- package/dist/components/Select/index.d.ts +1 -0
- package/dist/components/Select/types.d.ts +1 -0
- package/dist/helpers/utils.d.ts +2 -0
- package/dist/true-react-common-ui-kit.js +365 -163
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +365 -163
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/components/Input/Input.styles.ts +2 -0
- package/src/components/Input/Input.tsx +4 -1
- package/src/components/Select/MultiSelect.stories.tsx +263 -0
- package/src/components/Select/Select.styles.ts +11 -0
- package/src/components/Select/Select.tsx +234 -114
- package/src/components/Select/SelectList/SelectList.styles.ts +6 -2
- package/src/components/Select/SelectList/SelectList.tsx +65 -39
- package/src/components/Select/SelectListItem/SelectListItem.styles.ts +14 -0
- package/src/components/Select/SelectListItem/SelectListItem.tsx +73 -0
- package/src/components/Select/constants.ts +2 -0
- package/src/components/Select/helpers.ts +16 -8
- package/src/components/Select/index.ts +1 -0
- package/src/components/Select/types.ts +1 -0
- package/src/helpers/utils.ts +29 -0
|
@@ -1120,11 +1120,11 @@ function _array_with_holes$o(arr) {
|
|
|
1120
1120
|
if (Array.isArray(arr))
|
|
1121
1121
|
return arr;
|
|
1122
1122
|
}
|
|
1123
|
-
function _array_without_holes$
|
|
1123
|
+
function _array_without_holes$7(arr) {
|
|
1124
1124
|
if (Array.isArray(arr))
|
|
1125
1125
|
return _array_like_to_array$q(arr);
|
|
1126
1126
|
}
|
|
1127
|
-
function _iterable_to_array$
|
|
1127
|
+
function _iterable_to_array$7(iter) {
|
|
1128
1128
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
|
1129
1129
|
return Array.from(iter);
|
|
1130
1130
|
}
|
|
@@ -1159,14 +1159,14 @@ function _iterable_to_array_limit$o(arr, i) {
|
|
|
1159
1159
|
function _non_iterable_rest$o() {
|
|
1160
1160
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1161
1161
|
}
|
|
1162
|
-
function _non_iterable_spread$
|
|
1162
|
+
function _non_iterable_spread$7() {
|
|
1163
1163
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1164
1164
|
}
|
|
1165
1165
|
function _sliced_to_array$o(arr, i) {
|
|
1166
1166
|
return _array_with_holes$o(arr) || _iterable_to_array_limit$o(arr, i) || _unsupported_iterable_to_array$q(arr, i) || _non_iterable_rest$o();
|
|
1167
1167
|
}
|
|
1168
|
-
function _to_consumable_array$
|
|
1169
|
-
return _array_without_holes$
|
|
1168
|
+
function _to_consumable_array$7(arr) {
|
|
1169
|
+
return _array_without_holes$7(arr) || _iterable_to_array$7(arr) || _unsupported_iterable_to_array$q(arr) || _non_iterable_spread$7();
|
|
1170
1170
|
}
|
|
1171
1171
|
function _unsupported_iterable_to_array$q(o, minLen) {
|
|
1172
1172
|
if (!o)
|
|
@@ -1301,6 +1301,9 @@ var getNumberLength = function(n) {
|
|
|
1301
1301
|
var isNotEmpty = function(val) {
|
|
1302
1302
|
return typeof val === "string" ? val.trim() !== "" : val !== null && val !== void 0;
|
|
1303
1303
|
};
|
|
1304
|
+
var isStringNotEmpty = function(value) {
|
|
1305
|
+
return (value !== null && value !== void 0 ? value : "").trim() !== "";
|
|
1306
|
+
};
|
|
1304
1307
|
var trimStringToMaxLength = function(val, maxLength) {
|
|
1305
1308
|
return val.length > maxLength ? val.slice(0, maxLength) : val;
|
|
1306
1309
|
};
|
|
@@ -1318,7 +1321,7 @@ var addDataTestId = function() {
|
|
|
1318
1321
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1319
1322
|
args[_key] = arguments[_key];
|
|
1320
1323
|
}
|
|
1321
|
-
var testId = getTestId.apply(void 0, _to_consumable_array$
|
|
1324
|
+
var testId = getTestId.apply(void 0, _to_consumable_array$7(args));
|
|
1322
1325
|
return isNotEmpty(testId) ? {
|
|
1323
1326
|
"data-testid": testId
|
|
1324
1327
|
} : void 0;
|
|
@@ -1346,6 +1349,21 @@ var addClickHandler = function(cb) {
|
|
|
1346
1349
|
tabIndex: -1
|
|
1347
1350
|
};
|
|
1348
1351
|
};
|
|
1352
|
+
var createFilter = function(getter) {
|
|
1353
|
+
return function(items, query) {
|
|
1354
|
+
return items.filter(function(item) {
|
|
1355
|
+
var possibleValues = getter(item).reduce(function(acc, cur) {
|
|
1356
|
+
return _to_consumable_array$7(acc).concat(_to_consumable_array$7(isStringNotEmpty(cur) ? [
|
|
1357
|
+
cur === null || cur === void 0 ? void 0 : cur.toLowerCase()
|
|
1358
|
+
] : []));
|
|
1359
|
+
}, []);
|
|
1360
|
+
var queryString = query.toLowerCase().trim();
|
|
1361
|
+
return possibleValues.some(function(v) {
|
|
1362
|
+
return v === null || v === void 0 ? void 0 : v.includes(queryString);
|
|
1363
|
+
});
|
|
1364
|
+
});
|
|
1365
|
+
};
|
|
1366
|
+
};
|
|
1349
1367
|
var minWidthModifier = {
|
|
1350
1368
|
name: "minWidth",
|
|
1351
1369
|
enabled: true,
|
|
@@ -1369,19 +1387,19 @@ function _array_like_to_array$p(arr, len) {
|
|
|
1369
1387
|
arr2[i] = arr[i];
|
|
1370
1388
|
return arr2;
|
|
1371
1389
|
}
|
|
1372
|
-
function _array_without_holes$
|
|
1390
|
+
function _array_without_holes$6(arr) {
|
|
1373
1391
|
if (Array.isArray(arr))
|
|
1374
1392
|
return _array_like_to_array$p(arr);
|
|
1375
1393
|
}
|
|
1376
|
-
function _iterable_to_array$
|
|
1394
|
+
function _iterable_to_array$6(iter) {
|
|
1377
1395
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
|
1378
1396
|
return Array.from(iter);
|
|
1379
1397
|
}
|
|
1380
|
-
function _non_iterable_spread$
|
|
1398
|
+
function _non_iterable_spread$6() {
|
|
1381
1399
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1382
1400
|
}
|
|
1383
|
-
function _to_consumable_array$
|
|
1384
|
-
return _array_without_holes$
|
|
1401
|
+
function _to_consumable_array$6(arr) {
|
|
1402
|
+
return _array_without_holes$6(arr) || _iterable_to_array$6(arr) || _unsupported_iterable_to_array$p(arr) || _non_iterable_spread$6();
|
|
1385
1403
|
}
|
|
1386
1404
|
function _unsupported_iterable_to_array$p(o, minLen) {
|
|
1387
1405
|
if (!o)
|
|
@@ -1421,7 +1439,7 @@ var checkSearchStringInCountry = function(country, searchString) {
|
|
|
1421
1439
|
var possibleValues = [
|
|
1422
1440
|
country.countryRu,
|
|
1423
1441
|
country.countryEn
|
|
1424
|
-
].concat(_to_consumable_array$
|
|
1442
|
+
].concat(_to_consumable_array$6(country.countryRu.split(" ")), _to_consumable_array$6(country.countryEn.split(" ")), [
|
|
1425
1443
|
country.dialCode
|
|
1426
1444
|
]).map(function(part) {
|
|
1427
1445
|
return part.toLowerCase();
|
|
@@ -3901,11 +3919,11 @@ function _array_like_to_array$o(arr, len) {
|
|
|
3901
3919
|
arr2[i] = arr[i];
|
|
3902
3920
|
return arr2;
|
|
3903
3921
|
}
|
|
3904
|
-
function _array_without_holes$
|
|
3922
|
+
function _array_without_holes$5(arr) {
|
|
3905
3923
|
if (Array.isArray(arr))
|
|
3906
3924
|
return _array_like_to_array$o(arr);
|
|
3907
3925
|
}
|
|
3908
|
-
function _define_property$
|
|
3926
|
+
function _define_property$P(obj, key, value) {
|
|
3909
3927
|
if (key in obj) {
|
|
3910
3928
|
Object.defineProperty(obj, key, {
|
|
3911
3929
|
value,
|
|
@@ -3918,11 +3936,11 @@ function _define_property$O(obj, key, value) {
|
|
|
3918
3936
|
}
|
|
3919
3937
|
return obj;
|
|
3920
3938
|
}
|
|
3921
|
-
function _iterable_to_array$
|
|
3939
|
+
function _iterable_to_array$5(iter) {
|
|
3922
3940
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
|
3923
3941
|
return Array.from(iter);
|
|
3924
3942
|
}
|
|
3925
|
-
function _non_iterable_spread$
|
|
3943
|
+
function _non_iterable_spread$5() {
|
|
3926
3944
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3927
3945
|
}
|
|
3928
3946
|
function _object_spread$N(target) {
|
|
@@ -3935,13 +3953,13 @@ function _object_spread$N(target) {
|
|
|
3935
3953
|
}));
|
|
3936
3954
|
}
|
|
3937
3955
|
ownKeys2.forEach(function(key) {
|
|
3938
|
-
_define_property$
|
|
3956
|
+
_define_property$P(target, key, source[key]);
|
|
3939
3957
|
});
|
|
3940
3958
|
}
|
|
3941
3959
|
return target;
|
|
3942
3960
|
}
|
|
3943
|
-
function _to_consumable_array$
|
|
3944
|
-
return _array_without_holes$
|
|
3961
|
+
function _to_consumable_array$5(arr) {
|
|
3962
|
+
return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$o(arr) || _non_iterable_spread$5();
|
|
3945
3963
|
}
|
|
3946
3964
|
function _unsupported_iterable_to_array$o(o, minLen) {
|
|
3947
3965
|
if (!o)
|
|
@@ -3977,7 +3995,7 @@ var useDropdown = function(param) {
|
|
|
3977
3995
|
popperData = usePopper(referenceElement, dropdownElement, {
|
|
3978
3996
|
enabled: isOpen,
|
|
3979
3997
|
placement,
|
|
3980
|
-
modifiers: _to_consumable_array$
|
|
3998
|
+
modifiers: _to_consumable_array$5(shouldRenderInBody ? [
|
|
3981
3999
|
minWidthModifier
|
|
3982
4000
|
] : []).concat([
|
|
3983
4001
|
{
|
|
@@ -4000,7 +4018,7 @@ var useDropdown = function(param) {
|
|
|
4000
4018
|
]
|
|
4001
4019
|
}, flipOptions)
|
|
4002
4020
|
}
|
|
4003
|
-
], _to_consumable_array$
|
|
4021
|
+
], _to_consumable_array$5(modifiers))
|
|
4004
4022
|
});
|
|
4005
4023
|
}
|
|
4006
4024
|
useEffect(function() {
|
|
@@ -4860,7 +4878,7 @@ var icons = checkIcons({
|
|
|
4860
4878
|
]
|
|
4861
4879
|
}
|
|
4862
4880
|
});
|
|
4863
|
-
function _define_property$
|
|
4881
|
+
function _define_property$O(obj, key, value) {
|
|
4864
4882
|
if (key in obj) {
|
|
4865
4883
|
Object.defineProperty(obj, key, {
|
|
4866
4884
|
value,
|
|
@@ -4883,7 +4901,7 @@ function _object_spread$M(target) {
|
|
|
4883
4901
|
}));
|
|
4884
4902
|
}
|
|
4885
4903
|
ownKeys2.forEach(function(key) {
|
|
4886
|
-
_define_property$
|
|
4904
|
+
_define_property$O(target, key, source[key]);
|
|
4887
4905
|
});
|
|
4888
4906
|
}
|
|
4889
4907
|
return target;
|
|
@@ -5010,7 +5028,7 @@ const avatarGreen = ` <svg\r
|
|
|
5010
5028
|
var complexIcons = {
|
|
5011
5029
|
avatar: avatarGreen
|
|
5012
5030
|
};
|
|
5013
|
-
function _define_property$
|
|
5031
|
+
function _define_property$N(obj, key, value) {
|
|
5014
5032
|
if (key in obj) {
|
|
5015
5033
|
Object.defineProperty(obj, key, {
|
|
5016
5034
|
value,
|
|
@@ -5033,7 +5051,7 @@ function _object_spread$L(target) {
|
|
|
5033
5051
|
}));
|
|
5034
5052
|
}
|
|
5035
5053
|
ownKeys2.forEach(function(key) {
|
|
5036
|
-
_define_property$
|
|
5054
|
+
_define_property$N(target, key, source[key]);
|
|
5037
5055
|
});
|
|
5038
5056
|
}
|
|
5039
5057
|
return target;
|
|
@@ -5057,7 +5075,7 @@ var styles$K = {
|
|
|
5057
5075
|
alignItems: "center"
|
|
5058
5076
|
}
|
|
5059
5077
|
};
|
|
5060
|
-
function _define_property$
|
|
5078
|
+
function _define_property$M(obj, key, value) {
|
|
5061
5079
|
if (key in obj) {
|
|
5062
5080
|
Object.defineProperty(obj, key, {
|
|
5063
5081
|
value,
|
|
@@ -5080,7 +5098,7 @@ function _object_spread$K(target) {
|
|
|
5080
5098
|
}));
|
|
5081
5099
|
}
|
|
5082
5100
|
ownKeys2.forEach(function(key) {
|
|
5083
|
-
_define_property$
|
|
5101
|
+
_define_property$M(target, key, source[key]);
|
|
5084
5102
|
});
|
|
5085
5103
|
}
|
|
5086
5104
|
return target;
|
|
@@ -5171,7 +5189,7 @@ var styles$J = {
|
|
|
5171
5189
|
},
|
|
5172
5190
|
content: {}
|
|
5173
5191
|
};
|
|
5174
|
-
function _define_property$
|
|
5192
|
+
function _define_property$L(obj, key, value) {
|
|
5175
5193
|
if (key in obj) {
|
|
5176
5194
|
Object.defineProperty(obj, key, {
|
|
5177
5195
|
value,
|
|
@@ -5194,7 +5212,7 @@ function _object_spread$J(target) {
|
|
|
5194
5212
|
}));
|
|
5195
5213
|
}
|
|
5196
5214
|
ownKeys2.forEach(function(key) {
|
|
5197
|
-
_define_property$
|
|
5215
|
+
_define_property$L(target, key, source[key]);
|
|
5198
5216
|
});
|
|
5199
5217
|
}
|
|
5200
5218
|
return target;
|
|
@@ -5242,7 +5260,7 @@ var List = function(param) {
|
|
|
5242
5260
|
className: classes.spacer
|
|
5243
5261
|
}),
|
|
5244
5262
|
/* @__PURE__ */ jsxs("div", _object_spread_props$A(_object_spread$J({
|
|
5245
|
-
className: clsx(classes.item, (_obj = {}, _define_property$
|
|
5263
|
+
className: clsx(classes.item, (_obj = {}, _define_property$L(_obj, classes.disabledItem, item.disabled), _define_property$L(_obj, classes.withIconGap, item.withIconGap), _obj))
|
|
5246
5264
|
}, addDataTestId((_item_testId = item.testId) !== null && _item_testId !== void 0 ? _item_testId : getTestId(testId, "item-".concat(idx))), item.disabled && addDataAttributes({
|
|
5247
5265
|
disabled: item.disabled
|
|
5248
5266
|
})), {
|
|
@@ -5270,7 +5288,7 @@ var List = function(param) {
|
|
|
5270
5288
|
})
|
|
5271
5289
|
}));
|
|
5272
5290
|
};
|
|
5273
|
-
function _define_property$
|
|
5291
|
+
function _define_property$K(obj, key, value) {
|
|
5274
5292
|
if (key in obj) {
|
|
5275
5293
|
Object.defineProperty(obj, key, {
|
|
5276
5294
|
value,
|
|
@@ -5293,7 +5311,7 @@ function _object_spread$I(target) {
|
|
|
5293
5311
|
}));
|
|
5294
5312
|
}
|
|
5295
5313
|
ownKeys2.forEach(function(key) {
|
|
5296
|
-
_define_property$
|
|
5314
|
+
_define_property$K(target, key, source[key]);
|
|
5297
5315
|
});
|
|
5298
5316
|
}
|
|
5299
5317
|
return target;
|
|
@@ -5377,7 +5395,7 @@ function _array_with_holes$n(arr) {
|
|
|
5377
5395
|
if (Array.isArray(arr))
|
|
5378
5396
|
return arr;
|
|
5379
5397
|
}
|
|
5380
|
-
function _define_property$
|
|
5398
|
+
function _define_property$J(obj, key, value) {
|
|
5381
5399
|
if (key in obj) {
|
|
5382
5400
|
Object.defineProperty(obj, key, {
|
|
5383
5401
|
value,
|
|
@@ -5431,7 +5449,7 @@ function _object_spread$H(target) {
|
|
|
5431
5449
|
}));
|
|
5432
5450
|
}
|
|
5433
5451
|
ownKeys2.forEach(function(key) {
|
|
5434
|
-
_define_property$
|
|
5452
|
+
_define_property$J(target, key, source[key]);
|
|
5435
5453
|
});
|
|
5436
5454
|
}
|
|
5437
5455
|
return target;
|
|
@@ -5572,7 +5590,7 @@ var styles$H = {
|
|
|
5572
5590
|
width: "100%"
|
|
5573
5591
|
}
|
|
5574
5592
|
};
|
|
5575
|
-
function _define_property$
|
|
5593
|
+
function _define_property$I(obj, key, value) {
|
|
5576
5594
|
if (key in obj) {
|
|
5577
5595
|
Object.defineProperty(obj, key, {
|
|
5578
5596
|
value,
|
|
@@ -5595,7 +5613,7 @@ function _object_spread$G(target) {
|
|
|
5595
5613
|
}));
|
|
5596
5614
|
}
|
|
5597
5615
|
ownKeys2.forEach(function(key) {
|
|
5598
|
-
_define_property$
|
|
5616
|
+
_define_property$I(target, key, source[key]);
|
|
5599
5617
|
});
|
|
5600
5618
|
}
|
|
5601
5619
|
return target;
|
|
@@ -5789,7 +5807,7 @@ var styles$E = {
|
|
|
5789
5807
|
},
|
|
5790
5808
|
tweakPreloaderComponent: {}
|
|
5791
5809
|
};
|
|
5792
|
-
function _define_property$
|
|
5810
|
+
function _define_property$H(obj, key, value) {
|
|
5793
5811
|
if (key in obj) {
|
|
5794
5812
|
Object.defineProperty(obj, key, {
|
|
5795
5813
|
value,
|
|
@@ -5812,7 +5830,7 @@ function _object_spread$F(target) {
|
|
|
5812
5830
|
}));
|
|
5813
5831
|
}
|
|
5814
5832
|
ownKeys2.forEach(function(key) {
|
|
5815
|
-
_define_property$
|
|
5833
|
+
_define_property$H(target, key, source[key]);
|
|
5816
5834
|
});
|
|
5817
5835
|
}
|
|
5818
5836
|
return target;
|
|
@@ -5846,7 +5864,7 @@ var ThemedPreloader = function(param) {
|
|
|
5846
5864
|
var _useTheme = useTheme("ThemedPreloader", styles$E, tweakStyles), classes = _useTheme.classes, componentStyles = _useTheme.componentStyles;
|
|
5847
5865
|
var preloaderComponentStyles = useTweakStyles(componentStyles, tweakStyles, "tweakPreloaderComponent");
|
|
5848
5866
|
return /* @__PURE__ */ jsx("div", _object_spread_props$w(_object_spread$F({
|
|
5849
|
-
className: clsx(classes.root, classes[type], _define_property$
|
|
5867
|
+
className: clsx(classes.root, classes[type], _define_property$H({}, classes.currentColor, useCurrentColor))
|
|
5850
5868
|
}, addDataAttributes(data)), {
|
|
5851
5869
|
children: type === "dots" ? /* @__PURE__ */ jsx(DotsPreloader, {
|
|
5852
5870
|
tweakStyles: preloaderComponentStyles
|
|
@@ -6026,7 +6044,7 @@ var dotsPreloaderStyles = {
|
|
|
6026
6044
|
}
|
|
6027
6045
|
}
|
|
6028
6046
|
};
|
|
6029
|
-
function _define_property$
|
|
6047
|
+
function _define_property$G(obj, key, value) {
|
|
6030
6048
|
if (key in obj) {
|
|
6031
6049
|
Object.defineProperty(obj, key, {
|
|
6032
6050
|
value,
|
|
@@ -6049,7 +6067,7 @@ function _object_spread$E(target) {
|
|
|
6049
6067
|
}));
|
|
6050
6068
|
}
|
|
6051
6069
|
ownKeys2.forEach(function(key) {
|
|
6052
|
-
_define_property$
|
|
6070
|
+
_define_property$G(target, key, source[key]);
|
|
6053
6071
|
});
|
|
6054
6072
|
}
|
|
6055
6073
|
return target;
|
|
@@ -6102,7 +6120,7 @@ var Button = function(param) {
|
|
|
6102
6120
|
var _obj, _obj1;
|
|
6103
6121
|
return /* @__PURE__ */ jsxs("button", _object_spread_props$v(_object_spread$E({
|
|
6104
6122
|
type,
|
|
6105
|
-
className: clsx(classes.root, classes[size], classes[view], (_obj = {}, _define_property$
|
|
6123
|
+
className: clsx(classes.root, classes[size], classes[view], (_obj = {}, _define_property$G(_obj, classes.disabled, isDisabled), _define_property$G(_obj, classes.fullWidth, isFullWidth), _define_property$G(_obj, classes.inline, isInline), _define_property$G(_obj, classes.active, isActive), _define_property$G(_obj, classes.loading, isLoading), _define_property$G(_obj, classes.onlyIcon, hasIcon && !hasChildren), _obj)),
|
|
6106
6124
|
tabIndex: shouldSkipTabNavigation ? -1 : void 0,
|
|
6107
6125
|
disabled: hasNoAction,
|
|
6108
6126
|
onClick: !hasNoAction ? onClick : void 0,
|
|
@@ -6110,7 +6128,7 @@ var Button = function(param) {
|
|
|
6110
6128
|
}, addDataTestId(testId), addDataAttributes(data)), {
|
|
6111
6129
|
children: [
|
|
6112
6130
|
/* @__PURE__ */ jsxs("span", {
|
|
6113
|
-
className: clsx(classes.content, (_obj1 = {}, _define_property$
|
|
6131
|
+
className: clsx(classes.content, (_obj1 = {}, _define_property$G(_obj1, classes.iconFromRight, hasChildren && hasIcon && iconPosition === "right"), _define_property$G(_obj1, classes.iconFromLeft, hasChildren && hasIcon && iconPosition === "left"), _obj1)),
|
|
6114
6132
|
children: [
|
|
6115
6133
|
hasIcon && /* @__PURE__ */ jsx("span", {
|
|
6116
6134
|
className: classes.icon,
|
|
@@ -6202,7 +6220,7 @@ function _array_with_holes$m(arr) {
|
|
|
6202
6220
|
if (Array.isArray(arr))
|
|
6203
6221
|
return arr;
|
|
6204
6222
|
}
|
|
6205
|
-
function _define_property$
|
|
6223
|
+
function _define_property$F(obj, key, value) {
|
|
6206
6224
|
if (key in obj) {
|
|
6207
6225
|
Object.defineProperty(obj, key, {
|
|
6208
6226
|
value,
|
|
@@ -6256,7 +6274,7 @@ function _object_spread$D(target) {
|
|
|
6256
6274
|
}));
|
|
6257
6275
|
}
|
|
6258
6276
|
ownKeys2.forEach(function(key) {
|
|
6259
|
-
_define_property$
|
|
6277
|
+
_define_property$F(target, key, source[key]);
|
|
6260
6278
|
});
|
|
6261
6279
|
}
|
|
6262
6280
|
return target;
|
|
@@ -6325,7 +6343,7 @@ function Checkbox(param) {
|
|
|
6325
6343
|
]);
|
|
6326
6344
|
var _obj;
|
|
6327
6345
|
return /* @__PURE__ */ jsxs("label", _object_spread_props$u(_object_spread$D({
|
|
6328
|
-
className: clsx(classes.root, (_obj = {}, _define_property$
|
|
6346
|
+
className: clsx(classes.root, (_obj = {}, _define_property$F(_obj, classes.disabled, isDisabled), _define_property$F(_obj, classes.labelPositionLeft, labelPosition === "left"), _obj))
|
|
6329
6347
|
}, addDataTestId(testId), addDataAttributes(data)), {
|
|
6330
6348
|
children: [
|
|
6331
6349
|
/* @__PURE__ */ jsx("input", _object_spread$D({
|
|
@@ -6376,7 +6394,7 @@ var styles$B = {
|
|
|
6376
6394
|
}
|
|
6377
6395
|
}
|
|
6378
6396
|
};
|
|
6379
|
-
function _define_property$
|
|
6397
|
+
function _define_property$E(obj, key, value) {
|
|
6380
6398
|
if (key in obj) {
|
|
6381
6399
|
Object.defineProperty(obj, key, {
|
|
6382
6400
|
value,
|
|
@@ -6399,7 +6417,7 @@ function _object_spread$C(target) {
|
|
|
6399
6417
|
}));
|
|
6400
6418
|
}
|
|
6401
6419
|
ownKeys2.forEach(function(key) {
|
|
6402
|
-
_define_property$
|
|
6420
|
+
_define_property$E(target, key, source[key]);
|
|
6403
6421
|
});
|
|
6404
6422
|
}
|
|
6405
6423
|
return target;
|
|
@@ -6574,7 +6592,7 @@ var styles$z = {
|
|
|
6574
6592
|
},
|
|
6575
6593
|
root: {}
|
|
6576
6594
|
};
|
|
6577
|
-
function _define_property$
|
|
6595
|
+
function _define_property$D(obj, key, value) {
|
|
6578
6596
|
if (key in obj) {
|
|
6579
6597
|
Object.defineProperty(obj, key, {
|
|
6580
6598
|
value,
|
|
@@ -6597,7 +6615,7 @@ function _object_spread$B(target) {
|
|
|
6597
6615
|
}));
|
|
6598
6616
|
}
|
|
6599
6617
|
ownKeys2.forEach(function(key) {
|
|
6600
|
-
_define_property$
|
|
6618
|
+
_define_property$D(target, key, source[key]);
|
|
6601
6619
|
});
|
|
6602
6620
|
}
|
|
6603
6621
|
return target;
|
|
@@ -6882,6 +6900,7 @@ var styles$y = {
|
|
|
6882
6900
|
paddingLeft: 13
|
|
6883
6901
|
},
|
|
6884
6902
|
loading: {},
|
|
6903
|
+
withUnits: {},
|
|
6885
6904
|
tweakPreloader: {}
|
|
6886
6905
|
};
|
|
6887
6906
|
var renderIcon = function(icon) {
|
|
@@ -6929,7 +6948,7 @@ function _async_to_generator$5(fn3) {
|
|
|
6929
6948
|
});
|
|
6930
6949
|
};
|
|
6931
6950
|
}
|
|
6932
|
-
function _define_property$
|
|
6951
|
+
function _define_property$C(obj, key, value) {
|
|
6933
6952
|
if (key in obj) {
|
|
6934
6953
|
Object.defineProperty(obj, key, {
|
|
6935
6954
|
value,
|
|
@@ -6983,7 +7002,7 @@ function _object_spread$A(target) {
|
|
|
6983
7002
|
}));
|
|
6984
7003
|
}
|
|
6985
7004
|
ownKeys2.forEach(function(key) {
|
|
6986
|
-
_define_property$
|
|
7005
|
+
_define_property$C(target, key, source[key]);
|
|
6987
7006
|
});
|
|
6988
7007
|
}
|
|
6989
7008
|
return target;
|
|
@@ -7178,9 +7197,10 @@ var Input = /* @__PURE__ */ forwardRef(function(param, ref) {
|
|
|
7178
7197
|
var hasUnits = units !== void 0 && units !== "";
|
|
7179
7198
|
var hasLabel = isNotEmpty(label);
|
|
7180
7199
|
var hasPlaceholder = (!hasLabel || hasFocus && !isReadonly) && isNotEmpty(placeholder);
|
|
7200
|
+
var shouldShowUnits = (hasValue || isFocused && !hasPlaceholder) && hasUnits;
|
|
7181
7201
|
var _obj;
|
|
7182
7202
|
var props = _object_spread$A({
|
|
7183
|
-
className: clsx(classes.input, (_obj = {}, _define_property$
|
|
7203
|
+
className: clsx(classes.input, (_obj = {}, _define_property$C(_obj, classes.withFloatingLabel, hasFloatingLabel && hasLabel), _define_property$C(_obj, classes.withIcons, hasControls), _define_property$C(_obj, classes.withControls, hasControls), _define_property$C(_obj, classes.withUnits, shouldShowUnits), _define_property$C(_obj, classes.floatingLabelWithoutPadding, hasFloatingLabel && hasLabel && border === "bottom"), _obj)),
|
|
7184
7204
|
onFocus: handleFocus,
|
|
7185
7205
|
onBlur: handleBlur,
|
|
7186
7206
|
onChange: handleChange,
|
|
@@ -7203,7 +7223,7 @@ var Input = /* @__PURE__ */ forwardRef(function(param, ref) {
|
|
|
7203
7223
|
className: classes.root,
|
|
7204
7224
|
children: [
|
|
7205
7225
|
/* @__PURE__ */ jsxs("div", _object_spread_props$s(_object_spread$A({
|
|
7206
|
-
className: clsx(classes.inputWrapper, (_obj1 = {}, _define_property$
|
|
7226
|
+
className: clsx(classes.inputWrapper, (_obj1 = {}, _define_property$C(_obj1, classes.required, isRequired && !hasRequiredLabel), _define_property$C(_obj1, classes.invalid, isInvalid), _define_property$C(_obj1, classes.focused, hasFocus), _define_property$C(_obj1, classes.disabled, isDisabled), _define_property$C(_obj1, classes.autosize, isAutoSizeable), _obj1), inlineStyle !== void 0 && classes[inlineStyle], border !== void 0 && classes["border-".concat(border)]),
|
|
7207
7227
|
"data-value": isAutoSizeable ? value : void 0
|
|
7208
7228
|
}, addDataAttributes(data)), {
|
|
7209
7229
|
children: [
|
|
@@ -7217,12 +7237,12 @@ var Input = /* @__PURE__ */ forwardRef(function(param, ref) {
|
|
|
7217
7237
|
beforeMaskedStateChange
|
|
7218
7238
|
}, props)),
|
|
7219
7239
|
hasLabel && /* @__PURE__ */ jsx("span", {
|
|
7220
|
-
className: clsx(classes.label, (_obj2 = {}, _define_property$
|
|
7221
|
-
_define_property$
|
|
7240
|
+
className: clsx(classes.label, (_obj2 = {}, _define_property$C(_obj2, classes.invalidLabel, isInvalid), _define_property$C(_obj2, classes.requiredLabel, hasRequiredLabel && !isRequired), _define_property$C(_obj2, classes.activeLabel, hasFocus && !isReadonly || hasValue), _define_property$C(_obj2, classes.floating, hasFloatingLabel), // Обсуждаемо, сделал так, потому что не хочется создавать новую пропсу, на каждый чих в стилях
|
|
7241
|
+
_define_property$C(_obj2, classes.floatingWithoutPadding, hasFloatingLabel && border === "bottom"), _obj2)),
|
|
7222
7242
|
children: label
|
|
7223
7243
|
}),
|
|
7224
|
-
|
|
7225
|
-
className: clsx(classes.unitsWrapper, _define_property$
|
|
7244
|
+
shouldShowUnits && /* @__PURE__ */ jsxs("div", {
|
|
7245
|
+
className: clsx(classes.unitsWrapper, _define_property$C({}, classes.withFloatingLabel, hasFloatingLabel && hasLabel)),
|
|
7226
7246
|
children: [
|
|
7227
7247
|
/* @__PURE__ */ jsx("span", {
|
|
7228
7248
|
className: classes.fakeValue,
|
|
@@ -7254,7 +7274,7 @@ var Input = /* @__PURE__ */ forwardRef(function(param, ref) {
|
|
|
7254
7274
|
})
|
|
7255
7275
|
}),
|
|
7256
7276
|
iconType !== void 0 && /* @__PURE__ */ jsx("div", {
|
|
7257
|
-
className: clsx(classes.inputIcon, _define_property$
|
|
7277
|
+
className: clsx(classes.inputIcon, _define_property$C({}, classes.activeIcon, !isDisabled && onIconClick !== void 0)),
|
|
7258
7278
|
onClick: !isDisabled ? onIconClick : void 0,
|
|
7259
7279
|
children: renderIcon(iconType)
|
|
7260
7280
|
})
|
|
@@ -7282,7 +7302,7 @@ var styles$x = {
|
|
|
7282
7302
|
},
|
|
7283
7303
|
tweakInput: {}
|
|
7284
7304
|
};
|
|
7285
|
-
function _define_property$
|
|
7305
|
+
function _define_property$B(obj, key, value) {
|
|
7286
7306
|
if (key in obj) {
|
|
7287
7307
|
Object.defineProperty(obj, key, {
|
|
7288
7308
|
value,
|
|
@@ -7305,7 +7325,7 @@ function _object_spread$z(target) {
|
|
|
7305
7325
|
}));
|
|
7306
7326
|
}
|
|
7307
7327
|
ownKeys2.forEach(function(key) {
|
|
7308
|
-
_define_property$
|
|
7328
|
+
_define_property$B(target, key, source[key]);
|
|
7309
7329
|
});
|
|
7310
7330
|
}
|
|
7311
7331
|
return target;
|
|
@@ -7459,7 +7479,7 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
7459
7479
|
_defineProperties(Constructor, staticProps);
|
|
7460
7480
|
return Constructor;
|
|
7461
7481
|
}
|
|
7462
|
-
function _define_property$
|
|
7482
|
+
function _define_property$A(obj, key, value) {
|
|
7463
7483
|
if (key in obj) {
|
|
7464
7484
|
Object.defineProperty(obj, key, {
|
|
7465
7485
|
value,
|
|
@@ -7502,7 +7522,7 @@ function _object_spread$y(target) {
|
|
|
7502
7522
|
}));
|
|
7503
7523
|
}
|
|
7504
7524
|
ownKeys2.forEach(function(key) {
|
|
7505
|
-
_define_property$
|
|
7525
|
+
_define_property$A(target, key, source[key]);
|
|
7506
7526
|
});
|
|
7507
7527
|
}
|
|
7508
7528
|
return target;
|
|
@@ -7600,8 +7620,8 @@ var ScrollIntoViewIfNeeded = /* @__PURE__ */ function(PureComponent2) {
|
|
|
7600
7620
|
_class_call_check(this, ScrollIntoViewIfNeeded2);
|
|
7601
7621
|
var _this;
|
|
7602
7622
|
_this = _super.apply(this, arguments);
|
|
7603
|
-
_define_property$
|
|
7604
|
-
_define_property$
|
|
7623
|
+
_define_property$A(_assert_this_initialized(_this), "node", createRef());
|
|
7624
|
+
_define_property$A(_assert_this_initialized(_this), "handleScrollIntoViewIfNeeded", function() {
|
|
7605
7625
|
var options = _this.props.options;
|
|
7606
7626
|
var _this_node = _this.node, node = _this_node.current;
|
|
7607
7627
|
if (node) {
|
|
@@ -7651,8 +7671,8 @@ var ScrollIntoViewIfNeeded = /* @__PURE__ */ function(PureComponent2) {
|
|
|
7651
7671
|
]);
|
|
7652
7672
|
return ScrollIntoViewIfNeeded2;
|
|
7653
7673
|
}(PureComponent);
|
|
7654
|
-
_define_property$
|
|
7655
|
-
function _define_property$
|
|
7674
|
+
_define_property$A(ScrollIntoViewIfNeeded, "defaultProps", ScrollIntoViewIfNeededDefaultProps);
|
|
7675
|
+
function _define_property$z(obj, key, value) {
|
|
7656
7676
|
if (key in obj) {
|
|
7657
7677
|
Object.defineProperty(obj, key, {
|
|
7658
7678
|
value,
|
|
@@ -7675,7 +7695,7 @@ function _object_spread$x(target) {
|
|
|
7675
7695
|
}));
|
|
7676
7696
|
}
|
|
7677
7697
|
ownKeys2.forEach(function(key) {
|
|
7678
|
-
_define_property$
|
|
7698
|
+
_define_property$z(target, key, source[key]);
|
|
7679
7699
|
});
|
|
7680
7700
|
}
|
|
7681
7701
|
return target;
|
|
@@ -7726,6 +7746,9 @@ var styles$v = {
|
|
|
7726
7746
|
boxSizing: "border-box",
|
|
7727
7747
|
fontSize: 14
|
|
7728
7748
|
},
|
|
7749
|
+
cellWithCheckbox: {
|
|
7750
|
+
padding: 0
|
|
7751
|
+
},
|
|
7729
7752
|
noMatchesLabel: {
|
|
7730
7753
|
pointerEvents: "none"
|
|
7731
7754
|
},
|
|
@@ -7740,7 +7763,17 @@ var styles$v = {
|
|
|
7740
7763
|
},
|
|
7741
7764
|
defaultCell: {}
|
|
7742
7765
|
};
|
|
7743
|
-
|
|
7766
|
+
var checkboxStyles = {
|
|
7767
|
+
root: {
|
|
7768
|
+
padding: CELL_PADDING,
|
|
7769
|
+
width: "100%"
|
|
7770
|
+
},
|
|
7771
|
+
input: {
|
|
7772
|
+
// иначе будет фокуситься и энтер будет вызывать изменение нескольких опций
|
|
7773
|
+
display: "none"
|
|
7774
|
+
}
|
|
7775
|
+
};
|
|
7776
|
+
function _define_property$y(obj, key, value) {
|
|
7744
7777
|
if (key in obj) {
|
|
7745
7778
|
Object.defineProperty(obj, key, {
|
|
7746
7779
|
value,
|
|
@@ -7763,7 +7796,7 @@ function _object_spread$w(target) {
|
|
|
7763
7796
|
}));
|
|
7764
7797
|
}
|
|
7765
7798
|
ownKeys2.forEach(function(key) {
|
|
7766
|
-
_define_property$
|
|
7799
|
+
_define_property$y(target, key, source[key]);
|
|
7767
7800
|
});
|
|
7768
7801
|
}
|
|
7769
7802
|
return target;
|
|
@@ -7792,15 +7825,67 @@ function _object_spread_props$q(target, source) {
|
|
|
7792
7825
|
}
|
|
7793
7826
|
return target;
|
|
7794
7827
|
}
|
|
7795
|
-
var
|
|
7828
|
+
var SelectListItem = function(param) {
|
|
7829
|
+
var classes = param.classes, index = param.index, isSemiChecked = param.isSemiChecked, isDisabled = param.isDisabled, isActive = param.isActive, children = param.children, isFocused = param.isFocused, onOptionSelect = param.onOptionSelect, onToggleCheckbox = param.onToggleCheckbox;
|
|
7830
|
+
var isMultiSelect = isNotEmpty(onToggleCheckbox);
|
|
7831
|
+
var _obj;
|
|
7832
|
+
return /* @__PURE__ */ jsx(ScrollIntoViewIfNeeded, _object_spread_props$q(_object_spread$w({
|
|
7833
|
+
active: isFocused,
|
|
7834
|
+
options: {
|
|
7835
|
+
block: "nearest"
|
|
7836
|
+
},
|
|
7837
|
+
className: clsx(classes.cell, (_obj = {}, _define_property$y(_obj, classes.cellWithCheckbox, isMultiSelect), _define_property$y(_obj, classes.focused, isFocused), _define_property$y(_obj, classes.active, isActive && !isMultiSelect), _define_property$y(_obj, classes.disabled, isDisabled), _obj))
|
|
7838
|
+
}, addDataAttributes({
|
|
7839
|
+
disabled: isDisabled,
|
|
7840
|
+
active: isActive,
|
|
7841
|
+
focused: isFocused
|
|
7842
|
+
})), {
|
|
7843
|
+
onClick: !isDisabled && !isMultiSelect ? function(event) {
|
|
7844
|
+
return onOptionSelect(index, event);
|
|
7845
|
+
} : void 0,
|
|
7846
|
+
children: isMultiSelect ? /* @__PURE__ */ jsx(Checkbox, {
|
|
7847
|
+
value: index,
|
|
7848
|
+
isChecked: isActive || isSemiChecked,
|
|
7849
|
+
isSemiChecked,
|
|
7850
|
+
isDisabled,
|
|
7851
|
+
tweakStyles: checkboxStyles,
|
|
7852
|
+
onSelect: function(v) {
|
|
7853
|
+
return onToggleCheckbox(index, v.isSelected);
|
|
7854
|
+
},
|
|
7855
|
+
children
|
|
7856
|
+
}) : children
|
|
7857
|
+
}));
|
|
7858
|
+
};
|
|
7859
|
+
var DEFAULT_OPTION_INDEX = -2;
|
|
7860
|
+
var ALL_OPTION_INDEX = -1;
|
|
7861
|
+
function _define_property$x(obj, key, value) {
|
|
7862
|
+
if (key in obj) {
|
|
7863
|
+
Object.defineProperty(obj, key, {
|
|
7864
|
+
value,
|
|
7865
|
+
enumerable: true,
|
|
7866
|
+
configurable: true,
|
|
7867
|
+
writable: true
|
|
7868
|
+
});
|
|
7869
|
+
} else {
|
|
7870
|
+
obj[key] = value;
|
|
7871
|
+
}
|
|
7872
|
+
return obj;
|
|
7873
|
+
}
|
|
7796
7874
|
function SelectList(param) {
|
|
7797
|
-
var options = param.options, focusedIndex = param.focusedIndex, activeValue = param.activeValue, defaultOptionLabel = param.defaultOptionLabel, _param_noMatchesLabel = param.noMatchesLabel, noMatchesLabel = _param_noMatchesLabel === void 0 ? "Совпадений не найдено" : _param_noMatchesLabel, isLoading = param.isLoading, _param_loadingLabel = param.loadingLabel, loadingLabel = _param_loadingLabel === void 0 ? "Загрузка..." : _param_loadingLabel, tweakStyles = param.tweakStyles, testId = param.testId, _param_shouldScrollToList = param.shouldScrollToList, shouldScrollToList = _param_shouldScrollToList === void 0 ? true : _param_shouldScrollToList, customListHeader = param.customListHeader, isOptionDisabled = param.isOptionDisabled,
|
|
7875
|
+
var options = param.options, focusedIndex = param.focusedIndex, activeValue = param.activeValue, defaultOptionLabel = param.defaultOptionLabel, _param_noMatchesLabel = param.noMatchesLabel, noMatchesLabel = _param_noMatchesLabel === void 0 ? "Совпадений не найдено" : _param_noMatchesLabel, isLoading = param.isLoading, _param_loadingLabel = param.loadingLabel, loadingLabel = _param_loadingLabel === void 0 ? "Загрузка..." : _param_loadingLabel, tweakStyles = param.tweakStyles, testId = param.testId, _param_shouldScrollToList = param.shouldScrollToList, shouldScrollToList = _param_shouldScrollToList === void 0 ? true : _param_shouldScrollToList, areAllOptionsSelected = param.areAllOptionsSelected, customListHeader = param.customListHeader, isOptionDisabled = param.isOptionDisabled, allOptionsLabel = param.allOptionsLabel, onOptionSelect = param.onOptionSelect, onToggleCheckbox = param.onToggleCheckbox, convertValueToString = param.convertValueToString, _param_convertValueToReactNode = param.convertValueToReactNode, convertValueToReactNode = _param_convertValueToReactNode === void 0 ? convertValueToString : _param_convertValueToReactNode, convertValueToId = param.convertValueToId;
|
|
7798
7876
|
var classes = useTheme("SelectList", styles$v, tweakStyles).classes;
|
|
7799
|
-
var
|
|
7800
|
-
var
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
var
|
|
7877
|
+
var isMultiSelect = isNotEmpty(onToggleCheckbox);
|
|
7878
|
+
var multiSelectValue = activeValue;
|
|
7879
|
+
var _multiSelectValue_length;
|
|
7880
|
+
var selectedOptionsCount = (_multiSelectValue_length = multiSelectValue === null || multiSelectValue === void 0 ? void 0 : multiSelectValue.length) !== null && _multiSelectValue_length !== void 0 ? _multiSelectValue_length : 0;
|
|
7881
|
+
var _multiSelectValue_map;
|
|
7882
|
+
var activeOptionsIdMap = useMemo(function() {
|
|
7883
|
+
return isMultiSelect ? (_multiSelectValue_map = multiSelectValue === null || multiSelectValue === void 0 ? void 0 : multiSelectValue.map(convertValueToId)) !== null && _multiSelectValue_map !== void 0 ? _multiSelectValue_map : [] : [];
|
|
7884
|
+
}, [
|
|
7885
|
+
isMultiSelect,
|
|
7886
|
+
multiSelectValue,
|
|
7887
|
+
convertValueToId
|
|
7888
|
+
]);
|
|
7804
7889
|
var optionsDisableMap = useMemo(function() {
|
|
7805
7890
|
return options.map(function(o) {
|
|
7806
7891
|
return isOptionDisabled(o);
|
|
@@ -7811,15 +7896,18 @@ function SelectList(param) {
|
|
|
7811
7896
|
]);
|
|
7812
7897
|
var listOptions = useMemo(function() {
|
|
7813
7898
|
return options.map(function(opt, i) {
|
|
7814
|
-
return
|
|
7899
|
+
return convertValueToReactNode(opt, optionsDisableMap[i]);
|
|
7815
7900
|
});
|
|
7816
7901
|
}, [
|
|
7817
7902
|
options,
|
|
7818
|
-
|
|
7903
|
+
convertValueToReactNode,
|
|
7819
7904
|
optionsDisableMap
|
|
7820
7905
|
]);
|
|
7906
|
+
var isActiveOption = function(item) {
|
|
7907
|
+
return isMultiSelect ? activeOptionsIdMap.includes(convertValueToId(item)) : isNotEmpty(activeValue) && convertValueToId(activeValue) === convertValueToId(item);
|
|
7908
|
+
};
|
|
7821
7909
|
return /* @__PURE__ */ jsxs(ScrollIntoViewIfNeeded, {
|
|
7822
|
-
active: shouldScrollToList,
|
|
7910
|
+
active: shouldScrollToList && !isMultiSelect,
|
|
7823
7911
|
className: clsx(classes.root, _define_property$x({}, classes.withListHeader, isNotEmpty(customListHeader))),
|
|
7824
7912
|
children: [
|
|
7825
7913
|
isNotEmpty(customListHeader) && /* @__PURE__ */ jsx("div", {
|
|
@@ -7834,39 +7922,42 @@ function SelectList(param) {
|
|
|
7834
7922
|
children: loadingLabel
|
|
7835
7923
|
}) : /* @__PURE__ */ jsxs(Fragment, {
|
|
7836
7924
|
children: [
|
|
7837
|
-
defaultOptionLabel
|
|
7925
|
+
isNotEmpty(defaultOptionLabel) && /* @__PURE__ */ jsx(ScrollIntoViewIfNeeded, {
|
|
7838
7926
|
active: focusedIndex === DEFAULT_OPTION_INDEX,
|
|
7839
7927
|
options: {
|
|
7840
7928
|
block: "nearest"
|
|
7841
7929
|
},
|
|
7842
7930
|
className: clsx(classes.cell, classes.defaultCell, focusedIndex === DEFAULT_OPTION_INDEX && classes.focused),
|
|
7843
7931
|
onClick: function(event) {
|
|
7844
|
-
return
|
|
7932
|
+
return onOptionSelect(DEFAULT_OPTION_INDEX, event);
|
|
7845
7933
|
},
|
|
7846
7934
|
children: defaultOptionLabel
|
|
7847
7935
|
}),
|
|
7936
|
+
isNotEmpty(allOptionsLabel) && /* @__PURE__ */ jsx(SelectListItem, {
|
|
7937
|
+
classes,
|
|
7938
|
+
index: ALL_OPTION_INDEX,
|
|
7939
|
+
isSemiChecked: selectedOptionsCount > 0 && !areAllOptionsSelected,
|
|
7940
|
+
isActive: areAllOptionsSelected,
|
|
7941
|
+
isFocused: focusedIndex === ALL_OPTION_INDEX,
|
|
7942
|
+
onOptionSelect,
|
|
7943
|
+
onToggleCheckbox,
|
|
7944
|
+
children: allOptionsLabel
|
|
7945
|
+
}),
|
|
7848
7946
|
listOptions.map(function(opt, i) {
|
|
7849
7947
|
var optionValue = options[i];
|
|
7850
|
-
var isFocused =
|
|
7948
|
+
var isFocused = focusedIndex === i;
|
|
7851
7949
|
var isActive = isActiveOption(optionValue);
|
|
7852
7950
|
var isDisabled = optionsDisableMap[i];
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
|
|
7861
|
-
disabled: isDisabled,
|
|
7862
|
-
active: isActive,
|
|
7863
|
-
focused: isFocused
|
|
7864
|
-
})), {
|
|
7865
|
-
onClick: !isDisabled ? function(event) {
|
|
7866
|
-
return onOptionClick(i, event);
|
|
7867
|
-
} : void 0,
|
|
7951
|
+
return /* @__PURE__ */ jsx(SelectListItem, {
|
|
7952
|
+
classes,
|
|
7953
|
+
index: i,
|
|
7954
|
+
isDisabled,
|
|
7955
|
+
isActive,
|
|
7956
|
+
isFocused,
|
|
7957
|
+
onOptionSelect,
|
|
7958
|
+
onToggleCheckbox,
|
|
7868
7959
|
children: opt
|
|
7869
|
-
}
|
|
7960
|
+
}, i);
|
|
7870
7961
|
}),
|
|
7871
7962
|
listOptions.length === 0 && /* @__PURE__ */ jsx("div", {
|
|
7872
7963
|
className: clsx(classes.cell, classes.noMatchesLabel),
|
|
@@ -7888,10 +7979,13 @@ var defaultConvertFunction$2 = function(v) {
|
|
|
7888
7979
|
var defaultCompareFunction = function(v1, v2) {
|
|
7889
7980
|
return v1 === v2;
|
|
7890
7981
|
};
|
|
7891
|
-
var
|
|
7892
|
-
return
|
|
7893
|
-
return
|
|
7894
|
-
}
|
|
7982
|
+
var getDefaultConvertToIdFunction = function(convertValueToString) {
|
|
7983
|
+
return function(value) {
|
|
7984
|
+
return isNotEmpty(value === null || value === void 0 ? void 0 : value.id) ? String(value.id) : convertValueToString(value);
|
|
7985
|
+
};
|
|
7986
|
+
};
|
|
7987
|
+
var isMultiSelectValue = function(props, _value) {
|
|
7988
|
+
return props.isMultiSelect === true;
|
|
7895
7989
|
};
|
|
7896
7990
|
var styles$u = {
|
|
7897
7991
|
root: {
|
|
@@ -7937,6 +8031,15 @@ var styles$u = {
|
|
|
7937
8031
|
cursor: "default"
|
|
7938
8032
|
}
|
|
7939
8033
|
},
|
|
8034
|
+
counter: {
|
|
8035
|
+
"&:not(:last-child)": {
|
|
8036
|
+
paddingRight: 8
|
|
8037
|
+
}
|
|
8038
|
+
},
|
|
8039
|
+
icon: {
|
|
8040
|
+
width: 16,
|
|
8041
|
+
height: 16
|
|
8042
|
+
},
|
|
7940
8043
|
tweakInput: {
|
|
7941
8044
|
input: {
|
|
7942
8045
|
paddingRight: 32
|
|
@@ -8125,6 +8228,10 @@ function _array_with_holes$j(arr) {
|
|
|
8125
8228
|
if (Array.isArray(arr))
|
|
8126
8229
|
return arr;
|
|
8127
8230
|
}
|
|
8231
|
+
function _array_without_holes$4(arr) {
|
|
8232
|
+
if (Array.isArray(arr))
|
|
8233
|
+
return _array_like_to_array$j(arr);
|
|
8234
|
+
}
|
|
8128
8235
|
function asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, key, arg) {
|
|
8129
8236
|
try {
|
|
8130
8237
|
var info = gen[key](arg);
|
|
@@ -8167,6 +8274,10 @@ function _define_property$v(obj, key, value) {
|
|
|
8167
8274
|
}
|
|
8168
8275
|
return obj;
|
|
8169
8276
|
}
|
|
8277
|
+
function _iterable_to_array$4(iter) {
|
|
8278
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
|
8279
|
+
return Array.from(iter);
|
|
8280
|
+
}
|
|
8170
8281
|
function _iterable_to_array_limit$j(arr, i) {
|
|
8171
8282
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
8172
8283
|
if (_i == null)
|
|
@@ -8198,6 +8309,9 @@ function _iterable_to_array_limit$j(arr, i) {
|
|
|
8198
8309
|
function _non_iterable_rest$j() {
|
|
8199
8310
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
8200
8311
|
}
|
|
8312
|
+
function _non_iterable_spread$4() {
|
|
8313
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
8314
|
+
}
|
|
8201
8315
|
function _object_spread$u(target) {
|
|
8202
8316
|
for (var i = 1; i < arguments.length; i++) {
|
|
8203
8317
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
@@ -8272,6 +8386,9 @@ function _object_without_properties_loose$5(source, excluded) {
|
|
|
8272
8386
|
function _sliced_to_array$j(arr, i) {
|
|
8273
8387
|
return _array_with_holes$j(arr) || _iterable_to_array_limit$j(arr, i) || _unsupported_iterable_to_array$j(arr, i) || _non_iterable_rest$j();
|
|
8274
8388
|
}
|
|
8389
|
+
function _to_consumable_array$4(arr) {
|
|
8390
|
+
return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$j(arr) || _non_iterable_spread$4();
|
|
8391
|
+
}
|
|
8275
8392
|
function _unsupported_iterable_to_array$j(o, minLen) {
|
|
8276
8393
|
if (!o)
|
|
8277
8394
|
return;
|
|
@@ -8387,11 +8504,12 @@ var __generator$4 = globalThis && globalThis.__generator || function(thisArg, bo
|
|
|
8387
8504
|
};
|
|
8388
8505
|
}
|
|
8389
8506
|
};
|
|
8390
|
-
function Select(
|
|
8391
|
-
var options =
|
|
8507
|
+
function Select(props) {
|
|
8508
|
+
var options = props.options, value = props.value, defaultOptionLabel = props.defaultOptionLabel, allOptionsLabel = props.allOptionsLabel, _props_debounceTime = props.debounceTime, debounceTime = _props_debounceTime === void 0 ? 400 : _props_debounceTime, _props_optionsMode = props.optionsMode, optionsMode = _props_optionsMode === void 0 ? "normal" : _props_optionsMode, noMatchesLabel = props.noMatchesLabel, loadingLabel = props.loadingLabel, tweakStyles = props.tweakStyles, testId = props.testId, isReadonly = props.isReadonly, isDisabled = props.isDisabled, dropdownOptions = props.dropdownOptions, _props_minSymbolsCountToOpenList = props.minSymbolsCountToOpenList, minSymbolsCountToOpenList = _props_minSymbolsCountToOpenList === void 0 ? 0 : _props_minSymbolsCountToOpenList, _props_dropdownIcon = props.dropdownIcon, dropdownIcon = _props_dropdownIcon === void 0 ? "chevron-down" : _props_dropdownIcon, _props_shouldScrollToList = props.shouldScrollToList, shouldScrollToList = _props_shouldScrollToList === void 0 ? true : _props_shouldScrollToList, searchInput = props.searchInput, iconType = props.iconType, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, onType = props.onType, onOpen = props.onOpen, _props_isOptionDisabled = props.isOptionDisabled, isOptionDisabled = _props_isOptionDisabled === void 0 ? defaultIsOptionDisabled : _props_isOptionDisabled, _props_compareValuesOnChange = props.compareValuesOnChange, compareValuesOnChange = _props_compareValuesOnChange === void 0 ? defaultCompareFunction : _props_compareValuesOnChange, _props_convertValueToString = props.convertValueToString, convertValueToString = _props_convertValueToString === void 0 ? defaultConvertFunction$2 : _props_convertValueToString, convertValueToId = props.convertValueToId, convertValueToReactNode = props.convertValueToReactNode, optionsFilter = props.optionsFilter, inputProps = _object_without_properties$5(props, [
|
|
8392
8509
|
"options",
|
|
8393
8510
|
"value",
|
|
8394
8511
|
"defaultOptionLabel",
|
|
8512
|
+
"allOptionsLabel",
|
|
8395
8513
|
"debounceTime",
|
|
8396
8514
|
"optionsMode",
|
|
8397
8515
|
"noMatchesLabel",
|
|
@@ -8405,6 +8523,7 @@ function Select(_param) {
|
|
|
8405
8523
|
"dropdownIcon",
|
|
8406
8524
|
"shouldScrollToList",
|
|
8407
8525
|
"searchInput",
|
|
8526
|
+
"iconType",
|
|
8408
8527
|
"onChange",
|
|
8409
8528
|
"onFocus",
|
|
8410
8529
|
"onBlur",
|
|
@@ -8421,8 +8540,8 @@ function Select(_param) {
|
|
|
8421
8540
|
var isMounted = useIsMounted();
|
|
8422
8541
|
var _useState = _sliced_to_array$j(useState(false), 2), isListOpen = _useState[0], setIsListOpen = _useState[1];
|
|
8423
8542
|
var _useState1 = _sliced_to_array$j(useState(false), 2), areOptionsLoading = _useState1[0], setAreOptionsLoading = _useState1[1];
|
|
8424
|
-
var hasDefaultOption = defaultOptionLabel
|
|
8425
|
-
var _useState2 = _sliced_to_array$j(useState(
|
|
8543
|
+
var hasDefaultOption = isStringNotEmpty(defaultOptionLabel);
|
|
8544
|
+
var _useState2 = _sliced_to_array$j(useState(DEFAULT_OPTION_INDEX), 2), focusedListCellIndex = _useState2[0], setFocusedListCellIndex = _useState2[1];
|
|
8426
8545
|
var _useState3 = _sliced_to_array$j(useState(""), 2), searchValue = _useState3[0], setSearchValue = _useState3[1];
|
|
8427
8546
|
var _useState4 = _sliced_to_array$j(useState(true), 2), shouldShowDefaultOption = _useState4[0], setShouldShowDefaultOption = _useState4[1];
|
|
8428
8547
|
var inputWrapper = useRef(null);
|
|
@@ -8430,31 +8549,60 @@ function Select(_param) {
|
|
|
8430
8549
|
var input = useRef(null);
|
|
8431
8550
|
var shouldRenderSearchInputInList = (searchInput === null || searchInput === void 0 ? void 0 : searchInput.shouldRenderInList) === true;
|
|
8432
8551
|
var hasSearchInputInList = optionsMode !== "normal" && shouldRenderSearchInputInList;
|
|
8433
|
-
var
|
|
8552
|
+
var isMultiSelect = isMultiSelectValue(props);
|
|
8553
|
+
var strValue = isMultiSelect ? value === null || value === void 0 ? void 0 : value[0] : value;
|
|
8554
|
+
var shouldShowAllOption = isMultiSelect && isNotEmpty(allOptionsLabel) && searchValue === "";
|
|
8434
8555
|
var filteredOptions = useMemo(function() {
|
|
8435
8556
|
if (optionsMode !== "search") {
|
|
8436
8557
|
return options;
|
|
8437
8558
|
}
|
|
8438
|
-
|
|
8439
|
-
|
|
8440
|
-
|
|
8441
|
-
|
|
8442
|
-
|
|
8443
|
-
var convertedOption = convertValueToString(option);
|
|
8444
|
-
return convertedOption !== void 0 && convertedOption.toLowerCase().includes(lowerCaseValue);
|
|
8559
|
+
var _convertValueToString;
|
|
8560
|
+
var filter = optionsFilter !== null && optionsFilter !== void 0 ? optionsFilter : createFilter(function(option) {
|
|
8561
|
+
return [
|
|
8562
|
+
(_convertValueToString = convertValueToString(option)) !== null && _convertValueToString !== void 0 ? _convertValueToString : ""
|
|
8563
|
+
];
|
|
8445
8564
|
});
|
|
8565
|
+
return filter(options, searchValue);
|
|
8446
8566
|
}, [
|
|
8447
|
-
optionsMode,
|
|
8448
8567
|
optionsFilter,
|
|
8449
8568
|
options,
|
|
8450
8569
|
convertValueToString,
|
|
8451
|
-
searchValue
|
|
8570
|
+
searchValue,
|
|
8571
|
+
optionsMode
|
|
8452
8572
|
]);
|
|
8453
|
-
|
|
8454
|
-
|
|
8573
|
+
var availableOptions = useMemo(function() {
|
|
8574
|
+
return options.filter(function(o) {
|
|
8575
|
+
return !isOptionDisabled(o);
|
|
8576
|
+
});
|
|
8455
8577
|
}, [
|
|
8456
|
-
|
|
8457
|
-
|
|
8578
|
+
options,
|
|
8579
|
+
isOptionDisabled
|
|
8580
|
+
]);
|
|
8581
|
+
var areAllOptionsSelected = isMultiSelect && (value === null || value === void 0 ? void 0 : value.length) === availableOptions.length;
|
|
8582
|
+
var shouldShowMultiSelectCounter = isMultiSelect && isNotEmpty(value) && value.length > 1 && !areAllOptionsSelected;
|
|
8583
|
+
var optionsIndexesForNavigation = useMemo(function() {
|
|
8584
|
+
var result = [];
|
|
8585
|
+
if (shouldShowDefaultOption && hasDefaultOption) {
|
|
8586
|
+
result.push(DEFAULT_OPTION_INDEX);
|
|
8587
|
+
}
|
|
8588
|
+
if (shouldShowAllOption) {
|
|
8589
|
+
result.push(ALL_OPTION_INDEX);
|
|
8590
|
+
}
|
|
8591
|
+
return result.concat(filteredOptions.reduce(function(acc, cur, i) {
|
|
8592
|
+
if (!isOptionDisabled(cur)) {
|
|
8593
|
+
acc.push(i);
|
|
8594
|
+
}
|
|
8595
|
+
return acc;
|
|
8596
|
+
}, []));
|
|
8597
|
+
}, [
|
|
8598
|
+
filteredOptions
|
|
8599
|
+
]);
|
|
8600
|
+
var stringValue = isNotEmpty(strValue) ? convertValueToString(strValue) : void 0;
|
|
8601
|
+
var showedStringValue = areAllOptionsSelected && isNotEmpty(allOptionsLabel) ? allOptionsLabel : stringValue;
|
|
8602
|
+
var convertToId = useCallback(function(v) {
|
|
8603
|
+
return (convertValueToId !== null && convertValueToId !== void 0 ? convertValueToId : getDefaultConvertToIdFunction(convertValueToString))(v);
|
|
8604
|
+
}, [
|
|
8605
|
+
convertValueToId,
|
|
8458
8606
|
convertValueToString
|
|
8459
8607
|
]);
|
|
8460
8608
|
var handleListClose = useCallback(function(event) {
|
|
@@ -8491,11 +8639,9 @@ function Select(_param) {
|
|
|
8491
8639
|
}
|
|
8492
8640
|
};
|
|
8493
8641
|
var handleOnChange = useCallback(function(newValue) {
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
return;
|
|
8642
|
+
if (!compareValuesOnChange(value, newValue)) {
|
|
8643
|
+
onChange(newValue);
|
|
8497
8644
|
}
|
|
8498
|
-
onChange(newValue);
|
|
8499
8645
|
}, [
|
|
8500
8646
|
value,
|
|
8501
8647
|
compareValuesOnChange,
|
|
@@ -8503,7 +8649,7 @@ function Select(_param) {
|
|
|
8503
8649
|
]);
|
|
8504
8650
|
var handleOptionSelect = useCallback(function(index, event) {
|
|
8505
8651
|
var _input_current;
|
|
8506
|
-
handleOnChange(index ===
|
|
8652
|
+
handleOnChange(index === DEFAULT_OPTION_INDEX ? void 0 : filteredOptions[index]);
|
|
8507
8653
|
handleListClose(event);
|
|
8508
8654
|
(_input_current = input.current) === null || _input_current === void 0 ? void 0 : _input_current.blur();
|
|
8509
8655
|
}, [
|
|
@@ -8511,6 +8657,36 @@ function Select(_param) {
|
|
|
8511
8657
|
handleListClose,
|
|
8512
8658
|
filteredOptions
|
|
8513
8659
|
]);
|
|
8660
|
+
var handleToggleOptionCheckbox = useCallback(function(index, isSelected) {
|
|
8661
|
+
if (!isMultiSelect) {
|
|
8662
|
+
return;
|
|
8663
|
+
}
|
|
8664
|
+
if (index === DEFAULT_OPTION_INDEX || index === ALL_OPTION_INDEX && !isSelected) {
|
|
8665
|
+
handleOnChange(void 0);
|
|
8666
|
+
return;
|
|
8667
|
+
}
|
|
8668
|
+
if (index === ALL_OPTION_INDEX && isSelected) {
|
|
8669
|
+
handleOnChange(availableOptions);
|
|
8670
|
+
return;
|
|
8671
|
+
}
|
|
8672
|
+
var option = filteredOptions[index];
|
|
8673
|
+
handleOnChange(isSelected ? (
|
|
8674
|
+
// Добавляем
|
|
8675
|
+
_to_consumable_array$4(value !== null && value !== void 0 ? value : []).concat([
|
|
8676
|
+
option
|
|
8677
|
+
])
|
|
8678
|
+
) : (
|
|
8679
|
+
// Убираем
|
|
8680
|
+
value === null || value === void 0 ? void 0 : value.filter(function(o) {
|
|
8681
|
+
return convertToId(o) !== convertToId(option);
|
|
8682
|
+
})
|
|
8683
|
+
));
|
|
8684
|
+
}, [
|
|
8685
|
+
handleOnChange,
|
|
8686
|
+
filteredOptions,
|
|
8687
|
+
isMultiSelect,
|
|
8688
|
+
value
|
|
8689
|
+
]);
|
|
8514
8690
|
var handleOnType = useCallback(function() {
|
|
8515
8691
|
var _ref2 = _async_to_generator$4(function(v) {
|
|
8516
8692
|
return __generator$4(this, function(_state) {
|
|
@@ -8570,47 +8746,43 @@ function Select(_param) {
|
|
|
8570
8746
|
return;
|
|
8571
8747
|
}
|
|
8572
8748
|
event.stopPropagation();
|
|
8749
|
+
var curIndexInNavigation = optionsIndexesForNavigation.findIndex(function(index) {
|
|
8750
|
+
return index === focusedListCellIndex;
|
|
8751
|
+
});
|
|
8573
8752
|
switch (event.code) {
|
|
8574
8753
|
case "Enter":
|
|
8575
8754
|
case "NumpadEnter": {
|
|
8576
|
-
var
|
|
8577
|
-
if (
|
|
8578
|
-
|
|
8755
|
+
var indexToSelect = focusedListCellIndex;
|
|
8756
|
+
if (indexToSelect === DEFAULT_OPTION_INDEX && filteredOptions.length === 1) {
|
|
8757
|
+
indexToSelect = 0;
|
|
8758
|
+
}
|
|
8759
|
+
if (isMultiSelect) {
|
|
8760
|
+
var isThisValueAlreadySelected;
|
|
8761
|
+
if (indexToSelect === ALL_OPTION_INDEX) {
|
|
8762
|
+
isThisValueAlreadySelected = areAllOptionsSelected;
|
|
8763
|
+
} else {
|
|
8764
|
+
var valueIdToSelect = convertToId(filteredOptions[indexToSelect]);
|
|
8765
|
+
var _value_some;
|
|
8766
|
+
isThisValueAlreadySelected = (_value_some = value === null || value === void 0 ? void 0 : value.some(function(opt) {
|
|
8767
|
+
return convertToId(opt) === valueIdToSelect;
|
|
8768
|
+
})) !== null && _value_some !== void 0 ? _value_some : false;
|
|
8769
|
+
}
|
|
8770
|
+
handleToggleOptionCheckbox(indexToSelect, !isThisValueAlreadySelected);
|
|
8771
|
+
} else {
|
|
8772
|
+
handleOptionSelect(indexToSelect, event);
|
|
8579
8773
|
}
|
|
8580
|
-
handleOptionSelect(indexToClick, event);
|
|
8581
8774
|
break;
|
|
8582
8775
|
}
|
|
8583
8776
|
case "ArrowDown": {
|
|
8584
8777
|
event.preventDefault();
|
|
8585
|
-
var
|
|
8586
|
-
|
|
8587
|
-
var targetIndex = (i + 1) % filteredOptions.length;
|
|
8588
|
-
if (shouldShowDefaultOption && hasDefaultOption && newIndex > -1 && targetIndex === 0) {
|
|
8589
|
-
newIndex = -1;
|
|
8590
|
-
break;
|
|
8591
|
-
}
|
|
8592
|
-
if (!isOptionDisabled(filteredOptions[targetIndex])) {
|
|
8593
|
-
newIndex = targetIndex;
|
|
8594
|
-
break;
|
|
8595
|
-
}
|
|
8596
|
-
}
|
|
8597
|
-
setFocusedListCellIndex(newIndex);
|
|
8778
|
+
var targetIndexInNavigation = (curIndexInNavigation + 1) % optionsIndexesForNavigation.length;
|
|
8779
|
+
setFocusedListCellIndex(optionsIndexesForNavigation[targetIndexInNavigation]);
|
|
8598
8780
|
break;
|
|
8599
8781
|
}
|
|
8600
8782
|
case "ArrowUp": {
|
|
8601
8783
|
event.preventDefault();
|
|
8602
|
-
var
|
|
8603
|
-
|
|
8604
|
-
var targetIndex1 = (i1 > 0 ? i1 : filteredOptions.length + i1) - 1;
|
|
8605
|
-
if (shouldShowDefaultOption && hasDefaultOption && focusedListCellIndex !== -1 && targetIndex1 === filteredOptions.length - 1) {
|
|
8606
|
-
setFocusedListCellIndex(-1);
|
|
8607
|
-
break;
|
|
8608
|
-
}
|
|
8609
|
-
if (!isOptionDisabled(filteredOptions[targetIndex1])) {
|
|
8610
|
-
setFocusedListCellIndex(targetIndex1);
|
|
8611
|
-
break;
|
|
8612
|
-
}
|
|
8613
|
-
}
|
|
8784
|
+
var targetIndexInNavigation1 = (curIndexInNavigation - 1 + optionsIndexesForNavigation.length) % optionsIndexesForNavigation.length;
|
|
8785
|
+
setFocusedListCellIndex(optionsIndexesForNavigation[targetIndexInNavigation1]);
|
|
8614
8786
|
break;
|
|
8615
8787
|
}
|
|
8616
8788
|
}
|
|
@@ -8643,6 +8815,10 @@ function Select(_param) {
|
|
|
8643
8815
|
input: {
|
|
8644
8816
|
cursor: "pointer"
|
|
8645
8817
|
}
|
|
8818
|
+
}), _object_spread$u({}, isMultiSelect && {
|
|
8819
|
+
inputIcon: {
|
|
8820
|
+
width: "auto"
|
|
8821
|
+
}
|
|
8646
8822
|
}), tweakStyles === null || tweakStyles === void 0 ? void 0 : tweakStyles.tweakInput);
|
|
8647
8823
|
}, [
|
|
8648
8824
|
tweakStyles === null || tweakStyles === void 0 ? void 0 : tweakStyles.tweakInput,
|
|
@@ -8662,12 +8838,16 @@ function Select(_param) {
|
|
|
8662
8838
|
]
|
|
8663
8839
|
});
|
|
8664
8840
|
useEffect(function() {
|
|
8665
|
-
|
|
8666
|
-
|
|
8841
|
+
var val = isMultiSelect ? value === null || value === void 0 ? void 0 : value[0] : value;
|
|
8842
|
+
var _optionsIndexesForNavigation_find;
|
|
8843
|
+
setFocusedListCellIndex((_optionsIndexesForNavigation_find = optionsIndexesForNavigation.find(function(index) {
|
|
8844
|
+
return filteredOptions[index] === val;
|
|
8845
|
+
})) !== null && _optionsIndexesForNavigation_find !== void 0 ? _optionsIndexesForNavigation_find : optionsIndexesForNavigation[0]);
|
|
8846
|
+
if (isOpen) {
|
|
8847
|
+
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
8667
8848
|
}
|
|
8668
8849
|
}, [
|
|
8669
|
-
isOpen
|
|
8670
|
-
onOpen
|
|
8850
|
+
isOpen
|
|
8671
8851
|
]);
|
|
8672
8852
|
var _obj;
|
|
8673
8853
|
var listEl = /* @__PURE__ */ jsx("div", _object_spread_props$o(_object_spread$u({
|
|
@@ -8679,6 +8859,8 @@ function Select(_param) {
|
|
|
8679
8859
|
children: isOpen && /* @__PURE__ */ jsx(SelectList, {
|
|
8680
8860
|
options: filteredOptions,
|
|
8681
8861
|
defaultOptionLabel: hasDefaultOption && shouldShowDefaultOption ? defaultOptionLabel : void 0,
|
|
8862
|
+
allOptionsLabel: shouldShowAllOption ? allOptionsLabel : void 0,
|
|
8863
|
+
areAllOptionsSelected,
|
|
8682
8864
|
customListHeader: hasSearchInputInList ? /* @__PURE__ */ jsx(SearchInput, _object_spread$u({
|
|
8683
8865
|
value: searchValue,
|
|
8684
8866
|
onChange: handleInputChange,
|
|
@@ -8696,10 +8878,27 @@ function Select(_param) {
|
|
|
8696
8878
|
isOptionDisabled,
|
|
8697
8879
|
convertValueToString,
|
|
8698
8880
|
convertValueToReactNode,
|
|
8699
|
-
convertValueToId,
|
|
8700
|
-
|
|
8881
|
+
convertValueToId: convertToId,
|
|
8882
|
+
onOptionSelect: handleOptionSelect,
|
|
8883
|
+
onToggleCheckbox: isMultiSelect ? handleToggleOptionCheckbox : void 0
|
|
8701
8884
|
})
|
|
8702
8885
|
}));
|
|
8886
|
+
var multiSelectCounterWithIcon = shouldShowMultiSelectCounter || isNotEmpty(iconType) ? /* @__PURE__ */ jsxs(Fragment, {
|
|
8887
|
+
children: [
|
|
8888
|
+
shouldShowMultiSelectCounter && /* @__PURE__ */ jsxs("div", {
|
|
8889
|
+
className: classes.counter,
|
|
8890
|
+
children: [
|
|
8891
|
+
"(+",
|
|
8892
|
+
value.length - 1,
|
|
8893
|
+
")"
|
|
8894
|
+
]
|
|
8895
|
+
}),
|
|
8896
|
+
isNotEmpty(iconType) && /* @__PURE__ */ jsx("div", {
|
|
8897
|
+
className: classes.icon,
|
|
8898
|
+
children: renderIcon(iconType)
|
|
8899
|
+
})
|
|
8900
|
+
]
|
|
8901
|
+
}) : void 0;
|
|
8703
8902
|
return /* @__PURE__ */ jsxs("div", {
|
|
8704
8903
|
className: classes.root,
|
|
8705
8904
|
onKeyDown: handleKeyDown,
|
|
@@ -8710,7 +8909,7 @@ function Select(_param) {
|
|
|
8710
8909
|
ref: inputWrapper,
|
|
8711
8910
|
children: [
|
|
8712
8911
|
/* @__PURE__ */ jsx(Input, _object_spread$u({
|
|
8713
|
-
value: searchValue !== "" && !shouldRenderSearchInputInList ? searchValue :
|
|
8912
|
+
value: searchValue !== "" && !shouldRenderSearchInputInList ? searchValue : showedStringValue,
|
|
8714
8913
|
onChange: handleInputChange,
|
|
8715
8914
|
isActive: isListOpen,
|
|
8716
8915
|
isReadonly: hasReadonlyInput,
|
|
@@ -8720,7 +8919,8 @@ function Select(_param) {
|
|
|
8720
8919
|
ref: input,
|
|
8721
8920
|
isLoading: areOptionsLoading,
|
|
8722
8921
|
tweakStyles: tweakInputStyles,
|
|
8723
|
-
testId
|
|
8922
|
+
testId,
|
|
8923
|
+
iconType: isMultiSelect ? multiSelectCounterWithIcon : iconType
|
|
8724
8924
|
}, inputProps)),
|
|
8725
8925
|
/* @__PURE__ */ jsx("div", {
|
|
8726
8926
|
onMouseDown: function(event) {
|
|
@@ -27899,6 +28099,7 @@ export {
|
|
|
27899
28099
|
checkElementParentsClassNames,
|
|
27900
28100
|
checkSearchStringInCountry,
|
|
27901
28101
|
commonTheme,
|
|
28102
|
+
createFilter,
|
|
27902
28103
|
defaultConvertFunction$1 as defaultConvertFunction,
|
|
27903
28104
|
findCountryByCode,
|
|
27904
28105
|
findCountryIndexByCode,
|
|
@@ -27923,6 +28124,7 @@ export {
|
|
|
27923
28124
|
isInt,
|
|
27924
28125
|
isNotEmpty,
|
|
27925
28126
|
isSpaceChar,
|
|
28127
|
+
isStringNotEmpty,
|
|
27926
28128
|
minWidthModifier,
|
|
27927
28129
|
phoneInfo,
|
|
27928
28130
|
removeStringFormat,
|