@itcase/ui 1.9.57 → 1.9.59

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.
Files changed (184) hide show
  1. package/dist/{Avatar_cjs_BIHJrAbQ.js → Avatar_cjs_BcCK-1qn.js} +5 -8
  2. package/dist/{Avatar_es_CtP68jPM.js → Avatar_es_Dn6PILdH.js} +2 -5
  3. package/dist/{Button_cjs_BCcz3-Fw.js → Button_cjs_DqbZe2Sk.js} +7 -13
  4. package/dist/{Button_es_DAzeb-vJ.js → Button_es_C9pw5qr_.js} +2 -8
  5. package/dist/{ChipsGroup_cjs_C27x9x9O.js → ChipsGroup_cjs_BNapN3BL.js} +7 -11
  6. package/dist/{ChipsGroup_es_BTe1MYhV.js → ChipsGroup_es_CYtMZd_G.js} +1 -5
  7. package/dist/{DatePicker_cjs_Dvw_cGFH.js → DatePicker_cjs_CY3VQDAV.js} +10 -14
  8. package/dist/{DatePicker_es_t3u6yddn.js → DatePicker_es_C110M8WT.js} +4 -8
  9. package/dist/{Group_cjs_MYtD5is_.js → Group_cjs_CvX0cIz2.js} +5 -17
  10. package/dist/{Group_es_C_WChp2_.js → Group_es_BgJhtaOv.js} +2 -14
  11. package/dist/{Image_cjs_Hvjp2QDB.js → Image_cjs_BdHJJUTP.js} +4 -6
  12. package/dist/{Image_es_DpOCNWpn.js → Image_es_5EyRL35j.js} +1 -3
  13. package/dist/{Input_cjs_BQIi1N63.js → Input_cjs_BStFgIuQ.js} +3 -4
  14. package/dist/{Input_es_BYbc2X9M.js → Input_es_BVvf5Gpr.js} +1 -2
  15. package/dist/{Label_cjs_RI5tFcPt.js → Label_cjs_BYjXyKWj.js} +5 -9
  16. package/dist/{Label_es_CNRTIAWo.js → Label_es_SG60qCRL.js} +1 -5
  17. package/dist/{Loader_cjs_CJpdLndn.js → Loader_cjs_BgiKK0BF.js} +5 -8
  18. package/dist/{Loader_es_CqlLujBJ.js → Loader_es_DzjoV2MF.js} +1 -4
  19. package/dist/{Overlay_cjs_BK_0yTLw.js → Overlay_cjs_OmKx5lKU.js} +4 -6
  20. package/dist/{Overlay_es_DOO535JM.js → Overlay_es_DhKLpjdA.js} +1 -3
  21. package/dist/{SelectContainer_cjs_DTIqXM5V.js → SelectContainer_cjs_CdxNPEhL.js} +17 -22
  22. package/dist/{SelectContainer_es_CXkK4_Om.js → SelectContainer_es_BQNyIzfX.js} +3 -8
  23. package/dist/cjs/components/Accordion.js +7 -22
  24. package/dist/cjs/components/Avatar.js +4 -18
  25. package/dist/cjs/components/AvatarStack.js +8 -22
  26. package/dist/cjs/components/Badge.js +5 -19
  27. package/dist/cjs/components/Breadcrumbs.js +7 -21
  28. package/dist/cjs/components/Button.js +4 -18
  29. package/dist/cjs/components/Cell.js +6 -20
  30. package/dist/cjs/components/Checkbox.js +7 -15
  31. package/dist/cjs/components/Checkmark.js +5 -19
  32. package/dist/cjs/components/Chips.js +2 -16
  33. package/dist/cjs/components/Choice.js +7 -21
  34. package/dist/cjs/components/Code.js +5 -10
  35. package/dist/cjs/components/CookiesWarning.js +7 -21
  36. package/dist/cjs/components/Dadata.js +4 -9
  37. package/dist/cjs/components/DatePeriod.js +18 -33
  38. package/dist/cjs/components/DatePicker.js +7 -21
  39. package/dist/cjs/components/Divider.js +6 -14
  40. package/dist/cjs/components/Dot.js +4 -10
  41. package/dist/cjs/components/Drawer.js +6 -21
  42. package/dist/cjs/components/Dropdown.js +5 -21
  43. package/dist/cjs/components/Dropzone.js +11 -25
  44. package/dist/cjs/components/Flex.js +6 -12
  45. package/dist/cjs/components/Grid.js +8 -14
  46. package/dist/cjs/components/Group.js +3 -10
  47. package/dist/cjs/components/HTMLContent.js +4 -10
  48. package/dist/cjs/components/HeroTitle.js +5 -19
  49. package/dist/cjs/components/Icon.js +5 -19
  50. package/dist/cjs/components/Image.js +4 -12
  51. package/dist/cjs/components/Input.js +4 -9
  52. package/dist/cjs/components/InputNumber.js +6 -20
  53. package/dist/cjs/components/InputPassword.js +5 -19
  54. package/dist/cjs/components/Label.js +2 -16
  55. package/dist/cjs/components/Link.js +6 -14
  56. package/dist/cjs/components/List.js +8 -16
  57. package/dist/cjs/components/Loader.js +3 -11
  58. package/dist/cjs/components/Logo.js +8 -18
  59. package/dist/cjs/components/MenuItem.js +5 -19
  60. package/dist/cjs/components/Modal.js +7 -21
  61. package/dist/cjs/components/ModalSheetBottom.js +5 -19
  62. package/dist/cjs/components/Notification.js +11 -25
  63. package/dist/cjs/components/Overlay.js +3 -10
  64. package/dist/cjs/components/Pagination.js +8 -24
  65. package/dist/cjs/components/Radio.js +5 -13
  66. package/dist/cjs/components/RangeSlider.js +4 -10
  67. package/dist/cjs/components/Response.js +10 -24
  68. package/dist/cjs/components/SVGContent.js +5 -14
  69. package/dist/cjs/components/ScrollOnDrag.js +4 -10
  70. package/dist/cjs/components/ScrollToView.js +4 -10
  71. package/dist/cjs/components/Search.js +7 -21
  72. package/dist/cjs/components/Segmented.js +6 -20
  73. package/dist/cjs/components/Select.js +5 -20
  74. package/dist/cjs/components/Swiper.js +6 -20
  75. package/dist/cjs/components/Switch.js +5 -13
  76. package/dist/cjs/components/Tab.js +8 -23
  77. package/dist/cjs/components/Text.js +6 -14
  78. package/dist/cjs/components/Textarea.js +5 -10
  79. package/dist/cjs/components/Tile.js +5 -19
  80. package/dist/cjs/components/Title.js +5 -19
  81. package/dist/cjs/components/Tooltip.js +5 -19
  82. package/dist/cjs/components/Video.js +5 -9
  83. package/dist/cjs/components/Warning.js +5 -19
  84. package/dist/cjs/context/Notifications.js +16 -188
  85. package/dist/cjs/context/UIContext.js +14 -71
  86. package/dist/cjs/context/UrlAssetPrefix.js +15 -13
  87. package/dist/cjs/hoc/urlWithAssetPrefix.js +14 -73
  88. package/dist/cjs/hooks/useAppearanceConfig/useAppearanceConfig.js +14 -25
  89. package/dist/cjs/hooks/useAppearanceConfig.js +12 -2
  90. package/dist/cjs/hooks/useDevicePropsGenerator/useDevicePropsGenerator.js +10 -124
  91. package/dist/cjs/hooks/useDevicePropsGenerator.js +6 -9
  92. package/dist/cjs/hooks/useDeviceTargetClass.js +8 -4
  93. package/dist/cjs/hooks/useMediaQueries/useMediaQueries.js +13 -116
  94. package/dist/cjs/hooks/useMediaQueries.js +11 -2
  95. package/dist/cjs/hooks/useStyles/styleAttributes.js +15 -168
  96. package/dist/cjs/hooks/useStyles/useStyles.js +10 -196
  97. package/dist/cjs/hooks/useStyles.js +7 -10
  98. package/dist/cjs/hooks.js +15 -6
  99. package/dist/cjs/utils/mergeAppearanceKeys.js +15 -15
  100. package/dist/cjs/utils/setViewportProperty.js +15 -5
  101. package/dist/cjs/utils.js +14 -4
  102. package/dist/components/Accordion.js +1 -16
  103. package/dist/components/Avatar.js +4 -18
  104. package/dist/components/AvatarStack.js +4 -18
  105. package/dist/components/Badge.js +2 -16
  106. package/dist/components/Breadcrumbs.js +1 -15
  107. package/dist/components/Button.js +4 -18
  108. package/dist/components/Cell.js +2 -16
  109. package/dist/components/Checkbox.js +4 -12
  110. package/dist/components/Checkmark.js +1 -15
  111. package/dist/components/Chips.js +2 -16
  112. package/dist/components/Choice.js +2 -16
  113. package/dist/components/Code.js +3 -8
  114. package/dist/components/CookiesWarning.js +4 -18
  115. package/dist/components/Dadata.js +4 -9
  116. package/dist/components/DatePeriod.js +12 -27
  117. package/dist/components/DatePicker.js +7 -21
  118. package/dist/components/Divider.js +3 -11
  119. package/dist/components/Dot.js +2 -8
  120. package/dist/components/Drawer.js +3 -18
  121. package/dist/components/Dropdown.js +1 -17
  122. package/dist/components/Dropzone.js +7 -21
  123. package/dist/components/Flex.js +2 -8
  124. package/dist/components/Grid.js +2 -8
  125. package/dist/components/Group/Group.appearance.js +1 -4
  126. package/dist/components/Group.js +3 -10
  127. package/dist/components/HTMLContent.js +2 -8
  128. package/dist/components/HeroTitle.js +1 -15
  129. package/dist/components/Icon.js +2 -16
  130. package/dist/components/Image.js +4 -12
  131. package/dist/components/Input.js +4 -9
  132. package/dist/components/InputNumber.js +4 -18
  133. package/dist/components/InputPassword.js +2 -16
  134. package/dist/components/Label.js +2 -16
  135. package/dist/components/Link.js +2 -10
  136. package/dist/components/List.js +2 -10
  137. package/dist/components/Loader.js +3 -11
  138. package/dist/components/Logo.js +3 -13
  139. package/dist/components/MenuItem.js +1 -15
  140. package/dist/components/Modal.js +3 -17
  141. package/dist/components/ModalSheetBottom.js +1 -15
  142. package/dist/components/Notification.js +5 -19
  143. package/dist/components/Overlay.js +3 -10
  144. package/dist/components/Pagination.js +1 -17
  145. package/dist/components/Radio.js +2 -10
  146. package/dist/components/RangeSlider.js +2 -8
  147. package/dist/components/Response.js +5 -19
  148. package/dist/components/SVGContent.js +2 -11
  149. package/dist/components/ScrollOnDrag.js +2 -8
  150. package/dist/components/ScrollToView.js +2 -8
  151. package/dist/components/Search.js +1 -15
  152. package/dist/components/Segmented.js +2 -16
  153. package/dist/components/Select.js +5 -20
  154. package/dist/components/Swiper.js +2 -16
  155. package/dist/components/Switch.js +2 -10
  156. package/dist/components/Tab.js +2 -17
  157. package/dist/components/Text.js +3 -11
  158. package/dist/components/Textarea.js +3 -8
  159. package/dist/components/Tile.js +1 -15
  160. package/dist/components/Title.js +2 -16
  161. package/dist/components/Tooltip.js +2 -16
  162. package/dist/components/Video.js +4 -8
  163. package/dist/components/Warning.js +1 -15
  164. package/dist/hooks/useAppearanceConfig.js +11 -1
  165. package/dist/hooks/useDevicePropsGenerator.js +5 -8
  166. package/dist/hooks/useMediaQueries.js +10 -1
  167. package/dist/hooks/useStyles.js +6 -9
  168. package/dist/hooks.js +12 -7
  169. package/dist/primitives_cjs_DX--6Yn5.js +2715 -0
  170. package/dist/primitives_es_BNlMaZfZ.js +2672 -0
  171. package/dist/utils.js +12 -2
  172. package/package.json +1 -1
  173. package/dist/Divider_cjs_C5Ou2Kqa.js +0 -104
  174. package/dist/Divider_es_D2snK_vn.js +0 -100
  175. package/dist/DropdownItem_cjs_k28TIoDU.js +0 -230
  176. package/dist/DropdownItem_es_DjPgbwtU.js +0 -225
  177. package/dist/Icon_cjs_DTvdhr8B.js +0 -1099
  178. package/dist/Icon_es_kewxGRUB.js +0 -1086
  179. package/dist/Link_cjs_Dn7UhCYe.js +0 -277
  180. package/dist/Link_es_BDAmhIzd.js +0 -272
  181. package/dist/Text_cjs_erTy2pUN.js +0 -68
  182. package/dist/Text_es_DVNvU0m0.js +0 -64
  183. package/dist/components/Group/appearance/groupSurface.js +0 -8
  184. package/dist/types/components/Group/appearance/groupSurface.d.ts +0 -3
@@ -1,1086 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import React, { useMemo, useRef, useState, useCallback, useImperativeHandle } from 'react';
3
- import clsx from 'clsx';
4
- import SVG from 'react-inlinesvg';
5
- import { a as LinkWrapper } from './Link_es_BDAmhIzd.js';
6
- import { useAppearanceConfig } from './hooks/useAppearanceConfig/useAppearanceConfig.js';
7
- import { useDevicePropsGenerator } from './hooks/useDevicePropsGenerator/useDevicePropsGenerator.js';
8
- import { useStyles } from './hooks/useStyles/useStyles.js';
9
- import { T as Text } from './Text_es_DVNvU0m0.js';
10
- import { urlWithAssetPrefix } from './hoc/urlWithAssetPrefix.js';
11
- import { mergeAppearanceKeys } from './utils/mergeAppearanceKeys.js';
12
-
13
- const badgeAppearanceAccent = {
14
- accentPrimary: {
15
- fill: 'accentPrimary',
16
- borderColor: 'accentBorderQuaternary',
17
- textColor: 'accentTextPrimary',
18
- dotFill: 'accentItemPrimary',
19
- iconFill: 'accentItemPrimary',
20
- },
21
- accentQuaternary: {
22
- fill: 'accentQuaternary',
23
- borderColor: 'accentBorderQuaternary',
24
- textColor: 'accentTextPrimary',
25
- dotFill: 'accentItemPrimary',
26
- iconFill: 'accentItemPrimary',
27
- },
28
- accentSecondary: {
29
- fill: 'accentSecondary',
30
- borderColor: 'accentBorderQuaternary',
31
- textColor: 'accentTextQuaternary',
32
- dotFill: 'accentItemQuaternary',
33
- iconFill: 'accentItemQuaternary',
34
- },
35
- accentTertiary: {
36
- fill: 'accentTertiary',
37
- borderColor: 'accentBorderSecondary',
38
- textColor: 'accentTextSecondary',
39
- dotFill: 'accentItemSecondary',
40
- iconFill: 'accentItemSecondary',
41
- },
42
- };
43
-
44
- const badgeAppearanceDanger = {
45
- dangerPrimary: {
46
- fill: 'dangerPrimary',
47
- borderColor: 'dangerBorderPrimary',
48
- textColor: 'dangerTextPrimary',
49
- dotFill: 'dangerItemPrimary',
50
- iconFill: 'dangerItemPrimary',
51
- },
52
- };
53
-
54
- const badgeAppearanceDisabled = {
55
- disabledPrimary: {
56
- fill: 'surfacePrimary',
57
- borderColor: 'surfaceBorderPrimary',
58
- textColor: 'surfaceTextPrimary',
59
- iconFill: 'surfaceItemPrimary',
60
- },
61
- };
62
-
63
- const badgeAppearanceError = {
64
- errorPrimary: {
65
- fill: 'errorPrimary',
66
- fillHover: 'errorHoverPrimary',
67
- textColor: 'errorTextPrimary',
68
- iconFill: 'errorItemPrimary',
69
- },
70
- };
71
-
72
- const badgeAppearanceExtra = {
73
- extraPrimary: {
74
- fill: 'extraPrimary',
75
- borderColor: 'extraBorderSecondary',
76
- textColor: 'extraTextPrimary',
77
- dotFill: 'extraItemPrimary',
78
- iconFill: 'extraItemPrimary',
79
- },
80
- };
81
-
82
- const badgeAppearanceInfo = {
83
- infoPrimary: {
84
- fill: 'infoPrimary',
85
- borderColor: 'infoBorderSecondary',
86
- textColor: 'infoTextPrimary',
87
- dotFill: 'infoItemPrimary',
88
- iconFill: 'infoItemPrimary',
89
- },
90
- infoSecondary: {
91
- fill: 'infoSecondary',
92
- borderColor: 'infoBorderSecondary',
93
- textColor: 'infoTextSecondary',
94
- dotFill: 'infoItemSecondary',
95
- },
96
- };
97
-
98
- const badgeAppearanceShape = {
99
- circular: {
100
- shape: 'circular',
101
- },
102
- rounded: {
103
- shape: 'rounded',
104
- },
105
- roundedXL: {
106
- shape: 'rounded',
107
- shapeStrength: '2m',
108
- },
109
- roundedL: {
110
- shape: 'rounded',
111
- shapeStrength: '1_5m',
112
- },
113
- roundedM: {
114
- shape: 'rounded',
115
- shapeStrength: '1m',
116
- },
117
- roundedS: {
118
- shape: 'rounded',
119
- shapeStrength: '0_5m',
120
- },
121
- };
122
-
123
- const badgeAppearanceSize = {
124
- sizeXXL: {
125
- size: 'xxl',
126
- textSize: 'xl',
127
- iconSize: '24',
128
- },
129
- sizeXL: {
130
- size: 'xl',
131
- textSize: 'l',
132
- iconSize: '24',
133
- },
134
- sizeL: {
135
- size: 'l',
136
- textSize: 'l',
137
- iconSize: '24',
138
- },
139
- sizeM: {
140
- size: 'm',
141
- textSize: 'm',
142
- iconSize: '24',
143
- },
144
- sizeS: {
145
- size: 's',
146
- textSize: 's',
147
- iconSize: '24',
148
- },
149
- sizeXS: {
150
- size: 'xs',
151
- textSize: 'xs',
152
- iconSize: '24',
153
- },
154
- sizeXXS: {
155
- size: 'xxs',
156
- textSize: 'xs',
157
- iconSize: '24',
158
- },
159
- };
160
-
161
- const badgeAppearanceSpecial = {
162
- specialPrimary: {
163
- fill: 'specialPrimary',
164
- borderColor: 'specialBorderSecondary',
165
- textColor: 'specialTextPrimary',
166
- dotFill: 'specialItemPrimary',
167
- iconFill: 'specialItemPrimary',
168
- },
169
- };
170
-
171
- const badgeAppearanceStyle = {
172
- solid: {
173
- borderColor: 'none',
174
- },
175
- outlined: {
176
- fill: 'none',
177
- },
178
- full: {},
179
- ghost: {
180
- fill: 'none',
181
- borderColor: 'none',
182
- },
183
- };
184
-
185
- const badgeAppearanceSuccess = {
186
- successPrimary: {
187
- fill: 'successPrimary',
188
- borderColor: 'successBorderPrimary',
189
- textColor: 'successTextPrimary',
190
- dotFill: 'successItemPrimary',
191
- iconFill: 'successItemPrimary',
192
- },
193
- };
194
-
195
- const badgeAppearanceSurface = {
196
- surfacePrimary: {
197
- fill: 'surfacePrimary',
198
- borderColor: 'surfaceBorderTertiary',
199
- textColor: 'surfaceTextPrimary',
200
- dotFill: 'surfaceItemPrimary',
201
- iconFill: 'surfaceItemPrimary',
202
- },
203
- surfaceQuaternary: {
204
- fill: 'accentPrimary',
205
- borderColor: 'surfaceBorderPrimary',
206
- textColor: 'surfaceTextPrimary',
207
- },
208
- surfaceSecondary: {
209
- fill: 'surfaceSecondary',
210
- borderColor: 'surfaceBorderSecondary',
211
- textColor: 'surfaceTextPrimary',
212
- },
213
- surfaceTertiary: {
214
- fill: 'surfaceTertiary',
215
- borderColor: 'surfaceBorderTertiary',
216
- textColor: 'surfaceTextPrimary',
217
- },
218
- };
219
-
220
- const badgeAppearanceWarning = {
221
- warningPrimary: {
222
- fill: 'warningPrimary',
223
- borderColor: 'warningBorderPrimary',
224
- textColor: 'warningTextPrimary',
225
- dotFill: 'warningItemPrimary',
226
- iconFill: 'warningItemPrimary',
227
- },
228
- };
229
-
230
- const badgeAppearance = {
231
- ...badgeAppearanceSize,
232
- ...badgeAppearanceShape,
233
- ...badgeAppearanceStyle,
234
- ...badgeAppearanceAccent,
235
- ...badgeAppearanceDanger,
236
- ...badgeAppearanceError,
237
- ...badgeAppearanceInfo,
238
- ...badgeAppearanceSpecial,
239
- ...badgeAppearanceExtra,
240
- ...badgeAppearanceSuccess,
241
- ...badgeAppearanceDisabled,
242
- ...badgeAppearanceSurface,
243
- ...badgeAppearanceWarning,
244
- };
245
-
246
- const badgeConfig = {
247
- appearance: badgeAppearance,
248
- setAppearance: (appearanceConfig) => {
249
- badgeConfig.appearance = appearanceConfig;
250
- },
251
- };
252
- function Badge(props) {
253
- const { appearance, className, dataTestId, dataTour, dot, icon, iconSrc, value, isSkeleton, children, } = props;
254
- const appearanceConfig = useAppearanceConfig(appearance, badgeConfig);
255
- const propsGenerator = useDevicePropsGenerator(props, appearanceConfig);
256
- const { fillClass, fillHoverClass, borderColorClass, borderColorHoverClass, borderTypeClass, borderWidthClass, textColor, textSize, dotFillClass, iconFill, iconShape, iconSize, shapeClass, shapeStrengthClass, sizeClass, } = propsGenerator;
257
- const { styles: badgeStyles } = useStyles(props);
258
- const badgeTypeClass = value
259
- ? icon
260
- ? dot
261
- ? 'badge_type_dot-icon-counter'
262
- : 'badge_type_icon-counter'
263
- : 'badge_type_counter'
264
- : icon
265
- ? 'badge_type_icon'
266
- : dot
267
- ? 'badge_type_dot'
268
- : 'badge_type_fill';
269
- 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'), "data-testid": dataTestId, "data-tour": dataTour, 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 ||
270
- (value && (jsx(Text, { className: "badge__value", size: textSize, textColor: textColor, children: value })))] }));
271
- }
272
-
273
- const titleAppearanceAccent = {
274
- accentPrimary: {
275
- fill: 'accentPrimary',
276
- fillHover: 'accentHoverPrimary',
277
- },
278
- accentSecondary: {
279
- fill: 'accentPrimary',
280
- fillHover: 'accentHoverPrimary',
281
- },
282
- };
283
-
284
- const titleAppearanceDanger = {
285
- dangerPrimary: {
286
- fill: 'dangerPrimary',
287
- fillHover: 'dangerHoverPrimary',
288
- },
289
- };
290
-
291
- const titleAppearanceDisabled = {
292
- disabledPrimary: {
293
- fill: 'surfacePrimary',
294
- borderColor: 'errorBorderQuaternary',
295
- borderHover: 'errorBorderHoverQuaternary',
296
- textColor: 'surfaceTextQuaternary',
297
- iconBeforeFill: 'errorQuaternary',
298
- },
299
- disabledSecondary: {
300
- fill: 'surfaceSecondary',
301
- borderColor: 'surfaceBorderTertiary',
302
- borderHover: 'surfaceBorderHoverQuaternary',
303
- iconBeforeFill: 'surfaceQuaternary',
304
- },
305
- };
306
-
307
- const titleAppearanceError = {
308
- errorPrimary: {
309
- fill: 'errorPrimary',
310
- fillHover: 'errorHoverPrimary',
311
- textColor: 'errorTextPrimary',
312
- textColorHover: 'errorTextPrimary',
313
- },
314
- };
315
-
316
- const titleAppearanceExtra = {
317
- extraPrimary: {
318
- fill: 'extraPrimary',
319
- fillHover: 'extraHoverPrimary',
320
- textColor: 'extraTextPrimary',
321
- },
322
- };
323
-
324
- const titleAppearanceInfo = {
325
- infoPrimary: {
326
- fill: 'accentPrimary',
327
- fillHover: 'accentHoverPrimary',
328
- },
329
- infoSecondary: {
330
- fill: 'accentPrimary',
331
- fillHover: 'accentHoverPrimary',
332
- },
333
- };
334
-
335
- const titleAppearanceRequire = {
336
- requirePrimary: {
337
- fill: 'warningTertiary',
338
- borderColor: 'warningBorderQuaternary',
339
- borderHover: 'warningBorderQuaternary',
340
- textColor: 'surfaceTextPrimary',
341
- iconBeforeFill: 'warningQuaternary',
342
- },
343
- requireSecondary: {
344
- fill: 'surfaceSecondary',
345
- borderColor: 'surfaceBorderTertiary',
346
- borderHover: 'surfaceBorderQuaternary',
347
- iconBeforeFill: 'surfaceQuaternary',
348
- },
349
- };
350
-
351
- const titleAppearanceSize = {
352
- h1: {
353
- size: 'h1',
354
- iconAfterFillSize: '24',
355
- iconAfterSize: '24',
356
- iconBeforeFillSize: '24',
357
- iconBeforeSize: '24',
358
- },
359
- h2: {
360
- size: 'h2',
361
- iconAfterFillSize: '24',
362
- iconAfterSize: '24',
363
- iconBeforeFillSize: '24',
364
- iconBeforeSize: '24',
365
- },
366
- h3: {
367
- size: 'h3',
368
- iconAfterFillSize: '24',
369
- iconAfterSize: '24',
370
- iconBeforeFillSize: '24',
371
- iconBeforeSize: '24',
372
- },
373
- h4: {
374
- size: 'h4',
375
- iconAfterFillSize: '24',
376
- iconAfterSize: '24',
377
- iconBeforeFillSize: '24',
378
- iconBeforeSize: '24',
379
- },
380
- h5: {
381
- size: 'h5',
382
- iconAfterFillSize: '20',
383
- iconAfterSize: '20',
384
- iconBeforeFillSize: '20',
385
- iconBeforeSize: '20',
386
- },
387
- h6: {
388
- size: 'h6',
389
- iconAfterFillSize: '16',
390
- iconAfterSize: '16',
391
- iconBeforeFillSize: '16',
392
- iconBeforeSize: '16',
393
- },
394
- };
395
-
396
- const titleAppearanceSpecial = {
397
- specialPrimary: {
398
- fill: 'specialPrimary',
399
- fillHover: 'specialHoverPrimary',
400
- },
401
- };
402
-
403
- const titleAppearanceStyle = {
404
- solid: {},
405
- outlined: {
406
- fill: 'none',
407
- },
408
- full: {},
409
- ghost: {
410
- fill: 'none',
411
- },
412
- };
413
-
414
- const titleAppearanceSuccess = {
415
- successPrimary: {
416
- fill: 'successPrimary',
417
- fillHover: 'successHoverPrimary',
418
- },
419
- };
420
-
421
- const titleAppearanceSurface = {
422
- surfacePrimary: {
423
- fill: 'surfacePrimary',
424
- fillHover: 'surfaceHoverPrimary',
425
- },
426
- surfaceQuaternary: {
427
- fill: 'surfaceQuaternary',
428
- fillHover: 'surfaceHoverQuaternary',
429
- },
430
- surfaceSecondary: {
431
- fill: 'surfaceSecondary',
432
- fillHover: 'surfaceHoverSecondary',
433
- },
434
- surfaceTertiary: {
435
- fill: 'surfaceTertiary',
436
- fillHover: 'surfaceHoverTertiary',
437
- },
438
- };
439
-
440
- const titleAppearanceWarning = {
441
- warningPrimary: {
442
- fill: 'warningPrimary',
443
- fillHover: 'warningHoverPrimary',
444
- textColor: 'warningTextSecondary',
445
- textColorHover: 'warningTextSecondary',
446
- },
447
- };
448
-
449
- const titleAppearance = {
450
- ...titleAppearanceSize,
451
- ...titleAppearanceDisabled,
452
- ...titleAppearanceStyle,
453
- ...titleAppearanceAccent,
454
- ...titleAppearanceDanger,
455
- ...titleAppearanceError,
456
- ...titleAppearanceInfo,
457
- ...titleAppearanceSpecial,
458
- ...titleAppearanceExtra,
459
- ...titleAppearanceSuccess,
460
- ...titleAppearanceSurface,
461
- ...titleAppearanceWarning,
462
- ...titleAppearanceRequire,
463
- };
464
-
465
- const titleConfig = {
466
- appearance: titleAppearance,
467
- setAppearance: (appearanceConfig) => {
468
- titleConfig.appearance = appearanceConfig;
469
- },
470
- };
471
- function Title(props) {
472
- const { appearance, className, dataTestId, dataTour, text, afterWrapper, beforeWrapper, style, tag = 'span', before, after, isActive, isDisabled, isSkeleton, onClick, children, } = props;
473
- const appearanceConfig = useAppearanceConfig(appearance, titleConfig, isDisabled);
474
- const propsGenerator = useDevicePropsGenerator(props, appearanceConfig);
475
- const { directionClass, size, fillClass, fillHoverClass, textAlignClass, textColorActiveClass, textColorActiveHoverClass, textColorClass, textColorDisabledClass, textColorHoverClass, textFontClass, 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, onClickIconAfter, onClickIconBefore, } = propsGenerator;
476
- const { styles: titleStyles, wrapper: titleWrapperStyles } = useStyles(props);
477
- const Tag = useMemo(() => {
478
- if (tag) {
479
- return tag;
480
- }
481
- return size ? size : 'span';
482
- }, [tag, size]);
483
- return (jsxs(Tag, { className: clsx(className, 'title', fillClass && `fill_${fillClass}`, fillHoverClass && `fill_hover_${fillHoverClass}`, svgFillClass && `svg_fill_${svgFillClass}`, svgFillHoverClass && `svg_fill_hover_${svgFillHoverClass}`, widthClass && `width_${widthClass}`, heightClass && `height_${heightClass}`, size && `title_size_${size}`, directionClass && `title_direction_${directionClass}`, isDisabled &&
484
- textColorDisabledClass &&
485
- `text-color_${textColorDisabledClass}`, !isActive &&
486
- !isDisabled &&
487
- textColorClass &&
488
- `text text-color_${textColorClass}`, isActive &&
489
- !isDisabled &&
490
- textColorActiveClass &&
491
- `text-color_active_${textColorActiveClass}`, !isActive &&
492
- !isDisabled &&
493
- textColorHoverClass &&
494
- `text-color_hover_${textColorHoverClass}`, isActive &&
495
- !isDisabled &&
496
- textColorActiveHoverClass &&
497
- `text-color_active_hover${textColorActiveHoverClass}`, textFontClass && `text-font_${textFontClass}`, textStyleClass && `text-style_${textStyleClass}`, textWeightClass && `text-weight_${textWeightClass}`, textWrap && `word-wrap_${textWrap}`, iconBadgeValue && 'title_badge', isSkeleton && 'title_skeleton'), "data-testid": dataTestId, "data-tour": dataTour, style: Object.assign({}, titleStyles, style), 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, onClick: onClickIconBefore })), 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, onClick: onClickIconAfter }))] }), after] }));
498
- }
499
-
500
- const tooltipAppearanceDefault = {
501
- defaultPrimary: {
502
- fill: 'surfacePrimary',
503
- fillHover: 'surfaceHoverPrimary',
504
- titleColor: 'surfaceTextPrimary',
505
- borderColor: 'surfaceBorderPrimary',
506
- textColor: 'surfaceTextPrimary',
507
- },
508
- };
509
-
510
- const tooltipAppearanceDisabled = {
511
- disabledPrimary: {
512
- fill: 'disabledPrimary',
513
- fillHover: 'disabledHoverPrimary',
514
- titleColor: 'surfaceTextPrimary',
515
- textColor: 'surfaceTextPrimary',
516
- },
517
- };
518
-
519
- const tooltipAppearanceError = {
520
- errorPrimary: {
521
- fill: 'errorPrimary',
522
- fillHover: 'errorHoverPrimary',
523
- borderColor: 'errorBorderPrimary',
524
- titleColor: 'errorTextPrimary',
525
- textColor: 'errorTextPrimary',
526
- },
527
- };
528
-
529
- const tooltipAppearanceRequire = {
530
- requirePrimary: {
531
- fill: 'warningPrimary',
532
- fillHover: 'warningHoverPrimary',
533
- borderColor: 'warningBorderPrimary',
534
- titleColor: 'warningTextPrimary',
535
- textColor: 'warningTextPrimary',
536
- },
537
- };
538
-
539
- const tooltipAppearanceShape = {
540
- circular: {
541
- shape: 'circular',
542
- },
543
- rounded: {
544
- shape: 'rounded',
545
- },
546
- roundedXL: {
547
- shape: 'rounded',
548
- shapeStrength: '2m',
549
- },
550
- roundedL: {
551
- shape: 'rounded',
552
- shapeStrength: '1_5m',
553
- },
554
- roundedM: {
555
- shape: 'rounded',
556
- shapeStrength: '1m',
557
- },
558
- roundedS: {
559
- shape: 'rounded',
560
- shapeStrength: '0_5m',
561
- },
562
- };
563
-
564
- const tooltipAppearanceSize = {
565
- sizeL: {
566
- size: 'l',
567
- titleSize: 'h5',
568
- textSize: 's',
569
- },
570
- sizeM: {
571
- size: 'm',
572
- titleSize: 'h5',
573
- textSize: 's',
574
- },
575
- sizeS: {
576
- size: 's',
577
- titleSize: 'h5',
578
- textSize: 's',
579
- },
580
- };
581
-
582
- const tooltipAppearanceStyle = {
583
- solid: {
584
- borderColor: 'none',
585
- },
586
- outlined: {
587
- fill: 'none',
588
- },
589
- full: {},
590
- ghost: {
591
- fill: 'none',
592
- borderColor: 'none',
593
- },
594
- };
595
-
596
- const tooltipAppearanceSuccess = {
597
- successPrimary: {
598
- fill: 'successPrimary',
599
- fillHover: 'successHoverPrimary',
600
- borderColor: 'successBorderPrimary',
601
- titleColor: 'successTextPrimary',
602
- textColor: 'successTextPrimary',
603
- },
604
- };
605
-
606
- const tooltipAppearance = {
607
- ...tooltipAppearanceDefault,
608
- ...tooltipAppearanceSize,
609
- ...tooltipAppearanceDisabled,
610
- ...tooltipAppearanceRequire,
611
- ...tooltipAppearanceShape,
612
- ...tooltipAppearanceStyle,
613
- ...tooltipAppearanceError,
614
- ...tooltipAppearanceSuccess,
615
- };
616
-
617
- const tooltipConfig = {
618
- appearance: tooltipAppearance,
619
- setAppearance: (appearanceConfig) => {
620
- tooltipConfig.appearance = appearanceConfig;
621
- },
622
- };
623
- const Tooltip = React.forwardRef(function Tooltip(props, ref) {
624
- const { appearance, className, dataTestId, dataTour, initialIsVisible, title, text, before, after, openTimeoutDelay = 500, closeTimeoutDelay = 250, isSkeleton, isTooltipDisableState, children, } = props;
625
- const tooltipElementRef = useRef(null);
626
- const tooltipTimeoutHideRef = useRef(null);
627
- const tooltipTimeoutShowRef = useRef(null);
628
- const isTooltipCloseAnimationInProgressRef = useRef(false);
629
- const [isTooltipVisible, setIsTooltipVisible] = useState(initialIsVisible);
630
- const openTooltip = useCallback(() => {
631
- if (!isTooltipCloseAnimationInProgressRef.current) {
632
- if (tooltipTimeoutHideRef.current) {
633
- clearTimeout(tooltipTimeoutHideRef.current);
634
- }
635
- tooltipTimeoutShowRef.current = setTimeout(() => {
636
- setIsTooltipVisible(true);
637
- }, openTimeoutDelay);
638
- }
639
- }, [openTimeoutDelay]);
640
- const closeTooltip = useCallback(() => {
641
- if (tooltipTimeoutShowRef.current) {
642
- clearTimeout(tooltipTimeoutShowRef.current);
643
- }
644
- tooltipTimeoutHideRef.current = setTimeout(() => {
645
- setIsTooltipVisible((prevState) => {
646
- const newState = false;
647
- if (prevState === true) {
648
- isTooltipCloseAnimationInProgressRef.current = true;
649
- }
650
- return newState;
651
- });
652
- }, closeTimeoutDelay);
653
- }, [closeTimeoutDelay]);
654
- const onAnimationEnd = useCallback(() => {
655
- isTooltipCloseAnimationInProgressRef.current = false;
656
- }, []);
657
- useImperativeHandle(ref, () => ({
658
- get tooltipElement() {
659
- return tooltipElementRef.current;
660
- },
661
- openTooltip: openTooltip,
662
- closeTooltip: closeTooltip,
663
- isTooltipVisible: isTooltipVisible,
664
- }), [isTooltipVisible, openTooltip, closeTooltip]);
665
- const appearanceConfig = useAppearanceConfig(appearance, tooltipConfig);
666
- const propsGenerator = useDevicePropsGenerator(props, appearanceConfig);
667
- const { alignClass, alignDirectionClass, alignmentClass, alignPosition, fillClass, titleColor, titleSize, titleWeight, borderColorClass, borderTypeClass, borderWidthClass, textColor, textSize, textWeight, arrowPosition, centeringClass, elevationClass, shapeClass, shapeStrengthClass, sizeClass, widthClass, } = propsGenerator;
668
- const { styles: tooltipStyles } = useStyles(props);
669
- return (jsxs("div", { className: clsx(className, 'tooltip', !isTooltipDisableState
670
- ? isTooltipVisible
671
- ? 'tooltip_state_open'
672
- : 'tooltip_state_close'
673
- : null, alignPosition && `tooltip_align-position_${alignPosition}`, alignDirectionClass && `align_${alignDirectionClass}`, alignClass && `align_${alignClass}`, elevationClass && `elevation_${elevationClass}`, centeringClass && `centering_${centeringClass}`, alignmentClass && `alignment_${alignmentClass}`, sizeClass && `tooltip_size_${sizeClass}`, isSkeleton && 'tooltip_skeleton', widthClass && `width_${widthClass}`), ref: tooltipElementRef, "data-testid": dataTestId, "data-tour": dataTour, style: tooltipStyles, onAnimationEnd: onAnimationEnd, children: [arrowPosition && (jsx("div", { className: clsx('tooltip__arrow', arrowPosition && `tooltip__arrow_position_${arrowPosition}`, fillClass && `fill_${fillClass}`), children: "\u00A0" })), before, jsxs("div", { className: clsx('tooltip__inner', borderWidthClass && `border-width_${borderWidthClass}`, borderColorClass && `border-color_${borderColorClass}`, borderTypeClass && `border_type_${borderTypeClass}`, fillClass && `fill_${fillClass}`, shapeClass && `shape_${shapeClass}`, shapeStrengthClass && `shape-strength_${shapeStrengthClass}`), 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] }));
674
- });
675
-
676
- const iconAppearanceAccent = {
677
- accentPrimary: {
678
- fill: 'accentPrimary',
679
- fillHover: 'accentHoverPrimary',
680
- borderColor: 'accentBorderPrimary',
681
- badgeAppearance: 'surfacePrimary',
682
- iconFill: 'accentItemPrimary',
683
- },
684
- accentSecondary: {
685
- fill: 'accentPrimary',
686
- fillHover: 'accentHoverPrimary',
687
- borderColor: 'accentBorderPrimary',
688
- iconFill: 'accentItemPrimary',
689
- },
690
- };
691
-
692
- const iconAppearanceDanger = {
693
- dangerPrimary: {
694
- fill: 'dangerPrimary',
695
- fillHover: 'dangerHoverPrimary',
696
- borderColor: 'dangerBorderSecondary',
697
- badgeAppearance: 'surfacePrimary',
698
- iconFill: 'dangerItemPrimary',
699
- },
700
- };
701
-
702
- const iconAppearanceDisabled = {
703
- disabledPrimary: {
704
- fill: 'surfacePrimary',
705
- borderColor: 'surfaceBorderPrimary',
706
- badgeAppearance: 'surfacePrimary',
707
- iconFill: 'surfaceItemQuaternary',
708
- },
709
- };
710
-
711
- const iconAppearanceError = {
712
- errorPrimary: {
713
- fill: 'errorPrimary',
714
- fillHover: 'errorHoverPrimary',
715
- borderColor: 'errorBorderPrimary',
716
- badgeAppearance: 'surfacePrimary',
717
- iconFill: 'errorItemPrimary',
718
- },
719
- };
720
-
721
- const iconAppearanceExtra = {
722
- extraPrimary: {
723
- fill: 'extraPrimary',
724
- fillHover: 'extraHoverPrimary',
725
- borderColor: 'extraBorderQuaternary',
726
- badgeAppearance: 'surfacePrimary',
727
- iconFill: 'extraItemPrimary',
728
- },
729
- };
730
-
731
- const iconAppearanceInfo = {
732
- infoPrimary: {
733
- fill: 'infoPrimary',
734
- borderColor: 'infoBorderPrimary',
735
- badgeAppearance: 'surfacePrimary',
736
- iconFill: 'infoItemPrimary',
737
- },
738
- infoSecondary: {
739
- fill: 'accentPrimary',
740
- fillHover: 'accentHoverPrimary',
741
- borderColor: 'accentBorderPrimary',
742
- iconFill: 'infoItemSecondary',
743
- },
744
- };
745
-
746
- const iconAppearanceShape = {
747
- circular: {
748
- shape: 'circular',
749
- },
750
- rounded: {
751
- shape: 'rounded',
752
- },
753
- roundedXL: {
754
- shape: 'rounded',
755
- shapeStrength: '2m',
756
- },
757
- roundedL: {
758
- shape: 'rounded',
759
- shapeStrength: '1_5m',
760
- },
761
- roundedM: {
762
- shape: 'rounded',
763
- shapeStrength: '1m',
764
- },
765
- roundedS: {
766
- shape: 'rounded',
767
- shapeStrength: '0_5m',
768
- },
769
- };
770
-
771
- const iconAppearanceSize = {
772
- size12_12: {
773
- fillSize: '12',
774
- badgeAppearanceSize: 'sizeXXS',
775
- badgeSize: 'xxs',
776
- iconSize: '12',
777
- },
778
- size14_12: {
779
- fillSize: '14',
780
- badgeAppearanceSize: 'sizeXXS',
781
- badgeSize: 'xxs',
782
- iconSize: '12',
783
- },
784
- size14_14: {
785
- fillSize: '14',
786
- badgeAppearanceSize: 'sizeXXS',
787
- badgeSize: 'xxs',
788
- iconSize: '14',
789
- },
790
- size16_12: {
791
- fillSize: '16',
792
- badgeAppearanceSize: 'sizeXXS',
793
- badgeSize: 'xxs',
794
- iconSize: '12',
795
- },
796
- size16_14: {
797
- fillSize: '16',
798
- badgeAppearanceSize: 'sizeXXS',
799
- badgeSize: 'xxs',
800
- iconSize: '14',
801
- },
802
- size16_16: {
803
- fillSize: '16',
804
- badgeAppearanceSize: 'sizeXXS',
805
- badgeSize: 'xxs',
806
- iconSize: '16',
807
- },
808
- size20_12: {
809
- fillSize: '20',
810
- badgeAppearanceSize: 'sizeXXS',
811
- badgeSize: 'xxs',
812
- iconSize: '12',
813
- },
814
- size20_14: {
815
- fillSize: '20',
816
- badgeAppearanceSize: 'sizeXXS',
817
- badgeSize: 'xxs',
818
- iconSize: '14',
819
- },
820
- size20_16: {
821
- fillSize: '20',
822
- badgeAppearanceSize: 'sizeXXS',
823
- badgeSize: 'xxs',
824
- iconSize: '16',
825
- },
826
- size20_20: {
827
- fillSize: '20',
828
- badgeAppearanceSize: 'sizeXXS',
829
- badgeSize: 'xxs',
830
- iconSize: '20',
831
- },
832
- size24_12: {
833
- fillSize: '24',
834
- badgeAppearanceSize: 'sizeXXS',
835
- badgeSize: 'xxs',
836
- iconSize: '12',
837
- },
838
- size24_14: {
839
- fillSize: '24',
840
- badgeAppearanceSize: 'sizeXXS',
841
- badgeSize: 'xxs',
842
- iconSize: '14',
843
- },
844
- size24_16: {
845
- fillSize: '24',
846
- badgeAppearanceSize: 'sizeXXS',
847
- badgeSize: 'xxs',
848
- iconSize: '16',
849
- },
850
- size24_20: {
851
- fillSize: '24',
852
- badgeAppearanceSize: 'sizeXXS',
853
- badgeSize: 'xxs',
854
- iconSize: '20',
855
- },
856
- size24_24: {
857
- fillSize: '24',
858
- badgeAppearanceSize: 'sizeXXS',
859
- badgeSize: 'xxs',
860
- iconSize: '24',
861
- },
862
- size32_12: {
863
- fillSize: '32',
864
- badgeAppearanceSize: 'sizeXXS',
865
- badgeSize: 'xxs',
866
- iconSize: '12',
867
- },
868
- size32_14: {
869
- fillSize: '32',
870
- badgeAppearanceSize: 'sizeXXS',
871
- badgeSize: 'xxs',
872
- iconSize: '14',
873
- },
874
- size32_16: {
875
- fillSize: '32',
876
- badgeAppearanceSize: 'sizeXXS',
877
- badgeSize: 'xxs',
878
- iconSize: '16',
879
- },
880
- size32_20: {
881
- fillSize: '32',
882
- badgeAppearanceSize: 'sizeXXS',
883
- badgeSize: 'xxs',
884
- iconSize: '20',
885
- },
886
- size32_24: {
887
- fillSize: '32',
888
- badgeAppearanceSize: 'sizeXXS',
889
- badgeSize: 'xxs',
890
- iconSize: '24',
891
- },
892
- size32_32: {
893
- fillSize: '32',
894
- badgeAppearanceSize: 'sizeXXS',
895
- badgeSize: 'xxs',
896
- iconSize: '32',
897
- },
898
- size40_12: {
899
- fillSize: '40',
900
- badgeAppearanceSize: 'sizeXXS',
901
- badgeSize: 'xxs',
902
- iconSize: '12',
903
- },
904
- size40_14: {
905
- fillSize: '40',
906
- badgeAppearanceSize: 'sizeXXS',
907
- badgeSize: 'xxs',
908
- iconSize: '14',
909
- },
910
- size40_16: {
911
- fillSize: '40',
912
- badgeAppearanceSize: 'sizeXXS',
913
- badgeSize: 'xxs',
914
- iconSize: '16',
915
- },
916
- size40_20: {
917
- fillSize: '40',
918
- badgeAppearanceSize: 'sizeXXS',
919
- badgeSize: 'xxs',
920
- iconSize: '20',
921
- },
922
- size40_24: {
923
- fillSize: '40',
924
- badgeAppearanceSize: 'sizeXXS',
925
- badgeSize: 'xxs',
926
- iconSize: '24',
927
- },
928
- size40_32: {
929
- fillSize: '40',
930
- badgeAppearanceSize: 'sizeXXS',
931
- badgeSize: 'xxs',
932
- iconSize: '32',
933
- },
934
- size40_40: {
935
- fillSize: '40',
936
- badgeAppearanceSize: 'sizeXXS',
937
- badgeSize: 'xxs',
938
- iconSize: '40',
939
- },
940
- };
941
-
942
- const iconAppearanceSpecial = {
943
- specialPrimary: {
944
- fill: 'specialPrimary',
945
- fillHover: 'specialHoverPrimary',
946
- borderColor: 'specialBorderQuaternary',
947
- badgeAppearance: 'surfacePrimary',
948
- iconFill: 'specialItemPrimary',
949
- },
950
- };
951
-
952
- const iconAppearanceStyle = {
953
- solid: {
954
- borderColor: 'none',
955
- },
956
- outlined: {
957
- fill: 'none',
958
- },
959
- full: {},
960
- ghost: {
961
- fill: 'none',
962
- borderColor: 'none',
963
- },
964
- };
965
-
966
- const iconAppearanceSuccess = {
967
- successPrimary: {
968
- fill: 'successPrimary',
969
- fillHover: 'successHoverPrimary',
970
- borderColor: 'successBorderPrimary',
971
- badgeAppearance: 'surfacePrimary',
972
- iconFill: 'successItemPrimary',
973
- },
974
- };
975
-
976
- const iconAppearanceSurface = {
977
- surfacePrimary: {
978
- fill: 'surfacePrimary',
979
- fillHover: 'surfaceHoverSecondary',
980
- borderColor: 'surfaceBorderTertiary',
981
- badgeAppearance: 'surfacePrimary',
982
- iconFill: 'surfaceItemPrimary',
983
- },
984
- surfaceQuaternary: {
985
- fill: 'surfaceQuaternary',
986
- fillHover: 'surfaceHoverQuaternary',
987
- badgeAppearance: 'accentPrimary',
988
- iconFill: 'surfaceItemPrimary',
989
- },
990
- surfaceSecondary: {
991
- fill: 'surfaceSecondary',
992
- fillHover: 'surfaceHoverSecondary',
993
- badgeAppearance: 'accentPrimary solid rounded',
994
- iconFill: 'surfaceItemPrimary',
995
- },
996
- surfaceTertiary: {
997
- fill: 'surfaceTertiary',
998
- fillHover: 'surfaceHoverTertiary',
999
- badgeAppearance: 'accentPrimary',
1000
- iconFill: 'surfaceItemPrimary',
1001
- },
1002
- };
1003
-
1004
- const iconAppearanceWarning = {
1005
- warningPrimary: {
1006
- fill: 'warningPrimary',
1007
- fillHover: 'warningHoverPrimary',
1008
- borderColor: 'warningBorderSecondary',
1009
- badgeAppearance: 'surfacePrimary',
1010
- iconFill: 'warningItemPrimary',
1011
- },
1012
- };
1013
-
1014
- const iconAppearance = {
1015
- ...iconAppearanceDisabled,
1016
- ...iconAppearanceSize,
1017
- ...iconAppearanceStyle,
1018
- ...iconAppearanceAccent,
1019
- ...iconAppearanceShape,
1020
- ...iconAppearanceDanger,
1021
- ...iconAppearanceError,
1022
- ...iconAppearanceInfo,
1023
- ...iconAppearanceSpecial,
1024
- ...iconAppearanceExtra,
1025
- ...iconAppearanceSuccess,
1026
- ...iconAppearanceSurface,
1027
- ...iconAppearanceWarning,
1028
- };
1029
-
1030
- const iconConfig = {
1031
- appearance: iconAppearance,
1032
- setAppearance: (appearanceConfig) => {
1033
- iconConfig.appearance = appearanceConfig;
1034
- },
1035
- };
1036
- const Icon = urlWithAssetPrefix(React.forwardRef(function Icon(props, ref) {
1037
- const { id, appearance, className, dataTestId, dataTour, width, height, badgeClass, href, imageSrc, link, linkRel, linkTarget, notification, saveFillStroke, showTooltip, SvgImage, before, after, isActive, isDisabled, isSkeleton, onClick, onMouseEnter, onMouseLeave, } = props;
1038
- const ImageComponent = useMemo(() => {
1039
- if (SvgImage) {
1040
- const SvgComponent = SvgImage;
1041
- const sizes = {};
1042
- if (width) {
1043
- sizes.width = width;
1044
- }
1045
- if (height) {
1046
- sizes.height = height;
1047
- }
1048
- return jsx(SvgComponent, { ...sizes });
1049
- }
1050
- if (imageSrc) {
1051
- if (imageSrc.endsWith('.svg')) {
1052
- if (saveFillStroke) {
1053
- return jsx(SVG, { src: imageSrc });
1054
- }
1055
- return jsx(SVG, { src: imageSrc, preProcessor: removeFillStroke });
1056
- }
1057
- return jsx("img", { src: imageSrc });
1058
- }
1059
- return null;
1060
- }, [SvgImage, imageSrc, width, height, saveFillStroke]);
1061
- const appearanceConfig = useAppearanceConfig(appearance, iconConfig, isDisabled);
1062
- const propsGenerator = useDevicePropsGenerator(props, appearanceConfig);
1063
- 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;
1064
- const { styles: iconStyles } = useStyles(props);
1065
- return (jsxs("div", { id: id, className: clsx(className, 'icon', !isActive
1066
- ? fillClass && `fill_${fillClass}`
1067
- : fillActiveClass && `fill_active_${fillActiveClass}`, !isActive
1068
- ? fillHoverClass && `fill_hover_${fillHoverClass}`
1069
- : fillActiveHoverClass &&
1070
- `fill_active_hover_${fillActiveHoverClass}`, fillSizeClass && `icon_fill_size_${fillSizeClass}`, fillDisabledClass && `fill_disabled_${fillDisabledClass}`, !isActive
1071
- ? iconFillClass && `icon_fill_${iconFillClass}`
1072
- : iconFillActiveClass && `icon_fill_active_${iconFillActiveClass}`, !isActive
1073
- ? iconFillHoverClass && `icon_fill_hover_${iconFillHoverClass}`
1074
- : iconFillActiveHoverClass &&
1075
- `icon_fill_active_hover_${iconFillActiveHoverClass}`, isDisabled &&
1076
- iconFillDisabledClass &&
1077
- `icon_fill_disabled_${iconFillDisabledClass}`, shapeClass && `shape_${shapeClass}`, shapeStrengthClass && `shape-strength_${shapeStrengthClass}`, borderColorClass && `border-color_${borderColorClass}`, borderColorHoverClass &&
1078
- `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-testid": dataTestId, "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, { appearance: mergeAppearanceKeys(badgeAppearance, badgeAppearanceSize), className: clsx(badgeClass, 'icon__badge'), size: badgeSize, textColor: badgeTextColor, textSize: badgeTextSize, shape: badgeShape, value: badgeValue })), showTooltip && (jsx(Tooltip, { appearance: tooltipAppearance, className: clsx(className, 'icon__tooltip', alignmentClass && `alignment_${alignmentClass}`), title: tooltipTitle, titleSize: tooltipTitleSize, text: tooltipText, textSize: tooltipTextSize }))] }), after] }));
1079
- }));
1080
- const removeFillStroke = (code) => {
1081
- return code
1082
- .replace(/fill=".*?"/g, 'fill=""')
1083
- .replace(/stroke=".*?"/g, 'stroke=""');
1084
- };
1085
-
1086
- export { Badge as B, Icon as I, Tooltip as T, tooltipConfig as a, Title as b, titleAppearance as c, titleConfig as d, iconConfig as e, badgeAppearance as f, badgeConfig as g, iconAppearance as i, tooltipAppearance as t };