@mirror-physics/fractal-ui 0.2.0-next.72 → 0.2.0-next.73
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/index.cjs +28 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -940,6 +940,21 @@ function Slider(props) {
|
|
|
940
940
|
clamp(nextUpper, nextLower, max)
|
|
941
941
|
]);
|
|
942
942
|
};
|
|
943
|
+
const getKeyboardValue = (event, value) => {
|
|
944
|
+
const pageStep = step * 10;
|
|
945
|
+
const adjustments = {
|
|
946
|
+
ArrowDown: -step,
|
|
947
|
+
ArrowLeft: -step,
|
|
948
|
+
ArrowRight: step,
|
|
949
|
+
ArrowUp: step,
|
|
950
|
+
PageDown: -pageStep,
|
|
951
|
+
PageUp: pageStep
|
|
952
|
+
};
|
|
953
|
+
if (event.key === "Home") return min;
|
|
954
|
+
if (event.key === "End") return max;
|
|
955
|
+
if (!(event.key in adjustments)) return null;
|
|
956
|
+
return value + adjustments[event.key];
|
|
957
|
+
};
|
|
943
958
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
944
959
|
"div",
|
|
945
960
|
{
|
|
@@ -974,6 +989,13 @@ function Slider(props) {
|
|
|
974
989
|
if (knobs === 2) changeRangeValue(Math.min(nextValue, secondValue), secondValue);
|
|
975
990
|
else changeSingleValue(nextValue);
|
|
976
991
|
},
|
|
992
|
+
onKeyDown: (event) => {
|
|
993
|
+
const nextValue = getKeyboardValue(event, firstValue);
|
|
994
|
+
if (nextValue === null) return;
|
|
995
|
+
event.preventDefault();
|
|
996
|
+
if (knobs === 2) changeRangeValue(Math.min(nextValue, secondValue), secondValue);
|
|
997
|
+
else changeSingleValue(nextValue);
|
|
998
|
+
},
|
|
977
999
|
step,
|
|
978
1000
|
type: "range",
|
|
979
1001
|
value: firstValue
|
|
@@ -990,6 +1012,12 @@ function Slider(props) {
|
|
|
990
1012
|
const nextValue = event.currentTarget.valueAsNumber;
|
|
991
1013
|
changeRangeValue(firstValue, Math.max(nextValue, firstValue));
|
|
992
1014
|
},
|
|
1015
|
+
onKeyDown: (event) => {
|
|
1016
|
+
const nextValue = getKeyboardValue(event, secondValue);
|
|
1017
|
+
if (nextValue === null) return;
|
|
1018
|
+
event.preventDefault();
|
|
1019
|
+
changeRangeValue(firstValue, Math.max(nextValue, firstValue));
|
|
1020
|
+
},
|
|
993
1021
|
step,
|
|
994
1022
|
type: "range",
|
|
995
1023
|
value: secondValue
|