@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,4 +1,3 @@
|
|
|
1
|
-
import { _ as __assign } from './tslib.es6_es_Bwu1Cn-t.js';
|
|
2
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
2
|
import React, { useMemo, useRef, useState, useCallback, useImperativeHandle } from 'react';
|
|
4
3
|
import clsx from 'clsx';
|
|
@@ -7,10 +6,10 @@ import { urlWithAssetPrefix } from './hoc/urlWithAssetPrefix.js';
|
|
|
7
6
|
import { useAppearanceConfig } from './hooks/useAppearanceConfig/useAppearanceConfig.js';
|
|
8
7
|
import { useDevicePropsGenerator } from './hooks/useDevicePropsGenerator/useDevicePropsGenerator.js';
|
|
9
8
|
import { useStyles } from './hooks/useStyles/useStyles.js';
|
|
10
|
-
import { a as LinkWrapper } from './
|
|
11
|
-
import { T as Text } from './
|
|
9
|
+
import { a as LinkWrapper } from './Link_es_P2b6ya7P.js';
|
|
10
|
+
import { T as Text } from './Text_es_CnymlElo.js';
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
const badgeAppearanceAccent = {
|
|
14
13
|
accent: {
|
|
15
14
|
fill: 'accentPrimary',
|
|
16
15
|
borderColor: 'accentBorderQuaternary',
|
|
@@ -48,7 +47,7 @@ var badgeAppearanceAccent = {
|
|
|
48
47
|
},
|
|
49
48
|
};
|
|
50
49
|
|
|
51
|
-
|
|
50
|
+
const badgeAppearanceDanger = {
|
|
52
51
|
danger: {
|
|
53
52
|
fill: 'dangerPrimary',
|
|
54
53
|
borderColor: 'dangerBorderPrimary',
|
|
@@ -65,7 +64,7 @@ var badgeAppearanceDanger = {
|
|
|
65
64
|
},
|
|
66
65
|
};
|
|
67
66
|
|
|
68
|
-
|
|
67
|
+
const badgeAppearanceDisabled = {
|
|
69
68
|
disabled: {
|
|
70
69
|
fill: 'surfaceDisabled',
|
|
71
70
|
borderColor: 'surfaceBorderDisabled',
|
|
@@ -80,7 +79,7 @@ var badgeAppearanceDisabled = {
|
|
|
80
79
|
},
|
|
81
80
|
};
|
|
82
81
|
|
|
83
|
-
|
|
82
|
+
const badgeAppearanceError = {
|
|
84
83
|
error: {
|
|
85
84
|
fill: 'errorPrimary',
|
|
86
85
|
fillHover: 'errorPrimaryHover',
|
|
@@ -97,7 +96,7 @@ var badgeAppearanceError = {
|
|
|
97
96
|
},
|
|
98
97
|
};
|
|
99
98
|
|
|
100
|
-
|
|
99
|
+
const badgeAppearanceInfo = {
|
|
101
100
|
infoPrimary: {
|
|
102
101
|
fill: 'infoPrimary',
|
|
103
102
|
borderColor: 'infoBorderSecondary',
|
|
@@ -113,7 +112,7 @@ var badgeAppearanceInfo = {
|
|
|
113
112
|
},
|
|
114
113
|
};
|
|
115
114
|
|
|
116
|
-
|
|
115
|
+
const badgeAppearancePrimary = {
|
|
117
116
|
primary: {
|
|
118
117
|
fill: 'primaryPrimary',
|
|
119
118
|
borderColor: 'primaryBorderSecondary',
|
|
@@ -130,7 +129,7 @@ var badgeAppearancePrimary = {
|
|
|
130
129
|
},
|
|
131
130
|
};
|
|
132
131
|
|
|
133
|
-
|
|
132
|
+
const badgeAppearanceSecondary = {
|
|
134
133
|
secondary: {
|
|
135
134
|
fill: 'secondaryPrimary',
|
|
136
135
|
borderColor: 'secondaryBorderSecondary',
|
|
@@ -147,7 +146,7 @@ var badgeAppearanceSecondary = {
|
|
|
147
146
|
},
|
|
148
147
|
};
|
|
149
148
|
|
|
150
|
-
|
|
149
|
+
const badgeAppearanceShape = {
|
|
151
150
|
circular: {
|
|
152
151
|
shape: 'circular',
|
|
153
152
|
},
|
|
@@ -172,7 +171,7 @@ var badgeAppearanceShape = {
|
|
|
172
171
|
},
|
|
173
172
|
};
|
|
174
173
|
|
|
175
|
-
|
|
174
|
+
const badgeAppearanceSize = {
|
|
176
175
|
sizeXXL: {
|
|
177
176
|
size: 'xxl',
|
|
178
177
|
textSize: 'xl',
|
|
@@ -210,7 +209,7 @@ var badgeAppearanceSize = {
|
|
|
210
209
|
},
|
|
211
210
|
};
|
|
212
211
|
|
|
213
|
-
|
|
212
|
+
const badgeAppearanceStyle = {
|
|
214
213
|
solid: {
|
|
215
214
|
borderColor: 'none',
|
|
216
215
|
},
|
|
@@ -224,7 +223,7 @@ var badgeAppearanceStyle = {
|
|
|
224
223
|
},
|
|
225
224
|
};
|
|
226
225
|
|
|
227
|
-
|
|
226
|
+
const badgeAppearanceSuccess = {
|
|
228
227
|
success: {
|
|
229
228
|
fill: 'successPrimary',
|
|
230
229
|
borderColor: 'successBorderPrimary',
|
|
@@ -241,7 +240,7 @@ var badgeAppearanceSuccess = {
|
|
|
241
240
|
},
|
|
242
241
|
};
|
|
243
242
|
|
|
244
|
-
|
|
243
|
+
const badgeAppearanceSurface = {
|
|
245
244
|
surfacePrimary: {
|
|
246
245
|
fill: 'surfacePrimary',
|
|
247
246
|
borderColor: 'surfaceBorderTertiary',
|
|
@@ -266,7 +265,7 @@ var badgeAppearanceSurface = {
|
|
|
266
265
|
},
|
|
267
266
|
};
|
|
268
267
|
|
|
269
|
-
|
|
268
|
+
const badgeAppearanceWarning = {
|
|
270
269
|
warning: {
|
|
271
270
|
fill: 'warningPrimary',
|
|
272
271
|
borderColor: 'warningBorderPrimary',
|
|
@@ -283,22 +282,36 @@ var badgeAppearanceWarning = {
|
|
|
283
282
|
},
|
|
284
283
|
};
|
|
285
284
|
|
|
286
|
-
|
|
285
|
+
const badgeAppearance = {
|
|
286
|
+
...badgeAppearanceSize,
|
|
287
|
+
...badgeAppearanceShape,
|
|
288
|
+
...badgeAppearanceStyle,
|
|
289
|
+
...badgeAppearanceAccent,
|
|
290
|
+
...badgeAppearanceDanger,
|
|
291
|
+
...badgeAppearanceError,
|
|
292
|
+
...badgeAppearanceInfo,
|
|
293
|
+
...badgeAppearancePrimary,
|
|
294
|
+
...badgeAppearanceSecondary,
|
|
295
|
+
...badgeAppearanceSuccess,
|
|
296
|
+
...badgeAppearanceDisabled,
|
|
297
|
+
...badgeAppearanceSurface,
|
|
298
|
+
...badgeAppearanceWarning,
|
|
299
|
+
};
|
|
287
300
|
|
|
288
|
-
|
|
301
|
+
const badgeConfig = {
|
|
289
302
|
appearance: badgeAppearance,
|
|
290
|
-
setAppearance:
|
|
303
|
+
setAppearance: (appearanceConfig) => {
|
|
291
304
|
badgeConfig.appearance = appearanceConfig;
|
|
292
305
|
},
|
|
293
306
|
};
|
|
294
307
|
function Badge(props) {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
308
|
+
const { className, appearance, dot, icon, iconSrc, value, isSkeleton, children, } = props;
|
|
309
|
+
const appearanceConfig = useAppearanceConfig(appearance, badgeConfig);
|
|
310
|
+
const propsGenerator = useDevicePropsGenerator(props, appearanceConfig);
|
|
311
|
+
const { fillClass, fillHoverClass, borderColorClass, borderColorHoverClass, borderTypeClass, borderWidthClass, textColor, textSize, dotFillClass, iconFill, iconShape, iconSize, shapeClass, shapeStrengthClass, sizeClass, } = propsGenerator;
|
|
299
312
|
// @ts-expect-error
|
|
300
|
-
|
|
301
|
-
|
|
313
|
+
const { styles: badgeStyles } = useStyles(props);
|
|
314
|
+
const badgeTypeClass = value
|
|
302
315
|
? icon
|
|
303
316
|
? dot
|
|
304
317
|
? 'badge_type_dot-icon-counter'
|
|
@@ -309,11 +322,11 @@ function Badge(props) {
|
|
|
309
322
|
: dot
|
|
310
323
|
? 'badge_type_dot'
|
|
311
324
|
: 'badge_type_fill';
|
|
312
|
-
return (jsxs("div", { className: clsx(className, 'badge', borderColorClass &&
|
|
325
|
+
return (jsxs("div", { className: clsx(className, 'badge', borderColorClass && `border-color_${borderColorClass}`, borderColorHoverClass && `border-color_hover_${borderColorHoverClass}`, borderWidthClass && `border-width_${borderWidthClass}`, borderTypeClass && `border_type_${borderTypeClass}`, fillClass && `fill_${fillClass}`, fillHoverClass && `fill_hover_${fillHoverClass}`, sizeClass && `badge_size_${sizeClass}`, shapeClass && `shape_${shapeClass}`, shapeStrengthClass && `shape-strength_${shapeStrengthClass}`, badgeTypeClass, isSkeleton && 'badge_skeleton'), style: badgeStyles, children: [dot && (jsx("div", { className: clsx('badge__dot', dotFillClass && `svg_fill_${dotFillClass}`), children: jsx("svg", { width: "6", height: "6", viewBox: "0 0 6 6", xmlns: "http://www.w3.org/2000/svg", children: jsx("rect", { width: "6", height: "6", rx: "50" }) }) })), icon && (jsx(Icon, { className: "badge__icon", size: iconSize, iconFill: iconFill, imageSrc: iconSrc, shape: iconShape, SvgImage: icon })), children ||
|
|
313
326
|
(value && (jsx(Text, { className: "badge__value", size: textSize, textColor: textColor, children: value })))] }));
|
|
314
327
|
}
|
|
315
328
|
|
|
316
|
-
|
|
329
|
+
const titleAppearanceAccent = {
|
|
317
330
|
accent: {
|
|
318
331
|
fill: 'accentPrimary',
|
|
319
332
|
fillHover: 'accentHoverPrimary',
|
|
@@ -328,14 +341,14 @@ var titleAppearanceAccent = {
|
|
|
328
341
|
},
|
|
329
342
|
};
|
|
330
343
|
|
|
331
|
-
|
|
344
|
+
const titleAppearanceDanger = {
|
|
332
345
|
danger: {
|
|
333
346
|
fill: 'dangerPrimary',
|
|
334
347
|
fillHover: 'dangerPrimaryHover',
|
|
335
348
|
},
|
|
336
349
|
};
|
|
337
350
|
|
|
338
|
-
|
|
351
|
+
const titleAppearanceDisabled = {
|
|
339
352
|
disabledPrimary: {
|
|
340
353
|
fill: 'surfaceFillDisabled',
|
|
341
354
|
borderColor: 'errorBorderQuaternary',
|
|
@@ -355,7 +368,7 @@ var titleAppearanceDisabled = {
|
|
|
355
368
|
},
|
|
356
369
|
};
|
|
357
370
|
|
|
358
|
-
|
|
371
|
+
const titleAppearanceError = {
|
|
359
372
|
error: {
|
|
360
373
|
fill: 'errorPrimary',
|
|
361
374
|
fillHover: 'errorPrimaryHover',
|
|
@@ -364,7 +377,7 @@ var titleAppearanceError = {
|
|
|
364
377
|
},
|
|
365
378
|
};
|
|
366
379
|
|
|
367
|
-
|
|
380
|
+
const titleAppearanceInfo = {
|
|
368
381
|
info: {
|
|
369
382
|
fill: 'accentPrimary',
|
|
370
383
|
fillHover: 'accentPrimaryHover',
|
|
@@ -375,14 +388,14 @@ var titleAppearanceInfo = {
|
|
|
375
388
|
},
|
|
376
389
|
};
|
|
377
390
|
|
|
378
|
-
|
|
391
|
+
const titleAppearancePrimary = {
|
|
379
392
|
primary: {
|
|
380
393
|
fill: 'primaryPrimary',
|
|
381
394
|
fillHover: 'primaryPrimaryHover',
|
|
382
395
|
},
|
|
383
396
|
};
|
|
384
397
|
|
|
385
|
-
|
|
398
|
+
const titleAppearanceRequire = {
|
|
386
399
|
requirePrimary: {
|
|
387
400
|
fill: 'warningTertiary',
|
|
388
401
|
borderColor: 'warningBorderQuaternary',
|
|
@@ -402,7 +415,7 @@ var titleAppearanceRequire = {
|
|
|
402
415
|
},
|
|
403
416
|
};
|
|
404
417
|
|
|
405
|
-
|
|
418
|
+
const titleAppearanceSecondary = {
|
|
406
419
|
secondary: {
|
|
407
420
|
fill: 'secondaryPrimary',
|
|
408
421
|
fillHover: 'secondaryPrimaryHover',
|
|
@@ -410,7 +423,7 @@ var titleAppearanceSecondary = {
|
|
|
410
423
|
},
|
|
411
424
|
};
|
|
412
425
|
|
|
413
|
-
|
|
426
|
+
const titleAppearanceSize = {
|
|
414
427
|
h1: {
|
|
415
428
|
size: 'h1',
|
|
416
429
|
iconAfterFillSize: '24',
|
|
@@ -455,7 +468,7 @@ var titleAppearanceSize = {
|
|
|
455
468
|
},
|
|
456
469
|
};
|
|
457
470
|
|
|
458
|
-
|
|
471
|
+
const titleAppearanceStyle = {
|
|
459
472
|
solid: {},
|
|
460
473
|
outlined: {
|
|
461
474
|
fill: 'none',
|
|
@@ -466,14 +479,14 @@ var titleAppearanceStyle = {
|
|
|
466
479
|
},
|
|
467
480
|
};
|
|
468
481
|
|
|
469
|
-
|
|
482
|
+
const titleAppearanceSuccess = {
|
|
470
483
|
success: {
|
|
471
484
|
fill: 'successPrimary',
|
|
472
485
|
fillHover: 'successPrimaryHover',
|
|
473
486
|
},
|
|
474
487
|
};
|
|
475
488
|
|
|
476
|
-
|
|
489
|
+
const titleAppearanceSurface = {
|
|
477
490
|
surfacePrimary: {
|
|
478
491
|
fill: 'surfacePrimary',
|
|
479
492
|
fillHover: 'surfacePrimaryHover',
|
|
@@ -492,7 +505,7 @@ var titleAppearanceSurface = {
|
|
|
492
505
|
},
|
|
493
506
|
};
|
|
494
507
|
|
|
495
|
-
|
|
508
|
+
const titleAppearanceWarning = {
|
|
496
509
|
warning: {
|
|
497
510
|
fill: 'warningPrimary',
|
|
498
511
|
fillHover: 'warningPrimaryHover',
|
|
@@ -501,46 +514,60 @@ var titleAppearanceWarning = {
|
|
|
501
514
|
},
|
|
502
515
|
};
|
|
503
516
|
|
|
504
|
-
|
|
517
|
+
const titleAppearance = {
|
|
518
|
+
...titleAppearanceSize,
|
|
519
|
+
...titleAppearanceDisabled,
|
|
520
|
+
...titleAppearanceRequire,
|
|
521
|
+
...titleAppearanceStyle,
|
|
522
|
+
...titleAppearanceAccent,
|
|
523
|
+
...titleAppearanceDanger,
|
|
524
|
+
...titleAppearanceError,
|
|
525
|
+
...titleAppearanceInfo,
|
|
526
|
+
...titleAppearancePrimary,
|
|
527
|
+
...titleAppearanceSecondary,
|
|
528
|
+
...titleAppearanceSuccess,
|
|
529
|
+
...titleAppearanceSurface,
|
|
530
|
+
...titleAppearanceWarning,
|
|
531
|
+
};
|
|
505
532
|
|
|
506
|
-
|
|
533
|
+
const titleConfig = {
|
|
507
534
|
appearance: titleAppearance,
|
|
508
|
-
setAppearance:
|
|
535
|
+
setAppearance: (appearanceConfig) => {
|
|
509
536
|
titleConfig.appearance = appearanceConfig;
|
|
510
537
|
},
|
|
511
538
|
};
|
|
512
539
|
function Title(props) {
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
540
|
+
const { dataTestId, dataTour, className, appearance, isDisabled, text, afterWrapper, beforeWrapper, tag = 'span', before, after, isActive, isSkeleton, onClick, children, } = props;
|
|
541
|
+
const appearanceConfig = useAppearanceConfig(appearance, titleConfig, isDisabled);
|
|
542
|
+
const propsGenerator = useDevicePropsGenerator(props, appearanceConfig);
|
|
543
|
+
const { directionClass, size, fillClass, fillHoverClass, textColorDisabledClass, textAlignClass, textColorActiveClass, textColorActiveHoverClass, textColorClass, textColorHoverClass, textStyleClass, textTruncateClass, textWeightClass, textWrap, heightClass, iconAfter, iconAfterFill, iconAfterFillIcon, iconAfterFillSize, iconAfterShape, iconAfterSize, iconAfterSrc, iconBadgeAppearance, iconBadgeShape, iconBadgeSize, iconBadgeTextColor, iconBadgeTextSize, iconBadgeValue, iconBefore, iconBeforeFill, iconBeforeFillIcon, iconBeforeFillSize, iconBeforeShape, iconBeforeSize, iconBeforeSrc, svgFillClass, svgFillHoverClass, widthClass, wrapperDirectionClass, } = propsGenerator;
|
|
517
544
|
// @ts-expect-error
|
|
518
|
-
|
|
545
|
+
const { styles: titleStyles, wrapper: titleWrapperStyles } = useStyles(props);
|
|
519
546
|
// Element type (h1, h2, ..., h6)
|
|
520
|
-
|
|
547
|
+
const Tag = useMemo(() => {
|
|
521
548
|
if (tag) {
|
|
522
549
|
return tag;
|
|
523
550
|
}
|
|
524
551
|
return size ? size : 'span';
|
|
525
552
|
}, [tag, size]);
|
|
526
|
-
return (jsxs(Tag, { className: clsx(className, 'title', fillClass &&
|
|
553
|
+
return (jsxs(Tag, { className: clsx(className, 'title', fillClass && `fill_${fillClass}`, fillHoverClass && `fill_hover_${fillClass}`, svgFillClass && `svg_fill_${svgFillClass}`, svgFillHoverClass && `svg_fill_hover_${svgFillHoverClass}`, widthClass && `width_${widthClass}`, heightClass && `height_${heightClass}`, size && `title_size_${size}`, directionClass && `title_direction_${directionClass}`, isDisabled &&
|
|
527
554
|
textColorDisabledClass &&
|
|
528
|
-
|
|
555
|
+
`text-color_${textColorDisabledClass}`, !isActive &&
|
|
529
556
|
!isDisabled &&
|
|
530
557
|
textColorClass &&
|
|
531
|
-
|
|
558
|
+
`text-color_${textColorClass}`, isActive &&
|
|
532
559
|
!isDisabled &&
|
|
533
560
|
textColorActiveClass &&
|
|
534
|
-
|
|
561
|
+
`text-color_active_${textColorActiveClass}`, !isActive &&
|
|
535
562
|
!isDisabled &&
|
|
536
563
|
textColorHoverClass &&
|
|
537
|
-
|
|
564
|
+
`text-color_hover_${textColorHoverClass}`, isActive &&
|
|
538
565
|
!isDisabled &&
|
|
539
566
|
textColorActiveHoverClass &&
|
|
540
|
-
|
|
567
|
+
`text-color_active_hover${textColorActiveHoverClass}`, textStyleClass && `text-style_${textStyleClass}`, textWeightClass && `text-weight_${textWeightClass}`, textWrap && `word-wrap_${textWrap}`, iconBadgeValue && 'title_badge', isSkeleton && 'title_skeleton'), "data-test-id": dataTestId, "data-tour": dataTour, style: titleStyles, onClick: onClick, children: [before, jsxs("span", { className: clsx(textAlignClass && `text-align_${textAlignClass}`, wrapperDirectionClass && `title_direction_${wrapperDirectionClass}`, 'title__wrapper', textTruncateClass && `text-truncate_${textTruncateClass}`), style: titleWrapperStyles, children: [(iconBefore || iconBeforeSrc) && (jsx(Icon, { className: clsx('title__icon_before', iconBadgeValue && 'title__icon_before-badge'), fill: iconBeforeFill, fillSize: iconBeforeFillSize, badgeAppearance: iconBadgeAppearance, badgeClass: 'title__icon_before_badge', badgeShape: iconBadgeShape, badgeSize: iconBadgeSize, badgeTextColor: iconBadgeTextColor, badgeTextSize: iconBadgeTextSize, badgeValue: iconBadgeValue, iconFill: iconBeforeFillIcon, iconSize: iconBeforeSize, imageSrc: iconBeforeSrc, shape: iconBeforeShape, SvgImage: iconBefore })), beforeWrapper, children || text, afterWrapper, (iconAfter || iconAfterSrc) && (jsx(Icon, { className: clsx('title__icon_after', iconBadgeValue && 'title__icon_after-badge'), fill: iconAfterFill, fillSize: iconAfterFillSize, badgeAppearance: iconBadgeAppearance, badgeClass: 'title__icon_after_badge', badgeShape: iconBadgeShape, badgeSize: iconBadgeSize, badgeTextColor: iconBadgeTextColor, badgeTextSize: iconBadgeTextSize, badgeValue: iconBadgeValue, iconFill: iconAfterFillIcon, iconSize: iconAfterSize, imageSrc: iconAfterSrc, shape: iconAfterShape, SvgImage: iconAfter }))] }), after] }));
|
|
541
568
|
}
|
|
542
569
|
|
|
543
|
-
|
|
570
|
+
const tooltipAppearanceDefault = {
|
|
544
571
|
defaultPrimary: {
|
|
545
572
|
fill: 'surfacePrimary',
|
|
546
573
|
fillHover: 'surfaceHoverPrimary',
|
|
@@ -550,7 +577,7 @@ var tooltipAppearanceDefault = {
|
|
|
550
577
|
},
|
|
551
578
|
};
|
|
552
579
|
|
|
553
|
-
|
|
580
|
+
const tooltipAppearanceDisabled = {
|
|
554
581
|
disabledPrimary: {
|
|
555
582
|
fill: 'disabledPrimary',
|
|
556
583
|
fillHover: 'disabledHoverPrimary',
|
|
@@ -559,7 +586,7 @@ var tooltipAppearanceDisabled = {
|
|
|
559
586
|
},
|
|
560
587
|
};
|
|
561
588
|
|
|
562
|
-
|
|
589
|
+
const tooltipAppearanceError = {
|
|
563
590
|
errorPrimary: {
|
|
564
591
|
fill: 'errorPrimary',
|
|
565
592
|
fillHover: 'errorHoverPrimary',
|
|
@@ -569,7 +596,7 @@ var tooltipAppearanceError = {
|
|
|
569
596
|
},
|
|
570
597
|
};
|
|
571
598
|
|
|
572
|
-
|
|
599
|
+
const tooltipAppearanceRequire = {
|
|
573
600
|
requirePrimary: {
|
|
574
601
|
fill: 'warningPrimary',
|
|
575
602
|
fillHover: 'warningHoverPrimary',
|
|
@@ -579,7 +606,7 @@ var tooltipAppearanceRequire = {
|
|
|
579
606
|
},
|
|
580
607
|
};
|
|
581
608
|
|
|
582
|
-
|
|
609
|
+
const tooltipAppearanceSize = {
|
|
583
610
|
sizeL: {
|
|
584
611
|
size: 'l',
|
|
585
612
|
titleSize: 'h5',
|
|
@@ -597,7 +624,7 @@ var tooltipAppearanceSize = {
|
|
|
597
624
|
},
|
|
598
625
|
};
|
|
599
626
|
|
|
600
|
-
|
|
627
|
+
const tooltipAppearanceStyle = {
|
|
601
628
|
solid: {
|
|
602
629
|
borderColor: 'none',
|
|
603
630
|
},
|
|
@@ -611,7 +638,7 @@ var tooltipAppearanceStyle = {
|
|
|
611
638
|
},
|
|
612
639
|
};
|
|
613
640
|
|
|
614
|
-
|
|
641
|
+
const tooltipAppearanceSuccess = {
|
|
615
642
|
successPrimary: {
|
|
616
643
|
fill: 'successPrimary',
|
|
617
644
|
fillHover: 'successHoverPrimary',
|
|
@@ -621,43 +648,51 @@ var tooltipAppearanceSuccess = {
|
|
|
621
648
|
},
|
|
622
649
|
};
|
|
623
650
|
|
|
624
|
-
|
|
651
|
+
const tooltipAppearance = {
|
|
652
|
+
...tooltipAppearanceDefault,
|
|
653
|
+
...tooltipAppearanceSize,
|
|
654
|
+
...tooltipAppearanceDisabled,
|
|
655
|
+
...tooltipAppearanceRequire,
|
|
656
|
+
...tooltipAppearanceStyle,
|
|
657
|
+
...tooltipAppearanceError,
|
|
658
|
+
...tooltipAppearanceSuccess,
|
|
659
|
+
};
|
|
625
660
|
|
|
626
|
-
|
|
661
|
+
const tooltipConfig = {
|
|
627
662
|
appearance: tooltipAppearance,
|
|
628
|
-
setAppearance:
|
|
663
|
+
setAppearance: (appearanceConfig) => {
|
|
629
664
|
tooltipConfig.appearance = appearanceConfig;
|
|
630
665
|
},
|
|
631
666
|
};
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
667
|
+
const Tooltip = React.forwardRef(function Tooltip(props, ref) {
|
|
668
|
+
const { className, appearance, initialIsVisible, title, text, before, after, openTimeoutDelay = 500, closeTimeoutDelay = 250, isSkeleton, children, } = props;
|
|
669
|
+
const tooltipElementRef = useRef(null);
|
|
670
|
+
const tooltipTimeoutHideRef = useRef(null);
|
|
671
|
+
const tooltipTimeoutShowRef = useRef(null);
|
|
672
|
+
const isTooltipCloseAnimationInProgressRef = useRef(false);
|
|
638
673
|
// TODO: rename to open?
|
|
639
|
-
|
|
674
|
+
const [isTooltipVisible, setIsTooltipVisible] = useState(initialIsVisible);
|
|
640
675
|
// TODO: or rename to show/hide?
|
|
641
|
-
|
|
676
|
+
const openTooltip = useCallback(() => {
|
|
642
677
|
if (!isTooltipCloseAnimationInProgressRef.current) {
|
|
643
678
|
if (tooltipTimeoutHideRef.current) {
|
|
644
679
|
clearTimeout(tooltipTimeoutHideRef.current);
|
|
645
680
|
}
|
|
646
|
-
tooltipTimeoutShowRef.current = setTimeout(
|
|
681
|
+
tooltipTimeoutShowRef.current = setTimeout(() => {
|
|
647
682
|
setIsTooltipVisible(true);
|
|
648
683
|
}, openTimeoutDelay);
|
|
649
684
|
}
|
|
650
685
|
}, [openTimeoutDelay]);
|
|
651
|
-
|
|
686
|
+
const closeTooltip = useCallback(() => {
|
|
652
687
|
if (tooltipTimeoutShowRef.current) {
|
|
653
688
|
clearTimeout(tooltipTimeoutShowRef.current);
|
|
654
689
|
}
|
|
655
690
|
// Make a small delay to be able to move cursor on the tooltip without
|
|
656
691
|
// triggering a close, because the label and the tooltip have space between
|
|
657
|
-
tooltipTimeoutHideRef.current = setTimeout(
|
|
692
|
+
tooltipTimeoutHideRef.current = setTimeout(() => {
|
|
658
693
|
// @ts-expect-error
|
|
659
|
-
setIsTooltipVisible(
|
|
660
|
-
|
|
694
|
+
setIsTooltipVisible((prevState) => {
|
|
695
|
+
const newState = false;
|
|
661
696
|
if (prevState === true) {
|
|
662
697
|
isTooltipCloseAnimationInProgressRef.current = true;
|
|
663
698
|
}
|
|
@@ -665,33 +700,26 @@ var Tooltip = React.forwardRef(function Tooltip(props, ref) {
|
|
|
665
700
|
});
|
|
666
701
|
}, closeTimeoutDelay);
|
|
667
702
|
}, [closeTimeoutDelay]);
|
|
668
|
-
|
|
703
|
+
const onAnimationEnd = useCallback(() => {
|
|
669
704
|
isTooltipCloseAnimationInProgressRef.current = false;
|
|
670
705
|
}, []);
|
|
671
|
-
useImperativeHandle(ref,
|
|
706
|
+
useImperativeHandle(ref, () => ({
|
|
672
707
|
get tooltipElement() {
|
|
673
708
|
return tooltipElementRef.current;
|
|
674
709
|
},
|
|
675
710
|
openTooltip: openTooltip,
|
|
676
711
|
closeTooltip: closeTooltip,
|
|
677
712
|
isTooltipVisible: isTooltipVisible,
|
|
678
|
-
})
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
713
|
+
}), [isTooltipVisible, openTooltip, closeTooltip]);
|
|
714
|
+
const appearanceConfig = useAppearanceConfig(appearance, tooltipConfig);
|
|
715
|
+
const propsGenerator = useDevicePropsGenerator(props, appearanceConfig);
|
|
716
|
+
const { alignClass, alignDirectionClass, alignmentClass, alignPosition, fillClass, borderColorClass, borderTypeClass, borderWidthClass, titleColor, titleSize, titleWeight, textColor, textSize, textWeight, arrowPosition, centeringClass, elevationClass, shapeClass, shapeStrengthClass, sizeClass, widthClass, } = propsGenerator;
|
|
682
717
|
// @ts-expect-error
|
|
683
|
-
|
|
684
|
-
return (jsxs("div", { className: clsx(className, 'tooltip', isTooltipVisible ? 'tooltip_state_open' : 'tooltip_state_close', fillClass &&
|
|
718
|
+
const { styles: tooltipStyles } = useStyles(props);
|
|
719
|
+
return (jsxs("div", { className: clsx(className, 'tooltip', isTooltipVisible ? 'tooltip_state_open' : 'tooltip_state_close', fillClass && `fill_${fillClass}`, alignPosition && `tooltip_align-position_${alignPosition}`, alignDirectionClass && `align_${alignDirectionClass}`, alignClass && `align_${alignClass}`, elevationClass && `elevation_${elevationClass}`, centeringClass && `centering_${centeringClass}`, shapeClass && `shape_${shapeClass}`, shapeStrengthClass && `shape-strength_${shapeStrengthClass}`, alignmentClass && `alignment_${alignmentClass}`, borderWidthClass && `border-width_${borderWidthClass}`, borderColorClass && `border-color_${borderColorClass}`, borderTypeClass && `border_type_${borderTypeClass}`, sizeClass && `tooltip_size_${sizeClass}`, isSkeleton && 'tooltip_skeleton', widthClass && `width_${widthClass}`), ref: tooltipElementRef, style: tooltipStyles, onAnimationEnd: onAnimationEnd, children: [jsx("div", { className: clsx('tooltip__arrow', arrowPosition && `tooltip__arrow_position_${arrowPosition}`, fillClass && `fill_${fillClass}`), children: "\u00A0" }), before, jsxs("div", { className: "tooltip__inner", children: [title && (jsx(Title, { className: "tooltip__title text", size: titleSize, textColor: titleColor, textWeight: titleWeight, children: title })), text && (jsx(Text, { className: "tooltip__text", size: textSize, textColor: textColor, textWeight: textWeight, children: text })), children] }), after] }));
|
|
685
720
|
});
|
|
686
721
|
|
|
687
|
-
|
|
688
|
-
accent: {
|
|
689
|
-
fill: 'accentPrimary',
|
|
690
|
-
fillHover: 'accentHover',
|
|
691
|
-
borderColor: 'accentBorderPrimary',
|
|
692
|
-
badgeAppearance: 'surfacePrimary',
|
|
693
|
-
iconFill: 'accentItemPrimary',
|
|
694
|
-
},
|
|
722
|
+
const iconAppearanceAccent = {
|
|
695
723
|
accentPrimary: {
|
|
696
724
|
fill: 'accentPrimary',
|
|
697
725
|
fillHover: 'accentHover',
|
|
@@ -707,11 +735,7 @@ var iconAppearanceAccent = {
|
|
|
707
735
|
},
|
|
708
736
|
};
|
|
709
737
|
|
|
710
|
-
|
|
711
|
-
danger: {
|
|
712
|
-
fill: 'dangerPrimary',
|
|
713
|
-
fillHover: 'dangerHover',
|
|
714
|
-
},
|
|
738
|
+
const iconAppearanceDanger = {
|
|
715
739
|
dangerPrimary: {
|
|
716
740
|
fill: 'dangerPrimary',
|
|
717
741
|
fillHover: 'dangerHover',
|
|
@@ -721,7 +745,7 @@ var iconAppearanceDanger = {
|
|
|
721
745
|
},
|
|
722
746
|
};
|
|
723
747
|
|
|
724
|
-
|
|
748
|
+
const iconAppearanceDisabled = {
|
|
725
749
|
disabledPrimary: {
|
|
726
750
|
fill: 'surfaceDisabled',
|
|
727
751
|
borderColor: 'surfaceBorderDisabled',
|
|
@@ -730,13 +754,7 @@ var iconAppearanceDisabled = {
|
|
|
730
754
|
},
|
|
731
755
|
};
|
|
732
756
|
|
|
733
|
-
|
|
734
|
-
error: {
|
|
735
|
-
fill: 'errorPrimary',
|
|
736
|
-
fillHover: 'errorHover',
|
|
737
|
-
badgeAppearance: 'surfacePrimary',
|
|
738
|
-
iconFill: 'errorItemPrimary',
|
|
739
|
-
},
|
|
757
|
+
const iconAppearanceError = {
|
|
740
758
|
errorPrimary: {
|
|
741
759
|
fill: 'errorPrimary',
|
|
742
760
|
fillHover: 'errorHover',
|
|
@@ -746,12 +764,7 @@ var iconAppearanceError = {
|
|
|
746
764
|
},
|
|
747
765
|
};
|
|
748
766
|
|
|
749
|
-
|
|
750
|
-
info: {
|
|
751
|
-
fill: 'accentPrimary',
|
|
752
|
-
fillHover: 'accentPrimaryHover',
|
|
753
|
-
borderColor: 'accentBorderPrimary',
|
|
754
|
-
},
|
|
767
|
+
const iconAppearanceInfo = {
|
|
755
768
|
infoPrimary: {
|
|
756
769
|
fill: 'infoPrimary',
|
|
757
770
|
borderColor: 'infoBorderDisabled',
|
|
@@ -765,13 +778,7 @@ var iconAppearanceInfo = {
|
|
|
765
778
|
},
|
|
766
779
|
};
|
|
767
780
|
|
|
768
|
-
|
|
769
|
-
primary: {
|
|
770
|
-
fill: 'primaryPrimary',
|
|
771
|
-
fillHover: 'primaryPrimaryHover',
|
|
772
|
-
badgeAppearance: 'surfacePrimary',
|
|
773
|
-
iconFill: 'primaryItemPrimary',
|
|
774
|
-
},
|
|
781
|
+
const iconAppearancePrimary = {
|
|
775
782
|
primaryPrimary: {
|
|
776
783
|
fill: 'primaryPrimary',
|
|
777
784
|
fillHover: 'primaryPrimaryHover',
|
|
@@ -781,11 +788,7 @@ var iconAppearancePrimary = {
|
|
|
781
788
|
},
|
|
782
789
|
};
|
|
783
790
|
|
|
784
|
-
|
|
785
|
-
secondary: {
|
|
786
|
-
fill: 'secondaryPrimary',
|
|
787
|
-
fillHover: 'secondaryPrimaryHover',
|
|
788
|
-
},
|
|
791
|
+
const iconAppearanceSecondary = {
|
|
789
792
|
secondaryPrimary: {
|
|
790
793
|
fill: 'secondaryPrimary',
|
|
791
794
|
fillHover: 'secondaryHoverPrimary',
|
|
@@ -795,7 +798,7 @@ var iconAppearanceSecondary = {
|
|
|
795
798
|
},
|
|
796
799
|
};
|
|
797
800
|
|
|
798
|
-
|
|
801
|
+
const iconAppearanceShape = {
|
|
799
802
|
circular: {
|
|
800
803
|
shape: 'circular',
|
|
801
804
|
},
|
|
@@ -820,7 +823,7 @@ var iconAppearanceShape = {
|
|
|
820
823
|
},
|
|
821
824
|
};
|
|
822
825
|
|
|
823
|
-
|
|
826
|
+
const iconAppearanceSize = {
|
|
824
827
|
size12_12: {
|
|
825
828
|
fillSize: '12',
|
|
826
829
|
badgeAppearanceSize: 'sizeXXS',
|
|
@@ -963,7 +966,7 @@ var iconAppearanceSize = {
|
|
|
963
966
|
},
|
|
964
967
|
};
|
|
965
968
|
|
|
966
|
-
|
|
969
|
+
const iconAppearanceStyle = {
|
|
967
970
|
solid: {
|
|
968
971
|
borderColor: 'none',
|
|
969
972
|
},
|
|
@@ -977,11 +980,7 @@ var iconAppearanceStyle = {
|
|
|
977
980
|
},
|
|
978
981
|
};
|
|
979
982
|
|
|
980
|
-
|
|
981
|
-
success: {
|
|
982
|
-
fill: 'successPrimary',
|
|
983
|
-
fillHover: 'successHover',
|
|
984
|
-
},
|
|
983
|
+
const iconAppearanceSuccess = {
|
|
985
984
|
successPrimary: {
|
|
986
985
|
fill: 'successPrimary',
|
|
987
986
|
fillHover: 'successHover',
|
|
@@ -991,7 +990,7 @@ var iconAppearanceSuccess = {
|
|
|
991
990
|
},
|
|
992
991
|
};
|
|
993
992
|
|
|
994
|
-
|
|
993
|
+
const iconAppearanceSurface = {
|
|
995
994
|
surfacePrimary: {
|
|
996
995
|
fill: 'surfacePrimary',
|
|
997
996
|
fillHover: 'surfaceSecondary',
|
|
@@ -1019,7 +1018,7 @@ var iconAppearanceSurface = {
|
|
|
1019
1018
|
},
|
|
1020
1019
|
};
|
|
1021
1020
|
|
|
1022
|
-
|
|
1021
|
+
const iconAppearanceWarning = {
|
|
1023
1022
|
warning: {
|
|
1024
1023
|
fill: 'warningPrimary',
|
|
1025
1024
|
fillHover: 'warningHover',
|
|
@@ -1035,28 +1034,42 @@ var iconAppearanceWarning = {
|
|
|
1035
1034
|
},
|
|
1036
1035
|
};
|
|
1037
1036
|
|
|
1038
|
-
|
|
1037
|
+
const iconAppearance = {
|
|
1038
|
+
...iconAppearanceDisabled,
|
|
1039
|
+
...iconAppearanceSize,
|
|
1040
|
+
...iconAppearanceStyle,
|
|
1041
|
+
...iconAppearanceAccent,
|
|
1042
|
+
...iconAppearanceShape,
|
|
1043
|
+
...iconAppearanceDanger,
|
|
1044
|
+
...iconAppearanceError,
|
|
1045
|
+
...iconAppearanceInfo,
|
|
1046
|
+
...iconAppearancePrimary,
|
|
1047
|
+
...iconAppearanceSecondary,
|
|
1048
|
+
...iconAppearanceSuccess,
|
|
1049
|
+
...iconAppearanceSurface,
|
|
1050
|
+
...iconAppearanceWarning,
|
|
1051
|
+
};
|
|
1039
1052
|
|
|
1040
|
-
|
|
1053
|
+
const iconConfig = {
|
|
1041
1054
|
appearance: iconAppearance,
|
|
1042
|
-
setAppearance:
|
|
1055
|
+
setAppearance: (appearanceConfig) => {
|
|
1043
1056
|
iconConfig.appearance = appearanceConfig;
|
|
1044
1057
|
},
|
|
1045
1058
|
};
|
|
1046
|
-
|
|
1059
|
+
const Icon = urlWithAssetPrefix(React.forwardRef(function Icon(props, ref) {
|
|
1047
1060
|
// TODO: Tooltip doesn't work that anymore
|
|
1048
1061
|
// const [isTooltipVisible, setIsTooltipVisible] = useState(false)
|
|
1049
|
-
|
|
1050
|
-
|
|
1062
|
+
const { id, appearance, className, dataTour, width, height, badgeClass, href, imageSrc, link, linkRel, linkTarget, notification, showTooltip, SvgImage, before, after, isActive, isDisabled, isSkeleton, onClick, onMouseEnter, onMouseLeave, } = props;
|
|
1063
|
+
const ImageComponent = useMemo(() => {
|
|
1051
1064
|
if (SvgImage) {
|
|
1052
|
-
|
|
1065
|
+
const sizes = {};
|
|
1053
1066
|
if (width) {
|
|
1054
1067
|
sizes.width = width;
|
|
1055
1068
|
}
|
|
1056
1069
|
if (height) {
|
|
1057
1070
|
sizes.height = height;
|
|
1058
1071
|
}
|
|
1059
|
-
return jsx(SvgImage,
|
|
1072
|
+
return jsx(SvgImage, { ...sizes });
|
|
1060
1073
|
}
|
|
1061
1074
|
if (imageSrc) {
|
|
1062
1075
|
if (imageSrc.endsWith('.svg')) {
|
|
@@ -1066,27 +1079,27 @@ var Icon = urlWithAssetPrefix(React.forwardRef(function Icon(props, ref) {
|
|
|
1066
1079
|
}
|
|
1067
1080
|
return null;
|
|
1068
1081
|
}, [SvgImage, width, height, imageSrc]);
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1082
|
+
const appearanceConfig = useAppearanceConfig(appearance, iconConfig, isDisabled);
|
|
1083
|
+
const propsGenerator = useDevicePropsGenerator(props, appearanceConfig);
|
|
1084
|
+
const { alignmentClass, fillActiveClass, fillActiveHoverClass, fillClass, fillDisabledClass, fillHoverClass, fillSizeClass, borderColorClass, borderColorHoverClass, borderTypeClass, borderWidthClass, badgeAppearance, badgeAppearanceSize, badgeShape, badgeSize, badgeTextColor, badgeTextSize, badgeValue, centeringClass, iconFillActiveClass, iconFillActiveHoverClass, iconFillClass, iconFillDisabledClass, iconFillHoverClass, iconSizeClass, shapeClass, shapeStrengthClass, tooltipAppearance, tooltipText, tooltipTextSize, tooltipTitle, tooltipTitleSize, } = propsGenerator;
|
|
1072
1085
|
// @ts-expect-error - TODO: сделать useStyles на ts
|
|
1073
|
-
|
|
1086
|
+
const { styles: iconStyles } = useStyles(props);
|
|
1074
1087
|
return (jsxs("div", { id: id, className: clsx(className, 'icon', !isActive
|
|
1075
|
-
? fillClass &&
|
|
1076
|
-
: fillActiveClass &&
|
|
1077
|
-
? fillHoverClass &&
|
|
1088
|
+
? fillClass && `fill_${fillClass}`
|
|
1089
|
+
: fillActiveClass && `fill_active_${fillActiveClass}`, !isActive
|
|
1090
|
+
? fillHoverClass && `fill_hover_${fillHoverClass}`
|
|
1078
1091
|
: fillActiveHoverClass &&
|
|
1079
|
-
|
|
1080
|
-
? iconFillClass &&
|
|
1081
|
-
: iconFillActiveClass &&
|
|
1082
|
-
? iconFillHoverClass &&
|
|
1092
|
+
`fill_active_hover_${fillActiveHoverClass}`, fillSizeClass && `icon_fill_size_${fillSizeClass}`, fillDisabledClass && `fill_disabled_${fillDisabledClass}`, !isActive
|
|
1093
|
+
? iconFillClass && `icon_fill_${iconFillClass}`
|
|
1094
|
+
: iconFillActiveClass && `icon_fill_active_${iconFillActiveClass}`, !isActive
|
|
1095
|
+
? iconFillHoverClass && `icon_fill_hover_${iconFillHoverClass}`
|
|
1083
1096
|
: iconFillActiveHoverClass &&
|
|
1084
|
-
|
|
1097
|
+
`icon_fill_active_hover_${iconFillActiveHoverClass}`, isDisabled &&
|
|
1085
1098
|
iconFillDisabledClass &&
|
|
1086
|
-
|
|
1087
|
-
|
|
1099
|
+
`icon_fill_disabled_${iconFillDisabledClass}`, shapeClass && `shape_${shapeClass}`, shapeStrengthClass && `shape-strength_${shapeStrengthClass}`, borderColorClass && `border-color_${borderColorClass}`, borderColorHoverClass &&
|
|
1100
|
+
`border-color_hover_${borderColorHoverClass}`, borderWidthClass && `border-width_${borderWidthClass}`, borderTypeClass && `border_type_${borderTypeClass}`, badgeValue && 'icon_with-badge', centeringClass && `centering_${centeringClass}`, onClick && 'cursor_type_pointer', isSkeleton && `icon_skeleton`), ref: ref, "data-tour": dataTour, style: iconStyles, onClick: onClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, children: [before, jsxs(LinkWrapper, { className: clsx((link || href || onClick) && 'cursor_type_pointer', link || href ? 'icon__link' : 'icon__item', iconSizeClass && `icon_size_${iconSizeClass}`), href: link || href, LinkComponent: "div", rel: linkRel, target: linkTarget, children: [ImageComponent, (badgeValue || notification) && (jsx(Badge, { className: clsx(badgeClass, 'icon__badge'), appearance: `${badgeAppearance} ${badgeAppearanceSize}`, size: badgeSize, textColor: badgeTextColor, textSize: badgeTextSize, shape: badgeShape, value: badgeValue })), showTooltip && (jsx(Tooltip, { className: clsx(className, 'icon__tooltip', alignmentClass && `alignment_${alignmentClass}`), appearance: tooltipAppearance, title: tooltipTitle, titleSize: tooltipTitleSize, text: tooltipText, textSize: tooltipTextSize }))] }), after] }));
|
|
1088
1101
|
}));
|
|
1089
|
-
|
|
1102
|
+
const removeFillStroke = (code) => {
|
|
1090
1103
|
return code
|
|
1091
1104
|
.replace(/fill=".*?"/g, 'fill=""')
|
|
1092
1105
|
.replace(/stroke=".*?"/g, 'stroke=""');
|