intelicoreact 1.8.8 → 1.8.10
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 -1
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN_old.jsx +121 -1
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.jsx +507 -1
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.jsx +46 -1
- package/dist/Atomic/FormElements/NumericInput/NumericInput.jsx +337 -1
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.jsx +66 -1
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.jsx +78 -1
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.jsx +54 -1
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.jsx +183 -1
- package/dist/Atomic/FormElements/RangeList/RangeList.jsx +181 -1
- package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.jsx +41 -1
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.jsx +449 -1
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.jsx +865 -1
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.jsx +37 -1
- package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.jsx +48 -1
- package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.jsx +62 -1
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.jsx +175 -1
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.jsx +65 -1
- package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.jsx +118 -1
- package/dist/Atomic/FormElements/Text/Text.jsx +126 -1
- package/dist/Atomic/FormElements/Textarea/Textarea.jsx +61 -1
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.jsx +181 -1
- package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.jsx +60 -1
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.jsx +83 -1
- package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.jsx +80 -1
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.jsx +103 -1
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.jsx +115 -1
- package/dist/Atomic/Layout/Header/Header.jsx +86 -1
- package/dist/Atomic/Layout/MainMenu/MainMenu.jsx +164 -1
- package/dist/Atomic/UI/AccordionTable/AccordionTable.jsx +250 -1
- package/dist/Atomic/UI/AccordionText/AccordionText.jsx +68 -1
- package/dist/Atomic/UI/Arrow/Arrow.jsx +134 -1
- package/dist/Atomic/UI/Box/Box.jsx +53 -1
- package/dist/Atomic/UI/Chart/Chart.jsx +178 -1
- package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.jsx +78 -1
- package/dist/Atomic/UI/Chart/partial/optionsConstructor.jsx +334 -1
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.jsx +111 -1
- package/dist/Atomic/UI/DateTime/DateTime.jsx +57 -1
- package/dist/Atomic/UI/DebugContainer/DebugContainer.jsx +44 -1
- package/dist/Atomic/UI/DebugContainer/useDebugContainer.jsx +15 -1
- package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.jsx +223 -1
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion._test.jsx +75 -1
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.jsx +86 -1
- package/dist/Atomic/UI/PieChart/PieChart.jsx +41 -1
- package/dist/Atomic/UI/Table/Partials/TdCell.jsx +87 -1
- package/dist/Atomic/UI/Table/Partials/TdHeader.jsx +36 -1
- package/dist/Atomic/UI/Table/Partials/TdRow.jsx +103 -1
- package/dist/Atomic/UI/Table/Partials/TdTitle.jsx +55 -1
- package/dist/Atomic/UI/Table/Table.jsx +63 -1
- package/dist/Atomic/UI/Table/TdTypes/TdActions.jsx +80 -1
- package/dist/Atomic/UI/Table/TdTypes/TdPriority.jsx +26 -1
- package/dist/Atomic/UI/Table/TdTypes/TdRange.jsx +13 -1
- package/dist/Atomic/UI/Table/TdTypes/TdWeight.jsx +56 -1
- package/dist/Atomic/UI/TagList/TagList.jsx +256 -1
- package/dist/Atomic/UI/WizardStepper/constructor.jsx +86 -1
- package/dist/Classes/RESTAPI/partials/CredentialsProcessing.jsx +254 -1
- package/dist/Functions/customEventListener.jsx +96 -1
- package/dist/Functions/operations.jsx +138 -1
- package/dist/Functions/useFormTools/functions/RenderFields.jsx +108 -1
- package/dist/Functions/useFormTools/index.jsx +777 -1
- package/dist/Functions/usePasswordChecker.jsx +128 -1
- package/dist/Functions/utils.jsx +492 -1
- package/dist/Molecular/CustomIcons/components/AffiliateNetworks.jsx +22 -1
- package/dist/Molecular/CustomIcons/components/AlertCircle.jsx +24 -1
- package/dist/Molecular/CustomIcons/components/AppStore.jsx +30 -1
- package/dist/Molecular/CustomIcons/components/Arrow.jsx +33 -1
- package/dist/Molecular/CustomIcons/components/ArrowDown.jsx +18 -1
- package/dist/Molecular/CustomIcons/components/ArrowLeft.jsx +23 -1
- package/dist/Molecular/CustomIcons/components/ArrowRight.jsx +23 -1
- package/dist/Molecular/CustomIcons/components/ArrowUp.jsx +18 -1
- package/dist/Molecular/CustomIcons/components/Bell.jsx +16 -1
- package/dist/Molecular/CustomIcons/components/Button.jsx +13 -1
- package/dist/Molecular/CustomIcons/components/Campaigns.jsx +17 -1
- package/dist/Molecular/CustomIcons/components/Check.jsx +15 -1
- package/dist/Molecular/CustomIcons/components/Check2.jsx +13 -1
- package/dist/Molecular/CustomIcons/components/ChevronDown.jsx +13 -1
- package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.jsx +12 -1
- package/dist/Molecular/CustomIcons/components/ChevronLeft.jsx +12 -1
- package/dist/Molecular/CustomIcons/components/ChevronRight.jsx +12 -1
- package/dist/Molecular/CustomIcons/components/ChevronUp.jsx +12 -1
- package/dist/Molecular/CustomIcons/components/ChevronUpDown.jsx +28 -1
- package/dist/Molecular/CustomIcons/components/Close.jsx +15 -1
- package/dist/Molecular/CustomIcons/components/ColumnsOrder.jsx +18 -1
- package/dist/Molecular/CustomIcons/components/Delete.jsx +17 -1
- package/dist/Molecular/CustomIcons/components/Edit.jsx +16 -1
- package/dist/Molecular/CustomIcons/components/Email.jsx +32 -1
- package/dist/Molecular/CustomIcons/components/FinturfLogo.jsx +19 -1
- package/dist/Molecular/CustomIcons/components/FinturfLogo2.jsx +36 -1
- package/dist/Molecular/CustomIcons/components/Flows.jsx +16 -1
- package/dist/Molecular/CustomIcons/components/Gift.jsx +26 -1
- package/dist/Molecular/CustomIcons/components/GoogleAuth.jsx +30 -1
- package/dist/Molecular/CustomIcons/components/GooglePlay.jsx +30 -1
- package/dist/Molecular/CustomIcons/components/HelpCircle.jsx +20 -1
- package/dist/Molecular/CustomIcons/components/HelpCircle2.jsx +21 -1
- package/dist/Molecular/CustomIcons/components/HelpCircleFilled.jsx +20 -1
- package/dist/Molecular/CustomIcons/components/Home.jsx +17 -1
- package/dist/Molecular/CustomIcons/components/Home2.jsx +23 -1
- package/dist/Molecular/CustomIcons/components/Key.jsx +24 -1
- package/dist/Molecular/CustomIcons/components/Landers.jsx +21 -1
- package/dist/Molecular/CustomIcons/components/Lock.jsx +16 -1
- package/dist/Molecular/CustomIcons/components/Mail.jsx +27 -1
- package/dist/Molecular/CustomIcons/components/Mastercard.jsx +74 -1
- package/dist/Molecular/CustomIcons/components/Minus.jsx +26 -1
- package/dist/Molecular/CustomIcons/components/Offers.jsx +17 -1
- package/dist/Molecular/CustomIcons/components/Pause.jsx +29 -1
- package/dist/Molecular/CustomIcons/components/PayPal.jsx +42 -1
- package/dist/Molecular/CustomIcons/components/PayPalLightLarge.jsx +29 -1
- package/dist/Molecular/CustomIcons/components/Phone.jsx +31 -1
- package/dist/Molecular/CustomIcons/components/Play.jsx +26 -1
- package/dist/Molecular/CustomIcons/components/Plus.jsx +26 -1
- package/dist/Molecular/CustomIcons/components/Profile.jsx +17 -1
- package/dist/Molecular/CustomIcons/components/QRCode.jsx +30 -1
- package/dist/Molecular/CustomIcons/components/Rectangle.jsx +13 -1
- package/dist/Molecular/CustomIcons/components/Revert.jsx +14 -1
- package/dist/Molecular/CustomIcons/components/Star.jsx +15 -1
- package/dist/Molecular/CustomIcons/components/Star2.jsx +17 -1
- package/dist/Molecular/CustomIcons/components/TrafficSources.jsx +15 -1
- package/dist/Molecular/CustomIcons/components/Trash.jsx +16 -1
- package/dist/Molecular/CustomIcons/components/TrashRed.jsx +16 -1
- package/dist/Molecular/CustomIcons/components/Triggers.jsx +16 -1
- package/dist/Molecular/CustomIcons/components/User.jsx +26 -1
- package/dist/Molecular/CustomIcons/components/Visa.jsx +32 -1
- package/dist/Molecular/CustomIcons/components/X.jsx +13 -1
- package/dist/Molecular/FormElement/FormElement.jsx +52 -1
- package/dist/Molecular/FormWithDependOn/FormWithDependOn.jsx +161 -1
- package/dist/Molecular/InputAddress/InputAddress.jsx +641 -1
- package/dist/Molecular/InputPassword/InputPassword.jsx +50 -1
- package/package.json +1 -1
|
@@ -1 +1,37 @@
|
|
|
1
|
-
import
|
|
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;
|
|
@@ -1 +1,48 @@
|
|
|
1
|
-
|
|
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;
|
|
@@ -1 +1,62 @@
|
|
|
1
|
-
import
|
|
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;
|
|
@@ -1 +1,175 @@
|
|
|
1
|
-
|
|
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;
|
|
@@ -1 +1,65 @@
|
|
|
1
|
-
import
|
|
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;
|
|
@@ -1 +1,118 @@
|
|
|
1
|
-
|
|
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;
|
|
@@ -1 +1,126 @@
|
|
|
1
|
-
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
|
|
3
|
+
import './Text.scss';
|
|
4
|
+
|
|
5
|
+
const RC = 'text';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param value
|
|
10
|
+
* @param className
|
|
11
|
+
* @param classesObj
|
|
12
|
+
* @param icon
|
|
13
|
+
* @param link
|
|
14
|
+
* @param align
|
|
15
|
+
* @param testId
|
|
16
|
+
* @return {JSX.Element|null}
|
|
17
|
+
* @constructor
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
// ? Прототип лежит на проекте кабинета src\JS\Components\Atomic\FormElements\Text\Text.js
|
|
21
|
+
// ? Что поменял?
|
|
22
|
+
// ? - в верстке убрал дополнительную вложенность
|
|
23
|
+
// ? (теперь только 1 внешний контейнер, доп. классы назначаются рядом с className)
|
|
24
|
+
// ? - убрал пропы as и isTitle, они были для работы с предзаданными классами связанными с токенизацией
|
|
25
|
+
// ? возможность прокинуть доп. классы объектом с условиями оставил через пропу classesObj
|
|
26
|
+
// ? - заменил пропу text на value
|
|
27
|
+
// ? - заменил пропу iconMain на icon
|
|
28
|
+
// ? - переработал пропу link, может быть строкой или объектом
|
|
29
|
+
// ? если это объект, то у него могут быть свойства
|
|
30
|
+
// ? - path - значение для href
|
|
31
|
+
|
|
32
|
+
// ? - target - значение для атрибута target, имеет смысл передавать, если не передаются onClick или redirect
|
|
33
|
+
|
|
34
|
+
// ? - onClick - альтернативный обработчик нажатия, если он есть то он будет ипользован в приоритете,
|
|
35
|
+
// ? ф-я будет вызвана с 1 аргументом - props, в объекте props будет свойство ev (event) и все содержание link,
|
|
36
|
+
// ? по умолчанию до использования onClick будут вызваны e.preventDefault() и e.stopPropagation
|
|
37
|
+
|
|
38
|
+
// ? - redirect - альтернативный исполнитель редиректа (например history.push),
|
|
39
|
+
// ? если есть и нет onClick - будет вызван с одним аргументом (link.path)
|
|
40
|
+
|
|
41
|
+
// ? - isNoPreventDefault - отключает вызов e.preventDefault перед вызовом onClick или redirect
|
|
42
|
+
|
|
43
|
+
// ? - isNoStopPropagation - отключает вызов e.preventDefault перед вызовом onClick или redirect
|
|
44
|
+
|
|
45
|
+
function Text({
|
|
46
|
+
value,
|
|
47
|
+
className,
|
|
48
|
+
classesObj,
|
|
49
|
+
icon,
|
|
50
|
+
link,
|
|
51
|
+
align = 'left',
|
|
52
|
+
testId = 'text-lib-component',
|
|
53
|
+
}) {
|
|
54
|
+
if (!value) return null;
|
|
55
|
+
const isLinkAsObj = link instanceof Object && !Array.isArray(link);
|
|
56
|
+
const isLinkAsString = typeof link === 'string';
|
|
57
|
+
const isLink = isLinkAsObj || isLinkAsString;
|
|
58
|
+
|
|
59
|
+
const linkObj = isLinkAsObj ? link : {};
|
|
60
|
+
const {
|
|
61
|
+
path = '',
|
|
62
|
+
target,
|
|
63
|
+
redirect,
|
|
64
|
+
onClick: onClickInner,
|
|
65
|
+
isNoPreventDefault,
|
|
66
|
+
isNoStopPropagation,
|
|
67
|
+
} = linkObj;
|
|
68
|
+
|
|
69
|
+
const preparedPath = (() => {
|
|
70
|
+
if (!isLink) return '';
|
|
71
|
+
return isLinkAsObj ? path : link;
|
|
72
|
+
})();
|
|
73
|
+
|
|
74
|
+
const atributes = {};
|
|
75
|
+
|
|
76
|
+
if (typeof onClickInner === 'function' || typeof redirect === 'function') {
|
|
77
|
+
atributes.onClick = function onClick(ev) {
|
|
78
|
+
if (!isNoPreventDefault) ev.preventDefault();
|
|
79
|
+
if (!isNoStopPropagation) ev.stopPropagation();
|
|
80
|
+
|
|
81
|
+
// ? если переданы и onClick, и redirect, то onClick считается приоритетнее redirect
|
|
82
|
+
if (onClickInner) {
|
|
83
|
+
onClickInner({ ev, ...link });
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
redirect(preparedPath);
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const mainInner = (
|
|
91
|
+
<>
|
|
92
|
+
{icon && <div className={`${RC}__icon-container`}>{icon}</div>}
|
|
93
|
+
{value}
|
|
94
|
+
</>
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<div
|
|
99
|
+
data-testid={testId}
|
|
100
|
+
className={cn(RC, className, {
|
|
101
|
+
[`${RC}-left`]: align === 'left',
|
|
102
|
+
[`${RC}-center`]: align === 'center',
|
|
103
|
+
[`${RC}-right`]: align === 'right',
|
|
104
|
+
[`${RC}-justify`]: align === 'justify',
|
|
105
|
+
...classesObj,
|
|
106
|
+
})}
|
|
107
|
+
>
|
|
108
|
+
{isLink
|
|
109
|
+
? (
|
|
110
|
+
<a
|
|
111
|
+
{...atributes}
|
|
112
|
+
href={preparedPath}
|
|
113
|
+
target={target ?? '_self'}
|
|
114
|
+
rel="noreferrer"
|
|
115
|
+
>
|
|
116
|
+
{mainInner}
|
|
117
|
+
</a>
|
|
118
|
+
)
|
|
119
|
+
: (
|
|
120
|
+
mainInner
|
|
121
|
+
)}
|
|
122
|
+
</div>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export default Text;
|