@itcase/ui 1.8.123 → 1.8.125
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_AwXEUY8j.js +161 -0
- package/dist/Avatar_es_BtlaCRc5.js +157 -0
- package/dist/{Button_cjs_Ce97psFT.js → Button_cjs_C34BU1BK.js} +46 -34
- package/dist/{Button_es_CZss7cXh.js → Button_es_DnlzLBUT.js} +46 -34
- package/dist/ChipsGroup_cjs_DfAKN5CA.js +344 -0
- package/dist/{ChipsGroup_es_ayPPUwQ7.js → ChipsGroup_es_DBKY2UyF.js} +48 -35
- package/dist/DatePicker_cjs_DfbeIL2m.js +182 -0
- package/dist/DatePicker_es_BIJNx427.js +178 -0
- package/dist/Divider_cjs_DrmV2ezS.js +105 -0
- package/dist/Divider_es_BiYozVBS.js +101 -0
- package/dist/DropdownItem_cjs_vHuzXW9M.js +211 -0
- package/dist/DropdownItem_es_DVHWWgnU.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_BVLGzj7Y.js} +170 -157
- package/dist/{Icon_es_BrwLifge.js → Icon_es_DkVkzTha.js} +170 -157
- package/dist/Image_cjs_BUM81t4Y.js +28 -0
- package/dist/Image_es_C-IjVkKX.js +26 -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_DwAmukik.js} +45 -33
- package/dist/{Label_es_SULlg9bL.js → Label_es_B2kcstsG.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 -29
- 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 -29
- 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/Button/Button.appearance.d.ts +232 -232
- package/dist/types/components/Button/Button.d.ts +4 -4
- package/dist/types/components/Button/Button.interface.d.ts +5 -5
- package/dist/types/components/Pagination/Pagination.d.ts +1 -1
- package/dist/types/components/Select/SelectContainer.d.ts +1 -1
- package/dist/types/components/Text/Text.appearance.d.ts +58 -58
- package/dist/types/components/Text/Text.interface.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
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { _ as __assign } from '../tslib.es6_es_Bwu1Cn-t.js';
|
|
2
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
2
|
import Select, { components } from 'react-select';
|
|
4
|
-
import { I as Icon, B as Badge } from '../
|
|
3
|
+
import { I as Icon, B as Badge } from '../Icon_es_DkVkzTha.js';
|
|
5
4
|
import React, { useRef, useEffect, useMemo } from 'react';
|
|
6
5
|
import clsx from 'clsx';
|
|
7
6
|
import CreatableSelect from 'react-select/creatable';
|
|
8
|
-
import { G as Group } from '../
|
|
9
|
-
import { T as Text } from '../
|
|
7
|
+
import { G as Group } from '../Group_es_BU5k8f5S.js';
|
|
8
|
+
import { T as Text } from '../Text_es_CnymlElo.js';
|
|
10
9
|
import { useAppearanceConfig } from '../hooks/useAppearanceConfig/useAppearanceConfig.js';
|
|
11
10
|
import { useDevicePropsGenerator } from '../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js';
|
|
12
11
|
import { icons12, icons16, icons14, icons24 } from '@itcase/icons/default';
|
|
13
|
-
import { L as Loader } from '../
|
|
14
|
-
import { D as Divider } from '../
|
|
12
|
+
import { L as Loader } from '../Loader_es_CmSggwbR.js';
|
|
13
|
+
import { D as Divider } from '../Divider_es_BiYozVBS.js';
|
|
15
14
|
import 'react-inlinesvg';
|
|
16
15
|
import '../hoc/urlWithAssetPrefix.js';
|
|
17
16
|
import '@itcase/common';
|
|
@@ -28,25 +27,25 @@ import 'react-responsive';
|
|
|
28
27
|
import '../utils/setViewportProperty.js';
|
|
29
28
|
import '../hooks.js';
|
|
30
29
|
import '../hooks/useStyles/styleAttributes.js';
|
|
31
|
-
import '../
|
|
30
|
+
import '../Link_es_P2b6ya7P.js';
|
|
32
31
|
import 'lodash/castArray';
|
|
33
32
|
|
|
34
33
|
// interface ClearIndicatorProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>>
|
|
35
34
|
// extends DefaultClearIndicatorProps<Option, IsMulti, Group> {}
|
|
36
35
|
// For use memo need to check "ClearIndicator" props
|
|
37
36
|
// const SelectClearIndicator = React.memo(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return (jsx(components.ClearIndicator,
|
|
37
|
+
const SelectClearIndicator = (props) => {
|
|
38
|
+
const { children } = props;
|
|
39
|
+
const { clearIcon, clearIconFill } = props.selectProps;
|
|
40
|
+
return (jsx(components.ClearIndicator, { ...props, children: clearIcon ? (jsx(Icon, { iconFill: clearIconFill, SvgImage: clearIcon })) : (children) }));
|
|
42
41
|
};
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
const SelectLoadingMessage = (props) => {
|
|
44
|
+
const { loadingMessageText, loadingMessageTextColor, loadingMessageTextSize, } = props.selectProps;
|
|
46
45
|
return (jsx(Group, { textAlign: "center", children: jsx(Text, { size: loadingMessageTextSize, textColor: loadingMessageTextColor, children: loadingMessageText }) }));
|
|
47
46
|
};
|
|
48
47
|
|
|
49
|
-
|
|
48
|
+
const selectAppearanceDefault = {
|
|
50
49
|
defaultPrimary: {
|
|
51
50
|
fill: 'surfaceSecondary',
|
|
52
51
|
fillHover: 'surfaceTertiary',
|
|
@@ -85,7 +84,7 @@ var selectAppearanceDefault = {
|
|
|
85
84
|
},
|
|
86
85
|
};
|
|
87
86
|
|
|
88
|
-
|
|
87
|
+
const selectAppearanceDisabled = {
|
|
89
88
|
disabledPrimary: {
|
|
90
89
|
elevation: 8,
|
|
91
90
|
badgeAppearance: 'accent',
|
|
@@ -115,7 +114,7 @@ var selectAppearanceDisabled = {
|
|
|
115
114
|
},
|
|
116
115
|
};
|
|
117
116
|
|
|
118
|
-
|
|
117
|
+
const selectAppearanceError = {
|
|
119
118
|
errorPrimary: {
|
|
120
119
|
fill: 'errorTertiary',
|
|
121
120
|
fillHover: 'errorTertiary',
|
|
@@ -154,7 +153,7 @@ var selectAppearanceError = {
|
|
|
154
153
|
},
|
|
155
154
|
};
|
|
156
155
|
|
|
157
|
-
|
|
156
|
+
const selectAppearanceRequire = {
|
|
158
157
|
requirePrimary: {
|
|
159
158
|
fill: 'warningTertiary',
|
|
160
159
|
fillHover: 'warningTertiary',
|
|
@@ -193,7 +192,7 @@ var selectAppearanceRequire = {
|
|
|
193
192
|
},
|
|
194
193
|
};
|
|
195
194
|
|
|
196
|
-
|
|
195
|
+
const selectAppearanceShape = {
|
|
197
196
|
rounded: {
|
|
198
197
|
shape: 'rounded',
|
|
199
198
|
},
|
|
@@ -215,7 +214,7 @@ var selectAppearanceShape = {
|
|
|
215
214
|
},
|
|
216
215
|
};
|
|
217
216
|
|
|
218
|
-
|
|
217
|
+
const selectAppearanceSize = {
|
|
219
218
|
sizeXXL: {
|
|
220
219
|
size: 'xxl',
|
|
221
220
|
textLoadingMessageAppearance: 'sizeM',
|
|
@@ -332,7 +331,7 @@ var selectAppearanceSize = {
|
|
|
332
331
|
},
|
|
333
332
|
};
|
|
334
333
|
|
|
335
|
-
|
|
334
|
+
const selectAppearanceStyle = {
|
|
336
335
|
solid: {
|
|
337
336
|
borderColor: 'none',
|
|
338
337
|
borderColorHover: 'none',
|
|
@@ -349,7 +348,7 @@ var selectAppearanceStyle = {
|
|
|
349
348
|
},
|
|
350
349
|
};
|
|
351
350
|
|
|
352
|
-
|
|
351
|
+
const selectAppearanceSuccess = {
|
|
353
352
|
successPrimary: {
|
|
354
353
|
fill: 'successTertiary',
|
|
355
354
|
fillHover: 'successTertiary',
|
|
@@ -388,169 +387,175 @@ var selectAppearanceSuccess = {
|
|
|
388
387
|
},
|
|
389
388
|
};
|
|
390
389
|
|
|
391
|
-
|
|
390
|
+
const selectAppearance = {
|
|
391
|
+
...selectAppearanceRequire,
|
|
392
|
+
...selectAppearanceDefault,
|
|
393
|
+
...selectAppearanceDisabled,
|
|
394
|
+
...selectAppearanceSuccess,
|
|
395
|
+
...selectAppearanceSize,
|
|
396
|
+
...selectAppearanceError,
|
|
397
|
+
...selectAppearanceShape,
|
|
398
|
+
...selectAppearanceStyle,
|
|
399
|
+
};
|
|
392
400
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
return (jsxs(React.Fragment, { children: [before, jsx(components.Control,
|
|
401
|
+
const SelectControl = (props) => {
|
|
402
|
+
const { before, after } = props.selectProps;
|
|
403
|
+
return (jsxs(React.Fragment, { children: [before, jsx(components.Control, { ...props, className: clsx('select__control') }), after] }));
|
|
396
404
|
};
|
|
397
405
|
|
|
398
406
|
// For use memo need to check "DropdownIndicator" props
|
|
399
407
|
// const SelectDropdownIndicator = React.memo(
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
return (jsx(components.DropdownIndicator,
|
|
408
|
+
const SelectDropdownIndicator = (props) => {
|
|
409
|
+
const { children } = props;
|
|
410
|
+
const { dropdownFillHover, dropdownIcon, dropdownIconFill, dropdownIconShape, } = props.selectProps;
|
|
411
|
+
return (jsx(components.DropdownIndicator, { ...props, children: dropdownIcon ? (jsx(Icon, { fillHover: dropdownFillHover, iconFill: dropdownIconFill, shape: dropdownIconShape, SvgImage: dropdownIcon })) : (children) }));
|
|
404
412
|
};
|
|
405
413
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
return (jsx(components.GroupHeading,
|
|
414
|
+
const SelectGroupHeading = (props) => {
|
|
415
|
+
const { groupFill, groupTextColor, groupTextSize, groupTextWeight } = props.selectProps;
|
|
416
|
+
return (jsx(components.GroupHeading, { ...props, className: clsx('select__menu-group-heading', groupFill && `fill_${groupFill}`), children: jsx(Text, { size: groupTextSize, textColor: groupTextColor, textWeight: groupTextWeight, children: props.data.label }) }));
|
|
409
417
|
};
|
|
410
418
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
return (jsxs(components.IndicatorsContainer,
|
|
419
|
+
const SelectIndicatorsContainer = (props) => {
|
|
420
|
+
const { badgeAppearance, badgeSize, badgeTextSize, showBadge, value } = props.selectProps;
|
|
421
|
+
return (jsxs(components.IndicatorsContainer, { ...props, children: [showBadge &&
|
|
414
422
|
value &&
|
|
415
423
|
// @ts-expect-error
|
|
416
|
-
|
|
424
|
+
value?.length > 0 ? (jsx(Badge, { appearance: badgeAppearance, size: badgeSize, textSize: badgeTextSize,
|
|
417
425
|
// @ts-expect-error
|
|
418
|
-
value: value.length.toString() })) : null, props.children] }))
|
|
426
|
+
value: value.length.toString() })) : null, props.children] }));
|
|
419
427
|
};
|
|
420
428
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
return (jsx(components.Input,
|
|
429
|
+
const SelectInput = (props) => {
|
|
430
|
+
const { inputCaretColor, inputTextColor, inputTextSize } = props.selectProps;
|
|
431
|
+
return (jsx(components.Input, { ...props, className: clsx(inputTextSize && `text_size_${inputTextSize}`, inputTextColor && `text-color_${inputTextColor}`, inputCaretColor && `caret-color_${inputCaretColor}`) }));
|
|
424
432
|
};
|
|
425
433
|
|
|
426
|
-
|
|
427
|
-
|
|
434
|
+
const SelectLoadingIndicator = (props) => {
|
|
435
|
+
const { loaderAppearance, isLoading } = props.selectProps;
|
|
428
436
|
return isLoading && jsx(Loader, { appearance: loaderAppearance });
|
|
429
437
|
};
|
|
430
438
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
return (jsxs(components.Menu,
|
|
439
|
+
const SelectMenu = (props) => {
|
|
440
|
+
const { elevation, menuAfter, menuBefore, menuFill, menuShape, menuShapeStrength, } = props.selectProps;
|
|
441
|
+
return (jsxs(components.Menu, { ...props, className: clsx(menuFill && `fill_${menuFill}`, menuShape && `shape_${menuShape}`, menuShapeStrength && `shape-strength_${menuShapeStrength}`, elevation && `elevation_${elevation}`), children: [menuBefore, props.selectProps.fetchingData ? (jsx("span", { className: "fetching", children: "Fetching data..." })) : (jsx(React.Fragment, { children: props.children })), menuAfter] }));
|
|
434
442
|
};
|
|
435
443
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
return (jsx(components.MultiValueContainer,
|
|
444
|
+
const SelectMultiValueContainer = (props) => {
|
|
445
|
+
const { multipleItemFill, multipleItemFillHover } = props.selectProps;
|
|
446
|
+
return (jsx(components.MultiValueContainer, { ...props, children: jsx(Group, { className: clsx('select__multi-value-item'), direction: "horizontal", alignItems: "center", fill: multipleItemFill, fillHover: multipleItemFillHover, gap: "0.5m", children: props.children }) }));
|
|
439
447
|
};
|
|
440
448
|
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
return (jsx(components.MultiValueLabel,
|
|
449
|
+
const SelectMultiValueLabel = (props) => {
|
|
450
|
+
const { multipleItemTextColor, multipleItemTextSize } = props.selectProps;
|
|
451
|
+
return (jsx(components.MultiValueLabel, { ...props, children: props.data && (jsx(Text, { size: multipleItemTextSize, textColor: multipleItemTextColor, children: props.data.label })) }));
|
|
444
452
|
};
|
|
445
453
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
return (jsx(components.MultiValueRemove,
|
|
454
|
+
const SelectMultiValueRemove = (props) => {
|
|
455
|
+
const { multipleItemIcon, multipleItemIconFill } = props.selectProps;
|
|
456
|
+
return (jsx(components.MultiValueRemove, { ...props, children: jsx(Icon, { iconFill: multipleItemIconFill, SvgImage: multipleItemIcon }) }));
|
|
449
457
|
};
|
|
450
458
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
return (jsx(components.NoOptionsMessage,
|
|
459
|
+
const SelectNoOptions = (props) => {
|
|
460
|
+
const { inputValue, noOptionsSearchText, noOptionsText, noOptionsTextColor, noOptionsTextSize, optionFill, } = props.selectProps;
|
|
461
|
+
return (jsx(components.NoOptionsMessage, { ...props, className: clsx(optionFill && `fill_${optionFill}`), children: jsx(Group, { textAlign: "center", children: jsx(Text, { size: noOptionsTextSize, textColor: noOptionsTextColor, children: inputValue && noOptionsSearchText
|
|
454
462
|
? noOptionsSearchText
|
|
455
|
-
: noOptionsText }) }) }))
|
|
463
|
+
: noOptionsText }) }) }));
|
|
456
464
|
};
|
|
457
465
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
return (jsxs(components.Option,
|
|
466
|
+
const SelectOption = (props) => {
|
|
467
|
+
const { label, isSelected } = props;
|
|
468
|
+
const { optionFillActiveDisabled, optionFillDisabled, optionTextColorDisabled, dividerDirection, dividerFill, dividerSize, menuItemSize, optionAfter, optionBefore, optionBorder, optionBorderType, optionFill, optionFillActive, optionFillActiveHover, optionFillHover, optionSelectedIcon, optionSelectedIconFillIcon, optionSelectedIconSize, optionSelectedIconSrc, optionShape, optionShapeStrength, optionTextColor, optionTextColorActive, optionTextSize, showDivider, } = props.selectProps;
|
|
469
|
+
return (jsxs(components.Option, { ...props, className: clsx('select__menu-list-item', isSelected || props.isSelected
|
|
462
470
|
? !props.isDisabled
|
|
463
|
-
? optionFillActive &&
|
|
471
|
+
? optionFillActive && `fill_active_${optionFillActive}`
|
|
464
472
|
: optionFillActiveDisabled &&
|
|
465
|
-
|
|
473
|
+
`fill_active_disabled_${optionFillActiveDisabled}`
|
|
466
474
|
: !props.isDisabled
|
|
467
|
-
? optionFill &&
|
|
468
|
-
: optionFillDisabled &&
|
|
475
|
+
? optionFill && `fill_${optionFill}`
|
|
476
|
+
: optionFillDisabled && `fill_${optionFillDisabled}`, (isSelected || props.isSelected) &&
|
|
469
477
|
!props.isDisabled &&
|
|
470
478
|
optionFillActiveHover &&
|
|
471
|
-
|
|
479
|
+
`fill_active_hover_${optionFillActiveHover}`, !isSelected &&
|
|
472
480
|
!props.isSelected &&
|
|
473
481
|
!props.isDisabled &&
|
|
474
482
|
optionFillHover &&
|
|
475
|
-
|
|
483
|
+
`fill_hover_${optionFillHover}`, isSelected && 'select__menu-list-item_state_selected', menuItemSize && `select__menu-list-item_size_${menuItemSize}`, optionBorder && `border-color_${optionBorder}`, optionBorderType && `border_type_${optionBorderType}`, optionShape && `shape_${optionShape}`, optionShapeStrength && `shape-strength_${optionShapeStrength}`), children: [optionBefore, jsx(Text, { className: "select__menu-list-item_option", size: optionTextSize, textColor: optionTextColor, textColorActive: optionTextColorActive, textColorDisabled: optionTextColorDisabled, isDisabled: props.isDisabled, isActive: props.isSelected || isSelected, children: label }), (isSelected || props.isSelected) && (jsx("div", { className: "select__menu-list-item_selected", children: jsx(Icon, { iconFill: optionSelectedIconFillIcon, iconSize: optionSelectedIconSize, imageSrc: optionSelectedIconSrc, SvgImage: optionSelectedIcon }) })), optionAfter, showDivider && (jsx(Divider, { width: "fill", direction: dividerDirection, size: dividerSize, fill: dividerFill }))] }));
|
|
476
484
|
};
|
|
477
485
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
return (jsx(components.Placeholder,
|
|
486
|
+
const SelectPlaceholder = (props) => {
|
|
487
|
+
const { placeholderTextColor, placeholderTextSize } = props.selectProps;
|
|
488
|
+
return (jsx(components.Placeholder, { ...props, children: jsx(Text, { size: placeholderTextSize, textColor: placeholderTextColor, children: props.children }) }));
|
|
481
489
|
};
|
|
482
490
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
return (jsxs(components.SingleValue,
|
|
491
|
+
const SelectSingleValue = (props) => {
|
|
492
|
+
const { data } = props;
|
|
493
|
+
const { inputTextColor, inputTextSize } = props.selectProps;
|
|
494
|
+
return (jsxs(components.SingleValue, { ...props, children: [data && data.optionBefore, jsx(Text, { size: inputTextSize, textColor: inputTextColor, children: props.children }), data && data.optionAfter] }));
|
|
487
495
|
};
|
|
488
496
|
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
return (jsxs(components.ValueContainer,
|
|
497
|
+
const SelectValueContainer = (props) => {
|
|
498
|
+
const { inputAfter, inputBefore } = props.selectProps;
|
|
499
|
+
return (jsxs(components.ValueContainer, { ...props, children: [inputBefore, props.children, inputAfter] }));
|
|
492
500
|
};
|
|
493
501
|
|
|
494
|
-
|
|
502
|
+
const selectConfig = {
|
|
495
503
|
appearance: selectAppearance,
|
|
496
|
-
setAppearance:
|
|
504
|
+
setAppearance: (appearanceConfig) => {
|
|
497
505
|
selectConfig.appearance = appearanceConfig;
|
|
498
506
|
},
|
|
499
507
|
};
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
508
|
+
const SelectContainer = React.forwardRef(function SelectContainer(props, ref) {
|
|
509
|
+
const { appearance = '', className, width, minWidth, initialValue, badgeAppearance, badgeSize, defaultValue, dividerDirection, filterOption, hideSelectedOptions, hideValueContainer, inputAfter, inputBefore, instanceId, loaderAppearance, loadingMessageText, menuAfter, menuBefore, menuIsOpen, menuItemSize, noOptionsSearchText, noOptionsText, optionAfter, optionBefore, options, placeholder, showBadge, showDivider, value, before, after, openMenuOnClick, closeMenuOnSelect, isDisabled, isClearable, isCreatable, isLoading, isMulti, isSearchable, set, onChange, onInputChange, } = props;
|
|
510
|
+
const defaultRef = useRef(null);
|
|
511
|
+
const selectRef = ref || defaultRef;
|
|
512
|
+
const SelectComponent = isCreatable
|
|
505
513
|
? CreatableSelect
|
|
506
514
|
: Select;
|
|
507
|
-
useEffect(
|
|
515
|
+
useEffect(() => {
|
|
508
516
|
// @ts-expect-error
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
var isTargetSelectContainer =
|
|
517
|
+
const onClickOutside = (event) => {
|
|
518
|
+
const isTargetSelectContainer =
|
|
512
519
|
// maybe here ".contains()"?
|
|
513
520
|
event.target.hasClass &&
|
|
514
521
|
event.target.hasClass('select_state_hide-value-container');
|
|
515
522
|
if ('current' in selectRef &&
|
|
516
523
|
selectRef.current &&
|
|
517
524
|
selectRef.current.controlRef) {
|
|
518
|
-
|
|
525
|
+
const isTargetInsideController = selectRef.current.controlRef.contains(event.target);
|
|
519
526
|
if (!isTargetSelectContainer && !isTargetInsideController) {
|
|
520
527
|
// @ts-expect-error
|
|
521
|
-
|
|
528
|
+
selectRef.current?.onInputBlur();
|
|
522
529
|
}
|
|
523
530
|
}
|
|
524
531
|
};
|
|
525
532
|
if (hideValueContainer) {
|
|
526
533
|
document.addEventListener('click', onClickOutside);
|
|
527
534
|
}
|
|
528
|
-
return
|
|
535
|
+
return () => {
|
|
529
536
|
if (hideValueContainer) {
|
|
530
537
|
document.removeEventListener('click', onClickOutside);
|
|
531
538
|
}
|
|
532
539
|
};
|
|
533
540
|
}, [hideValueContainer, selectRef]);
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
return (jsx(SelectComponent, { className: clsx(className, 'select', shapeClass && "shape_".concat(shapeClass), shapeStrengthClass && "shape-strength_".concat(shapeStrengthClass), fillClass && "fill_".concat(fillClass), fillHoverClass && "fill_hover_".concat(fillHoverClass), borderColorClass && "border-color_".concat(borderColorClass), borderColorHoverClass && "border-color_hover_".concat(borderColorHoverClass), sizeClass && "select_size_".concat(sizeClass), hideValueContainer && 'select_state_hide-value-container', set && "select_set_".concat(set), widthClass && "select_width_".concat(widthClass)), ref: selectRef, isDisabled: isDisabled, optionFillActiveDisabledClass: optionFillActiveDisabledClass, optionFillDisabled: optionFillDisabledClass, optionTextColorDisabled: optionTextColorDisabled, elevation: elevation, badgeAppearance: badgeAppearance, badgeSize: badgeSize, badgeTextSize: badgeTextSize, classNamePrefix: "select", clearIcon: clearIcon, clearIconFill: clearIconFill, components: {
|
|
553
|
-
IndicatorSeparator: function () { return null; },
|
|
541
|
+
const clearStyle = useMemo(() => new Proxy({
|
|
542
|
+
container: {
|
|
543
|
+
width: width,
|
|
544
|
+
minWidth: minWidth,
|
|
545
|
+
},
|
|
546
|
+
}, {
|
|
547
|
+
get: (target, prop) => {
|
|
548
|
+
if (prop in target) {
|
|
549
|
+
return () => target[prop];
|
|
550
|
+
}
|
|
551
|
+
return () => { };
|
|
552
|
+
},
|
|
553
|
+
}), [minWidth, width]);
|
|
554
|
+
const appearanceConfig = useAppearanceConfig(appearance, selectConfig, isDisabled);
|
|
555
|
+
const propsGenerator = useDevicePropsGenerator(props, appearanceConfig);
|
|
556
|
+
const { fillClass, fillHoverClass, borderColorClass, borderColorHoverClass, elevation, badgeTextSize, clearIcon, clearIconFill, dividerFill, dividerSize, dropdownFillHover, dropdownIcon, dropdownIconFill, dropdownIconShape, groupFillClass, groupTextColorClass, groupTextSizeClass, groupTextWeightClass, inputCaretColorClass, inputTextColorClass, inputTextSizeClass, loadingMessageTextColor, loadingMessageTextSize, menuFillClass, multipleItemFill, multipleItemFillHover, multipleItemIcon, multipleItemIconFill, multipleItemTextColorClass, multipleItemTextSizeClass, noOptionsTextColorClass, noOptionsTextSizeClass, optionBorderClass, optionBorderTypeClass, optionFillActiveClass, optionFillActiveDisabledClass, optionFillActiveHoverClass, optionFillClass, optionFillDisabledClass, optionFillHoverClass, optionSelectedIcon, optionSelectedIconFillIcon, optionSelectedIconSize, optionSelectedIconSrc, optionTextColorActiveClass, optionTextColorClass, optionTextColorDisabled, optionTextSizeClass, placeholderTextColor, placeholderTextSize, shapeClass, shapeStrengthClass, sizeClass, widthClass, } = propsGenerator;
|
|
557
|
+
return (jsx(SelectComponent, { className: clsx(className, 'select', shapeClass && `shape_${shapeClass}`, shapeStrengthClass && `shape-strength_${shapeStrengthClass}`, fillClass && `fill_${fillClass}`, fillHoverClass && `fill_hover_${fillHoverClass}`, borderColorClass && `border-color_${borderColorClass}`, borderColorHoverClass && `border-color_hover_${borderColorHoverClass}`, sizeClass && `select_size_${sizeClass}`, hideValueContainer && 'select_state_hide-value-container', set && `select_set_${set}`, widthClass && `select_width_${widthClass}`), ref: selectRef, elevation: elevation, badgeAppearance: badgeAppearance, badgeSize: badgeSize, badgeTextSize: badgeTextSize, classNamePrefix: "select", clearIcon: clearIcon, clearIconFill: clearIconFill, components: {
|
|
558
|
+
IndicatorSeparator: () => null,
|
|
554
559
|
ClearIndicator: SelectClearIndicator,
|
|
555
560
|
Control: SelectControl,
|
|
556
561
|
DropdownIndicator: SelectDropdownIndicator,
|
|
@@ -568,7 +573,7 @@ var SelectContainer = React.forwardRef(function SelectContainer(props, ref) {
|
|
|
568
573
|
Placeholder: SelectPlaceholder,
|
|
569
574
|
SingleValue: SelectSingleValue,
|
|
570
575
|
ValueContainer: SelectValueContainer,
|
|
571
|
-
}, defaultValue: defaultValue || initialValue, dividerDirection: dividerDirection, dividerFill: dividerFill, dividerSize: dividerSize, dropdownFillHover: dropdownFillHover, dropdownIcon: dropdownIcon, dropdownIconFill: dropdownIconFill, dropdownIconShape: dropdownIconShape, filterOption: filterOption, groupFill: groupFillClass, groupTextColor: groupTextColorClass, groupTextSize: groupTextSizeClass, groupTextWeight: groupTextWeightClass, hideSelectedOptions: hideSelectedOptions, inputAfter: inputAfter, inputBefore: inputBefore, inputCaretColor: inputCaretColorClass, inputShape: shapeClass, inputShapeStrength: shapeStrengthClass, inputTextColor: inputTextColorClass, inputTextSize: inputTextSizeClass, instanceId: instanceId, loaderAppearance: loaderAppearance, loadingMessageText: loadingMessageText, loadingMessageTextColor: loadingMessageTextColor, loadingMessageTextSize: loadingMessageTextSize, menuAfter: menuAfter, menuBefore: menuBefore, menuFill: menuFillClass, menuIsOpen: menuIsOpen, menuItemSize: menuItemSize, menuShape: shapeClass, menuShapeStrength: shapeStrengthClass, multipleItemFill: multipleItemFill, multipleItemFillHover: multipleItemFillHover, multipleItemIcon: multipleItemIcon, multipleItemIconFill: multipleItemIconFill, multipleItemSize: sizeClass, multipleItemTextColor: multipleItemTextColorClass, multipleItemTextSize: multipleItemTextSizeClass, noOptionBorder: optionBorderClass &&
|
|
576
|
+
}, defaultValue: defaultValue || initialValue, dividerDirection: dividerDirection, dividerFill: dividerFill, dividerSize: dividerSize, dropdownFillHover: dropdownFillHover, dropdownIcon: dropdownIcon, dropdownIconFill: dropdownIconFill, dropdownIconShape: dropdownIconShape, filterOption: filterOption, groupFill: groupFillClass, groupTextColor: groupTextColorClass, groupTextSize: groupTextSizeClass, groupTextWeight: groupTextWeightClass, hideSelectedOptions: hideSelectedOptions ?? false, inputAfter: inputAfter, inputBefore: inputBefore, inputCaretColor: inputCaretColorClass, inputShape: shapeClass, inputShapeStrength: shapeStrengthClass, inputTextColor: inputTextColorClass, inputTextSize: inputTextSizeClass, instanceId: instanceId, loaderAppearance: loaderAppearance, loadingMessageText: loadingMessageText, loadingMessageTextColor: loadingMessageTextColor, loadingMessageTextSize: loadingMessageTextSize, menuAfter: menuAfter, menuBefore: menuBefore, menuFill: menuFillClass, menuIsOpen: menuIsOpen, menuItemSize: menuItemSize, menuShape: shapeClass, menuShapeStrength: shapeStrengthClass, multipleItemFill: multipleItemFill, multipleItemFillHover: multipleItemFillHover, multipleItemIcon: multipleItemIcon, multipleItemIconFill: multipleItemIconFill, multipleItemSize: sizeClass, multipleItemTextColor: multipleItemTextColorClass, multipleItemTextSize: multipleItemTextSizeClass, noOptionBorder: optionBorderClass && `border-color_${optionBorderClass}`, noOptionBorderType: optionBorderTypeClass && `border_type_${optionBorderTypeClass}`, noOptionsFill: optionFillClass && `fill_${optionFillClass}`, noOptionsSearchText: noOptionsSearchText, noOptionsText: noOptionsText, noOptionsTextColor: noOptionsTextColorClass, noOptionsTextSize: noOptionsTextSizeClass, optionAfter: optionAfter, optionBefore: optionBefore, optionBorder: optionBorderClass, optionBorderType: optionBorderTypeClass, optionFill: optionFillClass, optionFillActive: optionFillActiveClass, optionFillActiveDisabledClass: optionFillActiveDisabledClass, optionFillActiveHover: optionFillActiveHoverClass, optionFillDisabled: optionFillDisabledClass, optionFillHover: optionFillHoverClass, options: options, optionSelectedIcon: optionSelectedIcon, optionSelectedIconFillIcon: optionSelectedIconFillIcon, optionSelectedIconSize: optionSelectedIconSize, optionSelectedIconSrc: optionSelectedIconSrc, optionShape: shapeClass, optionShapeStrength: shapeStrengthClass, optionTextColor: optionTextColorClass, optionTextColorActive: optionTextColorActiveClass, optionTextColorDisabled: optionTextColorDisabled, optionTextSize: optionTextSizeClass, placeholder: placeholder, placeholderTextColor: placeholderTextColor, placeholderTextSize: placeholderTextSize, showBadge: showBadge, showDivider: showDivider, styles: clearStyle, value: value, before: before, after: after, openMenuOnClick: openMenuOnClick, closeMenuOnSelect: closeMenuOnSelect ?? true, isDisabled: isDisabled, isClearable: isClearable ?? false, isLoading: isLoading, isMulti: isMulti, isSearchable: isSearchable ?? false, set: set, onChange: onChange, onInputChange: onInputChange }));
|
|
572
577
|
});
|
|
573
578
|
|
|
574
579
|
export { SelectContainer as Select, SelectClearIndicator, SelectControl, SelectDropdownIndicator, SelectGroupHeading, SelectIndicatorsContainer, SelectInput, SelectMenu, SelectMultiValueContainer, SelectMultiValueLabel, SelectMultiValueRemove, SelectOption, SelectPlaceholder, SelectSingleValue, SelectValueContainer, selectConfig };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs } from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const slidesMock = Array.from({ length: 10 }, (_, index) => (jsxs("div", { style: {
|
|
4
4
|
width: '100%',
|
|
5
5
|
height: 'auto',
|
|
6
6
|
justifyContent: 'center',
|
|
@@ -8,7 +8,7 @@ var slidesMock = Array.from({ length: 10 }, function (_, index) { return (jsxs("
|
|
|
8
8
|
fontSize: 24,
|
|
9
9
|
fontWeight: 'bold',
|
|
10
10
|
display: 'flex',
|
|
11
|
-
background:
|
|
12
|
-
}, children: ["Slide ", index + 1] }, index))
|
|
11
|
+
background: `hsl(${index * 60}, 70%, 80%)`,
|
|
12
|
+
}, children: ["Slide ", index + 1] }, index)));
|
|
13
13
|
|
|
14
14
|
export { slidesMock };
|
|
@@ -4,8 +4,7 @@ import clsx from 'clsx';
|
|
|
4
4
|
import { Swiper as Swiper$1, SwiperSlide } from 'swiper/react';
|
|
5
5
|
import { useDevicePropsGenerator } from '../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js';
|
|
6
6
|
import { useStyles } from '../hooks/useStyles/useStyles.js';
|
|
7
|
-
import { b as Title } from '../
|
|
8
|
-
import '../tslib.es6_es_Bwu1Cn-t.js';
|
|
7
|
+
import { b as Title } from '../Icon_es_DkVkzTha.js';
|
|
9
8
|
import 'lodash/camelCase';
|
|
10
9
|
import 'lodash/castArray';
|
|
11
10
|
import 'lodash/upperFirst';
|
|
@@ -23,18 +22,18 @@ import 'react-inlinesvg';
|
|
|
23
22
|
import '../hoc/urlWithAssetPrefix.js';
|
|
24
23
|
import '../context/UrlAssetPrefix.js';
|
|
25
24
|
import '../hooks/useAppearanceConfig/useAppearanceConfig.js';
|
|
26
|
-
import '../
|
|
27
|
-
import '../
|
|
25
|
+
import '../Link_es_P2b6ya7P.js';
|
|
26
|
+
import '../Text_es_CnymlElo.js';
|
|
28
27
|
|
|
29
28
|
function Swiper(props) {
|
|
30
|
-
|
|
31
|
-
freeMode
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
const { id, className, direction, title, titleAfter, titleSize, titleTextColor, titleWeight, setNextBtnDisabled, setPrevBtnDisabled, activeSlideIndex = 0, allowTouchMove, autoHeight, breakpoints, forwardedRef, // https://github.com/vercel/next.js/issues/4957
|
|
30
|
+
freeMode, items, keyboard, loop, modules, mousewheel, nextButton, normalizeSlideIndex, pagination, prevButton, preventClicks, preventClicksPropagation, set, simulateTouch, slidesPerView, spaceBetween, speed, swiperClass, swiperSlideClass, isChangeOnClickSlide, isInit, isNavigation = false, isScrollbar, onSlideNextTransitionEnd, onSlidePrevTransitionEnd, onSwiper, onUpdate, children, } = props;
|
|
31
|
+
const swiperRef = useRef(null);
|
|
32
|
+
const isMountedRef = useRef(false);
|
|
33
|
+
const [nextEl, nextRef] = useSwiperRef();
|
|
34
|
+
const [prevEl, prevRef] = useSwiperRef();
|
|
35
|
+
const isLoop = loop ?? true;
|
|
36
|
+
const onInitSwiper = useCallback((swiper) => {
|
|
38
37
|
// swiper.touchEventsData.formElements = 'undefined'
|
|
39
38
|
// Set "disabled" state to navigation buttons on init
|
|
40
39
|
if (!isLoop && setPrevBtnDisabled && setNextBtnDisabled) {
|
|
@@ -42,13 +41,13 @@ function Swiper(props) {
|
|
|
42
41
|
setNextBtnDisabled(swiper.isEnd);
|
|
43
42
|
}
|
|
44
43
|
}, [isLoop, setPrevBtnDisabled, setNextBtnDisabled]);
|
|
45
|
-
|
|
44
|
+
const onSlideChange = useCallback((swiper) => {
|
|
46
45
|
// Some things with clickedIndex
|
|
47
46
|
if (isChangeOnClickSlide) {
|
|
48
47
|
swiper.activeIndex = activeSlideIndex || swiper.clickedIndex;
|
|
49
48
|
}
|
|
50
49
|
}, [isChangeOnClickSlide, activeSlideIndex]);
|
|
51
|
-
|
|
50
|
+
const onTransitionStart = useCallback((swiper) => {
|
|
52
51
|
// Set "disabled" state to navigation buttons, when slider move
|
|
53
52
|
if (!isLoop && setPrevBtnDisabled && setNextBtnDisabled) {
|
|
54
53
|
setPrevBtnDisabled(swiper.isBeginning);
|
|
@@ -56,31 +55,30 @@ function Swiper(props) {
|
|
|
56
55
|
}
|
|
57
56
|
}, [isLoop, setPrevBtnDisabled, setNextBtnDisabled]);
|
|
58
57
|
// @ts-expect-error
|
|
59
|
-
useImperativeHandle(forwardedRef,
|
|
60
|
-
useEffect(
|
|
61
|
-
var _a;
|
|
58
|
+
useImperativeHandle(forwardedRef, () => swiperRef.current, []);
|
|
59
|
+
useEffect(() => {
|
|
62
60
|
if (isMountedRef.current) {
|
|
63
|
-
|
|
61
|
+
const swiperInstance = swiperRef.current?.swiper;
|
|
64
62
|
// @ts-expect-error
|
|
65
|
-
swiperInstance
|
|
66
|
-
swiperInstance
|
|
63
|
+
swiperInstance?.updateActiveIndex(activeSlideIndex);
|
|
64
|
+
swiperInstance?.updateSlidesClasses();
|
|
67
65
|
}
|
|
68
66
|
else {
|
|
69
67
|
isMountedRef.current = true;
|
|
70
68
|
}
|
|
71
69
|
}, [activeSlideIndex]);
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
const propsGenerator = useDevicePropsGenerator(props);
|
|
71
|
+
const { alignClass, alignDirectionClass, fillClass, shapeClass } = propsGenerator;
|
|
74
72
|
// @ts-expect-error
|
|
75
|
-
|
|
76
|
-
return (jsxs("div", { id: id, className: clsx('swiper-block', slidesPerView === 'auto' && 'swiper-block_type_auto', fillClass &&
|
|
77
|
-
|
|
73
|
+
const { styles: style } = useStyles(props);
|
|
74
|
+
return (jsxs("div", { id: id, className: clsx('swiper-block', slidesPerView === 'auto' && 'swiper-block_type_auto', fillClass && `fill_${fillClass}`, shapeClass && `swiper_shape_${shapeClass}`, className, set && `swiper-block_set_${set}`), style: style, children: [(title || (prevButton && nextButton)) && (jsxs("div", { className: "swiper-block__wrapper", children: [title && (jsx(Title, { className: "swiper-block__title", size: titleSize, textColor: titleTextColor, textWeight: titleWeight, children: title })), titleAfter, prevButton && nextButton && (jsxs("div", { className: "swiper-block__navigation", children: [jsx("div", { className: "swiper-block__prev swiper-button", ref: prevRef, children: prevButton }), jsx("div", { className: "swiper-block__next swiper-button", ref: nextRef, children: nextButton })] }))] })), jsx(Swiper$1, { className: clsx('swiper-block__swiper', swiperClass), ref: swiperRef, direction: direction, allowTouchMove: allowTouchMove, autoHeight: autoHeight ?? false, breakpoints: breakpoints, centeredSlides: true, freeMode: freeMode, init: isInit ?? true, keyboard: keyboard, loop: isLoop, modules: modules, mousewheel: mousewheel, navigation: isNavigation ? { nextEl, prevEl } : false, normalizeSlideIndex: normalizeSlideIndex, pagination: pagination, preventClicks: preventClicks, preventClicksPropagation: preventClicksPropagation, scrollbar: isScrollbar, simulateTouch: simulateTouch, slidesPerView: slidesPerView, spaceBetween: spaceBetween, speed: speed ?? 500, onInit: onInitSwiper, onSlideChange: onSlideChange, onSlideNextTransitionEnd: onSlideNextTransitionEnd, onSlidePrevTransitionEnd: onSlidePrevTransitionEnd, onSwiper: onSwiper, onTransitionStart: onTransitionStart, onUpdate: onUpdate, children: children ||
|
|
75
|
+
items?.map((item, i) => (jsx(SwiperSlide, { className: clsx('swiper-block__item', swiperSlideClass, alignDirectionClass && `align_${alignDirectionClass}`, alignClass && `align_${alignClass}`), children: item }, `swiper-slide_${i}`))) })] }));
|
|
78
76
|
}
|
|
79
77
|
// https://github.com/nolimits4web/swiper/issues/3855#issuecomment-1050694342
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
useEffect(
|
|
78
|
+
const useSwiperRef = () => {
|
|
79
|
+
const [wrapper, setWrapper] = useState(null);
|
|
80
|
+
const ref = useRef(null);
|
|
81
|
+
useEffect(() => {
|
|
84
82
|
if (ref.current) {
|
|
85
83
|
setWrapper(ref.current);
|
|
86
84
|
}
|