@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-navbar.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oh-navbar.d.ts","sourceRoot":"","sources":["../src/oh-navbar.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"oh-navbar.d.ts","sourceRoot":"","sources":["../src/oh-navbar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,SAAS,EAAc,MAAM,WAAW,CAAC;AAElD,OAAO,mBAAmB,CAAC;AAC3B,OAAO,iBAAiB,CAAC;AACzB,OAAO,gBAAgB,CAAC;AACxB,OAAO,gBAAgB,CAAC;AACxB,OAAO,cAAc,CAAC;AAEtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,qBACa,QAAS,SAAQ,SAAS;IACrC,OAAgB,MAAM,4BA2EpB;IAEF,yCAAyC;IAEzC,aAAa,SAAU;IAGvB,OAAO,CAAC,WAAW,CAAS;IAE5B,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,YAAY;IAIpB,MAAM;CA0CP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
|
package/dist/oh-navbar.js
CHANGED
|
@@ -1,30 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* oh-navbar
|
|
3
3
|
*
|
|
4
|
-
* A responsive navigation bar component with logo, links, and mobile drawer.
|
|
5
|
-
*
|
|
6
4
|
* DESIGN DECISIONS:
|
|
7
5
|
* ─────────────────
|
|
8
6
|
* 1. LAYOUT
|
|
9
|
-
* - Logo on the left
|
|
10
|
-
*
|
|
11
|
-
* -
|
|
12
|
-
*
|
|
13
|
-
* 2. STYLING
|
|
14
|
-
* - Surface base background
|
|
15
|
-
* - Chunky bottom border
|
|
16
|
-
* - Links use oh-link styling
|
|
17
|
-
*
|
|
18
|
-
* 3. RESPONSIVE
|
|
19
|
-
* - Desktop: horizontal links
|
|
20
|
-
* - Mobile (< 768px): hamburger + drawer
|
|
21
|
-
*
|
|
22
|
-
* @element oh-navbar
|
|
7
|
+
* - Logo on the left, links pushed to the right, inside an
|
|
8
|
+
* oh-container (size lg)
|
|
9
|
+
* - At and below `size.breakpoint.md` the links hide and a menu button
|
|
10
|
+
* opens an oh-drawer from the left
|
|
23
11
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
12
|
+
* 2. DRAWER LINKS ARE A SEPARATE SLOT
|
|
13
|
+
* - The drawer lives outside the bar, so links for it are passed again
|
|
14
|
+
* in the `mobile` slot
|
|
26
15
|
*
|
|
27
|
-
*
|
|
16
|
+
* 3. LOOK FROM TOKENS
|
|
17
|
+
* - `color.surface.base` background, a shadow in `focus.glowColor`,
|
|
18
|
+
* `stroke.divider` / `color.border.subtle` between drawer links
|
|
28
19
|
*/
|
|
29
20
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
30
21
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -40,6 +31,38 @@ import "./oh-cluster.js";
|
|
|
40
31
|
import "./oh-drawer.js";
|
|
41
32
|
import "./oh-button.js";
|
|
42
33
|
import "./oh-icon.js";
|
|
34
|
+
/**
|
|
35
|
+
* A site header bar with a logo and the site's main navigation links, which move into a drawer on narrow viewports.
|
|
36
|
+
*
|
|
37
|
+
* **Use it for** the main navigation at the top of every page. **Don't use
|
|
38
|
+
* it for** in-page sections (use `oh-tabs`) or a trail through the hierarchy
|
|
39
|
+
* (use `oh-breadcrumb`).
|
|
40
|
+
*
|
|
41
|
+
* **Parts:** the `logo` slot (a link to the home page), the default slot for
|
|
42
|
+
* the bar's links (`oh-link`), and the `mobile` slot for the same links in the
|
|
43
|
+
* drawer. `drawer-heading` names the drawer (defaults to "Menu").
|
|
44
|
+
*
|
|
45
|
+
* **Behaviour:** at and below the `size.breakpoint.md` width the links hide
|
|
46
|
+
* and an icon-only menu button ("Open navigation menu") opens an `oh-drawer`
|
|
47
|
+
* from the left, which traps focus and closes on Escape or its close button.
|
|
48
|
+
*
|
|
49
|
+
* **Accessibility:** the bar and the drawer each wrap their links in a
|
|
50
|
+
* `<nav>`; the drawer is a modal dialog. Give the logo link an accessible
|
|
51
|
+
* name (`alt` on its image, or text).
|
|
52
|
+
*
|
|
53
|
+
* **Look:** set by tokens — `color.surface.base` the background,
|
|
54
|
+
* `focus.glowColor` the shadow, `typography.body.*` the text, `spacing.*` the
|
|
55
|
+
* padding and gaps, `stroke.divider` and `color.border.subtle` the dividers
|
|
56
|
+
* between drawer links. `--oh-navbar-logo-height` sets the logo height.
|
|
57
|
+
*
|
|
58
|
+
* @element oh-navbar
|
|
59
|
+
*
|
|
60
|
+
* @slot logo - Slot for logo/brand element
|
|
61
|
+
* @slot - Default slot for navigation links
|
|
62
|
+
* @slot mobile - The navigation links again, shown in the drawer
|
|
63
|
+
*
|
|
64
|
+
* @cssprop --oh-navbar-logo-height - Height of the slotted logo link or image
|
|
65
|
+
*/
|
|
43
66
|
let OhNavbar = class OhNavbar extends OhElement {
|
|
44
67
|
constructor() {
|
|
45
68
|
super(...arguments);
|
|
@@ -103,7 +126,8 @@ let OhNavbar = class OhNavbar extends OhElement {
|
|
|
103
126
|
|
|
104
127
|
.drawer-nav ::slotted(oh-link) {
|
|
105
128
|
padding: var(--oh-spacing-3) 0;
|
|
106
|
-
border-bottom: var(--oh-stroke-divider) solid
|
|
129
|
+
border-bottom: var(--oh-stroke-divider) solid
|
|
130
|
+
var(--oh-color-border-subtle);
|
|
107
131
|
}
|
|
108
132
|
|
|
109
133
|
.drawer-nav ::slotted(oh-link:last-child) {
|
package/dist/oh-navbar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oh-navbar.js","sourceRoot":"","sources":["../src/oh-navbar.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"oh-navbar.js","sourceRoot":"","sources":["../src/oh-navbar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;;;;;AAEH,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KA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with aria-valuenow, aria-valuemin, aria-valuemax
|
|
11
11
|
* - aria-label for screen reader context
|
|
12
|
-
* -
|
|
12
|
+
* - The visible percentage is aria-hidden; screen readers get the value
|
|
13
|
+
* from the progressbar's aria-value* attributes
|
|
13
14
|
*
|
|
14
15
|
* 2. VISUAL + NUMERIC
|
|
15
16
|
* - Bar shows progress visually
|
|
16
17
|
* - Percentage text for precise feedback
|
|
17
18
|
* - Text can be hidden if needed
|
|
18
19
|
*
|
|
19
|
-
* 3.
|
|
20
|
-
* -
|
|
21
|
-
*
|
|
22
|
-
* -
|
|
23
|
-
*
|
|
24
|
-
*
|
|
20
|
+
* 3. LOOK FROM TOKENS
|
|
21
|
+
* - Track: color.surface.inset, stroke.control, shape.pill and
|
|
22
|
+
* progress.track.insetShadow; fill: the variant's role colour
|
|
23
|
+
* - Inverse uses progress.inverse.*, one fill for every variant, so the
|
|
24
|
+
* fill keeps 3:1 against the track (a pair in contrast-pairs.json)
|
|
25
|
+
* - Width change animates over motion.relaxed, off under reduced motion
|
|
25
26
|
*/
|
|
26
27
|
import { OhElement } from "./base.js";
|
|
27
28
|
export type ProgressVariant = "brand" | "success" | "info" | "warning" | "error";
|
|
28
29
|
export type ProgressSize = "sm" | "md" | "lg";
|
|
30
|
+
/**
|
|
31
|
+
* A bar that shows how much of a task is done, with an optional percentage and visible label.
|
|
32
|
+
*
|
|
33
|
+
* **Use it for** a task with a known end: an upload, a download, steps completed. **Don't use it for** a wait of unknown length (it has no indeterminate state); or for a measurement that isn't progress, like storage used against a quota (a meter).
|
|
34
|
+
*
|
|
35
|
+
* **Variants:** `brand` (default), and `success`, `info`, `warning`, `error` by their feedback role. **Sizes:** `sm`, `md` (default), `lg` set the track height and the value's text size. **`inverse`:** for use on a brand-coloured or dark background.
|
|
36
|
+
*
|
|
37
|
+
* **Behaviour:** `value` runs from 0 to `max` (default 100) and is clamped to that range; the bar and the percentage show `value / max`, rounded. `show-value` (on by default) shows the percentage; `show-label` shows `label` above the bar. The fill's width animates when the value changes, except under `prefers-reduced-motion`.
|
|
38
|
+
*
|
|
39
|
+
* **Accessibility:** the bar is a `progressbar` with `aria-valuenow`, `aria-valuemin`, `aria-valuemax` and `aria-label` from `label` (default "Progress"). Always set `label` to say what is progressing. The visible percentage is `aria-hidden`, since screen readers read the value from the progressbar.
|
|
40
|
+
*
|
|
41
|
+
* **Look:** set by tokens. The track uses `color.surface.inset`, a `stroke.control` border in `color.border.default`, `shape.pill` corners and an inset `elevation.offset.sm` shadow in `progress.track.insetShadow`. The fill is `color.brand.primary` or `color.feedback.<variant>`. Text uses `color.text.primary` and `typography.body.*`. Inverse uses `progress.inverse.trackBackground`, `progress.inverse.trackBorder`, `progress.inverse.fill` and `color.text.onBrand`. Motion uses `motion.relaxed` and `motion.easeGentle`.
|
|
42
|
+
*
|
|
43
|
+
* @element oh-progress
|
|
44
|
+
* @csspart track - The bar's track.
|
|
45
|
+
* @csspart fill - The filled part of the track.
|
|
46
|
+
* @csspart value - The percentage text.
|
|
47
|
+
*/
|
|
29
48
|
export declare class OhProgress extends OhElement {
|
|
30
49
|
static styles: import("lit").CSSResult[];
|
|
31
50
|
/** Current progress value (0-100 by default, or 0-max) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oh-progress.d.ts","sourceRoot":"","sources":["../src/oh-progress.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"oh-progress.d.ts","sourceRoot":"","sources":["../src/oh-progress.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,EAAE,SAAS,EAAc,MAAM,WAAW,CAAC;AAElD,MAAM,MAAM,eAAe,GACvB,OAAO,GACP,SAAS,GACT,MAAM,GACN,SAAS,GACT,OAAO,CAAC;AACZ,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9C;;;;;;;;;;;;;;;;;GAiBG;AACH,qBACa,UAAW,SAAQ,SAAS;IACvC,OAAgB,MAAM,4BAgKpB;IAEF,0DAA0D;IAE1D,KAAK,SAAK;IAEV,kCAAkC;IAElC,GAAG,SAAO;IAEV,+DAA+D;IAE/D,KAAK,SAAc;IAEnB,sDAAsD;IAEtD,SAAS,UAAS;IAElB,4CAA4C;IAE5C,SAAS,UAAQ;IAEjB,mBAAmB;IAEnB,IAAI,EAAE,YAAY,CAAQ;IAE1B,oBAAoB;IAEpB,OAAO,EAAE,eAAe,CAAW;IAEnC,0CAA0C;IAE1C,OAAO,UAAS;IAEhB,2CAA2C;IAC3C,OAAO,KAAK,UAAU,GAGrB;IAED,MAAM;CAwCP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
|
package/dist/oh-progress.js
CHANGED
|
@@ -9,19 +9,20 @@
|
|
|
9
9
|
* 1. FULLY ACCESSIBLE
|
|
10
10
|
* - role="progressbar" with aria-valuenow, aria-valuemin, aria-valuemax
|
|
11
11
|
* - aria-label for screen reader context
|
|
12
|
-
* -
|
|
12
|
+
* - The visible percentage is aria-hidden; screen readers get the value
|
|
13
|
+
* from the progressbar's aria-value* attributes
|
|
13
14
|
*
|
|
14
15
|
* 2. VISUAL + NUMERIC
|
|
15
16
|
* - Bar shows progress visually
|
|
16
17
|
* - Percentage text for precise feedback
|
|
17
18
|
* - Text can be hidden if needed
|
|
18
19
|
*
|
|
19
|
-
* 3.
|
|
20
|
-
* -
|
|
21
|
-
*
|
|
22
|
-
* -
|
|
23
|
-
*
|
|
24
|
-
*
|
|
20
|
+
* 3. LOOK FROM TOKENS
|
|
21
|
+
* - Track: color.surface.inset, stroke.control, shape.pill and
|
|
22
|
+
* progress.track.insetShadow; fill: the variant's role colour
|
|
23
|
+
* - Inverse uses progress.inverse.*, one fill for every variant, so the
|
|
24
|
+
* fill keeps 3:1 against the track (a pair in contrast-pairs.json)
|
|
25
|
+
* - Width change animates over motion.relaxed, off under reduced motion
|
|
25
26
|
*/
|
|
26
27
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
27
28
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -32,6 +33,24 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
32
33
|
import { html, css } from "lit";
|
|
33
34
|
import { customElement, property } from "lit/decorators.js";
|
|
34
35
|
import { OhElement, baseStyles } from "./base.js";
|
|
36
|
+
/**
|
|
37
|
+
* A bar that shows how much of a task is done, with an optional percentage and visible label.
|
|
38
|
+
*
|
|
39
|
+
* **Use it for** a task with a known end: an upload, a download, steps completed. **Don't use it for** a wait of unknown length (it has no indeterminate state); or for a measurement that isn't progress, like storage used against a quota (a meter).
|
|
40
|
+
*
|
|
41
|
+
* **Variants:** `brand` (default), and `success`, `info`, `warning`, `error` by their feedback role. **Sizes:** `sm`, `md` (default), `lg` set the track height and the value's text size. **`inverse`:** for use on a brand-coloured or dark background.
|
|
42
|
+
*
|
|
43
|
+
* **Behaviour:** `value` runs from 0 to `max` (default 100) and is clamped to that range; the bar and the percentage show `value / max`, rounded. `show-value` (on by default) shows the percentage; `show-label` shows `label` above the bar. The fill's width animates when the value changes, except under `prefers-reduced-motion`.
|
|
44
|
+
*
|
|
45
|
+
* **Accessibility:** the bar is a `progressbar` with `aria-valuenow`, `aria-valuemin`, `aria-valuemax` and `aria-label` from `label` (default "Progress"). Always set `label` to say what is progressing. The visible percentage is `aria-hidden`, since screen readers read the value from the progressbar.
|
|
46
|
+
*
|
|
47
|
+
* **Look:** set by tokens. The track uses `color.surface.inset`, a `stroke.control` border in `color.border.default`, `shape.pill` corners and an inset `elevation.offset.sm` shadow in `progress.track.insetShadow`. The fill is `color.brand.primary` or `color.feedback.<variant>`. Text uses `color.text.primary` and `typography.body.*`. Inverse uses `progress.inverse.trackBackground`, `progress.inverse.trackBorder`, `progress.inverse.fill` and `color.text.onBrand`. Motion uses `motion.relaxed` and `motion.easeGentle`.
|
|
48
|
+
*
|
|
49
|
+
* @element oh-progress
|
|
50
|
+
* @csspart track - The bar's track.
|
|
51
|
+
* @csspart fill - The filled part of the track.
|
|
52
|
+
* @csspart value - The percentage text.
|
|
53
|
+
*/
|
|
35
54
|
let OhProgress = class OhProgress extends OhElement {
|
|
36
55
|
constructor() {
|
|
37
56
|
super(...arguments);
|
|
@@ -56,8 +75,8 @@ let OhProgress = class OhProgress extends OhElement {
|
|
|
56
75
|
baseStyles,
|
|
57
76
|
css `
|
|
58
77
|
/* ═══════════════════════════════════════════════════════════════
|
|
59
|
-
|
|
60
|
-
Accessible • Visual + Numeric
|
|
78
|
+
PROGRESS BAR
|
|
79
|
+
Accessible • Visual + Numeric
|
|
61
80
|
═══════════════════════════════════════════════════════════════ */
|
|
62
81
|
|
|
63
82
|
:host {
|
|
@@ -82,7 +101,9 @@ let OhProgress = class OhProgress extends OhElement {
|
|
|
82
101
|
border: var(--oh-stroke-control) solid var(--oh-color-border-default);
|
|
83
102
|
border-radius: var(--oh-shape-pill);
|
|
84
103
|
overflow: hidden;
|
|
85
|
-
box-shadow: inset var(--oh-elevation-offset-sm)
|
|
104
|
+
box-shadow: inset var(--oh-elevation-offset-sm)
|
|
105
|
+
var(--oh-elevation-offset-sm) 0 0
|
|
106
|
+
var(--oh-progress-track-inset-shadow);
|
|
86
107
|
}
|
|
87
108
|
|
|
88
109
|
/* Size variants for track height */
|
|
@@ -193,9 +214,9 @@ let OhProgress = class OhProgress extends OhElement {
|
|
|
193
214
|
color: var(--oh-color-text-on-brand);
|
|
194
215
|
}
|
|
195
216
|
|
|
196
|
-
/* Inverse fill — one
|
|
197
|
-
keeps 3:1
|
|
198
|
-
(the
|
|
217
|
+
/* Inverse fill — one progress.inverse.fill for every variant, so the
|
|
218
|
+
bar keeps 3:1 contrast against the track on brand/accent backgrounds
|
|
219
|
+
(per-variant fills failed; the pair is in contrast-pairs.json). */
|
|
199
220
|
:host([inverse]) .progress__fill {
|
|
200
221
|
background-color: var(--oh-progress-inverse-fill);
|
|
201
222
|
}
|
|
@@ -231,7 +252,7 @@ let OhProgress = class OhProgress extends OhElement {
|
|
|
231
252
|
${this.showLabel
|
|
232
253
|
? html `<div class="progress__label">${this.label}</div>`
|
|
233
254
|
: null}
|
|
234
|
-
|
|
255
|
+
|
|
235
256
|
<div
|
|
236
257
|
class=${classes}
|
|
237
258
|
role="progressbar"
|
package/dist/oh-progress.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oh-progress.js","sourceRoot":"","sources":["../src/oh-progress.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"oh-progress.js","sourceRoot":"","sources":["../src/oh-progress.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;;;;;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;AAUlD;;;;;;;;;;;;;;;;;GAiBG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,SAAS;IAAlC;;QAmKL,0DAA0D;QAE1D,UAAK,GAAG,CAAC,CAAC;QAEV,kCAAkC;QAElC,QAAG,GAAG,GAAG,CAAC;QAEV,+DAA+D;QAE/D,UAAK,GAAG,UAAU,CAAC;QAEnB,sDAAsD;QAEtD,cAAS,GAAG,KAAK,CAAC;QAElB,4CAA4C;QAE5C,cAAS,GAAG,IAAI,CAAC;QAEjB,mBAAmB;QAEnB,SAAI,GAAiB,IAAI,CAAC;QAE1B,oBAAoB;QAEpB,YAAO,GAAoB,OAAO,CAAC;QAEnC,0CAA0C;QAE1C,YAAO,GAAG,KAAK,CAAC;IAgDlB,CAAC;aAhPiB,WAAM,GAAG;QACvB,UAAU;QACV,GAAG,CAAA;;;;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,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAChC;AAIV;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uCAChC;AAIV;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCACR;AAInB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;6CACnC;AAIlB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;6CACpC;AAIjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;wCAChB;AAI1B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CACP;AAInC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CAC3B;AAjML,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAiPtB"}
|
package/dist/oh-radio-group.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* oh-radio-group
|
|
3
3
|
*
|
|
4
|
-
* A radio group with
|
|
5
|
-
*
|
|
4
|
+
* A radio group with ARIA group semantics and group-level error handling.
|
|
5
|
+
* Use it for every set of radios: separate oh-radio elements can't form a
|
|
6
|
+
* group, because each native radio is in its own shadow root.
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* - role="radiogroup" with aria-labelledby
|
|
10
|
-
* -
|
|
11
|
-
* -
|
|
12
|
-
* -
|
|
13
|
-
* -
|
|
14
|
-
*
|
|
15
|
-
* @element oh-radio-group
|
|
8
|
+
* DESIGN DECISIONS:
|
|
9
|
+
* ─────────────────
|
|
10
|
+
* - role="radiogroup" with aria-labelledby, aria-required and aria-invalid
|
|
11
|
+
* - Native radios sharing one name in one shadow root, so the browser
|
|
12
|
+
* handles arrow-key navigation between options
|
|
13
|
+
* - One error for the group, after the label and before the options
|
|
14
|
+
* - Focus underlines the option's label (a solid indicator)
|
|
15
|
+
* - The drawn circles use the same tokens as oh-radio
|
|
16
16
|
*/
|
|
17
17
|
import { type PropertyValues } from "lit";
|
|
18
18
|
import { OhElement } from "./base.js";
|
|
@@ -20,6 +20,44 @@ export interface RadioOption {
|
|
|
20
20
|
label: string;
|
|
21
21
|
value: string;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* A set of radio buttons under one label, where exactly one can be chosen.
|
|
25
|
+
*
|
|
26
|
+
* **Use it for** one choice from a few options that should all be visible,
|
|
27
|
+
* such as a plan or a delivery speed. **Don't use it for** a long list (use
|
|
28
|
+
* `oh-select`), several choices (use `oh-checkbox-group`) or an on/off
|
|
29
|
+
* setting (use `oh-toggle` or `oh-checkbox`). Use it rather than separate
|
|
30
|
+
* `oh-radio` elements, which can't form a group.
|
|
31
|
+
*
|
|
32
|
+
* **Parts:** a `label` for the group and a list of `options`
|
|
33
|
+
* (`{ label, value }`). `value` is the chosen option's value. **States:**
|
|
34
|
+
* each option unchecked, checked, hover, active and focus; the group can be
|
|
35
|
+
* `required` and in error (set `error-text`).
|
|
36
|
+
*
|
|
37
|
+
* **Behaviour:** Tab moves into and out of the group; arrow keys move
|
|
38
|
+
* between options and choose them (the browser's native radio behaviour).
|
|
39
|
+
* Each change sets `value` and fires `oh-change`. The native radios sit in
|
|
40
|
+
* the shadow root, so they don't submit with a native form: read `value` or
|
|
41
|
+
* listen for `oh-change`. `required` sets `aria-required` and a marker on
|
|
42
|
+
* the label but doesn't validate; set the error yourself.
|
|
43
|
+
*
|
|
44
|
+
* **Accessibility:** `role="radiogroup"` labelled by `label`, so always set
|
|
45
|
+
* one. The error shows after the label and before the options, with an
|
|
46
|
+
* icon; the group gets `aria-invalid` and `aria-describedby`, and the error
|
|
47
|
+
* is announced (`role="alert"`) only when it appears after first render.
|
|
48
|
+
* Focus underlines the option's label.
|
|
49
|
+
*
|
|
50
|
+
* **Look:** set by tokens — the same as `oh-radio`: `stroke.control` in
|
|
51
|
+
* `color.border.emphasis` (border), `shape.pill` (circle),
|
|
52
|
+
* `elevation.offset.*` with `elevation.color.secondary` / `elevation.color.primary` (shadow),
|
|
53
|
+
* `lift.hoverSm` / `lift.pressSm` (movement on hover and press),
|
|
54
|
+
* `color.brand.primary` and `color.text.onBrand` (checked),
|
|
55
|
+
* `color.feedback.error` and `elevation.color.error` (error); `typography.control.*`
|
|
56
|
+
* for the group label and option labels.
|
|
57
|
+
*
|
|
58
|
+
* @element oh-radio-group
|
|
59
|
+
* @fires oh-change - An option was chosen. detail: { value }
|
|
60
|
+
*/
|
|
23
61
|
export declare class OhRadioGroup extends OhElement {
|
|
24
62
|
static styles: import("lit").CSSResult[];
|
|
25
63
|
label: string;
|
|
@@ -27,8 +65,11 @@ export declare class OhRadioGroup extends OhElement {
|
|
|
27
65
|
options: RadioOption[];
|
|
28
66
|
value: string;
|
|
29
67
|
required: boolean;
|
|
30
|
-
|
|
31
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Error shown with the control and linked to it. Setting it puts the
|
|
70
|
+
* control in its error state; clear it to leave that state.
|
|
71
|
+
*/
|
|
72
|
+
errorText: string;
|
|
32
73
|
private _labelId;
|
|
33
74
|
private _focusedValue;
|
|
34
75
|
private _handleChange;
|
|
@@ -40,6 +81,7 @@ export declare class OhRadioGroup extends OhElement {
|
|
|
40
81
|
* aria-describedby, so they aren't read out unprompted.
|
|
41
82
|
*/
|
|
42
83
|
private _announceError;
|
|
84
|
+
updated(changed: PropertyValues): void;
|
|
43
85
|
willUpdate(changed: PropertyValues): void;
|
|
44
86
|
render(): import("lit").TemplateResult<1>;
|
|
45
87
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oh-radio-group.d.ts","sourceRoot":"","sources":["../src/oh-radio-group.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAc,MAAM,WAAW,CAAC;AAElD,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,qBACa,YAAa,SAAQ,SAAS;IACzC,OAAgB,MAAM,
|
|
1
|
+
{"version":3,"file":"oh-radio-group.d.ts","sourceRoot":"","sources":["../src/oh-radio-group.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAc,MAAM,WAAW,CAAC;AAElD,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,qBACa,YAAa,SAAQ,SAAS;IACzC,OAAgB,MAAM,4BAqMpB;IAGF,KAAK,SAAM;IAGX,IAAI,SAAM;IAGV,OAAO,EAAE,WAAW,EAAE,CAAM;IAG5B,KAAK,SAAM;IAGX,QAAQ,UAAS;IAEjB;;;OAGG;IAEH,SAAS,SAAM;IAGf,OAAO,CAAC,QAAQ,CACiD;IAGjE,OAAO,CAAC,aAAa,CAAuB;IAE5C,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,WAAW;IAInB;;;;OAIG;IAEH,OAAO,CAAC,cAAc,CAAS;IAE/B,OAAO,CAAC,OAAO,EAAE,cAAc;IAM/B,UAAU,CAAC,OAAO,EAAE,cAAc;IAMlC,MAAM;CA0EP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,YAAY,CAAC;KAChC;CACF"}
|
|
@@ -8,13 +8,13 @@ figma.connect("https://www.figma.com/design/q9ZYrOj2w9DrTVmgQFU7bu/OHDS?node-id=
|
|
|
8
8
|
props: {
|
|
9
9
|
label: figma.string("Label"),
|
|
10
10
|
required: figma.boolean("Required"),
|
|
11
|
-
|
|
11
|
+
errorText: figma.string("Error Message"),
|
|
12
12
|
},
|
|
13
13
|
example: (props) => html `
|
|
14
14
|
<oh-radio-group
|
|
15
15
|
label="${props.label}"
|
|
16
16
|
?required="${props.required}"
|
|
17
|
-
|
|
17
|
+
error-text="${props.errorText}"
|
|
18
18
|
.options="\${options}"
|
|
19
19
|
></oh-radio-group>
|
|
20
20
|
`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oh-radio-group.figma.js","sourceRoot":"","sources":["../src/oh-radio-group.figma.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEvD;;;;GAIG;AAEH,KAAK,CAAC,OAAO,CACX,wEAAwE,EACxE;IACE,KAAK,EAAE;QACL,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;QAC5B,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC;QACnC,
|
|
1
|
+
{"version":3,"file":"oh-radio-group.figma.js","sourceRoot":"","sources":["../src/oh-radio-group.figma.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEvD;;;;GAIG;AAEH,KAAK,CAAC,OAAO,CACX,wEAAwE,EACxE;IACE,KAAK,EAAE;QACL,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;QAC5B,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC;QACnC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC;KACzC;IACD,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAA;;iBAEX,KAAK,CAAC,KAAK;qBACP,KAAK,CAAC,QAAQ;sBACb,KAAK,CAAC,SAAS;;;KAGhC;CACF,CACF,CAAC"}
|