@itcase/ui 1.8.122 → 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_i0Dn1pkl.js → Button_cjs_CZz8OjWi.js} +42 -30
- package/dist/{Button_es_CtH5EKJd.js → Button_es_Cn3wtv3M.js} +42 -30
- 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_Du73R-wm.js → Input_cjs_DDi5JVAV.js} +27 -19
- package/dist/{Input_es_CiDHjDqJ.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 +114 -84
- 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 +102 -84
- 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 +47 -42
- 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 +59 -69
- 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 +114 -84
- 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 +102 -84
- 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 +47 -42
- 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 +59 -69
- 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/Checkmark/Checkmark.css +2 -0
- package/dist/css/components/DatePeriod/DatePeriod.css +3 -0
- package/dist/css/components/Input/Input.css +0 -8
- package/dist/css/components/InputPassword/InputPassword.css +34 -43
- 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/InputPassword/InputPassword.appearance.d.ts +179 -2
- package/dist/types/components/InputPassword/appearance/inputPasswordDefault.d.ts +7 -4
- package/dist/types/components/InputPassword/appearance/inputPasswordDisabled.d.ts +6 -4
- package/dist/types/components/InputPassword/appearance/inputPasswordError.d.ts +6 -4
- package/dist/types/components/InputPassword/appearance/inputPasswordRequire.d.ts +6 -4
- package/dist/types/components/InputPassword/appearance/inputPasswordShape.d.ts +25 -0
- package/dist/types/components/InputPassword/appearance/inputPasswordSize.d.ts +14 -28
- package/dist/types/components/InputPassword/appearance/inputPasswordStyle.d.ts +5 -5
- package/dist/types/components/InputPassword/appearance/inputPasswordSuccess.d.ts +6 -4
- package/dist/types/components/Response/Response.constant.d.ts +32 -35
- package/dist/types/components/Response/appearance/responseConfirm.d.ts +1 -0
- package/dist/types/components/Response/appearance/responseDanger.d.ts +1 -0
- package/dist/types/components/Response/appearance/responseEmpty.d.ts +1 -0
- package/dist/types/components/Response/appearance/responseError.d.ts +1 -0
- package/dist/types/components/Response/appearance/responseFail.d.ts +1 -0
- package/dist/types/components/Response/appearance/responseNothingFound.d.ts +1 -0
- package/dist/types/components/Response/appearance/responseRefresh.d.ts +1 -0
- package/dist/types/components/Response/appearance/responseSuccess.d.ts +1 -0
- package/dist/types/components/Response/appearance/responseUnableLoadData.d.ts +1 -0
- package/dist/types/components/Response/appearance/responseWarning.d.ts +1 -0
- package/dist/types/components/Select/SelectContainer.d.ts +1 -1
- package/dist/types/components/Tab/appearance/tabSize.d.ts +0 -14
- package/dist/types/components/Tab/appearance/tabSurface.d.ts +7 -7
- package/dist/utils/setViewportProperty.js +3 -3
- package/package.json +14 -14
- package/dist/Avatar_cjs_kuE0Rueg.js +0 -157
- package/dist/Avatar_es_lx7s4Vla.js +0 -153
- package/dist/ChipsGroup_cjs_C8L3ZeD_.js +0 -331
- package/dist/DatePicker_cjs_DsIAoi01.js +0 -183
- package/dist/DatePicker_es_BP5BrEr-.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_B6YlGx8G.js +0 -28
- package/dist/Image_es_BvYo_cHH.js +0 -26
- 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
|
@@ -3,11 +3,10 @@ import clsx from 'clsx';
|
|
|
3
3
|
import { useAppearanceConfig } from './hooks/useAppearanceConfig/useAppearanceConfig.js';
|
|
4
4
|
import { useDevicePropsGenerator } from './hooks/useDevicePropsGenerator/useDevicePropsGenerator.js';
|
|
5
5
|
import { useStyles } from './hooks/useStyles/useStyles.js';
|
|
6
|
-
import { I as Icon, B as Badge } from './
|
|
7
|
-
import { T as Text } from './
|
|
8
|
-
import { _ as __assign } from './tslib.es6_es_Bwu1Cn-t.js';
|
|
6
|
+
import { I as Icon, B as Badge } from './Icon_es_D5eiycFI.js';
|
|
7
|
+
import { T as Text } from './Text_es_CnymlElo.js';
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
const chipsAppearanceAccent = {
|
|
11
10
|
accent: {
|
|
12
11
|
fill: 'accentPrimary',
|
|
13
12
|
fillHover: 'accentHoverPrimary',
|
|
@@ -32,7 +31,7 @@ var chipsAppearanceAccent = {
|
|
|
32
31
|
},
|
|
33
32
|
};
|
|
34
33
|
|
|
35
|
-
|
|
34
|
+
const chipsAppearanceDanger = {
|
|
36
35
|
dangerMutedPrimary: {
|
|
37
36
|
fill: 'dangerTertiary',
|
|
38
37
|
labelTextColor: 'dangerTextQuaternary',
|
|
@@ -49,7 +48,7 @@ var chipsAppearanceDanger = {
|
|
|
49
48
|
},
|
|
50
49
|
};
|
|
51
50
|
|
|
52
|
-
|
|
51
|
+
const chipsAppearanceDisabled = {
|
|
53
52
|
disabled: {
|
|
54
53
|
fill: 'surfaceDisabled',
|
|
55
54
|
labelTextColor: 'surfaceTextDisabled',
|
|
@@ -59,7 +58,7 @@ var chipsAppearanceDisabled = {
|
|
|
59
58
|
},
|
|
60
59
|
};
|
|
61
60
|
|
|
62
|
-
|
|
61
|
+
const chipsAppearanceError = {
|
|
63
62
|
errorMutedPrimary: {
|
|
64
63
|
fill: 'errorDisabled',
|
|
65
64
|
labelTextColor: 'errorTextQuaternary',
|
|
@@ -76,7 +75,7 @@ var chipsAppearanceError = {
|
|
|
76
75
|
},
|
|
77
76
|
};
|
|
78
77
|
|
|
79
|
-
|
|
78
|
+
const chipsAppearanceInfo = {
|
|
80
79
|
infoMutedPrimary: {
|
|
81
80
|
fill: 'infoTertiary',
|
|
82
81
|
labelTextColor: 'infoTextPrimary',
|
|
@@ -93,7 +92,7 @@ var chipsAppearanceInfo = {
|
|
|
93
92
|
},
|
|
94
93
|
};
|
|
95
94
|
|
|
96
|
-
|
|
95
|
+
const chipsAppearancePrimary = {
|
|
97
96
|
primaryMutedPrimary: {
|
|
98
97
|
fill: 'primaryDisabled',
|
|
99
98
|
labelTextColor: 'primaryTextSecondary',
|
|
@@ -110,7 +109,7 @@ var chipsAppearancePrimary = {
|
|
|
110
109
|
},
|
|
111
110
|
};
|
|
112
111
|
|
|
113
|
-
|
|
112
|
+
const chipsAppearanceSecondary = {
|
|
114
113
|
secondaryMutedPrimary: {
|
|
115
114
|
fill: 'secondaryDisabled',
|
|
116
115
|
labelTextColor: 'secondaryTextQuaternary',
|
|
@@ -127,7 +126,7 @@ var chipsAppearanceSecondary = {
|
|
|
127
126
|
},
|
|
128
127
|
};
|
|
129
128
|
|
|
130
|
-
|
|
129
|
+
const chipsAppearanceShape = {
|
|
131
130
|
circular: {
|
|
132
131
|
shape: 'circular',
|
|
133
132
|
},
|
|
@@ -152,7 +151,7 @@ var chipsAppearanceShape = {
|
|
|
152
151
|
},
|
|
153
152
|
};
|
|
154
153
|
|
|
155
|
-
|
|
154
|
+
const chipsAppearanceSize = {
|
|
156
155
|
sizeXXL: {
|
|
157
156
|
size: 'xxl',
|
|
158
157
|
labelTextSize: 'xl',
|
|
@@ -197,7 +196,7 @@ var chipsAppearanceSize = {
|
|
|
197
196
|
},
|
|
198
197
|
};
|
|
199
198
|
|
|
200
|
-
|
|
199
|
+
const chipsAppearanceStyle = {
|
|
201
200
|
solid: {
|
|
202
201
|
borderColor: 'none',
|
|
203
202
|
},
|
|
@@ -211,7 +210,7 @@ var chipsAppearanceStyle = {
|
|
|
211
210
|
},
|
|
212
211
|
};
|
|
213
212
|
|
|
214
|
-
|
|
213
|
+
const chipsAppearanceSuccess = {
|
|
215
214
|
successMutedPrimary: {
|
|
216
215
|
fill: 'successTertiary',
|
|
217
216
|
labelTextColor: 'successTextQuaternary',
|
|
@@ -228,7 +227,7 @@ var chipsAppearanceSuccess = {
|
|
|
228
227
|
},
|
|
229
228
|
};
|
|
230
229
|
|
|
231
|
-
|
|
230
|
+
const chipsAppearanceSurface = {
|
|
232
231
|
surfaceMutedPrimary: {
|
|
233
232
|
fill: 'surfaceSecondary',
|
|
234
233
|
labelTextColor: 'surfaceTextQuaternary',
|
|
@@ -274,7 +273,7 @@ var chipsAppearanceSurface = {
|
|
|
274
273
|
},
|
|
275
274
|
};
|
|
276
275
|
|
|
277
|
-
|
|
276
|
+
const chipsAppearanceWarning = {
|
|
278
277
|
warningMutedPrimary: {
|
|
279
278
|
fill: 'warningTertiary',
|
|
280
279
|
labelTextColor: 'warningTextSecondary',
|
|
@@ -291,36 +290,50 @@ var chipsAppearanceWarning = {
|
|
|
291
290
|
},
|
|
292
291
|
};
|
|
293
292
|
|
|
294
|
-
|
|
293
|
+
const chipsAppearance = {
|
|
294
|
+
...chipsAppearanceSize,
|
|
295
|
+
...chipsAppearanceStyle,
|
|
296
|
+
...chipsAppearanceAccent,
|
|
297
|
+
...chipsAppearanceDanger,
|
|
298
|
+
...chipsAppearanceError,
|
|
299
|
+
...chipsAppearanceInfo,
|
|
300
|
+
...chipsAppearanceDisabled,
|
|
301
|
+
...chipsAppearancePrimary,
|
|
302
|
+
...chipsAppearanceSecondary,
|
|
303
|
+
...chipsAppearanceSuccess,
|
|
304
|
+
...chipsAppearanceSurface,
|
|
305
|
+
...chipsAppearanceWarning,
|
|
306
|
+
...chipsAppearanceShape,
|
|
307
|
+
};
|
|
295
308
|
|
|
296
|
-
|
|
309
|
+
const chipsConfig = {
|
|
297
310
|
appearance: chipsAppearance,
|
|
298
|
-
setAppearance:
|
|
311
|
+
setAppearance: (appearanceConfig) => {
|
|
299
312
|
chipsConfig.appearance = appearanceConfig;
|
|
300
313
|
},
|
|
301
314
|
};
|
|
302
315
|
function Chips(props) {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
return (jsx("div", { "data-test-id": dataTestId &&
|
|
309
|
-
? fillClass &&
|
|
310
|
-
: fillActiveClass &&
|
|
311
|
-
? fillHoverClass &&
|
|
312
|
-
: fillActiveHoverClass &&
|
|
316
|
+
const { dataTestId, dataTour, className, appearance, label = '', isDisabled, iconAfter, iconAfterSrc, iconBefore, iconBeforeSrc, isActive, isSkeleton, onClick, onClickIconAfter, onClickIconBefore, children, } = props;
|
|
317
|
+
const appearanceConfig = useAppearanceConfig(appearance, chipsConfig, isDisabled);
|
|
318
|
+
const propsGenerator = useDevicePropsGenerator(props, appearanceConfig);
|
|
319
|
+
const { alignClass, alignDirectionClass, fillActiveClass, fillActiveHoverClass, fillClass, fillHoverClass, labelTextActiveColor, labelTextActiveHoverColor, labelTextColor, labelTextHoverColor, labelTextSize, labelTextWeight, labelTextWrap, borderColorClass, borderTypeClass, badgeAppearance, badgeShape, badgeSize, badgeTextColor, badgeTextSize, badgeValue, cursorClass, iconAfterFill, iconAfterFillActiveIcon, iconAfterFillIcon, iconAfterFillSize, iconAfterShape, iconAfterSize, iconBeforeFill, iconBeforeFillActiveIcon, iconBeforeFillIcon, iconBeforeFillSize, iconBeforeShape, iconBeforeSize, shapeClass, shapeStrengthClass, sizeClass, } = propsGenerator;
|
|
320
|
+
const { styles: chipsStyles } = useStyles(props);
|
|
321
|
+
return (jsx("div", { "data-test-id": dataTestId && `${dataTestId}Chips`, "data-tour": dataTour, className: clsx(className, 'chips', !isActive
|
|
322
|
+
? fillClass && `fill_${fillClass}`
|
|
323
|
+
: fillActiveClass && `fill_active_${fillActiveClass}`, !isActive
|
|
324
|
+
? fillHoverClass && `fill_hover_${fillHoverClass}`
|
|
325
|
+
: fillActiveHoverClass && `fill_active_hover_${fillActiveHoverClass}`, shapeClass && `shape_${shapeClass}`, shapeStrengthClass && `shape-strength_${shapeStrengthClass}`, borderColorClass && `border-color_${borderColorClass}`, borderTypeClass && `border_type_${borderTypeClass}`, sizeClass && `chips_size_${sizeClass}`, alignDirectionClass && `align_${alignDirectionClass}`, alignClass && `align_${alignClass}`, isActive && 'chips_state_active', isDisabled && `chips_state_disabled`, cursorClass && `cursor_${cursorClass}`, onClick && 'cursor_type_pointer', isSkeleton && `chips_skeleton`), style: chipsStyles, onClick: !isDisabled ? onClick : undefined, children: jsxs("div", { className: "chips__inner", children: [(iconBefore || iconBeforeSrc) && (jsx(Icon, { className: "chips__icon_before", size: iconBeforeSize, fill: iconBeforeFill, fillSize: iconBeforeFillSize, iconFill: iconBeforeFillIcon, iconFillActive: iconBeforeFillActiveIcon, imageSrc: iconBeforeSrc, shape: iconBeforeShape, SvgImage: iconBefore, isActive: isActive, onClick: onClickIconBefore })), typeof label === 'string' ? (jsx(Text, { className: "chips__label", size: labelTextSize, textColor: labelTextColor, textColorActive: labelTextActiveColor, textColorActiveHover: labelTextActiveHoverColor, textColorHover: labelTextHoverColor, textWeight: labelTextWeight, textWrap: labelTextWrap, isActive: isActive, children: label })) : (jsx("div", { className: "chips__label", children: label })), children, (iconAfter || iconAfterSrc) && (jsx(Icon, { className: "chips__icon_after", size: iconAfterSize, fill: iconAfterFill, fillSize: iconAfterFillSize, iconFill: iconAfterFillIcon, iconFillActive: iconAfterFillActiveIcon, imageSrc: iconAfterSrc, shape: iconAfterShape, SvgImage: iconAfter, isActive: isActive, onClick: onClickIconAfter })), badgeValue && (jsx(Badge, { className: "chips__badge", appearance: badgeAppearance, size: badgeSize, textColor: badgeTextColor, textSize: badgeTextSize, shape: badgeShape, value: badgeValue }))] }) }));
|
|
313
326
|
}
|
|
314
327
|
|
|
315
328
|
function ChipsGroup(props) {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
329
|
+
const { className, chipsList, dataTestId, dataTour, horizontalScroll, style, onClick, children, } = props;
|
|
330
|
+
const propsGenerator = useDevicePropsGenerator(props);
|
|
331
|
+
const { directionClass, alignClass, alignDirectionClass, fillClass, borderColorClass, borderTypeClass, borderWidthClass, chipsAppearance, widthClass, wrapClass, } = propsGenerator;
|
|
319
332
|
// @ts-expect-error
|
|
320
|
-
|
|
321
|
-
return (jsx("div", { className: clsx(className, 'chips-group', 'group', widthClass &&
|
|
333
|
+
const { styles: groupStyles, wrapper: groupWrapperStyles } = useStyles(props);
|
|
334
|
+
return (jsx("div", { className: clsx(className, 'chips-group', 'group', widthClass && `width_${widthClass}`, alignDirectionClass && `align_${alignDirectionClass}`, directionClass && `group_direction_${directionClass}`, alignClass && `align_${alignClass}`, fillClass && `fill_${fillClass}`, horizontalScroll && 'group_type_horizontal_scroll', wrapClass && `group_wrap_${wrapClass}`, borderColorClass && `border-color_${borderColorClass}`, borderWidthClass && `border-width_${borderWidthClass}`, borderTypeClass && `border_type_${borderTypeClass}`), "data-test-id": dataTestId, "data-tour": dataTour, style: Object.assign({}, groupStyles, style), children: horizontalScroll ? (jsx("div", { className: "chips-group__wrapper", style: groupWrapperStyles, children: children
|
|
322
335
|
? children
|
|
323
|
-
: chipsList
|
|
336
|
+
: chipsList?.map((item) => (jsx(Chips, { appearance: chipsAppearance, label: item.label, isDisabled: item.isDisabled, iconAfter: item.iconAfter, iconBefore: item.iconBefore, isActive: item.isActive, onClick: () => onClick(item) }, item.id))) })) : children ? (children) : (chipsList?.map((item) => (jsx(Chips, { appearance: chipsAppearance, label: item.label, isDisabled: item.isDisabled, iconAfter: item.iconAfter, iconBefore: item.iconBefore, isActive: item.isActive, onClick: () => onClick(item) }, item.id)))) }));
|
|
324
337
|
}
|
|
325
338
|
|
|
326
339
|
export { Chips as C, chipsAppearance as a, ChipsGroup as b, chipsConfig as c };
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var clsx = require('clsx');
|
|
6
|
+
var locale = require('date-fns/locale');
|
|
7
|
+
var DatePicker = require('react-datepicker');
|
|
8
|
+
var useAppearanceConfig = require('./cjs/hooks/useAppearanceConfig/useAppearanceConfig.js');
|
|
9
|
+
var useDevicePropsGenerator = require('./cjs/hooks/useDevicePropsGenerator/useDevicePropsGenerator.js');
|
|
10
|
+
var useStyles = require('./cjs/hooks/useStyles/useStyles.js');
|
|
11
|
+
var Button = require('./Button_cjs_CZz8OjWi.js');
|
|
12
|
+
var Icon = require('./Icon_cjs_DpFxIFv5.js');
|
|
13
|
+
var Input = require('./Input_cjs_DDi5JVAV.js');
|
|
14
|
+
var Label = require('./Label_cjs_C-x9blCL.js');
|
|
15
|
+
var Text = require('./Text_cjs_BDTjOTVB.js');
|
|
16
|
+
var _default = require('@itcase/icons/default');
|
|
17
|
+
|
|
18
|
+
const datePickerSize = {
|
|
19
|
+
sizeL: {
|
|
20
|
+
size: 'l',
|
|
21
|
+
daySize: 'xs',
|
|
22
|
+
dayTextSize: 'm',
|
|
23
|
+
iconFillSize: 24,
|
|
24
|
+
iconLeft: _default.icons14.Arrow.ChevronLeft,
|
|
25
|
+
iconRight: _default.icons14.Arrow.ChevronRight,
|
|
26
|
+
},
|
|
27
|
+
sizeM: {
|
|
28
|
+
size: 'm',
|
|
29
|
+
daySize: 'xxl',
|
|
30
|
+
dayTextSize: 'm',
|
|
31
|
+
iconFillSize: 24,
|
|
32
|
+
iconLeft: _default.icons14.Arrow.ChevronLeft,
|
|
33
|
+
iconRight: _default.icons14.Arrow.ChevronRight,
|
|
34
|
+
iconSize: 14,
|
|
35
|
+
monthTextSize: 'm',
|
|
36
|
+
yearTextSize: 'm',
|
|
37
|
+
},
|
|
38
|
+
sizeS: {
|
|
39
|
+
size: 's',
|
|
40
|
+
daySize: 'xs',
|
|
41
|
+
dayTextSize: 'm',
|
|
42
|
+
iconFillSize: 24,
|
|
43
|
+
iconLeft: _default.icons14.Arrow.ChevronLeft,
|
|
44
|
+
iconRight: _default.icons14.Arrow.ChevronRight,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const datePickerStyle = {
|
|
49
|
+
solid: {
|
|
50
|
+
inputProps: {
|
|
51
|
+
borderColor: 'none',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
outlined: {
|
|
55
|
+
inputProps: {
|
|
56
|
+
fill: 'none',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
full: {},
|
|
60
|
+
ghost: {
|
|
61
|
+
inputProps: {
|
|
62
|
+
fill: 'none',
|
|
63
|
+
borderColor: 'none',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const datePickerAppearanceSurface = {
|
|
69
|
+
surfacePrimary: {
|
|
70
|
+
dayTextColor: 'surfaceTextPrimary',
|
|
71
|
+
dayTextShape: 'rounded',
|
|
72
|
+
iconFillHover: 'surfaceSecondary',
|
|
73
|
+
iconItemFill: 'surfaceItemPrimary',
|
|
74
|
+
iconShape: 'circular',
|
|
75
|
+
monthTextColor: 'surfaceTextPrimary',
|
|
76
|
+
monthTextWeight: 400,
|
|
77
|
+
placeholderTextColor: 'surfaceTextPrimary',
|
|
78
|
+
yearTextColor: 'surfaceTextPrimary',
|
|
79
|
+
yearTextWeight: 400,
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const datePickerAppearance = {
|
|
84
|
+
...datePickerAppearanceSurface,
|
|
85
|
+
...datePickerSize,
|
|
86
|
+
...datePickerStyle,
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const datePickerConfig = {
|
|
90
|
+
appearance: datePickerAppearance,
|
|
91
|
+
setAppearance: (appearanceConfig) => {
|
|
92
|
+
datePickerConfig.appearance = appearanceConfig;
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
function DatePickerInput(props) {
|
|
96
|
+
const { className, datePickerProps = {}, endValue, inputProps = {}, value, onChange, } = props;
|
|
97
|
+
const datepickerRef = React.useRef(null);
|
|
98
|
+
const { customTimeInput, disablePastDays, monthsShown, selectsRange } = datePickerProps;
|
|
99
|
+
const appearanceConfig = useAppearanceConfig.useAppearanceConfig(datePickerProps.appearance, datePickerConfig);
|
|
100
|
+
const propsGenerator = useDevicePropsGenerator.useDevicePropsGenerator(datePickerProps, appearanceConfig);
|
|
101
|
+
const { daySize, dayTextColor, dayTextShape, dayTextSize, iconFill, iconFillHover, iconFillSize, iconItemFill, iconLeft, iconRight, iconShape, monthTextColor, monthTextSize, monthTextWeight, popper, popperPlacement, sizeClass, widthClass, yearTextColor, yearTextSize, yearTextWeight, isClearable, } = propsGenerator;
|
|
102
|
+
const [dateStart, dateEnd] = React.useMemo(() => {
|
|
103
|
+
let dateStart;
|
|
104
|
+
if (value) {
|
|
105
|
+
if (typeof value === 'string') {
|
|
106
|
+
dateStart = new Date(value);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
dateStart = value;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
dateStart = undefined;
|
|
114
|
+
}
|
|
115
|
+
let dateEnd;
|
|
116
|
+
if (endValue) {
|
|
117
|
+
if (typeof endValue === 'string') {
|
|
118
|
+
dateEnd = new Date(endValue);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
dateEnd = endValue;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
dateEnd = undefined;
|
|
126
|
+
}
|
|
127
|
+
return [dateStart, dateEnd];
|
|
128
|
+
}, [value, endValue]);
|
|
129
|
+
const handleChange = React.useCallback((valuesList) => {
|
|
130
|
+
const [newDateStart, newDateEnd] = valuesList;
|
|
131
|
+
onChange(newDateStart, newDateEnd);
|
|
132
|
+
}, [onChange]);
|
|
133
|
+
const renderDayContents = React.useCallback((day, date) => {
|
|
134
|
+
return (jsxRuntime.jsx(Button.Button, { className: "react-datepicker__day-button", size: daySize, label: date.getDate().toString(), labelTextColor: dayTextColor, labelTextSize: dayTextSize, shape: dayTextShape }));
|
|
135
|
+
}, [daySize, dayTextColor, dayTextShape, dayTextSize]);
|
|
136
|
+
const renderCustomHeader = React.useCallback(({ decreaseMonth, increaseMonth, monthDate, }) => (jsxRuntime.jsxs("div", { className: "react-datepicker__header--div", children: [iconLeft && (jsxRuntime.jsx(Icon.Icon, { className: "react-datepicker__icon", fill: iconFill, fillHover: iconFillHover, fillSize: iconFillSize, iconFill: iconItemFill, shape: iconShape, SvgImage: iconLeft, onClick: decreaseMonth })), jsxRuntime.jsxs("div", { className: "react-datepicker__data", children: [jsxRuntime.jsx(Text.Text, { className: "react-datepicker__month", size: monthTextSize, textColor: monthTextColor, textWeight: monthTextWeight, children: monthDate.toLocaleString('ru-RU', { month: 'long' }) }), jsxRuntime.jsx(Text.Text, { className: "react-datepicker__year", size: yearTextSize, textColor: yearTextColor, textWeight: yearTextWeight, children: monthDate.toLocaleString('ru-RU', { year: 'numeric' }) })] }), iconRight && (jsxRuntime.jsx(Icon.Icon, { className: "react-datepicker__icon", fill: iconFill, fillHover: iconFillHover, fillSize: iconFillSize, iconFill: iconItemFill, shape: iconShape, SvgImage: iconRight, onClick: increaseMonth }))] })), [
|
|
137
|
+
iconFill,
|
|
138
|
+
iconFillHover,
|
|
139
|
+
iconFillSize,
|
|
140
|
+
iconItemFill,
|
|
141
|
+
iconLeft,
|
|
142
|
+
iconRight,
|
|
143
|
+
iconShape,
|
|
144
|
+
monthTextColor,
|
|
145
|
+
monthTextSize,
|
|
146
|
+
monthTextWeight,
|
|
147
|
+
yearTextColor,
|
|
148
|
+
yearTextSize,
|
|
149
|
+
yearTextWeight,
|
|
150
|
+
]);
|
|
151
|
+
const { styles: datePickerStyles } = useStyles.useStyles(props);
|
|
152
|
+
return (jsxRuntime.jsx("div", { className: clsx(className, 'datepicker', monthsShown && 'datepicker_multiple-months', customTimeInput && 'datepicker_button', sizeClass && `datepicker_size_${sizeClass}`, widthClass && `datepicker_width_${widthClass}`), style: datePickerStyles, children: jsxRuntime.jsx(DatePicker, { minDate: disablePastDays ? new Date() : undefined, customInput: jsxRuntime.jsx(DatePickerCustomInput, { datepickerRef: datepickerRef, inputProps: inputProps, isClearable: isClearable }), endDate: selectsRange ? dateEnd : undefined, locale: locale.ru, popperClassName: popper && `react-datepicker-popper-${popper}`, popperPlacement: popperPlacement, ref: datepickerRef, renderCustomHeader: renderCustomHeader, renderDayContents: renderDayContents, selected: dateStart, startDate: dateStart, onChange: selectsRange ? handleChange : onChange, ...datePickerProps,
|
|
153
|
+
// Important for use custom clear button
|
|
154
|
+
isClearable: false }) }));
|
|
155
|
+
}
|
|
156
|
+
const DatePickerCustomInput = React.forwardRef((props, ref) => {
|
|
157
|
+
const { inputIcon, inputProps, value, isClearable } = props;
|
|
158
|
+
const multipleValue = React.useMemo(() => {
|
|
159
|
+
if (value) {
|
|
160
|
+
const twoDates = value.split(' - ');
|
|
161
|
+
return twoDates[0] === twoDates[1] ? twoDates[0] : value;
|
|
162
|
+
}
|
|
163
|
+
return '';
|
|
164
|
+
}, [value]);
|
|
165
|
+
return (jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsx(Input.Input, { ...props, ...inputProps, className: clsx(inputProps.className, 'datepicker__input'), autocomplete: "off", ref: ref, value: multipleValue }), inputIcon && jsxRuntime.jsx(DatePickerInputIcon, { ...inputProps }), isClearable && jsxRuntime.jsx(DatePickerClearButton, { ...inputProps })] }));
|
|
166
|
+
});
|
|
167
|
+
function DatePickerClearButton(props) {
|
|
168
|
+
const { clearIcon, clearIconFill, clearIconFillHover, clearIconFillSize, clearIconItemFill, clearIconItemFillHover, clearIconShape, clearIconSize, clearIconSrc, clearLabel, clearLabelTextColor, clearLabelTextColorHover, clearLabelTextSize, datepickerRef, } = props;
|
|
169
|
+
const onClick = React.useCallback((event) => {
|
|
170
|
+
datepickerRef?.current?.onClearClick(event);
|
|
171
|
+
datepickerRef?.current?.handleFocus(event);
|
|
172
|
+
}, []);
|
|
173
|
+
return (jsxRuntime.jsx(React.Fragment, { children: clearLabel ? (jsxRuntime.jsx(Label.Label, { className: clsx('react-datepicker__clear-label', 'cursor_type_pointer'), label: clearLabel, labelTextColor: clearLabelTextColor, labelTextColorHover: clearLabelTextColorHover, labelTextSize: clearLabelTextSize, onClick: onClick })) : ((clearIcon || clearIconSrc) && (jsxRuntime.jsx(Icon.Icon, { className: clsx('react-datepicker__clear-icon', 'cursor_type_pointer'), size: clearIconSize, fill: clearIconFill, fillHover: clearIconFillHover, fillSize: clearIconFillSize, iconFill: clearIconItemFill, iconFillHover: clearIconItemFillHover, imageSrc: clearIconSrc, shape: clearIconShape, SvgImage: clearIcon, onClick: onClick }))) }));
|
|
174
|
+
}
|
|
175
|
+
function DatePickerInputIcon(props) {
|
|
176
|
+
const { inputIcon, inputIconFill, inputIconFillHover, inputIconFillSize, inputIconItemFill, inputIconShape, inputIconSize, inputIconSrc, onClick, } = props;
|
|
177
|
+
return (jsxRuntime.jsx(Icon.Icon, { className: clsx('react-datepicker__input-icon', 'cursor_type_pointer'), size: inputIconSize, fill: inputIconFill, fillHover: inputIconFillHover, fillSize: inputIconFillSize, iconFill: inputIconItemFill, imageSrc: inputIconSrc, shape: inputIconShape, SvgImage: inputIcon, onClick: () => onClick && onClick() }));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
exports.DatePickerInput = DatePickerInput;
|
|
181
|
+
exports.datePickerAppearance = datePickerAppearance;
|
|
182
|
+
exports.datePickerConfig = datePickerConfig;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import React, { useMemo, useCallback, useRef } from 'react';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { ru } from 'date-fns/locale';
|
|
5
|
+
import DatePicker from 'react-datepicker';
|
|
6
|
+
import { useAppearanceConfig } from './hooks/useAppearanceConfig/useAppearanceConfig.js';
|
|
7
|
+
import { useDevicePropsGenerator } from './hooks/useDevicePropsGenerator/useDevicePropsGenerator.js';
|
|
8
|
+
import { useStyles } from './hooks/useStyles/useStyles.js';
|
|
9
|
+
import { B as Button } from './Button_es_Cn3wtv3M.js';
|
|
10
|
+
import { I as Icon } from './Icon_es_D5eiycFI.js';
|
|
11
|
+
import { I as Input } from './Input_es_BnCXATnh.js';
|
|
12
|
+
import { L as Label } from './Label_es_DCqpSw_F.js';
|
|
13
|
+
import { T as Text } from './Text_es_CnymlElo.js';
|
|
14
|
+
import { icons14 } from '@itcase/icons/default';
|
|
15
|
+
|
|
16
|
+
const datePickerSize = {
|
|
17
|
+
sizeL: {
|
|
18
|
+
size: 'l',
|
|
19
|
+
daySize: 'xs',
|
|
20
|
+
dayTextSize: 'm',
|
|
21
|
+
iconFillSize: 24,
|
|
22
|
+
iconLeft: icons14.Arrow.ChevronLeft,
|
|
23
|
+
iconRight: icons14.Arrow.ChevronRight,
|
|
24
|
+
},
|
|
25
|
+
sizeM: {
|
|
26
|
+
size: 'm',
|
|
27
|
+
daySize: 'xxl',
|
|
28
|
+
dayTextSize: 'm',
|
|
29
|
+
iconFillSize: 24,
|
|
30
|
+
iconLeft: icons14.Arrow.ChevronLeft,
|
|
31
|
+
iconRight: icons14.Arrow.ChevronRight,
|
|
32
|
+
iconSize: 14,
|
|
33
|
+
monthTextSize: 'm',
|
|
34
|
+
yearTextSize: 'm',
|
|
35
|
+
},
|
|
36
|
+
sizeS: {
|
|
37
|
+
size: 's',
|
|
38
|
+
daySize: 'xs',
|
|
39
|
+
dayTextSize: 'm',
|
|
40
|
+
iconFillSize: 24,
|
|
41
|
+
iconLeft: icons14.Arrow.ChevronLeft,
|
|
42
|
+
iconRight: icons14.Arrow.ChevronRight,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const datePickerStyle = {
|
|
47
|
+
solid: {
|
|
48
|
+
inputProps: {
|
|
49
|
+
borderColor: 'none',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
outlined: {
|
|
53
|
+
inputProps: {
|
|
54
|
+
fill: 'none',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
full: {},
|
|
58
|
+
ghost: {
|
|
59
|
+
inputProps: {
|
|
60
|
+
fill: 'none',
|
|
61
|
+
borderColor: 'none',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const datePickerAppearanceSurface = {
|
|
67
|
+
surfacePrimary: {
|
|
68
|
+
dayTextColor: 'surfaceTextPrimary',
|
|
69
|
+
dayTextShape: 'rounded',
|
|
70
|
+
iconFillHover: 'surfaceSecondary',
|
|
71
|
+
iconItemFill: 'surfaceItemPrimary',
|
|
72
|
+
iconShape: 'circular',
|
|
73
|
+
monthTextColor: 'surfaceTextPrimary',
|
|
74
|
+
monthTextWeight: 400,
|
|
75
|
+
placeholderTextColor: 'surfaceTextPrimary',
|
|
76
|
+
yearTextColor: 'surfaceTextPrimary',
|
|
77
|
+
yearTextWeight: 400,
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const datePickerAppearance = {
|
|
82
|
+
...datePickerAppearanceSurface,
|
|
83
|
+
...datePickerSize,
|
|
84
|
+
...datePickerStyle,
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const datePickerConfig = {
|
|
88
|
+
appearance: datePickerAppearance,
|
|
89
|
+
setAppearance: (appearanceConfig) => {
|
|
90
|
+
datePickerConfig.appearance = appearanceConfig;
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
function DatePickerInput(props) {
|
|
94
|
+
const { className, datePickerProps = {}, endValue, inputProps = {}, value, onChange, } = props;
|
|
95
|
+
const datepickerRef = useRef(null);
|
|
96
|
+
const { customTimeInput, disablePastDays, monthsShown, selectsRange } = datePickerProps;
|
|
97
|
+
const appearanceConfig = useAppearanceConfig(datePickerProps.appearance, datePickerConfig);
|
|
98
|
+
const propsGenerator = useDevicePropsGenerator(datePickerProps, appearanceConfig);
|
|
99
|
+
const { daySize, dayTextColor, dayTextShape, dayTextSize, iconFill, iconFillHover, iconFillSize, iconItemFill, iconLeft, iconRight, iconShape, monthTextColor, monthTextSize, monthTextWeight, popper, popperPlacement, sizeClass, widthClass, yearTextColor, yearTextSize, yearTextWeight, isClearable, } = propsGenerator;
|
|
100
|
+
const [dateStart, dateEnd] = useMemo(() => {
|
|
101
|
+
let dateStart;
|
|
102
|
+
if (value) {
|
|
103
|
+
if (typeof value === 'string') {
|
|
104
|
+
dateStart = new Date(value);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
dateStart = value;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
dateStart = undefined;
|
|
112
|
+
}
|
|
113
|
+
let dateEnd;
|
|
114
|
+
if (endValue) {
|
|
115
|
+
if (typeof endValue === 'string') {
|
|
116
|
+
dateEnd = new Date(endValue);
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
dateEnd = endValue;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
dateEnd = undefined;
|
|
124
|
+
}
|
|
125
|
+
return [dateStart, dateEnd];
|
|
126
|
+
}, [value, endValue]);
|
|
127
|
+
const handleChange = useCallback((valuesList) => {
|
|
128
|
+
const [newDateStart, newDateEnd] = valuesList;
|
|
129
|
+
onChange(newDateStart, newDateEnd);
|
|
130
|
+
}, [onChange]);
|
|
131
|
+
const renderDayContents = useCallback((day, date) => {
|
|
132
|
+
return (jsx(Button, { className: "react-datepicker__day-button", size: daySize, label: date.getDate().toString(), labelTextColor: dayTextColor, labelTextSize: dayTextSize, shape: dayTextShape }));
|
|
133
|
+
}, [daySize, dayTextColor, dayTextShape, dayTextSize]);
|
|
134
|
+
const renderCustomHeader = useCallback(({ decreaseMonth, increaseMonth, monthDate, }) => (jsxs("div", { className: "react-datepicker__header--div", children: [iconLeft && (jsx(Icon, { className: "react-datepicker__icon", fill: iconFill, fillHover: iconFillHover, fillSize: iconFillSize, iconFill: iconItemFill, shape: iconShape, SvgImage: iconLeft, onClick: decreaseMonth })), jsxs("div", { className: "react-datepicker__data", children: [jsx(Text, { className: "react-datepicker__month", size: monthTextSize, textColor: monthTextColor, textWeight: monthTextWeight, children: monthDate.toLocaleString('ru-RU', { month: 'long' }) }), jsx(Text, { className: "react-datepicker__year", size: yearTextSize, textColor: yearTextColor, textWeight: yearTextWeight, children: monthDate.toLocaleString('ru-RU', { year: 'numeric' }) })] }), iconRight && (jsx(Icon, { className: "react-datepicker__icon", fill: iconFill, fillHover: iconFillHover, fillSize: iconFillSize, iconFill: iconItemFill, shape: iconShape, SvgImage: iconRight, onClick: increaseMonth }))] })), [
|
|
135
|
+
iconFill,
|
|
136
|
+
iconFillHover,
|
|
137
|
+
iconFillSize,
|
|
138
|
+
iconItemFill,
|
|
139
|
+
iconLeft,
|
|
140
|
+
iconRight,
|
|
141
|
+
iconShape,
|
|
142
|
+
monthTextColor,
|
|
143
|
+
monthTextSize,
|
|
144
|
+
monthTextWeight,
|
|
145
|
+
yearTextColor,
|
|
146
|
+
yearTextSize,
|
|
147
|
+
yearTextWeight,
|
|
148
|
+
]);
|
|
149
|
+
const { styles: datePickerStyles } = useStyles(props);
|
|
150
|
+
return (jsx("div", { className: clsx(className, 'datepicker', monthsShown && 'datepicker_multiple-months', customTimeInput && 'datepicker_button', sizeClass && `datepicker_size_${sizeClass}`, widthClass && `datepicker_width_${widthClass}`), style: datePickerStyles, children: jsx(DatePicker, { minDate: disablePastDays ? new Date() : undefined, customInput: jsx(DatePickerCustomInput, { datepickerRef: datepickerRef, inputProps: inputProps, isClearable: isClearable }), endDate: selectsRange ? dateEnd : undefined, locale: ru, popperClassName: popper && `react-datepicker-popper-${popper}`, popperPlacement: popperPlacement, ref: datepickerRef, renderCustomHeader: renderCustomHeader, renderDayContents: renderDayContents, selected: dateStart, startDate: dateStart, onChange: selectsRange ? handleChange : onChange, ...datePickerProps,
|
|
151
|
+
// Important for use custom clear button
|
|
152
|
+
isClearable: false }) }));
|
|
153
|
+
}
|
|
154
|
+
const DatePickerCustomInput = React.forwardRef((props, ref) => {
|
|
155
|
+
const { inputIcon, inputProps, value, isClearable } = props;
|
|
156
|
+
const multipleValue = useMemo(() => {
|
|
157
|
+
if (value) {
|
|
158
|
+
const twoDates = value.split(' - ');
|
|
159
|
+
return twoDates[0] === twoDates[1] ? twoDates[0] : value;
|
|
160
|
+
}
|
|
161
|
+
return '';
|
|
162
|
+
}, [value]);
|
|
163
|
+
return (jsxs(React.Fragment, { children: [jsx(Input, { ...props, ...inputProps, className: clsx(inputProps.className, 'datepicker__input'), autocomplete: "off", ref: ref, value: multipleValue }), inputIcon && jsx(DatePickerInputIcon, { ...inputProps }), isClearable && jsx(DatePickerClearButton, { ...inputProps })] }));
|
|
164
|
+
});
|
|
165
|
+
function DatePickerClearButton(props) {
|
|
166
|
+
const { clearIcon, clearIconFill, clearIconFillHover, clearIconFillSize, clearIconItemFill, clearIconItemFillHover, clearIconShape, clearIconSize, clearIconSrc, clearLabel, clearLabelTextColor, clearLabelTextColorHover, clearLabelTextSize, datepickerRef, } = props;
|
|
167
|
+
const onClick = useCallback((event) => {
|
|
168
|
+
datepickerRef?.current?.onClearClick(event);
|
|
169
|
+
datepickerRef?.current?.handleFocus(event);
|
|
170
|
+
}, []);
|
|
171
|
+
return (jsx(React.Fragment, { children: clearLabel ? (jsx(Label, { className: clsx('react-datepicker__clear-label', 'cursor_type_pointer'), label: clearLabel, labelTextColor: clearLabelTextColor, labelTextColorHover: clearLabelTextColorHover, labelTextSize: clearLabelTextSize, onClick: onClick })) : ((clearIcon || clearIconSrc) && (jsx(Icon, { className: clsx('react-datepicker__clear-icon', 'cursor_type_pointer'), size: clearIconSize, fill: clearIconFill, fillHover: clearIconFillHover, fillSize: clearIconFillSize, iconFill: clearIconItemFill, iconFillHover: clearIconItemFillHover, imageSrc: clearIconSrc, shape: clearIconShape, SvgImage: clearIcon, onClick: onClick }))) }));
|
|
172
|
+
}
|
|
173
|
+
function DatePickerInputIcon(props) {
|
|
174
|
+
const { inputIcon, inputIconFill, inputIconFillHover, inputIconFillSize, inputIconItemFill, inputIconShape, inputIconSize, inputIconSrc, onClick, } = props;
|
|
175
|
+
return (jsx(Icon, { className: clsx('react-datepicker__input-icon', 'cursor_type_pointer'), size: inputIconSize, fill: inputIconFill, fillHover: inputIconFillHover, fillSize: inputIconFillSize, iconFill: inputIconItemFill, imageSrc: inputIconSrc, shape: inputIconShape, SvgImage: inputIcon, onClick: () => onClick && onClick() }));
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export { DatePickerInput as D, datePickerAppearance as a, datePickerConfig as d };
|