@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
|
@@ -8,32 +8,11 @@ Object.defineProperty(exports, "Handle", {
|
|
|
8
8
|
return Handle;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function _array_like_to_array(arr, len) {
|
|
17
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
18
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
19
|
-
return arr2;
|
|
20
|
-
}
|
|
21
|
-
function _array_with_holes(arr) {
|
|
22
|
-
if (Array.isArray(arr)) return arr;
|
|
23
|
-
}
|
|
24
|
-
function _define_property(obj, key, value) {
|
|
25
|
-
if (key in obj) {
|
|
26
|
-
Object.defineProperty(obj, key, {
|
|
27
|
-
value: value,
|
|
28
|
-
enumerable: true,
|
|
29
|
-
configurable: true,
|
|
30
|
-
writable: true
|
|
31
|
-
});
|
|
32
|
-
} else {
|
|
33
|
-
obj[key] = value;
|
|
34
|
-
}
|
|
35
|
-
return obj;
|
|
36
|
-
}
|
|
11
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
|
+
const _styledcomponents = /*#__PURE__*/ _interop_require_default(require("styled-components"));
|
|
13
|
+
const _reactdraggable = /*#__PURE__*/ _interop_require_default(require("react-draggable"));
|
|
14
|
+
const _utils = require("./utils");
|
|
15
|
+
const _ThumbBase = require("./ThumbBase");
|
|
37
16
|
function _interop_require_default(obj) {
|
|
38
17
|
return obj && obj.__esModule ? obj : {
|
|
39
18
|
default: obj
|
|
@@ -80,128 +59,18 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
80
59
|
}
|
|
81
60
|
return newObj;
|
|
82
61
|
}
|
|
83
|
-
|
|
84
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
85
|
-
}
|
|
86
|
-
function _iterable_to_array_limit(arr, i) {
|
|
87
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
88
|
-
if (_i == null) return;
|
|
89
|
-
var _arr = [];
|
|
90
|
-
var _n = true;
|
|
91
|
-
var _d = false;
|
|
92
|
-
var _s, _e;
|
|
93
|
-
try {
|
|
94
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
95
|
-
_arr.push(_s.value);
|
|
96
|
-
if (i && _arr.length === i) break;
|
|
97
|
-
}
|
|
98
|
-
} catch (err) {
|
|
99
|
-
_d = true;
|
|
100
|
-
_e = err;
|
|
101
|
-
} finally{
|
|
102
|
-
try {
|
|
103
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
104
|
-
} finally{
|
|
105
|
-
if (_d) throw _e;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return _arr;
|
|
109
|
-
}
|
|
110
|
-
function _non_iterable_rest() {
|
|
111
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
112
|
-
}
|
|
113
|
-
function _object_spread(target) {
|
|
114
|
-
for(var i = 1; i < arguments.length; i++){
|
|
115
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
116
|
-
var ownKeys = Object.keys(source);
|
|
117
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
118
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
119
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
120
|
-
}));
|
|
121
|
-
}
|
|
122
|
-
ownKeys.forEach(function(key) {
|
|
123
|
-
_define_property(target, key, source[key]);
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
return target;
|
|
127
|
-
}
|
|
128
|
-
function _object_without_properties(source, excluded) {
|
|
129
|
-
if (source == null) return {};
|
|
130
|
-
var target = {}, sourceKeys, key, i;
|
|
131
|
-
if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
|
|
132
|
-
sourceKeys = Reflect.ownKeys(source);
|
|
133
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
134
|
-
key = sourceKeys[i];
|
|
135
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
136
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
137
|
-
target[key] = source[key];
|
|
138
|
-
}
|
|
139
|
-
return target;
|
|
140
|
-
}
|
|
141
|
-
target = _object_without_properties_loose(source, excluded);
|
|
142
|
-
if (Object.getOwnPropertySymbols) {
|
|
143
|
-
sourceKeys = Object.getOwnPropertySymbols(source);
|
|
144
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
145
|
-
key = sourceKeys[i];
|
|
146
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
147
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
148
|
-
target[key] = source[key];
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
return target;
|
|
152
|
-
}
|
|
153
|
-
function _object_without_properties_loose(source, excluded) {
|
|
154
|
-
if (source == null) return {};
|
|
155
|
-
var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
|
|
156
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
157
|
-
key = sourceKeys[i];
|
|
158
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
159
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
160
|
-
target[key] = source[key];
|
|
161
|
-
}
|
|
162
|
-
return target;
|
|
163
|
-
}
|
|
164
|
-
function _sliced_to_array(arr, i) {
|
|
165
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
166
|
-
}
|
|
167
|
-
function _to_array(arr) {
|
|
168
|
-
return _array_with_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_rest();
|
|
169
|
-
}
|
|
170
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
171
|
-
if (!o) return;
|
|
172
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
173
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
174
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
175
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
176
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
177
|
-
}
|
|
178
|
-
var HandleStyled = _styledcomponents.default.div.withConfig({
|
|
62
|
+
const HandleStyled = _styledcomponents.default.div.withConfig({
|
|
179
63
|
displayName: "Handle__HandleStyled",
|
|
180
64
|
componentId: "sc-50a39b96-0"
|
|
181
65
|
})([
|
|
182
|
-
|
|
66
|
+
`cursor:pointer;position:absolute;z-index:1;top:0;left:0;`
|
|
183
67
|
]);
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
], _ref1 = _to_array(_ref), _ref2 = _ref1[0], _rest = _ref1.slice(1), stepSize = _ref2.stepSize, onChangeCommitted = _ref2.onChangeCommitted, onChange = _ref2.onChange, xPosition = _ref2.xPosition, min = _ref2.min, max = _ref2.max, _ref_bounds = _ref2.bounds, bounds = _ref_bounds === void 0 ? [] : _ref_bounds, zIndex = _ref2.zIndex, disabled = _ref2.disabled, side = _ref2.side, rest = _object_without_properties(_ref2, [
|
|
189
|
-
"stepSize",
|
|
190
|
-
"onChangeCommitted",
|
|
191
|
-
"onChange",
|
|
192
|
-
"xPosition",
|
|
193
|
-
"min",
|
|
194
|
-
"max",
|
|
195
|
-
"bounds",
|
|
196
|
-
"zIndex",
|
|
197
|
-
"disabled",
|
|
198
|
-
"side"
|
|
199
|
-
]), _rest1 = _sliced_to_array(_rest, 1), ref = _rest1[0];
|
|
200
|
-
var lastOnChangeValue = (0, _react.useRef)();
|
|
201
|
-
var currentSliderValue = (lastOnChangeValue === null || lastOnChangeValue === void 0 ? void 0 : lastOnChangeValue.current) || rest.value;
|
|
202
|
-
var onDrag = (0, _react.useCallback)(function(_, data) {
|
|
68
|
+
const Handle = /*#__PURE__*/ (0, _react.forwardRef)(({ stepSize, onChangeCommitted, onChange, xPosition, min, max, bounds = [], zIndex, disabled, side, ...rest }, ref)=>{
|
|
69
|
+
const lastOnChangeValue = (0, _react.useRef)();
|
|
70
|
+
const currentSliderValue = lastOnChangeValue?.current || rest.value;
|
|
71
|
+
const onDrag = (0, _react.useCallback)((_, data)=>{
|
|
203
72
|
if (onChange) {
|
|
204
|
-
|
|
73
|
+
const newValue = (0, _utils.getSliderThumbValue)(data.x, stepSize, min, max);
|
|
205
74
|
if (lastOnChangeValue.current !== newValue) {
|
|
206
75
|
onChange(newValue, data);
|
|
207
76
|
lastOnChangeValue.current = newValue;
|
|
@@ -213,8 +82,8 @@ var Handle = /*#__PURE__*/ (0, _react.forwardRef)(function(_0, _1) {
|
|
|
213
82
|
min,
|
|
214
83
|
max
|
|
215
84
|
]);
|
|
216
|
-
|
|
217
|
-
|
|
85
|
+
const onStop = (0, _react.useCallback)((_, data)=>{
|
|
86
|
+
const newValue = (0, _utils.getSliderThumbValue)(data.x, stepSize, min, max);
|
|
218
87
|
onChangeCommitted(newValue, data);
|
|
219
88
|
}, [
|
|
220
89
|
onChangeCommitted,
|
|
@@ -222,18 +91,18 @@ var Handle = /*#__PURE__*/ (0, _react.forwardRef)(function(_0, _1) {
|
|
|
222
91
|
min,
|
|
223
92
|
max
|
|
224
93
|
]);
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
94
|
+
const [offsetLeft, offsetRight] = (0, _utils.getOffsets)(ref, side);
|
|
95
|
+
const [leftValueBound, rightValueBound] = bounds;
|
|
96
|
+
const leftPositionBound = leftValueBound ? (leftValueBound - min) * stepSize : null;
|
|
97
|
+
const rightPositionBound = rightValueBound ? (rightValueBound - min) * stepSize : null;
|
|
98
|
+
const position = typeof xPosition === 'number' ? {
|
|
230
99
|
x: xPosition,
|
|
231
100
|
y: 0
|
|
232
101
|
} : undefined;
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
left: (leftPositionBound
|
|
236
|
-
right: (rightPositionBound
|
|
102
|
+
const tabIndex = disabled ? -1 : 0;
|
|
103
|
+
const computedBounds = {
|
|
104
|
+
left: (leftPositionBound ?? 0) + offsetLeft,
|
|
105
|
+
right: (rightPositionBound ?? stepSize * (max - min)) - offsetRight
|
|
237
106
|
};
|
|
238
107
|
return /*#__PURE__*/ _react.default.createElement(_reactdraggable.default, {
|
|
239
108
|
axis: "x",
|
|
@@ -249,9 +118,9 @@ var Handle = /*#__PURE__*/ (0, _react.forwardRef)(function(_0, _1) {
|
|
|
249
118
|
}, /*#__PURE__*/ _react.default.createElement(HandleStyled, {
|
|
250
119
|
ref: ref,
|
|
251
120
|
style: {
|
|
252
|
-
zIndex
|
|
121
|
+
zIndex
|
|
253
122
|
}
|
|
254
|
-
}, /*#__PURE__*/ _react.default.createElement(_ThumbBase.Thumb,
|
|
123
|
+
}, /*#__PURE__*/ _react.default.createElement(_ThumbBase.Thumb, {
|
|
255
124
|
tabIndex: tabIndex,
|
|
256
125
|
min: min,
|
|
257
126
|
max: max,
|
|
@@ -260,6 +129,7 @@ var Handle = /*#__PURE__*/ (0, _react.forwardRef)(function(_0, _1) {
|
|
|
260
129
|
onChangeCommitted: onChangeCommitted,
|
|
261
130
|
xPosition: xPosition,
|
|
262
131
|
disabled: disabled,
|
|
263
|
-
bounds: computedBounds
|
|
264
|
-
|
|
132
|
+
bounds: computedBounds,
|
|
133
|
+
...rest
|
|
134
|
+
})));
|
|
265
135
|
});
|
|
@@ -8,219 +8,71 @@ Object.defineProperty(exports, "Slider", {
|
|
|
8
8
|
return Slider;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
function _array_like_to_array(arr, len) {
|
|
15
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
16
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
17
|
-
return arr2;
|
|
18
|
-
}
|
|
19
|
-
function _array_with_holes(arr) {
|
|
20
|
-
if (Array.isArray(arr)) return arr;
|
|
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
|
-
}
|
|
11
|
+
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
|
|
12
|
+
const _SliderBase = require("./SliderBase");
|
|
13
|
+
const _Handle = require("./Handle");
|
|
35
14
|
function _interop_require_default(obj) {
|
|
36
15
|
return obj && obj.__esModule ? obj : {
|
|
37
16
|
default: obj
|
|
38
17
|
};
|
|
39
18
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (_i == null) return;
|
|
43
|
-
var _arr = [];
|
|
44
|
-
var _n = true;
|
|
45
|
-
var _d = false;
|
|
46
|
-
var _s, _e;
|
|
47
|
-
try {
|
|
48
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
49
|
-
_arr.push(_s.value);
|
|
50
|
-
if (i && _arr.length === i) break;
|
|
51
|
-
}
|
|
52
|
-
} catch (err) {
|
|
53
|
-
_d = true;
|
|
54
|
-
_e = err;
|
|
55
|
-
} finally{
|
|
56
|
-
try {
|
|
57
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
58
|
-
} finally{
|
|
59
|
-
if (_d) throw _e;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return _arr;
|
|
63
|
-
}
|
|
64
|
-
function _non_iterable_rest() {
|
|
65
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
66
|
-
}
|
|
67
|
-
function _object_spread(target) {
|
|
68
|
-
for(var i = 1; i < arguments.length; i++){
|
|
69
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
70
|
-
var ownKeys = Object.keys(source);
|
|
71
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
72
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
73
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
74
|
-
}));
|
|
75
|
-
}
|
|
76
|
-
ownKeys.forEach(function(key) {
|
|
77
|
-
_define_property(target, key, source[key]);
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
return target;
|
|
81
|
-
}
|
|
82
|
-
function ownKeys(object, enumerableOnly) {
|
|
83
|
-
var keys = Object.keys(object);
|
|
84
|
-
if (Object.getOwnPropertySymbols) {
|
|
85
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
86
|
-
if (enumerableOnly) {
|
|
87
|
-
symbols = symbols.filter(function(sym) {
|
|
88
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
keys.push.apply(keys, symbols);
|
|
92
|
-
}
|
|
93
|
-
return keys;
|
|
94
|
-
}
|
|
95
|
-
function _object_spread_props(target, source) {
|
|
96
|
-
source = source != null ? source : {};
|
|
97
|
-
if (Object.getOwnPropertyDescriptors) {
|
|
98
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
99
|
-
} else {
|
|
100
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
101
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
return target;
|
|
105
|
-
}
|
|
106
|
-
function _object_without_properties(source, excluded) {
|
|
107
|
-
if (source == null) return {};
|
|
108
|
-
var target = {}, sourceKeys, key, i;
|
|
109
|
-
if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
|
|
110
|
-
sourceKeys = Reflect.ownKeys(source);
|
|
111
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
112
|
-
key = sourceKeys[i];
|
|
113
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
114
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
115
|
-
target[key] = source[key];
|
|
116
|
-
}
|
|
117
|
-
return target;
|
|
118
|
-
}
|
|
119
|
-
target = _object_without_properties_loose(source, excluded);
|
|
120
|
-
if (Object.getOwnPropertySymbols) {
|
|
121
|
-
sourceKeys = Object.getOwnPropertySymbols(source);
|
|
122
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
123
|
-
key = sourceKeys[i];
|
|
124
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
125
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
126
|
-
target[key] = source[key];
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return target;
|
|
130
|
-
}
|
|
131
|
-
function _object_without_properties_loose(source, excluded) {
|
|
132
|
-
if (source == null) return {};
|
|
133
|
-
var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
|
|
134
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
135
|
-
key = sourceKeys[i];
|
|
136
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
137
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
138
|
-
target[key] = source[key];
|
|
139
|
-
}
|
|
140
|
-
return target;
|
|
141
|
-
}
|
|
142
|
-
function _sliced_to_array(arr, i) {
|
|
143
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
144
|
-
}
|
|
145
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
146
|
-
if (!o) return;
|
|
147
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
148
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
149
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
150
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
151
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
152
|
-
}
|
|
153
|
-
var Slider = function Slider(_0) {
|
|
154
|
-
var min = _0.min, max = _0.max, value = _0.value, disabled = _0.disabled, onChangeCommitted = _0.onChangeCommitted, onChange = _0.onChange, ariaLabel = _0.ariaLabel, _0_multipleStepSize = _0.multipleStepSize, multipleStepSize = _0_multipleStepSize === void 0 ? 10 : _0_multipleStepSize, thumb = _0.thumb, rest = _object_without_properties(_0, [
|
|
155
|
-
"min",
|
|
156
|
-
"max",
|
|
157
|
-
"value",
|
|
158
|
-
"disabled",
|
|
159
|
-
"onChangeCommitted",
|
|
160
|
-
"onChange",
|
|
161
|
-
"ariaLabel",
|
|
162
|
-
"multipleStepSize",
|
|
163
|
-
"thumb"
|
|
164
|
-
]);
|
|
165
|
-
var _React_useState = _sliced_to_array(_react.default.useState({
|
|
19
|
+
const Slider = ({ min, max, value, disabled, onChangeCommitted, onChange, ariaLabel, multipleStepSize = 10, thumb, ...rest })=>{
|
|
20
|
+
const [state, setState] = _react.default.useState({
|
|
166
21
|
xHandle: 0,
|
|
167
22
|
stepSize: 0,
|
|
168
23
|
railFillWidth: 0
|
|
169
|
-
})
|
|
170
|
-
|
|
171
|
-
_react.default.useEffect(
|
|
172
|
-
|
|
173
|
-
setState(
|
|
174
|
-
|
|
24
|
+
});
|
|
25
|
+
const { stepSize } = state;
|
|
26
|
+
_react.default.useEffect(()=>{
|
|
27
|
+
const localValue = Math.min(Math.max(value, min), max) - min;
|
|
28
|
+
setState((prevState)=>({
|
|
29
|
+
...prevState,
|
|
175
30
|
xHandle: stepSize * localValue,
|
|
176
31
|
railFillWidth: stepSize * localValue
|
|
177
|
-
});
|
|
178
|
-
});
|
|
32
|
+
}));
|
|
179
33
|
}, [
|
|
180
34
|
value,
|
|
181
35
|
stepSize,
|
|
182
36
|
min,
|
|
183
37
|
max
|
|
184
38
|
]);
|
|
185
|
-
|
|
186
|
-
setState(
|
|
187
|
-
|
|
39
|
+
const setStepSize = _react.default.useCallback((newStepSize)=>{
|
|
40
|
+
setState((prevState)=>({
|
|
41
|
+
...prevState,
|
|
188
42
|
stepSize: newStepSize
|
|
189
|
-
});
|
|
190
|
-
});
|
|
43
|
+
}));
|
|
191
44
|
}, []);
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
setState(
|
|
195
|
-
|
|
45
|
+
const onHandleChange = _react.default.useCallback((handleValue, data)=>{
|
|
46
|
+
const newHandleXPosition = data.x;
|
|
47
|
+
setState((prevState)=>({
|
|
48
|
+
...prevState,
|
|
196
49
|
railFillWidth: newHandleXPosition
|
|
197
|
-
});
|
|
198
|
-
});
|
|
50
|
+
}));
|
|
199
51
|
if (onChange) {
|
|
200
52
|
onChange(handleValue);
|
|
201
53
|
}
|
|
202
54
|
}, [
|
|
203
55
|
onChange
|
|
204
56
|
]);
|
|
205
|
-
|
|
57
|
+
const onHandleChangeCommitted = _react.default.useCallback((handleValue, data)=>{
|
|
206
58
|
onChangeCommitted(handleValue);
|
|
207
|
-
setState(
|
|
208
|
-
|
|
59
|
+
setState((prevState)=>({
|
|
60
|
+
...prevState,
|
|
209
61
|
xHandle: data.lastX,
|
|
210
62
|
railFillWidth: data.lastX
|
|
211
|
-
});
|
|
212
|
-
});
|
|
63
|
+
}));
|
|
213
64
|
}, [
|
|
214
65
|
onChangeCommitted
|
|
215
66
|
]);
|
|
216
|
-
return /*#__PURE__*/ _react.default.createElement(_SliderBase.SliderBase,
|
|
67
|
+
return /*#__PURE__*/ _react.default.createElement(_SliderBase.SliderBase, {
|
|
217
68
|
min: min,
|
|
218
69
|
max: max,
|
|
219
70
|
disabled: disabled,
|
|
220
71
|
setStepSize: setStepSize,
|
|
221
72
|
onChange: onHandleChangeCommitted,
|
|
222
|
-
railFillWidth: state.railFillWidth
|
|
223
|
-
|
|
73
|
+
railFillWidth: state.railFillWidth,
|
|
74
|
+
...rest
|
|
75
|
+
}, /*#__PURE__*/ _react.default.createElement(_Handle.Handle, {
|
|
224
76
|
stepSize: state.stepSize,
|
|
225
77
|
onChangeCommitted: onHandleChangeCommitted,
|
|
226
78
|
onChange: onHandleChange,
|
|
@@ -8,18 +8,16 @@ Object.defineProperty(exports, "SliderCore", {
|
|
|
8
8
|
return SliderCore;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
|
|
12
|
+
const _Single = require("./Single");
|
|
13
|
+
const _Double = require("./Double");
|
|
14
14
|
function _interop_require_default(obj) {
|
|
15
15
|
return obj && obj.__esModule ? obj : {
|
|
16
16
|
default: obj
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
var SliderCore = function SliderCore(props) {
|
|
19
|
+
const isSingleValueProps = (props)=>typeof props.value === 'number';
|
|
20
|
+
const SliderCore = (props)=>{
|
|
23
21
|
if (isSingleValueProps(props)) {
|
|
24
22
|
return /*#__PURE__*/ _react.default.createElement(_Single.Slider, props);
|
|
25
23
|
}
|
|
@@ -8,9 +8,9 @@ Object.defineProperty(exports, "SliderBase", {
|
|
|
8
8
|
return SliderBase;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
|
+
const _styledcomponents = /*#__PURE__*/ _interop_require_wildcard(require("styled-components"));
|
|
13
|
+
const _hooks = require("../../hooks");
|
|
14
14
|
function _getRequireWildcardCache(nodeInterop) {
|
|
15
15
|
if (typeof WeakMap !== "function") return null;
|
|
16
16
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -52,60 +52,53 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
52
52
|
}
|
|
53
53
|
return newObj;
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
const Slider = _styledcomponents.default.div.withConfig({
|
|
56
56
|
displayName: "SliderBase__Slider",
|
|
57
57
|
componentId: "sc-1367fcf6-0"
|
|
58
58
|
})([
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
],
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
]
|
|
70
|
-
|
|
71
|
-
var disabled = param.disabled;
|
|
72
|
-
return disabled && (0, _styledcomponents.css)([
|
|
73
|
-
"opacity:0.4;"
|
|
74
|
-
]);
|
|
75
|
-
});
|
|
76
|
-
var RailWrap = _styledcomponents.default.div.withConfig({
|
|
59
|
+
`position:relative;height:1.625rem;user-select:none;`,
|
|
60
|
+
` `,
|
|
61
|
+
``
|
|
62
|
+
], ({ $settings: { indent = 0.75, backgroundColor, fillColor } })=>(0, _styledcomponents.css)([
|
|
63
|
+
`--indent:`,
|
|
64
|
+
`rem;--background-color:`,
|
|
65
|
+
`;--fill-color:`,
|
|
66
|
+
`;`
|
|
67
|
+
], indent, backgroundColor, fillColor), ({ disabled })=>disabled && (0, _styledcomponents.css)([
|
|
68
|
+
`opacity:0.4;`
|
|
69
|
+
]));
|
|
70
|
+
const RailWrap = _styledcomponents.default.div.withConfig({
|
|
77
71
|
displayName: "SliderBase__RailWrap",
|
|
78
72
|
componentId: "sc-1367fcf6-1"
|
|
79
73
|
})([
|
|
80
|
-
|
|
74
|
+
`height:100%;`
|
|
81
75
|
]);
|
|
82
|
-
|
|
76
|
+
const Rail = _styledcomponents.default.div.withConfig({
|
|
83
77
|
displayName: "SliderBase__Rail",
|
|
84
78
|
componentId: "sc-1367fcf6-2"
|
|
85
79
|
})([
|
|
86
|
-
|
|
80
|
+
`position:relative;top:50%;margin-left:var(--indent);margin-right:var(--indent);height:0.25rem;border-radius:0.125rem;background-color:var(--background-color);overflow:hidden;transform:translateY(-50%);`
|
|
87
81
|
]);
|
|
88
|
-
|
|
82
|
+
const Fill = _styledcomponents.default.div.withConfig({
|
|
89
83
|
displayName: "SliderBase__Fill",
|
|
90
84
|
componentId: "sc-1367fcf6-3"
|
|
91
85
|
})([
|
|
92
|
-
|
|
86
|
+
`position:absolute;height:100%;top:0;left:0;background-color:var(--fill-color);width:0;`
|
|
93
87
|
]);
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
var onHandleChange = (0, _react.useCallback)(function(e) {
|
|
88
|
+
const SliderBase = ({ max, min, setStepSize, railFillWidth, children, railFillXPosition = 0, disabled, onChange, settings = {} })=>{
|
|
89
|
+
const { indent = 0.75, fontSizeMultiplier = 16 } = settings;
|
|
90
|
+
const ref = (0, _react.useRef)(null);
|
|
91
|
+
const gap = indent * fontSizeMultiplier * 2;
|
|
92
|
+
const onHandleChange = (0, _react.useCallback)((e)=>{
|
|
100
93
|
if (!onChange || disabled) {
|
|
101
94
|
return;
|
|
102
95
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
96
|
+
const { x, width } = e.currentTarget.getBoundingClientRect();
|
|
97
|
+
const lastX = e.clientX - x;
|
|
98
|
+
const position = min + lastX / (width - gap) * (max - min);
|
|
99
|
+
const result = Math.max(min, Math.min(max, position));
|
|
107
100
|
onChange(result, {
|
|
108
|
-
lastX
|
|
101
|
+
lastX
|
|
109
102
|
});
|
|
110
103
|
}, [
|
|
111
104
|
onChange,
|
|
@@ -114,28 +107,26 @@ var SliderBase = function SliderBase(param) {
|
|
|
114
107
|
gap,
|
|
115
108
|
max
|
|
116
109
|
]);
|
|
117
|
-
(0, _hooks.useIsomorphicLayoutEffect)(
|
|
118
|
-
|
|
110
|
+
(0, _hooks.useIsomorphicLayoutEffect)(()=>{
|
|
111
|
+
const resizeHandler = ()=>{
|
|
119
112
|
if (ref.current) {
|
|
120
|
-
|
|
121
|
-
|
|
113
|
+
const railSize = ref.current.offsetWidth - gap;
|
|
114
|
+
const totalSteps = max - min;
|
|
122
115
|
setStepSize(railSize / totalSteps);
|
|
123
116
|
}
|
|
124
117
|
};
|
|
125
118
|
resizeHandler();
|
|
126
119
|
window.addEventListener('resize', resizeHandler);
|
|
127
|
-
return
|
|
128
|
-
return window.removeEventListener('resize', resizeHandler);
|
|
129
|
-
};
|
|
120
|
+
return ()=>window.removeEventListener('resize', resizeHandler);
|
|
130
121
|
}, [
|
|
131
122
|
min,
|
|
132
123
|
max,
|
|
133
124
|
setStepSize,
|
|
134
125
|
ref.current
|
|
135
126
|
]);
|
|
136
|
-
|
|
137
|
-
left:
|
|
138
|
-
width:
|
|
127
|
+
const fillStyle = {
|
|
128
|
+
left: `${railFillXPosition}px`,
|
|
129
|
+
width: `${railFillWidth}px`
|
|
139
130
|
};
|
|
140
131
|
return /*#__PURE__*/ _react.default.createElement(Slider, {
|
|
141
132
|
disabled: disabled,
|