@salutejs/plasma-core 1.226.1-next-sbcom.0 → 1.227.0-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/__helpers/IconPlaceholder.js +6 -9
  2. package/__helpers/index.js +1 -1
  3. package/collectPackageInfo.js +4 -4
  4. package/components/Badge/Badge.js +30 -103
  5. package/components/Badge/index.js +1 -1
  6. package/components/Basebox/Basebox.js +33 -42
  7. package/components/Basebox/index.js +1 -1
  8. package/components/Button/Button.js +28 -67
  9. package/components/Button/Button.mixins.js +22 -76
  10. package/components/Button/Button.props.js +5 -5
  11. package/components/Button/createButton.js +14 -145
  12. package/components/Button/index.js +4 -4
  13. package/components/Card/Card.js +34 -162
  14. package/components/Card/CardBody.js +4 -4
  15. package/components/Card/CardContent.js +14 -23
  16. package/components/Card/CardMedia.js +20 -91
  17. package/components/Card/CardPrice.js +18 -60
  18. package/components/Card/CardTypography.js +43 -52
  19. package/components/Card/index.js +5 -5
  20. package/components/Carousel/Carousel.js +46 -64
  21. package/components/Carousel/CarouselItem.js +21 -93
  22. package/components/Carousel/hooks.js +62 -121
  23. package/components/Carousel/index.js +3 -3
  24. package/components/Carousel/utils.js +59 -73
  25. package/components/Fade/Fade.js +6 -9
  26. package/components/Fade/index.js +1 -1
  27. package/components/Field/Field.js +48 -63
  28. package/components/Field/Field.statuses.js +3 -3
  29. package/components/Field/index.js +2 -2
  30. package/components/Image/Image.js +34 -115
  31. package/components/Image/index.js +1 -1
  32. package/components/Input/Input.js +7 -7
  33. package/components/Input/Input.mixins.js +9 -12
  34. package/components/Input/index.js +1 -1
  35. package/components/ModalBase/ModalBase.js +22 -100
  36. package/components/ModalBase/ModalBaseContext.js +6 -9
  37. package/components/ModalBase/ModalOverlay.js +28 -111
  38. package/components/ModalBase/hooks.js +15 -43
  39. package/components/ModalBase/index.js +2 -2
  40. package/components/PaginationDots/PaginationDot.js +11 -17
  41. package/components/PaginationDots/PaginationDots.js +4 -7
  42. package/components/PaginationDots/index.js +3 -3
  43. package/components/PaginationDots/usePaginationDots.js +10 -11
  44. package/components/Popup/Popup.js +52 -205
  45. package/components/Popup/index.js +1 -1
  46. package/components/PopupBase/PopupBase.js +35 -169
  47. package/components/PopupBase/PopupBaseContext.js +26 -86
  48. package/components/PopupBase/PopupBaseRoot.js +31 -169
  49. package/components/PopupBase/hooks.js +23 -97
  50. package/components/PopupBase/index.js +3 -3
  51. package/components/PopupBase/utils.js +32 -78
  52. package/components/Price/Price.js +15 -90
  53. package/components/Price/index.js +1 -1
  54. package/components/RadioGroup/RadioGroup.js +6 -127
  55. package/components/RadioGroup/index.js +1 -1
  56. package/components/SSRProvider/SSRProvider.js +4 -5
  57. package/components/SSRProvider/index.js +1 -1
  58. package/components/Skeleton/LineSkeleton.js +23 -95
  59. package/components/Skeleton/RectSkeleton.js +20 -93
  60. package/components/Skeleton/Skeleton.js +2 -2
  61. package/components/Skeleton/TextSkeleton.js +11 -55
  62. package/components/Skeleton/index.js +3 -3
  63. package/components/Slider/Double.js +52 -203
  64. package/components/Slider/Handle.js +28 -158
  65. package/components/Slider/Single.js +29 -177
  66. package/components/Slider/Slider.js +5 -7
  67. package/components/Slider/SliderBase.js +39 -48
  68. package/components/Slider/ThumbBase.js +19 -95
  69. package/components/Slider/index.js +3 -3
  70. package/components/Slider/utils.js +2 -2
  71. package/components/Spinner/Spinner.js +28 -100
  72. package/components/Spinner/SpinnerSvg.js +9 -78
  73. package/components/Spinner/index.js +1 -1
  74. package/components/Switch/Switch.js +49 -220
  75. package/components/Switch/index.js +1 -1
  76. package/components/Tabs/TabItem.js +33 -168
  77. package/components/Tabs/Tabs.js +32 -170
  78. package/components/Tabs/TabsContext.js +12 -42
  79. package/components/Tabs/createTabsController.js +33 -168
  80. package/components/Tabs/index.js +4 -4
  81. package/components/TextArea/TextArea.js +20 -30
  82. package/components/TextArea/index.js +1 -1
  83. package/components/TextField/index.js +3 -3
  84. package/components/Toast/Toast.js +15 -16
  85. package/components/Toast/ToastContext.js +4 -8
  86. package/components/Toast/ToastController.js +44 -101
  87. package/components/Toast/ToastProvider.js +37 -142
  88. package/components/Toast/index.js +3 -3
  89. package/components/Toast/useToast.js +6 -6
  90. package/components/Typography/Body.js +18 -18
  91. package/components/Typography/Button.js +13 -13
  92. package/components/Typography/Caption.js +8 -8
  93. package/components/Typography/Display.js +18 -18
  94. package/components/Typography/Footnote.js +13 -13
  95. package/components/Typography/Headline.js +43 -43
  96. package/components/Typography/Paragraph.js +24 -24
  97. package/components/Typography/Underline.js +8 -8
  98. package/es/__helpers/IconPlaceholder.js +5 -8
  99. package/es/collectPackageInfo.js +3 -3
  100. package/es/components/Badge/Badge.js +27 -100
  101. package/es/components/Basebox/Basebox.js +28 -37
  102. package/es/components/Button/Button.js +24 -63
  103. package/es/components/Button/Button.mixins.js +19 -73
  104. package/es/components/Button/Button.props.js +3 -3
  105. package/es/components/Button/createButton.js +12 -143
  106. package/es/components/Card/Card.js +29 -157
  107. package/es/components/Card/CardBody.js +2 -2
  108. package/es/components/Card/CardContent.js +12 -21
  109. package/es/components/Card/CardMedia.js +17 -88
  110. package/es/components/Card/CardPrice.js +13 -55
  111. package/es/components/Card/CardTypography.js +43 -52
  112. package/es/components/Carousel/Carousel.js +45 -63
  113. package/es/components/Carousel/CarouselItem.js +18 -90
  114. package/es/components/Carousel/hooks.js +58 -117
  115. package/es/components/Carousel/utils.js +58 -72
  116. package/es/components/Fade/Fade.js +5 -8
  117. package/es/components/Field/Field.js +44 -59
  118. package/es/components/Field/Field.statuses.js +4 -4
  119. package/es/components/Image/Image.js +31 -112
  120. package/es/components/Input/Input.js +4 -4
  121. package/es/components/Input/Input.mixins.js +6 -9
  122. package/es/components/ModalBase/ModalBase.js +16 -94
  123. package/es/components/ModalBase/ModalBaseContext.js +6 -9
  124. package/es/components/ModalBase/ModalOverlay.js +23 -106
  125. package/es/components/ModalBase/hooks.js +12 -40
  126. package/es/components/PaginationDots/PaginationDot.js +9 -15
  127. package/es/components/PaginationDots/PaginationDots.js +3 -6
  128. package/es/components/PaginationDots/usePaginationDots.js +9 -10
  129. package/es/components/Popup/Popup.js +48 -201
  130. package/es/components/PopupBase/PopupBase.js +27 -161
  131. package/es/components/PopupBase/PopupBaseContext.js +25 -85
  132. package/es/components/PopupBase/PopupBaseRoot.js +26 -164
  133. package/es/components/PopupBase/hooks.js +21 -95
  134. package/es/components/PopupBase/utils.js +31 -77
  135. package/es/components/Price/Price.js +12 -87
  136. package/es/components/RadioGroup/RadioGroup.js +5 -126
  137. package/es/components/SSRProvider/SSRProvider.js +3 -4
  138. package/es/components/Skeleton/LineSkeleton.js +18 -90
  139. package/es/components/Skeleton/RectSkeleton.js +16 -89
  140. package/es/components/Skeleton/Skeleton.js +2 -2
  141. package/es/components/Skeleton/TextSkeleton.js +7 -51
  142. package/es/components/Slider/Double.js +49 -200
  143. package/es/components/Slider/Handle.js +23 -153
  144. package/es/components/Slider/Single.js +26 -174
  145. package/es/components/Slider/Slider.js +2 -4
  146. package/es/components/Slider/SliderBase.js +36 -45
  147. package/es/components/Slider/ThumbBase.js +16 -92
  148. package/es/components/Slider/index.js +1 -1
  149. package/es/components/Slider/utils.js +2 -2
  150. package/es/components/Spinner/Spinner.js +23 -95
  151. package/es/components/Spinner/SpinnerSvg.js +8 -77
  152. package/es/components/Switch/Switch.js +45 -216
  153. package/es/components/Tabs/TabItem.js +28 -163
  154. package/es/components/Tabs/Tabs.js +28 -166
  155. package/es/components/Tabs/TabsContext.js +11 -41
  156. package/es/components/Tabs/createTabsController.js +28 -163
  157. package/es/components/TextArea/TextArea.js +18 -28
  158. package/es/components/Toast/Toast.js +10 -11
  159. package/es/components/Toast/ToastContext.js +3 -7
  160. package/es/components/Toast/ToastController.js +38 -95
  161. package/es/components/Toast/ToastProvider.js +34 -139
  162. package/es/components/Toast/useToast.js +4 -4
  163. package/es/components/Typography/Body.js +15 -15
  164. package/es/components/Typography/Button.js +10 -10
  165. package/es/components/Typography/Caption.js +5 -5
  166. package/es/components/Typography/Display.js +15 -15
  167. package/es/components/Typography/Footnote.js +10 -10
  168. package/es/components/Typography/Headline.js +40 -40
  169. package/es/components/Typography/Paragraph.js +21 -21
  170. package/es/components/Typography/Underline.js +5 -5
  171. package/es/hocs/withAutoFocus.js +8 -78
  172. package/es/hocs/withSkeleton.js +5 -10
  173. package/es/hooks/useDebouncedFunction.js +4 -36
  174. package/es/hooks/useFocusTrap.js +18 -21
  175. package/es/hooks/useForkRef.js +3 -3
  176. package/es/hooks/useIsomorphicLayoutEffect.js +1 -1
  177. package/es/hooks/useResizeObserver.js +8 -8
  178. package/es/hooks/useUniqId.js +6 -52
  179. package/es/mixins/addFocus.js +17 -22
  180. package/es/mixins/applyDisabled.js +6 -9
  181. package/es/mixins/applyEllipsis.js +2 -4
  182. package/es/mixins/applyMaxLines.js +3 -6
  183. package/es/mixins/applyNoSelect.js +2 -4
  184. package/es/mixins/applyOutline.js +2 -4
  185. package/es/mixins/applyRoundness.js +4 -7
  186. package/es/mixins/applyScrollSnap.js +4 -7
  187. package/es/mixins/applySkeletonGradient.js +6 -9
  188. package/es/mixins/applyView.js +2 -5
  189. package/es/mixins/blur.js +2 -5
  190. package/es/mixins/shadows.js +1 -1
  191. package/es/tokens/colors.js +48 -48
  192. package/es/tokens/typography.js +18 -18
  193. package/es/utils/__tests__/formatters.test.js +2 -2
  194. package/es/utils/animatedScrollTo.js +24 -34
  195. package/es/utils/canUseDOM.js +1 -1
  196. package/es/utils/extractTextFrom.js +3 -7
  197. package/es/utils/focusManager.js +40 -47
  198. package/es/utils/formatCurrency.js +4 -4
  199. package/es/utils/formatters.js +6 -14
  200. package/es/utils/react.js +4 -4
  201. package/es/utils/roundness.js +2 -4
  202. package/es/utils/scopeTab.js +5 -5
  203. package/es/utils/setRef.js +1 -1
  204. package/es/utils/tabbable.js +16 -25
  205. package/es/utils/toCssSize.js +1 -3
  206. package/es/utils/transformStyles.js +5 -60
  207. package/hocs/index.js +2 -2
  208. package/hocs/withAutoFocus.js +9 -79
  209. package/hocs/withSkeleton.js +8 -13
  210. package/hooks/index.js +6 -6
  211. package/hooks/useDebouncedFunction.js +5 -37
  212. package/hooks/useFocusTrap.js +22 -25
  213. package/hooks/useForkRef.js +5 -5
  214. package/hooks/useIsomorphicLayoutEffect.js +3 -3
  215. package/hooks/useResizeObserver.js +9 -9
  216. package/hooks/useUniqId.js +8 -54
  217. package/mixins/addFocus.js +19 -24
  218. package/mixins/applyDisabled.js +7 -10
  219. package/mixins/applyEllipsis.js +3 -5
  220. package/mixins/applyMaxLines.js +4 -7
  221. package/mixins/applyNoSelect.js +3 -5
  222. package/mixins/applyOutline.js +3 -5
  223. package/mixins/applyRoundness.js +5 -8
  224. package/mixins/applyScrollSnap.js +5 -8
  225. package/mixins/applySkeletonGradient.js +8 -11
  226. package/mixins/applyView.js +3 -6
  227. package/mixins/blur.js +2 -5
  228. package/mixins/index.js +11 -11
  229. package/mixins/shadows.js +1 -1
  230. package/package.json +13 -18
  231. package/tokens/colors.js +48 -48
  232. package/tokens/typography.js +18 -18
  233. package/utils/__tests__/formatters.test.js +3 -3
  234. package/utils/animatedScrollTo.js +24 -34
  235. package/utils/canUseDOM.js +1 -1
  236. package/utils/extractTextFrom.js +4 -8
  237. package/utils/focusManager.js +41 -48
  238. package/utils/formatCurrency.js +4 -4
  239. package/utils/formatters.js +6 -14
  240. package/utils/index.js +10 -10
  241. package/utils/react.js +7 -7
  242. package/utils/roundness.js +2 -4
  243. package/utils/scopeTab.js +6 -6
  244. package/utils/setRef.js +1 -1
  245. package/utils/tabbable.js +16 -25
  246. package/utils/toCssSize.js +1 -3
  247. package/utils/transformStyles.js +5 -60
@@ -8,31 +8,10 @@ Object.defineProperty(exports, "Switch", {
8
8
  return Switch;
9
9
  }
10
10
  });
11
- var _react = /*#__PURE__*/ _interop_require_default(require("react"));
12
- var _styledcomponents = /*#__PURE__*/ _interop_require_wildcard(require("styled-components"));
13
- var _tokens = require("../../tokens");
14
- var _mixins = require("../../mixins");
15
- function _array_like_to_array(arr, len) {
16
- if (len == null || len > arr.length) len = arr.length;
17
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
18
- return arr2;
19
- }
20
- function _array_with_holes(arr) {
21
- if (Array.isArray(arr)) return arr;
22
- }
23
- function _define_property(obj, key, value) {
24
- if (key in obj) {
25
- Object.defineProperty(obj, key, {
26
- value: value,
27
- enumerable: true,
28
- configurable: true,
29
- writable: true
30
- });
31
- } else {
32
- obj[key] = value;
33
- }
34
- return obj;
35
- }
11
+ const _react = /*#__PURE__*/ _interop_require_default(require("react"));
12
+ const _styledcomponents = /*#__PURE__*/ _interop_require_wildcard(require("styled-components"));
13
+ const _tokens = require("../../tokens");
14
+ const _mixins = require("../../mixins");
36
15
  function _interop_require_default(obj) {
37
16
  return obj && obj.__esModule ? obj : {
38
17
  default: obj
@@ -79,220 +58,70 @@ function _interop_require_wildcard(obj, nodeInterop) {
79
58
  }
80
59
  return newObj;
81
60
  }
82
- function _iterable_to_array(iter) {
83
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
84
- }
85
- function _iterable_to_array_limit(arr, i) {
86
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
87
- if (_i == null) return;
88
- var _arr = [];
89
- var _n = true;
90
- var _d = false;
91
- var _s, _e;
92
- try {
93
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
94
- _arr.push(_s.value);
95
- if (i && _arr.length === i) break;
96
- }
97
- } catch (err) {
98
- _d = true;
99
- _e = err;
100
- } finally{
101
- try {
102
- if (!_n && _i["return"] != null) _i["return"]();
103
- } finally{
104
- if (_d) throw _e;
105
- }
106
- }
107
- return _arr;
108
- }
109
- function _non_iterable_rest() {
110
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
111
- }
112
- function _object_spread(target) {
113
- for(var i = 1; i < arguments.length; i++){
114
- var source = arguments[i] != null ? arguments[i] : {};
115
- var ownKeys = Object.keys(source);
116
- if (typeof Object.getOwnPropertySymbols === "function") {
117
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
118
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
119
- }));
120
- }
121
- ownKeys.forEach(function(key) {
122
- _define_property(target, key, source[key]);
123
- });
124
- }
125
- return target;
126
- }
127
- function ownKeys(object, enumerableOnly) {
128
- var keys = Object.keys(object);
129
- if (Object.getOwnPropertySymbols) {
130
- var symbols = Object.getOwnPropertySymbols(object);
131
- if (enumerableOnly) {
132
- symbols = symbols.filter(function(sym) {
133
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
134
- });
135
- }
136
- keys.push.apply(keys, symbols);
137
- }
138
- return keys;
139
- }
140
- function _object_spread_props(target, source) {
141
- source = source != null ? source : {};
142
- if (Object.getOwnPropertyDescriptors) {
143
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
144
- } else {
145
- ownKeys(Object(source)).forEach(function(key) {
146
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
147
- });
148
- }
149
- return target;
150
- }
151
- function _object_without_properties(source, excluded) {
152
- if (source == null) return {};
153
- var target = {}, sourceKeys, key, i;
154
- if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
155
- sourceKeys = Reflect.ownKeys(source);
156
- for(i = 0; i < sourceKeys.length; i++){
157
- key = sourceKeys[i];
158
- if (excluded.indexOf(key) >= 0) continue;
159
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
160
- target[key] = source[key];
161
- }
162
- return target;
163
- }
164
- target = _object_without_properties_loose(source, excluded);
165
- if (Object.getOwnPropertySymbols) {
166
- sourceKeys = Object.getOwnPropertySymbols(source);
167
- for(i = 0; i < sourceKeys.length; i++){
168
- key = sourceKeys[i];
169
- if (excluded.indexOf(key) >= 0) continue;
170
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
171
- target[key] = source[key];
172
- }
173
- }
174
- return target;
175
- }
176
- function _object_without_properties_loose(source, excluded) {
177
- if (source == null) return {};
178
- var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
179
- for(i = 0; i < sourceKeys.length; i++){
180
- key = sourceKeys[i];
181
- if (excluded.indexOf(key) >= 0) continue;
182
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
183
- target[key] = source[key];
184
- }
185
- return target;
186
- }
187
- function _sliced_to_array(arr, i) {
188
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
189
- }
190
- function _to_array(arr) {
191
- return _array_with_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_rest();
192
- }
193
- function _unsupported_iterable_to_array(o, minLen) {
194
- if (!o) return;
195
- if (typeof o === "string") return _array_like_to_array(o, minLen);
196
- var n = Object.prototype.toString.call(o).slice(8, -1);
197
- if (n === "Object" && o.constructor) n = o.constructor.name;
198
- if (n === "Map" || n === "Set") return Array.from(n);
199
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
200
- }
201
- var triggerWidth = 'var(--plasma-switch-trigger-width, 2.75rem)';
202
- var triggerHeight = 'var(--plasma-switch-trigger-height, 1.75rem)';
203
- var StyledRoot = _styledcomponents.default.label.withConfig({
61
+ const triggerWidth = 'var(--plasma-switch-trigger-width, 2.75rem)';
62
+ const triggerHeight = 'var(--plasma-switch-trigger-height, 1.75rem)';
63
+ const StyledRoot = _styledcomponents.default.label.withConfig({
204
64
  displayName: "Switch__StyledRoot",
205
65
  componentId: "sc-a32af9d8-0"
206
66
  })([
207
- "position:relative;display:flex;align-items:center;justify-content:space-between;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0);&:focus{outline:0 none;}",
208
- ""
67
+ `position:relative;display:flex;align-items:center;justify-content:space-between;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0);&:focus{outline:0 none;}`,
68
+ ``
209
69
  ], _mixins.applyDisabled);
210
- var StyledInput = _styledcomponents.default.input.withConfig({
70
+ const StyledInput = _styledcomponents.default.input.withConfig({
211
71
  displayName: "Switch__StyledInput",
212
72
  componentId: "sc-a32af9d8-1"
213
73
  })([
214
- "position:absolute;right:0;margin:0;opacity:0;width:",
215
- ";height:",
216
- ";&:focus{outline:0 none;}"
74
+ `position:absolute;right:0;margin:0;opacity:0;width:`,
75
+ `;height:`,
76
+ `;&:focus{outline:0 none;}`
217
77
  ], triggerWidth, triggerHeight);
218
- var synthesizeFocus = function synthesizeFocus(ruleset, focused) {
219
- return (0, _styledcomponents.css)([
220
- ".focus-visible:focus > &,",
221
- ".focus-visible:focus ~ &{",
222
- ";}",
223
- ";"
78
+ const synthesizeFocus = (ruleset, focused)=>(0, _styledcomponents.css)([
79
+ `.focus-visible:focus > &,`,
80
+ `.focus-visible:focus ~ &{`,
81
+ `;}`,
82
+ `;`
224
83
  ], StyledInput, ruleset, focused && ruleset);
225
- };
226
- var StyledTrigger = _styledcomponents.default.div.withConfig({
84
+ const StyledTrigger = _styledcomponents.default.div.withConfig({
227
85
  displayName: "Switch__StyledTrigger",
228
86
  componentId: "sc-a32af9d8-2"
229
87
  })([
230
- "position:relative;display:flex;flex:0 0 ",
231
- ";width:",
232
- ";height:",
233
- ";margin-left:auto;border-radius:0.875rem;background-color:var(--plasma-switch-trigger-background);transition:",
234
- ";&::after{content:'';display:block;position:absolute;top:0;left:0;bottom:0;margin:auto 0.125rem;width:1.5rem;height:1.5rem;border-radius:1.5rem;background-color:var(--plasma-switch-ellipse-background);box-shadow:",
235
- ";transition:",
236
- ";}",
237
- " ",
238
- ":checked ~ &{background-color:var(--plasma-switch-trigger-background-checked);&::after{left:auto;right:0;}}",
239
- ""
240
- ], triggerWidth, triggerWidth, triggerHeight, function(param) {
241
- var theme = param.theme;
242
- return theme.lowPerformance ? 'unset' : 'background-color 0.15s ease-in-out 0.1s';
243
- }, _mixins.shadows.tiny, function(param) {
244
- var theme = param.theme;
245
- return theme.lowPerformance ? 'unset' : 'width 0.15s ease-in-out, left 0.3s ease-in-out, right 0.3s ease-in-out';
246
- }, function(param) {
247
- var $disabled = param.$disabled, pressed = param.pressed;
248
- return !$disabled && (0, _styledcomponents.css)([
249
- "",
250
- ":active &::after{width:1.875rem;}",
251
- ""
88
+ `position:relative;display:flex;flex:0 0 `,
89
+ `;width:`,
90
+ `;height:`,
91
+ `;margin-left:auto;border-radius:0.875rem;background-color:var(--plasma-switch-trigger-background);transition:`,
92
+ `;&::after{content:'';display:block;position:absolute;top:0;left:0;bottom:0;margin:auto 0.125rem;width:1.5rem;height:1.5rem;border-radius:1.5rem;background-color:var(--plasma-switch-ellipse-background);box-shadow:`,
93
+ `;transition:`,
94
+ `;}`,
95
+ ` `,
96
+ `:checked ~ &{background-color:var(--plasma-switch-trigger-background-checked);&::after{left:auto;right:0;}}`,
97
+ ``
98
+ ], triggerWidth, triggerWidth, triggerHeight, ({ theme })=>theme.lowPerformance ? 'unset' : 'background-color 0.15s ease-in-out 0.1s', _mixins.shadows.tiny, ({ theme })=>theme.lowPerformance ? 'unset' : 'width 0.15s ease-in-out, left 0.3s ease-in-out, right 0.3s ease-in-out', ({ $disabled, pressed })=>!$disabled && (0, _styledcomponents.css)([
99
+ ``,
100
+ `:active &::after{width:1.875rem;}`,
101
+ ``
252
102
  ], StyledRoot, pressed && (0, _styledcomponents.css)([
253
- "&::after{width:1.875rem;}"
254
- ]));
255
- }, StyledInput, function(param) {
256
- var focused = param.focused, outlined = param.outlined, theme = param.theme;
257
- return (0, _mixins.addFocus)(_object_spread_props(_object_spread({}, theme), {
258
- focused: focused,
259
- outlined: outlined,
103
+ `&::after{width:1.875rem;}`
104
+ ])), StyledInput, ({ focused, outlined, theme })=>(0, _mixins.addFocus)({
105
+ ...theme,
106
+ focused,
107
+ outlined,
260
108
  outlineRadius: '1rem',
261
- synthesizeFocus: synthesizeFocus
109
+ synthesizeFocus
262
110
  }));
263
- });
264
- var StyledLabel = _styledcomponents.default.span.withConfig({
111
+ const StyledLabel = _styledcomponents.default.span.withConfig({
265
112
  displayName: "Switch__StyledLabel",
266
113
  componentId: "sc-a32af9d8-3"
267
114
  })([
268
- "",
269
- ";margin-right:0.75rem;user-select:none;",
270
- ""
115
+ ``,
116
+ `;margin-right:0.75rem;user-select:none;`,
117
+ ``
271
118
  ], _tokens.body1, _mixins.applyEllipsis);
272
- var Switch = /*#__PURE__*/ _react.default.forwardRef(function Switch(_0, _1) {
273
- var _ref = [
274
- _0,
275
- _1
276
- ], _ref1 = _to_array(_ref), _ref2 = _ref1[0], _rest = _ref1.slice(1), name = _ref2.name, value = _ref2.value, label = _ref2.label, checked = _ref2.checked, defaultChecked = _ref2.defaultChecked, disabled = _ref2.disabled, readOnly = _ref2.readOnly, pressed = _ref2.pressed, focused = _ref2.focused, outlined = _ref2.outlined, tabIndex = _ref2.tabIndex, onChange = _ref2.onChange, onFocus = _ref2.onFocus, onBlur = _ref2.onBlur, rest = _object_without_properties(_ref2, [
277
- "name",
278
- "value",
279
- "label",
280
- "checked",
281
- "defaultChecked",
282
- "disabled",
283
- "readOnly",
284
- "pressed",
285
- "focused",
286
- "outlined",
287
- "tabIndex",
288
- "onChange",
289
- "onFocus",
290
- "onBlur"
291
- ]), _rest1 = _sliced_to_array(_rest, 1), ref = _rest1[0];
292
- var exactChecked = Boolean(checked !== undefined ? checked : defaultChecked);
293
- return /*#__PURE__*/ _react.default.createElement(StyledRoot, _object_spread({
294
- $disabled: disabled
295
- }, rest), /*#__PURE__*/ _react.default.createElement(StyledInput, {
119
+ const Switch = /*#__PURE__*/ _react.default.forwardRef(function Switch({ name, value, label, checked, defaultChecked, disabled, readOnly, pressed, focused, outlined, tabIndex, onChange, onFocus, onBlur, ...rest }, ref) {
120
+ const exactChecked = Boolean(checked !== undefined ? checked : defaultChecked);
121
+ return /*#__PURE__*/ _react.default.createElement(StyledRoot, {
122
+ $disabled: disabled,
123
+ ...rest
124
+ }, /*#__PURE__*/ _react.default.createElement(StyledInput, {
296
125
  ref: ref,
297
126
  role: "switch",
298
127
  "aria-checked": exactChecked,
@@ -8,4 +8,4 @@ Object.defineProperty(exports, "Switch", {
8
8
  return _Switch.Switch;
9
9
  }
10
10
  });
11
- var _Switch = require("./Switch");
11
+ const _Switch = require("./Switch");
@@ -16,32 +16,11 @@ _export(exports, {
16
16
  return TabItem;
17
17
  }
18
18
  });
19
- var _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
20
- var _styledcomponents = /*#__PURE__*/ _interop_require_wildcard(require("styled-components"));
21
- var _hooks = require("../../hooks");
22
- var _mixins = require("../../mixins");
23
- var _TabsContext = require("./TabsContext");
24
- function _array_like_to_array(arr, len) {
25
- if (len == null || len > arr.length) len = arr.length;
26
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
27
- return arr2;
28
- }
29
- function _array_with_holes(arr) {
30
- if (Array.isArray(arr)) return arr;
31
- }
32
- function _define_property(obj, key, value) {
33
- if (key in obj) {
34
- Object.defineProperty(obj, key, {
35
- value: value,
36
- enumerable: true,
37
- configurable: true,
38
- writable: true
39
- });
40
- } else {
41
- obj[key] = value;
42
- }
43
- return obj;
44
- }
19
+ const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
20
+ const _styledcomponents = /*#__PURE__*/ _interop_require_wildcard(require("styled-components"));
21
+ const _hooks = require("../../hooks");
22
+ const _mixins = require("../../mixins");
23
+ const _TabsContext = require("./TabsContext");
45
24
  function _getRequireWildcardCache(nodeInterop) {
46
25
  if (typeof WeakMap !== "function") return null;
47
26
  var cacheBabelInterop = new WeakMap();
@@ -83,178 +62,64 @@ function _interop_require_wildcard(obj, nodeInterop) {
83
62
  }
84
63
  return newObj;
85
64
  }
86
- function _iterable_to_array(iter) {
87
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
88
- }
89
- function _iterable_to_array_limit(arr, i) {
90
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
91
- if (_i == null) return;
92
- var _arr = [];
93
- var _n = true;
94
- var _d = false;
95
- var _s, _e;
96
- try {
97
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
98
- _arr.push(_s.value);
99
- if (i && _arr.length === i) break;
100
- }
101
- } catch (err) {
102
- _d = true;
103
- _e = err;
104
- } finally{
105
- try {
106
- if (!_n && _i["return"] != null) _i["return"]();
107
- } finally{
108
- if (_d) throw _e;
109
- }
110
- }
111
- return _arr;
112
- }
113
- function _non_iterable_rest() {
114
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
115
- }
116
- function _object_spread(target) {
117
- for(var i = 1; i < arguments.length; i++){
118
- var source = arguments[i] != null ? arguments[i] : {};
119
- var ownKeys = Object.keys(source);
120
- if (typeof Object.getOwnPropertySymbols === "function") {
121
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
122
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
123
- }));
124
- }
125
- ownKeys.forEach(function(key) {
126
- _define_property(target, key, source[key]);
127
- });
128
- }
129
- return target;
130
- }
131
- function _object_without_properties(source, excluded) {
132
- if (source == null) return {};
133
- var target = {}, sourceKeys, key, i;
134
- if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
135
- sourceKeys = Reflect.ownKeys(source);
136
- for(i = 0; i < sourceKeys.length; i++){
137
- key = sourceKeys[i];
138
- if (excluded.indexOf(key) >= 0) continue;
139
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
140
- target[key] = source[key];
141
- }
142
- return target;
143
- }
144
- target = _object_without_properties_loose(source, excluded);
145
- if (Object.getOwnPropertySymbols) {
146
- sourceKeys = Object.getOwnPropertySymbols(source);
147
- for(i = 0; i < sourceKeys.length; i++){
148
- key = sourceKeys[i];
149
- if (excluded.indexOf(key) >= 0) continue;
150
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
151
- target[key] = source[key];
152
- }
153
- }
154
- return target;
155
- }
156
- function _object_without_properties_loose(source, excluded) {
157
- if (source == null) return {};
158
- var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
159
- for(i = 0; i < sourceKeys.length; i++){
160
- key = sourceKeys[i];
161
- if (excluded.indexOf(key) >= 0) continue;
162
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
163
- target[key] = source[key];
164
- }
165
- return target;
166
- }
167
- function _sliced_to_array(arr, i) {
168
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
169
- }
170
- function _to_array(arr) {
171
- return _array_with_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_rest();
172
- }
173
- function _unsupported_iterable_to_array(o, minLen) {
174
- if (!o) return;
175
- if (typeof o === "string") return _array_like_to_array(o, minLen);
176
- var n = Object.prototype.toString.call(o).slice(8, -1);
177
- if (n === "Object" && o.constructor) n = o.constructor.name;
178
- if (n === "Map" || n === "Set") return Array.from(n);
179
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
180
- }
181
65
  /**
182
66
  * Без этого спана баг - контент (например, иконка)
183
67
  * сжимался в угоду текстового контента,
184
68
  * при чем ширина иконки игнорируется.
185
- */ var StyledTabItemContentLeft = _styledcomponents.default.span.withConfig({
69
+ */ const StyledTabItemContentLeft = _styledcomponents.default.span.withConfig({
186
70
  displayName: "TabItem__StyledTabItemContentLeft",
187
71
  componentId: "sc-7e8918c-0"
188
72
  })([
189
- "display:flex;pointer-events:none;"
73
+ `display:flex;pointer-events:none;`
190
74
  ]);
191
75
  /**
192
76
  * Этот спан нужен для сокращения
193
77
  * текстового контента и отступов.
194
- */ var StyledTabItemText = _styledcomponents.default.span.withConfig({
78
+ */ const StyledTabItemText = _styledcomponents.default.span.withConfig({
195
79
  displayName: "TabItem__StyledTabItemText",
196
80
  componentId: "sc-7e8918c-1"
197
81
  })([
198
- "display:inline;pointer-events:none;",
199
- " ",
200
- " ~ &{margin-left:0.375rem;}&:focus,&.focus-visible{outline:0 none;}"
82
+ `display:inline;pointer-events:none;`,
83
+ ` `,
84
+ ` ~ &{margin-left:0.375rem;}&:focus,&.focus-visible{outline:0 none;}`
201
85
  ], _mixins.applyEllipsis, StyledTabItemContentLeft);
202
- var StyledTabItem = _styledcomponents.default.div.withConfig({
86
+ const StyledTabItem = _styledcomponents.default.div.withConfig({
203
87
  displayName: "TabItem__StyledTabItem",
204
88
  componentId: "sc-7e8918c-2"
205
89
  })([
206
- "align-items:center;box-sizing:border-box;display:flex;justify-content:center;border:0 none;background:none;color:inherit;letter-spacing:inherit;text-align:center;cursor:pointer;&:focus{outline:0 none;}",
207
- " ",
208
- " ",
209
- ""
210
- ], function(param) {
211
- var disabled = param.disabled;
212
- return disabled && (0, _styledcomponents.css)([
213
- "pointer-events:none;"
214
- ]);
215
- }, function(param) {
216
- var isChildren = param.isChildren;
217
- return !isChildren && (0, _styledcomponents.css)([
218
- "width:var(--tab-item-height);padding-left:0;padding-right:0;"
219
- ]);
220
- }, function(param) {
221
- var isContentLeft = param.isContentLeft;
222
- return isContentLeft && (0, _styledcomponents.css)([
223
- "padding-top:var(--tab-item-padding-y-reduced);padding-bottom:var(--tab-item-padding-y-reduced);"
224
- ]);
225
- });
226
- var TabItem = /*#__PURE__*/ (0, _react.forwardRef)(function TabItem(_0, _1) {
227
- var _ref = [
228
- _0,
229
- _1
230
- ], _ref1 = _to_array(_ref), _ref2 = _ref1[0], _rest = _ref1.slice(1), children = _ref2.children, contentLeft = _ref2.contentLeft, isActive = _ref2.isActive, _ref_role = _ref2.role, role = _ref_role === void 0 ? 'tab' : _ref_role, rest = _object_without_properties(_ref2, [
231
- "children",
232
- "contentLeft",
233
- "isActive",
234
- "role"
235
- ]), _rest1 = _sliced_to_array(_rest, 1), outerRef = _rest1[0];
236
- var innerRef = (0, _react.useRef)(null);
237
- var ref = (0, _hooks.useForkRef)(outerRef, innerRef);
238
- var refs = (0, _react.useContext)(_TabsContext.TabsContext);
239
- (0, _react.useEffect)(function() {
90
+ `align-items:center;box-sizing:border-box;display:flex;justify-content:center;border:0 none;background:none;color:inherit;letter-spacing:inherit;text-align:center;cursor:pointer;&:focus{outline:0 none;}`,
91
+ ` `,
92
+ ` `,
93
+ ``
94
+ ], ({ disabled })=>disabled && (0, _styledcomponents.css)([
95
+ `pointer-events:none;`
96
+ ]), ({ isChildren })=>!isChildren && (0, _styledcomponents.css)([
97
+ `width:var(--tab-item-height);padding-left:0;padding-right:0;`
98
+ ]), ({ isContentLeft })=>isContentLeft && (0, _styledcomponents.css)([
99
+ `padding-top:var(--tab-item-padding-y-reduced);padding-bottom:var(--tab-item-padding-y-reduced);`
100
+ ]));
101
+ const TabItem = /*#__PURE__*/ (0, _react.forwardRef)(function TabItem({ children, contentLeft, isActive, role = 'tab', ...rest }, outerRef) {
102
+ const innerRef = (0, _react.useRef)(null);
103
+ const ref = (0, _hooks.useForkRef)(outerRef, innerRef);
104
+ const refs = (0, _react.useContext)(_TabsContext.TabsContext);
105
+ (0, _react.useEffect)(()=>{
240
106
  if (!refs) {
241
107
  return;
242
108
  }
243
109
  refs.register(innerRef);
244
- return function() {
245
- return refs.unregister(innerRef);
246
- };
110
+ return ()=>refs.unregister(innerRef);
247
111
  }, [
248
112
  refs
249
113
  ]);
250
- return /*#__PURE__*/ _react.default.createElement(StyledTabItem, _object_spread({
114
+ return /*#__PURE__*/ _react.default.createElement(StyledTabItem, {
251
115
  ref: ref,
252
116
  isChildren: !!children,
253
117
  isContentLeft: !!contentLeft,
254
118
  isActive: isActive,
255
119
  "aria-selected": isActive,
256
- role: role
257
- }, rest), contentLeft && /*#__PURE__*/ _react.default.createElement(StyledTabItemContentLeft, {
120
+ role: role,
121
+ ...rest
122
+ }, contentLeft && /*#__PURE__*/ _react.default.createElement(StyledTabItemContentLeft, {
258
123
  "aria-hidden": true
259
124
  }, contentLeft), children && /*#__PURE__*/ _react.default.createElement(StyledTabItemText, {
260
125
  tabIndex: -1