@salutejs/plasma-core 1.226.1-next-sbcom.0 → 1.227.0-dev.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/__helpers/IconPlaceholder.js +6 -9
- package/__helpers/index.js +1 -1
- package/collectPackageInfo.js +4 -4
- package/components/Badge/Badge.js +30 -103
- package/components/Badge/index.js +1 -1
- package/components/Basebox/Basebox.js +33 -42
- package/components/Basebox/index.js +1 -1
- package/components/Button/Button.js +28 -67
- package/components/Button/Button.mixins.js +22 -76
- package/components/Button/Button.props.js +5 -5
- package/components/Button/createButton.js +14 -145
- package/components/Button/index.js +4 -4
- package/components/Card/Card.js +34 -162
- package/components/Card/CardBody.js +4 -4
- package/components/Card/CardContent.js +14 -23
- package/components/Card/CardMedia.js +20 -91
- package/components/Card/CardPrice.js +18 -60
- package/components/Card/CardTypography.js +43 -52
- package/components/Card/index.js +5 -5
- package/components/Carousel/Carousel.js +46 -64
- package/components/Carousel/CarouselItem.js +21 -93
- package/components/Carousel/hooks.js +62 -121
- package/components/Carousel/index.js +3 -3
- package/components/Carousel/utils.js +59 -73
- package/components/Fade/Fade.js +6 -9
- package/components/Fade/index.js +1 -1
- package/components/Field/Field.js +48 -63
- package/components/Field/Field.statuses.js +3 -3
- package/components/Field/index.js +2 -2
- package/components/Image/Image.js +34 -115
- package/components/Image/index.js +1 -1
- package/components/Input/Input.js +7 -7
- package/components/Input/Input.mixins.js +9 -12
- package/components/Input/index.js +1 -1
- package/components/ModalBase/ModalBase.js +22 -100
- package/components/ModalBase/ModalBaseContext.js +6 -9
- package/components/ModalBase/ModalOverlay.js +28 -111
- package/components/ModalBase/hooks.js +15 -43
- package/components/ModalBase/index.js +2 -2
- package/components/PaginationDots/PaginationDot.js +11 -17
- package/components/PaginationDots/PaginationDots.js +4 -7
- package/components/PaginationDots/index.js +3 -3
- package/components/PaginationDots/usePaginationDots.js +10 -11
- package/components/Popup/Popup.js +52 -205
- package/components/Popup/index.js +1 -1
- package/components/PopupBase/PopupBase.js +35 -169
- package/components/PopupBase/PopupBaseContext.js +26 -86
- package/components/PopupBase/PopupBaseRoot.js +31 -169
- package/components/PopupBase/hooks.js +23 -97
- package/components/PopupBase/index.js +3 -3
- package/components/PopupBase/utils.js +32 -78
- package/components/Price/Price.js +15 -90
- package/components/Price/index.js +1 -1
- package/components/RadioGroup/RadioGroup.js +6 -127
- package/components/RadioGroup/index.js +1 -1
- package/components/SSRProvider/SSRProvider.js +4 -5
- package/components/SSRProvider/index.js +1 -1
- package/components/Skeleton/LineSkeleton.js +23 -95
- package/components/Skeleton/RectSkeleton.js +20 -93
- package/components/Skeleton/Skeleton.js +2 -2
- package/components/Skeleton/TextSkeleton.js +11 -55
- package/components/Skeleton/index.js +3 -3
- package/components/Slider/Double.js +52 -203
- package/components/Slider/Handle.js +28 -158
- package/components/Slider/Single.js +29 -177
- package/components/Slider/Slider.js +5 -7
- package/components/Slider/SliderBase.js +39 -48
- package/components/Slider/ThumbBase.js +19 -95
- package/components/Slider/index.js +3 -3
- package/components/Slider/utils.js +2 -2
- package/components/Spinner/Spinner.js +28 -100
- package/components/Spinner/SpinnerSvg.js +9 -78
- package/components/Spinner/index.js +1 -1
- package/components/Switch/Switch.js +49 -220
- package/components/Switch/index.js +1 -1
- package/components/Tabs/TabItem.js +33 -168
- package/components/Tabs/Tabs.js +32 -170
- package/components/Tabs/TabsContext.js +12 -42
- package/components/Tabs/createTabsController.js +33 -168
- package/components/Tabs/index.js +4 -4
- package/components/TextArea/TextArea.js +20 -30
- package/components/TextArea/index.js +1 -1
- package/components/TextField/index.js +3 -3
- package/components/Toast/Toast.js +15 -16
- package/components/Toast/ToastContext.js +4 -8
- package/components/Toast/ToastController.js +44 -101
- package/components/Toast/ToastProvider.js +37 -142
- package/components/Toast/index.js +3 -3
- package/components/Toast/useToast.js +6 -6
- package/components/Typography/Body.js +18 -18
- package/components/Typography/Button.js +13 -13
- package/components/Typography/Caption.js +8 -8
- package/components/Typography/Display.js +18 -18
- package/components/Typography/Footnote.js +13 -13
- package/components/Typography/Headline.js +43 -43
- package/components/Typography/Paragraph.js +24 -24
- package/components/Typography/Underline.js +8 -8
- package/es/__helpers/IconPlaceholder.js +5 -8
- package/es/collectPackageInfo.js +3 -3
- package/es/components/Badge/Badge.js +27 -100
- package/es/components/Basebox/Basebox.js +28 -37
- package/es/components/Button/Button.js +24 -63
- package/es/components/Button/Button.mixins.js +19 -73
- package/es/components/Button/Button.props.js +3 -3
- package/es/components/Button/createButton.js +12 -143
- package/es/components/Card/Card.js +29 -157
- package/es/components/Card/CardBody.js +2 -2
- package/es/components/Card/CardContent.js +12 -21
- package/es/components/Card/CardMedia.js +17 -88
- package/es/components/Card/CardPrice.js +13 -55
- package/es/components/Card/CardTypography.js +43 -52
- package/es/components/Carousel/Carousel.js +45 -63
- package/es/components/Carousel/CarouselItem.js +18 -90
- package/es/components/Carousel/hooks.js +58 -117
- package/es/components/Carousel/utils.js +58 -72
- package/es/components/Fade/Fade.js +5 -8
- package/es/components/Field/Field.js +44 -59
- package/es/components/Field/Field.statuses.js +4 -4
- package/es/components/Image/Image.js +31 -112
- package/es/components/Input/Input.js +4 -4
- package/es/components/Input/Input.mixins.js +6 -9
- package/es/components/ModalBase/ModalBase.js +16 -94
- package/es/components/ModalBase/ModalBaseContext.js +6 -9
- package/es/components/ModalBase/ModalOverlay.js +23 -106
- package/es/components/ModalBase/hooks.js +12 -40
- package/es/components/PaginationDots/PaginationDot.js +9 -15
- package/es/components/PaginationDots/PaginationDots.js +3 -6
- package/es/components/PaginationDots/usePaginationDots.js +9 -10
- package/es/components/Popup/Popup.js +48 -201
- package/es/components/PopupBase/PopupBase.js +27 -161
- package/es/components/PopupBase/PopupBaseContext.js +25 -85
- package/es/components/PopupBase/PopupBaseRoot.js +26 -164
- package/es/components/PopupBase/hooks.js +21 -95
- package/es/components/PopupBase/utils.js +31 -77
- package/es/components/Price/Price.js +12 -87
- package/es/components/RadioGroup/RadioGroup.js +5 -126
- package/es/components/SSRProvider/SSRProvider.js +3 -4
- package/es/components/Skeleton/LineSkeleton.js +18 -90
- package/es/components/Skeleton/RectSkeleton.js +16 -89
- package/es/components/Skeleton/Skeleton.js +2 -2
- package/es/components/Skeleton/TextSkeleton.js +7 -51
- package/es/components/Slider/Double.js +49 -200
- package/es/components/Slider/Handle.js +23 -153
- package/es/components/Slider/Single.js +26 -174
- package/es/components/Slider/Slider.js +2 -4
- package/es/components/Slider/SliderBase.js +36 -45
- package/es/components/Slider/ThumbBase.js +16 -92
- package/es/components/Slider/index.js +1 -1
- package/es/components/Slider/utils.js +2 -2
- package/es/components/Spinner/Spinner.js +23 -95
- package/es/components/Spinner/SpinnerSvg.js +8 -77
- package/es/components/Switch/Switch.js +45 -216
- package/es/components/Tabs/TabItem.js +28 -163
- package/es/components/Tabs/Tabs.js +28 -166
- package/es/components/Tabs/TabsContext.js +11 -41
- package/es/components/Tabs/createTabsController.js +28 -163
- package/es/components/TextArea/TextArea.js +18 -28
- package/es/components/Toast/Toast.js +10 -11
- package/es/components/Toast/ToastContext.js +3 -7
- package/es/components/Toast/ToastController.js +38 -95
- package/es/components/Toast/ToastProvider.js +34 -139
- package/es/components/Toast/useToast.js +4 -4
- package/es/components/Typography/Body.js +15 -15
- package/es/components/Typography/Button.js +10 -10
- package/es/components/Typography/Caption.js +5 -5
- package/es/components/Typography/Display.js +15 -15
- package/es/components/Typography/Footnote.js +10 -10
- package/es/components/Typography/Headline.js +40 -40
- package/es/components/Typography/Paragraph.js +21 -21
- package/es/components/Typography/Underline.js +5 -5
- package/es/hocs/withAutoFocus.js +8 -78
- package/es/hocs/withSkeleton.js +5 -10
- package/es/hooks/useDebouncedFunction.js +4 -36
- package/es/hooks/useFocusTrap.js +18 -21
- package/es/hooks/useForkRef.js +3 -3
- package/es/hooks/useIsomorphicLayoutEffect.js +1 -1
- package/es/hooks/useResizeObserver.js +8 -8
- package/es/hooks/useUniqId.js +6 -52
- package/es/mixins/addFocus.js +17 -22
- package/es/mixins/applyDisabled.js +6 -9
- package/es/mixins/applyEllipsis.js +2 -4
- package/es/mixins/applyMaxLines.js +3 -6
- package/es/mixins/applyNoSelect.js +2 -4
- package/es/mixins/applyOutline.js +2 -4
- package/es/mixins/applyRoundness.js +4 -7
- package/es/mixins/applyScrollSnap.js +4 -7
- package/es/mixins/applySkeletonGradient.js +6 -9
- package/es/mixins/applyView.js +2 -5
- package/es/mixins/blur.js +2 -5
- package/es/mixins/shadows.js +1 -1
- package/es/tokens/colors.js +48 -48
- package/es/tokens/typography.js +18 -18
- package/es/utils/__tests__/formatters.test.js +2 -2
- package/es/utils/animatedScrollTo.js +24 -34
- package/es/utils/canUseDOM.js +1 -1
- package/es/utils/extractTextFrom.js +3 -7
- package/es/utils/focusManager.js +40 -47
- package/es/utils/formatCurrency.js +4 -4
- package/es/utils/formatters.js +6 -14
- package/es/utils/react.js +4 -4
- package/es/utils/roundness.js +2 -4
- package/es/utils/scopeTab.js +5 -5
- package/es/utils/setRef.js +1 -1
- package/es/utils/tabbable.js +16 -25
- package/es/utils/toCssSize.js +1 -3
- package/es/utils/transformStyles.js +5 -60
- package/hocs/index.js +2 -2
- package/hocs/withAutoFocus.js +9 -79
- package/hocs/withSkeleton.js +8 -13
- package/hooks/index.js +6 -6
- package/hooks/useDebouncedFunction.js +5 -37
- package/hooks/useFocusTrap.js +22 -25
- package/hooks/useForkRef.js +5 -5
- package/hooks/useIsomorphicLayoutEffect.js +3 -3
- package/hooks/useResizeObserver.js +9 -9
- package/hooks/useUniqId.js +8 -54
- package/mixins/addFocus.js +19 -24
- package/mixins/applyDisabled.js +7 -10
- package/mixins/applyEllipsis.js +3 -5
- package/mixins/applyMaxLines.js +4 -7
- package/mixins/applyNoSelect.js +3 -5
- package/mixins/applyOutline.js +3 -5
- package/mixins/applyRoundness.js +5 -8
- package/mixins/applyScrollSnap.js +5 -8
- package/mixins/applySkeletonGradient.js +8 -11
- package/mixins/applyView.js +3 -6
- package/mixins/blur.js +2 -5
- package/mixins/index.js +11 -11
- package/mixins/shadows.js +1 -1
- package/package.json +13 -18
- package/tokens/colors.js +48 -48
- package/tokens/typography.js +18 -18
- package/utils/__tests__/formatters.test.js +3 -3
- package/utils/animatedScrollTo.js +24 -34
- package/utils/canUseDOM.js +1 -1
- package/utils/extractTextFrom.js +4 -8
- package/utils/focusManager.js +41 -48
- package/utils/formatCurrency.js +4 -4
- package/utils/formatters.js +6 -14
- package/utils/index.js +10 -10
- package/utils/react.js +7 -7
- package/utils/roundness.js +2 -4
- package/utils/scopeTab.js +6 -6
- package/utils/setRef.js +1 -1
- package/utils/tabbable.js +16 -25
- package/utils/toCssSize.js +1 -3
- package/utils/transformStyles.js +5 -60
|
@@ -16,35 +16,34 @@ _export(exports, {
|
|
|
16
16
|
return Toast;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
|
|
20
|
+
const _styledcomponents = /*#__PURE__*/ _interop_require_default(require("styled-components"));
|
|
21
|
+
const _mixins = require("../../mixins");
|
|
22
|
+
const _tokens = require("../../tokens");
|
|
23
|
+
const _Typography = require("../Typography");
|
|
24
24
|
function _interop_require_default(obj) {
|
|
25
25
|
return obj && obj.__esModule ? obj : {
|
|
26
26
|
default: obj
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
const StyledRoot = (0, _styledcomponents.default)(_Typography.Footnote1).withConfig({
|
|
30
30
|
displayName: "Toast__StyledRoot",
|
|
31
31
|
componentId: "sc-d40fdfda-0"
|
|
32
32
|
})([
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
`display:inline-flex;align-items:center;padding:0.6875rem 1.25rem;border-radius:1.5rem;background:`,
|
|
34
|
+
`;color:`,
|
|
35
|
+
`;`,
|
|
36
|
+
`;`
|
|
37
37
|
], _tokens.dark02, _tokens.white, _mixins.applyNoSelect);
|
|
38
|
-
|
|
38
|
+
const StyledContent = _styledcomponents.default.div.withConfig({
|
|
39
39
|
displayName: "Toast__StyledContent",
|
|
40
40
|
componentId: "sc-d40fdfda-1"
|
|
41
41
|
})([
|
|
42
|
-
|
|
42
|
+
`display:flex;align-items:center;margin-right:0.5rem;`
|
|
43
43
|
]);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
var ariaAtomic = false;
|
|
44
|
+
const Toast = ({ role = 'status', text, contentLeft })=>{
|
|
45
|
+
let ariaLive = 'polite';
|
|
46
|
+
let ariaAtomic = false;
|
|
48
47
|
if (role === 'alert') {
|
|
49
48
|
ariaLive = 'assertive';
|
|
50
49
|
} else if (role === 'status') {
|
|
@@ -8,15 +8,11 @@ Object.defineProperty(exports, "ToastContext", {
|
|
|
8
8
|
return ToastContext;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const _react = require("react");
|
|
12
|
+
const ToastContext = /*#__PURE__*/ (0, _react.createContext)({
|
|
13
13
|
text: null,
|
|
14
14
|
position: null,
|
|
15
15
|
timeout: null,
|
|
16
|
-
showToast:
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
hideToast: function hideToast() {
|
|
20
|
-
return undefined;
|
|
21
|
-
}
|
|
16
|
+
showToast: ()=>undefined,
|
|
17
|
+
hideToast: ()=>undefined
|
|
22
18
|
});
|
|
@@ -8,20 +8,12 @@ Object.defineProperty(exports, "ToastController", {
|
|
|
8
8
|
return ToastController;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
function _array_like_to_array(arr, len) {
|
|
18
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
19
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
20
|
-
return arr2;
|
|
21
|
-
}
|
|
22
|
-
function _array_with_holes(arr) {
|
|
23
|
-
if (Array.isArray(arr)) return arr;
|
|
24
|
-
}
|
|
11
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
|
+
const _styledcomponents = /*#__PURE__*/ _interop_require_wildcard(require("styled-components"));
|
|
13
|
+
const _Fade = require("../Fade");
|
|
14
|
+
const _utils = require("../../utils");
|
|
15
|
+
const _Toast = require("./Toast");
|
|
16
|
+
const _useToast = require("./useToast");
|
|
25
17
|
function _getRequireWildcardCache(nodeInterop) {
|
|
26
18
|
if (typeof WeakMap !== "function") return null;
|
|
27
19
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -63,106 +55,57 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
63
55
|
}
|
|
64
56
|
return newObj;
|
|
65
57
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
var _arr = [];
|
|
70
|
-
var _n = true;
|
|
71
|
-
var _d = false;
|
|
72
|
-
var _s, _e;
|
|
73
|
-
try {
|
|
74
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
75
|
-
_arr.push(_s.value);
|
|
76
|
-
if (i && _arr.length === i) break;
|
|
77
|
-
}
|
|
78
|
-
} catch (err) {
|
|
79
|
-
_d = true;
|
|
80
|
-
_e = err;
|
|
81
|
-
} finally{
|
|
82
|
-
try {
|
|
83
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
84
|
-
} finally{
|
|
85
|
-
if (_d) throw _e;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return _arr;
|
|
89
|
-
}
|
|
90
|
-
function _non_iterable_rest() {
|
|
91
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
92
|
-
}
|
|
93
|
-
function _sliced_to_array(arr, i) {
|
|
94
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
95
|
-
}
|
|
96
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
97
|
-
if (!o) return;
|
|
98
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
99
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
100
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
101
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
102
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
103
|
-
}
|
|
104
|
-
var showAnimation = function showAnimation(position) {
|
|
105
|
-
return (0, _styledcomponents.keyframes)([
|
|
106
|
-
"0%{transform:translate(-50%,",
|
|
107
|
-
"5rem);opacity:0;}80%{transform:translate(-50%,0);opacity:0.7;}100%{opacity:1;}"
|
|
58
|
+
const showAnimation = (position)=>(0, _styledcomponents.keyframes)([
|
|
59
|
+
`0%{transform:translate(-50%,`,
|
|
60
|
+
`5rem);opacity:0;}80%{transform:translate(-50%,0);opacity:0.7;}100%{opacity:1;}`
|
|
108
61
|
], position === 'top' && '-');
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
"0%{opacity:1;}20%{transform:translate(-50%,0);opacity:0.7;}100%{transform:translate(-50%,",
|
|
113
|
-
"5rem);opacity:0;}"
|
|
62
|
+
const hideAnimation = (position)=>(0, _styledcomponents.keyframes)([
|
|
63
|
+
`0%{opacity:1;}20%{transform:translate(-50%,0);opacity:0.7;}100%{transform:translate(-50%,`,
|
|
64
|
+
`5rem);opacity:0;}`
|
|
114
65
|
], position === 'top' && '-');
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
"from{opacity:0;}to{opacity:1;}"
|
|
66
|
+
const fadeIn = (0, _styledcomponents.keyframes)([
|
|
67
|
+
`from{opacity:0;}to{opacity:1;}`
|
|
118
68
|
]);
|
|
119
|
-
|
|
120
|
-
|
|
69
|
+
const fadeOut = (0, _styledcomponents.keyframes)([
|
|
70
|
+
`from{opacity:1;}to{opacity:0;}`
|
|
121
71
|
]);
|
|
122
|
-
|
|
72
|
+
const StyledFade = (0, _styledcomponents.default)(_Fade.Fade).withConfig({
|
|
123
73
|
displayName: "ToastController__StyledFade",
|
|
124
74
|
componentId: "sc-339da759-0"
|
|
125
75
|
})([
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
],
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
], isVisible ? fadeIn : fadeOut);
|
|
134
|
-
});
|
|
135
|
-
var StyledRoot = _styledcomponents.default.div.withConfig({
|
|
76
|
+
``,
|
|
77
|
+
`;`
|
|
78
|
+
], ({ isVisible })=>(0, _styledcomponents.css)([
|
|
79
|
+
`animation:300ms `,
|
|
80
|
+
`;`
|
|
81
|
+
], isVisible ? fadeIn : fadeOut));
|
|
82
|
+
const StyledRoot = _styledcomponents.default.div.withConfig({
|
|
136
83
|
displayName: "ToastController__StyledRoot",
|
|
137
84
|
componentId: "sc-339da759-1"
|
|
138
85
|
})([
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
],
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
var _useState = _sliced_to_array((0, _react.useState)(true), 2), isVisible = _useState[0], setIsVisible = _useState[1];
|
|
155
|
-
var hideTimeout = (0, _react.useRef)(null);
|
|
156
|
-
var toastKey = "".concat(text).concat(position);
|
|
157
|
-
var animationEndHandler = (0, _react.useCallback)(function() {
|
|
86
|
+
`position:fixed;left:50%;z-index:1000;transform:translateX(-50%);`,
|
|
87
|
+
`;display:flex;width:0;`,
|
|
88
|
+
`{transform:translateX(-50%);max-width:calc(100vw - 5rem);flex-shrink:0;}`
|
|
89
|
+
], ({ $position, isVisible, $offset = 0 })=>(0, _styledcomponents.css)([
|
|
90
|
+
``,
|
|
91
|
+
`:`,
|
|
92
|
+
`rem;animation:300ms `,
|
|
93
|
+
`;`
|
|
94
|
+
], $position, $offset + 5, isVisible ? showAnimation($position) : hideAnimation($position)), _Toast.StyledRoot);
|
|
95
|
+
const ToastController = ({ role, text, contentLeft, position, timeout, fade, offset })=>{
|
|
96
|
+
const { hideToast } = (0, _useToast.useToast)();
|
|
97
|
+
const [isVisible, setIsVisible] = (0, _react.useState)(true);
|
|
98
|
+
const hideTimeout = (0, _react.useRef)(null);
|
|
99
|
+
const toastKey = `${text}${position}`;
|
|
100
|
+
const animationEndHandler = (0, _react.useCallback)(()=>{
|
|
158
101
|
if (!isVisible) {
|
|
159
102
|
hideToast();
|
|
160
|
-
(0, _utils.safeFlushSync)(
|
|
103
|
+
(0, _utils.safeFlushSync)(()=>{
|
|
161
104
|
setIsVisible(true); // Необходимо вернуть булево к следующему вызову тоста
|
|
162
105
|
});
|
|
163
106
|
}
|
|
164
107
|
if (isVisible) {
|
|
165
|
-
hideTimeout.current = setTimeout(
|
|
108
|
+
hideTimeout.current = setTimeout(()=>{
|
|
166
109
|
setIsVisible(false);
|
|
167
110
|
}, timeout);
|
|
168
111
|
}
|
|
@@ -171,15 +114,15 @@ var ToastController = function ToastController(param) {
|
|
|
171
114
|
timeout,
|
|
172
115
|
isVisible
|
|
173
116
|
]);
|
|
174
|
-
(0, _react.useEffect)(
|
|
117
|
+
(0, _react.useEffect)(()=>{
|
|
175
118
|
if (timeout === null && hideTimeout.current !== null) {
|
|
176
119
|
clearTimeout(hideTimeout.current);
|
|
177
120
|
}
|
|
178
121
|
}, [
|
|
179
122
|
timeout
|
|
180
123
|
]);
|
|
181
|
-
(0, _react.useEffect)(
|
|
182
|
-
return
|
|
124
|
+
(0, _react.useEffect)(()=>{
|
|
125
|
+
return ()=>{
|
|
183
126
|
if (hideTimeout.current !== null) {
|
|
184
127
|
clearTimeout(hideTimeout.current);
|
|
185
128
|
}
|
|
@@ -8,30 +8,9 @@ Object.defineProperty(exports, "ToastProvider", {
|
|
|
8
8
|
return ToastProvider;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
function _array_like_to_array(arr, len) {
|
|
15
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
16
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
17
|
-
return arr2;
|
|
18
|
-
}
|
|
19
|
-
function _array_with_holes(arr) {
|
|
20
|
-
if (Array.isArray(arr)) return arr;
|
|
21
|
-
}
|
|
22
|
-
function _define_property(obj, key, value) {
|
|
23
|
-
if (key in obj) {
|
|
24
|
-
Object.defineProperty(obj, key, {
|
|
25
|
-
value: value,
|
|
26
|
-
enumerable: true,
|
|
27
|
-
configurable: true,
|
|
28
|
-
writable: true
|
|
29
|
-
});
|
|
30
|
-
} else {
|
|
31
|
-
obj[key] = value;
|
|
32
|
-
}
|
|
33
|
-
return obj;
|
|
34
|
-
}
|
|
11
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
|
+
const _ToastController = require("./ToastController");
|
|
13
|
+
const _ToastContext = require("./ToastContext");
|
|
35
14
|
function _getRequireWildcardCache(nodeInterop) {
|
|
36
15
|
if (typeof WeakMap !== "function") return null;
|
|
37
16
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -73,135 +52,50 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
73
52
|
}
|
|
74
53
|
return newObj;
|
|
75
54
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
var _d = false;
|
|
82
|
-
var _s, _e;
|
|
83
|
-
try {
|
|
84
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
85
|
-
_arr.push(_s.value);
|
|
86
|
-
if (i && _arr.length === i) break;
|
|
87
|
-
}
|
|
88
|
-
} catch (err) {
|
|
89
|
-
_d = true;
|
|
90
|
-
_e = err;
|
|
91
|
-
} finally{
|
|
92
|
-
try {
|
|
93
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
94
|
-
} finally{
|
|
95
|
-
if (_d) throw _e;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return _arr;
|
|
99
|
-
}
|
|
100
|
-
function _non_iterable_rest() {
|
|
101
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
102
|
-
}
|
|
103
|
-
function _object_spread(target) {
|
|
104
|
-
for(var i = 1; i < arguments.length; i++){
|
|
105
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
106
|
-
var ownKeys = Object.keys(source);
|
|
107
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
108
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
109
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
110
|
-
}));
|
|
111
|
-
}
|
|
112
|
-
ownKeys.forEach(function(key) {
|
|
113
|
-
_define_property(target, key, source[key]);
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
return target;
|
|
117
|
-
}
|
|
118
|
-
function ownKeys(object, enumerableOnly) {
|
|
119
|
-
var keys = Object.keys(object);
|
|
120
|
-
if (Object.getOwnPropertySymbols) {
|
|
121
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
122
|
-
if (enumerableOnly) {
|
|
123
|
-
symbols = symbols.filter(function(sym) {
|
|
124
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
keys.push.apply(keys, symbols);
|
|
128
|
-
}
|
|
129
|
-
return keys;
|
|
130
|
-
}
|
|
131
|
-
function _object_spread_props(target, source) {
|
|
132
|
-
source = source != null ? source : {};
|
|
133
|
-
if (Object.getOwnPropertyDescriptors) {
|
|
134
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
135
|
-
} else {
|
|
136
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
137
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
return target;
|
|
141
|
-
}
|
|
142
|
-
function _sliced_to_array(arr, i) {
|
|
143
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
144
|
-
}
|
|
145
|
-
function _type_of(obj) {
|
|
146
|
-
"@swc/helpers - typeof";
|
|
147
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
148
|
-
}
|
|
149
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
150
|
-
if (!o) return;
|
|
151
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
152
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
153
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
154
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
155
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
156
|
-
}
|
|
157
|
-
var DEFAULT_POSITION = 'bottom';
|
|
158
|
-
var DEFAULT_TIMEOUT = 3000;
|
|
159
|
-
var DEFAULT_FADE = true;
|
|
160
|
-
var getShowToastCallSignature = function getShowToastCallSignature(args) {
|
|
161
|
-
if (_type_of(args[0]) === 'object' && 'text' in args[0]) {
|
|
55
|
+
const DEFAULT_POSITION = 'bottom';
|
|
56
|
+
const DEFAULT_TIMEOUT = 3000;
|
|
57
|
+
const DEFAULT_FADE = true;
|
|
58
|
+
const getShowToastCallSignature = (args)=>{
|
|
59
|
+
if (typeof args[0] === 'object' && 'text' in args[0]) {
|
|
162
60
|
return args[0];
|
|
163
61
|
}
|
|
164
62
|
// TODO: issue https://github.com/salute-developers/plasma/issues/333
|
|
165
|
-
|
|
63
|
+
const [text, position, timeout, fade, contentLeft, role] = args;
|
|
166
64
|
return {
|
|
167
|
-
text
|
|
168
|
-
position
|
|
169
|
-
timeout
|
|
170
|
-
fade
|
|
171
|
-
contentLeft
|
|
172
|
-
role
|
|
65
|
+
text,
|
|
66
|
+
position,
|
|
67
|
+
timeout,
|
|
68
|
+
fade,
|
|
69
|
+
contentLeft,
|
|
70
|
+
role
|
|
173
71
|
};
|
|
174
72
|
};
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
var _useState = _sliced_to_array((0, _react.useState)({
|
|
73
|
+
const ToastProvider = ({ children })=>{
|
|
74
|
+
const [value, setValue] = (0, _react.useState)({
|
|
178
75
|
text: null,
|
|
179
76
|
position: null,
|
|
180
77
|
timeout: null
|
|
181
|
-
})
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
args[_key] = arguments[_key];
|
|
185
|
-
}
|
|
186
|
-
var _getShowToastCallSignature = getShowToastCallSignature(args), text = _getShowToastCallSignature.text, _getShowToastCallSignature_position = _getShowToastCallSignature.position, position = _getShowToastCallSignature_position === void 0 ? DEFAULT_POSITION : _getShowToastCallSignature_position, _getShowToastCallSignature_timeout = _getShowToastCallSignature.timeout, timeout = _getShowToastCallSignature_timeout === void 0 ? DEFAULT_TIMEOUT : _getShowToastCallSignature_timeout, _getShowToastCallSignature_fade = _getShowToastCallSignature.fade, fade = _getShowToastCallSignature_fade === void 0 ? DEFAULT_FADE : _getShowToastCallSignature_fade, contentLeft = _getShowToastCallSignature.contentLeft, role = _getShowToastCallSignature.role, onHide = _getShowToastCallSignature.onHide, onShow = _getShowToastCallSignature.onShow, offset = _getShowToastCallSignature.offset;
|
|
78
|
+
});
|
|
79
|
+
const showToastCallback = (...args)=>{
|
|
80
|
+
const { text, position = DEFAULT_POSITION, timeout = DEFAULT_TIMEOUT, fade = DEFAULT_FADE, contentLeft, role, onHide, onShow, offset } = getShowToastCallSignature(args);
|
|
187
81
|
setValue({
|
|
188
|
-
text
|
|
189
|
-
position
|
|
190
|
-
timeout
|
|
191
|
-
fade
|
|
192
|
-
contentLeft
|
|
193
|
-
role
|
|
194
|
-
onHide
|
|
195
|
-
onShow
|
|
196
|
-
offset
|
|
82
|
+
text,
|
|
83
|
+
position,
|
|
84
|
+
timeout,
|
|
85
|
+
fade,
|
|
86
|
+
contentLeft,
|
|
87
|
+
role,
|
|
88
|
+
onHide,
|
|
89
|
+
onShow,
|
|
90
|
+
offset
|
|
197
91
|
});
|
|
198
92
|
if (onShow) {
|
|
199
93
|
onShow();
|
|
200
94
|
}
|
|
201
95
|
};
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
96
|
+
const showToast = (0, _react.useCallback)(showToastCallback, []);
|
|
97
|
+
const { onHide } = value;
|
|
98
|
+
const hideToast = (0, _react.useCallback)(()=>{
|
|
205
99
|
setValue({
|
|
206
100
|
text: null,
|
|
207
101
|
position: null,
|
|
@@ -214,9 +108,10 @@ var ToastProvider = function ToastProvider(param) {
|
|
|
214
108
|
onHide
|
|
215
109
|
]);
|
|
216
110
|
return /*#__PURE__*/ _react.default.createElement(_ToastContext.ToastContext.Provider, {
|
|
217
|
-
value:
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
111
|
+
value: {
|
|
112
|
+
...value,
|
|
113
|
+
showToast,
|
|
114
|
+
hideToast
|
|
115
|
+
}
|
|
221
116
|
}, children, /*#__PURE__*/ _react.default.createElement(_ToastController.ToastController, value));
|
|
222
117
|
};
|
|
@@ -19,6 +19,6 @@ _export(exports, {
|
|
|
19
19
|
return _useToast.useToast;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const _Toast = require("./Toast");
|
|
23
|
+
const _ToastProvider = require("./ToastProvider");
|
|
24
|
+
const _useToast = require("./useToast");
|
|
@@ -8,12 +8,12 @@ Object.defineProperty(exports, "useToast", {
|
|
|
8
8
|
return useToast;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const _react = require("react");
|
|
12
|
+
const _ToastContext = require("./ToastContext");
|
|
13
|
+
const useToast = ()=>{
|
|
14
|
+
const { showToast, hideToast } = (0, _react.useContext)(_ToastContext.ToastContext);
|
|
15
15
|
return {
|
|
16
|
-
showToast
|
|
17
|
-
hideToast
|
|
16
|
+
showToast,
|
|
17
|
+
hideToast
|
|
18
18
|
};
|
|
19
19
|
};
|
|
@@ -19,38 +19,38 @@ _export(exports, {
|
|
|
19
19
|
return Body3;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const _styledcomponents = /*#__PURE__*/ _interop_require_default(require("styled-components"));
|
|
23
|
+
const _tokens = require("../../tokens");
|
|
24
|
+
const _mixins = require("../../mixins");
|
|
25
25
|
function _interop_require_default(obj) {
|
|
26
26
|
return obj && obj.__esModule ? obj : {
|
|
27
27
|
default: obj
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
const Body1 = _styledcomponents.default.div.withConfig({
|
|
31
31
|
displayName: "Body__Body1",
|
|
32
32
|
componentId: "sc-66189794-0"
|
|
33
33
|
})([
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
``,
|
|
35
|
+
` `,
|
|
36
|
+
` `,
|
|
37
|
+
``
|
|
38
38
|
], _mixins.applyHyphens, _mixins.applySpacing, _tokens.body1);
|
|
39
|
-
|
|
39
|
+
const Body2 = _styledcomponents.default.div.withConfig({
|
|
40
40
|
displayName: "Body__Body2",
|
|
41
41
|
componentId: "sc-66189794-1"
|
|
42
42
|
})([
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
``,
|
|
44
|
+
` `,
|
|
45
|
+
` `,
|
|
46
|
+
``
|
|
47
47
|
], _mixins.applyHyphens, _mixins.applySpacing, _tokens.body2);
|
|
48
|
-
|
|
48
|
+
const Body3 = _styledcomponents.default.div.withConfig({
|
|
49
49
|
displayName: "Body__Body3",
|
|
50
50
|
componentId: "sc-66189794-2"
|
|
51
51
|
})([
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
``,
|
|
53
|
+
` `,
|
|
54
|
+
` `,
|
|
55
|
+
``
|
|
56
56
|
], _mixins.applyHyphens, _mixins.applySpacing, _tokens.body3);
|
|
@@ -16,29 +16,29 @@ _export(exports, {
|
|
|
16
16
|
return Button2;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
const _styledcomponents = /*#__PURE__*/ _interop_require_default(require("styled-components"));
|
|
20
|
+
const _tokens = require("../../tokens");
|
|
21
|
+
const _mixins = require("../../mixins");
|
|
22
22
|
function _interop_require_default(obj) {
|
|
23
23
|
return obj && obj.__esModule ? obj : {
|
|
24
24
|
default: obj
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
const Button1 = _styledcomponents.default.div.withConfig({
|
|
28
28
|
displayName: "Button__Button1",
|
|
29
29
|
componentId: "sc-54b5d133-0"
|
|
30
30
|
})([
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
``,
|
|
32
|
+
` `,
|
|
33
|
+
` `,
|
|
34
|
+
``
|
|
35
35
|
], _mixins.applyHyphens, _mixins.applySpacing, _tokens.button1);
|
|
36
|
-
|
|
36
|
+
const Button2 = _styledcomponents.default.div.withConfig({
|
|
37
37
|
displayName: "Button__Button2",
|
|
38
38
|
componentId: "sc-54b5d133-1"
|
|
39
39
|
})([
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
``,
|
|
41
|
+
` `,
|
|
42
|
+
` `,
|
|
43
|
+
``
|
|
44
44
|
], _mixins.applyHyphens, _mixins.applySpacing, _tokens.button2);
|
|
@@ -8,20 +8,20 @@ Object.defineProperty(exports, "Caption", {
|
|
|
8
8
|
return Caption;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const _styledcomponents = /*#__PURE__*/ _interop_require_default(require("styled-components"));
|
|
12
|
+
const _tokens = require("../../tokens");
|
|
13
|
+
const _mixins = require("../../mixins");
|
|
14
14
|
function _interop_require_default(obj) {
|
|
15
15
|
return obj && obj.__esModule ? obj : {
|
|
16
16
|
default: obj
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
const Caption = _styledcomponents.default.div.withConfig({
|
|
20
20
|
displayName: "Caption",
|
|
21
21
|
componentId: "sc-6a11b9de-0"
|
|
22
22
|
})([
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
``,
|
|
24
|
+
` `,
|
|
25
|
+
` `,
|
|
26
|
+
``
|
|
27
27
|
], _mixins.applyHyphens, _mixins.applySpacing, _tokens.caption);
|