@contentrain/astro-kit 0.14.0 → 0.15.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/components/announcement/Announcement.astro +1 -1
- package/components/card-grid/CardGrid.astro +1 -1
- package/components/consent/Consent.astro +1 -1
- package/components/faq/Faq.astro +1 -1
- package/components/header/Header.astro +2 -2
- package/components/nav/Nav.astro +5 -5
- package/components/newsletter/Newsletter.astro +1 -1
- package/components/pagination/Pagination.astro +2 -2
- package/components/pricing/Pricing.astro +2 -2
- package/components/slider/Slider.astro +7 -5
- package/components/steps/Steps.astro +1 -1
- package/components/tabs/Tabs.astro +2 -2
- package/components/testimonial/Testimonial.astro +1 -1
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ const announcement = tv({
|
|
|
15
15
|
root: 'relative text-sm not-open:hidden',
|
|
16
16
|
bar: 'mx-auto flex max-w-page items-center justify-center gap-x-3 px-10 py-2 text-center',
|
|
17
17
|
link: 'font-semibold underline decoration-current/40 underline-offset-4 hover:decoration-current',
|
|
18
|
-
close: 'absolute inset-y-0
|
|
18
|
+
close: 'absolute inset-y-0 end-2 flex cursor-pointer list-none items-center px-2 [&::-webkit-details-marker]:hidden',
|
|
19
19
|
},
|
|
20
20
|
variants: {
|
|
21
21
|
tone: {
|
|
@@ -25,7 +25,7 @@ const grid = tv({
|
|
|
25
25
|
bordered: { card: 'border border-line p-6', media: '-mx-6 -mt-6 mb-2 rounded-b-none' },
|
|
26
26
|
elevated: { card: 'bg-surface p-6 text-ink shadow-md ring-1 ring-line/60', media: '-mx-6 -mt-6 mb-2 rounded-b-none' },
|
|
27
27
|
},
|
|
28
|
-
align: { start: { card: 'text-
|
|
28
|
+
align: { start: { card: 'text-start' }, center: { card: 'items-center text-center' } },
|
|
29
29
|
},
|
|
30
30
|
defaultVariants: { columns: '3', style: 'plain', align: 'start' },
|
|
31
31
|
})
|
|
@@ -20,7 +20,7 @@ const consent = tv({
|
|
|
20
20
|
variants: {
|
|
21
21
|
position: {
|
|
22
22
|
bottom: { root: 'inset-x-0 bottom-0 border-x-0 border-b-0 sm:flex sm:items-center sm:justify-between sm:gap-6', actions: 'sm:mt-0 sm:shrink-0' },
|
|
23
|
-
corner: { root: 'inset-x-4 bottom-4 rounded-lg sm:
|
|
23
|
+
corner: { root: 'inset-x-4 bottom-4 rounded-lg sm:start-auto sm:max-w-sm' },
|
|
24
24
|
},
|
|
25
25
|
},
|
|
26
26
|
defaultVariants: { position: 'bottom' },
|
package/components/faq/Faq.astro
CHANGED
|
@@ -26,7 +26,7 @@ const faq = tv({
|
|
|
26
26
|
lines: { list: 'divide-y divide-line border-y border-line' },
|
|
27
27
|
cards: { list: 'gap-3', item: 'rounded-card border border-line px-5', summary: 'py-5' },
|
|
28
28
|
// WordPress's details block: the browser's own disclosure triangle, no rules or box.
|
|
29
|
-
plain: { list: 'gap-2', summary: 'list-item list-[revert] py-1 text-[length:var(--text-body,1rem)] [font-weight:inherit] [&::-webkit-details-marker]:inline', marker: 'hidden', answer: 'pt-2
|
|
29
|
+
plain: { list: 'gap-2', summary: 'list-item list-[revert] py-1 text-[length:var(--text-body,1rem)] [font-weight:inherit] [&::-webkit-details-marker]:inline', marker: 'hidden', answer: 'pt-2 ps-5' },
|
|
30
30
|
},
|
|
31
31
|
tone: { default: {}, muted: { item: 'bg-surface' }, inverse: { answer: 'prose-invert' }, accent: { answer: 'prose-invert' } },
|
|
32
32
|
// heading: the question as a small heading. bold: body size in bold, as accordion and toggle titles often are.
|
|
@@ -17,7 +17,7 @@ const header = tv({
|
|
|
17
17
|
layout: {
|
|
18
18
|
split: { inner: 'justify-between' },
|
|
19
19
|
centered: { inner: 'flex-col gap-3 md:gap-4' },
|
|
20
|
-
'brand-left': { inner: 'justify-start [&>nav]:
|
|
20
|
+
'brand-left': { inner: 'justify-start [&>nav]:ms-10' },
|
|
21
21
|
},
|
|
22
22
|
tone: {
|
|
23
23
|
default: { root: 'border-b border-line bg-surface text-ink' },
|
|
@@ -74,7 +74,7 @@ const wrap = tagline ? 'flex-wrap md:flex-nowrap' : undefined
|
|
|
74
74
|
{showName && <span>{siteName}</span>}
|
|
75
75
|
</a>
|
|
76
76
|
)}
|
|
77
|
-
<div class:list={['flex items-center gap-4', layout === 'centered' ? 'justify-center' : '
|
|
77
|
+
<div class:list={['flex items-center gap-4', layout === 'centered' ? 'justify-center' : 'ms-auto']}>
|
|
78
78
|
<Nav items={items} label={navLabel} menuLabel={menuLabel} closeLabel={closeLabel} part="nav-header" color={linkNav ? 'link' : 'current'} align={layout === 'centered' ? 'center' : 'end'} />
|
|
79
79
|
{action && <Button action={action} size="sm" class="hidden md:inline-flex" />}
|
|
80
80
|
</div>
|
package/components/nav/Nav.astro
CHANGED
|
@@ -15,7 +15,7 @@ const nav = tv({
|
|
|
15
15
|
},
|
|
16
16
|
variants: {
|
|
17
17
|
// Submenus open towards the page: leftwards under an end-aligned menu.
|
|
18
|
-
align: { start: { list: 'justify-start', sub: '
|
|
18
|
+
align: { start: { list: 'justify-start', sub: 'start-0' }, end: { list: 'justify-end', sub: 'end-0' }, center: { list: 'justify-center', sub: 'start-0' } },
|
|
19
19
|
density: { compact: { list: 'gap-5 text-sm' }, comfortable: { list: 'gap-8 text-base' } },
|
|
20
20
|
// current: the surrounding text, dimmed until hovered. link: the site's link colour at full strength, as themes that
|
|
21
21
|
// colour every link draw their menu; the toggle keeps the surrounding text.
|
|
@@ -74,8 +74,8 @@ const drawer = `${id}-drawer`
|
|
|
74
74
|
<svg aria-hidden="true" viewBox="0 0 24 24" class="size-5" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 6h16M4 12h16M4 18h16" /></svg>
|
|
75
75
|
{menuLabel}
|
|
76
76
|
</button>
|
|
77
|
-
<div id={drawer} popover class="m-0
|
|
78
|
-
<button type="button" popovertarget={drawer} popovertargetaction="hide" class="mb-6
|
|
77
|
+
<div id={drawer} popover class="m-0 ms-auto h-dvh max-h-none w-80 max-w-[85vw] border-s border-line bg-surface p-6 text-ink shadow-xl backdrop:bg-ink/40">
|
|
78
|
+
<button type="button" popovertarget={drawer} popovertargetaction="hide" class="mb-6 ms-auto flex items-center gap-2 rounded-md px-3 py-2 text-sm font-medium hover:bg-surface-muted">
|
|
79
79
|
<svg aria-hidden="true" viewBox="0 0 24 24" class="size-5" fill="none" stroke="currentColor" stroke-width="2"><path d="M6 6l12 12M18 6L6 18" /></svg>
|
|
80
80
|
{closeLabel}
|
|
81
81
|
</button>
|
|
@@ -84,7 +84,7 @@ const drawer = `${id}-drawer`
|
|
|
84
84
|
<li>
|
|
85
85
|
<a href={item.href} aria-current={item.href === current ? 'page' : undefined} class="block rounded-md px-3 py-2 text-ink no-underline hover:bg-surface-muted aria-[current=page]:font-semibold">{item.label}</a>
|
|
86
86
|
{item.children && item.children.length > 0 && (
|
|
87
|
-
<ul class="
|
|
87
|
+
<ul class="ms-3 border-s border-line ps-3">
|
|
88
88
|
{item.children.map(child => <li><a href={child.href} class="block rounded-md px-3 py-1.5 text-sm text-ink-muted no-underline hover:text-ink">{child.label}</a></li>)}
|
|
89
89
|
</ul>
|
|
90
90
|
)}
|
|
@@ -100,7 +100,7 @@ const drawer = `${id}-drawer`
|
|
|
100
100
|
<svg aria-hidden="true" viewBox="0 0 24 24" class="size-5" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 6h16M4 12h16M4 18h16" /></svg>
|
|
101
101
|
{menuLabel}
|
|
102
102
|
</summary>
|
|
103
|
-
<ul class="absolute
|
|
103
|
+
<ul class="absolute end-0 z-30 mt-2 flex w-64 flex-col gap-1 rounded-lg border border-line bg-surface p-3 text-ink shadow-lg">
|
|
104
104
|
{items.flatMap(item => [item, ...(item.children ?? [])]).map(item => (
|
|
105
105
|
<li><a href={item.href} aria-current={item.href === current ? 'page' : undefined} class="block rounded-md px-3 py-2 text-sm text-ink no-underline hover:bg-surface-muted">{item.label}</a></li>
|
|
106
106
|
))}
|
|
@@ -99,7 +99,7 @@ const formRel: Record<string, string> = newTab ? { rel: 'noopener noreferrer' }
|
|
|
99
99
|
<input id={`${id}-email`} name={form.email} type="email" required autocomplete="email" inputmode="email" class={s.input()} />
|
|
100
100
|
</div>
|
|
101
101
|
{form.hidden.map(field => (
|
|
102
|
-
<div aria-hidden="true" class="absolute -
|
|
102
|
+
<div aria-hidden="true" class="absolute -start-[5000px]"><input type="text" name={field.name} value={field.value} tabindex="-1" autocomplete="off" /></div>
|
|
103
103
|
))}
|
|
104
104
|
<button type="submit" class={s.submit()}>{submitLabel}</button>
|
|
105
105
|
</form>
|
|
@@ -52,7 +52,7 @@ const shown = [...new Set([1, current - 2, current - 1, current, current + 1, cu
|
|
|
52
52
|
{total > 1 && (
|
|
53
53
|
<nav aria-label={label} data-cr-part="pagination" class={slots.root()}>
|
|
54
54
|
{current > 1
|
|
55
|
-
? <a href={href(current - 1)} rel="prev" class:list={[slots.item(), slots.link()]}><span aria-hidden="true">←</span> <span class="max-sm:sr-only">{prevLabel}</span></a>
|
|
55
|
+
? <a href={href(current - 1)} rel="prev" class:list={[slots.item(), slots.link()]}><span aria-hidden="true" class="inline-block rtl:-scale-x-100">←</span> <span class="max-sm:sr-only">{prevLabel}</span></a>
|
|
56
56
|
: style === 'simple' && <span />}
|
|
57
57
|
{style === 'numbered' && shown.map((page, index) => (
|
|
58
58
|
<>
|
|
@@ -64,6 +64,6 @@ const shown = [...new Set([1, current - 2, current - 1, current, current + 1, cu
|
|
|
64
64
|
</>
|
|
65
65
|
))}
|
|
66
66
|
{style === 'simple' && <span class="text-sm text-ink-muted">{pageLabel} {current} / {total}</span>}
|
|
67
|
-
{current < total && <a href={href(current + 1)} rel="next" class:list={[slots.item(), slots.link()]}><span class="max-sm:sr-only">{nextLabel}</span> <span aria-hidden="true">→</span></a>}
|
|
67
|
+
{current < total && <a href={href(current + 1)} rel="next" class:list={[slots.item(), slots.link()]}><span class="max-sm:sr-only">{nextLabel}</span> <span aria-hidden="true" class="inline-block rtl:-scale-x-100">→</span></a>}
|
|
68
68
|
</nav>
|
|
69
69
|
)}
|
|
@@ -15,13 +15,13 @@ const pricing = tv({
|
|
|
15
15
|
intro: 'text-lg opacity-80',
|
|
16
16
|
list: 'grid items-stretch gap-6 sm:grid-cols-2',
|
|
17
17
|
plan: 'relative flex flex-col gap-5 rounded-card border border-line bg-surface p-6 text-ink md:p-8',
|
|
18
|
-
badge: 'absolute -top-3
|
|
18
|
+
badge: 'absolute -top-3 start-6 rounded-full bg-accent px-3 py-1 text-xs font-semibold text-accent-ink',
|
|
19
19
|
name: 'text-lg [font-weight:var(--font-weight-heading,600)]',
|
|
20
20
|
price: 'flex items-baseline gap-1',
|
|
21
21
|
amount: 'text-4xl [font-weight:var(--font-weight-heading,700)] tracking-tight',
|
|
22
22
|
period: 'text-sm opacity-75',
|
|
23
23
|
description: 'text-pretty opacity-80',
|
|
24
|
-
features: 'prose-site prose max-w-none text-current prose-ul:
|
|
24
|
+
features: 'prose-site prose max-w-none text-current prose-ul:ps-5 prose-li:my-1',
|
|
25
25
|
action: 'mt-auto pt-2',
|
|
26
26
|
},
|
|
27
27
|
variants: {
|
|
@@ -95,11 +95,11 @@ const arrow = 'absolute top-1/2 z-10 hidden size-11 -translate-y-1/2 items-cente
|
|
|
95
95
|
</div>
|
|
96
96
|
{slides.length > 1 && (
|
|
97
97
|
<>
|
|
98
|
-
<button type="button" class:list={[arrow, '
|
|
99
|
-
<svg aria-hidden="true" viewBox="0 0 24 24" class="size-5" fill="none" stroke="currentColor" stroke-width="2"><path d="M15 18l-6-6 6-6" /></svg>
|
|
98
|
+
<button type="button" class:list={[arrow, 'start-6 md:start-10']} aria-label={prevLabel} data-prev>
|
|
99
|
+
<svg aria-hidden="true" viewBox="0 0 24 24" class="size-5 rtl:-scale-x-100" fill="none" stroke="currentColor" stroke-width="2"><path d="M15 18l-6-6 6-6" /></svg>
|
|
100
100
|
</button>
|
|
101
|
-
<button type="button" class:list={[arrow, '
|
|
102
|
-
<svg aria-hidden="true" viewBox="0 0 24 24" class="size-5" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 6l6 6-6 6" /></svg>
|
|
101
|
+
<button type="button" class:list={[arrow, 'end-6 md:end-10']} aria-label={nextLabel} data-next>
|
|
102
|
+
<svg aria-hidden="true" viewBox="0 0 24 24" class="size-5 rtl:-scale-x-100" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 6l6 6-6 6" /></svg>
|
|
103
103
|
</button>
|
|
104
104
|
<div class="mt-4 hidden justify-center group-data-[ready]:flex" data-dots></div>
|
|
105
105
|
</>
|
|
@@ -115,7 +115,9 @@ const arrow = 'absolute top-1/2 z-10 hidden size-11 -translate-y-1/2 items-cente
|
|
|
115
115
|
root.dataset.ready = ''
|
|
116
116
|
// Reduced motion: slides change instantly instead of gliding.
|
|
117
117
|
const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches
|
|
118
|
-
|
|
118
|
+
// A right-to-left page runs the row from the right: the first slide at the start edge, "next" towards the end.
|
|
119
|
+
const direction = getComputedStyle(root).direction === 'rtl' ? 'rtl' : 'ltr'
|
|
120
|
+
const embla = EmblaCarousel(viewport, { loop: root.dataset.loop !== undefined, align: 'start', containScroll: 'trimSnaps', duration: reduce ? 0 : 25, direction })
|
|
119
121
|
const prev = root.querySelector<HTMLButtonElement>('[data-prev]')
|
|
120
122
|
const next = root.querySelector<HTMLButtonElement>('[data-next]')
|
|
121
123
|
const dots = root.querySelector<HTMLElement>('[data-dots]')
|
|
@@ -32,7 +32,7 @@ const steps = tv({
|
|
|
32
32
|
step: "before:flex before:size-10 before:shrink-0 before:items-center before:justify-center before:rounded-full before:bg-accent before:font-semibold before:text-accent-ink before:content-[counter(kit-step)]",
|
|
33
33
|
badge: 'flex h-10 min-w-10 items-center justify-center self-start rounded-full bg-accent px-2 font-semibold text-accent-ink',
|
|
34
34
|
},
|
|
35
|
-
plain: { step: 'border-
|
|
35
|
+
plain: { step: 'border-s-2 border-accent ps-4', badge: 'font-semibold tabular-nums' },
|
|
36
36
|
},
|
|
37
37
|
},
|
|
38
38
|
defaultVariants: { layout: 'list', style: 'numbered' },
|
|
@@ -28,12 +28,12 @@ const tabs = tv({
|
|
|
28
28
|
},
|
|
29
29
|
orientation: {
|
|
30
30
|
horizontal: { list: 'overflow-x-auto' },
|
|
31
|
-
vertical: { root: 'md:data-[ready]:flex-row md:data-[ready]:items-start md:data-[ready]:gap-10', list: 'md:w-56 md:shrink-0 md:flex-col', trigger: 'text-
|
|
31
|
+
vertical: { root: 'md:data-[ready]:flex-row md:data-[ready]:items-start md:data-[ready]:gap-10', list: 'md:w-56 md:shrink-0 md:flex-col', trigger: 'text-start' },
|
|
32
32
|
},
|
|
33
33
|
tone: { default: {}, muted: {}, inverse: { panel: 'prose-invert' }, accent: { panel: 'prose-invert', trigger: 'opacity-100' } },
|
|
34
34
|
},
|
|
35
35
|
compoundVariants: [
|
|
36
|
-
{ style: 'underline', orientation: 'vertical', class: { list: 'md:border-b-0 md:border-
|
|
36
|
+
{ style: 'underline', orientation: 'vertical', class: { list: 'md:border-b-0 md:border-s', trigger: 'md:mb-0 md:-ms-px md:border-b-0 md:border-s-2' } },
|
|
37
37
|
],
|
|
38
38
|
defaultVariants: { style: 'underline', orientation: 'horizontal', tone: 'default' },
|
|
39
39
|
})
|
|
@@ -71,7 +71,7 @@ const quoted = (text: string) => /^\s*["'“‘„«‹「『]/.test(text)
|
|
|
71
71
|
<blockquote class={s.quote()}><p class:list={[!quoted(item.quote) && "before:content-[open-quote] after:content-[close-quote]"]}>{item.quote}</p></blockquote>
|
|
72
72
|
<figcaption class={s.person()}>
|
|
73
73
|
{imageOf(item.avatar, item.avatarAlt) && <KitImage image={imageOf(item.avatar, item.avatarAlt)!} sizes="48px" class="size-12 shrink-0 rounded-full object-cover" />}
|
|
74
|
-
<span class="flex flex-col text-
|
|
74
|
+
<span class="flex flex-col text-start">
|
|
75
75
|
<span class={s.name()}>{item.name}</span>
|
|
76
76
|
{item.role && <span class={s.role()}>{item.role}</span>}
|
|
77
77
|
</span>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentrain/astro-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.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",
|