@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.
- package/LICENSE +201 -201
- package/README.md +21 -0
- package/dist/components/Select/CustomSelect.stories.d.ts +1 -1
- package/dist/components/Select/MultiSelect.stories.d.ts +2 -2
- package/dist/components/Select/Select.d.ts +14 -9
- package/dist/components/Select/Select.styles.d.ts +5 -5
- package/dist/components/Select/components/SelectList/SelectList.d.ts +7 -6
- package/dist/components/Select/components/SelectList/SelectList.styles.d.ts +1 -1
- package/dist/components/Select/components/SelectListItem/SelectListItem.d.ts +4 -3
- package/dist/components/Select/helpers.d.ts +0 -3
- package/dist/true-react-common-ui-kit.js +176 -142
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +175 -141
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/components/AccountInfo/AccountInfo.stories.tsx +32 -32
- package/src/components/AccountInfo/AccountInfo.tsx +80 -80
- package/src/components/AddButton/AddButton.stories.tsx +21 -21
- package/src/components/AddButton/AddButton.tsx +52 -52
- package/src/components/Button/Button.tsx +129 -129
- package/src/components/Colors/Colors.stories.tsx +7 -7
- package/src/components/DateInput/DateInput.tsx +90 -90
- package/src/components/DateInput/constants.ts +2 -2
- package/src/components/Description/Description.stories.tsx +27 -27
- package/src/components/Description/Description.tsx +61 -61
- package/src/components/FiltersPane/components/FilterValueView/FilterValueView.tsx +166 -166
- package/src/components/FiltersPane/components/FilterWithDates/FilterWithDates.tsx +210 -210
- package/src/components/FiltersPane/components/FilterWithPeriod/FilterWithPeriod.tsx +177 -177
- package/src/components/Flag/Flag.stories.tsx +29 -29
- package/src/components/Flag/Flag.tsx +26 -26
- package/src/components/Flag/augment.d.ts +1 -1
- package/src/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.styles.ts +38 -38
- package/src/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.styles.ts +25 -25
- package/src/components/FlexibleTable/helpers.ts +13 -13
- package/src/components/Icon/Icon.stories.tsx +86 -86
- package/src/components/Icon/complexIcons/augment.d.ts +1 -1
- package/src/components/Icon/complexIcons/avatarGreen.svg +57 -57
- package/src/components/Icon/complexIcons/index.ts +1 -1
- package/src/components/IncrementInput/IncrementInput.tsx +105 -105
- package/src/components/Input/Input.tsx +297 -297
- package/src/components/Input/types.ts +32 -32
- package/src/components/List/List.stories.tsx +70 -70
- package/src/components/List/List.tsx +33 -33
- package/src/components/List/components/ListItem/ListItem.tsx +57 -57
- package/src/components/Modal/Modal.stories.tsx +105 -105
- package/src/components/MultiSelect/MultiSelect.stories.tsx +46 -46
- package/src/components/MultiSelect/MultiSelect.tsx +106 -106
- package/src/components/MultiSelect/components/MultiSelectInput/MultiSelectInput.tsx +53 -53
- package/src/components/Notification/Notification.stories.tsx +46 -46
- package/src/components/Notification/Notification.tsx +69 -69
- package/src/components/NumberInput/NumberInput.tsx +137 -137
- package/src/components/NumberInput/helpers.ts +4 -6
- package/src/components/NumberInput/index.ts +1 -1
- package/src/components/PhoneInput/PhoneInput.tsx +214 -214
- package/src/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.tsx +155 -155
- package/src/components/PhoneInput/types.ts +16 -16
- package/src/components/RadioButton/RadioButton.stories.tsx +46 -46
- package/src/components/RadioButton/RadioButton.tsx +57 -57
- package/src/components/ScrollIntoViewIfNeeded/index.ts +1 -1
- package/src/components/Select/CustomSelect.stories.tsx +52 -16
- package/src/components/Select/MultiSelect.stories.tsx +3 -3
- package/src/components/Select/Select.stories.tsx +235 -235
- package/src/components/Select/Select.styles.ts +8 -7
- package/src/components/Select/Select.tsx +106 -62
- package/src/components/Select/components/SelectList/SelectList.styles.ts +6 -4
- package/src/components/Select/components/SelectList/SelectList.tsx +25 -29
- package/src/components/Select/components/SelectListItem/SelectListItem.tsx +23 -19
- package/src/components/Select/constants.ts +2 -2
- package/src/components/Select/helpers.ts +0 -7
- package/src/components/Select/types.ts +1 -1
- package/src/components/Selector/Selector.stories.tsx +62 -62
- package/src/components/Selector/Selector.tsx +115 -115
- package/src/components/Selector/index.ts +2 -2
- package/src/components/Selector/types.ts +12 -12
- package/src/components/Skeleton/Skeleton.stories.tsx +19 -19
- package/src/components/SmartInput/SmartInput.tsx +134 -134
- package/src/components/Status/Status.stories.tsx +73 -73
- package/src/components/Status/Status.styles.ts +143 -143
- package/src/components/Status/Status.tsx +49 -49
- package/src/components/Status/constants.ts +11 -11
- package/src/components/Status/index.ts +3 -3
- package/src/components/Status/types.ts +5 -5
- package/src/components/Switch/Switch.stories.tsx +40 -40
- package/src/components/Switch/Switch.tsx +75 -75
- package/src/components/TextWithInfo/TextWithInfo.stories.tsx +53 -53
- package/src/components/TextWithInfo/TextWithInfo.tsx +62 -62
- package/src/components/TextWithTooltip/TextWithTooltip.stories.tsx +58 -58
- package/src/components/TextWithTooltip/TextWithTooltip.tsx +2 -3
- package/src/components/ThemedPreloader/ThemedPreloader.stories.tsx +41 -41
- package/src/components/ThemedPreloader/ThemedPreloader.tsx +54 -54
- package/src/components/ThemedPreloader/components/DefaultPreloader/index.ts +1 -1
- package/src/components/Toaster/Toaster.stories.tsx +30 -30
- package/src/components/Tooltip/Tooltip.stories.tsx +19 -19
- package/src/components/Tooltip/Tooltip.tsx +35 -35
- package/src/components/Tooltip/types.ts +1 -1
- package/src/helpers/popper-helpers.ts +17 -17
- package/src/hooks/use-dropdown.ts +84 -84
- package/src/hooks/use-is-mounted.ts +15 -15
- package/src/theme/helpers.ts +76 -76
- package/src/vite-env.d.ts +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { createContext, useRef, useEffect, useCallback, useState, useMemo, useContext, createElement, Fragment as Fragment$1, forwardRef, createRef, PureComponent, memo } from "react";
|
|
2
2
|
import { createUseStyles } from "react-jss";
|
|
3
|
-
import { mergeStyles, isNotEmpty, isArrayNotEmpty, isEmpty, isString, isStringNotEmpty, mergeRefs, addDataTestId, isReactNodeNotEmpty, addClickHandler, getTestId, getSelectKeyHandler, createFilter, isFunction as isFunction$1, isObject as isObject$1, getTransition, applyAction, indexMap, isNumberInteger, hasDuplicates } from "@true-engineering/true-react-platform-helpers";
|
|
3
|
+
import { mergeStyles, isNotEmpty, isArrayNotEmpty, isEmpty, isString, isStringNotEmpty, mergeRefs, addDataTestId, isReactNodeNotEmpty, addClickHandler, getTestId, getSelectKeyHandler, getArray, createFilter, isFunction as isFunction$1, isObject as isObject$1, getTransition, applyAction, indexMap, isNumberInteger, hasDuplicates } from "@true-engineering/true-react-platform-helpers";
|
|
4
4
|
import { CSSTransition } from "react-transition-group";
|
|
5
5
|
import clsx from "clsx";
|
|
6
6
|
import hexToRgba from "hex-to-rgba";
|
|
@@ -6668,63 +6668,63 @@ var useMergedRefs = function(refs) {
|
|
|
6668
6668
|
return mergeRefs(refs);
|
|
6669
6669
|
}, refs);
|
|
6670
6670
|
};
|
|
6671
|
-
const avatarGreen = ` <svg
|
|
6672
|
-
width="100%"
|
|
6673
|
-
height="100%"
|
|
6674
|
-
viewBox="0 0 32 32"
|
|
6675
|
-
fill="none"
|
|
6676
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
6677
|
-
|
|
6678
|
-
<circle opacity="0.5" cx="16" cy="16" r="16" fill="#DDE3ED"
|
|
6679
|
-
<mask
|
|
6680
|
-
id="mask0_0_12744"
|
|
6681
|
-
style="mask-type: 'alpha';"
|
|
6682
|
-
maskUnits="userSpaceOnUse"
|
|
6683
|
-
x="0"
|
|
6684
|
-
y="0"
|
|
6685
|
-
width="32"
|
|
6686
|
-
height="32"
|
|
6687
|
-
|
|
6688
|
-
<circle cx="16" cy="16" r="16" fill="white"
|
|
6689
|
-
</mask
|
|
6690
|
-
<g mask="url(#mask0_0_12744)"
|
|
6691
|
-
<circle cx="16" cy="29" r="13" fill="url(#paint0_linear_0_12744)"
|
|
6692
|
-
<mask
|
|
6693
|
-
id="mask1_0_12744"
|
|
6694
|
-
style="mask-type: 'alpha';"
|
|
6695
|
-
maskUnits="userSpaceOnUse"
|
|
6696
|
-
x="3"
|
|
6697
|
-
y="16"
|
|
6698
|
-
width="26"
|
|
6699
|
-
height="26"
|
|
6700
|
-
|
|
6701
|
-
<circle cx="16" cy="29" r="13" fill="white"
|
|
6702
|
-
</mask
|
|
6703
|
-
<g mask="url(#mask1_0_12744)"
|
|
6704
|
-
<ellipse
|
|
6705
|
-
cx="16"
|
|
6706
|
-
cy="17.5"
|
|
6707
|
-
rx="6"
|
|
6708
|
-
ry="7.5"
|
|
6709
|
-
fill="#505F79"
|
|
6710
|
-
fill-opacity="0.204983"
|
|
6711
|
-
|
|
6712
|
-
</g
|
|
6713
|
-
</g
|
|
6714
|
-
<ellipse cx="16" cy="13" rx="6" ry="7" fill="white"
|
|
6715
|
-
<defs
|
|
6716
|
-
<linearGradient
|
|
6717
|
-
id="paint0_linear_0_12744"
|
|
6718
|
-
x1="13.347"
|
|
6719
|
-
y1="46.279"
|
|
6720
|
-
x2="33.5318"
|
|
6721
|
-
y2="30.8088"
|
|
6722
|
-
gradientUnits="userSpaceOnUse"
|
|
6723
|
-
|
|
6724
|
-
<stop stop-color="#ABD229"
|
|
6725
|
-
<stop offset="1" stop-color="#9CD03F"
|
|
6726
|
-
</linearGradient
|
|
6727
|
-
</defs
|
|
6671
|
+
const avatarGreen = ` <svg
|
|
6672
|
+
width="100%"
|
|
6673
|
+
height="100%"
|
|
6674
|
+
viewBox="0 0 32 32"
|
|
6675
|
+
fill="none"
|
|
6676
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
6677
|
+
>
|
|
6678
|
+
<circle opacity="0.5" cx="16" cy="16" r="16" fill="#DDE3ED" />
|
|
6679
|
+
<mask
|
|
6680
|
+
id="mask0_0_12744"
|
|
6681
|
+
style="mask-type: 'alpha';"
|
|
6682
|
+
maskUnits="userSpaceOnUse"
|
|
6683
|
+
x="0"
|
|
6684
|
+
y="0"
|
|
6685
|
+
width="32"
|
|
6686
|
+
height="32"
|
|
6687
|
+
>
|
|
6688
|
+
<circle cx="16" cy="16" r="16" fill="white" />
|
|
6689
|
+
</mask>
|
|
6690
|
+
<g mask="url(#mask0_0_12744)">
|
|
6691
|
+
<circle cx="16" cy="29" r="13" fill="url(#paint0_linear_0_12744)" />
|
|
6692
|
+
<mask
|
|
6693
|
+
id="mask1_0_12744"
|
|
6694
|
+
style="mask-type: 'alpha';"
|
|
6695
|
+
maskUnits="userSpaceOnUse"
|
|
6696
|
+
x="3"
|
|
6697
|
+
y="16"
|
|
6698
|
+
width="26"
|
|
6699
|
+
height="26"
|
|
6700
|
+
>
|
|
6701
|
+
<circle cx="16" cy="29" r="13" fill="white" />
|
|
6702
|
+
</mask>
|
|
6703
|
+
<g mask="url(#mask1_0_12744)">
|
|
6704
|
+
<ellipse
|
|
6705
|
+
cx="16"
|
|
6706
|
+
cy="17.5"
|
|
6707
|
+
rx="6"
|
|
6708
|
+
ry="7.5"
|
|
6709
|
+
fill="#505F79"
|
|
6710
|
+
fill-opacity="0.204983"
|
|
6711
|
+
/>
|
|
6712
|
+
</g>
|
|
6713
|
+
</g>
|
|
6714
|
+
<ellipse cx="16" cy="13" rx="6" ry="7" fill="white" />
|
|
6715
|
+
<defs>
|
|
6716
|
+
<linearGradient
|
|
6717
|
+
id="paint0_linear_0_12744"
|
|
6718
|
+
x1="13.347"
|
|
6719
|
+
y1="46.279"
|
|
6720
|
+
x2="33.5318"
|
|
6721
|
+
y2="30.8088"
|
|
6722
|
+
gradientUnits="userSpaceOnUse"
|
|
6723
|
+
>
|
|
6724
|
+
<stop stop-color="#ABD229" />
|
|
6725
|
+
<stop offset="1" stop-color="#9CD03F" />
|
|
6726
|
+
</linearGradient>
|
|
6727
|
+
</defs>
|
|
6728
6728
|
</svg>`;
|
|
6729
6729
|
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>';
|
|
6730
6730
|
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>';
|
|
@@ -10619,15 +10619,11 @@ var useStyles$F = createThemedStyles("SelectList", {
|
|
|
10619
10619
|
withListHeader: {
|
|
10620
10620
|
paddingTop: 0
|
|
10621
10621
|
},
|
|
10622
|
-
|
|
10623
|
-
|
|
10624
|
-
borderTop: [
|
|
10625
|
-
1,
|
|
10626
|
-
"solid",
|
|
10627
|
-
colors.BORDER_LIGHT
|
|
10628
|
-
]
|
|
10629
|
-
}
|
|
10622
|
+
withListFooter: {
|
|
10623
|
+
paddingBottom: 0
|
|
10630
10624
|
},
|
|
10625
|
+
listHeader: {},
|
|
10626
|
+
listFooter: {},
|
|
10631
10627
|
list: _object_spread$K({
|
|
10632
10628
|
height: "100%",
|
|
10633
10629
|
maxHeight: ROW_HEIGHT$1 * 6,
|
|
@@ -10724,8 +10720,18 @@ function _object_spread_props$E(target, source) {
|
|
|
10724
10720
|
return target;
|
|
10725
10721
|
}
|
|
10726
10722
|
var SelectListItem = function(param) {
|
|
10727
|
-
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;
|
|
10728
|
-
var
|
|
10723
|
+
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;
|
|
10724
|
+
var multiSelectContent = isMultiSelect && /* @__PURE__ */ jsx(Checkbox, {
|
|
10725
|
+
isChecked: isActive || isSemiChecked,
|
|
10726
|
+
isSemiChecked,
|
|
10727
|
+
isDisabled,
|
|
10728
|
+
tweakStyles: checkboxStyles$1,
|
|
10729
|
+
onSelect: function(param2, event) {
|
|
10730
|
+
var isSelected = param2.isSelected;
|
|
10731
|
+
return onToggleCheckbox(index, isSelected, event);
|
|
10732
|
+
},
|
|
10733
|
+
children
|
|
10734
|
+
});
|
|
10729
10735
|
var _obj2;
|
|
10730
10736
|
return /* @__PURE__ */ jsx(ScrollIntoViewIfNeeded, _object_spread_props$E(_object_spread$J({
|
|
10731
10737
|
active: isFocused,
|
|
@@ -10741,17 +10747,7 @@ var SelectListItem = function(param) {
|
|
|
10741
10747
|
onClick: !isDisabled && !isMultiSelect ? function(event) {
|
|
10742
10748
|
return onOptionSelect(index, event);
|
|
10743
10749
|
} : void 0,
|
|
10744
|
-
children: isMultiSelect ?
|
|
10745
|
-
value: index,
|
|
10746
|
-
isChecked: isActive || isSemiChecked,
|
|
10747
|
-
isSemiChecked,
|
|
10748
|
-
isDisabled,
|
|
10749
|
-
tweakStyles: checkboxStyles$1,
|
|
10750
|
-
onSelect: function(v, event) {
|
|
10751
|
-
return onToggleCheckbox(index, v.isSelected, event);
|
|
10752
|
-
},
|
|
10753
|
-
children
|
|
10754
|
-
}) : children
|
|
10750
|
+
children: isMultiSelect ? multiSelectContent : children
|
|
10755
10751
|
}));
|
|
10756
10752
|
};
|
|
10757
10753
|
function _define_property$K(obj, key, value) {
|
|
@@ -10807,47 +10803,39 @@ function _object_spread_props$D(target, source) {
|
|
|
10807
10803
|
return target;
|
|
10808
10804
|
}
|
|
10809
10805
|
function SelectList(param) {
|
|
10810
|
-
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;
|
|
10806
|
+
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;
|
|
10811
10807
|
var classes = useStyles$F({
|
|
10812
10808
|
theme: tweakStyles
|
|
10813
10809
|
});
|
|
10814
|
-
var
|
|
10815
|
-
var
|
|
10816
|
-
var _multiSelectValue_length;
|
|
10817
|
-
var selectedOptionsCount = (_multiSelectValue_length = multiSelectValue === null || multiSelectValue === void 0 ? void 0 : multiSelectValue.length) !== null && _multiSelectValue_length !== void 0 ? _multiSelectValue_length : 0;
|
|
10818
|
-
var activeOptionsIdMap = useMemo(function() {
|
|
10819
|
-
var _multiSelectValue_map;
|
|
10820
|
-
return isMultiSelect ? (_multiSelectValue_map = multiSelectValue === null || multiSelectValue === void 0 ? void 0 : multiSelectValue.map(convertValueToId)) !== null && _multiSelectValue_map !== void 0 ? _multiSelectValue_map : [] : [];
|
|
10821
|
-
}, [
|
|
10822
|
-
isMultiSelect,
|
|
10823
|
-
multiSelectValue,
|
|
10824
|
-
convertValueToId
|
|
10825
|
-
]);
|
|
10810
|
+
var isHeaderNotEmpty = isReactNodeNotEmpty(customListHeader);
|
|
10811
|
+
var isFooterNotEmpty = isReactNodeNotEmpty(customListFooter);
|
|
10826
10812
|
var optionsDisableMap = useMemo(function() {
|
|
10827
|
-
return options.map(
|
|
10828
|
-
return isOptionDisabled(o);
|
|
10829
|
-
});
|
|
10813
|
+
return options.map(isOptionDisabled);
|
|
10830
10814
|
}, [
|
|
10831
10815
|
options,
|
|
10832
10816
|
isOptionDisabled
|
|
10833
10817
|
]);
|
|
10834
10818
|
var listOptions = useMemo(function() {
|
|
10835
|
-
return options.map(function(
|
|
10836
|
-
return convertValueToReactNode(
|
|
10819
|
+
return options.map(function(option, index) {
|
|
10820
|
+
return convertValueToReactNode(option, optionsDisableMap[index]);
|
|
10837
10821
|
});
|
|
10838
10822
|
}, [
|
|
10839
10823
|
options,
|
|
10840
10824
|
convertValueToReactNode,
|
|
10841
10825
|
optionsDisableMap
|
|
10842
10826
|
]);
|
|
10843
|
-
var
|
|
10844
|
-
return
|
|
10845
|
-
}
|
|
10827
|
+
var activeOptionsIds = useMemo(function() {
|
|
10828
|
+
return new Set(getArray(activeValue).map(convertValueToId));
|
|
10829
|
+
}, [
|
|
10830
|
+
activeValue,
|
|
10831
|
+
convertValueToId
|
|
10832
|
+
]);
|
|
10833
|
+
var _obj2;
|
|
10846
10834
|
return /* @__PURE__ */ jsxs(ScrollIntoViewIfNeeded, {
|
|
10847
10835
|
active: shouldScrollToList && !isMultiSelect,
|
|
10848
|
-
className: clsx(classes.root, _define_property$K(
|
|
10836
|
+
className: clsx(classes.root, (_obj2 = {}, _define_property$K(_obj2, classes.withListHeader, isHeaderNotEmpty), _define_property$K(_obj2, classes.withListFooter, isFooterNotEmpty), _obj2)),
|
|
10849
10837
|
children: [
|
|
10850
|
-
|
|
10838
|
+
isHeaderNotEmpty && /* @__PURE__ */ jsx("div", {
|
|
10851
10839
|
className: classes.listHeader,
|
|
10852
10840
|
children: customListHeader
|
|
10853
10841
|
}),
|
|
@@ -10873,9 +10861,10 @@ function SelectList(param) {
|
|
|
10873
10861
|
isReactNodeNotEmpty(allOptionsLabel) && /* @__PURE__ */ jsx(SelectListItem, {
|
|
10874
10862
|
classes,
|
|
10875
10863
|
index: ALL_OPTION_INDEX,
|
|
10876
|
-
isSemiChecked:
|
|
10864
|
+
isSemiChecked: activeOptionsIds.size > 0 && !areAllOptionsSelected,
|
|
10877
10865
|
isActive: areAllOptionsSelected,
|
|
10878
10866
|
isFocused: focusedIndex === ALL_OPTION_INDEX,
|
|
10867
|
+
isMultiSelect,
|
|
10879
10868
|
onOptionSelect,
|
|
10880
10869
|
onToggleCheckbox,
|
|
10881
10870
|
children: allOptionsLabel
|
|
@@ -10883,7 +10872,7 @@ function SelectList(param) {
|
|
|
10883
10872
|
listOptions.map(function(opt, i) {
|
|
10884
10873
|
var optionValue = options[i];
|
|
10885
10874
|
var isFocused = focusedIndex === i;
|
|
10886
|
-
var isActive =
|
|
10875
|
+
var isActive = activeOptionsIds.has(convertValueToId(optionValue));
|
|
10887
10876
|
var isDisabled = optionsDisableMap[i];
|
|
10888
10877
|
return /* @__PURE__ */ jsx(SelectListItem, {
|
|
10889
10878
|
classes,
|
|
@@ -10891,6 +10880,7 @@ function SelectList(param) {
|
|
|
10891
10880
|
isDisabled,
|
|
10892
10881
|
isActive,
|
|
10893
10882
|
isFocused,
|
|
10883
|
+
isMultiSelect,
|
|
10894
10884
|
onOptionSelect,
|
|
10895
10885
|
onToggleCheckbox,
|
|
10896
10886
|
children: opt
|
|
@@ -10902,7 +10892,11 @@ function SelectList(param) {
|
|
|
10902
10892
|
})
|
|
10903
10893
|
]
|
|
10904
10894
|
})
|
|
10905
|
-
}))
|
|
10895
|
+
})),
|
|
10896
|
+
isFooterNotEmpty && /* @__PURE__ */ jsx("div", {
|
|
10897
|
+
className: classes.listFooter,
|
|
10898
|
+
children: customListFooter
|
|
10899
|
+
})
|
|
10906
10900
|
]
|
|
10907
10901
|
});
|
|
10908
10902
|
}
|
|
@@ -10921,9 +10915,6 @@ var getDefaultConvertToIdFunction = function(convertValueToString) {
|
|
|
10921
10915
|
return isNotEmpty(value === null || value === void 0 ? void 0 : value.id) ? String(value.id) : convertValueToString(value);
|
|
10922
10916
|
};
|
|
10923
10917
|
};
|
|
10924
|
-
var isMultiSelectValue = function(props, _value) {
|
|
10925
|
-
return props.isMultiSelect === true;
|
|
10926
|
-
};
|
|
10927
10918
|
var useStyles$E = createThemedStyles("Select", {
|
|
10928
10919
|
root: {
|
|
10929
10920
|
width: "100%",
|
|
@@ -10943,7 +10934,7 @@ var useStyles$E = createThemedStyles("Select", {
|
|
|
10943
10934
|
},
|
|
10944
10935
|
withoutPopper: {
|
|
10945
10936
|
position: "absolute",
|
|
10946
|
-
top: "calc(100% + 6px)"
|
|
10937
|
+
top: "calc(var(--dropdown-offset, 100%) + 6px)"
|
|
10947
10938
|
},
|
|
10948
10939
|
listWrapperInBody: {
|
|
10949
10940
|
minWidth: "auto",
|
|
@@ -10958,7 +10949,8 @@ var useStyles$E = createThemedStyles("Select", {
|
|
|
10958
10949
|
height: 20,
|
|
10959
10950
|
cursor: "pointer",
|
|
10960
10951
|
zIndex: 1,
|
|
10961
|
-
transition:
|
|
10952
|
+
transition: animations.defaultTransition,
|
|
10953
|
+
transitionProperty: "transform"
|
|
10962
10954
|
},
|
|
10963
10955
|
activeArrow: {
|
|
10964
10956
|
transform: "rotate(180deg)"
|
|
@@ -11317,9 +11309,13 @@ function _ts_generator$4(thisArg, body) {
|
|
|
11317
11309
|
}
|
|
11318
11310
|
}
|
|
11319
11311
|
function Select(props) {
|
|
11320
|
-
var
|
|
11312
|
+
var _input_current;
|
|
11313
|
+
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, [
|
|
11321
11314
|
"options",
|
|
11315
|
+
"isMultiSelect",
|
|
11322
11316
|
"value",
|
|
11317
|
+
"header",
|
|
11318
|
+
"footer",
|
|
11323
11319
|
"defaultOptionLabel",
|
|
11324
11320
|
"allOptionsLabel",
|
|
11325
11321
|
"debounceTime",
|
|
@@ -11355,7 +11351,6 @@ function Select(props) {
|
|
|
11355
11351
|
"shouldRenderInList"
|
|
11356
11352
|
]);
|
|
11357
11353
|
var hasSearchInputInList = optionsMode !== "normal" && shouldRenderSearchInputInList;
|
|
11358
|
-
var isMultiSelect = isMultiSelectValue(props);
|
|
11359
11354
|
var hasReadonlyInput = isReadonly || optionsMode === "normal" || shouldRenderSearchInputInList;
|
|
11360
11355
|
var tweakInputStyles = useTweakStyles({
|
|
11361
11356
|
innerStyles: getInputStyles({
|
|
@@ -11384,6 +11379,7 @@ function Select(props) {
|
|
|
11384
11379
|
var _useState2 = _sliced_to_array$k(useState(DEFAULT_OPTION_INDEX), 2), focusedListCellIndex = _useState2[0], setFocusedListCellIndex = _useState2[1];
|
|
11385
11380
|
var _useState3 = _sliced_to_array$k(useState(""), 2), searchValue = _useState3[0], setSearchValue = _useState3[1];
|
|
11386
11381
|
var _useState4 = _sliced_to_array$k(useState(true), 2), shouldShowDefaultOption = _useState4[0], setShouldShowDefaultOption = _useState4[1];
|
|
11382
|
+
var root2 = useRef(null);
|
|
11387
11383
|
var inputWrapper = useRef(null);
|
|
11388
11384
|
var list = useRef(null);
|
|
11389
11385
|
var input = useRef(null);
|
|
@@ -11408,8 +11404,8 @@ function Select(props) {
|
|
|
11408
11404
|
optionsMode
|
|
11409
11405
|
]);
|
|
11410
11406
|
var availableOptions = useMemo(function() {
|
|
11411
|
-
return options.filter(function(
|
|
11412
|
-
return !isOptionDisabled(
|
|
11407
|
+
return options.filter(function(option) {
|
|
11408
|
+
return !isOptionDisabled(option);
|
|
11413
11409
|
});
|
|
11414
11410
|
}, [
|
|
11415
11411
|
options,
|
|
@@ -11446,17 +11442,39 @@ function Select(props) {
|
|
|
11446
11442
|
convertValueToId,
|
|
11447
11443
|
convertValueToString
|
|
11448
11444
|
]);
|
|
11449
|
-
var
|
|
11445
|
+
var getDropdownOffset = function() {
|
|
11446
|
+
var _input_current_parentElement2;
|
|
11447
|
+
if (isEmpty(input.current) || inputProps.errorPosition === "top") {
|
|
11448
|
+
return 0;
|
|
11449
|
+
}
|
|
11450
|
+
var _input_current_parentElement_offsetHeight;
|
|
11451
|
+
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;
|
|
11452
|
+
};
|
|
11453
|
+
var closeList = useCallback(function() {
|
|
11450
11454
|
setIsListOpen(false);
|
|
11451
11455
|
setSearchValue("");
|
|
11452
11456
|
setShouldShowDefaultOption(true);
|
|
11457
|
+
if (!(dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.shouldUsePopper)) {
|
|
11458
|
+
var _root_current;
|
|
11459
|
+
(_root_current = root2.current) === null || _root_current === void 0 ? void 0 : _root_current.style.removeProperty("--dropdown-offset");
|
|
11460
|
+
}
|
|
11461
|
+
}, [
|
|
11462
|
+
dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.shouldUsePopper
|
|
11463
|
+
]);
|
|
11464
|
+
var handleListClose = useCallback(function(event) {
|
|
11465
|
+
closeList();
|
|
11453
11466
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
11454
11467
|
}, [
|
|
11468
|
+
closeList,
|
|
11455
11469
|
onBlur
|
|
11456
11470
|
]);
|
|
11457
11471
|
var handleListOpen = function() {
|
|
11458
11472
|
if (!isListOpen) {
|
|
11459
11473
|
setIsListOpen(true);
|
|
11474
|
+
if (!(dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.shouldUsePopper)) {
|
|
11475
|
+
var _root_current;
|
|
11476
|
+
(_root_current = root2.current) === null || _root_current === void 0 ? void 0 : _root_current.style.setProperty("--dropdown-offset", "".concat(getDropdownOffset(), "px"));
|
|
11477
|
+
}
|
|
11460
11478
|
}
|
|
11461
11479
|
};
|
|
11462
11480
|
var handleFocus = function(event) {
|
|
@@ -11479,7 +11497,7 @@ function Select(props) {
|
|
|
11479
11497
|
handleListClose(event);
|
|
11480
11498
|
}
|
|
11481
11499
|
};
|
|
11482
|
-
var
|
|
11500
|
+
var handleChange = useCallback(function(newValue, event) {
|
|
11483
11501
|
if (!compareValuesOnChange(value, newValue)) {
|
|
11484
11502
|
onChange(newValue, event);
|
|
11485
11503
|
}
|
|
@@ -11489,12 +11507,12 @@ function Select(props) {
|
|
|
11489
11507
|
onChange
|
|
11490
11508
|
]);
|
|
11491
11509
|
var handleOptionSelect = useCallback(function(index, event) {
|
|
11492
|
-
var
|
|
11493
|
-
|
|
11510
|
+
var _input_current2;
|
|
11511
|
+
handleChange(index === DEFAULT_OPTION_INDEX ? void 0 : filteredOptions[index], event);
|
|
11494
11512
|
handleListClose(event);
|
|
11495
|
-
(
|
|
11513
|
+
(_input_current2 = input.current) === null || _input_current2 === void 0 ? void 0 : _input_current2.blur();
|
|
11496
11514
|
}, [
|
|
11497
|
-
|
|
11515
|
+
handleChange,
|
|
11498
11516
|
handleListClose,
|
|
11499
11517
|
filteredOptions
|
|
11500
11518
|
]);
|
|
@@ -11503,15 +11521,15 @@ function Select(props) {
|
|
|
11503
11521
|
return;
|
|
11504
11522
|
}
|
|
11505
11523
|
if (index === DEFAULT_OPTION_INDEX || index === ALL_OPTION_INDEX && !isSelected) {
|
|
11506
|
-
|
|
11524
|
+
handleChange(void 0, event);
|
|
11507
11525
|
return;
|
|
11508
11526
|
}
|
|
11509
11527
|
if (index === ALL_OPTION_INDEX && isSelected) {
|
|
11510
|
-
|
|
11528
|
+
handleChange(availableOptions, event);
|
|
11511
11529
|
return;
|
|
11512
11530
|
}
|
|
11513
11531
|
var option = filteredOptions[index];
|
|
11514
|
-
|
|
11532
|
+
handleChange(isSelected ? (
|
|
11515
11533
|
// Добавляем
|
|
11516
11534
|
_to_consumable_array$7(value !== null && value !== void 0 ? value : []).concat([
|
|
11517
11535
|
option
|
|
@@ -11525,7 +11543,7 @@ function Select(props) {
|
|
|
11525
11543
|
}, [
|
|
11526
11544
|
isMultiSelect,
|
|
11527
11545
|
filteredOptions,
|
|
11528
|
-
|
|
11546
|
+
handleChange,
|
|
11529
11547
|
value,
|
|
11530
11548
|
availableOptions,
|
|
11531
11549
|
convertToId
|
|
@@ -11585,7 +11603,7 @@ function Select(props) {
|
|
|
11585
11603
|
setShouldShowDefaultOption(v === "");
|
|
11586
11604
|
}
|
|
11587
11605
|
if (v === "" && !hasSearchInputInList) {
|
|
11588
|
-
|
|
11606
|
+
handleChange(void 0, event);
|
|
11589
11607
|
}
|
|
11590
11608
|
setSearchValue(v);
|
|
11591
11609
|
};
|
|
@@ -11609,7 +11627,8 @@ function Select(props) {
|
|
|
11609
11627
|
if (indexToSelect === ALL_OPTION_INDEX) {
|
|
11610
11628
|
isThisValueAlreadySelected = areAllOptionsSelected;
|
|
11611
11629
|
} else {
|
|
11612
|
-
var
|
|
11630
|
+
var option = filteredOptions[indexToSelect];
|
|
11631
|
+
var valueIdToSelect = convertToId(option);
|
|
11613
11632
|
var _value_some;
|
|
11614
11633
|
isThisValueAlreadySelected = (_value_some = value === null || value === void 0 ? void 0 : value.some(function(opt) {
|
|
11615
11634
|
return convertToId(opt) === valueIdToSelect;
|
|
@@ -11637,8 +11656,9 @@ function Select(props) {
|
|
|
11637
11656
|
};
|
|
11638
11657
|
var onArrowClick = function() {
|
|
11639
11658
|
if (isListOpen) {
|
|
11640
|
-
var
|
|
11641
|
-
(
|
|
11659
|
+
var _input_current2;
|
|
11660
|
+
(_input_current2 = input.current) === null || _input_current2 === void 0 ? void 0 : _input_current2.blur();
|
|
11661
|
+
closeList();
|
|
11642
11662
|
} else {
|
|
11643
11663
|
var _input_current1;
|
|
11644
11664
|
(_input_current1 = input.current) === null || _input_current1 === void 0 ? void 0 : _input_current1.focus();
|
|
@@ -11658,10 +11678,11 @@ function Select(props) {
|
|
|
11658
11678
|
(optionsMode === "normal" || hasEnoughSymbolsToSearch)
|
|
11659
11679
|
);
|
|
11660
11680
|
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;
|
|
11681
|
+
var _input_current_parentElement;
|
|
11661
11682
|
var popperData = useDropdown({
|
|
11662
11683
|
isOpen,
|
|
11663
11684
|
onDropdownClose: handleListClose,
|
|
11664
|
-
referenceElement: inputWrapper.current,
|
|
11685
|
+
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,
|
|
11665
11686
|
dropdownElement: list.current,
|
|
11666
11687
|
options: dropdownOptions,
|
|
11667
11688
|
dependenciesForPositionUpdating: [
|
|
@@ -11670,10 +11691,11 @@ function Select(props) {
|
|
|
11670
11691
|
]
|
|
11671
11692
|
});
|
|
11672
11693
|
useEffect(function() {
|
|
11673
|
-
var
|
|
11674
|
-
|
|
11675
|
-
return isNotEmpty(
|
|
11676
|
-
})
|
|
11694
|
+
var focusedCellIndex = isNotEmpty(strValue) ? optionsIndexesForNavigation.find(function(index) {
|
|
11695
|
+
var option = filteredOptions[index];
|
|
11696
|
+
return isNotEmpty(option) && convertToId(option) === convertToId(strValue);
|
|
11697
|
+
}) : void 0;
|
|
11698
|
+
setFocusedListCellIndex(focusedCellIndex !== null && focusedCellIndex !== void 0 ? focusedCellIndex : optionsIndexesForNavigation[0]);
|
|
11677
11699
|
}, [
|
|
11678
11700
|
strValue,
|
|
11679
11701
|
filteredOptions,
|
|
@@ -11687,11 +11709,24 @@ function Select(props) {
|
|
|
11687
11709
|
}, [
|
|
11688
11710
|
isOpen
|
|
11689
11711
|
]);
|
|
11712
|
+
var searchInputEl = hasSearchInputInList && /* @__PURE__ */ jsx(SearchInput, _object_spread$H({
|
|
11713
|
+
value: searchValue,
|
|
11714
|
+
onChange: handleInputChange,
|
|
11715
|
+
tweakStyles: tweakSearchInputStyles,
|
|
11716
|
+
placeholder: "Поиск"
|
|
11717
|
+
}, searchInputProps));
|
|
11718
|
+
var customHeader = (isReactNodeNotEmpty(searchInputEl) || isReactNodeNotEmpty(header)) && /* @__PURE__ */ jsxs(Fragment, {
|
|
11719
|
+
children: [
|
|
11720
|
+
searchInputEl,
|
|
11721
|
+
header
|
|
11722
|
+
]
|
|
11723
|
+
});
|
|
11690
11724
|
var _obj2;
|
|
11691
11725
|
var listEl = /* @__PURE__ */ jsx("div", _object_spread_props$C(_object_spread$H({
|
|
11692
11726
|
className: clsx(classes.listWrapper, (_obj2 = {}, _define_property$J(_obj2, classes.withoutPopper, !shouldUsePopper), _define_property$J(_obj2, classes.listWrapperInBody, shouldRenderInBody), _obj2)),
|
|
11693
11727
|
ref: list,
|
|
11694
11728
|
style: popperData === null || popperData === void 0 ? void 0 : popperData.styles.popper,
|
|
11729
|
+
tabIndex: 0,
|
|
11695
11730
|
onBlur: handleBlur
|
|
11696
11731
|
}, popperData === null || popperData === void 0 ? void 0 : popperData.attributes.popper), {
|
|
11697
11732
|
children: isOpen && /* @__PURE__ */ jsx(SelectList, {
|
|
@@ -11699,12 +11734,8 @@ function Select(props) {
|
|
|
11699
11734
|
defaultOptionLabel: hasDefaultOption && shouldShowDefaultOption && defaultOptionLabel,
|
|
11700
11735
|
allOptionsLabel: shouldShowAllOption && allOptionsLabel,
|
|
11701
11736
|
areAllOptionsSelected,
|
|
11702
|
-
customListHeader:
|
|
11703
|
-
|
|
11704
|
-
onChange: handleInputChange,
|
|
11705
|
-
tweakStyles: tweakSearchInputStyles,
|
|
11706
|
-
placeholder: "Поиск"
|
|
11707
|
-
}, searchInputProps)),
|
|
11737
|
+
customListHeader: customHeader,
|
|
11738
|
+
customListFooter: footer,
|
|
11708
11739
|
noMatchesLabel,
|
|
11709
11740
|
focusedIndex: focusedListCellIndex,
|
|
11710
11741
|
activeValue: value,
|
|
@@ -11712,13 +11743,14 @@ function Select(props) {
|
|
|
11712
11743
|
loadingLabel,
|
|
11713
11744
|
tweakStyles: tweakSelectListStyles,
|
|
11714
11745
|
testId: getTestId(testId, "list"),
|
|
11746
|
+
isMultiSelect,
|
|
11715
11747
|
shouldScrollToList: shouldScrollToList && !shouldUsePopper && !shouldHideOnScroll,
|
|
11716
11748
|
isOptionDisabled,
|
|
11717
11749
|
convertValueToString,
|
|
11718
11750
|
convertValueToReactNode,
|
|
11719
11751
|
convertValueToId: convertToId,
|
|
11720
11752
|
onOptionSelect: handleOptionSelect,
|
|
11721
|
-
onToggleCheckbox:
|
|
11753
|
+
onToggleCheckbox: handleToggleOptionCheckbox
|
|
11722
11754
|
})
|
|
11723
11755
|
}));
|
|
11724
11756
|
var multiSelectCounterWithIcon = shouldShowMultiSelectCounter || isNotEmpty(iconType) ? /* @__PURE__ */ jsxs(Fragment, {
|
|
@@ -11740,6 +11772,7 @@ function Select(props) {
|
|
|
11740
11772
|
return /* @__PURE__ */ jsxs("div", {
|
|
11741
11773
|
className: classes.root,
|
|
11742
11774
|
onKeyDown: handleKeyDown,
|
|
11775
|
+
ref: root2,
|
|
11743
11776
|
children: [
|
|
11744
11777
|
/* @__PURE__ */ jsxs("div", {
|
|
11745
11778
|
className: clsx(classes.inputWrapper, isDisabled && classes.disabled),
|
|
@@ -13776,13 +13809,14 @@ var defaultConvertFunction$1 = function(val) {
|
|
|
13776
13809
|
return String(val);
|
|
13777
13810
|
};
|
|
13778
13811
|
var getPrevSpaces = function(val, position) {
|
|
13779
|
-
return val.slice(0, position
|
|
13812
|
+
return val.slice(0, position).split("").filter(isSpaceChar).length;
|
|
13780
13813
|
};
|
|
13781
13814
|
var getNewCaretPosition = function(defaultPosition, oldValue, newValue, isDeleteForwardAction) {
|
|
13782
13815
|
if (oldValue === newValue) {
|
|
13783
13816
|
return isDeleteForwardAction ? defaultPosition + 1 : defaultPosition;
|
|
13784
13817
|
}
|
|
13785
|
-
var
|
|
13818
|
+
var isAdding = newValue.length > oldValue.length;
|
|
13819
|
+
var oldPrevSpaces = getPrevSpaces(oldValue, defaultPosition - (isAdding ? 1 : 0));
|
|
13786
13820
|
var newPrevSpaces = getPrevSpaces(newValue, defaultPosition);
|
|
13787
13821
|
var diff = newPrevSpaces - oldPrevSpaces;
|
|
13788
13822
|
var res = defaultPosition + diff;
|