@leitware/composables 1.7.0 → 2.0.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.
@@ -1,242 +0,0 @@
1
- import { useState } from 'react'
2
- import { ArrowRightIcon } from 'lucide-react'
3
- import { Avatar } from '../avatar'
4
- import { BentoCell, BentoGrid } from '../layout-bento'
5
- import { cn } from '../../lib/utils'
6
- import {
7
- BlockAction,
8
- BlockHeading,
9
- BlockImage,
10
- BlockSection,
11
- type BlockBaseProps,
12
- type BlockCTA,
13
- type BlockMedia,
14
- } from './shared'
15
-
16
- type FeatureItem = { id: string; title: string; description: string; media: BlockMedia }
17
-
18
- export interface Feature01Props extends BlockBaseProps {
19
- items: FeatureItem[]
20
- }
21
- export function Feature01({ items, variant, animation, className }: Feature01Props) {
22
- const [active, setActive] = useState(0)
23
- const current = items[active]
24
- return (
25
- <BlockSection variant={variant} animation={animation} className={className}>
26
- <div className="grid gap-10 md:grid-cols-2">
27
- <div className="divide-y divide-[var(--border-default)] border-y border-stroke-default">
28
- {items.map((item, index) => (
29
- <button
30
- key={item.id}
31
- type="button"
32
- onClick={() => setActive(index)}
33
- aria-pressed={active === index}
34
- className={cn(
35
- 'group flex w-full items-start gap-5 py-6 text-left transition-colors',
36
- active === index ? 'text-default' : 'text-[var(--text-muted)] hover:text-default',
37
- )}
38
- >
39
- <span className="pt-1 text-xs tabular-nums">{item.id}</span>
40
- <span className="flex-1">
41
- <span className="block font-heading text-2xl">{item.title}</span>
42
- {active === index && (
43
- <span className="mt-3 block max-w-md text-sm leading-relaxed text-[var(--text-secondary)]">
44
- {item.description}
45
- </span>
46
- )}
47
- </span>
48
- <ArrowRightIcon className="mt-1 size-4" />
49
- </button>
50
- ))}
51
- </div>
52
- <div className="aspect-[4/3] overflow-hidden rounded-xl bg-surface-accent">
53
- {current && <BlockImage media={current.media} />}
54
- </div>
55
- </div>
56
- </BlockSection>
57
- )
58
- }
59
-
60
- export interface Feature02Props extends BlockBaseProps {
61
- title: string
62
- description: string
63
- image: string
64
- imageAlt: string
65
- steps: { number: string; title: string; description: string }[]
66
- }
67
- export function Feature02({
68
- title,
69
- description,
70
- image,
71
- imageAlt,
72
- steps,
73
- animation,
74
- className,
75
- }: Feature02Props) {
76
- const midpoint = Math.ceil(steps.length / 2)
77
- const Step = ({
78
- number,
79
- title: stepTitle,
80
- description: stepDescription,
81
- }: (typeof steps)[number]) => (
82
- <div className="border-t border-stroke-default pt-5">
83
- <span className="text-xs text-brand">{number}</span>
84
- <h3 className="mt-4 text-xl font-semibold">{stepTitle}</h3>
85
- <p className="mt-3 text-sm leading-relaxed text-[var(--text-secondary)]">{stepDescription}</p>
86
- </div>
87
- )
88
- return (
89
- <BlockSection animation={animation} className={className}>
90
- <div className="grid gap-8 md:grid-cols-2">
91
- <BlockHeading title={title} />
92
- <p className="self-end text-[var(--text-secondary)]">{description}</p>
93
- </div>
94
- <div className="mt-14 grid gap-8 lg:grid-cols-[1fr_1.2fr_1fr]">
95
- <div className="flex flex-col justify-around gap-8">
96
- {steps.slice(0, midpoint).map((step) => (
97
- <Step key={step.number} {...step} />
98
- ))}
99
- </div>
100
- <div className="min-h-[34rem] overflow-hidden rounded-xl bg-surface-accent">
101
- <BlockImage media={{ src: image, alt: imageAlt }} />
102
- </div>
103
- <div className="flex flex-col justify-around gap-8">
104
- {steps.slice(midpoint).map((step) => (
105
- <Step key={step.number} {...step} />
106
- ))}
107
- </div>
108
- </div>
109
- </BlockSection>
110
- )
111
- }
112
-
113
- export interface Feature03Props extends BlockBaseProps {
114
- title: string
115
- description: string
116
- items: FeatureItem[]
117
- }
118
- export function Feature03({
119
- title,
120
- description,
121
- items,
122
- variant,
123
- animation,
124
- className,
125
- }: Feature03Props) {
126
- return (
127
- <BlockSection variant={variant} animation={animation} className={className}>
128
- <div className="grid gap-12 lg:grid-cols-2">
129
- <div className="self-start lg:sticky lg:top-12">
130
- <BlockHeading title={title} description={description} />
131
- </div>
132
- <div className="space-y-14">
133
- {items.map((item) => (
134
- <article key={item.id}>
135
- <div className="aspect-[4/3] overflow-hidden rounded-xl bg-surface-accent">
136
- <BlockImage media={item.media} />
137
- </div>
138
- <div className="mt-5 flex gap-5 border-t border-stroke-default pt-5">
139
- <span className="text-xs text-[var(--text-muted)]">{item.id}</span>
140
- <div>
141
- <h3 className="text-xl font-semibold">{item.title}</h3>
142
- <p className="mt-3 text-sm leading-relaxed text-[var(--text-secondary)]">
143
- {item.description}
144
- </p>
145
- </div>
146
- </div>
147
- </article>
148
- ))}
149
- </div>
150
- </div>
151
- </BlockSection>
152
- )
153
- }
154
-
155
- export interface Cta01Props extends BlockBaseProps {
156
- title: string
157
- description: string
158
- cta?: BlockCTA
159
- }
160
- export function Cta01({ title, description, cta, className }: Cta01Props) {
161
- return (
162
- <BlockSection className={cn('text-center', className)}>
163
- <BlockHeading title={title} description={description} centered className="[&_p]:mx-auto" />
164
- <BlockAction action={cta} className="mt-8" />
165
- </BlockSection>
166
- )
167
- }
168
-
169
- type BentoMedia = { src: string; title: string }
170
- type BentoItem = { title: string; description: string; media: BentoMedia }
171
- export interface BentoGrids01Props extends BlockBaseProps {
172
- primary: BentoItem & { cta?: BlockCTA }
173
- items: BentoItem[]
174
- }
175
- export function BentoGrids01({ primary, items, className }: BentoGrids01Props) {
176
- return (
177
- <BlockSection className={className}>
178
- <BentoGrid cols={3} className="gap-3 bg-transparent p-0">
179
- <BentoCell
180
- colSpan={2}
181
- rowSpan={2}
182
- className="relative flex min-h-[32rem] flex-col justify-end overflow-hidden p-0"
183
- >
184
- <BlockImage
185
- media={{ src: primary.media.src, alt: primary.media.title }}
186
- className="absolute inset-0"
187
- />
188
- <div className="absolute inset-0 bg-gradient-to-t from-black/85 via-black/20 to-transparent" />
189
- <div className="relative p-8 text-white">
190
- <h2 className="font-heading text-3xl">{primary.title}</h2>
191
- <p className="mt-3 max-w-md text-sm">{primary.description}</p>
192
- <BlockAction action={primary.cta} className="mt-6" />
193
- </div>
194
- </BentoCell>
195
- {items.map((item) => (
196
- <BentoCell
197
- key={item.title}
198
- className="relative flex min-h-56 flex-col justify-end overflow-hidden p-0"
199
- >
200
- <BlockImage
201
- media={{ src: item.media.src, alt: item.media.title }}
202
- className="absolute inset-0"
203
- />
204
- <div className="absolute inset-0 bg-gradient-to-t from-black/80 to-transparent" />
205
- <div className="relative p-5 text-white">
206
- <h3 className="text-lg font-semibold">{item.title}</h3>
207
- <p className="mt-2 text-xs">{item.description}</p>
208
- </div>
209
- </BentoCell>
210
- ))}
211
- </BentoGrid>
212
- </BlockSection>
213
- )
214
- }
215
-
216
- export interface Testimonials01Props extends BlockBaseProps {
217
- quote: string
218
- author: { name: string; role: string; avatar: { src?: string; alt?: string; fallback: string } }
219
- }
220
- export function Testimonials01({ quote, author, className }: Testimonials01Props) {
221
- return (
222
- <BlockSection className={cn('text-center', className)}>
223
- <figure className="mx-auto max-w-3xl py-12">
224
- <blockquote className="font-heading text-2xl leading-snug tracking-tight md:text-4xl">
225
- “{quote}”
226
- </blockquote>
227
- <figcaption className="mt-9 flex items-center justify-center gap-4 text-left">
228
- <Avatar
229
- src={author.avatar.src}
230
- alt={author.avatar.alt ?? author.name}
231
- fallback={author.avatar.fallback}
232
- size="lg"
233
- />
234
- <span>
235
- <span className="block text-sm font-semibold">{author.name}</span>
236
- <span className="mt-1 block text-xs text-[var(--text-muted)]">{author.role}</span>
237
- </span>
238
- </figcaption>
239
- </figure>
240
- </BlockSection>
241
- )
242
- }