@oscarpalmer/oui 0.9.0 → 0.11.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.
@@ -1,3 +1,46 @@
1
+ @mixin button() {
2
+ --oui-background-percentage: 25%;
3
+ --oui-foreground-percentage: 0%;
4
+ --oui-outline-percentage: 100%;
5
+ --oui-shadow-percentage: 85%;
6
+
7
+ --oui-shadow-value: color-mix(
8
+ in oklch,
9
+ var(--oui-outline-value, var(--oui-gray-6)),
10
+ transparent var(--oui-shadow-percentage)
11
+ );
12
+
13
+ padding: 0.5em 0.75em;
14
+ display: inline-flex;
15
+ flex-flow: row wrap;
16
+ gap: 0.75em;
17
+ align-items: center;
18
+ border-radius: 0.25em;
19
+ background-color: color-mix(
20
+ in oklab,
21
+ var(--oui-background-value, var(--oui-gray-2)),
22
+ transparent var(--oui-background-percentage)
23
+ );
24
+ outline: 4px solid
25
+ color-mix(
26
+ in oklab,
27
+ var(--oui-outline-value, var(--oui-gray-6)),
28
+ transparent var(--oui-outline-percentage)
29
+ );
30
+ border: none;
31
+ box-shadow:
32
+ 0 0 0 1px var(--oui-shadow-value),
33
+ 0 1px 2px 0 var(--oui-shadow-value),
34
+ 0 2px 4px 0 var(--oui-shadow-value);
35
+ color: color-mix(
36
+ in oklab,
37
+ var(--oui-foreground-value, var(--oui-gray-8)),
38
+ transparent var(--oui-foreground-percentage)
39
+ );
40
+ line-height: 1.25;
41
+ transition: 0.125s ease-in-out;
42
+ }
43
+
1
44
  @mixin visuallyHidden() {
2
45
  width: 1px !important;
3
46
  height: 1px !important;
@@ -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
 
@@ -65,7 +65,7 @@ function onFocusOut(): void {
65
65
  return;
66
66
  }
67
67
 
68
- setTimeout(() => {
68
+ requestAnimationFrame(() => {
69
69
  const element = findAncestor(
70
70
  document.activeElement as never,
71
71
  `[${selector}]`,
@@ -76,7 +76,7 @@ function onFocusOut(): void {
76
76
  focusTrap.activate();
77
77
  }
78
78
  }
79
- }, 0);
79
+ });
80
80
  }
81
81
 
82
82
  function onTab(event: KeyboardEvent): void {
@@ -163,7 +163,7 @@ observer.observe(document, {
163
163
  subtree: true,
164
164
  });
165
165
 
166
- setTimeout(() => {
166
+ requestAnimationFrame(() => {
167
167
  addFocusTraps(document.querySelectorAll(`[${selector}]`));
168
168
 
169
169
  on(document, 'focusout', onFocusOut, {
@@ -178,4 +178,4 @@ setTimeout(() => {
178
178
  on(document, 'keydown', onEscape, {
179
179
  passive: false,
180
180
  });
181
- }, 0);
181
+ });