@equal-experts/kuat-react 0.2.3 → 0.2.5

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,451 @@
1
+ # Kuat Design System Typography
2
+
3
+ A guide to using typography in the Kuat Design System. This document helps ensure consistent, accessible typography across all digital products built with shadcn/ui and shadcn-vue.
4
+
5
+ ---
6
+
7
+ ## Overview
8
+
9
+ The Kuat Design System follows shadcn/ui patterns, which means **typography is handled through Tailwind CSS utility classes** rather than predefined typography components. This approach provides flexibility while maintaining consistency through design tokens.
10
+
11
+ **Key Principle:** Use Tailwind utility classes for typography styling. All typography values are defined in `@equal-experts/kuat-core` and accessible via Tailwind classes.
12
+
13
+ ---
14
+
15
+ ## Font Families
16
+
17
+ Font families are defined in `@equal-experts/kuat-core/src/variables.css` and available via Tailwind utilities.
18
+
19
+ ### Sans Serif (Default)
20
+ - **Font Family:** `Lexend`
21
+ - **CSS Variable:** `--font-sans`
22
+ - **Tailwind Class:** `font-sans`
23
+ - **Fallback Stack:** `Lexend, ui-sans-serif, sans-serif, system-ui`
24
+ - **Usage:** Primary font for all UI elements, body text, headings, and interface copy
25
+
26
+ ### Serif
27
+ - **Font Family:** `Lora`
28
+ - **CSS Variable:** `--font-serif`
29
+ - **Tailwind Class:** `font-serif`
30
+ - **Usage:** Decorative text, special emphasis (use sparingly)
31
+
32
+ ### Monospace
33
+ - **Font Family:** `JetBrains Mono`
34
+ - **CSS Variable:** `--font-mono`
35
+ - **Tailwind Class:** `font-mono`
36
+ - **Usage:** Code blocks, technical content, data display
37
+ - **Why JetBrains Mono:** A professional monospace font designed specifically for developers, with excellent readability and clear character distinction optimized for coding
38
+
39
+ ### Usage Examples
40
+
41
+ ```tsx
42
+ // React
43
+ <p className="font-sans">Primary text using Lexend</p>
44
+ <code className="font-mono">Code example</code>
45
+ ```
46
+
47
+ ```vue
48
+ <!-- Vue -->
49
+ <p class="font-sans">Primary text using Lexend</p>
50
+ <code class="font-mono">Code example</code>
51
+ ```
52
+
53
+ ---
54
+
55
+ ## Typography Scale
56
+
57
+ The design system uses Tailwind's default typography scale. All sizes are relative and responsive by default.
58
+
59
+ ### Text Sizes (Tailwind Utilities)
60
+
61
+ | Size | Class | Font Size | Line Height | Usage |
62
+ |------|-------|-----------|-------------|-------|
63
+ | XS | `text-xs` | 0.75rem (12px) | 1rem (16px) | Labels, captions, metadata |
64
+ | SM | `text-sm` | 0.875rem (14px) | 1.25rem (20px) | Secondary text, form inputs |
65
+ | Base | `text-base` | 1rem (16px) | 1.5rem (24px) | Body text (default) |
66
+ | LG | `text-lg` | 1.125rem (18px) | 1.75rem (28px) | Large body text, subheadings |
67
+ | XL | `text-xl` | 1.25rem (20px) | 1.75rem (28px) | Section headings |
68
+ | 2XL | `text-2xl` | 1.5rem (24px) | 2rem (32px) | Page headings |
69
+ | 3XL | `text-3xl` | 1.875rem (30px) | 2.25rem (36px) | Large headings |
70
+ | 4XL | `text-4xl` | 2.25rem (36px) | 2.5rem (40px) | Display text |
71
+ | 5XL | `text-5xl` | 3rem (48px) | 1 | Hero headings |
72
+ | 6XL | `text-6xl` | 3.75rem (60px) | 1 | Large hero text |
73
+ | 7XL | `text-7xl` | 4.5rem (72px) | 1 | Extra large display |
74
+ | 8XL | `text-8xl` | 6rem (96px) | 1 | Maximum display |
75
+ | 9XL | `text-9xl` | 8rem (128px) | 1 | Ultra large display |
76
+
77
+ ### Usage Examples
78
+
79
+ ```tsx
80
+ // React
81
+ <h1 className="text-4xl font-bold">Page Title</h1>
82
+ <p className="text-base">Body text content</p>
83
+ <span className="text-sm text-muted-foreground">Secondary information</span>
84
+ ```
85
+
86
+ ```vue
87
+ <!-- Vue -->
88
+ <h1 class="text-4xl font-bold">Page Title</h1>
89
+ <p class="text-base">Body text content</p>
90
+ <span class="text-sm text-muted-foreground">Secondary information</span>
91
+ ```
92
+
93
+ ---
94
+
95
+ ## Font Weights
96
+
97
+ Font weights use Tailwind's standard weight scale:
98
+
99
+ | Weight | Class | Value | Usage |
100
+ |--------|-------|-------|-------|
101
+ | Thin | `font-thin` | 100 | Rarely used |
102
+ | Extra Light | `font-extralight` | 200 | Rarely used |
103
+ | Light | `font-light` | 300 | Large display text, subtle emphasis |
104
+ | Normal | `font-normal` | 400 | Default body text |
105
+ | Medium | `font-medium` | 500 | Form inputs, UI labels, subtle emphasis |
106
+ | Semi Bold | `font-semibold` | 600 | Headings, important labels |
107
+ | Bold | `font-bold` | 700 | Strong emphasis, primary headings |
108
+ | Extra Bold | `font-extrabold` | 800 | Maximum emphasis (use sparingly) |
109
+ | Black | `font-black` | 900 | Maximum emphasis (use sparingly) |
110
+
111
+ ### Recommended Weight Usage
112
+
113
+ - **Body Text:** `font-normal` (400) - Default for paragraphs and content
114
+ - **Headings:** `font-semibold` (600) or `font-bold` (700)
115
+ - **Form Inputs:** `font-medium` (500) or `font-semibold` (600)
116
+ - **UI Labels:** `font-medium` (500)
117
+ - **Display Text:** `font-light` (300) for large sizes, `font-bold` (700) for impact
118
+
119
+ ---
120
+
121
+ ## Text Colors
122
+
123
+ Text colors use the design system's semantic color tokens from `@equal-experts/kuat-core`. All colors support light and dark modes automatically.
124
+
125
+ ### Primary Text Colors
126
+
127
+ | Color | Class | Usage |
128
+ |-------|-------|-------|
129
+ | Foreground | `text-foreground` | Primary text color (default) |
130
+ | Muted | `text-muted-foreground` | Secondary text, hints, metadata |
131
+ | Primary | `text-primary` | Brand color text |
132
+ | Primary Foreground | `text-primary-foreground` | Text on primary backgrounds |
133
+ | Secondary | `text-secondary` | Secondary brand color |
134
+ | Secondary Foreground | `text-secondary-foreground` | Text on secondary backgrounds |
135
+ | Accent | `text-accent` | Accent color text |
136
+ | Accent Foreground | `text-accent-foreground` | Text on accent backgrounds |
137
+ | Destructive | `text-destructive` | Error text, warnings |
138
+ | Destructive Foreground | `text-destructive-foreground` | Text on destructive backgrounds |
139
+
140
+ ### Usage Examples
141
+
142
+ ```tsx
143
+ // React
144
+ <p className="text-foreground">Primary text</p>
145
+ <p className="text-muted-foreground">Secondary text</p>
146
+ <h2 className="text-primary">Brand heading</h2>
147
+ <span className="text-destructive">Error message</span>
148
+ ```
149
+
150
+ ```vue
151
+ <!-- Vue -->
152
+ <p class="text-foreground">Primary text</p>
153
+ <p class="text-muted-foreground">Secondary text</p>
154
+ <h2 class="text-primary">Brand heading</h2>
155
+ <span class="text-destructive">Error message</span>
156
+ ```
157
+
158
+ ### Accessibility
159
+
160
+ All text color combinations are designed to meet WCAG AA contrast standards:
161
+ - **Normal text:** Minimum 4.5:1 contrast ratio
162
+ - **Large text (18px+ or 14px+ bold):** Minimum 3:1 contrast ratio
163
+
164
+ Always use semantic color tokens rather than hardcoded colors to ensure accessibility.
165
+
166
+ ---
167
+
168
+ ## Letter Spacing
169
+
170
+ Letter spacing is controlled via CSS variables and Tailwind utilities.
171
+
172
+ ### Available Classes
173
+
174
+ | Class | Value | Usage |
175
+ |------|-------|-------|
176
+ | `tracking-tighter` | `calc(var(--tracking-normal) - 0.05em)` | Tighter spacing |
177
+ | `tracking-tight` | `calc(var(--tracking-normal) - 0.025em)` | Slightly tighter |
178
+ | `tracking-normal` | `var(--tracking-normal)` (0.01em) | Default spacing |
179
+ | `tracking-wide` | `calc(var(--tracking-normal) + 0.025em)` | Slightly wider |
180
+ | `tracking-wider` | `calc(var(--tracking-normal) + 0.05em)` | Wider spacing |
181
+ | `tracking-widest` | `calc(var(--tracking-normal) + 0.1em)` | Maximum spacing |
182
+
183
+ **Default:** Body text uses `tracking-normal` automatically via CSS variables.
184
+
185
+ ---
186
+
187
+ ## Line Height
188
+
189
+ Line heights are built into Tailwind's typography scale. Use Tailwind's `leading-*` utilities for custom line heights when needed.
190
+
191
+ ### Common Line Height Classes
192
+
193
+ | Class | Value | Usage |
194
+ |------|-------|-------|
195
+ | `leading-none` | 1 | Tight spacing (headings) |
196
+ | `leading-tight` | 1.25 | Compact text |
197
+ | `leading-snug` | 1.375 | Slightly tight |
198
+ | `leading-normal` | 1.5 | Default body text |
199
+ | `leading-relaxed` | 1.625 | Comfortable reading |
200
+ | `leading-loose` | 2 | Generous spacing |
201
+
202
+ ---
203
+
204
+ ## Typography in Components
205
+
206
+ ### Using Typography with shadcn/ui Components
207
+
208
+ shadcn/ui components use Tailwind utility classes for typography. You can customize typography by adding classes:
209
+
210
+ ```tsx
211
+ // React - Button component
212
+ <Button className="text-lg font-semibold">
213
+ Click me
214
+ </Button>
215
+
216
+ // React - Card component
217
+ <Card>
218
+ <CardHeader>
219
+ <CardTitle className="text-2xl font-bold">Card Title</CardTitle>
220
+ <CardDescription className="text-sm text-muted-foreground">
221
+ Card description
222
+ </CardDescription>
223
+ </CardHeader>
224
+ </Card>
225
+ ```
226
+
227
+ ```vue
228
+ <!-- Vue - Button component -->
229
+ <Button class="text-lg font-semibold">
230
+ Click me
231
+ </Button>
232
+
233
+ <!-- Vue - Card component -->
234
+ <Card>
235
+ <CardHeader>
236
+ <CardTitle class="text-2xl font-bold">Card Title</CardTitle>
237
+ <CardDescription class="text-sm text-muted-foreground">
238
+ Card description
239
+ </CardDescription>
240
+ </CardHeader>
241
+ </Card>
242
+ ```
243
+
244
+ ### Creating Typography Utilities
245
+
246
+ For reusable typography patterns, create utility classes or use the `cn()` helper:
247
+
248
+ ```tsx
249
+ // React
250
+ import { cn } from "@/lib/utils"
251
+
252
+ const headingStyles = cn(
253
+ "text-2xl font-bold text-foreground",
254
+ "tracking-tight"
255
+ )
256
+
257
+ <h1 className={headingStyles}>Heading</h1>
258
+ ```
259
+
260
+ ```vue
261
+ <!-- Vue -->
262
+ <script setup>
263
+ import { cn } from "@/lib/utils"
264
+
265
+ const headingStyles = cn(
266
+ "text-2xl font-bold text-foreground",
267
+ "tracking-tight"
268
+ )
269
+ </script>
270
+
271
+ <template>
272
+ <h1 :class="headingStyles">Heading</h1>
273
+ </template>
274
+ ```
275
+
276
+ ---
277
+
278
+ ## Typography Hierarchy
279
+
280
+ Establish clear visual hierarchy using size, weight, and color:
281
+
282
+ 1. **Primary Heading (H1):** `text-4xl` or `text-5xl` with `font-bold`
283
+ 2. **Secondary Heading (H2):** `text-3xl` or `text-2xl` with `font-semibold` or `font-bold`
284
+ 3. **Tertiary Heading (H3):** `text-xl` or `text-2xl` with `font-semibold`
285
+ 4. **Body Text:** `text-base` with `font-normal`
286
+ 5. **Supporting Text:** `text-sm` with `font-normal` or `font-medium`
287
+ 6. **Labels/Captions:** `text-xs` or `text-sm` with `text-muted-foreground`
288
+
289
+ ### Example Hierarchy
290
+
291
+ ```tsx
292
+ // React
293
+ <div>
294
+ <h1 className="text-5xl font-bold text-foreground mb-4">
295
+ Main Page Title
296
+ </h1>
297
+ <h2 className="text-3xl font-semibold text-foreground mb-3">
298
+ Section Heading
299
+ </h2>
300
+ <p className="text-base font-normal text-foreground mb-2">
301
+ Body text content goes here. This is the primary content.
302
+ </p>
303
+ <p className="text-sm text-muted-foreground">
304
+ Supporting information or metadata.
305
+ </p>
306
+ </div>
307
+ ```
308
+
309
+ ```vue
310
+ <!-- Vue -->
311
+ <template>
312
+ <div>
313
+ <h1 class="text-5xl font-bold text-foreground mb-4">
314
+ Main Page Title
315
+ </h1>
316
+ <h2 class="text-3xl font-semibold text-foreground mb-3">
317
+ Section Heading
318
+ </h2>
319
+ <p class="text-base font-normal text-foreground mb-2">
320
+ Body text content goes here. This is the primary content.
321
+ </p>
322
+ <p class="text-sm text-muted-foreground">
323
+ Supporting information or metadata.
324
+ </p>
325
+ </div>
326
+ </template>
327
+ ```
328
+
329
+ ---
330
+
331
+ ## Best Practices
332
+
333
+ ### ✅ Do's
334
+
335
+ 1. **Use Tailwind utility classes**
336
+ - ✅ Use `text-*` classes for font sizes
337
+ - ✅ Use `font-*` classes for font weights
338
+ - ✅ Use semantic color tokens (`text-foreground`, `text-muted-foreground`, etc.)
339
+
340
+ 2. **Maintain consistency**
341
+ - ✅ Use the same typography scale across components
342
+ - ✅ Follow the hierarchy guidelines
343
+ - ✅ Use design tokens from `@equal-experts/kuat-core`
344
+
345
+ 3. **Ensure accessibility**
346
+ - ✅ Use semantic HTML elements (`<h1>`, `<h2>`, `<p>`, etc.)
347
+ - ✅ Apply visual styles with classes, not semantic meaning
348
+ - ✅ Verify contrast ratios meet WCAG AA standards
349
+ - ✅ Use proper heading hierarchy (h1 → h2 → h3, etc.)
350
+
351
+ 4. **Use semantic colors**
352
+ - ✅ Prefer `text-foreground` over hardcoded colors
353
+ - ✅ Use `text-muted-foreground` for secondary text
354
+ - ✅ Leverage color tokens for automatic dark mode support
355
+
356
+ 5. **Combine utilities effectively**
357
+ - ✅ Use the `cn()` utility for conditional classes
358
+ - ✅ Create reusable typography patterns
359
+ - ✅ Keep class lists readable and maintainable
360
+
361
+ ### ❌ Don'ts
362
+
363
+ 1. **Don't hardcode typography values**
364
+ - ❌ Don't use inline styles for font sizes or weights
365
+ - ❌ Don't create custom CSS for typography (use Tailwind)
366
+ - ❌ Don't use pixel values directly in components
367
+
368
+ 2. **Don't break semantic structure**
369
+ - ❌ Don't use heading levels based on appearance
370
+ - ❌ Don't use `<h1>` through `<h6>` for styling non-headings
371
+ - ❌ Don't skip heading levels (h1 → h3 is invalid)
372
+
373
+ 3. **Don't ignore accessibility**
374
+ - ❌ Don't use low-contrast text colors
375
+ - ❌ Don't use font sizes smaller than 12px for body text
376
+ - ❌ Don't rely solely on color to convey information
377
+
378
+ 4. **Don't mix font families unnecessarily**
379
+ - ❌ Don't use multiple font families in the same component
380
+ - ❌ Don't override font-family without a good reason
381
+ - ❌ Stick to `font-sans` for most UI elements
382
+
383
+ 5. **Don't create custom typography components**
384
+ - ❌ Don't create wrapper components for typography (shadcn/ui pattern)
385
+ - ❌ Use Tailwind utilities directly
386
+ - ❌ Keep typography styling at the element level
387
+
388
+ ---
389
+
390
+ ## Responsive Typography
391
+
392
+ Tailwind's responsive modifiers work with typography utilities:
393
+
394
+ ```tsx
395
+ // React
396
+ <h1 className="text-2xl md:text-4xl lg:text-5xl font-bold">
397
+ Responsive Heading
398
+ </h1>
399
+ ```
400
+
401
+ ```vue
402
+ <!-- Vue -->
403
+ <h1 class="text-2xl md:text-4xl lg:text-5xl font-bold">
404
+ Responsive Heading
405
+ </h1>
406
+ ```
407
+
408
+ ---
409
+
410
+ ## Dark Mode
411
+
412
+ Typography automatically adapts to dark mode through color tokens:
413
+
414
+ ```tsx
415
+ // React - Colors automatically switch in dark mode
416
+ <p className="text-foreground">This text adapts to dark mode</p>
417
+ <p className="text-muted-foreground">Secondary text also adapts</p>
418
+ ```
419
+
420
+ The `text-foreground` and `text-muted-foreground` classes automatically use the appropriate colors based on the `dark` class on the root element.
421
+
422
+ ---
423
+
424
+ ## Integration with Design System
425
+
426
+ Typography integrates seamlessly with other design system elements:
427
+
428
+ - **Colors:** Use semantic color tokens (`text-foreground`, `text-primary`, etc.)
429
+ - **Spacing:** Combine with Tailwind spacing utilities (`mb-4`, `mt-2`, etc.)
430
+ - **Components:** All shadcn/ui components accept typography classes
431
+ - **Tokens:** All values come from `@equal-experts/kuat-core/src/variables.css`
432
+
433
+ ---
434
+
435
+ ## Additional Resources
436
+
437
+ - **Design System Overview:** See [design-system.md](./design-system.md) for complete design system documentation
438
+ - **Component Guidelines:** See [../technical/component-guidelines.md](../technical/component-guidelines.md) for component development patterns
439
+ - **Usage Guide:** See [../usage-guide.md](../usage-guide.md) for quick reference
440
+ - **shadcn/ui Typography:** [shadcn/ui Typography Documentation](https://ui.shadcn.com/docs/components/typography)
441
+ - **Tailwind Typography:** [Tailwind CSS Typography Documentation](https://tailwindcss.com/docs/font-size)
442
+
443
+ ---
444
+
445
+ ## Notes
446
+
447
+ - **Consistency is key:** Always use Tailwind utility classes for typography
448
+ - **Semantic HTML first:** Use proper HTML elements, then style with classes
449
+ - **Design tokens:** All typography values reference tokens from `@equal-experts/kuat-core`
450
+ - **Flexibility:** shadcn/ui's utility-first approach allows customization while maintaining consistency
451
+ - **Accessibility:** Always verify contrast ratios and use semantic HTML structure
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equal-experts/kuat-react",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -10,10 +10,28 @@
10
10
  "import": "./dist/index.js",
11
11
  "types": "./dist/index.d.ts"
12
12
  },
13
- "./styles": "./dist/style.css"
13
+ "./button": {
14
+ "import": "./dist/button.js",
15
+ "types": "./dist/button.d.ts"
16
+ },
17
+ "./accordion": {
18
+ "import": "./dist/accordion.js",
19
+ "types": "./dist/accordion.d.ts"
20
+ },
21
+ "./alert-dialog": {
22
+ "import": "./dist/alert-dialog.js",
23
+ "types": "./dist/alert-dialog.d.ts"
24
+ },
25
+ "./badge": {
26
+ "import": "./dist/badge.js",
27
+ "types": "./dist/badge.d.ts"
28
+ },
29
+ "./styles": "./dist/style.css",
30
+ "./docs/*": "./docs/*"
14
31
  },
15
32
  "files": [
16
33
  "dist",
34
+ "docs",
17
35
  "README.md"
18
36
  ],
19
37
  "keywords": [
@@ -46,7 +64,7 @@
46
64
  "typescript": "^5.3.3",
47
65
  "vite": "^5.1.0",
48
66
  "vite-plugin-dts": "^3.6.4",
49
- "@equal-experts/kuat-core": "0.2.1"
67
+ "@equal-experts/kuat-core": "0.2.4"
50
68
  },
51
69
  "peerDependencies": {
52
70
  "react": "^18.2.0",
@@ -77,9 +95,10 @@
77
95
  "@radix-ui/react-toggle": "^1.0.3",
78
96
  "@radix-ui/react-toggle-group": "^1.0.3",
79
97
  "@radix-ui/react-tooltip": "^1.0.7",
80
- "lucide-react": "^0.344.0"
98
+ "lucide-react": "^0.344.0 || >=0.400.0"
81
99
  },
82
100
  "scripts": {
101
+ "copy-docs": "node scripts/copy-docs.js",
83
102
  "build": "vite build",
84
103
  "dev": "vite build --watch",
85
104
  "lint": "eslint . --max-warnings 0"