@megafon/ui-core 4.6.0 → 4.8.0

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 (42) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/es/components/Accordion/Accordion.css +1 -0
  3. package/dist/es/components/Banner/BannerDot.d.ts +2 -0
  4. package/dist/es/components/Banner/BannerDot.js +6 -4
  5. package/dist/es/components/Button/Button.d.ts +2 -0
  6. package/dist/es/components/Button/Button.js +7 -5
  7. package/dist/es/components/Notification/Notification.d.ts +4 -0
  8. package/dist/es/components/Notification/Notification.js +7 -1
  9. package/dist/es/components/Search/Search.css +14 -0
  10. package/dist/es/components/Select/Select.css +2 -0
  11. package/dist/es/components/Tabs/Tabs.css +8 -5
  12. package/dist/es/components/Tabs/Tabs.d.ts +1 -0
  13. package/dist/es/components/Tabs/Tabs.js +4 -2
  14. package/dist/es/components/TextField/TextField.css +7 -0
  15. package/dist/es/components/TextField/TextField.js +3 -1
  16. package/dist/es/components/Tile/Tile.css +22 -6
  17. package/dist/es/components/Tile/Tile.d.ts +9 -5
  18. package/dist/es/components/Tile/Tile.js +11 -4
  19. package/dist/es/components/Tooltip/Tooltip.css +242 -71
  20. package/dist/es/components/Tooltip/Tooltip.d.ts +38 -0
  21. package/dist/es/components/Tooltip/Tooltip.js +162 -49
  22. package/dist/lib/components/Accordion/Accordion.css +1 -0
  23. package/dist/lib/components/Banner/BannerDot.d.ts +2 -0
  24. package/dist/lib/components/Banner/BannerDot.js +6 -4
  25. package/dist/lib/components/Button/Button.d.ts +2 -0
  26. package/dist/lib/components/Button/Button.js +7 -5
  27. package/dist/lib/components/Notification/Notification.d.ts +4 -0
  28. package/dist/lib/components/Notification/Notification.js +7 -1
  29. package/dist/lib/components/Search/Search.css +14 -0
  30. package/dist/lib/components/Select/Select.css +2 -0
  31. package/dist/lib/components/Tabs/Tabs.css +8 -5
  32. package/dist/lib/components/Tabs/Tabs.d.ts +1 -0
  33. package/dist/lib/components/Tabs/Tabs.js +4 -2
  34. package/dist/lib/components/TextField/TextField.css +7 -0
  35. package/dist/lib/components/TextField/TextField.js +3 -1
  36. package/dist/lib/components/Tile/Tile.css +22 -6
  37. package/dist/lib/components/Tile/Tile.d.ts +9 -5
  38. package/dist/lib/components/Tile/Tile.js +13 -6
  39. package/dist/lib/components/Tooltip/Tooltip.css +242 -71
  40. package/dist/lib/components/Tooltip/Tooltip.d.ts +38 -0
  41. package/dist/lib/components/Tooltip/Tooltip.js +168 -52
  42. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -3,6 +3,41 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [4.8.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.7.0...@megafon/ui-core@4.8.0) (2022-11-14)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **search:** fix scrollbar styles ([c8df5df](https://github.com/MegafonWebLab/megafon-ui/commit/c8df5df9787984a5eb9556b786ab8a6bee75dcb7))
12
+ * **select:** fix scrollbar styles ([15fdd41](https://github.com/MegafonWebLab/megafon-ui/commit/15fdd4170b600b8dad5f6144dadb86ae1d1e7cc0))
13
+ * **tabs:** update resize ([710895f](https://github.com/MegafonWebLab/megafon-ui/commit/710895f4c2f0899fb41ac08e7dde7b1636c24ed9))
14
+ * **textfield:** fix scrollbar styles ([8205a34](https://github.com/MegafonWebLab/megafon-ui/commit/8205a345dfe254a8f46fe4b1023f18761a5a9d29))
15
+
16
+
17
+ ### Features
18
+
19
+ * **tooltip:** add props and update design ([3bb935a](https://github.com/MegafonWebLab/megafon-ui/commit/3bb935ae0b8f302f4dd9a9ef58496e9f19e3cd2f))
20
+
21
+
22
+
23
+
24
+
25
+ # [4.7.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.6.0...@megafon/ui-core@4.7.0) (2022-11-07)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * **textfield:** fix right padding with hideIcon prop ([c2aeffd](https://github.com/MegafonWebLab/megafon-ui/commit/c2aeffd1e4c94c97aac23128b9f1ccff4ead9a81))
31
+
32
+
33
+ ### Features
34
+
35
+ * **tabs:** add gray color to tabColorTheme prop ([9d01119](https://github.com/MegafonWebLab/megafon-ui/commit/9d01119aef6ee6ef26e02c7b22efd17cb8a1147a))
36
+
37
+
38
+
39
+
40
+
6
41
  # [4.6.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.5.1...@megafon/ui-core@4.6.0) (2022-10-31)
7
42
 
8
43
 
@@ -14,6 +14,7 @@
14
14
  position: relative;
15
15
  padding: 24px 44px 24px 16px;
16
16
  border-radius: 12px;
17
+ outline: none;
17
18
  cursor: pointer;
18
19
  -webkit-transition: background-color 0.3s;
19
20
  transition: background-color 0.3s;
@@ -8,6 +8,8 @@ export interface IBannerDotProps {
8
8
  timerDelay: number;
9
9
  dataAttrs?: {
10
10
  root?: Record<string, string>;
11
+ svg?: Record<string, string>;
12
+ circle?: Record<string, string>;
11
13
  };
12
14
  onClick: (index: number) => void;
13
15
  }
@@ -22,10 +22,10 @@ var BannerDot = function BannerDot(_ref) {
22
22
  timer: showTimer
23
23
  }, className),
24
24
  onClick: handleDotClick
25
- }), showTimer && isActive && /*#__PURE__*/React.createElement("svg", {
25
+ }), showTimer && isActive && /*#__PURE__*/React.createElement("svg", _extends({
26
26
  className: cn('timer'),
27
27
  viewBox: "0 0 100 100"
28
- }, /*#__PURE__*/React.createElement("circle", {
28
+ }, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.svg)), /*#__PURE__*/React.createElement("circle", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.circle), {
29
29
  className: cn('timer-circle'),
30
30
  style: {
31
31
  animationDuration: "".concat(timerDelay, "s")
@@ -33,13 +33,15 @@ var BannerDot = function BannerDot(_ref) {
33
33
  cx: "50",
34
34
  cy: "50",
35
35
  r: "50"
36
- })));
36
+ }))));
37
37
  };
38
38
 
39
39
  BannerDot.propTypes = {
40
40
  className: PropTypes.string,
41
41
  dataAttrs: PropTypes.shape({
42
- root: PropTypes.objectOf(PropTypes.string.isRequired)
42
+ root: PropTypes.objectOf(PropTypes.string.isRequired),
43
+ svg: PropTypes.objectOf(PropTypes.string.isRequired),
44
+ circle: PropTypes.objectOf(PropTypes.string.isRequired)
43
45
  }),
44
46
  index: PropTypes.number.isRequired,
45
47
  isActive: PropTypes.bool.isRequired,
@@ -37,6 +37,8 @@ export interface IButtonProps {
37
37
  content?: Record<string, string>;
38
38
  inner?: Record<string, string>;
39
39
  loader?: Record<string, string>;
40
+ text?: Record<string, string>;
41
+ arrow?: Record<string, string>;
40
42
  };
41
43
  /** Тема компонента */
42
44
  theme?: ButtonThemesType;
@@ -130,14 +130,14 @@ var Button = function Button(_ref) {
130
130
  }, contentClassName)
131
131
  }), icon && /*#__PURE__*/React.createElement("div", {
132
132
  className: cn('icon')
133
- }, icon), children && /*#__PURE__*/React.createElement("span", {
133
+ }, icon), children && /*#__PURE__*/React.createElement("span", _extends({
134
134
  className: cn('text', {
135
135
  ellipsis: ellipsis
136
136
  })
137
- }, children), !icon && showArrow && /*#__PURE__*/React.createElement(Arrow, {
137
+ }, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.text)), children), !icon && showArrow && /*#__PURE__*/React.createElement(Arrow, _extends({
138
138
  className: cn('icon-arrow')
139
- }));
140
- }, [children, icon, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.content, contentClassName, showArrow, ellipsis]);
139
+ }, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrow))));
140
+ }, [children, icon, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.content, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.text, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrow, ellipsis, contentClassName, showArrow]);
141
141
  var contentType = React.useMemo(function () {
142
142
  switch (true) {
143
143
  case icon && !children:
@@ -222,7 +222,9 @@ Button.propTypes = {
222
222
  root: PropTypes.objectOf(PropTypes.string.isRequired),
223
223
  content: PropTypes.objectOf(PropTypes.string.isRequired),
224
224
  inner: PropTypes.objectOf(PropTypes.string.isRequired),
225
- loader: PropTypes.objectOf(PropTypes.string.isRequired)
225
+ loader: PropTypes.objectOf(PropTypes.string.isRequired),
226
+ text: PropTypes.objectOf(PropTypes.string.isRequired),
227
+ arrow: PropTypes.objectOf(PropTypes.string.isRequired)
226
228
  }),
227
229
  theme: PropTypes.oneOf(Object.values(ButtonThemes)),
228
230
  type: PropTypes.oneOf(Object.values(ButtonTypes)),
@@ -9,9 +9,13 @@ export declare const NotificationTypes: {
9
9
  declare type NotificationType = typeof NotificationTypes[keyof typeof NotificationTypes];
10
10
  export declare const ShadowTypes: {
11
11
  readonly ZERO: "zero";
12
+ /** @deprecated TODO: нужно удалить значение при выпуске мажорной версии */
12
13
  readonly LOW: "low";
14
+ /** @deprecated TODO: нужно удалить значение при выпуске мажорной версии */
13
15
  readonly HIGH: "high";
14
16
  readonly HOVER: "hover";
17
+ readonly PRESSED: "pressed";
18
+ readonly DEFAULT: "default";
15
19
  };
16
20
  declare type ShadowType = typeof ShadowTypes[keyof typeof ShadowTypes];
17
21
  export interface INotificationProps {
@@ -92,9 +92,15 @@ export var NotificationTypes = {
92
92
  };
93
93
  export var ShadowTypes = {
94
94
  ZERO: 'zero',
95
+
96
+ /** @deprecated TODO: нужно удалить значение при выпуске мажорной версии */
95
97
  LOW: 'low',
98
+
99
+ /** @deprecated TODO: нужно удалить значение при выпуске мажорной версии */
96
100
  HIGH: 'high',
97
- HOVER: 'hover'
101
+ HOVER: 'hover',
102
+ PRESSED: 'pressed',
103
+ DEFAULT: 'default'
98
104
  };
99
105
  var cn = cnCreate('mfui-notification');
100
106
 
@@ -231,6 +231,20 @@
231
231
  max-height: 368px;
232
232
  padding: 16px;
233
233
  overflow-y: auto;
234
+ scrollbar-width: thin;
235
+ scrollbar-color: var(--spbSky2) transparent;
236
+ }
237
+ .mfui-search__list-inner::-webkit-scrollbar {
238
+ width: 16px;
239
+ }
240
+ .mfui-search__list-inner::-webkit-scrollbar-thumb {
241
+ border: 6px solid transparent;
242
+ border-radius: 16px;
243
+ background-color: #D8D8D8;
244
+ background-clip: padding-box;
245
+ }
246
+ .mfui-search__list-inner::-webkit-scrollbar-thumb:hover {
247
+ background-color: #999999;
234
248
  }
235
249
  .mfui-search__list-item {
236
250
  font-family: inherit;
@@ -177,6 +177,8 @@
177
177
  max-height: 368px;
178
178
  padding: 16px;
179
179
  overflow-y: auto;
180
+ scrollbar-width: thin;
181
+ scrollbar-color: var(--spbSky2) transparent;
180
182
  }
181
183
  .mfui-select__list-inner_short {
182
184
  max-height: 235px;
@@ -149,8 +149,8 @@
149
149
  text-align: center;
150
150
  text-decoration: none;
151
151
  cursor: pointer;
152
- -webkit-transition: color 0.3s;
153
- transition: color 0.3s;
152
+ -webkit-transition: color 0.3s, fill 0.3s;
153
+ transition: color 0.3s, fill 0.3s;
154
154
  fill: var(--spbSky3);
155
155
  }
156
156
  .mfui-tabs__tab-inner:focus {
@@ -245,12 +245,15 @@
245
245
  z-index: 100;
246
246
  background-color: var(--base);
247
247
  }
248
+ .mfui-tabs_tab-color_gray .mfui-tabs__swiper {
249
+ background-color: var(--spbSky1);
250
+ }
248
251
  .mfui-tabs_tab-color_green:not(.mfui-tabs_sticky) .mfui-tabs__swiper {
249
- background-color: var(--stcBlack50);
252
+ background-color: var(--stcBlack20);
250
253
  }
251
254
  .mfui-tabs_tab-color_green:not(.mfui-tabs_sticky) .mfui-tabs__tab-inner:not(.mfui-tabs_tab-color_green:not(.mfui-tabs_sticky) .mfui-tabs__tab-inner_current) {
252
- color: var(--stcWhite50);
253
- fill: var(--stcWhite50);
255
+ color: #ffffffb2;
256
+ fill: #ffffffb2;
254
257
  }
255
258
  .mfui-tabs_tab-color_green:not(.mfui-tabs_sticky) .mfui-tabs__tab-inner:not(.mfui-tabs_tab-color_green:not(.mfui-tabs_sticky) .mfui-tabs__tab-inner_current):hover {
256
259
  color: var(--stcWhite);
@@ -12,6 +12,7 @@ export declare const TabSize: {
12
12
  export declare const TabColorTheme: {
13
13
  readonly WHITE: "white";
14
14
  readonly GREEN: "green";
15
+ readonly GRAY: "gray";
15
16
  };
16
17
  declare type TabSizeType = typeof TabSize[keyof typeof TabSize];
17
18
  declare type TabColorThemeType = typeof TabColorTheme[keyof typeof TabColorTheme];
@@ -32,7 +32,8 @@ export var TabSize = {
32
32
  };
33
33
  export var TabColorTheme = {
34
34
  WHITE: 'white',
35
- GREEN: 'green'
35
+ GREEN: 'green',
36
+ GRAY: 'gray'
36
37
  };
37
38
  var cn = cnCreate('mfui-tabs');
38
39
 
@@ -395,7 +396,8 @@ var Tabs = function Tabs(_ref) {
395
396
  onSwiper: handleSwiper,
396
397
  onReachBeginning: handleReachBeginning,
397
398
  onReachEnd: handleReachEnd,
398
- onFromEdge: handleFromEdge
399
+ onFromEdge: handleFromEdge,
400
+ observer: true
399
401
  }), renderTabs(), /*#__PURE__*/React.createElement("div", {
400
402
  className: cn('underline'),
401
403
  slot: "wrapper-start",
@@ -46,6 +46,9 @@
46
46
  transition: height 0.1s;
47
47
  will-change: height;
48
48
  }
49
+ .mfui-text-field__field_no-icon {
50
+ padding-right: 16px;
51
+ }
49
52
  .mfui-text-field__resizer {
50
53
  position: absolute;
51
54
  right: 0;
@@ -158,6 +161,10 @@
158
161
  font-size: 15px;
159
162
  line-height: 24px;
160
163
  }
164
+ .mfui-text-field__field_textarea {
165
+ scrollbar-width: thin;
166
+ scrollbar-color: var(--spbSky2) transparent;
167
+ }
161
168
  .mfui-text-field__field_textarea ~ .mfui-text-field__label {
162
169
  top: 16px;
163
170
  }
@@ -319,7 +319,9 @@ var TextField = function TextField(_ref) {
319
319
  });
320
320
 
321
321
  var inputParams = _extends(_extends({}, commonParams), {
322
- className: cn('field', classes === null || classes === void 0 ? void 0 : classes.input),
322
+ className: cn('field', {
323
+ 'no-icon': hideIcon
324
+ }, classes === null || classes === void 0 ? void 0 : classes.input),
323
325
  type: isVisiblePassword ? 'text' : type,
324
326
  autoComplete: autoComplete
325
327
  });
@@ -3,7 +3,7 @@
3
3
  background-color: var(--base);
4
4
  }
5
5
  .mfui-tile_radius_rounded {
6
- border-radius: 8px;
6
+ border-radius: 12px;
7
7
  }
8
8
  .mfui-tile_pointer {
9
9
  cursor: pointer;
@@ -16,11 +16,6 @@
16
16
  -webkit-box-shadow: 0 2px 9px rgba(0, 0, 0, 0.15);
17
17
  box-shadow: 0 2px 9px rgba(0, 0, 0, 0.15);
18
18
  }
19
- .mfui-tile_theme_light.mfui-tile_shadow_hover,
20
- .mfui-tile_theme_light.mfui-tile_interactive:hover {
21
- -webkit-box-shadow: 0 8px 28px rgba(0, 0, 0, 0.1);
22
- box-shadow: 0 8px 28px rgba(0, 0, 0, 0.1);
23
- }
24
19
  .mfui-tile_theme_dark.mfui-tile_shadow_low {
25
20
  -webkit-box-shadow: 0 0.25px 3px rgba(0, 0, 0, 0.45);
26
21
  box-shadow: 0 0.25px 3px rgba(0, 0, 0, 0.45);
@@ -29,6 +24,27 @@
29
24
  -webkit-box-shadow: 0 2px 9px rgba(0, 0, 0, 0.25);
30
25
  box-shadow: 0 2px 9px rgba(0, 0, 0, 0.25);
31
26
  }
27
+ .mfui-tile_theme_light.mfui-tile_shadow_default {
28
+ -webkit-box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
29
+ box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
30
+ }
31
+ .mfui-tile_theme_light.mfui-tile_shadow_pressed {
32
+ -webkit-box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
33
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
34
+ }
35
+ .mfui-tile_theme_light.mfui-tile_shadow_hover,
36
+ .mfui-tile_theme_light.mfui-tile_interactive:hover {
37
+ -webkit-box-shadow: 0 8px 28px rgba(0, 0, 0, 0.1);
38
+ box-shadow: 0 8px 28px rgba(0, 0, 0, 0.1);
39
+ }
40
+ .mfui-tile_theme_dark.mfui-tile_shadow_default {
41
+ -webkit-box-shadow: 0 2px 12px rgba(0, 0, 0, 0.16);
42
+ box-shadow: 0 2px 12px rgba(0, 0, 0, 0.16);
43
+ }
44
+ .mfui-tile_theme_dark.mfui-tile_shadow_pressed {
45
+ -webkit-box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
46
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
47
+ }
32
48
  .mfui-tile_theme_dark.mfui-tile_shadow_hover,
33
49
  .mfui-tile_theme_dark.mfui-tile_interactive:hover {
34
50
  -webkit-box-shadow: 0 8px 28px rgba(0, 0, 0, 0.2);
@@ -10,13 +10,17 @@ export declare const Radius: {
10
10
  readonly ROUNDED: "rounded";
11
11
  };
12
12
  declare type RadiusType = typeof Radius[keyof typeof Radius];
13
- export declare const Shadow: {
13
+ export declare const ShadowLevel: {
14
14
  readonly ZERO: "zero";
15
- readonly LOW: "low";
16
- readonly HIGH: "high";
15
+ readonly DEFAULT: "default";
17
16
  readonly HOVER: "hover";
17
+ readonly PRESSED: "pressed";
18
+ /** @deprecated TODO: нужно удалить значение при выпуске мажорной версии */
19
+ readonly HIGH: "high";
20
+ /** @deprecated TODO: нужно удалить значение при выпуске мажорной версии */
21
+ readonly LOW: "low";
18
22
  };
19
- declare type ShadowType = typeof Shadow[keyof typeof Shadow];
23
+ declare type ShadowLevelType = typeof ShadowLevel[keyof typeof ShadowLevel];
20
24
  export interface ITileProps {
21
25
  /** Ссылка */
22
26
  href?: string;
@@ -27,7 +31,7 @@ export interface ITileProps {
27
31
  /** Радиус границы */
28
32
  radius?: RadiusType;
29
33
  /** Уровень тени */
30
- shadowLevel?: ShadowType;
34
+ shadowLevel?: ShadowLevelType;
31
35
  /** Включить тень при наведении */
32
36
  isInteractive?: boolean;
33
37
  /** Дополнительный класс корневого элемента */
@@ -12,11 +12,17 @@ export var Radius = {
12
12
  DEFAULT: 'default',
13
13
  ROUNDED: 'rounded'
14
14
  };
15
- export var Shadow = {
15
+ export var ShadowLevel = {
16
16
  ZERO: 'zero',
17
- LOW: 'low',
17
+ DEFAULT: 'default',
18
+ HOVER: 'hover',
19
+ PRESSED: 'pressed',
20
+
21
+ /** @deprecated TODO: нужно удалить значение при выпуске мажорной версии */
18
22
  HIGH: 'high',
19
- HOVER: 'hover'
23
+
24
+ /** @deprecated TODO: нужно удалить значение при выпуске мажорной версии */
25
+ LOW: 'low'
20
26
  };
21
27
  var cn = cnCreate('mfui-tile');
22
28
 
@@ -44,6 +50,7 @@ var Tile = function Tile(_ref) {
44
50
  var isPointer = !!href || isInteractive;
45
51
  return /*#__PURE__*/React.createElement("div", _extends({
46
52
  className: cn({
53
+ // TODO: переименовать в shadowColor
47
54
  theme: theme,
48
55
  radius: radius,
49
56
  shadow: shadowLevel,
@@ -62,7 +69,7 @@ Tile.propTypes = {
62
69
  href: PropTypes.string,
63
70
  theme: PropTypes.oneOf(Object.values(Theme)),
64
71
  radius: PropTypes.oneOf(Object.values(Radius)),
65
- shadowLevel: PropTypes.oneOf(Object.values(Shadow)),
72
+ shadowLevel: PropTypes.oneOf(Object.values(ShadowLevel)),
66
73
  className: PropTypes.string,
67
74
  isInteractive: PropTypes.bool,
68
75
  onClick: PropTypes.func,