|
1 | 1 | /*!
|
2 |
| - * Copyright 2024 Adobe. All rights reserved. |
| 2 | + * Copyright 2025 Adobe. All rights reserved. |
3 | 3 | *
|
4 | 4 | * This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License. You may obtain a copy
|
|
11 | 11 | * governing permissions and limitations under the License.
|
12 | 12 | */
|
13 | 13 |
|
14 |
| -/* Windows High Contrast Mode */ |
15 |
| -@media (forced-colors: active) { |
16 |
| - .spectrum-ColorWheel { |
17 |
| - --highcontrast-colorwheel-border-color-disabled: GrayText; |
18 |
| - --highcontrast-colorwheel-fill-color-disabled: Canvas; |
| 14 | +.spectrum-ColorWheel { |
| 15 | + --spectrum-colorwheel-width: var(--spectrum-color-wheel-width); |
| 16 | + --spectrum-colorwheel-height: var(--spectrum-color-wheel-width); |
19 | 17 |
|
20 |
| - forced-color-adjust: none; |
21 |
| - } |
22 |
| -} |
| 18 | + /* @TODO: leveraging the rgb token in this case to achieve the desired border color implementation as rgb + opacity are required by the `rgba` function. */ |
| 19 | + --spectrum-colorwheel-border-color-rgb: var(--spectrum-gray-1000-rgb); |
23 | 20 |
|
24 |
| -.spectrum-ColorWheel { |
25 |
| - --spectrum-colorwheel-border-color: var(--spectrum-transparent-black-300); |
| 21 | + --spectrum-colorwheel-border-opacity: var(--spectrum-color-wheel-border-opacity); |
| 22 | + --spectrum-colorwheel-border-color: rgba(var(--spectrum-colorwheel-border-color-rgb), var(--spectrum-colorwheel-border-opacity)); |
| 23 | + |
| 24 | + --spectrum-colorwheel-border-width: var(--spectrum-border-width-100); |
| 25 | + --spectrum-colorwheel-track-width: var(--spectrum-color-control-track-width); |
| 26 | + |
| 27 | + --spectrum-colorwheel-min-inline-size: var(--spectrum-color-wheel-minimum-width); |
26 | 28 |
|
27 |
| - --spectrum-colorwheel-width: var(--mod-colorwheel-width, var(--spectrum-color-wheel-width)); |
28 |
| - --spectrum-colorwheel-height: var(--mod-colorwheel-height, var(--spectrum-color-wheel-width)); |
29 |
| - --spectrum-colorwheel-fill-color-disabled: var(--mod-colorwheel-fill-color-disabled, var(--spectrum-disabled-background-color)); |
30 |
| - --spectrum-colorwheel-border-color: var(--spectrum-transparent-black-300); |
| 29 | + --spectrum-colorwheel-colorarea-margin: var(--spectrum-color-wheel-color-area-margin); |
31 | 30 |
|
32 |
| - --spectrum-colorwheel-border-width: var(--mod-colorwheel-border-width, var(--spectrum-border-width-100)); |
33 |
| - --spectrum-colorwheel-track-width: var(--mod-colorwheel-track-width, var(--spectrum-color-control-track-width)); |
| 31 | + --spectrum-colorwheel-fill-color-disabled: var(--spectrum-disabled-background-color); |
34 | 32 |
|
35 | 33 | /* stylelint-disable-next-line spectrum-tools/no-unused-custom-properties -- used with JS in calculating the clip-path paths and colorarea-container-size */
|
36 |
| - --_track-width: var(--spectrum-colorwheel-track-width); |
| 34 | + --_track-width: var(--mod-colorwheel-track-width, var(--spectrum-colorwheel-track-width)); |
37 | 35 | /* stylelint-disable-next-line spectrum-tools/no-unused-custom-properties -- used with JS in calculating the clip-path paths and colorarea-container-size */
|
38 |
| - --_border-width: var(--spectrum-colorwheel-border-width); |
| 36 | + --_border-width: var(--mod-colorwheel-border-width, var(--spectrum-colorwheel-border-width)); |
39 | 37 |
|
40 | 38 | position: relative;
|
41 | 39 | display: block;
|
42 |
| - min-inline-size: var(--mod-colorwheel-min-width, var(--spectrum-color-wheel-minimum-width)); |
| 40 | + min-inline-size: var(--mod-colorwheel-min-inline-size, var(--spectrum-colorwheel-min-inline-size)); |
43 | 41 | inline-size: var(--spectrum-colorwheel-width);
|
44 | 42 | block-size: var(--spectrum-colorwheel-height);
|
45 | 43 | user-select: none;
|
46 | 44 | cursor: default;
|
47 | 45 |
|
| 46 | + /* calcs wrapping --spectrum-colorwheel-border-width are used to properly position the border drawn using this ::before pseudo element over the exterior edge of the colorwheel. The size is reduced and positioning adjusted to create the border effect. */ |
| 47 | + &::before { |
| 48 | + inline-size: calc(var(--spectrum-colorwheel-width) - calc(4 * var(--spectrum-colorwheel-border-width))); |
| 49 | + block-size: calc(var(--spectrum-colorwheel-width) - calc(4 * var(--spectrum-colorwheel-border-width))); |
| 50 | + inset-block-start: var(--spectrum-colorwheel-border-width); |
| 51 | + inset-inline-start: var(--spectrum-colorwheel-border-width); |
| 52 | + content: ""; |
| 53 | + position: absolute; |
| 54 | + border-width: var(--spectrum-colorwheel-border-width); |
| 55 | + border-style: solid; |
| 56 | + border-color: var(--mod-colorwheel-border-color, var(--spectrum-colorwheel-border-color)); |
| 57 | + border-radius: 100%; |
| 58 | + z-index: 1; |
| 59 | + } |
| 60 | + |
48 | 61 | &.is-focused {
|
49 | 62 | z-index: 2;
|
50 | 63 | }
|
51 | 64 |
|
52 | 65 | &.is-disabled {
|
53 | 66 | pointer-events: none;
|
| 67 | + |
| 68 | + &::before, |
| 69 | + .spectrum-ColorWheel-inner::before { |
| 70 | + border-color: var(--highcontrast-colorwheel-border-color-disabled, transparent); |
| 71 | + } |
54 | 72 | }
|
55 | 73 |
|
56 | 74 | &.is-dragged {
|
|
69 | 87 | inline-size: var(--mod-colorwheel-colorarea-container-size, var(--spectrum-colorwheel-colorarea-container-size));
|
70 | 88 | block-size: var(--mod-colorwheel-colorarea-container-size, var(--spectrum-colorwheel-colorarea-container-size));
|
71 | 89 | margin: auto;
|
| 90 | + |
| 91 | + /* calcs wrapping --spectrum-colorwheel-border-width are used to properly position the border drawn using this ::before pseudo element over the interior edge of the colorwheel. The size is increased and positioning adjusted to create the border effect. */ |
| 92 | + &::before { |
| 93 | + inline-size: calc(var(--mod-colorwheel-colorarea-container-size, var(--spectrum-colorwheel-colorarea-container-size)) + calc(2 * var(--spectrum-colorwheel-border-width))); |
| 94 | + block-size: calc(var(--mod-colorwheel-colorarea-container-size, var(--spectrum-colorwheel-colorarea-container-size)) + calc(2 * var(--spectrum-colorwheel-border-width))); |
| 95 | + inset-block-start: calc(-2 * var(--spectrum-colorwheel-border-width)); |
| 96 | + inset-inline-start: calc(-2 * var(--spectrum-colorwheel-border-width)); |
| 97 | + content: ""; |
| 98 | + position: absolute; |
| 99 | + border-width: var(--spectrum-colorwheel-border-width); |
| 100 | + border-style: solid; |
| 101 | + border-color: var(--mod-colorwheel-border-color, var(--spectrum-colorwheel-border-color)); |
| 102 | + border-radius: 100%; |
| 103 | + z-index: 1; |
| 104 | + } |
72 | 105 | }
|
73 | 106 |
|
74 | 107 | .spectrum-ColorWheel-colorarea-container {
|
|
77 | 110 | display: flex;
|
78 | 111 | align-items: center;
|
79 | 112 | justify-content: center;
|
80 |
| - margin: var(--mod-colorwheel-colorarea-margin, var(--spectrum-color-wheel-color-area-margin)); |
| 113 | + margin: var(--mod-colorwheel-colorarea-margin, var(--spectrum-colorwheel-colorarea-margin)); |
81 | 114 | }
|
82 | 115 |
|
83 | 116 | .spectrum-ColorWheel-slider {
|
|
93 | 126 | }
|
94 | 127 |
|
95 | 128 | .spectrum-ColorWheel-handle {
|
96 |
| - transform: translate(calc(var(--spectrum-colorwheel-width) / 2 - var(--spectrum-colorwheel-track-width) / 2), 0); |
| 129 | + transform: translate(calc(var(--spectrum-colorwheel-width) / 2 - var(--mod-colorwheel-track-width, var(--spectrum-colorwheel-track-width)) / 2), 0); |
97 | 130 | inset-block-start: 50%;
|
98 | 131 | inset-inline: 50%;
|
99 | 132 | }
|
|
107 | 140 | }
|
108 | 141 | }
|
109 | 142 |
|
110 |
| -/* a clip-path set border-width wider than than spectrum-colorwheel-wheel to create the appreance of a border */ |
111 |
| -.spectrum-ColorWheel-border { |
112 |
| - position: relative; |
113 |
| - background-color: var(--mod-colorwheel-border-color, var(--spectrum-colorwheel-border-color)); |
114 |
| - inline-size: var(--spectrum-colorwheel-width); |
115 |
| - block-size: var(--spectrum-colorwheel-height); |
116 |
| - clip-path: path(evenodd, var(--mod-colorwheel-path-borders, var(--spectrum-colorwheel-path-borders))); |
117 |
| - |
118 |
| - &.is-disabled { |
119 |
| - background-color: var(--highcontrast-colorwheel-border-color-disabled, var(--spectrum-colorwheel-fill-color-disabled)); |
120 |
| - } |
121 |
| -} |
122 |
| - |
123 | 143 | .spectrum-ColorWheel-wheel {
|
124 | 144 | position: absolute;
|
125 | 145 | background: conic-gradient(from 90deg, red, rgb(255 128 0), rgb(255 255 0), rgb(128 255 0), rgb(0 255 0), rgb(0 255 128), rgb(0 255 255), rgb(0 128 255), rgb(0 0 255), rgb(128 0 255), rgb(255 0 255), rgb(255 0 128), red);
|
|
129 | 149 |
|
130 | 150 | &.is-disabled {
|
131 | 151 | pointer-events: none;
|
132 |
| - background: var(--highcontrast-colorwheel-fill-color-disabled, var(--spectrum-colorwheel-fill-color-disabled)); |
| 152 | + background: var(--highcontrast-colorwheel-fill-color-disabled, var(--mod-colorwheel-fill-color-disabled, var(--spectrum-colorwheel-fill-color-disabled))); |
| 153 | + } |
| 154 | +} |
| 155 | + |
| 156 | +/* Windows High Contrast Mode */ |
| 157 | +@media (forced-colors: active) { |
| 158 | + .spectrum-ColorWheel { |
| 159 | + --highcontrast-colorwheel-border-color-disabled: GrayText; |
| 160 | + --highcontrast-colorwheel-fill-color-disabled: Canvas; |
| 161 | + |
| 162 | + forced-color-adjust: none; |
133 | 163 | }
|
134 | 164 | }
|
0 commit comments