@atomic-ui/ui 0.1.4 → 0.1.7

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 (141) hide show
  1. package/README.md +30 -6
  2. package/dist/base/FieldElement.d.ts +7 -0
  3. package/dist/base/tokens.d.ts +23 -1
  4. package/dist/chunk-2YQA3VBY.js +85 -0
  5. package/dist/chunk-2YQA3VBY.js.map +1 -0
  6. package/dist/{chunk-LFOWTFMR.js → chunk-4HU4Y23Q.js} +3 -3
  7. package/dist/chunk-5EA4IDUD.js +177 -0
  8. package/dist/chunk-5EA4IDUD.js.map +1 -0
  9. package/dist/{chunk-3OSL2HMN.js → chunk-6ICOJPMD.js} +7 -5
  10. package/dist/chunk-6ICOJPMD.js.map +1 -0
  11. package/dist/{chunk-ZXCSQ6MK.js → chunk-7BIQ3K6H.js} +10 -2
  12. package/dist/chunk-7BIQ3K6H.js.map +1 -0
  13. package/dist/chunk-7Y6UCSUS.js +361 -0
  14. package/dist/chunk-7Y6UCSUS.js.map +1 -0
  15. package/dist/chunk-BTGCUONV.js +56 -0
  16. package/dist/chunk-BTGCUONV.js.map +1 -0
  17. package/dist/{chunk-QYHWR6C5.js → chunk-C36CZRHK.js} +20 -7
  18. package/dist/chunk-C36CZRHK.js.map +1 -0
  19. package/dist/{chunk-MAMBT7BZ.js → chunk-CMAU4DSB.js} +21 -7
  20. package/dist/chunk-CMAU4DSB.js.map +1 -0
  21. package/dist/{chunk-HWNY6U5F.js → chunk-G6OVKNL7.js} +2 -2
  22. package/dist/{chunk-6UDDZQDK.js → chunk-GO2IBRFP.js} +3 -3
  23. package/dist/chunk-GO2IBRFP.js.map +1 -0
  24. package/dist/{chunk-PDXOPY22.js → chunk-GSCVG2ER.js} +3 -3
  25. package/dist/{chunk-IBTOZOGI.js → chunk-HWWA27DN.js} +2 -2
  26. package/dist/chunk-MLVUMCQ2.js +167 -0
  27. package/dist/chunk-MLVUMCQ2.js.map +1 -0
  28. package/dist/{chunk-A4CJ2F3J.js → chunk-MOEMFL4K.js} +21 -7
  29. package/dist/chunk-MOEMFL4K.js.map +1 -0
  30. package/dist/{chunk-OBCSDZHP.js → chunk-NQKYHILD.js} +3 -3
  31. package/dist/{chunk-5NUF7ZQA.js → chunk-NTNXHLTM.js} +24 -3
  32. package/dist/chunk-NTNXHLTM.js.map +1 -0
  33. package/dist/{chunk-4Y3HJBJY.js → chunk-OB7LC6NJ.js} +3 -2
  34. package/dist/chunk-OB7LC6NJ.js.map +1 -0
  35. package/dist/chunk-QCNT7D5V.js +549 -0
  36. package/dist/chunk-QCNT7D5V.js.map +1 -0
  37. package/dist/{chunk-CGMDIZPO.js → chunk-QDNI54ON.js} +3 -3
  38. package/dist/chunk-T6L3USBZ.js +245 -0
  39. package/dist/chunk-T6L3USBZ.js.map +1 -0
  40. package/dist/{chunk-TZD7IVVQ.js → chunk-TPF4MOMF.js} +8 -3
  41. package/dist/chunk-TPF4MOMF.js.map +1 -0
  42. package/dist/{chunk-S3EQO33M.js → chunk-VTFCTWSX.js} +6 -4
  43. package/dist/chunk-VTFCTWSX.js.map +1 -0
  44. package/dist/{chunk-2RBYVWZT.js → chunk-VWNBB7FW.js} +5 -3
  45. package/dist/chunk-VWNBB7FW.js.map +1 -0
  46. package/dist/{chunk-DIZCGSJA.js → chunk-WECSVHIM.js} +15 -3
  47. package/dist/chunk-WECSVHIM.js.map +1 -0
  48. package/dist/chunk-X7IPZPTG.js +710 -0
  49. package/dist/chunk-X7IPZPTG.js.map +1 -0
  50. package/dist/{chunk-TIKX5POO.js → chunk-XJP45LFA.js} +55 -28
  51. package/dist/chunk-XJP45LFA.js.map +1 -0
  52. package/dist/{chunk-6MLXFFH4.js → chunk-XVKEM5JY.js} +3 -3
  53. package/dist/chunk-XVKEM5JY.js.map +1 -0
  54. package/dist/chunk-ZBLTU67D.js +424 -0
  55. package/dist/chunk-ZBLTU67D.js.map +1 -0
  56. package/dist/{chunk-4KFHQBH2.js → chunk-ZGAOMRYD.js} +17 -4
  57. package/dist/chunk-ZGAOMRYD.js.map +1 -0
  58. package/dist/chunk-ZQJD4YEJ.js +195 -0
  59. package/dist/chunk-ZQJD4YEJ.js.map +1 -0
  60. package/dist/components/accordion.js +2 -2
  61. package/dist/components/alert.js +2 -2
  62. package/dist/components/app-ui.d.ts +421 -0
  63. package/dist/components/app-ui.js +26 -0
  64. package/dist/components/app-ui.js.map +1 -0
  65. package/dist/components/blocks.d.ts +174 -0
  66. package/dist/components/blocks.js +17 -0
  67. package/dist/components/blocks.js.map +1 -0
  68. package/dist/components/button.d.ts +33 -0
  69. package/dist/components/button.js +3 -2
  70. package/dist/components/checkbox-group.js +3 -3
  71. package/dist/components/checkbox.js +3 -3
  72. package/dist/components/date-input.js +3 -3
  73. package/dist/components/dialog.js +2 -2
  74. package/dist/components/fieldset.d.ts +49 -0
  75. package/dist/components/fieldset.js +8 -0
  76. package/dist/components/fieldset.js.map +1 -0
  77. package/dist/components/grid.d.ts +3 -3
  78. package/dist/components/grid.js +2 -2
  79. package/dist/components/help.js +2 -2
  80. package/dist/components/icon.d.ts +89 -0
  81. package/dist/components/icon.js +14 -0
  82. package/dist/components/icon.js.map +1 -0
  83. package/dist/components/layout.d.ts +75 -7
  84. package/dist/components/layout.js +2 -2
  85. package/dist/components/link.d.ts +11 -0
  86. package/dist/components/link.js +3 -2
  87. package/dist/components/marketing.d.ts +370 -0
  88. package/dist/components/marketing.js +21 -0
  89. package/dist/components/marketing.js.map +1 -0
  90. package/dist/components/media.d.ts +12 -0
  91. package/dist/components/media.js +2 -2
  92. package/dist/components/navigation.d.ts +98 -0
  93. package/dist/components/navigation.js +11 -0
  94. package/dist/components/navigation.js.map +1 -0
  95. package/dist/components/organisms.d.ts +547 -0
  96. package/dist/components/organisms.js +25 -0
  97. package/dist/components/organisms.js.map +1 -0
  98. package/dist/components/page.d.ts +130 -0
  99. package/dist/components/page.js +10 -0
  100. package/dist/components/page.js.map +1 -0
  101. package/dist/components/price.d.ts +5 -0
  102. package/dist/components/price.js +2 -2
  103. package/dist/components/progress.js +2 -2
  104. package/dist/components/property.d.ts +389 -0
  105. package/dist/components/property.js +19 -0
  106. package/dist/components/property.js.map +1 -0
  107. package/dist/components/radio-group.js +3 -3
  108. package/dist/components/select.d.ts +6 -0
  109. package/dist/components/select.js +3 -3
  110. package/dist/components/summary-list.js +2 -2
  111. package/dist/components/table.js +2 -2
  112. package/dist/components/text-input.d.ts +6 -0
  113. package/dist/components/text-input.js +3 -3
  114. package/dist/components/textarea.d.ts +6 -0
  115. package/dist/components/textarea.js +3 -3
  116. package/dist/index.d.ts +9 -0
  117. package/dist/index.js +140 -36
  118. package/package.json +2 -2
  119. package/dist/chunk-2RBYVWZT.js.map +0 -1
  120. package/dist/chunk-3OSL2HMN.js.map +0 -1
  121. package/dist/chunk-4KFHQBH2.js.map +0 -1
  122. package/dist/chunk-4Y3HJBJY.js.map +0 -1
  123. package/dist/chunk-5NUF7ZQA.js.map +0 -1
  124. package/dist/chunk-6MLXFFH4.js.map +0 -1
  125. package/dist/chunk-6UDDZQDK.js.map +0 -1
  126. package/dist/chunk-A4CJ2F3J.js.map +0 -1
  127. package/dist/chunk-DIZCGSJA.js.map +0 -1
  128. package/dist/chunk-GGODB3GY.js +0 -172
  129. package/dist/chunk-GGODB3GY.js.map +0 -1
  130. package/dist/chunk-MAMBT7BZ.js.map +0 -1
  131. package/dist/chunk-QYHWR6C5.js.map +0 -1
  132. package/dist/chunk-S3EQO33M.js.map +0 -1
  133. package/dist/chunk-TIKX5POO.js.map +0 -1
  134. package/dist/chunk-TZD7IVVQ.js.map +0 -1
  135. package/dist/chunk-ZXCSQ6MK.js.map +0 -1
  136. /package/dist/{chunk-LFOWTFMR.js.map → chunk-4HU4Y23Q.js.map} +0 -0
  137. /package/dist/{chunk-HWNY6U5F.js.map → chunk-G6OVKNL7.js.map} +0 -0
  138. /package/dist/{chunk-PDXOPY22.js.map → chunk-GSCVG2ER.js.map} +0 -0
  139. /package/dist/{chunk-IBTOZOGI.js.map → chunk-HWWA27DN.js.map} +0 -0
  140. /package/dist/{chunk-OBCSDZHP.js.map → chunk-NQKYHILD.js.map} +0 -0
  141. /package/dist/{chunk-CGMDIZPO.js.map → chunk-QDNI54ON.js.map} +0 -0
package/README.md CHANGED
@@ -24,16 +24,40 @@ In React, from `@atomic-ui/ui-react`:
24
24
 
25
25
  ## What is here
26
26
 
27
- Twenty-four elements.
27
+ Sixty-four elements.
28
28
 
29
29
  | Group | Elements |
30
30
  | --- | --- |
31
- | Layout and type | `impkt-grid`, `impkt-stack`, `impkt-card`, `impkt-heading`, `impkt-text` |
32
- | Actions | `impkt-button`, `impkt-link` |
33
- | Form controls | `impkt-text-input`, `impkt-textarea`, `impkt-select`, `impkt-checkbox`, `impkt-checkbox-group`, `impkt-radio-group`, `impkt-date-input` |
31
+ | The page frame | `impkt-page`, `impkt-section` |
32
+ | Layout and type | `impkt-grid`, `impkt-stack`, `impkt-card`, `impkt-heading`, `impkt-text`, `impkt-divider`, `impkt-spacer`, `impkt-visually-hidden` |
33
+ | Navigation and actions | `impkt-nav`, `impkt-breadcrumbs`, `impkt-button`, `impkt-link` |
34
+ | Marketing blocks | `impkt-hero`, `impkt-feature-list`, `impkt-card-grid`, `impkt-quote`, `impkt-stat`, `impkt-badge` |
35
+ | Organisms | `impkt-carousel`, `impkt-gallery`, `impkt-logo-cloud`, `impkt-steps`, `impkt-media-split`, `impkt-cta-banner`, `impkt-reviews`, `impkt-newsletter` |
36
+ | App | `impkt-drawer`, `impkt-toast`, `impkt-menu`, `impkt-pagination`, `impkt-avatar`, `impkt-avatar-group`, `impkt-empty-state`, `impkt-slot-picker` |
37
+ | Property | `impkt-site-plan`, `impkt-mortgage-calculator`, `impkt-before-after`, `impkt-sticky-bar`, `impkt-location-card` |
38
+ | Form controls | `impkt-text-input`, `impkt-textarea`, `impkt-select`, `impkt-checkbox`, `impkt-checkbox-group`, `impkt-radio-group`, `impkt-date-input`, `impkt-fieldset` |
34
39
  | Feedback | `impkt-alert`, `impkt-dialog` |
35
- | Content | `impkt-summary-list`, `impkt-table`, `impkt-accordion`, `impkt-progress`, `impkt-price` |
36
- | Media | `impkt-image`, `impkt-logo`, `impkt-document-link` |
40
+ | Content | `impkt-summary-list`, `impkt-table`, `impkt-accordion`, `impkt-tabs`, `impkt-progress`, `impkt-price` |
41
+ | Media | `impkt-image`, `impkt-logo`, `impkt-icon`, `impkt-document-link` |
42
+
43
+ **A layout puts `impkt-page` at its root.** It gives a page the brand's page width
44
+ (`layout.page-width`), its side margins on a phone, tablet and desktop
45
+ (`layout.margin.*`), the header, main and footer landmarks, and a Skip to content link.
46
+ Without it a page runs edge to edge. `impkt-section` is a band across the whole width
47
+ of the screen with the content kept to the page width inside it.
48
+
49
+ **Everything sits on one set of scales,** derived from the brand:
50
+
51
+ - **Space** in quarter steps of the brand's base unit: `space(1)` is 4px, `space(4)` 16px, `space(12)` 48px, with half steps at the small end. Every gap, padding and margin is one of them, so things line up.
52
+ - **Type** from `xs` (12px) to `6xl` (60px) against a 16px base, each size with its own line height (`type('xl')` sets both). Display sizes are drawn slightly tighter and move with the brand's ratio.
53
+ - **Radii** from `xs` to `3xl` in steps of the brand's base, and **shadows** from `xs` to `xl`, tinted with the text colour.
54
+ - **Hairlines** (`t.hairline`, `t.rule`) are the text colour at 10% and 15%, for card rings and quiet borders. Form controls keep the contrast-checked border, because their edges must be visible (1.4.11).
55
+
56
+ Controls share sizes: a button and a field are both 40px tall at the default size, 32px small and 48px large.
57
+
58
+ **Icons come from one set**, `ICONS`, drawn on a 24 by 24 grid in the current text
59
+ colour, so every icon matches the line weight of the ones beside it. An icon is
60
+ decorative unless it is given a `label`.
37
61
 
38
62
  Bindings: [`@atomic-ui/ui-react`](../ui-react), [`@atomic-ui/ui-vue`](../ui-vue),
39
63
  [`@atomic-ui/ui-angular`](../ui-angular). Each is thin and each exists for a different
@@ -15,6 +15,13 @@ import { ImpktElement } from './ImpktElement';
15
15
  * outside could not describe it. Keeping the whole relationship in one tree is
16
16
  * what makes the wiring work at all.
17
17
  */
18
+ /**
19
+ * How wide a single-line control is, from what it holds: a postcode is short,
20
+ * an email address is long. A width that matches the answer is a hint about
21
+ * what to type (1.3.5 is about the purpose, this is about the size). Applied by
22
+ * the controls that take a `width`, through `--impkt-field-width`.
23
+ */
24
+ export declare const fieldWidths: import("lit").CSSResult;
18
25
  export declare abstract class FieldElement extends ImpktElement {
19
26
  /** Form controls participate in a `<form>` like native ones. */
20
27
  static formAssociated: boolean;
@@ -59,8 +59,30 @@ export declare const t: {
59
59
  readonly radiusLg: CSSResult;
60
60
  readonly borderThin: CSSResult;
61
61
  readonly borderThick: CSSResult;
62
+ readonly radiusXs: CSSResult;
63
+ readonly radiusXl: CSSResult;
64
+ readonly radius2xl: CSSResult;
65
+ /** Hairline borders and rings, from the text colour, so they suit any surface. */
66
+ readonly hairline: CSSResult;
67
+ readonly rule: CSSResult;
68
+ /** A wash of the text colour, for hover and pressed states on quiet controls. */
69
+ readonly wash: CSSResult;
70
+ /** The brand at a fifth, for focus halos round fields. */
71
+ readonly brandHalo: CSSResult;
72
+ readonly shadowXs: CSSResult;
73
+ readonly shadowSm: CSSResult;
74
+ readonly shadowMd: CSSResult;
75
+ readonly shadowLg: CSSResult;
76
+ readonly shadowXl: CSSResult;
77
+ readonly trackingTight: CSSResult;
78
+ readonly trackingWide: CSSResult;
62
79
  };
63
- /** `space.3` → the custom property. Spacing is always a token, never a number. */
80
+ /**
81
+ * A size on the type scale with its own line height, so text drawn at
82
+ * `type('xl')` has the leading that size reads best at.
83
+ */
84
+ export declare const type: (name: string) => CSSResult;
85
+ /** `space(3)` → `space.3`, `space(0.5)` → `space.0-5`. Spacing is always a token, never a number. */
64
86
  export declare const space: (step: number) => CSSResult;
65
87
  /** `font.size.lg` → the custom property. */
66
88
  export declare const fontSize: (name: string) => CSSResult;
@@ -0,0 +1,85 @@
1
+ import {
2
+ ImpktElement,
3
+ t
4
+ } from "./chunk-NTNXHLTM.js";
5
+
6
+ // packages/ui/src/components/icon.ts
7
+ import { css, html, nothing, svg } from "lit";
8
+ var ICONS = {
9
+ "arrow-right": svg`<path d="M5 12h14M13 6l6 6-6 6"/>`,
10
+ "arrow-left": svg`<path d="M19 12H5M11 6l-6 6 6 6"/>`,
11
+ "chevron-right": svg`<path d="M9 6l6 6-6 6"/>`,
12
+ "chevron-down": svg`<path d="M6 9l6 6 6-6"/>`,
13
+ check: svg`<path d="M5 12.5l4.5 4.5L19 7"/>`,
14
+ close: svg`<path d="M6 6l12 12M18 6L6 18"/>`,
15
+ menu: svg`<path d="M4 7h16M4 12h16M4 17h16"/>`,
16
+ plus: svg`<path d="M12 5v14M5 12h14"/>`,
17
+ minus: svg`<path d="M5 12h14"/>`,
18
+ search: svg`<circle cx="11" cy="11" r="6.5"/><path d="M16 16l4 4"/>`,
19
+ external: svg`<path d="M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"/>`,
20
+ download: svg`<path d="M12 4v11M7 10l5 5 5-5M5 20h14"/>`,
21
+ home: svg`<path d="M4 11l8-7 8 7M6 9.5V20h12V9.5"/><path d="M10 20v-6h4v6"/>`,
22
+ phone: svg`<path d="M7 3.5h3l1.5 4-2 1.5a11 11 0 0 0 5.5 5.5l1.5-2 4 1.5v3a2 2 0 0 1-2 2A16 16 0 0 1 5 5.5a2 2 0 0 1 2-2z"/>`,
23
+ mail: svg`<rect x="3.5" y="5.5" width="17" height="13" rx="1.5"/><path d="M4 7l8 6 8-6"/>`,
24
+ "map-pin": svg`<path d="M12 21s-6.5-6-6.5-11a6.5 6.5 0 0 1 13 0c0 5-6.5 11-6.5 11z"/><circle cx="12" cy="10" r="2.5"/>`,
25
+ calendar: svg`<rect x="4" y="5.5" width="16" height="14.5" rx="1.5"/><path d="M4 10h16M8.5 3.5v4M15.5 3.5v4"/>`,
26
+ clock: svg`<circle cx="12" cy="12" r="8.5"/><path d="M12 7.5V12l3 2"/>`,
27
+ user: svg`<circle cx="12" cy="8.5" r="3.5"/><path d="M5 20a7 7 0 0 1 14 0"/>`,
28
+ star: svg`<path d="M12 4l2.4 5 5.4.6-4 3.7 1.1 5.4L12 16l-4.9 2.7 1.1-5.4-4-3.7 5.4-.6z"/>`,
29
+ heart: svg`<path d="M12 19.5s-7.5-4.6-7.5-10A4 4 0 0 1 12 7a4 4 0 0 1 7.5 2.5c0 5.4-7.5 10-7.5 10z"/>`,
30
+ shield: svg`<path d="M12 3.5l7 2.5v5.5c0 4.5-3 7.8-7 9-4-1.2-7-4.5-7-9V6z"/><path d="M9 12l2 2 4-4"/>`,
31
+ leaf: svg`<path d="M5 19c0-8 5-13 14-14 0 9-5 14-13 14z"/><path d="M5 19l7-7"/>`,
32
+ sun: svg`<circle cx="12" cy="12" r="3.5"/><path d="M12 3v2M12 19v2M3 12h2M19 12h2M5.6 5.6L7 7M17 17l1.4 1.4M5.6 18.4L7 17M17 7l1.4-1.4"/>`,
33
+ bolt: svg`<path d="M13 3L5 13.5h6L10 21l8-10.5h-6z"/>`,
34
+ key: svg`<circle cx="8" cy="15" r="3.5"/><path d="M10.5 12.5L19 4M16 7l2.5 2.5M14 9l2 2"/>`,
35
+ info: svg`<circle cx="12" cy="12" r="8.5"/><path d="M12 11v5.5M12 7.5v.5"/>`,
36
+ warning: svg`<path d="M12 4l9 15.5H3z"/><path d="M12 10v4M12 16.5v.5"/>`,
37
+ document: svg`<path d="M6 3.5h8l4 4V20a.5.5 0 0 1-.5.5h-11A.5.5 0 0 1 6 20z"/><path d="M14 3.5V8h4M9 13h6M9 16.5h6"/>`,
38
+ pound: svg`<path d="M16 6.5a3.5 3.5 0 0 0-6.5 1.8V20M7 13h7M7 20h10"/>`,
39
+ chat: svg`<path d="M4.5 5.5h15v10h-9l-4 3.5v-3.5h-2z"/>`
40
+ };
41
+ var ICON_NAMES = Object.keys(ICONS);
42
+ function iconSvg(name, size = "1.25em") {
43
+ const shape = name ? ICONS[name] : void 0;
44
+ if (!shape) return nothing;
45
+ return html`<svg class="icon" viewBox="0 0 24 24" width=${size} height=${size} fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${shape}</svg>`;
46
+ }
47
+ var ImpktIcon = class extends ImpktElement {
48
+ static {
49
+ this.properties = {
50
+ name: { type: String, reflect: true },
51
+ label: { type: String },
52
+ size: { type: String, reflect: true },
53
+ tone: { type: String, reflect: true }
54
+ };
55
+ }
56
+ constructor() {
57
+ super();
58
+ this.name = "star";
59
+ this.label = "";
60
+ this.size = "md";
61
+ this.tone = "inherit";
62
+ }
63
+ static {
64
+ this.styles = [...ImpktElement.styles, css`
65
+ :host { display: inline-flex; vertical-align: middle; line-height: 0; }
66
+ :host([tone='brand']) { color: ${t.brand}; }
67
+ :host([tone='muted']) { color: ${t.textMuted}; }
68
+ @media (forced-colors: active) { :host { color: CanvasText; } }
69
+ `];
70
+ }
71
+ render() {
72
+ const size = { sm: "16px", md: "24px", lg: "32px", xl: "48px" }[this.size] ?? "24px";
73
+ const drawn = iconSvg(this.name, size);
74
+ return this.label ? html`<span role="img" aria-label=${this.label}>${drawn}</span>` : html`${drawn}`;
75
+ }
76
+ };
77
+ customElements.define("impkt-icon", ImpktIcon);
78
+
79
+ export {
80
+ ICONS,
81
+ ICON_NAMES,
82
+ iconSvg,
83
+ ImpktIcon
84
+ };
85
+ //# sourceMappingURL=chunk-2YQA3VBY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/icon.ts"],"sourcesContent":["import { css, html, nothing, svg, type SVGTemplateResult, type TemplateResult } from 'lit';\nimport { ImpktElement } from '../base/ImpktElement';\nimport { t } from '../base/tokens';\n\n/**\n * The icons the library draws, each on a 24 by 24 grid in strokes of the\n * current text colour. Kept to a set the components need and editors reach\n * for, so an icon always matches the line weight of the ones beside it.\n */\nexport const ICONS = {\n 'arrow-right': svg`<path d=\"M5 12h14M13 6l6 6-6 6\"/>`,\n 'arrow-left': svg`<path d=\"M19 12H5M11 6l-6 6 6 6\"/>`,\n 'chevron-right': svg`<path d=\"M9 6l6 6-6 6\"/>`,\n 'chevron-down': svg`<path d=\"M6 9l6 6 6-6\"/>`,\n check: svg`<path d=\"M5 12.5l4.5 4.5L19 7\"/>`,\n close: svg`<path d=\"M6 6l12 12M18 6L6 18\"/>`,\n menu: svg`<path d=\"M4 7h16M4 12h16M4 17h16\"/>`,\n plus: svg`<path d=\"M12 5v14M5 12h14\"/>`,\n minus: svg`<path d=\"M5 12h14\"/>`,\n search: svg`<circle cx=\"11\" cy=\"11\" r=\"6.5\"/><path d=\"M16 16l4 4\"/>`,\n external: svg`<path d=\"M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5\"/>`,\n download: svg`<path d=\"M12 4v11M7 10l5 5 5-5M5 20h14\"/>`,\n home: svg`<path d=\"M4 11l8-7 8 7M6 9.5V20h12V9.5\"/><path d=\"M10 20v-6h4v6\"/>`,\n phone: svg`<path d=\"M7 3.5h3l1.5 4-2 1.5a11 11 0 0 0 5.5 5.5l1.5-2 4 1.5v3a2 2 0 0 1-2 2A16 16 0 0 1 5 5.5a2 2 0 0 1 2-2z\"/>`,\n mail: svg`<rect x=\"3.5\" y=\"5.5\" width=\"17\" height=\"13\" rx=\"1.5\"/><path d=\"M4 7l8 6 8-6\"/>`,\n 'map-pin': svg`<path d=\"M12 21s-6.5-6-6.5-11a6.5 6.5 0 0 1 13 0c0 5-6.5 11-6.5 11z\"/><circle cx=\"12\" cy=\"10\" r=\"2.5\"/>`,\n calendar: svg`<rect x=\"4\" y=\"5.5\" width=\"16\" height=\"14.5\" rx=\"1.5\"/><path d=\"M4 10h16M8.5 3.5v4M15.5 3.5v4\"/>`,\n clock: svg`<circle cx=\"12\" cy=\"12\" r=\"8.5\"/><path d=\"M12 7.5V12l3 2\"/>`,\n user: svg`<circle cx=\"12\" cy=\"8.5\" r=\"3.5\"/><path d=\"M5 20a7 7 0 0 1 14 0\"/>`,\n star: svg`<path d=\"M12 4l2.4 5 5.4.6-4 3.7 1.1 5.4L12 16l-4.9 2.7 1.1-5.4-4-3.7 5.4-.6z\"/>`,\n heart: svg`<path d=\"M12 19.5s-7.5-4.6-7.5-10A4 4 0 0 1 12 7a4 4 0 0 1 7.5 2.5c0 5.4-7.5 10-7.5 10z\"/>`,\n shield: svg`<path d=\"M12 3.5l7 2.5v5.5c0 4.5-3 7.8-7 9-4-1.2-7-4.5-7-9V6z\"/><path d=\"M9 12l2 2 4-4\"/>`,\n leaf: svg`<path d=\"M5 19c0-8 5-13 14-14 0 9-5 14-13 14z\"/><path d=\"M5 19l7-7\"/>`,\n sun: svg`<circle cx=\"12\" cy=\"12\" r=\"3.5\"/><path d=\"M12 3v2M12 19v2M3 12h2M19 12h2M5.6 5.6L7 7M17 17l1.4 1.4M5.6 18.4L7 17M17 7l1.4-1.4\"/>`,\n bolt: svg`<path d=\"M13 3L5 13.5h6L10 21l8-10.5h-6z\"/>`,\n key: svg`<circle cx=\"8\" cy=\"15\" r=\"3.5\"/><path d=\"M10.5 12.5L19 4M16 7l2.5 2.5M14 9l2 2\"/>`,\n info: svg`<circle cx=\"12\" cy=\"12\" r=\"8.5\"/><path d=\"M12 11v5.5M12 7.5v.5\"/>`,\n warning: svg`<path d=\"M12 4l9 15.5H3z\"/><path d=\"M12 10v4M12 16.5v.5\"/>`,\n document: svg`<path d=\"M6 3.5h8l4 4V20a.5.5 0 0 1-.5.5h-11A.5.5 0 0 1 6 20z\"/><path d=\"M14 3.5V8h4M9 13h6M9 16.5h6\"/>`,\n pound: svg`<path d=\"M16 6.5a3.5 3.5 0 0 0-6.5 1.8V20M7 13h7M7 20h10\"/>`,\n chat: svg`<path d=\"M4.5 5.5h15v10h-9l-4 3.5v-3.5h-2z\"/>`,\n} as const satisfies Record<string, SVGTemplateResult>;\n\nexport type IconName = keyof typeof ICONS;\nexport const ICON_NAMES = Object.keys(ICONS) as IconName[];\n\n/** An icon as markup, for components that draw one beside their own words. Always decorative. */\nexport function iconSvg(name: string | undefined, size = '1.25em'): TemplateResult | typeof nothing {\n const shape = name ? ICONS[name as IconName] : undefined;\n if (!shape) return nothing;\n return html`<svg class=\"icon\" viewBox=\"0 0 24 24\" width=${size} height=${size} fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\">${shape}</svg>`;\n}\n\n/**\n * A small picture that stands for something: a phone beside a number, a tick\n * beside a benefit.\n *\n * **An icon is decorative unless it is labelled.** With no `label` it is\n * hidden from screen readers, because the words beside it already say what it\n * means. Give it a label only when it stands alone and carries meaning (1.1.1).\n *\n * @category media\n * @icon star\n */\nexport class ImpktIcon extends ImpktElement {\n static properties = {\n name: { type: String, reflect: true },\n label: { type: String },\n size: { type: String, reflect: true },\n tone: { type: String, reflect: true },\n };\n /** Which icon. */\n declare name: 'arrow-right' | 'arrow-left' | 'chevron-right' | 'chevron-down' | 'check' | 'close' | 'menu' | 'plus' | 'minus' | 'search' | 'external' | 'download' | 'home' | 'phone' | 'mail' | 'map-pin' | 'calendar' | 'clock' | 'user' | 'star' | 'heart' | 'shield' | 'leaf' | 'sun' | 'bolt' | 'key' | 'info' | 'warning' | 'document' | 'pound' | 'chat';\n /** What the icon means, when it stands alone. Leave empty when words beside it say the same. */\n declare label: string;\n declare size: 'sm' | 'md' | 'lg' | 'xl';\n /** The icon's colour. */\n declare tone: 'inherit' | 'brand' | 'muted';\n\n constructor() {\n super();\n this.name = 'star';\n this.label = '';\n this.size = 'md';\n this.tone = 'inherit';\n }\n\n static styles = [...ImpktElement.styles, css`\n :host { display: inline-flex; vertical-align: middle; line-height: 0; }\n :host([tone='brand']) { color: ${t.brand}; }\n :host([tone='muted']) { color: ${t.textMuted}; }\n @media (forced-colors: active) { :host { color: CanvasText; } }\n `];\n\n render(): TemplateResult {\n const size = { sm: '16px', md: '24px', lg: '32px', xl: '48px' }[this.size] ?? '24px';\n const drawn = iconSvg(this.name, size);\n return this.label ? html`<span role=\"img\" aria-label=${this.label}>${drawn}</span>` : html`${drawn}`;\n }\n}\n\ncustomElements.define('impkt-icon', ImpktIcon);\ndeclare global { interface HTMLElementTagNameMap { 'impkt-icon': ImpktIcon } }\n"],"mappings":";;;;;;AAAA,SAAS,KAAK,MAAM,SAAS,WAAwD;AAS9E,IAAM,QAAQ;AAAA,EACnB,eAAe;AAAA,EACf,cAAc;AAAA,EACd,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,UAAU;AAAA,EACV,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AAAA,EACN,WAAW;AAAA,EACX,UAAU;AAAA,EACV,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AAAA,EACN,SAAS;AAAA,EACT,UAAU;AAAA,EACV,OAAO;AAAA,EACP,MAAM;AACR;AAGO,IAAM,aAAa,OAAO,KAAK,KAAK;AAGpC,SAAS,QAAQ,MAA0B,OAAO,UAA2C;AAClG,QAAM,QAAQ,OAAO,MAAM,IAAgB,IAAI;AAC/C,MAAI,CAAC,MAAO,QAAO;AACnB,SAAO,mDAAmD,IAAI,WAAW,IAAI,8IAA8I,KAAK;AAClO;AAaO,IAAM,YAAN,cAAwB,aAAa;AAAA,EAC1C;AAAA,SAAO,aAAa;AAAA,MAClB,MAAM,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACpC,OAAO,EAAE,MAAM,OAAO;AAAA,MACtB,MAAM,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACpC,MAAM,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,IACtC;AAAA;AAAA,EASA,cAAc;AACZ,UAAM;AACN,SAAK,OAAO;AACZ,SAAK,QAAQ;AACb,SAAK,OAAO;AACZ,SAAK,OAAO;AAAA,EACd;AAAA,EAEA;AAAA,SAAO,SAAS,CAAC,GAAG,aAAa,QAAQ;AAAA;AAAA,qCAEN,EAAE,KAAK;AAAA,qCACP,EAAE,SAAS;AAAA;AAAA,GAE7C;AAAA;AAAA,EAED,SAAyB;AACvB,UAAM,OAAO,EAAE,IAAI,QAAQ,IAAI,QAAQ,IAAI,QAAQ,IAAI,OAAO,EAAE,KAAK,IAAI,KAAK;AAC9E,UAAM,QAAQ,QAAQ,KAAK,MAAM,IAAI;AACrC,WAAO,KAAK,QAAQ,mCAAmC,KAAK,KAAK,IAAI,KAAK,YAAY,OAAO,KAAK;AAAA,EACpG;AACF;AAEA,eAAe,OAAO,cAAc,SAAS;","names":[]}
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  FieldElement
3
- } from "./chunk-ZXCSQ6MK.js";
3
+ } from "./chunk-7BIQ3K6H.js";
4
4
  import {
5
5
  fontSize,
6
6
  space,
7
7
  t,
8
8
  targetSize
9
- } from "./chunk-5NUF7ZQA.js";
9
+ } from "./chunk-NTNXHLTM.js";
10
10
 
11
11
  // packages/ui/src/components/checkbox.ts
12
12
  import { html, css, nothing } from "lit";
@@ -85,4 +85,4 @@ customElements.define("impkt-checkbox", ImpktCheckbox);
85
85
  export {
86
86
  ImpktCheckbox
87
87
  };
88
- //# sourceMappingURL=chunk-LFOWTFMR.js.map
88
+ //# sourceMappingURL=chunk-4HU4Y23Q.js.map
@@ -0,0 +1,177 @@
1
+ import {
2
+ ImpktElement,
3
+ focusRing,
4
+ space,
5
+ spaceAround,
6
+ t,
7
+ token
8
+ } from "./chunk-NTNXHLTM.js";
9
+
10
+ // packages/ui/src/components/page.ts
11
+ import { css, html, nothing } from "lit";
12
+ var widths = css`
13
+ :host { --impkt-page-inner: ${token("layout.page-width", "1200px")}; }
14
+ :host([width='narrow']) { --impkt-page-inner: 760px; }
15
+ :host([width='wide']) { --impkt-page-inner: 1440px; }
16
+ `;
17
+ var margins = css`
18
+ :host { --impkt-page-margin: ${token("layout.margin.phone", "16px")}; }
19
+ @container impkt-page (min-width: 40rem) { .frame { --impkt-page-margin: ${token("layout.margin.tablet", "32px")}; } }
20
+ @container impkt-page (min-width: 64rem) { .frame { --impkt-page-margin: ${token("layout.margin.desktop", "64px")}; } }
21
+ `;
22
+ var ImpktPage = class extends ImpktElement {
23
+ constructor() {
24
+ super();
25
+ /**
26
+ * The header floats when the page opens on a full-picture hero, sitting on the
27
+ * picture itself, so nothing has to be set for it. It stays an ordinary bar
28
+ * while editing, where the blocks are kept inside the page's box.
29
+ */
30
+ this.place = () => {
31
+ const hero = this.querySelector('impkt-hero[treatment="cover"]');
32
+ const editing = getComputedStyle(this).getPropertyValue("--impkt-bleed").trim() === "0";
33
+ const floats = !!hero && !editing && this.opensOn(hero);
34
+ this.toggleAttribute("floating", floats);
35
+ if (!floats) return;
36
+ const frame = this.renderRoot.querySelector(".frame");
37
+ if (frame) this.style.setProperty("--impkt-header-top", `${Math.round(hero.getBoundingClientRect().top - frame.getBoundingClientRect().top)}px`);
38
+ };
39
+ this.width = "standard";
40
+ this.stickyHeader = false;
41
+ this.skipText = "Skip to content";
42
+ }
43
+ static {
44
+ this.properties = {
45
+ width: { type: String, reflect: true },
46
+ stickyHeader: { type: Boolean, reflect: true, attribute: "sticky-header" },
47
+ skipText: { type: String, attribute: "skip-text" }
48
+ };
49
+ }
50
+ static {
51
+ this.styles = [...ImpktElement.styles, focusRing, widths, margins, css`
52
+ :host { display: block; container: impkt-page / inline-size; }
53
+ .frame { position: relative; display: flex; flex-direction: column; min-block-size: 100%; overflow-x: clip; }
54
+ .inner { box-sizing: border-box; inline-size: 100%; max-inline-size: calc(var(--impkt-page-inner) + 2 * var(--impkt-page-margin)); margin-inline: auto; padding-inline: var(--impkt-page-margin); }
55
+ header { background: ${token("color.surface.header", "transparent")}; color: ${token("color.text.on-header", "inherit")}; padding-block: ${space(4)}; }
56
+ /* What sits in the header and footer takes their text colour, so words on a dark footer stay readable. */
57
+ header { --impkt-color-text-default: ${token("color.text.on-header", "inherit")}; --impkt-color-text-heading: ${token("color.text.on-header", "inherit")}; }
58
+ footer { --impkt-color-text-default: ${token("color.text.on-footer", "inherit")}; --impkt-color-text-heading: ${token("color.text.on-footer", "inherit")}; --impkt-color-text-muted: ${token("color.text.on-footer", "inherit")}; --impkt-color-text-link: ${token("color.text.on-footer", "inherit")}; --impkt-color-text-link-hover: ${token("color.text.on-footer", "inherit")}; }
59
+ :host([sticky-header]) header { position: sticky; inset-block-start: 0; z-index: 10; }
60
+ main { flex: 1; padding-block: ${space(6)} ${space(10)}; }
61
+ main:focus { outline: none; }
62
+ /* A page that opens on a full-picture hero: the header floats over it as a rounded bar. */
63
+ :host([floating]) header { position: absolute; z-index: 20; inset-inline: 0; inset-block-start: var(--impkt-header-top, 0px); padding-block: ${space(6)} 0; background: transparent; border: 0; }
64
+ :host([floating]) header .inner { inline-size: calc(100% - 2 * var(--impkt-page-margin)); max-inline-size: var(--impkt-page-inner); padding: ${space(3)} ${space(4)} ${space(3)} ${space(6)}; background: ${token("color.surface.header", "#fff")}; border-radius: ${t.radius2xl}; box-shadow: ${t.shadowLg}; }
65
+ :host([floating]) main { padding-block-start: 0; }
66
+ footer { background: ${token("color.surface.footer", "transparent")}; color: ${token("color.text.on-footer", "inherit")}; padding-block: ${space(8)}; border-block-start: ${t.borderThin} solid ${token("color.border.subtle", "transparent")}; }
67
+ .skip { position: absolute; inset-inline-start: ${space(2)}; inset-block-start: ${space(2)}; z-index: 20; padding: ${space(2)} ${space(4)}; background: ${t.surfaceCard}; color: ${t.link}; border-radius: ${t.radius}; transform: translateY(-200%); }
68
+ .skip:not(:focus) { clip-path: inset(50%); }
69
+ .skip:focus { transform: none; }
70
+ .empty { display: none; }
71
+ `];
72
+ }
73
+ hasSlot(name) {
74
+ return Array.from(this.children).some((c) => c.getAttribute("slot") === name);
75
+ }
76
+ skip(event) {
77
+ event.preventDefault();
78
+ const main = this.renderRoot.querySelector("main");
79
+ main?.focus();
80
+ main?.scrollIntoView();
81
+ }
82
+ render() {
83
+ const header = this.hasSlot("header");
84
+ const footer = this.hasSlot("footer");
85
+ return html`<div class="frame" part="frame">
86
+ <a class="skip" href="#content" part="skip" @click=${this.skip}>${this.skipText}</a>
87
+ ${header ? html`<header part="header"><div class="inner"><slot name="header"></slot></div></header>` : nothing}
88
+ <main id="content" tabindex="-1" part="main"><div class="inner"><slot></slot></div></main>
89
+ ${footer ? html`<footer part="footer"><div class="inner"><slot name="footer"></slot></div></footer>` : nothing}
90
+ </div>`;
91
+ }
92
+ /** Whether nothing a reader would notice comes before this block, other than an announcement. */
93
+ opensOn(hero) {
94
+ for (const element of Array.from(this.querySelectorAll("*"))) {
95
+ if (element === hero) return true;
96
+ if (element.closest('[slot="header"],[slot="footer"]')) continue;
97
+ if (element.tagName.startsWith("IMPKT-") && !/^IMPKT-(STACK|SECTION|GRID|ANNOUNCEMENT)$/.test(element.tagName)) return false;
98
+ }
99
+ return false;
100
+ }
101
+ // A header or footer added after the first render still gets its landmark.
102
+ connectedCallback() {
103
+ super.connectedCallback();
104
+ this.observer = new MutationObserver(() => this.requestUpdate());
105
+ this.observer.observe(this, { childList: true, attributes: true, subtree: false, attributeFilter: ["slot"] });
106
+ this.watcher = new MutationObserver(this.place);
107
+ this.watcher.observe(this, { childList: true, subtree: true, attributes: true, attributeFilter: ["treatment"] });
108
+ if (typeof ResizeObserver === "function") {
109
+ this.resize = new ResizeObserver(this.place);
110
+ this.resize.observe(this);
111
+ }
112
+ }
113
+ disconnectedCallback() {
114
+ super.disconnectedCallback();
115
+ this.observer?.disconnect();
116
+ this.watcher?.disconnect();
117
+ this.resize?.disconnect();
118
+ }
119
+ firstUpdated() {
120
+ this.place();
121
+ }
122
+ };
123
+ var ImpktSection = class extends ImpktElement {
124
+ static {
125
+ this.properties = {
126
+ tone: { type: String, reflect: true },
127
+ padding: { type: String, reflect: true },
128
+ width: { type: String, reflect: true },
129
+ bleed: { type: Boolean, reflect: true },
130
+ label: { type: String },
131
+ spaceAbove: { type: String, reflect: true, attribute: "space-above" },
132
+ spaceBelow: { type: String, reflect: true, attribute: "space-below" }
133
+ };
134
+ }
135
+ constructor() {
136
+ super();
137
+ this.tone = "none";
138
+ this.padding = "lg";
139
+ this.width = "standard";
140
+ this.bleed = true;
141
+ this.label = "";
142
+ this.spaceAbove = "none";
143
+ this.spaceBelow = "none";
144
+ }
145
+ static {
146
+ this.styles = [...ImpktElement.styles, spaceAround, widths, css`
147
+ :host { display: block; --impkt-page-margin: inherit; }
148
+ /* What a solid card on a brand band goes back to, since the band repaints these for its own text. */
149
+ :host([tone='brand']) { --impkt-solid-card: ${t.surfaceCard}; --impkt-solid-text: ${t.text}; --impkt-solid-heading: var(--impkt-color-text-heading, ${t.text}); --impkt-solid-muted: ${t.textMuted}; }
150
+ .band { box-sizing: border-box; border-radius: ${t.radiusLg}; }
151
+ /* --impkt-bleed is 0 while editing, so a full-width block stays inside the box it is being edited in. */
152
+ :host([bleed]) .band { border-radius: 0; margin-inline: calc(var(--impkt-bleed, 1) * (50% - 50vw)); padding-inline: max(${space(4)}, calc(var(--impkt-bleed, 1) * (50vw - 50%))); }
153
+ :host([tone='subtle']) .band { background: ${t.surfaceSubtle}; }
154
+ :host([tone='inset']) .band { background: ${t.surfaceInset}; }
155
+ :host([tone='card']) .band { background: ${t.surfaceCard}; }
156
+ :host([tone='brand']) .band { background: ${t.brand}; color: ${t.onBrand}; --impkt-eyebrow: ${t.onBrand}; --impkt-color-surface-card: color-mix(in srgb, ${t.onBrand} 10%, transparent); --impkt-color-text-heading: ${t.onBrand}; --impkt-color-text-default: ${t.onBrand}; --impkt-color-text-muted: ${t.onBrand}; --impkt-color-text-link: ${t.onBrand}; --impkt-color-text-link-hover: ${t.onBrand}; }
157
+ :host(:not([bleed]):not([tone='none'])) .band { padding-inline: ${space(6)}; }
158
+ :host([padding='sm']) .band { padding-block: ${space(4)}; }
159
+ :host([padding='md']) .band { padding-block: ${space(8)}; }
160
+ :host([padding='lg']) .band { padding-block: ${space(12)}; }
161
+ :host([padding='xl']) .band { padding-block: ${space(16)}; }
162
+ :host([padding='2xl']) .band { padding-block: clamp(${space(14)}, 8vw, ${space(28)}); }
163
+ .content { max-inline-size: var(--impkt-page-inner); margin-inline: auto; }
164
+ `];
165
+ }
166
+ render() {
167
+ return html`<section class="band" part="band" aria-label=${this.label || nothing} role=${this.label ? nothing : "presentation"}><div class="content" part="content"><slot></slot></div></section>`;
168
+ }
169
+ };
170
+ customElements.define("impkt-page", ImpktPage);
171
+ customElements.define("impkt-section", ImpktSection);
172
+
173
+ export {
174
+ ImpktPage,
175
+ ImpktSection
176
+ };
177
+ //# sourceMappingURL=chunk-5EA4IDUD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/page.ts"],"sourcesContent":["import { css, html, nothing, type TemplateResult } from 'lit';\nimport { ImpktElement } from '../base/ImpktElement';\nimport { focusRing } from '../base/styles';\nimport { space, spaceAround, t, token } from '../base/tokens';\n\n/** The widest a line of content runs, for each choice of `width`. */\nconst widths = css`\n :host { --impkt-page-inner: ${token('layout.page-width', '1200px')}; }\n :host([width='narrow']) { --impkt-page-inner: 760px; }\n :host([width='wide']) { --impkt-page-inner: 1440px; }\n`;\n\n/**\n * The side margins, from the brand's layout: narrow on a phone, wider on a\n * tablet and a desktop. Measured against the page itself, so a page drawn in a\n * narrow preview gets phone margins whatever the window is.\n */\nconst margins = css`\n :host { --impkt-page-margin: ${token('layout.margin.phone', '16px')}; }\n @container impkt-page (min-width: 40rem) { .frame { --impkt-page-margin: ${token('layout.margin.tablet', '32px')}; } }\n @container impkt-page (min-width: 64rem) { .frame { --impkt-page-margin: ${token('layout.margin.desktop', '64px')}; } }\n`;\n\n/**\n * The frame every page sits in: a header, the page's own content, and a\n * footer, each kept to the brand's page width with the brand's side margins.\n *\n * A layout puts this at its root, with the site's header and footer in their\n * slots and the page content in the middle, so an app draws the same frame the\n * CMS shows. Without it, a page runs edge to edge.\n *\n * **It gives the page its landmarks.** The header, main content and footer are\n * `header`, `main` and `footer` elements, so a screen reader can jump between\n * them (1.3.1), and the first thing in the page is a \"Skip to content\" link\n * that appears when it has focus (2.4.1).\n *\n * @category layout\n * @icon layout\n * @slot header - The site's header: its logo, navigation and a call to action.\n * @slot - The page's own content.\n * @slot footer - The site's footer.\n */\nexport class ImpktPage extends ImpktElement {\n static properties = {\n width: { type: String, reflect: true },\n stickyHeader: { type: Boolean, reflect: true, attribute: 'sticky-header' },\n skipText: { type: String, attribute: 'skip-text' },\n };\n /** How wide the content runs. Standard is the brand's page width. */\n declare width: 'narrow' | 'standard' | 'wide';\n /** Keep the header at the top of the screen while the page scrolls. */\n declare stickyHeader: boolean;\n /** The words of the link that skips past the header to the content. */\n declare skipText: string;\n\n constructor() {\n super();\n this.width = 'standard';\n this.stickyHeader = false;\n this.skipText = 'Skip to content';\n }\n\n static styles = [...ImpktElement.styles, focusRing, widths, margins, css`\n :host { display: block; container: impkt-page / inline-size; }\n .frame { position: relative; display: flex; flex-direction: column; min-block-size: 100%; overflow-x: clip; }\n .inner { box-sizing: border-box; inline-size: 100%; max-inline-size: calc(var(--impkt-page-inner) + 2 * var(--impkt-page-margin)); margin-inline: auto; padding-inline: var(--impkt-page-margin); }\n header { background: ${token('color.surface.header', 'transparent')}; color: ${token('color.text.on-header', 'inherit')}; padding-block: ${space(4)}; }\n /* What sits in the header and footer takes their text colour, so words on a dark footer stay readable. */\n header { --impkt-color-text-default: ${token('color.text.on-header', 'inherit')}; --impkt-color-text-heading: ${token('color.text.on-header', 'inherit')}; }\n footer { --impkt-color-text-default: ${token('color.text.on-footer', 'inherit')}; --impkt-color-text-heading: ${token('color.text.on-footer', 'inherit')}; --impkt-color-text-muted: ${token('color.text.on-footer', 'inherit')}; --impkt-color-text-link: ${token('color.text.on-footer', 'inherit')}; --impkt-color-text-link-hover: ${token('color.text.on-footer', 'inherit')}; }\n :host([sticky-header]) header { position: sticky; inset-block-start: 0; z-index: 10; }\n main { flex: 1; padding-block: ${space(6)} ${space(10)}; }\n main:focus { outline: none; }\n /* A page that opens on a full-picture hero: the header floats over it as a rounded bar. */\n :host([floating]) header { position: absolute; z-index: 20; inset-inline: 0; inset-block-start: var(--impkt-header-top, 0px); padding-block: ${space(6)} 0; background: transparent; border: 0; }\n :host([floating]) header .inner { inline-size: calc(100% - 2 * var(--impkt-page-margin)); max-inline-size: var(--impkt-page-inner); padding: ${space(3)} ${space(4)} ${space(3)} ${space(6)}; background: ${token('color.surface.header', '#fff')}; border-radius: ${t.radius2xl}; box-shadow: ${t.shadowLg}; }\n :host([floating]) main { padding-block-start: 0; }\n footer { background: ${token('color.surface.footer', 'transparent')}; color: ${token('color.text.on-footer', 'inherit')}; padding-block: ${space(8)}; border-block-start: ${t.borderThin} solid ${token('color.border.subtle', 'transparent')}; }\n .skip { position: absolute; inset-inline-start: ${space(2)}; inset-block-start: ${space(2)}; z-index: 20; padding: ${space(2)} ${space(4)}; background: ${t.surfaceCard}; color: ${t.link}; border-radius: ${t.radius}; transform: translateY(-200%); }\n .skip:not(:focus) { clip-path: inset(50%); }\n .skip:focus { transform: none; }\n .empty { display: none; }\n `];\n\n private hasSlot(name: string): boolean {\n return Array.from(this.children).some((c) => c.getAttribute('slot') === name);\n }\n\n private skip(event: Event): void {\n event.preventDefault();\n const main = this.renderRoot.querySelector('main');\n main?.focus();\n main?.scrollIntoView();\n }\n\n render(): TemplateResult {\n // The header and footer are left out when nothing is in them, so a page\n // with no site header has no empty landmark for a screen reader to land on.\n const header = this.hasSlot('header');\n const footer = this.hasSlot('footer');\n return html`<div class=\"frame\" part=\"frame\">\n <a class=\"skip\" href=\"#content\" part=\"skip\" @click=${this.skip}>${this.skipText}</a>\n ${header ? html`<header part=\"header\"><div class=\"inner\"><slot name=\"header\"></slot></div></header>` : nothing}\n <main id=\"content\" tabindex=\"-1\" part=\"main\"><div class=\"inner\"><slot></slot></div></main>\n ${footer ? html`<footer part=\"footer\"><div class=\"inner\"><slot name=\"footer\"></slot></div></footer>` : nothing}\n </div>`;\n }\n\n /**\n * The header floats when the page opens on a full-picture hero, sitting on the\n * picture itself, so nothing has to be set for it. It stays an ordinary bar\n * while editing, where the blocks are kept inside the page's box.\n */\n private place = (): void => {\n const hero = this.querySelector('impkt-hero[treatment=\"cover\"]');\n const editing = getComputedStyle(this).getPropertyValue('--impkt-bleed').trim() === '0';\n const floats = !!hero && !editing && this.opensOn(hero);\n this.toggleAttribute('floating', floats);\n if (!floats) return;\n const frame = this.renderRoot.querySelector('.frame');\n if (frame) this.style.setProperty('--impkt-header-top', `${Math.round(hero!.getBoundingClientRect().top - frame.getBoundingClientRect().top)}px`);\n };\n\n /** Whether nothing a reader would notice comes before this block, other than an announcement. */\n private opensOn(hero: Element): boolean {\n for (const element of Array.from(this.querySelectorAll('*'))) {\n if (element === hero) return true;\n if (element.closest('[slot=\"header\"],[slot=\"footer\"]')) continue;\n if (element.tagName.startsWith('IMPKT-') && !/^IMPKT-(STACK|SECTION|GRID|ANNOUNCEMENT)$/.test(element.tagName)) return false;\n }\n return false;\n }\n\n // A header or footer added after the first render still gets its landmark.\n connectedCallback(): void {\n super.connectedCallback();\n this.observer = new MutationObserver(() => this.requestUpdate());\n this.observer.observe(this, { childList: true, attributes: true, subtree: false, attributeFilter: ['slot'] });\n this.watcher = new MutationObserver(this.place);\n this.watcher.observe(this, { childList: true, subtree: true, attributes: true, attributeFilter: ['treatment'] });\n if (typeof ResizeObserver === 'function') {\n this.resize = new ResizeObserver(this.place);\n this.resize.observe(this);\n }\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n this.watcher?.disconnect();\n this.resize?.disconnect();\n }\n\n protected firstUpdated(): void {\n this.place();\n }\n\n private observer?: MutationObserver;\n private watcher?: MutationObserver;\n private resize?: ResizeObserver;\n}\n\n/**\n * A band across the whole width of the page, with its own background, and its\n * content kept to the page width inside it: a coloured strip of features, a\n * quote on a tinted background, a call to action at the foot of a page.\n *\n * Inside a Page it reaches the edges of the screen whatever the page width is,\n * so a page can alternate bands without any of them knowing the frame. Set\n * `bleed` off to keep the band to the page width, as a panel.\n *\n * @category layout\n * @icon section\n * @slot - The section's content.\n */\nexport class ImpktSection extends ImpktElement {\n static properties = {\n tone: { type: String, reflect: true },\n padding: { type: String, reflect: true },\n width: { type: String, reflect: true },\n bleed: { type: Boolean, reflect: true },\n label: { type: String },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n /** The band's background. Text on it takes the matching colour, so it stays readable. */\n declare tone: 'none' | 'subtle' | 'inset' | 'brand' | 'card';\n /** Space inside the band, above and below its content. */\n declare padding: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** How wide the content inside runs. */\n declare width: 'narrow' | 'standard' | 'wide';\n /** Run the background to the edges of the screen. */\n declare bleed: boolean;\n /** A name for the section, so a screen reader can find it in the page's regions. Leave empty for none. */\n declare label: string;\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n constructor() {\n super();\n this.tone = 'none';\n this.padding = 'lg';\n this.width = 'standard';\n this.bleed = true;\n this.label = '';\n this.spaceAbove = 'none';\n this.spaceBelow = 'none';\n }\n\n static styles = [...ImpktElement.styles, spaceAround, widths, css`\n :host { display: block; --impkt-page-margin: inherit; }\n /* What a solid card on a brand band goes back to, since the band repaints these for its own text. */\n :host([tone='brand']) { --impkt-solid-card: ${t.surfaceCard}; --impkt-solid-text: ${t.text}; --impkt-solid-heading: var(--impkt-color-text-heading, ${t.text}); --impkt-solid-muted: ${t.textMuted}; }\n .band { box-sizing: border-box; border-radius: ${t.radiusLg}; }\n /* --impkt-bleed is 0 while editing, so a full-width block stays inside the box it is being edited in. */\n :host([bleed]) .band { border-radius: 0; margin-inline: calc(var(--impkt-bleed, 1) * (50% - 50vw)); padding-inline: max(${space(4)}, calc(var(--impkt-bleed, 1) * (50vw - 50%))); }\n :host([tone='subtle']) .band { background: ${t.surfaceSubtle}; }\n :host([tone='inset']) .band { background: ${t.surfaceInset}; }\n :host([tone='card']) .band { background: ${t.surfaceCard}; }\n :host([tone='brand']) .band { background: ${t.brand}; color: ${t.onBrand}; --impkt-eyebrow: ${t.onBrand}; --impkt-color-surface-card: color-mix(in srgb, ${t.onBrand} 10%, transparent); --impkt-color-text-heading: ${t.onBrand}; --impkt-color-text-default: ${t.onBrand}; --impkt-color-text-muted: ${t.onBrand}; --impkt-color-text-link: ${t.onBrand}; --impkt-color-text-link-hover: ${t.onBrand}; }\n :host(:not([bleed]):not([tone='none'])) .band { padding-inline: ${space(6)}; }\n :host([padding='sm']) .band { padding-block: ${space(4)}; }\n :host([padding='md']) .band { padding-block: ${space(8)}; }\n :host([padding='lg']) .band { padding-block: ${space(12)}; }\n :host([padding='xl']) .band { padding-block: ${space(16)}; }\n :host([padding='2xl']) .band { padding-block: clamp(${space(14)}, 8vw, ${space(28)}); }\n .content { max-inline-size: var(--impkt-page-inner); margin-inline: auto; }\n `];\n\n render(): TemplateResult {\n return html`<section class=\"band\" part=\"band\" aria-label=${this.label || nothing} role=${this.label ? nothing : 'presentation'}><div class=\"content\" part=\"content\"><slot></slot></div></section>`;\n }\n}\n\ncustomElements.define('impkt-page', ImpktPage);\ncustomElements.define('impkt-section', ImpktSection);\ndeclare global { interface HTMLElementTagNameMap { 'impkt-page': ImpktPage; 'impkt-section': ImpktSection } }\n"],"mappings":";;;;;;;;;;AAAA,SAAS,KAAK,MAAM,eAAoC;AAMxD,IAAM,SAAS;AAAA,gCACiB,MAAM,qBAAqB,QAAQ,CAAC;AAAA;AAAA;AAAA;AAUpE,IAAM,UAAU;AAAA,iCACiB,MAAM,uBAAuB,MAAM,CAAC;AAAA,6EACQ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AEA,eAAe,OAAO,cAAc,SAAS;AAC7C,eAAe,OAAO,iBAAiB,YAAY;","names":[]}
@@ -4,7 +4,7 @@ import {
4
4
  fontWeight,
5
5
  space,
6
6
  t
7
- } from "./chunk-5NUF7ZQA.js";
7
+ } from "./chunk-NTNXHLTM.js";
8
8
 
9
9
  // packages/ui/src/components/alert.ts
10
10
  import { html, css, nothing } from "lit";
@@ -39,10 +39,12 @@ var ImpktAlert = class _ImpktAlert extends ImpktElement {
39
39
  margin-block-end: ${space(4)};
40
40
  }
41
41
  .alert {
42
- padding: ${space(4)};
43
- border-radius: ${t.radius};
42
+ padding: ${space(4)} ${space(5)};
43
+ border-radius: ${t.radiusLg};
44
44
  border-inline-start: 4px solid;
45
- font-size: ${fontSize("md")};
45
+ box-shadow: inset 0 0 0 1px ${t.hairline};
46
+ font-size: ${fontSize("sm")};
47
+ line-height: 1.5;
46
48
  }
47
49
  .heading {
48
50
  font-weight: ${fontWeight("semibold")};
@@ -102,4 +104,4 @@ customElements.define("impkt-alert", ImpktAlert);
102
104
  export {
103
105
  ImpktAlert
104
106
  };
105
- //# sourceMappingURL=chunk-3OSL2HMN.js.map
107
+ //# sourceMappingURL=chunk-6ICOJPMD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/alert.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpktElement } from '../base/ImpktElement';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\nexport type AlertTone = 'info' | 'success' | 'warning' | 'danger';\n\n/**\n * A notice.\n *\n * **The role depends on the tone, and that is a real distinction.** `alert`\n * interrupts whatever a screen reader is saying; `status` waits for a pause.\n * A failed payment earns the interruption. \"Your basket has been saved\" does\n * not, and using `alert` for it is how users learn to tune the live region\n * out — at which point the one that mattered is also lost.\n *\n * **The tone is never carried by colour alone.** Each tone ships a word, in\n * the accessible name, because 1.4.1 Use of Colour says a red border is not a\n * message and because a red border is invisible in forced-colours mode.\n\n *\n * @category feedback\n * @icon alert\n * @slot - The body of the notice.\n */\nexport class ImpktAlert extends ImpktElement {\n static properties = {\n tone: { type: String, reflect: true },\n heading: { type: String },\n toneLabel: { type: String, attribute: 'tone-label' },\n };\n\n declare tone: AlertTone;\n declare heading: string;\n /** Overrides the default word for the tone, for translation. */\n declare toneLabel: string;\n\n constructor() {\n super();\n this.tone = 'info';\n this.heading = '';\n this.toneLabel = '';\n }\n\n private static readonly TONE_WORDS: Record<AlertTone, string> = {\n info: 'Information',\n success: 'Success',\n warning: 'Warning',\n danger: 'Error',\n };\n\n static styles = [\n ...ImpktElement.styles,\n css`\n :host {\n display: block;\n margin-block-end: ${space(4)};\n }\n .alert {\n padding: ${space(4)} ${space(5)};\n border-radius: ${t.radiusLg};\n border-inline-start: 4px solid;\n box-shadow: inset 0 0 0 1px ${t.hairline};\n font-size: ${fontSize('sm')};\n line-height: 1.5;\n }\n .heading {\n font-weight: ${fontWeight('semibold')};\n margin-block-end: ${space(1)};\n }\n :host([tone='info']) .alert {\n background: ${t.infoSubtle};\n border-color: ${t.info};\n color: ${t.text};\n }\n :host([tone='success']) .alert {\n background: ${t.successSubtle};\n border-color: ${t.success};\n color: ${t.text};\n }\n :host([tone='warning']) .alert {\n background: ${t.warningSubtle};\n border-color: ${t.warning};\n color: ${t.text};\n }\n :host([tone='danger']) .alert {\n background: ${t.dangerSubtle};\n border-color: ${t.danger};\n color: ${t.text};\n }\n /* Colour is the only signal left in forced-colours mode, and it is gone.\n The border keeps the boundary; the tone word in the label carries the\n meaning. */\n @media (forced-colors: active) {\n .alert {\n border: 1px solid CanvasText;\n border-inline-start-width: 4px;\n }\n }\n `,\n ];\n\n render(): TemplateResult {\n const word = this.toneLabel || ImpktAlert.TONE_WORDS[this.tone];\n return html`\n <div\n class=\"alert\"\n part=\"alert\"\n role=${this.tone === 'danger' ? 'alert' : 'status'}\n aria-label=${this.heading ? nothing : word}\n >\n ${this.heading\n ? html`<div class=\"heading\" part=\"heading\">\n <span class=\"tone-word\">${word}:</span> ${this.heading}\n </div>`\n : nothing}\n <slot></slot>\n </div>\n `;\n }\n}\n\ncustomElements.define('impkt-alert', ImpktAlert);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impkt-alert': ImpktAlert;\n }\n}\n"],"mappings":";;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AAwBjD,IAAM,aAAN,MAAM,oBAAmB,aAAa;AAAA,EAC3C;AAAA,SAAO,aAAa;AAAA,MAClB,MAAM,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACpC,SAAS,EAAE,MAAM,OAAO;AAAA,MACxB,WAAW,EAAE,MAAM,QAAQ,WAAW,aAAa;AAAA,IACrD;AAAA;AAAA,EAOA,cAAc;AACZ,UAAM;AACN,SAAK,OAAO;AACZ,SAAK,UAAU;AACf,SAAK,YAAY;AAAA,EACnB;AAAA,EAEA;AAAA,SAAwB,aAAwC;AAAA,MAC9D,MAAM;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,MACT,QAAQ;AAAA,IACV;AAAA;AAAA,EAEA;AAAA,SAAO,SAAS;AAAA,MACd,GAAG,aAAa;AAAA,MAChB;AAAA;AAAA;AAAA,4BAGwB,MAAM,CAAC,CAAC;AAAA;AAAA;AAAA,mBAGjB,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC;AAAA,yBACd,EAAE,QAAQ;AAAA;AAAA,sCAEG,EAAE,QAAQ;AAAA,qBAC3B,SAAS,IAAI,CAAC;AAAA;AAAA;AAAA;AAAA,uBAIZ,WAAW,UAAU,CAAC;AAAA,4BACjB,MAAM,CAAC,CAAC;AAAA;AAAA;AAAA,sBAGd,EAAE,UAAU;AAAA,wBACV,EAAE,IAAI;AAAA,iBACb,EAAE,IAAI;AAAA;AAAA;AAAA,sBAGD,EAAE,aAAa;AAAA,wBACb,EAAE,OAAO;AAAA,iBAChB,EAAE,IAAI;AAAA;AAAA;AAAA,sBAGD,EAAE,aAAa;AAAA,wBACb,EAAE,OAAO;AAAA,iBAChB,EAAE,IAAI;AAAA;AAAA;AAAA,sBAGD,EAAE,YAAY;AAAA,wBACZ,EAAE,MAAM;AAAA,iBACf,EAAE,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAYrB;AAAA;AAAA,EAEA,SAAyB;AACvB,UAAM,OAAO,KAAK,aAAa,YAAW,WAAW,KAAK,IAAI;AAC9D,WAAO;AAAA;AAAA;AAAA;AAAA,eAII,KAAK,SAAS,WAAW,UAAU,QAAQ;AAAA,qBACrC,KAAK,UAAU,UAAU,IAAI;AAAA;AAAA,UAExC,KAAK,UACH;AAAA,wCAC4B,IAAI,YAAY,KAAK,OAAO;AAAA,sBAExD,OAAO;AAAA;AAAA;AAAA;AAAA,EAIjB;AACF;AAEA,eAAe,OAAO,eAAe,UAAU;","names":[]}
@@ -7,10 +7,17 @@ import {
7
7
  space,
8
8
  t,
9
9
  visuallyHidden
10
- } from "./chunk-5NUF7ZQA.js";
10
+ } from "./chunk-NTNXHLTM.js";
11
11
 
12
12
  // packages/ui/src/base/FieldElement.ts
13
13
  import { html, css, nothing } from "lit";
14
+ var fieldWidths = css`
15
+ :host { --impkt-field-width: 100%; }
16
+ :host([width='xs']) { --impkt-field-width: 8ch; }
17
+ :host([width='sm']) { --impkt-field-width: 14ch; }
18
+ :host([width='md']) { --impkt-field-width: 24ch; }
19
+ :host([width='lg']) { --impkt-field-width: 40ch; }
20
+ `;
14
21
  var FieldElement = class extends ImpktElement {
15
22
  constructor() {
16
23
  super();
@@ -157,6 +164,7 @@ var FieldElement = class extends ImpktElement {
157
164
  };
158
165
 
159
166
  export {
167
+ fieldWidths,
160
168
  FieldElement
161
169
  };
162
- //# sourceMappingURL=chunk-ZXCSQ6MK.js.map
170
+ //# sourceMappingURL=chunk-7BIQ3K6H.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/base/FieldElement.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpktElement } from './ImpktElement';\nimport { focusRing, visuallyHidden } from './styles';\nimport { fontSize, fontWeight, lineHeight, space, t } from './tokens';\n\n/**\n * The shared anatomy of a form control: a label, an optional description, a\n * control, and an error.\n *\n * This exists because the ARIA wiring between those four is where accessible\n * forms actually fail, and it fails the same way every time — a description\n * that is never announced, an error that appears silently, a label that points\n * at nothing. Written once, it is right once.\n *\n * Everything is rendered inside this component's own shadow root, including\n * the native control. That is not an implementation detail: `aria-describedby`\n * cannot cross a shadow boundary, so a component that slotted the input from\n * outside could not describe it. Keeping the whole relationship in one tree is\n * what makes the wiring work at all.\n */\n/**\n * How wide a single-line control is, from what it holds: a postcode is short,\n * an email address is long. A width that matches the answer is a hint about\n * what to type (1.3.5 is about the purpose, this is about the size). Applied by\n * the controls that take a `width`, through `--impkt-field-width`.\n */\nexport const fieldWidths = css`\n :host { --impkt-field-width: 100%; }\n :host([width='xs']) { --impkt-field-width: 8ch; }\n :host([width='sm']) { --impkt-field-width: 14ch; }\n :host([width='md']) { --impkt-field-width: 24ch; }\n :host([width='lg']) { --impkt-field-width: 40ch; }\n`;\n\nexport abstract class FieldElement extends ImpktElement {\n /** Form controls participate in a `<form>` like native ones. */\n static formAssociated = true;\n\n static properties = {\n label: { type: String },\n name: { type: String },\n value: { type: String },\n description: { type: String },\n error: { type: String },\n required: { type: Boolean, reflect: true },\n disabled: { type: Boolean, reflect: true },\n readonly: { type: Boolean, reflect: true },\n requiredText: { type: String, attribute: 'required-text' },\n };\n\n declare label: string;\n declare name: string;\n declare value: string;\n declare description: string;\n declare error: string;\n declare required: boolean;\n declare disabled: boolean;\n declare readonly: boolean;\n /**\n * How \"you must answer this\" is said.\n *\n * Words, not an asterisk. 3.3.2 asks for labels or instructions, and an\n * asterisk is neither until a legend explains it — which puts the\n * explanation somewhere other than the field it explains. It is a property\n * so a partner can reword it, not so they can empty it.\n */\n declare requiredText: string;\n\n protected internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this.label = '';\n this.name = '';\n this.value = '';\n this.description = '';\n this.error = '';\n this.required = false;\n this.disabled = false;\n this.readonly = false;\n this.requiredText = 'required';\n // happy-dom and older engines do not implement attachInternals. A control\n // that cannot associate with a form is still a usable control, so this\n // degrades rather than throwing on construction.\n try {\n this.internals = this.attachInternals();\n } catch {\n this.internals = null;\n }\n }\n\n static styles = [\n ...ImpktElement.styles,\n focusRing,\n css`\n :host {\n display: block;\n margin-block-end: ${space(4)};\n }\n .label {\n display: block;\n font-size: ${fontSize('sm')};\n font-weight: ${fontWeight('semibold')};\n line-height: ${lineHeight('normal')};\n margin-block-end: ${space(1)};\n color: ${t.text};\n }\n .required {\n font-weight: ${fontWeight('regular')};\n color: ${t.textMuted};\n }\n .description {\n font-size: ${fontSize('sm')};\n line-height: ${lineHeight('normal')};\n color: ${t.textMuted};\n margin-block-end: ${space(2)};\n }\n .error {\n font-size: ${fontSize('sm')};\n line-height: ${lineHeight('normal')};\n color: ${t.dangerText};\n margin-block-start: ${space(1)};\n display: flex;\n gap: ${space(1)};\n }\n .error:empty {\n display: none;\n }\n .visually-hidden {\n ${visuallyHidden}\n }\n :host([disabled]) {\n opacity: 0.6;\n }\n `,\n ];\n\n protected get controlId(): string {\n return this.id_('control');\n }\n\n /**\n * What the control points `aria-describedby` at.\n *\n * The error id is included only while there is an error. A describedby that\n * always names an empty element trains a screen-reader user to expect\n * nothing after the description, and then the one time it matters they have\n * already learned to ignore it.\n */\n protected get describedBy(): string | typeof nothing {\n const ids = [\n this.description ? this.id_('description') : '',\n this.error ? this.id_('error') : '',\n ].filter(Boolean);\n return ids.length ? ids.join(' ') : nothing;\n }\n\n /** Subclasses render the control itself; everything round it is here. */\n protected abstract renderControl(): TemplateResult;\n\n /**\n * `<label for>` by default. A group of controls — radios, checkboxes —\n * cannot use one, because `for` names a single control, so those override\n * this and render a `<fieldset>` and `<legend>` instead.\n */\n protected renderLabel(): TemplateResult {\n return html`\n <label class=\"label\" for=${this.controlId} part=\"label\">\n ${this.label}${this.required\n ? html`<span class=\"required\"> (${this.requiredText})</span>`\n : nothing}\n </label>\n `;\n }\n\n render(): TemplateResult {\n return html`\n ${this.renderLabel()}\n ${this.description\n ? html`<div class=\"description\" id=${this.id_('description')} part=\"description\">\n ${this.description}\n </div>`\n : nothing}\n ${this.renderControl()}\n <!--\n The error region is always present, even when empty. A live region\n inserted at the same moment as its content is announced unreliably\n across screen readers; one that already exists and is then filled is\n announced consistently. \"polite\" rather than \"assertive\" because a\n validation message should not interrupt what is being read.\n -->\n <div\n class=\"error\"\n id=${this.id_('error')}\n part=\"error\"\n aria-live=\"polite\"\n >\n ${this.error || nothing}\n </div>\n `;\n }\n\n /** Keep the form value in step with the control. */\n protected setFormValue(value: string): void {\n this.value = value;\n this.internals?.setFormValue(value);\n this.dispatchEvent(new CustomEvent('impkt-change', { detail: { value }, bubbles: true, composed: true }));\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AA0BjD,IAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQpB,IAAe,eAAf,cAAoC,aAAa;AAAA,EAoCtD,cAAc;AACZ,UAAM;AAHR,SAAU,YAAqC;AAI7C,SAAK,QAAQ;AACb,SAAK,OAAO;AACZ,SAAK,QAAQ;AACb,SAAK,cAAc;AACnB,SAAK,QAAQ;AACb,SAAK,WAAW;AAChB,SAAK,WAAW;AAChB,SAAK,WAAW;AAChB,SAAK,eAAe;AAIpB,QAAI;AACF,WAAK,YAAY,KAAK,gBAAgB;AAAA,IACxC,QAAQ;AACN,WAAK,YAAY;AAAA,IACnB;AAAA,EACF;AAAA,EArDA;AAAA;AAAA,SAAO,iBAAiB;AAAA;AAAA,EAExB;AAAA,SAAO,aAAa;AAAA,MAClB,OAAO,EAAE,MAAM,OAAO;AAAA,MACtB,MAAM,EAAE,MAAM,OAAO;AAAA,MACrB,OAAO,EAAE,MAAM,OAAO;AAAA,MACtB,aAAa,EAAE,MAAM,OAAO;AA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