@oscarpalmer/oui 0.7.0 → 0.9.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.
@@ -2,9 +2,9 @@
2
2
  display: inline-flex;
3
3
  flex-flow: row nowrap;
4
4
  gap: 0.5em;
5
- background-color: var(--background, var(--oui-grey-1, #eee));
6
- border: 1px solid var(--border, var(--oui-grey-3, #ccc));
7
- color: var(--foreground, var(--oui-grey-8, #333));
5
+ background-color: var(--background, var(--oui-gray-1));
6
+ border: 1px solid var(--border, var(--oui-gray-3));
7
+ color: var(--foreground, var(--oui-gray-8));
8
8
  line-height: 1.125;
9
9
  }
10
10
  :where(.oui-pill) {
@@ -27,30 +27,30 @@
27
27
  :where(.oui-pill-blue, .oui-tag-blue) {
28
28
  --background: var(--oui-blue-1);
29
29
  --border: var(--oui-blue-3);
30
- --foreground: var(--oui-blue-9);
30
+ --foreground: var(--oui-blue-8);
31
31
  }
32
32
  :where(.oui-pill-green, .oui-tag-green) {
33
33
  --background: var(--oui-green-1);
34
34
  --border: var(--oui-green-3);
35
- --foreground: var(--oui-green-9);
35
+ --foreground: var(--oui-green-8);
36
36
  }
37
37
  :where(.oui-pill-orange, .oui-tag-orange) {
38
38
  --background: var(--oui-orange-1);
39
39
  --border: var(--oui-orange-3);
40
- --foreground: var(--oui-orange-9);
40
+ --foreground: var(--oui-orange-8);
41
41
  }
42
42
  :where(.oui-pill-purple, .oui-tag-purple) {
43
43
  --background: var(--oui-purple-1);
44
44
  --border: var(--oui-purple-3);
45
- --foreground: var(--oui-purple-9);
45
+ --foreground: var(--oui-purple-8);
46
46
  }
47
47
  :where(.oui-pill-red, .oui-tag-red) {
48
48
  --background: var(--oui-red-1);
49
49
  --border: var(--oui-red-3);
50
- --foreground: var(--oui-red-9);
50
+ --foreground: var(--oui-red-8);
51
51
  }
52
52
  :where(.oui-pill-yellow, .oui-tag-yellow) {
53
53
  --background: var(--oui-yellow-1);
54
54
  --border: var(--oui-yellow-3);
55
- --foreground: var(--oui-yellow-9);
55
+ --foreground: var(--oui-yellow-8);
56
56
  }
@@ -0,0 +1,102 @@
1
+ :root {
2
+ --oui-absolute: light-dark(white, black);
3
+ --oui-blue-0: light-dark(oklch(0.98 0.015 260), oklch(0.18 0.1 250));
4
+ --oui-blue-1: light-dark(oklch(0.95 0.03 259), oklch(0.24 0.12 251));
5
+ --oui-blue-2: light-dark(oklch(0.9 0.05 258), oklch(0.32 0.14 252));
6
+ --oui-blue-3: light-dark(oklch(0.83 0.07 257), oklch(0.4 0.16 253));
7
+ --oui-blue-4: light-dark(oklch(0.75 0.09 256), oklch(0.5 0.14 254));
8
+ --oui-blue-5: light-dark(oklch(0.67 0.11 255), oklch(0.6 0.11 255));
9
+ --oui-blue-6: light-dark(oklch(0.58 0.14 254), oklch(0.7 0.09 256));
10
+ --oui-blue-7: light-dark(oklch(0.48 0.16 253), oklch(0.78 0.07 257));
11
+ --oui-blue-8: light-dark(oklch(0.34 0.14 252), oklch(0.85 0.05 258));
12
+ --oui-blue-9: light-dark(oklch(0.22 0.12 251), oklch(0.91 0.03 259));
13
+ --oui-blue-10: light-dark(oklch(0.18 0.1 250), oklch(0.97 0.01 260));
14
+ --oui-green-0: light-dark(oklch(0.98 0.015 150), oklch(0.18 0.1 140));
15
+ --oui-green-1: light-dark(oklch(0.95 0.03 149), oklch(0.24 0.12 141));
16
+ --oui-green-2: light-dark(oklch(0.9 0.05 148), oklch(0.32 0.14 142));
17
+ --oui-green-3: light-dark(oklch(0.83 0.07 147), oklch(0.4 0.15 143));
18
+ --oui-green-4: light-dark(oklch(0.75 0.09 146), oklch(0.5 0.14 144));
19
+ --oui-green-5: light-dark(oklch(0.67 0.11 145), oklch(0.6 0.12 145));
20
+ --oui-green-6: light-dark(oklch(0.58 0.14 144), oklch(0.7 0.09 146));
21
+ --oui-green-7: light-dark(oklch(0.48 0.15 143), oklch(0.78 0.07 147));
22
+ --oui-green-8: light-dark(oklch(0.34 0.14 142), oklch(0.85 0.05 148));
23
+ --oui-green-9: light-dark(oklch(0.22 0.12 141), oklch(0.91 0.03 149));
24
+ --oui-green-10: light-dark(oklch(0.18 0.1 140), oklch(0.97 0.01 150));
25
+ --oui-orange-0: light-dark(oklch(0.985 0.02 60), oklch(0.18 0.1 50));
26
+ --oui-orange-1: light-dark(oklch(0.95 0.03 59), oklch(0.24 0.11 51));
27
+ --oui-orange-2: light-dark(oklch(0.9 0.05 58), oklch(0.32 0.12 52));
28
+ --oui-orange-3: light-dark(oklch(0.83 0.08 57), oklch(0.4 0.13 53));
29
+ --oui-orange-4: light-dark(oklch(0.75 0.11 56), oklch(0.5 0.14 54));
30
+ --oui-orange-5: light-dark(oklch(0.67 0.13 55), oklch(0.6 0.13 55));
31
+ --oui-orange-6: light-dark(oklch(0.57 0.14 54), oklch(0.7 0.11 56));
32
+ --oui-orange-7: light-dark(oklch(0.46 0.13 53), oklch(0.78 0.08 57));
33
+ --oui-orange-8: light-dark(oklch(0.34 0.12 53), oklch(0.85 0.05 58));
34
+ --oui-orange-9: light-dark(oklch(0.22 0.11 51), oklch(0.91 0.03 59));
35
+ --oui-orange-10: light-dark(oklch(0.18 0.1 50), oklch(0.97 0.02 60));
36
+ --oui-purple-0: light-dark(oklch(0.98 0.015 300), oklch(0.18 0.1 290));
37
+ --oui-purple-1: light-dark(oklch(0.95 0.03 299), oklch(0.24 0.11 291));
38
+ --oui-purple-2: light-dark(oklch(0.9 0.05 298), oklch(0.32 0.12 292));
39
+ --oui-purple-3: light-dark(oklch(0.83 0.07 297), oklch(0.4 0.13 293));
40
+ --oui-purple-4: light-dark(oklch(0.75 0.09 296), oklch(0.5 0.12 294));
41
+ --oui-purple-5: light-dark(oklch(0.67 0.11 295), oklch(0.6 0.11 295));
42
+ --oui-purple-6: light-dark(oklch(0.58 0.12 294), oklch(0.7 0.09 296));
43
+ --oui-purple-7: light-dark(oklch(0.48 0.13 293), oklch(0.78 0.07 297));
44
+ --oui-purple-8: light-dark(oklch(0.34 0.12 292), oklch(0.85 0.05 298));
45
+ --oui-purple-9: light-dark(oklch(0.22 0.11 291), oklch(0.91 0.03 299));
46
+ --oui-purple-10: light-dark(oklch(0.18 0.1 290), oklch(0.97 0.01 300));
47
+ --oui-red-0: light-dark(oklch(0.98 0.015 15), oklch(0.18 0.1 25));
48
+ --oui-red-1: light-dark(oklch(0.95 0.025 16), oklch(0.24 0.125 24));
49
+ --oui-red-2: light-dark(oklch(0.9 0.045 17), oklch(0.32 0.15 23));
50
+ --oui-red-3: light-dark(oklch(0.83 0.08 18), oklch(0.4 0.17 22));
51
+ --oui-red-4: light-dark(oklch(0.75 0.11 19), oklch(0.5 0.16 21));
52
+ --oui-red-5: light-dark(oklch(0.67 0.15 20), oklch(0.6 0.15 20));
53
+ --oui-red-6: light-dark(oklch(0.58 0.16 21), oklch(0.7 0.11 19));
54
+ --oui-red-7: light-dark(oklch(0.48 0.17 22), oklch(0.78 0.08 18));
55
+ --oui-red-8: light-dark(oklch(0.34 0.15 23), oklch(0.85 0.045 17));
56
+ --oui-red-9: light-dark(oklch(0.22 0.125 24), oklch(0.91 0.025 16));
57
+ --oui-red-10: light-dark(oklch(0.18 0.1 25), oklch(0.97 0.01 15));
58
+ --oui-yellow-0: light-dark(oklch(0.985 0.02 100), oklch(0.18 0.1 90));
59
+ --oui-yellow-1: light-dark(oklch(0.955 0.04 99), oklch(0.24 0.12 91));
60
+ --oui-yellow-2: light-dark(oklch(0.915 0.08 98), oklch(0.32 0.14 92));
61
+ --oui-yellow-3: light-dark(oklch(0.865 0.12 97), oklch(0.4 0.16 93));
62
+ --oui-yellow-4: light-dark(oklch(0.805 0.14 96), oklch(0.5 0.18 94));
63
+ --oui-yellow-5: light-dark(oklch(0.735 0.16 95), oklch(0.6 0.16 95));
64
+ --oui-yellow-6: light-dark(oklch(0.635 0.18 94), oklch(0.7 0.14 96));
65
+ --oui-yellow-7: light-dark(oklch(0.515 0.16 93), oklch(0.78 0.12 97));
66
+ --oui-yellow-8: light-dark(oklch(0.385 0.14 92), oklch(0.85 0.08 98));
67
+ --oui-yellow-9: light-dark(oklch(0.255 0.12 91), oklch(0.91 0.04 99));
68
+ --oui-yellow-10: light-dark(oklch(0.1875 0.1 90), oklch(0.97 0.02 100));
69
+ --oui-gray-0: light-dark(oklch(0.99 0 0), oklch(0.18 0 0));
70
+ --oui-gray-1: light-dark(oklch(0.97 0 0), oklch(0.24 0 0));
71
+ --oui-gray-2: light-dark(oklch(0.94 0 0), oklch(0.32 0 0));
72
+ --oui-gray-3: light-dark(oklch(0.88 0 0), oklch(0.4 0 0));
73
+ --oui-gray-4: light-dark(oklch(0.78 0 0), oklch(0.5 0 0));
74
+ --oui-gray-5: light-dark(oklch(0.67 0 0), oklch(0.6 0 0));
75
+ --oui-gray-6: light-dark(oklch(0.58 0 0), oklch(0.7 0 0));
76
+ --oui-gray-7: light-dark(oklch(0.48 0 0), oklch(0.78 0 0));
77
+ --oui-gray-8: light-dark(oklch(0.34 0 0), oklch(0.85 0 0));
78
+ --oui-gray-9: light-dark(oklch(0.22 0 0), oklch(0.91 0 0));
79
+ --oui-gray-10: light-dark(oklch(0.18 0 0), oklch(0.97 0 0));
80
+ --oui-slate-0: light-dark(oklch(0.99 0.0033 255), oklch(0.18 0.005 255));
81
+ --oui-slate-1: light-dark(oklch(0.97 0.0067 255), oklch(0.24 0.0075 255));
82
+ --oui-slate-2: light-dark(oklch(0.94 0.01 255), oklch(0.32 0.01 255));
83
+ --oui-slate-3: light-dark(oklch(0.88 0.0125 255), oklch(0.4 0.0125 255));
84
+ --oui-slate-4: light-dark(oklch(0.78 0.015 255), oklch(0.5 0.015 255));
85
+ --oui-slate-5: light-dark(oklch(0.67 0.02 255), oklch(0.6 0.02 255));
86
+ --oui-slate-6: light-dark(oklch(0.58 0.015 255), oklch(0.7 0.015 255));
87
+ --oui-slate-7: light-dark(oklch(0.48 0.0125 255), oklch(0.78 0.0125 255));
88
+ --oui-slate-8: light-dark(oklch(0.34 0.01 255), oklch(0.85 0.01 255));
89
+ --oui-slate-9: light-dark(oklch(0.22 0.0075 255), oklch(0.91 0.0075 255));
90
+ --oui-slate-10: light-dark(oklch(0.18 0.005 255), oklch(0.97 0.005 255));
91
+ --oui-stone-0: light-dark(oklch(0.99 0.0033 95), oklch(0.18 0.005 95));
92
+ --oui-stone-1: light-dark(oklch(0.97 0.0067 95), oklch(0.24 0.0075 95));
93
+ --oui-stone-2: light-dark(oklch(0.94 0.01 95), oklch(0.32 0.01 95));
94
+ --oui-stone-3: light-dark(oklch(0.88 0.0125 95), oklch(0.4 0.0125 95));
95
+ --oui-stone-4: light-dark(oklch(0.78 0.015 95), oklch(0.5 0.015 95));
96
+ --oui-stone-5: light-dark(oklch(0.67 0.02 95), oklch(0.6 0.02 95));
97
+ --oui-stone-6: light-dark(oklch(0.58 0.015 95), oklch(0.7 0.015 95));
98
+ --oui-stone-7: light-dark(oklch(0.48 0.0125 95), oklch(0.78 0.0125 95));
99
+ --oui-stone-8: light-dark(oklch(0.34 0.01 95), oklch(0.85 0.01 95));
100
+ --oui-stone-9: light-dark(oklch(0.22 0.0075 95), oklch(0.91 0.0075 95));
101
+ --oui-stone-10: light-dark(oklch(0.18 0.005 95), oklch(0.97 0.005 95));
102
+ }
package/dist/css/form.css CHANGED
@@ -1,7 +1,7 @@
1
1
  @charset "UTF-8";
2
2
  :where(.oui-fieldset) {
3
3
  padding: 1em;
4
- border: 1px solid var(--oui-grey-3);
4
+ border: 1px solid var(--oui-gray-3);
5
5
  border-radius: 0.25em;
6
6
  }
7
7
 
@@ -10,9 +10,9 @@
10
10
  outline: 3px solid transparent;
11
11
  outline-offset: 0;
12
12
  background-color: var(--oui-absolute);
13
- border-color: var(--oui-grey-3);
13
+ border-color: var(--oui-gray-3);
14
14
  border-radius: 0.25em;
15
- box-shadow: inset 0 1px 2px 0 color-mix(in srgb, var(--oui-grey-10), transparent 80%);
15
+ box-shadow: inset 0 1px 2px 0 color-mix(in oklab, var(--oui-gray-10), transparent 80%);
16
16
  transition: 0.125s ease-in-out;
17
17
  }
18
18
  :where(.oui-input:not(textarea)) {
@@ -32,30 +32,30 @@
32
32
  }
33
33
  :where(.oui-input.oui-validateable:not([disabled], [aria-disabled=true]):is(:user-invalid,
34
34
  [aria-invalid=true])) {
35
- outline-color: color-mix(in srgb, var(--oui-red-6), transparent 60%);
35
+ outline-color: color-mix(in oklab, var(--oui-red-6), transparent 60%);
36
36
  border-color: var(--oui-red-6);
37
37
  }
38
38
  :where(.oui-input.oui-validateable:not([disabled], [aria-disabled=true]):is(:user-valid,
39
39
  [aria-invalid=false])) {
40
- outline-color: color-mix(in srgb, var(--oui-green-6), transparent 60%);
40
+ outline-color: color-mix(in oklab, var(--oui-green-6), transparent 60%);
41
41
  border-color: var(--oui-green-6);
42
42
  }
43
43
  :where(.oui-input:not([disabled], [aria-disabled=true]):focus) {
44
- outline-color: color-mix(in srgb, var(--oui-blue-6), transparent 60%);
44
+ outline-color: color-mix(in oklab, var(--oui-blue-6), transparent 60%);
45
45
  border-color: var(--oui-blue-6);
46
46
  }
47
47
  @media (hover: hover) {
48
48
  :where(.oui-input:not([disabled], [aria-disabled=true]):hover) {
49
- outline-color: color-mix(in srgb, var(--oui-blue-6), transparent 80%);
49
+ outline-color: color-mix(in oklab, var(--oui-blue-6), transparent 80%);
50
50
  border-color: var(--oui-blue-6);
51
51
  }
52
52
  }
53
53
  :where(.oui-input[readonly]) {
54
- color: color-mix(in srgb, currentColor, transparent 12.5%);
54
+ color: color-mix(in oklab, currentColor, transparent 12.5%);
55
55
  }
56
56
  :where(.oui-input[disabled], .oui-input[aria-disabled=true]) {
57
- background-color: color-mix(in srgb, var(--oui-grey-0), transparent 50%);
58
- color: color-mix(in srgb, currentColor, transparent 25%);
57
+ background-color: color-mix(in oklab, var(--oui-gray-0), transparent 50%);
58
+ color: color-mix(in oklab, currentColor, transparent 25%);
59
59
  }
60
60
 
61
61
  :where(select.oui-input) {
@@ -80,7 +80,7 @@
80
80
 
81
81
  :where(.oui-legend) {
82
82
  padding: 0.5em;
83
- border: 1px solid var(--oui-grey-3);
83
+ border: 1px solid var(--oui-gray-3);
84
84
  border-radius: 0.25em;
85
85
  }
86
86
 
@@ -107,8 +107,8 @@
107
107
  width: 2.5em;
108
108
  height: 1.5em;
109
109
  display: inline-block;
110
- background-color: var(--oui-grey-0);
111
- border: 1px solid var(--oui-grey-3);
110
+ background-color: var(--oui-gray-0);
111
+ border: 1px solid var(--oui-gray-3);
112
112
  border-radius: 3em;
113
113
  right: 0;
114
114
  }
@@ -119,7 +119,7 @@
119
119
  background-color: var(--oui-absolute);
120
120
  border-radius: 1.5em;
121
121
  box-shadow: 0 1px 2px 1px rgba(0, 0, 0, 0.125);
122
- color: var(--oui-grey-8);
122
+ color: var(--oui-gray-8);
123
123
  font-size: 0.75em;
124
124
  font-weight: bold;
125
125
  line-height: 1.5em;
@@ -143,7 +143,7 @@
143
143
  height: 1.5em;
144
144
  display: inline-block;
145
145
  background-color: transparent;
146
- border: 1px solid var(--oui-grey-4);
146
+ border: 1px solid var(--oui-gray-4);
147
147
  inset: 0 auto auto 0;
148
148
  }
149
149
  :where(.oui-toggle)::after {
@@ -189,7 +189,7 @@
189
189
  }
190
190
  :where(.oui-switch:has(input:not([disabled], [aria-disabled=true])):focus-within,
191
191
  .oui-toggle:has(input:not([disabled], [aria-disabled=true])):focus-within)::before {
192
- outline-color: color-mix(in srgb, var(--oui-blue-6), transparent 60%);
192
+ outline-color: color-mix(in oklab, var(--oui-blue-6), transparent 60%);
193
193
  border-color: var(--oui-absolute);
194
194
  }
195
195
  @media (hover: hover) {
@@ -199,12 +199,12 @@
199
199
  }
200
200
  :where(.oui-switch:has(input:not([disabled], [aria-disabled=true])):hover,
201
201
  .oui-toggle:has(input:not([disabled], [aria-disabled=true])):hover)::before {
202
- outline-color: color-mix(in srgb, var(--oui-blue-6), transparent 80%);
202
+ outline-color: color-mix(in oklab, var(--oui-blue-6), transparent 80%);
203
203
  border-color: var(--oui-blue-6);
204
204
  }
205
205
  :where(.oui-switch:has(input:not([disabled], [aria-disabled=true]):is(:checked)):hover,
206
206
  .oui-toggle:has(input:not([disabled], [aria-disabled=true]):is(:checked)):hover)::before {
207
- background-color: color-mix(in srgb, var(--oui-blue-6), transparent 40%);
207
+ background-color: color-mix(in oklab, var(--oui-blue-6), transparent 40%);
208
208
  }
209
209
  }
210
210
  :where(.oui-switch:has(input[disabled], input[aria-disabled=true]),
@@ -212,18 +212,21 @@
212
212
  cursor: default;
213
213
  }
214
214
  :where(.oui-switch:has(input[disabled], input[aria-disabled=true]),
215
- .oui-toggle:has(input[disabled], input[aria-disabled=true])), :where(.oui-switch:has(input[disabled], input[aria-disabled=true]),
215
+ .oui-toggle:has(input[disabled], input[aria-disabled=true])) {
216
+ color: color-mix(in oklab, currentColor, transparent 25%);
217
+ }
218
+ :where(.oui-switch:has(input[disabled], input[aria-disabled=true]),
216
219
  .oui-toggle:has(input[disabled], input[aria-disabled=true]))::after {
217
- color: color-mix(in srgb, currentColor, transparent 25%);
220
+ color: color-mix(in oklab, currentColor, transparent);
218
221
  }
219
222
  :where(.oui-switch:has(input[disabled], input[aria-disabled=true]),
220
223
  .oui-toggle:has(input[disabled], input[aria-disabled=true]))::before {
221
- background-color: color-mix(in srgb, var(--oui-grey-0), transparent 50%);
222
- border-color: var(--oui-grey-3);
224
+ background-color: color-mix(in oklab, var(--oui-gray-0), transparent 50%);
225
+ border-color: var(--oui-gray-3);
223
226
  }
224
227
  :where(.oui-switch:has(input[disabled], input[aria-disabled=true]),
225
228
  .oui-toggle:has(input[disabled], input[aria-disabled=true]))::after {
226
- box-shadow: 0 0 0 1px var(--oui-grey-3);
229
+ box-shadow: 0 0 0 1px var(--oui-gray-3);
227
230
  text-shadow: none;
228
231
  }
229
232
 
@@ -3,10 +3,10 @@
3
3
  display: inline-flex;
4
4
  flex-flow: column nowrap;
5
5
  gap: 1em;
6
- background-color: var(--background, var(--oui-grey-0, #eee));
7
- border: 1px solid var(--border, var(--oui-grey-2, #ccc));
6
+ background-color: var(--background, var(--oui-gray-0));
7
+ border: 1px solid var(--border, var(--oui-gray-2));
8
8
  border-radius: 0.5em;
9
- color: var(--foreground, var(--oui-grey-8, #333));
9
+ color: var(--foreground, var(--oui-gray-8));
10
10
  line-height: 1.25;
11
11
  }
12
12
  :where(.oui-message h2, .oui-message h3, .oui-message h4, .oui-message h5, .oui-message h6) {
@@ -16,7 +16,7 @@
16
16
  :where(.oui-message hr) {
17
17
  height: 1px;
18
18
  margin: 0 -1em;
19
- background-color: var(--border, var(--oui-grey-2));
19
+ background-color: var(--border, var(--oui-gray-2));
20
20
  border: none;
21
21
  }
22
22
  :where(.oui-message p) {
@@ -4,7 +4,7 @@
4
4
  :where(.oui-table-wrapper) {
5
5
  max-height: 32em;
6
6
  overflow: auto;
7
- border: 1px solid var(--oui-grey-3);
7
+ border: 1px solid var(--oui-gray-3);
8
8
  border-radius: 0.25em;
9
9
  position: relative;
10
10
  overscroll-behavior-y: none;
@@ -12,8 +12,8 @@
12
12
  :where(.oui-table caption) {
13
13
  height: 2rem;
14
14
  align-content: center;
15
- background-color: var(--oui-grey-1);
16
- border: solid var(--oui-grey-3);
15
+ background-color: var(--oui-gray-1);
16
+ border: solid var(--oui-gray-3);
17
17
  border-width: 0 0 1px 0;
18
18
  font-size: 0.875rem;
19
19
  text-align: left;
@@ -23,11 +23,11 @@
23
23
  z-index: 2;
24
24
  }
25
25
  :where(.oui-table tbody tr:nth-child(2n)) {
26
- background-color: var(--oui-blue-0);
26
+ background-color: color-mix(in oklab, var(--oui-blue-0), transparent 67%);
27
27
  }
28
28
  :where(.oui-table th, .oui-table tfoot td) {
29
- background-color: var(--oui-grey-1);
30
- border: solid var(--oui-grey-3);
29
+ background-color: var(--oui-gray-1);
30
+ border: solid var(--oui-gray-3);
31
31
  border-width: 0 1px 0 0;
32
32
  position: sticky;
33
33
  left: 0;
@@ -35,7 +35,7 @@
35
35
  }
36
36
  :where(.oui-table th, .oui-table tfoot td)::after {
37
37
  content: "";
38
- border-bottom: 1px solid var(--oui-grey-3);
38
+ border-bottom: 1px solid var(--oui-gray-3);
39
39
  position: absolute;
40
40
  }
41
41
  :where(.oui-table th, .oui-table td) {
@@ -54,7 +54,7 @@
54
54
  inset: 0 0 auto 0;
55
55
  }
56
56
  :where(.oui-table tbody td) {
57
- border: solid var(--oui-grey-3);
57
+ border: solid var(--oui-gray-3);
58
58
  border-width: 0 1px 1px 0;
59
59
  }
60
60
  :where(.oui-table tbody tr:last-child td) {
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ const number = require("@oscarpalmer/atoms/number");
6
+ const event = require("@oscarpalmer/toretto/event");
7
+ const find = require("@oscarpalmer/toretto/find");
8
+ const focusable = require("@oscarpalmer/toretto/focusable");
9
+ class FocusTrap {
10
+ constructor(element) {
11
+ __publicField(this, "active", true);
12
+ this.element = element;
13
+ element.setAttribute("aria-modal", "true");
14
+ element.setAttribute("tabindex", "-1");
15
+ }
16
+ activate() {
17
+ this.element.setAttribute("aria-modal", "true");
18
+ this.active = true;
19
+ }
20
+ destroy() {
21
+ this.active = false;
22
+ this.element = void 0;
23
+ }
24
+ inactivate() {
25
+ this.element.setAttribute("aria-modal", "false");
26
+ this.active = false;
27
+ inactive.add(this);
28
+ }
29
+ }
30
+ function addFocusTraps(nodes) {
31
+ const elements = [...nodes].filter(
32
+ (node) => node instanceof HTMLElement
33
+ );
34
+ const { length } = elements;
35
+ for (let index = 0; index < length; index += 1) {
36
+ const element = elements[index];
37
+ if (element.hasAttribute(selector)) {
38
+ focusTraps.set(element, new FocusTrap(element));
39
+ }
40
+ }
41
+ }
42
+ function onEscape(event2) {
43
+ var _a;
44
+ if (event2.key !== "Escape") {
45
+ return;
46
+ }
47
+ const element = find.findAncestor(
48
+ document.activeElement,
49
+ `[${selector}]`
50
+ );
51
+ (_a = focusTraps.get(element)) == null ? void 0 : _a.inactivate();
52
+ }
53
+ function onFocusOut() {
54
+ if (inactive.size === 0) {
55
+ return;
56
+ }
57
+ setTimeout(() => {
58
+ const element = find.findAncestor(
59
+ document.activeElement,
60
+ `[${selector}]`
61
+ );
62
+ if (!focusTraps.has(element)) {
63
+ for (const focusTrap of inactive) {
64
+ focusTrap.activate();
65
+ }
66
+ }
67
+ }, 0);
68
+ }
69
+ function onTab(event2) {
70
+ var _a;
71
+ if (event2.key !== "Tab") {
72
+ return;
73
+ }
74
+ const element = find.findAncestor(
75
+ event2.target,
76
+ `[${selector}]`
77
+ );
78
+ if (!(((_a = focusTraps.get(element)) == null ? void 0 : _a.active) ?? false)) {
79
+ return;
80
+ }
81
+ event2.preventDefault();
82
+ const elements = focusable.getFocusable(element);
83
+ const { length } = elements;
84
+ const index = elements.indexOf(event2.target);
85
+ if (index === -1 || length === 0) {
86
+ if (length === 0) {
87
+ element.focus();
88
+ } else {
89
+ elements[0].focus();
90
+ }
91
+ return;
92
+ }
93
+ const next = number.clamp(index + (event2.shiftKey ? -1 : 1), 0, length - 1, true);
94
+ if (next !== index) {
95
+ elements[next].focus();
96
+ }
97
+ }
98
+ function removeFocusTraps(nodes) {
99
+ var _a;
100
+ const elements = [...nodes].filter(
101
+ (node) => node instanceof HTMLElement
102
+ );
103
+ const { length } = elements;
104
+ for (let index = 0; index < length; index += 1) {
105
+ const element = elements[index];
106
+ (_a = focusTraps.get(element)) == null ? void 0 : _a.destroy();
107
+ focusTraps.delete(element);
108
+ }
109
+ }
110
+ const focusTraps = /* @__PURE__ */ new WeakMap();
111
+ const inactive = /* @__PURE__ */ new Set();
112
+ const observer = new MutationObserver((entries) => {
113
+ const { length } = entries;
114
+ for (let index = 0; index < length; index += 1) {
115
+ const entry = entries[index];
116
+ if (entry.type === "attributes" && entry.target instanceof HTMLElement) {
117
+ if (entry.target.hasAttribute(selector)) {
118
+ addFocusTraps([entry.target]);
119
+ } else {
120
+ removeFocusTraps([entry.target]);
121
+ }
122
+ } else if (entry.type === "childList") {
123
+ addFocusTraps(entry.addedNodes);
124
+ removeFocusTraps(entry.removedNodes);
125
+ }
126
+ }
127
+ });
128
+ const selector = "oui-focus-trap";
129
+ observer.observe(document, {
130
+ attributeFilter: [selector],
131
+ attributes: true,
132
+ childList: true,
133
+ subtree: true
134
+ });
135
+ setTimeout(() => {
136
+ addFocusTraps(document.querySelectorAll(`[${selector}]`));
137
+ event.on(document, "focusout", onFocusOut, {
138
+ capture: true
139
+ });
140
+ event.on(document, "keydown", onTab, {
141
+ capture: true,
142
+ passive: false
143
+ });
144
+ event.on(document, "keydown", onEscape, {
145
+ passive: false
146
+ });
147
+ }, 0);
@@ -0,0 +1,146 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ import { clamp } from "@oscarpalmer/atoms/number";
5
+ import { on } from "@oscarpalmer/toretto/event";
6
+ import { findAncestor } from "@oscarpalmer/toretto/find";
7
+ import { getFocusable } from "@oscarpalmer/toretto/focusable";
8
+ class FocusTrap {
9
+ constructor(element) {
10
+ __publicField(this, "active", true);
11
+ this.element = element;
12
+ element.setAttribute("aria-modal", "true");
13
+ element.setAttribute("tabindex", "-1");
14
+ }
15
+ activate() {
16
+ this.element.setAttribute("aria-modal", "true");
17
+ this.active = true;
18
+ }
19
+ destroy() {
20
+ this.active = false;
21
+ this.element = void 0;
22
+ }
23
+ inactivate() {
24
+ this.element.setAttribute("aria-modal", "false");
25
+ this.active = false;
26
+ inactive.add(this);
27
+ }
28
+ }
29
+ function addFocusTraps(nodes) {
30
+ const elements = [...nodes].filter(
31
+ (node) => node instanceof HTMLElement
32
+ );
33
+ const { length } = elements;
34
+ for (let index = 0; index < length; index += 1) {
35
+ const element = elements[index];
36
+ if (element.hasAttribute(selector)) {
37
+ focusTraps.set(element, new FocusTrap(element));
38
+ }
39
+ }
40
+ }
41
+ function onEscape(event) {
42
+ var _a;
43
+ if (event.key !== "Escape") {
44
+ return;
45
+ }
46
+ const element = findAncestor(
47
+ document.activeElement,
48
+ `[${selector}]`
49
+ );
50
+ (_a = focusTraps.get(element)) == null ? void 0 : _a.inactivate();
51
+ }
52
+ function onFocusOut() {
53
+ if (inactive.size === 0) {
54
+ return;
55
+ }
56
+ setTimeout(() => {
57
+ const element = findAncestor(
58
+ document.activeElement,
59
+ `[${selector}]`
60
+ );
61
+ if (!focusTraps.has(element)) {
62
+ for (const focusTrap of inactive) {
63
+ focusTrap.activate();
64
+ }
65
+ }
66
+ }, 0);
67
+ }
68
+ function onTab(event) {
69
+ var _a;
70
+ if (event.key !== "Tab") {
71
+ return;
72
+ }
73
+ const element = findAncestor(
74
+ event.target,
75
+ `[${selector}]`
76
+ );
77
+ if (!(((_a = focusTraps.get(element)) == null ? void 0 : _a.active) ?? false)) {
78
+ return;
79
+ }
80
+ event.preventDefault();
81
+ const elements = getFocusable(element);
82
+ const { length } = elements;
83
+ const index = elements.indexOf(event.target);
84
+ if (index === -1 || length === 0) {
85
+ if (length === 0) {
86
+ element.focus();
87
+ } else {
88
+ elements[0].focus();
89
+ }
90
+ return;
91
+ }
92
+ const next = clamp(index + (event.shiftKey ? -1 : 1), 0, length - 1, true);
93
+ if (next !== index) {
94
+ elements[next].focus();
95
+ }
96
+ }
97
+ function removeFocusTraps(nodes) {
98
+ var _a;
99
+ const elements = [...nodes].filter(
100
+ (node) => node instanceof HTMLElement
101
+ );
102
+ const { length } = elements;
103
+ for (let index = 0; index < length; index += 1) {
104
+ const element = elements[index];
105
+ (_a = focusTraps.get(element)) == null ? void 0 : _a.destroy();
106
+ focusTraps.delete(element);
107
+ }
108
+ }
109
+ const focusTraps = /* @__PURE__ */ new WeakMap();
110
+ const inactive = /* @__PURE__ */ new Set();
111
+ const observer = new MutationObserver((entries) => {
112
+ const { length } = entries;
113
+ for (let index = 0; index < length; index += 1) {
114
+ const entry = entries[index];
115
+ if (entry.type === "attributes" && entry.target instanceof HTMLElement) {
116
+ if (entry.target.hasAttribute(selector)) {
117
+ addFocusTraps([entry.target]);
118
+ } else {
119
+ removeFocusTraps([entry.target]);
120
+ }
121
+ } else if (entry.type === "childList") {
122
+ addFocusTraps(entry.addedNodes);
123
+ removeFocusTraps(entry.removedNodes);
124
+ }
125
+ }
126
+ });
127
+ const selector = "oui-focus-trap";
128
+ observer.observe(document, {
129
+ attributeFilter: [selector],
130
+ attributes: true,
131
+ childList: true,
132
+ subtree: true
133
+ });
134
+ setTimeout(() => {
135
+ addFocusTraps(document.querySelectorAll(`[${selector}]`));
136
+ on(document, "focusout", onFocusOut, {
137
+ capture: true
138
+ });
139
+ on(document, "keydown", onTab, {
140
+ capture: true,
141
+ passive: false
142
+ });
143
+ on(document, "keydown", onEscape, {
144
+ passive: false
145
+ });
146
+ }, 0);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ require("./focus-trap.cjs");
@@ -0,0 +1 @@
1
+ import "./focus-trap.js";