@maxsteinwender/sort-ui 1.1.0 → 1.1.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.
@@ -0,0 +1,354 @@
1
+ # Design Tokens and CSS Guidelines
2
+
3
+ Design tokens, CSS custom properties, and theming in SortUI. Uses **Tailwind v3** (`^3.4.1`) — never v4.
4
+
5
+ ## Token Format
6
+
7
+ Tokens are consumed as **CSS custom properties** (variables) and **Tailwind v3 utility classes**.
8
+
9
+ ```css
10
+ /* CSS custom properties */
11
+ color: var(--text-default);
12
+ background: var(--bg-subtle);
13
+ border-radius: var(--radius-md);
14
+ box-shadow: var(--shadow-card);
15
+
16
+ /* Tailwind v3 classes (via SortUI preset) */
17
+ <div className="bg-sui-bg-default text-sui-text-default rounded-md shadow-card p-sui-24" />
18
+ ```
19
+
20
+ ### `sui-` prefix rules (CRITICAL)
21
+
22
+ The `sui-` prefix is applied **selectively**. Memorize this table.
23
+
24
+ | Category | Prefix? | Correct | Wrong |
25
+ |---|---|---|---|
26
+ | Color — text | yes | `text-sui-text-default`, `text-sui-text-muted` | `text-default` |
27
+ | Color — background | yes | `bg-sui-bg-default`, `bg-sui-bg-subtle` | `bg-default` |
28
+ | Color — border | yes | `border-sui-border-default` | `border-default` |
29
+ | Color — icon | yes | `text-sui-icon-default`, `text-sui-icon-destructive` | `text-icon-default` |
30
+ | Spacing | yes | `gap-sui-16`, `p-sui-24`, `mx-sui-32`, `space-y-sui-16` | `gap-16` |
31
+ | Badge background | yes | `bg-sui-badge-blue`, `bg-sui-badge-red` | `bg-badge-blue` |
32
+ | **Radius** | **no** | `rounded-md`, `rounded-lg`, `rounded-full`, `rounded-card-md` | ~~`rounded-sui-md`~~ |
33
+ | **Shadow** | **no** | `shadow-default`, `shadow-card`, `shadow-focus`, `shadow-modal-md` | ~~`shadow-sui-default`~~ ~~`shadow-md`~~ |
34
+ | **Border width** | **no** | `border` (1px), `border-md` (1.5px), `border-lg` (2px) | ~~`border-sui-md`~~ |
35
+ | **Font size** | **no** | `text-sm`, `text-base`, `text-2xl` | ~~`text-sui-md`~~ |
36
+
37
+ ---
38
+
39
+ ## Theming — 4 Themes
40
+
41
+ SortUI provides **4 theme variants**. All four must render correctly for any generated UI.
42
+
43
+ - `light` — zinc/blue, light mode (default)
44
+ - `dark` — zinc/blue, dark mode
45
+ - `theme-2` — neutral/orange, light mode
46
+ - `theme-2-dark` — neutral/orange, dark mode
47
+
48
+ **Apply theme class to `<html>` or `<body>`:**
49
+ ```tsx
50
+ <html className="dark">
51
+ {/* App renders in dark theme */}
52
+ </html>
53
+ ```
54
+
55
+ ---
56
+
57
+ ## Color Tokens
58
+
59
+ ### Text Tokens
60
+
61
+ | Token | Usage | Tailwind class |
62
+ |-------|-------|----------------|
63
+ | `--text-default` | Primary text | `text-sui-text-default` |
64
+ | `--text-subtle` | Secondary text | `text-sui-text-subtle` |
65
+ | `--text-muted` | Tertiary text | `text-sui-text-muted` |
66
+ | `--text-hint` | Placeholder text | `text-sui-text-hint` |
67
+ | `--text-inverted-default` | Text on dark backgrounds | `text-sui-text-inverted-default` |
68
+ | `--text-inverted-subtle` | Subtle text on dark | `text-sui-text-inverted-subtle` |
69
+ | `--text-destructive` | Error/danger text | `text-sui-text-destructive` |
70
+ | `--text-primary` | Primary brand text | `text-sui-text-primary` |
71
+ | `--text-success` | Success text | `text-sui-text-success` |
72
+ | `--text-warning` | Warning text | `text-sui-text-warning` |
73
+ | `--text-informative` | Info text | `text-sui-text-informative` |
74
+
75
+ ### Background Tokens
76
+
77
+ | Token | Usage | Tailwind class |
78
+ |-------|-------|----------------|
79
+ | `--bg-default` | Page/card background | `bg-sui-bg-default` |
80
+ | `--bg-subtle` | Subtle background | `bg-sui-bg-subtle` |
81
+ | `--bg-muted` | Muted background | `bg-sui-bg-muted` |
82
+ | `--bg-card` | Card background | `bg-sui-bg-card` |
83
+ | `--bg-inverted` | Dark background | `bg-sui-bg-inverted` |
84
+
85
+ **State backgrounds:** `bg-sui-state-primary`, `bg-sui-state-primary-hover`, `bg-sui-state-destructive`, `bg-sui-state-soft`, `bg-sui-state-ghost`, `bg-sui-state-disabled`, etc.
86
+
87
+ **Badge backgrounds (semantic color scale):**
88
+ - `bg-sui-badge-red`, `bg-sui-badge-orange`, `bg-sui-badge-yellow`, `bg-sui-badge-lime`, `bg-sui-badge-green`, `bg-sui-badge-emerald`, `bg-sui-badge-teal`, `bg-sui-badge-cyan`, `bg-sui-badge-sky`, `bg-sui-badge-blue`, `bg-sui-badge-indigo`, `bg-sui-badge-violet`, `bg-sui-badge-purple`, `bg-sui-badge-fuchsia`, `bg-sui-badge-pink`, `bg-sui-badge-gray`, `bg-sui-badge-white`, `bg-sui-badge-inverted`
89
+
90
+ ### Border Color Tokens
91
+
92
+ | Token | Usage | Tailwind class |
93
+ |-------|-------|----------------|
94
+ | `--border-default` | Default borders | `border-sui-border-default` |
95
+ | `--border-darker` | Stronger borders | `border-sui-border-darker` |
96
+ | `--border-strong` | Strong borders | `border-sui-border-strong` |
97
+ | `--border-accent` | Accent borders | `border-sui-border-accent` |
98
+ | `--border-destructive` | Error borders | `border-sui-border-destructive` |
99
+ | `--border-informative` | Info borders | `border-sui-border-informative` |
100
+ | `--border-success` | Success borders | `border-sui-border-success` |
101
+ | `--border-warning` | Warning borders | `border-sui-border-warning` |
102
+
103
+ ### Icon Color Tokens
104
+
105
+ | Token | Usage | Tailwind class |
106
+ |-------|-------|----------------|
107
+ | `--icon-default` | Primary icons | `text-sui-icon-default` |
108
+ | `--icon-default-subtle` | Subtle icons | `text-sui-icon-subtle` |
109
+ | `--icon-default-muted` | Muted icons | `text-sui-icon-muted` |
110
+ | `--icon-default-disabled` | Disabled icons | `text-sui-icon-disabled` |
111
+ | `--icon-inverted-default` | Icons on dark backgrounds | `text-sui-icon-inverted-default` |
112
+ | `--icon-destructive` | Error icons | `text-sui-icon-destructive` |
113
+ | `--icon-informative` | Info icons | `text-sui-icon-informative` |
114
+ | `--icon-success` | Success icons | `text-sui-icon-success` |
115
+ | `--icon-warning` | Warning icons | `text-sui-icon-warning` |
116
+
117
+ ---
118
+
119
+ ## Typography Tokens
120
+
121
+ ### Font Family
122
+
123
+ | Token | Tailwind | Default |
124
+ |-------|----------|---------|
125
+ | `--font-body` | `font-sans` | Geist Sans (bundled) |
126
+ | `--font-headline` | `font-headline` | Geist Sans |
127
+ | `--font-quote` | `font-quote` | Redaction (bundled) |
128
+ | `--font-quote-alt` | `font-quote-alt` | Redaction 35 |
129
+ | `--font-code` | `font-code` | Geist Mono (bundled) |
130
+
131
+ ### Font Size (Tailwind v3 classes)
132
+
133
+ Use `text-xs` through `text-9xl` — these are native Tailwind classes wired to SortUI tokens. **Do NOT use `text-sui-*` font-size classes.**
134
+
135
+ | Class | Size | Usage |
136
+ |-------|------|-------|
137
+ | `text-xs` | 12px | Small labels, captions |
138
+ | `text-sm` | 14px | Body text (small) |
139
+ | `text-base` | 16px | Body text (default) — also `text-md` |
140
+ | `text-lg` | 18px | Large body text |
141
+ | `text-xl` | 20px | Small headings |
142
+ | `text-2xl` | 24px | Headings (H3) |
143
+ | `text-3xl` | 30px | Headings (H2) |
144
+ | `text-4xl` | 36px | Headings (H1) |
145
+ | `text-5xl` – `text-9xl` | 48–128px | Display / hero text |
146
+
147
+ ### Font Weight
148
+
149
+ `font-light` (300), `font-normal` (400), `font-medium` (500), `font-semibold` (600), `font-bold` (700), `font-extrabold` (800), `font-black` (900).
150
+
151
+ ---
152
+
153
+ ## Shadow Tokens (NO `sui-` prefix)
154
+
155
+ Use ONLY these Figma-aligned shadow classes. **Never** use `shadow-sm`, `shadow-md`, `shadow-lg`, arbitrary `shadow-[…]`, or `shadow-sui-*`.
156
+
157
+ | Tailwind class | CSS var | Usage |
158
+ |----------------|---------|-------|
159
+ | `shadow-default` | `--shadow-default` | Default element shadow |
160
+ | `shadow-card` | `--shadow-card` | Card shadow |
161
+ | `shadow-card-base` | `--shadow-card-base` | Base card shadow |
162
+ | `shadow-focus` | `--shadow-focus` | Focus ring |
163
+ | `shadow-destructive-focus` | `--shadow-destructive-focus` | Destructive focus ring |
164
+ | `shadow-misc-focus` | `--shadow-misc-focus` | Misc focus |
165
+ | `shadow-input-focus` | `--shadow-input-focus` | Input focus |
166
+ | `shadow-modal-sm` | `--shadow-modal-sm` | Small modal |
167
+ | `shadow-modal-md` | `--shadow-modal-md` | Medium modal |
168
+ | `shadow-modal-lg` | `--shadow-modal-lg` | Large modal |
169
+ | `shadow-switch-handle` | `--shadow-switch-handle` | Switch handle |
170
+ | `shadow-checkbox` / `shadow-checkbox-active` | | Checkbox |
171
+ | `shadow-inset-bottom` / `-soft` / `-strong` | | Inset bottom |
172
+ | `shadow-tab-active` | `--shadow-tab-active` | Active tab |
173
+ | `shadow-button-default` / `-press` / `-secondary` / `-secondary-press` | | Button shadows |
174
+
175
+ ```tsx
176
+ <div className="shadow-card" />
177
+ <div className="shadow-default" />
178
+ <button className="shadow-button-default active:shadow-button-press" />
179
+ ```
180
+
181
+ ---
182
+
183
+ ## Border & Radius Tokens
184
+
185
+ ### Border Width (NO `sui-` prefix)
186
+
187
+ | Class | Width |
188
+ |-------|-------|
189
+ | `border-sm` | 0.5px |
190
+ | `border` | 1px (default) |
191
+ | `border-md` | 1.5px |
192
+ | `border-lg` | 2px |
193
+ | `border-xl` | 3px |
194
+ | `border-2xl` | 4px |
195
+
196
+ ### Border Radius (NO `sui-` prefix)
197
+
198
+ | Class | Radius |
199
+ |-------|--------|
200
+ | `rounded-none` | 0px |
201
+ | `rounded-2xs` | 2px |
202
+ | `rounded-xs` | 4px |
203
+ | `rounded-sm` | 6px |
204
+ | `rounded-md` | 8px |
205
+ | `rounded-lg` | 12px |
206
+ | `rounded-xl` | 16px |
207
+ | `rounded-2xl` | 24px |
208
+ | `rounded-3xl` | 28px |
209
+ | `rounded-full` | 9999px (pill) |
210
+ | `rounded-card-none` / `-xs` / `-sm` / `-md` / `-lg` | Card-specific |
211
+
212
+ ```tsx
213
+ <div className="rounded-md" /> {/* 8px */}
214
+ <div className="rounded-lg" /> {/* 12px */}
215
+ <div className="rounded-full" /> {/* pill */}
216
+ <div className="rounded-card-md" /> {/* card-aligned */}
217
+ ```
218
+
219
+ ---
220
+
221
+ ## Spacing Tokens (WITH `sui-` prefix)
222
+
223
+ Use spacing tokens from `--spacing-1` to `--spacing-384`, exposed as `p-sui-16`, `gap-sui-12`, etc.
224
+
225
+ | Class | Size | Common usage |
226
+ |-------|------|--------------|
227
+ | `gap-sui-none` | 0 | No spacing |
228
+ | `gap-sui-4` | 4px | Tight groups |
229
+ | `gap-sui-8` | 8px | Small |
230
+ | `gap-sui-12` | 12px | Inline items |
231
+ | `gap-sui-16` | 16px | Form fields |
232
+ | `gap-sui-20` | 20px | Medium+ |
233
+ | `gap-sui-24` | 24px | Card internal |
234
+ | `gap-sui-32` | 32px | Section break |
235
+ | `gap-sui-48` | 48px | Major section |
236
+ | `gap-sui-64` | 64px | Page section |
237
+
238
+ Works across all spacing utilities: `p-`, `m-`, `gap-`, `space-x-`, `space-y-`, etc.
239
+
240
+ ```tsx
241
+ <div className="gap-sui-16 p-sui-24" />
242
+ <div className="space-y-sui-16" />
243
+ <div className="mx-sui-32 my-sui-24" />
244
+ ```
245
+
246
+ ---
247
+
248
+ ## DO / DON'T
249
+
250
+ **DO:**
251
+ ```tsx
252
+ // Semantic color tokens
253
+ <div className="bg-sui-bg-subtle text-sui-text-default border border-sui-border-default" />
254
+
255
+ // Correct radius (NO sui- prefix)
256
+ <div className="rounded-md" />
257
+ <div className="rounded-lg" />
258
+
259
+ // Correct shadow (NO sui- prefix)
260
+ <div className="shadow-card" />
261
+ <div className="shadow-default" />
262
+
263
+ // Correct spacing (WITH sui- prefix)
264
+ <div className="p-sui-24 gap-sui-16" />
265
+
266
+ // CSS variable for dynamic values
267
+ <div style={{ color: "var(--text-subtle)" }} />
268
+ ```
269
+
270
+ **DON'T:**
271
+ ```tsx
272
+ // ❌ sui- prefix on radius/shadow
273
+ <div className="rounded-sui-md shadow-sui-default" />
274
+
275
+ // ❌ Generic Tailwind shadow primitives
276
+ <div className="shadow-md shadow-lg" />
277
+
278
+ // ❌ Hardcoded hex/arbitrary values
279
+ <div className="bg-[#fafafa] text-[#111115] gap-[16px]" />
280
+
281
+ // ❌ Missing sui- on colors/spacing
282
+ <div className="bg-bg-default text-text-default gap-16" />
283
+ ```
284
+
285
+ ---
286
+
287
+ ## Token Usage Examples
288
+
289
+ **Card:**
290
+ ```tsx
291
+ <div className="bg-sui-bg-card border border-sui-border-default rounded-card-md shadow-card p-sui-24">
292
+ <h3 className="text-sui-text-default font-semibold">Card title</h3>
293
+ <p className="text-sui-text-subtle">Card body</p>
294
+ </div>
295
+ ```
296
+
297
+ **Button (primary):**
298
+ ```css
299
+ .custom-button {
300
+ background: var(--bg-state-primary);
301
+ color: var(--text-inverted-default);
302
+ border-radius: var(--radius-md);
303
+ padding: var(--spacing-12) var(--spacing-24);
304
+ box-shadow: var(--shadow-button-default);
305
+ }
306
+ .custom-button:hover { background: var(--bg-state-primary-hover); }
307
+ .custom-button:active { box-shadow: var(--shadow-button-press); }
308
+ ```
309
+
310
+ **Input:**
311
+ ```css
312
+ .custom-input {
313
+ background: var(--bg-default);
314
+ border: 1px solid var(--border-default);
315
+ border-radius: var(--radius-sm);
316
+ color: var(--text-default);
317
+ padding: var(--spacing-8) var(--spacing-12);
318
+ }
319
+ .custom-input:focus {
320
+ border-color: var(--border-informative);
321
+ box-shadow: var(--shadow-input-focus);
322
+ }
323
+ ```
324
+
325
+ ---
326
+
327
+ ## Chart Color Tokens
328
+
329
+ For data visualization (Recharts integration):
330
+
331
+ | Token | Default |
332
+ |-------|---------|
333
+ | `--chart-1` | blue |
334
+ | `--chart-2` | green |
335
+ | `--chart-3` | orange |
336
+ | `--chart-4` | red |
337
+ | `--chart-5` | purple |
338
+
339
+ **Usage in charts (note `isAnimationActive={false}` — required for React 19):**
340
+ ```tsx
341
+ <Line dataKey="revenue" stroke="var(--chart-1)" isAnimationActive={false} />
342
+ <Bar dataKey="sales" fill="var(--chart-2)" isAnimationActive={false} />
343
+ ```
344
+
345
+ ---
346
+
347
+ ## Summary
348
+
349
+ - **Use semantic tokens** over raw values
350
+ - **Tokens are CSS custom properties** (`var(--token-name)`)
351
+ - **Tailwind v3** utility classes — never emit Tailwind v4 syntax
352
+ - **Selective `sui-` prefix** — colors + spacing yes; radius + shadow + border-width + font-size no
353
+ - **Theming** via class on root element (`light`, `dark`, `theme-2`, `theme-2-dark`)
354
+ - **All tokens** automatically adapt to theme changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maxsteinwender/sort-ui",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "A coded design system based on Sort UI Kit — Figma components as production-ready Next.js/Tailwind components",
5
5
  "author": "Max Steinwender",
6
6
  "license": "UNLICENSED",
@@ -26,7 +26,8 @@
26
26
  }
27
27
  },
28
28
  "files": [
29
- "dist"
29
+ "dist",
30
+ "guidelines"
30
31
  ],
31
32
  "sideEffects": [
32
33
  "*.css"