@contentrain/astro-kit 0.13.0 → 0.14.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
@@ -1606,6 +1606,22 @@
1606
1606
  ],
1607
1607
  "default": "inherit",
1608
1608
  "description": "The lead's alignment. inherit: as the layout sets it. start: at the start edge and across the column, under a centred heading (a centred heading widget over a left-aligned text editor in one container)."
1609
+ },
1610
+ "actionsAlign": {
1611
+ "options": [
1612
+ "inherit",
1613
+ "start"
1614
+ ],
1615
+ "default": "inherit",
1616
+ "description": "The buttons' alignment. inherit: as the layout sets it. start: at the start edge, under centred text (a WordPress buttons block with no justification inside a centred cover)."
1617
+ },
1618
+ "width": {
1619
+ "options": [
1620
+ "full",
1621
+ "content"
1622
+ ],
1623
+ "default": "full",
1624
+ "description": "Layout cover only. full: the image runs the full window width. content: the cover sits in the reading column, as a WordPress cover block that is not alignfull does under the page title."
1609
1625
  }
1610
1626
  },
1611
1627
  "props": {
@@ -30,13 +30,22 @@ const hero = tv({
30
30
  // The lead's own alignment: `start` keeps it at the start edge, across the column, under a centred heading
31
31
  // (Hello centres the heading widget and leaves the text editor left in the same container).
32
32
  leadAlign: { inherit: {}, start: {} },
33
+ // The buttons' own alignment: `start` keeps them at the start edge under centred text (a WordPress buttons block
34
+ // with no justification sits left inside a cover whose heading and paragraph are centred).
35
+ actionsAlign: { inherit: {}, start: {} },
36
+ // How wide a cover runs: the full window, or the reading column — a WordPress cover block that is not
37
+ // alignfull sits in the content column, the page title above it.
38
+ width: { full: {}, content: {} },
33
39
  },
34
40
  compoundVariants: [
41
+ // After the layout's own heights, so a boxed cover keeps WordPress's 430px default.
42
+ { layout: 'cover', width: 'content', class: { grid: 'min-h-[20rem] md:min-h-[26.875rem]' } },
35
43
  { layout: 'cover', align: 'center', class: { grid: 'justify-items-center', copy: 'mx-auto items-center text-center', lead: 'mx-auto', actions: 'justify-center' } },
36
44
  // After the centring rules, so the lead leaves them.
37
45
  { leadAlign: 'start', class: { lead: 'mx-0 max-w-none self-stretch text-start' } },
46
+ { actionsAlign: 'start', class: { actions: 'justify-start self-stretch' } },
38
47
  ],
39
- defaultVariants: { layout: 'split', tone: 'default', align: 'center', leadAlign: 'inherit' },
48
+ defaultVariants: { layout: 'split', tone: 'default', align: 'center', leadAlign: 'inherit', actionsAlign: 'inherit', width: 'full' },
40
49
  })
41
50
 
42
51
  interface Props {
@@ -52,17 +61,40 @@ interface Props {
52
61
  align?: 'start' | 'center' | undefined
53
62
  /** The lead's alignment: as the layout sets it, or at the start edge under a centred heading. */
54
63
  leadAlign?: 'inherit' | 'start' | undefined
64
+ /** The buttons' alignment: as the layout sets it, or at the start edge under centred text. */
65
+ actionsAlign?: 'inherit' | 'start' | undefined
66
+ /** A cover's width: the full window (the default) or the reading column; other layouts ignore it. */
67
+ width?: 'full' | 'content' | undefined
55
68
  tone?: 'default' | 'muted' | 'inverse' | 'accent' | undefined
56
69
  id?: string | undefined
57
70
  }
58
71
 
59
- const { heading, level = 1, eyebrow, lead, actions = [], image, layout = 'split', align, leadAlign, tone, id } = Astro.props
60
- const s = hero({ layout, align, leadAlign, tone })
72
+ const { heading, level = 1, eyebrow, lead, actions = [], image, layout = 'split', align, leadAlign, actionsAlign, width = 'full', tone, id } = Astro.props
73
+ const s = hero({ layout, align, leadAlign, actionsAlign, width, tone })
61
74
  const Heading = level === 1 ? 'h1' : 'h2'
62
75
  const headingId = id ? `${id}-title` : undefined
63
76
  const cover = layout === 'cover' && image
64
77
  ---
65
- {cover
78
+ {cover && width === 'content'
79
+ ? (
80
+ <Section tone="none" spacing="sm" width="prose" id={id} aria-labelledby={headingId}>
81
+ <div class="relative isolate overflow-hidden bg-ink text-surface">
82
+ <KitImage image={image} priority sizes="(min-width: 768px) 46rem, 100vw" class="absolute inset-0 -z-10 h-full w-full object-cover" />
83
+ <div class="absolute inset-0 -z-10 bg-ink/60" aria-hidden="true" />
84
+ <div class="px-6 py-10 md:px-10">
85
+ <div class={s.grid()}>
86
+ <div class={s.copy()}>
87
+ {eyebrow && <p class={s.eyebrow()}>{eyebrow}</p>}
88
+ <Heading id={headingId} class={s.heading()}>{heading}</Heading>
89
+ {lead && <p class={s.lead()} data-kit-text>{lead}</p>}
90
+ {actions.length > 0 && <div class={s.actions()}>{actions.map(action => <Button action={action} size="lg" />)}</div>}
91
+ </div>
92
+ </div>
93
+ </div>
94
+ </div>
95
+ </Section>
96
+ )
97
+ : cover
66
98
  ? (
67
99
  <Section tone="inverse" spacing="none" width="none" id={id} aria-labelledby={headingId} class="relative isolate overflow-hidden">
68
100
  <KitImage image={image} priority sizes="100vw" class="absolute inset-0 -z-10 h-full w-full object-cover" />
@@ -122,5 +122,50 @@
122
122
  "leadAlign": "start",
123
123
  "level": 2
124
124
  }
125
+ },
126
+ {
127
+ "name": "cover-content",
128
+ "props": {
129
+ "heading": "The long way round",
130
+ "lead": "A year of trains across Europe, one station at a time.",
131
+ "layout": "cover",
132
+ "actions": [
133
+ {
134
+ "label": "Read the series",
135
+ "href": "/series/long-way/"
136
+ }
137
+ ],
138
+ "image": {
139
+ "src": "/kit-fixtures/photo-3.svg",
140
+ "alt": "",
141
+ "width": 1600,
142
+ "height": 900
143
+ },
144
+ "width": "content",
145
+ "level": 2
146
+ }
147
+ },
148
+ {
149
+ "name": "cover-content-actions-start",
150
+ "props": {
151
+ "heading": "The long way round",
152
+ "lead": "A year of trains across Europe, one station at a time.",
153
+ "layout": "cover",
154
+ "actions": [
155
+ {
156
+ "label": "Read the series",
157
+ "href": "/series/long-way/"
158
+ }
159
+ ],
160
+ "image": {
161
+ "src": "/kit-fixtures/photo-3.svg",
162
+ "alt": "",
163
+ "width": 1600,
164
+ "height": 900
165
+ },
166
+ "width": "content",
167
+ "level": 2,
168
+ "actionsAlign": "start"
169
+ }
125
170
  }
126
171
  ]
@@ -45,6 +45,22 @@
45
45
  ],
46
46
  "default": "inherit",
47
47
  "description": "The lead's alignment. inherit: as the layout sets it. start: at the start edge and across the column, under a centred heading (a centred heading widget over a left-aligned text editor in one container)."
48
+ },
49
+ "actionsAlign": {
50
+ "options": [
51
+ "inherit",
52
+ "start"
53
+ ],
54
+ "default": "inherit",
55
+ "description": "The buttons' alignment. inherit: as the layout sets it. start: at the start edge, under centred text (a WordPress buttons block with no justification inside a centred cover)."
56
+ },
57
+ "width": {
58
+ "options": [
59
+ "full",
60
+ "content"
61
+ ],
62
+ "default": "full",
63
+ "description": "Layout cover only. full: the image runs the full window width. content: the cover sits in the reading column, as a WordPress cover block that is not alignfull does under the page title."
48
64
  }
49
65
  },
50
66
  "props": {
@@ -218,7 +218,8 @@
218
218
  "component": "hero",
219
219
  "variant": {
220
220
  "layout": "cover",
221
- "align": "class:is-position-*-left=start|center"
221
+ "align": "class:is-position-*-left=start|center",
222
+ "width": "class:alignfull=full|content"
222
223
  },
223
224
  "props": {
224
225
  "heading": "dom:h1,h2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentrain/astro-kit",
3
- "version": "0.13.0",
3
+ "version": "0.14.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",