|
| 1 | +/* Copyright 2023 The Matrix.org Foundation C.I.C. |
| 2 | + * |
| 3 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | + * you may not use this file except in compliance with the License. |
| 5 | + * You may obtain a copy of the License at |
| 6 | + * |
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | + * |
| 9 | + * Unless required by applicable law or agreed to in writing, software |
| 10 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | + * See the License for the specific language governing permissions and |
| 13 | + * limitations under the License. |
| 14 | + */ |
| 15 | + |
| 16 | +/** |
| 17 | + * FIELD: Wrapper around label, control and message |
| 18 | + */ |
| 19 | + |
| 20 | +.cpd-field { |
| 21 | + display: flex; |
| 22 | + flex-direction: column; |
| 23 | +} |
| 24 | + |
| 25 | +/** |
| 26 | + * LABEL |
| 27 | + */ |
| 28 | + |
| 29 | +.cpd-label { |
| 30 | + font-weight: var(--cpd-font-weight-medium); |
| 31 | +} |
| 32 | + |
| 33 | +.cpd-label[for] { |
| 34 | + cursor: pointer; |
| 35 | +} |
| 36 | + |
| 37 | +.cpd-label[data-invalid] { |
| 38 | + color: var(--cpd-color-text-critical-primary); |
| 39 | +} |
| 40 | + |
| 41 | +/* Currently working everywhere but on Firefox (only behind a labs flag) |
| 42 | +https://developer.mozilla.org/en-US/docs/Web/CSS/:has#browser_compatibility */ |
| 43 | +.cpd-label:has(~ .cpd-control[disabled]) { |
| 44 | + color: var(--cpd-color-text-disabled); |
| 45 | + cursor: not-allowed; |
| 46 | +} |
| 47 | + |
| 48 | +/** |
| 49 | + * CONTROL |
| 50 | + */ |
| 51 | + |
| 52 | +.cpd-control { |
| 53 | + border: 1px solid var(--cpd-color-border-interactive-primary); |
| 54 | + background: var(--cpd-color-bg-canvas-default); |
| 55 | + border-radius: 0.5rem; |
| 56 | + padding: var(--cpd-space-3x) var(--cpd-space-4x); |
| 57 | + box-sizing: border-box; |
| 58 | +} |
| 59 | + |
| 60 | +.cpd-control:hover, |
| 61 | +input:hover ~ .cpd-control { |
| 62 | + border-color: var(--cpd-color-border-interactive-hovered); |
| 63 | +} |
| 64 | + |
| 65 | +.cpd-control:focus, |
| 66 | +input:focus ~ .cpd-control { |
| 67 | + outline: 2px solid var(--cpd-color-border-focused); |
| 68 | + border-color: transparent; |
| 69 | +} |
| 70 | + |
| 71 | +.cpd-control[data-invalid], |
| 72 | +input[data-invalid] ~ .cpd-control { |
| 73 | + border-color: var(--cpd-color-text-critical-primary); |
| 74 | +} |
| 75 | + |
| 76 | +.cpd-control:disabled, |
| 77 | +input:disabled ~ .cpd-control { |
| 78 | + background: var(--cpd-color-bg-canvas-disabled); |
| 79 | + border-color: var(--cpd-color-border-disabled); |
| 80 | + color: var(--cpd-color-text-disabled); |
| 81 | + cursor: not-allowed; |
| 82 | +} |
0 commit comments