@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.
Files changed (146) hide show
  1. package/cjs/components/Modal/Modal.css +0 -6
  2. package/cjs/components/Modal/Modal.js +13 -27
  3. package/cjs/components/Modal/Modal.js.map +1 -1
  4. package/cjs/components/Modal/Modal.tokens.js +1 -7
  5. package/cjs/components/Modal/Modal.tokens.js.map +1 -1
  6. package/cjs/components/Switch/Switch.css +2 -2
  7. package/cjs/components/Switch/Switch.tokens.js +7 -1
  8. package/cjs/components/Switch/Switch.tokens.js.map +1 -1
  9. package/cjs/components/Switch/_toggleSize/base.js +1 -1
  10. package/cjs/components/Switch/_toggleSize/base.js.map +1 -1
  11. package/cjs/components/Switch/_toggleSize/base_38anc0.css +1 -0
  12. package/cjs/components/Switch/_view/base.js +1 -1
  13. package/cjs/components/Switch/_view/base.js.map +1 -1
  14. package/cjs/components/Switch/_view/base_15atbyp.css +1 -0
  15. package/cjs/index.css +2 -6
  16. package/emotion/cjs/components/Modal/Modal.js +12 -26
  17. package/emotion/cjs/components/Modal/Modal.template-doc.mdx +0 -47
  18. package/emotion/cjs/components/Modal/Modal.tokens.js +1 -7
  19. package/emotion/cjs/components/Switch/Switch.tokens.js +7 -1
  20. package/emotion/cjs/components/Switch/_toggleSize/base.js +1 -1
  21. package/emotion/cjs/components/Switch/_view/base.js +1 -1
  22. package/emotion/cjs/examples/plasma_b2c/components/Modal/Modal.config.js +1 -1
  23. package/emotion/cjs/examples/plasma_b2c/components/Modal/Modal.stories.tsx +1 -90
  24. package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.config.js +8 -8
  25. package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.js +5 -2
  26. package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.outline.config.js +37 -0
  27. package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.stories.tsx +33 -1
  28. package/emotion/cjs/examples/plasma_web/components/Modal/Modal.config.js +1 -1
  29. package/emotion/cjs/examples/plasma_web/components/Modal/Modal.stories.tsx +1 -90
  30. package/emotion/cjs/examples/plasma_web/components/Switch/Switch.config.js +8 -8
  31. package/emotion/cjs/examples/plasma_web/components/Switch/Switch.js +5 -2
  32. package/emotion/cjs/examples/plasma_web/components/Switch/Switch.outline.config.js +37 -0
  33. package/emotion/cjs/examples/plasma_web/components/Switch/Switch.stories.tsx +33 -1
  34. package/emotion/es/components/Modal/Modal.js +12 -26
  35. package/emotion/es/components/Modal/Modal.template-doc.mdx +0 -47
  36. package/emotion/es/components/Modal/Modal.tokens.js +1 -7
  37. package/emotion/es/components/Switch/Switch.tokens.js +7 -1
  38. package/emotion/es/components/Switch/_toggleSize/base.js +1 -1
  39. package/emotion/es/components/Switch/_view/base.js +1 -1
  40. package/emotion/es/examples/plasma_b2c/components/Modal/Modal.config.js +1 -1
  41. package/emotion/es/examples/plasma_b2c/components/Modal/Modal.stories.tsx +1 -90
  42. package/emotion/es/examples/plasma_b2c/components/Switch/Switch.config.js +8 -8
  43. package/emotion/es/examples/plasma_b2c/components/Switch/Switch.js +4 -1
  44. package/emotion/es/examples/plasma_b2c/components/Switch/Switch.outline.config.js +31 -0
  45. package/emotion/es/examples/plasma_b2c/components/Switch/Switch.stories.tsx +33 -1
  46. package/emotion/es/examples/plasma_web/components/Modal/Modal.config.js +1 -1
  47. package/emotion/es/examples/plasma_web/components/Modal/Modal.stories.tsx +1 -90
  48. package/emotion/es/examples/plasma_web/components/Switch/Switch.config.js +8 -8
  49. package/emotion/es/examples/plasma_web/components/Switch/Switch.js +4 -1
  50. package/emotion/es/examples/plasma_web/components/Switch/Switch.outline.config.js +31 -0
  51. package/emotion/es/examples/plasma_web/components/Switch/Switch.stories.tsx +33 -1
  52. package/es/components/Modal/Modal.css +0 -6
  53. package/es/components/Modal/Modal.js +13 -27
  54. package/es/components/Modal/Modal.js.map +1 -1
  55. package/es/components/Modal/Modal.tokens.js +1 -7
  56. package/es/components/Modal/Modal.tokens.js.map +1 -1
  57. package/es/components/Switch/Switch.css +2 -2
  58. package/es/components/Switch/Switch.tokens.js +7 -1
  59. package/es/components/Switch/Switch.tokens.js.map +1 -1
  60. package/es/components/Switch/_toggleSize/base.js +1 -1
  61. package/es/components/Switch/_toggleSize/base.js.map +1 -1
  62. package/es/components/Switch/_toggleSize/base_38anc0.css +1 -0
  63. package/es/components/Switch/_view/base.js +1 -1
  64. package/es/components/Switch/_view/base.js.map +1 -1
  65. package/es/components/Switch/_view/base_15atbyp.css +1 -0
  66. package/es/index.css +2 -6
  67. package/package.json +2 -2
  68. package/styled-components/cjs/components/Modal/Modal.js +12 -26
  69. package/styled-components/cjs/components/Modal/Modal.template-doc.mdx +0 -47
  70. package/styled-components/cjs/components/Modal/Modal.tokens.js +1 -7
  71. package/styled-components/cjs/components/Switch/Switch.tokens.js +7 -1
  72. package/styled-components/cjs/components/Switch/_toggleSize/base.js +1 -1
  73. package/styled-components/cjs/components/Switch/_view/base.js +1 -1
  74. package/styled-components/cjs/examples/plasma_b2c/components/Modal/Modal.config.js +1 -1
  75. package/styled-components/cjs/examples/plasma_b2c/components/Modal/Modal.stories.tsx +1 -90
  76. package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.config.js +1 -1
  77. package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.js +5 -2
  78. package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.outline.config.js +37 -0
  79. package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.stories.tsx +33 -1
  80. package/styled-components/cjs/examples/plasma_web/components/Modal/Modal.config.js +1 -1
  81. package/styled-components/cjs/examples/plasma_web/components/Modal/Modal.stories.tsx +1 -90
  82. package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.config.js +1 -1
  83. package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.js +5 -2
  84. package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.outline.config.js +37 -0
  85. package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.stories.tsx +33 -1
  86. package/styled-components/es/components/Modal/Modal.js +12 -26
  87. package/styled-components/es/components/Modal/Modal.template-doc.mdx +0 -47
  88. package/styled-components/es/components/Modal/Modal.tokens.js +1 -7
  89. package/styled-components/es/components/Switch/Switch.tokens.js +7 -1
  90. package/styled-components/es/components/Switch/_toggleSize/base.js +1 -1
  91. package/styled-components/es/components/Switch/_view/base.js +1 -1
  92. package/styled-components/es/examples/plasma_b2c/components/Modal/Modal.config.js +1 -1
  93. package/styled-components/es/examples/plasma_b2c/components/Modal/Modal.stories.tsx +1 -90
  94. package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.config.js +1 -1
  95. package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.js +4 -1
  96. package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.outline.config.js +31 -0
  97. package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.stories.tsx +33 -1
  98. package/styled-components/es/examples/plasma_web/components/Modal/Modal.config.js +1 -1
  99. package/styled-components/es/examples/plasma_web/components/Modal/Modal.stories.tsx +1 -90
  100. package/styled-components/es/examples/plasma_web/components/Switch/Switch.config.js +1 -1
  101. package/styled-components/es/examples/plasma_web/components/Switch/Switch.js +4 -1
  102. package/styled-components/es/examples/plasma_web/components/Switch/Switch.outline.config.js +31 -0
  103. package/styled-components/es/examples/plasma_web/components/Switch/Switch.stories.tsx +33 -1
  104. package/types/components/Modal/Modal.d.ts.map +1 -1
  105. package/types/components/Modal/Modal.tokens.d.ts +0 -6
  106. package/types/components/Modal/Modal.tokens.d.ts.map +1 -1
  107. package/types/components/Modal/Modal.types.d.ts +1 -21
  108. package/types/components/Modal/Modal.types.d.ts.map +1 -1
  109. package/types/components/Modal/index.d.ts +1 -1
  110. package/types/components/Modal/index.d.ts.map +1 -1
  111. package/types/components/Switch/Switch.tokens.d.ts +7 -1
  112. package/types/components/Switch/Switch.tokens.d.ts.map +1 -1
  113. package/types/components/Switch/_toggleSize/base.d.ts.map +1 -1
  114. package/types/components/Switch/_view/base.d.ts.map +1 -1
  115. package/types/examples/plasma_b2c/components/Modal/Modal.config.d.ts.map +1 -1
  116. package/types/examples/plasma_b2c/components/Modal/Modal.d.ts +1 -7
  117. package/types/examples/plasma_b2c/components/Modal/Modal.d.ts.map +1 -1
  118. package/types/examples/plasma_b2c/components/Switch/Switch.config.d.ts.map +1 -1
  119. package/types/examples/plasma_b2c/components/Switch/Switch.d.ts +20 -0
  120. package/types/examples/plasma_b2c/components/Switch/Switch.d.ts.map +1 -1
  121. package/types/examples/plasma_b2c/components/Switch/Switch.outline.config.d.ts +30 -0
  122. package/types/examples/plasma_b2c/components/Switch/Switch.outline.config.d.ts.map +1 -0
  123. package/types/examples/plasma_web/components/Modal/Modal.config.d.ts.map +1 -1
  124. package/types/examples/plasma_web/components/Modal/Modal.d.ts +1 -7
  125. package/types/examples/plasma_web/components/Modal/Modal.d.ts.map +1 -1
  126. package/types/examples/plasma_web/components/Switch/Switch.config.d.ts.map +1 -1
  127. package/types/examples/plasma_web/components/Switch/Switch.d.ts +20 -0
  128. package/types/examples/plasma_web/components/Switch/Switch.d.ts.map +1 -1
  129. package/types/examples/plasma_web/components/Switch/Switch.outline.config.d.ts +30 -0
  130. package/types/examples/plasma_web/components/Switch/Switch.outline.config.d.ts.map +1 -0
  131. package/cjs/components/Modal/Modal.styles.js +0 -27
  132. package/cjs/components/Modal/Modal.styles.js.map +0 -1
  133. package/cjs/components/Modal/Modal.styles_tqsxxy.css +0 -3
  134. package/cjs/components/Switch/_toggleSize/base_6i0904.css +0 -1
  135. package/cjs/components/Switch/_view/base_yxkf3s.css +0 -1
  136. package/emotion/cjs/components/Modal/Modal.styles.js +0 -27
  137. package/emotion/es/components/Modal/Modal.styles.js +0 -20
  138. package/es/components/Modal/Modal.styles.js +0 -21
  139. package/es/components/Modal/Modal.styles.js.map +0 -1
  140. package/es/components/Modal/Modal.styles_tqsxxy.css +0 -3
  141. package/es/components/Switch/_toggleSize/base_6i0904.css +0 -1
  142. package/es/components/Switch/_view/base_yxkf3s.css +0 -1
  143. package/styled-components/cjs/components/Modal/Modal.styles.js +0 -24
  144. package/styled-components/es/components/Modal/Modal.styles.js +0 -17
  145. package/types/components/Modal/Modal.styles.d.ts +0 -5
  146. package/types/components/Modal/Modal.styles.d.ts.map +0 -1
@@ -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
+ };
@@ -1,5 +1,4 @@
1
- var _IconClose;
2
- var _excluded = ["id", "withAnimation", "onClose", "onOverlayClick", "onEscKeyDown", "closeOnEsc", "closeOnOverlayClick", "withBlur", "initialFocusRef", "focusAfterRef", "zIndex", "popupInfo", "children", "view", "opened", "isOpen", "hasBody", "hasClose"];
1
+ var _excluded = ["id", "withAnimation", "onClose", "onOverlayClick", "onEscKeyDown", "closeOnEsc", "closeOnOverlayClick", "withBlur", "initialFocusRef", "focusAfterRef", "zIndex", "popupInfo", "children", "view", "opened", "isOpen"];
3
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
5
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -10,12 +9,10 @@ import { popupConfig, usePopupContext } from '../Popup';
10
9
  import { Overlay } from '../Overlay';
11
10
  import { DEFAULT_Z_INDEX } from '../Popup/utils';
12
11
  import { useFocusTrap } from '../../hooks';
13
- import { IconClose } from '../_Icon/Icons/IconClose';
14
12
  import { classes, tokens } from './Modal.tokens';
15
13
  import { useModal } from './hooks';
16
14
  import { base as viewCSS } from './variations/_view/base';
17
15
  import { getIdLastModal } from './ModalContext';
18
- import { CloseButton, ModalBody, ModalContent } from './Modal.styles';
19
16
 
20
17
  // issue #823
21
18
  var Popup = /*#__PURE__*/component(popupConfig);
@@ -44,11 +41,8 @@ export var modalRoot = function modalRoot(Root) {
44
41
  view = _ref.view,
45
42
  opened = _ref.opened,
46
43
  isOpen = _ref.isOpen,
47
- hasBody = _ref.hasBody,
48
- hasClose = _ref.hasClose,
49
44
  rest = _objectWithoutProperties(_ref, _excluded);
50
45
  var innerIsOpen = Boolean(isOpen || opened);
51
- var innerHasClose = hasClose === undefined && hasBody || hasClose;
52
46
  var trapRef = useFocusTrap(true, initialFocusRef, focusAfterRef, true);
53
47
  var popupController = usePopupContext();
54
48
  var innerRef = useForkRef(trapRef, outerRootRef);
@@ -76,15 +70,6 @@ export var modalRoot = function modalRoot(Root) {
76
70
  onClose();
77
71
  }
78
72
  }, [closeOnOverlayClick, onOverlayClick, onClose]);
79
- var overlayNode = /*#__PURE__*/React.createElement(Overlay, {
80
- className: classes.overlay,
81
- zIndex: zIndex || DEFAULT_Z_INDEX,
82
- backgroundColorProperty: overlayBackgroundToken,
83
- withBlur: withBlur,
84
- transparent: transparent,
85
- isClickable: closeOnOverlayClick,
86
- onOverlayClick: onModalOverlayKeyDown
87
- });
88
73
  return /*#__PURE__*/React.createElement(Popup, _extends({
89
74
  id: innerId,
90
75
  opened: innerIsOpen,
@@ -92,17 +77,18 @@ export var modalRoot = function modalRoot(Root) {
92
77
  popupInfo: modalInfo,
93
78
  withAnimation: withAnimation,
94
79
  zIndex: zIndex,
95
- overlay: hasBody ? overlayNode : /*#__PURE__*/React.createElement(Root, {
80
+ overlay: /*#__PURE__*/React.createElement(Root, {
96
81
  view: view
97
- }, overlayNode)
98
- }, rest), hasBody ? /*#__PURE__*/React.createElement(Root, {
99
- view: view
100
- }, /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement(ModalContent, null, innerHasClose && /*#__PURE__*/React.createElement(CloseButton, {
101
- onClick: onClose,
102
- "data-test": "modal-close"
103
- }, _IconClose || (_IconClose = /*#__PURE__*/React.createElement(IconClose, {
104
- size: "s"
105
- }))), children))) : /*#__PURE__*/React.createElement(React.Fragment, null, children));
82
+ }, /*#__PURE__*/React.createElement(Overlay, {
83
+ className: classes.overlay,
84
+ zIndex: zIndex || DEFAULT_Z_INDEX,
85
+ backgroundColorProperty: overlayBackgroundToken,
86
+ withBlur: withBlur,
87
+ transparent: transparent,
88
+ isClickable: closeOnOverlayClick,
89
+ onOverlayClick: onModalOverlayKeyDown
90
+ }))
91
+ }, rest), children);
106
92
  });
107
93
  };
108
94
  export var 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` из пакета.
@@ -6,11 +6,5 @@ export var classes = {
6
6
  };
7
7
  export var tokens = {
8
8
  modalOverlayWithBlurColor: '--plasma-modal-overlay-with-blur-color',
9
- modalOverlayColor: '--plasma-modal-overlay-color',
10
- modalBodyBackground: '--plasma-modal-body-background',
11
- modalBodyBorderRadius: '--plasma-modal-body-border-radius',
12
- modalBodyPadding: '--plasma-modal-body-padding',
13
- modalContentPadding: '--plasma-modal-content-padding',
14
- modalOutlineFocusColor: '--plasma-modal-outline-focus-color',
15
- modalCloseButtonRadius: '--plasma-modal-close-button-radius'
9
+ modalOverlayColor: '--plasma-modal-overlay-color'
16
10
  };
@@ -23,6 +23,11 @@ export var tokens = {
23
23
  verticalGap: '--plasma-switch-vertical-gap',
24
24
  trackWidth: '--plasma-switch__track-width',
25
25
  trackHeight: '--plasma-switch__track-height',
26
+ trackBorderWidth: '--plasma-switch__track-border',
27
+ trackBorderColorOn: '--plasma-switch__track-checked_true-border-color',
28
+ trackBorderColorOnHover: '--plasma-switch__track-checked_true_hovered_true-border-color',
29
+ trackBorderColorOff: '--plasma-switch__track-checked_false-border-color',
30
+ trackBorderColorOffHover: '--plasma-switch__track-checked_false_hovered_true-border-color',
26
31
  trackBorderRadius: '--plasma-switch__track-border-radius',
27
32
  // NOTE: could be intersection with checked
28
33
  trackBackgroundColorOn: '--plasma-switch__track_checked_true-bg-color',
@@ -34,7 +39,8 @@ export var tokens = {
34
39
  thumbOffset: '--plasma-switch__thumb-offset',
35
40
  thumbBorderRadius: '--plasma-switch__thumb-border-radius',
36
41
  thumbPressScale: '--plasma-switch__thumb-scale',
37
- thumbBackgroundColor: '--plasma-switch__thumb-bg-color',
42
+ thumbBackgroundColorOn: '--plasma-switch__thumb_checked_true-bg-color',
43
+ thumbBackgroundColorOff: '--plasma-switch__thumb-checked_false-bg-color',
38
44
  thumbBoxShadow: '--plasma-switch__thumb-box-shadow',
39
45
  thumbBoxShadowOn: '--plasma-switch__thumb-box-shadow_checked_true',
40
46
  labelOffsetPrivate: '--plasma_private-switch__label-offset'
@@ -1,4 +1,4 @@
1
1
  import { css } from 'styled-components';
2
2
  import { tokens } from '../Switch.tokens';
3
3
  import { StyledTrigger } from '../Switch.styles';
4
- export var base = /*#__PURE__*/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));}"], StyledTrigger, tokens.trackWidth, tokens.trackWidth, tokens.trackHeight, tokens.trackBorderRadius, tokens.thumbSize, tokens.thumbSize, tokens.thumbBorderRadius, tokens.thumbOffset, StyledTrigger, tokens.thumbSize, tokens.thumbPressScale);
4
+ export var base = /*#__PURE__*/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));}"], StyledTrigger, tokens.thumbSize, tokens.trackBorderWidth, tokens.trackWidth, tokens.trackBorderWidth, tokens.trackBorderRadius, tokens.trackWidth, tokens.trackHeight, tokens.thumbBorderRadius, tokens.thumbOffset, StyledTrigger, tokens.thumbSize, tokens.thumbPressScale);
@@ -1,4 +1,4 @@
1
1
  import { css } from 'styled-components';
2
2
  import { tokens } from '../Switch.tokens';
3
3
  import { StyledTrigger, StyledInput, StyledLabel, StyledDescription } from '../Switch.styles';
4
- export var base = /*#__PURE__*/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(", ");}"], StyledTrigger, tokens.trackBackgroundColorOff, StyledInput, StyledTrigger, tokens.trackBackgroundColorOffHover, tokens.trackBackgroundColorOff, StyledInput, StyledTrigger, tokens.trackBackgroundColorOn, StyledInput, StyledTrigger, tokens.trackBackgroundColorOnHover, tokens.trackBackgroundColorOn, StyledTrigger, tokens.thumbBackgroundColor, tokens.thumbBoxShadow, StyledInput, StyledTrigger, tokens.thumbBoxShadowOn, tokens.thumbBoxShadow, StyledLabel, tokens.labelColor, StyledDescription, tokens.descriptionColor);
4
+ export var base = /*#__PURE__*/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(", ");}"], StyledTrigger, tokens.trackBackgroundColorOff, tokens.trackBorderColorOff, StyledInput, StyledTrigger, tokens.trackBackgroundColorOffHover, tokens.trackBackgroundColorOff, tokens.trackBorderColorOffHover, tokens.trackBorderColorOff, StyledInput, StyledTrigger, tokens.trackBackgroundColorOn, tokens.trackBorderColorOn, StyledInput, StyledTrigger, tokens.trackBackgroundColorOnHover, tokens.trackBackgroundColorOn, tokens.trackBorderColorOnHover, tokens.trackBorderColorOn, StyledTrigger, tokens.thumbBackgroundColorOff, tokens.thumbBoxShadow, StyledInput, StyledTrigger, tokens.thumbBackgroundColorOn, tokens.thumbBoxShadowOn, tokens.thumbBoxShadow, StyledLabel, tokens.labelColor, StyledDescription, tokens.descriptionColor);
@@ -6,7 +6,7 @@ export var config = {
6
6
  },
7
7
  variations: {
8
8
  view: {
9
- "default": /*#__PURE__*/css(["", ":var(--overlay-blur);", ":var(--overlay-soft);", ":var(--surface-solid-card);", ":1.25rem;", ":2rem;", ":0.625rem;", ":0.375rem;", ":var(--surface-accent);"], modalTokens.modalOverlayWithBlurColor, modalTokens.modalOverlayColor, modalTokens.modalBodyBackground, modalTokens.modalBodyBorderRadius, modalTokens.modalBodyPadding, modalTokens.modalContentPadding, modalTokens.modalCloseButtonRadius, modalTokens.modalOutlineFocusColor)
9
+ "default": /*#__PURE__*/css(["", ":var(--overlay-blur);", ":var(--overlay-soft);"], modalTokens.modalOverlayWithBlurColor, modalTokens.modalOverlayColor)
10
10
  }
11
11
  }
12
12
  };
@@ -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 Default: StoryObj<StoryModalProps> = {
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} {
@@ -19,7 +19,7 @@ export var config = {
19
19
  s: /*#__PURE__*/css(["", ":2rem;", ":1.25rem;", ":calc(var(", ") / 2);", ":1rem;", ":calc(var(", ") / 2);", ":0.125rem;", ":1.25;"], switchTokens.trackWidth, switchTokens.trackHeight, switchTokens.trackBorderRadius, switchTokens.trackHeight, switchTokens.thumbSize, switchTokens.thumbBorderRadius, switchTokens.thumbSize, switchTokens.thumbOffset, switchTokens.thumbPressScale)
20
20
  },
21
21
  view: {
22
- "default": /*#__PURE__*/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);"], switchTokens.labelColor, switchTokens.descriptionColor, switchTokens.trackBackgroundColorOn, switchTokens.trackBackgroundColorOnHover, switchTokens.trackBackgroundColorOff, switchTokens.trackBackgroundColorOffHover, switchTokens.thumbBackgroundColor, switchTokens.thumbBoxShadow)
22
+ "default": /*#__PURE__*/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);"], switchTokens.labelColor, switchTokens.descriptionColor, switchTokens.trackBackgroundColorOn, switchTokens.trackBackgroundColorOnHover, switchTokens.trackBackgroundColorOff, switchTokens.trackBackgroundColorOffHover, switchTokens.trackBorderWidth, switchTokens.trackBorderColorOff, switchTokens.trackBorderColorOffHover, switchTokens.trackBorderColorOn, switchTokens.trackBorderColorOnHover, switchTokens.thumbBackgroundColorOff, switchTokens.thumbBackgroundColorOn, switchTokens.thumbBoxShadow)
23
23
  },
24
24
  disabled: {
25
25
  "true": /*#__PURE__*/css(["", ":0.4;"], switchTokens.disabledOpacity)
@@ -1,5 +1,8 @@
1
1
  import { switchConfig } from '../../../../components/Switch';
2
2
  import { component, mergeConfig } from '../../../../engines';
3
3
  import { config } from './Switch.config';
4
+ import { config as outlineConfig } from './Switch.outline.config';
4
5
  var mergedConfig = /*#__PURE__*/mergeConfig(switchConfig, config);
5
- export var Switch = /*#__PURE__*/component(mergedConfig);
6
+ export var Switch = /*#__PURE__*/component(mergedConfig);
7
+ var mergedOutlineConfig = /*#__PURE__*/mergeConfig(switchConfig, outlineConfig);
8
+ export var SwitchOutline = /*#__PURE__*/component(mergedOutlineConfig);
@@ -0,0 +1,31 @@
1
+ import { css } from 'styled-components';
2
+ import { switchTokens } from '../../../../components/Switch';
3
+ export var config = {
4
+ defaults: {
5
+ view: 'default',
6
+ size: 'm',
7
+ toggleSize: 'l',
8
+ labelPosition: 'before',
9
+ focused: 'true'
10
+ },
11
+ variations: {
12
+ size: {
13
+ s: /*#__PURE__*/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;"], switchTokens.fontFamily, switchTokens.fontStyle, switchTokens.fontWeight, switchTokens.lineHeight, switchTokens.fontSize, switchTokens.letterSpacing, switchTokens.descriptionFontFamily, switchTokens.descriptionFontStyle, switchTokens.descriptionFontWeight, switchTokens.descriptionLineHeight, switchTokens.descriptionFontSize, switchTokens.descriptionLetterSpacing, switchTokens.verticalGap, switchTokens.labelOffset),
14
+ m: /*#__PURE__*/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;"], switchTokens.fontFamily, switchTokens.fontStyle, switchTokens.fontWeight, switchTokens.lineHeight, switchTokens.fontSize, switchTokens.letterSpacing, switchTokens.descriptionFontFamily, switchTokens.descriptionFontStyle, switchTokens.descriptionFontWeight, switchTokens.descriptionLineHeight, switchTokens.descriptionFontSize, switchTokens.descriptionLetterSpacing, switchTokens.verticalGap, switchTokens.labelOffset),
15
+ l: /*#__PURE__*/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;"], switchTokens.fontFamily, switchTokens.fontStyle, switchTokens.fontWeight, switchTokens.lineHeight, switchTokens.fontSize, switchTokens.letterSpacing, switchTokens.descriptionFontFamily, switchTokens.descriptionFontStyle, switchTokens.descriptionFontWeight, switchTokens.descriptionLineHeight, switchTokens.descriptionFontSize, switchTokens.descriptionLetterSpacing, switchTokens.verticalGap, switchTokens.labelOffset)
16
+ },
17
+ toggleSize: {
18
+ l: /*#__PURE__*/css(["", ":2.75rem;", ":1.75rem;", ":calc(var(", ") / 2);", ":1.5rem;", ":calc(var(", ") / 2);", ":0.125rem;", ":1.25;"], switchTokens.trackWidth, switchTokens.trackHeight, switchTokens.trackBorderRadius, switchTokens.trackHeight, switchTokens.thumbSize, switchTokens.thumbBorderRadius, switchTokens.thumbSize, switchTokens.thumbOffset, switchTokens.thumbPressScale),
19
+ s: /*#__PURE__*/css(["", ":2rem;", ":1.25rem;", ":calc(var(", ") / 2);", ":1rem;", ":calc(var(", ") / 2);", ":0.125rem;", ":1.25;"], switchTokens.trackWidth, switchTokens.trackHeight, switchTokens.trackBorderRadius, switchTokens.trackHeight, switchTokens.thumbSize, switchTokens.thumbBorderRadius, switchTokens.thumbSize, switchTokens.thumbOffset, switchTokens.thumbPressScale)
20
+ },
21
+ view: {
22
+ "default": /*#__PURE__*/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);"], switchTokens.labelColor, switchTokens.descriptionColor, switchTokens.trackBackgroundColorOn, switchTokens.trackBackgroundColorOnHover, switchTokens.trackBackgroundColorOff, switchTokens.trackBackgroundColorOffHover, switchTokens.trackBorderWidth, switchTokens.trackBorderColorOff, switchTokens.trackBorderColorOffHover, switchTokens.trackBorderColorOn, switchTokens.trackBorderColorOnHover, switchTokens.thumbBackgroundColorOff, switchTokens.thumbBackgroundColorOn, switchTokens.thumbBoxShadow)
23
+ },
24
+ disabled: {
25
+ "true": /*#__PURE__*/css(["", ":0.4;"], switchTokens.disabledOpacity)
26
+ },
27
+ focused: {
28
+ "true": /*#__PURE__*/css(["", ":var(--surface-accent);"], switchTokens.trackFocusColor)
29
+ }
30
+ }
31
+ };
@@ -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
+ };
@@ -6,7 +6,7 @@ export var config = {
6
6
  },
7
7
  variations: {
8
8
  view: {
9
- "default": /*#__PURE__*/css(["", ":var(--overlay-blur);", ":var(--overlay-soft);", ":var(--surface-solid-card);", ":1.25rem;", ":2rem;", ":0.625rem;", ":0.375rem;", ":var(--surface-accent);"], modalTokens.modalOverlayWithBlurColor, modalTokens.modalOverlayColor, modalTokens.modalBodyBackground, modalTokens.modalBodyBorderRadius, modalTokens.modalBodyPadding, modalTokens.modalContentPadding, modalTokens.modalCloseButtonRadius, modalTokens.modalOutlineFocusColor)
9
+ "default": /*#__PURE__*/css(["", ":var(--overlay-blur);", ":var(--overlay-soft);"], modalTokens.modalOverlayWithBlurColor, modalTokens.modalOverlayColor)
10
10
  }
11
11
  }
12
12
  };