@btst/stack 4.0.0 → 4.1.0
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 +2 -2
- package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-input.cjs +112 -103
- package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-input.mjs +112 -103
- package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-interface.cjs +5 -2
- package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-interface.mjs +5 -2
- package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-layout.cjs +99 -88
- package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-layout.mjs +99 -88
- package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-message.cjs +12 -3
- package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-message.mjs +12 -3
- package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-sidebar.cjs +6 -2
- package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-sidebar.mjs +6 -2
- package/dist/packages/stack/src/plugins/blog/client/components/shared/page-wrapper.cjs +3 -2
- package/dist/packages/stack/src/plugins/blog/client/components/shared/page-wrapper.mjs +3 -2
- package/dist/packages/stack/src/plugins/blog/client/components/shared/post-card.cjs +81 -52
- package/dist/packages/stack/src/plugins/blog/client/components/shared/post-card.mjs +82 -53
- package/dist/packages/stack/src/plugins/blog/client/components/shared/posts-list.cjs +3 -2
- package/dist/packages/stack/src/plugins/blog/client/components/shared/posts-list.mjs +3 -2
- package/dist/packages/stack/src/plugins/cms/client/components/pages/content-list-page.internal.cjs +95 -75
- package/dist/packages/stack/src/plugins/cms/client/components/pages/content-list-page.internal.mjs +95 -75
- package/dist/packages/stack/src/plugins/cms/client/components/pages/dashboard-page.internal.cjs +16 -3
- package/dist/packages/stack/src/plugins/cms/client/components/pages/dashboard-page.internal.mjs +16 -3
- package/dist/packages/stack/src/plugins/cms/client/components/shared/page-wrapper.cjs +3 -2
- package/dist/packages/stack/src/plugins/cms/client/components/shared/page-wrapper.mjs +3 -2
- package/dist/packages/stack/src/plugins/cms/utils.cjs +6 -2
- package/dist/packages/stack/src/plugins/cms/utils.mjs +6 -3
- package/dist/packages/stack/src/plugins/form-builder/client/components/forms/form-renderer.cjs +14 -8
- package/dist/packages/stack/src/plugins/form-builder/client/components/forms/form-renderer.mjs +14 -8
- package/dist/packages/stack/src/plugins/form-builder/client/components/pages/form-list-page.internal.cjs +94 -87
- package/dist/packages/stack/src/plugins/form-builder/client/components/pages/form-list-page.internal.mjs +94 -87
- package/dist/packages/stack/src/plugins/form-builder/client/components/pages/submissions-page.internal.cjs +81 -74
- package/dist/packages/stack/src/plugins/form-builder/client/components/pages/submissions-page.internal.mjs +81 -74
- package/dist/packages/stack/src/plugins/form-builder/client/components/shared/page-wrapper.cjs +3 -2
- package/dist/packages/stack/src/plugins/form-builder/client/components/shared/page-wrapper.mjs +3 -2
- package/dist/packages/stack/src/plugins/form-builder/client/components/shared/pagination.cjs +25 -16
- package/dist/packages/stack/src/plugins/form-builder/client/components/shared/pagination.mjs +25 -16
- package/dist/packages/stack/src/plugins/form-builder/utils.cjs +6 -2
- package/dist/packages/stack/src/plugins/form-builder/utils.mjs +6 -3
- package/dist/plugins/ai-chat/client/components/index.d.cts +1 -1
- package/dist/plugins/ai-chat/client/components/index.d.mts +1 -1
- package/dist/plugins/ai-chat/client/components/index.d.ts +1 -1
- package/dist/plugins/ai-chat/client/index.d.cts +2 -2
- package/dist/plugins/ai-chat/client/index.d.mts +2 -2
- package/dist/plugins/ai-chat/client/index.d.ts +2 -2
- package/dist/plugins/blog/client/index.d.cts +18 -0
- package/dist/plugins/blog/client/index.d.mts +18 -0
- package/dist/plugins/blog/client/index.d.ts +18 -0
- package/dist/plugins/cms/client/index.d.cts +18 -0
- package/dist/plugins/cms/client/index.d.mts +18 -0
- package/dist/plugins/cms/client/index.d.ts +18 -0
- package/dist/plugins/form-builder/api/index.d.cts +1 -1
- package/dist/plugins/form-builder/api/index.d.mts +1 -1
- package/dist/plugins/form-builder/api/index.d.ts +1 -1
- package/dist/plugins/form-builder/client/hooks/index.d.cts +1 -1
- package/dist/plugins/form-builder/client/hooks/index.d.mts +1 -1
- package/dist/plugins/form-builder/client/hooks/index.d.ts +1 -1
- package/dist/plugins/form-builder/client/index.d.cts +16 -0
- package/dist/plugins/form-builder/client/index.d.mts +16 -0
- package/dist/plugins/form-builder/client/index.d.ts +16 -0
- package/dist/plugins/form-builder/query-keys.d.cts +1 -1
- package/dist/plugins/form-builder/query-keys.d.mts +1 -1
- package/dist/plugins/form-builder/query-keys.d.ts +1 -1
- package/dist/shared/{stack.5_zzCejP.d.cts → stack.rVF0f509.d.cts} +20 -0
- package/dist/shared/{stack.5_zzCejP.d.mts → stack.rVF0f509.d.mts} +20 -0
- package/dist/shared/{stack.5_zzCejP.d.ts → stack.rVF0f509.d.ts} +20 -0
- package/package.json +1 -1
- package/src/plugins/ai-chat/__tests__/classnames-overrides.test.tsx +248 -0
- package/src/plugins/ai-chat/client/components/chat-input.tsx +6 -1
- package/src/plugins/ai-chat/client/components/chat-interface.tsx +3 -0
- package/src/plugins/ai-chat/client/components/chat-layout.tsx +9 -2
- package/src/plugins/ai-chat/client/components/chat-message.tsx +13 -5
- package/src/plugins/ai-chat/client/components/chat-sidebar.tsx +6 -2
- package/src/plugins/ai-chat/client/overrides.ts +21 -0
- package/src/plugins/blog/__tests__/classnames-overrides.test.tsx +206 -0
- package/src/plugins/blog/client/components/shared/page-wrapper.tsx +3 -2
- package/src/plugins/blog/client/components/shared/post-card.tsx +32 -12
- package/src/plugins/blog/client/components/shared/posts-list.tsx +3 -2
- package/src/plugins/blog/client/overrides.ts +18 -0
- package/src/plugins/cms/__tests__/classnames-overrides.test.tsx +200 -0
- package/src/plugins/cms/client/components/pages/content-list-page.internal.tsx +17 -4
- package/src/plugins/cms/client/components/pages/dashboard-page.internal.tsx +14 -3
- package/src/plugins/cms/client/components/shared/page-wrapper.tsx +3 -2
- package/src/plugins/cms/client/overrides.ts +19 -0
- package/src/plugins/form-builder/__tests__/classnames-overrides.test.tsx +312 -0
- package/src/plugins/form-builder/client/components/forms/form-renderer.tsx +14 -9
- package/src/plugins/form-builder/client/components/pages/form-list-page.internal.tsx +9 -5
- package/src/plugins/form-builder/client/components/pages/submissions-page.internal.tsx +9 -5
- package/src/plugins/form-builder/client/components/shared/page-wrapper.tsx +3 -2
- package/src/plugins/form-builder/client/components/shared/pagination.tsx +7 -1
- package/src/plugins/form-builder/client/overrides.ts +17 -0
- package/dist/shared/{stack.BuxUQqL8.d.ts → stack.CGmh-Lpe.d.ts} +12 -12
- package/dist/shared/{stack.Egr3RWhA.d.mts → stack.Doy2_wgl.d.mts} +12 -12
- package/dist/shared/{stack.CX83YNuS.d.cts → stack.zch70Loj.d.cts} +12 -12
package/dist/packages/stack/src/plugins/cms/client/components/pages/content-list-page.internal.mjs
CHANGED
|
@@ -10,6 +10,7 @@ import { cmsPermissions } from '../../../../../../../../plugins/cms/permissions.
|
|
|
10
10
|
import { useListState } from '@btst/stack/client/hooks';
|
|
11
11
|
import { orderCMSContentTypes } from '../../overrides.mjs';
|
|
12
12
|
import { CMS_PLUGIN_ID } from '../../constants.mjs';
|
|
13
|
+
import { cn } from '../../../utils.mjs';
|
|
13
14
|
import { EmptyState } from '../shared/empty-state.mjs';
|
|
14
15
|
import { PageWrapper } from '../shared/page-wrapper.mjs';
|
|
15
16
|
import { useRouteLifecycle } from '../../../../../../../ui/src/hooks/use-route-lifecycle.mjs';
|
|
@@ -23,7 +24,7 @@ function ContentListPage({ typeSlug }) {
|
|
|
23
24
|
const t = useTranslate();
|
|
24
25
|
const notify = useNotify();
|
|
25
26
|
const overrides = usePluginOverrides(CMS_PLUGIN_ID);
|
|
26
|
-
const { localization } = overrides;
|
|
27
|
+
const { localization, classNames } = overrides;
|
|
27
28
|
const { router, plugins, basePath: stackBasePath } = useStack();
|
|
28
29
|
const navigate = router?.navigate;
|
|
29
30
|
const Link = router?.Link;
|
|
@@ -205,6 +206,7 @@ function ContentListPage({ typeSlug }) {
|
|
|
205
206
|
hasMore,
|
|
206
207
|
isLoadingMore,
|
|
207
208
|
localization,
|
|
209
|
+
classNames,
|
|
208
210
|
t
|
|
209
211
|
}
|
|
210
212
|
)
|
|
@@ -224,89 +226,107 @@ function ContentTable({
|
|
|
224
226
|
hasMore,
|
|
225
227
|
isLoadingMore,
|
|
226
228
|
localization,
|
|
229
|
+
classNames,
|
|
227
230
|
t
|
|
228
231
|
}) {
|
|
229
|
-
return /* @__PURE__ */ jsxs(
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
/* @__PURE__ */
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
children:
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
{
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}),
|
|
257
|
-
children: /* @__PURE__ */ jsx(
|
|
258
|
-
Button,
|
|
232
|
+
return /* @__PURE__ */ jsxs(
|
|
233
|
+
"div",
|
|
234
|
+
{
|
|
235
|
+
className: cn("border rounded-lg", classNames?.table),
|
|
236
|
+
"data-testid": "cms-content-table",
|
|
237
|
+
children: [
|
|
238
|
+
/* @__PURE__ */ jsxs(Table, { children: [
|
|
239
|
+
/* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsxs(TableRow, { children: [
|
|
240
|
+
/* @__PURE__ */ jsx(TableHead, { children: localization?.CMS_LIST_COLUMN_SLUG ?? t("cms.list.columnSlug", "Slug") }),
|
|
241
|
+
/* @__PURE__ */ jsx(TableHead, { children: localization?.CMS_LIST_COLUMN_CREATED ?? t("cms.list.columnCreated", "Created") }),
|
|
242
|
+
/* @__PURE__ */ jsx(TableHead, { children: localization?.CMS_LIST_COLUMN_UPDATED ?? t("cms.list.columnUpdated", "Updated") }),
|
|
243
|
+
/* @__PURE__ */ jsx(TableHead, { className: "w-[100px]", children: localization?.CMS_LIST_COLUMN_ACTIONS ?? t("cms.list.columnActions", "Actions") })
|
|
244
|
+
] }) }),
|
|
245
|
+
/* @__PURE__ */ jsx(TableBody, { children: items.map((item) => /* @__PURE__ */ jsxs(TableRow, { className: classNames?.tableRow, children: [
|
|
246
|
+
/* @__PURE__ */ jsx(TableCell, { className: "font-medium", children: /* @__PURE__ */ jsx(
|
|
247
|
+
LinkComponent,
|
|
248
|
+
{
|
|
249
|
+
href: joinBasePath(basePath, `/cms/${typeSlug}/${item.id}`),
|
|
250
|
+
className: "hover:underline",
|
|
251
|
+
children: item.slug
|
|
252
|
+
}
|
|
253
|
+
) }),
|
|
254
|
+
/* @__PURE__ */ jsx(TableCell, { children: formatDate(item.createdAt) }),
|
|
255
|
+
/* @__PURE__ */ jsx(TableCell, { children: formatDate(item.updatedAt) }),
|
|
256
|
+
/* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
257
|
+
/* @__PURE__ */ jsx(
|
|
258
|
+
PermissionAccess,
|
|
259
259
|
{
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
),
|
|
265
|
-
children: /* @__PURE__ */ jsx(
|
|
260
|
+
permission: cmsPermissions.record.update({
|
|
261
|
+
contentType: item.contentType?.slug ?? typeSlug,
|
|
262
|
+
recordId: item.id,
|
|
263
|
+
...item.authorId ? { authorId: item.authorId } : {}
|
|
264
|
+
}),
|
|
265
|
+
children: /* @__PURE__ */ jsx(
|
|
266
|
+
Button,
|
|
267
|
+
{
|
|
268
|
+
variant: "ghost",
|
|
269
|
+
size: "icon",
|
|
270
|
+
onClick: () => void navigate?.(
|
|
271
|
+
joinBasePath(basePath, `/cms/${typeSlug}/${item.id}`)
|
|
272
|
+
),
|
|
273
|
+
children: /* @__PURE__ */ jsx(Pencil, { className: "h-4 w-4" })
|
|
274
|
+
}
|
|
275
|
+
)
|
|
276
|
+
}
|
|
277
|
+
),
|
|
278
|
+
/* @__PURE__ */ jsx(
|
|
279
|
+
PermissionAccess,
|
|
280
|
+
{
|
|
281
|
+
permission: cmsPermissions.record.delete({
|
|
282
|
+
contentType: item.contentType?.slug ?? typeSlug,
|
|
283
|
+
recordId: item.id,
|
|
284
|
+
...item.authorId ? { authorId: item.authorId } : {}
|
|
285
|
+
}),
|
|
286
|
+
children: /* @__PURE__ */ jsx(
|
|
287
|
+
Button,
|
|
288
|
+
{
|
|
289
|
+
variant: "ghost",
|
|
290
|
+
size: "icon",
|
|
291
|
+
onClick: () => onDelete(item.id),
|
|
292
|
+
disabled: isDeleting,
|
|
293
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4 text-destructive" })
|
|
294
|
+
}
|
|
295
|
+
)
|
|
266
296
|
}
|
|
267
297
|
)
|
|
268
|
-
}
|
|
269
|
-
)
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
298
|
+
] }) })
|
|
299
|
+
] }, item.id)) })
|
|
300
|
+
] }),
|
|
301
|
+
/* @__PURE__ */ jsxs(
|
|
302
|
+
"div",
|
|
303
|
+
{
|
|
304
|
+
className: cn(
|
|
305
|
+
"flex items-center justify-between px-4 py-3 border-t",
|
|
306
|
+
classNames?.pagination
|
|
307
|
+
),
|
|
308
|
+
"data-testid": "cms-content-pagination",
|
|
309
|
+
children: [
|
|
310
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: (localization?.CMS_LIST_PAGINATION_SHOWING ?? t("cms.list.paginationShowing", "Showing {from}-{to} of {total}")).replace("{from}", "1").replace("{to}", String(items.length)).replace("{total}", String(total)) }),
|
|
311
|
+
hasMore && /* @__PURE__ */ jsxs(
|
|
279
312
|
Button,
|
|
280
313
|
{
|
|
281
|
-
variant: "
|
|
282
|
-
size: "
|
|
283
|
-
onClick: () =>
|
|
284
|
-
disabled:
|
|
285
|
-
children:
|
|
314
|
+
variant: "outline",
|
|
315
|
+
size: "sm",
|
|
316
|
+
onClick: () => loadMore(),
|
|
317
|
+
disabled: isLoadingMore,
|
|
318
|
+
children: [
|
|
319
|
+
isLoadingMore && /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
|
|
320
|
+
localization?.CMS_LIST_PAGINATION_NEXT ?? t("cms.list.paginationNext", "Next")
|
|
321
|
+
]
|
|
286
322
|
}
|
|
287
323
|
)
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
]
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: (localization?.CMS_LIST_PAGINATION_SHOWING ?? t("cms.list.paginationShowing", "Showing {from}-{to} of {total}")).replace("{from}", "1").replace("{to}", String(items.length)).replace("{total}", String(total)) }),
|
|
295
|
-
hasMore && /* @__PURE__ */ jsxs(
|
|
296
|
-
Button,
|
|
297
|
-
{
|
|
298
|
-
variant: "outline",
|
|
299
|
-
size: "sm",
|
|
300
|
-
onClick: () => loadMore(),
|
|
301
|
-
disabled: isLoadingMore,
|
|
302
|
-
children: [
|
|
303
|
-
isLoadingMore && /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
|
|
304
|
-
localization?.CMS_LIST_PAGINATION_NEXT ?? t("cms.list.paginationNext", "Next")
|
|
305
|
-
]
|
|
306
|
-
}
|
|
307
|
-
)
|
|
308
|
-
] })
|
|
309
|
-
] });
|
|
324
|
+
]
|
|
325
|
+
}
|
|
326
|
+
)
|
|
327
|
+
]
|
|
328
|
+
}
|
|
329
|
+
);
|
|
310
330
|
}
|
|
311
331
|
|
|
312
332
|
export { ContentListPage };
|
package/dist/packages/stack/src/plugins/cms/client/components/pages/dashboard-page.internal.cjs
CHANGED
|
@@ -10,12 +10,13 @@ const constants = require('../../constants.cjs');
|
|
|
10
10
|
const emptyState = require('../shared/empty-state.cjs');
|
|
11
11
|
const pageWrapper = require('../shared/page-wrapper.cjs');
|
|
12
12
|
const useRouteLifecycle = require('../../../../../../../ui/src/hooks/use-route-lifecycle.cjs');
|
|
13
|
+
const utils = require('../../../utils.cjs');
|
|
13
14
|
const cmsHooks = require('../../hooks/cms-hooks.cjs');
|
|
14
15
|
|
|
15
16
|
function DashboardPage() {
|
|
16
17
|
const t = context.useTranslate();
|
|
17
18
|
const overrides$1 = context.usePluginOverrides(constants.CMS_PLUGIN_ID);
|
|
18
|
-
const { localization } = overrides$1;
|
|
19
|
+
const { localization, classNames } = overrides$1;
|
|
19
20
|
const { router, plugins, basePath: stackBasePath } = context.useStack();
|
|
20
21
|
const navigate = router?.navigate;
|
|
21
22
|
const basePath = plugins?.[constants.CMS_PLUGIN_ID]?.site.basePath ?? stackBasePath;
|
|
@@ -67,11 +68,23 @@ function DashboardPage() {
|
|
|
67
68
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-4 md:grid-cols-2 lg:grid-cols-3", children: contentTypes.map((ct) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
68
69
|
card.Card,
|
|
69
70
|
{
|
|
70
|
-
className:
|
|
71
|
+
className: utils.cn(
|
|
72
|
+
"hover:border-primary/50 transition-colors cursor-pointer",
|
|
73
|
+
classNames?.contentTypeCard
|
|
74
|
+
),
|
|
71
75
|
onClick: () => void navigate?.(context.joinBasePath(basePath, `/cms/${ct.slug}`)),
|
|
72
76
|
children: [
|
|
73
77
|
/* @__PURE__ */ jsxRuntime.jsxs(card.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
74
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
78
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
79
|
+
card.CardTitle,
|
|
80
|
+
{
|
|
81
|
+
className: utils.cn(
|
|
82
|
+
"text-lg font-medium",
|
|
83
|
+
classNames?.contentTypeTitle
|
|
84
|
+
),
|
|
85
|
+
children: ct.name
|
|
86
|
+
}
|
|
87
|
+
),
|
|
75
88
|
/* @__PURE__ */ jsxRuntime.jsx(LucideIcons.FileText, { className: "h-5 w-5 text-muted-foreground" })
|
|
76
89
|
] }),
|
|
77
90
|
/* @__PURE__ */ jsxRuntime.jsxs(card.CardContent, { children: [
|
package/dist/packages/stack/src/plugins/cms/client/components/pages/dashboard-page.internal.mjs
CHANGED
|
@@ -8,12 +8,13 @@ import { CMS_PLUGIN_ID } from '../../constants.mjs';
|
|
|
8
8
|
import { EmptyState } from '../shared/empty-state.mjs';
|
|
9
9
|
import { PageWrapper } from '../shared/page-wrapper.mjs';
|
|
10
10
|
import { useRouteLifecycle } from '../../../../../../../ui/src/hooks/use-route-lifecycle.mjs';
|
|
11
|
+
import { cn } from '../../../utils.mjs';
|
|
11
12
|
import { useSuspenseContentTypes } from '../../hooks/cms-hooks.mjs';
|
|
12
13
|
|
|
13
14
|
function DashboardPage() {
|
|
14
15
|
const t = useTranslate();
|
|
15
16
|
const overrides = usePluginOverrides(CMS_PLUGIN_ID);
|
|
16
|
-
const { localization } = overrides;
|
|
17
|
+
const { localization, classNames } = overrides;
|
|
17
18
|
const { router, plugins, basePath: stackBasePath } = useStack();
|
|
18
19
|
const navigate = router?.navigate;
|
|
19
20
|
const basePath = plugins?.[CMS_PLUGIN_ID]?.site.basePath ?? stackBasePath;
|
|
@@ -65,11 +66,23 @@ function DashboardPage() {
|
|
|
65
66
|
/* @__PURE__ */ jsx("div", { className: "grid gap-4 md:grid-cols-2 lg:grid-cols-3", children: contentTypes.map((ct) => /* @__PURE__ */ jsxs(
|
|
66
67
|
Card,
|
|
67
68
|
{
|
|
68
|
-
className:
|
|
69
|
+
className: cn(
|
|
70
|
+
"hover:border-primary/50 transition-colors cursor-pointer",
|
|
71
|
+
classNames?.contentTypeCard
|
|
72
|
+
),
|
|
69
73
|
onClick: () => void navigate?.(joinBasePath(basePath, `/cms/${ct.slug}`)),
|
|
70
74
|
children: [
|
|
71
75
|
/* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
72
|
-
/* @__PURE__ */ jsx(
|
|
76
|
+
/* @__PURE__ */ jsx(
|
|
77
|
+
CardTitle,
|
|
78
|
+
{
|
|
79
|
+
className: cn(
|
|
80
|
+
"text-lg font-medium",
|
|
81
|
+
classNames?.contentTypeTitle
|
|
82
|
+
),
|
|
83
|
+
children: ct.name
|
|
84
|
+
}
|
|
85
|
+
),
|
|
73
86
|
/* @__PURE__ */ jsx(FileText, { className: "h-5 w-5 text-muted-foreground" })
|
|
74
87
|
] }),
|
|
75
88
|
/* @__PURE__ */ jsxs(CardContent, { children: [
|
|
@@ -5,19 +5,20 @@ const jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
const context = require('@btst/stack/context');
|
|
6
6
|
const pageWrapper = require('../../../../../../../ui/src/components/page-wrapper.cjs');
|
|
7
7
|
const constants = require('../../constants.cjs');
|
|
8
|
+
const utils = require('../../../utils.cjs');
|
|
8
9
|
|
|
9
10
|
function PageWrapper({
|
|
10
11
|
children,
|
|
11
12
|
className,
|
|
12
13
|
testId
|
|
13
14
|
}) {
|
|
14
|
-
const { showAttribution } = context.usePluginOverrides(constants.CMS_PLUGIN_ID, {
|
|
15
|
+
const { showAttribution, classNames } = context.usePluginOverrides(constants.CMS_PLUGIN_ID, {
|
|
15
16
|
showAttribution: true
|
|
16
17
|
});
|
|
17
18
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
18
19
|
pageWrapper.PageWrapper,
|
|
19
20
|
{
|
|
20
|
-
className,
|
|
21
|
+
className: utils.cn(className, classNames?.container),
|
|
21
22
|
testId,
|
|
22
23
|
showAttribution,
|
|
23
24
|
children
|
|
@@ -3,19 +3,20 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { usePluginOverrides } from '@btst/stack/context';
|
|
4
4
|
import { PageWrapper as PageWrapper$1 } from '../../../../../../../ui/src/components/page-wrapper.mjs';
|
|
5
5
|
import { CMS_PLUGIN_ID } from '../../constants.mjs';
|
|
6
|
+
import { cn } from '../../../utils.mjs';
|
|
6
7
|
|
|
7
8
|
function PageWrapper({
|
|
8
9
|
children,
|
|
9
10
|
className,
|
|
10
11
|
testId
|
|
11
12
|
}) {
|
|
12
|
-
const { showAttribution } = usePluginOverrides(CMS_PLUGIN_ID, {
|
|
13
|
+
const { showAttribution, classNames } = usePluginOverrides(CMS_PLUGIN_ID, {
|
|
13
14
|
showAttribution: true
|
|
14
15
|
});
|
|
15
16
|
return /* @__PURE__ */ jsx(
|
|
16
17
|
PageWrapper$1,
|
|
17
18
|
{
|
|
18
|
-
className,
|
|
19
|
+
className: cn(className, classNames?.container),
|
|
19
20
|
testId,
|
|
20
21
|
showAttribution,
|
|
21
22
|
children
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('clsx');
|
|
4
|
-
require('tailwind-merge');
|
|
3
|
+
const clsx = require('clsx');
|
|
4
|
+
const tailwindMerge = require('tailwind-merge');
|
|
5
5
|
const slug = require('slug');
|
|
6
6
|
|
|
7
7
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
@@ -11,5 +11,9 @@ const slug__default = /*#__PURE__*/_interopDefaultCompat(slug);
|
|
|
11
11
|
function slugify(text, locale = "en") {
|
|
12
12
|
return slug__default(text, { lower: true, locale });
|
|
13
13
|
}
|
|
14
|
+
function cn(...inputs) {
|
|
15
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
16
|
+
}
|
|
14
17
|
|
|
18
|
+
exports.cn = cn;
|
|
15
19
|
exports.slugify = slugify;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import 'clsx';
|
|
2
|
-
import 'tailwind-merge';
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
|
+
import { twMerge } from 'tailwind-merge';
|
|
3
3
|
import slug from 'slug';
|
|
4
4
|
|
|
5
5
|
function slugify(text, locale = "en") {
|
|
6
6
|
return slug(text, { lower: true, locale });
|
|
7
7
|
}
|
|
8
|
+
function cn(...inputs) {
|
|
9
|
+
return twMerge(clsx(inputs));
|
|
10
|
+
}
|
|
8
11
|
|
|
9
|
-
export { slugify };
|
|
12
|
+
export { cn, slugify };
|
package/dist/packages/stack/src/plugins/form-builder/client/components/forms/form-renderer.cjs
CHANGED
|
@@ -12,6 +12,7 @@ const LucideIcons = require('lucide-react');
|
|
|
12
12
|
const formBuilderHooks = require('../../hooks/form-builder-hooks.cjs');
|
|
13
13
|
const plugins_formBuilder_permissions = require('../../../../../../../../plugins/form-builder/permissions.cjs');
|
|
14
14
|
const constants = require('../../constants.cjs');
|
|
15
|
+
const utils = require('../../../utils.cjs');
|
|
15
16
|
|
|
16
17
|
function DefaultLoadingComponent() {
|
|
17
18
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
|
|
@@ -58,7 +59,12 @@ function FormRenderer({
|
|
|
58
59
|
className
|
|
59
60
|
}) {
|
|
60
61
|
const t = context.useTranslate();
|
|
61
|
-
const {
|
|
62
|
+
const {
|
|
63
|
+
fieldComponents: overrideFieldComponents,
|
|
64
|
+
localization,
|
|
65
|
+
classNames
|
|
66
|
+
} = context.usePluginOverrides(constants.FORM_BUILDER_PLUGIN_ID);
|
|
67
|
+
const formClassName = utils.cn(className, classNames?.form);
|
|
62
68
|
const { form, isLoading, error } = formBuilderHooks.useFormBySlug(slug);
|
|
63
69
|
const submitMutation = formBuilderHooks.useSubmitForm(slug);
|
|
64
70
|
const [submitted, setSubmitted] = React.useState(false);
|
|
@@ -104,13 +110,13 @@ function FormRenderer({
|
|
|
104
110
|
}
|
|
105
111
|
};
|
|
106
112
|
if (isLoading) {
|
|
107
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children: /* @__PURE__ */ jsxRuntime.jsx(LoadingComponent, {}) });
|
|
113
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: formClassName, children: /* @__PURE__ */ jsxRuntime.jsx(LoadingComponent, {}) });
|
|
108
114
|
}
|
|
109
115
|
if (error) {
|
|
110
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children: /* @__PURE__ */ jsxRuntime.jsx(ErrorComponent, { error }) });
|
|
116
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: formClassName, children: /* @__PURE__ */ jsxRuntime.jsx(ErrorComponent, { error }) });
|
|
111
117
|
}
|
|
112
118
|
if (!form) {
|
|
113
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
119
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: formClassName, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
114
120
|
ErrorComponent,
|
|
115
121
|
{
|
|
116
122
|
error: new Error(
|
|
@@ -120,7 +126,7 @@ function FormRenderer({
|
|
|
120
126
|
) });
|
|
121
127
|
}
|
|
122
128
|
if (form.status !== "active") {
|
|
123
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
129
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: formClassName, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
124
130
|
ErrorComponent,
|
|
125
131
|
{
|
|
126
132
|
error: new Error(
|
|
@@ -133,7 +139,7 @@ function FormRenderer({
|
|
|
133
139
|
) });
|
|
134
140
|
}
|
|
135
141
|
if (!zodSchema) {
|
|
136
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
142
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: formClassName, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
137
143
|
ErrorComponent,
|
|
138
144
|
{
|
|
139
145
|
error: new Error(
|
|
@@ -146,7 +152,7 @@ function FormRenderer({
|
|
|
146
152
|
) });
|
|
147
153
|
}
|
|
148
154
|
if (submitted && finalSuccessMessage) {
|
|
149
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children: /* @__PURE__ */ jsxRuntime.jsx(DefaultSuccessComponent, { message: finalSuccessMessage }) });
|
|
155
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: formClassName, children: /* @__PURE__ */ jsxRuntime.jsx(DefaultSuccessComponent, { message: finalSuccessMessage }) });
|
|
150
156
|
}
|
|
151
157
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
152
158
|
context.PermissionAccess,
|
|
@@ -168,7 +174,7 @@ function FormRenderer({
|
|
|
168
174
|
...form.createdBy ? { ownerId: form.createdBy } : {},
|
|
169
175
|
status: form.status
|
|
170
176
|
}),
|
|
171
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className, "data-testid": "form-renderer", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
177
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: formClassName, "data-testid": "form-renderer", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
172
178
|
steppedAutoForm.default,
|
|
173
179
|
{
|
|
174
180
|
formSchema: zodSchema,
|
package/dist/packages/stack/src/plugins/form-builder/client/components/forms/form-renderer.mjs
CHANGED
|
@@ -10,6 +10,7 @@ import { AlertCircle, CheckCircle } from 'lucide-react';
|
|
|
10
10
|
import { useFormBySlug, useSubmitForm } from '../../hooks/form-builder-hooks.mjs';
|
|
11
11
|
import { formBuilderPermissions } from '../../../../../../../../plugins/form-builder/permissions.mjs';
|
|
12
12
|
import { FORM_BUILDER_PLUGIN_ID } from '../../constants.mjs';
|
|
13
|
+
import { cn } from '../../../utils.mjs';
|
|
13
14
|
|
|
14
15
|
function DefaultLoadingComponent() {
|
|
15
16
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
@@ -56,7 +57,12 @@ function FormRenderer({
|
|
|
56
57
|
className
|
|
57
58
|
}) {
|
|
58
59
|
const t = useTranslate();
|
|
59
|
-
const {
|
|
60
|
+
const {
|
|
61
|
+
fieldComponents: overrideFieldComponents,
|
|
62
|
+
localization,
|
|
63
|
+
classNames
|
|
64
|
+
} = usePluginOverrides(FORM_BUILDER_PLUGIN_ID);
|
|
65
|
+
const formClassName = cn(className, classNames?.form);
|
|
60
66
|
const { form, isLoading, error } = useFormBySlug(slug);
|
|
61
67
|
const submitMutation = useSubmitForm(slug);
|
|
62
68
|
const [submitted, setSubmitted] = useState(false);
|
|
@@ -102,13 +108,13 @@ function FormRenderer({
|
|
|
102
108
|
}
|
|
103
109
|
};
|
|
104
110
|
if (isLoading) {
|
|
105
|
-
return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(LoadingComponent, {}) });
|
|
111
|
+
return /* @__PURE__ */ jsx("div", { className: formClassName, children: /* @__PURE__ */ jsx(LoadingComponent, {}) });
|
|
106
112
|
}
|
|
107
113
|
if (error) {
|
|
108
|
-
return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(ErrorComponent, { error }) });
|
|
114
|
+
return /* @__PURE__ */ jsx("div", { className: formClassName, children: /* @__PURE__ */ jsx(ErrorComponent, { error }) });
|
|
109
115
|
}
|
|
110
116
|
if (!form) {
|
|
111
|
-
return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(
|
|
117
|
+
return /* @__PURE__ */ jsx("div", { className: formClassName, children: /* @__PURE__ */ jsx(
|
|
112
118
|
ErrorComponent,
|
|
113
119
|
{
|
|
114
120
|
error: new Error(
|
|
@@ -118,7 +124,7 @@ function FormRenderer({
|
|
|
118
124
|
) });
|
|
119
125
|
}
|
|
120
126
|
if (form.status !== "active") {
|
|
121
|
-
return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(
|
|
127
|
+
return /* @__PURE__ */ jsx("div", { className: formClassName, children: /* @__PURE__ */ jsx(
|
|
122
128
|
ErrorComponent,
|
|
123
129
|
{
|
|
124
130
|
error: new Error(
|
|
@@ -131,7 +137,7 @@ function FormRenderer({
|
|
|
131
137
|
) });
|
|
132
138
|
}
|
|
133
139
|
if (!zodSchema) {
|
|
134
|
-
return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(
|
|
140
|
+
return /* @__PURE__ */ jsx("div", { className: formClassName, children: /* @__PURE__ */ jsx(
|
|
135
141
|
ErrorComponent,
|
|
136
142
|
{
|
|
137
143
|
error: new Error(
|
|
@@ -144,7 +150,7 @@ function FormRenderer({
|
|
|
144
150
|
) });
|
|
145
151
|
}
|
|
146
152
|
if (submitted && finalSuccessMessage) {
|
|
147
|
-
return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(DefaultSuccessComponent, { message: finalSuccessMessage }) });
|
|
153
|
+
return /* @__PURE__ */ jsx("div", { className: formClassName, children: /* @__PURE__ */ jsx(DefaultSuccessComponent, { message: finalSuccessMessage }) });
|
|
148
154
|
}
|
|
149
155
|
return /* @__PURE__ */ jsx(
|
|
150
156
|
PermissionAccess,
|
|
@@ -166,7 +172,7 @@ function FormRenderer({
|
|
|
166
172
|
...form.createdBy ? { ownerId: form.createdBy } : {},
|
|
167
173
|
status: form.status
|
|
168
174
|
}),
|
|
169
|
-
children: /* @__PURE__ */ jsx("div", { className, "data-testid": "form-renderer", children: /* @__PURE__ */ jsx(
|
|
175
|
+
children: /* @__PURE__ */ jsx("div", { className: formClassName, "data-testid": "form-renderer", children: /* @__PURE__ */ jsx(
|
|
170
176
|
SteppedAutoForm,
|
|
171
177
|
{
|
|
172
178
|
formSchema: zodSchema,
|