@luminix/mui-cms 0.2.13 → 1.0.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/docs/tipos.md ADDED
@@ -0,0 +1,238 @@
1
+ # Referência de tipos
2
+
3
+ Todos os tipos abaixo são exportados de `@luminix/mui-cms`.
4
+
5
+ ---
6
+
7
+ ## Ações
8
+
9
+ ### StaticAction
10
+
11
+ ```ts
12
+ type StaticAction = {
13
+ key?: string;
14
+ label: string;
15
+ icon?: React.ReactNode;
16
+ callback: (e: ActionCallbackEvent) => void;
17
+ };
18
+ ```
19
+
20
+ ### InstanceAction
21
+
22
+ ```ts
23
+ type InstanceAction = {
24
+ key?: string;
25
+ label: string;
26
+ icon?: React.ReactNode;
27
+ callback: (e: InstanceActionCallbackEvent) => void;
28
+ };
29
+ ```
30
+
31
+ ### MassAction
32
+
33
+ ```ts
34
+ type MassAction = {
35
+ key: string; // obrigatório
36
+ label: string;
37
+ callback: (e: MassActionCallbackEvent) => void;
38
+ };
39
+ ```
40
+
41
+ ### ActionCallbackEvent
42
+
43
+ ```ts
44
+ type ActionCallbackEvent = {
45
+ navigate: (path: string) => void;
46
+ refresh: () => void;
47
+ notify: NotifyFunction;
48
+ dialog: DialogFunction;
49
+ t: TFunction; // i18next
50
+ };
51
+ ```
52
+
53
+ ### InstanceActionCallbackEvent
54
+
55
+ ```ts
56
+ type InstanceActionCallbackEvent = ActionCallbackEvent & {
57
+ item: ModelType;
58
+ };
59
+ ```
60
+
61
+ ### MassActionCallbackEvent
62
+
63
+ ```ts
64
+ type MassActionCallbackEvent = ActionCallbackEvent & {
65
+ selected: Collection<ModelType>;
66
+ };
67
+ ```
68
+
69
+ ---
70
+
71
+ ## Tabela
72
+
73
+ ### Column
74
+
75
+ Estende `TableCellProps` do MUI:
76
+
77
+ ```ts
78
+ type Column = TableCellProps & {
79
+ key: string;
80
+ label: string;
81
+ sortable?: boolean;
82
+ };
83
+ ```
84
+
85
+ ---
86
+
87
+ ## Rotas
88
+
89
+ ### RouteObject
90
+
91
+ Re-exportado de `react-router-dom`. Use para tipar rotas adicionadas via redutor `cmsRoutes`:
92
+
93
+ ```ts
94
+ import type { RouteObject } from '@luminix/mui-cms';
95
+ ```
96
+
97
+ ---
98
+
99
+ ## Configuração
100
+
101
+ ### CmsConfig
102
+
103
+ ```ts
104
+ type CmsConfig = {
105
+ layout?: {
106
+ breakpoint?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
107
+ drawer?: {
108
+ width?: number;
109
+ };
110
+ appBar?: {
111
+ height?: number;
112
+ color?: string;
113
+ };
114
+ };
115
+ };
116
+ ```
117
+
118
+ ---
119
+
120
+ ## Componente LuminixCms
121
+
122
+ ### LuminixCmsProps
123
+
124
+ ```ts
125
+ type LuminixCmsProps = Partial<LuminixProviderProps> & {
126
+ theme?: ThemeOptions; // MUI ThemeOptions
127
+ themeArgs?: object[]; // argumentos adicionais para createTheme()
128
+ };
129
+ ```
130
+
131
+ `LuminixProviderProps` vem de `@luminix/react`. Consulte a documentação desse pacote para ver as props herdadas.
132
+
133
+ ---
134
+
135
+ ## Filtros
136
+
137
+ ### FilterColumn
138
+
139
+ Representa uma coluna disponível para filtragem:
140
+
141
+ ```ts
142
+ type FilterColumn = {
143
+ key: string;
144
+ label: string;
145
+ type: string; // tipo do atributo (int, date, text, autocomplete, ...)
146
+ nullable: boolean;
147
+ is_relation: boolean;
148
+ };
149
+ ```
150
+
151
+ ### FilteredColumn
152
+
153
+ Estado de uma linha ativa no painel de filtros:
154
+
155
+ ```ts
156
+ type FilteredColumn = {
157
+ key: string;
158
+ type: string;
159
+ operator: string;
160
+ value: unknown;
161
+ };
162
+ ```
163
+
164
+ ---
165
+
166
+ ## Notificações
167
+
168
+ ### NotifyFunction
169
+
170
+ ```ts
171
+ type NotifyFunction = (notification: string | Notification) => void;
172
+ ```
173
+
174
+ ### Notification
175
+
176
+ ```ts
177
+ type Notification = {
178
+ message: React.ReactNode;
179
+ severity?: 'success' | 'error' | 'warning' | 'info';
180
+ title?: React.ReactNode;
181
+ actions?: NotificationAction[];
182
+ };
183
+
184
+ type NotificationAction = {
185
+ label: React.ReactNode;
186
+ callback: () => void;
187
+ };
188
+ ```
189
+
190
+ ---
191
+
192
+ ## Diálogos
193
+
194
+ ### DialogFunction
195
+
196
+ ```ts
197
+ type DialogFunction = (message: string | DialogMessage) => Promise<boolean | string>;
198
+ ```
199
+
200
+ ### DialogMessage
201
+
202
+ ```ts
203
+ type DialogMessage = {
204
+ title?: React.ReactNode;
205
+ message: React.ReactNode;
206
+ type?: 'alert' | 'confirm' | 'prompt';
207
+ dismissable?: boolean;
208
+ confirmText?: string;
209
+ cancelText?: string;
210
+ defaultValue?: string;
211
+ dialogProps?: Partial<DialogProps>;
212
+ textFieldProps?: Partial<TextFieldProps>;
213
+ };
214
+ ```
215
+
216
+ ---
217
+
218
+ ## Menu
219
+
220
+ ### MenuItem
221
+
222
+ ```ts
223
+ type MenuItem = {
224
+ key: string;
225
+ text: string;
226
+ to?: string;
227
+ icon?: React.ReactNode;
228
+ children?: MenuItem[];
229
+ };
230
+ ```
231
+
232
+ ---
233
+
234
+ ## Próximos passos
235
+
236
+ - [Ações](acoes.md) — como usar esses tipos na prática
237
+ - [Extensibilidade](extensibilidade.md) — redutores e customizações
238
+ - [Volta ao índice](index.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luminix/mui-cms",
3
- "version": "0.2.13",
3
+ "version": "1.0.0",
4
4
  "type": "module",
5
5
  "main": "bundle/mui-cms.js",
6
6
  "module": "dist/mui-cms.js",
@@ -12,15 +12,18 @@
12
12
  "build:dist": "tsc && vite build",
13
13
  "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
14
14
  "preview": "vite preview",
15
+ "test": "vitest run",
16
+ "test:coverage": "vitest run --coverage",
17
+ "test:watch": "vitest",
15
18
  "publish:beta": "npm run build && npm publish --tag beta"
16
19
  },
17
20
  "peerDependencies": {
18
21
  "@emotion/react": "^11.13.0",
19
22
  "@emotion/styled": "^11.13.0",
20
23
  "@fontsource/roboto": "^5.0.12",
21
- "@luminix/core": "^0.4.0",
22
- "@luminix/react": "^0.4.0",
23
- "@luminix/support": "^0.4.9",
24
+ "@luminix/core": "^1.0.0",
25
+ "@luminix/react": "^1.0.0",
26
+ "@luminix/support": "^1.0.1",
24
27
  "@mui/icons-material": "^5.16.5",
25
28
  "@mui/material": "^5.16.5",
26
29
  "i18next": "^23.12.2",
@@ -30,17 +33,24 @@
30
33
  "react-router-dom": "6.25.1"
31
34
  },
32
35
  "devDependencies": {
36
+ "@testing-library/jest-dom": "^6.9.1",
37
+ "@testing-library/react": "^16.3.2",
38
+ "@testing-library/user-event": "^14.6.1",
39
+ "@types/node": "^25.8.0",
33
40
  "@types/react": "^18.3.3",
34
41
  "@types/react-dom": "^18.3.0",
35
42
  "@typescript-eslint/eslint-plugin": "^7.2.0",
36
43
  "@typescript-eslint/parser": "^7.2.0",
37
44
  "@vitejs/plugin-react": "^4.2.1",
45
+ "@vitest/coverage-v8": "^4.1.6",
38
46
  "eslint": "^8.57.0",
39
47
  "eslint-plugin-react-hooks": "^4.6.0",
40
48
  "eslint-plugin-react-refresh": "^0.4.6",
49
+ "jsdom": "^29.1.1",
41
50
  "terser": "^5.31.6",
42
51
  "typescript": "^5.2.2",
43
52
  "vite": "^5.2.0",
44
- "vite-plugin-dts": "^4.0.3"
53
+ "vite-plugin-dts": "^4.0.3",
54
+ "vitest": "^4.1.6"
45
55
  }
46
56
  }
package/tsconfig.json CHANGED
@@ -21,5 +21,6 @@
21
21
  "noFallthroughCasesInSwitch": true
22
22
  },
23
23
  "include": ["src"],
24
+ "exclude": ["src/__tests__"],
24
25
  "references": [{ "path": "./tsconfig.node.json" }]
25
26
  }
@@ -0,0 +1,16 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "skipLibCheck": true,
5
+ "moduleResolution": "bundler",
6
+ "noUnusedLocals": false,
7
+ "noUnusedParameters": false,
8
+ "types": [
9
+ "vite/client",
10
+ "vitest/globals",
11
+ "@testing-library/jest-dom"
12
+ ]
13
+ },
14
+ "include": ["src"],
15
+ "exclude": []
16
+ }
@@ -0,0 +1,22 @@
1
+ import { defineConfig } from 'vitest/config';
2
+ import { resolve } from 'path';
3
+
4
+ export default defineConfig({
5
+ resolve: {
6
+ alias: {
7
+ '@luminix/react': resolve(__dirname, 'node_modules/@luminix/react/dist/react.js'),
8
+ '@luminix/core': resolve(__dirname, 'node_modules/@luminix/core/dist/core.js'),
9
+ '@luminix/support': resolve(__dirname, 'node_modules/@luminix/support/dist/support.js'),
10
+ },
11
+ },
12
+ test: {
13
+ environment: 'jsdom',
14
+ globals: true,
15
+ setupFiles: ['./src/__tests__/setup.ts'],
16
+ coverage: {
17
+ provider: 'v8',
18
+ include: ['src/**/*.{ts,tsx}'],
19
+ exclude: ['src/__tests__/**', 'src/**/*.d.ts', 'src/main.tsx'],
20
+ },
21
+ },
22
+ });
File without changes