@atomic-ui/ui 0.2.0 → 0.5.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.
- package/README.md +88 -105
- package/custom-elements.json +6370 -15469
- package/dist/base/FieldElement.d.ts +14 -3
- package/dist/base/{ImpktElement.d.ts → ImpaktElement.d.ts} +2 -2
- package/dist/base/scroll-lock.d.ts +2 -0
- package/dist/base/styles.d.ts +31 -5
- package/dist/base/tokens.d.ts +1 -1
- package/dist/base/tone.d.ts +20 -0
- package/dist/chunk-2YRTFWW2.js +26 -0
- package/dist/chunk-2YRTFWW2.js.map +1 -0
- package/dist/{chunk-7BSZPUE3.js → chunk-3EF4T242.js} +7 -7
- package/dist/chunk-3EF4T242.js.map +1 -0
- package/dist/{chunk-KFD4O7VA.js → chunk-5Y3HYRCU.js} +7 -7
- package/dist/chunk-5Y3HYRCU.js.map +1 -0
- package/dist/{chunk-7AJN2TIS.js → chunk-5ZQVL3V2.js} +29 -12
- package/dist/chunk-5ZQVL3V2.js.map +1 -0
- package/dist/{chunk-NCASAXQT.js → chunk-A7YBFS4H.js} +15 -15
- package/dist/chunk-A7YBFS4H.js.map +1 -0
- package/dist/{chunk-E2VBUWJ4.js → chunk-ACQ4KYPR.js} +9 -9
- package/dist/chunk-ACQ4KYPR.js.map +1 -0
- package/dist/{chunk-OMJMUFOW.js → chunk-DE3INTHZ.js} +6 -6
- package/dist/chunk-DE3INTHZ.js.map +1 -0
- package/dist/chunk-EJD6LT7E.js +161 -0
- package/dist/chunk-EJD6LT7E.js.map +1 -0
- package/dist/{chunk-XJXCTGDR.js → chunk-EJSX4WCD.js} +9 -9
- package/dist/chunk-EJSX4WCD.js.map +1 -0
- package/dist/chunk-FMSC7J7J.js +76 -0
- package/dist/chunk-FMSC7J7J.js.map +1 -0
- package/dist/{chunk-R67PDFKE.js → chunk-FWR6SEIA.js} +33 -33
- package/dist/chunk-FWR6SEIA.js.map +1 -0
- package/dist/{chunk-FFCIY7NM.js → chunk-GJPHQLLN.js} +8 -8
- package/dist/chunk-GJPHQLLN.js.map +1 -0
- package/dist/{chunk-OLLZFNO6.js → chunk-HNBG2POR.js} +7 -7
- package/dist/chunk-HNBG2POR.js.map +1 -0
- package/dist/{chunk-E3XJK7MY.js → chunk-HNZQ7LM4.js} +13 -11
- package/dist/chunk-HNZQ7LM4.js.map +1 -0
- package/dist/{chunk-3IQ73WNW.js → chunk-I54DOEZB.js} +9 -7
- package/dist/chunk-I54DOEZB.js.map +1 -0
- package/dist/{chunk-QB2KMV6S.js → chunk-PANH23MF.js} +12 -12
- package/dist/chunk-PANH23MF.js.map +1 -0
- package/dist/{chunk-UCHJCUYI.js → chunk-PYVUQNFQ.js} +39 -13
- package/dist/chunk-PYVUQNFQ.js.map +1 -0
- package/dist/{chunk-GQDUHZE3.js → chunk-Q54FX3SY.js} +8 -8
- package/dist/chunk-Q54FX3SY.js.map +1 -0
- package/dist/{chunk-WFKSOM6O.js → chunk-QBORJTS4.js} +68 -44
- package/dist/chunk-QBORJTS4.js.map +1 -0
- package/dist/{chunk-TGT7J4EG.js → chunk-RXX4CN5J.js} +7 -7
- package/dist/chunk-RXX4CN5J.js.map +1 -0
- package/dist/{chunk-XEJMFFIM.js → chunk-SV77SN6P.js} +8 -8
- package/dist/chunk-SV77SN6P.js.map +1 -0
- package/dist/chunk-TAZZLOUY.js +328 -0
- package/dist/chunk-TAZZLOUY.js.map +1 -0
- package/dist/{chunk-7OXTZJR4.js → chunk-TRZO5CHU.js} +7 -7
- package/dist/chunk-TRZO5CHU.js.map +1 -0
- package/dist/{chunk-EDSZI227.js → chunk-UPOTBKKK.js} +12 -9
- package/dist/chunk-UPOTBKKK.js.map +1 -0
- package/dist/{chunk-26O27BQS.js → chunk-WP5WJ4V5.js} +6 -6
- package/dist/chunk-WP5WJ4V5.js.map +1 -0
- package/dist/{chunk-YD6IZ2C5.js → chunk-WS5AUJ35.js} +7 -7
- package/dist/chunk-WS5AUJ35.js.map +1 -0
- package/dist/{chunk-HYPPG4NF.js → chunk-WWYYNR3Z.js} +93 -53
- package/dist/chunk-WWYYNR3Z.js.map +1 -0
- package/dist/{chunk-NKTMMJYD.js → chunk-XU2XODVH.js} +9 -8
- package/dist/chunk-XU2XODVH.js.map +1 -0
- package/dist/{chunk-D6C7XEY4.js → chunk-YR6T73GY.js} +24 -12
- package/dist/chunk-YR6T73GY.js.map +1 -0
- package/dist/{chunk-OB7WULFK.js → chunk-YYYQPKQ7.js} +24 -24
- package/dist/chunk-YYYQPKQ7.js.map +1 -0
- package/dist/{chunk-FJRHZA3C.js → chunk-Z45LY6BT.js} +9 -9
- package/dist/chunk-Z45LY6BT.js.map +1 -0
- package/dist/{chunk-6YYAOKNI.js → chunk-ZQBEFP2O.js} +7 -7
- package/dist/chunk-ZQBEFP2O.js.map +1 -0
- package/dist/chunk-ZS7RPXCT.js +47 -0
- package/dist/chunk-ZS7RPXCT.js.map +1 -0
- package/dist/components/accordion.d.ts +3 -3
- package/dist/components/accordion.js +4 -4
- package/dist/components/alert.d.ts +3 -3
- package/dist/components/alert.js +4 -4
- package/dist/components/app-ui.d.ts +47 -31
- package/dist/components/app-ui.js +21 -20
- package/dist/components/badge.d.ts +37 -0
- package/dist/components/badge.js +9 -0
- package/dist/components/blocks.d.ts +37 -74
- package/dist/components/blocks.js +10 -13
- package/dist/components/button.d.ts +3 -3
- package/dist/components/button.js +5 -5
- package/dist/components/checkbox-group.d.ts +2 -2
- package/dist/components/checkbox-group.js +5 -5
- package/dist/components/checkbox.d.ts +2 -2
- package/dist/components/checkbox.js +5 -5
- package/dist/components/chip.d.ts +58 -0
- package/dist/components/chip.js +8 -0
- package/dist/components/date-input.d.ts +2 -2
- package/dist/components/date-input.js +5 -5
- package/dist/components/dialog.d.ts +18 -3
- package/dist/components/dialog.js +5 -4
- package/dist/components/fieldset.d.ts +3 -3
- package/dist/components/fieldset.js +4 -4
- package/dist/components/grid.d.ts +3 -3
- package/dist/components/grid.js +4 -4
- package/dist/components/help.d.ts +3 -3
- package/dist/components/help.js +4 -4
- package/dist/components/icon.d.ts +3 -3
- package/dist/components/icon.js +4 -4
- package/dist/components/journey.d.ts +30 -16
- package/dist/components/journey.js +15 -15
- package/dist/components/layout.d.ts +9 -9
- package/dist/components/layout.js +10 -10
- package/dist/components/link.d.ts +3 -3
- package/dist/components/link.js +5 -5
- package/dist/components/list.d.ts +3 -3
- package/dist/components/list.js +4 -4
- package/dist/components/media.d.ts +8 -8
- package/dist/components/media.js +8 -8
- package/dist/components/navigation.d.ts +5 -5
- package/dist/components/navigation.js +7 -7
- package/dist/components/page.d.ts +5 -5
- package/dist/components/page.js +6 -6
- package/dist/components/price.d.ts +3 -3
- package/dist/components/price.js +4 -4
- package/dist/components/progress.d.ts +3 -3
- package/dist/components/progress.js +4 -4
- package/dist/components/radio-group.d.ts +2 -2
- package/dist/components/radio-group.js +5 -5
- package/dist/components/select.d.ts +2 -2
- package/dist/components/select.js +5 -5
- package/dist/components/summary-list.d.ts +3 -3
- package/dist/components/summary-list.js +4 -4
- package/dist/components/table.d.ts +97 -5
- package/dist/components/table.js +6 -4
- package/dist/components/text-input.d.ts +2 -2
- package/dist/components/text-input.js +5 -5
- package/dist/components/textarea.d.ts +2 -2
- package/dist/components/textarea.js +5 -5
- package/dist/index.d.ts +47 -40
- package/dist/index.js +206 -269
- package/dist/standalone/atomic-ui.js +1928 -0
- package/dist/standalone/atomic-ui.js.map +7 -0
- package/dist/standalone/index.html +173 -0
- package/package.json +19 -7
- package/scripts/copy-to-product.mjs +52 -0
- package/specimen/index.html +173 -0
- package/dist/chunk-26O27BQS.js.map +0 -1
- package/dist/chunk-2CFVV2NZ.js +0 -494
- package/dist/chunk-2CFVV2NZ.js.map +0 -1
- package/dist/chunk-3IQ73WNW.js.map +0 -1
- package/dist/chunk-4X723QBD.js +0 -361
- package/dist/chunk-4X723QBD.js.map +0 -1
- package/dist/chunk-6YYAOKNI.js.map +0 -1
- package/dist/chunk-7AJN2TIS.js.map +0 -1
- package/dist/chunk-7BSZPUE3.js.map +0 -1
- package/dist/chunk-7OXTZJR4.js.map +0 -1
- package/dist/chunk-7XEPNEVQ.js +0 -264
- package/dist/chunk-7XEPNEVQ.js.map +0 -1
- package/dist/chunk-D6C7XEY4.js.map +0 -1
- package/dist/chunk-E2VBUWJ4.js.map +0 -1
- package/dist/chunk-E3XJK7MY.js.map +0 -1
- package/dist/chunk-EDSZI227.js.map +0 -1
- package/dist/chunk-FFCIY7NM.js.map +0 -1
- package/dist/chunk-FJRHZA3C.js.map +0 -1
- package/dist/chunk-GQDUHZE3.js.map +0 -1
- package/dist/chunk-HYPPG4NF.js.map +0 -1
- package/dist/chunk-J4JULXUG.js +0 -249
- package/dist/chunk-J4JULXUG.js.map +0 -1
- package/dist/chunk-KFD4O7VA.js.map +0 -1
- package/dist/chunk-MVEFM5QI.js +0 -195
- package/dist/chunk-MVEFM5QI.js.map +0 -1
- package/dist/chunk-NCASAXQT.js.map +0 -1
- package/dist/chunk-NKTMMJYD.js.map +0 -1
- package/dist/chunk-OB7WULFK.js.map +0 -1
- package/dist/chunk-OHDPGIJ3.js +0 -428
- package/dist/chunk-OHDPGIJ3.js.map +0 -1
- package/dist/chunk-OLLZFNO6.js.map +0 -1
- package/dist/chunk-OMJMUFOW.js.map +0 -1
- package/dist/chunk-QB2KMV6S.js.map +0 -1
- package/dist/chunk-R67PDFKE.js.map +0 -1
- package/dist/chunk-RZSZQMSE.js +0 -236
- package/dist/chunk-RZSZQMSE.js.map +0 -1
- package/dist/chunk-TGT7J4EG.js.map +0 -1
- package/dist/chunk-UCHJCUYI.js.map +0 -1
- package/dist/chunk-UHLRXI6J.js +0 -453
- package/dist/chunk-UHLRXI6J.js.map +0 -1
- package/dist/chunk-UNVL3CNM.js +0 -725
- package/dist/chunk-UNVL3CNM.js.map +0 -1
- package/dist/chunk-WDDWWCHN.js +0 -104
- package/dist/chunk-WDDWWCHN.js.map +0 -1
- package/dist/chunk-WFKSOM6O.js.map +0 -1
- package/dist/chunk-XEJMFFIM.js.map +0 -1
- package/dist/chunk-XJXCTGDR.js.map +0 -1
- package/dist/chunk-YD6IZ2C5.js.map +0 -1
- package/dist/chunk-YK5QI57J.js +0 -396
- package/dist/chunk-YK5QI57J.js.map +0 -1
- package/dist/components/changelog.d.ts +0 -386
- package/dist/components/changelog.js +0 -25
- package/dist/components/estimator.d.ts +0 -246
- package/dist/components/estimator.js +0 -16
- package/dist/components/marketing.d.ts +0 -370
- package/dist/components/marketing.js +0 -21
- package/dist/components/marketing.js.map +0 -1
- package/dist/components/organisms.d.ts +0 -559
- package/dist/components/organisms.js +0 -25
- package/dist/components/organisms.js.map +0 -1
- package/dist/components/property.d.ts +0 -389
- package/dist/components/property.js +0 -20
- package/dist/components/property.js.map +0 -1
- package/dist/components/scene.d.ts +0 -138
- package/dist/components/scene.js +0 -8
- package/dist/components/scene.js.map +0 -1
- package/dist/components/scrubber.d.ts +0 -86
- package/dist/components/scrubber.js +0 -8
- package/dist/components/scrubber.js.map +0 -1
- package/dist/components/selling.d.ts +0 -407
- package/dist/components/selling.js +0 -25
- package/dist/components/selling.js.map +0 -1
- package/dist/components/site.d.ts +0 -283
- package/dist/components/site.js +0 -20
- package/dist/components/site.js.map +0 -1
- /package/dist/components/{changelog.js.map → badge.js.map} +0 -0
- /package/dist/components/{estimator.js.map → chip.js.map} +0 -0
package/dist/chunk-J4JULXUG.js
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
toneOf
|
|
3
|
-
} from "./chunk-2CFVV2NZ.js";
|
|
4
|
-
import {
|
|
5
|
-
ImpktElement,
|
|
6
|
-
focusRing,
|
|
7
|
-
fontSize,
|
|
8
|
-
fontWeight,
|
|
9
|
-
space,
|
|
10
|
-
t,
|
|
11
|
-
type
|
|
12
|
-
} from "./chunk-D6C7XEY4.js";
|
|
13
|
-
|
|
14
|
-
// packages/ui/src/components/site.ts
|
|
15
|
-
import { css, html, nothing } from "lit";
|
|
16
|
-
var STRIPE = [0, 1, 2, 3, 4];
|
|
17
|
-
var MONO = t.fontMono;
|
|
18
|
-
var hideOn = css`
|
|
19
|
-
@media (max-width: 40rem) { :host([hide-on='phone']) { display: none !important; } }
|
|
20
|
-
@media (min-width: 40.0625rem) { :host([hide-on='wide']) { display: none !important; } }
|
|
21
|
-
`;
|
|
22
|
-
var ImpktSiteHeader = class extends ImpktElement {
|
|
23
|
-
static {
|
|
24
|
-
this.properties = {
|
|
25
|
-
brand: { type: String },
|
|
26
|
-
logoSrc: { type: String, attribute: "logo-src" },
|
|
27
|
-
logoAlt: { type: String, attribute: "logo-alt" },
|
|
28
|
-
home: { type: String },
|
|
29
|
-
badge: { type: String },
|
|
30
|
-
meta: { type: String },
|
|
31
|
-
links: { type: Array },
|
|
32
|
-
label: { type: String },
|
|
33
|
-
menuText: { type: String, attribute: "menu-text" },
|
|
34
|
-
status: { type: String },
|
|
35
|
-
statusMeta: { type: String, attribute: "status-meta" },
|
|
36
|
-
statusTone: { type: String, attribute: "status-tone" },
|
|
37
|
-
actionText: { type: String, attribute: "action-text" },
|
|
38
|
-
actionHref: { type: String, attribute: "action-href" }
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
constructor() {
|
|
42
|
-
super();
|
|
43
|
-
this.brand = "";
|
|
44
|
-
this.logoSrc = "";
|
|
45
|
-
this.logoAlt = "";
|
|
46
|
-
this.home = "/";
|
|
47
|
-
this.badge = "";
|
|
48
|
-
this.meta = "";
|
|
49
|
-
this.links = [];
|
|
50
|
-
this.label = "Main";
|
|
51
|
-
this.menuText = "Menu";
|
|
52
|
-
this.status = "";
|
|
53
|
-
this.statusMeta = "";
|
|
54
|
-
this.statusTone = "success";
|
|
55
|
-
this.actionText = "";
|
|
56
|
-
this.actionHref = "";
|
|
57
|
-
}
|
|
58
|
-
static {
|
|
59
|
-
this.styles = [...ImpktElement.styles, focusRing, css`
|
|
60
|
-
:host { display: block; container-type: inline-size; }
|
|
61
|
-
.bar { display: flex; align-items: center; gap: ${space(6)}; }
|
|
62
|
-
.start { display: flex; align-items: center; gap: ${space(3)}; flex: none; }
|
|
63
|
-
.middle { flex: 1 1 8rem; min-inline-size: 0; display: flex; align-items: center; justify-content: center; }
|
|
64
|
-
.middle ::slotted(*) { flex: 1 1 auto; min-inline-size: 0; }
|
|
65
|
-
slot { display: contents; }
|
|
66
|
-
.brand { color: inherit; text-decoration: none; font-family: ${t.fontHeading}; font-weight: ${fontWeight("semibold")}; ${type("2xl")} letter-spacing: -0.02em; line-height: 1; }
|
|
67
|
-
.brand img { display: block; block-size: 32px; inline-size: auto; }
|
|
68
|
-
.chip { display: inline-flex; align-items: center; gap: ${space(1)}; padding: 2px ${space(2)}; border-radius: ${t.radius}; background: color-mix(in srgb, currentColor 7%, transparent); font-family: ${MONO}; font-size: ${fontSize("xs")}; }
|
|
69
|
-
.chip svg { inline-size: 12px; block-size: 12px; }
|
|
70
|
-
.meta { font-family: ${MONO}; font-size: ${fontSize("xs")}; opacity: 0.55; }
|
|
71
|
-
.middle impkt-nav { flex: 1 1 8rem; }
|
|
72
|
-
.end { display: flex; align-items: center; gap: ${space(3)}; flex: none; }
|
|
73
|
-
.end:empty, .start:empty { display: none; }
|
|
74
|
-
.status { display: inline-flex; align-items: center; gap: ${space(2)}; padding: ${space(1)} ${space(3)}; border: ${t.borderThin} solid ${t.border}; border-radius: 999px; background: ${t.surfaceCard}; font-family: ${MONO}; font-size: ${fontSize("xs")}; white-space: nowrap; }
|
|
75
|
-
.status .dot { inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--tone); }
|
|
76
|
-
.status .hash { opacity: 0.55; }
|
|
77
|
-
@container (max-width: 56rem) { .chip, .meta, .status { display: none; } .bar { gap: ${space(3)}; } }
|
|
78
|
-
`];
|
|
79
|
-
}
|
|
80
|
-
act() {
|
|
81
|
-
this.dispatchEvent(new CustomEvent("impkt-action", { bubbles: true, composed: true }));
|
|
82
|
-
}
|
|
83
|
-
render() {
|
|
84
|
-
const wordmark = this.logoSrc ? html`<img src=${this.logoSrc} alt=${this.logoAlt || this.brand} />` : html`${this.brand}`;
|
|
85
|
-
return html`<div class="bar" part="bar">
|
|
86
|
-
<div class="start"><slot name="start">
|
|
87
|
-
${this.brand || this.logoSrc ? html`<a class="brand" href=${this.home || "/"} part="brand">${wordmark}</a>` : nothing}
|
|
88
|
-
${this.badge ? html`<span class="chip" part="badge"><svg viewBox="0 0 14 14" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="3.5" cy="3" r="1.5"/><circle cx="3.5" cy="11" r="1.5"/><circle cx="10.5" cy="4.5" r="1.5"/><path d="M3.5 4.5v5M10.5 6c0 2.5-3 2.5-6 4"/></svg>${this.badge}</span>` : nothing}
|
|
89
|
-
${this.meta ? html`<span class="meta" part="meta">${this.meta}</span>` : nothing}
|
|
90
|
-
</slot></div>
|
|
91
|
-
<div class="middle"><slot name="middle">${(this.links ?? []).length ? html`<impkt-nav align="center" size="sm" .links=${this.links} .label=${this.label} .menuText=${this.menuText}></impkt-nav>` : nothing}</slot></div>
|
|
92
|
-
<div class="end"><slot name="end">
|
|
93
|
-
${this.status ? html`<span class="status" part="status" style=${`--tone:${toneOf(this.statusTone, 0)}`}><span class="dot" aria-hidden="true"></span>${this.status}${this.statusMeta ? html` <span class="hash">${this.statusMeta}</span>` : nothing}</span>` : nothing}
|
|
94
|
-
${this.actionText ? html`<impkt-button variant="primary" icon-after="arrow-right" href=${this.actionHref || nothing} @click=${this.act}>${this.actionText}</impkt-button>` : nothing}
|
|
95
|
-
</slot></div>
|
|
96
|
-
</div>`;
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
var ImpktWordmark = class extends ImpktElement {
|
|
100
|
-
static {
|
|
101
|
-
this.properties = {
|
|
102
|
-
text: { type: String },
|
|
103
|
-
src: { type: String },
|
|
104
|
-
alt: { type: String },
|
|
105
|
-
href: { type: String },
|
|
106
|
-
size: { type: String, reflect: true },
|
|
107
|
-
hideOn: { type: String, reflect: true, attribute: "hide-on" }
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
constructor() {
|
|
111
|
-
super();
|
|
112
|
-
this.text = "";
|
|
113
|
-
this.src = "";
|
|
114
|
-
this.alt = "";
|
|
115
|
-
this.href = "/";
|
|
116
|
-
this.size = "md";
|
|
117
|
-
this.hideOn = "never";
|
|
118
|
-
}
|
|
119
|
-
static {
|
|
120
|
-
this.styles = [...ImpktElement.styles, focusRing, hideOn, css`
|
|
121
|
-
:host { display: inline-flex; align-items: center; flex: none; }
|
|
122
|
-
a { color: inherit; text-decoration: none; font-family: ${t.fontHeading}; font-weight: ${fontWeight("semibold")}; letter-spacing: -0.02em; line-height: 1; border-radius: ${t.radiusSm}; }
|
|
123
|
-
:host([size='sm']) a { ${type("xl")} } :host([size='md']) a { ${type("2xl")} } :host([size='lg']) a { ${type("3xl")} }
|
|
124
|
-
img { display: block; block-size: 32px; inline-size: auto; }
|
|
125
|
-
@media (max-width: 40rem) { :host([size='md']) a, :host([size='lg']) a { ${type("xl")} } }
|
|
126
|
-
`];
|
|
127
|
-
}
|
|
128
|
-
render() {
|
|
129
|
-
return html`<a href=${this.href || "/"} part="link">${this.src ? html`<img src=${this.src} alt=${this.alt || this.text || this.textContent?.trim() || ""} />` : html`<slot>${this.text}</slot>`}</a>`;
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
var ImpktChip = class extends ImpktElement {
|
|
133
|
-
static {
|
|
134
|
-
this.properties = {
|
|
135
|
-
label: { type: String },
|
|
136
|
-
meta: { type: String },
|
|
137
|
-
icon: { type: String, reflect: true },
|
|
138
|
-
tone: { type: String },
|
|
139
|
-
look: { type: String, reflect: true },
|
|
140
|
-
hideOn: { type: String, reflect: true, attribute: "hide-on" }
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
constructor() {
|
|
144
|
-
super();
|
|
145
|
-
this.label = "";
|
|
146
|
-
this.meta = "";
|
|
147
|
-
this.icon = "none";
|
|
148
|
-
this.tone = "success";
|
|
149
|
-
this.look = "filled";
|
|
150
|
-
this.hideOn = "never";
|
|
151
|
-
}
|
|
152
|
-
static {
|
|
153
|
-
this.styles = [...ImpktElement.styles, hideOn, css`
|
|
154
|
-
:host { display: inline-flex; flex: none; }
|
|
155
|
-
span.chip { display: inline-flex; align-items: center; gap: ${space(1.5)}; padding: 3px ${space(2.5)}; border-radius: 999px; font-family: ${MONO}; font-size: ${fontSize("xs")}; line-height: 1.2; white-space: nowrap; }
|
|
156
|
-
:host([look='filled']) span.chip { border-radius: ${t.radius}; background: color-mix(in srgb, currentColor 7%, transparent); }
|
|
157
|
-
:host([look='outlined']) span.chip { border: ${t.borderThin} solid ${t.border}; background: ${t.surfaceCard}; text-transform: uppercase; letter-spacing: 0.04em; }
|
|
158
|
-
:host([look='plain']) span.chip { padding: 0; }
|
|
159
|
-
.dot { inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--tone); }
|
|
160
|
-
svg { inline-size: 12px; block-size: 12px; }
|
|
161
|
-
.meta { opacity: 0.55; text-transform: none; }
|
|
162
|
-
:host([look='plain']) .label { opacity: 0.55; }
|
|
163
|
-
`];
|
|
164
|
-
}
|
|
165
|
-
render() {
|
|
166
|
-
const icon = this.icon === "dot" ? html`<span class="dot" aria-hidden="true"></span>` : this.icon === "branch" ? html`<svg viewBox="0 0 14 14" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="3.5" cy="3" r="1.5"/><circle cx="3.5" cy="11" r="1.5"/><circle cx="10.5" cy="4.5" r="1.5"/><path d="M3.5 4.5v5M10.5 6c0 2.5-3 2.5-6 4"/></svg>` : nothing;
|
|
167
|
-
return html`<span class="chip" part="chip" style=${`--tone:${toneOf(this.tone, 0)}`}>${icon}<span class="label">${this.label}</span>${this.meta ? html` <span class="meta">${this.meta}</span>` : nothing}</span>`;
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
var ImpktSiteFooter = class extends ImpktElement {
|
|
171
|
-
static {
|
|
172
|
-
this.properties = {
|
|
173
|
-
brand: { type: String },
|
|
174
|
-
log: { type: Array },
|
|
175
|
-
columns: { type: Array },
|
|
176
|
-
columnsOnPhone: { type: String, attribute: "columns-on-phone", reflect: true },
|
|
177
|
-
legal: { type: String },
|
|
178
|
-
stripe: { type: Boolean, reflect: true },
|
|
179
|
-
headingLevel: { type: Number, attribute: "heading-level" }
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
constructor() {
|
|
183
|
-
super();
|
|
184
|
-
this.brand = "";
|
|
185
|
-
this.log = [];
|
|
186
|
-
this.columns = [];
|
|
187
|
-
this.columnsOnPhone = "shown";
|
|
188
|
-
this.legal = "";
|
|
189
|
-
this.stripe = false;
|
|
190
|
-
this.headingLevel = 2;
|
|
191
|
-
}
|
|
192
|
-
static {
|
|
193
|
-
this.styles = [...ImpktElement.styles, focusRing, css`
|
|
194
|
-
/* The page frame's footer band gives the colours; this sits flush with its foot so the stripe meets the edge. */
|
|
195
|
-
:host { display: block; container-type: inline-size; position: relative; padding-block: ${space(8)} ${space(4)}; margin-block-end: calc(-1 * ${space(8)}); }
|
|
196
|
-
.top { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: ${space(10)}; }
|
|
197
|
-
.brand { margin: 0; font-family: ${t.fontHeading}; font-weight: ${fontWeight("bold")}; font-size: clamp(3rem, 6vw, 4.5rem); line-height: 1; letter-spacing: -0.03em; }
|
|
198
|
-
ul { list-style: none; margin: 0; padding: 0; }
|
|
199
|
-
.log { margin-block-start: ${space(8)}; display: grid; gap: ${space(3)}; font-family: ${MONO}; font-size: ${fontSize("sm")}; }
|
|
200
|
-
.log li { display: flex; align-items: center; gap: ${space(3)}; opacity: 0.55; }
|
|
201
|
-
.log li:first-child { opacity: 1; }
|
|
202
|
-
.log .dot { flex: none; inline-size: 10px; block-size: 10px; border-radius: 50%; background: var(--tone); }
|
|
203
|
-
.log .code { margin-inline-end: ${space(3)}; }
|
|
204
|
-
.columns { display: grid; grid-template-columns: repeat(var(--count, 4), minmax(0, 1fr)); gap: ${space(8)}; }
|
|
205
|
-
.h { margin: 0 0 ${space(4)}; font-family: ${MONO}; font-size: ${fontSize("xs")}; font-weight: ${fontWeight("medium")}; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.55; }
|
|
206
|
-
.columns ul { display: grid; gap: ${space(3)}; }
|
|
207
|
-
a { color: inherit; text-decoration: none; font-weight: ${fontWeight("medium")}; border-radius: ${t.radiusSm}; }
|
|
208
|
-
a:hover { text-decoration: underline; text-underline-offset: 0.25em; }
|
|
209
|
-
.legal { margin: ${space(16)} 0 0; font-family: ${MONO}; font-size: ${fontSize("xs")}; opacity: 0.55; }
|
|
210
|
-
.stripe { position: absolute; inset-inline: -100vmax; inset-block-end: 0; block-size: 6px; display: flex; }
|
|
211
|
-
.stripe span { flex: 1; }
|
|
212
|
-
@container (max-width: 48rem) { .top { grid-template-columns: 1fr; } .columns { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
|
|
213
|
-
@container (max-width: 40rem) { :host([columns-on-phone='hidden']) .columns { display: none; } }
|
|
214
|
-
@media (forced-colors: active) { :host { border-block-start: 1px solid CanvasText; } .log .dot { border: 1px solid CanvasText; } }
|
|
215
|
-
`];
|
|
216
|
-
}
|
|
217
|
-
heading(text) {
|
|
218
|
-
const level = Math.min(Math.max(this.headingLevel || 2, 2), 4);
|
|
219
|
-
return level === 3 ? html`<h3 class="h">${text}</h3>` : level === 4 ? html`<h4 class="h">${text}</h4>` : html`<h2 class="h">${text}</h2>`;
|
|
220
|
-
}
|
|
221
|
-
render() {
|
|
222
|
-
const log = this.log ?? [];
|
|
223
|
-
return html`<div part="footer">
|
|
224
|
-
<div class="top">
|
|
225
|
-
<div>
|
|
226
|
-
${this.brand ? html`<p class="brand" part="brand">${this.brand}</p>` : nothing}
|
|
227
|
-
${log.length ? html`<ul class="log" part="log">${log.map((line, i) => html`<li style=${`--tone:${toneOf(line.tone ?? (i === 0 ? "success" : "accent"), i)}`}><span class="dot" aria-hidden="true"></span><span>${line.meta ? html`<span class="code">${line.meta}</span>` : nothing}${line.text}</span></li>`)}</ul>` : nothing}
|
|
228
|
-
</div>
|
|
229
|
-
<div class="columns" part="columns" style=${`--count:${Math.max(1, (this.columns ?? []).length)}`}>
|
|
230
|
-
${(this.columns ?? []).map((column) => html`<div>${this.heading(column.heading)}<ul>${(column.links ?? []).map((link) => html`<li><a href=${link.href}>${link.label}</a></li>`)}</ul></div>`)}
|
|
231
|
-
</div>
|
|
232
|
-
</div>
|
|
233
|
-
${this.legal ? html`<p class="legal" part="legal">${this.legal}</p>` : nothing}
|
|
234
|
-
${this.stripe ? html`<div class="stripe" aria-hidden="true">${STRIPE.map((i) => html`<span style=${`background:${toneOf(void 0, i)}`}></span>`)}</div>` : nothing}
|
|
235
|
-
</div>`;
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
customElements.define("impkt-site-header", ImpktSiteHeader);
|
|
239
|
-
customElements.define("impkt-wordmark", ImpktWordmark);
|
|
240
|
-
customElements.define("impkt-chip", ImpktChip);
|
|
241
|
-
customElements.define("impkt-site-footer", ImpktSiteFooter);
|
|
242
|
-
|
|
243
|
-
export {
|
|
244
|
-
ImpktSiteHeader,
|
|
245
|
-
ImpktWordmark,
|
|
246
|
-
ImpktChip,
|
|
247
|
-
ImpktSiteFooter
|
|
248
|
-
};
|
|
249
|
-
//# sourceMappingURL=chunk-J4JULXUG.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/site.ts"],"sourcesContent":["/**\n * A site's own header and footer, drawn as one piece each, for the layout's\n * header and footer slots.\n *\n * The page frame (`impkt-page`) gives them their landmarks, so neither draws a\n * `<header>` or `<footer>` of its own: a second banner would be one a screen\n * reader announces twice.\n */\nimport { css, html, nothing, type TemplateResult } from 'lit';\nimport { ImpktElement } from '../base/ImpktElement';\nimport { focusRing } from '../base/styles';\nimport { fontSize, fontWeight, space, t, type } from '../base/tokens';\nimport { toneOf, type Tone } from './changelog';\nimport type { NavLink } from './navigation';\nimport './navigation';\nimport './button';\n\n/** The footer stripe's colours, left to right. */\n/** The stripe's segments take the brand's chart colours in order. */\nconst STRIPE = [0, 1, 2, 3, 4];\n\n/** Code-like labels: a branch, a hash, a commit message. */\nconst MONO = t.fontMono;\n\n/** `hideOn`: left out on a phone, or on anything wider. The same width the nav folds at. */\nconst hideOn = css`\n @media (max-width: 40rem) { :host([hide-on='phone']) { display: none !important; } }\n @media (min-width: 40.0625rem) { :host([hide-on='wide']) { display: none !important; } }\n`;\n\n\n/**\n * The site header: the brand, the main links and one call to action, with an\n * optional chip beside the brand and a status before the action.\n *\n * The links fold behind a Menu button when they do not fit, as `impkt-nav`\n * does. The chip and the status are labels, not controls, and they are left\n * out on a phone so the brand, the menu and the action keep the row.\n *\n * **Build your own.** Place components in its three slots, start, middle and\n * end, and each slot that holds something replaces what the props draw there:\n * a wordmark and chips at the start, a nav in the middle, a status and a\n * button at the end, in any order. Give a component `hideOn: 'phone'` to leave\n * it out on a phone, so the phone's header is built from the same pieces.\n *\n * @category layout\n * @icon header\n * @slot start - The brand: a wordmark or logo, and any chips beside it.\n * @slot middle - The links, usually one nav.\n * @slot end - A status and the call to action.\n * @fires impkt-action - When the call to action is pressed.\n */\nexport class ImpktSiteHeader extends ImpktElement {\n static properties = {\n brand: { type: String },\n logoSrc: { type: String, attribute: 'logo-src' },\n logoAlt: { type: String, attribute: 'logo-alt' },\n home: { type: String },\n badge: { type: String },\n meta: { type: String },\n links: { type: Array },\n label: { type: String },\n menuText: { type: String, attribute: 'menu-text' },\n status: { type: String },\n statusMeta: { type: String, attribute: 'status-meta' },\n statusTone: { type: String, attribute: 'status-tone' },\n actionText: { type: String, attribute: 'action-text' },\n actionHref: { type: String, attribute: 'action-href' },\n };\n /** The site's name, set as a wordmark when there is no logo picture. */\n declare brand: string;\n /** A logo picture, used instead of the wordmark. */\n declare logoSrc: string;\n /** What the logo says. Leave empty to use the brand name. */\n declare logoAlt: string;\n /** Where the brand links to. */\n declare home: string;\n /** A short chip beside the brand, such as \"main\". */\n declare badge: string;\n /** A code-like line after the chip, such as a commit hash. */\n declare meta: string;\n declare links: NavLink[];\n /** The name of the links' landmark. */\n declare label: string;\n /** The words on the button that opens the links on a narrow screen. */\n declare menuText: string;\n /** A status before the action, such as the stage the site is at. */\n declare status: string;\n /** A code-like line in the status, such as a hash. */\n declare statusMeta: string;\n declare statusTone: Tone;\n declare actionText: string;\n declare actionHref: string;\n\n constructor() {\n super();\n this.brand = '';\n this.logoSrc = '';\n this.logoAlt = '';\n this.home = '/';\n this.badge = '';\n this.meta = '';\n this.links = [];\n this.label = 'Main';\n this.menuText = 'Menu';\n this.status = '';\n this.statusMeta = '';\n this.statusTone = 'success';\n this.actionText = '';\n this.actionHref = '';\n }\n\n static styles = [...ImpktElement.styles, focusRing, css`\n :host { display: block; container-type: inline-size; }\n .bar { display: flex; align-items: center; gap: ${space(6)}; }\n .start { display: flex; align-items: center; gap: ${space(3)}; flex: none; }\n .middle { flex: 1 1 8rem; min-inline-size: 0; display: flex; align-items: center; justify-content: center; }\n .middle ::slotted(*) { flex: 1 1 auto; min-inline-size: 0; }\n slot { display: contents; }\n .brand { color: inherit; text-decoration: none; font-family: ${t.fontHeading}; font-weight: ${fontWeight('semibold')}; ${type('2xl')} letter-spacing: -0.02em; line-height: 1; }\n .brand img { display: block; block-size: 32px; inline-size: auto; }\n .chip { display: inline-flex; align-items: center; gap: ${space(1)}; padding: 2px ${space(2)}; border-radius: ${t.radius}; background: color-mix(in srgb, currentColor 7%, transparent); font-family: ${MONO}; font-size: ${fontSize('xs')}; }\n .chip svg { inline-size: 12px; block-size: 12px; }\n .meta { font-family: ${MONO}; font-size: ${fontSize('xs')}; opacity: 0.55; }\n .middle impkt-nav { flex: 1 1 8rem; }\n .end { display: flex; align-items: center; gap: ${space(3)}; flex: none; }\n .end:empty, .start:empty { display: none; }\n .status { display: inline-flex; align-items: center; gap: ${space(2)}; padding: ${space(1)} ${space(3)}; border: ${t.borderThin} solid ${t.border}; border-radius: 999px; background: ${t.surfaceCard}; font-family: ${MONO}; font-size: ${fontSize('xs')}; white-space: nowrap; }\n .status .dot { inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--tone); }\n .status .hash { opacity: 0.55; }\n @container (max-width: 56rem) { .chip, .meta, .status { display: none; } .bar { gap: ${space(3)}; } }\n `];\n\n private act(): void {\n this.dispatchEvent(new CustomEvent('impkt-action', { bubbles: true, composed: true }));\n }\n\n render(): TemplateResult {\n const wordmark = this.logoSrc\n ? html`<img src=${this.logoSrc} alt=${this.logoAlt || this.brand} />`\n : html`${this.brand}`;\n // Each region shows what is placed in its slot, or, when nothing is, what the props describe.\n return html`<div class=\"bar\" part=\"bar\">\n <div class=\"start\"><slot name=\"start\">\n ${this.brand || this.logoSrc ? html`<a class=\"brand\" href=${this.home || '/'} part=\"brand\">${wordmark}</a>` : nothing}\n ${this.badge ? html`<span class=\"chip\" part=\"badge\"><svg viewBox=\"0 0 14 14\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"><circle cx=\"3.5\" cy=\"3\" r=\"1.5\"/><circle cx=\"3.5\" cy=\"11\" r=\"1.5\"/><circle cx=\"10.5\" cy=\"4.5\" r=\"1.5\"/><path d=\"M3.5 4.5v5M10.5 6c0 2.5-3 2.5-6 4\"/></svg>${this.badge}</span>` : nothing}\n ${this.meta ? html`<span class=\"meta\" part=\"meta\">${this.meta}</span>` : nothing}\n </slot></div>\n <div class=\"middle\"><slot name=\"middle\">${(this.links ?? []).length ? html`<impkt-nav align=\"center\" size=\"sm\" .links=${this.links} .label=${this.label} .menuText=${this.menuText}></impkt-nav>` : nothing}</slot></div>\n <div class=\"end\"><slot name=\"end\">\n ${this.status ? html`<span class=\"status\" part=\"status\" style=${`--tone:${toneOf(this.statusTone, 0)}`}><span class=\"dot\" aria-hidden=\"true\"></span>${this.status}${this.statusMeta ? html` <span class=\"hash\">${this.statusMeta}</span>` : nothing}</span>` : nothing}\n ${this.actionText ? html`<impkt-button variant=\"primary\" icon-after=\"arrow-right\" href=${this.actionHref || nothing} @click=${this.act}>${this.actionText}</impkt-button>` : nothing}\n </slot></div>\n </div>`;\n }\n}\n\n/**\n * The site's name as a wordmark, or its logo, linking home: the start of a\n * site header.\n *\n * @category layout\n * @icon logo\n */\nexport class ImpktWordmark extends ImpktElement {\n static properties = {\n text: { type: String },\n src: { type: String },\n alt: { type: String },\n href: { type: String },\n size: { type: String, reflect: true },\n hideOn: { type: String, reflect: true, attribute: 'hide-on' },\n };\n /** The name, set in the heading face. */\n declare text: string;\n /** A logo picture, used instead of the name. */\n declare src: string;\n /** What the logo says. Leave empty to use the name. */\n declare alt: string;\n declare href: string;\n /** Larger on a wide header, smaller on a phone's. */\n declare size: 'sm' | 'md' | 'lg';\n declare hideOn: 'never' | 'phone' | 'wide';\n\n constructor() {\n super();\n this.text = '';\n this.src = '';\n this.alt = '';\n this.href = '/';\n this.size = 'md';\n this.hideOn = 'never';\n }\n\n static styles = [...ImpktElement.styles, focusRing, hideOn, css`\n :host { display: inline-flex; align-items: center; flex: none; }\n a { color: inherit; text-decoration: none; font-family: ${t.fontHeading}; font-weight: ${fontWeight('semibold')}; letter-spacing: -0.02em; line-height: 1; border-radius: ${t.radiusSm}; }\n :host([size='sm']) a { ${type('xl')} } :host([size='md']) a { ${type('2xl')} } :host([size='lg']) a { ${type('3xl')} }\n img { display: block; block-size: 32px; inline-size: auto; }\n @media (max-width: 40rem) { :host([size='md']) a, :host([size='lg']) a { ${type('xl')} } }\n `];\n\n render(): TemplateResult {\n // The name arrives as the element's words when a page places it, or as `text` when it is set directly.\n return html`<a href=${this.href || '/'} part=\"link\">${this.src ? html`<img src=${this.src} alt=${this.alt || this.text || this.textContent?.trim() || ''} />` : html`<slot>${this.text}</slot>`}</a>`;\n }\n}\n\n/**\n * A short label: a branch name with its icon, a status with its dot, or a\n * code such as a commit hash. It says something; it does nothing.\n *\n * @category content\n * @icon badge\n */\nexport class ImpktChip extends ImpktElement {\n static properties = {\n label: { type: String },\n meta: { type: String },\n icon: { type: String, reflect: true },\n tone: { type: String },\n look: { type: String, reflect: true },\n hideOn: { type: String, reflect: true, attribute: 'hide-on' },\n };\n declare label: string;\n /** A code after the label, quieter, such as a hash. */\n declare meta: string;\n /** A coloured dot, a branch, or nothing before the label. */\n declare icon: 'none' | 'dot' | 'branch';\n /** The dot's colour: a named tone, or 1 to 5 for the brand's chart colours. */\n declare tone: Tone;\n /** `outlined` on the card colour, `filled` with a faint wash, or `plain` words in the code face. */\n declare look: 'outlined' | 'filled' | 'plain';\n declare hideOn: 'never' | 'phone' | 'wide';\n\n constructor() {\n super();\n this.label = '';\n this.meta = '';\n this.icon = 'none';\n this.tone = 'success';\n this.look = 'filled';\n this.hideOn = 'never';\n }\n\n static styles = [...ImpktElement.styles, hideOn, css`\n :host { display: inline-flex; flex: none; }\n span.chip { display: inline-flex; align-items: center; gap: ${space(1.5)}; padding: 3px ${space(2.5)}; border-radius: 999px; font-family: ${MONO}; font-size: ${fontSize('xs')}; line-height: 1.2; white-space: nowrap; }\n :host([look='filled']) span.chip { border-radius: ${t.radius}; background: color-mix(in srgb, currentColor 7%, transparent); }\n :host([look='outlined']) span.chip { border: ${t.borderThin} solid ${t.border}; background: ${t.surfaceCard}; text-transform: uppercase; letter-spacing: 0.04em; }\n :host([look='plain']) span.chip { padding: 0; }\n .dot { inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--tone); }\n svg { inline-size: 12px; block-size: 12px; }\n .meta { opacity: 0.55; text-transform: none; }\n :host([look='plain']) .label { opacity: 0.55; }\n `];\n\n render(): TemplateResult {\n const icon = this.icon === 'dot'\n ? html`<span class=\"dot\" aria-hidden=\"true\"></span>`\n : this.icon === 'branch'\n ? html`<svg viewBox=\"0 0 14 14\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"><circle cx=\"3.5\" cy=\"3\" r=\"1.5\"/><circle cx=\"3.5\" cy=\"11\" r=\"1.5\"/><circle cx=\"10.5\" cy=\"4.5\" r=\"1.5\"/><path d=\"M3.5 4.5v5M10.5 6c0 2.5-3 2.5-6 4\"/></svg>`\n : nothing;\n return html`<span class=\"chip\" part=\"chip\" style=${`--tone:${toneOf(this.tone, 0)}`}>${icon}<span class=\"label\">${this.label}</span>${this.meta ? html` <span class=\"meta\">${this.meta}</span>` : nothing}</span>`;\n }\n}\n\n/** One line of a footer's log: a code, what it says, and the colour of its dot. */\nexport interface FooterLogLine {\n meta?: string;\n text: string;\n tone?: Tone;\n}\n\n/** A column of footer links under a short heading. */\nexport interface FooterColumn {\n heading: string;\n links: NavLink[];\n}\n\n/**\n * The site footer: the footer band with the brand set large, an optional log of\n * lines beside it, columns of links, a legal line and a stripe of the brand's\n * colours along the foot.\n *\n * Each column is a list under its own heading, so a screen reader can move\n * from one to the next. The log is a list too; its dots are decoration.\n *\n * @category layout\n * @icon footer\n */\nexport class ImpktSiteFooter extends ImpktElement {\n static properties = {\n brand: { type: String },\n log: { type: Array },\n columns: { type: Array },\n columnsOnPhone: { type: String, attribute: 'columns-on-phone', reflect: true },\n legal: { type: String },\n stripe: { type: Boolean, reflect: true },\n headingLevel: { type: Number, attribute: 'heading-level' },\n };\n /** The site's name, set large. */\n declare brand: string;\n /** Lines set in code type under the brand, newest first. The first is bright. */\n declare log: FooterLogLine[];\n declare columns: FooterColumn[];\n /** `hidden` leaves the link columns out on a phone, so the footer there is the name, the lines and the legal line. */\n declare columnsOnPhone: 'shown' | 'hidden';\n /** The line at the foot, such as the copyright. */\n declare legal: string;\n /** A stripe of the brand's colours along the bottom edge. */\n declare stripe: boolean;\n /** The level of each column's heading. */\n declare headingLevel: 2 | 3 | 4;\n\n constructor() {\n super();\n this.brand = '';\n this.log = [];\n this.columns = [];\n this.columnsOnPhone = 'shown';\n this.legal = '';\n this.stripe = false;\n this.headingLevel = 2;\n }\n\n static styles = [...ImpktElement.styles, focusRing, css`\n /* The page frame's footer band gives the colours; this sits flush with its foot so the stripe meets the edge. */\n :host { display: block; container-type: inline-size; position: relative; padding-block: ${space(8)} ${space(4)}; margin-block-end: calc(-1 * ${space(8)}); }\n .top { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: ${space(10)}; }\n .brand { margin: 0; font-family: ${t.fontHeading}; font-weight: ${fontWeight('bold')}; font-size: clamp(3rem, 6vw, 4.5rem); line-height: 1; letter-spacing: -0.03em; }\n ul { list-style: none; margin: 0; padding: 0; }\n .log { margin-block-start: ${space(8)}; display: grid; gap: ${space(3)}; font-family: ${MONO}; font-size: ${fontSize('sm')}; }\n .log li { display: flex; align-items: center; gap: ${space(3)}; opacity: 0.55; }\n .log li:first-child { opacity: 1; }\n .log .dot { flex: none; inline-size: 10px; block-size: 10px; border-radius: 50%; background: var(--tone); }\n .log .code { margin-inline-end: ${space(3)}; }\n .columns { display: grid; grid-template-columns: repeat(var(--count, 4), minmax(0, 1fr)); gap: ${space(8)}; }\n .h { margin: 0 0 ${space(4)}; font-family: ${MONO}; font-size: ${fontSize('xs')}; font-weight: ${fontWeight('medium')}; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.55; }\n .columns ul { display: grid; gap: ${space(3)}; }\n a { color: inherit; text-decoration: none; font-weight: ${fontWeight('medium')}; border-radius: ${t.radiusSm}; }\n a:hover { text-decoration: underline; text-underline-offset: 0.25em; }\n .legal { margin: ${space(16)} 0 0; font-family: ${MONO}; font-size: ${fontSize('xs')}; opacity: 0.55; }\n .stripe { position: absolute; inset-inline: -100vmax; inset-block-end: 0; block-size: 6px; display: flex; }\n .stripe span { flex: 1; }\n @container (max-width: 48rem) { .top { grid-template-columns: 1fr; } .columns { grid-template-columns: repeat(2, minmax(0, 1fr)); } }\n @container (max-width: 40rem) { :host([columns-on-phone='hidden']) .columns { display: none; } }\n @media (forced-colors: active) { :host { border-block-start: 1px solid CanvasText; } .log .dot { border: 1px solid CanvasText; } }\n `];\n\n private heading(text: string): TemplateResult {\n const level = Math.min(Math.max(this.headingLevel || 2, 2), 4);\n return level === 3 ? html`<h3 class=\"h\">${text}</h3>` : level === 4 ? html`<h4 class=\"h\">${text}</h4>` : html`<h2 class=\"h\">${text}</h2>`;\n }\n\n render(): TemplateResult {\n const log = this.log ?? [];\n return html`<div part=\"footer\">\n <div class=\"top\">\n <div>\n ${this.brand ? html`<p class=\"brand\" part=\"brand\">${this.brand}</p>` : nothing}\n ${log.length ? html`<ul class=\"log\" part=\"log\">${log.map((line, i) => html`<li style=${`--tone:${toneOf(line.tone ?? (i === 0 ? 'success' : 'accent'), i)}`}><span class=\"dot\" aria-hidden=\"true\"></span><span>${line.meta ? html`<span class=\"code\">${line.meta}</span>` : nothing}${line.text}</span></li>`)}</ul>` : nothing}\n </div>\n <div class=\"columns\" part=\"columns\" style=${`--count:${Math.max(1, (this.columns ?? []).length)}`}>\n ${(this.columns ?? []).map((column) => html`<div>${this.heading(column.heading)}<ul>${(column.links ?? []).map((link) => html`<li><a href=${link.href}>${link.label}</a></li>`)}</ul></div>`)}\n </div>\n </div>\n ${this.legal ? html`<p class=\"legal\" part=\"legal\">${this.legal}</p>` : nothing}\n ${this.stripe ? html`<div class=\"stripe\" aria-hidden=\"true\">${STRIPE.map((i) => html`<span style=${`background:${toneOf(undefined, i)}`}></span>`)}</div>` : nothing}\n </div>`;\n }\n}\n\ncustomElements.define('impkt-site-header', ImpktSiteHeader);\ncustomElements.define('impkt-wordmark', ImpktWordmark);\ncustomElements.define('impkt-chip', ImpktChip);\ncustomElements.define('impkt-site-footer', ImpktSiteFooter);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impkt-site-header': ImpktSiteHeader;\n 'impkt-wordmark': ImpktWordmark;\n 'impkt-chip': ImpktChip;\n 'impkt-site-footer': ImpktSiteFooter;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAQA,SAAS,KAAK,MAAM,eAAoC;AAWxD,IAAM,SAAS,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC;AAG7B,IAAM,OAAO,EAAE;AAGf,IAAM,SAAS;AAAA;AAAA;A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AAM,MAAM,KAAK,OAAO,CAAC;AACzB,WAAO;AAAA;AAAA;AAAA,YAGC,KAAK,QAAQ,qCAAqC,KAAK,KAAK,SAAS,OAAO;AAAA,YAC5E,IAAI,SAAS,kCAAkC,IAAI,IAAI,CAAC,MAAM,MAAM,iBAAiB,UAAU,OAAO,KAAK,SAAS,MAAM,IAAI,YAAY,WAAW,CAAC,CAAC,EAAE,sDAAsD,KAAK,OAAO,0BAA0B,KAAK,IAAI,YAAY,OAAO,GAAG,KAAK,IAAI,cAAc,CAAC,UAAU,OAAO;AAAA;AAAA,oDAErR,WAAW,KAAK,IAAI,IAAI,KAAK,WAAW,CAAC,GAAG,MAAM,CAAC,EAAE;AAAA,aAC5F,KAAK,WAAW,CAAC,GAAG,IAAI,CAAC,WAAW,YAAY,KAAK,QAAQ,OAAO,OAAO,CAAC,QAAQ,OAAO,SAAS,CAAC,GAAG,IAAI,CAAC,SAAS,mBAAmB,KAAK,IAAI,IAAI,KAAK,KAAK,WAAW,CAAC,aAAa,CAAC;AAAA;AAAA;AAAA,QAG/L,KAAK,QAAQ,qCAAqC,KAAK,KAAK,SAAS,OAAO;AAAA,QAC5E,KAAK,SAAS,8CAA8C,OAAO,IAAI,CAAC,MAAM,mBAAmB,cAAc,OAAO,QAAW,CAAC,CAAC,EAAE,UAAU,CAAC,WAAW,OAAO;AAAA;AAAA,EAExK;AACF;AAEA,eAAe,OAAO,qBAAqB,eAAe;AAC1D,eAAe,OAAO,kBAAkB,aAAa;AACrD,eAAe,OAAO,cAAc,SAAS;AAC7C,eAAe,OAAO,qBAAqB,eAAe;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/icon.ts"],"sourcesContent":["import { css, html, nothing, svg, type SVGTemplateResult, type TemplateResult } from 'lit';\nimport { ImpktElement } from '../base/ImpktElement';\nimport { t } from '../base/tokens';\n\n/**\n * The icons the library draws, each on a 24 by 24 grid in strokes of the\n * current text colour. Kept to a set the components need and editors reach\n * for, so an icon always matches the line weight of the ones beside it.\n */\nexport const ICONS = {\n 'arrow-right': svg`<path d=\"M5 12h14M13 6l6 6-6 6\"/>`,\n 'arrow-left': svg`<path d=\"M19 12H5M11 6l-6 6 6 6\"/>`,\n 'chevron-right': svg`<path d=\"M9 6l6 6-6 6\"/>`,\n 'chevron-down': svg`<path d=\"M6 9l6 6 6-6\"/>`,\n check: svg`<path d=\"M5 12.5l4.5 4.5L19 7\"/>`,\n close: svg`<path d=\"M6 6l12 12M18 6L6 18\"/>`,\n menu: svg`<path d=\"M4 7h16M4 12h16M4 17h16\"/>`,\n /** Two lines: a menu drawn quieter, as a round icon button. */\n 'menu-two': svg`<path d=\"M5 9.5h14M5 14.5h14\"/>`,\n plus: svg`<path d=\"M12 5v14M5 12h14\"/>`,\n minus: svg`<path d=\"M5 12h14\"/>`,\n search: svg`<circle cx=\"11\" cy=\"11\" r=\"6.5\"/><path d=\"M16 16l4 4\"/>`,\n external: svg`<path d=\"M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5\"/>`,\n download: svg`<path d=\"M12 4v11M7 10l5 5 5-5M5 20h14\"/>`,\n home: svg`<path d=\"M4 11l8-7 8 7M6 9.5V20h12V9.5\"/><path d=\"M10 20v-6h4v6\"/>`,\n phone: svg`<path d=\"M7 3.5h3l1.5 4-2 1.5a11 11 0 0 0 5.5 5.5l1.5-2 4 1.5v3a2 2 0 0 1-2 2A16 16 0 0 1 5 5.5a2 2 0 0 1 2-2z\"/>`,\n mail: svg`<rect x=\"3.5\" y=\"5.5\" width=\"17\" height=\"13\" rx=\"1.5\"/><path d=\"M4 7l8 6 8-6\"/>`,\n 'map-pin': svg`<path d=\"M12 21s-6.5-6-6.5-11a6.5 6.5 0 0 1 13 0c0 5-6.5 11-6.5 11z\"/><circle cx=\"12\" cy=\"10\" r=\"2.5\"/>`,\n calendar: svg`<rect x=\"4\" y=\"5.5\" width=\"16\" height=\"14.5\" rx=\"1.5\"/><path d=\"M4 10h16M8.5 3.5v4M15.5 3.5v4\"/>`,\n clock: svg`<circle cx=\"12\" cy=\"12\" r=\"8.5\"/><path d=\"M12 7.5V12l3 2\"/>`,\n user: svg`<circle cx=\"12\" cy=\"8.5\" r=\"3.5\"/><path d=\"M5 20a7 7 0 0 1 14 0\"/>`,\n star: svg`<path d=\"M12 4l2.4 5 5.4.6-4 3.7 1.1 5.4L12 16l-4.9 2.7 1.1-5.4-4-3.7 5.4-.6z\"/>`,\n heart: svg`<path d=\"M12 19.5s-7.5-4.6-7.5-10A4 4 0 0 1 12 7a4 4 0 0 1 7.5 2.5c0 5.4-7.5 10-7.5 10z\"/>`,\n shield: svg`<path d=\"M12 3.5l7 2.5v5.5c0 4.5-3 7.8-7 9-4-1.2-7-4.5-7-9V6z\"/><path d=\"M9 12l2 2 4-4\"/>`,\n leaf: svg`<path d=\"M5 19c0-8 5-13 14-14 0 9-5 14-13 14z\"/><path d=\"M5 19l7-7\"/>`,\n sun: svg`<circle cx=\"12\" cy=\"12\" r=\"3.5\"/><path d=\"M12 3v2M12 19v2M3 12h2M19 12h2M5.6 5.6L7 7M17 17l1.4 1.4M5.6 18.4L7 17M17 7l1.4-1.4\"/>`,\n bolt: svg`<path d=\"M13 3L5 13.5h6L10 21l8-10.5h-6z\"/>`,\n key: svg`<circle cx=\"8\" cy=\"15\" r=\"3.5\"/><path d=\"M10.5 12.5L19 4M16 7l2.5 2.5M14 9l2 2\"/>`,\n info: svg`<circle cx=\"12\" cy=\"12\" r=\"8.5\"/><path d=\"M12 11v5.5M12 7.5v.5\"/>`,\n warning: svg`<path d=\"M12 4l9 15.5H3z\"/><path d=\"M12 10v4M12 16.5v.5\"/>`,\n document: svg`<path d=\"M6 3.5h8l4 4V20a.5.5 0 0 1-.5.5h-11A.5.5 0 0 1 6 20z\"/><path d=\"M14 3.5V8h4M9 13h6M9 16.5h6\"/>`,\n pound: svg`<path d=\"M16 6.5a3.5 3.5 0 0 0-6.5 1.8V20M7 13h7M7 20h10\"/>`,\n chat: svg`<path d=\"M4.5 5.5h15v10h-9l-4 3.5v-3.5h-2z\"/>`,\n} as const satisfies Record<string, SVGTemplateResult>;\n\nexport type IconName = keyof typeof ICONS;\nexport const ICON_NAMES = Object.keys(ICONS) as IconName[];\n\n/** An icon as markup, for components that draw one beside their own words. Always decorative. */\nexport function iconSvg(name: string | undefined, size = '1.25em'): TemplateResult | typeof nothing {\n const shape = name ? ICONS[name as IconName] : undefined;\n if (!shape) return nothing;\n return html`<svg class=\"icon\" viewBox=\"0 0 24 24\" width=${size} height=${size} fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\">${shape}</svg>`;\n}\n\n/**\n * A small picture that stands for something: a phone beside a number, a tick\n * beside a benefit.\n *\n * **An icon is decorative unless it is labelled.** With no `label` it is\n * hidden from screen readers, because the words beside it already say what it\n * means. Give it a label only when it stands alone and carries meaning (1.1.1).\n *\n * @category media\n * @icon star\n */\nexport class ImpktIcon extends ImpktElement {\n static properties = {\n name: { type: String, reflect: true },\n label: { type: String },\n size: { type: String, reflect: true },\n tone: { type: String, reflect: true },\n };\n /** Which icon. */\n declare name: 'arrow-right' | 'arrow-left' | 'chevron-right' | 'chevron-down' | 'check' | 'close' | 'menu' | 'plus' | 'minus' | 'search' | 'external' | 'download' | 'home' | 'phone' | 'mail' | 'map-pin' | 'calendar' | 'clock' | 'user' | 'star' | 'heart' | 'shield' | 'leaf' | 'sun' | 'bolt' | 'key' | 'info' | 'warning' | 'document' | 'pound' | 'chat';\n /** What the icon means, when it stands alone. Leave empty when words beside it say the same. */\n declare label: string;\n declare size: 'sm' | 'md' | 'lg' | 'xl';\n /** The icon's colour. */\n declare tone: 'inherit' | 'brand' | 'muted';\n\n constructor() {\n super();\n this.name = 'star';\n this.label = '';\n this.size = 'md';\n this.tone = 'inherit';\n }\n\n static styles = [...ImpktElement.styles, css`\n :host { display: inline-flex; vertical-align: middle; line-height: 0; }\n :host([tone='brand']) { color: ${t.brand}; }\n :host([tone='muted']) { color: ${t.textMuted}; }\n @media (forced-colors: active) { :host { color: CanvasText; } }\n `];\n\n render(): TemplateResult {\n const size = { sm: '16px', md: '24px', lg: '32px', xl: '48px' }[this.size] ?? '24px';\n const drawn = iconSvg(this.name, size);\n return this.label ? html`<span role=\"img\" aria-label=${this.label}>${drawn}</span>` : html`${drawn}`;\n }\n}\n\ncustomElements.define('impkt-icon', ImpktIcon);\ndeclare global { interface HTMLElementTagNameMap { 'impkt-icon': ImpktIcon } }\n"],"mappings":";;;;;;AAAA,SAAS,KAAK,MAAM,SAAS,WAAwD;AAS9E,IAAM,QAAQ;AAAA,EACnB,eAAe;AAAA,EACf,cAAc;AAAA,EACd,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,OAAO;AAAA,EACP,MAAM;AAAA;AAAA,EAEN,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,UAAU;AAAA,EACV,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AAAA,EACN,WAAW;AAAA,EACX,UAAU;AAAA,EACV,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AAAA,EACN,SAAS;AAAA,EACT,UAAU;AAAA,EACV,OAAO;AAAA,EACP,MAAM;AACR;AAGO,IAAM,aAAa,OAAO,KAAK,KAAK;AAGpC,SAAS,QAAQ,MAA0B,OAAO,UAA2C;AAClG,QAAM,QAAQ,OAAO,MAAM,IAAgB,IAAI;AAC/C,MAAI,CAAC,MAAO,QAAO;AACnB,SAAO,mDAAmD,IAAI,WAAW,IAAI,8IAA8I,KAAK;AAClO;AAaO,IAAM,YAAN,cAAwB,aAAa;AAAA,EAC1C;AAAA,SAAO,aAAa;AAAA,MAClB,MAAM,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACpC,OAAO,EAAE,MAAM,OAAO;AAAA,MACtB,MAAM,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACpC,MAAM,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,IACtC;AAAA;AAAA,EASA,cAAc;AACZ,UAAM;AACN,SAAK,OAAO;AACZ,SAAK,QAAQ;AACb,SAAK,OAAO;AACZ,SAAK,OAAO;AAAA,EACd;AAAA,EAEA;AAAA,SAAO,SAAS,CAAC,GAAG,aAAa,QAAQ;AAAA;AAAA,qCAEN,EAAE,KAAK;AAAA,qCACP,EAAE,SAAS;AAAA;AAAA,GAE7C;AAAA;AAAA,EAED,SAAyB;AACvB,UAAM,OAAO,EAAE,IAAI,QAAQ,IAAI,QAAQ,IAAI,QAAQ,IAAI,OAAO,EAAE,KAAK,IAAI,KAAK;AAC9E,UAAM,QAAQ,QAAQ,KAAK,MAAM,IAAI;AACrC,WAAO,KAAK,QAAQ,mCAAmC,KAAK,KAAK,IAAI,KAAK,YAAY,OAAO,KAAK;AAAA,EACpG;AACF;AAEA,eAAe,OAAO,cAAc,SAAS;","names":[]}
|
package/dist/chunk-MVEFM5QI.js
DELETED
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
iconSvg
|
|
3
|
-
} from "./chunk-KFD4O7VA.js";
|
|
4
|
-
import {
|
|
5
|
-
ImpktElement,
|
|
6
|
-
focusRing,
|
|
7
|
-
fontSize,
|
|
8
|
-
fontWeight,
|
|
9
|
-
lineHeight,
|
|
10
|
-
space,
|
|
11
|
-
spaceAround,
|
|
12
|
-
t,
|
|
13
|
-
targetSize,
|
|
14
|
-
visuallyHidden
|
|
15
|
-
} from "./chunk-D6C7XEY4.js";
|
|
16
|
-
|
|
17
|
-
// packages/ui/src/components/blocks.ts
|
|
18
|
-
import { css, html, nothing } from "lit";
|
|
19
|
-
var ImpktDivider = class extends ImpktElement {
|
|
20
|
-
static {
|
|
21
|
-
this.properties = {
|
|
22
|
-
spacing: { type: String, reflect: true },
|
|
23
|
-
tone: { type: String, reflect: true }
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
constructor() {
|
|
27
|
-
super();
|
|
28
|
-
this.spacing = "md";
|
|
29
|
-
this.tone = "subtle";
|
|
30
|
-
}
|
|
31
|
-
static {
|
|
32
|
-
this.styles = [...ImpktElement.styles, css`
|
|
33
|
-
:host { display: block; }
|
|
34
|
-
hr { margin: ${space(4)} 0; border: 0; border-block-start: ${t.borderThin} solid ${t.border}; opacity: 0.5; }
|
|
35
|
-
:host([tone='strong']) hr { opacity: 1; border-block-start-width: ${t.borderThick}; }
|
|
36
|
-
:host([spacing='sm']) hr { margin-block: ${space(2)}; }
|
|
37
|
-
:host([spacing='lg']) hr { margin-block: ${space(8)}; }
|
|
38
|
-
:host([spacing='xl']) hr { margin-block: ${space(12)}; }
|
|
39
|
-
`];
|
|
40
|
-
}
|
|
41
|
-
render() {
|
|
42
|
-
return html`<hr aria-hidden="true" part="line" />`;
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
var ImpktSpacer = class extends ImpktElement {
|
|
46
|
-
static {
|
|
47
|
-
this.properties = { size: { type: String, reflect: true } };
|
|
48
|
-
}
|
|
49
|
-
constructor() {
|
|
50
|
-
super();
|
|
51
|
-
this.size = "md";
|
|
52
|
-
}
|
|
53
|
-
static {
|
|
54
|
-
this.styles = [...ImpktElement.styles, css`
|
|
55
|
-
:host { display: block; block-size: ${space(4)}; }
|
|
56
|
-
:host([size='sm']) { block-size: ${space(2)}; }
|
|
57
|
-
:host([size='lg']) { block-size: ${space(8)}; }
|
|
58
|
-
:host([size='xl']) { block-size: ${space(12)}; }
|
|
59
|
-
:host([size='2xl']) { block-size: ${space(16)}; }
|
|
60
|
-
`];
|
|
61
|
-
}
|
|
62
|
-
render() {
|
|
63
|
-
return html``;
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
var ImpktVisuallyHidden = class extends ImpktElement {
|
|
67
|
-
static {
|
|
68
|
-
this.styles = [...ImpktElement.styles, css`:host { ${visuallyHidden} }`];
|
|
69
|
-
}
|
|
70
|
-
render() {
|
|
71
|
-
return html`<slot></slot>`;
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
var ImpktTabs = class extends ImpktElement {
|
|
75
|
-
static {
|
|
76
|
-
this.properties = {
|
|
77
|
-
items: { type: Array },
|
|
78
|
-
selected: { type: String, reflect: true },
|
|
79
|
-
label: { type: String }
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
constructor() {
|
|
83
|
-
super();
|
|
84
|
-
this.items = [];
|
|
85
|
-
this.selected = "";
|
|
86
|
-
this.label = "";
|
|
87
|
-
}
|
|
88
|
-
static {
|
|
89
|
-
this.styles = [...ImpktElement.styles, focusRing, css`
|
|
90
|
-
:host { display: block; }
|
|
91
|
-
[role='tablist'] { display: flex; flex-wrap: wrap; gap: ${space(1)}; border-block-end: ${t.borderThin} solid ${t.border}; }
|
|
92
|
-
[role='tab'] { ${targetSize} padding: ${space(3)} ${space(4)}; font: inherit; font-weight: ${fontWeight("semibold")}; color: ${t.textMuted}; background: transparent; border: 0; border-block-end: 3px solid transparent; margin-block-end: -1px; cursor: pointer; border-radius: ${t.radius} ${t.radius} 0 0; }
|
|
93
|
-
[role='tab']:hover { color: ${t.text}; background: ${t.surfaceInset}; }
|
|
94
|
-
[role='tab'][aria-selected='true'] { color: ${t.link}; border-block-end-color: currentColor; }
|
|
95
|
-
[role='tabpanel'] { padding-block: ${space(5)}; line-height: ${lineHeight("normal")}; white-space: pre-line; }
|
|
96
|
-
@media (forced-colors: active) { [role='tab'][aria-selected='true'] { border-block-end-color: Highlight; } }
|
|
97
|
-
`];
|
|
98
|
-
}
|
|
99
|
-
current() {
|
|
100
|
-
const items = this.items ?? [];
|
|
101
|
-
return items.some((i) => i.id === this.selected) ? this.selected : items[0]?.id ?? "";
|
|
102
|
-
}
|
|
103
|
-
choose(id, focus) {
|
|
104
|
-
if (id === this.current()) return;
|
|
105
|
-
this.selected = id;
|
|
106
|
-
this.dispatchEvent(new CustomEvent("impkt-change", { detail: { value: id }, bubbles: true, composed: true }));
|
|
107
|
-
if (focus) void this.updateComplete.then(() => this.renderRoot.querySelector(`#${this.id_(`tab-${id}`)}`)?.focus());
|
|
108
|
-
}
|
|
109
|
-
onKey(event) {
|
|
110
|
-
const items = this.items ?? [];
|
|
111
|
-
const at = items.findIndex((i) => i.id === this.current());
|
|
112
|
-
const to = { ArrowRight: at + 1, ArrowLeft: at - 1, Home: 0, End: items.length - 1 }[event.key];
|
|
113
|
-
if (to === void 0 || !items.length) return;
|
|
114
|
-
event.preventDefault();
|
|
115
|
-
this.choose(items[(to + items.length) % items.length].id, true);
|
|
116
|
-
}
|
|
117
|
-
render() {
|
|
118
|
-
const items = this.items ?? [];
|
|
119
|
-
const current = this.current();
|
|
120
|
-
return html`<div role="tablist" aria-label=${this.label || nothing} part="tabs" @keydown=${this.onKey}>
|
|
121
|
-
${items.map((item) => html`<button role="tab" type="button" id=${this.id_(`tab-${item.id}`)} aria-selected=${item.id === current ? "true" : "false"} aria-controls=${this.id_(`panel-${item.id}`)} tabindex=${item.id === current ? "0" : "-1"} @click=${() => this.choose(item.id, false)}>${item.label}</button>`)}
|
|
122
|
-
</div>
|
|
123
|
-
${items.map((item) => html`<div role="tabpanel" id=${this.id_(`panel-${item.id}`)} aria-labelledby=${this.id_(`tab-${item.id}`)} tabindex="0" ?hidden=${item.id !== current} part="panel">${item.body}</div>`)}`;
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
var ImpktCardGrid = class extends ImpktElement {
|
|
127
|
-
static {
|
|
128
|
-
this.properties = {
|
|
129
|
-
items: { type: Array },
|
|
130
|
-
columns: { type: String, reflect: true },
|
|
131
|
-
headingLevel: { type: Number, attribute: "heading-level" },
|
|
132
|
-
ratio: { type: String, reflect: true },
|
|
133
|
-
spaceAbove: { type: String, reflect: true, attribute: "space-above" },
|
|
134
|
-
spaceBelow: { type: String, reflect: true, attribute: "space-below" }
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
constructor() {
|
|
138
|
-
super();
|
|
139
|
-
this.items = [];
|
|
140
|
-
this.columns = "three";
|
|
141
|
-
this.headingLevel = 3;
|
|
142
|
-
this.ratio = "4:3";
|
|
143
|
-
this.spaceAbove = "none";
|
|
144
|
-
this.spaceBelow = "none";
|
|
145
|
-
}
|
|
146
|
-
static {
|
|
147
|
-
this.styles = [...ImpktElement.styles, focusRing, spaceAround, css`
|
|
148
|
-
:host { display: block; container-type: inline-size; --ratio: 4 / 3; }
|
|
149
|
-
:host([ratio='16:9']) { --ratio: 16 / 9; }
|
|
150
|
-
:host([ratio='3:2']) { --ratio: 3 / 2; }
|
|
151
|
-
:host([ratio='1:1']) { --ratio: 1 / 1; }
|
|
152
|
-
ul { list-style: none; margin: 0; padding: 0; display: grid; gap: ${space(6)}; grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
153
|
-
:host([columns='two']) ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
154
|
-
:host([columns='four']) ul { grid-template-columns: repeat(4, minmax(0, 1fr)); }
|
|
155
|
-
li { position: relative; display: flex; flex-direction: column; background: ${t.surfaceCard}; border: ${t.borderThin} solid ${t.hairline}; border-radius: ${t.radiusXl}; box-shadow: ${t.shadowSm}; overflow: hidden; transition: box-shadow 150ms ease-in-out, transform 150ms ease-in-out; }
|
|
156
|
-
li.linked:hover { box-shadow: ${t.shadowLg}; transform: translateY(-2px); }
|
|
157
|
-
img { display: block; inline-size: 100%; aspect-ratio: var(--ratio); object-fit: cover; }
|
|
158
|
-
.words { display: flex; flex-direction: column; gap: ${space(2)}; padding: ${space(5)}; flex: 1; }
|
|
159
|
-
.h { margin: 0; color: ${t.textHeading}; font-family: ${t.fontHeading}; font-size: ${fontSize("lg")}; font-weight: ${fontWeight("bold")}; line-height: ${lineHeight("tight")}; }
|
|
160
|
-
.h a { color: inherit; text-decoration: none; border-radius: ${t.radiusSm}; }
|
|
161
|
-
.h a::after { content: ''; position: absolute; inset: 0; }
|
|
162
|
-
li.linked:hover .h a { text-decoration: underline; text-underline-offset: 0.2em; }
|
|
163
|
-
.body { margin: 0; line-height: ${lineHeight("normal")}; }
|
|
164
|
-
.badge { align-self: flex-start; padding: ${space(0.5)} ${space(2)}; border-radius: ${t.radius}; font-size: ${fontSize("xs")}; font-weight: ${fontWeight("medium")}; background: ${t.brandSubtle}; color: ${t.brand}; box-shadow: inset 0 0 0 1px ${t.hairline}; }
|
|
165
|
-
.more { margin-block-start: auto; display: inline-flex; align-items: center; gap: ${space(1)}; color: ${t.link}; font-weight: ${fontWeight("semibold")}; }
|
|
166
|
-
@container (max-width: 48rem) { ul, :host([columns='four']) ul { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
|
|
167
|
-
@container (max-width: 32rem) { ul, :host([columns='two']) ul, :host([columns='four']) ul { grid-template-columns: minmax(0, 1fr); } }
|
|
168
|
-
`];
|
|
169
|
-
}
|
|
170
|
-
render() {
|
|
171
|
-
return html`<ul part="list">${(this.items ?? []).map((card) => html`<li class=${card.href ? "linked" : ""} part="card">
|
|
172
|
-
${card.imageSrc ? html`<img src=${card.imageSrc} alt=${card.imageAlt ?? ""} loading="lazy" />` : nothing}
|
|
173
|
-
<div class="words">
|
|
174
|
-
${card.badge ? html`<span class="badge">${card.badge}</span>` : nothing}
|
|
175
|
-
<div class="h" role="heading" aria-level=${this.headingLevel}>${card.href ? html`<a href=${card.href}>${card.heading}</a>` : card.heading}</div>
|
|
176
|
-
${card.text ? html`<p class="body">${card.text}</p>` : nothing}
|
|
177
|
-
${card.href ? html`<span class="more" aria-hidden="true">${iconSvg("arrow-right", "1em")}</span>` : nothing}
|
|
178
|
-
</div>
|
|
179
|
-
</li>`)}</ul>`;
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
customElements.define("impkt-divider", ImpktDivider);
|
|
183
|
-
customElements.define("impkt-spacer", ImpktSpacer);
|
|
184
|
-
customElements.define("impkt-visually-hidden", ImpktVisuallyHidden);
|
|
185
|
-
customElements.define("impkt-tabs", ImpktTabs);
|
|
186
|
-
customElements.define("impkt-card-grid", ImpktCardGrid);
|
|
187
|
-
|
|
188
|
-
export {
|
|
189
|
-
ImpktDivider,
|
|
190
|
-
ImpktSpacer,
|
|
191
|
-
ImpktVisuallyHidden,
|
|
192
|
-
ImpktTabs,
|
|
193
|
-
ImpktCardGrid
|
|
194
|
-
};
|
|
195
|
-
//# sourceMappingURL=chunk-MVEFM5QI.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/blocks.ts"],"sourcesContent":["import { css, html, nothing, type TemplateResult } from 'lit';\nimport { ImpktElement } from '../base/ImpktElement';\nimport { focusRing, targetSize, visuallyHidden } from '../base/styles';\nimport { fontSize, fontWeight, lineHeight, space, spaceAround, t } from '../base/tokens';\nimport { iconSvg } from './icon';\n\n/**\n * A line between two parts of a page.\n *\n * It is decoration, so a screen reader passes over it. Where the change of\n * subject matters, a heading says so better.\n *\n * @category layout\n * @icon divider\n */\nexport class ImpktDivider extends ImpktElement {\n static properties = {\n spacing: { type: String, reflect: true },\n tone: { type: String, reflect: true },\n };\n /** Space above and below the line. */\n declare spacing: 'sm' | 'md' | 'lg' | 'xl';\n declare tone: 'subtle' | 'strong';\n\n constructor() {\n super();\n this.spacing = 'md';\n this.tone = 'subtle';\n }\n\n static styles = [...ImpktElement.styles, css`\n :host { display: block; }\n hr { margin: ${space(4)} 0; border: 0; border-block-start: ${t.borderThin} solid ${t.border}; opacity: 0.5; }\n :host([tone='strong']) hr { opacity: 1; border-block-start-width: ${t.borderThick}; }\n :host([spacing='sm']) hr { margin-block: ${space(2)}; }\n :host([spacing='lg']) hr { margin-block: ${space(8)}; }\n :host([spacing='xl']) hr { margin-block: ${space(12)}; }\n `];\n\n render(): TemplateResult {\n return html`<hr aria-hidden=\"true\" part=\"line\" />`;\n }\n}\n\n/**\n * Empty space, from the spacing scale, for the rare place where the gaps of the\n * containers around it are not enough.\n *\n * @category layout\n * @icon spacer\n */\nexport class ImpktSpacer extends ImpktElement {\n static properties = { size: { type: String, reflect: true } };\n declare size: 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n constructor() {\n super();\n this.size = 'md';\n }\n\n static styles = [...ImpktElement.styles, css`\n :host { display: block; block-size: ${space(4)}; }\n :host([size='sm']) { block-size: ${space(2)}; }\n :host([size='lg']) { block-size: ${space(8)}; }\n :host([size='xl']) { block-size: ${space(12)}; }\n :host([size='2xl']) { block-size: ${space(16)}; }\n `];\n\n render(): TemplateResult {\n return html``;\n }\n}\n\n/**\n * Words a screen reader says that are not shown: \"(opens a map)\" after a link\n * whose purpose is clear on screen from where it sits.\n *\n * @category typography\n * @icon hidden\n * @slot - The words to say.\n */\nexport class ImpktVisuallyHidden extends ImpktElement {\n static styles = [...ImpktElement.styles, css`:host { ${visuallyHidden} }`];\n render(): TemplateResult {\n return html`<slot></slot>`;\n }\n}\n\n/** One tab and what it shows. */\nexport interface TabItem {\n id: string;\n label: string;\n body: string;\n}\n\n/**\n * Panels of content behind a row of tabs, one shown at a time: the floor plans\n * of three house types, or what is included and what costs extra.\n *\n * It follows the ARIA tabs pattern. The tabs are one stop in the tab order,\n * the arrow keys, Home and End move between them, and each panel is labelled\n * by its tab. Use an accordion instead when someone may want to compare panels.\n *\n * @category content\n * @icon tabs\n * @fires impkt-change - When another tab is chosen.\n */\nexport class ImpktTabs extends ImpktElement {\n static properties = {\n items: { type: Array },\n selected: { type: String, reflect: true },\n label: { type: String },\n };\n declare items: TabItem[];\n /** The id of the tab shown first. The first tab when it is empty. */\n declare selected: string;\n /** What the set of tabs is about, for a screen reader. */\n declare label: string;\n\n constructor() {\n super();\n this.items = [];\n this.selected = '';\n this.label = '';\n }\n\n static styles = [...ImpktElement.styles, focusRing, css`\n :host { display: block; }\n [role='tablist'] { display: flex; flex-wrap: wrap; gap: ${space(1)}; border-block-end: ${t.borderThin} solid ${t.border}; }\n [role='tab'] { ${targetSize} padding: ${space(3)} ${space(4)}; font: inherit; font-weight: ${fontWeight('semibold')}; color: ${t.textMuted}; background: transparent; border: 0; border-block-end: 3px solid transparent; margin-block-end: -1px; cursor: pointer; border-radius: ${t.radius} ${t.radius} 0 0; }\n [role='tab']:hover { color: ${t.text}; background: ${t.surfaceInset}; }\n [role='tab'][aria-selected='true'] { color: ${t.link}; border-block-end-color: currentColor; }\n [role='tabpanel'] { padding-block: ${space(5)}; line-height: ${lineHeight('normal')}; white-space: pre-line; }\n @media (forced-colors: active) { [role='tab'][aria-selected='true'] { border-block-end-color: Highlight; } }\n `];\n\n private current(): string {\n const items = this.items ?? [];\n return items.some((i) => i.id === this.selected) ? this.selected : items[0]?.id ?? '';\n }\n\n private choose(id: string, focus: boolean): void {\n if (id === this.current()) return;\n this.selected = id;\n this.dispatchEvent(new CustomEvent('impkt-change', { detail: { value: id }, bubbles: true, composed: true }));\n if (focus) void this.updateComplete.then(() => this.renderRoot.querySelector<HTMLElement>(`#${this.id_(`tab-${id}`)}`)?.focus());\n }\n\n private onKey(event: KeyboardEvent): void {\n const items = this.items ?? [];\n const at = items.findIndex((i) => i.id === this.current());\n const to = { ArrowRight: at + 1, ArrowLeft: at - 1, Home: 0, End: items.length - 1 }[event.key];\n if (to === undefined || !items.length) return;\n event.preventDefault();\n this.choose(items[(to + items.length) % items.length]!.id, true);\n }\n\n render(): TemplateResult {\n const items = this.items ?? [];\n const current = this.current();\n return html`<div role=\"tablist\" aria-label=${this.label || nothing} part=\"tabs\" @keydown=${this.onKey}>\n ${items.map((item) => html`<button role=\"tab\" type=\"button\" id=${this.id_(`tab-${item.id}`)} aria-selected=${item.id === current ? 'true' : 'false'} aria-controls=${this.id_(`panel-${item.id}`)} tabindex=${item.id === current ? '0' : '-1'} @click=${() => this.choose(item.id, false)}>${item.label}</button>`)}\n </div>\n ${items.map((item) => html`<div role=\"tabpanel\" id=${this.id_(`panel-${item.id}`)} aria-labelledby=${this.id_(`tab-${item.id}`)} tabindex=\"0\" ?hidden=${item.id !== current} part=\"panel\">${item.body}</div>`)}`;\n }\n}\n\n/** One card in a row of them. */\nexport interface CardItem {\n id?: string;\n heading: string;\n text?: string;\n imageSrc?: string;\n imageAlt?: string;\n href?: string;\n badge?: string;\n}\n\n/**\n * A row of cards, each a picture, a heading, a line of text and a link: the\n * developments on a developments page, or the house types at one of them.\n *\n * **The whole card is the link's target, and the heading is its name.** The\n * link is on the heading, so a screen reader hears \"Larkfield Meadows, link\"\n * once rather than the whole card read out as one long link, and a pointer\n * can still press anywhere on the card.\n *\n * @category content\n * @icon cards\n */\nexport class ImpktCardGrid extends ImpktElement {\n static properties = {\n items: { type: Array },\n columns: { type: String, reflect: true },\n headingLevel: { type: Number, attribute: 'heading-level' },\n ratio: { type: String, reflect: true },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n declare items: CardItem[];\n declare columns: 'two' | 'three' | 'four';\n /** The level of each card's heading. One below the heading above the cards. */\n declare headingLevel: 2 | 3 | 4;\n /** The shape of each card's picture. */\n declare ratio: '16:9' | '4:3' | '3:2' | '1:1';\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n constructor() {\n super();\n this.items = [];\n this.columns = 'three';\n this.headingLevel = 3;\n this.ratio = '4:3';\n this.spaceAbove = 'none';\n this.spaceBelow = 'none';\n }\n\n static styles = [...ImpktElement.styles, focusRing, spaceAround, css`\n :host { display: block; container-type: inline-size; --ratio: 4 / 3; }\n :host([ratio='16:9']) { --ratio: 16 / 9; }\n :host([ratio='3:2']) { --ratio: 3 / 2; }\n :host([ratio='1:1']) { --ratio: 1 / 1; }\n ul { list-style: none; margin: 0; padding: 0; display: grid; gap: ${space(6)}; grid-template-columns: repeat(3, minmax(0, 1fr)); }\n :host([columns='two']) ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }\n :host([columns='four']) ul { grid-template-columns: repeat(4, minmax(0, 1fr)); }\n li { position: relative; display: flex; flex-direction: column; background: ${t.surfaceCard}; border: ${t.borderThin} solid ${t.hairline}; border-radius: ${t.radiusXl}; box-shadow: ${t.shadowSm}; overflow: hidden; transition: box-shadow 150ms ease-in-out, transform 150ms ease-in-out; }\n li.linked:hover { box-shadow: ${t.shadowLg}; transform: translateY(-2px); }\n img { display: block; inline-size: 100%; aspect-ratio: var(--ratio); object-fit: cover; }\n .words { display: flex; flex-direction: column; gap: ${space(2)}; padding: ${space(5)}; flex: 1; }\n .h { margin: 0; color: ${t.textHeading}; font-family: ${t.fontHeading}; font-size: ${fontSize('lg')}; font-weight: ${fontWeight('bold')}; line-height: ${lineHeight('tight')}; }\n .h a { color: inherit; text-decoration: none; border-radius: ${t.radiusSm}; }\n .h a::after { content: ''; position: absolute; inset: 0; }\n li.linked:hover .h a { text-decoration: underline; text-underline-offset: 0.2em; }\n .body { margin: 0; line-height: ${lineHeight('normal')}; }\n .badge { align-self: flex-start; padding: ${space(0.5)} ${space(2)}; border-radius: ${t.radius}; font-size: ${fontSize('xs')}; font-weight: ${fontWeight('medium')}; background: ${t.brandSubtle}; color: ${t.brand}; box-shadow: inset 0 0 0 1px ${t.hairline}; }\n .more { margin-block-start: auto; display: inline-flex; align-items: center; gap: ${space(1)}; color: ${t.link}; font-weight: ${fontWeight('semibold')}; }\n @container (max-width: 48rem) { ul, :host([columns='four']) ul { grid-template-columns: repeat(2, minmax(0, 1fr)); } }\n @container (max-width: 32rem) { ul, :host([columns='two']) ul, :host([columns='four']) ul { grid-template-columns: minmax(0, 1fr); } }\n `];\n\n render(): TemplateResult {\n return html`<ul part=\"list\">${(this.items ?? []).map((card) => html`<li class=${card.href ? 'linked' : ''} part=\"card\">\n ${card.imageSrc ? html`<img src=${card.imageSrc} alt=${card.imageAlt ?? ''} loading=\"lazy\" />` : nothing}\n <div class=\"words\">\n ${card.badge ? html`<span class=\"badge\">${card.badge}</span>` : nothing}\n <div class=\"h\" role=\"heading\" aria-level=${this.headingLevel}>${card.href ? html`<a href=${card.href}>${card.heading}</a>` : card.heading}</div>\n ${card.text ? html`<p class=\"body\">${card.text}</p>` : nothing}\n ${card.href ? html`<span class=\"more\" aria-hidden=\"true\">${iconSvg('arrow-right', '1em')}</span>` : nothing}\n </div>\n </li>`)}</ul>`;\n }\n}\n\ncustomElements.define('impkt-divider', ImpktDivider);\ncustomElements.define('impkt-spacer', ImpktSpacer);\ncustomElements.define('impkt-visually-hidden', ImpktVisuallyHidden);\ncustomElements.define('impkt-tabs', ImpktTabs);\ncustomElements.define('impkt-card-grid', ImpktCardGrid);\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impkt-divider': ImpktDivider; 'impkt-spacer': ImpktSpacer; 'impkt-visually-hidden': ImpktVisuallyHidden; 'impkt-tabs': ImpktTabs; 'impkt-card-grid': ImpktCardGrid;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAS,KAAK,MAAM,eAAoC;AAejD,IAAM,eAAN,cAA2B,aAAa;AAAA,EAC7C;AAAA,SAAO,aAAa;AAAA,MAClB,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACvC,MAAM,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,IACtC;AAAA;AAAA,EAKA,cAAc;AACZ,UAAM;AACN,SAAK,UAAU;AACf,SAAK,OAAO;AAAA,EACd;AAAA,EAEA;AAAA,SAAO,SAAS,CAAC,GAAG,aAAa,QAAQ;AAAA;AAAA,mBAExB,MAAM,CAAC,CAAC,sCAAsC,EAAE,UAAU,UAAU,EAAE,MAAM;AAAA,wEACvB,EAAE,WAAW;AAAA,+CACtC,MAAM,CAAC,CAAC;AAAA,+CACR,MAAM,CAAC,CAAC;AAAA,+CACR,MAAM,EAAE,CAAC;AAAA,GAC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AACnD,eAAe,OAAO,gBAAgB,WAAW;AACjD,eAAe,OAAO,yBAAyB,mBAAmB;AAClE,eAAe,OAAO,cAAc,SAAS;AAC7C,eAAe,OAAO,mBAAmB,aAAa;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/media.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpktElement } from '../base/ImpktElement';\nimport { t } from '../base/tokens';\n\n/**\n * An image.\n *\n * `alt` is required and may be the empty string, which is a decision rather\n * than laxity: an empty alt is the correct and only way to mark an image as\n * decorative, and a missing alt is a different thing entirely — it leaves a\n * screen reader to read the file name. Making the property required forces the\n * author to say which they meant.\n *\n * `width` and `height` are the intrinsic pixel size. Without them the browser\n * cannot reserve space and the page jumps as each image loads, which is a\n * usability problem for everyone and a serious one for anyone using a screen\n * magnifier, who loses their place entirely.\n\n *\n * @category media\n * @icon image\n * @role image\n */\nexport class ImpktImage extends ImpktElement {\n static properties = {\n src: { type: String },\n alt: { type: String },\n decorative: { type: Boolean, reflect: true },\n width: { type: Number },\n height: { type: Number },\n focalX: { type: Number, attribute: 'focal-x' },\n focalY: { type: Number, attribute: 'focal-y' },\n loading: { type: String },\n ratio: { type: String, reflect: true },\n rounded: { type: String, reflect: true },\n hideOn: { type: String, reflect: true, attribute: 'hide-on' },\n };\n\n /**\n * Leave it out on a phone, or on anything wider, for a picture drawn twice:\n * once for a wide screen and once for a narrow one. Never both.\n */\n declare hideOn: 'never' | 'phone' | 'wide';\n declare src: string;\n declare alt: string;\n /**\n * This image says nothing a reader needs.\n *\n * An empty `alt` is the correct way to mark a decorative image AND what a\n * missing one looks like, so the two are indistinguishable to anything\n * downstream — which is why the commonest accessibility failure on the web\n * survives every automated check. Only the author knows which they meant,\n * so this is where they say it, and the publish gate holds them to it.\n */\n declare decorative: boolean;\n declare width: number | undefined;\n declare height: number | undefined;\n /** The fraction of the image that must survive a crop. */\n declare focalX: number;\n declare focalY: number;\n declare loading: 'lazy' | 'eager';\n /** The picture's shape. It is cropped to fit, keeping the focal point in view. */\n declare ratio: 'natural' | '16:9' | '4:3' | '3:2' | '1:1';\n /** How round the corners are. */\n declare rounded: 'none' | 'sm' | 'lg' | 'full';\n\n constructor() {\n super();\n this.hideOn = 'never';\n this.ratio = 'natural';\n this.rounded = 'none';\n this.src = '';\n this.alt = '';\n this.decorative = false;\n this.width = undefined;\n this.height = undefined;\n this.focalX = 0.5;\n this.focalY = 0.5;\n this.loading = 'lazy';\n }\n\n static styles = [\n ...ImpktElement.styles,\n css`\n @media (max-width: 40rem) { :host([hide-on='phone']) { display: none; } }\n @media (min-width: 40.0625rem) { :host([hide-on='wide']) { display: none; } }\n :host {\n display: block;\n }\n img {\n display: block;\n max-inline-size: 100%;\n block-size: auto;\n object-fit: cover;\n }\n :host(:not([ratio='natural'])) img { inline-size: 100%; }\n :host([ratio='16:9']) img { aspect-ratio: 16 / 9; }\n :host([ratio='4:3']) img { aspect-ratio: 4 / 3; }\n :host([ratio='3:2']) img { aspect-ratio: 3 / 2; }\n :host([ratio='1:1']) img { aspect-ratio: 1 / 1; }\n :host([rounded='sm']) img { border-radius: ${t.radius}; }\n :host([rounded='lg']) img { border-radius: ${t.radiusLg}; }\n :host([rounded='full']) img { border-radius: 50%; }\n `,\n ];\n\n render(): TemplateResult {\n return html`\n <img\n part=\"image\"\n src=${this.src}\n alt=${this.decorative ? '' : this.alt}\n role=${this.decorative ? 'presentation' : nothing}\n width=${this.width ?? nothing}\n height=${this.height ?? nothing}\n loading=${this.loading}\n style=\"object-position: ${this.focalX * 100}% ${this.focalY * 100}%\"\n />\n `;\n }\n}\n\n/**\n * The partner's logo.\n *\n * Separate from `impkt-image` for one reason: it is the most prominent image on\n * every page and its alt text is the brand name, so it should not be possible\n * to ship it with an empty alt by copying a decorative image. `src` and `alt`\n * come from the brand's assets.\n *\n * `on-dark` picks the dark-surface variant where the brand supplies one. A\n * logo that disappears into a dark footer is not a styling problem, it is a\n * missing piece of information.\n\n *\n * @category media\n * @icon logo\n */\nexport class ImpktLogo extends ImpktElement {\n static properties = {\n src: { type: String },\n srcDark: { type: String, attribute: 'src-dark' },\n alt: { type: String },\n onDark: { type: Boolean, attribute: 'on-dark', reflect: true },\n height: { type: Number },\n };\n\n declare src: string;\n declare srcDark: string;\n declare alt: string;\n declare onDark: boolean;\n declare height: number;\n\n constructor() {\n super();\n this.src = '';\n this.srcDark = '';\n this.alt = '';\n this.onDark = false;\n this.height = 32;\n }\n\n static styles = [\n ...ImpktElement.styles,\n css`\n :host {\n display: inline-block;\n }\n img {\n display: block;\n inline-size: auto;\n }\n `,\n ];\n\n render(): TemplateResult {\n const src = this.onDark && this.srcDark ? this.srcDark : this.src;\n return html`<img part=\"logo\" src=${src} alt=${this.alt} style=\"height: ${this.height}px\" />`;\n }\n}\n\n/**\n * A downloadable document — terms of service, a product sheet, a price list.\n *\n * The file type and size are part of the accessible name, not decoration\n * beside it. A list of links all named \"Download\" fails 2.4.4 Link Purpose,\n * and a reader tabbing between them cannot tell which document they are on.\n\n *\n * @category media\n * @icon document\n */\nexport class ImpktDocumentLink extends ImpktElement {\n static properties = {\n href: { type: String },\n label: { type: String },\n fileType: { type: String, attribute: 'file-type' },\n byteSize: { type: Number, attribute: 'byte-size' },\n };\n\n declare href: string;\n declare label: string;\n declare fileType: string;\n declare byteSize: number | undefined;\n\n constructor() {\n super();\n this.href = '';\n this.label = '';\n this.fileType = '';\n this.byteSize = undefined;\n }\n\n static styles = [\n ...ImpktElement.styles,\n css`\n :host {\n display: block;\n }\n a {\n color: ${t.link};\n text-decoration: underline;\n text-underline-offset: 0.2em;\n display: inline-flex;\n gap: 0.5ch;\n align-items: baseline;\n min-block-size: ${t.targetMin};\n }\n .meta {\n color: ${t.textMuted};\n }\n `,\n ];\n\n /** \"240 KB\". Rounded, because the exact byte count helps nobody. */\n private get size(): string {\n if (!this.byteSize) return '';\n const kb = this.byteSize / 1024;\n return kb >= 1024 ? `${(kb / 1024).toFixed(1)} MB` : `${Math.round(kb)} KB`;\n }\n\n render(): TemplateResult {\n const meta = [this.fileType, this.size].filter(Boolean).join(', ');\n return html`\n <a part=\"link\" href=${this.href || nothing} download>\n <span>${this.label}</span>${meta ? html`<span class=\"meta\">(${meta})</span>` : nothing}\n </a>\n `;\n }\n}\n\ncustomElements.define('impkt-image', ImpktImage);\ncustomElements.define('impkt-logo', ImpktLogo);\ncustomElements.define('impkt-document-link', ImpktDocumentLink);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impkt-image': ImpktImage;\n 'impkt-logo': ImpktLogo;\n 'impkt-document-link': ImpktDocumentLink;\n }\n}\n"],"mappings":";;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AAuBjD,IAAM,aAAN,cAAyB,aAAa;AAAA,EAC3C;AAAA,SAAO,aAAa;AAAA,MAClB,KAAK,EAAE,MAAM,OAAO;AAAA,MACpB,KAAK,EAAE,MAAM,OAAO;AAAA,MACpB,YAAY,EAAE,MAAM,SAAS,SAAS,KAAK;AAAA,MAC3C,OAAO,EAAE,MAAM,OAAO;AAAA,MACtB,QAAQ,EAAE,MAAM,OAAO;AAAA,MACvB,QAAQ,EAAE,MAAM,QAAQ,WAAW,UAAU;AAAA,MAC7C,QAAQ,EAAE,MAAM,QAAQ,WAAW,UAAU;AAAA,MAC7C,SAAS,EAAE,MAAM,OAAO;AAAA,MACxB,OAAO,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACrC,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACvC,QAAQ,EAAE,MAAM,QAAQ,SAAS,MAAM,WAAW,UAAU;AAAA,IAC9D;AAAA;AAAA,EA8BA,cAAc;AACZ,UAAM;AACN,SAAK,SAAS;AACd,SAAK,QAAQ;AACb,SAAK,UAAU;AACf,SAAK,MAAM;AACX,SAAK,MAAM;AACX,SAAK,aAAa;AAClB,SAAK,QAAQ;AACb,SAAK,SAAS;AACd,SAAK,SAAS;AACd,SAAK,SAAS;AACd,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B;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/date-input.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { say } from '../base/say';\nimport { FieldElement } from '../base/FieldElement';\nimport { fontSize, space, t } from '../base/tokens';\n\n/**\n * A date, as three fields.\n *\n * **Why not `<input type=\"date\">`.** The native control is excellent for\n * picking a date near today — an appointment, a start date — and poor for a\n * date of birth, which is the date this product asks for most. Its picker\n * opens on the current month and makes a user born in 1958 navigate eight\n * hundred steps back, its text entry expects a locale-specific format the\n * field does not state, and its rendering differs enough between browsers that\n * no single hint is correct everywhere.\n *\n * Three fields is the pattern government services converged on after testing\n * it on exactly this problem. Each part is typed directly, in any order, with\n * no picker to fight.\n *\n * **The accessibility shape.** A `<fieldset>` and `<legend>` ask the question\n * once; each part has its own visible label, so \"Month\" is announced rather\n * than \"second field\"; `inputmode=\"numeric\"` brings up a number pad without\n * `type=\"number\"`, which on a date part gives spinners, scroll-wheel surprises\n * and silent stripping of a leading zero. The parts carry `autocomplete`\n * tokens so autofill still works, which is 1.3.5.\n\n *\n * @category form\n * @icon calendar\n */\nexport class ImpktDateInput extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n day: { type: String },\n month: { type: String },\n year: { type: String },\n autocompleteSection: { type: String, attribute: 'autocomplete-section' },\n };\n\n declare day: string;\n declare month: string;\n declare year: string;\n /** \"bday\" fills a date of birth. Empty disables autofill for this field. */\n declare autocompleteSection: string;\n\n constructor() {\n super();\n this.day = '';\n this.month = '';\n this.year = '';\n this.autocompleteSection = 'bday';\n }\n\n static styles = [\n ...FieldElement.styles,\n css`\n fieldset {\n border: 0;\n margin: 0;\n padding: 0;\n min-inline-size: 0;\n }\n legend {\n padding: 0;\n }\n .parts {\n display: flex;\n gap: ${space(3)};\n }\n .part {\n display: flex;\n flex-direction: column;\n gap: ${space(1)};\n }\n .part label {\n font-size: ${fontSize('sm')};\n color: ${t.textMuted};\n }\n input {\n min-block-size: 44px;\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 inline-size: 4ch;\n }\n .year input {\n inline-size: 6ch;\n }\n :host([invalid]) input {\n border-color: ${t.danger};\n border-width: ${t.borderThick};\n }\n `,\n ];\n\n protected renderLabel(): TemplateResult {\n return html`<legend class=\"label\" part=\"label\">\n ${this.label}${this.required ? html`<span class=\"required\"> (${this.requiredText})</span>` : nothing}\n </legend>`;\n }\n\n private datePart(\n name: 'day' | 'month' | 'year',\n label: string,\n length: number,\n autocomplete: string,\n ): TemplateResult {\n const id = this.id_(name);\n return html`\n <div class=\"part ${name}\">\n <label for=${id}>${label}</label>\n <input\n id=${id}\n type=\"text\"\n inputmode=\"numeric\"\n maxlength=${length}\n .value=${this[name]}\n autocomplete=${this.autocompleteSection ? `${this.autocompleteSection}-${autocomplete}` : nothing}\n ?disabled=${this.disabled}\n @input=${(e: Event) => {\n this[name] = (e.target as HTMLInputElement).value;\n this.emit();\n }}\n />\n </div>\n `;\n }\n\n /** ISO, or empty while incomplete. Partial dates are not half-valid. */\n private emit(): void {\n const complete = this.day && this.month && this.year.length === 4;\n const iso = complete\n ? `${this.year}-${this.month.padStart(2, '0')}-${this.day.padStart(2, '0')}`\n : '';\n this.setFormValue(iso);\n }\n\n protected renderControl(): TemplateResult {\n return html`\n <div class=\"parts\" part=\"parts\">\n ${this.datePart('day', say('Day'), 2, 'day')}\n ${this.datePart('month', say('Month'), 2, 'month')}\n ${this.datePart('year', say('Year'), 4, 'year')}\n </div>\n `;\n }\n\n render(): TemplateResult {\n return html`\n <fieldset part=\"fieldset\" aria-describedby=${this.describedBy} aria-invalid=${this.error ? 'true' : nothing}>\n ${this.renderLabel()}\n ${this.description\n ? html`<div class=\"description\" id=${this.id_('description')} part=\"description\">${this.description}</div>`\n : nothing}\n ${this.renderControl()}\n <div class=\"error\" id=${this.id_('error')} part=\"error\" aria-live=\"polite\">${this.error || nothing}</div>\n </fieldset>\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-date-input', ImpktDateInput);\n\ndeclare global {\n interface HTMLElementTagNameMap { 'impkt-date-input': ImpktDateInput }\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AA+BjD,IAAM,iBAAN,cAA6B,aAAa;AAAA,EAC/C;AAAA,SAAO,aAAa;AAAA,MAClB,GAAG,aAAa;AAAA,MAChB,KAAK,EAAE,MAAM,OAAO;AAAA,MACpB,OAAO,EAAE,MAAM,OAAO;AAAA,MACtB,MAAM,EAAE,MAAM,OAAO;AAAA,MACrB,qBAAqB,EAAE,MAAM,QAAQ,WAAW,uBAAuB;AAAA,IACzE;AAAA;AAAA,EAQA,cAAc;AACZ,UAAM;AACN,SAAK,MAAM;AACX,SAAK,QAAQ;AACb,SAAK,OAAO;AACZ,SAAK,sBAAsB;AAAA,EAC7B;AAAA,EAEA;AAAA,SAAO,SAAS;AAAA,MACd,GAAG,aAAa;AAAA,MAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAYW,MAAM,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,eAKR,MAAM,CAAC,CAAC;AAAA;AAAA;AAAA,qBAGF,SAAS,IAAI,CAAC;AAAA,iBAClB,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA,mBAIT,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;AAAA,wBAOT,EAAE,MAAM;AAAA,wBACR,EAA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