@oscarpalmer/oui 0.17.0 → 0.18.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.
Files changed (58) hide show
  1. package/dist/css/badge.css +3 -3
  2. package/dist/css/content.css +9 -11
  3. package/dist/css/form.css +36 -22
  4. package/dist/css/message.css +4 -0
  5. package/dist/css/reset.css +176 -56
  6. package/dist/css/tooltip.css +8 -0
  7. package/dist/js/attributable.full.js +48 -0
  8. package/dist/js/attributable.js +30 -45
  9. package/dist/js/floatable.full.js +413 -0
  10. package/dist/js/floatable.js +254 -169
  11. package/dist/js/focus-trap/embedded.full.js +351 -0
  12. package/dist/js/focus-trap/embedded.js +131 -131
  13. package/dist/js/focus-trap/standalone.full.js +402 -0
  14. package/dist/js/focus-trap/standalone.js +4 -4
  15. package/dist/js/index.js +4 -5
  16. package/dist/js/oui.full.js +1596 -0
  17. package/dist/js/popover.full.js +822 -0
  18. package/dist/js/popover.js +83 -162
  19. package/dist/js/splitter.full.js +605 -0
  20. package/dist/js/splitter.js +263 -245
  21. package/dist/js/tooltip.full.js +679 -0
  22. package/dist/js/tooltip.js +159 -150
  23. package/package.json +31 -59
  24. package/src/css/content.scss +1 -2
  25. package/src/css/form.scss +12 -4
  26. package/src/css/message.scss +3 -0
  27. package/src/css/mixins.scss +7 -0
  28. package/src/css/reset.scss +180 -54
  29. package/src/css/tooltip.scss +8 -0
  30. package/src/js/floatable.ts +380 -133
  31. package/src/js/focus-trap/embedded.ts +149 -64
  32. package/src/js/focus-trap/standalone.ts +4 -4
  33. package/src/js/index.ts +1 -0
  34. package/src/js/popover.ts +50 -120
  35. package/src/js/splitter.ts +250 -103
  36. package/src/js/tooltip.ts +155 -68
  37. package/types/floatable.d.ts +17 -10
  38. package/types/focus-trap/embedded.d.ts +18 -5
  39. package/types/index.d.ts +1 -0
  40. package/types/popover.d.ts +2 -0
  41. package/types/splitter.d.ts +13 -1
  42. package/types/tooltip.d.ts +2 -1
  43. package/dist/js/attributable.cjs +0 -51
  44. package/dist/js/floatable.cjs +0 -176
  45. package/dist/js/focus-trap/embedded.cjs +0 -150
  46. package/dist/js/focus-trap/standalone.cjs +0 -8
  47. package/dist/js/index.cjs +0 -6
  48. package/dist/js/popover.cjs +0 -166
  49. package/dist/js/splitter.cjs +0 -272
  50. package/dist/js/tooltip.cjs +0 -166
  51. package/types/attributable.d.cts +0 -5
  52. package/types/floatable.d.cts +0 -20
  53. package/types/focus-trap/embedded.d.cts +0 -15
  54. package/types/focus-trap/standalone.d.cts +0 -3
  55. package/types/index.d.cts +0 -14
  56. package/types/popover.d.cts +0 -14
  57. package/types/splitter.d.cts +0 -10
  58. package/types/tooltip.d.cts +0 -3
@@ -12,9 +12,15 @@
12
12
  * - Andy Bell's "A (more) Modern CSS Reset" [AB]
13
13
  * https://andy-bell.co.uk/a-more-modern-css-reset/
14
14
  *
15
+ * - Chris Coyier's "The Coyier CSS Starter" [CC]
16
+ * https://frontendmasters.com/blog/the-coyier-css-starter/
17
+ *
15
18
  * - CSS Remedy [CR]
16
19
  * https://github.com/jensimmons/cssremedy
17
20
  *
21
+ * - Harry Roberts [HR]
22
+ * - https://github.com/csswizardry
23
+ *
18
24
  * - RESS [RS]
19
25
  * https://github.com/filipelinhares/ress
20
26
  *
@@ -45,8 +51,10 @@
45
51
  font-family: system-ui, sans-serif;
46
52
  font-size: 100%;
47
53
  line-height: 1.5;
48
- text-size-adjust: none; // Prevent text size inflation (e.g., after orientation change) [AB][RE][SE]
54
+ /** Prevent text size inflation (e.g., after orientation change) [AB][RE][SE] */
55
+ text-size-adjust: none;
49
56
  tab-size: 4;
57
+ word-break: break-word;
50
58
  }
51
59
 
52
60
  :where(body) {
@@ -63,47 +71,84 @@
63
71
  text-underline-offset: 0.125em;
64
72
  }
65
73
 
74
+ :where(abbr[title], dfn[title]) {
75
+ cursor: help;
76
+ }
77
+
66
78
  :where(abbr[title]) {
67
- text-decoration: underline; // Add the correct text decoration in Safari [RS][SE]
68
- text-decoration: underline dotted; // ditto
79
+ /** Add the correct text decoration in Safari [RS][SE] */
80
+ text-decoration: underline;
81
+ /** Ditto */
82
+ text-decoration: underline dotted;
69
83
  }
70
84
 
71
85
  :where(b, strong) {
72
- font-weight: bolder; // Add the correct font weight in Chrome, Edge, and Safari [RS][SE]
86
+ /** Add the correct font weight in Chrome, Edge, and Safari [RS][SE], without compounding [HR] */
87
+ font-weight: bold;
73
88
  }
74
89
 
75
90
  :where(button, h1, h2, h3, h4, h5, h6, input, label, legend) {
76
- line-height: 1.125; // Set shorter line heights on headings and interactive elements [AB]
77
- }
78
-
79
- :where(button, [type='button' i], [type='reset' i], [type='submit' i]) {
80
- appearance: button; // Correct the inability to style clickable types in iOS [RS][SE]
91
+ /** Set shorter line heights on headings and interactive elements [AB] */
92
+ line-height: 1.125;
93
+ }
94
+
95
+ :where(
96
+ button,
97
+ input[type='button' i],
98
+ input[type='checkbox' i],
99
+ input[type='file' i],
100
+ input[type='image' i],
101
+ input[type='radio' i],
102
+ input[type='reset' i],
103
+ input[type='submit' i],
104
+ summary
105
+ ) {
106
+ /** Correct the inability to style clickable types in iOS [HR][RS][SE] */
107
+ appearance: button;
108
+ /** Ditto */
81
109
  cursor: pointer;
82
110
  }
83
111
 
84
- :where(code, kbd, pre, samp) {
85
- font-family: monospace, monospace; // Specify the font family of code elements [RS][SE]
86
- font-size: 1em; // Correct the odd 'em' font sizing in all browsers [RS][SE]
112
+ :where(code, kbd, output, pre, samp) {
113
+ /** Specify the font family of code elements [HR][RS][SE] */
114
+ font-family: monospace, monospace;
115
+ /** Correct the odd 'em' font sizing in all browsers [HR][RS][SE] */
116
+ font-size: inherit;
87
117
  }
88
118
 
89
119
  :where(details > summary:first-of-type) {
90
- display: list-item; // Add the correct display in Safari [SE]
120
+ /** Add the correct display in Safari [SE] */
121
+ display: list-item;
91
122
  }
92
123
 
93
124
  :where(dl, ol, ul) :where(dl, ol, ul) {
94
- margin: 0; // Remove the margin on nested lists in Chrome, Edge, and Safari [SE]
125
+ /** Remove the margin on nested lists in Chrome, Edge, and Safari [SE] */
126
+ margin: 0;
95
127
  }
96
128
 
97
129
  :where(h1, h2, h3, h4, h5, h6) {
98
130
  text-wrap: balance;
99
131
  }
100
132
 
133
+ :where(h1) {
134
+ /** Consistent sizing across browsers [HR] */
135
+ font-size: 2em;
136
+ }
137
+
101
138
  :where(hr) {
102
- height: 0; // Add the correct box sizing in Firefox [CR][RS][SE]
103
- overflow: visible; // Show the overflow in Edge and IE [CR][RS]
139
+ /** Add the correct box sizing in Firefox [CR][RS][SE] */
140
+ height: 0;
141
+ /** Show the overflow in Edge and IE [CR][RS] */
142
+ overflow: visible;
104
143
  border-style: solid;
105
144
  border-width: 1px 0 0;
106
- color: inherit; // Correct the inheritance of border colour in Firefox [CR][RS][SE]
145
+ /** // Correct the inheritance of border colour in Firefox [CR][RS][SE] */
146
+ color: inherit;
147
+ }
148
+
149
+ :where(ins, u) {
150
+ /** Prevent link styling [HR] */
151
+ text-decoration: none;
107
152
  }
108
153
 
109
154
  :where(nav) :where(ol, ul),
@@ -113,22 +158,24 @@
113
158
  }
114
159
 
115
160
  :where(nav li)::before {
116
- content: '\200B'; // Prevent VoiceOver from ignoring list semantics in Safari [SE]
161
+ /** Prevent VoiceOver from ignoring list semantics in Safari [SE] */
162
+ content: '\200B';
117
163
  float: left;
118
164
  }
119
165
 
120
166
  :where(pre) {
121
- overflow: auto; // Prevent overflow of the container in all browsers [SE]
122
- white-space: pre-wrap; // Overflow by default is bad… [CR]
167
+ /** Prevent overflow of the container in all browsers [SE] */
168
+ overflow: auto;
169
+ /** Overflow by default is bad… [CR] */
170
+ white-space: pre-wrap;
123
171
  }
124
172
 
125
- :where(small) {
173
+ :where(small, sub, sup) {
126
174
  font-size: 0.875rem;
127
175
  }
128
176
 
129
177
  :where(sub, sup) {
130
178
  vertical-align: baseline;
131
- font-size: 0.75rem;
132
179
  line-height: 0;
133
180
  position: relative;
134
181
  }
@@ -143,8 +190,14 @@
143
190
 
144
191
  :where(table) {
145
192
  border-collapse: collapse;
146
- border-color: currentColor; // Correct table border colour in Chrome, Edge, and Safari [SE]
147
- text-indent: 0; // Remove text indentation from table contents in Chrome, Edge, and Safari [RS][SE]
193
+ /** Correct table border colour in Chrome, Edge, and Safari [SE] */
194
+ border-color: currentColor;
195
+ /** Modernized border spacing [HR] */
196
+ border-spacing: 0;
197
+ /** More legible numbers [HR] */
198
+ font-variant-numeric: tabular-nums;
199
+ /** Remove text indentation from table contents in Chrome, Edge, and Safari [RS][SE] */
200
+ text-indent: 0;
148
201
  }
149
202
 
150
203
  /**
@@ -152,75 +205,94 @@
152
205
  */
153
206
 
154
207
  :where(button, input, optgroup, select, textarea) {
155
- font: inherit; // Correct the font inheritance in Firefox, Edge, and Safari [RS][SE]
208
+ /** Correct the font inheritance in Firefox, Edge, and Safari [HR][RS][SE] */
209
+ font: inherit;
156
210
  }
157
211
 
158
212
  :where(button, input, select, textarea) {
159
- padding: 0.25em 0.5em; // Change the inconsistent appearance in all browsers [SE]
160
- background-color: transparent; // ditto
161
- border: 1px solid WindowFrame; // ditto
162
- color: inherit; // ditto
163
- letter-spacing: inherit; // ditto
213
+ /** Change the inconsistent appearance in all browsers [SE] */
214
+ padding: 0.25em 0.5em;
215
+ /** Ditto for all */
216
+ background-color: transparent;
217
+ border: 1px solid WindowFrame;
218
+ color: inherit;
219
+ letter-spacing: inherit;
164
220
  }
165
221
 
166
222
  :where(fieldset) {
167
- border: 1px solid darkgrey; // Change the inconsistent appearance in all browsers [SE]
223
+ /** Change the inconsistent appearance in all browsers [SE] */
224
+ border: 1px solid darkgrey;
168
225
  }
169
226
 
170
227
  :where(optgroup) {
171
- font-weight: bold; // Restore the font weight unset by previous rules [RS]
228
+ /** Restore the font weight unset by previous rules [RS] */
229
+ font-weight: bold;
172
230
  }
173
231
 
174
232
  :where(progress) {
175
- vertical-align: baseline; // Add the correct vertical alignment in Chrome, Edge, and Firefox [RS][SE]
233
+ /** Add the correct vertical alignment in Chrome, Edge, and Firefox [RS][SE] */
234
+ vertical-align: baseline;
176
235
  }
177
236
 
178
237
  :where(select, input[list]) {
179
- appearance: none; // Change the inconsistent appearance in all browsers [SE]
180
- padding-right: 1em; // ditto
238
+ /** Change the inconsistent appearance in all browsers [SE] */
239
+ appearance: none;
240
+ /** Ditto for all */
241
+ padding-right: 1em;
181
242
  background-image: 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");
182
- background-position: right center / 1em; // ditto
183
- background-repeat: no-repeat; // ditto
184
- border-radius: 0; // ditto
243
+ background-position: right center / 1em;
244
+ background-repeat: no-repeat;
245
+ border-radius: 0;
185
246
  }
186
247
 
187
248
  :where(select[multiple]) {
188
- background-image: none; // Don't show the arrow for multiple choice selects [SE]
249
+ /** Don't show the arrow for multiple choice selects [SE] */
250
+ background-image: none;
189
251
  }
190
252
 
191
253
  :where(textarea) {
192
- resize: vertical; // Change the resize direction in all browsers [RS][SE]
254
+ /** Change the resize direction in all browsers [RS][SE] */
255
+ resize: vertical;
193
256
  }
194
257
 
195
258
  :where([type='color' i], [type='range' i]) {
196
- padding: 0; // Remove the padding in all browsers [SE]
197
- border-width: 0; // Remove the border in all browsers [SE]
259
+ /** Remove the padding in all browsers [SE] */
260
+ padding: 0;
261
+ /** Remove the border in all browsers [SE] */
262
+ border-width: 0;
198
263
  }
199
264
 
200
265
  :where([type='search' i]) {
201
- appearance: textfield; // Correct the odd appearance in Chrome, Edge, and Safari [RS][SE]
202
- outline-offset: -2px; // Correct the outline style in Safari [RS][SE]
266
+ /** Correct the odd appearance in Chrome, Edge, and Safari [RS][SE] */
267
+ appearance: textfield;
268
+ /** Correct the outline style in Safari [RS][SE] */
269
+ outline-offset: -2px;
203
270
  }
204
271
 
205
272
  ::file-selector-button {
206
- appearance: button; // Correct the inability to style upload buttons in iOS and Safari [RS][SE]
273
+ /** Correct the inability to style upload buttons in iOS and Safari [RS][SE] */
274
+ appearance: button;
207
275
  color: inherit;
208
276
  font: inherit;
209
277
  line-height: 1.25;
210
278
  }
211
279
 
212
280
  ::placeholder {
213
- opacity: 0.54; // Correct the text style of placeholders in Chrome, Edge, and Safari. [SE]
214
- color: inherit; // Correct the text style of placeholders in Chrome, Edge, and Safari. [SE]
281
+ /** Better default text opacity [OP] */
282
+ opacity: 0.67;
283
+ /** Better default text color [HR][SE] */
284
+ color: inherit;
215
285
  }
216
286
 
217
287
  ::-webkit-inner-spin-button,
218
288
  ::-webkit-outer-spin-button {
219
- height: auto; // Correct the cursor style of increment and decrement buttons in Safari [RS][SE]
289
+ /** Correct the cursor style of increment and decrement buttons in Safari [RS][SE] */
290
+ height: auto;
220
291
  }
221
292
 
222
293
  ::-webkit-search-decoration {
223
- -webkit-appearance: none; // Remove the inner padding in Chrome, Edge, and Safari on macOS [SE]
294
+ /** Remove the inner padding in Chrome, Edge, and Safari on macOS [SE] */
295
+ -webkit-appearance: none;
224
296
  }
225
297
 
226
298
  /**
@@ -228,7 +300,7 @@
228
300
  */
229
301
 
230
302
  :where(audio, canvas, embed, iframe, img, object, picture, svg, video) {
231
- max-width: 100%;
303
+ max-inline-size: 100%;
232
304
  vertical-align: middle;
233
305
  }
234
306
 
@@ -237,7 +309,8 @@
237
309
  }
238
310
 
239
311
  :where(audio) {
240
- width: 100%; // Better default width [CR]
312
+ /** Better default width [CR] */
313
+ width: 100%;
241
314
  }
242
315
 
243
316
  :where(audio:not([controls])) {
@@ -245,19 +318,31 @@
245
318
  }
246
319
 
247
320
  :where(canvas, img, svg, video) {
248
- height: auto; // Maintain aspect ratios [CR]
321
+ /** Proportional height based on width [HR] */
322
+ block-size: auto;
249
323
  }
250
324
 
251
325
  :where(iframe) {
252
326
  border-style: none;
253
327
  }
254
328
 
329
+ :where(img) {
330
+ /** CSS magic! [HR] */
331
+ background-repeat: no-repeat;
332
+ /** Ditto */
333
+ background-size: cover;
334
+ /** Offset alt-text if image does not load [HR] */
335
+ font-style: italic;
336
+ }
337
+
255
338
  :where(picture) {
256
- display: contents; // Remove the unnecessary wrapping 'picture', while maintaining contents [CR]
339
+ /** Remove the unnecessary wrapping 'picture', while maintaining contents [CR] */
340
+ display: contents;
257
341
  }
258
342
 
259
343
  :where(source) {
260
- display: none; // Source elements have nothing to display, so we hide them entirely [CR]
344
+ /** Source elements have nothing to display, so we hide them entirely [CR] */
345
+ display: none;
261
346
  }
262
347
 
263
348
  :where(svg:not([fill])) {
@@ -283,3 +368,44 @@
283
368
  :where([aria-controls]) {
284
369
  cursor: pointer;
285
370
  }
371
+
372
+ /**
373
+ * Pseudo-classes
374
+ */
375
+
376
+ :where(:target) {
377
+ scroll-margin: 2rlh;
378
+ }
379
+
380
+ /**
381
+ * Media queries
382
+ */
383
+
384
+ @media (prefers-reduced-motion: no-preference) {
385
+ :where(:root) {
386
+ /** Allow for animations on auto-sizes [CC] */
387
+ interpolate-size: allow-keywords;
388
+ }
389
+
390
+ :where(:root:focus-within) {
391
+ /** Allow for smooth scrolling to focused elements */
392
+ scroll-behavior: smooth;
393
+ }
394
+ }
395
+
396
+ @media (prefers-reduced-motion: reduce) {
397
+ :where(:root:focus-within) {
398
+ /** Disable smooth scrolling, when requested */
399
+ scroll-behavior: auto;
400
+ }
401
+
402
+ /** Disable animations and transitions, when requested */
403
+ :where(*),
404
+ ::after,
405
+ ::before {
406
+ animation-duration: 0.01ms !important;
407
+ animation-iteration-count: 1 !important;
408
+ transition-duration: 0.01ms !important;
409
+ scroll-behavior: auto !important;
410
+ }
411
+ }
@@ -12,7 +12,15 @@
12
12
 
13
13
  max-width: 48ch;
14
14
  padding: 0.75em 1em;
15
+ opacity: 0;
15
16
  background-color: var(--oui-absolute);
16
17
  border-radius: 0.25rem;
17
18
  font-size: 0.875rem;
19
+ transition: opacity .125s ease-in-out;
20
+ transition-delay: 0s;
21
+ }
22
+
23
+ :where([oui-tooltip-content][oui-tooltip-content-active]) {
24
+ opacity: 1;
25
+ transition-delay: .25s;
18
26
  }