@true-engineering/true-react-common-ui-kit 3.24.1 → 3.25.1

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 (100) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +21 -0
  3. package/dist/components/Select/CustomSelect.stories.d.ts +1 -1
  4. package/dist/components/Select/MultiSelect.stories.d.ts +2 -2
  5. package/dist/components/Select/Select.d.ts +14 -9
  6. package/dist/components/Select/Select.styles.d.ts +5 -5
  7. package/dist/components/Select/components/SelectList/SelectList.d.ts +7 -6
  8. package/dist/components/Select/components/SelectList/SelectList.styles.d.ts +1 -1
  9. package/dist/components/Select/components/SelectListItem/SelectListItem.d.ts +4 -3
  10. package/dist/components/Select/helpers.d.ts +0 -3
  11. package/dist/true-react-common-ui-kit.js +176 -142
  12. package/dist/true-react-common-ui-kit.js.map +1 -1
  13. package/dist/true-react-common-ui-kit.umd.cjs +175 -141
  14. package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
  15. package/package.json +1 -1
  16. package/src/components/AccountInfo/AccountInfo.stories.tsx +32 -32
  17. package/src/components/AccountInfo/AccountInfo.tsx +80 -80
  18. package/src/components/AddButton/AddButton.stories.tsx +21 -21
  19. package/src/components/AddButton/AddButton.tsx +52 -52
  20. package/src/components/Button/Button.tsx +129 -129
  21. package/src/components/Colors/Colors.stories.tsx +7 -7
  22. package/src/components/DateInput/DateInput.tsx +90 -90
  23. package/src/components/DateInput/constants.ts +2 -2
  24. package/src/components/Description/Description.stories.tsx +27 -27
  25. package/src/components/Description/Description.tsx +61 -61
  26. package/src/components/FiltersPane/components/FilterValueView/FilterValueView.tsx +166 -166
  27. package/src/components/FiltersPane/components/FilterWithDates/FilterWithDates.tsx +210 -210
  28. package/src/components/FiltersPane/components/FilterWithPeriod/FilterWithPeriod.tsx +177 -177
  29. package/src/components/Flag/Flag.stories.tsx +29 -29
  30. package/src/components/Flag/Flag.tsx +26 -26
  31. package/src/components/Flag/augment.d.ts +1 -1
  32. package/src/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.styles.ts +38 -38
  33. package/src/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.styles.ts +25 -25
  34. package/src/components/FlexibleTable/helpers.ts +13 -13
  35. package/src/components/Icon/Icon.stories.tsx +86 -86
  36. package/src/components/Icon/complexIcons/augment.d.ts +1 -1
  37. package/src/components/Icon/complexIcons/avatarGreen.svg +57 -57
  38. package/src/components/Icon/complexIcons/index.ts +1 -1
  39. package/src/components/IncrementInput/IncrementInput.tsx +105 -105
  40. package/src/components/Input/Input.tsx +297 -297
  41. package/src/components/Input/types.ts +32 -32
  42. package/src/components/List/List.stories.tsx +70 -70
  43. package/src/components/List/List.tsx +33 -33
  44. package/src/components/List/components/ListItem/ListItem.tsx +57 -57
  45. package/src/components/Modal/Modal.stories.tsx +105 -105
  46. package/src/components/MultiSelect/MultiSelect.stories.tsx +46 -46
  47. package/src/components/MultiSelect/MultiSelect.tsx +106 -106
  48. package/src/components/MultiSelect/components/MultiSelectInput/MultiSelectInput.tsx +53 -53
  49. package/src/components/Notification/Notification.stories.tsx +46 -46
  50. package/src/components/Notification/Notification.tsx +69 -69
  51. package/src/components/NumberInput/NumberInput.tsx +137 -137
  52. package/src/components/NumberInput/helpers.ts +4 -6
  53. package/src/components/NumberInput/index.ts +1 -1
  54. package/src/components/PhoneInput/PhoneInput.tsx +214 -214
  55. package/src/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.tsx +155 -155
  56. package/src/components/PhoneInput/types.ts +16 -16
  57. package/src/components/RadioButton/RadioButton.stories.tsx +46 -46
  58. package/src/components/RadioButton/RadioButton.tsx +57 -57
  59. package/src/components/ScrollIntoViewIfNeeded/index.ts +1 -1
  60. package/src/components/Select/CustomSelect.stories.tsx +52 -16
  61. package/src/components/Select/MultiSelect.stories.tsx +3 -3
  62. package/src/components/Select/Select.stories.tsx +235 -235
  63. package/src/components/Select/Select.styles.ts +8 -7
  64. package/src/components/Select/Select.tsx +106 -62
  65. package/src/components/Select/components/SelectList/SelectList.styles.ts +6 -4
  66. package/src/components/Select/components/SelectList/SelectList.tsx +25 -29
  67. package/src/components/Select/components/SelectListItem/SelectListItem.tsx +23 -19
  68. package/src/components/Select/constants.ts +2 -2
  69. package/src/components/Select/helpers.ts +0 -7
  70. package/src/components/Select/types.ts +1 -1
  71. package/src/components/Selector/Selector.stories.tsx +62 -62
  72. package/src/components/Selector/Selector.tsx +115 -115
  73. package/src/components/Selector/index.ts +2 -2
  74. package/src/components/Selector/types.ts +12 -12
  75. package/src/components/Skeleton/Skeleton.stories.tsx +19 -19
  76. package/src/components/SmartInput/SmartInput.tsx +134 -134
  77. package/src/components/Status/Status.stories.tsx +73 -73
  78. package/src/components/Status/Status.styles.ts +143 -143
  79. package/src/components/Status/Status.tsx +49 -49
  80. package/src/components/Status/constants.ts +11 -11
  81. package/src/components/Status/index.ts +3 -3
  82. package/src/components/Status/types.ts +5 -5
  83. package/src/components/Switch/Switch.stories.tsx +40 -40
  84. package/src/components/Switch/Switch.tsx +75 -75
  85. package/src/components/TextWithInfo/TextWithInfo.stories.tsx +53 -53
  86. package/src/components/TextWithInfo/TextWithInfo.tsx +62 -62
  87. package/src/components/TextWithTooltip/TextWithTooltip.stories.tsx +58 -58
  88. package/src/components/TextWithTooltip/TextWithTooltip.tsx +2 -3
  89. package/src/components/ThemedPreloader/ThemedPreloader.stories.tsx +41 -41
  90. package/src/components/ThemedPreloader/ThemedPreloader.tsx +54 -54
  91. package/src/components/ThemedPreloader/components/DefaultPreloader/index.ts +1 -1
  92. package/src/components/Toaster/Toaster.stories.tsx +30 -30
  93. package/src/components/Tooltip/Tooltip.stories.tsx +19 -19
  94. package/src/components/Tooltip/Tooltip.tsx +35 -35
  95. package/src/components/Tooltip/types.ts +1 -1
  96. package/src/helpers/popper-helpers.ts +17 -17
  97. package/src/hooks/use-dropdown.ts +84 -84
  98. package/src/hooks/use-is-mounted.ts +15 -15
  99. package/src/theme/helpers.ts +76 -76
  100. package/src/vite-env.d.ts +1 -1
@@ -6656,63 +6656,63 @@
6656
6656
  return trueReactPlatformHelpers.mergeRefs(refs);
6657
6657
  }, refs);
6658
6658
  };
6659
- const avatarGreen = ` <svg\r
6660
- width="100%"\r
6661
- height="100%"\r
6662
- viewBox="0 0 32 32"\r
6663
- fill="none"\r
6664
- xmlns="http://www.w3.org/2000/svg"\r
6665
- >\r
6666
- <circle opacity="0.5" cx="16" cy="16" r="16" fill="#DDE3ED" />\r
6667
- <mask\r
6668
- id="mask0_0_12744"\r
6669
- style="mask-type: 'alpha';"\r
6670
- maskUnits="userSpaceOnUse"\r
6671
- x="0"\r
6672
- y="0"\r
6673
- width="32"\r
6674
- height="32"\r
6675
- >\r
6676
- <circle cx="16" cy="16" r="16" fill="white" />\r
6677
- </mask>\r
6678
- <g mask="url(#mask0_0_12744)">\r
6679
- <circle cx="16" cy="29" r="13" fill="url(#paint0_linear_0_12744)" />\r
6680
- <mask\r
6681
- id="mask1_0_12744"\r
6682
- style="mask-type: 'alpha';"\r
6683
- maskUnits="userSpaceOnUse"\r
6684
- x="3"\r
6685
- y="16"\r
6686
- width="26"\r
6687
- height="26"\r
6688
- >\r
6689
- <circle cx="16" cy="29" r="13" fill="white" />\r
6690
- </mask>\r
6691
- <g mask="url(#mask1_0_12744)">\r
6692
- <ellipse\r
6693
- cx="16"\r
6694
- cy="17.5"\r
6695
- rx="6"\r
6696
- ry="7.5"\r
6697
- fill="#505F79"\r
6698
- fill-opacity="0.204983"\r
6699
- />\r
6700
- </g>\r
6701
- </g>\r
6702
- <ellipse cx="16" cy="13" rx="6" ry="7" fill="white" />\r
6703
- <defs>\r
6704
- <linearGradient\r
6705
- id="paint0_linear_0_12744"\r
6706
- x1="13.347"\r
6707
- y1="46.279"\r
6708
- x2="33.5318"\r
6709
- y2="30.8088"\r
6710
- gradientUnits="userSpaceOnUse"\r
6711
- >\r
6712
- <stop stop-color="#ABD229" />\r
6713
- <stop offset="1" stop-color="#9CD03F" />\r
6714
- </linearGradient>\r
6715
- </defs>\r
6659
+ const avatarGreen = ` <svg
6660
+ width="100%"
6661
+ height="100%"
6662
+ viewBox="0 0 32 32"
6663
+ fill="none"
6664
+ xmlns="http://www.w3.org/2000/svg"
6665
+ >
6666
+ <circle opacity="0.5" cx="16" cy="16" r="16" fill="#DDE3ED" />
6667
+ <mask
6668
+ id="mask0_0_12744"
6669
+ style="mask-type: 'alpha';"
6670
+ maskUnits="userSpaceOnUse"
6671
+ x="0"
6672
+ y="0"
6673
+ width="32"
6674
+ height="32"
6675
+ >
6676
+ <circle cx="16" cy="16" r="16" fill="white" />
6677
+ </mask>
6678
+ <g mask="url(#mask0_0_12744)">
6679
+ <circle cx="16" cy="29" r="13" fill="url(#paint0_linear_0_12744)" />
6680
+ <mask
6681
+ id="mask1_0_12744"
6682
+ style="mask-type: 'alpha';"
6683
+ maskUnits="userSpaceOnUse"
6684
+ x="3"
6685
+ y="16"
6686
+ width="26"
6687
+ height="26"
6688
+ >
6689
+ <circle cx="16" cy="29" r="13" fill="white" />
6690
+ </mask>
6691
+ <g mask="url(#mask1_0_12744)">
6692
+ <ellipse
6693
+ cx="16"
6694
+ cy="17.5"
6695
+ rx="6"
6696
+ ry="7.5"
6697
+ fill="#505F79"
6698
+ fill-opacity="0.204983"
6699
+ />
6700
+ </g>
6701
+ </g>
6702
+ <ellipse cx="16" cy="13" rx="6" ry="7" fill="white" />
6703
+ <defs>
6704
+ <linearGradient
6705
+ id="paint0_linear_0_12744"
6706
+ x1="13.347"
6707
+ y1="46.279"
6708
+ x2="33.5318"
6709
+ y2="30.8088"
6710
+ gradientUnits="userSpaceOnUse"
6711
+ >
6712
+ <stop stop-color="#ABD229" />
6713
+ <stop offset="1" stop-color="#9CD03F" />
6714
+ </linearGradient>
6715
+ </defs>
6716
6716
  </svg>`;
6717
6717
  const fileExcel = '<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 20 20" fill="none">\r\n <rect width="20" height="20" rx="4" fill="#21A366"/>\r\n <rect width="20" height="20" rx="4" fill="url(#paint0_linear_0_16081)" style="mix-blend-mode:overlay"/>\r\n <path d="M8.00342 14.5244L10.0728 11.3062L12.1357 14.5244H14.4019L11.2217 9.73828L14.1162 5.21875H11.939L10.1108 8.2085L8.24463 5.21875H6.04834L8.93018 9.66846L5.75 14.5244H8.00342Z" fill="white"/>\r\n <defs>\r\n <linearGradient id="paint0_linear_0_16081" x1="-9.95187" y1="9.95187" x2="9.95187" y2="29.8556" gradientUnits="userSpaceOnUse">\r\n <stop stop-color="white" stop-opacity="0.245559"/>\r\n <stop offset="1" stop-opacity="0.498578"/>\r\n </linearGradient>\r\n </defs>\r\n</svg>';
6718
6718
  const fileImage = '<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 20 20" fill="none">\r\n <rect width="20" height="20" rx="4" fill="#FF991F"/>\r\n <rect width="20" height="20" rx="4" fill="url(#paint0_linear_0_16103)" style="mix-blend-mode:overlay"/>\r\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.90113 15C3.09595 15 2.62093 14.097 3.07709 13.4335L6.67606 8.19861C7.07341 7.62064 7.9268 7.62065 8.32414 8.19861L13.0001 15H3.90113Z" fill="white"/>\r\n <path fill-rule="evenodd" clip-rule="evenodd" d="M9.53962 15L12.7076 10.2481C13.1034 9.65434 13.9758 9.65434 14.3717 10.2481L16.5031 13.4453C16.9462 14.1099 16.4698 15 15.6711 15H9.53962Z" fill="white"/>\r\n <path d="M16.0001 5.5C16.0001 6.32843 15.3285 7 14.5001 7C13.6717 7 13.0001 6.32843 13.0001 5.5C13.0001 4.67157 13.6717 4 14.5001 4C15.3285 4 16.0001 4.67157 16.0001 5.5Z" fill="white"/>\r\n <defs>\r\n <linearGradient id="paint0_linear_0_16103" x1="-9.95187" y1="9.95187" x2="9.95187" y2="29.8556" gradientUnits="userSpaceOnUse">\r\n <stop stop-color="white" stop-opacity="0.245559"/>\r\n <stop offset="1" stop-opacity="0.498578"/>\r\n </linearGradient>\r\n </defs>\r\n</svg>';
@@ -10607,15 +10607,11 @@
10607
10607
  withListHeader: {
10608
10608
  paddingTop: 0
10609
10609
  },
10610
- listHeader: {
10611
- "& + $list": {
10612
- borderTop: [
10613
- 1,
10614
- "solid",
10615
- colors.BORDER_LIGHT
10616
- ]
10617
- }
10610
+ withListFooter: {
10611
+ paddingBottom: 0
10618
10612
  },
10613
+ listHeader: {},
10614
+ listFooter: {},
10619
10615
  list: _object_spread$K({
10620
10616
  height: "100%",
10621
10617
  maxHeight: ROW_HEIGHT$1 * 6,
@@ -10712,8 +10708,18 @@
10712
10708
  return target;
10713
10709
  }
10714
10710
  var SelectListItem = function(param) {
10715
- 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;
10716
- var isMultiSelect = trueReactPlatformHelpers.isNotEmpty(onToggleCheckbox);
10711
+ var classes = param.classes, index = param.index, isSemiChecked = param.isSemiChecked, isDisabled = param.isDisabled, isActive = param.isActive, children = param.children, isFocused = param.isFocused, isMultiSelect = param.isMultiSelect, onOptionSelect = param.onOptionSelect, onToggleCheckbox = param.onToggleCheckbox;
10712
+ var multiSelectContent = isMultiSelect && /* @__PURE__ */ jsx(Checkbox, {
10713
+ isChecked: isActive || isSemiChecked,
10714
+ isSemiChecked,
10715
+ isDisabled,
10716
+ tweakStyles: checkboxStyles$1,
10717
+ onSelect: function(param2, event) {
10718
+ var isSelected = param2.isSelected;
10719
+ return onToggleCheckbox(index, isSelected, event);
10720
+ },
10721
+ children
10722
+ });
10717
10723
  var _obj2;
10718
10724
  return /* @__PURE__ */ jsx(ScrollIntoViewIfNeeded, _object_spread_props$E(_object_spread$J({
10719
10725
  active: isFocused,
@@ -10729,17 +10735,7 @@
10729
10735
  onClick: !isDisabled && !isMultiSelect ? function(event) {
10730
10736
  return onOptionSelect(index, event);
10731
10737
  } : void 0,
10732
- children: isMultiSelect ? /* @__PURE__ */ jsx(Checkbox, {
10733
- value: index,
10734
- isChecked: isActive || isSemiChecked,
10735
- isSemiChecked,
10736
- isDisabled,
10737
- tweakStyles: checkboxStyles$1,
10738
- onSelect: function(v, event) {
10739
- return onToggleCheckbox(index, v.isSelected, event);
10740
- },
10741
- children
10742
- }) : children
10738
+ children: isMultiSelect ? multiSelectContent : children
10743
10739
  }));
10744
10740
  };
10745
10741
  function _define_property$K(obj, key, value) {
@@ -10795,47 +10791,39 @@
10795
10791
  return target;
10796
10792
  }
10797
10793
  function SelectList(param) {
10798
- 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;
10794
+ 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, customListFooter = param.customListFooter, isMultiSelect = param.isMultiSelect, 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;
10799
10795
  var classes = useStyles$F({
10800
10796
  theme: tweakStyles
10801
10797
  });
10802
- var isMultiSelect = trueReactPlatformHelpers.isNotEmpty(onToggleCheckbox);
10803
- var multiSelectValue = activeValue;
10804
- var _multiSelectValue_length;
10805
- var selectedOptionsCount = (_multiSelectValue_length = multiSelectValue === null || multiSelectValue === void 0 ? void 0 : multiSelectValue.length) !== null && _multiSelectValue_length !== void 0 ? _multiSelectValue_length : 0;
10806
- var activeOptionsIdMap = React.useMemo(function() {
10807
- var _multiSelectValue_map;
10808
- return isMultiSelect ? (_multiSelectValue_map = multiSelectValue === null || multiSelectValue === void 0 ? void 0 : multiSelectValue.map(convertValueToId)) !== null && _multiSelectValue_map !== void 0 ? _multiSelectValue_map : [] : [];
10809
- }, [
10810
- isMultiSelect,
10811
- multiSelectValue,
10812
- convertValueToId
10813
- ]);
10798
+ var isHeaderNotEmpty = trueReactPlatformHelpers.isReactNodeNotEmpty(customListHeader);
10799
+ var isFooterNotEmpty = trueReactPlatformHelpers.isReactNodeNotEmpty(customListFooter);
10814
10800
  var optionsDisableMap = React.useMemo(function() {
10815
- return options.map(function(o) {
10816
- return isOptionDisabled(o);
10817
- });
10801
+ return options.map(isOptionDisabled);
10818
10802
  }, [
10819
10803
  options,
10820
10804
  isOptionDisabled
10821
10805
  ]);
10822
10806
  var listOptions = React.useMemo(function() {
10823
- return options.map(function(opt, i) {
10824
- return convertValueToReactNode(opt, optionsDisableMap[i]);
10807
+ return options.map(function(option, index) {
10808
+ return convertValueToReactNode(option, optionsDisableMap[index]);
10825
10809
  });
10826
10810
  }, [
10827
10811
  options,
10828
10812
  convertValueToReactNode,
10829
10813
  optionsDisableMap
10830
10814
  ]);
10831
- var isActiveOption = function(item) {
10832
- return isMultiSelect ? activeOptionsIdMap.includes(convertValueToId(item)) : trueReactPlatformHelpers.isNotEmpty(activeValue) && convertValueToId(activeValue) === convertValueToId(item);
10833
- };
10815
+ var activeOptionsIds = React.useMemo(function() {
10816
+ return new Set(trueReactPlatformHelpers.getArray(activeValue).map(convertValueToId));
10817
+ }, [
10818
+ activeValue,
10819
+ convertValueToId
10820
+ ]);
10821
+ var _obj2;
10834
10822
  return /* @__PURE__ */ jsxs(ScrollIntoViewIfNeeded, {
10835
10823
  active: shouldScrollToList && !isMultiSelect,
10836
- className: clsx(classes.root, _define_property$K({}, classes.withListHeader, trueReactPlatformHelpers.isReactNodeNotEmpty(customListHeader))),
10824
+ className: clsx(classes.root, (_obj2 = {}, _define_property$K(_obj2, classes.withListHeader, isHeaderNotEmpty), _define_property$K(_obj2, classes.withListFooter, isFooterNotEmpty), _obj2)),
10837
10825
  children: [
10838
- trueReactPlatformHelpers.isReactNodeNotEmpty(customListHeader) && /* @__PURE__ */ jsx("div", {
10826
+ isHeaderNotEmpty && /* @__PURE__ */ jsx("div", {
10839
10827
  className: classes.listHeader,
10840
10828
  children: customListHeader
10841
10829
  }),
@@ -10861,9 +10849,10 @@
10861
10849
  trueReactPlatformHelpers.isReactNodeNotEmpty(allOptionsLabel) && /* @__PURE__ */ jsx(SelectListItem, {
10862
10850
  classes,
10863
10851
  index: ALL_OPTION_INDEX,
10864
- isSemiChecked: selectedOptionsCount > 0 && !areAllOptionsSelected,
10852
+ isSemiChecked: activeOptionsIds.size > 0 && !areAllOptionsSelected,
10865
10853
  isActive: areAllOptionsSelected,
10866
10854
  isFocused: focusedIndex === ALL_OPTION_INDEX,
10855
+ isMultiSelect,
10867
10856
  onOptionSelect,
10868
10857
  onToggleCheckbox,
10869
10858
  children: allOptionsLabel
@@ -10871,7 +10860,7 @@
10871
10860
  listOptions.map(function(opt, i) {
10872
10861
  var optionValue = options[i];
10873
10862
  var isFocused = focusedIndex === i;
10874
- var isActive = isActiveOption(optionValue);
10863
+ var isActive = activeOptionsIds.has(convertValueToId(optionValue));
10875
10864
  var isDisabled = optionsDisableMap[i];
10876
10865
  return /* @__PURE__ */ jsx(SelectListItem, {
10877
10866
  classes,
@@ -10879,6 +10868,7 @@
10879
10868
  isDisabled,
10880
10869
  isActive,
10881
10870
  isFocused,
10871
+ isMultiSelect,
10882
10872
  onOptionSelect,
10883
10873
  onToggleCheckbox,
10884
10874
  children: opt
@@ -10890,7 +10880,11 @@
10890
10880
  })
10891
10881
  ]
10892
10882
  })
10893
- }))
10883
+ })),
10884
+ isFooterNotEmpty && /* @__PURE__ */ jsx("div", {
10885
+ className: classes.listFooter,
10886
+ children: customListFooter
10887
+ })
10894
10888
  ]
10895
10889
  });
10896
10890
  }
@@ -10909,9 +10903,6 @@
10909
10903
  return trueReactPlatformHelpers.isNotEmpty(value === null || value === void 0 ? void 0 : value.id) ? String(value.id) : convertValueToString(value);
10910
10904
  };
10911
10905
  };
10912
- var isMultiSelectValue = function(props, _value) {
10913
- return props.isMultiSelect === true;
10914
- };
10915
10906
  var useStyles$E = createThemedStyles("Select", {
10916
10907
  root: {
10917
10908
  width: "100%",
@@ -10931,7 +10922,7 @@
10931
10922
  },
10932
10923
  withoutPopper: {
10933
10924
  position: "absolute",
10934
- top: "calc(100% + 6px)"
10925
+ top: "calc(var(--dropdown-offset, 100%) + 6px)"
10935
10926
  },
10936
10927
  listWrapperInBody: {
10937
10928
  minWidth: "auto",
@@ -10946,7 +10937,8 @@
10946
10937
  height: 20,
10947
10938
  cursor: "pointer",
10948
10939
  zIndex: 1,
10949
- transition: "transform 0.1s ease"
10940
+ transition: animations.defaultTransition,
10941
+ transitionProperty: "transform"
10950
10942
  },
10951
10943
  activeArrow: {
10952
10944
  transform: "rotate(180deg)"
@@ -11305,9 +11297,13 @@
11305
11297
  }
11306
11298
  }
11307
11299
  function Select(props) {
11308
- 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$b(props, [
11300
+ var _input_current;
11301
+ var options = props.options, isMultiSelect = props.isMultiSelect, value = props.value, header = props.header, footer = props.footer, 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$b(props, [
11309
11302
  "options",
11303
+ "isMultiSelect",
11310
11304
  "value",
11305
+ "header",
11306
+ "footer",
11311
11307
  "defaultOptionLabel",
11312
11308
  "allOptionsLabel",
11313
11309
  "debounceTime",
@@ -11343,7 +11339,6 @@
11343
11339
  "shouldRenderInList"
11344
11340
  ]);
11345
11341
  var hasSearchInputInList = optionsMode !== "normal" && shouldRenderSearchInputInList;
11346
- var isMultiSelect = isMultiSelectValue(props);
11347
11342
  var hasReadonlyInput = isReadonly || optionsMode === "normal" || shouldRenderSearchInputInList;
11348
11343
  var tweakInputStyles = useTweakStyles({
11349
11344
  innerStyles: getInputStyles({
@@ -11372,6 +11367,7 @@
11372
11367
  var _useState2 = _sliced_to_array$k(React.useState(DEFAULT_OPTION_INDEX), 2), focusedListCellIndex = _useState2[0], setFocusedListCellIndex = _useState2[1];
11373
11368
  var _useState3 = _sliced_to_array$k(React.useState(""), 2), searchValue = _useState3[0], setSearchValue = _useState3[1];
11374
11369
  var _useState4 = _sliced_to_array$k(React.useState(true), 2), shouldShowDefaultOption = _useState4[0], setShouldShowDefaultOption = _useState4[1];
11370
+ var root2 = React.useRef(null);
11375
11371
  var inputWrapper = React.useRef(null);
11376
11372
  var list = React.useRef(null);
11377
11373
  var input = React.useRef(null);
@@ -11396,8 +11392,8 @@
11396
11392
  optionsMode
11397
11393
  ]);
11398
11394
  var availableOptions = React.useMemo(function() {
11399
- return options.filter(function(o) {
11400
- return !isOptionDisabled(o);
11395
+ return options.filter(function(option) {
11396
+ return !isOptionDisabled(option);
11401
11397
  });
11402
11398
  }, [
11403
11399
  options,
@@ -11434,17 +11430,39 @@
11434
11430
  convertValueToId,
11435
11431
  convertValueToString
11436
11432
  ]);
11437
- var handleListClose = React.useCallback(function(event) {
11433
+ var getDropdownOffset = function() {
11434
+ var _input_current_parentElement2;
11435
+ if (trueReactPlatformHelpers.isEmpty(input.current) || inputProps.errorPosition === "top") {
11436
+ return 0;
11437
+ }
11438
+ var _input_current_parentElement_offsetHeight;
11439
+ return (_input_current_parentElement_offsetHeight = (_input_current_parentElement2 = input.current.parentElement) === null || _input_current_parentElement2 === void 0 ? void 0 : _input_current_parentElement2.offsetHeight) !== null && _input_current_parentElement_offsetHeight !== void 0 ? _input_current_parentElement_offsetHeight : 0;
11440
+ };
11441
+ var closeList = React.useCallback(function() {
11438
11442
  setIsListOpen(false);
11439
11443
  setSearchValue("");
11440
11444
  setShouldShowDefaultOption(true);
11445
+ if (!(dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.shouldUsePopper)) {
11446
+ var _root_current;
11447
+ (_root_current = root2.current) === null || _root_current === void 0 ? void 0 : _root_current.style.removeProperty("--dropdown-offset");
11448
+ }
11449
+ }, [
11450
+ dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.shouldUsePopper
11451
+ ]);
11452
+ var handleListClose = React.useCallback(function(event) {
11453
+ closeList();
11441
11454
  onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
11442
11455
  }, [
11456
+ closeList,
11443
11457
  onBlur
11444
11458
  ]);
11445
11459
  var handleListOpen = function() {
11446
11460
  if (!isListOpen) {
11447
11461
  setIsListOpen(true);
11462
+ if (!(dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.shouldUsePopper)) {
11463
+ var _root_current;
11464
+ (_root_current = root2.current) === null || _root_current === void 0 ? void 0 : _root_current.style.setProperty("--dropdown-offset", "".concat(getDropdownOffset(), "px"));
11465
+ }
11448
11466
  }
11449
11467
  };
11450
11468
  var handleFocus = function(event) {
@@ -11467,7 +11485,7 @@
11467
11485
  handleListClose(event);
11468
11486
  }
11469
11487
  };
11470
- var handleOnChange = React.useCallback(function(newValue, event) {
11488
+ var handleChange = React.useCallback(function(newValue, event) {
11471
11489
  if (!compareValuesOnChange(value, newValue)) {
11472
11490
  onChange(newValue, event);
11473
11491
  }
@@ -11477,12 +11495,12 @@
11477
11495
  onChange
11478
11496
  ]);
11479
11497
  var handleOptionSelect = React.useCallback(function(index, event) {
11480
- var _input_current;
11481
- handleOnChange(index === DEFAULT_OPTION_INDEX ? void 0 : filteredOptions[index], event);
11498
+ var _input_current2;
11499
+ handleChange(index === DEFAULT_OPTION_INDEX ? void 0 : filteredOptions[index], event);
11482
11500
  handleListClose(event);
11483
- (_input_current = input.current) === null || _input_current === void 0 ? void 0 : _input_current.blur();
11501
+ (_input_current2 = input.current) === null || _input_current2 === void 0 ? void 0 : _input_current2.blur();
11484
11502
  }, [
11485
- handleOnChange,
11503
+ handleChange,
11486
11504
  handleListClose,
11487
11505
  filteredOptions
11488
11506
  ]);
@@ -11491,15 +11509,15 @@
11491
11509
  return;
11492
11510
  }
11493
11511
  if (index === DEFAULT_OPTION_INDEX || index === ALL_OPTION_INDEX && !isSelected) {
11494
- handleOnChange(void 0, event);
11512
+ handleChange(void 0, event);
11495
11513
  return;
11496
11514
  }
11497
11515
  if (index === ALL_OPTION_INDEX && isSelected) {
11498
- handleOnChange(availableOptions, event);
11516
+ handleChange(availableOptions, event);
11499
11517
  return;
11500
11518
  }
11501
11519
  var option = filteredOptions[index];
11502
- handleOnChange(isSelected ? (
11520
+ handleChange(isSelected ? (
11503
11521
  // Добавляем
11504
11522
  _to_consumable_array$7(value !== null && value !== void 0 ? value : []).concat([
11505
11523
  option
@@ -11513,7 +11531,7 @@
11513
11531
  }, [
11514
11532
  isMultiSelect,
11515
11533
  filteredOptions,
11516
- handleOnChange,
11534
+ handleChange,
11517
11535
  value,
11518
11536
  availableOptions,
11519
11537
  convertToId
@@ -11573,7 +11591,7 @@
11573
11591
  setShouldShowDefaultOption(v === "");
11574
11592
  }
11575
11593
  if (v === "" && !hasSearchInputInList) {
11576
- handleOnChange(void 0, event);
11594
+ handleChange(void 0, event);
11577
11595
  }
11578
11596
  setSearchValue(v);
11579
11597
  };
@@ -11597,7 +11615,8 @@
11597
11615
  if (indexToSelect === ALL_OPTION_INDEX) {
11598
11616
  isThisValueAlreadySelected = areAllOptionsSelected;
11599
11617
  } else {
11600
- var valueIdToSelect = convertToId(filteredOptions[indexToSelect]);
11618
+ var option = filteredOptions[indexToSelect];
11619
+ var valueIdToSelect = convertToId(option);
11601
11620
  var _value_some;
11602
11621
  isThisValueAlreadySelected = (_value_some = value === null || value === void 0 ? void 0 : value.some(function(opt) {
11603
11622
  return convertToId(opt) === valueIdToSelect;
@@ -11625,8 +11644,9 @@
11625
11644
  };
11626
11645
  var onArrowClick = function() {
11627
11646
  if (isListOpen) {
11628
- var _input_current;
11629
- (_input_current = input.current) === null || _input_current === void 0 ? void 0 : _input_current.blur();
11647
+ var _input_current2;
11648
+ (_input_current2 = input.current) === null || _input_current2 === void 0 ? void 0 : _input_current2.blur();
11649
+ closeList();
11630
11650
  } else {
11631
11651
  var _input_current1;
11632
11652
  (_input_current1 = input.current) === null || _input_current1 === void 0 ? void 0 : _input_current1.focus();
@@ -11646,10 +11666,11 @@
11646
11666
  (optionsMode === "normal" || hasEnoughSymbolsToSearch)
11647
11667
  );
11648
11668
  var _ref1 = dropdownOptions !== null && dropdownOptions !== void 0 ? dropdownOptions : {}, _ref_shouldUsePopper = _ref1.shouldUsePopper, shouldUsePopper = _ref_shouldUsePopper === void 0 ? false : _ref_shouldUsePopper, _ref_shouldRenderInBody = _ref1.shouldRenderInBody, shouldRenderInBody = _ref_shouldRenderInBody === void 0 ? false : _ref_shouldRenderInBody, _ref_shouldHideOnScroll = _ref1.shouldHideOnScroll, shouldHideOnScroll = _ref_shouldHideOnScroll === void 0 ? false : _ref_shouldHideOnScroll;
11669
+ var _input_current_parentElement;
11649
11670
  var popperData = useDropdown({
11650
11671
  isOpen,
11651
11672
  onDropdownClose: handleListClose,
11652
- referenceElement: inputWrapper.current,
11673
+ referenceElement: (_input_current_parentElement = (_input_current = input.current) === null || _input_current === void 0 ? void 0 : _input_current.parentElement) !== null && _input_current_parentElement !== void 0 ? _input_current_parentElement : inputWrapper.current,
11653
11674
  dropdownElement: list.current,
11654
11675
  options: dropdownOptions,
11655
11676
  dependenciesForPositionUpdating: [
@@ -11658,10 +11679,11 @@
11658
11679
  ]
11659
11680
  });
11660
11681
  React.useEffect(function() {
11661
- var _optionsIndexesForNavigation_find;
11662
- setFocusedListCellIndex((_optionsIndexesForNavigation_find = optionsIndexesForNavigation.find(function(index) {
11663
- return trueReactPlatformHelpers.isNotEmpty(strValue) && trueReactPlatformHelpers.isNotEmpty(filteredOptions[index]) && convertToId(filteredOptions[index]) === convertToId(strValue);
11664
- })) !== null && _optionsIndexesForNavigation_find !== void 0 ? _optionsIndexesForNavigation_find : optionsIndexesForNavigation[0]);
11682
+ var focusedCellIndex = trueReactPlatformHelpers.isNotEmpty(strValue) ? optionsIndexesForNavigation.find(function(index) {
11683
+ var option = filteredOptions[index];
11684
+ return trueReactPlatformHelpers.isNotEmpty(option) && convertToId(option) === convertToId(strValue);
11685
+ }) : void 0;
11686
+ setFocusedListCellIndex(focusedCellIndex !== null && focusedCellIndex !== void 0 ? focusedCellIndex : optionsIndexesForNavigation[0]);
11665
11687
  }, [
11666
11688
  strValue,
11667
11689
  filteredOptions,
@@ -11675,11 +11697,24 @@
11675
11697
  }, [
11676
11698
  isOpen
11677
11699
  ]);
11700
+ var searchInputEl = hasSearchInputInList && /* @__PURE__ */ jsx(SearchInput, _object_spread$H({
11701
+ value: searchValue,
11702
+ onChange: handleInputChange,
11703
+ tweakStyles: tweakSearchInputStyles,
11704
+ placeholder: "Поиск"
11705
+ }, searchInputProps));
11706
+ var customHeader = (trueReactPlatformHelpers.isReactNodeNotEmpty(searchInputEl) || trueReactPlatformHelpers.isReactNodeNotEmpty(header)) && /* @__PURE__ */ jsxs(Fragment, {
11707
+ children: [
11708
+ searchInputEl,
11709
+ header
11710
+ ]
11711
+ });
11678
11712
  var _obj2;
11679
11713
  var listEl = /* @__PURE__ */ jsx("div", _object_spread_props$C(_object_spread$H({
11680
11714
  className: clsx(classes.listWrapper, (_obj2 = {}, _define_property$J(_obj2, classes.withoutPopper, !shouldUsePopper), _define_property$J(_obj2, classes.listWrapperInBody, shouldRenderInBody), _obj2)),
11681
11715
  ref: list,
11682
11716
  style: popperData === null || popperData === void 0 ? void 0 : popperData.styles.popper,
11717
+ tabIndex: 0,
11683
11718
  onBlur: handleBlur
11684
11719
  }, popperData === null || popperData === void 0 ? void 0 : popperData.attributes.popper), {
11685
11720
  children: isOpen && /* @__PURE__ */ jsx(SelectList, {
@@ -11687,12 +11722,8 @@
11687
11722
  defaultOptionLabel: hasDefaultOption && shouldShowDefaultOption && defaultOptionLabel,
11688
11723
  allOptionsLabel: shouldShowAllOption && allOptionsLabel,
11689
11724
  areAllOptionsSelected,
11690
- customListHeader: hasSearchInputInList && /* @__PURE__ */ jsx(SearchInput, _object_spread$H({
11691
- value: searchValue,
11692
- onChange: handleInputChange,
11693
- tweakStyles: tweakSearchInputStyles,
11694
- placeholder: "Поиск"
11695
- }, searchInputProps)),
11725
+ customListHeader: customHeader,
11726
+ customListFooter: footer,
11696
11727
  noMatchesLabel,
11697
11728
  focusedIndex: focusedListCellIndex,
11698
11729
  activeValue: value,
@@ -11700,13 +11731,14 @@
11700
11731
  loadingLabel,
11701
11732
  tweakStyles: tweakSelectListStyles,
11702
11733
  testId: trueReactPlatformHelpers.getTestId(testId, "list"),
11734
+ isMultiSelect,
11703
11735
  shouldScrollToList: shouldScrollToList && !shouldUsePopper && !shouldHideOnScroll,
11704
11736
  isOptionDisabled,
11705
11737
  convertValueToString,
11706
11738
  convertValueToReactNode,
11707
11739
  convertValueToId: convertToId,
11708
11740
  onOptionSelect: handleOptionSelect,
11709
- onToggleCheckbox: isMultiSelect ? handleToggleOptionCheckbox : void 0
11741
+ onToggleCheckbox: handleToggleOptionCheckbox
11710
11742
  })
11711
11743
  }));
11712
11744
  var multiSelectCounterWithIcon = shouldShowMultiSelectCounter || trueReactPlatformHelpers.isNotEmpty(iconType) ? /* @__PURE__ */ jsxs(Fragment, {
@@ -11728,6 +11760,7 @@
11728
11760
  return /* @__PURE__ */ jsxs("div", {
11729
11761
  className: classes.root,
11730
11762
  onKeyDown: handleKeyDown,
11763
+ ref: root2,
11731
11764
  children: [
11732
11765
  /* @__PURE__ */ jsxs("div", {
11733
11766
  className: clsx(classes.inputWrapper, isDisabled && classes.disabled),
@@ -13764,13 +13797,14 @@
13764
13797
  return String(val);
13765
13798
  };
13766
13799
  var getPrevSpaces = function(val, position) {
13767
- return val.slice(0, position - 1).split("").filter(isSpaceChar).length;
13800
+ return val.slice(0, position).split("").filter(isSpaceChar).length;
13768
13801
  };
13769
13802
  var getNewCaretPosition = function(defaultPosition, oldValue, newValue, isDeleteForwardAction) {
13770
13803
  if (oldValue === newValue) {
13771
13804
  return isDeleteForwardAction ? defaultPosition + 1 : defaultPosition;
13772
13805
  }
13773
- var oldPrevSpaces = getPrevSpaces(oldValue, defaultPosition);
13806
+ var isAdding = newValue.length > oldValue.length;
13807
+ var oldPrevSpaces = getPrevSpaces(oldValue, defaultPosition - (isAdding ? 1 : 0));
13774
13808
  var newPrevSpaces = getPrevSpaces(newValue, defaultPosition);
13775
13809
  var diff = newPrevSpaces - oldPrevSpaces;
13776
13810
  var res = defaultPosition + diff;