@atomic-ui/ui 0.0.0-stage → 0.1.1

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 (113) hide show
  1. package/README.md +134 -2
  2. package/dist/base/FieldElement.d.ts +95 -0
  3. package/dist/base/ImpktElement.d.ts +21 -0
  4. package/dist/base/styles.d.ts +42 -0
  5. package/dist/base/tokens.d.ts +68 -0
  6. package/dist/chunk-4YAA7EML.js +43 -0
  7. package/dist/chunk-4YAA7EML.js.map +1 -0
  8. package/dist/chunk-6HZA6A3L.js +162 -0
  9. package/dist/chunk-6HZA6A3L.js.map +1 -0
  10. package/dist/chunk-7T34CRBF.js +75 -0
  11. package/dist/chunk-7T34CRBF.js.map +1 -0
  12. package/dist/chunk-AC6G7X3G.js +84 -0
  13. package/dist/chunk-AC6G7X3G.js.map +1 -0
  14. package/dist/chunk-BBWMRF5N.js +157 -0
  15. package/dist/chunk-BBWMRF5N.js.map +1 -0
  16. package/dist/chunk-BOLZMDAS.js +95 -0
  17. package/dist/chunk-BOLZMDAS.js.map +1 -0
  18. package/dist/chunk-BUWE6XGX.js +152 -0
  19. package/dist/chunk-BUWE6XGX.js.map +1 -0
  20. package/dist/chunk-GEBLDC2J.js +136 -0
  21. package/dist/chunk-GEBLDC2J.js.map +1 -0
  22. package/dist/chunk-GU4UQKJP.js +120 -0
  23. package/dist/chunk-GU4UQKJP.js.map +1 -0
  24. package/dist/chunk-HJ2V635J.js +88 -0
  25. package/dist/chunk-HJ2V635J.js.map +1 -0
  26. package/dist/chunk-IHEEUM3M.js +162 -0
  27. package/dist/chunk-IHEEUM3M.js.map +1 -0
  28. package/dist/chunk-J5KAMJ2N.js +138 -0
  29. package/dist/chunk-J5KAMJ2N.js.map +1 -0
  30. package/dist/chunk-KAU3V65B.js +65 -0
  31. package/dist/chunk-KAU3V65B.js.map +1 -0
  32. package/dist/chunk-KC6RKWO6.js +81 -0
  33. package/dist/chunk-KC6RKWO6.js.map +1 -0
  34. package/dist/chunk-NEWN44LO.js +92 -0
  35. package/dist/chunk-NEWN44LO.js.map +1 -0
  36. package/dist/chunk-SSNCGJ5W.js +105 -0
  37. package/dist/chunk-SSNCGJ5W.js.map +1 -0
  38. package/dist/chunk-T4HSPWA7.js +122 -0
  39. package/dist/chunk-T4HSPWA7.js.map +1 -0
  40. package/dist/chunk-T63FI4ET.js +139 -0
  41. package/dist/chunk-T63FI4ET.js.map +1 -0
  42. package/dist/chunk-TOTVL3YH.js +130 -0
  43. package/dist/chunk-TOTVL3YH.js.map +1 -0
  44. package/dist/chunk-TRLEYGGH.js +102 -0
  45. package/dist/chunk-TRLEYGGH.js.map +1 -0
  46. package/dist/chunk-XEN5NV55.js +79 -0
  47. package/dist/chunk-XEN5NV55.js.map +1 -0
  48. package/dist/chunk-Z4KZG2E3.js +131 -0
  49. package/dist/chunk-Z4KZG2E3.js.map +1 -0
  50. package/dist/components/accordion.d.ts +66 -0
  51. package/dist/components/accordion.js +8 -0
  52. package/dist/components/accordion.js.map +1 -0
  53. package/dist/components/alert.d.ts +49 -0
  54. package/dist/components/alert.js +8 -0
  55. package/dist/components/alert.js.map +1 -0
  56. package/dist/components/button.d.ts +70 -0
  57. package/dist/components/button.js +8 -0
  58. package/dist/components/button.js.map +1 -0
  59. package/dist/components/checkbox-group.d.ts +79 -0
  60. package/dist/components/checkbox-group.js +9 -0
  61. package/dist/components/checkbox-group.js.map +1 -0
  62. package/dist/components/checkbox.d.ts +64 -0
  63. package/dist/components/checkbox.js +9 -0
  64. package/dist/components/checkbox.js.map +1 -0
  65. package/dist/components/date-input.d.ts +95 -0
  66. package/dist/components/date-input.js +9 -0
  67. package/dist/components/date-input.js.map +1 -0
  68. package/dist/components/dialog.d.ts +61 -0
  69. package/dist/components/dialog.js +8 -0
  70. package/dist/components/dialog.js.map +1 -0
  71. package/dist/components/grid.d.ts +34 -0
  72. package/dist/components/grid.js +8 -0
  73. package/dist/components/grid.js.map +1 -0
  74. package/dist/components/help.d.ts +103 -0
  75. package/dist/components/help.js +8 -0
  76. package/dist/components/help.js.map +1 -0
  77. package/dist/components/layout.d.ts +100 -0
  78. package/dist/components/layout.js +14 -0
  79. package/dist/components/layout.js.map +1 -0
  80. package/dist/components/link.d.ts +46 -0
  81. package/dist/components/link.js +8 -0
  82. package/dist/components/link.js.map +1 -0
  83. package/dist/components/media.d.ts +164 -0
  84. package/dist/components/media.js +12 -0
  85. package/dist/components/media.js.map +1 -0
  86. package/dist/components/price.d.ts +67 -0
  87. package/dist/components/price.js +8 -0
  88. package/dist/components/price.js.map +1 -0
  89. package/dist/components/progress.d.ts +50 -0
  90. package/dist/components/progress.js +8 -0
  91. package/dist/components/progress.js.map +1 -0
  92. package/dist/components/radio-group.d.ts +82 -0
  93. package/dist/components/radio-group.js +9 -0
  94. package/dist/components/radio-group.js.map +1 -0
  95. package/dist/components/select.d.ts +74 -0
  96. package/dist/components/select.js +9 -0
  97. package/dist/components/select.js.map +1 -0
  98. package/dist/components/summary-list.d.ts +47 -0
  99. package/dist/components/summary-list.js +8 -0
  100. package/dist/components/summary-list.js.map +1 -0
  101. package/dist/components/table.d.ts +49 -0
  102. package/dist/components/table.js +8 -0
  103. package/dist/components/table.js.map +1 -0
  104. package/dist/components/text-input.d.ts +80 -0
  105. package/dist/components/text-input.js +9 -0
  106. package/dist/components/text-input.js.map +1 -0
  107. package/dist/components/textarea.d.ts +59 -0
  108. package/dist/components/textarea.js +9 -0
  109. package/dist/components/textarea.js.map +1 -0
  110. package/dist/index.d.ts +31 -0
  111. package/dist/index.js +113 -0
  112. package/dist/index.js.map +1 -0
  113. package/package.json +45 -4
@@ -0,0 +1,75 @@
1
+ import {
2
+ FieldElement
3
+ } from "./chunk-6HZA6A3L.js";
4
+ import {
5
+ fontSize,
6
+ space,
7
+ t
8
+ } from "./chunk-J5KAMJ2N.js";
9
+
10
+ // packages/ui/src/components/textarea.ts
11
+ import { html, css, nothing } from "lit";
12
+ var ImpktTextarea = class extends FieldElement {
13
+ static {
14
+ this.properties = {
15
+ ...FieldElement.properties,
16
+ rows: { type: Number },
17
+ maxlength: { type: Number }
18
+ };
19
+ }
20
+ constructor() {
21
+ super();
22
+ this.rows = 4;
23
+ this.maxlength = void 0;
24
+ }
25
+ static {
26
+ this.styles = [
27
+ ...FieldElement.styles,
28
+ css`
29
+ textarea {
30
+ inline-size: 100%;
31
+ padding: ${space(3)};
32
+ font-family: inherit;
33
+ font-size: ${fontSize("md")};
34
+ color: ${t.text};
35
+ background: ${t.surfaceCard};
36
+ border: ${t.borderThin} solid ${t.border};
37
+ border-radius: ${t.radius};
38
+ /* Resizing is left on deliberately. 1.4.4 and 1.4.12 both assume text
39
+ can be made bigger, and a fixed box is where that stops working. */
40
+ resize: vertical;
41
+ }
42
+ :host([invalid]) textarea {
43
+ border-color: ${t.danger};
44
+ border-width: ${t.borderThick};
45
+ }
46
+ `
47
+ ];
48
+ }
49
+ renderControl() {
50
+ return html`
51
+ <textarea
52
+ id=${this.controlId}
53
+ part="textarea"
54
+ name=${this.name || nothing}
55
+ rows=${this.rows}
56
+ maxlength=${this.maxlength ?? nothing}
57
+ ?disabled=${this.disabled}
58
+ ?readonly=${this.readonly}
59
+ ?required=${this.required}
60
+ aria-describedby=${this.describedBy}
61
+ aria-invalid=${this.error ? "true" : nothing}
62
+ @input=${(e) => this.setFormValue(e.target.value)}
63
+ >${this.value}</textarea>
64
+ `;
65
+ }
66
+ updated(changed) {
67
+ if (changed.has("error")) this.toggleAttribute("invalid", Boolean(this.error));
68
+ }
69
+ };
70
+ customElements.define("impkt-textarea", ImpktTextarea);
71
+
72
+ export {
73
+ ImpktTextarea
74
+ };
75
+ //# sourceMappingURL=chunk-7T34CRBF.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/textarea.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement } from '../base/FieldElement';\nimport { fontSize, space, t } from '../base/tokens';\n\n/** Several lines of text — a delivery instruction, an additional note.\n *\n * @category form\n * @icon field\n */\nexport class ImpktTextarea extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n rows: { type: Number },\n maxlength: { type: Number },\n };\n\n declare rows: number;\n declare maxlength: number | undefined;\n\n constructor() {\n super();\n this.rows = 4;\n this.maxlength = undefined;\n }\n\n static styles = [\n ...FieldElement.styles,\n css`\n textarea {\n inline-size: 100%;\n padding: ${space(3)};\n font-family: inherit;\n font-size: ${fontSize('md')};\n color: ${t.text};\n background: ${t.surfaceCard};\n border: ${t.borderThin} solid ${t.border};\n border-radius: ${t.radius};\n /* Resizing is left on deliberately. 1.4.4 and 1.4.12 both assume text\n can be made bigger, and a fixed box is where that stops working. */\n resize: vertical;\n }\n :host([invalid]) textarea {\n border-color: ${t.danger};\n border-width: ${t.borderThick};\n }\n `,\n ];\n\n protected renderControl(): TemplateResult {\n return html`\n <textarea\n id=${this.controlId}\n part=\"textarea\"\n name=${this.name || nothing}\n rows=${this.rows}\n maxlength=${this.maxlength ?? nothing}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n aria-describedby=${this.describedBy}\n aria-invalid=${this.error ? 'true' : nothing}\n @input=${(e: Event) => this.setFormValue((e.target as HTMLTextAreaElement).value)}\n >${this.value}</textarea>\n `;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\ncustomElements.define('impkt-textarea', ImpktTextarea);\n\ndeclare global {\n interface HTMLElementTagNameMap { 'impkt-textarea': ImpktTextarea }\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AASjD,IAAM,gBAAN,cAA4B,aAAa;AAAA,EAC9C;AAAA,SAAO,aAAa;AAAA,MAClB,GAAG,aAAa;AAAA,MAChB,MAAM,EAAE,MAAM,OAAO;AAAA,MACrB,WAAW,EAAE,MAAM,OAAO;AAAA,IAC5B;AAAA;AAAA,EAKA,cAAc;AACZ,UAAM;AACN,SAAK,OAAO;AACZ,SAAK,YAAY;AAAA,EACnB;AAAA,EAEA;AAAA,SAAO,SAAS;AAAA,MACd,GAAG,aAAa;AAAA,MAChB;AAAA;AAAA;AAAA,mBAGe,MAAM,CAAC,CAAC;AAAA;AAAA,qBAEN,SAAS,IAAI,CAAC;AAAA,iBAClB,EAAE,IAAI;AAAA,sBACD,EAAE,WAAW;AAAA,kBACjB,EAAE,UAAU,UAAU,EAAE,MAAM;AAAA,yBACvB,EAAE,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAMT,EAAE,MAAM;AAAA,wBACR,EAAE,WAAW;AAAA;AAAA;AAAA,IAGnC;AAAA;AAAA,EAEU,gBAAgC;AACxC,WAAO;AAAA;AAAA,aAEE,KAAK,SAAS;AAAA;AAAA,eAEZ,KAAK,QAAQ,OAAO;AAAA,eACpB,KAAK,IAAI;AAAA,oBACJ,KAAK,aAAa,OAAO;AAAA,oBACzB,KAAK,QAAQ;AAAA,oBACb,KAAK,QAAQ;AAAA,oBACb,KAAK,QAAQ;AAAA,2BACN,KAAK,WAAW;AAAA,uBACpB,KAAK,QAAQ,SAAS,OAAO;AAAA,iBACnC,CAAC,MAAa,KAAK,aAAc,EAAE,OAA+B,KAAK,CAAC;AAAA,SAChF,KAAK,KAAK;AAAA;AAAA,EAEjB;AAAA,EAEA,QAAQ,SAAqC;AAC3C,QAAI,QAAQ,IAAI,OAAO,EAAG,MAAK,gBAAgB,WAAW,QAAQ,KAAK,KAAK,CAAC;AAAA,EAC/E;AACF;AAEA,eAAe,OAAO,kBAAkB,aAAa;","names":[]}
@@ -0,0 +1,84 @@
1
+ import {
2
+ ImpktElement,
3
+ focusRing,
4
+ fontWeight,
5
+ t
6
+ } from "./chunk-J5KAMJ2N.js";
7
+
8
+ // packages/ui/src/components/help.ts
9
+ import { html, css, nothing } from "lit";
10
+ var ImpktHelp = class extends ImpktElement {
11
+ static {
12
+ this.properties = {
13
+ mechanismId: { type: String, attribute: "mechanism-id" },
14
+ kind: { type: String, reflect: true },
15
+ href: { type: String },
16
+ label: { type: String },
17
+ detail: { type: String }
18
+ };
19
+ }
20
+ constructor() {
21
+ super();
22
+ this.kind = "link";
23
+ this.href = "";
24
+ this.label = "";
25
+ this.detail = "";
26
+ }
27
+ static {
28
+ this.styles = [...ImpktElement.styles, focusRing, css`
29
+ :host { display: block; }
30
+ a { display: inline-flex; align-items: center; min-height: ${t.targetMin}; min-width: ${t.targetMin};
31
+ color: ${t.link}; text-decoration: underline; overflow-wrap: anywhere; max-width: 100%; }
32
+ a:hover { color: ${t.linkHover}; }
33
+ .contact { margin: 0; }
34
+ .caption { display: block; font-weight: ${fontWeight("semibold")}; }
35
+ /* An address is written one line at a time, and opening hours are often one
36
+ day to a line. Long unbroken values still wrap at 320px (1.4.10). */
37
+ .detail { white-space: pre-line; overflow-wrap: anywhere; }
38
+ `];
39
+ }
40
+ render() {
41
+ switch (this.kind) {
42
+ case "phone":
43
+ case "email":
44
+ case "address":
45
+ case "hours":
46
+ return this.renderContact();
47
+ default:
48
+ return this.renderLink();
49
+ }
50
+ }
51
+ renderLink() {
52
+ if (!text(this.label)) return nothing;
53
+ return html`<a part="link" href=${this.href}>${this.label}</a>`;
54
+ }
55
+ renderContact() {
56
+ const detail = text(this.detail);
57
+ if (!detail) return nothing;
58
+ const caption = text(this.label);
59
+ const target = contactHref(this.kind, detail);
60
+ const captionId = this.id_("caption");
61
+ const detailId = this.id_("detail");
62
+ const captionPart = caption ? html`<span class="caption" part="label" id=${captionId}>${caption}</span>` : nothing;
63
+ const detailPart = target ? html`<a part="link" href=${target} aria-labelledby=${caption ? `${captionId} ${detailId}` : nothing}
64
+ ><span class="detail" part="detail" id=${detailId}>${detail}</span></a>` : html`<span class="detail" part="detail">${detail}</span>`;
65
+ return html`<p class="contact" part="contact">${captionPart}${detailPart}</p>`;
66
+ }
67
+ };
68
+ function text(value) {
69
+ return typeof value === "string" ? value.trim() : "";
70
+ }
71
+ function contactHref(kind, detail) {
72
+ if (kind === "phone") {
73
+ const digits = detail.replace(/\(0\)/g, "").replace(/[^\d+]/g, "").replace(/(?!^)\+/g, "");
74
+ return /\d/.test(digits) ? `tel:${digits}` : "";
75
+ }
76
+ if (kind === "email") return /^[^\s@]+@[^\s@]+$/.test(detail) ? `mailto:${detail}` : "";
77
+ return "";
78
+ }
79
+ customElements.define("impkt-help", ImpktHelp);
80
+
81
+ export {
82
+ ImpktHelp
83
+ };
84
+ //# sourceMappingURL=chunk-AC6G7X3G.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/help.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpktElement } from '../base/ImpktElement';\nimport { focusRing } from '../base/styles';\nimport { fontWeight, t } from '../base/tokens';\n\n/**\n * What form a help mechanism takes.\n *\n * `link` goes somewhere: a help page, a contact form, a chat. The other four\n * are the \"human contact details\" that 3.2.6 Consistent Help names, shown as\n * text so a reader can see them without following anything.\n */\nexport type HelpKind = 'link' | 'phone' | 'email' | 'address' | 'hours';\n\n/**\n * A help link, or contact details shown as text.\n *\n * **Its identity is `mechanismId`, not its wording or destination.** 3.2.6\n * Consistent Help asks that help offered on several pages appears in the same\n * relative order on each. Strata checks that at publish by comparing these ids\n * across pages, so the label can be reworded and the number can change\n * without the check treating it as a different mechanism. It is literal and\n * cannot be bound, because an id that a data response could change is one the\n * check cannot compare.\n *\n * **Contact details are text, not a link to a page that has them.** The\n * criterion lists a phone number, an email address and a postal address as\n * help in their own right, and a reader who has to follow a link to find the\n * number has been given a link rather than the number. A phone number renders\n * as a `tel:` link and an email address as a `mailto:` link, each with the\n * detail itself as the visible text. The link target is derived from the\n * visible detail rather than authored separately, so the number a reader sees\n * and the number their phone dials cannot drift apart. An address or opening\n * hours render as plain text and keep the line breaks they were written with.\n *\n * **Contact links are named by their caption and their detail.** A phone\n * link's accessible name is \"Call us 0800 123 456\" rather than the bare\n * number, because a reader moving through a list of links hears each one out\n * of context (2.4.4 Link Purpose). The visible text stays inside the name, so\n * 2.5.3 Label in Name holds for a reader who speaks it.\n *\n * **Nothing unnamed or empty is ever rendered.** Runtime bindings may be\n * absent while data loads, or resolve to blank text. A link with no label, or\n * contact details with no detail, render nothing rather than a focusable link\n * with no name or a caption with nothing under it. Contact details whose\n * caption is blank still show the detail, because a phone number or an\n * address names itself. For that reason the caption is optional for contact\n * details, and publishing requires a label only on a link. Publishing does\n * require what each kind cannot do without: a link's label and address, and\n * contact details' detail, so the empty states are only reached at runtime.\n *\n * **Every link meets the minimum target size.** Links here are at least the\n * locked `target.min` token in both directions (2.5.8 Target Size), because a\n * help link usually stands on its own line, where the criterion's inline\n * exemption does not apply.\n *\n * @category action\n * @icon help\n * @role help\n */\nexport class ImpktHelp extends ImpktElement {\n static properties = {\n mechanismId: { type: String, attribute: 'mechanism-id' },\n kind: { type: String, reflect: true },\n href: { type: String },\n label: { type: String },\n detail: { type: String },\n };\n\n /** Stable identity across pages, independent of wording and destination. */\n declare mechanismId: string;\n // Written out as a union rather than as `HelpKind` so the manifest offers it\n // as a fixed choice: which form help takes is a design decision, not data.\n /** Whether this is a link to help, or contact details shown as text. */\n declare kind: 'link' | 'phone' | 'email' | 'address' | 'hours';\n /** Where a link goes. Phone and email links are built from the detail instead. */\n declare href: string;\n /**\n * The visible name. For a link it is the link text. For contact details it\n * is the caption shown above them, such as \"Call us\".\n */\n declare label: string;\n /**\n * The contact detail itself: a phone number, an email address, a postal\n * address or opening hours. Line breaks are kept. Unused by a link.\n */\n declare detail: string;\n\n constructor() {\n super();\n this.kind = 'link';\n this.href = '';\n // Defaulted, so the manifest does not mark it required: contact details\n // may leave the caption out. A link without one is refused at publish.\n this.label = '';\n this.detail = '';\n }\n\n static styles = [...ImpktElement.styles, focusRing, css`\n :host { display: block; }\n a { display: inline-flex; align-items: center; min-height: ${t.targetMin}; min-width: ${t.targetMin};\n color: ${t.link}; text-decoration: underline; overflow-wrap: anywhere; max-width: 100%; }\n a:hover { color: ${t.linkHover}; }\n .contact { margin: 0; }\n .caption { display: block; font-weight: ${fontWeight('semibold')}; }\n /* An address is written one line at a time, and opening hours are often one\n day to a line. Long unbroken values still wrap at 320px (1.4.10). */\n .detail { white-space: pre-line; overflow-wrap: anywhere; }\n `];\n\n render(): TemplateResult | typeof nothing {\n switch (this.kind) {\n case 'phone':\n case 'email':\n case 'address':\n case 'hours':\n return this.renderContact();\n default:\n // An absent or unrecognised kind keeps the original link behaviour, so\n // a page published before contact details existed renders unchanged.\n return this.renderLink();\n }\n }\n\n private renderLink(): TemplateResult | typeof nothing {\n // Runtime bindings may be absent while data loads, or resolve to blank text.\n // Do not expose an unnamed focusable link in those states.\n if (!text(this.label)) return nothing;\n return html`<a part=\"link\" href=${this.href}>${this.label}</a>`;\n }\n\n private renderContact(): TemplateResult | typeof nothing {\n const detail = text(this.detail);\n // A caption with nothing under it is not help, so neither is drawn.\n if (!detail) return nothing;\n const caption = text(this.label);\n const target = contactHref(this.kind, detail);\n const captionId = this.id_('caption');\n const detailId = this.id_('detail');\n const captionPart = caption\n ? html`<span class=\"caption\" part=\"label\" id=${captionId}>${caption}</span>`\n : nothing;\n const detailPart = target\n ? html`<a part=\"link\" href=${target} aria-labelledby=${caption ? `${captionId} ${detailId}` : nothing}\n ><span class=\"detail\" part=\"detail\" id=${detailId}>${detail}</span></a>`\n : html`<span class=\"detail\" part=\"detail\">${detail}</span>`;\n return html`<p class=\"contact\" part=\"contact\">${captionPart}${detailPart}</p>`;\n }\n}\n\n/** Trimmed text, or empty for anything that is not a string. */\nfunction text(value: unknown): string {\n return typeof value === 'string' ? value.trim() : '';\n}\n\n/**\n * The link a contact detail opens, or empty when it should stay as text.\n *\n * A phone number is reduced to its digits and one leading `+`, and the \"(0)\"\n * that UK numbers print after the country code is dropped, because the\n * separators a reader expects are not dialled. A value with no digits, or an\n * email address without an `@`, stays as plain text. The reader still sees\n * it, and nothing offers to dial or mail something that cannot work.\n */\nfunction contactHref(kind: string, detail: string): string {\n if (kind === 'phone') {\n const digits = detail.replace(/\\(0\\)/g, '').replace(/[^\\d+]/g, '').replace(/(?!^)\\+/g, '');\n return /\\d/.test(digits) ? `tel:${digits}` : '';\n }\n if (kind === 'email') return /^[^\\s@]+@[^\\s@]+$/.test(detail) ? `mailto:${detail}` : '';\n return '';\n}\n\ncustomElements.define('impkt-help', ImpktHelp);\ndeclare global {\n interface HTMLElementTagNameMap { 'impkt-help': ImpktHelp }\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AA4DjD,IAAM,YAAN,cAAwB,aAAa;AAAA,EAC1C;AAAA,SAAO,aAAa;AAAA,MAClB,aAAa,EAAE,MAAM,QAAQ,WAAW,eAAe;AAAA,MACvD,MAAM,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACpC,MAAM,EAAE,MAAM,OAAO;AAAA,MACrB,OAAO,EAAE,MAAM,OAAO;AAAA,MACtB,QAAQ,EAAE,MAAM,OAAO;AAAA,IACzB;AAAA;AAAA,EAqBA,cAAc;AACZ,UAAM;AACN,SAAK,OAAO;AACZ,SAAK,OAAO;AAGZ,SAAK,QAAQ;AACb,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA;AAAA,SAAO,SAAS,CAAC,GAAG,aAAa,QAAQ,WAAW;AAAA;AAAA,iEAEW,EAAE,SAAS,gBAAgB,EAAE,SAAS;AAAA,eACxF,EAAE,IAAI;AAAA,uBACE,EAAE,SAAS;AAAA;AAAA,8CAEY,WAAW,UAAU,CAAC;AAAA;AAAA;AAAA;AAAA,GAIjE;AAAA;AAAA,EAED,SAA0C;AACxC,YAAQ,KAAK,MAAM;AAAA,MACjB,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AACH,eAAO,KAAK,cAAc;AAAA,MAC5B;AAGE,eAAO,KAAK,WAAW;AAAA,IAC3B;AAAA,EACF;AAAA,EAEQ,aAA8C;AAGpD,QAAI,CAAC,KAAK,KAAK,KAAK,EAAG,QAAO;AAC9B,WAAO,2BAA2B,KAAK,IAAI,IAAI,KAAK,KAAK;AAAA,EAC3D;AAAA,EAEQ,gBAAiD;AACvD,UAAM,SAAS,KAAK,KAAK,MAAM;AAE/B,QAAI,CAAC,OAAQ,QAAO;AACpB,UAAM,UAAU,KAAK,KAAK,KAAK;AAC/B,UAAM,SAAS,YAAY,KAAK,MAAM,MAAM;AAC5C,UAAM,YAAY,KAAK,IAAI,SAAS;AACpC,UAAM,WAAW,KAAK,IAAI,QAAQ;AAClC,UAAM,cAAc,UAChB,6CAA6C,SAAS,IAAI,OAAO,YACjE;AACJ,UAAM,aAAa,SACf,2BAA2B,MAAM,oBAAoB,UAAU,GAAG,SAAS,IAAI,QAAQ,KAAK,OAAO;AAAA,mDACxD,QAAQ,IAAI,MAAM,gBAC7D,0CAA0C,MAAM;AACpD,WAAO,yCAAyC,WAAW,GAAG,UAAU;AAAA,EAC1E;AACF;AAGA,SAAS,KAAK,OAAwB;AACpC,SAAO,OAAO,UAAU,WAAW,MAAM,KAAK,IAAI;AACpD;AAWA,SAAS,YAAY,MAAc,QAAwB;AACzD,MAAI,SAAS,SAAS;AACpB,UAAM,SAAS,OAAO,QAAQ,UAAU,EAAE,EAAE,QAAQ,WAAW,EAAE,EAAE,QAAQ,YAAY,EAAE;AACzF,WAAO,KAAK,KAAK,MAAM,IAAI,OAAO,MAAM,KAAK;AAAA,EAC/C;AACA,MAAI,SAAS,QAAS,QAAO,oBAAoB,KAAK,MAAM,IAAI,UAAU,MAAM,KAAK;AACrF,SAAO;AACT;AAEA,eAAe,OAAO,cAAc,SAAS;","names":[]}
@@ -0,0 +1,157 @@
1
+ import {
2
+ ImpktElement,
3
+ focusRing,
4
+ fontSize,
5
+ fontWeight,
6
+ space,
7
+ t,
8
+ targetSize,
9
+ visuallyHidden
10
+ } from "./chunk-J5KAMJ2N.js";
11
+
12
+ // packages/ui/src/components/button.ts
13
+ import { html, css, nothing } from "lit";
14
+ var ImpktButton = class extends ImpktElement {
15
+ constructor() {
16
+ super();
17
+ this.internals = null;
18
+ this.variant = "primary";
19
+ this.type = "button";
20
+ this.disabled = false;
21
+ this.busy = false;
22
+ this.busyLabel = "Working";
23
+ this.full = false;
24
+ try {
25
+ this.internals = this.attachInternals();
26
+ } catch {
27
+ this.internals = null;
28
+ }
29
+ }
30
+ static {
31
+ this.formAssociated = true;
32
+ }
33
+ static {
34
+ this.properties = {
35
+ variant: { type: String, reflect: true },
36
+ type: { type: String },
37
+ disabled: { type: Boolean, reflect: true },
38
+ busy: { type: Boolean, reflect: true },
39
+ busyLabel: { type: String, attribute: "busy-label" },
40
+ full: { type: Boolean, reflect: true }
41
+ };
42
+ }
43
+ static {
44
+ this.styles = [
45
+ ...ImpktElement.styles,
46
+ focusRing,
47
+ css`
48
+ :host {
49
+ display: inline-block;
50
+ }
51
+ :host([full]) {
52
+ display: block;
53
+ }
54
+ button {
55
+ ${targetSize}
56
+ display: inline-flex;
57
+ align-items: center;
58
+ justify-content: center;
59
+ gap: ${space(2)};
60
+ inline-size: 100%;
61
+ padding: ${space(3)} ${space(5)};
62
+ font-family: inherit;
63
+ font-size: ${fontSize("md")};
64
+ font-weight: ${fontWeight("semibold")};
65
+ line-height: 1.2;
66
+ border-radius: ${t.radius};
67
+ border: ${t.borderThick} solid transparent;
68
+ cursor: pointer;
69
+ transition: background-color 120ms ease-in-out, border-color 120ms ease-in-out;
70
+ }
71
+ /* The cursor is the only thing that changes while busy. Moving or
72
+ recolouring a control the moment it is pressed is how a user loses it. */
73
+ button[aria-disabled='true'] {
74
+ cursor: progress;
75
+ }
76
+ :host([disabled]) button {
77
+ cursor: not-allowed;
78
+ opacity: 0.55;
79
+ }
80
+
81
+ button.primary {
82
+ background: ${t.brand};
83
+ color: ${t.onBrand};
84
+ }
85
+ button.primary:hover:not([aria-disabled='true']) {
86
+ background: ${t.brandHover};
87
+ }
88
+ button.primary:active:not([aria-disabled='true']) {
89
+ background: ${t.brandActive};
90
+ }
91
+
92
+ button.secondary {
93
+ background: transparent;
94
+ color: ${t.link};
95
+ border-color: currentColor;
96
+ }
97
+ button.secondary:hover:not([aria-disabled='true']) {
98
+ background: ${t.brandSubtle};
99
+ }
100
+
101
+ button.ghost {
102
+ background: transparent;
103
+ color: ${t.link};
104
+ border-color: transparent;
105
+ text-decoration: underline;
106
+ }
107
+ button.ghost:hover:not([aria-disabled='true']) {
108
+ background: ${t.brandSubtle};
109
+ }
110
+
111
+ .sr-only {
112
+ ${visuallyHidden}
113
+ }
114
+
115
+ /* Windows High Contrast Mode drops background and border colours, so a
116
+ button styled only by background becomes invisible. A forced-colors
117
+ border puts the boundary back. */
118
+ @media (forced-colors: active) {
119
+ button {
120
+ border-color: ButtonBorder;
121
+ }
122
+ }
123
+ `
124
+ ];
125
+ }
126
+ onClick(event) {
127
+ if (this.disabled || this.busy) {
128
+ event.preventDefault();
129
+ event.stopImmediatePropagation();
130
+ return;
131
+ }
132
+ if (this.type === "submit") this.internals?.form?.requestSubmit();
133
+ if (this.type === "reset") this.internals?.form?.reset();
134
+ }
135
+ render() {
136
+ return html`
137
+ <button
138
+ class=${this.variant}
139
+ type="button"
140
+ part="button"
141
+ ?disabled=${this.disabled}
142
+ aria-disabled=${this.busy ? "true" : nothing}
143
+ aria-busy=${this.busy ? "true" : nothing}
144
+ @click=${this.onClick}
145
+ >
146
+ <slot></slot>
147
+ ${this.busy ? html`<span class="sr-only">${this.busyLabel}</span>` : nothing}
148
+ </button>
149
+ `;
150
+ }
151
+ };
152
+ customElements.define("impkt-button", ImpktButton);
153
+
154
+ export {
155
+ ImpktButton
156
+ };
157
+ //# sourceMappingURL=chunk-BBWMRF5N.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/button.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpktElement } from '../base/ImpktElement';\nimport { focusRing, targetSize, visuallyHidden } from '../base/styles';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\n/**\n * A button.\n *\n * Two decisions carry the accessibility weight here.\n *\n * **A busy button is not a disabled button.** While an action is in flight the\n * control keeps its place in the tab order and reports `aria-disabled`, rather\n * than taking the native `disabled` attribute. A natively disabled element is\n * removed from the tab order, so a keyboard user who had just activated it\n * loses their focus position to the top of the document — at precisely the\n * moment something is happening that they need to be told about. Activation is\n * blocked in the handler instead.\n *\n * **It renders a real `<button>`.** A `<div role=\"button\">` needs Enter and\n * Space handling, a tabindex, and a disabled story, and it will still not\n * submit a form. The native element already has all of that, correctly, in\n * every browser and every assistive technology.\n\n *\n * @category action\n * @icon button\n * @slot - The button label.\n */\nexport class ImpktButton extends ImpktElement {\n static formAssociated = true;\n\n static properties = {\n variant: { type: String, reflect: true },\n type: { type: String },\n disabled: { type: Boolean, reflect: true },\n busy: { type: Boolean, reflect: true },\n busyLabel: { type: String, attribute: 'busy-label' },\n full: { type: Boolean, reflect: true },\n };\n\n declare variant: 'primary' | 'secondary' | 'ghost';\n declare type: 'button' | 'submit' | 'reset';\n declare disabled: boolean;\n declare busy: boolean;\n /** Announced when the button becomes busy. Says what is happening, not that something is. */\n declare busyLabel: string;\n declare full: boolean;\n\n private internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this.variant = 'primary';\n this.type = 'button';\n this.disabled = false;\n this.busy = false;\n this.busyLabel = 'Working';\n this.full = false;\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: inline-block;\n }\n :host([full]) {\n display: block;\n }\n button {\n ${targetSize}\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: ${space(2)};\n inline-size: 100%;\n padding: ${space(3)} ${space(5)};\n font-family: inherit;\n font-size: ${fontSize('md')};\n font-weight: ${fontWeight('semibold')};\n line-height: 1.2;\n border-radius: ${t.radius};\n border: ${t.borderThick} solid transparent;\n cursor: pointer;\n transition: background-color 120ms ease-in-out, border-color 120ms ease-in-out;\n }\n /* The cursor is the only thing that changes while busy. Moving or\n recolouring a control the moment it is pressed is how a user loses it. */\n button[aria-disabled='true'] {\n cursor: progress;\n }\n :host([disabled]) button {\n cursor: not-allowed;\n opacity: 0.55;\n }\n\n button.primary {\n background: ${t.brand};\n color: ${t.onBrand};\n }\n button.primary:hover:not([aria-disabled='true']) {\n background: ${t.brandHover};\n }\n button.primary:active:not([aria-disabled='true']) {\n background: ${t.brandActive};\n }\n\n button.secondary {\n background: transparent;\n color: ${t.link};\n border-color: currentColor;\n }\n button.secondary:hover:not([aria-disabled='true']) {\n background: ${t.brandSubtle};\n }\n\n button.ghost {\n background: transparent;\n color: ${t.link};\n border-color: transparent;\n text-decoration: underline;\n }\n button.ghost:hover:not([aria-disabled='true']) {\n background: ${t.brandSubtle};\n }\n\n .sr-only {\n ${visuallyHidden}\n }\n\n /* Windows High Contrast Mode drops background and border colours, so a\n button styled only by background becomes invisible. A forced-colors\n border puts the boundary back. */\n @media (forced-colors: active) {\n button {\n border-color: ButtonBorder;\n }\n }\n `,\n ];\n\n private onClick(event: MouseEvent): void {\n if (this.disabled || this.busy) {\n event.preventDefault();\n event.stopImmediatePropagation();\n return;\n }\n // A shadow-rooted button does not submit the outer form by itself, because\n // the click never reaches it. `requestSubmit` rather than `submit` so that\n // native validation and the submit event both still run.\n if (this.type === 'submit') this.internals?.form?.requestSubmit();\n if (this.type === 'reset') this.internals?.form?.reset();\n }\n\n render(): TemplateResult {\n return html`\n <button\n class=${this.variant}\n type=\"button\"\n part=\"button\"\n ?disabled=${this.disabled}\n aria-disabled=${this.busy ? 'true' : nothing}\n aria-busy=${this.busy ? 'true' : nothing}\n @click=${this.onClick}\n >\n <slot></slot>\n ${this.busy ? html`<span class=\"sr-only\">${this.busyLabel}</span>` : nothing}\n </button>\n `;\n }\n}\n\ncustomElements.define('impkt-button', ImpktButton);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impkt-button': ImpktButton;\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AA4BjD,IAAM,cAAN,cAA0B,aAAa;AAA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AA;AAAA,iBAKlB,EAAE,IAAI;AAAA;AAAA;AAAA;AAAA,sBAID,EAAE,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA,iBAKlB,EAAE,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA,sBAKD,EAAE,WAAW;AAAA;AAAA;AAAA;AAAA,UAIzB,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAYtB;AAAA;AAAA,EAEQ,QAAQ,OAAyB;AACvC,QAAI,KAAK,YAAY,KAAK,MAAM;AAC9B,YAAM,eAAe;AACrB,YAAM,yBAAyB;AAC/B;AAAA,IACF;AAIA,QAAI,KAAK,SAAS,SAAU,MAAK,WAAW,MAAM,cAAc;AAChE,QAAI,KAAK,SAAS,QAAS,MAAK,WAAW,MAAM,MAAM;AAAA,EACzD;AAAA,EAEA,SAAyB;AACvB,WAAO;AAAA;AAAA,gBAEK,KAAK,OAAO;AAAA;AAAA;AAAA,oBAGR,KAAK,QAAQ;AAAA,wBACT,KAAK,OAAO,SAAS,OAAO;AAAA,oBAChC,KAAK,OAAO,SAAS,OAAO;AAAA,iBAC/B,KAAK,OAAO;AAAA;AAAA;AAAA,UAGnB,KAAK,OAAO,6BAA6B,KAAK,SAAS,YAAY,OAAO;AAAA;AAAA;AAAA,EAGlF;AACF;AAEA,eAAe,OAAO,gBAAgB,WAAW;","names":[]}
@@ -0,0 +1,95 @@
1
+ import {
2
+ ImpktElement,
3
+ fontSize,
4
+ fontWeight,
5
+ space,
6
+ t,
7
+ visuallyHidden
8
+ } from "./chunk-J5KAMJ2N.js";
9
+
10
+ // packages/ui/src/components/progress.ts
11
+ import { html, css, nothing } from "lit";
12
+ var ImpktProgress = class extends ImpktElement {
13
+ static {
14
+ this.properties = {
15
+ steps: { type: Array },
16
+ current: { type: String },
17
+ label: { type: String }
18
+ };
19
+ }
20
+ constructor() {
21
+ super();
22
+ this.steps = [];
23
+ this.current = "";
24
+ this.label = "Progress";
25
+ }
26
+ static {
27
+ this.styles = [
28
+ ...ImpktElement.styles,
29
+ css`
30
+ :host {
31
+ display: block;
32
+ margin-block-end: ${space(5)};
33
+ }
34
+ ol {
35
+ display: flex;
36
+ gap: ${space(2)};
37
+ list-style: none;
38
+ margin: 0;
39
+ padding: 0;
40
+ }
41
+ li {
42
+ flex: 1;
43
+ font-size: ${fontSize("xs")};
44
+ color: ${t.textMuted};
45
+ padding-block-start: ${space(2)};
46
+ border-block-start: 4px solid ${t.border};
47
+ }
48
+ li[data-state='done'] {
49
+ color: ${t.text};
50
+ border-block-start-color: ${t.brand};
51
+ }
52
+ li[data-state='current'] {
53
+ color: ${t.text};
54
+ font-weight: ${fontWeight("semibold")};
55
+ border-block-start-color: ${t.brand};
56
+ }
57
+ .sr-only {
58
+ ${visuallyHidden}
59
+ }
60
+ /* Below 30rem the labels stop fitting; the position in words is the part
61
+ that has to survive, so the list collapses to bars and the current
62
+ step's name. */
63
+ @media (max-width: 30rem) {
64
+ li:not([data-state='current']) span:not(.sr-only) {
65
+ ${visuallyHidden}
66
+ }
67
+ }
68
+ `
69
+ ];
70
+ }
71
+ render() {
72
+ const index = this.steps.findIndex((s) => s.id === this.current);
73
+ return html`
74
+ <nav part="nav" aria-label=${this.label}>
75
+ <ol part="list">
76
+ ${this.steps.map((step, i) => {
77
+ const state = i < index ? "done" : i === index ? "current" : "todo";
78
+ return html`
79
+ <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
+ <span>${step.label}</span>
82
+ </li>
83
+ `;
84
+ })}
85
+ </ol>
86
+ </nav>
87
+ `;
88
+ }
89
+ };
90
+ customElements.define("impkt-progress", ImpktProgress);
91
+
92
+ export {
93
+ ImpktProgress
94
+ };
95
+ //# sourceMappingURL=chunk-BOLZMDAS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/progress.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\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('xs')};\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\">Step ${i + 1} of ${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;AA6BjD,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;AAAA;AAAA;AAAA,4BAGwB,MAAM,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA,eAIrB,MAAM,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAOF,SAAS,IAAI,CAAC;AAAA,iBAClB,EAAE,SAAS;AAAA,+BACG,MAAM,CAAC,CAAC;AAAA,wCACC,EAAE,MAAM;AAAA;AAAA;AAAA,iBAG/B,EAAE,IAAI;AAAA,oCACa,EAAE,KAAK;AAAA;AAAA;AAAA,iBAG1B,EAAE,IAAI;AAAA,uBACA,WAAW,UAAU,CAAC;AAAA,oCACT,EAAE,KAAK;AAAA;AAAA;AAAA,UAGjC,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAOZ,cAAc;AAAA;AAAA;AAAA;AAAA,IAIxB;AAAA;AAAA,EAEA,SAAyB;AACvB,UAAM,QAAQ,KAAK,MAAM,UAAU,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO;AAC/D,WAAO;AAAA,mCACwB,KAAK,KAAK;AAAA;AAAA,YAEjC,KAAK,MAAM,IAAI,CAAC,MAAM,MAAM;AAC5B,YAAM,QAAQ,IAAI,QAAQ,SAAS,MAAM,QAAQ,YAAY;AAC7D,aAAO;AAAA,+BACY,KAAK,iBAAiB,UAAU,YAAY,SAAS,OAAO;AAAA,kBACzE,UAAU,YACR,kCAAkC,IAAI,CAAC,OAAO,KAAK,MAAM,MAAM,cAC/D,OAAO;AAAA,wBACH,KAAK,KAAK;AAAA;AAAA;AAAA,IAGxB,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA,EAIV;AACF;AAEA,eAAe,OAAO,kBAAkB,aAAa;","names":[]}
@@ -0,0 +1,152 @@
1
+ import {
2
+ ImpktElement,
3
+ fontSize,
4
+ fontWeight,
5
+ lineHeight,
6
+ space,
7
+ t
8
+ } from "./chunk-J5KAMJ2N.js";
9
+
10
+ // packages/ui/src/components/layout.ts
11
+ import { html, css } from "lit";
12
+ var ImpktStack = class extends ImpktElement {
13
+ static {
14
+ this.properties = { gap: { type: String, reflect: true } };
15
+ }
16
+ constructor() {
17
+ super();
18
+ this.gap = "md";
19
+ }
20
+ static {
21
+ this.styles = [
22
+ ...ImpktElement.styles,
23
+ css`
24
+ :host {
25
+ display: flex;
26
+ flex-direction: column;
27
+ }
28
+ :host([gap='xs']) { gap: ${space(1)}; }
29
+ :host([gap='sm']) { gap: ${space(2)}; }
30
+ :host([gap='md']) { gap: ${space(4)}; }
31
+ :host([gap='lg']) { gap: ${space(6)}; }
32
+ :host([gap='xl']) { gap: ${space(8)}; }
33
+ `
34
+ ];
35
+ }
36
+ render() {
37
+ return html`<slot></slot>`;
38
+ }
39
+ };
40
+ var ImpktCard = class extends ImpktElement {
41
+ static {
42
+ this.styles = [
43
+ ...ImpktElement.styles,
44
+ css`
45
+ :host {
46
+ display: block;
47
+ background: ${t.surfaceCard};
48
+ border: ${t.borderThin} solid ${t.border};
49
+ border-radius: ${t.radiusLg};
50
+ padding: ${space(6)};
51
+ }
52
+ `
53
+ ];
54
+ }
55
+ render() {
56
+ return html`<slot></slot>`;
57
+ }
58
+ };
59
+ var ImpktHeading = class extends ImpktElement {
60
+ static {
61
+ this.properties = {
62
+ level: { type: Number, reflect: true },
63
+ size: { type: String, reflect: true }
64
+ };
65
+ }
66
+ constructor() {
67
+ super();
68
+ this.level = 2;
69
+ this.size = "xl";
70
+ }
71
+ static {
72
+ this.styles = [
73
+ ...ImpktElement.styles,
74
+ css`
75
+ :host {
76
+ display: block;
77
+ color: ${t.textHeading};
78
+ font-family: ${t.fontHeading};
79
+ font-weight: ${fontWeight("bold")};
80
+ line-height: ${lineHeight("tight")};
81
+ }
82
+ :host([size='3xl']) { font-size: ${fontSize("3xl")}; }
83
+ :host([size='2xl']) { font-size: ${fontSize("2xl")}; }
84
+ :host([size='xl']) { font-size: ${fontSize("xl")}; }
85
+ :host([size='lg']) { font-size: ${fontSize("lg")}; }
86
+ :host([size='md']) { font-size: ${fontSize("md")}; }
87
+ .h {
88
+ margin: 0;
89
+ font: inherit;
90
+ color: inherit;
91
+ }
92
+ `
93
+ ];
94
+ }
95
+ render() {
96
+ return html`<div class="h" role="heading" aria-level=${this.level} part="heading">
97
+ <slot></slot>
98
+ </div>`;
99
+ }
100
+ };
101
+ var ImpktText = class extends ImpktElement {
102
+ static {
103
+ this.properties = {
104
+ size: { type: String, reflect: true },
105
+ tone: { type: String, reflect: true }
106
+ };
107
+ }
108
+ constructor() {
109
+ super();
110
+ this.size = "md";
111
+ this.tone = "default";
112
+ }
113
+ static {
114
+ this.styles = [
115
+ ...ImpktElement.styles,
116
+ css`
117
+ :host {
118
+ display: block;
119
+ /* 1.4.8 asks for 1.5 within a paragraph, and it is the default here
120
+ rather than an option, because body text is what it is about. */
121
+ line-height: ${lineHeight("normal")};
122
+ /* 1.4.12 Text Spacing: a user stylesheet must be able to widen this
123
+ without clipping, which a max-width in ch units survives and a
124
+ fixed pixel height does not. */
125
+ max-inline-size: 70ch;
126
+ }
127
+ :host([size='sm']) { font-size: ${fontSize("sm")}; }
128
+ :host([size='md']) { font-size: ${fontSize("md")}; }
129
+ :host([size='lg']) { font-size: ${fontSize("lg")}; }
130
+ :host([tone='muted']) { color: ${t.textMuted}; }
131
+ p {
132
+ margin: 0;
133
+ }
134
+ `
135
+ ];
136
+ }
137
+ render() {
138
+ return html`<p part="text"><slot></slot></p>`;
139
+ }
140
+ };
141
+ customElements.define("impkt-stack", ImpktStack);
142
+ customElements.define("impkt-card", ImpktCard);
143
+ customElements.define("impkt-heading", ImpktHeading);
144
+ customElements.define("impkt-text", ImpktText);
145
+
146
+ export {
147
+ ImpktStack,
148
+ ImpktCard,
149
+ ImpktHeading,
150
+ ImpktText
151
+ };
152
+ //# sourceMappingURL=chunk-BUWE6XGX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/layout.ts"],"sourcesContent":["import { html, css, type TemplateResult } from 'lit';\nimport { ImpktElement } from '../base/ImpktElement';\nimport { fontSize, fontWeight, lineHeight, space, t } from '../base/tokens';\n\n/**\n * Layout and typography primitives.\n *\n * These are the components a composition is mostly made of, and they are\n * deliberately dull. Their one job is that spacing, type and colour come from\n * tokens, so that a page built in the CMS cannot contain a hard-coded 13px.\n */\n\n/** Vertical rhythm. Every gap is a spacing token, never a number.\n *\n * @category layout\n * @icon stack\n * @slot - The things being stacked.\n */\nexport class ImpktStack extends ImpktElement {\n static properties = { gap: { type: String, reflect: true } };\n declare gap: 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\n constructor() {\n super();\n this.gap = 'md';\n }\n\n static styles = [\n ...ImpktElement.styles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n }\n :host([gap='xs']) { gap: ${space(1)}; }\n :host([gap='sm']) { gap: ${space(2)}; }\n :host([gap='md']) { gap: ${space(4)}; }\n :host([gap='lg']) { gap: ${space(6)}; }\n :host([gap='xl']) { gap: ${space(8)}; }\n `,\n ];\n\n render(): TemplateResult {\n return html`<slot></slot>`;\n }\n}\n\n/** A surface. What text is read against, and what contrast is measured from.\n *\n * @category layout\n * @icon card\n * @slot - What sits on the card.\n */\nexport class ImpktCard extends ImpktElement {\n static styles = [\n ...ImpktElement.styles,\n css`\n :host {\n display: block;\n background: ${t.surfaceCard};\n border: ${t.borderThin} solid ${t.border};\n border-radius: ${t.radiusLg};\n padding: ${space(6)};\n }\n `,\n ];\n\n render(): TemplateResult {\n return html`<slot></slot>`;\n }\n}\n\n/**\n * A heading.\n *\n * `level` is required and renders the matching `<h1>`–`<h6>`, because heading\n * level is document structure rather than appearance: a screen-reader user\n * navigates by it, and a page whose levels skip is a page they cannot skim.\n * Size is a separate property, so a visually small `<h2>` needs no lie about\n * its level — which is the usual reason levels end up wrong.\n\n *\n * @category typography\n * @icon heading\n * @role heading\n * @slot - The heading text.\n */\nexport class ImpktHeading extends ImpktElement {\n static properties = {\n level: { type: Number, reflect: true },\n size: { type: String, reflect: true },\n };\n\n declare level: 1 | 2 | 3 | 4 | 5 | 6;\n declare size: '3xl' | '2xl' | 'xl' | 'lg' | 'md';\n\n constructor() {\n super();\n this.level = 2;\n this.size = 'xl';\n }\n\n static styles = [\n ...ImpktElement.styles,\n css`\n :host {\n display: block;\n color: ${t.textHeading};\n font-family: ${t.fontHeading};\n font-weight: ${fontWeight('bold')};\n line-height: ${lineHeight('tight')};\n }\n :host([size='3xl']) { font-size: ${fontSize('3xl')}; }\n :host([size='2xl']) { font-size: ${fontSize('2xl')}; }\n :host([size='xl']) { font-size: ${fontSize('xl')}; }\n :host([size='lg']) { font-size: ${fontSize('lg')}; }\n :host([size='md']) { font-size: ${fontSize('md')}; }\n .h {\n margin: 0;\n font: inherit;\n color: inherit;\n }\n `,\n ];\n\n render(): TemplateResult {\n // A `role=\"heading\"` with `aria-level` rather than six branches of\n // template. The native element would be marginally better; this is the one\n // place where Lit's lack of a dynamic tag makes the explicit role the\n // honest trade, and the role is fully supported.\n return html`<div class=\"h\" role=\"heading\" aria-level=${this.level} part=\"heading\">\n <slot></slot>\n </div>`;\n }\n}\n\n/** A paragraph.\n *\n * @category typography\n * @icon text\n * @slot - The paragraph text.\n */\nexport class ImpktText extends ImpktElement {\n static properties = {\n size: { type: String, reflect: true },\n tone: { type: String, reflect: true },\n };\n\n declare size: 'sm' | 'md' | 'lg';\n declare tone: 'default' | 'muted';\n\n constructor() {\n super();\n this.size = 'md';\n this.tone = 'default';\n }\n\n static styles = [\n ...ImpktElement.styles,\n css`\n :host {\n display: block;\n /* 1.4.8 asks for 1.5 within a paragraph, and it is the default here\n rather than an option, because body text is what it is about. */\n line-height: ${lineHeight('normal')};\n /* 1.4.12 Text Spacing: a user stylesheet must be able to widen this\n without clipping, which a max-width in ch units survives and a\n fixed pixel height does not. */\n max-inline-size: 70ch;\n }\n :host([size='sm']) { font-size: ${fontSize('sm')}; }\n :host([size='md']) { font-size: ${fontSize('md')}; }\n :host([size='lg']) { font-size: ${fontSize('lg')}; }\n :host([tone='muted']) { color: ${t.textMuted}; }\n p {\n margin: 0;\n }\n `,\n ];\n\n render(): TemplateResult {\n return html`<p part=\"text\"><slot></slot></p>`;\n }\n}\n\ncustomElements.define('impkt-stack', ImpktStack);\ncustomElements.define('impkt-card', ImpktCard);\ncustomElements.define('impkt-heading', ImpktHeading);\ncustomElements.define('impkt-text', ImpktText);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impkt-stack': ImpktStack;\n 'impkt-card': ImpktCard;\n 'impkt-heading': ImpktHeading;\n 'impkt-text': ImpktText;\n }\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAS,MAAM,WAAgC;AAkBxC,IAAM,aAAN,cAAyB,aAAa;AAAA,EAC3C;AAAA,SAAO,a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