@rpg-engine/long-bow 0.5.83 → 0.5.84
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/components/RangeSlider.d.ts +1 -0
- package/dist/long-bow.cjs.development.js +11 -7
- package/dist/long-bow.cjs.development.js.map +1 -1
- package/dist/long-bow.cjs.production.min.js +1 -1
- package/dist/long-bow.cjs.production.min.js.map +1 -1
- package/dist/long-bow.esm.js +11 -7
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/RangeSlider.tsx +51 -46
- package/src/stories/RangeSlider.stories.tsx +1 -0
package/dist/long-bow.esm.js
CHANGED
|
@@ -16317,13 +16317,15 @@ var RangeSliderType;
|
|
|
16317
16317
|
RangeSliderType["Slider"] = "rpgui-slider";
|
|
16318
16318
|
RangeSliderType["GoldSlider"] = "rpgui-slider golden";
|
|
16319
16319
|
})(RangeSliderType || (RangeSliderType = {}));
|
|
16320
|
-
var RangeSlider = function
|
|
16320
|
+
var RangeSlider = /*#__PURE__*/React.memo(function (_ref) {
|
|
16321
16321
|
var type = _ref.type,
|
|
16322
16322
|
valueMin = _ref.valueMin,
|
|
16323
16323
|
valueMax = _ref.valueMax,
|
|
16324
16324
|
width = _ref.width,
|
|
16325
|
-
|
|
16326
|
-
value = _ref.value
|
|
16325
|
+
onChange = _ref.onChange,
|
|
16326
|
+
value = _ref.value,
|
|
16327
|
+
_ref$step = _ref.step,
|
|
16328
|
+
step = _ref$step === void 0 ? 1 : _ref$step;
|
|
16327
16329
|
var sliderId = v4();
|
|
16328
16330
|
var containerRef = useRef(null);
|
|
16329
16331
|
var _useState = useState(0),
|
|
@@ -16335,6 +16337,9 @@ var RangeSlider = function RangeSlider(_ref) {
|
|
|
16335
16337
|
setLeft(Math.max((value - valueMin) / (valueMax - valueMin) * (calculatedWidth - 35) + 10));
|
|
16336
16338
|
}, [value, valueMin, valueMax]);
|
|
16337
16339
|
var typeClass = type === RangeSliderType.GoldSlider ? 'golden' : '';
|
|
16340
|
+
var handleChange = useCallback(function (e) {
|
|
16341
|
+
onChange(Number(e.target.value));
|
|
16342
|
+
}, [onChange]);
|
|
16338
16343
|
return React.createElement("div", {
|
|
16339
16344
|
style: {
|
|
16340
16345
|
width: width,
|
|
@@ -16365,13 +16370,12 @@ var RangeSlider = function RangeSlider(_ref) {
|
|
|
16365
16370
|
},
|
|
16366
16371
|
min: valueMin,
|
|
16367
16372
|
max: valueMax,
|
|
16368
|
-
|
|
16369
|
-
|
|
16370
|
-
},
|
|
16373
|
+
step: step,
|
|
16374
|
+
onChange: handleChange,
|
|
16371
16375
|
value: value,
|
|
16372
16376
|
className: "rpgui-cursor-point"
|
|
16373
16377
|
}));
|
|
16374
|
-
};
|
|
16378
|
+
});
|
|
16375
16379
|
var Input$1 = /*#__PURE__*/styled.input.withConfig({
|
|
16376
16380
|
displayName: "RangeSlider__Input",
|
|
16377
16381
|
componentId: "sc-v8mte9-0"
|