@maxsteinwender/sort-ui 1.0.7 → 1.0.8

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,247 @@
1
+ # Icon Discovery and Usage Guidelines
2
+
3
+ This document explains how to find and use icons in the SortUI Design System.
4
+
5
+ ## Icon Package
6
+
7
+ **Bundled with:** `@maxsteinwender/sort-ui` (Remix Icons — no separate install)
8
+ **Import:** Icons are loaded automatically via the main CSS bundle
9
+ **Location in package:** `node_modules/@maxsteinwender/sort-ui/dist/styles.css` (font-icon classes)
10
+
11
+ **DO NOT install `lucide-react`, `heroicons`, `react-icons`, or any other icon package.** Remix Icons is the single source.
12
+
13
+ ## Naming Convention
14
+
15
+ ```
16
+ ri-{icon-name}-{variant}
17
+ ```
18
+
19
+ **Variants:**
20
+ - `-line` — outlined/stroke style (most common)
21
+ - `-fill` — filled/solid style
22
+
23
+ **Examples:**
24
+ - `ri-user-line`, `ri-user-fill`
25
+ - `ri-settings-line`, `ri-settings-fill`
26
+ - `ri-arrow-right-line`, `ri-arrow-right-fill`
27
+ - `ri-check-line`, `ri-check-fill`
28
+ - `ri-close-line`, `ri-close-fill`
29
+
30
+ ## Usage
31
+
32
+ Icons are rendered as `<i>` elements with Remix Icon class names:
33
+
34
+ ```tsx
35
+ <i className="ri-user-line" />
36
+ <i className="ri-settings-fill" />
37
+ <i className="ri-arrow-right-line" />
38
+ ```
39
+
40
+ **Color via icon tokens** (note: icon colors use `text-sui-icon-*`):
41
+ ```tsx
42
+ <i className="ri-user-fill text-sui-icon-default" />
43
+ <i className="ri-error-warning-line text-sui-icon-destructive" />
44
+ <i className="ri-check-line text-sui-icon-success" />
45
+ <i className="ri-information-line text-sui-icon-informative" />
46
+ <i className="ri-alarm-warning-line text-sui-icon-warning" />
47
+ <i className="ri-user-line text-sui-icon-subtle" />
48
+ ```
49
+
50
+ **Within SortUI components:**
51
+ ```tsx
52
+ // Button with lead icon
53
+ <Button>
54
+ <i className="ri-search-line" />
55
+ Search
56
+ </Button>
57
+
58
+ // Icon-only button — MUST have aria-label
59
+ <Button iconOnly aria-label="Settings">
60
+ <i className="ri-settings-line" />
61
+ </Button>
62
+
63
+ // InputField with lead icon
64
+ <InputField
65
+ leadIcon={<i className="ri-mail-line" />}
66
+ placeholder="Email"
67
+ />
68
+ ```
69
+
70
+ ## Sizing
71
+
72
+ Most SortUI components handle icon sizing automatically. When direct size control is needed, use Tailwind text-size utilities — do NOT use `ri-xs` / `ri-sm` helpers:
73
+
74
+ ```tsx
75
+ <i className="ri-user-line text-sm" />
76
+ <i className="ri-user-line text-base" />
77
+ <i className="ri-user-line text-lg" />
78
+ <i className="ri-user-line text-xl" />
79
+ <i className="ri-user-line text-2xl" />
80
+ ```
81
+
82
+ ## How to Find Icons
83
+
84
+ **CRITICAL:** Do NOT guess icon names. Icon names must be verified before use.
85
+
86
+ ### Method 1: Search the bundled CSS
87
+
88
+ The bundled CSS contains every available icon class. Search `node_modules/@maxsteinwender/sort-ui/dist/styles.css` for keywords:
89
+
90
+ ```bash
91
+ grep -o "\.ri-[a-z0-9-]*user[a-z0-9-]*:before" node_modules/@maxsteinwender/sort-ui/dist/styles.css
92
+ grep -o "\.ri-[a-z0-9-]*calendar[a-z0-9-]*:before" node_modules/@maxsteinwender/sort-ui/dist/styles.css
93
+ ```
94
+
95
+ Example workflow:
96
+ 1. Identify keyword (e.g., "calendar")
97
+ 2. Search styles.css for `ri-calendar`
98
+ 3. Find matching icons: `ri-calendar-line`, `ri-calendar-fill`, `ri-calendar-event-line`, `ri-calendar-2-line`, etc.
99
+
100
+ ### Method 2: Official Remix Icon reference
101
+
102
+ The design system uses **Remix Icon v4.9.1**. All icons from Remix Icon 4.x are available.
103
+
104
+ Reference: https://remixicon.com/
105
+
106
+ **Common icon categories:**
107
+ - **System:** settings, more, menu, close, check, error, information, question, warning
108
+ - **Arrows:** arrow-up, arrow-down, arrow-left, arrow-right, chevron-up, chevron-down
109
+ - **Media:** play, pause, stop, volume, image, camera, video
110
+ - **User:** user, team, account, contacts, profile
111
+ - **Files:** file, folder, attachment, download, upload
112
+ - **Communication:** mail, message, chat, notification, phone
113
+ - **Design:** pencil, brush, palette, format, layout
114
+ - **Business:** briefcase, bank, wallet, price-tag, shopping-cart
115
+ - **Maps:** map, pin, location, navigation, compass
116
+ - **Device:** phone, tablet, computer, keyboard, mouse
117
+ - **Weather:** sun, moon, cloud, rain, snow
118
+
119
+ ## Common Icon Patterns
120
+
121
+ ### Navigation icons
122
+ ```tsx
123
+ <i className="ri-arrow-left-line" />
124
+ <i className="ri-arrow-right-line" />
125
+ <i className="ri-arrow-up-line" />
126
+ <i className="ri-arrow-down-line" />
127
+ <i className="ri-chevron-left-line" />
128
+ <i className="ri-chevron-right-line" />
129
+ <i className="ri-menu-line" />
130
+ <i className="ri-close-line" />
131
+ <i className="ri-more-line" />
132
+ ```
133
+
134
+ ### Action icons
135
+ ```tsx
136
+ <i className="ri-add-line" />
137
+ <i className="ri-subtract-line" />
138
+ <i className="ri-edit-line" />
139
+ <i className="ri-delete-bin-line" />
140
+ <i className="ri-save-line" />
141
+ <i className="ri-download-line" />
142
+ <i className="ri-upload-line" />
143
+ <i className="ri-share-line" />
144
+ <i className="ri-search-line" />
145
+ <i className="ri-filter-line" />
146
+ ```
147
+
148
+ ### Status icons
149
+ ```tsx
150
+ <i className="ri-check-line text-sui-icon-success" />
151
+ <i className="ri-close-circle-line text-sui-icon-destructive" />
152
+ <i className="ri-error-warning-line text-sui-icon-warning" />
153
+ <i className="ri-information-line text-sui-icon-informative" />
154
+ <i className="ri-checkbox-circle-line text-sui-icon-success" />
155
+ ```
156
+
157
+ ### User / Social icons
158
+ ```tsx
159
+ <i className="ri-user-line" />
160
+ <i className="ri-user-fill" />
161
+ <i className="ri-team-line" />
162
+ <i className="ri-account-circle-line" />
163
+ <i className="ri-heart-line" />
164
+ <i className="ri-star-line" />
165
+ <i className="ri-thumb-up-line" />
166
+ ```
167
+
168
+ ### Communication icons
169
+ ```tsx
170
+ <i className="ri-mail-line" />
171
+ <i className="ri-message-line" />
172
+ <i className="ri-chat-line" />
173
+ <i className="ri-notification-line" />
174
+ <i className="ri-phone-line" />
175
+ <i className="ri-send-plane-line" />
176
+ ```
177
+
178
+ ### File / Document icons
179
+ ```tsx
180
+ <i className="ri-file-line" />
181
+ <i className="ri-folder-line" />
182
+ <i className="ri-attachment-line" />
183
+ <i className="ri-file-text-line" />
184
+ <i className="ri-file-pdf-line" />
185
+ <i className="ri-image-line" />
186
+ ```
187
+
188
+ ### Settings / System icons
189
+ ```tsx
190
+ <i className="ri-settings-line" />
191
+ <i className="ri-equalizer-line" />
192
+ <i className="ri-tools-line" />
193
+ <i className="ri-lock-line" />
194
+ <i className="ri-eye-line" />
195
+ <i className="ri-eye-off-line" />
196
+ ```
197
+
198
+ ## DO / DON'T
199
+
200
+ **DO:**
201
+ ```tsx
202
+ <i className="ri-user-line" />
203
+ <i className="ri-check-line" /> {/* outlined */}
204
+ <i className="ri-check-fill" /> {/* filled */}
205
+
206
+ // Icon-only button with aria-label
207
+ <Button iconOnly aria-label="Settings">
208
+ <i className="ri-settings-line" />
209
+ </Button>
210
+ ```
211
+
212
+ **DON'T:**
213
+ ```tsx
214
+ // ❌ Guessed icon names
215
+ <i className="ri-profile-line" /> {/* doesn't exist — use ri-user-line */}
216
+
217
+ // ❌ Installing alternate icon packages
218
+ import { User } from "lucide-react";
219
+
220
+ // ❌ Icon-only button without aria-label
221
+ <Button iconOnly>
222
+ <i className="ri-settings-line" />
223
+ </Button>
224
+ ```
225
+
226
+ ## Verifying Icon Existence
227
+
228
+ Before using an icon in generated code:
229
+
230
+ 1. **Search the bundled CSS** for the icon class
231
+ 2. **Check the pattern** matches `ri-{name}-line` or `ri-{name}-fill`
232
+ 3. **If uncertain**, pick a similar known icon (e.g., `ri-user-line` instead of guessing `ri-profile-line`)
233
+
234
+ ```bash
235
+ # Verify ri-calendar-event-line exists
236
+ grep "ri-calendar-event-line:before" node_modules/@maxsteinwender/sort-ui/dist/styles.css
237
+ # ✓ If output contains "content:" the icon is valid
238
+ ```
239
+
240
+ ## Reminders
241
+
242
+ - **Remix Icons are bundled** — no separate package install
243
+ - **Do NOT install `lucide-react`** or other icon packages
244
+ - **Always verify icon existence** before use
245
+ - **Use `-line` for outlined**, `-fill` for solid
246
+ - **Provide `aria-label`** for icon-only buttons
247
+ - **Icon color via `text-sui-icon-*` tokens** (never raw hex)
@@ -0,0 +1,343 @@
1
+ # SortUI Design System — Setup Instructions
2
+
3
+ Complete setup guide for integrating `@maxsteinwender/sort-ui` into your project.
4
+
5
+ ---
6
+
7
+ ## Package Manager
8
+
9
+ **Use npm.** This package is authored and published using npm. Examples in these guidelines always show `npm install`. Do not suggest `pnpm add` or `yarn add`.
10
+
11
+ ---
12
+
13
+ ## Package Installation
14
+
15
+ **CRITICAL**: You MUST explicitly install every package listed below as a direct dependency, exactly as written. Transitive availability does NOT count as installed.
16
+
17
+ ```bash
18
+ npm install @maxsteinwender/sort-ui
19
+ ```
20
+
21
+ Add to your `package.json`:
22
+
23
+ ```json
24
+ {
25
+ "dependencies": {
26
+ "@maxsteinwender/sort-ui": "^1.0.8"
27
+ }
28
+ }
29
+ ```
30
+
31
+ **Peer dependencies (required):**
32
+ - `react` >= 19.0.0
33
+ - `react-dom` >= 19.0.0
34
+
35
+ If using form components (React Hook Form wrappers), install:
36
+
37
+ ```bash
38
+ npm install react-hook-form
39
+ ```
40
+
41
+ ---
42
+
43
+ ## CSS Import
44
+
45
+ Import the bundled CSS **once** at your app entry point (e.g., root layout, `_app.tsx`, or `main.tsx`):
46
+
47
+ ```tsx
48
+ import "@maxsteinwender/sort-ui/styles.css";
49
+ ```
50
+
51
+ This loads:
52
+ - Design tokens (CSS custom properties)
53
+ - Remix Icons (font icons, bundled)
54
+ - Component styles
55
+ - Redaction font (bundled)
56
+ - Geist Sans + Geist Mono (bundled)
57
+
58
+ **IMPORTANT:** Only import this CSS file once. Do not import it in multiple files.
59
+
60
+ ---
61
+
62
+ ## Theme Configuration — All 4 Themes
63
+
64
+ Apply ONE of these classes to the root `<html>` (or `<body>`) element. The SortUI Design System ships **four** themes and all four must render correctly for any generated UI.
65
+
66
+ | Theme Class | Color Scheme | Mode |
67
+ |-------------|--------------|------|
68
+ | `light` | zinc/blue | light (default) |
69
+ | `dark` | zinc/blue | dark |
70
+ | `theme-2` | neutral/orange | light |
71
+ | `theme-2-dark` | neutral/orange | dark |
72
+
73
+ **Example — light (default):**
74
+ ```tsx
75
+ // app/layout.tsx
76
+ import "@maxsteinwender/sort-ui/styles.css";
77
+
78
+ export default function RootLayout({ children }) {
79
+ return (
80
+ <html lang="en" className="light">
81
+ <body>{children}</body>
82
+ </html>
83
+ );
84
+ }
85
+ ```
86
+
87
+ **Example — dark:**
88
+ ```tsx
89
+ <html lang="en" className="dark">
90
+ <body>{children}</body>
91
+ </html>
92
+ ```
93
+
94
+ **Example — theme-2 (neutral/orange, light):**
95
+ ```tsx
96
+ <html lang="en" className="theme-2">
97
+ <body>{children}</body>
98
+ </html>
99
+ ```
100
+
101
+ **Example — theme-2-dark (neutral/orange, dark):**
102
+ ```tsx
103
+ <html lang="en" className="theme-2-dark">
104
+ <body>{children}</body>
105
+ </html>
106
+ ```
107
+
108
+ **Dynamic theme switching:**
109
+ ```tsx
110
+ "use client";
111
+
112
+ import { useEffect, useState } from "react";
113
+
114
+ type Theme = "light" | "dark" | "theme-2" | "theme-2-dark";
115
+
116
+ export function ThemeProvider({ children }: { children: React.ReactNode }) {
117
+ const [theme, setTheme] = useState<Theme>("light");
118
+
119
+ useEffect(() => {
120
+ document.documentElement.className = theme;
121
+ }, [theme]);
122
+
123
+ return <>{children}</>;
124
+ }
125
+ ```
126
+
127
+ Theme variants swap CSS variables automatically — never hard-code theme-specific class logic in components.
128
+
129
+ ---
130
+
131
+ ## Tailwind CSS v3 Setup
132
+
133
+ **IMPORTANT:** SortUI targets **Tailwind CSS v3** (`^3.4.1`). It is **NOT** Tailwind v4. Do not use the v4 `@theme` directive or v4-only APIs. The package ships a **Tailwind v3 preset** that extends Tailwind with SUI design tokens.
134
+
135
+ ### 1. Install Tailwind CSS v3
136
+
137
+ ```bash
138
+ npm install -D tailwindcss@^3.4.1 postcss autoprefixer
139
+ ```
140
+
141
+ ### 2. Configure Tailwind
142
+
143
+ Import the SortUI preset in your `tailwind.config.ts` (or `tailwind.config.js`):
144
+
145
+ ```ts
146
+ // tailwind.config.ts
147
+ import type { Config } from "tailwindcss";
148
+ import sortUiPreset from "@maxsteinwender/sort-ui/tailwind-preset";
149
+
150
+ const config: Config = {
151
+ presets: [sortUiPreset],
152
+ content: [
153
+ "./src/app/**/*.{ts,tsx,js,jsx}",
154
+ "./src/components/**/*.{ts,tsx,js,jsx}",
155
+ ],
156
+ };
157
+
158
+ export default config;
159
+ ```
160
+
161
+ **JavaScript version:**
162
+ ```js
163
+ // tailwind.config.js
164
+ const sortUiPreset = require("@maxsteinwender/sort-ui/tailwind-preset");
165
+
166
+ module.exports = {
167
+ presets: [sortUiPreset],
168
+ content: [
169
+ "./src/app/**/*.{ts,tsx,js,jsx}",
170
+ "./src/components/**/*.{ts,tsx,js,jsx}",
171
+ ],
172
+ };
173
+ ```
174
+
175
+ ### 3. Add Tailwind v3 directives
176
+
177
+ Create or update your global CSS file (e.g., `globals.css`):
178
+
179
+ ```css
180
+ @tailwind base;
181
+ @tailwind components;
182
+ @tailwind utilities;
183
+ ```
184
+
185
+ **IMPORTANT:** Import `@maxsteinwender/sort-ui/styles.css` BEFORE your global CSS file:
186
+
187
+ ```tsx
188
+ // app/layout.tsx
189
+ import "@maxsteinwender/sort-ui/styles.css";
190
+ import "./globals.css";
191
+ ```
192
+
193
+ ---
194
+
195
+ ## Tailwind Utility Classes (correct naming)
196
+
197
+ The SortUI preset exposes utility classes that follow the `sui-` prefix rules in `Guidelines.md`:
198
+
199
+ | Token Category | Prefix? | Tailwind Classes | Example |
200
+ |----------------|---------|------------------|---------|
201
+ | Background | `sui-` | `bg-sui-bg-default`, `bg-sui-bg-subtle` | `<div className="bg-sui-bg-default" />` |
202
+ | Text | `sui-` | `text-sui-text-default`, `text-sui-text-subtle` | `<p className="text-sui-text-default" />` |
203
+ | Border color | `sui-` | `border-sui-border-default` | `<div className="border border-sui-border-default" />` |
204
+ | Icon color | `sui-` | `text-sui-icon-default`, `text-sui-icon-destructive` | `<i className="ri-user-line text-sui-icon-subtle" />` |
205
+ | Spacing | `sui-` | `p-sui-24`, `gap-sui-16`, `m-sui-8`, `space-y-sui-16` | `<div className="p-sui-24 gap-sui-16" />` |
206
+ | Radius | **no prefix** | `rounded-md`, `rounded-lg`, `rounded-full`, `rounded-card-md` | `<div className="rounded-lg" />` |
207
+ | Shadow | **no prefix** | `shadow-default`, `shadow-card`, `shadow-focus`, `shadow-modal-md` | `<div className="shadow-card" />` |
208
+ | Border width | **no prefix** | `border`, `border-md`, `border-lg` | `<div className="border-md" />` |
209
+
210
+ ❌ `shadow-sui-default`, `shadow-sui-card`, `shadow-sm`, `shadow-md`, `shadow-lg` — **these do not exist.**
211
+ ❌ `rounded-sui-md`, `rounded-sui-lg`, `rounded-sui-full` — **these do not exist.**
212
+
213
+ ---
214
+
215
+ ## Toast Provider Setup
216
+
217
+ If using the Toast component (powered by Sonner), add the `<Toaster />` component to your root layout:
218
+
219
+ ```tsx
220
+ // app/layout.tsx
221
+ import { Toaster } from "@maxsteinwender/sort-ui";
222
+ import "@maxsteinwender/sort-ui/styles.css";
223
+
224
+ export default function RootLayout({ children }) {
225
+ return (
226
+ <html lang="en" className="light">
227
+ <body>
228
+ {children}
229
+ <Toaster />
230
+ </body>
231
+ </html>
232
+ );
233
+ }
234
+ ```
235
+
236
+ **Usage:**
237
+ ```tsx
238
+ import { toast } from "sonner";
239
+
240
+ toast.success("Operation successful");
241
+ toast.error("Something went wrong");
242
+ ```
243
+
244
+ ---
245
+
246
+ ## Tooltip Provider Setup
247
+
248
+ If using Tooltip components, wrap your app with `<TooltipProvider>`:
249
+
250
+ ```tsx
251
+ import { TooltipProvider } from "@maxsteinwender/sort-ui";
252
+
253
+ export default function RootLayout({ children }) {
254
+ return (
255
+ <html lang="en" className="light">
256
+ <body>
257
+ <TooltipProvider>{children}</TooltipProvider>
258
+ </body>
259
+ </html>
260
+ );
261
+ }
262
+ ```
263
+
264
+ ---
265
+
266
+ ## Form Integration
267
+
268
+ For form components, install `react-hook-form` and import from the `/form` entry point:
269
+
270
+ ```bash
271
+ npm install react-hook-form
272
+ ```
273
+
274
+ ```tsx
275
+ import { useForm } from "react-hook-form";
276
+ import { Form, FormField, FormItem, FormLabel, FormControl, FormMessage } from "@maxsteinwender/sort-ui/form";
277
+ import { InputField, Button } from "@maxsteinwender/sort-ui";
278
+
279
+ const form = useForm({ defaultValues: { email: "" } });
280
+
281
+ <Form {...form}>
282
+ <form onSubmit={form.handleSubmit(onSubmit)} className="flex flex-col gap-sui-16">
283
+ <FormField
284
+ control={form.control}
285
+ name="email"
286
+ render={({ field }) => (
287
+ <FormItem>
288
+ <FormLabel>Email</FormLabel>
289
+ <FormControl>
290
+ <InputField {...field} placeholder="you@example.com" />
291
+ </FormControl>
292
+ <FormMessage />
293
+ </FormItem>
294
+ )}
295
+ />
296
+ <Button type="submit">Submit</Button>
297
+ </form>
298
+ </Form>
299
+ ```
300
+
301
+ ---
302
+
303
+ ## Icon Usage
304
+
305
+ Icons are bundled with the design system (Remix Icons). No additional installation required.
306
+
307
+ ```tsx
308
+ <i className="ri-user-line" />
309
+ <i className="ri-settings-fill" />
310
+
311
+ <Button>
312
+ <i className="ri-search-line" />
313
+ Search
314
+ </Button>
315
+ ```
316
+
317
+ **DO NOT install `lucide-react`, `heroicons`, `react-icons`, or any other icon package.**
318
+
319
+ See `icon-discovery.md` for the icon verification workflow.
320
+
321
+ ---
322
+
323
+ ## TypeScript Support
324
+
325
+ The package ships TypeScript definitions; no additional setup required.
326
+
327
+ ```tsx
328
+ import type { ButtonProps, InputFieldProps } from "@maxsteinwender/sort-ui";
329
+ ```
330
+
331
+ ---
332
+
333
+ ## Setup Checklist
334
+
335
+ - [ ] Installed `@maxsteinwender/sort-ui` via **npm** (not pnpm/yarn)
336
+ - [ ] Imported `@maxsteinwender/sort-ui/styles.css` once at app entry
337
+ - [ ] Set one of the 4 theme classes on `<html>`: `light`, `dark`, `theme-2`, or `theme-2-dark`
338
+ - [ ] Configured **Tailwind v3** with SortUI preset (not v4)
339
+ - [ ] Added `@tailwind base; @tailwind components; @tailwind utilities;` to global CSS
340
+ - [ ] Added `<Toaster />` to root layout (if using toasts)
341
+ - [ ] Wrapped app with `<TooltipProvider>` (if using tooltips)
342
+ - [ ] Installed `react-hook-form` (if using form components)
343
+ - [ ] Did NOT install `lucide-react` or any additional icon package