@loykin/designkit 0.0.1-dev.2 → 0.0.1-dev.4
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 +113 -22
- package/dist/index.cjs +426 -103
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +100 -3
- package/dist/index.d.ts +100 -3
- package/dist/index.js +425 -106
- package/dist/index.js.map +1 -1
- package/dist/styles.css +2 -77
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
React page template library. Provides ready-to-use page layouts for admin and dashboard applications.
|
|
4
4
|
|
|
5
|
+
For AI-assisted implementation in consuming applications, see the
|
|
6
|
+
[DesignKit Consumer Agent Guide](docs/consumer-guide.md).
|
|
7
|
+
|
|
5
8
|
## Installation
|
|
6
9
|
|
|
7
10
|
```bash
|
|
@@ -17,14 +20,7 @@ Import the styles in your global CSS:
|
|
|
17
20
|
@import "@loykin/designkit/styles";
|
|
18
21
|
```
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
your Tailwind scan sources:
|
|
22
|
-
|
|
23
|
-
```css
|
|
24
|
-
@source "@loykin/designkit";
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
You can also import the stylesheet from your app entry, as shown below.
|
|
23
|
+
The styles file includes pre-built Tailwind utility classes — no `@source` configuration required. You can also import the stylesheet from your app entry, as shown below.
|
|
28
24
|
|
|
29
25
|
## Quick Start
|
|
30
26
|
|
|
@@ -138,6 +134,16 @@ Groups content within a tab or section. The `layout` prop controls the visual st
|
|
|
138
134
|
| `inline` | Table-style rows (detail view) |
|
|
139
135
|
| `split` | Left list + right detail |
|
|
140
136
|
|
|
137
|
+
| Prop | Type | Description |
|
|
138
|
+
|---|---|---|
|
|
139
|
+
| `layout` | `GroupLayout` | Visual structure — see table above |
|
|
140
|
+
| `variant` | `'card' \| 'plain' \| 'bordered'` | Wrapper style (defaults per layout) |
|
|
141
|
+
| `title` | `ReactNode` | Group heading |
|
|
142
|
+
| `description` | `ReactNode` | Subtitle below the heading |
|
|
143
|
+
| `actions` | `ReactNode` | Action slot next to the heading |
|
|
144
|
+
| `danger` | `boolean` | Renders title in destructive color |
|
|
145
|
+
| `className` | `string` | Class applied to the group root element |
|
|
146
|
+
|
|
141
147
|
```tsx
|
|
142
148
|
<DataBodyTemplate.Tab id="settings" label="Settings">
|
|
143
149
|
<DataBodyTemplate.Group layout="horizontal" title="Identity" description="Basic information">
|
|
@@ -198,15 +204,15 @@ handle stays inside the clipped panel corner:
|
|
|
198
204
|
|
|
199
205
|
```css
|
|
200
206
|
.layout-dashboard .react-grid-item:not(.react-grid-placeholder) {
|
|
201
|
-
--
|
|
202
|
-
--
|
|
203
|
-
--
|
|
204
|
-
--
|
|
205
|
-
--
|
|
207
|
+
--designkit-resize-handle-size: clamp(20px, calc(var(--radius) * 1.6), 40px);
|
|
208
|
+
--designkit-resize-handle-inset: clamp(4px, calc(var(--radius) * 0.45), 16px);
|
|
209
|
+
--designkit-resize-handle-mark-size: clamp(6px, calc(var(--radius) * 0.55), 12px);
|
|
210
|
+
--designkit-resize-handle-color: rgba(0, 0, 0, 0.35);
|
|
211
|
+
--designkit-resize-handle-mark-radius: min(var(--radius), var(--designkit-resize-handle-mark-size));
|
|
206
212
|
}
|
|
207
213
|
|
|
208
214
|
.dark .layout-dashboard .react-grid-item:not(.react-grid-placeholder) {
|
|
209
|
-
--
|
|
215
|
+
--designkit-resize-handle-color: rgba(255, 255, 255, 0.4);
|
|
210
216
|
}
|
|
211
217
|
```
|
|
212
218
|
|
|
@@ -300,6 +306,44 @@ Panel card component. Wrap your panel viewer in `DashboardPanel` for consistent
|
|
|
300
306
|
|
|
301
307
|
---
|
|
302
308
|
|
|
309
|
+
### WorkbenchBodyTemplate
|
|
310
|
+
|
|
311
|
+
Resizable editor/workbench shell for products like panel editors, SQL editors, log explorers, and data workspaces. The template owns the pane chrome and resize handles; the app owns editor, preview, inspector, schema, and result content.
|
|
312
|
+
|
|
313
|
+
```tsx
|
|
314
|
+
import { WorkbenchBodyTemplate, PageTopBar, Button } from '@loykin/designkit'
|
|
315
|
+
|
|
316
|
+
export function SqlEditorPage() {
|
|
317
|
+
return (
|
|
318
|
+
<WorkbenchBodyTemplate
|
|
319
|
+
topBar={<PageTopBar left="Data / Query editor" />}
|
|
320
|
+
title="SQL editor"
|
|
321
|
+
headerRight={<Button variant="outline" size="sm">Run</Button>}
|
|
322
|
+
leftPane={<SchemaBrowser />}
|
|
323
|
+
mainPane={<SqlEditor />}
|
|
324
|
+
bottomPane={<ResultsGrid />}
|
|
325
|
+
resizable
|
|
326
|
+
/>
|
|
327
|
+
)
|
|
328
|
+
}
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
**WorkbenchBodyTemplate props:**
|
|
332
|
+
|
|
333
|
+
| Prop | Type | Description |
|
|
334
|
+
|---|---|---|
|
|
335
|
+
| `topBar` | `ReactNode` | Top bar above the workbench |
|
|
336
|
+
| `title` / `description` | `ReactNode` | Header copy above the panes |
|
|
337
|
+
| `headerRight` / `actions` | `ReactNode` | Header action slots |
|
|
338
|
+
| `leftPane` / `rightPane` | `ReactNode` | Optional side panes |
|
|
339
|
+
| `mainPane` | `ReactNode` | Primary editor or preview area |
|
|
340
|
+
| `bottomPane` | `ReactNode` | Optional result, query, or logs pane |
|
|
341
|
+
| `resizable` | `boolean` | Enables pane drag handles |
|
|
342
|
+
| `leftPaneCollapsed` / `rightPaneCollapsed` / `bottomPaneCollapsed` | `boolean` | Hides optional panes while preserving the template layout model |
|
|
343
|
+
| `leftPaneWidth` / `rightPaneWidth` / `bottomPaneHeight` | `number` | Initial pane sizes in pixels |
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
303
347
|
### FormWizardBodyTemplate
|
|
304
348
|
|
|
305
349
|
Multi-step input wizard. Wraps each step's `content` in a `<form>` element automatically.
|
|
@@ -409,6 +453,39 @@ import {
|
|
|
409
453
|
} from '@loykin/designkit'
|
|
410
454
|
```
|
|
411
455
|
|
|
456
|
+
### PageTopBar
|
|
457
|
+
|
|
458
|
+
Top breadcrumb / action bar placed at the top of a page template via the `topBar` prop.
|
|
459
|
+
|
|
460
|
+
```tsx
|
|
461
|
+
import { PageTopBar } from '@loykin/designkit'
|
|
462
|
+
|
|
463
|
+
<PageTopBar left="Admin / Users" right={<Button size="sm">Add</Button>} />
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
| Prop | Type | Default | Description |
|
|
467
|
+
|---|---|---|---|
|
|
468
|
+
| `left` | `ReactNode` | — | Left content. A plain string is parsed as `/`-separated breadcrumbs. |
|
|
469
|
+
| `right` | `ReactNode` | — | Right-aligned actions |
|
|
470
|
+
| `variant` | `'ghost' \| 'default'` | `'ghost'` | `'default'` adds a bottom border |
|
|
471
|
+
| `sidebarTrigger` | `false \| ReactNode` | auto | Mobile sidebar open button. `undefined` auto-detects SidebarProvider context; `false` suppresses; pass a `ReactNode` for a custom trigger. |
|
|
472
|
+
| `height` | `string` | `var(--designkit-toolbar-height)` | Bar height |
|
|
473
|
+
| `className` | `string` | — | Class applied to the bar root |
|
|
474
|
+
|
|
475
|
+
**Mobile sidebar trigger**
|
|
476
|
+
|
|
477
|
+
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}`:
|
|
478
|
+
|
|
479
|
+
```tsx
|
|
480
|
+
// Back-button detail page — suppress auto trigger
|
|
481
|
+
<PageTopBar sidebarTrigger={false} left={<BackButton />} />
|
|
482
|
+
|
|
483
|
+
// Custom trigger
|
|
484
|
+
<PageTopBar sidebarTrigger={<MyTrigger />} left="Settings" />
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
---
|
|
488
|
+
|
|
412
489
|
### EmptyState
|
|
413
490
|
|
|
414
491
|
```tsx
|
|
@@ -427,20 +504,20 @@ import { Users } from 'lucide-react'
|
|
|
427
504
|
|
|
428
505
|
## Theming
|
|
429
506
|
|
|
430
|
-
Designkit maps shadcn/ui CSS variables onto its own `--
|
|
507
|
+
Designkit maps shadcn/ui CSS variables onto its own `--designkit-*` tokens. Changing your shadcn theme automatically updates all designkit components.
|
|
431
508
|
|
|
432
509
|
| What | How |
|
|
433
510
|
|---|---|
|
|
434
511
|
| Colors, radius, typography | shadcn/ui theme variables (`--primary`, `--radius`, etc.) |
|
|
435
|
-
| Spacing, density, padding | `--
|
|
512
|
+
| Spacing, density, padding | `--designkit-density`, `--designkit-page-padding-*`, `--designkit-panel-gap` |
|
|
436
513
|
| Per-page overrides | `className` or `theme` prop |
|
|
437
514
|
|
|
438
515
|
```css
|
|
439
516
|
:root {
|
|
440
|
-
--
|
|
441
|
-
--
|
|
442
|
-
--
|
|
443
|
-
--
|
|
517
|
+
--designkit-density: 1; /* 0.85 compact / 1 default / 1.15 comfortable */
|
|
518
|
+
--designkit-page-padding-x: 1.5rem;
|
|
519
|
+
--designkit-page-padding-y: 1rem;
|
|
520
|
+
--designkit-panel-gap: 1rem;
|
|
444
521
|
}
|
|
445
522
|
```
|
|
446
523
|
|
|
@@ -448,7 +525,7 @@ Per-page override via `className`:
|
|
|
448
525
|
|
|
449
526
|
```css
|
|
450
527
|
.layout-dashboard {
|
|
451
|
-
--
|
|
528
|
+
--designkit-density: 0.85;
|
|
452
529
|
}
|
|
453
530
|
```
|
|
454
531
|
|
|
@@ -460,13 +537,27 @@ Or via `theme` prop:
|
|
|
460
537
|
|
|
461
538
|
```tsx
|
|
462
539
|
<DataBodyTemplate
|
|
463
|
-
theme={{ '--
|
|
540
|
+
theme={{ '--designkit-density': '1.15' } as React.CSSProperties}
|
|
464
541
|
title="Settings"
|
|
465
542
|
>
|
|
466
543
|
```
|
|
467
544
|
|
|
468
545
|
---
|
|
469
546
|
|
|
547
|
+
## Using with gridkit
|
|
548
|
+
|
|
549
|
+
If your app also uses `@loykin/gridkit`, import its styles **after** designkit:
|
|
550
|
+
|
|
551
|
+
```css
|
|
552
|
+
@import "tailwindcss";
|
|
553
|
+
@import "@loykin/designkit/styles";
|
|
554
|
+
@import "@loykin/gridkit/styles"; /* must come last — uses @layer gridkit */
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
gridkit registers a named `@layer gridkit`. Importing it before `tailwindcss` or `designkit/styles` causes layer ordering conflicts where utility overrides resolve incorrectly.
|
|
558
|
+
|
|
559
|
+
---
|
|
560
|
+
|
|
470
561
|
## Playground
|
|
471
562
|
|
|
472
563
|
Interactive development tool to preview templates and generate code.
|