@react-aria/color 3.0.0-beta.21 → 3.0.0-beta.23
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/import.mjs +74 -62
- package/dist/main.js +72 -60
- package/dist/main.js.map +1 -1
- package/dist/module.js +74 -62
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +14 -14
- package/src/useColorArea.ts +55 -43
- package/src/useColorSlider.ts +2 -1
- package/src/useColorWheel.ts +14 -13
package/dist/import.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {useGlobalListeners as $7KHxM$useGlobalListeners, focusWithoutScrolling as $7KHxM$focusWithoutScrolling, mergeProps as $7KHxM$mergeProps, isIOS as $7KHxM$isIOS, isAndroid as $7KHxM$isAndroid, useLabels as $7KHxM$useLabels, useId as $7KHxM$useId} from "@react-aria/utils";
|
|
2
|
-
import {
|
|
1
|
+
import {useGlobalListeners as $7KHxM$useGlobalListeners, focusWithoutScrolling as $7KHxM$focusWithoutScrolling, useFormReset as $7KHxM$useFormReset, mergeProps as $7KHxM$mergeProps, isIOS as $7KHxM$isIOS, isAndroid as $7KHxM$isAndroid, useLabels as $7KHxM$useLabels, useId as $7KHxM$useId} from "@react-aria/utils";
|
|
2
|
+
import {useState as $7KHxM$useState, useCallback as $7KHxM$useCallback, useRef as $7KHxM$useRef, useMemo as $7KHxM$useMemo} from "react";
|
|
3
3
|
import {useKeyboard as $7KHxM$useKeyboard, useMove as $7KHxM$useMove, useFocusWithin as $7KHxM$useFocusWithin, useFocus as $7KHxM$useFocus, useScrollWheel as $7KHxM$useScrollWheel} from "@react-aria/interactions";
|
|
4
4
|
import {useLocalizedStringFormatter as $7KHxM$useLocalizedStringFormatter, useLocale as $7KHxM$useLocale} from "@react-aria/i18n";
|
|
5
5
|
import {useVisuallyHidden as $7KHxM$useVisuallyHidden} from "@react-aria/visually-hidden";
|
|
@@ -31,7 +31,7 @@ function $parcel$interopDefault(a) {
|
|
|
31
31
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
32
32
|
* governing permissions and limitations under the License.
|
|
33
33
|
*/
|
|
34
|
-
var $
|
|
34
|
+
var $3493a52097159720$exports = {};
|
|
35
35
|
var $eccab2b0118aef08$exports = {};
|
|
36
36
|
$eccab2b0118aef08$exports = {
|
|
37
37
|
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
@@ -338,7 +338,7 @@ $b0fef28529309aa6$exports = {
|
|
|
338
338
|
};
|
|
339
339
|
|
|
340
340
|
|
|
341
|
-
$
|
|
341
|
+
$3493a52097159720$exports = {
|
|
342
342
|
"ar-AE": $eccab2b0118aef08$exports,
|
|
343
343
|
"bg-BG": $bf2b4507594e3d45$exports,
|
|
344
344
|
"cs-CZ": $01c08487af7ecd14$exports,
|
|
@@ -601,21 +601,27 @@ function $40297c24c53588e6$export$dd62420467d245ca({ direction: direction , stat
|
|
|
601
601
|
|
|
602
602
|
|
|
603
603
|
function $60bd7d6e45dcddfa$export$2f92a7a615a014f6(props, state) {
|
|
604
|
-
let { isDisabled: isDisabled , inputXRef: inputXRef , inputYRef: inputYRef , containerRef: containerRef , "aria-label": ariaLabel } = props;
|
|
605
|
-
let stringFormatter = (0, $7KHxM$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($
|
|
604
|
+
let { isDisabled: isDisabled , inputXRef: inputXRef , inputYRef: inputYRef , containerRef: containerRef , "aria-label": ariaLabel , xName: xName , yName: yName } = props;
|
|
605
|
+
let stringFormatter = (0, $7KHxM$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($3493a52097159720$exports))));
|
|
606
606
|
let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = (0, $7KHxM$useGlobalListeners)();
|
|
607
607
|
let { direction: direction , locale: locale } = (0, $7KHxM$useLocale)();
|
|
608
|
-
let
|
|
608
|
+
let [focusedInput, setFocusedInput] = (0, $7KHxM$useState)(null);
|
|
609
609
|
let focusInput = (0, $7KHxM$useCallback)((inputRef = inputXRef)=>{
|
|
610
610
|
if (inputRef.current) (0, $7KHxM$focusWithoutScrolling)(inputRef.current);
|
|
611
611
|
}, [
|
|
612
612
|
inputXRef
|
|
613
613
|
]);
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
614
|
+
(0, $7KHxM$useFormReset)(inputXRef, [
|
|
615
|
+
state.xValue,
|
|
616
|
+
state.yValue
|
|
617
|
+
], ([x, y])=>{
|
|
618
|
+
let newColor = state.value.withChannelValue(state.channels.xChannel, x).withChannelValue(state.channels.yChannel, y);
|
|
619
|
+
state.setValue(newColor);
|
|
620
|
+
});
|
|
621
|
+
let [valueChangedViaKeyboard, setValueChangedViaKeyboard] = (0, $7KHxM$useState)(false);
|
|
622
|
+
let { xChannel: xChannel , yChannel: yChannel , zChannel: zChannel } = state.channels;
|
|
623
|
+
let xChannelStep = state.xChannelStep;
|
|
624
|
+
let yChannelStep = state.yChannelStep;
|
|
619
625
|
let currentPosition = (0, $7KHxM$useRef)(null);
|
|
620
626
|
let { keyboardProps: keyboardProps } = (0, $7KHxM$useKeyboard)({
|
|
621
627
|
onKeyDown (e) {
|
|
@@ -627,37 +633,42 @@ function $60bd7d6e45dcddfa$export$2f92a7a615a014f6(props, state) {
|
|
|
627
633
|
// same handling as useMove, don't need to stop propagation, useKeyboard will do that for us
|
|
628
634
|
e.preventDefault();
|
|
629
635
|
// remember to set this and unset it so that onChangeEnd is fired
|
|
630
|
-
|
|
631
|
-
|
|
636
|
+
state.setDragging(true);
|
|
637
|
+
setValueChangedViaKeyboard(true);
|
|
638
|
+
let dir;
|
|
632
639
|
switch(e.key){
|
|
633
640
|
case "PageUp":
|
|
634
|
-
|
|
635
|
-
|
|
641
|
+
state.incrementY(state.yChannelPageStep);
|
|
642
|
+
dir = "y";
|
|
636
643
|
break;
|
|
637
644
|
case "PageDown":
|
|
638
|
-
|
|
639
|
-
|
|
645
|
+
state.decrementY(state.yChannelPageStep);
|
|
646
|
+
dir = "y";
|
|
640
647
|
break;
|
|
641
648
|
case "Home":
|
|
642
|
-
direction === "rtl" ?
|
|
643
|
-
|
|
649
|
+
direction === "rtl" ? state.incrementX(state.xChannelPageStep) : state.decrementX(state.xChannelPageStep);
|
|
650
|
+
dir = "x";
|
|
644
651
|
break;
|
|
645
652
|
case "End":
|
|
646
|
-
direction === "rtl" ?
|
|
647
|
-
|
|
653
|
+
direction === "rtl" ? state.decrementX(state.xChannelPageStep) : state.incrementX(state.xChannelPageStep);
|
|
654
|
+
dir = "x";
|
|
648
655
|
break;
|
|
649
656
|
}
|
|
650
|
-
|
|
651
|
-
if (
|
|
657
|
+
state.setDragging(false);
|
|
658
|
+
if (dir) {
|
|
659
|
+
let input = dir === "x" ? inputXRef : inputYRef;
|
|
660
|
+
focusInput(input);
|
|
661
|
+
setFocusedInput(dir);
|
|
662
|
+
}
|
|
652
663
|
}
|
|
653
664
|
});
|
|
654
665
|
let moveHandler = {
|
|
655
666
|
onMoveStart () {
|
|
656
667
|
currentPosition.current = null;
|
|
657
|
-
|
|
668
|
+
state.setDragging(true);
|
|
658
669
|
},
|
|
659
670
|
onMove ({ deltaX: deltaX , deltaY: deltaY , pointerType: pointerType , shiftKey: shiftKey }) {
|
|
660
|
-
let { incrementX: incrementX , decrementX: decrementX , incrementY: incrementY , decrementY: decrementY , xChannelPageStep: xChannelPageStep , xChannelStep: xChannelStep , yChannelPageStep: yChannelPageStep , yChannelStep: yChannelStep , getThumbPosition: getThumbPosition , setColorFromPoint: setColorFromPoint } =
|
|
671
|
+
let { incrementX: incrementX , decrementX: decrementX , incrementY: incrementY , decrementY: decrementY , xChannelPageStep: xChannelPageStep , xChannelStep: xChannelStep , yChannelPageStep: yChannelPageStep , yChannelStep: yChannelStep , getThumbPosition: getThumbPosition , setColorFromPoint: setColorFromPoint } = state;
|
|
661
672
|
if (currentPosition.current == null) currentPosition.current = getThumbPosition();
|
|
662
673
|
let { width: width , height: height } = containerRef.current.getBoundingClientRect();
|
|
663
674
|
let valueChanged = deltaX !== 0 || deltaY !== 0;
|
|
@@ -668,9 +679,10 @@ function $60bd7d6e45dcddfa$export$2f92a7a615a014f6(props, state) {
|
|
|
668
679
|
else if (deltaX < 0 && direction === "ltr" || deltaX > 0 && direction === "rtl") decrementX(deltaXValue);
|
|
669
680
|
else if (deltaY > 0) decrementY(deltaYValue);
|
|
670
681
|
else if (deltaY < 0) incrementY(deltaYValue);
|
|
671
|
-
|
|
682
|
+
setValueChangedViaKeyboard(valueChanged);
|
|
672
683
|
// set the focused input based on which axis has the greater delta
|
|
673
|
-
|
|
684
|
+
focusedInput = valueChanged && Math.abs(deltaY) > Math.abs(deltaX) ? "y" : "x";
|
|
685
|
+
setFocusedInput(focusedInput);
|
|
674
686
|
} else {
|
|
675
687
|
currentPosition.current.x += (direction === "rtl" ? -1 : 1) * deltaX / width;
|
|
676
688
|
currentPosition.current.y += deltaY / height;
|
|
@@ -679,18 +691,15 @@ function $60bd7d6e45dcddfa$export$2f92a7a615a014f6(props, state) {
|
|
|
679
691
|
},
|
|
680
692
|
onMoveEnd () {
|
|
681
693
|
isOnColorArea.current = undefined;
|
|
682
|
-
|
|
683
|
-
|
|
694
|
+
state.setDragging(false);
|
|
695
|
+
let input = focusedInput === "x" ? inputXRef : inputYRef;
|
|
696
|
+
focusInput(input);
|
|
684
697
|
}
|
|
685
698
|
};
|
|
686
699
|
let { moveProps: movePropsThumb } = (0, $7KHxM$useMove)(moveHandler);
|
|
687
|
-
let valueChangedViaKeyboard = (0, $7KHxM$useRef)(false);
|
|
688
700
|
let { focusWithinProps: focusWithinProps } = (0, $7KHxM$useFocusWithin)({
|
|
689
701
|
onFocusWithinChange: (focusWithin)=>{
|
|
690
|
-
if (!focusWithin)
|
|
691
|
-
valueChangedViaKeyboard.current = false;
|
|
692
|
-
focusedInputRef.current;
|
|
693
|
-
}
|
|
702
|
+
if (!focusWithin) setValueChangedViaKeyboard(false);
|
|
694
703
|
}
|
|
695
704
|
});
|
|
696
705
|
let currentPointer = (0, $7KHxM$useRef)(undefined);
|
|
@@ -709,7 +718,7 @@ function $60bd7d6e45dcddfa$export$2f92a7a615a014f6(props, state) {
|
|
|
709
718
|
let onThumbDown = (id)=>{
|
|
710
719
|
if (!state.isDragging) {
|
|
711
720
|
currentPointer.current = id;
|
|
712
|
-
|
|
721
|
+
setValueChangedViaKeyboard(false);
|
|
713
722
|
focusInput();
|
|
714
723
|
state.setDragging(true);
|
|
715
724
|
if (typeof PointerEvent !== "undefined") addGlobalListener(window, "pointerup", onThumbUp, false);
|
|
@@ -724,7 +733,7 @@ function $60bd7d6e45dcddfa$export$2f92a7a615a014f6(props, state) {
|
|
|
724
733
|
var _e_pointerId;
|
|
725
734
|
let id = (_e_pointerId = e.pointerId) !== null && _e_pointerId !== void 0 ? _e_pointerId : (_e_changedTouches = e.changedTouches) === null || _e_changedTouches === void 0 ? void 0 : _e_changedTouches[0].identifier;
|
|
726
735
|
if (id === currentPointer.current) {
|
|
727
|
-
|
|
736
|
+
setValueChangedViaKeyboard(false);
|
|
728
737
|
focusInput();
|
|
729
738
|
state.setDragging(false);
|
|
730
739
|
currentPointer.current = undefined;
|
|
@@ -744,7 +753,7 @@ function $60bd7d6e45dcddfa$export$2f92a7a615a014f6(props, state) {
|
|
|
744
753
|
if (direction === "rtl") x = 1 - x;
|
|
745
754
|
if (x >= 0 && x <= 1 && y >= 0 && y <= 1 && !state.isDragging && currentPointer.current === undefined) {
|
|
746
755
|
isOnColorArea.current = true;
|
|
747
|
-
|
|
756
|
+
setValueChangedViaKeyboard(false);
|
|
748
757
|
currentPointer.current = id;
|
|
749
758
|
state.setColorFromPoint(x, y);
|
|
750
759
|
focusInput();
|
|
@@ -762,7 +771,7 @@ function $60bd7d6e45dcddfa$export$2f92a7a615a014f6(props, state) {
|
|
|
762
771
|
let id = (_e_pointerId = e.pointerId) !== null && _e_pointerId !== void 0 ? _e_pointerId : (_e_changedTouches = e.changedTouches) === null || _e_changedTouches === void 0 ? void 0 : _e_changedTouches[0].identifier;
|
|
763
772
|
if (isOnColorArea.current && id === currentPointer.current) {
|
|
764
773
|
isOnColorArea.current = false;
|
|
765
|
-
|
|
774
|
+
setValueChangedViaKeyboard(false);
|
|
766
775
|
currentPointer.current = undefined;
|
|
767
776
|
state.setDragging(false);
|
|
768
777
|
focusInput();
|
|
@@ -807,17 +816,17 @@ function $60bd7d6e45dcddfa$export$2f92a7a615a014f6(props, state) {
|
|
|
807
816
|
}, focusWithinProps, keyboardProps, movePropsThumb);
|
|
808
817
|
let { focusProps: xInputFocusProps } = (0, $7KHxM$useFocus)({
|
|
809
818
|
onFocus: ()=>{
|
|
810
|
-
|
|
819
|
+
setFocusedInput("x");
|
|
811
820
|
}
|
|
812
821
|
});
|
|
813
822
|
let { focusProps: yInputFocusProps } = (0, $7KHxM$useFocus)({
|
|
814
823
|
onFocus: ()=>{
|
|
815
|
-
|
|
824
|
+
setFocusedInput("y");
|
|
816
825
|
}
|
|
817
826
|
});
|
|
818
827
|
let isMobile = (0, $7KHxM$isIOS)() || (0, $7KHxM$isAndroid)();
|
|
819
828
|
function getAriaValueTextForChannel(channel) {
|
|
820
|
-
return valueChangedViaKeyboard
|
|
829
|
+
return valueChangedViaKeyboard ? stringFormatter.format("colorNameAndValue", {
|
|
821
830
|
name: state.value.getChannelName(channel, locale),
|
|
822
831
|
value: state.value.formatChannelValue(channel, locale)
|
|
823
832
|
}) : [
|
|
@@ -894,12 +903,13 @@ function $60bd7d6e45dcddfa$export$2f92a7a615a014f6(props, state) {
|
|
|
894
903
|
"aria-valuetext": getAriaValueTextForChannel(xChannel),
|
|
895
904
|
disabled: isDisabled,
|
|
896
905
|
value: state.value.getChannelValue(xChannel),
|
|
897
|
-
|
|
906
|
+
name: xName,
|
|
907
|
+
tabIndex: isMobile || !focusedInput || focusedInput === "x" ? undefined : -1,
|
|
898
908
|
/*
|
|
899
909
|
So that only a single "2d slider" control shows up when listing form elements for screen readers,
|
|
900
910
|
add aria-hidden="true" to the unfocused control when the value has not changed via the keyboard,
|
|
901
911
|
but remove aria-hidden to reveal the input for each channel when the value has changed with the keyboard.
|
|
902
|
-
*/ "aria-hidden": isMobile || !
|
|
912
|
+
*/ "aria-hidden": isMobile || !focusedInput || focusedInput === "x" || valueChangedViaKeyboard ? undefined : "true",
|
|
903
913
|
onChange: (e)=>{
|
|
904
914
|
state.setXValue(parseFloat(e.target.value));
|
|
905
915
|
}
|
|
@@ -917,12 +927,13 @@ function $60bd7d6e45dcddfa$export$2f92a7a615a014f6(props, state) {
|
|
|
917
927
|
"aria-orientation": "vertical",
|
|
918
928
|
disabled: isDisabled,
|
|
919
929
|
value: state.value.getChannelValue(yChannel),
|
|
920
|
-
|
|
930
|
+
name: yName,
|
|
931
|
+
tabIndex: isMobile || focusedInput === "y" ? undefined : -1,
|
|
921
932
|
/*
|
|
922
933
|
So that only a single "2d slider" control shows up when listing form elements for screen readers,
|
|
923
934
|
add aria-hidden="true" to the unfocused input when the value has not changed via the keyboard,
|
|
924
935
|
but remove aria-hidden to reveal the input for each channel when the value has changed with the keyboard.
|
|
925
|
-
*/ "aria-hidden": isMobile ||
|
|
936
|
+
*/ "aria-hidden": isMobile || focusedInput === "y" || valueChangedViaKeyboard ? undefined : "true",
|
|
926
937
|
onChange: (e)=>{
|
|
927
938
|
state.setYValue(parseFloat(e.target.value));
|
|
928
939
|
}
|
|
@@ -945,7 +956,7 @@ function $60bd7d6e45dcddfa$export$2f92a7a615a014f6(props, state) {
|
|
|
945
956
|
|
|
946
957
|
|
|
947
958
|
function $40af666d6c251e36$export$106b7a4e66508f66(props, state) {
|
|
948
|
-
let { trackRef: trackRef , inputRef: inputRef , orientation: orientation , channel: channel , "aria-label": ariaLabel } = props;
|
|
959
|
+
let { trackRef: trackRef , inputRef: inputRef , orientation: orientation , channel: channel , "aria-label": ariaLabel , name: name } = props;
|
|
949
960
|
let { locale: locale , direction: direction } = (0, $7KHxM$useLocale)();
|
|
950
961
|
// Provide a default aria-label if there is no other label provided.
|
|
951
962
|
if (!props.label && !ariaLabel && !props["aria-labelledby"]) ariaLabel = state.value.getChannelName(channel, locale);
|
|
@@ -958,6 +969,7 @@ function $40af666d6c251e36$export$106b7a4e66508f66(props, state) {
|
|
|
958
969
|
index: 0,
|
|
959
970
|
orientation: orientation,
|
|
960
971
|
isDisabled: props.isDisabled,
|
|
972
|
+
name: name,
|
|
961
973
|
trackRef: trackRef,
|
|
962
974
|
inputRef: inputRef
|
|
963
975
|
}, state);
|
|
@@ -988,9 +1000,9 @@ function $40af666d6c251e36$export$106b7a4e66508f66(props, state) {
|
|
|
988
1000
|
case "blue":
|
|
989
1001
|
case "alpha":
|
|
990
1002
|
{
|
|
991
|
-
let
|
|
992
|
-
let
|
|
993
|
-
return `linear-gradient(to ${to}, ${
|
|
1003
|
+
let start = value.withChannelValue(channel, state.getThumbMinValue(0)).toString("css");
|
|
1004
|
+
let end = value.withChannelValue(channel, state.getThumbMaxValue(0)).toString("css");
|
|
1005
|
+
return `linear-gradient(to ${to}, ${start}, ${end})`;
|
|
994
1006
|
}
|
|
995
1007
|
default:
|
|
996
1008
|
throw new Error("Unknown color channel: " + channel);
|
|
@@ -1037,7 +1049,7 @@ function $40af666d6c251e36$export$106b7a4e66508f66(props, state) {
|
|
|
1037
1049
|
|
|
1038
1050
|
|
|
1039
1051
|
function $b4a0a4fdc900495e$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
1040
|
-
let { isDisabled: isDisabled , innerRadius: innerRadius , outerRadius: outerRadius , "aria-label": ariaLabel } = props;
|
|
1052
|
+
let { isDisabled: isDisabled , innerRadius: innerRadius , outerRadius: outerRadius , "aria-label": ariaLabel , name: name } = props;
|
|
1041
1053
|
let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = (0, $7KHxM$useGlobalListeners)();
|
|
1042
1054
|
let thumbRadius = (innerRadius + outerRadius) / 2;
|
|
1043
1055
|
let focusInput = (0, $7KHxM$useCallback)(()=>{
|
|
@@ -1045,8 +1057,7 @@ function $b4a0a4fdc900495e$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
1045
1057
|
}, [
|
|
1046
1058
|
inputRef
|
|
1047
1059
|
]);
|
|
1048
|
-
|
|
1049
|
-
stateRef.current = state;
|
|
1060
|
+
(0, $7KHxM$useFormReset)(inputRef, state.hue, state.setHue);
|
|
1050
1061
|
let currentPosition = (0, $7KHxM$useRef)(null);
|
|
1051
1062
|
let { keyboardProps: keyboardProps } = (0, $7KHxM$useKeyboard)({
|
|
1052
1063
|
onKeyDown (e) {
|
|
@@ -1058,18 +1069,18 @@ function $b4a0a4fdc900495e$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
1058
1069
|
// same handling as useMove, don't need to stop propagation, useKeyboard will do that for us
|
|
1059
1070
|
e.preventDefault();
|
|
1060
1071
|
// remember to set this and unset it so that onChangeEnd is fired
|
|
1061
|
-
|
|
1072
|
+
state.setDragging(true);
|
|
1062
1073
|
switch(e.key){
|
|
1063
1074
|
case "PageUp":
|
|
1064
1075
|
e.preventDefault();
|
|
1065
|
-
state.increment(
|
|
1076
|
+
state.increment(state.pageStep);
|
|
1066
1077
|
break;
|
|
1067
1078
|
case "PageDown":
|
|
1068
1079
|
e.preventDefault();
|
|
1069
|
-
state.decrement(
|
|
1080
|
+
state.decrement(state.pageStep);
|
|
1070
1081
|
break;
|
|
1071
1082
|
}
|
|
1072
|
-
|
|
1083
|
+
state.setDragging(false);
|
|
1073
1084
|
}
|
|
1074
1085
|
});
|
|
1075
1086
|
let moveHandler = {
|
|
@@ -1078,13 +1089,13 @@ function $b4a0a4fdc900495e$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
1078
1089
|
state.setDragging(true);
|
|
1079
1090
|
},
|
|
1080
1091
|
onMove ({ deltaX: deltaX , deltaY: deltaY , pointerType: pointerType , shiftKey: shiftKey }) {
|
|
1081
|
-
if (currentPosition.current == null) currentPosition.current =
|
|
1092
|
+
if (currentPosition.current == null) currentPosition.current = state.getThumbPosition(thumbRadius);
|
|
1082
1093
|
currentPosition.current.x += deltaX;
|
|
1083
1094
|
currentPosition.current.y += deltaY;
|
|
1084
1095
|
if (pointerType === "keyboard") {
|
|
1085
|
-
if (deltaX > 0 || deltaY < 0) state.increment(shiftKey ?
|
|
1086
|
-
else if (deltaX < 0 || deltaY > 0) state.decrement(shiftKey ?
|
|
1087
|
-
} else
|
|
1096
|
+
if (deltaX > 0 || deltaY < 0) state.increment(shiftKey ? state.pageStep : state.step);
|
|
1097
|
+
else if (deltaX < 0 || deltaY > 0) state.decrement(shiftKey ? state.pageStep : state.step);
|
|
1098
|
+
} else state.setHueFromPoint(currentPosition.current.x, currentPosition.current.y, thumbRadius);
|
|
1088
1099
|
},
|
|
1089
1100
|
onMoveEnd () {
|
|
1090
1101
|
isOnTrack.current = undefined;
|
|
@@ -1142,7 +1153,7 @@ function $b4a0a4fdc900495e$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
1142
1153
|
if (innerRadius < radius && radius < outerRadius && !state.isDragging && currentPointer.current === undefined) {
|
|
1143
1154
|
isOnTrack.current = true;
|
|
1144
1155
|
currentPointer.current = id;
|
|
1145
|
-
|
|
1156
|
+
state.setHueFromPoint(x, y, radius);
|
|
1146
1157
|
focusInput();
|
|
1147
1158
|
state.setDragging(true);
|
|
1148
1159
|
if (typeof PointerEvent !== "undefined") addGlobalListener(window, "pointerup", onTrackUp, false);
|
|
@@ -1258,6 +1269,7 @@ function $b4a0a4fdc900495e$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
1258
1269
|
"aria-valuetext": state.value.formatChannelValue("hue", locale),
|
|
1259
1270
|
disabled: isDisabled,
|
|
1260
1271
|
value: `${state.value.getChannelValue("hue")}`,
|
|
1272
|
+
name: name,
|
|
1261
1273
|
onChange: (e)=>{
|
|
1262
1274
|
state.setHue(parseFloat(e.target.value));
|
|
1263
1275
|
}
|