@loykin/designkit 0.0.1-dev.7 → 0.0.2
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 +29 -16
- package/dist/index.cjs +25 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +58 -2
- package/dist/index.d.ts +58 -2
- package/dist/index.js +37 -17
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -2,8 +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,
|
|
6
|
-
|
|
5
|
+
For AI-assisted implementation in consuming applications, follow the published
|
|
6
|
+
compound-component contract below. The same rules are included in the package's
|
|
7
|
+
TypeScript declarations so editors and coding agents can discover them.
|
|
7
8
|
|
|
8
9
|
## Installation
|
|
9
10
|
|
|
@@ -59,6 +60,12 @@ export function UsersPage() {
|
|
|
59
60
|
|
|
60
61
|
General-purpose page shell. Accepts `.Body`, `.Tab`, and `.Section` child slots which determine the layout mode automatically.
|
|
61
62
|
|
|
63
|
+
> **Compound-component contract:** `DataBodyTemplate` is the required root.
|
|
64
|
+
> Never render `.Group`, `.Tab`, `.Section`, `.Body`, `.Summary`, `.Row`, or
|
|
65
|
+
> `.Field` without it. Choose one primary mode—direct content/groups, `Tab`,
|
|
66
|
+
> `Section`, or `Body`—and do not mix those modes in one root. Invalid standalone
|
|
67
|
+
> usage throws at render time.
|
|
68
|
+
|
|
62
69
|
```tsx
|
|
63
70
|
<DataBodyTemplate
|
|
64
71
|
topBar={<PageTopBar left="Admin / Users" />}
|
|
@@ -142,6 +149,8 @@ Groups content within a tab or section. The `layout` prop controls the visual st
|
|
|
142
149
|
| `inline` | Table-style rows (detail view) |
|
|
143
150
|
| `split` | Left list + right detail |
|
|
144
151
|
|
|
152
|
+
`layout` defaults to `stacked`; omit it when the stacked arrangement is intended.
|
|
153
|
+
|
|
145
154
|
| Prop | Type | Description |
|
|
146
155
|
|---|---|---|
|
|
147
156
|
| `layout` | `GroupLayout` | Visual structure — see table above |
|
|
@@ -153,16 +162,18 @@ Groups content within a tab or section. The `layout` prop controls the visual st
|
|
|
153
162
|
| `className` | `string` | Class applied to the group root element |
|
|
154
163
|
|
|
155
164
|
```tsx
|
|
156
|
-
<DataBodyTemplate
|
|
157
|
-
<DataBodyTemplate.
|
|
158
|
-
<DataBodyTemplate.
|
|
159
|
-
<
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
<
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
</DataBodyTemplate.
|
|
165
|
+
<DataBodyTemplate title="Settings">
|
|
166
|
+
<DataBodyTemplate.Tab id="settings" label="Settings">
|
|
167
|
+
<DataBodyTemplate.Group layout="horizontal" title="Identity" description="Basic information">
|
|
168
|
+
<DataBodyTemplate.Row label="Name" required>
|
|
169
|
+
<Input defaultValue="Sarah Kim" />
|
|
170
|
+
</DataBodyTemplate.Row>
|
|
171
|
+
<DataBodyTemplate.Row label="Email">
|
|
172
|
+
<Input type="email" defaultValue="sarah@acme.com" />
|
|
173
|
+
</DataBodyTemplate.Row>
|
|
174
|
+
</DataBodyTemplate.Group>
|
|
175
|
+
</DataBodyTemplate.Tab>
|
|
176
|
+
</DataBodyTemplate>
|
|
166
177
|
```
|
|
167
178
|
|
|
168
179
|
#### DataBodyTemplate.Field
|
|
@@ -170,10 +181,12 @@ Groups content within a tab or section. The `layout` prop controls the visual st
|
|
|
170
181
|
Read-only key-value display.
|
|
171
182
|
|
|
172
183
|
```tsx
|
|
173
|
-
<DataBodyTemplate
|
|
174
|
-
<DataBodyTemplate.
|
|
175
|
-
|
|
176
|
-
</DataBodyTemplate.
|
|
184
|
+
<DataBodyTemplate title="Profile">
|
|
185
|
+
<DataBodyTemplate.Group layout="inline" title="Identity">
|
|
186
|
+
<DataBodyTemplate.Field label="Email">sarah@acme.com</DataBodyTemplate.Field>
|
|
187
|
+
<DataBodyTemplate.Field label="Role"><Badge>Admin</Badge></DataBodyTemplate.Field>
|
|
188
|
+
</DataBodyTemplate.Group>
|
|
189
|
+
</DataBodyTemplate>
|
|
177
190
|
```
|
|
178
191
|
|
|
179
192
|
#### DataBodyTemplate.Summary
|
package/dist/index.cjs
CHANGED
|
@@ -1479,7 +1479,7 @@ function Sidebar({
|
|
|
1479
1479
|
/* @__PURE__ */ jsxRuntime.jsx(SheetTitle, { children: "Sidebar" }),
|
|
1480
1480
|
/* @__PURE__ */ jsxRuntime.jsx(SheetDescription, { children: "Displays the mobile sidebar." })
|
|
1481
1481
|
] }),
|
|
1482
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full w-full flex-col", children })
|
|
1482
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full min-h-0 w-full flex-col", children })
|
|
1483
1483
|
]
|
|
1484
1484
|
}
|
|
1485
1485
|
) });
|
|
@@ -2705,7 +2705,7 @@ function WorkbenchBodyTemplate({
|
|
|
2705
2705
|
)
|
|
2706
2706
|
] }),
|
|
2707
2707
|
/* @__PURE__ */ jsxRuntime.jsxs("main", { className: cn("flex min-w-0 flex-1 flex-col overflow-hidden", mainPaneClassName), children: [
|
|
2708
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-0 flex-1 overflow-
|
|
2708
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-0 flex-1 overflow-auto", children: mainPane ?? children }),
|
|
2709
2709
|
showBottomPane && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2710
2710
|
resizable && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2711
2711
|
ResizeHandle,
|
|
@@ -2786,19 +2786,30 @@ function WorkbenchBodyTemplate({
|
|
|
2786
2786
|
] })
|
|
2787
2787
|
] });
|
|
2788
2788
|
}
|
|
2789
|
+
var DataBodyTemplateContext = React2__namespace.default.createContext(false);
|
|
2790
|
+
function useDataBodyTemplateParent(component) {
|
|
2791
|
+
if (!React2__namespace.default.useContext(DataBodyTemplateContext)) {
|
|
2792
|
+
throw new Error(
|
|
2793
|
+
`[DesignKit] <DataBodyTemplate.${component}> must be rendered inside <DataBodyTemplate>. Wrap it like: <DataBodyTemplate><DataBodyTemplate.${component}>...</DataBodyTemplate.${component}></DataBodyTemplate>.`
|
|
2794
|
+
);
|
|
2795
|
+
}
|
|
2796
|
+
}
|
|
2789
2797
|
function DataBodyTab(_props) {
|
|
2798
|
+
useDataBodyTemplateParent("Tab");
|
|
2790
2799
|
return null;
|
|
2791
2800
|
}
|
|
2792
2801
|
function isDataBodyTab(node) {
|
|
2793
2802
|
return Boolean(node && typeof node === "object" && "type" in node && node.type === DataBodyTab);
|
|
2794
2803
|
}
|
|
2795
2804
|
function DataBodyBody(_props) {
|
|
2805
|
+
useDataBodyTemplateParent("Body");
|
|
2796
2806
|
return null;
|
|
2797
2807
|
}
|
|
2798
2808
|
function isDataBodyBody(node) {
|
|
2799
2809
|
return Boolean(node && typeof node === "object" && "type" in node && node.type === DataBodyBody);
|
|
2800
2810
|
}
|
|
2801
2811
|
function DataBodySection(_props) {
|
|
2812
|
+
useDataBodyTemplateParent("Section");
|
|
2802
2813
|
return null;
|
|
2803
2814
|
}
|
|
2804
2815
|
function isDataBodySection(node) {
|
|
@@ -2807,6 +2818,7 @@ function isDataBodySection(node) {
|
|
|
2807
2818
|
);
|
|
2808
2819
|
}
|
|
2809
2820
|
function DataBodySummary(_props) {
|
|
2821
|
+
useDataBodyTemplateParent("Summary");
|
|
2810
2822
|
return null;
|
|
2811
2823
|
}
|
|
2812
2824
|
function isDataBodySummary(node) {
|
|
@@ -2821,6 +2833,7 @@ var layoutDefaultVariant = {
|
|
|
2821
2833
|
split: "bordered"
|
|
2822
2834
|
};
|
|
2823
2835
|
function DataBodyGroup(props) {
|
|
2836
|
+
useDataBodyTemplateParent("Group");
|
|
2824
2837
|
return renderGroupProps(props);
|
|
2825
2838
|
}
|
|
2826
2839
|
function isDataBodyGroup(node) {
|
|
@@ -2918,6 +2931,7 @@ function renderGroupProps(props) {
|
|
|
2918
2931
|
] });
|
|
2919
2932
|
}
|
|
2920
2933
|
function DataBodyField({ label, description, children }) {
|
|
2934
|
+
useDataBodyTemplateParent("Field");
|
|
2921
2935
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2922
2936
|
"div",
|
|
2923
2937
|
{
|
|
@@ -2934,6 +2948,7 @@ function DataBodyField({ label, description, children }) {
|
|
|
2934
2948
|
);
|
|
2935
2949
|
}
|
|
2936
2950
|
function DataBodyRow({ label, description, required, children }) {
|
|
2951
|
+
useDataBodyTemplateParent("Row");
|
|
2937
2952
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2938
2953
|
"div",
|
|
2939
2954
|
{
|
|
@@ -2956,7 +2971,7 @@ function TopBarSlot({ topBar }) {
|
|
|
2956
2971
|
if (!topBar) return null;
|
|
2957
2972
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0", children: topBar });
|
|
2958
2973
|
}
|
|
2959
|
-
function
|
|
2974
|
+
function RootContent({
|
|
2960
2975
|
theme,
|
|
2961
2976
|
className,
|
|
2962
2977
|
topBar,
|
|
@@ -3066,6 +3081,9 @@ function Root2({
|
|
|
3066
3081
|
] })
|
|
3067
3082
|
] });
|
|
3068
3083
|
}
|
|
3084
|
+
function Root2(props) {
|
|
3085
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DataBodyTemplateContext.Provider, { value: true, children: /* @__PURE__ */ jsxRuntime.jsx(RootContent, { ...props }) });
|
|
3086
|
+
}
|
|
3069
3087
|
var DataBodyTemplate = Object.assign(Root2, {
|
|
3070
3088
|
Body: DataBodyBody,
|
|
3071
3089
|
Tab: DataBodyTab,
|
|
@@ -3143,7 +3161,7 @@ function BrowseBodyTemplate({
|
|
|
3143
3161
|
"div",
|
|
3144
3162
|
{
|
|
3145
3163
|
className: cn(
|
|
3146
|
-
"min-w-0 flex-1 overflow-
|
|
3164
|
+
"min-w-0 flex-1 overflow-auto px-(--designkit-page-padding-x) py-(--designkit-page-padding-y)",
|
|
3147
3165
|
"[&_.gridkit-shell]:h-full [&_.gridkit-table-stack]:flex-1 [&_.gridkit-table-stack]:min-h-0",
|
|
3148
3166
|
"[&_.gridkit-frame]:flex-1 [&_.gridkit-frame]:min-h-0 [&_.gridkit-frame]:overflow-auto",
|
|
3149
3167
|
contentClassName
|
|
@@ -3232,6 +3250,7 @@ function DetailBodyTemplateRoot({
|
|
|
3232
3250
|
aside,
|
|
3233
3251
|
summary,
|
|
3234
3252
|
stickyAside = true,
|
|
3253
|
+
layoutClassName,
|
|
3235
3254
|
contentClassName,
|
|
3236
3255
|
mediaClassName,
|
|
3237
3256
|
asideClassName,
|
|
@@ -3345,7 +3364,8 @@ function DetailBodyTemplateRoot({
|
|
|
3345
3364
|
{
|
|
3346
3365
|
className: cn(
|
|
3347
3366
|
"grid h-full min-h-0 grid-cols-1 overflow-hidden",
|
|
3348
|
-
outsideAsideSlot && "lg:grid-cols-[minmax(0,1fr)_minmax(18rem,24rem)]"
|
|
3367
|
+
outsideAsideSlot && "lg:grid-cols-[minmax(0,1fr)_minmax(18rem,24rem)]",
|
|
3368
|
+
layoutClassName
|
|
3349
3369
|
),
|
|
3350
3370
|
children: [
|
|
3351
3371
|
/* @__PURE__ */ jsxRuntime.jsx(
|