intelicoreact 1.8.6 → 1.8.8
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 +1 -18
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN_old.jsx +1 -121
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.jsx +1 -507
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.jsx +1 -46
- package/dist/Atomic/FormElements/NumericInput/NumericInput.jsx +1 -337
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.jsx +1 -66
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.jsx +1 -78
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.jsx +1 -54
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.jsx +1 -183
- package/dist/Atomic/FormElements/RangeList/RangeList.jsx +1 -181
- package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.jsx +1 -41
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.jsx +1 -449
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.jsx +1 -865
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.jsx +1 -37
- package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.jsx +1 -48
- package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.jsx +1 -62
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.jsx +1 -175
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.jsx +1 -65
- package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.jsx +1 -118
- package/dist/Atomic/FormElements/Text/Text.jsx +1 -126
- package/dist/Atomic/FormElements/Textarea/Textarea.jsx +1 -61
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.jsx +1 -181
- package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.jsx +1 -60
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.jsx +1 -83
- package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.jsx +1 -80
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.jsx +1 -103
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.jsx +1 -115
- package/dist/Atomic/Layout/Header/Header.jsx +1 -86
- package/dist/Atomic/Layout/MainMenu/MainMenu.jsx +1 -164
- package/dist/Atomic/UI/AccordionTable/AccordionTable.jsx +1 -250
- package/dist/Atomic/UI/AccordionText/AccordionText.jsx +1 -68
- package/dist/Atomic/UI/Arrow/Arrow.jsx +1 -134
- package/dist/Atomic/UI/Box/Box.jsx +1 -53
- package/dist/Atomic/UI/Chart/Chart.jsx +1 -178
- package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.jsx +1 -78
- package/dist/Atomic/UI/Chart/partial/optionsConstructor.jsx +1 -334
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.jsx +1 -111
- package/dist/Atomic/UI/DateTime/DateTime.jsx +1 -57
- package/dist/Atomic/UI/DebugContainer/DebugContainer.jsx +1 -44
- package/dist/Atomic/UI/DebugContainer/useDebugContainer.jsx +1 -15
- package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.jsx +1 -223
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion._test.jsx +1 -75
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.jsx +1 -86
- package/dist/Atomic/UI/PieChart/PieChart.jsx +1 -41
- package/dist/Atomic/UI/Table/Partials/TdCell.jsx +1 -87
- package/dist/Atomic/UI/Table/Partials/TdHeader.jsx +1 -36
- package/dist/Atomic/UI/Table/Partials/TdRow.jsx +1 -103
- package/dist/Atomic/UI/Table/Partials/TdTitle.jsx +1 -55
- package/dist/Atomic/UI/Table/Table.jsx +1 -63
- package/dist/Atomic/UI/Table/TdTypes/TdActions.jsx +1 -80
- package/dist/Atomic/UI/Table/TdTypes/TdPriority.jsx +1 -26
- package/dist/Atomic/UI/Table/TdTypes/TdRange.jsx +1 -13
- package/dist/Atomic/UI/Table/TdTypes/TdWeight.jsx +1 -56
- package/dist/Atomic/UI/TagList/TagList.jsx +1 -256
- package/dist/Atomic/UI/WizardStepper/constructor.jsx +1 -86
- package/dist/Classes/RESTAPI/partials/CredentialsProcessing.jsx +1 -254
- package/dist/Functions/customEventListener.jsx +1 -96
- package/dist/Functions/operations.jsx +1 -138
- package/dist/Functions/useFormTools/functions/RenderFields.jsx +1 -108
- package/dist/Functions/useFormTools/index.jsx +1 -777
- package/dist/Functions/usePasswordChecker.jsx +1 -128
- package/dist/Functions/utils.jsx +1 -492
- package/dist/Molecular/CustomIcons/components/AffiliateNetworks.jsx +1 -22
- package/dist/Molecular/CustomIcons/components/AlertCircle.jsx +1 -24
- package/dist/Molecular/CustomIcons/components/AppStore.jsx +1 -30
- package/dist/Molecular/CustomIcons/components/Arrow.jsx +1 -33
- package/dist/Molecular/CustomIcons/components/ArrowDown.jsx +1 -18
- package/dist/Molecular/CustomIcons/components/ArrowLeft.jsx +1 -23
- package/dist/Molecular/CustomIcons/components/ArrowRight.jsx +1 -23
- package/dist/Molecular/CustomIcons/components/ArrowUp.jsx +1 -18
- package/dist/Molecular/CustomIcons/components/Bell.jsx +1 -16
- package/dist/Molecular/CustomIcons/components/Button.jsx +1 -13
- package/dist/Molecular/CustomIcons/components/Campaigns.jsx +1 -17
- package/dist/Molecular/CustomIcons/components/Check.jsx +1 -15
- package/dist/Molecular/CustomIcons/components/Check2.jsx +1 -13
- package/dist/Molecular/CustomIcons/components/ChevronDown.jsx +1 -13
- package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.jsx +1 -12
- package/dist/Molecular/CustomIcons/components/ChevronLeft.jsx +1 -12
- package/dist/Molecular/CustomIcons/components/ChevronRight.jsx +1 -12
- package/dist/Molecular/CustomIcons/components/ChevronUp.jsx +1 -12
- package/dist/Molecular/CustomIcons/components/ChevronUpDown.jsx +1 -28
- package/dist/Molecular/CustomIcons/components/Close.jsx +1 -15
- package/dist/Molecular/CustomIcons/components/ColumnsOrder.jsx +1 -18
- package/dist/Molecular/CustomIcons/components/Delete.jsx +1 -17
- package/dist/Molecular/CustomIcons/components/Edit.jsx +1 -16
- package/dist/Molecular/CustomIcons/components/Email.jsx +1 -32
- package/dist/Molecular/CustomIcons/components/FinturfLogo.jsx +1 -19
- package/dist/Molecular/CustomIcons/components/FinturfLogo2.jsx +1 -36
- package/dist/Molecular/CustomIcons/components/Flows.jsx +1 -16
- package/dist/Molecular/CustomIcons/components/Gift.jsx +1 -26
- package/dist/Molecular/CustomIcons/components/GoogleAuth.jsx +1 -30
- package/dist/Molecular/CustomIcons/components/GooglePlay.jsx +1 -30
- package/dist/Molecular/CustomIcons/components/HelpCircle.jsx +1 -20
- package/dist/Molecular/CustomIcons/components/HelpCircle2.jsx +1 -21
- package/dist/Molecular/CustomIcons/components/HelpCircleFilled.jsx +1 -20
- package/dist/Molecular/CustomIcons/components/Home.jsx +1 -17
- package/dist/Molecular/CustomIcons/components/Home2.jsx +1 -23
- package/dist/Molecular/CustomIcons/components/Key.jsx +1 -24
- package/dist/Molecular/CustomIcons/components/Landers.jsx +1 -21
- package/dist/Molecular/CustomIcons/components/Lock.jsx +1 -16
- package/dist/Molecular/CustomIcons/components/Mail.jsx +1 -27
- package/dist/Molecular/CustomIcons/components/Mastercard.jsx +1 -74
- package/dist/Molecular/CustomIcons/components/Minus.jsx +1 -26
- package/dist/Molecular/CustomIcons/components/Offers.jsx +1 -17
- package/dist/Molecular/CustomIcons/components/Pause.jsx +1 -29
- package/dist/Molecular/CustomIcons/components/PayPal.jsx +1 -42
- package/dist/Molecular/CustomIcons/components/PayPalLightLarge.jsx +1 -29
- package/dist/Molecular/CustomIcons/components/Phone.jsx +1 -31
- package/dist/Molecular/CustomIcons/components/Play.jsx +1 -26
- package/dist/Molecular/CustomIcons/components/Plus.jsx +1 -26
- package/dist/Molecular/CustomIcons/components/Profile.jsx +1 -17
- package/dist/Molecular/CustomIcons/components/QRCode.jsx +1 -30
- package/dist/Molecular/CustomIcons/components/Rectangle.jsx +1 -13
- package/dist/Molecular/CustomIcons/components/Revert.jsx +1 -14
- package/dist/Molecular/CustomIcons/components/Star.jsx +1 -15
- package/dist/Molecular/CustomIcons/components/Star2.jsx +1 -17
- package/dist/Molecular/CustomIcons/components/TrafficSources.jsx +1 -15
- package/dist/Molecular/CustomIcons/components/Trash.jsx +1 -16
- package/dist/Molecular/CustomIcons/components/TrashRed.jsx +1 -16
- package/dist/Molecular/CustomIcons/components/Triggers.jsx +1 -16
- package/dist/Molecular/CustomIcons/components/User.jsx +1 -26
- package/dist/Molecular/CustomIcons/components/Visa.jsx +1 -32
- package/dist/Molecular/CustomIcons/components/X.jsx +1 -13
- package/dist/Molecular/FormElement/FormElement.jsx +1 -52
- package/dist/Molecular/FormWithDependOn/FormWithDependOn.jsx +1 -161
- package/dist/Molecular/InputAddress/InputAddress.jsx +1 -641
- package/dist/Molecular/InputPassword/InputPassword.jsx +1 -50
- package/package.json +1 -1
- package/dist/Atomic/FormElements/RangeInputs/RangeInputs.d.ts +0 -5
- package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js.map +0 -1
|
@@ -1,37 +1 @@
|
|
|
1
|
-
import
|
|
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
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import s from"classnames";import i from"../Switcher/Switcher";import"./SwitchableRow.scss";var a="switchable-row";export default function(c){var r=c||{},l=r.RC,o=void 0===l?a:l,d=r.className,m=r.children,n=r.isActive,h=r.setIsActive,v=r.switcherLabel,w=r.isSwitcherLabelBold,b=r.testId,f=void 0===b?a:b;return t("div",{className:s(o,d),"data-testid":f,children:[e("div",{className:s("".concat(o,"__cell")),children:e(i,{isActive:n,onChange:h,isLabelBold:w,label:v,"data-testid":"".concat(f,"-switcher")})}),m]})}
|
|
@@ -1,48 +1 @@
|
|
|
1
|
-
import
|
|
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
|
+
function e(e,i,n){return i in e?Object.defineProperty(e,i,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[i]=n,e}import{jsx as i,jsxs as n}from"react/jsx-runtime";import t from"classnames";import o from"../CheckboxesLine/CheckboxesLine";import r from"../Switcher/Switcher";import"./SwitcherCheckbox.scss";var a="switcher-hide";export default function(c){var s,l=c.label,d=c.hint,h=c.items,m=void 0===h?[]:h,u=c.value,b=void 0===u?[]:u,f=c.className,v=c.isLabelBold,C=c.isActive,p=c.hintSide,w=c.disabled,x=c.hideChildren,S=c.onSwitcherChange,g=void 0===S?function(){}:S,j=c.onChange,L=void 0===j?function(){}:j,_=function(){return i(o,{items:m,value:b,onChange:L})};return n("div",{className:t(a,f,(e(s={},"".concat(a,"_closed"),!C),e(s,"".concat(a,"_disabled"),w),s)),children:[i(r,{className:"".concat(a,"__switcher"),hintSide:p,label:l,isActive:C,onChange:function(e){return g(e)},isLabelBold:v,hint:d}),C?_():void 0===x||x?"":_()]})}
|
|
@@ -1,62 +1 @@
|
|
|
1
|
-
import
|
|
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
|
+
import{jsx as e}from"react/jsx-runtime";import i from"classnames";import a from"../RangeList/RangeList";import t from"../SwitcherHide/SwitcherHide";import"./SwitcherRangeList.scss";var r="switcher-range-list";export default function(s){var l=s.className,n=s.label,o=s.isLabelBold,c=s.hint,d=s.hintSide,m=s.disabled,u=s.isActive,h=s.value,v=s.validateErrors,f=s.isFloatValues,g=s.decimalPlaces,w=s.error,x=s.defaultErrorText,b=s.nullValueText,p=s.isOnlyOneRow,L=s.setIsActive,R=s.onChange,S=s.testId;return e(t,{isActive:u,onChange:void 0===L?function(){}:L,label:n,isLabelBold:o,hint:c,hintSide:d,className:i(r,l),disabled:m,children:e("div",{className:"switcher-range-list__row",children:e(a,{testId:S,className:"".concat(r,"__range-list"),value:h,isOnlyOneRow:p,onChange:void 0===R?function(){}:R,validateErrors:v,isFloatValues:f,decimalPlaces:g,error:w,defaultErrorText:x,nullValueText:b})})})}
|
|
@@ -1,175 +1 @@
|
|
|
1
|
-
import
|
|
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
|
+
function t(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=Array(n);e<n;e++)r[e]=t[e];return r}function n(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){var e,r,o=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(t);!(a=(e=o.next()).done)&&(i.push(e.value),!n||i.length!==n);a=!0);}catch(t){l=!0,r=t}finally{try{a||null==o.return||o.return()}finally{if(l)throw r}}return i}}(t,n)||r(t,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 e(n){return function(n){if(Array.isArray(n))return t(n)}(n)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||r(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 r(n,e){if(n){if("string"==typeof n)return t(n,e);var r=Object.prototype.toString.call(n).slice(8,-1);if("Object"===r&&n.constructor&&(r=n.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return t(n,e)}}import{jsx as o,jsxs as i}from"react/jsx-runtime";import a from"classnames";import{useEffect as l,useMemo as c,useState as u}from"react";import s from"../../UI/Button/Button";import d from"../SwitcherHide/SwitcherHide";import f from"../TagsDropdown/TagsDropdown";import m from"../Textarea/Textarea";import v from"../TextSwitcher/TextSwitcher";import"./SwitcherTagsDropdown.scss";var p="switcher-tags-dropdown";export default function(t){var r,b,h,y=t.className,g=t.label,w=t.isLabelBold,_=t.isValuesInTags,C=t.isActive,S=t.isIncluded,A=t.isAdvancedLabelSearch,T=t.disabled,x=t.options,I=void 0===x?[]:x,L=t.chosenOptions,N=void 0===L?[]:L,j=t.setIsActive,O=t.setIsIncluded,k=t.onChange,B=void 0===k?function(){}:k,D=n(u(!1),2),E=D[0],H=D[1],P=n(u(),2),U=P[0],V=P[1],K=c(function(){return I.reduce(function(t,n){return e(t).concat(e(n.groupName?n.list:[n]))},[])},[I]),M=function(){var t,n=null==U||null==(t=U.split)?void 0:t.call(U,",").map(function(t){return t.toString().trim()}).filter(function(t){return!!t});B(I.filter(function(t){return n.find(function(n){var e=null==t?void 0:t.value.toString().toLowerCase(),r=(t.title||t.label||t.name||t.value).toString().toLowerCase(),o=n.toString().toLowerCase(),i=r.includes(o)&&!N.includes(t.value);return _?(o===e||o===r)&&!t.disabled:A?(o===r||o===e||i)&&!t.disabled:(o===r||o===e)&&!t.disabled})}).map(function(t){return t.value}),"chosenOptions"),H(!1)},$=function(t,n){if(13===t.keyCode){var r=null==I?void 0:I.find(function(t){var e;return(null==t||null==(e=t.title)?void 0:e.toLowerCase())===(null==n?void 0:n.toLowerCase())&&!t.disabled}),o=null==N?void 0:N.some(function(t){var n,e;return(null==t||null==(n=t.title)?void 0:n.toLowerCase())===(null==r||null==(e=r.title)?void 0:e.toLowerCase())});r&&!o&&B(e(N).concat([r]),"chosenOptions")}};return l(function(){V((null==N?void 0:N.map(function(t){var n;return _?t:(n=K.find(function(n){return n.value===t})).title||n.label||n.name||n.value})).join(", "))},[N,E]),i(d,{isActive:C,onChange:void 0===j?function(){}:j,label:g,className:a(p,y),isLabelBold:w,disabled:T,children:[i("div",{className:"".concat(p,"__wrap switcher-hide__content"),children:[o(v,{activeText:"is",inactiveText:"is not",isActive:null==S||S,onChange:void 0===O?function(){}:O,className:"".concat(p,"__text-switcher")}),i("div",{className:"filter-select__wrap--buttons",children:[o("button",{onClick:function(){return H(!E)},className:"".concat(p,"__btn"),children:E?"Close":"List view"}),E&&o(s,{label:"Apply",className:"".concat(p,"__apply"),onClick:function(){return M()}}),o("button",{onClick:function(){return B([],"chosenOptions")},className:"".concat(p,"__btn"),children:"Clear"})]})]}),E?o(m,{value:U,onChange:function(t){return V(t)}}):o(f,{options:I,chosenOptions:N,onChange:B,className:"".concat(p,"__tags-dropdown"),onKeyPress:function(t,n){return $(t,n)},tagClassname:a("".concat(p,"__tag"),(r={},b="".concat(p,"__tag_inactive"),h=!S,b in r?Object.defineProperty(r,b,{value:h,enumerable:!0,configurable:!0,writable:!0}):r[b]=h,r)),isValuesInTags:_})]})}
|
|
@@ -1,65 +1 @@
|
|
|
1
|
-
import
|
|
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
|
+
import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import a from"classnames";import c from"../SwitcherHide/SwitcherHide";import n from"../Textarea/Textarea";import s from"../TextSwitcher/TextSwitcher";import"./SwitcherTextarea.scss";var r="switcher-textarea";export default function(o){var d=o.label,l=o.isLabelBold,h=o.hint,m=o.className,v=o.isActive,u=o.setIsActive,x=o.isIncluded,f=void 0===x||x,p=o.setIsIncluded,T=void 0===p?function(){}:p,_=o.text,w=o.setText,b=void 0===w?function(){}:w,I=o.activeText,N=o.inactiveText,C=o.placeholder,S=o.disabled,g=o.testId;return e(c,{testId:g,isActive:void 0===v||v,onChange:void 0===u?function(){}:u,label:d,isLabelBold:l,className:a(r,m),hint:h,disabled:S,children:t(i,{children:[t("div",{className:"".concat(r,"__wrap switcher-hide__content"),children:[e(s,{testId:g,activeText:void 0===I?"is":I,inactiveText:void 0===N?"is not":N,isActive:null==f||f,onChange:function(e){return T(e)},className:"".concat(r,"__text-switcher")}),e("button",{onClick:function(){return b("")},className:"".concat(r,"__btn"),children:"Clear"})]}),e(n,{testId:g,value:void 0===_?"":_,placeholder:C,onChange:function(e){return b(e)},className:"".concat(r,"__textarea")})]})})}
|
|
@@ -1,118 +1 @@
|
|
|
1
|
-
|
|
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
|
+
function t(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=Array(n);e<n;e++)r[e]=t[e];return r}function n(t){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{},r=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.forEach(function(n){var r;r=e[n],n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r})}return t}function e(t,n){return n=null!=n?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e.push.apply(e,r)}return e})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t}function r(n,e){return function(t){if(Array.isArray(t))return t}(n)||function(t,n){var e,r,o=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=o){var i=[],u=!0,c=!1;try{for(o=o.call(t);!(u=(e=o.next()).done)&&(i.push(e.value),!n||i.length!==n);u=!0);}catch(t){c=!0,r=t}finally{try{u||null==o.return||o.return()}finally{if(c)throw r}}return i}}(n,e)||function(n,e){if(n){if("string"==typeof n)return t(n,e);var r=Object.prototype.toString.call(n).slice(8,-1);if("Object"===r&&n.constructor&&(r=n.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return t(n,e)}}(n,e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}import{jsx as o}from"react/jsx-runtime";import{useEffect as i,useRef as u,useState as c}from"react";import l from"../../UI/TagList/TagList";import a from"../TagsDropdown/TagsDropdown";export default function(t){var s=t.options,f=t.tagsFullList,p=t.value,y=void 0===p?[]:p,d=t.dropdownProps,m=void 0===d?{}:d,b=t.listProps,O=void 0===b?{}:b,g=t.onChange,v=t.useDropdownCompactMode,h=y.map(function(t){return t.value}),w=r(c(!1),2),j=w[0],C=w[1],P=r(c(!1),2),S=P[0],A=P[1],D=r(c(h),2),T=D[0],I=D[1],L=r(c(!1),2),E=L[0],k=L[1],x=r(c(!1),2),R=x[0],U=x[1],F=u(null),M=function(){if(E){var t;U(!0),k(!1),t=new Promise(function(t){var n,e=g(s.filter(function(t){var n=t.value;return T.includes(n)}));(null!=(n=Promise)&&"undefined"!=typeof Symbol&&n[Symbol.hasInstance]?!!n[Symbol.hasInstance](e):e instanceof n)?e.then(function(n){return t(n)}):t()}),t.finally(function(){C(!1),U(!1)})}else C(!1)};i(function(){I(h)},[j]);var $=function(t){return o(a,e(n(e(n({},m),{disabled:R,options:s,tagsFullList:f,chosenOptions:T,renderOptionsAsTags:!0,withCreateLogic:!0,isUseLocalOptionsStore:!1,onOptionEdit:null==m?void 0:m.onOptionEdit,onOptionDelete:null==m?void 0:m.onOptionDelete,onOptionCreate:null==m?void 0:m.onOptionCreate,onActionConfirmClick:M,onActionCancelClick:function(){return C(function(t){return!t})},onChange:function(t){I(t),k(!0)}}),t),{isDefaultOpened:j}))},q=function(t){return o(l,n(e(n({disabled:R,refProp:F},O),{items:y,onEditClick:function(){return C(function(t){return!t})}}),t))};return v?$({withActions:!1,withSearchInputInList:!0,customTriggerRef:F,recalculateListContainerStylesTrigger:S,onDropdownListClose:M,renderCustomTrigger:function(t){t.isOpen;var n=t.setIsOpen;return t.inputRef,q({onToggleRenderAll:function(t){return setTimeout(function(){return A(t)},1)},onEditClick:function(){n(!j),j?M():C(!0)}})}}):j?$({withActions:!0}):q()}
|
|
@@ -1,126 +1 @@
|
|
|
1
|
-
import
|
|
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;
|
|
1
|
+
function e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function t(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(r){e(t,r,n[r])})}return t}import{jsx as r,jsxs as n,Fragment as o}from"react/jsx-runtime";import c from"classnames";import"./Text.scss";var i="text";export default function(a){var s,l,f,u,p=a.value,y=a.className,b=a.classesObj,O=a.icon,j=a.link,m=a.align,d=void 0===m?"left":m,g=a.testId;if(!p)return null;var v=(null!=(s=Object)&&"undefined"!=typeof Symbol&&s[Symbol.hasInstance]?!!s[Symbol.hasInstance](j):j instanceof s)&&!Array.isArray(j),h="string"==typeof j,P=v||h,w=v?j:{},S=w.path,x=w.target,D=w.redirect,k=w.onClick,N=w.isNoPreventDefault,I=w.isNoStopPropagation,_=P?v?void 0===S?"":S:j:"",A={};("function"==typeof k||"function"==typeof D)&&(A.onClick=function(e){if(N||e.preventDefault(),I||e.stopPropagation(),k)return void k(t({ev:e},j));D(_)});var C=n(o,{children:[O&&r("div",{className:"".concat(i,"__icon-container"),children:O}),p]});return r("div",{"data-testid":void 0===g?"text-lib-component":g,className:c(i,y,t((e(u={},"".concat(i,"-left"),"left"===d),e(u,"".concat(i,"-center"),"center"===d),e(u,"".concat(i,"-right"),"right"===d),e(u,"".concat(i,"-justify"),"justify"===d),u),b)),children:P?r("a",(l=t({},A),f=f={href:_,target:null!=x?x:"_self",rel:"noreferrer",children:C},Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(f)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(f)).forEach(function(e){Object.defineProperty(l,e,Object.getOwnPropertyDescriptor(f,e))}),l)):C})}
|