@maxsteinwender/sort-ui 1.0.8 → 1.1.0
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/dist/index.d.mts +63 -1
- package/dist/index.d.ts +63 -1
- package/dist/index.js +662 -542
- package/dist/index.mjs +661 -541
- package/dist/styles.css +294 -212
- package/dist/tailwind-preset.js +13 -0
- package/dist/tailwind-preset.mjs +13 -0
- package/package.json +5 -3
- package/guidelines/Guidelines.md +0 -294
- package/guidelines/components.md +0 -406
- package/guidelines/icon-discovery.md +0 -247
- package/guidelines/setup.md +0 -343
- package/guidelines/styles.md +0 -356
- package/guidelines/tokens.md +0 -354
package/dist/tailwind-preset.js
CHANGED
|
@@ -482,6 +482,19 @@ var config = {
|
|
|
482
482
|
"accordion-up": "accordion-up 0.2s ease-out",
|
|
483
483
|
"stepper-pulse": "stepper-pulse 0.3s ease-out"
|
|
484
484
|
},
|
|
485
|
+
transitionDuration: {
|
|
486
|
+
/* Web Interface Guidelines #22 — animation ≤ 200ms for interaction feedback.
|
|
487
|
+
Use duration-fast/base/slow inside SortUI components. Tailwind's
|
|
488
|
+
built-in duration-{300,500,...} classes remain available for app-level
|
|
489
|
+
non-interaction animations. */
|
|
490
|
+
"fast": "var(--duration-fast)",
|
|
491
|
+
"base": "var(--duration-base)",
|
|
492
|
+
"slow": "var(--duration-slow)"
|
|
493
|
+
},
|
|
494
|
+
scale: {
|
|
495
|
+
/* Web Interface Guidelines #24 — button press scale ~0.96, not 0.8 */
|
|
496
|
+
"press": "var(--press-scale)"
|
|
497
|
+
},
|
|
485
498
|
boxShadow: {
|
|
486
499
|
/* Button shadows */
|
|
487
500
|
"button-default": "0px 1px 2px rgba(0,0,0,0.08), inset 0px -2px 0px rgba(0,0,0,0.20)",
|
package/dist/tailwind-preset.mjs
CHANGED
|
@@ -480,6 +480,19 @@ var config = {
|
|
|
480
480
|
"accordion-up": "accordion-up 0.2s ease-out",
|
|
481
481
|
"stepper-pulse": "stepper-pulse 0.3s ease-out"
|
|
482
482
|
},
|
|
483
|
+
transitionDuration: {
|
|
484
|
+
/* Web Interface Guidelines #22 — animation ≤ 200ms for interaction feedback.
|
|
485
|
+
Use duration-fast/base/slow inside SortUI components. Tailwind's
|
|
486
|
+
built-in duration-{300,500,...} classes remain available for app-level
|
|
487
|
+
non-interaction animations. */
|
|
488
|
+
"fast": "var(--duration-fast)",
|
|
489
|
+
"base": "var(--duration-base)",
|
|
490
|
+
"slow": "var(--duration-slow)"
|
|
491
|
+
},
|
|
492
|
+
scale: {
|
|
493
|
+
/* Web Interface Guidelines #24 — button press scale ~0.96, not 0.8 */
|
|
494
|
+
"press": "var(--press-scale)"
|
|
495
|
+
},
|
|
483
496
|
boxShadow: {
|
|
484
497
|
/* Button shadows */
|
|
485
498
|
"button-default": "0px 1px 2px rgba(0,0,0,0.08), inset 0px -2px 0px rgba(0,0,0,0.20)",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maxsteinwender/sort-ui",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
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,8 +26,7 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
|
-
"dist"
|
|
30
|
-
"guidelines"
|
|
29
|
+
"dist"
|
|
31
30
|
],
|
|
32
31
|
"sideEffects": [
|
|
33
32
|
"*.css"
|
|
@@ -49,6 +48,9 @@
|
|
|
49
48
|
"build:lib:fix-font-urls": "sed -i '' \"s|url('/fonts/|url('./fonts/|g\" dist/styles.css",
|
|
50
49
|
"start": "next start",
|
|
51
50
|
"lint": "eslint src",
|
|
51
|
+
"typecheck": "tsc --noEmit",
|
|
52
|
+
"test": "vitest",
|
|
53
|
+
"test:ui": "vitest --ui",
|
|
52
54
|
"storybook": "storybook dev -p 6006",
|
|
53
55
|
"build-storybook": "storybook build && echo 'User-agent: *\\nDisallow: /' > storybook-static/robots.txt",
|
|
54
56
|
"format": "prettier --write \"src/**/*.{ts,tsx,mdx,json}\"",
|
package/guidelines/Guidelines.md
DELETED
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
# SortUI Design System Guidelines
|
|
2
|
-
|
|
3
|
-
This is the main hub for all SortUI Design System (`@maxsteinwender/sort-ui`) guidelines. These files are authoritative — prefer them over any heuristics inferred from bundled source code.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Reading order
|
|
8
|
-
|
|
9
|
-
Always read first:
|
|
10
|
-
- `Guidelines.md` — this file; the main hub and entry point
|
|
11
|
-
- `setup.md` — required project configuration, providers, and CSS imports
|
|
12
|
-
- `tokens.md` — foundational design tokens (color, typography, spacing, shadow, radius)
|
|
13
|
-
|
|
14
|
-
Read on-demand:
|
|
15
|
-
- `components.md` — read BEFORE using any design-system component
|
|
16
|
-
- `icon-discovery.md` — read BEFORE using any icons
|
|
17
|
-
- `styles.md` — read when building page layouts or applying custom spacing
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## Critical rules (read before generating any code)
|
|
22
|
-
|
|
23
|
-
1. **Tailwind version is v3** (`^3.4.1`). It is **NOT** Tailwind v4. Never emit `@theme` directives or v4-only syntax.
|
|
24
|
-
2. **Package manager is npm.** Never suggest `pnpm` or `yarn` install commands — use `npm install`.
|
|
25
|
-
3. **Selective `sui-` prefix.** Colors and spacing carry `sui-`; shadows and radius do NOT.
|
|
26
|
-
- ✅ `text-sui-text-default`, `bg-sui-bg-subtle`, `gap-sui-16`, `p-sui-24`
|
|
27
|
-
- ✅ `shadow-default`, `shadow-card`, `shadow-focus`, `shadow-modal-md`
|
|
28
|
-
- ✅ `rounded-md`, `rounded-lg`, `rounded-full`, `rounded-card-md`
|
|
29
|
-
- ❌ `shadow-sui-default`, `shadow-sui-card`, `shadow-sm`, `shadow-md`
|
|
30
|
-
- ❌ `rounded-sui-md`, `rounded-sui-lg`
|
|
31
|
-
4. **Reuse existing SortUI components.** Never inline custom markup when a component exists — use `Badge`, `Avatar`, `ProgressBar`, `Button`, `InputField`, `Card`, etc.
|
|
32
|
-
5. **Charts: `isAnimationActive={false}` on every Recharts series.** Recharts 2.x animations rely on removed React 19 APIs and render empty without this prop.
|
|
33
|
-
6. **Icons: Remix Icons only.** Syntax `<i className="ri-{name}-{variant}" />`. Never install `lucide-react`, `heroicons`, or any other icon package.
|
|
34
|
-
7. **All 4 themes.** Every generated UI must render correctly in `light`, `dark`, `theme-2`, and `theme-2-dark`.
|
|
35
|
-
|
|
36
|
-
---
|
|
37
|
-
|
|
38
|
-
## Companion guideline files
|
|
39
|
-
|
|
40
|
-
| File | Focus |
|
|
41
|
-
|---|---|
|
|
42
|
-
| `setup.md` | Installation, Tailwind v3 config, CSS imports, provider setup, all 4 theme classes |
|
|
43
|
-
| `tokens.md` | Design tokens — colors, typography, shadow, border, radius, spacing (correct class names) |
|
|
44
|
-
| `styles.md` | Spacing, layout primitives, responsive patterns (Tailwind v3 breakpoints) |
|
|
45
|
-
| `components.md` | Component imports, props, variants, and composition patterns |
|
|
46
|
-
| `icon-discovery.md` | Remix Icon naming, discovery, and verification |
|
|
47
|
-
|
|
48
|
-
---
|
|
49
|
-
|
|
50
|
-
## Before using an icon
|
|
51
|
-
|
|
52
|
-
1. Check `icon-discovery.md` for verification workflow
|
|
53
|
-
2. Do NOT guess icon names — verify the icon exists first
|
|
54
|
-
3. If an icon doesn't exist, pick a different one and verify
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## General Guidelines
|
|
59
|
-
|
|
60
|
-
### Code Quality
|
|
61
|
-
- Use responsive layouts with Flexbox and Grid by default
|
|
62
|
-
- Avoid absolute positioning unless necessary
|
|
63
|
-
- Keep components focused and single-purpose
|
|
64
|
-
- Extract reusable logic into helper functions
|
|
65
|
-
|
|
66
|
-
### Component Usage
|
|
67
|
-
- Always import components from the correct entry points:
|
|
68
|
-
- Main: `@maxsteinwender/sort-ui`
|
|
69
|
-
- Form (React Hook Form wrappers): `@maxsteinwender/sort-ui/form`
|
|
70
|
-
- Prefer composition over complex prop APIs
|
|
71
|
-
- **Reuse existing SortUI components instead of custom markup.**
|
|
72
|
-
|
|
73
|
-
### Accessibility
|
|
74
|
-
- Provide `aria-label` for icon-only buttons
|
|
75
|
-
- Use semantic HTML elements
|
|
76
|
-
- Ensure proper heading hierarchy
|
|
77
|
-
- Add descriptive labels for form inputs
|
|
78
|
-
|
|
79
|
-
---
|
|
80
|
-
|
|
81
|
-
## Design System Guidelines
|
|
82
|
-
|
|
83
|
-
### Colors & Theming
|
|
84
|
-
- Use semantic tokens (`text-sui-text-default`, `bg-sui-bg-subtle`) over raw hex values
|
|
85
|
-
- Tokens automatically adapt to theme changes
|
|
86
|
-
- Apply ONE theme class to `<html>` or `<body>`: `light`, `dark`, `theme-2`, `theme-2-dark`
|
|
87
|
-
|
|
88
|
-
### Typography
|
|
89
|
-
- Default font: Geist Sans (bundled)
|
|
90
|
-
- Code font: Geist Mono (bundled)
|
|
91
|
-
- Display/quote font: Redaction (bundled)
|
|
92
|
-
- Use Tailwind size utilities: `text-xs` through `text-9xl`
|
|
93
|
-
|
|
94
|
-
### Spacing
|
|
95
|
-
- Use SortUI spacing tokens: `gap-sui-16`, `p-sui-24`, `mx-sui-32`, `space-y-sui-16`
|
|
96
|
-
- Common patterns:
|
|
97
|
-
- Form field gap: `gap-sui-16`
|
|
98
|
-
- Card padding: `p-sui-24`
|
|
99
|
-
- Section gap: `gap-sui-32` to `gap-sui-48`
|
|
100
|
-
|
|
101
|
-
### Shadow & Radius (NO `sui-` prefix)
|
|
102
|
-
- Shadows: `shadow-default`, `shadow-card`, `shadow-focus`, `shadow-modal-md`
|
|
103
|
-
- Radius: `rounded-md`, `rounded-lg`, `rounded-full`, `rounded-card-md`
|
|
104
|
-
- Never use `shadow-sm`, `shadow-md`, `shadow-lg`, or arbitrary `shadow-[…]` values
|
|
105
|
-
|
|
106
|
-
### Responsive Design (Tailwind v3 breakpoints)
|
|
107
|
-
- Mobile-first approach
|
|
108
|
-
- Breakpoints: `sm` (640px), `md` (768px), `lg` (1024px), `xl` (1280px), `2xl` (1536px)
|
|
109
|
-
- Example: `p-sui-16 md:p-sui-24 lg:p-sui-32`
|
|
110
|
-
|
|
111
|
-
---
|
|
112
|
-
|
|
113
|
-
## Component Best Practices
|
|
114
|
-
|
|
115
|
-
### Buttons
|
|
116
|
-
- `variant`: `default`, `ghost`, `destructive`, `secondary`, `outline`, `ghost-muted`
|
|
117
|
-
- `size`: `2xs`, `xs`, `sm`, `md`, `lg`
|
|
118
|
-
- Icon-only buttons **MUST** have `aria-label`
|
|
119
|
-
- Use `loading` prop for async actions (don't add manual spinners)
|
|
120
|
-
|
|
121
|
-
### Forms
|
|
122
|
-
- Use `InputField` with `error` prop for validation feedback
|
|
123
|
-
- Group related fields with `gap-sui-16`
|
|
124
|
-
- Use `required` prop to show asterisk on labels
|
|
125
|
-
- Integrate with React Hook Form via `@maxsteinwender/sort-ui/form`
|
|
126
|
-
|
|
127
|
-
### Cards
|
|
128
|
-
- Use semantic slots: `CardHeader`, `CardTitle`, `CardDescription`, `CardContent`, `CardFooter`
|
|
129
|
-
- Use `CardCover` with `flush` prop for edge-to-edge images
|
|
130
|
-
- `variant="default"` has border + shadow; `variant="flat"` removes them
|
|
131
|
-
|
|
132
|
-
### Icons
|
|
133
|
-
- Always verify icon exists before using (see `icon-discovery.md`)
|
|
134
|
-
- Use `-line` for outlined, `-fill` for solid
|
|
135
|
-
- Syntax: `<i className="ri-{name}-line" />`
|
|
136
|
-
- Do NOT install additional icon packages
|
|
137
|
-
|
|
138
|
-
### Charts (Recharts)
|
|
139
|
-
- Always set `isAnimationActive={false}` on every series (`Line`, `Bar`, `Area`, `Pie`, etc.)
|
|
140
|
-
- Wrap in `ChartContainer` from `@maxsteinwender/sort-ui` with a `ChartConfig`
|
|
141
|
-
- Use chart color tokens: `var(--chart-1)` through `var(--chart-5)`
|
|
142
|
-
|
|
143
|
-
---
|
|
144
|
-
|
|
145
|
-
## Common Patterns
|
|
146
|
-
|
|
147
|
-
### Form with validation
|
|
148
|
-
```tsx
|
|
149
|
-
import { useForm } from "react-hook-form";
|
|
150
|
-
import { Form, FormField, FormItem, FormLabel, FormControl, FormMessage } from "@maxsteinwender/sort-ui/form";
|
|
151
|
-
import { InputField, Button } from "@maxsteinwender/sort-ui";
|
|
152
|
-
|
|
153
|
-
const form = useForm({ defaultValues: { email: "" } });
|
|
154
|
-
|
|
155
|
-
<Form {...form}>
|
|
156
|
-
<form onSubmit={form.handleSubmit(onSubmit)} className="flex flex-col gap-sui-16">
|
|
157
|
-
<FormField
|
|
158
|
-
control={form.control}
|
|
159
|
-
name="email"
|
|
160
|
-
render={({ field }) => (
|
|
161
|
-
<FormItem>
|
|
162
|
-
<FormLabel>Email</FormLabel>
|
|
163
|
-
<FormControl>
|
|
164
|
-
<InputField {...field} placeholder="you@example.com" />
|
|
165
|
-
</FormControl>
|
|
166
|
-
<FormMessage />
|
|
167
|
-
</FormItem>
|
|
168
|
-
)}
|
|
169
|
-
/>
|
|
170
|
-
<Button type="submit">Submit</Button>
|
|
171
|
-
</form>
|
|
172
|
-
</Form>
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
### Modal dialog
|
|
176
|
-
```tsx
|
|
177
|
-
<Dialog>
|
|
178
|
-
<DialogTrigger asChild>
|
|
179
|
-
<Button>Open</Button>
|
|
180
|
-
</DialogTrigger>
|
|
181
|
-
<DialogContent>
|
|
182
|
-
<DialogHeader>
|
|
183
|
-
<DialogTitle>Confirm</DialogTitle>
|
|
184
|
-
<DialogDescription>This action cannot be undone.</DialogDescription>
|
|
185
|
-
</DialogHeader>
|
|
186
|
-
<DialogFooter>
|
|
187
|
-
<DialogClose asChild><Button variant="ghost">Cancel</Button></DialogClose>
|
|
188
|
-
<Button>Confirm</Button>
|
|
189
|
-
</DialogFooter>
|
|
190
|
-
</DialogContent>
|
|
191
|
-
</Dialog>
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
### Data display with reused SortUI components
|
|
195
|
-
```tsx
|
|
196
|
-
// ✅ DO — reuse Avatar + Badge
|
|
197
|
-
<div className="flex items-center gap-sui-12">
|
|
198
|
-
<Avatar
|
|
199
|
-
src="/user.jpg"
|
|
200
|
-
fallback="JD"
|
|
201
|
-
size="md"
|
|
202
|
-
bottomBadge
|
|
203
|
-
bottomBadgeVariant="online"
|
|
204
|
-
bottomBadgeLabel="Online"
|
|
205
|
-
/>
|
|
206
|
-
<div>
|
|
207
|
-
<p className="font-semibold text-sui-text-default">John Doe</p>
|
|
208
|
-
<Badge color="green" size="sm">Active</Badge>
|
|
209
|
-
</div>
|
|
210
|
-
</div>
|
|
211
|
-
|
|
212
|
-
// ❌ DON'T — inline markup instead of reusing components
|
|
213
|
-
<div className="flex items-center gap-sui-12">
|
|
214
|
-
<img src="/user.jpg" className="w-10 h-10 rounded-full" />
|
|
215
|
-
<div>
|
|
216
|
-
<p className="font-semibold">John Doe</p>
|
|
217
|
-
<span className="inline-flex bg-green-100 text-green-800 px-2 py-1 rounded-full text-xs">Active</span>
|
|
218
|
-
</div>
|
|
219
|
-
</div>
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
### Chart with required `isAnimationActive={false}`
|
|
223
|
-
```tsx
|
|
224
|
-
import { ChartContainer, ChartTooltip, ChartTooltipContent, type ChartConfig } from "@maxsteinwender/sort-ui";
|
|
225
|
-
import { LineChart, Line, Bar } from "recharts";
|
|
226
|
-
|
|
227
|
-
const config: ChartConfig = {
|
|
228
|
-
revenue: { label: "Revenue", color: "var(--chart-1)" },
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
<ChartContainer config={config}>
|
|
232
|
-
<LineChart data={data}>
|
|
233
|
-
<ChartTooltip content={<ChartTooltipContent />} />
|
|
234
|
-
<Line dataKey="revenue" stroke="var(--color-revenue)" isAnimationActive={false} />
|
|
235
|
-
<Bar dataKey="sales" fill="var(--chart-2)" isAnimationActive={false} />
|
|
236
|
-
</LineChart>
|
|
237
|
-
</ChartContainer>
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
---
|
|
241
|
-
|
|
242
|
-
## DO / DON'T
|
|
243
|
-
|
|
244
|
-
**DO:**
|
|
245
|
-
- ✓ Use `npm install` (not `pnpm add`)
|
|
246
|
-
- ✓ Treat Tailwind as v3 (not v4)
|
|
247
|
-
- ✓ Use `shadow-default`, `shadow-card`, `shadow-focus`, `shadow-modal-md`
|
|
248
|
-
- ✓ Use `rounded-md`, `rounded-lg`, `rounded-full`, `rounded-card-md`
|
|
249
|
-
- ✓ Use `sui-` prefix for colors and spacing (`bg-sui-bg-default`, `gap-sui-16`)
|
|
250
|
-
- ✓ Reuse existing SortUI components (`Badge`, `Avatar`, `ProgressBar`, `Button`)
|
|
251
|
-
- ✓ Provide `aria-label` for icon-only buttons
|
|
252
|
-
- ✓ Set `isAnimationActive={false}` on all Recharts series
|
|
253
|
-
- ✓ Test all 4 themes (`light`, `dark`, `theme-2`, `theme-2-dark`)
|
|
254
|
-
|
|
255
|
-
**DON'T:**
|
|
256
|
-
- ✗ Use `pnpm add` or `yarn add`
|
|
257
|
-
- ✗ Assume Tailwind v4 or emit `@theme` directives
|
|
258
|
-
- ✗ Use `shadow-sui-*`, `shadow-sm`, `shadow-md`, `shadow-lg`
|
|
259
|
-
- ✗ Use `rounded-sui-*`
|
|
260
|
-
- ✗ Hard-code colors (`bg-[#fafafa]`) or spacing (`gap-[16px]`)
|
|
261
|
-
- ✗ Inline custom markup when a SortUI component exists
|
|
262
|
-
- ✗ Omit `isAnimationActive={false}` on Recharts series
|
|
263
|
-
- ✗ Guess icon names without verification
|
|
264
|
-
- ✗ Install `lucide-react` or other icon packages
|
|
265
|
-
|
|
266
|
-
---
|
|
267
|
-
|
|
268
|
-
## Quick Reference
|
|
269
|
-
|
|
270
|
-
| Need | Read |
|
|
271
|
-
|------|------|
|
|
272
|
-
| Setup / install / providers | `setup.md` |
|
|
273
|
-
| Color, typography, shadow, radius tokens | `tokens.md` |
|
|
274
|
-
| Spacing and layout | `styles.md` |
|
|
275
|
-
| Component API | `components.md` |
|
|
276
|
-
| Icon usage and discovery | `icon-discovery.md` |
|
|
277
|
-
|
|
278
|
-
---
|
|
279
|
-
|
|
280
|
-
## Common Mistakes to Avoid
|
|
281
|
-
|
|
282
|
-
| ❌ Wrong | ✅ Correct |
|
|
283
|
-
|---|---|
|
|
284
|
-
| `pnpm add @maxsteinwender/sort-ui` | `npm install @maxsteinwender/sort-ui` |
|
|
285
|
-
| "Tailwind v4" / `@theme` directive | Tailwind v3 / `tailwind.config.ts` preset |
|
|
286
|
-
| `shadow-sui-default`, `shadow-sui-card` | `shadow-default`, `shadow-card` |
|
|
287
|
-
| `shadow-md`, `shadow-lg` | `shadow-default` or `shadow-card` |
|
|
288
|
-
| `rounded-sui-md`, `rounded-sui-lg` | `rounded-md`, `rounded-lg` |
|
|
289
|
-
| `bg-[#fafafa]` | `bg-sui-bg-subtle` |
|
|
290
|
-
| `gap-[16px]` | `gap-sui-16` |
|
|
291
|
-
| `<i className="lucide-user" />` | `<i className="ri-user-line" />` |
|
|
292
|
-
| `<Line stroke="..." />` (Recharts) | `<Line stroke="..." isAnimationActive={false} />` |
|
|
293
|
-
| Inline `<span class="bg-green-100">Active</span>` | `<Badge color="green">Active</Badge>` |
|
|
294
|
-
| `<img src="/u.jpg" class="rounded-full" />` | `<Avatar src="/u.jpg" fallback="MS" size="md" />` |
|