|
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-inline-size: var(--spectrum-color-wheel-width); |
| 16 | + --spectrum-colorwheel-block-size: var(--spectrum-color-wheel-width); |
| 17 | + --spectrum-colorwheel-min-inline-size: var(--spectrum-color-wheel-minimum-width); |
19 | 18 |
|
20 |
| - forced-color-adjust: none; |
21 |
| - } |
22 |
| -} |
| 19 | + /* @TODO: leveraging the rgb token in this case to achieve the desired border color implementation as rgb + opacity are required by the `rgba` function. */ |
| 20 | + --spectrum-colorwheel-border-color-rgb: var(--spectrum-gray-1000-rgb); |
23 | 21 |
|
24 |
| -.spectrum-ColorWheel { |
25 |
| - --spectrum-colorwheel-border-color: var(--spectrum-transparent-black-300); |
| 22 | + --spectrum-colorwheel-border-opacity: var(--spectrum-color-wheel-border-opacity); |
| 23 | + --spectrum-colorwheel-border-color: rgba(var(--spectrum-colorwheel-border-color-rgb), var(--spectrum-colorwheel-border-opacity)); |
26 | 24 |
|
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); |
| 25 | + --spectrum-colorwheel-border-width: var(--spectrum-border-width-100); |
| 26 | + --spectrum-colorwheel-track-width: var(--spectrum-color-control-track-width); |
31 | 27 |
|
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)); |
| 28 | + --spectrum-colorwheel-fill-color-disabled: var(--spectrum-disabled-background-color); |
34 | 29 |
|
35 | 30 | /* 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); |
| 31 | + --_track-width: var(--mod-colorwheel-track-width, var(--spectrum-colorwheel-track-width)); |
37 | 32 | /* stylelint-disable-next-line spectrum-tools/no-unused-custom-properties -- used with JS in calculating the clip-path paths and colorarea-container-size */
|
38 | 33 | --_border-width: var(--spectrum-colorwheel-border-width);
|
39 | 34 |
|
40 | 35 | position: relative;
|
41 | 36 | display: block;
|
42 |
| - min-inline-size: var(--mod-colorwheel-min-width, var(--spectrum-color-wheel-minimum-width)); |
43 |
| - inline-size: var(--spectrum-colorwheel-width); |
44 |
| - block-size: var(--spectrum-colorwheel-height); |
| 37 | + min-inline-size: var(--mod-colorwheel-min-inline-size, var(--spectrum-colorwheel-min-inline-size)); |
| 38 | + inline-size: var(--mod-colorwheel-inline-size, var(--spectrum-colorwheel-inline-size)); |
| 39 | + block-size: var(--mod-colorwheel-block-size, var(--spectrum-colorwheel-block-size)); |
45 | 40 | user-select: none;
|
46 | 41 | cursor: default;
|
47 | 42 |
|
| 43 | + /** |
| 44 | + * Color wheel exterior border |
| 45 | + * - Calcs for `inline-size` and `block-size` subtract 4 times the component's border width |
| 46 | + * (to account for the inset width of the exterior border) from the component's width. |
| 47 | + */ |
| 48 | + &::before { |
| 49 | + inline-size: calc(var(--mod-colorwheel-inline-size, var(--spectrum-colorwheel-inline-size)) - calc(4 * var(--spectrum-colorwheel-border-width))); |
| 50 | + block-size: calc(var(--mod-colorwheel-inline-size, var(--spectrum-colorwheel-inline-size)) - calc(4 * var(--spectrum-colorwheel-border-width))); |
| 51 | + inset: 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 | + |
| 61 | + /** |
| 62 | + * Color wheel interior border |
| 63 | + * - Calcs for `inset` 2 times the component's border width from the |
| 64 | + * track width (to account for the inset width of the interior border) |
| 65 | + */ |
| 66 | + &::after { |
| 67 | + inset: calc(var(--mod-colorwheel-track-width, var(--spectrum-colorwheel-track-width)) - (calc(2 * var(--spectrum-colorwheel-border-width)))); |
| 68 | + content: ""; |
| 69 | + position: absolute; |
| 70 | + border-width: var(--spectrum-colorwheel-border-width); |
| 71 | + border-style: solid; |
| 72 | + border-color: var(--mod-colorwheel-border-color, var(--spectrum-colorwheel-border-color)); |
| 73 | + border-radius: 100%; |
| 74 | + z-index: 1; |
| 75 | + } |
| 76 | + |
48 | 77 | &.is-focused {
|
49 | 78 | z-index: 2;
|
50 | 79 | }
|
51 | 80 |
|
52 | 81 | &.is-disabled {
|
53 | 82 | pointer-events: none;
|
| 83 | + |
| 84 | + &::before, |
| 85 | + &::after, |
| 86 | + .spectrum-ColorWheel-inner::before { |
| 87 | + border-color: var(--highcontrast-colorwheel-border-color-disabled, transparent); |
| 88 | + } |
54 | 89 | }
|
55 | 90 |
|
56 | 91 | &.is-dragged {
|
|
77 | 112 | display: flex;
|
78 | 113 | align-items: center;
|
79 | 114 | justify-content: center;
|
80 |
| - margin: var(--mod-colorwheel-colorarea-margin, var(--spectrum-color-wheel-color-area-margin)); |
81 | 115 | }
|
82 | 116 |
|
83 | 117 | .spectrum-ColorWheel-slider {
|
|
93 | 127 | }
|
94 | 128 |
|
95 | 129 | .spectrum-ColorWheel-handle {
|
96 |
| - transform: translate(calc(var(--spectrum-colorwheel-width) / 2 - var(--spectrum-colorwheel-track-width) / 2), 0); |
| 130 | + transform: translate(calc(var(--mod-colorwheel-inline-size, var(--spectrum-colorwheel-inline-size)) / 2 - var(--mod-colorwheel-track-width, var(--mod-colorwheel-track-width, var(--spectrum-colorwheel-track-width))) / 2), 0); |
97 | 131 | inset-block-start: 50%;
|
98 | 132 | inset-inline: 50%;
|
99 | 133 | }
|
|
107 | 141 | }
|
108 | 142 | }
|
109 | 143 |
|
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 | 144 | .spectrum-ColorWheel-wheel {
|
124 | 145 | position: absolute;
|
125 | 146 | 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 | 150 |
|
130 | 151 | &.is-disabled {
|
131 | 152 | pointer-events: none;
|
132 |
| - background: var(--highcontrast-colorwheel-fill-color-disabled, var(--spectrum-colorwheel-fill-color-disabled)); |
| 153 | + background: var(--highcontrast-colorwheel-fill-color-disabled, var(--mod-colorwheel-fill-color-disabled, var(--spectrum-colorwheel-fill-color-disabled))); |
| 154 | + } |
| 155 | +} |
| 156 | + |
| 157 | +/* Windows High Contrast Mode */ |
| 158 | +@media (forced-colors: active) { |
| 159 | + .spectrum-ColorWheel { |
| 160 | + --highcontrast-colorwheel-border-color-disabled: GrayText; |
| 161 | + --highcontrast-colorwheel-fill-color-disabled: Canvas; |
| 162 | + |
| 163 | + forced-color-adjust: none; |
133 | 164 | }
|
134 | 165 | }
|
0 commit comments