@atomic-ui/ui 0.1.4 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/README.md +30 -6
  2. package/dist/base/FieldElement.d.ts +7 -0
  3. package/dist/base/tokens.d.ts +23 -1
  4. package/dist/chunk-2YQA3VBY.js +85 -0
  5. package/dist/chunk-2YQA3VBY.js.map +1 -0
  6. package/dist/{chunk-LFOWTFMR.js → chunk-4HU4Y23Q.js} +3 -3
  7. package/dist/chunk-5EA4IDUD.js +177 -0
  8. package/dist/chunk-5EA4IDUD.js.map +1 -0
  9. package/dist/{chunk-3OSL2HMN.js → chunk-6ICOJPMD.js} +7 -5
  10. package/dist/chunk-6ICOJPMD.js.map +1 -0
  11. package/dist/{chunk-ZXCSQ6MK.js → chunk-7BIQ3K6H.js} +10 -2
  12. package/dist/chunk-7BIQ3K6H.js.map +1 -0
  13. package/dist/chunk-7Y6UCSUS.js +361 -0
  14. package/dist/chunk-7Y6UCSUS.js.map +1 -0
  15. package/dist/chunk-BTGCUONV.js +56 -0
  16. package/dist/chunk-BTGCUONV.js.map +1 -0
  17. package/dist/{chunk-QYHWR6C5.js → chunk-C36CZRHK.js} +20 -7
  18. package/dist/chunk-C36CZRHK.js.map +1 -0
  19. package/dist/{chunk-MAMBT7BZ.js → chunk-CMAU4DSB.js} +21 -7
  20. package/dist/chunk-CMAU4DSB.js.map +1 -0
  21. package/dist/{chunk-HWNY6U5F.js → chunk-G6OVKNL7.js} +2 -2
  22. package/dist/{chunk-6UDDZQDK.js → chunk-GO2IBRFP.js} +3 -3
  23. package/dist/chunk-GO2IBRFP.js.map +1 -0
  24. package/dist/{chunk-PDXOPY22.js → chunk-GSCVG2ER.js} +3 -3
  25. package/dist/{chunk-IBTOZOGI.js → chunk-HWWA27DN.js} +2 -2
  26. package/dist/chunk-MLVUMCQ2.js +167 -0
  27. package/dist/chunk-MLVUMCQ2.js.map +1 -0
  28. package/dist/{chunk-A4CJ2F3J.js → chunk-MOEMFL4K.js} +21 -7
  29. package/dist/chunk-MOEMFL4K.js.map +1 -0
  30. package/dist/{chunk-OBCSDZHP.js → chunk-NQKYHILD.js} +3 -3
  31. package/dist/{chunk-5NUF7ZQA.js → chunk-NTNXHLTM.js} +24 -3
  32. package/dist/chunk-NTNXHLTM.js.map +1 -0
  33. package/dist/{chunk-4Y3HJBJY.js → chunk-OB7LC6NJ.js} +3 -2
  34. package/dist/chunk-OB7LC6NJ.js.map +1 -0
  35. package/dist/chunk-QCNT7D5V.js +549 -0
  36. package/dist/chunk-QCNT7D5V.js.map +1 -0
  37. package/dist/{chunk-CGMDIZPO.js → chunk-QDNI54ON.js} +3 -3
  38. package/dist/chunk-T6L3USBZ.js +245 -0
  39. package/dist/chunk-T6L3USBZ.js.map +1 -0
  40. package/dist/{chunk-TZD7IVVQ.js → chunk-TPF4MOMF.js} +8 -3
  41. package/dist/chunk-TPF4MOMF.js.map +1 -0
  42. package/dist/{chunk-S3EQO33M.js → chunk-VTFCTWSX.js} +6 -4
  43. package/dist/chunk-VTFCTWSX.js.map +1 -0
  44. package/dist/{chunk-2RBYVWZT.js → chunk-VWNBB7FW.js} +5 -3
  45. package/dist/chunk-VWNBB7FW.js.map +1 -0
  46. package/dist/{chunk-DIZCGSJA.js → chunk-WECSVHIM.js} +15 -3
  47. package/dist/chunk-WECSVHIM.js.map +1 -0
  48. package/dist/chunk-X7IPZPTG.js +710 -0
  49. package/dist/chunk-X7IPZPTG.js.map +1 -0
  50. package/dist/{chunk-TIKX5POO.js → chunk-XJP45LFA.js} +55 -28
  51. package/dist/chunk-XJP45LFA.js.map +1 -0
  52. package/dist/{chunk-6MLXFFH4.js → chunk-XVKEM5JY.js} +3 -3
  53. package/dist/chunk-XVKEM5JY.js.map +1 -0
  54. package/dist/chunk-ZBLTU67D.js +424 -0
  55. package/dist/chunk-ZBLTU67D.js.map +1 -0
  56. package/dist/{chunk-4KFHQBH2.js → chunk-ZGAOMRYD.js} +17 -4
  57. package/dist/chunk-ZGAOMRYD.js.map +1 -0
  58. package/dist/chunk-ZQJD4YEJ.js +195 -0
  59. package/dist/chunk-ZQJD4YEJ.js.map +1 -0
  60. package/dist/components/accordion.js +2 -2
  61. package/dist/components/alert.js +2 -2
  62. package/dist/components/app-ui.d.ts +421 -0
  63. package/dist/components/app-ui.js +26 -0
  64. package/dist/components/app-ui.js.map +1 -0
  65. package/dist/components/blocks.d.ts +174 -0
  66. package/dist/components/blocks.js +17 -0
  67. package/dist/components/blocks.js.map +1 -0
  68. package/dist/components/button.d.ts +33 -0
  69. package/dist/components/button.js +3 -2
  70. package/dist/components/checkbox-group.js +3 -3
  71. package/dist/components/checkbox.js +3 -3
  72. package/dist/components/date-input.js +3 -3
  73. package/dist/components/dialog.js +2 -2
  74. package/dist/components/fieldset.d.ts +49 -0
  75. package/dist/components/fieldset.js +8 -0
  76. package/dist/components/fieldset.js.map +1 -0
  77. package/dist/components/grid.d.ts +3 -3
  78. package/dist/components/grid.js +2 -2
  79. package/dist/components/help.js +2 -2
  80. package/dist/components/icon.d.ts +89 -0
  81. package/dist/components/icon.js +14 -0
  82. package/dist/components/icon.js.map +1 -0
  83. package/dist/components/layout.d.ts +75 -7
  84. package/dist/components/layout.js +2 -2
  85. package/dist/components/link.d.ts +11 -0
  86. package/dist/components/link.js +3 -2
  87. package/dist/components/marketing.d.ts +370 -0
  88. package/dist/components/marketing.js +21 -0
  89. package/dist/components/marketing.js.map +1 -0
  90. package/dist/components/media.d.ts +12 -0
  91. package/dist/components/media.js +2 -2
  92. package/dist/components/navigation.d.ts +98 -0
  93. package/dist/components/navigation.js +11 -0
  94. package/dist/components/navigation.js.map +1 -0
  95. package/dist/components/organisms.d.ts +547 -0
  96. package/dist/components/organisms.js +25 -0
  97. package/dist/components/organisms.js.map +1 -0
  98. package/dist/components/page.d.ts +130 -0
  99. package/dist/components/page.js +10 -0
  100. package/dist/components/page.js.map +1 -0
  101. package/dist/components/price.d.ts +5 -0
  102. package/dist/components/price.js +2 -2
  103. package/dist/components/progress.js +2 -2
  104. package/dist/components/property.d.ts +389 -0
  105. package/dist/components/property.js +19 -0
  106. package/dist/components/property.js.map +1 -0
  107. package/dist/components/radio-group.js +3 -3
  108. package/dist/components/select.d.ts +6 -0
  109. package/dist/components/select.js +3 -3
  110. package/dist/components/summary-list.js +2 -2
  111. package/dist/components/table.js +2 -2
  112. package/dist/components/text-input.d.ts +6 -0
  113. package/dist/components/text-input.js +3 -3
  114. package/dist/components/textarea.d.ts +6 -0
  115. package/dist/components/textarea.js +3 -3
  116. package/dist/index.d.ts +9 -0
  117. package/dist/index.js +140 -36
  118. package/package.json +2 -2
  119. package/dist/chunk-2RBYVWZT.js.map +0 -1
  120. package/dist/chunk-3OSL2HMN.js.map +0 -1
  121. package/dist/chunk-4KFHQBH2.js.map +0 -1
  122. package/dist/chunk-4Y3HJBJY.js.map +0 -1
  123. package/dist/chunk-5NUF7ZQA.js.map +0 -1
  124. package/dist/chunk-6MLXFFH4.js.map +0 -1
  125. package/dist/chunk-6UDDZQDK.js.map +0 -1
  126. package/dist/chunk-A4CJ2F3J.js.map +0 -1
  127. package/dist/chunk-DIZCGSJA.js.map +0 -1
  128. package/dist/chunk-GGODB3GY.js +0 -172
  129. package/dist/chunk-GGODB3GY.js.map +0 -1
  130. package/dist/chunk-MAMBT7BZ.js.map +0 -1
  131. package/dist/chunk-QYHWR6C5.js.map +0 -1
  132. package/dist/chunk-S3EQO33M.js.map +0 -1
  133. package/dist/chunk-TIKX5POO.js.map +0 -1
  134. package/dist/chunk-TZD7IVVQ.js.map +0 -1
  135. package/dist/chunk-ZXCSQ6MK.js.map +0 -1
  136. /package/dist/{chunk-LFOWTFMR.js.map → chunk-4HU4Y23Q.js.map} +0 -0
  137. /package/dist/{chunk-HWNY6U5F.js.map → chunk-G6OVKNL7.js.map} +0 -0
  138. /package/dist/{chunk-PDXOPY22.js.map → chunk-GSCVG2ER.js.map} +0 -0
  139. /package/dist/{chunk-IBTOZOGI.js.map → chunk-HWWA27DN.js.map} +0 -0
  140. /package/dist/{chunk-OBCSDZHP.js.map → chunk-NQKYHILD.js.map} +0 -0
  141. /package/dist/{chunk-CGMDIZPO.js.map → chunk-QDNI54ON.js.map} +0 -0
@@ -0,0 +1,549 @@
1
+ import {
2
+ iconSvg
3
+ } from "./chunk-2YQA3VBY.js";
4
+ import {
5
+ FieldElement
6
+ } from "./chunk-7BIQ3K6H.js";
7
+ import {
8
+ ImpktElement,
9
+ focusRing,
10
+ fontWeight,
11
+ space,
12
+ spaceAround,
13
+ t,
14
+ targetSize,
15
+ type,
16
+ visuallyHidden
17
+ } from "./chunk-NTNXHLTM.js";
18
+
19
+ // packages/ui/src/components/app-ui.ts
20
+ import { css, html, nothing } from "lit";
21
+ var ImpktDrawer = class extends ImpktElement {
22
+ constructor() {
23
+ super();
24
+ this.hasFooter = false;
25
+ this.open = false;
26
+ this.heading = "";
27
+ this.side = "right";
28
+ this.closeLabel = "Close";
29
+ }
30
+ static {
31
+ this.properties = {
32
+ open: { type: Boolean, reflect: true },
33
+ heading: { type: String },
34
+ side: { type: String, reflect: true },
35
+ closeLabel: { type: String, attribute: "close-label" }
36
+ };
37
+ }
38
+ static {
39
+ this.styles = [...ImpktElement.styles, focusRing, css`
40
+ dialog { box-sizing: border-box; display: none; flex-direction: column; inline-size: min(28rem, 100vw); max-inline-size: 100vw; block-size: 100dvh; max-block-size: 100dvh; margin: 0 0 0 auto; padding: 0; border: 0; color: ${t.text}; background: ${t.surfaceCard}; box-shadow: ${t.shadowXl}; animation: from-right 240ms cubic-bezier(0.16, 1, 0.3, 1); }
41
+ dialog[open] { display: flex; }
42
+ :host([side='left']) dialog { margin: 0 auto 0 0; animation-name: from-left; }
43
+ dialog::backdrop { background: color-mix(in srgb, ${t.text} 30%, transparent); backdrop-filter: blur(2px); }
44
+ @keyframes from-right { from { transform: translateX(100%); } }
45
+ @keyframes from-left { from { transform: translateX(-100%); } }
46
+ .head { display: flex; align-items: center; justify-content: space-between; gap: ${space(3)}; padding: ${space(4)} ${space(5)}; box-shadow: 0 1px 0 color-mix(in srgb, ${t.text} 8%, transparent); }
47
+ h2 { margin: 0; font-family: ${t.fontHeading}; ${type("xl")} font-weight: ${fontWeight("bold")}; color: ${t.textHeading}; }
48
+ .close { ${targetSize} display: inline-flex; align-items: center; justify-content: center; padding: 0; color: ${t.text}; background: none; border: 0; border-radius: ${t.radius}; cursor: pointer; }
49
+ .close:hover { background: ${t.surfaceSubtle}; }
50
+ .body { flex: 1; overflow: auto; padding: ${space(5)}; }
51
+ .foot { display: flex; gap: ${space(3)}; justify-content: flex-end; padding: ${space(4)} ${space(5)}; box-shadow: 0 -1px 0 color-mix(in srgb, ${t.text} 8%, transparent); }
52
+ .foot[hidden] { display: none; }
53
+ `];
54
+ }
55
+ get dialog() {
56
+ return this.renderRoot.querySelector("dialog");
57
+ }
58
+ updated(changed) {
59
+ if (!changed.has("open")) return;
60
+ const dialog = this.dialog;
61
+ if (!dialog) return;
62
+ if (this.open) {
63
+ if (typeof dialog.showModal === "function") dialog.showModal();
64
+ else dialog.setAttribute("open", "");
65
+ } else if (typeof dialog.close === "function" && dialog.open) dialog.close();
66
+ else dialog.removeAttribute("open");
67
+ }
68
+ close() {
69
+ this.open = false;
70
+ this.dispatchEvent(new CustomEvent("impkt-close", { bubbles: true, composed: true }));
71
+ }
72
+ footerChanged(event) {
73
+ this.hasFooter = event.target.assignedNodes().length > 0;
74
+ this.requestUpdate();
75
+ }
76
+ render() {
77
+ return html`<dialog part="dialog" aria-labelledby=${this.heading ? this.id_("heading") : nothing}
78
+ @cancel=${() => this.close()}
79
+ @close=${() => {
80
+ if (this.open) this.close();
81
+ }}
82
+ @click=${(event) => {
83
+ if (event.target === this.dialog) this.close();
84
+ }}>
85
+ <div class="head">
86
+ ${this.heading ? html`<h2 id=${this.id_("heading")}>${this.heading}</h2>` : html`<span></span>`}
87
+ <button class="close" type="button" aria-label=${this.closeLabel} @click=${this.close}>${iconSvg("close", "20px")}</button>
88
+ </div>
89
+ <div class="body" part="body"><slot></slot></div>
90
+ <div class="foot" part="footer" ?hidden=${!this.hasFooter}><slot name="footer" @slotchange=${this.footerChanged}></slot></div>
91
+ </dialog>`;
92
+ }
93
+ };
94
+ var TOAST_ICON = { neutral: "info", success: "check", warning: "warning", danger: "warning" };
95
+ var ImpktToast = class extends ImpktElement {
96
+ static {
97
+ this.properties = {
98
+ open: { type: Boolean, reflect: true },
99
+ message: { type: String },
100
+ tone: { type: String, reflect: true },
101
+ duration: { type: Number },
102
+ actionText: { type: String, attribute: "action-text" },
103
+ closeLabel: { type: String, attribute: "close-label" }
104
+ };
105
+ }
106
+ constructor() {
107
+ super();
108
+ this.open = false;
109
+ this.message = "";
110
+ this.tone = "neutral";
111
+ this.duration = 6;
112
+ this.actionText = "";
113
+ this.closeLabel = "Dismiss";
114
+ }
115
+ static {
116
+ this.styles = [...ImpktElement.styles, focusRing, css`
117
+ .region { position: fixed; inset-block-end: calc(${space(4)} + var(--impkt-bottom-bar, 0px)); inset-inline-end: ${space(4)}; z-index: 1000; inline-size: min(24rem, calc(100vw - ${space(8)})); }
118
+ .toast { display: flex; align-items: flex-start; gap: ${space(3)}; padding: ${space(3)} ${space(3)} ${space(3)} ${space(4)}; color: ${t.text}; background: ${t.surfaceCard}; border-radius: ${t.radiusXl}; box-shadow: ${t.shadowXl}, 0 0 0 1px color-mix(in srgb, ${t.text} 8%, transparent); animation: rise 220ms cubic-bezier(0.16, 1, 0.3, 1); }
119
+ @keyframes rise { from { opacity: 0; transform: translateY(${space(3)}); } }
120
+ .mark { display: inline-flex; flex: none; margin-block-start: ${space(0.5)}; color: ${t.info}; }
121
+ :host([tone='success']) .mark { color: ${t.success}; }
122
+ :host([tone='warning']) .mark { color: ${t.warning}; }
123
+ :host([tone='danger']) .mark { color: ${t.danger}; }
124
+ .message { flex: 1; align-self: center; margin: 0; ${type("sm")} font-weight: ${fontWeight("medium")}; }
125
+ .action, .close { ${targetSize} padding: 0 ${space(2)}; font: inherit; ${type("sm")} font-weight: ${fontWeight("semibold")}; color: ${t.link}; background: none; border: 0; border-radius: ${t.radius}; cursor: pointer; }
126
+ .close { display: inline-flex; align-items: center; justify-content: center; color: ${t.textMuted}; }
127
+ .action:hover, .close:hover { background: ${t.surfaceSubtle}; }
128
+ `];
129
+ }
130
+ disconnectedCallback() {
131
+ super.disconnectedCallback();
132
+ this.stop();
133
+ }
134
+ updated(changed) {
135
+ if (changed.has("open") || changed.has("duration")) {
136
+ this.stop();
137
+ if (this.open) this.start();
138
+ }
139
+ }
140
+ start() {
141
+ if (this.duration > 0) this.timer = setTimeout(() => this.close(), this.duration * 1e3);
142
+ }
143
+ stop() {
144
+ if (this.timer) clearTimeout(this.timer);
145
+ this.timer = void 0;
146
+ }
147
+ close() {
148
+ this.stop();
149
+ if (!this.open) return;
150
+ this.open = false;
151
+ this.dispatchEvent(new CustomEvent("impkt-close", { bubbles: true, composed: true }));
152
+ }
153
+ action() {
154
+ this.dispatchEvent(new CustomEvent("impkt-action", { bubbles: true, composed: true }));
155
+ this.close();
156
+ }
157
+ render() {
158
+ return html`<div class="region" role="status" aria-live="polite">
159
+ ${this.open ? html`<div class="toast" part="toast" @mouseenter=${this.stop} @mouseleave=${this.start} @focusin=${this.stop} @focusout=${this.start}>
160
+ <span class="mark">${iconSvg(TOAST_ICON[this.tone] ?? "info", "20px")}</span>
161
+ <p class="message">${this.message}</p>
162
+ ${this.actionText ? html`<button class="action" type="button" @click=${this.action}>${this.actionText}</button>` : nothing}
163
+ <button class="close" type="button" aria-label=${this.closeLabel} @click=${this.close}>${iconSvg("close", "16px")}</button>
164
+ </div>` : nothing}
165
+ </div>`;
166
+ }
167
+ };
168
+ var ImpktMenu = class extends ImpktElement {
169
+ constructor() {
170
+ super();
171
+ this.outside = (event) => {
172
+ if (!event.composedPath().includes(this)) this.toggle(false);
173
+ };
174
+ this.label = "Menu";
175
+ this.icon = "";
176
+ this.items = [];
177
+ this.edge = "start";
178
+ this.open = false;
179
+ }
180
+ static {
181
+ this.properties = {
182
+ label: { type: String },
183
+ icon: { type: String },
184
+ items: { type: Array },
185
+ edge: { type: String, reflect: true },
186
+ open: { type: Boolean, reflect: true }
187
+ };
188
+ }
189
+ static {
190
+ this.styles = [...ImpktElement.styles, focusRing, css`
191
+ :host { position: relative; display: inline-block; }
192
+ .trigger { ${targetSize} display: inline-flex; align-items: center; gap: ${space(2)}; padding: ${space(2)} ${space(3.5)}; font: inherit; ${type("sm")} font-weight: ${fontWeight("semibold")}; color: ${t.text}; background: ${t.surfaceCard}; border: ${t.borderThin} solid ${t.border}; border-radius: ${t.radiusLg}; box-shadow: ${t.shadowXs}; cursor: pointer; }
193
+ .trigger:hover { background: ${t.surfaceSubtle}; }
194
+ .chev { display: inline-flex; color: ${t.textMuted}; transition: transform 120ms ease-in-out; }
195
+ :host([open]) .chev { transform: rotate(180deg); }
196
+ .list { position: absolute; z-index: 100; inset-block-start: calc(100% + ${space(1.5)}); inset-inline-start: 0; box-sizing: border-box; min-inline-size: 13rem; max-inline-size: min(20rem, 90vw); margin: 0; padding: ${space(1.5)}; list-style: none; background: ${t.surfaceCard}; border-radius: ${t.radiusXl}; box-shadow: ${t.shadowLg}, 0 0 0 1px color-mix(in srgb, ${t.text} 8%, transparent); animation: pop 120ms ease-out; }
197
+ :host([edge='end']) .list { inset-inline: auto 0; }
198
+ @keyframes pop { from { opacity: 0; transform: translateY(-${space(1)}); } }
199
+ .item { ${targetSize} box-sizing: border-box; display: flex; align-items: center; gap: ${space(2.5)}; inline-size: 100%; padding: ${space(2)} ${space(2.5)}; font: inherit; ${type("sm")} text-align: start; color: ${t.text}; text-decoration: none; background: none; border: 0; border-radius: ${t.radius}; cursor: pointer; }
200
+ .item:hover, .item:focus { background: ${t.surfaceSubtle}; }
201
+ .item.danger { color: ${t.dangerText}; }
202
+ .item svg { flex: none; }
203
+ `];
204
+ }
205
+ disconnectedCallback() {
206
+ super.disconnectedCallback();
207
+ document.removeEventListener("click", this.outside);
208
+ }
209
+ get entries() {
210
+ return Array.from(this.renderRoot.querySelectorAll(".item"));
211
+ }
212
+ get trigger() {
213
+ return this.renderRoot.querySelector(".trigger");
214
+ }
215
+ toggle(open, focus) {
216
+ this.open = open;
217
+ if (open) {
218
+ document.addEventListener("click", this.outside);
219
+ void this.updateComplete.then(() => this.entries[focus === "last" ? this.entries.length - 1 : 0]?.focus());
220
+ } else document.removeEventListener("click", this.outside);
221
+ }
222
+ triggerKey(event) {
223
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
224
+ event.preventDefault();
225
+ this.toggle(true, event.key === "ArrowUp" ? "last" : "first");
226
+ }
227
+ }
228
+ listKey(event) {
229
+ const entries = this.entries;
230
+ const at = entries.indexOf(this.renderRoot.activeElement);
231
+ const go = { ArrowDown: (at + 1) % entries.length, ArrowUp: (at - 1 + entries.length) % entries.length, Home: 0, End: entries.length - 1 };
232
+ if (event.key in go) {
233
+ event.preventDefault();
234
+ entries[go[event.key]]?.focus();
235
+ } else if (event.key === "Escape") {
236
+ event.preventDefault();
237
+ this.toggle(false);
238
+ this.trigger?.focus();
239
+ } else if (event.key === "Tab") this.toggle(false);
240
+ }
241
+ choose(item) {
242
+ this.toggle(false);
243
+ this.trigger?.focus();
244
+ if (!item.href) this.dispatchEvent(new CustomEvent("impkt-select", { detail: { value: item.value ?? item.text }, bubbles: true, composed: true }));
245
+ }
246
+ render() {
247
+ const inner = (item) => html`${iconSvg(item.icon, "18px")}<span>${item.text}</span>`;
248
+ return html`<button class="trigger" part="trigger" type="button" aria-haspopup="menu" aria-expanded=${String(this.open)} aria-controls=${this.id_("list")}
249
+ @click=${() => this.toggle(!this.open)} @keydown=${this.triggerKey}>${iconSvg(this.icon, "18px")}${this.label}<span class="chev">${iconSvg("chevron-down", "16px")}</span></button>
250
+ ${this.open ? html`<ul class="list" part="list" id=${this.id_("list")} role="menu" aria-label=${this.label} @keydown=${this.listKey}>
251
+ ${this.items.map((item) => html`<li role="none">${item.href ? html`<a class="item ${item.tone === "danger" ? "danger" : ""}" role="menuitem" tabindex="-1" href=${item.href} @click=${() => this.choose(item)}>${inner(item)}</a>` : html`<button class="item ${item.tone === "danger" ? "danger" : ""}" role="menuitem" tabindex="-1" type="button" @click=${() => this.choose(item)}>${inner(item)}</button>`}</li>`)}
252
+ </ul>` : nothing}`;
253
+ }
254
+ };
255
+ function pageWindow(page, pages) {
256
+ const wanted = [.../* @__PURE__ */ new Set([1, page - 1, page, page + 1, pages])].filter((n) => n >= 1 && n <= pages).sort((a, b) => a - b);
257
+ return wanted.flatMap((n, i) => {
258
+ const previous = wanted[i - 1];
259
+ if (previous === void 0 || n === previous + 1) return [n];
260
+ return n === previous + 2 ? [previous + 1, n] : ["gap", n];
261
+ });
262
+ }
263
+ var ImpktPagination = class extends ImpktElement {
264
+ static {
265
+ this.properties = {
266
+ page: { type: Number },
267
+ pages: { type: Number },
268
+ hrefPattern: { type: String, attribute: "href-pattern" },
269
+ label: { type: String },
270
+ previousText: { type: String, attribute: "previous-text" },
271
+ nextText: { type: String, attribute: "next-text" }
272
+ };
273
+ }
274
+ constructor() {
275
+ super();
276
+ this.page = 1;
277
+ this.pages = 1;
278
+ this.hrefPattern = "";
279
+ this.label = "Pages";
280
+ this.previousText = "Previous";
281
+ this.nextText = "Next";
282
+ }
283
+ static {
284
+ this.styles = [...ImpktElement.styles, focusRing, css`
285
+ :host { display: block; container-type: inline-size; }
286
+ nav { display: flex; align-items: center; justify-content: space-between; gap: ${space(2)}; }
287
+ ul { display: flex; align-items: center; gap: ${space(1)}; margin: 0; padding: 0; list-style: none; }
288
+ .n, .step { ${targetSize} box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; gap: ${space(1.5)}; min-inline-size: 44px; padding: 0 ${space(2.5)}; font: inherit; ${type("sm")} font-weight: ${fontWeight("medium")}; color: ${t.text}; text-decoration: none; background: none; border: 0; border-radius: ${t.radiusLg}; cursor: pointer; }
289
+ .n:hover, .step:hover { background: ${t.surfaceSubtle}; }
290
+ .n[aria-current] { color: ${t.onBrand}; background: ${t.brand}; font-weight: ${fontWeight("semibold")}; }
291
+ .step[aria-disabled='true'] { color: ${t.textMuted}; opacity: 0.55; background: none; cursor: not-allowed; }
292
+ .gap { color: ${t.textMuted}; padding: 0 ${space(1)}; }
293
+ .count { display: none; ${type("sm")} color: ${t.textMuted}; }
294
+ @container (max-width: 34rem) { ul { display: none; } .count { display: block; } }
295
+ `];
296
+ }
297
+ go(page, event) {
298
+ if (this.hrefPattern) return;
299
+ event.preventDefault();
300
+ this.page = page;
301
+ this.dispatchEvent(new CustomEvent("impkt-page", { detail: { page }, bubbles: true, composed: true }));
302
+ }
303
+ link(page, classes, content, label, current) {
304
+ return this.hrefPattern ? html`<a class=${classes} href=${this.hrefPattern.replace("{page}", String(page))} aria-label=${label} aria-current=${current ? "page" : nothing}>${content}</a>` : html`<button class=${classes} type="button" aria-label=${label} aria-current=${current ? "page" : nothing} @click=${(e) => this.go(page, e)}>${content}</button>`;
305
+ }
306
+ step(to, words, icon, off) {
307
+ const content = icon === "arrow-left" ? html`${iconSvg(icon, "16px")}${words}` : html`${words}${iconSvg(icon, "16px")}`;
308
+ return off ? html`<span class="step" aria-disabled="true">${content}</span>` : this.link(to, "step", content, words, false);
309
+ }
310
+ render() {
311
+ const page = Math.min(Math.max(this.page, 1), Math.max(this.pages, 1));
312
+ return html`<nav aria-label=${this.label} part="nav">
313
+ ${this.step(page - 1, this.previousText, "arrow-left", page <= 1)}
314
+ <ul>${pageWindow(page, this.pages).map((n) => html`<li>${n === "gap" ? html`<span class="gap" aria-hidden="true">…</span>` : this.link(n, "n", n, `Page ${n}`, n === page)}</li>`)}</ul>
315
+ <span class="count">Page ${page} of ${this.pages}</span>
316
+ ${this.step(page + 1, this.nextText, "arrow-right", page >= this.pages)}
317
+ </nav>`;
318
+ }
319
+ };
320
+ var initialsOf = (name) => {
321
+ const words = name.trim().split(/\s+/).filter(Boolean);
322
+ return ((words[0]?.[0] ?? "") + (words.length > 1 ? words[words.length - 1][0] : "")).toUpperCase();
323
+ };
324
+ var ImpktAvatar = class extends ImpktElement {
325
+ constructor() {
326
+ super();
327
+ this.failed = false;
328
+ this.fullName = "";
329
+ this.src = "";
330
+ this.size = "md";
331
+ }
332
+ static {
333
+ this.properties = {
334
+ fullName: { type: String, attribute: "full-name" },
335
+ src: { type: String },
336
+ size: { type: String, reflect: true }
337
+ };
338
+ }
339
+ static {
340
+ this.styles = [...ImpktElement.styles, css`
341
+ :host { --size: 40px; display: inline-block; inline-size: var(--size); block-size: var(--size); vertical-align: middle; }
342
+ :host([size='sm']) { --size: 32px; }
343
+ :host([size='lg']) { --size: 56px; }
344
+ :host([size='xl']) { --size: 80px; }
345
+ .face { display: flex; align-items: center; justify-content: center; inline-size: 100%; block-size: 100%; overflow: hidden; color: ${t.brand}; background: ${t.brandSubtle}; border-radius: 50%; font-size: calc(var(--size) * 0.38); font-weight: ${fontWeight("semibold")}; }
346
+ img { inline-size: 100%; block-size: 100%; object-fit: cover; }
347
+ `];
348
+ }
349
+ willUpdate(changed) {
350
+ if (changed.has("src")) this.failed = false;
351
+ }
352
+ render() {
353
+ if (this.src && !this.failed) {
354
+ return html`<div class="face"><img src=${this.src} alt=${this.fullName} @error=${() => {
355
+ this.failed = true;
356
+ this.requestUpdate();
357
+ }} /></div>`;
358
+ }
359
+ return html`<div class="face" role="img" aria-label=${this.fullName || "Person"}>${initialsOf(this.fullName) || iconSvg("user", "55%")}</div>`;
360
+ }
361
+ };
362
+ var ImpktAvatarGroup = class extends ImpktElement {
363
+ static {
364
+ this.properties = {
365
+ items: { type: Array },
366
+ max: { type: Number },
367
+ size: { type: String, reflect: true },
368
+ moreLabel: { type: String, attribute: "more-label" }
369
+ };
370
+ }
371
+ constructor() {
372
+ super();
373
+ this.items = [];
374
+ this.max = 4;
375
+ this.size = "md";
376
+ this.moreLabel = "more people";
377
+ }
378
+ static {
379
+ this.styles = [...ImpktElement.styles, css`
380
+ ul { display: flex; margin: 0; padding: 0; list-style: none; }
381
+ li { margin-inline-start: -${space(2.5)}; border-radius: 50%; box-shadow: 0 0 0 2px ${t.surfaceCard}; line-height: 0; }
382
+ li:first-child { margin-inline-start: 0; }
383
+ .more { display: flex; align-items: center; justify-content: center; inline-size: 40px; block-size: 40px; ${type("xs")} line-height: 1; font-weight: ${fontWeight("semibold")}; color: ${t.text}; background: ${t.surfaceSubtle}; border-radius: 50%; }
384
+ :host([size='sm']) .more { inline-size: 32px; block-size: 32px; }
385
+ :host([size='lg']) .more { inline-size: 56px; block-size: 56px; }
386
+ .sr { ${visuallyHidden} }
387
+ `];
388
+ }
389
+ render() {
390
+ const shown = this.items.slice(0, this.max);
391
+ const rest = this.items.length - shown.length;
392
+ return html`<ul part="list">
393
+ ${shown.map((item) => html`<li><impkt-avatar full-name=${item.name} src=${item.src ?? ""} size=${this.size}></impkt-avatar></li>`)}
394
+ ${rest > 0 ? html`<li><span class="more"><span aria-hidden="true">+${rest}</span><span class="sr">${rest} ${this.moreLabel}</span></span></li>` : nothing}
395
+ </ul>`;
396
+ }
397
+ };
398
+ var ImpktEmptyState = class extends ImpktElement {
399
+ static {
400
+ this.properties = {
401
+ icon: { type: String },
402
+ heading: { type: String },
403
+ lead: { type: String },
404
+ framed: { type: Boolean, reflect: true },
405
+ headingLevel: { type: Number, attribute: "heading-level" },
406
+ spaceAbove: { type: String, reflect: true, attribute: "space-above" },
407
+ spaceBelow: { type: String, reflect: true, attribute: "space-below" }
408
+ };
409
+ }
410
+ constructor() {
411
+ super();
412
+ this.icon = "search";
413
+ this.heading = "";
414
+ this.lead = "";
415
+ this.framed = false;
416
+ this.headingLevel = 2;
417
+ this.spaceAbove = "none";
418
+ this.spaceBelow = "none";
419
+ }
420
+ static {
421
+ this.styles = [...ImpktElement.styles, spaceAround, css`
422
+ .wrap { display: flex; flex-direction: column; align-items: center; gap: ${space(2)}; padding: ${space(12)} ${space(6)}; text-align: center; }
423
+ :host([framed]) .wrap { border: ${t.borderThin} dashed ${t.border}; border-radius: ${t.radiusXl}; }
424
+ .mark { display: inline-flex; align-items: center; justify-content: center; inline-size: 56px; block-size: 56px; margin-block-end: ${space(2)}; color: ${t.brand}; background: ${t.brandSubtle}; border-radius: 50%; }
425
+ .h { margin: 0; font-family: ${t.fontHeading}; ${type("xl")} font-weight: ${fontWeight("bold")}; color: ${t.textHeading}; }
426
+ p { margin: 0; max-inline-size: 42ch; color: ${t.textMuted}; text-wrap: pretty; }
427
+ .actions { display: flex; flex-wrap: wrap; justify-content: center; gap: ${space(3)}; margin-block-start: ${space(3)}; }
428
+ `];
429
+ }
430
+ render() {
431
+ return html`<div class="wrap" part="wrap">
432
+ <span class="mark">${iconSvg(this.icon, "26px")}</span>
433
+ ${this.heading ? html`<div class="h" role="heading" aria-level=${this.headingLevel}>${this.heading}</div>` : nothing}
434
+ ${this.lead ? html`<p>${this.lead}</p>` : nothing}
435
+ <div class="actions"><slot name="actions"></slot></div>
436
+ </div>`;
437
+ }
438
+ };
439
+ var timesOf = (day) => String(day?.times ?? "").split(",").map((time) => time.trim()).filter(Boolean);
440
+ function dayParts(date) {
441
+ const parsed = /* @__PURE__ */ new Date(`${date}T00:00:00Z`);
442
+ if (Number.isNaN(parsed.getTime())) return { weekday: "", day: date, month: "" };
443
+ const locale = typeof document !== "undefined" && document.documentElement.lang || "en-GB";
444
+ const part = (options) => new Intl.DateTimeFormat(locale, { timeZone: "UTC", ...options }).format(parsed);
445
+ return { weekday: part({ weekday: "short" }), day: part({ day: "numeric" }), month: part({ month: "short" }) };
446
+ }
447
+ var ImpktSlotPicker = class extends FieldElement {
448
+ constructor() {
449
+ super();
450
+ this.day = "";
451
+ this.days = [];
452
+ this.dayLabel = "Day";
453
+ this.timeLabel = "Time";
454
+ this.emptyText = "No times are available at the moment.";
455
+ }
456
+ static {
457
+ this.properties = {
458
+ ...FieldElement.properties,
459
+ days: { type: Array },
460
+ dayLabel: { type: String, attribute: "day-label" },
461
+ timeLabel: { type: String, attribute: "time-label" },
462
+ emptyText: { type: String, attribute: "empty-text" }
463
+ };
464
+ }
465
+ static {
466
+ this.styles = [...FieldElement.styles, css`
467
+ fieldset { min-inline-size: 0; margin: 0; padding: 0; border: 0; }
468
+ legend { padding: 0; }
469
+ .row-label { ${type("sm")} color: ${t.textMuted}; margin-block: ${space(2)}; }
470
+ .days { display: flex; gap: ${space(2)}; overflow-x: auto; padding: ${space(1)}; margin: -${space(1)}; scrollbar-width: thin; }
471
+ .times { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); gap: ${space(2)}; }
472
+ label { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; box-sizing: border-box; min-block-size: 44px; color: ${t.text}; background: ${t.surfaceCard}; border-radius: ${t.radiusLg}; box-shadow: inset 0 0 0 1px ${t.border}; cursor: pointer; transition: background-color 120ms ease-in-out; }
473
+ label:hover { background: ${t.surfaceSubtle}; }
474
+ label:has(input:checked) { color: ${t.onBrand}; background: ${t.brand}; box-shadow: none; }
475
+ label:has(input:focus-visible) { box-shadow: ${t.focusShadow}; }
476
+ input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
477
+ .day { flex: none; inline-size: 4.5rem; padding-block: ${space(2.5)}; }
478
+ .weekday, .month { ${type("xs")} }
479
+ .num { ${type("xl")} font-weight: ${fontWeight("semibold")}; }
480
+ .time { padding: ${space(2)}; ${type("sm")} font-weight: ${fontWeight("medium")}; }
481
+ .empty { margin: 0; color: ${t.textMuted}; }
482
+ :host([invalid]) .days label, :host([invalid]) .times label { box-shadow: inset 0 0 0 1px ${t.danger}; }
483
+ `];
484
+ }
485
+ get currentDay() {
486
+ const wanted = this.day || this.value.split("T")[0];
487
+ return this.days.find((day) => day.date === wanted) ?? this.days[0];
488
+ }
489
+ chooseDay(date) {
490
+ this.day = date;
491
+ if (this.value && !this.value.startsWith(`${date}T`)) this.setFormValue("");
492
+ this.requestUpdate();
493
+ }
494
+ renderLabel() {
495
+ return html`<legend class="label" part="label">${this.label}${this.required ? html`<span class="required"> (${this.requiredText})</span>` : nothing}</legend>`;
496
+ }
497
+ renderControl() {
498
+ const current = this.currentDay;
499
+ if (!current) return html`<p class="empty">${this.emptyText}</p>`;
500
+ return html`
501
+ <div class="row-label" id=${this.id_("days")}>${this.dayLabel}</div>
502
+ <div class="days" part="days" role="radiogroup" aria-labelledby=${this.id_("days")}>
503
+ ${this.days.map((day) => {
504
+ const parts = dayParts(day.date);
505
+ return html`<label class="day"><input type="radio" name=${`${this.uid}-day`} .checked=${day.date === current.date} ?disabled=${this.disabled} @change=${() => this.chooseDay(day.date)} />
506
+ <span class="weekday">${parts.weekday}</span><span class="num">${parts.day}</span><span class="month">${parts.month}</span></label>`;
507
+ })}
508
+ </div>
509
+ <div class="row-label" id=${this.id_("times")}>${this.timeLabel}</div>
510
+ <div class="times" part="times" role="radiogroup" aria-labelledby=${this.id_("times")}>
511
+ ${timesOf(current).map((time, i) => {
512
+ const value = `${current.date}T${time}`;
513
+ return html`<label class="time"><input type="radio" name=${`${this.uid}-time`} .checked=${this.value === value} ?required=${this.required && i === 0} ?disabled=${this.disabled} @change=${() => this.setFormValue(value)} />${time}</label>`;
514
+ })}
515
+ </div>`;
516
+ }
517
+ render() {
518
+ return html`<fieldset part="fieldset" aria-describedby=${this.describedBy} aria-invalid=${this.error ? "true" : nothing}>
519
+ ${this.renderLabel()}
520
+ ${this.description ? html`<div class="description" id=${this.id_("description")} part="description">${this.description}</div>` : nothing}
521
+ ${this.renderControl()}
522
+ <div class="error" id=${this.id_("error")} part="error" aria-live="polite">${this.error || nothing}</div>
523
+ </fieldset>`;
524
+ }
525
+ updated(changed) {
526
+ if (changed.has("error")) this.toggleAttribute("invalid", Boolean(this.error));
527
+ }
528
+ };
529
+ customElements.define("impkt-drawer", ImpktDrawer);
530
+ customElements.define("impkt-toast", ImpktToast);
531
+ customElements.define("impkt-menu", ImpktMenu);
532
+ customElements.define("impkt-pagination", ImpktPagination);
533
+ customElements.define("impkt-avatar", ImpktAvatar);
534
+ customElements.define("impkt-avatar-group", ImpktAvatarGroup);
535
+ customElements.define("impkt-empty-state", ImpktEmptyState);
536
+ customElements.define("impkt-slot-picker", ImpktSlotPicker);
537
+
538
+ export {
539
+ ImpktDrawer,
540
+ ImpktToast,
541
+ ImpktMenu,
542
+ pageWindow,
543
+ ImpktPagination,
544
+ ImpktAvatar,
545
+ ImpktAvatarGroup,
546
+ ImpktEmptyState,
547
+ ImpktSlotPicker
548
+ };
549
+ //# sourceMappingURL=chunk-QCNT7D5V.js.map