@loykin/designkit 0.0.1-dev.3 → 0.0.1-dev.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.
- package/README.md +58 -18
- package/dist/index.cjs +384 -246
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +53 -9
- package/dist/index.d.ts +53 -9
- package/dist/index.js +384 -248
- package/dist/index.js.map +1 -1
- package/dist/styles.css +133 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -13,21 +13,28 @@ npm install @loykin/designkit
|
|
|
13
13
|
|
|
14
14
|
Requires React 19 and Tailwind CSS v4. UI components are based on [shadcn/ui](https://ui.shadcn.com) — if your app has shadcn set up, theming integrates automatically via shared CSS variables (`--primary`, `--background`, `--radius`, etc.).
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
shadcn/ui is the component and semantic-token convention, not a runtime
|
|
17
|
+
dependency. Consumers do not need to install the shadcn CLI, but they must use
|
|
18
|
+
Tailwind CSS v4 and should define the shared semantic variables they want to
|
|
19
|
+
customize.
|
|
20
|
+
|
|
21
|
+
Import Tailwind and DesignKit from the same global CSS entry:
|
|
17
22
|
|
|
18
23
|
```css
|
|
19
24
|
/* globals.css */
|
|
25
|
+
@import "tailwindcss";
|
|
20
26
|
@import "@loykin/designkit/styles";
|
|
21
27
|
```
|
|
22
28
|
|
|
23
|
-
|
|
29
|
+
`@loykin/designkit/styles` registers the package's compiled JavaScript as a
|
|
30
|
+
Tailwind source. The consuming application's Tailwind v4 build generates the
|
|
31
|
+
utilities for both the application and DesignKit in one cascade. DesignKit does
|
|
32
|
+
not ship a second, pre-built copy of Tailwind utilities.
|
|
24
33
|
|
|
25
34
|
## Quick Start
|
|
26
35
|
|
|
27
36
|
```tsx
|
|
28
37
|
import { DataBodyTemplate, PageTopBar, Button } from '@loykin/designkit'
|
|
29
|
-
import '@loykin/designkit/styles'
|
|
30
|
-
|
|
31
38
|
export function UsersPage() {
|
|
32
39
|
return (
|
|
33
40
|
<DataBodyTemplate
|
|
@@ -204,15 +211,15 @@ handle stays inside the clipped panel corner:
|
|
|
204
211
|
|
|
205
212
|
```css
|
|
206
213
|
.layout-dashboard .react-grid-item:not(.react-grid-placeholder) {
|
|
207
|
-
--
|
|
208
|
-
--
|
|
209
|
-
--
|
|
210
|
-
--
|
|
211
|
-
--
|
|
214
|
+
--designkit-resize-handle-size: clamp(20px, calc(var(--radius) * 1.6), 40px);
|
|
215
|
+
--designkit-resize-handle-inset: clamp(4px, calc(var(--radius) * 0.45), 16px);
|
|
216
|
+
--designkit-resize-handle-mark-size: clamp(6px, calc(var(--radius) * 0.55), 12px);
|
|
217
|
+
--designkit-resize-handle-color: rgba(0, 0, 0, 0.35);
|
|
218
|
+
--designkit-resize-handle-mark-radius: min(var(--radius), var(--designkit-resize-handle-mark-size));
|
|
212
219
|
}
|
|
213
220
|
|
|
214
221
|
.dark .layout-dashboard .react-grid-item:not(.react-grid-placeholder) {
|
|
215
|
-
--
|
|
222
|
+
--designkit-resize-handle-color: rgba(255, 255, 255, 0.4);
|
|
216
223
|
}
|
|
217
224
|
```
|
|
218
225
|
|
|
@@ -453,6 +460,39 @@ import {
|
|
|
453
460
|
} from '@loykin/designkit'
|
|
454
461
|
```
|
|
455
462
|
|
|
463
|
+
### PageTopBar
|
|
464
|
+
|
|
465
|
+
Top breadcrumb / action bar placed at the top of a page template via the `topBar` prop.
|
|
466
|
+
|
|
467
|
+
```tsx
|
|
468
|
+
import { PageTopBar } from '@loykin/designkit'
|
|
469
|
+
|
|
470
|
+
<PageTopBar left="Admin / Users" right={<Button size="sm">Add</Button>} />
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
| Prop | Type | Default | Description |
|
|
474
|
+
|---|---|---|---|
|
|
475
|
+
| `left` | `ReactNode` | — | Left content. A plain string is parsed as `/`-separated breadcrumbs. |
|
|
476
|
+
| `right` | `ReactNode` | — | Right-aligned actions |
|
|
477
|
+
| `variant` | `'ghost' \| 'default'` | `'ghost'` | `'default'` adds a bottom border |
|
|
478
|
+
| `sidebarTrigger` | `false \| ReactNode` | auto | Mobile sidebar open button. `undefined` auto-detects SidebarProvider context; `false` suppresses; pass a `ReactNode` for a custom trigger. |
|
|
479
|
+
| `height` | `string` | `var(--designkit-toolbar-height)` | Bar height |
|
|
480
|
+
| `className` | `string` | — | Class applied to the bar root |
|
|
481
|
+
|
|
482
|
+
**Mobile sidebar trigger**
|
|
483
|
+
|
|
484
|
+
When `PageTopBar` is rendered inside a `SidebarShell` on a mobile viewport, it automatically prepends a hamburger trigger to open the sidebar drawer — no extra code required. To suppress this (e.g. when the left slot already has a back button), pass `sidebarTrigger={false}`:
|
|
485
|
+
|
|
486
|
+
```tsx
|
|
487
|
+
// Back-button detail page — suppress auto trigger
|
|
488
|
+
<PageTopBar sidebarTrigger={false} left={<BackButton />} />
|
|
489
|
+
|
|
490
|
+
// Custom trigger
|
|
491
|
+
<PageTopBar sidebarTrigger={<MyTrigger />} left="Settings" />
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
---
|
|
495
|
+
|
|
456
496
|
### EmptyState
|
|
457
497
|
|
|
458
498
|
```tsx
|
|
@@ -471,20 +511,20 @@ import { Users } from 'lucide-react'
|
|
|
471
511
|
|
|
472
512
|
## Theming
|
|
473
513
|
|
|
474
|
-
Designkit maps shadcn/ui CSS variables onto its own `--
|
|
514
|
+
Designkit maps shadcn/ui CSS variables onto its own `--designkit-*` tokens. Changing your shadcn theme automatically updates all designkit components.
|
|
475
515
|
|
|
476
516
|
| What | How |
|
|
477
517
|
|---|---|
|
|
478
518
|
| Colors, radius, typography | shadcn/ui theme variables (`--primary`, `--radius`, etc.) |
|
|
479
|
-
| Spacing, density, padding | `--
|
|
519
|
+
| Spacing, density, padding | `--designkit-density`, `--designkit-page-padding-*`, `--designkit-panel-gap` |
|
|
480
520
|
| Per-page overrides | `className` or `theme` prop |
|
|
481
521
|
|
|
482
522
|
```css
|
|
483
523
|
:root {
|
|
484
|
-
--
|
|
485
|
-
--
|
|
486
|
-
--
|
|
487
|
-
--
|
|
524
|
+
--designkit-density: 1; /* 0.85 compact / 1 default / 1.15 comfortable */
|
|
525
|
+
--designkit-page-padding-x: 1.5rem;
|
|
526
|
+
--designkit-page-padding-y: 1rem;
|
|
527
|
+
--designkit-panel-gap: 1rem;
|
|
488
528
|
}
|
|
489
529
|
```
|
|
490
530
|
|
|
@@ -492,7 +532,7 @@ Per-page override via `className`:
|
|
|
492
532
|
|
|
493
533
|
```css
|
|
494
534
|
.layout-dashboard {
|
|
495
|
-
--
|
|
535
|
+
--designkit-density: 0.85;
|
|
496
536
|
}
|
|
497
537
|
```
|
|
498
538
|
|
|
@@ -504,7 +544,7 @@ Or via `theme` prop:
|
|
|
504
544
|
|
|
505
545
|
```tsx
|
|
506
546
|
<DataBodyTemplate
|
|
507
|
-
theme={{ '--
|
|
547
|
+
theme={{ '--designkit-density': '1.15' } as React.CSSProperties}
|
|
508
548
|
title="Settings"
|
|
509
549
|
>
|
|
510
550
|
```
|