nucleus-core-ts 0.9.18 → 0.9.23
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/dist/fe/components/DesignSystem/components/ComponentCanvas.d.ts +6 -0
- package/dist/fe/components/DesignSystem/components/ComponentCanvas.js +339 -0
- package/dist/fe/components/DesignSystem/components/ComponentSidebar.d.ts +6 -0
- package/dist/fe/components/DesignSystem/components/ComponentSidebar.js +110 -0
- package/dist/fe/components/DesignSystem/components/DesignSystemPage.d.ts +2 -0
- package/dist/fe/components/DesignSystem/components/DesignSystemPage.js +29 -0
- package/dist/fe/components/DesignSystem/components/PropsPanel.d.ts +6 -0
- package/dist/fe/components/DesignSystem/components/PropsPanel.js +175 -0
- package/dist/fe/components/DesignSystem/index.d.ts +9 -0
- package/dist/fe/components/DesignSystem/index.js +7 -0
- package/dist/fe/components/DesignSystem/registry/defaultRegistry.d.ts +2 -0
- package/dist/fe/components/DesignSystem/registry/defaultRegistry.js +1237 -0
- package/dist/fe/components/DesignSystem/registry/index.d.ts +1 -0
- package/dist/fe/components/DesignSystem/registry/index.js +1 -0
- package/dist/fe/components/DesignSystem/store/index.d.ts +29 -0
- package/dist/fe/components/DesignSystem/store/index.js +59 -0
- package/dist/fe/components/DesignSystem/theme/index.d.ts +70 -0
- package/dist/fe/components/DesignSystem/theme/index.js +94 -0
- package/dist/fe/components/DesignSystem/types/index.d.ts +63 -0
- package/dist/fe/components/DesignSystem/types/index.js +1 -0
- package/dist/fe/index.d.ts +2 -0
- package/dist/fe/index.js +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/src/Services/Email/index.d.ts +2 -2
- package/dist/src/Services/Gmail/index.d.ts +1 -1
- package/package.json +1 -1
- package/public/components/Nav.tsx +86 -102
- package/public/components/docs/docsData.ts +7 -7
- package/public/styles.css +488 -512
- package/schemas/config.nucleus.json +26 -116
- package/schemas/nucleus.tables.schema.json +1 -3
- package/schemas/table.schema.json +20 -109
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../../../utils/cn";
|
|
4
|
+
import { useDesignSystemStore } from "../store";
|
|
5
|
+
import { designSystemTheme } from "../theme";
|
|
6
|
+
const VIEWPORT_WIDTHS = {
|
|
7
|
+
"mobile-sm": "max-w-[320px]",
|
|
8
|
+
"mobile-lg": "max-w-[428px]",
|
|
9
|
+
"tablet-sm": "max-w-[768px]",
|
|
10
|
+
"tablet-lg": "max-w-[1024px]",
|
|
11
|
+
"desktop-sm": "max-w-[1280px]",
|
|
12
|
+
"desktop-lg": "max-w-full"
|
|
13
|
+
};
|
|
14
|
+
const VIEWPORT_LABELS = {
|
|
15
|
+
"mobile-sm": "320px",
|
|
16
|
+
"mobile-lg": "428px",
|
|
17
|
+
"tablet-sm": "768px",
|
|
18
|
+
"tablet-lg": "1024px",
|
|
19
|
+
"desktop-sm": "1280px",
|
|
20
|
+
"desktop-lg": "Full"
|
|
21
|
+
};
|
|
22
|
+
const VIEWPORT_OPTIONS = [
|
|
23
|
+
"mobile-sm",
|
|
24
|
+
"mobile-lg",
|
|
25
|
+
"tablet-sm",
|
|
26
|
+
"tablet-lg",
|
|
27
|
+
"desktop-sm",
|
|
28
|
+
"desktop-lg"
|
|
29
|
+
];
|
|
30
|
+
const VIEWPORT_ICONS = {
|
|
31
|
+
mobile: "M7 2h10a2 2 0 012 2v16a2 2 0 01-2 2H7a2 2 0 01-2-2V4a2 2 0 012-2zm5 16h.01",
|
|
32
|
+
tablet: "M6 2h12a2 2 0 012 2v16a2 2 0 01-2 2H6a2 2 0 01-2-2V4a2 2 0 012-2zm6 16h.01",
|
|
33
|
+
desktop: "M4 3h16a2 2 0 012 2v10a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2zm4 18h8m-4-4v4"
|
|
34
|
+
};
|
|
35
|
+
export function ComponentCanvas({ registry }) {
|
|
36
|
+
const store = useDesignSystemStore();
|
|
37
|
+
const t = designSystemTheme.canvas;
|
|
38
|
+
const activeEntry = registry.find((e)=>e.id === store.activeComponentId);
|
|
39
|
+
const resolvedProps = {};
|
|
40
|
+
if (activeEntry) {
|
|
41
|
+
for (const prop of activeEntry.props){
|
|
42
|
+
const storeVal = store.propValues[prop.name];
|
|
43
|
+
resolvedProps[prop.name] = storeVal !== undefined && storeVal !== null ? storeVal : prop.defaultValue ?? null;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const isDark = store.themeMode === "dark";
|
|
47
|
+
return /*#__PURE__*/ _jsxs("main", {
|
|
48
|
+
className: t.container,
|
|
49
|
+
children: [
|
|
50
|
+
/*#__PURE__*/ _jsxs("header", {
|
|
51
|
+
className: t.toolbar,
|
|
52
|
+
children: [
|
|
53
|
+
/*#__PURE__*/ _jsx("button", {
|
|
54
|
+
type: "button",
|
|
55
|
+
className: "p-2 lg:hidden rounded-md text-slate-500 hover:bg-slate-100 dark:hover:bg-slate-800",
|
|
56
|
+
onClick: ()=>store.toggleSidebar(),
|
|
57
|
+
"aria-label": "Toggle sidebar",
|
|
58
|
+
children: /*#__PURE__*/ _jsx("svg", {
|
|
59
|
+
width: "18",
|
|
60
|
+
height: "18",
|
|
61
|
+
viewBox: "0 0 24 24",
|
|
62
|
+
fill: "none",
|
|
63
|
+
stroke: "currentColor",
|
|
64
|
+
strokeWidth: "2",
|
|
65
|
+
"aria-hidden": "true",
|
|
66
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
67
|
+
d: "M3 12h18M3 6h18M3 18h18"
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
}),
|
|
71
|
+
VIEWPORT_OPTIONS.map((vp)=>{
|
|
72
|
+
const deviceType = vp.split("-")[0] ?? "";
|
|
73
|
+
const sizeLabel = vp.split("-")[1]?.toUpperCase() ?? "";
|
|
74
|
+
return /*#__PURE__*/ _jsx("button", {
|
|
75
|
+
type: "button",
|
|
76
|
+
onClick: ()=>store.setViewportSize(vp),
|
|
77
|
+
className: store.viewportSize === vp ? t.toolbarButtonActive : t.toolbarButton,
|
|
78
|
+
title: `${VIEWPORT_LABELS[vp]} — ${deviceType} ${sizeLabel}`,
|
|
79
|
+
children: /*#__PURE__*/ _jsx("svg", {
|
|
80
|
+
width: "14",
|
|
81
|
+
height: "14",
|
|
82
|
+
viewBox: "0 0 24 24",
|
|
83
|
+
fill: "none",
|
|
84
|
+
stroke: "currentColor",
|
|
85
|
+
strokeWidth: "2",
|
|
86
|
+
className: "inline",
|
|
87
|
+
"aria-hidden": "true",
|
|
88
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
89
|
+
d: VIEWPORT_ICONS[deviceType] ?? ""
|
|
90
|
+
})
|
|
91
|
+
})
|
|
92
|
+
}, vp);
|
|
93
|
+
}),
|
|
94
|
+
/*#__PURE__*/ _jsx("span", {
|
|
95
|
+
className: t.toolbarDivider,
|
|
96
|
+
"aria-hidden": "true"
|
|
97
|
+
}),
|
|
98
|
+
/*#__PURE__*/ _jsx("button", {
|
|
99
|
+
type: "button",
|
|
100
|
+
onClick: ()=>store.setThemeMode("light"),
|
|
101
|
+
className: store.themeMode === "light" ? t.toolbarButtonActive : t.toolbarButton,
|
|
102
|
+
title: "Light mode",
|
|
103
|
+
children: /*#__PURE__*/ _jsxs("svg", {
|
|
104
|
+
width: "14",
|
|
105
|
+
height: "14",
|
|
106
|
+
viewBox: "0 0 24 24",
|
|
107
|
+
fill: "none",
|
|
108
|
+
stroke: "currentColor",
|
|
109
|
+
strokeWidth: "2",
|
|
110
|
+
"aria-hidden": "true",
|
|
111
|
+
children: [
|
|
112
|
+
/*#__PURE__*/ _jsx("circle", {
|
|
113
|
+
cx: "12",
|
|
114
|
+
cy: "12",
|
|
115
|
+
r: "5"
|
|
116
|
+
}),
|
|
117
|
+
/*#__PURE__*/ _jsx("path", {
|
|
118
|
+
d: "M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"
|
|
119
|
+
})
|
|
120
|
+
]
|
|
121
|
+
})
|
|
122
|
+
}),
|
|
123
|
+
/*#__PURE__*/ _jsx("button", {
|
|
124
|
+
type: "button",
|
|
125
|
+
onClick: ()=>store.setThemeMode("dark"),
|
|
126
|
+
className: store.themeMode === "dark" ? t.toolbarButtonActive : t.toolbarButton,
|
|
127
|
+
title: "Dark mode",
|
|
128
|
+
children: /*#__PURE__*/ _jsx("svg", {
|
|
129
|
+
width: "14",
|
|
130
|
+
height: "14",
|
|
131
|
+
viewBox: "0 0 24 24",
|
|
132
|
+
fill: "none",
|
|
133
|
+
stroke: "currentColor",
|
|
134
|
+
strokeWidth: "2",
|
|
135
|
+
"aria-hidden": "true",
|
|
136
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
137
|
+
d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"
|
|
138
|
+
})
|
|
139
|
+
})
|
|
140
|
+
}),
|
|
141
|
+
/*#__PURE__*/ _jsx("span", {
|
|
142
|
+
className: t.toolbarDivider,
|
|
143
|
+
"aria-hidden": "true"
|
|
144
|
+
}),
|
|
145
|
+
/*#__PURE__*/ _jsx("button", {
|
|
146
|
+
type: "button",
|
|
147
|
+
onClick: ()=>store.togglePropsPanel(),
|
|
148
|
+
className: store.propsPanelOpen ? t.toolbarButtonActive : t.toolbarButton,
|
|
149
|
+
title: "Toggle props panel",
|
|
150
|
+
children: /*#__PURE__*/ _jsxs("svg", {
|
|
151
|
+
width: "14",
|
|
152
|
+
height: "14",
|
|
153
|
+
viewBox: "0 0 24 24",
|
|
154
|
+
fill: "none",
|
|
155
|
+
stroke: "currentColor",
|
|
156
|
+
strokeWidth: "2",
|
|
157
|
+
"aria-hidden": "true",
|
|
158
|
+
children: [
|
|
159
|
+
/*#__PURE__*/ _jsx("path", {
|
|
160
|
+
d: "M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"
|
|
161
|
+
}),
|
|
162
|
+
/*#__PURE__*/ _jsx("circle", {
|
|
163
|
+
cx: "12",
|
|
164
|
+
cy: "12",
|
|
165
|
+
r: "3"
|
|
166
|
+
})
|
|
167
|
+
]
|
|
168
|
+
})
|
|
169
|
+
}),
|
|
170
|
+
activeEntry && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
171
|
+
children: [
|
|
172
|
+
/*#__PURE__*/ _jsx("span", {
|
|
173
|
+
className: t.toolbarDivider,
|
|
174
|
+
"aria-hidden": "true"
|
|
175
|
+
}),
|
|
176
|
+
/*#__PURE__*/ _jsx("span", {
|
|
177
|
+
className: "text-xs font-semibold text-slate-900 dark:text-slate-100",
|
|
178
|
+
children: activeEntry.name
|
|
179
|
+
}),
|
|
180
|
+
/*#__PURE__*/ _jsx("span", {
|
|
181
|
+
className: "text-[11px] text-slate-400 dark:text-slate-500 font-mono",
|
|
182
|
+
children: VIEWPORT_LABELS[store.viewportSize]
|
|
183
|
+
})
|
|
184
|
+
]
|
|
185
|
+
})
|
|
186
|
+
]
|
|
187
|
+
}),
|
|
188
|
+
/*#__PURE__*/ _jsx("section", {
|
|
189
|
+
className: cn(t.viewportFrame, isDark ? "bg-slate-950" : "bg-slate-100/70"),
|
|
190
|
+
style: !isDark ? {
|
|
191
|
+
backgroundImage: "radial-gradient(circle, #e2e8f0 1px, transparent 1px)",
|
|
192
|
+
backgroundSize: "20px 20px"
|
|
193
|
+
} : {
|
|
194
|
+
backgroundImage: "radial-gradient(circle, #1e293b 1px, transparent 1px)",
|
|
195
|
+
backgroundSize: "20px 20px"
|
|
196
|
+
},
|
|
197
|
+
children: activeEntry ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
198
|
+
children: [
|
|
199
|
+
/*#__PURE__*/ _jsx("article", {
|
|
200
|
+
className: cn(t.componentWrapper, VIEWPORT_WIDTHS[store.viewportSize], isDark ? "bg-slate-900 border-slate-800" : "bg-white border-slate-200"),
|
|
201
|
+
children: /*#__PURE__*/ _jsx("section", {
|
|
202
|
+
className: isDark ? "dark" : "",
|
|
203
|
+
children: /*#__PURE__*/ _jsx("section", {
|
|
204
|
+
className: cn("rounded-lg", isDark ? "bg-slate-900 text-white" : "bg-white text-slate-900"),
|
|
205
|
+
children: activeEntry.render(resolvedProps)
|
|
206
|
+
})
|
|
207
|
+
})
|
|
208
|
+
}),
|
|
209
|
+
/*#__PURE__*/ _jsx(PropDocTable, {
|
|
210
|
+
entry: activeEntry,
|
|
211
|
+
isDark: isDark
|
|
212
|
+
})
|
|
213
|
+
]
|
|
214
|
+
}) : /*#__PURE__*/ _jsxs("article", {
|
|
215
|
+
className: t.emptyState,
|
|
216
|
+
children: [
|
|
217
|
+
/*#__PURE__*/ _jsxs("svg", {
|
|
218
|
+
className: t.emptyIcon,
|
|
219
|
+
viewBox: "0 0 24 24",
|
|
220
|
+
fill: "none",
|
|
221
|
+
stroke: "currentColor",
|
|
222
|
+
strokeWidth: "1.5",
|
|
223
|
+
"aria-hidden": "true",
|
|
224
|
+
children: [
|
|
225
|
+
/*#__PURE__*/ _jsx("rect", {
|
|
226
|
+
x: "3",
|
|
227
|
+
y: "3",
|
|
228
|
+
width: "18",
|
|
229
|
+
height: "18",
|
|
230
|
+
rx: "2",
|
|
231
|
+
ry: "2"
|
|
232
|
+
}),
|
|
233
|
+
/*#__PURE__*/ _jsx("path", {
|
|
234
|
+
d: "M3 9h18M9 21V9"
|
|
235
|
+
})
|
|
236
|
+
]
|
|
237
|
+
}),
|
|
238
|
+
/*#__PURE__*/ _jsx("p", {
|
|
239
|
+
className: t.emptyText,
|
|
240
|
+
children: "Select a component from the sidebar to preview"
|
|
241
|
+
})
|
|
242
|
+
]
|
|
243
|
+
})
|
|
244
|
+
})
|
|
245
|
+
]
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
function PropDocTable({ entry, isDark }) {
|
|
249
|
+
const t = designSystemTheme.propTable;
|
|
250
|
+
const borderColor = isDark ? "border-slate-800" : "border-slate-200";
|
|
251
|
+
const headerBg = isDark ? "bg-slate-800/80" : "bg-slate-50";
|
|
252
|
+
const headerText = isDark ? "text-slate-400" : "text-slate-500";
|
|
253
|
+
const rowHover = isDark ? "hover:bg-slate-800/40" : "hover:bg-slate-50";
|
|
254
|
+
const nameColor = isDark ? "text-sky-400" : "text-slate-900";
|
|
255
|
+
const typeColor = isDark ? "text-emerald-400" : "text-violet-700";
|
|
256
|
+
const defaultColor = isDark ? "text-slate-400" : "text-slate-500";
|
|
257
|
+
const descColor = isDark ? "text-slate-300" : "text-slate-600";
|
|
258
|
+
const tableBg = isDark ? "bg-slate-900" : "bg-white";
|
|
259
|
+
return /*#__PURE__*/ _jsxs("section", {
|
|
260
|
+
className: cn(t.container, borderColor, tableBg),
|
|
261
|
+
children: [
|
|
262
|
+
/*#__PURE__*/ _jsxs("header", {
|
|
263
|
+
className: cn("px-5 py-4 border-b", borderColor),
|
|
264
|
+
children: [
|
|
265
|
+
/*#__PURE__*/ _jsx("h3", {
|
|
266
|
+
className: cn("text-sm font-bold tracking-tight", isDark ? "text-slate-100" : "text-slate-900"),
|
|
267
|
+
children: "Props Reference"
|
|
268
|
+
}),
|
|
269
|
+
/*#__PURE__*/ _jsx("p", {
|
|
270
|
+
className: cn("mt-1 text-xs font-mono", isDark ? "text-slate-500" : "text-slate-400"),
|
|
271
|
+
children: entry.importPath
|
|
272
|
+
})
|
|
273
|
+
]
|
|
274
|
+
}),
|
|
275
|
+
/*#__PURE__*/ _jsxs("table", {
|
|
276
|
+
className: "w-full text-left",
|
|
277
|
+
children: [
|
|
278
|
+
/*#__PURE__*/ _jsx("thead", {
|
|
279
|
+
children: /*#__PURE__*/ _jsxs("tr", {
|
|
280
|
+
className: headerBg,
|
|
281
|
+
children: [
|
|
282
|
+
/*#__PURE__*/ _jsx("th", {
|
|
283
|
+
className: cn(t.headerCell, headerText),
|
|
284
|
+
children: "Prop"
|
|
285
|
+
}),
|
|
286
|
+
/*#__PURE__*/ _jsx("th", {
|
|
287
|
+
className: cn(t.headerCell, headerText),
|
|
288
|
+
children: "Type"
|
|
289
|
+
}),
|
|
290
|
+
/*#__PURE__*/ _jsx("th", {
|
|
291
|
+
className: cn(t.headerCell, headerText),
|
|
292
|
+
children: "Default"
|
|
293
|
+
}),
|
|
294
|
+
/*#__PURE__*/ _jsx("th", {
|
|
295
|
+
className: cn(t.headerCell, headerText),
|
|
296
|
+
children: "Required"
|
|
297
|
+
}),
|
|
298
|
+
/*#__PURE__*/ _jsx("th", {
|
|
299
|
+
className: cn(t.headerCell, headerText),
|
|
300
|
+
children: "Description"
|
|
301
|
+
})
|
|
302
|
+
]
|
|
303
|
+
})
|
|
304
|
+
}),
|
|
305
|
+
/*#__PURE__*/ _jsx("tbody", {
|
|
306
|
+
children: entry.props.map((prop)=>/*#__PURE__*/ _jsxs("tr", {
|
|
307
|
+
className: cn(t.row, borderColor, rowHover),
|
|
308
|
+
children: [
|
|
309
|
+
/*#__PURE__*/ _jsx("td", {
|
|
310
|
+
className: cn(t.cell, t.propName, nameColor),
|
|
311
|
+
children: prop.name
|
|
312
|
+
}),
|
|
313
|
+
/*#__PURE__*/ _jsx("td", {
|
|
314
|
+
className: cn(t.cell, t.propType, typeColor),
|
|
315
|
+
children: prop.type === "select" && prop.options ? prop.options.map((o)=>`'${o.value}'`).join(" | ") : prop.type === "boolean" ? "boolean" : prop.type === "number" ? "number" : "string"
|
|
316
|
+
}),
|
|
317
|
+
/*#__PURE__*/ _jsx("td", {
|
|
318
|
+
className: cn(t.cell, t.propDefault, defaultColor),
|
|
319
|
+
children: prop.defaultValue === null ? "—" : typeof prop.defaultValue === "boolean" ? String(prop.defaultValue) : typeof prop.defaultValue === "string" ? `"${prop.defaultValue}"` : String(prop.defaultValue)
|
|
320
|
+
}),
|
|
321
|
+
/*#__PURE__*/ _jsx("td", {
|
|
322
|
+
className: t.cell,
|
|
323
|
+
children: prop.required && /*#__PURE__*/ _jsx("span", {
|
|
324
|
+
className: t.propRequired,
|
|
325
|
+
children: "Required"
|
|
326
|
+
})
|
|
327
|
+
}),
|
|
328
|
+
/*#__PURE__*/ _jsx("td", {
|
|
329
|
+
className: cn(t.cell, t.propDescription, descColor),
|
|
330
|
+
children: prop.description
|
|
331
|
+
})
|
|
332
|
+
]
|
|
333
|
+
}, prop.name))
|
|
334
|
+
})
|
|
335
|
+
]
|
|
336
|
+
})
|
|
337
|
+
]
|
|
338
|
+
});
|
|
339
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from '../../../utils/cn';
|
|
4
|
+
import { useDesignSystemStore } from '../store';
|
|
5
|
+
import { designSystemTheme } from '../theme';
|
|
6
|
+
const CATEGORY_LABELS = {
|
|
7
|
+
all: 'All',
|
|
8
|
+
inputs: 'Inputs',
|
|
9
|
+
display: 'Display',
|
|
10
|
+
feedback: 'Feedback',
|
|
11
|
+
navigation: 'Navigation',
|
|
12
|
+
layout: 'Layout',
|
|
13
|
+
data: 'Data'
|
|
14
|
+
};
|
|
15
|
+
const CATEGORY_ORDER = [
|
|
16
|
+
'all',
|
|
17
|
+
'inputs',
|
|
18
|
+
'data',
|
|
19
|
+
'display',
|
|
20
|
+
'feedback',
|
|
21
|
+
'navigation',
|
|
22
|
+
'layout'
|
|
23
|
+
];
|
|
24
|
+
export function ComponentSidebar({ registry }) {
|
|
25
|
+
const store = useDesignSystemStore();
|
|
26
|
+
const t = designSystemTheme.sidebar;
|
|
27
|
+
const filteredComponents = registry.filter((entry)=>{
|
|
28
|
+
const matchesCategory = store.activeCategory === 'all' || entry.category === store.activeCategory;
|
|
29
|
+
const matchesSearch = !store.searchQuery || entry.name.toLowerCase().includes(store.searchQuery.toLowerCase()) || entry.description.toLowerCase().includes(store.searchQuery.toLowerCase());
|
|
30
|
+
return matchesCategory && matchesSearch;
|
|
31
|
+
});
|
|
32
|
+
const categoriesWithCount = CATEGORY_ORDER.filter((cat)=>{
|
|
33
|
+
if (cat === 'all') return true;
|
|
34
|
+
return registry.some((e)=>e.category === cat);
|
|
35
|
+
});
|
|
36
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
37
|
+
children: [
|
|
38
|
+
store.sidebarOpen && /*#__PURE__*/ _jsx("section", {
|
|
39
|
+
className: t.overlay,
|
|
40
|
+
onClick: ()=>store.toggleSidebar(),
|
|
41
|
+
"aria-hidden": "true"
|
|
42
|
+
}),
|
|
43
|
+
/*#__PURE__*/ _jsxs("nav", {
|
|
44
|
+
className: cn(t.container, 'fixed lg:relative z-50 lg:z-auto transition-transform duration-300', store.sidebarOpen ? 'translate-x-0' : '-translate-x-full lg:translate-x-0'),
|
|
45
|
+
children: [
|
|
46
|
+
/*#__PURE__*/ _jsxs("header", {
|
|
47
|
+
className: t.header,
|
|
48
|
+
children: [
|
|
49
|
+
/*#__PURE__*/ _jsx("h1", {
|
|
50
|
+
className: t.title,
|
|
51
|
+
children: "Design System"
|
|
52
|
+
}),
|
|
53
|
+
/*#__PURE__*/ _jsxs("p", {
|
|
54
|
+
className: "mt-0.5 text-xs text-zinc-500 dark:text-zinc-400",
|
|
55
|
+
children: [
|
|
56
|
+
registry.length,
|
|
57
|
+
" components"
|
|
58
|
+
]
|
|
59
|
+
}),
|
|
60
|
+
/*#__PURE__*/ _jsx("input", {
|
|
61
|
+
type: "text",
|
|
62
|
+
placeholder: "Search components...",
|
|
63
|
+
value: store.searchQuery,
|
|
64
|
+
onChange: (e)=>store.setSearchQuery(e.target.value),
|
|
65
|
+
className: t.searchInput
|
|
66
|
+
}),
|
|
67
|
+
/*#__PURE__*/ _jsx("nav", {
|
|
68
|
+
className: "flex flex-wrap gap-1 mt-3",
|
|
69
|
+
"aria-label": "Categories",
|
|
70
|
+
children: categoriesWithCount.map((cat)=>/*#__PURE__*/ _jsx("button", {
|
|
71
|
+
type: "button",
|
|
72
|
+
onClick: ()=>store.setActiveCategory(cat),
|
|
73
|
+
className: store.activeCategory === cat ? t.categoryButtonActive : t.categoryButton,
|
|
74
|
+
children: CATEGORY_LABELS[cat]
|
|
75
|
+
}, cat))
|
|
76
|
+
})
|
|
77
|
+
]
|
|
78
|
+
}),
|
|
79
|
+
/*#__PURE__*/ _jsxs("section", {
|
|
80
|
+
className: "flex-1 py-2",
|
|
81
|
+
children: [
|
|
82
|
+
filteredComponents.map((entry)=>/*#__PURE__*/ _jsx("button", {
|
|
83
|
+
type: "button",
|
|
84
|
+
onClick: ()=>store.setActiveComponent(entry.id),
|
|
85
|
+
className: cn(t.componentItem, 'w-full text-left', store.activeComponentId === entry.id ? t.componentItemActive : t.componentItemHover),
|
|
86
|
+
children: /*#__PURE__*/ _jsxs("span", {
|
|
87
|
+
className: "flex flex-col min-w-0",
|
|
88
|
+
children: [
|
|
89
|
+
/*#__PURE__*/ _jsx("span", {
|
|
90
|
+
className: t.componentName,
|
|
91
|
+
children: entry.name
|
|
92
|
+
}),
|
|
93
|
+
/*#__PURE__*/ _jsx("span", {
|
|
94
|
+
className: t.componentCategory,
|
|
95
|
+
children: CATEGORY_LABELS[entry.category]
|
|
96
|
+
})
|
|
97
|
+
]
|
|
98
|
+
})
|
|
99
|
+
}, entry.id)),
|
|
100
|
+
filteredComponents.length === 0 && /*#__PURE__*/ _jsx("p", {
|
|
101
|
+
className: "px-4 py-8 text-center text-xs text-zinc-400 dark:text-zinc-500",
|
|
102
|
+
children: "No components found"
|
|
103
|
+
})
|
|
104
|
+
]
|
|
105
|
+
})
|
|
106
|
+
]
|
|
107
|
+
})
|
|
108
|
+
]
|
|
109
|
+
});
|
|
110
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from '../../../utils/cn';
|
|
4
|
+
import { useDesignSystemStore } from '../store';
|
|
5
|
+
import { designSystemTheme } from '../theme';
|
|
6
|
+
import { ComponentCanvas } from './ComponentCanvas';
|
|
7
|
+
import { ComponentSidebar } from './ComponentSidebar';
|
|
8
|
+
import { PropsPanel } from './PropsPanel';
|
|
9
|
+
export function DesignSystemPage({ registry, className }) {
|
|
10
|
+
const store = useDesignSystemStore();
|
|
11
|
+
const t = designSystemTheme.layout;
|
|
12
|
+
return /*#__PURE__*/ _jsx("section", {
|
|
13
|
+
className: cn(t.container, className),
|
|
14
|
+
children: /*#__PURE__*/ _jsxs("section", {
|
|
15
|
+
className: t.wrapper,
|
|
16
|
+
children: [
|
|
17
|
+
/*#__PURE__*/ _jsx(ComponentSidebar, {
|
|
18
|
+
registry: registry
|
|
19
|
+
}),
|
|
20
|
+
/*#__PURE__*/ _jsx(ComponentCanvas, {
|
|
21
|
+
registry: registry
|
|
22
|
+
}),
|
|
23
|
+
store.propsPanelOpen && /*#__PURE__*/ _jsx(PropsPanel, {
|
|
24
|
+
registry: registry
|
|
25
|
+
})
|
|
26
|
+
]
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
}
|