@salutejs/plasma-new-hope 0.191.2-canary.1517.11801064973.0 → 0.192.0-canary.1539.11802074105.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Steps/Steps.css +10 -10
- package/cjs/components/Steps/Steps.js +14 -21
- package/cjs/components/Steps/Steps.js.map +1 -1
- package/cjs/components/Steps/Steps.styles.js +1 -1
- package/cjs/components/Steps/Steps.styles.js.map +1 -1
- package/cjs/components/Steps/{Steps.styles_wa45kj.css → Steps.styles_1xmqxqu.css} +1 -1
- package/cjs/components/Steps/Steps.tokens.js +0 -1
- package/cjs/components/Steps/Steps.tokens.js.map +1 -1
- package/cjs/components/Steps/ui/StepItem/StepItem.css +9 -9
- package/cjs/components/Steps/ui/StepItem/StepItem.js +8 -32
- package/cjs/components/Steps/ui/StepItem/StepItem.js.map +1 -1
- package/cjs/components/Steps/ui/StepItem/StepItem.styles.js +6 -6
- package/cjs/components/Steps/ui/StepItem/StepItem.styles.js.map +1 -1
- package/cjs/components/Steps/ui/StepItem/StepItem.styles_sp9rcd.css +9 -0
- package/cjs/components/Switch/Switch.css +11 -7
- package/cjs/components/Switch/Switch.js +16 -7
- package/cjs/components/Switch/Switch.js.map +1 -1
- package/cjs/components/Switch/Switch.styles.js +16 -4
- package/cjs/components/Switch/Switch.styles.js.map +1 -1
- package/cjs/components/Switch/Switch.styles_bei7bh.css +6 -0
- package/cjs/components/Switch/Switch.tokens.js +11 -0
- package/cjs/components/Switch/Switch.tokens.js.map +1 -1
- package/cjs/components/Switch/_focused/base.js +1 -1
- package/{es/components/Switch/_focused/base_j4murk.css → cjs/components/Switch/_focused/base_sz3n0x.css} +1 -1
- package/cjs/components/Switch/_size/base.js +1 -1
- package/cjs/components/Switch/_size/base.js.map +1 -1
- package/cjs/components/Switch/_size/base_1tcl212.css +1 -0
- package/cjs/components/Switch/_toggleSize/base.js +9 -0
- package/cjs/components/Switch/_toggleSize/base.js.map +1 -0
- package/cjs/components/Switch/_toggleSize/base_6i0904.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_yxkf3s.css +1 -0
- package/cjs/index.css +22 -18
- package/emotion/cjs/components/Steps/Steps.js +14 -23
- package/emotion/cjs/components/Steps/Steps.styles.js +1 -1
- package/emotion/cjs/components/Steps/Steps.tokens.js +0 -1
- package/emotion/cjs/components/Steps/ui/StepItem/StepItem.js +8 -32
- package/emotion/cjs/components/Steps/ui/StepItem/StepItem.styles.js +11 -22
- package/emotion/cjs/components/Switch/Switch.js +17 -8
- package/emotion/cjs/components/Switch/Switch.styles.js +21 -5
- package/emotion/cjs/components/Switch/Switch.template-doc.mdx +37 -1
- package/emotion/cjs/components/Switch/Switch.tokens.js +11 -0
- package/emotion/cjs/components/Switch/_size/base.js +1 -1
- package/emotion/cjs/components/Switch/_toggleSize/base.js +10 -0
- package/emotion/cjs/components/Switch/_view/base.js +1 -1
- package/emotion/cjs/examples/plasma_b2c/components/Steps/Steps.config.js +5 -5
- package/emotion/cjs/examples/plasma_b2c/components/Steps/Steps.stories.tsx +1 -1
- package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.config.js +11 -4
- package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.stories.tsx +7 -1
- package/emotion/cjs/examples/plasma_web/components/Steps/Steps.config.js +5 -5
- package/emotion/cjs/examples/plasma_web/components/Steps/Steps.stories.tsx +1 -1
- package/emotion/cjs/examples/plasma_web/components/Switch/Switch.config.js +11 -4
- package/emotion/cjs/examples/plasma_web/components/Switch/Switch.stories.tsx +14 -1
- package/emotion/es/components/Steps/Steps.js +15 -24
- package/emotion/es/components/Steps/Steps.styles.js +1 -1
- package/emotion/es/components/Steps/Steps.tokens.js +0 -1
- package/emotion/es/components/Steps/ui/StepItem/StepItem.js +8 -32
- package/emotion/es/components/Steps/ui/StepItem/StepItem.styles.js +11 -22
- package/emotion/es/components/Switch/Switch.js +13 -4
- package/emotion/es/components/Switch/Switch.styles.js +20 -4
- package/emotion/es/components/Switch/Switch.template-doc.mdx +37 -1
- package/emotion/es/components/Switch/Switch.tokens.js +11 -0
- package/emotion/es/components/Switch/_size/base.js +2 -2
- package/emotion/es/components/Switch/_toggleSize/base.js +4 -0
- package/emotion/es/components/Switch/_view/base.js +2 -2
- package/emotion/es/examples/plasma_b2c/components/Steps/Steps.config.js +5 -5
- package/emotion/es/examples/plasma_b2c/components/Steps/Steps.stories.tsx +1 -1
- package/emotion/es/examples/plasma_b2c/components/Switch/Switch.config.js +11 -4
- package/emotion/es/examples/plasma_b2c/components/Switch/Switch.stories.tsx +7 -1
- package/emotion/es/examples/plasma_web/components/Steps/Steps.config.js +5 -5
- package/emotion/es/examples/plasma_web/components/Steps/Steps.stories.tsx +1 -1
- package/emotion/es/examples/plasma_web/components/Switch/Switch.config.js +11 -4
- package/emotion/es/examples/plasma_web/components/Switch/Switch.stories.tsx +14 -1
- package/es/components/Steps/Steps.css +10 -10
- package/es/components/Steps/Steps.js +16 -23
- package/es/components/Steps/Steps.js.map +1 -1
- package/es/components/Steps/Steps.styles.js +1 -1
- package/es/components/Steps/Steps.styles.js.map +1 -1
- package/es/components/Steps/{Steps.styles_wa45kj.css → Steps.styles_1xmqxqu.css} +1 -1
- package/es/components/Steps/Steps.tokens.js +0 -1
- package/es/components/Steps/Steps.tokens.js.map +1 -1
- package/es/components/Steps/ui/StepItem/StepItem.css +9 -9
- package/es/components/Steps/ui/StepItem/StepItem.js +9 -33
- package/es/components/Steps/ui/StepItem/StepItem.js.map +1 -1
- package/es/components/Steps/ui/StepItem/StepItem.styles.js +6 -6
- package/es/components/Steps/ui/StepItem/StepItem.styles.js.map +1 -1
- package/es/components/Steps/ui/StepItem/StepItem.styles_sp9rcd.css +9 -0
- package/es/components/Switch/Switch.css +11 -7
- package/es/components/Switch/Switch.js +17 -8
- package/es/components/Switch/Switch.js.map +1 -1
- package/es/components/Switch/Switch.styles.js +15 -5
- package/es/components/Switch/Switch.styles.js.map +1 -1
- package/es/components/Switch/Switch.styles_bei7bh.css +6 -0
- package/es/components/Switch/Switch.tokens.js +11 -0
- package/es/components/Switch/Switch.tokens.js.map +1 -1
- package/es/components/Switch/_focused/base.js +1 -1
- package/{cjs/components/Switch/_focused/base_j4murk.css → es/components/Switch/_focused/base_sz3n0x.css} +1 -1
- package/es/components/Switch/_size/base.js +1 -1
- package/es/components/Switch/_size/base.js.map +1 -1
- package/es/components/Switch/_size/base_1tcl212.css +1 -0
- package/es/components/Switch/_toggleSize/base.js +5 -0
- package/es/components/Switch/_toggleSize/base.js.map +1 -0
- package/es/components/Switch/_toggleSize/base_6i0904.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_yxkf3s.css +1 -0
- package/es/index.css +22 -18
- package/package.json +2 -2
- package/styled-components/cjs/components/Steps/Steps.js +14 -23
- package/styled-components/cjs/components/Steps/Steps.styles.js +1 -1
- package/styled-components/cjs/components/Steps/Steps.tokens.js +0 -1
- package/styled-components/cjs/components/Steps/ui/StepItem/StepItem.js +8 -32
- package/styled-components/cjs/components/Steps/ui/StepItem/StepItem.styles.js +6 -17
- package/styled-components/cjs/components/Switch/Switch.js +17 -8
- package/styled-components/cjs/components/Switch/Switch.styles.js +11 -5
- package/styled-components/cjs/components/Switch/Switch.template-doc.mdx +37 -1
- package/styled-components/cjs/components/Switch/Switch.tokens.js +11 -0
- package/styled-components/cjs/components/Switch/_size/base.js +1 -1
- package/styled-components/cjs/components/Switch/_toggleSize/base.js +10 -0
- package/styled-components/cjs/components/Switch/_view/base.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Steps/Steps.config.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Steps/Steps.stories.tsx +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.config.js +9 -2
- package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.stories.tsx +7 -1
- package/styled-components/cjs/examples/plasma_web/components/Steps/Steps.config.js +1 -1
- package/styled-components/cjs/examples/plasma_web/components/Steps/Steps.stories.tsx +1 -1
- package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.config.js +9 -2
- package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.stories.tsx +14 -1
- package/styled-components/es/components/Steps/Steps.js +15 -24
- package/styled-components/es/components/Steps/Steps.styles.js +1 -1
- package/styled-components/es/components/Steps/Steps.tokens.js +0 -1
- package/styled-components/es/components/Steps/ui/StepItem/StepItem.js +8 -32
- package/styled-components/es/components/Steps/ui/StepItem/StepItem.styles.js +6 -17
- package/styled-components/es/components/Switch/Switch.js +13 -4
- package/styled-components/es/components/Switch/Switch.styles.js +10 -4
- package/styled-components/es/components/Switch/Switch.template-doc.mdx +37 -1
- package/styled-components/es/components/Switch/Switch.tokens.js +11 -0
- package/styled-components/es/components/Switch/_size/base.js +2 -2
- package/styled-components/es/components/Switch/_toggleSize/base.js +4 -0
- package/styled-components/es/components/Switch/_view/base.js +2 -2
- package/styled-components/es/examples/plasma_b2c/components/Steps/Steps.config.js +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Steps/Steps.stories.tsx +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.config.js +9 -2
- package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.stories.tsx +7 -1
- package/styled-components/es/examples/plasma_web/components/Steps/Steps.config.js +1 -1
- package/styled-components/es/examples/plasma_web/components/Steps/Steps.stories.tsx +1 -1
- package/styled-components/es/examples/plasma_web/components/Switch/Switch.config.js +9 -2
- package/styled-components/es/examples/plasma_web/components/Switch/Switch.stories.tsx +14 -1
- package/types/components/Steps/Steps.d.ts.map +1 -1
- package/types/components/Steps/Steps.styles.d.ts.map +1 -1
- package/types/components/Steps/Steps.tokens.d.ts +0 -1
- package/types/components/Steps/Steps.tokens.d.ts.map +1 -1
- package/types/components/Steps/ui/StepItem/StepItem.d.ts.map +1 -1
- package/types/components/Steps/ui/StepItem/StepItem.styles.d.ts +2 -2
- package/types/components/Steps/ui/StepItem/StepItem.styles.d.ts.map +1 -1
- package/types/components/Switch/Switch.d.ts +3 -0
- package/types/components/Switch/Switch.d.ts.map +1 -1
- package/types/components/Switch/Switch.styles.d.ts +2 -0
- package/types/components/Switch/Switch.styles.d.ts.map +1 -1
- package/types/components/Switch/Switch.tokens.d.ts +9 -0
- package/types/components/Switch/Switch.tokens.d.ts.map +1 -1
- package/types/components/Switch/Switch.types.d.ts +10 -2
- package/types/components/Switch/Switch.types.d.ts.map +1 -1
- package/types/components/Switch/_size/base.d.ts.map +1 -1
- package/types/components/Switch/_toggleSize/base.d.ts +2 -0
- package/types/components/Switch/_toggleSize/base.d.ts.map +1 -0
- package/types/components/Switch/_view/base.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Steps/Steps.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Switch/Switch.config.d.ts +7 -0
- package/types/examples/plasma_b2c/components/Switch/Switch.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Switch/Switch.d.ts +6 -0
- package/types/examples/plasma_b2c/components/Switch/Switch.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Steps/Steps.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Switch/Switch.config.d.ts +7 -0
- package/types/examples/plasma_web/components/Switch/Switch.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Switch/Switch.d.ts +6 -0
- package/types/examples/plasma_web/components/Switch/Switch.d.ts.map +1 -1
- package/cjs/components/Steps/ui/StepItem/StepItem.styles_acxstj.css +0 -9
- package/cjs/components/Switch/Switch.styles_1kk0qzz.css +0 -4
- package/cjs/components/Switch/_size/base_1rjzpi4.css +0 -1
- package/cjs/components/Switch/_view/base_1mtyz12.css +0 -1
- package/es/components/Steps/ui/StepItem/StepItem.styles_acxstj.css +0 -9
- package/es/components/Switch/Switch.styles_1kk0qzz.css +0 -4
- package/es/components/Switch/_size/base_1rjzpi4.css +0 -1
- package/es/components/Switch/_view/base_1mtyz12.css +0 -1
@@ -62,7 +62,6 @@ var tokens = exports.tokens = {
|
|
62
62
|
inactiveTitleColor: '--plasma-step-item-inactive-title-color',
|
63
63
|
inactiveTitleColorHover: '--plasma-step-item-inactive-title-color-hover',
|
64
64
|
contentColor: '--plasma-step-item-content-color',
|
65
|
-
focusColor: '--plasma-step-item-focus-color',
|
66
65
|
activeIndicatorBorder: '--plasma-step-item-active-indicator-border',
|
67
66
|
activeIndicatorBorderHover: '--plasma-step-item-active-indicator-border-hover',
|
68
67
|
activeIndicatorColor: '--plasma-step-item-active-indicator-color',
|
@@ -51,7 +51,6 @@ var StepItem = exports.StepItem = function StepItem(_ref) {
|
|
51
51
|
var prevItem = items[index - 1];
|
52
52
|
var nextItem = items[index + 1];
|
53
53
|
var isActive = status === 'active';
|
54
|
-
var isNextActive = (nextItem === null || nextItem === void 0 ? void 0 : nextItem.status) === 'active';
|
55
54
|
var isInactive = status === 'inactive';
|
56
55
|
var isPrevInactive = prevItem && !(prevItem !== null && prevItem !== void 0 && prevItem.status) || (prevItem === null || prevItem === void 0 ? void 0 : prevItem.status) === 'inactive';
|
57
56
|
var isNextInactive = !(nextItem !== null && nextItem !== void 0 && nextItem.status) || (nextItem === null || nextItem === void 0 ? void 0 : nextItem.status) === 'inactive';
|
@@ -89,32 +88,8 @@ var StepItem = exports.StepItem = function StepItem(_ref) {
|
|
89
88
|
setIsHovered(false);
|
90
89
|
}
|
91
90
|
}, [isDisabled]);
|
92
|
-
if (isSimple) {
|
93
|
-
var _cls;
|
94
|
-
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_StepItem.StepItemStyled, {
|
95
|
-
className: (0, _classnames["default"])((_cls = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_cls, _Steps.classes.simple, isSimple), _Steps.classes.active, isActive), _Steps.classes.hovered, isHovered && !isActive), _Steps.classes.inactive, isInactive), _Steps.classes.centered, isCentered), _Steps.classes.disabled, isDisabled), _Steps.classes.clickable, clickable && !isActive), _Steps.classes.hasIndicator, hasIndicator), _Steps.classes.transparentDivider, !hasLine), _Steps.classes.verticalOrientation, isVertical), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_cls, "isFirst", isFirst), "isLast", isLast), "isPrevInactive", isPrevInactive), "isNextInactive", isNextInactive)))
|
96
|
-
}, /*#__PURE__*/_react["default"].createElement(_StepItem.BulletIndicatorWrapper, {
|
97
|
-
className: (0, _classnames["default"])(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, _Steps.classes.verticalOrientation, isVertical), _Steps.classes.centered, isCentered), _Steps.classes.simple, isSimple), _Steps.classes.hasIndicator, hasIndicator)),
|
98
|
-
onClick: onClickHandler,
|
99
|
-
onFocus: onMouseOver,
|
100
|
-
onBlur: onMouseOut,
|
101
|
-
onMouseOver: onMouseOver,
|
102
|
-
onMouseOut: onMouseOut
|
103
|
-
}, hasLoader && /*#__PURE__*/_react["default"].createElement(_StepItem.SpinnerStyled, {
|
104
|
-
hasIndicator: hasIndicator
|
105
|
-
}), !hasLoader && /*#__PURE__*/_react["default"].createElement(BulletNode, {
|
106
|
-
className: (0, _classnames["default"])(_defineProperty(_defineProperty({}, _Steps.classes.active, isActive), _Steps.classes.inactive, isInactive)),
|
107
|
-
disabled: isDisabled
|
108
|
-
}, typeof indicator === 'function' && indicator({
|
109
|
-
status: status,
|
110
|
-
item: item,
|
111
|
-
size: size
|
112
|
-
}), typeof indicator !== 'function' && indicator))), !isLast && /*#__PURE__*/_react["default"].createElement(_StepItem.StepItemDivider, {
|
113
|
-
className: (0, _classnames["default"])(_Steps.classes.simple, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, _Steps.classes.verticalOrientation, isVertical), _Steps.classes.transparentDivider, !hasLine), _Steps.classes.active, isActive), _Steps.classes.inactive, isInactive || isNextInactive), _Steps.classes.disabled, isDisabled))
|
114
|
-
}));
|
115
|
-
}
|
116
91
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_StepItem.StepItemStyled, {
|
117
|
-
className: (0, _classnames["default"])(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(
|
92
|
+
className: (0, _classnames["default"])(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, _Steps.classes.simple, isSimple), _Steps.classes.active, isActive), _Steps.classes.hovered, isHovered && !isActive), _Steps.classes.inactive, isInactive), _Steps.classes.centered, isCentered), _Steps.classes.disabled, isDisabled), _Steps.classes.clickable, clickable && !isActive), _Steps.classes.hasIndicator, hasIndicator), _Steps.classes.verticalOrientation, isVertical))
|
118
93
|
}, /*#__PURE__*/_react["default"].createElement(_StepItem.BulletIndicatorWrapper, {
|
119
94
|
className: (0, _classnames["default"])(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, _Steps.classes.verticalOrientation, isVertical), _Steps.classes.centered, isCentered), _Steps.classes.simple, isSimple), _Steps.classes.hasIndicator, hasIndicator)),
|
120
95
|
onClick: onClickHandler,
|
@@ -124,21 +99,20 @@ var StepItem = exports.StepItem = function StepItem(_ref) {
|
|
124
99
|
onMouseOut: onMouseOut
|
125
100
|
}, contentAlign === 'center' && !isSimple && /*#__PURE__*/_react["default"].createElement(_StepItem.StepItemDivider, {
|
126
101
|
className: (0, _classnames["default"])(_defineProperty(_defineProperty(_defineProperty({}, _Steps.classes.simple, isSimple), _Steps.classes.transparentDivider, !hasLine || isFirst), _Steps.classes.inactive, isInactive || isPrevInactive))
|
127
|
-
}), isVertical && /*#__PURE__*/_react["default"].createElement(_StepItem.StepItemDivider, {
|
102
|
+
}), isVertical && (isSimple ? !isFirst : true) && /*#__PURE__*/_react["default"].createElement(_StepItem.StepItemDivider, {
|
128
103
|
className: (0, _classnames["default"])(_Steps.classes.indentDivider, _defineProperty(_defineProperty(_defineProperty({}, _Steps.classes.simple, isSimple), _Steps.classes.transparentDivider, !hasLine || isFirst), _Steps.classes.inactive, isInactive || isPrevInactive)),
|
129
104
|
indentToken: indentToken
|
130
105
|
}), hasLoader && /*#__PURE__*/_react["default"].createElement(_StepItem.SpinnerStyled, {
|
131
106
|
hasIndicator: hasIndicator
|
132
107
|
}), !hasLoader && /*#__PURE__*/_react["default"].createElement(BulletNode, {
|
133
|
-
className: (0, _classnames["default"])(_defineProperty(_defineProperty({}, _Steps.classes.active, isActive), _Steps.classes.inactive, isInactive))
|
134
|
-
disabled: isDisabled
|
108
|
+
className: (0, _classnames["default"])(_defineProperty(_defineProperty({}, _Steps.classes.active, isActive), _Steps.classes.inactive, isInactive))
|
135
109
|
}, typeof indicator === 'function' && indicator({
|
136
110
|
status: status,
|
137
111
|
item: item,
|
138
112
|
size: size
|
139
|
-
}), typeof indicator !== 'function' && indicator), /*#__PURE__*/_react["default"].createElement(_StepItem.StepItemDivider, {
|
113
|
+
}), typeof indicator !== 'function' && indicator), !isSimple && /*#__PURE__*/_react["default"].createElement(_StepItem.StepItemDivider, {
|
140
114
|
className: (0, _classnames["default"])(_defineProperty(_defineProperty(_defineProperty({}, _Steps.classes.simple, isSimple), _Steps.classes.transparentDivider, !hasLine || isLast), _Steps.classes.inactive, isInactive || isNextInactive))
|
141
|
-
})), /*#__PURE__*/_react["default"].createElement(_StepItem.StepItemContentWrapper, {
|
115
|
+
})), !isSimple && /*#__PURE__*/_react["default"].createElement(_StepItem.StepItemContentWrapper, {
|
142
116
|
className: (0, _classnames["default"])(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, _Steps.classes.verticalOrientation, isVertical), _Steps.classes.centered, isCentered), _Steps.classes.active, isActive), _Steps.classes.hasIndicator, hasIndicator))
|
143
117
|
}, /*#__PURE__*/_react["default"].createElement(_StepItem.StepItemTitle, {
|
144
118
|
onClick: onClickHandler,
|
@@ -146,5 +120,7 @@ var StepItem = exports.StepItem = function StepItem(_ref) {
|
|
146
120
|
onBlur: onMouseOut,
|
147
121
|
onMouseOver: onMouseOver,
|
148
122
|
onMouseOut: onMouseOut
|
149
|
-
}, title), content && /*#__PURE__*/_react["default"].createElement(_StepItem.StepItemContent, null, typeof content === 'function' ? content(status, index, items) : content)))
|
123
|
+
}, title), content && /*#__PURE__*/_react["default"].createElement(_StepItem.StepItemContent, null, typeof content === 'function' ? content(status, index, items) : content))), isSimple && !isLast && /*#__PURE__*/_react["default"].createElement(_StepItem.StepItemDivider, {
|
124
|
+
className: (0, _classnames["default"])(_Steps.classes.simple, _defineProperty(_defineProperty(_defineProperty({}, _Steps.classes.verticalOrientation, isVertical), _Steps.classes.transparentDivider, !hasLine), _Steps.classes.inactive, isInactive || isNextInactive))
|
125
|
+
}));
|
150
126
|
};
|
@@ -8,7 +8,6 @@ var _styledComponents = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/requir
|
|
8
8
|
var _Steps = /*#__PURE__*/require("../../Steps.tokens");
|
9
9
|
var _engines = /*#__PURE__*/require("../../../../engines");
|
10
10
|
var _Spinner = /*#__PURE__*/require("../../../Spinner");
|
11
|
-
var _mixins = /*#__PURE__*/require("../../../../mixins");
|
12
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
13
12
|
var mergedConfig = /*#__PURE__*/(0, _engines.mergeConfig)(_Spinner.spinnerConfig);
|
14
13
|
var Spinner = /*#__PURE__*/(0, _engines.component)(mergedConfig);
|
@@ -26,26 +25,16 @@ var StepItemContent = exports.StepItemContent = /*#__PURE__*/_styledComponents["
|
|
26
25
|
})(["padding-top:var(", ");padding-right:var(", ");font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");word-break:break-word;color:var(", ");"], _Steps.tokens.contentPaddingTop, _Steps.tokens.contentSidePadding, _Steps.tokens.contentFontFamily, _Steps.tokens.contentFontSize, _Steps.tokens.contentFontStyle, _Steps.tokens.contentFontWeight, _Steps.tokens.contentLetterSpacing, _Steps.tokens.contentLineHeight, _Steps.tokens.contentColor);
|
27
26
|
var BulletIndicatorWrapper = exports.BulletIndicatorWrapper = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
28
27
|
componentId: "plasma-new-hope__sc-bjma6z-3"
|
29
|
-
})(["display:flex;align-items:center;&:not(.", "){flex:0;&.", "{width:100%;min-height:var(", ");}&:not(.", "){width:100%;min-height:var(", ");}&.", "{padding-right:var(", ");}}&.", "{flex
|
30
|
-
var BulletIndicator = exports.BulletIndicator = /*#__PURE__*/_styledComponents["default"].
|
28
|
+
})(["display:flex;align-items:center;&:not(.", "){flex:0;&.", "{width:100%;min-height:var(", ");}&:not(.", "){width:100%;min-height:var(", ");}&.", "{padding-right:var(", ");}}&.", "{flex-direction:column;align-items:center;justify-content:center;min-height:100%;&.", "{min-width:var(", ");}&:not(.", "){min-width:var(", ");}}&.", "{justify-content:center;}"], _Steps.classes.simple, _Steps.classes.hasIndicator, _Steps.tokens.activeIndicatorSize, _Steps.classes.hasIndicator, _Steps.tokens.activeBulletSize, _Steps.classes.verticalOrientation, _Steps.tokens.verticalContentPaddingLeft, _Steps.classes.verticalOrientation, _Steps.classes.hasIndicator, _Steps.tokens.activeIndicatorSize, _Steps.classes.hasIndicator, _Steps.tokens.activeBulletSize, _Steps.classes.centered);
|
29
|
+
var BulletIndicator = exports.BulletIndicator = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
31
30
|
componentId: "plasma-new-hope__sc-bjma6z-4"
|
32
|
-
})(["display:flex;align-items:center;justify-content:center;width:var(", ");height:var(", ");border-radius:50%;box-sizing:border-box;position:relative;
|
33
|
-
outlineOffset: '-0.0625rem',
|
34
|
-
outlineSize: '0.0625rem',
|
35
|
-
outlineRadius: '50%',
|
36
|
-
outlineColor: /*#__PURE__*/"var(".concat(_Steps.tokens.focusColor, ")")
|
37
|
-
}), _Steps.classes.active, _Steps.tokens.activeIndicatorSize, _Steps.tokens.activeIndicatorSize, _Steps.tokens.dividerThickness, _Steps.tokens.activeIndicatorBorder, _Steps.tokens.activeIndicatorFontFamily, _Steps.tokens.activeIndicatorFontSize, _Steps.tokens.activeIndicatorFontStyle, _Steps.tokens.activeIndicatorFontWeight, _Steps.tokens.activeIndicatorLetterSpacing, _Steps.tokens.activeIndicatorLineHeight, _Steps.tokens.activeIndicatorColor, _Steps.tokens.activeIndicatorBackground, /*#__PURE__*/(0, _mixins.addFocus)({
|
38
|
-
outlineOffset: '-0.1875rem',
|
39
|
-
outlineSize: '0.0625rem',
|
40
|
-
outlineRadius: '50%',
|
41
|
-
outlineColor: /*#__PURE__*/"var(".concat(_Steps.tokens.focusColor, ")")
|
42
|
-
}), _Steps.classes.inactive, _Steps.tokens.inactiveIndicatorColor, _Steps.tokens.inactiveIndicatorBackground, _Steps.classes.simple, _Steps.tokens.inactiveIndicatorBackground);
|
31
|
+
})(["display:flex;align-items:center;justify-content:center;width:var(", ");height:var(", ");border-radius:50%;box-sizing:border-box;position:relative;color:var(", ");background-color:var(", ");font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");&.", "{width:var(", ");height:var(", ");border:var(", ") var(", ");font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");color:var(", ");background:var(", ");}&.", "{color:var(", ");background:var(", ");&:before,&:after{background:var(", ");}}"], _Steps.tokens.indicatorSize, _Steps.tokens.indicatorSize, _Steps.tokens.completedIndicatorColor, _Steps.tokens.completedIndicatorBackground, _Steps.tokens.indicatorFontFamily, _Steps.tokens.indicatorFontSize, _Steps.tokens.indicatorFontStyle, _Steps.tokens.indicatorFontWeight, _Steps.tokens.indicatorLetterSpacing, _Steps.tokens.indicatorLineHeight, _Steps.classes.active, _Steps.tokens.activeIndicatorSize, _Steps.tokens.activeIndicatorSize, _Steps.tokens.dividerThickness, _Steps.tokens.activeIndicatorBorder, _Steps.tokens.activeIndicatorFontFamily, _Steps.tokens.activeIndicatorFontSize, _Steps.tokens.activeIndicatorFontStyle, _Steps.tokens.activeIndicatorFontWeight, _Steps.tokens.activeIndicatorLetterSpacing, _Steps.tokens.activeIndicatorLineHeight, _Steps.tokens.activeIndicatorColor, _Steps.tokens.activeIndicatorBackground, _Steps.classes.inactive, _Steps.tokens.inactiveIndicatorColor, _Steps.tokens.inactiveIndicatorBackground, _Steps.tokens.inactiveIndicatorBackground);
|
43
32
|
var Bullet = exports.Bullet = /*#__PURE__*/(0, _styledComponents["default"])(BulletIndicator).withConfig({
|
44
33
|
componentId: "plasma-new-hope__sc-bjma6z-5"
|
45
|
-
})(["width:var(", ");height:var(", ");&.", "{width:var(", ");height:var(", ");border:var(", ") var(", ");background:var(", ");}"], _Steps.tokens.bulletSize, _Steps.tokens.bulletSize, _Steps.classes.active, _Steps.tokens.activeBulletSize, _Steps.tokens.activeBulletSize, _Steps.tokens.dividerThickness, _Steps.tokens.activeIndicatorBorder, _Steps.tokens.activeIndicatorBackground);
|
34
|
+
})(["width:var(", ");height:var(", ");&.", "{width:var(", ");height:var(", ");border:var(", ") var(", ");background-color:var(", ");}"], _Steps.tokens.bulletSize, _Steps.tokens.bulletSize, _Steps.classes.active, _Steps.tokens.activeBulletSize, _Steps.tokens.activeBulletSize, _Steps.tokens.dividerThickness, _Steps.tokens.activeIndicatorBorder, _Steps.tokens.activeIndicatorBackground);
|
46
35
|
var StepItemDivider = exports.StepItemDivider = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
47
36
|
componentId: "plasma-new-hope__sc-bjma6z-6"
|
48
|
-
})(["width:100%;height:var(", ");flex:1;background:var(", ");&.", "{background:var(", ");}&.", "{
|
37
|
+
})(["width:100%;height:var(", ");flex:1;background-color:var(", ");&.", "{background-color:var(", ");}&.", "{background-color:transparent;}&.", "{width:var(", ");height:100%;}&.", "{height:", ";min-height:", ";max-height:", ";&.", "{height:auto;max-height:none;}}"], _Steps.tokens.dividerThickness, _Steps.tokens.activeIndicatorColor, _Steps.classes.inactive, _Steps.tokens.inactiveIndicatorBackground, _Steps.classes.transparentDivider, _Steps.classes.verticalOrientation, _Steps.tokens.dividerThickness, _Steps.classes.indentDivider, function (_ref2) {
|
49
38
|
var indentToken = _ref2.indentToken;
|
50
39
|
return indentToken || '';
|
51
40
|
}, function (_ref3) {
|
@@ -60,4 +49,4 @@ var StepItemContentWrapper = exports.StepItemContentWrapper = /*#__PURE__*/_styl
|
|
60
49
|
})(["&.", "{", "{padding-top:var(", ");padding-right:0;}", "{padding-top:var(", ");padding-bottom:var(", ");padding-right:0;}}"], _Steps.classes.verticalOrientation, StepItemTitle, _Steps.tokens.contentVerticalPadding, StepItemContent, _Steps.tokens.contentVerticalPadding, _Steps.tokens.contentVerticalPadding);
|
61
50
|
var StepItemStyled = exports.StepItemStyled = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
62
51
|
componentId: "plasma-new-hope__sc-bjma6z-8"
|
63
|
-
})(["
|
52
|
+
})(["display:flex;flex-direction:column;align-items:flex-start;flex:1;&.", "{flex-direction:row;align-items:stretch;", "{width:var(", ");height:100%;}}&.", "{", "{color:var(", ");}}&.", "{", "{color:var(", ");}}&.", "{&:not(.", "){", "{cursor:pointer;color:var(", ");}", ",", "{color:var(", ");background:var(", ");}}&.", "{", "{color:var(", ");}", ",", "{color:var(", ");background:var(", ");}}", "{cursor:pointer;}}&.", "{align-items:center;", "{display:flex;flex-direction:column;align-items:center;padding-left:calc(var(", ") / 2);padding-right:calc(var(", ") / 2);", "{width:100%;}", ",", "{padding-right:0;text-align:center;}}}&.", "{flex:0;}&.", "{opacity:var(", ");}"], _Steps.classes.verticalOrientation, StepItemDivider, _Steps.tokens.dividerThickness, _Steps.classes.active, StepItemTitle, _Steps.tokens.activeTitleColor, _Steps.classes.inactive, StepItemTitle, _Steps.tokens.inactiveTitleColor, _Steps.classes.hovered, _Steps.classes.active, StepItemTitle, _Steps.tokens.activeTitleColorHover, BulletIndicator, Bullet, _Steps.tokens.completedIndicatorColorHover, _Steps.tokens.completedIndicatorBackgroundHover, _Steps.classes.inactive, StepItemTitle, _Steps.tokens.inactiveTitleColorHover, BulletIndicator, Bullet, _Steps.tokens.inactiveIndicatorColorHover, _Steps.tokens.inactiveIndicatorBackgroundHover, BulletIndicatorWrapper, _Steps.classes.centered, StepItemContentWrapper, _Steps.tokens.contentSidePadding, _Steps.tokens.contentSidePadding, StepItemTitle, StepItemTitle, StepItemContent, _Steps.classes.simple, _Steps.classes.disabled, _Steps.tokens.disabledOpacity);
|
@@ -7,14 +7,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
exports.switchRoot = exports.switchConfig = void 0;
|
8
8
|
var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
|
9
9
|
var _base = /*#__PURE__*/require("../Switch/_size/base");
|
10
|
-
var _base2 = /*#__PURE__*/require("../Switch/
|
11
|
-
var _base3 = /*#__PURE__*/require("../Switch/
|
12
|
-
var _base4 = /*#__PURE__*/require("../Switch/
|
10
|
+
var _base2 = /*#__PURE__*/require("../Switch/_toggleSize/base");
|
11
|
+
var _base3 = /*#__PURE__*/require("../Switch/_view/base");
|
12
|
+
var _base4 = /*#__PURE__*/require("../Switch/_focused/base");
|
13
|
+
var _base5 = /*#__PURE__*/require("../Switch/_disabled/base");
|
13
14
|
var _utils = /*#__PURE__*/require("../../utils");
|
14
15
|
var _Switch = /*#__PURE__*/require("./Switch.styles");
|
15
16
|
var _Switch2 = /*#__PURE__*/require("./Switch.tokens");
|
16
17
|
var _StyledTrigger;
|
17
|
-
var _excluded = ["size", "view", "focused", "outlined", "disabled", "labelPosition", "label", "id", "style", "className", "checked", "pressed", "defaultChecked"];
|
18
|
+
var _excluded = ["size", "toggleSize", "view", "focused", "outlined", "disabled", "labelPosition", "label", "description", "id", "style", "className", "checked", "pressed", "defaultChecked"];
|
18
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); }
|
19
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; }
|
20
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); }
|
@@ -23,12 +24,14 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
23
24
|
var switchRoot = exports.switchRoot = function switchRoot(Root) {
|
24
25
|
return /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
25
26
|
var size = props.size,
|
27
|
+
toggleSize = props.toggleSize,
|
26
28
|
view = props.view,
|
27
29
|
focused = props.focused,
|
28
30
|
outlined = props.outlined,
|
29
31
|
disabled = props.disabled,
|
30
32
|
labelPosition = props.labelPosition,
|
31
33
|
label = props.label,
|
34
|
+
description = props.description,
|
32
35
|
id = props.id,
|
33
36
|
style = props.style,
|
34
37
|
className = props.className,
|
@@ -40,12 +43,15 @@ var switchRoot = exports.switchRoot = function switchRoot(Root) {
|
|
40
43
|
return /*#__PURE__*/_react["default"].createElement(Root, {
|
41
44
|
view: view,
|
42
45
|
size: size,
|
46
|
+
toggleSize: toggleSize,
|
43
47
|
disabled: disabled,
|
44
48
|
focused: focused !== null && focused !== void 0 ? focused : outlined,
|
45
49
|
labelPosition: labelPosition,
|
46
50
|
id: id,
|
47
51
|
style: style,
|
48
|
-
className: (0, _utils.cx)(className
|
52
|
+
className: (0, _utils.cx)(className)
|
53
|
+
}, /*#__PURE__*/_react["default"].createElement(_Switch.StyledContent, {
|
54
|
+
className: (0, _utils.cx)(_Switch2.classes["".concat(labelPosition, "SwitchLabelPosition")])
|
49
55
|
}, /*#__PURE__*/_react["default"].createElement(_Switch.StyledInput, _extends({}, rest, {
|
50
56
|
ref: ref,
|
51
57
|
role: "switch",
|
@@ -58,7 +64,7 @@ var switchRoot = exports.switchRoot = function switchRoot(Root) {
|
|
58
64
|
tabIndex: -1
|
59
65
|
}, label), _StyledTrigger || (_StyledTrigger = /*#__PURE__*/_react["default"].createElement(_Switch.StyledTrigger, {
|
60
66
|
"aria-hidden": true
|
61
|
-
})));
|
67
|
+
}))), description && /*#__PURE__*/_react["default"].createElement(_Switch.StyledDescription, null, description));
|
62
68
|
});
|
63
69
|
};
|
64
70
|
var switchConfig = exports.switchConfig = {
|
@@ -71,14 +77,17 @@ var switchConfig = exports.switchConfig = {
|
|
71
77
|
css: _base.base
|
72
78
|
},
|
73
79
|
view: {
|
80
|
+
css: _base3.base
|
81
|
+
},
|
82
|
+
toggleSize: {
|
74
83
|
css: _base2.base
|
75
84
|
},
|
76
85
|
disabled: {
|
77
|
-
css:
|
86
|
+
css: _base5.base,
|
78
87
|
attrs: true
|
79
88
|
},
|
80
89
|
focused: {
|
81
|
-
css:
|
90
|
+
css: _base4.base
|
82
91
|
}
|
83
92
|
},
|
84
93
|
defaults: {
|
@@ -4,19 +4,25 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
5
5
|
value: true
|
6
6
|
});
|
7
|
-
exports.base = exports.StyledTrigger = exports.StyledLabel = exports.StyledInput = void 0;
|
7
|
+
exports.base = exports.StyledTrigger = exports.StyledLabel = exports.StyledInput = exports.StyledDescription = exports.StyledContent = void 0;
|
8
8
|
var _styledComponents = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("styled-components"));
|
9
9
|
var _mixins = /*#__PURE__*/require("../../mixins");
|
10
10
|
var _Switch = /*#__PURE__*/require("./Switch.tokens");
|
11
11
|
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); }
|
12
12
|
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; }
|
13
|
-
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["position:relative;display:flex;
|
14
|
-
var
|
13
|
+
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["position:relative;display:flex;flex-direction:column;gap:var(", ");cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0);&:focus{outline:0 none;}"], _Switch.tokens.verticalGap);
|
14
|
+
var StyledContent = exports.StyledContent = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
15
15
|
componentId: "plasma-new-hope__sc-i4fgom-0"
|
16
|
+
})(["width:100%;position:relative;display:flex;align-items:center;&.", "{justify-content:space-between;", ":0 var(", ") 0 0;}&.", "{justify-content:start;flex-direction:row-reverse;", ":0 0 0 var(", ");}"], _Switch.classes.beforeSwitchLabelPosition, _Switch.tokens.labelOffsetPrivate, _Switch.tokens.labelOffset, _Switch.classes.afterSwitchLabelPosition, _Switch.tokens.labelOffsetPrivate, _Switch.tokens.labelOffset);
|
17
|
+
var StyledDescription = exports.StyledDescription = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
18
|
+
componentId: "plasma-new-hope__sc-i4fgom-1"
|
19
|
+
})(["position:relative;"]);
|
20
|
+
var StyledInput = exports.StyledInput = /*#__PURE__*/_styledComponents["default"].input.withConfig({
|
21
|
+
componentId: "plasma-new-hope__sc-i4fgom-2"
|
16
22
|
})(["position:absolute;right:0;margin:0;opacity:0;&:focus{outline:0 none;}"]);
|
17
23
|
var StyledLabel = exports.StyledLabel = /*#__PURE__*/_styledComponents["default"].span.withConfig({
|
18
|
-
componentId: "plasma-new-hope__sc-i4fgom-
|
24
|
+
componentId: "plasma-new-hope__sc-i4fgom-3"
|
19
25
|
})(["user-select:none;", ""], /*#__PURE__*/(0, _mixins.applyEllipsis)());
|
20
26
|
var StyledTrigger = exports.StyledTrigger = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
21
|
-
componentId: "plasma-new-hope__sc-i4fgom-
|
27
|
+
componentId: "plasma-new-hope__sc-i4fgom-4"
|
22
28
|
})(["position:relative;display:flex;align-items:center;transition:background-color 0.15s ease-in-out 0.1s;::after{content:'';position:absolute;right:auto;left:0;transition:width 0.15s ease-in-out 0s,left 0.3s ease-in-out 0s,right 0.3s ease-in-out 0s;}", ":checked ~ &::after{right:0;left:auto;}"], StyledInput);
|
@@ -18,7 +18,43 @@ import { Switch } from '@salutejs/{{ package }}';
|
|
18
18
|
|
19
19
|
export function App() {
|
20
20
|
return (
|
21
|
-
<Switch label="Переключатель" defaultChecked />
|
21
|
+
<Switch description="Описание переключателя" label="Переключатель" defaultChecked />
|
22
|
+
);
|
23
|
+
}
|
24
|
+
```
|
25
|
+
|
26
|
+
## Примеры
|
27
|
+
|
28
|
+
### Размер Switch
|
29
|
+
Размер компонента задается с помощью свойства `size`.
|
30
|
+
|
31
|
+
```tsx live
|
32
|
+
import React from 'react';
|
33
|
+
import { Button } from '@salutejs/{{ package }}';
|
34
|
+
|
35
|
+
export function App() {
|
36
|
+
return (
|
37
|
+
<div>
|
38
|
+
<Switch size="s" description="Описание переключателя" label="Переключатель" defaultChecked />
|
39
|
+
<Switch size="m" description="Описание переключателя" label="Переключатель" defaultChecked />
|
40
|
+
<Switch size="l" description="Описание переключателя" label="Переключатель" defaultChecked />
|
41
|
+
</div>
|
42
|
+
);
|
43
|
+
}
|
44
|
+
```
|
45
|
+
|
46
|
+
Размер переключателя задается с помощью свойства `toggleSize`.
|
47
|
+
|
48
|
+
```tsx live
|
49
|
+
import React from 'react';
|
50
|
+
import { Button } from '@salutejs/{{ package }}';
|
51
|
+
|
52
|
+
export function App() {
|
53
|
+
return (
|
54
|
+
<div style=\{{ alignItems: "center" }}>
|
55
|
+
<Switch toggleSize="s" label="Переключатель" defaultChecked />
|
56
|
+
<Switch toggleSize="l" label="Переключатель" defaultChecked />
|
57
|
+
</div>
|
22
58
|
);
|
23
59
|
}
|
24
60
|
```
|
@@ -11,11 +11,22 @@ var tokens = exports.tokens = {
|
|
11
11
|
fontWeight: '--plasma-switch-font-weight',
|
12
12
|
letterSpacing: '--plasma-switch-letter-spacing',
|
13
13
|
lineHeight: '--plasma-switch-line-height',
|
14
|
+
/* Токены description */
|
15
|
+
descriptionFontFamily: '--plasma-switch-description-font-family',
|
16
|
+
descriptionFontStyle: '--plasma-switch-description-font-style',
|
17
|
+
descriptionFontSize: '--plasma-switch-description-font-size',
|
18
|
+
descriptionFontWeight: '--plasma-switch-description-font-weight',
|
19
|
+
descriptionLetterSpacing: '--plasma-switch-description-letter-spacing',
|
20
|
+
descriptionLineHeight: '--plasma-switch-description-line-height',
|
14
21
|
/* Цвет подписи */
|
15
22
|
labelColor: '--plasma-switch__label-color',
|
16
23
|
labelOffset: '--plasma-switch__label-offset',
|
24
|
+
/* Цвет описания */
|
25
|
+
descriptionColor: '--plasma-switch__description-color',
|
26
|
+
descriptionOffset: '--plasma-switch__description-offset',
|
17
27
|
/** Прозрачность для всего компонента в состоянии disabled */
|
18
28
|
disabledOpacity: '--plasma-switch-disabled-opacity',
|
29
|
+
verticalGap: '--plasma-switch-vertical-gap',
|
19
30
|
trackWidth: '--plasma-switch__track-width',
|
20
31
|
trackHeight: '--plasma-switch__track-height',
|
21
32
|
trackBorderRadius: '--plasma-switch__track-border-radius',
|
@@ -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)(["font-family:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");font-size:var(", ");", "{
|
10
|
+
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["", "{font-family:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");font-size:var(", ");}", "{font-family:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");font-size:var(", ");}", "{margin:var(", ",0);}"], _Switch2.StyledContent, _Switch.tokens.fontFamily, _Switch.tokens.fontStyle, _Switch.tokens.fontWeight, _Switch.tokens.letterSpacing, _Switch.tokens.lineHeight, _Switch.tokens.fontSize, _Switch2.StyledDescription, _Switch.tokens.descriptionFontFamily, _Switch.tokens.descriptionFontStyle, _Switch.tokens.descriptionFontWeight, _Switch.tokens.descriptionLetterSpacing, _Switch.tokens.descriptionLineHeight, _Switch.tokens.descriptionFontSize, _Switch2.StyledLabel, _Switch.tokens.labelOffsetPrivate);
|
@@ -0,0 +1,10 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.base = void 0;
|
7
|
+
var _styledComponents = /*#__PURE__*/require("styled-components");
|
8
|
+
var _Switch = /*#__PURE__*/require("../Switch.tokens");
|
9
|
+
var _Switch2 = /*#__PURE__*/require("../Switch.styles");
|
10
|
+
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["", "{flex:0 0 var(", ");width:var(", ");height:var(", ");border-radius:var(", ");&::after{width:var(", ");height:var(", ");border-radius:var(", ");margin:auto var(", ");}}:active:not([disabled]) ", "::after{width:calc(var(", ") * var(", ",1));}"], _Switch2.StyledTrigger, _Switch.tokens.trackWidth, _Switch.tokens.trackWidth, _Switch.tokens.trackHeight, _Switch.tokens.trackBorderRadius, _Switch.tokens.thumbSize, _Switch.tokens.thumbSize, _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(", "));}"], _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.thumbBackgroundColor, _Switch.tokens.thumbBoxShadow, _Switch2.StyledInput, _Switch2.StyledTrigger, _Switch.tokens.thumbBoxShadowOn, _Switch.tokens.thumbBoxShadow);
|
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.thumbBackgroundColor, _Switch.tokens.thumbBoxShadow, _Switch2.StyledInput, _Switch2.StyledTrigger, _Switch.tokens.thumbBoxShadowOn, _Switch.tokens.thumbBoxShadow, _Switch2.StyledLabel, _Switch.tokens.labelColor, _Switch2.StyledDescription, _Switch.tokens.descriptionColor);
|
@@ -13,7 +13,7 @@ var config = exports.config = {
|
|
13
13
|
},
|
14
14
|
variations: {
|
15
15
|
view: {
|
16
|
-
"default": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--text-primary);", ":var(--text-primary-hover);", ":solid var(--surface-solid-default);", ":var(--text-primary);", ":var(--surface-clear);", ":var(--inverse-text-primary);", ":var(--inverse-text-primary);", ":var(--surface-solid-default);", ":var(--surface-solid-default-hover);", ":var(--text-secondary);", ":var(--text-secondary-hover);", ":var(--text-secondary);", ":var(--text-secondary);", ":var(--surface-transparent-secondary);", ":var(--surface-transparent-secondary-hover);", ":var(--text-secondary);", ":
|
16
|
+
"default": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--text-primary);", ":var(--text-primary-hover);", ":solid var(--surface-solid-default);", ":var(--text-primary);", ":var(--surface-clear);", ":var(--inverse-text-primary);", ":var(--inverse-text-primary);", ":var(--surface-solid-default);", ":var(--surface-solid-default-hover);", ":var(--text-secondary);", ":var(--text-secondary-hover);", ":var(--text-secondary);", ":var(--text-secondary);", ":var(--surface-transparent-secondary);", ":var(--surface-transparent-secondary-hover);", ":var(--text-secondary);", ":0.4;"], _Steps.stepsTokens.activeTitleColor, _Steps.stepsTokens.activeTitleColorHover, _Steps.stepsTokens.activeIndicatorBorder, _Steps.stepsTokens.activeIndicatorColor, _Steps.stepsTokens.activeIndicatorBackground, _Steps.stepsTokens.completedIndicatorColor, _Steps.stepsTokens.completedIndicatorColorHover, _Steps.stepsTokens.completedIndicatorBackground, _Steps.stepsTokens.completedIndicatorBackgroundHover, _Steps.stepsTokens.inactiveTitleColor, _Steps.stepsTokens.inactiveTitleColorHover, _Steps.stepsTokens.inactiveIndicatorColor, _Steps.stepsTokens.inactiveIndicatorColorHover, _Steps.stepsTokens.inactiveIndicatorBackground, _Steps.stepsTokens.inactiveIndicatorBackgroundHover, _Steps.stepsTokens.contentColor, _Steps.stepsTokens.disabledOpacity)
|
17
17
|
},
|
18
18
|
size: {
|
19
19
|
l: /*#__PURE__*/(0, _styledComponents.css)(["", ":1.5rem;", ":2.25rem;", ":0.5rem;", ":1rem;", ":0.75rem;", ":0.375rem;", ":2rem;", ":1.0625rem;", ":0.75rem;", ":1rem;", ":0.625rem;", ":1.5rem;", ":1.25rem;", ":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);", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);", ":var(--plasma-typo-body-l-font-family);", ":var(--plasma-typo-body-l-font-size);", ":var(--plasma-typo-body-l-font-style);", ":var(--plasma-typo-body-l-font-weight);", ":var(--plasma-typo-body-l-letter-spacing);", ":var(--plasma-typo-body-l-line-height);", ":var(--plasma-typo-body-m-font-family);", ":var(--plasma-typo-body-m-font-size);", ":var(--plasma-typo-body-m-font-style);", ":var(--plasma-typo-body-m-font-weight);", ":var(--plasma-typo-body-m-letter-spacing);", ":var(--plasma-typo-body-m-line-height);", ":0.125rem;"], _Steps.stepsTokens.indicatorSize, _Steps.stepsTokens.activeIndicatorSize, _Steps.stepsTokens.bulletSize, _Steps.stepsTokens.activeBulletSize, _Steps.stepsTokens.titlePaddingTop, _Steps.stepsTokens.contentPaddingTop, _Steps.stepsTokens.contentSidePadding, _Steps.stepsTokens.contentVerticalPadding, _Steps.stepsTokens.verticalContentPaddingLeft, _Steps.stepsTokens.smallIndicatorIndentHeight, _Steps.stepsTokens.largeIndicatorIndentHeight, _Steps.stepsTokens.smallBulletIndentHeight, _Steps.stepsTokens.largeBulletIndentHeight, _Steps.stepsTokens.indicatorFontFamily, _Steps.stepsTokens.indicatorFontSize, _Steps.stepsTokens.indicatorFontStyle, _Steps.stepsTokens.indicatorFontWeight, _Steps.stepsTokens.indicatorLetterSpacing, _Steps.stepsTokens.indicatorLineHeight, _Steps.stepsTokens.activeIndicatorFontFamily, _Steps.stepsTokens.activeIndicatorFontSize, _Steps.stepsTokens.activeIndicatorFontStyle, _Steps.stepsTokens.activeIndicatorFontWeight, _Steps.stepsTokens.activeIndicatorLetterSpacing, _Steps.stepsTokens.activeIndicatorLineHeight, _Steps.stepsTokens.titleFontFamily, _Steps.stepsTokens.titleFontSize, _Steps.stepsTokens.titleFontStyle, _Steps.stepsTokens.titleFontWeight, _Steps.stepsTokens.titleLetterSpacing, _Steps.stepsTokens.titleLineHeight, _Steps.stepsTokens.contentFontFamily, _Steps.stepsTokens.contentFontSize, _Steps.stepsTokens.contentFontStyle, _Steps.stepsTokens.contentFontWeight, _Steps.stepsTokens.contentLetterSpacing, _Steps.stepsTokens.contentLineHeight, _Steps.stepsTokens.dividerThickness),
|
@@ -10,15 +10,22 @@ var config = exports.config = {
|
|
10
10
|
defaults: {
|
11
11
|
view: 'default',
|
12
12
|
size: 'm',
|
13
|
+
toggleSize: 'l',
|
13
14
|
labelPosition: 'before',
|
14
15
|
focused: 'true'
|
15
16
|
},
|
16
17
|
variations: {
|
17
18
|
size: {
|
18
|
-
|
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)
|
19
26
|
},
|
20
27
|
view: {
|
21
|
-
"default": /*#__PURE__*/(0, _styledComponents.css)(["", ":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.trackBackgroundColorOn, _Switch.switchTokens.trackBackgroundColorOnHover, _Switch.switchTokens.trackBackgroundColorOff, _Switch.switchTokens.trackBackgroundColorOffHover, _Switch.switchTokens.thumbBackgroundColor, _Switch.switchTokens.thumbBoxShadow)
|
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.thumbBackgroundColor, _Switch.switchTokens.thumbBoxShadow)
|
22
29
|
},
|
23
30
|
disabled: {
|
24
31
|
"true": /*#__PURE__*/(0, _styledComponents.css)(["", ":0.4;"], _Switch.switchTokens.disabledOpacity)
|
@@ -18,7 +18,7 @@ const meta: Meta<SwitchProps> = {
|
|
18
18
|
decorators: [WithTheme],
|
19
19
|
component: Switch,
|
20
20
|
argTypes: {
|
21
|
-
...argTypesFromConfig(mergeConfig(switchConfig, config), ['
|
21
|
+
...argTypesFromConfig(mergeConfig(switchConfig, config), ['view', 'focused']),
|
22
22
|
labelPosition: {
|
23
23
|
options: ['before', 'after'],
|
24
24
|
control: { type: 'select' },
|
@@ -26,6 +26,7 @@ const meta: Meta<SwitchProps> = {
|
|
26
26
|
},
|
27
27
|
args: {
|
28
28
|
label: 'Label',
|
29
|
+
description: 'Description',
|
29
30
|
labelPosition: 'before',
|
30
31
|
},
|
31
32
|
};
|
@@ -64,5 +65,10 @@ const StoryDefault = (args: SwitchProps) => {
|
|
64
65
|
};
|
65
66
|
|
66
67
|
export const Default: StoryObj<SwitchProps> = {
|
68
|
+
args: {
|
69
|
+
size: 'm',
|
70
|
+
toggleSize: 'l',
|
71
|
+
disabled: false,
|
72
|
+
},
|
67
73
|
render: (args) => <StoryDefault {...args} />,
|
68
74
|
};
|
@@ -13,7 +13,7 @@ var config = exports.config = {
|
|
13
13
|
},
|
14
14
|
variations: {
|
15
15
|
view: {
|
16
|
-
"default": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--text-primary);", ":var(--text-primary-hover);", ":solid var(--surface-solid-default);", ":var(--text-primary);", ":var(--surface-clear);", ":var(--inverse-text-primary);", ":var(--inverse-text-primary);", ":var(--surface-solid-default);", ":var(--surface-solid-default-hover);", ":var(--text-secondary);", ":var(--text-secondary-hover);", ":var(--text-secondary);", ":var(--text-secondary);", ":var(--surface-transparent-secondary);", ":var(--surface-transparent-secondary-hover);", ":var(--text-secondary);", ":
|
16
|
+
"default": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--text-primary);", ":var(--text-primary-hover);", ":solid var(--surface-solid-default);", ":var(--text-primary);", ":var(--surface-clear);", ":var(--inverse-text-primary);", ":var(--inverse-text-primary);", ":var(--surface-solid-default);", ":var(--surface-solid-default-hover);", ":var(--text-secondary);", ":var(--text-secondary-hover);", ":var(--text-secondary);", ":var(--text-secondary);", ":var(--surface-transparent-secondary);", ":var(--surface-transparent-secondary-hover);", ":var(--text-secondary);", ":0.4;"], _Steps.stepsTokens.activeTitleColor, _Steps.stepsTokens.activeTitleColorHover, _Steps.stepsTokens.activeIndicatorBorder, _Steps.stepsTokens.activeIndicatorColor, _Steps.stepsTokens.activeIndicatorBackground, _Steps.stepsTokens.completedIndicatorColor, _Steps.stepsTokens.completedIndicatorColorHover, _Steps.stepsTokens.completedIndicatorBackground, _Steps.stepsTokens.completedIndicatorBackgroundHover, _Steps.stepsTokens.inactiveTitleColor, _Steps.stepsTokens.inactiveTitleColorHover, _Steps.stepsTokens.inactiveIndicatorColor, _Steps.stepsTokens.inactiveIndicatorColorHover, _Steps.stepsTokens.inactiveIndicatorBackground, _Steps.stepsTokens.inactiveIndicatorBackgroundHover, _Steps.stepsTokens.contentColor, _Steps.stepsTokens.disabledOpacity)
|
17
17
|
},
|
18
18
|
size: {
|
19
19
|
l: /*#__PURE__*/(0, _styledComponents.css)(["", ":1.5rem;", ":2.25rem;", ":0.5rem;", ":1rem;", ":0.75rem;", ":0.375rem;", ":2rem;", ":1.0625rem;", ":0.75rem;", ":1rem;", ":0.625rem;", ":1.5rem;", ":1.25rem;", ":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);", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);", ":var(--plasma-typo-body-l-font-family);", ":var(--plasma-typo-body-l-font-size);", ":var(--plasma-typo-body-l-font-style);", ":var(--plasma-typo-body-l-font-weight);", ":var(--plasma-typo-body-l-letter-spacing);", ":var(--plasma-typo-body-l-line-height);", ":var(--plasma-typo-body-m-font-family);", ":var(--plasma-typo-body-m-font-size);", ":var(--plasma-typo-body-m-font-style);", ":var(--plasma-typo-body-m-font-weight);", ":var(--plasma-typo-body-m-letter-spacing);", ":var(--plasma-typo-body-m-line-height);", ":0.125rem;"], _Steps.stepsTokens.indicatorSize, _Steps.stepsTokens.activeIndicatorSize, _Steps.stepsTokens.bulletSize, _Steps.stepsTokens.activeBulletSize, _Steps.stepsTokens.titlePaddingTop, _Steps.stepsTokens.contentPaddingTop, _Steps.stepsTokens.contentSidePadding, _Steps.stepsTokens.contentVerticalPadding, _Steps.stepsTokens.verticalContentPaddingLeft, _Steps.stepsTokens.smallIndicatorIndentHeight, _Steps.stepsTokens.largeIndicatorIndentHeight, _Steps.stepsTokens.smallBulletIndentHeight, _Steps.stepsTokens.largeBulletIndentHeight, _Steps.stepsTokens.indicatorFontFamily, _Steps.stepsTokens.indicatorFontSize, _Steps.stepsTokens.indicatorFontStyle, _Steps.stepsTokens.indicatorFontWeight, _Steps.stepsTokens.indicatorLetterSpacing, _Steps.stepsTokens.indicatorLineHeight, _Steps.stepsTokens.activeIndicatorFontFamily, _Steps.stepsTokens.activeIndicatorFontSize, _Steps.stepsTokens.activeIndicatorFontStyle, _Steps.stepsTokens.activeIndicatorFontWeight, _Steps.stepsTokens.activeIndicatorLetterSpacing, _Steps.stepsTokens.activeIndicatorLineHeight, _Steps.stepsTokens.titleFontFamily, _Steps.stepsTokens.titleFontSize, _Steps.stepsTokens.titleFontStyle, _Steps.stepsTokens.titleFontWeight, _Steps.stepsTokens.titleLetterSpacing, _Steps.stepsTokens.titleLineHeight, _Steps.stepsTokens.contentFontFamily, _Steps.stepsTokens.contentFontSize, _Steps.stepsTokens.contentFontStyle, _Steps.stepsTokens.contentFontWeight, _Steps.stepsTokens.contentLetterSpacing, _Steps.stepsTokens.contentLineHeight, _Steps.stepsTokens.dividerThickness),
|
@@ -10,15 +10,22 @@ var config = exports.config = {
|
|
10
10
|
defaults: {
|
11
11
|
view: 'default',
|
12
12
|
size: 'm',
|
13
|
+
toggleSize: 'l',
|
13
14
|
labelPosition: 'before',
|
14
15
|
focused: 'true'
|
15
16
|
},
|
16
17
|
variations: {
|
17
18
|
size: {
|
18
|
-
|
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)
|
19
26
|
},
|
20
27
|
view: {
|
21
|
-
"default": /*#__PURE__*/(0, _styledComponents.css)(["", ":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.trackBackgroundColorOn, _Switch.switchTokens.trackBackgroundColorOnHover, _Switch.switchTokens.trackBackgroundColorOff, _Switch.switchTokens.trackBackgroundColorOffHover, _Switch.switchTokens.thumbBackgroundColor, _Switch.switchTokens.thumbBoxShadow)
|
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.thumbBackgroundColor, _Switch.switchTokens.thumbBoxShadow)
|
22
29
|
},
|
23
30
|
disabled: {
|
24
31
|
"true": /*#__PURE__*/(0, _styledComponents.css)(["", ":0.4;"], _Switch.switchTokens.disabledOpacity)
|
@@ -17,9 +17,17 @@ const meta: Meta<SwitchProps> = {
|
|
17
17
|
title: 'plasma_web/Switch',
|
18
18
|
decorators: [WithTheme],
|
19
19
|
component: Switch,
|
20
|
-
argTypes:
|
20
|
+
argTypes: {
|
21
|
+
...argTypesFromConfig(mergeConfig(switchConfig, config), ['view', 'focused']),
|
22
|
+
labelPosition: {
|
23
|
+
options: ['before', 'after'],
|
24
|
+
control: { type: 'select' },
|
25
|
+
},
|
26
|
+
},
|
21
27
|
args: {
|
22
28
|
label: 'Label',
|
29
|
+
description: 'Description',
|
30
|
+
labelPosition: 'before',
|
23
31
|
},
|
24
32
|
};
|
25
33
|
|
@@ -57,5 +65,10 @@ const StoryDefault = (args: SwitchProps) => {
|
|
57
65
|
};
|
58
66
|
|
59
67
|
export const Default: StoryObj<SwitchProps> = {
|
68
|
+
args: {
|
69
|
+
size: 'm',
|
70
|
+
toggleSize: 'l',
|
71
|
+
disabled: false,
|
72
|
+
},
|
60
73
|
render: (args) => <StoryDefault {...args} />,
|
61
74
|
};
|