|
2 | 2 | * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors |
3 | 3 | * SPDX-License-Identifier: AGPL-3.0-or-later |
4 | 4 | */ |
5 | | - |
6 | | - @mixin boxShadow($borderColor) { |
7 | | - box-shadow: 0 -1px $borderColor, |
8 | | - 0 0 0 1px color-mix(in srgb, $borderColor, 65% transparent); |
9 | | -} |
10 | | - |
11 | | -@mixin boxShadowDark($borderColor) { |
12 | | - box-shadow: 0 1px $borderColor, |
13 | | - 0 0 0 1px color-mix(in srgb, $borderColor, 65% transparent); |
14 | | -} |
15 | 5 |
|
16 | 6 | /** |
17 | 7 | * Similar as inputBorder but without active styles. |
18 | 8 | */ |
19 | | -@mixin inputLikeBorder($darkThemeSelector, $legacySelector, $borderColor: var(--color-border-maxcontrast)) { |
| 9 | +@mixin inputLikeBorder($legacySelector, $borderColor: var(--color-border-maxcontrast)) { |
| 10 | + --input-border-box-shadow-light: 0 -1px #{$borderColor}, |
| 11 | + 0 0 0 1px color-mix(in srgb, #{$borderColor}, 65% transparent); |
| 12 | + --input-border-box-shadow-dark: 0 1px #{$borderColor}, |
| 13 | + 0 0 0 1px color-mix(in srgb, #{$borderColor}, 65% transparent); |
| 14 | + --input-border-box-shadow: var(--input-border-box-shadow-light); |
20 | 15 | border: none; |
21 | 16 | border-radius: var(--border-radius-element); |
22 | | - @include boxShadow($borderColor); |
| 17 | + box-shadow: var(--input-border-box-shadow); |
23 | 18 |
|
24 | 19 | &:hover:not([disabled]) { |
25 | 20 | box-shadow: 0 0 0 1px $borderColor; |
26 | 21 | } |
27 | 22 |
|
28 | | - @at-root #{$darkThemeSelector} #{&} { |
29 | | - @include boxShadowDark($borderColor); |
| 23 | + // override with system theme |
| 24 | + @media (prefers-color-scheme: dark) { |
| 25 | + --input-border-box-shadow: var(--input-border-box-shadow-dark); |
| 26 | + } |
| 27 | + |
| 28 | + // override with nextcloud theme |
| 29 | + @at-root [data-theme-dark] #{&} { |
| 30 | + --input-border-box-shadow: var(--input-border-box-shadow-dark); |
| 31 | + } |
| 32 | + @at-root [data-theme-light] #{&} { |
| 33 | + --input-border-box-shadow: var(--input-border-box-shadow-light); |
30 | 34 | } |
31 | 35 |
|
32 | 36 | @at-root #{$legacySelector} #{&} { |
|
42 | 46 | * Create a consistent border for an input element. |
43 | 47 | * With Nextcloud 32+ there is no real border anymore but we use a box-shadow. |
44 | 48 | */ |
45 | | -@mixin inputBorder($darkThemeSelector, $legacySelector, $borderColor: var(--color-border-maxcontrast)) { |
46 | | - @include inputLikeBorder($darkThemeSelector, $legacySelector, $borderColor); |
| 49 | +@mixin inputBorder($legacySelector, $borderColor: var(--color-border-maxcontrast)) { |
| 50 | + @include inputLikeBorder($legacySelector, $borderColor); |
47 | 51 |
|
48 | 52 | &:focus-within:not([disabled]), |
49 | 53 | &:active:not([disabled]) { |
|
0 commit comments