@salutejs/plasma-new-hope 0.248.0-canary.1719.12929292229.0 → 0.248.0-canary.1722.12945590646.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 (104) hide show
  1. package/cjs/components/Toast/Toast.css +7 -7
  2. package/cjs/components/Toast/Toast.js +2 -5
  3. package/cjs/components/Toast/Toast.js.map +1 -1
  4. package/cjs/components/Toast/Toast.styles.js +2 -11
  5. package/cjs/components/Toast/Toast.styles.js.map +1 -1
  6. package/cjs/components/Toast/{Toast.styles_1kasmzh.css → Toast.styles_1nei944.css} +2 -2
  7. package/cjs/components/Toast/Toast.tokens.js +1 -2
  8. package/cjs/components/Toast/Toast.tokens.js.map +1 -1
  9. package/cjs/components/Toast/ToastController.css +6 -6
  10. package/cjs/components/Toast/ToastProvider/ToastProvider.js +1 -6
  11. package/cjs/components/Toast/ToastProvider/ToastProvider.js.map +1 -1
  12. package/cjs/components/Toast/utils.js +0 -2
  13. package/cjs/components/Toast/utils.js.map +1 -1
  14. package/cjs/components/Toast/variations/_pilled/base.js +1 -1
  15. package/cjs/components/Toast/variations/_pilled/base.js.map +1 -1
  16. package/cjs/components/Toast/variations/_pilled/base_199qghc.css +1 -0
  17. package/cjs/index.css +8 -8
  18. package/emotion/cjs/components/Dropdown/Dropdown.template-doc.mdx +1 -1
  19. package/emotion/cjs/components/Toast/Toast.js +2 -5
  20. package/emotion/cjs/components/Toast/Toast.styles.js +6 -9
  21. package/emotion/cjs/components/Toast/Toast.template-doc.mdx +5 -22
  22. package/emotion/cjs/components/Toast/Toast.tokens.js +1 -2
  23. package/emotion/cjs/components/Toast/ToastProvider/ToastProvider.js +1 -6
  24. package/emotion/cjs/components/Toast/utils.js +1 -2
  25. package/emotion/cjs/components/Toast/variations/_pilled/base.js +1 -1
  26. package/emotion/cjs/examples/plasma_b2c/components/Toast/Toast.config.js +7 -17
  27. package/emotion/cjs/examples/plasma_b2c/components/Toast/Toast.stories.tsx +13 -31
  28. package/emotion/cjs/examples/plasma_web/components/Toast/Toast.config.js +7 -17
  29. package/emotion/cjs/examples/plasma_web/components/Toast/Toast.stories.tsx +13 -31
  30. package/emotion/es/components/Dropdown/Dropdown.template-doc.mdx +1 -1
  31. package/emotion/es/components/Toast/Toast.js +2 -5
  32. package/emotion/es/components/Toast/Toast.styles.js +6 -9
  33. package/emotion/es/components/Toast/Toast.template-doc.mdx +5 -22
  34. package/emotion/es/components/Toast/Toast.tokens.js +1 -2
  35. package/emotion/es/components/Toast/ToastProvider/ToastProvider.js +2 -7
  36. package/emotion/es/components/Toast/utils.js +0 -1
  37. package/emotion/es/components/Toast/variations/_pilled/base.js +1 -1
  38. package/emotion/es/examples/plasma_b2c/components/Toast/Toast.config.js +7 -17
  39. package/emotion/es/examples/plasma_b2c/components/Toast/Toast.stories.tsx +13 -31
  40. package/emotion/es/examples/plasma_web/components/Toast/Toast.config.js +7 -17
  41. package/emotion/es/examples/plasma_web/components/Toast/Toast.stories.tsx +13 -31
  42. package/es/components/Toast/Toast.css +7 -7
  43. package/es/components/Toast/Toast.js +2 -5
  44. package/es/components/Toast/Toast.js.map +1 -1
  45. package/es/components/Toast/Toast.styles.js +2 -11
  46. package/es/components/Toast/Toast.styles.js.map +1 -1
  47. package/es/components/Toast/{Toast.styles_1kasmzh.css → Toast.styles_1nei944.css} +2 -2
  48. package/es/components/Toast/Toast.tokens.js +1 -2
  49. package/es/components/Toast/Toast.tokens.js.map +1 -1
  50. package/es/components/Toast/ToastController.css +6 -6
  51. package/es/components/Toast/ToastProvider/ToastProvider.js +2 -7
  52. package/es/components/Toast/ToastProvider/ToastProvider.js.map +1 -1
  53. package/es/components/Toast/utils.js +1 -2
  54. package/es/components/Toast/utils.js.map +1 -1
  55. package/es/components/Toast/variations/_pilled/base.js +1 -1
  56. package/es/components/Toast/variations/_pilled/base.js.map +1 -1
  57. package/es/components/Toast/variations/_pilled/base_199qghc.css +1 -0
  58. package/es/index.css +8 -8
  59. package/package.json +2 -2
  60. package/styled-components/cjs/components/Dropdown/Dropdown.template-doc.mdx +1 -1
  61. package/styled-components/cjs/components/Toast/Toast.js +2 -5
  62. package/styled-components/cjs/components/Toast/Toast.styles.js +2 -5
  63. package/styled-components/cjs/components/Toast/Toast.template-doc.mdx +5 -22
  64. package/styled-components/cjs/components/Toast/Toast.tokens.js +1 -2
  65. package/styled-components/cjs/components/Toast/ToastProvider/ToastProvider.js +1 -6
  66. package/styled-components/cjs/components/Toast/utils.js +1 -2
  67. package/styled-components/cjs/components/Toast/variations/_pilled/base.js +1 -1
  68. package/styled-components/cjs/examples/plasma_b2c/components/Toast/Toast.config.js +2 -12
  69. package/styled-components/cjs/examples/plasma_b2c/components/Toast/Toast.stories.tsx +13 -31
  70. package/styled-components/cjs/examples/plasma_web/components/Toast/Toast.config.js +2 -12
  71. package/styled-components/cjs/examples/plasma_web/components/Toast/Toast.stories.tsx +13 -31
  72. package/styled-components/es/components/Dropdown/Dropdown.template-doc.mdx +1 -1
  73. package/styled-components/es/components/Toast/Toast.js +2 -5
  74. package/styled-components/es/components/Toast/Toast.styles.js +2 -5
  75. package/styled-components/es/components/Toast/Toast.template-doc.mdx +5 -22
  76. package/styled-components/es/components/Toast/Toast.tokens.js +1 -2
  77. package/styled-components/es/components/Toast/ToastProvider/ToastProvider.js +2 -7
  78. package/styled-components/es/components/Toast/utils.js +0 -1
  79. package/styled-components/es/components/Toast/variations/_pilled/base.js +1 -1
  80. package/styled-components/es/examples/plasma_b2c/components/Toast/Toast.config.js +2 -12
  81. package/styled-components/es/examples/plasma_b2c/components/Toast/Toast.stories.tsx +13 -31
  82. package/styled-components/es/examples/plasma_web/components/Toast/Toast.config.js +2 -12
  83. package/styled-components/es/examples/plasma_web/components/Toast/Toast.stories.tsx +13 -31
  84. package/types/components/Dropdown/ui/DropdownItem/DropdownItem.type.d.ts +1 -1
  85. package/types/components/Dropdown/ui/DropdownItem/DropdownItem.type.d.ts.map +1 -1
  86. package/types/components/Toast/Toast.styles.d.ts +1 -3
  87. package/types/components/Toast/Toast.styles.d.ts.map +1 -1
  88. package/types/components/Toast/Toast.tokens.d.ts +1 -2
  89. package/types/components/Toast/Toast.tokens.d.ts.map +1 -1
  90. package/types/components/Toast/Toast.types.d.ts +0 -8
  91. package/types/components/Toast/Toast.types.d.ts.map +1 -1
  92. package/types/components/Toast/ToastProvider/ToastProvider.d.ts.map +1 -1
  93. package/types/components/Toast/utils.d.ts +0 -1
  94. package/types/components/Toast/utils.d.ts.map +1 -1
  95. package/types/examples/plasma_b2c/components/Toast/Toast.config.d.ts +0 -10
  96. package/types/examples/plasma_b2c/components/Toast/Toast.config.d.ts.map +1 -1
  97. package/types/examples/plasma_b2c/components/Toast/Toast.d.ts +0 -2
  98. package/types/examples/plasma_b2c/components/Toast/Toast.d.ts.map +1 -1
  99. package/types/examples/plasma_web/components/Toast/Toast.config.d.ts +0 -10
  100. package/types/examples/plasma_web/components/Toast/Toast.config.d.ts.map +1 -1
  101. package/types/examples/plasma_web/components/Toast/Toast.d.ts +0 -2
  102. package/types/examples/plasma_web/components/Toast/Toast.d.ts.map +1 -1
  103. package/cjs/components/Toast/variations/_pilled/base_13i59v3.css +0 -1
  104. package/es/components/Toast/variations/_pilled/base_13i59v3.css +0 -1
@@ -4,39 +4,21 @@ import { action } from '@storybook/addon-actions';
4
4
  import styled from 'styled-components';
5
5
  import { disableProps } from '@salutejs/plasma-sb-utils';
6
6
 
7
- import { WithTheme } from '../../../_helpers';
7
+ import { toastConfig } from '../../../../components/Toast';
8
+ import { mergeConfig } from '../../../../engines';
9
+ import { WithTheme, argTypesFromConfig } from '../../../_helpers';
8
10
  import { Button } from '../Button/Button';
9
11
  import { PopupProvider } from '../Popup/Popup';
10
12
  import { addNotification } from '../../../../../src/components/Notification';
11
13
  import { NotificationsProvider } from '../Notification/Notification';
12
14
  import { Modal } from '../Modal/Modal';
13
15
 
16
+ import { config } from './Toast.config';
14
17
  import { Toast, ToastController, ToastProvider, useToast } from './Toast';
15
18
 
16
- const views = ['default', 'positive', 'negative'];
17
- const closeIconTypes = ['default', 'thin'];
18
-
19
19
  const meta: Meta<typeof ToastController> = {
20
20
  title: 'b2c/Overlay/Toast',
21
21
  decorators: [WithTheme],
22
- argTypes: {
23
- view: {
24
- options: views,
25
- control: {
26
- type: 'select',
27
- },
28
- },
29
- closeIconType: {
30
- options: closeIconTypes,
31
- control: {
32
- type: 'select',
33
- },
34
- },
35
- textColor: {
36
- control: 'color',
37
- },
38
- ...disableProps(['size']),
39
- },
40
22
  };
41
23
 
42
24
  export default meta;
@@ -79,7 +61,6 @@ const Container = styled.div`
79
61
  export const ToastComponent: StoryComponent = {
80
62
  args: {
81
63
  text: 'Текст всплывающего уведомления',
82
- textColor: undefined,
83
64
  view: 'default',
84
65
  closeIconType: 'default',
85
66
  size: 'm',
@@ -87,6 +68,14 @@ export const ToastComponent: StoryComponent = {
87
68
  enableContentLeft: true,
88
69
  pilled: false,
89
70
  },
71
+ argTypes: {
72
+ closeIconType: {
73
+ options: ['default', 'thin'],
74
+ control: {
75
+ type: 'select',
76
+ },
77
+ },
78
+ },
90
79
  render: ({ enableContentLeft, ...args }) => (
91
80
  <ToastContainer>
92
81
  <Toast contentLeft={enableContentLeft && <BellIcon width="1rem" height="1rem" />} {...args} />
@@ -105,8 +94,6 @@ const StoryLiveDemo = ({
105
94
  size,
106
95
  hasClose,
107
96
  enableContentLeft,
108
- closeIconType,
109
- textColor,
110
97
  }: StoryProps) => {
111
98
  const { showToast, hideToast } = useToast();
112
99
  const contentLeft = enableContentLeft && <BellIcon width="1rem" height="1rem" />;
@@ -127,8 +114,6 @@ const StoryLiveDemo = ({
127
114
  view,
128
115
  size,
129
116
  hasClose,
130
- closeIconType,
131
- textColor,
132
117
  onHide: action('onHide'),
133
118
  onShow: action('onShow'),
134
119
  });
@@ -156,6 +141,7 @@ export const LiveDemo: Story = {
156
141
  type: 'inline-radio',
157
142
  },
158
143
  },
144
+ ...argTypesFromConfig(mergeConfig(toastConfig, config)),
159
145
  ...disableProps(['role', 'onShow', 'onHide', 'contentLeft']),
160
146
  },
161
147
  parameters: {
@@ -181,8 +167,6 @@ const StoryComplex = ({
181
167
  size,
182
168
  hasClose,
183
169
  enableContentLeft,
184
- closeIconType,
185
- textColor,
186
170
  }: StoryProps) => {
187
171
  const [isModalOpen, setIsModalOpen] = useState(false);
188
172
 
@@ -201,8 +185,6 @@ const StoryComplex = ({
201
185
  view,
202
186
  size,
203
187
  hasClose,
204
- closeIconType,
205
- textColor,
206
188
  onHide: action('onHide'),
207
189
  onShow: action('onShow'),
208
190
  });
@@ -15,24 +15,14 @@ var config = exports.config = {
15
15
  variations: {
16
16
  view: {
17
17
  "default": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--text-primary);", ":var(--surface-solid-card-brightness);", ":var(--text-secondary);", ":var(--text-secondary);"], _Toast.toastTokens.color, _Toast.toastTokens.background, _Toast.toastTokens.closeIconColor, _Toast.toastTokens.closeIconColorOnHover),
18
- positive: /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--text-primary);", ":var(--surface-solid-card-brightness);", ":var(--text-positive);", ":var(--text-secondary);", ":var(--text-secondary);"], _Toast.toastTokens.color, _Toast.toastTokens.background, _Toast.toastTokens.contentLeftColor, _Toast.toastTokens.closeIconColor, _Toast.toastTokens.closeIconColorOnHover),
19
- negative: /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--text-primary);", ":var(--surface-solid-card-brightness);", ":var(--text-negative);", ":var(--text-secondary);", ":var(--text-secondary);"], _Toast.toastTokens.color, _Toast.toastTokens.background, _Toast.toastTokens.contentLeftColor, _Toast.toastTokens.closeIconColor, _Toast.toastTokens.closeIconColorOnHover),
20
- /**
21
- * @deprecated
22
- * светлый и темный фон регулировать через `view` компонента `ViewContainer`
23
- */
24
18
  dark: /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--on-dark-text-primary);", ":var(--on-dark-surface-solid-primary-brightness);", ":var(--on-dark-text-secondary);", ":var(--on-dark-text-secondary);"], _Toast.toastTokens.color, _Toast.toastTokens.background, _Toast.toastTokens.closeIconColor, _Toast.toastTokens.closeIconColorOnHover),
25
- /**
26
- * @deprecated
27
- * светлый и темный фон регулировать через `view` компонента `ViewContainer`
28
- */
29
19
  light: /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--on-light-text-primary);", ":var(--on-light-surface-solid-primary-brightness);", ":var(--on-light-text-secondary);", ":var(--on-light-text-secondary);"], _Toast.toastTokens.color, _Toast.toastTokens.background, _Toast.toastTokens.closeIconColor, _Toast.toastTokens.closeIconColorOnHover)
30
20
  },
31
21
  size: {
32
- m: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.75rem;", ":calc(100vw - 5rem);", ":0.5625rem 0.75rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":-0.0625rem 0.375rem -0.0625rem -0.125rem;", ":-0.0625rem -0.25rem -0.0625rem 0.5rem;"], _Toast.toastTokens.borderRadius, _Toast.toastTokens.maxWidth, _Toast.toastTokens.padding, _Toast.toastTokens.fontFamily, _Toast.toastTokens.fontSize, _Toast.toastTokens.fontStyle, _Toast.toastTokens.fontWeight, _Toast.toastTokens.letterSpacing, _Toast.toastTokens.lineHeight, _Toast.toastTokens.contentLeftMargin, _Toast.toastTokens.closeIconMargin)
22
+ m: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.75rem;", ":calc(100vw - 5rem);", ":0.5625rem 0.75rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":-0.0625rem 0.375rem -0.0625rem -0.125rem;", ":-0.0625rem -0.25rem -0.0625rem 0.5rem;"], _Toast.toastTokens.borderRadius, _Toast.toastTokens.maxWidth, _Toast.toastTokens.padding, _Toast.toastTokens.fontFamily, _Toast.toastTokens.fontSize, _Toast.toastTokens.fontStyle, _Toast.toastTokens.fontWeight, _Toast.toastTokens.letterSpacing, _Toast.toastTokens.lineHeight, _Toast.toastTokens.leftContentMargin, _Toast.toastTokens.closeIconMargin)
33
23
  },
34
24
  pilled: {
35
- "true": /*#__PURE__*/(0, _styledComponents.css)(["", ":1.5rem;", ":-0.0625rem 0.375rem -0.0625rem -0.25rem;", ":-0.0625rem -0.25rem -0.0625rem 0.375rem;"], _Toast.toastTokens.pilledBorderRadius, _Toast.toastTokens.contentLeftMargin, _Toast.toastTokens.closeIconMargin)
25
+ "true": /*#__PURE__*/(0, _styledComponents.css)(["", ":1.5rem;", ":-0.0625rem 0.375rem -0.0625rem -0.25rem;", ":-0.0625rem -0.25rem -0.0625rem 0.375rem;"], _Toast.toastTokens.pilledBorderRadius, _Toast.toastTokens.leftContentMargin, _Toast.toastTokens.closeIconMargin)
36
26
  },
37
27
  closeIconType: {
38
28
  "default": /*#__PURE__*/(0, _styledComponents.css)(["", ":1rem;", ":1.5rem;"], _Toast.toastTokens.closeIconButtonSize, _Toast.toastTokens.closeIconSize),
@@ -4,39 +4,21 @@ import { action } from '@storybook/addon-actions';
4
4
  import styled from 'styled-components';
5
5
  import { disableProps } from '@salutejs/plasma-sb-utils';
6
6
 
7
- import { WithTheme } from '../../../_helpers';
7
+ import { toastConfig } from '../../../../components/Toast';
8
+ import { mergeConfig } from '../../../../engines';
9
+ import { WithTheme, argTypesFromConfig } from '../../../_helpers';
8
10
  import { Button } from '../Button/Button';
9
11
  import { PopupProvider } from '../Popup/Popup';
10
12
  import { addNotification } from '../../../../../src/components/Notification';
11
13
  import { NotificationsProvider } from '../Notification/Notification';
12
14
  import { Modal } from '../Modal/Modal';
13
15
 
16
+ import { config } from './Toast.config';
14
17
  import { Toast, ToastController, ToastProvider, useToast } from './Toast';
15
18
 
16
- const views = ['default', 'positive', 'negative'];
17
- const closeIconTypes = ['default', 'thin'];
18
-
19
19
  const meta: Meta<typeof ToastController> = {
20
20
  title: 'web/Overlay/Toast',
21
21
  decorators: [WithTheme],
22
- argTypes: {
23
- view: {
24
- options: views,
25
- control: {
26
- type: 'select',
27
- },
28
- },
29
- closeIconType: {
30
- options: closeIconTypes,
31
- control: {
32
- type: 'select',
33
- },
34
- },
35
- textColor: {
36
- control: 'color',
37
- },
38
- ...disableProps(['size']),
39
- },
40
22
  };
41
23
 
42
24
  export default meta;
@@ -79,7 +61,6 @@ const Container = styled.div`
79
61
  export const ToastComponent: StoryComponent = {
80
62
  args: {
81
63
  text: 'Текст всплывающего уведомления',
82
- textColor: undefined,
83
64
  view: 'default',
84
65
  closeIconType: 'default',
85
66
  size: 'm',
@@ -87,6 +68,14 @@ export const ToastComponent: StoryComponent = {
87
68
  enableContentLeft: true,
88
69
  pilled: false,
89
70
  },
71
+ argTypes: {
72
+ closeIconType: {
73
+ options: ['default', 'thin'],
74
+ control: {
75
+ type: 'select',
76
+ },
77
+ },
78
+ },
90
79
  render: ({ enableContentLeft, ...args }) => (
91
80
  <ToastContainer>
92
81
  <Toast contentLeft={enableContentLeft && <BellIcon width="1rem" height="1rem" />} {...args} />
@@ -105,8 +94,6 @@ const StoryLiveDemo = ({
105
94
  size,
106
95
  hasClose,
107
96
  enableContentLeft,
108
- closeIconType,
109
- textColor,
110
97
  }: StoryProps) => {
111
98
  const { showToast, hideToast } = useToast();
112
99
  const contentLeft = enableContentLeft && <BellIcon width="1rem" height="1rem" />;
@@ -127,8 +114,6 @@ const StoryLiveDemo = ({
127
114
  view,
128
115
  size,
129
116
  hasClose,
130
- closeIconType,
131
- textColor,
132
117
  onHide: action('onHide'),
133
118
  onShow: action('onShow'),
134
119
  });
@@ -156,6 +141,7 @@ export const LiveDemo: Story = {
156
141
  type: 'inline-radio',
157
142
  },
158
143
  },
144
+ ...argTypesFromConfig(mergeConfig(toastConfig, config)),
159
145
  ...disableProps(['role', 'onShow', 'onHide', 'contentLeft']),
160
146
  },
161
147
  parameters: {
@@ -181,8 +167,6 @@ const StoryComplex = ({
181
167
  size,
182
168
  hasClose,
183
169
  enableContentLeft,
184
- closeIconType,
185
- textColor,
186
170
  }: StoryProps) => {
187
171
  const [isModalOpen, setIsModalOpen] = useState(false);
188
172
 
@@ -201,8 +185,6 @@ const StoryComplex = ({
201
185
  view,
202
186
  size,
203
187
  hasClose,
204
- closeIconType,
205
- textColor,
206
188
  onHide: action('onHide'),
207
189
  onShow: action('onShow'),
208
190
  });
@@ -32,7 +32,7 @@ type Items = Array<{
32
32
  /**
33
33
  * Сторона открытия вложенного дропдауна относительно текущего элемента;
34
34
  */
35
- placement: DropdownPlacement;
35
+ placement?: DropdownPlacement;
36
36
  /**
37
37
  * Список дочерних items.
38
38
  */
@@ -1,5 +1,5 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["role", "width", "text", "hasClose", "contentLeft", "view", "size", "pilled", "className", "style", "closeIconType", "onCloseButtonClick", "textColor"];
2
+ var _excluded = ["role", "width", "text", "hasClose", "contentLeft", "view", "size", "pilled", "className", "style", "closeIconType", "onCloseButtonClick"];
3
3
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
5
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -35,7 +35,6 @@ export var toastRoot = function toastRoot(Root) {
35
35
  style = props.style,
36
36
  closeIconType = props.closeIconType,
37
37
  onCloseButtonClick = props.onCloseButtonClick,
38
- textColor = props.textColor,
39
38
  rest = _objectWithoutProperties(props, _excluded);
40
39
  var pilledClass = pilled ? classes.toastPilled : undefined;
41
40
  var fixedWidth = !Number.isNaN(Number(width)) ? "".concat(width, "%") : width;
@@ -59,9 +58,7 @@ export var toastRoot = function toastRoot(Root) {
59
58
  role: role,
60
59
  "aria-live": ariaLive,
61
60
  "aria-atomic": ariaAtomic
62
- }, rest), contentLeft && /*#__PURE__*/React.createElement(StyledContentLeft, null, contentLeft), /*#__PURE__*/React.createElement(StyledContent, {
63
- textColor: textColor
64
- }, text), hasClose && /*#__PURE__*/React.createElement(CloseIconWrapper, {
61
+ }, rest), contentLeft && /*#__PURE__*/React.createElement(StyledContentLeft, null, contentLeft), /*#__PURE__*/React.createElement(StyledContent, null, text), hasClose && /*#__PURE__*/React.createElement(CloseIconWrapper, {
65
62
  view: "clear",
66
63
  size: "s",
67
64
  onClick: onCloseButtonClick,
@@ -34,10 +34,7 @@ export var StyledOverlay = /*#__PURE__*/styled(Overlay).withConfig({
34
34
  })(["&&.", "{animation:0.3s showFadeAnimation ease-out forwards;}&&.", "{animation:0.3s hideFadeAnimation ease-out forwards;}@keyframes showFadeAnimation{0%{opacity:0;}100%{opacity:1;}}@keyframes hideFadeAnimation{0%{opacity:1;}100%{opacity:0;}}"], /*#__PURE__*/String(classes.toastFadeShowed), /*#__PURE__*/String(classes.toastFadeHidden));
35
35
  export var StyledContentLeft = /*#__PURE__*/styled.div.withConfig({
36
36
  componentId: "plasma-new-hope__sc-19l9ekl-3"
37
- })(["display:flex;--plasma_private-content-left-margin:var(", ");margin:var(--plasma_private-content-left-margin);color:var(", ");"], tokens.contentLeftMargin, tokens.contentLeftColor);
37
+ })(["display:flex;--plasma_private-left-content-margin:var(", ");margin:var(--plasma_private-left-content-margin);"], tokens.leftContentMargin);
38
38
  export var StyledContent = /*#__PURE__*/styled.div.withConfig({
39
39
  componentId: "plasma-new-hope__sc-19l9ekl-4"
40
- })(["color:", ";"], function (_ref5) {
41
- var textColor = _ref5.textColor;
42
- return textColor || 'currentColor';
43
- });
40
+ })([""]);
@@ -104,10 +104,6 @@ export interface ShowToastArgs {
104
104
  * Время отображения подсказки. Если не передать значение, подсказка будет отображаться пока ее не закроют.
105
105
  */
106
106
  timeout?: number;
107
- /**
108
- * Цвет текста (по умолчанию берётся цвет из view)
109
- */
110
- textColor?: string;
111
107
  /**
112
108
  * callback срабатывающий в момент события hideToast
113
109
  */
@@ -121,11 +117,9 @@ export interface ShowToastArgs {
121
117
 
122
118
  ## Пример использования
123
119
 
124
- Для изменения цветовой темы компонента `Toast` используйте свойство `view` компонента `ViewContainer`.
125
-
126
120
  ```jsx live
127
121
  import React from 'react'
128
- import { useToast, ToastProvider, Button, ViewContainer } from '@salutejs/{{ package }}'
122
+ import { useToast, ToastProvider, Button } from '@salutejs/{{ package }}'
129
123
 
130
124
  export function App() {
131
125
 
@@ -136,13 +130,12 @@ export function App() {
136
130
  const onHide = () => {}
137
131
  const toastData = {
138
132
  text: 'Подсказка вызванная showToast',
139
- textColor: 'cyan',
140
133
  position: 'bottom',
141
134
  role: 'status',
142
135
  hasClose: true,
143
136
  fade: false,
144
137
  size: 'm',
145
- view: 'default',
138
+ view: 'dark',
146
139
  timeout: 3000,
147
140
  onShow,
148
141
  onHide
@@ -152,19 +145,9 @@ export function App() {
152
145
  }
153
146
 
154
147
  return (
155
- <div style=\{{ display: 'flex', gap: '1rem' }}>
156
- <ViewContainer view="onLight">
157
- <ToastProvider>
158
- <ToastExample />
159
- </ToastProvider>
160
- </ViewContainer>
161
-
162
- <ViewContainer view="onDark">
163
- <ToastProvider>
164
- <ToastExample />
165
- </ToastProvider>
166
- </ViewContainer>
167
- </div>
148
+ <ToastProvider>
149
+ <ToastExample />
150
+ </ToastProvider>
168
151
  )
169
152
  }
170
153
  ```
@@ -19,8 +19,7 @@ export var tokens = {
19
19
  letterSpacing: '--plasma-toast-letter-spacing',
20
20
  lineHeight: '--plasma-toast-lineheight',
21
21
  pilledBorderRadius: '--plasma-toast-pilled-border-radius',
22
- contentLeftMargin: '--plasma-toast-content-left-margin',
23
- contentLeftColor: '--plasma-toast-content-left-color',
22
+ leftContentMargin: '--plasma-toast-left-content-margin',
24
23
  closeIconMargin: '--plasma-toast-close-icon-margin',
25
24
  closeIconColor: '--plasma-toast-close-icon-color',
26
25
  closeIconColorOnHover: '--plasma-toast-close-icon-color-on-hover',
@@ -6,7 +6,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
8
8
  import React, { createContext, useCallback, useContext, useEffect, useRef, useState } from 'react';
9
- import { DEFAULT_CLOSE_ICON_TYPE, DEFAULT_FADE, DEFAULT_POSITION, TIMER_DELAY } from '../utils';
9
+ import { DEFAULT_FADE, DEFAULT_POSITION, TIMER_DELAY } from '../utils';
10
10
  export var ToastContext = /*#__PURE__*/createContext(null);
11
11
  export var useToastInner = function useToastInner() {
12
12
  var context = useContext(ToastContext);
@@ -118,9 +118,6 @@ export var ToastProviderHoc = function ToastProviderHoc(ToastComponent) {
118
118
  size = _getShowToastCallSign.size,
119
119
  view = _getShowToastCallSign.view,
120
120
  width = _getShowToastCallSign.width,
121
- _getShowToastCallSign4 = _getShowToastCallSign.closeIconType,
122
- closeIconType = _getShowToastCallSign4 === void 0 ? DEFAULT_CLOSE_ICON_TYPE : _getShowToastCallSign4,
123
- textColor = _getShowToastCallSign.textColor,
124
121
  onHide = _getShowToastCallSign.onHide,
125
122
  onShow = _getShowToastCallSign.onShow;
126
123
  setToastProps({
@@ -134,9 +131,7 @@ export var ToastProviderHoc = function ToastProviderHoc(ToastComponent) {
134
131
  pilled: pilled,
135
132
  hasClose: hasClose,
136
133
  size: size,
137
- view: view,
138
- closeIconType: closeIconType,
139
- textColor: textColor
134
+ view: view
140
135
  });
141
136
  setToastInfo({
142
137
  timeout: timeout,
@@ -2,7 +2,6 @@ import { buttonConfig } from '../Button';
2
2
  import { component, mergeConfig } from '../../engines';
3
3
  export var DEFAULT_FADE = true;
4
4
  export var DEFAULT_POSITION = 'bottom';
5
- export var DEFAULT_CLOSE_ICON_TYPE = 'default';
6
5
  export var TIMER_DELAY = 300;
7
6
  export var FADE_Z_INDEX = '9900';
8
7
  export var TOAST_Z_INDEX = '9901';
@@ -1,3 +1,3 @@
1
1
  import { css } from 'styled-components';
2
2
  import { classes, tokens } from '../../Toast.tokens';
3
- export var base = /*#__PURE__*/css(["&.", "{--plasma_private-content-left-margin:var(", ");--plasma_private-close-icon-margin:var(", ");border-radius:var(", ");}"], /*#__PURE__*/String(classes.toastPilled), tokens.contentLeftMargin, tokens.closeIconMargin, tokens.pilledBorderRadius);
3
+ export var base = /*#__PURE__*/css(["&.", "{--plasma_private-left-content-margin:var(", ");--plasma_private-close-icon-margin:var(", ");border-radius:var(", ");}"], /*#__PURE__*/String(classes.toastPilled), tokens.leftContentMargin, tokens.closeIconMargin, tokens.pilledBorderRadius);
@@ -9,24 +9,14 @@ export var config = {
9
9
  variations: {
10
10
  view: {
11
11
  "default": /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--surface-solid-card-brightness);", ":var(--text-secondary);", ":var(--text-secondary);"], toastTokens.color, toastTokens.background, toastTokens.closeIconColor, toastTokens.closeIconColorOnHover),
12
- positive: /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--surface-solid-card-brightness);", ":var(--text-positive);", ":var(--text-secondary);", ":var(--text-secondary);"], toastTokens.color, toastTokens.background, toastTokens.contentLeftColor, toastTokens.closeIconColor, toastTokens.closeIconColorOnHover),
13
- negative: /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--surface-solid-card-brightness);", ":var(--text-negative);", ":var(--text-secondary);", ":var(--text-secondary);"], toastTokens.color, toastTokens.background, toastTokens.contentLeftColor, toastTokens.closeIconColor, toastTokens.closeIconColorOnHover),
14
- /**
15
- * @deprecated
16
- * светлый и темный фон регулировать через `view` компонента `ViewContainer`
17
- */
18
12
  dark: /*#__PURE__*/css(["", ":var(--on-dark-text-primary);", ":var(--on-dark-surface-solid-primary-brightness);", ":var(--on-dark-text-secondary);", ":var(--on-dark-text-secondary);"], toastTokens.color, toastTokens.background, toastTokens.closeIconColor, toastTokens.closeIconColorOnHover),
19
- /**
20
- * @deprecated
21
- * светлый и темный фон регулировать через `view` компонента `ViewContainer`
22
- */
23
13
  light: /*#__PURE__*/css(["", ":var(--on-light-text-primary);", ":var(--on-light-surface-solid-primary-brightness);", ":var(--on-light-text-secondary);", ":var(--on-light-text-secondary);"], toastTokens.color, toastTokens.background, toastTokens.closeIconColor, toastTokens.closeIconColorOnHover)
24
14
  },
25
15
  size: {
26
- m: /*#__PURE__*/css(["", ":0.75rem;", ":calc(100vw - 5rem);", ":0.5625rem 0.75rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":-0.0625rem 0.375rem -0.0625rem -0.125rem;", ":-0.0625rem -0.25rem -0.0625rem 0.5rem;"], toastTokens.borderRadius, toastTokens.maxWidth, toastTokens.padding, toastTokens.fontFamily, toastTokens.fontSize, toastTokens.fontStyle, toastTokens.fontWeight, toastTokens.letterSpacing, toastTokens.lineHeight, toastTokens.contentLeftMargin, toastTokens.closeIconMargin)
16
+ m: /*#__PURE__*/css(["", ":0.75rem;", ":calc(100vw - 5rem);", ":0.5625rem 0.75rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":-0.0625rem 0.375rem -0.0625rem -0.125rem;", ":-0.0625rem -0.25rem -0.0625rem 0.5rem;"], toastTokens.borderRadius, toastTokens.maxWidth, toastTokens.padding, toastTokens.fontFamily, toastTokens.fontSize, toastTokens.fontStyle, toastTokens.fontWeight, toastTokens.letterSpacing, toastTokens.lineHeight, toastTokens.leftContentMargin, toastTokens.closeIconMargin)
27
17
  },
28
18
  pilled: {
29
- "true": /*#__PURE__*/css(["", ":1.5rem;", ":-0.0625rem 0.375rem -0.0625rem -0.25rem;", ":-0.0625rem -0.25rem -0.0625rem 0.375rem;"], toastTokens.pilledBorderRadius, toastTokens.contentLeftMargin, toastTokens.closeIconMargin)
19
+ "true": /*#__PURE__*/css(["", ":1.5rem;", ":-0.0625rem 0.375rem -0.0625rem -0.25rem;", ":-0.0625rem -0.25rem -0.0625rem 0.375rem;"], toastTokens.pilledBorderRadius, toastTokens.leftContentMargin, toastTokens.closeIconMargin)
30
20
  },
31
21
  closeIconType: {
32
22
  "default": /*#__PURE__*/css(["", ":1rem;", ":1.5rem;"], toastTokens.closeIconButtonSize, toastTokens.closeIconSize),
@@ -4,39 +4,21 @@ import { action } from '@storybook/addon-actions';
4
4
  import styled from 'styled-components';
5
5
  import { disableProps } from '@salutejs/plasma-sb-utils';
6
6
 
7
- import { WithTheme } from '../../../_helpers';
7
+ import { toastConfig } from '../../../../components/Toast';
8
+ import { mergeConfig } from '../../../../engines';
9
+ import { WithTheme, argTypesFromConfig } from '../../../_helpers';
8
10
  import { Button } from '../Button/Button';
9
11
  import { PopupProvider } from '../Popup/Popup';
10
12
  import { addNotification } from '../../../../../src/components/Notification';
11
13
  import { NotificationsProvider } from '../Notification/Notification';
12
14
  import { Modal } from '../Modal/Modal';
13
15
 
16
+ import { config } from './Toast.config';
14
17
  import { Toast, ToastController, ToastProvider, useToast } from './Toast';
15
18
 
16
- const views = ['default', 'positive', 'negative'];
17
- const closeIconTypes = ['default', 'thin'];
18
-
19
19
  const meta: Meta<typeof ToastController> = {
20
20
  title: 'b2c/Overlay/Toast',
21
21
  decorators: [WithTheme],
22
- argTypes: {
23
- view: {
24
- options: views,
25
- control: {
26
- type: 'select',
27
- },
28
- },
29
- closeIconType: {
30
- options: closeIconTypes,
31
- control: {
32
- type: 'select',
33
- },
34
- },
35
- textColor: {
36
- control: 'color',
37
- },
38
- ...disableProps(['size']),
39
- },
40
22
  };
41
23
 
42
24
  export default meta;
@@ -79,7 +61,6 @@ const Container = styled.div`
79
61
  export const ToastComponent: StoryComponent = {
80
62
  args: {
81
63
  text: 'Текст всплывающего уведомления',
82
- textColor: undefined,
83
64
  view: 'default',
84
65
  closeIconType: 'default',
85
66
  size: 'm',
@@ -87,6 +68,14 @@ export const ToastComponent: StoryComponent = {
87
68
  enableContentLeft: true,
88
69
  pilled: false,
89
70
  },
71
+ argTypes: {
72
+ closeIconType: {
73
+ options: ['default', 'thin'],
74
+ control: {
75
+ type: 'select',
76
+ },
77
+ },
78
+ },
90
79
  render: ({ enableContentLeft, ...args }) => (
91
80
  <ToastContainer>
92
81
  <Toast contentLeft={enableContentLeft && <BellIcon width="1rem" height="1rem" />} {...args} />
@@ -105,8 +94,6 @@ const StoryLiveDemo = ({
105
94
  size,
106
95
  hasClose,
107
96
  enableContentLeft,
108
- closeIconType,
109
- textColor,
110
97
  }: StoryProps) => {
111
98
  const { showToast, hideToast } = useToast();
112
99
  const contentLeft = enableContentLeft && <BellIcon width="1rem" height="1rem" />;
@@ -127,8 +114,6 @@ const StoryLiveDemo = ({
127
114
  view,
128
115
  size,
129
116
  hasClose,
130
- closeIconType,
131
- textColor,
132
117
  onHide: action('onHide'),
133
118
  onShow: action('onShow'),
134
119
  });
@@ -156,6 +141,7 @@ export const LiveDemo: Story = {
156
141
  type: 'inline-radio',
157
142
  },
158
143
  },
144
+ ...argTypesFromConfig(mergeConfig(toastConfig, config)),
159
145
  ...disableProps(['role', 'onShow', 'onHide', 'contentLeft']),
160
146
  },
161
147
  parameters: {
@@ -181,8 +167,6 @@ const StoryComplex = ({
181
167
  size,
182
168
  hasClose,
183
169
  enableContentLeft,
184
- closeIconType,
185
- textColor,
186
170
  }: StoryProps) => {
187
171
  const [isModalOpen, setIsModalOpen] = useState(false);
188
172
 
@@ -201,8 +185,6 @@ const StoryComplex = ({
201
185
  view,
202
186
  size,
203
187
  hasClose,
204
- closeIconType,
205
- textColor,
206
188
  onHide: action('onHide'),
207
189
  onShow: action('onShow'),
208
190
  });
@@ -9,24 +9,14 @@ export var config = {
9
9
  variations: {
10
10
  view: {
11
11
  "default": /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--surface-solid-card-brightness);", ":var(--text-secondary);", ":var(--text-secondary);"], toastTokens.color, toastTokens.background, toastTokens.closeIconColor, toastTokens.closeIconColorOnHover),
12
- positive: /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--surface-solid-card-brightness);", ":var(--text-positive);", ":var(--text-secondary);", ":var(--text-secondary);"], toastTokens.color, toastTokens.background, toastTokens.contentLeftColor, toastTokens.closeIconColor, toastTokens.closeIconColorOnHover),
13
- negative: /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--surface-solid-card-brightness);", ":var(--text-negative);", ":var(--text-secondary);", ":var(--text-secondary);"], toastTokens.color, toastTokens.background, toastTokens.contentLeftColor, toastTokens.closeIconColor, toastTokens.closeIconColorOnHover),
14
- /**
15
- * @deprecated
16
- * светлый и темный фон регулировать через `view` компонента `ViewContainer`
17
- */
18
12
  dark: /*#__PURE__*/css(["", ":var(--on-dark-text-primary);", ":var(--on-dark-surface-solid-primary-brightness);", ":var(--on-dark-text-secondary);", ":var(--on-dark-text-secondary);"], toastTokens.color, toastTokens.background, toastTokens.closeIconColor, toastTokens.closeIconColorOnHover),
19
- /**
20
- * @deprecated
21
- * светлый и темный фон регулировать через `view` компонента `ViewContainer`
22
- */
23
13
  light: /*#__PURE__*/css(["", ":var(--on-light-text-primary);", ":var(--on-light-surface-solid-primary-brightness);", ":var(--on-light-text-secondary);", ":var(--on-light-text-secondary);"], toastTokens.color, toastTokens.background, toastTokens.closeIconColor, toastTokens.closeIconColorOnHover)
24
14
  },
25
15
  size: {
26
- m: /*#__PURE__*/css(["", ":0.75rem;", ":calc(100vw - 5rem);", ":0.5625rem 0.75rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":-0.0625rem 0.375rem -0.0625rem -0.125rem;", ":-0.0625rem -0.25rem -0.0625rem 0.5rem;"], toastTokens.borderRadius, toastTokens.maxWidth, toastTokens.padding, toastTokens.fontFamily, toastTokens.fontSize, toastTokens.fontStyle, toastTokens.fontWeight, toastTokens.letterSpacing, toastTokens.lineHeight, toastTokens.contentLeftMargin, toastTokens.closeIconMargin)
16
+ m: /*#__PURE__*/css(["", ":0.75rem;", ":calc(100vw - 5rem);", ":0.5625rem 0.75rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":-0.0625rem 0.375rem -0.0625rem -0.125rem;", ":-0.0625rem -0.25rem -0.0625rem 0.5rem;"], toastTokens.borderRadius, toastTokens.maxWidth, toastTokens.padding, toastTokens.fontFamily, toastTokens.fontSize, toastTokens.fontStyle, toastTokens.fontWeight, toastTokens.letterSpacing, toastTokens.lineHeight, toastTokens.leftContentMargin, toastTokens.closeIconMargin)
27
17
  },
28
18
  pilled: {
29
- "true": /*#__PURE__*/css(["", ":1.5rem;", ":-0.0625rem 0.375rem -0.0625rem -0.25rem;", ":-0.0625rem -0.25rem -0.0625rem 0.375rem;"], toastTokens.pilledBorderRadius, toastTokens.contentLeftMargin, toastTokens.closeIconMargin)
19
+ "true": /*#__PURE__*/css(["", ":1.5rem;", ":-0.0625rem 0.375rem -0.0625rem -0.25rem;", ":-0.0625rem -0.25rem -0.0625rem 0.375rem;"], toastTokens.pilledBorderRadius, toastTokens.leftContentMargin, toastTokens.closeIconMargin)
30
20
  },
31
21
  closeIconType: {
32
22
  "default": /*#__PURE__*/css(["", ":1rem;", ":1.5rem;"], toastTokens.closeIconButtonSize, toastTokens.closeIconSize),