@true-engineering/true-react-common-ui-kit 1.9.0 → 1.10.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.
Files changed (31) hide show
  1. package/dist/components/Input/Input.styles.d.ts +1 -0
  2. package/dist/components/Select/Select.d.ts +12 -3
  3. package/dist/components/Select/Select.styles.d.ts +10 -0
  4. package/dist/components/Select/SelectList/SelectList.d.ts +6 -4
  5. package/dist/components/Select/SelectList/SelectList.styles.d.ts +5 -0
  6. package/dist/components/Select/SelectListItem/SelectListItem.d.ts +14 -0
  7. package/dist/components/Select/SelectListItem/SelectListItem.styles.d.ts +2 -0
  8. package/dist/components/Select/constants.d.ts +2 -0
  9. package/dist/components/Select/helpers.d.ts +4 -1
  10. package/dist/components/Select/index.d.ts +1 -0
  11. package/dist/components/Select/types.d.ts +1 -0
  12. package/dist/helpers/utils.d.ts +2 -0
  13. package/dist/true-react-common-ui-kit.js +340 -163
  14. package/dist/true-react-common-ui-kit.js.map +1 -1
  15. package/dist/true-react-common-ui-kit.umd.cjs +340 -163
  16. package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
  17. package/package.json +1 -1
  18. package/src/components/Input/Input.styles.ts +2 -0
  19. package/src/components/Input/Input.tsx +4 -1
  20. package/src/components/Select/MultiSelect.stories.tsx +262 -0
  21. package/src/components/Select/Select.styles.ts +13 -0
  22. package/src/components/Select/Select.tsx +215 -114
  23. package/src/components/Select/SelectList/SelectList.styles.ts +6 -2
  24. package/src/components/Select/SelectList/SelectList.tsx +64 -39
  25. package/src/components/Select/SelectListItem/SelectListItem.styles.ts +14 -0
  26. package/src/components/Select/SelectListItem/SelectListItem.tsx +73 -0
  27. package/src/components/Select/constants.ts +2 -0
  28. package/src/components/Select/helpers.ts +16 -8
  29. package/src/components/Select/index.ts +1 -0
  30. package/src/components/Select/types.ts +1 -0
  31. 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$6(arr) {
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$6(iter) {
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$6() {
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$6(arr) {
1169
- return _array_without_holes$6(arr) || _iterable_to_array$6(arr) || _unsupported_iterable_to_array$q(arr) || _non_iterable_spread$6();
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$6(args));
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$5(arr) {
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$5(iter) {
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$5() {
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$5(arr) {
1384
- return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$p(arr) || _non_iterable_spread$5();
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$5(country.countryRu.split(" ")), _to_consumable_array$5(country.countryEn.split(" ")), [
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$4(arr) {
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$O(obj, key, value) {
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$4(iter) {
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$4() {
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$O(target, key, source[key]);
3956
+ _define_property$P(target, key, source[key]);
3939
3957
  });
3940
3958
  }
3941
3959
  return target;
3942
3960
  }
3943
- function _to_consumable_array$4(arr) {
3944
- return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$o(arr) || _non_iterable_spread$4();
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$4(shouldRenderInBody ? [
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$4(modifiers))
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$N(obj, key, value) {
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$N(target, key, source[key]);
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$M(obj, key, value) {
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$M(target, key, source[key]);
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$L(obj, key, value) {
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$L(target, key, source[key]);
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$K(obj, key, value) {
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$K(target, key, source[key]);
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$K(_obj, classes.disabledItem, item.disabled), _define_property$K(_obj, classes.withIconGap, item.withIconGap), _obj))
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$J(obj, key, value) {
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$J(target, key, source[key]);
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$I(obj, key, value) {
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$I(target, key, source[key]);
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$H(obj, key, value) {
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$H(target, key, source[key]);
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$G(obj, key, value) {
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$G(target, key, source[key]);
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$G({}, classes.currentColor, useCurrentColor))
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$F(obj, key, value) {
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$F(target, key, source[key]);
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$F(_obj, classes.disabled, isDisabled), _define_property$F(_obj, classes.fullWidth, isFullWidth), _define_property$F(_obj, classes.inline, isInline), _define_property$F(_obj, classes.active, isActive), _define_property$F(_obj, classes.loading, isLoading), _define_property$F(_obj, classes.onlyIcon, hasIcon && !hasChildren), _obj)),
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$F(_obj1, classes.iconFromRight, hasChildren && hasIcon && iconPosition === "right"), _define_property$F(_obj1, classes.iconFromLeft, hasChildren && hasIcon && iconPosition === "left"), _obj1)),
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$E(obj, key, value) {
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$E(target, key, source[key]);
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$E(_obj, classes.disabled, isDisabled), _define_property$E(_obj, classes.labelPositionLeft, labelPosition === "left"), _obj))
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$D(obj, key, value) {
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$D(target, key, source[key]);
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$C(obj, key, value) {
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$C(target, key, source[key]);
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$B(obj, key, value) {
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$B(target, key, source[key]);
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$B(_obj, classes.withFloatingLabel, hasFloatingLabel && hasLabel), _define_property$B(_obj, classes.withIcons, hasControls), _define_property$B(_obj, classes.withControls, hasControls), _define_property$B(_obj, classes.floatingLabelWithoutPadding, hasFloatingLabel && hasLabel && border === "bottom"), _obj)),
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$B(_obj1, classes.required, isRequired && !hasRequiredLabel), _define_property$B(_obj1, classes.invalid, isInvalid), _define_property$B(_obj1, classes.focused, hasFocus), _define_property$B(_obj1, classes.disabled, isDisabled), _define_property$B(_obj1, classes.autosize, isAutoSizeable), _obj1), inlineStyle !== void 0 && classes[inlineStyle], border !== void 0 && classes["border-".concat(border)]),
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$B(_obj2, classes.invalidLabel, isInvalid), _define_property$B(_obj2, classes.requiredLabel, hasRequiredLabel && !isRequired), _define_property$B(_obj2, classes.activeLabel, hasFocus && !isReadonly || hasValue), _define_property$B(_obj2, classes.floating, hasFloatingLabel), // Обсуждаемо, сделал так, потому что не хочется создавать новую пропсу, на каждый чих в стилях
7221
- _define_property$B(_obj2, classes.floatingWithoutPadding, hasFloatingLabel && border === "bottom"), _obj2)),
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
- (hasValue || isFocused && !hasPlaceholder) && hasUnits && /* @__PURE__ */ jsxs("div", {
7225
- className: clsx(classes.unitsWrapper, _define_property$B({}, classes.withFloatingLabel, hasFloatingLabel && hasLabel)),
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$B({}, classes.activeIcon, !isDisabled && onIconClick !== void 0)),
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$A(obj, key, value) {
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$A(target, key, source[key]);
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$z(obj, key, value) {
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$z(target, key, source[key]);
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$z(_assert_this_initialized(_this), "node", createRef());
7604
- _define_property$z(_assert_this_initialized(_this), "handleScrollIntoViewIfNeeded", function() {
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$z(ScrollIntoViewIfNeeded, "defaultProps", ScrollIntoViewIfNeededDefaultProps);
7655
- function _define_property$y(obj, key, value) {
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$y(target, key, source[key]);
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
- function _define_property$x(obj, key, value) {
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$x(target, key, source[key]);
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 DEFAULT_OPTION_INDEX = -1;
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, onOptionClick = param.onOptionClick, convertValueToString = param.convertValueToString, convertValueToReactNode = param.convertValueToReactNode, _param_convertValueToId = param.convertValueToId, convertValueToId = _param_convertValueToId === void 0 ? convertValueToString : _param_convertValueToId;
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, 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 activeValueId = isNotEmpty(activeValue) ? convertValueToId(activeValue) : void 0;
7800
- var isActiveOption = function(item) {
7801
- return convertValueToId(item) === activeValueId;
7802
- };
7803
- var convertFunction = convertValueToReactNode !== null && convertValueToReactNode !== void 0 ? convertValueToReactNode : convertValueToString;
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 convertFunction(opt, optionsDisableMap[i]);
7899
+ return convertValueToReactNode(opt, optionsDisableMap[i]);
7815
7900
  });
7816
7901
  }, [
7817
7902
  options,
7818
- convertFunction,
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 !== void 0 && /* @__PURE__ */ jsx(ScrollIntoViewIfNeeded, {
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 onOptionClick(DEFAULT_OPTION_INDEX, event);
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 && selectedOptionsCount < options.length,
7940
+ isActive: selectedOptionsCount === options.length,
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 = i === focusedIndex;
7948
+ var isFocused = focusedIndex === i;
7851
7949
  var isActive = isActiveOption(optionValue);
7852
7950
  var isDisabled = optionsDisableMap[i];
7853
- var _obj;
7854
- return /* @__PURE__ */ jsx(ScrollIntoViewIfNeeded, _object_spread_props$q(_object_spread$w({
7855
- active: isFocused,
7856
- options: {
7857
- block: "nearest"
7858
- },
7859
- className: clsx(classes.cell, (_obj = {}, _define_property$x(_obj, classes.focused, isFocused), _define_property$x(_obj, classes.active, isActive), _define_property$x(_obj, classes.disabled, isDisabled), _obj))
7860
- }, addDataAttributes({
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
- }), i);
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 getActiveValueIndex = function(options, value, convertFunc) {
7892
- return isNotEmpty(value) ? options.findIndex(function(o) {
7893
- return convertFunc(o) === convertFunc(value);
7894
- }) : -1;
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: {
@@ -7941,6 +8035,21 @@ var styles$u = {
7941
8035
  input: {
7942
8036
  paddingRight: 32
7943
8037
  },
8038
+ withUnits: {
8039
+ paddingRight: 8
8040
+ },
8041
+ unitsWrapper: {
8042
+ position: "unset",
8043
+ padding: [
8044
+ 0,
8045
+ 32,
8046
+ 0,
8047
+ 0
8048
+ ]
8049
+ },
8050
+ fakeValue: {
8051
+ display: "none"
8052
+ },
7944
8053
  disabled: {
7945
8054
  "& $input": {
7946
8055
  cursor: "default"
@@ -8125,6 +8234,10 @@ function _array_with_holes$j(arr) {
8125
8234
  if (Array.isArray(arr))
8126
8235
  return arr;
8127
8236
  }
8237
+ function _array_without_holes$4(arr) {
8238
+ if (Array.isArray(arr))
8239
+ return _array_like_to_array$j(arr);
8240
+ }
8128
8241
  function asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, key, arg) {
8129
8242
  try {
8130
8243
  var info = gen[key](arg);
@@ -8167,6 +8280,10 @@ function _define_property$v(obj, key, value) {
8167
8280
  }
8168
8281
  return obj;
8169
8282
  }
8283
+ function _iterable_to_array$4(iter) {
8284
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
8285
+ return Array.from(iter);
8286
+ }
8170
8287
  function _iterable_to_array_limit$j(arr, i) {
8171
8288
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
8172
8289
  if (_i == null)
@@ -8198,6 +8315,9 @@ function _iterable_to_array_limit$j(arr, i) {
8198
8315
  function _non_iterable_rest$j() {
8199
8316
  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
8317
  }
8318
+ function _non_iterable_spread$4() {
8319
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
8320
+ }
8201
8321
  function _object_spread$u(target) {
8202
8322
  for (var i = 1; i < arguments.length; i++) {
8203
8323
  var source = arguments[i] != null ? arguments[i] : {};
@@ -8272,6 +8392,9 @@ function _object_without_properties_loose$5(source, excluded) {
8272
8392
  function _sliced_to_array$j(arr, i) {
8273
8393
  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
8394
  }
8395
+ function _to_consumable_array$4(arr) {
8396
+ return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$j(arr) || _non_iterable_spread$4();
8397
+ }
8275
8398
  function _unsupported_iterable_to_array$j(o, minLen) {
8276
8399
  if (!o)
8277
8400
  return;
@@ -8387,11 +8510,12 @@ var __generator$4 = globalThis && globalThis.__generator || function(thisArg, bo
8387
8510
  };
8388
8511
  }
8389
8512
  };
8390
- function Select(_param) {
8391
- var options = _param.options, value = _param.value, defaultOptionLabel = _param.defaultOptionLabel, _param_debounceTime = _param.debounceTime, debounceTime = _param_debounceTime === void 0 ? 400 : _param_debounceTime, _param_optionsMode = _param.optionsMode, optionsMode = _param_optionsMode === void 0 ? "normal" : _param_optionsMode, noMatchesLabel = _param.noMatchesLabel, loadingLabel = _param.loadingLabel, tweakStyles = _param.tweakStyles, testId = _param.testId, isReadonly = _param.isReadonly, isDisabled = _param.isDisabled, dropdownOptions = _param.dropdownOptions, _param_minSymbolsCountToOpenList = _param.minSymbolsCountToOpenList, minSymbolsCountToOpenList = _param_minSymbolsCountToOpenList === void 0 ? 0 : _param_minSymbolsCountToOpenList, _param_dropdownIcon = _param.dropdownIcon, dropdownIcon = _param_dropdownIcon === void 0 ? "chevron-down" : _param_dropdownIcon, _param_shouldScrollToList = _param.shouldScrollToList, shouldScrollToList = _param_shouldScrollToList === void 0 ? true : _param_shouldScrollToList, searchInput = _param.searchInput, onChange = _param.onChange, onFocus = _param.onFocus, onBlur = _param.onBlur, onType = _param.onType, onOpen = _param.onOpen, _param_isOptionDisabled = _param.isOptionDisabled, isOptionDisabled = _param_isOptionDisabled === void 0 ? defaultIsOptionDisabled : _param_isOptionDisabled, _param_compareValuesOnChange = _param.compareValuesOnChange, compareValuesOnChange = _param_compareValuesOnChange === void 0 ? defaultCompareFunction : _param_compareValuesOnChange, _param_convertValueToString = _param.convertValueToString, convertValueToString = _param_convertValueToString === void 0 ? defaultConvertFunction$2 : _param_convertValueToString, convertValueToId = _param.convertValueToId, convertValueToReactNode = _param.convertValueToReactNode, optionsFilter = _param.optionsFilter, inputProps = _object_without_properties$5(_param, [
8513
+ function Select(props) {
8514
+ 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, units = props.units, 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
8515
  "options",
8393
8516
  "value",
8394
8517
  "defaultOptionLabel",
8518
+ "allOptionsLabel",
8395
8519
  "debounceTime",
8396
8520
  "optionsMode",
8397
8521
  "noMatchesLabel",
@@ -8405,6 +8529,7 @@ function Select(_param) {
8405
8529
  "dropdownIcon",
8406
8530
  "shouldScrollToList",
8407
8531
  "searchInput",
8532
+ "units",
8408
8533
  "onChange",
8409
8534
  "onFocus",
8410
8535
  "onBlur",
@@ -8421,8 +8546,8 @@ function Select(_param) {
8421
8546
  var isMounted = useIsMounted();
8422
8547
  var _useState = _sliced_to_array$j(useState(false), 2), isListOpen = _useState[0], setIsListOpen = _useState[1];
8423
8548
  var _useState1 = _sliced_to_array$j(useState(false), 2), areOptionsLoading = _useState1[0], setAreOptionsLoading = _useState1[1];
8424
- var hasDefaultOption = defaultOptionLabel !== void 0;
8425
- var _useState2 = _sliced_to_array$j(useState(-1), 2), focusedListCellIndex = _useState2[0], setFocusedListCellIndex = _useState2[1];
8549
+ var hasDefaultOption = isStringNotEmpty(defaultOptionLabel);
8550
+ var _useState2 = _sliced_to_array$j(useState(DEFAULT_OPTION_INDEX), 2), focusedListCellIndex = _useState2[0], setFocusedListCellIndex = _useState2[1];
8426
8551
  var _useState3 = _sliced_to_array$j(useState(""), 2), searchValue = _useState3[0], setSearchValue = _useState3[1];
8427
8552
  var _useState4 = _sliced_to_array$j(useState(true), 2), shouldShowDefaultOption = _useState4[0], setShouldShowDefaultOption = _useState4[1];
8428
8553
  var inputWrapper = useRef(null);
@@ -8430,31 +8555,50 @@ function Select(_param) {
8430
8555
  var input = useRef(null);
8431
8556
  var shouldRenderSearchInputInList = (searchInput === null || searchInput === void 0 ? void 0 : searchInput.shouldRenderInList) === true;
8432
8557
  var hasSearchInputInList = optionsMode !== "normal" && shouldRenderSearchInputInList;
8433
- var stringValue = isNotEmpty(value) ? convertValueToString(value) : void 0;
8558
+ var isMultiSelect = isMultiSelectValue(props);
8559
+ var strValue = isMultiSelect ? value === null || value === void 0 ? void 0 : value[0] : value;
8560
+ var shouldShowAllOption = isMultiSelect && isNotEmpty(allOptionsLabel) && searchValue === "";
8434
8561
  var filteredOptions = useMemo(function() {
8435
8562
  if (optionsMode !== "search") {
8436
8563
  return options;
8437
8564
  }
8438
- if (isNotEmpty(optionsFilter)) {
8439
- return optionsFilter(options, searchValue);
8440
- }
8441
- var lowerCaseValue = searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase();
8442
- return options.filter(function(option) {
8443
- var convertedOption = convertValueToString(option);
8444
- return convertedOption !== void 0 && convertedOption.toLowerCase().includes(lowerCaseValue);
8565
+ var _convertValueToString;
8566
+ var filter = optionsFilter !== null && optionsFilter !== void 0 ? optionsFilter : createFilter(function(option) {
8567
+ return [
8568
+ (_convertValueToString = convertValueToString(option)) !== null && _convertValueToString !== void 0 ? _convertValueToString : ""
8569
+ ];
8445
8570
  });
8571
+ return filter(options, searchValue);
8446
8572
  }, [
8447
- optionsMode,
8448
8573
  optionsFilter,
8449
8574
  options,
8450
8575
  convertValueToString,
8451
- searchValue
8576
+ searchValue,
8577
+ optionsMode
8452
8578
  ]);
8453
- useEffect(function() {
8454
- setFocusedListCellIndex(getActiveValueIndex(filteredOptions, value, convertValueToString));
8579
+ var optionsIndexesForNavigation = useMemo(function() {
8580
+ var result = [];
8581
+ if (shouldShowDefaultOption && hasDefaultOption) {
8582
+ result.push(DEFAULT_OPTION_INDEX);
8583
+ }
8584
+ if (shouldShowAllOption) {
8585
+ result.push(ALL_OPTION_INDEX);
8586
+ }
8587
+ return result.concat(filteredOptions.reduce(function(acc, cur, i) {
8588
+ if (!isOptionDisabled(cur)) {
8589
+ acc.push(i);
8590
+ }
8591
+ return acc;
8592
+ }, []));
8455
8593
  }, [
8456
- filteredOptions,
8457
- value,
8594
+ filteredOptions
8595
+ ]);
8596
+ var stringValue = isNotEmpty(strValue) ? convertValueToString(strValue) : void 0;
8597
+ var showedStringValue = isMultiSelect && (value === null || value === void 0 ? void 0 : value.length) === filteredOptions.length && isNotEmpty(allOptionsLabel) ? allOptionsLabel : stringValue;
8598
+ var convertToId = useCallback(function(v) {
8599
+ return (convertValueToId !== null && convertValueToId !== void 0 ? convertValueToId : getDefaultConvertToIdFunction(convertValueToString))(v);
8600
+ }, [
8601
+ convertValueToId,
8458
8602
  convertValueToString
8459
8603
  ]);
8460
8604
  var handleListClose = useCallback(function(event) {
@@ -8491,11 +8635,9 @@ function Select(_param) {
8491
8635
  }
8492
8636
  };
8493
8637
  var handleOnChange = useCallback(function(newValue) {
8494
- var areValuesEqual = compareValuesOnChange(value, newValue);
8495
- if (areValuesEqual) {
8496
- return;
8638
+ if (!compareValuesOnChange(value, newValue)) {
8639
+ onChange(newValue);
8497
8640
  }
8498
- onChange(newValue);
8499
8641
  }, [
8500
8642
  value,
8501
8643
  compareValuesOnChange,
@@ -8503,7 +8645,7 @@ function Select(_param) {
8503
8645
  ]);
8504
8646
  var handleOptionSelect = useCallback(function(index, event) {
8505
8647
  var _input_current;
8506
- handleOnChange(index === -1 ? void 0 : filteredOptions[index]);
8648
+ handleOnChange(index === DEFAULT_OPTION_INDEX ? void 0 : filteredOptions[index]);
8507
8649
  handleListClose(event);
8508
8650
  (_input_current = input.current) === null || _input_current === void 0 ? void 0 : _input_current.blur();
8509
8651
  }, [
@@ -8511,6 +8653,36 @@ function Select(_param) {
8511
8653
  handleListClose,
8512
8654
  filteredOptions
8513
8655
  ]);
8656
+ var handleToggleOptionCheckbox = useCallback(function(index, isSelected) {
8657
+ if (!isMultiSelect) {
8658
+ return;
8659
+ }
8660
+ if (index === DEFAULT_OPTION_INDEX || index === ALL_OPTION_INDEX && !isSelected) {
8661
+ handleOnChange(void 0);
8662
+ return;
8663
+ }
8664
+ if (index === ALL_OPTION_INDEX && isSelected) {
8665
+ handleOnChange(options);
8666
+ return;
8667
+ }
8668
+ var option = filteredOptions[index];
8669
+ handleOnChange(isSelected ? (
8670
+ // Добавляем
8671
+ _to_consumable_array$4(value !== null && value !== void 0 ? value : []).concat([
8672
+ option
8673
+ ])
8674
+ ) : (
8675
+ // Убираем
8676
+ value === null || value === void 0 ? void 0 : value.filter(function(o) {
8677
+ return convertToId(o) !== convertToId(option);
8678
+ })
8679
+ ));
8680
+ }, [
8681
+ handleOnChange,
8682
+ filteredOptions,
8683
+ isMultiSelect,
8684
+ value
8685
+ ]);
8514
8686
  var handleOnType = useCallback(function() {
8515
8687
  var _ref2 = _async_to_generator$4(function(v) {
8516
8688
  return __generator$4(this, function(_state) {
@@ -8570,47 +8742,43 @@ function Select(_param) {
8570
8742
  return;
8571
8743
  }
8572
8744
  event.stopPropagation();
8745
+ var curIndexInNavigation = optionsIndexesForNavigation.findIndex(function(index) {
8746
+ return index === focusedListCellIndex;
8747
+ });
8573
8748
  switch (event.code) {
8574
8749
  case "Enter":
8575
8750
  case "NumpadEnter": {
8576
- var indexToClick = focusedListCellIndex;
8577
- if (indexToClick === -1 && filteredOptions.length === 1) {
8578
- indexToClick = 0;
8751
+ var indexToSelect = focusedListCellIndex;
8752
+ if (indexToSelect === DEFAULT_OPTION_INDEX && filteredOptions.length === 1) {
8753
+ indexToSelect = 0;
8754
+ }
8755
+ if (isMultiSelect) {
8756
+ var isThisValueAlreadySelected;
8757
+ if (indexToSelect === ALL_OPTION_INDEX) {
8758
+ isThisValueAlreadySelected = (value === null || value === void 0 ? void 0 : value.length) === options.length;
8759
+ } else {
8760
+ var valueIdToSelect = convertToId(filteredOptions[indexToSelect]);
8761
+ var _value_some;
8762
+ isThisValueAlreadySelected = (_value_some = value === null || value === void 0 ? void 0 : value.some(function(opt) {
8763
+ return convertToId(opt) === valueIdToSelect;
8764
+ })) !== null && _value_some !== void 0 ? _value_some : false;
8765
+ }
8766
+ handleToggleOptionCheckbox(indexToSelect, !isThisValueAlreadySelected);
8767
+ } else {
8768
+ handleOptionSelect(indexToSelect, event);
8579
8769
  }
8580
- handleOptionSelect(indexToClick, event);
8581
8770
  break;
8582
8771
  }
8583
8772
  case "ArrowDown": {
8584
8773
  event.preventDefault();
8585
- var newIndex = focusedListCellIndex !== null && focusedListCellIndex !== void 0 ? focusedListCellIndex : -1;
8586
- for (var i = newIndex; i < newIndex + filteredOptions.length; i++) {
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);
8774
+ var targetIndexInNavigation = (curIndexInNavigation + 1) % optionsIndexesForNavigation.length;
8775
+ setFocusedListCellIndex(optionsIndexesForNavigation[targetIndexInNavigation]);
8598
8776
  break;
8599
8777
  }
8600
8778
  case "ArrowUp": {
8601
8779
  event.preventDefault();
8602
- var newIndex1 = (focusedListCellIndex !== null && focusedListCellIndex !== void 0 ? focusedListCellIndex : -1) === -1 ? 0 : focusedListCellIndex;
8603
- for (var i1 = newIndex1; i1 > newIndex1 - filteredOptions.length; i1--) {
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
- }
8780
+ var targetIndexInNavigation1 = (curIndexInNavigation - 1 + optionsIndexesForNavigation.length) % optionsIndexesForNavigation.length;
8781
+ setFocusedListCellIndex(optionsIndexesForNavigation[targetIndexInNavigation1]);
8614
8782
  break;
8615
8783
  }
8616
8784
  }
@@ -8662,12 +8830,16 @@ function Select(_param) {
8662
8830
  ]
8663
8831
  });
8664
8832
  useEffect(function() {
8665
- if (isOpen && onOpen !== void 0) {
8666
- onOpen();
8833
+ var val = isMultiSelect ? value === null || value === void 0 ? void 0 : value[0] : value;
8834
+ var _optionsIndexesForNavigation_find;
8835
+ setFocusedListCellIndex((_optionsIndexesForNavigation_find = optionsIndexesForNavigation.find(function(index) {
8836
+ return filteredOptions[index] === val;
8837
+ })) !== null && _optionsIndexesForNavigation_find !== void 0 ? _optionsIndexesForNavigation_find : optionsIndexesForNavigation[0]);
8838
+ if (isOpen) {
8839
+ onOpen === null || onOpen === void 0 ? void 0 : onOpen();
8667
8840
  }
8668
8841
  }, [
8669
- isOpen,
8670
- onOpen
8842
+ isOpen
8671
8843
  ]);
8672
8844
  var _obj;
8673
8845
  var listEl = /* @__PURE__ */ jsx("div", _object_spread_props$o(_object_spread$u({
@@ -8679,6 +8851,7 @@ function Select(_param) {
8679
8851
  children: isOpen && /* @__PURE__ */ jsx(SelectList, {
8680
8852
  options: filteredOptions,
8681
8853
  defaultOptionLabel: hasDefaultOption && shouldShowDefaultOption ? defaultOptionLabel : void 0,
8854
+ allOptionsLabel: shouldShowAllOption ? allOptionsLabel : void 0,
8682
8855
  customListHeader: hasSearchInputInList ? /* @__PURE__ */ jsx(SearchInput, _object_spread$u({
8683
8856
  value: searchValue,
8684
8857
  onChange: handleInputChange,
@@ -8696,8 +8869,9 @@ function Select(_param) {
8696
8869
  isOptionDisabled,
8697
8870
  convertValueToString,
8698
8871
  convertValueToReactNode,
8699
- convertValueToId,
8700
- onOptionClick: handleOptionSelect
8872
+ convertValueToId: convertToId,
8873
+ onOptionSelect: handleOptionSelect,
8874
+ onToggleCheckbox: isMultiSelect ? handleToggleOptionCheckbox : void 0
8701
8875
  })
8702
8876
  }));
8703
8877
  return /* @__PURE__ */ jsxs("div", {
@@ -8710,7 +8884,7 @@ function Select(_param) {
8710
8884
  ref: inputWrapper,
8711
8885
  children: [
8712
8886
  /* @__PURE__ */ jsx(Input, _object_spread$u({
8713
- value: searchValue !== "" && !shouldRenderSearchInputInList ? searchValue : stringValue,
8887
+ value: searchValue !== "" && !shouldRenderSearchInputInList ? searchValue : showedStringValue,
8714
8888
  onChange: handleInputChange,
8715
8889
  isActive: isListOpen,
8716
8890
  isReadonly: hasReadonlyInput,
@@ -8720,7 +8894,8 @@ function Select(_param) {
8720
8894
  ref: input,
8721
8895
  isLoading: areOptionsLoading,
8722
8896
  tweakStyles: tweakInputStyles,
8723
- testId
8897
+ testId,
8898
+ units: isMultiSelect && isNotEmpty(value) && value.length > 1 && value.length !== options.length ? "(+".concat(value.length - 1, ")") : units
8724
8899
  }, inputProps)),
8725
8900
  /* @__PURE__ */ jsx("div", {
8726
8901
  onMouseDown: function(event) {
@@ -27899,6 +28074,7 @@ export {
27899
28074
  checkElementParentsClassNames,
27900
28075
  checkSearchStringInCountry,
27901
28076
  commonTheme,
28077
+ createFilter,
27902
28078
  defaultConvertFunction$1 as defaultConvertFunction,
27903
28079
  findCountryByCode,
27904
28080
  findCountryIndexByCode,
@@ -27923,6 +28099,7 @@ export {
27923
28099
  isInt,
27924
28100
  isNotEmpty,
27925
28101
  isSpaceChar,
28102
+ isStringNotEmpty,
27926
28103
  minWidthModifier,
27927
28104
  phoneInfo,
27928
28105
  removeStringFormat,