@evinvest/uikit 0.7.0 → 0.8.1
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 +6 -4
- package/dist/index.d.ts +59 -6
- package/dist/index.js +977 -646
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/styles/tokens.css +0 -305
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evinvest/uikit",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Dep-light React UI kit: shadcn-semantics components with zero @radix-ui / cva, mirroring the
|
|
3
|
+
"version": "0.8.1",
|
|
4
|
+
"description": "Dep-light React UI kit: shadcn-semantics components with zero @radix-ui / cva, mirroring the ev_lib::uikit Rust feature. Ships the shared design tokens.",
|
|
5
5
|
"license": "BlueOak-1.0.0",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"build": "tsup",
|
|
36
36
|
"test": "vitest run",
|
|
37
37
|
"typecheck": "tsc --noEmit",
|
|
38
|
-
"prepare": "tsup"
|
|
38
|
+
"prepare": "mkdir -p styles && cp ../../tokens.css styles/tokens.css && tsup"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"react": "^18 || ^19",
|
package/styles/tokens.css
DELETED
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Shared design tokens — the theme contract for the `ev_lib::uikit` (Rust) and
|
|
3
|
-
* `@evinvest/uikit` (TypeScript) components. Import this file from any Tailwind v4
|
|
4
|
-
* entrypoint. Kept byte-for-byte in parity with `@evinvest/uikit`'s
|
|
5
|
-
* `styles/tokens.css`; change one, change the other.
|
|
6
|
-
*
|
|
7
|
-
* Structure:
|
|
8
|
-
* @theme inline {} — wires values into Tailwind utilities (processed by
|
|
9
|
-
* Tailwind v4; ignored as unknown at-rule by browsers)
|
|
10
|
-
* :root {} — raw CSS custom properties; work everywhere
|
|
11
|
-
* @keyframes / rules — toast (sonner) enter/exit motion at the tail; shipped
|
|
12
|
-
* here so the lifecycle is self-contained (see below)
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
@theme inline {
|
|
16
|
-
--radius-sm: calc(var(--radius) - 4px);
|
|
17
|
-
--radius-md: calc(var(--radius) - 2px);
|
|
18
|
-
--radius-lg: var(--radius);
|
|
19
|
-
--radius-xl: calc(var(--radius) + 4px);
|
|
20
|
-
|
|
21
|
-
/* The leading var() carries its own fallback: next/font (landing) sets
|
|
22
|
-
* `--font-inter` / `--font-playfair`; a Rust consumer renders `uikit::Fonts`,
|
|
23
|
-
* which `@font-face`s the same families. Without the in-var fallback an
|
|
24
|
-
* undefined leading var would invalidate the whole `font-family` and drop the
|
|
25
|
-
* browser to its default — so it must never resolve to guaranteed-invalid. */
|
|
26
|
-
--font-sans: var(--font-inter, "Inter"), ui-sans-serif, system-ui, sans-serif;
|
|
27
|
-
--font-serif: var(--font-playfair, "Playfair Display"), ui-serif, Georgia, serif;
|
|
28
|
-
--font-mono: var(--font-inter, "Inter"), ui-monospace, monospace;
|
|
29
|
-
|
|
30
|
-
/* shadcn semantic utilities */
|
|
31
|
-
--color-background: var(--background);
|
|
32
|
-
--color-foreground: var(--foreground);
|
|
33
|
-
--color-card: var(--card);
|
|
34
|
-
--color-card-foreground: var(--card-foreground);
|
|
35
|
-
--color-popover: var(--popover);
|
|
36
|
-
--color-popover-foreground: var(--popover-foreground);
|
|
37
|
-
--color-primary: var(--primary);
|
|
38
|
-
--color-primary-foreground: var(--primary-foreground);
|
|
39
|
-
--color-secondary: var(--secondary);
|
|
40
|
-
--color-secondary-foreground: var(--secondary-foreground);
|
|
41
|
-
--color-muted: var(--muted);
|
|
42
|
-
--color-muted-foreground: var(--muted-foreground);
|
|
43
|
-
--color-accent: var(--accent);
|
|
44
|
-
--color-accent-foreground: var(--accent-foreground);
|
|
45
|
-
--color-destructive: var(--destructive);
|
|
46
|
-
--color-destructive-foreground: var(--destructive-foreground);
|
|
47
|
-
--color-border: var(--border);
|
|
48
|
-
--color-input: var(--input);
|
|
49
|
-
--color-ring: var(--ring);
|
|
50
|
-
|
|
51
|
-
/* sidebar utilities (PC) */
|
|
52
|
-
--color-sidebar: var(--sidebar);
|
|
53
|
-
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
54
|
-
--color-sidebar-primary: var(--sidebar-primary);
|
|
55
|
-
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
56
|
-
--color-sidebar-accent: var(--sidebar-accent);
|
|
57
|
-
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
58
|
-
--color-sidebar-border: var(--sidebar-border);
|
|
59
|
-
--color-sidebar-ring: var(--sidebar-ring);
|
|
60
|
-
|
|
61
|
-
/*
|
|
62
|
-
* Brand palette — navy-led institutional base + tiered Vietnam-inspired accents.
|
|
63
|
-
* Named by ROLE, not hue. Tier hierarchy:
|
|
64
|
-
* t1 (Ha Long Teal) — recurring workhorse: labels, nav, secondary numbers
|
|
65
|
-
* t2 (Jungle Green) — positive financial signals: yields, growth %, FDI
|
|
66
|
-
* t3 (Rice Gold) — headline return figures: IRR, ROI, appreciation
|
|
67
|
-
* t4 (Lotus Pink) — ≤1 per section; the punctuation jewel
|
|
68
|
-
*/
|
|
69
|
-
--color-main-brand: #001e4e;
|
|
70
|
-
--color-main-black: #070d18;
|
|
71
|
-
--color-main-surface: #081020;
|
|
72
|
-
--color-main-card: #0c1626;
|
|
73
|
-
--color-main-mist: #e6e1d3;
|
|
74
|
-
--color-main-accent-t1: #2a9d8f;
|
|
75
|
-
--color-main-accent-t2: #2e9e5b;
|
|
76
|
-
--color-main-accent-t3: #f2c94c;
|
|
77
|
-
--color-main-accent-t4: #e58aae;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
:root {
|
|
81
|
-
/* ── shadcn semantic tokens ──────────────────────────────────── */
|
|
82
|
-
--background: #070d18;
|
|
83
|
-
--foreground: white;
|
|
84
|
-
--card: #0c1626;
|
|
85
|
-
--card-foreground: white;
|
|
86
|
-
--popover: #0c1626;
|
|
87
|
-
--popover-foreground: white;
|
|
88
|
-
--primary: #001e4e;
|
|
89
|
-
--primary-foreground: #e6e1d3;
|
|
90
|
-
--secondary: #081020;
|
|
91
|
-
--secondary-foreground: white;
|
|
92
|
-
--muted: #16213a;
|
|
93
|
-
--muted-foreground: color-mix(in srgb, #e6e1d3 40%, transparent);
|
|
94
|
-
--accent: color-mix(in srgb, #e6e1d3 8%, transparent);
|
|
95
|
-
--accent-foreground: white;
|
|
96
|
-
--destructive: #da251d;
|
|
97
|
-
--destructive-foreground: #e6e1d3;
|
|
98
|
-
--border: color-mix(in srgb, #e6e1d3 10%, transparent);
|
|
99
|
-
--input: color-mix(in srgb, #e6e1d3 20%, transparent);
|
|
100
|
-
--ring: #2a9d8f;
|
|
101
|
-
--radius: 0.375rem; /* 6px on mobile; bumped to 8px ≥ sm (see @media below) */
|
|
102
|
-
|
|
103
|
-
/* ── sidebar (PC nav) ───────────────────────────────────────── */
|
|
104
|
-
--sidebar: #0c1626;
|
|
105
|
-
--sidebar-foreground: white;
|
|
106
|
-
--sidebar-primary: #001e4e;
|
|
107
|
-
--sidebar-primary-foreground: #e6e1d3;
|
|
108
|
-
--sidebar-accent: color-mix(in srgb, #e6e1d3 8%, transparent);
|
|
109
|
-
--sidebar-accent-foreground: white;
|
|
110
|
-
--sidebar-border: color-mix(in srgb, #e6e1d3 10%, transparent);
|
|
111
|
-
--sidebar-ring: #2a9d8f;
|
|
112
|
-
--sidebar-width: 14rem;
|
|
113
|
-
|
|
114
|
-
/* ── page container — responsive gutter + max width (uikit <Container>) ─ */
|
|
115
|
-
--page-max: 90rem; /* 1440px */
|
|
116
|
-
--page-px: 1rem; /* 16px — mobile gutter, scales up below */
|
|
117
|
-
|
|
118
|
-
/* ── shell offset — viewport space reserved by whatever shell hosts the app.
|
|
119
|
-
Standalone apps get 0; a hosting shell overrides on :root. Size
|
|
120
|
-
viewport-bound surfaces with calc(100dvh - var(--ev-shell-offset, 0px)). */
|
|
121
|
-
--ev-shell-offset: 0px;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/* Mobile-first scale-ups: roomier gutters + slightly larger radii on bigger
|
|
125
|
-
viewports. Lives here (not per-component) so every consumer scales alike. */
|
|
126
|
-
@media (min-width: 640px) {
|
|
127
|
-
:root {
|
|
128
|
-
--radius: 0.5rem;
|
|
129
|
-
--page-px: 1.5rem;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
@media (min-width: 1024px) {
|
|
134
|
-
:root {
|
|
135
|
-
--page-px: 3rem;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/* ── Toast stacking (Sonner-style), shared by both ports via data-stack ──────
|
|
140
|
-
Both `ev::uikit` (Dioxus) and `@evinvest/uikit` (React) set data-stack on the
|
|
141
|
-
toaster and drive the same machine: toasts are absolutely stacked at the
|
|
142
|
-
pinned edge, pile up collapsed (front three peeking, each lifted + scaled by
|
|
143
|
-
--index and clamped to --front-height), and spread to --offset on hover /
|
|
144
|
-
keyboard focus (pure CSS — no JS state). Vars: the toaster sets --front-height
|
|
145
|
-
+ --gap; each toast sets --index, --z-index, --offset, --initial-height. React
|
|
146
|
-
measures real heights; Dioxus can't (host-only), so it feeds a constant height
|
|
147
|
-
— collapse is exact, expansion is uniform. The enter is a keyframe (plays on
|
|
148
|
-
DOM insertion, so it works in both ports without a JS mount flip),
|
|
149
|
-
`data-state=closed` slides out, and the node is dropped on the transitionend. */
|
|
150
|
-
|
|
151
|
-
[data-slot="toaster"][data-stack] [data-slot="toast"] {
|
|
152
|
-
position: absolute;
|
|
153
|
-
--y: translateY(0);
|
|
154
|
-
opacity: 1;
|
|
155
|
-
z-index: var(--z-index, 1);
|
|
156
|
-
transform: var(--y) translateX(var(--swipe-x, 0px));
|
|
157
|
-
/* a plain easeOut (no overshoot) so a restack settles instead of bouncing
|
|
158
|
-
back past its slot */
|
|
159
|
-
transition:
|
|
160
|
-
transform 350ms cubic-bezier(0.21, 0.8, 0.4, 1),
|
|
161
|
-
opacity 350ms,
|
|
162
|
-
height 350ms;
|
|
163
|
-
/* the enter is a keyframe (plays on DOM insertion in both ports — no JS mount
|
|
164
|
-
flip, whose pre-paint timing the Dioxus effect couldn't drive). It animates
|
|
165
|
-
the independent `translate` property, NOT `transform`, so it *composes* with
|
|
166
|
-
the stack transform instead of overriding it: a toast pushed back mid-enter
|
|
167
|
-
keeps repositioning smoothly instead of fighting the keyframe (rapid-fire
|
|
168
|
-
lag). */
|
|
169
|
-
animation: ev-toast-enter 350ms cubic-bezier(0.21, 0.8, 0.4, 1) backwards;
|
|
170
|
-
}
|
|
171
|
-
@keyframes ev-toast-enter {
|
|
172
|
-
from {
|
|
173
|
-
opacity: 0;
|
|
174
|
-
translate: 0 var(--enter-y, 100%);
|
|
175
|
-
}
|
|
176
|
-
to {
|
|
177
|
-
opacity: 1;
|
|
178
|
-
translate: 0 0;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/* pin to the toaster's edge; set the lift sign + the off-screen enter offset */
|
|
183
|
-
[data-slot="toaster"][data-stack][data-y-position="bottom"] [data-slot="toast"] {
|
|
184
|
-
bottom: 0;
|
|
185
|
-
--lift: -1;
|
|
186
|
-
--enter-y: 100%;
|
|
187
|
-
}
|
|
188
|
-
[data-slot="toaster"][data-stack][data-y-position="top"] [data-slot="toast"] {
|
|
189
|
-
top: 0;
|
|
190
|
-
--lift: 1;
|
|
191
|
-
--enter-y: -100%;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/* closing: slide back off + fade out; the node is dropped on its transitionend */
|
|
195
|
-
[data-slot="toaster"][data-stack] [data-slot="toast"][data-state="closed"] {
|
|
196
|
-
--y: translateY(var(--enter-y));
|
|
197
|
-
opacity: 0;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/* collapsed: back toasts lift + shrink by depth, clamp to the front height */
|
|
201
|
-
[data-slot="toaster"][data-stack]
|
|
202
|
-
[data-slot="toast"][data-state="open"][data-front="false"] {
|
|
203
|
-
--y: translateY(calc(var(--lift) * var(--gap) * var(--index)))
|
|
204
|
-
scale(calc(1 - var(--index) * 0.05));
|
|
205
|
-
height: var(--front-height);
|
|
206
|
-
}
|
|
207
|
-
[data-slot="toaster"][data-stack] [data-slot="toast"][data-front="false"] > * {
|
|
208
|
-
opacity: 0;
|
|
209
|
-
transition: opacity 300ms;
|
|
210
|
-
}
|
|
211
|
-
/* only the front three show while collapsed */
|
|
212
|
-
[data-slot="toaster"][data-stack] [data-slot="toast"][data-visible="false"] {
|
|
213
|
-
opacity: 0;
|
|
214
|
-
pointer-events: none;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/* expanded (hover / keyboard focus): spread to the offset, real height, content
|
|
218
|
-
+ overflow back */
|
|
219
|
-
[data-slot="toaster"][data-stack]:hover [data-slot="toast"][data-state="open"],
|
|
220
|
-
[data-slot="toaster"][data-stack]:focus-within
|
|
221
|
-
[data-slot="toast"][data-state="open"] {
|
|
222
|
-
--y: translateY(calc(var(--lift) * var(--offset)));
|
|
223
|
-
height: var(--initial-height);
|
|
224
|
-
}
|
|
225
|
-
[data-slot="toaster"][data-stack]:hover [data-slot="toast"] > *,
|
|
226
|
-
[data-slot="toaster"][data-stack]:focus-within [data-slot="toast"] > *,
|
|
227
|
-
[data-slot="toaster"][data-stack]:hover [data-slot="toast"][data-visible="false"],
|
|
228
|
-
[data-slot="toaster"][data-stack]:focus-within
|
|
229
|
-
[data-slot="toast"][data-visible="false"] {
|
|
230
|
-
opacity: 1;
|
|
231
|
-
pointer-events: auto;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/* a transparent strip over the gap so the hover area stays contiguous between
|
|
235
|
-
spread toasts (otherwise the pointer falls through the gap and it collapses) */
|
|
236
|
-
[data-slot="toaster"][data-stack] [data-slot="toast"]::after {
|
|
237
|
-
content: "";
|
|
238
|
-
position: absolute;
|
|
239
|
-
left: 0;
|
|
240
|
-
width: 100%;
|
|
241
|
-
height: calc(var(--gap) + 1px);
|
|
242
|
-
}
|
|
243
|
-
[data-slot="toaster"][data-stack][data-y-position="bottom"]
|
|
244
|
-
[data-slot="toast"]::after {
|
|
245
|
-
bottom: 100%;
|
|
246
|
-
}
|
|
247
|
-
[data-slot="toaster"][data-stack][data-y-position="top"]
|
|
248
|
-
[data-slot="toast"]::after {
|
|
249
|
-
top: 100%;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
/* 1:1 finger tracking during a swipe — kill the transition */
|
|
253
|
-
[data-slot="toaster"][data-stack] [data-slot="toast"][data-swiping="true"] {
|
|
254
|
-
transition: none;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/* auto-dismiss without a host timer: a no-op "life" animation runs for --life,
|
|
258
|
-
then its `animationend` fires (the toast closes itself). Hovering/focusing the
|
|
259
|
-
stack pauses just that animation (animation-play-state's 2nd slot), so the
|
|
260
|
-
countdown holds — and resumes with the elapsed time preserved — while the
|
|
261
|
-
enter (1st slot) keeps running. Persistent toasts set data-autodismiss=false,
|
|
262
|
-
so they get no life animation. (The React port uses setTimeout instead.) */
|
|
263
|
-
@keyframes ev-toast-life {
|
|
264
|
-
from {
|
|
265
|
-
--ev-life: 0;
|
|
266
|
-
}
|
|
267
|
-
to {
|
|
268
|
-
--ev-life: 1;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
[data-slot="toaster"][data-stack]
|
|
272
|
-
[data-slot="toast"][data-autodismiss="true"][data-state="open"] {
|
|
273
|
-
animation:
|
|
274
|
-
ev-toast-enter 350ms cubic-bezier(0.21, 0.8, 0.4, 1) backwards,
|
|
275
|
-
ev-toast-life var(--life) linear;
|
|
276
|
-
}
|
|
277
|
-
[data-slot="toaster"][data-stack]:hover
|
|
278
|
-
[data-slot="toast"][data-autodismiss="true"],
|
|
279
|
-
[data-slot="toaster"][data-stack]:focus-within
|
|
280
|
-
[data-slot="toast"][data-autodismiss="true"] {
|
|
281
|
-
animation-play-state: running, paused;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/* reduced motion: opacity-only enter + near-instant transform (still fires
|
|
285
|
-
transitionend, so exit removal works), no height animation */
|
|
286
|
-
@keyframes ev-toast-fade-in {
|
|
287
|
-
from {
|
|
288
|
-
opacity: 0;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
@media (prefers-reduced-motion: reduce) {
|
|
292
|
-
[data-slot="toaster"][data-stack] [data-slot="toast"] {
|
|
293
|
-
transition:
|
|
294
|
-
transform 1ms linear,
|
|
295
|
-
opacity 200ms;
|
|
296
|
-
animation: ev-toast-fade-in 200ms;
|
|
297
|
-
}
|
|
298
|
-
/* keep the auto-dismiss life animation under reduced motion */
|
|
299
|
-
[data-slot="toaster"][data-stack]
|
|
300
|
-
[data-slot="toast"][data-autodismiss="true"][data-state="open"] {
|
|
301
|
-
animation:
|
|
302
|
-
ev-toast-fade-in 200ms,
|
|
303
|
-
ev-toast-life var(--life) linear;
|
|
304
|
-
}
|
|
305
|
-
}
|