@orange-halo/components 2.2.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.
Files changed (124) hide show
  1. package/custom-elements.json +551 -314
  2. package/dist/index.d.ts +1 -7
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +0 -4
  5. package/dist/index.js.map +1 -1
  6. package/dist/oh-accordion.d.ts +53 -8
  7. package/dist/oh-accordion.d.ts.map +1 -1
  8. package/dist/oh-accordion.js +77 -15
  9. package/dist/oh-accordion.js.map +1 -1
  10. package/dist/oh-alert.d.ts +26 -8
  11. package/dist/oh-alert.d.ts.map +1 -1
  12. package/dist/oh-alert.js +32 -14
  13. package/dist/oh-alert.js.map +1 -1
  14. package/dist/oh-badge.d.ts +32 -13
  15. package/dist/oh-badge.d.ts.map +1 -1
  16. package/dist/oh-badge.js +35 -16
  17. package/dist/oh-badge.js.map +1 -1
  18. package/dist/oh-breadcrumb.d.ts +39 -12
  19. package/dist/oh-breadcrumb.d.ts.map +1 -1
  20. package/dist/oh-breadcrumb.js +39 -17
  21. package/dist/oh-breadcrumb.js.map +1 -1
  22. package/dist/oh-button.d.ts +49 -23
  23. package/dist/oh-button.d.ts.map +1 -1
  24. package/dist/oh-button.js +63 -44
  25. package/dist/oh-button.js.map +1 -1
  26. package/dist/oh-card.d.ts +47 -19
  27. package/dist/oh-card.d.ts.map +1 -1
  28. package/dist/oh-card.js +110 -82
  29. package/dist/oh-card.js.map +1 -1
  30. package/dist/oh-checkbox-group.d.ts +56 -12
  31. package/dist/oh-checkbox-group.d.ts.map +1 -1
  32. package/dist/oh-checkbox-group.figma.js +4 -6
  33. package/dist/oh-checkbox-group.figma.js.map +1 -1
  34. package/dist/oh-checkbox-group.js +86 -44
  35. package/dist/oh-checkbox-group.js.map +1 -1
  36. package/dist/oh-checkbox.d.ts +54 -17
  37. package/dist/oh-checkbox.d.ts.map +1 -1
  38. package/dist/oh-checkbox.js +85 -55
  39. package/dist/oh-checkbox.js.map +1 -1
  40. package/dist/oh-cluster.d.ts +19 -14
  41. package/dist/oh-cluster.d.ts.map +1 -1
  42. package/dist/oh-cluster.js +19 -19
  43. package/dist/oh-cluster.js.map +1 -1
  44. package/dist/oh-container.d.ts +19 -16
  45. package/dist/oh-container.d.ts.map +1 -1
  46. package/dist/oh-container.js +21 -23
  47. package/dist/oh-container.js.map +1 -1
  48. package/dist/oh-drawer.d.ts +28 -11
  49. package/dist/oh-drawer.d.ts.map +1 -1
  50. package/dist/oh-drawer.js +31 -14
  51. package/dist/oh-drawer.js.map +1 -1
  52. package/dist/oh-footer.d.ts +37 -18
  53. package/dist/oh-footer.d.ts.map +1 -1
  54. package/dist/oh-footer.js +38 -19
  55. package/dist/oh-footer.js.map +1 -1
  56. package/dist/oh-grid.d.ts +27 -14
  57. package/dist/oh-grid.d.ts.map +1 -1
  58. package/dist/oh-grid.js +27 -19
  59. package/dist/oh-grid.js.map +1 -1
  60. package/dist/oh-icon.d.ts +21 -5
  61. package/dist/oh-icon.d.ts.map +1 -1
  62. package/dist/oh-icon.js +21 -5
  63. package/dist/oh-icon.js.map +1 -1
  64. package/dist/oh-input.d.ts +104 -20
  65. package/dist/oh-input.d.ts.map +1 -1
  66. package/dist/oh-input.figma.js +2 -2
  67. package/dist/oh-input.figma.js.map +1 -1
  68. package/dist/oh-input.js +205 -66
  69. package/dist/oh-input.js.map +1 -1
  70. package/dist/oh-link.d.ts +42 -19
  71. package/dist/oh-link.d.ts.map +1 -1
  72. package/dist/oh-link.js +47 -29
  73. package/dist/oh-link.js.map +1 -1
  74. package/dist/oh-modal.d.ts +29 -6
  75. package/dist/oh-modal.d.ts.map +1 -1
  76. package/dist/oh-modal.js +37 -16
  77. package/dist/oh-modal.js.map +1 -1
  78. package/dist/oh-navbar.d.ts +42 -19
  79. package/dist/oh-navbar.d.ts.map +1 -1
  80. package/dist/oh-navbar.js +42 -19
  81. package/dist/oh-navbar.js.map +1 -1
  82. package/dist/oh-progress.d.ts +26 -7
  83. package/dist/oh-progress.d.ts.map +1 -1
  84. package/dist/oh-progress.js +31 -12
  85. package/dist/oh-progress.js.map +1 -1
  86. package/dist/oh-radio-group.d.ts +55 -13
  87. package/dist/oh-radio-group.d.ts.map +1 -1
  88. package/dist/oh-radio-group.figma.js +2 -2
  89. package/dist/oh-radio-group.figma.js.map +1 -1
  90. package/dist/oh-radio-group.js +83 -43
  91. package/dist/oh-radio-group.js.map +1 -1
  92. package/dist/oh-radio.d.ts +55 -17
  93. package/dist/oh-radio.d.ts.map +1 -1
  94. package/dist/oh-radio.js +87 -56
  95. package/dist/oh-radio.js.map +1 -1
  96. package/dist/oh-select.d.ts +58 -16
  97. package/dist/oh-select.d.ts.map +1 -1
  98. package/dist/oh-select.js +70 -33
  99. package/dist/oh-select.js.map +1 -1
  100. package/dist/oh-skip-link.d.ts +33 -15
  101. package/dist/oh-skip-link.d.ts.map +1 -1
  102. package/dist/oh-skip-link.js +38 -25
  103. package/dist/oh-skip-link.js.map +1 -1
  104. package/dist/oh-stack.d.ts +17 -14
  105. package/dist/oh-stack.d.ts.map +1 -1
  106. package/dist/oh-stack.js +18 -20
  107. package/dist/oh-stack.js.map +1 -1
  108. package/dist/oh-tabs.d.ts +55 -30
  109. package/dist/oh-tabs.d.ts.map +1 -1
  110. package/dist/oh-tabs.js +80 -65
  111. package/dist/oh-tabs.js.map +1 -1
  112. package/dist/oh-textarea.d.ts +37 -6
  113. package/dist/oh-textarea.d.ts.map +1 -1
  114. package/dist/oh-textarea.js +40 -9
  115. package/dist/oh-textarea.js.map +1 -1
  116. package/dist/oh-toggle.d.ts +45 -12
  117. package/dist/oh-toggle.d.ts.map +1 -1
  118. package/dist/oh-toggle.js +64 -29
  119. package/dist/oh-toggle.js.map +1 -1
  120. package/package.json +3 -7
  121. package/dist/oh-hero.d.ts +0 -33
  122. package/dist/oh-hero.d.ts.map +0 -1
  123. package/dist/oh-hero.js +0 -248
  124. package/dist/oh-hero.js.map +0 -1
package/dist/oh-grid.d.ts CHANGED
@@ -1,28 +1,41 @@
1
1
  /**
2
2
  * oh-grid
3
3
  *
4
- * CSS Grid layout with configurable columns.
5
- * Flexible grid system for cards, galleries, and layouts.
6
- *
7
4
  * DESIGN DECISIONS:
8
5
  * ─────────────────
9
6
  * 1. COLUMN PRESETS
10
- * - 1-4 fixed columns
11
- * - auto-fit: responsive columns with min-width
12
- * - auto-fill: fills available space
13
- *
14
- * 2. MIN-WIDTH FOR AUTO COLUMNS
15
- * - Configurable minimum column width
16
- * - Defaults to 280px for card-friendly layouts
17
- *
18
- * 3. GAP SCALE
19
- * - Uses design token spacing values
7
+ * - 1–4 fixed columns, which step down on narrower viewports at the
8
+ * `size.breakpoint.*` widths
9
+ * - auto-fit / auto-fill: as many columns as fit, each at least
10
+ * `min-width` wide
20
11
  *
21
- * @element oh-grid
12
+ * 2. GAP SCALE
13
+ * - Named steps mapped to `spacing.*` tokens
22
14
  */
23
15
  import { OhElement } from "./base.js";
24
16
  export type GridColumns = "1" | "2" | "3" | "4" | "auto-fit" | "auto-fill";
25
17
  export type GridGap = "none" | "xs" | "sm" | "md" | "lg" | "xl";
18
+ /**
19
+ * A CSS grid of equal-width columns, fixed or as many as fit.
20
+ *
21
+ * **Use it for** cards, galleries and other sets of similar items. **Don't
22
+ * use it for** a single column (use `oh-stack`) or items of varying width in
23
+ * a row (use `oh-cluster`).
24
+ *
25
+ * **Columns:** `columns` is `1`–`4`, `auto-fit` (default) or `auto-fill`.
26
+ * Auto columns are at least `min-width` wide (any CSS length); `auto-fit`
27
+ * stretches the items to fill the row, `auto-fill` keeps empty tracks.
28
+ * **Gaps:** `gap` is `none`, `xs` (`spacing.1`), `sm` (`spacing.2`), `md`
29
+ * (default, `spacing.4`), `lg` (`spacing.6`) or `xl` (`spacing.8`).
30
+ * `align-items` is `start`, `center`, `end` or `stretch` (default).
31
+ *
32
+ * **Behaviour:** fixed columns respond to the viewport: up to
33
+ * `size.breakpoint.sm` they become one column; up to `size.breakpoint.md`,
34
+ * 3 and 4 become 2; up to `size.breakpoint.lg`, 4 becomes 3.
35
+ *
36
+ * @element oh-grid
37
+ * @slot - The grid items.
38
+ */
26
39
  export declare class OhGrid extends OhElement {
27
40
  static styles: import("lit").CSSResult[];
28
41
  columns: GridColumns;
@@ -1 +1 @@
1
- {"version":3,"file":"oh-grid.d.ts","sourceRoot":"","sources":["../src/oh-grid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,OAAO,EAAE,SAAS,EAAc,MAAM,WAAW,CAAC;AAElD,MAAM,MAAM,WAAW,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,UAAU,GAAG,WAAW,CAAC;AAC3E,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEhE,qBACa,MAAO,SAAQ,SAAS;IACnC,OAAgB,MAAM,4BA8FpB;IAGF,OAAO,EAAE,WAAW,CAAc;IAGlC,GAAG,EAAE,OAAO,CAAQ;IAGpB,QAAQ,SAAW;IAGnB,UAAU,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAa;IAEtD,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAaxD,MAAM;CAGP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,MAAM,CAAC;KACnB;CACF"}
1
+ {"version":3,"file":"oh-grid.d.ts","sourceRoot":"","sources":["../src/oh-grid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,EAAE,SAAS,EAAc,MAAM,WAAW,CAAC;AAElD,MAAM,MAAM,WAAW,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,UAAU,GAAG,WAAW,CAAC;AAC3E,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBACa,MAAO,SAAQ,SAAS;IACnC,OAAgB,MAAM,4BAyFpB;IAGF,OAAO,EAAE,WAAW,CAAc;IAGlC,GAAG,EAAE,OAAO,CAAQ;IAGpB,QAAQ,SAAW;IAGnB,UAAU,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAa;IAEtD,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAaxD,MAAM;CAGP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,MAAM,CAAC;KACnB;CACF"}
package/dist/oh-grid.js CHANGED
@@ -1,24 +1,16 @@
1
1
  /**
2
2
  * oh-grid
3
3
  *
4
- * CSS Grid layout with configurable columns.
5
- * Flexible grid system for cards, galleries, and layouts.
6
- *
7
4
  * DESIGN DECISIONS:
8
5
  * ─────────────────
9
6
  * 1. COLUMN PRESETS
10
- * - 1-4 fixed columns
11
- * - auto-fit: responsive columns with min-width
12
- * - auto-fill: fills available space
13
- *
14
- * 2. MIN-WIDTH FOR AUTO COLUMNS
15
- * - Configurable minimum column width
16
- * - Defaults to 280px for card-friendly layouts
17
- *
18
- * 3. GAP SCALE
19
- * - Uses design token spacing values
7
+ * - 1–4 fixed columns, which step down on narrower viewports at the
8
+ * `size.breakpoint.*` widths
9
+ * - auto-fit / auto-fill: as many columns as fit, each at least
10
+ * `min-width` wide
20
11
  *
21
- * @element oh-grid
12
+ * 2. GAP SCALE
13
+ * - Named steps mapped to `spacing.*` tokens
22
14
  */
23
15
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
24
16
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -29,6 +21,27 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
29
21
  import { html, css } from "lit";
30
22
  import { customElement, property } from "lit/decorators.js";
31
23
  import { OhElement, baseStyles } from "./base.js";
24
+ /**
25
+ * A CSS grid of equal-width columns, fixed or as many as fit.
26
+ *
27
+ * **Use it for** cards, galleries and other sets of similar items. **Don't
28
+ * use it for** a single column (use `oh-stack`) or items of varying width in
29
+ * a row (use `oh-cluster`).
30
+ *
31
+ * **Columns:** `columns` is `1`–`4`, `auto-fit` (default) or `auto-fill`.
32
+ * Auto columns are at least `min-width` wide (any CSS length); `auto-fit`
33
+ * stretches the items to fill the row, `auto-fill` keeps empty tracks.
34
+ * **Gaps:** `gap` is `none`, `xs` (`spacing.1`), `sm` (`spacing.2`), `md`
35
+ * (default, `spacing.4`), `lg` (`spacing.6`) or `xl` (`spacing.8`).
36
+ * `align-items` is `start`, `center`, `end` or `stretch` (default).
37
+ *
38
+ * **Behaviour:** fixed columns respond to the viewport: up to
39
+ * `size.breakpoint.sm` they become one column; up to `size.breakpoint.md`,
40
+ * 3 and 4 become 2; up to `size.breakpoint.lg`, 4 becomes 3.
41
+ *
42
+ * @element oh-grid
43
+ * @slot - The grid items.
44
+ */
32
45
  let OhGrid = class OhGrid extends OhElement {
33
46
  constructor() {
34
47
  super(...arguments);
@@ -40,11 +53,6 @@ let OhGrid = class OhGrid extends OhElement {
40
53
  static { this.styles = [
41
54
  baseStyles,
42
55
  css `
43
- /* ═══════════════════════════════════════════════════════════════
44
- ORANGE HALO GRID
45
- CSS Grid layout • Responsive columns • Flexible gaps
46
- ═══════════════════════════════════════════════════════════════ */
47
-
48
56
  :host {
49
57
  display: grid;
50
58
  width: 100%;
@@ -1 +1 @@
1
- {"version":3,"file":"oh-grid.js","sourceRoot":"","sources":["../src/oh-grid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;;;;;AAEH,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,aAA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OAAO,KAAK,UAAU,IAAI,IAAI,CAAC,OAAO,KAAK,WAAW,EAAE,CAAC;gBAChE,IAAI,CAAC,KAAK,CAAC,mBAAmB,GAAG,UAAU,IAAI,CAAC,OAAO,YAAY,IAAI,CAAC,QAAQ,SAAS,CAAC;YAC5F,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,KAAK,CAAC,mBAAmB,GAAG,EAAE,CAAC;YACtC,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;;AA1BD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uCACR;AAGlC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;mCACtB;AAGpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;wCAChC;AAGnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CACL;AAtGpD,MAAM;IADlB,aAAa,CAAC,SAAS,CAAC;GACZ,MAAM,CAwHlB"}
package/dist/oh-icon.d.ts CHANGED
@@ -1,14 +1,15 @@
1
1
  /**
2
2
  * oh-icon
3
3
  *
4
- * A flexible icon component for the Orange Halo design system.
4
+ * A flexible icon component for the design system.
5
5
  * Can render as a standalone icon or as an interactive link.
6
6
  *
7
7
  * DESIGN DECISIONS:
8
8
  * ─────────────────
9
9
  * 1. SIZE
10
- * - Default size matches line-height (1em)
11
- * - Size variants: sm (16px), md (20px), lg (24px), xl (32px)
10
+ * - With no size, the icon is 1em, so it follows the text around it
11
+ * - Size variants: sm, md, lg, xl (fixed sizes, set in this file; there
12
+ * are no icon size tokens yet)
12
13
  *
13
14
  * 2. LINK MODE
14
15
  * - When `href` is provided, renders as an <a> tag
@@ -19,13 +20,28 @@
19
20
  * - Decorative by default (aria-hidden="true")
20
21
  * - Provide `label` for meaningful icons
21
22
  * - When used as link, label becomes aria-label
22
- *
23
- * @element oh-icon
24
23
  */
25
24
  import { nothing } from "lit";
26
25
  import { OhElement } from "./base.js";
27
26
  export type IconName = "twitter" | "github" | "linkedin" | "instagram" | "youtube" | "facebook" | "email" | "substack" | "arrow-right" | "arrow-left" | "arrow-up" | "arrow-down" | "chevron-right" | "chevron-left" | "chevron-up" | "chevron-down" | "external-link" | "close" | "plus" | "minus" | "check" | "search" | "menu" | "settings" | "heart" | "sparkle" | "info" | "warning" | "error" | "success";
28
27
  export type IconSize = "sm" | "md" | "lg" | "xl";
28
+ /**
29
+ * An icon from the system's built-in set, shown on its own, with a label, or as an icon-only link.
30
+ *
31
+ * **Use it for** an icon next to text, an icon that carries meaning on its own (with `label`), or a compact link such as a social profile (`href` + `label`). **Don't use it for** an icon-only button (use `oh-button` with `icon-only`); or for an image or logo (use `<img>`).
32
+ *
33
+ * **Names:** `name` picks the icon: social (`twitter`, `github`, `linkedin`, `instagram`, `youtube`, `facebook`, `email`, `substack`), navigation (`arrow-*`, `chevron-*`, `external-link`), actions (`close`, `plus`, `minus`, `check`, `search`, `menu`, `settings`, `heart`, `sparkle`) and feedback (`info`, `warning`, `error`, `success`). An unknown name renders nothing and logs a warning.
34
+ *
35
+ * **Sizes:** with no `size` the icon is 1em and follows the text; `sm`, `md`, `lg`, `xl` set fixed sizes. **`inverse`:** for icons on an accent-coloured or dark background.
36
+ *
37
+ * **Behaviour:** the icon takes the current text colour. With `href` it renders as a link, with hover, active and focus-visible states; `target="_blank"` adds `rel="noopener noreferrer"`.
38
+ *
39
+ * **Accessibility:** without `label` the icon is decorative (`aria-hidden="true"`). With `label` it's `role="img"` with that name. As a link, `label` is required (it logs a warning without one) and becomes the link's `aria-label`. Focus-visible shows a solid ring in `focus.ringColor` (`color.text.onAccent` when `inverse`).
40
+ *
41
+ * **Look:** set by tokens. The icon is `currentColor`; `inverse` sets `color.text.onAccent`. As a link: `shape.compact` corners, hover moves by `lift.hoverMd` with an `elevation.offset.lg` shadow in `color.border.default` (`color.text.onAccent` when `inverse`); motion uses `motion.snappy` and `motion.easeGentle`, off under `prefers-reduced-motion`.
42
+ *
43
+ * @element oh-icon
44
+ */
29
45
  export declare class OhIcon extends OhElement {
30
46
  static styles: import("lit").CSSResult[];
31
47
  name: IconName;
@@ -1 +1 @@
1
- {"version":3,"file":"oh-icon.d.ts","sourceRoot":"","sources":["../src/oh-icon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAa,OAAO,EAAE,MAAM,KAAK,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAc,MAAM,WAAW,CAAC;AAElD,MAAM,MAAM,QAAQ,GAEhB,SAAS,GACT,QAAQ,GACR,UAAU,GACV,WAAW,GACX,SAAS,GACT,UAAU,GACV,OAAO,GACP,UAAU,GAEV,aAAa,GACb,YAAY,GACZ,UAAU,GACV,YAAY,GACZ,eAAe,GACf,cAAc,GACd,YAAY,GACZ,cAAc,GACd,eAAe,GAEf,OAAO,GACP,MAAM,GACN,OAAO,GACP,OAAO,GACP,QAAQ,GACR,MAAM,GACN,UAAU,GACV,OAAO,GACP,SAAS,GAET,MAAM,GACN,SAAS,GACT,OAAO,GACP,SAAS,CAAC;AAEd,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAqIjD,qBACa,MAAO,SAAQ,SAAS;IACnC,OAAgB,MAAM,4BA+FpB;IAGF,IAAI,EAAE,QAAQ,CAAU;IAGxB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAGhB,OAAO,UAAS;IAGhB,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf,IAAI,CAAC,EAAE,MAAM,CAAC;IAGd,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,MAAM;CA6CP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,MAAM,CAAC;KACnB;CACF"}
1
+ {"version":3,"file":"oh-icon.d.ts","sourceRoot":"","sources":["../src/oh-icon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAa,OAAO,EAAE,MAAM,KAAK,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAc,MAAM,WAAW,CAAC;AAElD,MAAM,MAAM,QAAQ,GAEhB,SAAS,GACT,QAAQ,GACR,UAAU,GACV,WAAW,GACX,SAAS,GACT,UAAU,GACV,OAAO,GACP,UAAU,GAEV,aAAa,GACb,YAAY,GACZ,UAAU,GACV,YAAY,GACZ,eAAe,GACf,cAAc,GACd,YAAY,GACZ,cAAc,GACd,eAAe,GAEf,OAAO,GACP,MAAM,GACN,OAAO,GACP,OAAO,GACP,QAAQ,GACR,MAAM,GACN,UAAU,GACV,OAAO,GACP,SAAS,GAET,MAAM,GACN,SAAS,GACT,OAAO,GACP,SAAS,CAAC;AAEd,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAqIjD;;;;;;;;;;;;;;;;GAgBG;AACH,qBACa,MAAO,SAAQ,SAAS;IACnC,OAAgB,MAAM,4BA+FpB;IAGF,IAAI,EAAE,QAAQ,CAAU;IAGxB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAGhB,OAAO,UAAS;IAGhB,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf,IAAI,CAAC,EAAE,MAAM,CAAC;IAGd,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,MAAM;CA6CP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,MAAM,CAAC;KACnB;CACF"}
package/dist/oh-icon.js CHANGED
@@ -1,14 +1,15 @@
1
1
  /**
2
2
  * oh-icon
3
3
  *
4
- * A flexible icon component for the Orange Halo design system.
4
+ * A flexible icon component for the design system.
5
5
  * Can render as a standalone icon or as an interactive link.
6
6
  *
7
7
  * DESIGN DECISIONS:
8
8
  * ─────────────────
9
9
  * 1. SIZE
10
- * - Default size matches line-height (1em)
11
- * - Size variants: sm (16px), md (20px), lg (24px), xl (32px)
10
+ * - With no size, the icon is 1em, so it follows the text around it
11
+ * - Size variants: sm, md, lg, xl (fixed sizes, set in this file; there
12
+ * are no icon size tokens yet)
12
13
  *
13
14
  * 2. LINK MODE
14
15
  * - When `href` is provided, renders as an <a> tag
@@ -19,8 +20,6 @@
19
20
  * - Decorative by default (aria-hidden="true")
20
21
  * - Provide `label` for meaningful icons
21
22
  * - When used as link, label becomes aria-label
22
- *
23
- * @element oh-icon
24
23
  */
25
24
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
26
25
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -158,6 +157,23 @@ const icons = {
158
157
  path: `M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,
159
158
  },
160
159
  };
160
+ /**
161
+ * An icon from the system's built-in set, shown on its own, with a label, or as an icon-only link.
162
+ *
163
+ * **Use it for** an icon next to text, an icon that carries meaning on its own (with `label`), or a compact link such as a social profile (`href` + `label`). **Don't use it for** an icon-only button (use `oh-button` with `icon-only`); or for an image or logo (use `<img>`).
164
+ *
165
+ * **Names:** `name` picks the icon: social (`twitter`, `github`, `linkedin`, `instagram`, `youtube`, `facebook`, `email`, `substack`), navigation (`arrow-*`, `chevron-*`, `external-link`), actions (`close`, `plus`, `minus`, `check`, `search`, `menu`, `settings`, `heart`, `sparkle`) and feedback (`info`, `warning`, `error`, `success`). An unknown name renders nothing and logs a warning.
166
+ *
167
+ * **Sizes:** with no `size` the icon is 1em and follows the text; `sm`, `md`, `lg`, `xl` set fixed sizes. **`inverse`:** for icons on an accent-coloured or dark background.
168
+ *
169
+ * **Behaviour:** the icon takes the current text colour. With `href` it renders as a link, with hover, active and focus-visible states; `target="_blank"` adds `rel="noopener noreferrer"`.
170
+ *
171
+ * **Accessibility:** without `label` the icon is decorative (`aria-hidden="true"`). With `label` it's `role="img"` with that name. As a link, `label` is required (it logs a warning without one) and becomes the link's `aria-label`. Focus-visible shows a solid ring in `focus.ringColor` (`color.text.onAccent` when `inverse`).
172
+ *
173
+ * **Look:** set by tokens. The icon is `currentColor`; `inverse` sets `color.text.onAccent`. As a link: `shape.compact` corners, hover moves by `lift.hoverMd` with an `elevation.offset.lg` shadow in `color.border.default` (`color.text.onAccent` when `inverse`); motion uses `motion.snappy` and `motion.easeGentle`, off under `prefers-reduced-motion`.
174
+ *
175
+ * @element oh-icon
176
+ */
161
177
  let OhIcon = class OhIcon extends OhElement {
162
178
  constructor() {
163
179
  super(...arguments);
@@ -1 +1 @@
1
- {"version":3,"file":"oh-icon.js","sourceRoot":"","sources":["../src/oh-icon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;;;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;AAwClD,iBAAiB;AACjB,MAAM,KAAK,GAAwD;IACjE,uBAAuB;IACvB,OAAO,EAAE;QACP,OAAO,EAAE,WAAW;QACpB,IAAI,EAAE,6JAA6J;KACpK;IACD,MAAM,EAAE;QACN,OAAO,EAAE,WAAW;QACpB,IAAI,EAAE,ktBAAktB;KACztB;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,WAAW;QACpB,IAAI,EAAE,ofAAof;KAC3f;IACD,SAAS,EAAE;QAC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AE,IAAI,EAAE,MAAM,EAAE,CAAC;sCACX;AAlHL,MAAM;IADlB,aAAa,CAAC,SAAS,CAAC;GACZ,MAAM,CAiKlB"}
@@ -1,41 +1,113 @@
1
1
  /**
2
2
  * oh-input
3
3
  *
4
- * A chunky, inset input field that feels pressed into the page.
5
- * On focus, it rises to meet you.
6
- *
7
4
  * DESIGN DECISIONS:
8
5
  * ─────────────────
9
- * 1. CHUNKY & CONFIDENT
10
- * - Thick border (stroke.control) that feels illustrative
11
- * - Solid fill, no subtle gradients
12
- * - shape.control corners (matches button)
13
- *
14
- * 2. INSET SHADOW (PRESSED IN)
15
- * - Shadow offset to top-left (inset)
16
- * - Feels pressed into the surface
17
- * - Opposite of button's outset sticker effect
6
+ * 1. LOOK FROM TOKENS
7
+ * - Border: input.base.borderWidth (stroke.control) in color.border.emphasis
8
+ * - Corners: shape.control (same as oh-button)
9
+ * - Shadow: an inset shadow offset by elevation.offset.md in elevation.color.field
18
10
  *
19
- * 3. FOCUS THICKENS
20
- * - An inset ring in focus.ringColor thickens the border inward
11
+ * 2. FOCUS IS A SOLID RING
12
+ * - An inset ring in focus.ringColor inside the border, so focus doesn't
13
+ * shift the layout
21
14
  * - Background switches to color.surface.highlight
22
- * - Clear visual hierarchy
23
15
  *
24
- * @element oh-input
16
+ * 3. A REAL FORM CONTROL
17
+ * - Form-associated, like oh-textarea: its value submits with the form
18
+ * under its name and shows in form.elements, `required` blocks
19
+ * submission, a form reset restores the starting value, and a
20
+ * disabled <fieldset> disables it
21
+ *
22
+ * 4. SUGGESTIONS ARE NATIVE
23
+ * - `suggestions` renders a <datalist> inside the component (a list
24
+ * outside it can't reach an input in the shadow root). The browser
25
+ * draws the list and handles the keyboard and screen readers, so
26
+ * people can still type anything: it suggests, it doesn't restrict
27
+ *
28
+ * 5. ERRORS BEFORE THE FIELD
29
+ * - Error text sits after the label and before the field, with an icon,
30
+ * so it's read before the field is reached. Helper text sits after
25
31
  */
26
32
  import { type PropertyValues } from "lit";
27
33
  import { OhElement } from "./base.js";
28
34
  export type InputType = "text" | "email" | "password" | "search" | "tel" | "url";
29
35
  export type InputState = "default" | "hover" | "focus";
36
+ /**
37
+ * A single-line text field that submits with a native form, with optional
38
+ * typing suggestions.
39
+ *
40
+ * **Use it for** short free text: names, email addresses, search terms.
41
+ * **Don't use it for** several lines (use `oh-textarea`) or a choice from a
42
+ * fixed list (use `oh-select`, or `oh-radio-group` for a few options).
43
+ * `suggestions` offers values while still allowing any text.
44
+ *
45
+ * **Types:** `text` (default), `email`, `password`, `search`, `tel`, `url`.
46
+ * One size. **States:** rest, hover, focus, error (set `error-text`),
47
+ * disabled, required.
48
+ *
49
+ * **Behaviour:** form-associated: the value submits under `name`, `required`
50
+ * blocks submission (validity comes from the inner `<input>`), a form reset
51
+ * restores the starting value, and a disabled `<fieldset>` disables it.
52
+ * Fires `oh-input` as the text changes and `oh-change` when it's committed.
53
+ * `suggestions` renders a native `<datalist>`, so the browser handles its
54
+ * keyboard and screen reader support. `autocomplete` is passed to the inner
55
+ * `<input>`.
56
+ *
57
+ * **Accessibility:** always set `label`: it's the field's name. The error
58
+ * shows after the label and before the field, with an icon, and is linked
59
+ * with `aria-describedby` and `aria-invalid`; it's announced (`role="alert"`)
60
+ * only when it appears after first render. Helper text is linked the same
61
+ * way (it's hidden while an error shows). Focus is a solid inset ring.
62
+ * Set `autocomplete` for personal data (WCAG 1.3.5).
63
+ *
64
+ * **Look:** set by tokens — `input.base.borderWidth` (`stroke.control`) in
65
+ * `color.border.emphasis` (border), `shape.control` (corners),
66
+ * `typography.control.*` (type), `input.size.md.minHeight` (height),
67
+ * `elevation.offset.md` and `elevation.color.field` (inset shadow),
68
+ * `color.border.hover` (hover), `focus.ringColor` and
69
+ * `color.surface.highlight` (focus), `color.feedback.error`,
70
+ * `color.feedback.errorSubtle` and `elevation.color.error` (error),
71
+ * `color.surface.disabled`, `color.border.disabled` and
72
+ * `color.text.disabled` (disabled).
73
+ *
74
+ * @element oh-input
75
+ * @fires oh-input - Whenever the text changes: typing, or picking a suggestion. detail: { value, originalEvent }
76
+ * @fires oh-change - When the value is committed (on blur or Enter). detail: { value, originalEvent }
77
+ * @csspart label - The visible label
78
+ * @csspart input - The text field
79
+ * @csspart helper - The helper text, and the error message (which also has the error part)
80
+ * @csspart error - The error message
81
+ */
30
82
  export declare class OhInput extends OhElement {
83
+ static formAssociated: boolean;
31
84
  static styles: import("lit").CSSResult[];
85
+ /** The kind of text: text, email, password, search, tel or url */
32
86
  type: InputType;
87
+ /** The text in the field */
33
88
  value: string;
89
+ /** Example text shown while the field is empty. Not a replacement for the label */
34
90
  placeholder: string;
91
+ /** The visible label. Always set one: it names the field */
35
92
  label: string;
93
+ /** Help shown under the field and linked to it */
36
94
  helperText: string;
95
+ /** Error shown before the field and linked to it. Setting it puts the field in its error state */
37
96
  errorText: string;
97
+ /** The name the value is submitted under */
98
+ name: string;
99
+ /** Must be filled in before the form submits */
38
100
  required: boolean;
101
+ /** Not editable, and left out of the form's data */
102
+ disabled: boolean;
103
+ /**
104
+ * Values offered while typing, shown by the browser as a list under the
105
+ * field. They suggest, they don't restrict: any text is still allowed.
106
+ * Set it as a property (an array of strings) or, in HTML, as a JSON array:
107
+ * suggestions='["Option one","Option two"]'. Browsers also offer the
108
+ * field's autofill history, so set autocomplete="off" to show only these.
109
+ */
110
+ suggestions: string[];
39
111
  /**
40
112
  * The input's purpose, for autofill and assistive tech (WCAG 1.3.5):
41
113
  * an HTML autocomplete token such as "email", "name" or "tel".
@@ -48,17 +120,29 @@ export declare class OhInput extends OhElement {
48
120
  */
49
121
  forceState: InputState;
50
122
  private _input;
51
- private _handleInput;
52
- private _handleChange;
53
- focus(): void;
54
- blur(): void;
123
+ private _internals;
124
+ /** The starting value, restored when the form resets */
125
+ private _defaultValue;
126
+ /** Set when a disabled <fieldset> around it disables it */
127
+ private _formDisabled;
55
128
  /**
56
129
  * Errors that appear after first render (e.g. on submit) are announced via
57
130
  * role="alert". Errors present on page load are only linked with
58
131
  * aria-describedby, so they aren't read out unprompted.
59
132
  */
60
133
  private _announceError;
134
+ connectedCallback(): void;
135
+ /** The form this field belongs to */
136
+ get form(): HTMLFormElement | null;
137
+ focus(options?: FocusOptions): void;
138
+ blur(): void;
139
+ formResetCallback(): void;
140
+ formDisabledCallback(disabled: boolean): void;
141
+ formStateRestoreCallback(state: string | File | FormData | null): void;
61
142
  willUpdate(changed: PropertyValues): void;
143
+ updated(changed: PropertyValues): void;
144
+ private _handleInput;
145
+ private _handleChange;
62
146
  render(): import("lit").TemplateResult<1>;
63
147
  }
64
148
  declare global {
@@ -1 +1 @@
1
- {"version":3,"file":"oh-input.d.ts","sourceRoot":"","sources":["../src/oh-input.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAc,MAAM,WAAW,CAAC;AAElD,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,OAAO,GACP,UAAU,GACV,QAAQ,GACR,KAAK,GACL,KAAK,CAAC;AACV,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAEvD,qBACa,OAAQ,SAAQ,SAAS;IACpC,OAAgB,MAAM,4BAuKpB;IAGF,IAAI,EAAE,SAAS,CAAU;IAGzB,KAAK,SAAM;IAGX,WAAW,SAAM;IAGjB,KAAK,SAAM;IAGX,UAAU,SAAM;IAGhB,SAAS,SAAM;IAGf,QAAQ,UAAS;IAEjB;;;;OAIG;IAEH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IAEH,UAAU,EAAE,UAAU,CAAa;IAGnC,OAAO,CAAC,MAAM,CAAoB;IAElC,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,aAAa;IAIrB,KAAK;IAIL,IAAI;IAIJ;;;;OAIG;IAEH,OAAO,CAAC,cAAc,CAAS;IAE/B,UAAU,CAAC,OAAO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OAAO,CAAC,aAAa,CAAM;IAE3B,2DAA2D;IAE3D,OAAO,CAAC,aAAa,CAAS;IAE9B;;;;OAIG;IAEH,OAAO,CAAC,cAAc,CAAS;IAE/B,iBAAiB;IAKjB,qCAAqC;IACrC,IAAI,IAAI,2BAEP;IAED,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY;IAI5B,IAAI;IAIJ,iBAAiB;IAIjB,oBAAoB,CAAC,QAAQ,EAAE,OAAO;IAItC,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,GAAG,IAAI;IAI/D,UAAU,CAAC,OAAO,EAAE,cAAc;IAMlC,OAAO,CAAC,OAAO,EAAE,cAAc;IAe/B,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,aAAa;IAIrB,MAAM;CAkFP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,OAAO,CAAC;KACrB;CACF"}
@@ -28,8 +28,8 @@ figma.connect("https://www.figma.com/design/q9ZYrOj2w9DrTVmgQFU7bu/OHDS?node-id=
28
28
  value="${props.value}"
29
29
  placeholder="${props.showPlaceholder ? props.placeholder : ""}"
30
30
  ?required="${props.required}"
31
- helpertext="${props.helperText}"
32
- errortext="${props.errorText}"
31
+ helper-text="${props.helperText}"
32
+ error-text="${props.errorText}"
33
33
  ></oh-input>
34
34
  `,
35
35
  });
@@ -1 +1 @@
1
- {"version":3,"file":"oh-input.figma.js","sourceRoot":"","sources":["../src/oh-input.figma.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEvD;;;;;;;;;;;;GAYG;AAEH,KAAK,CAAC,OAAO,CACX,uEAAuE,EACvE;IACE,KAAK,EAAE;QACL,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;QAC5B,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;QAC5B,eAAe,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