@shopify/polaris
Version:
Shopify’s product component library
37 lines (30 loc) • 1.04 kB
JavaScript
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
import React$1 from 'react';
import { useUniqueId } from '../../utilities/unique-id/hooks.js';
import { DualThumb as DualThumb$1 } from './components/DualThumb/DualThumb.js';
import { SingleThumb as SingleThumb$1 } from './components/SingleThumb/SingleThumb.js';
function RangeSlider(_ref) {
var {
min = 0,
max = 100,
step = 1,
value
} = _ref,
rest = _objectWithoutProperties(_ref, ["min", "max", "step", "value"]);
var id = useUniqueId('RangeSlider');
var sharedProps = _objectSpread2({
id,
min,
max,
step
}, rest);
return isDualThumb(value) ? /*#__PURE__*/React$1.createElement(DualThumb$1, Object.assign({
value: value
}, sharedProps)) : /*#__PURE__*/React$1.createElement(SingleThumb$1, Object.assign({
value: value
}, sharedProps));
}
function isDualThumb(value) {
return Array.isArray(value);
}
export { RangeSlider };