Skip to content

Color area #2483

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 35 commits into from
Feb 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
1de2a0d
Initial ColorArea implementation
snowystinger Oct 20, 2021
5ac1ea6
Merge branch 'main' into color-area
snowystinger Oct 20, 2021
c36c999
refactor aria back to stately
snowystinger Oct 21, 2021
dd5c47e
more refactoring
snowystinger Oct 21, 2021
fc3de3a
refactor step logic and defaults
snowystinger Oct 21, 2021
4ba225c
tests and subsequent fixes from tests
snowystinger Oct 21, 2021
9971bed
Add uncontrolled to tests
snowystinger Oct 22, 2021
fe8a88f
Add size story
snowystinger Oct 22, 2021
27fbfda
use snaptovalue and add page steps
snowystinger Oct 23, 2021
f1f734f
remove dead code
snowystinger Oct 23, 2021
7cb5b88
rename variable to make more sense, fix description
snowystinger Oct 23, 2021
87da7c4
Add isDisabled based on Spectrum designs
snowystinger Oct 23, 2021
796944f
add min size
snowystinger Oct 23, 2021
2bb5b2a
add prop description
snowystinger Oct 23, 2021
9c2769f
Get back to no useMove changes
snowystinger Oct 25, 2021
7d49f0f
Combine the useMove frequently appears with useKeyboard (#2508)
majornista Nov 8, 2021
09097c5
Merge branch 'main' into color-area
snowystinger Nov 9, 2021
1e58328
ColorArea: remove aria-roledescription on iOS/Android (#2547)
majornista Nov 11, 2021
cfa9a10
Add formatting for color name and value based on locale
snowystinger Nov 11, 2021
2b81e33
allow for differences in formatting strings
snowystinger Nov 11, 2021
a05ff19
fix lint
snowystinger Nov 11, 2021
3178823
Merge branch 'main' into color-area
majornista Nov 17, 2021
04e93b8
Merge branch 'main' of github.com:adobe/react-spectrum into color-area
LFDanLu Nov 30, 2021
4d106df
Merge branch 'main' into color-area
majornista Dec 17, 2021
20c67b2
Merge branch 'main' into color-area
snowystinger Jan 4, 2022
fe0ac58
Merge branch 'main' into color-area
majornista Feb 4, 2022
affe41b
@trivial remove extra whitespace/redundant afterEach
majornista Feb 4, 2022
ee10c74
fix: tests
majornista Feb 4, 2022
a995b15
Merge branch 'main' into color-area
ashlovell Feb 17, 2022
a911911
fix remaining issues before merges on main make it in
ashlovell Feb 17, 2022
c7d30e4
Merge branch 'main' into color-area
snowystinger Feb 17, 2022
57dc904
incorporate michaels a11y and locale fixes
snowystinger Feb 17, 2022
659597b
Merge branch 'main' into color-area
LFDanLu Feb 18, 2022
cf5f2b5
Merge branch 'main' into color-area
snowystinger Feb 18, 2022
b4b9293
Merge branch 'main' into color-area
snowystinger Feb 23, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions packages/@adobe/spectrum-css-temp/components/colorarea/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
.spectrum-ColorArea {
position: relative;
display: inline-block;
inline-size: var(--spectrum-colorarea-default-width);
block-size: var(--spectrum-colorarea-default-height);
min-inline-size: var(--spectrum-colorarea-min-width);
min-block-size: var(--spectrum-colorarea-min-height);

border-radius: var(--spectrum-colorarea-border-radius);

cursor: default;

user-select: none;

&.is-focused,
&.focus-ring {
z-index: 2;

.spectrum-ColorArea-handle {
/* Bigger handle when focused */
width: calc(var(--spectrum-colorhandle-size) * 2);
height: calc(var(--spectrum-colorhandle-size) * 2);

margin-left: calc(-1 * var(--spectrum-colorhandle-size));
margin-top: calc(-1 * var(--spectrum-colorhandle-size));
}
}

&:focus-within {
z-index: 2;
}

&.is-disabled {
pointer-events: none;
}

/* the floating inset box shadow must be a separate element since <canvas> won't take it */
&:before {
content: '';
z-index: 1;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
border-radius: var(--spectrum-colorarea-border-radius);
}
}

.spectrum-ColorArea-handle {
left: 0;
top: 0;
}

.spectrum-ColorArea-gradient {
width: 100%;
height: 100%;
border-radius: var(--spectrum-colorarea-border-radius);
}

.spectrum-ColorArea-slider {
opacity: 0.0001;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 0;
margin: 0;
pointer-events: none;
}
36 changes: 36 additions & 0 deletions packages/@adobe/spectrum-css-temp/components/colorarea/skin.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.spectrum-ColorArea {
&:before {
box-shadow: inset 0 0 0 var(--spectrum-colorarea-border-size) var(--spectrum-colorarea-border-color);
}
}
.spectrum-ColorArea-gradient {
forced-color-adjust: none;
}
.spectrum-ColorHandle-color {
forced-color-adjust: none;
}

.spectrum-ColorArea {
&.is-disabled {
background: var(--spectrum-colorarea-fill-color-disabled);

&:before {
box-shadow: inset 0 0 0 var(--spectrum-colorarea-border-size) var(--spectrum-colorarea-border-color-disabled);
}

.spectrum-ColorArea-gradient {
display: none;
}
}
}

@media (forced-colors: active) {
.spectrum-ColorArea {
--spectrum-colorarea-fill-color-disabled : GrayText;
}
.spectrum-ColorArea {
&.is-disabled {
forced-color-adjust: none;
}
}
}
14 changes: 14 additions & 0 deletions packages/@adobe/spectrum-css-temp/components/colorarea/vars.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright 2021 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/

@import './index.css';
@import './skin.css';
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/ar-AE.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "شريط تمرير ثنائي الأبعاد",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/bg-BG.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "2D плъзгач",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/cs-CZ.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "2D posuvník",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/da-DK.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "2D-skyder",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/de-DE.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "2D-Schieberegler",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/el-GR.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "Ρυθμιστικό 2D",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/en-US.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "2D slider",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/es-ES.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "Control deslizante en 2D",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/et-EE.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "2D-liugur",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/fi-FI.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "2D-liukusäädin",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/fr-FR.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "Curseur 2D",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/he-IL.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "מחוון דו-ממדי",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/hr-HR.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "2D kliznik",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/hu-HU.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "2D csúszka",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/it-IT.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "Dispositivo di scorrimento 2D",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/ja-JP.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "2D スライダー",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/ko-KR.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "2D 슬라이더",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/lt-LT.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "2D slankiklis",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/lv-LV.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "Plaknes slīdnis",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/nb-NO.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "2D-glidebryter",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/nl-NL.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "2D-schuifregelaar",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/pl-PL.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "Suwak 2D",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/pt-BR.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "Controle deslizante 2D",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/pt-PT.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "Controlo de deslize 2D",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/ro-RO.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "Cursor 2D",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/ru-RU.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "Двумерный ползунок",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/sk-SK.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "2D jazdec",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/sl-SI.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "2D-drsnik",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/sr-SP.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "2D клизач",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/sv-SE.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "2D-reglage",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/tr-TR.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "2B slayt gösterisi",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/uk-UA.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "Повзунок 2D",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/zh-CN.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "2D 滑块",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
5 changes: 5 additions & 0 deletions packages/@react-aria/color/intl/zh-TW.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"twoDimensionalSlider": "2D 滑桿",
"colorNameAndValue": "{name}: {value}",
"x/y": "{x} / {y}"
}
18 changes: 10 additions & 8 deletions packages/@react-aria/color/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,18 @@
},
"dependencies": {
"@babel/runtime": "^7.6.2",
"@react-aria/spinbutton": "^3.0.3",
"@react-aria/textfield": "^3.5.2",
"@react-aria/i18n": "^3.3.6",
"@react-aria/interactions": "^3.8.1",
"@react-aria/slider": "^3.0.5",
"@react-aria/utils": "^3.11.2",
"@internationalized/message": "^3.0.2",
"@react-aria/i18n": "^3.3.3",
"@react-aria/interactions": "^3.7.0",
"@react-aria/slider": "^3.0.3",
"@react-aria/spinbutton": "^3.0.1",
"@react-aria/textfield": "^3.5.0",
"@react-aria/utils": "^3.11.0",
"@react-aria/visually-hidden": "^3.2.3",
"@react-stately/color": "3.0.0-beta.7",
"@react-types/color": "3.0.0-beta.5",
"@react-types/shared": "^3.11.1",
"@react-types/slider": "^3.0.4"
"@react-types/shared": "^3.10.1",
"@react-types/slider": "^3.0.2"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0-rc.1",
Expand Down
1 change: 1 addition & 0 deletions packages/@react-aria/color/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* governing permissions and limitations under the License.
*/

export * from './useColorArea';
export * from './useColorSlider';
export * from './useColorWheel';
export * from './useColorField';
Loading