@react-aria/color 3.0.0-beta.7 → 3.0.0-beta.8
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 +57 -53
- package/dist/main.js.map +1 -1
- package/dist/module.js +55 -51
- package/dist/module.js.map +1 -1
- 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 $9VynS$reactariautils = require("@react-aria/utils");
|
|
2
|
+
var $9VynS$reactariai18n = require("@react-aria/i18n");
|
|
3
|
+
var $9VynS$reactariaslider = require("@react-aria/slider");
|
|
4
|
+
var $9VynS$react = require("react");
|
|
5
|
+
var $9VynS$reactariainteractions = require("@react-aria/interactions");
|
|
6
|
+
var $9VynS$reactariatextfield = require("@react-aria/textfield");
|
|
7
|
+
var $9VynS$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 $9b39dbd4f9acd144$exports = {};
|
|
29
29
|
|
|
30
|
-
$parcel$export($
|
|
30
|
+
$parcel$export($9b39dbd4f9acd144$exports, "useColorSlider", () => $9b39dbd4f9acd144$export$106b7a4e66508f66);
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
function $
|
|
34
|
+
function $9b39dbd4f9acd144$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 } = $9VynS$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 } = $9VynS$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 } = $9VynS$reactariaslider.useSliderThumb({
|
|
45
45
|
index: 0,
|
|
46
46
|
orientation: orientation,
|
|
47
47
|
isDisabled: props.isDisabled,
|
|
@@ -87,7 +87,7 @@ function $65c158f0c1f3086b$export$106b7a4e66508f66(props, state) {
|
|
|
87
87
|
if (orientation === 'vertical' || direction === 'rtl') thumbPosition = 1 - thumbPosition;
|
|
88
88
|
return {
|
|
89
89
|
trackProps: {
|
|
90
|
-
...$
|
|
90
|
+
...$9VynS$reactariautils.mergeProps(groupProps, trackProps),
|
|
91
91
|
style: {
|
|
92
92
|
position: 'relative',
|
|
93
93
|
touchAction: 'none',
|
|
@@ -110,26 +110,26 @@ function $65c158f0c1f3086b$export$106b7a4e66508f66(props, state) {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
|
|
113
|
-
var $
|
|
113
|
+
var $e5063b6d79973c73$exports = {};
|
|
114
114
|
|
|
115
|
-
$parcel$export($
|
|
115
|
+
$parcel$export($e5063b6d79973c73$exports, "useColorWheel", () => $e5063b6d79973c73$export$9064ff4e44b3729a);
|
|
116
116
|
|
|
117
117
|
|
|
118
118
|
|
|
119
119
|
|
|
120
|
-
const $
|
|
121
|
-
function $
|
|
120
|
+
const $e5063b6d79973c73$var$PAGE_MIN_STEP_SIZE = 6;
|
|
121
|
+
function $e5063b6d79973c73$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 } = $9VynS$reactariautils.useGlobalListeners();
|
|
124
124
|
let thumbRadius = (innerRadius + outerRadius) / 2;
|
|
125
|
-
let focusInput = $
|
|
126
|
-
if (inputRef.current) $
|
|
125
|
+
let focusInput = $9VynS$react.useCallback(()=>{
|
|
126
|
+
if (inputRef.current) $9VynS$reactariautils.focusWithoutScrolling(inputRef.current);
|
|
127
127
|
}, [
|
|
128
128
|
inputRef
|
|
129
129
|
]);
|
|
130
|
-
let stateRef = $
|
|
130
|
+
let stateRef = $9VynS$react.useRef(null);
|
|
131
131
|
stateRef.current = state;
|
|
132
|
-
let currentPosition = $
|
|
132
|
+
let currentPosition = $9VynS$react.useRef(null);
|
|
133
133
|
let moveHandler = {
|
|
134
134
|
onMoveStart () {
|
|
135
135
|
currentPosition.current = null;
|
|
@@ -150,10 +150,10 @@ function $f52a5d5adb728369$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 } = $9VynS$reactariainteractions.useMove(moveHandler);
|
|
154
|
+
let currentPointer = $9VynS$react.useRef(undefined);
|
|
155
|
+
let isOnTrack = $9VynS$react.useRef(false);
|
|
156
|
+
let { moveProps: movePropsContainer } = $9VynS$reactariainteractions.useMove({
|
|
157
157
|
onMoveStart () {
|
|
158
158
|
if (isOnTrack.current) moveHandler.onMoveStart();
|
|
159
159
|
},
|
|
@@ -177,7 +177,9 @@ function $f52a5d5adb728369$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
177
177
|
}
|
|
178
178
|
};
|
|
179
179
|
let onThumbUp = (e)=>{
|
|
180
|
-
|
|
180
|
+
var ref;
|
|
181
|
+
var _pointerId;
|
|
182
|
+
let id = (_pointerId = e.pointerId) !== null && _pointerId !== void 0 ? _pointerId : (ref = e.changedTouches) === null || ref === void 0 ? void 0 : ref[0].identifier;
|
|
181
183
|
if (id === currentPointer.current) {
|
|
182
184
|
focusInput();
|
|
183
185
|
state.setDragging(false);
|
|
@@ -209,7 +211,9 @@ function $f52a5d5adb728369$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
209
211
|
}
|
|
210
212
|
};
|
|
211
213
|
let onTrackUp = (e)=>{
|
|
212
|
-
|
|
214
|
+
var ref;
|
|
215
|
+
var _pointerId;
|
|
216
|
+
let id = (_pointerId = e.pointerId) !== null && _pointerId !== void 0 ? _pointerId : (ref = e.changedTouches) === null || ref === void 0 ? void 0 : ref[0].identifier;
|
|
213
217
|
if (isOnTrack.current && id === currentPointer.current) {
|
|
214
218
|
isOnTrack.current = false;
|
|
215
219
|
currentPointer.current = undefined;
|
|
@@ -222,22 +226,22 @@ function $f52a5d5adb728369$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
222
226
|
}
|
|
223
227
|
}
|
|
224
228
|
};
|
|
225
|
-
let { keyboardProps: keyboardProps } = $
|
|
229
|
+
let { keyboardProps: keyboardProps } = $9VynS$reactariainteractions.useKeyboard({
|
|
226
230
|
onKeyDown (e) {
|
|
227
231
|
switch(e.key){
|
|
228
232
|
case 'PageUp':
|
|
229
233
|
e.preventDefault();
|
|
230
|
-
state.increment($
|
|
234
|
+
state.increment($e5063b6d79973c73$var$PAGE_MIN_STEP_SIZE);
|
|
231
235
|
break;
|
|
232
236
|
case 'PageDown':
|
|
233
237
|
e.preventDefault();
|
|
234
|
-
state.decrement($
|
|
238
|
+
state.decrement($e5063b6d79973c73$var$PAGE_MIN_STEP_SIZE);
|
|
235
239
|
break;
|
|
236
240
|
}
|
|
237
241
|
}
|
|
238
242
|
});
|
|
239
243
|
let trackInteractions = isDisabled ? {
|
|
240
|
-
} : $
|
|
244
|
+
} : $9VynS$reactariautils.mergeProps({
|
|
241
245
|
...typeof PointerEvent !== 'undefined' ? {
|
|
242
246
|
onPointerDown: (e)=>{
|
|
243
247
|
if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
|
|
@@ -254,7 +258,7 @@ function $f52a5d5adb728369$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
254
258
|
}
|
|
255
259
|
}, movePropsContainer);
|
|
256
260
|
let thumbInteractions = isDisabled ? {
|
|
257
|
-
} : $
|
|
261
|
+
} : $9VynS$reactariautils.mergeProps({
|
|
258
262
|
onMouseDown: (e)=>{
|
|
259
263
|
if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
260
264
|
onThumbDown(undefined);
|
|
@@ -269,9 +273,9 @@ function $f52a5d5adb728369$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
269
273
|
}, movePropsThumb, keyboardProps);
|
|
270
274
|
let { x: x1 , y: y1 } = state.getThumbPosition(thumbRadius);
|
|
271
275
|
// Provide a default aria-label if none is given
|
|
272
|
-
let { locale: locale } = $
|
|
276
|
+
let { locale: locale } = $9VynS$reactariai18n.useLocale();
|
|
273
277
|
if (ariaLabel == null && props['aria-labelledby'] == null) ariaLabel = state.value.getChannelName('hue', locale);
|
|
274
|
-
let inputLabellingProps = $
|
|
278
|
+
let inputLabellingProps = $9VynS$reactariautils.useLabels({
|
|
275
279
|
...props,
|
|
276
280
|
'aria-label': ariaLabel
|
|
277
281
|
});
|
|
@@ -301,7 +305,7 @@ function $f52a5d5adb728369$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
301
305
|
hsl(360, 100%, 50%)
|
|
302
306
|
)
|
|
303
307
|
`,
|
|
304
|
-
clipPath: `path(evenodd, "${$
|
|
308
|
+
clipPath: `path(evenodd, "${$e5063b6d79973c73$var$circlePath(outerRadius, outerRadius, outerRadius)} ${$e5063b6d79973c73$var$circlePath(outerRadius, outerRadius, innerRadius)}")`
|
|
305
309
|
}
|
|
306
310
|
},
|
|
307
311
|
thumbProps: {
|
|
@@ -314,7 +318,7 @@ function $f52a5d5adb728369$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
314
318
|
touchAction: 'none'
|
|
315
319
|
}
|
|
316
320
|
},
|
|
317
|
-
inputProps: $
|
|
321
|
+
inputProps: $9VynS$reactariautils.mergeProps(inputLabellingProps, {
|
|
318
322
|
type: 'range',
|
|
319
323
|
min: '0',
|
|
320
324
|
max: '360',
|
|
@@ -329,24 +333,24 @@ function $f52a5d5adb728369$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
329
333
|
};
|
|
330
334
|
}
|
|
331
335
|
// Creates an SVG path string for a circle.
|
|
332
|
-
function $
|
|
336
|
+
function $e5063b6d79973c73$var$circlePath(cx, cy, r) {
|
|
333
337
|
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
338
|
}
|
|
335
339
|
|
|
336
340
|
|
|
337
|
-
var $
|
|
341
|
+
var $0542a73d68f06faa$exports = {};
|
|
338
342
|
|
|
339
|
-
$parcel$export($
|
|
343
|
+
$parcel$export($0542a73d68f06faa$exports, "useColorField", () => $0542a73d68f06faa$export$77e32ca575a28fdf);
|
|
340
344
|
|
|
341
345
|
|
|
342
346
|
|
|
343
347
|
|
|
344
348
|
|
|
345
|
-
function $
|
|
349
|
+
function $0542a73d68f06faa$export$77e32ca575a28fdf(props, state, ref) {
|
|
346
350
|
let { isDisabled: isDisabled , isReadOnly: isReadOnly , isRequired: isRequired } = props;
|
|
347
351
|
let { colorValue: colorValue , inputValue: inputValue , commit: commit , increment: increment , decrement: decrement , incrementToMax: incrementToMax , decrementToMin: decrementToMin } = state;
|
|
348
|
-
let inputId = $
|
|
349
|
-
let { spinButtonProps: spinButtonProps } = $
|
|
352
|
+
let inputId = $9VynS$reactariautils.useId();
|
|
353
|
+
let { spinButtonProps: spinButtonProps } = $9VynS$reactariaspinbutton.useSpinButton({
|
|
350
354
|
isDisabled: isDisabled,
|
|
351
355
|
isReadOnly: isReadOnly,
|
|
352
356
|
isRequired: isRequired,
|
|
@@ -359,12 +363,12 @@ function $a03d78c6bebe68f6$export$77e32ca575a28fdf(props, state, ref) {
|
|
|
359
363
|
value: colorValue ? colorValue.toHexInt() : undefined,
|
|
360
364
|
textValue: colorValue ? colorValue.toString('hex') : undefined
|
|
361
365
|
});
|
|
362
|
-
let [focusWithin, setFocusWithin] = $
|
|
363
|
-
let { focusWithinProps: focusWithinProps } = $
|
|
366
|
+
let [focusWithin, setFocusWithin] = $9VynS$react.useState(false);
|
|
367
|
+
let { focusWithinProps: focusWithinProps } = $9VynS$reactariainteractions.useFocusWithin({
|
|
364
368
|
isDisabled: isDisabled,
|
|
365
369
|
onFocusWithinChange: setFocusWithin
|
|
366
370
|
});
|
|
367
|
-
let onWheel = $
|
|
371
|
+
let onWheel = $9VynS$react.useCallback((e)=>{
|
|
368
372
|
if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) return;
|
|
369
373
|
if (e.deltaY > 0) increment();
|
|
370
374
|
else if (e.deltaY < 0) decrement();
|
|
@@ -376,14 +380,14 @@ function $a03d78c6bebe68f6$export$77e32ca575a28fdf(props, state, ref) {
|
|
|
376
380
|
]);
|
|
377
381
|
// If the input isn't supposed to receive input, disable scrolling.
|
|
378
382
|
let scrollingDisabled = isDisabled || isReadOnly || !focusWithin;
|
|
379
|
-
$
|
|
383
|
+
$9VynS$reactariainteractions.useScrollWheel({
|
|
380
384
|
onScroll: onWheel,
|
|
381
385
|
isDisabled: scrollingDisabled
|
|
382
386
|
}, ref);
|
|
383
387
|
let onChange = (value)=>{
|
|
384
388
|
state.setInputValue(value);
|
|
385
389
|
};
|
|
386
|
-
let { labelProps: labelProps , inputProps: inputProps } = $
|
|
390
|
+
let { labelProps: labelProps , inputProps: inputProps } = $9VynS$reactariatextfield.useFormattedTextField($9VynS$reactariautils.mergeProps(props, {
|
|
387
391
|
id: inputId,
|
|
388
392
|
value: inputValue,
|
|
389
393
|
defaultValue: undefined,
|
|
@@ -393,7 +397,7 @@ function $a03d78c6bebe68f6$export$77e32ca575a28fdf(props, state, ref) {
|
|
|
393
397
|
}), state, ref);
|
|
394
398
|
return {
|
|
395
399
|
labelProps: labelProps,
|
|
396
|
-
inputProps: $
|
|
400
|
+
inputProps: $9VynS$reactariautils.mergeProps(inputProps, spinButtonProps, focusWithinProps, {
|
|
397
401
|
role: 'textbox',
|
|
398
402
|
'aria-valuemax': null,
|
|
399
403
|
'aria-valuemin': null,
|
|
@@ -407,9 +411,9 @@ function $a03d78c6bebe68f6$export$77e32ca575a28fdf(props, state, ref) {
|
|
|
407
411
|
}
|
|
408
412
|
|
|
409
413
|
|
|
410
|
-
$parcel$exportWildcard(module.exports, $
|
|
411
|
-
$parcel$exportWildcard(module.exports, $
|
|
412
|
-
$parcel$exportWildcard(module.exports, $
|
|
414
|
+
$parcel$exportWildcard(module.exports, $9b39dbd4f9acd144$exports);
|
|
415
|
+
$parcel$exportWildcard(module.exports, $e5063b6d79973c73$exports);
|
|
416
|
+
$parcel$exportWildcard(module.exports, $0542a73d68f06faa$exports);
|
|
413
417
|
|
|
414
418
|
|
|
415
419
|
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SC2CgB,yCAAc,CA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BAAiB,GAAG,UAAU,IAAI,UAAU,KAAK,WAAW;IAChE,2CAAc,CAAC,CAAC;QAAA,QAAQ,EAAE,OAAO;QAAE,UAAU,EAAE,iBAAiB;IAAA,CAAC,EAAE,GAAG;IAEtE,GAAG,CAAC,QAAQ,IAAG,KAAK,GAAI,CAAC;QACvB,KAAK,CAAC,aAAa,CAAC,KAAK;IAC3B,CAAC;IAED,GAAG,CAAC,CAAC,aAAA,UAAU,eAAE,UAAU,EAAA,CAAC,GAAG,+CAAqB,CAClD,gCAAU,CAAC,KAAK,EAAE,CAAC;QACjB,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,UAAU;QACjB,YAAY,EAAE,SAAS;QACvB,IAAI,EAAE,CAAM;QACZ,YAAY,EAAE,CAAK;kBACnB,QAAQ;IACV,CAAC,GAAG,KAAK,EAAE,GAAG;IAEhB,MAAM,CAAC,CAAC;oBACN,UAAU;QACV,UAAU,EAAE,gCAAU,CAAC,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,CAAC;YACrE,IAAI,EAAE,CAAS;YACf,CAAe,gBAAE,IAAI;YACrB,CAAe,gBAAE,IAAI;YACrB,CAAe,gBAAE,IAAI;YACrB,CAAgB,iBAAE,IAAI;YACtB,WAAW,EAAE,CAAK;YAClB,UAAU,EAAE,CAAO;YACnB,MAAM,EAAE,MAAM;QAChB,CAAC;IACH,CAAC;AACH,CAAC;","sources":["packages/@react-aria/color/src/index.ts","packages/@react-aria/color/src/useColorSlider.ts","packages/@react-aria/color/src/useColorWheel.ts","packages/@react-aria/color/src/useColorField.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport * from './useColorSlider';\nexport * from './useColorWheel';\nexport * from './useColorField';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaColorSliderProps} from '@react-types/color';\nimport {ColorSliderState} from '@react-stately/color';\nimport {HTMLAttributes, RefObject} from 'react';\nimport {mergeProps} from '@react-aria/utils';\nimport {useLocale} from '@react-aria/i18n';\nimport {useSlider, useSliderThumb} from '@react-aria/slider';\n\ninterface ColorSliderAriaOptions extends AriaColorSliderProps {\n /** A ref for the track element. */\n trackRef: RefObject<HTMLElement>,\n /** A ref for the input element. */\n inputRef: RefObject<HTMLInputElement>\n}\n\ninterface ColorSliderAria {\n /** Props for the label element. */\n labelProps: HTMLAttributes<HTMLElement>,\n /** Props for the track element. */\n trackProps: HTMLAttributes<HTMLElement>,\n /** Props for the thumb element. */\n thumbProps: HTMLAttributes<HTMLElement>,\n /** Props for the visually hidden range input element. */\n inputProps: HTMLAttributes<HTMLElement>,\n /** Props for the output element, displaying the value of the color slider. */\n outputProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a color slider component.\n * Color sliders allow users to adjust an individual channel of a color value.\n */\nexport function useColorSlider(props: ColorSliderAriaOptions, state: ColorSliderState): ColorSliderAria {\n let {trackRef, inputRef, orientation, channel, 'aria-label': ariaLabel} = props;\n\n let {locale, direction} = useLocale();\n\n // Provide a default aria-label if there is no other label provided.\n if (!props.label && !ariaLabel && !props['aria-labelledby']) {\n ariaLabel = state.value.getChannelName(channel, locale);\n }\n\n // @ts-ignore - ignore unused incompatible props\n let {groupProps, trackProps, labelProps, outputProps} = useSlider({...props, 'aria-label': ariaLabel}, state, trackRef);\n let {inputProps, thumbProps} = useSliderThumb({\n index: 0,\n orientation,\n isDisabled: props.isDisabled,\n trackRef,\n inputRef\n }, state);\n\n let generateBackground = () => {\n let value = state.getDisplayColor();\n let to: string;\n if (orientation === 'vertical') {\n to = 'top';\n } else if (direction === 'ltr') {\n to = 'right';\n } else {\n to = 'left';\n }\n switch (channel) {\n case 'hue':\n return `linear-gradient(to ${to}, rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%)`;\n case 'lightness': {\n // We have to add an extra color stop in the middle so that the hue shows up at all.\n // Otherwise it will always just be black to white.\n let min = state.getThumbMinValue(0);\n let max = state.getThumbMaxValue(0);\n let start = value.withChannelValue(channel, min).toString('css');\n let middle = value.withChannelValue(channel, (max - min) / 2).toString('css');\n let end = value.withChannelValue(channel, max).toString('css');\n return `linear-gradient(to ${to}, ${start}, ${middle}, ${end})`;\n }\n case 'saturation':\n case 'brightness':\n case 'red':\n case 'green':\n case 'blue':\n case 'alpha': {\n let start = value.withChannelValue(channel, state.getThumbMinValue(0)).toString('css');\n let end = value.withChannelValue(channel, state.getThumbMaxValue(0)).toString('css');\n return `linear-gradient(to ${to}, ${start}, ${end})`;\n }\n default:\n throw new Error('Unknown color channel: ' + channel);\n }\n };\n\n let thumbPosition = state.getThumbPercent(0);\n if (orientation === 'vertical' || direction === 'rtl') {\n thumbPosition = 1 - thumbPosition;\n }\n\n return {\n trackProps: {\n ...mergeProps(groupProps, trackProps),\n style: {\n position: 'relative',\n touchAction: 'none',\n background: generateBackground()\n }\n },\n inputProps,\n thumbProps: {\n ...thumbProps,\n style: {\n touchAction: 'none',\n position: 'absolute',\n [orientation === 'vertical' ? 'top' : 'left']: `${thumbPosition * 100}%`,\n transform: 'translate(-50%, -50%)'\n }\n },\n labelProps,\n outputProps\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaColorWheelProps} from '@react-types/color';\nimport {ColorWheelState} from '@react-stately/color';\nimport {focusWithoutScrolling, mergeProps, useGlobalListeners, useLabels} from '@react-aria/utils';\nimport React, {ChangeEvent, HTMLAttributes, InputHTMLAttributes, RefObject, useCallback, useRef} from 'react';\nimport {useKeyboard, useMove} from '@react-aria/interactions';\nimport {useLocale} from '@react-aria/i18n';\n\ninterface ColorWheelAriaProps extends AriaColorWheelProps {\n /** The outer radius of the color wheel. */\n outerRadius: number,\n /** The inner radius of the color wheel. */\n innerRadius: number\n}\n\ninterface ColorWheelAria {\n /** Props for the track element. */\n trackProps: HTMLAttributes<HTMLElement>,\n /** Props for the thumb element. */\n thumbProps: HTMLAttributes<HTMLElement>,\n /** Props for the visually hidden range input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>\n}\n\nconst PAGE_MIN_STEP_SIZE = 6;\n\n/**\n * Provides the behavior and accessibility implementation for a color wheel component.\n * Color wheels allow users to adjust the hue of an HSL or HSB color value on a circular track.\n */\nexport function useColorWheel(props: ColorWheelAriaProps, state: ColorWheelState, inputRef: RefObject<HTMLElement>): ColorWheelAria {\n let {\n isDisabled,\n step = 1,\n innerRadius,\n outerRadius,\n 'aria-label': ariaLabel\n } = props;\n\n let {addGlobalListener, removeGlobalListener} = useGlobalListeners();\n\n let thumbRadius = (innerRadius + outerRadius) / 2;\n\n let focusInput = useCallback(() => {\n if (inputRef.current) {\n focusWithoutScrolling(inputRef.current);\n }\n }, [inputRef]);\n\n let stateRef = useRef<ColorWheelState>(null);\n stateRef.current = state;\n\n let currentPosition = useRef<{x: number, y: number}>(null);\n let moveHandler = {\n onMoveStart() {\n currentPosition.current = null;\n state.setDragging(true);\n },\n onMove({deltaX, deltaY, pointerType}) {\n if (currentPosition.current == null) {\n currentPosition.current = stateRef.current.getThumbPosition(thumbRadius);\n }\n currentPosition.current.x += deltaX;\n currentPosition.current.y += deltaY;\n if (pointerType === 'keyboard') {\n if (deltaX > 0 || deltaY < 0) {\n state.increment();\n } else if (deltaX < 0 || deltaY > 0) {\n state.decrement();\n }\n } else {\n stateRef.current.setHueFromPoint(currentPosition.current.x, currentPosition.current.y, thumbRadius);\n }\n },\n onMoveEnd() {\n isOnTrack.current = undefined;\n state.setDragging(false);\n focusInput();\n }\n };\n let {moveProps: movePropsThumb} = useMove(moveHandler);\n\n let currentPointer = useRef<number | null | undefined>(undefined);\n let isOnTrack = useRef<boolean>(false);\n let {moveProps: movePropsContainer} = useMove({\n onMoveStart() {\n if (isOnTrack.current) {\n moveHandler.onMoveStart();\n }\n },\n onMove(e) {\n if (isOnTrack.current) {\n moveHandler.onMove(e);\n }\n },\n onMoveEnd() {\n if (isOnTrack.current) {\n moveHandler.onMoveEnd();\n }\n }\n });\n\n let onThumbDown = (id: number | null) => {\n if (!state.isDragging) {\n currentPointer.current = id;\n focusInput();\n state.setDragging(true);\n\n if (typeof PointerEvent !== 'undefined') {\n addGlobalListener(window, 'pointerup', onThumbUp, false);\n } else {\n addGlobalListener(window, 'mouseup', onThumbUp, false);\n addGlobalListener(window, 'touchend', onThumbUp, false);\n }\n }\n };\n\n let onThumbUp = (e) => {\n let id = e.pointerId ?? e.changedTouches?.[0].identifier;\n if (id === currentPointer.current) {\n focusInput();\n state.setDragging(false);\n currentPointer.current = undefined;\n isOnTrack.current = false;\n\n if (typeof PointerEvent !== 'undefined') {\n removeGlobalListener(window, 'pointerup', onThumbUp, false);\n } else {\n removeGlobalListener(window, 'mouseup', onThumbUp, false);\n removeGlobalListener(window, 'touchend', onThumbUp, false);\n }\n }\n };\n\n let onTrackDown = (track: Element, id: number | null, pageX: number, pageY: number) => {\n let rect = track.getBoundingClientRect();\n let x = pageX - rect.x - rect.width / 2;\n let y = pageY - rect.y - rect.height / 2;\n let radius = Math.sqrt(x * x + y * y);\n if (innerRadius < radius && radius < outerRadius && !state.isDragging && currentPointer.current === undefined) {\n isOnTrack.current = true;\n currentPointer.current = id;\n stateRef.current.setHueFromPoint(x, y, radius);\n\n focusInput();\n state.setDragging(true);\n\n if (typeof PointerEvent !== 'undefined') {\n addGlobalListener(window, 'pointerup', onTrackUp, false);\n } else {\n addGlobalListener(window, 'mouseup', onTrackUp, false);\n addGlobalListener(window, 'touchend', onTrackUp, false);\n }\n }\n };\n\n let onTrackUp = (e) => {\n let id = e.pointerId ?? e.changedTouches?.[0].identifier;\n if (isOnTrack.current && id === currentPointer.current) {\n isOnTrack.current = false;\n currentPointer.current = undefined;\n state.setDragging(false);\n focusInput();\n\n\n if (typeof PointerEvent !== 'undefined') {\n removeGlobalListener(window, 'pointerup', onTrackUp, false);\n } else {\n removeGlobalListener(window, 'mouseup', onTrackUp, false);\n removeGlobalListener(window, 'touchend', onTrackUp, false);\n }\n }\n };\n\n let {keyboardProps} = useKeyboard({\n onKeyDown(e) {\n switch (e.key) {\n case 'PageUp':\n e.preventDefault();\n state.increment(PAGE_MIN_STEP_SIZE);\n break;\n case 'PageDown':\n e.preventDefault();\n state.decrement(PAGE_MIN_STEP_SIZE);\n break;\n }\n }\n });\n\n let trackInteractions = isDisabled ? {} : mergeProps({\n ...(typeof PointerEvent !== 'undefined' ? {\n onPointerDown: (e: React.PointerEvent) => {\n if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) {\n return;\n }\n onTrackDown(e.currentTarget, e.pointerId, e.clientX, e.clientY);\n }} : {\n onMouseDown: (e: React.MouseEvent) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onTrackDown(e.currentTarget, undefined, e.clientX, e.clientY);\n },\n onTouchStart: (e: React.TouchEvent) => {\n onTrackDown(e.currentTarget, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY);\n }\n })\n }, movePropsContainer);\n\n let thumbInteractions = isDisabled ? {} : mergeProps({\n onMouseDown: (e: React.MouseEvent) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onThumbDown(undefined);\n },\n onPointerDown: (e: React.PointerEvent) => {\n if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) {\n return;\n }\n onThumbDown(e.pointerId);\n },\n onTouchStart: (e: React.TouchEvent) => {\n onThumbDown(e.changedTouches[0].identifier);\n }\n }, movePropsThumb, keyboardProps);\n let {x, y} = state.getThumbPosition(thumbRadius);\n\n // Provide a default aria-label if none is given\n let {locale} = useLocale();\n if (ariaLabel == null && props['aria-labelledby'] == null) {\n ariaLabel = state.value.getChannelName('hue', locale);\n }\n\n let inputLabellingProps = useLabels({\n ...props,\n 'aria-label': ariaLabel\n });\n\n return {\n trackProps: {\n ...trackInteractions,\n style: {\n position: 'relative',\n touchAction: 'none',\n width: outerRadius * 2,\n height: outerRadius * 2,\n background: `\n conic-gradient(\n from 90deg,\n hsl(0, 100%, 50%),\n hsl(30, 100%, 50%),\n hsl(60, 100%, 50%),\n hsl(90, 100%, 50%),\n hsl(120, 100%, 50%),\n hsl(150, 100%, 50%),\n hsl(180, 100%, 50%),\n hsl(210, 100%, 50%),\n hsl(240, 100%, 50%),\n hsl(270, 100%, 50%),\n hsl(300, 100%, 50%),\n hsl(330, 100%, 50%),\n hsl(360, 100%, 50%)\n )\n `,\n clipPath: `path(evenodd, \"${circlePath(outerRadius, outerRadius, outerRadius)} ${circlePath(outerRadius, outerRadius, innerRadius)}\")`\n }\n },\n thumbProps: {\n ...thumbInteractions,\n style: {\n position: 'absolute',\n left: '50%',\n top: '50%',\n transform: `translate(calc(${x}px - 50%), calc(${y}px - 50%))`,\n touchAction: 'none'\n }\n },\n inputProps: mergeProps(\n inputLabellingProps,\n {\n type: 'range',\n min: '0',\n max: '360',\n step: String(step),\n 'aria-valuetext': state.value.formatChannelValue('hue', locale),\n disabled: isDisabled,\n value: `${state.value.getChannelValue('hue')}`,\n onChange: (e: ChangeEvent<HTMLInputElement>) => {\n state.setHue(parseFloat(e.target.value));\n }\n }\n )\n };\n}\n\n// Creates an SVG path string for a circle.\nfunction circlePath(cx: number, cy: number, r: number) {\n 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`;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaColorFieldProps} from '@react-types/color';\nimport {ColorFieldState} from '@react-stately/color';\nimport {\n HTMLAttributes,\n LabelHTMLAttributes,\n RefObject,\n useCallback,\n useState\n} from 'react';\nimport {mergeProps, useId} from '@react-aria/utils';\nimport {useFocusWithin, useScrollWheel} from '@react-aria/interactions';\nimport {useFormattedTextField} from '@react-aria/textfield';\nimport {useSpinButton} from '@react-aria/spinbutton';\n\ninterface ColorFieldAria {\n /** Props for the label element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n /** Props for the input element. */\n inputProps: HTMLAttributes<HTMLInputElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a color field component.\n * Color fields allow users to enter and adjust a hex color value.\n */\nexport function useColorField(\n props: AriaColorFieldProps,\n state: ColorFieldState,\n ref: RefObject<HTMLInputElement>\n): ColorFieldAria {\n let {\n isDisabled,\n isReadOnly,\n isRequired\n } = props;\n\n let {\n colorValue,\n inputValue,\n commit,\n increment,\n decrement,\n incrementToMax,\n decrementToMin\n } = state;\n\n let inputId = useId();\n let {spinButtonProps} = useSpinButton(\n {\n isDisabled,\n isReadOnly,\n isRequired,\n maxValue: 0xFFFFFF,\n minValue: 0,\n onIncrement: increment,\n onIncrementToMax: incrementToMax,\n onDecrement: decrement,\n onDecrementToMin: decrementToMin,\n value: colorValue ? colorValue.toHexInt() : undefined,\n textValue: colorValue ? colorValue.toString('hex') : undefined\n }\n );\n\n let [focusWithin, setFocusWithin] = useState(false);\n let {focusWithinProps} = useFocusWithin({isDisabled, onFocusWithinChange: setFocusWithin});\n\n let onWheel = useCallback((e) => {\n if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) {\n return;\n }\n if (e.deltaY > 0) {\n increment();\n } else if (e.deltaY < 0) {\n decrement();\n }\n }, [isReadOnly, isDisabled, decrement, increment]);\n // If the input isn't supposed to receive input, disable scrolling.\n let scrollingDisabled = isDisabled || isReadOnly || !focusWithin;\n useScrollWheel({onScroll: onWheel, isDisabled: scrollingDisabled}, ref);\n\n let onChange = value => {\n state.setInputValue(value);\n };\n\n let {labelProps, inputProps} = useFormattedTextField(\n mergeProps(props, {\n id: inputId,\n value: inputValue,\n defaultValue: undefined,\n type: 'text',\n autoComplete: 'off',\n onChange\n }), state, ref);\n\n return {\n labelProps,\n inputProps: mergeProps(inputProps, spinButtonProps, focusWithinProps, {\n role: 'textbox',\n 'aria-valuemax': null,\n 'aria-valuemin': null,\n 'aria-valuenow': null,\n 'aria-valuetext': null,\n autoCorrect: 'off',\n spellCheck: 'false',\n onBlur: commit\n })\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SC2CgB,yCAAc,CAAC,KAA6B,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-aria/color/src/useColorWheel.ts","packages/@react-aria/color/src/useColorField.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport * from './useColorSlider';\nexport * from './useColorWheel';\nexport * from './useColorField';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaColorSliderProps} from '@react-types/color';\nimport {ColorSliderState} from '@react-stately/color';\nimport {HTMLAttributes, RefObject} from 'react';\nimport {mergeProps} from '@react-aria/utils';\nimport {useLocale} from '@react-aria/i18n';\nimport {useSlider, useSliderThumb} from '@react-aria/slider';\n\ninterface ColorSliderAriaOptions extends AriaColorSliderProps {\n /** A ref for the track element. */\n trackRef: RefObject<HTMLElement>,\n /** A ref for the input element. */\n inputRef: RefObject<HTMLInputElement>\n}\n\ninterface ColorSliderAria {\n /** Props for the label element. */\n labelProps: HTMLAttributes<HTMLElement>,\n /** Props for the track element. */\n trackProps: HTMLAttributes<HTMLElement>,\n /** Props for the thumb element. */\n thumbProps: HTMLAttributes<HTMLElement>,\n /** Props for the visually hidden range input element. */\n inputProps: HTMLAttributes<HTMLElement>,\n /** Props for the output element, displaying the value of the color slider. */\n outputProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a color slider component.\n * Color sliders allow users to adjust an individual channel of a color value.\n */\nexport function useColorSlider(props: ColorSliderAriaOptions, state: ColorSliderState): ColorSliderAria {\n let {trackRef, inputRef, orientation, channel, 'aria-label': ariaLabel} = props;\n\n let {locale, direction} = useLocale();\n\n // Provide a default aria-label if there is no other label provided.\n if (!props.label && !ariaLabel && !props['aria-labelledby']) {\n ariaLabel = state.value.getChannelName(channel, locale);\n }\n\n // @ts-ignore - ignore unused incompatible props\n let {groupProps, trackProps, labelProps, outputProps} = useSlider({...props, 'aria-label': ariaLabel}, state, trackRef);\n let {inputProps, thumbProps} = useSliderThumb({\n index: 0,\n orientation,\n isDisabled: props.isDisabled,\n trackRef,\n inputRef\n }, state);\n\n let generateBackground = () => {\n let value = state.getDisplayColor();\n let to: string;\n if (orientation === 'vertical') {\n to = 'top';\n } else if (direction === 'ltr') {\n to = 'right';\n } else {\n to = 'left';\n }\n switch (channel) {\n case 'hue':\n return `linear-gradient(to ${to}, rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%)`;\n case 'lightness': {\n // We have to add an extra color stop in the middle so that the hue shows up at all.\n // Otherwise it will always just be black to white.\n let min = state.getThumbMinValue(0);\n let max = state.getThumbMaxValue(0);\n let start = value.withChannelValue(channel, min).toString('css');\n let middle = value.withChannelValue(channel, (max - min) / 2).toString('css');\n let end = value.withChannelValue(channel, max).toString('css');\n return `linear-gradient(to ${to}, ${start}, ${middle}, ${end})`;\n }\n case 'saturation':\n case 'brightness':\n case 'red':\n case 'green':\n case 'blue':\n case 'alpha': {\n let start = value.withChannelValue(channel, state.getThumbMinValue(0)).toString('css');\n let end = value.withChannelValue(channel, state.getThumbMaxValue(0)).toString('css');\n return `linear-gradient(to ${to}, ${start}, ${end})`;\n }\n default:\n throw new Error('Unknown color channel: ' + channel);\n }\n };\n\n let thumbPosition = state.getThumbPercent(0);\n if (orientation === 'vertical' || direction === 'rtl') {\n thumbPosition = 1 - thumbPosition;\n }\n\n return {\n trackProps: {\n ...mergeProps(groupProps, trackProps),\n style: {\n position: 'relative',\n touchAction: 'none',\n background: generateBackground()\n }\n },\n inputProps,\n thumbProps: {\n ...thumbProps,\n style: {\n touchAction: 'none',\n position: 'absolute',\n [orientation === 'vertical' ? 'top' : 'left']: `${thumbPosition * 100}%`,\n transform: 'translate(-50%, -50%)'\n }\n },\n labelProps,\n outputProps\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaColorWheelProps} from '@react-types/color';\nimport {ColorWheelState} from '@react-stately/color';\nimport {focusWithoutScrolling, mergeProps, useGlobalListeners, useLabels} from '@react-aria/utils';\nimport React, {ChangeEvent, HTMLAttributes, InputHTMLAttributes, RefObject, useCallback, useRef} from 'react';\nimport {useKeyboard, useMove} from '@react-aria/interactions';\nimport {useLocale} from '@react-aria/i18n';\n\ninterface ColorWheelAriaProps extends AriaColorWheelProps {\n /** The outer radius of the color wheel. */\n outerRadius: number,\n /** The inner radius of the color wheel. */\n innerRadius: number\n}\n\ninterface ColorWheelAria {\n /** Props for the track element. */\n trackProps: HTMLAttributes<HTMLElement>,\n /** Props for the thumb element. */\n thumbProps: HTMLAttributes<HTMLElement>,\n /** Props for the visually hidden range input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>\n}\n\nconst PAGE_MIN_STEP_SIZE = 6;\n\n/**\n * Provides the behavior and accessibility implementation for a color wheel component.\n * Color wheels allow users to adjust the hue of an HSL or HSB color value on a circular track.\n */\nexport function useColorWheel(props: ColorWheelAriaProps, state: ColorWheelState, inputRef: RefObject<HTMLElement>): ColorWheelAria {\n let {\n isDisabled,\n step = 1,\n innerRadius,\n outerRadius,\n 'aria-label': ariaLabel\n } = props;\n\n let {addGlobalListener, removeGlobalListener} = useGlobalListeners();\n\n let thumbRadius = (innerRadius + outerRadius) / 2;\n\n let focusInput = useCallback(() => {\n if (inputRef.current) {\n focusWithoutScrolling(inputRef.current);\n }\n }, [inputRef]);\n\n let stateRef = useRef<ColorWheelState>(null);\n stateRef.current = state;\n\n let currentPosition = useRef<{x: number, y: number}>(null);\n let moveHandler = {\n onMoveStart() {\n currentPosition.current = null;\n state.setDragging(true);\n },\n onMove({deltaX, deltaY, pointerType}) {\n if (currentPosition.current == null) {\n currentPosition.current = stateRef.current.getThumbPosition(thumbRadius);\n }\n currentPosition.current.x += deltaX;\n currentPosition.current.y += deltaY;\n if (pointerType === 'keyboard') {\n if (deltaX > 0 || deltaY < 0) {\n state.increment();\n } else if (deltaX < 0 || deltaY > 0) {\n state.decrement();\n }\n } else {\n stateRef.current.setHueFromPoint(currentPosition.current.x, currentPosition.current.y, thumbRadius);\n }\n },\n onMoveEnd() {\n isOnTrack.current = undefined;\n state.setDragging(false);\n focusInput();\n }\n };\n let {moveProps: movePropsThumb} = useMove(moveHandler);\n\n let currentPointer = useRef<number | null | undefined>(undefined);\n let isOnTrack = useRef<boolean>(false);\n let {moveProps: movePropsContainer} = useMove({\n onMoveStart() {\n if (isOnTrack.current) {\n moveHandler.onMoveStart();\n }\n },\n onMove(e) {\n if (isOnTrack.current) {\n moveHandler.onMove(e);\n }\n },\n onMoveEnd() {\n if (isOnTrack.current) {\n moveHandler.onMoveEnd();\n }\n }\n });\n\n let onThumbDown = (id: number | null) => {\n if (!state.isDragging) {\n currentPointer.current = id;\n focusInput();\n state.setDragging(true);\n\n if (typeof PointerEvent !== 'undefined') {\n addGlobalListener(window, 'pointerup', onThumbUp, false);\n } else {\n addGlobalListener(window, 'mouseup', onThumbUp, false);\n addGlobalListener(window, 'touchend', onThumbUp, false);\n }\n }\n };\n\n let onThumbUp = (e) => {\n let id = e.pointerId ?? e.changedTouches?.[0].identifier;\n if (id === currentPointer.current) {\n focusInput();\n state.setDragging(false);\n currentPointer.current = undefined;\n isOnTrack.current = false;\n\n if (typeof PointerEvent !== 'undefined') {\n removeGlobalListener(window, 'pointerup', onThumbUp, false);\n } else {\n removeGlobalListener(window, 'mouseup', onThumbUp, false);\n removeGlobalListener(window, 'touchend', onThumbUp, false);\n }\n }\n };\n\n let onTrackDown = (track: Element, id: number | null, pageX: number, pageY: number) => {\n let rect = track.getBoundingClientRect();\n let x = pageX - rect.x - rect.width / 2;\n let y = pageY - rect.y - rect.height / 2;\n let radius = Math.sqrt(x * x + y * y);\n if (innerRadius < radius && radius < outerRadius && !state.isDragging && currentPointer.current === undefined) {\n isOnTrack.current = true;\n currentPointer.current = id;\n stateRef.current.setHueFromPoint(x, y, radius);\n\n focusInput();\n state.setDragging(true);\n\n if (typeof PointerEvent !== 'undefined') {\n addGlobalListener(window, 'pointerup', onTrackUp, false);\n } else {\n addGlobalListener(window, 'mouseup', onTrackUp, false);\n addGlobalListener(window, 'touchend', onTrackUp, false);\n }\n }\n };\n\n let onTrackUp = (e) => {\n let id = e.pointerId ?? e.changedTouches?.[0].identifier;\n if (isOnTrack.current && id === currentPointer.current) {\n isOnTrack.current = false;\n currentPointer.current = undefined;\n state.setDragging(false);\n focusInput();\n\n\n if (typeof PointerEvent !== 'undefined') {\n removeGlobalListener(window, 'pointerup', onTrackUp, false);\n } else {\n removeGlobalListener(window, 'mouseup', onTrackUp, false);\n removeGlobalListener(window, 'touchend', onTrackUp, false);\n }\n }\n };\n\n let {keyboardProps} = useKeyboard({\n onKeyDown(e) {\n switch (e.key) {\n case 'PageUp':\n e.preventDefault();\n state.increment(PAGE_MIN_STEP_SIZE);\n break;\n case 'PageDown':\n e.preventDefault();\n state.decrement(PAGE_MIN_STEP_SIZE);\n break;\n }\n }\n });\n\n let trackInteractions = isDisabled ? {} : mergeProps({\n ...(typeof PointerEvent !== 'undefined' ? {\n onPointerDown: (e: React.PointerEvent) => {\n if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) {\n return;\n }\n onTrackDown(e.currentTarget, e.pointerId, e.clientX, e.clientY);\n }} : {\n onMouseDown: (e: React.MouseEvent) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onTrackDown(e.currentTarget, undefined, e.clientX, e.clientY);\n },\n onTouchStart: (e: React.TouchEvent) => {\n onTrackDown(e.currentTarget, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY);\n }\n })\n }, movePropsContainer);\n\n let thumbInteractions = isDisabled ? {} : mergeProps({\n onMouseDown: (e: React.MouseEvent) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onThumbDown(undefined);\n },\n onPointerDown: (e: React.PointerEvent) => {\n if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) {\n return;\n }\n onThumbDown(e.pointerId);\n },\n onTouchStart: (e: React.TouchEvent) => {\n onThumbDown(e.changedTouches[0].identifier);\n }\n }, movePropsThumb, keyboardProps);\n let {x, y} = state.getThumbPosition(thumbRadius);\n\n // Provide a default aria-label if none is given\n let {locale} = useLocale();\n if (ariaLabel == null && props['aria-labelledby'] == null) {\n ariaLabel = state.value.getChannelName('hue', locale);\n }\n\n let inputLabellingProps = useLabels({\n ...props,\n 'aria-label': ariaLabel\n });\n\n return {\n trackProps: {\n ...trackInteractions,\n style: {\n position: 'relative',\n touchAction: 'none',\n width: outerRadius * 2,\n height: outerRadius * 2,\n background: `\n conic-gradient(\n from 90deg,\n hsl(0, 100%, 50%),\n hsl(30, 100%, 50%),\n hsl(60, 100%, 50%),\n hsl(90, 100%, 50%),\n hsl(120, 100%, 50%),\n hsl(150, 100%, 50%),\n hsl(180, 100%, 50%),\n hsl(210, 100%, 50%),\n hsl(240, 100%, 50%),\n hsl(270, 100%, 50%),\n hsl(300, 100%, 50%),\n hsl(330, 100%, 50%),\n hsl(360, 100%, 50%)\n )\n `,\n clipPath: `path(evenodd, \"${circlePath(outerRadius, outerRadius, outerRadius)} ${circlePath(outerRadius, outerRadius, innerRadius)}\")`\n }\n },\n thumbProps: {\n ...thumbInteractions,\n style: {\n position: 'absolute',\n left: '50%',\n top: '50%',\n transform: `translate(calc(${x}px - 50%), calc(${y}px - 50%))`,\n touchAction: 'none'\n }\n },\n inputProps: mergeProps(\n inputLabellingProps,\n {\n type: 'range',\n min: '0',\n max: '360',\n step: String(step),\n 'aria-valuetext': state.value.formatChannelValue('hue', locale),\n disabled: isDisabled,\n value: `${state.value.getChannelValue('hue')}`,\n onChange: (e: ChangeEvent<HTMLInputElement>) => {\n state.setHue(parseFloat(e.target.value));\n }\n }\n )\n };\n}\n\n// Creates an SVG path string for a circle.\nfunction circlePath(cx: number, cy: number, r: number) {\n 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`;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaColorFieldProps} from '@react-types/color';\nimport {ColorFieldState} from '@react-stately/color';\nimport {\n HTMLAttributes,\n LabelHTMLAttributes,\n RefObject,\n useCallback,\n useState\n} from 'react';\nimport {mergeProps, useId} from '@react-aria/utils';\nimport {useFocusWithin, useScrollWheel} from '@react-aria/interactions';\nimport {useFormattedTextField} from '@react-aria/textfield';\nimport {useSpinButton} from '@react-aria/spinbutton';\n\ninterface ColorFieldAria {\n /** Props for the label element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n /** Props for the input element. */\n inputProps: HTMLAttributes<HTMLInputElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a color field component.\n * Color fields allow users to enter and adjust a hex color value.\n */\nexport function useColorField(\n props: AriaColorFieldProps,\n state: ColorFieldState,\n ref: RefObject<HTMLInputElement>\n): ColorFieldAria {\n let {\n isDisabled,\n isReadOnly,\n isRequired\n } = props;\n\n let {\n colorValue,\n inputValue,\n commit,\n increment,\n decrement,\n incrementToMax,\n decrementToMin\n } = state;\n\n let inputId = useId();\n let {spinButtonProps} = useSpinButton(\n {\n isDisabled,\n isReadOnly,\n isRequired,\n maxValue: 0xFFFFFF,\n minValue: 0,\n onIncrement: increment,\n onIncrementToMax: incrementToMax,\n onDecrement: decrement,\n onDecrementToMin: decrementToMin,\n value: colorValue ? colorValue.toHexInt() : undefined,\n textValue: colorValue ? colorValue.toString('hex') : undefined\n }\n );\n\n let [focusWithin, setFocusWithin] = useState(false);\n let {focusWithinProps} = useFocusWithin({isDisabled, onFocusWithinChange: setFocusWithin});\n\n let onWheel = useCallback((e) => {\n if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) {\n return;\n }\n if (e.deltaY > 0) {\n increment();\n } else if (e.deltaY < 0) {\n decrement();\n }\n }, [isReadOnly, isDisabled, decrement, increment]);\n // If the input isn't supposed to receive input, disable scrolling.\n let scrollingDisabled = isDisabled || isReadOnly || !focusWithin;\n useScrollWheel({onScroll: onWheel, isDisabled: scrollingDisabled}, ref);\n\n let onChange = value => {\n state.setInputValue(value);\n };\n\n let {labelProps, inputProps} = useFormattedTextField(\n mergeProps(props, {\n id: inputId,\n value: inputValue,\n defaultValue: undefined,\n type: 'text',\n autoComplete: 'off',\n onChange\n }), state, ref);\n\n return {\n labelProps,\n inputProps: mergeProps(inputProps, spinButtonProps, focusWithinProps, {\n role: 'textbox',\n 'aria-valuemax': null,\n 'aria-valuemin': null,\n 'aria-valuenow': null,\n 'aria-valuetext': null,\n autoCorrect: 'off',\n spellCheck: 'false',\n onBlur: commit\n })\n };\n}\n"],"names":[],"version":3,"file":"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 $l7vYy$mergeProps, useGlobalListeners as $l7vYy$useGlobalListeners, focusWithoutScrolling as $l7vYy$focusWithoutScrolling, useLabels as $l7vYy$useLabels, useId as $l7vYy$useId} from "@react-aria/utils";
|
|
2
|
+
import {useLocale as $l7vYy$useLocale} from "@react-aria/i18n";
|
|
3
|
+
import {useSlider as $l7vYy$useSlider, useSliderThumb as $l7vYy$useSliderThumb} from "@react-aria/slider";
|
|
4
|
+
import {useCallback as $l7vYy$useCallback, useRef as $l7vYy$useRef, useState as $l7vYy$useState} from "react";
|
|
5
|
+
import {useMove as $l7vYy$useMove, useKeyboard as $l7vYy$useKeyboard, useFocusWithin as $l7vYy$useFocusWithin, useScrollWheel as $l7vYy$useScrollWheel} from "@react-aria/interactions";
|
|
6
|
+
import {useFormattedTextField as $l7vYy$useFormattedTextField} from "@react-aria/textfield";
|
|
7
|
+
import {useSpinButton as $l7vYy$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 $8992d2cc13930492$exports = {};
|
|
13
13
|
|
|
14
|
-
$parcel$export($
|
|
14
|
+
$parcel$export($8992d2cc13930492$exports, "useColorSlider", () => $8992d2cc13930492$export$106b7a4e66508f66);
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
function $
|
|
18
|
+
function $8992d2cc13930492$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 } = $l7vYy$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 } = $l7vYy$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 } = $l7vYy$useSliderThumb({
|
|
29
29
|
index: 0,
|
|
30
30
|
orientation: orientation,
|
|
31
31
|
isDisabled: props.isDisabled,
|
|
@@ -71,7 +71,7 @@ function $d35c65941a2de674$export$106b7a4e66508f66(props, state) {
|
|
|
71
71
|
if (orientation === 'vertical' || direction === 'rtl') thumbPosition = 1 - thumbPosition;
|
|
72
72
|
return {
|
|
73
73
|
trackProps: {
|
|
74
|
-
...$
|
|
74
|
+
...$l7vYy$mergeProps(groupProps, trackProps),
|
|
75
75
|
style: {
|
|
76
76
|
position: 'relative',
|
|
77
77
|
touchAction: 'none',
|
|
@@ -94,26 +94,26 @@ function $d35c65941a2de674$export$106b7a4e66508f66(props, state) {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
|
|
97
|
-
var $
|
|
97
|
+
var $e8f573825f77431c$exports = {};
|
|
98
98
|
|
|
99
|
-
$parcel$export($
|
|
99
|
+
$parcel$export($e8f573825f77431c$exports, "useColorWheel", () => $e8f573825f77431c$export$9064ff4e44b3729a);
|
|
100
100
|
|
|
101
101
|
|
|
102
102
|
|
|
103
103
|
|
|
104
|
-
const $
|
|
105
|
-
function $
|
|
104
|
+
const $e8f573825f77431c$var$PAGE_MIN_STEP_SIZE = 6;
|
|
105
|
+
function $e8f573825f77431c$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 } = $l7vYy$useGlobalListeners();
|
|
108
108
|
let thumbRadius = (innerRadius + outerRadius) / 2;
|
|
109
|
-
let focusInput = $
|
|
110
|
-
if (inputRef.current) $
|
|
109
|
+
let focusInput = $l7vYy$useCallback(()=>{
|
|
110
|
+
if (inputRef.current) $l7vYy$focusWithoutScrolling(inputRef.current);
|
|
111
111
|
}, [
|
|
112
112
|
inputRef
|
|
113
113
|
]);
|
|
114
|
-
let stateRef = $
|
|
114
|
+
let stateRef = $l7vYy$useRef(null);
|
|
115
115
|
stateRef.current = state;
|
|
116
|
-
let currentPosition = $
|
|
116
|
+
let currentPosition = $l7vYy$useRef(null);
|
|
117
117
|
let moveHandler = {
|
|
118
118
|
onMoveStart () {
|
|
119
119
|
currentPosition.current = null;
|
|
@@ -134,10 +134,10 @@ function $29049ccc426e44cb$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 } = $l7vYy$useMove(moveHandler);
|
|
138
|
+
let currentPointer = $l7vYy$useRef(undefined);
|
|
139
|
+
let isOnTrack = $l7vYy$useRef(false);
|
|
140
|
+
let { moveProps: movePropsContainer } = $l7vYy$useMove({
|
|
141
141
|
onMoveStart () {
|
|
142
142
|
if (isOnTrack.current) moveHandler.onMoveStart();
|
|
143
143
|
},
|
|
@@ -161,7 +161,9 @@ function $29049ccc426e44cb$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
161
161
|
}
|
|
162
162
|
};
|
|
163
163
|
let onThumbUp = (e)=>{
|
|
164
|
-
|
|
164
|
+
var ref;
|
|
165
|
+
var _pointerId;
|
|
166
|
+
let id = (_pointerId = e.pointerId) !== null && _pointerId !== void 0 ? _pointerId : (ref = e.changedTouches) === null || ref === void 0 ? void 0 : ref[0].identifier;
|
|
165
167
|
if (id === currentPointer.current) {
|
|
166
168
|
focusInput();
|
|
167
169
|
state.setDragging(false);
|
|
@@ -193,7 +195,9 @@ function $29049ccc426e44cb$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
193
195
|
}
|
|
194
196
|
};
|
|
195
197
|
let onTrackUp = (e)=>{
|
|
196
|
-
|
|
198
|
+
var ref;
|
|
199
|
+
var _pointerId;
|
|
200
|
+
let id = (_pointerId = e.pointerId) !== null && _pointerId !== void 0 ? _pointerId : (ref = e.changedTouches) === null || ref === void 0 ? void 0 : ref[0].identifier;
|
|
197
201
|
if (isOnTrack.current && id === currentPointer.current) {
|
|
198
202
|
isOnTrack.current = false;
|
|
199
203
|
currentPointer.current = undefined;
|
|
@@ -206,22 +210,22 @@ function $29049ccc426e44cb$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
206
210
|
}
|
|
207
211
|
}
|
|
208
212
|
};
|
|
209
|
-
let { keyboardProps: keyboardProps } = $
|
|
213
|
+
let { keyboardProps: keyboardProps } = $l7vYy$useKeyboard({
|
|
210
214
|
onKeyDown (e) {
|
|
211
215
|
switch(e.key){
|
|
212
216
|
case 'PageUp':
|
|
213
217
|
e.preventDefault();
|
|
214
|
-
state.increment($
|
|
218
|
+
state.increment($e8f573825f77431c$var$PAGE_MIN_STEP_SIZE);
|
|
215
219
|
break;
|
|
216
220
|
case 'PageDown':
|
|
217
221
|
e.preventDefault();
|
|
218
|
-
state.decrement($
|
|
222
|
+
state.decrement($e8f573825f77431c$var$PAGE_MIN_STEP_SIZE);
|
|
219
223
|
break;
|
|
220
224
|
}
|
|
221
225
|
}
|
|
222
226
|
});
|
|
223
227
|
let trackInteractions = isDisabled ? {
|
|
224
|
-
} : $
|
|
228
|
+
} : $l7vYy$mergeProps({
|
|
225
229
|
...typeof PointerEvent !== 'undefined' ? {
|
|
226
230
|
onPointerDown: (e)=>{
|
|
227
231
|
if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
|
|
@@ -238,7 +242,7 @@ function $29049ccc426e44cb$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
238
242
|
}
|
|
239
243
|
}, movePropsContainer);
|
|
240
244
|
let thumbInteractions = isDisabled ? {
|
|
241
|
-
} : $
|
|
245
|
+
} : $l7vYy$mergeProps({
|
|
242
246
|
onMouseDown: (e)=>{
|
|
243
247
|
if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
244
248
|
onThumbDown(undefined);
|
|
@@ -253,9 +257,9 @@ function $29049ccc426e44cb$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
253
257
|
}, movePropsThumb, keyboardProps);
|
|
254
258
|
let { x: x1 , y: y1 } = state.getThumbPosition(thumbRadius);
|
|
255
259
|
// Provide a default aria-label if none is given
|
|
256
|
-
let { locale: locale } = $
|
|
260
|
+
let { locale: locale } = $l7vYy$useLocale();
|
|
257
261
|
if (ariaLabel == null && props['aria-labelledby'] == null) ariaLabel = state.value.getChannelName('hue', locale);
|
|
258
|
-
let inputLabellingProps = $
|
|
262
|
+
let inputLabellingProps = $l7vYy$useLabels({
|
|
259
263
|
...props,
|
|
260
264
|
'aria-label': ariaLabel
|
|
261
265
|
});
|
|
@@ -285,7 +289,7 @@ function $29049ccc426e44cb$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
285
289
|
hsl(360, 100%, 50%)
|
|
286
290
|
)
|
|
287
291
|
`,
|
|
288
|
-
clipPath: `path(evenodd, "${$
|
|
292
|
+
clipPath: `path(evenodd, "${$e8f573825f77431c$var$circlePath(outerRadius, outerRadius, outerRadius)} ${$e8f573825f77431c$var$circlePath(outerRadius, outerRadius, innerRadius)}")`
|
|
289
293
|
}
|
|
290
294
|
},
|
|
291
295
|
thumbProps: {
|
|
@@ -298,7 +302,7 @@ function $29049ccc426e44cb$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
298
302
|
touchAction: 'none'
|
|
299
303
|
}
|
|
300
304
|
},
|
|
301
|
-
inputProps: $
|
|
305
|
+
inputProps: $l7vYy$mergeProps(inputLabellingProps, {
|
|
302
306
|
type: 'range',
|
|
303
307
|
min: '0',
|
|
304
308
|
max: '360',
|
|
@@ -313,24 +317,24 @@ function $29049ccc426e44cb$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
|
313
317
|
};
|
|
314
318
|
}
|
|
315
319
|
// Creates an SVG path string for a circle.
|
|
316
|
-
function $
|
|
320
|
+
function $e8f573825f77431c$var$circlePath(cx, cy, r) {
|
|
317
321
|
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
322
|
}
|
|
319
323
|
|
|
320
324
|
|
|
321
|
-
var $
|
|
325
|
+
var $bb9d9837d0b340e7$exports = {};
|
|
322
326
|
|
|
323
|
-
$parcel$export($
|
|
327
|
+
$parcel$export($bb9d9837d0b340e7$exports, "useColorField", () => $bb9d9837d0b340e7$export$77e32ca575a28fdf);
|
|
324
328
|
|
|
325
329
|
|
|
326
330
|
|
|
327
331
|
|
|
328
332
|
|
|
329
|
-
function $
|
|
333
|
+
function $bb9d9837d0b340e7$export$77e32ca575a28fdf(props, state, ref) {
|
|
330
334
|
let { isDisabled: isDisabled , isReadOnly: isReadOnly , isRequired: isRequired } = props;
|
|
331
335
|
let { colorValue: colorValue , inputValue: inputValue , commit: commit , increment: increment , decrement: decrement , incrementToMax: incrementToMax , decrementToMin: decrementToMin } = state;
|
|
332
|
-
let inputId = $
|
|
333
|
-
let { spinButtonProps: spinButtonProps } = $
|
|
336
|
+
let inputId = $l7vYy$useId();
|
|
337
|
+
let { spinButtonProps: spinButtonProps } = $l7vYy$useSpinButton({
|
|
334
338
|
isDisabled: isDisabled,
|
|
335
339
|
isReadOnly: isReadOnly,
|
|
336
340
|
isRequired: isRequired,
|
|
@@ -343,12 +347,12 @@ function $42d92523b2461444$export$77e32ca575a28fdf(props, state, ref) {
|
|
|
343
347
|
value: colorValue ? colorValue.toHexInt() : undefined,
|
|
344
348
|
textValue: colorValue ? colorValue.toString('hex') : undefined
|
|
345
349
|
});
|
|
346
|
-
let [focusWithin, setFocusWithin] = $
|
|
347
|
-
let { focusWithinProps: focusWithinProps } = $
|
|
350
|
+
let [focusWithin, setFocusWithin] = $l7vYy$useState(false);
|
|
351
|
+
let { focusWithinProps: focusWithinProps } = $l7vYy$useFocusWithin({
|
|
348
352
|
isDisabled: isDisabled,
|
|
349
353
|
onFocusWithinChange: setFocusWithin
|
|
350
354
|
});
|
|
351
|
-
let onWheel = $
|
|
355
|
+
let onWheel = $l7vYy$useCallback((e)=>{
|
|
352
356
|
if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) return;
|
|
353
357
|
if (e.deltaY > 0) increment();
|
|
354
358
|
else if (e.deltaY < 0) decrement();
|
|
@@ -360,14 +364,14 @@ function $42d92523b2461444$export$77e32ca575a28fdf(props, state, ref) {
|
|
|
360
364
|
]);
|
|
361
365
|
// If the input isn't supposed to receive input, disable scrolling.
|
|
362
366
|
let scrollingDisabled = isDisabled || isReadOnly || !focusWithin;
|
|
363
|
-
$
|
|
367
|
+
$l7vYy$useScrollWheel({
|
|
364
368
|
onScroll: onWheel,
|
|
365
369
|
isDisabled: scrollingDisabled
|
|
366
370
|
}, ref);
|
|
367
371
|
let onChange = (value)=>{
|
|
368
372
|
state.setInputValue(value);
|
|
369
373
|
};
|
|
370
|
-
let { labelProps: labelProps , inputProps: inputProps } = $
|
|
374
|
+
let { labelProps: labelProps , inputProps: inputProps } = $l7vYy$useFormattedTextField($l7vYy$mergeProps(props, {
|
|
371
375
|
id: inputId,
|
|
372
376
|
value: inputValue,
|
|
373
377
|
defaultValue: undefined,
|
|
@@ -377,7 +381,7 @@ function $42d92523b2461444$export$77e32ca575a28fdf(props, state, ref) {
|
|
|
377
381
|
}), state, ref);
|
|
378
382
|
return {
|
|
379
383
|
labelProps: labelProps,
|
|
380
|
-
inputProps: $
|
|
384
|
+
inputProps: $l7vYy$mergeProps(inputProps, spinButtonProps, focusWithinProps, {
|
|
381
385
|
role: 'textbox',
|
|
382
386
|
'aria-valuemax': null,
|
|
383
387
|
'aria-valuemin': null,
|
|
@@ -393,5 +397,5 @@ function $42d92523b2461444$export$77e32ca575a28fdf(props, state, ref) {
|
|
|
393
397
|
|
|
394
398
|
|
|
395
399
|
|
|
396
|
-
export {$
|
|
400
|
+
export {$8992d2cc13930492$export$106b7a4e66508f66 as useColorSlider, $e8f573825f77431c$export$9064ff4e44b3729a as useColorWheel, $bb9d9837d0b340e7$export$77e32ca575a28fdf as useColorField};
|
|
397
401
|
//# sourceMappingURL=module.js.map
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;SC2CgB,yCAAc,CAAC,KAA6B,EAAE,KAAuB,EAAmB,CAAC;IACvG,GAAG,CAAC,CAAC,WAAA,QAAQ,aAAE,QAAQ,gBAAE,WAAW,YAAE,OAAO,G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A,CAAC,EAAE,GAAG;IAEtE,GAAG,CAAC,QAAQ,IAAG,KAAK,GAAI,CAAC;QACvB,KAAK,CAAC,aAAa,CAAC,KAAK;IAC3B,CAAC;IAED,GAAG,CAAC,CAAC,aAAA,UAAU,eAAE,UAAU,EAAA,CAAC,GAAG,4BAAqB,CAClD,iBAAU,CAAC,KAAK,EAAE,CAAC;QACjB,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,UAAU;QACjB,YAAY,EAAE,SAAS;QACvB,IAAI,EAAE,CAAM;QACZ,YAAY,EAAE,CAAK;kBACnB,QAAQ;IACV,CAAC,GAAG,KAAK,EAAE,GAAG;IAEhB,MAAM,CAAC,CAAC;oBACN,UAAU;QACV,UAAU,EAAE,iBAAU,CAAC,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,CAAC;YACrE,IAAI,EAAE,CAAS;YACf,CAAe,gBAAE,IAAI;YACrB,CAAe,gBAAE,IAAI;YACrB,CAAe,gBAAE,IAAI;YACrB,CAAgB,iBAAE,IAAI;YACtB,WAAW,EAAE,CAAK;YAClB,UAAU,EAAE,CAAO;YACnB,MAAM,EAAE,MAAM;QAChB,CAAC;IACH,CAAC;AACH,CAAC;","sources":["packages/@react-aria/color/src/index.ts","packages/@react-aria/color/src/useColorSlider.ts","packages/@react-aria/color/src/useColorWheel.ts","packages/@react-aria/color/src/useColorField.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport * from './useColorSlider';\nexport * from './useColorWheel';\nexport * from './useColorField';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaColorSliderProps} from '@react-types/color';\nimport {ColorSliderState} from '@react-stately/color';\nimport {HTMLAttributes, RefObject} from 'react';\nimport {mergeProps} from '@react-aria/utils';\nimport {useLocale} from '@react-aria/i18n';\nimport {useSlider, useSliderThumb} from '@react-aria/slider';\n\ninterface ColorSliderAriaOptions extends AriaColorSliderProps {\n /** A ref for the track element. */\n trackRef: RefObject<HTMLElement>,\n /** A ref for the input element. */\n inputRef: RefObject<HTMLInputElement>\n}\n\ninterface ColorSliderAria {\n /** Props for the label element. */\n labelProps: HTMLAttributes<HTMLElement>,\n /** Props for the track element. */\n trackProps: HTMLAttributes<HTMLElement>,\n /** Props for the thumb element. */\n thumbProps: HTMLAttributes<HTMLElement>,\n /** Props for the visually hidden range input element. */\n inputProps: HTMLAttributes<HTMLElement>,\n /** Props for the output element, displaying the value of the color slider. */\n outputProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a color slider component.\n * Color sliders allow users to adjust an individual channel of a color value.\n */\nexport function useColorSlider(props: ColorSliderAriaOptions, state: ColorSliderState): ColorSliderAria {\n let {trackRef, inputRef, orientation, channel, 'aria-label': ariaLabel} = props;\n\n let {locale, direction} = useLocale();\n\n // Provide a default aria-label if there is no other label provided.\n if (!props.label && !ariaLabel && !props['aria-labelledby']) {\n ariaLabel = state.value.getChannelName(channel, locale);\n }\n\n // @ts-ignore - ignore unused incompatible props\n let {groupProps, trackProps, labelProps, outputProps} = useSlider({...props, 'aria-label': ariaLabel}, state, trackRef);\n let {inputProps, thumbProps} = useSliderThumb({\n index: 0,\n orientation,\n isDisabled: props.isDisabled,\n trackRef,\n inputRef\n }, state);\n\n let generateBackground = () => {\n let value = state.getDisplayColor();\n let to: string;\n if (orientation === 'vertical') {\n to = 'top';\n } else if (direction === 'ltr') {\n to = 'right';\n } else {\n to = 'left';\n }\n switch (channel) {\n case 'hue':\n return `linear-gradient(to ${to}, rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%)`;\n case 'lightness': {\n // We have to add an extra color stop in the middle so that the hue shows up at all.\n // Otherwise it will always just be black to white.\n let min = state.getThumbMinValue(0);\n let max = state.getThumbMaxValue(0);\n let start = value.withChannelValue(channel, min).toString('css');\n let middle = value.withChannelValue(channel, (max - min) / 2).toString('css');\n let end = value.withChannelValue(channel, max).toString('css');\n return `linear-gradient(to ${to}, ${start}, ${middle}, ${end})`;\n }\n case 'saturation':\n case 'brightness':\n case 'red':\n case 'green':\n case 'blue':\n case 'alpha': {\n let start = value.withChannelValue(channel, state.getThumbMinValue(0)).toString('css');\n let end = value.withChannelValue(channel, state.getThumbMaxValue(0)).toString('css');\n return `linear-gradient(to ${to}, ${start}, ${end})`;\n }\n default:\n throw new Error('Unknown color channel: ' + channel);\n }\n };\n\n let thumbPosition = state.getThumbPercent(0);\n if (orientation === 'vertical' || direction === 'rtl') {\n thumbPosition = 1 - thumbPosition;\n }\n\n return {\n trackProps: {\n ...mergeProps(groupProps, trackProps),\n style: {\n position: 'relative',\n touchAction: 'none',\n background: generateBackground()\n }\n },\n inputProps,\n thumbProps: {\n ...thumbProps,\n style: {\n touchAction: 'none',\n position: 'absolute',\n [orientation === 'vertical' ? 'top' : 'left']: `${thumbPosition * 100}%`,\n transform: 'translate(-50%, -50%)'\n }\n },\n labelProps,\n outputProps\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaColorWheelProps} from '@react-types/color';\nimport {ColorWheelState} from '@react-stately/color';\nimport {focusWithoutScrolling, mergeProps, useGlobalListeners, useLabels} from '@react-aria/utils';\nimport React, {ChangeEvent, HTMLAttributes, InputHTMLAttributes, RefObject, useCallback, useRef} from 'react';\nimport {useKeyboard, useMove} from '@react-aria/interactions';\nimport {useLocale} from '@react-aria/i18n';\n\ninterface ColorWheelAriaProps extends AriaColorWheelProps {\n /** The outer radius of the color wheel. */\n outerRadius: number,\n /** The inner radius of the color wheel. */\n innerRadius: number\n}\n\ninterface ColorWheelAria {\n /** Props for the track element. */\n trackProps: HTMLAttributes<HTMLElement>,\n /** Props for the thumb element. */\n thumbProps: HTMLAttributes<HTMLElement>,\n /** Props for the visually hidden range input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>\n}\n\nconst PAGE_MIN_STEP_SIZE = 6;\n\n/**\n * Provides the behavior and accessibility implementation for a color wheel component.\n * Color wheels allow users to adjust the hue of an HSL or HSB color value on a circular track.\n */\nexport function useColorWheel(props: ColorWheelAriaProps, state: ColorWheelState, inputRef: RefObject<HTMLElement>): ColorWheelAria {\n let {\n isDisabled,\n step = 1,\n innerRadius,\n outerRadius,\n 'aria-label': ariaLabel\n } = props;\n\n let {addGlobalListener, removeGlobalListener} = useGlobalListeners();\n\n let thumbRadius = (innerRadius + outerRadius) / 2;\n\n let focusInput = useCallback(() => {\n if (inputRef.current) {\n focusWithoutScrolling(inputRef.current);\n }\n }, [inputRef]);\n\n let stateRef = useRef<ColorWheelState>(null);\n stateRef.current = state;\n\n let currentPosition = useRef<{x: number, y: number}>(null);\n let moveHandler = {\n onMoveStart() {\n currentPosition.current = null;\n state.setDragging(true);\n },\n onMove({deltaX, deltaY, pointerType}) {\n if (currentPosition.current == null) {\n currentPosition.current = stateRef.current.getThumbPosition(thumbRadius);\n }\n currentPosition.current.x += deltaX;\n currentPosition.current.y += deltaY;\n if (pointerType === 'keyboard') {\n if (deltaX > 0 || deltaY < 0) {\n state.increment();\n } else if (deltaX < 0 || deltaY > 0) {\n state.decrement();\n }\n } else {\n stateRef.current.setHueFromPoint(currentPosition.current.x, currentPosition.current.y, thumbRadius);\n }\n },\n onMoveEnd() {\n isOnTrack.current = undefined;\n state.setDragging(false);\n focusInput();\n }\n };\n let {moveProps: movePropsThumb} = useMove(moveHandler);\n\n let currentPointer = useRef<number | null | undefined>(undefined);\n let isOnTrack = useRef<boolean>(false);\n let {moveProps: movePropsContainer} = useMove({\n onMoveStart() {\n if (isOnTrack.current) {\n moveHandler.onMoveStart();\n }\n },\n onMove(e) {\n if (isOnTrack.current) {\n moveHandler.onMove(e);\n }\n },\n onMoveEnd() {\n if (isOnTrack.current) {\n moveHandler.onMoveEnd();\n }\n }\n });\n\n let onThumbDown = (id: number | null) => {\n if (!state.isDragging) {\n currentPointer.current = id;\n focusInput();\n state.setDragging(true);\n\n if (typeof PointerEvent !== 'undefined') {\n addGlobalListener(window, 'pointerup', onThumbUp, false);\n } else {\n addGlobalListener(window, 'mouseup', onThumbUp, false);\n addGlobalListener(window, 'touchend', onThumbUp, false);\n }\n }\n };\n\n let onThumbUp = (e) => {\n let id = e.pointerId ?? e.changedTouches?.[0].identifier;\n if (id === currentPointer.current) {\n focusInput();\n state.setDragging(false);\n currentPointer.current = undefined;\n isOnTrack.current = false;\n\n if (typeof PointerEvent !== 'undefined') {\n removeGlobalListener(window, 'pointerup', onThumbUp, false);\n } else {\n removeGlobalListener(window, 'mouseup', onThumbUp, false);\n removeGlobalListener(window, 'touchend', onThumbUp, false);\n }\n }\n };\n\n let onTrackDown = (track: Element, id: number | null, pageX: number, pageY: number) => {\n let rect = track.getBoundingClientRect();\n let x = pageX - rect.x - rect.width / 2;\n let y = pageY - rect.y - rect.height / 2;\n let radius = Math.sqrt(x * x + y * y);\n if (innerRadius < radius && radius < outerRadius && !state.isDragging && currentPointer.current === undefined) {\n isOnTrack.current = true;\n currentPointer.current = id;\n stateRef.current.setHueFromPoint(x, y, radius);\n\n focusInput();\n state.setDragging(true);\n\n if (typeof PointerEvent !== 'undefined') {\n addGlobalListener(window, 'pointerup', onTrackUp, false);\n } else {\n addGlobalListener(window, 'mouseup', onTrackUp, false);\n addGlobalListener(window, 'touchend', onTrackUp, false);\n }\n }\n };\n\n let onTrackUp = (e) => {\n let id = e.pointerId ?? e.changedTouches?.[0].identifier;\n if (isOnTrack.current && id === currentPointer.current) {\n isOnTrack.current = false;\n currentPointer.current = undefined;\n state.setDragging(false);\n focusInput();\n\n\n if (typeof PointerEvent !== 'undefined') {\n removeGlobalListener(window, 'pointerup', onTrackUp, false);\n } else {\n removeGlobalListener(window, 'mouseup', onTrackUp, false);\n removeGlobalListener(window, 'touchend', onTrackUp, false);\n }\n }\n };\n\n let {keyboardProps} = useKeyboard({\n onKeyDown(e) {\n switch (e.key) {\n case 'PageUp':\n e.preventDefault();\n state.increment(PAGE_MIN_STEP_SIZE);\n break;\n case 'PageDown':\n e.preventDefault();\n state.decrement(PAGE_MIN_STEP_SIZE);\n break;\n }\n }\n });\n\n let trackInteractions = isDisabled ? {} : mergeProps({\n ...(typeof PointerEvent !== 'undefined' ? {\n onPointerDown: (e: React.PointerEvent) => {\n if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) {\n return;\n }\n onTrackDown(e.currentTarget, e.pointerId, e.clientX, e.clientY);\n }} : {\n onMouseDown: (e: React.MouseEvent) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onTrackDown(e.currentTarget, undefined, e.clientX, e.clientY);\n },\n onTouchStart: (e: React.TouchEvent) => {\n onTrackDown(e.currentTarget, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY);\n }\n })\n }, movePropsContainer);\n\n let thumbInteractions = isDisabled ? {} : mergeProps({\n onMouseDown: (e: React.MouseEvent) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onThumbDown(undefined);\n },\n onPointerDown: (e: React.PointerEvent) => {\n if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) {\n return;\n }\n onThumbDown(e.pointerId);\n },\n onTouchStart: (e: React.TouchEvent) => {\n onThumbDown(e.changedTouches[0].identifier);\n }\n }, movePropsThumb, keyboardProps);\n let {x, y} = state.getThumbPosition(thumbRadius);\n\n // Provide a default aria-label if none is given\n let {locale} = useLocale();\n if (ariaLabel == null && props['aria-labelledby'] == null) {\n ariaLabel = state.value.getChannelName('hue', locale);\n }\n\n let inputLabellingProps = useLabels({\n ...props,\n 'aria-label': ariaLabel\n });\n\n return {\n trackProps: {\n ...trackInteractions,\n style: {\n position: 'relative',\n touchAction: 'none',\n width: outerRadius * 2,\n height: outerRadius * 2,\n background: `\n conic-gradient(\n from 90deg,\n hsl(0, 100%, 50%),\n hsl(30, 100%, 50%),\n hsl(60, 100%, 50%),\n hsl(90, 100%, 50%),\n hsl(120, 100%, 50%),\n hsl(150, 100%, 50%),\n hsl(180, 100%, 50%),\n hsl(210, 100%, 50%),\n hsl(240, 100%, 50%),\n hsl(270, 100%, 50%),\n hsl(300, 100%, 50%),\n hsl(330, 100%, 50%),\n hsl(360, 100%, 50%)\n )\n `,\n clipPath: `path(evenodd, \"${circlePath(outerRadius, outerRadius, outerRadius)} ${circlePath(outerRadius, outerRadius, innerRadius)}\")`\n }\n },\n thumbProps: {\n ...thumbInteractions,\n style: {\n position: 'absolute',\n left: '50%',\n top: '50%',\n transform: `translate(calc(${x}px - 50%), calc(${y}px - 50%))`,\n touchAction: 'none'\n }\n },\n inputProps: mergeProps(\n inputLabellingProps,\n {\n type: 'range',\n min: '0',\n max: '360',\n step: String(step),\n 'aria-valuetext': state.value.formatChannelValue('hue', locale),\n disabled: isDisabled,\n value: `${state.value.getChannelValue('hue')}`,\n onChange: (e: ChangeEvent<HTMLInputElement>) => {\n state.setHue(parseFloat(e.target.value));\n }\n }\n )\n };\n}\n\n// Creates an SVG path string for a circle.\nfunction circlePath(cx: number, cy: number, r: number) {\n 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`;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaColorFieldProps} from '@react-types/color';\nimport {ColorFieldState} from '@react-stately/color';\nimport {\n HTMLAttributes,\n LabelHTMLAttributes,\n RefObject,\n useCallback,\n useState\n} from 'react';\nimport {mergeProps, useId} from '@react-aria/utils';\nimport {useFocusWithin, useScrollWheel} from '@react-aria/interactions';\nimport {useFormattedTextField} from '@react-aria/textfield';\nimport {useSpinButton} from '@react-aria/spinbutton';\n\ninterface ColorFieldAria {\n /** Props for the label element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n /** Props for the input element. */\n inputProps: HTMLAttributes<HTMLInputElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a color field component.\n * Color fields allow users to enter and adjust a hex color value.\n */\nexport function useColorField(\n props: AriaColorFieldProps,\n state: ColorFieldState,\n ref: RefObject<HTMLInputElement>\n): ColorFieldAria {\n let {\n isDisabled,\n isReadOnly,\n isRequired\n } = props;\n\n let {\n colorValue,\n inputValue,\n commit,\n increment,\n decrement,\n incrementToMax,\n decrementToMin\n } = state;\n\n let inputId = useId();\n let {spinButtonProps} = useSpinButton(\n {\n isDisabled,\n isReadOnly,\n isRequired,\n maxValue: 0xFFFFFF,\n minValue: 0,\n onIncrement: increment,\n onIncrementToMax: incrementToMax,\n onDecrement: decrement,\n onDecrementToMin: decrementToMin,\n value: colorValue ? colorValue.toHexInt() : undefined,\n textValue: colorValue ? colorValue.toString('hex') : undefined\n }\n );\n\n let [focusWithin, setFocusWithin] = useState(false);\n let {focusWithinProps} = useFocusWithin({isDisabled, onFocusWithinChange: setFocusWithin});\n\n let onWheel = useCallback((e) => {\n if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) {\n return;\n }\n if (e.deltaY > 0) {\n increment();\n } else if (e.deltaY < 0) {\n decrement();\n }\n }, [isReadOnly, isDisabled, decrement, increment]);\n // If the input isn't supposed to receive input, disable scrolling.\n let scrollingDisabled = isDisabled || isReadOnly || !focusWithin;\n useScrollWheel({onScroll: onWheel, isDisabled: scrollingDisabled}, ref);\n\n let onChange = value => {\n state.setInputValue(value);\n };\n\n let {labelProps, inputProps} = useFormattedTextField(\n mergeProps(props, {\n id: inputId,\n value: inputValue,\n defaultValue: undefined,\n type: 'text',\n autoComplete: 'off',\n onChange\n }), state, ref);\n\n return {\n labelProps,\n inputProps: mergeProps(inputProps, spinButtonProps, focusWithinProps, {\n role: 'textbox',\n 'aria-valuemax': null,\n 'aria-valuemin': null,\n 'aria-valuenow': null,\n 'aria-valuetext': null,\n autoCorrect: 'off',\n spellCheck: 'false',\n onBlur: commit\n })\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;SC2CgB,yCAAc,CAAC,KAA6B,EAAE,KAAuB,EAAmB,CAAC;IACvG,GAAG,CAAC,CAAC,WAAA,QAAQ,aAAE,QAAQ,gBAAE,WAAW,YAAE,OAAO,GAAE,CAAY,aAAE,SAAS,EAAA,CAAC,GAAG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,CAAC,EACrB,SAAS;IAEb,CAAC,EAAE,CAAC;QAAA,UAAU;QAAE,UAAU;QAAE,SAAS;QAAE,SAAS;IAAA,CAAC;IACjD,EAAmE,AAAnE,iEAAmE;IACnE,GAAG,CAAC,iBAAiB,GAAG,UAAU,IAAI,UAAU,KAAK,WAAW;IAChE,qBAAc,CAAC,CAAC;QAAA,QAAQ,EAAE,OAAO;QAAE,UAAU,EAAE,iBAAiB;IAAA,CAAC,EAAE,GAAG;IAEtE,GAAG,CAAC,QAAQ,IAAG,KAAK,GAAI,CAAC;QACvB,KAAK,CAAC,aAAa,CAAC,KAAK;IAC3B,CAAC;IAED,GAAG,CAAC,CAAC,aAAA,UAAU,eAAE,UAAU,EAAA,CAAC,GAAG,4BAAqB,CAClD,iBAAU,CAAC,KAAK,EAAE,CAAC;QACjB,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,UAAU;QACjB,YAAY,EAAE,SAAS;QACvB,IAAI,EAAE,CAAM;QACZ,YAAY,EAAE,CAAK;kBACnB,QAAQ;IACV,CAAC,GAAG,KAAK,EAAE,GAAG;IAEhB,MAAM,CAAC,CAAC;oBACN,UAAU;QACV,UAAU,EAAE,iBAAU,CAAC,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,CAAC;YACrE,IAAI,EAAE,CAAS;YACf,CAAe,gBAAE,IAAI;YACrB,CAAe,gBAAE,IAAI;YACrB,CAAe,gBAAE,IAAI;YACrB,CAAgB,iBAAE,IAAI;YACtB,WAAW,EAAE,CAAK;YAClB,UAAU,EAAE,CAAO;YACnB,MAAM,EAAE,MAAM;QAChB,CAAC;IACH,CAAC;AACH,CAAC;","sources":["packages/@react-aria/color/src/index.ts","packages/@react-aria/color/src/useColorSlider.ts","packages/@react-aria/color/src/useColorWheel.ts","packages/@react-aria/color/src/useColorField.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport * from './useColorSlider';\nexport * from './useColorWheel';\nexport * from './useColorField';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaColorSliderProps} from '@react-types/color';\nimport {ColorSliderState} from '@react-stately/color';\nimport {HTMLAttributes, RefObject} from 'react';\nimport {mergeProps} from '@react-aria/utils';\nimport {useLocale} from '@react-aria/i18n';\nimport {useSlider, useSliderThumb} from '@react-aria/slider';\n\ninterface ColorSliderAriaOptions extends AriaColorSliderProps {\n /** A ref for the track element. */\n trackRef: RefObject<HTMLElement>,\n /** A ref for the input element. */\n inputRef: RefObject<HTMLInputElement>\n}\n\ninterface ColorSliderAria {\n /** Props for the label element. */\n labelProps: HTMLAttributes<HTMLElement>,\n /** Props for the track element. */\n trackProps: HTMLAttributes<HTMLElement>,\n /** Props for the thumb element. */\n thumbProps: HTMLAttributes<HTMLElement>,\n /** Props for the visually hidden range input element. */\n inputProps: HTMLAttributes<HTMLElement>,\n /** Props for the output element, displaying the value of the color slider. */\n outputProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a color slider component.\n * Color sliders allow users to adjust an individual channel of a color value.\n */\nexport function useColorSlider(props: ColorSliderAriaOptions, state: ColorSliderState): ColorSliderAria {\n let {trackRef, inputRef, orientation, channel, 'aria-label': ariaLabel} = props;\n\n let {locale, direction} = useLocale();\n\n // Provide a default aria-label if there is no other label provided.\n if (!props.label && !ariaLabel && !props['aria-labelledby']) {\n ariaLabel = state.value.getChannelName(channel, locale);\n }\n\n // @ts-ignore - ignore unused incompatible props\n let {groupProps, trackProps, labelProps, outputProps} = useSlider({...props, 'aria-label': ariaLabel}, state, trackRef);\n let {inputProps, thumbProps} = useSliderThumb({\n index: 0,\n orientation,\n isDisabled: props.isDisabled,\n trackRef,\n inputRef\n }, state);\n\n let generateBackground = () => {\n let value = state.getDisplayColor();\n let to: string;\n if (orientation === 'vertical') {\n to = 'top';\n } else if (direction === 'ltr') {\n to = 'right';\n } else {\n to = 'left';\n }\n switch (channel) {\n case 'hue':\n return `linear-gradient(to ${to}, rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%)`;\n case 'lightness': {\n // We have to add an extra color stop in the middle so that the hue shows up at all.\n // Otherwise it will always just be black to white.\n let min = state.getThumbMinValue(0);\n let max = state.getThumbMaxValue(0);\n let start = value.withChannelValue(channel, min).toString('css');\n let middle = value.withChannelValue(channel, (max - min) / 2).toString('css');\n let end = value.withChannelValue(channel, max).toString('css');\n return `linear-gradient(to ${to}, ${start}, ${middle}, ${end})`;\n }\n case 'saturation':\n case 'brightness':\n case 'red':\n case 'green':\n case 'blue':\n case 'alpha': {\n let start = value.withChannelValue(channel, state.getThumbMinValue(0)).toString('css');\n let end = value.withChannelValue(channel, state.getThumbMaxValue(0)).toString('css');\n return `linear-gradient(to ${to}, ${start}, ${end})`;\n }\n default:\n throw new Error('Unknown color channel: ' + channel);\n }\n };\n\n let thumbPosition = state.getThumbPercent(0);\n if (orientation === 'vertical' || direction === 'rtl') {\n thumbPosition = 1 - thumbPosition;\n }\n\n return {\n trackProps: {\n ...mergeProps(groupProps, trackProps),\n style: {\n position: 'relative',\n touchAction: 'none',\n background: generateBackground()\n }\n },\n inputProps,\n thumbProps: {\n ...thumbProps,\n style: {\n touchAction: 'none',\n position: 'absolute',\n [orientation === 'vertical' ? 'top' : 'left']: `${thumbPosition * 100}%`,\n transform: 'translate(-50%, -50%)'\n }\n },\n labelProps,\n outputProps\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaColorWheelProps} from '@react-types/color';\nimport {ColorWheelState} from '@react-stately/color';\nimport {focusWithoutScrolling, mergeProps, useGlobalListeners, useLabels} from '@react-aria/utils';\nimport React, {ChangeEvent, HTMLAttributes, InputHTMLAttributes, RefObject, useCallback, useRef} from 'react';\nimport {useKeyboard, useMove} from '@react-aria/interactions';\nimport {useLocale} from '@react-aria/i18n';\n\ninterface ColorWheelAriaProps extends AriaColorWheelProps {\n /** The outer radius of the color wheel. */\n outerRadius: number,\n /** The inner radius of the color wheel. */\n innerRadius: number\n}\n\ninterface ColorWheelAria {\n /** Props for the track element. */\n trackProps: HTMLAttributes<HTMLElement>,\n /** Props for the thumb element. */\n thumbProps: HTMLAttributes<HTMLElement>,\n /** Props for the visually hidden range input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>\n}\n\nconst PAGE_MIN_STEP_SIZE = 6;\n\n/**\n * Provides the behavior and accessibility implementation for a color wheel component.\n * Color wheels allow users to adjust the hue of an HSL or HSB color value on a circular track.\n */\nexport function useColorWheel(props: ColorWheelAriaProps, state: ColorWheelState, inputRef: RefObject<HTMLElement>): ColorWheelAria {\n let {\n isDisabled,\n step = 1,\n innerRadius,\n outerRadius,\n 'aria-label': ariaLabel\n } = props;\n\n let {addGlobalListener, removeGlobalListener} = useGlobalListeners();\n\n let thumbRadius = (innerRadius + outerRadius) / 2;\n\n let focusInput = useCallback(() => {\n if (inputRef.current) {\n focusWithoutScrolling(inputRef.current);\n }\n }, [inputRef]);\n\n let stateRef = useRef<ColorWheelState>(null);\n stateRef.current = state;\n\n let currentPosition = useRef<{x: number, y: number}>(null);\n let moveHandler = {\n onMoveStart() {\n currentPosition.current = null;\n state.setDragging(true);\n },\n onMove({deltaX, deltaY, pointerType}) {\n if (currentPosition.current == null) {\n currentPosition.current = stateRef.current.getThumbPosition(thumbRadius);\n }\n currentPosition.current.x += deltaX;\n currentPosition.current.y += deltaY;\n if (pointerType === 'keyboard') {\n if (deltaX > 0 || deltaY < 0) {\n state.increment();\n } else if (deltaX < 0 || deltaY > 0) {\n state.decrement();\n }\n } else {\n stateRef.current.setHueFromPoint(currentPosition.current.x, currentPosition.current.y, thumbRadius);\n }\n },\n onMoveEnd() {\n isOnTrack.current = undefined;\n state.setDragging(false);\n focusInput();\n }\n };\n let {moveProps: movePropsThumb} = useMove(moveHandler);\n\n let currentPointer = useRef<number | null | undefined>(undefined);\n let isOnTrack = useRef<boolean>(false);\n let {moveProps: movePropsContainer} = useMove({\n onMoveStart() {\n if (isOnTrack.current) {\n moveHandler.onMoveStart();\n }\n },\n onMove(e) {\n if (isOnTrack.current) {\n moveHandler.onMove(e);\n }\n },\n onMoveEnd() {\n if (isOnTrack.current) {\n moveHandler.onMoveEnd();\n }\n }\n });\n\n let onThumbDown = (id: number | null) => {\n if (!state.isDragging) {\n currentPointer.current = id;\n focusInput();\n state.setDragging(true);\n\n if (typeof PointerEvent !== 'undefined') {\n addGlobalListener(window, 'pointerup', onThumbUp, false);\n } else {\n addGlobalListener(window, 'mouseup', onThumbUp, false);\n addGlobalListener(window, 'touchend', onThumbUp, false);\n }\n }\n };\n\n let onThumbUp = (e) => {\n let id = e.pointerId ?? e.changedTouches?.[0].identifier;\n if (id === currentPointer.current) {\n focusInput();\n state.setDragging(false);\n currentPointer.current = undefined;\n isOnTrack.current = false;\n\n if (typeof PointerEvent !== 'undefined') {\n removeGlobalListener(window, 'pointerup', onThumbUp, false);\n } else {\n removeGlobalListener(window, 'mouseup', onThumbUp, false);\n removeGlobalListener(window, 'touchend', onThumbUp, false);\n }\n }\n };\n\n let onTrackDown = (track: Element, id: number | null, pageX: number, pageY: number) => {\n let rect = track.getBoundingClientRect();\n let x = pageX - rect.x - rect.width / 2;\n let y = pageY - rect.y - rect.height / 2;\n let radius = Math.sqrt(x * x + y * y);\n if (innerRadius < radius && radius < outerRadius && !state.isDragging && currentPointer.current === undefined) {\n isOnTrack.current = true;\n currentPointer.current = id;\n stateRef.current.setHueFromPoint(x, y, radius);\n\n focusInput();\n state.setDragging(true);\n\n if (typeof PointerEvent !== 'undefined') {\n addGlobalListener(window, 'pointerup', onTrackUp, false);\n } else {\n addGlobalListener(window, 'mouseup', onTrackUp, false);\n addGlobalListener(window, 'touchend', onTrackUp, false);\n }\n }\n };\n\n let onTrackUp = (e) => {\n let id = e.pointerId ?? e.changedTouches?.[0].identifier;\n if (isOnTrack.current && id === currentPointer.current) {\n isOnTrack.current = false;\n currentPointer.current = undefined;\n state.setDragging(false);\n focusInput();\n\n\n if (typeof PointerEvent !== 'undefined') {\n removeGlobalListener(window, 'pointerup', onTrackUp, false);\n } else {\n removeGlobalListener(window, 'mouseup', onTrackUp, false);\n removeGlobalListener(window, 'touchend', onTrackUp, false);\n }\n }\n };\n\n let {keyboardProps} = useKeyboard({\n onKeyDown(e) {\n switch (e.key) {\n case 'PageUp':\n e.preventDefault();\n state.increment(PAGE_MIN_STEP_SIZE);\n break;\n case 'PageDown':\n e.preventDefault();\n state.decrement(PAGE_MIN_STEP_SIZE);\n break;\n }\n }\n });\n\n let trackInteractions = isDisabled ? {} : mergeProps({\n ...(typeof PointerEvent !== 'undefined' ? {\n onPointerDown: (e: React.PointerEvent) => {\n if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) {\n return;\n }\n onTrackDown(e.currentTarget, e.pointerId, e.clientX, e.clientY);\n }} : {\n onMouseDown: (e: React.MouseEvent) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onTrackDown(e.currentTarget, undefined, e.clientX, e.clientY);\n },\n onTouchStart: (e: React.TouchEvent) => {\n onTrackDown(e.currentTarget, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY);\n }\n })\n }, movePropsContainer);\n\n let thumbInteractions = isDisabled ? {} : mergeProps({\n onMouseDown: (e: React.MouseEvent) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onThumbDown(undefined);\n },\n onPointerDown: (e: React.PointerEvent) => {\n if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) {\n return;\n }\n onThumbDown(e.pointerId);\n },\n onTouchStart: (e: React.TouchEvent) => {\n onThumbDown(e.changedTouches[0].identifier);\n }\n }, movePropsThumb, keyboardProps);\n let {x, y} = state.getThumbPosition(thumbRadius);\n\n // Provide a default aria-label if none is given\n let {locale} = useLocale();\n if (ariaLabel == null && props['aria-labelledby'] == null) {\n ariaLabel = state.value.getChannelName('hue', locale);\n }\n\n let inputLabellingProps = useLabels({\n ...props,\n 'aria-label': ariaLabel\n });\n\n return {\n trackProps: {\n ...trackInteractions,\n style: {\n position: 'relative',\n touchAction: 'none',\n width: outerRadius * 2,\n height: outerRadius * 2,\n background: `\n conic-gradient(\n from 90deg,\n hsl(0, 100%, 50%),\n hsl(30, 100%, 50%),\n hsl(60, 100%, 50%),\n hsl(90, 100%, 50%),\n hsl(120, 100%, 50%),\n hsl(150, 100%, 50%),\n hsl(180, 100%, 50%),\n hsl(210, 100%, 50%),\n hsl(240, 100%, 50%),\n hsl(270, 100%, 50%),\n hsl(300, 100%, 50%),\n hsl(330, 100%, 50%),\n hsl(360, 100%, 50%)\n )\n `,\n clipPath: `path(evenodd, \"${circlePath(outerRadius, outerRadius, outerRadius)} ${circlePath(outerRadius, outerRadius, innerRadius)}\")`\n }\n },\n thumbProps: {\n ...thumbInteractions,\n style: {\n position: 'absolute',\n left: '50%',\n top: '50%',\n transform: `translate(calc(${x}px - 50%), calc(${y}px - 50%))`,\n touchAction: 'none'\n }\n },\n inputProps: mergeProps(\n inputLabellingProps,\n {\n type: 'range',\n min: '0',\n max: '360',\n step: String(step),\n 'aria-valuetext': state.value.formatChannelValue('hue', locale),\n disabled: isDisabled,\n value: `${state.value.getChannelValue('hue')}`,\n onChange: (e: ChangeEvent<HTMLInputElement>) => {\n state.setHue(parseFloat(e.target.value));\n }\n }\n )\n };\n}\n\n// Creates an SVG path string for a circle.\nfunction circlePath(cx: number, cy: number, r: number) {\n 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`;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaColorFieldProps} from '@react-types/color';\nimport {ColorFieldState} from '@react-stately/color';\nimport {\n HTMLAttributes,\n LabelHTMLAttributes,\n RefObject,\n useCallback,\n useState\n} from 'react';\nimport {mergeProps, useId} from '@react-aria/utils';\nimport {useFocusWithin, useScrollWheel} from '@react-aria/interactions';\nimport {useFormattedTextField} from '@react-aria/textfield';\nimport {useSpinButton} from '@react-aria/spinbutton';\n\ninterface ColorFieldAria {\n /** Props for the label element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n /** Props for the input element. */\n inputProps: HTMLAttributes<HTMLInputElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a color field component.\n * Color fields allow users to enter and adjust a hex color value.\n */\nexport function useColorField(\n props: AriaColorFieldProps,\n state: ColorFieldState,\n ref: RefObject<HTMLInputElement>\n): ColorFieldAria {\n let {\n isDisabled,\n isReadOnly,\n isRequired\n } = props;\n\n let {\n colorValue,\n inputValue,\n commit,\n increment,\n decrement,\n incrementToMax,\n decrementToMin\n } = state;\n\n let inputId = useId();\n let {spinButtonProps} = useSpinButton(\n {\n isDisabled,\n isReadOnly,\n isRequired,\n maxValue: 0xFFFFFF,\n minValue: 0,\n onIncrement: increment,\n onIncrementToMax: incrementToMax,\n onDecrement: decrement,\n onDecrementToMin: decrementToMin,\n value: colorValue ? colorValue.toHexInt() : undefined,\n textValue: colorValue ? colorValue.toString('hex') : undefined\n }\n );\n\n let [focusWithin, setFocusWithin] = useState(false);\n let {focusWithinProps} = useFocusWithin({isDisabled, onFocusWithinChange: setFocusWithin});\n\n let onWheel = useCallback((e) => {\n if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) {\n return;\n }\n if (e.deltaY > 0) {\n increment();\n } else if (e.deltaY < 0) {\n decrement();\n }\n }, [isReadOnly, isDisabled, decrement, increment]);\n // If the input isn't supposed to receive input, disable scrolling.\n let scrollingDisabled = isDisabled || isReadOnly || !focusWithin;\n useScrollWheel({onScroll: onWheel, isDisabled: scrollingDisabled}, ref);\n\n let onChange = value => {\n state.setInputValue(value);\n };\n\n let {labelProps, inputProps} = useFormattedTextField(\n mergeProps(props, {\n id: inputId,\n value: inputValue,\n defaultValue: undefined,\n type: 'text',\n autoComplete: 'off',\n onChange\n }), state, ref);\n\n return {\n labelProps,\n inputProps: mergeProps(inputProps, spinButtonProps, focusWithinProps, {\n role: 'textbox',\n 'aria-valuemax': null,\n 'aria-valuemin': null,\n 'aria-valuenow': null,\n 'aria-valuetext': null,\n autoCorrect: 'off',\n spellCheck: 'false',\n onBlur: commit\n })\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/color",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.8",
|
|
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.3.
|
|
22
|
-
"@react-aria/interactions": "^3.8.
|
|
23
|
-
"@react-aria/slider": "^3.0.
|
|
24
|
-
"@react-aria/spinbutton": "^3.0.
|
|
25
|
-
"@react-aria/textfield": "^3.5.
|
|
26
|
-
"@react-aria/utils": "^3.11.
|
|
27
|
-
"@react-stately/color": "3.0.0-beta.
|
|
28
|
-
"@react-types/color": "3.0.0-beta.
|
|
29
|
-
"@react-types/shared": "^3.11.
|
|
30
|
-
"@react-types/slider": "^3.0.
|
|
21
|
+
"@react-aria/i18n": "^3.3.6",
|
|
22
|
+
"@react-aria/interactions": "^3.8.1",
|
|
23
|
+
"@react-aria/slider": "^3.0.5",
|
|
24
|
+
"@react-aria/spinbutton": "^3.0.3",
|
|
25
|
+
"@react-aria/textfield": "^3.5.2",
|
|
26
|
+
"@react-aria/utils": "^3.11.2",
|
|
27
|
+
"@react-stately/color": "3.0.0-beta.7",
|
|
28
|
+
"@react-types/color": "3.0.0-beta.5",
|
|
29
|
+
"@react-types/shared": "^3.11.1",
|
|
30
|
+
"@react-types/slider": "^3.0.4"
|
|
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": "404d41859b7d6f56201d7fc01bd9f22ae3512937"
|
|
40
40
|
}
|