intelicoreact 1.8.3 → 1.8.5
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/Dropdown/components/DropdownLoader.jsx +18 -0
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN_old.jsx +121 -0
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.jsx +507 -0
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.jsx +46 -0
- package/dist/Atomic/FormElements/NumericInput/NumericInput.jsx +337 -0
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.jsx +66 -0
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.jsx +78 -0
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.jsx +54 -0
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.jsx +183 -0
- package/dist/Atomic/FormElements/RangeList/RangeList.jsx +181 -0
- package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.jsx +41 -0
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.jsx +449 -0
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.jsx +865 -0
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.jsx +37 -0
- package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.jsx +48 -0
- package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.jsx +62 -0
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.jsx +175 -0
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.jsx +65 -0
- package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.jsx +118 -0
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.interface.ts +2 -0
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +1 -1
- package/dist/Atomic/FormElements/Text/Text.jsx +126 -0
- package/dist/Atomic/FormElements/Textarea/Textarea.jsx +61 -0
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.jsx +181 -0
- package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.jsx +60 -0
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.jsx +83 -0
- package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.jsx +80 -0
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.jsx +103 -0
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.jsx +115 -0
- package/dist/Atomic/Layout/Header/Header.jsx +86 -0
- package/dist/Atomic/UI/AccordionTable/AccordionTable.jsx +250 -0
- package/dist/Atomic/UI/AccordionText/AccordionText.jsx +68 -0
- package/dist/Atomic/UI/Arrow/Arrow.jsx +134 -0
- package/dist/Atomic/UI/Box/Box.jsx +53 -0
- package/dist/Atomic/UI/Chart/Chart.jsx +178 -0
- package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.jsx +78 -0
- package/dist/Atomic/UI/Chart/partial/optionsConstructor.jsx +334 -0
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.jsx +111 -0
- package/dist/Atomic/UI/DateTime/DateTime.jsx +57 -0
- package/dist/Atomic/UI/DebugContainer/DebugContainer.jsx +44 -0
- package/dist/Atomic/UI/DebugContainer/useDebugContainer.jsx +15 -0
- package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.jsx +223 -0
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion._test.jsx +75 -0
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.jsx +86 -0
- package/dist/Atomic/UI/PieChart/PieChart.jsx +41 -0
- package/dist/Atomic/UI/Table/Partials/TdCell.jsx +87 -0
- package/dist/Atomic/UI/Table/Partials/TdHeader.jsx +36 -0
- package/dist/Atomic/UI/Table/Partials/TdRow.jsx +103 -0
- package/dist/Atomic/UI/Table/Partials/TdTitle.jsx +55 -0
- package/dist/Atomic/UI/Table/Table.jsx +63 -0
- package/dist/Atomic/UI/Table/TdTypes/TdActions.jsx +80 -0
- package/dist/Atomic/UI/Table/TdTypes/TdPriority.jsx +26 -0
- package/dist/Atomic/UI/Table/TdTypes/TdRange.jsx +13 -0
- package/dist/Atomic/UI/Table/TdTypes/TdWeight.jsx +56 -0
- package/dist/Atomic/UI/Tag/Tag.interface.ts +1 -0
- package/dist/Atomic/UI/Tag/Tag.js +1 -1
- package/dist/Atomic/UI/TagList/TagList.jsx +256 -0
- package/dist/Atomic/UI/WizardStepper/constructor.jsx +86 -0
- package/dist/Classes/RESTAPI/partials/CredentialsProcessing.jsx +254 -0
- package/dist/Functions/customEventListener.jsx +96 -0
- package/dist/Functions/operations.jsx +138 -0
- package/dist/Functions/useFormTools/functions/RenderFields.jsx +108 -0
- package/dist/Functions/useFormTools/index.jsx +777 -0
- package/dist/Functions/usePasswordChecker.jsx +128 -0
- package/dist/Functions/utils.jsx +492 -0
- package/dist/Molecular/CustomIcons/components/AffiliateNetworks.jsx +22 -0
- package/dist/Molecular/CustomIcons/components/AlertCircle.jsx +24 -0
- package/dist/Molecular/CustomIcons/components/AppStore.jsx +30 -0
- package/dist/Molecular/CustomIcons/components/Arrow.jsx +33 -0
- package/dist/Molecular/CustomIcons/components/ArrowDown.jsx +18 -0
- package/dist/Molecular/CustomIcons/components/ArrowLeft.jsx +23 -0
- package/dist/Molecular/CustomIcons/components/ArrowRight.jsx +23 -0
- package/dist/Molecular/CustomIcons/components/ArrowUp.jsx +18 -0
- package/dist/Molecular/CustomIcons/components/Bell.jsx +16 -0
- package/dist/Molecular/CustomIcons/components/Button.jsx +13 -0
- package/dist/Molecular/CustomIcons/components/Campaigns.jsx +17 -0
- package/dist/Molecular/CustomIcons/components/Check.jsx +15 -0
- package/dist/Molecular/CustomIcons/components/Check2.jsx +13 -0
- package/dist/Molecular/CustomIcons/components/ChevronDown.jsx +13 -0
- package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.jsx +12 -0
- package/dist/Molecular/CustomIcons/components/ChevronLeft.jsx +12 -0
- package/dist/Molecular/CustomIcons/components/ChevronRight.jsx +12 -0
- package/dist/Molecular/CustomIcons/components/ChevronUp.jsx +12 -0
- package/dist/Molecular/CustomIcons/components/ChevronUpDown.jsx +28 -0
- package/dist/Molecular/CustomIcons/components/Close.jsx +15 -0
- package/dist/Molecular/CustomIcons/components/ColumnsOrder.jsx +18 -0
- package/dist/Molecular/CustomIcons/components/Delete.jsx +17 -0
- package/dist/Molecular/CustomIcons/components/Edit.jsx +16 -0
- package/dist/Molecular/CustomIcons/components/Email.jsx +32 -0
- package/dist/Molecular/CustomIcons/components/FinturfLogo.jsx +19 -0
- package/dist/Molecular/CustomIcons/components/FinturfLogo2.jsx +36 -0
- package/dist/Molecular/CustomIcons/components/Flows.jsx +16 -0
- package/dist/Molecular/CustomIcons/components/Gift.jsx +26 -0
- package/dist/Molecular/CustomIcons/components/GoogleAuth.jsx +30 -0
- package/dist/Molecular/CustomIcons/components/GooglePlay.jsx +30 -0
- package/dist/Molecular/CustomIcons/components/HelpCircle.jsx +20 -0
- package/dist/Molecular/CustomIcons/components/HelpCircle2.jsx +21 -0
- package/dist/Molecular/CustomIcons/components/HelpCircleFilled.jsx +20 -0
- package/dist/Molecular/CustomIcons/components/Home.jsx +17 -0
- package/dist/Molecular/CustomIcons/components/Home2.jsx +23 -0
- package/dist/Molecular/CustomIcons/components/Key.jsx +24 -0
- package/dist/Molecular/CustomIcons/components/Landers.jsx +21 -0
- package/dist/Molecular/CustomIcons/components/Lock.jsx +16 -0
- package/dist/Molecular/CustomIcons/components/Mail.jsx +27 -0
- package/dist/Molecular/CustomIcons/components/Mastercard.jsx +74 -0
- package/dist/Molecular/CustomIcons/components/Minus.jsx +26 -0
- package/dist/Molecular/CustomIcons/components/Offers.jsx +17 -0
- package/dist/Molecular/CustomIcons/components/Pause.jsx +29 -0
- package/dist/Molecular/CustomIcons/components/PayPal.jsx +42 -0
- package/dist/Molecular/CustomIcons/components/PayPalLightLarge.jsx +29 -0
- package/dist/Molecular/CustomIcons/components/Phone.jsx +31 -0
- package/dist/Molecular/CustomIcons/components/Play.jsx +26 -0
- package/dist/Molecular/CustomIcons/components/Plus.jsx +26 -0
- package/dist/Molecular/CustomIcons/components/Profile.jsx +17 -0
- package/dist/Molecular/CustomIcons/components/QRCode.jsx +30 -0
- package/dist/Molecular/CustomIcons/components/Rectangle.jsx +13 -0
- package/dist/Molecular/CustomIcons/components/Revert.jsx +14 -0
- package/dist/Molecular/CustomIcons/components/Star.jsx +15 -0
- package/dist/Molecular/CustomIcons/components/Star2.jsx +17 -0
- package/dist/Molecular/CustomIcons/components/TrafficSources.jsx +15 -0
- package/dist/Molecular/CustomIcons/components/Trash.jsx +16 -0
- package/dist/Molecular/CustomIcons/components/TrashRed.jsx +16 -0
- package/dist/Molecular/CustomIcons/components/Triggers.jsx +16 -0
- package/dist/Molecular/CustomIcons/components/User.jsx +26 -0
- package/dist/Molecular/CustomIcons/components/Visa.jsx +32 -0
- package/dist/Molecular/CustomIcons/components/X.jsx +13 -0
- package/dist/Molecular/FormElement/FormElement.jsx +52 -0
- package/dist/Molecular/FormWithDependOn/FormWithDependOn.jsx +161 -0
- package/dist/Molecular/InputAddress/InputAddress.jsx +641 -0
- package/dist/Molecular/InputPassword/InputPassword.jsx +50 -0
- package/package.json +13 -6
- package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +0 -1
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN_old.js +0 -1
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +0 -1
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +0 -1
- package/dist/Atomic/FormElements/NumericInput/NumericInput.js +0 -1
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +0 -1
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +0 -1
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +0 -1
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +0 -1
- package/dist/Atomic/FormElements/RangeList/RangeList.js +0 -1
- package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +0 -1
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +0 -1
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +0 -1
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +0 -1
- package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +0 -1
- package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +0 -1
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.d.ts +0 -16
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +0 -1
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +0 -1
- package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.d.ts +0 -9
- package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.js +0 -1
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.d.ts +0 -5
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.interface.d.ts +0 -79
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.interface.js +0 -1
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.interface.js.map +0 -1
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js.map +0 -1
- package/dist/Atomic/FormElements/Text/Text.js +0 -1
- package/dist/Atomic/FormElements/Textarea/Textarea.js +0 -1
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +0 -1
- package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.js +0 -1
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +0 -1
- package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.js +0 -1
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +0 -1
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +0 -1
- package/dist/Atomic/Layout/Header/Header.js +0 -1
- package/dist/Atomic/UI/AccordionTable/AccordionTable.js +0 -1
- package/dist/Atomic/UI/AccordionText/AccordionText.js +0 -1
- package/dist/Atomic/UI/Arrow/Arrow.js +0 -1
- package/dist/Atomic/UI/Box/Box.js +0 -1
- package/dist/Atomic/UI/Chart/Chart.js +0 -1
- package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +0 -1
- package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +0 -1
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +0 -1
- package/dist/Atomic/UI/DateTime/DateTime.js +0 -1
- package/dist/Atomic/UI/DebugContainer/DebugContainer.js +0 -1
- package/dist/Atomic/UI/DebugContainer/useDebugContainer.js +0 -1
- package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +0 -1
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion._test.js +0 -1
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +0 -1
- package/dist/Atomic/UI/PieChart/PieChart.js +0 -1
- package/dist/Atomic/UI/Table/Partials/TdCell.js +0 -1
- package/dist/Atomic/UI/Table/Partials/TdHeader.js +0 -1
- package/dist/Atomic/UI/Table/Partials/TdRow.js +0 -1
- package/dist/Atomic/UI/Table/Partials/TdTitle.js +0 -1
- package/dist/Atomic/UI/Table/Table.js +0 -1
- package/dist/Atomic/UI/Table/TdTypes/TdActions.js +0 -1
- package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +0 -1
- package/dist/Atomic/UI/Table/TdTypes/TdRange.js +0 -1
- package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +0 -1
- package/dist/Atomic/UI/TagList/TagList.js +0 -1
- package/dist/Atomic/UI/WizardStepper/constructor.js +0 -1
- package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +0 -1
- package/dist/Functions/customEventListener.js +0 -1
- package/dist/Functions/operations.js +0 -1
- package/dist/Functions/useFormTools/functions/RenderFields.js +0 -1
- package/dist/Functions/useFormTools/index.js +0 -1
- package/dist/Functions/usePasswordChecker.js +0 -1
- package/dist/Functions/utils.js +0 -1
- package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +0 -1
- package/dist/Molecular/CustomIcons/components/AlertCircle.js +0 -1
- package/dist/Molecular/CustomIcons/components/AppStore.js +0 -1
- package/dist/Molecular/CustomIcons/components/Arrow.js +0 -1
- package/dist/Molecular/CustomIcons/components/ArrowDown.js +0 -1
- package/dist/Molecular/CustomIcons/components/ArrowLeft.js +0 -1
- package/dist/Molecular/CustomIcons/components/ArrowRight.js +0 -1
- package/dist/Molecular/CustomIcons/components/ArrowUp.js +0 -1
- package/dist/Molecular/CustomIcons/components/Bell.js +0 -1
- package/dist/Molecular/CustomIcons/components/Button.js +0 -1
- package/dist/Molecular/CustomIcons/components/Campaigns.js +0 -1
- package/dist/Molecular/CustomIcons/components/Check.js +0 -1
- package/dist/Molecular/CustomIcons/components/Check2.js +0 -1
- package/dist/Molecular/CustomIcons/components/ChevronDown.js +0 -1
- package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +0 -1
- package/dist/Molecular/CustomIcons/components/ChevronLeft.js +0 -1
- package/dist/Molecular/CustomIcons/components/ChevronRight.js +0 -1
- package/dist/Molecular/CustomIcons/components/ChevronUp.js +0 -1
- package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +0 -1
- package/dist/Molecular/CustomIcons/components/Close.js +0 -1
- package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +0 -1
- package/dist/Molecular/CustomIcons/components/Delete.js +0 -1
- package/dist/Molecular/CustomIcons/components/Edit.js +0 -1
- package/dist/Molecular/CustomIcons/components/Email.js +0 -1
- package/dist/Molecular/CustomIcons/components/FinturfLogo.js +0 -1
- package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +0 -1
- package/dist/Molecular/CustomIcons/components/Flows.js +0 -1
- package/dist/Molecular/CustomIcons/components/Gift.js +0 -1
- package/dist/Molecular/CustomIcons/components/GoogleAuth.js +0 -1
- package/dist/Molecular/CustomIcons/components/GooglePlay.js +0 -1
- package/dist/Molecular/CustomIcons/components/HelpCircle.js +0 -1
- package/dist/Molecular/CustomIcons/components/HelpCircle2.js +0 -1
- package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +0 -1
- package/dist/Molecular/CustomIcons/components/Home.js +0 -1
- package/dist/Molecular/CustomIcons/components/Home2.js +0 -1
- package/dist/Molecular/CustomIcons/components/Key.js +0 -1
- package/dist/Molecular/CustomIcons/components/Landers.js +0 -1
- package/dist/Molecular/CustomIcons/components/Lock.js +0 -1
- package/dist/Molecular/CustomIcons/components/Mail.js +0 -1
- package/dist/Molecular/CustomIcons/components/Mastercard.js +0 -1
- package/dist/Molecular/CustomIcons/components/Minus.js +0 -1
- package/dist/Molecular/CustomIcons/components/Offers.js +0 -1
- package/dist/Molecular/CustomIcons/components/Pause.js +0 -1
- package/dist/Molecular/CustomIcons/components/PayPal.js +0 -1
- package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +0 -1
- package/dist/Molecular/CustomIcons/components/Phone.js +0 -1
- package/dist/Molecular/CustomIcons/components/Play.js +0 -1
- package/dist/Molecular/CustomIcons/components/Plus.js +0 -1
- package/dist/Molecular/CustomIcons/components/Profile.js +0 -1
- package/dist/Molecular/CustomIcons/components/QRCode.js +0 -1
- package/dist/Molecular/CustomIcons/components/Rectangle.js +0 -1
- package/dist/Molecular/CustomIcons/components/Revert.js +0 -1
- package/dist/Molecular/CustomIcons/components/Star.js +0 -1
- package/dist/Molecular/CustomIcons/components/Star2.js +0 -1
- package/dist/Molecular/CustomIcons/components/TrafficSources.js +0 -1
- package/dist/Molecular/CustomIcons/components/Trash.js +0 -1
- package/dist/Molecular/CustomIcons/components/TrashRed.js +0 -1
- package/dist/Molecular/CustomIcons/components/Triggers.js +0 -1
- package/dist/Molecular/CustomIcons/components/User.js +0 -1
- package/dist/Molecular/CustomIcons/components/Visa.js +0 -1
- package/dist/Molecular/CustomIcons/components/X.js +0 -1
- package/dist/Molecular/FormElement/FormElement.js +0 -1
- package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +0 -1
- package/dist/Molecular/InputAddress/InputAddress.js +0 -1
- package/dist/Molecular/InputPassword/InputPassword.js +0 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
|
|
3
|
+
import Switcher from '../Switcher/Switcher';
|
|
4
|
+
|
|
5
|
+
import './SwitchableRow.scss';
|
|
6
|
+
|
|
7
|
+
const RC_default = 'switchable-row';
|
|
8
|
+
|
|
9
|
+
function SwitchableRow(props) {
|
|
10
|
+
const {
|
|
11
|
+
RC = RC_default,
|
|
12
|
+
className,
|
|
13
|
+
children,
|
|
14
|
+
isActive,
|
|
15
|
+
setIsActive,
|
|
16
|
+
switcherLabel,
|
|
17
|
+
isSwitcherLabelBold,
|
|
18
|
+
testId = RC_default,
|
|
19
|
+
} = props || {};
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<div className={cn(RC, className)} data-testid={testId}>
|
|
23
|
+
<div className={cn(`${RC}__cell`)}>
|
|
24
|
+
<Switcher
|
|
25
|
+
isActive={isActive}
|
|
26
|
+
onChange={setIsActive}
|
|
27
|
+
isLabelBold={isSwitcherLabelBold}
|
|
28
|
+
label={switcherLabel}
|
|
29
|
+
data-testid={`${testId}-switcher`}
|
|
30
|
+
/>
|
|
31
|
+
</div>
|
|
32
|
+
{children}
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default SwitchableRow;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
|
|
3
|
+
import CheckboxesLine from '../CheckboxesLine/CheckboxesLine';
|
|
4
|
+
import Switcher from '../Switcher/Switcher';
|
|
5
|
+
|
|
6
|
+
import './SwitcherCheckbox.scss';
|
|
7
|
+
|
|
8
|
+
const RC = 'switcher-hide';
|
|
9
|
+
|
|
10
|
+
function SwitcherCheckbox({
|
|
11
|
+
label,
|
|
12
|
+
hint,
|
|
13
|
+
items = [],
|
|
14
|
+
value = [],
|
|
15
|
+
className,
|
|
16
|
+
isLabelBold,
|
|
17
|
+
isActive,
|
|
18
|
+
hintSide,
|
|
19
|
+
disabled,
|
|
20
|
+
hideChildren = true,
|
|
21
|
+
onSwitcherChange = () => {},
|
|
22
|
+
onChange = () => {},
|
|
23
|
+
}) {
|
|
24
|
+
const renderCheckboxes = () => {
|
|
25
|
+
return <CheckboxesLine items={items} value={value} onChange={onChange} />;
|
|
26
|
+
};
|
|
27
|
+
return (
|
|
28
|
+
<div
|
|
29
|
+
className={cn(RC, className, {
|
|
30
|
+
[`${RC}_closed`]: !isActive,
|
|
31
|
+
[`${RC}_disabled`]: disabled,
|
|
32
|
+
})}
|
|
33
|
+
>
|
|
34
|
+
<Switcher
|
|
35
|
+
className={`${RC}__switcher`}
|
|
36
|
+
hintSide={hintSide}
|
|
37
|
+
label={label}
|
|
38
|
+
isActive={isActive}
|
|
39
|
+
onChange={value => onSwitcherChange(value)}
|
|
40
|
+
isLabelBold={isLabelBold}
|
|
41
|
+
hint={hint}
|
|
42
|
+
/>
|
|
43
|
+
{isActive ? renderCheckboxes() : !hideChildren ? renderCheckboxes() : ''}
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export default SwitcherCheckbox;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
|
|
3
|
+
import RangeList from '../RangeList/RangeList';
|
|
4
|
+
import SwitcherHide from '../SwitcherHide/SwitcherHide';
|
|
5
|
+
|
|
6
|
+
import './SwitcherRangeList.scss';
|
|
7
|
+
|
|
8
|
+
const RC = 'switcher-range-list';
|
|
9
|
+
|
|
10
|
+
function SwitcherRangeList(props) {
|
|
11
|
+
const {
|
|
12
|
+
className,
|
|
13
|
+
label,
|
|
14
|
+
isLabelBold,
|
|
15
|
+
hint,
|
|
16
|
+
hintSide,
|
|
17
|
+
disabled,
|
|
18
|
+
isActive,
|
|
19
|
+
value,
|
|
20
|
+
validateErrors,
|
|
21
|
+
isFloatValues,
|
|
22
|
+
decimalPlaces,
|
|
23
|
+
error,
|
|
24
|
+
defaultErrorText,
|
|
25
|
+
nullValueText,
|
|
26
|
+
isOnlyOneRow,
|
|
27
|
+
setIsActive = () => {},
|
|
28
|
+
onChange = () => {},
|
|
29
|
+
testId,
|
|
30
|
+
} = props;
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<SwitcherHide
|
|
34
|
+
isActive={isActive}
|
|
35
|
+
onChange={setIsActive}
|
|
36
|
+
label={label}
|
|
37
|
+
isLabelBold={isLabelBold}
|
|
38
|
+
hint={hint}
|
|
39
|
+
hintSide={hintSide}
|
|
40
|
+
className={cn(RC, className)}
|
|
41
|
+
disabled={disabled}
|
|
42
|
+
>
|
|
43
|
+
<div className="switcher-range-list__row">
|
|
44
|
+
<RangeList
|
|
45
|
+
testId={testId}
|
|
46
|
+
className={`${RC}__range-list`}
|
|
47
|
+
value={value}
|
|
48
|
+
isOnlyOneRow={isOnlyOneRow}
|
|
49
|
+
onChange={onChange}
|
|
50
|
+
validateErrors={validateErrors}
|
|
51
|
+
isFloatValues={isFloatValues}
|
|
52
|
+
decimalPlaces={decimalPlaces}
|
|
53
|
+
error={error}
|
|
54
|
+
defaultErrorText={defaultErrorText}
|
|
55
|
+
nullValueText={nullValueText}
|
|
56
|
+
/>
|
|
57
|
+
</div>
|
|
58
|
+
</SwitcherHide>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default SwitcherRangeList;
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
|
|
3
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
4
|
+
|
|
5
|
+
import Button from '../../UI/Button/Button';
|
|
6
|
+
import SwitcherHide from '../SwitcherHide/SwitcherHide';
|
|
7
|
+
import TagsDropdown from '../TagsDropdown/TagsDropdown';
|
|
8
|
+
import Textarea from '../Textarea/Textarea';
|
|
9
|
+
import TextSwitcher from '../TextSwitcher/TextSwitcher';
|
|
10
|
+
|
|
11
|
+
import './SwitcherTagsDropdown.scss';
|
|
12
|
+
|
|
13
|
+
const RC = 'switcher-tags-dropdown';
|
|
14
|
+
|
|
15
|
+
function SwitcherTagsDropdown({
|
|
16
|
+
className,
|
|
17
|
+
label,
|
|
18
|
+
isLabelBold,
|
|
19
|
+
isValuesInTags,
|
|
20
|
+
isActive,
|
|
21
|
+
isIncluded,
|
|
22
|
+
isAdvancedLabelSearch,
|
|
23
|
+
disabled,
|
|
24
|
+
options = [],
|
|
25
|
+
chosenOptions = [],
|
|
26
|
+
setIsActive = () => {},
|
|
27
|
+
setIsIncluded = () => {},
|
|
28
|
+
onChange = () => {},
|
|
29
|
+
}) {
|
|
30
|
+
const [listView, setListView] = useState(false);
|
|
31
|
+
const [textValue, setTextValue] = useState();
|
|
32
|
+
|
|
33
|
+
const singleLevelOptions = useMemo(
|
|
34
|
+
() =>
|
|
35
|
+
options.reduce(
|
|
36
|
+
(acc, item) => [...acc, ...(item.groupName ? item.list : [item])],
|
|
37
|
+
[],
|
|
38
|
+
),
|
|
39
|
+
[options],
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
const apply = () => {
|
|
43
|
+
// вернет функциюю сравнения для метода filter с замкнутым массивом listValuesArr
|
|
44
|
+
// (по логике listValuesArr - массив полученный из строки textaria).
|
|
45
|
+
const getFilterFunction = listValuesArr => (item) => {
|
|
46
|
+
return listValuesArr.find((el) => {
|
|
47
|
+
const itemValue = item?.value.toString().toLowerCase();
|
|
48
|
+
const itemLabel = (item.title || item.label || item.name || item.value)
|
|
49
|
+
.toString()
|
|
50
|
+
.toLowerCase();
|
|
51
|
+
const chosenOption = el.toString().toLowerCase();
|
|
52
|
+
const isChosenOptionIncludedInLabel
|
|
53
|
+
= itemLabel.includes(chosenOption)
|
|
54
|
+
&& !chosenOptions.includes(item.value);
|
|
55
|
+
|
|
56
|
+
if (isValuesInTags) {
|
|
57
|
+
return (
|
|
58
|
+
(chosenOption === itemValue || chosenOption === itemLabel)
|
|
59
|
+
&& !item.disabled
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
else if (isAdvancedLabelSearch) {
|
|
63
|
+
return (
|
|
64
|
+
(chosenOption === itemLabel
|
|
65
|
+
|| chosenOption === itemValue
|
|
66
|
+
|| isChosenOptionIncludedInLabel)
|
|
67
|
+
&& !item.disabled
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
return (
|
|
72
|
+
(chosenOption === itemLabel || chosenOption === itemValue)
|
|
73
|
+
&& !item.disabled
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const textToArray = textValue
|
|
80
|
+
?.split?.(',')
|
|
81
|
+
.map(item => item.toString().trim())
|
|
82
|
+
.filter(item => Boolean(item));
|
|
83
|
+
const newOptions = options
|
|
84
|
+
.filter(getFilterFunction(textToArray))
|
|
85
|
+
.map(option => option.value);
|
|
86
|
+
|
|
87
|
+
onChange(newOptions, 'chosenOptions');
|
|
88
|
+
setListView(false);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const enterHandler = (e, value) => {
|
|
92
|
+
if (e.keyCode === 13) {
|
|
93
|
+
const option = options?.find(
|
|
94
|
+
item =>
|
|
95
|
+
item?.title?.toLowerCase() === value?.toLowerCase() && !item.disabled,
|
|
96
|
+
);
|
|
97
|
+
const isOptionChecked = chosenOptions?.some(
|
|
98
|
+
item => item?.title?.toLowerCase() === option?.title?.toLowerCase(),
|
|
99
|
+
);
|
|
100
|
+
if (option && !isOptionChecked)
|
|
101
|
+
onChange([...chosenOptions, option], 'chosenOptions');
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
const getLabel = el => el.title || el.label || el.name || el.value;
|
|
107
|
+
const valuesArr = chosenOptions?.map(item =>
|
|
108
|
+
isValuesInTags
|
|
109
|
+
? item
|
|
110
|
+
: getLabel(singleLevelOptions.find(option => option.value === item)),
|
|
111
|
+
);
|
|
112
|
+
setTextValue(valuesArr.join(', '));
|
|
113
|
+
}, [chosenOptions, listView]);
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<SwitcherHide
|
|
117
|
+
isActive={isActive}
|
|
118
|
+
onChange={setIsActive}
|
|
119
|
+
label={label}
|
|
120
|
+
className={cn(RC, className)}
|
|
121
|
+
isLabelBold={isLabelBold}
|
|
122
|
+
disabled={disabled}
|
|
123
|
+
>
|
|
124
|
+
<div className={`${RC}__wrap switcher-hide__content`}>
|
|
125
|
+
<TextSwitcher
|
|
126
|
+
activeText="is"
|
|
127
|
+
inactiveText="is not"
|
|
128
|
+
isActive={isIncluded ?? true}
|
|
129
|
+
onChange={setIsIncluded}
|
|
130
|
+
className={`${RC}__text-switcher`}
|
|
131
|
+
/>
|
|
132
|
+
<div className="filter-select__wrap--buttons">
|
|
133
|
+
<button
|
|
134
|
+
onClick={() => setListView(!listView)}
|
|
135
|
+
className={`${RC}__btn`}
|
|
136
|
+
>
|
|
137
|
+
{listView ? 'Close' : 'List view'}
|
|
138
|
+
</button>
|
|
139
|
+
{listView && (
|
|
140
|
+
<Button
|
|
141
|
+
label="Apply"
|
|
142
|
+
className={`${RC}__apply`}
|
|
143
|
+
onClick={() => apply()}
|
|
144
|
+
/>
|
|
145
|
+
)}
|
|
146
|
+
<button
|
|
147
|
+
onClick={() => onChange([], 'chosenOptions')}
|
|
148
|
+
className={`${RC}__btn`}
|
|
149
|
+
>
|
|
150
|
+
Clear
|
|
151
|
+
</button>
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
{listView
|
|
155
|
+
? (
|
|
156
|
+
<Textarea value={textValue} onChange={value => setTextValue(value)} />
|
|
157
|
+
)
|
|
158
|
+
: (
|
|
159
|
+
<TagsDropdown
|
|
160
|
+
options={options}
|
|
161
|
+
chosenOptions={chosenOptions}
|
|
162
|
+
onChange={onChange}
|
|
163
|
+
className={`${RC}__tags-dropdown`}
|
|
164
|
+
onKeyPress={(e, value) => enterHandler(e, value)}
|
|
165
|
+
tagClassname={cn(`${RC}__tag`, {
|
|
166
|
+
[`${RC}__tag_inactive`]: !isIncluded,
|
|
167
|
+
})}
|
|
168
|
+
isValuesInTags={isValuesInTags}
|
|
169
|
+
/>
|
|
170
|
+
)}
|
|
171
|
+
</SwitcherHide>
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export default SwitcherTagsDropdown;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
|
|
3
|
+
import SwitcherHide from '../SwitcherHide/SwitcherHide';
|
|
4
|
+
import Textarea from '../Textarea/Textarea';
|
|
5
|
+
import TextSwitcher from '../TextSwitcher/TextSwitcher';
|
|
6
|
+
|
|
7
|
+
import './SwitcherTextarea.scss';
|
|
8
|
+
|
|
9
|
+
const RC = 'switcher-textarea';
|
|
10
|
+
|
|
11
|
+
function SwitcherTextarea({
|
|
12
|
+
label,
|
|
13
|
+
isLabelBold,
|
|
14
|
+
hint,
|
|
15
|
+
className,
|
|
16
|
+
isActive = true,
|
|
17
|
+
setIsActive = () => {},
|
|
18
|
+
isIncluded = true,
|
|
19
|
+
setIsIncluded = () => {},
|
|
20
|
+
text = '',
|
|
21
|
+
setText = () => {},
|
|
22
|
+
activeText = 'is',
|
|
23
|
+
inactiveText = 'is not',
|
|
24
|
+
placeholder,
|
|
25
|
+
disabled,
|
|
26
|
+
testId,
|
|
27
|
+
}) {
|
|
28
|
+
return (
|
|
29
|
+
<SwitcherHide
|
|
30
|
+
testId={testId}
|
|
31
|
+
isActive={isActive}
|
|
32
|
+
onChange={setIsActive}
|
|
33
|
+
label={label}
|
|
34
|
+
isLabelBold={isLabelBold}
|
|
35
|
+
className={cn(RC, className)}
|
|
36
|
+
hint={hint}
|
|
37
|
+
disabled={disabled}
|
|
38
|
+
>
|
|
39
|
+
<>
|
|
40
|
+
<div className={`${RC}__wrap switcher-hide__content`}>
|
|
41
|
+
<TextSwitcher
|
|
42
|
+
testId={testId}
|
|
43
|
+
activeText={activeText}
|
|
44
|
+
inactiveText={inactiveText}
|
|
45
|
+
isActive={isIncluded ?? true}
|
|
46
|
+
onChange={value => setIsIncluded(value)}
|
|
47
|
+
className={`${RC}__text-switcher`}
|
|
48
|
+
/>
|
|
49
|
+
<button onClick={() => setText('')} className={`${RC}__btn`}>
|
|
50
|
+
Clear
|
|
51
|
+
</button>
|
|
52
|
+
</div>
|
|
53
|
+
<Textarea
|
|
54
|
+
testId={testId}
|
|
55
|
+
value={text}
|
|
56
|
+
placeholder={placeholder}
|
|
57
|
+
onChange={value => setText(value)}
|
|
58
|
+
className={`${RC}__textarea`}
|
|
59
|
+
/>
|
|
60
|
+
</>
|
|
61
|
+
</SwitcherHide>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default SwitcherTextarea;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import TagList from '../../UI/TagList/TagList';
|
|
4
|
+
import TagsDropdown from '../TagsDropdown/TagsDropdown';
|
|
5
|
+
|
|
6
|
+
function TagListToDropdown({
|
|
7
|
+
options,
|
|
8
|
+
tagsFullList,
|
|
9
|
+
value = [],
|
|
10
|
+
dropdownProps = {},
|
|
11
|
+
listProps = {},
|
|
12
|
+
onChange,
|
|
13
|
+
useDropdownCompactMode,
|
|
14
|
+
}) {
|
|
15
|
+
const preparedValue = value.map(({ value }) => value);
|
|
16
|
+
const [isEditMode, setIsEditMode] = useState(false);
|
|
17
|
+
const [isRenderAllTags, setIsRenderAllTags] = useState(false);
|
|
18
|
+
const [newValue, setNewValue] = useState(preparedValue);
|
|
19
|
+
const [isValueChanged, setIsValueChanged] = useState(false);
|
|
20
|
+
|
|
21
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
22
|
+
|
|
23
|
+
const tagListRef = useRef(null);
|
|
24
|
+
|
|
25
|
+
const onConfirmChangesClick = () => {
|
|
26
|
+
if (isValueChanged) {
|
|
27
|
+
setIsLoading(true);
|
|
28
|
+
setIsValueChanged(false);
|
|
29
|
+
new Promise((r) => {
|
|
30
|
+
const onChangeResult = onChange(
|
|
31
|
+
options.filter(({ value }) => newValue.includes(value)),
|
|
32
|
+
);
|
|
33
|
+
if (onChangeResult instanceof Promise) {
|
|
34
|
+
onChangeResult.then(data => r(data));
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
r();
|
|
38
|
+
}
|
|
39
|
+
})?.finally(() => {
|
|
40
|
+
setIsEditMode(false);
|
|
41
|
+
setIsLoading(false);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
setIsEditMode(false);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
setNewValue(preparedValue);
|
|
51
|
+
}, [isEditMode]);
|
|
52
|
+
|
|
53
|
+
const renderTagsDropdown = (props) => {
|
|
54
|
+
return (
|
|
55
|
+
<TagsDropdown
|
|
56
|
+
{...dropdownProps}
|
|
57
|
+
disabled={isLoading}
|
|
58
|
+
options={options}
|
|
59
|
+
tagsFullList={tagsFullList}
|
|
60
|
+
chosenOptions={newValue}
|
|
61
|
+
renderOptionsAsTags
|
|
62
|
+
withCreateLogic
|
|
63
|
+
isUseLocalOptionsStore={false}
|
|
64
|
+
onOptionEdit={dropdownProps?.onOptionEdit}
|
|
65
|
+
onOptionDelete={dropdownProps?.onOptionDelete}
|
|
66
|
+
onOptionCreate={dropdownProps?.onOptionCreate}
|
|
67
|
+
onActionConfirmClick={onConfirmChangesClick}
|
|
68
|
+
onActionCancelClick={() => setIsEditMode(v => !v)}
|
|
69
|
+
onChange={(data) => {
|
|
70
|
+
setNewValue(data);
|
|
71
|
+
setIsValueChanged(true);
|
|
72
|
+
}}
|
|
73
|
+
{...props}
|
|
74
|
+
isDefaultOpened={isEditMode}
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const renderTagsList = (props) => {
|
|
80
|
+
return (
|
|
81
|
+
<TagList
|
|
82
|
+
disabled={isLoading}
|
|
83
|
+
refProp={tagListRef}
|
|
84
|
+
{...listProps}
|
|
85
|
+
items={value}
|
|
86
|
+
onEditClick={() => setIsEditMode(v => !v)}
|
|
87
|
+
{...props}
|
|
88
|
+
/>
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const renderCompactMode = () => {
|
|
93
|
+
return renderTagsDropdown({
|
|
94
|
+
withActions: false,
|
|
95
|
+
withSearchInputInList: true,
|
|
96
|
+
customTriggerRef: tagListRef,
|
|
97
|
+
recalculateListContainerStylesTrigger: isRenderAllTags,
|
|
98
|
+
onDropdownListClose: onConfirmChangesClick,
|
|
99
|
+
renderCustomTrigger: ({ isOpen, setIsOpen, inputRef }) =>
|
|
100
|
+
renderTagsList({
|
|
101
|
+
onToggleRenderAll: v => setTimeout(() => setIsRenderAllTags(v), 1),
|
|
102
|
+
onEditClick: () => {
|
|
103
|
+
setIsOpen(!isEditMode);
|
|
104
|
+
if (isEditMode) onConfirmChangesClick();
|
|
105
|
+
else setIsEditMode(true);
|
|
106
|
+
},
|
|
107
|
+
}),
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
return useDropdownCompactMode
|
|
112
|
+
? renderCompactMode()
|
|
113
|
+
: isEditMode
|
|
114
|
+
? renderTagsDropdown({ withActions: true })
|
|
115
|
+
: renderTagsList();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export default TagListToDropdown;
|
|
@@ -18,6 +18,7 @@ export interface ITagsDropdownOption extends IUniProps {
|
|
|
18
18
|
isEditable?: boolean;
|
|
19
19
|
isChanged?: boolean;
|
|
20
20
|
isFreezed?: boolean;
|
|
21
|
+
readOnly?: boolean;
|
|
21
22
|
style?: CSSProperties;
|
|
22
23
|
closeOnOptionSelect?: boolean;
|
|
23
24
|
disabled?: boolean;
|
|
@@ -30,6 +31,7 @@ export interface ITagsDropdownOption extends IUniProps {
|
|
|
30
31
|
|
|
31
32
|
export interface ITagsDropdownProps extends IUniProps {
|
|
32
33
|
options: ITagsDropdownOption[];
|
|
34
|
+
tagsFullList: ITagsDropdownOption[];
|
|
33
35
|
chosenOptions: (string | number)[];
|
|
34
36
|
onChange?: (value: (string | number)[], key: string) => void;
|
|
35
37
|
tagClassname?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e,n){(null==n||n>e.length)&&(n=e.length);for(var l=0,t=Array(n);l<n;l++)t[l]=e[l];return t}function n(e,n,l){return n in e?Object.defineProperty(e,n,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[n]=l,e}function l(e){for(var l=1;l<arguments.length;l++){var t=null!=arguments[l]?arguments[l]:{},o=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.forEach(function(l){n(e,l,t[l])})}return e}function t(e,n){return n=null!=n?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):(function(e,n){var l=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);l.push.apply(l,t)}return l})(Object(n)).forEach(function(l){Object.defineProperty(e,l,Object.getOwnPropertyDescriptor(n,l))}),e}function o(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var l,t,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var r=[],i=!0,u=!1;try{for(o=o.call(e);!(i=(l=o.next()).done)&&(r.push(l.value),!n||r.length!==n);i=!0);}catch(e){u=!0,t=e}finally{try{i||null==o.return||o.return()}finally{if(u)throw t}}return r}}(e,n)||i(e,n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(n){return function(n){if(Array.isArray(n))return e(n)}(n)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||i(n)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(n,l){if(n){if("string"==typeof n)return e(n,l);var t=Object.prototype.toString.call(n).slice(8,-1);if("Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return e(n,l)}}Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return j}});var u=require("react/jsx-runtime"),a=w(require("classnames")),c=function(e,n){if(e&&e.__esModule)return e;if(null===e||(void 0===e?"undefined":e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)!="object"&&"function"!=typeof e)return{default:e};var l=y(n);if(l&&l.has(e))return l.get(e);var t={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if("default"!==r&&Object.prototype.hasOwnProperty.call(e,r)){var i=o?Object.getOwnPropertyDescriptor(e,r):null;i&&(i.get||i.set)?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,l&&l.set(e,t),t}(require("react")),s=require("react-dom"),d=require("react-feather"),v=require("../../../Functions/fieldValueFormatters"),f=require("../../../Functions/useDebounce"),m=w(require("../../../Functions/useIsMobile/useIsMobile")),p=w(require("../../UI/Button/Button")),h=w(require("../../UI/Tag/Tag")),g=w(require("../../UI/TagList/TagList")),b=w(require("../CheckboxInput/CheckboxInput")),_=w(require("../Input/Input"));function w(e){return e&&e.__esModule?e:{default:e}}function y(e){if("function"!=typeof WeakMap)return null;var n=new WeakMap,l=new WeakMap;return(y=function(e){return e?l:n})(e)}require("./TagsDropdown.scss");var x="tags-dropdown",N=["#F1F0F0","#E3E2E0","#EEDFDA","#F9DEC9","#FDECC8","#DBECDB","#D3E4EF","#E8DEEE","#F4E0E9","#FFE2DD","#D3EFED","#ECEEDE"],j=function(e){var i,w,y,j,C,E,O,S=e.options,L=e.chosenOptions,k=e.onChange,I=e.className,D=e.tagClassname,P=e.listClassName,M=e.onKeyPress,R=e.placeholder,A=e.label,T=e.disabled,F=e.isValuesInTags,H=e.error,B=e.isNotValidateASCII,q=void 0!==B&&B,z=e.noTagsWrap,W=void 0!==z&&z,U=e.headerContent,K=void 0===U?null:U,V=e.footerContent,X=void 0===V?null:V,Y=e.selectAllButtonRef,$=void 0===Y?null:Y,G=e.unselectAllButtonRef,J=void 0===G?null:G,Q=e.closeOnSelect,Z=void 0!==Q&&Q,ee=e.closeOnRemove,en=void 0!==ee&&ee,el=e.closeOnRemoveAll,et=void 0!==el&&el,eo=e.closeOnSelectAll,er=void 0!==eo&&eo,ei=e.closeOnSelectMobile,eu=void 0!==ei&&ei,ea=e.closeOnRemoveMobile,ec=void 0!==ea&&ea,es=e.closeOnRemoveAllMobile,ed=void 0!==es&&es,ev=e.closeOnSelectAllMobile,ef=void 0!==ev&&ev,em=e.fieldKey,ep=e.id,eh=e.noOptionsText,eg=void 0===eh?"No options available":eh,eb=e.mobileSearchPlaceholder,e_=e.isSearchable,ew=void 0===e_||e_,ey=e.useLiveSearch,ex=e.doRequest,eN=e.attributesOfNativeInput,ej=e.isUseLocalOptionsStore,eC=void 0===ej||ej,eE=e.isDefaultOpened,eO=void 0!==eE&&eE,eS=e.withMobileLogic,eL=e.withCreateLogic,ek=e.withActions,eI=e.withSearchInputInList,eD=e.renderOptionsAsTags,eP=e.minItemsForShowMobileSearch,eM=void 0===eP?10:eP,eR=e.onOptionCreate,eA=e.onOptionEdit,eT=e.onOptionDelete,eF=e.onActionConfirmClick,eH=e.onActionCancelClick,eB=e.onDropdownListClose,eq=e.customTriggerRef,ez=e.renderCustomTrigger,eW=e.recalculateListContainerStylesTrigger,eU=(0,c.useRef)(null),eK=(0,c.useRef)(null),eV=(0,c.useRef)(null),eX=(0,c.useRef)(null),eY=(0,c.useRef)(null),e$=(0,c.useRef)(null),eG=(0,m.default)().isMobile,eJ=eG&&eS&&window.screen.width<=768,eQ=o((0,c.useState)(ep||em||Math.random().toString(16).slice(2)),1)[0],eZ=o((0,c.useState)(!1),2),e0=eZ[0],e1=eZ[1],e2=o((0,c.useState)(0),2),e3=e2[0],e6=e2[1],e8=o((0,c.useState)(null),2),e5=e8[0],e9=e8[1],e4=o((0,c.useState)(null),2),e7=e4[0],ne=e4[1],nn=o((0,c.useState)(null),2),nl=nn[0],nt=nn[1],no=o((0,c.useState)(!1),2),nr=no[0],ni=no[1],nu=o((0,c.useState)(0),2),na=nu[0],nc=nu[1],ns=o((0,c.useState)(1),2),nd=ns[0],nv=ns[1],nf=(0,c.useRef)(null),nm=o((0,c.useState)(""),2),np=nm[0],nh=nm[1],ng=(0,f.useDebounce)({searchValue:np,delay:600}),nb=o((0,c.useState)(!1),2),n_=nb[0],nw=nb[1],ny=function(e){nh(e),nw(np!==e&&""===e),nf.current=e},nx=(0,c.useRef)(null),nN=o((0,c.useState)([]),2),nj=nN[0],nC=nN[1],nE=o((0,c.useState)(null),2),nO=nE[0],nS=nE[1],nL=function(e){nS(function(n){return e?t(l({},null!=n?n:{},"function"==typeof e?null==e?void 0:e(n):e),{isChanged:!!n}):e})},nk=(0,c.useMemo)(function(){return!!nO&&(!!nj.filter(function(e){return e.value!==nO.value}).some(function(e){return e.label===nO.label})||null)},[nj,nO]),nI=o((0,c.useState)({}),2),nD=nI[0],nP=nI[1],nM=(0,c.useMemo)(function(){var e=Math.floor(Math.random()*(N.length-1-0+1))+0;return N[e]},[nj.length]),nR=null==nj?void 0:nj.reduce(function(e,n){var l,t=function(e,n){var l=null==e?void 0:e.findIndex(function(e){return e.value===(null==n?void 0:n.value)});-1!==l?e[l]=n:e.push(n)};return n.groupName?null==(l=n.list)||l.map(function(n){return t(e,n)}):t(e,n),e},eC?null==(w=Object.keys(nD))?void 0:w.map(function(e){var n;return{value:e,label:null!=(n=null==nD?void 0:nD[e])?n:""}}):[]),nA=function(e){(eJ?ec:en)&&e1(!1),eC&&nP(function(o){return t(l({},o),n({},e,void 0))}),null==k||k(L.filter(function(n){return n!==e}),"chosenOptions")},nT=function(){var e,n;return null!=(n=null!=(e=document.querySelector("div#root"))?e:document.querySelector("div#app"))?n:document.querySelector("div#storybook-root")},nF=function(){var e,n=document.createElement("div");if(n.setAttribute("id",eQ),n.classList.add("tags-dropdown__container"),P&&n.classList.add(P),eJ&&n.addEventListener("click",function(e){e.target&&e.target.id===eQ&&e1(!1)}),eJ){try{null==(t=document.getElementById("mlw-".concat(eQ)))||t.remove()}catch(e){}var l,t,o=document.createElement("div");o.classList.add("tags-dropdown-mobile"),o.setAttribute("id","mlw-".concat(eQ)),null==o||o.append(n),null==(l=nT())||l.append(o)}else null==(e=nT())||e.append(n)},nH=function(){return document.getElementById(eQ)},nB=function(){var e=nH();if(!e||!e0)return!1;var n=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,l=null!=(x=null==eV||null==(h=eV.current)?void 0:h.getBoundingClientRect())?x:{},t=l.width,o=l.height,r=void 0===o?0:o,i=l.left,u=l.top,a=void 0===u?0:u,c=null==e$?void 0:e$.current,s=e.getElementsByClassName("tags-dropdown__list")[0],d=null==c?void 0:c.getElementsByClassName("tags-dropdown__header")[0],v=null==c?void 0:c.getElementsByClassName("tags-dropdown__footer")[0],f=Number.parseInt(null!=(N=null==(b=getComputedStyle(c))||null==(g=b.marginTop)?void 0:g.replace("px",""))?N:0,10),m=null!=(j=null==c||null==(_=c.getBoundingClientRect())?void 0:_.height)?j:0,p=500-(null!=(C=null==d||null==(w=d.getBoundingClientRect())?void 0:w.height)?C:0)-(null!=(E=null==v||null==(y=v.getBoundingClientRect())?void 0:y.height)?E:0);if(eJ&&eS)s.style.maxHeight="".concat(p,"px");else{var h,g,b,_,w,y,x,N,j,C,E,O,S,L,k,I,D=null==(O=getComputedStyle(s))?void 0:O.maxHeight,P=null!=e7?e7:Number.parseInt(null!=(k=null==D?void 0:D.replace("px",""))?k:0,10);null!==e7||Number.isNaN(P)||ne(P),void 0!==m&&m>P&&!Number.isNaN(P)&&(m=P-2*f);var M=ez?a-f-(null!=(I=null==eq||null==(L=eq.current)||null==(S=L.getBoundingClientRect())?void 0:S.height)?I:0):a-f,R=n-a-r-2*f,A=e5;!e5&&nj.length&&e9(A=M<R||R>=m?"bottom":"top"),m>("top"===A?M:R)&&((m=("top"===A?M:R)-3*f)<200&&(m=200),c&&(c.style.maxHeight="".concat(m,"px"))),e.style.minWidth="".concat(t,"px"),e.style.left="".concat(i,"px"),e.style.top="".concat("bottom"===A?a+r:a-m-2*f,"px")}},nq=function(){var e,n={label:np,style:{backgroundColor:nM},isEditable:!0,ref:(0,c.createRef)()};(null!=(e=null==eR?void 0:eR(n))?e:new Promise(function(e){return e(1)})).then(function(e){var l,t=Math.random().toString(16).slice(2);n.value=null!=(l=null==e?void 0:e.id)?l:t,nC(function(e){return r(e).concat([n])}),nh(""),nQ(n)})},nz=function(e,n){null==e||e.preventDefault(),null==e||e.stopPropagation(),nL((null==nO?void 0:nO.value)===(null==n?void 0:n.value)?null:n)},nW=function(){var e;(null!=(e=null==eT?void 0:eT(nO))?e:new Promise(function(e){return e(1)})).then(function(){(null==nO?void 0:nO.value)&&nA(null==nO?void 0:nO.value),nC(function(e){return e.filter(function(e){return e.value!==(null==nO?void 0:nO.value)})}),nL(null)})},nU=function(){if(!(null==nO?void 0:nO.isChanged)||nk)return nL(null),!1;null==eA||eA(nO),nC(function(e){return e.map(function(e){if(nO&&e.value===(null==nO?void 0:nO.value)){var n=l({},nO);return nL(null),n}return e})})},nK=function(){if(!nO||!(null==eY?void 0:eY.current))return null;var e,n,l,t,o,r,i,u,a,c=window.scrollX,s=window.scrollY,d={left:"modal-left",right:"modal-right",top:"modal-top",bottom:"modal-bottom"},v=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,f=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,m=null==nO||null==(e=nO.ref)?void 0:e.current,p=null!=(l=null==m?void 0:m.getBoundingClientRect())?l:{},h=p.x,g=p.y,b=void 0===g?0:g,_=p.width,w=p.height,y=void 0===w?0:w,x=null==e$||null==(n=e$.current)?void 0:n.getBoundingClientRect(),N=v-(null!=(t=null==x?void 0:x.x)?t:0)-(null!=(o=null==x?void 0:x.width)?o:0),j=f-b-s-y;Object.values(d).map(function(e){return eY.current&&eY.current.classList.remove(e),e}),eY.current.classList.add(null!=(r=null==d?void 0:d[N<200?"left":"right"])?r:""),eY.current.classList.add(null!=(i=null==d?void 0:d[j<200?"top":"bottom"])?i:""),u=eY.current,(null!=(a=HTMLElement)&&"undefined"!=typeof Symbol&&a[Symbol.hasInstance]?!!a[Symbol.hasInstance](u):u instanceof a)&&(eY.current.style.left="".concat((void 0===h?0:h)+c+(void 0===_?0:_),"px"),eY.current.style.top="".concat(b+s+y,"px"),eY.current.style.transform="translate(".concat(N<200?"calc(-100% + 7px)":"-35px",", ").concat(j<200?"calc(-100% - ".concat(y+10,"px)"):"10px",")"))},nV=function(e){var n,l,t,o,r,i,u=e.target;!e0||(null==(n=nH())?void 0:n.contains(u))||eY.current?eY.current&&!(null==(l=eY.current)?void 0:l.contains(u))&&((null==(i=document)||null==(r=i.getElementById)||null==(o=r.call(i,"editTrigger".concat(null==nO?void 0:nO.value)))||null==(t=o.contains)?void 0:t.call(o,u))||nU()):(e1(!1),null==eB||eB(e))},nX=function(e){var n;nV(e),e.target.isEqualNode(null==eU?void 0:eU.current)||null==eU||null==(n=eU.current)||n.blur()},nY=function(e){var n,l,t,o,r,i;return((null==e?void 0:e.tagName)!=="svg"||(null==e||null==(n=e.parentNode)?void 0:n.className)!=="tag__button")&&(null==e?void 0:e.tagName)!=="line"&&((null==e?void 0:e.tagName)==="svg"&&(null==e||null==(l=e.parentNode)?void 0:l.className)!=="tag__button"||(null==e||null==(o=e.className)||null==(t=o.indexOf)?void 0:t.call(o,"tag__label"))!==-1||(null==e||null==(i=e.className)||null==(r=i.indexOf)?void 0:r.call(i,"tag-list_wrapper"))!==-1||(null==e?void 0:e.className.indexOf("".concat(x,"__trigger")))!==-1||(null==e?void 0:e.className)==="tags-dropdown__arrow")},n$=function(e){if(e.isHiddenInList)return!1;var n=e.title||e.label;return!np.length||!!(null==n?void 0:n.toLowerCase().includes((null==np?void 0:np.toLowerCase())||""))},nG=function(e){return null==e?void 0:e.map(function(e){var n;return(null==e?void 0:e.groupName)?null!=(n=null==e?void 0:e.list)?n:[]:e}).flat()},nJ=(0,c.useCallback)(function(){return null==nj?void 0:nj.reduce(function(e,n){if(null==n?void 0:n.list){var l;e+=(null==n||null==(l=n.list)?void 0:l.length)||0}else++e;return e},0)},[nj]),nQ=function(e){return(null==e||!e.isFreezed)&&(((null==e?void 0:e.closeOnOptionSelect)!==void 0?e.closeOnOptionSelect&&e1(!1):(eJ?eu:Z)&&e1(!1),ny(""),e.value&&L.includes(e.value))?nA(e.value):(e.value&&eC&&nP(function(o){return e.value?t(l({},o),n({},e.value,null==e?void 0:e.label)):o}),e.value&&(null==k||k(r(L).concat([e.value]),"chosenOptions"))),null)},nZ=function(e){var n=e;q||(n=(0,v.formatToOnlyASCIICodeText)(n)),ny(n)},n0=function(e){e.target===(null==eK?void 0:eK.current)&&(e.stopPropagation(),e.preventDefault(),e1(!1))},n1=function(){var e,n=null==(e=nG(nj))?void 0:e.filter(function(e){var n=e.isFreezed,l=e.value;return l&&!n&&!(null==L?void 0:L.includes(null==l?void 0:l.toString()))&&"open_modal"!==l});eC&&nP(function(e){return null==n?void 0:n.reduce(function(e,n){var l=n.value,t=n.label;return l&&(e[l]=t),e},e)}),null==k||k(r(L).concat(r((null==n?void 0:n.map(function(e){var n=e.value;return null!=n?n:""}))||[])),"chosenOptions"),(eJ?ef:er)&&e1(!1)},n2=function(){eC&&nP({}),null==k||k(null==L?void 0:L.filter(function(e){var n,l;return null==(l=nG(nj))||null==(n=l.find(function(n){return n.value===e}))?void 0:n.isFreezed}),"chosenOptions"),(eJ?ed:et)&&e1(!1)},n3=(0,c.useCallback)(function(e){ex&&"function"==typeof ex&&+Math.round(e.target.clientHeight+e.target.scrollTop)==+e.target.scrollHeight&&ex(nf.current,!0)},[nj]),n6=function(e){var l,t=e.description,o=e.title||e.label,r=function(e){var n,l=null==e||null==(n=e.toLowerCase())?void 0:n.indexOf(null==np?void 0:np.toLowerCase());return -1===l?e:(0,u.jsxs)("pre",{className:"inherit-styles",children:[(0,u.jsx)("span",{children:e.substring(0,l)}),(0,u.jsx)("span",{className:"search-match bg--yellow",children:e.substring(l,l+(null==np?void 0:np.length))}),(0,u.jsx)("span",{children:e.substring(l+(null==np?void 0:np.length))})]})};return(0,u.jsxs)("button",{type:"button",ref:null==e?void 0:e.ref,onClick:function(n){n.preventDefault(),n.stopPropagation(),nQ(e)},className:(0,a.default)("".concat(x,"__list-item"),n({},"".concat(x,"__list-item_active"),null==L?void 0:L.some(function(n){return n===e.value})),n({},"".concat(x,"__list-item_disabled"),e.disabled),n({},"".concat(x,"__list-item_freezed"),null==e?void 0:e.isFreezed),n({},"".concat(x,"__list-item--editing"),(null==e?void 0:e.value)===(null==nO?void 0:nO.value)),e.className),children:[!eJ&&(0,u.jsx)("span",{className:(0,a.default)("".concat(x,"__active-icon"),n({},"".concat(x,"__active-icon_active"),null==L?void 0:L.some(function(n){return n===e.value}))),children:(0,u.jsx)(d.Check,{width:16,height:16,className:"color--text"})}),(0,u.jsxs)("div",{className:(0,a.default)("".concat(x,"__list-item-body")),children:[eD?(0,u.jsx)(h.default,{className:(0,a.default)("".concat(x,"__list-item-title"),null==e?void 0:e.labelClassName,{"tag_with-btn":!(null==e?void 0:e.isFreezed)}),label:o?r(o):"",style:null==e?void 0:e.style,isNoDismiss:!0},null==e?void 0:e.value):(0,u.jsx)("span",{className:(0,a.default)("".concat(x,"__list-item-title"),e.labelClassName),children:o?r(o):""}),t&&(0,u.jsx)("span",{className:(0,a.default)("".concat(x,"__list-item-description")),children:t})]}),!eJ&&(null==e?void 0:e.isEditable)&&eA&&eT&&(0,u.jsx)("div",{id:"editTrigger".concat(null==e?void 0:e.value),className:(0,a.default)("".concat(x,"__list-item-edit-trigger")),onClick:function(n){return nz(n,e)},children:(0,u.jsx)(d.MoreHorizontal,{})}),eJ?null!=(l=null==e?void 0:e.customMobileIcon)?l:(0,u.jsx)(b.default,{value:null==L?void 0:L.some(function(n){return n===e.value}),onChange:function(){nQ(e)},label:"",id:""}):""]},"".concat(x,"__list-item-").concat(e.id||e.value))},n8=function(){return(0,u.jsx)(_.default,l({ref:eU,className:(0,a.default)("".concat(x,"__input"),n({},"".concat(x,"__input--in-list"),eI)),value:np,onChange:nZ,placeholder:R||"Select from list",attributesOfNativeInput:t(l({},eN),{onKeyDown:function(e){13===e.keyCode&&eL&&eR&&nR.every(function(e){var n=e.label;return(null==n?void 0:n.toLowerCase())!==(null==np?void 0:np.toLowerCase())})&&nq(),null==M||M(e,np)}})},eL?{symbolsLimit:50}:{}))},n5=(0,c.useCallback)(function(){var e;return null!=(e=null==ez?void 0:ez({chosenOptions:L,singleLevelOptions:nR,deleteChosen:nA,inputRef:eU,onSearchHandler:nZ,isOpen:e0,setIsOpen:e1}))?e:(0,u.jsxs)("div",{className:(0,a.default)("".concat(x,"__trigger"),n({"tags-dropdown__error":H},"".concat(x,"__trigger--with-actions"),ek)),onClick:function(e){var n=e.target;(null==n?void 0:n.tagName)==="INPUT"?e1(!0):nY(n)&&e1(function(e){return!e})},children:[W?(0,u.jsx)(g.default,{items:null==L?void 0:L.map(function(e,n){var l=null==nR?void 0:nR.find(function(n){return n.value===e});return{value:e,label:F?null==l?void 0:l.value:(null==l?void 0:l.label)||(null==l?void 0:l.name)||(null==l?void 0:l.title),id:n,className:null==l?void 0:l.labelClassName,style:null==l?void 0:l.style}}),disableShowMore:!0}):null==L?void 0:L.map(function(e){var n=null==nR?void 0:nR.find(function(n){return n.value===e}),l=F?null==n?void 0:n.value:(null==n?void 0:n.label)||(null==n?void 0:n.name)||(null==n?void 0:n.title);return(0,u.jsx)(h.default,{className:(0,a.default)(D,null==n?void 0:n.labelClassName,{"tag_with-btn":!(null==n?void 0:n.isFreezed)}),label:l,style:null==n?void 0:n.style,removeItem:(null==n?void 0:n.isFreezed)?void 0:function(){return nA(e)},isNoDismiss:!1},e)}),0!==L.length&&W?"":n8(),(0,u.jsx)("span",{className:(0,a.default)("".concat(x,"__arrow"),n({},"".concat(x,"__arrow_active"),e0)),children:eJ?(0,u.jsx)(d.Code,{className:"mobile-icon"}):e0?(0,u.jsx)(d.ChevronUp,{className:"color--text"}):(0,u.jsx)(d.ChevronDown,{className:"color--text"})})]})},[L,nR,eU,e0]);return(0,c.useLayoutEffect)(function(){return nF(),eO&&!eG&&e1(!0),function(){var e,n;null==(e=nH())||e.remove(),null==(n=document.getElementById("mlw-".concat(eQ)))||n.remove()}},[]),(0,c.useLayoutEffect)(function(){var e;return eJ?(window.removeEventListener("mousewheel",nX),window.removeEventListener("wheel",nX),window.removeEventListener("touchmove",nX),window.removeEventListener("mouseup",nV)):(window.addEventListener("mousewheel",nX),window.addEventListener("wheel",nX),window.addEventListener("touchmove",nX),window.addEventListener("mouseup",nV)),null==(e=nH())||e.addEventListener("click",nX),function(){var e;window.removeEventListener("mousewheel",nX),window.removeEventListener("mouseup",nV),window.removeEventListener("wheel",nX),window.removeEventListener("touchmove",nX),null==(e=nH())||e.removeEventListener("click",nX)}},[nH,eJ]),(0,c.useLayoutEffect)(function(){e0&&(nB(),nK())},[e0,S,L,np,eJ,null==e$||null==(j=e$.current)||null==(y=j.getBoundingClientRect())?void 0:y.height,eW]),(0,c.useEffect)(function(){eC&&L.length!==Object.keys(nD).length&&nj.map(function(e){var o;return(null==e?void 0:e.value)&&!(null==nD?void 0:nD[null==e||null==(o=e.value)?void 0:o.toString()])&&nP(function(o){var r;return e.value?t(l({},o),n({},null==e||null==(r=e.value)?void 0:r.toString(),null==e?void 0:e.label)):o}),e})},[L,eC]),(0,c.useEffect)(function(){var e,n,l,t,o,r,i,u,a=function(){e6(window.scrollY)},c=e0?"addEventListener":"removeEventListener";null==$||null==(e=$.current)||e[c]("click",n1,!0),null==J||null==(n=J.current)||n[c]("click",n2,!0),e0?(eJ&&eS||window.removeEventListener("scroll",a),(null==eq?void 0:eq.current)&&(eq.current.style.pointerEvents="none"),null==(l=nH())||l.classList.add("tags-dropdown__container--opened"),eJ?null==eU||null==(i=eU.current)||null==(r=i.blur)||r.call(i):null==eU||null==(o=eU.current)||null==(t=o.focus)||t.call(o)):(eJ&&eS||window.addEventListener("scroll",a),(null==eq?void 0:eq.current)&&(eq.current.style.pointerEvents="auto"),null==(u=nH())||u.classList.remove("tags-dropdown__container--opened"),eI&&ny(""),e9(null),nh(""))},[e0]),(0,c.useEffect)(function(){var e,n,l,t,o,r=function(e){var n;nc(Number.parseInt(null==(n=e.target.scrollTop)?void 0:n.toString(),10))},i=function(e){e.preventDefault(),window.scrollTo({top:e3})};return e0&&eJ&&(null==eX?void 0:eX.current)&&(null==eX||null==(e=eX.current)||e.addEventListener("scroll",r),nt((null==eX||null==(n=eX.current)?void 0:n.scrollHeight)>(null==eX||null==(l=eX.current)?void 0:l.clientHeight)),null===nl&&ni((null==eX||null==(t=eX.current)?void 0:t.scrollHeight)>(null==eX||null==(o=eX.current)?void 0:o.clientHeight))),e0&&eX&&eX.current&&(eX.current.addEventListener("scroll",n3),eJ&&eS||window.addEventListener("scroll",i)),function(){var e,n;eJ&&eS||window.removeEventListener("scroll",i),null==eX||null==(e=eX.current)||e.removeEventListener("scroll",n3),null==eX||null==(n=eX.current)||n.removeEventListener("scroll",r)}},[e0,eJ,null==eX?void 0:eX.current,null==eX||null==(C=eX.current)?void 0:C.scrollHeight,null==eX||null==(E=eX.current)?void 0:E.clientHeight]),(0,c.useEffect)(function(){if(null==eX?void 0:eX.current){var e,n,l;nv(Number.parseInt((e=(null==eX||null==(n=eX.current)?void 0:n.scrollHeight)-(null==eX||null==(l=eX.current)?void 0:l.clientHeight),e.toString()),10))}},[na,null==eX?void 0:eX.current]),(0,c.useEffect)(function(){ew&&ey&&(ng||n_||e0)&&(null==ex||ex(ng))},[e0,ng,n_]),(0,c.useEffect)(function(){nC(S.map(function(e){return t(l({},e),{ref:(0,c.createRef)()})}))},[S]),(0,c.useEffect)(function(){if(nO){var e,n;nK(),null==nx||null==(n=nx.current)||null==(e=n.focus)||e.call(n)}},[null==nO?void 0:nO.value]),(0,u.jsxs)("div",{className:(0,a.default)(x,I,(n(O={},"".concat(x,"_disabled"),T),n(O,"".concat(x,"-mobile"),eJ),n(O,"".concat(x,"--focused"),e0&&!(null==eq?void 0:eq.current)&&!eJ),n(O,"".concat(x,"--custom-trigger"),!!(null==eq?void 0:eq.current)),O)),ref:eV,children:[n5(),ek&&(0,u.jsxs)("div",{className:(0,a.default)("".concat(x,"__actions")),children:[(0,u.jsx)("div",{className:(0,a.default)("".concat(x,"__actions-item")),onClick:eF,children:(0,u.jsx)(d.Check,{})}),(0,u.jsx)("div",{className:(0,a.default)("".concat(x,"__actions-item")),onClick:eH,children:(0,u.jsx)(d.X,{})})]}),e0&&((i=nH())?(0,s.createPortal)(function(){var e,o,r,i=null==nj?void 0:nj.reduce(function(e,n){if(n.groupName){var o,r=null==n||null==(o=n.list)?void 0:o.filter(function(e){return n$(e)});(null==r?void 0:r.length)&&e.push(t(l({},n),{list:r}))}else n$(n)&&e.push(n);return e},[]),c=[],v=!0,f=!1,m=void 0;try{for(var g,b,w,y=i[Symbol.iterator]();!(v=(w=y.next()).done);v=!0){var j,C,E,O,S=w.value;S.groupName?c.push((0,u.jsxs)("div",{className:(0,a.default)("".concat(x,"-group"),S.className),children:[(0,u.jsx)("span",{className:"".concat(x,"-group__name"),children:S.groupName}),null==(j=S.list)?void 0:j.map(function(e){return n6(e)})]},null==(O=S.groupName)||null==(E=O.toString())?void 0:E.replace(/ /g,"_").concat(null==(C=Date.now())?void 0:C.toString()))):c.push(n6(S))}}catch(e){f=!0,m=e}finally{try{v||null==y.return||y.return()}finally{if(f)throw m}}return(0,u.jsx)("div",{className:(0,a.default)("".concat(x,"__container-wrapper")),ref:eK,onClick:eJ?n0:function(){},children:(0,u.jsxs)("div",{ref:e$,className:(0,a.default)("".concat(x,"__selector-wrapper"),n({},"".concat(x,"__selector-wrapper--fixed-height"),nr&&eJ)),children:[K||eJ?(0,u.jsxs)("div",{className:(0,a.default)("".concat(x,"__header"),(n(o={},"".concat(x,"__header-with-shadow"),nl&&eJ),n(o,"".concat(x,"__header-with-shadow-hidden"),0===na),o)),children:[eJ&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)("div",{className:(0,a.default)("".concat(x,"__header-row")),children:[(0,u.jsx)("div",{className:(0,a.default)("".concat(x,"__label")),children:A}),(0,u.jsx)("div",{className:(0,a.default)("".concat(x,"__close-icon")),onClick:function(e){e.stopPropagation(),e1(!1)},children:(0,u.jsx)(d.X,{onClick:function(e){e.stopPropagation(),e1(!1)}})})]}),nJ()>(eM||10)&&(0,u.jsx)("div",{className:(0,a.default)("".concat(x,"__header-row")),children:(0,u.jsx)(_.default,l({className:"".concat(x,"__input"),value:np,onChange:function(e){return ny(e)},placeholder:eb||"Search",withDelete:!0,onMouseDown:function(){e0||e1(!0)}},eN))})]}),K&&(0,u.jsx)("div",{className:(0,a.default)("".concat(x,"__header-row")),children:K})]}):null,eI&&(0,u.jsx)("div",{className:(0,a.default)("".concat(x,"__input-list-wrapper")),children:n8()}),eL&&eR&&np&&i.length&&nR.every(function(e){var n=e.label;return(null==n?void 0:n.toLowerCase())!==(null==np?void 0:np.toLowerCase())})?(0,u.jsx)("div",{className:(0,a.default)("".concat(x,"__creatable-helper")),children:"Select an option or create one"}):null,(0,u.jsxs)("div",{ref:eX,className:"".concat(x,"__list ").concat(K||eJ?"".concat(x,"__list--with-header"):""," ").concat(X?"".concat(x,"__list--with-footer"):""),children:[c,(null==(g=i.filter(function(e){return"open_modal"!==e.value}))?void 0:g.length)!==0||eL&&np?null:(0,u.jsx)("div",{className:"".concat(x,"__no-options"),children:eg})]}),(X||eJ)&&(null==(b=i.filter(function(e){return"open_modal"!==e.value}))?void 0:b.length)>0?(0,u.jsxs)("div",{className:(0,a.default)("".concat(x,"__footer"),(n(r={},"".concat(x,"__footer-with-shadow"),eJ&&nl),n(r,"".concat(x,"__footer-with-shadow-hidden"),na===nd),r)),children:[X,eJ&&(0,u.jsxs)("button",{type:"button",onClick:function(){return e1(!1)},children:["Apply",(null==L?void 0:L.length)?"(".concat(null==L?void 0:L.length,")"):""]})]}):null,nO&&(0,s.createPortal)((0,u.jsxs)("div",{ref:eY,className:(0,a.default)("".concat(x,"__edit-option-modal")),children:[(0,u.jsxs)("div",{className:(0,a.default)("".concat(x,"__edit-option-modal-section")),children:[(0,u.jsx)(_.default,{value:null==nO?void 0:nO.label,onChange:function(e){return nL(function(n){return t(l({},n),{label:e})})},error:!!nk,onKeyDown:function(e){13===e&&nU()},symbolsLimit:"50",ref:nx}),(0,u.jsx)(p.default,{variant:"link",icon:(0,u.jsx)(d.Trash2,{}),label:"Delete",onClick:nW})]}),(0,u.jsx)("div",{className:(0,a.default)("".concat(x,"__edit-option-modal-section-divider"))}),(0,u.jsxs)("div",{className:(0,a.default)("".concat(x,"__edit-option-modal-section")),children:[(0,u.jsx)("h3",{children:"Colors"}),(0,u.jsx)("div",{className:(0,a.default)("".concat(x,"__edit-option-modal-section-colors")),children:N.map(function(e){var n;return(0,u.jsx)("div",{className:"color-block",style:{backgroundColor:e},onClick:function(){return nL(function(n){return t(l({},n),{style:t(l({},n?n.style:{}),{backgroundColor:e})})})},children:(null==nO||null==(n=nO.style)?void 0:n.backgroundColor)===e?(0,u.jsx)(d.Check,{}):null},e)})})]})]},"editOptionModal".concat(null==nO?void 0:nO.value)),null!=(e=document.getElementById("app"))?e:document.body),eL&&eR&&np&&nR.every(function(e){var n=e.label;return(null==n?void 0:n.toLowerCase())!==(null==np?void 0:np.toLowerCase())})&&(0,u.jsxs)("div",{className:(0,a.default)("".concat(x,"__create-option")),onClick:nq,children:["Create",(0,u.jsx)(h.default,{label:np,style:{backgroundColor:nM},isNoDismiss:!0})]})]})})}(),i):null)]})};
|
|
1
|
+
function e(e,n){(null==n||n>e.length)&&(n=e.length);for(var l=0,t=Array(n);l<n;l++)t[l]=e[l];return t}function n(e,n,l){return n in e?Object.defineProperty(e,n,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[n]=l,e}function l(e){for(var l=1;l<arguments.length;l++){var t=null!=arguments[l]?arguments[l]:{},o=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.forEach(function(l){n(e,l,t[l])})}return e}function t(e,n){return n=null!=n?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):(function(e,n){var l=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);l.push.apply(l,t)}return l})(Object(n)).forEach(function(l){Object.defineProperty(e,l,Object.getOwnPropertyDescriptor(n,l))}),e}function o(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var l,t,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var r=[],i=!0,u=!1;try{for(o=o.call(e);!(i=(l=o.next()).done)&&(r.push(l.value),!n||r.length!==n);i=!0);}catch(e){u=!0,t=e}finally{try{i||null==o.return||o.return()}finally{if(u)throw t}}return r}}(e,n)||i(e,n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(n){return function(n){if(Array.isArray(n))return e(n)}(n)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||i(n)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(n,l){if(n){if("string"==typeof n)return e(n,l);var t=Object.prototype.toString.call(n).slice(8,-1);if("Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return e(n,l)}}Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return j}});var u=require("react/jsx-runtime"),a=w(require("classnames")),c=function(e,n){if(e&&e.__esModule)return e;if(null===e||(void 0===e?"undefined":e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)!="object"&&"function"!=typeof e)return{default:e};var l=y(n);if(l&&l.has(e))return l.get(e);var t={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if("default"!==r&&Object.prototype.hasOwnProperty.call(e,r)){var i=o?Object.getOwnPropertyDescriptor(e,r):null;i&&(i.get||i.set)?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,l&&l.set(e,t),t}(require("react")),s=require("react-dom"),d=require("react-feather"),v=require("../../../Functions/fieldValueFormatters"),f=require("../../../Functions/useDebounce"),m=w(require("../../../Functions/useIsMobile/useIsMobile")),p=w(require("../../UI/Button/Button")),h=w(require("../../UI/Tag/Tag")),g=w(require("../../UI/TagList/TagList")),b=w(require("../CheckboxInput/CheckboxInput")),_=w(require("../Input/Input"));function w(e){return e&&e.__esModule?e:{default:e}}function y(e){if("function"!=typeof WeakMap)return null;var n=new WeakMap,l=new WeakMap;return(y=function(e){return e?l:n})(e)}require("./TagsDropdown.scss");var x="tags-dropdown",N=["#F1F0F0","#E3E2E0","#EEDFDA","#F9DEC9","#FDECC8","#DBECDB","#D3E4EF","#E8DEEE","#F4E0E9","#FFE2DD","#D3EFED","#ECEEDE"],j=function(e){var i,w,y,j,C,E,O,S=e.options,L=e.tagsFullList,k=e.chosenOptions,I=e.onChange,D=e.className,P=e.tagClassname,M=e.listClassName,R=e.onKeyPress,A=e.placeholder,F=e.label,T=e.disabled,H=e.isValuesInTags,B=e.error,q=e.isNotValidateASCII,z=void 0!==q&&q,W=e.noTagsWrap,U=void 0!==W&&W,K=e.headerContent,V=void 0===K?null:K,X=e.footerContent,Y=void 0===X?null:X,$=e.selectAllButtonRef,G=void 0===$?null:$,J=e.unselectAllButtonRef,Q=void 0===J?null:J,Z=e.closeOnSelect,ee=void 0!==Z&&Z,en=e.closeOnRemove,el=void 0!==en&&en,et=e.closeOnRemoveAll,eo=void 0!==et&&et,er=e.closeOnSelectAll,ei=void 0!==er&&er,eu=e.closeOnSelectMobile,ea=void 0!==eu&&eu,ec=e.closeOnRemoveMobile,es=void 0!==ec&&ec,ed=e.closeOnRemoveAllMobile,ev=void 0!==ed&&ed,ef=e.closeOnSelectAllMobile,em=void 0!==ef&&ef,ep=e.fieldKey,eh=e.id,eg=e.noOptionsText,eb=void 0===eg?"No options available":eg,e_=e.mobileSearchPlaceholder,ew=e.isSearchable,ey=void 0===ew||ew,ex=e.useLiveSearch,eN=e.doRequest,ej=e.attributesOfNativeInput,eC=e.isUseLocalOptionsStore,eE=void 0===eC||eC,eO=e.isDefaultOpened,eS=void 0!==eO&&eO,eL=e.withMobileLogic,ek=e.withCreateLogic,eI=e.withActions,eD=e.withSearchInputInList,eP=e.renderOptionsAsTags,eM=e.minItemsForShowMobileSearch,eR=void 0===eM?10:eM,eA=e.onOptionCreate,eF=e.onOptionEdit,eT=e.onOptionDelete,eH=e.onActionConfirmClick,eB=e.onActionCancelClick,eq=e.onDropdownListClose,ez=e.customTriggerRef,eW=e.renderCustomTrigger,eU=e.recalculateListContainerStylesTrigger,eK=(0,c.useRef)(null),eV=(0,c.useRef)(null),eX=(0,c.useRef)(null),eY=(0,c.useRef)(null),e$=(0,c.useRef)(null),eG=(0,c.useRef)(null),eJ=(0,m.default)().isMobile,eQ=eJ&&eL&&window.screen.width<=768,eZ=o((0,c.useState)(eh||ep||Math.random().toString(16).slice(2)),1)[0],e0=o((0,c.useState)(!1),2),e1=e0[0],e2=e0[1],e3=o((0,c.useState)(0),2),e6=e3[0],e8=e3[1],e5=o((0,c.useState)(null),2),e9=e5[0],e4=e5[1],e7=o((0,c.useState)(null),2),ne=e7[0],nn=e7[1],nl=o((0,c.useState)(null),2),nt=nl[0],no=nl[1],nr=o((0,c.useState)(!1),2),ni=nr[0],nu=nr[1],na=o((0,c.useState)(0),2),nc=na[0],ns=na[1],nd=o((0,c.useState)(1),2),nv=nd[0],nf=nd[1],nm=(0,c.useRef)(null),np=o((0,c.useState)(""),2),nh=np[0],ng=np[1],nb=(0,f.useDebounce)({searchValue:nh,delay:600}),n_=o((0,c.useState)(!1),2),nw=n_[0],ny=n_[1],nx=function(e){ng(e),ny(nh!==e&&""===e),nm.current=e},nN=(0,c.useRef)(null),nj=o((0,c.useState)([]),2),nC=nj[0],nE=nj[1],nO=o((0,c.useState)(null),2),nS=nO[0],nL=nO[1],nk=function(e){nL(function(n){return e?t(l({},null!=n?n:{},"function"==typeof e?null==e?void 0:e(n):e),{isChanged:!!n}):e})},nI=(0,c.useMemo)(function(){return!!nS&&(!!nC.filter(function(e){return e.value!==nS.value}).some(function(e){return e.label===nS.label})||null)},[nC,nS]),nD=o((0,c.useState)({}),2),nP=nD[0],nM=nD[1],nR=(0,c.useMemo)(function(){var e=Math.floor(Math.random()*(N.length-1-0+1))+0;return N[e]},[nC.length]),nA=null==nC?void 0:nC.reduce(function(e,n){var l,t=function(e,n){var l=null==e?void 0:e.findIndex(function(e){return e.value===(null==n?void 0:n.value)});-1!==l?e[l]=n:e.push(n)};return n.groupName?null==(l=n.list)||l.map(function(n){return t(e,n)}):t(e,n),e},eE?null==(w=Object.keys(nP))?void 0:w.map(function(e){var n;return{value:e,label:null!=(n=null==nP?void 0:nP[e])?n:""}}):[]),nF=function(e){(eQ?es:el)&&e2(!1),eE&&nM(function(o){return t(l({},o),n({},e,void 0))}),null==I||I(k.filter(function(n){return n!==e}),"chosenOptions")},nT=function(){var e,n;return null!=(n=null!=(e=document.querySelector("div#root"))?e:document.querySelector("div#app"))?n:document.querySelector("div#storybook-root")},nH=function(){var e,n=document.createElement("div");if(n.setAttribute("id",eZ),n.classList.add("tags-dropdown__container"),M&&n.classList.add(M),eQ&&n.addEventListener("click",function(e){e.target&&e.target.id===eZ&&e2(!1)}),eQ){try{null==(t=document.getElementById("mlw-".concat(eZ)))||t.remove()}catch(e){}var l,t,o=document.createElement("div");o.classList.add("tags-dropdown-mobile"),o.setAttribute("id","mlw-".concat(eZ)),null==o||o.append(n),null==(l=nT())||l.append(o)}else null==(e=nT())||e.append(n)},nB=function(){return document.getElementById(eZ)},nq=function(){var e=nB();if(!e||!e1)return!1;var n=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,l=null!=(x=null==eX||null==(h=eX.current)?void 0:h.getBoundingClientRect())?x:{},t=l.width,o=l.height,r=void 0===o?0:o,i=l.left,u=l.top,a=void 0===u?0:u,c=null==eG?void 0:eG.current,s=e.getElementsByClassName("tags-dropdown__list")[0],d=null==c?void 0:c.getElementsByClassName("tags-dropdown__header")[0],v=null==c?void 0:c.getElementsByClassName("tags-dropdown__footer")[0],f=Number.parseInt(null!=(N=null==(b=getComputedStyle(c))||null==(g=b.marginTop)?void 0:g.replace("px",""))?N:0,10),m=null!=(j=null==c||null==(_=c.getBoundingClientRect())?void 0:_.height)?j:0,p=500-(null!=(C=null==d||null==(w=d.getBoundingClientRect())?void 0:w.height)?C:0)-(null!=(E=null==v||null==(y=v.getBoundingClientRect())?void 0:y.height)?E:0);if(eQ&&eL)s.style.maxHeight="".concat(p,"px");else{var h,g,b,_,w,y,x,N,j,C,E,O,S,L,k,I,D=null==(O=getComputedStyle(s))?void 0:O.maxHeight,P=null!=ne?ne:Number.parseInt(null!=(k=null==D?void 0:D.replace("px",""))?k:0,10);null!==ne||Number.isNaN(P)||nn(P),void 0!==m&&m>P&&!Number.isNaN(P)&&(m=P-2*f);var M=eW?a-f-(null!=(I=null==ez||null==(L=ez.current)||null==(S=L.getBoundingClientRect())?void 0:S.height)?I:0):a-f,R=n-a-r-2*f,A=e9;!e9&&nC.length&&e4(A=M<R||R>=m?"bottom":"top"),m>("top"===A?M:R)&&((m=("top"===A?M:R)-3*f)<200&&(m=200),c&&(c.style.maxHeight="".concat(m,"px"))),e.style.minWidth="".concat(t,"px"),e.style.left="".concat(i,"px"),e.style.top="".concat("bottom"===A?a+r:a-m-2*f,"px")}},nz=function(){var e,n={label:nh,style:{backgroundColor:nR},isEditable:!0,ref:(0,c.createRef)()};(null!=(e=null==eA?void 0:eA(n))?e:new Promise(function(e){return e(1)})).then(function(e){var l,t=Math.random().toString(16).slice(2);n.value=null!=(l=null==e?void 0:e.id)?l:t,nE(function(e){return r(e).concat([n])}),ng(""),nZ(n)})},nW=function(e,n){null==e||e.preventDefault(),null==e||e.stopPropagation(),nk((null==nS?void 0:nS.value)===(null==n?void 0:n.value)?null:n)},nU=function(){var e;(null!=(e=null==eT?void 0:eT(nS))?e:new Promise(function(e){return e(1)})).then(function(){(null==nS?void 0:nS.value)&&nF(null==nS?void 0:nS.value),nE(function(e){return e.filter(function(e){return e.value!==(null==nS?void 0:nS.value)})}),nk(null)})},nK=function(){if(!(null==nS?void 0:nS.isChanged)||nI)return nk(null),!1;null==eF||eF(nS),nE(function(e){return e.map(function(e){if(nS&&e.value===(null==nS?void 0:nS.value)){var n=l({},nS);return nk(null),n}return e})})},nV=function(){if(!nS||!(null==e$?void 0:e$.current))return null;var e,n,l,t,o,r,i,u,a,c=window.scrollX,s=window.scrollY,d={left:"modal-left",right:"modal-right",top:"modal-top",bottom:"modal-bottom"},v=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,f=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,m=null==nS||null==(e=nS.ref)?void 0:e.current,p=null!=(l=null==m?void 0:m.getBoundingClientRect())?l:{},h=p.x,g=p.y,b=void 0===g?0:g,_=p.width,w=p.height,y=void 0===w?0:w,x=null==eG||null==(n=eG.current)?void 0:n.getBoundingClientRect(),N=v-(null!=(t=null==x?void 0:x.x)?t:0)-(null!=(o=null==x?void 0:x.width)?o:0),j=f-b-s-y;Object.values(d).map(function(e){return e$.current&&e$.current.classList.remove(e),e}),e$.current.classList.add(null!=(r=null==d?void 0:d[N<200?"left":"right"])?r:""),e$.current.classList.add(null!=(i=null==d?void 0:d[j<200?"top":"bottom"])?i:""),u=e$.current,(null!=(a=HTMLElement)&&"undefined"!=typeof Symbol&&a[Symbol.hasInstance]?!!a[Symbol.hasInstance](u):u instanceof a)&&(e$.current.style.left="".concat((void 0===h?0:h)+c+(void 0===_?0:_),"px"),e$.current.style.top="".concat(b+s+y,"px"),e$.current.style.transform="translate(".concat(N<200?"calc(-100% + 7px)":"-35px",", ").concat(j<200?"calc(-100% - ".concat(y+10,"px)"):"10px",")"))},nX=function(e){var n,l,t,o,r,i,u=e.target;!e1||(null==(n=nB())?void 0:n.contains(u))||e$.current?e$.current&&!(null==(l=e$.current)?void 0:l.contains(u))&&((null==(i=document)||null==(r=i.getElementById)||null==(o=r.call(i,"editTrigger".concat(null==nS?void 0:nS.value)))||null==(t=o.contains)?void 0:t.call(o,u))||nK()):(e2(!1),null==eq||eq(e))},nY=function(e){var n;nX(e),e.target.isEqualNode(null==eK?void 0:eK.current)||null==eK||null==(n=eK.current)||n.blur()},n$=function(e){var n,l,t,o,r,i;return((null==e?void 0:e.tagName)!=="svg"||(null==e||null==(n=e.parentNode)?void 0:n.className)!=="tag__button")&&(null==e?void 0:e.tagName)!=="line"&&((null==e?void 0:e.tagName)==="svg"&&(null==e||null==(l=e.parentNode)?void 0:l.className)!=="tag__button"||(null==e||null==(o=e.className)||null==(t=o.indexOf)?void 0:t.call(o,"tag__label"))!==-1||(null==e||null==(i=e.className)||null==(r=i.indexOf)?void 0:r.call(i,"tag-list_wrapper"))!==-1||(null==e?void 0:e.className.indexOf("".concat(x,"__trigger")))!==-1||(null==e?void 0:e.className)==="tags-dropdown__arrow")},nG=function(e){if(e.isHiddenInList)return!1;var n=e.title||e.label;return!nh.length||!!(null==n?void 0:n.toLowerCase().includes((null==nh?void 0:nh.toLowerCase())||""))},nJ=function(e){return null==e?void 0:e.map(function(e){var n;return(null==e?void 0:e.groupName)?null!=(n=null==e?void 0:e.list)?n:[]:e}).flat()},nQ=(0,c.useCallback)(function(){return null==nC?void 0:nC.reduce(function(e,n){if(null==n?void 0:n.list){var l;e+=(null==n||null==(l=n.list)?void 0:l.length)||0}else++e;return e},0)},[nC]),nZ=function(e){return(null==e||!e.isFreezed)&&(((null==e?void 0:e.closeOnOptionSelect)!==void 0?e.closeOnOptionSelect&&e2(!1):(eQ?ea:ee)&&e2(!1),nx(""),e.value&&k.includes(e.value))?nF(e.value):(e.value&&eE&&nM(function(o){return e.value?t(l({},o),n({},e.value,null==e?void 0:e.label)):o}),e.value&&(null==I||I(r(k).concat([e.value]),"chosenOptions"))),null)},n0=function(e){var n=e;z||(n=(0,v.formatToOnlyASCIICodeText)(n)),nx(n)},n1=function(e){e.target===(null==eV?void 0:eV.current)&&(e.stopPropagation(),e.preventDefault(),e2(!1))},n2=function(){var e,n=null==(e=nJ(nC))?void 0:e.filter(function(e){var n=e.isFreezed,l=e.value;return l&&!n&&!(null==k?void 0:k.includes(null==l?void 0:l.toString()))&&"open_modal"!==l});eE&&nM(function(e){return null==n?void 0:n.reduce(function(e,n){var l=n.value,t=n.label;return l&&(e[l]=t),e},e)}),null==I||I(r(k).concat(r((null==n?void 0:n.map(function(e){var n=e.value;return null!=n?n:""}))||[])),"chosenOptions"),(eQ?em:ei)&&e2(!1)},n3=function(){eE&&nM({}),null==I||I(null==k?void 0:k.filter(function(e){var n,l;return null==(l=nJ(nC))||null==(n=l.find(function(n){return n.value===e}))?void 0:n.isFreezed}),"chosenOptions"),(eQ?ev:eo)&&e2(!1)},n6=(0,c.useCallback)(function(e){eN&&"function"==typeof eN&&+Math.round(e.target.clientHeight+e.target.scrollTop)==+e.target.scrollHeight&&eN(nm.current,!0)},[nC]),n8=function(e){var l,t=e.description,o=e.title||e.label,r=function(e){var n,l=null==e||null==(n=e.toLowerCase())?void 0:n.indexOf(null==nh?void 0:nh.toLowerCase());return -1===l?e:(0,u.jsxs)("pre",{className:"inherit-styles",children:[(0,u.jsx)("span",{children:e.substring(0,l)}),(0,u.jsx)("span",{className:"search-match bg--yellow",children:e.substring(l,l+(null==nh?void 0:nh.length))}),(0,u.jsx)("span",{children:e.substring(l+(null==nh?void 0:nh.length))})]})};return(0,u.jsxs)("button",{type:"button",ref:null==e?void 0:e.ref,onClick:function(n){n.preventDefault(),n.stopPropagation(),nZ(e)},className:(0,a.default)("".concat(x,"__list-item"),n({},"".concat(x,"__list-item_active"),null==k?void 0:k.some(function(n){return n===e.value})),n({},"".concat(x,"__list-item_disabled"),e.disabled),n({},"".concat(x,"__list-item_freezed"),null==e?void 0:e.isFreezed),n({},"".concat(x,"__list-item--editing"),(null==e?void 0:e.value)===(null==nS?void 0:nS.value)),e.className),children:[!eQ&&(0,u.jsx)("span",{className:(0,a.default)("".concat(x,"__active-icon"),n({},"".concat(x,"__active-icon_active"),null==k?void 0:k.some(function(n){return n===e.value}))),children:(0,u.jsx)(d.Check,{width:16,height:16,className:"color--text"})}),(0,u.jsxs)("div",{className:(0,a.default)("".concat(x,"__list-item-body")),children:[eP?(0,u.jsx)(h.default,{className:(0,a.default)("".concat(x,"__list-item-title"),null==e?void 0:e.labelClassName,{"tag_with-btn":!(null==e?void 0:e.isFreezed)}),label:o?r(o):"",style:null==e?void 0:e.style,isNoDismiss:!0},null==e?void 0:e.value):(0,u.jsx)("span",{className:(0,a.default)("".concat(x,"__list-item-title"),e.labelClassName),children:o?r(o):""}),t&&(0,u.jsx)("span",{className:(0,a.default)("".concat(x,"__list-item-description")),children:t})]}),!eQ&&(null==e?void 0:e.isEditable)&&eF&&eT&&(0,u.jsx)("div",{id:"editTrigger".concat(null==e?void 0:e.value),className:(0,a.default)("".concat(x,"__list-item-edit-trigger")),onClick:function(n){return nW(n,e)},children:(0,u.jsx)(d.MoreHorizontal,{})}),eQ?null!=(l=null==e?void 0:e.customMobileIcon)?l:(0,u.jsx)(b.default,{value:null==k?void 0:k.some(function(n){return n===e.value}),onChange:function(){nZ(e)},label:"",id:""}):""]},"".concat(x,"__list-item-").concat(e.id||e.value))},n5=function(){return(0,u.jsx)(_.default,l({ref:eK,className:(0,a.default)("".concat(x,"__input"),n({},"".concat(x,"__input--in-list"),eD)),value:nh,onChange:n0,placeholder:A||"Select from list",attributesOfNativeInput:t(l({},ej),{onKeyDown:function(e){13===e.keyCode&&ek&&eA&&nA.every(function(e){var n=e.label;return(null==n?void 0:n.toLowerCase())!==(null==nh?void 0:nh.toLowerCase())})&&nz(),null==R||R(e,nh)}})},ek?{symbolsLimit:50}:{}))},n9=(0,c.useCallback)(function(){var e;return null!=(e=null==eW?void 0:eW({chosenOptions:k,singleLevelOptions:nA,deleteChosen:nF,inputRef:eK,onSearchHandler:n0,isOpen:e1,setIsOpen:e2}))?e:(0,u.jsxs)("div",{className:(0,a.default)("".concat(x,"__trigger"),n({"tags-dropdown__error":B},"".concat(x,"__trigger--with-actions"),eI)),onClick:function(e){var n=e.target;(null==n?void 0:n.tagName)==="INPUT"?e2(!0):n$(n)&&e2(function(e){return!e})},children:[U?(0,u.jsx)(g.default,{items:null==k?void 0:k.map(function(e,n){var l=null==nA?void 0:nA.find(function(n){return n.value===e});return{value:e,label:H?null==l?void 0:l.value:(null==l?void 0:l.label)||(null==l?void 0:l.name)||(null==l?void 0:l.title),id:n,className:null==l?void 0:l.labelClassName,style:null==l?void 0:l.style}}),disableShowMore:!0}):null==k?void 0:k.map(function(e){var n=null==nA?void 0:nA.find(function(n){return n.value===e}),l=H?null==n?void 0:n.value:(null==n?void 0:n.label)||(null==n?void 0:n.name)||(null==n?void 0:n.title);return(0,u.jsx)(h.default,{className:(0,a.default)(P,null==n?void 0:n.labelClassName,{"tag_with-btn":!(null==n?void 0:n.isFreezed)}),label:l,style:null==n?void 0:n.style,removeItem:(null==n?void 0:n.isFreezed)||(null==n?void 0:n.readOnly)?void 0:function(){return nF(e)},isNoDismiss:!1},e)}),0!==k.length&&U?"":n5(),(0,u.jsx)("span",{className:(0,a.default)("".concat(x,"__arrow"),n({},"".concat(x,"__arrow_active"),e1)),children:eQ?(0,u.jsx)(d.Code,{className:"mobile-icon"}):e1?(0,u.jsx)(d.ChevronUp,{className:"color--text"}):(0,u.jsx)(d.ChevronDown,{className:"color--text"})})]})},[k,nA,eK,e1]);return(0,c.useLayoutEffect)(function(){return nH(),eS&&!eJ&&e2(!0),function(){var e,n;null==(e=nB())||e.remove(),null==(n=document.getElementById("mlw-".concat(eZ)))||n.remove()}},[]),(0,c.useLayoutEffect)(function(){var e;return eQ?(window.removeEventListener("mousewheel",nY),window.removeEventListener("wheel",nY),window.removeEventListener("touchmove",nY),window.removeEventListener("mouseup",nX)):(window.addEventListener("mousewheel",nY),window.addEventListener("wheel",nY),window.addEventListener("touchmove",nY),window.addEventListener("mouseup",nX)),null==(e=nB())||e.addEventListener("click",nY),function(){var e;window.removeEventListener("mousewheel",nY),window.removeEventListener("mouseup",nX),window.removeEventListener("wheel",nY),window.removeEventListener("touchmove",nY),null==(e=nB())||e.removeEventListener("click",nY)}},[nB,eQ]),(0,c.useLayoutEffect)(function(){e1&&(nq(),nV())},[e1,S,k,nh,eQ,null==eG||null==(j=eG.current)||null==(y=j.getBoundingClientRect())?void 0:y.height,eU]),(0,c.useEffect)(function(){eE&&k.length!==Object.keys(nP).length&&nC.map(function(e){var o;return(null==e?void 0:e.value)&&!(null==nP?void 0:nP[null==e||null==(o=e.value)?void 0:o.toString()])&&nM(function(o){var r;return e.value?t(l({},o),n({},null==e||null==(r=e.value)?void 0:r.toString(),null==e?void 0:e.label)):o}),e})},[k,eE]),(0,c.useEffect)(function(){var e,n,l,t,o,r,i,u,a=function(){e8(window.scrollY)},c=e1?"addEventListener":"removeEventListener";null==G||null==(e=G.current)||e[c]("click",n2,!0),null==Q||null==(n=Q.current)||n[c]("click",n3,!0),e1?(eQ&&eL||window.removeEventListener("scroll",a),(null==ez?void 0:ez.current)&&(ez.current.style.pointerEvents="none"),null==(l=nB())||l.classList.add("tags-dropdown__container--opened"),eQ?null==eK||null==(i=eK.current)||null==(r=i.blur)||r.call(i):null==eK||null==(o=eK.current)||null==(t=o.focus)||t.call(o)):(eQ&&eL||window.addEventListener("scroll",a),(null==ez?void 0:ez.current)&&(ez.current.style.pointerEvents="auto"),null==(u=nB())||u.classList.remove("tags-dropdown__container--opened"),eD&&nx(""),e4(null),ng(""))},[e1]),(0,c.useEffect)(function(){var e,n,l,t,o,r=function(e){var n;ns(Number.parseInt(null==(n=e.target.scrollTop)?void 0:n.toString(),10))},i=function(e){e.preventDefault(),window.scrollTo({top:e6})};return e1&&eQ&&(null==eY?void 0:eY.current)&&(null==eY||null==(e=eY.current)||e.addEventListener("scroll",r),no((null==eY||null==(n=eY.current)?void 0:n.scrollHeight)>(null==eY||null==(l=eY.current)?void 0:l.clientHeight)),null===nt&&nu((null==eY||null==(t=eY.current)?void 0:t.scrollHeight)>(null==eY||null==(o=eY.current)?void 0:o.clientHeight))),e1&&eY&&eY.current&&(eY.current.addEventListener("scroll",n6),eQ&&eL||window.addEventListener("scroll",i)),function(){var e,n;eQ&&eL||window.removeEventListener("scroll",i),null==eY||null==(e=eY.current)||e.removeEventListener("scroll",n6),null==eY||null==(n=eY.current)||n.removeEventListener("scroll",r)}},[e1,eQ,null==eY?void 0:eY.current,null==eY||null==(C=eY.current)?void 0:C.scrollHeight,null==eY||null==(E=eY.current)?void 0:E.clientHeight]),(0,c.useEffect)(function(){if(null==eY?void 0:eY.current){var e,n,l;nf(Number.parseInt((e=(null==eY||null==(n=eY.current)?void 0:n.scrollHeight)-(null==eY||null==(l=eY.current)?void 0:l.clientHeight),e.toString()),10))}},[nc,null==eY?void 0:eY.current]),(0,c.useEffect)(function(){ey&&ex&&(nb||nw||e1)&&(null==eN||eN(nb))},[e1,nb,nw]),(0,c.useEffect)(function(){nE(L.map(function(e){return t(l({},e),{ref:(0,c.createRef)()})}))},[S]),(0,c.useEffect)(function(){if(nS){var e,n;nV(),null==nN||null==(n=nN.current)||null==(e=n.focus)||e.call(n)}},[null==nS?void 0:nS.value]),(0,u.jsxs)("div",{className:(0,a.default)(x,D,(n(O={},"".concat(x,"_disabled"),T),n(O,"".concat(x,"-mobile"),eQ),n(O,"".concat(x,"--focused"),e1&&!(null==ez?void 0:ez.current)&&!eQ),n(O,"".concat(x,"--custom-trigger"),!!(null==ez?void 0:ez.current)),O)),ref:eX,children:[n9(),eI&&(0,u.jsxs)("div",{className:(0,a.default)("".concat(x,"__actions")),children:[(0,u.jsx)("div",{className:(0,a.default)("".concat(x,"__actions-item")),onClick:eH,children:(0,u.jsx)(d.Check,{})}),(0,u.jsx)("div",{className:(0,a.default)("".concat(x,"__actions-item")),onClick:eB,children:(0,u.jsx)(d.X,{})})]}),e1&&((i=nB())?(0,s.createPortal)(function(){var e,o,r,i=null==nC?void 0:nC.reduce(function(e,n){if(n.groupName){var o,r=null==n||null==(o=n.list)?void 0:o.filter(function(e){return nG(e)});(null==r?void 0:r.length)&&e.push(t(l({},n),{list:r}))}else nG(n)&&e.push(n);return e},[]),c=[],v=!0,f=!1,m=void 0;try{for(var g,b,w,y=i[Symbol.iterator]();!(v=(w=y.next()).done);v=!0){var j,C,E,O,S=w.value;S.groupName?c.push((0,u.jsxs)("div",{className:(0,a.default)("".concat(x,"-group"),S.className),children:[(0,u.jsx)("span",{className:"".concat(x,"-group__name"),children:S.groupName}),null==(j=S.list)?void 0:j.map(function(e){return n8(e)})]},null==(O=S.groupName)||null==(E=O.toString())?void 0:E.replace(/ /g,"_").concat(null==(C=Date.now())?void 0:C.toString()))):S.readOnly||c.push(n8(S))}}catch(e){f=!0,m=e}finally{try{v||null==y.return||y.return()}finally{if(f)throw m}}return(0,u.jsx)("div",{className:(0,a.default)("".concat(x,"__container-wrapper")),ref:eV,onClick:eQ?n1:function(){},children:(0,u.jsxs)("div",{ref:eG,className:(0,a.default)("".concat(x,"__selector-wrapper"),n({},"".concat(x,"__selector-wrapper--fixed-height"),ni&&eQ)),children:[V||eQ?(0,u.jsxs)("div",{className:(0,a.default)("".concat(x,"__header"),(n(o={},"".concat(x,"__header-with-shadow"),nt&&eQ),n(o,"".concat(x,"__header-with-shadow-hidden"),0===nc),o)),children:[eQ&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)("div",{className:(0,a.default)("".concat(x,"__header-row")),children:[(0,u.jsx)("div",{className:(0,a.default)("".concat(x,"__label")),children:F}),(0,u.jsx)("div",{className:(0,a.default)("".concat(x,"__close-icon")),onClick:function(e){e.stopPropagation(),e2(!1)},children:(0,u.jsx)(d.X,{onClick:function(e){e.stopPropagation(),e2(!1)}})})]}),nQ()>(eR||10)&&(0,u.jsx)("div",{className:(0,a.default)("".concat(x,"__header-row")),children:(0,u.jsx)(_.default,l({className:"".concat(x,"__input"),value:nh,onChange:function(e){return nx(e)},placeholder:e_||"Search",withDelete:!0,onMouseDown:function(){e1||e2(!0)}},ej))})]}),V&&(0,u.jsx)("div",{className:(0,a.default)("".concat(x,"__header-row")),children:V})]}):null,eD&&(0,u.jsx)("div",{className:(0,a.default)("".concat(x,"__input-list-wrapper")),children:n5()}),ek&&eA&&nh&&i.length&&nA.every(function(e){var n=e.label;return(null==n?void 0:n.toLowerCase())!==(null==nh?void 0:nh.toLowerCase())})?(0,u.jsx)("div",{className:(0,a.default)("".concat(x,"__creatable-helper")),children:"Select an option or create one"}):null,(0,u.jsxs)("div",{ref:eY,className:"".concat(x,"__list ").concat(V||eQ?"".concat(x,"__list--with-header"):""," ").concat(Y?"".concat(x,"__list--with-footer"):""),children:[c,(null==(g=i.filter(function(e){return"open_modal"!==e.value}))?void 0:g.length)!==0||ek&&nh?null:(0,u.jsx)("div",{className:"".concat(x,"__no-options"),children:eb})]}),(Y||eQ)&&(null==(b=i.filter(function(e){return"open_modal"!==e.value}))?void 0:b.length)>0?(0,u.jsxs)("div",{className:(0,a.default)("".concat(x,"__footer"),(n(r={},"".concat(x,"__footer-with-shadow"),eQ&&nt),n(r,"".concat(x,"__footer-with-shadow-hidden"),nc===nv),r)),children:[Y,eQ&&(0,u.jsxs)("button",{type:"button",onClick:function(){return e2(!1)},children:["Apply",(null==k?void 0:k.length)?"(".concat(null==k?void 0:k.length,")"):""]})]}):null,nS&&(0,s.createPortal)((0,u.jsxs)("div",{ref:e$,className:(0,a.default)("".concat(x,"__edit-option-modal")),children:[(0,u.jsxs)("div",{className:(0,a.default)("".concat(x,"__edit-option-modal-section")),children:[(0,u.jsx)(_.default,{value:null==nS?void 0:nS.label,onChange:function(e){return nk(function(n){return t(l({},n),{label:e})})},error:!!nI,onKeyDown:function(e){13===e&&nK()},symbolsLimit:"50",ref:nN}),(0,u.jsx)(p.default,{variant:"link",icon:(0,u.jsx)(d.Trash2,{}),label:"Delete",onClick:nU})]}),(0,u.jsx)("div",{className:(0,a.default)("".concat(x,"__edit-option-modal-section-divider"))}),(0,u.jsxs)("div",{className:(0,a.default)("".concat(x,"__edit-option-modal-section")),children:[(0,u.jsx)("h3",{children:"Colors"}),(0,u.jsx)("div",{className:(0,a.default)("".concat(x,"__edit-option-modal-section-colors")),children:N.map(function(e){var n;return(0,u.jsx)("div",{className:"color-block",style:{backgroundColor:e},onClick:function(){return nk(function(n){return t(l({},n),{style:t(l({},n?n.style:{}),{backgroundColor:e})})})},children:(null==nS||null==(n=nS.style)?void 0:n.backgroundColor)===e?(0,u.jsx)(d.Check,{}):null},e)})})]})]},"editOptionModal".concat(null==nS?void 0:nS.value)),null!=(e=document.getElementById("root"))?e:document.body),ek&&eA&&nh&&nA.every(function(e){var n=e.label;return(null==n?void 0:n.toLowerCase())!==(null==nh?void 0:nh.toLowerCase())})&&(0,u.jsxs)("div",{className:(0,a.default)("".concat(x,"__create-option")),onClick:nz,children:["Create",(0,u.jsx)(h.default,{label:nh,style:{backgroundColor:nR},isNoDismiss:!0})]})]})})}(),i):null)]})};
|