@atomic-ui/ui 0.1.7 → 0.3.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 (190) hide show
  1. package/README.md +82 -95
  2. package/custom-elements.json +25364 -0
  3. package/dist/base/FieldElement.d.ts +11 -0
  4. package/dist/base/ImpktElement.d.ts +14 -0
  5. package/dist/base/locale.d.ts +8 -0
  6. package/dist/base/say.d.ts +1 -0
  7. package/dist/base/scroll-lock.d.ts +2 -0
  8. package/dist/base/styles.d.ts +25 -6
  9. package/dist/base/tokens.d.ts +5 -1
  10. package/dist/chunk-2YRTFWW2.js +26 -0
  11. package/dist/chunk-2YRTFWW2.js.map +1 -0
  12. package/dist/{chunk-X7IPZPTG.js → chunk-37PA72FC.js} +34 -19
  13. package/dist/chunk-37PA72FC.js.map +1 -0
  14. package/dist/chunk-3IGNZTJU.js +14 -0
  15. package/dist/chunk-3IGNZTJU.js.map +1 -0
  16. package/dist/{chunk-NTNXHLTM.js → chunk-3KO55PZK.js} +47 -2
  17. package/dist/chunk-3KO55PZK.js.map +1 -0
  18. package/dist/chunk-3RE4H2XO.js +53 -0
  19. package/dist/chunk-3RE4H2XO.js.map +1 -0
  20. package/dist/{chunk-5EA4IDUD.js → chunk-46BYUQ5A.js} +2 -2
  21. package/dist/{chunk-WECSVHIM.js → chunk-4OYHT4BN.js} +7 -3
  22. package/dist/chunk-4OYHT4BN.js.map +1 -0
  23. package/dist/{chunk-4HU4Y23Q.js → chunk-55DK75QF.js} +6 -4
  24. package/dist/chunk-55DK75QF.js.map +1 -0
  25. package/dist/{chunk-XVKEM5JY.js → chunk-5QSTXIPG.js} +2 -2
  26. package/dist/{chunk-QCNT7D5V.js → chunk-7P4Z4CLK.js} +63 -20
  27. package/dist/chunk-7P4Z4CLK.js.map +1 -0
  28. package/dist/{chunk-GSCVG2ER.js → chunk-APJ5JGRW.js} +3 -3
  29. package/dist/chunk-AUVIOU5G.js +522 -0
  30. package/dist/chunk-AUVIOU5G.js.map +1 -0
  31. package/dist/{chunk-6ICOJPMD.js → chunk-CUUBAETM.js} +4 -3
  32. package/dist/chunk-CUUBAETM.js.map +1 -0
  33. package/dist/{chunk-NQKYHILD.js → chunk-DAH7RLW3.js} +3 -3
  34. package/dist/{chunk-OB7LC6NJ.js → chunk-DJEZW7AC.js} +2 -2
  35. package/dist/{chunk-XJP45LFA.js → chunk-DKZ425AM.js} +15 -5
  36. package/dist/chunk-DKZ425AM.js.map +1 -0
  37. package/dist/{chunk-GO2IBRFP.js → chunk-F4YQWKK2.js} +7 -4
  38. package/dist/chunk-F4YQWKK2.js.map +1 -0
  39. package/dist/chunk-FVCM4WHD.js +328 -0
  40. package/dist/chunk-FVCM4WHD.js.map +1 -0
  41. package/dist/chunk-GBRML4RF.js +264 -0
  42. package/dist/chunk-GBRML4RF.js.map +1 -0
  43. package/dist/{chunk-ZQJD4YEJ.js → chunk-HXINWP3V.js} +42 -13
  44. package/dist/chunk-HXINWP3V.js.map +1 -0
  45. package/dist/{chunk-T6L3USBZ.js → chunk-IOBSIAHB.js} +23 -11
  46. package/dist/chunk-IOBSIAHB.js.map +1 -0
  47. package/dist/{chunk-7Y6UCSUS.js → chunk-IZOTGWWI.js} +5 -5
  48. package/dist/chunk-IZOTGWWI.js.map +1 -0
  49. package/dist/{chunk-MLVUMCQ2.js → chunk-J2FACXYI.js} +14 -5
  50. package/dist/chunk-J2FACXYI.js.map +1 -0
  51. package/dist/{chunk-VTFCTWSX.js → chunk-KKJEEKL2.js} +33 -7
  52. package/dist/chunk-KKJEEKL2.js.map +1 -0
  53. package/dist/{chunk-HWWA27DN.js → chunk-KMCGX76Y.js} +2 -2
  54. package/dist/{chunk-2YQA3VBY.js → chunk-NKMVICB5.js} +4 -2
  55. package/dist/chunk-NKMVICB5.js.map +1 -0
  56. package/dist/{chunk-ZBLTU67D.js → chunk-OFLMG6RN.js} +15 -11
  57. package/dist/chunk-OFLMG6RN.js.map +1 -0
  58. package/dist/{chunk-CMAU4DSB.js → chunk-P6GDMZK4.js} +5 -5
  59. package/dist/chunk-P6GDMZK4.js.map +1 -0
  60. package/dist/{chunk-MOEMFL4K.js → chunk-PO6FCAIS.js} +5 -5
  61. package/dist/chunk-PO6FCAIS.js.map +1 -0
  62. package/dist/chunk-PWLZFGS3.js +494 -0
  63. package/dist/chunk-PWLZFGS3.js.map +1 -0
  64. package/dist/chunk-QJIB36DM.js +249 -0
  65. package/dist/chunk-QJIB36DM.js.map +1 -0
  66. package/dist/{chunk-TPF4MOMF.js → chunk-R7FKGFW6.js} +7 -4
  67. package/dist/chunk-R7FKGFW6.js.map +1 -0
  68. package/dist/{chunk-ZGAOMRYD.js → chunk-RWWRTURA.js} +3 -3
  69. package/dist/{chunk-QDNI54ON.js → chunk-RYBY35QE.js} +10 -8
  70. package/dist/chunk-RYBY35QE.js.map +1 -0
  71. package/dist/chunk-S7F5VKWU.js +453 -0
  72. package/dist/chunk-S7F5VKWU.js.map +1 -0
  73. package/dist/chunk-T5W3FDSF.js +396 -0
  74. package/dist/chunk-T5W3FDSF.js.map +1 -0
  75. package/dist/{chunk-BTGCUONV.js → chunk-TCXKZDMR.js} +2 -2
  76. package/dist/{chunk-C36CZRHK.js → chunk-WGPB3QQU.js} +43 -13
  77. package/dist/chunk-WGPB3QQU.js.map +1 -0
  78. package/dist/{chunk-G6OVKNL7.js → chunk-XPCU4KUY.js} +5 -4
  79. package/dist/chunk-XPCU4KUY.js.map +1 -0
  80. package/dist/chunk-YRYZUYY7.js +236 -0
  81. package/dist/chunk-YRYZUYY7.js.map +1 -0
  82. package/dist/{chunk-7BIQ3K6H.js → chunk-ZOTAAYO5.js} +12 -2
  83. package/dist/chunk-ZOTAAYO5.js.map +1 -0
  84. package/dist/components/accordion.js +2 -2
  85. package/dist/components/alert.js +2 -2
  86. package/dist/components/app-ui.d.ts +28 -12
  87. package/dist/components/app-ui.js +6 -4
  88. package/dist/components/blocks.d.ts +28 -2
  89. package/dist/components/blocks.js +3 -3
  90. package/dist/components/button.d.ts +7 -0
  91. package/dist/components/button.js +3 -3
  92. package/dist/components/changelog.d.ts +386 -0
  93. package/dist/components/changelog.js +25 -0
  94. package/dist/components/changelog.js.map +1 -0
  95. package/dist/components/checkbox-group.js +3 -3
  96. package/dist/components/checkbox.js +3 -3
  97. package/dist/components/date-input.js +3 -3
  98. package/dist/components/dialog.d.ts +15 -0
  99. package/dist/components/dialog.js +3 -2
  100. package/dist/components/estimator.d.ts +246 -0
  101. package/dist/components/estimator.js +16 -0
  102. package/dist/components/estimator.js.map +1 -0
  103. package/dist/components/fieldset.js +2 -2
  104. package/dist/components/grid.js +2 -2
  105. package/dist/components/help.js +2 -2
  106. package/dist/components/icon.d.ts +2 -0
  107. package/dist/components/icon.js +2 -2
  108. package/dist/components/journey.d.ts +447 -0
  109. package/dist/components/journey.js +22 -0
  110. package/dist/components/journey.js.map +1 -0
  111. package/dist/components/layout.d.ts +24 -0
  112. package/dist/components/layout.js +2 -2
  113. package/dist/components/link.js +3 -3
  114. package/dist/components/list.d.ts +50 -0
  115. package/dist/components/list.js +8 -0
  116. package/dist/components/list.js.map +1 -0
  117. package/dist/components/marketing.d.ts +1 -1
  118. package/dist/components/marketing.js +3 -3
  119. package/dist/components/media.d.ts +10 -0
  120. package/dist/components/media.js +2 -2
  121. package/dist/components/navigation.d.ts +16 -0
  122. package/dist/components/navigation.js +3 -3
  123. package/dist/components/organisms.d.ts +13 -1
  124. package/dist/components/organisms.js +3 -3
  125. package/dist/components/page.js +2 -2
  126. package/dist/components/price.d.ts +1 -1
  127. package/dist/components/price.js +3 -2
  128. package/dist/components/progress.js +2 -2
  129. package/dist/components/property.d.ts +1 -1
  130. package/dist/components/property.js +4 -3
  131. package/dist/components/radio-group.js +3 -3
  132. package/dist/components/scene.d.ts +138 -0
  133. package/dist/components/scene.js +8 -0
  134. package/dist/components/scene.js.map +1 -0
  135. package/dist/components/scrubber.d.ts +86 -0
  136. package/dist/components/scrubber.js +8 -0
  137. package/dist/components/scrubber.js.map +1 -0
  138. package/dist/components/select.js +3 -3
  139. package/dist/components/selling.d.ts +409 -0
  140. package/dist/components/selling.js +25 -0
  141. package/dist/components/selling.js.map +1 -0
  142. package/dist/components/site.d.ts +283 -0
  143. package/dist/components/site.js +20 -0
  144. package/dist/components/site.js.map +1 -0
  145. package/dist/components/summary-list.js +2 -2
  146. package/dist/components/table.d.ts +94 -2
  147. package/dist/components/table.js +4 -2
  148. package/dist/components/text-input.js +3 -3
  149. package/dist/components/textarea.d.ts +13 -0
  150. package/dist/components/textarea.js +3 -3
  151. package/dist/index.d.ts +10 -2
  152. package/dist/index.js +135 -55
  153. package/dist/standalone/atomic-ui.js +3134 -0
  154. package/dist/standalone/atomic-ui.js.map +7 -0
  155. package/dist/standalone/index.html +174 -0
  156. package/package.json +26 -7
  157. package/scripts/copy-to-product.mjs +52 -0
  158. package/specimen/index.html +174 -0
  159. package/dist/chunk-2YQA3VBY.js.map +0 -1
  160. package/dist/chunk-4HU4Y23Q.js.map +0 -1
  161. package/dist/chunk-6ICOJPMD.js.map +0 -1
  162. package/dist/chunk-7BIQ3K6H.js.map +0 -1
  163. package/dist/chunk-7Y6UCSUS.js.map +0 -1
  164. package/dist/chunk-C36CZRHK.js.map +0 -1
  165. package/dist/chunk-CMAU4DSB.js.map +0 -1
  166. package/dist/chunk-G6OVKNL7.js.map +0 -1
  167. package/dist/chunk-GO2IBRFP.js.map +0 -1
  168. package/dist/chunk-MLVUMCQ2.js.map +0 -1
  169. package/dist/chunk-MOEMFL4K.js.map +0 -1
  170. package/dist/chunk-NTNXHLTM.js.map +0 -1
  171. package/dist/chunk-QCNT7D5V.js.map +0 -1
  172. package/dist/chunk-QDNI54ON.js.map +0 -1
  173. package/dist/chunk-T6L3USBZ.js.map +0 -1
  174. package/dist/chunk-TPF4MOMF.js.map +0 -1
  175. package/dist/chunk-VTFCTWSX.js.map +0 -1
  176. package/dist/chunk-VWNBB7FW.js +0 -104
  177. package/dist/chunk-VWNBB7FW.js.map +0 -1
  178. package/dist/chunk-WECSVHIM.js.map +0 -1
  179. package/dist/chunk-X7IPZPTG.js.map +0 -1
  180. package/dist/chunk-XJP45LFA.js.map +0 -1
  181. package/dist/chunk-ZBLTU67D.js.map +0 -1
  182. package/dist/chunk-ZQJD4YEJ.js.map +0 -1
  183. /package/dist/{chunk-5EA4IDUD.js.map → chunk-46BYUQ5A.js.map} +0 -0
  184. /package/dist/{chunk-XVKEM5JY.js.map → chunk-5QSTXIPG.js.map} +0 -0
  185. /package/dist/{chunk-GSCVG2ER.js.map → chunk-APJ5JGRW.js.map} +0 -0
  186. /package/dist/{chunk-NQKYHILD.js.map → chunk-DAH7RLW3.js.map} +0 -0
  187. /package/dist/{chunk-OB7LC6NJ.js.map → chunk-DJEZW7AC.js.map} +0 -0
  188. /package/dist/{chunk-HWWA27DN.js.map → chunk-KMCGX76Y.js.map} +0 -0
  189. /package/dist/{chunk-ZGAOMRYD.js.map → chunk-RWWRTURA.js.map} +0 -0
  190. /package/dist/{chunk-BTGCUONV.js.map → chunk-TCXKZDMR.js.map} +0 -0
@@ -2,10 +2,11 @@ import {
2
2
  ImpktElement,
3
3
  fontSize,
4
4
  fontWeight,
5
+ say,
5
6
  space,
6
7
  t,
7
8
  visuallyHidden
8
- } from "./chunk-NTNXHLTM.js";
9
+ } from "./chunk-3KO55PZK.js";
9
10
 
10
11
  // packages/ui/src/components/progress.ts
11
12
  import { html, css, nothing } from "lit";
@@ -40,7 +41,7 @@ var ImpktProgress = class extends ImpktElement {
40
41
  }
41
42
  li {
42
43
  flex: 1;
43
- font-size: ${fontSize("xs")};
44
+ font-size: ${fontSize("sm")};
44
45
  color: ${t.textMuted};
45
46
  padding-block-start: ${space(2)};
46
47
  border-block-start: 4px solid ${t.border};
@@ -77,7 +78,7 @@ var ImpktProgress = class extends ImpktElement {
77
78
  const state = i < index ? "done" : i === index ? "current" : "todo";
78
79
  return html`
79
80
  <li data-state=${state} aria-current=${state === "current" ? "step" : nothing}>
80
- ${state === "current" ? html`<span class="sr-only">Step ${i + 1} of ${this.steps.length}: </span>` : nothing}
81
+ ${state === "current" ? html`<span class="sr-only">${say("Step {step} of {steps}:", { step: i + 1, steps: this.steps.length })} </span>` : nothing}
81
82
  <span>${step.label}</span>
82
83
  </li>
83
84
  `;
@@ -92,4 +93,4 @@ customElements.define("impkt-progress", ImpktProgress);
92
93
  export {
93
94
  ImpktProgress
94
95
  };
95
- //# sourceMappingURL=chunk-G6OVKNL7.js.map
96
+ //# sourceMappingURL=chunk-XPCU4KUY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/progress.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { say } from '../base/say';\nimport { ImpktElement } from '../base/ImpktElement';\nimport { visuallyHidden } from '../base/styles';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\nexport interface ProgressStep {\n id: string;\n label: string;\n}\n\n/**\n * Where the customer is in a journey.\n *\n * **It is not a `progressbar`.** That role is for a task completing — a file\n * uploading, a price calculating — and it carries `aria-valuenow`. A journey\n * indicator is navigation: an ordered list of named steps with\n * `aria-current=\"step\"` on the one you are on. Using `progressbar` here\n * announces a percentage and loses the step names, which are the only useful\n * part.\n *\n * **The position is said in words.** \"Step 2 of 5\" is visually hidden and read\n * aloud, because the visual design communicates position through colour and a\n * filled bar, and neither is available to a screen-reader user — nor to anyone\n * who cannot distinguish the filled colour from the empty one, which is 1.4.1.\n\n *\n * @category content\n * @icon progress\n */\nexport class ImpktProgress extends ImpktElement {\n static properties = {\n steps: { type: Array },\n current: { type: String },\n label: { type: String },\n };\n\n declare steps: ProgressStep[];\n /** The id of the step being shown. */\n declare current: string;\n declare label: string;\n\n constructor() {\n super();\n this.steps = [];\n this.current = '';\n this.label = 'Progress';\n }\n\n static styles = [\n ...ImpktElement.styles,\n css`\n :host {\n display: block;\n margin-block-end: ${space(5)};\n }\n ol {\n display: flex;\n gap: ${space(2)};\n list-style: none;\n margin: 0;\n padding: 0;\n }\n li {\n flex: 1;\n font-size: ${fontSize('sm')};\n color: ${t.textMuted};\n padding-block-start: ${space(2)};\n border-block-start: 4px solid ${t.border};\n }\n li[data-state='done'] {\n color: ${t.text};\n border-block-start-color: ${t.brand};\n }\n li[data-state='current'] {\n color: ${t.text};\n font-weight: ${fontWeight('semibold')};\n border-block-start-color: ${t.brand};\n }\n .sr-only {\n ${visuallyHidden}\n }\n /* Below 30rem the labels stop fitting; the position in words is the part\n that has to survive, so the list collapses to bars and the current\n step's name. */\n @media (max-width: 30rem) {\n li:not([data-state='current']) span:not(.sr-only) {\n ${visuallyHidden}\n }\n }\n `,\n ];\n\n render(): TemplateResult {\n const index = this.steps.findIndex((s) => s.id === this.current);\n return html`\n <nav part=\"nav\" aria-label=${this.label}>\n <ol part=\"list\">\n ${this.steps.map((step, i) => {\n const state = i < index ? 'done' : i === index ? 'current' : 'todo';\n return html`\n <li data-state=${state} aria-current=${state === 'current' ? 'step' : nothing}>\n ${state === 'current'\n ? html`<span class=\"sr-only\">${say('Step {step} of {steps}:', { step: i + 1, steps: this.steps.length })} </span>`\n : nothing}\n <span>${step.label}</span>\n </li>\n `;\n })}\n </ol>\n </nav>\n `;\n }\n}\n\ncustomElements.define('impkt-progress', ImpktProgress);\n\ndeclare global {\n interface HTMLElementTagNameMap { 'impkt-progress': ImpktProgress }\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AA8BjD,IAAM,gBAAN,cAA4B,aAAa;AAAA,EAC9C;AAAA,SAAO,aAAa;AAAA,MAClB,OAAO,EAAE,MAAM,MAAM;AAAA,MACrB,SAAS,EAAE,MAAM,OAAO;AAAA,MACxB,OAAO,EAAE,MAAM,OAAO;AAAA,IACxB;AAAA;AAAA,EAOA,cAAc;AACZ,UAAM;AACN,SAAK,QAAQ,CAAC;AACd,SAAK,UAAU;AACf,SAAK,QAAQ;AAAA,EACf;AAAA,EAEA;AAAA,SAAO,SAAS;AAAA,MACd,GAAG,aAAa;AAAA,MAChB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+
12
+ // packages/ui/src/components/scrubber.ts
13
+ import { html, css } from "lit";
14
+ var TONES = {
15
+ brand: "var(--impkt-color-brand-default, #1f4ed8)",
16
+ accent: "var(--impkt-color-accent-default, #c8a15a)",
17
+ info: "var(--impkt-color-status-info-default, #1f4ed8)",
18
+ success: "var(--impkt-color-status-success-default, #047857)",
19
+ warning: "var(--impkt-color-status-warning-default, #b45309)",
20
+ danger: "var(--impkt-color-status-danger-default, #c8102e)"
21
+ };
22
+ var ImpktScrubber = class extends ImpktElement {
23
+ constructor() {
24
+ super();
25
+ this.scene = null;
26
+ this.onProgress = (e) => {
27
+ this.value = e.detail.progress;
28
+ };
29
+ this.onInput = (e) => {
30
+ const v = Number(e.target.value) / 1e3;
31
+ this.value = v;
32
+ this.scene?.seek(v);
33
+ };
34
+ this.label = "Scene progress";
35
+ this.stops = [];
36
+ this.look = "buttons";
37
+ this.hint = "";
38
+ this.value = 0;
39
+ }
40
+ static {
41
+ this.properties = {
42
+ label: { type: String },
43
+ stops: { type: Array },
44
+ look: { type: String, reflect: true },
45
+ hint: { type: String },
46
+ value: { type: Number, state: true }
47
+ };
48
+ }
49
+ static {
50
+ this.styles = [
51
+ ...ImpktElement.styles,
52
+ css`
53
+ :host {
54
+ display: block;
55
+ width: 100%;
56
+ max-width: 48rem;
57
+ margin-inline: auto;
58
+ }
59
+ .wrap {
60
+ display: grid;
61
+ gap: ${space(2)};
62
+ padding: ${space(3)} ${space(4)};
63
+ border-radius: ${token("radius.xl", "16px")};
64
+ background: ${t.surfaceCard};
65
+ box-shadow: ${token("shadow.lg", "0 10px 15px -3px rgba(0,0,0,.1)")};
66
+ border: 1px solid ${t.border};
67
+ }
68
+ input {
69
+ width: 100%;
70
+ min-height: ${token("target.min", "24px")};
71
+ accent-color: ${t.brand};
72
+ margin: 0;
73
+ }
74
+ .stops {
75
+ position: relative;
76
+ display: flex;
77
+ flex-wrap: wrap;
78
+ gap: ${space(2)};
79
+ list-style: none;
80
+ margin: 0;
81
+ padding: 0;
82
+ }
83
+ button {
84
+ min-height: ${token("target.min", "24px")};
85
+ padding: ${space(1)} ${space(3)};
86
+ border-radius: ${token("radius.full", "9999px")};
87
+ border: 1px solid ${t.border};
88
+ background: transparent;
89
+ color: ${t.textMuted};
90
+ font-size: ${fontSize("xs")};
91
+ font-weight: ${fontWeight("medium")};
92
+ cursor: pointer;
93
+ }
94
+ button[aria-current='true'] {
95
+ color: ${t.text};
96
+ border-color: ${t.text};
97
+ }
98
+ .sr-only {
99
+ ${visuallyHidden}
100
+ }
101
+ /* The graph look: the code of where you are, the line of stops, where you are. */
102
+ :host([look='graph']) { max-width: none; }
103
+ .graph { display: grid; grid-template-columns: minmax(8rem, auto) minmax(0, 1fr) auto; gap: ${space(6)}; align-items: center; padding: ${space(4)} ${space(6)}; border-radius: ${token("radius.xl", "16px")}; background: ${t.surfaceCard}; box-shadow: ${token("shadow.lg", "0 10px 15px -3px rgba(0,0,0,.1)")}; border: 1px solid ${t.border}; }
104
+ .mono { font-family: ${t.fontMono}; font-size: ${fontSize("xs")}; letter-spacing: 0.04em; }
105
+ .head { display: grid; gap: 2px; }
106
+ .head .k { color: ${t.textMuted}; text-transform: uppercase; }
107
+ .head .code { font-size: ${fontSize("md")}; color: ${t.text}; }
108
+ .head .note { color: ${t.textMuted}; }
109
+ .line { position: relative; block-size: 48px; }
110
+ .track, .fill { position: absolute; inset-inline: 0; inset-block-start: 14px; block-size: 3px; border-radius: 3px; background: ${t.border}; opacity: 0.5; }
111
+ .fill { opacity: 1; background: none; display: flex; overflow: hidden; }
112
+ .fill span { block-size: 100%; }
113
+ .dot { position: absolute; inset-block-start: 15px; inline-size: 14px; block-size: 14px; translate: -50% -50%; border-radius: 50%; border: 2px solid var(--c); background: ${t.surfaceCard}; padding: 0; min-height: 0; cursor: pointer; }
114
+ .dot[data-passed] { background: var(--c); }
115
+ .dot[aria-current='true'] { inline-size: 24px; block-size: 24px; box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 25%, transparent); }
116
+ .dot-label { position: absolute; inset-block-start: 30px; translate: -50% 0; white-space: nowrap; color: ${t.textMuted}; text-transform: uppercase; pointer-events: none; }
117
+ .dot-label[data-current] { color: ${t.text}; font-weight: ${fontWeight("bold")}; }
118
+ .line input { position: absolute; inset: 0 0 auto; block-size: 30px; opacity: 0; cursor: grab; }
119
+ .line input:focus-visible { opacity: 1; }
120
+ .where { display: grid; gap: ${space(2)}; justify-items: end; }
121
+ .chip { display: inline-flex; align-items: center; gap: ${space(2)}; padding: ${space(1)} ${space(3)}; border-radius: ${token("radius.full", "9999px")}; border: 1px solid ${t.border}; color: ${t.text}; text-transform: uppercase; }
122
+ .chip::before { content: ''; inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--c); }
123
+ .hint { color: ${t.textMuted}; text-transform: uppercase; }
124
+ @media (max-width: 48rem) {
125
+ .graph { grid-template-columns: minmax(0, 1fr); }
126
+ .where { justify-items: start; }
127
+ .dot-label:not([data-current]) { display: none; }
128
+ }
129
+ button:focus-visible,
130
+ input:focus-visible {
131
+ outline: none;
132
+ box-shadow: ${token("focus.ring.shadow", "0 0 0 2px #fff, 0 0 0 4px #1a1a1a")};
133
+ }
134
+ `
135
+ ];
136
+ }
137
+ /** @ignore */
138
+ connectedCallback() {
139
+ super.connectedCallback();
140
+ this.scene = this.closest("impkt-scene");
141
+ this.scene?.addEventListener("impkt-scene-progress", this.onProgress);
142
+ if (this.scene) this.value = this.scene.progress;
143
+ }
144
+ /** @ignore */
145
+ disconnectedCallback() {
146
+ super.disconnectedCallback();
147
+ this.scene?.removeEventListener("impkt-scene-progress", this.onProgress);
148
+ this.scene = null;
149
+ }
150
+ goTo(stop) {
151
+ this.scene?.seek(stop.at, 600);
152
+ }
153
+ /** The stop nearest the current position, which the stop list marks as current. */
154
+ nearest() {
155
+ let best = -1;
156
+ let gap = Infinity;
157
+ this.stops.forEach((s, i) => {
158
+ const d = Math.abs(s.at - this.value);
159
+ if (d < gap) {
160
+ gap = d;
161
+ best = i;
162
+ }
163
+ });
164
+ return best;
165
+ }
166
+ renderGraph(nearestIndex, valueText) {
167
+ let current = nearestIndex;
168
+ const stops = [...this.stops ?? []].sort((a, b) => a.at - b.at);
169
+ current = stops.indexOf(this.stops[current]);
170
+ const colour = (s) => {
171
+ const tone = s?.tone ?? "brand";
172
+ return typeof tone === "number" ? `var(--impkt-color-chart-${tone}, ${TONES.brand})` : TONES[tone] ?? TONES.brand;
173
+ };
174
+ const now = stops[current] ?? stops[0];
175
+ const segments = stops.map((s, i) => {
176
+ const from = i === 0 ? 0 : stops[i - 1].at;
177
+ const to = Math.min(s.at, this.value);
178
+ return { width: Math.round(Math.max(0, to - from) * 1e4) / 100, c: colour(s) };
179
+ });
180
+ return html`<div class="graph" part="wrap">
181
+ <div class="head mono" aria-hidden="true">
182
+ <span class="k">HEAD</span>
183
+ <span class="code">${now?.meta ?? now?.label ?? ""}</span>
184
+ ${now?.note ? html`<span class="note">${now.note}</span>` : null}
185
+ </div>
186
+ <div class="line">
187
+ <div class="track"></div>
188
+ <div class="fill" aria-hidden="true">${segments.map((g) => html`<span style=${`width:${g.width}%;background:${g.c}`}></span>`)}</div>
189
+ ${stops.map((s, i) => html`
190
+ <button type="button" class="dot" style=${`left:${s.at * 100}%;--c:${colour(s)}`} ?data-passed=${s.at <= this.value + 1e-4} aria-current=${i === current ? "true" : "false"} @click=${() => this.goTo(s)}>
191
+ <span class="sr-only">${say("Go to {name}", { name: s.label })}</span>
192
+ </button>
193
+ <span class="dot-label mono" style=${`left:${s.at * 100}%`} ?data-current=${i === current} aria-hidden="true">${s.label}</span>`)}
194
+ <input type="range" min="0" max="1000" step="1" .value=${String(Math.round(this.value * 1e3))} aria-label=${this.label} aria-valuetext=${valueText} @input=${this.onInput} />
195
+ </div>
196
+ <div class="where" aria-hidden="true">
197
+ ${now ? html`<span class="chip mono" style=${`--c:${colour(now)}`}>${now.label}${now.meta ? html`&nbsp;<span style="opacity:.6">${now.meta}</span>` : null}</span>` : null}
198
+ ${this.hint ? html`<span class="hint mono">${this.hint}</span>` : null}
199
+ </div>
200
+ </div>`;
201
+ }
202
+ render() {
203
+ const current = this.nearest();
204
+ const valueText = current >= 0 ? this.stops[current].label : `${Math.round(this.value * 100)}%`;
205
+ if (this.look === "graph") return this.renderGraph(current, valueText);
206
+ return html`
207
+ <div class="wrap" part="wrap">
208
+ <input
209
+ type="range"
210
+ min="0"
211
+ max="1000"
212
+ step="1"
213
+ .value=${String(Math.round(this.value * 1e3))}
214
+ aria-label=${this.label}
215
+ aria-valuetext=${valueText}
216
+ @input=${this.onInput}
217
+ />
218
+ ${this.stops.length ? html`<ul class="stops" part="stops">
219
+ ${this.stops.map(
220
+ (s, i) => html`<li>
221
+ <button type="button" aria-current=${i === current ? "true" : "false"} @click=${() => this.goTo(s)}>
222
+ <span aria-hidden="true">${s.label}</span><span class="sr-only">${say("Go to {name}", { name: s.label })}</span>
223
+ </button>
224
+ </li>`
225
+ )}
226
+ </ul>` : null}
227
+ </div>
228
+ `;
229
+ }
230
+ };
231
+ customElements.define("impkt-scrubber", ImpktScrubber);
232
+
233
+ export {
234
+ ImpktScrubber
235
+ };
236
+ //# sourceMappingURL=chunk-YRYZUYY7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/scrubber.ts"],"sourcesContent":["import { html, css, type TemplateResult } from 'lit';\nimport { say } from '../base/say';\nimport { ImpktElement } from '../base/ImpktElement';\nimport { visuallyHidden } from '../base/styles';\nimport { fontSize, fontWeight, space, t, token } from '../base/tokens';\nimport type { ImpktScene } from './scene';\n\nexport interface ScrubberStop {\n /** Where the stop sits on the scene's progress, from 0 to 1. */\n at: number;\n label: string;\n /** A short code beside it in the graph look, such as a commit hash. */\n meta?: string;\n /** A line under the code in the graph look, such as a commit message. */\n note?: string;\n /**\n * The colour of the line up to this stop, in the graph look: a named tone,\n * or 1 to 5 for the brand's chart colours, as a project's phases are drawn.\n */\n tone?: 'brand' | 'accent' | 'info' | 'success' | 'warning' | 'danger' | 1 | 2 | 3 | 4 | 5;\n}\n\nconst TONES = {\n brand: 'var(--impkt-color-brand-default, #1f4ed8)',\n accent: 'var(--impkt-color-accent-default, #c8a15a)',\n info: 'var(--impkt-color-status-info-default, #1f4ed8)',\n success: 'var(--impkt-color-status-success-default, #047857)',\n warning: 'var(--impkt-color-status-warning-default, #b45309)',\n danger: 'var(--impkt-color-status-danger-default, #c8102e)',\n} as const;\n\n/**\n * Drives the scene it sits in, by hand.\n *\n * Place it in an `impkt-scene`'s `controls` slot and set that scene's `drive`\n * to `scrubber`. Dragging moves through the scene; a named stop seeks to it\n * with an eased move rather than a cut, which is what makes the Commit-style\n * \"time travel\" read as travel.\n *\n * **It is a native range input.** A slider built from divs has to recreate\n * arrow keys, Page Up and Down, Home and End, the value announcement and touch\n * handling, and every one of those is a place to get it wrong. The input\n * already does all of it. The stops are buttons beside it, so a keyboard or\n * switch user reaches each named moment in one action instead of nudging a\n * thumb to find it (2.5.7, dragging movements).\n *\n * @category action\n * @icon adjustments-horizontal\n */\nexport class ImpktScrubber extends ImpktElement {\n static properties = {\n label: { type: String },\n stops: { type: Array },\n look: { type: String, reflect: true },\n hint: { type: String },\n value: { type: Number, state: true },\n };\n\n /** The slider's accessible name. */\n declare label: string;\n declare stops: ScrubberStop[];\n /**\n * `buttons` lists the stops as buttons under the slider. `graph` draws them\n * as commits on a line that fills in each stop's colour as it is dragged,\n * with the current one's code and note beside it.\n */\n declare look: 'buttons' | 'graph';\n /** A word of help in the graph look, such as \"drag to time-travel\". */\n declare hint: string;\n declare value: number;\n\n private scene: ImpktScene | null = null;\n\n constructor() {\n super();\n this.label = 'Scene progress';\n this.stops = [];\n this.look = 'buttons';\n this.hint = '';\n this.value = 0;\n }\n\n static styles = [\n ...ImpktElement.styles,\n css`\n :host {\n display: block;\n width: 100%;\n max-width: 48rem;\n margin-inline: auto;\n }\n .wrap {\n display: grid;\n gap: ${space(2)};\n padding: ${space(3)} ${space(4)};\n border-radius: ${token('radius.xl', '16px')};\n background: ${t.surfaceCard};\n box-shadow: ${token('shadow.lg', '0 10px 15px -3px rgba(0,0,0,.1)')};\n border: 1px solid ${t.border};\n }\n input {\n width: 100%;\n min-height: ${token('target.min', '24px')};\n accent-color: ${t.brand};\n margin: 0;\n }\n .stops {\n position: relative;\n display: flex;\n flex-wrap: wrap;\n gap: ${space(2)};\n list-style: none;\n margin: 0;\n padding: 0;\n }\n button {\n min-height: ${token('target.min', '24px')};\n padding: ${space(1)} ${space(3)};\n border-radius: ${token('radius.full', '9999px')};\n border: 1px solid ${t.border};\n background: transparent;\n color: ${t.textMuted};\n font-size: ${fontSize('xs')};\n font-weight: ${fontWeight('medium')};\n cursor: pointer;\n }\n button[aria-current='true'] {\n color: ${t.text};\n border-color: ${t.text};\n }\n .sr-only {\n ${visuallyHidden}\n }\n /* The graph look: the code of where you are, the line of stops, where you are. */\n :host([look='graph']) { max-width: none; }\n .graph { display: grid; grid-template-columns: minmax(8rem, auto) minmax(0, 1fr) auto; gap: ${space(6)}; align-items: center; padding: ${space(4)} ${space(6)}; border-radius: ${token('radius.xl', '16px')}; background: ${t.surfaceCard}; box-shadow: ${token('shadow.lg', '0 10px 15px -3px rgba(0,0,0,.1)')}; border: 1px solid ${t.border}; }\n .mono { font-family: ${t.fontMono}; font-size: ${fontSize('xs')}; letter-spacing: 0.04em; }\n .head { display: grid; gap: 2px; }\n .head .k { color: ${t.textMuted}; text-transform: uppercase; }\n .head .code { font-size: ${fontSize('md')}; color: ${t.text}; }\n .head .note { color: ${t.textMuted}; }\n .line { position: relative; block-size: 48px; }\n .track, .fill { position: absolute; inset-inline: 0; inset-block-start: 14px; block-size: 3px; border-radius: 3px; background: ${t.border}; opacity: 0.5; }\n .fill { opacity: 1; background: none; display: flex; overflow: hidden; }\n .fill span { block-size: 100%; }\n .dot { position: absolute; inset-block-start: 15px; inline-size: 14px; block-size: 14px; translate: -50% -50%; border-radius: 50%; border: 2px solid var(--c); background: ${t.surfaceCard}; padding: 0; min-height: 0; cursor: pointer; }\n .dot[data-passed] { background: var(--c); }\n .dot[aria-current='true'] { inline-size: 24px; block-size: 24px; box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 25%, transparent); }\n .dot-label { position: absolute; inset-block-start: 30px; translate: -50% 0; white-space: nowrap; color: ${t.textMuted}; text-transform: uppercase; pointer-events: none; }\n .dot-label[data-current] { color: ${t.text}; font-weight: ${fontWeight('bold')}; }\n .line input { position: absolute; inset: 0 0 auto; block-size: 30px; opacity: 0; cursor: grab; }\n .line input:focus-visible { opacity: 1; }\n .where { display: grid; gap: ${space(2)}; justify-items: end; }\n .chip { display: inline-flex; align-items: center; gap: ${space(2)}; padding: ${space(1)} ${space(3)}; border-radius: ${token('radius.full', '9999px')}; border: 1px solid ${t.border}; color: ${t.text}; text-transform: uppercase; }\n .chip::before { content: ''; inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--c); }\n .hint { color: ${t.textMuted}; text-transform: uppercase; }\n @media (max-width: 48rem) {\n .graph { grid-template-columns: minmax(0, 1fr); }\n .where { justify-items: start; }\n .dot-label:not([data-current]) { display: none; }\n }\n button:focus-visible,\n input:focus-visible {\n outline: none;\n box-shadow: ${token('focus.ring.shadow', '0 0 0 2px #fff, 0 0 0 4px #1a1a1a')};\n }\n `,\n ];\n\n /** @ignore */\n connectedCallback(): void {\n super.connectedCallback();\n this.scene = this.closest('impkt-scene');\n this.scene?.addEventListener('impkt-scene-progress', this.onProgress);\n if (this.scene) this.value = this.scene.progress;\n }\n\n /** @ignore */\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.scene?.removeEventListener('impkt-scene-progress', this.onProgress);\n this.scene = null;\n }\n\n private onProgress = (e: Event) => {\n this.value = (e as CustomEvent<{ progress: number }>).detail.progress;\n };\n\n private onInput = (e: Event) => {\n const v = Number((e.target as HTMLInputElement).value) / 1000;\n this.value = v;\n this.scene?.seek(v);\n };\n\n private goTo(stop: ScrubberStop) {\n this.scene?.seek(stop.at, 600);\n }\n\n /** The stop nearest the current position, which the stop list marks as current. */\n private nearest(): number {\n let best = -1;\n let gap = Infinity;\n this.stops.forEach((s, i) => {\n const d = Math.abs(s.at - this.value);\n if (d < gap) {\n gap = d;\n best = i;\n }\n });\n return best;\n }\n\n private renderGraph(nearestIndex: number, valueText: string): TemplateResult {\n let current = nearestIndex;\n const stops = [...(this.stops ?? [])].sort((a, b) => a.at - b.at);\n // Where you are, among the stops in the order they are drawn.\n current = stops.indexOf(this.stops[current]!);\n const colour = (s: ScrubberStop | undefined) => {\n const tone = s?.tone ?? 'brand';\n return typeof tone === 'number' ? `var(--impkt-color-chart-${tone}, ${TONES.brand})` : TONES[tone] ?? TONES.brand;\n };\n const now = stops[current] ?? stops[0];\n // The line fills in each stop's colour, from the stop before it to it, as far as the playhead.\n const segments = stops.map((s, i) => {\n const from = i === 0 ? 0 : stops[i - 1]!.at;\n const to = Math.min(s.at, this.value);\n return { width: Math.round(Math.max(0, to - from) * 10000) / 100, c: colour(s) };\n });\n return html`<div class=\"graph\" part=\"wrap\">\n <div class=\"head mono\" aria-hidden=\"true\">\n <span class=\"k\">HEAD</span>\n <span class=\"code\">${now?.meta ?? now?.label ?? ''}</span>\n ${now?.note ? html`<span class=\"note\">${now.note}</span>` : null}\n </div>\n <div class=\"line\">\n <div class=\"track\"></div>\n <div class=\"fill\" aria-hidden=\"true\">${segments.map((g) => html`<span style=${`width:${g.width}%;background:${g.c}`}></span>`)}</div>\n ${stops.map((s, i) => html`\n <button type=\"button\" class=\"dot\" style=${`left:${s.at * 100}%;--c:${colour(s)}`} ?data-passed=${s.at <= this.value + 0.0001} aria-current=${i === current ? 'true' : 'false'} @click=${() => this.goTo(s)}>\n <span class=\"sr-only\">${say('Go to {name}', { name: s.label })}</span>\n </button>\n <span class=\"dot-label mono\" style=${`left:${s.at * 100}%`} ?data-current=${i === current} aria-hidden=\"true\">${s.label}</span>`)}\n <input type=\"range\" min=\"0\" max=\"1000\" step=\"1\" .value=${String(Math.round(this.value * 1000))} aria-label=${this.label} aria-valuetext=${valueText} @input=${this.onInput} />\n </div>\n <div class=\"where\" aria-hidden=\"true\">\n ${now ? html`<span class=\"chip mono\" style=${`--c:${colour(now)}`}>${now.label}${now.meta ? html`&nbsp;<span style=\"opacity:.6\">${now.meta}</span>` : null}</span>` : null}\n ${this.hint ? html`<span class=\"hint mono\">${this.hint}</span>` : null}\n </div>\n </div>`;\n }\n\n render(): TemplateResult {\n const current = this.nearest();\n const valueText = current >= 0 ? this.stops[current].label : `${Math.round(this.value * 100)}%`;\n if (this.look === 'graph') return this.renderGraph(current, valueText);\n return html`\n <div class=\"wrap\" part=\"wrap\">\n <input\n type=\"range\"\n min=\"0\"\n max=\"1000\"\n step=\"1\"\n .value=${String(Math.round(this.value * 1000))}\n aria-label=${this.label}\n aria-valuetext=${valueText}\n @input=${this.onInput}\n />\n ${this.stops.length\n ? html`<ul class=\"stops\" part=\"stops\">\n ${this.stops.map(\n (s, i) => html`<li>\n <button type=\"button\" aria-current=${i === current ? 'true' : 'false'} @click=${() => this.goTo(s)}>\n <span aria-hidden=\"true\">${s.label}</span><span class=\"sr-only\">${say('Go to {name}', { name: s.label })}</span>\n </button>\n </li>`,\n )}\n </ul>`\n : null}\n </div>\n `;\n }\n}\n\ncustomElements.define('impkt-scrubber', ImpktScrubber);\n\ndeclare global {\n interface HTMLElementTagNameMap { 'impkt-scrubber': ImpktScrubber }\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,MAAM,WAAgC;AAsB/C,IAAM,QAAQ;AAAA,EACZ,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AACV;AAoBO,IAAM,gBAAN,cAA4B,aAAa;AAAA,EAwB9C,cAAc;AACZ,UAAM;AAHR,SAAQ,QAA2B;AAiHnC,SAAQ,aAAa,CAAC,MAAa;AACjC,WAAK,QAAS,EAAwC,OAAO;AAAA,IAC/D;AAEA,SAAQ,UAAU,CAAC,MAAa;AAC9B,YAAM,I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,SAAS;AAAA,mBACjB,KAAK,OAAO;AAAA;AAAA,UAErB,KAAK,MAAM,SACT;AAAA,gBACI,KAAK,MAAM;AAAA,MACX,CAAC,GAAG,MAAM;AAAA,uDAC6B,MAAM,UAAU,SAAS,OAAO,WAAW,MAAM,KAAK,KAAK,CAAC,CAAC;AAAA,+CACrE,EAAE,KAAK,gCAAgC,IAAI,gBAAgB,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAAA;AAAA;AAAA,IAG9G,CAAC;AAAA,qBAEH,IAAI;AAAA;AAAA;AAAA,EAGd;AACF;AAEA,eAAe,OAAO,kBAAkB,aAAa;","names":[]}
@@ -7,7 +7,7 @@ import {
7
7
  space,
8
8
  t,
9
9
  visuallyHidden
10
- } from "./chunk-NTNXHLTM.js";
10
+ } from "./chunk-3KO55PZK.js";
11
11
 
12
12
  // packages/ui/src/base/FieldElement.ts
13
13
  import { html, css, nothing } from "lit";
@@ -119,6 +119,16 @@ var FieldElement = class extends ImpktElement {
119
119
  ].filter(Boolean);
120
120
  return ids.length ? ids.join(" ") : nothing;
121
121
  }
122
+ /**
123
+ * Focusing the element focuses its control, so `el.focus()` from an app, a
124
+ * React ref or the error summary's link lands where someone can type, rather
125
+ * than on a host that cannot take focus and so silently does nothing.
126
+ */
127
+ focus(options) {
128
+ const control = this.renderRoot?.querySelector(`#${this.controlId}`) ?? this.renderRoot?.querySelector("input, select, textarea, button");
129
+ if (control) control.focus(options);
130
+ else super.focus(options);
131
+ }
122
132
  /**
123
133
  * `<label for>` by default. A group of controls — radios, checkboxes —
124
134
  * cannot use one, because `for` names a single control, so those override
@@ -167,4 +177,4 @@ export {
167
177
  fieldWidths,
168
178
  FieldElement
169
179
  };
170
- //# sourceMappingURL=chunk-7BIQ3K6H.js.map
180
+ //# sourceMappingURL=chunk-ZOTAAYO5.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\n/**\n * The base of every form control.\n *\n * @fires {CustomEvent<{ value: string }>} impkt-change - When the answer changes. The answer is in detail.value.\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 /**\n * Focusing the element focuses its control, so `el.focus()` from an app, a\n * React ref or the error summary's link lands where someone can type, rather\n * than on a host that cannot take focus and so silently does nothing.\n */\n focus(options?: FocusOptions): void {\n const control = this.renderRoot?.querySelector<HTMLElement>(`#${this.controlId}`)\n ?? this.renderRoot?.querySelector<HTMLElement>('input, select, textarea, button');\n if (control) control.focus(options);\n else super.focus(options);\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;AAapB,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,WAA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;AAC1C,SAAK,QAAQ;AACb,SAAK,WAAW,aAAa,KAAK;AAClC,SAAK,cAAc,IAAI,YAAY,gBAAgB,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,MAAM,UAAU,KAAK,CAAC,CAAC;AAAA,EAC1G;AACF;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ImpktAccordion
3
- } from "../chunk-XVKEM5JY.js";
4
- import "../chunk-NTNXHLTM.js";
3
+ } from "../chunk-5QSTXIPG.js";
4
+ import "../chunk-3KO55PZK.js";
5
5
  export {
6
6
  ImpktAccordion
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ImpktAlert
3
- } from "../chunk-6ICOJPMD.js";
4
- import "../chunk-NTNXHLTM.js";
3
+ } from "../chunk-CUUBAETM.js";
4
+ import "../chunk-3KO55PZK.js";
5
5
  export {
6
6
  ImpktAlert
7
7
  };
@@ -6,14 +6,15 @@ import { ImpktElement } from '../base/ImpktElement';
6
6
  *
7
7
  * It is a native `<dialog>` opened with `showModal()`, like the dialog, so the
8
8
  * focus trap, Escape, the inert page behind it and the return of focus all come
9
- * from the browser. The slide is a decoration and stops for anyone who has
10
- * asked for reduced motion.
9
+ * from the browser. The page behind it does not scroll while it is open. The
10
+ * slide is a decoration and stops for anyone who has asked for reduced motion.
11
+ * On a phone it fills the screen.
11
12
  *
12
13
  * @category feedback
13
14
  * @icon drawer
14
15
  * @slot - The body of the panel.
15
16
  * @slot footer - Buttons pinned to the bottom of the panel.
16
- * @fires impkt-close - When the panel is closed.
17
+ * @fires {CustomEvent<null>} impkt-close - When the panel is closed.
17
18
  */
18
19
  export declare class ImpktDrawer extends ImpktElement {
19
20
  static properties: {
@@ -42,6 +43,7 @@ export declare class ImpktDrawer extends ImpktElement {
42
43
  private hasFooter;
43
44
  private get dialog();
44
45
  updated(changed: Map<string, unknown>): void;
46
+ disconnectedCallback(): void;
45
47
  private close;
46
48
  private footerChanged;
47
49
  render(): TemplateResult;
@@ -49,14 +51,24 @@ export declare class ImpktDrawer extends ImpktElement {
49
51
  /**
50
52
  * A short message in the corner that goes away: "Viewing booked", "Saved".
51
53
  *
52
- * It says itself to a screen reader through a live region, and its timer stops
53
- * while it is pointed at or focused. Set `duration` to 0 to keep it up until it
54
- * is closed. Anything a person must act on belongs in an alert on the page.
54
+ * It says itself to a screen reader through a live region that is on the page
55
+ * before the message is, and its timer stops while it is pointed at or focused.
56
+ * Set `duration` to 0 to keep it up until it is closed. A message with a button,
57
+ * such as Undo, stays until it is closed whatever the duration, because a
58
+ * button that disappears on a timer cannot be pressed by someone who needs
59
+ * longer (2.2.1). Escape closes it while focus is inside it. Anything a person
60
+ * must act on belongs in an alert on the page.
61
+ *
62
+ * It never takes the page's clicks: only the message itself can be pressed, so
63
+ * the page beside and behind the corner it sits in still works. On a phone it
64
+ * spans the screen above the bottom edge, clear of the home bar and of a bottom
65
+ * bar that sets `--impkt-bottom-bar`, and it rises without moving for anyone who
66
+ * has asked for reduced motion.
55
67
  *
56
68
  * @category feedback
57
69
  * @icon toast
58
- * @fires impkt-close - When the message goes away.
59
- * @fires impkt-action - When its button is pressed.
70
+ * @fires {CustomEvent<null>} impkt-close - When the message goes away.
71
+ * @fires {CustomEvent<null>} impkt-action - When its button is pressed.
60
72
  */
61
73
  export declare class ImpktToast extends ImpktElement {
62
74
  static properties: {
@@ -114,12 +126,14 @@ export interface MenuItem {
114
126
  * A button that opens a short list of actions or links.
115
127
  *
116
128
  * It follows the ARIA menu button pattern: the arrow keys, Home and End move
117
- * through it, Escape closes it and puts focus back on the button, and a click
118
- * anywhere else closes it.
129
+ * through it, a letter moves to the next item that starts with it, Escape
130
+ * closes it and puts focus back on the button, and a click anywhere else closes
131
+ * it. A list that would run off the side of the screen opens towards the other
132
+ * edge instead, so it never makes a phone scroll sideways.
119
133
  *
120
134
  * @category navigation
121
135
  * @icon menu
122
- * @fires impkt-select - When an item without an address is chosen. The value is in detail.value.
136
+ * @fires {CustomEvent<{ value: string }>} impkt-select - When an item without an address is chosen. The value is in detail.value.
123
137
  */
124
138
  export declare class ImpktMenu extends ImpktElement {
125
139
  static properties: {
@@ -154,6 +168,8 @@ export declare class ImpktMenu extends ImpktElement {
154
168
  private get entries();
155
169
  private get trigger();
156
170
  private toggle;
171
+ /** Open towards the other edge when the list would run off the screen. */
172
+ private keepOnScreen;
157
173
  private triggerKey;
158
174
  private listKey;
159
175
  private choose;
@@ -170,7 +186,7 @@ export declare function pageWindow(page: number, pages: number): Array<number |
170
186
  *
171
187
  * @category navigation
172
188
  * @icon pagination
173
- * @fires impkt-page - When a page is chosen. The number is in detail.page.
189
+ * @fires {CustomEvent<{ page: number }>} impkt-page - When a page is chosen. The number is in detail.page.
174
190
  */
175
191
  export declare class ImpktPagination extends ImpktElement {
176
192
  static properties: {
@@ -8,10 +8,12 @@ import {
8
8
  ImpktSlotPicker,
9
9
  ImpktToast,
10
10
  pageWindow
11
- } from "../chunk-QCNT7D5V.js";
12
- import "../chunk-2YQA3VBY.js";
13
- import "../chunk-7BIQ3K6H.js";
14
- import "../chunk-NTNXHLTM.js";
11
+ } from "../chunk-7P4Z4CLK.js";
12
+ import "../chunk-2YRTFWW2.js";
13
+ import "../chunk-3IGNZTJU.js";
14
+ import "../chunk-NKMVICB5.js";
15
+ import "../chunk-ZOTAAYO5.js";
16
+ import "../chunk-3KO55PZK.js";
15
17
  export {
16
18
  ImpktAvatar,
17
19
  ImpktAvatarGroup,
@@ -62,19 +62,31 @@ export declare class ImpktVisuallyHidden extends ImpktElement {
62
62
  export interface TabItem {
63
63
  id: string;
64
64
  label: string;
65
+ /** The panel's words. A child with `slot` set to the tab's id is shown instead, for anything richer. */
65
66
  body: string;
66
67
  }
67
68
  /**
68
69
  * Panels of content behind a row of tabs, one shown at a time: the floor plans
69
- * of three house types, or what is included and what costs extra.
70
+ * of three house types, or a case's summary, tasks and files.
70
71
  *
71
72
  * It follows the ARIA tabs pattern. The tabs are one stop in the tab order,
72
73
  * the arrow keys, Home and End move between them, and each panel is labelled
73
74
  * by its tab. Use an accordion instead when someone may want to compare panels.
74
75
  *
76
+ * **The tabs stay on one row** and scroll sideways when they do not fit, as the
77
+ * design guide sets, and the chosen tab is scrolled into view, so on a phone it
78
+ * is never hidden off the edge. With `two-rows`, a set of more than four tabs is
79
+ * laid out in two rows on a narrow screen instead, so every tab can be seen.
80
+ *
81
+ * **The chosen tab is kept** when the tabs are given again, as a React or Vue app
82
+ * does on every render, so long as a tab with that id is still there.
83
+ *
84
+ * A panel shows its item's `body`, or a child whose `slot` is the item's id.
85
+ *
75
86
  * @category content
76
87
  * @icon tabs
77
- * @fires impkt-change - When another tab is chosen.
88
+ * @slot - A child with `slot` set to a tab's id is that tab's panel.
89
+ * @fires {CustomEvent<{ value: string }>} impkt-change - When another tab is chosen.
78
90
  */
79
91
  export declare class ImpktTabs extends ImpktElement {
80
92
  static properties: {
@@ -88,17 +100,31 @@ export declare class ImpktTabs extends ImpktElement {
88
100
  label: {
89
101
  type: StringConstructor;
90
102
  };
103
+ twoRows: {
104
+ type: BooleanConstructor;
105
+ reflect: boolean;
106
+ attribute: string;
107
+ };
91
108
  };
92
109
  items: TabItem[];
93
110
  /** The id of the tab shown first. The first tab when it is empty. */
94
111
  selected: string;
95
112
  /** What the set of tabs is about, for a screen reader. */
96
113
  label: string;
114
+ /** On a narrow screen, lay more than four tabs out in two rows rather than scroll them. */
115
+ twoRows: boolean;
97
116
  constructor();
98
117
  static styles: import("lit").CSSResult[];
99
118
  private current;
100
119
  private choose;
101
120
  private onKey;
121
+ /**
122
+ * Bring the chosen tab into view inside the row of tabs. Only the row scrolls:
123
+ * `scrollIntoView` would scroll the page too, and move someone who is reading
124
+ * further down.
125
+ */
126
+ private reveal;
127
+ updated(changed: Map<string, unknown>): void;
102
128
  render(): TemplateResult;
103
129
  }
104
130
  /** One card in a row of them. */
@@ -4,9 +4,9 @@ import {
4
4
  ImpktSpacer,
5
5
  ImpktTabs,
6
6
  ImpktVisuallyHidden
7
- } from "../chunk-ZQJD4YEJ.js";
8
- import "../chunk-2YQA3VBY.js";
9
- import "../chunk-NTNXHLTM.js";
7
+ } from "../chunk-HXINWP3V.js";
8
+ import "../chunk-NKMVICB5.js";
9
+ import "../chunk-3KO55PZK.js";
10
10
  export {
11
11
  ImpktCardGrid,
12
12
  ImpktDivider,
@@ -59,6 +59,11 @@ export declare class ImpktButton extends ImpktElement {
59
59
  type: BooleanConstructor;
60
60
  reflect: boolean;
61
61
  };
62
+ fullOnPhone: {
63
+ type: BooleanConstructor;
64
+ attribute: string;
65
+ reflect: boolean;
66
+ };
62
67
  size: {
63
68
  type: StringConstructor;
64
69
  reflect: boolean;
@@ -84,6 +89,8 @@ export declare class ImpktButton extends ImpktElement {
84
89
  /** Announced when the button becomes busy. Says what is happening, not that something is. */
85
90
  busyLabel: string;
86
91
  full: boolean;
92
+ /** As wide as its space on a phone only, such as a form's send button. */
93
+ fullOnPhone: boolean;
87
94
  size: 'sm' | 'md' | 'lg';
88
95
  /** An icon before the words, such as phone or calendar. */
89
96
  iconBefore: 'none' | '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';
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  ImpktButton
3
- } from "../chunk-XJP45LFA.js";
4
- import "../chunk-2YQA3VBY.js";
5
- import "../chunk-NTNXHLTM.js";
3
+ } from "../chunk-DKZ425AM.js";
4
+ import "../chunk-NKMVICB5.js";
5
+ import "../chunk-3KO55PZK.js";
6
6
  export {
7
7
  ImpktButton
8
8
  };