@pingux/astro 1.10.0-alpha.2 → 1.10.0-alpha.3
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.
@@ -0,0 +1,239 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
6
|
+
|
7
|
+
var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
|
8
|
+
|
9
|
+
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
|
10
|
+
|
11
|
+
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
12
|
+
|
13
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
14
|
+
|
15
|
+
var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
|
16
|
+
|
17
|
+
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
|
18
|
+
|
19
|
+
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
20
|
+
|
21
|
+
_Object$defineProperty(exports, "__esModule", {
|
22
|
+
value: true
|
23
|
+
});
|
24
|
+
|
25
|
+
exports["default"] = exports.Default = void 0;
|
26
|
+
|
27
|
+
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
28
|
+
|
29
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
30
|
+
|
31
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
32
|
+
|
33
|
+
var _react = _interopRequireDefault(require("react"));
|
34
|
+
|
35
|
+
var _slider = require("@react-aria/slider");
|
36
|
+
|
37
|
+
var _slider2 = require("@react-stately/slider");
|
38
|
+
|
39
|
+
var _focus = require("@react-aria/focus");
|
40
|
+
|
41
|
+
var _visuallyHidden = require("@react-aria/visually-hidden");
|
42
|
+
|
43
|
+
var _utils = require("@react-aria/utils");
|
44
|
+
|
45
|
+
var _i18n = require("@react-aria/i18n");
|
46
|
+
|
47
|
+
var _index = require("../index");
|
48
|
+
|
49
|
+
var _react2 = require("@emotion/react");
|
50
|
+
|
51
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
52
|
+
|
53
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context6, _context7; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context6 = ownKeys(Object(source), !0)).call(_context6, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context7 = ownKeys(Object(source))).call(_context7, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
54
|
+
|
55
|
+
var _default = {
|
56
|
+
title: 'Recipes/Slider'
|
57
|
+
};
|
58
|
+
/*
|
59
|
+
* The slider value can be formatted by using the `formatOptions` prop.
|
60
|
+
`* formatOptions` is compatible with the option parameter of
|
61
|
+
* [Intl.NumberFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat)
|
62
|
+
* and is applied based on the current locale.
|
63
|
+
* https://react-spectrum.adobe.com/react-aria/useSlider.html
|
64
|
+
*/
|
65
|
+
|
66
|
+
exports["default"] = _default;
|
67
|
+
|
68
|
+
var Default = function Default() {
|
69
|
+
return (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_index.Box, {
|
70
|
+
mb: "xl"
|
71
|
+
}, (0, _react2.jsx)(Slider, {
|
72
|
+
label: "Single with solid lower background",
|
73
|
+
maxValue: 100,
|
74
|
+
step: 1
|
75
|
+
})), (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(RangeSlider, {
|
76
|
+
label: "Multiple with gradient background and custom point values",
|
77
|
+
maxValue: 100,
|
78
|
+
defaultValue: [0, 1],
|
79
|
+
step: 1
|
80
|
+
})));
|
81
|
+
};
|
82
|
+
|
83
|
+
exports.Default = Default;
|
84
|
+
|
85
|
+
var Slider = function Slider(props) {
|
86
|
+
var _context, _context2, _context3, _context4;
|
87
|
+
|
88
|
+
var trackRef = _react["default"].useRef(null);
|
89
|
+
|
90
|
+
var numberFormatter = (0, _i18n.useNumberFormatter)(props.formatOptions);
|
91
|
+
var state = (0, _slider2.useSliderState)(_objectSpread(_objectSpread({}, props), {}, {
|
92
|
+
numberFormatter: numberFormatter
|
93
|
+
}));
|
94
|
+
|
95
|
+
var _useSlider = (0, _slider.useSlider)(props, state, trackRef),
|
96
|
+
groupProps = _useSlider.groupProps,
|
97
|
+
trackProps = _useSlider.trackProps,
|
98
|
+
labelProps = _useSlider.labelProps,
|
99
|
+
outputProps = _useSlider.outputProps;
|
100
|
+
|
101
|
+
var thumbPosition = state.getThumbPercent(0) * 100;
|
102
|
+
return (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({}, groupProps, {
|
103
|
+
sx: {
|
104
|
+
position: 'relative',
|
105
|
+
alignItems: 'center',
|
106
|
+
width: '100%',
|
107
|
+
touchAction: 'none'
|
108
|
+
}
|
109
|
+
}), (0, _react2.jsx)(_index.Box, {
|
110
|
+
sx: {
|
111
|
+
alignSelf: 'stretch'
|
112
|
+
}
|
113
|
+
}, props.label && (0, _react2.jsx)("label", labelProps, props.label), (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({}, outputProps, {
|
114
|
+
sx: {
|
115
|
+
flex: '1 0 auto',
|
116
|
+
textAlign: 'end'
|
117
|
+
}
|
118
|
+
}), "(", state.getThumbValueLabel(0), ")")), (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({}, trackProps, {
|
119
|
+
ref: trackRef,
|
120
|
+
sx: {
|
121
|
+
position: 'relative',
|
122
|
+
height: 30,
|
123
|
+
width: ' 100%'
|
124
|
+
}
|
125
|
+
}), (0, _react2.jsx)(_index.Box, {
|
126
|
+
sx: {
|
127
|
+
position: 'absolute',
|
128
|
+
backgroundImage: thumbPosition < 25 ? (0, _concat["default"])(_context = "linear-gradient(to right, rgb(169, 215, 50) 0%, rgb(169, 215, 50) ".concat(thumbPosition, "%, rgb(242, 242, 242) ")).call(_context, thumbPosition, "%, rgb(242, 242, 242) 100%)") : thumbPosition >= 25 && thumbPosition <= 49 ? (0, _concat["default"])(_context2 = "linear-gradient(to right, rgb(226, 215, 20) 0%, rgb(226, 215, 20) ".concat(thumbPosition, "%, rgb(242, 242, 242) ")).call(_context2, thumbPosition, "%, rgb(242, 242, 242) 100%)") : thumbPosition >= 50 && thumbPosition <= 74 ? (0, _concat["default"])(_context3 = "linear-gradient(to right, rgb(231, 135, 38) 0%, rgb(231, 135, 38) ".concat(thumbPosition, "%, rgb(242, 242, 242) ")).call(_context3, thumbPosition, "%, rgb(242, 242, 242) 100%)") : (0, _concat["default"])(_context4 = "linear-gradient(to right, rgb(235, 44, 56) 0%, rgb(235, 44, 56) ".concat(thumbPosition, "%, rgb(242, 242, 242) ")).call(_context4, thumbPosition, "%, rgb(242, 242, 242) 100%)"),
|
129
|
+
height: 10,
|
130
|
+
borderRadius: '5px',
|
131
|
+
top: 13,
|
132
|
+
width: '100%'
|
133
|
+
}
|
134
|
+
}), (0, _react2.jsx)(Thumb, {
|
135
|
+
index: 0,
|
136
|
+
state: state,
|
137
|
+
trackRef: trackRef
|
138
|
+
})));
|
139
|
+
};
|
140
|
+
|
141
|
+
var RangeSlider = function RangeSlider(props) {
|
142
|
+
var _context5;
|
143
|
+
|
144
|
+
var trackRef = _react["default"].useRef(null);
|
145
|
+
|
146
|
+
var numberFormatter = (0, _i18n.useNumberFormatter)(props.formatOptions);
|
147
|
+
var state = (0, _slider2.useSliderState)(_objectSpread(_objectSpread({}, props), {}, {
|
148
|
+
numberFormatter: numberFormatter
|
149
|
+
}));
|
150
|
+
|
151
|
+
var _useSlider2 = (0, _slider.useSlider)(props, state, trackRef),
|
152
|
+
groupProps = _useSlider2.groupProps,
|
153
|
+
trackProps = _useSlider2.trackProps,
|
154
|
+
labelProps = _useSlider2.labelProps,
|
155
|
+
outputProps = _useSlider2.outputProps;
|
156
|
+
|
157
|
+
return (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({}, groupProps, {
|
158
|
+
sx: {
|
159
|
+
position: 'relative',
|
160
|
+
alignItems: 'center',
|
161
|
+
width: '100%',
|
162
|
+
touchAction: 'none'
|
163
|
+
}
|
164
|
+
}), (0, _react2.jsx)(_index.Box, {
|
165
|
+
sx: {
|
166
|
+
alignSelf: 'stretch'
|
167
|
+
}
|
168
|
+
}, props.label && (0, _react2.jsx)("label", labelProps, props.label), (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({}, outputProps, {
|
169
|
+
sx: {
|
170
|
+
flex: '1 0 auto',
|
171
|
+
textAlign: 'end'
|
172
|
+
}
|
173
|
+
}), "(", (0, _concat["default"])(_context5 = "".concat(state.getThumbValueLabel(0), ", ")).call(_context5, state.getThumbValueLabel(1)), ")")), (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({}, trackProps, {
|
174
|
+
ref: trackRef,
|
175
|
+
sx: {
|
176
|
+
position: 'relative',
|
177
|
+
height: 30,
|
178
|
+
width: ' 100%'
|
179
|
+
}
|
180
|
+
}), (0, _react2.jsx)(_index.Box, {
|
181
|
+
sx: {
|
182
|
+
position: 'absolute',
|
183
|
+
backgroundImage: 'linear-gradient(to right, rgb(169, 215, 50) 10%, rgb(226, 215, 20) 50%, rgb(235, 44, 56) 90%)',
|
184
|
+
height: 10,
|
185
|
+
borderRadius: '5px',
|
186
|
+
top: 13,
|
187
|
+
width: '100%'
|
188
|
+
}
|
189
|
+
}), (0, _react2.jsx)(Thumb, {
|
190
|
+
index: 0,
|
191
|
+
state: state,
|
192
|
+
trackRef: trackRef
|
193
|
+
}), (0, _react2.jsx)(Thumb, {
|
194
|
+
index: 1,
|
195
|
+
state: state,
|
196
|
+
trackRef: trackRef
|
197
|
+
})));
|
198
|
+
};
|
199
|
+
|
200
|
+
var Thumb = function Thumb(props) {
|
201
|
+
var state = props.state,
|
202
|
+
trackRef = props.trackRef,
|
203
|
+
index = props.index;
|
204
|
+
|
205
|
+
var inputRef = _react["default"].useRef(null);
|
206
|
+
|
207
|
+
var _useSliderThumb = (0, _slider.useSliderThumb)({
|
208
|
+
index: index,
|
209
|
+
trackRef: trackRef,
|
210
|
+
inputRef: inputRef
|
211
|
+
}, state),
|
212
|
+
thumbProps = _useSliderThumb.thumbProps,
|
213
|
+
inputProps = _useSliderThumb.inputProps;
|
214
|
+
|
215
|
+
var _useFocusRing = (0, _focus.useFocusRing)(),
|
216
|
+
focusProps = _useFocusRing.focusProps,
|
217
|
+
isFocusVisible = _useFocusRing.isFocusVisible;
|
218
|
+
|
219
|
+
return (0, _react2.jsx)(_index.Box, {
|
220
|
+
sx: {
|
221
|
+
position: 'absolute',
|
222
|
+
top: 5,
|
223
|
+
transform: 'translateX(-50%)',
|
224
|
+
left: "".concat(state.getThumbPercent(index) * 100, "%")
|
225
|
+
}
|
226
|
+
}, (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({}, thumbProps, {
|
227
|
+
sx: {
|
228
|
+
width: 25,
|
229
|
+
height: 25,
|
230
|
+
borderRadius: '50%',
|
231
|
+
backgroundColor: 'white',
|
232
|
+
border: '1px solid #C1C5C8',
|
233
|
+
boxShadow: '0 2px 2px 0 #CACACA',
|
234
|
+
outline: isFocusVisible ? '5px solid rgba(41,150,204,0.5)' : 'none'
|
235
|
+
}
|
236
|
+
}), (0, _react2.jsx)(_visuallyHidden.VisuallyHidden, null, (0, _react2.jsx)("input", (0, _extends2["default"])({
|
237
|
+
ref: inputRef
|
238
|
+
}, (0, _utils.mergeProps)(inputProps, focusProps))))));
|
239
|
+
};
|
@@ -0,0 +1,204 @@
|
|
1
|
+
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
2
|
+
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
3
|
+
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
4
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
5
|
+
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
6
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
7
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
8
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
9
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
10
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
11
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
12
|
+
|
13
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
14
|
+
|
15
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context6, _context7; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context6 = ownKeys(Object(source), !0)).call(_context6, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context7 = ownKeys(Object(source))).call(_context7, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
16
|
+
|
17
|
+
/* eslint-disable no-nested-ternary */
|
18
|
+
import React from 'react';
|
19
|
+
import { useSlider, useSliderThumb } from '@react-aria/slider';
|
20
|
+
import { useSliderState } from '@react-stately/slider';
|
21
|
+
import { useFocusRing } from '@react-aria/focus';
|
22
|
+
import { VisuallyHidden } from '@react-aria/visually-hidden';
|
23
|
+
import { mergeProps } from '@react-aria/utils';
|
24
|
+
import { useNumberFormatter } from '@react-aria/i18n';
|
25
|
+
import { Box } from '../index';
|
26
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
27
|
+
export default {
|
28
|
+
title: 'Recipes/Slider'
|
29
|
+
};
|
30
|
+
/*
|
31
|
+
* The slider value can be formatted by using the `formatOptions` prop.
|
32
|
+
`* formatOptions` is compatible with the option parameter of
|
33
|
+
* [Intl.NumberFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat)
|
34
|
+
* and is applied based on the current locale.
|
35
|
+
* https://react-spectrum.adobe.com/react-aria/useSlider.html
|
36
|
+
*/
|
37
|
+
|
38
|
+
export var Default = function Default() {
|
39
|
+
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Box, {
|
40
|
+
mb: "xl"
|
41
|
+
}, ___EmotionJSX(Slider, {
|
42
|
+
label: "Single with solid lower background",
|
43
|
+
maxValue: 100,
|
44
|
+
step: 1
|
45
|
+
})), ___EmotionJSX(Box, null, ___EmotionJSX(RangeSlider, {
|
46
|
+
label: "Multiple with gradient background and custom point values",
|
47
|
+
maxValue: 100,
|
48
|
+
defaultValue: [0, 1],
|
49
|
+
step: 1
|
50
|
+
})));
|
51
|
+
};
|
52
|
+
|
53
|
+
var Slider = function Slider(props) {
|
54
|
+
var _context, _context2, _context3, _context4;
|
55
|
+
|
56
|
+
var trackRef = React.useRef(null);
|
57
|
+
var numberFormatter = useNumberFormatter(props.formatOptions);
|
58
|
+
var state = useSliderState(_objectSpread(_objectSpread({}, props), {}, {
|
59
|
+
numberFormatter: numberFormatter
|
60
|
+
}));
|
61
|
+
|
62
|
+
var _useSlider = useSlider(props, state, trackRef),
|
63
|
+
groupProps = _useSlider.groupProps,
|
64
|
+
trackProps = _useSlider.trackProps,
|
65
|
+
labelProps = _useSlider.labelProps,
|
66
|
+
outputProps = _useSlider.outputProps;
|
67
|
+
|
68
|
+
var thumbPosition = state.getThumbPercent(0) * 100;
|
69
|
+
return ___EmotionJSX(Box, _extends({}, groupProps, {
|
70
|
+
sx: {
|
71
|
+
position: 'relative',
|
72
|
+
alignItems: 'center',
|
73
|
+
width: '100%',
|
74
|
+
touchAction: 'none'
|
75
|
+
}
|
76
|
+
}), ___EmotionJSX(Box, {
|
77
|
+
sx: {
|
78
|
+
alignSelf: 'stretch'
|
79
|
+
}
|
80
|
+
}, props.label && ___EmotionJSX("label", labelProps, props.label), ___EmotionJSX(Box, _extends({}, outputProps, {
|
81
|
+
sx: {
|
82
|
+
flex: '1 0 auto',
|
83
|
+
textAlign: 'end'
|
84
|
+
}
|
85
|
+
}), "(", state.getThumbValueLabel(0), ")")), ___EmotionJSX(Box, _extends({}, trackProps, {
|
86
|
+
ref: trackRef,
|
87
|
+
sx: {
|
88
|
+
position: 'relative',
|
89
|
+
height: 30,
|
90
|
+
width: ' 100%'
|
91
|
+
}
|
92
|
+
}), ___EmotionJSX(Box, {
|
93
|
+
sx: {
|
94
|
+
position: 'absolute',
|
95
|
+
backgroundImage: thumbPosition < 25 ? _concatInstanceProperty(_context = "linear-gradient(to right, rgb(169, 215, 50) 0%, rgb(169, 215, 50) ".concat(thumbPosition, "%, rgb(242, 242, 242) ")).call(_context, thumbPosition, "%, rgb(242, 242, 242) 100%)") : thumbPosition >= 25 && thumbPosition <= 49 ? _concatInstanceProperty(_context2 = "linear-gradient(to right, rgb(226, 215, 20) 0%, rgb(226, 215, 20) ".concat(thumbPosition, "%, rgb(242, 242, 242) ")).call(_context2, thumbPosition, "%, rgb(242, 242, 242) 100%)") : thumbPosition >= 50 && thumbPosition <= 74 ? _concatInstanceProperty(_context3 = "linear-gradient(to right, rgb(231, 135, 38) 0%, rgb(231, 135, 38) ".concat(thumbPosition, "%, rgb(242, 242, 242) ")).call(_context3, thumbPosition, "%, rgb(242, 242, 242) 100%)") : _concatInstanceProperty(_context4 = "linear-gradient(to right, rgb(235, 44, 56) 0%, rgb(235, 44, 56) ".concat(thumbPosition, "%, rgb(242, 242, 242) ")).call(_context4, thumbPosition, "%, rgb(242, 242, 242) 100%)"),
|
96
|
+
height: 10,
|
97
|
+
borderRadius: '5px',
|
98
|
+
top: 13,
|
99
|
+
width: '100%'
|
100
|
+
}
|
101
|
+
}), ___EmotionJSX(Thumb, {
|
102
|
+
index: 0,
|
103
|
+
state: state,
|
104
|
+
trackRef: trackRef
|
105
|
+
})));
|
106
|
+
};
|
107
|
+
|
108
|
+
var RangeSlider = function RangeSlider(props) {
|
109
|
+
var _context5;
|
110
|
+
|
111
|
+
var trackRef = React.useRef(null);
|
112
|
+
var numberFormatter = useNumberFormatter(props.formatOptions);
|
113
|
+
var state = useSliderState(_objectSpread(_objectSpread({}, props), {}, {
|
114
|
+
numberFormatter: numberFormatter
|
115
|
+
}));
|
116
|
+
|
117
|
+
var _useSlider2 = useSlider(props, state, trackRef),
|
118
|
+
groupProps = _useSlider2.groupProps,
|
119
|
+
trackProps = _useSlider2.trackProps,
|
120
|
+
labelProps = _useSlider2.labelProps,
|
121
|
+
outputProps = _useSlider2.outputProps;
|
122
|
+
|
123
|
+
return ___EmotionJSX(Box, _extends({}, groupProps, {
|
124
|
+
sx: {
|
125
|
+
position: 'relative',
|
126
|
+
alignItems: 'center',
|
127
|
+
width: '100%',
|
128
|
+
touchAction: 'none'
|
129
|
+
}
|
130
|
+
}), ___EmotionJSX(Box, {
|
131
|
+
sx: {
|
132
|
+
alignSelf: 'stretch'
|
133
|
+
}
|
134
|
+
}, props.label && ___EmotionJSX("label", labelProps, props.label), ___EmotionJSX(Box, _extends({}, outputProps, {
|
135
|
+
sx: {
|
136
|
+
flex: '1 0 auto',
|
137
|
+
textAlign: 'end'
|
138
|
+
}
|
139
|
+
}), "(", _concatInstanceProperty(_context5 = "".concat(state.getThumbValueLabel(0), ", ")).call(_context5, state.getThumbValueLabel(1)), ")")), ___EmotionJSX(Box, _extends({}, trackProps, {
|
140
|
+
ref: trackRef,
|
141
|
+
sx: {
|
142
|
+
position: 'relative',
|
143
|
+
height: 30,
|
144
|
+
width: ' 100%'
|
145
|
+
}
|
146
|
+
}), ___EmotionJSX(Box, {
|
147
|
+
sx: {
|
148
|
+
position: 'absolute',
|
149
|
+
backgroundImage: 'linear-gradient(to right, rgb(169, 215, 50) 10%, rgb(226, 215, 20) 50%, rgb(235, 44, 56) 90%)',
|
150
|
+
height: 10,
|
151
|
+
borderRadius: '5px',
|
152
|
+
top: 13,
|
153
|
+
width: '100%'
|
154
|
+
}
|
155
|
+
}), ___EmotionJSX(Thumb, {
|
156
|
+
index: 0,
|
157
|
+
state: state,
|
158
|
+
trackRef: trackRef
|
159
|
+
}), ___EmotionJSX(Thumb, {
|
160
|
+
index: 1,
|
161
|
+
state: state,
|
162
|
+
trackRef: trackRef
|
163
|
+
})));
|
164
|
+
};
|
165
|
+
|
166
|
+
var Thumb = function Thumb(props) {
|
167
|
+
var state = props.state,
|
168
|
+
trackRef = props.trackRef,
|
169
|
+
index = props.index;
|
170
|
+
var inputRef = React.useRef(null);
|
171
|
+
|
172
|
+
var _useSliderThumb = useSliderThumb({
|
173
|
+
index: index,
|
174
|
+
trackRef: trackRef,
|
175
|
+
inputRef: inputRef
|
176
|
+
}, state),
|
177
|
+
thumbProps = _useSliderThumb.thumbProps,
|
178
|
+
inputProps = _useSliderThumb.inputProps;
|
179
|
+
|
180
|
+
var _useFocusRing = useFocusRing(),
|
181
|
+
focusProps = _useFocusRing.focusProps,
|
182
|
+
isFocusVisible = _useFocusRing.isFocusVisible;
|
183
|
+
|
184
|
+
return ___EmotionJSX(Box, {
|
185
|
+
sx: {
|
186
|
+
position: 'absolute',
|
187
|
+
top: 5,
|
188
|
+
transform: 'translateX(-50%)',
|
189
|
+
left: "".concat(state.getThumbPercent(index) * 100, "%")
|
190
|
+
}
|
191
|
+
}, ___EmotionJSX(Box, _extends({}, thumbProps, {
|
192
|
+
sx: {
|
193
|
+
width: 25,
|
194
|
+
height: 25,
|
195
|
+
borderRadius: '50%',
|
196
|
+
backgroundColor: 'white',
|
197
|
+
border: '1px solid #C1C5C8',
|
198
|
+
boxShadow: '0 2px 2px 0 #CACACA',
|
199
|
+
outline: isFocusVisible ? '5px solid rgba(41,150,204,0.5)' : 'none'
|
200
|
+
}
|
201
|
+
}), ___EmotionJSX(VisuallyHidden, null, ___EmotionJSX("input", _extends({
|
202
|
+
ref: inputRef
|
203
|
+
}, mergeProps(inputProps, focusProps))))));
|
204
|
+
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pingux/astro",
|
3
|
-
"version": "1.10.0-alpha.
|
3
|
+
"version": "1.10.0-alpha.3",
|
4
4
|
"description": "PingUX themeable React component library",
|
5
5
|
"author": "ux-development@pingidentity.com",
|
6
6
|
"license": "Apache-2.0",
|
@@ -98,6 +98,7 @@
|
|
98
98
|
"@react-aria/select": "^3.2.3",
|
99
99
|
"@react-aria/selection": "^3.3.1",
|
100
100
|
"@react-aria/separator": "^3.1.1",
|
101
|
+
"@react-aria/slider": "^3.0.7",
|
101
102
|
"@react-aria/switch": "3.1.1",
|
102
103
|
"@react-aria/tabs": "^3.0.1",
|
103
104
|
"@react-aria/tooltip": "^3.1.2",
|
@@ -119,6 +120,7 @@
|
|
119
120
|
"@react-stately/radio": "^3.2.0",
|
120
121
|
"@react-stately/searchfield": "^3.1.1",
|
121
122
|
"@react-stately/select": "^3.1.1",
|
123
|
+
"@react-stately/slider": "^3.0.7",
|
122
124
|
"@react-stately/tabs": "^3.0.1",
|
123
125
|
"@react-stately/toggle": "^3.2.0",
|
124
126
|
"@react-stately/tooltip": "^3.0.4",
|