@react-aria/color 3.0.0-beta.10 → 3.0.0-beta.13
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/main.js +109 -92
- package/dist/main.js.map +1 -1
- package/dist/module.js +110 -93
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +16 -16
- package/src/useColorArea.ts +76 -44
package/dist/main.js
CHANGED
|
@@ -35,139 +35,139 @@ $parcel$export($47925bd68062ac17$exports, "useColorArea", () => $47925bd68062ac1
|
|
|
35
35
|
|
|
36
36
|
var $4f97b428b4cbcd4e$exports = {};
|
|
37
37
|
var $f141a15c3076a67b$exports = {};
|
|
38
|
-
$f141a15c3076a67b$exports = JSON.parse("{\"
|
|
38
|
+
$f141a15c3076a67b$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"أداة انتقاء اللون\",\"twoDimensionalSlider\":\"مُنزلق 2D\"}");
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
var $435ac2a9fdd2ae5e$exports = {};
|
|
42
|
-
$435ac2a9fdd2ae5e$exports = JSON.parse("{\"
|
|
42
|
+
$435ac2a9fdd2ae5e$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Средство за избиране на цвят\",\"twoDimensionalSlider\":\"2D плъзгач\"}");
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
var $6b29758b432284f5$exports = {};
|
|
46
|
-
$6b29758b432284f5$exports = JSON.parse("{\"
|
|
46
|
+
$6b29758b432284f5$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Výběr barvy\",\"twoDimensionalSlider\":\"2D posuvník\"}");
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
var $357597bcf4afd6fb$exports = {};
|
|
50
|
-
$357597bcf4afd6fb$exports = JSON.parse("{\"
|
|
50
|
+
$357597bcf4afd6fb$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Farvevælger\",\"twoDimensionalSlider\":\"2D-skyder\"}");
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
var $ddc6333960e2b591$exports = {};
|
|
54
|
-
$ddc6333960e2b591$exports = JSON.parse("{\"
|
|
54
|
+
$ddc6333960e2b591$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Farbwähler\",\"twoDimensionalSlider\":\"2D-Schieberegler\"}");
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
var $417ee93d3ca474c0$exports = {};
|
|
58
|
-
$417ee93d3ca474c0$exports = JSON.parse("{\"
|
|
58
|
+
$417ee93d3ca474c0$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Επιλογέας χρωμάτων\",\"twoDimensionalSlider\":\"Ρυθμιστικό 2D\"}");
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
var $519561bc6dcff98b$exports = {};
|
|
62
|
-
$519561bc6dcff98b$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D slider\",\"colorNameAndValue\":\"{name}: {value}\",\"
|
|
62
|
+
$519561bc6dcff98b$exports = JSON.parse("{\"colorPicker\":\"Color picker\",\"twoDimensionalSlider\":\"2D slider\",\"colorNameAndValue\":\"{name}: {value}\",\"colorInputLabel\":\"{label}, {channelLabel}\"}");
|
|
63
63
|
|
|
64
64
|
|
|
65
65
|
var $7a34c3fcc03402b8$exports = {};
|
|
66
|
-
$7a34c3fcc03402b8$exports = JSON.parse("{\"
|
|
66
|
+
$7a34c3fcc03402b8$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Selector de color\",\"twoDimensionalSlider\":\"Regulador 2D\"}");
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
var $860f86d6eae22cba$exports = {};
|
|
70
|
-
$860f86d6eae22cba$exports = JSON.parse("{\"
|
|
70
|
+
$860f86d6eae22cba$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Värvivalija\",\"twoDimensionalSlider\":\"2D-liugur\"}");
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
var $8525d3c77b8a51b0$exports = {};
|
|
74
|
-
$8525d3c77b8a51b0$exports = JSON.parse("{\"
|
|
74
|
+
$8525d3c77b8a51b0$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Värimuokkain\",\"twoDimensionalSlider\":\"2D-liukusäädin\"}");
|
|
75
75
|
|
|
76
76
|
|
|
77
77
|
var $8240fe6825e900ec$exports = {};
|
|
78
|
-
$8240fe6825e900ec$exports = JSON.parse("{\"
|
|
78
|
+
$8240fe6825e900ec$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name} : {value}\",\"colorPicker\":\"Sélecteur de couleurs\",\"twoDimensionalSlider\":\"Curseur 2D\"}");
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
var $377849238307c673$exports = {};
|
|
82
|
-
$377849238307c673$exports = JSON.parse("{\"
|
|
82
|
+
$377849238307c673$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"בוחר הצבעים\",\"twoDimensionalSlider\":\"מחוון דו מימדי\"}");
|
|
83
83
|
|
|
84
84
|
|
|
85
85
|
var $5a6f44e0ec14b083$exports = {};
|
|
86
|
-
$5a6f44e0ec14b083$exports = JSON.parse("{\"
|
|
86
|
+
$5a6f44e0ec14b083$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Odabir boje\",\"twoDimensionalSlider\":\"2D klizač\"}");
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
var $82327d6e71e3e273$exports = {};
|
|
90
|
-
$82327d6e71e3e273$exports = JSON.parse("{\"
|
|
90
|
+
$82327d6e71e3e273$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Színválasztó\",\"twoDimensionalSlider\":\"2D-csúszka\"}");
|
|
91
91
|
|
|
92
92
|
|
|
93
93
|
var $b1e297275c248ab8$exports = {};
|
|
94
|
-
$b1e297275c248ab8$exports = JSON.parse("{\"
|
|
94
|
+
$b1e297275c248ab8$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Selettore colore\",\"twoDimensionalSlider\":\"Cursore 2D\"}");
|
|
95
95
|
|
|
96
96
|
|
|
97
97
|
var $b39c9f2638b4d2b9$exports = {};
|
|
98
|
-
$b39c9f2638b4d2b9$exports = JSON.parse("{\"
|
|
98
|
+
$b39c9f2638b4d2b9$exports = JSON.parse("{\"colorInputLabel\":\"{label}、{channelLabel}\",\"colorNameAndValue\":\"{name} : {value}\",\"colorPicker\":\"カラーピッカー\",\"twoDimensionalSlider\":\"2D スライダー\"}");
|
|
99
99
|
|
|
100
100
|
|
|
101
101
|
var $2d2fbf4195848a62$exports = {};
|
|
102
|
-
$2d2fbf4195848a62$exports = JSON.parse("{\"
|
|
102
|
+
$2d2fbf4195848a62$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"색상 피커\",\"twoDimensionalSlider\":\"2D 슬라이더\"}");
|
|
103
103
|
|
|
104
104
|
|
|
105
105
|
var $ea88350d0828fa2c$exports = {};
|
|
106
|
-
$ea88350d0828fa2c$exports = JSON.parse("{\"
|
|
106
|
+
$ea88350d0828fa2c$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Spalvų parinkiklis\",\"twoDimensionalSlider\":\"2D slankiklis\"}");
|
|
107
107
|
|
|
108
108
|
|
|
109
109
|
var $0e0acd541630120a$exports = {};
|
|
110
|
-
$0e0acd541630120a$exports = JSON.parse("{\"
|
|
110
|
+
$0e0acd541630120a$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Krāsu atlasītājs\",\"twoDimensionalSlider\":\"2D slīdnis\"}");
|
|
111
111
|
|
|
112
112
|
|
|
113
113
|
var $952a458224052046$exports = {};
|
|
114
|
-
$952a458224052046$exports = JSON.parse("{\"
|
|
114
|
+
$952a458224052046$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Fargevelger\",\"twoDimensionalSlider\":\"2D-glidebryter\"}");
|
|
115
115
|
|
|
116
116
|
|
|
117
117
|
var $2d8e195bc5683483$exports = {};
|
|
118
|
-
$2d8e195bc5683483$exports = JSON.parse("{\"
|
|
118
|
+
$2d8e195bc5683483$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Kleurkiezer\",\"twoDimensionalSlider\":\"2D-schuifregelaar\"}");
|
|
119
119
|
|
|
120
120
|
|
|
121
121
|
var $750d83f83c5f38d4$exports = {};
|
|
122
|
-
$750d83f83c5f38d4$exports = JSON.parse("{\"
|
|
122
|
+
$750d83f83c5f38d4$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Próbnik kolorów\",\"twoDimensionalSlider\":\"Suwak 2D\"}");
|
|
123
123
|
|
|
124
124
|
|
|
125
125
|
var $656b2846f611067c$exports = {};
|
|
126
|
-
$656b2846f611067c$exports = JSON.parse("{\"
|
|
126
|
+
$656b2846f611067c$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Seletor de cores\",\"twoDimensionalSlider\":\"Controle deslizante 2D\"}");
|
|
127
127
|
|
|
128
128
|
|
|
129
129
|
var $58ce120874d069dd$exports = {};
|
|
130
|
-
$58ce120874d069dd$exports = JSON.parse("{\"
|
|
130
|
+
$58ce120874d069dd$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Seletor de cores\",\"twoDimensionalSlider\":\"Controle deslizante 2D\"}");
|
|
131
131
|
|
|
132
132
|
|
|
133
133
|
var $fd6c85b4eba18825$exports = {};
|
|
134
|
-
$fd6c85b4eba18825$exports = JSON.parse("{\"
|
|
134
|
+
$fd6c85b4eba18825$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Selector de culori\",\"twoDimensionalSlider\":\"Glisor 2D\"}");
|
|
135
135
|
|
|
136
136
|
|
|
137
137
|
var $8849a15ecc435984$exports = {};
|
|
138
|
-
$8849a15ecc435984$exports = JSON.parse("{\"
|
|
138
|
+
$8849a15ecc435984$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Палитра цветов\",\"twoDimensionalSlider\":\"Ползунок 2D\"}");
|
|
139
139
|
|
|
140
140
|
|
|
141
141
|
var $5192372f064be783$exports = {};
|
|
142
|
-
$5192372f064be783$exports = JSON.parse("{\"
|
|
142
|
+
$5192372f064be783$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Výber farieb\",\"twoDimensionalSlider\":\"2D jazdec\"}");
|
|
143
143
|
|
|
144
144
|
|
|
145
145
|
var $094525f9176df65d$exports = {};
|
|
146
|
-
$094525f9176df65d$exports = JSON.parse("{\"
|
|
146
|
+
$094525f9176df65d$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Izbirnik barv\",\"twoDimensionalSlider\":\"2D drsnik\"}");
|
|
147
147
|
|
|
148
148
|
|
|
149
149
|
var $9795aa59b4ad40ed$exports = {};
|
|
150
|
-
$9795aa59b4ad40ed$exports = JSON.parse("{\"
|
|
150
|
+
$9795aa59b4ad40ed$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Birač boja\",\"twoDimensionalSlider\":\"2D klizač\"}");
|
|
151
151
|
|
|
152
152
|
|
|
153
153
|
var $9ebaa0b485f13e4d$exports = {};
|
|
154
|
-
$9ebaa0b485f13e4d$exports = JSON.parse("{\"
|
|
154
|
+
$9ebaa0b485f13e4d$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Färgväljaren\",\"twoDimensionalSlider\":\"2D-reglage\"}");
|
|
155
155
|
|
|
156
156
|
|
|
157
157
|
var $ad58e2e4e0f2e750$exports = {};
|
|
158
|
-
$ad58e2e4e0f2e750$exports = JSON.parse("{\"
|
|
158
|
+
$ad58e2e4e0f2e750$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Renk Seçici\",\"twoDimensionalSlider\":\"2D sürgü\"}");
|
|
159
159
|
|
|
160
160
|
|
|
161
161
|
var $dafc19306f8b2dfc$exports = {};
|
|
162
|
-
$dafc19306f8b2dfc$exports = JSON.parse("{\"
|
|
162
|
+
$dafc19306f8b2dfc$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Палітра кольорів\",\"twoDimensionalSlider\":\"Повзунок 2D\"}");
|
|
163
163
|
|
|
164
164
|
|
|
165
165
|
var $d31a8b80af5acc16$exports = {};
|
|
166
|
-
$d31a8b80af5acc16$exports = JSON.parse("{\"
|
|
166
|
+
$d31a8b80af5acc16$exports = JSON.parse("{\"colorInputLabel\":\"{label}、{channelLabel}\",\"colorNameAndValue\":\"{name}:{value}\",\"colorPicker\":\"拾色器\",\"twoDimensionalSlider\":\"2D 滑块\"}");
|
|
167
167
|
|
|
168
168
|
|
|
169
169
|
var $7377d28aec5fa200$exports = {};
|
|
170
|
-
$7377d28aec5fa200$exports = JSON.parse("{\"
|
|
170
|
+
$7377d28aec5fa200$exports = JSON.parse("{\"colorInputLabel\":\"{label},{channelLabel}\",\"colorNameAndValue\":\"{name}:{value}\",\"colorPicker\":\"檢色器\",\"twoDimensionalSlider\":\"2D 滑桿\"}");
|
|
171
171
|
|
|
172
172
|
|
|
173
173
|
$4f97b428b4cbcd4e$exports = {
|
|
@@ -425,7 +425,7 @@ function $99936ad0bf67c8c4$export$dd62420467d245ca({ direction: direction , stat
|
|
|
425
425
|
|
|
426
426
|
|
|
427
427
|
function $47925bd68062ac17$export$2f92a7a615a014f6(props, state) {
|
|
428
|
-
let { isDisabled: isDisabled , inputXRef: inputXRef , inputYRef: inputYRef , containerRef: containerRef } = props;
|
|
428
|
+
let { isDisabled: isDisabled , inputXRef: inputXRef , inputYRef: inputYRef , containerRef: containerRef , 'aria-label': ariaLabel } = props;
|
|
429
429
|
let formatMessage = $kZqDi$reactariai18n.useMessageFormatter((/*@__PURE__*/$parcel$interopDefault($4f97b428b4cbcd4e$exports)));
|
|
430
430
|
let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = $kZqDi$reactariautils.useGlobalListeners();
|
|
431
431
|
let { direction: direction , locale: locale } = $kZqDi$reactariai18n.useLocale();
|
|
@@ -452,6 +452,7 @@ function $47925bd68062ac17$export$2f92a7a615a014f6(props, state) {
|
|
|
452
452
|
e.preventDefault();
|
|
453
453
|
// remember to set this and unset it so that onChangeEnd is fired
|
|
454
454
|
stateRef.current.setDragging(true);
|
|
455
|
+
valueChangedViaKeyboard.current = true;
|
|
455
456
|
switch(e.key){
|
|
456
457
|
case 'PageUp':
|
|
457
458
|
stateRef.current.incrementY(stateRef.current.yChannelPageStep);
|
|
@@ -471,10 +472,7 @@ function $47925bd68062ac17$export$2f92a7a615a014f6(props, state) {
|
|
|
471
472
|
break;
|
|
472
473
|
}
|
|
473
474
|
stateRef.current.setDragging(false);
|
|
474
|
-
if (focusedInputRef.current)
|
|
475
|
-
focusInput(focusedInputRef.current ? focusedInputRef : inputXRef);
|
|
476
|
-
focusedInputRef.current = undefined;
|
|
477
|
-
}
|
|
475
|
+
if (focusedInputRef.current) focusInput(focusedInputRef.current ? focusedInputRef : inputXRef);
|
|
478
476
|
}
|
|
479
477
|
});
|
|
480
478
|
let moveHandler = {
|
|
@@ -486,6 +484,7 @@ function $47925bd68062ac17$export$2f92a7a615a014f6(props, state) {
|
|
|
486
484
|
let { incrementX: incrementX , decrementX: decrementX , incrementY: incrementY , decrementY: decrementY , xChannelPageStep: xChannelPageStep , xChannelStep: xChannelStep , yChannelPageStep: yChannelPageStep , yChannelStep: yChannelStep , getThumbPosition: getThumbPosition , setColorFromPoint: setColorFromPoint } = stateRef.current;
|
|
487
485
|
if (currentPosition.current == null) currentPosition.current = getThumbPosition();
|
|
488
486
|
let { width: width , height: height } = containerRef.current.getBoundingClientRect();
|
|
487
|
+
let valueChanged = deltaX !== 0 || deltaY !== 0;
|
|
489
488
|
if (pointerType === 'keyboard') {
|
|
490
489
|
let deltaXValue = shiftKey && xChannelPageStep > xChannelStep ? xChannelPageStep : xChannelStep;
|
|
491
490
|
let deltaYValue = shiftKey && yChannelPageStep > yChannelStep ? yChannelPageStep : yChannelStep;
|
|
@@ -493,8 +492,9 @@ function $47925bd68062ac17$export$2f92a7a615a014f6(props, state) {
|
|
|
493
492
|
else if (deltaX < 0 && direction === 'ltr' || deltaX > 0 && direction === 'rtl') decrementX(deltaXValue);
|
|
494
493
|
else if (deltaY > 0) decrementY(deltaYValue);
|
|
495
494
|
else if (deltaY < 0) incrementY(deltaYValue);
|
|
495
|
+
valueChangedViaKeyboard.current = valueChanged;
|
|
496
496
|
// set the focused input based on which axis has the greater delta
|
|
497
|
-
focusedInputRef.current =
|
|
497
|
+
focusedInputRef.current = valueChanged && Math.abs(deltaY) > Math.abs(deltaX) ? inputYRef.current : inputXRef.current;
|
|
498
498
|
} else {
|
|
499
499
|
currentPosition.current.x += (direction === 'rtl' ? -1 : 1) * deltaX / width;
|
|
500
500
|
currentPosition.current.y += deltaY / height;
|
|
@@ -505,10 +505,18 @@ function $47925bd68062ac17$export$2f92a7a615a014f6(props, state) {
|
|
|
505
505
|
isOnColorArea.current = undefined;
|
|
506
506
|
stateRef.current.setDragging(false);
|
|
507
507
|
focusInput(focusedInputRef.current ? focusedInputRef : inputXRef);
|
|
508
|
-
focusedInputRef.current = undefined;
|
|
509
508
|
}
|
|
510
509
|
};
|
|
511
510
|
let { moveProps: movePropsThumb } = $kZqDi$reactariainteractions.useMove(moveHandler);
|
|
511
|
+
let valueChangedViaKeyboard = $kZqDi$react.useRef(false);
|
|
512
|
+
let { focusWithinProps: focusWithinProps } = $kZqDi$reactariainteractions.useFocusWithin({
|
|
513
|
+
onFocusWithinChange: (focusWithin)=>{
|
|
514
|
+
if (!focusWithin) {
|
|
515
|
+
valueChangedViaKeyboard.current = false;
|
|
516
|
+
focusedInputRef.current;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
});
|
|
512
520
|
let currentPointer = $kZqDi$react.useRef(undefined);
|
|
513
521
|
let isOnColorArea = $kZqDi$react.useRef(false);
|
|
514
522
|
let { moveProps: movePropsContainer } = $kZqDi$reactariainteractions.useMove({
|
|
@@ -525,6 +533,7 @@ function $47925bd68062ac17$export$2f92a7a615a014f6(props, state) {
|
|
|
525
533
|
let onThumbDown = (id)=>{
|
|
526
534
|
if (!state.isDragging) {
|
|
527
535
|
currentPointer.current = id;
|
|
536
|
+
valueChangedViaKeyboard.current = false;
|
|
528
537
|
focusInput();
|
|
529
538
|
state.setDragging(true);
|
|
530
539
|
if (typeof PointerEvent !== 'undefined') addGlobalListener(window, 'pointerup', onThumbUp, false);
|
|
@@ -539,6 +548,7 @@ function $47925bd68062ac17$export$2f92a7a615a014f6(props, state) {
|
|
|
539
548
|
var _pointerId;
|
|
540
549
|
let id = (_pointerId = e.pointerId) !== null && _pointerId !== void 0 ? _pointerId : (ref = e.changedTouches) === null || ref === void 0 ? void 0 : ref[0].identifier;
|
|
541
550
|
if (id === currentPointer.current) {
|
|
551
|
+
valueChangedViaKeyboard.current = false;
|
|
542
552
|
focusInput();
|
|
543
553
|
state.setDragging(false);
|
|
544
554
|
currentPointer.current = undefined;
|
|
@@ -558,6 +568,7 @@ function $47925bd68062ac17$export$2f92a7a615a014f6(props, state) {
|
|
|
558
568
|
if (direction === 'rtl') x = 1 - x;
|
|
559
569
|
if (x >= 0 && x <= 1 && y >= 0 && y <= 1 && !state.isDragging && currentPointer.current === undefined) {
|
|
560
570
|
isOnColorArea.current = true;
|
|
571
|
+
valueChangedViaKeyboard.current = false;
|
|
561
572
|
currentPointer.current = id;
|
|
562
573
|
state.setColorFromPoint(x, y);
|
|
563
574
|
focusInput();
|
|
@@ -575,6 +586,7 @@ function $47925bd68062ac17$export$2f92a7a615a014f6(props, state) {
|
|
|
575
586
|
let id = (_pointerId = e.pointerId) !== null && _pointerId !== void 0 ? _pointerId : (ref = e.changedTouches) === null || ref === void 0 ? void 0 : ref[0].identifier;
|
|
576
587
|
if (isOnColorArea.current && id === currentPointer.current) {
|
|
577
588
|
isOnColorArea.current = false;
|
|
589
|
+
valueChangedViaKeyboard.current = false;
|
|
578
590
|
currentPointer.current = undefined;
|
|
579
591
|
state.setDragging(false);
|
|
580
592
|
focusInput();
|
|
@@ -618,34 +630,53 @@ function $47925bd68062ac17$export$2f92a7a615a014f6(props, state) {
|
|
|
618
630
|
onThumbDown(e.changedTouches[0].identifier);
|
|
619
631
|
}
|
|
620
632
|
}
|
|
621
|
-
}, keyboardProps, movePropsThumb);
|
|
633
|
+
}, focusWithinProps, keyboardProps, movePropsThumb);
|
|
634
|
+
let { focusProps: xInputFocusProps } = $kZqDi$reactariainteractions.useFocus({
|
|
635
|
+
onFocus: ()=>{
|
|
636
|
+
focusedInputRef.current = inputXRef.current;
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
let { focusProps: yInputFocusProps } = $kZqDi$reactariainteractions.useFocus({
|
|
640
|
+
onFocus: ()=>{
|
|
641
|
+
focusedInputRef.current = inputYRef.current;
|
|
642
|
+
}
|
|
643
|
+
});
|
|
622
644
|
let isMobile = $kZqDi$reactariautils.isIOS() || $kZqDi$reactariautils.isAndroid();
|
|
645
|
+
function getAriaValueTextForChannel(channel) {
|
|
646
|
+
return valueChangedViaKeyboard.current ? formatMessage('colorNameAndValue', {
|
|
647
|
+
name: state.value.getChannelName(channel, locale),
|
|
648
|
+
value: state.value.formatChannelValue(channel, locale)
|
|
649
|
+
}) : [
|
|
650
|
+
formatMessage('colorNameAndValue', {
|
|
651
|
+
name: state.value.getChannelName(channel, locale),
|
|
652
|
+
value: state.value.formatChannelValue(channel, locale)
|
|
653
|
+
}),
|
|
654
|
+
formatMessage('colorNameAndValue', {
|
|
655
|
+
name: state.value.getChannelName(channel === yChannel ? xChannel : yChannel, locale),
|
|
656
|
+
value: state.value.formatChannelValue(channel === yChannel ? xChannel : yChannel, locale)
|
|
657
|
+
})
|
|
658
|
+
].join(', ');
|
|
659
|
+
}
|
|
660
|
+
let colorPickerLabel = formatMessage('colorPicker');
|
|
623
661
|
let xInputLabellingProps = $kZqDi$reactariautils.useLabels({
|
|
624
662
|
...props,
|
|
625
|
-
'aria-label':
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
})
|
|
663
|
+
'aria-label': ariaLabel ? formatMessage('colorInputLabel', {
|
|
664
|
+
label: ariaLabel,
|
|
665
|
+
channelLabel: colorPickerLabel
|
|
666
|
+
}) : colorPickerLabel
|
|
629
667
|
});
|
|
630
668
|
let yInputLabellingProps = $kZqDi$reactariautils.useLabels({
|
|
631
669
|
...props,
|
|
632
|
-
'aria-label':
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
})
|
|
670
|
+
'aria-label': ariaLabel ? formatMessage('colorInputLabel', {
|
|
671
|
+
label: ariaLabel,
|
|
672
|
+
channelLabel: colorPickerLabel
|
|
673
|
+
}) : colorPickerLabel
|
|
636
674
|
});
|
|
637
|
-
let colorAriaLabellingProps = $kZqDi$reactariautils.useLabels(
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
name: state.value.getChannelName(channel, locale),
|
|
643
|
-
value: state.value.formatChannelValue(channel, locale)
|
|
644
|
-
}))
|
|
645
|
-
);
|
|
646
|
-
return colorNamesAndValues.length ? colorNamesAndValues.join(', ') : null;
|
|
647
|
-
};
|
|
648
|
-
let ariaRoleDescription = isMobile ? null : formatMessage('twoDimensionalSlider');
|
|
675
|
+
let colorAriaLabellingProps = $kZqDi$reactariautils.useLabels({
|
|
676
|
+
...props,
|
|
677
|
+
'aria-label': ariaLabel ? `${ariaLabel} ${colorPickerLabel}` : undefined
|
|
678
|
+
}, isMobile ? colorPickerLabel : undefined);
|
|
679
|
+
let ariaRoleDescription = formatMessage('twoDimensionalSlider');
|
|
649
680
|
let { visuallyHiddenProps: visuallyHiddenProps } = $kZqDi$reactariavisuallyhidden.useVisuallyHidden({
|
|
650
681
|
style: {
|
|
651
682
|
opacity: '0.0001',
|
|
@@ -680,28 +711,21 @@ function $47925bd68062ac17$export$2f92a7a615a014f6(props, state) {
|
|
|
680
711
|
xInputProps: {
|
|
681
712
|
...xInputLabellingProps,
|
|
682
713
|
...visuallyHiddenProps,
|
|
714
|
+
...xInputFocusProps,
|
|
683
715
|
type: 'range',
|
|
684
716
|
min: state.value.getChannelRange(xChannel).minValue,
|
|
685
717
|
max: state.value.getChannelRange(xChannel).maxValue,
|
|
686
718
|
step: xChannelStep1,
|
|
687
719
|
'aria-roledescription': ariaRoleDescription,
|
|
688
|
-
'aria-valuetext':
|
|
689
|
-
name: state.value.getChannelName(xChannel, locale),
|
|
690
|
-
value: state.value.formatChannelValue(xChannel, locale)
|
|
691
|
-
}) : [
|
|
692
|
-
formatMessage('colorNameAndValue', {
|
|
693
|
-
name: state.value.getChannelName(xChannel, locale),
|
|
694
|
-
value: state.value.formatChannelValue(xChannel, locale)
|
|
695
|
-
}),
|
|
696
|
-
formatMessage('colorNameAndValue', {
|
|
697
|
-
name: state.value.getChannelName(yChannel, locale),
|
|
698
|
-
value: state.value.formatChannelValue(yChannel, locale)
|
|
699
|
-
})
|
|
700
|
-
].join(', '),
|
|
701
|
-
title: getValueTitle(),
|
|
720
|
+
'aria-valuetext': getAriaValueTextForChannel(xChannel),
|
|
702
721
|
disabled: isDisabled,
|
|
703
722
|
value: state.value.getChannelValue(xChannel),
|
|
704
|
-
tabIndex:
|
|
723
|
+
tabIndex: isMobile || !focusedInputRef.current || focusedInputRef.current === inputXRef.current ? undefined : -1,
|
|
724
|
+
/*
|
|
725
|
+
So that only a single "2d slider" control shows up when listing form elements for screen readers,
|
|
726
|
+
add aria-hidden="true" to the unfocused control when the value has not changed via the keyboard,
|
|
727
|
+
but remove aria-hidden to reveal the input for each channel when the value has changed with the keyboard.
|
|
728
|
+
*/ 'aria-hidden': !isMobile && focusedInputRef.current === inputYRef.current && !valueChangedViaKeyboard.current ? 'true' : undefined,
|
|
705
729
|
onChange: (e)=>{
|
|
706
730
|
state.setXValue(parseFloat(e.target.value));
|
|
707
731
|
}
|
|
@@ -709,29 +733,22 @@ function $47925bd68062ac17$export$2f92a7a615a014f6(props, state) {
|
|
|
709
733
|
yInputProps: {
|
|
710
734
|
...yInputLabellingProps,
|
|
711
735
|
...visuallyHiddenProps,
|
|
736
|
+
...yInputFocusProps,
|
|
712
737
|
type: 'range',
|
|
713
738
|
min: state.value.getChannelRange(yChannel).minValue,
|
|
714
739
|
max: state.value.getChannelRange(yChannel).maxValue,
|
|
715
740
|
step: yChannelStep1,
|
|
716
741
|
'aria-roledescription': ariaRoleDescription,
|
|
717
|
-
'aria-valuetext':
|
|
718
|
-
name: state.value.getChannelName(yChannel, locale),
|
|
719
|
-
value: state.value.formatChannelValue(yChannel, locale)
|
|
720
|
-
}) : [
|
|
721
|
-
formatMessage('colorNameAndValue', {
|
|
722
|
-
name: state.value.getChannelName(yChannel, locale),
|
|
723
|
-
value: state.value.formatChannelValue(yChannel, locale)
|
|
724
|
-
}),
|
|
725
|
-
formatMessage('colorNameAndValue', {
|
|
726
|
-
name: state.value.getChannelName(xChannel, locale),
|
|
727
|
-
value: state.value.formatChannelValue(xChannel, locale)
|
|
728
|
-
})
|
|
729
|
-
].join(', '),
|
|
742
|
+
'aria-valuetext': getAriaValueTextForChannel(yChannel),
|
|
730
743
|
'aria-orientation': 'vertical',
|
|
731
|
-
title: getValueTitle(),
|
|
732
744
|
disabled: isDisabled,
|
|
733
745
|
value: state.value.getChannelValue(yChannel),
|
|
734
|
-
tabIndex: -1,
|
|
746
|
+
tabIndex: isMobile || focusedInputRef.current === inputYRef.current ? undefined : -1,
|
|
747
|
+
/*
|
|
748
|
+
So that only a single "2d slider" control shows up when listing form elements for screen readers,
|
|
749
|
+
add aria-hidden="true" to the unfocused input when the value has not changed via the keyboard,
|
|
750
|
+
but remove aria-hidden to reveal the input for each channel when the value has changed with the keyboard.
|
|
751
|
+
*/ 'aria-hidden': isMobile || focusedInputRef.current === inputYRef.current || valueChangedViaKeyboard.current ? undefined : 'true',
|
|
735
752
|
onChange: (e)=>{
|
|
736
753
|
state.setYValue(parseFloat(e.target.value));
|
|
737
754
|
}
|