@valiify/dashboard-ui 0.1.0-alpha.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/CHANGELOG.md +104 -0
- package/LICENSE +21 -0
- package/README.md +373 -0
- package/dist/index.css +3743 -0
- package/package.json +82 -0
- package/src/base/index.css +21 -0
- package/src/components/ICON-SYSTEM.md +425 -0
- package/src/components/_template.css +109 -0
- package/src/components/alert.css +156 -0
- package/src/components/avatar.css +87 -0
- package/src/components/breadcrumbs.css +158 -0
- package/src/components/button.css +177 -0
- package/src/components/card.css +63 -0
- package/src/components/checkbox.css +181 -0
- package/src/components/chip.css +234 -0
- package/src/components/data-row.css +142 -0
- package/src/components/divider.css +143 -0
- package/src/components/dropdown-field.css +185 -0
- package/src/components/dropdown-menu.css +80 -0
- package/src/components/field-verification.css +156 -0
- package/src/components/filter-segment.css +163 -0
- package/src/components/icon-button.css +83 -0
- package/src/components/icon.css +145 -0
- package/src/components/index.css +47 -0
- package/src/components/input.css +180 -0
- package/src/components/link.css +183 -0
- package/src/components/loading-indicator.css +184 -0
- package/src/components/loading-inline.css +75 -0
- package/src/components/menu-item.css +138 -0
- package/src/components/modal.css +203 -0
- package/src/components/navigation-rail.css +558 -0
- package/src/components/pagination-item.css +196 -0
- package/src/components/pagination.css +108 -0
- package/src/components/pill.css +108 -0
- package/src/components/progress-bar.css +157 -0
- package/src/components/radio-select.css +97 -0
- package/src/components/section-marker.css +96 -0
- package/src/components/segment-selector.css +78 -0
- package/src/components/sensitive-data.css +77 -0
- package/src/components/skeleton.css +184 -0
- package/src/components/step.css +106 -0
- package/src/components/stepper.css +93 -0
- package/src/components/switch.css +99 -0
- package/src/components/tabs.css +213 -0
- package/src/components/tag.css +133 -0
- package/src/components/text-button.css +170 -0
- package/src/components/textarea.css +156 -0
- package/src/components/toast.css +182 -0
- package/src/components/tooltip.css +70 -0
- package/src/fonts.css +23 -0
- package/src/icons/README.md +297 -0
- package/src/icons/custom/help.svg +3 -0
- package/src/icons/custom/valiify-logo.svg +6 -0
- package/src/icons/icon-list.txt +2036 -0
- package/src/icons/sprite.svg +12223 -0
- package/src/index.css +35 -0
- package/src/library.css +34 -0
- package/src/themes/valiify.css +319 -0
- package/src/utilities/index.css +35 -0
- package/types/components.d.ts +630 -0
- package/types/index.d.ts +15 -0
|
@@ -0,0 +1,558 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigation Rail — Figma Nav Items 723:18649, Nav Group Container 726:18779,
|
|
3
|
+
* Nav Badge 724:18701, Nav Title 727:18963
|
|
4
|
+
*
|
|
5
|
+
* The sidebar family. Four sub-components live in this one file because they are
|
|
6
|
+
* only ever composed together, the way input.css holds .input-container ›
|
|
7
|
+
* .input-field › .input:
|
|
8
|
+
*
|
|
9
|
+
* .nav-title 46px header — logo tile, product name, switcher + search
|
|
10
|
+
* .nav-group 26px group header — label, hover chevron; a rule when collapsed
|
|
11
|
+
* .nav-item 32px row — icon, label, optional badge / count / status dot
|
|
12
|
+
* .nav-badge 14px "Beta" pill, slots inside a nav item
|
|
13
|
+
*
|
|
14
|
+
* .nav-rail 240px expanded / 60px collapsed container
|
|
15
|
+
*
|
|
16
|
+
* Collapsing is driven from the RAIL — put `.nav-rail-collapsed` on the
|
|
17
|
+
* container and every part follows. The per-part `-collapsed` modifiers still
|
|
18
|
+
* work for rendering a part on its own (Storybook, tests), and are the same
|
|
19
|
+
* declarations, not a second implementation.
|
|
20
|
+
*
|
|
21
|
+
* Structure:
|
|
22
|
+
* <nav class="nav-rail">
|
|
23
|
+
* <a class="nav-title">
|
|
24
|
+
* <span class="nav-title-logo"><img …></span>
|
|
25
|
+
* <span class="nav-title-details">
|
|
26
|
+
* <span class="nav-title-name">Central Williamette</span>
|
|
27
|
+
* <span class="nav-title-subtitle">Main st branch</span>
|
|
28
|
+
* </span>
|
|
29
|
+
* <span class="nav-title-action"><svg class="icon icon-size-14">…</svg></span>
|
|
30
|
+
* <span class="nav-title-action"><svg class="icon icon-size-14">…</svg></span>
|
|
31
|
+
* </a>
|
|
32
|
+
*
|
|
33
|
+
* <button class="nav-group" aria-expanded="true" aria-controls="analyze">
|
|
34
|
+
* <span class="nav-group-label">Analyze</span>
|
|
35
|
+
* <svg class="nav-group-chevron icon icon-size-16"><use href="#chevron-down" /></svg>
|
|
36
|
+
* <span class="nav-group-rule"></span>
|
|
37
|
+
* </button>
|
|
38
|
+
* <div class="nav-rail-items" id="analyze">
|
|
39
|
+
* ...nav items the group controls...
|
|
40
|
+
* </div>
|
|
41
|
+
*
|
|
42
|
+
* <a class="nav-item" aria-current="page">
|
|
43
|
+
* <svg class="nav-item-icon icon icon-size-16"><use href="#inbox" /></svg>
|
|
44
|
+
* <span class="nav-item-label">Inbox</span>
|
|
45
|
+
* <span class="nav-badge">Beta</span>
|
|
46
|
+
* <span class="nav-item-count">41</span>
|
|
47
|
+
* </a>
|
|
48
|
+
* </nav>
|
|
49
|
+
*
|
|
50
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
51
|
+
* FIGMA'S STATE NAMES ARE INVERTED FROM INTUITION. Read this before changing
|
|
52
|
+
* any state rule.
|
|
53
|
+
*
|
|
54
|
+
* The Nav Item set has states rest / Hover / Pressed / Active / Passive, and:
|
|
55
|
+
*
|
|
56
|
+
* "Passive" is the BLUE, current-page look — Primary/Soft bg, Primary/Main text
|
|
57
|
+
* "Active" is a NEUTRAL GREY highlight — Action/Selected bg, Content/Primary
|
|
58
|
+
*
|
|
59
|
+
* So Figma's "Active" is not the active page and its "Passive" is not
|
|
60
|
+
* de-emphasised. Mapped here to the semantics they actually describe:
|
|
61
|
+
*
|
|
62
|
+
* Figma Passive -> [aria-current="page"] the current page (blue)
|
|
63
|
+
* Figma Active -> .nav-item-active an ancestor section of it (grey)
|
|
64
|
+
* Figma Hover -> :hover
|
|
65
|
+
* Figma Pressed -> :active
|
|
66
|
+
*
|
|
67
|
+
* That reading — blue for the page you are on, grey for the section containing
|
|
68
|
+
* it — is the only one that makes both states useful at once, but it IS a
|
|
69
|
+
* reading. Confirm with the designer before relying on `.nav-item-active`.
|
|
70
|
+
*
|
|
71
|
+
* The set also declares a `Beta` axis whose only drawn value is `no`. There is
|
|
72
|
+
* no Beta=yes variant; the Beta visual is delivered by the badge slot instead.
|
|
73
|
+
* Treated as a dead property and not modelled.
|
|
74
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
75
|
+
*
|
|
76
|
+
* Heights are pinned with explicit `height`, per house style: several of these
|
|
77
|
+
* text styles use an Auto line height, so a content-driven box would be
|
|
78
|
+
* font-metric dependent.
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
@layer components {
|
|
82
|
+
/* ================================================================== */
|
|
83
|
+
/* Nav Rail — Figma 728:20677, 2 variants (Expanded=yes/no) */
|
|
84
|
+
/* ================================================================== */
|
|
85
|
+
|
|
86
|
+
/* THE RAIL HAS NO SURFACE OF ITS OWN. No fill, no border, no right divider,
|
|
87
|
+
no shadow, no radius — confirmed absent in both variants, and no
|
|
88
|
+
Surface/* variable resolves anywhere on the root. It is transparent and
|
|
89
|
+
inherits whatever it sits on. Do not add a background here to make
|
|
90
|
+
Storybook look tidier; that would invent a spec.
|
|
91
|
+
|
|
92
|
+
Padding is 8px horizontal and 0 vertical in BOTH states — collapsing
|
|
93
|
+
changes the content column width (224 -> 44), not the padding.
|
|
94
|
+
|
|
95
|
+
Height in Figma is a fixed 897px, which is a frame height standing in for
|
|
96
|
+
the viewport, not a constraint on the component. `h-full` is used instead
|
|
97
|
+
so the rail fills whatever it is put in.
|
|
98
|
+
|
|
99
|
+
CONSUMERS MUST GIVE IT A HEIGHT. `h-full` is `height: 100%`, so in an
|
|
100
|
+
auto-height parent it resolves to the content height — measured at 64px for
|
|
101
|
+
a two-row rail — and `justify-between` then has no slack to distribute, so
|
|
102
|
+
the footer sits directly under the content instead of at the bottom.
|
|
103
|
+
Put the rail in something sized: a `h-screen` wrapper, a grid row, or a
|
|
104
|
+
flex parent with a height. Nothing breaks without it; the footer just
|
|
105
|
+
stops being bottom-pinned. */
|
|
106
|
+
.nav-rail {
|
|
107
|
+
@apply flex h-full w-60 flex-col items-start justify-between; /* 240px */
|
|
108
|
+
@apply px-2; /* 8px, both states */
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.nav-rail-collapsed {
|
|
112
|
+
@apply w-15; /* 60px */
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* Sections wrapper. `justify-between` on the rail pushes the footer down —
|
|
116
|
+
in Figma the 149px of slack is absorbed that way, with no spacer node.
|
|
117
|
+
|
|
118
|
+
`overflow-y-auto` is NOT from Figma: neither root declares clipping, so
|
|
119
|
+
nothing in the file says which subtree scrolls. This is the only sensible
|
|
120
|
+
candidate (684px of content in an 897px frame) and a rail with more items
|
|
121
|
+
than fit has to scroll somewhere. Flagged as an engineering decision. */
|
|
122
|
+
.nav-rail-content {
|
|
123
|
+
@apply flex w-full flex-col gap-5 overflow-y-auto; /* 20px between sections */
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* One group of rows. Items butt directly against each other — the gap inside
|
|
127
|
+
a section is 0, and the breathing room comes from the 32px row height
|
|
128
|
+
against a 19.5px line box. Not every section has a header: the first
|
|
129
|
+
("Apps") has none. */
|
|
130
|
+
.nav-rail-section {
|
|
131
|
+
@apply flex w-full flex-col gap-0;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* Bottom-pinned. Holds ordinary nav items — Settings and Collapse are rows,
|
|
135
|
+
not a bespoke control, and the collapse toggle is a footer item rather than
|
|
136
|
+
the floating edge chevron this pattern usually gets. */
|
|
137
|
+
.nav-rail-footer {
|
|
138
|
+
@apply flex w-full flex-col gap-0;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/* ================================================================== */
|
|
142
|
+
/* Nav Title — Figma 727:18963, 4 variants (Hover x Expanded) */
|
|
143
|
+
/* ================================================================== */
|
|
144
|
+
|
|
145
|
+
.nav-title {
|
|
146
|
+
/* Layout */
|
|
147
|
+
@apply flex items-center gap-2; /* 8px */
|
|
148
|
+
@apply px-2; /* 8px; no vertical padding — 46px height centres instead */
|
|
149
|
+
@apply h-11.5; /* 46px */
|
|
150
|
+
|
|
151
|
+
/* Shape */
|
|
152
|
+
@apply rounded-tight; /* Radius/XS 4px */
|
|
153
|
+
|
|
154
|
+
/* Reset, so the class works on a / button / div alike */
|
|
155
|
+
@apply appearance-none border-none bg-transparent text-left no-underline;
|
|
156
|
+
|
|
157
|
+
@apply cursor-pointer transition-colors duration-150;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/* Figma's only hover delta on this component is the background. Text and
|
|
161
|
+
icon colours, width, padding and radius are all unchanged. */
|
|
162
|
+
.nav-title:hover:not(:disabled):not([aria-disabled="true"]) {
|
|
163
|
+
@apply bg-action-hover;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.nav-title:focus-visible {
|
|
167
|
+
@apply focus-ring;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/* 30px tile carrying the institution logo. The Figma logo is a raster crop
|
|
171
|
+
out of a larger image and cannot be reproduced faithfully, so this is a
|
|
172
|
+
slot: put an <img> or an <svg> inside it. */
|
|
173
|
+
.nav-title-logo {
|
|
174
|
+
@apply flex size-7.5 shrink-0 items-center justify-center; /* 30px */
|
|
175
|
+
@apply overflow-hidden rounded-control; /* Radius/SM 6px */
|
|
176
|
+
@apply border border-[length:var(--border-thin)] border-stroke-divider;
|
|
177
|
+
@apply bg-surface-paper;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.nav-title-logo > img,
|
|
181
|
+
.nav-title-logo > svg {
|
|
182
|
+
@apply size-5 object-contain; /* 20px */
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/* Fixed 119px in Figma, so long names wrap rather than widening the row.
|
|
186
|
+
Kept fixed to stay faithful — see the note in CLAUDE.md. */
|
|
187
|
+
.nav-title-details {
|
|
188
|
+
@apply flex w-[119px] shrink-0 flex-col items-start justify-center;
|
|
189
|
+
min-width: 0;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.nav-title-name {
|
|
193
|
+
@apply w-full truncate;
|
|
194
|
+
@apply text-body-1-bold text-content-primary; /* 13px / 19.5 / 500 */
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.nav-title-subtitle {
|
|
198
|
+
@apply w-full truncate;
|
|
199
|
+
@apply text-micro-l text-content-secondary; /* 11px / normal / 400 */
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/* 18px hit box around a 14px glyph. Figma also puts 6px padding on this
|
|
203
|
+
box, which with a 14px glyph would need 26px — the glyph overflows its own
|
|
204
|
+
padded frame in the file. Rendered as an 18px box centring a 14px glyph. */
|
|
205
|
+
.nav-title-action {
|
|
206
|
+
@apply flex size-4.5 shrink-0 items-center justify-center; /* 18px */
|
|
207
|
+
@apply rounded-control text-secondary; /* Radius/SM, Secondary/Main */
|
|
208
|
+
@apply cursor-pointer;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/* Collapsed rail: only the logo tile survives. Figma drops the details block
|
|
212
|
+
and both action icons entirely rather than hiding them.
|
|
213
|
+
|
|
214
|
+
Figma reports this frame as 44px wide while its own contents measure
|
|
215
|
+
8 + 30 + 8 = 46. Width is held at Figma's 44 and the padding tightened to
|
|
216
|
+
7px so the tile actually fits; the 2px is a file discrepancy, not a
|
|
217
|
+
deliberate overflow. */
|
|
218
|
+
.nav-title-collapsed,
|
|
219
|
+
.nav-rail-collapsed .nav-title {
|
|
220
|
+
@apply w-11 justify-center px-1.75; /* 44px, 7px */
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/* The details block carries the institution name, which is `.nav-title`'s
|
|
224
|
+
accessible name — `sr-only` so the collapsed logo tile is still a labelled
|
|
225
|
+
link rather than an anonymous one. */
|
|
226
|
+
.nav-title-collapsed .nav-title-details,
|
|
227
|
+
.nav-rail-collapsed .nav-title-details {
|
|
228
|
+
@apply sr-only;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/* The two action icons are genuinely removed, not hidden: they are separate
|
|
232
|
+
controls (a switcher and a search), and Figma drops them. Keeping them in
|
|
233
|
+
the accessibility tree would announce controls that cannot be seen. */
|
|
234
|
+
.nav-title-collapsed .nav-title-action,
|
|
235
|
+
.nav-rail-collapsed .nav-title-action {
|
|
236
|
+
@apply hidden;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/* ================================================================== */
|
|
240
|
+
/* Nav Group — Figma 726:18779, 8 variants (Hover x Collapsed x Expanded) */
|
|
241
|
+
/* ================================================================== */
|
|
242
|
+
|
|
243
|
+
/* Two axes in Figma that both sound like "collapsed", and they are NOT the
|
|
244
|
+
same thing:
|
|
245
|
+
Expanded = the whole RAIL is expanded vs icon-only -> .nav-group-collapsed
|
|
246
|
+
Collapsed = THIS GROUP's own disclosure state -> aria-expanded
|
|
247
|
+
Modelled with two different mechanisms so they cannot be confused. */
|
|
248
|
+
|
|
249
|
+
.nav-group {
|
|
250
|
+
/* Layout */
|
|
251
|
+
@apply flex items-center gap-0.75; /* 3px */
|
|
252
|
+
@apply px-2; /* 8px; no vertical padding — 26px height centres */
|
|
253
|
+
@apply h-6.5; /* 26px */
|
|
254
|
+
@apply w-full;
|
|
255
|
+
|
|
256
|
+
/* Shape */
|
|
257
|
+
@apply rounded-tight; /* Radius/XS 4px */
|
|
258
|
+
|
|
259
|
+
/* Reset — this is a <button> with aria-expanded, not a bare label */
|
|
260
|
+
@apply appearance-none border-none bg-transparent text-left;
|
|
261
|
+
|
|
262
|
+
@apply cursor-pointer transition-colors duration-150;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.nav-group:hover:not(.nav-group-collapsed):not(:disabled):not(
|
|
266
|
+
[aria-disabled="true"]
|
|
267
|
+
) {
|
|
268
|
+
@apply bg-action-hover;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.nav-group:focus-visible {
|
|
272
|
+
@apply focus-ring;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/* Style name is "Micro L - Bold" but the file resolves it to Medium / 500,
|
|
276
|
+
and the label is NOT uppercase — Figma renders "Analyze" in mixed case. */
|
|
277
|
+
.nav-group-label {
|
|
278
|
+
@apply text-micro-l-bold text-content-tertiary; /* 11px / normal / 500 */
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/* FIGMA SHOWS THE CHEVRON ON HOVER ONLY — absent at rest.
|
|
282
|
+
|
|
283
|
+
In the standalone component that makes the frame grow 58 -> 77px when the
|
|
284
|
+
pointer enters (3px gap + 16px icon). Inside the rail it does NOT grow, and
|
|
285
|
+
that is correct: the in-rail group is set to fill, so it is 224px either
|
|
286
|
+
way and the chevron simply appears within it. Measured both ways — 224 at
|
|
287
|
+
rest, 224 on hover. An earlier version of this comment claimed the width
|
|
288
|
+
change was reproduced; it is not, because the only place the component is
|
|
289
|
+
actually used never hugs.
|
|
290
|
+
|
|
291
|
+
Consequence worth raising with the designer: at rest a collapsed group used
|
|
292
|
+
to be indistinguishable from an open one. That is much less true now the
|
|
293
|
+
rows actually hide (see Group disclosure below) — the row count is the
|
|
294
|
+
state indicator. Touch users still get no chevron; `:focus-visible` is
|
|
295
|
+
included below so keyboard users reach parity with mouse users, which is an
|
|
296
|
+
addition to the design rather than a reading of it. */
|
|
297
|
+
.nav-group-chevron {
|
|
298
|
+
@apply hidden shrink-0 text-content-tertiary;
|
|
299
|
+
@apply transition-transform duration-150;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.nav-group:hover:not(.nav-group-collapsed):not(:disabled):not(
|
|
303
|
+
[aria-disabled="true"]
|
|
304
|
+
)
|
|
305
|
+
.nav-group-chevron,
|
|
306
|
+
.nav-group:focus-visible .nav-group-chevron {
|
|
307
|
+
@apply block;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/* Collapsed group: the same chevron instance rotated, not a swapped glyph.
|
|
311
|
+
Down when open, pointing right when closed. */
|
|
312
|
+
.nav-group[aria-expanded="false"] .nav-group-chevron {
|
|
313
|
+
@apply -rotate-90;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/* --- Group disclosure ----------------------------------------------- */
|
|
317
|
+
|
|
318
|
+
/* A collapsed group HIDES THE ROWS BELOW IT. Figma draws the chevron
|
|
319
|
+
rotation and nothing else, so this behaviour is not in the file — but a
|
|
320
|
+
disclosure control whose disclosure does nothing is a bug, not fidelity.
|
|
321
|
+
|
|
322
|
+
Two markup shapes are supported, because a library cannot dictate one:
|
|
323
|
+
|
|
324
|
+
wrapped .nav-group + .nav-rail-items <- recommended
|
|
325
|
+
flat .nav-group ~ .nav-item
|
|
326
|
+
|
|
327
|
+
Prefer wrapped. It is the only shape that lets you point `aria-controls`
|
|
328
|
+
at a real element, which is what makes this an actual ARIA disclosure
|
|
329
|
+
rather than a button that happens to hide things.
|
|
330
|
+
|
|
331
|
+
This library ships no JavaScript, so flipping `aria-expanded` is the
|
|
332
|
+
consumer's job — one line on click. The CSS is the whole contract. */
|
|
333
|
+
.nav-group[aria-expanded="false"] + .nav-rail-items,
|
|
334
|
+
.nav-group[aria-expanded="false"] ~ .nav-item {
|
|
335
|
+
@apply hidden;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/* ...except in a collapsed rail. Figma's Collapsed axis has no visual effect
|
|
339
|
+
when the rail is icon-only, and there the header renders as a bare rule
|
|
340
|
+
with no chevron — so honouring disclosure would strand those rows with no
|
|
341
|
+
affordance to bring them back. Rows stay visible; the state is remembered
|
|
342
|
+
and reapplies when the rail expands. */
|
|
343
|
+
.nav-rail-collapsed .nav-group[aria-expanded="false"] ~ .nav-item {
|
|
344
|
+
@apply flex;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.nav-rail-collapsed .nav-group[aria-expanded="false"] + .nav-rail-items {
|
|
348
|
+
@apply flex;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/* Optional wrapper for the rows a group controls. Give it an id and point the
|
|
352
|
+
header's `aria-controls` at it. */
|
|
353
|
+
.nav-rail-items {
|
|
354
|
+
@apply flex w-full flex-col gap-0;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/* Collapsed rail: the label and chevron are replaced by a short rule.
|
|
358
|
+
|
|
359
|
+
The standalone component hugs to 38.5px (8 + a raw 22.5px rule + 8), and
|
|
360
|
+
that half pixel looked like an authoring artefact worth flagging. The rail
|
|
361
|
+
resolves it: INSIDE the rail all three group headers are set to fill, so
|
|
362
|
+
they render 44 x 26 like everything else in the column. 38.5 is the hug
|
|
363
|
+
width of a component nobody uses standalone, so no width is pinned here —
|
|
364
|
+
it fills, and the rule stays 22.5px centred within it.
|
|
365
|
+
|
|
366
|
+
Not a control in this state — it is a divider, so the base hover rule
|
|
367
|
+
above excludes it rather than applying a background and cancelling it. */
|
|
368
|
+
.nav-group-collapsed,
|
|
369
|
+
.nav-rail-collapsed .nav-group {
|
|
370
|
+
@apply justify-center;
|
|
371
|
+
@apply cursor-default;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.nav-group-collapsed .nav-group-chevron,
|
|
375
|
+
.nav-rail-collapsed .nav-group-chevron {
|
|
376
|
+
@apply hidden;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/* `sr-only`, NOT `hidden`. Figma drops the label in the collapsed rail, but
|
|
380
|
+
`.nav-group` is a <button>, and a button whose only remaining child is a
|
|
381
|
+
decorative rule has no accessible name — axe `button-name`, and a keyboard
|
|
382
|
+
user lands on an unlabelled tab stop. Hiding it visually while leaving it
|
|
383
|
+
in the accessibility tree keeps Figma's appearance and the name both.
|
|
384
|
+
`sr-only` is absolutely positioned, so it takes no space in the row. */
|
|
385
|
+
.nav-group-collapsed .nav-group-label,
|
|
386
|
+
.nav-rail-collapsed .nav-group-label {
|
|
387
|
+
@apply sr-only;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
.nav-group-rule {
|
|
391
|
+
@apply hidden h-0 w-[22.5px] shrink-0;
|
|
392
|
+
@apply border-t border-t-[length:var(--border-line)] border-stroke-divider;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
.nav-group-collapsed .nav-group-rule,
|
|
396
|
+
.nav-rail-collapsed .nav-group-rule {
|
|
397
|
+
@apply block;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/* ================================================================== */
|
|
401
|
+
/* Nav Item — Figma 723:18649, 10 variants */
|
|
402
|
+
/* ================================================================== */
|
|
403
|
+
|
|
404
|
+
.nav-item {
|
|
405
|
+
/* Layout */
|
|
406
|
+
@apply relative flex items-center gap-3; /* 12px */
|
|
407
|
+
@apply px-2; /* 8px; no vertical padding — 32px height centres */
|
|
408
|
+
@apply h-8; /* 32px */
|
|
409
|
+
@apply w-full;
|
|
410
|
+
|
|
411
|
+
/* Shape */
|
|
412
|
+
@apply rounded-tight; /* Radius/XS 4px */
|
|
413
|
+
|
|
414
|
+
/* Reset, so the class works on a / button / div / li alike */
|
|
415
|
+
@apply appearance-none border-none bg-transparent text-left no-underline;
|
|
416
|
+
|
|
417
|
+
/* Rest — label and icon are DIFFERENT colours here, the only state where
|
|
418
|
+
they diverge. The icon takes its own colour below. */
|
|
419
|
+
@apply bg-transparent text-content-secondary;
|
|
420
|
+
|
|
421
|
+
@apply cursor-pointer transition-colors duration-150;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
.nav-item-icon {
|
|
425
|
+
@apply shrink-0 text-content-tertiary;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
.nav-item-label {
|
|
429
|
+
@apply flex-1 truncate;
|
|
430
|
+
@apply text-body-1-bold; /* 13px / 19.5 / 500 */
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/* Trailing count — mono, and keeps Content/Tertiary in every state */
|
|
434
|
+
.nav-item-count {
|
|
435
|
+
@apply shrink-0 whitespace-nowrap;
|
|
436
|
+
@apply text-data-xs font-mono text-content-tertiary; /* 12px / 16.5 / 400 */
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/* 5px dot, positioned top-right of the centred icon in a collapsed 44x32 row.
|
|
440
|
+
|
|
441
|
+
Collapsed-only in Figma — the expanded variant has no status layer at all,
|
|
442
|
+
which looks like an authoring gap given the component description mentions
|
|
443
|
+
a status indicator. Available in both here; it costs nothing and the
|
|
444
|
+
expanded rail is where a status is most legible.
|
|
445
|
+
|
|
446
|
+
The rail uses THREE colours for it — Neutral/Main, Warning/Main and
|
|
447
|
+
Primary/Main — so the colour is a modifier rather than baked in. Neutral is
|
|
448
|
+
the base because an unqualified status dot is informational; the other two
|
|
449
|
+
say something. */
|
|
450
|
+
.nav-item-status {
|
|
451
|
+
@apply absolute size-1.25 rounded-pill bg-neutral; /* 5px, Neutral/Main */
|
|
452
|
+
top: 6px;
|
|
453
|
+
left: 27px;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.nav-item-status-warning {
|
|
457
|
+
@apply bg-warning; /* Warning/Main — Alerts */
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
.nav-item-status-primary {
|
|
461
|
+
@apply bg-primary; /* Primary/Main — Analytics, Email automation */
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/* --- Nav Item states ------------------------------------------------ */
|
|
465
|
+
|
|
466
|
+
/* In every state but rest the label and icon share one colour, so the icon
|
|
467
|
+
simply follows the row instead of each state setting it twice. */
|
|
468
|
+
.nav-item:hover:not(:disabled):not([aria-disabled="true"]) .nav-item-icon,
|
|
469
|
+
.nav-item:active:not(:disabled):not([aria-disabled="true"]) .nav-item-icon,
|
|
470
|
+
.nav-item-active .nav-item-icon,
|
|
471
|
+
.nav-item[aria-current="page"] .nav-item-icon,
|
|
472
|
+
.nav-item:hover:not(:disabled):not([aria-disabled="true"]) {
|
|
473
|
+
@apply bg-action-hover text-content-primary;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/* Figma "Pressed" — note it binds Action/Focused, not an Action/Pressed
|
|
477
|
+
token, which does not exist. */
|
|
478
|
+
.nav-item:active:not(:disabled):not([aria-disabled="true"]) {
|
|
479
|
+
@apply bg-action-focused text-content-primary;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
.nav-item:focus-visible {
|
|
483
|
+
@apply focus-ring;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/* Figma "Active" — the neutral grey highlight. See the header: this is NOT
|
|
487
|
+
the current page. */
|
|
488
|
+
.nav-item-active {
|
|
489
|
+
@apply bg-action-selected text-content-primary;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/* Figma "Passive" — the blue current-page look. See the header. */
|
|
493
|
+
.nav-item[aria-current="page"] {
|
|
494
|
+
@apply bg-primary-soft text-primary;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
.nav-item:disabled,
|
|
498
|
+
.nav-item[aria-disabled="true"] {
|
|
499
|
+
@apply cursor-not-allowed text-content-faint;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/* Collapsed rail: 44px, icon centred. Figma REMOVES the label rather than
|
|
503
|
+
hiding it, so the gap and padding stop mattering — `justify-center` is what
|
|
504
|
+
positions the icon, not the 8px padding, which Figma still declares. */
|
|
505
|
+
.nav-item-collapsed,
|
|
506
|
+
.nav-rail-collapsed .nav-item {
|
|
507
|
+
@apply justify-center;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/* `sr-only`, NOT `hidden` — same reason as the group label. `.nav-item` is an
|
|
511
|
+
<a>/<button>, and its label is its only text: `display:none` takes it out
|
|
512
|
+
of the accessibility tree and leaves an unnamed control in the tab order.
|
|
513
|
+
Measured with axe and Playwright's ariaSnapshot BEFORE this fix: 16 of 21
|
|
514
|
+
focusable nodes in the collapsed rail had no accessible name at all, which
|
|
515
|
+
made the icon-only rail unusable with a screen reader.
|
|
516
|
+
|
|
517
|
+
The count goes the same way rather than being dropped: it is real
|
|
518
|
+
information ("Inbox, 41"), and keeping it means the collapsed rail
|
|
519
|
+
announces exactly what the expanded one does. */
|
|
520
|
+
.nav-item-collapsed .nav-item-label,
|
|
521
|
+
.nav-item-collapsed .nav-item-count,
|
|
522
|
+
.nav-rail-collapsed .nav-item-label,
|
|
523
|
+
.nav-rail-collapsed .nav-item-count {
|
|
524
|
+
@apply sr-only;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
/* The badge IS dropped — Figma drops it in the collapsed rail, and it is
|
|
528
|
+
decorative duplication next to a 44px icon. It also has to go: left
|
|
529
|
+
visible it rendered 30.4px inside a 44px row, overflowing by 7px
|
|
530
|
+
(scrollWidth 51 vs width 44). */
|
|
531
|
+
.nav-item-collapsed .nav-badge,
|
|
532
|
+
.nav-rail-collapsed .nav-badge {
|
|
533
|
+
@apply hidden;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/* ================================================================== */
|
|
537
|
+
/* Nav Badge — Figma 724:18701, 2 variants */
|
|
538
|
+
/* ================================================================== */
|
|
539
|
+
|
|
540
|
+
/* Figma declares a Size axis of micro / md. The two variants are identical in
|
|
541
|
+
every extracted property and render pixel-for-pixel the same — same 29x14
|
|
542
|
+
box, same padding, same radius, same text style. No size modifiers are
|
|
543
|
+
defined here, because shipping .nav-badge-micro and .nav-badge-md as
|
|
544
|
+
synonyms would encode a distinction the design system does not make.
|
|
545
|
+
Raised with the designer; add them if the sizes diverge.
|
|
546
|
+
|
|
547
|
+
The resting border binds Primary/Disabled, which is an odd token for a
|
|
548
|
+
non-disabled element, but it is what the file specifies. */
|
|
549
|
+
.nav-badge {
|
|
550
|
+
@apply inline-flex shrink-0 items-center justify-center;
|
|
551
|
+
@apply h-3.5 px-1; /* 14px, 4px */
|
|
552
|
+
@apply rounded-micro; /* Radius/Micro 2px */
|
|
553
|
+
@apply border border-[length:var(--border-thin)] border-primary-disabled;
|
|
554
|
+
@apply bg-primary-soft text-primary-dark;
|
|
555
|
+
@apply text-data-micro-m font-mono; /* 8.5px / normal / 500, JetBrains Mono */
|
|
556
|
+
@apply whitespace-nowrap;
|
|
557
|
+
}
|
|
558
|
+
}
|