@grazziotin/react-components-next 1.0.0 → 2.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/README.md +184 -105
- package/dist/accessibility/index.d.mts +136 -0
- package/dist/accessibility/index.d.ts +136 -0
- package/dist/accessibility/index.js +138 -0
- package/dist/accessibility/index.js.map +1 -0
- package/dist/accessibility/index.mjs +127 -0
- package/dist/accessibility/index.mjs.map +1 -0
- package/dist/chunk-BWW3F4R4.mjs +118 -0
- package/dist/chunk-BWW3F4R4.mjs.map +1 -0
- package/dist/functions/index.d.mts +36 -1
- package/dist/functions/index.d.ts +36 -1
- package/dist/functions/index.js +36 -0
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/index.mjs +1 -1
- package/dist/index.css +1 -1
- package/dist/ui/index.d.mts +301 -6
- package/dist/ui/index.d.ts +301 -6
- package/dist/ui/index.js +852 -2
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/index.mjs +873 -2
- package/dist/ui/index.mjs.map +1 -1
- package/package.json +9 -11
- package/dist/chunk-CNXFSE26.mjs +0 -120
- package/dist/chunk-CNXFSE26.mjs.map +0 -1
- package/dist/chunk-NHHZBMJL.mjs +0 -64
- package/dist/chunk-NHHZBMJL.mjs.map +0 -1
- package/dist/index.d.mts +0 -5
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -217
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -29
- package/dist/index.mjs.map +0 -1
package/dist/ui/index.js
CHANGED
|
@@ -9,6 +9,12 @@ var DialogMui = require('@mui/material/Dialog');
|
|
|
9
9
|
var DialogTitle = require('@mui/material/DialogTitle');
|
|
10
10
|
var DialogActions = require('@mui/material/DialogActions');
|
|
11
11
|
var DialogContent = require('@mui/material/DialogContent');
|
|
12
|
+
var locales = require('@mui/x-data-grid/locales');
|
|
13
|
+
var xDataGrid = require('@mui/x-data-grid');
|
|
14
|
+
var react = require('react');
|
|
15
|
+
var md = require('react-icons/md');
|
|
16
|
+
var Autocomplete = require('@mui/material/Autocomplete');
|
|
17
|
+
var fa = require('react-icons/fa');
|
|
12
18
|
|
|
13
19
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
20
|
|
|
@@ -16,8 +22,11 @@ var DialogMui__default = /*#__PURE__*/_interopDefault(DialogMui);
|
|
|
16
22
|
var DialogTitle__default = /*#__PURE__*/_interopDefault(DialogTitle);
|
|
17
23
|
var DialogActions__default = /*#__PURE__*/_interopDefault(DialogActions);
|
|
18
24
|
var DialogContent__default = /*#__PURE__*/_interopDefault(DialogContent);
|
|
25
|
+
var Autocomplete__default = /*#__PURE__*/_interopDefault(Autocomplete);
|
|
19
26
|
|
|
20
27
|
var __defProp = Object.defineProperty;
|
|
28
|
+
var __defProps = Object.defineProperties;
|
|
29
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
21
30
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
22
31
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
23
32
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -33,9 +42,94 @@ var __spreadValues = (a, b) => {
|
|
|
33
42
|
}
|
|
34
43
|
return a;
|
|
35
44
|
};
|
|
45
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
46
|
+
var __objRest = (source, exclude) => {
|
|
47
|
+
var target = {};
|
|
48
|
+
for (var prop in source)
|
|
49
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
50
|
+
target[prop] = source[prop];
|
|
51
|
+
if (source != null && __getOwnPropSymbols)
|
|
52
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
53
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
54
|
+
target[prop] = source[prop];
|
|
55
|
+
}
|
|
56
|
+
return target;
|
|
57
|
+
};
|
|
36
58
|
function cn(...values) {
|
|
37
59
|
return tailwindMerge.twMerge(clsx.clsx(values));
|
|
38
60
|
}
|
|
61
|
+
|
|
62
|
+
// src/core/remove-digits.ts
|
|
63
|
+
function removeDigits(value) {
|
|
64
|
+
return value.replace(/\D/g, "");
|
|
65
|
+
}
|
|
66
|
+
function removeNonDigits(value) {
|
|
67
|
+
return value.replaceAll(/\d/g, "");
|
|
68
|
+
}
|
|
69
|
+
function removeTextOnly(value) {
|
|
70
|
+
return value.replaceAll(/[^\p{L}]/gu, "");
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// src/functions/format-cpf-cnpj/format-cpf-cnpj.ts
|
|
74
|
+
function formatCpfCnpj(data) {
|
|
75
|
+
if (!data) return "";
|
|
76
|
+
const value = removeDigits(data);
|
|
77
|
+
if (!value) return "";
|
|
78
|
+
if (value.length <= 11) {
|
|
79
|
+
const cpf = value.slice(0, 11);
|
|
80
|
+
return cpf.replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d{1,2})$/, "$1-$2");
|
|
81
|
+
}
|
|
82
|
+
const cnpj = value.slice(0, 14);
|
|
83
|
+
return cnpj.replace(/^(\d{2})(\d)/, "$1.$2").replace(/^(\d{2})\.(\d{3})(\d)/, "$1.$2.$3").replace(/\.(\d{3})(\d)/, ".$1/$2").replace(/(\d{4})(\d)/, "$1-$2");
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// src/functions/format-phone-br/format-phone-br.ts
|
|
87
|
+
function formatPhoneBr(phone) {
|
|
88
|
+
if (!phone) return "";
|
|
89
|
+
const digits = removeDigits(phone).slice(0, 11);
|
|
90
|
+
if (!digits) return "";
|
|
91
|
+
if (digits.length <= 2) return digits;
|
|
92
|
+
if (digits.length <= 6) {
|
|
93
|
+
return digits.replace(/(\d{2})(\d+)/, "($1) $2");
|
|
94
|
+
}
|
|
95
|
+
if (digits.length <= 10) {
|
|
96
|
+
return digits.replace(/(\d{2})(\d{4})(\d+)/, "($1) $2-$3");
|
|
97
|
+
}
|
|
98
|
+
return digits.replace(/(\d{2})(\d{5})(\d+)/, "($1) $2-$3");
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// src/functions/format-price-brl/format-price-brl.ts
|
|
102
|
+
function formatPriceBrl(value) {
|
|
103
|
+
if (value === void 0 || value === null) return "";
|
|
104
|
+
if (typeof value === "string") {
|
|
105
|
+
const digits = removeDigits(value);
|
|
106
|
+
if (!digits) return "";
|
|
107
|
+
const price = Number(digits) / 100;
|
|
108
|
+
if (Number.isNaN(price)) return "";
|
|
109
|
+
return price.toLocaleString("pt-BR", {
|
|
110
|
+
style: "currency",
|
|
111
|
+
currency: "BRL"
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
if (Number.isNaN(value)) return "";
|
|
115
|
+
return value.toLocaleString("pt-BR", { style: "currency", currency: "BRL" });
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// src/functions/format-item-170/format-item-170.ts
|
|
119
|
+
function formatItem170(item) {
|
|
120
|
+
if (!item) return "";
|
|
121
|
+
const digits = removeDigits(item).slice(0, 12);
|
|
122
|
+
if (!digits) return "";
|
|
123
|
+
return digits.replace(/(\d{2})(\d)/, "$1.$2").replace(/(\d{2})(\d)/, "$1.$2").replace(/(\d{2})(\d)/, "$1.$2").replace(/(\d{2})(\d)/, "$1.$2").replace(/(\d{2})\.(\d)(\d{1,3})$/, "$1.$2.$3");
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// src/functions/format-item-150/format-item-150.ts
|
|
127
|
+
function formatItem150(item) {
|
|
128
|
+
if (!item) return "";
|
|
129
|
+
const digits = removeDigits(item).slice(0, 10);
|
|
130
|
+
if (!digits) return "";
|
|
131
|
+
return digits.replace(/(\d{2})(\d)/, "$1.$2").replace(/(\d{2})(\d)/, "$1.$2").replace(/(\d{2})(\d)/, "$1.$2").replace(/(\d{2})\.(\d)(\d{1,3})$/, "$1.$2.$3");
|
|
132
|
+
}
|
|
39
133
|
function Card({
|
|
40
134
|
margin,
|
|
41
135
|
onClick,
|
|
@@ -49,7 +143,7 @@ function Card({
|
|
|
49
143
|
height = "auto",
|
|
50
144
|
titleWidth = "100%",
|
|
51
145
|
justifyContent = "space-between",
|
|
52
|
-
titleColor = "var(--color
|
|
146
|
+
titleColor = "var(--primary-color)",
|
|
53
147
|
icon
|
|
54
148
|
}) {
|
|
55
149
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -116,6 +210,12 @@ var DIALOG_BACKDROP_STYLE = {
|
|
|
116
210
|
backdropFilter: "blur(4px)",
|
|
117
211
|
backgroundColor: "rgba(0, 0, 0, 0.5)"
|
|
118
212
|
};
|
|
213
|
+
var DIALOG_PAPER_FONT_SX = {
|
|
214
|
+
fontFamily: "var(--font-family, inherit) !important",
|
|
215
|
+
"& .MuiDialogTitle-root, & .MuiDialogContent-root, & .MuiDialogActions-root, & .MuiTypography-root": {
|
|
216
|
+
fontFamily: "inherit !important"
|
|
217
|
+
}
|
|
218
|
+
};
|
|
119
219
|
function Dialog({
|
|
120
220
|
open,
|
|
121
221
|
title,
|
|
@@ -133,7 +233,10 @@ function Dialog({
|
|
|
133
233
|
open,
|
|
134
234
|
onClose,
|
|
135
235
|
maxWidth,
|
|
136
|
-
slotProps: {
|
|
236
|
+
slotProps: {
|
|
237
|
+
backdrop: { sx: backdropStyle },
|
|
238
|
+
paper: { sx: DIALOG_PAPER_FONT_SX }
|
|
239
|
+
},
|
|
137
240
|
children: [
|
|
138
241
|
title && /* @__PURE__ */ jsxRuntime.jsx(DialogTitle__default.default, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold text-black-de", children: title }) }),
|
|
139
242
|
/* @__PURE__ */ jsxRuntime.jsx(DialogContent__default.default, { className: "text-black", children }),
|
|
@@ -143,8 +246,755 @@ function Dialog({
|
|
|
143
246
|
);
|
|
144
247
|
}
|
|
145
248
|
var dialog_default = Dialog;
|
|
249
|
+
var localeText = __spreadProps(__spreadValues({}, locales.ptBR.components.MuiDataGrid.defaultProps.localeText), {
|
|
250
|
+
noColumnsOverlayLabel: "Nenhuma coluna dispon\xEDvel",
|
|
251
|
+
noColumnsOverlayManageColumns: "Gerenciar colunas",
|
|
252
|
+
columnsManagementSearchTitle: "Buscar coluna",
|
|
253
|
+
columnsManagementNoColumns: "Nenhuma coluna para mostrar",
|
|
254
|
+
columnsManagementShowHideAllText: "Mostrar/Ocultar todas",
|
|
255
|
+
columnsManagementReset: "Redefinir",
|
|
256
|
+
columnsManagementDeleteIconLabel: "Excluir",
|
|
257
|
+
columnMenuManageColumns: "Gerenciar colunas",
|
|
258
|
+
columnMenuShowColumns: "Mostrar colunas",
|
|
259
|
+
columnMenuLabel: "Menu da coluna",
|
|
260
|
+
columnMenuHideColumn: "Ocultar",
|
|
261
|
+
columnMenuUnsort: "Remover ordena\xE7\xE3o",
|
|
262
|
+
columnMenuSortAsc: "Ordenar ASC",
|
|
263
|
+
columnMenuSortDesc: "Ordenar DESC",
|
|
264
|
+
columnMenuFilter: "Filtrar",
|
|
265
|
+
toolbarQuickFilterLabel: "Filtro r\xE1pido",
|
|
266
|
+
toolbarQuickFilterPlaceholder: "Filtrar\u2026",
|
|
267
|
+
toolbarQuickFilterDeleteIconLabel: "Limpar filtro",
|
|
268
|
+
toolbarExport: "Exportar",
|
|
269
|
+
toolbarExportLabel: "Exportar",
|
|
270
|
+
toolbarExportCSV: "Baixar como CSV",
|
|
271
|
+
toolbarExportPrint: "Imprimir",
|
|
272
|
+
toolbarColumns: "Colunas",
|
|
273
|
+
toolbarColumnsLabel: "Selecionar colunas",
|
|
274
|
+
toolbarFilters: "Filtros",
|
|
275
|
+
toolbarFiltersLabel: "Mostrar filtros",
|
|
276
|
+
toolbarFiltersTooltipHide: "Ocultar filtros",
|
|
277
|
+
toolbarFiltersTooltipShow: "Mostrar filtros",
|
|
278
|
+
toolbarFiltersTooltipActive: (count) => count === 1 ? `${count} filtro ativo` : `${count} filtros ativos`,
|
|
279
|
+
toolbarDensity: "Densidade",
|
|
280
|
+
toolbarDensityLabel: "Densidade",
|
|
281
|
+
toolbarDensityCompact: "Compacta",
|
|
282
|
+
toolbarDensityStandard: "Padr\xE3o",
|
|
283
|
+
toolbarDensityComfortable: "Confort\xE1vel",
|
|
284
|
+
filterPanelAddFilter: "Adicionar filtro",
|
|
285
|
+
filterPanelDeleteIconLabel: "Excluir",
|
|
286
|
+
filterPanelOperatorAnd: "E",
|
|
287
|
+
filterPanelOperatorOr: "OU",
|
|
288
|
+
filterPanelColumn: "Colunas",
|
|
289
|
+
filterPanelInputLabel: "Valor",
|
|
290
|
+
filterPanelInputPlaceholder: "Valor do filtro",
|
|
291
|
+
filterOperatorContains: "cont\xE9m",
|
|
292
|
+
filterOperatorEquals: "igual a",
|
|
293
|
+
filterOperatorStartsWith: "come\xE7a com",
|
|
294
|
+
filterOperatorEndsWith: "termina com",
|
|
295
|
+
filterOperatorIs: "\xE9",
|
|
296
|
+
filterOperatorNot: "n\xE3o \xE9",
|
|
297
|
+
filterOperatorAfter: "depois de",
|
|
298
|
+
filterOperatorOnOrAfter: "em ou depois de",
|
|
299
|
+
filterOperatorBefore: "antes de",
|
|
300
|
+
filterOperatorOnOrBefore: "em ou antes de",
|
|
301
|
+
filterOperatorIsEmpty: "est\xE1 vazio",
|
|
302
|
+
filterOperatorIsNotEmpty: "n\xE3o est\xE1 vazio",
|
|
303
|
+
filterOperatorIsAnyOf: "\xE9 qualquer um de",
|
|
304
|
+
footerTotalRows: "Total de linhas:",
|
|
305
|
+
footerRowSelected: (count) => count === 1 ? "1 linha selecionada" : `${count.toLocaleString()} linhas selecionadas`,
|
|
306
|
+
footerTotalVisibleRows: (visibleCount, totalCount) => `${visibleCount.toLocaleString()} de ${totalCount.toLocaleString()}`,
|
|
307
|
+
paginationRowsPerPage: "Linhas por p\xE1gina:",
|
|
308
|
+
paginationItemAriaLabel: (type) => {
|
|
309
|
+
switch (type) {
|
|
310
|
+
case "first":
|
|
311
|
+
return "Primeira p\xE1gina";
|
|
312
|
+
case "last":
|
|
313
|
+
return "\xDAltima p\xE1gina";
|
|
314
|
+
case "next":
|
|
315
|
+
return "Pr\xF3xima p\xE1gina";
|
|
316
|
+
case "previous":
|
|
317
|
+
return "P\xE1gina anterior";
|
|
318
|
+
default:
|
|
319
|
+
return "";
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
noRowsLabel: "Nenhum dado encontrado",
|
|
323
|
+
noResultsOverlayLabel: "Nenhum resultado encontrado",
|
|
324
|
+
checkboxSelectionHeaderName: "Sele\xE7\xE3o de checkbox",
|
|
325
|
+
checkboxSelectionSelectAllRows: "Selecionar todas as linhas",
|
|
326
|
+
checkboxSelectionUnselectAllRows: "Desmarcar todas as linhas",
|
|
327
|
+
checkboxSelectionSelectRow: "Selecionar linha",
|
|
328
|
+
checkboxSelectionUnselectRow: "Desmarcar linha",
|
|
329
|
+
columnHeaderSortIconLabel: "Ordenar",
|
|
330
|
+
groupingColumnHeaderName: "Grupo",
|
|
331
|
+
groupColumn: (name) => `Agrupar por ${name}`,
|
|
332
|
+
unGroupColumn: (name) => `Parar de agrupar por ${name}`,
|
|
333
|
+
detailPanelToggle: "Alternar painel de detalhes",
|
|
334
|
+
expandDetailPanel: "Expandir",
|
|
335
|
+
collapseDetailPanel: "Recolher",
|
|
336
|
+
treeDataGroupingHeaderName: "Grupo",
|
|
337
|
+
treeDataExpand: "ver filhos",
|
|
338
|
+
treeDataCollapse: "ocultar filhos",
|
|
339
|
+
aggregationMenuItemHeader: "Agrega\xE7\xE3o",
|
|
340
|
+
aggregationFunctionLabelSum: "soma",
|
|
341
|
+
aggregationFunctionLabelAvg: "m\xE9dia",
|
|
342
|
+
aggregationFunctionLabelMin: "m\xEDn",
|
|
343
|
+
aggregationFunctionLabelMax: "m\xE1x",
|
|
344
|
+
aggregationFunctionLabelSize: "tamanho",
|
|
345
|
+
paginationDisplayedRows: ({ from, to, count }) => {
|
|
346
|
+
const total = count === -1 ? "mais de " + to : count;
|
|
347
|
+
return `${from}\u2013${to} de ${total}`;
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
var columnPanelSx = {
|
|
351
|
+
padding: 2,
|
|
352
|
+
width: "350px",
|
|
353
|
+
color: "#000000DE"
|
|
354
|
+
};
|
|
355
|
+
var columnMenuSx = {
|
|
356
|
+
"& .MuiListItemText-primary": {
|
|
357
|
+
fontSize: "14px !important"
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
var filterSx = {
|
|
361
|
+
width: "750px",
|
|
362
|
+
"*": { fontSize: "14px !important" },
|
|
363
|
+
"& .MuiDataGrid-filterFormColumnInput": { width: "230px" },
|
|
364
|
+
"& .MuiDataGrid-filterFormOperatorInput": { width: "230px" }
|
|
365
|
+
};
|
|
366
|
+
var paginationSx = {
|
|
367
|
+
"& .MuiTablePagination-root": { fontSize: "12px !important" },
|
|
368
|
+
"& .MuiTablePagination-selectLabel": { fontSize: "12px !important" },
|
|
369
|
+
"& .MuiTablePagination-displayedRows": { fontSize: "12px !important" },
|
|
370
|
+
"& .MuiTablePagination-select": { fontSize: "12px !important" },
|
|
371
|
+
"& .MuiTablePagination-toolbar": {
|
|
372
|
+
minHeight: "40px !important",
|
|
373
|
+
padding: "0 8px !important"
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
var tableSx = {
|
|
377
|
+
fontSize: "13px",
|
|
378
|
+
"& .MuiDataGrid-row:nth-of-type(even)": {
|
|
379
|
+
backgroundColor: "#F9FAFB"
|
|
380
|
+
},
|
|
381
|
+
"& .MuiDataGrid-row:nth-of-type(odd)": {
|
|
382
|
+
backgroundColor: "#FFFFFF"
|
|
383
|
+
},
|
|
384
|
+
"& .MuiDataGrid-row.Mui-selected:nth-of-type(even)": {
|
|
385
|
+
backgroundColor: "#F9FAFB !important"
|
|
386
|
+
},
|
|
387
|
+
"& .MuiDataGrid-row.Mui-selected:nth-of-type(odd)": {
|
|
388
|
+
backgroundColor: "#FFFFFF !important"
|
|
389
|
+
},
|
|
390
|
+
"& .MuiDataGrid-row:hover": { backgroundColor: "#F3F4F6 !important" },
|
|
391
|
+
"& .MuiDataGrid-columnHeaderTitleContainer": {
|
|
392
|
+
color: "#FFFFFF",
|
|
393
|
+
justifyContent: "center",
|
|
394
|
+
"& svg": { color: "#FFFFFF" }
|
|
395
|
+
},
|
|
396
|
+
"& .MuiDataGrid-iconButtonContainer .MuiIconButton-root, & .MuiDataGrid-menuIconButton": {
|
|
397
|
+
color: "#FFFFFF"
|
|
398
|
+
},
|
|
399
|
+
"& .MuiDataGrid-iconButtonContainer .MuiIconButton-root:hover, & .MuiDataGrid-menuIconButton:hover": { backgroundColor: "transparent" },
|
|
400
|
+
"& .MuiDataGrid-iconButtonContainer .MuiIconButton-root.Mui-focusVisible, & .MuiDataGrid-menuIconButton.Mui-focusVisible": { backgroundColor: "transparent" },
|
|
401
|
+
"& .MuiDataGrid-columnHeaders": {
|
|
402
|
+
background: "linear-gradient(to right, #00B2A6 0%, #0AAEB2 100%)"
|
|
403
|
+
},
|
|
404
|
+
"& .MuiDataGrid-columnHeader": {
|
|
405
|
+
color: "#FFFFFF",
|
|
406
|
+
fontWeight: "bold",
|
|
407
|
+
backgroundColor: "transparent",
|
|
408
|
+
"& svg": { color: "#FFFFFF" }
|
|
409
|
+
},
|
|
410
|
+
"& .MuiDataGrid-columnHeader:hover": { backgroundColor: "transparent" },
|
|
411
|
+
"& .MuiDataGrid-columnHeader:hover .MuiIconButton-root": {
|
|
412
|
+
backgroundColor: "transparent"
|
|
413
|
+
},
|
|
414
|
+
"& .MuiDataGrid-columnHeader:focus-within": {
|
|
415
|
+
backgroundColor: "transparent"
|
|
416
|
+
},
|
|
417
|
+
"& .MuiDataGrid-columnHeader--sorted": { backgroundColor: "transparent" },
|
|
418
|
+
"& .MuiDataGrid-columnHeader--sorted .MuiIconButton-root": {
|
|
419
|
+
backgroundColor: "transparent"
|
|
420
|
+
},
|
|
421
|
+
"& .MuiDataGrid-sortIcon": { color: "#FFFFFF" },
|
|
422
|
+
"& .MuiDataGrid-sortIcon:hover": { backgroundColor: "transparent" },
|
|
423
|
+
"& .MuiDataGrid-columnHeaderTitle": { fontWeight: "500", color: "#FFFFFF" }
|
|
424
|
+
};
|
|
425
|
+
var createChange = (item, applyValue) => (index) => ({ target }) => {
|
|
426
|
+
const [start = "", end = ""] = Array.isArray(item.value) ? item.value : [];
|
|
427
|
+
applyValue(__spreadProps(__spreadValues({}, item), {
|
|
428
|
+
value: index === 0 ? [target.value, end] : [start, target.value]
|
|
429
|
+
}));
|
|
430
|
+
};
|
|
431
|
+
var textBetweenOp = {
|
|
432
|
+
label: "entre",
|
|
433
|
+
value: "between",
|
|
434
|
+
getApplyFilterFn: (filter) => {
|
|
435
|
+
if (!filter.value || !Array.isArray(filter.value)) return null;
|
|
436
|
+
const [start, end] = filter.value;
|
|
437
|
+
if (!start || !end) return null;
|
|
438
|
+
return (value) => {
|
|
439
|
+
const cell = (value == null ? void 0 : value.toString()) || "";
|
|
440
|
+
return cell >= start && cell <= end;
|
|
441
|
+
};
|
|
442
|
+
},
|
|
443
|
+
InputComponent: ({ item, applyValue, focusElementRef }) => {
|
|
444
|
+
const onChange = createChange(item, applyValue);
|
|
445
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { display: "flex", flexDirection: "column", gap: 1 }, children: [
|
|
446
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
447
|
+
material.TextField,
|
|
448
|
+
{
|
|
449
|
+
size: "small",
|
|
450
|
+
label: "De",
|
|
451
|
+
variant: "outlined",
|
|
452
|
+
inputRef: focusElementRef,
|
|
453
|
+
value: (item.value || ["", ""])[0] || "",
|
|
454
|
+
onChange: onChange(0),
|
|
455
|
+
placeholder: "Inicial"
|
|
456
|
+
}
|
|
457
|
+
),
|
|
458
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
459
|
+
material.TextField,
|
|
460
|
+
{
|
|
461
|
+
size: "small",
|
|
462
|
+
label: "At\xE9",
|
|
463
|
+
variant: "outlined",
|
|
464
|
+
value: (item.value || ["", ""])[1] || "",
|
|
465
|
+
onChange: onChange(1),
|
|
466
|
+
placeholder: "Final"
|
|
467
|
+
}
|
|
468
|
+
)
|
|
469
|
+
] });
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
var numberBetweenOp = {
|
|
473
|
+
label: "entre",
|
|
474
|
+
value: "between",
|
|
475
|
+
getApplyFilterFn: (filter) => {
|
|
476
|
+
if (!filter.value || !Array.isArray(filter.value)) return null;
|
|
477
|
+
const [start, end] = filter.value;
|
|
478
|
+
if (start === "" || end === "" || start == null || end == null) return null;
|
|
479
|
+
return (value) => {
|
|
480
|
+
const number = Number(value);
|
|
481
|
+
return number >= Number(start) && number <= Number(end);
|
|
482
|
+
};
|
|
483
|
+
},
|
|
484
|
+
InputComponent: ({ item, applyValue, focusElementRef }) => {
|
|
485
|
+
const onChange = createChange(item, applyValue);
|
|
486
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { display: "flex", flexDirection: "column", gap: 1 }, children: [
|
|
487
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
488
|
+
material.TextField,
|
|
489
|
+
{
|
|
490
|
+
size: "small",
|
|
491
|
+
label: "De",
|
|
492
|
+
type: "number",
|
|
493
|
+
variant: "outlined",
|
|
494
|
+
inputRef: focusElementRef,
|
|
495
|
+
value: (item.value || ["", ""])[0] || "",
|
|
496
|
+
onChange: onChange(0),
|
|
497
|
+
placeholder: "M\xEDnimo"
|
|
498
|
+
}
|
|
499
|
+
),
|
|
500
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
501
|
+
material.TextField,
|
|
502
|
+
{
|
|
503
|
+
size: "small",
|
|
504
|
+
label: "At\xE9",
|
|
505
|
+
type: "number",
|
|
506
|
+
variant: "outlined",
|
|
507
|
+
value: (item.value || ["", ""])[1] || "",
|
|
508
|
+
onChange: onChange(1),
|
|
509
|
+
placeholder: "M\xE1ximo"
|
|
510
|
+
}
|
|
511
|
+
)
|
|
512
|
+
] });
|
|
513
|
+
}
|
|
514
|
+
};
|
|
515
|
+
var getTextOps = () => {
|
|
516
|
+
return [...xDataGrid.getGridStringOperators(), textBetweenOp];
|
|
517
|
+
};
|
|
518
|
+
var getNumberOps = () => {
|
|
519
|
+
return [...xDataGrid.getGridNumericOperators(), numberBetweenOp];
|
|
520
|
+
};
|
|
521
|
+
xDataGrid.GRID_STRING_COL_DEF.filterOperators = getTextOps();
|
|
522
|
+
xDataGrid.GRID_NUMERIC_COL_DEF.filterOperators = getNumberOps();
|
|
523
|
+
function CustomColumnsPanel(props) {
|
|
524
|
+
return /* @__PURE__ */ jsxRuntime.jsx(xDataGrid.GridColumnsPanel, __spreadProps(__spreadValues({}, props), { sx: columnPanelSx }));
|
|
525
|
+
}
|
|
526
|
+
function CustomColumnMenu(props) {
|
|
527
|
+
return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: columnMenuSx, children: /* @__PURE__ */ jsxRuntime.jsx(xDataGrid.GridColumnMenu, __spreadValues({}, props)) });
|
|
528
|
+
}
|
|
529
|
+
function CustomFilterPanel(props) {
|
|
530
|
+
return /* @__PURE__ */ jsxRuntime.jsx(xDataGrid.GridFilterPanel, __spreadProps(__spreadValues({}, props), { sx: filterSx }));
|
|
531
|
+
}
|
|
532
|
+
function CustomNoRowsOverlay() {
|
|
533
|
+
return /* @__PURE__ */ jsxRuntime.jsx(xDataGrid.GridOverlay, { children: /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { mt: 1 }, children: "Nenhum dado encontrado." }) });
|
|
534
|
+
}
|
|
535
|
+
function CustomPagination() {
|
|
536
|
+
return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: paginationSx, children: /* @__PURE__ */ jsxRuntime.jsx(xDataGrid.GridPagination, {}) });
|
|
537
|
+
}
|
|
538
|
+
var DataTable = (_a) => {
|
|
539
|
+
var rest = __objRest(_a, []);
|
|
540
|
+
return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { mb: 2, mt: 2, height: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
541
|
+
xDataGrid.DataGrid,
|
|
542
|
+
__spreadProps(__spreadValues({
|
|
543
|
+
sx: tableSx
|
|
544
|
+
}, rest), {
|
|
545
|
+
className: "min-h-[210px]!",
|
|
546
|
+
localeText,
|
|
547
|
+
disableRowSelectionOnClick: true,
|
|
548
|
+
slotProps: {
|
|
549
|
+
loadingOverlay: {
|
|
550
|
+
variant: "linear-progress",
|
|
551
|
+
noRowsVariant: "skeleton"
|
|
552
|
+
}
|
|
553
|
+
},
|
|
554
|
+
slots: {
|
|
555
|
+
columnMenu: CustomColumnMenu,
|
|
556
|
+
filterPanel: CustomFilterPanel,
|
|
557
|
+
columnsPanel: CustomColumnsPanel,
|
|
558
|
+
noRowsOverlay: CustomNoRowsOverlay,
|
|
559
|
+
pagination: CustomPagination
|
|
560
|
+
}
|
|
561
|
+
})
|
|
562
|
+
) });
|
|
563
|
+
};
|
|
564
|
+
var data_table_default = DataTable;
|
|
565
|
+
var DEFAULT_TAB_COLOR = "var(--primary-color)";
|
|
566
|
+
var DEFAULT_TAB_FONT_FAMILY = "var(--font-family, inherit)";
|
|
567
|
+
var Tabs = material.styled(material.Tabs, {
|
|
568
|
+
shouldForwardProp: (prop) => prop !== "color"
|
|
569
|
+
})(({ color = DEFAULT_TAB_COLOR }) => ({
|
|
570
|
+
fontFamily: `${DEFAULT_TAB_FONT_FAMILY} !important`,
|
|
571
|
+
"& .MuiTabs-indicator": { backgroundColor: color }
|
|
572
|
+
}));
|
|
573
|
+
var Tab = material.styled(material.Tab, {
|
|
574
|
+
shouldForwardProp: (prop) => prop !== "color" && prop !== "fontFamily"
|
|
575
|
+
})(
|
|
576
|
+
({ color = DEFAULT_TAB_COLOR, fontFamily = DEFAULT_TAB_FONT_FAMILY }) => ({
|
|
577
|
+
fontWeight: "500 !important",
|
|
578
|
+
color: "#000000CC !important",
|
|
579
|
+
fontSize: "14px !important",
|
|
580
|
+
textTransform: "uppercase !important",
|
|
581
|
+
fontFamily: `${fontFamily} !important`,
|
|
582
|
+
"&.Mui-selected": { color: `${color} !important` }
|
|
583
|
+
})
|
|
584
|
+
);
|
|
585
|
+
|
|
586
|
+
// src/core/css-var.ts
|
|
587
|
+
function withCssVar(style, name, value) {
|
|
588
|
+
if (value == null || value === "") return style;
|
|
589
|
+
return __spreadProps(__spreadValues({}, style), { [name]: value });
|
|
590
|
+
}
|
|
591
|
+
var DEFAULT_ACCENT = "var(--primary-color)";
|
|
592
|
+
var accent = "var(--primary-color)";
|
|
593
|
+
var errorColor = "#D32F2F";
|
|
594
|
+
var focusLabel = { color: accent };
|
|
595
|
+
var errorLabel = { color: errorColor };
|
|
596
|
+
var borderAccent = { borderColor: accent };
|
|
597
|
+
var borderError = { borderColor: errorColor };
|
|
598
|
+
var underlineAccent = { borderBottomColor: accent };
|
|
599
|
+
var underlineError = { borderBottomColor: errorColor };
|
|
600
|
+
var disabledText = { color: "#9E9E9E", cursor: "not-allowed" };
|
|
601
|
+
var disabledBorder = { borderColor: "#9E9E9E", cursor: "not-allowed" };
|
|
602
|
+
var input = {
|
|
603
|
+
color: "#333",
|
|
604
|
+
fontSize: "13px !important",
|
|
605
|
+
fontFamily: "var(--font-poppins) !important"
|
|
606
|
+
};
|
|
607
|
+
var InputTextField = material.styled(material.TextField)({
|
|
608
|
+
fontFamily: "var(--font-poppins) !important",
|
|
609
|
+
"& input": input,
|
|
610
|
+
"& label": input,
|
|
611
|
+
"& label.Mui-focused": focusLabel,
|
|
612
|
+
"& label.Mui-error": errorLabel,
|
|
613
|
+
"& .MuiInput-underline:after": underlineAccent,
|
|
614
|
+
"& .MuiInput-underline.Mui-error:after": underlineError,
|
|
615
|
+
"& .MuiOutlinedInput-root": {
|
|
616
|
+
"& fieldset": borderAccent,
|
|
617
|
+
"&:hover fieldset": borderAccent,
|
|
618
|
+
"&.Mui-disabled fieldset": disabledBorder,
|
|
619
|
+
"&.Mui-focused fieldset": borderAccent,
|
|
620
|
+
"&.Mui-error fieldset": borderError,
|
|
621
|
+
"&.Mui-error:hover fieldset": borderError,
|
|
622
|
+
"&.Mui-error.Mui-focused fieldset": borderError
|
|
623
|
+
},
|
|
624
|
+
"& .MuiFilledInput-root": {
|
|
625
|
+
backgroundColor: "#F9FAFB",
|
|
626
|
+
"&:after": underlineAccent,
|
|
627
|
+
"&:before": underlineAccent,
|
|
628
|
+
"&:hover:before": underlineAccent,
|
|
629
|
+
"&.Mui-error:after": underlineError,
|
|
630
|
+
"&.Mui-error:before": underlineError,
|
|
631
|
+
"&:hover": { backgroundColor: "#F5F5F5" },
|
|
632
|
+
"&.Mui-error:hover:before": underlineError,
|
|
633
|
+
fontFamily: "var(--font-poppins) !important",
|
|
634
|
+
"&.Mui-disabled": __spreadProps(__spreadValues({}, disabledText), { backgroundColor: "#F9FAFB" })
|
|
635
|
+
},
|
|
636
|
+
"& .MuiInputBase-input": __spreadProps(__spreadValues({}, input), { "&.Mui-disabled": disabledText }),
|
|
637
|
+
"& .MuiFormHelperText-root": {
|
|
638
|
+
fontSize: "11px",
|
|
639
|
+
marginLeft: 2,
|
|
640
|
+
fontFamily: "var(--font-poppins) !important"
|
|
641
|
+
},
|
|
642
|
+
"& .MuiFormHelperText-root.Mui-error": { color: errorColor },
|
|
643
|
+
"& .Mui-disabled": disabledText
|
|
644
|
+
});
|
|
645
|
+
var css_default = react.memo(InputTextField);
|
|
646
|
+
function useInputMasker({ type, onChange }) {
|
|
647
|
+
const formatValue = react.useCallback(
|
|
648
|
+
(v) => {
|
|
649
|
+
if (!v) return "";
|
|
650
|
+
switch (type) {
|
|
651
|
+
case "cpf-cnpj":
|
|
652
|
+
return formatCpfCnpj(v);
|
|
653
|
+
case "numeric":
|
|
654
|
+
return removeDigits(v);
|
|
655
|
+
case "tel":
|
|
656
|
+
return formatPhoneBr(v);
|
|
657
|
+
case "price":
|
|
658
|
+
return formatPriceBrl(v);
|
|
659
|
+
case "text-only":
|
|
660
|
+
return removeTextOnly(v);
|
|
661
|
+
case "text-no-number":
|
|
662
|
+
return removeNonDigits(v);
|
|
663
|
+
case "item-170":
|
|
664
|
+
return formatItem170(v);
|
|
665
|
+
case "item-150":
|
|
666
|
+
return formatItem150(v);
|
|
667
|
+
default:
|
|
668
|
+
return v;
|
|
669
|
+
}
|
|
670
|
+
},
|
|
671
|
+
[type]
|
|
672
|
+
);
|
|
673
|
+
const handleChange = (e) => {
|
|
674
|
+
const newValue = e.target.value;
|
|
675
|
+
onChange == null ? void 0 : onChange(__spreadProps(__spreadValues({}, e), {
|
|
676
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: formatValue(newValue) })
|
|
677
|
+
}));
|
|
678
|
+
};
|
|
679
|
+
return { handleChange };
|
|
680
|
+
}
|
|
681
|
+
function withPasswordToggle({
|
|
682
|
+
showPwd,
|
|
683
|
+
canToggle,
|
|
684
|
+
slotProps,
|
|
685
|
+
setShowPwd,
|
|
686
|
+
color = DEFAULT_ACCENT
|
|
687
|
+
}) {
|
|
688
|
+
if (!canToggle) return slotProps;
|
|
689
|
+
const Icon = showPwd ? md.MdVisibilityOff : md.MdVisibility;
|
|
690
|
+
return __spreadProps(__spreadValues({}, slotProps), {
|
|
691
|
+
input: __spreadProps(__spreadValues({}, slotProps == null ? void 0 : slotProps.input), {
|
|
692
|
+
endAdornment: /* @__PURE__ */ jsxRuntime.jsx(material.InputAdornment, { position: "end", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
693
|
+
material.IconButton,
|
|
694
|
+
{
|
|
695
|
+
edge: "end",
|
|
696
|
+
size: "small",
|
|
697
|
+
sx: { color },
|
|
698
|
+
onClick: () => setShowPwd((prev) => !prev),
|
|
699
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: 20 })
|
|
700
|
+
}
|
|
701
|
+
) })
|
|
702
|
+
})
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
function buildSlotProps(args) {
|
|
706
|
+
return withPasswordToggle(args);
|
|
707
|
+
}
|
|
708
|
+
var CUSTOM_INPUT_TYPES = /* @__PURE__ */ new Set([
|
|
709
|
+
"cpf-cnpj",
|
|
710
|
+
"numeric",
|
|
711
|
+
"price",
|
|
712
|
+
"item-170",
|
|
713
|
+
"item-150",
|
|
714
|
+
"text-only",
|
|
715
|
+
"text-no-number"
|
|
716
|
+
]);
|
|
717
|
+
function resolveHtmlInputType(type) {
|
|
718
|
+
if (!type || CUSTOM_INPUT_TYPES.has(type)) return "text";
|
|
719
|
+
return type;
|
|
720
|
+
}
|
|
721
|
+
var Input = (_a) => {
|
|
722
|
+
var _b = _a, {
|
|
723
|
+
color,
|
|
724
|
+
onChange,
|
|
725
|
+
isPassword,
|
|
726
|
+
type = "text",
|
|
727
|
+
size = "small"
|
|
728
|
+
} = _b, rest = __objRest(_b, [
|
|
729
|
+
"color",
|
|
730
|
+
"onChange",
|
|
731
|
+
"isPassword",
|
|
732
|
+
"type",
|
|
733
|
+
"size"
|
|
734
|
+
]);
|
|
735
|
+
const [showPwd, setShowPwd] = react.useState(false);
|
|
736
|
+
const isPwd = type === "password";
|
|
737
|
+
const canToggle = isPwd && isPassword;
|
|
738
|
+
const htmlType = resolveHtmlInputType(type);
|
|
739
|
+
const inputType = canToggle && showPwd ? "text" : htmlType;
|
|
740
|
+
const style = react.useMemo(
|
|
741
|
+
() => withCssVar(rest.style, "--primary-color", color),
|
|
742
|
+
[color, rest.style]
|
|
743
|
+
);
|
|
744
|
+
const slotProps = react.useMemo(
|
|
745
|
+
() => buildSlotProps({
|
|
746
|
+
color,
|
|
747
|
+
showPwd,
|
|
748
|
+
canToggle,
|
|
749
|
+
setShowPwd,
|
|
750
|
+
slotProps: rest.slotProps
|
|
751
|
+
}),
|
|
752
|
+
[canToggle, color, showPwd, rest.slotProps]
|
|
753
|
+
);
|
|
754
|
+
const { handleChange } = useInputMasker({ type, onChange });
|
|
755
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
756
|
+
css_default,
|
|
757
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
758
|
+
size,
|
|
759
|
+
style,
|
|
760
|
+
type: inputType,
|
|
761
|
+
slotProps,
|
|
762
|
+
onChange: handleChange,
|
|
763
|
+
className: cn("select-none", rest.className)
|
|
764
|
+
})
|
|
765
|
+
);
|
|
766
|
+
};
|
|
767
|
+
var input_default = Input;
|
|
768
|
+
|
|
769
|
+
// src/components/ui/input-select/utils/css.ts
|
|
770
|
+
var optionText = {
|
|
771
|
+
fontSize: "13px !important",
|
|
772
|
+
fontFamily: "var(--font-poppins) !important"
|
|
773
|
+
};
|
|
774
|
+
var selectMui = {
|
|
775
|
+
"& .MuiAutocomplete-option": __spreadProps(__spreadValues({
|
|
776
|
+
padding: "8px 12px"
|
|
777
|
+
}, optionText), {
|
|
778
|
+
lineHeight: "25px !important"
|
|
779
|
+
}),
|
|
780
|
+
"& .MuiAutocomplete-noOptions": optionText,
|
|
781
|
+
"& .MuiAutocomplete-listbox": { padding: "5px" }
|
|
782
|
+
};
|
|
783
|
+
function InputSelect(_a) {
|
|
784
|
+
var _b = _a, {
|
|
785
|
+
multiple,
|
|
786
|
+
optionLabel,
|
|
787
|
+
onChange,
|
|
788
|
+
input: input2
|
|
789
|
+
} = _b, rest = __objRest(_b, [
|
|
790
|
+
"multiple",
|
|
791
|
+
"optionLabel",
|
|
792
|
+
"onChange",
|
|
793
|
+
"input"
|
|
794
|
+
]);
|
|
795
|
+
const handleChange = (event, value, reason, details) => {
|
|
796
|
+
onChange == null ? void 0 : onChange(event, value, reason, details);
|
|
797
|
+
};
|
|
798
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
799
|
+
Autocomplete__default.default,
|
|
800
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
801
|
+
size: "small",
|
|
802
|
+
multiple,
|
|
803
|
+
onChange: handleChange,
|
|
804
|
+
slotProps: { paper: { sx: selectMui } },
|
|
805
|
+
getOptionLabel: (option) => typeof option === "string" ? "" : optionLabel(option),
|
|
806
|
+
isOptionEqualToValue: (option, value) => JSON.stringify(option) === JSON.stringify(value),
|
|
807
|
+
renderInput: (params) => {
|
|
808
|
+
var _a2;
|
|
809
|
+
return /* @__PURE__ */ jsxRuntime.jsx(input_default, __spreadProps(__spreadValues(__spreadValues({}, params), input2), { size: (_a2 = input2 == null ? void 0 : input2.size) != null ? _a2 : "small" }));
|
|
810
|
+
}
|
|
811
|
+
})
|
|
812
|
+
);
|
|
813
|
+
}
|
|
814
|
+
var input_select_default = InputSelect;
|
|
815
|
+
var FilterCard = ({
|
|
816
|
+
title,
|
|
817
|
+
setOpen,
|
|
818
|
+
renderFilter
|
|
819
|
+
}) => {
|
|
820
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "h-15 flex items-center w-full bg-white mb-2 rounded-md shadow-[0_2px_6px_-1px_rgba(0,0,0,.16),0_6px_18px_-1px_rgba(0,0,0,.06)]", children: [
|
|
821
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-2 bg-(--primary-color) rounded-tl-md rounded-bl-md" }),
|
|
822
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full flex justify-between items-center p-3", children: [
|
|
823
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "font-medium text-lg whitespace-nowrap text-ellipsis overflow-hidden ml-1 text-black/80", children: title }),
|
|
824
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center space-x-4", children: renderFilter && /* @__PURE__ */ jsxRuntime.jsx(
|
|
825
|
+
core.Tooltip,
|
|
826
|
+
{
|
|
827
|
+
withArrow: true,
|
|
828
|
+
arrowSize: 4,
|
|
829
|
+
color: "#00b2a6",
|
|
830
|
+
arrowOffset: 20,
|
|
831
|
+
label: "Ver filtros",
|
|
832
|
+
className: "text-xs!",
|
|
833
|
+
transitionProps: { transition: "pop", duration: 300 },
|
|
834
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex items-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
835
|
+
core.ActionIcon,
|
|
836
|
+
{
|
|
837
|
+
size: 40,
|
|
838
|
+
radius: "md",
|
|
839
|
+
"aria-label": "Ver filtros",
|
|
840
|
+
color: "var(--primary-color)",
|
|
841
|
+
onClick: () => setOpen(true),
|
|
842
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(fa.FaFilter, { className: "h-5 w-5 text-white" })
|
|
843
|
+
}
|
|
844
|
+
) })
|
|
845
|
+
}
|
|
846
|
+
) })
|
|
847
|
+
] })
|
|
848
|
+
] });
|
|
849
|
+
};
|
|
850
|
+
var card_default2 = FilterCard;
|
|
851
|
+
|
|
852
|
+
// src/components/ui/filter/utils/constants.ts
|
|
853
|
+
var FILTER_DEFAULT_ORDER = 99;
|
|
854
|
+
var FILTER_DRAWER_PAPER_SX = {
|
|
855
|
+
["& .MuiDrawer-paper"]: { borderRadius: "0px 0px 20px 20px" }
|
|
856
|
+
};
|
|
857
|
+
function hasFilterFields(inputs, inputSelect) {
|
|
858
|
+
var _a, _b;
|
|
859
|
+
return ((_a = inputs == null ? void 0 : inputs.length) != null ? _a : 0) > 0 || ((_b = inputSelect == null ? void 0 : inputSelect.length) != null ? _b : 0) > 0;
|
|
860
|
+
}
|
|
861
|
+
function isInputSelect(field) {
|
|
862
|
+
return "options" in field;
|
|
863
|
+
}
|
|
864
|
+
function filterInputSelect(props) {
|
|
865
|
+
return props;
|
|
866
|
+
}
|
|
867
|
+
function sortFilterFields(fields) {
|
|
868
|
+
return [...fields].sort(
|
|
869
|
+
(a, b) => {
|
|
870
|
+
var _a, _b;
|
|
871
|
+
return ((_a = a.order) != null ? _a : FILTER_DEFAULT_ORDER) - ((_b = b.order) != null ? _b : FILTER_DEFAULT_ORDER);
|
|
872
|
+
}
|
|
873
|
+
);
|
|
874
|
+
}
|
|
875
|
+
function mergeFilterFields(inputs, inputSelect) {
|
|
876
|
+
return sortFilterFields([...inputs, ...inputSelect]);
|
|
877
|
+
}
|
|
878
|
+
function getFilterGridColumns(isMobile, isTablet) {
|
|
879
|
+
if (isMobile) return 1;
|
|
880
|
+
if (isTablet) return 3;
|
|
881
|
+
return 7;
|
|
882
|
+
}
|
|
883
|
+
var FilterDrawer = ({
|
|
884
|
+
open,
|
|
885
|
+
setOpen,
|
|
886
|
+
onClear,
|
|
887
|
+
onSubmit,
|
|
888
|
+
inputs = [],
|
|
889
|
+
inputSelect = []
|
|
890
|
+
}) => {
|
|
891
|
+
const m640 = material.useMediaQuery("(max-width:640px)");
|
|
892
|
+
const m1120 = material.useMediaQuery("(max-width:1120px)");
|
|
893
|
+
const allInputs = mergeFilterFields(inputs, inputSelect);
|
|
894
|
+
const renderField = (field, index) => {
|
|
895
|
+
var _a, _b;
|
|
896
|
+
if (isInputSelect(field)) {
|
|
897
|
+
return /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { size: (_a = field.xs) != null ? _a : 1, children: /* @__PURE__ */ jsxRuntime.jsx(input_select_default, __spreadProps(__spreadValues({}, field), { id: `inputSM${index}`, fullWidth: true })) }, `inputSelect-${index}`);
|
|
898
|
+
}
|
|
899
|
+
return /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { size: (_b = field.xs) != null ? _b : 1, children: /* @__PURE__ */ jsxRuntime.jsx(input_default, __spreadProps(__spreadValues({}, field), { fullWidth: true })) }, `input-${index}`);
|
|
900
|
+
};
|
|
901
|
+
const handleSubmit = (event) => {
|
|
902
|
+
event.preventDefault();
|
|
903
|
+
if (!onSubmit) return;
|
|
904
|
+
onSubmit(event);
|
|
905
|
+
setOpen(false);
|
|
906
|
+
};
|
|
907
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
908
|
+
material.Drawer,
|
|
909
|
+
{
|
|
910
|
+
open,
|
|
911
|
+
anchor: "top",
|
|
912
|
+
onClose: () => setOpen(false),
|
|
913
|
+
sx: FILTER_DRAWER_PAPER_SX,
|
|
914
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
915
|
+
"form",
|
|
916
|
+
{
|
|
917
|
+
onSubmit: handleSubmit,
|
|
918
|
+
className: "flex w-full select-none flex-col py-4 pl-5",
|
|
919
|
+
children: [
|
|
920
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg font-medium text-system-900", children: "Filtros" }),
|
|
921
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pb-5 pt-1 text-sm text-black/80", children: "Para que possamos apresentar dados espec\xEDficos, por favor, preencha os campos abaixo." }),
|
|
922
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
923
|
+
material.Grid,
|
|
924
|
+
{
|
|
925
|
+
container: true,
|
|
926
|
+
rowSpacing: 2,
|
|
927
|
+
className: "pr-5",
|
|
928
|
+
columnSpacing: 1,
|
|
929
|
+
columns: getFilterGridColumns(Boolean(m640), Boolean(m1120)),
|
|
930
|
+
children: allInputs.map((field, index) => renderField(field, index))
|
|
931
|
+
}
|
|
932
|
+
),
|
|
933
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end space-x-4 pr-4 pt-4", children: [
|
|
934
|
+
onClear && /* @__PURE__ */ jsxRuntime.jsx(
|
|
935
|
+
core.Button,
|
|
936
|
+
{
|
|
937
|
+
radius: "sm",
|
|
938
|
+
color: "#253E56",
|
|
939
|
+
variant: "outline",
|
|
940
|
+
onClick: onClear,
|
|
941
|
+
size: "xs",
|
|
942
|
+
children: "LIMPAR FILTROS"
|
|
943
|
+
}
|
|
944
|
+
),
|
|
945
|
+
onSubmit && /* @__PURE__ */ jsxRuntime.jsx(
|
|
946
|
+
core.Button,
|
|
947
|
+
{
|
|
948
|
+
size: "xs",
|
|
949
|
+
radius: "sm",
|
|
950
|
+
type: "submit",
|
|
951
|
+
variant: "filled",
|
|
952
|
+
color: "var(--primary-color)",
|
|
953
|
+
children: "PESQUISAR"
|
|
954
|
+
}
|
|
955
|
+
)
|
|
956
|
+
] })
|
|
957
|
+
]
|
|
958
|
+
}
|
|
959
|
+
)
|
|
960
|
+
}
|
|
961
|
+
);
|
|
962
|
+
};
|
|
963
|
+
var filter_default = FilterDrawer;
|
|
964
|
+
var Filter = ({
|
|
965
|
+
title,
|
|
966
|
+
inputs,
|
|
967
|
+
onClear,
|
|
968
|
+
onSubmit,
|
|
969
|
+
inputSelect
|
|
970
|
+
}) => {
|
|
971
|
+
const [open, setOpen] = react.useState(false);
|
|
972
|
+
const hasFields = hasFilterFields(inputs, inputSelect);
|
|
973
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
974
|
+
/* @__PURE__ */ jsxRuntime.jsx(card_default2, { title, setOpen, renderFilter: hasFields }),
|
|
975
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
976
|
+
filter_default,
|
|
977
|
+
{
|
|
978
|
+
open,
|
|
979
|
+
inputs,
|
|
980
|
+
setOpen,
|
|
981
|
+
onClear,
|
|
982
|
+
onSubmit,
|
|
983
|
+
inputSelect
|
|
984
|
+
}
|
|
985
|
+
)
|
|
986
|
+
] });
|
|
987
|
+
};
|
|
988
|
+
var filter_default2 = Filter;
|
|
146
989
|
|
|
147
990
|
exports.Card = card_default;
|
|
991
|
+
exports.DataTable = data_table_default;
|
|
148
992
|
exports.Dialog = dialog_default;
|
|
993
|
+
exports.Filter = filter_default2;
|
|
994
|
+
exports.Input = input_default;
|
|
995
|
+
exports.InputSelect = input_select_default;
|
|
996
|
+
exports.Tab = Tab;
|
|
997
|
+
exports.Tabs = Tabs;
|
|
998
|
+
exports.filterInputSelect = filterInputSelect;
|
|
149
999
|
//# sourceMappingURL=index.js.map
|
|
150
1000
|
//# sourceMappingURL=index.js.map
|