@react-spectrum/slider
Advanced tools
Comparing version 3.0.0-nightly.2508 to 3.0.0-nightly-07431f4b1-241030
625
dist/main.js
@@ -1,617 +0,26 @@ | ||
var _babelRuntimeHelpersInteropRequireDefault = $parcel$interopDefault(require("@babel/runtime/helpers/interopRequireDefault")); | ||
var $3a761bdd22d32681$exports = require("./Slider.main.js"); | ||
var $f166b52c7f82645c$exports = require("./RangeSlider.main.js"); | ||
var { | ||
VisuallyHidden | ||
} = require("@react-aria/visually-hidden"); | ||
var { | ||
useHover | ||
} = require("@react-aria/interactions"); | ||
var { | ||
FocusRing | ||
} = require("@react-aria/focus"); | ||
var { | ||
useSlider, | ||
useSliderThumb | ||
} = require("@react-aria/slider"); | ||
var { | ||
useProviderProps | ||
} = require("@react-spectrum/provider"); | ||
var { | ||
useNumberFormatter, | ||
useLocale, | ||
useMessageFormatter | ||
} = require("@react-aria/i18n"); | ||
var { | ||
useSliderState | ||
} = require("@react-stately/slider"); | ||
var _react2 = require("react"); | ||
var _react = $parcel$interopDefault(_react2); | ||
var { | ||
useRef | ||
} = _react2; | ||
var { | ||
classNames, | ||
useFocusableRef, | ||
useStyleProps | ||
} = require("@react-spectrum/utils"); | ||
var { | ||
clamp, | ||
mergeProps | ||
} = require("@react-aria/utils"); | ||
var _babelRuntimeHelpersObjectWithoutPropertiesLoose = $parcel$interopDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose")); | ||
var _babelRuntimeHelpersExtends = $parcel$interopDefault(require("@babel/runtime/helpers/extends")); | ||
require("./main.css"); | ||
function $parcel$interopDefault(a) { | ||
return a && a.__esModule ? a.default : a; | ||
function $parcel$export(e, n, v, s) { | ||
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true}); | ||
} | ||
// ASSET: /home/circleci/react-spectrum/node_modules/@adobe/spectrum-css-temp/components/slider/vars.css | ||
var $c8f0b01c76499f8ceef39abc1b587900$exports = {}; | ||
$c8f0b01c76499f8ceef39abc1b587900$exports = { | ||
"spectrum-Slider": "_spectrum-Slider_acd08", | ||
"spectrum-Dial": "_spectrum-Dial_acd08", | ||
"spectrum-Slider--positionTop": "_spectrum-Slider--positionTop_acd08", | ||
"spectrum-Slider-controls": "_spectrum-Slider-controls_acd08", | ||
"spectrum-Dial-controls": "_spectrum-Dial-controls_acd08", | ||
"spectrum-Slider--positionSide": "_spectrum-Slider--positionSide_acd08", | ||
"spectrum-Slider-labelContainer": "_spectrum-Slider-labelContainer_acd08", | ||
"spectrum-Dial-labelContainer": "_spectrum-Dial-labelContainer_acd08", | ||
"spectrum-Slider-valueLabelContainer": "_spectrum-Slider-valueLabelContainer_acd08", | ||
"spectrum-Slider-value": "_spectrum-Slider-value_acd08", | ||
"spectrum-Slider-track": "_spectrum-Slider-track_acd08", | ||
"spectrum-Slider-buffer": "_spectrum-Slider-buffer_acd08", | ||
"spectrum-Slider-ramp": "_spectrum-Slider-ramp_acd08", | ||
"spectrum-Slider-fill": "_spectrum-Slider-fill_acd08", | ||
"spectrum-Slider-fill--right": "_spectrum-Slider-fill--right_acd08", | ||
"spectrum-Slider--range": "_spectrum-Slider--range_acd08", | ||
"spectrum-Slider-handle": "_spectrum-Slider-handle_acd08", | ||
"spectrum-Dial-handle": "_spectrum-Dial-handle_acd08", | ||
"is-dragged": "_is-dragged_acd08", | ||
"is-focused": "_is-focused_acd08", | ||
"is-tophandle": "_is-tophandle_acd08", | ||
"spectrum-Slider-input": "_spectrum-Slider-input_acd08", | ||
"spectrum-Dial-input": "_spectrum-Dial-input_acd08", | ||
"spectrum-Slider-label": "_spectrum-Slider-label_acd08", | ||
"spectrum-Dial-label": "_spectrum-Dial-label_acd08", | ||
"spectrum-Dial-value": "_spectrum-Dial-value_acd08", | ||
"spectrum-Slider-ticks": "_spectrum-Slider-ticks_acd08", | ||
"spectrum-Slider-tick": "_spectrum-Slider-tick_acd08", | ||
"spectrum-Slider-tickLabel": "_spectrum-Slider-tickLabel_acd08", | ||
"spectrum-Slider--color": "_spectrum-Slider--color_acd08", | ||
"spectrum-Dial--small": "_spectrum-Dial--small_acd08", | ||
"is-disabled": "_is-disabled_acd08", | ||
"is-hovered": "_is-hovered_acd08", | ||
"u-isGrabbing": "_u-isGrabbing_acd08", | ||
"spectrum-Slider--filled": "_spectrum-Slider--filled_acd08", | ||
"spectrum-Slider--ramp": "_spectrum-Slider--ramp_acd08", | ||
"spectrum-Slider--label-side": "_spectrum-Slider--label-side_acd08" | ||
}; | ||
var $c8f0b01c76499f8ceef39abc1b587900$$interop$default = $parcel$interopDefault($c8f0b01c76499f8ceef39abc1b587900$exports); | ||
$parcel$export(module.exports, "Slider", () => $3a761bdd22d32681$exports.Slider); | ||
$parcel$export(module.exports, "RangeSlider", () => $f166b52c7f82645c$exports.RangeSlider); | ||
/* | ||
* Copyright 2020 Adobe. All rights reserved. | ||
* This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. You may obtain a copy | ||
* of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under | ||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
* OF ANY KIND, either express or implied. See the License for the specific language | ||
* governing permissions and limitations under the License. | ||
*/ /// <reference types="css-module-types" /> | ||
function $e14249f20430d37bc9376d3f2ea9af72$var$SliderBase(props, ref) { | ||
props = useProviderProps(props); | ||
let { | ||
isDisabled, | ||
children, | ||
classes, | ||
style, | ||
labelPosition = 'top', | ||
getValueLabel, | ||
showValueLabel = !!props.label, | ||
formatOptions, | ||
minValue = 0, | ||
maxValue = 100 | ||
} = props, | ||
otherProps = _babelRuntimeHelpersObjectWithoutPropertiesLoose(props, ["isDisabled", "children", "classes", "style", "labelPosition", "getValueLabel", "showValueLabel", "formatOptions", "minValue", "maxValue"]); | ||
let { | ||
styleProps | ||
} = useStyleProps(otherProps); // `Math.abs(Math.sign(a) - Math.sign(b)) === 2` is true if the values have a different sign. | ||
let alwaysDisplaySign = Math.abs(Math.sign(minValue) - Math.sign(maxValue)) === 2; | ||
if (alwaysDisplaySign) { | ||
if (formatOptions != null) { | ||
if (!('signDisplay' in formatOptions)) { | ||
formatOptions = _babelRuntimeHelpersExtends({}, formatOptions, { | ||
// @ts-ignore | ||
signDisplay: 'exceptZero' | ||
}); | ||
} | ||
} else { | ||
// @ts-ignore | ||
formatOptions = { | ||
signDisplay: 'exceptZero' | ||
}; | ||
} | ||
} | ||
const formatter = useNumberFormatter(formatOptions); | ||
const state = useSliderState(_babelRuntimeHelpersExtends({}, props, { | ||
numberFormatter: formatter, | ||
minValue, | ||
maxValue | ||
})); | ||
let trackRef = useRef(); | ||
let { | ||
groupProps, | ||
trackProps, | ||
labelProps, | ||
outputProps | ||
} = useSlider(props, state, trackRef); | ||
let inputRef = useRef(); | ||
let domRef = useFocusableRef(ref, inputRef); | ||
let displayValue = ''; | ||
let maxLabelLength = undefined; | ||
if (typeof getValueLabel === 'function') { | ||
displayValue = getValueLabel(state.values); | ||
switch (state.values.length) { | ||
case 1: | ||
maxLabelLength = Math.max(getValueLabel([minValue]).length, getValueLabel([maxValue]).length); | ||
break; | ||
case 2: | ||
// Try all possible combinations of min and max values. | ||
maxLabelLength = Math.max(getValueLabel([minValue, minValue]).length, getValueLabel([minValue, maxValue]).length, getValueLabel([maxValue, minValue]).length, getValueLabel([maxValue, maxValue]).length); | ||
break; | ||
default: | ||
throw new Error('Only sliders with 1 or 2 handles are supported!'); | ||
} | ||
} else { | ||
maxLabelLength = Math.max([...formatter.format(minValue)].length, [...formatter.format(maxValue)].length); | ||
switch (state.values.length) { | ||
case 1: | ||
displayValue = state.getThumbValueLabel(0); | ||
break; | ||
case 2: | ||
// This should really use the NumberFormat#formatRange proposal... | ||
// https://github.com/tc39/ecma402/issues/393 | ||
// https://github.com/tc39/proposal-intl-numberformat-v3#formatrange-ecma-402-393 | ||
displayValue = state.getThumbValueLabel(0) + " \u2013 " + state.getThumbValueLabel(1); | ||
maxLabelLength = 3 + 2 * Math.max(maxLabelLength, [...formatter.format(minValue)].length, [...formatter.format(maxValue)].length); | ||
break; | ||
default: | ||
throw new Error('Only sliders with 1 or 2 handles are supported!'); | ||
} | ||
} | ||
let labelNode = /*#__PURE__*/_react.createElement("label", _babelRuntimeHelpersExtends({ | ||
className: classNames($c8f0b01c76499f8ceef39abc1b587900$$interop$default, 'spectrum-Slider-label') | ||
}, labelProps), props.label); | ||
let valueNode = /*#__PURE__*/_react.createElement("output", _babelRuntimeHelpersExtends({}, outputProps, { | ||
className: classNames($c8f0b01c76499f8ceef39abc1b587900$$interop$default, 'spectrum-Slider-value'), | ||
style: maxLabelLength && { | ||
width: maxLabelLength + "ch", | ||
minWidth: maxLabelLength + "ch" | ||
} | ||
}), displayValue); | ||
return /*#__PURE__*/_react.createElement("div", _babelRuntimeHelpersExtends({ | ||
ref: domRef, | ||
className: classNames($c8f0b01c76499f8ceef39abc1b587900$$interop$default, 'spectrum-Slider', { | ||
'spectrum-Slider--positionTop': labelPosition === 'top', | ||
'spectrum-Slider--positionSide': labelPosition === 'side', | ||
'is-disabled': isDisabled | ||
}, classes, styleProps.className), | ||
style: _babelRuntimeHelpersExtends({}, style, styleProps.style) | ||
}, groupProps), props.label && /*#__PURE__*/_react.createElement("div", { | ||
className: classNames($c8f0b01c76499f8ceef39abc1b587900$$interop$default, 'spectrum-Slider-labelContainer'), | ||
role: "presentation" | ||
}, props.label && labelNode, labelPosition === 'top' && showValueLabel && valueNode), /*#__PURE__*/_react.createElement("div", _babelRuntimeHelpersExtends({ | ||
className: classNames($c8f0b01c76499f8ceef39abc1b587900$$interop$default, 'spectrum-Slider-controls'), | ||
ref: trackRef | ||
}, trackProps, { | ||
role: "presentation" | ||
}), children({ | ||
trackRef, | ||
inputRef, | ||
state | ||
})), labelPosition === 'side' && /*#__PURE__*/_react.createElement("div", { | ||
className: classNames($c8f0b01c76499f8ceef39abc1b587900$$interop$default, 'spectrum-Slider-valueLabelContainer'), | ||
role: "presentation" | ||
}, showValueLabel && valueNode)); | ||
} | ||
const $e14249f20430d37bc9376d3f2ea9af72$export$SliderBase = _react.forwardRef($e14249f20430d37bc9376d3f2ea9af72$var$SliderBase); | ||
function $d5bef0bb79767419ec0237e591b28$export$SliderThumb(props) { | ||
let { | ||
index, | ||
inputRef, | ||
state | ||
} = props; | ||
let backupRef = useRef(); | ||
inputRef = inputRef || backupRef; | ||
let { | ||
thumbProps, | ||
inputProps | ||
} = useSliderThumb(_babelRuntimeHelpersExtends({}, props, { | ||
inputRef | ||
}), state); | ||
let { | ||
hoverProps, | ||
isHovered | ||
} = useHover({}); | ||
let { | ||
direction | ||
} = useLocale(); | ||
let cssDirection = direction === 'rtl' ? 'right' : 'left'; | ||
return /*#__PURE__*/_react.createElement(FocusRing, { | ||
within: true, | ||
focusRingClass: classNames($c8f0b01c76499f8ceef39abc1b587900$$interop$default, 'is-focused') | ||
}, /*#__PURE__*/_react.createElement("div", _babelRuntimeHelpersExtends({ | ||
className: classNames($c8f0b01c76499f8ceef39abc1b587900$$interop$default, 'spectrum-Slider-handle', { | ||
'is-hovered': isHovered, | ||
'is-dragged': state.isThumbDragging(index), | ||
'is-tophandle': state.focusedThumb === index | ||
}), | ||
style: { | ||
[cssDirection]: state.getThumbPercent(index) * 100 + "%" | ||
} | ||
}, mergeProps(thumbProps, hoverProps), { | ||
role: "presentation" | ||
}), /*#__PURE__*/_react.createElement(VisuallyHidden, null, /*#__PURE__*/_react.createElement("input", _babelRuntimeHelpersExtends({ | ||
className: classNames($c8f0b01c76499f8ceef39abc1b587900$$interop$default, 'spectrum-Slider-input'), | ||
ref: inputRef | ||
}, inputProps))))); | ||
} | ||
function $de4e99e1d6ad6d61a9bc95d4631$var$Slider(props, ref) { | ||
let { | ||
onChange: _onChange, | ||
onChangeEnd: _onChangeEnd, | ||
value, | ||
defaultValue, | ||
isFilled, | ||
fillOffset, | ||
trackGradient, | ||
getValueLabel | ||
} = props, | ||
otherProps = _babelRuntimeHelpersObjectWithoutPropertiesLoose(props, ["onChange", "onChangeEnd", "value", "defaultValue", "isFilled", "fillOffset", "trackGradient", "getValueLabel"]); | ||
let baseProps = _babelRuntimeHelpersExtends({}, otherProps, { | ||
// Normalize `value: number[]` to `value: number` | ||
value: value != null ? [value] : undefined, | ||
defaultValue: defaultValue != null ? [defaultValue] : undefined, | ||
onChange: v => { | ||
_onChange == null ? void 0 : _onChange(v[0]); | ||
}, | ||
onChangeEnd: v => { | ||
_onChangeEnd == null ? void 0 : _onChangeEnd(v[0]); | ||
}, | ||
getValueLabel: getValueLabel ? (_ref) => { | ||
let [v] = _ref; | ||
return getValueLabel(v); | ||
} : undefined | ||
}); | ||
let { | ||
direction | ||
} = useLocale(); | ||
return /*#__PURE__*/_react.createElement($e14249f20430d37bc9376d3f2ea9af72$export$SliderBase, _babelRuntimeHelpersExtends({}, baseProps, { | ||
ref: ref, | ||
classes: { | ||
'spectrum-Slider--filled': isFilled && fillOffset == null | ||
}, | ||
style: // @ts-ignore | ||
{ | ||
'--spectrum-slider-track-gradient': trackGradient && "linear-gradient(to " + (direction === 'ltr' ? 'right' : 'left') + ", " + trackGradient.join(', ') + ")" | ||
} | ||
}), (_ref2) => { | ||
let { | ||
trackRef, | ||
inputRef, | ||
state | ||
} = _ref2; | ||
fillOffset = fillOffset != null ? clamp(fillOffset, state.getThumbMinValue(0), state.getThumbMaxValue(0)) : fillOffset; | ||
let cssDirection = direction === 'rtl' ? 'right' : 'left'; | ||
let lowerTrack = /*#__PURE__*/_react.createElement("div", { | ||
className: classNames($c8f0b01c76499f8ceef39abc1b587900$$interop$default, 'spectrum-Slider-track'), | ||
style: { | ||
width: state.getThumbPercent(0) * 100 + "%", | ||
// TODO not sure if it has advantages, but this could also be implemented as CSS calc(): | ||
// .track::before { | ||
// background-size: calc((1/ (var(--width)/100)) * 100%); | ||
// width: calc(var(--width) * 1%)M | ||
// } | ||
// @ts-ignore | ||
'--spectrum-track-background-size': 1 / state.getThumbPercent(0) * 100 + "%", | ||
'--spectrum-track-background-position': direction === 'ltr' ? '0' : '100%' | ||
} | ||
}); | ||
let upperTrack = /*#__PURE__*/_react.createElement("div", { | ||
className: classNames($c8f0b01c76499f8ceef39abc1b587900$$interop$default, 'spectrum-Slider-track'), | ||
style: { | ||
width: (1 - state.getThumbPercent(0)) * 100 + "%", | ||
// @ts-ignore | ||
'--spectrum-track-background-size': 1 / (1 - state.getThumbPercent(0)) * 100 + "%", | ||
'--spectrum-track-background-position': direction === 'ltr' ? '100%' : '0' | ||
} | ||
}); | ||
let filledTrack = null; | ||
if (isFilled && fillOffset != null) { | ||
let width = state.getThumbPercent(0) - state.getValuePercent(fillOffset); | ||
let isRightOfOffset = width > 0; | ||
let offset = isRightOfOffset ? state.getValuePercent(fillOffset) : state.getThumbPercent(0); | ||
filledTrack = /*#__PURE__*/_react.createElement("div", { | ||
className: classNames($c8f0b01c76499f8ceef39abc1b587900$$interop$default, 'spectrum-Slider-fill', { | ||
'spectrum-Slider-fill--right': isRightOfOffset | ||
}), | ||
style: { | ||
[cssDirection]: offset * 100 + "%", | ||
width: Math.abs(width) * 100 + "%" | ||
} | ||
}); | ||
} | ||
return /*#__PURE__*/_react.createElement(_react.Fragment, null, lowerTrack, /*#__PURE__*/_react.createElement($d5bef0bb79767419ec0237e591b28$export$SliderThumb, { | ||
index: 0, | ||
isDisabled: props.isDisabled, | ||
trackRef: trackRef, | ||
inputRef: inputRef, | ||
state: state | ||
}), upperTrack, filledTrack); | ||
}); | ||
} | ||
/** | ||
* 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. | ||
*/ | ||
const Slider = _react.forwardRef($de4e99e1d6ad6d61a9bc95d4631$var$Slider); | ||
exports.Slider = Slider; | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/ar-AE.json | ||
var $d78e0b50ed86b529de1ea5a9c2e5e3a0$exports = {}; | ||
$d78e0b50ed86b529de1ea5a9c2e5e3a0$exports = JSON.parse("{\"maximum\":\"الحد الأقصى\",\"minimum\":\"الحد الأدنى\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/bg-BG.json | ||
var $b8053210c821c3657151d27d3a03aba$exports = {}; | ||
$b8053210c821c3657151d27d3a03aba$exports = JSON.parse("{\"maximum\":\"Максимум\",\"minimum\":\"Минимум\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/cs-CZ.json | ||
var $b3123d5771edb4be28c66dce211c946$exports = {}; | ||
$b3123d5771edb4be28c66dce211c946$exports = JSON.parse("{\"maximum\":\"Maximum\",\"minimum\":\"Minimální\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/da-DK.json | ||
var $afd096174a90c8a61a0f8ed18$exports = {}; | ||
$afd096174a90c8a61a0f8ed18$exports = JSON.parse("{\"maximum\":\"Maksimum\",\"minimum\":\"Minimum\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/de-DE.json | ||
var $ae2c9e4bda6c39a90d65a27f5c556788$exports = {}; | ||
$ae2c9e4bda6c39a90d65a27f5c556788$exports = JSON.parse("{\"maximum\":\"Maximal\",\"minimum\":\"Minimum\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/el-GR.json | ||
var $a105026d6afa9e6267d2ddbcfd39a$exports = {}; | ||
$a105026d6afa9e6267d2ddbcfd39a$exports = JSON.parse("{\"maximum\":\"Το μέγιστο\",\"minimum\":\"Ελάχιστο\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/en-US.json | ||
var $fe0427bf71697a80afe363fd174c3d2$exports = {}; | ||
$fe0427bf71697a80afe363fd174c3d2$exports = JSON.parse("{\"minimum\":\"Minimum\",\"maximum\":\"Maximum\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/es-ES.json | ||
var $ebe61748ec02536aa113857af1f4e72$exports = {}; | ||
$ebe61748ec02536aa113857af1f4e72$exports = JSON.parse("{\"maximum\":\"Máximo\",\"minimum\":\"Mínimo\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/et-EE.json | ||
var $e9a9a4dcf098fc49e73a17fe63b$exports = {}; | ||
$e9a9a4dcf098fc49e73a17fe63b$exports = JSON.parse("{\"maximum\":\"Maksimaalne\",\"minimum\":\"Minimaalne\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/fi-FI.json | ||
var $ad34360a22b458ec27cdfc71d13e23$exports = {}; | ||
$ad34360a22b458ec27cdfc71d13e23$exports = JSON.parse("{\"maximum\":\"Maksimi\",\"minimum\":\"Minimi\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/fr-FR.json | ||
var $d8b4689d285edca7cf57f1be30cad1d$exports = {}; | ||
$d8b4689d285edca7cf57f1be30cad1d$exports = JSON.parse("{\"maximum\":\"Maximum\",\"minimum\":\"Minimum\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/he-IL.json | ||
var $c2ccacfd828d16a0780a500ec6f2b3e$exports = {}; | ||
$c2ccacfd828d16a0780a500ec6f2b3e$exports = JSON.parse("{\"maximum\":\"מַקסִימוּם\",\"minimum\":\"מִינִימוּם\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/hu-HU.json | ||
var $c4df3691058a446ced0dd150dfe$exports = {}; | ||
$c4df3691058a446ced0dd150dfe$exports = JSON.parse("{\"maximum\":\"Maximális\",\"minimum\":\"Minimális\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/it-IT.json | ||
var $f4bcae96d6025c3425150015e7c1$exports = {}; | ||
$f4bcae96d6025c3425150015e7c1$exports = JSON.parse("{\"maximum\":\"Massimo\",\"minimum\":\"Minimo\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/ja-JP.json | ||
var $ce4641ff9c7f6cd81880de9ec4aea1$exports = {}; | ||
$ce4641ff9c7f6cd81880de9ec4aea1$exports = JSON.parse("{\"maximum\":\"最大\",\"minimum\":\"最小\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/ko-KR.json | ||
var $fc7f2dc28877fe5ef711423f43ab4ec$exports = {}; | ||
$fc7f2dc28877fe5ef711423f43ab4ec$exports = JSON.parse("{\"maximum\":\"최대\",\"minimum\":\"최소\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/lt-LT.json | ||
var $e9780606fc2786708924a487ef051090$exports = {}; | ||
$e9780606fc2786708924a487ef051090$exports = JSON.parse("{\"maximum\":\"Maksimalus\",\"minimum\":\"Minimumas\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/lv-LV.json | ||
var $f78f2303da5064e404af9736fac047$exports = {}; | ||
$f78f2303da5064e404af9736fac047$exports = JSON.parse("{\"maximum\":\"Maksimums\",\"minimum\":\"Minimālais\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/nb-NO.json | ||
var $cee5ad394707cc520a38ce3ba3cf$exports = {}; | ||
$cee5ad394707cc520a38ce3ba3cf$exports = JSON.parse("{\"maximum\":\"Maksimum\",\"minimum\":\"Minimum\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/nl-NL.json | ||
var $cb082e87d27553826af25629e5be5497$exports = {}; | ||
$cb082e87d27553826af25629e5be5497$exports = JSON.parse("{\"maximum\":\"Maximaal\",\"minimum\":\"Minimum\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/pl-PL.json | ||
var $c157e78f7f989ea301b76269c14e187$exports = {}; | ||
$c157e78f7f989ea301b76269c14e187$exports = JSON.parse("{\"maximum\":\"Maksimum\",\"minimum\":\"Minimum\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/pt-BR.json | ||
var $b8a8c2b158e59b4a0c2e03bc13ca6d$exports = {}; | ||
$b8a8c2b158e59b4a0c2e03bc13ca6d$exports = JSON.parse("{\"maximum\":\"Máximo\",\"minimum\":\"Mínimo\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/ro-RO.json | ||
var $b4afde306c2e45ef13d84f99c1f9$exports = {}; | ||
$b4afde306c2e45ef13d84f99c1f9$exports = JSON.parse("{\"maximum\":\"Maxim\",\"minimum\":\"Minim\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/ru-RU.json | ||
var $f70785a191c1047fe82970e3e4ca90a$exports = {}; | ||
$f70785a191c1047fe82970e3e4ca90a$exports = JSON.parse("{\"maximum\":\"Максимум\",\"minimum\":\"Минимум\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/sk-SK.json | ||
var $d9f1e67ea22a6278ecf4429d8d6404b7$exports = {}; | ||
$d9f1e67ea22a6278ecf4429d8d6404b7$exports = JSON.parse("{\"maximum\":\"Maximum\",\"minimum\":\"Minimálne\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/sl-SI.json | ||
var $d935f82244fe405429542f38796$exports = {}; | ||
$d935f82244fe405429542f38796$exports = JSON.parse("{\"maximum\":\"Največ\",\"minimum\":\"Najmanj\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/sr-SP.json | ||
var $f34be9f827d85a700494af98057c32$exports = {}; | ||
$f34be9f827d85a700494af98057c32$exports = JSON.parse("{\"maximum\":\"Максимум\",\"minimum\":\"Минимум\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/sv-SE.json | ||
var $d5bc44175c568de085b694f2193a7616$exports = {}; | ||
$d5bc44175c568de085b694f2193a7616$exports = JSON.parse("{\"maximum\":\"Maximal\",\"minimum\":\"Minimum\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/tr-TR.json | ||
var $eebf5c30d8cd80b9b3f852c78275c4f1$exports = {}; | ||
$eebf5c30d8cd80b9b3f852c78275c4f1$exports = JSON.parse("{\"maximum\":\"Maksimum\",\"minimum\":\"Minimum\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/uk-UA.json | ||
var $cac4b10af9ebf64a6b9df2e9a4d$exports = {}; | ||
$cac4b10af9ebf64a6b9df2e9a4d$exports = JSON.parse("{\"maximum\":\"Максимум\",\"minimum\":\"Мінімум\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/zh-CN.json | ||
var $b2d7ef1e8161e192c7a2a26b282f26e$exports = {}; | ||
$b2d7ef1e8161e192c7a2a26b282f26e$exports = JSON.parse("{\"maximum\":\"最大\",\"minimum\":\"最小\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/zh-TW.json | ||
var $d8c66ddb465b487c64522ffc49e44c8$exports = {}; | ||
$d8c66ddb465b487c64522ffc49e44c8$exports = JSON.parse("{\"maximum\":\"最大值\",\"minimum\":\"最小值\"}"); | ||
// @ts-ignore | ||
const $b7614884795b0b78874e0b09da85cc36$var$intlMessages = { | ||
"ar-AE": _babelRuntimeHelpersInteropRequireDefault($d78e0b50ed86b529de1ea5a9c2e5e3a0$exports).default, | ||
"bg-BG": _babelRuntimeHelpersInteropRequireDefault($b8053210c821c3657151d27d3a03aba$exports).default, | ||
"cs-CZ": _babelRuntimeHelpersInteropRequireDefault($b3123d5771edb4be28c66dce211c946$exports).default, | ||
"da-DK": _babelRuntimeHelpersInteropRequireDefault($afd096174a90c8a61a0f8ed18$exports).default, | ||
"de-DE": _babelRuntimeHelpersInteropRequireDefault($ae2c9e4bda6c39a90d65a27f5c556788$exports).default, | ||
"el-GR": _babelRuntimeHelpersInteropRequireDefault($a105026d6afa9e6267d2ddbcfd39a$exports).default, | ||
"en-US": _babelRuntimeHelpersInteropRequireDefault($fe0427bf71697a80afe363fd174c3d2$exports).default, | ||
"es-ES": _babelRuntimeHelpersInteropRequireDefault($ebe61748ec02536aa113857af1f4e72$exports).default, | ||
"et-EE": _babelRuntimeHelpersInteropRequireDefault($e9a9a4dcf098fc49e73a17fe63b$exports).default, | ||
"fi-FI": _babelRuntimeHelpersInteropRequireDefault($ad34360a22b458ec27cdfc71d13e23$exports).default, | ||
"fr-FR": _babelRuntimeHelpersInteropRequireDefault($d8b4689d285edca7cf57f1be30cad1d$exports).default, | ||
"he-IL": _babelRuntimeHelpersInteropRequireDefault($c2ccacfd828d16a0780a500ec6f2b3e$exports).default, | ||
"hu-HU": _babelRuntimeHelpersInteropRequireDefault($c4df3691058a446ced0dd150dfe$exports).default, | ||
"it-IT": _babelRuntimeHelpersInteropRequireDefault($f4bcae96d6025c3425150015e7c1$exports).default, | ||
"ja-JP": _babelRuntimeHelpersInteropRequireDefault($ce4641ff9c7f6cd81880de9ec4aea1$exports).default, | ||
"ko-KR": _babelRuntimeHelpersInteropRequireDefault($fc7f2dc28877fe5ef711423f43ab4ec$exports).default, | ||
"lt-LT": _babelRuntimeHelpersInteropRequireDefault($e9780606fc2786708924a487ef051090$exports).default, | ||
"lv-LV": _babelRuntimeHelpersInteropRequireDefault($f78f2303da5064e404af9736fac047$exports).default, | ||
"nb-NO": _babelRuntimeHelpersInteropRequireDefault($cee5ad394707cc520a38ce3ba3cf$exports).default, | ||
"nl-NL": _babelRuntimeHelpersInteropRequireDefault($cb082e87d27553826af25629e5be5497$exports).default, | ||
"pl-PL": _babelRuntimeHelpersInteropRequireDefault($c157e78f7f989ea301b76269c14e187$exports).default, | ||
"pt-BR": _babelRuntimeHelpersInteropRequireDefault($b8a8c2b158e59b4a0c2e03bc13ca6d$exports).default, | ||
"ro-RO": _babelRuntimeHelpersInteropRequireDefault($b4afde306c2e45ef13d84f99c1f9$exports).default, | ||
"ru-RU": _babelRuntimeHelpersInteropRequireDefault($f70785a191c1047fe82970e3e4ca90a$exports).default, | ||
"sk-SK": _babelRuntimeHelpersInteropRequireDefault($d9f1e67ea22a6278ecf4429d8d6404b7$exports).default, | ||
"sl-SI": _babelRuntimeHelpersInteropRequireDefault($d935f82244fe405429542f38796$exports).default, | ||
"sr-SP": _babelRuntimeHelpersInteropRequireDefault($f34be9f827d85a700494af98057c32$exports).default, | ||
"sv-SE": _babelRuntimeHelpersInteropRequireDefault($d5bc44175c568de085b694f2193a7616$exports).default, | ||
"tr-TR": _babelRuntimeHelpersInteropRequireDefault($eebf5c30d8cd80b9b3f852c78275c4f1$exports).default, | ||
"uk-UA": _babelRuntimeHelpersInteropRequireDefault($cac4b10af9ebf64a6b9df2e9a4d$exports).default, | ||
"zh-CN": _babelRuntimeHelpersInteropRequireDefault($b2d7ef1e8161e192c7a2a26b282f26e$exports).default, | ||
"zh-TW": _babelRuntimeHelpersInteropRequireDefault($d8c66ddb465b487c64522ffc49e44c8$exports).default | ||
}; | ||
function $b7614884795b0b78874e0b09da85cc36$var$RangeSlider(props, ref) { | ||
var _props$minValue, _props$maxValue; | ||
let { | ||
onChange, | ||
onChangeEnd, | ||
value, | ||
defaultValue, | ||
getValueLabel | ||
} = props, | ||
otherProps = _babelRuntimeHelpersObjectWithoutPropertiesLoose(props, ["onChange", "onChangeEnd", "value", "defaultValue", "getValueLabel"]); | ||
let baseProps = _babelRuntimeHelpersExtends({}, otherProps, { | ||
value: value != null ? [value.start, value.end] : undefined, | ||
defaultValue: defaultValue != null ? [defaultValue.start, defaultValue.end] // make sure that useSliderState knows we have two handles | ||
: [(_props$minValue = props.minValue) != null ? _props$minValue : 0, (_props$maxValue = props.maxValue) != null ? _props$maxValue : 100], | ||
onChange(v) { | ||
onChange == null ? void 0 : onChange({ | ||
start: v[0], | ||
end: v[1] | ||
}); | ||
}, | ||
onChangeEnd(v) { | ||
onChangeEnd == null ? void 0 : onChangeEnd({ | ||
start: v[0], | ||
end: v[1] | ||
}); | ||
}, | ||
getValueLabel: getValueLabel ? (_ref) => { | ||
let [start, end] = _ref; | ||
return getValueLabel({ | ||
start, | ||
end | ||
}); | ||
} : undefined | ||
}); | ||
let formatter = useMessageFormatter($b7614884795b0b78874e0b09da85cc36$var$intlMessages); | ||
let { | ||
direction | ||
} = useLocale(); | ||
return /*#__PURE__*/_react.createElement($e14249f20430d37bc9376d3f2ea9af72$export$SliderBase, _babelRuntimeHelpersExtends({}, baseProps, { | ||
classes: 'spectrum-Slider--range', | ||
ref: ref | ||
}), (_ref2) => { | ||
let { | ||
trackRef, | ||
inputRef, | ||
state | ||
} = _ref2; | ||
let cssDirection = direction === 'rtl' ? 'right' : 'left'; | ||
return /*#__PURE__*/_react.createElement(_react.Fragment, null, /*#__PURE__*/_react.createElement("div", { | ||
className: classNames($c8f0b01c76499f8ceef39abc1b587900$$interop$default, 'spectrum-Slider-track'), | ||
style: { | ||
width: state.getThumbPercent(0) * 100 + "%" | ||
} | ||
}), /*#__PURE__*/_react.createElement($d5bef0bb79767419ec0237e591b28$export$SliderThumb, { | ||
index: 0, | ||
"aria-label": formatter('minimum'), | ||
isDisabled: props.isDisabled, | ||
trackRef: trackRef, | ||
inputRef: inputRef, | ||
state: state | ||
}), /*#__PURE__*/_react.createElement("div", { | ||
className: classNames($c8f0b01c76499f8ceef39abc1b587900$$interop$default, 'spectrum-Slider-track'), | ||
style: { | ||
[cssDirection]: state.getThumbPercent(0) * 100 + "%", | ||
width: Math.abs(state.getThumbPercent(0) - state.getThumbPercent(1)) * 100 + "%" | ||
} | ||
}), /*#__PURE__*/_react.createElement($d5bef0bb79767419ec0237e591b28$export$SliderThumb, { | ||
index: 1, | ||
"aria-label": formatter('maximum'), | ||
isDisabled: props.isDisabled, | ||
trackRef: trackRef, | ||
state: state | ||
}), /*#__PURE__*/_react.createElement("div", { | ||
className: classNames($c8f0b01c76499f8ceef39abc1b587900$$interop$default, 'spectrum-Slider-track'), | ||
style: { | ||
width: (1 - state.getThumbPercent(1)) * 100 + "%" | ||
} | ||
})); | ||
}); | ||
} | ||
/** | ||
* RangeSliders allow users to quickly select a subset range. They should be used when the upper and lower bounds to the range are invariable. | ||
*/ | ||
const RangeSlider = _react.forwardRef($b7614884795b0b78874e0b09da85cc36$var$RangeSlider); | ||
exports.RangeSlider = RangeSlider; | ||
//# sourceMappingURL=main.js.map |
@@ -1,570 +0,20 @@ | ||
import _babelRuntimeHelpersEsmInteropRequireDefault from "@babel/runtime/helpers/esm/interopRequireDefault"; | ||
import { VisuallyHidden } from "@react-aria/visually-hidden"; | ||
import { useHover } from "@react-aria/interactions"; | ||
import { FocusRing } from "@react-aria/focus"; | ||
import { useSlider, useSliderThumb } from "@react-aria/slider"; | ||
import { useProviderProps } from "@react-spectrum/provider"; | ||
import { useNumberFormatter, useLocale, useMessageFormatter } from "@react-aria/i18n"; | ||
import { useSliderState } from "@react-stately/slider"; | ||
import _react, { useRef } from "react"; | ||
import { classNames, useFocusableRef, useStyleProps } from "@react-spectrum/utils"; | ||
import { clamp, mergeProps } from "@react-aria/utils"; | ||
import _babelRuntimeHelpersEsmObjectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; | ||
import _babelRuntimeHelpersEsmExtends from "@babel/runtime/helpers/esm/extends"; | ||
import "./main.css"; | ||
import {Slider as $a1251704aa53e1a5$export$472062a354075cee} from "./Slider.module.js"; | ||
import {RangeSlider as $d42a197b273dc031$export$826424dabc3dd705} from "./RangeSlider.module.js"; | ||
function $parcel$interopDefault(a) { | ||
return a && a.__esModule ? a.default : a; | ||
} | ||
/* | ||
* Copyright 2020 Adobe. All rights reserved. | ||
* This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. You may obtain a copy | ||
* of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under | ||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
* OF ANY KIND, either express or implied. See the License for the specific language | ||
* governing permissions and limitations under the License. | ||
*/ /// <reference types="css-module-types" /> | ||
// ASSET: /home/circleci/react-spectrum/node_modules/@adobe/spectrum-css-temp/components/slider/vars.css | ||
var $eba6840c1d0392d10739f5de841f2b2$exports = {}; | ||
$eba6840c1d0392d10739f5de841f2b2$exports = { | ||
"spectrum-Slider": "_spectrum-Slider_acd08", | ||
"spectrum-Dial": "_spectrum-Dial_acd08", | ||
"spectrum-Slider--positionTop": "_spectrum-Slider--positionTop_acd08", | ||
"spectrum-Slider-controls": "_spectrum-Slider-controls_acd08", | ||
"spectrum-Dial-controls": "_spectrum-Dial-controls_acd08", | ||
"spectrum-Slider--positionSide": "_spectrum-Slider--positionSide_acd08", | ||
"spectrum-Slider-labelContainer": "_spectrum-Slider-labelContainer_acd08", | ||
"spectrum-Dial-labelContainer": "_spectrum-Dial-labelContainer_acd08", | ||
"spectrum-Slider-valueLabelContainer": "_spectrum-Slider-valueLabelContainer_acd08", | ||
"spectrum-Slider-value": "_spectrum-Slider-value_acd08", | ||
"spectrum-Slider-track": "_spectrum-Slider-track_acd08", | ||
"spectrum-Slider-buffer": "_spectrum-Slider-buffer_acd08", | ||
"spectrum-Slider-ramp": "_spectrum-Slider-ramp_acd08", | ||
"spectrum-Slider-fill": "_spectrum-Slider-fill_acd08", | ||
"spectrum-Slider-fill--right": "_spectrum-Slider-fill--right_acd08", | ||
"spectrum-Slider--range": "_spectrum-Slider--range_acd08", | ||
"spectrum-Slider-handle": "_spectrum-Slider-handle_acd08", | ||
"spectrum-Dial-handle": "_spectrum-Dial-handle_acd08", | ||
"is-dragged": "_is-dragged_acd08", | ||
"is-focused": "_is-focused_acd08", | ||
"is-tophandle": "_is-tophandle_acd08", | ||
"spectrum-Slider-input": "_spectrum-Slider-input_acd08", | ||
"spectrum-Dial-input": "_spectrum-Dial-input_acd08", | ||
"spectrum-Slider-label": "_spectrum-Slider-label_acd08", | ||
"spectrum-Dial-label": "_spectrum-Dial-label_acd08", | ||
"spectrum-Dial-value": "_spectrum-Dial-value_acd08", | ||
"spectrum-Slider-ticks": "_spectrum-Slider-ticks_acd08", | ||
"spectrum-Slider-tick": "_spectrum-Slider-tick_acd08", | ||
"spectrum-Slider-tickLabel": "_spectrum-Slider-tickLabel_acd08", | ||
"spectrum-Slider--color": "_spectrum-Slider--color_acd08", | ||
"spectrum-Dial--small": "_spectrum-Dial--small_acd08", | ||
"is-disabled": "_is-disabled_acd08", | ||
"is-hovered": "_is-hovered_acd08", | ||
"u-isGrabbing": "_u-isGrabbing_acd08", | ||
"spectrum-Slider--filled": "_spectrum-Slider--filled_acd08", | ||
"spectrum-Slider--ramp": "_spectrum-Slider--ramp_acd08", | ||
"spectrum-Slider--label-side": "_spectrum-Slider--label-side_acd08" | ||
}; | ||
var $eba6840c1d0392d10739f5de841f2b2$$interop$default = $parcel$interopDefault($eba6840c1d0392d10739f5de841f2b2$exports); | ||
function $f2a839d60b7d0475c1a8405c5f55c59$var$SliderBase(props, ref) { | ||
props = useProviderProps(props); | ||
let { | ||
isDisabled, | ||
children, | ||
classes, | ||
style, | ||
labelPosition = 'top', | ||
getValueLabel, | ||
showValueLabel = !!props.label, | ||
formatOptions, | ||
minValue = 0, | ||
maxValue = 100 | ||
} = props, | ||
otherProps = _babelRuntimeHelpersEsmObjectWithoutPropertiesLoose(props, ["isDisabled", "children", "classes", "style", "labelPosition", "getValueLabel", "showValueLabel", "formatOptions", "minValue", "maxValue"]); | ||
let { | ||
styleProps | ||
} = useStyleProps(otherProps); // `Math.abs(Math.sign(a) - Math.sign(b)) === 2` is true if the values have a different sign. | ||
let alwaysDisplaySign = Math.abs(Math.sign(minValue) - Math.sign(maxValue)) === 2; | ||
if (alwaysDisplaySign) { | ||
if (formatOptions != null) { | ||
if (!('signDisplay' in formatOptions)) { | ||
formatOptions = _babelRuntimeHelpersEsmExtends({}, formatOptions, { | ||
// @ts-ignore | ||
signDisplay: 'exceptZero' | ||
}); | ||
} | ||
} else { | ||
// @ts-ignore | ||
formatOptions = { | ||
signDisplay: 'exceptZero' | ||
}; | ||
} | ||
} | ||
const formatter = useNumberFormatter(formatOptions); | ||
const state = useSliderState(_babelRuntimeHelpersEsmExtends({}, props, { | ||
numberFormatter: formatter, | ||
minValue, | ||
maxValue | ||
})); | ||
let trackRef = useRef(); | ||
let { | ||
groupProps, | ||
trackProps, | ||
labelProps, | ||
outputProps | ||
} = useSlider(props, state, trackRef); | ||
let inputRef = useRef(); | ||
let domRef = useFocusableRef(ref, inputRef); | ||
let displayValue = ''; | ||
let maxLabelLength = undefined; | ||
if (typeof getValueLabel === 'function') { | ||
displayValue = getValueLabel(state.values); | ||
switch (state.values.length) { | ||
case 1: | ||
maxLabelLength = Math.max(getValueLabel([minValue]).length, getValueLabel([maxValue]).length); | ||
break; | ||
case 2: | ||
// Try all possible combinations of min and max values. | ||
maxLabelLength = Math.max(getValueLabel([minValue, minValue]).length, getValueLabel([minValue, maxValue]).length, getValueLabel([maxValue, minValue]).length, getValueLabel([maxValue, maxValue]).length); | ||
break; | ||
default: | ||
throw new Error('Only sliders with 1 or 2 handles are supported!'); | ||
} | ||
} else { | ||
maxLabelLength = Math.max([...formatter.format(minValue)].length, [...formatter.format(maxValue)].length); | ||
switch (state.values.length) { | ||
case 1: | ||
displayValue = state.getThumbValueLabel(0); | ||
break; | ||
case 2: | ||
// This should really use the NumberFormat#formatRange proposal... | ||
// https://github.com/tc39/ecma402/issues/393 | ||
// https://github.com/tc39/proposal-intl-numberformat-v3#formatrange-ecma-402-393 | ||
displayValue = state.getThumbValueLabel(0) + " \u2013 " + state.getThumbValueLabel(1); | ||
maxLabelLength = 3 + 2 * Math.max(maxLabelLength, [...formatter.format(minValue)].length, [...formatter.format(maxValue)].length); | ||
break; | ||
default: | ||
throw new Error('Only sliders with 1 or 2 handles are supported!'); | ||
} | ||
} | ||
let labelNode = /*#__PURE__*/_react.createElement("label", _babelRuntimeHelpersEsmExtends({ | ||
className: classNames($eba6840c1d0392d10739f5de841f2b2$$interop$default, 'spectrum-Slider-label') | ||
}, labelProps), props.label); | ||
let valueNode = /*#__PURE__*/_react.createElement("output", _babelRuntimeHelpersEsmExtends({}, outputProps, { | ||
className: classNames($eba6840c1d0392d10739f5de841f2b2$$interop$default, 'spectrum-Slider-value'), | ||
style: maxLabelLength && { | ||
width: maxLabelLength + "ch", | ||
minWidth: maxLabelLength + "ch" | ||
} | ||
}), displayValue); | ||
return /*#__PURE__*/_react.createElement("div", _babelRuntimeHelpersEsmExtends({ | ||
ref: domRef, | ||
className: classNames($eba6840c1d0392d10739f5de841f2b2$$interop$default, 'spectrum-Slider', { | ||
'spectrum-Slider--positionTop': labelPosition === 'top', | ||
'spectrum-Slider--positionSide': labelPosition === 'side', | ||
'is-disabled': isDisabled | ||
}, classes, styleProps.className), | ||
style: _babelRuntimeHelpersEsmExtends({}, style, styleProps.style) | ||
}, groupProps), props.label && /*#__PURE__*/_react.createElement("div", { | ||
className: classNames($eba6840c1d0392d10739f5de841f2b2$$interop$default, 'spectrum-Slider-labelContainer'), | ||
role: "presentation" | ||
}, props.label && labelNode, labelPosition === 'top' && showValueLabel && valueNode), /*#__PURE__*/_react.createElement("div", _babelRuntimeHelpersEsmExtends({ | ||
className: classNames($eba6840c1d0392d10739f5de841f2b2$$interop$default, 'spectrum-Slider-controls'), | ||
ref: trackRef | ||
}, trackProps, { | ||
role: "presentation" | ||
}), children({ | ||
trackRef, | ||
inputRef, | ||
state | ||
})), labelPosition === 'side' && /*#__PURE__*/_react.createElement("div", { | ||
className: classNames($eba6840c1d0392d10739f5de841f2b2$$interop$default, 'spectrum-Slider-valueLabelContainer'), | ||
role: "presentation" | ||
}, showValueLabel && valueNode)); | ||
} | ||
const $f2a839d60b7d0475c1a8405c5f55c59$export$SliderBase = _react.forwardRef($f2a839d60b7d0475c1a8405c5f55c59$var$SliderBase); | ||
function $cdd2e1d7a72464bc66c894fc90d9514$export$SliderThumb(props) { | ||
let { | ||
index, | ||
inputRef, | ||
state | ||
} = props; | ||
let backupRef = useRef(); | ||
inputRef = inputRef || backupRef; | ||
let { | ||
thumbProps, | ||
inputProps | ||
} = useSliderThumb(_babelRuntimeHelpersEsmExtends({}, props, { | ||
inputRef | ||
}), state); | ||
let { | ||
hoverProps, | ||
isHovered | ||
} = useHover({}); | ||
let { | ||
direction | ||
} = useLocale(); | ||
let cssDirection = direction === 'rtl' ? 'right' : 'left'; | ||
return /*#__PURE__*/_react.createElement(FocusRing, { | ||
within: true, | ||
focusRingClass: classNames($eba6840c1d0392d10739f5de841f2b2$$interop$default, 'is-focused') | ||
}, /*#__PURE__*/_react.createElement("div", _babelRuntimeHelpersEsmExtends({ | ||
className: classNames($eba6840c1d0392d10739f5de841f2b2$$interop$default, 'spectrum-Slider-handle', { | ||
'is-hovered': isHovered, | ||
'is-dragged': state.isThumbDragging(index), | ||
'is-tophandle': state.focusedThumb === index | ||
}), | ||
style: { | ||
[cssDirection]: state.getThumbPercent(index) * 100 + "%" | ||
} | ||
}, mergeProps(thumbProps, hoverProps), { | ||
role: "presentation" | ||
}), /*#__PURE__*/_react.createElement(VisuallyHidden, null, /*#__PURE__*/_react.createElement("input", _babelRuntimeHelpersEsmExtends({ | ||
className: classNames($eba6840c1d0392d10739f5de841f2b2$$interop$default, 'spectrum-Slider-input'), | ||
ref: inputRef | ||
}, inputProps))))); | ||
} | ||
function $d5011716cff08c69e3bb71328d5$var$Slider(props, ref) { | ||
let { | ||
onChange: _onChange, | ||
onChangeEnd: _onChangeEnd, | ||
value, | ||
defaultValue, | ||
isFilled, | ||
fillOffset, | ||
trackGradient, | ||
getValueLabel | ||
} = props, | ||
otherProps = _babelRuntimeHelpersEsmObjectWithoutPropertiesLoose(props, ["onChange", "onChangeEnd", "value", "defaultValue", "isFilled", "fillOffset", "trackGradient", "getValueLabel"]); | ||
let baseProps = _babelRuntimeHelpersEsmExtends({}, otherProps, { | ||
// Normalize `value: number[]` to `value: number` | ||
value: value != null ? [value] : undefined, | ||
defaultValue: defaultValue != null ? [defaultValue] : undefined, | ||
onChange: v => { | ||
_onChange == null ? void 0 : _onChange(v[0]); | ||
}, | ||
onChangeEnd: v => { | ||
_onChangeEnd == null ? void 0 : _onChangeEnd(v[0]); | ||
}, | ||
getValueLabel: getValueLabel ? (_ref) => { | ||
let [v] = _ref; | ||
return getValueLabel(v); | ||
} : undefined | ||
}); | ||
let { | ||
direction | ||
} = useLocale(); | ||
return /*#__PURE__*/_react.createElement($f2a839d60b7d0475c1a8405c5f55c59$export$SliderBase, _babelRuntimeHelpersEsmExtends({}, baseProps, { | ||
ref: ref, | ||
classes: { | ||
'spectrum-Slider--filled': isFilled && fillOffset == null | ||
}, | ||
style: // @ts-ignore | ||
{ | ||
'--spectrum-slider-track-gradient': trackGradient && "linear-gradient(to " + (direction === 'ltr' ? 'right' : 'left') + ", " + trackGradient.join(', ') + ")" | ||
} | ||
}), (_ref2) => { | ||
let { | ||
trackRef, | ||
inputRef, | ||
state | ||
} = _ref2; | ||
fillOffset = fillOffset != null ? clamp(fillOffset, state.getThumbMinValue(0), state.getThumbMaxValue(0)) : fillOffset; | ||
let cssDirection = direction === 'rtl' ? 'right' : 'left'; | ||
let lowerTrack = /*#__PURE__*/_react.createElement("div", { | ||
className: classNames($eba6840c1d0392d10739f5de841f2b2$$interop$default, 'spectrum-Slider-track'), | ||
style: { | ||
width: state.getThumbPercent(0) * 100 + "%", | ||
// TODO not sure if it has advantages, but this could also be implemented as CSS calc(): | ||
// .track::before { | ||
// background-size: calc((1/ (var(--width)/100)) * 100%); | ||
// width: calc(var(--width) * 1%)M | ||
// } | ||
// @ts-ignore | ||
'--spectrum-track-background-size': 1 / state.getThumbPercent(0) * 100 + "%", | ||
'--spectrum-track-background-position': direction === 'ltr' ? '0' : '100%' | ||
} | ||
}); | ||
let upperTrack = /*#__PURE__*/_react.createElement("div", { | ||
className: classNames($eba6840c1d0392d10739f5de841f2b2$$interop$default, 'spectrum-Slider-track'), | ||
style: { | ||
width: (1 - state.getThumbPercent(0)) * 100 + "%", | ||
// @ts-ignore | ||
'--spectrum-track-background-size': 1 / (1 - state.getThumbPercent(0)) * 100 + "%", | ||
'--spectrum-track-background-position': direction === 'ltr' ? '100%' : '0' | ||
} | ||
}); | ||
let filledTrack = null; | ||
if (isFilled && fillOffset != null) { | ||
let width = state.getThumbPercent(0) - state.getValuePercent(fillOffset); | ||
let isRightOfOffset = width > 0; | ||
let offset = isRightOfOffset ? state.getValuePercent(fillOffset) : state.getThumbPercent(0); | ||
filledTrack = /*#__PURE__*/_react.createElement("div", { | ||
className: classNames($eba6840c1d0392d10739f5de841f2b2$$interop$default, 'spectrum-Slider-fill', { | ||
'spectrum-Slider-fill--right': isRightOfOffset | ||
}), | ||
style: { | ||
[cssDirection]: offset * 100 + "%", | ||
width: Math.abs(width) * 100 + "%" | ||
} | ||
}); | ||
} | ||
return /*#__PURE__*/_react.createElement(_react.Fragment, null, lowerTrack, /*#__PURE__*/_react.createElement($cdd2e1d7a72464bc66c894fc90d9514$export$SliderThumb, { | ||
index: 0, | ||
isDisabled: props.isDisabled, | ||
trackRef: trackRef, | ||
inputRef: inputRef, | ||
state: state | ||
}), upperTrack, filledTrack); | ||
}); | ||
} | ||
/** | ||
* 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. | ||
*/ | ||
export const Slider = _react.forwardRef($d5011716cff08c69e3bb71328d5$var$Slider); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/ar-AE.json | ||
var $d27687b4831e94119715757040fc89$exports = {}; | ||
$d27687b4831e94119715757040fc89$exports = JSON.parse("{\"maximum\":\"الحد الأقصى\",\"minimum\":\"الحد الأدنى\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/bg-BG.json | ||
var $c83745ea9effa482a53979007e74e9$exports = {}; | ||
$c83745ea9effa482a53979007e74e9$exports = JSON.parse("{\"maximum\":\"Максимум\",\"minimum\":\"Минимум\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/cs-CZ.json | ||
var $a5408019d06b7a0d17fa68ab878f23$exports = {}; | ||
$a5408019d06b7a0d17fa68ab878f23$exports = JSON.parse("{\"maximum\":\"Maximum\",\"minimum\":\"Minimální\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/da-DK.json | ||
var $c37c656790028961fe725e155cdbf4ad$exports = {}; | ||
$c37c656790028961fe725e155cdbf4ad$exports = JSON.parse("{\"maximum\":\"Maksimum\",\"minimum\":\"Minimum\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/de-DE.json | ||
var $bbde989ec969292d64b32c9785$exports = {}; | ||
$bbde989ec969292d64b32c9785$exports = JSON.parse("{\"maximum\":\"Maximal\",\"minimum\":\"Minimum\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/el-GR.json | ||
var $e5d8d525e4cd6133855df96071479cf2$exports = {}; | ||
$e5d8d525e4cd6133855df96071479cf2$exports = JSON.parse("{\"maximum\":\"Το μέγιστο\",\"minimum\":\"Ελάχιστο\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/en-US.json | ||
var $eda29b5e190c5d358791dd86f30d5b9$exports = {}; | ||
$eda29b5e190c5d358791dd86f30d5b9$exports = JSON.parse("{\"minimum\":\"Minimum\",\"maximum\":\"Maximum\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/es-ES.json | ||
var $dca9407f77c6bc19a0e23020da4bb2b7$exports = {}; | ||
$dca9407f77c6bc19a0e23020da4bb2b7$exports = JSON.parse("{\"maximum\":\"Máximo\",\"minimum\":\"Mínimo\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/et-EE.json | ||
var $c17118e3c81a731a76f3bb02af2b$exports = {}; | ||
$c17118e3c81a731a76f3bb02af2b$exports = JSON.parse("{\"maximum\":\"Maksimaalne\",\"minimum\":\"Minimaalne\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/fi-FI.json | ||
var $ca494ff015fe55028b109dceb4a5efcb$exports = {}; | ||
$ca494ff015fe55028b109dceb4a5efcb$exports = JSON.parse("{\"maximum\":\"Maksimi\",\"minimum\":\"Minimi\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/fr-FR.json | ||
var $bdd452ce38d84c24e6945e770a148231$exports = {}; | ||
$bdd452ce38d84c24e6945e770a148231$exports = JSON.parse("{\"maximum\":\"Maximum\",\"minimum\":\"Minimum\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/he-IL.json | ||
var $d6921d8badefd755f531ebb7e633cd67$exports = {}; | ||
$d6921d8badefd755f531ebb7e633cd67$exports = JSON.parse("{\"maximum\":\"מַקסִימוּם\",\"minimum\":\"מִינִימוּם\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/hu-HU.json | ||
var $dc224dbb1e4891dfe3b9cfa04d8f2f8c$exports = {}; | ||
$dc224dbb1e4891dfe3b9cfa04d8f2f8c$exports = JSON.parse("{\"maximum\":\"Maximális\",\"minimum\":\"Minimális\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/it-IT.json | ||
var $ffb3a383a81cee7d35dab658ba49265$exports = {}; | ||
$ffb3a383a81cee7d35dab658ba49265$exports = JSON.parse("{\"maximum\":\"Massimo\",\"minimum\":\"Minimo\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/ja-JP.json | ||
var $fc31587f58b7dd4a90ef7b4607576$exports = {}; | ||
$fc31587f58b7dd4a90ef7b4607576$exports = JSON.parse("{\"maximum\":\"最大\",\"minimum\":\"最小\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/ko-KR.json | ||
var $fdec86822a58a9d197eff29314d34c6$exports = {}; | ||
$fdec86822a58a9d197eff29314d34c6$exports = JSON.parse("{\"maximum\":\"최대\",\"minimum\":\"최소\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/lt-LT.json | ||
var $a7da2ce94c5a29b455a346a231f9dc17$exports = {}; | ||
$a7da2ce94c5a29b455a346a231f9dc17$exports = JSON.parse("{\"maximum\":\"Maksimalus\",\"minimum\":\"Minimumas\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/lv-LV.json | ||
var $fa4249d070625bd33d0f25292f40831$exports = {}; | ||
$fa4249d070625bd33d0f25292f40831$exports = JSON.parse("{\"maximum\":\"Maksimums\",\"minimum\":\"Minimālais\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/nb-NO.json | ||
var $bb265ee3e8ad9b68c8f373fa80448b$exports = {}; | ||
$bb265ee3e8ad9b68c8f373fa80448b$exports = JSON.parse("{\"maximum\":\"Maksimum\",\"minimum\":\"Minimum\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/nl-NL.json | ||
var $b26bd6f82d46acd94a531738cda$exports = {}; | ||
$b26bd6f82d46acd94a531738cda$exports = JSON.parse("{\"maximum\":\"Maximaal\",\"minimum\":\"Minimum\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/pl-PL.json | ||
var $d16fce360806f5e61591005b7f965580$exports = {}; | ||
$d16fce360806f5e61591005b7f965580$exports = JSON.parse("{\"maximum\":\"Maksimum\",\"minimum\":\"Minimum\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/pt-BR.json | ||
var $ecaad23b0296eeba404aa5a79c9b8$exports = {}; | ||
$ecaad23b0296eeba404aa5a79c9b8$exports = JSON.parse("{\"maximum\":\"Máximo\",\"minimum\":\"Mínimo\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/ro-RO.json | ||
var $f8bf2186219a1446233174d572510c$exports = {}; | ||
$f8bf2186219a1446233174d572510c$exports = JSON.parse("{\"maximum\":\"Maxim\",\"minimum\":\"Minim\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/ru-RU.json | ||
var $a64e4a312e107ca24139a3a42ac6$exports = {}; | ||
$a64e4a312e107ca24139a3a42ac6$exports = JSON.parse("{\"maximum\":\"Максимум\",\"minimum\":\"Минимум\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/sk-SK.json | ||
var $a72bb3889f0d9a1d3a8d412d1465b9c7$exports = {}; | ||
$a72bb3889f0d9a1d3a8d412d1465b9c7$exports = JSON.parse("{\"maximum\":\"Maximum\",\"minimum\":\"Minimálne\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/sl-SI.json | ||
var $aa49af86b37be21b5d3fd9d0a398a5$exports = {}; | ||
$aa49af86b37be21b5d3fd9d0a398a5$exports = JSON.parse("{\"maximum\":\"Največ\",\"minimum\":\"Najmanj\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/sr-SP.json | ||
var $caa91cda128ed7f0b3c99f252a005a46$exports = {}; | ||
$caa91cda128ed7f0b3c99f252a005a46$exports = JSON.parse("{\"maximum\":\"Максимум\",\"minimum\":\"Минимум\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/sv-SE.json | ||
var $da07c94178577196106bcc390$exports = {}; | ||
$da07c94178577196106bcc390$exports = JSON.parse("{\"maximum\":\"Maximal\",\"minimum\":\"Minimum\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/tr-TR.json | ||
var $d4d47d2cd3be126568c3f0c86d9a2e47$exports = {}; | ||
$d4d47d2cd3be126568c3f0c86d9a2e47$exports = JSON.parse("{\"maximum\":\"Maksimum\",\"minimum\":\"Minimum\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/uk-UA.json | ||
var $eea8e390fa97c96f720e776012259865$exports = {}; | ||
$eea8e390fa97c96f720e776012259865$exports = JSON.parse("{\"maximum\":\"Максимум\",\"minimum\":\"Мінімум\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/zh-CN.json | ||
var $ebe4e406cbb8c9cf937f42ddc0472714$exports = {}; | ||
$ebe4e406cbb8c9cf937f42ddc0472714$exports = JSON.parse("{\"maximum\":\"最大\",\"minimum\":\"最小\"}"); | ||
// ASSET: /home/circleci/react-spectrum/packages/@react-spectrum/slider/intl/zh-TW.json | ||
var $c50aa141b5dbc2139a49d6e48a78f8$exports = {}; | ||
$c50aa141b5dbc2139a49d6e48a78f8$exports = JSON.parse("{\"maximum\":\"最大值\",\"minimum\":\"最小值\"}"); | ||
// @ts-ignore | ||
const $b5dd6507adf3d1434dcf5a8f595509$var$intlMessages = { | ||
"ar-AE": _babelRuntimeHelpersEsmInteropRequireDefault($d27687b4831e94119715757040fc89$exports).default, | ||
"bg-BG": _babelRuntimeHelpersEsmInteropRequireDefault($c83745ea9effa482a53979007e74e9$exports).default, | ||
"cs-CZ": _babelRuntimeHelpersEsmInteropRequireDefault($a5408019d06b7a0d17fa68ab878f23$exports).default, | ||
"da-DK": _babelRuntimeHelpersEsmInteropRequireDefault($c37c656790028961fe725e155cdbf4ad$exports).default, | ||
"de-DE": _babelRuntimeHelpersEsmInteropRequireDefault($bbde989ec969292d64b32c9785$exports).default, | ||
"el-GR": _babelRuntimeHelpersEsmInteropRequireDefault($e5d8d525e4cd6133855df96071479cf2$exports).default, | ||
"en-US": _babelRuntimeHelpersEsmInteropRequireDefault($eda29b5e190c5d358791dd86f30d5b9$exports).default, | ||
"es-ES": _babelRuntimeHelpersEsmInteropRequireDefault($dca9407f77c6bc19a0e23020da4bb2b7$exports).default, | ||
"et-EE": _babelRuntimeHelpersEsmInteropRequireDefault($c17118e3c81a731a76f3bb02af2b$exports).default, | ||
"fi-FI": _babelRuntimeHelpersEsmInteropRequireDefault($ca494ff015fe55028b109dceb4a5efcb$exports).default, | ||
"fr-FR": _babelRuntimeHelpersEsmInteropRequireDefault($bdd452ce38d84c24e6945e770a148231$exports).default, | ||
"he-IL": _babelRuntimeHelpersEsmInteropRequireDefault($d6921d8badefd755f531ebb7e633cd67$exports).default, | ||
"hu-HU": _babelRuntimeHelpersEsmInteropRequireDefault($dc224dbb1e4891dfe3b9cfa04d8f2f8c$exports).default, | ||
"it-IT": _babelRuntimeHelpersEsmInteropRequireDefault($ffb3a383a81cee7d35dab658ba49265$exports).default, | ||
"ja-JP": _babelRuntimeHelpersEsmInteropRequireDefault($fc31587f58b7dd4a90ef7b4607576$exports).default, | ||
"ko-KR": _babelRuntimeHelpersEsmInteropRequireDefault($fdec86822a58a9d197eff29314d34c6$exports).default, | ||
"lt-LT": _babelRuntimeHelpersEsmInteropRequireDefault($a7da2ce94c5a29b455a346a231f9dc17$exports).default, | ||
"lv-LV": _babelRuntimeHelpersEsmInteropRequireDefault($fa4249d070625bd33d0f25292f40831$exports).default, | ||
"nb-NO": _babelRuntimeHelpersEsmInteropRequireDefault($bb265ee3e8ad9b68c8f373fa80448b$exports).default, | ||
"nl-NL": _babelRuntimeHelpersEsmInteropRequireDefault($b26bd6f82d46acd94a531738cda$exports).default, | ||
"pl-PL": _babelRuntimeHelpersEsmInteropRequireDefault($d16fce360806f5e61591005b7f965580$exports).default, | ||
"pt-BR": _babelRuntimeHelpersEsmInteropRequireDefault($ecaad23b0296eeba404aa5a79c9b8$exports).default, | ||
"ro-RO": _babelRuntimeHelpersEsmInteropRequireDefault($f8bf2186219a1446233174d572510c$exports).default, | ||
"ru-RU": _babelRuntimeHelpersEsmInteropRequireDefault($a64e4a312e107ca24139a3a42ac6$exports).default, | ||
"sk-SK": _babelRuntimeHelpersEsmInteropRequireDefault($a72bb3889f0d9a1d3a8d412d1465b9c7$exports).default, | ||
"sl-SI": _babelRuntimeHelpersEsmInteropRequireDefault($aa49af86b37be21b5d3fd9d0a398a5$exports).default, | ||
"sr-SP": _babelRuntimeHelpersEsmInteropRequireDefault($caa91cda128ed7f0b3c99f252a005a46$exports).default, | ||
"sv-SE": _babelRuntimeHelpersEsmInteropRequireDefault($da07c94178577196106bcc390$exports).default, | ||
"tr-TR": _babelRuntimeHelpersEsmInteropRequireDefault($d4d47d2cd3be126568c3f0c86d9a2e47$exports).default, | ||
"uk-UA": _babelRuntimeHelpersEsmInteropRequireDefault($eea8e390fa97c96f720e776012259865$exports).default, | ||
"zh-CN": _babelRuntimeHelpersEsmInteropRequireDefault($ebe4e406cbb8c9cf937f42ddc0472714$exports).default, | ||
"zh-TW": _babelRuntimeHelpersEsmInteropRequireDefault($c50aa141b5dbc2139a49d6e48a78f8$exports).default | ||
}; | ||
function $b5dd6507adf3d1434dcf5a8f595509$var$RangeSlider(props, ref) { | ||
var _props$minValue, _props$maxValue; | ||
let { | ||
onChange, | ||
onChangeEnd, | ||
value, | ||
defaultValue, | ||
getValueLabel | ||
} = props, | ||
otherProps = _babelRuntimeHelpersEsmObjectWithoutPropertiesLoose(props, ["onChange", "onChangeEnd", "value", "defaultValue", "getValueLabel"]); | ||
let baseProps = _babelRuntimeHelpersEsmExtends({}, otherProps, { | ||
value: value != null ? [value.start, value.end] : undefined, | ||
defaultValue: defaultValue != null ? [defaultValue.start, defaultValue.end] // make sure that useSliderState knows we have two handles | ||
: [(_props$minValue = props.minValue) != null ? _props$minValue : 0, (_props$maxValue = props.maxValue) != null ? _props$maxValue : 100], | ||
onChange(v) { | ||
onChange == null ? void 0 : onChange({ | ||
start: v[0], | ||
end: v[1] | ||
}); | ||
}, | ||
onChangeEnd(v) { | ||
onChangeEnd == null ? void 0 : onChangeEnd({ | ||
start: v[0], | ||
end: v[1] | ||
}); | ||
}, | ||
getValueLabel: getValueLabel ? (_ref) => { | ||
let [start, end] = _ref; | ||
return getValueLabel({ | ||
start, | ||
end | ||
}); | ||
} : undefined | ||
}); | ||
let formatter = useMessageFormatter($b5dd6507adf3d1434dcf5a8f595509$var$intlMessages); | ||
let { | ||
direction | ||
} = useLocale(); | ||
return /*#__PURE__*/_react.createElement($f2a839d60b7d0475c1a8405c5f55c59$export$SliderBase, _babelRuntimeHelpersEsmExtends({}, baseProps, { | ||
classes: 'spectrum-Slider--range', | ||
ref: ref | ||
}), (_ref2) => { | ||
let { | ||
trackRef, | ||
inputRef, | ||
state | ||
} = _ref2; | ||
let cssDirection = direction === 'rtl' ? 'right' : 'left'; | ||
return /*#__PURE__*/_react.createElement(_react.Fragment, null, /*#__PURE__*/_react.createElement("div", { | ||
className: classNames($eba6840c1d0392d10739f5de841f2b2$$interop$default, 'spectrum-Slider-track'), | ||
style: { | ||
width: state.getThumbPercent(0) * 100 + "%" | ||
} | ||
}), /*#__PURE__*/_react.createElement($cdd2e1d7a72464bc66c894fc90d9514$export$SliderThumb, { | ||
index: 0, | ||
"aria-label": formatter('minimum'), | ||
isDisabled: props.isDisabled, | ||
trackRef: trackRef, | ||
inputRef: inputRef, | ||
state: state | ||
}), /*#__PURE__*/_react.createElement("div", { | ||
className: classNames($eba6840c1d0392d10739f5de841f2b2$$interop$default, 'spectrum-Slider-track'), | ||
style: { | ||
[cssDirection]: state.getThumbPercent(0) * 100 + "%", | ||
width: Math.abs(state.getThumbPercent(0) - state.getThumbPercent(1)) * 100 + "%" | ||
} | ||
}), /*#__PURE__*/_react.createElement($cdd2e1d7a72464bc66c894fc90d9514$export$SliderThumb, { | ||
index: 1, | ||
"aria-label": formatter('maximum'), | ||
isDisabled: props.isDisabled, | ||
trackRef: trackRef, | ||
state: state | ||
}), /*#__PURE__*/_react.createElement("div", { | ||
className: classNames($eba6840c1d0392d10739f5de841f2b2$$interop$default, 'spectrum-Slider-track'), | ||
style: { | ||
width: (1 - state.getThumbPercent(1)) * 100 + "%" | ||
} | ||
})); | ||
}); | ||
} | ||
/** | ||
* RangeSliders allow users to quickly select a subset range. They should be used when the upper and lower bounds to the range are invariable. | ||
*/ | ||
export const RangeSlider = _react.forwardRef($b5dd6507adf3d1434dcf5a8f595509$var$RangeSlider); | ||
export {$a1251704aa53e1a5$export$472062a354075cee as Slider, $d42a197b273dc031$export$826424dabc3dd705 as RangeSlider}; | ||
//# sourceMappingURL=module.js.map |
import React from "react"; | ||
import { SpectrumSliderProps, SpectrumRangeSliderProps } from "@react-types/slider"; | ||
import { FocusableRefValue } from "@react-types/shared"; | ||
/** | ||
* 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. | ||
*/ | ||
export const Slider: React.ForwardRefExoticComponent<SpectrumSliderProps & React.RefAttributes<import("@react-types/shared").FocusableRefValue<HTMLDivElement, HTMLDivElement>>>; | ||
export const Slider: React.ForwardRefExoticComponent<SpectrumSliderProps & React.RefAttributes<FocusableRefValue<HTMLDivElement, HTMLDivElement>>>; | ||
/** | ||
* RangeSliders allow users to quickly select a subset range. They should be used when the upper and lower bounds to the range are invariable. | ||
*/ | ||
export const RangeSlider: React.ForwardRefExoticComponent<SpectrumRangeSliderProps & React.RefAttributes<import("@react-types/shared").FocusableRefValue<HTMLDivElement, HTMLDivElement>>>; | ||
export const RangeSlider: React.ForwardRefExoticComponent<SpectrumRangeSliderProps & React.RefAttributes<FocusableRefValue<HTMLDivElement, HTMLDivElement>>>; | ||
export type { SpectrumRangeSliderProps, SpectrumSliderProps } from '@react-types/slider'; | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "@react-spectrum/slider", | ||
"version": "3.0.0-nightly.2508+78347729", | ||
"version": "3.0.0-nightly-07431f4b1-241030", | ||
"description": "Spectrum UI components in React", | ||
@@ -8,2 +8,7 @@ "license": "Apache-2.0", | ||
"module": "dist/module.js", | ||
"exports": { | ||
"types": "./dist/types.d.ts", | ||
"import": "./dist/import.mjs", | ||
"require": "./dist/main.js" | ||
}, | ||
"types": "dist/types.d.ts", | ||
@@ -35,20 +40,20 @@ "source": "src/index.ts", | ||
"dependencies": { | ||
"@babel/runtime": "^7.6.2", | ||
"@react-aria/focus": "3.0.0-nightly.830+78347729", | ||
"@react-aria/i18n": "3.0.0-nightly.830+78347729", | ||
"@react-aria/interactions": "3.0.0-nightly.830+78347729", | ||
"@react-aria/slider": "3.0.0-nightly.2508+78347729", | ||
"@react-aria/utils": "3.0.0-nightly.830+78347729", | ||
"@react-aria/visually-hidden": "3.0.0-nightly.830+78347729", | ||
"@react-spectrum/utils": "3.0.0-nightly.830+78347729", | ||
"@react-stately/slider": "3.0.0-nightly.2508+78347729", | ||
"@react-types/shared": "3.0.0-nightly.830+78347729", | ||
"@react-types/slider": "3.0.0-nightly.2508+78347729" | ||
"@react-aria/focus": "^3.0.0-nightly-07431f4b1-241030", | ||
"@react-aria/i18n": "^3.0.0-nightly-07431f4b1-241030", | ||
"@react-aria/interactions": "^3.0.0-nightly-07431f4b1-241030", | ||
"@react-aria/slider": "^3.0.0-nightly-07431f4b1-241030", | ||
"@react-aria/utils": "^3.0.0-nightly-07431f4b1-241030", | ||
"@react-aria/visually-hidden": "^3.0.0-nightly-07431f4b1-241030", | ||
"@react-spectrum/utils": "^3.0.0-nightly-07431f4b1-241030", | ||
"@react-stately/slider": "^3.0.0-nightly-07431f4b1-241030", | ||
"@react-types/shared": "^3.0.0-nightly-07431f4b1-241030", | ||
"@react-types/slider": "^3.0.0-nightly-07431f4b1-241030", | ||
"@swc/helpers": "^0.5.0" | ||
}, | ||
"devDependencies": { | ||
"@adobe/spectrum-css-temp": "3.0.0-nightly.830+78347729" | ||
"@adobe/spectrum-css-temp": "3.0.0-alpha.1" | ||
}, | ||
"peerDependencies": { | ||
"@react-spectrum/provider": "^3.0.0-rc.1", | ||
"react": "^16.8.0" | ||
"@react-spectrum/provider": "^3.0.0-nightly-07431f4b1-241030", | ||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0" | ||
}, | ||
@@ -58,3 +63,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "78347729a1af5d16e7fa90120a258841d4cb55a7" | ||
} | ||
"stableVersion": "3.6.13" | ||
} |
@@ -15,3 +15,4 @@ /* | ||
export * from './Slider'; | ||
export * from './RangeSlider'; | ||
export {Slider} from './Slider'; | ||
export {RangeSlider} from './RangeSlider'; | ||
export type {SpectrumRangeSliderProps, SpectrumSliderProps} from '@react-types/slider'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 5 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
319728
216
4093
5
60
31
62
6
+ Added@swc/helpers@^0.5.0
+ Added@react-aria/label@3.7.12(transitive)
+ Added@react-aria/slider@3.7.13(transitive)
+ Added@react-stately/slider@3.5.8(transitive)
+ Added@react-types/slider@3.7.6(transitive)
- Removed@babel/runtime@^7.6.2
- Removed@babel/runtime@7.26.0(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedprop-types@15.8.1(transitive)
- Removedreact@16.14.0(transitive)
- Removedreact-is@16.13.1(transitive)
- Removedregenerator-runtime@0.14.1(transitive)
Updated@react-aria/interactions@^3.0.0-nightly-07431f4b1-241030
Updated@react-aria/visually-hidden@^3.0.0-nightly-07431f4b1-241030
Updated@react-spectrum/utils@^3.0.0-nightly-07431f4b1-241030
Updated@react-stately/slider@^3.0.0-nightly-07431f4b1-241030