-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustom-button.js
More file actions
59 lines (51 loc) · 1.54 KB
/
custom-button.js
File metadata and controls
59 lines (51 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { css } from '@aegisjsproject/parsers/css.js';
const DISABLED_SELECTOR = ':state(disabled)';
export const customButton = css`@layer components.aegisjsproject.button {
:host {
display: inline flow-root;
appearance: button;
user-select: none;
white-space: nowrap;
align-items: flex-start;
text-align: center;
cursor: default;
box-sizing: border-box;
background-color: ButtonFace;
color: ButtonText;
border: 1px outset ButtonBorder;
border-radius: 2px;
padding: 2px 6px;
font-family: system-ui, -apple-system, sans-serif;
font-size: small;
}
:host(:focus-visible) {
/* Universal fallback for older engines or high contrast overrides */
outline: auto;
outline: 2px solid CanvasText;
outline-offset: 2px;
}
/* WebKit & Blink (Chrome, Safari, Edge) native focus ring targeting */
@supports (outline-color: -webkit-focus-ring-color) {
:host(:focus-visible) {
outline: 5px auto -webkit-focus-ring-color;
}
}
/* Firefox cross-platform fallback (Windows, Android, Linux) */
@supports (-moz-appearance: none) {
:host(:focus-visible) {
outline: 2px solid AccentColor;
}
}
:host(${DISABLED_SELECTOR}) {
color: GrayText;
border-color: color-mix(in srgb, GrayText, transparent 50%);
background-color: color-mix(in srgb, ButtonFace, transparent 50%);
pointer-events: none;
}
:host(:hover:not(${DISABLED_SELECTOR})) {
background-color: color-mix(in srgb, ButtonFace, ButtonText 10%);
}
:host(:active:not(${DISABLED_SELECTOR})) {
background-color: color-mix(in srgb, ButtonFace, ButtonText 20%);
}
}`;