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