@zerodev/react-ui 0.0.2 → 0.0.4
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/README.md +1 -0
- package/dist/_types/components/ArrowCardPair/index.d.ts +10 -0
- package/dist/_types/components/ArrowCardPair/index.d.ts.map +1 -0
- package/dist/_types/components/Badge/index.d.ts +1 -1
- package/dist/_types/components/Badge/index.d.ts.map +1 -1
- package/dist/_types/components/BottomSheet/index.d.ts +17 -0
- package/dist/_types/components/BottomSheet/index.d.ts.map +1 -0
- package/dist/_types/components/Button/index.d.ts +1 -1
- package/dist/_types/components/Button/index.d.ts.map +1 -1
- package/dist/_types/components/Callout/index.d.ts +1 -1
- package/dist/_types/components/Callout/index.d.ts.map +1 -1
- package/dist/_types/components/DataRow/index.d.ts +33 -0
- package/dist/_types/components/DataRow/index.d.ts.map +1 -0
- package/dist/_types/components/Icon/index.d.ts +1 -1
- package/dist/_types/components/Icon/index.d.ts.map +1 -1
- package/dist/_types/components/IconButton/index.d.ts +1 -1
- package/dist/_types/components/IconButton/index.d.ts.map +1 -1
- package/dist/_types/components/Input/index.d.ts +1 -1
- package/dist/_types/components/Input/index.d.ts.map +1 -1
- package/dist/_types/components/ListItem/index.d.ts +32 -15
- package/dist/_types/components/ListItem/index.d.ts.map +1 -1
- package/dist/_types/components/Pill/index.d.ts +25 -0
- package/dist/_types/components/Pill/index.d.ts.map +1 -0
- package/dist/_types/components/PoweredBy/index.d.ts +6 -0
- package/dist/_types/components/PoweredBy/index.d.ts.map +1 -0
- package/dist/_types/components/Screen/EllipticalRadial.d.ts +23 -0
- package/dist/_types/components/Screen/EllipticalRadial.d.ts.map +1 -0
- package/dist/_types/components/Screen/MultiRadialBackground.d.ts +4 -0
- package/dist/_types/components/Screen/MultiRadialBackground.d.ts.map +1 -0
- package/dist/_types/components/Screen/index.d.ts +15 -0
- package/dist/_types/components/Screen/index.d.ts.map +1 -0
- package/dist/_types/components/Select/index.d.ts +28 -0
- package/dist/_types/components/Select/index.d.ts.map +1 -0
- package/dist/_types/components/Switch/index.d.ts +1 -1
- package/dist/_types/components/Switch/index.d.ts.map +1 -1
- package/dist/_types/components/Text/index.d.ts +1 -1
- package/dist/_types/components/Text/index.d.ts.map +1 -1
- package/dist/_types/components/TokenListItem/index.d.ts +33 -0
- package/dist/_types/components/TokenListItem/index.d.ts.map +1 -0
- package/dist/_types/components/TopNav/index.d.ts +20 -0
- package/dist/_types/components/TopNav/index.d.ts.map +1 -0
- package/dist/_types/components/WrappedPressable/index.d.ts +1 -1
- package/dist/_types/components/WrappedPressable/index.d.ts.map +1 -1
- package/dist/_types/components/Wrapper/index.d.ts +3 -2
- package/dist/_types/components/Wrapper/index.d.ts.map +1 -1
- package/dist/_types/components/ZeroDevLogo/index.d.ts +12 -0
- package/dist/_types/components/ZeroDevLogo/index.d.ts.map +1 -0
- package/dist/_types/index.d.ts +11 -1
- package/dist/_types/index.d.ts.map +1 -1
- package/dist/index.cjs +111 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +6164 -1199
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +2 -2
- package/package.json +7 -5
- package/src/components/ArrowCardPair/index.tsx +148 -0
- package/src/components/BottomSheet/index.tsx +57 -0
- package/src/components/DataRow/index.tsx +140 -0
- package/src/components/ListItem/index.tsx +74 -79
- package/src/components/Pill/index.tsx +167 -0
- package/src/components/PoweredBy/index.tsx +29 -0
- package/src/components/Screen/EllipticalRadial.tsx +65 -0
- package/src/components/Screen/MultiRadialBackground.tsx +323 -0
- package/src/components/Screen/index.tsx +121 -0
- package/src/components/Select/index.tsx +153 -0
- package/src/components/TokenListItem/index.tsx +192 -0
- package/src/components/TopNav/index.tsx +67 -0
- package/src/components/Wrapper/index.tsx +4 -1
- package/src/components/ZeroDevLogo/index.tsx +55 -0
- package/src/index.ts +50 -0
- package/src/svg.d.ts +9 -0
- package/tailwind.config.ts +39 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import type { HTMLAttributes, KeyboardEvent, ReactNode, Ref } from 'react'
|
|
2
|
+
import { cn } from '../../utils/common'
|
|
3
|
+
import { Text } from '../Text'
|
|
4
|
+
import { Wrapper } from '../Wrapper'
|
|
5
|
+
|
|
6
|
+
export interface PillProps
|
|
7
|
+
extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
8
|
+
/** Text label rendered next to the logo (e.g., "USDC", "Base"). */
|
|
9
|
+
label: string
|
|
10
|
+
/** URL of the logo image; when omitted, a neutral placeholder disc with the
|
|
11
|
+
* first letter of `label` is drawn. */
|
|
12
|
+
logoUri?: string
|
|
13
|
+
/** Click handler; when supplied and not `disabled`, the pill becomes a keyboard-accessible button. */
|
|
14
|
+
onClick?: () => void
|
|
15
|
+
/** When true, renders as a dimmed, non-interactive pill. */
|
|
16
|
+
disabled?: boolean
|
|
17
|
+
/** Render a pulsing skeleton placeholder instead of the content. */
|
|
18
|
+
loading?: boolean
|
|
19
|
+
/** Optional trailing affordance (e.g., `<SelectIcon />`). Rendered in a padded slot on the right. */
|
|
20
|
+
trailingIcon?: ReactNode
|
|
21
|
+
ref?: Ref<HTMLDivElement>
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function Pill({
|
|
25
|
+
label,
|
|
26
|
+
logoUri,
|
|
27
|
+
onClick,
|
|
28
|
+
disabled,
|
|
29
|
+
loading,
|
|
30
|
+
trailingIcon,
|
|
31
|
+
className,
|
|
32
|
+
ref,
|
|
33
|
+
...rest
|
|
34
|
+
}: PillProps) {
|
|
35
|
+
if (loading) return <PillSkeleton className={className} disabled={disabled} />
|
|
36
|
+
|
|
37
|
+
const logoInitial = label.charAt(0).toUpperCase()
|
|
38
|
+
|
|
39
|
+
const interactive = Boolean(onClick) && !disabled
|
|
40
|
+
|
|
41
|
+
const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {
|
|
42
|
+
if (!interactive) return
|
|
43
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
44
|
+
event.preventDefault()
|
|
45
|
+
onClick?.()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<Wrapper
|
|
51
|
+
ref={ref}
|
|
52
|
+
variant="solid"
|
|
53
|
+
// Override Wrapper's variant-based bg color for the display variant —
|
|
54
|
+
// Figma spec is exactly rgba(255,255,255,0.05), which none of the
|
|
55
|
+
// Wrapper variants match. Inline style beats Wrapper's own style.
|
|
56
|
+
style={
|
|
57
|
+
disabled ? { backgroundColor: 'rgba(255, 255, 255, 0.05)' } : undefined
|
|
58
|
+
}
|
|
59
|
+
className={cn(
|
|
60
|
+
// Sizing/padding matches Figma: outer pl-1 pr-2 py-1, rounded-2xl.
|
|
61
|
+
// Height is content-driven — 44px logo + 4px vertical padding = 52px.
|
|
62
|
+
'zd:relative zd:flex zd:w-full zd:items-center zd:justify-between zd:overflow-hidden zd:rounded-2xl zd:pl-1 zd:pr-2 zd:py-1',
|
|
63
|
+
// Universal inner shadow from the Figma design token.
|
|
64
|
+
'zd:shadow-[inset_0_-4px_4px_0_rgba(255,255,255,0.1),inset_0_3px_4px_0_rgba(0,0,0,0.02)]',
|
|
65
|
+
!disabled && 'zd:cursor-pointer',
|
|
66
|
+
className,
|
|
67
|
+
)}
|
|
68
|
+
{...rest}
|
|
69
|
+
{...(interactive && {
|
|
70
|
+
role: 'button',
|
|
71
|
+
tabIndex: 0,
|
|
72
|
+
onClick,
|
|
73
|
+
onKeyDown: handleKeyDown,
|
|
74
|
+
})}
|
|
75
|
+
>
|
|
76
|
+
<div className="zd:flex zd:items-center zd:gap-1.5">
|
|
77
|
+
{/* 44×44 logo well with a 34×34 centered inner disc. Figma places the
|
|
78
|
+
image with translate-1/2 offsets so the smaller disc sits inside
|
|
79
|
+
the larger well — the 10px reveal reads as the pill's "logo pad". */}
|
|
80
|
+
<div
|
|
81
|
+
className="zd:relative zd:size-11 zd:shrink-0 zd:rounded-xl"
|
|
82
|
+
aria-hidden={!logoUri}
|
|
83
|
+
>
|
|
84
|
+
<div
|
|
85
|
+
className={cn(
|
|
86
|
+
'zd:absolute zd:top-1/2 zd:left-1/2 zd:-translate-x-1/2 zd:-translate-y-1/2',
|
|
87
|
+
'zd:flex zd:size-8.5 zd:items-center zd:justify-center',
|
|
88
|
+
// Only round + clip when we're showing the letter fallback disc.
|
|
89
|
+
// Real logo SVGs bring their own shape (round, diamond, etc.) —
|
|
90
|
+
// clipping them to a circle chops off tips like Polygon's.
|
|
91
|
+
// The neutral greyScale/10 fallback disc reads as a design-
|
|
92
|
+
// system placeholder rather than a token-specific color; real
|
|
93
|
+
// tokens/chains ship via `logoUri`.
|
|
94
|
+
!logoUri &&
|
|
95
|
+
'zd:overflow-hidden zd:rounded-full zd:bg-greyScale/10',
|
|
96
|
+
)}
|
|
97
|
+
>
|
|
98
|
+
{logoUri ? (
|
|
99
|
+
<img
|
|
100
|
+
alt=""
|
|
101
|
+
src={logoUri}
|
|
102
|
+
className="zd:size-full zd:object-contain"
|
|
103
|
+
data-testid="token-chain-pill-logo"
|
|
104
|
+
/>
|
|
105
|
+
) : logoInitial ? (
|
|
106
|
+
<span className="zd:text-body2 zd:font-medium zd:text-greyScale">
|
|
107
|
+
{logoInitial}
|
|
108
|
+
</span>
|
|
109
|
+
) : null}
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
<Text className="zd:whitespace-nowrap zd:text-body1">{label}</Text>
|
|
113
|
+
</div>
|
|
114
|
+
{trailingIcon && (
|
|
115
|
+
<div
|
|
116
|
+
className="zd:flex zd:shrink-0 zd:items-center zd:rounded-full zd:p-2"
|
|
117
|
+
data-testid="pill-trailing-icon"
|
|
118
|
+
>
|
|
119
|
+
{trailingIcon}
|
|
120
|
+
</div>
|
|
121
|
+
)}
|
|
122
|
+
</Wrapper>
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function PillSkeleton({
|
|
127
|
+
className,
|
|
128
|
+
disabled,
|
|
129
|
+
}: {
|
|
130
|
+
className?: string | undefined
|
|
131
|
+
/** Match `Pill`'s dimmed display-variant background so the skeleton on a
|
|
132
|
+
* destination (disabled) pill doesn't look like an interactive pill. */
|
|
133
|
+
disabled?: boolean | undefined
|
|
134
|
+
}) {
|
|
135
|
+
return (
|
|
136
|
+
<Wrapper
|
|
137
|
+
variant="solid"
|
|
138
|
+
role="status"
|
|
139
|
+
aria-busy="true"
|
|
140
|
+
aria-label="Loading"
|
|
141
|
+
style={
|
|
142
|
+
disabled ? { backgroundColor: 'rgba(255, 255, 255, 0.05)' } : undefined
|
|
143
|
+
}
|
|
144
|
+
className={cn(
|
|
145
|
+
// Match Pill's outer chrome so the placeholder occupies the same
|
|
146
|
+
// footprint (52px tall = 44px logo well + 4px vertical padding).
|
|
147
|
+
'zd:relative zd:flex zd:w-full zd:items-center zd:overflow-hidden zd:rounded-2xl zd:pl-1 zd:pr-2 zd:py-1',
|
|
148
|
+
'zd:shadow-[inset_0_-4px_4px_0_rgba(255,255,255,0.1),inset_0_3px_4px_0_rgba(0,0,0,0.02)]',
|
|
149
|
+
className,
|
|
150
|
+
)}
|
|
151
|
+
>
|
|
152
|
+
{/* Visual only — the outer wrapper carries the a11y busy/label state,
|
|
153
|
+
* so hide the placeholder bars from assistive tech to avoid narrating
|
|
154
|
+
* empty pill contents. */}
|
|
155
|
+
<div
|
|
156
|
+
aria-hidden
|
|
157
|
+
className="zd:flex zd:items-center zd:gap-1.5 zd:animate-skel-pulse"
|
|
158
|
+
>
|
|
159
|
+
{/* Logo well mirrors Pill's 44×44 → inner 34×34 (size-8.5). */}
|
|
160
|
+
<div className="zd:relative zd:size-11 zd:shrink-0">
|
|
161
|
+
<div className="zd:absolute zd:top-1/2 zd:left-1/2 zd:size-8.5 zd:-translate-x-1/2 zd:-translate-y-1/2 zd:rounded-full zd:bg-greyScale/15" />
|
|
162
|
+
</div>
|
|
163
|
+
<div className="zd:h-3.5 zd:w-14 zd:rounded-md zd:bg-greyScale/15" />
|
|
164
|
+
</div>
|
|
165
|
+
</Wrapper>
|
|
166
|
+
)
|
|
167
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react'
|
|
2
|
+
import { cn } from '../../utils/common'
|
|
3
|
+
import { Text } from '../Text'
|
|
4
|
+
import { ZeroDevLogo } from '../ZeroDevLogo'
|
|
5
|
+
|
|
6
|
+
export function PoweredBy({
|
|
7
|
+
className,
|
|
8
|
+
style,
|
|
9
|
+
}: {
|
|
10
|
+
className?: string
|
|
11
|
+
style?: CSSProperties
|
|
12
|
+
}) {
|
|
13
|
+
return (
|
|
14
|
+
<div
|
|
15
|
+
className={cn(
|
|
16
|
+
'zd:gap-1.5 zd:flex zd:flex-row zd:items-center',
|
|
17
|
+
className,
|
|
18
|
+
)}
|
|
19
|
+
>
|
|
20
|
+
<Text>Powered by</Text>
|
|
21
|
+
<ZeroDevLogo
|
|
22
|
+
variant="lockup"
|
|
23
|
+
tone="black"
|
|
24
|
+
className="zd:h-4.5 zd:w-auto"
|
|
25
|
+
style={style}
|
|
26
|
+
/>
|
|
27
|
+
</div>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
interface RadialStop {
|
|
2
|
+
offset: number
|
|
3
|
+
color: string
|
|
4
|
+
opacity: number
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface RadialLayer {
|
|
8
|
+
id: string
|
|
9
|
+
// Figma-exported gradientTransform matrix: the unit circle
|
|
10
|
+
// (center 0,0 radius 1) mapped to a rotated/scaled/translated ellipse.
|
|
11
|
+
matrix: [number, number, number, number, number, number]
|
|
12
|
+
// Opacity of the rect the gradient fills (Figma exports this on the <rect>).
|
|
13
|
+
fillOpacity: number
|
|
14
|
+
stops: RadialStop[]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// The rect each gradient fills, in the parent SVG's viewBox coordinates.
|
|
18
|
+
interface RadialRect {
|
|
19
|
+
x: number
|
|
20
|
+
y: number
|
|
21
|
+
width: number
|
|
22
|
+
height: number
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function EllipticalRadial({
|
|
26
|
+
layer,
|
|
27
|
+
rect,
|
|
28
|
+
}: {
|
|
29
|
+
layer: RadialLayer
|
|
30
|
+
rect: RadialRect
|
|
31
|
+
}) {
|
|
32
|
+
const { id, matrix, fillOpacity, stops } = layer
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<>
|
|
36
|
+
<defs>
|
|
37
|
+
<radialGradient
|
|
38
|
+
id={id}
|
|
39
|
+
cx="0"
|
|
40
|
+
cy="0"
|
|
41
|
+
r="1"
|
|
42
|
+
gradientUnits="userSpaceOnUse"
|
|
43
|
+
gradientTransform={`matrix(${matrix.join(' ')})`}
|
|
44
|
+
>
|
|
45
|
+
{stops.map((s, i) => (
|
|
46
|
+
<stop
|
|
47
|
+
key={s.color + i.toString()}
|
|
48
|
+
offset={s.offset}
|
|
49
|
+
stopColor={s.color}
|
|
50
|
+
stopOpacity={s.opacity}
|
|
51
|
+
/>
|
|
52
|
+
))}
|
|
53
|
+
</radialGradient>
|
|
54
|
+
</defs>
|
|
55
|
+
<rect
|
|
56
|
+
x={rect.x}
|
|
57
|
+
y={rect.y}
|
|
58
|
+
width={rect.width}
|
|
59
|
+
height={rect.height}
|
|
60
|
+
fill={`url(#${id})`}
|
|
61
|
+
fillOpacity={fillOpacity}
|
|
62
|
+
/>
|
|
63
|
+
</>
|
|
64
|
+
)
|
|
65
|
+
}
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import { useId } from 'react'
|
|
2
|
+
|
|
3
|
+
import { EllipticalRadial, type RadialLayer } from './EllipticalRadial'
|
|
4
|
+
|
|
5
|
+
// The design frame: the gradient layers live on a 412×812 rect offset to
|
|
6
|
+
// (-6,-6) so they bleed 6px past the 400×800 card on every side — that 6px
|
|
7
|
+
// reveal is the wrapper's gradient border. The matrices below are the
|
|
8
|
+
// Figma-exported gradientTransform values verbatim, so rendering the SVG with
|
|
9
|
+
// a matching viewBox + preserveAspectRatio="none" reproduces the design 1:1
|
|
10
|
+
// while still scaling to any container size.
|
|
11
|
+
const FRAME_VIEWBOX = '-6 -6 412 812'
|
|
12
|
+
|
|
13
|
+
export function MultiRadialBackground() {
|
|
14
|
+
// The colorful gradient now lives entirely in CardGlow. This base layer is
|
|
15
|
+
// just a flat, soft warm-white fill behind it so CardGlow's colors read
|
|
16
|
+
// bright and clean, with no gray muddiers underneath.
|
|
17
|
+
return (
|
|
18
|
+
<div className="zd:absolute zd:inset-0 zd:z-0 zd:rounded-4xl zd:pointer-events-none">
|
|
19
|
+
<svg
|
|
20
|
+
width="100%"
|
|
21
|
+
height="100%"
|
|
22
|
+
viewBox={FRAME_VIEWBOX}
|
|
23
|
+
preserveAspectRatio="none"
|
|
24
|
+
role="img"
|
|
25
|
+
aria-label="Decorative gradient background"
|
|
26
|
+
>
|
|
27
|
+
<rect x="-6" y="-6" width="412" height="812" fill="#FBF7F2" />
|
|
28
|
+
</svg>
|
|
29
|
+
</div>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// On-card overlay (400×800), sitting ON TOP of the translucent card body so its
|
|
34
|
+
// color reads at full strength (the card at 0.8 opacity would otherwise wash a
|
|
35
|
+
// behind-card gradient to ~20%). This reproduces the vivid orange + blue that in
|
|
36
|
+
// the source design came from the decorative "Amorphic" blob raster overlaid on
|
|
37
|
+
// the lower card, plus the design's own white card glow (Figma paint6).
|
|
38
|
+
//
|
|
39
|
+
// The orange + blue lobes are NOT verbatim Figma layers — they reconstruct the
|
|
40
|
+
// blob's measured color footprint (orange across the lower card; blue lobe
|
|
41
|
+
// bottom-left ~x 0-150 / y 600-800) as gradients, per the decision to treat the
|
|
42
|
+
// blob as a background effect rather than ship the raster.
|
|
43
|
+
export function CardGlow() {
|
|
44
|
+
const baseId = useId()
|
|
45
|
+
// VERBATIM from the Figma `--Background-Brand-Gradient` token (6 stacked
|
|
46
|
+
// radial-gradients). CSS lists topmost-first; SVG paints last-on-top, so the
|
|
47
|
+
// array is the CSS list REVERSED. Each matrix is the CSS `rx% ry% at cx% cy%`
|
|
48
|
+
// converted over the 400×800 frame. An upward linear fade is applied on top
|
|
49
|
+
// (see the <rect> below) to soften the gradient toward the top.
|
|
50
|
+
const layers: RadialLayer[] = [
|
|
51
|
+
{
|
|
52
|
+
// (CSS #6) blue → top-right. x-radius widened so the lobe reaches further
|
|
53
|
+
// left; y-radius kept short so it stays up top and doesn't bleed into the
|
|
54
|
+
// orange band.
|
|
55
|
+
id: `${baseId}-blue`,
|
|
56
|
+
matrix: [1850, 0, 0, 645, 381.44, 0],
|
|
57
|
+
fillOpacity: 1,
|
|
58
|
+
stops: [
|
|
59
|
+
{ offset: 0, color: '#45ABFB', opacity: 0.66 },
|
|
60
|
+
{ offset: 0.4615, color: '#1E9AFB', opacity: 0.35 },
|
|
61
|
+
{ offset: 1, color: '#45ABFB', opacity: 0 },
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
// (CSS #5) offWhite → blue, very faint
|
|
66
|
+
id: `${baseId}-offwhite-tr`,
|
|
67
|
+
matrix: [55.28, 0, 0, 773.36, 386.68, 13.28],
|
|
68
|
+
fillOpacity: 1,
|
|
69
|
+
stops: [
|
|
70
|
+
{ offset: 0, color: '#F7F5F0', opacity: 0.1 },
|
|
71
|
+
{ offset: 1, color: '#45ABFB', opacity: 0 },
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
// (CSS #4) warmGrey
|
|
76
|
+
id: `${baseId}-warmgrey`,
|
|
77
|
+
matrix: [326.72, 0, 0, 855.52, 0, 50.32],
|
|
78
|
+
fillOpacity: 1,
|
|
79
|
+
stops: [
|
|
80
|
+
{ offset: 0, color: '#E3CFC3', opacity: 1 },
|
|
81
|
+
{ offset: 1, color: '#E3CFC3', opacity: 0 },
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
// (CSS #3) orange — spans the full width across the bottom ~30%, uniform.
|
|
86
|
+
id: `${baseId}-orange`,
|
|
87
|
+
matrix: [580, 0, 0, 380, 200, 835],
|
|
88
|
+
fillOpacity: 1,
|
|
89
|
+
stops: [
|
|
90
|
+
{ offset: 0, color: '#EE6C2E', opacity: 0.8 },
|
|
91
|
+
{ offset: 0.55, color: '#EE6C2E', opacity: 0.6 },
|
|
92
|
+
{ offset: 1, color: '#EE6C2E', opacity: 0.15 },
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
// (CSS #2) peach — spread further up (~30% of the bottom), a bit more vivid
|
|
97
|
+
id: `${baseId}-peach`,
|
|
98
|
+
matrix: [520, 0, 0, 560, 180, 830],
|
|
99
|
+
fillOpacity: 1,
|
|
100
|
+
stops: [
|
|
101
|
+
{ offset: 0, color: '#FAC8AC', opacity: 1 },
|
|
102
|
+
{ offset: 1, color: '#F27B3E', opacity: 0 },
|
|
103
|
+
],
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
// (CSS #1) white glow (topmost of the colour stack)
|
|
107
|
+
id: `${baseId}-white-bl`,
|
|
108
|
+
matrix: [90.72, 0, 0, 550.48, 38.04, 702.64],
|
|
109
|
+
fillOpacity: 1,
|
|
110
|
+
stops: [
|
|
111
|
+
{ offset: 0, color: 'white', opacity: 0.58 },
|
|
112
|
+
{ offset: 1, color: 'white', opacity: 0 },
|
|
113
|
+
],
|
|
114
|
+
},
|
|
115
|
+
]
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<div className="zd:absolute zd:inset-0 zd:z-0 zd:rounded-4xl zd:pointer-events-none zd:overflow-hidden">
|
|
119
|
+
<svg
|
|
120
|
+
width="100%"
|
|
121
|
+
height="100%"
|
|
122
|
+
viewBox="0 0 400 800"
|
|
123
|
+
preserveAspectRatio="none"
|
|
124
|
+
role="presentation"
|
|
125
|
+
>
|
|
126
|
+
{layers.map((layer) => (
|
|
127
|
+
<EllipticalRadial
|
|
128
|
+
key={layer.id}
|
|
129
|
+
layer={layer}
|
|
130
|
+
rect={{ x: 0, y: 0, width: 400, height: 800 }}
|
|
131
|
+
/>
|
|
132
|
+
))}
|
|
133
|
+
{/* Vertical white fade — strongest at the bottom, easing linearly to
|
|
134
|
+
nothing at the top. Softens the lower (most vivid) part of the
|
|
135
|
+
gradient. A gradient layer (not an opaque card) so the frosted
|
|
136
|
+
buttons composite over it cleanly. */}
|
|
137
|
+
<defs>
|
|
138
|
+
<linearGradient
|
|
139
|
+
id={`${baseId}-vfade`}
|
|
140
|
+
x1="0"
|
|
141
|
+
y1="0"
|
|
142
|
+
x2="0"
|
|
143
|
+
y2="800"
|
|
144
|
+
gradientUnits="userSpaceOnUse"
|
|
145
|
+
>
|
|
146
|
+
<stop offset="0" stopColor="white" stopOpacity="0.55" />
|
|
147
|
+
<stop offset="0.45" stopColor="white" stopOpacity="0.52" />
|
|
148
|
+
<stop offset="0.65" stopColor="white" stopOpacity="0.5" />
|
|
149
|
+
<stop offset="0.85" stopColor="white" stopOpacity="0.5" />
|
|
150
|
+
<stop offset="1" stopColor="white" stopOpacity="0.5" />
|
|
151
|
+
</linearGradient>
|
|
152
|
+
</defs>
|
|
153
|
+
<rect
|
|
154
|
+
x="0"
|
|
155
|
+
y="0"
|
|
156
|
+
width="400"
|
|
157
|
+
height="800"
|
|
158
|
+
fill={`url(#${baseId}-vfade)`}
|
|
159
|
+
/>
|
|
160
|
+
{/* Blue — a diagonal linear gradient from the bottom-left corner fading
|
|
161
|
+
to transparent toward the top-right, so it blends smoothly into the
|
|
162
|
+
orange with no hard edge. On top of the fade so #A7B8E2 reads true. */}
|
|
163
|
+
<defs>
|
|
164
|
+
<linearGradient
|
|
165
|
+
id={`${baseId}-bluefade`}
|
|
166
|
+
x1="0"
|
|
167
|
+
y1="800"
|
|
168
|
+
x2="120"
|
|
169
|
+
y2="640"
|
|
170
|
+
gradientUnits="userSpaceOnUse"
|
|
171
|
+
>
|
|
172
|
+
<stop offset="0" stopColor="#A7B8E2" stopOpacity="1" />
|
|
173
|
+
<stop offset="0.33" stopColor="#A7B8E2" stopOpacity="0.7" />
|
|
174
|
+
<stop offset="0.66" stopColor="#A7B8E2" stopOpacity="0.35" />
|
|
175
|
+
<stop offset="1" stopColor="#A7B8E2" stopOpacity="0" />
|
|
176
|
+
</linearGradient>
|
|
177
|
+
</defs>
|
|
178
|
+
<rect
|
|
179
|
+
x="0"
|
|
180
|
+
y="0"
|
|
181
|
+
width="400"
|
|
182
|
+
height="800"
|
|
183
|
+
fill={`url(#${baseId}-bluefade)`}
|
|
184
|
+
/>
|
|
185
|
+
</svg>
|
|
186
|
+
</div>
|
|
187
|
+
)
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// The wrapper's gradient BORDER. Renders full-frame behind the inner card; the
|
|
191
|
+
// card sits on top with a 6px margin so this gradient shows as the border ring.
|
|
192
|
+
// Uses normalized cx/cy/rx/ry radial gradients (scale-transform) over a #130E0B
|
|
193
|
+
// base — the original border look.
|
|
194
|
+
type BorderLayer = {
|
|
195
|
+
id: string
|
|
196
|
+
cx: number
|
|
197
|
+
cy: number
|
|
198
|
+
rx: number
|
|
199
|
+
ry: number
|
|
200
|
+
stops: { offset: number; color: string; opacity: number }[]
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export function WrapperBorder() {
|
|
204
|
+
const baseId = useId()
|
|
205
|
+
// VERBATIM from the Figma `--Background-Brand-Gradient` token (6 stacked
|
|
206
|
+
// radial-gradients). CSS lists topmost-first, SVG paints last-on-top, so the
|
|
207
|
+
// array is the CSS list REVERSED. Each CSS `rx% ry% at cx% cy%` maps to
|
|
208
|
+
// normalized cx/cy/rx/ry (÷100); the inline <radialGradient> below applies
|
|
209
|
+
// the cx=(cx/rx)*100% + scale(rx,ry) convention.
|
|
210
|
+
const layers: BorderLayer[] = [
|
|
211
|
+
{
|
|
212
|
+
id: `${baseId}-g6`, // (CSS #6) blue, top-right
|
|
213
|
+
cx: 0.9536,
|
|
214
|
+
cy: 0.0,
|
|
215
|
+
rx: 0.9385,
|
|
216
|
+
ry: 1.2256,
|
|
217
|
+
stops: [
|
|
218
|
+
{ offset: 0, color: '#45ABFB', opacity: 0.6 },
|
|
219
|
+
{ offset: 0.4615, color: '#1E9AFB', opacity: 0.32 },
|
|
220
|
+
{ offset: 1, color: '#45ABFB', opacity: 0 },
|
|
221
|
+
],
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
id: `${baseId}-g5`, // (CSS #5) faint light, top-right
|
|
225
|
+
cx: 0.9667,
|
|
226
|
+
cy: 0.0166,
|
|
227
|
+
rx: 0.1382,
|
|
228
|
+
ry: 0.9667,
|
|
229
|
+
stops: [
|
|
230
|
+
{ offset: 0, color: '#F7F5F0', opacity: 0.1 },
|
|
231
|
+
{ offset: 1, color: '#45ABFB', opacity: 0 },
|
|
232
|
+
],
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
id: `${baseId}-g4`, // (CSS #4) warm grey, top-left
|
|
236
|
+
cx: 0.0,
|
|
237
|
+
cy: 0.0629,
|
|
238
|
+
rx: 0.8168,
|
|
239
|
+
ry: 1.0694,
|
|
240
|
+
stops: [
|
|
241
|
+
{ offset: 0, color: '#E3CFC3', opacity: 1 },
|
|
242
|
+
{ offset: 1, color: '#E3CFC3', opacity: 0 },
|
|
243
|
+
],
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
id: `${baseId}-g3`, // (CSS #3) orange, bottom-left
|
|
247
|
+
cx: 0.0393,
|
|
248
|
+
cy: 1.0,
|
|
249
|
+
rx: 1.0628,
|
|
250
|
+
ry: 1.0303,
|
|
251
|
+
stops: [
|
|
252
|
+
{ offset: 0, color: '#FF6B1F', opacity: 1 },
|
|
253
|
+
{ offset: 0.476, color: '#E76000', opacity: 0.72 },
|
|
254
|
+
{ offset: 1, color: '#E76000', opacity: 0 },
|
|
255
|
+
],
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
id: `${baseId}-g2`, // (CSS #2) peach, bottom-center
|
|
259
|
+
cx: 0.3476,
|
|
260
|
+
cy: 1.0,
|
|
261
|
+
rx: 0.9614,
|
|
262
|
+
ry: 0.338,
|
|
263
|
+
stops: [
|
|
264
|
+
{ offset: 0, color: '#FAC8AC', opacity: 0.7 },
|
|
265
|
+
{ offset: 1, color: '#F27B3E', opacity: 0 },
|
|
266
|
+
],
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
id: `${baseId}-g1`, // (CSS #1) white glow, bottom-left
|
|
270
|
+
cx: 0.0951,
|
|
271
|
+
cy: 0.8783,
|
|
272
|
+
rx: 0.2268,
|
|
273
|
+
ry: 0.6881,
|
|
274
|
+
stops: [
|
|
275
|
+
{ offset: 0, color: '#FFFFFF', opacity: 0.58 },
|
|
276
|
+
{ offset: 1, color: '#FFFFFF', opacity: 0 },
|
|
277
|
+
],
|
|
278
|
+
},
|
|
279
|
+
]
|
|
280
|
+
|
|
281
|
+
return (
|
|
282
|
+
<div className="zd:absolute zd:inset-0 zd:z-0 zd:rounded-4xl zd:pointer-events-none zd:overflow-hidden">
|
|
283
|
+
<svg
|
|
284
|
+
width="100%"
|
|
285
|
+
height="100%"
|
|
286
|
+
preserveAspectRatio="none"
|
|
287
|
+
role="presentation"
|
|
288
|
+
>
|
|
289
|
+
<rect width="100%" height="100%" fill="#130E0B" />
|
|
290
|
+
<defs>
|
|
291
|
+
{layers.map((layer) => (
|
|
292
|
+
<radialGradient
|
|
293
|
+
key={layer.id}
|
|
294
|
+
id={layer.id}
|
|
295
|
+
cx={`${(layer.cx / layer.rx) * 100}%`}
|
|
296
|
+
cy={`${(layer.cy / layer.ry) * 100}%`}
|
|
297
|
+
r="100%"
|
|
298
|
+
gradientUnits="objectBoundingBox"
|
|
299
|
+
gradientTransform={`scale(${layer.rx}, ${layer.ry})`}
|
|
300
|
+
>
|
|
301
|
+
{layer.stops.map((s, i) => (
|
|
302
|
+
<stop
|
|
303
|
+
key={s.color + i.toString()}
|
|
304
|
+
offset={s.offset}
|
|
305
|
+
stopColor={s.color}
|
|
306
|
+
stopOpacity={s.opacity}
|
|
307
|
+
/>
|
|
308
|
+
))}
|
|
309
|
+
</radialGradient>
|
|
310
|
+
))}
|
|
311
|
+
</defs>
|
|
312
|
+
{layers.map((layer) => (
|
|
313
|
+
<rect
|
|
314
|
+
key={`${layer.id}-rect`}
|
|
315
|
+
width="100%"
|
|
316
|
+
height="100%"
|
|
317
|
+
fill={`url(#${layer.id})`}
|
|
318
|
+
/>
|
|
319
|
+
))}
|
|
320
|
+
</svg>
|
|
321
|
+
</div>
|
|
322
|
+
)
|
|
323
|
+
}
|