intelicoreact 1.3.50 → 1.3.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Atomic/FormElements/ActionAlert/ActionAlert.js +1 -9
- package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.js +1 -10
- package/dist/Atomic/FormElements/Calendar/Calendar.js +4 -24
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +1 -10
- package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.js +2 -14
- package/dist/Atomic/FormElements/Datepicker/Datepicker.js +5 -54
- package/dist/Atomic/FormElements/Datepicker/components/Calendar.js +3 -21
- package/dist/Atomic/FormElements/Dropdown/Dropdown.js +50 -142
- package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +1 -7
- package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.js +35 -46
- package/dist/Atomic/FormElements/FileLoader/FileLoader.js +3 -15
- package/dist/Atomic/FormElements/FileLoader/partial/LoadZone.js +15 -29
- package/dist/Atomic/FormElements/FileLoader/partial/LoadedContent.js +5 -15
- package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +6 -26
- package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.js +19 -35
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.js +9 -38
- package/dist/Atomic/FormElements/Input/Input.js +24 -57
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +4 -31
- package/dist/Atomic/FormElements/InputColor/InputColor.js +4 -14
- package/dist/Atomic/FormElements/InputCurrency/InputCurrency.js +6 -27
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +7 -42
- package/dist/Atomic/FormElements/InputDateRange/components/DateInput.js +3 -21
- package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +58 -81
- package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +6 -41
- package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +1 -8
- package/dist/Atomic/FormElements/InputDateRange/dependencies.js +14 -44
- package/dist/Atomic/FormElements/InputLink/InputLink.js +6 -23
- package/dist/Atomic/FormElements/InputMask/InputCarretPosition.js +0 -4
- package/dist/Atomic/FormElements/InputMask/InputMask.js +77 -208
- package/dist/Atomic/FormElements/InputMask/functions.js +2 -28
- package/dist/Atomic/FormElements/InputMask2/InputMask2.js +43 -119
- package/dist/Atomic/FormElements/InputMask2/functions.js +2 -28
- package/dist/Atomic/FormElements/InputMask3/InputMask3.js +44 -137
- package/dist/Atomic/FormElements/InputMask3/functions.js +2 -28
- package/dist/Atomic/FormElements/InputWithAction/InputWithAction.js +3 -17
- package/dist/Atomic/FormElements/InputsRow/InputsRow.js +5 -24
- package/dist/Atomic/FormElements/Label/Label.js +1 -9
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +35 -73
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +3 -15
- package/dist/Atomic/FormElements/NumericInput/NumericInput.js +23 -44
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +7 -17
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +3 -14
- package/dist/Atomic/FormElements/RadioInput/RadioInput.js +1 -10
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +3 -14
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +3 -23
- package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js +17 -34
- package/dist/Atomic/FormElements/RangeList/RangeList.js +6 -25
- package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +1 -11
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +14 -72
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +40 -124
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +1 -10
- package/dist/Atomic/FormElements/Switcher/Switcher.js +1 -10
- package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +1 -13
- package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.js +1 -10
- package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.js +2 -17
- package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.js +3 -17
- package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +1 -11
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +6 -29
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/partial/States.js +2 -3
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +1 -12
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +99 -163
- package/dist/Atomic/FormElements/Text/Text.js +10 -16
- package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.js +1 -9
- package/dist/Atomic/FormElements/Textarea/Textarea.js +3 -16
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +6 -35
- package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.js +4 -13
- package/dist/Atomic/FormElements/TimeRange/TimeRange.js +7 -21
- package/dist/Atomic/FormElements/UserContacts/UserContacts.js +8 -35
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +5 -18
- package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.js +3 -10
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +3 -11
- package/dist/Atomic/FormElements/WidgetPseudoTable/partial/constructor.js +1 -2
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +5 -12
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/constructor.js +3 -3
- package/dist/Atomic/Layout/Header/Header.js +3 -15
- package/dist/Atomic/Layout/MainMenu/MainMenu.js +3 -20
- package/dist/Atomic/Layout/Spinner/Spinner.js +1 -8
- package/dist/Atomic/UI/Accordion/Accordion.js +3 -19
- package/dist/Atomic/UI/Accordion/AccordionItem.js +9 -23
- package/dist/Atomic/UI/AccordionTable/AccordionTable.js +7 -32
- package/dist/Atomic/UI/AccordionText/AccordionText.js +3 -15
- package/dist/Atomic/UI/AdvancedTag/AdvTag.js +4 -21
- package/dist/Atomic/UI/AdvancedTag/AdvancedTags.js +3 -15
- package/dist/Atomic/UI/Alert/Alert.js +3 -16
- package/dist/Atomic/UI/Arrow/Arrow.js +3 -16
- package/dist/Atomic/UI/Box/Box.js +3 -9
- package/dist/Atomic/UI/Button/Button.js +2 -11
- package/dist/Atomic/UI/ButtonsBar/ButtonsBar.js +1 -10
- package/dist/Atomic/UI/Chart/Chart.js +4 -29
- package/dist/Atomic/UI/Chart/partial/Chart.constants.js +11 -19
- package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +1 -12
- package/dist/Atomic/UI/Chart/partial/datasetSetters.js +11 -34
- package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +82 -56
- package/dist/Atomic/UI/Chart/partial/optionsSetters.js +15 -19
- package/dist/Atomic/UI/Chart/partial/utils.js +6 -20
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +3 -13
- package/dist/Atomic/UI/DateTime/DateTime.js +3 -14
- package/dist/Atomic/UI/DebugContainer/DebugContainer.js +4 -16
- package/dist/Atomic/UI/DebugContainer/useDebugContainer.js +3 -11
- package/dist/Atomic/UI/DoubleString/DoubleString.js +5 -17
- package/dist/Atomic/UI/DynamicIcon/DynamicIcon.js +3 -10
- package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +17 -52
- package/dist/Atomic/UI/ExampleChartIntegration/partial/utils.js +1 -29
- package/dist/Atomic/UI/Hint/Hint.js +5 -30
- package/dist/Atomic/UI/Modal/Modal.js +6 -28
- package/dist/Atomic/UI/Modal/ModalHOC.js +1 -9
- package/dist/Atomic/UI/Modal/partials/ModalFooter.js +1 -7
- package/dist/Atomic/UI/Modal/partials/ModalTitle.js +1 -8
- package/dist/Atomic/UI/Modal/partials/useMobileModal.js +32 -49
- package/dist/Atomic/UI/ModalBackup/Modal.js +65 -90
- package/dist/Atomic/UI/ModalBackup/ModalHOC.js +12 -21
- package/dist/Atomic/UI/ModalBackup/partials/ModalFooter.js +6 -11
- package/dist/Atomic/UI/ModalBackup/partials/ModalTitle.js +15 -19
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +6 -21
- package/dist/Atomic/UI/NavLine/NavLine.js +26 -55
- package/dist/Atomic/UI/NavLine/Tabs.js +2 -3
- package/dist/Atomic/UI/PageTitle/PageTitle.js +2 -10
- package/dist/Atomic/UI/PieChart/PieChart.js +1 -10
- package/dist/Atomic/UI/Price/Price.js +3 -8
- package/dist/Atomic/UI/PriceRange/PriceRange.js +1 -7
- package/dist/Atomic/UI/ProgressLine/ProgressLine.js +1 -16
- package/dist/Atomic/UI/Status/Status.js +1 -8
- package/dist/Atomic/UI/Table/Partials/TdCell.js +5 -29
- package/dist/Atomic/UI/Table/Partials/TdHeader.js +1 -11
- package/dist/Atomic/UI/Table/Partials/TdRow.js +5 -17
- package/dist/Atomic/UI/Table/Partials/TdTitle.js +3 -14
- package/dist/Atomic/UI/Table/Table.js +1 -12
- package/dist/Atomic/UI/Table/TdTypes/TdActions.js +2 -18
- package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +1 -9
- package/dist/Atomic/UI/Table/TdTypes/TdRange.js +1 -4
- package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +1 -13
- package/dist/Atomic/UI/Tag/Tag.js +3 -14
- package/dist/Atomic/UI/TagList/TagList.js +19 -35
- package/dist/Atomic/UI/UserBox/UserBox.js +1 -13
- package/dist/Classes/AbortableFetch.js +36 -93
- package/dist/Classes/AnimatedHandler.js +3 -7
- package/dist/Classes/RESTAPI/index.js +39 -43
- package/dist/Classes/RESTAPI/partials/AbortableFetch.js +35 -93
- package/dist/Classes/RESTAPI/partials/ApiBase.js +1 -9
- package/dist/Classes/RESTAPI/partials/ApiRequestCreators.js +7 -19
- package/dist/Classes/RESTAPI/partials/ApiUtils.js +28 -35
- package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +21 -44
- package/dist/Classes/RESTAPI/partials/Utils.js +6 -19
- package/dist/Classes/RESTAPI/partials/_outerDependencies.js +2 -6
- package/dist/Classes/RESTAPI/partials/_utils.js +13 -36
- package/dist/Constants/index.constants.js +8 -15
- package/dist/Functions/Portal.js +5 -16
- package/dist/Functions/customEventListener.js +4 -17
- package/dist/Functions/fieldValueFormatters.js +43 -83
- package/dist/Functions/hooks/useFormFieldsChangesManager.js +23 -26
- package/dist/Functions/locale/createTranslator.js +4 -9
- package/dist/Functions/operations.js +12 -22
- package/dist/Functions/presets/inputMaskPresets.js +9 -11
- package/dist/Functions/presets/inputPresets.js +8 -11
- package/dist/Functions/presets/mobileKeyboardTypesPresets.js +7 -9
- package/dist/Functions/schemas.js +6 -13
- package/dist/Functions/useBodyScrollLock.js +1 -6
- package/dist/Functions/useClickOutside.js +0 -4
- package/dist/Functions/useDebounce.js +2 -7
- package/dist/Functions/useFieldFocus.js +6 -18
- package/dist/Functions/useFormTools/form-drivers/ArrayWithObjects.js +0 -9
- package/dist/Functions/useFormTools/form-drivers/ObjectWithIterableObjects.js +12 -23
- package/dist/Functions/useFormTools/form-drivers/ObjectWithNamedKeyObjects.js +6 -15
- package/dist/Functions/useFormTools/functions/General.js +18 -28
- package/dist/Functions/useFormTools/functions/RenderFields.js +2 -11
- package/dist/Functions/useFormTools/functions/usePrevious.js +1 -5
- package/dist/Functions/useFormTools/index.js +85 -144
- package/dist/Functions/useInputHighlightError.js +3 -12
- package/dist/Functions/useIsMobile.js +7 -12
- package/dist/Functions/useKeyPress/useHandleKeyPress.js +1 -7
- package/dist/Functions/useKeyPress/useKeyPress.js +1 -9
- package/dist/Functions/useLocalStorage.js +1 -9
- package/dist/Functions/useLocationParams.js +4 -5
- package/dist/Functions/useMetaInfo.js +3 -10
- package/dist/Functions/useMouseUpOutside.js +0 -3
- package/dist/Functions/useOnlineStatus.js +1 -9
- package/dist/Functions/usePasswordChecker.js +4 -20
- package/dist/Functions/usePrevious.js +1 -5
- package/dist/Functions/useResize.js +2 -10
- package/dist/Functions/useScrollTo.js +2 -7
- package/dist/Functions/useToggle.js +1 -5
- package/dist/Functions/utils.js +49 -128
- package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +2 -9
- package/dist/Molecular/CustomIcons/components/AlertCircle.js +2 -9
- package/dist/Molecular/CustomIcons/components/AppStore.js +2 -9
- package/dist/Molecular/CustomIcons/components/Arrow.js +2 -9
- package/dist/Molecular/CustomIcons/components/ArrowDown.js +2 -9
- package/dist/Molecular/CustomIcons/components/ArrowLeft.js +2 -9
- package/dist/Molecular/CustomIcons/components/ArrowRight.js +2 -9
- package/dist/Molecular/CustomIcons/components/ArrowUp.js +2 -9
- package/dist/Molecular/CustomIcons/components/Bell.js +2 -9
- package/dist/Molecular/CustomIcons/components/Button.js +2 -9
- package/dist/Molecular/CustomIcons/components/Campaigns.js +2 -9
- package/dist/Molecular/CustomIcons/components/Check.js +2 -9
- package/dist/Molecular/CustomIcons/components/Check2.js +2 -9
- package/dist/Molecular/CustomIcons/components/ChevronDown.js +2 -9
- package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +2 -9
- package/dist/Molecular/CustomIcons/components/ChevronLeft.js +2 -9
- package/dist/Molecular/CustomIcons/components/ChevronRight.js +2 -9
- package/dist/Molecular/CustomIcons/components/ChevronUp.js +2 -9
- package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +2 -9
- package/dist/Molecular/CustomIcons/components/Close.js +2 -9
- package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +2 -9
- package/dist/Molecular/CustomIcons/components/Delete.js +2 -9
- package/dist/Molecular/CustomIcons/components/Edit.js +2 -9
- package/dist/Molecular/CustomIcons/components/Email.js +2 -9
- package/dist/Molecular/CustomIcons/components/FinturfLogo.js +2 -9
- package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +2 -9
- package/dist/Molecular/CustomIcons/components/Flows.js +2 -9
- package/dist/Molecular/CustomIcons/components/Gift.js +2 -9
- package/dist/Molecular/CustomIcons/components/GoogleAuth.js +2 -9
- package/dist/Molecular/CustomIcons/components/GooglePlay.js +2 -9
- package/dist/Molecular/CustomIcons/components/HelpCircle.js +2 -9
- package/dist/Molecular/CustomIcons/components/HelpCircle2.js +2 -9
- package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +2 -9
- package/dist/Molecular/CustomIcons/components/Home.js +2 -9
- package/dist/Molecular/CustomIcons/components/Home2.js +2 -9
- package/dist/Molecular/CustomIcons/components/Key.js +2 -9
- package/dist/Molecular/CustomIcons/components/Landers.js +2 -9
- package/dist/Molecular/CustomIcons/components/Lock.js +2 -9
- package/dist/Molecular/CustomIcons/components/Mail.js +2 -9
- package/dist/Molecular/CustomIcons/components/Mastercard.js +2 -9
- package/dist/Molecular/CustomIcons/components/Minus.js +2 -9
- package/dist/Molecular/CustomIcons/components/Offers.js +2 -9
- package/dist/Molecular/CustomIcons/components/Pause.js +2 -9
- package/dist/Molecular/CustomIcons/components/PayPal.js +2 -9
- package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +2 -9
- package/dist/Molecular/CustomIcons/components/Phone.js +2 -9
- package/dist/Molecular/CustomIcons/components/Play.js +2 -9
- package/dist/Molecular/CustomIcons/components/Plus.js +2 -9
- package/dist/Molecular/CustomIcons/components/Profile.js +2 -9
- package/dist/Molecular/CustomIcons/components/QRCode.js +2 -9
- package/dist/Molecular/CustomIcons/components/Rectangle.js +2 -9
- package/dist/Molecular/CustomIcons/components/Revert.js +2 -9
- package/dist/Molecular/CustomIcons/components/Star.js +2 -9
- package/dist/Molecular/CustomIcons/components/Star2.js +2 -9
- package/dist/Molecular/CustomIcons/components/TrafficSources.js +2 -9
- package/dist/Molecular/CustomIcons/components/Trash.js +2 -9
- package/dist/Molecular/CustomIcons/components/TrashRed.js +2 -9
- package/dist/Molecular/CustomIcons/components/Triggers.js +2 -9
- package/dist/Molecular/CustomIcons/components/User.js +2 -9
- package/dist/Molecular/CustomIcons/components/Visa.js +2 -9
- package/dist/Molecular/CustomIcons/components/X.js +2 -9
- package/dist/Molecular/CustomIcons/index.js +0 -122
- package/dist/Molecular/FormElement/FormElement.js +1 -12
- package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +30 -31
- package/dist/Molecular/FormWithDependOn/partials/_utils.js +9 -12
- package/dist/Molecular/InputAddress/InputAddress.js +65 -114
- package/dist/Molecular/InputPassword/InputPassword.js +5 -19
- package/dist/index.js +0 -2
- package/package.json +1 -1
- package/dist/Atomic/FormElements/UserContacts/partial/defaultIcons.js +0 -91
|
@@ -1,48 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
|
|
14
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
-
|
|
16
11
|
var _reactDom = require("react-dom");
|
|
17
|
-
|
|
18
12
|
var _reactFeather = require("react-feather");
|
|
19
|
-
|
|
20
13
|
var _fieldValueFormatters = require("../../../Functions/fieldValueFormatters");
|
|
21
|
-
|
|
22
14
|
var _useDebounce = require("../../../Functions/useDebounce");
|
|
23
|
-
|
|
24
15
|
var _useIsMobile = _interopRequireDefault(require("../../../Functions/useIsMobile"));
|
|
25
|
-
|
|
26
16
|
var _CheckboxInput = _interopRequireDefault(require("../../FormElements/CheckboxInput/CheckboxInput"));
|
|
27
|
-
|
|
28
17
|
var _Input = _interopRequireDefault(require("../../FormElements/Input/Input"));
|
|
29
|
-
|
|
30
18
|
var _Tag = _interopRequireDefault(require("../../UI/Tag/Tag"));
|
|
31
|
-
|
|
32
19
|
var _TagList = _interopRequireDefault(require("../../UI/TagList/TagList"));
|
|
33
|
-
|
|
34
20
|
require("./TagsDropdown.scss");
|
|
35
|
-
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
39
|
-
|
|
21
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
22
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
40
23
|
const RC = "tags-dropdown";
|
|
41
24
|
const MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH = 10;
|
|
42
|
-
|
|
43
25
|
const TagsDropdown = _ref => {
|
|
44
|
-
var _Object$keys, _dropdownListWrapperR,
|
|
45
|
-
|
|
26
|
+
var _Object$keys, _dropdownListWrapperR, _dropdownListRef$curr5, _dropdownListRef$curr6;
|
|
46
27
|
let {
|
|
47
28
|
options,
|
|
48
29
|
chosenOptions = [],
|
|
@@ -106,35 +87,34 @@ const TagsDropdown = _ref => {
|
|
|
106
87
|
const [localOptionsStore, setLocalOptionsStore] = (0, _react.useState)({});
|
|
107
88
|
const singleLevelOptions = options === null || options === void 0 ? void 0 : options.reduce((acc, item) => {
|
|
108
89
|
const checkUniqAndPush = (acc, item) => {
|
|
109
|
-
const isExist = acc === null || acc === void 0 ? void 0 : acc.findIndex(
|
|
110
|
-
|
|
90
|
+
const isExist = acc === null || acc === void 0 ? void 0 : acc.findIndex(_ref2 => {
|
|
91
|
+
let {
|
|
92
|
+
value
|
|
93
|
+
} = _ref2;
|
|
94
|
+
return value === (item === null || item === void 0 ? void 0 : item.value);
|
|
95
|
+
});
|
|
111
96
|
if (isExist !== -1) {
|
|
112
97
|
acc[isExist] = item;
|
|
113
98
|
} else {
|
|
114
99
|
acc.push(item);
|
|
115
100
|
}
|
|
116
101
|
};
|
|
117
|
-
|
|
118
102
|
if (item.groupName) {
|
|
119
103
|
var _item$list;
|
|
120
|
-
|
|
121
|
-
(_item$list = item.list) === null || _item$list === void 0 ? void 0 : _item$list.map(item => checkUniqAndPush(acc, item));
|
|
104
|
+
(_item$list = item.list) === null || _item$list === void 0 || _item$list.map(item => checkUniqAndPush(acc, item));
|
|
122
105
|
} else {
|
|
123
106
|
checkUniqAndPush(acc, item);
|
|
124
107
|
}
|
|
125
|
-
|
|
126
108
|
return acc;
|
|
127
109
|
}, (_Object$keys = Object.keys(localOptionsStore)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.map(value => ({
|
|
128
110
|
value,
|
|
129
111
|
label: localOptionsStore === null || localOptionsStore === void 0 ? void 0 : localOptionsStore[value]
|
|
130
112
|
})));
|
|
131
|
-
|
|
132
113
|
const setSearchValueInterceptor = value => {
|
|
133
114
|
setSearchValue(value);
|
|
134
115
|
setIsValueDeleted(value === "");
|
|
135
116
|
searchValueRef.current = value;
|
|
136
117
|
};
|
|
137
|
-
|
|
138
118
|
const doScrollCallback = (0, _react.useCallback)(e => {
|
|
139
119
|
if (doLiveSearchRequest && typeof doLiveSearchRequest === "function") {
|
|
140
120
|
if (Math.round(e.target.clientHeight + e.target.scrollTop) == e.target.scrollHeight) {
|
|
@@ -142,58 +122,48 @@ const TagsDropdown = _ref => {
|
|
|
142
122
|
}
|
|
143
123
|
}
|
|
144
124
|
}, [options]);
|
|
145
|
-
|
|
146
|
-
const handleClickOutside = _ref2 => {
|
|
125
|
+
const handleClickOutside = _ref3 => {
|
|
147
126
|
var _getListContainer;
|
|
148
|
-
|
|
149
127
|
let {
|
|
150
128
|
target
|
|
151
|
-
} =
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
!((_getListContainer = getListContainer()) !== null && _getListContainer !== void 0 && _getListContainer.contains(target))
|
|
155
|
-
/* && !isTargetInParent(target) */
|
|
156
|
-
) {
|
|
129
|
+
} = _ref3;
|
|
130
|
+
if (
|
|
131
|
+
// eslint-disable-next-line no-use-before-define
|
|
132
|
+
!((_getListContainer = getListContainer()) !== null && _getListContainer !== void 0 && _getListContainer.contains(target)) /* && !isTargetInParent(target) */) {
|
|
157
133
|
setIsOpen(false);
|
|
158
134
|
setSearchValueInterceptor("");
|
|
159
135
|
}
|
|
160
136
|
};
|
|
161
|
-
|
|
162
137
|
const deleteChosen = value => {
|
|
163
138
|
if (isMobile ? closeOnRemoveMobile : closeOnRemove) setIsOpen(false);
|
|
164
|
-
setLocalOptionsStore(options => ({
|
|
139
|
+
setLocalOptionsStore(options => ({
|
|
140
|
+
...options,
|
|
165
141
|
[value]: undefined
|
|
166
142
|
}));
|
|
167
143
|
onChange(chosenOptions.filter(item => item !== value), "chosenOptions");
|
|
168
144
|
};
|
|
169
|
-
|
|
170
145
|
const onChangeHandler = item => {
|
|
171
146
|
if (item !== null && item !== void 0 && item.isFreezed) return false;
|
|
172
|
-
|
|
173
147
|
if ((item === null || item === void 0 ? void 0 : item.closeOnOptionSelect) !== undefined) {
|
|
174
148
|
if (item.closeOnOptionSelect) setIsOpen(false);
|
|
175
149
|
} else if (isMobile ? closeOnSelectMobile : closeOnSelect) setIsOpen(false);
|
|
176
|
-
|
|
177
150
|
setSearchValueInterceptor("");
|
|
178
|
-
|
|
179
151
|
if (chosenOptions.some(el => el === item.value)) {
|
|
180
152
|
deleteChosen(item.value);
|
|
181
153
|
return null;
|
|
182
154
|
}
|
|
183
|
-
|
|
184
|
-
|
|
155
|
+
setLocalOptionsStore(options => ({
|
|
156
|
+
...options,
|
|
185
157
|
[item === null || item === void 0 ? void 0 : item.value]: item === null || item === void 0 ? void 0 : item.label
|
|
186
158
|
}));
|
|
187
159
|
onChange([...chosenOptions, item.value], "chosenOptions");
|
|
188
160
|
return null;
|
|
189
161
|
};
|
|
190
|
-
|
|
191
162
|
const onSearchHandler = name => {
|
|
192
163
|
let inputValue = name;
|
|
193
164
|
if (!isNotValidateASCII) inputValue = (0, _fieldValueFormatters.formatToOnlyASCIICodeText)(inputValue);
|
|
194
165
|
setSearchValueInterceptor(inputValue);
|
|
195
166
|
};
|
|
196
|
-
|
|
197
167
|
const onWrapperClick = e => {
|
|
198
168
|
if (e.target === (wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current)) {
|
|
199
169
|
e.stopPropagation();
|
|
@@ -201,27 +171,22 @@ const TagsDropdown = _ref => {
|
|
|
201
171
|
setIsOpen(false);
|
|
202
172
|
}
|
|
203
173
|
};
|
|
204
|
-
|
|
205
174
|
const getMarkupForElement = item => {
|
|
206
175
|
var _title$toString, _item$customMobileIco;
|
|
207
|
-
|
|
208
176
|
const {
|
|
209
177
|
description
|
|
210
178
|
} = item;
|
|
211
179
|
const title = item.title || item.label;
|
|
212
|
-
|
|
213
180
|
const hightlightSearchValue = title => {
|
|
214
181
|
var _title$toLowerCase;
|
|
215
|
-
|
|
216
182
|
const index = (_title$toLowerCase = title.toLowerCase()) === null || _title$toLowerCase === void 0 ? void 0 : _title$toLowerCase.indexOf(searchValue.toLowerCase());
|
|
217
183
|
if (index === -1) return title;
|
|
218
184
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, title.substring(0, index), /*#__PURE__*/_react.default.createElement("span", {
|
|
219
185
|
className: "search-match"
|
|
220
186
|
}, title.substring(index, index + (searchValue === null || searchValue === void 0 ? void 0 : searchValue.length))), title.substring(index + (searchValue === null || searchValue === void 0 ? void 0 : searchValue.length)));
|
|
221
187
|
};
|
|
222
|
-
|
|
223
188
|
return /*#__PURE__*/_react.default.createElement("button", {
|
|
224
|
-
key: title === null || title === void 0
|
|
189
|
+
key: title === null || title === void 0 || (_title$toString = title.toString()) === null || _title$toString === void 0 ? void 0 : _title$toString.replace(/ /g, "_"),
|
|
225
190
|
onClick: e => {
|
|
226
191
|
e.preventDefault();
|
|
227
192
|
e.stopPropagation();
|
|
@@ -255,102 +220,85 @@ const TagsDropdown = _ref => {
|
|
|
255
220
|
}
|
|
256
221
|
}) : "");
|
|
257
222
|
};
|
|
258
|
-
|
|
259
223
|
const prepareOptions = options => {
|
|
260
224
|
return options === null || options === void 0 ? void 0 : options.map(option => option !== null && option !== void 0 && option.groupName ? option === null || option === void 0 ? void 0 : option.list : option).flat();
|
|
261
225
|
};
|
|
262
|
-
|
|
263
226
|
const selectAllItems = () => {
|
|
264
227
|
var _prepareOptions;
|
|
265
|
-
|
|
266
|
-
const preparedOptions = (_prepareOptions = prepareOptions(options)) === null || _prepareOptions === void 0 ? void 0 : _prepareOptions.filter(_ref3 => {
|
|
228
|
+
const preparedOptions = (_prepareOptions = prepareOptions(options)) === null || _prepareOptions === void 0 ? void 0 : _prepareOptions.filter(_ref4 => {
|
|
267
229
|
let {
|
|
268
230
|
isFreezed,
|
|
269
231
|
value
|
|
270
|
-
} =
|
|
232
|
+
} = _ref4;
|
|
271
233
|
return !isFreezed && !(chosenOptions !== null && chosenOptions !== void 0 && chosenOptions.includes(value)) && value !== "open_modal";
|
|
272
234
|
});
|
|
273
|
-
setLocalOptionsStore(options => preparedOptions === null || preparedOptions === void 0 ? void 0 : preparedOptions.reduce((result,
|
|
235
|
+
setLocalOptionsStore(options => preparedOptions === null || preparedOptions === void 0 ? void 0 : preparedOptions.reduce((result, _ref5) => {
|
|
274
236
|
let {
|
|
275
237
|
value,
|
|
276
238
|
label
|
|
277
|
-
} =
|
|
239
|
+
} = _ref5;
|
|
278
240
|
result[value] = label;
|
|
279
241
|
return result;
|
|
280
242
|
}, options));
|
|
281
|
-
onChange([...chosenOptions, ...((preparedOptions === null || preparedOptions === void 0 ? void 0 : preparedOptions.map(
|
|
243
|
+
onChange([...chosenOptions, ...((preparedOptions === null || preparedOptions === void 0 ? void 0 : preparedOptions.map(_ref6 => {
|
|
282
244
|
let {
|
|
283
245
|
value
|
|
284
|
-
} =
|
|
246
|
+
} = _ref6;
|
|
285
247
|
return value;
|
|
286
248
|
})) || [])], "chosenOptions");
|
|
287
249
|
if (isMobile ? closeOnSelectAllMobile : closeOnSelectAll) setIsOpen(false);
|
|
288
250
|
};
|
|
289
|
-
|
|
290
251
|
const unselectAllItems = () => {
|
|
291
252
|
setLocalOptionsStore({});
|
|
292
253
|
onChange(chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.filter(item => {
|
|
293
|
-
var _prepareOptions2
|
|
294
|
-
|
|
295
|
-
return (_prepareOptions2 = prepareOptions(options)) === null || _prepareOptions2 === void 0 ? void 0 : (_prepareOptions2$find = _prepareOptions2.find(_ref6 => {
|
|
254
|
+
var _prepareOptions2;
|
|
255
|
+
return (_prepareOptions2 = prepareOptions(options)) === null || _prepareOptions2 === void 0 || (_prepareOptions2 = _prepareOptions2.find(_ref7 => {
|
|
296
256
|
let {
|
|
297
257
|
value
|
|
298
|
-
} =
|
|
258
|
+
} = _ref7;
|
|
299
259
|
return value === item;
|
|
300
|
-
})) === null || _prepareOptions2
|
|
260
|
+
})) === null || _prepareOptions2 === void 0 ? void 0 : _prepareOptions2.isFreezed;
|
|
301
261
|
}), "chosenOptions");
|
|
302
262
|
if (isMobile ? closeOnRemoveAllMobile : closeOnRemoveAll) setIsOpen(false);
|
|
303
263
|
};
|
|
304
|
-
|
|
305
264
|
const getParentNode = () => {
|
|
306
|
-
var
|
|
307
|
-
|
|
308
|
-
return (_ref7 = (_document$querySelect = document.querySelector("div#root")) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector("div#app")) !== null && _ref7 !== void 0 ? _ref7 : document.querySelector("div#storybook-root");
|
|
265
|
+
var _ref8, _document$querySelect;
|
|
266
|
+
return (_ref8 = (_document$querySelect = document.querySelector("div#root")) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector("div#app")) !== null && _ref8 !== void 0 ? _ref8 : document.querySelector("div#storybook-root");
|
|
309
267
|
};
|
|
310
|
-
|
|
311
268
|
const initListContainer = () => {
|
|
312
269
|
const dropdownList = document.createElement("div");
|
|
313
270
|
dropdownList.setAttribute("id", dropdownId);
|
|
314
271
|
dropdownList.classList.add("tags-dropdown__container");
|
|
315
|
-
|
|
316
272
|
if (isMobile) {
|
|
317
273
|
dropdownList.addEventListener("click", e => {
|
|
318
274
|
if (e.target.id === dropdownId) setIsOpen(false);
|
|
319
275
|
});
|
|
320
276
|
}
|
|
321
|
-
|
|
322
277
|
if (isMobile) {
|
|
323
278
|
var _getParentNode;
|
|
324
|
-
|
|
325
279
|
try {
|
|
326
280
|
var _document$getElementB;
|
|
327
|
-
|
|
328
|
-
|
|
281
|
+
(_document$getElementB = document.getElementById("mlw-".concat(dropdownId))) === null || _document$getElementB === void 0 || _document$getElementB.remove();
|
|
282
|
+
// eslint-disable-next-line no-empty
|
|
329
283
|
} catch (e) {}
|
|
330
|
-
|
|
331
284
|
const dropdownMobileListWrapper = document.createElement("div");
|
|
332
285
|
dropdownMobileListWrapper.classList.add("tags-dropdown-mobile");
|
|
333
286
|
dropdownMobileListWrapper.setAttribute("id", "mlw-".concat(dropdownId));
|
|
334
|
-
dropdownMobileListWrapper === null || dropdownMobileListWrapper === void 0
|
|
335
|
-
(_getParentNode = getParentNode()) === null || _getParentNode === void 0
|
|
287
|
+
dropdownMobileListWrapper === null || dropdownMobileListWrapper === void 0 || dropdownMobileListWrapper.append(dropdownList);
|
|
288
|
+
(_getParentNode = getParentNode()) === null || _getParentNode === void 0 || _getParentNode.append(dropdownMobileListWrapper);
|
|
336
289
|
} else {
|
|
337
290
|
var _getParentNode2;
|
|
338
|
-
|
|
339
|
-
(_getParentNode2 = getParentNode()) === null || _getParentNode2 === void 0 ? void 0 : _getParentNode2.append(dropdownList);
|
|
291
|
+
(_getParentNode2 = getParentNode()) === null || _getParentNode2 === void 0 || _getParentNode2.append(dropdownList);
|
|
340
292
|
}
|
|
341
293
|
};
|
|
342
|
-
|
|
343
294
|
const getListContainer = () => {
|
|
344
295
|
return document.getElementById(dropdownId);
|
|
345
296
|
};
|
|
346
|
-
|
|
347
297
|
const getListContainerWrapper = () => {
|
|
348
298
|
return document.getElementById("mlw-".concat(dropdownId));
|
|
349
299
|
};
|
|
350
|
-
|
|
351
300
|
const setListContainerStyles = () => {
|
|
352
|
-
var _dropdownRef$current$, _dropdownRef$current, _getComputedStyle$mar, _getComputedStyle, _getComputedStyle$
|
|
353
|
-
|
|
301
|
+
var _dropdownRef$current$, _dropdownRef$current, _getComputedStyle$mar, _getComputedStyle, _getComputedStyle$max, _getComputedStyle2, _dl$getBoundingClient, _sw$getBoundingClient, _sw$getBoundingClient2, _lh$getBoundingClient, _lf$getBoundingClient;
|
|
354
302
|
const lc = getListContainer();
|
|
355
303
|
if (!lc || !isOpen) return false;
|
|
356
304
|
const windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
|
|
@@ -359,21 +307,21 @@ const TagsDropdown = _ref => {
|
|
|
359
307
|
height,
|
|
360
308
|
left,
|
|
361
309
|
top
|
|
362
|
-
} = (_dropdownRef$current$ = dropdownRef === null || dropdownRef === void 0
|
|
310
|
+
} = (_dropdownRef$current$ = dropdownRef === null || dropdownRef === void 0 || (_dropdownRef$current = dropdownRef.current) === null || _dropdownRef$current === void 0 ? void 0 : _dropdownRef$current.getBoundingClientRect()) !== null && _dropdownRef$current$ !== void 0 ? _dropdownRef$current$ : {};
|
|
363
311
|
const sw = dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : dropdownListWrapperRef.current;
|
|
364
312
|
const dl = lc.getElementsByClassName("tags-dropdown__list")[0];
|
|
365
313
|
const lh = sw === null || sw === void 0 ? void 0 : sw.getElementsByClassName("tags-dropdown__header")[0];
|
|
366
314
|
const lf = sw === null || sw === void 0 ? void 0 : sw.getElementsByClassName("tags-dropdown__footer")[0];
|
|
367
|
-
const margin = parseInt((_getComputedStyle$mar = (_getComputedStyle = getComputedStyle(sw)) === null || _getComputedStyle === void 0
|
|
368
|
-
const maxHeight = initListHeight !== null && initListHeight !== void 0 ? initListHeight : parseInt((_getComputedStyle$max = (_getComputedStyle2 = getComputedStyle(dl)) === null || _getComputedStyle2 === void 0
|
|
315
|
+
const margin = parseInt((_getComputedStyle$mar = (_getComputedStyle = getComputedStyle(sw)) === null || _getComputedStyle === void 0 || (_getComputedStyle = _getComputedStyle.marginTop) === null || _getComputedStyle === void 0 ? void 0 : _getComputedStyle.replace("px", "")) !== null && _getComputedStyle$mar !== void 0 ? _getComputedStyle$mar : 0, 10);
|
|
316
|
+
const maxHeight = initListHeight !== null && initListHeight !== void 0 ? initListHeight : parseInt((_getComputedStyle$max = (_getComputedStyle2 = getComputedStyle(dl)) === null || _getComputedStyle2 === void 0 || (_getComputedStyle2 = _getComputedStyle2.maxHeight) === null || _getComputedStyle2 === void 0 ? void 0 : _getComputedStyle2.replace("px", "")) !== null && _getComputedStyle$max !== void 0 ? _getComputedStyle$max : 0, 10);
|
|
369
317
|
if (initListHeight === null) setInitListHeight(maxHeight);
|
|
370
318
|
const toTop = top - margin;
|
|
371
319
|
const toBottom = windowHeight - top - height - margin * 2;
|
|
372
|
-
const dlHeight = dl === null || dl === void 0
|
|
373
|
-
let swHeight = sw === null || sw === void 0
|
|
320
|
+
const dlHeight = dl === null || dl === void 0 || (_dl$getBoundingClient = dl.getBoundingClientRect()) === null || _dl$getBoundingClient === void 0 ? void 0 : _dl$getBoundingClient.height;
|
|
321
|
+
let swHeight = sw === null || sw === void 0 || (_sw$getBoundingClient = sw.getBoundingClientRect()) === null || _sw$getBoundingClient === void 0 ? void 0 : _sw$getBoundingClient.height;
|
|
374
322
|
const controlsHeight = swHeight - dlHeight;
|
|
375
323
|
if (swHeight > maxHeight) swHeight = maxHeight - 2 * margin;
|
|
376
|
-
const maxSwHeight = isMobile ? (sw === null || sw === void 0
|
|
324
|
+
const maxSwHeight = isMobile ? (sw === null || sw === void 0 || (_sw$getBoundingClient2 = sw.getBoundingClientRect()) === null || _sw$getBoundingClient2 === void 0 ? void 0 : _sw$getBoundingClient2.height) - (lh === null || lh === void 0 || (_lh$getBoundingClient = lh.getBoundingClientRect()) === null || _lh$getBoundingClient === void 0 ? void 0 : _lh$getBoundingClient.height) - (lf === null || lf === void 0 || (_lf$getBoundingClient = lf.getBoundingClientRect()) === null || _lf$getBoundingClient === void 0 ? void 0 : _lf$getBoundingClient.height) : toTop - margin >= maxHeight || toBottom - margin >= maxHeight ? maxHeight - 3 * margin : toTop > toBottom ? toTop - 3 * margin : toBottom - 4 * margin;
|
|
377
325
|
const listPos = toTop < toBottom || toBottom >= swHeight ? "bottom" : "top";
|
|
378
326
|
if (swHeight > (listPos === "top" ? toTop : toBottom)) swHeight = (listPos === "top" ? toTop : toBottom) - 3 * margin;
|
|
379
327
|
lc.style.minWidth = "".concat(width, "px");
|
|
@@ -381,62 +329,51 @@ const TagsDropdown = _ref => {
|
|
|
381
329
|
lc.style.top = "".concat(listPos === "bottom" ? top + height : top - swHeight - 2 * margin, "px");
|
|
382
330
|
dl.style.maxHeight = "".concat(isMobile ? maxSwHeight : maxSwHeight - controlsHeight, "px");
|
|
383
331
|
};
|
|
384
|
-
|
|
385
332
|
const renderListContainer = () => {
|
|
386
333
|
const lc = getListContainer();
|
|
387
|
-
if (!lc) return null;
|
|
334
|
+
if (!lc) return null;
|
|
388
335
|
|
|
336
|
+
// eslint-disable-next-line no-use-before-define
|
|
389
337
|
return /*#__PURE__*/(0, _reactDom.createPortal)(getListMarkUp(), lc);
|
|
390
338
|
};
|
|
391
|
-
|
|
392
339
|
const isTargetInParent = target => {
|
|
393
340
|
var _target$className, _target$className$ind, _target$className2, _target$className2$in;
|
|
394
|
-
|
|
395
341
|
if ((target === null || target === void 0 ? void 0 : target.tagName) === "svg" && (target === null || target === void 0 ? void 0 : target.parentNodclassName) === "tag__button" || (target === null || target === void 0 ? void 0 : target.tagName) === "line") return false;
|
|
396
|
-
if ((target === null || target === void 0 ? void 0 : target.tagName) === "svg" && (target === null || target === void 0 ? void 0 : target.parentNodclassName) !== "tag__button" || (target === null || target === void 0
|
|
342
|
+
if ((target === null || target === void 0 ? void 0 : target.tagName) === "svg" && (target === null || target === void 0 ? void 0 : target.parentNodclassName) !== "tag__button" || (target === null || target === void 0 || (_target$className = target.className) === null || _target$className === void 0 || (_target$className$ind = _target$className.indexOf) === null || _target$className$ind === void 0 ? void 0 : _target$className$ind.call(_target$className, "tag__label")) !== -1 || (target === null || target === void 0 || (_target$className2 = target.className) === null || _target$className2 === void 0 || (_target$className2$in = _target$className2.indexOf) === null || _target$className2$in === void 0 ? void 0 : _target$className2$in.call(_target$className2, "tag-list_wrapper")) !== -1 || (target === null || target === void 0 ? void 0 : target.className) === "".concat(RC, "__trigger") || (target === null || target === void 0 ? void 0 : target.className) === "tags-dropdown__arrow") return true;
|
|
397
343
|
return false;
|
|
398
344
|
};
|
|
399
|
-
|
|
400
345
|
const isItemMatchesSearch = item => {
|
|
401
346
|
const title = item.title || item.label;
|
|
402
347
|
return searchValue.length ? title.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || "") : true;
|
|
403
348
|
};
|
|
404
|
-
|
|
405
349
|
const getFilteredOptions = options => options === null || options === void 0 ? void 0 : options.reduce((result, option) => {
|
|
406
350
|
if (option.groupName) {
|
|
407
351
|
var _option$list;
|
|
408
|
-
|
|
409
|
-
const filteredGroupItems = option === null || option === void 0 ? void 0 : (_option$list = option.list) === null || _option$list === void 0 ? void 0 : _option$list.filter(item => isItemMatchesSearch(item));
|
|
410
|
-
|
|
352
|
+
const filteredGroupItems = option === null || option === void 0 || (_option$list = option.list) === null || _option$list === void 0 ? void 0 : _option$list.filter(item => isItemMatchesSearch(item));
|
|
411
353
|
if (filteredGroupItems !== null && filteredGroupItems !== void 0 && filteredGroupItems.length) {
|
|
412
|
-
result.push({
|
|
354
|
+
result.push({
|
|
355
|
+
...option,
|
|
413
356
|
list: filteredGroupItems
|
|
414
357
|
});
|
|
415
358
|
}
|
|
416
359
|
} else if (isItemMatchesSearch(option)) {
|
|
417
360
|
result.push(option);
|
|
418
361
|
}
|
|
419
|
-
|
|
420
362
|
return result;
|
|
421
363
|
}, []);
|
|
422
|
-
|
|
423
364
|
const getTotalOptions = (0, _react.useCallback)(() => {
|
|
424
365
|
return options === null || options === void 0 ? void 0 : options.reduce((result, item) => {
|
|
425
366
|
if (item !== null && item !== void 0 && item.list) {
|
|
426
367
|
var _item$list2;
|
|
427
|
-
|
|
428
|
-
result += (item === null || item === void 0 ? void 0 : (_item$list2 = item.list) === null || _item$list2 === void 0 ? void 0 : _item$list2.length) || 0;
|
|
368
|
+
result += (item === null || item === void 0 || (_item$list2 = item.list) === null || _item$list2 === void 0 ? void 0 : _item$list2.length) || 0;
|
|
429
369
|
} else {
|
|
430
370
|
++result;
|
|
431
371
|
}
|
|
432
|
-
|
|
433
372
|
return result;
|
|
434
373
|
}, 0);
|
|
435
374
|
}, [options]);
|
|
436
|
-
|
|
437
375
|
const getListMarkUp = () => {
|
|
438
376
|
var _filteredOptions$filt, _filteredOptions$filt2;
|
|
439
|
-
|
|
440
377
|
const filteredOptions = getFilteredOptions(options);
|
|
441
378
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
442
379
|
className: (0, _classnames.default)("".concat(RC, "__container-wrapper")),
|
|
@@ -486,25 +423,24 @@ const TagsDropdown = _ref => {
|
|
|
486
423
|
ref: dropdownListRef,
|
|
487
424
|
className: "".concat(RC, "__list ").concat(headerContent || isMobile ? "".concat(RC, "__list--with-header") : "", " ").concat(footerContent ? "".concat(RC, "__list--with-footer") : "")
|
|
488
425
|
}, filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.map(option => {
|
|
489
|
-
var _option$groupName, _option$
|
|
490
|
-
|
|
426
|
+
var _option$groupName, _option$list2;
|
|
491
427
|
return option.groupName ? /*#__PURE__*/_react.default.createElement("div", {
|
|
492
|
-
key: (_option$groupName = option.groupName) === null || _option$groupName === void 0
|
|
428
|
+
key: (_option$groupName = option.groupName) === null || _option$groupName === void 0 || (_option$groupName = _option$groupName.toString()) === null || _option$groupName === void 0 ? void 0 : _option$groupName.replace(/ /g, "_").concat(Date.now()),
|
|
493
429
|
className: (0, _classnames.default)("".concat(RC, "-group"), option.className)
|
|
494
430
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
495
431
|
className: "".concat(RC, "-group__name")
|
|
496
432
|
}, option.groupName), (_option$list2 = option.list) === null || _option$list2 === void 0 ? void 0 : _option$list2.map(item => getMarkupForElement(item))) : getMarkupForElement(option);
|
|
497
|
-
}), ((_filteredOptions$filt = filteredOptions.filter(
|
|
433
|
+
}), ((_filteredOptions$filt = filteredOptions.filter(_ref9 => {
|
|
498
434
|
let {
|
|
499
435
|
value
|
|
500
|
-
} =
|
|
436
|
+
} = _ref9;
|
|
501
437
|
return value !== "open_modal";
|
|
502
438
|
})) === null || _filteredOptions$filt === void 0 ? void 0 : _filteredOptions$filt.length) === 0 ? /*#__PURE__*/_react.default.createElement("div", {
|
|
503
439
|
className: "".concat(RC, "__no-options")
|
|
504
|
-
}, noOptionsText) : null), (footerContent || isMobile) && ((_filteredOptions$filt2 = filteredOptions.filter(
|
|
440
|
+
}, noOptionsText) : null), (footerContent || isMobile) && ((_filteredOptions$filt2 = filteredOptions.filter(_ref10 => {
|
|
505
441
|
let {
|
|
506
442
|
value
|
|
507
|
-
} =
|
|
443
|
+
} = _ref10;
|
|
508
444
|
return value !== "open_modal";
|
|
509
445
|
})) === null || _filteredOptions$filt2 === void 0 ? void 0 : _filteredOptions$filt2.length) > 0 ? /*#__PURE__*/_react.default.createElement("div", {
|
|
510
446
|
className: (0, _classnames.default)("".concat(RC, "__footer"), {
|
|
@@ -515,14 +451,11 @@ const TagsDropdown = _ref => {
|
|
|
515
451
|
onClick: () => setIsOpen(false)
|
|
516
452
|
}, "Apply", chosenOptions !== null && chosenOptions !== void 0 && chosenOptions.length ? "(".concat(chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.length, ")") : "")) : null));
|
|
517
453
|
};
|
|
518
|
-
|
|
519
454
|
const closeList = e => {
|
|
520
455
|
var _inputRef$current;
|
|
521
|
-
|
|
522
456
|
handleClickOutside(e);
|
|
523
|
-
inputRef === null || inputRef === void 0
|
|
457
|
+
inputRef === null || inputRef === void 0 || (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.blur();
|
|
524
458
|
};
|
|
525
|
-
|
|
526
459
|
(0, _react.useLayoutEffect)(() => {
|
|
527
460
|
initListContainer();
|
|
528
461
|
}, []);
|
|
@@ -536,7 +469,6 @@ const TagsDropdown = _ref => {
|
|
|
536
469
|
window.removeEventListener("mousewheel", closeList);
|
|
537
470
|
window.removeEventListener("mouseup", handleClickOutside);
|
|
538
471
|
}
|
|
539
|
-
|
|
540
472
|
return () => {
|
|
541
473
|
window.removeEventListener("resize", setListContainerStyles);
|
|
542
474
|
window.removeEventListener("mousewheel", closeList);
|
|
@@ -545,91 +477,98 @@ const TagsDropdown = _ref => {
|
|
|
545
477
|
}, [getListContainer]);
|
|
546
478
|
(0, _react.useLayoutEffect)(() => {
|
|
547
479
|
setListContainerStyles();
|
|
548
|
-
}, [isOpen, chosenOptions, isMobile, dropdownListWrapperRef === null || dropdownListWrapperRef === void 0
|
|
480
|
+
}, [isOpen, chosenOptions, isMobile, dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 || (_dropdownListWrapperR = dropdownListWrapperRef.current) === null || _dropdownListWrapperR === void 0 || (_dropdownListWrapperR = _dropdownListWrapperR.getBoundingClientRect()) === null || _dropdownListWrapperR === void 0 ? void 0 : _dropdownListWrapperR.height]);
|
|
549
481
|
(0, _react.useEffect)(() => {
|
|
550
482
|
if (!isMobile) {
|
|
551
483
|
document.addEventListener("click", handleClickOutside, true);
|
|
552
484
|
} else {
|
|
553
485
|
document.removeEventListener("click", handleClickOutside, true);
|
|
554
486
|
}
|
|
555
|
-
|
|
556
487
|
return () => document.removeEventListener("click", handleClickOutside, true);
|
|
557
488
|
}, [isMobile]);
|
|
558
489
|
(0, _react.useEffect)(() => {
|
|
559
490
|
var _selectAllButtonRef$c, _unselectAllButtonRef;
|
|
560
|
-
|
|
561
491
|
const fn = isOpen ? "addEventListener" : "removeEventListener";
|
|
562
|
-
selectAllButtonRef === null || selectAllButtonRef === void 0
|
|
563
|
-
unselectAllButtonRef === null || unselectAllButtonRef === void 0
|
|
564
|
-
|
|
492
|
+
selectAllButtonRef === null || selectAllButtonRef === void 0 || (_selectAllButtonRef$c = selectAllButtonRef.current) === null || _selectAllButtonRef$c === void 0 || _selectAllButtonRef$c[fn]("click", selectAllItems, true);
|
|
493
|
+
unselectAllButtonRef === null || unselectAllButtonRef === void 0 || (_unselectAllButtonRef = unselectAllButtonRef.current) === null || _unselectAllButtonRef === void 0 || _unselectAllButtonRef[fn]("click", unselectAllItems, true);
|
|
565
494
|
if (isOpen) {
|
|
566
495
|
var _getListContainer2;
|
|
567
|
-
|
|
568
|
-
(_getListContainer2 = getListContainer()) === null || _getListContainer2 === void 0 ? void 0 : _getListContainer2.classList.add("tags-dropdown__container--opened");
|
|
496
|
+
(_getListContainer2 = getListContainer()) === null || _getListContainer2 === void 0 || _getListContainer2.classList.add("tags-dropdown__container--opened");
|
|
569
497
|
} else {
|
|
570
498
|
var _getListContainer3;
|
|
571
|
-
|
|
572
|
-
(_getListContainer3 = getListContainer()) === null || _getListContainer3 === void 0 ? void 0 : _getListContainer3.classList.remove("tags-dropdown__container--opened");
|
|
499
|
+
(_getListContainer3 = getListContainer()) === null || _getListContainer3 === void 0 || _getListContainer3.classList.remove("tags-dropdown__container--opened");
|
|
573
500
|
}
|
|
574
501
|
}, [isOpen]);
|
|
575
502
|
(0, _react.useEffect)(() => {
|
|
576
503
|
if (isOpen && isMobile, dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
|
|
577
504
|
var _dropdownListRef$curr, _dropdownListRef$curr2;
|
|
578
|
-
|
|
579
|
-
setIsScrollableList((dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr = dropdownListRef.current) === null || _dropdownListRef$curr === void 0 ? void 0 : _dropdownListRef$curr.scrollHeight) > (dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr2 = dropdownListRef.current) === null || _dropdownListRef$curr2 === void 0 ? void 0 : _dropdownListRef$curr2.clientHeight));
|
|
580
|
-
|
|
505
|
+
setIsScrollableList((dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr = dropdownListRef.current) === null || _dropdownListRef$curr === void 0 ? void 0 : _dropdownListRef$curr.scrollHeight) > (dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr2 = dropdownListRef.current) === null || _dropdownListRef$curr2 === void 0 ? void 0 : _dropdownListRef$curr2.clientHeight));
|
|
581
506
|
if (isScrollableList === null) {
|
|
582
507
|
var _dropdownListRef$curr3, _dropdownListRef$curr4;
|
|
583
|
-
|
|
584
|
-
setIsFixedMaxHeight((dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr3 = dropdownListRef.current) === null || _dropdownListRef$curr3 === void 0 ? void 0 : _dropdownListRef$curr3.scrollHeight) > (dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr4 = dropdownListRef.current) === null || _dropdownListRef$curr4 === void 0 ? void 0 : _dropdownListRef$curr4.clientHeight));
|
|
508
|
+
setIsFixedMaxHeight((dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr3 = dropdownListRef.current) === null || _dropdownListRef$curr3 === void 0 ? void 0 : _dropdownListRef$curr3.scrollHeight) > (dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr4 = dropdownListRef.current) === null || _dropdownListRef$curr4 === void 0 ? void 0 : _dropdownListRef$curr4.clientHeight));
|
|
585
509
|
}
|
|
586
510
|
}
|
|
587
|
-
|
|
588
511
|
if (isOpen && dropdownListRef && dropdownListRef.current) {
|
|
589
512
|
dropdownListRef.current.addEventListener("scroll", doScrollCallback);
|
|
590
513
|
}
|
|
591
|
-
|
|
592
514
|
return () => {
|
|
593
515
|
removeEventListener("scroll", doScrollCallback);
|
|
594
516
|
};
|
|
595
|
-
}, [isOpen, isMobile, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current, dropdownListRef === null || dropdownListRef === void 0
|
|
517
|
+
}, [isOpen, isMobile, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current, dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr5 = dropdownListRef.current) === null || _dropdownListRef$curr5 === void 0 ? void 0 : _dropdownListRef$curr5.scrollHeight, dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr6 = dropdownListRef.current) === null || _dropdownListRef$curr6 === void 0 ? void 0 : _dropdownListRef$curr6.clientHeight]);
|
|
596
518
|
(0, _react.useEffect)(() => {
|
|
597
519
|
const setScrollTopValue = e => {
|
|
598
520
|
setScrollTop(parseInt(e.target.scrollTop, 10));
|
|
599
521
|
};
|
|
600
|
-
|
|
601
522
|
if (isOpen && isMobile && dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
|
|
602
523
|
var _dropdownListRef$curr7;
|
|
603
|
-
|
|
604
|
-
dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr7 = dropdownListRef.current) === null || _dropdownListRef$curr7 === void 0 ? void 0 : _dropdownListRef$curr7.addEventListener("scroll", setScrollTopValue);
|
|
524
|
+
dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr7 = dropdownListRef.current) === null || _dropdownListRef$curr7 === void 0 || _dropdownListRef$curr7.addEventListener("scroll", setScrollTopValue);
|
|
605
525
|
}
|
|
606
|
-
|
|
607
526
|
return () => {
|
|
608
527
|
var _dropdownListRef$curr8;
|
|
609
|
-
|
|
610
|
-
dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr8 = dropdownListRef.current) === null || _dropdownListRef$curr8 === void 0 ? void 0 : _dropdownListRef$curr8.removeEventListener("scroll", setScrollTopValue);
|
|
528
|
+
dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr8 = dropdownListRef.current) === null || _dropdownListRef$curr8 === void 0 || _dropdownListRef$curr8.removeEventListener("scroll", setScrollTopValue);
|
|
611
529
|
};
|
|
612
530
|
}, [isOpen, isMobile, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
|
|
613
531
|
(0, _react.useEffect)(() => {
|
|
614
532
|
if (dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
|
|
615
533
|
var _dropdownListRef$curr9, _dropdownListRef$curr10;
|
|
616
|
-
|
|
617
|
-
setScrollHeight(parseInt((dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr9 = dropdownListRef.current) === null || _dropdownListRef$curr9 === void 0 ? void 0 : _dropdownListRef$curr9.scrollHeight) - (dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr10 = dropdownListRef.current) === null || _dropdownListRef$curr10 === void 0 ? void 0 : _dropdownListRef$curr10.clientHeight), 10));
|
|
534
|
+
setScrollHeight(parseInt((dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr9 = dropdownListRef.current) === null || _dropdownListRef$curr9 === void 0 ? void 0 : _dropdownListRef$curr9.scrollHeight) - (dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr10 = dropdownListRef.current) === null || _dropdownListRef$curr10 === void 0 ? void 0 : _dropdownListRef$curr10.clientHeight), 10));
|
|
618
535
|
}
|
|
619
536
|
}, [scrollTop, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
|
|
620
537
|
(0, _react.useEffect)(() => {
|
|
621
538
|
return () => {
|
|
622
539
|
var _getListContainer4, _getListContainerWrap;
|
|
623
|
-
|
|
624
|
-
(
|
|
625
|
-
(_getListContainerWrap = getListContainerWrapper()) === null || _getListContainerWrap === void 0 ? void 0 : _getListContainerWrap.remove();
|
|
540
|
+
(_getListContainer4 = getListContainer()) === null || _getListContainer4 === void 0 || _getListContainer4.remove();
|
|
541
|
+
(_getListContainerWrap = getListContainerWrapper()) === null || _getListContainerWrap === void 0 || _getListContainerWrap.remove();
|
|
626
542
|
};
|
|
627
543
|
}, []);
|
|
628
544
|
(0, _react.useEffect)(() => {
|
|
629
545
|
if (isSearchable && useLiveSearch && debouncedSearchTerm || isValueDeleted) {
|
|
630
|
-
doLiveSearchRequest === null || doLiveSearchRequest === void 0
|
|
546
|
+
doLiveSearchRequest === null || doLiveSearchRequest === void 0 || doLiveSearchRequest(debouncedSearchTerm);
|
|
631
547
|
}
|
|
632
548
|
}, [debouncedSearchTerm, isValueDeleted]);
|
|
549
|
+
(0, _react.useLayoutEffect)(() => {
|
|
550
|
+
var _getListContainer5;
|
|
551
|
+
if (!isMobile) {
|
|
552
|
+
window.addEventListener("resize", setListContainerStyles);
|
|
553
|
+
window.addEventListener("mousewheel", closeList);
|
|
554
|
+
window.addEventListener("scroll", closeList);
|
|
555
|
+
window.addEventListener("touchmove", closeList);
|
|
556
|
+
} else {
|
|
557
|
+
window.removeEventListener("resize", setListContainerStyles);
|
|
558
|
+
window.removeEventListener("mousewheel", closeList);
|
|
559
|
+
window.removeEventListener("scroll", closeList);
|
|
560
|
+
window.removeEventListener("touchmove", closeList);
|
|
561
|
+
}
|
|
562
|
+
(_getListContainer5 = getListContainer()) === null || _getListContainer5 === void 0 || _getListContainer5.addEventListener("click", closeList);
|
|
563
|
+
return () => {
|
|
564
|
+
var _getListContainer6;
|
|
565
|
+
window.removeEventListener("resize", setListContainerStyles);
|
|
566
|
+
window.removeEventListener("mousewheel", closeList);
|
|
567
|
+
window.removeEventListener("scroll", closeList);
|
|
568
|
+
window.removeEventListener("touchmove", closeList);
|
|
569
|
+
(_getListContainer6 = getListContainer()) === null || _getListContainer6 === void 0 || _getListContainer6.removeEventListener("click", closeList);
|
|
570
|
+
};
|
|
571
|
+
}, [getListContainer]);
|
|
633
572
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
634
573
|
className: (0, _classnames.default)(RC, className, {
|
|
635
574
|
["".concat(RC, "_disabled")]: disabled,
|
|
@@ -640,10 +579,10 @@ const TagsDropdown = _ref => {
|
|
|
640
579
|
className: (0, _classnames.default)("".concat(RC, "__trigger"), {
|
|
641
580
|
"tags-dropdown__error": error
|
|
642
581
|
}),
|
|
643
|
-
onClick:
|
|
582
|
+
onClick: _ref11 => {
|
|
644
583
|
let {
|
|
645
584
|
target
|
|
646
|
-
} =
|
|
585
|
+
} = _ref11;
|
|
647
586
|
if ((target === null || target === void 0 ? void 0 : target.tagName) === "INPUT") setIsOpen(true);else if (isTargetInParent(target)) {
|
|
648
587
|
setIsOpen(isOpen => !isOpen);
|
|
649
588
|
}
|
|
@@ -681,8 +620,7 @@ const TagsDropdown = _ref => {
|
|
|
681
620
|
onKeyDown: e => onKeyPress(e, searchValue),
|
|
682
621
|
onFocus: e => {
|
|
683
622
|
var _e$target;
|
|
684
|
-
|
|
685
|
-
if (isMobile) e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.blur();
|
|
623
|
+
if (isMobile) e === null || e === void 0 || (_e$target = e.target) === null || _e$target === void 0 || _e$target.blur();
|
|
686
624
|
}
|
|
687
625
|
}, attributesOfNativeInput)) : "", isOpen && renderListContainer(), /*#__PURE__*/_react.default.createElement("span", {
|
|
688
626
|
className: (0, _classnames.default)("".concat(RC, "__arrow"), {
|
|
@@ -696,6 +634,4 @@ const TagsDropdown = _ref => {
|
|
|
696
634
|
className: "color--text"
|
|
697
635
|
}))));
|
|
698
636
|
};
|
|
699
|
-
|
|
700
|
-
var _default = TagsDropdown;
|
|
701
|
-
exports.default = _default;
|
|
637
|
+
var _default = exports.default = TagsDropdown;
|