@doneisbetter/gds-admin 2.6.1
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/chunk-DCLRWG2B.mjs +174 -0
- package/dist/chunk-ZUUEDN7I.mjs +238 -0
- package/dist/client.d.mts +88 -0
- package/dist/client.d.ts +88 -0
- package/dist/client.js +458 -0
- package/dist/client.mjs +32 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +458 -0
- package/dist/index.mjs +32 -0
- package/dist/server.d.mts +92 -0
- package/dist/server.d.ts +92 -0
- package/dist/server.js +272 -0
- package/dist/server.mjs +20 -0
- package/package.json +58 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
// src/AppShell.tsx
|
|
2
|
+
import { AppShell as MantineAppShell, Burger, Divider, Group, ScrollArea, Stack, Text, Title } from "@mantine/core";
|
|
3
|
+
import { useDisclosure } from "@mantine/hooks";
|
|
4
|
+
import { ThemeToggle } from "@doneisbetter/gds-core";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
function AppShell({
|
|
7
|
+
logoText = "GDS",
|
|
8
|
+
navLinks,
|
|
9
|
+
primaryNavigation,
|
|
10
|
+
secondaryNavigation,
|
|
11
|
+
accountPanel,
|
|
12
|
+
headerContext,
|
|
13
|
+
headerActions,
|
|
14
|
+
mobileNavigation,
|
|
15
|
+
children
|
|
16
|
+
}) {
|
|
17
|
+
const [opened, { toggle }] = useDisclosure();
|
|
18
|
+
const primaryNav = primaryNavigation ?? navLinks;
|
|
19
|
+
return /* @__PURE__ */ jsxs(
|
|
20
|
+
MantineAppShell,
|
|
21
|
+
{
|
|
22
|
+
header: { height: headerContext ? 72 : 60 },
|
|
23
|
+
footer: mobileNavigation ? { height: 68 } : void 0,
|
|
24
|
+
navbar: {
|
|
25
|
+
width: 250,
|
|
26
|
+
breakpoint: "sm",
|
|
27
|
+
collapsed: { mobile: !opened }
|
|
28
|
+
},
|
|
29
|
+
padding: "md",
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsx(MantineAppShell.Header, { children: /* @__PURE__ */ jsxs(Group, { h: "100%", px: "md", justify: "space-between", align: "center", wrap: "nowrap", children: [
|
|
32
|
+
/* @__PURE__ */ jsxs(Group, { wrap: "nowrap", style: { minWidth: 0, flex: 1 }, children: [
|
|
33
|
+
/* @__PURE__ */ jsx(Burger, { opened, onClick: toggle, hiddenFrom: "sm", size: "sm", "aria-label": "Toggle navigation" }),
|
|
34
|
+
/* @__PURE__ */ jsxs(Stack, { gap: 0, style: { minWidth: 0 }, children: [
|
|
35
|
+
/* @__PURE__ */ jsx(Title, { order: 3, lineClamp: 1, children: logoText }),
|
|
36
|
+
headerContext ? /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", lineClamp: 1, children: headerContext }) : null
|
|
37
|
+
] })
|
|
38
|
+
] }),
|
|
39
|
+
/* @__PURE__ */ jsxs(Group, { wrap: "nowrap", children: [
|
|
40
|
+
headerActions,
|
|
41
|
+
/* @__PURE__ */ jsx(ThemeToggle, {})
|
|
42
|
+
] })
|
|
43
|
+
] }) }),
|
|
44
|
+
/* @__PURE__ */ jsx(MantineAppShell.Navbar, { p: "md", children: /* @__PURE__ */ jsx(ScrollArea, { h: "100%", type: "auto", children: /* @__PURE__ */ jsxs(Stack, { gap: "md", h: "100%", children: [
|
|
45
|
+
primaryNav ? /* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
|
|
46
|
+
/* @__PURE__ */ jsx(Text, { size: "xs", fw: 700, c: "dimmed", children: "Primary" }),
|
|
47
|
+
primaryNav
|
|
48
|
+
] }) : null,
|
|
49
|
+
secondaryNavigation ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
50
|
+
/* @__PURE__ */ jsx(Divider, {}),
|
|
51
|
+
/* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
|
|
52
|
+
/* @__PURE__ */ jsx(Text, { size: "xs", fw: 700, c: "dimmed", children: "More" }),
|
|
53
|
+
secondaryNavigation
|
|
54
|
+
] })
|
|
55
|
+
] }) : null,
|
|
56
|
+
accountPanel ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
57
|
+
/* @__PURE__ */ jsx(Divider, { mt: "auto" }),
|
|
58
|
+
/* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
|
|
59
|
+
/* @__PURE__ */ jsx(Text, { size: "xs", fw: 700, c: "dimmed", children: "Account" }),
|
|
60
|
+
accountPanel
|
|
61
|
+
] })
|
|
62
|
+
] }) : null
|
|
63
|
+
] }) }) }),
|
|
64
|
+
mobileNavigation ? /* @__PURE__ */ jsx(MantineAppShell.Footer, { children: /* @__PURE__ */ jsx(Group, { h: "100%", px: "md", justify: "space-around", wrap: "nowrap", children: mobileNavigation }) }) : null,
|
|
65
|
+
/* @__PURE__ */ jsx(MantineAppShell.Main, { children })
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// src/DataTable.tsx
|
|
72
|
+
import { Table, Paper, LoadingOverlay } from "@mantine/core";
|
|
73
|
+
import { useGdsTranslation } from "@doneisbetter/gds-theme";
|
|
74
|
+
import { StateBlock } from "@doneisbetter/gds-core";
|
|
75
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
76
|
+
function DataTable({ data, columns, loading = false, getRowKey }) {
|
|
77
|
+
const { t } = useGdsTranslation();
|
|
78
|
+
if (!data.length && !loading) {
|
|
79
|
+
return /* @__PURE__ */ jsx2(Paper, { p: "xl", withBorder: true, children: /* @__PURE__ */ jsx2(
|
|
80
|
+
StateBlock,
|
|
81
|
+
{
|
|
82
|
+
variant: "empty",
|
|
83
|
+
title: t("gds.state.emptyDataTitle", "No data available"),
|
|
84
|
+
description: t("gds.state.emptyData", "No data available."),
|
|
85
|
+
compact: true
|
|
86
|
+
}
|
|
87
|
+
) });
|
|
88
|
+
}
|
|
89
|
+
return /* @__PURE__ */ jsxs2(Paper, { withBorder: true, pos: "relative", style: { overflow: "hidden" }, children: [
|
|
90
|
+
/* @__PURE__ */ jsx2(LoadingOverlay, { visible: loading, zIndex: 1e3, overlayProps: { radius: "sm", blur: 2 } }),
|
|
91
|
+
/* @__PURE__ */ jsxs2(Table, { striped: true, highlightOnHover: true, children: [
|
|
92
|
+
/* @__PURE__ */ jsx2(Table.Thead, { children: /* @__PURE__ */ jsx2(Table.Tr, { children: columns.map((col) => /* @__PURE__ */ jsx2(Table.Th, { children: col.label }, col.key)) }) }),
|
|
93
|
+
/* @__PURE__ */ jsx2(Table.Tbody, { children: data.map((item, rowIndex) => /* @__PURE__ */ jsx2(Table.Tr, { children: columns.map((col) => /* @__PURE__ */ jsx2(Table.Td, { children: col.render ? col.render(item) : item[col.key] }, col.key)) }, getRowKey ? getRowKey(item, rowIndex) : rowIndex)) })
|
|
94
|
+
] })
|
|
95
|
+
] });
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// src/SemanticNavLink.tsx
|
|
99
|
+
import { forwardRef } from "react";
|
|
100
|
+
import { NavLink, createPolymorphicComponent } from "@mantine/core";
|
|
101
|
+
import { useGdsTranslation as useGdsTranslation2 } from "@doneisbetter/gds-theme";
|
|
102
|
+
import { GdsVocabulary } from "@doneisbetter/gds-core";
|
|
103
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
104
|
+
var _SemanticNavLink = forwardRef(
|
|
105
|
+
({ action, ...props }, ref) => {
|
|
106
|
+
const { t } = useGdsTranslation2();
|
|
107
|
+
const config = GdsVocabulary[action];
|
|
108
|
+
const Icon = config.icon;
|
|
109
|
+
return /* @__PURE__ */ jsx3(
|
|
110
|
+
NavLink,
|
|
111
|
+
{
|
|
112
|
+
ref,
|
|
113
|
+
label: t(config.id, config.defaultMessage),
|
|
114
|
+
leftSection: /* @__PURE__ */ jsx3(Icon, { size: "1rem", stroke: 1.5 }),
|
|
115
|
+
...props
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
var SemanticNavLink = createPolymorphicComponent(_SemanticNavLink);
|
|
121
|
+
|
|
122
|
+
// src/ResponsiveDataView.tsx
|
|
123
|
+
import React from "react";
|
|
124
|
+
import { Badge, Group as Group2, SimpleGrid, Stack as Stack2 } from "@mantine/core";
|
|
125
|
+
import { useMediaQuery } from "@mantine/hooks";
|
|
126
|
+
import { StateBlock as StateBlock2 } from "@doneisbetter/gds-core";
|
|
127
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
128
|
+
function ResponsiveDataView({
|
|
129
|
+
data,
|
|
130
|
+
columns,
|
|
131
|
+
renderCard,
|
|
132
|
+
loading = false,
|
|
133
|
+
error,
|
|
134
|
+
errorAction,
|
|
135
|
+
emptyTitle = "No results yet",
|
|
136
|
+
emptyDescription = "Try changing filters or create a new record.",
|
|
137
|
+
emptyAction,
|
|
138
|
+
activeFilters = [],
|
|
139
|
+
toolbar,
|
|
140
|
+
filterDrawer,
|
|
141
|
+
mobileFilters,
|
|
142
|
+
getRowKey
|
|
143
|
+
}) {
|
|
144
|
+
const isMobile = useMediaQuery("(max-width: 48em)");
|
|
145
|
+
return /* @__PURE__ */ jsxs3(Stack2, { gap: "md", children: [
|
|
146
|
+
toolbar,
|
|
147
|
+
activeFilters.length ? /* @__PURE__ */ jsx4(Group2, { gap: "xs", wrap: "wrap", children: activeFilters.map((filter, index) => /* @__PURE__ */ jsx4(
|
|
148
|
+
Badge,
|
|
149
|
+
{
|
|
150
|
+
variant: "light",
|
|
151
|
+
color: "violet",
|
|
152
|
+
rightSection: filter.onRemove ? "\xD7" : void 0,
|
|
153
|
+
style: filter.onRemove ? { cursor: "pointer" } : void 0,
|
|
154
|
+
onClick: filter.onRemove,
|
|
155
|
+
children: filter.label
|
|
156
|
+
},
|
|
157
|
+
`${filter.label}-${index}`
|
|
158
|
+
)) }) : null,
|
|
159
|
+
mobileFilters && isMobile ? /* @__PURE__ */ jsx4(Stack2, { gap: "xs", children: mobileFilters }) : null,
|
|
160
|
+
filterDrawer && isMobile ? filterDrawer : null,
|
|
161
|
+
error ? /* @__PURE__ */ jsx4(StateBlock2, { variant: "error", title: "Unable to load data", description: error, action: errorAction, compact: true }) : null,
|
|
162
|
+
!error && loading ? /* @__PURE__ */ jsx4(StateBlock2, { variant: "loading", title: "Loading records", description: "The shared registry surface is synchronizing.", compact: true }) : null,
|
|
163
|
+
!error && !loading && data.length === 0 ? /* @__PURE__ */ jsx4(StateBlock2, { variant: "empty", title: emptyTitle, description: emptyDescription, action: emptyAction, compact: true }) : null,
|
|
164
|
+
!error && isMobile && data.length > 0 ? /* @__PURE__ */ jsx4(SimpleGrid, { cols: { base: 1, sm: 2 }, spacing: "md", children: data.map((item, index) => /* @__PURE__ */ jsx4(React.Fragment, { children: renderCard(item, index) }, getRowKey ? getRowKey(item, index) : index)) }) : null,
|
|
165
|
+
!error && !isMobile ? /* @__PURE__ */ jsx4(DataTable, { data, columns, loading, getRowKey }) : null
|
|
166
|
+
] });
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export {
|
|
170
|
+
AppShell,
|
|
171
|
+
DataTable,
|
|
172
|
+
SemanticNavLink,
|
|
173
|
+
ResponsiveDataView
|
|
174
|
+
};
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
// src/FormSection.tsx
|
|
2
|
+
import { Box, Title, Text, Stack, Divider } from "@mantine/core";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
function FormSection({ title, description, children, withDivider = true }) {
|
|
5
|
+
return /* @__PURE__ */ jsxs(Box, { mb: "xl", children: [
|
|
6
|
+
/* @__PURE__ */ jsxs(Box, { mb: "md", children: [
|
|
7
|
+
/* @__PURE__ */ jsx(Title, { order: 4, children: title }),
|
|
8
|
+
description && /* @__PURE__ */ jsx(Text, { c: "dimmed", size: "sm", children: description })
|
|
9
|
+
] }),
|
|
10
|
+
/* @__PURE__ */ jsx(Stack, { gap: "md", children }),
|
|
11
|
+
withDivider && /* @__PURE__ */ jsx(Divider, { my: "xl" })
|
|
12
|
+
] });
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// src/StatsStrip.tsx
|
|
16
|
+
import { SimpleGrid, Paper, Text as Text2, Group, Box as Box2 } from "@mantine/core";
|
|
17
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
18
|
+
function StatsStrip({ stats }) {
|
|
19
|
+
const items = stats.map((stat, index) => /* @__PURE__ */ jsx2(Paper, { p: "lg", withBorder: true, radius: "md", children: /* @__PURE__ */ jsxs2(Group, { justify: "space-between", align: "flex-end", gap: "xs", children: [
|
|
20
|
+
/* @__PURE__ */ jsxs2(Box2, { children: [
|
|
21
|
+
/* @__PURE__ */ jsx2(Text2, { c: "dimmed", tt: "uppercase", fw: 700, size: "xs", children: stat.label }),
|
|
22
|
+
/* @__PURE__ */ jsx2(Text2, { fw: 700, size: "xl", mt: "sm", children: stat.value })
|
|
23
|
+
] }),
|
|
24
|
+
stat.diff !== void 0 && /* @__PURE__ */ jsxs2(Text2, { c: stat.diff > 0 ? "teal" : "red", size: "sm", fw: 600, children: [
|
|
25
|
+
stat.diff > 0 ? "+" : "",
|
|
26
|
+
stat.diff,
|
|
27
|
+
"%"
|
|
28
|
+
] })
|
|
29
|
+
] }) }, index));
|
|
30
|
+
return /* @__PURE__ */ jsx2(SimpleGrid, { cols: { base: 1, sm: 2, md: 3 }, spacing: "md", children: items });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// src/InfoCard.tsx
|
|
34
|
+
import { Card, Text as Text3, Group as Group2, ThemeIcon, Box as Box3 } from "@mantine/core";
|
|
35
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
36
|
+
function InfoCard({ title, value, description, icon, color = "blue" }) {
|
|
37
|
+
return /* @__PURE__ */ jsx3(Card, { p: "xl", children: /* @__PURE__ */ jsxs3(Group2, { justify: "space-between", align: "flex-start", wrap: "nowrap", children: [
|
|
38
|
+
/* @__PURE__ */ jsxs3(Box3, { children: [
|
|
39
|
+
/* @__PURE__ */ jsx3(Text3, { tt: "uppercase", fw: 700, c: "dimmed", size: "xs", children: title }),
|
|
40
|
+
/* @__PURE__ */ jsx3(Text3, { fw: 700, size: "xl", mt: "sm", children: value }),
|
|
41
|
+
description && /* @__PURE__ */ jsx3(Text3, { c: "dimmed", size: "sm", mt: "xs", children: description })
|
|
42
|
+
] }),
|
|
43
|
+
icon && /* @__PURE__ */ jsx3(ThemeIcon, { size: "xl", radius: "md", variant: "light", color, children: icon })
|
|
44
|
+
] }) });
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// src/PageHeader.tsx
|
|
48
|
+
import { ActionIcon, Breadcrumbs, Group as Group3, Menu, Title as Title2, Text as Text4, Box as Box4, Stack as Stack2 } from "@mantine/core";
|
|
49
|
+
import { GdsIcons } from "@doneisbetter/gds-core";
|
|
50
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
51
|
+
function PageHeader({
|
|
52
|
+
title,
|
|
53
|
+
description,
|
|
54
|
+
subtitle,
|
|
55
|
+
eyebrow,
|
|
56
|
+
breadcrumbs,
|
|
57
|
+
status,
|
|
58
|
+
primaryAction,
|
|
59
|
+
secondaryActions,
|
|
60
|
+
overflowActions = []
|
|
61
|
+
}) {
|
|
62
|
+
return /* @__PURE__ */ jsxs4(Stack2, { gap: "sm", mb: "xl", children: [
|
|
63
|
+
breadcrumbs?.length ? /* @__PURE__ */ jsx4(Breadcrumbs, { children: breadcrumbs }) : null,
|
|
64
|
+
/* @__PURE__ */ jsxs4(Group3, { justify: "space-between", align: "flex-start", gap: "md", wrap: "wrap", children: [
|
|
65
|
+
/* @__PURE__ */ jsxs4(Box4, { style: { minWidth: 0, flex: 1 }, children: [
|
|
66
|
+
eyebrow ? /* @__PURE__ */ jsx4(Text4, { c: "dimmed", size: "sm", fw: 700, mb: 4, children: eyebrow }) : null,
|
|
67
|
+
/* @__PURE__ */ jsx4(Title2, { order: 1, children: title }),
|
|
68
|
+
subtitle ? /* @__PURE__ */ jsx4(Text4, { c: "dimmed", mt: "xs", size: "sm", children: subtitle }) : null,
|
|
69
|
+
description && /* @__PURE__ */ jsx4(Text4, { c: "dimmed", mt: "xs", size: "lg", children: description }),
|
|
70
|
+
status ? /* @__PURE__ */ jsx4(Group3, { mt: "sm", gap: "sm", children: status }) : null
|
|
71
|
+
] }),
|
|
72
|
+
(secondaryActions || primaryAction || overflowActions.length) && /* @__PURE__ */ jsxs4(Group3, { wrap: "wrap", justify: "flex-end", children: [
|
|
73
|
+
secondaryActions,
|
|
74
|
+
primaryAction,
|
|
75
|
+
overflowActions.length ? /* @__PURE__ */ jsxs4(Menu, { shadow: "md", width: 220, withinPortal: true, children: [
|
|
76
|
+
/* @__PURE__ */ jsx4(Menu.Target, { children: /* @__PURE__ */ jsx4(ActionIcon, { variant: "default", size: "lg", "aria-label": "More actions", children: /* @__PURE__ */ jsx4(GdsIcons.Menu, { size: "1rem" }) }) }),
|
|
77
|
+
/* @__PURE__ */ jsx4(Menu.Dropdown, { children: overflowActions.map((action, index) => /* @__PURE__ */ jsx4(
|
|
78
|
+
Menu.Item,
|
|
79
|
+
{
|
|
80
|
+
component: action.href ? "a" : "button",
|
|
81
|
+
href: action.href,
|
|
82
|
+
onClick: action.onClick,
|
|
83
|
+
color: action.color,
|
|
84
|
+
disabled: action.disabled,
|
|
85
|
+
children: action.label
|
|
86
|
+
},
|
|
87
|
+
`${String(action.label)}-${index}`
|
|
88
|
+
)) })
|
|
89
|
+
] }) : null
|
|
90
|
+
] })
|
|
91
|
+
] })
|
|
92
|
+
] });
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// src/WorkspaceHeader.tsx
|
|
96
|
+
import { Breadcrumbs as Breadcrumbs2, Group as Group4, Stack as Stack3, Text as Text5, Title as Title3 } from "@mantine/core";
|
|
97
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
98
|
+
function WorkspaceHeader({
|
|
99
|
+
breadcrumbs,
|
|
100
|
+
eyebrow,
|
|
101
|
+
title,
|
|
102
|
+
description,
|
|
103
|
+
primaryAction,
|
|
104
|
+
secondaryActions
|
|
105
|
+
}) {
|
|
106
|
+
return /* @__PURE__ */ jsxs5(Stack3, { gap: "sm", mb: "xl", children: [
|
|
107
|
+
breadcrumbs?.length ? /* @__PURE__ */ jsx5(Breadcrumbs2, { children: breadcrumbs }) : null,
|
|
108
|
+
eyebrow ? /* @__PURE__ */ jsx5(Text5, { size: "sm", fw: 700, c: "dimmed", tt: "uppercase", children: eyebrow }) : null,
|
|
109
|
+
/* @__PURE__ */ jsxs5(Group4, { justify: "space-between", align: "flex-start", gap: "md", children: [
|
|
110
|
+
/* @__PURE__ */ jsxs5(Stack3, { gap: 6, children: [
|
|
111
|
+
/* @__PURE__ */ jsx5(Title3, { order: 1, children: title }),
|
|
112
|
+
description ? /* @__PURE__ */ jsx5(Text5, { c: "dimmed", maw: 640, children: description }) : null
|
|
113
|
+
] }),
|
|
114
|
+
/* @__PURE__ */ jsxs5(Group4, { gap: "sm", children: [
|
|
115
|
+
secondaryActions,
|
|
116
|
+
primaryAction
|
|
117
|
+
] })
|
|
118
|
+
] })
|
|
119
|
+
] });
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// src/EditorScaffold.tsx
|
|
123
|
+
import { Grid, Paper as Paper2, Stack as Stack4 } from "@mantine/core";
|
|
124
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
125
|
+
function EditorScaffold({
|
|
126
|
+
header,
|
|
127
|
+
context,
|
|
128
|
+
form,
|
|
129
|
+
preview,
|
|
130
|
+
settings,
|
|
131
|
+
footer,
|
|
132
|
+
stickyFooter = false
|
|
133
|
+
}) {
|
|
134
|
+
return /* @__PURE__ */ jsxs6(Stack4, { gap: "lg", children: [
|
|
135
|
+
header,
|
|
136
|
+
context,
|
|
137
|
+
/* @__PURE__ */ jsxs6(Grid, { gutter: "lg", align: "start", children: [
|
|
138
|
+
/* @__PURE__ */ jsx6(Grid.Col, { span: { base: 12, md: preview ? 7 : 8 }, children: form }),
|
|
139
|
+
preview || settings ? /* @__PURE__ */ jsx6(Grid.Col, { span: { base: 12, md: preview ? 5 : 4 }, children: /* @__PURE__ */ jsxs6(Stack4, { gap: "lg", children: [
|
|
140
|
+
preview,
|
|
141
|
+
settings
|
|
142
|
+
] }) }) : null
|
|
143
|
+
] }),
|
|
144
|
+
footer ? stickyFooter ? /* @__PURE__ */ jsx6(
|
|
145
|
+
Paper2,
|
|
146
|
+
{
|
|
147
|
+
withBorder: true,
|
|
148
|
+
radius: "xl",
|
|
149
|
+
p: "md",
|
|
150
|
+
style: {
|
|
151
|
+
position: "sticky",
|
|
152
|
+
bottom: "1rem",
|
|
153
|
+
zIndex: 10
|
|
154
|
+
},
|
|
155
|
+
children: footer
|
|
156
|
+
}
|
|
157
|
+
) : footer : null
|
|
158
|
+
] });
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// src/ContentOpsSection.tsx
|
|
162
|
+
import { SectionPanel } from "@doneisbetter/gds-core";
|
|
163
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
164
|
+
function ContentOpsSection({
|
|
165
|
+
id,
|
|
166
|
+
title,
|
|
167
|
+
description,
|
|
168
|
+
action,
|
|
169
|
+
children,
|
|
170
|
+
tone = "default"
|
|
171
|
+
}) {
|
|
172
|
+
return /* @__PURE__ */ jsx7(SectionPanel, { id, title, description, action, tone, children });
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// src/ContentOpsActionBar.tsx
|
|
176
|
+
import { Badge, Group as Group5, Paper as Paper3, Text as Text6 } from "@mantine/core";
|
|
177
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
178
|
+
function ContentOpsActionBar({
|
|
179
|
+
dirty = false,
|
|
180
|
+
saving = false,
|
|
181
|
+
status,
|
|
182
|
+
primaryAction,
|
|
183
|
+
secondaryAction,
|
|
184
|
+
tertiaryAction
|
|
185
|
+
}) {
|
|
186
|
+
return /* @__PURE__ */ jsx8(Paper3, { withBorder: true, radius: "xl", p: "md", children: /* @__PURE__ */ jsxs7(Group5, { justify: "space-between", align: "center", gap: "md", wrap: "wrap", children: [
|
|
187
|
+
/* @__PURE__ */ jsxs7(Group5, { gap: "sm", wrap: "wrap", children: [
|
|
188
|
+
/* @__PURE__ */ jsx8(Badge, { color: saving ? "violet" : dirty ? "yellow" : "teal", variant: "light", children: saving ? "Saving" : dirty ? "Unsaved changes" : "Saved" }),
|
|
189
|
+
status ? typeof status === "string" ? /* @__PURE__ */ jsx8(Text6, { size: "sm", c: "dimmed", children: status }) : status : null
|
|
190
|
+
] }),
|
|
191
|
+
/* @__PURE__ */ jsxs7(Group5, { gap: "sm", wrap: "wrap", children: [
|
|
192
|
+
tertiaryAction,
|
|
193
|
+
secondaryAction,
|
|
194
|
+
primaryAction
|
|
195
|
+
] })
|
|
196
|
+
] }) });
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// src/ContentOpsEditor.tsx
|
|
200
|
+
import { Stack as Stack5 } from "@mantine/core";
|
|
201
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
202
|
+
function ContentOpsEditor({
|
|
203
|
+
header,
|
|
204
|
+
context,
|
|
205
|
+
status,
|
|
206
|
+
sections,
|
|
207
|
+
actionBar,
|
|
208
|
+
preview,
|
|
209
|
+
settings
|
|
210
|
+
}) {
|
|
211
|
+
return /* @__PURE__ */ jsxs8(Stack5, { gap: "lg", children: [
|
|
212
|
+
header,
|
|
213
|
+
status,
|
|
214
|
+
/* @__PURE__ */ jsx9(
|
|
215
|
+
EditorScaffold,
|
|
216
|
+
{
|
|
217
|
+
context,
|
|
218
|
+
form: /* @__PURE__ */ jsx9(Stack5, { gap: "lg", children: sections }),
|
|
219
|
+
preview,
|
|
220
|
+
settings,
|
|
221
|
+
footer: actionBar,
|
|
222
|
+
stickyFooter: true
|
|
223
|
+
}
|
|
224
|
+
)
|
|
225
|
+
] });
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export {
|
|
229
|
+
FormSection,
|
|
230
|
+
StatsStrip,
|
|
231
|
+
InfoCard,
|
|
232
|
+
PageHeader,
|
|
233
|
+
WorkspaceHeader,
|
|
234
|
+
EditorScaffold,
|
|
235
|
+
ContentOpsSection,
|
|
236
|
+
ContentOpsActionBar,
|
|
237
|
+
ContentOpsEditor
|
|
238
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export { ContentOpsActionBar, ContentOpsActionBarProps, ContentOpsEditor, ContentOpsEditorProps, ContentOpsSection, ContentOpsSectionProps, FormSection, FormSectionProps, InfoCard, InfoCardProps, PageHeader, PageHeaderOverflowAction, PageHeaderProps, StatItem, StatsStrip, StatsStripProps, WorkspaceHeader, WorkspaceHeaderProps } from './server.mjs';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import * as React$1 from 'react';
|
|
4
|
+
import React__default, { ReactNode, Key } from 'react';
|
|
5
|
+
import * as _mantine_core from '@mantine/core';
|
|
6
|
+
import { NavLinkProps } from '@mantine/core';
|
|
7
|
+
import { SemanticAction } from '@doneisbetter/gds-core';
|
|
8
|
+
|
|
9
|
+
interface AppShellProps {
|
|
10
|
+
logoText?: string;
|
|
11
|
+
navLinks?: ReactNode;
|
|
12
|
+
primaryNavigation?: ReactNode;
|
|
13
|
+
secondaryNavigation?: ReactNode;
|
|
14
|
+
accountPanel?: ReactNode;
|
|
15
|
+
headerContext?: ReactNode;
|
|
16
|
+
headerActions?: ReactNode;
|
|
17
|
+
mobileNavigation?: ReactNode;
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* AppShell provides the standard GDS application layout.
|
|
22
|
+
* It strictly controls the header, sidebar, and main content area.
|
|
23
|
+
*/
|
|
24
|
+
declare function AppShell({ logoText, navLinks, primaryNavigation, secondaryNavigation, accountPanel, headerContext, headerActions, mobileNavigation, children, }: AppShellProps): react_jsx_runtime.JSX.Element;
|
|
25
|
+
|
|
26
|
+
interface DataTableColumn<T> {
|
|
27
|
+
key: string;
|
|
28
|
+
label: string;
|
|
29
|
+
render?: (item: T) => ReactNode;
|
|
30
|
+
}
|
|
31
|
+
interface DataTableProps<T> {
|
|
32
|
+
data: T[];
|
|
33
|
+
columns: DataTableColumn<T>[];
|
|
34
|
+
loading?: boolean;
|
|
35
|
+
getRowKey?: (item: T, index: number) => Key;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Standardized Data Table
|
|
39
|
+
*/
|
|
40
|
+
declare function DataTable<T extends Record<string, unknown>>({ data, columns, loading, getRowKey }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
41
|
+
|
|
42
|
+
interface SemanticNavLinkProps extends Omit<NavLinkProps, 'leftSection' | 'label'> {
|
|
43
|
+
action: SemanticAction;
|
|
44
|
+
}
|
|
45
|
+
declare const SemanticNavLink: (<C = "a">(props: _mantine_core.PolymorphicComponentProps<C, SemanticNavLinkProps>) => React.ReactElement) & Omit<React$1.FunctionComponent<(SemanticNavLinkProps & {
|
|
46
|
+
component?: any;
|
|
47
|
+
} & Omit<Omit<any, "ref">, "component" | keyof SemanticNavLinkProps> & {
|
|
48
|
+
ref?: any;
|
|
49
|
+
renderRoot?: (props: any) => any;
|
|
50
|
+
}) | (SemanticNavLinkProps & {
|
|
51
|
+
component: React.ElementType;
|
|
52
|
+
renderRoot?: (props: Record<string, any>) => any;
|
|
53
|
+
})>, never> & Record<string, never>;
|
|
54
|
+
|
|
55
|
+
interface ResponsiveDataViewFilterChip {
|
|
56
|
+
label: string;
|
|
57
|
+
onRemove?: () => void;
|
|
58
|
+
}
|
|
59
|
+
interface ResponsiveDataViewProps<T extends Record<string, unknown>> {
|
|
60
|
+
data: T[];
|
|
61
|
+
columns: DataTableColumn<T>[];
|
|
62
|
+
renderCard: (item: T, index: number) => React__default.ReactNode;
|
|
63
|
+
loading?: boolean;
|
|
64
|
+
error?: string;
|
|
65
|
+
errorAction?: React__default.ReactNode;
|
|
66
|
+
emptyTitle?: string;
|
|
67
|
+
emptyDescription?: string;
|
|
68
|
+
emptyAction?: React__default.ReactNode;
|
|
69
|
+
activeFilters?: ResponsiveDataViewFilterChip[];
|
|
70
|
+
toolbar?: React__default.ReactNode;
|
|
71
|
+
filterDrawer?: React__default.ReactNode;
|
|
72
|
+
mobileFilters?: React__default.ReactNode;
|
|
73
|
+
getRowKey?: (item: T, index: number) => React__default.Key;
|
|
74
|
+
}
|
|
75
|
+
declare function ResponsiveDataView<T extends Record<string, unknown>>({ data, columns, renderCard, loading, error, errorAction, emptyTitle, emptyDescription, emptyAction, activeFilters, toolbar, filterDrawer, mobileFilters, getRowKey, }: ResponsiveDataViewProps<T>): react_jsx_runtime.JSX.Element;
|
|
76
|
+
|
|
77
|
+
interface EditorScaffoldProps {
|
|
78
|
+
header?: ReactNode;
|
|
79
|
+
context?: ReactNode;
|
|
80
|
+
form: ReactNode;
|
|
81
|
+
preview?: ReactNode;
|
|
82
|
+
settings?: ReactNode;
|
|
83
|
+
footer?: ReactNode;
|
|
84
|
+
stickyFooter?: boolean;
|
|
85
|
+
}
|
|
86
|
+
declare function EditorScaffold({ header, context, form, preview, settings, footer, stickyFooter, }: EditorScaffoldProps): react_jsx_runtime.JSX.Element;
|
|
87
|
+
|
|
88
|
+
export { AppShell, type AppShellProps, DataTable, type DataTableColumn, type DataTableProps, EditorScaffold, type EditorScaffoldProps, ResponsiveDataView, type ResponsiveDataViewFilterChip, type ResponsiveDataViewProps, SemanticNavLink, type SemanticNavLinkProps };
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export { ContentOpsActionBar, ContentOpsActionBarProps, ContentOpsEditor, ContentOpsEditorProps, ContentOpsSection, ContentOpsSectionProps, FormSection, FormSectionProps, InfoCard, InfoCardProps, PageHeader, PageHeaderOverflowAction, PageHeaderProps, StatItem, StatsStrip, StatsStripProps, WorkspaceHeader, WorkspaceHeaderProps } from './server.js';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import * as React$1 from 'react';
|
|
4
|
+
import React__default, { ReactNode, Key } from 'react';
|
|
5
|
+
import * as _mantine_core from '@mantine/core';
|
|
6
|
+
import { NavLinkProps } from '@mantine/core';
|
|
7
|
+
import { SemanticAction } from '@doneisbetter/gds-core';
|
|
8
|
+
|
|
9
|
+
interface AppShellProps {
|
|
10
|
+
logoText?: string;
|
|
11
|
+
navLinks?: ReactNode;
|
|
12
|
+
primaryNavigation?: ReactNode;
|
|
13
|
+
secondaryNavigation?: ReactNode;
|
|
14
|
+
accountPanel?: ReactNode;
|
|
15
|
+
headerContext?: ReactNode;
|
|
16
|
+
headerActions?: ReactNode;
|
|
17
|
+
mobileNavigation?: ReactNode;
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* AppShell provides the standard GDS application layout.
|
|
22
|
+
* It strictly controls the header, sidebar, and main content area.
|
|
23
|
+
*/
|
|
24
|
+
declare function AppShell({ logoText, navLinks, primaryNavigation, secondaryNavigation, accountPanel, headerContext, headerActions, mobileNavigation, children, }: AppShellProps): react_jsx_runtime.JSX.Element;
|
|
25
|
+
|
|
26
|
+
interface DataTableColumn<T> {
|
|
27
|
+
key: string;
|
|
28
|
+
label: string;
|
|
29
|
+
render?: (item: T) => ReactNode;
|
|
30
|
+
}
|
|
31
|
+
interface DataTableProps<T> {
|
|
32
|
+
data: T[];
|
|
33
|
+
columns: DataTableColumn<T>[];
|
|
34
|
+
loading?: boolean;
|
|
35
|
+
getRowKey?: (item: T, index: number) => Key;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Standardized Data Table
|
|
39
|
+
*/
|
|
40
|
+
declare function DataTable<T extends Record<string, unknown>>({ data, columns, loading, getRowKey }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
41
|
+
|
|
42
|
+
interface SemanticNavLinkProps extends Omit<NavLinkProps, 'leftSection' | 'label'> {
|
|
43
|
+
action: SemanticAction;
|
|
44
|
+
}
|
|
45
|
+
declare const SemanticNavLink: (<C = "a">(props: _mantine_core.PolymorphicComponentProps<C, SemanticNavLinkProps>) => React.ReactElement) & Omit<React$1.FunctionComponent<(SemanticNavLinkProps & {
|
|
46
|
+
component?: any;
|
|
47
|
+
} & Omit<Omit<any, "ref">, "component" | keyof SemanticNavLinkProps> & {
|
|
48
|
+
ref?: any;
|
|
49
|
+
renderRoot?: (props: any) => any;
|
|
50
|
+
}) | (SemanticNavLinkProps & {
|
|
51
|
+
component: React.ElementType;
|
|
52
|
+
renderRoot?: (props: Record<string, any>) => any;
|
|
53
|
+
})>, never> & Record<string, never>;
|
|
54
|
+
|
|
55
|
+
interface ResponsiveDataViewFilterChip {
|
|
56
|
+
label: string;
|
|
57
|
+
onRemove?: () => void;
|
|
58
|
+
}
|
|
59
|
+
interface ResponsiveDataViewProps<T extends Record<string, unknown>> {
|
|
60
|
+
data: T[];
|
|
61
|
+
columns: DataTableColumn<T>[];
|
|
62
|
+
renderCard: (item: T, index: number) => React__default.ReactNode;
|
|
63
|
+
loading?: boolean;
|
|
64
|
+
error?: string;
|
|
65
|
+
errorAction?: React__default.ReactNode;
|
|
66
|
+
emptyTitle?: string;
|
|
67
|
+
emptyDescription?: string;
|
|
68
|
+
emptyAction?: React__default.ReactNode;
|
|
69
|
+
activeFilters?: ResponsiveDataViewFilterChip[];
|
|
70
|
+
toolbar?: React__default.ReactNode;
|
|
71
|
+
filterDrawer?: React__default.ReactNode;
|
|
72
|
+
mobileFilters?: React__default.ReactNode;
|
|
73
|
+
getRowKey?: (item: T, index: number) => React__default.Key;
|
|
74
|
+
}
|
|
75
|
+
declare function ResponsiveDataView<T extends Record<string, unknown>>({ data, columns, renderCard, loading, error, errorAction, emptyTitle, emptyDescription, emptyAction, activeFilters, toolbar, filterDrawer, mobileFilters, getRowKey, }: ResponsiveDataViewProps<T>): react_jsx_runtime.JSX.Element;
|
|
76
|
+
|
|
77
|
+
interface EditorScaffoldProps {
|
|
78
|
+
header?: ReactNode;
|
|
79
|
+
context?: ReactNode;
|
|
80
|
+
form: ReactNode;
|
|
81
|
+
preview?: ReactNode;
|
|
82
|
+
settings?: ReactNode;
|
|
83
|
+
footer?: ReactNode;
|
|
84
|
+
stickyFooter?: boolean;
|
|
85
|
+
}
|
|
86
|
+
declare function EditorScaffold({ header, context, form, preview, settings, footer, stickyFooter, }: EditorScaffoldProps): react_jsx_runtime.JSX.Element;
|
|
87
|
+
|
|
88
|
+
export { AppShell, type AppShellProps, DataTable, type DataTableColumn, type DataTableProps, EditorScaffold, type EditorScaffoldProps, ResponsiveDataView, type ResponsiveDataViewFilterChip, type ResponsiveDataViewProps, SemanticNavLink, type SemanticNavLinkProps };
|