|
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. */ |
48 | 47 | &::before {
|
49 |
| - inline-size: calc(var(--spectrum-colorwheel-width) - 4px); |
50 |
| - block-size: calc(var(--spectrum-colorwheel-width) - 4px); |
51 |
| - inset-block-start: 1px; |
52 |
| - inset-inline-start: 1px; |
53 |
| - content: " "; |
| 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: ""; |
54 | 53 | position: absolute;
|
55 | 54 | border-width: var(--spectrum-colorwheel-border-width);
|
56 | 55 | border-style: solid;
|
|
68 | 67 |
|
69 | 68 | &::before,
|
70 | 69 | .spectrum-ColorWheel-inner::before {
|
71 |
| - border-color: transparent; |
| 70 | + border-color: var(--highcontrast-colorwheel-border-color-disabled, transparent); |
72 | 71 | }
|
73 | 72 | }
|
74 | 73 |
|
|
89 | 88 | block-size: var(--mod-colorwheel-colorarea-container-size, var(--spectrum-colorwheel-colorarea-container-size));
|
90 | 89 | margin: auto;
|
91 | 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 | 92 | &::before {
|
93 |
| - inline-size: calc(var(--mod-colorwheel-colorarea-container-size, var(--spectrum-colorwheel-colorarea-container-size)) + 2px); |
94 |
| - block-size: calc(var(--mod-colorwheel-colorarea-container-size, var(--spectrum-colorwheel-colorarea-container-size)) + 2px); |
95 |
| - inset-block-start: -2px; |
96 |
| - inset-inline-start: -2px; |
97 |
| - content: " "; |
| 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 | 98 | position: absolute;
|
99 | 99 | border-width: var(--spectrum-colorwheel-border-width);
|
100 | 100 | border-style: solid;
|
|
110 | 110 | display: flex;
|
111 | 111 | align-items: center;
|
112 | 112 | justify-content: center;
|
113 |
| - 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)); |
114 | 114 | }
|
115 | 115 |
|
116 | 116 | .spectrum-ColorWheel-slider {
|
|
126 | 126 | }
|
127 | 127 |
|
128 | 128 | .spectrum-ColorWheel-handle {
|
129 |
| - 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); |
130 | 130 | inset-block-start: 50%;
|
131 | 131 | inset-inline: 50%;
|
132 | 132 | }
|
|
140 | 140 | }
|
141 | 141 | }
|
142 | 142 |
|
143 |
| -/* a clip-path set border-width wider than than spectrum-colorwheel-wheel to create the appreance of a border */ |
144 |
| -.spectrum-ColorWheel-border { |
145 |
| - position: relative; |
146 |
| - background-color: var(--mod-colorwheel-border-color, var(--spectrum-colorwheel-border-color)); |
147 |
| - inline-size: var(--spectrum-colorwheel-width); |
148 |
| - block-size: var(--spectrum-colorwheel-height); |
149 |
| - clip-path: path(evenodd, var(--mod-colorwheel-path-borders, var(--spectrum-colorwheel-path-borders))); |
150 |
| - |
151 |
| - &.is-disabled { |
152 |
| - background-color: var(--highcontrast-colorwheel-border-color-disabled, var(--spectrum-colorwheel-fill-color-disabled)); |
153 |
| - } |
154 |
| -} |
155 |
| - |
156 | 143 | .spectrum-ColorWheel-wheel {
|
157 | 144 | position: absolute;
|
158 | 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);
|
|
162 | 149 |
|
163 | 150 | &.is-disabled {
|
164 | 151 | pointer-events: none;
|
165 |
| - 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; |
166 | 163 | }
|
167 | 164 | }
|
0 commit comments