@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
|
@@ -16,22 +16,9 @@ _export(exports, {
|
|
|
16
16
|
return ThumbBase;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
function _define_property(obj, key, value) {
|
|
23
|
-
if (key in obj) {
|
|
24
|
-
Object.defineProperty(obj, key, {
|
|
25
|
-
value: value,
|
|
26
|
-
enumerable: true,
|
|
27
|
-
configurable: true,
|
|
28
|
-
writable: true
|
|
29
|
-
});
|
|
30
|
-
} else {
|
|
31
|
-
obj[key] = value;
|
|
32
|
-
}
|
|
33
|
-
return obj;
|
|
34
|
-
}
|
|
19
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
20
|
+
const _styledcomponents = /*#__PURE__*/ _interop_require_default(require("styled-components"));
|
|
21
|
+
const _utils = require("./utils");
|
|
35
22
|
function _interop_require_default(obj) {
|
|
36
23
|
return obj && obj.__esModule ? obj : {
|
|
37
24
|
default: obj
|
|
@@ -78,58 +65,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
78
65
|
}
|
|
79
66
|
return newObj;
|
|
80
67
|
}
|
|
81
|
-
|
|
82
|
-
for(var i = 1; i < arguments.length; i++){
|
|
83
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
84
|
-
var ownKeys = Object.keys(source);
|
|
85
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
86
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
87
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
88
|
-
}));
|
|
89
|
-
}
|
|
90
|
-
ownKeys.forEach(function(key) {
|
|
91
|
-
_define_property(target, key, source[key]);
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
return target;
|
|
95
|
-
}
|
|
96
|
-
function _object_without_properties(source, excluded) {
|
|
97
|
-
if (source == null) return {};
|
|
98
|
-
var target = {}, sourceKeys, key, i;
|
|
99
|
-
if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
|
|
100
|
-
sourceKeys = Reflect.ownKeys(source);
|
|
101
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
102
|
-
key = sourceKeys[i];
|
|
103
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
104
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
105
|
-
target[key] = source[key];
|
|
106
|
-
}
|
|
107
|
-
return target;
|
|
108
|
-
}
|
|
109
|
-
target = _object_without_properties_loose(source, excluded);
|
|
110
|
-
if (Object.getOwnPropertySymbols) {
|
|
111
|
-
sourceKeys = Object.getOwnPropertySymbols(source);
|
|
112
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
113
|
-
key = sourceKeys[i];
|
|
114
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
115
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
116
|
-
target[key] = source[key];
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
return target;
|
|
120
|
-
}
|
|
121
|
-
function _object_without_properties_loose(source, excluded) {
|
|
122
|
-
if (source == null) return {};
|
|
123
|
-
var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
|
|
124
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
125
|
-
key = sourceKeys[i];
|
|
126
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
127
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
128
|
-
target[key] = source[key];
|
|
129
|
-
}
|
|
130
|
-
return target;
|
|
131
|
-
}
|
|
132
|
-
var KeyboardSupport = {
|
|
68
|
+
const KeyboardSupport = {
|
|
133
69
|
PageUp: 33,
|
|
134
70
|
PageDown: 34,
|
|
135
71
|
End: 35,
|
|
@@ -139,35 +75,22 @@ var KeyboardSupport = {
|
|
|
139
75
|
ArrowRight: 39,
|
|
140
76
|
ArrowDown: 40
|
|
141
77
|
};
|
|
142
|
-
|
|
78
|
+
const ThumbBase = _styledcomponents.default.div.withConfig({
|
|
143
79
|
displayName: "ThumbBase",
|
|
144
80
|
componentId: "sc-df386cdf-0"
|
|
145
81
|
})([
|
|
146
|
-
|
|
82
|
+
`border-radius:50%;background-clip:content-box;box-sizing:content-box;transition:transform 0.1s ease-in-out;&:focus{outline:none;}&:not([disabled]){&.focus-visible,&[data-focus-visible-added]{border-color:currentColor;}}`
|
|
147
83
|
]);
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
"onChangeCommitted",
|
|
151
|
-
"stepSize",
|
|
152
|
-
"xPosition",
|
|
153
|
-
"min",
|
|
154
|
-
"max",
|
|
155
|
-
"value",
|
|
156
|
-
"bounds",
|
|
157
|
-
"ariaValueMin",
|
|
158
|
-
"ariaLabel",
|
|
159
|
-
"multipleStepSize",
|
|
160
|
-
"thumb"
|
|
161
|
-
]);
|
|
162
|
-
var onKeyPress = (0, _react.useCallback)(function(event) {
|
|
84
|
+
const Thumb = ({ onChangeCommitted, stepSize, xPosition = 0, min, max, value, bounds, ariaValueMin = min, ariaLabel, multipleStepSize, thumb: ThumbAbstract, ...rest })=>{
|
|
85
|
+
const onKeyPress = (0, _react.useCallback)((event)=>{
|
|
163
86
|
event.persist();
|
|
164
|
-
|
|
87
|
+
const { keyCode, target } = event;
|
|
165
88
|
if (!Object.values(KeyboardSupport).includes(keyCode)) {
|
|
166
89
|
return;
|
|
167
90
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
91
|
+
const { ArrowUp, ArrowRight, ArrowDown, ArrowLeft, Home, End, PageDown, PageUp } = KeyboardSupport;
|
|
92
|
+
const computedMultipleSteps = stepSize * (multipleStepSize / 100 * max);
|
|
93
|
+
const data = {
|
|
171
94
|
x: 0,
|
|
172
95
|
deltaX: stepSize,
|
|
173
96
|
lastX: xPosition,
|
|
@@ -203,13 +126,13 @@ var Thumb = function Thumb(_0) {
|
|
|
203
126
|
default:
|
|
204
127
|
data.x = 0;
|
|
205
128
|
}
|
|
206
|
-
|
|
129
|
+
const { left, right } = bounds;
|
|
207
130
|
/*
|
|
208
131
|
* INFO:Находим значение в диапазоне между указанными левой и правой границами.
|
|
209
132
|
* Необходимо для правильного расчета положения SliderThumb.
|
|
210
133
|
* см. функция clamp
|
|
211
|
-
*/
|
|
212
|
-
|
|
134
|
+
*/ const boundedValue = Math.max(Math.min(right, data.x), left);
|
|
135
|
+
const computedValue = (0, _utils.getSliderThumbValue)(boundedValue, stepSize, min, max);
|
|
213
136
|
onChangeCommitted(computedValue, data);
|
|
214
137
|
}, [
|
|
215
138
|
onChangeCommitted,
|
|
@@ -220,13 +143,14 @@ var Thumb = function Thumb(_0) {
|
|
|
220
143
|
max,
|
|
221
144
|
xPosition
|
|
222
145
|
]);
|
|
223
|
-
return /*#__PURE__*/ _react.default.createElement(ThumbAbstract,
|
|
146
|
+
return /*#__PURE__*/ _react.default.createElement(ThumbAbstract, {
|
|
224
147
|
role: "slider",
|
|
225
148
|
"aria-label": ariaLabel,
|
|
226
149
|
"aria-valuemin": ariaValueMin,
|
|
227
150
|
"aria-valuemax": max,
|
|
228
151
|
"aria-valuenow": value,
|
|
229
152
|
"aria-orientation": "horizontal",
|
|
230
|
-
onKeyDown: onKeyPress
|
|
231
|
-
|
|
153
|
+
onKeyDown: onKeyPress,
|
|
154
|
+
...rest
|
|
155
|
+
});
|
|
232
156
|
};
|
|
@@ -19,6 +19,6 @@ _export(exports, {
|
|
|
19
19
|
return _ThumbBase.ThumbBase;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const _Slider = require("./Slider");
|
|
23
|
+
const _ThumbBase = require("./ThumbBase");
|
|
24
|
+
const Slider = _Slider.SliderCore;
|
|
@@ -17,7 +17,7 @@ _export(exports, {
|
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
function getSliderThumbValue(handleCenterXRelative, stepSize, min, max) {
|
|
20
|
-
|
|
20
|
+
const newValue = Math.round(handleCenterXRelative / stepSize) + min;
|
|
21
21
|
return Math.min(Math.max(newValue, min), max);
|
|
22
22
|
}
|
|
23
23
|
function getOffsets(ref, side) {
|
|
@@ -27,7 +27,7 @@ function getOffsets(ref, side) {
|
|
|
27
27
|
0
|
|
28
28
|
];
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
const size = ref.current.clientWidth;
|
|
31
31
|
if (side === 'left') {
|
|
32
32
|
return [
|
|
33
33
|
0,
|
|
@@ -8,24 +8,11 @@ Object.defineProperty(exports, "Spinner", {
|
|
|
8
8
|
return Spinner;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function _define_property(obj, key, value) {
|
|
17
|
-
if (key in obj) {
|
|
18
|
-
Object.defineProperty(obj, key, {
|
|
19
|
-
value: value,
|
|
20
|
-
enumerable: true,
|
|
21
|
-
configurable: true,
|
|
22
|
-
writable: true
|
|
23
|
-
});
|
|
24
|
-
} else {
|
|
25
|
-
obj[key] = value;
|
|
26
|
-
}
|
|
27
|
-
return obj;
|
|
28
|
-
}
|
|
11
|
+
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
|
|
12
|
+
const _styledcomponents = /*#__PURE__*/ _interop_require_wildcard(require("styled-components"));
|
|
13
|
+
const _tokens = require("../../tokens");
|
|
14
|
+
const _hooks = require("../../hooks");
|
|
15
|
+
const _SpinnerSvg = require("./SpinnerSvg");
|
|
29
16
|
function _interop_require_default(obj) {
|
|
30
17
|
return obj && obj.__esModule ? obj : {
|
|
31
18
|
default: obj
|
|
@@ -72,97 +59,38 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
72
59
|
}
|
|
73
60
|
return newObj;
|
|
74
61
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
78
|
-
var ownKeys = Object.keys(source);
|
|
79
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
80
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
81
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
82
|
-
}));
|
|
83
|
-
}
|
|
84
|
-
ownKeys.forEach(function(key) {
|
|
85
|
-
_define_property(target, key, source[key]);
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
return target;
|
|
89
|
-
}
|
|
90
|
-
function _object_without_properties(source, excluded) {
|
|
91
|
-
if (source == null) return {};
|
|
92
|
-
var target = {}, sourceKeys, key, i;
|
|
93
|
-
if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
|
|
94
|
-
sourceKeys = Reflect.ownKeys(source);
|
|
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
|
-
target = _object_without_properties_loose(source, excluded);
|
|
104
|
-
if (Object.getOwnPropertySymbols) {
|
|
105
|
-
sourceKeys = Object.getOwnPropertySymbols(source);
|
|
106
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
107
|
-
key = sourceKeys[i];
|
|
108
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
109
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
110
|
-
target[key] = source[key];
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return target;
|
|
114
|
-
}
|
|
115
|
-
function _object_without_properties_loose(source, excluded) {
|
|
116
|
-
if (source == null) return {};
|
|
117
|
-
var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
|
|
118
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
119
|
-
key = sourceKeys[i];
|
|
120
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
121
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
122
|
-
target[key] = source[key];
|
|
123
|
-
}
|
|
124
|
-
return target;
|
|
125
|
-
}
|
|
126
|
-
var rotateAnimation = (0, _styledcomponents.keyframes)([
|
|
127
|
-
"from{transform:rotate(0);}to{transform:rotate(360deg);}"
|
|
62
|
+
const rotateAnimation = (0, _styledcomponents.keyframes)([
|
|
63
|
+
`from{transform:rotate(0);}to{transform:rotate(360deg);}`
|
|
128
64
|
]);
|
|
129
|
-
|
|
65
|
+
const StyledRoot = _styledcomponents.default.div.withConfig({
|
|
130
66
|
displayName: "Spinner__StyledRoot",
|
|
131
67
|
componentId: "sc-c7478b4f-0"
|
|
132
68
|
})([
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
],
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}, rotateAnimation);
|
|
144
|
-
var scalingPixelBasis = 16;
|
|
145
|
-
var sizeFormatting = function sizeFormatting(size) {
|
|
146
|
-
var deviceScale = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
|
|
69
|
+
`display:flex;box-sizing:border-box;`,
|
|
70
|
+
` animation:`,
|
|
71
|
+
` 1s linear infinite;`
|
|
72
|
+
], ({ $size })=>(0, _styledcomponents.css)([
|
|
73
|
+
`width:`,
|
|
74
|
+
`;height:`,
|
|
75
|
+
`;`
|
|
76
|
+
], $size, $size), rotateAnimation);
|
|
77
|
+
const scalingPixelBasis = 16;
|
|
78
|
+
const sizeFormatting = (size, deviceScale = 1)=>{
|
|
147
79
|
if (typeof size === 'number' || !size.endsWith('rem') && !size.endsWith('px')) {
|
|
148
|
-
return
|
|
80
|
+
return `${Number(size) / (scalingPixelBasis * deviceScale)}rem`;
|
|
149
81
|
}
|
|
150
82
|
return size;
|
|
151
83
|
};
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
]);
|
|
159
|
-
var uniqId = (0, _hooks.useUniqId)();
|
|
160
|
-
var innerId = id || uniqId;
|
|
161
|
-
var currentSize = sizeFormatting(size, deviceScale);
|
|
162
|
-
return /*#__PURE__*/ _react.default.createElement(StyledRoot, _object_spread({
|
|
84
|
+
const Spinner = (props)=>{
|
|
85
|
+
const { id, size = 56, color = _tokens.accent, deviceScale, ...rest } = props;
|
|
86
|
+
const uniqId = (0, _hooks.useUniqId)();
|
|
87
|
+
const innerId = id || uniqId;
|
|
88
|
+
const currentSize = sizeFormatting(size, deviceScale);
|
|
89
|
+
return /*#__PURE__*/ _react.default.createElement(StyledRoot, {
|
|
163
90
|
id: innerId,
|
|
164
|
-
$size: currentSize
|
|
165
|
-
|
|
91
|
+
$size: currentSize,
|
|
92
|
+
...rest
|
|
93
|
+
}, /*#__PURE__*/ _react.default.createElement(_SpinnerSvg.SpinnerSvg, {
|
|
166
94
|
id: innerId,
|
|
167
95
|
width: size,
|
|
168
96
|
height: size,
|
|
@@ -8,94 +8,26 @@ Object.defineProperty(exports, "SpinnerSvg", {
|
|
|
8
8
|
return SpinnerSvg;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
function _define_property(obj, key, value) {
|
|
13
|
-
if (key in obj) {
|
|
14
|
-
Object.defineProperty(obj, key, {
|
|
15
|
-
value: value,
|
|
16
|
-
enumerable: true,
|
|
17
|
-
configurable: true,
|
|
18
|
-
writable: true
|
|
19
|
-
});
|
|
20
|
-
} else {
|
|
21
|
-
obj[key] = value;
|
|
22
|
-
}
|
|
23
|
-
return obj;
|
|
24
|
-
}
|
|
11
|
+
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
|
|
25
12
|
function _interop_require_default(obj) {
|
|
26
13
|
return obj && obj.__esModule ? obj : {
|
|
27
14
|
default: obj
|
|
28
15
|
};
|
|
29
16
|
}
|
|
30
|
-
|
|
31
|
-
for(var i = 1; i < arguments.length; i++){
|
|
32
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
33
|
-
var ownKeys = Object.keys(source);
|
|
34
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
35
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
36
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
37
|
-
}));
|
|
38
|
-
}
|
|
39
|
-
ownKeys.forEach(function(key) {
|
|
40
|
-
_define_property(target, key, source[key]);
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
return target;
|
|
44
|
-
}
|
|
45
|
-
function _object_without_properties(source, excluded) {
|
|
46
|
-
if (source == null) return {};
|
|
47
|
-
var target = {}, sourceKeys, key, i;
|
|
48
|
-
if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
|
|
49
|
-
sourceKeys = Reflect.ownKeys(source);
|
|
50
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
51
|
-
key = sourceKeys[i];
|
|
52
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
53
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
54
|
-
target[key] = source[key];
|
|
55
|
-
}
|
|
56
|
-
return target;
|
|
57
|
-
}
|
|
58
|
-
target = _object_without_properties_loose(source, excluded);
|
|
59
|
-
if (Object.getOwnPropertySymbols) {
|
|
60
|
-
sourceKeys = Object.getOwnPropertySymbols(source);
|
|
61
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
62
|
-
key = sourceKeys[i];
|
|
63
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
64
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
65
|
-
target[key] = source[key];
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return target;
|
|
69
|
-
}
|
|
70
|
-
function _object_without_properties_loose(source, excluded) {
|
|
71
|
-
if (source == null) return {};
|
|
72
|
-
var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
|
|
73
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
74
|
-
key = sourceKeys[i];
|
|
75
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
76
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
77
|
-
target[key] = source[key];
|
|
78
|
-
}
|
|
79
|
-
return target;
|
|
80
|
-
}
|
|
81
|
-
var SpinnerSvg = function SpinnerSvg(_0) {
|
|
82
|
-
var id = _0.id, color = _0.color, props = _object_without_properties(_0, [
|
|
83
|
-
"id",
|
|
84
|
-
"color"
|
|
85
|
-
]);
|
|
86
|
-
return /*#__PURE__*/ _react.default.createElement("svg", _object_spread({
|
|
17
|
+
const SpinnerSvg = ({ id, color, ...props })=>/*#__PURE__*/ _react.default.createElement("svg", {
|
|
87
18
|
viewBox: "0 0 56 56",
|
|
88
|
-
fill: "none"
|
|
89
|
-
|
|
19
|
+
fill: "none",
|
|
20
|
+
...props
|
|
21
|
+
}, /*#__PURE__*/ _react.default.createElement("path", {
|
|
90
22
|
fillRule: "evenodd",
|
|
91
23
|
clipRule: "evenodd",
|
|
92
24
|
d: "M28 0C12.536 0 0 12.536 0 28s12.536 28 28 28h.055H28v-4C14.745 52 4 41.255 4 28S14.745 4 28 4V0z",
|
|
93
|
-
fill:
|
|
25
|
+
fill: `url(#prefix__paint0_linear${id})`
|
|
94
26
|
}), /*#__PURE__*/ _react.default.createElement("path", {
|
|
95
27
|
d: "M56 28c0 14.791-11.47 26.904-26 27.93-1.102.077-2-.825-2-1.93s.899-1.991 2-2.082C42.318 50.902 52 40.58 52 28 52 14.745 41.255 4 28 4V0c15.464 0 28 12.536 28 28z",
|
|
96
|
-
fill:
|
|
28
|
+
fill: `url(#prefix__paint1_linear${id})`
|
|
97
29
|
}), /*#__PURE__*/ _react.default.createElement("defs", null, /*#__PURE__*/ _react.default.createElement("linearGradient", {
|
|
98
|
-
id:
|
|
30
|
+
id: `prefix__paint0_linear${id}`,
|
|
99
31
|
x1: 0,
|
|
100
32
|
y1: 56,
|
|
101
33
|
x2: 0,
|
|
@@ -117,7 +49,7 @@ var SpinnerSvg = function SpinnerSvg(_0) {
|
|
|
117
49
|
stopColor: color,
|
|
118
50
|
stopOpacity: 0.5
|
|
119
51
|
})), /*#__PURE__*/ _react.default.createElement("linearGradient", {
|
|
120
|
-
id:
|
|
52
|
+
id: `prefix__paint1_linear${id}`,
|
|
121
53
|
x1: 28,
|
|
122
54
|
y1: 56,
|
|
123
55
|
x2: 28,
|
|
@@ -137,4 +69,3 @@ var SpinnerSvg = function SpinnerSvg(_0) {
|
|
|
137
69
|
stopColor: color,
|
|
138
70
|
stopOpacity: 0.5
|
|
139
71
|
}))));
|
|
140
|
-
};
|