-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathinput-select-styles.js
More file actions
103 lines (94 loc) · 3.19 KB
/
input-select-styles.js
File metadata and controls
103 lines (94 loc) · 3.19 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import '../colors/colors.js';
import { css, unsafeCSS } from 'lit';
import { getFocusPseudoClass } from '../../helpers/focus.js';
import { invalidIcon } from './input-styles.js';
import { svgToCSS } from '../../helpers/svg-to-css.js';
const focusClass = unsafeCSS(getFocusPseudoClass());
const chevron = svgToCSS(`<svg width="11" height="7" viewBox="0 0 11 7" xmlns="http://www.w3.org/2000/svg">
<path d="M1 2l4.5 4M10 2L5.5 6" stroke="#565A5C" stroke-width="2" fill="none" fill-rule="evenodd" stroke-linecap="round"/>
</svg>`);
export const selectStyles = css`
.d2l-input-select {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background-color: #ffffff;
background-image: ${chevron};
background-origin: border-box;
background-position: center var(--d2l-inline-end, right) 17px;
background-repeat: no-repeat;
background-size: 11px 7px;
border: none;
border-radius: 0.3rem;
box-shadow: inset 0 2px 0 1px rgba(177, 185, 190, 0.2); /* corundum */
color: var(--d2l-color-ferrite);
display: inline-block;
font-family: inherit;
font-size: 0.8rem;
font-weight: 400;
height: auto;
letter-spacing: 0.02rem;
line-height: 1.2rem;
margin: 0;
max-height: calc(2rem + 2px);
outline: 1px solid var(--d2l-color-galena);
outline-offset: -1px;
padding-block: calc(0.4rem + 1px);
padding-inline: calc(0.75rem + 1px) calc(2px + 0.8rem + 1px + 11px + 16px + 1px);
vertical-align: middle;
}
.d2l-input-select:not([disabled]):hover,
.d2l-input-select:not([disabled]):${focusClass} {
box-shadow: inset 0 2px 0 2px rgba(177, 185, 190, 0.2); /* corundum */
outline: 2px solid var(--d2l-color-celestine);
outline-offset: -2px;
}
.d2l-input-select[aria-invalid="true"] {
background-image: ${chevron}, ${invalidIcon};
background-position: center var(--d2l-inline-end, right) 17px, center var(--d2l-inline-end, right) calc(1px + 11px + 17px);
background-repeat: no-repeat, no-repeat;
background-size: 11px 7px, 0.8rem 0.8rem;
}
.d2l-input-select[aria-invalid="true"],
.d2l-input-select[aria-invalid="true"]:${focusClass},
.d2l-input-select[aria-invalid="true"]:hover {
outline-color: var(--d2l-color-cinnabar);
}
.d2l-input-select:disabled {
opacity: 0.5;
}
@media (prefers-contrast: more) {
.d2l-input-select {
appearance: auto;
background-color: Field;
background-image: none;
border: none;
border-inline-end: 0.75rem solid transparent;
box-shadow: none;
color: FieldText;
forced-color-adjust: none;
height: 2rem;
outline: 1px solid ButtonBorder;
padding-inline: 0.6rem 16px;
}
.d2l-input-select:not([disabled]):${focusClass},
.d2l-input-select:not([disabled]):hover {
box-shadow: none;
outline: 2px solid Highlight;
}
.d2l-input-select:disabled {
outline: 1px solid GrayText;
}
.d2l-input-select[aria-invalid="true"] {
background-image: ${invalidIcon};
background-position: center var(--d2l-inline-end, right) calc(1px + 11px + 17px);
background-repeat: no-repeat;
background-size: 0.8rem 0.8rem;
}
.d2l-input-select[aria-invalid="true"],
.d2l-input-select[aria-invalid="true"]:${focusClass},
.d2l-input-select[aria-invalid="true"]:hover {
outline-color: var(--d2l-color-cinnabar);
}
}
`;