@oscarpalmer/oui 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/a11y.css +2 -2
- package/dist/css/colours.css +360 -74
- package/dist/css/form.css +650 -0
- package/dist/css/mixins.css +1 -1
- package/dist/css/reset.css +2 -3
- package/package.json +3 -3
- package/src/css/a11y.scss +5 -10
- package/src/css/colours.scss +0 -2
- package/src/css/form.scss +230 -0
- package/src/css/mixins.scss +51 -10
- package/src/css/reset.scss +2 -3
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
@use 'colours.scss' as colours;
|
|
2
|
+
@use 'mixins.scss' as mixins;
|
|
3
|
+
|
|
4
|
+
:where(.oui-fieldset) {
|
|
5
|
+
padding: 1em;
|
|
6
|
+
border: 1px solid var(--oui-grey-3);
|
|
7
|
+
border-radius: 0.25em;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.oui-input {
|
|
11
|
+
:where(&) {
|
|
12
|
+
padding: 0.5em 0.75em;
|
|
13
|
+
outline: 3px solid transparent;
|
|
14
|
+
outline-offset: 0;
|
|
15
|
+
border-color: var(--oui-grey-4);
|
|
16
|
+
border-radius: 0.25em;
|
|
17
|
+
box-shadow: inset 0 1px 2px 0
|
|
18
|
+
color-mix(in srgb, var(--oui-grey-10), transparent 75%);
|
|
19
|
+
transition: 0.125s ease-in-out;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
:where(&:not(textarea)) {
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
white-space: nowrap;
|
|
25
|
+
text-overflow: ellipsis;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:where(
|
|
29
|
+
&:is(
|
|
30
|
+
[type='date'],
|
|
31
|
+
[type='datetime-local'],
|
|
32
|
+
[type='month'],
|
|
33
|
+
[type='number'],
|
|
34
|
+
[type='tel'],
|
|
35
|
+
[type='time'],
|
|
36
|
+
[type='url'],
|
|
37
|
+
[type='week']
|
|
38
|
+
)
|
|
39
|
+
) {
|
|
40
|
+
font-variant-numeric: tabular-nums;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
:where(
|
|
44
|
+
&.oui-validateable:not([disabled], [aria-disabled='true']):is(
|
|
45
|
+
:user-invalid,
|
|
46
|
+
[aria-invalid='true']
|
|
47
|
+
)
|
|
48
|
+
) {
|
|
49
|
+
outline-color: color-mix(in srgb, var(--oui-red-4), transparent 75%);
|
|
50
|
+
border-color: var(--oui-red-6);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
:where(
|
|
54
|
+
&.oui-validateable:not([disabled], [aria-disabled='true']):is(
|
|
55
|
+
:user-valid,
|
|
56
|
+
[aria-invalid='false']
|
|
57
|
+
)
|
|
58
|
+
) {
|
|
59
|
+
outline-color: color-mix(in srgb, var(--oui-green-4), transparent 75%);
|
|
60
|
+
border-color: var(--oui-green-6);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
:where(&:not([disabled], [aria-disabled='true']):focus) {
|
|
64
|
+
outline-color: var(--oui-blue-4);
|
|
65
|
+
border-color: var(--oui-blue-6);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@media (hover: hover) {
|
|
69
|
+
:where(&:not([disabled], [aria-disabled='true']):hover) {
|
|
70
|
+
border-color: var(--oui-blue-6);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
:where(&[readonly]) {
|
|
75
|
+
color: color-mix(in srgb, currentColor, transparent 12.5%);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
:where(&[disabled], &[aria-disabled='true']) {
|
|
79
|
+
background-color: color-mix(in srgb, var(--oui-grey-0), transparent 50%);
|
|
80
|
+
color: color-mix(in srgb, currentColor, transparent 25%);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
:where(select.oui-input) {
|
|
85
|
+
padding-right: 2em;
|
|
86
|
+
background-position: right 0.5em center;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
:where(textarea.oui-input) {
|
|
90
|
+
min-height: 4em;
|
|
91
|
+
resize: vertical;
|
|
92
|
+
transition: all 0.125s ease-in-out, height 0s;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
:where(.oui-label, .oui-legend) {
|
|
96
|
+
font-size: 0.875rem;
|
|
97
|
+
font-weight: bold;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
:where(.oui-label) {
|
|
101
|
+
cursor: pointer;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
:where(.oui-legend) {
|
|
105
|
+
padding: 0.5em;
|
|
106
|
+
border: 1px solid var(--oui-grey-3);
|
|
107
|
+
border-radius: 0.25em;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.oui-toggle {
|
|
111
|
+
:where(&) {
|
|
112
|
+
padding: 0 0 0 2em;
|
|
113
|
+
position: relative;
|
|
114
|
+
cursor: pointer;
|
|
115
|
+
|
|
116
|
+
&::before,
|
|
117
|
+
&::after {
|
|
118
|
+
position: absolute;
|
|
119
|
+
transition: 0.125s ease-in-out;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&::before {
|
|
123
|
+
content: '';
|
|
124
|
+
width: 1.5em;
|
|
125
|
+
height: 1.5em;
|
|
126
|
+
display: inline-block;
|
|
127
|
+
background-color: transparent;
|
|
128
|
+
outline: 3px solid transparent;
|
|
129
|
+
outline-offset: 0;
|
|
130
|
+
border: 1px solid var(--oui-grey-4);
|
|
131
|
+
inset: 0 auto auto 0;
|
|
132
|
+
pointer-events: none;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
&::after {
|
|
136
|
+
opacity: 0;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
:where(&:has(input[type='checkbox'])) {
|
|
141
|
+
&::before {
|
|
142
|
+
border-radius: 0.25em;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
&::after {
|
|
146
|
+
content: '\2713';
|
|
147
|
+
width: 1.5em;
|
|
148
|
+
height: 1.5em;
|
|
149
|
+
color: white;
|
|
150
|
+
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
|
|
151
|
+
font-weight: bold;
|
|
152
|
+
line-height: 1.5em;
|
|
153
|
+
text-align: center;
|
|
154
|
+
inset: 0 auto auto 0;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
:where(&:has(input[type='radio'])) {
|
|
159
|
+
&::before,
|
|
160
|
+
&::after {
|
|
161
|
+
border-radius: 50%;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&::after {
|
|
165
|
+
content: '';
|
|
166
|
+
width: 0.75em;
|
|
167
|
+
height: 0.75em;
|
|
168
|
+
background-color: white;
|
|
169
|
+
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
|
|
170
|
+
inset: 0.375em auto auto 0.375em;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
:where(&:has(input:checked)) {
|
|
175
|
+
&::before {
|
|
176
|
+
background-color: var(--oui-blue-6);
|
|
177
|
+
border-color: transparent;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
&::after {
|
|
181
|
+
opacity: 1;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
:where(
|
|
186
|
+
&:has(input:not([disabled], [aria-disabled='true'])):focus-within
|
|
187
|
+
)::before {
|
|
188
|
+
outline-color: var(--oui-blue-4);
|
|
189
|
+
border-color: white;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
@media (hover: hover) {
|
|
193
|
+
:where(&:has(input:not([disabled], [aria-disabled='true'])):hover)::before {
|
|
194
|
+
border-color: var(--oui-blue-6);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
:where(
|
|
198
|
+
&:has(input:not([disabled], [aria-disabled='true']):is(:checked)):hover
|
|
199
|
+
)::before {
|
|
200
|
+
background-color: color-mix(in srgb, var(--oui-blue-6), transparent 50%);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
:where(&:has(input[disabled], input[aria-disabled='true'])) {
|
|
205
|
+
cursor: default;
|
|
206
|
+
|
|
207
|
+
&,
|
|
208
|
+
&::after {
|
|
209
|
+
color: color-mix(in srgb, currentColor, transparent 25%);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
&::before {
|
|
213
|
+
background-color: color-mix(in srgb, var(--oui-grey-0), transparent 50%);
|
|
214
|
+
border-color: var(--oui-grey-4);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
&::after {
|
|
218
|
+
text-shadow: none;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
:where(label.oui-toggle) {
|
|
224
|
+
display: inline-block;
|
|
225
|
+
line-height: 1.5;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
:where(.oui-toggle input) {
|
|
229
|
+
@include mixins.visuallyHidden;
|
|
230
|
+
}
|
package/src/css/mixins.scss
CHANGED
|
@@ -1,17 +1,47 @@
|
|
|
1
|
-
/*! https://github.com/oscarpalmer/oui */
|
|
2
|
-
|
|
3
1
|
@mixin colour($name, $zero, $six, $ten, $dark-zero, $dark-six, $dark-ten) {
|
|
4
2
|
& {
|
|
5
3
|
--oui-#{$name}-0: #{$zero};
|
|
6
|
-
--oui-#{$name}-1: color-mix(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
--oui-#{$name}-1: color-mix(
|
|
5
|
+
in srgb,
|
|
6
|
+
var(--oui-#{$name}-0),
|
|
7
|
+
var(--oui-#{$name}-6) 5%
|
|
8
|
+
);
|
|
9
|
+
--oui-#{$name}-2: color-mix(
|
|
10
|
+
in srgb,
|
|
11
|
+
var(--oui-#{$name}-0),
|
|
12
|
+
var(--oui-#{$name}-6) 15%
|
|
13
|
+
);
|
|
14
|
+
--oui-#{$name}-3: color-mix(
|
|
15
|
+
in srgb,
|
|
16
|
+
var(--oui-#{$name}-0),
|
|
17
|
+
var(--oui-#{$name}-6) 30%
|
|
18
|
+
);
|
|
19
|
+
--oui-#{$name}-4: color-mix(
|
|
20
|
+
in srgb,
|
|
21
|
+
var(--oui-#{$name}-0),
|
|
22
|
+
var(--oui-#{$name}-6) 50%
|
|
23
|
+
);
|
|
24
|
+
--oui-#{$name}-5: color-mix(
|
|
25
|
+
in srgb,
|
|
26
|
+
var(--oui-#{$name}-0),
|
|
27
|
+
var(--oui-#{$name}-6) 75%
|
|
28
|
+
);
|
|
11
29
|
--oui-#{$name}-6: #{$six};
|
|
12
|
-
--oui-#{$name}-7: color-mix(
|
|
13
|
-
|
|
14
|
-
|
|
30
|
+
--oui-#{$name}-7: color-mix(
|
|
31
|
+
in srgb,
|
|
32
|
+
var(--oui-#{$name}-10),
|
|
33
|
+
var(--oui-#{$name}-6) 75%
|
|
34
|
+
);
|
|
35
|
+
--oui-#{$name}-8: color-mix(
|
|
36
|
+
in srgb,
|
|
37
|
+
var(--oui-#{$name}-10),
|
|
38
|
+
var(--oui-#{$name}-6) 50%
|
|
39
|
+
);
|
|
40
|
+
--oui-#{$name}-9: color-mix(
|
|
41
|
+
in srgb,
|
|
42
|
+
var(--oui-#{$name}-10),
|
|
43
|
+
var(--oui-#{$name}-6) 25%
|
|
44
|
+
);
|
|
15
45
|
--oui-#{$name}-10: #{$ten};
|
|
16
46
|
|
|
17
47
|
@media (prefers-color-scheme: dark) {
|
|
@@ -23,3 +53,14 @@
|
|
|
23
53
|
}
|
|
24
54
|
}
|
|
25
55
|
}
|
|
56
|
+
|
|
57
|
+
@mixin visuallyHidden() {
|
|
58
|
+
width: 1px !important;
|
|
59
|
+
height: 1px !important;
|
|
60
|
+
padding: 0 !important;
|
|
61
|
+
clip: rect(1px, 1px 1px, 1px) !important;
|
|
62
|
+
clip-path: inset(50%) !important;
|
|
63
|
+
overflow: hidden !important;
|
|
64
|
+
border: 0 !important;
|
|
65
|
+
white-space: nowrap !important;
|
|
66
|
+
}
|