@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
package/package.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@valiify/dashboard-ui",
|
|
3
|
+
"version": "0.1.0-alpha.1",
|
|
4
|
+
"description": "Tailwind CSS component library for Valiify Dashboard applications",
|
|
5
|
+
"style": "dist/index.css",
|
|
6
|
+
"types": "types/index.d.ts",
|
|
7
|
+
"sideEffects": [
|
|
8
|
+
"*.css"
|
|
9
|
+
],
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./dist/index.css",
|
|
12
|
+
"./index.css": "./dist/index.css",
|
|
13
|
+
"./fonts": "./src/fonts.css",
|
|
14
|
+
"./source": "./src/library.css",
|
|
15
|
+
"./icons/sprite.svg": "./src/icons/sprite.svg",
|
|
16
|
+
"./types": "./types/index.d.ts"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"src",
|
|
21
|
+
"types",
|
|
22
|
+
"README.md",
|
|
23
|
+
"CHANGELOG.md"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "npm run build:theme && npm run build:icons && postcss src/index.css -o dist/index.css",
|
|
27
|
+
"prepack": "npm run build",
|
|
28
|
+
"build:theme": "node scripts/build-theme.mjs",
|
|
29
|
+
"build:icons": "node scripts/build-sprite.mjs",
|
|
30
|
+
"dev": "postcss src/index.css -o dist/index.css --watch",
|
|
31
|
+
"typecheck": "tsc --noEmit",
|
|
32
|
+
"format": "prettier --write .",
|
|
33
|
+
"new:component": "node scripts/new-component.mjs",
|
|
34
|
+
"verify:component": "node scripts/verify-component.mjs",
|
|
35
|
+
"verify:layers": "node scripts/verify-layers.mjs",
|
|
36
|
+
"storybook": "storybook dev -p 6006",
|
|
37
|
+
"build-storybook": "storybook build",
|
|
38
|
+
"verify:visual": "node scripts/visual-verify.mjs",
|
|
39
|
+
"verify:a11y": "node scripts/a11y-scan.mjs",
|
|
40
|
+
"audit": "node scripts/audit-components.mjs",
|
|
41
|
+
"chromatic": "chromatic"
|
|
42
|
+
},
|
|
43
|
+
"keywords": [
|
|
44
|
+
"tailwind",
|
|
45
|
+
"tailwindcss",
|
|
46
|
+
"css",
|
|
47
|
+
"components",
|
|
48
|
+
"valiify",
|
|
49
|
+
"dashboard",
|
|
50
|
+
"ui"
|
|
51
|
+
],
|
|
52
|
+
"author": "Valiify",
|
|
53
|
+
"license": "MIT",
|
|
54
|
+
"repository": {
|
|
55
|
+
"type": "git",
|
|
56
|
+
"url": "git+https://github.com/BubbaCoop/Valiify-dashboard-ui.git"
|
|
57
|
+
},
|
|
58
|
+
"publishConfig": {
|
|
59
|
+
"access": "public"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@storybook/addon-a11y": "^10.5.10",
|
|
63
|
+
"@storybook/addon-docs": "^10.5.10",
|
|
64
|
+
"@storybook/addon-mcp": "^0.7.0",
|
|
65
|
+
"@storybook/addon-themes": "^10.5.10",
|
|
66
|
+
"@storybook/html-vite": "^10.5.10",
|
|
67
|
+
"@tailwindcss/postcss": "^4.3.3",
|
|
68
|
+
"chromatic": "^18.6.0",
|
|
69
|
+
"lucide-static": "^1.33.0",
|
|
70
|
+
"playwright": "^1.62.1",
|
|
71
|
+
"postcss": "^8.5.26",
|
|
72
|
+
"postcss-cli": "^11.0.1",
|
|
73
|
+
"prettier": "^3.9.6",
|
|
74
|
+
"prettier-plugin-tailwindcss": "^0.6.14",
|
|
75
|
+
"storybook": "^10.5.10",
|
|
76
|
+
"tailwindcss": "^4.3.3",
|
|
77
|
+
"typescript": "^5.9.3"
|
|
78
|
+
},
|
|
79
|
+
"peerDependencies": {
|
|
80
|
+
"tailwindcss": ">=4.0.0"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Styles
|
|
3
|
+
*
|
|
4
|
+
* Document-level defaults. Kept deliberately small — anything reusable belongs
|
|
5
|
+
* in a component or as a theme token.
|
|
6
|
+
*
|
|
7
|
+
* Fonts are NOT loaded here. The @font-face import lives at the top of
|
|
8
|
+
* src/index.css because CSS requires every @import to precede all other rules;
|
|
9
|
+
* an @import nested in a @layer block is discarded by the browser.
|
|
10
|
+
*
|
|
11
|
+
* Font families themselves come from --font-sans / --font-mono in
|
|
12
|
+
* themes/valiify.css. Tailwind's preflight wires those into html and
|
|
13
|
+
* code/pre automatically, so there is no need to restate them.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
@layer base {
|
|
17
|
+
html {
|
|
18
|
+
color: var(--color-content-primary);
|
|
19
|
+
background-color: var(--color-surface-frame);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
# Icon System Integration Guide
|
|
2
|
+
|
|
3
|
+
Complete guide for using icons consistently across the Valiify Dashboard UI.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The icon system has three parts that work together:
|
|
8
|
+
|
|
9
|
+
1. **Icon Sprite** (`src/icons/sprite.svg`) - 2,035 icons (Lucide + custom)
|
|
10
|
+
2. **Icon Component** (`icon.css`) - 11 standardized sizes + ring state
|
|
11
|
+
3. **Usage Pattern** - How to use icons in components
|
|
12
|
+
|
|
13
|
+
## The Three-Part System
|
|
14
|
+
|
|
15
|
+
### 1. Icon Sprite (SVG Library)
|
|
16
|
+
|
|
17
|
+
All icons live in one optimized SVG sprite file:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
src/icons/
|
|
21
|
+
├── sprite.svg # Generated sprite (2035 icons)
|
|
22
|
+
├── icon-list.txt # Searchable names
|
|
23
|
+
└── custom/ # Your custom icons
|
|
24
|
+
└── valiify-logo.svg
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Build command**: `npm run build:icons`
|
|
28
|
+
|
|
29
|
+
### 2. Icon Component (Size Container)
|
|
30
|
+
|
|
31
|
+
CSS classes that enforce consistent sizing:
|
|
32
|
+
|
|
33
|
+
```css
|
|
34
|
+
.icon /* Base: 16×16px (default) */
|
|
35
|
+
.icon-size-10 /* 10×10px */
|
|
36
|
+
.icon-size-11 /* 11×11px */
|
|
37
|
+
.icon-size-12 /* 12×12px */
|
|
38
|
+
.icon-size-13 /* 13×13px */
|
|
39
|
+
.icon-size-14 /* 14×14px */
|
|
40
|
+
.icon-size-15 /* 15×15px */
|
|
41
|
+
.icon-size-16 /* 16×16px ⭐ Common */
|
|
42
|
+
.icon-size-18 /* 18×18px */
|
|
43
|
+
.icon-size-20 /* 20×20px ⭐ Common */
|
|
44
|
+
.icon-size-22 /* 22×22px */
|
|
45
|
+
.icon-size-24 /* 24×24px ⭐ Common */
|
|
46
|
+
.icon-ring /* Adds circular border (selected/active) */
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 3. Usage Pattern (The Standard)
|
|
50
|
+
|
|
51
|
+
**Every icon in the system uses this exact pattern:**
|
|
52
|
+
|
|
53
|
+
```html
|
|
54
|
+
<svg class="icon icon-size-20" aria-hidden="true">
|
|
55
|
+
<use href="#icon-name" />
|
|
56
|
+
</svg>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Icon Sizing Standards
|
|
60
|
+
|
|
61
|
+
### Recommended Sizes by Context
|
|
62
|
+
|
|
63
|
+
| Context | Size | Class | Use Case |
|
|
64
|
+
|---------|------|-------|----------|
|
|
65
|
+
| **Micro** | 12px | `icon-size-12` | Inline text indicators, badges |
|
|
66
|
+
| **Small** | 13px | `icon-size-13` | Small buttons (24px) |
|
|
67
|
+
| **Medium** | 14px | `icon-size-14` | ⭐ **Default buttons (28px)** |
|
|
68
|
+
| **Large** | 15px | `icon-size-15` | Large buttons (32px) |
|
|
69
|
+
| **XL** | 20-24px | `icon-size-20/24` | Headers, hero elements |
|
|
70
|
+
| **Custom** | varies | `icon-size-*` | Special cases |
|
|
71
|
+
|
|
72
|
+
### Component-Specific Sizing
|
|
73
|
+
|
|
74
|
+
| Component | Recommended Size | Example |
|
|
75
|
+
|-----------|------------------|---------|
|
|
76
|
+
| **Button (small)** | 13px | `icon-size-13` |
|
|
77
|
+
| **Button (medium)** | 14px | `icon-size-14` |
|
|
78
|
+
| **Button (large)** | 15px | `icon-size-15` |
|
|
79
|
+
| **Chip/Badge** | 12-14px | `icon-size-12` or `icon-size-14` |
|
|
80
|
+
| **Input** | 16px | `icon-size-16` |
|
|
81
|
+
| **Navigation** | 20-24px | `icon-size-20` or `icon-size-24` |
|
|
82
|
+
| **Status indicators** | 12-16px | `icon-size-12` to `icon-size-16` |
|
|
83
|
+
|
|
84
|
+
## Complete Usage Examples
|
|
85
|
+
|
|
86
|
+
### Basic Icon
|
|
87
|
+
```html
|
|
88
|
+
<!-- Standalone icon -->
|
|
89
|
+
<svg class="icon icon-size-20" aria-hidden="true">
|
|
90
|
+
<use href="#search" />
|
|
91
|
+
</svg>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Icon in Button
|
|
95
|
+
```html
|
|
96
|
+
<!-- Icon with text label -->
|
|
97
|
+
<button class="btn btn-primary">
|
|
98
|
+
<svg class="icon icon-size-14" aria-hidden="true">
|
|
99
|
+
<use href="#save" />
|
|
100
|
+
</svg>
|
|
101
|
+
Save Changes
|
|
102
|
+
</button>
|
|
103
|
+
|
|
104
|
+
<!-- Icon-only button (requires aria-label) -->
|
|
105
|
+
<button class="btn btn-outline" aria-label="Close">
|
|
106
|
+
<svg class="icon icon-size-13" aria-hidden="true">
|
|
107
|
+
<use href="#x" />
|
|
108
|
+
</svg>
|
|
109
|
+
</button>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Icon with Ring State (Selected)
|
|
113
|
+
```html
|
|
114
|
+
<!-- Active/selected icon with circular border -->
|
|
115
|
+
<svg class="icon icon-size-20 icon-ring" role="img" aria-label="Selected">
|
|
116
|
+
<use href="#check" />
|
|
117
|
+
</svg>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Icon with Status Color
|
|
121
|
+
```html
|
|
122
|
+
<!-- Success icon -->
|
|
123
|
+
<svg class="icon icon-size-16 text-approved" aria-hidden="true">
|
|
124
|
+
<use href="#check-circle" />
|
|
125
|
+
</svg>
|
|
126
|
+
|
|
127
|
+
<!-- Error icon -->
|
|
128
|
+
<svg class="icon icon-size-16 text-critical" aria-hidden="true">
|
|
129
|
+
<use href="#x-circle" />
|
|
130
|
+
</svg>
|
|
131
|
+
|
|
132
|
+
<!-- Warning icon -->
|
|
133
|
+
<svg class="icon icon-size-16 text-warning" aria-hidden="true">
|
|
134
|
+
<use href="#alert-circle" />
|
|
135
|
+
</svg>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Custom Icon
|
|
139
|
+
```html
|
|
140
|
+
<!-- Custom icons are prefixed with 'custom-' -->
|
|
141
|
+
<svg class="icon icon-size-24" aria-hidden="true">
|
|
142
|
+
<use href="#custom-valiify-logo" />
|
|
143
|
+
</svg>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Component Integration Patterns
|
|
147
|
+
|
|
148
|
+
### Button Component
|
|
149
|
+
|
|
150
|
+
**Standard pattern for buttons:**
|
|
151
|
+
|
|
152
|
+
```html
|
|
153
|
+
<!-- Small button (13px icons) -->
|
|
154
|
+
<button class="btn btn-outline btn-sm">
|
|
155
|
+
<svg class="icon icon-size-13" aria-hidden="true">
|
|
156
|
+
<use href="#filter" />
|
|
157
|
+
</svg>
|
|
158
|
+
Filter
|
|
159
|
+
</button>
|
|
160
|
+
|
|
161
|
+
<!-- Medium button (14px icons) - DEFAULT -->
|
|
162
|
+
<button class="btn btn-primary">
|
|
163
|
+
<svg class="icon icon-size-14" aria-hidden="true">
|
|
164
|
+
<use href="#save" />
|
|
165
|
+
</svg>
|
|
166
|
+
Save
|
|
167
|
+
</button>
|
|
168
|
+
|
|
169
|
+
<!-- Large button (15px icons) -->
|
|
170
|
+
<button class="btn btn-primary btn-lg">
|
|
171
|
+
<svg class="icon icon-size-15" aria-hidden="true">
|
|
172
|
+
<use href="#download" />
|
|
173
|
+
</svg>
|
|
174
|
+
Download
|
|
175
|
+
</button>
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Input Component
|
|
179
|
+
|
|
180
|
+
```html
|
|
181
|
+
<!-- Input with leading icon -->
|
|
182
|
+
<div class="input-wrapper">
|
|
183
|
+
<svg class="icon icon-size-16" aria-hidden="true">
|
|
184
|
+
<use href="#search" />
|
|
185
|
+
</svg>
|
|
186
|
+
<input type="text" class="input" placeholder="Search..." />
|
|
187
|
+
</div>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Chip Component
|
|
191
|
+
|
|
192
|
+
```html
|
|
193
|
+
<!-- Chip with status icon -->
|
|
194
|
+
<span class="chip chip-success">
|
|
195
|
+
<svg class="icon icon-size-12" aria-hidden="true">
|
|
196
|
+
<use href="#check" />
|
|
197
|
+
</svg>
|
|
198
|
+
<span class="chip-text">Approved</span>
|
|
199
|
+
</span>
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Accessibility Patterns
|
|
203
|
+
|
|
204
|
+
### Decorative Icons (Most Common)
|
|
205
|
+
Icons that accompany text labels:
|
|
206
|
+
|
|
207
|
+
```html
|
|
208
|
+
<button>
|
|
209
|
+
<svg class="icon icon-size-20" aria-hidden="true">
|
|
210
|
+
<use href="#save" />
|
|
211
|
+
</svg>
|
|
212
|
+
Save
|
|
213
|
+
</button>
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**Rule**: Add `aria-hidden="true"` when icon is decorative.
|
|
217
|
+
|
|
218
|
+
### Standalone Icons
|
|
219
|
+
Icon-only buttons or links:
|
|
220
|
+
|
|
221
|
+
```html
|
|
222
|
+
<button aria-label="Close dialog">
|
|
223
|
+
<svg class="icon icon-size-20" aria-hidden="true">
|
|
224
|
+
<use href="#x" />
|
|
225
|
+
</svg>
|
|
226
|
+
</button>
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
**Rule**: `aria-label` on the button/link, `aria-hidden="true"` on the icon.
|
|
230
|
+
|
|
231
|
+
### Meaningful Icons
|
|
232
|
+
Icons that convey information:
|
|
233
|
+
|
|
234
|
+
```html
|
|
235
|
+
<div class="status">
|
|
236
|
+
<svg class="icon icon-size-16 text-approved" role="img" aria-label="Verified">
|
|
237
|
+
<use href="#check-circle" />
|
|
238
|
+
</svg>
|
|
239
|
+
<span>Account verified</span>
|
|
240
|
+
</div>
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
**Rule**: Use `role="img"` and `aria-label` on the icon itself.
|
|
244
|
+
|
|
245
|
+
## Color and Theming
|
|
246
|
+
|
|
247
|
+
Icons use `currentColor` by default, inheriting the text color:
|
|
248
|
+
|
|
249
|
+
```css
|
|
250
|
+
/* Icon inherits button text color */
|
|
251
|
+
.btn-primary {
|
|
252
|
+
color: var(--color-content-contrast);
|
|
253
|
+
}
|
|
254
|
+
.btn-primary .icon {
|
|
255
|
+
stroke: currentColor; /* Inherits white color */
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/* Override icon color independently */
|
|
259
|
+
.icon-success {
|
|
260
|
+
color: var(--color-approved);
|
|
261
|
+
}
|
|
262
|
+
.icon-error {
|
|
263
|
+
color: var(--color-critical);
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Icon Naming Conventions
|
|
268
|
+
|
|
269
|
+
### Lucide Icons
|
|
270
|
+
Use the original Lucide icon name:
|
|
271
|
+
|
|
272
|
+
```html
|
|
273
|
+
<use href="#search" /> <!-- ✅ Correct -->
|
|
274
|
+
<use href="#lucide-search" /> <!-- ❌ Wrong -->
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
Browse all names: https://lucide.dev/icons/
|
|
278
|
+
|
|
279
|
+
### Custom Icons
|
|
280
|
+
Prefix with `custom-`:
|
|
281
|
+
|
|
282
|
+
```html
|
|
283
|
+
<use href="#custom-valiify-logo" /> <!-- ✅ Correct -->
|
|
284
|
+
<use href="#valiify-logo" /> <!-- ❌ Wrong -->
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## Common Mistakes to Avoid
|
|
288
|
+
|
|
289
|
+
### ❌ Wrong: Mixing size approaches
|
|
290
|
+
```html
|
|
291
|
+
<!-- Don't set width/height directly on icon class -->
|
|
292
|
+
<svg class="icon" width="20" height="20">
|
|
293
|
+
<use href="#search" />
|
|
294
|
+
</svg>
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### ✅ Right: Use size classes
|
|
298
|
+
```html
|
|
299
|
+
<svg class="icon icon-size-20" aria-hidden="true">
|
|
300
|
+
<use href="#search" />
|
|
301
|
+
</svg>
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### ❌ Wrong: Hardcoded icon sizing
|
|
305
|
+
```html
|
|
306
|
+
<button style="font-size: 20px;">
|
|
307
|
+
<svg width="20" height="20">...</svg>
|
|
308
|
+
</button>
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### ✅ Right: Standard icon component
|
|
312
|
+
```html
|
|
313
|
+
<button class="btn">
|
|
314
|
+
<svg class="icon icon-size-20" aria-hidden="true">
|
|
315
|
+
<use href="#save" />
|
|
316
|
+
</svg>
|
|
317
|
+
</button>
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### ❌ Wrong: Missing accessibility
|
|
321
|
+
```html
|
|
322
|
+
<!-- Icon-only button without label -->
|
|
323
|
+
<button class="btn">
|
|
324
|
+
<svg class="icon icon-size-20">
|
|
325
|
+
<use href="#x" />
|
|
326
|
+
</svg>
|
|
327
|
+
</button>
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### ✅ Right: Proper accessibility
|
|
331
|
+
```html
|
|
332
|
+
<button class="btn" aria-label="Close">
|
|
333
|
+
<svg class="icon icon-size-20" aria-hidden="true">
|
|
334
|
+
<use href="#x" />
|
|
335
|
+
</svg>
|
|
336
|
+
</button>
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
## Adding New Icons
|
|
340
|
+
|
|
341
|
+
### 1. Add to Custom Icons
|
|
342
|
+
```bash
|
|
343
|
+
# Drop your SVG in custom directory
|
|
344
|
+
cp my-icon.svg src/icons/custom/
|
|
345
|
+
|
|
346
|
+
# Rebuild sprite
|
|
347
|
+
npm run build:icons
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
### 2. Use in Components
|
|
351
|
+
```html
|
|
352
|
+
<!-- Custom icons are automatically prefixed with 'custom-' -->
|
|
353
|
+
<svg class="icon icon-size-20" aria-hidden="true">
|
|
354
|
+
<use href="#custom-my-icon" />
|
|
355
|
+
</svg>
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
### 3. Document Usage
|
|
359
|
+
Add to component documentation if it's a commonly-used custom icon.
|
|
360
|
+
|
|
361
|
+
## Quick Reference
|
|
362
|
+
|
|
363
|
+
### Icon Sizes
|
|
364
|
+
```
|
|
365
|
+
10, 11, 12, 13, 14, 15, 16, 18, 20, 22, 24
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
### Most Common Sizes
|
|
369
|
+
```
|
|
370
|
+
16px - Small UI elements
|
|
371
|
+
20px - Default buttons
|
|
372
|
+
24px - Large buttons, headers
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### Standard Pattern
|
|
376
|
+
```html
|
|
377
|
+
<svg class="icon icon-size-{SIZE}" aria-hidden="true">
|
|
378
|
+
<use href="#{ICON-NAME}" />
|
|
379
|
+
</svg>
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### With Status Color
|
|
383
|
+
```html
|
|
384
|
+
<svg class="icon icon-size-16 text-{STATUS}">
|
|
385
|
+
<use href="#icon-name" />
|
|
386
|
+
</svg>
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### With Ring State
|
|
390
|
+
```html
|
|
391
|
+
<svg class="icon icon-size-20 icon-ring">
|
|
392
|
+
<use href="#icon-name" />
|
|
393
|
+
</svg>
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
## Files Reference
|
|
397
|
+
|
|
398
|
+
- **Icon component CSS**: `src/components/icon.css`
|
|
399
|
+
- **Icon sprite**: `src/icons/sprite.svg`
|
|
400
|
+
- **Icon list**: `src/icons/icon-list.txt`
|
|
401
|
+
- **Custom icons**: `src/icons/custom/*.svg`
|
|
402
|
+
- **Icon README**: `src/icons/README.md`
|
|
403
|
+
- **Build script**: `scripts/build-sprite.mjs`
|
|
404
|
+
- **Storybook showcase**: `stories/foundations/Icons.stories.ts`
|
|
405
|
+
- **Component showcase**: `stories/components/Icon.stories.ts`
|
|
406
|
+
|
|
407
|
+
## Summary
|
|
408
|
+
|
|
409
|
+
✅ **DO**:
|
|
410
|
+
- Use `icon icon-size-*` classes for all icons
|
|
411
|
+
- Use sprite system (`<use href="#icon-name" />`)
|
|
412
|
+
- Add `aria-hidden="true"` for decorative icons
|
|
413
|
+
- Use standard sizes (16, 20, 24 most common)
|
|
414
|
+
- Let icons inherit color via `currentColor`
|
|
415
|
+
|
|
416
|
+
❌ **DON'T**:
|
|
417
|
+
- Hardcode icon dimensions
|
|
418
|
+
- Mix sizing approaches
|
|
419
|
+
- Forget accessibility attributes
|
|
420
|
+
- Create one-off icon sizing
|
|
421
|
+
- Import icon files individually
|
|
422
|
+
|
|
423
|
+
---
|
|
424
|
+
|
|
425
|
+
**Questions?** See `src/icons/README.md` for sprite system details or `stories/components/Icon.stories.ts` for visual examples.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* __NAME__ Component
|
|
3
|
+
*
|
|
4
|
+
* TODO: describe what this component is for.
|
|
5
|
+
* Populate the styles below from the Figma design.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* <div class="__CLASS__">...</div>
|
|
9
|
+
*
|
|
10
|
+
* ---------------------------------------------------------------------------
|
|
11
|
+
* HOUSE STYLE — please keep to these conventions so components stay uniform.
|
|
12
|
+
*
|
|
13
|
+
* 1. Everything goes inside `@layer components` so consumer utilities can
|
|
14
|
+
* override component styles without !important.
|
|
15
|
+
*
|
|
16
|
+
* 2. Prefer the token utilities generated from themes/valiify.css over
|
|
17
|
+
* hand-written var():
|
|
18
|
+
*
|
|
19
|
+
* GOOD @apply bg-surface-paper text-content-primary border-stroke-divider;
|
|
20
|
+
* BAD background-color: var(--color-surface-paper);
|
|
21
|
+
*
|
|
22
|
+
* Every --color-* token has bg-*, text-*, and border-* utilities.
|
|
23
|
+
* NOTE: there is no `surface-card` — Figma's surface stack is only
|
|
24
|
+
* Frame / Neutral / Paper. Cards render on Paper.
|
|
25
|
+
*
|
|
26
|
+
* 3. Radii use the role-named tokens, never t-shirt sizes:
|
|
27
|
+
* rounded-micro indicators, bars (Figma Radius/Micro, 2px)
|
|
28
|
+
* rounded-tight tags, badges (Figma Radius/XS, 4px)
|
|
29
|
+
* rounded-control buttons, inputs (Figma Radius/SM, 6px)
|
|
30
|
+
* rounded-surface cards, panels (Figma Radius/MD, 8px)
|
|
31
|
+
* rounded-pill avatars, pills (Figma Radius/Rounded)
|
|
32
|
+
*
|
|
33
|
+
* Do NOT use rounded-xs / rounded-sm / rounded-md — those are Tailwind's
|
|
34
|
+
* own defaults and are not part of the Valiify design system.
|
|
35
|
+
*
|
|
36
|
+
* 4. Type comes from the composite text tokens, which carry size, line-height,
|
|
37
|
+
* weight and tracking in one utility:
|
|
38
|
+
* @apply text-action-m; controls
|
|
39
|
+
* @apply text-body-1; body copy
|
|
40
|
+
* @apply text-h1; headings
|
|
41
|
+
*
|
|
42
|
+
* Tailwind's --text-* cannot carry font-family, so the JetBrains Mono
|
|
43
|
+
* styles MUST be paired with font-mono or they render in Inter:
|
|
44
|
+
* @apply text-data-m font-mono;
|
|
45
|
+
*
|
|
46
|
+
* 5. Border widths need an explicit var(), because --border-* has no Tailwind
|
|
47
|
+
* namespace to generate a utility from:
|
|
48
|
+
* @apply border border-[length:var(--border-thin)]; 0.5px hairline
|
|
49
|
+
* @apply border border-[length:var(--border-line)]; 1px
|
|
50
|
+
*
|
|
51
|
+
* 6. Spacing uses Tailwind's standard scale, which aligns exactly to Figma:
|
|
52
|
+
* Spacing/8 -> p-2, Spacing/12 -> p-3, Spacing/7 -> p-1.75.
|
|
53
|
+
* See the mapping table in CLAUDE.md. Do NOT invent --spacing-* tokens.
|
|
54
|
+
*
|
|
55
|
+
* 7. State conventions — match these selectors across all components:
|
|
56
|
+
* &:hover:not(:disabled) hover (never fires on disabled elements)
|
|
57
|
+
* &:active:not(:disabled) pressed
|
|
58
|
+
* &:focus-visible keyboard focus ring
|
|
59
|
+
* &:disabled disabled
|
|
60
|
+
*
|
|
61
|
+
* 8. Modifier classes are additive and flat: .__CLASS__-primary, not
|
|
62
|
+
* .__CLASS__.variant-primary.
|
|
63
|
+
*
|
|
64
|
+
* Delete this comment block once the component is populated.
|
|
65
|
+
* ---------------------------------------------------------------------------
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
@layer components {
|
|
69
|
+
.__CLASS__ {
|
|
70
|
+
/* Layout */
|
|
71
|
+
@apply inline-flex items-center;
|
|
72
|
+
|
|
73
|
+
/* Shape */
|
|
74
|
+
@apply rounded-control;
|
|
75
|
+
@apply border border-[length:var(--border-thin)];
|
|
76
|
+
|
|
77
|
+
/* Type */
|
|
78
|
+
@apply text-body-1;
|
|
79
|
+
|
|
80
|
+
/* Colors */
|
|
81
|
+
@apply border-stroke-divider bg-surface-paper text-content-primary;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* --- Variants ------------------------------------------------------- */
|
|
85
|
+
|
|
86
|
+
/* .__CLASS__-primary {
|
|
87
|
+
@apply border-transparent bg-primary text-content-contrast;
|
|
88
|
+
} */
|
|
89
|
+
|
|
90
|
+
/* --- Sizes ---------------------------------------------------------- */
|
|
91
|
+
|
|
92
|
+
/* .__CLASS__-sm {
|
|
93
|
+
@apply px-3 py-1.5 text-xs;
|
|
94
|
+
} */
|
|
95
|
+
|
|
96
|
+
/* --- States --------------------------------------------------------- */
|
|
97
|
+
|
|
98
|
+
/* .__CLASS__:hover:not(:disabled) {
|
|
99
|
+
@apply bg-action-hover;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.__CLASS__:focus-visible {
|
|
103
|
+
@apply focus-ring;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.__CLASS__:disabled {
|
|
107
|
+
@apply cursor-not-allowed text-secondary-disabled;
|
|
108
|
+
} */
|
|
109
|
+
}
|