@salutejs/plasma-core 1.226.0-next-platform-ai.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.
- package/__helpers/IconPlaceholder.js +6 -9
- package/__helpers/index.js +1 -1
- package/collectPackageInfo.js +4 -4
- package/components/Badge/Badge.js +30 -103
- package/components/Badge/index.js +1 -1
- package/components/Basebox/Basebox.js +33 -42
- package/components/Basebox/index.js +1 -1
- package/components/Button/Button.js +28 -67
- package/components/Button/Button.mixins.js +22 -76
- package/components/Button/Button.props.js +5 -5
- package/components/Button/createButton.js +14 -145
- package/components/Button/index.js +4 -4
- package/components/Card/Card.js +34 -162
- package/components/Card/CardBody.js +4 -4
- package/components/Card/CardContent.js +14 -23
- package/components/Card/CardMedia.js +20 -91
- package/components/Card/CardPrice.js +18 -60
- package/components/Card/CardTypography.js +43 -52
- package/components/Card/index.js +5 -5
- package/components/Carousel/Carousel.js +46 -64
- package/components/Carousel/CarouselItem.js +21 -93
- package/components/Carousel/hooks.js +62 -121
- package/components/Carousel/index.js +3 -3
- package/components/Carousel/utils.js +59 -73
- package/components/Fade/Fade.js +6 -9
- package/components/Fade/index.js +1 -1
- package/components/Field/Field.js +48 -63
- package/components/Field/Field.statuses.js +3 -3
- package/components/Field/index.js +2 -2
- package/components/Image/Image.js +34 -115
- package/components/Image/index.js +1 -1
- package/components/Input/Input.js +7 -7
- package/components/Input/Input.mixins.js +9 -12
- package/components/Input/index.js +1 -1
- package/components/ModalBase/ModalBase.js +22 -100
- package/components/ModalBase/ModalBaseContext.js +6 -9
- package/components/ModalBase/ModalOverlay.js +28 -111
- package/components/ModalBase/hooks.js +15 -43
- package/components/ModalBase/index.js +2 -2
- package/components/PaginationDots/PaginationDot.js +11 -17
- package/components/PaginationDots/PaginationDots.js +4 -7
- package/components/PaginationDots/index.js +3 -3
- package/components/PaginationDots/usePaginationDots.js +10 -11
- package/components/Popup/Popup.js +52 -205
- package/components/Popup/index.js +1 -1
- package/components/PopupBase/PopupBase.js +35 -169
- package/components/PopupBase/PopupBaseContext.js +26 -86
- package/components/PopupBase/PopupBaseRoot.js +31 -169
- package/components/PopupBase/hooks.js +23 -97
- package/components/PopupBase/index.js +3 -3
- package/components/PopupBase/utils.js +32 -78
- package/components/Price/Price.js +15 -90
- package/components/Price/index.js +1 -1
- package/components/RadioGroup/RadioGroup.js +6 -127
- package/components/RadioGroup/index.js +1 -1
- package/components/SSRProvider/SSRProvider.js +4 -5
- package/components/SSRProvider/index.js +1 -1
- package/components/Skeleton/LineSkeleton.js +23 -95
- package/components/Skeleton/RectSkeleton.js +20 -93
- package/components/Skeleton/Skeleton.js +2 -2
- package/components/Skeleton/TextSkeleton.js +11 -55
- package/components/Skeleton/index.js +3 -3
- package/components/Slider/Double.js +52 -203
- package/components/Slider/Handle.js +28 -158
- package/components/Slider/Single.js +29 -177
- package/components/Slider/Slider.js +5 -7
- package/components/Slider/SliderBase.js +39 -48
- package/components/Slider/ThumbBase.js +19 -95
- package/components/Slider/index.js +3 -3
- package/components/Slider/utils.js +2 -2
- package/components/Spinner/Spinner.js +28 -100
- package/components/Spinner/SpinnerSvg.js +9 -78
- package/components/Spinner/index.js +1 -1
- package/components/Switch/Switch.js +49 -220
- package/components/Switch/index.js +1 -1
- package/components/Tabs/TabItem.js +33 -168
- package/components/Tabs/Tabs.js +32 -170
- package/components/Tabs/TabsContext.js +12 -42
- package/components/Tabs/createTabsController.js +33 -168
- package/components/Tabs/index.js +4 -4
- package/components/TextArea/TextArea.js +20 -30
- package/components/TextArea/index.js +1 -1
- package/components/TextField/index.js +3 -3
- package/components/Toast/Toast.js +15 -16
- package/components/Toast/ToastContext.js +4 -8
- package/components/Toast/ToastController.js +44 -101
- package/components/Toast/ToastProvider.js +37 -142
- package/components/Toast/index.js +3 -3
- package/components/Toast/useToast.js +6 -6
- package/components/Typography/Body.js +18 -18
- package/components/Typography/Button.js +13 -13
- package/components/Typography/Caption.js +8 -8
- package/components/Typography/Display.js +18 -18
- package/components/Typography/Footnote.js +13 -13
- package/components/Typography/Headline.js +43 -43
- package/components/Typography/Paragraph.js +24 -24
- package/components/Typography/Underline.js +8 -8
- package/es/__helpers/IconPlaceholder.js +5 -8
- package/es/collectPackageInfo.js +3 -3
- package/es/components/Badge/Badge.js +27 -100
- package/es/components/Basebox/Basebox.js +28 -37
- package/es/components/Button/Button.js +24 -63
- package/es/components/Button/Button.mixins.js +19 -73
- package/es/components/Button/Button.props.js +3 -3
- package/es/components/Button/createButton.js +12 -143
- package/es/components/Card/Card.js +29 -157
- package/es/components/Card/CardBody.js +2 -2
- package/es/components/Card/CardContent.js +12 -21
- package/es/components/Card/CardMedia.js +17 -88
- package/es/components/Card/CardPrice.js +13 -55
- package/es/components/Card/CardTypography.js +43 -52
- package/es/components/Carousel/Carousel.js +45 -63
- package/es/components/Carousel/CarouselItem.js +18 -90
- package/es/components/Carousel/hooks.js +58 -117
- package/es/components/Carousel/utils.js +58 -72
- package/es/components/Fade/Fade.js +5 -8
- package/es/components/Field/Field.js +44 -59
- package/es/components/Field/Field.statuses.js +4 -4
- package/es/components/Image/Image.js +31 -112
- package/es/components/Input/Input.js +4 -4
- package/es/components/Input/Input.mixins.js +6 -9
- package/es/components/ModalBase/ModalBase.js +16 -94
- package/es/components/ModalBase/ModalBaseContext.js +6 -9
- package/es/components/ModalBase/ModalOverlay.js +23 -106
- package/es/components/ModalBase/hooks.js +12 -40
- package/es/components/PaginationDots/PaginationDot.js +9 -15
- package/es/components/PaginationDots/PaginationDots.js +3 -6
- package/es/components/PaginationDots/usePaginationDots.js +9 -10
- package/es/components/Popup/Popup.js +48 -201
- package/es/components/PopupBase/PopupBase.js +27 -161
- package/es/components/PopupBase/PopupBaseContext.js +25 -85
- package/es/components/PopupBase/PopupBaseRoot.js +26 -164
- package/es/components/PopupBase/hooks.js +21 -95
- package/es/components/PopupBase/utils.js +31 -77
- package/es/components/Price/Price.js +12 -87
- package/es/components/RadioGroup/RadioGroup.js +5 -126
- package/es/components/SSRProvider/SSRProvider.js +3 -4
- package/es/components/Skeleton/LineSkeleton.js +18 -90
- package/es/components/Skeleton/RectSkeleton.js +16 -89
- package/es/components/Skeleton/Skeleton.js +2 -2
- package/es/components/Skeleton/TextSkeleton.js +7 -51
- package/es/components/Slider/Double.js +49 -200
- package/es/components/Slider/Handle.js +23 -153
- package/es/components/Slider/Single.js +26 -174
- package/es/components/Slider/Slider.js +2 -4
- package/es/components/Slider/SliderBase.js +36 -45
- package/es/components/Slider/ThumbBase.js +16 -92
- package/es/components/Slider/index.js +1 -1
- package/es/components/Slider/utils.js +2 -2
- package/es/components/Spinner/Spinner.js +23 -95
- package/es/components/Spinner/SpinnerSvg.js +8 -77
- package/es/components/Switch/Switch.js +45 -216
- package/es/components/Tabs/TabItem.js +28 -163
- package/es/components/Tabs/Tabs.js +28 -166
- package/es/components/Tabs/TabsContext.js +11 -41
- package/es/components/Tabs/createTabsController.js +28 -163
- package/es/components/TextArea/TextArea.js +18 -28
- package/es/components/Toast/Toast.js +10 -11
- package/es/components/Toast/ToastContext.js +3 -7
- package/es/components/Toast/ToastController.js +38 -95
- package/es/components/Toast/ToastProvider.js +34 -139
- package/es/components/Toast/useToast.js +4 -4
- package/es/components/Typography/Body.js +15 -15
- package/es/components/Typography/Button.js +10 -10
- package/es/components/Typography/Caption.js +5 -5
- package/es/components/Typography/Display.js +15 -15
- package/es/components/Typography/Footnote.js +10 -10
- package/es/components/Typography/Headline.js +40 -40
- package/es/components/Typography/Paragraph.js +21 -21
- package/es/components/Typography/Underline.js +5 -5
- package/es/hocs/withAutoFocus.js +8 -78
- package/es/hocs/withSkeleton.js +5 -10
- package/es/hooks/useDebouncedFunction.js +4 -36
- package/es/hooks/useFocusTrap.js +18 -21
- package/es/hooks/useForkRef.js +3 -3
- package/es/hooks/useIsomorphicLayoutEffect.js +1 -1
- package/es/hooks/useResizeObserver.js +8 -8
- package/es/hooks/useUniqId.js +6 -52
- package/es/mixins/addFocus.js +17 -22
- package/es/mixins/applyDisabled.js +6 -9
- package/es/mixins/applyEllipsis.js +2 -4
- package/es/mixins/applyMaxLines.js +3 -6
- package/es/mixins/applyNoSelect.js +2 -4
- package/es/mixins/applyOutline.js +2 -4
- package/es/mixins/applyRoundness.js +4 -7
- package/es/mixins/applyScrollSnap.js +4 -7
- package/es/mixins/applySkeletonGradient.js +6 -9
- package/es/mixins/applyView.js +2 -5
- package/es/mixins/blur.js +2 -5
- package/es/mixins/shadows.js +1 -1
- package/es/tokens/colors.js +48 -48
- package/es/tokens/typography.js +18 -18
- package/es/utils/__tests__/formatters.test.js +2 -2
- package/es/utils/animatedScrollTo.js +24 -34
- package/es/utils/canUseDOM.js +1 -1
- package/es/utils/extractTextFrom.js +3 -7
- package/es/utils/focusManager.js +40 -47
- package/es/utils/formatCurrency.js +4 -4
- package/es/utils/formatters.js +6 -14
- package/es/utils/react.js +4 -4
- package/es/utils/roundness.js +2 -4
- package/es/utils/scopeTab.js +5 -5
- package/es/utils/setRef.js +1 -1
- package/es/utils/tabbable.js +16 -25
- package/es/utils/toCssSize.js +1 -3
- package/es/utils/transformStyles.js +5 -60
- package/hocs/index.js +2 -2
- package/hocs/withAutoFocus.js +9 -79
- package/hocs/withSkeleton.js +8 -13
- package/hooks/index.js +6 -6
- package/hooks/useDebouncedFunction.js +5 -37
- package/hooks/useFocusTrap.js +22 -25
- package/hooks/useForkRef.js +5 -5
- package/hooks/useIsomorphicLayoutEffect.js +3 -3
- package/hooks/useResizeObserver.js +9 -9
- package/hooks/useUniqId.js +8 -54
- package/mixins/addFocus.js +19 -24
- package/mixins/applyDisabled.js +7 -10
- package/mixins/applyEllipsis.js +3 -5
- package/mixins/applyMaxLines.js +4 -7
- package/mixins/applyNoSelect.js +3 -5
- package/mixins/applyOutline.js +3 -5
- package/mixins/applyRoundness.js +5 -8
- package/mixins/applyScrollSnap.js +5 -8
- package/mixins/applySkeletonGradient.js +8 -11
- package/mixins/applyView.js +3 -6
- package/mixins/blur.js +2 -5
- package/mixins/index.js +11 -11
- package/mixins/shadows.js +1 -1
- package/package.json +13 -18
- package/tokens/colors.js +48 -48
- package/tokens/typography.js +18 -18
- package/utils/__tests__/formatters.test.js +3 -3
- package/utils/animatedScrollTo.js +24 -34
- package/utils/canUseDOM.js +1 -1
- package/utils/extractTextFrom.js +4 -8
- package/utils/focusManager.js +41 -48
- package/utils/formatCurrency.js +4 -4
- package/utils/formatters.js +6 -14
- package/utils/index.js +10 -10
- package/utils/react.js +7 -7
- package/utils/roundness.js +2 -4
- package/utils/scopeTab.js +6 -6
- package/utils/setRef.js +1 -1
- package/utils/tabbable.js +16 -25
- package/utils/toCssSize.js +1 -3
- package/utils/transformStyles.js +5 -60
package/hooks/useFocusTrap.js
CHANGED
|
@@ -8,13 +8,13 @@ Object.defineProperty(exports, "useFocusTrap", {
|
|
|
8
8
|
return useFocusTrap;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const _react = require("react");
|
|
12
|
+
const _focusManager = require("../utils/focusManager");
|
|
13
|
+
const _tabbable = require("../utils/tabbable");
|
|
14
|
+
const _scopeTab = require("../utils/scopeTab");
|
|
15
15
|
// Находим элемент для фокуса
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const getFocusElement = (node, firstFocusSelector)=>{
|
|
17
|
+
let focusElement = null;
|
|
18
18
|
if (firstFocusSelector) {
|
|
19
19
|
if (typeof firstFocusSelector === 'string') {
|
|
20
20
|
focusElement = node.querySelector(firstFocusSelector);
|
|
@@ -23,10 +23,8 @@ var getFocusElement = function getFocusElement(node, firstFocusSelector) {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
if (!focusElement) {
|
|
26
|
-
|
|
27
|
-
focusElement = children.find(
|
|
28
|
-
return (0, _tabbable.isTabble)(el);
|
|
29
|
-
}) || null;
|
|
26
|
+
const children = Array.from(node.querySelectorAll(_tabbable.focusSelector));
|
|
27
|
+
focusElement = children.find((el)=>(0, _tabbable.isTabble)(el)) || null;
|
|
30
28
|
}
|
|
31
29
|
// Если ничего не нашлось, то может ли сама нода быть под фокусом
|
|
32
30
|
if (!focusElement && (0, _tabbable.isFocusable)(node)) {
|
|
@@ -34,22 +32,21 @@ var getFocusElement = function getFocusElement(node, firstFocusSelector) {
|
|
|
34
32
|
}
|
|
35
33
|
return focusElement;
|
|
36
34
|
};
|
|
37
|
-
|
|
38
|
-
if (ref
|
|
39
|
-
ref.current.removeEventListener('animationend',
|
|
35
|
+
const processNode = (node, firstFocusSelector, ref)=>{
|
|
36
|
+
if (ref?.current) {
|
|
37
|
+
ref.current.removeEventListener('animationend', ()=>{
|
|
40
38
|
processNode(node, firstFocusSelector, ref);
|
|
41
39
|
});
|
|
42
40
|
}
|
|
43
|
-
|
|
41
|
+
const focusElement = getFocusElement(node, firstFocusSelector);
|
|
44
42
|
if (focusElement) {
|
|
45
43
|
focusElement.focus();
|
|
46
44
|
}
|
|
47
45
|
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
var setRef = (0, _react.useCallback)(function(node) {
|
|
46
|
+
const focusManager = new _focusManager.FocusManager();
|
|
47
|
+
const useFocusTrap = (active = true, firstFocusSelector, focusAfterNode, focusAfterAnimation)=>{
|
|
48
|
+
const ref = (0, _react.useRef)();
|
|
49
|
+
const setRef = (0, _react.useCallback)((node)=>{
|
|
53
50
|
if (ref.current) {
|
|
54
51
|
focusManager.teardownScopedFocus();
|
|
55
52
|
focusManager.returnFocus();
|
|
@@ -58,9 +55,9 @@ var useFocusTrap = function useFocusTrap() {
|
|
|
58
55
|
focusManager.setupScopedFocus(node);
|
|
59
56
|
focusManager.markForFocusAfter(focusAfterNode);
|
|
60
57
|
// Delay processing the HTML node by a frame. This ensures focus is assigned correctly.
|
|
61
|
-
setTimeout(
|
|
62
|
-
if (
|
|
63
|
-
ref.current.addEventListener('animationend',
|
|
58
|
+
setTimeout(()=>{
|
|
59
|
+
if (ref?.current && node.ownerDocument && focusAfterAnimation) {
|
|
60
|
+
ref.current.addEventListener('animationend', ()=>{
|
|
64
61
|
processNode(node, firstFocusSelector, ref);
|
|
65
62
|
});
|
|
66
63
|
} else if (node.ownerDocument) {
|
|
@@ -75,17 +72,17 @@ var useFocusTrap = function useFocusTrap() {
|
|
|
75
72
|
active,
|
|
76
73
|
firstFocusSelector
|
|
77
74
|
]);
|
|
78
|
-
(0, _react.useEffect)(
|
|
75
|
+
(0, _react.useEffect)(()=>{
|
|
79
76
|
if (!active) {
|
|
80
77
|
return;
|
|
81
78
|
}
|
|
82
|
-
|
|
79
|
+
const handleKeyDown = (event)=>{
|
|
83
80
|
if (event.key === 'Tab' && ref.current) {
|
|
84
81
|
(0, _scopeTab.scopeTab)(ref.current, event);
|
|
85
82
|
}
|
|
86
83
|
};
|
|
87
84
|
document.addEventListener('keydown', handleKeyDown);
|
|
88
|
-
return
|
|
85
|
+
return ()=>{
|
|
89
86
|
document.removeEventListener('keydown', handleKeyDown);
|
|
90
87
|
};
|
|
91
88
|
}, [
|
package/hooks/useForkRef.js
CHANGED
|
@@ -8,19 +8,19 @@ Object.defineProperty(exports, "useForkRef", {
|
|
|
8
8
|
return useForkRef;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
|
|
12
|
+
const _utils = require("../utils");
|
|
13
13
|
function _interop_require_default(obj) {
|
|
14
14
|
return obj && obj.__esModule ? obj : {
|
|
15
15
|
default: obj
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
return _react.default.useMemo(
|
|
18
|
+
const useForkRef = (refOne, refTwo)=>{
|
|
19
|
+
return _react.default.useMemo(()=>{
|
|
20
20
|
if (refOne == null && refTwo === null) {
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
23
|
-
return
|
|
23
|
+
return (refOb)=>{
|
|
24
24
|
(0, _utils.setRef)(refOne, refOb);
|
|
25
25
|
(0, _utils.setRef)(refTwo, refOb);
|
|
26
26
|
};
|
|
@@ -8,6 +8,6 @@ Object.defineProperty(exports, "useIsomorphicLayoutEffect", {
|
|
|
8
8
|
return useIsomorphicLayoutEffect;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const _react = require("react");
|
|
12
|
+
const _utils = require("../utils");
|
|
13
|
+
const useIsomorphicLayoutEffect = _utils.canUseDOM ? _react.useLayoutEffect : _react.useEffect;
|
|
@@ -8,21 +8,21 @@ Object.defineProperty(exports, "useResizeObserver", {
|
|
|
8
8
|
return useResizeObserver;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
(0, _react.useEffect)(
|
|
14
|
-
/* istanbul ignore if: убираем проверку на рефы из покрытия */ if (!
|
|
11
|
+
const _react = require("react");
|
|
12
|
+
const useResizeObserver = (ref, callback)=>{
|
|
13
|
+
(0, _react.useEffect)(()=>{
|
|
14
|
+
/* istanbul ignore if: убираем проверку на рефы из покрытия */ if (!ref?.current) {
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
window.requestAnimationFrame(
|
|
17
|
+
const { current } = ref;
|
|
18
|
+
const resizeObserver = new window.ResizeObserver(()=>{
|
|
19
|
+
window.requestAnimationFrame(()=>{
|
|
20
20
|
callback(current);
|
|
21
21
|
});
|
|
22
22
|
});
|
|
23
23
|
resizeObserver.observe(ref.current);
|
|
24
|
-
return
|
|
25
|
-
/* istanbul ignore if: убираем проверку на рефы из покрытия */ if (!
|
|
24
|
+
return ()=>{
|
|
25
|
+
/* istanbul ignore if: убираем проверку на рефы из покрытия */ if (!ref?.current) {
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
resizeObserver.unobserve(ref.current);
|
package/hooks/useUniqId.js
CHANGED
|
@@ -8,62 +8,16 @@ Object.defineProperty(exports, "useUniqId", {
|
|
|
8
8
|
return useUniqId;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
15
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
16
|
-
return arr2;
|
|
17
|
-
}
|
|
18
|
-
function _array_with_holes(arr) {
|
|
19
|
-
if (Array.isArray(arr)) return arr;
|
|
20
|
-
}
|
|
21
|
-
function _iterable_to_array_limit(arr, i) {
|
|
22
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
23
|
-
if (_i == null) return;
|
|
24
|
-
var _arr = [];
|
|
25
|
-
var _n = true;
|
|
26
|
-
var _d = false;
|
|
27
|
-
var _s, _e;
|
|
28
|
-
try {
|
|
29
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
30
|
-
_arr.push(_s.value);
|
|
31
|
-
if (i && _arr.length === i) break;
|
|
32
|
-
}
|
|
33
|
-
} catch (err) {
|
|
34
|
-
_d = true;
|
|
35
|
-
_e = err;
|
|
36
|
-
} finally{
|
|
37
|
-
try {
|
|
38
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
39
|
-
} finally{
|
|
40
|
-
if (_d) throw _e;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return _arr;
|
|
44
|
-
}
|
|
45
|
-
function _non_iterable_rest() {
|
|
46
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
47
|
-
}
|
|
48
|
-
function _sliced_to_array(arr, i) {
|
|
49
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
50
|
-
}
|
|
51
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
52
|
-
if (!o) return;
|
|
53
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
54
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
55
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
56
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
57
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
58
|
-
}
|
|
59
|
-
var noSSRId = 0;
|
|
11
|
+
const _react = require("react");
|
|
12
|
+
const _SSRProvider = require("../components/SSRProvider");
|
|
13
|
+
let noSSRId = 0;
|
|
60
14
|
function useUniqId() {
|
|
61
|
-
|
|
62
|
-
|
|
15
|
+
const context = (0, _react.useContext)(_SSRProvider.SSRContext);
|
|
16
|
+
const [id] = (0, _react.useState)(()=>{
|
|
63
17
|
if (context.uniqId !== null) {
|
|
64
|
-
return
|
|
18
|
+
return `plasma-uniq-id-ssr-${++context.uniqId}`;
|
|
65
19
|
}
|
|
66
|
-
return
|
|
67
|
-
})
|
|
20
|
+
return `plasma-uniq-id-${++noSSRId}`;
|
|
21
|
+
});
|
|
68
22
|
return id;
|
|
69
23
|
}
|
package/mixins/addFocus.js
CHANGED
|
@@ -16,31 +16,26 @@ _export(exports, {
|
|
|
16
16
|
return syntheticFocus;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const _styledcomponents = require("styled-components");
|
|
20
|
+
const _tokens = require("../tokens");
|
|
21
21
|
require("focus-visible");
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
";"
|
|
22
|
+
const syntheticFocus = (ruleset, focused)=>(0, _styledcomponents.css)([
|
|
23
|
+
`&.focus-visible:focus,&[data-focus-visible-added]{outline:none;`,
|
|
24
|
+
`}`,
|
|
25
|
+
`;`
|
|
27
26
|
], ruleset, focused && ruleset);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
";transition:",
|
|
39
|
-
";pointer-events:none;}",
|
|
40
|
-
""
|
|
27
|
+
const addFocus = ({ lowPerformance, focused, outlined = true, outlineSize = '0.125rem', outlineOffset = outlineSize, outlineColor = _tokens.buttonFocused, outlineRadius = 0, synthesizeFocus = syntheticFocus })=>outlined && (0, _styledcomponents.css)([
|
|
28
|
+
`position:relative;&::before{content:'';position:absolute;top:-`,
|
|
29
|
+
`;left:-`,
|
|
30
|
+
`;right:-`,
|
|
31
|
+
`;bottom:-`,
|
|
32
|
+
`;display:block;box-sizing:content-box;border:`,
|
|
33
|
+
` solid transparent;border-radius:`,
|
|
34
|
+
`;transition:`,
|
|
35
|
+
`;pointer-events:none;}`,
|
|
36
|
+
``
|
|
41
37
|
], outlineOffset, outlineOffset, outlineOffset, outlineOffset, outlineSize, outlineRadius, lowPerformance ? 'unset' : 'box-shadow 0.2s ease-in-out', synthesizeFocus((0, _styledcomponents.css)([
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
`&::before{box-shadow:0 0 0 `,
|
|
39
|
+
` `,
|
|
40
|
+
`;}`
|
|
45
41
|
], outlineSize, outlineColor), focused));
|
|
46
|
-
};
|
package/mixins/applyDisabled.js
CHANGED
|
@@ -8,15 +8,12 @@ Object.defineProperty(exports, "applyDisabled", {
|
|
|
8
8
|
return applyDisabled;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const _styledcomponents = require("styled-components");
|
|
12
|
+
const disabledCss = (0, _styledcomponents.css)([
|
|
13
|
+
`opacity:0.4;cursor:not-allowed;&:hover,&:active{transform:none;}`
|
|
14
14
|
]);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"}",
|
|
20
|
-
""
|
|
15
|
+
const applyDisabled = ({ disabled, $disabled })=>(0, _styledcomponents.css)([
|
|
16
|
+
`&:disabled{`,
|
|
17
|
+
`}`,
|
|
18
|
+
``
|
|
21
19
|
], disabledCss, (disabled || $disabled) && disabledCss);
|
|
22
|
-
};
|
package/mixins/applyEllipsis.js
CHANGED
|
@@ -8,9 +8,7 @@ Object.defineProperty(exports, "applyEllipsis", {
|
|
|
8
8
|
return applyEllipsis;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"
|
|
11
|
+
const _styledcomponents = require("styled-components");
|
|
12
|
+
const applyEllipsis = ()=>(0, _styledcomponents.css)([
|
|
13
|
+
`overflow:hidden;text-overflow:ellipsis;white-space:nowrap;`
|
|
15
14
|
]);
|
|
16
|
-
};
|
package/mixins/applyMaxLines.js
CHANGED
|
@@ -8,11 +8,8 @@ Object.defineProperty(exports, "applyMaxLines", {
|
|
|
8
8
|
return applyMaxLines;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"display:-webkit-box;overflow:hidden;box-sizing:border-box;white-space:normal;-webkit-box-orient:vertical;-webkit-line-clamp:",
|
|
16
|
-
";"
|
|
11
|
+
const _styledcomponents = require("styled-components");
|
|
12
|
+
const applyMaxLines = ({ maxLines })=>maxLines && (0, _styledcomponents.css)([
|
|
13
|
+
`display:-webkit-box;overflow:hidden;box-sizing:border-box;white-space:normal;-webkit-box-orient:vertical;-webkit-line-clamp:`,
|
|
14
|
+
`;`
|
|
17
15
|
], maxLines);
|
|
18
|
-
};
|
package/mixins/applyNoSelect.js
CHANGED
|
@@ -8,9 +8,7 @@ Object.defineProperty(exports, "applyNoSelect", {
|
|
|
8
8
|
return applyNoSelect;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);"
|
|
11
|
+
const _styledcomponents = require("styled-components");
|
|
12
|
+
const applyNoSelect = ()=>(0, _styledcomponents.css)([
|
|
13
|
+
`user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);`
|
|
15
14
|
]);
|
|
16
|
-
};
|
package/mixins/applyOutline.js
CHANGED
|
@@ -8,9 +8,7 @@ Object.defineProperty(exports, "applyOutline", {
|
|
|
8
8
|
return applyOutline;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"position:relative;&::before{content:'';position:absolute;top:var(--plasma-outline-offset);left:var(--plasma-outline-offset);right:var(--plasma-outline-offset);bottom:var(--plasma-outline-offset);display:block;box-sizing:border-box;border:var(--plasma-outline-offset) solid transparent;border-radius:var(--plasma-outline-radius);transition:box-shadow 0.2s ease-in-out;pointer-events:none;}&:focus::before{box-shadow:0 0 0 var(--plasma-outline-size) var(--plasma-outline-radius);}"
|
|
11
|
+
const _styledcomponents = require("styled-components");
|
|
12
|
+
const applyOutline = ()=>(0, _styledcomponents.css)([
|
|
13
|
+
`position:relative;&::before{content:'';position:absolute;top:var(--plasma-outline-offset);left:var(--plasma-outline-offset);right:var(--plasma-outline-offset);bottom:var(--plasma-outline-offset);display:block;box-sizing:border-box;border:var(--plasma-outline-offset) solid transparent;border-radius:var(--plasma-outline-radius);transition:box-shadow 0.2s ease-in-out;pointer-events:none;}&:focus::before{box-shadow:0 0 0 var(--plasma-outline-size) var(--plasma-outline-radius);}`
|
|
15
14
|
]);
|
|
16
|
-
};
|
package/mixins/applyRoundness.js
CHANGED
|
@@ -16,8 +16,8 @@ _export(exports, {
|
|
|
16
16
|
return radiuses;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const _styledcomponents = require("styled-components");
|
|
20
|
+
const radiuses = {
|
|
21
21
|
250: 15.625,
|
|
22
22
|
32: 2,
|
|
23
23
|
28: 1.75,
|
|
@@ -30,10 +30,7 @@ var radiuses = {
|
|
|
30
30
|
8: 0.5,
|
|
31
31
|
0: 0
|
|
32
32
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"border-radius:",
|
|
37
|
-
"rem;"
|
|
33
|
+
const applyRoundness = ({ roundness })=>(0, _styledcomponents.css)([
|
|
34
|
+
`border-radius:`,
|
|
35
|
+
`rem;`
|
|
38
36
|
], radiuses[roundness]);
|
|
39
|
-
};
|
|
@@ -8,12 +8,9 @@ Object.defineProperty(exports, "applyScrollSnap", {
|
|
|
8
8
|
return applyScrollSnap;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
";scroll-snap-stop:",
|
|
17
|
-
";"
|
|
11
|
+
const _styledcomponents = require("styled-components");
|
|
12
|
+
const applyScrollSnap = ({ scrollSnapAlign, scrollSnapStop })=>scrollSnapAlign && (0, _styledcomponents.css)([
|
|
13
|
+
`scroll-snap-align:`,
|
|
14
|
+
`;scroll-snap-stop:`,
|
|
15
|
+
`;`
|
|
18
16
|
], scrollSnapAlign, scrollSnapStop);
|
|
19
|
-
};
|
|
@@ -8,16 +8,13 @@ Object.defineProperty(exports, "applySkeletonGradient", {
|
|
|
8
8
|
return applySkeletonGradient;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const _styledcomponents = require("styled-components");
|
|
12
|
+
const _tokens = require("../tokens");
|
|
13
|
+
const loading = (0, _styledcomponents.keyframes)([
|
|
14
|
+
`from{transform:translateX(0);}to{transform:translateX(100vw);}`
|
|
15
15
|
]);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
" 4s linear infinite;background-image:",
|
|
21
|
-
";top:0;left:-100vw;width:200vw;height:100%;}"
|
|
16
|
+
const applySkeletonGradient = ({ lighter })=>(0, _styledcomponents.css)([
|
|
17
|
+
`position:relative;overflow:hidden;z-index:1;&::before{content:'';position:absolute;animation:`,
|
|
18
|
+
` 4s linear infinite;background-image:`,
|
|
19
|
+
`;top:0;left:-100vw;width:200vw;height:100%;}`
|
|
22
20
|
], loading, lighter ? _tokens.skeletonGradientLighter : _tokens.skeletonGradient);
|
|
23
|
-
};
|
package/mixins/applyView.js
CHANGED
|
@@ -16,8 +16,8 @@ _export(exports, {
|
|
|
16
16
|
return views;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const _tokens = require("../tokens");
|
|
20
|
+
const views = {
|
|
21
21
|
accent: {
|
|
22
22
|
backgroundColor: _tokens.accent,
|
|
23
23
|
color: _tokens.white
|
|
@@ -57,7 +57,4 @@ var views = {
|
|
|
57
57
|
color: _tokens.white
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
|
-
|
|
61
|
-
var view = param.view;
|
|
62
|
-
return views[view];
|
|
63
|
-
};
|
|
60
|
+
const applyView = ({ view })=>views[view];
|
package/mixins/blur.js
CHANGED
|
@@ -16,12 +16,9 @@ _export(exports, {
|
|
|
16
16
|
return blurs;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
|
|
19
|
+
const blurs = {
|
|
20
20
|
small: '27px',
|
|
21
21
|
medium: '37px',
|
|
22
22
|
large: '50px'
|
|
23
23
|
};
|
|
24
|
-
|
|
25
|
-
var blur = param.blur;
|
|
26
|
-
return blur && "backdrop-filter: blur(".concat(blurs[blur], ");");
|
|
27
|
-
};
|
|
24
|
+
const applyBlur = ({ blur })=>blur && `backdrop-filter: blur(${blurs[blur]});`;
|
package/mixins/index.js
CHANGED
|
@@ -61,18 +61,18 @@ _export(exports, {
|
|
|
61
61
|
return _applyView.views;
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
64
|
+
const _addFocus = require("./addFocus");
|
|
65
|
+
const _blur = require("./blur");
|
|
66
|
+
const _applyDisabled = require("./applyDisabled");
|
|
67
|
+
const _applyEllipsis = require("./applyEllipsis");
|
|
68
|
+
const _applyMaxLines = require("./applyMaxLines");
|
|
69
|
+
const _applyNoSelect = require("./applyNoSelect");
|
|
70
|
+
const _applyRoundness = require("./applyRoundness");
|
|
71
|
+
const _applySkeletonGradient = require("./applySkeletonGradient");
|
|
72
|
+
const _applyView = require("./applyView");
|
|
73
|
+
const _applyScrollSnap = require("./applyScrollSnap");
|
|
74
74
|
_export_star(require("./shadows"), exports);
|
|
75
|
-
|
|
75
|
+
const _plasmatypo = require("@salutejs/plasma-typo");
|
|
76
76
|
function _export_star(from, to) {
|
|
77
77
|
Object.keys(from).forEach(function(k) {
|
|
78
78
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
package/mixins/shadows.js
CHANGED
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "shadows", {
|
|
|
8
8
|
return shadows;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
11
|
+
const shadows = {
|
|
12
12
|
tiny: '0 1px 1px rgba(0, 0, 0, 0.11)',
|
|
13
13
|
small: '0 1px 4px rgba(0, 0, 0, 0.05)',
|
|
14
14
|
medium: '0 1px 1px rgba(0, 0, 0, 0.05), 0 4px 14px rgba(0, 0, 0, 0.08)'
|
package/package.json
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salutejs/plasma-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.227.0-dev.0",
|
|
4
4
|
"description": "Core library for Plasma: Salute Design System.",
|
|
5
5
|
"author": "Salute Frontend Team <salute.developers@gmail.com>",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
6
9
|
"license": "MIT",
|
|
7
10
|
"main": "index.js",
|
|
8
11
|
"module": "es/index.js",
|
|
9
12
|
"types": "index.d.ts",
|
|
13
|
+
"peerDependencies": {
|
|
14
|
+
"react": ">=16.13.1",
|
|
15
|
+
"react-dom": ">=16.13.1",
|
|
16
|
+
"styled-components": "^5.3.1"
|
|
17
|
+
},
|
|
10
18
|
"dependencies": {
|
|
11
19
|
"@popperjs/core": "2.9.2",
|
|
12
|
-
"@salutejs/plasma-typo": "0.
|
|
20
|
+
"@salutejs/plasma-typo": "0.43.0-dev.0",
|
|
13
21
|
"focus-visible": "5.2.0",
|
|
14
22
|
"lodash.throttle": "4.1.1",
|
|
15
23
|
"react-draggable": "4.4.3",
|
|
@@ -23,8 +31,7 @@
|
|
|
23
31
|
"@babel/preset-env": "7.24.4",
|
|
24
32
|
"@babel/preset-react": "7.24.1",
|
|
25
33
|
"@babel/preset-typescript": "7.24.1",
|
|
26
|
-
"@
|
|
27
|
-
"@salutejs/plasma-cy-utils": "0.156.0-next-platform-ai.0",
|
|
34
|
+
"@salutejs/plasma-cy-utils": "0.157.0-dev.0",
|
|
28
35
|
"@types/jest": "27.0.1",
|
|
29
36
|
"@types/lodash.throttle": "4.1.6",
|
|
30
37
|
"@types/node": "15.14.9",
|
|
@@ -44,17 +51,7 @@
|
|
|
44
51
|
"ts-node": "10.2.1",
|
|
45
52
|
"typescript-coverage-report": "0.7.0"
|
|
46
53
|
},
|
|
47
|
-
"peerDependencies": {
|
|
48
|
-
"react": ">=16.13.1",
|
|
49
|
-
"react-dom": ">=16.13.1",
|
|
50
|
-
"styled-components": "^5.1.1"
|
|
51
|
-
},
|
|
52
|
-
"publishConfig": {
|
|
53
|
-
"access": "public"
|
|
54
|
-
},
|
|
55
54
|
"scripts": {
|
|
56
|
-
"preapi-report": "npm run generate:typings",
|
|
57
|
-
"api-report": "npx api-extractor run --local",
|
|
58
55
|
"prepare": "npm run build",
|
|
59
56
|
"prebuild": "rm -rf ./components ./es ./hocs ./hooks ./mixins ./tokens ./types ./utils index.js index.js.map index.d.ts index.d.ts.map",
|
|
60
57
|
"build": "npm run build:cjs && npm run build:esm",
|
|
@@ -75,10 +72,8 @@
|
|
|
75
72
|
"atLeast": 99
|
|
76
73
|
},
|
|
77
74
|
"contributors": [
|
|
78
|
-
"
|
|
79
|
-
"Виноградов Антон Александрович",
|
|
80
|
-
"Зубаиров Фаниль Асхатович"
|
|
75
|
+
"salute.developers@gmail.com"
|
|
81
76
|
],
|
|
82
77
|
"sideEffects": false,
|
|
83
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "bc2c961568e44fb73f80cb9d379a6ffee4f72ded"
|
|
84
79
|
}
|