@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,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pagination Item Component
|
|
3
|
+
*
|
|
4
|
+
* Individual pagination cell — page number, ellipsis, or navigation arrow.
|
|
5
|
+
* Extracted from Figma Pagination Item (894:1495) — 10 variants on a single
|
|
6
|
+
* `State` axis. Composes inside the Pagination bar.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* <button class="pagination-item">2</button>
|
|
10
|
+
* <button class="pagination-item pagination-item-active" aria-current="page">3</button>
|
|
11
|
+
* <span class="pagination-item pagination-item-ellipsis" aria-hidden="true">...</span>
|
|
12
|
+
* <button class="pagination-item pagination-item-nav" aria-label="Next page">
|
|
13
|
+
* <svg class="icon icon-size-14" aria-hidden="true"><use href="#chevron-right" /></svg>
|
|
14
|
+
* </button>
|
|
15
|
+
*
|
|
16
|
+
* A 32x32 box in every state. Four kinds, three of which take hover and
|
|
17
|
+
* pressed; ellipsis takes neither, because Figma draws none — it is a label,
|
|
18
|
+
* not a control, so it ships as a `<span>`.
|
|
19
|
+
*
|
|
20
|
+
* default Surface/Paper + 1px Stroke/Border, 13px mono, Content/Secondary
|
|
21
|
+
* active Primary/Main fill, Content/Contrast, NO stroke
|
|
22
|
+
* ellipsis no fill, no stroke, Content/Tertiary, a literal "..." text node
|
|
23
|
+
* nav the default box with a 14px icon, Secondary/Main
|
|
24
|
+
*
|
|
25
|
+
* default and nav are the same box; only the content and the token differ —
|
|
26
|
+
* default's label binds `Content/Secondary`, nav's glyph binds `Secondary/Main`.
|
|
27
|
+
* Both resolve to #5b5b68. The distinction is preserved because Figma draws it.
|
|
28
|
+
*
|
|
29
|
+
* THE SIX HOVER AND PRESSED STATES ARE NOT TOKENISED. This is the headline
|
|
30
|
+
* finding for this component and it is on the designer list. `get_variable_defs`
|
|
31
|
+
* returns almost nothing for those variants — only `Stroke/Line` — so their
|
|
32
|
+
* fills and strokes are raw values. Read by sampling the Figma render:
|
|
33
|
+
*
|
|
34
|
+
* state Figma raw shipped here delta
|
|
35
|
+
* default-hover #f2f2f5 Action/Hover 3.3 (imperceptible)
|
|
36
|
+
* default-pressed #e5e5eb Action/Selected 11.7
|
|
37
|
+
* active-hover #295c9e Primary/Dark see below
|
|
38
|
+
* active-pressed #143d75 Primary/Pressed 36.6 (see below)
|
|
39
|
+
*
|
|
40
|
+
* THE LABEL DARKENS TOO, which an earlier revision missed entirely: Figma draws
|
|
41
|
+
* it #40404d on hover and #2e2e38 on pressed against Content/Secondary at rest.
|
|
42
|
+
* The state rules only changed the background, so the label never moved. Both
|
|
43
|
+
* greys are as un-tokenised as the fills — the nearest are Secondary/Strong
|
|
44
|
+
* (delta 23.2) and Content/Primary (delta 45.3), which is what ships. A third
|
|
45
|
+
* un-tokenised axis, and the largest deltas in the component.
|
|
46
|
+
*
|
|
47
|
+
* The fills follow the Action ramp, which is what the progression clearly
|
|
48
|
+
* intends and lands within a few units of Figma. Surface/Neutral is marginally
|
|
49
|
+
* closer to the hover fill (delta 1.7) but is a surface token, not an
|
|
50
|
+
* interaction one — the wrong semantics for a hover state.
|
|
51
|
+
*
|
|
52
|
+
* ACTIVE HOVER GOES *LIGHTER* IN FIGMA (#295c9e against Primary/Main's
|
|
53
|
+
* #1e4d8c), where every other component in the library — Button, TextButton,
|
|
54
|
+
* Pill — darkens to Primary/Dark on hover. No lighter-primary token exists.
|
|
55
|
+
* Primary/Dark is used here so pagination behaves like the rest of the library;
|
|
56
|
+
* that is a deliberate divergence, not a match. Raised with the designer.
|
|
57
|
+
*
|
|
58
|
+
* THE BORDER DARKENS THROUGH THREE UN-TOKENISED GREYS: #e1e1e3 (rest, which IS
|
|
59
|
+
* exactly Stroke/Border), then #c6c6cc and #b1b1ba. Those two are Stroke/Border
|
|
60
|
+
* at rgba(20,20,40,0.2) and 0.25 EXACTLY — composited over the STATE FILL
|
|
61
|
+
* rather than over white, they reproduce the render with zero error. (An
|
|
62
|
+
* earlier revision said "roughly 0.24 and 0.33", derived over white; that was
|
|
63
|
+
* wrong.) The stroke ramp has no such steps —
|
|
64
|
+
* Stroke/Divider, Border and Disabled all sit at 0.129 or lighter. The border
|
|
65
|
+
* is therefore held at Stroke/Border in every state rather than inventing two
|
|
66
|
+
* alphas; the fill and label carry the state. Also on the designer list.
|
|
67
|
+
*
|
|
68
|
+
* ACTIVE-PRESSED IS THE WORST FIT HERE. Figma's #143d75 is 10.6 from
|
|
69
|
+
* Primary/Dark and 36.6 from the Primary/Pressed that ships. Primary/Dark is
|
|
70
|
+
* already spent on active-hover, and reusing it would flatten a state Figma
|
|
71
|
+
* distinguishes, so the library ramp is kept and the divergence recorded —
|
|
72
|
+
* previously only the hover one was.
|
|
73
|
+
*
|
|
74
|
+
* THE LABEL WEIGHT VARIES BY KIND, which is easy to miss because the size and
|
|
75
|
+
* family do not. Figma draws three different JetBrains Mono weights:
|
|
76
|
+
*
|
|
77
|
+
* default Medium (500)
|
|
78
|
+
* active Bold (700)
|
|
79
|
+
* ellipsis Regular (400)
|
|
80
|
+
*
|
|
81
|
+
* None of the three is a named Figma text style, and `--text-data-s` is
|
|
82
|
+
* Regular, so the token supplies family and size and each kind steps its own
|
|
83
|
+
* weight. An earlier revision of this file shipped Medium for all three.
|
|
84
|
+
*
|
|
85
|
+
* The 4px radius is raw in Figma too, but its value is exactly
|
|
86
|
+
* `--radius-tight`, so it is mapped rather than hardcoded.
|
|
87
|
+
*
|
|
88
|
+
* No disabled variant exists in Figma, but a pagination bar cannot work without
|
|
89
|
+
* one — the nav arrows disable at the first and last page. Added as a house
|
|
90
|
+
* convention using tokens rather than a blanket opacity, which is the treatment
|
|
91
|
+
* the visual harness rejected on IconButton.
|
|
92
|
+
*/
|
|
93
|
+
|
|
94
|
+
@layer components {
|
|
95
|
+
.pagination-item {
|
|
96
|
+
/* Layout — a fixed 32x32 cell in every state */
|
|
97
|
+
@apply inline-flex size-8 shrink-0 items-center justify-center;
|
|
98
|
+
|
|
99
|
+
/* Shape. 4px is raw in Figma but equals --radius-tight exactly. */
|
|
100
|
+
@apply rounded-tight;
|
|
101
|
+
@apply border border-[length:var(--border-line)] border-stroke-border;
|
|
102
|
+
|
|
103
|
+
/* Reset so the class works on button / a / span alike */
|
|
104
|
+
@apply appearance-none no-underline;
|
|
105
|
+
|
|
106
|
+
/* Colors — default */
|
|
107
|
+
@apply bg-surface-paper text-content-secondary;
|
|
108
|
+
|
|
109
|
+
/* Type — 13px JetBrains Mono, Medium for the default kind. Not a named
|
|
110
|
+
Figma style, and the WEIGHT VARIES BY KIND (see below), so --text-data-s
|
|
111
|
+
supplies family and size and each kind steps the weight itself. */
|
|
112
|
+
@apply text-data-s font-mono font-medium;
|
|
113
|
+
|
|
114
|
+
/* Interaction */
|
|
115
|
+
@apply cursor-pointer transition-colors duration-150;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/* --- States on the default box (shared with nav) ------------------------ */
|
|
119
|
+
|
|
120
|
+
/* Both kinds that own these are excluded by name rather than relying on
|
|
121
|
+
source order. `active` has its own ramp below, and `ellipsis` is a <span>
|
|
122
|
+
that :hover would otherwise still match. Equal-specificity rules resolved
|
|
123
|
+
by ordering are exactly the fragility the library audit flagged, so the
|
|
124
|
+
exclusions are explicit. */
|
|
125
|
+
.pagination-item:not(.pagination-item-active):not(
|
|
126
|
+
.pagination-item-ellipsis
|
|
127
|
+
):hover:not(:disabled):not([aria-disabled="true"]) {
|
|
128
|
+
@apply bg-action-hover text-secondary-strong;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.pagination-item:not(.pagination-item-active):not(
|
|
132
|
+
.pagination-item-ellipsis
|
|
133
|
+
):active:not(:disabled):not([aria-disabled="true"]) {
|
|
134
|
+
@apply bg-action-selected text-content-primary;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.pagination-item:focus-visible {
|
|
138
|
+
@apply focus-ring;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/* --- Kind: active ------------------------------------------------------- */
|
|
142
|
+
|
|
143
|
+
/* Figma draws no stroke here. A transparent border keeps the box arithmetic
|
|
144
|
+
identical to the other kinds, and the fill paints under it. */
|
|
145
|
+
.pagination-item-active {
|
|
146
|
+
@apply border-transparent bg-primary text-content-contrast;
|
|
147
|
+
@apply font-bold; /* JetBrains Mono Bold — heavier than default's Medium */
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/* Figma lightens on hover; the library darkens everywhere else. See header. */
|
|
151
|
+
.pagination-item-active:hover:not(:disabled):not([aria-disabled="true"]) {
|
|
152
|
+
@apply bg-primary-dark;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.pagination-item-active:active:not(:disabled):not([aria-disabled="true"]) {
|
|
156
|
+
@apply bg-primary-pressed;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/* Disabled must not repaint an active cell white — see the disabled rule at
|
|
160
|
+
the foot of the file, which is deliberately scoped away from active. */
|
|
161
|
+
.pagination-item-active:disabled,
|
|
162
|
+
.pagination-item-active[aria-disabled="true"] {
|
|
163
|
+
@apply border-transparent bg-primary-disabled text-content-contrast;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/* --- Kind: nav ---------------------------------------------------------- */
|
|
167
|
+
|
|
168
|
+
/* The same box as default. Only the content differs — a 14px icon, which the
|
|
169
|
+
call site sizes, as everywhere else in the library. */
|
|
170
|
+
.pagination-item-nav {
|
|
171
|
+
@apply text-secondary;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/* --- Kind: ellipsis ----------------------------------------------------- */
|
|
175
|
+
|
|
176
|
+
/* Not a control: no fill, no stroke, and Figma draws no hover or pressed.
|
|
177
|
+
Ships as a <span>, so the interactive rules above never apply. */
|
|
178
|
+
.pagination-item-ellipsis {
|
|
179
|
+
@apply border-transparent bg-transparent text-content-tertiary;
|
|
180
|
+
@apply font-normal; /* JetBrains Mono Regular — lighter than default's Medium */
|
|
181
|
+
@apply cursor-default;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/* --- Disabled (house convention — see header) --------------------------- */
|
|
185
|
+
|
|
186
|
+
.pagination-item:not(.pagination-item-active):disabled,
|
|
187
|
+
.pagination-item:not(.pagination-item-active)[aria-disabled="true"] {
|
|
188
|
+
@apply cursor-not-allowed bg-surface-paper text-content-faint;
|
|
189
|
+
@apply border-stroke-disabled;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.pagination-item-active:disabled,
|
|
193
|
+
.pagination-item-active[aria-disabled="true"] {
|
|
194
|
+
@apply cursor-not-allowed;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pagination Component
|
|
3
|
+
*
|
|
4
|
+
* Page navigation controls for multi-page data sets. Extracted from Figma
|
|
5
|
+
* Pagination (880:31248) — 2 variants on a single `Type` axis.
|
|
6
|
+
*
|
|
7
|
+
* Usage — numbered:
|
|
8
|
+
* <nav class="pagination" aria-label="Pagination">
|
|
9
|
+
* <div class="pagination-pages">
|
|
10
|
+
* <button class="pagination-item pagination-item-nav" aria-label="Previous page">…</button>
|
|
11
|
+
* <button class="pagination-item pagination-item-active" aria-current="page">1</button>
|
|
12
|
+
* <button class="pagination-item">2</button>
|
|
13
|
+
* <span class="pagination-item pagination-item-ellipsis" aria-hidden="true">...</span>
|
|
14
|
+
* <button class="pagination-item pagination-item-nav" aria-label="Next page">…</button>
|
|
15
|
+
* </div>
|
|
16
|
+
* <p class="pagination-summary">1-20 of 352</p>
|
|
17
|
+
* </nav>
|
|
18
|
+
*
|
|
19
|
+
* Usage — simple:
|
|
20
|
+
* <nav class="pagination" aria-label="Pagination">
|
|
21
|
+
* <button class="btn btn-outline btn-sm">
|
|
22
|
+
* <svg class="icon icon-size-13" aria-hidden="true"><use href="#chevron-left" /></svg>
|
|
23
|
+
* Prev
|
|
24
|
+
* </button>
|
|
25
|
+
* <p class="pagination-status">
|
|
26
|
+
* Page <span class="pagination-status-current">7</span> of 18
|
|
27
|
+
* </p>
|
|
28
|
+
* <button class="btn btn-outline btn-sm">
|
|
29
|
+
* Next
|
|
30
|
+
* <svg class="icon icon-size-13" aria-hidden="true"><use href="#chevron-right" /></svg>
|
|
31
|
+
* </button>
|
|
32
|
+
* </nav>
|
|
33
|
+
*
|
|
34
|
+
* BOTH TYPES SHARE THE SAME ROOT, so there is no `.pagination-simple` modifier.
|
|
35
|
+
* Figma draws `flex items-center justify-between` at full width for each; only
|
|
36
|
+
* the children differ. Adding a modifier that set nothing would be noise.
|
|
37
|
+
*
|
|
38
|
+
* EVERYTHING INTERACTIVE HERE IS AN EXISTING COMPONENT. The numbered type is
|
|
39
|
+
* `.pagination-item` cells; the simple type's Prev and Next are literal Button
|
|
40
|
+
* instances, and their Figma geometry — 24px tall, 8px/5px padding, 5px gap,
|
|
41
|
+
* 6px radius, 0.5px `Stroke/Divider`, `Action S` 12/500 in `Content/Primary` —
|
|
42
|
+
* is `.btn .btn-outline .btn-sm` down to the pixel, with a 13px icon. Nothing
|
|
43
|
+
* new is defined for either.
|
|
44
|
+
*
|
|
45
|
+
* TWO FIGMA ODDITIES, reported rather than reproduced:
|
|
46
|
+
* - The numbered bar's TRAILING nav cell points LEFT, identical to the
|
|
47
|
+
* leading one — the instance was never flipped. Shipped pointing right,
|
|
48
|
+
* because a "next" arrow that points backwards is not a design decision.
|
|
49
|
+
* - The two bars use different arrow families: the numbered cells carry
|
|
50
|
+
* chevrons (`#chevron-left` / `#chevron-right`) while simple's buttons
|
|
51
|
+
* carry true arrows (`#arrow-left` / `#arrow-right`). Reproduced as drawn,
|
|
52
|
+
* but worth confirming it is deliberate.
|
|
53
|
+
*
|
|
54
|
+
* WIDTH IS NOT PINNED. Figma's 1208px is the artboard's content width, and a
|
|
55
|
+
* pagination bar spans its table. Contrast Modal (480) and Toast (356), which
|
|
56
|
+
* are genuinely fixed and are pinned.
|
|
57
|
+
*
|
|
58
|
+
* The 4px gap between cells is `Spacing/4`, and it belongs to the bar rather
|
|
59
|
+
* than the item — `.pagination-item` sets no margin, so cells used outside this
|
|
60
|
+
* container space themselves.
|
|
61
|
+
*
|
|
62
|
+
* TWO TYPE READINGS ARE RAW, not named Figma styles:
|
|
63
|
+
* - `.pagination-summary` is 12px JetBrains Mono Regular, which is exactly
|
|
64
|
+
* `--text-data-xs`, so it maps cleanly.
|
|
65
|
+
* - `.pagination-status` is 13px Inter Regular with its current page in
|
|
66
|
+
* Semi Bold. `--text-body-1` supplies 13px/400 but carries a 19.5px
|
|
67
|
+
* line-height where Figma is Auto, and there is no 13px Inter 600 token —
|
|
68
|
+
* `--text-body-1-bold` is Medium/500 — so the weight is stepped explicitly.
|
|
69
|
+
* Neither difference is visible: the bar's height comes from the 24px
|
|
70
|
+
* buttons, not the line box.
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
@layer components {
|
|
74
|
+
.pagination {
|
|
75
|
+
/* Both types. Full width so the ends sit against the table's edges. */
|
|
76
|
+
@apply flex w-full items-center justify-between;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* --- Numbered ----------------------------------------------------------- */
|
|
80
|
+
|
|
81
|
+
/* The cell row. 4px gap — Spacing/4, owned by the bar, not the cell. */
|
|
82
|
+
.pagination-pages {
|
|
83
|
+
@apply flex shrink-0 items-center gap-1;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* "1-20 of 352" */
|
|
87
|
+
.pagination-summary {
|
|
88
|
+
@apply shrink-0;
|
|
89
|
+
@apply text-data-xs font-mono; /* 12px / 16.5px / 400, JetBrains Mono */
|
|
90
|
+
@apply text-content-secondary;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* --- Simple ------------------------------------------------------------- */
|
|
94
|
+
|
|
95
|
+
/* "Page 7 of 18" */
|
|
96
|
+
.pagination-status {
|
|
97
|
+
@apply shrink-0;
|
|
98
|
+
@apply text-body-1; /* 13px / 400 — Figma's leading is Auto; see the header */
|
|
99
|
+
@apply text-content-secondary;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* The page number inside the status. Inter Semi Bold in Figma, which no 13px
|
|
103
|
+
token carries — --text-body-1-bold is Medium. Stepped explicitly. */
|
|
104
|
+
.pagination-status-current {
|
|
105
|
+
@apply font-semibold;
|
|
106
|
+
@apply text-content-primary;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pill Component
|
|
3
|
+
*
|
|
4
|
+
* Compact rounded control. Extracted from Figma Pill (91:505) — 6 variants
|
|
5
|
+
* (State rest/hover/active × Dropdown Yes/No), plus a Ring boolean.
|
|
6
|
+
*
|
|
7
|
+
* Figma describes it as "Rounded pill-shaped toggle used for segmented
|
|
8
|
+
* selections and filter options."
|
|
9
|
+
*
|
|
10
|
+
* Usage — as a dropdown trigger:
|
|
11
|
+
* <button class="pill" aria-haspopup="listbox" aria-expanded="false">
|
|
12
|
+
* John Smith
|
|
13
|
+
* <svg class="pill-chevron icon icon-size-13" aria-hidden="true">
|
|
14
|
+
* <use href="#chevron-down" />
|
|
15
|
+
* </svg>
|
|
16
|
+
* </button>
|
|
17
|
+
*
|
|
18
|
+
* Usage — as a filter toggle (no chevron):
|
|
19
|
+
* <button class="pill" aria-pressed="false">Overdue</button>
|
|
20
|
+
*
|
|
21
|
+
* ACTIVE MEANS TWO THINGS, and which one depends on the chevron. Figma draws a
|
|
22
|
+
* single "active" treatment but ships both a Dropdown=Yes and a Dropdown=No
|
|
23
|
+
* variant, so it has to serve both:
|
|
24
|
+
* with a chevron -> active = menu open -> aria-expanded="true"
|
|
25
|
+
* without a chevron -> active = selected -> aria-pressed="true"
|
|
26
|
+
* Both attributes drive the same fill and text colour; only aria-expanded
|
|
27
|
+
* rotates the chevron, because a selected pill has nothing to flip.
|
|
28
|
+
*
|
|
29
|
+
* TOKEN NAMES ARE OFF BY ONE HERE, and this is not a mistake to fix: the REST
|
|
30
|
+
* background is the token literally named `Action/Hover`, and the HOVER
|
|
31
|
+
* background is `Action/Focused`. It reads like a bug in review. It is what
|
|
32
|
+
* the design file specifies.
|
|
33
|
+
*
|
|
34
|
+
* "Statecap" is NOT uppercase. Despite the style name, Figma renders the label
|
|
35
|
+
* mixed-case with no text-transform. Do not add `uppercase`.
|
|
36
|
+
*
|
|
37
|
+
* Height is pinned at 17px. Without a chevron the line box alone would give
|
|
38
|
+
* ~15.5px, because `--text-statecap` carries an Auto line height that is
|
|
39
|
+
* font-dependent — see CLAUDE.md. Figma is 17px with or without the chevron.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
@layer components {
|
|
43
|
+
.pill {
|
|
44
|
+
/* Layout */
|
|
45
|
+
@apply inline-flex shrink-0 items-center gap-1.25; /* 5px gap */
|
|
46
|
+
@apply px-2.25 py-0.5; /* 9px / 2px */
|
|
47
|
+
@apply h-[17px];
|
|
48
|
+
|
|
49
|
+
/* Shape — no border at any state */
|
|
50
|
+
@apply rounded-pill;
|
|
51
|
+
@apply border-none;
|
|
52
|
+
|
|
53
|
+
/* Reset so the class works on button / a / div alike */
|
|
54
|
+
@apply appearance-none text-left no-underline;
|
|
55
|
+
|
|
56
|
+
/* Colors — rest. Yes, rest really is Action/Hover; see the header. */
|
|
57
|
+
@apply bg-action-hover text-content-secondary;
|
|
58
|
+
|
|
59
|
+
/* Type — 9.5px / 600, mixed case */
|
|
60
|
+
@apply text-statecap;
|
|
61
|
+
|
|
62
|
+
/* Interaction */
|
|
63
|
+
@apply cursor-pointer transition-colors duration-150;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* --- Parts ------------------------------------------------------------ */
|
|
67
|
+
|
|
68
|
+
/* 13px trailing chevron. Present only on the Dropdown=Yes variant. */
|
|
69
|
+
.pill-chevron {
|
|
70
|
+
@apply shrink-0;
|
|
71
|
+
@apply transition-transform duration-150;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* --- States ----------------------------------------------------------- */
|
|
75
|
+
|
|
76
|
+
.pill:hover:not(:disabled):not([aria-disabled="true"]) {
|
|
77
|
+
@apply bg-action-focused;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.pill:focus-visible {
|
|
81
|
+
@apply focus-ring;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* Active — open (with a chevron) or selected (without one). */
|
|
85
|
+
.pill[aria-expanded="true"],
|
|
86
|
+
.pill[aria-pressed="true"],
|
|
87
|
+
.pill[aria-selected="true"] {
|
|
88
|
+
@apply bg-primary-soft text-primary;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* Only an open menu flips the chevron. A selected pill does not. */
|
|
92
|
+
.pill[aria-expanded="true"] .pill-chevron {
|
|
93
|
+
@apply rotate-180;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* Figma has no disabled variant. Following the house convention so the
|
|
97
|
+
control is not silently clickable when a consumer disables it. */
|
|
98
|
+
.pill:disabled,
|
|
99
|
+
.pill[aria-disabled="true"] {
|
|
100
|
+
@apply cursor-not-allowed opacity-50;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Ring — Figma boolean, hidden by default. Same 2px inset Primary/Main
|
|
104
|
+
treatment as Chip and Avatar. */
|
|
105
|
+
.pill.with-ring {
|
|
106
|
+
@apply ring-[length:var(--border-micro)] ring-inset ring-primary;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Progress Bar Component
|
|
3
|
+
*
|
|
4
|
+
* Extracted from Figma Progress Bar (1032:1991) — 2 variants, plus Top Content
|
|
5
|
+
* and Bottom Content booleans and two text properties.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* <div class="progress-bar">
|
|
9
|
+
* <div class="progress-bar-header">
|
|
10
|
+
* <span class="progress-bar-title">Review completion</span>
|
|
11
|
+
* <span class="progress-bar-value">68%</span>
|
|
12
|
+
* </div>
|
|
13
|
+
*
|
|
14
|
+
* <div class="progress-bar-track" role="progressbar"
|
|
15
|
+
* aria-valuenow="68" aria-valuemin="0" aria-valuemax="100">
|
|
16
|
+
* <div class="progress-bar-fill" style="width: 68%"></div>
|
|
17
|
+
* </div>
|
|
18
|
+
*
|
|
19
|
+
* <div class="progress-bar-legend">
|
|
20
|
+
* <span class="progress-bar-legend-item">
|
|
21
|
+
* <span class="progress-bar-legend-swatch"></span>
|
|
22
|
+
* <span class="progress-bar-legend-label">68% verified</span>
|
|
23
|
+
* </span>
|
|
24
|
+
* <span class="progress-bar-legend-item">
|
|
25
|
+
* <span class="progress-bar-legend-swatch progress-bar-legend-swatch-neutral"></span>
|
|
26
|
+
* <span class="progress-bar-legend-label">32% unaccounted</span>
|
|
27
|
+
* </span>
|
|
28
|
+
* </div>
|
|
29
|
+
* </div>
|
|
30
|
+
*
|
|
31
|
+
* FIGMA'S VARIANT PROPERTY IS MISNAMED. The axis is called `Has Legend`, but it
|
|
32
|
+
* does not control the legend: BOTH variants render the legend row, which is
|
|
33
|
+
* gated by a separate `Bottom Content` boolean that is true in each. What the
|
|
34
|
+
* property actually swaps is the COLOUR SCHEME — `Has Legend=false` is
|
|
35
|
+
* Primary/Main throughout, `true` is the Approved ramp — plus the sample copy.
|
|
36
|
+
* It is therefore implemented as a colour modifier and renamed, because
|
|
37
|
+
* shipping a class called `has-legend` that changes colour would be worse than
|
|
38
|
+
* the original mistake. On the designer list.
|
|
39
|
+
*
|
|
40
|
+
* scheme value text fill + first swatch
|
|
41
|
+
* base (default) Primary/Main Primary/Main
|
|
42
|
+
* `-success` Approved/CONTENT Approved/Main
|
|
43
|
+
*
|
|
44
|
+
* Note the success scheme uses two different Approved tokens: `Approved/Content`
|
|
45
|
+
* for the value text and `Approved/Main` for the fill. The same split Modal's
|
|
46
|
+
* positive variant has.
|
|
47
|
+
*
|
|
48
|
+
* THE `false` VARIANT CONTRADICTS ITSELF THREE WAYS, which is worth knowing
|
|
49
|
+
* before treating its numbers as a spec: its value label reads 92%, its fill is
|
|
50
|
+
* 260 of 360 (72%), and its legend says 68%. The `true` variant is internally
|
|
51
|
+
* consistent at 92 / 92 / 92, so the blue one looks like an un-updated
|
|
52
|
+
* duplicate. Also on the designer list. The story uses 68% throughout for the
|
|
53
|
+
* base scheme, since the legend is the only number that appears twice.
|
|
54
|
+
*
|
|
55
|
+
* THE TRACK IS FULL WIDTH HERE, where Figma fixes it at 360px inside a 400px
|
|
56
|
+
* frame while the label and legend rows are both full width — so the bar stops
|
|
57
|
+
* 40px short of everything above and below it, with no padding on the root to
|
|
58
|
+
* explain it. That reads as an authoring slip rather than an inset, and a
|
|
59
|
+
* progress track that does not span its container is not shippable. Same
|
|
60
|
+
* judgement as Alert's 828px.
|
|
61
|
+
*
|
|
62
|
+
* THE ROOT'S 8px RADIUS IS VESTIGIAL and is not reproduced: Figma sets it on a
|
|
63
|
+
* frame with no fill and no border, so it clips nothing and paints nothing.
|
|
64
|
+
*
|
|
65
|
+
* THE TYPE IS RAW — Figma binds no text style to any of the three. The value's
|
|
66
|
+
* 13px Inter Medium happens to equal `--text-action-l` exactly, but that is a
|
|
67
|
+
* Button & Actions token and coupling a progress readout to it would mean a
|
|
68
|
+
* button change silently moved this. Written directly instead.
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
@layer components {
|
|
72
|
+
.progress-bar {
|
|
73
|
+
@apply flex w-full flex-col items-start gap-3; /* 12px */
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/* --- Label row (Figma's Top Content boolean) ---------------------------- */
|
|
77
|
+
|
|
78
|
+
.progress-bar-header {
|
|
79
|
+
@apply flex w-full items-center justify-between;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.progress-bar-title {
|
|
83
|
+
@apply shrink-0;
|
|
84
|
+
@apply text-[11px] font-medium uppercase;
|
|
85
|
+
@apply leading-[normal] tracking-[0.5px];
|
|
86
|
+
@apply text-content-primary;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* Colour comes from the scheme — see the bottom of the file. */
|
|
90
|
+
.progress-bar-value {
|
|
91
|
+
@apply shrink-0;
|
|
92
|
+
@apply text-[13px] font-medium;
|
|
93
|
+
@apply leading-[normal];
|
|
94
|
+
@apply text-primary;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* --- Track and fill ------------------------------------------------------ */
|
|
98
|
+
|
|
99
|
+
/* Full width by choice; Figma's 360 is a slip. See the header. */
|
|
100
|
+
.progress-bar-track {
|
|
101
|
+
@apply flex w-full items-start overflow-hidden;
|
|
102
|
+
@apply h-[5px];
|
|
103
|
+
@apply rounded-pill;
|
|
104
|
+
@apply bg-stroke-divider;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* The consumer sets the width — `style="width: 68%"` or a utility. */
|
|
108
|
+
.progress-bar-fill {
|
|
109
|
+
@apply h-full shrink-0;
|
|
110
|
+
@apply rounded-pill;
|
|
111
|
+
@apply bg-primary;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* --- Legend row (Figma's Bottom Content boolean) ------------------------- */
|
|
115
|
+
|
|
116
|
+
.progress-bar-legend {
|
|
117
|
+
@apply flex w-full items-start gap-4; /* 16px */
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.progress-bar-legend-item {
|
|
121
|
+
@apply inline-flex shrink-0 items-center gap-1.5; /* 6px */
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.progress-bar-legend-swatch {
|
|
125
|
+
@apply size-2 shrink-0; /* 8px */
|
|
126
|
+
@apply rounded-micro; /* 2px */
|
|
127
|
+
@apply bg-primary;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* The unaccounted remainder is Neutral/Main in both schemes. */
|
|
131
|
+
.progress-bar-legend-swatch-neutral {
|
|
132
|
+
@apply bg-neutral;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.progress-bar-legend-label {
|
|
136
|
+
@apply text-[12px] font-normal;
|
|
137
|
+
@apply leading-[normal];
|
|
138
|
+
@apply text-content-secondary;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/* --- Scheme = success ---------------------------------------------------- */
|
|
142
|
+
|
|
143
|
+
/* Compound selectors so the scheme beats the base on specificity rather than
|
|
144
|
+
on source order, and so the neutral swatch is never recoloured. */
|
|
145
|
+
.progress-bar-success .progress-bar-value {
|
|
146
|
+
@apply text-approved-content;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.progress-bar-success .progress-bar-fill {
|
|
150
|
+
@apply bg-approved;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.progress-bar-success
|
|
154
|
+
.progress-bar-legend-swatch:not(.progress-bar-legend-swatch-neutral) {
|
|
155
|
+
@apply bg-approved;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Radio Select Component
|
|
3
|
+
*
|
|
4
|
+
* Radio button input for single-selection from a group with label support.
|
|
5
|
+
* Token-exact implementation from Figma (Radio component).
|
|
6
|
+
*
|
|
7
|
+
* Circle: 15px × 15px
|
|
8
|
+
* Inner dot (when selected): 8px × 8px
|
|
9
|
+
* Gap between radio and label: 9px (gap-2.25, Spacing/9)
|
|
10
|
+
* Typography: var(--text-caption) for label
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* <label class="radio-select">
|
|
14
|
+
* <input type="radio" name="group" class="radio-select-input" />
|
|
15
|
+
* <span class="radio-select-label">Label text</span>
|
|
16
|
+
* </label>
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
@layer components {
|
|
20
|
+
.radio-select {
|
|
21
|
+
/* Layout - horizontal with gap between radio and label */
|
|
22
|
+
@apply inline-flex items-center gap-2.25; /* Figma Spacing/9 (9px) */
|
|
23
|
+
@apply cursor-pointer;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.radio-select-input {
|
|
27
|
+
/* Reset native appearance */
|
|
28
|
+
@apply appearance-none;
|
|
29
|
+
@apply m-0 p-0;
|
|
30
|
+
@apply shrink-0; /* Prevent circle from being squished */
|
|
31
|
+
@apply cursor-pointer;
|
|
32
|
+
|
|
33
|
+
/* Dimensions - exact 15px circle from Figma */
|
|
34
|
+
@apply size-[15px];
|
|
35
|
+
|
|
36
|
+
/* Shape */
|
|
37
|
+
@apply rounded-pill; /* Figma Radius/Rounded (9999px) */
|
|
38
|
+
@apply border border-[length:var(--border-line)]; /* Figma 1px border */
|
|
39
|
+
|
|
40
|
+
/* Default state colors */
|
|
41
|
+
@apply border-stroke-border bg-surface-paper;
|
|
42
|
+
|
|
43
|
+
@apply transition-colors duration-150;
|
|
44
|
+
|
|
45
|
+
/* Position context for the inner dot pseudo-element */
|
|
46
|
+
@apply relative;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* Inner dot (selected state) - created with ::before pseudo-element */
|
|
50
|
+
.radio-select-input:checked::before {
|
|
51
|
+
@apply content-[''];
|
|
52
|
+
@apply absolute;
|
|
53
|
+
@apply inset-0 m-auto; /* Center the 8px dot in the 15px circle */
|
|
54
|
+
@apply size-[8px]; /* Figma inner dot size */
|
|
55
|
+
@apply rounded-pill;
|
|
56
|
+
@apply bg-primary; /* Figma Primary/Main */
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* Hover state */
|
|
60
|
+
.radio-select-input:hover:not(:disabled) {
|
|
61
|
+
@apply border-secondary; /* Figma Secondary/Main */
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* Active/Selected state - border changes to primary */
|
|
65
|
+
.radio-select-input:checked {
|
|
66
|
+
@apply border-primary; /* Figma Primary/Main */
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* Focused state - keyboard navigation ring */
|
|
70
|
+
.radio-select-input:focus-visible {
|
|
71
|
+
@apply focus-ring; /* Figma Menu Item > Ring: 2px Primary/Main */
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* Disabled state */
|
|
75
|
+
.radio-select-input:disabled {
|
|
76
|
+
@apply cursor-not-allowed;
|
|
77
|
+
@apply border-stroke-divider bg-surface-paper; /* Figma Stroke/Divider */
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* Disabled selected state - keep the dot but with disabled styling */
|
|
81
|
+
.radio-select-input:disabled:checked::before {
|
|
82
|
+
@apply bg-stroke-divider; /* Match the disabled border */
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* Label text */
|
|
86
|
+
.radio-select-label {
|
|
87
|
+
/* Typography from Figma */
|
|
88
|
+
@apply text-caption; /* Figma Body Content/Caption (12px/18px/400) */
|
|
89
|
+
@apply text-content-primary; /* Default text color */
|
|
90
|
+
@apply select-none; /* Prevent text selection on click */
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* Disabled label text */
|
|
94
|
+
.radio-select:has(.radio-select-input:disabled) .radio-select-label {
|
|
95
|
+
@apply text-content-tertiary; /* Figma Content/Tertiary */
|
|
96
|
+
}
|
|
97
|
+
}
|