@itcase/ui 1.8.123 → 1.8.124
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/Avatar_cjs_mojzcWRL.js +161 -0
- package/dist/Avatar_es_BFom0nAS.js +157 -0
- package/dist/{Button_cjs_Ce97psFT.js → Button_cjs_CZz8OjWi.js} +39 -27
- package/dist/{Button_es_CZss7cXh.js → Button_es_Cn3wtv3M.js} +39 -27
- package/dist/ChipsGroup_cjs_Dgskkc1e.js +344 -0
- package/dist/{ChipsGroup_es_ayPPUwQ7.js → ChipsGroup_es_BVQ7_n0k.js} +48 -35
- package/dist/DatePicker_cjs_Lzrr9Amf.js +182 -0
- package/dist/DatePicker_es_D1LvY5RT.js +178 -0
- package/dist/Divider_cjs_DrmV2ezS.js +105 -0
- package/dist/Divider_es_BiYozVBS.js +101 -0
- package/dist/DropdownItem_cjs_rKLdFxSj.js +211 -0
- package/dist/DropdownItem_es_B-1qtEa7.js +206 -0
- package/dist/Group_cjs_DmfeUcFI.js +59 -0
- package/dist/Group_es_BU5k8f5S.js +55 -0
- package/dist/{Icon_cjs_Cz6IyOkb.js → Icon_cjs_DpFxIFv5.js} +170 -121
- package/dist/{Icon_es_BrwLifge.js → Icon_es_D5eiycFI.js} +170 -121
- package/dist/Image_cjs_CBDMUzv_.js +29 -0
- package/dist/Image_es_BHec4iVN.js +27 -0
- package/dist/{Input_cjs_DRPK_RHK.js → Input_cjs_DDi5JVAV.js} +27 -19
- package/dist/{Input_es_Cv5nEb_n.js → Input_es_BnCXATnh.js} +27 -19
- package/dist/{Label_cjs_DMoaOoHi.js → Label_cjs_C-x9blCL.js} +45 -33
- package/dist/{Label_es_SULlg9bL.js → Label_es_DCqpSw_F.js} +45 -33
- package/dist/{Link_cjs_C5UsZUiF.js → Link_cjs_qKXVfU8e.js} +43 -30
- package/dist/{Link_es_XiqbdwLp.js → Link_es_P2b6ya7P.js} +43 -30
- package/dist/Loader_cjs_DIDsIq3J.js +143 -0
- package/dist/Loader_es_CmSggwbR.js +139 -0
- package/dist/Overlay_cjs_tGA2fU43.js +42 -0
- package/dist/Overlay_es_BS7OTFoy.js +38 -0
- package/dist/{Scrollbar_cjs_DcKOfcNp.js → Scrollbar_cjs_Cp-7v2Mt.js} +1 -1
- package/dist/{Scrollbar_es_CThJeCLF.js → Scrollbar_es_CcMgNvGi.js} +1 -1
- package/dist/Text_cjs_BDTjOTVB.js +69 -0
- package/dist/Text_es_CnymlElo.js +65 -0
- package/dist/cjs/components/Accordion.js +37 -34
- package/dist/cjs/components/Avatar.js +5 -6
- package/dist/cjs/components/AvatarStack/stories/__mock__.js +1 -1
- package/dist/cjs/components/AvatarStack.js +17 -16
- package/dist/cjs/components/Badge.js +3 -4
- package/dist/cjs/components/Breadcrumbs/stories/__mock__.js +1 -1
- package/dist/cjs/components/Breadcrumbs.js +27 -23
- package/dist/cjs/components/Button.js +5 -6
- package/dist/cjs/components/Cell/stories/__mock__.js +1 -1
- package/dist/cjs/components/Cell.js +28 -25
- package/dist/cjs/components/Checkbox.js +33 -26
- package/dist/cjs/components/Checkmark.js +28 -23
- package/dist/cjs/components/Chips/stories/__mock__.js +1 -1
- package/dist/cjs/components/Chips.js +4 -5
- package/dist/cjs/components/Choice/stories/__mock__.js +2 -2
- package/dist/cjs/components/Choice.js +46 -40
- package/dist/cjs/components/Code.js +34 -26
- package/dist/cjs/components/CookiesWarning.js +23 -23
- package/dist/cjs/components/Dadata.js +14 -9
- package/dist/cjs/components/DatePeriod.js +32 -30
- package/dist/cjs/components/DatePicker.js +8 -9
- package/dist/cjs/components/Divider.js +1 -2
- package/dist/cjs/components/Dot.js +5 -6
- package/dist/cjs/components/Drawer.js +23 -21
- package/dist/cjs/components/Dropdown/stories/__mock__.js +6 -6
- package/dist/cjs/components/Dropdown.js +5 -6
- package/dist/cjs/components/Flex.js +11 -12
- package/dist/cjs/components/Grid.js +15 -16
- package/dist/cjs/components/Group.js +1 -2
- package/dist/cjs/components/HTMLContent.js +5 -6
- package/dist/cjs/components/HeroTitle.js +17 -16
- package/dist/cjs/components/Icon.js +3 -4
- package/dist/cjs/components/Image.js +1 -2
- package/dist/cjs/components/Input.js +1 -2
- package/dist/cjs/components/InputPassword.js +34 -26
- package/dist/cjs/components/Label.js +4 -5
- package/dist/cjs/components/Link.js +1 -2
- package/dist/cjs/components/List.js +39 -28
- package/dist/cjs/components/Loader.js +2 -3
- package/dist/cjs/components/Logo.js +10 -11
- package/dist/cjs/components/MenuItem.js +36 -33
- package/dist/cjs/components/Modal.js +40 -38
- package/dist/cjs/components/ModalSheetBottom.js +17 -18
- package/dist/cjs/components/Notification/stories/__mock__.js +1 -1
- package/dist/cjs/components/Notification.js +31 -24
- package/dist/cjs/components/Overlay.js +1 -2
- package/dist/cjs/components/Pagination.js +43 -41
- package/dist/cjs/components/Radio.js +34 -26
- package/dist/cjs/components/RangeSlider.js +8 -9
- package/dist/cjs/components/Response/img.js +1 -1
- package/dist/cjs/components/Response.js +45 -34
- package/dist/cjs/components/SVGContent.js +6 -7
- package/dist/cjs/components/ScrollOnDrag/stories/__mock__.js +2 -2
- package/dist/cjs/components/ScrollOnDrag.js +7 -8
- package/dist/cjs/components/ScrollToView.js +8 -9
- package/dist/cjs/components/Scrollbar/stories/__mock__.js +1 -1
- package/dist/cjs/components/Scrollbar.js +1 -1
- package/dist/cjs/components/Search.js +39 -31
- package/dist/cjs/components/Segmented/stories/__mock__.js +23 -10
- package/dist/cjs/components/Segmented.js +46 -41
- package/dist/cjs/components/Select.js +118 -113
- package/dist/cjs/components/Swiper/stories/__mock__.js +3 -3
- package/dist/cjs/components/Swiper.js +27 -29
- package/dist/cjs/components/Switch.js +33 -26
- package/dist/cjs/components/Tab/stories/__mock__.js +1 -1
- package/dist/cjs/components/Tab.js +33 -27
- package/dist/cjs/components/Text.js +1 -2
- package/dist/cjs/components/Textarea.js +26 -18
- package/dist/cjs/components/Tile.js +21 -17
- package/dist/cjs/components/Title.js +3 -4
- package/dist/cjs/components/Tooltip.js +3 -4
- package/dist/cjs/components/Video/stories/__mocks__.js +1 -1
- package/dist/cjs/components/Video.js +3 -4
- package/dist/cjs/components/Warning.js +26 -20
- package/dist/cjs/context/Notifications.js +38 -42
- package/dist/cjs/context/UIContext.js +19 -17
- package/dist/cjs/context/UrlAssetPrefix.js +3 -3
- package/dist/cjs/hoc/urlWithAssetPrefix.js +13 -16
- package/dist/cjs/hooks/useActiveClasses/useActiveClasses.helpers.js +13 -40
- package/dist/cjs/hooks/useActiveClasses/useActiveClasses.interface.js +1 -1
- package/dist/cjs/hooks/useActiveClasses/useActiveClasses.js +25 -29
- package/dist/cjs/hooks/useAppearanceConfig/useAppearanceConfig.js +13 -15
- package/dist/cjs/hooks/useAppearanceConfig.js +0 -1
- package/dist/cjs/hooks/useDevicePropsGenerator/useDevicePropsGenerator.js +21 -28
- package/dist/cjs/hooks/useDevicePropsGenerator.js +0 -1
- package/dist/cjs/hooks/useDeviceTargetClass.js +0 -1
- package/dist/cjs/hooks/useStyles/styleAttributes.js +1 -1
- package/dist/cjs/hooks/useStyles/useStyles.js +0 -1
- package/dist/cjs/hooks/useStyles.js +0 -1
- package/dist/cjs/hooks/useViewportFix.js +5 -5
- package/dist/cjs/hooks.js +1 -1
- package/dist/cjs/utils/setViewportProperty.js +3 -3
- package/dist/components/Accordion.js +37 -34
- package/dist/components/Avatar.js +5 -6
- package/dist/components/AvatarStack/stories/__mock__.js +1 -1
- package/dist/components/AvatarStack.js +17 -16
- package/dist/components/Badge.js +3 -4
- package/dist/components/Breadcrumbs/stories/__mock__.js +1 -1
- package/dist/components/Breadcrumbs.js +27 -23
- package/dist/components/Button.js +5 -6
- package/dist/components/Cell/stories/__mock__.js +1 -1
- package/dist/components/Cell.js +28 -25
- package/dist/components/Checkbox.js +33 -26
- package/dist/components/Checkmark.js +28 -23
- package/dist/components/Chips/stories/__mock__.js +1 -1
- package/dist/components/Chips.js +4 -5
- package/dist/components/Choice/stories/__mock__.js +2 -2
- package/dist/components/Choice.js +46 -40
- package/dist/components/Code.js +34 -26
- package/dist/components/CookiesWarning.js +23 -23
- package/dist/components/Dadata.js +14 -9
- package/dist/components/DatePeriod.js +32 -30
- package/dist/components/DatePicker.js +8 -9
- package/dist/components/Divider.js +1 -2
- package/dist/components/Dot.js +5 -6
- package/dist/components/Drawer.js +23 -21
- package/dist/components/Dropdown/stories/__mock__.js +6 -6
- package/dist/components/Dropdown.js +5 -6
- package/dist/components/Flex.js +11 -12
- package/dist/components/Grid.js +15 -16
- package/dist/components/Group.js +1 -2
- package/dist/components/HTMLContent.js +5 -6
- package/dist/components/HeroTitle.js +17 -16
- package/dist/components/Icon.js +3 -4
- package/dist/components/Image.js +1 -2
- package/dist/components/Input.js +1 -2
- package/dist/components/InputPassword.js +34 -26
- package/dist/components/Label.js +4 -5
- package/dist/components/Link.js +1 -2
- package/dist/components/List.js +39 -28
- package/dist/components/Loader.js +2 -3
- package/dist/components/Logo.js +10 -11
- package/dist/components/MenuItem.js +36 -33
- package/dist/components/Modal.js +40 -38
- package/dist/components/ModalSheetBottom.js +17 -18
- package/dist/components/Notification/stories/__mock__.js +1 -1
- package/dist/components/Notification.js +31 -24
- package/dist/components/Overlay.js +1 -2
- package/dist/components/Pagination.js +43 -41
- package/dist/components/Radio.js +34 -26
- package/dist/components/RangeSlider.js +8 -9
- package/dist/components/Response/img.js +1 -1
- package/dist/components/Response.js +45 -34
- package/dist/components/SVGContent.js +6 -7
- package/dist/components/ScrollOnDrag/stories/__mock__.js +2 -2
- package/dist/components/ScrollOnDrag.js +7 -8
- package/dist/components/ScrollToView.js +8 -9
- package/dist/components/Scrollbar/stories/__mock__.js +1 -1
- package/dist/components/Scrollbar.js +1 -1
- package/dist/components/Search.js +39 -31
- package/dist/components/Segmented/stories/__mock__.js +23 -10
- package/dist/components/Segmented.js +46 -41
- package/dist/components/Select.js +118 -113
- package/dist/components/Swiper/stories/__mock__.js +3 -3
- package/dist/components/Swiper.js +27 -29
- package/dist/components/Switch.js +33 -26
- package/dist/components/Tab/stories/__mock__.js +1 -1
- package/dist/components/Tab.js +33 -27
- package/dist/components/Text.js +1 -2
- package/dist/components/Textarea.js +26 -18
- package/dist/components/Tile.js +21 -17
- package/dist/components/Title.js +3 -4
- package/dist/components/Tooltip.js +3 -4
- package/dist/components/Video/stories/__mocks__.js +1 -1
- package/dist/components/Video.js +3 -4
- package/dist/components/Warning.js +26 -20
- package/dist/context/Notifications.js +38 -42
- package/dist/context/UIContext.js +19 -17
- package/dist/context/UrlAssetPrefix.js +3 -3
- package/dist/css/components/Tile/Tile.css +3 -3
- package/dist/hoc/urlWithAssetPrefix.js +13 -16
- package/dist/hooks/useActiveClasses/useActiveClasses.helpers.js +13 -40
- package/dist/hooks/useActiveClasses/useActiveClasses.interface.js +1 -1
- package/dist/hooks/useActiveClasses/useActiveClasses.js +25 -29
- package/dist/hooks/useAppearanceConfig/useAppearanceConfig.js +13 -15
- package/dist/hooks/useAppearanceConfig.js +0 -1
- package/dist/hooks/useDevicePropsGenerator/useDevicePropsGenerator.js +21 -28
- package/dist/hooks/useDevicePropsGenerator.js +0 -1
- package/dist/hooks/useDeviceTargetClass.js +0 -1
- package/dist/hooks/useStyles/styleAttributes.js +1 -1
- package/dist/hooks/useStyles/useStyles.js +0 -1
- package/dist/hooks/useStyles.js +0 -1
- package/dist/hooks/useViewportFix.js +5 -5
- package/dist/hooks.js +1 -1
- package/dist/types/components/Select/SelectContainer.d.ts +1 -1
- package/dist/utils/setViewportProperty.js +3 -3
- package/package.json +3 -3
- package/dist/Avatar_cjs_CLJnKU39.js +0 -157
- package/dist/Avatar_es_BgN-fbOj.js +0 -153
- package/dist/ChipsGroup_cjs_C8L3ZeD_.js +0 -331
- package/dist/DatePicker_cjs_BzEtDAb8.js +0 -183
- package/dist/DatePicker_es_DRyCMO0I.js +0 -179
- package/dist/Divider_cjs_DUYtmwn2.js +0 -97
- package/dist/Divider_es_CCLBFIx6.js +0 -93
- package/dist/DropdownItem_cjs_Bhss6lyM.js +0 -207
- package/dist/DropdownItem_es_BXl6lPJx.js +0 -202
- package/dist/Group_cjs_CsJ6ICKK.js +0 -59
- package/dist/Group_es_DRqIIM9m.js +0 -55
- package/dist/Image_cjs_DRhhc66R.js +0 -29
- package/dist/Image_es_BpMidmve.js +0 -27
- package/dist/Loader_cjs_D3lnxPlI.js +0 -132
- package/dist/Loader_es_BUSqFrCd.js +0 -128
- package/dist/Overlay_cjs_CcfJYN5o.js +0 -41
- package/dist/Overlay_es_DF3DAdxS.js +0 -37
- package/dist/Text_cjs_0EINiUq4.js +0 -68
- package/dist/Text_es_CwV9rjFD.js +0 -64
- package/dist/tslib.es6_cjs_CCZ3TN_7.js +0 -59
- package/dist/tslib.es6_es_Bwu1Cn-t.js +0 -56
|
@@ -4,10 +4,9 @@ import clsx from 'clsx';
|
|
|
4
4
|
import { useAppearanceConfig } from '../hooks/useAppearanceConfig/useAppearanceConfig.js';
|
|
5
5
|
import { useDevicePropsGenerator } from '../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js';
|
|
6
6
|
import { useStyles } from '../hooks/useStyles/useStyles.js';
|
|
7
|
-
import { I as Icon } from '../
|
|
8
|
-
import { L as Loader } from '../
|
|
9
|
-
import { T as Text } from '../
|
|
10
|
-
import { _ as __assign } from '../tslib.es6_es_Bwu1Cn-t.js';
|
|
7
|
+
import { I as Icon } from '../Icon_es_D5eiycFI.js';
|
|
8
|
+
import { L as Loader } from '../Loader_es_CmSggwbR.js';
|
|
9
|
+
import { T as Text } from '../Text_es_CnymlElo.js';
|
|
11
10
|
import 'lodash/camelCase';
|
|
12
11
|
import 'lodash/castArray';
|
|
13
12
|
import 'lodash/upperFirst';
|
|
@@ -24,9 +23,9 @@ import 'lodash/maxBy';
|
|
|
24
23
|
import 'react-inlinesvg';
|
|
25
24
|
import '../hoc/urlWithAssetPrefix.js';
|
|
26
25
|
import '../context/UrlAssetPrefix.js';
|
|
27
|
-
import '../
|
|
26
|
+
import '../Link_es_P2b6ya7P.js';
|
|
28
27
|
|
|
29
|
-
|
|
28
|
+
const choiceAppearanceDefault = {
|
|
30
29
|
defaultPrimary: {
|
|
31
30
|
fill: 'surfaceSecondary',
|
|
32
31
|
fillItem: 'surfaceSecondary',
|
|
@@ -45,7 +44,7 @@ var choiceAppearanceDefault = {
|
|
|
45
44
|
},
|
|
46
45
|
};
|
|
47
46
|
|
|
48
|
-
|
|
47
|
+
const choiceAppearanceDisabled = {
|
|
49
48
|
disabledPrimary: {
|
|
50
49
|
fill: 'surfaceDisabled',
|
|
51
50
|
fillItem: 'surfaceDisabled',
|
|
@@ -64,7 +63,7 @@ var choiceAppearanceDisabled = {
|
|
|
64
63
|
},
|
|
65
64
|
};
|
|
66
65
|
|
|
67
|
-
|
|
66
|
+
const choiceAppearanceError = {
|
|
68
67
|
errorPrimary: {
|
|
69
68
|
fill: 'errorTertiary',
|
|
70
69
|
fillItem: 'errorItemTertiary',
|
|
@@ -82,7 +81,7 @@ var choiceAppearanceError = {
|
|
|
82
81
|
},
|
|
83
82
|
};
|
|
84
83
|
|
|
85
|
-
|
|
84
|
+
const choiceAppearanceRequire = {
|
|
86
85
|
requirePrimary: {
|
|
87
86
|
fill: 'warningTertiary',
|
|
88
87
|
fillItem: 'warningTertiary',
|
|
@@ -100,7 +99,7 @@ var choiceAppearanceRequire = {
|
|
|
100
99
|
},
|
|
101
100
|
};
|
|
102
101
|
|
|
103
|
-
|
|
102
|
+
const choiceAppearanceShape = {
|
|
104
103
|
circular: {
|
|
105
104
|
shape: 'circular',
|
|
106
105
|
},
|
|
@@ -125,7 +124,7 @@ var choiceAppearanceShape = {
|
|
|
125
124
|
},
|
|
126
125
|
};
|
|
127
126
|
|
|
128
|
-
|
|
127
|
+
const choiceAppearanceSize = {
|
|
129
128
|
sizeL: {
|
|
130
129
|
size: 'l',
|
|
131
130
|
labelTextSize: 'm',
|
|
@@ -143,7 +142,7 @@ var choiceAppearanceSize = {
|
|
|
143
142
|
},
|
|
144
143
|
};
|
|
145
144
|
|
|
146
|
-
|
|
145
|
+
const choiceAppearanceStyle = {
|
|
147
146
|
solid: {
|
|
148
147
|
borderColor: 'none',
|
|
149
148
|
},
|
|
@@ -161,7 +160,7 @@ var choiceAppearanceStyle = {
|
|
|
161
160
|
},
|
|
162
161
|
};
|
|
163
162
|
|
|
164
|
-
|
|
163
|
+
const choiceAppearanceSuccess = {
|
|
165
164
|
successPrimary: {
|
|
166
165
|
fill: 'successTertiary',
|
|
167
166
|
fillItem: 'successTertiary',
|
|
@@ -179,54 +178,61 @@ var choiceAppearanceSuccess = {
|
|
|
179
178
|
},
|
|
180
179
|
};
|
|
181
180
|
|
|
182
|
-
|
|
181
|
+
const choiceAppearance = {
|
|
182
|
+
...choiceAppearanceError,
|
|
183
|
+
...choiceAppearanceDisabled,
|
|
184
|
+
...choiceAppearanceDefault,
|
|
185
|
+
...choiceAppearanceSuccess,
|
|
186
|
+
...choiceAppearanceRequire,
|
|
187
|
+
...choiceAppearanceStyle,
|
|
188
|
+
...choiceAppearanceShape,
|
|
189
|
+
...choiceAppearanceSize,
|
|
190
|
+
};
|
|
183
191
|
|
|
184
|
-
|
|
192
|
+
const choiceConfig = {
|
|
185
193
|
appearance: choiceAppearance,
|
|
186
|
-
setAppearance:
|
|
194
|
+
setAppearance: (appearanceConfig) => {
|
|
187
195
|
choiceConfig.appearance = appearanceConfig;
|
|
188
196
|
},
|
|
189
197
|
};
|
|
190
198
|
function Choice(props) {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
var onChange = useCallback(function (event, item) {
|
|
197
|
-
var isChecked = isCheckbox ? event.target.checked : true;
|
|
199
|
+
const { id, dataTestId, dataTour, className, name, appearance, isDisabled = false, active = { value: undefined }, itemAfter, itemBefore, options = [], setActiveSegment, before, after, isCheckbox = false, isLoading = false, isSkeleton, } = props;
|
|
200
|
+
const controlRef = useRef(null);
|
|
201
|
+
const optionsRefs = useMemo(() => new Map(options.map((item) => [item.value, createRef()])), [options]);
|
|
202
|
+
const onChange = useCallback((event, item) => {
|
|
203
|
+
const isChecked = isCheckbox ? event.target.checked : true;
|
|
198
204
|
setActiveSegment && setActiveSegment(item, isChecked);
|
|
199
205
|
}, [isCheckbox, setActiveSegment]);
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
return (jsxs("div", { id: id, className: clsx(className, 'choice', size &&
|
|
205
|
-
|
|
206
|
+
const appearanceConfig = useAppearanceConfig(appearance, choiceConfig, isDisabled);
|
|
207
|
+
const propsGenerator = useDevicePropsGenerator(props, appearanceConfig);
|
|
208
|
+
const { size, fillClass, fillItemActiveClass, fillItemActiveDisabledClass, fillItemActiveHoverClass, fillItemClass, fillItemDisabledClass, fillItemHoverClass, labelTextActiveColor, labelTextColor, labelTextSize, labelTextWeight, labelTextWrap, iconAfterFillDisabled, iconBeforeFillDisabled, iconFillDisabled, borderColorClass, borderTypeClass, borderWidthClass, iconAfterFill, iconAfterFillActive, iconAfterSize, iconBeforeFill, iconBeforeFillActive, iconBeforeSize, iconFill, iconFillActive, iconSize, shapeClass, shapeStrengthClass, wrapClass, } = propsGenerator;
|
|
209
|
+
const { styles } = useStyles(props);
|
|
210
|
+
return (jsxs("div", { id: id, className: clsx(className, 'choice', size && `choice_size_${size}`, fillClass && `fill_${fillClass}`, wrapClass && `choice_wrap_${wrapClass}`, shapeClass && `shape_${shapeClass}`, shapeStrengthClass && `shape-strength_${shapeStrengthClass}`, isSkeleton && `choice_skeleton`), ref: controlRef, "data-test-id": dataTestId && `${dataTestId}Choice`, "data-tour": dataTour, style: styles, children: [before && jsx("div", { className: "choice__before", children: before }), isLoading ? (jsx(Loader, { width: "fill", height: "fill", fill: "surfacePrimary", itemFill: "surfaceItemAccent" })) : (jsx(React.Fragment, { children: options.map((item) => {
|
|
211
|
+
const isActive = typeof active === 'object'
|
|
206
212
|
? String(item.value) === String(active.value)
|
|
207
213
|
: String(item.value) === String(active);
|
|
208
|
-
return (jsxs("div", { className: clsx('choice__item', size &&
|
|
209
|
-
? fillItemClass &&
|
|
214
|
+
return (jsxs("div", { className: clsx('choice__item', size && `choice__item_size_${size}`, (item.icon || item.iconActive) && 'choice__item_icon', shapeClass && `shape_${shapeClass}`, shapeStrengthClass && `shape-strength_${shapeStrengthClass}`, borderColorClass && `border-color_${borderColorClass}`, borderWidthClass && `border-width_${borderWidthClass}`, borderTypeClass && `border_type_${borderTypeClass}`, !isActive && !isDisabled
|
|
215
|
+
? fillItemClass && `fill_${fillItemClass}`
|
|
210
216
|
: fillItemDisabledClass &&
|
|
211
|
-
|
|
212
|
-
? fillItemHoverClass &&
|
|
217
|
+
`fill_disabled_${fillItemDisabledClass}`, !isActive && !isDisabled
|
|
218
|
+
? fillItemHoverClass && `fill_hover_${fillItemHoverClass}`
|
|
213
219
|
: fillItemActiveHoverClass &&
|
|
214
|
-
|
|
220
|
+
`fill_active_hover_${fillItemActiveHoverClass}`, isActive
|
|
215
221
|
? !isDisabled
|
|
216
222
|
? fillItemActiveClass &&
|
|
217
|
-
|
|
223
|
+
`fill_active_${fillItemActiveClass}`
|
|
218
224
|
: fillItemActiveDisabledClass &&
|
|
219
|
-
|
|
225
|
+
`fill_active_disabled_${fillItemActiveDisabledClass}`
|
|
220
226
|
: !isDisabled
|
|
221
|
-
? fillItemClass &&
|
|
227
|
+
? fillItemClass && `fill_${fillItemClass}`
|
|
222
228
|
: fillItemDisabledClass &&
|
|
223
|
-
|
|
229
|
+
`fill_disabled_${fillItemDisabledClass}`, !isActive && isDisabled && 'choice__item_state_disabled', isActive &&
|
|
224
230
|
isDisabled &&
|
|
225
|
-
'choice__item_active_state_disabled', isActive && 'choice__item_active'), ref: optionsRefs.get(item.value), children: [jsx("input", { id:
|
|
231
|
+
'choice__item_active_state_disabled', isActive && 'choice__item_active'), ref: optionsRefs.get(item.value), children: [jsx("input", { id: `${name}-${item.value}`, className: "choice__item-radio", type: isCheckbox ? 'checkbox' : 'radio', name: name, disabled: isDisabled, checked: isActive, value: item.value, onChange: (event) => onChange(event, item) }), jsxs("label", { className: clsx('choice__item-label', isDisabled && 'choice__item-label_state_disabled'), htmlFor: `${name}-${item.value}`, children: [itemBefore, (item.iconBefore || item.iconBeforeActive) && (jsx(Icon, { className: "choice__item-icon", iconFillDisabled: iconBeforeFillDisabled, isDisabled: isDisabled, iconFill: iconBeforeFill, iconFillActive: iconBeforeFillActive, iconSize: iconBeforeSize, SvgImage: isActive
|
|
226
232
|
? item.iconBeforeActive || item.iconBefore
|
|
227
233
|
: item.iconBefore, isActive: isActive })), item.label && (jsx(Text, { size: labelTextSize, textColor: labelTextColor, textColorActive: labelTextActiveColor, textWeight: labelTextWeight, textWrap: labelTextWrap, isActive: isActive, children: item.label })), (item.icon || item.iconActive) && (jsx(Icon, { className: "choice__item-icon", iconFillDisabled: iconFillDisabled, iconFill: iconFill, iconFillActive: iconFillActive, iconSize: iconSize, SvgImage: isActive ? item.iconActive || item.icon : item.icon, isActive: isActive })), (item.iconAfter || item.iconAfterActive) && (jsx(Icon, { className: "choice__item-icon", iconFillDisabled: iconAfterFillDisabled, iconFill: iconAfterFill, iconFillActive: iconAfterFillActive, iconSize: iconAfterSize, SvgImage: isActive
|
|
228
234
|
? item.iconAfterActive || item.iconAfter
|
|
229
|
-
: item.iconAfter, isActive: isActive })), itemAfter] })] },
|
|
235
|
+
: item.iconAfter, isActive: isActive })), itemAfter] })] }, `${name}-${item.value}`));
|
|
230
236
|
}) })), after && jsx("div", { className: "choice__after", children: after })] }));
|
|
231
237
|
}
|
|
232
238
|
|
package/dist/components/Code.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { _ as __assign } from '../tslib.es6_es_Bwu1Cn-t.js';
|
|
2
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
2
|
import { useState, useEffect } from 'react';
|
|
4
3
|
import clsx from 'clsx';
|
|
@@ -18,7 +17,7 @@ import '../utils/setViewportProperty.js';
|
|
|
18
17
|
import '../hooks.js';
|
|
19
18
|
import '../hooks/useStyles/styleAttributes.js';
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
const codeAppearanceDefault = {
|
|
22
21
|
defaultPrimary: {
|
|
23
22
|
inputBorderColor: 'surfaceBorderTertiary',
|
|
24
23
|
inputCaretColor: 'surfaceItemPrimary',
|
|
@@ -29,7 +28,7 @@ var codeAppearanceDefault = {
|
|
|
29
28
|
},
|
|
30
29
|
};
|
|
31
30
|
|
|
32
|
-
|
|
31
|
+
const codeAppearanceDisabled = {
|
|
33
32
|
disabledPrimary: {
|
|
34
33
|
inputBorderColor: 'surfaceBorderDisabled',
|
|
35
34
|
inputBorderColorHover: 'surfaceBorderDisabled',
|
|
@@ -41,7 +40,7 @@ var codeAppearanceDisabled = {
|
|
|
41
40
|
},
|
|
42
41
|
};
|
|
43
42
|
|
|
44
|
-
|
|
43
|
+
const codeAppearanceError = {
|
|
45
44
|
errorPrimary: {
|
|
46
45
|
inputBorderColor: 'errorBorderQuaternary',
|
|
47
46
|
inputBorderColorHover: 'errorBorderSecondary',
|
|
@@ -53,7 +52,7 @@ var codeAppearanceError = {
|
|
|
53
52
|
},
|
|
54
53
|
};
|
|
55
54
|
|
|
56
|
-
|
|
55
|
+
const codeAppearanceRequire = {
|
|
57
56
|
requirePrimary: {
|
|
58
57
|
inputBorderColor: 'warningBorderSecondary',
|
|
59
58
|
inputBorderColorHover: 'warningBorderSecondary',
|
|
@@ -65,7 +64,7 @@ var codeAppearanceRequire = {
|
|
|
65
64
|
},
|
|
66
65
|
};
|
|
67
66
|
|
|
68
|
-
|
|
67
|
+
const codeAppearanceShape = {
|
|
69
68
|
circular: {
|
|
70
69
|
shape: 'circular',
|
|
71
70
|
},
|
|
@@ -90,7 +89,7 @@ var codeAppearanceShape = {
|
|
|
90
89
|
},
|
|
91
90
|
};
|
|
92
91
|
|
|
93
|
-
|
|
92
|
+
const codeAppearanceSize = {
|
|
94
93
|
sizeL: {
|
|
95
94
|
size: 'l',
|
|
96
95
|
inputSize: 'l',
|
|
@@ -103,7 +102,7 @@ var codeAppearanceSize = {
|
|
|
103
102
|
},
|
|
104
103
|
};
|
|
105
104
|
|
|
106
|
-
|
|
105
|
+
const codeAppearanceStyle = {
|
|
107
106
|
full: {
|
|
108
107
|
inputBorderColor: 'none',
|
|
109
108
|
},
|
|
@@ -119,7 +118,7 @@ var codeAppearanceStyle = {
|
|
|
119
118
|
},
|
|
120
119
|
};
|
|
121
120
|
|
|
122
|
-
|
|
121
|
+
const codeAppearanceSuccess = {
|
|
123
122
|
successPrimary: {
|
|
124
123
|
inputBorderColor: 'successBorderSecondary',
|
|
125
124
|
inputBorderColorHover: 'successBorderSecondary',
|
|
@@ -131,37 +130,46 @@ var codeAppearanceSuccess = {
|
|
|
131
130
|
},
|
|
132
131
|
};
|
|
133
132
|
|
|
134
|
-
|
|
133
|
+
const codeAppearance = {
|
|
134
|
+
...codeAppearanceDisabled,
|
|
135
|
+
...codeAppearanceShape,
|
|
136
|
+
...codeAppearanceRequire,
|
|
137
|
+
...codeAppearanceSize,
|
|
138
|
+
...codeAppearanceDefault,
|
|
139
|
+
...codeAppearanceStyle,
|
|
140
|
+
...codeAppearanceError,
|
|
141
|
+
...codeAppearanceSuccess,
|
|
142
|
+
};
|
|
135
143
|
|
|
136
|
-
|
|
144
|
+
const codeConfig = {
|
|
137
145
|
appearance: codeAppearance,
|
|
138
|
-
setAppearance:
|
|
146
|
+
setAppearance: (appearanceConfig) => {
|
|
139
147
|
codeConfig.appearance = appearanceConfig;
|
|
140
148
|
},
|
|
141
149
|
};
|
|
142
150
|
function Code(props) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
151
|
+
const { className, appearance, initialValue = '', isDisabled, inputAutoFocus, inputCount = 6, inputPlaceholder, inputType = 'number', separatorComponent, before, after, isSkeleton, onBlur, onChange, onFocus, } = props;
|
|
152
|
+
const [otp, setOtp] = useState(initialValue);
|
|
153
|
+
const appearanceConfig = useAppearanceConfig(appearance, codeConfig, isDisabled);
|
|
154
|
+
const propsGenerator = useDevicePropsGenerator(props, appearanceConfig);
|
|
155
|
+
const { inputBorderColorClass, inputBorderColorHoverClass, inputBorderFocusColorClass, inputBorderWidthClass, inputCaretColorClass, inputFillClass, inputFillHoverClass, inputPlaceholderTextColorClass, inputSizeClass, inputTextColorClass, inputTextSizeClass, inputTextWeightClass, shapeClass, shapeStrengthClass, sizeClass, widthClass, } = propsGenerator;
|
|
148
156
|
// NOTE: too many dependencies for "useCallback" and possible too many checks
|
|
149
|
-
|
|
150
|
-
return (jsx("input",
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
157
|
+
const renderInput = (otpInputProps, index) => {
|
|
158
|
+
return (jsx("input", { ...otpInputProps, className: clsx('code__input', inputCaretColorClass && `caret-color_${inputCaretColorClass}`, inputFillClass && `fill_${inputFillClass}`, inputFillHoverClass && `fill_hover_${inputFillHoverClass}`, inputPlaceholderTextColorClass &&
|
|
159
|
+
`placeholder-text-color_${inputPlaceholderTextColorClass}`, shapeClass && `shape_${shapeClass}`, shapeStrengthClass && `shape-strength_${shapeStrengthClass}`, inputTextSizeClass && `text_size_${inputTextSizeClass}`, inputTextColorClass && `text-color_${inputTextColorClass}`, inputTextWeightClass && `text-weight_${inputTextWeightClass}`, inputBorderWidthClass && `border-width_${inputBorderWidthClass}`, inputBorderColorClass && `border-color_${inputBorderColorClass}`, inputBorderColorHoverClass &&
|
|
160
|
+
`border-color_hover_${inputBorderColorHoverClass}`, inputBorderFocusColorClass &&
|
|
161
|
+
`border-color_focus_${inputBorderFocusColorClass}`, inputSizeClass && `code__input_size_${inputSizeClass}`, widthClass && `width_${widthClass}`, isSkeleton && `code__input_skeleton`), name: `code-${index}`, autoComplete: "one-time-code", placeholder: inputPlaceholder, onBlur: (event) => {
|
|
154
162
|
onBlur && onBlur(event);
|
|
155
163
|
otpInputProps.onBlur(event);
|
|
156
|
-
}, onFocus:
|
|
164
|
+
}, onFocus: (event) => {
|
|
157
165
|
onFocus && onFocus(event);
|
|
158
166
|
otpInputProps.onFocus(event);
|
|
159
|
-
} }))
|
|
167
|
+
} }));
|
|
160
168
|
};
|
|
161
|
-
useEffect(
|
|
169
|
+
useEffect(() => {
|
|
162
170
|
onChange && onChange(otp);
|
|
163
171
|
}, [otp]);
|
|
164
|
-
return (jsxs("div", { className: clsx(className, 'code', widthClass, sizeClass &&
|
|
172
|
+
return (jsxs("div", { className: clsx(className, 'code', widthClass, sizeClass && `code_size_${sizeClass}`), children: [before, jsx(OtpInput, { containerStyle: clsx(className, 'code__wrapper'), inputType: inputType, numInputs: inputCount, placeholder: inputPlaceholder, renderInput: renderInput, renderSeparator: separatorComponent || null, shouldAutoFocus: inputAutoFocus, value: otp, onChange: setOtp }), after] }));
|
|
165
173
|
}
|
|
166
174
|
|
|
167
175
|
export { Code, codeAppearance, codeConfig };
|
|
@@ -4,9 +4,8 @@ import clsx from 'clsx';
|
|
|
4
4
|
import Cookies from 'js-cookie';
|
|
5
5
|
import { useAppearanceConfig } from '../hooks/useAppearanceConfig/useAppearanceConfig.js';
|
|
6
6
|
import { useDevicePropsGenerator } from '../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js';
|
|
7
|
-
import { B as Button } from '../
|
|
8
|
-
import { T as Text } from '../
|
|
9
|
-
import { _ as __assign } from '../tslib.es6_es_Bwu1Cn-t.js';
|
|
7
|
+
import { B as Button } from '../Button_es_Cn3wtv3M.js';
|
|
8
|
+
import { T as Text } from '../Text_es_CnymlElo.js';
|
|
10
9
|
import 'lodash/camelCase';
|
|
11
10
|
import 'lodash/castArray';
|
|
12
11
|
import 'lodash/upperFirst';
|
|
@@ -19,16 +18,16 @@ import 'react-responsive';
|
|
|
19
18
|
import '../utils/setViewportProperty.js';
|
|
20
19
|
import '../hooks.js';
|
|
21
20
|
import '../hooks/useStyles/styleAttributes.js';
|
|
22
|
-
import '../
|
|
21
|
+
import '../Icon_es_D5eiycFI.js';
|
|
23
22
|
import 'react-inlinesvg';
|
|
24
23
|
import '../hoc/urlWithAssetPrefix.js';
|
|
25
24
|
import '../context/UrlAssetPrefix.js';
|
|
26
25
|
import '../hooks/useStyles/useStyles.js';
|
|
27
26
|
import 'lodash/maxBy';
|
|
28
|
-
import '../
|
|
29
|
-
import '../
|
|
27
|
+
import '../Link_es_P2b6ya7P.js';
|
|
28
|
+
import '../Loader_es_CmSggwbR.js';
|
|
30
29
|
|
|
31
|
-
|
|
30
|
+
const cookiesWarningAppearanceDefault = {
|
|
32
31
|
defaultPrimary: {
|
|
33
32
|
fill: 'accentPrimary',
|
|
34
33
|
fillHover: 'accentHover',
|
|
@@ -40,41 +39,42 @@ var cookiesWarningAppearanceDefault = {
|
|
|
40
39
|
},
|
|
41
40
|
};
|
|
42
41
|
|
|
43
|
-
|
|
42
|
+
const cookiesWarningAppearance = {
|
|
43
|
+
...cookiesWarningAppearanceDefault,
|
|
44
|
+
};
|
|
44
45
|
|
|
45
|
-
|
|
46
|
+
const cookiesWarningConfig = {
|
|
46
47
|
appearance: cookiesWarningAppearance,
|
|
47
|
-
setAppearance:
|
|
48
|
+
setAppearance: (appearanceConfig) => {
|
|
48
49
|
cookiesWarningConfig.appearance = appearanceConfig;
|
|
49
50
|
},
|
|
50
51
|
};
|
|
51
52
|
function CookiesWarning(props) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
(_a = cookiesWarningRef.current) === null || _a === void 0 ? void 0 : _a.classList.add('cookies-warning_state_hidden');
|
|
53
|
+
const { className, appearance, message, isHideOnScroll = false } = props;
|
|
54
|
+
const cookiesWarningRef = useRef(null);
|
|
55
|
+
const isOpen = useMemo(() => Cookies.get('cookies-warning') !== 'close', []);
|
|
56
|
+
const closeCookiesWarning = useCallback(() => {
|
|
57
|
+
cookiesWarningRef.current?.classList.add('cookies-warning_state_hidden');
|
|
58
58
|
Cookies.set('cookies-warning', 'close');
|
|
59
59
|
}, []);
|
|
60
|
-
useEffect(
|
|
60
|
+
useEffect(() => {
|
|
61
61
|
if (isHideOnScroll) {
|
|
62
62
|
window.addEventListener('scroll', closeCookiesWarning, true);
|
|
63
63
|
}
|
|
64
|
-
return
|
|
64
|
+
return () => {
|
|
65
65
|
window.removeEventListener('scroll', closeCookiesWarning, true);
|
|
66
66
|
};
|
|
67
67
|
}, []);
|
|
68
|
-
useEffect(
|
|
68
|
+
useEffect(() => {
|
|
69
69
|
// isHideOnScroll &&
|
|
70
70
|
if (!isOpen) {
|
|
71
71
|
window.removeEventListener('scroll', closeCookiesWarning, true);
|
|
72
72
|
}
|
|
73
73
|
}, [isOpen]);
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return (isOpen && (jsx("div", { className: clsx('cookies-warning', className, fillClass &&
|
|
74
|
+
const appearanceConfig = useAppearanceConfig(appearance, cookiesWarningConfig);
|
|
75
|
+
const propsGenerator = useDevicePropsGenerator(props, appearanceConfig);
|
|
76
|
+
const { fillClass, messageTextColor, messageTextSize, buttonAppearance, buttonFill, buttonFillHover, buttonLabel, buttonLabelSize, buttonLabelTextColor, buttonShape, buttonSize, buttonWidth, elevationClass, } = propsGenerator;
|
|
77
|
+
return (isOpen && (jsx("div", { className: clsx('cookies-warning', className, fillClass && `fill_${fillClass}`, elevationClass && `elevation_${elevationClass}`), ref: cookiesWarningRef, children: jsxs("div", { className: "cookies-warning__inner", children: [jsx(Text, { size: messageTextSize, textColor: messageTextColor, children: message }), jsx(Button, { appearance: buttonAppearance, width: buttonWidth, size: buttonSize, fill: buttonFill, fillHover: buttonFillHover, labelTextColor: buttonLabelTextColor, labelTextSize: buttonLabelSize, shape: buttonShape, onClick: closeCookiesWarning, children: buttonLabel })] }) })));
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
export { CookiesWarning, cookiesWarningAppearance, cookiesWarningConfig };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { _ as __assign, b as __rest } from '../tslib.es6_es_Bwu1Cn-t.js';
|
|
2
1
|
import { jsx } from 'react/jsx-runtime';
|
|
3
2
|
import { useMemo } from 'react';
|
|
4
3
|
import clsx from 'clsx';
|
|
5
4
|
import { PartySuggestions } from 'react-dadata';
|
|
6
|
-
import { I as Input } from '../
|
|
5
|
+
import { I as Input } from '../Input_es_BnCXATnh.js';
|
|
7
6
|
import '../hooks/useAppearanceConfig/useAppearanceConfig.js';
|
|
8
7
|
import '../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js';
|
|
9
8
|
import 'lodash/camelCase';
|
|
@@ -20,15 +19,21 @@ import '../hooks.js';
|
|
|
20
19
|
import '../hooks/useStyles/styleAttributes.js';
|
|
21
20
|
|
|
22
21
|
function Dadata(props) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return
|
|
22
|
+
const { delay, input, inputProps, meta, token, setValue } = props;
|
|
23
|
+
const dadataInputProps = useMemo(() => {
|
|
24
|
+
return {
|
|
25
|
+
...inputProps,
|
|
26
|
+
className: clsx('react-dadata__input', meta.active && 'input_state_focus', meta.error &&
|
|
26
27
|
meta.touched &&
|
|
27
|
-
|
|
28
|
+
`input_state_${meta.error.key || 'error'}`),
|
|
28
29
|
// https://www.npmjs.com/package/react-dadata
|
|
29
30
|
// "Свойство value игнорируется."
|
|
30
31
|
// value: input.value,
|
|
31
|
-
inputValue: input.value,
|
|
32
|
+
inputValue: input.value,
|
|
33
|
+
onBlur: input.onBlur,
|
|
34
|
+
onChange: input.onChange,
|
|
35
|
+
onFocus: input.onFocus,
|
|
36
|
+
};
|
|
32
37
|
}, [
|
|
33
38
|
inputProps,
|
|
34
39
|
meta.active,
|
|
@@ -42,8 +47,8 @@ function Dadata(props) {
|
|
|
42
47
|
return (jsx(PartySuggestions, { minChars: 3, customInput: DadataCustomInput, delay: delay || 750, inputProps: dadataInputProps, token: token, onChange: setValue }));
|
|
43
48
|
}
|
|
44
49
|
function DadataCustomInput(props) {
|
|
45
|
-
|
|
46
|
-
return jsx(Input,
|
|
50
|
+
const { inputValue, ...otherProps } = props;
|
|
51
|
+
return jsx(Input, { ...otherProps, value: inputValue });
|
|
47
52
|
}
|
|
48
53
|
|
|
49
54
|
export { Dadata };
|
|
@@ -2,11 +2,10 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { DATE_PERIOD_INTERVALS } from '@itcase/common';
|
|
5
|
-
import { D as DatePickerInput } from '../
|
|
5
|
+
import { D as DatePickerInput } from '../DatePicker_es_D1LvY5RT.js';
|
|
6
6
|
import { useAppearanceConfig } from '../hooks/useAppearanceConfig/useAppearanceConfig.js';
|
|
7
7
|
import { useDevicePropsGenerator } from '../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js';
|
|
8
|
-
import { b as ChipsGroup, C as Chips } from '../
|
|
9
|
-
import { _ as __assign } from '../tslib.es6_es_Bwu1Cn-t.js';
|
|
8
|
+
import { b as ChipsGroup, C as Chips } from '../ChipsGroup_es_BVQ7_n0k.js';
|
|
10
9
|
import 'date-fns/locale';
|
|
11
10
|
import 'react-datepicker';
|
|
12
11
|
import '../hooks/useStyles/useStyles.js';
|
|
@@ -21,20 +20,20 @@ import 'react-responsive';
|
|
|
21
20
|
import '../utils/setViewportProperty.js';
|
|
22
21
|
import '../hooks.js';
|
|
23
22
|
import '../hooks/useStyles/styleAttributes.js';
|
|
24
|
-
import '../
|
|
25
|
-
import '../
|
|
23
|
+
import '../Button_es_Cn3wtv3M.js';
|
|
24
|
+
import '../Icon_es_D5eiycFI.js';
|
|
26
25
|
import 'react-inlinesvg';
|
|
27
26
|
import '../hoc/urlWithAssetPrefix.js';
|
|
28
27
|
import '../context/UrlAssetPrefix.js';
|
|
29
|
-
import '../
|
|
30
|
-
import '../
|
|
31
|
-
import '../
|
|
32
|
-
import '../
|
|
33
|
-
import '../
|
|
28
|
+
import '../Link_es_P2b6ya7P.js';
|
|
29
|
+
import '../Text_es_CnymlElo.js';
|
|
30
|
+
import '../Loader_es_CmSggwbR.js';
|
|
31
|
+
import '../Input_es_BnCXATnh.js';
|
|
32
|
+
import '../Label_es_DCqpSw_F.js';
|
|
34
33
|
import '@itcase/icons/default';
|
|
35
34
|
import 'lodash/castArray';
|
|
36
35
|
|
|
37
|
-
|
|
36
|
+
const datePeriodAppearanceSize = {
|
|
38
37
|
sizeL: {
|
|
39
38
|
size: 'm',
|
|
40
39
|
chipsAppearanceSize: 'sizeL',
|
|
@@ -51,7 +50,7 @@ var datePeriodAppearanceSize = {
|
|
|
51
50
|
},
|
|
52
51
|
};
|
|
53
52
|
|
|
54
|
-
|
|
53
|
+
const datePeriodAppearanceSurface = {
|
|
55
54
|
surfacePrimary: {
|
|
56
55
|
fill: 'surfacePrimary',
|
|
57
56
|
chipsAppearance: 'surfacePrimary ghost',
|
|
@@ -70,27 +69,30 @@ var datePeriodAppearanceSurface = {
|
|
|
70
69
|
},
|
|
71
70
|
};
|
|
72
71
|
|
|
73
|
-
|
|
72
|
+
const datePeriodAppearance = {
|
|
73
|
+
...datePeriodAppearanceSurface,
|
|
74
|
+
...datePeriodAppearanceSize,
|
|
75
|
+
};
|
|
74
76
|
|
|
75
|
-
|
|
77
|
+
const datePeriodConfig = {
|
|
76
78
|
appearance: datePeriodAppearance,
|
|
77
|
-
setAppearance:
|
|
79
|
+
setAppearance: (appearanceConfig) => {
|
|
78
80
|
datePeriodConfig.appearance = appearanceConfig;
|
|
79
81
|
},
|
|
80
82
|
};
|
|
81
83
|
function DatePeriod(props) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
const { appearance, className, datePeriodIntervalsList = Object.values(DATE_PERIOD_INTERVALS), datePeriodValueEnd, datePeriodValueStart, monthsShown, selectsRange = true, isDisabled, isSkeleton, onChangeDatePeriod, onKeyDown, } = props;
|
|
85
|
+
const appearanceConfig = useAppearanceConfig(appearance, datePeriodConfig, isDisabled);
|
|
86
|
+
const propsGenerator = useDevicePropsGenerator(props, appearanceConfig);
|
|
87
|
+
const { fillClass, chipsAppearance, chipsAppearanceSize, chipsShape, datePickerAppearance, datePickerAppearanceSize, datePickerInputAppearance, datePickerInputFillHover, datePickerInputSize, datePickerInputTextSize, shapeClass, sizeClass, } = propsGenerator;
|
|
88
|
+
const onClickPeriodChips = useCallback((selectedPeriodItem) => {
|
|
89
|
+
const dateStartIso = selectedPeriodItem.dateIntervalsList[0];
|
|
90
|
+
const dateEndIso = selectedPeriodItem.dateIntervalsList[1];
|
|
89
91
|
onChangeDatePeriod(new Date(dateStartIso), new Date(dateEndIso));
|
|
90
92
|
}, [onChangeDatePeriod]);
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
const checkIsChipsActive = useCallback((targetPeriodItem) => {
|
|
94
|
+
const dateStartIso = targetPeriodItem.dateIntervalsList[0];
|
|
95
|
+
const dateEndIso = targetPeriodItem.dateIntervalsList[1];
|
|
94
96
|
return (dateStartIso === datePeriodValueStart &&
|
|
95
97
|
dateEndIso === datePeriodValueEnd);
|
|
96
98
|
}, [datePeriodValueEnd, datePeriodValueStart]);
|
|
@@ -108,18 +110,18 @@ function DatePeriod(props) {
|
|
|
108
110
|
// },
|
|
109
111
|
// [onChangeDatePeriod],
|
|
110
112
|
// )
|
|
111
|
-
return (jsx("div", { className: clsx(className, 'date-period', shapeClass &&
|
|
112
|
-
appearance:
|
|
113
|
+
return (jsx("div", { className: clsx(className, 'date-period', shapeClass && `date-period_shape_${shapeClass}`, sizeClass && `date-period_size_${sizeClass}`, isSkeleton && `date-period_skeleton`, fillClass && `fill_${fillClass}`, 'cursor_type_pointer'), children: jsxs(ChipsGroup, { direction: "horizontal", children: [datePeriodIntervalsList.map((datePeriodItem) => (jsx(Chips, { appearance: `${chipsAppearance} ${chipsAppearanceSize}`, label: datePeriodItem.label, shape: chipsShape, isActive: checkIsChipsActive(datePeriodItem), onClick: () => onClickPeriodChips(datePeriodItem) }, datePeriodItem.value))), jsx(DatePickerInput, { className: "date-period__datepicker", datePickerProps: {
|
|
114
|
+
appearance: `${datePickerAppearance} ${datePickerAppearanceSize}`,
|
|
113
115
|
dateFormat: 'dd/MM/yyyy',
|
|
114
116
|
monthsShown: monthsShown,
|
|
115
|
-
selectsRange:
|
|
117
|
+
selectsRange: selectsRange,
|
|
116
118
|
showWeekNumbers: true,
|
|
117
119
|
isClearable: false,
|
|
118
120
|
isStartDefaultNull: true,
|
|
119
121
|
onKeyDown: onKeyDown,
|
|
120
122
|
}, endValue: datePeriodValueEnd, inputProps: {
|
|
121
|
-
appearance:
|
|
122
|
-
className:
|
|
123
|
+
appearance: `${datePickerInputAppearance} ghost`,
|
|
124
|
+
className: `date-period__datepicker-input date-period__datepicker-input_size_${datePickerInputSize}`,
|
|
123
125
|
fillHover: datePickerInputFillHover,
|
|
124
126
|
textSize: datePickerInputTextSize,
|
|
125
127
|
placeholder: 'Выбрать период',
|