@salutejs/plasma-new-hope 0.247.0 → 0.248.0-canary.1719.12929292229.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 (98) hide show
  1. package/cjs/components/Toast/Toast.css +7 -7
  2. package/cjs/components/Toast/Toast.js +5 -2
  3. package/cjs/components/Toast/Toast.js.map +1 -1
  4. package/cjs/components/Toast/Toast.styles.js +11 -2
  5. package/cjs/components/Toast/Toast.styles.js.map +1 -1
  6. package/cjs/components/Toast/{Toast.styles_1nei944.css → Toast.styles_1kasmzh.css} +2 -2
  7. package/cjs/components/Toast/Toast.tokens.js +2 -1
  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 +6 -1
  11. package/cjs/components/Toast/ToastProvider/ToastProvider.js.map +1 -1
  12. package/cjs/components/Toast/utils.js +2 -0
  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_13i59v3.css +1 -0
  17. package/cjs/index.css +8 -8
  18. package/emotion/cjs/components/Toast/Toast.js +5 -2
  19. package/emotion/cjs/components/Toast/Toast.styles.js +9 -6
  20. package/emotion/cjs/components/Toast/Toast.template-doc.mdx +22 -5
  21. package/emotion/cjs/components/Toast/Toast.tokens.js +2 -1
  22. package/emotion/cjs/components/Toast/ToastProvider/ToastProvider.js +6 -1
  23. package/emotion/cjs/components/Toast/utils.js +2 -1
  24. package/emotion/cjs/components/Toast/variations/_pilled/base.js +1 -1
  25. package/emotion/cjs/examples/plasma_b2c/components/Toast/Toast.config.js +17 -7
  26. package/emotion/cjs/examples/plasma_b2c/components/Toast/Toast.stories.tsx +31 -13
  27. package/emotion/cjs/examples/plasma_web/components/Toast/Toast.config.js +17 -7
  28. package/emotion/cjs/examples/plasma_web/components/Toast/Toast.stories.tsx +31 -13
  29. package/emotion/es/components/Toast/Toast.js +5 -2
  30. package/emotion/es/components/Toast/Toast.styles.js +9 -6
  31. package/emotion/es/components/Toast/Toast.template-doc.mdx +22 -5
  32. package/emotion/es/components/Toast/Toast.tokens.js +2 -1
  33. package/emotion/es/components/Toast/ToastProvider/ToastProvider.js +7 -2
  34. package/emotion/es/components/Toast/utils.js +1 -0
  35. package/emotion/es/components/Toast/variations/_pilled/base.js +1 -1
  36. package/emotion/es/examples/plasma_b2c/components/Toast/Toast.config.js +17 -7
  37. package/emotion/es/examples/plasma_b2c/components/Toast/Toast.stories.tsx +31 -13
  38. package/emotion/es/examples/plasma_web/components/Toast/Toast.config.js +17 -7
  39. package/emotion/es/examples/plasma_web/components/Toast/Toast.stories.tsx +31 -13
  40. package/es/components/Toast/Toast.css +7 -7
  41. package/es/components/Toast/Toast.js +5 -2
  42. package/es/components/Toast/Toast.js.map +1 -1
  43. package/es/components/Toast/Toast.styles.js +11 -2
  44. package/es/components/Toast/Toast.styles.js.map +1 -1
  45. package/es/components/Toast/{Toast.styles_1nei944.css → Toast.styles_1kasmzh.css} +2 -2
  46. package/es/components/Toast/Toast.tokens.js +2 -1
  47. package/es/components/Toast/Toast.tokens.js.map +1 -1
  48. package/es/components/Toast/ToastController.css +6 -6
  49. package/es/components/Toast/ToastProvider/ToastProvider.js +7 -2
  50. package/es/components/Toast/ToastProvider/ToastProvider.js.map +1 -1
  51. package/es/components/Toast/utils.js +2 -1
  52. package/es/components/Toast/utils.js.map +1 -1
  53. package/es/components/Toast/variations/_pilled/base.js +1 -1
  54. package/es/components/Toast/variations/_pilled/base.js.map +1 -1
  55. package/es/components/Toast/variations/_pilled/base_13i59v3.css +1 -0
  56. package/es/index.css +8 -8
  57. package/package.json +2 -2
  58. package/styled-components/cjs/components/Toast/Toast.js +5 -2
  59. package/styled-components/cjs/components/Toast/Toast.styles.js +5 -2
  60. package/styled-components/cjs/components/Toast/Toast.template-doc.mdx +22 -5
  61. package/styled-components/cjs/components/Toast/Toast.tokens.js +2 -1
  62. package/styled-components/cjs/components/Toast/ToastProvider/ToastProvider.js +6 -1
  63. package/styled-components/cjs/components/Toast/utils.js +2 -1
  64. package/styled-components/cjs/components/Toast/variations/_pilled/base.js +1 -1
  65. package/styled-components/cjs/examples/plasma_b2c/components/Toast/Toast.config.js +12 -2
  66. package/styled-components/cjs/examples/plasma_b2c/components/Toast/Toast.stories.tsx +31 -13
  67. package/styled-components/cjs/examples/plasma_web/components/Toast/Toast.config.js +12 -2
  68. package/styled-components/cjs/examples/plasma_web/components/Toast/Toast.stories.tsx +31 -13
  69. package/styled-components/es/components/Toast/Toast.js +5 -2
  70. package/styled-components/es/components/Toast/Toast.styles.js +5 -2
  71. package/styled-components/es/components/Toast/Toast.template-doc.mdx +22 -5
  72. package/styled-components/es/components/Toast/Toast.tokens.js +2 -1
  73. package/styled-components/es/components/Toast/ToastProvider/ToastProvider.js +7 -2
  74. package/styled-components/es/components/Toast/utils.js +1 -0
  75. package/styled-components/es/components/Toast/variations/_pilled/base.js +1 -1
  76. package/styled-components/es/examples/plasma_b2c/components/Toast/Toast.config.js +12 -2
  77. package/styled-components/es/examples/plasma_b2c/components/Toast/Toast.stories.tsx +31 -13
  78. package/styled-components/es/examples/plasma_web/components/Toast/Toast.config.js +12 -2
  79. package/styled-components/es/examples/plasma_web/components/Toast/Toast.stories.tsx +31 -13
  80. package/types/components/Toast/Toast.styles.d.ts +3 -1
  81. package/types/components/Toast/Toast.styles.d.ts.map +1 -1
  82. package/types/components/Toast/Toast.tokens.d.ts +2 -1
  83. package/types/components/Toast/Toast.tokens.d.ts.map +1 -1
  84. package/types/components/Toast/Toast.types.d.ts +8 -0
  85. package/types/components/Toast/Toast.types.d.ts.map +1 -1
  86. package/types/components/Toast/ToastProvider/ToastProvider.d.ts.map +1 -1
  87. package/types/components/Toast/utils.d.ts +1 -0
  88. package/types/components/Toast/utils.d.ts.map +1 -1
  89. package/types/examples/plasma_b2c/components/Toast/Toast.config.d.ts +10 -0
  90. package/types/examples/plasma_b2c/components/Toast/Toast.config.d.ts.map +1 -1
  91. package/types/examples/plasma_b2c/components/Toast/Toast.d.ts +2 -0
  92. package/types/examples/plasma_b2c/components/Toast/Toast.d.ts.map +1 -1
  93. package/types/examples/plasma_web/components/Toast/Toast.config.d.ts +10 -0
  94. package/types/examples/plasma_web/components/Toast/Toast.config.d.ts.map +1 -1
  95. package/types/examples/plasma_web/components/Toast/Toast.d.ts +2 -0
  96. package/types/examples/plasma_web/components/Toast/Toast.d.ts.map +1 -1
  97. package/cjs/components/Toast/variations/_pilled/base_199qghc.css +0 -1
  98. package/es/components/Toast/variations/_pilled/base_199qghc.css +0 -1
@@ -4,21 +4,39 @@ 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 { toastConfig } from '../../../../components/Toast';
8
- import { mergeConfig } from '../../../../engines';
9
- import { WithTheme, argTypesFromConfig } from '../../../_helpers';
7
+ import { WithTheme } from '../../../_helpers';
10
8
  import { Button } from '../Button/Button';
11
9
  import { PopupProvider } from '../Popup/Popup';
12
10
  import { addNotification } from '../../../../../src/components/Notification';
13
11
  import { NotificationsProvider } from '../Notification/Notification';
14
12
  import { Modal } from '../Modal/Modal';
15
13
 
16
- import { config } from './Toast.config';
17
14
  import { Toast, ToastController, ToastProvider, useToast } from './Toast';
18
15
 
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
+ },
22
40
  };
23
41
 
24
42
  export default meta;
@@ -61,6 +79,7 @@ const Container = styled.div`
61
79
  export const ToastComponent: StoryComponent = {
62
80
  args: {
63
81
  text: 'Текст всплывающего уведомления',
82
+ textColor: undefined,
64
83
  view: 'default',
65
84
  closeIconType: 'default',
66
85
  size: 'm',
@@ -68,14 +87,6 @@ export const ToastComponent: StoryComponent = {
68
87
  enableContentLeft: true,
69
88
  pilled: false,
70
89
  },
71
- argTypes: {
72
- closeIconType: {
73
- options: ['default', 'thin'],
74
- control: {
75
- type: 'select',
76
- },
77
- },
78
- },
79
90
  render: ({ enableContentLeft, ...args }) => (
80
91
  <ToastContainer>
81
92
  <Toast contentLeft={enableContentLeft && <BellIcon width="1rem" height="1rem" />} {...args} />
@@ -94,6 +105,8 @@ const StoryLiveDemo = ({
94
105
  size,
95
106
  hasClose,
96
107
  enableContentLeft,
108
+ closeIconType,
109
+ textColor,
97
110
  }: StoryProps) => {
98
111
  const { showToast, hideToast } = useToast();
99
112
  const contentLeft = enableContentLeft && <BellIcon width="1rem" height="1rem" />;
@@ -114,6 +127,8 @@ const StoryLiveDemo = ({
114
127
  view,
115
128
  size,
116
129
  hasClose,
130
+ closeIconType,
131
+ textColor,
117
132
  onHide: action('onHide'),
118
133
  onShow: action('onShow'),
119
134
  });
@@ -141,7 +156,6 @@ export const LiveDemo: Story = {
141
156
  type: 'inline-radio',
142
157
  },
143
158
  },
144
- ...argTypesFromConfig(mergeConfig(toastConfig, config)),
145
159
  ...disableProps(['role', 'onShow', 'onHide', 'contentLeft']),
146
160
  },
147
161
  parameters: {
@@ -167,6 +181,8 @@ const StoryComplex = ({
167
181
  size,
168
182
  hasClose,
169
183
  enableContentLeft,
184
+ closeIconType,
185
+ textColor,
170
186
  }: StoryProps) => {
171
187
  const [isModalOpen, setIsModalOpen] = useState(false);
172
188
 
@@ -185,6 +201,8 @@ const StoryComplex = ({
185
201
  view,
186
202
  size,
187
203
  hasClose,
204
+ closeIconType,
205
+ textColor,
188
206
  onHide: action('onHide'),
189
207
  onShow: action('onShow'),
190
208
  });
@@ -15,14 +15,24 @@ 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
+ */
18
24
  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
+ */
19
29
  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)
20
30
  },
21
31
  size: {
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)
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)
23
33
  },
24
34
  pilled: {
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)
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)
26
36
  },
27
37
  closeIconType: {
28
38
  "default": /*#__PURE__*/(0, _styledComponents.css)(["", ":1rem;", ":1.5rem;"], _Toast.toastTokens.closeIconButtonSize, _Toast.toastTokens.closeIconSize),
@@ -4,21 +4,39 @@ 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 { toastConfig } from '../../../../components/Toast';
8
- import { mergeConfig } from '../../../../engines';
9
- import { WithTheme, argTypesFromConfig } from '../../../_helpers';
7
+ import { WithTheme } from '../../../_helpers';
10
8
  import { Button } from '../Button/Button';
11
9
  import { PopupProvider } from '../Popup/Popup';
12
10
  import { addNotification } from '../../../../../src/components/Notification';
13
11
  import { NotificationsProvider } from '../Notification/Notification';
14
12
  import { Modal } from '../Modal/Modal';
15
13
 
16
- import { config } from './Toast.config';
17
14
  import { Toast, ToastController, ToastProvider, useToast } from './Toast';
18
15
 
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
+ },
22
40
  };
23
41
 
24
42
  export default meta;
@@ -61,6 +79,7 @@ const Container = styled.div`
61
79
  export const ToastComponent: StoryComponent = {
62
80
  args: {
63
81
  text: 'Текст всплывающего уведомления',
82
+ textColor: undefined,
64
83
  view: 'default',
65
84
  closeIconType: 'default',
66
85
  size: 'm',
@@ -68,14 +87,6 @@ export const ToastComponent: StoryComponent = {
68
87
  enableContentLeft: true,
69
88
  pilled: false,
70
89
  },
71
- argTypes: {
72
- closeIconType: {
73
- options: ['default', 'thin'],
74
- control: {
75
- type: 'select',
76
- },
77
- },
78
- },
79
90
  render: ({ enableContentLeft, ...args }) => (
80
91
  <ToastContainer>
81
92
  <Toast contentLeft={enableContentLeft && <BellIcon width="1rem" height="1rem" />} {...args} />
@@ -94,6 +105,8 @@ const StoryLiveDemo = ({
94
105
  size,
95
106
  hasClose,
96
107
  enableContentLeft,
108
+ closeIconType,
109
+ textColor,
97
110
  }: StoryProps) => {
98
111
  const { showToast, hideToast } = useToast();
99
112
  const contentLeft = enableContentLeft && <BellIcon width="1rem" height="1rem" />;
@@ -114,6 +127,8 @@ const StoryLiveDemo = ({
114
127
  view,
115
128
  size,
116
129
  hasClose,
130
+ closeIconType,
131
+ textColor,
117
132
  onHide: action('onHide'),
118
133
  onShow: action('onShow'),
119
134
  });
@@ -141,7 +156,6 @@ export const LiveDemo: Story = {
141
156
  type: 'inline-radio',
142
157
  },
143
158
  },
144
- ...argTypesFromConfig(mergeConfig(toastConfig, config)),
145
159
  ...disableProps(['role', 'onShow', 'onHide', 'contentLeft']),
146
160
  },
147
161
  parameters: {
@@ -167,6 +181,8 @@ const StoryComplex = ({
167
181
  size,
168
182
  hasClose,
169
183
  enableContentLeft,
184
+ closeIconType,
185
+ textColor,
170
186
  }: StoryProps) => {
171
187
  const [isModalOpen, setIsModalOpen] = useState(false);
172
188
 
@@ -185,6 +201,8 @@ const StoryComplex = ({
185
201
  view,
186
202
  size,
187
203
  hasClose,
204
+ closeIconType,
205
+ textColor,
188
206
  onHide: action('onHide'),
189
207
  onShow: action('onShow'),
190
208
  });
@@ -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"];
2
+ var _excluded = ["role", "width", "text", "hasClose", "contentLeft", "view", "size", "pilled", "className", "style", "closeIconType", "onCloseButtonClick", "textColor"];
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,6 +35,7 @@ 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,
38
39
  rest = _objectWithoutProperties(props, _excluded);
39
40
  var pilledClass = pilled ? classes.toastPilled : undefined;
40
41
  var fixedWidth = !Number.isNaN(Number(width)) ? "".concat(width, "%") : width;
@@ -58,7 +59,9 @@ export var toastRoot = function toastRoot(Root) {
58
59
  role: role,
59
60
  "aria-live": ariaLive,
60
61
  "aria-atomic": ariaAtomic
61
- }, rest), contentLeft && /*#__PURE__*/React.createElement(StyledContentLeft, null, contentLeft), /*#__PURE__*/React.createElement(StyledContent, null, text), hasClose && /*#__PURE__*/React.createElement(CloseIconWrapper, {
62
+ }, rest), contentLeft && /*#__PURE__*/React.createElement(StyledContentLeft, null, contentLeft), /*#__PURE__*/React.createElement(StyledContent, {
63
+ textColor: textColor
64
+ }, text), hasClose && /*#__PURE__*/React.createElement(CloseIconWrapper, {
62
65
  view: "clear",
63
66
  size: "s",
64
67
  onClick: onCloseButtonClick,
@@ -34,7 +34,10 @@ 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-left-content-margin:var(", ");margin:var(--plasma_private-left-content-margin);"], tokens.leftContentMargin);
37
+ })(["display:flex;--plasma_private-content-left-margin:var(", ");margin:var(--plasma_private-content-left-margin);color:var(", ");"], tokens.contentLeftMargin, tokens.contentLeftColor);
38
38
  export var StyledContent = /*#__PURE__*/styled.div.withConfig({
39
39
  componentId: "plasma-new-hope__sc-19l9ekl-4"
40
- })([""]);
40
+ })(["color:", ";"], function (_ref5) {
41
+ var textColor = _ref5.textColor;
42
+ return textColor || 'currentColor';
43
+ });
@@ -104,6 +104,10 @@ export interface ShowToastArgs {
104
104
  * Время отображения подсказки. Если не передать значение, подсказка будет отображаться пока ее не закроют.
105
105
  */
106
106
  timeout?: number;
107
+ /**
108
+ * Цвет текста (по умолчанию берётся цвет из view)
109
+ */
110
+ textColor?: string;
107
111
  /**
108
112
  * callback срабатывающий в момент события hideToast
109
113
  */
@@ -117,9 +121,11 @@ export interface ShowToastArgs {
117
121
 
118
122
  ## Пример использования
119
123
 
124
+ Для изменения цветовой темы компонента `Toast` используйте свойство `view` компонента `ViewContainer`.
125
+
120
126
  ```jsx live
121
127
  import React from 'react'
122
- import { useToast, ToastProvider, Button } from '@salutejs/{{ package }}'
128
+ import { useToast, ToastProvider, Button, ViewContainer } from '@salutejs/{{ package }}'
123
129
 
124
130
  export function App() {
125
131
 
@@ -130,12 +136,13 @@ export function App() {
130
136
  const onHide = () => {}
131
137
  const toastData = {
132
138
  text: 'Подсказка вызванная showToast',
139
+ textColor: 'cyan',
133
140
  position: 'bottom',
134
141
  role: 'status',
135
142
  hasClose: true,
136
143
  fade: false,
137
144
  size: 'm',
138
- view: 'dark',
145
+ view: 'default',
139
146
  timeout: 3000,
140
147
  onShow,
141
148
  onHide
@@ -145,9 +152,19 @@ export function App() {
145
152
  }
146
153
 
147
154
  return (
148
- <ToastProvider>
149
- <ToastExample />
150
- </ToastProvider>
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>
151
168
  )
152
169
  }
153
170
  ```
@@ -19,7 +19,8 @@ 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
- leftContentMargin: '--plasma-toast-left-content-margin',
22
+ contentLeftMargin: '--plasma-toast-content-left-margin',
23
+ contentLeftColor: '--plasma-toast-content-left-color',
23
24
  closeIconMargin: '--plasma-toast-close-icon-margin',
24
25
  closeIconColor: '--plasma-toast-close-icon-color',
25
26
  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_FADE, DEFAULT_POSITION, TIMER_DELAY } from '../utils';
9
+ import { DEFAULT_CLOSE_ICON_TYPE, 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,6 +118,9 @@ 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,
121
124
  onHide = _getShowToastCallSign.onHide,
122
125
  onShow = _getShowToastCallSign.onShow;
123
126
  setToastProps({
@@ -131,7 +134,9 @@ export var ToastProviderHoc = function ToastProviderHoc(ToastComponent) {
131
134
  pilled: pilled,
132
135
  hasClose: hasClose,
133
136
  size: size,
134
- view: view
137
+ view: view,
138
+ closeIconType: closeIconType,
139
+ textColor: textColor
135
140
  });
136
141
  setToastInfo({
137
142
  timeout: timeout,
@@ -2,6 +2,7 @@ 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';
5
6
  export var TIMER_DELAY = 300;
6
7
  export var FADE_Z_INDEX = '9900';
7
8
  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-left-content-margin:var(", ");--plasma_private-close-icon-margin:var(", ");border-radius:var(", ");}"], /*#__PURE__*/String(classes.toastPilled), tokens.leftContentMargin, tokens.closeIconMargin, tokens.pilledBorderRadius);
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);
@@ -9,14 +9,24 @@ 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
+ */
12
18
  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
+ */
13
23
  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)
14
24
  },
15
25
  size: {
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)
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)
17
27
  },
18
28
  pilled: {
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)
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)
20
30
  },
21
31
  closeIconType: {
22
32
  "default": /*#__PURE__*/css(["", ":1rem;", ":1.5rem;"], toastTokens.closeIconButtonSize, toastTokens.closeIconSize),
@@ -4,21 +4,39 @@ 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 { toastConfig } from '../../../../components/Toast';
8
- import { mergeConfig } from '../../../../engines';
9
- import { WithTheme, argTypesFromConfig } from '../../../_helpers';
7
+ import { WithTheme } from '../../../_helpers';
10
8
  import { Button } from '../Button/Button';
11
9
  import { PopupProvider } from '../Popup/Popup';
12
10
  import { addNotification } from '../../../../../src/components/Notification';
13
11
  import { NotificationsProvider } from '../Notification/Notification';
14
12
  import { Modal } from '../Modal/Modal';
15
13
 
16
- import { config } from './Toast.config';
17
14
  import { Toast, ToastController, ToastProvider, useToast } from './Toast';
18
15
 
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
+ },
22
40
  };
23
41
 
24
42
  export default meta;
@@ -61,6 +79,7 @@ const Container = styled.div`
61
79
  export const ToastComponent: StoryComponent = {
62
80
  args: {
63
81
  text: 'Текст всплывающего уведомления',
82
+ textColor: undefined,
64
83
  view: 'default',
65
84
  closeIconType: 'default',
66
85
  size: 'm',
@@ -68,14 +87,6 @@ export const ToastComponent: StoryComponent = {
68
87
  enableContentLeft: true,
69
88
  pilled: false,
70
89
  },
71
- argTypes: {
72
- closeIconType: {
73
- options: ['default', 'thin'],
74
- control: {
75
- type: 'select',
76
- },
77
- },
78
- },
79
90
  render: ({ enableContentLeft, ...args }) => (
80
91
  <ToastContainer>
81
92
  <Toast contentLeft={enableContentLeft && <BellIcon width="1rem" height="1rem" />} {...args} />
@@ -94,6 +105,8 @@ const StoryLiveDemo = ({
94
105
  size,
95
106
  hasClose,
96
107
  enableContentLeft,
108
+ closeIconType,
109
+ textColor,
97
110
  }: StoryProps) => {
98
111
  const { showToast, hideToast } = useToast();
99
112
  const contentLeft = enableContentLeft && <BellIcon width="1rem" height="1rem" />;
@@ -114,6 +127,8 @@ const StoryLiveDemo = ({
114
127
  view,
115
128
  size,
116
129
  hasClose,
130
+ closeIconType,
131
+ textColor,
117
132
  onHide: action('onHide'),
118
133
  onShow: action('onShow'),
119
134
  });
@@ -141,7 +156,6 @@ export const LiveDemo: Story = {
141
156
  type: 'inline-radio',
142
157
  },
143
158
  },
144
- ...argTypesFromConfig(mergeConfig(toastConfig, config)),
145
159
  ...disableProps(['role', 'onShow', 'onHide', 'contentLeft']),
146
160
  },
147
161
  parameters: {
@@ -167,6 +181,8 @@ const StoryComplex = ({
167
181
  size,
168
182
  hasClose,
169
183
  enableContentLeft,
184
+ closeIconType,
185
+ textColor,
170
186
  }: StoryProps) => {
171
187
  const [isModalOpen, setIsModalOpen] = useState(false);
172
188
 
@@ -185,6 +201,8 @@ const StoryComplex = ({
185
201
  view,
186
202
  size,
187
203
  hasClose,
204
+ closeIconType,
205
+ textColor,
188
206
  onHide: action('onHide'),
189
207
  onShow: action('onShow'),
190
208
  });
@@ -9,14 +9,24 @@ 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
+ */
12
18
  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
+ */
13
23
  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)
14
24
  },
15
25
  size: {
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)
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)
17
27
  },
18
28
  pilled: {
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)
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)
20
30
  },
21
31
  closeIconType: {
22
32
  "default": /*#__PURE__*/css(["", ":1rem;", ":1.5rem;"], toastTokens.closeIconButtonSize, toastTokens.closeIconSize),