@react-aria/color 3.0.0-nightly.3085 → 3.0.0-nightly.3100
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 +51 -51
- package/dist/module.js +49 -49
- package/package.json +12 -12
package/dist/main.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $
|
|
3
|
-
var $
|
|
4
|
-
var $
|
|
5
|
-
var $
|
|
6
|
-
var $
|
|
7
|
-
var $
|
|
1
|
+
var $fb1f3$reactariautils = require("@react-aria/utils");
|
|
2
|
+
var $fb1f3$reactariai18n = require("@react-aria/i18n");
|
|
3
|
+
var $fb1f3$reactariaslider = require("@react-aria/slider");
|
|
4
|
+
var $fb1f3$react = require("react");
|
|
5
|
+
var $fb1f3$reactariainteractions = require("@react-aria/interactions");
|
|
6
|
+
var $fb1f3$reactariatextfield = require("@react-aria/textfield");
|
|
7
|
+
var $fb1f3$reactariaspinbutton = require("@react-aria/spinbutton");
|
|
8
8
|
|
|
9
9
|
function $parcel$exportWildcard(dest, source) {
|
|
10
10
|
Object.keys(source).forEach(function(key) {
|
|
@@ -25,23 +25,23 @@ function $parcel$exportWildcard(dest, source) {
|
|
|
25
25
|
function $parcel$export(e, n, v, s) {
|
|
26
26
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
27
27
|
}
|
|
28
|
-
var $
|
|
28
|
+
var $65c158f0c1f3086b$exports = {};
|
|
29
29
|
|
|
30
|
-
$parcel$export($
|
|
30
|
+
$parcel$export($65c158f0c1f3086b$exports, "useColorSlider", () => $65c158f0c1f3086b$export$106b7a4e66508f66);
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
function $
|
|
34
|
+
function $65c158f0c1f3086b$export$106b7a4e66508f66(props, state) {
|
|
35
35
|
let { trackRef: trackRef , inputRef: inputRef , orientation: orientation , channel: channel , 'aria-label': ariaLabel } = props;
|
|
36
|
-
let { locale: locale , direction: direction } = $
|
|
36
|
+
let { locale: locale , direction: direction } = $fb1f3$reactariai18n.useLocale();
|
|
37
37
|
// Provide a default aria-label if there is no other label provided.
|
|
38
38
|
if (!props.label && !ariaLabel && !props['aria-labelledby']) ariaLabel = state.value.getChannelName(channel, locale);
|
|
39
39
|
// @ts-ignore - ignore unused incompatible props
|
|
40
|
-
let { groupProps: groupProps , trackProps: trackProps , labelProps: labelProps , outputProps: outputProps } = $
|
|
40
|
+
let { groupProps: groupProps , trackProps: trackProps , labelProps: labelProps , outputProps: outputProps } = $fb1f3$reactariaslider.useSlider({
|
|
41
41
|
...props,
|
|
42
42
|
'aria-label': ariaLabel
|
|
43
43
|
}, state, trackRef);
|
|
44
|
-
let { inputProps: inputProps , thumbProps: thumbProps } = $
|
|
44
|
+
let { inputProps: inputProps , thumbProps: thumbProps } = $fb1f3$reactariaslider.useSliderThumb({
|
|
45
45
|
index: 0,
|
|
46
46
|
orientation: orientation,
|
|
47
47
|
isDisabled: props.isDisabled,
|
|
@@ -87,7 +87,7 @@ function $1dcb689e6b4dbdc0$export$106b7a4e66508f66(props, state) {
|
|
|
87
87
|
if (orientation === 'vertical' || direction === 'rtl') thumbPosition = 1 - thumbPosition;
|
|
88
88
|
return {
|
|
89
89
|
trackProps: {
|
|
90
|
-
...$
|
|
90
|
+
...$fb1f3$reactariautils.mergeProps(groupProps, trackProps),
|
|
91
91
|
style: {
|
|
92
92
|
position: 'relative',
|
|
93
93
|
touchAction: 'none',
|
|
@@ -110,26 +110,26 @@ function $1dcb689e6b4dbdc0$export$106b7a4e66508f66(props, state) {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
|
|
113
|
-
var $
|
|
113
|
+
var $f52a5d5adb728369$exports = {};
|
|
114
114
|
|
|
115
|
-
$parcel$export($
|
|
115
|
+
$parcel$export($f52a5d5adb728369$exports, "useColorWheel", () => $f52a5d5adb728369$export$9064ff4e44b3729a);
|
|
116
116
|
|
|
117
117
|
|
|
118
118
|
|
|
119
119
|
|
|
120
|
-
const $
|
|
121
|
-
function $
|
|
120
|
+
const $f52a5d5adb728369$var$PAGE_MIN_STEP_SIZE = 6;
|
|
121
|
+
function $f52a5d5adb728369$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
122
122
|
let { isDisabled: isDisabled , step: step = 1 , innerRadius: innerRadius , outerRadius: outerRadius , 'aria-label': ariaLabel } = props;
|
|
123
|
-
let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = $
|
|
123
|
+
let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = $fb1f3$reactariautils.useGlobalListeners();
|
|
124
124
|
let thumbRadius = (innerRadius + outerRadius) / 2;
|
|
125
|
-
let focusInput = $
|
|
126
|
-
if (inputRef.current) $
|
|
125
|
+
let focusInput = $fb1f3$react.useCallback(()=>{
|
|
126
|
+
if (inputRef.current) $fb1f3$reactariautils.focusWithoutScrolling(inputRef.current);
|
|
127
127
|
}, [
|
|
128
128
|
inputRef
|
|
129
129
|
]);
|
|
130
|
-
let stateRef = $
|
|
130
|
+
let stateRef = $fb1f3$react.useRef(null);
|
|
131
131
|
stateRef.current = state;
|
|
132
|
-
let currentPosition = $
|
|
132
|
+
let currentPosition = $fb1f3$react.useRef(null);
|
|
133
133
|
let moveHandler = {
|
|
134
134
|
onMoveStart () {
|
|
135
135
|
currentPosition.current = null;
|
|
@@ -150,10 +150,10 @@ function $5e049513506b53e6$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
150
150
|
focusInput();
|
|
151
151
|
}
|
|
152
152
|
};
|
|
153
|
-
let { moveProps: movePropsThumb } = $
|
|
154
|
-
let currentPointer = $
|
|
155
|
-
let isOnTrack = $
|
|
156
|
-
let { moveProps: movePropsContainer } = $
|
|
153
|
+
let { moveProps: movePropsThumb } = $fb1f3$reactariainteractions.useMove(moveHandler);
|
|
154
|
+
let currentPointer = $fb1f3$react.useRef(undefined);
|
|
155
|
+
let isOnTrack = $fb1f3$react.useRef(false);
|
|
156
|
+
let { moveProps: movePropsContainer } = $fb1f3$reactariainteractions.useMove({
|
|
157
157
|
onMoveStart () {
|
|
158
158
|
if (isOnTrack.current) moveHandler.onMoveStart();
|
|
159
159
|
},
|
|
@@ -222,22 +222,22 @@ function $5e049513506b53e6$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
};
|
|
225
|
-
let { keyboardProps: keyboardProps } = $
|
|
225
|
+
let { keyboardProps: keyboardProps } = $fb1f3$reactariainteractions.useKeyboard({
|
|
226
226
|
onKeyDown (e) {
|
|
227
227
|
switch(e.key){
|
|
228
228
|
case 'PageUp':
|
|
229
229
|
e.preventDefault();
|
|
230
|
-
state.increment($
|
|
230
|
+
state.increment($f52a5d5adb728369$var$PAGE_MIN_STEP_SIZE);
|
|
231
231
|
break;
|
|
232
232
|
case 'PageDown':
|
|
233
233
|
e.preventDefault();
|
|
234
|
-
state.decrement($
|
|
234
|
+
state.decrement($f52a5d5adb728369$var$PAGE_MIN_STEP_SIZE);
|
|
235
235
|
break;
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
});
|
|
239
239
|
let trackInteractions = isDisabled ? {
|
|
240
|
-
} : $
|
|
240
|
+
} : $fb1f3$reactariautils.mergeProps({
|
|
241
241
|
...typeof PointerEvent !== 'undefined' ? {
|
|
242
242
|
onPointerDown: (e)=>{
|
|
243
243
|
if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
|
|
@@ -254,7 +254,7 @@ function $5e049513506b53e6$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
254
254
|
}
|
|
255
255
|
}, movePropsContainer);
|
|
256
256
|
let thumbInteractions = isDisabled ? {
|
|
257
|
-
} : $
|
|
257
|
+
} : $fb1f3$reactariautils.mergeProps({
|
|
258
258
|
onMouseDown: (e)=>{
|
|
259
259
|
if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
260
260
|
onThumbDown(undefined);
|
|
@@ -269,9 +269,9 @@ function $5e049513506b53e6$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
269
269
|
}, movePropsThumb, keyboardProps);
|
|
270
270
|
let { x: x1 , y: y1 } = state.getThumbPosition(thumbRadius);
|
|
271
271
|
// Provide a default aria-label if none is given
|
|
272
|
-
let { locale: locale } = $
|
|
272
|
+
let { locale: locale } = $fb1f3$reactariai18n.useLocale();
|
|
273
273
|
if (ariaLabel == null && props['aria-labelledby'] == null) ariaLabel = state.value.getChannelName('hue', locale);
|
|
274
|
-
let inputLabellingProps = $
|
|
274
|
+
let inputLabellingProps = $fb1f3$reactariautils.useLabels({
|
|
275
275
|
...props,
|
|
276
276
|
'aria-label': ariaLabel
|
|
277
277
|
});
|
|
@@ -301,7 +301,7 @@ function $5e049513506b53e6$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
301
301
|
hsl(360, 100%, 50%)
|
|
302
302
|
)
|
|
303
303
|
`,
|
|
304
|
-
clipPath: `path(evenodd, "${$
|
|
304
|
+
clipPath: `path(evenodd, "${$f52a5d5adb728369$var$circlePath(outerRadius, outerRadius, outerRadius)} ${$f52a5d5adb728369$var$circlePath(outerRadius, outerRadius, innerRadius)}")`
|
|
305
305
|
}
|
|
306
306
|
},
|
|
307
307
|
thumbProps: {
|
|
@@ -314,7 +314,7 @@ function $5e049513506b53e6$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
314
314
|
touchAction: 'none'
|
|
315
315
|
}
|
|
316
316
|
},
|
|
317
|
-
inputProps: $
|
|
317
|
+
inputProps: $fb1f3$reactariautils.mergeProps(inputLabellingProps, {
|
|
318
318
|
type: 'range',
|
|
319
319
|
min: '0',
|
|
320
320
|
max: '360',
|
|
@@ -329,24 +329,24 @@ function $5e049513506b53e6$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
329
329
|
};
|
|
330
330
|
}
|
|
331
331
|
// Creates an SVG path string for a circle.
|
|
332
|
-
function $
|
|
332
|
+
function $f52a5d5adb728369$var$circlePath(cx, cy, r) {
|
|
333
333
|
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`;
|
|
334
334
|
}
|
|
335
335
|
|
|
336
336
|
|
|
337
|
-
var $
|
|
337
|
+
var $a03d78c6bebe68f6$exports = {};
|
|
338
338
|
|
|
339
|
-
$parcel$export($
|
|
339
|
+
$parcel$export($a03d78c6bebe68f6$exports, "useColorField", () => $a03d78c6bebe68f6$export$77e32ca575a28fdf);
|
|
340
340
|
|
|
341
341
|
|
|
342
342
|
|
|
343
343
|
|
|
344
344
|
|
|
345
|
-
function $
|
|
345
|
+
function $a03d78c6bebe68f6$export$77e32ca575a28fdf(props, state, ref) {
|
|
346
346
|
let { isDisabled: isDisabled , isReadOnly: isReadOnly , isRequired: isRequired } = props;
|
|
347
347
|
let { colorValue: colorValue , inputValue: inputValue , commit: commit , increment: increment , decrement: decrement , incrementToMax: incrementToMax , decrementToMin: decrementToMin } = state;
|
|
348
|
-
let inputId = $
|
|
349
|
-
let { spinButtonProps: spinButtonProps } = $
|
|
348
|
+
let inputId = $fb1f3$reactariautils.useId();
|
|
349
|
+
let { spinButtonProps: spinButtonProps } = $fb1f3$reactariaspinbutton.useSpinButton({
|
|
350
350
|
isDisabled: isDisabled,
|
|
351
351
|
isReadOnly: isReadOnly,
|
|
352
352
|
isRequired: isRequired,
|
|
@@ -359,12 +359,12 @@ function $c30bb376b5583743$export$77e32ca575a28fdf(props, state, ref) {
|
|
|
359
359
|
value: colorValue ? colorValue.toHexInt() : undefined,
|
|
360
360
|
textValue: colorValue ? colorValue.toString('hex') : undefined
|
|
361
361
|
});
|
|
362
|
-
let [focusWithin, setFocusWithin] = $
|
|
363
|
-
let { focusWithinProps: focusWithinProps } = $
|
|
362
|
+
let [focusWithin, setFocusWithin] = $fb1f3$react.useState(false);
|
|
363
|
+
let { focusWithinProps: focusWithinProps } = $fb1f3$reactariainteractions.useFocusWithin({
|
|
364
364
|
isDisabled: isDisabled,
|
|
365
365
|
onFocusWithinChange: setFocusWithin
|
|
366
366
|
});
|
|
367
|
-
let onWheel = $
|
|
367
|
+
let onWheel = $fb1f3$react.useCallback((e)=>{
|
|
368
368
|
if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) return;
|
|
369
369
|
if (e.deltaY > 0) increment();
|
|
370
370
|
else if (e.deltaY < 0) decrement();
|
|
@@ -376,14 +376,14 @@ function $c30bb376b5583743$export$77e32ca575a28fdf(props, state, ref) {
|
|
|
376
376
|
]);
|
|
377
377
|
// If the input isn't supposed to receive input, disable scrolling.
|
|
378
378
|
let scrollingDisabled = isDisabled || isReadOnly || !focusWithin;
|
|
379
|
-
$
|
|
379
|
+
$fb1f3$reactariainteractions.useScrollWheel({
|
|
380
380
|
onScroll: onWheel,
|
|
381
381
|
isDisabled: scrollingDisabled
|
|
382
382
|
}, ref);
|
|
383
383
|
let onChange = (value)=>{
|
|
384
384
|
state.setInputValue(value);
|
|
385
385
|
};
|
|
386
|
-
let { labelProps: labelProps , inputProps: inputProps } = $
|
|
386
|
+
let { labelProps: labelProps , inputProps: inputProps } = $fb1f3$reactariatextfield.useFormattedTextField($fb1f3$reactariautils.mergeProps(props, {
|
|
387
387
|
id: inputId,
|
|
388
388
|
value: inputValue,
|
|
389
389
|
defaultValue: undefined,
|
|
@@ -393,7 +393,7 @@ function $c30bb376b5583743$export$77e32ca575a28fdf(props, state, ref) {
|
|
|
393
393
|
}), state, ref);
|
|
394
394
|
return {
|
|
395
395
|
labelProps: labelProps,
|
|
396
|
-
inputProps: $
|
|
396
|
+
inputProps: $fb1f3$reactariautils.mergeProps(inputProps, spinButtonProps, focusWithinProps, {
|
|
397
397
|
role: 'textbox',
|
|
398
398
|
'aria-valuemax': null,
|
|
399
399
|
'aria-valuemin': null,
|
|
@@ -407,9 +407,9 @@ function $c30bb376b5583743$export$77e32ca575a28fdf(props, state, ref) {
|
|
|
407
407
|
}
|
|
408
408
|
|
|
409
409
|
|
|
410
|
-
$parcel$exportWildcard(module.exports, $
|
|
411
|
-
$parcel$exportWildcard(module.exports, $
|
|
412
|
-
$parcel$exportWildcard(module.exports, $
|
|
410
|
+
$parcel$exportWildcard(module.exports, $65c158f0c1f3086b$exports);
|
|
411
|
+
$parcel$exportWildcard(module.exports, $f52a5d5adb728369$exports);
|
|
412
|
+
$parcel$exportWildcard(module.exports, $a03d78c6bebe68f6$exports);
|
|
413
413
|
|
|
414
414
|
|
|
415
415
|
//# sourceMappingURL=main.js.map
|
package/dist/module.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import {mergeProps as $
|
|
2
|
-
import {useLocale as $
|
|
3
|
-
import {useSlider as $
|
|
4
|
-
import {useCallback as $
|
|
5
|
-
import {useMove as $
|
|
6
|
-
import {useFormattedTextField as $
|
|
7
|
-
import {useSpinButton as $
|
|
1
|
+
import {mergeProps as $kLMEb$mergeProps, useGlobalListeners as $kLMEb$useGlobalListeners, focusWithoutScrolling as $kLMEb$focusWithoutScrolling, useLabels as $kLMEb$useLabels, useId as $kLMEb$useId} from "@react-aria/utils";
|
|
2
|
+
import {useLocale as $kLMEb$useLocale} from "@react-aria/i18n";
|
|
3
|
+
import {useSlider as $kLMEb$useSlider, useSliderThumb as $kLMEb$useSliderThumb} from "@react-aria/slider";
|
|
4
|
+
import {useCallback as $kLMEb$useCallback, useRef as $kLMEb$useRef, useState as $kLMEb$useState} from "react";
|
|
5
|
+
import {useMove as $kLMEb$useMove, useKeyboard as $kLMEb$useKeyboard, useFocusWithin as $kLMEb$useFocusWithin, useScrollWheel as $kLMEb$useScrollWheel} from "@react-aria/interactions";
|
|
6
|
+
import {useFormattedTextField as $kLMEb$useFormattedTextField} from "@react-aria/textfield";
|
|
7
|
+
import {useSpinButton as $kLMEb$useSpinButton} from "@react-aria/spinbutton";
|
|
8
8
|
|
|
9
9
|
function $parcel$export(e, n, v, s) {
|
|
10
10
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
11
11
|
}
|
|
12
|
-
var $
|
|
12
|
+
var $d35c65941a2de674$exports = {};
|
|
13
13
|
|
|
14
|
-
$parcel$export($
|
|
14
|
+
$parcel$export($d35c65941a2de674$exports, "useColorSlider", () => $d35c65941a2de674$export$106b7a4e66508f66);
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
function $
|
|
18
|
+
function $d35c65941a2de674$export$106b7a4e66508f66(props, state) {
|
|
19
19
|
let { trackRef: trackRef , inputRef: inputRef , orientation: orientation , channel: channel , 'aria-label': ariaLabel } = props;
|
|
20
|
-
let { locale: locale , direction: direction } = $
|
|
20
|
+
let { locale: locale , direction: direction } = $kLMEb$useLocale();
|
|
21
21
|
// Provide a default aria-label if there is no other label provided.
|
|
22
22
|
if (!props.label && !ariaLabel && !props['aria-labelledby']) ariaLabel = state.value.getChannelName(channel, locale);
|
|
23
23
|
// @ts-ignore - ignore unused incompatible props
|
|
24
|
-
let { groupProps: groupProps , trackProps: trackProps , labelProps: labelProps , outputProps: outputProps } = $
|
|
24
|
+
let { groupProps: groupProps , trackProps: trackProps , labelProps: labelProps , outputProps: outputProps } = $kLMEb$useSlider({
|
|
25
25
|
...props,
|
|
26
26
|
'aria-label': ariaLabel
|
|
27
27
|
}, state, trackRef);
|
|
28
|
-
let { inputProps: inputProps , thumbProps: thumbProps } = $
|
|
28
|
+
let { inputProps: inputProps , thumbProps: thumbProps } = $kLMEb$useSliderThumb({
|
|
29
29
|
index: 0,
|
|
30
30
|
orientation: orientation,
|
|
31
31
|
isDisabled: props.isDisabled,
|
|
@@ -71,7 +71,7 @@ function $d984cfa31c77609b$export$106b7a4e66508f66(props, state) {
|
|
|
71
71
|
if (orientation === 'vertical' || direction === 'rtl') thumbPosition = 1 - thumbPosition;
|
|
72
72
|
return {
|
|
73
73
|
trackProps: {
|
|
74
|
-
...$
|
|
74
|
+
...$kLMEb$mergeProps(groupProps, trackProps),
|
|
75
75
|
style: {
|
|
76
76
|
position: 'relative',
|
|
77
77
|
touchAction: 'none',
|
|
@@ -94,26 +94,26 @@ function $d984cfa31c77609b$export$106b7a4e66508f66(props, state) {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
|
|
97
|
-
var $
|
|
97
|
+
var $29049ccc426e44cb$exports = {};
|
|
98
98
|
|
|
99
|
-
$parcel$export($
|
|
99
|
+
$parcel$export($29049ccc426e44cb$exports, "useColorWheel", () => $29049ccc426e44cb$export$9064ff4e44b3729a);
|
|
100
100
|
|
|
101
101
|
|
|
102
102
|
|
|
103
103
|
|
|
104
|
-
const $
|
|
105
|
-
function $
|
|
104
|
+
const $29049ccc426e44cb$var$PAGE_MIN_STEP_SIZE = 6;
|
|
105
|
+
function $29049ccc426e44cb$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
106
106
|
let { isDisabled: isDisabled , step: step = 1 , innerRadius: innerRadius , outerRadius: outerRadius , 'aria-label': ariaLabel } = props;
|
|
107
|
-
let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = $
|
|
107
|
+
let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = $kLMEb$useGlobalListeners();
|
|
108
108
|
let thumbRadius = (innerRadius + outerRadius) / 2;
|
|
109
|
-
let focusInput = $
|
|
110
|
-
if (inputRef.current) $
|
|
109
|
+
let focusInput = $kLMEb$useCallback(()=>{
|
|
110
|
+
if (inputRef.current) $kLMEb$focusWithoutScrolling(inputRef.current);
|
|
111
111
|
}, [
|
|
112
112
|
inputRef
|
|
113
113
|
]);
|
|
114
|
-
let stateRef = $
|
|
114
|
+
let stateRef = $kLMEb$useRef(null);
|
|
115
115
|
stateRef.current = state;
|
|
116
|
-
let currentPosition = $
|
|
116
|
+
let currentPosition = $kLMEb$useRef(null);
|
|
117
117
|
let moveHandler = {
|
|
118
118
|
onMoveStart () {
|
|
119
119
|
currentPosition.current = null;
|
|
@@ -134,10 +134,10 @@ function $57b62b9426efaf0d$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
134
134
|
focusInput();
|
|
135
135
|
}
|
|
136
136
|
};
|
|
137
|
-
let { moveProps: movePropsThumb } = $
|
|
138
|
-
let currentPointer = $
|
|
139
|
-
let isOnTrack = $
|
|
140
|
-
let { moveProps: movePropsContainer } = $
|
|
137
|
+
let { moveProps: movePropsThumb } = $kLMEb$useMove(moveHandler);
|
|
138
|
+
let currentPointer = $kLMEb$useRef(undefined);
|
|
139
|
+
let isOnTrack = $kLMEb$useRef(false);
|
|
140
|
+
let { moveProps: movePropsContainer } = $kLMEb$useMove({
|
|
141
141
|
onMoveStart () {
|
|
142
142
|
if (isOnTrack.current) moveHandler.onMoveStart();
|
|
143
143
|
},
|
|
@@ -206,22 +206,22 @@ function $57b62b9426efaf0d$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
};
|
|
209
|
-
let { keyboardProps: keyboardProps } = $
|
|
209
|
+
let { keyboardProps: keyboardProps } = $kLMEb$useKeyboard({
|
|
210
210
|
onKeyDown (e) {
|
|
211
211
|
switch(e.key){
|
|
212
212
|
case 'PageUp':
|
|
213
213
|
e.preventDefault();
|
|
214
|
-
state.increment($
|
|
214
|
+
state.increment($29049ccc426e44cb$var$PAGE_MIN_STEP_SIZE);
|
|
215
215
|
break;
|
|
216
216
|
case 'PageDown':
|
|
217
217
|
e.preventDefault();
|
|
218
|
-
state.decrement($
|
|
218
|
+
state.decrement($29049ccc426e44cb$var$PAGE_MIN_STEP_SIZE);
|
|
219
219
|
break;
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
});
|
|
223
223
|
let trackInteractions = isDisabled ? {
|
|
224
|
-
} : $
|
|
224
|
+
} : $kLMEb$mergeProps({
|
|
225
225
|
...typeof PointerEvent !== 'undefined' ? {
|
|
226
226
|
onPointerDown: (e)=>{
|
|
227
227
|
if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
|
|
@@ -238,7 +238,7 @@ function $57b62b9426efaf0d$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
238
238
|
}
|
|
239
239
|
}, movePropsContainer);
|
|
240
240
|
let thumbInteractions = isDisabled ? {
|
|
241
|
-
} : $
|
|
241
|
+
} : $kLMEb$mergeProps({
|
|
242
242
|
onMouseDown: (e)=>{
|
|
243
243
|
if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
244
244
|
onThumbDown(undefined);
|
|
@@ -253,9 +253,9 @@ function $57b62b9426efaf0d$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
253
253
|
}, movePropsThumb, keyboardProps);
|
|
254
254
|
let { x: x1 , y: y1 } = state.getThumbPosition(thumbRadius);
|
|
255
255
|
// Provide a default aria-label if none is given
|
|
256
|
-
let { locale: locale } = $
|
|
256
|
+
let { locale: locale } = $kLMEb$useLocale();
|
|
257
257
|
if (ariaLabel == null && props['aria-labelledby'] == null) ariaLabel = state.value.getChannelName('hue', locale);
|
|
258
|
-
let inputLabellingProps = $
|
|
258
|
+
let inputLabellingProps = $kLMEb$useLabels({
|
|
259
259
|
...props,
|
|
260
260
|
'aria-label': ariaLabel
|
|
261
261
|
});
|
|
@@ -285,7 +285,7 @@ function $57b62b9426efaf0d$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
285
285
|
hsl(360, 100%, 50%)
|
|
286
286
|
)
|
|
287
287
|
`,
|
|
288
|
-
clipPath: `path(evenodd, "${$
|
|
288
|
+
clipPath: `path(evenodd, "${$29049ccc426e44cb$var$circlePath(outerRadius, outerRadius, outerRadius)} ${$29049ccc426e44cb$var$circlePath(outerRadius, outerRadius, innerRadius)}")`
|
|
289
289
|
}
|
|
290
290
|
},
|
|
291
291
|
thumbProps: {
|
|
@@ -298,7 +298,7 @@ function $57b62b9426efaf0d$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
298
298
|
touchAction: 'none'
|
|
299
299
|
}
|
|
300
300
|
},
|
|
301
|
-
inputProps: $
|
|
301
|
+
inputProps: $kLMEb$mergeProps(inputLabellingProps, {
|
|
302
302
|
type: 'range',
|
|
303
303
|
min: '0',
|
|
304
304
|
max: '360',
|
|
@@ -313,24 +313,24 @@ function $57b62b9426efaf0d$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
313
313
|
};
|
|
314
314
|
}
|
|
315
315
|
// Creates an SVG path string for a circle.
|
|
316
|
-
function $
|
|
316
|
+
function $29049ccc426e44cb$var$circlePath(cx, cy, r) {
|
|
317
317
|
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`;
|
|
318
318
|
}
|
|
319
319
|
|
|
320
320
|
|
|
321
|
-
var $
|
|
321
|
+
var $42d92523b2461444$exports = {};
|
|
322
322
|
|
|
323
|
-
$parcel$export($
|
|
323
|
+
$parcel$export($42d92523b2461444$exports, "useColorField", () => $42d92523b2461444$export$77e32ca575a28fdf);
|
|
324
324
|
|
|
325
325
|
|
|
326
326
|
|
|
327
327
|
|
|
328
328
|
|
|
329
|
-
function $
|
|
329
|
+
function $42d92523b2461444$export$77e32ca575a28fdf(props, state, ref) {
|
|
330
330
|
let { isDisabled: isDisabled , isReadOnly: isReadOnly , isRequired: isRequired } = props;
|
|
331
331
|
let { colorValue: colorValue , inputValue: inputValue , commit: commit , increment: increment , decrement: decrement , incrementToMax: incrementToMax , decrementToMin: decrementToMin } = state;
|
|
332
|
-
let inputId = $
|
|
333
|
-
let { spinButtonProps: spinButtonProps } = $
|
|
332
|
+
let inputId = $kLMEb$useId();
|
|
333
|
+
let { spinButtonProps: spinButtonProps } = $kLMEb$useSpinButton({
|
|
334
334
|
isDisabled: isDisabled,
|
|
335
335
|
isReadOnly: isReadOnly,
|
|
336
336
|
isRequired: isRequired,
|
|
@@ -343,12 +343,12 @@ function $2a22f80414e6430f$export$77e32ca575a28fdf(props, state, ref) {
|
|
|
343
343
|
value: colorValue ? colorValue.toHexInt() : undefined,
|
|
344
344
|
textValue: colorValue ? colorValue.toString('hex') : undefined
|
|
345
345
|
});
|
|
346
|
-
let [focusWithin, setFocusWithin] = $
|
|
347
|
-
let { focusWithinProps: focusWithinProps } = $
|
|
346
|
+
let [focusWithin, setFocusWithin] = $kLMEb$useState(false);
|
|
347
|
+
let { focusWithinProps: focusWithinProps } = $kLMEb$useFocusWithin({
|
|
348
348
|
isDisabled: isDisabled,
|
|
349
349
|
onFocusWithinChange: setFocusWithin
|
|
350
350
|
});
|
|
351
|
-
let onWheel = $
|
|
351
|
+
let onWheel = $kLMEb$useCallback((e)=>{
|
|
352
352
|
if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) return;
|
|
353
353
|
if (e.deltaY > 0) increment();
|
|
354
354
|
else if (e.deltaY < 0) decrement();
|
|
@@ -360,14 +360,14 @@ function $2a22f80414e6430f$export$77e32ca575a28fdf(props, state, ref) {
|
|
|
360
360
|
]);
|
|
361
361
|
// If the input isn't supposed to receive input, disable scrolling.
|
|
362
362
|
let scrollingDisabled = isDisabled || isReadOnly || !focusWithin;
|
|
363
|
-
$
|
|
363
|
+
$kLMEb$useScrollWheel({
|
|
364
364
|
onScroll: onWheel,
|
|
365
365
|
isDisabled: scrollingDisabled
|
|
366
366
|
}, ref);
|
|
367
367
|
let onChange = (value)=>{
|
|
368
368
|
state.setInputValue(value);
|
|
369
369
|
};
|
|
370
|
-
let { labelProps: labelProps , inputProps: inputProps } = $
|
|
370
|
+
let { labelProps: labelProps , inputProps: inputProps } = $kLMEb$useFormattedTextField($kLMEb$mergeProps(props, {
|
|
371
371
|
id: inputId,
|
|
372
372
|
value: inputValue,
|
|
373
373
|
defaultValue: undefined,
|
|
@@ -377,7 +377,7 @@ function $2a22f80414e6430f$export$77e32ca575a28fdf(props, state, ref) {
|
|
|
377
377
|
}), state, ref);
|
|
378
378
|
return {
|
|
379
379
|
labelProps: labelProps,
|
|
380
|
-
inputProps: $
|
|
380
|
+
inputProps: $kLMEb$mergeProps(inputProps, spinButtonProps, focusWithinProps, {
|
|
381
381
|
role: 'textbox',
|
|
382
382
|
'aria-valuemax': null,
|
|
383
383
|
'aria-valuemin': null,
|
|
@@ -393,5 +393,5 @@ function $2a22f80414e6430f$export$77e32ca575a28fdf(props, state, ref) {
|
|
|
393
393
|
|
|
394
394
|
|
|
395
395
|
|
|
396
|
-
export {$
|
|
396
|
+
export {$d35c65941a2de674$export$106b7a4e66508f66 as useColorSlider, $29049ccc426e44cb$export$9064ff4e44b3729a as useColorWheel, $42d92523b2461444$export$77e32ca575a28fdf as useColorField};
|
|
397
397
|
//# sourceMappingURL=module.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/color",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.3100+da2aa7467",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -18,16 +18,16 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@babel/runtime": "^7.6.2",
|
|
21
|
-
"@react-aria/i18n": "3.0.0-nightly.
|
|
22
|
-
"@react-aria/interactions": "3.0.0-nightly.
|
|
23
|
-
"@react-aria/slider": "3.0.4-nightly.
|
|
24
|
-
"@react-aria/spinbutton": "3.0.0-nightly.
|
|
25
|
-
"@react-aria/textfield": "3.0.0-nightly.
|
|
26
|
-
"@react-aria/utils": "3.0.0-nightly.
|
|
27
|
-
"@react-stately/color": "3.0.0-nightly.
|
|
28
|
-
"@react-types/color": "3.0.0-nightly.
|
|
29
|
-
"@react-types/shared": "3.0.0-nightly.
|
|
30
|
-
"@react-types/slider": "3.0.3-nightly.
|
|
21
|
+
"@react-aria/i18n": "3.0.0-nightly.1409+da2aa7467",
|
|
22
|
+
"@react-aria/interactions": "3.0.0-nightly.1409+da2aa7467",
|
|
23
|
+
"@react-aria/slider": "3.0.4-nightly.3100+da2aa7467",
|
|
24
|
+
"@react-aria/spinbutton": "3.0.0-nightly.1409+da2aa7467",
|
|
25
|
+
"@react-aria/textfield": "3.0.0-nightly.1409+da2aa7467",
|
|
26
|
+
"@react-aria/utils": "3.0.0-nightly.1409+da2aa7467",
|
|
27
|
+
"@react-stately/color": "3.0.0-nightly.3100+da2aa7467",
|
|
28
|
+
"@react-types/color": "3.0.0-nightly.3100+da2aa7467",
|
|
29
|
+
"@react-types/shared": "3.0.0-nightly.1409+da2aa7467",
|
|
30
|
+
"@react-types/slider": "3.0.3-nightly.3100+da2aa7467"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"react": "^16.8.0 || ^17.0.0-rc.1",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "da2aa74670fbd93335ff01401ca53826b3602777"
|
|
40
40
|
}
|