|
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 | 26 |
|
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); |
| 27 | + --spectrum-colorwheel-min-inline-size: var(--spectrum-color-wheel-minimum-width); |
31 | 28 |
|
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)); |
| 29 | + --spectrum-colorwheel-fill-color-disabled: var(--spectrum-disabled-background-color); |
34 | 30 |
|
35 | 31 | /* 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); |
| 32 | + --_track-width: var(--mod-colorwheel-track-width, var(--spectrum-colorwheel-track-width)); |
37 | 33 | /* 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); |
| 34 | + --_border-width: var(--mod-colorwheel-border-width, var(--spectrum-colorwheel-border-width)); |
39 | 35 |
|
40 | 36 | position: relative;
|
41 | 37 | display: block;
|
42 |
| - min-inline-size: var(--mod-colorwheel-min-width, var(--spectrum-color-wheel-minimum-width)); |
| 38 | + min-inline-size: var(--mod-colorwheel-min-inline-size, var(--spectrum-colorwheel-min-inline-size)); |
43 | 39 | inline-size: var(--spectrum-colorwheel-width);
|
44 | 40 | block-size: var(--spectrum-colorwheel-height);
|
45 | 41 | user-select: none;
|
46 | 42 | cursor: default;
|
47 | 43 |
|
| 44 | + /** |
| 45 | + * Color wheel exterior border |
| 46 | + * - Calcs for `inline-size` and `block-size` subtract 4 times the component's border width |
| 47 | + * (to account for the inset width of the exterior border) from the component's width. |
| 48 | + */ |
| 49 | + &::before { |
| 50 | + inline-size: calc(var(--spectrum-colorwheel-width) - calc(4 * var(--spectrum-colorwheel-border-width))); |
| 51 | + block-size: calc(var(--spectrum-colorwheel-width) - calc(4 * var(--spectrum-colorwheel-border-width))); |
| 52 | + inset-block-start: var(--spectrum-colorwheel-border-width); |
| 53 | + inset-inline-start: var(--spectrum-colorwheel-border-width); |
| 54 | + content: ""; |
| 55 | + position: absolute; |
| 56 | + border-width: var(--spectrum-colorwheel-border-width); |
| 57 | + border-style: solid; |
| 58 | + border-color: var(--mod-colorwheel-border-color, var(--spectrum-colorwheel-border-color)); |
| 59 | + border-radius: 100%; |
| 60 | + z-index: 1; |
| 61 | + } |
| 62 | + |
| 63 | + /** |
| 64 | + * Color wheel interior border |
| 65 | + * - Calcs for `inset` 2 times the component's border width from the |
| 66 | + * track width (to account for the inset width of the interior border) |
| 67 | + */ |
| 68 | + &::after { |
| 69 | + inset: calc(var(--spectrum-colorwheel-track-width) - (calc(2 * var(--spectrum-colorwheel-border-width)))); |
| 70 | + content: ""; |
| 71 | + position: absolute; |
| 72 | + border-width: var(--spectrum-colorwheel-border-width); |
| 73 | + border-style: solid; |
| 74 | + border-color: var(--mod-colorwheel-border-color, var(--spectrum-colorwheel-border-color)); |
| 75 | + border-radius: 100%; |
| 76 | + z-index: 1; |
| 77 | + } |
| 78 | + |
48 | 79 | &.is-focused {
|
49 | 80 | z-index: 2;
|
50 | 81 | }
|
51 | 82 |
|
52 | 83 | &.is-disabled {
|
53 | 84 | pointer-events: none;
|
| 85 | + |
| 86 | + &::before, |
| 87 | + .spectrum-ColorWheel-inner::before { |
| 88 | + border-color: var(--highcontrast-colorwheel-border-color-disabled, transparent); |
| 89 | + } |
54 | 90 | }
|
55 | 91 |
|
56 | 92 | &.is-dragged {
|
|
77 | 113 | display: flex;
|
78 | 114 | align-items: center;
|
79 | 115 | justify-content: center;
|
80 |
| - margin: var(--mod-colorwheel-colorarea-margin, var(--spectrum-color-wheel-color-area-margin)); |
81 | 116 | }
|
82 | 117 |
|
83 | 118 | .spectrum-ColorWheel-slider {
|
|
93 | 128 | }
|
94 | 129 |
|
95 | 130 | .spectrum-ColorWheel-handle {
|
96 |
| - transform: translate(calc(var(--spectrum-colorwheel-width) / 2 - var(--spectrum-colorwheel-track-width) / 2), 0); |
| 131 | + transform: translate(calc(var(--spectrum-colorwheel-width) / 2 - var(--mod-colorwheel-track-width, var(--spectrum-colorwheel-track-width)) / 2), 0); |
97 | 132 | inset-block-start: 50%;
|
98 | 133 | inset-inline: 50%;
|
99 | 134 | }
|
|
107 | 142 | }
|
108 | 143 | }
|
109 | 144 |
|
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 | 145 | .spectrum-ColorWheel-wheel {
|
124 | 146 | position: absolute;
|
125 | 147 | 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 | 151 |
|
130 | 152 | &.is-disabled {
|
131 | 153 | pointer-events: none;
|
132 |
| - background: var(--highcontrast-colorwheel-fill-color-disabled, var(--spectrum-colorwheel-fill-color-disabled)); |
| 154 | + background: var(--highcontrast-colorwheel-fill-color-disabled, var(--mod-colorwheel-fill-color-disabled, var(--spectrum-colorwheel-fill-color-disabled))); |
| 155 | + } |
| 156 | +} |
| 157 | + |
| 158 | +/* Windows High Contrast Mode */ |
| 159 | +@media (forced-colors: active) { |
| 160 | + .spectrum-ColorWheel { |
| 161 | + --highcontrast-colorwheel-border-color-disabled: GrayText; |
| 162 | + --highcontrast-colorwheel-fill-color-disabled: Canvas; |
| 163 | + |
| 164 | + forced-color-adjust: none; |
133 | 165 | }
|
134 | 166 | }
|
0 commit comments