@react-aria/color 3.0.0-beta.13 → 3.0.0-beta.14

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.
@@ -1 +1 @@
1
- {"mappings":";;;ACuBA;IACE,kDAAkD;IAClD,cAAc,EAAE,eAAe,WAAW,CAAC,CAAC;IAC5C,4DAA4D;IAC5D,aAAa,EAAE,eAAe,WAAW,CAAC,CAAC;IAC3C,mCAAmC;IACnC,UAAU,EAAE,eAAe,WAAW,CAAC,CAAC;IACxC,oEAAoE;IACpE,WAAW,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IACnD,kEAAkE;IAClE,WAAW,EAAE,oBAAoB,gBAAgB,CAAC,CAAA;CACnD;AAED,4BAA6B,SAAQ,kBAAkB;IACrD,uEAAuE;IACvE,SAAS,EAAE,UAAU,WAAW,CAAC,CAAC;IAClC,uEAAuE;IACvE,SAAS,EAAE,UAAU,WAAW,CAAC,CAAC;IAClC,kDAAkD;IAClD,YAAY,EAAE,UAAU,WAAW,CAAC,CAAA;CACrC;AAED;;;GAGG;AACH,6BAA6B,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,cAAc,GAAG,aAAa,CA6Y5F;AC3aD,gCAAiC,SAAQ,oBAAoB;IAC3D,mCAAmC;IACnC,QAAQ,EAAE,UAAU,WAAW,CAAC,CAAC;IACjC,mCAAmC;IACnC,QAAQ,EAAE,UAAU,gBAAgB,CAAC,CAAA;CACtC;AAED;IACE,mCAAmC;IACnC,UAAU,EAAE,eAAe,WAAW,CAAC,CAAC;IACxC,mCAAmC;IACnC,UAAU,EAAE,eAAe,WAAW,CAAC,CAAC;IACxC,mCAAmC;IACnC,UAAU,EAAE,eAAe,WAAW,CAAC,CAAC;IACxC,yDAAyD;IACzD,UAAU,EAAE,eAAe,WAAW,CAAC,CAAC;IACxC,8EAA8E;IAC9E,WAAW,EAAE,eAAe,WAAW,CAAC,CAAA;CACzC;AAED;;;GAGG;AACH,+BAA+B,KAAK,EAAE,sBAAsB,EAAE,KAAK,EAAE,gBAAgB,GAAG,eAAe,CAqFtG;AC7GD,6BAA8B,SAAQ,mBAAmB;IACvD,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAA;CACpB;AAED;IACE,mCAAmC;IACnC,UAAU,EAAE,eAAe,WAAW,CAAC,CAAC;IACxC,mCAAmC;IACnC,UAAU,EAAE,eAAe,WAAW,CAAC,CAAC;IACxC,yDAAyD;IACzD,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,CAAA;CAClD;AAED;;;GAGG;AACH,8BAA8B,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,UAAU,WAAW,CAAC,GAAG,cAAc,CAmRlI;AChSD;IACE,mCAAmC;IACnC,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IAClD,mCAAmC;IACnC,UAAU,EAAE,eAAe,gBAAgB,CAAC,CAAA;CAC7C;AAED;;;GAGG;AACH,8BACE,KAAK,EAAE,mBAAmB,EAC1B,KAAK,EAAE,eAAe,EACtB,GAAG,EAAE,UAAU,gBAAgB,CAAC,GAC/B,cAAc,CA8EhB","sources":["packages/@react-aria/color/src/packages/@react-aria/color/src/useColorAreaGradient.ts","packages/@react-aria/color/src/packages/@react-aria/color/src/useColorArea.ts","packages/@react-aria/color/src/packages/@react-aria/color/src/useColorSlider.ts","packages/@react-aria/color/src/packages/@react-aria/color/src/useColorWheel.ts","packages/@react-aria/color/src/packages/@react-aria/color/src/useColorField.ts","packages/@react-aria/color/src/packages/@react-aria/color/src/index.ts","packages/@react-aria/color/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,"/*\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 './useColorArea';\nexport * from './useColorSlider';\nexport * from './useColorWheel';\nexport * from './useColorField';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;;ACwBA;IACE,kDAAkD;IAClD,cAAc,EAAE,aAAa,CAAC;IAC9B,4DAA4D;IAC5D,aAAa,EAAE,aAAa,CAAC;IAC7B,mCAAmC;IACnC,UAAU,EAAE,aAAa,CAAC;IAC1B,oEAAoE;IACpE,WAAW,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IACnD,kEAAkE;IAClE,WAAW,EAAE,oBAAoB,gBAAgB,CAAC,CAAA;CACnD;AAED,qCAAsC,SAAQ,kBAAkB;IAC9D,uEAAuE;IACvE,SAAS,EAAE,UAAU,gBAAgB,CAAC,CAAC;IACvC,uEAAuE;IACvE,SAAS,EAAE,UAAU,gBAAgB,CAAC,CAAC;IACvC,kDAAkD;IAClD,YAAY,EAAE,UAAU,OAAO,CAAC,CAAA;CACjC;AAED;;;GAGG;AACH,6BAA6B,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,cAAc,GAAG,aAAa,CA6Y9F;AC3aD,uCAAwC,SAAQ,oBAAoB;IAClE,mCAAmC;IACnC,QAAQ,EAAE,UAAU,OAAO,CAAC,CAAC;IAC7B,mCAAmC;IACnC,QAAQ,EAAE,UAAU,gBAAgB,CAAC,CAAA;CACtC;AAED;IACE,mCAAmC;IACnC,UAAU,EAAE,aAAa,CAAC;IAC1B,mCAAmC;IACnC,UAAU,EAAE,aAAa,CAAC;IAC1B,mCAAmC;IACnC,UAAU,EAAE,aAAa,CAAC;IAC1B,yDAAyD;IACzD,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IAClD,8EAA8E;IAC9E,WAAW,EAAE,aAAa,CAAA;CAC3B;AAED;;;GAGG;AACH,+BAA+B,KAAK,EAAE,sBAAsB,EAAE,KAAK,EAAE,gBAAgB,GAAG,eAAe,CAgFtG;ACxGD,sCAAuC,SAAQ,mBAAmB;IAChE,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAA;CACpB;AAED;IACE,mCAAmC;IACnC,UAAU,EAAE,aAAa,CAAC;IAC1B,mCAAmC;IACnC,UAAU,EAAE,aAAa,CAAC;IAC1B,yDAAyD;IACzD,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,CAAA;CAClD;AAED;;;GAGG;AACH,8BAA8B,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,UAAU,gBAAgB,CAAC,GAAG,cAAc,CA0RzI;ACxSD;IACE,mCAAmC;IACnC,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IAClD,mCAAmC;IACnC,UAAU,EAAE,eAAe,gBAAgB,CAAC,CAAA;CAC7C;AAED;;;GAGG;AACH,8BACE,KAAK,EAAE,mBAAmB,EAC1B,KAAK,EAAE,eAAe,EACtB,GAAG,EAAE,UAAU,gBAAgB,CAAC,GAC/B,cAAc,CA8EhB;ACrGD,YAAY,EAAC,mBAAmB,EAAC,MAAM,oBAAoB,CAAC","sources":["packages/@react-aria/color/src/packages/@react-aria/color/src/useColorAreaGradient.ts","packages/@react-aria/color/src/packages/@react-aria/color/src/useColorArea.ts","packages/@react-aria/color/src/packages/@react-aria/color/src/useColorSlider.ts","packages/@react-aria/color/src/packages/@react-aria/color/src/useColorWheel.ts","packages/@react-aria/color/src/packages/@react-aria/color/src/useColorField.ts","packages/@react-aria/color/src/packages/@react-aria/color/src/index.ts","packages/@react-aria/color/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,"/*\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 */\nexport {useColorArea} from './useColorArea';\nexport {useColorSlider} from './useColorSlider';\nexport {useColorWheel} from './useColorWheel';\nexport {useColorField} from './useColorField';\nexport type {AriaColorAreaOptions, ColorAreaAria} from './useColorArea';\nexport type {AriaColorSliderOptions, ColorSliderAria} from './useColorSlider';\nexport type {AriaColorWheelOptions, ColorWheelAria} from './useColorWheel';\nexport type {AriaColorFieldProps} from '@react-types/color';\nexport type {ColorFieldAria} from './useColorField';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/color",
3
- "version": "3.0.0-beta.13",
3
+ "version": "3.0.0-beta.14",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -18,18 +18,17 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@babel/runtime": "^7.6.2",
21
- "@internationalized/message": "^3.0.8",
22
- "@react-aria/i18n": "^3.4.1",
23
- "@react-aria/interactions": "^3.9.1",
24
- "@react-aria/slider": "^3.1.1",
25
- "@react-aria/spinbutton": "^3.1.1",
26
- "@react-aria/textfield": "^3.6.1",
27
- "@react-aria/utils": "^3.13.1",
28
- "@react-aria/visually-hidden": "^3.3.1",
29
- "@react-stately/color": "^3.0.0",
30
- "@react-types/color": "3.0.0-beta.10",
31
- "@react-types/shared": "^3.13.1",
32
- "@react-types/slider": "^3.1.1"
21
+ "@react-aria/i18n": "^3.5.0",
22
+ "@react-aria/interactions": "^3.10.0",
23
+ "@react-aria/slider": "^3.2.0",
24
+ "@react-aria/spinbutton": "^3.1.2",
25
+ "@react-aria/textfield": "^3.7.0",
26
+ "@react-aria/utils": "^3.13.2",
27
+ "@react-aria/visually-hidden": "^3.4.0",
28
+ "@react-stately/color": "^3.1.0",
29
+ "@react-types/color": "3.0.0-beta.11",
30
+ "@react-types/shared": "^3.14.0",
31
+ "@react-types/slider": "^3.2.0"
33
32
  },
34
33
  "peerDependencies": {
35
34
  "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0",
@@ -38,5 +37,5 @@
38
37
  "publishConfig": {
39
38
  "access": "public"
40
39
  },
41
- "gitHead": "715c3f563ccf8c2e0102d3e18403d9db21a05a71"
40
+ "gitHead": "cd7c0ec917122c7612f653c22f8ed558f8b66ecd"
42
41
  }
package/src/index.ts CHANGED
@@ -9,8 +9,12 @@
9
9
  * OF ANY KIND, either express or implied. See the License for the specific language
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
-
13
- export * from './useColorArea';
14
- export * from './useColorSlider';
15
- export * from './useColorWheel';
16
- export * from './useColorField';
12
+ export {useColorArea} from './useColorArea';
13
+ export {useColorSlider} from './useColorSlider';
14
+ export {useColorWheel} from './useColorWheel';
15
+ export {useColorField} from './useColorField';
16
+ export type {AriaColorAreaOptions, ColorAreaAria} from './useColorArea';
17
+ export type {AriaColorSliderOptions, ColorSliderAria} from './useColorSlider';
18
+ export type {AriaColorWheelOptions, ColorWheelAria} from './useColorWheel';
19
+ export type {AriaColorFieldProps} from '@react-types/color';
20
+ export type {ColorFieldAria} from './useColorField';
@@ -12,42 +12,43 @@
12
12
 
13
13
  import {AriaColorAreaProps, ColorChannel} from '@react-types/color';
14
14
  import {ColorAreaState} from '@react-stately/color';
15
+ import {DOMAttributes} from '@react-types/shared';
15
16
  import {focusWithoutScrolling, isAndroid, isIOS, mergeProps, useGlobalListeners, useLabels} from '@react-aria/utils';
16
17
  // @ts-ignore
17
18
  import intlMessages from '../intl/*.json';
18
- import React, {ChangeEvent, HTMLAttributes, InputHTMLAttributes, RefObject, useCallback, useRef} from 'react';
19
+ import React, {ChangeEvent, InputHTMLAttributes, RefObject, useCallback, useRef} from 'react';
19
20
  import {useColorAreaGradient} from './useColorAreaGradient';
20
21
  import {useFocus, useFocusWithin, useKeyboard, useMove} from '@react-aria/interactions';
21
- import {useLocale, useMessageFormatter} from '@react-aria/i18n';
22
+ import {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';
22
23
  import {useVisuallyHidden} from '@react-aria/visually-hidden';
23
24
 
24
- interface ColorAreaAria {
25
+ export interface ColorAreaAria {
25
26
  /** Props for the color area container element. */
26
- colorAreaProps: HTMLAttributes<HTMLElement>,
27
+ colorAreaProps: DOMAttributes,
27
28
  /** Props for the color area gradient foreground element. */
28
- gradientProps: HTMLAttributes<HTMLElement>,
29
+ gradientProps: DOMAttributes,
29
30
  /** Props for the thumb element. */
30
- thumbProps: HTMLAttributes<HTMLElement>,
31
+ thumbProps: DOMAttributes,
31
32
  /** Props for the visually hidden horizontal range input element. */
32
33
  xInputProps: InputHTMLAttributes<HTMLInputElement>,
33
34
  /** Props for the visually hidden vertical range input element. */
34
35
  yInputProps: InputHTMLAttributes<HTMLInputElement>
35
36
  }
36
37
 
37
- interface ColorAreaAriaProps extends AriaColorAreaProps {
38
+ export interface AriaColorAreaOptions extends AriaColorAreaProps {
38
39
  /** A ref to the input that represents the x axis of the color area. */
39
- inputXRef: RefObject<HTMLElement>,
40
+ inputXRef: RefObject<HTMLInputElement>,
40
41
  /** A ref to the input that represents the y axis of the color area. */
41
- inputYRef: RefObject<HTMLElement>,
42
+ inputYRef: RefObject<HTMLInputElement>,
42
43
  /** A ref to the color area containing element. */
43
- containerRef: RefObject<HTMLElement>
44
+ containerRef: RefObject<Element>
44
45
  }
45
46
 
46
47
  /**
47
- * Provides the behavior and accessibility implementation for a color wheel component.
48
- * Color wheels allow users to adjust the hue of an HSL or HSB color value on a circular track.
48
+ * Provides the behavior and accessibility implementation for a color area component.
49
+ * Color area allows users to adjust two channels of an RGB, HSL or HSB color value against a two-dimensional gradient background.
49
50
  */
50
- export function useColorArea(props: ColorAreaAriaProps, state: ColorAreaState): ColorAreaAria {
51
+ export function useColorArea(props: AriaColorAreaOptions, state: ColorAreaState): ColorAreaAria {
51
52
  let {
52
53
  isDisabled,
53
54
  inputXRef,
@@ -55,15 +56,15 @@ export function useColorArea(props: ColorAreaAriaProps, state: ColorAreaState):
55
56
  containerRef,
56
57
  'aria-label': ariaLabel
57
58
  } = props;
58
- let formatMessage = useMessageFormatter(intlMessages);
59
+ let stringFormatter = useLocalizedStringFormatter(intlMessages);
59
60
 
60
61
  let {addGlobalListener, removeGlobalListener} = useGlobalListeners();
61
62
 
62
63
  let {direction, locale} = useLocale();
63
64
 
64
- let focusedInputRef = useRef<HTMLElement>(null);
65
+ let focusedInputRef = useRef<HTMLInputElement>(null);
65
66
 
66
- let focusInput = useCallback((inputRef:RefObject<HTMLElement> = inputXRef) => {
67
+ let focusInput = useCallback((inputRef:RefObject<HTMLInputElement> = inputXRef) => {
67
68
  if (inputRef.current) {
68
69
  focusWithoutScrolling(inputRef.current);
69
70
  }
@@ -330,36 +331,36 @@ export function useColorArea(props: ColorAreaAriaProps, state: ColorAreaState):
330
331
  function getAriaValueTextForChannel(channel:ColorChannel) {
331
332
  return (
332
333
  valueChangedViaKeyboard.current ?
333
- formatMessage('colorNameAndValue', {name: state.value.getChannelName(channel, locale), value: state.value.formatChannelValue(channel, locale)})
334
+ stringFormatter.format('colorNameAndValue', {name: state.value.getChannelName(channel, locale), value: state.value.formatChannelValue(channel, locale)})
334
335
  :
335
336
  [
336
- formatMessage('colorNameAndValue', {name: state.value.getChannelName(channel, locale), value: state.value.formatChannelValue(channel, locale)}),
337
- formatMessage('colorNameAndValue', {name: state.value.getChannelName(channel === yChannel ? xChannel : yChannel, locale), value: state.value.formatChannelValue(channel === yChannel ? xChannel : yChannel, locale)})
337
+ stringFormatter.format('colorNameAndValue', {name: state.value.getChannelName(channel, locale), value: state.value.formatChannelValue(channel, locale)}),
338
+ stringFormatter.format('colorNameAndValue', {name: state.value.getChannelName(channel === yChannel ? xChannel : yChannel, locale), value: state.value.formatChannelValue(channel === yChannel ? xChannel : yChannel, locale)})
338
339
  ].join(', ')
339
340
  );
340
341
  }
341
342
 
342
- let colorPickerLabel = formatMessage('colorPicker');
343
+ let colorPickerLabel = stringFormatter.format('colorPicker');
343
344
 
344
345
  let xInputLabellingProps = useLabels({
345
346
  ...props,
346
- 'aria-label': ariaLabel ? formatMessage('colorInputLabel', {label: ariaLabel, channelLabel: colorPickerLabel}) : colorPickerLabel
347
+ 'aria-label': ariaLabel ? stringFormatter.format('colorInputLabel', {label: ariaLabel, channelLabel: colorPickerLabel}) : colorPickerLabel
347
348
  });
348
349
 
349
350
  let yInputLabellingProps = useLabels({
350
351
  ...props,
351
- 'aria-label': ariaLabel ? formatMessage('colorInputLabel', {label: ariaLabel, channelLabel: colorPickerLabel}) : colorPickerLabel
352
+ 'aria-label': ariaLabel ? stringFormatter.format('colorInputLabel', {label: ariaLabel, channelLabel: colorPickerLabel}) : colorPickerLabel
352
353
  });
353
354
 
354
- let colorAriaLabellingProps = useLabels(
355
+ let colorAreaLabellingProps = useLabels(
355
356
  {
356
357
  ...props,
357
- 'aria-label': ariaLabel ? `${ariaLabel} ${colorPickerLabel}` : undefined
358
+ 'aria-label': ariaLabel ? `${ariaLabel}, ${colorPickerLabel}` : undefined
358
359
  },
359
360
  isMobile ? colorPickerLabel : undefined
360
361
  );
361
362
 
362
- let ariaRoleDescription = formatMessage('twoDimensionalSlider');
363
+ let ariaRoleDescription = stringFormatter.format('twoDimensionalSlider');
363
364
 
364
365
  let {visuallyHiddenProps} = useVisuallyHidden({style: {
365
366
  opacity: '0.0001',
@@ -382,7 +383,7 @@ export function useColorArea(props: ColorAreaAriaProps, state: ColorAreaState):
382
383
 
383
384
  return {
384
385
  colorAreaProps: {
385
- ...colorAriaLabellingProps,
386
+ ...colorAreaLabellingProps,
386
387
  ...colorAreaInteractions,
387
388
  ...colorAreaStyleProps,
388
389
  role: 'group'
@@ -414,7 +415,7 @@ export function useColorArea(props: ColorAreaAriaProps, state: ColorAreaState):
414
415
  add aria-hidden="true" to the unfocused control when the value has not changed via the keyboard,
415
416
  but remove aria-hidden to reveal the input for each channel when the value has changed with the keyboard.
416
417
  */
417
- 'aria-hidden': (!isMobile && focusedInputRef.current === inputYRef.current && !valueChangedViaKeyboard.current ? 'true' : undefined),
418
+ 'aria-hidden': (isMobile || !focusedInputRef.current || focusedInputRef.current === inputXRef.current || valueChangedViaKeyboard.current ? undefined : 'true'),
418
419
  onChange: (e: ChangeEvent<HTMLInputElement>) => {
419
420
  state.setXValue(parseFloat(e.target.value));
420
421
  }
@@ -432,13 +433,13 @@ export function useColorArea(props: ColorAreaAriaProps, state: ColorAreaState):
432
433
  'aria-orientation': 'vertical',
433
434
  disabled: isDisabled,
434
435
  value: state.value.getChannelValue(yChannel),
435
- tabIndex: (isMobile || focusedInputRef.current === inputYRef.current ? undefined : -1),
436
+ tabIndex: (isMobile || (focusedInputRef.current && focusedInputRef.current === inputYRef.current) ? undefined : -1),
436
437
  /*
437
438
  So that only a single "2d slider" control shows up when listing form elements for screen readers,
438
439
  add aria-hidden="true" to the unfocused input when the value has not changed via the keyboard,
439
440
  but remove aria-hidden to reveal the input for each channel when the value has changed with the keyboard.
440
441
  */
441
- 'aria-hidden': (isMobile || focusedInputRef.current === inputYRef.current || valueChangedViaKeyboard.current ? undefined : 'true'),
442
+ 'aria-hidden': (isMobile || (focusedInputRef.current && focusedInputRef.current === inputYRef.current) || valueChangedViaKeyboard.current ? undefined : 'true'),
442
443
  onChange: (e: ChangeEvent<HTMLInputElement>) => {
443
444
  state.setYValue(parseFloat(e.target.value));
444
445
  }
@@ -218,17 +218,21 @@ export function useColorAreaGradient({direction, state, zChannel, xChannel, isDi
218
218
  x = 1 - x;
219
219
  }
220
220
 
221
+ let forcedColorAdjustNoneStyle = {forcedColorAdjust: 'none'};
222
+
221
223
  return {
222
224
  colorAreaStyleProps: {
223
225
  style: {
224
226
  position: 'relative',
225
227
  touchAction: 'none',
228
+ ...forcedColorAdjustNoneStyle,
226
229
  ...background.colorAreaStyles
227
230
  }
228
231
  },
229
232
  gradientStyleProps: {
230
233
  style: {
231
234
  touchAction: 'none',
235
+ ...forcedColorAdjustNoneStyle,
232
236
  ...background.gradientStyles
233
237
  }
234
238
  },
@@ -238,7 +242,8 @@ export function useColorAreaGradient({direction, state, zChannel, xChannel, isDi
238
242
  left: `${x * 100}%`,
239
243
  top: `${y * 100}%`,
240
244
  transform: 'translate(0%, 0%)',
241
- touchAction: 'none'
245
+ touchAction: 'none',
246
+ ...forcedColorAdjustNoneStyle
242
247
  }
243
248
  }
244
249
  };
@@ -24,7 +24,7 @@ import {useFocusWithin, useScrollWheel} from '@react-aria/interactions';
24
24
  import {useFormattedTextField} from '@react-aria/textfield';
25
25
  import {useSpinButton} from '@react-aria/spinbutton';
26
26
 
27
- interface ColorFieldAria {
27
+ export interface ColorFieldAria {
28
28
  /** Props for the label element. */
29
29
  labelProps: LabelHTMLAttributes<HTMLLabelElement>,
30
30
  /** Props for the input element. */
@@ -12,36 +12,37 @@
12
12
 
13
13
  import {AriaColorSliderProps} from '@react-types/color';
14
14
  import {ColorSliderState} from '@react-stately/color';
15
- import {HTMLAttributes, RefObject} from 'react';
15
+ import {DOMAttributes} from '@react-types/shared';
16
+ import {InputHTMLAttributes, RefObject} from 'react';
16
17
  import {mergeProps} from '@react-aria/utils';
17
18
  import {useLocale} from '@react-aria/i18n';
18
19
  import {useSlider, useSliderThumb} from '@react-aria/slider';
19
20
 
20
- interface ColorSliderAriaOptions extends AriaColorSliderProps {
21
+ export interface AriaColorSliderOptions extends AriaColorSliderProps {
21
22
  /** A ref for the track element. */
22
- trackRef: RefObject<HTMLElement>,
23
+ trackRef: RefObject<Element>,
23
24
  /** A ref for the input element. */
24
25
  inputRef: RefObject<HTMLInputElement>
25
26
  }
26
27
 
27
- interface ColorSliderAria {
28
+ export interface ColorSliderAria {
28
29
  /** Props for the label element. */
29
- labelProps: HTMLAttributes<HTMLElement>,
30
+ labelProps: DOMAttributes,
30
31
  /** Props for the track element. */
31
- trackProps: HTMLAttributes<HTMLElement>,
32
+ trackProps: DOMAttributes,
32
33
  /** Props for the thumb element. */
33
- thumbProps: HTMLAttributes<HTMLElement>,
34
+ thumbProps: DOMAttributes,
34
35
  /** Props for the visually hidden range input element. */
35
- inputProps: HTMLAttributes<HTMLElement>,
36
+ inputProps: InputHTMLAttributes<HTMLInputElement>,
36
37
  /** Props for the output element, displaying the value of the color slider. */
37
- outputProps: HTMLAttributes<HTMLElement>
38
+ outputProps: DOMAttributes
38
39
  }
39
40
 
40
41
  /**
41
42
  * Provides the behavior and accessibility implementation for a color slider component.
42
43
  * Color sliders allow users to adjust an individual channel of a color value.
43
44
  */
44
- export function useColorSlider(props: ColorSliderAriaOptions, state: ColorSliderState): ColorSliderAria {
45
+ export function useColorSlider(props: AriaColorSliderOptions, state: ColorSliderState): ColorSliderAria {
45
46
  let {trackRef, inputRef, orientation, channel, 'aria-label': ariaLabel} = props;
46
47
 
47
48
  let {locale, direction} = useLocale();
@@ -99,17 +100,14 @@ export function useColorSlider(props: ColorSliderAriaOptions, state: ColorSlider
99
100
  }
100
101
  };
101
102
 
102
- let thumbPosition = state.getThumbPercent(0);
103
- if (orientation === 'vertical' || direction === 'rtl') {
104
- thumbPosition = 1 - thumbPosition;
105
- }
103
+ let forcedColorAdjustNoneStyle = {forcedColorAdjust: 'none'};
106
104
 
107
105
  return {
108
106
  trackProps: {
109
107
  ...mergeProps(groupProps, trackProps),
110
108
  style: {
111
- position: 'relative',
112
- touchAction: 'none',
109
+ ...trackProps.style,
110
+ ...forcedColorAdjustNoneStyle,
113
111
  background: generateBackground()
114
112
  }
115
113
  },
@@ -117,10 +115,8 @@ export function useColorSlider(props: ColorSliderAriaOptions, state: ColorSlider
117
115
  thumbProps: {
118
116
  ...thumbProps,
119
117
  style: {
120
- touchAction: 'none',
121
- position: 'absolute',
122
- [orientation === 'vertical' ? 'top' : 'left']: `${thumbPosition * 100}%`,
123
- transform: 'translate(-50%, -50%)'
118
+ ...thumbProps.style,
119
+ ...forcedColorAdjustNoneStyle
124
120
  }
125
121
  },
126
122
  labelProps,
@@ -12,23 +12,24 @@
12
12
 
13
13
  import {AriaColorWheelProps} from '@react-types/color';
14
14
  import {ColorWheelState} from '@react-stately/color';
15
+ import {DOMAttributes} from '@react-types/shared';
15
16
  import {focusWithoutScrolling, mergeProps, useGlobalListeners, useLabels} from '@react-aria/utils';
16
- import React, {ChangeEvent, HTMLAttributes, InputHTMLAttributes, RefObject, useCallback, useRef} from 'react';
17
+ import React, {ChangeEvent, InputHTMLAttributes, RefObject, useCallback, useRef} from 'react';
17
18
  import {useKeyboard, useMove} from '@react-aria/interactions';
18
19
  import {useLocale} from '@react-aria/i18n';
19
20
 
20
- interface ColorWheelAriaProps extends AriaColorWheelProps {
21
+ export interface AriaColorWheelOptions extends AriaColorWheelProps {
21
22
  /** The outer radius of the color wheel. */
22
23
  outerRadius: number,
23
24
  /** The inner radius of the color wheel. */
24
25
  innerRadius: number
25
26
  }
26
27
 
27
- interface ColorWheelAria {
28
+ export interface ColorWheelAria {
28
29
  /** Props for the track element. */
29
- trackProps: HTMLAttributes<HTMLElement>,
30
+ trackProps: DOMAttributes,
30
31
  /** Props for the thumb element. */
31
- thumbProps: HTMLAttributes<HTMLElement>,
32
+ thumbProps: DOMAttributes,
32
33
  /** Props for the visually hidden range input element. */
33
34
  inputProps: InputHTMLAttributes<HTMLInputElement>
34
35
  }
@@ -37,7 +38,7 @@ interface ColorWheelAria {
37
38
  * Provides the behavior and accessibility implementation for a color wheel component.
38
39
  * Color wheels allow users to adjust the hue of an HSL or HSB color value on a circular track.
39
40
  */
40
- export function useColorWheel(props: ColorWheelAriaProps, state: ColorWheelState, inputRef: RefObject<HTMLElement>): ColorWheelAria {
41
+ export function useColorWheel(props: AriaColorWheelOptions, state: ColorWheelState, inputRef: RefObject<HTMLInputElement>): ColorWheelAria {
41
42
  let {
42
43
  isDisabled,
43
44
  innerRadius,
@@ -257,6 +258,11 @@ export function useColorWheel(props: ColorWheelAriaProps, state: ColorWheelState
257
258
  });
258
259
 
259
260
  let {minValue, maxValue, step} = state.value.getChannelRange('hue');
261
+
262
+ let forcedColorAdjustNoneStyle = {
263
+ forcedColorAdjust: 'none'
264
+ };
265
+
260
266
  return {
261
267
  trackProps: {
262
268
  ...trackInteractions,
@@ -283,7 +289,8 @@ export function useColorWheel(props: ColorWheelAriaProps, state: ColorWheelState
283
289
  hsl(360, 100%, 50%)
284
290
  )
285
291
  `,
286
- clipPath: `path(evenodd, "${circlePath(outerRadius, outerRadius, outerRadius)} ${circlePath(outerRadius, outerRadius, innerRadius)}")`
292
+ clipPath: `path(evenodd, "${circlePath(outerRadius, outerRadius, outerRadius)} ${circlePath(outerRadius, outerRadius, innerRadius)}")`,
293
+ ...forcedColorAdjustNoneStyle
287
294
  }
288
295
  },
289
296
  thumbProps: {
@@ -293,7 +300,8 @@ export function useColorWheel(props: ColorWheelAriaProps, state: ColorWheelState
293
300
  left: '50%',
294
301
  top: '50%',
295
302
  transform: `translate(calc(${x}px - 50%), calc(${y}px - 50%))`,
296
- touchAction: 'none'
303
+ touchAction: 'none',
304
+ ...forcedColorAdjustNoneStyle
297
305
  }
298
306
  },
299
307
  inputProps: mergeProps(