@grazziotin/react-components 1.0.3 → 1.0.5

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.
Files changed (74) hide show
  1. package/README.md +34 -24
  2. package/dist/150.index.js +1 -0
  3. package/dist/815.index.js +1 -0
  4. package/dist/908.index.js +2 -0
  5. package/dist/908.index.js.LICENSE.txt +9 -0
  6. package/dist/988.index.js +1 -0
  7. package/dist/assets/fonts/Montserrat-Black.ttf +0 -0
  8. package/dist/assets/fonts/Montserrat-BlackItalic.ttf +0 -0
  9. package/dist/assets/fonts/Montserrat-Bold.ttf +0 -0
  10. package/dist/assets/fonts/Montserrat-BoldItalic.ttf +0 -0
  11. package/dist/assets/fonts/Montserrat-ExtraBold.ttf +0 -0
  12. package/dist/assets/fonts/Montserrat-ExtraBoldItalic.ttf +0 -0
  13. package/dist/assets/fonts/Montserrat-ExtraLight.ttf +0 -0
  14. package/dist/assets/fonts/Montserrat-ExtraLightItalic.ttf +0 -0
  15. package/dist/assets/fonts/Montserrat-Italic.ttf +0 -0
  16. package/dist/assets/fonts/Montserrat-Light.ttf +0 -0
  17. package/dist/assets/fonts/Montserrat-LightItalic.ttf +0 -0
  18. package/dist/assets/fonts/Montserrat-Medium.ttf +0 -0
  19. package/dist/assets/fonts/Montserrat-MediumItalic.ttf +0 -0
  20. package/dist/assets/fonts/Montserrat-Regular.ttf +0 -0
  21. package/dist/assets/fonts/Montserrat-SemiBold.ttf +0 -0
  22. package/dist/assets/fonts/Montserrat-SemiBoldItalic.ttf +0 -0
  23. package/dist/assets/fonts/Montserrat-Thin.ttf +0 -0
  24. package/dist/assets/fonts/Montserrat-ThinItalic.ttf +0 -0
  25. package/dist/components/Inputs/Input/index.d.ts +39 -18
  26. package/dist/components/Inputs/Input/index.js +122 -28
  27. package/dist/components/Inputs/Input/utils/input-styled.d.ts +4 -0
  28. package/dist/components/Inputs/Input/utils/input-styled.js +63 -0
  29. package/dist/components/Inputs/Input/utils/interface.d.ts +21 -0
  30. package/dist/components/Inputs/Input/utils/interface.js +1 -0
  31. package/dist/components/Inputs/Input/utils/mask-custom.d.ts +4 -0
  32. package/dist/components/Inputs/Input/utils/mask-custom.js +30 -0
  33. package/dist/components/Inputs/input-select/index.d.ts +42 -0
  34. package/dist/components/Inputs/input-select/index.js +84 -0
  35. package/dist/components/Inputs/input-select/utils/interface.d.ts +43 -0
  36. package/dist/components/Inputs/input-select/utils/interface.js +1 -0
  37. package/dist/components/Loader/index.d.ts +5 -0
  38. package/dist/components/Loader/index.js +7 -0
  39. package/dist/components/barcode/BarcodeScanner.d.ts +26 -0
  40. package/dist/components/barcode/barcode-scanner.d.ts +26 -0
  41. package/dist/components/barcode/barcode-scanner.js +433 -0
  42. package/dist/components/barcode/index.d.ts +36 -0
  43. package/dist/components/barcode/index.js +65 -0
  44. package/dist/components/barcode/utils/constants.d.ts +139 -0
  45. package/dist/components/barcode/utils/constants.js +224 -0
  46. package/dist/components/barcode/utils/interface.d.ts +50 -0
  47. package/dist/components/barcode/utils/interface.js +1 -0
  48. package/dist/components/button/button-excel/index.d.ts +32 -0
  49. package/dist/components/button/button-excel/index.js +143 -0
  50. package/dist/components/button/index.d.ts +21 -0
  51. package/dist/components/button/index.js +101 -0
  52. package/dist/components/card/index.d.ts +21 -0
  53. package/dist/components/card/index.js +48 -0
  54. package/dist/components/datatable/index.d.ts +8 -0
  55. package/dist/components/datatable/index.js +103 -0
  56. package/dist/components/datatable/utils/constants.d.ts +8 -0
  57. package/dist/components/datatable/utils/constants.js +42 -0
  58. package/dist/components/filtro/components/card.d.ts +24 -0
  59. package/dist/components/filtro/components/card.js +49 -0
  60. package/dist/components/filtro/components/filtros.d.ts +19 -0
  61. package/dist/components/filtro/components/filtros.js +77 -0
  62. package/dist/components/filtro/index.d.ts +28 -0
  63. package/dist/components/filtro/index.js +38 -0
  64. package/dist/components/filtro/utils/interface.d.ts +105 -0
  65. package/dist/components/filtro/utils/interface.js +1 -0
  66. package/dist/components/icons/index.d.ts +21 -0
  67. package/dist/components/icons/index.js +39 -0
  68. package/dist/components/tabs/index.d.ts +24 -0
  69. package/dist/components/tabs/index.js +39 -0
  70. package/dist/functions/mascaras/index.js +1 -1
  71. package/dist/index.d.ts +12 -8
  72. package/dist/index.js +1 -1
  73. package/dist/theme.css +1058 -99
  74. package/package.json +29 -16
@@ -0,0 +1,103 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
24
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
25
+ if (ar || !(i in from)) {
26
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
27
+ ar[i] = from[i];
28
+ }
29
+ }
30
+ return to.concat(ar || Array.prototype.slice.call(from));
31
+ };
32
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
33
+ import { DataGrid, GridOverlay, GridColumnMenu, GridFilterPanel, GridColumnsPanel, GridPagination, } from '@mui/x-data-grid';
34
+ import { Box, ThemeProvider, Typography } from '@mui/material';
35
+ import { localeText, filtroPainel, stylesPaginacao, stylesMenuColuna, stylesFiltroPainel, stylesPainelColuna, estiloTabela, } from './utils/constants';
36
+ function CustomColumnsPanel(props) {
37
+ return _jsx(GridColumnsPanel, __assign({}, props, { sx: stylesPainelColuna }));
38
+ }
39
+ function CustomColumnMenu(props) {
40
+ return (_jsx(Box, { sx: stylesMenuColuna, children: _jsx(GridColumnMenu, __assign({}, props)) }));
41
+ }
42
+ function CustomFilterPanel(props) {
43
+ return (_jsx(ThemeProvider, { theme: filtroPainel, children: _jsx(GridFilterPanel, __assign({}, props, { sx: stylesFiltroPainel })) }));
44
+ }
45
+ function CustomNoRowsOverlay() {
46
+ return (_jsx(GridOverlay, { children: _jsx(Box, { sx: { mt: 1 }, children: "Nenhum dado encontrado." }) }));
47
+ }
48
+ function CustomPagination() {
49
+ return (_jsx(Box, { sx: stylesPaginacao, children: _jsx(GridPagination, {}) }));
50
+ }
51
+ var DataTable = function (_a) {
52
+ var _b, _c, _d, _e, _f, _g, _h;
53
+ var title = _a.title, countText = _a.countText, rest = __rest(_a, ["title", "countText"]);
54
+ var useAutoHeight = Boolean(rest.autoHeight);
55
+ var pageSizeOptions = rest.pageSizeOptions, initialState = rest.initialState, paginationModel = rest.paginationModel, gridProps = __rest(rest, ["pageSizeOptions", "initialState", "paginationModel"]);
56
+ var defaultPageSizeOptions = [5, 10, 25];
57
+ var currentOptions = pageSizeOptions && pageSizeOptions.length > 0
58
+ ? pageSizeOptions
59
+ : defaultPageSizeOptions;
60
+ var getOptionValue = function (option) {
61
+ return typeof option === 'number' ? option : option.value;
62
+ };
63
+ var fallbackPageSize = getOptionValue(currentOptions[0]) || 10;
64
+ var currentPageSize = (_e = (_b = paginationModel === null || paginationModel === void 0 ? void 0 : paginationModel.pageSize) !== null && _b !== void 0 ? _b : (_d = (_c = initialState === null || initialState === void 0 ? void 0 : initialState.pagination) === null || _c === void 0 ? void 0 : _c.paginationModel) === null || _d === void 0 ? void 0 : _d.pageSize) !== null && _e !== void 0 ? _e : fallbackPageSize;
65
+ var pageSizeExists = currentOptions.some(function (option) { return getOptionValue(option) === currentPageSize; });
66
+ var normalizedPageSizeOptions = pageSizeExists
67
+ ? currentOptions
68
+ : __spreadArray(__spreadArray([], currentOptions, true), [currentPageSize], false);
69
+ var normalizedInitialState = paginationModel
70
+ ? initialState
71
+ : __assign(__assign({}, initialState), { pagination: __assign(__assign({}, initialState === null || initialState === void 0 ? void 0 : initialState.pagination), { paginationModel: {
72
+ page: (_h = (_g = (_f = initialState === null || initialState === void 0 ? void 0 : initialState.pagination) === null || _f === void 0 ? void 0 : _f.paginationModel) === null || _g === void 0 ? void 0 : _g.page) !== null && _h !== void 0 ? _h : 0,
73
+ pageSize: currentPageSize,
74
+ } }) });
75
+ return (_jsxs(Box, { sx: { mb: 2, mt: 2, width: '100%' }, children: [(title !== null && title !== void 0 ? title : countText) && (_jsxs(Box, { sx: {
76
+ display: 'flex',
77
+ alignItems: 'center',
78
+ justifyContent: 'space-between',
79
+ flexWrap: 'wrap',
80
+ gap: 1,
81
+ mb: 2,
82
+ }, children: [title && (_jsx(Typography, { component: "h2", variant: "h6", sx: {
83
+ fontWeight: 700,
84
+ fontSize: '1.25rem',
85
+ color: 'text.primary',
86
+ }, children: title })), countText && (_jsx(Typography, { variant: "body2", sx: { color: 'text.secondary' }, children: countText }))] })), _jsx(Box, { sx: {
87
+ width: '100%',
88
+ minHeight: 210,
89
+ height: useAutoHeight ? 'auto' : 420,
90
+ }, children: _jsx(DataGrid, __assign({ sx: estiloTabela }, gridProps, { className: "min-h-[210px]", pageSizeOptions: normalizedPageSizeOptions, initialState: normalizedInitialState, paginationModel: paginationModel, localeText: localeText, disableRowSelectionOnClick: true, slotProps: {
91
+ loadingOverlay: {
92
+ variant: 'linear-progress',
93
+ noRowsVariant: 'skeleton',
94
+ },
95
+ }, slots: {
96
+ columnMenu: CustomColumnMenu,
97
+ filterPanel: CustomFilterPanel,
98
+ columnsPanel: CustomColumnsPanel,
99
+ noRowsOverlay: CustomNoRowsOverlay,
100
+ pagination: CustomPagination,
101
+ } })) })] }));
102
+ };
103
+ export default DataTable;
@@ -0,0 +1,8 @@
1
+ import type { SxProps, Theme } from '@mui/material';
2
+ export declare const localeText: Partial<import("@mui/x-data-grid").GridLocaleText>;
3
+ export declare const filtroPainel: Theme;
4
+ export declare const stylesPaginacao: SxProps<Theme>;
5
+ export declare const stylesMenuColuna: SxProps<Theme>;
6
+ export declare const stylesFiltroPainel: SxProps<Theme>;
7
+ export declare const stylesPainelColuna: SxProps<Theme>;
8
+ export declare const estiloTabela: SxProps<Theme>;
@@ -0,0 +1,42 @@
1
+ var _a, _b, _c, _d;
2
+ import { createTheme } from '@mui/material/styles';
3
+ import { ptBR } from '@mui/x-data-grid/locales';
4
+ export var localeText = (_d = (_c = (_b = (_a = ptBR === null || ptBR === void 0 ? void 0 : ptBR.components) === null || _a === void 0 ? void 0 : _a.MuiDataGrid) === null || _b === void 0 ? void 0 : _b.defaultProps) === null || _c === void 0 ? void 0 : _c.localeText) !== null && _d !== void 0 ? _d : {};
5
+ export var filtroPainel = createTheme({});
6
+ export var stylesPaginacao = {
7
+ display: 'flex',
8
+ alignItems: 'center',
9
+ gap: 1,
10
+ flexWrap: 'wrap',
11
+ justifyContent: 'flex-end',
12
+ py: 1,
13
+ };
14
+ export var stylesMenuColuna = {
15
+ '& .MuiDataGrid-columnMenuList': {
16
+ minWidth: 180,
17
+ },
18
+ };
19
+ export var stylesFiltroPainel = {
20
+ p: 2,
21
+ '& .MuiDataGrid-filterForm': {
22
+ gap: 1,
23
+ },
24
+ };
25
+ export var stylesPainelColuna = {
26
+ p: 2,
27
+ '& .MuiDataGrid-columnsPanelRow': {
28
+ gap: 1,
29
+ },
30
+ };
31
+ export var estiloTabela = {
32
+ border: 'none',
33
+ '& .MuiDataGrid-cell:focus': {
34
+ outline: 'none',
35
+ },
36
+ '& .MuiDataGrid-columnHeaders': {
37
+ backgroundColor: 'action.hover',
38
+ },
39
+ '& .MuiDataGrid-row:hover': {
40
+ backgroundColor: 'action.hover',
41
+ },
42
+ };
@@ -0,0 +1,24 @@
1
+ import { FiltroCardProps } from 'src/components/filtro/utils/interface';
2
+ /**
3
+ * Componente de card para filtros, permitindo a aplicação de filtros e ações de exportação.
4
+ *
5
+ *
6
+ * @version 0.0.1
7
+ * @author Flaviasoz
8
+ * @date 2024-10-21
9
+ *
10
+ * @template T - O tipo de dados utilizado no card de filtro.
11
+ *
12
+ * @param {Object} props - Propriedades do componente.
13
+ * @param {boolean} props.csv - Indica se a funcionalidade de exportação em CSV está habilitada.
14
+ * @param {string} props.title - Título do card de filtro.
15
+ * @param {Function} props.setOpen - Função para abrir o modal de filtros.
16
+ * @param {string} props.pesquisa - Valor da pesquisa atual.
17
+ * @param {Object} props.excelProps - Propriedades específicas para o botão de exportação em Excel.
18
+ * @param {Function} props.setPesquisa - Função para atualizar o valor da pesquisa.
19
+ * @param {boolean} props.renderFiltro - Indica se os filtros devem ser renderizados.
20
+ *
21
+ * @returns {JSX.Element} O card de filtro renderizado.
22
+ */
23
+ declare const FiltroCard: <T>({ csv, title, setOpen, pesquisa, excelProps, setPesquisa, renderFiltro, }: FiltroCardProps<T>) => JSX.Element;
24
+ export default FiltroCard;
@@ -0,0 +1,49 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { cn } from 'src/lib/utils';
14
+ import { Tooltip } from '@mantine/core';
15
+ import { CircularProgress } from '@mui/material';
16
+ import Input from 'src/components/inputs/input';
17
+ import { FilterList } from '@mui/icons-material';
18
+ import { ExcelIcon, Loading } from 'src/components/icons';
19
+ import Button from 'src/components/button';
20
+ import ButtonExcel from 'src/components/button/button-excel';
21
+ import { Suspense } from 'react';
22
+ /**
23
+ * Componente de card para filtros, permitindo a aplicação de filtros e ações de exportação.
24
+ *
25
+ *
26
+ * @version 0.0.1
27
+ * @author Flaviasoz
28
+ * @date 2024-10-21
29
+ *
30
+ * @template T - O tipo de dados utilizado no card de filtro.
31
+ *
32
+ * @param {Object} props - Propriedades do componente.
33
+ * @param {boolean} props.csv - Indica se a funcionalidade de exportação em CSV está habilitada.
34
+ * @param {string} props.title - Título do card de filtro.
35
+ * @param {Function} props.setOpen - Função para abrir o modal de filtros.
36
+ * @param {string} props.pesquisa - Valor da pesquisa atual.
37
+ * @param {Object} props.excelProps - Propriedades específicas para o botão de exportação em Excel.
38
+ * @param {Function} props.setPesquisa - Função para atualizar o valor da pesquisa.
39
+ * @param {boolean} props.renderFiltro - Indica se os filtros devem ser renderizados.
40
+ *
41
+ * @returns {JSX.Element} O card de filtro renderizado.
42
+ */
43
+ var FiltroCard = function (_a) {
44
+ var csv = _a.csv, title = _a.title, setOpen = _a.setOpen, pesquisa = _a.pesquisa, excelProps = _a.excelProps, setPesquisa = _a.setPesquisa, renderFiltro = _a.renderFiltro;
45
+ return (_jsxs("div", { className: "min-h-14 flex w-full bg-white shadow-3-strong rounded-md mb-2 border-2 border-gray-200 transition-shadow duration-200 hover:shadow-full", children: [_jsx("div", { className: "h-16 w-2 bg-grzprimary rounded-tl-sm rounded-bl-sm" }), _jsxs("div", { className: "w-full flex justify-between items-center gap-4 px-4 py-3 min-h-14", children: [_jsx("h1", { className: "font-semibold text-lg whitespace-nowrap text-ellipsis overflow-hidden text-black/80", children: title !== null && title !== void 0 ? title : 'Filtros' }), _jsxs("div", { className: "flex items-center gap-3", children: [renderFiltro && (_jsx(Tooltip, { withArrow: true, arrowSize: 4, color: "#00b2a6", arrowOffset: 20, label: "Ver filtros", position: "bottom-end", transitionProps: { transition: 'pop', duration: 300 }, children: _jsx("span", { className: "inline-flex", children: _jsx(Button, { variant: "contained", color: "primary", borderRadius: "6px", onClick: function () { return setOpen(true); }, className: "rounded-sm w-10 h-9", children: _jsx(FilterList, { className: "h-6 w-7 text-white" }) }) }) })), csv && (_jsx(Tooltip, { withArrow: true, arrowSize: 4, color: "#00b2a6", arrowOffset: 20, label: "Exportar CSV", position: "bottom-end", transitionProps: { transition: 'pop', duration: 300 }, children: _jsx("span", { className: "inline-flex", children: _jsx(Button, { variant: "contained", color: "primary", borderRadius: "6px", onClick: csv.onClick, disabled: csv.isLoading, className: cn('w-10 h-9 p-0 [&_img]:w-5 [&_img]:h-5', {
46
+ 'bg-system-100': csv.isLoading,
47
+ }), children: csv.isLoading ? _jsx(Loading, {}) : _jsx(ExcelIcon, {}) }) }) })), excelProps && !csv && (_jsx(Suspense, { fallback: _jsx(CircularProgress, {}), children: _jsx(ButtonExcel, __assign({}, excelProps)) })), setPesquisa && (_jsx(Input, { label: "Pesquisa", type: "search", value: pesquisa, placeholder: "Digite para filtrar", onChange: function (e) { return setPesquisa(e.target.value); } }))] })] })] }));
48
+ };
49
+ export default FiltroCard;
@@ -0,0 +1,19 @@
1
+ import { FiltrosProps } from 'src/components/filtro/utils/interface';
2
+ /**
3
+ * Componente que renderiza um drawer com campos de filtros personalizáveis.
4
+ *
5
+ * @template T - Tipo dos dados utilizados nos filtros.
6
+ * @template M - Tipo opcional que define um parâmetro booleano.
7
+ *
8
+ * @param {Object} props - Propriedades do componente.
9
+ * @param {boolean} props.open - Estado que determina se o drawer está aberto.
10
+ * @param {Function} props.setOpen - Função para alterar o estado do drawer.
11
+ * @param {Function} [props.onClear] - Função chamada ao limpar os filtros.
12
+ * @param {Function} [props.onSubmit] - Função chamada ao submeter os filtros.
13
+ * @param {(InputProps & AdicionalPropsInput)[]} [props.inputs] - Lista de entradas do tipo Input.
14
+ * @param {(InputSelectProps<T, M> & AdicionalPropsInput)[]} [props.inputSelect] - Lista de entradas do tipo InputSelect.
15
+ *
16
+ * @returns {JSX.Element} O drawer com campos de filtro.
17
+ */
18
+ declare const Filtros: <T, M extends boolean = false>({ open, setOpen, onClear, onSubmit, inputs, inputSelect, }: FiltrosProps<T, M>) => JSX.Element;
19
+ export default Filtros;
@@ -0,0 +1,77 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
+ if (ar || !(i in from)) {
15
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
+ ar[i] = from[i];
17
+ }
18
+ }
19
+ return to.concat(ar || Array.prototype.slice.call(from));
20
+ };
21
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
22
+ import Button from 'src/components/button';
23
+ import { Drawer, Grid } from '@mui/material';
24
+ import Input from 'src/components/inputs/input';
25
+ import InputSelect from 'src/components/inputs/input-select';
26
+ import { useDimension } from 'src/hooks';
27
+ /**
28
+ * Componente que renderiza um drawer com campos de filtros personalizáveis.
29
+ *
30
+ * @template T - Tipo dos dados utilizados nos filtros.
31
+ * @template M - Tipo opcional que define um parâmetro booleano.
32
+ *
33
+ * @param {Object} props - Propriedades do componente.
34
+ * @param {boolean} props.open - Estado que determina se o drawer está aberto.
35
+ * @param {Function} props.setOpen - Função para alterar o estado do drawer.
36
+ * @param {Function} [props.onClear] - Função chamada ao limpar os filtros.
37
+ * @param {Function} [props.onSubmit] - Função chamada ao submeter os filtros.
38
+ * @param {(InputProps & AdicionalPropsInput)[]} [props.inputs] - Lista de entradas do tipo Input.
39
+ * @param {(InputSelectProps<T, M> & AdicionalPropsInput)[]} [props.inputSelect] - Lista de entradas do tipo InputSelect.
40
+ *
41
+ * @returns {JSX.Element} O drawer com campos de filtro.
42
+ */
43
+ var Filtros = function (_a) {
44
+ var _b;
45
+ var open = _a.open, setOpen = _a.setOpen, onClear = _a.onClear, onSubmit = _a.onSubmit, _c = _a.inputs, inputs = _c === void 0 ? [] : _c, _d = _a.inputSelect, inputSelect = _d === void 0 ? [] : _d;
46
+ var m640 = useDimension(640);
47
+ var m1120 = useDimension(1120);
48
+ var allInputs = __spreadArray(__spreadArray([], inputs, true), inputSelect, true).sort(function (a, b) {
49
+ var _a, _b;
50
+ var orderA = 'textFieldProps' in a && a.textFieldProps
51
+ ? ((_a = a.textFieldProps.order) !== null && _a !== void 0 ? _a : 99)
52
+ : 99;
53
+ var orderB = 'order' in b ? ((_b = b.order) !== null && _b !== void 0 ? _b : 99) : 99;
54
+ return orderA - orderB;
55
+ });
56
+ var isInputSelect = function (obj) {
57
+ return 'options' in obj;
58
+ };
59
+ var render = function (input, i) {
60
+ var _a, _b, _c;
61
+ if (isInputSelect(input)) {
62
+ return (_jsx(Grid, { size: (_b = (_a = input === null || input === void 0 ? void 0 : input.textFieldProps) === null || _a === void 0 ? void 0 : _a.xs) !== null && _b !== void 0 ? _b : 1, children: _jsx(InputSelect, __assign({}, input, { id: "inputSM".concat(i), fullWidth: true })) }, "inputSelect-".concat(i)));
63
+ }
64
+ else {
65
+ return (_jsx(Grid, { size: (_c = input.xs) !== null && _c !== void 0 ? _c : 1, children: _jsx(Input, __assign({}, input, { fullWidth: true })) }, "input-".concat(i)));
66
+ }
67
+ };
68
+ var handleSubmit = function (event) {
69
+ event.preventDefault();
70
+ if (onSubmit) {
71
+ onSubmit(event);
72
+ setOpen(false);
73
+ }
74
+ };
75
+ return (_jsx(Drawer, { anchor: "top", open: open, onClose: function () { return setOpen(false); }, sx: (_b = {}, _b["& .MuiDrawer-paper"] = { borderRadius: '0px 0px 20px 20px' }, _b), children: _jsxs("form", { className: "w-full flex flex-col pl-5 py-4 select-none", onSubmit: handleSubmit, children: [_jsx("p", { className: "text-system-900 font-semibold text-lg", children: "Filtros" }), _jsx("p", { className: "text-system-700 text-sm pt-1 pb-5", children: "Para que possamos apresentar dados espec\u00EDficos, por favor, preencha os campos abaixo." }), _jsx(Grid, { container: true, pr: 2, rowSpacing: 2, columnSpacing: 1, columns: (m640 && 1) || (m1120 && 3) || 7, children: allInputs.map(function (input, index) { return render(input, index); }) }), _jsxs("div", { className: "flex justify-end pt-4 pr-4 gap-4", children: [onClear && (_jsx(Button, { onClick: onClear, variant: "outlined", color: "secondary", children: "Limpar Filtros" })), onSubmit && (_jsx(Button, { variant: "contained", type: "submit", children: "Pesquisar" }))] })] }) }));
76
+ };
77
+ export default Filtros;
@@ -0,0 +1,28 @@
1
+ import { FiltroProps } from './utils/interface';
2
+ /**
3
+ * Componente de filtro genérico que permite a busca e filtragem de dados.
4
+ *
5
+ *
6
+ * @version 0.0.1
7
+ * @author Flaviasoz
8
+ * @date 2024-10-21
9
+ *
10
+ * @template T - O tipo de dados a ser filtrado.
11
+ * @template M - Tipo que indica se a seleção múltipla está habilitada (padrão: false).
12
+ *
13
+ * @param {Object} props - Propriedades do componente.
14
+ * @param {boolean} props.csv - Indica se a exportação para CSV está habilitada.
15
+ * @param {string} props.title - Título do filtro.
16
+ * @param {Array} props.inputs - Lista de inputs a serem exibidos no filtro.
17
+ * @param {Function} props.onClear - Função chamada ao limpar os filtros.
18
+ * @param {Function} props.onSubmit - Função chamada ao enviar os filtros.
19
+ * @param {string} props.pesquisa - Valor da pesquisa.
20
+ * @param {Object} props.excelProps - Propriedades específicas para exportação em Excel.
21
+ * @param {Function} props.setPesquisa - Função para atualizar o valor da pesquisa.
22
+ * @param {Array} props.inputSelect - Lista de inputs de seleção.
23
+ *
24
+ * @returns {JSX.Element} O componente de filtro renderizado.
25
+ */
26
+ declare const Filtro: <T, M extends boolean = false>({ csv, title, inputs, onClear, onSubmit, pesquisa, excelProps, setPesquisa, inputSelect, }: FiltroProps<T, M>) => JSX.Element;
27
+ export default Filtro;
28
+ export type { FiltroProps, CsvProps } from './utils/interface';
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import FiltroCard from './components/card';
4
+ import Filtros from './components/filtros';
5
+ /**
6
+ * Componente de filtro genérico que permite a busca e filtragem de dados.
7
+ *
8
+ *
9
+ * @version 0.0.1
10
+ * @author Flaviasoz
11
+ * @date 2024-10-21
12
+ *
13
+ * @template T - O tipo de dados a ser filtrado.
14
+ * @template M - Tipo que indica se a seleção múltipla está habilitada (padrão: false).
15
+ *
16
+ * @param {Object} props - Propriedades do componente.
17
+ * @param {boolean} props.csv - Indica se a exportação para CSV está habilitada.
18
+ * @param {string} props.title - Título do filtro.
19
+ * @param {Array} props.inputs - Lista de inputs a serem exibidos no filtro.
20
+ * @param {Function} props.onClear - Função chamada ao limpar os filtros.
21
+ * @param {Function} props.onSubmit - Função chamada ao enviar os filtros.
22
+ * @param {string} props.pesquisa - Valor da pesquisa.
23
+ * @param {Object} props.excelProps - Propriedades específicas para exportação em Excel.
24
+ * @param {Function} props.setPesquisa - Função para atualizar o valor da pesquisa.
25
+ * @param {Array} props.inputSelect - Lista de inputs de seleção.
26
+ *
27
+ * @returns {JSX.Element} O componente de filtro renderizado.
28
+ */
29
+ var Filtro = function (_a) {
30
+ var csv = _a.csv, title = _a.title, inputs = _a.inputs, onClear = _a.onClear, onSubmit = _a.onSubmit, pesquisa = _a.pesquisa, excelProps = _a.excelProps, setPesquisa = _a.setPesquisa, inputSelect = _a.inputSelect;
31
+ var _b = useState(false), open = _b[0], setOpen = _b[1];
32
+ function renderFiltro() {
33
+ var _a, _b;
34
+ return ((_a = inputs === null || inputs === void 0 ? void 0 : inputs.length) !== null && _a !== void 0 ? _a : 0) > 0 || ((_b = inputSelect === null || inputSelect === void 0 ? void 0 : inputSelect.length) !== null && _b !== void 0 ? _b : 0) > 0;
35
+ }
36
+ return (_jsxs("div", { className: "w-full", children: [_jsx(FiltroCard, { csv: csv, title: title, setOpen: setOpen, pesquisa: pesquisa, excelProps: excelProps, setPesquisa: setPesquisa, renderFiltro: renderFiltro() }), _jsx(Filtros, { open: open, inputs: inputs, setOpen: setOpen, onClear: onClear, onSubmit: onSubmit, inputSelect: inputSelect })] }));
37
+ };
38
+ export default Filtro;
@@ -0,0 +1,105 @@
1
+ import { InputSelectProps } from 'src/components/inputs/input-select';
2
+ import { ButtonExcelProps } from 'src/components/button/button-excel';
3
+ import { InputProps } from 'src/components/inputs/input';
4
+ /**
5
+ * Propriedades para o componente CSV.
6
+ */
7
+ export interface CsvProps {
8
+ /**
9
+ * Função chamada ao clicar no botão CSV.
10
+ */
11
+ onClick: () => void;
12
+ /**
13
+ * Indica se o CSV está em processo de carregamento.
14
+ */
15
+ isLoading: boolean;
16
+ }
17
+ /**
18
+ * Propriedades para o componente FiltroCard.
19
+ *
20
+ * @template T - Tipo dos dados utilizados.
21
+ */
22
+ export interface FiltroCardProps<T> {
23
+ /**
24
+ * Propriedades para manipulação do CSV.
25
+ */
26
+ csv?: CsvProps;
27
+ /**
28
+ * Título do cartão de filtros.
29
+ */
30
+ title?: string;
31
+ /**
32
+ * Texto de pesquisa utilizado para filtrar dados.
33
+ */
34
+ pesquisa?: string;
35
+ /**
36
+ * Indica se os filtros devem ser renderizados.
37
+ */
38
+ renderFiltro: boolean;
39
+ /**
40
+ * Propriedades para o botão Excel.
41
+ */
42
+ excelProps?: ButtonExcelProps<T>;
43
+ /**
44
+ * Função para atualizar o valor da pesquisa.
45
+ */
46
+ setPesquisa?: (value: string) => void;
47
+ /**
48
+ * Função para alterar o estado de abertura do cartão.
49
+ */
50
+ setOpen: React.Dispatch<React.SetStateAction<boolean>>;
51
+ }
52
+ /**
53
+ * Propriedades adicionais para inputs.
54
+ */
55
+ export interface AdicionalPropsInput {
56
+ /**
57
+ * Ordem de exibição do input.
58
+ */
59
+ order?: number;
60
+ /**
61
+ * Tamanho do grid para o input.
62
+ */
63
+ xs?: number;
64
+ }
65
+ export type InputsTypeFiltro = Omit<InputProps, 'sx'> & AdicionalPropsInput;
66
+ /**
67
+ * Propriedades para o componente Filtros.
68
+ *
69
+ * @template T - Tipo dos dados utilizados.
70
+ * @template M - Tipo opcional que define um parâmetro booleano.
71
+ */
72
+ export interface FiltrosProps<T, M extends boolean = false> {
73
+ /**
74
+ * Estado que determina se o drawer está aberto.
75
+ */
76
+ open?: boolean;
77
+ /**
78
+ * Função para alterar o estado do drawer.
79
+ */
80
+ setOpen: React.Dispatch<React.SetStateAction<boolean>>;
81
+ /**
82
+ * Lista de entradas do tipo Input.
83
+ */
84
+ inputs?: InputsTypeFiltro[];
85
+ /**
86
+ * Lista de entradas do tipo InputSelect.
87
+ */
88
+ inputSelect?: Array<Omit<InputSelectProps<T, M>, 'sx'> & AdicionalPropsInput>;
89
+ /**
90
+ * Função chamada ao limpar os filtros.
91
+ */
92
+ onClear?: () => void;
93
+ /**
94
+ * Função chamada ao submeter os filtros.
95
+ */
96
+ onSubmit?: (event: React.FormEvent<HTMLFormElement>) => void;
97
+ }
98
+ /**
99
+ * Propriedades para o componente Filtro.
100
+ *
101
+ * @template T - Tipo dos dados utilizados.
102
+ * @template M - Tipo opcional que define um parâmetro booleano.
103
+ */
104
+ export interface FiltroProps<T, M extends boolean = false> extends Omit<FiltroCardProps<T>, 'renderFiltro' | 'setOpen'>, Omit<FiltrosProps<T, M>, 'open' | 'setOpen'> {
105
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Este é um arquivo de ícones. Para obter os ícones, visite https://icons8.com/icons
3
+ * @ViniciusCLoeblein
4
+ */
5
+ /**
6
+ * ![img](./svgs/excel.svg)
7
+ */
8
+ declare const ExcelIcon: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
9
+ /**
10
+ * ![img](./svgs/check.svg)
11
+ */
12
+ declare const Check: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
13
+ /**
14
+ * ![img](./svgs/config.svg)
15
+ */
16
+ declare const Config: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
17
+ /**
18
+ * ![img](./svgs/loading.svg|height=20|width=20)
19
+ */
20
+ declare const Loading: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
21
+ export { ExcelIcon, Check, Config, Loading };
@@ -0,0 +1,39 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import ExcelSvg from './svgs/excel.svg';
4
+ import CheckSvg from './svgs/check.svg';
5
+ import ConfigSvg from './svgs/config.svg';
6
+ import LoadingSvg from './svgs/loading.svg';
7
+ /**
8
+ * Este é um arquivo de ícones. Para obter os ícones, visite https://icons8.com/icons
9
+ * @ViniciusCLoeblein
10
+ */
11
+ /**
12
+ * ![img](./svgs/excel.svg)
13
+ */
14
+ var ExcelIcon = memo(function () {
15
+ return _jsx("img", { src: ExcelSvg, alt: "Excel", loading: "lazy" });
16
+ });
17
+ ExcelIcon.displayName = 'ExcelIcon';
18
+ /**
19
+ * ![img](./svgs/check.svg)
20
+ */
21
+ var Check = memo(function () {
22
+ return _jsx("img", { src: CheckSvg, alt: "Check", loading: "lazy" });
23
+ });
24
+ Check.displayName = 'Check';
25
+ /**
26
+ * ![img](./svgs/config.svg)
27
+ */
28
+ var Config = memo(function () {
29
+ return _jsx("img", { src: ConfigSvg, alt: "Config", loading: "lazy" });
30
+ });
31
+ Config.displayName = 'Config';
32
+ /**
33
+ * ![img](./svgs/loading.svg|height=20|width=20)
34
+ */
35
+ var Loading = memo(function () {
36
+ return (_jsx("img", { src: LoadingSvg, alt: "Loading", loading: "lazy", className: "inline w-5 h-5 animate-spin" }));
37
+ });
38
+ Loading.displayName = 'Loading';
39
+ export { ExcelIcon, Check, Config, Loading };
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ type TabsValue = string | number;
3
+ export interface TabsItem {
4
+ label: React.ReactNode;
5
+ content: React.ReactNode;
6
+ disabled?: boolean;
7
+ icon?: React.ReactElement;
8
+ iconPosition?: 'top' | 'bottom' | 'start' | 'end';
9
+ value?: TabsValue;
10
+ }
11
+ export interface TabsProps {
12
+ items: TabsItem[];
13
+ value?: TabsValue;
14
+ defaultValue?: TabsValue;
15
+ onChange?: (value: TabsValue) => void;
16
+ ariaLabel?: string;
17
+ variant?: 'standard' | 'scrollable' | 'fullWidth';
18
+ centered?: boolean;
19
+ orientation?: 'horizontal' | 'vertical';
20
+ allowScrollButtonsMobile?: boolean;
21
+ scrollButtons?: 'auto' | true | false;
22
+ }
23
+ declare const Tabs: ({ items, value, defaultValue, onChange, ariaLabel, variant, centered, orientation, allowScrollButtonsMobile, scrollButtons, }: Readonly<TabsProps>) => import("react/jsx-runtime").JSX.Element;
24
+ export default Tabs;
@@ -0,0 +1,39 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo, useState } from 'react';
3
+ import { Box, Tab, Tabs as MuiTabs, ThemeProvider, createTheme, } from '@mui/material';
4
+ var tabsTheme = createTheme({
5
+ palette: {
6
+ primary: {
7
+ main: '#00b2a6',
8
+ light: '#00b2a6',
9
+ dark: '#00b2a6',
10
+ contrastText: '#ffffff',
11
+ },
12
+ },
13
+ });
14
+ function CustomTabPanel(_a) {
15
+ var value = _a.value, currentValue = _a.currentValue, children = _a.children, idPrefix = _a.idPrefix;
16
+ var isActive = currentValue === value;
17
+ return (_jsx("div", { role: "tabpanel", hidden: !isActive, id: "".concat(idPrefix, "-tabpanel-").concat(value), "aria-labelledby": "".concat(idPrefix, "-tab-").concat(value), children: isActive && _jsx(Box, { sx: { pt: 2 }, children: children }) }));
18
+ }
19
+ var Tabs = function (_a) {
20
+ var _b;
21
+ var items = _a.items, value = _a.value, defaultValue = _a.defaultValue, onChange = _a.onChange, _c = _a.ariaLabel, ariaLabel = _c === void 0 ? 'tabs' : _c, _d = _a.variant, variant = _d === void 0 ? 'standard' : _d, _e = _a.centered, centered = _e === void 0 ? false : _e, _f = _a.orientation, orientation = _f === void 0 ? 'horizontal' : _f, _g = _a.allowScrollButtonsMobile, allowScrollButtonsMobile = _g === void 0 ? false : _g, _h = _a.scrollButtons, scrollButtons = _h === void 0 ? 'auto' : _h;
22
+ var idPrefix = useMemo(function () { return "tabs-".concat(Math.random().toString(36).slice(2, 9)); }, []);
23
+ var tabValues = useMemo(function () { return items.map(function (item, index) { var _a; return (_a = item.value) !== null && _a !== void 0 ? _a : index; }); }, [items]);
24
+ var _j = useState((_b = defaultValue !== null && defaultValue !== void 0 ? defaultValue : tabValues[0]) !== null && _b !== void 0 ? _b : 0), internalValue = _j[0], setInternalValue = _j[1];
25
+ var currentValue = value !== null && value !== void 0 ? value : internalValue;
26
+ var handleChange = function (_event, newValue) {
27
+ if (value === undefined)
28
+ setInternalValue(newValue);
29
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
30
+ };
31
+ return (_jsx(ThemeProvider, { theme: tabsTheme, children: _jsxs(Box, { sx: { width: '100%' }, children: [_jsx(Box, { sx: { borderBottom: 1, borderColor: 'divider' }, children: _jsx(MuiTabs, { value: currentValue, onChange: handleChange, "aria-label": ariaLabel, textColor: "primary", indicatorColor: "primary", variant: variant, centered: centered, orientation: orientation, allowScrollButtonsMobile: allowScrollButtonsMobile, scrollButtons: scrollButtons, children: items.map(function (item, index) {
32
+ var tabValue = tabValues[index];
33
+ return (_jsx(Tab, { label: item.label, icon: item.icon, iconPosition: item.iconPosition, disabled: item.disabled, value: tabValue, id: "".concat(idPrefix, "-tab-").concat(tabValue), "aria-controls": "".concat(idPrefix, "-tabpanel-").concat(tabValue) }, String(tabValue)));
34
+ }) }) }), items.map(function (item, index) {
35
+ var tabValue = tabValues[index];
36
+ return (_jsx(CustomTabPanel, { value: tabValue, currentValue: currentValue, idPrefix: idPrefix, children: item.content }, String(tabValue)));
37
+ })] }) }));
38
+ };
39
+ export default Tabs;
@@ -128,7 +128,7 @@ export var mascaradorMilharDecimal = function (v) {
128
128
  */
129
129
  export var mascaradorValorReal = function (v) {
130
130
  // Convertendo para um número, se for uma string
131
- var valorNumerico = typeof v === 'string' ? parseFloat(v) : v !== null && v !== void 0 ? v : 0;
131
+ var valorNumerico = typeof v === 'string' ? parseFloat(v) : (v !== null && v !== void 0 ? v : 0);
132
132
  // Verificando se a conversão foi bem-sucedida
133
133
  if (!isNaN(valorNumerico)) {
134
134
  // Formatando o número como moeda