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,61 @@
|
|
|
1
|
-
import
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef } from 'react';
|
|
4
|
+
|
|
5
|
+
import { formatToOnlyASCIICodeText } from '../../../Functions/fieldValueFormatters';
|
|
6
|
+
|
|
7
|
+
import './Textarea.scss';
|
|
8
|
+
|
|
9
|
+
const RC = 'textarea';
|
|
10
|
+
|
|
11
|
+
function Textarea({ ref, id, value, onChange, onFocus, onBlur, placeholder, disabled, className, isNotValidateASCII = false, testId = RC, withAutoGrow, onKeyDown = () => {} }) {
|
|
12
|
+
const internalRef = useRef();
|
|
13
|
+
const textareaRef = ref || internalRef;
|
|
14
|
+
|
|
15
|
+
const handle = {
|
|
16
|
+
change: (val) => {
|
|
17
|
+
let inputValue = val;
|
|
18
|
+
if (!isNotValidateASCII)
|
|
19
|
+
inputValue = formatToOnlyASCIICodeText(inputValue);
|
|
20
|
+
|
|
21
|
+
onChange(inputValue);
|
|
22
|
+
},
|
|
23
|
+
focus: (e) => {
|
|
24
|
+
onFocus?.(e);
|
|
25
|
+
},
|
|
26
|
+
blur: (e) => {
|
|
27
|
+
onBlur?.(e);
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const autoGrow = (el) => {
|
|
32
|
+
el.style.height = '5px';
|
|
33
|
+
el.style.height = `${el.scrollHeight}px`;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (withAutoGrow) {
|
|
38
|
+
autoGrow(textareaRef?.current);
|
|
39
|
+
}
|
|
40
|
+
}, [value, withAutoGrow]);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div data-testid={testId} className={cn(`${RC}`, className)}>
|
|
44
|
+
<textarea
|
|
45
|
+
id={id ?? Math.random().toString(16).slice(2)}
|
|
46
|
+
data-testid={`${testId}-textarea`}
|
|
47
|
+
className={`${RC}__textarea`}
|
|
48
|
+
value={value}
|
|
49
|
+
onChange={e => handle.change(e.target.value)}
|
|
50
|
+
placeholder={placeholder}
|
|
51
|
+
disabled={disabled}
|
|
52
|
+
onKeyDown={onKeyDown}
|
|
53
|
+
ref={textareaRef}
|
|
54
|
+
onFocus={handle.focus}
|
|
55
|
+
onBlur={handle.blur}
|
|
56
|
+
/>
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export default Textarea;
|
|
@@ -1 +1,181 @@
|
|
|
1
|
-
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
|
|
5
|
+
import { compareAlphabetical } from '../../../Functions/utils';
|
|
6
|
+
import CheckboxInput from '../CheckboxInput/CheckboxInput';
|
|
7
|
+
|
|
8
|
+
import AccordionWithCheckbox from './partial/AccordionWithCheckbox';
|
|
9
|
+
|
|
10
|
+
import './TieredCheckboxes.scss';
|
|
11
|
+
|
|
12
|
+
const RC = 'tiered-checkboxes';
|
|
13
|
+
|
|
14
|
+
function TieredCheckboxes({
|
|
15
|
+
items = {},
|
|
16
|
+
className,
|
|
17
|
+
onChange,
|
|
18
|
+
isUseParentsClassesAsDataset,
|
|
19
|
+
isUseAccordionForGroup,
|
|
20
|
+
accordionIcons,
|
|
21
|
+
isOnlyOne = false,
|
|
22
|
+
sortGroups = false,
|
|
23
|
+
sortGroupItems = false,
|
|
24
|
+
}) {
|
|
25
|
+
const handle = {
|
|
26
|
+
changeParent: (value, key, prop) => {
|
|
27
|
+
const parent = items.find(item => item.key === key);
|
|
28
|
+
if (prop) parent[prop] = value;
|
|
29
|
+
else parent.value = value;
|
|
30
|
+
|
|
31
|
+
if (!prop) {
|
|
32
|
+
if (value) {
|
|
33
|
+
parent.children
|
|
34
|
+
.filter(({ disabled }) => !disabled)
|
|
35
|
+
.forEach(item => (item.value = true));
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
parent.children
|
|
39
|
+
.filter(({ disabled }) => !disabled)
|
|
40
|
+
.forEach(item => (item.value = false));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
onChange([...items]);
|
|
44
|
+
},
|
|
45
|
+
changeChild: (value, key, parentKey) => {
|
|
46
|
+
if (isOnlyOne) {
|
|
47
|
+
const parent = items.find(item => item.key === parentKey);
|
|
48
|
+
parent.children.find(item => item.key === key).value = value;
|
|
49
|
+
|
|
50
|
+
parent.children.map((item) => {
|
|
51
|
+
if (item.key !== key && value === true) {
|
|
52
|
+
item.disabled = true;
|
|
53
|
+
parent.disabled = true;
|
|
54
|
+
}
|
|
55
|
+
else if (item.key !== key && value === false) {
|
|
56
|
+
item.disabled = false;
|
|
57
|
+
parent.disabled = false;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
item.disabled = false;
|
|
61
|
+
}
|
|
62
|
+
return item;
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
parent.disabled = true;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
const parent = items.find(item => item.key === parentKey);
|
|
69
|
+
parent.children.find(item => item.key === key).value = value;
|
|
70
|
+
|
|
71
|
+
if (parent.children.every(item => item.value)) parent.value = true;
|
|
72
|
+
else parent.value = false;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
onChange([...items]);
|
|
76
|
+
},
|
|
77
|
+
isAllChecked: (item) => {
|
|
78
|
+
return (
|
|
79
|
+
item?.children.some(item => item.value)
|
|
80
|
+
&& !item?.children.every(item => item.value)
|
|
81
|
+
);
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const preparedItems = useMemo(() => {
|
|
86
|
+
let newItems = [...items];
|
|
87
|
+
|
|
88
|
+
if (sortGroups) {
|
|
89
|
+
newItems = newItems?.sort(compareAlphabetical);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (sortGroupItems) {
|
|
93
|
+
newItems = newItems?.map((parent) => {
|
|
94
|
+
if (parent?.children) {
|
|
95
|
+
parent.children = parent?.children?.sort(compareAlphabetical);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return parent;
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return newItems;
|
|
103
|
+
}, [items]);
|
|
104
|
+
|
|
105
|
+
const renderInner = (parent) => {
|
|
106
|
+
return (
|
|
107
|
+
parent.children
|
|
108
|
+
&& parent.children.map(child => (
|
|
109
|
+
<div key={child.key} className={`${RC}__children`}>
|
|
110
|
+
<CheckboxInput
|
|
111
|
+
testId={child.key}
|
|
112
|
+
label={child.label}
|
|
113
|
+
value={child.value}
|
|
114
|
+
disabled={child?.disabled}
|
|
115
|
+
onChange={value =>
|
|
116
|
+
handle.changeChild(value, child.key, parent.key)}
|
|
117
|
+
/>
|
|
118
|
+
</div>
|
|
119
|
+
))
|
|
120
|
+
);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
return (
|
|
124
|
+
<div className={cn(RC, className)}>
|
|
125
|
+
{preparedItems.map((parent) => {
|
|
126
|
+
const datasetProp
|
|
127
|
+
= isUseParentsClassesAsDataset && parent?.className
|
|
128
|
+
? { 'data-key': parent?.className }
|
|
129
|
+
: {};
|
|
130
|
+
if (isUseAccordionForGroup) {
|
|
131
|
+
return (
|
|
132
|
+
<AccordionWithCheckbox
|
|
133
|
+
key={parent.key}
|
|
134
|
+
RC={RC}
|
|
135
|
+
parent={parent}
|
|
136
|
+
datasetProp={datasetProp}
|
|
137
|
+
isUseParentsClassesAsDataset={isUseParentsClassesAsDataset}
|
|
138
|
+
className={`${RC}__mono-accordion`}
|
|
139
|
+
setIsOpen={() =>
|
|
140
|
+
handle.changeParent(!parent.isOpen, parent.key, 'isOpen')}
|
|
141
|
+
onChange={value => handle.changeParent(value, parent.key)}
|
|
142
|
+
icon={
|
|
143
|
+
!parent.isOpen
|
|
144
|
+
? accordionIcons?.[0] || null
|
|
145
|
+
: accordionIcons?.[1] || null
|
|
146
|
+
}
|
|
147
|
+
// disabled={parent.children?.every?.((child) => child.disabled)}
|
|
148
|
+
>
|
|
149
|
+
{renderInner(parent)}
|
|
150
|
+
</AccordionWithCheckbox>
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
return (
|
|
154
|
+
<div
|
|
155
|
+
{...datasetProp}
|
|
156
|
+
key={parent.key}
|
|
157
|
+
className={cn(`${RC}__parents`, {
|
|
158
|
+
[`${parent.className}`]: !isUseParentsClassesAsDataset,
|
|
159
|
+
})}
|
|
160
|
+
>
|
|
161
|
+
<CheckboxInput
|
|
162
|
+
isStark={handle.isAllChecked(parent)}
|
|
163
|
+
label={parent.label}
|
|
164
|
+
value={parent.value}
|
|
165
|
+
onChange={value => handle.changeParent(value, parent.key)}
|
|
166
|
+
disabled={
|
|
167
|
+
parent.children.every(({ disabled }) => disabled === true)
|
|
168
|
+
|| parent.disabled
|
|
169
|
+
}
|
|
170
|
+
/>
|
|
171
|
+
<div className={cn(`${RC}__parent__children`)}>
|
|
172
|
+
{renderInner(parent)}
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
);
|
|
176
|
+
})}
|
|
177
|
+
</div>
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export default TieredCheckboxes;
|
|
@@ -1 +1,60 @@
|
|
|
1
|
-
import
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
|
|
3
|
+
import MonoAccordion from '../../../UI/MonoAccordion/MonoAccordion';
|
|
4
|
+
import CheckboxInput from '../../CheckboxInput/CheckboxInput';
|
|
5
|
+
|
|
6
|
+
import '../TieredCheckboxes.scss';
|
|
7
|
+
|
|
8
|
+
function AccordionWithCheckbox({
|
|
9
|
+
children,
|
|
10
|
+
parent,
|
|
11
|
+
onChange,
|
|
12
|
+
className,
|
|
13
|
+
RC,
|
|
14
|
+
setIsOpen,
|
|
15
|
+
icon,
|
|
16
|
+
disabled,
|
|
17
|
+
datasetProp,
|
|
18
|
+
isUseParentsClassesAsDataset,
|
|
19
|
+
}) {
|
|
20
|
+
return (
|
|
21
|
+
<MonoAccordion
|
|
22
|
+
datasetProp={datasetProp}
|
|
23
|
+
className={cn(className, {
|
|
24
|
+
[`${parent.className}`]: !isUseParentsClassesAsDataset,
|
|
25
|
+
})}
|
|
26
|
+
isOpen={parent.isOpen}
|
|
27
|
+
onClick={setIsOpen}
|
|
28
|
+
icon={icon}
|
|
29
|
+
disabled={disabled}
|
|
30
|
+
// disabled={parent.children?.every?.((child) => child.disabled)}
|
|
31
|
+
titleJSX={(
|
|
32
|
+
<>
|
|
33
|
+
<CheckboxInput
|
|
34
|
+
className={`${RC}__checkbox-input`}
|
|
35
|
+
isStark={
|
|
36
|
+
parent?.children?.some?.(item => item.value)
|
|
37
|
+
&& !parent?.children?.every?.(item => item.value)
|
|
38
|
+
}
|
|
39
|
+
label={parent.label}
|
|
40
|
+
value={parent.value}
|
|
41
|
+
onChange={onChange}
|
|
42
|
+
disabled={
|
|
43
|
+
parent.children.every(({ disabled }) => disabled === true)
|
|
44
|
+
|| parent.disabled
|
|
45
|
+
}
|
|
46
|
+
/>
|
|
47
|
+
<span className={`${RC}__description-checked`}>
|
|
48
|
+
{parent?.children?.length
|
|
49
|
+
? `Selected ${parent.children.filter(child => child.value).length} from ${parent.children?.length}`
|
|
50
|
+
: null}
|
|
51
|
+
</span>
|
|
52
|
+
</>
|
|
53
|
+
)}
|
|
54
|
+
>
|
|
55
|
+
{children}
|
|
56
|
+
</MonoAccordion>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export default AccordionWithCheckbox;
|
|
@@ -1 +1,83 @@
|
|
|
1
|
-
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
|
|
5
|
+
import { compare } from '../../../Functions/utils';
|
|
6
|
+
|
|
7
|
+
import VariantsListRadioItem from './partials/VariantsListRadioItem';
|
|
8
|
+
|
|
9
|
+
import './VariantsListRadio.scss';
|
|
10
|
+
|
|
11
|
+
const RC = 'variants-list-radio';
|
|
12
|
+
|
|
13
|
+
function VariantsListRadio({
|
|
14
|
+
items: outerItems,
|
|
15
|
+
value: outerValue,
|
|
16
|
+
onChange = () => {},
|
|
17
|
+
|
|
18
|
+
isWithBorders,
|
|
19
|
+
itemsContentRenderMode,
|
|
20
|
+
isRadioPositionReverse,
|
|
21
|
+
isUseAsOptionsList,
|
|
22
|
+
disabled,
|
|
23
|
+
isDisabled,
|
|
24
|
+
|
|
25
|
+
id,
|
|
26
|
+
className,
|
|
27
|
+
testId = 'variants-list-radio',
|
|
28
|
+
|
|
29
|
+
attributesOfNativeInput,
|
|
30
|
+
isMixWithPersonalAttributes,
|
|
31
|
+
}) {
|
|
32
|
+
const [items, setItems] = useState(outerItems);
|
|
33
|
+
const [value, setValue] = useState(outerValue);
|
|
34
|
+
|
|
35
|
+
const componentnId = id || 'variantsListRadio';
|
|
36
|
+
const mode = itemsContentRenderMode === 'col' ? 'col' : 'row';
|
|
37
|
+
const isElementDisabled = disabled || isDisabled;
|
|
38
|
+
|
|
39
|
+
const handleChange = (newValue) => {
|
|
40
|
+
setValue(newValue);
|
|
41
|
+
onChange(newValue);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (!compare(outerItems, items)) setItems(outerItems);
|
|
46
|
+
}, [outerItems]);
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (value !== outerValue) setValue(outerValue);
|
|
50
|
+
}, [outerValue]);
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<div
|
|
54
|
+
id={componentnId}
|
|
55
|
+
data-testid={testId}
|
|
56
|
+
className={cn(RC, `${RC}_items-content-${mode}`, className, {
|
|
57
|
+
[`${RC}_with-borders`]: isWithBorders && !isUseAsOptionsList,
|
|
58
|
+
[`${RC}_radio-position-reverse`]: isRadioPositionReverse,
|
|
59
|
+
})}
|
|
60
|
+
>
|
|
61
|
+
{items.map(item => (
|
|
62
|
+
<VariantsListRadioItem
|
|
63
|
+
key={`variants-list-radio-id-${componentnId}-item-id-${item.value}`}
|
|
64
|
+
RC={RC}
|
|
65
|
+
parentId={componentnId}
|
|
66
|
+
item={{
|
|
67
|
+
...item,
|
|
68
|
+
isDisabled:
|
|
69
|
+
item.disabled || item.isDisabled || isElementDisabled || false,
|
|
70
|
+
}}
|
|
71
|
+
value={value}
|
|
72
|
+
onChange={handleChange}
|
|
73
|
+
attributesOfNativeInput={attributesOfNativeInput}
|
|
74
|
+
isMixWithPersonalAttributes={isMixWithPersonalAttributes}
|
|
75
|
+
parentDisabled={disabled}
|
|
76
|
+
isUseAsOptionsList={isUseAsOptionsList}
|
|
77
|
+
/>
|
|
78
|
+
))}
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export default VariantsListRadio;
|
|
@@ -1 +1,80 @@
|
|
|
1
|
-
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
|
|
3
|
+
import { getIsOnlyAnObject } from '../../../../Functions/utils';
|
|
4
|
+
|
|
5
|
+
function VariantsListRadioItem({
|
|
6
|
+
RC,
|
|
7
|
+
parentId,
|
|
8
|
+
item,
|
|
9
|
+
value: actualValue,
|
|
10
|
+
onChange = () => {},
|
|
11
|
+
|
|
12
|
+
attributesOfNativeInput = {},
|
|
13
|
+
isMixWithPersonalAttributes,
|
|
14
|
+
|
|
15
|
+
isUseAsOptionsList,
|
|
16
|
+
testId = 'variants-list-radio-item',
|
|
17
|
+
}) {
|
|
18
|
+
// ? Для корректной работы нужны parentId и item(объект)
|
|
19
|
+
if (!parentId || !getIsOnlyAnObject(item)) return null;
|
|
20
|
+
|
|
21
|
+
const {
|
|
22
|
+
value,
|
|
23
|
+
label,
|
|
24
|
+
description,
|
|
25
|
+
isDisabled,
|
|
26
|
+
attributesOfNativeInput: personalAttributesOfNativeInput,
|
|
27
|
+
} = item;
|
|
28
|
+
const id = `${parentId.toString()}--item-${value}`;
|
|
29
|
+
const name = parentId.toString();
|
|
30
|
+
const isActive = actualValue === value;
|
|
31
|
+
const addAtributesObj = isMixWithPersonalAttributes
|
|
32
|
+
? { ...attributesOfNativeInput, ...personalAttributesOfNativeInput }
|
|
33
|
+
: personalAttributesOfNativeInput || attributesOfNativeInput || {};
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<label
|
|
37
|
+
data-testid={testId}
|
|
38
|
+
className={cn(`${RC}__item`, {
|
|
39
|
+
[`${RC}__item_disabled`]: isDisabled,
|
|
40
|
+
[`${RC}__item_active`]: isActive,
|
|
41
|
+
[`${RC}__item_as-option`]: isUseAsOptionsList,
|
|
42
|
+
})}
|
|
43
|
+
htmlFor={id}
|
|
44
|
+
>
|
|
45
|
+
<div className={cn(`${RC}__item-radio-container`)}>
|
|
46
|
+
<div className={cn(`${RC}__item-radio`)}>
|
|
47
|
+
<input
|
|
48
|
+
id={id}
|
|
49
|
+
data-testid={`${testId}-input`}
|
|
50
|
+
type="radio"
|
|
51
|
+
checked={isActive}
|
|
52
|
+
className={`${RC}__item-radio-input`}
|
|
53
|
+
onChange={() => onChange(value)}
|
|
54
|
+
name={name}
|
|
55
|
+
disabled={isDisabled}
|
|
56
|
+
{...addAtributesObj}
|
|
57
|
+
/>
|
|
58
|
+
<div className={`${RC}__item-radio-mark`}></div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<div className={cn(`${RC}__item-content`)}>
|
|
63
|
+
{label && (
|
|
64
|
+
<div className={cn(`${RC}__item-content-wrapper`)}>
|
|
65
|
+
<div className={cn(`${RC}__item-content-label`)}>{label}</div>
|
|
66
|
+
</div>
|
|
67
|
+
)}
|
|
68
|
+
{description && !isUseAsOptionsList && (
|
|
69
|
+
<div className={cn(`${RC}__item-content-wrapper`)}>
|
|
70
|
+
<div className={cn(`${RC}__item-content-description`)}>
|
|
71
|
+
{description}
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
)}
|
|
75
|
+
</div>
|
|
76
|
+
</label>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export default VariantsListRadioItem;
|
|
@@ -1 +1,103 @@
|
|
|
1
|
-
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
|
|
3
|
+
import './WidgetPseudoTable.scss';
|
|
4
|
+
|
|
5
|
+
const RC = 'widget-pseudo-table';
|
|
6
|
+
|
|
7
|
+
function WidgetPseudoTable(props) {
|
|
8
|
+
const {
|
|
9
|
+
className,
|
|
10
|
+
title,
|
|
11
|
+
rightHeaderContent,
|
|
12
|
+
nullContentData,
|
|
13
|
+
isNotRenderThead = false,
|
|
14
|
+
isNoHeader = false,
|
|
15
|
+
columns = [],
|
|
16
|
+
rows,
|
|
17
|
+
CellComponent,
|
|
18
|
+
CellComponentProps,
|
|
19
|
+
onChange,
|
|
20
|
+
} = props || {};
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div className={cn(RC, className)}>
|
|
24
|
+
{!isNoHeader && (
|
|
25
|
+
<div className={cn(`${RC}__header`)}>
|
|
26
|
+
<div className={cn(`${RC}__title-block`)}>{title}</div>
|
|
27
|
+
<div className={cn(`${RC}__right-header-content-block`)}>
|
|
28
|
+
{rightHeaderContent}
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
)}
|
|
32
|
+
<div
|
|
33
|
+
className={cn(`${RC}__body`, {
|
|
34
|
+
[`${RC}__body_no-content`]: !rows?.length,
|
|
35
|
+
})}
|
|
36
|
+
>
|
|
37
|
+
{Boolean(rows?.length) && !isNotRenderThead && (
|
|
38
|
+
<div className={cn(`${RC}__thead`)}>
|
|
39
|
+
{columns.map(field => (
|
|
40
|
+
<div
|
|
41
|
+
key={`thead-${field.key}`}
|
|
42
|
+
className={cn(
|
|
43
|
+
`${RC}__thead-cell`,
|
|
44
|
+
field.theadCellClassName,
|
|
45
|
+
field.columnClassName,
|
|
46
|
+
{
|
|
47
|
+
[`${RC}__thead-cell_reqiured`]: field.isRequired,
|
|
48
|
+
},
|
|
49
|
+
)}
|
|
50
|
+
data-key={field.key}
|
|
51
|
+
>
|
|
52
|
+
{field.label}
|
|
53
|
+
</div>
|
|
54
|
+
))}
|
|
55
|
+
</div>
|
|
56
|
+
)}
|
|
57
|
+
|
|
58
|
+
<div className={cn(`${RC}__table`)}>
|
|
59
|
+
{rows?.length
|
|
60
|
+
? (
|
|
61
|
+
rows.map(row => (
|
|
62
|
+
<div
|
|
63
|
+
key={`row-${row.id}`}
|
|
64
|
+
className={cn(`${RC}__row`)}
|
|
65
|
+
data-id={row.id}
|
|
66
|
+
>
|
|
67
|
+
{columns.map(cell => (
|
|
68
|
+
<div
|
|
69
|
+
key={`row-${row.id}-cell-${cell.key}`}
|
|
70
|
+
className={cn(
|
|
71
|
+
`${RC}__cell`,
|
|
72
|
+
cell.cellClassName,
|
|
73
|
+
cell.columnClassName,
|
|
74
|
+
)}
|
|
75
|
+
>
|
|
76
|
+
<CellComponent
|
|
77
|
+
{...CellComponentProps}
|
|
78
|
+
field={{
|
|
79
|
+
...cell,
|
|
80
|
+
value: row[cell.key],
|
|
81
|
+
rowData: row,
|
|
82
|
+
}}
|
|
83
|
+
onChange={(key, val) => onChange(val, cell.key, row.id)}
|
|
84
|
+
/>
|
|
85
|
+
</div>
|
|
86
|
+
))}
|
|
87
|
+
</div>
|
|
88
|
+
))
|
|
89
|
+
)
|
|
90
|
+
: (
|
|
91
|
+
<div className={cn(`${RC}__row`)} data-id="empty-row">
|
|
92
|
+
<span className={cn(`${RC}__no-data-content`)}>
|
|
93
|
+
{nullContentData ?? 'No data'}
|
|
94
|
+
</span>
|
|
95
|
+
</div>
|
|
96
|
+
)}
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export default WidgetPseudoTable;
|