@react-spectrum/slider 3.6.8-nightly.4552 → 3.6.8-nightly.4558
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/dist/RangeSlider.main.js +117 -0
- package/dist/RangeSlider.main.js.map +1 -0
- package/dist/RangeSlider.mjs +112 -0
- package/dist/RangeSlider.module.js +112 -0
- package/dist/RangeSlider.module.js.map +1 -0
- package/dist/Slider.main.js +123 -0
- package/dist/Slider.main.js.map +1 -0
- package/dist/Slider.mjs +118 -0
- package/dist/Slider.module.js +118 -0
- package/dist/Slider.module.js.map +1 -0
- package/dist/SliderBase.main.js +172 -0
- package/dist/SliderBase.main.js.map +1 -0
- package/dist/SliderBase.mjs +167 -0
- package/dist/SliderBase.module.js +167 -0
- package/dist/SliderBase.module.js.map +1 -0
- package/dist/SliderThumb.main.js +67 -0
- package/dist/SliderThumb.main.js.map +1 -0
- package/dist/SliderThumb.mjs +62 -0
- package/dist/SliderThumb.module.js +62 -0
- package/dist/SliderThumb.module.js.map +1 -0
- package/dist/ar-AE.mjs +1 -1
- package/dist/bg-BG.mjs +1 -1
- package/dist/cs-CZ.mjs +1 -1
- package/dist/da-DK.mjs +1 -1
- package/dist/de-DE.mjs +1 -1
- package/dist/el-GR.mjs +1 -1
- package/dist/en-US.mjs +1 -1
- package/dist/es-ES.mjs +1 -1
- package/dist/et-EE.mjs +1 -1
- package/dist/fi-FI.mjs +1 -1
- package/dist/fr-FR.mjs +1 -1
- package/dist/he-IL.mjs +1 -1
- package/dist/hr-HR.mjs +1 -1
- package/dist/hu-HU.mjs +1 -1
- package/dist/import.mjs +2 -660
- package/dist/intlStrings.main.js +108 -0
- package/dist/intlStrings.main.js.map +1 -0
- package/dist/intlStrings.mjs +110 -0
- package/dist/intlStrings.module.js +110 -0
- package/dist/intlStrings.module.js.map +1 -0
- package/dist/it-IT.mjs +1 -1
- package/dist/ja-JP.mjs +1 -1
- package/dist/ko-KR.mjs +1 -1
- package/dist/lt-LT.mjs +1 -1
- package/dist/lv-LV.mjs +1 -1
- package/dist/main.js +4 -658
- package/dist/main.js.map +1 -1
- package/dist/module.js +2 -660
- package/dist/module.js.map +1 -1
- package/dist/nb-NO.mjs +1 -1
- package/dist/nl-NL.mjs +1 -1
- package/dist/pl-PL.mjs +1 -1
- package/dist/pt-BR.mjs +1 -1
- package/dist/pt-PT.mjs +1 -1
- package/dist/ro-RO.mjs +1 -1
- package/dist/ru-RU.mjs +1 -1
- package/dist/sk-SK.mjs +1 -1
- package/dist/sl-SI.mjs +1 -1
- package/dist/slider_vars_css.main.js +146 -0
- package/dist/slider_vars_css.main.js.map +1 -0
- package/dist/slider_vars_css.mjs +148 -0
- package/dist/slider_vars_css.module.js +148 -0
- package/dist/slider_vars_css.module.js.map +1 -0
- package/dist/sr-SP.mjs +1 -1
- package/dist/sv-SE.mjs +1 -1
- package/dist/tr-TR.mjs +1 -1
- package/dist/types.d.ts +3 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/uk-UA.mjs +1 -1
- package/dist/{main.css → vars.b570f076.css} +1 -1
- package/dist/{main.css.map → vars.b570f076.css.map} +1 -1
- package/dist/zh-CN.mjs +1 -1
- package/dist/zh-TW.mjs +1 -1
- package/package.json +13 -13
- package/dist/module.css +0 -1189
- package/dist/module.css.map +0 -1
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
var $a8b5f113a6a8e4d8$exports = require("./intlStrings.main.js");
|
|
2
|
+
var $ec6ca573d82152ff$exports = require("./SliderBase.main.js");
|
|
3
|
+
var $77acc7fb8bfd13d6$exports = require("./SliderThumb.main.js");
|
|
4
|
+
require("./vars.b570f076.css");
|
|
5
|
+
var $57893a49ef34c169$exports = require("./slider_vars_css.main.js");
|
|
6
|
+
var $5TzYf$reactspectrumutils = require("@react-spectrum/utils");
|
|
7
|
+
var $5TzYf$react = require("react");
|
|
8
|
+
var $5TzYf$reactariai18n = require("@react-aria/i18n");
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
function $parcel$interopDefault(a) {
|
|
12
|
+
return a && a.__esModule ? a.default : a;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function $parcel$export(e, n, v, s) {
|
|
16
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
$parcel$export(module.exports, "RangeSlider", () => $f166b52c7f82645c$export$826424dabc3dd705);
|
|
20
|
+
/*
|
|
21
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
22
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
23
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
24
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
25
|
+
*
|
|
26
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
27
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
28
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
29
|
+
* governing permissions and limitations under the License.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
function $f166b52c7f82645c$var$RangeSlider(props, ref) {
|
|
38
|
+
let { onChange: onChange, onChangeEnd: onChangeEnd, value: value, defaultValue: defaultValue, getValueLabel: getValueLabel, ...otherProps } = props;
|
|
39
|
+
var _props_minValue, _props_maxValue;
|
|
40
|
+
let baseProps = {
|
|
41
|
+
...otherProps,
|
|
42
|
+
value: value != null ? [
|
|
43
|
+
value.start,
|
|
44
|
+
value.end
|
|
45
|
+
] : undefined,
|
|
46
|
+
defaultValue: defaultValue != null ? [
|
|
47
|
+
defaultValue.start,
|
|
48
|
+
defaultValue.end
|
|
49
|
+
] : [
|
|
50
|
+
(_props_minValue = props.minValue) !== null && _props_minValue !== void 0 ? _props_minValue : 0,
|
|
51
|
+
(_props_maxValue = props.maxValue) !== null && _props_maxValue !== void 0 ? _props_maxValue : 100
|
|
52
|
+
],
|
|
53
|
+
onChange (v) {
|
|
54
|
+
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
55
|
+
start: v[0],
|
|
56
|
+
end: v[1]
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
onChangeEnd (v) {
|
|
60
|
+
onChangeEnd === null || onChangeEnd === void 0 ? void 0 : onChangeEnd({
|
|
61
|
+
start: v[0],
|
|
62
|
+
end: v[1]
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
getValueLabel: getValueLabel ? ([start, end])=>getValueLabel({
|
|
66
|
+
start: start,
|
|
67
|
+
end: end
|
|
68
|
+
}) : undefined
|
|
69
|
+
};
|
|
70
|
+
let stringFormatter = (0, $5TzYf$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($a8b5f113a6a8e4d8$exports))), "@react-spectrum/slider");
|
|
71
|
+
let { direction: direction } = (0, $5TzYf$reactariai18n.useLocale)();
|
|
72
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($5TzYf$react))).createElement((0, $ec6ca573d82152ff$exports.SliderBase), {
|
|
73
|
+
...baseProps,
|
|
74
|
+
classes: "spectrum-Slider--range",
|
|
75
|
+
ref: ref
|
|
76
|
+
}, ({ trackRef: trackRef, inputRef: inputRef, state: state })=>{
|
|
77
|
+
let cssDirection = direction === "rtl" ? "right" : "left";
|
|
78
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($5TzYf$react))).createElement((0, ($parcel$interopDefault($5TzYf$react))).Fragment, null, /*#__PURE__*/ (0, ($parcel$interopDefault($5TzYf$react))).createElement("div", {
|
|
79
|
+
className: (0, $5TzYf$reactspectrumutils.classNames)((0, ($parcel$interopDefault($57893a49ef34c169$exports))), "spectrum-Slider-track"),
|
|
80
|
+
style: {
|
|
81
|
+
width: `${state.getThumbPercent(0) * 100}%`
|
|
82
|
+
}
|
|
83
|
+
}), /*#__PURE__*/ (0, ($parcel$interopDefault($5TzYf$react))).createElement((0, $77acc7fb8bfd13d6$exports.SliderThumb), {
|
|
84
|
+
index: 0,
|
|
85
|
+
"aria-label": stringFormatter.format("minimum"),
|
|
86
|
+
isDisabled: props.isDisabled,
|
|
87
|
+
trackRef: trackRef,
|
|
88
|
+
inputRef: inputRef,
|
|
89
|
+
state: state,
|
|
90
|
+
name: props.startName
|
|
91
|
+
}), /*#__PURE__*/ (0, ($parcel$interopDefault($5TzYf$react))).createElement("div", {
|
|
92
|
+
className: (0, $5TzYf$reactspectrumutils.classNames)((0, ($parcel$interopDefault($57893a49ef34c169$exports))), "spectrum-Slider-track"),
|
|
93
|
+
style: {
|
|
94
|
+
[cssDirection]: `${state.getThumbPercent(0) * 100}%`,
|
|
95
|
+
width: `${Math.abs(state.getThumbPercent(0) - state.getThumbPercent(1)) * 100}%`
|
|
96
|
+
}
|
|
97
|
+
}), /*#__PURE__*/ (0, ($parcel$interopDefault($5TzYf$react))).createElement((0, $77acc7fb8bfd13d6$exports.SliderThumb), {
|
|
98
|
+
index: 1,
|
|
99
|
+
"aria-label": stringFormatter.format("maximum"),
|
|
100
|
+
isDisabled: props.isDisabled,
|
|
101
|
+
trackRef: trackRef,
|
|
102
|
+
state: state,
|
|
103
|
+
name: props.endName
|
|
104
|
+
}), /*#__PURE__*/ (0, ($parcel$interopDefault($5TzYf$react))).createElement("div", {
|
|
105
|
+
className: (0, $5TzYf$reactspectrumutils.classNames)((0, ($parcel$interopDefault($57893a49ef34c169$exports))), "spectrum-Slider-track"),
|
|
106
|
+
style: {
|
|
107
|
+
width: `${(1 - state.getThumbPercent(1)) * 100}%`
|
|
108
|
+
}
|
|
109
|
+
}));
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* RangeSliders allow users to quickly select a subset range. They should be used when the upper and lower bounds to the range are invariable.
|
|
114
|
+
*/ const $f166b52c7f82645c$export$826424dabc3dd705 = /*#__PURE__*/ (0, ($parcel$interopDefault($5TzYf$react))).forwardRef($f166b52c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ACrD,IAAI,eAAe,cAAc,QAAQ,UAAU;QACnD,qBACE,oIACE,0DAAC;YACC,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;YAC9B,OAAO;gBAAC,OAAO,CAAC,EAAE,MAAM,eAAe,CAAC,KAAK,IAAI,CAAC,CAAC;YAAA;0BACrD,0DAAC,CAAA,GAAA,qCAAU;YACT,OAAO;YACP,cAAY,gBAAgB,MAAM,CAAC;YACnC,YAAY,MAAM,UAAU;YAC5B,UAAU;YACV,UAAU;YACV,OAAO;YACP,MAAM,MAAM,SAAS;0BACvB,0DAAC;YACC,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;YAC9B,OAAO;gBACL,CAAC,aAAa,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC,KAAK,IAAI,CAAC,CAAC;gBACpD,OAAO,CAAC,EAAE,KAAK,GAAG,CAAC,MAAM,eAAe,CAAC,KAAK,MAAM,eAAe,CAAC,MAAM,IAAI,CAAC,CAAC;YAClF;0BACF,0DAAC,CAAA,GAAA,qCAAU;YACT,OAAO;YACP,cAAY,gBAAgB,MAAM,CAAC;YACnC,YAAY,MAAM,UAAU;YAC5B,UAAU;YACV,OAAO;YACP,MAAM,MAAM,OAAO;0BACrB,0DAAC;YACC,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;YAC9B,OAAO;gBACL,OAAO,CAAC,EAAE,AAAC,CAAA,IAAI,MAAM,eAAe,CAAC,EAAC,IAAK,IAAI,CAAC,CAAC;YACnD;;IAGR;AAGN;AAEA;;CAEC,GACD,MAAM,0DAAe,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/slider/src/RangeSlider.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames} from '@react-spectrum/utils';\nimport {FocusableRef} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport React from 'react';\nimport {SliderBase, SliderBaseChildArguments, SliderBaseProps} from './SliderBase';\nimport {SliderThumb} from './SliderThumb';\nimport {SpectrumRangeSliderProps} from '@react-types/slider';\nimport styles from '@adobe/spectrum-css-temp/components/slider/vars.css';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\n\nfunction RangeSlider(props: SpectrumRangeSliderProps, ref: FocusableRef<HTMLDivElement>) {\n let {onChange, onChangeEnd, value, defaultValue, getValueLabel, ...otherProps} = props;\n\n let baseProps: Omit<SliderBaseProps<number[]>, 'children'> = {\n ...otherProps,\n value: value != null ? [value.start, value.end] : undefined,\n defaultValue: defaultValue != null\n ? [defaultValue.start, defaultValue.end]\n // make sure that useSliderState knows we have two handles\n : [props.minValue ?? 0, props.maxValue ?? 100],\n onChange(v) {\n onChange?.({start: v[0], end: v[1]});\n },\n onChangeEnd(v) {\n onChangeEnd?.({start: v[0], end: v[1]});\n },\n getValueLabel: getValueLabel ? ([start, end]) => getValueLabel({start, end}) : undefined\n };\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/slider');\n let {direction} = useLocale();\n\n return (\n <SliderBase {...baseProps} classes={'spectrum-Slider--range'} ref={ref}>\n {({trackRef, inputRef, state}: SliderBaseChildArguments) => {\n let cssDirection = direction === 'rtl' ? 'right' : 'left';\n return (\n <>\n <div\n className={classNames(styles, 'spectrum-Slider-track')}\n style={{width: `${state.getThumbPercent(0) * 100}%`}} />\n <SliderThumb\n index={0}\n aria-label={stringFormatter.format('minimum')}\n isDisabled={props.isDisabled}\n trackRef={trackRef}\n inputRef={inputRef}\n state={state}\n name={props.startName} />\n <div\n className={classNames(styles, 'spectrum-Slider-track')}\n style={{\n [cssDirection]: `${state.getThumbPercent(0) * 100}%`,\n width: `${Math.abs(state.getThumbPercent(0) - state.getThumbPercent(1)) * 100}%`\n }} />\n <SliderThumb\n index={1}\n aria-label={stringFormatter.format('maximum')}\n isDisabled={props.isDisabled}\n trackRef={trackRef}\n state={state}\n name={props.endName} />\n <div\n className={classNames(styles, 'spectrum-Slider-track')}\n style={{\n width: `${(1 - state.getThumbPercent(1)) * 100}%`\n }} />\n </>\n );\n }}\n </SliderBase>\n );\n}\n\n/**\n * RangeSliders allow users to quickly select a subset range. They should be used when the upper and lower bounds to the range are invariable.\n */\nconst _RangeSlider = React.forwardRef(RangeSlider);\nexport {_RangeSlider as RangeSlider};\n"],"names":[],"version":3,"file":"RangeSlider.main.js.map"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import $bc8Se$intlStringsmodulejs from "./intlStrings.mjs";
|
|
2
|
+
import {SliderBase as $39572711324a3b8e$export$9418495bb635ebde} from "./SliderBase.mjs";
|
|
3
|
+
import {SliderThumb as $9058ca69d66a724f$export$2c1b491743890dec} from "./SliderThumb.mjs";
|
|
4
|
+
import "./vars.b570f076.css";
|
|
5
|
+
import $bc8Se$slider_vars_cssmodulejs from "./slider_vars_css.mjs";
|
|
6
|
+
import {classNames as $bc8Se$classNames} from "@react-spectrum/utils";
|
|
7
|
+
import $bc8Se$react from "react";
|
|
8
|
+
import {useLocalizedStringFormatter as $bc8Se$useLocalizedStringFormatter, useLocale as $bc8Se$useLocale} from "@react-aria/i18n";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
function $parcel$interopDefault(a) {
|
|
12
|
+
return a && a.__esModule ? a.default : a;
|
|
13
|
+
}
|
|
14
|
+
/*
|
|
15
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
16
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
17
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
18
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
19
|
+
*
|
|
20
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
21
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
22
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
23
|
+
* governing permissions and limitations under the License.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
function $d42a197b273dc031$var$RangeSlider(props, ref) {
|
|
32
|
+
let { onChange: onChange, onChangeEnd: onChangeEnd, value: value, defaultValue: defaultValue, getValueLabel: getValueLabel, ...otherProps } = props;
|
|
33
|
+
var _props_minValue, _props_maxValue;
|
|
34
|
+
let baseProps = {
|
|
35
|
+
...otherProps,
|
|
36
|
+
value: value != null ? [
|
|
37
|
+
value.start,
|
|
38
|
+
value.end
|
|
39
|
+
] : undefined,
|
|
40
|
+
defaultValue: defaultValue != null ? [
|
|
41
|
+
defaultValue.start,
|
|
42
|
+
defaultValue.end
|
|
43
|
+
] : [
|
|
44
|
+
(_props_minValue = props.minValue) !== null && _props_minValue !== void 0 ? _props_minValue : 0,
|
|
45
|
+
(_props_maxValue = props.maxValue) !== null && _props_maxValue !== void 0 ? _props_maxValue : 100
|
|
46
|
+
],
|
|
47
|
+
onChange (v) {
|
|
48
|
+
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
49
|
+
start: v[0],
|
|
50
|
+
end: v[1]
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
onChangeEnd (v) {
|
|
54
|
+
onChangeEnd === null || onChangeEnd === void 0 ? void 0 : onChangeEnd({
|
|
55
|
+
start: v[0],
|
|
56
|
+
end: v[1]
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
getValueLabel: getValueLabel ? ([start, end])=>getValueLabel({
|
|
60
|
+
start: start,
|
|
61
|
+
end: end
|
|
62
|
+
}) : undefined
|
|
63
|
+
};
|
|
64
|
+
let stringFormatter = (0, $bc8Se$useLocalizedStringFormatter)((0, ($parcel$interopDefault($bc8Se$intlStringsmodulejs))), "@react-spectrum/slider");
|
|
65
|
+
let { direction: direction } = (0, $bc8Se$useLocale)();
|
|
66
|
+
return /*#__PURE__*/ (0, $bc8Se$react).createElement((0, $39572711324a3b8e$export$9418495bb635ebde), {
|
|
67
|
+
...baseProps,
|
|
68
|
+
classes: "spectrum-Slider--range",
|
|
69
|
+
ref: ref
|
|
70
|
+
}, ({ trackRef: trackRef, inputRef: inputRef, state: state })=>{
|
|
71
|
+
let cssDirection = direction === "rtl" ? "right" : "left";
|
|
72
|
+
return /*#__PURE__*/ (0, $bc8Se$react).createElement((0, $bc8Se$react).Fragment, null, /*#__PURE__*/ (0, $bc8Se$react).createElement("div", {
|
|
73
|
+
className: (0, $bc8Se$classNames)((0, ($parcel$interopDefault($bc8Se$slider_vars_cssmodulejs))), "spectrum-Slider-track"),
|
|
74
|
+
style: {
|
|
75
|
+
width: `${state.getThumbPercent(0) * 100}%`
|
|
76
|
+
}
|
|
77
|
+
}), /*#__PURE__*/ (0, $bc8Se$react).createElement((0, $9058ca69d66a724f$export$2c1b491743890dec), {
|
|
78
|
+
index: 0,
|
|
79
|
+
"aria-label": stringFormatter.format("minimum"),
|
|
80
|
+
isDisabled: props.isDisabled,
|
|
81
|
+
trackRef: trackRef,
|
|
82
|
+
inputRef: inputRef,
|
|
83
|
+
state: state,
|
|
84
|
+
name: props.startName
|
|
85
|
+
}), /*#__PURE__*/ (0, $bc8Se$react).createElement("div", {
|
|
86
|
+
className: (0, $bc8Se$classNames)((0, ($parcel$interopDefault($bc8Se$slider_vars_cssmodulejs))), "spectrum-Slider-track"),
|
|
87
|
+
style: {
|
|
88
|
+
[cssDirection]: `${state.getThumbPercent(0) * 100}%`,
|
|
89
|
+
width: `${Math.abs(state.getThumbPercent(0) - state.getThumbPercent(1)) * 100}%`
|
|
90
|
+
}
|
|
91
|
+
}), /*#__PURE__*/ (0, $bc8Se$react).createElement((0, $9058ca69d66a724f$export$2c1b491743890dec), {
|
|
92
|
+
index: 1,
|
|
93
|
+
"aria-label": stringFormatter.format("maximum"),
|
|
94
|
+
isDisabled: props.isDisabled,
|
|
95
|
+
trackRef: trackRef,
|
|
96
|
+
state: state,
|
|
97
|
+
name: props.endName
|
|
98
|
+
}), /*#__PURE__*/ (0, $bc8Se$react).createElement("div", {
|
|
99
|
+
className: (0, $bc8Se$classNames)((0, ($parcel$interopDefault($bc8Se$slider_vars_cssmodulejs))), "spectrum-Slider-track"),
|
|
100
|
+
style: {
|
|
101
|
+
width: `${(1 - state.getThumbPercent(1)) * 100}%`
|
|
102
|
+
}
|
|
103
|
+
}));
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* RangeSliders allow users to quickly select a subset range. They should be used when the upper and lower bounds to the range are invariable.
|
|
108
|
+
*/ const $d42a197b273dc031$export$826424dabc3dd705 = /*#__PURE__*/ (0, $bc8Se$react).forwardRef($d42a197b273dc031$var$RangeSlider);
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
export {$d42a197b273dc031$export$826424dabc3dd705 as RangeSlider};
|
|
112
|
+
//# sourceMappingURL=RangeSlider.mjs.map
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import $bc8Se$intlStringsmodulejs from "./intlStrings.module.js";
|
|
2
|
+
import {SliderBase as $39572711324a3b8e$export$9418495bb635ebde} from "./SliderBase.module.js";
|
|
3
|
+
import {SliderThumb as $9058ca69d66a724f$export$2c1b491743890dec} from "./SliderThumb.module.js";
|
|
4
|
+
import "./vars.b570f076.css";
|
|
5
|
+
import $bc8Se$slider_vars_cssmodulejs from "./slider_vars_css.module.js";
|
|
6
|
+
import {classNames as $bc8Se$classNames} from "@react-spectrum/utils";
|
|
7
|
+
import $bc8Se$react from "react";
|
|
8
|
+
import {useLocalizedStringFormatter as $bc8Se$useLocalizedStringFormatter, useLocale as $bc8Se$useLocale} from "@react-aria/i18n";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
function $parcel$interopDefault(a) {
|
|
12
|
+
return a && a.__esModule ? a.default : a;
|
|
13
|
+
}
|
|
14
|
+
/*
|
|
15
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
16
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
17
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
18
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
19
|
+
*
|
|
20
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
21
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
22
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
23
|
+
* governing permissions and limitations under the License.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
function $d42a197b273dc031$var$RangeSlider(props, ref) {
|
|
32
|
+
let { onChange: onChange, onChangeEnd: onChangeEnd, value: value, defaultValue: defaultValue, getValueLabel: getValueLabel, ...otherProps } = props;
|
|
33
|
+
var _props_minValue, _props_maxValue;
|
|
34
|
+
let baseProps = {
|
|
35
|
+
...otherProps,
|
|
36
|
+
value: value != null ? [
|
|
37
|
+
value.start,
|
|
38
|
+
value.end
|
|
39
|
+
] : undefined,
|
|
40
|
+
defaultValue: defaultValue != null ? [
|
|
41
|
+
defaultValue.start,
|
|
42
|
+
defaultValue.end
|
|
43
|
+
] : [
|
|
44
|
+
(_props_minValue = props.minValue) !== null && _props_minValue !== void 0 ? _props_minValue : 0,
|
|
45
|
+
(_props_maxValue = props.maxValue) !== null && _props_maxValue !== void 0 ? _props_maxValue : 100
|
|
46
|
+
],
|
|
47
|
+
onChange (v) {
|
|
48
|
+
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
49
|
+
start: v[0],
|
|
50
|
+
end: v[1]
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
onChangeEnd (v) {
|
|
54
|
+
onChangeEnd === null || onChangeEnd === void 0 ? void 0 : onChangeEnd({
|
|
55
|
+
start: v[0],
|
|
56
|
+
end: v[1]
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
getValueLabel: getValueLabel ? ([start, end])=>getValueLabel({
|
|
60
|
+
start: start,
|
|
61
|
+
end: end
|
|
62
|
+
}) : undefined
|
|
63
|
+
};
|
|
64
|
+
let stringFormatter = (0, $bc8Se$useLocalizedStringFormatter)((0, ($parcel$interopDefault($bc8Se$intlStringsmodulejs))), "@react-spectrum/slider");
|
|
65
|
+
let { direction: direction } = (0, $bc8Se$useLocale)();
|
|
66
|
+
return /*#__PURE__*/ (0, $bc8Se$react).createElement((0, $39572711324a3b8e$export$9418495bb635ebde), {
|
|
67
|
+
...baseProps,
|
|
68
|
+
classes: "spectrum-Slider--range",
|
|
69
|
+
ref: ref
|
|
70
|
+
}, ({ trackRef: trackRef, inputRef: inputRef, state: state })=>{
|
|
71
|
+
let cssDirection = direction === "rtl" ? "right" : "left";
|
|
72
|
+
return /*#__PURE__*/ (0, $bc8Se$react).createElement((0, $bc8Se$react).Fragment, null, /*#__PURE__*/ (0, $bc8Se$react).createElement("div", {
|
|
73
|
+
className: (0, $bc8Se$classNames)((0, ($parcel$interopDefault($bc8Se$slider_vars_cssmodulejs))), "spectrum-Slider-track"),
|
|
74
|
+
style: {
|
|
75
|
+
width: `${state.getThumbPercent(0) * 100}%`
|
|
76
|
+
}
|
|
77
|
+
}), /*#__PURE__*/ (0, $bc8Se$react).createElement((0, $9058ca69d66a724f$export$2c1b491743890dec), {
|
|
78
|
+
index: 0,
|
|
79
|
+
"aria-label": stringFormatter.format("minimum"),
|
|
80
|
+
isDisabled: props.isDisabled,
|
|
81
|
+
trackRef: trackRef,
|
|
82
|
+
inputRef: inputRef,
|
|
83
|
+
state: state,
|
|
84
|
+
name: props.startName
|
|
85
|
+
}), /*#__PURE__*/ (0, $bc8Se$react).createElement("div", {
|
|
86
|
+
className: (0, $bc8Se$classNames)((0, ($parcel$interopDefault($bc8Se$slider_vars_cssmodulejs))), "spectrum-Slider-track"),
|
|
87
|
+
style: {
|
|
88
|
+
[cssDirection]: `${state.getThumbPercent(0) * 100}%`,
|
|
89
|
+
width: `${Math.abs(state.getThumbPercent(0) - state.getThumbPercent(1)) * 100}%`
|
|
90
|
+
}
|
|
91
|
+
}), /*#__PURE__*/ (0, $bc8Se$react).createElement((0, $9058ca69d66a724f$export$2c1b491743890dec), {
|
|
92
|
+
index: 1,
|
|
93
|
+
"aria-label": stringFormatter.format("maximum"),
|
|
94
|
+
isDisabled: props.isDisabled,
|
|
95
|
+
trackRef: trackRef,
|
|
96
|
+
state: state,
|
|
97
|
+
name: props.endName
|
|
98
|
+
}), /*#__PURE__*/ (0, $bc8Se$react).createElement("div", {
|
|
99
|
+
className: (0, $bc8Se$classNames)((0, ($parcel$interopDefault($bc8Se$slider_vars_cssmodulejs))), "spectrum-Slider-track"),
|
|
100
|
+
style: {
|
|
101
|
+
width: `${(1 - state.getThumbPercent(1)) * 100}%`
|
|
102
|
+
}
|
|
103
|
+
}));
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* RangeSliders allow users to quickly select a subset range. They should be used when the upper and lower bounds to the range are invariable.
|
|
108
|
+
*/ const $d42a197b273dc031$export$826424dabc3dd705 = /*#__PURE__*/ (0, $bc8Se$react).forwardRef($d42a197b273dc031$var$RangeSlider);
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
export {$d42a197b273dc031$export$826424dabc3dd705 as RangeSlider};
|
|
112
|
+
//# sourceMappingURL=RangeSlider.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAaD,SAAS,kCAAY,KAA+B,EAA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BACrD,gCAAC,CAAA,GAAA,yCAAU;YACT,OAAO;YACP,cAAY,gBAAgB,MAAM,CAAC;YACnC,YAAY,MAAM,UAAU;YAC5B,UAAU;YACV,UAAU;YACV,OAAO;YACP,MAAM,MAAM,SAAS;0BACvB,gCAAC;YACC,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,wDAAK,GAAG;YAC9B,OAAO;gBACL,CAAC,aAAa,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC,KAAK,IAAI,CAAC,CAAC;gBACpD,OAAO,CAAC,EAAE,KAAK,GAAG,CAAC,MAAM,eAAe,CAAC,KAAK,MAAM,eAAe,CAAC,MAAM,IAAI,CAAC,CAAC;YAClF;0BACF,gCAAC,CAAA,GAAA,yCAAU;YACT,OAAO;YACP,cAAY,gBAAgB,MAAM,CAAC;YACnC,YAAY,MAAM,UAAU;YAC5B,UAAU;YACV,OAAO;YACP,MAAM,MAAM,OAAO;0BACrB,gCAAC;YACC,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,wDAAK,GAAG;YAC9B,OAAO;gBACL,OAAO,CAAC,EAAE,AAAC,CAAA,IAAI,MAAM,eAAe,CAAC,EAAC,IAAK,IAAI,CAAC,CAAC;YACnD;;IAGR;AAGN;AAEA;;CAEC,GACD,MAAM,0DAAe,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/slider/src/RangeSlider.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames} from '@react-spectrum/utils';\nimport {FocusableRef} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport React from 'react';\nimport {SliderBase, SliderBaseChildArguments, SliderBaseProps} from './SliderBase';\nimport {SliderThumb} from './SliderThumb';\nimport {SpectrumRangeSliderProps} from '@react-types/slider';\nimport styles from '@adobe/spectrum-css-temp/components/slider/vars.css';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\n\nfunction RangeSlider(props: SpectrumRangeSliderProps, ref: FocusableRef<HTMLDivElement>) {\n let {onChange, onChangeEnd, value, defaultValue, getValueLabel, ...otherProps} = props;\n\n let baseProps: Omit<SliderBaseProps<number[]>, 'children'> = {\n ...otherProps,\n value: value != null ? [value.start, value.end] : undefined,\n defaultValue: defaultValue != null\n ? [defaultValue.start, defaultValue.end]\n // make sure that useSliderState knows we have two handles\n : [props.minValue ?? 0, props.maxValue ?? 100],\n onChange(v) {\n onChange?.({start: v[0], end: v[1]});\n },\n onChangeEnd(v) {\n onChangeEnd?.({start: v[0], end: v[1]});\n },\n getValueLabel: getValueLabel ? ([start, end]) => getValueLabel({start, end}) : undefined\n };\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/slider');\n let {direction} = useLocale();\n\n return (\n <SliderBase {...baseProps} classes={'spectrum-Slider--range'} ref={ref}>\n {({trackRef, inputRef, state}: SliderBaseChildArguments) => {\n let cssDirection = direction === 'rtl' ? 'right' : 'left';\n return (\n <>\n <div\n className={classNames(styles, 'spectrum-Slider-track')}\n style={{width: `${state.getThumbPercent(0) * 100}%`}} />\n <SliderThumb\n index={0}\n aria-label={stringFormatter.format('minimum')}\n isDisabled={props.isDisabled}\n trackRef={trackRef}\n inputRef={inputRef}\n state={state}\n name={props.startName} />\n <div\n className={classNames(styles, 'spectrum-Slider-track')}\n style={{\n [cssDirection]: `${state.getThumbPercent(0) * 100}%`,\n width: `${Math.abs(state.getThumbPercent(0) - state.getThumbPercent(1)) * 100}%`\n }} />\n <SliderThumb\n index={1}\n aria-label={stringFormatter.format('maximum')}\n isDisabled={props.isDisabled}\n trackRef={trackRef}\n state={state}\n name={props.endName} />\n <div\n className={classNames(styles, 'spectrum-Slider-track')}\n style={{\n width: `${(1 - state.getThumbPercent(1)) * 100}%`\n }} />\n </>\n );\n }}\n </SliderBase>\n );\n}\n\n/**\n * RangeSliders allow users to quickly select a subset range. They should be used when the upper and lower bounds to the range are invariable.\n */\nconst _RangeSlider = React.forwardRef(RangeSlider);\nexport {_RangeSlider as RangeSlider};\n"],"names":[],"version":3,"file":"RangeSlider.module.js.map"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
var $ec6ca573d82152ff$exports = require("./SliderBase.main.js");
|
|
2
|
+
var $77acc7fb8bfd13d6$exports = require("./SliderThumb.main.js");
|
|
3
|
+
require("./vars.b570f076.css");
|
|
4
|
+
var $57893a49ef34c169$exports = require("./slider_vars_css.main.js");
|
|
5
|
+
var $h9MRe$reactariautils = require("@react-aria/utils");
|
|
6
|
+
var $h9MRe$reactspectrumutils = require("@react-spectrum/utils");
|
|
7
|
+
var $h9MRe$react = require("react");
|
|
8
|
+
var $h9MRe$reactariai18n = require("@react-aria/i18n");
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
function $parcel$interopDefault(a) {
|
|
12
|
+
return a && a.__esModule ? a.default : a;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function $parcel$export(e, n, v, s) {
|
|
16
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
$parcel$export(module.exports, "Slider", () => $3a761bdd22d32681$export$472062a354075cee);
|
|
20
|
+
/*
|
|
21
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
22
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
23
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
24
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
25
|
+
*
|
|
26
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
27
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
28
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
29
|
+
* governing permissions and limitations under the License.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
function $3a761bdd22d32681$var$Slider(props, ref) {
|
|
38
|
+
let { onChange: onChange, onChangeEnd: onChangeEnd, value: value, defaultValue: defaultValue, isFilled: isFilled, fillOffset: fillOffset, trackGradient: trackGradient, getValueLabel: getValueLabel, ...otherProps } = props;
|
|
39
|
+
let baseProps = {
|
|
40
|
+
...otherProps,
|
|
41
|
+
// Normalize `value: number[]` to `value: number`
|
|
42
|
+
value: value != null ? [
|
|
43
|
+
value
|
|
44
|
+
] : undefined,
|
|
45
|
+
defaultValue: defaultValue != null ? [
|
|
46
|
+
defaultValue
|
|
47
|
+
] : undefined,
|
|
48
|
+
onChange: (v)=>{
|
|
49
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(v[0]);
|
|
50
|
+
},
|
|
51
|
+
onChangeEnd: (v)=>{
|
|
52
|
+
onChangeEnd === null || onChangeEnd === void 0 ? void 0 : onChangeEnd(v[0]);
|
|
53
|
+
},
|
|
54
|
+
getValueLabel: getValueLabel ? ([v])=>getValueLabel(v) : undefined
|
|
55
|
+
};
|
|
56
|
+
let { direction: direction } = (0, $h9MRe$reactariai18n.useLocale)();
|
|
57
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($h9MRe$react))).createElement((0, $ec6ca573d82152ff$exports.SliderBase), {
|
|
58
|
+
...baseProps,
|
|
59
|
+
ref: ref,
|
|
60
|
+
classes: {
|
|
61
|
+
"spectrum-Slider--filled": isFilled && fillOffset == null
|
|
62
|
+
},
|
|
63
|
+
style: // @ts-ignore
|
|
64
|
+
{
|
|
65
|
+
"--spectrum-slider-track-gradient": trackGradient && `linear-gradient(to ${direction === "ltr" ? "right" : "left"}, ${trackGradient.join(", ")})`
|
|
66
|
+
}
|
|
67
|
+
}, ({ trackRef: trackRef, inputRef: inputRef, state: state })=>{
|
|
68
|
+
fillOffset = fillOffset != null ? (0, $h9MRe$reactariautils.clamp)(fillOffset, state.getThumbMinValue(0), state.getThumbMaxValue(0)) : fillOffset;
|
|
69
|
+
let cssDirection = direction === "rtl" ? "right" : "left";
|
|
70
|
+
let lowerTrack = /*#__PURE__*/ (0, ($parcel$interopDefault($h9MRe$react))).createElement("div", {
|
|
71
|
+
className: (0, $h9MRe$reactspectrumutils.classNames)((0, ($parcel$interopDefault($57893a49ef34c169$exports))), "spectrum-Slider-track"),
|
|
72
|
+
style: {
|
|
73
|
+
width: `${state.getThumbPercent(0) * 100}%`,
|
|
74
|
+
// TODO not sure if it has advantages, but this could also be implemented as CSS calc():
|
|
75
|
+
// .track::before {
|
|
76
|
+
// background-size: calc((1/ (var(--width)/100)) * 100%);
|
|
77
|
+
// width: calc(var(--width) * 1%)M
|
|
78
|
+
// }
|
|
79
|
+
// @ts-ignore
|
|
80
|
+
"--spectrum-track-background-size": `${1 / state.getThumbPercent(0) * 100}%`,
|
|
81
|
+
"--spectrum-track-background-position": direction === "ltr" ? "0" : "100%"
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
let upperTrack = /*#__PURE__*/ (0, ($parcel$interopDefault($h9MRe$react))).createElement("div", {
|
|
85
|
+
className: (0, $h9MRe$reactspectrumutils.classNames)((0, ($parcel$interopDefault($57893a49ef34c169$exports))), "spectrum-Slider-track"),
|
|
86
|
+
style: {
|
|
87
|
+
width: `${(1 - state.getThumbPercent(0)) * 100}%`,
|
|
88
|
+
// @ts-ignore
|
|
89
|
+
"--spectrum-track-background-size": `${1 / (1 - state.getThumbPercent(0)) * 100}%`,
|
|
90
|
+
"--spectrum-track-background-position": direction === "ltr" ? "100%" : "0"
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
let filledTrack = null;
|
|
94
|
+
if (isFilled && fillOffset != null) {
|
|
95
|
+
let width = state.getThumbPercent(0) - state.getValuePercent(fillOffset);
|
|
96
|
+
let isRightOfOffset = width > 0;
|
|
97
|
+
let offset = isRightOfOffset ? state.getValuePercent(fillOffset) : state.getThumbPercent(0);
|
|
98
|
+
filledTrack = /*#__PURE__*/ (0, ($parcel$interopDefault($h9MRe$react))).createElement("div", {
|
|
99
|
+
className: (0, $h9MRe$reactspectrumutils.classNames)((0, ($parcel$interopDefault($57893a49ef34c169$exports))), "spectrum-Slider-fill", {
|
|
100
|
+
"spectrum-Slider-fill--right": isRightOfOffset
|
|
101
|
+
}),
|
|
102
|
+
style: {
|
|
103
|
+
[cssDirection]: `${offset * 100}%`,
|
|
104
|
+
width: `${Math.abs(width) * 100}%`
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($h9MRe$react))).createElement((0, ($parcel$interopDefault($h9MRe$react))).Fragment, null, lowerTrack, /*#__PURE__*/ (0, ($parcel$interopDefault($h9MRe$react))).createElement((0, $77acc7fb8bfd13d6$exports.SliderThumb), {
|
|
109
|
+
index: 0,
|
|
110
|
+
isDisabled: props.isDisabled,
|
|
111
|
+
trackRef: trackRef,
|
|
112
|
+
inputRef: inputRef,
|
|
113
|
+
state: state,
|
|
114
|
+
name: props.name
|
|
115
|
+
}), filledTrack, upperTrack);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Sliders allow users to quickly select a value within a range. They should be used when the upper and lower bounds to the range are invariable.
|
|
120
|
+
*/ const $3a761bdd22d32681$export$472062a354075cee = /*#__PURE__*/ (0, ($parcel$interopDefault($h9MRe$react))).forwardRef($3a761bdd22d32681$var$Slider);
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
//# sourceMappingURL=Slider.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;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AAU,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/slider/src/Slider.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {clamp} from '@react-aria/utils';\nimport {classNames} from '@react-spectrum/utils';\nimport {FocusableRef} from '@react-types/shared';\nimport React from 'react';\nimport {SliderBase, SliderBaseChildArguments, SliderBaseProps} from './SliderBase';\nimport {SliderThumb} from './SliderThumb';\nimport {SpectrumSliderProps} from '@react-types/slider';\nimport styles from '@adobe/spectrum-css-temp/components/slider/vars.css';\nimport {useLocale} from '@react-aria/i18n';\n\nfunction Slider(props: SpectrumSliderProps, ref: FocusableRef<HTMLDivElement>) {\n let {onChange, onChangeEnd, value, defaultValue, isFilled, fillOffset, trackGradient, getValueLabel, ...otherProps} = props;\n\n let baseProps: Omit<SliderBaseProps, 'children'> = {\n ...otherProps,\n // Normalize `value: number[]` to `value: number`\n value: value != null ? [value] : undefined,\n defaultValue: defaultValue != null ? [defaultValue] : undefined,\n onChange: (v: number[]): void => {\n onChange?.(v[0]);\n },\n onChangeEnd: (v: number[]): void => {\n onChangeEnd?.(v[0]);\n },\n getValueLabel: getValueLabel ? ([v]) => getValueLabel(v) : undefined\n };\n\n let {direction} = useLocale();\n\n return (\n <SliderBase\n {...baseProps}\n ref={ref}\n classes={{\n 'spectrum-Slider--filled': isFilled && fillOffset == null\n }}\n style={\n // @ts-ignore\n {'--spectrum-slider-track-gradient': trackGradient && `linear-gradient(to ${direction === 'ltr' ? 'right' : 'left'}, ${trackGradient.join(', ')})`}\n }>\n {({trackRef, inputRef, state}: SliderBaseChildArguments) => {\n fillOffset = fillOffset != null ? clamp(fillOffset, state.getThumbMinValue(0), state.getThumbMaxValue(0)) : fillOffset;\n let cssDirection = direction === 'rtl' ? 'right' : 'left';\n\n let lowerTrack = (\n <div\n className={classNames(styles, 'spectrum-Slider-track')}\n style={{\n width: `${state.getThumbPercent(0) * 100}%`,\n // TODO not sure if it has advantages, but this could also be implemented as CSS calc():\n // .track::before {\n // background-size: calc((1/ (var(--width)/100)) * 100%);\n // width: calc(var(--width) * 1%)M\n // }\n // @ts-ignore\n '--spectrum-track-background-size': `${(1 / state.getThumbPercent(0)) * 100}%`,\n '--spectrum-track-background-position': direction === 'ltr' ? '0' : '100%'\n }} />\n );\n let upperTrack = (\n <div\n className={classNames(styles, 'spectrum-Slider-track')}\n style={{\n width: `${(1 - state.getThumbPercent(0)) * 100}%`,\n // @ts-ignore\n '--spectrum-track-background-size': `${(1 / (1 - state.getThumbPercent(0))) * 100}%`,\n '--spectrum-track-background-position': direction === 'ltr' ? '100%' : '0'\n }} />\n );\n\n let filledTrack = null;\n if (isFilled && fillOffset != null) {\n let width = state.getThumbPercent(0) - state.getValuePercent(fillOffset);\n let isRightOfOffset = width > 0;\n let offset = isRightOfOffset ? state.getValuePercent(fillOffset) : state.getThumbPercent(0);\n filledTrack = (\n <div\n className={classNames(styles, 'spectrum-Slider-fill', {'spectrum-Slider-fill--right': isRightOfOffset})}\n style={{\n [cssDirection]: `${offset * 100}%`,\n width: `${Math.abs(width) * 100}%`\n }} />\n );\n }\n\n return (\n <>\n {lowerTrack}\n <SliderThumb\n index={0}\n isDisabled={props.isDisabled}\n trackRef={trackRef}\n inputRef={inputRef}\n state={state}\n name={props.name} />\n {filledTrack}\n {upperTrack}\n </>\n );\n }}\n </SliderBase>\n );\n}\n\n/**\n * Sliders allow users to quickly select a value within a range. They should be used when the upper and lower bounds to the range are invariable.\n */\nconst _Slider = React.forwardRef(Slider);\nexport {_Slider as Slider};\n"],"names":[],"version":3,"file":"Slider.main.js.map"}
|
package/dist/Slider.mjs
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import {SliderBase as $39572711324a3b8e$export$9418495bb635ebde} from "./SliderBase.mjs";
|
|
2
|
+
import {SliderThumb as $9058ca69d66a724f$export$2c1b491743890dec} from "./SliderThumb.mjs";
|
|
3
|
+
import "./vars.b570f076.css";
|
|
4
|
+
import $i1AIe$slider_vars_cssmodulejs from "./slider_vars_css.mjs";
|
|
5
|
+
import {clamp as $i1AIe$clamp} from "@react-aria/utils";
|
|
6
|
+
import {classNames as $i1AIe$classNames} from "@react-spectrum/utils";
|
|
7
|
+
import $i1AIe$react from "react";
|
|
8
|
+
import {useLocale as $i1AIe$useLocale} from "@react-aria/i18n";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
function $parcel$interopDefault(a) {
|
|
12
|
+
return a && a.__esModule ? a.default : a;
|
|
13
|
+
}
|
|
14
|
+
/*
|
|
15
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
16
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
17
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
18
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
19
|
+
*
|
|
20
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
21
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
22
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
23
|
+
* governing permissions and limitations under the License.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
function $a1251704aa53e1a5$var$Slider(props, ref) {
|
|
32
|
+
let { onChange: onChange, onChangeEnd: onChangeEnd, value: value, defaultValue: defaultValue, isFilled: isFilled, fillOffset: fillOffset, trackGradient: trackGradient, getValueLabel: getValueLabel, ...otherProps } = props;
|
|
33
|
+
let baseProps = {
|
|
34
|
+
...otherProps,
|
|
35
|
+
// Normalize `value: number[]` to `value: number`
|
|
36
|
+
value: value != null ? [
|
|
37
|
+
value
|
|
38
|
+
] : undefined,
|
|
39
|
+
defaultValue: defaultValue != null ? [
|
|
40
|
+
defaultValue
|
|
41
|
+
] : undefined,
|
|
42
|
+
onChange: (v)=>{
|
|
43
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(v[0]);
|
|
44
|
+
},
|
|
45
|
+
onChangeEnd: (v)=>{
|
|
46
|
+
onChangeEnd === null || onChangeEnd === void 0 ? void 0 : onChangeEnd(v[0]);
|
|
47
|
+
},
|
|
48
|
+
getValueLabel: getValueLabel ? ([v])=>getValueLabel(v) : undefined
|
|
49
|
+
};
|
|
50
|
+
let { direction: direction } = (0, $i1AIe$useLocale)();
|
|
51
|
+
return /*#__PURE__*/ (0, $i1AIe$react).createElement((0, $39572711324a3b8e$export$9418495bb635ebde), {
|
|
52
|
+
...baseProps,
|
|
53
|
+
ref: ref,
|
|
54
|
+
classes: {
|
|
55
|
+
"spectrum-Slider--filled": isFilled && fillOffset == null
|
|
56
|
+
},
|
|
57
|
+
style: // @ts-ignore
|
|
58
|
+
{
|
|
59
|
+
"--spectrum-slider-track-gradient": trackGradient && `linear-gradient(to ${direction === "ltr" ? "right" : "left"}, ${trackGradient.join(", ")})`
|
|
60
|
+
}
|
|
61
|
+
}, ({ trackRef: trackRef, inputRef: inputRef, state: state })=>{
|
|
62
|
+
fillOffset = fillOffset != null ? (0, $i1AIe$clamp)(fillOffset, state.getThumbMinValue(0), state.getThumbMaxValue(0)) : fillOffset;
|
|
63
|
+
let cssDirection = direction === "rtl" ? "right" : "left";
|
|
64
|
+
let lowerTrack = /*#__PURE__*/ (0, $i1AIe$react).createElement("div", {
|
|
65
|
+
className: (0, $i1AIe$classNames)((0, ($parcel$interopDefault($i1AIe$slider_vars_cssmodulejs))), "spectrum-Slider-track"),
|
|
66
|
+
style: {
|
|
67
|
+
width: `${state.getThumbPercent(0) * 100}%`,
|
|
68
|
+
// TODO not sure if it has advantages, but this could also be implemented as CSS calc():
|
|
69
|
+
// .track::before {
|
|
70
|
+
// background-size: calc((1/ (var(--width)/100)) * 100%);
|
|
71
|
+
// width: calc(var(--width) * 1%)M
|
|
72
|
+
// }
|
|
73
|
+
// @ts-ignore
|
|
74
|
+
"--spectrum-track-background-size": `${1 / state.getThumbPercent(0) * 100}%`,
|
|
75
|
+
"--spectrum-track-background-position": direction === "ltr" ? "0" : "100%"
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
let upperTrack = /*#__PURE__*/ (0, $i1AIe$react).createElement("div", {
|
|
79
|
+
className: (0, $i1AIe$classNames)((0, ($parcel$interopDefault($i1AIe$slider_vars_cssmodulejs))), "spectrum-Slider-track"),
|
|
80
|
+
style: {
|
|
81
|
+
width: `${(1 - state.getThumbPercent(0)) * 100}%`,
|
|
82
|
+
// @ts-ignore
|
|
83
|
+
"--spectrum-track-background-size": `${1 / (1 - state.getThumbPercent(0)) * 100}%`,
|
|
84
|
+
"--spectrum-track-background-position": direction === "ltr" ? "100%" : "0"
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
let filledTrack = null;
|
|
88
|
+
if (isFilled && fillOffset != null) {
|
|
89
|
+
let width = state.getThumbPercent(0) - state.getValuePercent(fillOffset);
|
|
90
|
+
let isRightOfOffset = width > 0;
|
|
91
|
+
let offset = isRightOfOffset ? state.getValuePercent(fillOffset) : state.getThumbPercent(0);
|
|
92
|
+
filledTrack = /*#__PURE__*/ (0, $i1AIe$react).createElement("div", {
|
|
93
|
+
className: (0, $i1AIe$classNames)((0, ($parcel$interopDefault($i1AIe$slider_vars_cssmodulejs))), "spectrum-Slider-fill", {
|
|
94
|
+
"spectrum-Slider-fill--right": isRightOfOffset
|
|
95
|
+
}),
|
|
96
|
+
style: {
|
|
97
|
+
[cssDirection]: `${offset * 100}%`,
|
|
98
|
+
width: `${Math.abs(width) * 100}%`
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
return /*#__PURE__*/ (0, $i1AIe$react).createElement((0, $i1AIe$react).Fragment, null, lowerTrack, /*#__PURE__*/ (0, $i1AIe$react).createElement((0, $9058ca69d66a724f$export$2c1b491743890dec), {
|
|
103
|
+
index: 0,
|
|
104
|
+
isDisabled: props.isDisabled,
|
|
105
|
+
trackRef: trackRef,
|
|
106
|
+
inputRef: inputRef,
|
|
107
|
+
state: state,
|
|
108
|
+
name: props.name
|
|
109
|
+
}), filledTrack, upperTrack);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Sliders allow users to quickly select a value within a range. They should be used when the upper and lower bounds to the range are invariable.
|
|
114
|
+
*/ const $a1251704aa53e1a5$export$472062a354075cee = /*#__PURE__*/ (0, $i1AIe$react).forwardRef($a1251704aa53e1a5$var$Slider);
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
export {$a1251704aa53e1a5$export$472062a354075cee as Slider};
|
|
118
|
+
//# sourceMappingURL=Slider.mjs.map
|