@atomic-ui/ui 0.1.5 → 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.
- package/README.md +13 -1
- package/dist/base/tokens.d.ts +23 -1
- package/dist/{chunk-CFGLOYWW.js → chunk-2YQA3VBY.js} +2 -2
- package/dist/{chunk-DR3SJ7ZV.js → chunk-4HU4Y23Q.js} +3 -3
- package/dist/{chunk-QH46SOPJ.js → chunk-5EA4IDUD.js} +54 -11
- package/dist/chunk-5EA4IDUD.js.map +1 -0
- package/dist/{chunk-3OSL2HMN.js → chunk-6ICOJPMD.js} +7 -5
- package/dist/chunk-6ICOJPMD.js.map +1 -0
- package/dist/{chunk-DI2CJ3MZ.js → chunk-7BIQ3K6H.js} +2 -2
- package/dist/{chunk-AXQ5YBN2.js → chunk-7Y6UCSUS.js} +135 -10
- package/dist/chunk-7Y6UCSUS.js.map +1 -0
- package/dist/{chunk-G6UVYMA6.js → chunk-BTGCUONV.js} +2 -2
- package/dist/{chunk-4JKUAA6K.js → chunk-C36CZRHK.js} +14 -5
- package/dist/chunk-C36CZRHK.js.map +1 -0
- package/dist/{chunk-ZDYTNFQI.js → chunk-CMAU4DSB.js} +15 -5
- package/dist/chunk-CMAU4DSB.js.map +1 -0
- package/dist/{chunk-HWNY6U5F.js → chunk-G6OVKNL7.js} +2 -2
- package/dist/{chunk-6UDDZQDK.js → chunk-GO2IBRFP.js} +3 -3
- package/dist/chunk-GO2IBRFP.js.map +1 -0
- package/dist/{chunk-KWURASAB.js → chunk-GSCVG2ER.js} +3 -3
- package/dist/{chunk-IBTOZOGI.js → chunk-HWWA27DN.js} +2 -2
- package/dist/{chunk-U2S7OESF.js → chunk-MLVUMCQ2.js} +45 -13
- package/dist/chunk-MLVUMCQ2.js.map +1 -0
- package/dist/{chunk-4AJPS5AU.js → chunk-MOEMFL4K.js} +15 -5
- package/dist/chunk-MOEMFL4K.js.map +1 -0
- package/dist/{chunk-5RVMMKMO.js → chunk-NQKYHILD.js} +3 -3
- package/dist/{chunk-5NUF7ZQA.js → chunk-NTNXHLTM.js} +24 -3
- package/dist/chunk-NTNXHLTM.js.map +1 -0
- package/dist/{chunk-OFAVRPRK.js → chunk-OB7LC6NJ.js} +2 -2
- package/dist/chunk-OB7LC6NJ.js.map +1 -0
- package/dist/chunk-QCNT7D5V.js +549 -0
- package/dist/chunk-QCNT7D5V.js.map +1 -0
- package/dist/{chunk-H6L3FSQY.js → chunk-QDNI54ON.js} +3 -3
- package/dist/{chunk-QELX47AP.js → chunk-T6L3USBZ.js} +31 -20
- package/dist/chunk-T6L3USBZ.js.map +1 -0
- package/dist/{chunk-TZD7IVVQ.js → chunk-TPF4MOMF.js} +8 -3
- package/dist/chunk-TPF4MOMF.js.map +1 -0
- package/dist/{chunk-S3EQO33M.js → chunk-VTFCTWSX.js} +6 -4
- package/dist/chunk-VTFCTWSX.js.map +1 -0
- package/dist/{chunk-2RBYVWZT.js → chunk-VWNBB7FW.js} +5 -3
- package/dist/chunk-VWNBB7FW.js.map +1 -0
- package/dist/{chunk-6GKI67P7.js → chunk-WECSVHIM.js} +2 -2
- package/dist/chunk-X7IPZPTG.js +710 -0
- package/dist/chunk-X7IPZPTG.js.map +1 -0
- package/dist/{chunk-57P4WO4Y.js → chunk-XJP45LFA.js} +28 -21
- package/dist/chunk-XJP45LFA.js.map +1 -0
- package/dist/{chunk-6MLXFFH4.js → chunk-XVKEM5JY.js} +3 -3
- package/dist/chunk-XVKEM5JY.js.map +1 -0
- package/dist/chunk-ZBLTU67D.js +424 -0
- package/dist/chunk-ZBLTU67D.js.map +1 -0
- package/dist/{chunk-JPEWRJSQ.js → chunk-ZGAOMRYD.js} +3 -3
- package/dist/{chunk-LLRJU7XE.js → chunk-ZQJD4YEJ.js} +6 -6
- package/dist/chunk-ZQJD4YEJ.js.map +1 -0
- package/dist/components/accordion.js +2 -2
- package/dist/components/alert.js +2 -2
- package/dist/components/app-ui.d.ts +421 -0
- package/dist/components/app-ui.js +26 -0
- package/dist/components/app-ui.js.map +1 -0
- package/dist/components/blocks.d.ts +2 -2
- package/dist/components/blocks.js +3 -3
- package/dist/components/button.d.ts +7 -0
- package/dist/components/button.js +3 -3
- package/dist/components/checkbox-group.js +3 -3
- package/dist/components/checkbox.js +3 -3
- package/dist/components/date-input.js +3 -3
- package/dist/components/dialog.js +2 -2
- package/dist/components/fieldset.js +2 -2
- package/dist/components/grid.d.ts +2 -2
- package/dist/components/grid.js +2 -2
- package/dist/components/help.js +2 -2
- package/dist/components/icon.js +2 -2
- package/dist/components/layout.d.ts +10 -5
- package/dist/components/layout.js +2 -2
- package/dist/components/link.js +3 -3
- package/dist/components/marketing.d.ts +119 -6
- package/dist/components/marketing.js +7 -3
- package/dist/components/media.js +2 -2
- package/dist/components/navigation.d.ts +9 -2
- package/dist/components/navigation.js +3 -3
- package/dist/components/organisms.d.ts +547 -0
- package/dist/components/organisms.js +25 -0
- package/dist/components/organisms.js.map +1 -0
- package/dist/components/page.d.ts +14 -3
- package/dist/components/page.js +2 -2
- package/dist/components/price.d.ts +5 -0
- package/dist/components/price.js +2 -2
- package/dist/components/progress.js +2 -2
- package/dist/components/property.d.ts +389 -0
- package/dist/components/property.js +19 -0
- package/dist/components/property.js.map +1 -0
- package/dist/components/radio-group.js +3 -3
- package/dist/components/select.js +3 -3
- package/dist/components/summary-list.js +2 -2
- package/dist/components/table.js +2 -2
- package/dist/components/text-input.js +3 -3
- package/dist/components/textarea.js +3 -3
- package/dist/index.d.ts +4 -1
- package/dist/index.js +94 -40
- package/package.json +2 -2
- package/dist/chunk-2RBYVWZT.js.map +0 -1
- package/dist/chunk-3OSL2HMN.js.map +0 -1
- package/dist/chunk-4AJPS5AU.js.map +0 -1
- package/dist/chunk-4JKUAA6K.js.map +0 -1
- package/dist/chunk-57P4WO4Y.js.map +0 -1
- package/dist/chunk-5NUF7ZQA.js.map +0 -1
- package/dist/chunk-6MLXFFH4.js.map +0 -1
- package/dist/chunk-6UDDZQDK.js.map +0 -1
- package/dist/chunk-AXQ5YBN2.js.map +0 -1
- package/dist/chunk-LLRJU7XE.js.map +0 -1
- package/dist/chunk-OFAVRPRK.js.map +0 -1
- package/dist/chunk-QELX47AP.js.map +0 -1
- package/dist/chunk-QH46SOPJ.js.map +0 -1
- package/dist/chunk-S3EQO33M.js.map +0 -1
- package/dist/chunk-TZD7IVVQ.js.map +0 -1
- package/dist/chunk-U2S7OESF.js.map +0 -1
- package/dist/chunk-ZDYTNFQI.js.map +0 -1
- /package/dist/{chunk-CFGLOYWW.js.map → chunk-2YQA3VBY.js.map} +0 -0
- /package/dist/{chunk-DR3SJ7ZV.js.map → chunk-4HU4Y23Q.js.map} +0 -0
- /package/dist/{chunk-DI2CJ3MZ.js.map → chunk-7BIQ3K6H.js.map} +0 -0
- /package/dist/{chunk-G6UVYMA6.js.map → chunk-BTGCUONV.js.map} +0 -0
- /package/dist/{chunk-HWNY6U5F.js.map → chunk-G6OVKNL7.js.map} +0 -0
- /package/dist/{chunk-KWURASAB.js.map → chunk-GSCVG2ER.js.map} +0 -0
- /package/dist/{chunk-IBTOZOGI.js.map → chunk-HWWA27DN.js.map} +0 -0
- /package/dist/{chunk-5RVMMKMO.js.map → chunk-NQKYHILD.js.map} +0 -0
- /package/dist/{chunk-H6L3FSQY.js.map → chunk-QDNI54ON.js.map} +0 -0
- /package/dist/{chunk-6GKI67P7.js.map → chunk-WECSVHIM.js.map} +0 -0
- /package/dist/{chunk-JPEWRJSQ.js.map → chunk-ZGAOMRYD.js.map} +0 -0
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ In React, from `@atomic-ui/ui-react`:
|
|
|
24
24
|
|
|
25
25
|
## What is here
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
Sixty-four elements.
|
|
28
28
|
|
|
29
29
|
| Group | Elements |
|
|
30
30
|
| --- | --- |
|
|
@@ -32,6 +32,9 @@ Forty-one elements.
|
|
|
32
32
|
| Layout and type | `impkt-grid`, `impkt-stack`, `impkt-card`, `impkt-heading`, `impkt-text`, `impkt-divider`, `impkt-spacer`, `impkt-visually-hidden` |
|
|
33
33
|
| Navigation and actions | `impkt-nav`, `impkt-breadcrumbs`, `impkt-button`, `impkt-link` |
|
|
34
34
|
| Marketing blocks | `impkt-hero`, `impkt-feature-list`, `impkt-card-grid`, `impkt-quote`, `impkt-stat`, `impkt-badge` |
|
|
35
|
+
| Organisms | `impkt-carousel`, `impkt-gallery`, `impkt-logo-cloud`, `impkt-steps`, `impkt-media-split`, `impkt-cta-banner`, `impkt-reviews`, `impkt-newsletter` |
|
|
36
|
+
| App | `impkt-drawer`, `impkt-toast`, `impkt-menu`, `impkt-pagination`, `impkt-avatar`, `impkt-avatar-group`, `impkt-empty-state`, `impkt-slot-picker` |
|
|
37
|
+
| Property | `impkt-site-plan`, `impkt-mortgage-calculator`, `impkt-before-after`, `impkt-sticky-bar`, `impkt-location-card` |
|
|
35
38
|
| Form controls | `impkt-text-input`, `impkt-textarea`, `impkt-select`, `impkt-checkbox`, `impkt-checkbox-group`, `impkt-radio-group`, `impkt-date-input`, `impkt-fieldset` |
|
|
36
39
|
| Feedback | `impkt-alert`, `impkt-dialog` |
|
|
37
40
|
| Content | `impkt-summary-list`, `impkt-table`, `impkt-accordion`, `impkt-tabs`, `impkt-progress`, `impkt-price` |
|
|
@@ -43,6 +46,15 @@ Forty-one elements.
|
|
|
43
46
|
Without it a page runs edge to edge. `impkt-section` is a band across the whole width
|
|
44
47
|
of the screen with the content kept to the page width inside it.
|
|
45
48
|
|
|
49
|
+
**Everything sits on one set of scales,** derived from the brand:
|
|
50
|
+
|
|
51
|
+
- **Space** in quarter steps of the brand's base unit: `space(1)` is 4px, `space(4)` 16px, `space(12)` 48px, with half steps at the small end. Every gap, padding and margin is one of them, so things line up.
|
|
52
|
+
- **Type** from `xs` (12px) to `6xl` (60px) against a 16px base, each size with its own line height (`type('xl')` sets both). Display sizes are drawn slightly tighter and move with the brand's ratio.
|
|
53
|
+
- **Radii** from `xs` to `3xl` in steps of the brand's base, and **shadows** from `xs` to `xl`, tinted with the text colour.
|
|
54
|
+
- **Hairlines** (`t.hairline`, `t.rule`) are the text colour at 10% and 15%, for card rings and quiet borders. Form controls keep the contrast-checked border, because their edges must be visible (1.4.11).
|
|
55
|
+
|
|
56
|
+
Controls share sizes: a button and a field are both 40px tall at the default size, 32px small and 48px large.
|
|
57
|
+
|
|
46
58
|
**Icons come from one set**, `ICONS`, drawn on a 24 by 24 grid in the current text
|
|
47
59
|
colour, so every icon matches the line weight of the ones beside it. An icon is
|
|
48
60
|
decorative unless it is given a `label`.
|
package/dist/base/tokens.d.ts
CHANGED
|
@@ -59,8 +59,30 @@ export declare const t: {
|
|
|
59
59
|
readonly radiusLg: CSSResult;
|
|
60
60
|
readonly borderThin: CSSResult;
|
|
61
61
|
readonly borderThick: CSSResult;
|
|
62
|
+
readonly radiusXs: CSSResult;
|
|
63
|
+
readonly radiusXl: CSSResult;
|
|
64
|
+
readonly radius2xl: CSSResult;
|
|
65
|
+
/** Hairline borders and rings, from the text colour, so they suit any surface. */
|
|
66
|
+
readonly hairline: CSSResult;
|
|
67
|
+
readonly rule: CSSResult;
|
|
68
|
+
/** A wash of the text colour, for hover and pressed states on quiet controls. */
|
|
69
|
+
readonly wash: CSSResult;
|
|
70
|
+
/** The brand at a fifth, for focus halos round fields. */
|
|
71
|
+
readonly brandHalo: CSSResult;
|
|
72
|
+
readonly shadowXs: CSSResult;
|
|
73
|
+
readonly shadowSm: CSSResult;
|
|
74
|
+
readonly shadowMd: CSSResult;
|
|
75
|
+
readonly shadowLg: CSSResult;
|
|
76
|
+
readonly shadowXl: CSSResult;
|
|
77
|
+
readonly trackingTight: CSSResult;
|
|
78
|
+
readonly trackingWide: CSSResult;
|
|
62
79
|
};
|
|
63
|
-
/**
|
|
80
|
+
/**
|
|
81
|
+
* A size on the type scale with its own line height, so text drawn at
|
|
82
|
+
* `type('xl')` has the leading that size reads best at.
|
|
83
|
+
*/
|
|
84
|
+
export declare const type: (name: string) => CSSResult;
|
|
85
|
+
/** `space(3)` → `space.3`, `space(0.5)` → `space.0-5`. Spacing is always a token, never a number. */
|
|
64
86
|
export declare const space: (step: number) => CSSResult;
|
|
65
87
|
/** `font.size.lg` → the custom property. */
|
|
66
88
|
export declare const fontSize: (name: string) => CSSResult;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ImpktElement,
|
|
3
3
|
t
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NTNXHLTM.js";
|
|
5
5
|
|
|
6
6
|
// packages/ui/src/components/icon.ts
|
|
7
7
|
import { css, html, nothing, svg } from "lit";
|
|
@@ -82,4 +82,4 @@ export {
|
|
|
82
82
|
iconSvg,
|
|
83
83
|
ImpktIcon
|
|
84
84
|
};
|
|
85
|
-
//# sourceMappingURL=chunk-
|
|
85
|
+
//# sourceMappingURL=chunk-2YQA3VBY.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FieldElement
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7BIQ3K6H.js";
|
|
4
4
|
import {
|
|
5
5
|
fontSize,
|
|
6
6
|
space,
|
|
7
7
|
t,
|
|
8
8
|
targetSize
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-NTNXHLTM.js";
|
|
10
10
|
|
|
11
11
|
// packages/ui/src/components/checkbox.ts
|
|
12
12
|
import { html, css, nothing } from "lit";
|
|
@@ -85,4 +85,4 @@ customElements.define("impkt-checkbox", ImpktCheckbox);
|
|
|
85
85
|
export {
|
|
86
86
|
ImpktCheckbox
|
|
87
87
|
};
|
|
88
|
-
//# sourceMappingURL=chunk-
|
|
88
|
+
//# sourceMappingURL=chunk-4HU4Y23Q.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
spaceAround,
|
|
6
6
|
t,
|
|
7
7
|
token
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-NTNXHLTM.js";
|
|
9
9
|
|
|
10
10
|
// packages/ui/src/components/page.ts
|
|
11
11
|
import { css, html, nothing } from "lit";
|
|
@@ -20,6 +20,26 @@ var margins = css`
|
|
|
20
20
|
@container impkt-page (min-width: 64rem) { .frame { --impkt-page-margin: ${token("layout.margin.desktop", "64px")}; } }
|
|
21
21
|
`;
|
|
22
22
|
var ImpktPage = class extends ImpktElement {
|
|
23
|
+
constructor() {
|
|
24
|
+
super();
|
|
25
|
+
/**
|
|
26
|
+
* The header floats when the page opens on a full-picture hero, sitting on the
|
|
27
|
+
* picture itself, so nothing has to be set for it. It stays an ordinary bar
|
|
28
|
+
* while editing, where the blocks are kept inside the page's box.
|
|
29
|
+
*/
|
|
30
|
+
this.place = () => {
|
|
31
|
+
const hero = this.querySelector('impkt-hero[treatment="cover"]');
|
|
32
|
+
const editing = getComputedStyle(this).getPropertyValue("--impkt-bleed").trim() === "0";
|
|
33
|
+
const floats = !!hero && !editing && this.opensOn(hero);
|
|
34
|
+
this.toggleAttribute("floating", floats);
|
|
35
|
+
if (!floats) return;
|
|
36
|
+
const frame = this.renderRoot.querySelector(".frame");
|
|
37
|
+
if (frame) this.style.setProperty("--impkt-header-top", `${Math.round(hero.getBoundingClientRect().top - frame.getBoundingClientRect().top)}px`);
|
|
38
|
+
};
|
|
39
|
+
this.width = "standard";
|
|
40
|
+
this.stickyHeader = false;
|
|
41
|
+
this.skipText = "Skip to content";
|
|
42
|
+
}
|
|
23
43
|
static {
|
|
24
44
|
this.properties = {
|
|
25
45
|
width: { type: String, reflect: true },
|
|
@@ -27,16 +47,10 @@ var ImpktPage = class extends ImpktElement {
|
|
|
27
47
|
skipText: { type: String, attribute: "skip-text" }
|
|
28
48
|
};
|
|
29
49
|
}
|
|
30
|
-
constructor() {
|
|
31
|
-
super();
|
|
32
|
-
this.width = "standard";
|
|
33
|
-
this.stickyHeader = false;
|
|
34
|
-
this.skipText = "Skip to content";
|
|
35
|
-
}
|
|
36
50
|
static {
|
|
37
51
|
this.styles = [...ImpktElement.styles, focusRing, widths, margins, css`
|
|
38
52
|
:host { display: block; container: impkt-page / inline-size; }
|
|
39
|
-
.frame { display: flex; flex-direction: column; min-block-size: 100%; overflow-x: clip; }
|
|
53
|
+
.frame { position: relative; display: flex; flex-direction: column; min-block-size: 100%; overflow-x: clip; }
|
|
40
54
|
.inner { box-sizing: border-box; inline-size: 100%; max-inline-size: calc(var(--impkt-page-inner) + 2 * var(--impkt-page-margin)); margin-inline: auto; padding-inline: var(--impkt-page-margin); }
|
|
41
55
|
header { background: ${token("color.surface.header", "transparent")}; color: ${token("color.text.on-header", "inherit")}; padding-block: ${space(4)}; }
|
|
42
56
|
/* What sits in the header and footer takes their text colour, so words on a dark footer stay readable. */
|
|
@@ -45,8 +59,13 @@ var ImpktPage = class extends ImpktElement {
|
|
|
45
59
|
:host([sticky-header]) header { position: sticky; inset-block-start: 0; z-index: 10; }
|
|
46
60
|
main { flex: 1; padding-block: ${space(6)} ${space(10)}; }
|
|
47
61
|
main:focus { outline: none; }
|
|
62
|
+
/* A page that opens on a full-picture hero: the header floats over it as a rounded bar. */
|
|
63
|
+
:host([floating]) header { position: absolute; z-index: 20; inset-inline: 0; inset-block-start: var(--impkt-header-top, 0px); padding-block: ${space(6)} 0; background: transparent; border: 0; }
|
|
64
|
+
:host([floating]) header .inner { inline-size: calc(100% - 2 * var(--impkt-page-margin)); max-inline-size: var(--impkt-page-inner); padding: ${space(3)} ${space(4)} ${space(3)} ${space(6)}; background: ${token("color.surface.header", "#fff")}; border-radius: ${t.radius2xl}; box-shadow: ${t.shadowLg}; }
|
|
65
|
+
:host([floating]) main { padding-block-start: 0; }
|
|
48
66
|
footer { background: ${token("color.surface.footer", "transparent")}; color: ${token("color.text.on-footer", "inherit")}; padding-block: ${space(8)}; border-block-start: ${t.borderThin} solid ${token("color.border.subtle", "transparent")}; }
|
|
49
67
|
.skip { position: absolute; inset-inline-start: ${space(2)}; inset-block-start: ${space(2)}; z-index: 20; padding: ${space(2)} ${space(4)}; background: ${t.surfaceCard}; color: ${t.link}; border-radius: ${t.radius}; transform: translateY(-200%); }
|
|
68
|
+
.skip:not(:focus) { clip-path: inset(50%); }
|
|
50
69
|
.skip:focus { transform: none; }
|
|
51
70
|
.empty { display: none; }
|
|
52
71
|
`];
|
|
@@ -70,15 +89,35 @@ var ImpktPage = class extends ImpktElement {
|
|
|
70
89
|
${footer ? html`<footer part="footer"><div class="inner"><slot name="footer"></slot></div></footer>` : nothing}
|
|
71
90
|
</div>`;
|
|
72
91
|
}
|
|
92
|
+
/** Whether nothing a reader would notice comes before this block, other than an announcement. */
|
|
93
|
+
opensOn(hero) {
|
|
94
|
+
for (const element of Array.from(this.querySelectorAll("*"))) {
|
|
95
|
+
if (element === hero) return true;
|
|
96
|
+
if (element.closest('[slot="header"],[slot="footer"]')) continue;
|
|
97
|
+
if (element.tagName.startsWith("IMPKT-") && !/^IMPKT-(STACK|SECTION|GRID|ANNOUNCEMENT)$/.test(element.tagName)) return false;
|
|
98
|
+
}
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
73
101
|
// A header or footer added after the first render still gets its landmark.
|
|
74
102
|
connectedCallback() {
|
|
75
103
|
super.connectedCallback();
|
|
76
104
|
this.observer = new MutationObserver(() => this.requestUpdate());
|
|
77
105
|
this.observer.observe(this, { childList: true, attributes: true, subtree: false, attributeFilter: ["slot"] });
|
|
106
|
+
this.watcher = new MutationObserver(this.place);
|
|
107
|
+
this.watcher.observe(this, { childList: true, subtree: true, attributes: true, attributeFilter: ["treatment"] });
|
|
108
|
+
if (typeof ResizeObserver === "function") {
|
|
109
|
+
this.resize = new ResizeObserver(this.place);
|
|
110
|
+
this.resize.observe(this);
|
|
111
|
+
}
|
|
78
112
|
}
|
|
79
113
|
disconnectedCallback() {
|
|
80
114
|
super.disconnectedCallback();
|
|
81
115
|
this.observer?.disconnect();
|
|
116
|
+
this.watcher?.disconnect();
|
|
117
|
+
this.resize?.disconnect();
|
|
118
|
+
}
|
|
119
|
+
firstUpdated() {
|
|
120
|
+
this.place();
|
|
82
121
|
}
|
|
83
122
|
};
|
|
84
123
|
var ImpktSection = class extends ImpktElement {
|
|
@@ -106,17 +145,21 @@ var ImpktSection = class extends ImpktElement {
|
|
|
106
145
|
static {
|
|
107
146
|
this.styles = [...ImpktElement.styles, spaceAround, widths, css`
|
|
108
147
|
:host { display: block; --impkt-page-margin: inherit; }
|
|
148
|
+
/* What a solid card on a brand band goes back to, since the band repaints these for its own text. */
|
|
149
|
+
:host([tone='brand']) { --impkt-solid-card: ${t.surfaceCard}; --impkt-solid-text: ${t.text}; --impkt-solid-heading: var(--impkt-color-text-heading, ${t.text}); --impkt-solid-muted: ${t.textMuted}; }
|
|
109
150
|
.band { box-sizing: border-box; border-radius: ${t.radiusLg}; }
|
|
110
|
-
|
|
151
|
+
/* --impkt-bleed is 0 while editing, so a full-width block stays inside the box it is being edited in. */
|
|
152
|
+
:host([bleed]) .band { border-radius: 0; margin-inline: calc(var(--impkt-bleed, 1) * (50% - 50vw)); padding-inline: max(${space(4)}, calc(var(--impkt-bleed, 1) * (50vw - 50%))); }
|
|
111
153
|
:host([tone='subtle']) .band { background: ${t.surfaceSubtle}; }
|
|
112
154
|
:host([tone='inset']) .band { background: ${t.surfaceInset}; }
|
|
113
155
|
:host([tone='card']) .band { background: ${t.surfaceCard}; }
|
|
114
|
-
:host([tone='brand']) .band { background: ${t.brand}; color: ${t.onBrand}; --impkt-color-text-heading: ${t.onBrand}; --impkt-color-text-default: ${t.onBrand}; --impkt-color-text-muted: ${t.onBrand}; --impkt-color-text-link: ${t.onBrand}; --impkt-color-text-link-hover: ${t.onBrand}; }
|
|
156
|
+
:host([tone='brand']) .band { background: ${t.brand}; color: ${t.onBrand}; --impkt-eyebrow: ${t.onBrand}; --impkt-color-surface-card: color-mix(in srgb, ${t.onBrand} 10%, transparent); --impkt-color-text-heading: ${t.onBrand}; --impkt-color-text-default: ${t.onBrand}; --impkt-color-text-muted: ${t.onBrand}; --impkt-color-text-link: ${t.onBrand}; --impkt-color-text-link-hover: ${t.onBrand}; }
|
|
115
157
|
:host(:not([bleed]):not([tone='none'])) .band { padding-inline: ${space(6)}; }
|
|
116
158
|
:host([padding='sm']) .band { padding-block: ${space(4)}; }
|
|
117
159
|
:host([padding='md']) .band { padding-block: ${space(8)}; }
|
|
118
160
|
:host([padding='lg']) .band { padding-block: ${space(12)}; }
|
|
119
161
|
:host([padding='xl']) .band { padding-block: ${space(16)}; }
|
|
162
|
+
:host([padding='2xl']) .band { padding-block: clamp(${space(14)}, 8vw, ${space(28)}); }
|
|
120
163
|
.content { max-inline-size: var(--impkt-page-inner); margin-inline: auto; }
|
|
121
164
|
`];
|
|
122
165
|
}
|
|
@@ -131,4 +174,4 @@ export {
|
|
|
131
174
|
ImpktPage,
|
|
132
175
|
ImpktSection
|
|
133
176
|
};
|
|
134
|
-
//# sourceMappingURL=chunk-
|
|
177
|
+
//# sourceMappingURL=chunk-5EA4IDUD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/page.ts"],"sourcesContent":["import { css, html, nothing, type TemplateResult } from 'lit';\nimport { ImpktElement } from '../base/ImpktElement';\nimport { focusRing } from '../base/styles';\nimport { space, spaceAround, t, token } from '../base/tokens';\n\n/** The widest a line of content runs, for each choice of `width`. */\nconst widths = css`\n :host { --impkt-page-inner: ${token('layout.page-width', '1200px')}; }\n :host([width='narrow']) { --impkt-page-inner: 760px; }\n :host([width='wide']) { --impkt-page-inner: 1440px; }\n`;\n\n/**\n * The side margins, from the brand's layout: narrow on a phone, wider on a\n * tablet and a desktop. Measured against the page itself, so a page drawn in a\n * narrow preview gets phone margins whatever the window is.\n */\nconst margins = css`\n :host { --impkt-page-margin: ${token('layout.margin.phone', '16px')}; }\n @container impkt-page (min-width: 40rem) { .frame { --impkt-page-margin: ${token('layout.margin.tablet', '32px')}; } }\n @container impkt-page (min-width: 64rem) { .frame { --impkt-page-margin: ${token('layout.margin.desktop', '64px')}; } }\n`;\n\n/**\n * The frame every page sits in: a header, the page's own content, and a\n * footer, each kept to the brand's page width with the brand's side margins.\n *\n * A layout puts this at its root, with the site's header and footer in their\n * slots and the page content in the middle, so an app draws the same frame the\n * CMS shows. Without it, a page runs edge to edge.\n *\n * **It gives the page its landmarks.** The header, main content and footer are\n * `header`, `main` and `footer` elements, so a screen reader can jump between\n * them (1.3.1), and the first thing in the page is a \"Skip to content\" link\n * that appears when it has focus (2.4.1).\n *\n * @category layout\n * @icon layout\n * @slot header - The site's header: its logo, navigation and a call to action.\n * @slot - The page's own content.\n * @slot footer - The site's footer.\n */\nexport class ImpktPage extends ImpktElement {\n static properties = {\n width: { type: String, reflect: true },\n stickyHeader: { type: Boolean, reflect: true, attribute: 'sticky-header' },\n skipText: { type: String, attribute: 'skip-text' },\n };\n /** How wide the content runs. Standard is the brand's page width. */\n declare width: 'narrow' | 'standard' | 'wide';\n /** Keep the header at the top of the screen while the page scrolls. */\n declare stickyHeader: boolean;\n /** The words of the link that skips past the header to the content. */\n declare skipText: string;\n\n constructor() {\n super();\n this.width = 'standard';\n this.stickyHeader = false;\n this.skipText = 'Skip to content';\n }\n\n static styles = [...ImpktElement.styles, focusRing, widths, margins, css`\n :host { display: block; container: impkt-page / inline-size; }\n .frame { position: relative; display: flex; flex-direction: column; min-block-size: 100%; overflow-x: clip; }\n .inner { box-sizing: border-box; inline-size: 100%; max-inline-size: calc(var(--impkt-page-inner) + 2 * var(--impkt-page-margin)); margin-inline: auto; padding-inline: var(--impkt-page-margin); }\n header { background: ${token('color.surface.header', 'transparent')}; color: ${token('color.text.on-header', 'inherit')}; padding-block: ${space(4)}; }\n /* What sits in the header and footer takes their text colour, so words on a dark footer stay readable. */\n header { --impkt-color-text-default: ${token('color.text.on-header', 'inherit')}; --impkt-color-text-heading: ${token('color.text.on-header', 'inherit')}; }\n footer { --impkt-color-text-default: ${token('color.text.on-footer', 'inherit')}; --impkt-color-text-heading: ${token('color.text.on-footer', 'inherit')}; --impkt-color-text-muted: ${token('color.text.on-footer', 'inherit')}; --impkt-color-text-link: ${token('color.text.on-footer', 'inherit')}; --impkt-color-text-link-hover: ${token('color.text.on-footer', 'inherit')}; }\n :host([sticky-header]) header { position: sticky; inset-block-start: 0; z-index: 10; }\n main { flex: 1; padding-block: ${space(6)} ${space(10)}; }\n main:focus { outline: none; }\n /* A page that opens on a full-picture hero: the header floats over it as a rounded bar. */\n :host([floating]) header { position: absolute; z-index: 20; inset-inline: 0; inset-block-start: var(--impkt-header-top, 0px); padding-block: ${space(6)} 0; background: transparent; border: 0; }\n :host([floating]) header .inner { inline-size: calc(100% - 2 * var(--impkt-page-margin)); max-inline-size: var(--impkt-page-inner); padding: ${space(3)} ${space(4)} ${space(3)} ${space(6)}; background: ${token('color.surface.header', '#fff')}; border-radius: ${t.radius2xl}; box-shadow: ${t.shadowLg}; }\n :host([floating]) main { padding-block-start: 0; }\n footer { background: ${token('color.surface.footer', 'transparent')}; color: ${token('color.text.on-footer', 'inherit')}; padding-block: ${space(8)}; border-block-start: ${t.borderThin} solid ${token('color.border.subtle', 'transparent')}; }\n .skip { position: absolute; inset-inline-start: ${space(2)}; inset-block-start: ${space(2)}; z-index: 20; padding: ${space(2)} ${space(4)}; background: ${t.surfaceCard}; color: ${t.link}; border-radius: ${t.radius}; transform: translateY(-200%); }\n .skip:not(:focus) { clip-path: inset(50%); }\n .skip:focus { transform: none; }\n .empty { display: none; }\n `];\n\n private hasSlot(name: string): boolean {\n return Array.from(this.children).some((c) => c.getAttribute('slot') === name);\n }\n\n private skip(event: Event): void {\n event.preventDefault();\n const main = this.renderRoot.querySelector('main');\n main?.focus();\n main?.scrollIntoView();\n }\n\n render(): TemplateResult {\n // The header and footer are left out when nothing is in them, so a page\n // with no site header has no empty landmark for a screen reader to land on.\n const header = this.hasSlot('header');\n const footer = this.hasSlot('footer');\n return html`<div class=\"frame\" part=\"frame\">\n <a class=\"skip\" href=\"#content\" part=\"skip\" @click=${this.skip}>${this.skipText}</a>\n ${header ? html`<header part=\"header\"><div class=\"inner\"><slot name=\"header\"></slot></div></header>` : nothing}\n <main id=\"content\" tabindex=\"-1\" part=\"main\"><div class=\"inner\"><slot></slot></div></main>\n ${footer ? html`<footer part=\"footer\"><div class=\"inner\"><slot name=\"footer\"></slot></div></footer>` : nothing}\n </div>`;\n }\n\n /**\n * The header floats when the page opens on a full-picture hero, sitting on the\n * picture itself, so nothing has to be set for it. It stays an ordinary bar\n * while editing, where the blocks are kept inside the page's box.\n */\n private place = (): void => {\n const hero = this.querySelector('impkt-hero[treatment=\"cover\"]');\n const editing = getComputedStyle(this).getPropertyValue('--impkt-bleed').trim() === '0';\n const floats = !!hero && !editing && this.opensOn(hero);\n this.toggleAttribute('floating', floats);\n if (!floats) return;\n const frame = this.renderRoot.querySelector('.frame');\n if (frame) this.style.setProperty('--impkt-header-top', `${Math.round(hero!.getBoundingClientRect().top - frame.getBoundingClientRect().top)}px`);\n };\n\n /** Whether nothing a reader would notice comes before this block, other than an announcement. */\n private opensOn(hero: Element): boolean {\n for (const element of Array.from(this.querySelectorAll('*'))) {\n if (element === hero) return true;\n if (element.closest('[slot=\"header\"],[slot=\"footer\"]')) continue;\n if (element.tagName.startsWith('IMPKT-') && !/^IMPKT-(STACK|SECTION|GRID|ANNOUNCEMENT)$/.test(element.tagName)) return false;\n }\n return false;\n }\n\n // A header or footer added after the first render still gets its landmark.\n connectedCallback(): void {\n super.connectedCallback();\n this.observer = new MutationObserver(() => this.requestUpdate());\n this.observer.observe(this, { childList: true, attributes: true, subtree: false, attributeFilter: ['slot'] });\n this.watcher = new MutationObserver(this.place);\n this.watcher.observe(this, { childList: true, subtree: true, attributes: true, attributeFilter: ['treatment'] });\n if (typeof ResizeObserver === 'function') {\n this.resize = new ResizeObserver(this.place);\n this.resize.observe(this);\n }\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n this.watcher?.disconnect();\n this.resize?.disconnect();\n }\n\n protected firstUpdated(): void {\n this.place();\n }\n\n private observer?: MutationObserver;\n private watcher?: MutationObserver;\n private resize?: ResizeObserver;\n}\n\n/**\n * A band across the whole width of the page, with its own background, and its\n * content kept to the page width inside it: a coloured strip of features, a\n * quote on a tinted background, a call to action at the foot of a page.\n *\n * Inside a Page it reaches the edges of the screen whatever the page width is,\n * so a page can alternate bands without any of them knowing the frame. Set\n * `bleed` off to keep the band to the page width, as a panel.\n *\n * @category layout\n * @icon section\n * @slot - The section's content.\n */\nexport class ImpktSection extends ImpktElement {\n static properties = {\n tone: { type: String, reflect: true },\n padding: { type: String, reflect: true },\n width: { type: String, reflect: true },\n bleed: { type: Boolean, reflect: true },\n label: { type: String },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n /** The band's background. Text on it takes the matching colour, so it stays readable. */\n declare tone: 'none' | 'subtle' | 'inset' | 'brand' | 'card';\n /** Space inside the band, above and below its content. */\n declare padding: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** How wide the content inside runs. */\n declare width: 'narrow' | 'standard' | 'wide';\n /** Run the background to the edges of the screen. */\n declare bleed: boolean;\n /** A name for the section, so a screen reader can find it in the page's regions. Leave empty for none. */\n declare label: string;\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n constructor() {\n super();\n this.tone = 'none';\n this.padding = 'lg';\n this.width = 'standard';\n this.bleed = true;\n this.label = '';\n this.spaceAbove = 'none';\n this.spaceBelow = 'none';\n }\n\n static styles = [...ImpktElement.styles, spaceAround, widths, css`\n :host { display: block; --impkt-page-margin: inherit; }\n /* What a solid card on a brand band goes back to, since the band repaints these for its own text. */\n :host([tone='brand']) { --impkt-solid-card: ${t.surfaceCard}; --impkt-solid-text: ${t.text}; --impkt-solid-heading: var(--impkt-color-text-heading, ${t.text}); --impkt-solid-muted: ${t.textMuted}; }\n .band { box-sizing: border-box; border-radius: ${t.radiusLg}; }\n /* --impkt-bleed is 0 while editing, so a full-width block stays inside the box it is being edited in. */\n :host([bleed]) .band { border-radius: 0; margin-inline: calc(var(--impkt-bleed, 1) * (50% - 50vw)); padding-inline: max(${space(4)}, calc(var(--impkt-bleed, 1) * (50vw - 50%))); }\n :host([tone='subtle']) .band { background: ${t.surfaceSubtle}; }\n :host([tone='inset']) .band { background: ${t.surfaceInset}; }\n :host([tone='card']) .band { background: ${t.surfaceCard}; }\n :host([tone='brand']) .band { background: ${t.brand}; color: ${t.onBrand}; --impkt-eyebrow: ${t.onBrand}; --impkt-color-surface-card: color-mix(in srgb, ${t.onBrand} 10%, transparent); --impkt-color-text-heading: ${t.onBrand}; --impkt-color-text-default: ${t.onBrand}; --impkt-color-text-muted: ${t.onBrand}; --impkt-color-text-link: ${t.onBrand}; --impkt-color-text-link-hover: ${t.onBrand}; }\n :host(:not([bleed]):not([tone='none'])) .band { padding-inline: ${space(6)}; }\n :host([padding='sm']) .band { padding-block: ${space(4)}; }\n :host([padding='md']) .band { padding-block: ${space(8)}; }\n :host([padding='lg']) .band { padding-block: ${space(12)}; }\n :host([padding='xl']) .band { padding-block: ${space(16)}; }\n :host([padding='2xl']) .band { padding-block: clamp(${space(14)}, 8vw, ${space(28)}); }\n .content { max-inline-size: var(--impkt-page-inner); margin-inline: auto; }\n `];\n\n render(): TemplateResult {\n return html`<section class=\"band\" part=\"band\" aria-label=${this.label || nothing} role=${this.label ? nothing : 'presentation'}><div class=\"content\" part=\"content\"><slot></slot></div></section>`;\n }\n}\n\ncustomElements.define('impkt-page', ImpktPage);\ncustomElements.define('impkt-section', ImpktSection);\ndeclare global { interface HTMLElementTagNameMap { 'impkt-page': ImpktPage; 'impkt-section': ImpktSection } }\n"],"mappings":";;;;;;;;;;AAAA,SAAS,KAAK,MAAM,eAAoC;AAMxD,IAAM,SAAS;AAAA,gCACiB,MAAM,qBAAqB,QAAQ,CAAC;AAAA;AAAA;AAAA;AAUpE,IAAM,UAAU;AAAA,iCAC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AK,QAAQ,UAAU,cAAc;AAAA,EAChI;AACF;AAEA,eAAe,OAAO,cAAc,SAAS;AAC7C,eAAe,OAAO,iBAAiB,YAAY;","names":[]}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
fontWeight,
|
|
5
5
|
space,
|
|
6
6
|
t
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-NTNXHLTM.js";
|
|
8
8
|
|
|
9
9
|
// packages/ui/src/components/alert.ts
|
|
10
10
|
import { html, css, nothing } from "lit";
|
|
@@ -39,10 +39,12 @@ var ImpktAlert = class _ImpktAlert extends ImpktElement {
|
|
|
39
39
|
margin-block-end: ${space(4)};
|
|
40
40
|
}
|
|
41
41
|
.alert {
|
|
42
|
-
padding: ${space(4)};
|
|
43
|
-
border-radius: ${t.
|
|
42
|
+
padding: ${space(4)} ${space(5)};
|
|
43
|
+
border-radius: ${t.radiusLg};
|
|
44
44
|
border-inline-start: 4px solid;
|
|
45
|
-
|
|
45
|
+
box-shadow: inset 0 0 0 1px ${t.hairline};
|
|
46
|
+
font-size: ${fontSize("sm")};
|
|
47
|
+
line-height: 1.5;
|
|
46
48
|
}
|
|
47
49
|
.heading {
|
|
48
50
|
font-weight: ${fontWeight("semibold")};
|
|
@@ -102,4 +104,4 @@ customElements.define("impkt-alert", ImpktAlert);
|
|
|
102
104
|
export {
|
|
103
105
|
ImpktAlert
|
|
104
106
|
};
|
|
105
|
-
//# sourceMappingURL=chunk-
|
|
107
|
+
//# sourceMappingURL=chunk-6ICOJPMD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/alert.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpktElement } from '../base/ImpktElement';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\nexport type AlertTone = 'info' | 'success' | 'warning' | 'danger';\n\n/**\n * A notice.\n *\n * **The role depends on the tone, and that is a real distinction.** `alert`\n * interrupts whatever a screen reader is saying; `status` waits for a pause.\n * A failed payment earns the interruption. \"Your basket has been saved\" does\n * not, and using `alert` for it is how users learn to tune the live region\n * out — at which point the one that mattered is also lost.\n *\n * **The tone is never carried by colour alone.** Each tone ships a word, in\n * the accessible name, because 1.4.1 Use of Colour says a red border is not a\n * message and because a red border is invisible in forced-colours mode.\n\n *\n * @category feedback\n * @icon alert\n * @slot - The body of the notice.\n */\nexport class ImpktAlert extends ImpktElement {\n static properties = {\n tone: { type: String, reflect: true },\n heading: { type: String },\n toneLabel: { type: String, attribute: 'tone-label' },\n };\n\n declare tone: AlertTone;\n declare heading: string;\n /** Overrides the default word for the tone, for translation. */\n declare toneLabel: string;\n\n constructor() {\n super();\n this.tone = 'info';\n this.heading = '';\n this.toneLabel = '';\n }\n\n private static readonly TONE_WORDS: Record<AlertTone, string> = {\n info: 'Information',\n success: 'Success',\n warning: 'Warning',\n danger: 'Error',\n };\n\n static styles = [\n ...ImpktElement.styles,\n css`\n :host {\n display: block;\n margin-block-end: ${space(4)};\n }\n .alert {\n padding: ${space(4)} ${space(5)};\n border-radius: ${t.radiusLg};\n border-inline-start: 4px solid;\n box-shadow: inset 0 0 0 1px ${t.hairline};\n font-size: ${fontSize('sm')};\n line-height: 1.5;\n }\n .heading {\n font-weight: ${fontWeight('semibold')};\n margin-block-end: ${space(1)};\n }\n :host([tone='info']) .alert {\n background: ${t.infoSubtle};\n border-color: ${t.info};\n color: ${t.text};\n }\n :host([tone='success']) .alert {\n background: ${t.successSubtle};\n border-color: ${t.success};\n color: ${t.text};\n }\n :host([tone='warning']) .alert {\n background: ${t.warningSubtle};\n border-color: ${t.warning};\n color: ${t.text};\n }\n :host([tone='danger']) .alert {\n background: ${t.dangerSubtle};\n border-color: ${t.danger};\n color: ${t.text};\n }\n /* Colour is the only signal left in forced-colours mode, and it is gone.\n The border keeps the boundary; the tone word in the label carries the\n meaning. */\n @media (forced-colors: active) {\n .alert {\n border: 1px solid CanvasText;\n border-inline-start-width: 4px;\n }\n }\n `,\n ];\n\n render(): TemplateResult {\n const word = this.toneLabel || ImpktAlert.TONE_WORDS[this.tone];\n return html`\n <div\n class=\"alert\"\n part=\"alert\"\n role=${this.tone === 'danger' ? 'alert' : 'status'}\n aria-label=${this.heading ? nothing : word}\n >\n ${this.heading\n ? html`<div class=\"heading\" part=\"heading\">\n <span class=\"tone-word\">${word}:</span> ${this.heading}\n </div>`\n : nothing}\n <slot></slot>\n </div>\n `;\n }\n}\n\ncustomElements.define('impkt-alert', ImpktAlert);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impkt-alert': ImpktAlert;\n }\n}\n"],"mappings":";;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AAwBjD,IAAM,aAAN,MAAM,oBAAmB,aAAa;AAAA,EAC3C;AAAA,SAAO,aAAa;AAAA,MAClB,MAAM,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACpC,SAAS,EAAE,MAAM,OAAO;AAAA,MACxB,WAAW,EAAE,MAAM,QAAQ,WAAW,aAAa;AAAA,IACrD;AAAA;AAAA,EAOA,cAAc;AACZ,UAAM;AACN,SAAK,OAAO;AACZ,SAAK,UAAU;AACf,SAAK,YAAY;AAAA,EACnB;AAAA,EAEA;AAAA,SAAwB,aAAwC;AAAA,MAC9D,MAAM;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,MACT,QAAQ;AAAA,IACV;AAAA;AAAA,EAEA;AAAA,SAAO,SAAS;AAAA,MACd,GAAG,aAAa;AAAA,MAChB;AAAA;AAAA;AAAA,4BAGwB,MAAM,CAAC,CAAC;AAAA;AAAA;AAAA,mBAGjB,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC;AAAA,yBACd,EAAE,QAAQ;AAAA;AAAA,sCAEG,EAAE,QAAQ;AAAA,qBAC3B,SAAS,IAAI,CAAC;AAAA;AAAA;AAAA;AAAA,uBAIZ,WAAW,UAAU,CAAC;AAAA,4BACjB,MAAM,CAAC,CAAC;AAAA;AAAA;AAAA,sBAGd,EAAE,UAAU;AAAA,wBACV,EAAE,IAAI;AAAA,iBACb,EAAE,IAAI;AAAA;AAAA;AAAA,sBAGD,EAAE,aAAa;AAAA,wBACb,EAAE,OAAO;AAAA,iBAChB,EAAE,IAAI;AAAA;AAAA;AAAA,sBAGD,EAAE,aAAa;AAAA,wBACb,EAAE,OAAO;AAAA,iBAChB,EAAE,IAAI;AAAA;AAAA;AAAA,sBAGD,EAAE,YAAY;AAAA,wBACZ,EAAE,MAAM;AAAA,iBACf,EAAE,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAYrB;AAAA;AAAA,EAEA,SAAyB;AACvB,UAAM,OAAO,KAAK,aAAa,YAAW,WAAW,KAAK,IAAI;AAC9D,WAAO;AAAA;AAAA;AAAA;AAAA,eAII,KAAK,SAAS,WAAW,UAAU,QAAQ;AAAA,qBACrC,KAAK,UAAU,UAAU,IAAI;AAAA;AAAA,UAExC,KAAK,UACH;AAAA,wCAC4B,IAAI,YAAY,KAAK,OAAO;AAAA,sBAExD,OAAO;AAAA;AAAA;AAAA;AAAA,EAIjB;AACF;AAEA,eAAe,OAAO,eAAe,UAAU;","names":[]}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
space,
|
|
8
8
|
t,
|
|
9
9
|
visuallyHidden
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-NTNXHLTM.js";
|
|
11
11
|
|
|
12
12
|
// packages/ui/src/base/FieldElement.ts
|
|
13
13
|
import { html, css, nothing } from "lit";
|
|
@@ -167,4 +167,4 @@ export {
|
|
|
167
167
|
fieldWidths,
|
|
168
168
|
FieldElement
|
|
169
169
|
};
|
|
170
|
-
//# sourceMappingURL=chunk-
|
|
170
|
+
//# sourceMappingURL=chunk-7BIQ3K6H.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
iconSvg
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2YQA3VBY.js";
|
|
4
4
|
import {
|
|
5
5
|
ImpktElement,
|
|
6
6
|
fontSize,
|
|
@@ -8,15 +8,16 @@ import {
|
|
|
8
8
|
lineHeight,
|
|
9
9
|
space,
|
|
10
10
|
spaceAround,
|
|
11
|
-
t
|
|
12
|
-
|
|
11
|
+
t,
|
|
12
|
+
type
|
|
13
|
+
} from "./chunk-NTNXHLTM.js";
|
|
13
14
|
|
|
14
15
|
// packages/ui/src/components/marketing.ts
|
|
15
16
|
import { css, html, nothing } from "lit";
|
|
16
17
|
var heading = (level, text, cls) => html`<div class=${cls} role="heading" aria-level=${level}>${text}</div>`;
|
|
17
18
|
var headingStyles = css`
|
|
18
19
|
.h { margin: 0; color: ${t.textHeading}; font-family: ${t.fontHeading}; font-weight: ${fontWeight("bold")}; line-height: ${lineHeight("tight")}; }
|
|
19
|
-
.eyebrow { margin: 0; color: ${t.brand};
|
|
20
|
+
.eyebrow { margin: 0; color: var(--impkt-eyebrow, ${t.brand}); ${type("sm")} font-weight: ${fontWeight("semibold")}; letter-spacing: ${t.trackingWide}; text-transform: uppercase; }
|
|
20
21
|
.body { margin: 0; line-height: ${lineHeight("normal")}; max-inline-size: 65ch; }
|
|
21
22
|
`;
|
|
22
23
|
var ImpktHero = class extends ImpktElement {
|
|
@@ -28,6 +29,9 @@ var ImpktHero = class extends ImpktElement {
|
|
|
28
29
|
level: { type: Number, reflect: true },
|
|
29
30
|
imageSrc: { type: String, attribute: "image-src" },
|
|
30
31
|
imageAlt: { type: String, attribute: "image-alt" },
|
|
32
|
+
treatment: { type: String, reflect: true },
|
|
33
|
+
ratingText: { type: String, attribute: "rating-text" },
|
|
34
|
+
eyebrowIcon: { type: String, attribute: "eyebrow-icon" },
|
|
31
35
|
align: { type: String, reflect: true },
|
|
32
36
|
spaceAbove: { type: String, reflect: true, attribute: "space-above" },
|
|
33
37
|
spaceBelow: { type: String, reflect: true, attribute: "space-below" }
|
|
@@ -41,6 +45,9 @@ var ImpktHero = class extends ImpktElement {
|
|
|
41
45
|
this.level = 1;
|
|
42
46
|
this.imageSrc = "";
|
|
43
47
|
this.imageAlt = "";
|
|
48
|
+
this.treatment = "split";
|
|
49
|
+
this.ratingText = "";
|
|
50
|
+
this.eyebrowIcon = "none";
|
|
44
51
|
this.align = "start";
|
|
45
52
|
this.spaceAbove = "none";
|
|
46
53
|
this.spaceBelow = "none";
|
|
@@ -52,15 +59,43 @@ var ImpktHero = class extends ImpktElement {
|
|
|
52
59
|
.hero.pictured { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
|
|
53
60
|
.words { display: flex; flex-direction: column; gap: ${space(4)}; }
|
|
54
61
|
:host([align='center']) .words { align-items: center; text-align: center; margin-inline: auto; max-inline-size: 48rem; }
|
|
55
|
-
.h {
|
|
56
|
-
.body {
|
|
62
|
+
.h { ${type("5xl")} letter-spacing: ${t.trackingTight}; text-wrap: balance; }
|
|
63
|
+
.body { ${type("lg")} color: ${t.textMuted}; text-wrap: pretty; }
|
|
64
|
+
@container (max-width: 40rem) { .h { ${type("4xl")} } }
|
|
57
65
|
.actions { display: flex; flex-wrap: wrap; gap: ${space(3)} ${space(4)}; align-items: center; margin-block-start: ${space(2)}; }
|
|
58
66
|
:host([align='center']) .actions { justify-content: center; }
|
|
59
|
-
img { display: block; inline-size: 100%; block-size: auto; border-radius: ${t.
|
|
67
|
+
img { display: block; inline-size: 100%; block-size: auto; border-radius: ${t.radius2xl}; aspect-ratio: 4 / 3; object-fit: cover; box-shadow: ${t.shadowLg}; }
|
|
60
68
|
@container (max-width: 48rem) { .hero.pictured { grid-template-columns: minmax(0, 1fr); } }
|
|
69
|
+
/* Cover: the picture fills the block edge to edge, a scrim keeps the words readable (1.4.3). */
|
|
70
|
+
.cover { position: relative; display: flex; flex-direction: column; justify-content: center; min-block-size: clamp(44rem, 61vw, 55rem); margin-inline: calc(var(--impkt-bleed, 1) * (50% - 50vw)); padding: ${space(32)} max(${space(8)}, calc(var(--impkt-bleed, 1) * (50vw - 50%))) ${space(24)}; overflow: hidden; color: #fff; --impkt-color-text-heading: #fff; }
|
|
71
|
+
.cover img { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; aspect-ratio: auto; border-radius: 0; box-shadow: none; }
|
|
72
|
+
.cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgb(18 31 26 / 0.82) 0%, rgb(18 31 26 / 0.42) 55%, rgb(18 31 26 / 0.05) 100%); }
|
|
73
|
+
.cover .words { position: relative; z-index: 1; max-inline-size: 48rem; }
|
|
74
|
+
.cover .eyebrow { display: inline-flex; align-items: center; gap: ${space(2)}; align-self: flex-start; padding: ${space(2)} ${space(3.5)}; color: #fff; background: rgb(255 255 255 / 0.16); border-radius: 999px; text-transform: none; letter-spacing: 0; }
|
|
75
|
+
.chip-line { position: relative; z-index: 1; block-size: 0; }
|
|
76
|
+
.chip { position: absolute; inset-block-start: ${space(14)}; inset-inline-end: ${space(9)}; display: inline-flex; align-items: center; gap: ${space(2.5)}; padding: ${space(3)} ${space(4.5)}; ${type("sm")} font-weight: ${fontWeight("semibold")}; white-space: nowrap; color: #fff; background: rgb(255 255 255 / 0.16); border-radius: ${t.radiusXl}; }
|
|
77
|
+
.finder { position: relative; z-index: 1; margin-block-start: ${space(12)}; }
|
|
78
|
+
.cover .h { font-size: clamp(3rem, 6.4vw, 5.75rem); line-height: 1; }
|
|
79
|
+
.cover .body { color: rgb(255 255 255 / 0.92); max-inline-size: 40rem; }
|
|
80
|
+
@container (max-width: 64rem) { .chip { display: none; } }
|
|
81
|
+
@container (max-width: 30rem) { .finder { display: none; } }
|
|
82
|
+
@container (max-width: 48rem) { .finder { margin-block-start: ${space(6)}; } .cover { justify-content: flex-end; min-block-size: 43.75rem; padding-block: ${space(32)} ${space(10)}; } .cover::after { background: linear-gradient(180deg, rgb(18 31 26 / 0.1) 0%, rgb(18 31 26 / 0.3) 42%, rgb(18 31 26 / 0.86) 100%); } .cover .h { font-size: 3rem; } }
|
|
61
83
|
`];
|
|
62
84
|
}
|
|
63
85
|
render() {
|
|
86
|
+
if (this.treatment === "cover" && this.imageSrc) {
|
|
87
|
+
return html`<div class="cover" part="hero">
|
|
88
|
+
${this.ratingText ? html`<div class="chip-line"><div class="chip">${iconSvg("star", "20px")}${this.ratingText}</div></div>` : nothing}
|
|
89
|
+
<img src=${this.imageSrc} alt=${this.imageAlt} part="image" />
|
|
90
|
+
<div class="words">
|
|
91
|
+
${this.eyebrow ? html`<p class="eyebrow" part="eyebrow">${this.eyebrowIcon !== "none" ? iconSvg(this.eyebrowIcon, "16px") : nothing}${this.eyebrow}</p>` : nothing}
|
|
92
|
+
${heading(this.level, this.heading, "h")}
|
|
93
|
+
${this.lead ? html`<p class="body">${this.lead}</p>` : nothing}
|
|
94
|
+
<div class="actions"><slot name="actions"></slot></div>
|
|
95
|
+
</div>
|
|
96
|
+
<div class="finder"><slot name="search"></slot></div>
|
|
97
|
+
</div>`;
|
|
98
|
+
}
|
|
64
99
|
const pictured = Boolean(this.imageSrc) && this.align !== "center";
|
|
65
100
|
return html`<div class="hero ${pictured ? "pictured" : ""}" part="hero">
|
|
66
101
|
<div class="words">
|
|
@@ -168,6 +203,7 @@ var ImpktStat = class extends ImpktElement {
|
|
|
168
203
|
figure: { type: String },
|
|
169
204
|
label: { type: String },
|
|
170
205
|
note: { type: String },
|
|
206
|
+
size: { type: String, reflect: true },
|
|
171
207
|
align: { type: String, reflect: true }
|
|
172
208
|
};
|
|
173
209
|
}
|
|
@@ -176,6 +212,7 @@ var ImpktStat = class extends ImpktElement {
|
|
|
176
212
|
this.figure = "";
|
|
177
213
|
this.label = "";
|
|
178
214
|
this.note = "";
|
|
215
|
+
this.size = "md";
|
|
179
216
|
this.align = "start";
|
|
180
217
|
}
|
|
181
218
|
static {
|
|
@@ -184,6 +221,8 @@ var ImpktStat = class extends ImpktElement {
|
|
|
184
221
|
.stat { display: flex; flex-direction: column; gap: ${space(1)}; }
|
|
185
222
|
:host([align='center']) .stat { align-items: center; text-align: center; }
|
|
186
223
|
.value { font-family: ${t.fontHeading}; font-size: ${fontSize("3xl")}; font-weight: ${fontWeight("bold")}; line-height: 1; color: ${t.textHeading}; }
|
|
224
|
+
:host([size='lg']) .value { font-size: ${fontSize("5xl")}; }
|
|
225
|
+
:host([size='xl']) .value { font-size: clamp(2.75rem, 6vw, 4rem); }
|
|
187
226
|
.label { font-weight: ${fontWeight("semibold")}; }
|
|
188
227
|
.detail { color: ${t.textMuted}; font-size: ${fontSize("sm")}; }
|
|
189
228
|
`];
|
|
@@ -207,7 +246,7 @@ var ImpktBadge = class extends ImpktElement {
|
|
|
207
246
|
static {
|
|
208
247
|
this.styles = [...ImpktElement.styles, css`
|
|
209
248
|
:host { display: inline-flex; }
|
|
210
|
-
span { display: inline-flex; align-items: center; gap: ${space(1)}; padding: ${space(
|
|
249
|
+
span { display: inline-flex; align-items: center; gap: ${space(1)}; padding: ${space(0.5)} ${space(2)}; border-radius: ${t.radius}; ${type("xs")} font-weight: ${fontWeight("medium")}; background: ${t.surfaceInset}; color: ${t.text}; box-shadow: inset 0 0 0 1px ${t.hairline}; }
|
|
211
250
|
:host([tone='brand']) span { background: ${t.brandSubtle}; color: ${t.brand}; }
|
|
212
251
|
:host([tone='success']) span { background: ${t.successSubtle}; color: ${t.successText}; }
|
|
213
252
|
:host([tone='warning']) span { background: ${t.warningSubtle}; color: ${t.warningText}; }
|
|
@@ -220,6 +259,90 @@ var ImpktBadge = class extends ImpktElement {
|
|
|
220
259
|
return html`<span part="badge">${iconSvg(this.icon, "1em")}<slot></slot></span>`;
|
|
221
260
|
}
|
|
222
261
|
};
|
|
262
|
+
var ImpktAnnouncement = class extends ImpktElement {
|
|
263
|
+
static {
|
|
264
|
+
this.properties = {
|
|
265
|
+
message: { type: String },
|
|
266
|
+
linkText: { type: String, attribute: "link-text" },
|
|
267
|
+
href: { type: String }
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
constructor() {
|
|
271
|
+
super();
|
|
272
|
+
this.message = "";
|
|
273
|
+
this.linkText = "";
|
|
274
|
+
this.href = "";
|
|
275
|
+
}
|
|
276
|
+
static {
|
|
277
|
+
this.styles = [...ImpktElement.styles, css`
|
|
278
|
+
:host { display: block; }
|
|
279
|
+
.bar { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: ${space(2)} ${space(3)}; padding: ${space(2.5)} ${space(5)}; ${type("sm")} text-align: center; color: ${t.onBrand}; background: ${t.brand}; }
|
|
280
|
+
:host { margin-inline: calc(var(--impkt-bleed, 1) * (50% - 50vw)); }
|
|
281
|
+
a { display: inline-flex; align-items: center; gap: ${space(1)}; color: inherit; font-weight: ${fontWeight("semibold")}; }
|
|
282
|
+
`];
|
|
283
|
+
}
|
|
284
|
+
render() {
|
|
285
|
+
return html`<div class="bar" part="bar"><span>${this.message}</span>${this.linkText && this.href ? html`<a href=${this.href}>${this.linkText}${iconSvg("arrow-right", "14px")}</a>` : nothing}</div>`;
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
var ImpktSearchBar = class extends ImpktElement {
|
|
289
|
+
static {
|
|
290
|
+
this.properties = {
|
|
291
|
+
items: { type: Array },
|
|
292
|
+
buttonText: { type: String, attribute: "button-text" },
|
|
293
|
+
action: { type: String },
|
|
294
|
+
label: { type: String },
|
|
295
|
+
spaceAbove: { type: String, reflect: true, attribute: "space-above" },
|
|
296
|
+
spaceBelow: { type: String, reflect: true, attribute: "space-below" }
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
constructor() {
|
|
300
|
+
super();
|
|
301
|
+
this.items = [];
|
|
302
|
+
this.buttonText = "Search";
|
|
303
|
+
this.action = "";
|
|
304
|
+
this.label = "Search";
|
|
305
|
+
this.spaceAbove = "none";
|
|
306
|
+
this.spaceBelow = "none";
|
|
307
|
+
}
|
|
308
|
+
static {
|
|
309
|
+
this.styles = [...ImpktElement.styles, spaceAround, css`
|
|
310
|
+
:host { display: block; container-type: inline-size; }
|
|
311
|
+
form { display: flex; align-items: center; padding: ${space(3)}; background: ${t.surfaceCard}; color: ${t.text}; border-radius: ${t.radius2xl}; box-shadow: ${t.shadowXl}; }
|
|
312
|
+
.field { flex: 1; min-inline-size: 0; display: flex; flex-direction: column; gap: ${space(1)}; padding: ${space(1.5)} ${space(5)}; }
|
|
313
|
+
label { ${type("sm")} color: ${t.textMuted}; }
|
|
314
|
+
select { inline-size: 100%; min-block-size: 28px; padding: 0; font: inherit; ${type("sm")} font-weight: ${fontWeight("semibold")}; color: ${t.text}; background: transparent; border: 0; border-radius: ${t.radiusSm}; cursor: pointer; }
|
|
315
|
+
select:focus-visible, button:focus-visible { outline: 2px solid ${t.brand}; outline-offset: 2px; }
|
|
316
|
+
button { flex: none; min-block-size: 48px; padding: ${space(3)} ${space(6)}; font: inherit; font-weight: ${fontWeight("semibold")}; color: ${t.onBrand}; background: ${t.brand}; border: 0; border-radius: ${t.radiusLg}; cursor: pointer; }
|
|
317
|
+
button:hover { background: ${t.brandHover}; }
|
|
318
|
+
@container (max-width: 56rem) { form { flex-wrap: wrap; } .field { flex: 1 1 40%; } button { inline-size: 100%; } }
|
|
319
|
+
@container (max-width: 30rem) { form { flex-direction: column; align-items: stretch; gap: ${space(2)}; } .field { flex: none; } }
|
|
320
|
+
`];
|
|
321
|
+
}
|
|
322
|
+
submit(event) {
|
|
323
|
+
const data = new FormData(event.currentTarget);
|
|
324
|
+
const values = {};
|
|
325
|
+
data.forEach((value, key) => {
|
|
326
|
+
if (value !== "") values[key] = String(value);
|
|
327
|
+
});
|
|
328
|
+
this.dispatchEvent(new CustomEvent("impkt-submit", { detail: { values }, bubbles: true, composed: true }));
|
|
329
|
+
if (!this.action) event.preventDefault();
|
|
330
|
+
}
|
|
331
|
+
render() {
|
|
332
|
+
return html`<form role="search" aria-label=${this.label} method="get" action=${this.action || nothing} @submit=${this.submit} part="form">
|
|
333
|
+
${(this.items ?? []).map((field, i) => {
|
|
334
|
+
const id = this.id_(`field-${i}`);
|
|
335
|
+
const choices = String(field.options ?? "").split(",").map((o) => o.trim()).filter(Boolean);
|
|
336
|
+
return html`<div class="field"><label for=${id}>${field.label}</label><select id=${id} name=${field.name || field.label.toLowerCase().replace(/[^a-z0-9]+/g, "-")}>
|
|
337
|
+
<option value="">${field.placeholder || "Any"}</option>${choices.map((c) => html`<option value=${c}>${c}</option>`)}
|
|
338
|
+
</select></div>`;
|
|
339
|
+
})}
|
|
340
|
+
<button type="submit">${this.buttonText}</button>
|
|
341
|
+
</form>`;
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
customElements.define("impkt-search-bar", ImpktSearchBar);
|
|
345
|
+
customElements.define("impkt-announcement", ImpktAnnouncement);
|
|
223
346
|
customElements.define("impkt-hero", ImpktHero);
|
|
224
347
|
customElements.define("impkt-feature-list", ImpktFeatureList);
|
|
225
348
|
customElements.define("impkt-quote", ImpktQuote);
|
|
@@ -231,6 +354,8 @@ export {
|
|
|
231
354
|
ImpktFeatureList,
|
|
232
355
|
ImpktQuote,
|
|
233
356
|
ImpktStat,
|
|
234
|
-
ImpktBadge
|
|
357
|
+
ImpktBadge,
|
|
358
|
+
ImpktAnnouncement,
|
|
359
|
+
ImpktSearchBar
|
|
235
360
|
};
|
|
236
|
-
//# sourceMappingURL=chunk-
|
|
361
|
+
//# sourceMappingURL=chunk-7Y6UCSUS.js.map
|