@orange-halo/components 2.1.0 → 3.0.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/custom-elements.json +968 -362
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +1 -2
- package/dist/base.js.map +1 -1
- package/dist/index.d.ts +4 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -4
- package/dist/index.js.map +1 -1
- package/dist/oh-accordion.d.ts +53 -8
- package/dist/oh-accordion.d.ts.map +1 -1
- package/dist/oh-accordion.js +99 -29
- package/dist/oh-accordion.js.map +1 -1
- package/dist/oh-alert.d.ts +26 -8
- package/dist/oh-alert.d.ts.map +1 -1
- package/dist/oh-alert.js +96 -36
- package/dist/oh-alert.js.map +1 -1
- package/dist/oh-badge.d.ts +32 -13
- package/dist/oh-badge.d.ts.map +1 -1
- package/dist/oh-badge.js +38 -19
- package/dist/oh-badge.js.map +1 -1
- package/dist/oh-breadcrumb.d.ts +39 -12
- package/dist/oh-breadcrumb.d.ts.map +1 -1
- package/dist/oh-breadcrumb.js +66 -25
- package/dist/oh-breadcrumb.js.map +1 -1
- package/dist/oh-button.d.ts +49 -23
- package/dist/oh-button.d.ts.map +1 -1
- package/dist/oh-button.figma.js +1 -3
- package/dist/oh-button.figma.js.map +1 -1
- package/dist/oh-button.js +133 -82
- package/dist/oh-button.js.map +1 -1
- package/dist/oh-card.d.ts +47 -19
- package/dist/oh-card.d.ts.map +1 -1
- package/dist/oh-card.js +143 -96
- package/dist/oh-card.js.map +1 -1
- package/dist/oh-checkbox-group.d.ts +56 -12
- package/dist/oh-checkbox-group.d.ts.map +1 -1
- package/dist/oh-checkbox-group.figma.js +4 -6
- package/dist/oh-checkbox-group.figma.js.map +1 -1
- package/dist/oh-checkbox-group.js +114 -49
- package/dist/oh-checkbox-group.js.map +1 -1
- package/dist/oh-checkbox.d.ts +54 -17
- package/dist/oh-checkbox.d.ts.map +1 -1
- package/dist/oh-checkbox.js +117 -60
- package/dist/oh-checkbox.js.map +1 -1
- package/dist/oh-cluster.d.ts +19 -14
- package/dist/oh-cluster.d.ts.map +1 -1
- package/dist/oh-cluster.js +19 -19
- package/dist/oh-cluster.js.map +1 -1
- package/dist/oh-container.d.ts +19 -16
- package/dist/oh-container.d.ts.map +1 -1
- package/dist/oh-container.js +21 -23
- package/dist/oh-container.js.map +1 -1
- package/dist/oh-drawer.d.ts +28 -11
- package/dist/oh-drawer.d.ts.map +1 -1
- package/dist/oh-drawer.js +52 -24
- package/dist/oh-drawer.js.map +1 -1
- package/dist/oh-footer.d.ts +37 -18
- package/dist/oh-footer.d.ts.map +1 -1
- package/dist/oh-footer.js +38 -19
- package/dist/oh-footer.js.map +1 -1
- package/dist/oh-grid.d.ts +27 -14
- package/dist/oh-grid.d.ts.map +1 -1
- package/dist/oh-grid.js +28 -21
- package/dist/oh-grid.js.map +1 -1
- package/dist/oh-icon.d.ts +21 -5
- package/dist/oh-icon.d.ts.map +1 -1
- package/dist/oh-icon.js +27 -9
- package/dist/oh-icon.js.map +1 -1
- package/dist/oh-input.d.ts +110 -21
- package/dist/oh-input.d.ts.map +1 -1
- package/dist/oh-input.figma.js +2 -2
- package/dist/oh-input.figma.js.map +1 -1
- package/dist/oh-input.js +227 -71
- package/dist/oh-input.js.map +1 -1
- package/dist/oh-link.d.ts +42 -19
- package/dist/oh-link.d.ts.map +1 -1
- package/dist/oh-link.js +83 -38
- package/dist/oh-link.js.map +1 -1
- package/dist/oh-modal.d.ts +35 -6
- package/dist/oh-modal.d.ts.map +1 -1
- package/dist/oh-modal.js +90 -39
- package/dist/oh-modal.js.map +1 -1
- package/dist/oh-navbar.d.ts +42 -19
- package/dist/oh-navbar.d.ts.map +1 -1
- package/dist/oh-navbar.js +44 -20
- package/dist/oh-navbar.js.map +1 -1
- package/dist/oh-progress.d.ts +26 -7
- package/dist/oh-progress.d.ts.map +1 -1
- package/dist/oh-progress.js +35 -14
- package/dist/oh-progress.js.map +1 -1
- package/dist/oh-radio-group.d.ts +55 -13
- package/dist/oh-radio-group.d.ts.map +1 -1
- package/dist/oh-radio-group.figma.js +2 -2
- package/dist/oh-radio-group.figma.js.map +1 -1
- package/dist/oh-radio-group.js +122 -51
- package/dist/oh-radio-group.js.map +1 -1
- package/dist/oh-radio.d.ts +55 -17
- package/dist/oh-radio.d.ts.map +1 -1
- package/dist/oh-radio.js +120 -61
- package/dist/oh-radio.js.map +1 -1
- package/dist/oh-select.d.ts +59 -16
- package/dist/oh-select.d.ts.map +1 -1
- package/dist/oh-select.js +141 -69
- package/dist/oh-select.js.map +1 -1
- package/dist/oh-skip-link.d.ts +33 -15
- package/dist/oh-skip-link.d.ts.map +1 -1
- package/dist/oh-skip-link.js +43 -32
- package/dist/oh-skip-link.js.map +1 -1
- package/dist/oh-stack.d.ts +17 -14
- package/dist/oh-stack.d.ts.map +1 -1
- package/dist/oh-stack.js +18 -20
- package/dist/oh-stack.js.map +1 -1
- package/dist/oh-tabs.d.ts +55 -30
- package/dist/oh-tabs.d.ts.map +1 -1
- package/dist/oh-tabs.js +100 -76
- package/dist/oh-tabs.js.map +1 -1
- package/dist/oh-textarea.d.ts +129 -0
- package/dist/oh-textarea.d.ts.map +1 -0
- package/dist/oh-textarea.js +401 -0
- package/dist/oh-textarea.js.map +1 -0
- package/dist/oh-toggle.d.ts +45 -12
- package/dist/oh-toggle.d.ts.map +1 -1
- package/dist/oh-toggle.js +84 -34
- package/dist/oh-toggle.js.map +1 -1
- package/dist/styles/typography.js +1 -1
- package/package.json +7 -7
- package/dist/oh-hero.d.ts +0 -33
- package/dist/oh-hero.d.ts.map +0 -1
- package/dist/oh-hero.js +0 -246
- package/dist/oh-hero.js.map +0 -1
package/dist/oh-alert.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* oh-alert
|
|
3
3
|
*
|
|
4
|
-
* A
|
|
5
|
-
* Subtle backgrounds only, supports rich content including links.
|
|
4
|
+
* A message box for feedback, optionally dismissible, that can hold links.
|
|
6
5
|
*
|
|
7
6
|
* DESIGN DECISIONS:
|
|
8
7
|
* ─────────────────
|
|
9
8
|
* 1. SUBTLE ONLY
|
|
10
|
-
* -
|
|
9
|
+
* - Background is the variant's color.feedback.*Subtle token; border and
|
|
10
|
+
* icon use color.feedback.*; text stays color.text.primary
|
|
11
11
|
* - Matches badge subtle variants
|
|
12
12
|
*
|
|
13
13
|
* 2. DISMISSIBLE
|
|
@@ -19,11 +19,9 @@
|
|
|
19
19
|
* - Default slot for flexible content
|
|
20
20
|
*
|
|
21
21
|
* 4. ACCESSIBLE
|
|
22
|
-
* - role="alert"
|
|
23
|
-
* - Close button has
|
|
24
|
-
* - Links within
|
|
25
|
-
*
|
|
26
|
-
* @element oh-alert
|
|
22
|
+
* - role="alert" only when live is set (alerts added after first render)
|
|
23
|
+
* - Close button has a visible text label
|
|
24
|
+
* - Links within take the variant's feedback colour
|
|
27
25
|
*/
|
|
28
26
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
29
27
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -34,6 +32,26 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
34
32
|
import { html, css, nothing } from "lit";
|
|
35
33
|
import { customElement, property } from "lit/decorators.js";
|
|
36
34
|
import { OhElement, baseStyles } from "./base.js";
|
|
35
|
+
/**
|
|
36
|
+
* A message box that tells the user about the result of an action or something that needs their attention.
|
|
37
|
+
*
|
|
38
|
+
* **Use it for** feedback on what just happened (saved, failed) or a notice about the page or account, near the content it's about. **Don't use it for** a short status label (use `oh-badge`); for a field's validation error (use the field's own error message); or for a message that must interrupt the user (use `oh-modal`).
|
|
39
|
+
*
|
|
40
|
+
* **Variants:** `info` (default), `success`, `warning`, `error`, each by its feedback role. Each has its own icon, so the meaning isn't carried by colour alone.
|
|
41
|
+
*
|
|
42
|
+
* **Behaviour:** with `dismissible`, a "Close" button follows the content; selecting it fires `oh-dismiss` and sets `hidden` on the alert. Content goes in the default slot and can include links.
|
|
43
|
+
*
|
|
44
|
+
* **Accessibility:** set `live` only for an alert added after the page has rendered (e.g. after submit); it adds `role="alert"` so screen readers announce it. Leave it off for alerts present on page load. Icons are `aria-hidden`; put the meaning in the text. Links show a solid outline in the current text colour on focus; the close button shows an underline.
|
|
45
|
+
*
|
|
46
|
+
* **Look:** set by tokens. Each variant uses `color.feedback.<variant>Subtle` for the background and `color.feedback.<variant>` for the border, icon and links; text is `color.text.primary`. `stroke.control` sets the border, `shape.container` the corners, `typography.body.*` the text, and `decoration.underlineThickness`, `underlineDash` and `underlinePeriod` the link underline. The close button uses `closeButton.backgroundHover`, `closeButton.shadowHover`, `elevation.offset.*`, `lift.*` and `shape.compact`.
|
|
47
|
+
*
|
|
48
|
+
* @element oh-alert
|
|
49
|
+
* @slot - The message. Can include links.
|
|
50
|
+
* @csspart alert - The alert box.
|
|
51
|
+
* @csspart content - The message wrapper.
|
|
52
|
+
* @csspart close - The close button (only when `dismissible`).
|
|
53
|
+
* @fires oh-dismiss - When the close button is selected, before the alert hides.
|
|
54
|
+
*/
|
|
37
55
|
let OhAlert = class OhAlert extends OhElement {
|
|
38
56
|
constructor() {
|
|
39
57
|
super(...arguments);
|
|
@@ -49,7 +67,7 @@ let OhAlert = class OhAlert extends OhElement {
|
|
|
49
67
|
baseStyles,
|
|
50
68
|
css `
|
|
51
69
|
/* ═══════════════════════════════════════════════════════════════
|
|
52
|
-
|
|
70
|
+
ALERT
|
|
53
71
|
Subtle • Dismissible • Rich Content
|
|
54
72
|
═══════════════════════════════════════════════════════════════ */
|
|
55
73
|
|
|
@@ -65,12 +83,12 @@ let OhAlert = class OhAlert extends OhElement {
|
|
|
65
83
|
display: flex;
|
|
66
84
|
align-items: flex-start;
|
|
67
85
|
gap: var(--oh-spacing-3);
|
|
68
|
-
|
|
86
|
+
|
|
69
87
|
/* Shape */
|
|
70
88
|
padding: var(--oh-spacing-4);
|
|
71
89
|
border-radius: var(--oh-shape-container);
|
|
72
|
-
|
|
73
|
-
/*
|
|
90
|
+
|
|
91
|
+
/* Border: stroke.control, like other components */
|
|
74
92
|
border: var(--oh-stroke-control) solid;
|
|
75
93
|
}
|
|
76
94
|
|
|
@@ -92,7 +110,7 @@ let OhAlert = class OhAlert extends OhElement {
|
|
|
92
110
|
.alert-content {
|
|
93
111
|
flex: 1;
|
|
94
112
|
min-width: 0;
|
|
95
|
-
|
|
113
|
+
|
|
96
114
|
/* Typography */
|
|
97
115
|
font-family: var(--oh-typography-body-font-family);
|
|
98
116
|
font-size: var(--oh-typography-body-base-font-size);
|
|
@@ -100,7 +118,7 @@ let OhAlert = class OhAlert extends OhElement {
|
|
|
100
118
|
}
|
|
101
119
|
|
|
102
120
|
/*
|
|
103
|
-
* Links within alert
|
|
121
|
+
* Links within alert: the link underline (decoration.underline*), which shrinks on hover
|
|
104
122
|
* Uses background-image approach which works with ::slotted()
|
|
105
123
|
*/
|
|
106
124
|
.alert-content ::slotted(a) {
|
|
@@ -142,38 +160,40 @@ let OhAlert = class OhAlert extends OhElement {
|
|
|
142
160
|
display: flex;
|
|
143
161
|
align-items: center;
|
|
144
162
|
gap: var(--oh-spacing-1);
|
|
145
|
-
|
|
163
|
+
|
|
146
164
|
padding: var(--oh-spacing-1) var(--oh-spacing-2);
|
|
147
165
|
margin: -0.25rem -0.5rem -0.25rem 0;
|
|
148
|
-
|
|
166
|
+
|
|
149
167
|
font-family: var(--oh-typography-body-font-family);
|
|
150
168
|
font-size: var(--oh-typography-body-base-font-size);
|
|
151
169
|
font-weight: var(--oh-typography-label-base-font-weight);
|
|
152
|
-
|
|
170
|
+
|
|
153
171
|
background: transparent;
|
|
154
172
|
border: none;
|
|
155
173
|
border-radius: var(--oh-shape-compact);
|
|
156
174
|
cursor: pointer;
|
|
157
|
-
|
|
175
|
+
|
|
158
176
|
/* Use primary text color for contrast */
|
|
159
177
|
color: var(--oh-color-text-primary);
|
|
160
|
-
|
|
161
|
-
/*
|
|
162
|
-
transition:
|
|
163
|
-
transform var(--oh-motion-snappy) var(--oh-motion-ease-
|
|
164
|
-
box-shadow var(--oh-motion-snappy) var(--oh-motion-ease-
|
|
178
|
+
|
|
179
|
+
/* Hover and press movement come from lift.* and elevation.offset.* */
|
|
180
|
+
transition:
|
|
181
|
+
transform var(--oh-motion-snappy) var(--oh-motion-ease-emphasized),
|
|
182
|
+
box-shadow var(--oh-motion-snappy) var(--oh-motion-ease-emphasized),
|
|
165
183
|
background-color var(--oh-motion-quick) ease;
|
|
166
184
|
}
|
|
167
185
|
|
|
168
186
|
.alert-close:hover {
|
|
169
187
|
background-color: var(--oh-close-button-background-hover);
|
|
170
188
|
transform: translate(var(--oh-lift-hover-md), var(--oh-lift-hover-md));
|
|
171
|
-
box-shadow: var(--oh-elevation-offset-lg) var(--oh-elevation-offset-lg)
|
|
189
|
+
box-shadow: var(--oh-elevation-offset-lg) var(--oh-elevation-offset-lg)
|
|
190
|
+
0 0 var(--oh-close-button-shadow-hover);
|
|
172
191
|
}
|
|
173
192
|
|
|
174
193
|
.alert-close:active {
|
|
175
194
|
transform: translate(var(--oh-lift-press-sm), var(--oh-lift-press-sm));
|
|
176
|
-
box-shadow: var(--oh-elevation-offset-xs) var(--oh-elevation-offset-xs)
|
|
195
|
+
box-shadow: var(--oh-elevation-offset-xs) var(--oh-elevation-offset-xs)
|
|
196
|
+
0 0 var(--oh-close-button-shadow-hover);
|
|
177
197
|
}
|
|
178
198
|
|
|
179
199
|
.alert-close:focus-visible {
|
|
@@ -270,27 +290,63 @@ let OhAlert = class OhAlert extends OhElement {
|
|
|
270
290
|
switch (this.variant) {
|
|
271
291
|
case "success":
|
|
272
292
|
return html `
|
|
273
|
-
<svg
|
|
274
|
-
|
|
293
|
+
<svg
|
|
294
|
+
class="alert-icon"
|
|
295
|
+
viewBox="0 0 20 20"
|
|
296
|
+
fill="currentColor"
|
|
297
|
+
aria-hidden="true"
|
|
298
|
+
>
|
|
299
|
+
<path
|
|
300
|
+
fill-rule="evenodd"
|
|
301
|
+
d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"
|
|
302
|
+
clip-rule="evenodd"
|
|
303
|
+
/>
|
|
275
304
|
</svg>
|
|
276
305
|
`;
|
|
277
306
|
case "error":
|
|
278
307
|
return html `
|
|
279
|
-
<svg
|
|
280
|
-
|
|
308
|
+
<svg
|
|
309
|
+
class="alert-icon"
|
|
310
|
+
viewBox="0 0 20 20"
|
|
311
|
+
fill="currentColor"
|
|
312
|
+
aria-hidden="true"
|
|
313
|
+
>
|
|
314
|
+
<path
|
|
315
|
+
fill-rule="evenodd"
|
|
316
|
+
d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z"
|
|
317
|
+
clip-rule="evenodd"
|
|
318
|
+
/>
|
|
281
319
|
</svg>
|
|
282
320
|
`;
|
|
283
321
|
case "warning":
|
|
284
322
|
return html `
|
|
285
|
-
<svg
|
|
286
|
-
|
|
323
|
+
<svg
|
|
324
|
+
class="alert-icon"
|
|
325
|
+
viewBox="0 0 20 20"
|
|
326
|
+
fill="currentColor"
|
|
327
|
+
aria-hidden="true"
|
|
328
|
+
>
|
|
329
|
+
<path
|
|
330
|
+
fill-rule="evenodd"
|
|
331
|
+
d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z"
|
|
332
|
+
clip-rule="evenodd"
|
|
333
|
+
/>
|
|
287
334
|
</svg>
|
|
288
335
|
`;
|
|
289
336
|
case "info":
|
|
290
337
|
default:
|
|
291
338
|
return html `
|
|
292
|
-
<svg
|
|
293
|
-
|
|
339
|
+
<svg
|
|
340
|
+
class="alert-icon"
|
|
341
|
+
viewBox="0 0 20 20"
|
|
342
|
+
fill="currentColor"
|
|
343
|
+
aria-hidden="true"
|
|
344
|
+
>
|
|
345
|
+
<path
|
|
346
|
+
fill-rule="evenodd"
|
|
347
|
+
d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z"
|
|
348
|
+
clip-rule="evenodd"
|
|
349
|
+
/>
|
|
294
350
|
</svg>
|
|
295
351
|
`;
|
|
296
352
|
}
|
|
@@ -303,11 +359,11 @@ let OhAlert = class OhAlert extends OhElement {
|
|
|
303
359
|
return html `
|
|
304
360
|
<div class=${classes} role=${this.live ? "alert" : nothing} part="alert">
|
|
305
361
|
${this._getIcon()}
|
|
306
|
-
|
|
362
|
+
|
|
307
363
|
<div class="alert-content" part="content">
|
|
308
364
|
<slot></slot>
|
|
309
365
|
</div>
|
|
310
|
-
|
|
366
|
+
|
|
311
367
|
${this.dismissible
|
|
312
368
|
? html `
|
|
313
369
|
<button
|
|
@@ -318,7 +374,11 @@ let OhAlert = class OhAlert extends OhElement {
|
|
|
318
374
|
>
|
|
319
375
|
<span>Close</span>
|
|
320
376
|
<svg viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
|
321
|
-
<path
|
|
377
|
+
<path
|
|
378
|
+
fill-rule="evenodd"
|
|
379
|
+
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
|
|
380
|
+
clip-rule="evenodd"
|
|
381
|
+
/>
|
|
322
382
|
</svg>
|
|
323
383
|
</button>
|
|
324
384
|
`
|
package/dist/oh-alert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oh-alert.js","sourceRoot":"","sources":["../src/oh-alert.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"oh-alert.js","sourceRoot":"","sources":["../src/oh-alert.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;;;;;;;AAEH,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAIlD;;;;;;;;;;;;;;;;;;;GAmBG;AAEI,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,SAAS;IAA/B;;QA8NL,YAAO,GAAiB,MAAM,CAAC;QAG/B,gBAAW,GAAG,KAAK,CAAC;QAEpB;;;WAGG;QAEH,SAAI,GAAG,KAAK,CAAC;IA6Gf,CAAC;aApViB,WAAM,GAAG;QACvB,UAAU;QACV,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuNF;KACF,AA1NqB,CA0NpB;IAeM,cAAc;QACpB,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACrB,CAAC;IAEO,QAAQ;QACd,QAAQ,IAAI,CAAC,OAAO,EAAE,CAAC;YACrB,KAAK,SAAS;gBACZ,OAAO,IAAI,CAAA;;;;;;;;;;;;;SAaV,CAAC;YACJ,KAAK,OAAO;gBACV,OAAO,IAAI,CAAA;;;;;;;;;;;;;SAaV,CAAC;YACJ,KAAK,SAAS;gBACZ,OAAO,IAAI,CAAA;;;;;;;;;;;;;SAaV,CAAC;YACJ,KAAK,MAAM,CAAC;YACZ;gBACE,OAAO,IAAI,CAAA;;;;;;;;;;;;;SAaV,CAAC;QACN,CAAC;IACH,CAAC;IAED,MAAM;QACJ,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC;YAC5B,KAAK,EAAE,IAAI;YACX,CAAC,UAAU,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI;SACjC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAA;mBACI,OAAO,SAAS,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO;UACtD,IAAI,CAAC,QAAQ,EAAE;;;;;;UAMf,IAAI,CAAC,WAAW;YAChB,CAAC,CAAC,IAAI,CAAA;;;;;yBAKS,IAAI,CAAC,cAAc;;;;;;;;;;;aAW/B;YACH,CAAC,CAAC,OAAO;;KAEd,CAAC;IACJ,CAAC;;AAtHD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;wCACX;AAG/B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CACvB;AAOpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;qCAC9B;AAxOF,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAqVnB"}
|
package/dist/oh-badge.d.ts
CHANGED
|
@@ -1,33 +1,52 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* oh-badge
|
|
3
3
|
*
|
|
4
|
-
* A
|
|
5
|
-
* Two
|
|
4
|
+
* A non-interactive label for a status or category.
|
|
5
|
+
* Two types per variant: subtle and filled.
|
|
6
6
|
*
|
|
7
7
|
* DESIGN DECISIONS:
|
|
8
8
|
* ─────────────────
|
|
9
|
-
* 1.
|
|
10
|
-
* - No
|
|
9
|
+
* 1. NON-INTERACTIVE
|
|
10
|
+
* - No shadow, no hover states, pointer-events off
|
|
11
11
|
* - Pure informational element
|
|
12
12
|
* - Not clickable
|
|
13
13
|
*
|
|
14
|
-
* 2. TWO
|
|
15
|
-
* - Subtle:
|
|
16
|
-
* - Filled:
|
|
14
|
+
* 2. TWO TYPES
|
|
15
|
+
* - Subtle: the variant's *Subtle background token, its role colour as text
|
|
16
|
+
* - Filled: the role colour as background, its color.text.on* token as text
|
|
17
17
|
*
|
|
18
18
|
* 3. ACCESSIBLE CONTRAST
|
|
19
|
-
* -
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* @element oh-badge
|
|
19
|
+
* - Every text/background pair is in contrast-pairs.json, so
|
|
20
|
+
* check:contrast checks it in every brand and mode
|
|
23
21
|
*/
|
|
24
22
|
import { OhElement } from "./base.js";
|
|
25
23
|
export type BadgeVariant = "success" | "error" | "warning" | "info" | "brand" | "accent";
|
|
26
|
-
export type
|
|
24
|
+
export type BadgeAppearance = "subtle" | "filled";
|
|
25
|
+
/**
|
|
26
|
+
* A short, non-interactive label that shows the status or category of the thing next to it.
|
|
27
|
+
*
|
|
28
|
+
* **Use it for** a status ("Delivered", "Pending"), a count or a tag next to the item it describes. **Don't use it for** anything the user can select (use `oh-button` or a link); or for a message with more than a word or two (use `oh-alert`).
|
|
29
|
+
*
|
|
30
|
+
* **Variants:** `brand` (default) and `accent` for categories; `success`, `warning`, `error` and `info` for status. **Appearance:** `subtle` (default), for most badges; `filled`, the stronger appearance, for the one status that matters most.
|
|
31
|
+
*
|
|
32
|
+
* **Parts:** the default slot holds the text; the `icon` slot an optional leading icon, sized to the text.
|
|
33
|
+
*
|
|
34
|
+
* **Behaviour:** none. It doesn't take focus or respond to the pointer.
|
|
35
|
+
*
|
|
36
|
+
* **Accessibility:** the badge is plain text to screen readers, so the text must make sense on its own (say "Pending", don't rely on the colour). Mark a decorative icon `aria-hidden`.
|
|
37
|
+
*
|
|
38
|
+
* **Look:** set by tokens. Subtle uses the variant's `color.feedback.<variant>Subtle`, `color.brand.primarySubtle` or `color.accent.subtle` background with the role colour as text; filled uses the role colour (`color.feedback.<variant>`, `color.brand.primary`, `color.accent.default`) as background with `color.text.on<Role>` as text. `shape.compact` sets the corners; `typography.body.*`, `typography.label.base.fontWeight` and `typography.control.letterSpacing` the text.
|
|
39
|
+
*
|
|
40
|
+
* @element oh-badge
|
|
41
|
+
* @slot - The badge text.
|
|
42
|
+
* @slot icon - Optional leading icon.
|
|
43
|
+
* @csspart badge - The badge.
|
|
44
|
+
*/
|
|
27
45
|
export declare class OhBadge extends OhElement {
|
|
28
46
|
static styles: import("lit").CSSResult[];
|
|
29
47
|
variant: BadgeVariant;
|
|
30
|
-
|
|
48
|
+
/** `subtle` (default) for most badges; `filled`, the stronger appearance, for the one status that matters most */
|
|
49
|
+
appearance: BadgeAppearance;
|
|
31
50
|
render(): import("lit").TemplateResult<1>;
|
|
32
51
|
}
|
|
33
52
|
declare global {
|
package/dist/oh-badge.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oh-badge.d.ts","sourceRoot":"","sources":["../src/oh-badge.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"oh-badge.d.ts","sourceRoot":"","sources":["../src/oh-badge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,OAAO,EAAE,SAAS,EAAc,MAAM,WAAW,CAAC;AAElD,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,OAAO,GACP,SAAS,GACT,MAAM,GACN,OAAO,GACP,QAAQ,CAAC;AACb,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAElD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBACa,OAAQ,SAAQ,SAAS;IACpC,OAAgB,MAAM,4BAgHpB;IAGF,OAAO,EAAE,YAAY,CAAW;IAEhC,kHAAkH;IAElH,UAAU,EAAE,eAAe,CAAY;IAEvC,MAAM;CAcP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,OAAO,CAAC;KACrB;CACF"}
|
package/dist/oh-badge.js
CHANGED
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* oh-badge
|
|
3
3
|
*
|
|
4
|
-
* A
|
|
5
|
-
* Two
|
|
4
|
+
* A non-interactive label for a status or category.
|
|
5
|
+
* Two types per variant: subtle and filled.
|
|
6
6
|
*
|
|
7
7
|
* DESIGN DECISIONS:
|
|
8
8
|
* ─────────────────
|
|
9
|
-
* 1.
|
|
10
|
-
* - No
|
|
9
|
+
* 1. NON-INTERACTIVE
|
|
10
|
+
* - No shadow, no hover states, pointer-events off
|
|
11
11
|
* - Pure informational element
|
|
12
12
|
* - Not clickable
|
|
13
13
|
*
|
|
14
|
-
* 2. TWO
|
|
15
|
-
* - Subtle:
|
|
16
|
-
* - Filled:
|
|
14
|
+
* 2. TWO TYPES
|
|
15
|
+
* - Subtle: the variant's *Subtle background token, its role colour as text
|
|
16
|
+
* - Filled: the role colour as background, its color.text.on* token as text
|
|
17
17
|
*
|
|
18
18
|
* 3. ACCESSIBLE CONTRAST
|
|
19
|
-
* -
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* @element oh-badge
|
|
19
|
+
* - Every text/background pair is in contrast-pairs.json, so
|
|
20
|
+
* check:contrast checks it in every brand and mode
|
|
23
21
|
*/
|
|
24
22
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
25
23
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -30,18 +28,39 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
30
28
|
import { html, css } from "lit";
|
|
31
29
|
import { customElement, property } from "lit/decorators.js";
|
|
32
30
|
import { OhElement, baseStyles } from "./base.js";
|
|
31
|
+
/**
|
|
32
|
+
* A short, non-interactive label that shows the status or category of the thing next to it.
|
|
33
|
+
*
|
|
34
|
+
* **Use it for** a status ("Delivered", "Pending"), a count or a tag next to the item it describes. **Don't use it for** anything the user can select (use `oh-button` or a link); or for a message with more than a word or two (use `oh-alert`).
|
|
35
|
+
*
|
|
36
|
+
* **Variants:** `brand` (default) and `accent` for categories; `success`, `warning`, `error` and `info` for status. **Appearance:** `subtle` (default), for most badges; `filled`, the stronger appearance, for the one status that matters most.
|
|
37
|
+
*
|
|
38
|
+
* **Parts:** the default slot holds the text; the `icon` slot an optional leading icon, sized to the text.
|
|
39
|
+
*
|
|
40
|
+
* **Behaviour:** none. It doesn't take focus or respond to the pointer.
|
|
41
|
+
*
|
|
42
|
+
* **Accessibility:** the badge is plain text to screen readers, so the text must make sense on its own (say "Pending", don't rely on the colour). Mark a decorative icon `aria-hidden`.
|
|
43
|
+
*
|
|
44
|
+
* **Look:** set by tokens. Subtle uses the variant's `color.feedback.<variant>Subtle`, `color.brand.primarySubtle` or `color.accent.subtle` background with the role colour as text; filled uses the role colour (`color.feedback.<variant>`, `color.brand.primary`, `color.accent.default`) as background with `color.text.on<Role>` as text. `shape.compact` sets the corners; `typography.body.*`, `typography.label.base.fontWeight` and `typography.control.letterSpacing` the text.
|
|
45
|
+
*
|
|
46
|
+
* @element oh-badge
|
|
47
|
+
* @slot - The badge text.
|
|
48
|
+
* @slot icon - Optional leading icon.
|
|
49
|
+
* @csspart badge - The badge.
|
|
50
|
+
*/
|
|
33
51
|
let OhBadge = class OhBadge extends OhElement {
|
|
34
52
|
constructor() {
|
|
35
53
|
super(...arguments);
|
|
36
54
|
this.variant = "brand";
|
|
37
|
-
|
|
55
|
+
/** `subtle` (default) for most badges; `filled`, the stronger appearance, for the one status that matters most */
|
|
56
|
+
this.appearance = "subtle";
|
|
38
57
|
}
|
|
39
58
|
static { this.styles = [
|
|
40
59
|
baseStyles,
|
|
41
60
|
css `
|
|
42
61
|
/* ═══════════════════════════════════════════════════════════════
|
|
43
|
-
|
|
44
|
-
|
|
62
|
+
BADGE
|
|
63
|
+
Non-interactive • Informational
|
|
45
64
|
═══════════════════════════════════════════════════════════════ */
|
|
46
65
|
|
|
47
66
|
:host {
|
|
@@ -52,18 +71,18 @@ let OhBadge = class OhBadge extends OhElement {
|
|
|
52
71
|
display: inline-flex;
|
|
53
72
|
align-items: center;
|
|
54
73
|
gap: var(--oh-spacing-1);
|
|
55
|
-
|
|
74
|
+
|
|
56
75
|
/* Typography */
|
|
57
76
|
font-family: var(--oh-typography-body-font-family);
|
|
58
77
|
font-size: var(--oh-typography-body-base-font-size);
|
|
59
78
|
font-weight: var(--oh-typography-label-base-font-weight);
|
|
60
79
|
line-height: var(--oh-typography-heading-h1-line-height);
|
|
61
80
|
letter-spacing: var(--oh-typography-control-letter-spacing);
|
|
62
|
-
|
|
81
|
+
|
|
63
82
|
/* Shape */
|
|
64
83
|
padding: var(--oh-spacing-1) var(--oh-spacing-2-5);
|
|
65
84
|
border-radius: var(--oh-shape-compact);
|
|
66
|
-
|
|
85
|
+
|
|
67
86
|
/* No interaction */
|
|
68
87
|
pointer-events: none;
|
|
69
88
|
user-select: none;
|
|
@@ -153,7 +172,7 @@ let OhBadge = class OhBadge extends OhElement {
|
|
|
153
172
|
const classes = this.classMap({
|
|
154
173
|
badge: true,
|
|
155
174
|
[`badge--${this.variant}`]: true,
|
|
156
|
-
[`badge--${this.
|
|
175
|
+
[`badge--${this.appearance}`]: true,
|
|
157
176
|
});
|
|
158
177
|
return html `
|
|
159
178
|
<span class=${classes} part="badge">
|
|
@@ -168,7 +187,7 @@ __decorate([
|
|
|
168
187
|
], OhBadge.prototype, "variant", void 0);
|
|
169
188
|
__decorate([
|
|
170
189
|
property({ type: String, reflect: true })
|
|
171
|
-
], OhBadge.prototype, "
|
|
190
|
+
], OhBadge.prototype, "appearance", void 0);
|
|
172
191
|
OhBadge = __decorate([
|
|
173
192
|
customElement("oh-badge")
|
|
174
193
|
], OhBadge);
|
package/dist/oh-badge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oh-badge.js","sourceRoot":"","sources":["../src/oh-badge.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"oh-badge.js","sourceRoot":"","sources":["../src/oh-badge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;AAEH,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAWlD;;;;;;;;;;;;;;;;;;;GAmBG;AAEI,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,SAAS;IAA/B;;QAoHL,YAAO,GAAiB,OAAO,CAAC;QAEhC,kHAAkH;QAElH,eAAU,GAAoB,QAAQ,CAAC;IAgBzC,CAAC;aAvIiB,WAAM,GAAG;QACvB,UAAU;QACV,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6GF;KACF,AAhHqB,CAgHpB;IASF,MAAM;QACJ,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC;YAC5B,KAAK,EAAE,IAAI;YACX,CAAC,UAAU,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI;YAChC,CAAC,UAAU,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,IAAI;SACpC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAA;oBACK,OAAO;;;;KAItB,CAAC;IACJ,CAAC;;AAnBD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;wCACV;AAIhC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CACH;AAxH5B,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAwInB"}
|
package/dist/oh-breadcrumb.d.ts
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* oh-breadcrumb
|
|
3
3
|
*
|
|
4
|
-
* Accessible breadcrumb navigation with responsive collapse.
|
|
5
|
-
*
|
|
6
4
|
* DESIGN DECISIONS:
|
|
7
5
|
* ─────────────────
|
|
8
6
|
* 1. SEMANTIC STRUCTURE
|
|
9
|
-
* - <nav
|
|
10
|
-
* -
|
|
11
|
-
* - aria-
|
|
7
|
+
* - <nav aria-label="Breadcrumb"> around an <ol>
|
|
8
|
+
* - aria-current="page" on the last item, which is not a link
|
|
9
|
+
* - Separators are aria-hidden
|
|
12
10
|
*
|
|
13
|
-
* 2.
|
|
14
|
-
* -
|
|
15
|
-
*
|
|
11
|
+
* 2. LINKS MIRROR oh-link INLINE
|
|
12
|
+
* - Same underline tokens and hover/focus behaviour, written locally
|
|
13
|
+
* so the trail is one component
|
|
16
14
|
*
|
|
17
15
|
* 3. RESPONSIVE
|
|
18
|
-
* -
|
|
19
|
-
* -
|
|
20
|
-
*
|
|
21
|
-
* @element oh-breadcrumb
|
|
16
|
+
* - Wide viewports: the full trail
|
|
17
|
+
* - Below `size.breakpoint.sm`: a single "Back to [parent]" link
|
|
22
18
|
*/
|
|
23
19
|
import { nothing } from "lit";
|
|
24
20
|
import { OhElement } from "./base.js";
|
|
@@ -26,6 +22,37 @@ export interface BreadcrumbItem {
|
|
|
26
22
|
label: string;
|
|
27
23
|
href?: string;
|
|
28
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* A breadcrumb trail showing where the current page sits in the site's hierarchy.
|
|
27
|
+
*
|
|
28
|
+
* **Use it for** pages two or more levels deep in a hierarchy. **Don't use it
|
|
29
|
+
* for** a site's main navigation (use `oh-navbar`) or for steps in a process.
|
|
30
|
+
*
|
|
31
|
+
* **Parts:** pass `items`, an array of `{ label, href }`, from the top level
|
|
32
|
+
* down. The last item is the current page and is shown as text, not a link.
|
|
33
|
+
*
|
|
34
|
+
* **Behaviour:** below the `size.breakpoint.sm` width the trail collapses to a
|
|
35
|
+
* single "Back to [parent]" link to the second-to-last item; with one item,
|
|
36
|
+
* nothing shows there. Link underlines retract on hover; keyboard focus
|
|
37
|
+
* (`:focus-visible`) shows a solid underline and a background tint.
|
|
38
|
+
* Transitions are cut short under `prefers-reduced-motion`. Renders nothing
|
|
39
|
+
* when `items` is empty.
|
|
40
|
+
*
|
|
41
|
+
* **Accessibility:** renders `<nav aria-label="Breadcrumb">` with an ordered
|
|
42
|
+
* list, `aria-current="page"` on the last item and `aria-hidden` separators.
|
|
43
|
+
* Use one breadcrumb per page.
|
|
44
|
+
*
|
|
45
|
+
* **Look:** set by tokens — `color.text.link` the links,
|
|
46
|
+
* `decoration.underlineThickness`, `decoration.underlineDash` and
|
|
47
|
+
* `decoration.underlinePeriod` their underline; `color.brand.primary` the
|
|
48
|
+
* focus underline and `color.surface.hover` the focus tint;
|
|
49
|
+
* `color.text.primary` and `typography.label.base.fontWeight` the current
|
|
50
|
+
* page; `color.text.secondary` the separators; `typography.body.*` the text;
|
|
51
|
+
* `spacing.*` the gaps; `motion.relaxed` and `motion.easeGentle` the
|
|
52
|
+
* transitions.
|
|
53
|
+
*
|
|
54
|
+
* @element oh-breadcrumb
|
|
55
|
+
*/
|
|
29
56
|
export declare class OhBreadcrumb extends OhElement {
|
|
30
57
|
static styles: import("lit").CSSResult[];
|
|
31
58
|
items: BreadcrumbItem[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oh-breadcrumb.d.ts","sourceRoot":"","sources":["../src/oh-breadcrumb.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"oh-breadcrumb.d.ts","sourceRoot":"","sources":["../src/oh-breadcrumb.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAa,OAAO,EAAE,MAAM,KAAK,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAc,MAAM,WAAW,CAAC;AAElD,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBACa,YAAa,SAAQ,SAAS;IACzC,OAAgB,MAAM,4BA2LpB;IAGF,KAAK,EAAE,cAAc,EAAE,CAAM;IAE7B,MAAM;CA8DP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,eAAe,EAAE,YAAY,CAAC;KAC/B;CACF"}
|