@salutejs/plasma-new-hope 0.248.2-canary.1712.12992290184.0 → 0.249.0-canary.1719.12951148116.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.
- package/cjs/components/Toast/Toast.css +7 -7
- package/cjs/components/Toast/Toast.js +5 -2
- package/cjs/components/Toast/Toast.js.map +1 -1
- package/cjs/components/Toast/Toast.styles.js +11 -2
- package/cjs/components/Toast/Toast.styles.js.map +1 -1
- package/cjs/components/Toast/{Toast.styles_1nei944.css → Toast.styles_1kasmzh.css} +2 -2
- package/cjs/components/Toast/Toast.tokens.js +2 -1
- package/cjs/components/Toast/Toast.tokens.js.map +1 -1
- package/cjs/components/Toast/ToastController.css +6 -6
- package/cjs/components/Toast/ToastController.js +13 -1
- package/cjs/components/Toast/ToastController.js.map +1 -1
- package/cjs/components/Toast/ToastProvider/ToastProvider.js +9 -15
- package/cjs/components/Toast/ToastProvider/ToastProvider.js.map +1 -1
- package/cjs/components/Toast/utils.js +2 -0
- package/cjs/components/Toast/utils.js.map +1 -1
- package/cjs/components/Toast/variations/_pilled/base.js +1 -1
- package/cjs/components/Toast/variations/_pilled/base.js.map +1 -1
- package/cjs/components/Toast/variations/_pilled/base_13i59v3.css +1 -0
- package/cjs/index.css +8 -8
- package/emotion/cjs/components/Toast/Toast.js +5 -2
- package/emotion/cjs/components/Toast/Toast.styles.js +9 -6
- package/emotion/cjs/components/Toast/Toast.template-doc.mdx +22 -5
- package/emotion/cjs/components/Toast/Toast.tokens.js +2 -1
- package/emotion/cjs/components/Toast/ToastController.js +16 -3
- package/emotion/cjs/components/Toast/ToastProvider/ToastProvider.js +9 -15
- package/emotion/cjs/components/Toast/utils.js +2 -1
- package/emotion/cjs/components/Toast/variations/_pilled/base.js +1 -1
- package/emotion/cjs/examples/plasma_b2c/components/Toast/Toast.config.js +17 -7
- package/emotion/cjs/examples/plasma_b2c/components/Toast/Toast.stories.tsx +31 -14
- package/emotion/cjs/examples/plasma_web/components/Toast/Toast.config.js +17 -7
- package/emotion/cjs/examples/plasma_web/components/Toast/Toast.stories.tsx +31 -14
- package/emotion/es/components/Toast/Toast.js +5 -2
- package/emotion/es/components/Toast/Toast.styles.js +9 -6
- package/emotion/es/components/Toast/Toast.template-doc.mdx +22 -5
- package/emotion/es/components/Toast/Toast.tokens.js +2 -1
- package/emotion/es/components/Toast/ToastController.js +14 -2
- package/emotion/es/components/Toast/ToastProvider/ToastProvider.js +10 -16
- package/emotion/es/components/Toast/utils.js +1 -0
- package/emotion/es/components/Toast/variations/_pilled/base.js +1 -1
- package/emotion/es/examples/plasma_b2c/components/Toast/Toast.config.js +17 -7
- package/emotion/es/examples/plasma_b2c/components/Toast/Toast.stories.tsx +31 -14
- package/emotion/es/examples/plasma_web/components/Toast/Toast.config.js +17 -7
- package/emotion/es/examples/plasma_web/components/Toast/Toast.stories.tsx +31 -14
- package/es/components/Toast/Toast.css +7 -7
- package/es/components/Toast/Toast.js +5 -2
- package/es/components/Toast/Toast.js.map +1 -1
- package/es/components/Toast/Toast.styles.js +11 -2
- package/es/components/Toast/Toast.styles.js.map +1 -1
- package/es/components/Toast/{Toast.styles_1nei944.css → Toast.styles_1kasmzh.css} +2 -2
- package/es/components/Toast/Toast.tokens.js +2 -1
- package/es/components/Toast/Toast.tokens.js.map +1 -1
- package/es/components/Toast/ToastController.css +6 -6
- package/es/components/Toast/ToastController.js +14 -2
- package/es/components/Toast/ToastController.js.map +1 -1
- package/es/components/Toast/ToastProvider/ToastProvider.js +10 -16
- package/es/components/Toast/ToastProvider/ToastProvider.js.map +1 -1
- package/es/components/Toast/utils.js +2 -1
- package/es/components/Toast/utils.js.map +1 -1
- package/es/components/Toast/variations/_pilled/base.js +1 -1
- package/es/components/Toast/variations/_pilled/base.js.map +1 -1
- package/es/components/Toast/variations/_pilled/base_13i59v3.css +1 -0
- package/es/index.css +8 -8
- package/package.json +2 -2
- package/styled-components/cjs/components/Toast/Toast.js +5 -2
- package/styled-components/cjs/components/Toast/Toast.styles.js +5 -2
- package/styled-components/cjs/components/Toast/Toast.template-doc.mdx +22 -5
- package/styled-components/cjs/components/Toast/Toast.tokens.js +2 -1
- package/styled-components/cjs/components/Toast/ToastController.js +16 -3
- package/styled-components/cjs/components/Toast/ToastProvider/ToastProvider.js +9 -15
- package/styled-components/cjs/components/Toast/utils.js +2 -1
- package/styled-components/cjs/components/Toast/variations/_pilled/base.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Toast/Toast.config.js +12 -2
- package/styled-components/cjs/examples/plasma_b2c/components/Toast/Toast.stories.tsx +31 -14
- package/styled-components/cjs/examples/plasma_web/components/Toast/Toast.config.js +12 -2
- package/styled-components/cjs/examples/plasma_web/components/Toast/Toast.stories.tsx +31 -14
- package/styled-components/es/components/Toast/Toast.js +5 -2
- package/styled-components/es/components/Toast/Toast.styles.js +5 -2
- package/styled-components/es/components/Toast/Toast.template-doc.mdx +22 -5
- package/styled-components/es/components/Toast/Toast.tokens.js +2 -1
- package/styled-components/es/components/Toast/ToastController.js +14 -2
- package/styled-components/es/components/Toast/ToastProvider/ToastProvider.js +10 -16
- package/styled-components/es/components/Toast/utils.js +1 -0
- package/styled-components/es/components/Toast/variations/_pilled/base.js +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Toast/Toast.config.js +12 -2
- package/styled-components/es/examples/plasma_b2c/components/Toast/Toast.stories.tsx +31 -14
- package/styled-components/es/examples/plasma_web/components/Toast/Toast.config.js +12 -2
- package/styled-components/es/examples/plasma_web/components/Toast/Toast.stories.tsx +31 -14
- package/types/components/Toast/Toast.styles.d.ts +3 -1
- package/types/components/Toast/Toast.styles.d.ts.map +1 -1
- package/types/components/Toast/Toast.tokens.d.ts +2 -1
- package/types/components/Toast/Toast.tokens.d.ts.map +1 -1
- package/types/components/Toast/Toast.types.d.ts +8 -0
- package/types/components/Toast/Toast.types.d.ts.map +1 -1
- package/types/components/Toast/ToastController.d.ts.map +1 -1
- package/types/components/Toast/ToastProvider/ToastProvider.d.ts.map +1 -1
- package/types/components/Toast/utils.d.ts +1 -0
- package/types/components/Toast/utils.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Toast/Toast.config.d.ts +10 -0
- package/types/examples/plasma_b2c/components/Toast/Toast.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Toast/Toast.d.ts +2 -0
- package/types/examples/plasma_b2c/components/Toast/Toast.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Toast/Toast.config.d.ts +10 -0
- package/types/examples/plasma_web/components/Toast/Toast.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Toast/Toast.d.ts +2 -0
- package/types/examples/plasma_web/components/Toast/Toast.d.ts.map +1 -1
- package/cjs/components/Toast/variations/_pilled/base_199qghc.css +0 -1
- package/es/components/Toast/variations/_pilled/base_199qghc.css +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"base.js","sources":["../../../../../src/components/Toast/variations/_pilled/base.ts"],"sourcesContent":["import { css } from '@linaria/core';\n\nimport { classes, tokens } from '../../Toast.tokens';\n\nexport const base = css`\n &.${String(classes.toastPilled)} {\n --plasma_private-left-
|
1
|
+
{"version":3,"file":"base.js","sources":["../../../../../src/components/Toast/variations/_pilled/base.ts"],"sourcesContent":["import { css } from '@linaria/core';\n\nimport { classes, tokens } from '../../Toast.tokens';\n\nexport const base = css`\n &.${String(classes.toastPilled)} {\n --plasma_private-content-left-margin: var(${tokens.contentLeftMargin});\n --plasma_private-close-icon-margin: var(${tokens.closeIconMargin});\n\n border-radius: var(${tokens.pilledBorderRadius});\n }\n`;\n"],"names":["base"],"mappings":"AAIO,IAAMA,IAAI,GAOhB;;;;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
.bmt2xdv.toast-pilled{--plasma_private-content-left-margin:var(--plasma-toast-content-left-margin);--plasma_private-close-icon-margin:var(--plasma-toast-close-icon-margin);border-radius:var(--plasma-toast-pilled-border-radius);}
|
package/es/index.css
CHANGED
@@ -540,14 +540,14 @@
|
|
540
540
|
|
541
541
|
.base_r51pt4_b1d1vtqu__bfcbbf25{padding:var(--plasma-toast-padding);border-radius:var(--plasma-toast-border-radius);max-width:var(--plasma-toast-max-width);-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);font-family:var(--plasma-toast-font-family);font-size:var(--plasma-toast-font-size);font-style:var(--plasma-toast-font-style);font-weight:var(--plasma-toast-font-weight);-webkit-letter-spacing:var(--plasma-toast-letter-spacing);-moz-letter-spacing:var(--plasma-toast-letter-spacing);-ms-letter-spacing:var(--plasma-toast-letter-spacing);letter-spacing:var(--plasma-toast-letter-spacing);line-height:var(--plasma-toast-lineheight);}
|
542
542
|
|
543
|
-
.
|
544
|
-
|
545
|
-
.
|
546
|
-
.
|
547
|
-
.
|
548
|
-
.
|
549
|
-
.
|
550
|
-
|
543
|
+
.base_13i59v3_bmt2xdv__6505c4ad.base_13i59v3_toastPilled__6505c4ad{--plasma_private-content-left-margin:var(--plasma-toast-content-left-margin);--plasma_private-close-icon-margin:var(--plasma-toast-close-icon-margin);border-radius:var(--plasma-toast-pilled-border-radius);}
|
544
|
+
|
545
|
+
.Toast_styles_1kasmzh_b1xqk743__8ac79e0c{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);--plasma-button-width:1rem;}
|
546
|
+
.Toast_styles_1kasmzh_s1ajsqhx__8ac79e0c{position:fixed;left:50%;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);z-index:9901;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;width:0;top:var(--s1ajsqhx-0);bottom:var(--s1ajsqhx-1);}.Toast_styles_1kasmzh_s1ajsqhx__8ac79e0c.Toast_styles_1kasmzh_toastShowed__8ac79e0c{-webkit-animation:0.3s Toast_styles_1kasmzh_showToastAnimationS1ajsqhx__8ac79e0c ease-out forwards;animation:0.3s Toast_styles_1kasmzh_showToastAnimationS1ajsqhx__8ac79e0c ease-out forwards;}.Toast_styles_1kasmzh_s1ajsqhx__8ac79e0c.Toast_styles_1kasmzh_toastHidden__8ac79e0c{-webkit-animation:0.3s Toast_styles_1kasmzh_hideToastAnimationS1ajsqhx__8ac79e0c ease-out forwards;animation:0.3s Toast_styles_1kasmzh_hideToastAnimationS1ajsqhx__8ac79e0c ease-out forwards;}@-webkit-keyframes Toast_styles_1kasmzh_showToastAnimationS1ajsqhx__8ac79e0c{0%{-webkit-transform:var(--s1ajsqhx-2);-ms-transform:var(--s1ajsqhx-2);transform:var(--s1ajsqhx-2);opacity:0;}80%{-webkit-transform:translate(-50%,0);-ms-transform:translate(-50%,0);transform:translate(-50%,0);opacity:0.7;}100%{opacity:1;}}@keyframes Toast_styles_1kasmzh_showToastAnimationS1ajsqhx__8ac79e0c{0%{-webkit-transform:var(--s1ajsqhx-2);-ms-transform:var(--s1ajsqhx-2);transform:var(--s1ajsqhx-2);opacity:0;}80%{-webkit-transform:translate(-50%,0);-ms-transform:translate(-50%,0);transform:translate(-50%,0);opacity:0.7;}100%{opacity:1;}}@-webkit-keyframes Toast_styles_1kasmzh_hideToastAnimationS1ajsqhx__8ac79e0c{0%{opacity:1;}20%{-webkit-transform:translate(-50%,0);-ms-transform:translate(-50%,0);transform:translate(-50%,0);opacity:0.7;}100%{-webkit-transform:var(--s1ajsqhx-2);-ms-transform:var(--s1ajsqhx-2);transform:var(--s1ajsqhx-2);opacity:0;}}@keyframes Toast_styles_1kasmzh_hideToastAnimationS1ajsqhx__8ac79e0c{0%{opacity:1;}20%{-webkit-transform:translate(-50%,0);-ms-transform:translate(-50%,0);transform:translate(-50%,0);opacity:0.7;}100%{-webkit-transform:var(--s1ajsqhx-2);-ms-transform:var(--s1ajsqhx-2);transform:var(--s1ajsqhx-2);opacity:0;}}
|
547
|
+
.Toast_styles_1kasmzh_cb0tpdq__8ac79e0c{height:var(--plasma-toast-close-icon-button-size);--plasma_private-close-icon-margin:var(--plasma-toast-close-icon-margin);margin:var(--plasma_private-close-icon-margin);color:var(--plasma-toast-close-icon-color);}.Toast_styles_1kasmzh_cb0tpdq__8ac79e0c:hover{color:var(--plasma-toast-close-icon-color-on-hover);}
|
548
|
+
.Toast_styles_1kasmzh_segu2tf__8ac79e0c.Toast_styles_1kasmzh_segu2tf__8ac79e0c.Toast_styles_1kasmzh_toastFadeShowed__8ac79e0c{-webkit-animation:0.3s Toast_styles_1kasmzh_showFadeAnimationSegu2tf__8ac79e0c ease-out forwards;animation:0.3s Toast_styles_1kasmzh_showFadeAnimationSegu2tf__8ac79e0c ease-out forwards;}.Toast_styles_1kasmzh_segu2tf__8ac79e0c.Toast_styles_1kasmzh_segu2tf__8ac79e0c.Toast_styles_1kasmzh_toastFadeHidden__8ac79e0c{-webkit-animation:0.3s Toast_styles_1kasmzh_hideFadeAnimationSegu2tf__8ac79e0c ease-out forwards;animation:0.3s Toast_styles_1kasmzh_hideFadeAnimationSegu2tf__8ac79e0c ease-out forwards;}@-webkit-keyframes Toast_styles_1kasmzh_showFadeAnimationSegu2tf__8ac79e0c{0%{opacity:0;}100%{opacity:1;}}@keyframes Toast_styles_1kasmzh_showFadeAnimationSegu2tf__8ac79e0c{0%{opacity:0;}100%{opacity:1;}}@-webkit-keyframes Toast_styles_1kasmzh_hideFadeAnimationSegu2tf__8ac79e0c{0%{opacity:1;}100%{opacity:0;}}@keyframes Toast_styles_1kasmzh_hideFadeAnimationSegu2tf__8ac79e0c{0%{opacity:1;}100%{opacity:0;}}
|
549
|
+
.Toast_styles_1kasmzh_s1bt6ppa__8ac79e0c{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;--plasma_private-content-left-margin:var(--plasma-toast-content-left-margin);margin:var(--plasma_private-content-left-margin);color:var(--plasma-toast-content-left-color);}
|
550
|
+
.Toast_styles_1kasmzh_s1h44nk1__8ac79e0c{color:var(--s1h44nk1-0);}
|
551
551
|
|
552
552
|
.Overlay_styles_cxej3y_s1afr8la__70d4dd9a{position:fixed;inset:0;z-index:var(--s1afr8la-0);--plasma_private-overlay-background-color:var(--s1afr8la-1);--plasma_private-overlay-backdrop-filter:var(--s1afr8la-2);background:var(--s1afr8la-3);-webkit-backdrop-filter:var(--s1afr8la-4);backdrop-filter:var(--s1afr8la-4);cursor:var(--s1afr8la-5);}
|
553
553
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@salutejs/plasma-new-hope",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.249.0-canary.1719.12951148116.0",
|
4
4
|
"description": "Salute Design System blueprint",
|
5
5
|
"main": "cjs/index.js",
|
6
6
|
"module": "es/index.js",
|
@@ -131,5 +131,5 @@
|
|
131
131
|
"sideEffects": [
|
132
132
|
"*.css"
|
133
133
|
],
|
134
|
-
"gitHead": "
|
134
|
+
"gitHead": "948aef0496344b4eb08549a4a05ae39eaca108a4"
|
135
135
|
}
|
@@ -15,7 +15,7 @@ var _base2 = /*#__PURE__*/require("./variations/_size/base");
|
|
15
15
|
var _base3 = /*#__PURE__*/require("./variations/_pilled/base");
|
16
16
|
var _base4 = /*#__PURE__*/require("./variations/_closeIconType/base");
|
17
17
|
var _Toast2 = /*#__PURE__*/require("./Toast.styles");
|
18
|
-
var _excluded = ["role", "width", "text", "hasClose", "contentLeft", "view", "size", "pilled", "className", "style", "closeIconType", "onCloseButtonClick"];
|
18
|
+
var _excluded = ["role", "width", "text", "hasClose", "contentLeft", "view", "size", "pilled", "className", "style", "closeIconType", "onCloseButtonClick", "textColor"];
|
19
19
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
20
20
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
21
21
|
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); }
|
@@ -42,6 +42,7 @@ var toastRoot = exports.toastRoot = function toastRoot(Root) {
|
|
42
42
|
style = props.style,
|
43
43
|
closeIconType = props.closeIconType,
|
44
44
|
onCloseButtonClick = props.onCloseButtonClick,
|
45
|
+
textColor = props.textColor,
|
45
46
|
rest = _objectWithoutProperties(props, _excluded);
|
46
47
|
var pilledClass = pilled ? _Toast.classes.toastPilled : undefined;
|
47
48
|
var fixedWidth = !Number.isNaN(Number(width)) ? "".concat(width, "%") : width;
|
@@ -65,7 +66,9 @@ var toastRoot = exports.toastRoot = function toastRoot(Root) {
|
|
65
66
|
role: role,
|
66
67
|
"aria-live": ariaLive,
|
67
68
|
"aria-atomic": ariaAtomic
|
68
|
-
}, rest), contentLeft && /*#__PURE__*/_react["default"].createElement(_Toast2.StyledContentLeft, null, contentLeft), /*#__PURE__*/_react["default"].createElement(_Toast2.StyledContent,
|
69
|
+
}, rest), contentLeft && /*#__PURE__*/_react["default"].createElement(_Toast2.StyledContentLeft, null, contentLeft), /*#__PURE__*/_react["default"].createElement(_Toast2.StyledContent, {
|
70
|
+
textColor: textColor
|
71
|
+
}, text), hasClose && /*#__PURE__*/_react["default"].createElement(_Toast2.CloseIconWrapper, {
|
69
72
|
view: "clear",
|
70
73
|
size: "s",
|
71
74
|
onClick: onCloseButtonClick,
|
@@ -42,7 +42,10 @@ var StyledOverlay = exports.StyledOverlay = /*#__PURE__*/(0, _styledComponents["
|
|
42
42
|
})(["&&.", "{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(_Toast.classes.toastFadeShowed), /*#__PURE__*/String(_Toast.classes.toastFadeHidden));
|
43
43
|
var StyledContentLeft = exports.StyledContentLeft = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
44
44
|
componentId: "plasma-new-hope__sc-19l9ekl-3"
|
45
|
-
})(["display:flex;--plasma_private-left-
|
45
|
+
})(["display:flex;--plasma_private-content-left-margin:var(", ");margin:var(--plasma_private-content-left-margin);color:var(", ");"], _Toast.tokens.contentLeftMargin, _Toast.tokens.contentLeftColor);
|
46
46
|
var StyledContent = exports.StyledContent = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
47
47
|
componentId: "plasma-new-hope__sc-19l9ekl-4"
|
48
|
-
})([""])
|
48
|
+
})(["color:", ";"], function (_ref5) {
|
49
|
+
var textColor = _ref5.textColor;
|
50
|
+
return textColor || 'currentColor';
|
51
|
+
});
|
@@ -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: '
|
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
|
-
<
|
149
|
-
<
|
150
|
-
|
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
|
```
|
@@ -25,7 +25,8 @@ var tokens = exports.tokens = {
|
|
25
25
|
letterSpacing: '--plasma-toast-letter-spacing',
|
26
26
|
lineHeight: '--plasma-toast-lineheight',
|
27
27
|
pilledBorderRadius: '--plasma-toast-pilled-border-radius',
|
28
|
-
|
28
|
+
contentLeftMargin: '--plasma-toast-content-left-margin',
|
29
|
+
contentLeftColor: '--plasma-toast-content-left-color',
|
29
30
|
closeIconMargin: '--plasma-toast-close-icon-margin',
|
30
31
|
closeIconColor: '--plasma-toast-close-icon-color',
|
31
32
|
closeIconColorOnHover: '--plasma-toast-close-icon-color-on-hover',
|
@@ -5,13 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
6
6
|
});
|
7
7
|
exports.ToastControllerHoc = void 0;
|
8
|
-
var _react = /*#__PURE__*/
|
8
|
+
var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
|
9
9
|
var _Toast = /*#__PURE__*/require("./Toast.tokens");
|
10
10
|
var _Toast2 = /*#__PURE__*/require("./Toast.styles");
|
11
11
|
var _ToastProvider = /*#__PURE__*/require("./ToastProvider");
|
12
12
|
var _utils = /*#__PURE__*/require("./utils");
|
13
13
|
var _excluded = ["position", "offset", "fade", "text"];
|
14
|
-
function
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
15
16
|
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; }
|
16
17
|
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; }
|
17
18
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
@@ -29,7 +30,9 @@ var ToastControllerHoc = exports.ToastControllerHoc = function ToastControllerHo
|
|
29
30
|
rest = _objectWithoutProperties(props, _excluded);
|
30
31
|
var _useToastInner = (0, _ToastProvider.useToastInner)(),
|
31
32
|
hideToast = _useToastInner.hideToast,
|
32
|
-
isVisible = _useToastInner.isVisible
|
33
|
+
isVisible = _useToastInner.isVisible,
|
34
|
+
hideTimeout = _useToastInner.hideTimeout,
|
35
|
+
animationRunTimeout = _useToastInner.animationRunTimeout;
|
33
36
|
var toastKey = "".concat(text).concat(position);
|
34
37
|
var showedClass = isVisible ? _Toast.classes.toastShowed : _Toast.classes.toastHidden;
|
35
38
|
var showedFadeClass = isVisible ? _Toast.classes.toastFadeShowed : _Toast.classes.toastFadeHidden;
|
@@ -37,6 +40,16 @@ var ToastControllerHoc = exports.ToastControllerHoc = function ToastControllerHo
|
|
37
40
|
text: text,
|
38
41
|
onCloseButtonClick: hideToast
|
39
42
|
}, rest);
|
43
|
+
(0, _react.useEffect)(function () {
|
44
|
+
return function () {
|
45
|
+
if (hideTimeout !== null && hideTimeout !== void 0 && hideTimeout.current) {
|
46
|
+
clearTimeout(hideTimeout.current);
|
47
|
+
}
|
48
|
+
if (animationRunTimeout !== null && animationRunTimeout !== void 0 && animationRunTimeout.current) {
|
49
|
+
clearTimeout(animationRunTimeout.current);
|
50
|
+
}
|
51
|
+
};
|
52
|
+
}, []);
|
40
53
|
if (!text) {
|
41
54
|
return null;
|
42
55
|
}
|
@@ -126,6 +126,9 @@ var ToastProviderHoc = exports.ToastProviderHoc = function ToastProviderHoc(Toas
|
|
126
126
|
size = _getShowToastCallSign.size,
|
127
127
|
view = _getShowToastCallSign.view,
|
128
128
|
width = _getShowToastCallSign.width,
|
129
|
+
_getShowToastCallSign4 = _getShowToastCallSign.closeIconType,
|
130
|
+
closeIconType = _getShowToastCallSign4 === void 0 ? _utils.DEFAULT_CLOSE_ICON_TYPE : _getShowToastCallSign4,
|
131
|
+
textColor = _getShowToastCallSign.textColor,
|
129
132
|
onHide = _getShowToastCallSign.onHide,
|
130
133
|
onShow = _getShowToastCallSign.onShow;
|
131
134
|
setToastProps({
|
@@ -139,7 +142,9 @@ var ToastProviderHoc = exports.ToastProviderHoc = function ToastProviderHoc(Toas
|
|
139
142
|
pilled: pilled,
|
140
143
|
hasClose: hasClose,
|
141
144
|
size: size,
|
142
|
-
view: view
|
145
|
+
view: view,
|
146
|
+
closeIconType: closeIconType,
|
147
|
+
textColor: textColor
|
143
148
|
});
|
144
149
|
setToastInfo({
|
145
150
|
timeout: timeout,
|
@@ -153,13 +158,13 @@ var ToastProviderHoc = exports.ToastProviderHoc = function ToastProviderHoc(Toas
|
|
153
158
|
var onHide = toastInfo.onHide,
|
154
159
|
timeout = toastInfo.timeout;
|
155
160
|
var hideToast = (0, _react.useCallback)(function () {
|
161
|
+
if (!isVisible) {
|
162
|
+
return;
|
163
|
+
}
|
156
164
|
if (hideTimeout !== null && hideTimeout !== void 0 && hideTimeout.current) {
|
157
165
|
clearTimeout(hideTimeout.current);
|
158
166
|
hideTimeout.current = null;
|
159
167
|
}
|
160
|
-
if (!isVisible) {
|
161
|
-
return;
|
162
|
-
}
|
163
168
|
onHide === null || onHide === void 0 || onHide();
|
164
169
|
setIsVisible(false);
|
165
170
|
animationRunTimeout.current = setTimeout(function () {
|
@@ -172,11 +177,6 @@ var ToastProviderHoc = exports.ToastProviderHoc = function ToastProviderHoc(Toas
|
|
172
177
|
clearTimeout(animationRunTimeout.current);
|
173
178
|
animationRunTimeout.current = null;
|
174
179
|
}
|
175
|
-
return function () {
|
176
|
-
if (animationRunTimeout !== null && animationRunTimeout !== void 0 && animationRunTimeout.current) {
|
177
|
-
clearTimeout(animationRunTimeout.current);
|
178
|
-
}
|
179
|
-
};
|
180
180
|
}, [timeout]);
|
181
181
|
(0, _react.useEffect)(function () {
|
182
182
|
if (timeout && isVisible) {
|
@@ -184,12 +184,6 @@ var ToastProviderHoc = exports.ToastProviderHoc = function ToastProviderHoc(Toas
|
|
184
184
|
hideToast();
|
185
185
|
}, timeout);
|
186
186
|
}
|
187
|
-
return function () {
|
188
|
-
if (hideTimeout !== null && hideTimeout !== void 0 && hideTimeout.current) {
|
189
|
-
clearTimeout(hideTimeout.current);
|
190
|
-
hideTimeout.current = null;
|
191
|
-
}
|
192
|
-
};
|
193
187
|
}, [isVisible, timeout]);
|
194
188
|
return /*#__PURE__*/_react["default"].createElement(ToastContext.Provider, {
|
195
189
|
value: {
|
@@ -3,11 +3,12 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.gradients = exports.TOAST_Z_INDEX = exports.TIMER_DELAY = exports.FADE_Z_INDEX = exports.DEFAULT_POSITION = exports.DEFAULT_FADE = exports.Button = void 0;
|
6
|
+
exports.gradients = exports.TOAST_Z_INDEX = exports.TIMER_DELAY = exports.FADE_Z_INDEX = exports.DEFAULT_POSITION = exports.DEFAULT_FADE = exports.DEFAULT_CLOSE_ICON_TYPE = exports.Button = void 0;
|
7
7
|
var _Button = /*#__PURE__*/require("../Button");
|
8
8
|
var _engines = /*#__PURE__*/require("../../engines");
|
9
9
|
var DEFAULT_FADE = exports.DEFAULT_FADE = true;
|
10
10
|
var DEFAULT_POSITION = exports.DEFAULT_POSITION = 'bottom';
|
11
|
+
var DEFAULT_CLOSE_ICON_TYPE = exports.DEFAULT_CLOSE_ICON_TYPE = 'default';
|
11
12
|
var TIMER_DELAY = exports.TIMER_DELAY = 300;
|
12
13
|
var FADE_Z_INDEX = exports.FADE_Z_INDEX = '9900';
|
13
14
|
var TOAST_Z_INDEX = exports.TOAST_Z_INDEX = '9901';
|
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.base = void 0;
|
7
7
|
var _styledComponents = /*#__PURE__*/require("styled-components");
|
8
8
|
var _Toast = /*#__PURE__*/require("../../Toast.tokens");
|
9
|
-
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["&.", "{--plasma_private-left-
|
9
|
+
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["&.", "{--plasma_private-content-left-margin:var(", ");--plasma_private-close-icon-margin:var(", ");border-radius:var(", ");}"], /*#__PURE__*/String(_Toast.classes.toastPilled), _Toast.tokens.contentLeftMargin, _Toast.tokens.closeIconMargin, _Toast.tokens.pilledBorderRadius);
|
@@ -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.
|
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.
|
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 {
|
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;
|
@@ -49,7 +67,6 @@ const StyledWrapper = styled.div`
|
|
49
67
|
`;
|
50
68
|
|
51
69
|
const ToastContainer = styled.div`
|
52
|
-
position: fixed;
|
53
70
|
transform: translateX(50%);
|
54
71
|
`;
|
55
72
|
|
@@ -61,6 +78,7 @@ const Container = styled.div`
|
|
61
78
|
export const ToastComponent: StoryComponent = {
|
62
79
|
args: {
|
63
80
|
text: 'Текст всплывающего уведомления',
|
81
|
+
textColor: undefined,
|
64
82
|
view: 'default',
|
65
83
|
closeIconType: 'default',
|
66
84
|
size: 'm',
|
@@ -68,14 +86,6 @@ export const ToastComponent: StoryComponent = {
|
|
68
86
|
enableContentLeft: true,
|
69
87
|
pilled: false,
|
70
88
|
},
|
71
|
-
argTypes: {
|
72
|
-
closeIconType: {
|
73
|
-
options: ['default', 'thin'],
|
74
|
-
control: {
|
75
|
-
type: 'select',
|
76
|
-
},
|
77
|
-
},
|
78
|
-
},
|
79
89
|
render: ({ enableContentLeft, ...args }) => (
|
80
90
|
<ToastContainer>
|
81
91
|
<Toast contentLeft={enableContentLeft && <BellIcon width="1rem" height="1rem" />} {...args} />
|
@@ -94,6 +104,8 @@ const StoryLiveDemo = ({
|
|
94
104
|
size,
|
95
105
|
hasClose,
|
96
106
|
enableContentLeft,
|
107
|
+
closeIconType,
|
108
|
+
textColor,
|
97
109
|
}: StoryProps) => {
|
98
110
|
const { showToast, hideToast } = useToast();
|
99
111
|
const contentLeft = enableContentLeft && <BellIcon width="1rem" height="1rem" />;
|
@@ -114,6 +126,8 @@ const StoryLiveDemo = ({
|
|
114
126
|
view,
|
115
127
|
size,
|
116
128
|
hasClose,
|
129
|
+
closeIconType,
|
130
|
+
textColor,
|
117
131
|
onHide: action('onHide'),
|
118
132
|
onShow: action('onShow'),
|
119
133
|
});
|
@@ -141,7 +155,6 @@ export const LiveDemo: Story = {
|
|
141
155
|
type: 'inline-radio',
|
142
156
|
},
|
143
157
|
},
|
144
|
-
...argTypesFromConfig(mergeConfig(toastConfig, config)),
|
145
158
|
...disableProps(['role', 'onShow', 'onHide', 'contentLeft']),
|
146
159
|
},
|
147
160
|
parameters: {
|
@@ -167,6 +180,8 @@ const StoryComplex = ({
|
|
167
180
|
size,
|
168
181
|
hasClose,
|
169
182
|
enableContentLeft,
|
183
|
+
closeIconType,
|
184
|
+
textColor,
|
170
185
|
}: StoryProps) => {
|
171
186
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
172
187
|
|
@@ -185,6 +200,8 @@ const StoryComplex = ({
|
|
185
200
|
view,
|
186
201
|
size,
|
187
202
|
hasClose,
|
203
|
+
closeIconType,
|
204
|
+
textColor,
|
188
205
|
onHide: action('onHide'),
|
189
206
|
onShow: action('onShow'),
|
190
207
|
});
|
@@ -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.
|
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.
|
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 {
|
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;
|
@@ -49,7 +67,6 @@ const StyledWrapper = styled.div`
|
|
49
67
|
`;
|
50
68
|
|
51
69
|
const ToastContainer = styled.div`
|
52
|
-
position: fixed;
|
53
70
|
transform: translateX(50%);
|
54
71
|
`;
|
55
72
|
|
@@ -61,6 +78,7 @@ const Container = styled.div`
|
|
61
78
|
export const ToastComponent: StoryComponent = {
|
62
79
|
args: {
|
63
80
|
text: 'Текст всплывающего уведомления',
|
81
|
+
textColor: undefined,
|
64
82
|
view: 'default',
|
65
83
|
closeIconType: 'default',
|
66
84
|
size: 'm',
|
@@ -68,14 +86,6 @@ export const ToastComponent: StoryComponent = {
|
|
68
86
|
enableContentLeft: true,
|
69
87
|
pilled: false,
|
70
88
|
},
|
71
|
-
argTypes: {
|
72
|
-
closeIconType: {
|
73
|
-
options: ['default', 'thin'],
|
74
|
-
control: {
|
75
|
-
type: 'select',
|
76
|
-
},
|
77
|
-
},
|
78
|
-
},
|
79
89
|
render: ({ enableContentLeft, ...args }) => (
|
80
90
|
<ToastContainer>
|
81
91
|
<Toast contentLeft={enableContentLeft && <BellIcon width="1rem" height="1rem" />} {...args} />
|
@@ -94,6 +104,8 @@ const StoryLiveDemo = ({
|
|
94
104
|
size,
|
95
105
|
hasClose,
|
96
106
|
enableContentLeft,
|
107
|
+
closeIconType,
|
108
|
+
textColor,
|
97
109
|
}: StoryProps) => {
|
98
110
|
const { showToast, hideToast } = useToast();
|
99
111
|
const contentLeft = enableContentLeft && <BellIcon width="1rem" height="1rem" />;
|
@@ -114,6 +126,8 @@ const StoryLiveDemo = ({
|
|
114
126
|
view,
|
115
127
|
size,
|
116
128
|
hasClose,
|
129
|
+
closeIconType,
|
130
|
+
textColor,
|
117
131
|
onHide: action('onHide'),
|
118
132
|
onShow: action('onShow'),
|
119
133
|
});
|
@@ -141,7 +155,6 @@ export const LiveDemo: Story = {
|
|
141
155
|
type: 'inline-radio',
|
142
156
|
},
|
143
157
|
},
|
144
|
-
...argTypesFromConfig(mergeConfig(toastConfig, config)),
|
145
158
|
...disableProps(['role', 'onShow', 'onHide', 'contentLeft']),
|
146
159
|
},
|
147
160
|
parameters: {
|
@@ -167,6 +180,8 @@ const StoryComplex = ({
|
|
167
180
|
size,
|
168
181
|
hasClose,
|
169
182
|
enableContentLeft,
|
183
|
+
closeIconType,
|
184
|
+
textColor,
|
170
185
|
}: StoryProps) => {
|
171
186
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
172
187
|
|
@@ -185,6 +200,8 @@ const StoryComplex = ({
|
|
185
200
|
view,
|
186
201
|
size,
|
187
202
|
hasClose,
|
203
|
+
closeIconType,
|
204
|
+
textColor,
|
188
205
|
onHide: action('onHide'),
|
189
206
|
onShow: action('onShow'),
|
190
207
|
});
|