@orange-halo/components 2.2.0 → 3.1.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 (140) hide show
  1. package/custom-elements.json +565 -328
  2. package/dist/base.d.ts.map +1 -1
  3. package/dist/base.js +7 -0
  4. package/dist/base.js.map +1 -1
  5. package/dist/index.d.ts +2 -7
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +0 -4
  8. package/dist/index.js.map +1 -1
  9. package/dist/oh-accordion.d.ts +53 -8
  10. package/dist/oh-accordion.d.ts.map +1 -1
  11. package/dist/oh-accordion.js +83 -21
  12. package/dist/oh-accordion.js.map +1 -1
  13. package/dist/oh-alert.d.ts +26 -8
  14. package/dist/oh-alert.d.ts.map +1 -1
  15. package/dist/oh-alert.js +32 -14
  16. package/dist/oh-alert.js.map +1 -1
  17. package/dist/oh-badge.d.ts +32 -13
  18. package/dist/oh-badge.d.ts.map +1 -1
  19. package/dist/oh-badge.js +35 -16
  20. package/dist/oh-badge.js.map +1 -1
  21. package/dist/oh-breadcrumb.d.ts +39 -12
  22. package/dist/oh-breadcrumb.d.ts.map +1 -1
  23. package/dist/oh-breadcrumb.js +43 -21
  24. package/dist/oh-breadcrumb.js.map +1 -1
  25. package/dist/oh-button.d.ts +50 -24
  26. package/dist/oh-button.d.ts.map +1 -1
  27. package/dist/oh-button.js +66 -47
  28. package/dist/oh-button.js.map +1 -1
  29. package/dist/oh-card.d.ts +47 -19
  30. package/dist/oh-card.d.ts.map +1 -1
  31. package/dist/oh-card.js +110 -82
  32. package/dist/oh-card.js.map +1 -1
  33. package/dist/oh-checkbox-group.d.ts +56 -12
  34. package/dist/oh-checkbox-group.d.ts.map +1 -1
  35. package/dist/oh-checkbox-group.js +87 -45
  36. package/dist/oh-checkbox-group.js.map +1 -1
  37. package/dist/oh-checkbox.d.ts +55 -18
  38. package/dist/oh-checkbox.d.ts.map +1 -1
  39. package/dist/oh-checkbox.js +91 -59
  40. package/dist/oh-checkbox.js.map +1 -1
  41. package/dist/oh-cluster.d.ts +19 -14
  42. package/dist/oh-cluster.d.ts.map +1 -1
  43. package/dist/oh-cluster.js +19 -19
  44. package/dist/oh-cluster.js.map +1 -1
  45. package/dist/oh-container.d.ts +19 -16
  46. package/dist/oh-container.d.ts.map +1 -1
  47. package/dist/oh-container.js +26 -33
  48. package/dist/oh-container.js.map +1 -1
  49. package/dist/oh-drawer.d.ts +36 -14
  50. package/dist/oh-drawer.d.ts.map +1 -1
  51. package/dist/oh-drawer.js +57 -26
  52. package/dist/oh-drawer.js.map +1 -1
  53. package/dist/oh-footer.d.ts +37 -18
  54. package/dist/oh-footer.d.ts.map +1 -1
  55. package/dist/oh-footer.js +38 -19
  56. package/dist/oh-footer.js.map +1 -1
  57. package/dist/oh-grid.d.ts +27 -14
  58. package/dist/oh-grid.d.ts.map +1 -1
  59. package/dist/oh-grid.js +27 -19
  60. package/dist/oh-grid.js.map +1 -1
  61. package/dist/oh-icon.d.ts +21 -5
  62. package/dist/oh-icon.d.ts.map +1 -1
  63. package/dist/oh-icon.js +28 -5
  64. package/dist/oh-icon.js.map +1 -1
  65. package/dist/oh-input.d.ts +105 -21
  66. package/dist/oh-input.d.ts.map +1 -1
  67. package/dist/oh-input.js +207 -68
  68. package/dist/oh-input.js.map +1 -1
  69. package/dist/oh-link.d.ts +42 -19
  70. package/dist/oh-link.d.ts.map +1 -1
  71. package/dist/oh-link.js +56 -34
  72. package/dist/oh-link.js.map +1 -1
  73. package/dist/oh-modal.d.ts +29 -6
  74. package/dist/oh-modal.d.ts.map +1 -1
  75. package/dist/oh-modal.js +37 -16
  76. package/dist/oh-modal.js.map +1 -1
  77. package/dist/oh-navbar.d.ts +42 -19
  78. package/dist/oh-navbar.d.ts.map +1 -1
  79. package/dist/oh-navbar.js +44 -21
  80. package/dist/oh-navbar.js.map +1 -1
  81. package/dist/oh-progress.d.ts +26 -7
  82. package/dist/oh-progress.d.ts.map +1 -1
  83. package/dist/oh-progress.js +32 -13
  84. package/dist/oh-progress.js.map +1 -1
  85. package/dist/oh-radio-group.d.ts +55 -13
  86. package/dist/oh-radio-group.d.ts.map +1 -1
  87. package/dist/oh-radio-group.js +84 -44
  88. package/dist/oh-radio-group.js.map +1 -1
  89. package/dist/oh-radio.d.ts +56 -18
  90. package/dist/oh-radio.d.ts.map +1 -1
  91. package/dist/oh-radio.js +93 -60
  92. package/dist/oh-radio.js.map +1 -1
  93. package/dist/oh-select.d.ts +58 -16
  94. package/dist/oh-select.d.ts.map +1 -1
  95. package/dist/oh-select.js +72 -36
  96. package/dist/oh-select.js.map +1 -1
  97. package/dist/oh-skip-link.d.ts +33 -15
  98. package/dist/oh-skip-link.d.ts.map +1 -1
  99. package/dist/oh-skip-link.js +39 -26
  100. package/dist/oh-skip-link.js.map +1 -1
  101. package/dist/oh-stack.d.ts +17 -14
  102. package/dist/oh-stack.d.ts.map +1 -1
  103. package/dist/oh-stack.js +18 -20
  104. package/dist/oh-stack.js.map +1 -1
  105. package/dist/oh-tabs.d.ts +56 -30
  106. package/dist/oh-tabs.d.ts.map +1 -1
  107. package/dist/oh-tabs.js +89 -70
  108. package/dist/oh-tabs.js.map +1 -1
  109. package/dist/oh-textarea.d.ts +37 -6
  110. package/dist/oh-textarea.d.ts.map +1 -1
  111. package/dist/oh-textarea.js +40 -9
  112. package/dist/oh-textarea.js.map +1 -1
  113. package/dist/oh-toggle.d.ts +45 -12
  114. package/dist/oh-toggle.d.ts.map +1 -1
  115. package/dist/oh-toggle.js +68 -33
  116. package/dist/oh-toggle.js.map +1 -1
  117. package/dist/styles/typography.d.ts.map +1 -1
  118. package/dist/styles/typography.js +1 -2
  119. package/dist/styles/typography.js.map +1 -1
  120. package/package.json +3 -7
  121. package/dist/oh-button.figma.d.ts +0 -2
  122. package/dist/oh-button.figma.d.ts.map +0 -1
  123. package/dist/oh-button.figma.js +0 -18
  124. package/dist/oh-button.figma.js.map +0 -1
  125. package/dist/oh-checkbox-group.figma.d.ts +0 -2
  126. package/dist/oh-checkbox-group.figma.d.ts.map +0 -1
  127. package/dist/oh-checkbox-group.figma.js +0 -24
  128. package/dist/oh-checkbox-group.figma.js.map +0 -1
  129. package/dist/oh-hero.d.ts +0 -33
  130. package/dist/oh-hero.d.ts.map +0 -1
  131. package/dist/oh-hero.js +0 -248
  132. package/dist/oh-hero.js.map +0 -1
  133. package/dist/oh-input.figma.d.ts +0 -2
  134. package/dist/oh-input.figma.d.ts.map +0 -1
  135. package/dist/oh-input.figma.js +0 -36
  136. package/dist/oh-input.figma.js.map +0 -1
  137. package/dist/oh-radio-group.figma.d.ts +0 -2
  138. package/dist/oh-radio-group.figma.d.ts.map +0 -1
  139. package/dist/oh-radio-group.figma.js +0 -22
  140. package/dist/oh-radio-group.figma.js.map +0 -1
@@ -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
- * - Percentage announced to screen readers
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. ORANGE HALO STYLING
20
- * - Chunky track with soft corners
21
- * - Warm fill colors
22
- * - Gentle animation on value change
23
- *
24
- * @element oh-progress
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
- ORANGE HALO PROGRESS BAR
60
- Accessible • Visual + Numeric • Warm styling
78
+ PROGRESS BAR
79
+ Accessible • Visual + Numeric
61
80
  ═══════════════════════════════════════════════════════════════ */
62
81
 
63
82
  :host {
@@ -141,7 +160,7 @@ let OhProgress = class OhProgress extends OhElement {
141
160
  font-weight: var(--oh-typography-label-base-font-weight);
142
161
  color: var(--oh-color-text-primary);
143
162
  min-width: 3.5ch;
144
- text-align: right;
163
+ text-align: end;
145
164
  font-variant-numeric: tabular-nums;
146
165
  }
147
166
 
@@ -195,9 +214,9 @@ let OhProgress = class OhProgress extends OhElement {
195
214
  color: var(--oh-color-text-on-brand);
196
215
  }
197
216
 
198
- /* Inverse fill — one solid cream fill for every variant, so the bar
199
- keeps 3:1+ contrast against the track on brand/accent backgrounds
200
- (the old honey/pastel fills were 1.6–1.9:1). */
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). */
201
220
  :host([inverse]) .progress__fill {
202
221
  background-color: var(--oh-progress-inverse-fill);
203
222
  }
@@ -1 +1 @@
1
- {"version":3,"file":"oh-progress.js","sourceRoot":"","sources":["../src/oh-progress.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;;;;;;;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;AAW3C,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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M,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"}
@@ -1,18 +1,18 @@
1
1
  /**
2
2
  * oh-radio-group
3
3
  *
4
- * A radio group with proper ARIA semantics and group-level error handling.
5
- * Individual radios cannot be used standalone.
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
- * ACCESSIBILITY:
8
- * ─────────────
9
- * - role="radiogroup" with aria-labelledby
10
- * - Arrow key navigation between options
11
- * - Group-level error messaging
12
- * - Visible focus ring (outline, not inset)
13
- * - aria-required and aria-invalid
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
- error: boolean;
31
- errorMessage: string;
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,4BAqMpB;IAGF,KAAK,SAAM;IAGX,IAAI,SAAM;IAGV,OAAO,EAAE,WAAW,EAAE,CAAM;IAG5B,KAAK,SAAM;IAGX,QAAQ,UAAS;IAGjB,KAAK,UAAS;IAGd,YAAY,SAAM;IAGlB,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,UAAU,CAAC,OAAO,EAAE,cAAc;IASlC,MAAM;CA4EP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,YAAY,CAAC;KAChC;CACF"}
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"}
@@ -1,18 +1,18 @@
1
1
  /**
2
2
  * oh-radio-group
3
3
  *
4
- * A radio group with proper ARIA semantics and group-level error handling.
5
- * Individual radios cannot be used standalone.
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
- * ACCESSIBILITY:
8
- * ─────────────
9
- * - role="radiogroup" with aria-labelledby
10
- * - Arrow key navigation between options
11
- * - Group-level error messaging
12
- * - Visible focus ring (outline, not inset)
13
- * - aria-required and aria-invalid
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
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
18
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -23,6 +23,44 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
23
23
  import { html, css, nothing } from "lit";
24
24
  import { customElement, property, state } from "lit/decorators.js";
25
25
  import { OhElement, baseStyles } from "./base.js";
26
+ /**
27
+ * A set of radio buttons under one label, where exactly one can be chosen.
28
+ *
29
+ * **Use it for** one choice from a few options that should all be visible,
30
+ * such as a plan or a delivery speed. **Don't use it for** a long list (use
31
+ * `oh-select`), several choices (use `oh-checkbox-group`) or an on/off
32
+ * setting (use `oh-toggle` or `oh-checkbox`). Use it rather than separate
33
+ * `oh-radio` elements, which can't form a group.
34
+ *
35
+ * **Parts:** a `label` for the group and a list of `options`
36
+ * (`{ label, value }`). `value` is the chosen option's value. **States:**
37
+ * each option unchecked, checked, hover, active and focus; the group can be
38
+ * `required` and in error (set `error-text`).
39
+ *
40
+ * **Behaviour:** Tab moves into and out of the group; arrow keys move
41
+ * between options and choose them (the browser's native radio behaviour).
42
+ * Each change sets `value` and fires `oh-change`. The native radios sit in
43
+ * the shadow root, so they don't submit with a native form: read `value` or
44
+ * listen for `oh-change`. `required` sets `aria-required` and a marker on
45
+ * the label but doesn't validate; set the error yourself.
46
+ *
47
+ * **Accessibility:** `role="radiogroup"` labelled by `label`, so always set
48
+ * one. The error shows after the label and before the options, with an
49
+ * icon; the group gets `aria-invalid` and `aria-describedby`, and the error
50
+ * is announced (`role="alert"`) only when it appears after first render.
51
+ * Focus underlines the option's label.
52
+ *
53
+ * **Look:** set by tokens — the same as `oh-radio`: `stroke.control` in
54
+ * `color.border.emphasis` (border), `shape.pill` (circle),
55
+ * `elevation.offset.*` with `elevation.color.secondary` / `elevation.color.primary` (shadow),
56
+ * `lift.hoverSm` / `lift.pressSm` (movement on hover and press),
57
+ * `color.brand.primary` and `color.text.onBrand` (checked),
58
+ * `color.feedback.error` and `elevation.color.error` (error); `typography.control.*`
59
+ * for the group label and option labels.
60
+ *
61
+ * @element oh-radio-group
62
+ * @fires oh-change - An option was chosen. detail: { value }
63
+ */
26
64
  let OhRadioGroup = class OhRadioGroup extends OhElement {
27
65
  constructor() {
28
66
  super(...arguments);
@@ -31,8 +69,11 @@ let OhRadioGroup = class OhRadioGroup extends OhElement {
31
69
  this.options = [];
32
70
  this.value = "";
33
71
  this.required = false;
34
- this.error = false;
35
- this.errorMessage = "";
72
+ /**
73
+ * Error shown with the control and linked to it. Setting it puts the
74
+ * control in its error state; clear it to leave that state.
75
+ */
76
+ this.errorText = "";
36
77
  this._labelId = `radio-group-label-${Math.random().toString(36).substr(2, 9)}`;
37
78
  this._focusedValue = null;
38
79
  /**
@@ -106,10 +147,10 @@ let OhRadioGroup = class OhRadioGroup extends OhElement {
106
147
  border-radius: var(--oh-shape-pill);
107
148
  background-color: var(--oh-color-surface-base);
108
149
  box-shadow: var(--oh-elevation-offset-md) var(--oh-elevation-offset-md)
109
- 0 0 var(--oh-shadow-secondary);
150
+ 0 0 var(--oh-elevation-color-secondary);
110
151
  transition:
111
- transform var(--oh-motion-snappy) var(--oh-motion-ease-playful),
112
- box-shadow var(--oh-motion-snappy) var(--oh-motion-ease-playful),
152
+ transform var(--oh-motion-snappy) var(--oh-motion-ease-emphasized),
153
+ box-shadow var(--oh-motion-snappy) var(--oh-motion-ease-emphasized),
113
154
  background-color var(--oh-motion-quick) ease,
114
155
  border-color var(--oh-motion-quick) ease;
115
156
  }
@@ -118,14 +159,14 @@ let OhRadioGroup = class OhRadioGroup extends OhElement {
118
159
  content: "";
119
160
  position: absolute;
120
161
  top: 50%;
121
- left: 50%;
162
+ left: 50%; /* physical: centres the dot */
122
163
  width: 10px;
123
164
  height: 10px;
124
165
  background-color: var(--oh-color-text-on-brand);
125
166
  border-radius: var(--oh-shape-pill);
126
167
  transform: translate(-50%, -50%) scale(0);
127
168
  transition: transform var(--oh-motion-snappy)
128
- var(--oh-motion-ease-playful);
169
+ var(--oh-motion-ease-emphasized);
129
170
  }
130
171
 
131
172
  .option-label {
@@ -140,27 +181,27 @@ let OhRadioGroup = class OhRadioGroup extends OhElement {
140
181
  STATES
141
182
  ═══════════════════════════════════════════════════════════════ */
142
183
 
143
- /* Hover: lift up-left, shadow grows */
184
+ /* Hover: moves by lift.hoverSm; shadow offset elevation.offset.lg */
144
185
  .radio-option:hover .radio-circle {
145
186
  border-color: var(--oh-color-border-hover);
146
187
  transform: translate(var(--oh-lift-hover-sm), var(--oh-lift-hover-sm));
147
188
  box-shadow: var(--oh-elevation-offset-lg) var(--oh-elevation-offset-lg)
148
- 0 0 var(--oh-shadow-secondary);
189
+ 0 0 var(--oh-elevation-color-secondary);
149
190
  }
150
191
 
151
- /* Active: press down-right, shadow shrinks */
192
+ /* Active: moves by lift.pressSm; shadow offset elevation.offset.xs */
152
193
  .radio-option:active .radio-circle {
153
194
  transform: translate(var(--oh-lift-press-sm), var(--oh-lift-press-sm));
154
195
  box-shadow: var(--oh-elevation-offset-xs) var(--oh-elevation-offset-xs)
155
- 0 0 var(--oh-shadow-secondary);
196
+ 0 0 var(--oh-elevation-color-secondary);
156
197
  }
157
198
 
158
- /* Checked: primary color with warm shadow */
199
+ /* Checked: color.brand.primary fill, elevation.color.primary shadow */
159
200
  .native-radio:checked + .radio-circle {
160
201
  background-color: var(--oh-color-brand-primary);
161
202
  border-color: var(--oh-color-brand-primary);
162
203
  box-shadow: var(--oh-elevation-offset-md) var(--oh-elevation-offset-md)
163
- 0 0 var(--oh-shadow-primary);
204
+ 0 0 var(--oh-elevation-color-primary);
164
205
  }
165
206
 
166
207
  .native-radio:checked + .radio-circle::after {
@@ -173,7 +214,7 @@ let OhRadioGroup = class OhRadioGroup extends OhElement {
173
214
  border-color: var(--oh-color-brand-primary-hover);
174
215
  transform: translate(var(--oh-lift-hover-sm), var(--oh-lift-hover-sm));
175
216
  box-shadow: var(--oh-elevation-offset-lg) var(--oh-elevation-offset-lg)
176
- 0 0 var(--oh-shadow-primary);
217
+ 0 0 var(--oh-elevation-color-primary);
177
218
  }
178
219
 
179
220
  /* Checked + Active */
@@ -181,7 +222,7 @@ let OhRadioGroup = class OhRadioGroup extends OhElement {
181
222
  background-color: var(--oh-color-brand-primary-active);
182
223
  transform: translate(var(--oh-lift-press-sm), var(--oh-lift-press-sm));
183
224
  box-shadow: var(--oh-elevation-offset-xs) var(--oh-elevation-offset-xs)
184
- 0 0 var(--oh-shadow-primary);
225
+ 0 0 var(--oh-elevation-color-primary);
185
226
  }
186
227
 
187
228
  /* Focus: underline the label (accessible indicator) */
@@ -200,16 +241,16 @@ let OhRadioGroup = class OhRadioGroup extends OhElement {
200
241
  ERROR STATE
201
242
  ═══════════════════════════════════════════════════════════════ */
202
243
 
203
- :host([error]) .radio-circle {
244
+ :host([data-invalid]) .radio-circle {
204
245
  border-color: var(--oh-color-feedback-error);
205
246
  box-shadow: var(--oh-elevation-offset-md) var(--oh-elevation-offset-md)
206
- 0 0 var(--oh-shadow-error);
247
+ 0 0 var(--oh-elevation-color-error);
207
248
  }
208
249
 
209
- :host([error]) .radio-option:hover .radio-circle {
250
+ :host([data-invalid]) .radio-option:hover .radio-circle {
210
251
  border-color: var(--oh-color-feedback-error-hover);
211
252
  box-shadow: var(--oh-elevation-offset-lg) var(--oh-elevation-offset-lg)
212
- 0 0 var(--oh-shadow-error);
253
+ 0 0 var(--oh-elevation-color-error);
213
254
  }
214
255
 
215
256
  .error-message {
@@ -251,10 +292,14 @@ let OhRadioGroup = class OhRadioGroup extends OhElement {
251
292
  _handleBlur() {
252
293
  this._focusedValue = null;
253
294
  }
295
+ updated(changed) {
296
+ // Styling hook for the error state (data-invalid on the host)
297
+ if (changed.has("errorText"))
298
+ this.toggleAttribute("data-invalid", !!this.errorText);
299
+ }
254
300
  willUpdate(changed) {
255
- if (this.hasUpdated &&
256
- (changed.has("error") || changed.has("errorMessage"))) {
257
- this._announceError = !!(this.error && this.errorMessage);
301
+ if (this.hasUpdated && changed.has("errorText")) {
302
+ this._announceError = !!this.errorText;
258
303
  }
259
304
  }
260
305
  render() {
@@ -272,7 +317,7 @@ let OhRadioGroup = class OhRadioGroup extends OhElement {
272
317
  </span>
273
318
  `
274
319
  : nothing}
275
- ${this.error && this.errorMessage
320
+ ${this.errorText
276
321
  ? html `
277
322
  <div
278
323
  id="error-msg"
@@ -291,7 +336,7 @@ let OhRadioGroup = class OhRadioGroup extends OhElement {
291
336
  clip-rule="evenodd"
292
337
  />
293
338
  </svg>
294
- ${this.errorMessage}
339
+ ${this.errorText}
295
340
  </div>
296
341
  `
297
342
  : nothing}
@@ -301,10 +346,8 @@ let OhRadioGroup = class OhRadioGroup extends OhElement {
301
346
  role="radiogroup"
302
347
  aria-labelledby=${this.label ? this._labelId : nothing}
303
348
  aria-required=${this.required ? "true" : nothing}
304
- aria-invalid=${this.error ? "true" : nothing}
305
- aria-describedby=${this.error && this.errorMessage
306
- ? "error-msg"
307
- : nothing}
349
+ aria-invalid=${this.errorText ? "true" : nothing}
350
+ aria-describedby=${this.errorText ? "error-msg" : nothing}
308
351
  >
309
352
  ${this.options.map((option) => html `
310
353
  <label class="radio-option">
@@ -348,11 +391,8 @@ __decorate([
348
391
  property({ type: Boolean, reflect: true })
349
392
  ], OhRadioGroup.prototype, "required", void 0);
350
393
  __decorate([
351
- property({ type: Boolean, reflect: true })
352
- ], OhRadioGroup.prototype, "error", void 0);
353
- __decorate([
354
- property({ type: String })
355
- ], OhRadioGroup.prototype, "errorMessage", void 0);
394
+ property({ type: String, attribute: "error-text" })
395
+ ], OhRadioGroup.prototype, "errorText", void 0);
356
396
  __decorate([
357
397
  state()
358
398
  ], OhRadioGroup.prototype, "_labelId", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"oh-radio-group.js","sourceRoot":"","sources":["../src/oh-radio-group.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;AAEH,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAuB,MAAM,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ADxB,aAAa,CAAC,gBAAgB,CAAC;GACnB,YAAY,CAiVxB"}
@@ -1,42 +1,79 @@
1
1
  /**
2
2
  * oh-radio
3
3
  *
4
- * A chunky, playful radio button with hand-crafted feel.
5
- * Matches the inset/pressed aesthetic of oh-input.
6
- *
7
4
  * DESIGN DECISIONS:
8
5
  * ─────────────────
9
- * 1. CHUNKY & TACTILE
10
- * - Thick border (stroke.control)
11
- * - Inset shadow when unchecked (pressed into page)
12
- * - Fully circular (radio = circle)
6
+ * 1. LOOK FROM TOKENS
7
+ * - Border: stroke.control in color.border.emphasis
8
+ * - Circular: shape.pill
9
+ * - Shadow: offset by elevation.offset.* in elevation.color.secondary; hover and
10
+ * press move the circle by lift.hoverSm / lift.pressSm
13
11
  *
14
12
  * 2. CHECKED STATE
15
- * - Filled dot in center
16
- * - Primary color ring
17
- * - Shadow shifts to feel "activated"
13
+ * - Filled with color.brand.primary, a centre dot in color.text.onBrand,
14
+ * and the shadow in elevation.color.primary
18
15
  *
19
16
  * 3. ACCESSIBILITY
20
- * - Native radio hidden but accessible
17
+ * - A native radio, visually hidden but focusable and announced
21
18
  * - Label always required
22
- * - Focus ring matches input
23
- * - Works in radio groups via name attribute
24
- *
25
- * @element oh-radio
19
+ * - Focus underlines the label (a solid indicator)
20
+ * - Two oh-radios with the same name don't form a group (each native
21
+ * radio is in its own shadow root): use oh-radio-group for a set
26
22
  */
27
23
  import { type PropertyValues } from "lit";
28
24
  import { OhElement } from "./base.js";
29
25
  export type RadioState = "default" | "hover" | "focus";
26
+ /**
27
+ * A single radio button with its label.
28
+ *
29
+ * **Use it for** a one-off radio you manage yourself. **For a set of
30
+ * choices, use `oh-radio-group`.** Each `oh-radio` keeps its native radio
31
+ * inside its own shadow root, so two of them with the same `name` don't form
32
+ * a group: checking one doesn't uncheck the other, and arrow keys don't move
33
+ * between them. `oh-radio-group` renders the whole set in one place, with
34
+ * arrow-key navigation and one label for the group. For an independent
35
+ * on/off choice use `oh-checkbox`.
36
+ *
37
+ * **States:** unchecked, checked, hover, active, focus, error (set `error-text`).
38
+ *
39
+ * **Behaviour:** clicking the circle or label checks it. Checking sets
40
+ * `checked` and fires `oh-change`. The native radio sits in the shadow
41
+ * root, so it doesn't submit with a native form.
42
+ *
43
+ * **Accessibility:** a real native radio, visually hidden, carries the role
44
+ * and state; the drawn circle is decoration. Always set `label`: it's the
45
+ * radio's name. Focus underlines the label. The error message shows under
46
+ * the radio with an icon, sets `aria-invalid` and is linked with
47
+ * `aria-describedby`; it's announced (`role="alert"`) only when it appears
48
+ * after first render.
49
+ *
50
+ * **Look:** set by tokens — `stroke.control` in `color.border.emphasis`
51
+ * (border), `shape.pill` (circle), `typography.control.*` (label),
52
+ * `elevation.offset.*` and `elevation.color.secondary` (shadow), `lift.hoverSm` /
53
+ * `lift.pressSm` (movement on hover and press), `color.border.hover`
54
+ * (hover), `color.brand.primary` (and its hover and active tokens),
55
+ * `color.text.onBrand` and `elevation.color.primary` (checked),
56
+ * `color.feedback.error` and `elevation.color.error` (error).
57
+ *
58
+ * @element oh-radio
59
+ * @fires oh-change - The radio was checked. detail: { checked, value }
60
+ * @csspart circle - The drawn radio circle
61
+ * @csspart label - The label text
62
+ * @csspart error - The error message
63
+ */
30
64
  export declare class OhRadio extends OhElement {
31
65
  static styles: import("lit").CSSResult[];
32
66
  checked: boolean;
33
67
  label: string;
34
68
  name: string;
35
69
  value: string;
36
- error: boolean;
37
- errorMessage: string;
38
70
  /**
39
- * Force a visual state (for documentation/Figma sync only)
71
+ * Error shown with the control and linked to it. Setting it puts the
72
+ * control in its error state; clear it to leave that state.
73
+ */
74
+ errorText: string;
75
+ /**
76
+ * Force a visual state (for documentation only)
40
77
  * Values: 'hover' | 'focus'
41
78
  */
42
79
  forceState: RadioState;
@@ -48,6 +85,7 @@ export declare class OhRadio extends OhElement {
48
85
  */
49
86
  private _announceError;
50
87
  private _errorId;
88
+ updated(changed: PropertyValues): void;
51
89
  willUpdate(changed: PropertyValues): void;
52
90
  render(): import("lit").TemplateResult<1>;
53
91
  }
@@ -1 +1 @@
1
- {"version":3,"file":"oh-radio.d.ts","sourceRoot":"","sources":["../src/oh-radio.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAc,MAAM,WAAW,CAAC;AAElD,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAEvD,qBACa,OAAQ,SAAQ,SAAS;IACpC,OAAgB,MAAM,4BAmNpB;IAGF,OAAO,UAAS;IAGhB,KAAK,SAAM;IAGX,IAAI,SAAM;IAGV,KAAK,SAAM;IAGX,KAAK,UAAS;IAGd,YAAY,SAAM;IAElB;;;OAGG;IAEH,UAAU,EAAE,UAAU,CAAa;IAEnC,OAAO,CAAC,aAAa;IAMrB;;;;OAIG;IAEH,OAAO,CAAC,cAAc,CAAS;IAE/B,OAAO,CAAC,QAAQ,CAA+D;IAE/E,UAAU,CAAC,OAAO,EAAE,cAAc;IASlC,MAAM;CAiDP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,OAAO,CAAC;KACrB;CACF"}
1
+ {"version":3,"file":"oh-radio.d.ts","sourceRoot":"","sources":["../src/oh-radio.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAc,MAAM,WAAW,CAAC;AAElD,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,qBACa,OAAQ,SAAQ,SAAS;IACpC,OAAgB,MAAM,4BAgNpB;IAGF,OAAO,UAAS;IAGhB,KAAK,SAAM;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