@wikex/admin-kit 0.5.0 → 0.6.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/CHANGELOG.md +6 -0
- package/README.md +34 -1
- package/dist/{chunk-7FEACJUN.js → chunk-5DJKPKJ6.js} +2 -1
- package/dist/chunk-AEUBQWCG.js +186 -0
- package/dist/index.js +1 -1
- package/dist/minimal/index.d.ts +107 -0
- package/dist/minimal/index.js +132 -0
- package/dist/minimal/provider.d.ts +14 -0
- package/dist/minimal/provider.js +12 -0
- package/dist/starter.js +1 -1
- package/package.json +9 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Các thay đổi đáng chú ý của `@wikex/admin-kit` được ghi tại đây theo Semantic Versioning.
|
|
4
4
|
|
|
5
|
+
## 0.6.0 - 2026-09-13
|
|
6
|
+
|
|
7
|
+
- Tích hợp MUI 7 và Emotion bằng App Router cache provider chính thức cho Next.js 16.
|
|
8
|
+
- Thêm Minimal theme gốc, tự đồng bộ light/dark mode với Payload Admin.
|
|
9
|
+
- Thêm `MinimalDataTable`, `MinimalSelect` và `MinimalBlockCard` cho các màn hình admin custom.
|
|
10
|
+
|
|
5
11
|
## 0.5.0 - 2026-09-13
|
|
6
12
|
|
|
7
13
|
- Hoàn thiện admin shell Minimal với navigation mini/mobile, workspace header và account actions.
|
package/README.md
CHANGED
|
@@ -53,6 +53,39 @@ export const plugins = [
|
|
|
53
53
|
]
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
+
`wikexAdminPlugin` tự đăng ký MUI/Emotion provider của Admin Kit và đồng bộ light/dark
|
|
57
|
+
mode với Payload. Các màn hình custom có thể dùng trực tiếp các primitive Minimal thật:
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
'use client'
|
|
61
|
+
|
|
62
|
+
import {
|
|
63
|
+
MinimalBlockCard,
|
|
64
|
+
MinimalDataTable,
|
|
65
|
+
MinimalSelect,
|
|
66
|
+
} from '@wikex/admin-kit/minimal'
|
|
67
|
+
|
|
68
|
+
export const ProductPanel = () => (
|
|
69
|
+
<MinimalBlockCard label="Catalog" title="Hàng hóa">
|
|
70
|
+
<MinimalSelect
|
|
71
|
+
label="Trạng thái"
|
|
72
|
+
onChange={(value) => console.log(value)}
|
|
73
|
+
options={[{ label: 'Đang bán', value: 'active' }]}
|
|
74
|
+
value="active"
|
|
75
|
+
/>
|
|
76
|
+
<MinimalDataTable
|
|
77
|
+
caption="Danh sách hàng hóa"
|
|
78
|
+
columns={[{ id: 'name', header: 'Tên', render: (row) => row.name }]}
|
|
79
|
+
rowKey="id"
|
|
80
|
+
rows={[{ id: 'gold', name: 'Vàng' }]}
|
|
81
|
+
/>
|
|
82
|
+
</MinimalBlockCard>
|
|
83
|
+
)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Theme dùng palette gốc của Minimal UI (`primary.main = #00A76F`) và không chèn
|
|
87
|
+
`CssBaseline`, nhờ vậy không reset CSS form/document có sẵn của Payload.
|
|
88
|
+
|
|
56
89
|
Live Preview provider của dự án là adapter khai báo route và component khả dụng:
|
|
57
90
|
|
|
58
91
|
```tsx
|
|
@@ -104,7 +137,7 @@ Xem consumer không thuộc lĩnh vực bất động sản tại `examples/corp
|
|
|
104
137
|
## Cài vào dự án khác — một package, một cấu hình
|
|
105
138
|
|
|
106
139
|
```bash
|
|
107
|
-
pnpm add @wikex/admin-kit@0.
|
|
140
|
+
pnpm add @wikex/admin-kit@0.6.0
|
|
108
141
|
```
|
|
109
142
|
|
|
110
143
|
Không cần `.npmrc`, GitLab token hay npm token ở dự án consumer. Các peer dependency
|
|
@@ -107,6 +107,7 @@ var wikexAdminPlugin = (options = {}) => {
|
|
|
107
107
|
const components = admin.components ?? {};
|
|
108
108
|
const beforeDashboard = options.components?.beforeDashboard;
|
|
109
109
|
const provider = options.components?.provider;
|
|
110
|
+
const providers = appendUnique(components.providers, ["@wikex/admin-kit/minimal/provider"]);
|
|
110
111
|
return {
|
|
111
112
|
...config,
|
|
112
113
|
admin: {
|
|
@@ -130,7 +131,7 @@ var wikexAdminPlugin = (options = {}) => {
|
|
|
130
131
|
logout: {
|
|
131
132
|
Button: components.logout?.Button ?? "@wikex/admin-kit/admin/logout-button"
|
|
132
133
|
},
|
|
133
|
-
providers: typeof provider !== "string" ?
|
|
134
|
+
providers: typeof provider !== "string" ? providers : appendUnique(providers, [provider])
|
|
134
135
|
},
|
|
135
136
|
livePreview: admin.livePreview ?? {
|
|
136
137
|
breakpoints: [
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
// src/minimal/MinimalAdminProvider.tsx
|
|
4
|
+
import { AppRouterCacheProvider } from "@mui/material-nextjs/v15-appRouter";
|
|
5
|
+
import { ThemeProvider } from "@mui/material/styles";
|
|
6
|
+
import { useTheme as usePayloadTheme } from "@payloadcms/ui";
|
|
7
|
+
import { useMemo } from "react";
|
|
8
|
+
|
|
9
|
+
// src/minimal/theme.ts
|
|
10
|
+
import { alpha, createTheme } from "@mui/material/styles";
|
|
11
|
+
var grey = {
|
|
12
|
+
50: "#FCFDFD",
|
|
13
|
+
100: "#F9FAFB",
|
|
14
|
+
200: "#F4F6F8",
|
|
15
|
+
300: "#DFE3E8",
|
|
16
|
+
400: "#C4CDD5",
|
|
17
|
+
500: "#919EAB",
|
|
18
|
+
600: "#637381",
|
|
19
|
+
700: "#454F5B",
|
|
20
|
+
800: "#1C252E",
|
|
21
|
+
900: "#141A21"
|
|
22
|
+
};
|
|
23
|
+
var minimalPalette = {
|
|
24
|
+
primary: {
|
|
25
|
+
light: "#5BE49B",
|
|
26
|
+
main: "#00A76F",
|
|
27
|
+
dark: "#007867",
|
|
28
|
+
contrastText: "#FFFFFF"
|
|
29
|
+
},
|
|
30
|
+
secondary: {
|
|
31
|
+
light: "#C684FF",
|
|
32
|
+
main: "#8E33FF",
|
|
33
|
+
dark: "#5119B7",
|
|
34
|
+
contrastText: "#FFFFFF"
|
|
35
|
+
},
|
|
36
|
+
info: {
|
|
37
|
+
light: "#61F3F3",
|
|
38
|
+
main: "#00B8D9",
|
|
39
|
+
dark: "#006C9C",
|
|
40
|
+
contrastText: "#FFFFFF"
|
|
41
|
+
},
|
|
42
|
+
success: {
|
|
43
|
+
light: "#77ED8B",
|
|
44
|
+
main: "#22C55E",
|
|
45
|
+
dark: "#118D57",
|
|
46
|
+
contrastText: "#FFFFFF"
|
|
47
|
+
},
|
|
48
|
+
warning: {
|
|
49
|
+
light: "#FFD666",
|
|
50
|
+
main: "#FFAB00",
|
|
51
|
+
dark: "#B76E00",
|
|
52
|
+
contrastText: grey[800]
|
|
53
|
+
},
|
|
54
|
+
error: {
|
|
55
|
+
light: "#FFAC82",
|
|
56
|
+
main: "#FF5630",
|
|
57
|
+
dark: "#B71D18",
|
|
58
|
+
contrastText: "#FFFFFF"
|
|
59
|
+
},
|
|
60
|
+
grey
|
|
61
|
+
};
|
|
62
|
+
var createMinimalAdminTheme = (mode = "light") => {
|
|
63
|
+
const isDark = mode === "dark";
|
|
64
|
+
return createTheme({
|
|
65
|
+
cssVariables: true,
|
|
66
|
+
palette: {
|
|
67
|
+
mode,
|
|
68
|
+
...minimalPalette,
|
|
69
|
+
background: {
|
|
70
|
+
default: isDark ? "#141A21" : "#FFFFFF",
|
|
71
|
+
paper: isDark ? "#1C252E" : "#FFFFFF"
|
|
72
|
+
},
|
|
73
|
+
divider: alpha(grey[500], 0.2),
|
|
74
|
+
text: {
|
|
75
|
+
primary: isDark ? "#FFFFFF" : grey[800],
|
|
76
|
+
secondary: isDark ? grey[500] : grey[600],
|
|
77
|
+
disabled: grey[500]
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
shape: { borderRadius: 8 },
|
|
81
|
+
typography: {
|
|
82
|
+
fontFamily: "'Public Sans Variable', 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
83
|
+
button: { fontWeight: 700, textTransform: "none" },
|
|
84
|
+
h6: { fontSize: "1.125rem", fontWeight: 700, lineHeight: 1.5 },
|
|
85
|
+
subtitle1: { fontWeight: 600 },
|
|
86
|
+
subtitle2: { fontWeight: 600 },
|
|
87
|
+
body2: { fontSize: "0.875rem", lineHeight: 1.57143 },
|
|
88
|
+
caption: { fontSize: "0.75rem", lineHeight: 1.5 }
|
|
89
|
+
},
|
|
90
|
+
components: {
|
|
91
|
+
MuiButton: {
|
|
92
|
+
defaultProps: { disableElevation: true },
|
|
93
|
+
styleOverrides: {
|
|
94
|
+
root: { borderRadius: 8, minHeight: 36 }
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
MuiCard: {
|
|
98
|
+
defaultProps: { elevation: 0 },
|
|
99
|
+
styleOverrides: {
|
|
100
|
+
root: {
|
|
101
|
+
backgroundImage: "none",
|
|
102
|
+
border: `1px solid ${alpha(grey[500], isDark ? 0.2 : 0.12)}`,
|
|
103
|
+
borderRadius: 16,
|
|
104
|
+
boxShadow: `0 0 2px 0 ${alpha(grey[500], 0.2)}, 0 12px 24px -4px ${alpha(
|
|
105
|
+
grey[500],
|
|
106
|
+
0.12
|
|
107
|
+
)}`
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
MuiCardHeader: {
|
|
112
|
+
styleOverrides: {
|
|
113
|
+
root: { padding: "24px 24px 16px" },
|
|
114
|
+
title: { fontSize: "1rem", fontWeight: 700 },
|
|
115
|
+
subheader: { fontSize: "0.875rem", marginTop: 4 }
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
MuiCardContent: {
|
|
119
|
+
styleOverrides: { root: { padding: 24 } }
|
|
120
|
+
},
|
|
121
|
+
MuiOutlinedInput: {
|
|
122
|
+
styleOverrides: {
|
|
123
|
+
root: {
|
|
124
|
+
borderRadius: 8,
|
|
125
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
|
126
|
+
borderColor: alpha(grey[500], 0.32)
|
|
127
|
+
},
|
|
128
|
+
"&:hover .MuiOutlinedInput-notchedOutline": {
|
|
129
|
+
borderColor: grey[800]
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
MuiTableContainer: {
|
|
135
|
+
styleOverrides: {
|
|
136
|
+
root: {
|
|
137
|
+
border: `1px solid ${alpha(grey[500], 0.16)}`,
|
|
138
|
+
borderRadius: 12
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
MuiTableCell: {
|
|
143
|
+
styleOverrides: {
|
|
144
|
+
root: {
|
|
145
|
+
borderBottom: `1px dashed ${alpha(grey[500], 0.2)}`,
|
|
146
|
+
padding: "16px"
|
|
147
|
+
},
|
|
148
|
+
head: {
|
|
149
|
+
backgroundColor: isDark ? alpha(grey[500], 0.12) : grey[200],
|
|
150
|
+
color: isDark ? grey[400] : grey[600],
|
|
151
|
+
fontSize: "0.875rem",
|
|
152
|
+
fontWeight: 600
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
MuiTableRow: {
|
|
157
|
+
styleOverrides: {
|
|
158
|
+
root: {
|
|
159
|
+
"&:last-child .MuiTableCell-body": { borderBottom: 0 },
|
|
160
|
+
"&:hover": { backgroundColor: alpha(grey[500], 0.06) }
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
// src/minimal/MinimalAdminProvider.tsx
|
|
169
|
+
import { jsx } from "react/jsx-runtime";
|
|
170
|
+
var MinimalThemeProvider = ({ children, mode = "light" }) => {
|
|
171
|
+
const theme = useMemo(() => createMinimalAdminTheme(mode), [mode]);
|
|
172
|
+
return /* @__PURE__ */ jsx(AppRouterCacheProvider, { options: { enableCssLayer: true, key: "wikex-minimal" }, children: /* @__PURE__ */ jsx(ThemeProvider, { theme, children }) });
|
|
173
|
+
};
|
|
174
|
+
var MinimalAdminProvider = ({ children }) => {
|
|
175
|
+
const { theme } = usePayloadTheme();
|
|
176
|
+
return /* @__PURE__ */ jsx(MinimalThemeProvider, { mode: theme === "dark" ? "dark" : "light", children });
|
|
177
|
+
};
|
|
178
|
+
var MinimalAdminProvider_default = MinimalAdminProvider;
|
|
179
|
+
|
|
180
|
+
export {
|
|
181
|
+
minimalPalette,
|
|
182
|
+
createMinimalAdminTheme,
|
|
183
|
+
MinimalThemeProvider,
|
|
184
|
+
MinimalAdminProvider,
|
|
185
|
+
MinimalAdminProvider_default
|
|
186
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
export { MinimalAdminProvider, MinimalThemeProvider, MinimalThemeProviderProps } from './provider.js';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import * as _mui_material from '@mui/material';
|
|
4
|
+
import { CardProps, CardContentProps, TableCellProps, TableProps, FormControlProps, SelectProps } from '@mui/material';
|
|
5
|
+
import { ReactNode, Key } from 'react';
|
|
6
|
+
import { PaletteMode } from '@mui/material/styles';
|
|
7
|
+
|
|
8
|
+
type MinimalBlockCardProps = Omit<CardProps, 'title'> & {
|
|
9
|
+
actions?: ReactNode;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
contentProps?: CardContentProps;
|
|
12
|
+
description?: ReactNode;
|
|
13
|
+
label?: string;
|
|
14
|
+
title: ReactNode;
|
|
15
|
+
};
|
|
16
|
+
declare const MinimalBlockCard: ({ actions, children, contentProps, description, label, title, ...cardProps }: MinimalBlockCardProps) => react_jsx_runtime.JSX.Element;
|
|
17
|
+
|
|
18
|
+
type MinimalTableColumn<Row> = {
|
|
19
|
+
align?: TableCellProps['align'];
|
|
20
|
+
header: ReactNode;
|
|
21
|
+
id: string;
|
|
22
|
+
render: (row: Row, index: number) => ReactNode;
|
|
23
|
+
width?: number | string;
|
|
24
|
+
};
|
|
25
|
+
type MinimalDataTableProps<Row> = {
|
|
26
|
+
caption?: string;
|
|
27
|
+
columns: MinimalTableColumn<Row>[];
|
|
28
|
+
emptyText?: string;
|
|
29
|
+
loading?: boolean;
|
|
30
|
+
maxHeight?: number | string;
|
|
31
|
+
rowKey: keyof Row | ((row: Row, index: number) => Key);
|
|
32
|
+
rows: Row[];
|
|
33
|
+
size?: TableProps['size'];
|
|
34
|
+
stickyHeader?: boolean;
|
|
35
|
+
};
|
|
36
|
+
declare const MinimalDataTable: <Row>({ caption, columns, emptyText, loading, maxHeight, rowKey, rows, size, stickyHeader, }: MinimalDataTableProps<Row>) => react_jsx_runtime.JSX.Element;
|
|
37
|
+
|
|
38
|
+
type MinimalSelectValue = number | string;
|
|
39
|
+
type MinimalSelectOption = {
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
label: string;
|
|
42
|
+
value: MinimalSelectValue;
|
|
43
|
+
};
|
|
44
|
+
type MinimalSelectProps = Omit<FormControlProps, 'onChange'> & {
|
|
45
|
+
helperText?: string;
|
|
46
|
+
label: string;
|
|
47
|
+
onChange: (value: MinimalSelectValue) => void;
|
|
48
|
+
options: MinimalSelectOption[];
|
|
49
|
+
selectProps?: Omit<SelectProps<MinimalSelectValue>, 'label' | 'onChange' | 'value'>;
|
|
50
|
+
value: MinimalSelectValue;
|
|
51
|
+
};
|
|
52
|
+
declare const MinimalSelect: ({ helperText, label, onChange, options, selectProps, value, ...formControlProps }: MinimalSelectProps) => react_jsx_runtime.JSX.Element;
|
|
53
|
+
|
|
54
|
+
declare const minimalPalette: {
|
|
55
|
+
readonly primary: {
|
|
56
|
+
readonly light: "#5BE49B";
|
|
57
|
+
readonly main: "#00A76F";
|
|
58
|
+
readonly dark: "#007867";
|
|
59
|
+
readonly contrastText: "#FFFFFF";
|
|
60
|
+
};
|
|
61
|
+
readonly secondary: {
|
|
62
|
+
readonly light: "#C684FF";
|
|
63
|
+
readonly main: "#8E33FF";
|
|
64
|
+
readonly dark: "#5119B7";
|
|
65
|
+
readonly contrastText: "#FFFFFF";
|
|
66
|
+
};
|
|
67
|
+
readonly info: {
|
|
68
|
+
readonly light: "#61F3F3";
|
|
69
|
+
readonly main: "#00B8D9";
|
|
70
|
+
readonly dark: "#006C9C";
|
|
71
|
+
readonly contrastText: "#FFFFFF";
|
|
72
|
+
};
|
|
73
|
+
readonly success: {
|
|
74
|
+
readonly light: "#77ED8B";
|
|
75
|
+
readonly main: "#22C55E";
|
|
76
|
+
readonly dark: "#118D57";
|
|
77
|
+
readonly contrastText: "#FFFFFF";
|
|
78
|
+
};
|
|
79
|
+
readonly warning: {
|
|
80
|
+
readonly light: "#FFD666";
|
|
81
|
+
readonly main: "#FFAB00";
|
|
82
|
+
readonly dark: "#B76E00";
|
|
83
|
+
readonly contrastText: "#1C252E";
|
|
84
|
+
};
|
|
85
|
+
readonly error: {
|
|
86
|
+
readonly light: "#FFAC82";
|
|
87
|
+
readonly main: "#FF5630";
|
|
88
|
+
readonly dark: "#B71D18";
|
|
89
|
+
readonly contrastText: "#FFFFFF";
|
|
90
|
+
};
|
|
91
|
+
readonly grey: {
|
|
92
|
+
readonly 50: "#FCFDFD";
|
|
93
|
+
readonly 100: "#F9FAFB";
|
|
94
|
+
readonly 200: "#F4F6F8";
|
|
95
|
+
readonly 300: "#DFE3E8";
|
|
96
|
+
readonly 400: "#C4CDD5";
|
|
97
|
+
readonly 500: "#919EAB";
|
|
98
|
+
readonly 600: "#637381";
|
|
99
|
+
readonly 700: "#454F5B";
|
|
100
|
+
readonly 800: "#1C252E";
|
|
101
|
+
readonly 900: "#141A21";
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
declare const createMinimalAdminTheme: (mode?: PaletteMode) => _mui_material.Theme;
|
|
105
|
+
type MinimalAdminTheme = ReturnType<typeof createMinimalAdminTheme>;
|
|
106
|
+
|
|
107
|
+
export { type MinimalAdminTheme, MinimalBlockCard, type MinimalBlockCardProps, MinimalDataTable, type MinimalDataTableProps, MinimalSelect, type MinimalSelectOption, type MinimalSelectProps, type MinimalSelectValue, type MinimalTableColumn, createMinimalAdminTheme, minimalPalette };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use client";
|
|
3
|
+
import {
|
|
4
|
+
MinimalAdminProvider,
|
|
5
|
+
MinimalThemeProvider,
|
|
6
|
+
createMinimalAdminTheme,
|
|
7
|
+
minimalPalette
|
|
8
|
+
} from "../chunk-AEUBQWCG.js";
|
|
9
|
+
|
|
10
|
+
// src/minimal/MinimalBlockCard.tsx
|
|
11
|
+
import {
|
|
12
|
+
Card,
|
|
13
|
+
CardContent,
|
|
14
|
+
CardHeader,
|
|
15
|
+
Chip,
|
|
16
|
+
Divider,
|
|
17
|
+
Stack
|
|
18
|
+
} from "@mui/material";
|
|
19
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
20
|
+
var MinimalBlockCard = ({
|
|
21
|
+
actions,
|
|
22
|
+
children,
|
|
23
|
+
contentProps,
|
|
24
|
+
description,
|
|
25
|
+
label,
|
|
26
|
+
title,
|
|
27
|
+
...cardProps
|
|
28
|
+
}) => /* @__PURE__ */ jsxs(Card, { ...cardProps, children: [
|
|
29
|
+
/* @__PURE__ */ jsx(
|
|
30
|
+
CardHeader,
|
|
31
|
+
{
|
|
32
|
+
action: actions,
|
|
33
|
+
subheader: description,
|
|
34
|
+
title: /* @__PURE__ */ jsxs(Stack, { alignItems: "center", direction: "row", spacing: 1, children: [
|
|
35
|
+
/* @__PURE__ */ jsx("span", { children: title }),
|
|
36
|
+
label ? /* @__PURE__ */ jsx(Chip, { color: "primary", label, size: "small" }) : null
|
|
37
|
+
] })
|
|
38
|
+
}
|
|
39
|
+
),
|
|
40
|
+
/* @__PURE__ */ jsx(Divider, {}),
|
|
41
|
+
/* @__PURE__ */ jsx(CardContent, { ...contentProps, children })
|
|
42
|
+
] });
|
|
43
|
+
|
|
44
|
+
// src/minimal/MinimalDataTable.tsx
|
|
45
|
+
import {
|
|
46
|
+
Box,
|
|
47
|
+
CircularProgress,
|
|
48
|
+
Table,
|
|
49
|
+
TableBody,
|
|
50
|
+
TableCell,
|
|
51
|
+
TableContainer,
|
|
52
|
+
TableHead,
|
|
53
|
+
TableRow,
|
|
54
|
+
Typography
|
|
55
|
+
} from "@mui/material";
|
|
56
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
57
|
+
var MinimalDataTable = ({
|
|
58
|
+
caption,
|
|
59
|
+
columns,
|
|
60
|
+
emptyText = "Kh\xF4ng c\xF3 d\u1EEF li\u1EC7u",
|
|
61
|
+
loading = false,
|
|
62
|
+
maxHeight,
|
|
63
|
+
rowKey,
|
|
64
|
+
rows,
|
|
65
|
+
size = "medium",
|
|
66
|
+
stickyHeader = false
|
|
67
|
+
}) => {
|
|
68
|
+
const getRowKey = (row, index) => {
|
|
69
|
+
if (typeof rowKey === "function") return rowKey(row, index);
|
|
70
|
+
return String(row[rowKey]);
|
|
71
|
+
};
|
|
72
|
+
return /* @__PURE__ */ jsx2(TableContainer, { sx: { maxHeight }, children: /* @__PURE__ */ jsxs2(Table, { "aria-label": caption, size, stickyHeader, children: [
|
|
73
|
+
caption ? /* @__PURE__ */ jsx2("caption", { children: caption }) : null,
|
|
74
|
+
/* @__PURE__ */ jsx2(TableHead, { children: /* @__PURE__ */ jsx2(TableRow, { children: columns.map((column) => /* @__PURE__ */ jsx2(TableCell, { align: column.align, sx: { width: column.width }, children: column.header }, column.id)) }) }),
|
|
75
|
+
/* @__PURE__ */ jsxs2(TableBody, { children: [
|
|
76
|
+
loading ? /* @__PURE__ */ jsx2(TableRow, { children: /* @__PURE__ */ jsx2(TableCell, { colSpan: columns.length, children: /* @__PURE__ */ jsx2(Box, { alignItems: "center", display: "flex", justifyContent: "center", minHeight: 120, children: /* @__PURE__ */ jsx2(CircularProgress, { "aria-label": "\u0110ang t\u1EA3i d\u1EEF li\u1EC7u", size: 28 }) }) }) }) : null,
|
|
77
|
+
!loading && rows.length === 0 ? /* @__PURE__ */ jsx2(TableRow, { children: /* @__PURE__ */ jsx2(TableCell, { colSpan: columns.length, children: /* @__PURE__ */ jsx2(Typography, { color: "text.secondary", sx: { py: 4, textAlign: "center" }, variant: "body2", children: emptyText }) }) }) : null,
|
|
78
|
+
!loading ? rows.map((row, rowIndex) => /* @__PURE__ */ jsx2(TableRow, { children: columns.map((column) => /* @__PURE__ */ jsx2(TableCell, { align: column.align, children: column.render(row, rowIndex) }, column.id)) }, getRowKey(row, rowIndex))) : null
|
|
79
|
+
] })
|
|
80
|
+
] }) });
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// src/minimal/MinimalSelect.tsx
|
|
84
|
+
import {
|
|
85
|
+
FormControl,
|
|
86
|
+
FormHelperText,
|
|
87
|
+
InputLabel,
|
|
88
|
+
MenuItem,
|
|
89
|
+
Select
|
|
90
|
+
} from "@mui/material";
|
|
91
|
+
import { useId } from "react";
|
|
92
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
93
|
+
var MinimalSelect = ({
|
|
94
|
+
helperText,
|
|
95
|
+
label,
|
|
96
|
+
onChange,
|
|
97
|
+
options,
|
|
98
|
+
selectProps,
|
|
99
|
+
value,
|
|
100
|
+
...formControlProps
|
|
101
|
+
}) => {
|
|
102
|
+
const fieldId = useId();
|
|
103
|
+
const labelId = `${fieldId}-label`;
|
|
104
|
+
const handleChange = (event) => {
|
|
105
|
+
onChange(event.target.value);
|
|
106
|
+
};
|
|
107
|
+
return /* @__PURE__ */ jsxs3(FormControl, { fullWidth: true, size: "small", ...formControlProps, children: [
|
|
108
|
+
/* @__PURE__ */ jsx3(InputLabel, { id: labelId, children: label }),
|
|
109
|
+
/* @__PURE__ */ jsx3(
|
|
110
|
+
Select,
|
|
111
|
+
{
|
|
112
|
+
...selectProps,
|
|
113
|
+
id: fieldId,
|
|
114
|
+
label,
|
|
115
|
+
labelId,
|
|
116
|
+
onChange: handleChange,
|
|
117
|
+
value,
|
|
118
|
+
children: options.map((option) => /* @__PURE__ */ jsx3(MenuItem, { disabled: option.disabled, value: option.value, children: option.label }, option.value))
|
|
119
|
+
}
|
|
120
|
+
),
|
|
121
|
+
helperText ? /* @__PURE__ */ jsx3(FormHelperText, { children: helperText }) : null
|
|
122
|
+
] });
|
|
123
|
+
};
|
|
124
|
+
export {
|
|
125
|
+
MinimalAdminProvider,
|
|
126
|
+
MinimalBlockCard,
|
|
127
|
+
MinimalDataTable,
|
|
128
|
+
MinimalSelect,
|
|
129
|
+
MinimalThemeProvider,
|
|
130
|
+
createMinimalAdminTheme,
|
|
131
|
+
minimalPalette
|
|
132
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type MinimalThemeProviderProps = {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
mode?: 'dark' | 'light';
|
|
7
|
+
};
|
|
8
|
+
declare const MinimalThemeProvider: ({ children, mode }: MinimalThemeProviderProps) => react_jsx_runtime.JSX.Element;
|
|
9
|
+
/** Keeps MUI's color mode aligned with Payload's light/dark theme setting. */
|
|
10
|
+
declare const MinimalAdminProvider: ({ children }: {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { MinimalAdminProvider, MinimalThemeProvider, type MinimalThemeProviderProps, MinimalAdminProvider as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use client";
|
|
3
|
+
import {
|
|
4
|
+
MinimalAdminProvider,
|
|
5
|
+
MinimalAdminProvider_default,
|
|
6
|
+
MinimalThemeProvider
|
|
7
|
+
} from "../chunk-AEUBQWCG.js";
|
|
8
|
+
export {
|
|
9
|
+
MinimalAdminProvider,
|
|
10
|
+
MinimalThemeProvider,
|
|
11
|
+
MinimalAdminProvider_default as default
|
|
12
|
+
};
|
package/dist/starter.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wikex/admin-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Reusable Payload CMS admin shell, visual editor and typography tools for Wikex projects",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"private": false,
|
|
@@ -20,6 +20,12 @@
|
|
|
20
20
|
"registry": "https://registry.npmjs.org/"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
+
"@emotion/cache": "11.14.0",
|
|
24
|
+
"@emotion/react": "11.14.0",
|
|
25
|
+
"@emotion/server": "11.11.0",
|
|
26
|
+
"@emotion/styled": "11.14.1",
|
|
27
|
+
"@mui/material": "7.3.6",
|
|
28
|
+
"@mui/material-nextjs": "7.3.6",
|
|
23
29
|
"@wikex/content-kit": "^0.1.1"
|
|
24
30
|
},
|
|
25
31
|
"exports": {
|
|
@@ -33,6 +39,8 @@
|
|
|
33
39
|
"./admin/theme-toggle": "./dist/admin/theme-toggle.js",
|
|
34
40
|
"./admin/view-site": "./dist/admin/view-site.js",
|
|
35
41
|
"./live-preview": "./dist/live-preview.js",
|
|
42
|
+
"./minimal": "./dist/minimal/index.js",
|
|
43
|
+
"./minimal/provider": "./dist/minimal/provider.js",
|
|
36
44
|
"./project": "./dist/project.js",
|
|
37
45
|
"./rich-text": "./dist/rich-text.js",
|
|
38
46
|
"./rich-text/client": "./dist/rich-text-client.js",
|