@react-aria/color 3.0.0-beta.8 → 3.0.0-beta.9
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 +578 -71
- package/dist/main.js.map +1 -1
- package/dist/module.js +575 -69
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +28 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +14 -12
- package/src/index.ts +1 -0
- package/src/useColorArea.ts +393 -0
- package/src/useColorField.ts +1 -1
- package/src/useColorWheel.ts +33 -24
package/dist/main.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $
|
|
3
|
-
var $
|
|
4
|
-
var $
|
|
5
|
-
var $
|
|
6
|
-
var $
|
|
7
|
-
var $
|
|
1
|
+
var $kZqDi$reactariautils = require("@react-aria/utils");
|
|
2
|
+
var $kZqDi$react = require("react");
|
|
3
|
+
var $kZqDi$reactariainteractions = require("@react-aria/interactions");
|
|
4
|
+
var $kZqDi$reactariai18n = require("@react-aria/i18n");
|
|
5
|
+
var $kZqDi$reactariavisuallyhidden = require("@react-aria/visually-hidden");
|
|
6
|
+
var $kZqDi$reactariaslider = require("@react-aria/slider");
|
|
7
|
+
var $kZqDi$reactariatextfield = require("@react-aria/textfield");
|
|
8
|
+
var $kZqDi$reactariaspinbutton = require("@react-aria/spinbutton");
|
|
8
9
|
|
|
9
10
|
function $parcel$exportWildcard(dest, source) {
|
|
10
11
|
Object.keys(source).forEach(function(key) {
|
|
@@ -22,26 +23,523 @@ function $parcel$exportWildcard(dest, source) {
|
|
|
22
23
|
|
|
23
24
|
return dest;
|
|
24
25
|
}
|
|
26
|
+
function $parcel$interopDefault(a) {
|
|
27
|
+
return a && a.__esModule ? a.default : a;
|
|
28
|
+
}
|
|
25
29
|
function $parcel$export(e, n, v, s) {
|
|
26
30
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
27
31
|
}
|
|
28
|
-
var $
|
|
32
|
+
var $47925bd68062ac17$exports = {};
|
|
33
|
+
|
|
34
|
+
$parcel$export($47925bd68062ac17$exports, "useColorArea", () => $47925bd68062ac17$export$2f92a7a615a014f6);
|
|
35
|
+
|
|
36
|
+
var $4f97b428b4cbcd4e$exports = {};
|
|
37
|
+
var $f141a15c3076a67b$exports = {};
|
|
38
|
+
$f141a15c3076a67b$exports = JSON.parse("{\"twoDimensionalSlider\":\"شريط تمرير ثنائي الأبعاد\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
var $435ac2a9fdd2ae5e$exports = {};
|
|
42
|
+
$435ac2a9fdd2ae5e$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D плъзгач\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
var $6b29758b432284f5$exports = {};
|
|
46
|
+
$6b29758b432284f5$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D posuvník\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
var $357597bcf4afd6fb$exports = {};
|
|
50
|
+
$357597bcf4afd6fb$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D-skyder\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
var $ddc6333960e2b591$exports = {};
|
|
54
|
+
$ddc6333960e2b591$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D-Schieberegler\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
var $417ee93d3ca474c0$exports = {};
|
|
58
|
+
$417ee93d3ca474c0$exports = JSON.parse("{\"twoDimensionalSlider\":\"Ρυθμιστικό 2D\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
var $519561bc6dcff98b$exports = {};
|
|
62
|
+
$519561bc6dcff98b$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D slider\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
var $7a34c3fcc03402b8$exports = {};
|
|
66
|
+
$7a34c3fcc03402b8$exports = JSON.parse("{\"twoDimensionalSlider\":\"Control deslizante en 2D\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
var $860f86d6eae22cba$exports = {};
|
|
70
|
+
$860f86d6eae22cba$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D-liugur\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
var $8525d3c77b8a51b0$exports = {};
|
|
74
|
+
$8525d3c77b8a51b0$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D-liukusäädin\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
var $8240fe6825e900ec$exports = {};
|
|
78
|
+
$8240fe6825e900ec$exports = JSON.parse("{\"twoDimensionalSlider\":\"Curseur 2D\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
var $377849238307c673$exports = {};
|
|
82
|
+
$377849238307c673$exports = JSON.parse("{\"twoDimensionalSlider\":\"מחוון דו-ממדי\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
var $5a6f44e0ec14b083$exports = {};
|
|
86
|
+
$5a6f44e0ec14b083$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D kliznik\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
var $82327d6e71e3e273$exports = {};
|
|
90
|
+
$82327d6e71e3e273$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D csúszka\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
var $b1e297275c248ab8$exports = {};
|
|
94
|
+
$b1e297275c248ab8$exports = JSON.parse("{\"twoDimensionalSlider\":\"Dispositivo di scorrimento 2D\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
var $b39c9f2638b4d2b9$exports = {};
|
|
98
|
+
$b39c9f2638b4d2b9$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D スライダー\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
var $2d2fbf4195848a62$exports = {};
|
|
102
|
+
$2d2fbf4195848a62$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D 슬라이더\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
var $ea88350d0828fa2c$exports = {};
|
|
106
|
+
$ea88350d0828fa2c$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D slankiklis\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
var $0e0acd541630120a$exports = {};
|
|
110
|
+
$0e0acd541630120a$exports = JSON.parse("{\"twoDimensionalSlider\":\"Plaknes slīdnis\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
var $952a458224052046$exports = {};
|
|
114
|
+
$952a458224052046$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D-glidebryter\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
var $2d8e195bc5683483$exports = {};
|
|
118
|
+
$2d8e195bc5683483$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D-schuifregelaar\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
var $750d83f83c5f38d4$exports = {};
|
|
122
|
+
$750d83f83c5f38d4$exports = JSON.parse("{\"twoDimensionalSlider\":\"Suwak 2D\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
var $656b2846f611067c$exports = {};
|
|
126
|
+
$656b2846f611067c$exports = JSON.parse("{\"twoDimensionalSlider\":\"Controle deslizante 2D\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
var $58ce120874d069dd$exports = {};
|
|
130
|
+
$58ce120874d069dd$exports = JSON.parse("{\"twoDimensionalSlider\":\"Controlo de deslize 2D\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
var $fd6c85b4eba18825$exports = {};
|
|
134
|
+
$fd6c85b4eba18825$exports = JSON.parse("{\"twoDimensionalSlider\":\"Cursor 2D\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
var $8849a15ecc435984$exports = {};
|
|
138
|
+
$8849a15ecc435984$exports = JSON.parse("{\"twoDimensionalSlider\":\"Двумерный ползунок\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
var $5192372f064be783$exports = {};
|
|
142
|
+
$5192372f064be783$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D jazdec\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
var $094525f9176df65d$exports = {};
|
|
146
|
+
$094525f9176df65d$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D-drsnik\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
147
|
+
|
|
29
148
|
|
|
30
|
-
$
|
|
149
|
+
var $9795aa59b4ad40ed$exports = {};
|
|
150
|
+
$9795aa59b4ad40ed$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D клизач\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
31
151
|
|
|
32
152
|
|
|
153
|
+
var $9ebaa0b485f13e4d$exports = {};
|
|
154
|
+
$9ebaa0b485f13e4d$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D-reglage\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
33
155
|
|
|
34
|
-
|
|
156
|
+
|
|
157
|
+
var $ad58e2e4e0f2e750$exports = {};
|
|
158
|
+
$ad58e2e4e0f2e750$exports = JSON.parse("{\"twoDimensionalSlider\":\"2B slayt gösterisi\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
var $dafc19306f8b2dfc$exports = {};
|
|
162
|
+
$dafc19306f8b2dfc$exports = JSON.parse("{\"twoDimensionalSlider\":\"Повзунок 2D\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
var $d31a8b80af5acc16$exports = {};
|
|
166
|
+
$d31a8b80af5acc16$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D 滑块\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
var $7377d28aec5fa200$exports = {};
|
|
170
|
+
$7377d28aec5fa200$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D 滑桿\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
$4f97b428b4cbcd4e$exports = {
|
|
174
|
+
"ar-AE": $f141a15c3076a67b$exports,
|
|
175
|
+
"bg-BG": $435ac2a9fdd2ae5e$exports,
|
|
176
|
+
"cs-CZ": $6b29758b432284f5$exports,
|
|
177
|
+
"da-DK": $357597bcf4afd6fb$exports,
|
|
178
|
+
"de-DE": $ddc6333960e2b591$exports,
|
|
179
|
+
"el-GR": $417ee93d3ca474c0$exports,
|
|
180
|
+
"en-US": $519561bc6dcff98b$exports,
|
|
181
|
+
"es-ES": $7a34c3fcc03402b8$exports,
|
|
182
|
+
"et-EE": $860f86d6eae22cba$exports,
|
|
183
|
+
"fi-FI": $8525d3c77b8a51b0$exports,
|
|
184
|
+
"fr-FR": $8240fe6825e900ec$exports,
|
|
185
|
+
"he-IL": $377849238307c673$exports,
|
|
186
|
+
"hr-HR": $5a6f44e0ec14b083$exports,
|
|
187
|
+
"hu-HU": $82327d6e71e3e273$exports,
|
|
188
|
+
"it-IT": $b1e297275c248ab8$exports,
|
|
189
|
+
"ja-JP": $b39c9f2638b4d2b9$exports,
|
|
190
|
+
"ko-KR": $2d2fbf4195848a62$exports,
|
|
191
|
+
"lt-LT": $ea88350d0828fa2c$exports,
|
|
192
|
+
"lv-LV": $0e0acd541630120a$exports,
|
|
193
|
+
"nb-NO": $952a458224052046$exports,
|
|
194
|
+
"nl-NL": $2d8e195bc5683483$exports,
|
|
195
|
+
"pl-PL": $750d83f83c5f38d4$exports,
|
|
196
|
+
"pt-BR": $656b2846f611067c$exports,
|
|
197
|
+
"pt-PT": $58ce120874d069dd$exports,
|
|
198
|
+
"ro-RO": $fd6c85b4eba18825$exports,
|
|
199
|
+
"ru-RU": $8849a15ecc435984$exports,
|
|
200
|
+
"sk-SK": $5192372f064be783$exports,
|
|
201
|
+
"sl-SI": $094525f9176df65d$exports,
|
|
202
|
+
"sr-SP": $9795aa59b4ad40ed$exports,
|
|
203
|
+
"sv-SE": $9ebaa0b485f13e4d$exports,
|
|
204
|
+
"tr-TR": $ad58e2e4e0f2e750$exports,
|
|
205
|
+
"uk-UA": $dafc19306f8b2dfc$exports,
|
|
206
|
+
"zh-CN": $d31a8b80af5acc16$exports,
|
|
207
|
+
"zh-TW": $7377d28aec5fa200$exports
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
function $47925bd68062ac17$export$2f92a7a615a014f6(props, state) {
|
|
216
|
+
let { isDisabled: isDisabled , inputXRef: inputXRef , inputYRef: inputYRef , containerRef: containerRef } = props;
|
|
217
|
+
let formatMessage = $kZqDi$reactariai18n.useMessageFormatter((/*@__PURE__*/$parcel$interopDefault($4f97b428b4cbcd4e$exports)));
|
|
218
|
+
let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = $kZqDi$reactariautils.useGlobalListeners();
|
|
219
|
+
let { direction: direction , locale: locale } = $kZqDi$reactariai18n.useLocale();
|
|
220
|
+
let focusedInputRef = $kZqDi$react.useRef(null);
|
|
221
|
+
let focusInput = $kZqDi$react.useCallback((inputRef = inputXRef)=>{
|
|
222
|
+
if (inputRef.current) $kZqDi$reactariautils.focusWithoutScrolling(inputRef.current);
|
|
223
|
+
}, [
|
|
224
|
+
inputXRef
|
|
225
|
+
]);
|
|
226
|
+
let stateRef = $kZqDi$react.useRef(null);
|
|
227
|
+
stateRef.current = state;
|
|
228
|
+
let { xChannel: xChannel , yChannel: yChannel } = stateRef.current.channels;
|
|
229
|
+
let xChannelStep1 = stateRef.current.xChannelStep;
|
|
230
|
+
let yChannelStep1 = stateRef.current.xChannelStep;
|
|
231
|
+
let currentPosition = $kZqDi$react.useRef(null);
|
|
232
|
+
let { keyboardProps: keyboardProps } = $kZqDi$reactariainteractions.useKeyboard({
|
|
233
|
+
onKeyDown (e) {
|
|
234
|
+
// these are the cases that useMove doesn't handle
|
|
235
|
+
if (!/^(PageUp|PageDown|Home|End)$/.test(e.key)) {
|
|
236
|
+
e.continuePropagation();
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
// same handling as useMove, don't need to stop propagation, useKeyboard will do that for us
|
|
240
|
+
e.preventDefault();
|
|
241
|
+
// remember to set this and unset it so that onChangeEnd is fired
|
|
242
|
+
stateRef.current.setDragging(true);
|
|
243
|
+
switch(e.key){
|
|
244
|
+
case 'PageUp':
|
|
245
|
+
stateRef.current.incrementY(stateRef.current.yChannelPageStep);
|
|
246
|
+
focusedInputRef.current = inputYRef.current;
|
|
247
|
+
break;
|
|
248
|
+
case 'PageDown':
|
|
249
|
+
stateRef.current.decrementY(stateRef.current.yChannelPageStep);
|
|
250
|
+
focusedInputRef.current = inputYRef.current;
|
|
251
|
+
break;
|
|
252
|
+
case 'Home':
|
|
253
|
+
direction === 'rtl' ? stateRef.current.incrementX(stateRef.current.xChannelPageStep) : stateRef.current.decrementX(stateRef.current.xChannelPageStep);
|
|
254
|
+
focusedInputRef.current = inputXRef.current;
|
|
255
|
+
break;
|
|
256
|
+
case 'End':
|
|
257
|
+
direction === 'rtl' ? stateRef.current.decrementX(stateRef.current.xChannelPageStep) : stateRef.current.incrementX(stateRef.current.xChannelPageStep);
|
|
258
|
+
focusedInputRef.current = inputXRef.current;
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
stateRef.current.setDragging(false);
|
|
262
|
+
if (focusedInputRef.current) {
|
|
263
|
+
focusInput(focusedInputRef.current ? focusedInputRef : inputXRef);
|
|
264
|
+
focusedInputRef.current = undefined;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
let moveHandler = {
|
|
269
|
+
onMoveStart () {
|
|
270
|
+
currentPosition.current = null;
|
|
271
|
+
stateRef.current.setDragging(true);
|
|
272
|
+
},
|
|
273
|
+
onMove ({ deltaX: deltaX , deltaY: deltaY , pointerType: pointerType , shiftKey: shiftKey }) {
|
|
274
|
+
let { incrementX: incrementX , decrementX: decrementX , incrementY: incrementY , decrementY: decrementY , xChannelPageStep: xChannelPageStep , xChannelStep: xChannelStep , yChannelPageStep: yChannelPageStep , yChannelStep: yChannelStep , getThumbPosition: getThumbPosition , setColorFromPoint: setColorFromPoint } = stateRef.current;
|
|
275
|
+
if (currentPosition.current == null) currentPosition.current = getThumbPosition();
|
|
276
|
+
let { width: width , height: height } = containerRef.current.getBoundingClientRect();
|
|
277
|
+
if (pointerType === 'keyboard') {
|
|
278
|
+
let deltaXValue = shiftKey && xChannelPageStep > xChannelStep ? xChannelPageStep : xChannelStep;
|
|
279
|
+
let deltaYValue = shiftKey && yChannelPageStep > yChannelStep ? yChannelPageStep : yChannelStep;
|
|
280
|
+
if (deltaX > 0 && direction === 'ltr' || deltaX < 0 && direction === 'rtl') incrementX(deltaXValue);
|
|
281
|
+
else if (deltaX < 0 && direction === 'ltr' || deltaX > 0 && direction === 'rtl') decrementX(deltaXValue);
|
|
282
|
+
else if (deltaY > 0) decrementY(deltaYValue);
|
|
283
|
+
else if (deltaY < 0) incrementY(deltaYValue);
|
|
284
|
+
// set the focused input based on which axis has the greater delta
|
|
285
|
+
focusedInputRef.current = (deltaX !== 0 || deltaY !== 0) && Math.abs(deltaY) > Math.abs(deltaX) ? inputYRef.current : inputXRef.current;
|
|
286
|
+
} else {
|
|
287
|
+
currentPosition.current.x += (direction === 'rtl' ? -1 : 1) * deltaX / width;
|
|
288
|
+
currentPosition.current.y += deltaY / height;
|
|
289
|
+
setColorFromPoint(currentPosition.current.x, currentPosition.current.y);
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
onMoveEnd () {
|
|
293
|
+
isOnColorArea.current = undefined;
|
|
294
|
+
stateRef.current.setDragging(false);
|
|
295
|
+
focusInput(focusedInputRef.current ? focusedInputRef : inputXRef);
|
|
296
|
+
focusedInputRef.current = undefined;
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
let { moveProps: movePropsThumb } = $kZqDi$reactariainteractions.useMove(moveHandler);
|
|
300
|
+
let currentPointer = $kZqDi$react.useRef(undefined);
|
|
301
|
+
let isOnColorArea = $kZqDi$react.useRef(false);
|
|
302
|
+
let { moveProps: movePropsContainer } = $kZqDi$reactariainteractions.useMove({
|
|
303
|
+
onMoveStart () {
|
|
304
|
+
if (isOnColorArea.current) moveHandler.onMoveStart();
|
|
305
|
+
},
|
|
306
|
+
onMove (e) {
|
|
307
|
+
if (isOnColorArea.current) moveHandler.onMove(e);
|
|
308
|
+
},
|
|
309
|
+
onMoveEnd () {
|
|
310
|
+
if (isOnColorArea.current) moveHandler.onMoveEnd();
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
let onThumbDown = (id)=>{
|
|
314
|
+
if (!state.isDragging) {
|
|
315
|
+
currentPointer.current = id;
|
|
316
|
+
focusInput();
|
|
317
|
+
state.setDragging(true);
|
|
318
|
+
if (typeof PointerEvent !== 'undefined') addGlobalListener(window, 'pointerup', onThumbUp, false);
|
|
319
|
+
else {
|
|
320
|
+
addGlobalListener(window, 'mouseup', onThumbUp, false);
|
|
321
|
+
addGlobalListener(window, 'touchend', onThumbUp, false);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
let onThumbUp = (e)=>{
|
|
326
|
+
var ref;
|
|
327
|
+
var _pointerId;
|
|
328
|
+
let id = (_pointerId = e.pointerId) !== null && _pointerId !== void 0 ? _pointerId : (ref = e.changedTouches) === null || ref === void 0 ? void 0 : ref[0].identifier;
|
|
329
|
+
if (id === currentPointer.current) {
|
|
330
|
+
focusInput();
|
|
331
|
+
state.setDragging(false);
|
|
332
|
+
currentPointer.current = undefined;
|
|
333
|
+
isOnColorArea.current = false;
|
|
334
|
+
if (typeof PointerEvent !== 'undefined') removeGlobalListener(window, 'pointerup', onThumbUp, false);
|
|
335
|
+
else {
|
|
336
|
+
removeGlobalListener(window, 'mouseup', onThumbUp, false);
|
|
337
|
+
removeGlobalListener(window, 'touchend', onThumbUp, false);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
let onColorAreaDown = (colorArea, id, clientX, clientY)=>{
|
|
342
|
+
let rect = colorArea.getBoundingClientRect();
|
|
343
|
+
let { width: width , height: height } = rect;
|
|
344
|
+
let x = (clientX - rect.x) / width;
|
|
345
|
+
let y = (clientY - rect.y) / height;
|
|
346
|
+
if (direction === 'rtl') x = 1 - x;
|
|
347
|
+
if (x >= 0 && x <= 1 && y >= 0 && y <= 1 && !state.isDragging && currentPointer.current === undefined) {
|
|
348
|
+
isOnColorArea.current = true;
|
|
349
|
+
currentPointer.current = id;
|
|
350
|
+
state.setColorFromPoint(x, y);
|
|
351
|
+
focusInput();
|
|
352
|
+
state.setDragging(true);
|
|
353
|
+
if (typeof PointerEvent !== 'undefined') addGlobalListener(window, 'pointerup', onColorAreaUp, false);
|
|
354
|
+
else {
|
|
355
|
+
addGlobalListener(window, 'mouseup', onColorAreaUp, false);
|
|
356
|
+
addGlobalListener(window, 'touchend', onColorAreaUp, false);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
let onColorAreaUp = (e)=>{
|
|
361
|
+
var ref;
|
|
362
|
+
var _pointerId;
|
|
363
|
+
let id = (_pointerId = e.pointerId) !== null && _pointerId !== void 0 ? _pointerId : (ref = e.changedTouches) === null || ref === void 0 ? void 0 : ref[0].identifier;
|
|
364
|
+
if (isOnColorArea.current && id === currentPointer.current) {
|
|
365
|
+
isOnColorArea.current = false;
|
|
366
|
+
currentPointer.current = undefined;
|
|
367
|
+
state.setDragging(false);
|
|
368
|
+
focusInput();
|
|
369
|
+
if (typeof PointerEvent !== 'undefined') removeGlobalListener(window, 'pointerup', onColorAreaUp, false);
|
|
370
|
+
else {
|
|
371
|
+
removeGlobalListener(window, 'mouseup', onColorAreaUp, false);
|
|
372
|
+
removeGlobalListener(window, 'touchend', onColorAreaUp, false);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
let colorAreaInteractions = isDisabled ? {
|
|
377
|
+
} : $kZqDi$reactariautils.mergeProps({
|
|
378
|
+
...typeof PointerEvent !== 'undefined' ? {
|
|
379
|
+
onPointerDown: (e)=>{
|
|
380
|
+
if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
|
|
381
|
+
onColorAreaDown(e.currentTarget, e.pointerId, e.clientX, e.clientY);
|
|
382
|
+
}
|
|
383
|
+
} : {
|
|
384
|
+
onMouseDown: (e)=>{
|
|
385
|
+
if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
386
|
+
onColorAreaDown(e.currentTarget, undefined, e.clientX, e.clientY);
|
|
387
|
+
},
|
|
388
|
+
onTouchStart: (e)=>{
|
|
389
|
+
onColorAreaDown(e.currentTarget, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}, movePropsContainer);
|
|
393
|
+
let thumbInteractions = isDisabled ? {
|
|
394
|
+
} : $kZqDi$reactariautils.mergeProps({
|
|
395
|
+
...typeof PointerEvent !== 'undefined' ? {
|
|
396
|
+
onPointerDown: (e)=>{
|
|
397
|
+
if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
|
|
398
|
+
onThumbDown(e.pointerId);
|
|
399
|
+
}
|
|
400
|
+
} : {
|
|
401
|
+
onMouseDown: (e)=>{
|
|
402
|
+
if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
403
|
+
onThumbDown(undefined);
|
|
404
|
+
},
|
|
405
|
+
onTouchStart: (e)=>{
|
|
406
|
+
onThumbDown(e.changedTouches[0].identifier);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}, keyboardProps, movePropsThumb);
|
|
410
|
+
let isMobile = $kZqDi$reactariautils.isIOS() || $kZqDi$reactariautils.isAndroid();
|
|
411
|
+
let xInputLabellingProps = $kZqDi$reactariautils.useLabels({
|
|
412
|
+
...props,
|
|
413
|
+
'aria-label': isMobile ? state.value.getChannelName(xChannel, locale) : formatMessage('x/y', {
|
|
414
|
+
x: state.value.getChannelName(xChannel, locale),
|
|
415
|
+
y: state.value.getChannelName(yChannel, locale)
|
|
416
|
+
})
|
|
417
|
+
});
|
|
418
|
+
let yInputLabellingProps = $kZqDi$reactariautils.useLabels({
|
|
419
|
+
...props,
|
|
420
|
+
'aria-label': isMobile ? state.value.getChannelName(yChannel, locale) : formatMessage('x/y', {
|
|
421
|
+
x: state.value.getChannelName(xChannel, locale),
|
|
422
|
+
y: state.value.getChannelName(yChannel, locale)
|
|
423
|
+
})
|
|
424
|
+
});
|
|
425
|
+
let colorAriaLabellingProps = $kZqDi$reactariautils.useLabels(props);
|
|
426
|
+
let getValueTitle = ()=>[
|
|
427
|
+
formatMessage('colorNameAndValue', {
|
|
428
|
+
name: state.value.getChannelName('red', locale),
|
|
429
|
+
value: state.value.formatChannelValue('red', locale)
|
|
430
|
+
}),
|
|
431
|
+
formatMessage('colorNameAndValue', {
|
|
432
|
+
name: state.value.getChannelName('green', locale),
|
|
433
|
+
value: state.value.formatChannelValue('green', locale)
|
|
434
|
+
}),
|
|
435
|
+
formatMessage('colorNameAndValue', {
|
|
436
|
+
name: state.value.getChannelName('blue', locale),
|
|
437
|
+
value: state.value.formatChannelValue('blue', locale)
|
|
438
|
+
})
|
|
439
|
+
].join(', ')
|
|
440
|
+
;
|
|
441
|
+
let ariaRoleDescription = isMobile ? null : formatMessage('twoDimensionalSlider');
|
|
442
|
+
let { visuallyHiddenProps: visuallyHiddenProps } = $kZqDi$reactariavisuallyhidden.useVisuallyHidden({
|
|
443
|
+
style: {
|
|
444
|
+
opacity: '0.0001',
|
|
445
|
+
width: '100%',
|
|
446
|
+
height: '100%',
|
|
447
|
+
pointerEvents: 'none'
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
return {
|
|
451
|
+
colorAreaProps: {
|
|
452
|
+
...colorAriaLabellingProps,
|
|
453
|
+
...colorAreaInteractions,
|
|
454
|
+
role: 'group'
|
|
455
|
+
},
|
|
456
|
+
gradientProps: {
|
|
457
|
+
role: 'presentation'
|
|
458
|
+
},
|
|
459
|
+
thumbProps: {
|
|
460
|
+
...thumbInteractions,
|
|
461
|
+
role: 'presentation'
|
|
462
|
+
},
|
|
463
|
+
xInputProps: {
|
|
464
|
+
...xInputLabellingProps,
|
|
465
|
+
...visuallyHiddenProps,
|
|
466
|
+
type: 'range',
|
|
467
|
+
min: state.value.getChannelRange(xChannel).minValue,
|
|
468
|
+
max: state.value.getChannelRange(xChannel).maxValue,
|
|
469
|
+
step: xChannelStep1,
|
|
470
|
+
'aria-roledescription': ariaRoleDescription,
|
|
471
|
+
'aria-valuetext': isMobile ? formatMessage('colorNameAndValue', {
|
|
472
|
+
name: state.value.getChannelName(xChannel, locale),
|
|
473
|
+
value: state.value.formatChannelValue(xChannel, locale)
|
|
474
|
+
}) : [
|
|
475
|
+
formatMessage('colorNameAndValue', {
|
|
476
|
+
name: state.value.getChannelName(xChannel, locale),
|
|
477
|
+
value: state.value.formatChannelValue(xChannel, locale)
|
|
478
|
+
}),
|
|
479
|
+
formatMessage('colorNameAndValue', {
|
|
480
|
+
name: state.value.getChannelName(yChannel, locale),
|
|
481
|
+
value: state.value.formatChannelValue(yChannel, locale)
|
|
482
|
+
})
|
|
483
|
+
].join(', '),
|
|
484
|
+
title: getValueTitle(),
|
|
485
|
+
disabled: isDisabled,
|
|
486
|
+
value: state.value.getChannelValue(xChannel),
|
|
487
|
+
tabIndex: 0,
|
|
488
|
+
onChange: (e)=>{
|
|
489
|
+
state.setXValue(parseFloat(e.target.value));
|
|
490
|
+
}
|
|
491
|
+
},
|
|
492
|
+
yInputProps: {
|
|
493
|
+
...yInputLabellingProps,
|
|
494
|
+
...visuallyHiddenProps,
|
|
495
|
+
type: 'range',
|
|
496
|
+
min: state.value.getChannelRange(yChannel).minValue,
|
|
497
|
+
max: state.value.getChannelRange(yChannel).maxValue,
|
|
498
|
+
step: yChannelStep1,
|
|
499
|
+
'aria-roledescription': ariaRoleDescription,
|
|
500
|
+
'aria-valuetext': isMobile ? formatMessage('colorNameAndValue', {
|
|
501
|
+
name: state.value.getChannelName(yChannel, locale),
|
|
502
|
+
value: state.value.formatChannelValue(yChannel, locale)
|
|
503
|
+
}) : [
|
|
504
|
+
formatMessage('colorNameAndValue', {
|
|
505
|
+
name: state.value.getChannelName(yChannel, locale),
|
|
506
|
+
value: state.value.formatChannelValue(yChannel, locale)
|
|
507
|
+
}),
|
|
508
|
+
formatMessage('colorNameAndValue', {
|
|
509
|
+
name: state.value.getChannelName(xChannel, locale),
|
|
510
|
+
value: state.value.formatChannelValue(xChannel, locale)
|
|
511
|
+
})
|
|
512
|
+
].join(', '),
|
|
513
|
+
'aria-orientation': 'vertical',
|
|
514
|
+
title: getValueTitle(),
|
|
515
|
+
disabled: isDisabled,
|
|
516
|
+
value: state.value.getChannelValue(yChannel),
|
|
517
|
+
tabIndex: -1,
|
|
518
|
+
onChange: (e)=>{
|
|
519
|
+
state.setYValue(parseFloat(e.target.value));
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
var $afbb9647440a7f5b$exports = {};
|
|
527
|
+
|
|
528
|
+
$parcel$export($afbb9647440a7f5b$exports, "useColorSlider", () => $afbb9647440a7f5b$export$106b7a4e66508f66);
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
function $afbb9647440a7f5b$export$106b7a4e66508f66(props, state) {
|
|
35
533
|
let { trackRef: trackRef , inputRef: inputRef , orientation: orientation , channel: channel , 'aria-label': ariaLabel } = props;
|
|
36
|
-
let { locale: locale , direction: direction } = $
|
|
534
|
+
let { locale: locale , direction: direction } = $kZqDi$reactariai18n.useLocale();
|
|
37
535
|
// Provide a default aria-label if there is no other label provided.
|
|
38
536
|
if (!props.label && !ariaLabel && !props['aria-labelledby']) ariaLabel = state.value.getChannelName(channel, locale);
|
|
39
537
|
// @ts-ignore - ignore unused incompatible props
|
|
40
|
-
let { groupProps: groupProps , trackProps: trackProps , labelProps: labelProps , outputProps: outputProps } = $
|
|
538
|
+
let { groupProps: groupProps , trackProps: trackProps , labelProps: labelProps , outputProps: outputProps } = $kZqDi$reactariaslider.useSlider({
|
|
41
539
|
...props,
|
|
42
540
|
'aria-label': ariaLabel
|
|
43
541
|
}, state, trackRef);
|
|
44
|
-
let { inputProps: inputProps , thumbProps: thumbProps } = $
|
|
542
|
+
let { inputProps: inputProps , thumbProps: thumbProps } = $kZqDi$reactariaslider.useSliderThumb({
|
|
45
543
|
index: 0,
|
|
46
544
|
orientation: orientation,
|
|
47
545
|
isDisabled: props.isDisabled,
|
|
@@ -87,7 +585,7 @@ function $9b39dbd4f9acd144$export$106b7a4e66508f66(props, state) {
|
|
|
87
585
|
if (orientation === 'vertical' || direction === 'rtl') thumbPosition = 1 - thumbPosition;
|
|
88
586
|
return {
|
|
89
587
|
trackProps: {
|
|
90
|
-
...$
|
|
588
|
+
...$kZqDi$reactariautils.mergeProps(groupProps, trackProps),
|
|
91
589
|
style: {
|
|
92
590
|
position: 'relative',
|
|
93
591
|
touchAction: 'none',
|
|
@@ -110,38 +608,61 @@ function $9b39dbd4f9acd144$export$106b7a4e66508f66(props, state) {
|
|
|
110
608
|
}
|
|
111
609
|
|
|
112
610
|
|
|
113
|
-
var $
|
|
611
|
+
var $1d29bf243d4a9a53$exports = {};
|
|
114
612
|
|
|
115
|
-
$parcel$export($
|
|
613
|
+
$parcel$export($1d29bf243d4a9a53$exports, "useColorWheel", () => $1d29bf243d4a9a53$export$9064ff4e44b3729a);
|
|
116
614
|
|
|
117
615
|
|
|
118
616
|
|
|
119
617
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
let {
|
|
123
|
-
let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = $9VynS$reactariautils.useGlobalListeners();
|
|
618
|
+
function $1d29bf243d4a9a53$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
619
|
+
let { isDisabled: isDisabled , innerRadius: innerRadius , outerRadius: outerRadius , 'aria-label': ariaLabel } = props;
|
|
620
|
+
let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = $kZqDi$reactariautils.useGlobalListeners();
|
|
124
621
|
let thumbRadius = (innerRadius + outerRadius) / 2;
|
|
125
|
-
let focusInput = $
|
|
126
|
-
if (inputRef.current) $
|
|
622
|
+
let focusInput = $kZqDi$react.useCallback(()=>{
|
|
623
|
+
if (inputRef.current) $kZqDi$reactariautils.focusWithoutScrolling(inputRef.current);
|
|
127
624
|
}, [
|
|
128
625
|
inputRef
|
|
129
626
|
]);
|
|
130
|
-
let stateRef = $
|
|
627
|
+
let stateRef = $kZqDi$react.useRef(null);
|
|
131
628
|
stateRef.current = state;
|
|
132
|
-
let currentPosition = $
|
|
629
|
+
let currentPosition = $kZqDi$react.useRef(null);
|
|
630
|
+
let { keyboardProps: keyboardProps } = $kZqDi$reactariainteractions.useKeyboard({
|
|
631
|
+
onKeyDown (e) {
|
|
632
|
+
// these are the cases that useMove doesn't handle
|
|
633
|
+
if (!/^(PageUp|PageDown)$/.test(e.key)) {
|
|
634
|
+
e.continuePropagation();
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
// same handling as useMove, don't need to stop propagation, useKeyboard will do that for us
|
|
638
|
+
e.preventDefault();
|
|
639
|
+
// remember to set this and unset it so that onChangeEnd is fired
|
|
640
|
+
stateRef.current.setDragging(true);
|
|
641
|
+
switch(e.key){
|
|
642
|
+
case 'PageUp':
|
|
643
|
+
e.preventDefault();
|
|
644
|
+
state.increment(stateRef.current.pageStep);
|
|
645
|
+
break;
|
|
646
|
+
case 'PageDown':
|
|
647
|
+
e.preventDefault();
|
|
648
|
+
state.decrement(stateRef.current.pageStep);
|
|
649
|
+
break;
|
|
650
|
+
}
|
|
651
|
+
stateRef.current.setDragging(false);
|
|
652
|
+
}
|
|
653
|
+
});
|
|
133
654
|
let moveHandler = {
|
|
134
655
|
onMoveStart () {
|
|
135
656
|
currentPosition.current = null;
|
|
136
657
|
state.setDragging(true);
|
|
137
658
|
},
|
|
138
|
-
onMove ({ deltaX: deltaX , deltaY: deltaY , pointerType: pointerType }) {
|
|
659
|
+
onMove ({ deltaX: deltaX , deltaY: deltaY , pointerType: pointerType , shiftKey: shiftKey }) {
|
|
139
660
|
if (currentPosition.current == null) currentPosition.current = stateRef.current.getThumbPosition(thumbRadius);
|
|
140
661
|
currentPosition.current.x += deltaX;
|
|
141
662
|
currentPosition.current.y += deltaY;
|
|
142
663
|
if (pointerType === 'keyboard') {
|
|
143
|
-
if (deltaX > 0 || deltaY < 0) state.increment();
|
|
144
|
-
else if (deltaX < 0 || deltaY > 0) state.decrement();
|
|
664
|
+
if (deltaX > 0 || deltaY < 0) state.increment(shiftKey ? stateRef.current.pageStep : stateRef.current.step);
|
|
665
|
+
else if (deltaX < 0 || deltaY > 0) state.decrement(shiftKey ? stateRef.current.pageStep : stateRef.current.step);
|
|
145
666
|
} else stateRef.current.setHueFromPoint(currentPosition.current.x, currentPosition.current.y, thumbRadius);
|
|
146
667
|
},
|
|
147
668
|
onMoveEnd () {
|
|
@@ -150,10 +671,10 @@ function $e5063b6d79973c73$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
150
671
|
focusInput();
|
|
151
672
|
}
|
|
152
673
|
};
|
|
153
|
-
let { moveProps: movePropsThumb } = $
|
|
154
|
-
let currentPointer = $
|
|
155
|
-
let isOnTrack = $
|
|
156
|
-
let { moveProps: movePropsContainer } = $
|
|
674
|
+
let { moveProps: movePropsThumb } = $kZqDi$reactariainteractions.useMove(moveHandler);
|
|
675
|
+
let currentPointer = $kZqDi$react.useRef(undefined);
|
|
676
|
+
let isOnTrack = $kZqDi$react.useRef(false);
|
|
677
|
+
let { moveProps: movePropsContainer } = $kZqDi$reactariainteractions.useMove({
|
|
157
678
|
onMoveStart () {
|
|
158
679
|
if (isOnTrack.current) moveHandler.onMoveStart();
|
|
159
680
|
},
|
|
@@ -226,22 +747,8 @@ function $e5063b6d79973c73$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
226
747
|
}
|
|
227
748
|
}
|
|
228
749
|
};
|
|
229
|
-
let { keyboardProps: keyboardProps } = $9VynS$reactariainteractions.useKeyboard({
|
|
230
|
-
onKeyDown (e) {
|
|
231
|
-
switch(e.key){
|
|
232
|
-
case 'PageUp':
|
|
233
|
-
e.preventDefault();
|
|
234
|
-
state.increment($e5063b6d79973c73$var$PAGE_MIN_STEP_SIZE);
|
|
235
|
-
break;
|
|
236
|
-
case 'PageDown':
|
|
237
|
-
e.preventDefault();
|
|
238
|
-
state.decrement($e5063b6d79973c73$var$PAGE_MIN_STEP_SIZE);
|
|
239
|
-
break;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
750
|
let trackInteractions = isDisabled ? {
|
|
244
|
-
} : $
|
|
751
|
+
} : $kZqDi$reactariautils.mergeProps({
|
|
245
752
|
...typeof PointerEvent !== 'undefined' ? {
|
|
246
753
|
onPointerDown: (e)=>{
|
|
247
754
|
if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
|
|
@@ -258,7 +765,7 @@ function $e5063b6d79973c73$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
258
765
|
}
|
|
259
766
|
}, movePropsContainer);
|
|
260
767
|
let thumbInteractions = isDisabled ? {
|
|
261
|
-
} : $
|
|
768
|
+
} : $kZqDi$reactariautils.mergeProps({
|
|
262
769
|
onMouseDown: (e)=>{
|
|
263
770
|
if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
264
771
|
onThumbDown(undefined);
|
|
@@ -270,15 +777,16 @@ function $e5063b6d79973c73$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
270
777
|
onTouchStart: (e)=>{
|
|
271
778
|
onThumbDown(e.changedTouches[0].identifier);
|
|
272
779
|
}
|
|
273
|
-
},
|
|
780
|
+
}, keyboardProps, movePropsThumb);
|
|
274
781
|
let { x: x1 , y: y1 } = state.getThumbPosition(thumbRadius);
|
|
275
782
|
// Provide a default aria-label if none is given
|
|
276
|
-
let { locale: locale } = $
|
|
783
|
+
let { locale: locale } = $kZqDi$reactariai18n.useLocale();
|
|
277
784
|
if (ariaLabel == null && props['aria-labelledby'] == null) ariaLabel = state.value.getChannelName('hue', locale);
|
|
278
|
-
let inputLabellingProps = $
|
|
785
|
+
let inputLabellingProps = $kZqDi$reactariautils.useLabels({
|
|
279
786
|
...props,
|
|
280
787
|
'aria-label': ariaLabel
|
|
281
788
|
});
|
|
789
|
+
let { minValue: minValue , maxValue: maxValue , step: step } = state.value.getChannelRange('hue');
|
|
282
790
|
return {
|
|
283
791
|
trackProps: {
|
|
284
792
|
...trackInteractions,
|
|
@@ -305,7 +813,7 @@ function $e5063b6d79973c73$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
305
813
|
hsl(360, 100%, 50%)
|
|
306
814
|
)
|
|
307
815
|
`,
|
|
308
|
-
clipPath: `path(evenodd, "${$
|
|
816
|
+
clipPath: `path(evenodd, "${$1d29bf243d4a9a53$var$circlePath(outerRadius, outerRadius, outerRadius)} ${$1d29bf243d4a9a53$var$circlePath(outerRadius, outerRadius, innerRadius)}")`
|
|
309
817
|
}
|
|
310
818
|
},
|
|
311
819
|
thumbProps: {
|
|
@@ -318,10 +826,10 @@ function $e5063b6d79973c73$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
318
826
|
touchAction: 'none'
|
|
319
827
|
}
|
|
320
828
|
},
|
|
321
|
-
inputProps: $
|
|
829
|
+
inputProps: $kZqDi$reactariautils.mergeProps(inputLabellingProps, {
|
|
322
830
|
type: 'range',
|
|
323
|
-
min:
|
|
324
|
-
max:
|
|
831
|
+
min: String(minValue),
|
|
832
|
+
max: String(maxValue),
|
|
325
833
|
step: String(step),
|
|
326
834
|
'aria-valuetext': state.value.formatChannelValue('hue', locale),
|
|
327
835
|
disabled: isDisabled,
|
|
@@ -333,24 +841,24 @@ function $e5063b6d79973c73$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
333
841
|
};
|
|
334
842
|
}
|
|
335
843
|
// Creates an SVG path string for a circle.
|
|
336
|
-
function $
|
|
844
|
+
function $1d29bf243d4a9a53$var$circlePath(cx, cy, r) {
|
|
337
845
|
return `M ${cx}, ${cy} m ${-r}, 0 a ${r}, ${r}, 0, 1, 0, ${r * 2}, 0 a ${r}, ${r}, 0, 1, 0 ${-r * 2}, 0`;
|
|
338
846
|
}
|
|
339
847
|
|
|
340
848
|
|
|
341
|
-
var $
|
|
849
|
+
var $58c850037bc7a7ce$exports = {};
|
|
342
850
|
|
|
343
|
-
$parcel$export($
|
|
851
|
+
$parcel$export($58c850037bc7a7ce$exports, "useColorField", () => $58c850037bc7a7ce$export$77e32ca575a28fdf);
|
|
344
852
|
|
|
345
853
|
|
|
346
854
|
|
|
347
855
|
|
|
348
856
|
|
|
349
|
-
function $
|
|
857
|
+
function $58c850037bc7a7ce$export$77e32ca575a28fdf(props, state, ref) {
|
|
350
858
|
let { isDisabled: isDisabled , isReadOnly: isReadOnly , isRequired: isRequired } = props;
|
|
351
859
|
let { colorValue: colorValue , inputValue: inputValue , commit: commit , increment: increment , decrement: decrement , incrementToMax: incrementToMax , decrementToMin: decrementToMin } = state;
|
|
352
|
-
let inputId = $
|
|
353
|
-
let { spinButtonProps: spinButtonProps } = $
|
|
860
|
+
let inputId = $kZqDi$reactariautils.useId();
|
|
861
|
+
let { spinButtonProps: spinButtonProps } = $kZqDi$reactariaspinbutton.useSpinButton({
|
|
354
862
|
isDisabled: isDisabled,
|
|
355
863
|
isReadOnly: isReadOnly,
|
|
356
864
|
isRequired: isRequired,
|
|
@@ -363,31 +871,29 @@ function $0542a73d68f06faa$export$77e32ca575a28fdf(props, state, ref) {
|
|
|
363
871
|
value: colorValue ? colorValue.toHexInt() : undefined,
|
|
364
872
|
textValue: colorValue ? colorValue.toString('hex') : undefined
|
|
365
873
|
});
|
|
366
|
-
let [focusWithin, setFocusWithin] = $
|
|
367
|
-
let { focusWithinProps: focusWithinProps } = $
|
|
874
|
+
let [focusWithin, setFocusWithin] = $kZqDi$react.useState(false);
|
|
875
|
+
let { focusWithinProps: focusWithinProps } = $kZqDi$reactariainteractions.useFocusWithin({
|
|
368
876
|
isDisabled: isDisabled,
|
|
369
877
|
onFocusWithinChange: setFocusWithin
|
|
370
878
|
});
|
|
371
|
-
let onWheel = $
|
|
879
|
+
let onWheel = $kZqDi$react.useCallback((e)=>{
|
|
372
880
|
if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) return;
|
|
373
881
|
if (e.deltaY > 0) increment();
|
|
374
882
|
else if (e.deltaY < 0) decrement();
|
|
375
883
|
}, [
|
|
376
|
-
isReadOnly,
|
|
377
|
-
isDisabled,
|
|
378
884
|
decrement,
|
|
379
885
|
increment
|
|
380
886
|
]);
|
|
381
887
|
// If the input isn't supposed to receive input, disable scrolling.
|
|
382
888
|
let scrollingDisabled = isDisabled || isReadOnly || !focusWithin;
|
|
383
|
-
$
|
|
889
|
+
$kZqDi$reactariainteractions.useScrollWheel({
|
|
384
890
|
onScroll: onWheel,
|
|
385
891
|
isDisabled: scrollingDisabled
|
|
386
892
|
}, ref);
|
|
387
893
|
let onChange = (value)=>{
|
|
388
894
|
state.setInputValue(value);
|
|
389
895
|
};
|
|
390
|
-
let { labelProps: labelProps , inputProps: inputProps } = $
|
|
896
|
+
let { labelProps: labelProps , inputProps: inputProps } = $kZqDi$reactariatextfield.useFormattedTextField($kZqDi$reactariautils.mergeProps(props, {
|
|
391
897
|
id: inputId,
|
|
392
898
|
value: inputValue,
|
|
393
899
|
defaultValue: undefined,
|
|
@@ -397,7 +903,7 @@ function $0542a73d68f06faa$export$77e32ca575a28fdf(props, state, ref) {
|
|
|
397
903
|
}), state, ref);
|
|
398
904
|
return {
|
|
399
905
|
labelProps: labelProps,
|
|
400
|
-
inputProps: $
|
|
906
|
+
inputProps: $kZqDi$reactariautils.mergeProps(inputProps, spinButtonProps, focusWithinProps, {
|
|
401
907
|
role: 'textbox',
|
|
402
908
|
'aria-valuemax': null,
|
|
403
909
|
'aria-valuemin': null,
|
|
@@ -411,9 +917,10 @@ function $0542a73d68f06faa$export$77e32ca575a28fdf(props, state, ref) {
|
|
|
411
917
|
}
|
|
412
918
|
|
|
413
919
|
|
|
414
|
-
$parcel$exportWildcard(module.exports, $
|
|
415
|
-
$parcel$exportWildcard(module.exports, $
|
|
416
|
-
$parcel$exportWildcard(module.exports, $
|
|
920
|
+
$parcel$exportWildcard(module.exports, $47925bd68062ac17$exports);
|
|
921
|
+
$parcel$exportWildcard(module.exports, $afbb9647440a7f5b$exports);
|
|
922
|
+
$parcel$exportWildcard(module.exports, $1d29bf243d4a9a53$exports);
|
|
923
|
+
$parcel$exportWildcard(module.exports, $58c850037bc7a7ce$exports);
|
|
417
924
|
|
|
418
925
|
|
|
419
926
|
//# sourceMappingURL=main.js.map
|