@oscarpalmer/oui 0.8.0 → 0.10.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/src/css/form.scss CHANGED
@@ -1,5 +1,15 @@
1
+ /*! https://github.com/oscarpalmer/oui */
2
+
1
3
  @use 'mixins.scss' as mixins;
2
4
 
5
+ @mixin input {
6
+ outline: 4px solid transparent;
7
+ outline-offset: 0;
8
+ background-color: var(--oui-absolute);
9
+ box-shadow: inset 0 1px 2px 0 color-mix(in oklab, var(--oui-gray-10), transparent 80%);
10
+ transition: 0.125s ease-in-out;
11
+ }
12
+
3
13
  :where(.oui-fieldset) {
4
14
  padding: 1em;
5
15
  border: 1px solid var(--oui-gray-3);
@@ -7,68 +17,180 @@
7
17
  }
8
18
 
9
19
  .oui-input {
10
- :where(&) {
20
+ :where(&:not([type='range' i])) {
21
+ @include input;
22
+
11
23
  padding: 0.5em 0.75em;
12
- outline: 3px solid transparent;
13
- outline-offset: 0;
14
- background-color: var(--oui-absolute);
15
24
  border-color: var(--oui-gray-3);
16
25
  border-radius: 0.25em;
17
- box-shadow: inset 0 1px 2px 0
18
- color-mix(in oklab, var(--oui-gray-10), transparent 80%);
19
- transition: 0.125s ease-in-out;
20
26
  }
21
27
 
22
- :where(&:not(textarea)) {
28
+ :where(&:not([type='range' i], select[multiple], textarea)) {
23
29
  overflow: hidden;
24
30
  white-space: nowrap;
25
31
  text-overflow: ellipsis;
26
32
  }
27
33
 
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
- ) {
34
+ :where(&:is([list])) {
35
+ &::-webkit-calendar-picker-indicator {
36
+ display: none !important;
37
+ }
38
+ }
39
+
40
+ :where(&:is([type='color' i])) {
41
+ padding: 0;
42
+ }
43
+
44
+ :where(&:is([type='date' i],
45
+ [type='datetime-local' i],
46
+ [type='month' i],
47
+ [type='number' i],
48
+ [type='tel' i],
49
+ [type='time' i],
50
+ [type='url' i],
51
+ [type='week' i])) {
40
52
  font-variant-numeric: tabular-nums;
41
53
  }
42
54
 
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 oklab, var(--oui-red-6), transparent 60%);
50
- border-color: var(--oui-red-6);
55
+ :where(&:is([type='file' i])) {
56
+ padding-left: .5em;
57
+
58
+ &::file-selector-button {
59
+ padding: .5em .75em;
60
+ margin: 0 .75em 0 0;
61
+ background-color: var(--oui-gray-1);
62
+ border: 1px solid var(--oui-gray-3);
63
+ border-radius: .25em;
64
+ box-shadow: inset 0 1px 0 0 var(--oui-gray-0), 0 1px 2px 0 rgba(0, 0, 0, 0.125);
65
+ color: var(--oui-gray-8);
66
+ font-size: .75em;
67
+ line-height: 1;
68
+ transition: .125s ease-in-out;
69
+ cursor: pointer;
70
+ }
71
+ }
72
+
73
+ :where(&:is([type='range' i])) {
74
+ appearance: none;
75
+ outline: none;
76
+
77
+ &::range-track {
78
+ @include input;
79
+
80
+ appearance: none;
81
+ width: 100%;
82
+ height: 0.75em;
83
+ border: 1px solid var(--oui-gray-3);
84
+ border-radius: .75em;
85
+ position: relative;
86
+ }
87
+
88
+ &::range-thumb {
89
+ appearance: none;
90
+ width: 1.25em;
91
+ height: 1.25em;
92
+ background-color: var(--oui-blue-6);
93
+ outline: 4px solid transparent;
94
+ border: 2px solid var(--oui-absolute);
95
+ border-radius: 1.25em;
96
+ box-shadow: 0 1px 2px 2px rgba(0, 0, 0, 0.125);
97
+ transition: .125s ease-in-out;
98
+ cursor: pointer;
99
+ }
100
+ }
101
+
102
+ :where(&.oui-validatable:not([disabled], [aria-disabled='true' i]):is(:user-invalid,
103
+ [aria-invalid='true' i])) {
104
+ & {
105
+ outline-color: color-mix(in oklab, var(--oui-red-6), transparent 60%);
106
+ border-color: var(--oui-red-6);
107
+ }
108
+
109
+ &::range-track {
110
+ outline-color: color-mix(in oklab, var(--oui-red-6), transparent 60%);
111
+ border-color: var(--oui-red-6);
112
+ }
113
+
114
+ &::file-selector-button {
115
+ background-color: var(--oui-red-0);
116
+ border-color: var(--oui-red-2);
117
+ color: var(--oui-red-9);
118
+ }
119
+
120
+ &::range-thumb {
121
+ background-color: var(--oui-red-6);
122
+ }
51
123
  }
52
124
 
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 oklab, var(--oui-green-6), transparent 60%);
60
- border-color: var(--oui-green-6);
125
+ :where(&.oui-validatable:not([disabled], [aria-disabled='true' i]):is(:user-valid,
126
+ [aria-invalid='false' i])) {
127
+ & {
128
+ outline-color: color-mix(in oklab, var(--oui-green-6), transparent 60%);
129
+ border-color: var(--oui-green-6);
130
+ }
131
+
132
+ &::range-track {
133
+ outline-color: color-mix(in oklab, var(--oui-green-6), transparent 60%);
134
+ border-color: var(--oui-green-6);
135
+ }
136
+
137
+ &::file-selector-button {
138
+ background-color: var(--oui-green-0);
139
+ border-color: var(--oui-green-3);
140
+ color: var(--oui-green-9);
141
+ }
142
+
143
+ &::range-thumb {
144
+ background-color: var(--oui-green-6);
145
+ }
61
146
  }
62
147
 
63
- :where(&:not([disabled], [aria-disabled='true']):focus) {
148
+ :where(&:not([disabled], [aria-disabled='true' i]):focus) {
64
149
  outline-color: color-mix(in oklab, var(--oui-blue-6), transparent 60%);
65
150
  border-color: var(--oui-blue-6);
151
+
152
+ &::file-selector-button {
153
+ background-color: var(--oui-blue-0);
154
+ border-color: var(--oui-blue-3);
155
+ color: var(--oui-blue-9);
156
+ }
157
+
158
+ &::range-track,
159
+ &::range-thumb {
160
+ outline-color: color-mix(in oklab, var(--oui-blue-6), transparent 60%);
161
+ }
162
+
163
+ &::range-track {
164
+ border-color: var(--oui-blue-6);
165
+ }
166
+
167
+ &::range-thumb {
168
+ background-color: var(--oui-blue-6);
169
+ box-shadow: 0 1px 2px 2px rgba(0, 0, 0, 0.25);
170
+ }
66
171
  }
67
172
 
68
173
  @media (hover: hover) {
69
- :where(&:not([disabled], [aria-disabled='true']):hover) {
70
- outline-color: color-mix(in oklab, var(--oui-blue-6), transparent 80%);
71
- border-color: var(--oui-blue-6);
174
+ :where(&:not([disabled], [aria-disabled='true' i]):hover) {
175
+ & {
176
+ outline-color: color-mix(in oklab, var(--oui-blue-6), transparent 80%);
177
+ border-color: var(--oui-blue-6);
178
+ }
179
+
180
+ &::range-track {
181
+ outline-color: color-mix(in oklab, var(--oui-blue-6), transparent 80%);
182
+ border-color: var(--oui-blue-6);
183
+ }
184
+
185
+ &::file-selector-button {
186
+ background-color: var(--oui-blue-0);
187
+ border-color: var(--oui-blue-3);
188
+ color: var(--oui-blue-9);
189
+ }
190
+
191
+ &::range-thumb {
192
+ background-color: var(--oui-blue-5);
193
+ }
72
194
  }
73
195
  }
74
196
 
@@ -76,17 +198,65 @@
76
198
  color: color-mix(in oklab, currentColor, transparent 12.5%);
77
199
  }
78
200
 
79
- :where(&[disabled], &[aria-disabled='true']) {
80
- background-color: color-mix(in oklab, var(--oui-gray-0), transparent 50%);
81
- color: color-mix(in oklab, currentColor, transparent 25%);
201
+ :where(&[disabled], &[aria-disabled='true' i]) {
202
+ & {
203
+ background-color: color-mix(in oklab, var(--oui-gray-0), transparent 50%);
204
+ color: color-mix(in oklab, currentColor, transparent 25%);
205
+ font-style: italic;
206
+ }
207
+
208
+ &::range-track {
209
+ background-color: color-mix(in oklab, var(--oui-gray-0), transparent 50%);
210
+ color: color-mix(in oklab, currentColor, transparent 25%);
211
+ font-style: italic;
212
+ }
213
+
214
+ &::file-selector-button,
215
+ &::range-thumb {
216
+ background-color: var(--oui-gray-1);
217
+ }
82
218
  }
83
219
  }
84
220
 
85
- :where(select.oui-input) {
221
+ :where(select.oui-input, .oui-input[list]) {
86
222
  padding-right: 2em;
87
223
  background-position: right 0.5em center;
88
224
  }
89
225
 
226
+ select.oui-input:is([multiple]) {
227
+ :where(&) {
228
+ --oui-off: attr(oui-off);
229
+ --oui-on: attr(oui-on, '\2713');
230
+
231
+ padding: 0;
232
+ }
233
+
234
+ :where(& > option) {
235
+ padding: 0.5em 0.75em;
236
+ }
237
+
238
+ :where(&[oui-off] > option) {
239
+ &::before {
240
+ content: var(--oui-off);
241
+ margin: 0 0.75em 0 0;
242
+ }
243
+ }
244
+
245
+ :where(& > option:nth-of-type(2n)) {
246
+ background-color: color-mix(in oklab, var(--oui-blue-0), transparent 67%)
247
+ }
248
+
249
+ :where(& > option:checked) {
250
+ background-color: var(--oui-blue-1);
251
+ color: var(--oui-blue-9);
252
+
253
+ &::before {
254
+ content: var(--oui-on);
255
+ margin: 0 .75em 0 0;
256
+ }
257
+ }
258
+ }
259
+
90
260
  :where(textarea.oui-input) {
91
261
  min-height: 4em;
92
262
  resize: vertical;
@@ -100,6 +270,13 @@
100
270
 
101
271
  :where(.oui-label) {
102
272
  cursor: pointer;
273
+ transition: .125s ease-in-out;
274
+
275
+ @media (hover: hover) {
276
+ :where(&:hover) {
277
+ color: var(--oui-blue-8);
278
+ }
279
+ }
103
280
  }
104
281
 
105
282
  :where(.oui-legend) {
@@ -121,7 +298,7 @@
121
298
  }
122
299
 
123
300
  &::before {
124
- outline: 3px solid transparent;
301
+ outline: 4px solid transparent;
125
302
  outline-offset: 0;
126
303
  }
127
304
  }
@@ -142,7 +319,7 @@
142
319
  }
143
320
 
144
321
  &::after {
145
- content: '\2715';
322
+ content: attr(oui-off, '\2715');
146
323
  width: 1.5em;
147
324
  height: 1.5em;
148
325
  background-color: var(--oui-absolute);
@@ -160,7 +337,7 @@
160
337
 
161
338
  :where(&:has(input:checked)) {
162
339
  &::after {
163
- content: '\2713';
340
+ content: attr(oui-on, '\2713');
164
341
  box-shadow: 0 1px 2px 1px rgba(0, 0, 0, 0.25);
165
342
  color: var(--oui-blue-8);
166
343
  right: 0.25em;
@@ -187,13 +364,13 @@
187
364
  }
188
365
  }
189
366
 
190
- :where(&:has(input[type='checkbox'])) {
367
+ :where(&:has(input[type='checkbox' i])) {
191
368
  &::before {
192
369
  border-radius: 0.25em;
193
370
  }
194
371
 
195
372
  &::after {
196
- content: '\2713';
373
+ content: attr(oui-on, '\2713');
197
374
  width: 1.5em;
198
375
  height: 1.5em;
199
376
  color: white;
@@ -205,7 +382,8 @@
205
382
  }
206
383
  }
207
384
 
208
- :where(&:has(input[type='radio'])) {
385
+ :where(&:has(input[type='radio' i])) {
386
+
209
387
  &::before,
210
388
  &::after {
211
389
  border-radius: 50%;
@@ -237,7 +415,7 @@
237
415
  }
238
416
  }
239
417
 
240
- :where(&:has(input:not([disabled], [aria-disabled='true'])):focus-within) {
418
+ :where(&:has(input:not([disabled], [aria-disabled='true' i])):focus-within) {
241
419
  color: var(--oui-blue-8);
242
420
 
243
421
  &::before {
@@ -247,7 +425,7 @@
247
425
  }
248
426
 
249
427
  @media (hover: hover) {
250
- :where(&:has(input:not([disabled], [aria-disabled='true'])):hover) {
428
+ :where(&:has(input:not([disabled], [aria-disabled='true' i])):hover) {
251
429
  color: var(--oui-blue-8);
252
430
 
253
431
  &::before {
@@ -256,20 +434,15 @@
256
434
  }
257
435
  }
258
436
 
259
- :where(
260
- &:has(input:not([disabled], [aria-disabled='true']):is(:checked)):hover
261
- )::before {
437
+ :where(&:has(input:not([disabled], [aria-disabled='true' i]):is(:checked)):hover)::before {
262
438
  background-color: color-mix(in oklab, var(--oui-blue-6), transparent 40%);
263
439
  }
264
440
  }
265
441
 
266
- :where(&:has(input[disabled], input[aria-disabled='true'])) {
442
+ :where(&:has(input[disabled], input[aria-disabled='true' i])) {
443
+ color: color-mix(in oklab, currentColor, transparent 25%);
267
444
  cursor: default;
268
445
 
269
- & {
270
- color: color-mix(in oklab, currentColor, transparent 25%);
271
- }
272
-
273
446
  &::after {
274
447
  color: color-mix(in oklab, currentColor, transparent);
275
448
  }
@@ -1,13 +1,26 @@
1
+ /*! https://github.com/oscarpalmer/oui */
2
+
1
3
  .oui-message {
2
4
  :where(&) {
5
+ --oui-shadow-value: color-mix(
6
+ in oklch,
7
+ var(--oui-shadow, var(--oui-gray-6)),
8
+ transparent 95%
9
+ );
10
+
3
11
  padding: 1em;
4
12
  display: inline-flex;
5
13
  flex-flow: column nowrap;
6
14
  gap: 1em;
7
- background-color: var(--background, var(--oui-gray-0));
8
- border: 1px solid var(--border, var(--oui-gray-2));
9
- border-radius: .5em;
10
- color: var(--foreground, var(--oui-gray-8));
15
+ background-color: color-mix(
16
+ in oklab,
17
+ var(--oui-background, var(--oui-gray-0)),
18
+ transparent 25%
19
+ );
20
+ border-radius: 0.5em;
21
+ box-shadow: 0 0 0 1px var(--oui-shadow-value),
22
+ 0 1px 2px 0 var(--oui-shadow-value), 0 2px 4px 0 var(--oui-shadow-value);
23
+ color: var(--oui-foreground, var(--oui-gray-8));
11
24
  line-height: 1.25;
12
25
  }
13
26
 
@@ -19,7 +32,7 @@
19
32
  :where(& hr) {
20
33
  height: 1px;
21
34
  margin: 0 -1em;
22
- background-color: var(--border, var(--oui-gray-2));
35
+ background-color: var(--oui-shadow-value, var(--oui-gray-2));
23
36
  border: none;
24
37
  }
25
38
 
@@ -30,38 +43,38 @@
30
43
  }
31
44
 
32
45
  :where(&-blue, &-info) {
33
- --background: var(--oui-blue-0);
34
- --border: var(--oui-blue-2);
35
- --foreground: var(--oui-blue-8);
46
+ --oui-background: var(--oui-blue-0);
47
+ --oui-foreground: var(--oui-blue-8);
48
+ --oui-shadow: var(--oui-blue-6);
36
49
  }
37
50
 
38
51
  :where(&-green, &-success) {
39
- --background: var(--oui-green-0);
40
- --border: var(--oui-green-2);
41
- --foreground: var(--oui-green-8);
52
+ --oui-background: var(--oui-green-0);
53
+ --oui-foreground: var(--oui-green-8);
54
+ --oui-shadow: var(--oui-green-6);
42
55
  }
43
56
 
44
57
  :where(&-orange, &-warning) {
45
- --background: var(--oui-orange-0);
46
- --border: var(--oui-orange-2);
47
- --foreground: var(--oui-orange-8);
58
+ --oui-background: var(--oui-orange-0);
59
+ --oui-foreground: var(--oui-orange-8);
60
+ --oui-shadow: var(--oui-orange-6);
48
61
  }
49
62
 
50
63
  :where(&-purple, &-special) {
51
- --background: var(--oui-purple-0);
52
- --border: var(--oui-purple-2);
53
- --foreground: var(--oui-purple-8);
64
+ --oui-background: var(--oui-purple-0);
65
+ --oui-foreground: var(--oui-purple-8);
66
+ --oui-shadow: var(--oui-purple-6);
54
67
  }
55
68
 
56
69
  :where(&-red, &-error) {
57
- --background: var(--oui-red-0);
58
- --border: var(--oui-red-2);
59
- --foreground: var(--oui-red-8);
70
+ --oui-background: var(--oui-red-0);
71
+ --oui-foreground: var(--oui-red-8);
72
+ --oui-shadow: var(--oui-red-6);
60
73
  }
61
74
 
62
75
  :where(&-yellow, &-notice) {
63
- --background: var(--oui-yellow-0);
64
- --border: var(--oui-yellow-2);
65
- --foreground: var(--oui-yellow-8);
76
+ --oui-background: var(--oui-yellow-0);
77
+ --oui-foreground: var(--oui-yellow-8);
78
+ --oui-shadow: var(--oui-yellow-6);
66
79
  }
67
80
  }
@@ -45,10 +45,7 @@
45
45
  font-family: system-ui, sans-serif;
46
46
  font-size: 100%;
47
47
  line-height: 1.5;
48
- -moz-text-size-adjust: none; // Prevent text size inflation (e.g., after orientation change) [AB][RE][SE]
49
- -webkit-text-size-adjust: none; // ditto
50
- text-size-adjust: none; // ditto
51
- -moz-tab-size: 4;
48
+ text-size-adjust: none; // Prevent text size inflation (e.g., after orientation change) [AB][RE][SE]
52
49
  tab-size: 4;
53
50
  }
54
51
 
@@ -80,7 +77,7 @@
80
77
  }
81
78
 
82
79
  :where(button, [type='button' i], [type='reset' i], [type='submit' i]) {
83
- -webkit-appearance: button; // Correct the inability to style clickable types in iOS [RS][SE]
80
+ appearance: button; // Correct the inability to style clickable types in iOS [RS][SE]
84
81
  cursor: pointer;
85
82
  }
86
83
 
@@ -178,10 +175,8 @@
178
175
  vertical-align: baseline; // Add the correct vertical alignment in Chrome, Edge, and Firefox [RS][SE]
179
176
  }
180
177
 
181
- :where(select) {
182
- -moz-appearance: none; // Change the inconsistent appearance in all browsers [SE]
183
- -webkit-appearance: none; // ditto
184
- appearance: none; // ditto
178
+ :where(select, input[list]) {
179
+ appearance: none; // Change the inconsistent appearance in all browsers [SE]
185
180
  padding-right: 1em; // ditto
186
181
  background: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='4'%3E%3Cpath d='M4 0h6L7 4'/%3E%3C/svg%3E")
187
182
  no-repeat right center / 1em; // ditto
@@ -202,27 +197,27 @@
202
197
  }
203
198
 
204
199
  :where([type='search' i]) {
205
- -webkit-appearance: textfield; // Correct the odd appearance in Chrome, Edge, and Safari [RS][SE]
200
+ appearance: textfield; // Correct the odd appearance in Chrome, Edge, and Safari [RS][SE]
206
201
  outline-offset: -2px; // Correct the outline style in Safari [RS][SE]
207
202
  }
208
203
 
209
- ::-webkit-file-upload-button {
210
- -webkit-appearance: button; // Correct the inability to style upload buttons in iOS and Safari [RS][SE]
204
+ ::file-selector-button {
205
+ appearance: button; // Correct the inability to style upload buttons in iOS and Safari [RS][SE]
211
206
  color: inherit;
212
207
  font: inherit;
213
208
  line-height: 1.25;
214
209
  }
215
210
 
211
+ ::placeholder {
212
+ opacity: 0.54; // Correct the text style of placeholders in Chrome, Edge, and Safari. [SE]
213
+ color: inherit; // Correct the text style of placeholders in Chrome, Edge, and Safari. [SE]
214
+ }
215
+
216
216
  ::-webkit-inner-spin-button,
217
217
  ::-webkit-outer-spin-button {
218
218
  height: auto; // Correct the cursor style of increment and decrement buttons in Safari [RS][SE]
219
219
  }
220
220
 
221
- ::-webkit-input-placeholder {
222
- opacity: 0.54; // Correct the text style of placeholders in Chrome, Edge, and Safari. [SE]
223
- color: inherit; // Correct the text style of placeholders in Chrome, Edge, and Safari. [SE]
224
- }
225
-
226
221
  ::-webkit-search-decoration {
227
222
  -webkit-appearance: none; // Remove the inner padding in Chrome, Edge, and Safari on macOS [SE]
228
223
  }
@@ -1,3 +1,5 @@
1
+ /*! https://github.com/oscarpalmer/oui */
2
+
1
3
  .oui-table {
2
4
  :where(&) {
3
5
  width: 100%;
@@ -26,7 +28,7 @@
26
28
  z-index: 2;
27
29
  }
28
30
 
29
- :where(& tbody tr:nth-child(2n)) {
31
+ :where(& tbody tr:nth-of-type(2n)) {
30
32
  background-color: color-mix(in oklab, var(--oui-blue-0), transparent 67%);
31
33
  }
32
34