@leitware/composables 1.7.1 → 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,4 +0,0 @@
1
- export * from './content'
2
- export * from './features'
3
- export * from './heroes'
4
- export type { BlockAnimation, BlockBaseProps, BlockCTA, BlockMedia, BlockVariant } from './shared'
@@ -1,185 +0,0 @@
1
- import type * as React from 'react'
2
- import { ArrowRightIcon } from 'lucide-react'
3
- import { cn } from '../../lib/utils'
4
- import { Button, type ButtonProps } from '../button'
5
- import { Container } from '../container'
6
- import { WindowFrame } from '../window-frame'
7
-
8
- export type BlockAnimation = 'none' | 'subtle'
9
- export type BlockVariant = 'standard' | 'muted' | 'inverse'
10
- export type BlockMedia = { src: string; alt: string }
11
- export type BlockCTA = {
12
- ctaEnabled?: boolean
13
- text: string
14
- link?: string
15
- variant?: ButtonProps['variant']
16
- size?: ButtonProps['size']
17
- }
18
- export type BlockBaseProps = {
19
- className?: string
20
- variant?: BlockVariant
21
- animation?: BlockAnimation
22
- }
23
-
24
- export function BlockSection({
25
- children,
26
- className,
27
- variant = 'standard',
28
- animation = 'none',
29
- fullWidth = false,
30
- }: BlockBaseProps & { children: React.ReactNode; fullWidth?: boolean }) {
31
- return (
32
- <section
33
- data-slot="block"
34
- data-variant={variant}
35
- className={cn(
36
- 'relative isolate overflow-hidden py-16 md:py-24',
37
- variant === 'standard' && 'bg-default text-default',
38
- variant === 'muted' && 'bg-muted text-default',
39
- variant === 'inverse' &&
40
- 'bg-inverse text-inverse [--text-secondary:var(--text-inverse)] [--text-muted:var(--text-inverse)]',
41
- animation === 'subtle' &&
42
- 'motion-safe:animate-in motion-safe:fade-in motion-safe:duration-700',
43
- className,
44
- )}
45
- >
46
- {fullWidth ? children : <Container maxWidth="2xl">{children}</Container>}
47
- </section>
48
- )
49
- }
50
-
51
- export function BlockHeading({
52
- title,
53
- description,
54
- centered = false,
55
- className,
56
- }: {
57
- title: string
58
- description?: string
59
- centered?: boolean
60
- className?: string
61
- }) {
62
- return (
63
- <div className={cn('max-w-3xl', centered && 'mx-auto text-center', className)}>
64
- <h2 className="font-heading text-4xl leading-tight tracking-tight md:text-5xl">{title}</h2>
65
- {description && (
66
- <p className="mt-5 max-w-2xl text-base leading-relaxed text-[var(--text-secondary)]">
67
- {description}
68
- </p>
69
- )}
70
- </div>
71
- )
72
- }
73
-
74
- export function BlockImage({
75
- media,
76
- className,
77
- priority = false,
78
- }: {
79
- media: BlockMedia
80
- className?: string
81
- priority?: boolean
82
- }) {
83
- return (
84
- <img
85
- src={media.src}
86
- alt={media.alt}
87
- loading={priority ? 'eager' : 'lazy'}
88
- className={cn('h-full w-full object-cover', className)}
89
- />
90
- )
91
- }
92
-
93
- export function BlockAction({
94
- action,
95
- className,
96
- arrow = false,
97
- }: {
98
- action?: BlockCTA
99
- className?: string
100
- arrow?: boolean
101
- }) {
102
- if (!action || action.ctaEnabled === false) return null
103
- const content = (
104
- <>
105
- {action.text}
106
- {arrow && <ArrowRightIcon aria-hidden="true" />}
107
- </>
108
- )
109
- return (
110
- <Button
111
- render={action.link ? <a href={action.link} /> : undefined}
112
- variant={action.variant ?? 'default'}
113
- size={action.size ?? 'lg'}
114
- shape="pill"
115
- className={cn('min-h-10 px-5', className)}
116
- >
117
- {content}
118
- </Button>
119
- )
120
- }
121
-
122
- export function BlockActions({
123
- primary,
124
- secondary,
125
- centered = false,
126
- }: {
127
- primary?: BlockCTA
128
- secondary?: BlockCTA
129
- centered?: boolean
130
- }) {
131
- if (!primary && !secondary) return null
132
- return (
133
- <div className={cn('mt-8 flex flex-wrap items-center gap-3', centered && 'justify-center')}>
134
- <BlockAction action={primary} />
135
- <BlockAction action={secondary} />
136
- </div>
137
- )
138
- }
139
-
140
- export function BlockLogos({ label, logos }: { label?: string; logos?: string[] }) {
141
- if (!logos?.length) return null
142
- return (
143
- <div className="mt-14 border-t border-stroke-default pt-6 text-center">
144
- {label && (
145
- <p className="mb-5 text-xs uppercase tracking-wider text-[var(--text-muted)]">{label}</p>
146
- )}
147
- <div className="flex flex-wrap items-center justify-center gap-x-10 gap-y-4 text-sm font-semibold text-[var(--text-secondary)]">
148
- {logos.map((logo) => (
149
- <span key={logo}>{logo}</span>
150
- ))}
151
- </div>
152
- </div>
153
- )
154
- }
155
-
156
- export function BlockDashboard({ className }: { className?: string }) {
157
- return (
158
- <WindowFrame
159
- role="group"
160
- aria-label="Product dashboard illustration"
161
- className={className}
162
- toolbar={<span aria-hidden="true" className="h-2 w-20 rounded-full bg-surface-accent" />}
163
- >
164
- <div className="grid gap-3 sm:grid-cols-3">
165
- {['Revenue', 'Customers', 'Growth'].map((label, index) => (
166
- <div key={label} className="rounded-lg border border-stroke-default bg-default p-4">
167
- <p className="text-xs text-[var(--text-muted)]">{label}</p>
168
- <p className="mt-3 text-2xl font-semibold text-default">
169
- {['£48,290', '2,410', '+18.6%'][index]}
170
- </p>
171
- </div>
172
- ))}
173
- </div>
174
- <div className="mt-3 flex h-40 items-end gap-2 rounded-lg border border-stroke-default bg-default p-5">
175
- {[32, 48, 38, 68, 52, 75, 61, 92, 70, 85, 72, 100].map((height, index) => (
176
- <span
177
- key={index}
178
- className="flex-1 rounded-t-sm bg-fill-brand"
179
- style={{ height: `${height}%`, opacity: 0.4 + index / 20 }}
180
- />
181
- ))}
182
- </div>
183
- </WindowFrame>
184
- )
185
- }