@contentrain/astro-kit 0.8.0 → 0.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/catalog.json CHANGED
@@ -1204,6 +1204,24 @@
1204
1204
  },
1205
1205
  "description": "Social profile links (site.same_as)."
1206
1206
  },
1207
+ "contact": {
1208
+ "type": "object",
1209
+ "fields": {
1210
+ "address": {
1211
+ "type": "text",
1212
+ "description": "Postal address; line breaks are kept."
1213
+ },
1214
+ "phone": {
1215
+ "type": "string",
1216
+ "description": "Phone number, linked as tel: when it has digits."
1217
+ },
1218
+ "email": {
1219
+ "type": "email",
1220
+ "description": "Email address, linked as mailto:."
1221
+ }
1222
+ },
1223
+ "description": "Contact details printed in an address block under the tagline; the block is left out when none is set."
1224
+ },
1207
1225
  "copyright": {
1208
1226
  "type": "string",
1209
1227
  "description": "Copyright line; {year} is the current year. Defaults to © <year> <siteName>."
@@ -37,6 +37,8 @@ interface Props {
37
37
  /** A single row of links (the footer menu). */
38
38
  links?: LinkInput[] | undefined
39
39
  social?: LinkInput[] | undefined
40
+ /** Contact details printed in an `<address>` block; each is optional, and the block is left out when none is set. */
41
+ contact?: { address?: string | undefined, phone?: string | undefined, email?: string | undefined } | undefined
40
42
  /** The copyright line, e.g. "© 2026 Northwind Studio"; `{year}` is the current year. */
41
43
  copyright?: string | undefined
42
44
  /** Label of the cookie settings link after the copyright line ("Cookie settings"); it reopens the consent bar, so a visitor can withdraw consent as easily as they gave it. Only with a consent bar on the page. */
@@ -48,9 +50,11 @@ interface Props {
48
50
  align?: 'start' | 'center' | undefined
49
51
  }
50
52
 
51
- const { siteName, tagline, columns = [], links = [], social = [], copyright, consentLabel, navLabel = 'Footer', layout = 'simple', tone, align } = Astro.props
53
+ const { siteName, tagline, columns = [], links = [], social = [], contact, copyright, consentLabel, navLabel = 'Footer', layout = 'simple', tone, align } = Astro.props
52
54
  const { root, inner, muted, link } = footer({ layout, tone, align })
53
55
  const year = String(new Date().getFullYear())
56
+ const phoneHref = contact?.phone?.replace(/[^\d+]/g, '')
57
+ const hasContact = Boolean(contact?.address || contact?.phone || contact?.email)
54
58
  const line = copyright?.replaceAll('{year}', year) ?? `© ${year} ${siteName}`
55
59
  ---
56
60
  <!-- The cookie settings control is a button, not a link: the Consent component's listener reopens its bar on any [data-kit-consent-open]. -->
@@ -59,6 +63,13 @@ const line = copyright?.replaceAll('{year}', year) ?? `© ${year} ${siteName}`
59
63
  <div class="flex flex-col gap-3">
60
64
  <p class="text-base font-semibold" data-kit-brand>{siteName}</p>
61
65
  {tagline && <p class={muted()} data-kit-tagline>{tagline}</p>}
66
+ {hasContact && (
67
+ <address class={`${muted()} flex flex-col gap-1 not-italic`} data-kit-contact>
68
+ {contact?.address && <span class="whitespace-pre-line">{contact.address}</span>}
69
+ {contact?.phone && (phoneHref ? <a href={`tel:${phoneHref}`} class={link()}>{contact.phone}</a> : <span>{contact.phone}</span>)}
70
+ {contact?.email && <a href={`mailto:${contact.email}`} class={link()}>{contact.email}</a>}
71
+ </address>
72
+ )}
62
73
  {layout === 'columns' && <p class:list={[muted(), 'mt-auto pt-6']}>{line}{consentLabel && <> · <button type="button" data-kit-consent-open class={link()}>{consentLabel}</button></>}</p>}
63
74
  </div>
64
75
  {layout === 'columns'
@@ -99,6 +99,15 @@
99
99
  },
100
100
  "description": "Social profile links (site.same_as)."
101
101
  },
102
+ "contact": {
103
+ "type": "object",
104
+ "fields": {
105
+ "address": { "type": "text", "description": "Postal address; line breaks are kept." },
106
+ "phone": { "type": "string", "description": "Phone number, linked as tel: when it has digits." },
107
+ "email": { "type": "email", "description": "Email address, linked as mailto:." }
108
+ },
109
+ "description": "Contact details printed in an address block under the tagline; the block is left out when none is set."
110
+ },
102
111
  "copyright": {
103
112
  "type": "string",
104
113
  "description": "Copyright line; {year} is the current year. Defaults to © <year> <siteName>."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentrain/astro-kit",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "license": "MIT",
5
5
  "description": "Copy-in Astro components for Contentrain sites (shadcn model): typed props, tailwind-variants, zero JavaScript by default — with a machine-readable catalog",
6
6
  "type": "module",
@@ -42,7 +42,7 @@
42
42
  "mapping"
43
43
  ],
44
44
  "dependencies": {
45
- "@contentrain/types": "1.32.0"
45
+ "@contentrain/types": "1.32.1"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/node": "^22.10.0",