@dloizides/marketing-astro-kit 1.7.0 → 1.9.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/CHANGELOG.md CHANGED
@@ -1,115 +1,132 @@
1
- # Changelog
2
-
3
- ## 1.7.0
4
-
5
- ### Added
6
-
7
- - `<BottomSheet />` (`./BottomSheet.astro`): slot-based phone bottom sheet opened by `:target`, inline at 1024 px and up. Sits above `--dlz-consent-inset`. BEAD-ONE-2 "One-host follow-ups".
8
-
9
- ## 1.6.1
10
-
11
- ### Fixed
12
-
13
- - `HairlineFigure` mount: a failed lazy-chunk load or figure mount no longer becomes an unhandled rejection. The host gets `data-hairline-failed="true"` and the page logs one `console.warn`. HAIRLINE-1 "Adopt hairline isometric line figures".
14
- - README: a sub-path host (kefi-landings) needs `build.assetsPrefix` set to an ABSOLUTE origin serving `dist/_astro/`; a relative prefix fails silently.
15
-
16
- ## 1.6.0
17
-
18
- ### Added
19
-
20
- - `<HairlineFigure />` (`./HairlineFigure.astro`) plus `HAIRLINE_FIGURES`, `TOUCH_SAFE_HAIRLINE_FIGURES` and `clampHairlineIntensity` (`./hairline`). Wraps `@lucasmarkes/hairline` 0.3.0 (exact pin): SSR 5:4 box, lazy mount near the viewport, destroy on page swap, `--hairline-*` mapped from the theming contract. HAIRLINE-1 "Adopt hairline isometric line figures".
21
-
22
- ## 1.5.2
23
-
24
- ### Fixed
25
-
26
- - `.dmk-disclaimer` (DemoFrame) and `.pmk-footnote` (PricingComparison) cap their measure at 65ch; at 1280 px they ran 102-113 characters per line. Mobile is unaffected.
27
-
28
- ## 1.3.0
29
-
30
- ### Added
31
-
32
- - `<HeroBackdrop />` plus the named hero-backdrop preset catalog (`./heroBackdrop`).
33
- Nine animated hero treatments -- three canvas, one SVG-filter, five pure-CSS --
34
- that until now existed ONLY in a disposable per-session scratchpad and had been
35
- rebuilt from scratch more than once. `HERO_BACKDROP_PRESETS` is the permanent
36
- record: preset name -> `{ variant, engine, palette, css, ember }`, using the
37
- design studio's own parameter names verbatim so a studio export pastes in with
38
- no translation step.
39
- - `csdf-ember-sparse` -- CSDF's shipped configuration. 40 particles, an eighth of
40
- the studio default, which is what makes a canvas backdrop affordable against a
41
- hard Lighthouse >= 80 budget.
42
- - Only the ember canvas engine ships as a RENDERER. The CSS/SVG entries are
43
- recorded PARAMETER SETS painted by the host stylesheet; the component renders
44
- nothing for those, leaving the host's own backdrop untouched.
45
-
46
- ### Notes
47
-
48
- - The component's script is `is:inline` deliberately -- a bundled Astro script
49
- emits a root-absolute `/_astro/*.js` reference, which 404s under kefi-landings'
50
- host-based per-tenant nginx roots.
51
- - Respects `prefers-reduced-motion` (one still frame, no loop) and stops the rAF
52
- loop on `visibilitychange` and when the canvas leaves the viewport.
53
-
54
- ## 1.2.1
55
-
56
- - **a11y fix (serious): the pricing comparison was SILENT to screen readers.**
57
- `PricingComparison.astro` marked each cell with `aria-label` on a bare
58
- `<span>`. `aria-label` is *prohibited* on a roleless generic element, so
59
- assistive tech ignored it — and the inner `<svg>` is `aria-hidden`. Net
60
- effect: a screen-reader user reached every included/not-included cell and
61
- heard **nothing**, so they could not tell which plan carried which feature,
62
- on a public pricing page. Fixed by giving the span `role="img"` alongside
63
- the existing label. Found by the `a11y-public` E2E axe scan against the live
64
- kefi landing: `aria-prohibited-attr`, 27 nodes. Swept the rest of the kit —
65
- no other instances of this shape.
66
-
67
- ## 1.2.0
68
-
69
- - New `DemoFrame.astro` — a themeable, **client-side "try it" demo** shell for
70
- static marketing sites (no backend): an eyebrow/title/intro, a row of clickable
71
- example chips, a per-example result panel (bespoke product body injected via a
72
- named slot `result-<example.id>`), a clearly-visible "sample data" disclaimer,
73
- and a primary CTA (reuses `PrimaryCta`). Tiny inline vanilla JS toggles which
74
- result shows on chip click (+ arrow-key roving tablist); the first example is
75
- visible without JS (progressive enhancement). New `DemoExample` / `DemoFrameData`
76
- types in `schema.ts`.
77
- - New `GuideCard.astro` — a themeable card for a **guides / SEO content-hub**
78
- listing, rendering one guide's tags, title, description and date. New
79
- `GuideCardData` type.
80
- - New `guideFrontmatterSchema` (Zod, built on `astro/zod`) + `GuideFrontmatter`
81
- type in `schema.ts` — plug straight into an Astro content collection
82
- (`defineCollection({ loader: glob(...), schema: guideFrontmatterSchema })`) so
83
- every product's guides validate the same shape (title, description, slug?,
84
- publishDate, updatedDate?, tags, ogImage?, canonical?, draft?). The article
85
- page + routes + JSON-LD stay product-owned.
86
- - `schema.ts` now imports `z` from `astro/zod` (Astro is already a peer dep) —
87
- the ONE runtime import; every other export stays plain types.
88
-
89
- ## 1.1.0
90
-
91
- - New `PrimaryCta.astro` — a themeable primary call-to-action (link OR spam-safe
92
- contact) with an optional secondary CTA and a `tone: 'light' | 'dark'` for
93
- dark bands. Renders a `MarketingCta` so link-vs-lead-capture + analytics wiring
94
- is no longer hand-coded per page.
95
- - New `buildPrimaryCta(opts)` helper + `PrimaryCtaOptions` in `schema.ts`: drive
96
- a primary CTA from ONE `SIGNUP_URL` constant — a real signup link when set,
97
- spam-safe lead-capture when `null` (flip at GA with no template change).
98
- - `ctaAttrs()` promoted from `PricingComparison.astro` into `schema.ts` and now
99
- shared by every CTA-rendering component (no duplication).
100
- - `TrustSection` gains three optional, guarded fields (existing sites
101
- unaffected): `foundingPartner` ("first N free during beta" panel),
102
- `founder` (honest one-line credibility) and `sampleDeliverable` (a "here's the
103
- actual report you get" showcase — image, or a `slot="sample-deliverable"` for
104
- bespoke mock markup while the section chrome stays shared).
105
-
106
- ## 1.0.0
107
-
108
- - Initial release. `PricingComparison.astro` (Free-vs-Pro comparison table with
109
- tier columns, grouped feature rows, optional footnote + one-time callout card)
110
- and `TrustSection.astro` (security cards with inline icons, customer-logo row
111
- with placeholders, testimonial placeholders, discreet built-by line).
112
- - Framework-agnostic data schema (`schema.ts`) + inline icon set (`icons.ts`).
113
- - Themed via host CSS custom properties with fallbacks; no image assets.
114
- - Extracted from `kefi-marketing` as the 2nd genuine use of the pricing/trust
115
- sections across the Astro marketing sites.
1
+ # Changelog
2
+
3
+ ## 1.9.0
4
+
5
+ ### Added
6
+
7
+ - `<MeetingRequestForm />` (`./MeetingRequestForm.astro`) + `./meetingRequest` helpers: preferred day, time of day, name, email, company, message; validation (past day, bad email), JSON POST with timeout, sent / rate-limited (429) / failed states, mailto assembled in the browser, honeypot `website`, Send loading state, optional Umami event. Labels and endpoint are options; no subject is sent. MOONCUBE-SITE-1 "Moon Cube Technologies site: read and book", AC-07, AC-08, AC-18, AC-20, AC-21, AC-22.
8
+ - `<DateField />` (`./DateField.astro`) + `./dateField` helpers: the shared date input for Astro sites (DATE-INPUT-1 "Every date or date-time field uses the shared input"): native picker, label, min/max, error with `aria-invalid` + `aria-describedby`, 44 px control, themed by `--tmk-df-*`. `MeetingRequestForm` uses it for the day. MOONCUBE-SITE-1, D-SITE-17.
9
+
10
+ ### Changed
11
+
12
+ - `MeetingRequestForm`: the message is required, at least 10 characters (matches the `/contact` server validator); new error kind `too-short` in `labels.errors`.
13
+
14
+ ## 1.8.0
15
+
16
+ ### Added
17
+
18
+ - `<BookingEmbed />` (`./BookingEmbed.astro`) + `./bookingEmbed` helpers: Cal.com inline embed set by options, contact fallback after 8 s or a load error, address assembled in the browser. Unit tests (vitest), lint and typecheck scripts. MOONCUBE-SITE-1 "Moon Cube Technologies site: read and book", AC-18.
19
+
20
+ ## 1.7.0
21
+
22
+ ### Added
23
+
24
+ - `<BottomSheet />` (`./BottomSheet.astro`): slot-based phone bottom sheet opened by `:target`, inline at 1024 px and up. Sits above `--dlz-consent-inset`. BEAD-ONE-2 "One-host follow-ups".
25
+
26
+ ## 1.6.1
27
+
28
+ ### Fixed
29
+
30
+ - `HairlineFigure` mount: a failed lazy-chunk load or figure mount no longer becomes an unhandled rejection. The host gets `data-hairline-failed="true"` and the page logs one `console.warn`. HAIRLINE-1 "Adopt hairline isometric line figures".
31
+ - README: a sub-path host (kefi-landings) needs `build.assetsPrefix` set to an ABSOLUTE origin serving `dist/_astro/`; a relative prefix fails silently.
32
+
33
+ ## 1.6.0
34
+
35
+ ### Added
36
+
37
+ - `<HairlineFigure />` (`./HairlineFigure.astro`) plus `HAIRLINE_FIGURES`, `TOUCH_SAFE_HAIRLINE_FIGURES` and `clampHairlineIntensity` (`./hairline`). Wraps `@lucasmarkes/hairline` 0.3.0 (exact pin): SSR 5:4 box, lazy mount near the viewport, destroy on page swap, `--hairline-*` mapped from the theming contract. HAIRLINE-1 "Adopt hairline isometric line figures".
38
+
39
+ ## 1.5.2
40
+
41
+ ### Fixed
42
+
43
+ - `.dmk-disclaimer` (DemoFrame) and `.pmk-footnote` (PricingComparison) cap their measure at 65ch; at 1280 px they ran 102-113 characters per line. Mobile is unaffected.
44
+
45
+ ## 1.3.0
46
+
47
+ ### Added
48
+
49
+ - `<HeroBackdrop />` plus the named hero-backdrop preset catalog (`./heroBackdrop`).
50
+ Nine animated hero treatments -- three canvas, one SVG-filter, five pure-CSS --
51
+ that until now existed ONLY in a disposable per-session scratchpad and had been
52
+ rebuilt from scratch more than once. `HERO_BACKDROP_PRESETS` is the permanent
53
+ record: preset name -> `{ variant, engine, palette, css, ember }`, using the
54
+ design studio's own parameter names verbatim so a studio export pastes in with
55
+ no translation step.
56
+ - `csdf-ember-sparse` -- CSDF's shipped configuration. 40 particles, an eighth of
57
+ the studio default, which is what makes a canvas backdrop affordable against a
58
+ hard Lighthouse >= 80 budget.
59
+ - Only the ember canvas engine ships as a RENDERER. The CSS/SVG entries are
60
+ recorded PARAMETER SETS painted by the host stylesheet; the component renders
61
+ nothing for those, leaving the host's own backdrop untouched.
62
+
63
+ ### Notes
64
+
65
+ - The component's script is `is:inline` deliberately -- a bundled Astro script
66
+ emits a root-absolute `/_astro/*.js` reference, which 404s under kefi-landings'
67
+ host-based per-tenant nginx roots.
68
+ - Respects `prefers-reduced-motion` (one still frame, no loop) and stops the rAF
69
+ loop on `visibilitychange` and when the canvas leaves the viewport.
70
+
71
+ ## 1.2.1
72
+
73
+ - **a11y fix (serious): the pricing comparison was SILENT to screen readers.**
74
+ `PricingComparison.astro` marked each cell with `aria-label` on a bare
75
+ `<span>`. `aria-label` is *prohibited* on a roleless generic element, so
76
+ assistive tech ignored it — and the inner `<svg>` is `aria-hidden`. Net
77
+ effect: a screen-reader user reached every included/not-included cell and
78
+ heard **nothing**, so they could not tell which plan carried which feature,
79
+ on a public pricing page. Fixed by giving the span `role="img"` alongside
80
+ the existing label. Found by the `a11y-public` E2E axe scan against the live
81
+ kefi landing: `aria-prohibited-attr`, 27 nodes. Swept the rest of the kit —
82
+ no other instances of this shape.
83
+
84
+ ## 1.2.0
85
+
86
+ - New `DemoFrame.astro` — a themeable, **client-side "try it" demo** shell for
87
+ static marketing sites (no backend): an eyebrow/title/intro, a row of clickable
88
+ example chips, a per-example result panel (bespoke product body injected via a
89
+ named slot `result-<example.id>`), a clearly-visible "sample data" disclaimer,
90
+ and a primary CTA (reuses `PrimaryCta`). Tiny inline vanilla JS toggles which
91
+ result shows on chip click (+ arrow-key roving tablist); the first example is
92
+ visible without JS (progressive enhancement). New `DemoExample` / `DemoFrameData`
93
+ types in `schema.ts`.
94
+ - New `GuideCard.astro` — a themeable card for a **guides / SEO content-hub**
95
+ listing, rendering one guide's tags, title, description and date. New
96
+ `GuideCardData` type.
97
+ - New `guideFrontmatterSchema` (Zod, built on `astro/zod`) + `GuideFrontmatter`
98
+ type in `schema.ts` — plug straight into an Astro content collection
99
+ (`defineCollection({ loader: glob(...), schema: guideFrontmatterSchema })`) so
100
+ every product's guides validate the same shape (title, description, slug?,
101
+ publishDate, updatedDate?, tags, ogImage?, canonical?, draft?). The article
102
+ page + routes + JSON-LD stay product-owned.
103
+ - `schema.ts` now imports `z` from `astro/zod` (Astro is already a peer dep) —
104
+ the ONE runtime import; every other export stays plain types.
105
+
106
+ ## 1.1.0
107
+
108
+ - New `PrimaryCta.astro` — a themeable primary call-to-action (link OR spam-safe
109
+ contact) with an optional secondary CTA and a `tone: 'light' | 'dark'` for
110
+ dark bands. Renders a `MarketingCta` so link-vs-lead-capture + analytics wiring
111
+ is no longer hand-coded per page.
112
+ - New `buildPrimaryCta(opts)` helper + `PrimaryCtaOptions` in `schema.ts`: drive
113
+ a primary CTA from ONE `SIGNUP_URL` constant — a real signup link when set,
114
+ spam-safe lead-capture when `null` (flip at GA with no template change).
115
+ - `ctaAttrs()` promoted from `PricingComparison.astro` into `schema.ts` and now
116
+ shared by every CTA-rendering component (no duplication).
117
+ - `TrustSection` gains three optional, guarded fields (existing sites
118
+ unaffected): `foundingPartner` ("first N free during beta" panel),
119
+ `founder` (honest one-line credibility) and `sampleDeliverable` (a "here's the
120
+ actual report you get" showcase — image, or a `slot="sample-deliverable"` for
121
+ bespoke mock markup while the section chrome stays shared).
122
+
123
+ ## 1.0.0
124
+
125
+ - Initial release. `PricingComparison.astro` (Free-vs-Pro comparison table with
126
+ tier columns, grouped feature rows, optional footnote + one-time callout card)
127
+ and `TrustSection.astro` (security cards with inline icons, customer-logo row
128
+ with placeholders, testimonial placeholders, discreet built-by line).
129
+ - Framework-agnostic data schema (`schema.ts`) + inline icon set (`icons.ts`).
130
+ - Themed via host CSS custom properties with fallbacks; no image assets.
131
+ - Extracted from `kefi-marketing` as the 2nd genuine use of the pricing/trust
132
+ sections across the Astro marketing sites.
package/README.md CHANGED
@@ -10,6 +10,7 @@ credibility + conversion markers an executive scans for before they trust a SaaS
10
10
  | `PrimaryCta.astro` | A themeable **primary call-to-action** (link OR spam-safe contact) with an optional secondary CTA. Pair with `buildPrimaryCta` so ONE `SIGNUP_URL` constant drives whether it's a real signup link or lead-capture. |
11
11
  | `DemoFrame.astro` | A themeable, **client-side "try it" demo** shell for static sites (no backend): eyebrow/title/intro, a row of clickable example chips, a per-example result panel (bespoke product body via a named `result-<id>` slot), a "sample data" disclaimer, and a primary CTA. Tiny inline vanilla JS toggles which result shows; first example visible without JS. |
12
12
  | `GuideCard.astro` | A themeable **card for a guides / SEO content-hub** listing — one guide's tags, title, description and date. Pair with `guideFrontmatterSchema` on an Astro content collection. |
13
+ | `BookingEmbed.astro` | A **Cal.com inline booking embed** set by options (link, theme, brand colours), loaded on its page only, with a spam-safe contact fallback after a timeout or load error. |
13
14
  | `HairlineFigure.astro` | A **Hairline isometric line figure** (`@lucasmarkes/hairline`, pinned 0.3.0) for heroes and empty states: an empty 5:4 box server-side, drawn on the client once it nears the viewport, coloured from the host's tokens. |
14
15
 
15
16
  ## Config-driven primary CTA (`PrimaryCta` + `buildPrimaryCta`)
@@ -185,6 +186,29 @@ import HairlineFigure from '@dloizides/marketing-astro-kit/HairlineFigure.astro'
185
186
  - **Script bundling:** unlike `HeroBackdrop`, this script is a bundled Astro `<script>` (it imports an npm module), so it emits a root-absolute `/_astro/*.js` URL. On a host that serves a tenant from a sub-directory (kefi-landings: the nginx root is the tenant sub-directory), set Astro's `build.assetsPrefix` to an ABSOLUTE origin (`https://cdn.example.com`) that serves this build's `dist/_astro/`, both the entry script and the lazy Hairline chunk. A relative prefix fails silently: the chunk 404s and the box stays empty, marked `data-hairline-failed` with one `console.warn`.
186
187
  - **Vite-alias consumers** (the kit aliased to source, not installed) must have `@lucasmarkes/hairline@0.3.0` resolvable from the site.
187
188
 
189
+ ## Booking embed (`BookingEmbed`)
190
+
191
+ ```astro
192
+ ---
193
+ import BookingEmbed from "@dloizides/marketing-astro-kit/BookingEmbed.astro";
194
+ import { BookingTheme, CalLayout } from "@dloizides/marketing-astro-kit/bookingEmbed";
195
+ ---
196
+ <BookingEmbed
197
+ id="book"
198
+ label="Book a call"
199
+ options={{ calLink: "mooncube/intro", theme: BookingTheme.Dark, layout: CalLayout.Month,
200
+ hideEventTypeDetails: true, cssVarsPerTheme: { dark: { "cal-bg": "#0F1B2D", "cal-brand": "#E8C36A" } } }}
201
+ contact={{ local: "hello", domain: "example.com" }}
202
+ >
203
+ <p slot="fallback">Calendar unavailable. Email <a data-booking-contact></a></p>
204
+ </BookingEmbed>
205
+ ```
206
+
207
+ - Options: `calLink` (required, Cal.com path), `theme` (default dark), `layout` (default month view), `hideEventTypeDetails`, `cssVarsPerTheme` (`cal-*` names, hex only, checked at build), `timeoutMs` (default 8000), `namespace` (`^[\w-]+$`, default the host `id`), `origin` (https URL with no path, default `https://app.cal.com`; the embed script loads from `<origin>/embed/embed.js`).
208
+ - The Cal.com script is added by the component script only when a host is on the page.
209
+ - The fallback slot shows after `timeoutMs` with no `linkReady`, on `linkFailed`, or when the script fails, for hosts mounted by any later call too. Each `[data-booking-contact]` link gets its `mailto:` filled in the browser from `data-local` + `data-domain`; the served HTML holds no address.
210
+ - `data-booking-state` on the host is `loading`, `ready` or `fallback`. Set `--tmk-booking-min-height` (default 640px).
211
+
188
212
  ## Bottom sheet (`BottomSheet`)
189
213
 
190
214
  Below 1024 px the default slot opens as a bottom sheet when the URL hash equals `id`; link to `#id` to open it. From 1024 px the slot renders inline and the head and foot are hidden. The `foot` slot holds the sticky action. Set `--tmk-sheet-bg` and `--tmk-sheet-edge` to theme it (fallbacks `--paper`, `--ink`). It stays above a consent card through `--dlz-consent-inset`. The close link carries `data-sheet-close`.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dloizides/marketing-astro-kit",
3
- "version": "1.7.0",
4
- "description": "Reusable, themeable Astro marketing sections for product sites — a Free-vs-Pro pricing comparison table, a trust / credibility section (security cards, customer-logo + testimonial placeholders, discreet built-by), a client-side \"try it\" demo shell, and an SEO guides/content-hub card + frontmatter schema. Data-driven via a shared TypeScript schema; themed entirely through the host site's CSS custom properties.",
3
+ "version": "1.9.0",
4
+ "description": "Reusable, themeable Astro marketing sections for product sites — a Free-vs-Pro pricing comparison table, a trust / credibility section (security cards, customer-logo + testimonial placeholders, discreet built-by), a client-side \"try it\" demo shell, a meeting request form posting to a contact endpoint, and an SEO guides/content-hub card + frontmatter schema. Data-driven via a shared TypeScript schema; themed entirely through the host site's CSS custom properties.",
5
5
  "keywords": [
6
6
  "astro",
7
7
  "marketing",
@@ -19,7 +19,12 @@
19
19
  "canvas",
20
20
  "animation",
21
21
  "hairline",
22
- "illustration"
22
+ "illustration",
23
+ "booking",
24
+ "cal.com",
25
+ "meeting-request",
26
+ "contact-form",
27
+ "date-field"
23
28
  ],
24
29
  "author": "dloizides",
25
30
  "license": "MIT",
@@ -30,6 +35,7 @@
30
35
  },
31
36
  "files": [
32
37
  "src",
38
+ "!src/**/*.test.ts",
33
39
  "README.md",
34
40
  "CHANGELOG.md"
35
41
  ],
@@ -48,11 +54,31 @@
48
54
  "./HairlineFigure.astro": "./src/HairlineFigure.astro",
49
55
  "./hairline": "./src/hairline/figures.ts",
50
56
  "./BottomSheet.astro": "./src/BottomSheet.astro",
51
- "./bottomSheet.css": "./src/bottomSheet.css"
57
+ "./bottomSheet.css": "./src/bottomSheet.css",
58
+ "./BookingEmbed.astro": "./src/BookingEmbed.astro",
59
+ "./bookingEmbed": "./src/bookingEmbed/index.ts",
60
+ "./MeetingRequestForm.astro": "./src/MeetingRequestForm.astro",
61
+ "./meetingRequest": "./src/meetingRequest/index.ts",
62
+ "./DateField.astro": "./src/DateField.astro",
63
+ "./dateField": "./src/dateField/index.ts"
64
+ },
65
+ "scripts": {
66
+ "test": "vitest run",
67
+ "lint": "eslint src/bookingEmbed src/dateField src/meetingRequest --ext .ts",
68
+ "typecheck": "tsc --noEmit -p ."
52
69
  },
53
70
  "dependencies": {
54
71
  "@lucasmarkes/hairline": "0.3.0"
55
72
  },
73
+ "devDependencies": {
74
+ "@typescript-eslint/eslint-plugin": "^7.18.0",
75
+ "@typescript-eslint/parser": "^7.18.0",
76
+ "eslint": "^8.57.1",
77
+ "eslint-plugin-sonarjs": "^3.0.7",
78
+ "jsdom": "^25.0.1",
79
+ "typescript": "^5.9.3",
80
+ "vitest": "^2.1.9"
81
+ },
56
82
  "peerDependencies": {
57
83
  "astro": ">=4"
58
84
  },
@@ -0,0 +1,53 @@
1
+ ---
2
+ import { contactDataAttributes, type BookingContact } from './bookingEmbed/contact';
3
+ import { serializeBookingOptions, type BookingEmbedOptions } from './bookingEmbed/options';
4
+
5
+ interface Props {
6
+ /** Unique id; the calendar mounts at `#<id>-calendar`. */
7
+ id: string;
8
+ options: BookingEmbedOptions;
9
+ /** Address parts, joined in the browser only when the fallback shows. */
10
+ contact: BookingContact;
11
+ label: string;
12
+ testId?: string;
13
+ }
14
+
15
+ const { id, options, contact, label, testId } = Astro.props;
16
+ ---
17
+
18
+ <section
19
+ class="tmk-booking"
20
+ id={id}
21
+ aria-label={label}
22
+ data-booking-embed
23
+ data-booking-options={serializeBookingOptions(options)}
24
+ {...contactDataAttributes(contact)}
25
+ data-testid={testId}
26
+ >
27
+ <div class="tmk-booking-calendar" id={`${id}-calendar`} data-booking-calendar tabindex="-1"></div>
28
+ <div class="tmk-booking-fallback" data-booking-fallback hidden>
29
+ <slot name="fallback" />
30
+ </div>
31
+ </section>
32
+
33
+ <style>
34
+ :where(.tmk-booking) {
35
+ display: block;
36
+ width: 100%;
37
+ min-height: var(--tmk-booking-min-height, 640px);
38
+ }
39
+ :where(.tmk-booking-calendar) {
40
+ width: 100%;
41
+ min-height: inherit;
42
+ overflow: auto;
43
+ }
44
+ :where(.tmk-booking[data-booking-state='fallback']) {
45
+ min-height: 0;
46
+ }
47
+ </style>
48
+
49
+ <script>
50
+ import { mountBookingEmbeds } from './bookingEmbed/mount';
51
+
52
+ mountBookingEmbeds();
53
+ </script>
@@ -0,0 +1,85 @@
1
+ ---
2
+ import { dateErrorId, dateFieldControlAria } from './dateField/attributes';
3
+
4
+ interface Props {
5
+ /** Control id; the error block is `<id>-error`. */
6
+ id: string;
7
+ name: string;
8
+ label: string;
9
+ value?: string;
10
+ /** Earliest day, YYYY-MM-DD, inclusive. */
11
+ min?: string;
12
+ /** Latest day, YYYY-MM-DD, inclusive. */
13
+ max?: string;
14
+ required?: boolean;
15
+ autofocus?: boolean;
16
+ /** Error shown on render; marks the control aria-invalid. The `error` slot replaces it for client-rendered messages. */
17
+ error?: string;
18
+ testId?: string;
19
+ }
20
+
21
+ const { id, name, label, value, min, max, required = false, autofocus = false, error, testId } = Astro.props;
22
+ const errorId = dateErrorId(id);
23
+ const aria = dateFieldControlAria({ errorId, error });
24
+ const hasError = error !== undefined && error !== '';
25
+ ---
26
+
27
+ <div class="tmk-df">
28
+ <label class="tmk-df-label" for={id}>{label}</label>
29
+ <input
30
+ class="tmk-df-control"
31
+ id={id}
32
+ name={name}
33
+ type="date"
34
+ value={value}
35
+ min={min}
36
+ max={max}
37
+ required={required}
38
+ autofocus={autofocus}
39
+ {...aria}
40
+ data-testid={testId}
41
+ />
42
+ <p class="tmk-df-error" id={errorId} data-field-error={name} hidden={!hasError}>
43
+ <slot name="error">{error}</slot>
44
+ </p>
45
+ </div>
46
+
47
+ <style>
48
+ :where(.tmk-df) {
49
+ display: grid;
50
+ gap: var(--tmk-df-label-gap, 0.375rem);
51
+ min-width: 0;
52
+ }
53
+ :where(.tmk-df-label) {
54
+ color: var(--tmk-df-label-fg, inherit);
55
+ }
56
+ :where(.tmk-df-control) {
57
+ box-sizing: border-box;
58
+ width: 100%;
59
+ min-height: 44px;
60
+ padding: 0.625rem 0.75rem;
61
+ font: inherit;
62
+ color: var(--tmk-df-fg, inherit);
63
+ background: var(--tmk-df-bg, transparent);
64
+ border: 1px solid var(--tmk-df-border, currentColor);
65
+ border-radius: var(--tmk-df-radius, 0.5rem);
66
+ color-scheme: var(--tmk-df-color-scheme, normal);
67
+ }
68
+ :where(.tmk-df-control:focus-visible) {
69
+ outline: 2px solid var(--tmk-df-focus, currentColor);
70
+ outline-offset: 2px;
71
+ }
72
+ :where(.tmk-df-control)::-webkit-calendar-picker-indicator {
73
+ min-width: 24px;
74
+ min-height: 24px;
75
+ cursor: pointer;
76
+ }
77
+ :where(.tmk-df-control[aria-invalid='true']) {
78
+ border-color: var(--tmk-df-error, currentColor);
79
+ }
80
+ :where(.tmk-df-error) {
81
+ margin: 0;
82
+ color: var(--tmk-df-error, inherit);
83
+ overflow-wrap: anywhere;
84
+ }
85
+ </style>