@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
@@ -1,100 +1,25 @@
1
- function _array_like_to_array(arr, len) {
2
- if (len == null || len > arr.length) len = arr.length;
3
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
- return arr2;
5
- }
6
- function _array_with_holes(arr) {
7
- if (Array.isArray(arr)) return arr;
8
- }
9
- function _define_property(obj, key, value) {
10
- if (key in obj) {
11
- Object.defineProperty(obj, key, {
12
- value: value,
13
- enumerable: true,
14
- configurable: true,
15
- writable: true
16
- });
17
- } else {
18
- obj[key] = value;
19
- }
20
- return obj;
21
- }
22
- function _iterable_to_array_limit(arr, i) {
23
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
24
- if (_i == null) return;
25
- var _arr = [];
26
- var _n = true;
27
- var _d = false;
28
- var _s, _e;
29
- try {
30
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
31
- _arr.push(_s.value);
32
- if (i && _arr.length === i) break;
33
- }
34
- } catch (err) {
35
- _d = true;
36
- _e = err;
37
- } finally{
38
- try {
39
- if (!_n && _i["return"] != null) _i["return"]();
40
- } finally{
41
- if (_d) throw _e;
42
- }
43
- }
44
- return _arr;
45
- }
46
- function _non_iterable_rest() {
47
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
48
- }
49
- function _object_spread(target) {
50
- for(var i = 1; i < arguments.length; i++){
51
- var source = arguments[i] != null ? arguments[i] : {};
52
- var ownKeys = Object.keys(source);
53
- if (typeof Object.getOwnPropertySymbols === "function") {
54
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
55
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
56
- }));
57
- }
58
- ownKeys.forEach(function(key) {
59
- _define_property(target, key, source[key]);
60
- });
61
- }
62
- return target;
63
- }
64
- function _sliced_to_array(arr, i) {
65
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
66
- }
67
- function _unsupported_iterable_to_array(o, minLen) {
68
- if (!o) return;
69
- if (typeof o === "string") return _array_like_to_array(o, minLen);
70
- var n = Object.prototype.toString.call(o).slice(8, -1);
71
- if (n === "Object" && o.constructor) n = o.constructor.name;
72
- if (n === "Map" || n === "Set") return Array.from(n);
73
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
74
- }
75
1
  import { useEffect, useState } from 'react';
76
2
  import { usePopupBaseContext } from './PopupBaseContext';
77
3
  // Хук для поключения анимации
78
- export var usePopupAnimation = function usePopupAnimation() {
79
- var _useState = _sliced_to_array(useState(false), 2), endAnimation = _useState[0], setEndAnimation = _useState[1];
80
- var _useState1 = _sliced_to_array(useState(false), 2), endTransition = _useState1[0], setEndTransition = _useState1[1];
4
+ export const usePopupAnimation = ()=>{
5
+ const [endAnimation, setEndAnimation] = useState(false);
6
+ const [endTransition, setEndTransition] = useState(false);
81
7
  return {
82
- endAnimation: endAnimation,
83
- endTransition: endTransition,
84
- setEndTransition: setEndTransition,
85
- setEndAnimation: setEndAnimation
8
+ endAnimation,
9
+ endTransition,
10
+ setEndTransition,
11
+ setEndAnimation
86
12
  };
87
13
  };
88
14
  // Хук для внутреннего состояния, необходимого для правильного отображения вложенных окон, а также для анимации
89
- export var usePopup = function usePopup(param) {
90
- var isOpen = param.isOpen, id = param.id, popupInfo = param.popupInfo, withAnimation = param.withAnimation;
91
- var _useState = _sliced_to_array(useState(false), 2), isVisible = _useState[0], setVisible = _useState[1];
92
- var popupController = usePopupBaseContext();
93
- var animationInfo = usePopupAnimation();
15
+ export const usePopup = ({ isOpen, id, popupInfo, withAnimation })=>{
16
+ const [isVisible, setVisible] = useState(false);
17
+ const popupController = usePopupBaseContext();
18
+ const animationInfo = usePopupAnimation();
94
19
  // для использования transition в качестве анимации
95
- useEffect(function() {
20
+ useEffect(()=>{
96
21
  if (withAnimation && animationInfo) {
97
- animationInfo.setEndTransition(!isVisible || (animationInfo === null || animationInfo === void 0 ? void 0 : animationInfo.endAnimation));
22
+ animationInfo.setEndTransition(!isVisible || animationInfo?.endAnimation);
98
23
  }
99
24
  }, [
100
25
  animationInfo,
@@ -102,12 +27,13 @@ export var usePopup = function usePopup(param) {
102
27
  isVisible
103
28
  ]);
104
29
  // сначала добавление/удаление из контекста, и только после этого отображение/скрытие
105
- useEffect(function() {
30
+ useEffect(()=>{
106
31
  // при первом открытии
107
32
  if (isOpen && !isVisible) {
108
- popupController.register(_object_spread({
109
- id: id
110
- }, popupInfo));
33
+ popupController.register({
34
+ id,
35
+ ...popupInfo
36
+ });
111
37
  setVisible(true);
112
38
  animationInfo.setEndAnimation(false);
113
39
  return;
@@ -130,8 +56,8 @@ export var usePopup = function usePopup(param) {
130
56
  withAnimation
131
57
  ]);
132
58
  return {
133
- isVisible: isVisible,
134
- setVisible: setVisible,
135
- animationInfo: animationInfo
59
+ isVisible,
60
+ setVisible,
61
+ animationInfo
136
62
  };
137
63
  };
@@ -1,76 +1,30 @@
1
- function _array_like_to_array(arr, len) {
2
- if (len == null || len > arr.length) len = arr.length;
3
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
- return arr2;
5
- }
6
- function _array_with_holes(arr) {
7
- if (Array.isArray(arr)) return arr;
8
- }
9
- function _iterable_to_array_limit(arr, i) {
10
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
11
- if (_i == null) return;
12
- var _arr = [];
13
- var _n = true;
14
- var _d = false;
15
- var _s, _e;
16
- try {
17
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
18
- _arr.push(_s.value);
19
- if (i && _arr.length === i) break;
20
- }
21
- } catch (err) {
22
- _d = true;
23
- _e = err;
24
- } finally{
25
- try {
26
- if (!_n && _i["return"] != null) _i["return"]();
27
- } finally{
28
- if (_d) throw _e;
29
- }
30
- }
31
- return _arr;
32
- }
33
- function _non_iterable_rest() {
34
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
35
- }
36
- function _sliced_to_array(arr, i) {
37
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
38
- }
39
- function _unsupported_iterable_to_array(o, minLen) {
40
- if (!o) return;
41
- if (typeof o === "string") return _array_like_to_array(o, minLen);
42
- var n = Object.prototype.toString.call(o).slice(8, -1);
43
- if (n === "Object" && o.constructor) n = o.constructor.name;
44
- if (n === "Map" || n === "Set") return Array.from(n);
45
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
46
- }
47
1
  import { css } from 'styled-components';
48
2
  /*
49
3
  * Класс корневого компонента PopupBaseRoot: `popup-base-root`
50
- */ export var popupBaseRootClass = 'popup-base-root';
51
- export var endAnimationClass = 'popup-base-end-animation';
52
- export var endTransitionClass = 'popup-base-end-transition';
53
- export var handlePosition = function handlePosition(placement, offset) {
54
- var x = '0rem';
55
- var y = '0rem';
4
+ */ export const popupBaseRootClass = 'popup-base-root';
5
+ export const endAnimationClass = 'popup-base-end-animation';
6
+ export const endTransitionClass = 'popup-base-end-transition';
7
+ export const handlePosition = (placement, offset)=>{
8
+ let x = '0rem';
9
+ let y = '0rem';
56
10
  if (offset) {
57
- var _offset = _sliced_to_array(offset, 2), _x = _offset[0], _y = _offset[1];
58
- x = typeof _x === 'number' ? "".concat(_x, "rem") : _x;
59
- y = typeof _y === 'number' ? "".concat(_y, "rem") : _y;
11
+ const [_x, _y] = offset;
12
+ x = typeof _x === 'number' ? `${_x}rem` : _x;
13
+ y = typeof _y === 'number' ? `${_y}rem` : _y;
60
14
  }
61
15
  if (!placement || placement === 'center') {
62
16
  return css([
63
- "left:calc(50% + ",
64
- ");top:calc(50% - ",
65
- ");transform:translate(-50%,-50%);"
17
+ `left:calc(50% + `,
18
+ `);top:calc(50% - `,
19
+ `);transform:translate(-50%,-50%);`
66
20
  ], x, y);
67
21
  }
68
- var left;
69
- var right;
70
- var top;
71
- var bottom;
72
- var placements = placement.split('-');
73
- placements.forEach(function(placement) {
22
+ let left;
23
+ let right;
24
+ let top;
25
+ let bottom;
26
+ const placements = placement.split('-');
27
+ placements.forEach((placement)=>{
74
28
  switch(placement){
75
29
  case 'left':
76
30
  left = x;
@@ -88,22 +42,22 @@ export var handlePosition = function handlePosition(placement, offset) {
88
42
  break;
89
43
  }
90
44
  });
91
- var isCenteredX = left === undefined && right === undefined;
92
- var isCenteredY = top === undefined && bottom === undefined;
45
+ const isCenteredX = left === undefined && right === undefined;
46
+ const isCenteredY = top === undefined && bottom === undefined;
93
47
  // информация для переезда в new-hope: не забыть, что styled-component выпилит undefined свойства, а линария нет
94
48
  return css([
95
- "left:",
96
- ";right:",
97
- ";top:",
98
- ";bottom:",
99
- ";",
100
- " ",
101
- ""
49
+ `left:`,
50
+ `;right:`,
51
+ `;top:`,
52
+ `;bottom:`,
53
+ `;`,
54
+ ` `,
55
+ ``
102
56
  ], left, right, top, bottom, isCenteredX && css([
103
- "left:calc(50% + ",
104
- ");transform:translateX(-50%);"
57
+ `left:calc(50% + `,
58
+ `);transform:translateX(-50%);`
105
59
  ], x), isCenteredY && css([
106
- "top:calc(50% - ",
107
- ");transform:translateY(-50%);"
60
+ `top:calc(50% - `,
61
+ `);transform:translateY(-50%);`
108
62
  ], y));
109
63
  };
@@ -1,99 +1,24 @@
1
- function _define_property(obj, key, value) {
2
- if (key in obj) {
3
- Object.defineProperty(obj, key, {
4
- value: value,
5
- enumerable: true,
6
- configurable: true,
7
- writable: true
8
- });
9
- } else {
10
- obj[key] = value;
11
- }
12
- return obj;
13
- }
14
- function _object_spread(target) {
15
- for(var i = 1; i < arguments.length; i++){
16
- var source = arguments[i] != null ? arguments[i] : {};
17
- var ownKeys = Object.keys(source);
18
- if (typeof Object.getOwnPropertySymbols === "function") {
19
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
20
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
21
- }));
22
- }
23
- ownKeys.forEach(function(key) {
24
- _define_property(target, key, source[key]);
25
- });
26
- }
27
- return target;
28
- }
29
- function _object_without_properties(source, excluded) {
30
- if (source == null) return {};
31
- var target = {}, sourceKeys, key, i;
32
- if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
33
- sourceKeys = Reflect.ownKeys(source);
34
- for(i = 0; i < sourceKeys.length; i++){
35
- key = sourceKeys[i];
36
- if (excluded.indexOf(key) >= 0) continue;
37
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
38
- target[key] = source[key];
39
- }
40
- return target;
41
- }
42
- target = _object_without_properties_loose(source, excluded);
43
- if (Object.getOwnPropertySymbols) {
44
- sourceKeys = Object.getOwnPropertySymbols(source);
45
- for(i = 0; i < sourceKeys.length; i++){
46
- key = sourceKeys[i];
47
- if (excluded.indexOf(key) >= 0) continue;
48
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
49
- target[key] = source[key];
50
- }
51
- }
52
- return target;
53
- }
54
- function _object_without_properties_loose(source, excluded) {
55
- if (source == null) return {};
56
- var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
57
- for(i = 0; i < sourceKeys.length; i++){
58
- key = sourceKeys[i];
59
- if (excluded.indexOf(key) >= 0) continue;
60
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
61
- target[key] = source[key];
62
- }
63
- return target;
64
- }
65
1
  import React from 'react';
66
2
  import styled, { css } from 'styled-components';
67
3
  import { formatCurrency } from '../../utils';
68
- var StyledPrice = styled.span.withConfig({
4
+ const StyledPrice = styled.span.withConfig({
69
5
  displayName: "Price__StyledPrice",
70
6
  componentId: "sc-cf7d3366-0"
71
7
  })([
72
- "",
73
- ";"
74
- ], function(param) {
75
- var $stroke = param.$stroke;
76
- return $stroke && css([
77
- "text-decoration:line-through;"
78
- ]);
79
- });
80
- var StyledPeriodicity = styled.span.withConfig({
8
+ ``,
9
+ `;`
10
+ ], ({ $stroke })=>$stroke && css([
11
+ `text-decoration:line-through;`
12
+ ]));
13
+ const StyledPeriodicity = styled.span.withConfig({
81
14
  displayName: "Price__StyledPeriodicity",
82
15
  componentId: "sc-cf7d3366-1"
83
16
  })([
84
- "padding-left:0.25rem;"
17
+ `padding-left:0.25rem;`
85
18
  ]);
86
19
  /**
87
20
  * Компонент для отображения цены / стоимости / суммы.
88
- */ export var Price = function Price(_0) {
89
- var children = _0.children, _0_currency = _0.currency, currency = _0_currency === void 0 ? 'rub' : _0_currency, _0_minimumFractionDigits = _0.minimumFractionDigits, minimumFractionDigits = _0_minimumFractionDigits === void 0 ? 0 : _0_minimumFractionDigits, _0_stroke = _0.stroke, stroke = _0_stroke === void 0 ? false : _0_stroke, periodicity = _0.periodicity, rest = _object_without_properties(_0, [
90
- "children",
91
- "currency",
92
- "minimumFractionDigits",
93
- "stroke",
94
- "periodicity"
95
- ]);
96
- return /*#__PURE__*/ React.createElement(StyledPrice, _object_spread({
97
- $stroke: stroke
98
- }, rest), formatCurrency(children, currency, minimumFractionDigits), periodicity && /*#__PURE__*/ React.createElement(StyledPeriodicity, null, periodicity));
99
- };
21
+ */ export const Price = ({ children, currency = 'rub', minimumFractionDigits = 0, stroke = false, periodicity, ...rest })=>/*#__PURE__*/ React.createElement(StyledPrice, {
22
+ $stroke: stroke,
23
+ ...rest
24
+ }, formatCurrency(children, currency, minimumFractionDigits), periodicity && /*#__PURE__*/ React.createElement(StyledPeriodicity, null, periodicity));
@@ -1,129 +1,8 @@
1
- function _array_like_to_array(arr, len) {
2
- if (len == null || len > arr.length) len = arr.length;
3
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
- return arr2;
5
- }
6
- function _array_with_holes(arr) {
7
- if (Array.isArray(arr)) return arr;
8
- }
9
- function _define_property(obj, key, value) {
10
- if (key in obj) {
11
- Object.defineProperty(obj, key, {
12
- value: value,
13
- enumerable: true,
14
- configurable: true,
15
- writable: true
16
- });
17
- } else {
18
- obj[key] = value;
19
- }
20
- return obj;
21
- }
22
- function _iterable_to_array(iter) {
23
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
24
- }
25
- function _iterable_to_array_limit(arr, i) {
26
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
27
- if (_i == null) return;
28
- var _arr = [];
29
- var _n = true;
30
- var _d = false;
31
- var _s, _e;
32
- try {
33
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
34
- _arr.push(_s.value);
35
- if (i && _arr.length === i) break;
36
- }
37
- } catch (err) {
38
- _d = true;
39
- _e = err;
40
- } finally{
41
- try {
42
- if (!_n && _i["return"] != null) _i["return"]();
43
- } finally{
44
- if (_d) throw _e;
45
- }
46
- }
47
- return _arr;
48
- }
49
- function _non_iterable_rest() {
50
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
51
- }
52
- function _object_spread(target) {
53
- for(var i = 1; i < arguments.length; i++){
54
- var source = arguments[i] != null ? arguments[i] : {};
55
- var ownKeys = Object.keys(source);
56
- if (typeof Object.getOwnPropertySymbols === "function") {
57
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
58
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
59
- }));
60
- }
61
- ownKeys.forEach(function(key) {
62
- _define_property(target, key, source[key]);
63
- });
64
- }
65
- return target;
66
- }
67
- function _object_without_properties(source, excluded) {
68
- if (source == null) return {};
69
- var target = {}, sourceKeys, key, i;
70
- if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
71
- sourceKeys = Reflect.ownKeys(source);
72
- for(i = 0; i < sourceKeys.length; i++){
73
- key = sourceKeys[i];
74
- if (excluded.indexOf(key) >= 0) continue;
75
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
76
- target[key] = source[key];
77
- }
78
- return target;
79
- }
80
- target = _object_without_properties_loose(source, excluded);
81
- if (Object.getOwnPropertySymbols) {
82
- sourceKeys = Object.getOwnPropertySymbols(source);
83
- for(i = 0; i < sourceKeys.length; i++){
84
- key = sourceKeys[i];
85
- if (excluded.indexOf(key) >= 0) continue;
86
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
87
- target[key] = source[key];
88
- }
89
- }
90
- return target;
91
- }
92
- function _object_without_properties_loose(source, excluded) {
93
- if (source == null) return {};
94
- var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
95
- for(i = 0; i < sourceKeys.length; i++){
96
- key = sourceKeys[i];
97
- if (excluded.indexOf(key) >= 0) continue;
98
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
99
- target[key] = source[key];
100
- }
101
- return target;
102
- }
103
- function _sliced_to_array(arr, i) {
104
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
105
- }
106
- function _to_array(arr) {
107
- return _array_with_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_rest();
108
- }
109
- function _unsupported_iterable_to_array(o, minLen) {
110
- if (!o) return;
111
- if (typeof o === "string") return _array_like_to_array(o, minLen);
112
- var n = Object.prototype.toString.call(o).slice(8, -1);
113
- if (n === "Object" && o.constructor) n = o.constructor.name;
114
- if (n === "Map" || n === "Set") return Array.from(n);
115
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
116
- }
117
1
  import React from 'react';
118
- export var RadioGroup = /*#__PURE__*/ React.forwardRef(function(_0, _1) {
119
- var _ref = [
120
- _0,
121
- _1
122
- ], _ref1 = _to_array(_ref), _ref2 = _ref1[0], _rest = _ref1.slice(1), children = _ref2.children, rest = _object_without_properties(_ref2, [
123
- "children"
124
- ]), _rest1 = _sliced_to_array(_rest, 1), ref = _rest1[0];
125
- return /*#__PURE__*/ React.createElement("div", _object_spread({
2
+ export const RadioGroup = /*#__PURE__*/ React.forwardRef(({ children, ...rest }, ref)=>{
3
+ return /*#__PURE__*/ React.createElement("div", {
126
4
  role: "radiogroup",
127
- ref: ref
128
- }, rest), children);
5
+ ref: ref,
6
+ ...rest
7
+ }, children);
129
8
  });
@@ -1,14 +1,13 @@
1
1
  import React, { createContext } from 'react';
2
- export var SSRContext = /*#__PURE__*/ createContext({
2
+ export const SSRContext = /*#__PURE__*/ createContext({
3
3
  uniqId: null
4
4
  });
5
5
  /**
6
6
  * Провайдер обязателен для использования, необходимо обернуть в него все приложение.
7
7
  *
8
8
  * Используется для корректного озвучивания скринридерами Radiobox и Checkbox компонент.
9
- */ export var SSRProvider = function SSRProvider(param) {
10
- var children = param.children;
11
- var value = {
9
+ */ export const SSRProvider = ({ children })=>{
10
+ const value = {
12
11
  uniqId: 0
13
12
  };
14
13
  return /*#__PURE__*/ React.createElement(SSRContext.Provider, {
@@ -1,105 +1,33 @@
1
- function _define_property(obj, key, value) {
2
- if (key in obj) {
3
- Object.defineProperty(obj, key, {
4
- value: value,
5
- enumerable: true,
6
- configurable: true,
7
- writable: true
8
- });
9
- } else {
10
- obj[key] = value;
11
- }
12
- return obj;
13
- }
14
- function _object_spread(target) {
15
- for(var i = 1; i < arguments.length; i++){
16
- var source = arguments[i] != null ? arguments[i] : {};
17
- var ownKeys = Object.keys(source);
18
- if (typeof Object.getOwnPropertySymbols === "function") {
19
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
20
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
21
- }));
22
- }
23
- ownKeys.forEach(function(key) {
24
- _define_property(target, key, source[key]);
25
- });
26
- }
27
- return target;
28
- }
29
- function _object_without_properties(source, excluded) {
30
- if (source == null) return {};
31
- var target = {}, sourceKeys, key, i;
32
- if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
33
- sourceKeys = Reflect.ownKeys(source);
34
- for(i = 0; i < sourceKeys.length; i++){
35
- key = sourceKeys[i];
36
- if (excluded.indexOf(key) >= 0) continue;
37
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
38
- target[key] = source[key];
39
- }
40
- return target;
41
- }
42
- target = _object_without_properties_loose(source, excluded);
43
- if (Object.getOwnPropertySymbols) {
44
- sourceKeys = Object.getOwnPropertySymbols(source);
45
- for(i = 0; i < sourceKeys.length; i++){
46
- key = sourceKeys[i];
47
- if (excluded.indexOf(key) >= 0) continue;
48
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
49
- target[key] = source[key];
50
- }
51
- }
52
- return target;
53
- }
54
- function _object_without_properties_loose(source, excluded) {
55
- if (source == null) return {};
56
- var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
57
- for(i = 0; i < sourceKeys.length; i++){
58
- key = sourceKeys[i];
59
- if (excluded.indexOf(key) >= 0) continue;
60
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
61
- target[key] = source[key];
62
- }
63
- return target;
64
- }
65
1
  import React from 'react';
66
2
  import styled, { css } from 'styled-components';
67
3
  import { applySkeletonGradient, applyRoundness } from '../../mixins';
68
4
  import * as typography from '../../tokens/typography';
69
5
  import { DEFAULT_TEXT_SIZE, DEFAULT_ROUNDNESS } from './Skeleton';
70
- var StyledVisibleLine = styled.div.withConfig({
6
+ const StyledVisibleLine = styled.div.withConfig({
71
7
  displayName: "LineSkeleton__StyledVisibleLine",
72
8
  componentId: "sc-fa3b5b49-0"
73
9
  })([
74
- "position:relative;overflow:hidden;width:100%;"
10
+ `position:relative;overflow:hidden;width:100%;`
75
11
  ]);
76
- var StyledLine = styled.div.withConfig({
12
+ const StyledLine = styled.div.withConfig({
77
13
  displayName: "LineSkeleton__StyledLine",
78
14
  componentId: "sc-fa3b5b49-1"
79
15
  })([
80
- "display:flex;align-items:center;width:100%;",
81
- " & ",
82
- "{",
83
- " ",
84
- "}"
85
- ], function(param) {
86
- var $size = param.$size;
87
- return css([
88
- "height:",
89
- ";& ",
90
- "{height:",
91
- ";}"
92
- ], typography[$size].lineHeight, StyledVisibleLine, typography[$size].fontSize);
93
- }, StyledVisibleLine, applyRoundness, applySkeletonGradient);
16
+ `display:flex;align-items:center;width:100%;`,
17
+ ` & `,
18
+ `{`,
19
+ ` `,
20
+ `}`
21
+ ], ({ $size })=>css([
22
+ `height:`,
23
+ `;& `,
24
+ `{height:`,
25
+ `;}`
26
+ ], typography[$size].lineHeight, StyledVisibleLine, typography[$size].fontSize), StyledVisibleLine, applyRoundness, applySkeletonGradient);
94
27
  /**
95
28
  * Размеры компонента задаются с помощью констант и соответствуют размерам [типографических элементов](/?path=/docs/).
96
- */ export var LineSkeleton = function LineSkeleton(_0) {
97
- var _0_size = _0.size, size = _0_size === void 0 ? DEFAULT_TEXT_SIZE : _0_size, _0_roundness = _0.roundness, roundness = _0_roundness === void 0 ? DEFAULT_ROUNDNESS : _0_roundness, rest = _object_without_properties(_0, [
98
- "size",
99
- "roundness"
100
- ]);
101
- return /*#__PURE__*/ React.createElement(StyledLine, _object_spread({
29
+ */ export const LineSkeleton = ({ size = DEFAULT_TEXT_SIZE, roundness = DEFAULT_ROUNDNESS, ...rest })=>/*#__PURE__*/ React.createElement(StyledLine, {
102
30
  $size: size,
103
- roundness: roundness
104
- }, rest), /*#__PURE__*/ React.createElement(StyledVisibleLine, null));
105
- };
31
+ roundness: roundness,
32
+ ...rest
33
+ }, /*#__PURE__*/ React.createElement(StyledVisibleLine, null));