@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.
- 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
|
@@ -1,182 +1,44 @@
|
|
|
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
2
|
import styled, { css } from 'styled-components';
|
|
119
3
|
import { applyDisabled } from '../../mixins';
|
|
120
4
|
import { StyledTabItem } from './TabItem';
|
|
121
|
-
export
|
|
5
|
+
export const StyledTabs = styled.div.withConfig({
|
|
122
6
|
displayName: "Tabs__StyledTabs",
|
|
123
7
|
componentId: "sc-c62b2a-0"
|
|
124
8
|
})([
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
],
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
]);
|
|
132
|
-
});
|
|
133
|
-
export var StyledWrapper = styled.div.withConfig({
|
|
9
|
+
`position:relative;display:inline-flex;align-items:center;box-sizing:border-box;flex-wrap:nowrap;justify-content:stretch;padding:0;margin:0;width:max-content;list-style-type:none;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);`,
|
|
10
|
+
` gap:inherit;`
|
|
11
|
+
], ({ stretch = false })=>!stretch && css([
|
|
12
|
+
`margin:0 var(--tabs-margin);`
|
|
13
|
+
]));
|
|
14
|
+
export const StyledWrapper = styled.div.withConfig({
|
|
134
15
|
displayName: "Tabs__StyledWrapper",
|
|
135
16
|
componentId: "sc-c62b2a-1"
|
|
136
17
|
})([
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
], StyledTabs, applyDisabled,
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
],
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
return !stretch && css([
|
|
154
|
-
"margin-left:calc(var(--tabs-margin) * -1 + var(--tab-focus-border-size) * -1);margin-right:calc(var(--tabs-margin) * -1);"
|
|
155
|
-
]);
|
|
156
|
-
}, StyledTabItem, function(param) {
|
|
157
|
-
var disabled = param.disabled;
|
|
158
|
-
return disabled && css([
|
|
159
|
-
"cursor:not-allowed;"
|
|
160
|
-
]);
|
|
161
|
-
});
|
|
18
|
+
`overflow-x:auto;margin-left:calc(var(--tab-focus-border-size) * -1);margin-top:calc(var(--tab-focus-border-size) * -2);padding:var(--tab-focus-border-size);transform:translateY(var(--tab-focus-border-size));&::-webkit-scrollbar{display:none;}`,
|
|
19
|
+
`{`,
|
|
20
|
+
`}`,
|
|
21
|
+
` `,
|
|
22
|
+
` `,
|
|
23
|
+
`{`,
|
|
24
|
+
`}gap:0.125rem;`
|
|
25
|
+
], StyledTabs, applyDisabled, ({ stretch })=>stretch && css([
|
|
26
|
+
`width:100%;`,
|
|
27
|
+
`{width:100%;}`,
|
|
28
|
+
`{flex:1 1 calc((100% / 4) - 0.125rem);}`
|
|
29
|
+
], StyledTabs, StyledTabItem), ({ stretch = false })=>!stretch && css([
|
|
30
|
+
`margin-left:calc(var(--tabs-margin) * -1 + var(--tab-focus-border-size) * -1);margin-right:calc(var(--tabs-margin) * -1);`
|
|
31
|
+
]), StyledTabItem, ({ disabled })=>disabled && css([
|
|
32
|
+
`cursor:not-allowed;`
|
|
33
|
+
]));
|
|
162
34
|
/**
|
|
163
35
|
* Контейнер вкладок.
|
|
164
|
-
*/ export
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
], _ref1 = _to_array(_ref), _ref2 = _ref1[0], _rest = _ref1.slice(1), _ref_role = _ref2.role, role = _ref_role === void 0 ? 'tablist' : _ref_role, as = _ref2.as, children = _ref2.children, stretch = _ref2.stretch, rest = _object_without_properties(_ref2, [
|
|
169
|
-
"role",
|
|
170
|
-
"as",
|
|
171
|
-
"children",
|
|
172
|
-
"stretch"
|
|
173
|
-
]), _rest1 = _sliced_to_array(_rest, 1), ref = _rest1[0];
|
|
174
|
-
return /*#__PURE__*/ React.createElement(StyledWrapper, _object_spread({
|
|
175
|
-
stretch: stretch
|
|
176
|
-
}, rest), /*#__PURE__*/ React.createElement(StyledTabs, {
|
|
36
|
+
*/ export const Tabs = /*#__PURE__*/ React.forwardRef(({ role = 'tablist', as, children, stretch, ...rest }, ref)=>/*#__PURE__*/ React.createElement(StyledWrapper, {
|
|
37
|
+
stretch: stretch,
|
|
38
|
+
...rest
|
|
39
|
+
}, /*#__PURE__*/ React.createElement(StyledTabs, {
|
|
177
40
|
as: as,
|
|
178
41
|
ref: ref,
|
|
179
42
|
role: role,
|
|
180
43
|
stretch: stretch
|
|
181
|
-
}, children));
|
|
182
|
-
});
|
|
44
|
+
}, children)));
|
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
function _class_call_check(instance, Constructor) {
|
|
2
|
-
if (!(instance instanceof Constructor)) {
|
|
3
|
-
throw new TypeError("Cannot call a class as a function");
|
|
4
|
-
}
|
|
5
|
-
}
|
|
6
|
-
function _defineProperties(target, props) {
|
|
7
|
-
for(var i = 0; i < props.length; i++){
|
|
8
|
-
var descriptor = props[i];
|
|
9
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
10
|
-
descriptor.configurable = true;
|
|
11
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
12
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
16
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
17
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
18
|
-
return Constructor;
|
|
19
|
-
}
|
|
20
1
|
function _define_property(obj, key, value) {
|
|
21
2
|
if (key in obj) {
|
|
22
3
|
Object.defineProperty(obj, key, {
|
|
@@ -31,27 +12,16 @@ function _define_property(obj, key, value) {
|
|
|
31
12
|
return obj;
|
|
32
13
|
}
|
|
33
14
|
import { createContext } from 'react';
|
|
34
|
-
export
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
15
|
+
export class TabItemRefs {
|
|
16
|
+
register(ref) {
|
|
17
|
+
this.items.push(ref);
|
|
18
|
+
return this.items.length - 1;
|
|
19
|
+
}
|
|
20
|
+
unregister(ref) {
|
|
21
|
+
this.items.splice(this.items.indexOf(ref), 1);
|
|
22
|
+
}
|
|
23
|
+
constructor(){
|
|
38
24
|
_define_property(this, "items", []);
|
|
39
25
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
key: "register",
|
|
43
|
-
value: function register(ref) {
|
|
44
|
-
this.items.push(ref);
|
|
45
|
-
return this.items.length - 1;
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
key: "unregister",
|
|
50
|
-
value: function unregister(ref) {
|
|
51
|
-
this.items.splice(this.items.indexOf(ref), 1);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
]);
|
|
55
|
-
return TabItemRefs;
|
|
56
|
-
}();
|
|
57
|
-
export var TabsContext = /*#__PURE__*/ createContext(null);
|
|
26
|
+
}
|
|
27
|
+
export const TabsContext = /*#__PURE__*/ createContext(null);
|
|
@@ -1,119 +1,3 @@
|
|
|
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, { forwardRef, useMemo, useCallback, useRef } from 'react';
|
|
118
2
|
import { useForkRef } from '../../hooks';
|
|
119
3
|
import { TabItemRefs, TabsContext } from './TabsContext';
|
|
@@ -129,47 +13,31 @@ var Keys = /*#__PURE__*/ function(Keys) {
|
|
|
129
13
|
/**
|
|
130
14
|
* Функция для создания `TabController`, которая дает возможность
|
|
131
15
|
* кастомизировать стили, при этом сохраняя единый интерфейс и функционал.
|
|
132
|
-
*/ export function createTabsController() {
|
|
133
|
-
var ListComponent = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Tabs, ItemComponent = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : TabItem;
|
|
16
|
+
*/ export function createTabsController(ListComponent = Tabs, ItemComponent = TabItem) {
|
|
134
17
|
// eslint-disable-next-line prefer-arrow-callback
|
|
135
|
-
return /*#__PURE__*/ forwardRef(function TabsController(
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
"index",
|
|
142
|
-
"autoscroll",
|
|
143
|
-
"onIndexChange"
|
|
144
|
-
]), _rest1 = _sliced_to_array(_rest, 1), outerRef = _rest1[0];
|
|
145
|
-
var disabled = rest.disabled;
|
|
146
|
-
var refs = useMemo(function() {
|
|
147
|
-
return new TabItemRefs();
|
|
148
|
-
}, []);
|
|
149
|
-
var innerRef = useRef(null);
|
|
150
|
-
var ref = useForkRef(outerRef, innerRef);
|
|
151
|
-
var onItemFocus = useCallback(function(event) {
|
|
152
|
-
var _innerRef_current;
|
|
18
|
+
return /*#__PURE__*/ forwardRef(function TabsController({ items, index, autoscroll, onIndexChange, ...rest }, outerRef) {
|
|
19
|
+
const { disabled } = rest;
|
|
20
|
+
const refs = useMemo(()=>new TabItemRefs(), []);
|
|
21
|
+
const innerRef = useRef(null);
|
|
22
|
+
const ref = useForkRef(outerRef, innerRef);
|
|
23
|
+
const onItemFocus = useCallback((event)=>{
|
|
153
24
|
if (disabled) {
|
|
154
25
|
return;
|
|
155
26
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
});
|
|
159
|
-
var focusItem = refs.items[focusIndex];
|
|
27
|
+
const focusIndex = refs.items.findIndex((itemRef)=>itemRef.current === event.target);
|
|
28
|
+
const focusItem = refs.items[focusIndex];
|
|
160
29
|
if (focusIndex === index) {
|
|
161
30
|
return;
|
|
162
31
|
}
|
|
163
|
-
onIndexChange
|
|
164
|
-
|
|
165
|
-
if (autoscroll && parent &&
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
var marginRight = Number.parseInt(style.marginRight, 10);
|
|
32
|
+
onIndexChange?.(focusIndex);
|
|
33
|
+
const parent = innerRef.current?.parentNode;
|
|
34
|
+
if (autoscroll && parent && focusItem?.current) {
|
|
35
|
+
const { x, width } = focusItem.current?.getBoundingClientRect();
|
|
36
|
+
const { x: parentX, width: parentWidth } = parent.getBoundingClientRect();
|
|
37
|
+
const relativeX = x - parentX;
|
|
38
|
+
const style = window.getComputedStyle(parent);
|
|
39
|
+
const marginLeft = Number.parseInt(style.marginLeft, 10);
|
|
40
|
+
const marginRight = Number.parseInt(style.marginRight, 10);
|
|
173
41
|
if (relativeX < -marginLeft) {
|
|
174
42
|
parent.scrollLeft += relativeX + marginLeft;
|
|
175
43
|
return;
|
|
@@ -185,13 +53,13 @@ var Keys = /*#__PURE__*/ function(Keys) {
|
|
|
185
53
|
onIndexChange,
|
|
186
54
|
disabled
|
|
187
55
|
]);
|
|
188
|
-
|
|
56
|
+
const onKeyDown = useCallback((event)=>{
|
|
189
57
|
if (disabled) {
|
|
190
58
|
return;
|
|
191
59
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
60
|
+
const minIndex = 0;
|
|
61
|
+
const maxIndex = refs.items.length - 1;
|
|
62
|
+
let nextIndex;
|
|
195
63
|
switch(event.keyCode){
|
|
196
64
|
case 35:
|
|
197
65
|
nextIndex = maxIndex;
|
|
@@ -209,9 +77,8 @@ var Keys = /*#__PURE__*/ function(Keys) {
|
|
|
209
77
|
return;
|
|
210
78
|
}
|
|
211
79
|
if (nextIndex !== index) {
|
|
212
|
-
var _refs_items_nextIndex_current;
|
|
213
80
|
event.preventDefault();
|
|
214
|
-
|
|
81
|
+
refs.items[nextIndex].current?.focus();
|
|
215
82
|
}
|
|
216
83
|
}, [
|
|
217
84
|
index,
|
|
@@ -220,19 +87,17 @@ var Keys = /*#__PURE__*/ function(Keys) {
|
|
|
220
87
|
]);
|
|
221
88
|
return /*#__PURE__*/ React.createElement(TabsContext.Provider, {
|
|
222
89
|
value: refs
|
|
223
|
-
}, /*#__PURE__*/ React.createElement(ListComponent,
|
|
90
|
+
}, /*#__PURE__*/ React.createElement(ListComponent, {
|
|
224
91
|
ref: ref,
|
|
225
|
-
onKeyDown: onKeyDown
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
return /*#__PURE__*/ React.createElement(ItemComponent, {
|
|
92
|
+
onKeyDown: onKeyDown,
|
|
93
|
+
...rest
|
|
94
|
+
}, items.map(({ label, contentLeft }, i)=>/*#__PURE__*/ React.createElement(ItemComponent, {
|
|
229
95
|
key: i,
|
|
230
96
|
isActive: i === index,
|
|
231
97
|
tabIndex: !disabled && i === index ? 0 : -1,
|
|
232
98
|
contentLeft: contentLeft,
|
|
233
99
|
onFocus: onItemFocus,
|
|
234
100
|
disabled: disabled
|
|
235
|
-
}, label);
|
|
236
|
-
})));
|
|
101
|
+
}, label))));
|
|
237
102
|
});
|
|
238
103
|
}
|
|
@@ -1,38 +1,28 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
2
|
import { applyInputStyles } from '../Input/Input.mixins';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var computedWidth = !Number.isNaN(Number(width)) ? "".concat(width, "rem") : width;
|
|
3
|
+
export const applyTextAreaCssProperties = ({ height, width })=>{
|
|
4
|
+
const computedHeight = !Number.isNaN(Number(height)) ? `${height}rem` : height;
|
|
5
|
+
const computedWidth = !Number.isNaN(Number(width)) ? `${width}rem` : width;
|
|
7
6
|
return css([
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
`--plasma-textarea-height:`,
|
|
8
|
+
`;--plasma-textarea-width:`,
|
|
9
|
+
`;`
|
|
11
10
|
], computedHeight, computedWidth);
|
|
12
11
|
};
|
|
13
12
|
/**
|
|
14
13
|
* Base textarea.
|
|
15
|
-
*/ export
|
|
14
|
+
*/ export const TextArea = styled.textarea.withConfig({
|
|
16
15
|
displayName: "TextArea",
|
|
17
16
|
componentId: "sc-c2e61f4e-0"
|
|
18
17
|
})([
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
], applyInputStyles, applyTextAreaCssProperties,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return cols ? 'unset' : 'var(--plasma-textarea-width, 100%)';
|
|
31
|
-
}, function(param) {
|
|
32
|
-
var resize = param.resize, cols = param.cols;
|
|
33
|
-
return css([
|
|
34
|
-
"",
|
|
35
|
-
" ",
|
|
36
|
-
""
|
|
37
|
-
], resize && "resize: ".concat(resize, ";"), resize !== 'both' && resize !== 'horizontal' && !cols && 'min-width: var(--plasma-textarea-width, 100%); max-width: var(--plasma-textarea-width, 100%)');
|
|
38
|
-
});
|
|
18
|
+
``,
|
|
19
|
+
` `,
|
|
20
|
+
` display:block;min-height:3.5rem;height:`,
|
|
21
|
+
`;width:`,
|
|
22
|
+
`;`,
|
|
23
|
+
``
|
|
24
|
+
], applyInputStyles, applyTextAreaCssProperties, ({ rows })=>rows ? 'unset' : 'var(--plasma-textarea-height, 9.375rem)', ({ cols })=>cols ? 'unset' : 'var(--plasma-textarea-width, 100%)', ({ resize, cols })=>css([
|
|
25
|
+
``,
|
|
26
|
+
` `,
|
|
27
|
+
``
|
|
28
|
+
], resize && `resize: ${resize};`, resize !== 'both' && resize !== 'horizontal' && !cols && 'min-width: var(--plasma-textarea-width, 100%); max-width: var(--plasma-textarea-width, 100%)'));
|
|
@@ -3,28 +3,27 @@ import styled from 'styled-components';
|
|
|
3
3
|
import { applyNoSelect } from '../../mixins';
|
|
4
4
|
import { dark02, white } from '../../tokens';
|
|
5
5
|
import { Footnote1 } from '../Typography';
|
|
6
|
-
export
|
|
6
|
+
export const StyledRoot = styled(Footnote1).withConfig({
|
|
7
7
|
displayName: "Toast__StyledRoot",
|
|
8
8
|
componentId: "sc-d40fdfda-0"
|
|
9
9
|
})([
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
`display:inline-flex;align-items:center;padding:0.6875rem 1.25rem;border-radius:1.5rem;background:`,
|
|
11
|
+
`;color:`,
|
|
12
|
+
`;`,
|
|
13
|
+
`;`
|
|
14
14
|
], dark02, white, applyNoSelect);
|
|
15
|
-
|
|
15
|
+
const StyledContent = styled.div.withConfig({
|
|
16
16
|
displayName: "Toast__StyledContent",
|
|
17
17
|
componentId: "sc-d40fdfda-1"
|
|
18
18
|
})([
|
|
19
|
-
|
|
19
|
+
`display:flex;align-items:center;margin-right:0.5rem;`
|
|
20
20
|
]);
|
|
21
21
|
/**
|
|
22
22
|
* Короткие текстовые подсказки.
|
|
23
23
|
* Вызываются только в текущем запущенном приложении как реакция на выполнение действия пользователем.
|
|
24
|
-
*/ export
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var ariaAtomic = false;
|
|
24
|
+
*/ export const Toast = ({ role = 'status', text, contentLeft })=>{
|
|
25
|
+
let ariaLive = 'polite';
|
|
26
|
+
let ariaAtomic = false;
|
|
28
27
|
if (role === 'alert') {
|
|
29
28
|
ariaLive = 'assertive';
|
|
30
29
|
} else if (role === 'status') {
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { createContext } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export const ToastContext = /*#__PURE__*/ createContext({
|
|
3
3
|
text: null,
|
|
4
4
|
position: null,
|
|
5
5
|
timeout: null,
|
|
6
|
-
showToast:
|
|
7
|
-
|
|
8
|
-
},
|
|
9
|
-
hideToast: function hideToast() {
|
|
10
|
-
return undefined;
|
|
11
|
-
}
|
|
6
|
+
showToast: ()=>undefined,
|
|
7
|
+
hideToast: ()=>undefined
|
|
12
8
|
});
|