diff --git a/packages/@react-aria/color/test/useColorWheel.test.tsx b/packages/@react-aria/color/test/useColorWheel.test.tsx
index b336c7828c6..e0ede0a76e4 100644
--- a/packages/@react-aria/color/test/useColorWheel.test.tsx
+++ b/packages/@react-aria/color/test/useColorWheel.test.tsx
@@ -11,9 +11,9 @@
*/
import {act, fireEvent, render} from '@testing-library/react';
-import {Color, useColorWheelState} from '@react-stately/color';
import {ColorWheelProps} from '@react-types/color';
import {installMouseEvent, installPointerEvent} from '@react-spectrum/test-utils';
+import {parseColor, useColorWheelState} from '@react-stately/color';
import React, {useRef} from 'react';
import {useColorWheel} from '../';
import userEvent from '@testing-library/user-event';
@@ -124,7 +124,7 @@ describe('useColorWheel', () => {
describe('keyboard events', () => {
it('left/right works', () => {
- let defaultColor = new Color('hsl(0, 100%, 50%)');
+ let defaultColor = parseColor('hsl(0, 100%, 50%)');
let {getByRole} = render();
let slider = getByRole('slider');
act(() => {slider.focus();});
@@ -138,7 +138,7 @@ describe('useColorWheel', () => {
});
it('up/down works', () => {
- let defaultColor = new Color('hsl(0, 100%, 50%)');
+ let defaultColor = parseColor('hsl(0, 100%, 50%)');
let {getByRole} = render();
let slider = getByRole('slider');
act(() => {slider.focus();});
@@ -152,7 +152,7 @@ describe('useColorWheel', () => {
});
it('doesn\'t work when disabled', () => {
- let defaultColor = new Color('hsl(0, 100%, 50%)');
+ let defaultColor = parseColor('hsl(0, 100%, 50%)');
let {getByRole} = render();
let slider = getByRole('slider');
act(() => {slider.focus();});
@@ -164,7 +164,7 @@ describe('useColorWheel', () => {
});
it('wraps around', () => {
- let defaultColor = new Color('hsl(0, 100%, 50%)');
+ let defaultColor = parseColor('hsl(0, 100%, 50%)');
let {getByRole} = render();
let slider = getByRole('slider');
act(() => {slider.focus();});
@@ -175,7 +175,7 @@ describe('useColorWheel', () => {
});
it('respects step', () => {
- let defaultColor = new Color('hsl(0, 100%, 50%)');
+ let defaultColor = parseColor('hsl(0, 100%, 50%)');
let {getByRole} = render();
let slider = getByRole('slider');
act(() => {slider.focus();});
@@ -189,7 +189,7 @@ describe('useColorWheel', () => {
});
it('can always get back to 0 even with step', () => {
- let defaultColor = new Color('hsl(330, 100%, 50%)');
+ let defaultColor = parseColor('hsl(330, 100%, 50%)');
let {getByRole} = render();
let slider = getByRole('slider');
act(() => {slider.focus();});
@@ -203,7 +203,7 @@ describe('useColorWheel', () => {
});
it('steps with page up/down', () => {
- let defaultColor = new Color('hsl(0, 100%, 50%)');
+ let defaultColor = parseColor('hsl(0, 100%, 50%)');
let {getByRole} = render();
let slider = getByRole('slider');
act(() => {slider.focus();});
@@ -238,7 +238,7 @@ describe('useColorWheel', () => {
prepare();
it('dragging the thumb works', () => {
- let defaultColor = new Color('hsl(0, 100%, 50%)');
+ let defaultColor = parseColor('hsl(0, 100%, 50%)');
let {getByRole, getByTestId} = render();
let thumb = getByTestId('thumb');
let slider = getByRole('slider');
@@ -261,7 +261,7 @@ describe('useColorWheel', () => {
});
it('dragging the thumb doesn\'t work when disabled', () => {
- let defaultColor = new Color('hsl(0, 100%, 50%)');
+ let defaultColor = parseColor('hsl(0, 100%, 50%)');
let {getByRole, getByTestId} = render();
let thumb = getByTestId('thumb');
let slider = getByRole('slider');
@@ -283,7 +283,7 @@ describe('useColorWheel', () => {
});
it('dragging the thumb respects the step', () => {
- let defaultColor = new Color('hsl(0, 100%, 50%)');
+ let defaultColor = parseColor('hsl(0, 100%, 50%)');
let {getByTestId} = render();
let thumb = getByTestId('thumb');
let container = getByTestId('container');
@@ -299,7 +299,7 @@ describe('useColorWheel', () => {
});
it('clicking and dragging on the track works', () => {
- let defaultColor = new Color('hsl(0, 100%, 50%)');
+ let defaultColor = parseColor('hsl(0, 100%, 50%)');
let {getByRole, getByTestId} = render();
let thumb = getByTestId('thumb');
let slider = getByRole('slider');
@@ -323,7 +323,7 @@ describe('useColorWheel', () => {
});
it('clicking and dragging on the track doesn\'t work when disabled', () => {
- let defaultColor = new Color('hsl(0, 100%, 50%)');
+ let defaultColor = parseColor('hsl(0, 100%, 50%)');
let {getByRole, getByTestId} = render();
let slider = getByRole('slider');
let container = getByTestId('container');
@@ -344,7 +344,7 @@ describe('useColorWheel', () => {
});
it('clicking and dragging on the track respects the step', () => {
- let defaultColor = new Color('hsl(0, 100%, 50%)');
+ let defaultColor = parseColor('hsl(0, 100%, 50%)');
let {getByTestId} = render();
let thumb = getByTestId('thumb');
let container = getByTestId('container');
diff --git a/packages/@react-aria/color/test/useHexColorField.test.js b/packages/@react-aria/color/test/useHexColorField.test.js
index b0db940a3a9..4e6fd1cef06 100644
--- a/packages/@react-aria/color/test/useHexColorField.test.js
+++ b/packages/@react-aria/color/test/useHexColorField.test.js
@@ -10,7 +10,7 @@
* governing permissions and limitations under the License.
*/
-import {Color} from '@react-stately/color';
+import {parseColor} from '@react-stately/color';
import React from 'react';
import {renderHook} from '@testing-library/react-hooks';
import {useHexColorField} from '../';
@@ -50,7 +50,7 @@ describe('useHexColorField', function () {
});
it('should return props for colorValue provided', function () {
- let colorValue = new Color('#ff88a0');
+ let colorValue = parseColor('#ff88a0');
let {inputFieldProps} = renderHexColorFieldHook({}, {colorValue});
expect(inputFieldProps['aria-valuenow']).toBe(colorValue.toHexInt());
expect(inputFieldProps['aria-valuetext']).toBe('#FF88A0');
@@ -77,12 +77,12 @@ describe('useHexColorField', function () {
let {inputFieldProps} = renderHexColorFieldHook({validationState: 'invalid'});
expect(inputFieldProps['aria-invalid']).toBe(true);
});
-
+
it('should return prop for required', function () {
let {inputFieldProps} = renderHexColorFieldHook({isRequired: true});
expect(inputFieldProps['aria-required']).toBe(true);
});
-
+
it('should return prop for readonly', function () {
let {inputFieldProps} = renderHexColorFieldHook({isReadOnly: true});
expect(inputFieldProps['aria-readonly']).toBe(true);
diff --git a/packages/@react-spectrum/color/src/ColorThumb.tsx b/packages/@react-spectrum/color/src/ColorThumb.tsx
index 481c1ef806b..14581d265d4 100644
--- a/packages/@react-spectrum/color/src/ColorThumb.tsx
+++ b/packages/@react-spectrum/color/src/ColorThumb.tsx
@@ -11,7 +11,7 @@
*/
import {classNames} from '@react-spectrum/utils';
-import {Color} from '@react-stately/color';
+import {Color} from '@react-types/color';
import {DOMProps} from '@react-types/shared';
import React, {ReactElement} from 'react';
import stylesHandle from '@adobe/spectrum-css-temp/components/colorhandle/vars.css';
diff --git a/packages/@react-spectrum/color/stories/ColorSlider.stories.tsx b/packages/@react-spectrum/color/stories/ColorSlider.stories.tsx
index 3a0dd497822..794fc17c5d1 100644
--- a/packages/@react-spectrum/color/stories/ColorSlider.stories.tsx
+++ b/packages/@react-spectrum/color/stories/ColorSlider.stories.tsx
@@ -10,9 +10,9 @@
* governing permissions and limitations under the License.
*/
-import {Color} from '@react-stately/color';
import {ColorSlider} from '../';
import {Flex} from '@react-spectrum/layout';
+import {parseColor} from '@react-stately/color';
import React, {useState} from 'react';
import {storiesOf} from '@storybook/react';
import {Text} from '@react-spectrum/text';
@@ -20,44 +20,44 @@ import {Text} from '@react-spectrum/text';
storiesOf('ColorSlider', module)
.add(
'default',
- () =>
+ () =>
)
.add(
'no label',
- () =>
+ () =>
)
.add(
'no value label',
- () =>
+ () =>
)
.add(
'no label, no value label',
- () =>
+ () =>
)
.add(
'step',
- () =>
+ () =>
)
.add(
'disabled',
- () =>
+ () =>
)
.add(
'vertical',
- () =>
+ () =>
)
.add(
'controlled',
- () =>
+ () =>
)
.add(
'custom width',
- () =>
+ () =>
)
.add(
'rgba',
() => {
- let [color, setColor] = useState(new Color('#ff00ff'));
+ let [color, setColor] = useState(parseColor('#ff00ff'));
return (
@@ -75,7 +75,7 @@ storiesOf('ColorSlider', module)
.add(
'hsla',
() => {
- let [color, setColor] = useState(new Color('hsla(0, 100%, 50%, 0.5)'));
+ let [color, setColor] = useState(parseColor('hsla(0, 100%, 50%, 0.5)'));
return (
@@ -92,7 +92,7 @@ storiesOf('ColorSlider', module)
.add(
'hsba',
() => {
- let [color, setColor] = useState(new Color('hsba(0, 100%, 50%, 0.5)'));
+ let [color, setColor] = useState(parseColor('hsba(0, 100%, 50%, 0.5)'));
return (
diff --git a/packages/@react-spectrum/color/stories/ColorThumb.stories.tsx b/packages/@react-spectrum/color/stories/ColorThumb.stories.tsx
index 6297eaaeceb..dd4c584342a 100644
--- a/packages/@react-spectrum/color/stories/ColorThumb.stories.tsx
+++ b/packages/@react-spectrum/color/stories/ColorThumb.stories.tsx
@@ -10,29 +10,29 @@
* governing permissions and limitations under the License.
*/
-import {Color} from '@react-stately/color';
import {ColorThumb} from '../src/ColorThumb';
+import {parseColor} from '@react-stately/color';
import React from 'react';
import {storiesOf} from '@storybook/react';
storiesOf('ColorThumb', module)
.add(
'default',
- () =>
+ () =>
)
.add(
'focused',
- () =>
+ () =>
)
.add(
'focused, dragging',
- () =>
+ () =>
)
.add(
'focused, dragging, alpha',
- () =>
+ () =>
)
.add(
'disabled',
- () =>
+ () =>
);
diff --git a/packages/@react-spectrum/color/stories/ColorWheel.stories.tsx b/packages/@react-spectrum/color/stories/ColorWheel.stories.tsx
index c850f8a165c..5a2a66ecc4d 100644
--- a/packages/@react-spectrum/color/stories/ColorWheel.stories.tsx
+++ b/packages/@react-spectrum/color/stories/ColorWheel.stories.tsx
@@ -11,24 +11,24 @@
*/
import {action} from '@storybook/addon-actions';
-import {Color} from '@react-stately/color';
import {ColorWheel} from '../';
import {Flex} from '@adobe/react-spectrum';
+import {parseColor} from '@react-stately/color';
import React, {useState} from 'react';
import {storiesOf} from '@storybook/react';
storiesOf('ColorWheel', module)
.add(
'default',
- () =>
+ () =>
)
.add(
'disabled',
- () =>
+ () =>
)
.add(
'step',
- () =>
+ () =>
)
.add(
'custom size',
@@ -40,14 +40,14 @@ storiesOf('ColorWheel', module)
-
+
);
}
)
.add(
'controlled',
() => {
- let [color, setColor] = useState(new Color('hsl(0, 100%, 50%)'));
+ let [color, setColor] = useState(parseColor('hsl(0, 100%, 50%)'));
let colorCSS = color.toString('css');
return (
diff --git a/packages/@react-spectrum/color/stories/HexColorField.stories.tsx b/packages/@react-spectrum/color/stories/HexColorField.stories.tsx
index 35120e85544..2a966f15976 100644
--- a/packages/@react-spectrum/color/stories/HexColorField.stories.tsx
+++ b/packages/@react-spectrum/color/stories/HexColorField.stories.tsx
@@ -12,7 +12,7 @@
import {action} from '@storybook/addon-actions';
import {ActionButton} from '@react-spectrum/button';
-import {Color} from '@react-stately/color';
+import {Color} from '@react-types/color';
import {Dialog, DialogTrigger} from '@react-spectrum/dialog';
import {Flex} from '@react-spectrum/layout';
import {HexColorField} from '../';
@@ -61,7 +61,7 @@ storiesOf('HexColorField', module)
'controlled value',
() => (
)
)
@@ -91,7 +91,7 @@ function HexColorFieldPopover(props: any = {}) {
UNSAFE_style={{
background: colorString
}} >{colorString}
-