@salutejs/plasma-new-hope 0.194.0-canary.1558.11852073996.0 → 0.194.0-canary.1560.11855728487.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Modal/Modal.css +0 -6
- package/cjs/components/Modal/Modal.js +13 -27
- package/cjs/components/Modal/Modal.js.map +1 -1
- package/cjs/components/Modal/Modal.tokens.js +1 -7
- package/cjs/components/Modal/Modal.tokens.js.map +1 -1
- package/cjs/components/Switch/Switch.css +2 -2
- package/cjs/components/Switch/Switch.tokens.js +7 -1
- package/cjs/components/Switch/Switch.tokens.js.map +1 -1
- package/cjs/components/Switch/_toggleSize/base.js +1 -1
- package/cjs/components/Switch/_toggleSize/base.js.map +1 -1
- package/cjs/components/Switch/_toggleSize/base_38anc0.css +1 -0
- package/cjs/components/Switch/_view/base.js +1 -1
- package/cjs/components/Switch/_view/base.js.map +1 -1
- package/cjs/components/Switch/_view/base_15atbyp.css +1 -0
- package/cjs/index.css +2 -6
- package/emotion/cjs/components/Modal/Modal.js +12 -26
- package/emotion/cjs/components/Modal/Modal.template-doc.mdx +0 -47
- package/emotion/cjs/components/Modal/Modal.tokens.js +1 -7
- package/emotion/cjs/components/Switch/Switch.tokens.js +7 -1
- package/emotion/cjs/components/Switch/_toggleSize/base.js +1 -1
- package/emotion/cjs/components/Switch/_view/base.js +1 -1
- package/emotion/cjs/examples/plasma_b2c/components/Modal/Modal.config.js +1 -1
- package/emotion/cjs/examples/plasma_b2c/components/Modal/Modal.stories.tsx +1 -90
- package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.config.js +8 -8
- package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.js +5 -2
- package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.outline.config.js +37 -0
- package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.stories.tsx +33 -1
- package/emotion/cjs/examples/plasma_web/components/Modal/Modal.config.js +1 -1
- package/emotion/cjs/examples/plasma_web/components/Modal/Modal.stories.tsx +1 -90
- package/emotion/cjs/examples/plasma_web/components/Switch/Switch.config.js +8 -8
- package/emotion/cjs/examples/plasma_web/components/Switch/Switch.js +5 -2
- package/emotion/cjs/examples/plasma_web/components/Switch/Switch.outline.config.js +37 -0
- package/emotion/cjs/examples/plasma_web/components/Switch/Switch.stories.tsx +33 -1
- package/emotion/es/components/Modal/Modal.js +12 -26
- package/emotion/es/components/Modal/Modal.template-doc.mdx +0 -47
- package/emotion/es/components/Modal/Modal.tokens.js +1 -7
- package/emotion/es/components/Switch/Switch.tokens.js +7 -1
- package/emotion/es/components/Switch/_toggleSize/base.js +1 -1
- package/emotion/es/components/Switch/_view/base.js +1 -1
- package/emotion/es/examples/plasma_b2c/components/Modal/Modal.config.js +1 -1
- package/emotion/es/examples/plasma_b2c/components/Modal/Modal.stories.tsx +1 -90
- package/emotion/es/examples/plasma_b2c/components/Switch/Switch.config.js +8 -8
- package/emotion/es/examples/plasma_b2c/components/Switch/Switch.js +4 -1
- package/emotion/es/examples/plasma_b2c/components/Switch/Switch.outline.config.js +31 -0
- package/emotion/es/examples/plasma_b2c/components/Switch/Switch.stories.tsx +33 -1
- package/emotion/es/examples/plasma_web/components/Modal/Modal.config.js +1 -1
- package/emotion/es/examples/plasma_web/components/Modal/Modal.stories.tsx +1 -90
- package/emotion/es/examples/plasma_web/components/Switch/Switch.config.js +8 -8
- package/emotion/es/examples/plasma_web/components/Switch/Switch.js +4 -1
- package/emotion/es/examples/plasma_web/components/Switch/Switch.outline.config.js +31 -0
- package/emotion/es/examples/plasma_web/components/Switch/Switch.stories.tsx +33 -1
- package/es/components/Modal/Modal.css +0 -6
- package/es/components/Modal/Modal.js +13 -27
- package/es/components/Modal/Modal.js.map +1 -1
- package/es/components/Modal/Modal.tokens.js +1 -7
- package/es/components/Modal/Modal.tokens.js.map +1 -1
- package/es/components/Switch/Switch.css +2 -2
- package/es/components/Switch/Switch.tokens.js +7 -1
- package/es/components/Switch/Switch.tokens.js.map +1 -1
- package/es/components/Switch/_toggleSize/base.js +1 -1
- package/es/components/Switch/_toggleSize/base.js.map +1 -1
- package/es/components/Switch/_toggleSize/base_38anc0.css +1 -0
- package/es/components/Switch/_view/base.js +1 -1
- package/es/components/Switch/_view/base.js.map +1 -1
- package/es/components/Switch/_view/base_15atbyp.css +1 -0
- package/es/index.css +2 -6
- package/package.json +2 -2
- package/styled-components/cjs/components/Modal/Modal.js +12 -26
- package/styled-components/cjs/components/Modal/Modal.template-doc.mdx +0 -47
- package/styled-components/cjs/components/Modal/Modal.tokens.js +1 -7
- package/styled-components/cjs/components/Switch/Switch.tokens.js +7 -1
- package/styled-components/cjs/components/Switch/_toggleSize/base.js +1 -1
- package/styled-components/cjs/components/Switch/_view/base.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Modal/Modal.config.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Modal/Modal.stories.tsx +1 -90
- package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.config.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.js +5 -2
- package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.outline.config.js +37 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.stories.tsx +33 -1
- package/styled-components/cjs/examples/plasma_web/components/Modal/Modal.config.js +1 -1
- package/styled-components/cjs/examples/plasma_web/components/Modal/Modal.stories.tsx +1 -90
- package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.config.js +1 -1
- package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.js +5 -2
- package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.outline.config.js +37 -0
- package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.stories.tsx +33 -1
- package/styled-components/es/components/Modal/Modal.js +12 -26
- package/styled-components/es/components/Modal/Modal.template-doc.mdx +0 -47
- package/styled-components/es/components/Modal/Modal.tokens.js +1 -7
- package/styled-components/es/components/Switch/Switch.tokens.js +7 -1
- package/styled-components/es/components/Switch/_toggleSize/base.js +1 -1
- package/styled-components/es/components/Switch/_view/base.js +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Modal/Modal.config.js +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Modal/Modal.stories.tsx +1 -90
- package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.config.js +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.js +4 -1
- package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.outline.config.js +31 -0
- package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.stories.tsx +33 -1
- package/styled-components/es/examples/plasma_web/components/Modal/Modal.config.js +1 -1
- package/styled-components/es/examples/plasma_web/components/Modal/Modal.stories.tsx +1 -90
- package/styled-components/es/examples/plasma_web/components/Switch/Switch.config.js +1 -1
- package/styled-components/es/examples/plasma_web/components/Switch/Switch.js +4 -1
- package/styled-components/es/examples/plasma_web/components/Switch/Switch.outline.config.js +31 -0
- package/styled-components/es/examples/plasma_web/components/Switch/Switch.stories.tsx +33 -1
- package/types/components/Modal/Modal.d.ts.map +1 -1
- package/types/components/Modal/Modal.tokens.d.ts +0 -6
- package/types/components/Modal/Modal.tokens.d.ts.map +1 -1
- package/types/components/Modal/Modal.types.d.ts +1 -21
- package/types/components/Modal/Modal.types.d.ts.map +1 -1
- package/types/components/Modal/index.d.ts +1 -1
- package/types/components/Modal/index.d.ts.map +1 -1
- package/types/components/Switch/Switch.tokens.d.ts +7 -1
- package/types/components/Switch/Switch.tokens.d.ts.map +1 -1
- package/types/components/Switch/_toggleSize/base.d.ts.map +1 -1
- package/types/components/Switch/_view/base.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Modal/Modal.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Modal/Modal.d.ts +1 -7
- package/types/examples/plasma_b2c/components/Modal/Modal.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Switch/Switch.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Switch/Switch.d.ts +20 -0
- package/types/examples/plasma_b2c/components/Switch/Switch.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Switch/Switch.outline.config.d.ts +30 -0
- package/types/examples/plasma_b2c/components/Switch/Switch.outline.config.d.ts.map +1 -0
- package/types/examples/plasma_web/components/Modal/Modal.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Modal/Modal.d.ts +1 -7
- package/types/examples/plasma_web/components/Modal/Modal.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Switch/Switch.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Switch/Switch.d.ts +20 -0
- package/types/examples/plasma_web/components/Switch/Switch.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Switch/Switch.outline.config.d.ts +30 -0
- package/types/examples/plasma_web/components/Switch/Switch.outline.config.d.ts.map +1 -0
- package/cjs/components/Modal/Modal.styles.js +0 -27
- package/cjs/components/Modal/Modal.styles.js.map +0 -1
- package/cjs/components/Modal/Modal.styles_tqsxxy.css +0 -3
- package/cjs/components/Switch/_toggleSize/base_6i0904.css +0 -1
- package/cjs/components/Switch/_view/base_yxkf3s.css +0 -1
- package/emotion/cjs/components/Modal/Modal.styles.js +0 -27
- package/emotion/es/components/Modal/Modal.styles.js +0 -20
- package/es/components/Modal/Modal.styles.js +0 -21
- package/es/components/Modal/Modal.styles.js.map +0 -1
- package/es/components/Modal/Modal.styles_tqsxxy.css +0 -3
- package/es/components/Switch/_toggleSize/base_6i0904.css +0 -1
- package/es/components/Switch/_view/base_yxkf3s.css +0 -1
- package/styled-components/cjs/components/Modal/Modal.styles.js +0 -24
- package/styled-components/es/components/Modal/Modal.styles.js +0 -17
- package/types/components/Modal/Modal.styles.d.ts +0 -5
- package/types/components/Modal/Modal.styles.d.ts.map +0 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@salutejs/plasma-new-hope",
|
3
|
-
"version": "0.194.0-canary.
|
3
|
+
"version": "0.194.0-canary.1560.11855728487.0",
|
4
4
|
"description": "Salute Design System blueprint",
|
5
5
|
"main": "cjs/index.js",
|
6
6
|
"module": "es/index.js",
|
@@ -128,5 +128,5 @@
|
|
128
128
|
"sideEffects": [
|
129
129
|
"*.css"
|
130
130
|
],
|
131
|
-
"gitHead": "
|
131
|
+
"gitHead": "a8aafde3c5ae964b2f53e2743779d03e3beb8155"
|
132
132
|
}
|
@@ -12,14 +12,11 @@ var _Popup = /*#__PURE__*/require("../Popup");
|
|
12
12
|
var _Overlay = /*#__PURE__*/require("../Overlay");
|
13
13
|
var _utils = /*#__PURE__*/require("../Popup/utils");
|
14
14
|
var _hooks = /*#__PURE__*/require("../../hooks");
|
15
|
-
var _IconClose2 = /*#__PURE__*/require("../_Icon/Icons/IconClose");
|
16
15
|
var _Modal = /*#__PURE__*/require("./Modal.tokens");
|
17
16
|
var _hooks2 = /*#__PURE__*/require("./hooks");
|
18
17
|
var _base = /*#__PURE__*/require("./variations/_view/base");
|
19
18
|
var _ModalContext = /*#__PURE__*/require("./ModalContext");
|
20
|
-
var
|
21
|
-
var _IconClose;
|
22
|
-
var _excluded = ["id", "withAnimation", "onClose", "onOverlayClick", "onEscKeyDown", "closeOnEsc", "closeOnOverlayClick", "withBlur", "initialFocusRef", "focusAfterRef", "zIndex", "popupInfo", "children", "view", "opened", "isOpen", "hasBody", "hasClose"];
|
19
|
+
var _excluded = ["id", "withAnimation", "onClose", "onOverlayClick", "onEscKeyDown", "closeOnEsc", "closeOnOverlayClick", "withBlur", "initialFocusRef", "focusAfterRef", "zIndex", "popupInfo", "children", "view", "opened", "isOpen"];
|
23
20
|
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); }
|
24
21
|
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; }
|
25
22
|
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); }
|
@@ -52,11 +49,8 @@ var modalRoot = exports.modalRoot = function modalRoot(Root) {
|
|
52
49
|
view = _ref.view,
|
53
50
|
opened = _ref.opened,
|
54
51
|
isOpen = _ref.isOpen,
|
55
|
-
hasBody = _ref.hasBody,
|
56
|
-
hasClose = _ref.hasClose,
|
57
52
|
rest = _objectWithoutProperties(_ref, _excluded);
|
58
53
|
var innerIsOpen = Boolean(isOpen || opened);
|
59
|
-
var innerHasClose = hasClose === undefined && hasBody || hasClose;
|
60
54
|
var trapRef = (0, _hooks.useFocusTrap)(true, initialFocusRef, focusAfterRef, true);
|
61
55
|
var popupController = (0, _Popup.usePopupContext)();
|
62
56
|
var innerRef = (0, _plasmaCore.useForkRef)(trapRef, outerRootRef);
|
@@ -84,15 +78,6 @@ var modalRoot = exports.modalRoot = function modalRoot(Root) {
|
|
84
78
|
onClose();
|
85
79
|
}
|
86
80
|
}, [closeOnOverlayClick, onOverlayClick, onClose]);
|
87
|
-
var overlayNode = /*#__PURE__*/_react["default"].createElement(_Overlay.Overlay, {
|
88
|
-
className: _Modal.classes.overlay,
|
89
|
-
zIndex: zIndex || _utils.DEFAULT_Z_INDEX,
|
90
|
-
backgroundColorProperty: overlayBackgroundToken,
|
91
|
-
withBlur: withBlur,
|
92
|
-
transparent: transparent,
|
93
|
-
isClickable: closeOnOverlayClick,
|
94
|
-
onOverlayClick: onModalOverlayKeyDown
|
95
|
-
});
|
96
81
|
return /*#__PURE__*/_react["default"].createElement(Popup, _extends({
|
97
82
|
id: innerId,
|
98
83
|
opened: innerIsOpen,
|
@@ -100,17 +85,18 @@ var modalRoot = exports.modalRoot = function modalRoot(Root) {
|
|
100
85
|
popupInfo: modalInfo,
|
101
86
|
withAnimation: withAnimation,
|
102
87
|
zIndex: zIndex,
|
103
|
-
overlay:
|
88
|
+
overlay: /*#__PURE__*/_react["default"].createElement(Root, {
|
104
89
|
view: view
|
105
|
-
},
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
90
|
+
}, /*#__PURE__*/_react["default"].createElement(_Overlay.Overlay, {
|
91
|
+
className: _Modal.classes.overlay,
|
92
|
+
zIndex: zIndex || _utils.DEFAULT_Z_INDEX,
|
93
|
+
backgroundColorProperty: overlayBackgroundToken,
|
94
|
+
withBlur: withBlur,
|
95
|
+
transparent: transparent,
|
96
|
+
isClickable: closeOnOverlayClick,
|
97
|
+
onOverlayClick: onModalOverlayKeyDown
|
98
|
+
}))
|
99
|
+
}, rest), children);
|
114
100
|
});
|
115
101
|
};
|
116
102
|
var modalConfig = exports.modalConfig = {
|
@@ -62,53 +62,6 @@ export function App() {
|
|
62
62
|
}
|
63
63
|
```
|
64
64
|
|
65
|
-
## Использование стилизованной обертки
|
66
|
-
|
67
|
-
Для использования стилизованного мобального окна с отступами и крестиком для закрытия, добавьте свойство `hasBody`.
|
68
|
-
```tsx live
|
69
|
-
import React, { useState } from 'react';
|
70
|
-
import { SSRProvider, Button, Modal, PopupProvider } from '@salutejs/{{ package }}';
|
71
|
-
|
72
|
-
export function App() {
|
73
|
-
const [isOpenA, setIsOpenA] = useState(false);
|
74
|
-
const [isOpenB, setIsOpenB] = useState(false);
|
75
|
-
|
76
|
-
return (
|
77
|
-
<SSRProvider>
|
78
|
-
<PopupProvider>
|
79
|
-
<div style=\{{ height: "300px" }}>
|
80
|
-
<div style=\{{ display: 'flex', flexDirection: 'column' }}>
|
81
|
-
<Button text="Открыть A" onClick={() => setIsOpenA(true)} />
|
82
|
-
</div>
|
83
|
-
<Modal
|
84
|
-
id="modalA"
|
85
|
-
onClose={() => setIsOpenA(false)}
|
86
|
-
opened={isOpenA}
|
87
|
-
placement="center"
|
88
|
-
offset={[0, 0]}
|
89
|
-
hasBody
|
90
|
-
>
|
91
|
-
<Button onClick={() => setIsOpenA(false)}>Close</Button>
|
92
|
-
<Button text="Открыть B" onClick={() => setIsOpenB(true)} />
|
93
|
-
Content
|
94
|
-
<Modal
|
95
|
-
id="modalB"
|
96
|
-
onClose={() => setIsOpenB(false)}
|
97
|
-
opened={isOpenB}
|
98
|
-
placement="right"
|
99
|
-
offset={[0, 0]}
|
100
|
-
>
|
101
|
-
<Button onClick={() => setIsOpenB(false)}>Close</Button>
|
102
|
-
Content
|
103
|
-
</Modal>
|
104
|
-
</Modal>
|
105
|
-
</div>
|
106
|
-
</PopupProvider>
|
107
|
-
</SSRProvider>
|
108
|
-
);
|
109
|
-
}
|
110
|
-
```
|
111
|
-
|
112
65
|
## Подключение анимации
|
113
66
|
Подключение анимации аналогично тому, как это происходит в `Popup` - через свойство `withAnimation`(управление через `popupClasses`, `modalClasses`).
|
114
67
|
Для добавления анимации в оверлей необходимо использовать класс `.modal-overlay` через переменную `modalClasses.overlay` из пакета.
|
@@ -12,11 +12,5 @@ var classes = exports.classes = {
|
|
12
12
|
};
|
13
13
|
var tokens = exports.tokens = {
|
14
14
|
modalOverlayWithBlurColor: '--plasma-modal-overlay-with-blur-color',
|
15
|
-
modalOverlayColor: '--plasma-modal-overlay-color'
|
16
|
-
modalBodyBackground: '--plasma-modal-body-background',
|
17
|
-
modalBodyBorderRadius: '--plasma-modal-body-border-radius',
|
18
|
-
modalBodyPadding: '--plasma-modal-body-padding',
|
19
|
-
modalContentPadding: '--plasma-modal-content-padding',
|
20
|
-
modalOutlineFocusColor: '--plasma-modal-outline-focus-color',
|
21
|
-
modalCloseButtonRadius: '--plasma-modal-close-button-radius'
|
15
|
+
modalOverlayColor: '--plasma-modal-overlay-color'
|
22
16
|
};
|
@@ -29,6 +29,11 @@ var tokens = exports.tokens = {
|
|
29
29
|
verticalGap: '--plasma-switch-vertical-gap',
|
30
30
|
trackWidth: '--plasma-switch__track-width',
|
31
31
|
trackHeight: '--plasma-switch__track-height',
|
32
|
+
trackBorderWidth: '--plasma-switch__track-border',
|
33
|
+
trackBorderColorOn: '--plasma-switch__track-checked_true-border-color',
|
34
|
+
trackBorderColorOnHover: '--plasma-switch__track-checked_true_hovered_true-border-color',
|
35
|
+
trackBorderColorOff: '--plasma-switch__track-checked_false-border-color',
|
36
|
+
trackBorderColorOffHover: '--plasma-switch__track-checked_false_hovered_true-border-color',
|
32
37
|
trackBorderRadius: '--plasma-switch__track-border-radius',
|
33
38
|
// NOTE: could be intersection with checked
|
34
39
|
trackBackgroundColorOn: '--plasma-switch__track_checked_true-bg-color',
|
@@ -40,7 +45,8 @@ var tokens = exports.tokens = {
|
|
40
45
|
thumbOffset: '--plasma-switch__thumb-offset',
|
41
46
|
thumbBorderRadius: '--plasma-switch__thumb-border-radius',
|
42
47
|
thumbPressScale: '--plasma-switch__thumb-scale',
|
43
|
-
|
48
|
+
thumbBackgroundColorOn: '--plasma-switch__thumb_checked_true-bg-color',
|
49
|
+
thumbBackgroundColorOff: '--plasma-switch__thumb-checked_false-bg-color',
|
44
50
|
thumbBoxShadow: '--plasma-switch__thumb-box-shadow',
|
45
51
|
thumbBoxShadowOn: '--plasma-switch__thumb-box-shadow_checked_true',
|
46
52
|
labelOffsetPrivate: '--plasma_private-switch__label-offset'
|
@@ -7,4 +7,4 @@ exports.base = void 0;
|
|
7
7
|
var _styledComponents = /*#__PURE__*/require("styled-components");
|
8
8
|
var _Switch = /*#__PURE__*/require("../Switch.tokens");
|
9
9
|
var _Switch2 = /*#__PURE__*/require("../Switch.styles");
|
10
|
-
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["", "{
|
10
|
+
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["", "{--plasma_private-thumbSize:calc(var(", ") - (2 * var(", ")));box-sizing:border-box;flex:0 0 var(", ");border-style:solid;border-width:var(", ");border-radius:var(", ");width:var(", ");height:var(", ");&::after{width:var(--plasma_private-thumbSize);height:var(--plasma_private-thumbSize);border-radius:var(", ");margin:auto var(", ");}}:active:not([disabled]) ", "::after{width:calc(var(", ") * var(", ",1));}"], _Switch2.StyledTrigger, _Switch.tokens.thumbSize, _Switch.tokens.trackBorderWidth, _Switch.tokens.trackWidth, _Switch.tokens.trackBorderWidth, _Switch.tokens.trackBorderRadius, _Switch.tokens.trackWidth, _Switch.tokens.trackHeight, _Switch.tokens.thumbBorderRadius, _Switch.tokens.thumbOffset, _Switch2.StyledTrigger, _Switch.tokens.thumbSize, _Switch.tokens.thumbPressScale);
|
@@ -7,4 +7,4 @@ exports.base = void 0;
|
|
7
7
|
var _styledComponents = /*#__PURE__*/require("styled-components");
|
8
8
|
var _Switch = /*#__PURE__*/require("../Switch.tokens");
|
9
9
|
var _Switch2 = /*#__PURE__*/require("../Switch.styles");
|
10
|
-
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["", "{background-color:var(", ");}", ":not([disabled]) ~ ", ":hover{background-color:var(", ",var(", "));}", ":checked ~ ", "{background-color:var(", ");}", ":checked:not([disabled]) ~ ", ":hover{background-color:var(", ",var(", "));}", "::after{background-color:var(", ");box-shadow:var(", ");}", ":checked ~ ", "::after{box-shadow:var(", ",var(", "));}", "{color:var(", ");}", "{color:var(", ");}"], _Switch2.StyledTrigger, _Switch.tokens.trackBackgroundColorOff, _Switch2.StyledInput, _Switch2.StyledTrigger, _Switch.tokens.trackBackgroundColorOffHover, _Switch.tokens.trackBackgroundColorOff, _Switch2.StyledInput, _Switch2.StyledTrigger, _Switch.tokens.trackBackgroundColorOn, _Switch2.StyledInput, _Switch2.StyledTrigger, _Switch.tokens.trackBackgroundColorOnHover, _Switch.tokens.trackBackgroundColorOn, _Switch2.StyledTrigger, _Switch.tokens.
|
10
|
+
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["", "{background-color:var(", ");border-color:var(", ");}", ":not([disabled]) ~ ", ":hover{background-color:var(", ",var(", "));border-color:var(", ",var(", "));}", ":checked ~ ", "{background-color:var(", ");border-color:var(", ");}", ":checked:not([disabled]) ~ ", ":hover{background-color:var(", ",var(", "));border-color:var(", ",var(", "));}", "::after{background-color:var(", ");box-shadow:var(", ");}", ":checked ~ ", "::after{background-color:var(", ");box-shadow:var(", ",var(", "));}", "{color:var(", ");}", "{color:var(", ");}"], _Switch2.StyledTrigger, _Switch.tokens.trackBackgroundColorOff, _Switch.tokens.trackBorderColorOff, _Switch2.StyledInput, _Switch2.StyledTrigger, _Switch.tokens.trackBackgroundColorOffHover, _Switch.tokens.trackBackgroundColorOff, _Switch.tokens.trackBorderColorOffHover, _Switch.tokens.trackBorderColorOff, _Switch2.StyledInput, _Switch2.StyledTrigger, _Switch.tokens.trackBackgroundColorOn, _Switch.tokens.trackBorderColorOn, _Switch2.StyledInput, _Switch2.StyledTrigger, _Switch.tokens.trackBackgroundColorOnHover, _Switch.tokens.trackBackgroundColorOn, _Switch.tokens.trackBorderColorOnHover, _Switch.tokens.trackBorderColorOn, _Switch2.StyledTrigger, _Switch.tokens.thumbBackgroundColorOff, _Switch.tokens.thumbBoxShadow, _Switch2.StyledInput, _Switch2.StyledTrigger, _Switch.tokens.thumbBackgroundColorOn, _Switch.tokens.thumbBoxShadowOn, _Switch.tokens.thumbBoxShadow, _Switch2.StyledLabel, _Switch.tokens.labelColor, _Switch2.StyledDescription, _Switch.tokens.descriptionColor);
|
@@ -12,7 +12,7 @@ var config = exports.config = {
|
|
12
12
|
},
|
13
13
|
variations: {
|
14
14
|
view: {
|
15
|
-
"default": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--overlay-blur);", ":var(--overlay-soft);"
|
15
|
+
"default": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--overlay-blur);", ":var(--overlay-soft);"], _Modal.modalTokens.modalOverlayWithBlurColor, _Modal.modalTokens.modalOverlayColor)
|
16
16
|
}
|
17
17
|
}
|
18
18
|
};
|
@@ -3,7 +3,6 @@ import styled from 'styled-components';
|
|
3
3
|
import type { ComponentProps } from 'react';
|
4
4
|
import type { StoryObj, Meta } from '@storybook/react';
|
5
5
|
import { SSRProvider } from '@salutejs/plasma-core';
|
6
|
-
import { disableProps } from '@salutejs/plasma-sb-utils';
|
7
6
|
|
8
7
|
import { PopupProvider, popupClasses } from '../Popup/Popup';
|
9
8
|
import { Button } from '../Button/Button';
|
@@ -19,7 +18,6 @@ export default {
|
|
19
18
|
docs: { story: { inline: false, iframeHeight: '30rem' } },
|
20
19
|
},
|
21
20
|
argTypes: {
|
22
|
-
...disableProps(['hasBody']),
|
23
21
|
placement: {
|
24
22
|
options: [
|
25
23
|
'center',
|
@@ -77,7 +75,6 @@ type StoryModalProps = ComponentProps<typeof Modal> & {
|
|
77
75
|
closeOnEsc: boolean;
|
78
76
|
closeOnOverlayClick: boolean;
|
79
77
|
withBlur: boolean;
|
80
|
-
hasClose?: boolean;
|
81
78
|
};
|
82
79
|
|
83
80
|
const StyledButton = styled(Button)`
|
@@ -138,72 +135,6 @@ const StoryModalDemo = ({ placement, offsetX, offsetY, ...rest }: StoryModalProp
|
|
138
135
|
const [isOpenB, setIsOpenB] = useState(false);
|
139
136
|
const [isOpenC, setIsOpenC] = useState(false);
|
140
137
|
|
141
|
-
return (
|
142
|
-
<SSRProvider>
|
143
|
-
<StyledWrapper>
|
144
|
-
<PopupProvider>
|
145
|
-
<ButtonWrapper>
|
146
|
-
<StyledButton text="Открыть A" onClick={() => setIsOpenA(true)} />
|
147
|
-
</ButtonWrapper>
|
148
|
-
<StyledModal
|
149
|
-
id="modalA"
|
150
|
-
frame="theme-root"
|
151
|
-
withAnimation
|
152
|
-
onClose={() => setIsOpenA(false)}
|
153
|
-
opened={isOpenA}
|
154
|
-
placement={placement}
|
155
|
-
offset={[offsetX, offsetY]}
|
156
|
-
hasBody
|
157
|
-
{...rest}
|
158
|
-
>
|
159
|
-
<Button onClick={() => setIsOpenA(false)}>Close</Button>
|
160
|
-
<ButtonWrapper>
|
161
|
-
<StyledButton text="Открыть B" onClick={() => setIsOpenB(true)} />
|
162
|
-
</ButtonWrapper>
|
163
|
-
<Modal
|
164
|
-
id="modalB"
|
165
|
-
frame="theme-root"
|
166
|
-
onClose={() => setIsOpenB(false)}
|
167
|
-
opened={isOpenB}
|
168
|
-
placement="left"
|
169
|
-
offset={[offsetX, offsetY]}
|
170
|
-
hasBody
|
171
|
-
{...rest}
|
172
|
-
>
|
173
|
-
<Button style={{ marginRight: '1rem' }} onClick={() => setIsOpenB(false)}>
|
174
|
-
Close
|
175
|
-
</Button>
|
176
|
-
<ButtonWrapper>
|
177
|
-
<StyledButton text="Открыть C" onClick={() => setIsOpenC(true)} />
|
178
|
-
</ButtonWrapper>
|
179
|
-
<Modal
|
180
|
-
id="modalC"
|
181
|
-
frame="theme-root"
|
182
|
-
onClose={() => setIsOpenC(false)}
|
183
|
-
opened={isOpenC}
|
184
|
-
placement="top"
|
185
|
-
offset={[offsetX, offsetY]}
|
186
|
-
hasBody
|
187
|
-
{...rest}
|
188
|
-
>
|
189
|
-
<Button style={{ marginRight: '1rem' }} onClick={() => setIsOpenC(false)}>
|
190
|
-
Close
|
191
|
-
</Button>
|
192
|
-
<>Content</>
|
193
|
-
</Modal>
|
194
|
-
</Modal>
|
195
|
-
</StyledModal>
|
196
|
-
</PopupProvider>
|
197
|
-
</StyledWrapper>
|
198
|
-
</SSRProvider>
|
199
|
-
);
|
200
|
-
};
|
201
|
-
|
202
|
-
const StoryCustomModalDemo = ({ placement, offsetX, offsetY, ...rest }: StoryModalProps) => {
|
203
|
-
const [isOpenA, setIsOpenA] = useState(false);
|
204
|
-
const [isOpenB, setIsOpenB] = useState(false);
|
205
|
-
const [isOpenC, setIsOpenC] = useState(false);
|
206
|
-
|
207
138
|
return (
|
208
139
|
<SSRProvider>
|
209
140
|
<StyledWrapper>
|
@@ -268,7 +199,7 @@ const StoryCustomModalDemo = ({ placement, offsetX, offsetY, ...rest }: StoryMod
|
|
268
199
|
);
|
269
200
|
};
|
270
201
|
|
271
|
-
export const
|
202
|
+
export const ModalDemo: StoryObj<StoryModalProps> = {
|
272
203
|
args: {
|
273
204
|
placement: 'center',
|
274
205
|
withBlur: false,
|
@@ -276,30 +207,10 @@ export const Default: StoryObj<StoryModalProps> = {
|
|
276
207
|
closeOnOverlayClick: true,
|
277
208
|
offsetX: 0,
|
278
209
|
offsetY: 0,
|
279
|
-
hasClose: true,
|
280
|
-
},
|
281
|
-
argTypes: {
|
282
|
-
hasClose: {
|
283
|
-
control: {
|
284
|
-
type: 'boolean',
|
285
|
-
},
|
286
|
-
},
|
287
210
|
},
|
288
211
|
render: (args) => <StoryModalDemo {...args} />,
|
289
212
|
};
|
290
213
|
|
291
|
-
export const CustomModalDemo: StoryObj<StoryModalProps> = {
|
292
|
-
args: {
|
293
|
-
placement: 'center',
|
294
|
-
withBlur: false,
|
295
|
-
closeOnEsc: true,
|
296
|
-
closeOnOverlayClick: true,
|
297
|
-
offsetX: 0,
|
298
|
-
offsetY: 0,
|
299
|
-
},
|
300
|
-
render: (args) => <StoryCustomModalDemo {...args} />,
|
301
|
-
};
|
302
|
-
|
303
214
|
const StyledModalAnimation = styled(Modal)`
|
304
215
|
/* stylelint-disable */
|
305
216
|
&& .${popupClasses.root} {
|
@@ -25,7 +25,7 @@ var config = exports.config = {
|
|
25
25
|
s: /*#__PURE__*/(0, _styledComponents.css)(["", ":2rem;", ":1.25rem;", ":calc(var(", ") / 2);", ":1rem;", ":calc(var(", ") / 2);", ":0.125rem;", ":1.25;"], _Switch.switchTokens.trackWidth, _Switch.switchTokens.trackHeight, _Switch.switchTokens.trackBorderRadius, _Switch.switchTokens.trackHeight, _Switch.switchTokens.thumbSize, _Switch.switchTokens.thumbBorderRadius, _Switch.switchTokens.thumbSize, _Switch.switchTokens.thumbOffset, _Switch.switchTokens.thumbPressScale)
|
26
26
|
},
|
27
27
|
view: {
|
28
|
-
"default": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--text-primary);", ":var(--text-secondary);", ":var(--surface-accent);", ":var(--surface-accent-hover);", ":var(--surface-transparent-tertiary);", ":var(--surface-transparent-tertiary-hover);", ":var(--on-dark-surface-solid-default);", ":0 1px 1px rgba(0,0,0,0.11);"], _Switch.switchTokens.labelColor, _Switch.switchTokens.descriptionColor, _Switch.switchTokens.trackBackgroundColorOn, _Switch.switchTokens.trackBackgroundColorOnHover, _Switch.switchTokens.trackBackgroundColorOff, _Switch.switchTokens.trackBackgroundColorOffHover, _Switch.switchTokens.
|
28
|
+
"default": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--text-primary);", ":var(--text-secondary);", ":var(--surface-accent);", ":var(--surface-accent-hover);", ":var(--surface-transparent-tertiary);", ":var(--surface-transparent-tertiary-hover);", ":0rem;", ":transparent;", ":transparent;", ":transparent;", ":transparent;", ":var(--on-dark-surface-solid-default);", ":var(--on-dark-surface-solid-default);", ":0 1px 1px rgba(0,0,0,0.11);"], _Switch.switchTokens.labelColor, _Switch.switchTokens.descriptionColor, _Switch.switchTokens.trackBackgroundColorOn, _Switch.switchTokens.trackBackgroundColorOnHover, _Switch.switchTokens.trackBackgroundColorOff, _Switch.switchTokens.trackBackgroundColorOffHover, _Switch.switchTokens.trackBorderWidth, _Switch.switchTokens.trackBorderColorOff, _Switch.switchTokens.trackBorderColorOffHover, _Switch.switchTokens.trackBorderColorOn, _Switch.switchTokens.trackBorderColorOnHover, _Switch.switchTokens.thumbBackgroundColorOff, _Switch.switchTokens.thumbBackgroundColorOn, _Switch.switchTokens.thumbBoxShadow)
|
29
29
|
},
|
30
30
|
disabled: {
|
31
31
|
"true": /*#__PURE__*/(0, _styledComponents.css)(["", ":0.4;"], _Switch.switchTokens.disabledOpacity)
|
@@ -3,9 +3,12 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.Switch = void 0;
|
6
|
+
exports.SwitchOutline = exports.Switch = void 0;
|
7
7
|
var _Switch = /*#__PURE__*/require("../../../../components/Switch");
|
8
8
|
var _engines = /*#__PURE__*/require("../../../../engines");
|
9
9
|
var _Switch2 = /*#__PURE__*/require("./Switch.config");
|
10
|
+
var _SwitchOutline = /*#__PURE__*/require("./Switch.outline.config");
|
10
11
|
var mergedConfig = /*#__PURE__*/(0, _engines.mergeConfig)(_Switch.switchConfig, _Switch2.config);
|
11
|
-
var Switch = exports.Switch = /*#__PURE__*/(0, _engines.component)(mergedConfig);
|
12
|
+
var Switch = exports.Switch = /*#__PURE__*/(0, _engines.component)(mergedConfig);
|
13
|
+
var mergedOutlineConfig = /*#__PURE__*/(0, _engines.mergeConfig)(_Switch.switchConfig, _SwitchOutline.config);
|
14
|
+
var SwitchOutline = exports.SwitchOutline = /*#__PURE__*/(0, _engines.component)(mergedOutlineConfig);
|
@@ -0,0 +1,37 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.config = void 0;
|
7
|
+
var _styledComponents = /*#__PURE__*/require("styled-components");
|
8
|
+
var _Switch = /*#__PURE__*/require("../../../../components/Switch");
|
9
|
+
var config = exports.config = {
|
10
|
+
defaults: {
|
11
|
+
view: 'default',
|
12
|
+
size: 'm',
|
13
|
+
toggleSize: 'l',
|
14
|
+
labelPosition: 'before',
|
15
|
+
focused: 'true'
|
16
|
+
},
|
17
|
+
variations: {
|
18
|
+
size: {
|
19
|
+
s: /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-line-height);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-line-height);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-letter-spacing);", ":0.25rem;", ":0.75rem;"], _Switch.switchTokens.fontFamily, _Switch.switchTokens.fontStyle, _Switch.switchTokens.fontWeight, _Switch.switchTokens.lineHeight, _Switch.switchTokens.fontSize, _Switch.switchTokens.letterSpacing, _Switch.switchTokens.descriptionFontFamily, _Switch.switchTokens.descriptionFontStyle, _Switch.switchTokens.descriptionFontWeight, _Switch.switchTokens.descriptionLineHeight, _Switch.switchTokens.descriptionFontSize, _Switch.switchTokens.descriptionLetterSpacing, _Switch.switchTokens.verticalGap, _Switch.switchTokens.labelOffset),
|
20
|
+
m: /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--plasma-typo-body-m-font-family);", ":var(--plasma-typo-body-m-font-style);", ":var(--plasma-typo-body-m-font-weight);", ":var(--plasma-typo-body-m-line-height);", ":var(--plasma-typo-body-m-font-size);", ":var(--plasma-typo-body-m-letter-spacing);", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-line-height);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-xs-letter-spacing);", ":0.25rem;", ":0.75rem;"], _Switch.switchTokens.fontFamily, _Switch.switchTokens.fontStyle, _Switch.switchTokens.fontWeight, _Switch.switchTokens.lineHeight, _Switch.switchTokens.fontSize, _Switch.switchTokens.letterSpacing, _Switch.switchTokens.descriptionFontFamily, _Switch.switchTokens.descriptionFontStyle, _Switch.switchTokens.descriptionFontWeight, _Switch.switchTokens.descriptionLineHeight, _Switch.switchTokens.descriptionFontSize, _Switch.switchTokens.descriptionLetterSpacing, _Switch.switchTokens.verticalGap, _Switch.switchTokens.labelOffset),
|
21
|
+
l: /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--plasma-typo-body-l-font-family);", ":var(--plasma-typo-body-l-font-style);", ":var(--plasma-typo-body-l-font-weight);", ":var(--plasma-typo-body-l-line-height);", ":var(--plasma-typo-body-l-font-size);", ":var(--plasma-typo-body-l-letter-spacing);", ":var(--plasma-typo-body-m-font-family);", ":var(--plasma-typo-body-m-font-style);", ":var(--plasma-typo-body-m-font-weight);", ":var(--plasma-typo-body-m-line-height);", ":var(--plasma-typo-body-m-font-size);", ":var(--plasma-typo-body-xs-letter-spacing);", ":0.25rem;", ":0.75rem;"], _Switch.switchTokens.fontFamily, _Switch.switchTokens.fontStyle, _Switch.switchTokens.fontWeight, _Switch.switchTokens.lineHeight, _Switch.switchTokens.fontSize, _Switch.switchTokens.letterSpacing, _Switch.switchTokens.descriptionFontFamily, _Switch.switchTokens.descriptionFontStyle, _Switch.switchTokens.descriptionFontWeight, _Switch.switchTokens.descriptionLineHeight, _Switch.switchTokens.descriptionFontSize, _Switch.switchTokens.descriptionLetterSpacing, _Switch.switchTokens.verticalGap, _Switch.switchTokens.labelOffset)
|
22
|
+
},
|
23
|
+
toggleSize: {
|
24
|
+
l: /*#__PURE__*/(0, _styledComponents.css)(["", ":2.75rem;", ":1.75rem;", ":calc(var(", ") / 2);", ":1.5rem;", ":calc(var(", ") / 2);", ":0.125rem;", ":1.25;"], _Switch.switchTokens.trackWidth, _Switch.switchTokens.trackHeight, _Switch.switchTokens.trackBorderRadius, _Switch.switchTokens.trackHeight, _Switch.switchTokens.thumbSize, _Switch.switchTokens.thumbBorderRadius, _Switch.switchTokens.thumbSize, _Switch.switchTokens.thumbOffset, _Switch.switchTokens.thumbPressScale),
|
25
|
+
s: /*#__PURE__*/(0, _styledComponents.css)(["", ":2rem;", ":1.25rem;", ":calc(var(", ") / 2);", ":1rem;", ":calc(var(", ") / 2);", ":0.125rem;", ":1.25;"], _Switch.switchTokens.trackWidth, _Switch.switchTokens.trackHeight, _Switch.switchTokens.trackBorderRadius, _Switch.switchTokens.trackHeight, _Switch.switchTokens.thumbSize, _Switch.switchTokens.thumbBorderRadius, _Switch.switchTokens.thumbSize, _Switch.switchTokens.thumbOffset, _Switch.switchTokens.thumbPressScale)
|
26
|
+
},
|
27
|
+
view: {
|
28
|
+
"default": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--text-primary);", ":var(--text-secondary);", ":transparent;", ":transparent;", ":transparent;", ":transparent;", ":0.0625rem;", ":var(--outline-secondary);", ":var(--outline-secondary-hover);", ":var(--outline-accent);", ":var(--outline-accent-hover);", ":var(--text-tertiary);", ":var(--text-accent);", ":0 1px 1px rgba(0,0,0,0.11);"], _Switch.switchTokens.labelColor, _Switch.switchTokens.descriptionColor, _Switch.switchTokens.trackBackgroundColorOn, _Switch.switchTokens.trackBackgroundColorOnHover, _Switch.switchTokens.trackBackgroundColorOff, _Switch.switchTokens.trackBackgroundColorOffHover, _Switch.switchTokens.trackBorderWidth, _Switch.switchTokens.trackBorderColorOff, _Switch.switchTokens.trackBorderColorOffHover, _Switch.switchTokens.trackBorderColorOn, _Switch.switchTokens.trackBorderColorOnHover, _Switch.switchTokens.thumbBackgroundColorOff, _Switch.switchTokens.thumbBackgroundColorOn, _Switch.switchTokens.thumbBoxShadow)
|
29
|
+
},
|
30
|
+
disabled: {
|
31
|
+
"true": /*#__PURE__*/(0, _styledComponents.css)(["", ":0.4;"], _Switch.switchTokens.disabledOpacity)
|
32
|
+
},
|
33
|
+
focused: {
|
34
|
+
"true": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--surface-accent);"], _Switch.switchTokens.trackFocusColor)
|
35
|
+
}
|
36
|
+
}
|
37
|
+
};
|
@@ -9,7 +9,7 @@ import { mergeConfig } from '../../../../engines';
|
|
9
9
|
import { WithTheme, argTypesFromConfig } from '../../../_helpers';
|
10
10
|
|
11
11
|
import { config } from './Switch.config';
|
12
|
-
import { Switch } from './Switch';
|
12
|
+
import { Switch, SwitchOutline } from './Switch';
|
13
13
|
|
14
14
|
type SwitchProps = ComponentProps<typeof Switch>;
|
15
15
|
|
@@ -72,3 +72,35 @@ export const Default: StoryObj<SwitchProps> = {
|
|
72
72
|
},
|
73
73
|
render: (args) => <StoryDefault {...args} />,
|
74
74
|
};
|
75
|
+
|
76
|
+
const StoryOutline = (args: SwitchProps) => {
|
77
|
+
const value = 'yes';
|
78
|
+
const name = 'agree';
|
79
|
+
const [checked, setChecked] = useState(true);
|
80
|
+
|
81
|
+
return (
|
82
|
+
<StyledWrapper>
|
83
|
+
<SwitchOutline
|
84
|
+
value={value}
|
85
|
+
name={name}
|
86
|
+
checked={checked}
|
87
|
+
onChange={(event) => {
|
88
|
+
setChecked(event.target.checked);
|
89
|
+
onChange(event);
|
90
|
+
}}
|
91
|
+
onFocus={onFocus}
|
92
|
+
onBlur={onBlur}
|
93
|
+
{...args}
|
94
|
+
/>
|
95
|
+
</StyledWrapper>
|
96
|
+
);
|
97
|
+
};
|
98
|
+
|
99
|
+
export const Outline: StoryObj<SwitchProps> = {
|
100
|
+
args: {
|
101
|
+
size: 'm',
|
102
|
+
toggleSize: 'l',
|
103
|
+
disabled: false,
|
104
|
+
},
|
105
|
+
render: (args) => <StoryOutline {...args} />,
|
106
|
+
};
|
@@ -12,7 +12,7 @@ var config = exports.config = {
|
|
12
12
|
},
|
13
13
|
variations: {
|
14
14
|
view: {
|
15
|
-
"default": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--overlay-blur);", ":var(--overlay-soft);"
|
15
|
+
"default": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--overlay-blur);", ":var(--overlay-soft);"], _Modal.modalTokens.modalOverlayWithBlurColor, _Modal.modalTokens.modalOverlayColor)
|
16
16
|
}
|
17
17
|
}
|
18
18
|
};
|
@@ -3,7 +3,6 @@ import styled from 'styled-components';
|
|
3
3
|
import type { ComponentProps } from 'react';
|
4
4
|
import type { StoryObj, Meta } from '@storybook/react';
|
5
5
|
import { SSRProvider } from '@salutejs/plasma-core';
|
6
|
-
import { disableProps } from '@salutejs/plasma-sb-utils';
|
7
6
|
|
8
7
|
import { PopupProvider, popupClasses } from '../Popup/Popup';
|
9
8
|
import { Button } from '../Button/Button';
|
@@ -19,7 +18,6 @@ export default {
|
|
19
18
|
docs: { story: { inline: false, iframeHeight: '30rem' } },
|
20
19
|
},
|
21
20
|
argTypes: {
|
22
|
-
...disableProps(['hasBody']),
|
23
21
|
placement: {
|
24
22
|
options: [
|
25
23
|
'center',
|
@@ -77,7 +75,6 @@ type StoryModalProps = ComponentProps<typeof Modal> & {
|
|
77
75
|
closeOnEsc: boolean;
|
78
76
|
closeOnOverlayClick: boolean;
|
79
77
|
withBlur: boolean;
|
80
|
-
hasClose?: boolean;
|
81
78
|
};
|
82
79
|
|
83
80
|
const StyledButton = styled(Button)`
|
@@ -138,72 +135,6 @@ const StoryModalDemo = ({ placement, offsetX, offsetY, ...rest }: StoryModalProp
|
|
138
135
|
const [isOpenB, setIsOpenB] = useState(false);
|
139
136
|
const [isOpenC, setIsOpenC] = useState(false);
|
140
137
|
|
141
|
-
return (
|
142
|
-
<SSRProvider>
|
143
|
-
<StyledWrapper>
|
144
|
-
<PopupProvider>
|
145
|
-
<ButtonWrapper>
|
146
|
-
<StyledButton text="Открыть A" onClick={() => setIsOpenA(true)} />
|
147
|
-
</ButtonWrapper>
|
148
|
-
<StyledModal
|
149
|
-
id="modalA"
|
150
|
-
frame="theme-root"
|
151
|
-
withAnimation
|
152
|
-
onClose={() => setIsOpenA(false)}
|
153
|
-
opened={isOpenA}
|
154
|
-
placement={placement}
|
155
|
-
offset={[offsetX, offsetY]}
|
156
|
-
hasBody
|
157
|
-
{...rest}
|
158
|
-
>
|
159
|
-
<Button onClick={() => setIsOpenA(false)}>Close</Button>
|
160
|
-
<ButtonWrapper>
|
161
|
-
<StyledButton text="Открыть B" onClick={() => setIsOpenB(true)} />
|
162
|
-
</ButtonWrapper>
|
163
|
-
<Modal
|
164
|
-
id="modalB"
|
165
|
-
frame="theme-root"
|
166
|
-
onClose={() => setIsOpenB(false)}
|
167
|
-
opened={isOpenB}
|
168
|
-
placement="left"
|
169
|
-
offset={[offsetX, offsetY]}
|
170
|
-
hasBody
|
171
|
-
{...rest}
|
172
|
-
>
|
173
|
-
<Button style={{ marginRight: '1rem' }} onClick={() => setIsOpenB(false)}>
|
174
|
-
Close
|
175
|
-
</Button>
|
176
|
-
<ButtonWrapper>
|
177
|
-
<StyledButton text="Открыть C" onClick={() => setIsOpenC(true)} />
|
178
|
-
</ButtonWrapper>
|
179
|
-
<Modal
|
180
|
-
id="modalC"
|
181
|
-
frame="theme-root"
|
182
|
-
onClose={() => setIsOpenC(false)}
|
183
|
-
opened={isOpenC}
|
184
|
-
placement="top"
|
185
|
-
offset={[offsetX, offsetY]}
|
186
|
-
hasBody
|
187
|
-
{...rest}
|
188
|
-
>
|
189
|
-
<Button style={{ marginRight: '1rem' }} onClick={() => setIsOpenC(false)}>
|
190
|
-
Close
|
191
|
-
</Button>
|
192
|
-
<>Content</>
|
193
|
-
</Modal>
|
194
|
-
</Modal>
|
195
|
-
</StyledModal>
|
196
|
-
</PopupProvider>
|
197
|
-
</StyledWrapper>
|
198
|
-
</SSRProvider>
|
199
|
-
);
|
200
|
-
};
|
201
|
-
|
202
|
-
const StoryCustomModalDemo = ({ placement, offsetX, offsetY, ...rest }: StoryModalProps) => {
|
203
|
-
const [isOpenA, setIsOpenA] = useState(false);
|
204
|
-
const [isOpenB, setIsOpenB] = useState(false);
|
205
|
-
const [isOpenC, setIsOpenC] = useState(false);
|
206
|
-
|
207
138
|
return (
|
208
139
|
<SSRProvider>
|
209
140
|
<StyledWrapper>
|
@@ -268,7 +199,7 @@ const StoryCustomModalDemo = ({ placement, offsetX, offsetY, ...rest }: StoryMod
|
|
268
199
|
);
|
269
200
|
};
|
270
201
|
|
271
|
-
export const
|
202
|
+
export const ModalDemo: StoryObj<StoryModalProps> = {
|
272
203
|
args: {
|
273
204
|
placement: 'center',
|
274
205
|
withBlur: false,
|
@@ -276,30 +207,10 @@ export const Default: StoryObj<StoryModalProps> = {
|
|
276
207
|
closeOnOverlayClick: true,
|
277
208
|
offsetX: 0,
|
278
209
|
offsetY: 0,
|
279
|
-
hasClose: true,
|
280
|
-
},
|
281
|
-
argTypes: {
|
282
|
-
hasClose: {
|
283
|
-
control: {
|
284
|
-
type: 'boolean',
|
285
|
-
},
|
286
|
-
},
|
287
210
|
},
|
288
211
|
render: (args) => <StoryModalDemo {...args} />,
|
289
212
|
};
|
290
213
|
|
291
|
-
export const CustomModalDemo: StoryObj<StoryModalProps> = {
|
292
|
-
args: {
|
293
|
-
placement: 'center',
|
294
|
-
withBlur: false,
|
295
|
-
closeOnEsc: true,
|
296
|
-
closeOnOverlayClick: true,
|
297
|
-
offsetX: 0,
|
298
|
-
offsetY: 0,
|
299
|
-
},
|
300
|
-
render: (args) => <StoryCustomModalDemo {...args} />,
|
301
|
-
};
|
302
|
-
|
303
214
|
const StyledModalAnimation = styled(Modal)`
|
304
215
|
/* stylelint-disable */
|
305
216
|
&& .${popupClasses.root} {
|
@@ -25,7 +25,7 @@ var config = exports.config = {
|
|
25
25
|
s: /*#__PURE__*/(0, _styledComponents.css)(["", ":2rem;", ":1.25rem;", ":calc(var(", ") / 2);", ":1rem;", ":calc(var(", ") / 2);", ":0.125rem;", ":1.25;"], _Switch.switchTokens.trackWidth, _Switch.switchTokens.trackHeight, _Switch.switchTokens.trackBorderRadius, _Switch.switchTokens.trackHeight, _Switch.switchTokens.thumbSize, _Switch.switchTokens.thumbBorderRadius, _Switch.switchTokens.thumbSize, _Switch.switchTokens.thumbOffset, _Switch.switchTokens.thumbPressScale)
|
26
26
|
},
|
27
27
|
view: {
|
28
|
-
"default": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--text-primary);", ":var(--text-secondary);", ":var(--surface-accent);", ":var(--surface-accent-hover);", ":var(--surface-transparent-tertiary);", ":var(--surface-transparent-tertiary-hover);", ":var(--on-dark-surface-solid-default);", ":0 1px 1px rgba(0,0,0,0.11);"], _Switch.switchTokens.labelColor, _Switch.switchTokens.descriptionColor, _Switch.switchTokens.trackBackgroundColorOn, _Switch.switchTokens.trackBackgroundColorOnHover, _Switch.switchTokens.trackBackgroundColorOff, _Switch.switchTokens.trackBackgroundColorOffHover, _Switch.switchTokens.
|
28
|
+
"default": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--text-primary);", ":var(--text-secondary);", ":var(--surface-accent);", ":var(--surface-accent-hover);", ":var(--surface-transparent-tertiary);", ":var(--surface-transparent-tertiary-hover);", ":0rem;", ":transparent;", ":transparent;", ":transparent;", ":transparent;", ":var(--on-dark-surface-solid-default);", ":var(--on-dark-surface-solid-default);", ":0 1px 1px rgba(0,0,0,0.11);"], _Switch.switchTokens.labelColor, _Switch.switchTokens.descriptionColor, _Switch.switchTokens.trackBackgroundColorOn, _Switch.switchTokens.trackBackgroundColorOnHover, _Switch.switchTokens.trackBackgroundColorOff, _Switch.switchTokens.trackBackgroundColorOffHover, _Switch.switchTokens.trackBorderWidth, _Switch.switchTokens.trackBorderColorOff, _Switch.switchTokens.trackBorderColorOffHover, _Switch.switchTokens.trackBorderColorOn, _Switch.switchTokens.trackBorderColorOnHover, _Switch.switchTokens.thumbBackgroundColorOff, _Switch.switchTokens.thumbBackgroundColorOn, _Switch.switchTokens.thumbBoxShadow)
|
29
29
|
},
|
30
30
|
disabled: {
|
31
31
|
"true": /*#__PURE__*/(0, _styledComponents.css)(["", ":0.4;"], _Switch.switchTokens.disabledOpacity)
|