eai-frontend-components 2.0.23 → 2.0.25
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/LICENSE +20 -20
- package/README.md +298 -298
- package/dist/eai-frontend-components-1.0.0.tgz +0 -0
- package/dist/index.d.ts +24 -18
- package/dist/index.esm.js +24 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +24 -7
- package/dist/index.js.map +1 -1
- package/package.json +147 -146
- package/dist/components/ui/accordion.d.ts +0 -8
- package/dist/components/ui/accordion.d.ts.map +0 -1
- package/dist/components/ui/accordion.js +0 -13
- package/dist/components/ui/alert-dialog.d.ts +0 -25
- package/dist/components/ui/alert-dialog.d.ts.map +0 -1
- package/dist/components/ui/alert-dialog.js +0 -27
- package/dist/components/ui/alert.d.ts +0 -9
- package/dist/components/ui/alert.d.ts.map +0 -1
- package/dist/components/ui/alert.js +0 -22
- package/dist/components/ui/avatar.d.ts +0 -7
- package/dist/components/ui/avatar.d.ts.map +0 -1
- package/dist/components/ui/avatar.js +0 -11
- package/dist/components/ui/badge.d.ts +0 -10
- package/dist/components/ui/badge.d.ts.map +0 -1
- package/dist/components/ui/badge.js +0 -26
- package/dist/components/ui/breadcrumb.d.ts +0 -20
- package/dist/components/ui/breadcrumb.d.ts.map +0 -1
- package/dist/components/ui/breadcrumb.js +0 -23
- package/dist/components/ui/button.d.ts +0 -12
- package/dist/components/ui/button.d.ts.map +0 -1
- package/dist/components/ui/button.js +0 -33
- package/dist/components/ui/calendar.d.ts +0 -9
- package/dist/components/ui/calendar.d.ts.map +0 -1
- package/dist/components/ui/calendar.js +0 -70
- package/dist/components/ui/card.d.ts +0 -9
- package/dist/components/ui/card.d.ts.map +0 -1
- package/dist/components/ui/card.js +0 -16
- package/dist/components/ui/carousel.d.ts +0 -19
- package/dist/components/ui/carousel.d.ts.map +0 -1
- package/dist/components/ui/carousel.js +0 -98
- package/dist/components/ui/chart.d.ts +0 -63
- package/dist/components/ui/chart.d.ts.map +0 -1
- package/dist/components/ui/chart.js +0 -132
- package/dist/components/ui/checkbox.d.ts +0 -5
- package/dist/components/ui/checkbox.d.ts.map +0 -1
- package/dist/components/ui/checkbox.js +0 -8
- package/dist/components/ui/collapsible.d.ts +0 -6
- package/dist/components/ui/collapsible.d.ts.map +0 -1
- package/dist/components/ui/collapsible.js +0 -5
- package/dist/components/ui/command.d.ts +0 -81
- package/dist/components/ui/command.d.ts.map +0 -1
- package/dist/components/ui/command.js +0 -28
- package/dist/components/ui/context-menu.d.ts +0 -28
- package/dist/components/ui/context-menu.d.ts.map +0 -1
- package/dist/components/ui/context-menu.js +0 -33
- package/dist/components/ui/custom/date-picker.d.ts +0 -12
- package/dist/components/ui/custom/date-picker.d.ts.map +0 -1
- package/dist/components/ui/custom/date-picker.js +0 -35
- package/dist/components/ui/custom/form/checkbox.d.ts +0 -13
- package/dist/components/ui/custom/form/checkbox.d.ts.map +0 -1
- package/dist/components/ui/custom/form/checkbox.js +0 -15
- package/dist/components/ui/custom/form/color.d.ts +0 -15
- package/dist/components/ui/custom/form/color.d.ts.map +0 -1
- package/dist/components/ui/custom/form/color.js +0 -40
- package/dist/components/ui/custom/form/combobox.d.ts +0 -37
- package/dist/components/ui/custom/form/combobox.d.ts.map +0 -1
- package/dist/components/ui/custom/form/combobox.js +0 -82
- package/dist/components/ui/custom/form/cpf-cnpj.d.ts +0 -16
- package/dist/components/ui/custom/form/cpf-cnpj.d.ts.map +0 -1
- package/dist/components/ui/custom/form/cpf-cnpj.js +0 -32
- package/dist/components/ui/custom/form/currency.d.ts +0 -14
- package/dist/components/ui/custom/form/currency.d.ts.map +0 -1
- package/dist/components/ui/custom/form/currency.js +0 -15
- package/dist/components/ui/custom/form/date-range.d.ts +0 -16
- package/dist/components/ui/custom/form/date-range.d.ts.map +0 -1
- package/dist/components/ui/custom/form/date-range.js +0 -24
- package/dist/components/ui/custom/form/date.d.ts +0 -16
- package/dist/components/ui/custom/form/date.d.ts.map +0 -1
- package/dist/components/ui/custom/form/date.js +0 -35
- package/dist/components/ui/custom/form/decimal.d.ts +0 -14
- package/dist/components/ui/custom/form/decimal.d.ts.map +0 -1
- package/dist/components/ui/custom/form/decimal.js +0 -15
- package/dist/components/ui/custom/form/file.d.ts +0 -15
- package/dist/components/ui/custom/form/file.d.ts.map +0 -1
- package/dist/components/ui/custom/form/file.js +0 -18
- package/dist/components/ui/custom/form/form-help-text.d.ts +0 -3
- package/dist/components/ui/custom/form/form-help-text.d.ts.map +0 -1
- package/dist/components/ui/custom/form/form-help-text.js +0 -7
- package/dist/components/ui/custom/form/form-label.d.ts +0 -7
- package/dist/components/ui/custom/form/form-label.d.ts.map +0 -1
- package/dist/components/ui/custom/form/form-label.js +0 -9
- package/dist/components/ui/custom/form/form-message.d.ts +0 -5
- package/dist/components/ui/custom/form/form-message.d.ts.map +0 -1
- package/dist/components/ui/custom/form/form-message.js +0 -5
- package/dist/components/ui/custom/form/ghost.d.ts +0 -8
- package/dist/components/ui/custom/form/ghost.d.ts.map +0 -1
- package/dist/components/ui/custom/form/ghost.js +0 -8
- package/dist/components/ui/custom/form/input.d.ts +0 -18
- package/dist/components/ui/custom/form/input.d.ts.map +0 -1
- package/dist/components/ui/custom/form/input.js +0 -14
- package/dist/components/ui/custom/form/mask.d.ts +0 -19
- package/dist/components/ui/custom/form/mask.d.ts.map +0 -1
- package/dist/components/ui/custom/form/mask.js +0 -19
- package/dist/components/ui/custom/form/multi-select.d.ts +0 -26
- package/dist/components/ui/custom/form/multi-select.d.ts.map +0 -1
- package/dist/components/ui/custom/form/multi-select.js +0 -66
- package/dist/components/ui/custom/form/password.d.ts +0 -16
- package/dist/components/ui/custom/form/password.d.ts.map +0 -1
- package/dist/components/ui/custom/form/password.js +0 -14
- package/dist/components/ui/custom/form/percent.d.ts +0 -14
- package/dist/components/ui/custom/form/percent.d.ts.map +0 -1
- package/dist/components/ui/custom/form/percent.js +0 -15
- package/dist/components/ui/custom/form/phone.d.ts +0 -16
- package/dist/components/ui/custom/form/phone.d.ts.map +0 -1
- package/dist/components/ui/custom/form/phone.js +0 -23
- package/dist/components/ui/custom/form/radio-group.d.ts +0 -23
- package/dist/components/ui/custom/form/radio-group.d.ts.map +0 -1
- package/dist/components/ui/custom/form/radio-group.js +0 -15
- package/dist/components/ui/custom/form/select.d.ts +0 -20
- package/dist/components/ui/custom/form/select.d.ts.map +0 -1
- package/dist/components/ui/custom/form/select.js +0 -12
- package/dist/components/ui/custom/form/step-new-form.d.ts +0 -10
- package/dist/components/ui/custom/form/step-new-form.d.ts.map +0 -1
- package/dist/components/ui/custom/form/step-new-form.js +0 -13
- package/dist/components/ui/custom/form/switch.d.ts +0 -13
- package/dist/components/ui/custom/form/switch.d.ts.map +0 -1
- package/dist/components/ui/custom/form/switch.js +0 -16
- package/dist/components/ui/custom/form/text.d.ts +0 -18
- package/dist/components/ui/custom/form/text.d.ts.map +0 -1
- package/dist/components/ui/custom/form/text.js +0 -14
- package/dist/components/ui/custom/form/textarea.d.ts +0 -16
- package/dist/components/ui/custom/form/textarea.d.ts.map +0 -1
- package/dist/components/ui/custom/form/textarea.js +0 -19
- package/dist/components/ui/custom/form/utils.d.ts +0 -18
- package/dist/components/ui/custom/form/utils.d.ts.map +0 -1
- package/dist/components/ui/custom/form/utils.js +0 -88
- package/dist/components/ui/custom/header.d.ts +0 -11
- package/dist/components/ui/custom/header.d.ts.map +0 -1
- package/dist/components/ui/custom/header.js +0 -74
- package/dist/components/ui/custom/label.d.ts +0 -13
- package/dist/components/ui/custom/label.d.ts.map +0 -1
- package/dist/components/ui/custom/label.js +0 -20
- package/dist/components/ui/custom/not-found.d.ts +0 -3
- package/dist/components/ui/custom/not-found.d.ts.map +0 -1
- package/dist/components/ui/custom/not-found.js +0 -9
- package/dist/components/ui/custom/sidebar/module-switcher.d.ts +0 -9
- package/dist/components/ui/custom/sidebar/module-switcher.d.ts.map +0 -1
- package/dist/components/ui/custom/sidebar/module-switcher.js +0 -20
- package/dist/components/ui/custom/sidebar/nav-footer.d.ts +0 -7
- package/dist/components/ui/custom/sidebar/nav-footer.d.ts.map +0 -1
- package/dist/components/ui/custom/sidebar/nav-footer.js +0 -13
- package/dist/components/ui/custom/sidebar/nav-main.d.ts +0 -7
- package/dist/components/ui/custom/sidebar/nav-main.d.ts.map +0 -1
- package/dist/components/ui/custom/sidebar/nav-main.js +0 -27
- package/dist/components/ui/custom/sidebar/nav-submenu-collapsible.d.ts +0 -9
- package/dist/components/ui/custom/sidebar/nav-submenu-collapsible.d.ts.map +0 -1
- package/dist/components/ui/custom/sidebar/nav-submenu-collapsible.js +0 -18
- package/dist/components/ui/custom/sidebar/nav-submenu-dropdown.d.ts +0 -10
- package/dist/components/ui/custom/sidebar/nav-submenu-dropdown.d.ts.map +0 -1
- package/dist/components/ui/custom/sidebar/nav-submenu-dropdown.js +0 -10
- package/dist/components/ui/custom/sidebar/nav-user.d.ts +0 -9
- package/dist/components/ui/custom/sidebar/nav-user.d.ts.map +0 -1
- package/dist/components/ui/custom/sidebar/nav-user.js +0 -24
- package/dist/components/ui/custom/sidebar/sidebar-button.d.ts +0 -9
- package/dist/components/ui/custom/sidebar/sidebar-button.d.ts.map +0 -1
- package/dist/components/ui/custom/sidebar/sidebar-button.js +0 -7
- package/dist/components/ui/custom/sidebar/sidebar-item-two-lines.d.ts +0 -12
- package/dist/components/ui/custom/sidebar/sidebar-item-two-lines.d.ts.map +0 -1
- package/dist/components/ui/custom/sidebar/sidebar-item-two-lines.js +0 -5
- package/dist/components/ui/custom/sidebar/sidebar-item.d.ts +0 -9
- package/dist/components/ui/custom/sidebar/sidebar-item.d.ts.map +0 -1
- package/dist/components/ui/custom/sidebar/sidebar-item.js +0 -7
- package/dist/components/ui/custom/sidebar/types/sidebar.d.ts +0 -29
- package/dist/components/ui/custom/sidebar/types/sidebar.d.ts.map +0 -1
- package/dist/components/ui/custom/sidebar/types/sidebar.js +0 -5
- package/dist/components/ui/custom/table/data-table-export.d.ts +0 -8
- package/dist/components/ui/custom/table/data-table-export.d.ts.map +0 -1
- package/dist/components/ui/custom/table/data-table-export.js +0 -65
- package/dist/components/ui/custom/table/data-table-footer.d.ts +0 -25
- package/dist/components/ui/custom/table/data-table-footer.d.ts.map +0 -1
- package/dist/components/ui/custom/table/data-table-footer.js +0 -39
- package/dist/components/ui/custom/table/data-table-header.d.ts +0 -9
- package/dist/components/ui/custom/table/data-table-header.d.ts.map +0 -1
- package/dist/components/ui/custom/table/data-table-header.js +0 -11
- package/dist/components/ui/custom/table/data-table-rows.d.ts +0 -13
- package/dist/components/ui/custom/table/data-table-rows.d.ts.map +0 -1
- package/dist/components/ui/custom/table/data-table-rows.js +0 -25
- package/dist/components/ui/custom/table/data-table.d.ts +0 -35
- package/dist/components/ui/custom/table/data-table.d.ts.map +0 -1
- package/dist/components/ui/custom/table/data-table.js +0 -99
- package/dist/components/ui/custom/table/types/data-table.d.ts +0 -29
- package/dist/components/ui/custom/table/types/data-table.d.ts.map +0 -1
- package/dist/components/ui/custom/table/types/data-table.js +0 -1
- package/dist/components/ui/custom/theme-provider.d.ts +0 -24
- package/dist/components/ui/custom/theme-provider.d.ts.map +0 -1
- package/dist/components/ui/custom/theme-provider.js +0 -79
- package/dist/components/ui/dateRangePicker.d.ts +0 -3
- package/dist/components/ui/dateRangePicker.d.ts.map +0 -1
- package/dist/components/ui/dateRangePicker.js +0 -15
- package/dist/components/ui/dialog.d.ts +0 -23
- package/dist/components/ui/dialog.d.ts.map +0 -1
- package/dist/components/ui/dialog.js +0 -23
- package/dist/components/ui/drawer.d.ts +0 -23
- package/dist/components/ui/drawer.d.ts.map +0 -1
- package/dist/components/ui/drawer.js +0 -22
- package/dist/components/ui/dropdown-menu.d.ts +0 -28
- package/dist/components/ui/dropdown-menu.d.ts.map +0 -1
- package/dist/components/ui/dropdown-menu.js +0 -32
- package/dist/components/ui/form.d.ts +0 -24
- package/dist/components/ui/form.d.ts.map +0 -1
- package/dist/components/ui/form.js +0 -60
- package/dist/components/ui/hover-card.d.ts +0 -7
- package/dist/components/ui/hover-card.d.ts.map +0 -1
- package/dist/components/ui/hover-card.js +0 -9
- package/dist/components/ui/input.d.ts +0 -24
- package/dist/components/ui/input.d.ts.map +0 -1
- package/dist/components/ui/input.js +0 -71
- package/dist/components/ui/label.d.ts +0 -6
- package/dist/components/ui/label.d.ts.map +0 -1
- package/dist/components/ui/label.js +0 -9
- package/dist/components/ui/masks.d.ts +0 -17
- package/dist/components/ui/masks.d.ts.map +0 -1
- package/dist/components/ui/masks.js +0 -25
- package/dist/components/ui/pagination.d.ts +0 -30
- package/dist/components/ui/pagination.d.ts.map +0 -1
- package/dist/components/ui/pagination.js +0 -23
- package/dist/components/ui/popover.d.ts +0 -7
- package/dist/components/ui/popover.d.ts.map +0 -1
- package/dist/components/ui/popover.js +0 -11
- package/dist/components/ui/progress.d.ts +0 -5
- package/dist/components/ui/progress.d.ts.map +0 -1
- package/dist/components/ui/progress.js +0 -7
- package/dist/components/ui/radio-group.d.ts +0 -6
- package/dist/components/ui/radio-group.d.ts.map +0 -1
- package/dist/components/ui/radio-group.js +0 -14
- package/dist/components/ui/scroll-area.d.ts +0 -6
- package/dist/components/ui/scroll-area.d.ts.map +0 -1
- package/dist/components/ui/scroll-area.js +0 -11
- package/dist/components/ui/select.d.ts +0 -14
- package/dist/components/ui/select.d.ts.map +0 -1
- package/dist/components/ui/select.js +0 -24
- package/dist/components/ui/separator.d.ts +0 -5
- package/dist/components/ui/separator.d.ts.map +0 -1
- package/dist/components/ui/separator.js +0 -7
- package/dist/components/ui/sheet.d.ts +0 -26
- package/dist/components/ui/sheet.d.ts.map +0 -1
- package/dist/components/ui/sheet.js +0 -37
- package/dist/components/ui/sidebar.d.ts +0 -67
- package/dist/components/ui/sidebar.d.ts.map +0 -1
- package/dist/components/ui/sidebar.js +0 -221
- package/dist/components/ui/skeleton.d.ts +0 -3
- package/dist/components/ui/skeleton.d.ts.map +0 -1
- package/dist/components/ui/skeleton.js +0 -6
- package/dist/components/ui/slider.d.ts +0 -5
- package/dist/components/ui/slider.d.ts.map +0 -1
- package/dist/components/ui/slider.js +0 -7
- package/dist/components/ui/switch.d.ts +0 -5
- package/dist/components/ui/switch.d.ts.map +0 -1
- package/dist/components/ui/switch.js +0 -7
- package/dist/components/ui/table.d.ts +0 -11
- package/dist/components/ui/table.d.ts.map +0 -1
- package/dist/components/ui/table.js +0 -20
- package/dist/components/ui/tabs.d.ts +0 -8
- package/dist/components/ui/tabs.d.ts.map +0 -1
- package/dist/components/ui/tabs.js +0 -12
- package/dist/components/ui/textarea.d.ts +0 -4
- package/dist/components/ui/textarea.d.ts.map +0 -1
- package/dist/components/ui/textarea.js +0 -14
- package/dist/components/ui/toast.d.ts +0 -16
- package/dist/components/ui/toast.d.ts.map +0 -1
- package/dist/components/ui/toast.js +0 -34
- package/dist/components/ui/toaster.d.ts +0 -2
- package/dist/components/ui/toaster.d.ts.map +0 -1
- package/dist/components/ui/toaster.js +0 -21
- package/dist/components/ui/tooltip.d.ts +0 -8
- package/dist/components/ui/tooltip.d.ts.map +0 -1
- package/dist/components/ui/tooltip.js +0 -10
- package/dist/components/ui/use-calendar.d.ts +0 -7
- package/dist/components/ui/use-calendar.d.ts.map +0 -1
- package/dist/components/ui/use-calendar.js +0 -23
- package/dist/components/ui/use-toast.d.ts +0 -46
- package/dist/components/ui/use-toast.d.ts.map +0 -1
- package/dist/components/ui/use-toast.js +0 -125
- package/dist/hooks/use-mobile.d.ts +0 -2
- package/dist/hooks/use-mobile.d.ts.map +0 -1
- package/dist/hooks/use-mobile.js +0 -15
- package/dist/index.d.ts.map +0 -1
- package/dist/lib/help/date-utils.d.ts +0 -7
- package/dist/lib/help/date-utils.d.ts.map +0 -1
- package/dist/lib/help/date-utils.js +0 -34
- package/dist/lib/help/format.d.ts +0 -22
- package/dist/lib/help/format.d.ts.map +0 -1
- package/dist/lib/help/format.js +0 -140
- package/dist/lib/help/theme.d.ts +0 -291
- package/dist/lib/help/theme.d.ts.map +0 -1
- package/dist/lib/help/theme.js +0 -340
- package/dist/lib/help/uuid.d.ts +0 -2
- package/dist/lib/help/uuid.d.ts.map +0 -1
- package/dist/lib/help/uuid.js +0 -4
- package/dist/lib/utils.d.ts +0 -3
- package/dist/lib/utils.d.ts.map +0 -1
- package/dist/lib/utils.js +0 -5
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ExportDataTable } from './types/data-table';
|
|
2
|
-
interface DataTableExportProps {
|
|
3
|
-
exportData?: ExportDataTable;
|
|
4
|
-
totalRows: number;
|
|
5
|
-
}
|
|
6
|
-
export declare function DataTableExport({ exportData, totalRows }: DataTableExportProps): import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=data-table-export.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data-table-export.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/custom/table/data-table-export.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,UAAU,oBAAoB;IAC7B,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,eAAe,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,oBAAoB,8DA8G9E"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { zodResolver } from '@hookform/resolvers/zod';
|
|
3
|
-
import { useForm } from 'react-hook-form';
|
|
4
|
-
import { z } from 'zod';
|
|
5
|
-
import { Button } from '../../button';
|
|
6
|
-
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from '../../dialog';
|
|
7
|
-
import { Form } from '../../form';
|
|
8
|
-
import { toast } from '../../use-toast';
|
|
9
|
-
import { FormRadioGroup } from '../form/radio-group';
|
|
10
|
-
export function DataTableExport({ exportData, totalRows }) {
|
|
11
|
-
const exportXlSX = () => {
|
|
12
|
-
if (!exportData)
|
|
13
|
-
return;
|
|
14
|
-
if (totalRows === 0) {
|
|
15
|
-
toast({
|
|
16
|
-
title: 'Não há dados para exportar.',
|
|
17
|
-
variant: 'destructive',
|
|
18
|
-
});
|
|
19
|
-
return {};
|
|
20
|
-
}
|
|
21
|
-
const params = new URLSearchParams(exportData.params).toString();
|
|
22
|
-
window.open(`${exportData.url}?${params}`, '_blank');
|
|
23
|
-
};
|
|
24
|
-
const renderExport = () => {
|
|
25
|
-
if (!exportData)
|
|
26
|
-
return null;
|
|
27
|
-
if (exportData.type === 'xlsx') {
|
|
28
|
-
return (_jsx(Button, { variant: 'secondary', onClick: exportXlSX, children: "Exportar" }));
|
|
29
|
-
}
|
|
30
|
-
if (exportData.type === 'dialog') {
|
|
31
|
-
const ExportDataSchema = z.object({
|
|
32
|
-
model: z.string(),
|
|
33
|
-
format: z.string(),
|
|
34
|
-
});
|
|
35
|
-
const form = useForm({
|
|
36
|
-
mode: 'onTouched',
|
|
37
|
-
resolver: zodResolver(ExportDataSchema),
|
|
38
|
-
});
|
|
39
|
-
const { control, trigger, handleSubmit } = form;
|
|
40
|
-
const onSubmit = async (values) => {
|
|
41
|
-
await trigger();
|
|
42
|
-
toast({
|
|
43
|
-
title: 'Em desenvolvimento.',
|
|
44
|
-
variant: 'destructive',
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
const onError = async (errors) => {
|
|
48
|
-
toast({
|
|
49
|
-
title: 'Erro ao salvar',
|
|
50
|
-
description: 'Verifique os campos obrigatórios',
|
|
51
|
-
variant: 'destructive',
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
return (_jsx(Form, { ...form, onSubmit: handleSubmit(onSubmit, onError), children: _jsxs(Dialog, { children: [_jsx(DialogTrigger, { asChild: true, children: _jsx(Button, { variant: 'secondary', children: "Exportar" }) }), _jsxs(DialogContent, { hideClose: true, className: 'fixed p-6 rounded-lg w-[451px]', children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Exportar" }), _jsx(DialogDescription, {})] }), _jsxs("div", { className: 'flex flex-col gap-6', children: [_jsx(FormRadioGroup, { control: control, name: 'model', label: 'Selecione o modelo de visualiza\u00E7\u00E3o', options: [
|
|
55
|
-
{ value: '0', label: 'Resumido' },
|
|
56
|
-
{ value: '1', label: 'Detalhado' },
|
|
57
|
-
], className: 'text-sm font-normal', classNameOptions: 'flex flex-col gap-4 mt-4 text-sm font-normal' }), _jsx(FormRadioGroup, { control: control, name: 'format', label: 'Selecione o formato desejado para exporta\u00E7\u00E3o', options: [
|
|
58
|
-
{ value: '0', label: 'PDF' },
|
|
59
|
-
{ value: '1', label: 'XLSX' },
|
|
60
|
-
], className: 'text-sm font-normal', classNameOptions: 'flex flex-col gap-4 mt-4 text-sm font-normal' })] }), _jsxs(DialogFooter, { className: 'sm:justify-end gap-2', children: [_jsx(Button, { type: 'button', variant: 'secondary', children: "Fechar" }), _jsx(Button, { type: 'button', variant: 'default', onClick: () => exportXlSX(), children: "Exportar" })] })] })] }) }));
|
|
61
|
-
}
|
|
62
|
-
return null;
|
|
63
|
-
};
|
|
64
|
-
return exportData && renderExport();
|
|
65
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { PaginationState } from '@tanstack/react-table';
|
|
2
|
-
import { ExportDataTable } from './types/data-table';
|
|
3
|
-
interface DataTableFooterProps<TData> {
|
|
4
|
-
hidePagination?: boolean;
|
|
5
|
-
disablePagination?: boolean;
|
|
6
|
-
isLoading?: boolean;
|
|
7
|
-
totalRows: number;
|
|
8
|
-
totalPages: number;
|
|
9
|
-
currentPage: number;
|
|
10
|
-
pagination: PaginationState;
|
|
11
|
-
handlePageSize: (value: number) => void;
|
|
12
|
-
handlePage: (value: number) => void;
|
|
13
|
-
previousPage: {
|
|
14
|
-
action: () => void;
|
|
15
|
-
disabled: boolean;
|
|
16
|
-
};
|
|
17
|
-
nextPage: {
|
|
18
|
-
action: () => void;
|
|
19
|
-
disabled: boolean;
|
|
20
|
-
};
|
|
21
|
-
exportData?: ExportDataTable;
|
|
22
|
-
}
|
|
23
|
-
export declare function DataTableFooter<TData>({ isLoading, totalRows, totalPages, currentPage, hidePagination, disablePagination, pagination, handlePageSize, handlePage, previousPage, nextPage, exportData, }: DataTableFooterProps<TData>): false | import("react/jsx-runtime").JSX.Element;
|
|
24
|
-
export {};
|
|
25
|
-
//# sourceMappingURL=data-table-footer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data-table-footer.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/custom/table/data-table-footer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAaxD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,UAAU,oBAAoB,CAAC,KAAK;IACnC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,eAAe,CAAC;IAC5B,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,YAAY,EAAE;QACb,MAAM,EAAE,MAAM,IAAI,CAAC;QACnB,QAAQ,EAAE,OAAO,CAAC;KAClB,CAAC;IACF,QAAQ,EAAE;QACT,MAAM,EAAE,MAAM,IAAI,CAAC;QACnB,QAAQ,EAAE,OAAO,CAAC;KAClB,CAAC;IACF,UAAU,CAAC,EAAE,eAAe,CAAC;CAC7B;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,EACtC,SAAS,EACT,SAAS,EACT,UAAU,EACV,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,UAAU,GACV,EAAE,oBAAoB,CAAC,KAAK,CAAC,mDAkG7B"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Badge } from '../../badge';
|
|
3
|
-
import { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, } from '../../pagination';
|
|
4
|
-
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from '../../select';
|
|
5
|
-
import { DataTableExport } from './data-table-export';
|
|
6
|
-
export function DataTableFooter({ isLoading, totalRows, totalPages, currentPage, hidePagination, disablePagination, pagination, handlePageSize, handlePage, previousPage, nextPage, exportData, }) {
|
|
7
|
-
const renderPaginationPages = () => {
|
|
8
|
-
const paginationItems = [];
|
|
9
|
-
const createPaginationItem = (pageIndex) => (_jsx(PaginationItem, { children: _jsx(PaginationLink, { onClick: () => handlePage(pageIndex), isActive: currentPage === pageIndex, children: pageIndex + 1 }) }, pageIndex));
|
|
10
|
-
// Add first page
|
|
11
|
-
paginationItems.push(createPaginationItem(0));
|
|
12
|
-
// Add ellipsis if needed
|
|
13
|
-
if (currentPage > 2) {
|
|
14
|
-
paginationItems.push(_jsx(PaginationEllipsis, {}, 'start-ellipsis'));
|
|
15
|
-
}
|
|
16
|
-
// Add pages before current page
|
|
17
|
-
for (let i = Math.max(1, currentPage - 1); i < currentPage; i++) {
|
|
18
|
-
paginationItems.push(createPaginationItem(i));
|
|
19
|
-
}
|
|
20
|
-
// Add current page
|
|
21
|
-
if (currentPage !== 0 && currentPage !== totalPages - 1) {
|
|
22
|
-
paginationItems.push(createPaginationItem(currentPage));
|
|
23
|
-
}
|
|
24
|
-
// Add pages after current page
|
|
25
|
-
for (let i = currentPage + 1; i <= Math.min(totalPages - 2, currentPage + 1); i++) {
|
|
26
|
-
paginationItems.push(createPaginationItem(i));
|
|
27
|
-
}
|
|
28
|
-
// Add ellipsis if needed
|
|
29
|
-
if (currentPage < totalPages - 3) {
|
|
30
|
-
paginationItems.push(_jsx(PaginationEllipsis, {}, 'end-ellipsis'));
|
|
31
|
-
}
|
|
32
|
-
// Add last page
|
|
33
|
-
if (totalPages > 1) {
|
|
34
|
-
paginationItems.push(createPaginationItem(totalPages - 1));
|
|
35
|
-
}
|
|
36
|
-
return paginationItems;
|
|
37
|
-
};
|
|
38
|
-
return (!hidePagination && (_jsxs("footer", { className: 'flex items-center justify-between h-[64px]', children: [_jsxs("div", { className: 'flex flex-row items-center gap-6', children: [_jsxs("div", { className: 'flex flex-row items-center gap-2', children: ["Linhas por p\u00E1gina", _jsxs(Select, { value: pagination.pageSize.toString(), onValueChange: (value) => handlePageSize(Number(value)), disabled: isLoading || disablePagination, children: [_jsx(SelectTrigger, { className: 'w-20', children: _jsx(SelectValue, { placeholder: '', className: 'text-slate-800 font-medium' }) }), _jsx(SelectContent, { children: _jsxs(SelectGroup, { children: [_jsx(SelectItem, { value: '25', children: "25" }), _jsx(SelectItem, { value: '50', children: "50" }), _jsx(SelectItem, { value: '100', children: "100" })] }) })] })] }), _jsx(DataTableExport, { exportData: exportData, totalRows: totalPages })] }), _jsxs("div", { className: 'flex items-center gap-4', children: [_jsx("div", { children: !isLoading && (_jsx(Badge, { variant: 'secondary', children: totalRows === 0 ? 'Nenhum item' : totalRows === 1 ? '1 item' : `${totalRows} itens` })) }), _jsx("div", { children: _jsx(Pagination, { children: _jsxs(PaginationContent, { children: [_jsx(PaginationItem, { children: _jsx(PaginationPrevious, { onClick: () => previousPage.action(), disabled: previousPage.disabled || disablePagination }) }), renderPaginationPages(), _jsx(PaginationItem, { children: _jsx(PaginationNext, { onClick: () => nextPage.action(), disabled: nextPage.disabled || disablePagination }) })] }) }) })] })] })));
|
|
39
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Table } from '@tanstack/react-table';
|
|
2
|
-
interface DataTableHeaderProps<TData> {
|
|
3
|
-
table: Table<TData>;
|
|
4
|
-
canActionsRow?: boolean;
|
|
5
|
-
enableMultiRowSelection?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare function DataTableHeader<TData>({ table, canActionsRow, enableMultiRowSelection }: DataTableHeaderProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=data-table-header.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data-table-header.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/custom/table/data-table-header.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAc,MAAM,uBAAuB,CAAC;AAO1D,UAAU,oBAAoB,CAAC,KAAK;IACnC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,uBAAuB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,uBAAuB,EAAE,EAAE,oBAAoB,CAAC,KAAK,CAAC,2CA4CpH"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { flexRender } from '@tanstack/react-table';
|
|
3
|
-
import { ArrowUpDown, MoveDown, MoveUp } from 'lucide-react';
|
|
4
|
-
import { cn } from '../../../../lib/utils';
|
|
5
|
-
import { Button } from '../../button';
|
|
6
|
-
import { Checkbox } from '../../checkbox';
|
|
7
|
-
import { TableHead, TableHeader, TableRow } from '../../table';
|
|
8
|
-
export function DataTableHeader({ table, canActionsRow, enableMultiRowSelection }) {
|
|
9
|
-
const headerGroups = table.getHeaderGroups();
|
|
10
|
-
return (_jsx(TableHeader, { children: headerGroups.map((headerGroup) => (_jsxs(TableRow, { className: 'bg-background dark:bg-datatable-accent rounded-t-md sticky top-0 z-10', children: [enableMultiRowSelection && (_jsx(TableHead, { className: 'h-[65px] w-6', children: _jsx(Checkbox, { checked: table.getIsAllPageRowsSelected() || (table.getIsSomePageRowsSelected() && 'indeterminate'), onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value) }) })), headerGroup.headers.map((header) => (_jsx(TableHead, { className: cn('h-[65px] whitespace-nowrap', header.column.id === 'id' ? 'sticky left-0 z-20' : '', header.column.columnDef.enableSorting ? 'pl-2' : ''), children: header.column.columnDef.enableSorting ? (_jsxs(Button, { variant: 'ghost', onClick: () => header.column.toggleSorting(header.column.getIsSorted() === 'asc'), children: [flexRender(header.column.columnDef.header, header.getContext()), header.column.getIsSorted() === 'asc' ? (_jsx(MoveUp, { className: 'ml-2 h-4 w-4' })) : header.column.getIsSorted() === 'desc' ? (_jsx(MoveDown, { className: 'ml-2 h-4 w-4' })) : (_jsx(ArrowUpDown, { className: 'ml-2 h-4 w-4' }))] })) : (flexRender(header.column.columnDef.header, header.getContext())) }, header.id))), canActionsRow && _jsx(TableHead, {})] }, headerGroup.id))) }));
|
|
11
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ColumnDef, Table } from '@tanstack/react-table';
|
|
2
|
-
import { ActionRow } from './types/data-table';
|
|
3
|
-
interface DataTableRowsProps<TData> {
|
|
4
|
-
table: Table<TData>;
|
|
5
|
-
columns: ColumnDef<TData>[];
|
|
6
|
-
isLoading?: boolean;
|
|
7
|
-
actionsRow?: ActionRow[];
|
|
8
|
-
textNoRecords?: string;
|
|
9
|
-
enableMultiRowSelection?: boolean;
|
|
10
|
-
}
|
|
11
|
-
export declare function DataTableRows<TData>({ table, isLoading, columns, actionsRow, textNoRecords, enableMultiRowSelection }: DataTableRowsProps<TData>): import("react/jsx-runtime").JSX.Element | import("react/jsx-runtime").JSX.Element[];
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=data-table-rows.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data-table-rows.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/custom/table/data-table-rows.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAc,MAAM,uBAAuB,CAAC;AAMrE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,UAAU,kBAAkB,CAAC,KAAK;IACjC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACpB,OAAO,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uBAAuB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,uBAAuB,EAAE,EAAE,kBAAkB,CAAC,KAAK,CAAC,uFA4EhJ"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { flexRender } from '@tanstack/react-table';
|
|
3
|
-
import { cn } from '../../../../lib/utils';
|
|
4
|
-
import { Button } from '../../button';
|
|
5
|
-
import { Checkbox } from '../../checkbox';
|
|
6
|
-
import { Skeleton } from '../../skeleton';
|
|
7
|
-
import { TableCell, TableRow } from '../../table';
|
|
8
|
-
export function DataTableRows({ table, isLoading, columns, actionsRow, textNoRecords, enableMultiRowSelection }) {
|
|
9
|
-
const rows = table.getRowModel().rows;
|
|
10
|
-
const renderLoadingRows = () => {
|
|
11
|
-
const rows = [];
|
|
12
|
-
for (let i = 0; i < 10; i++) {
|
|
13
|
-
rows.push(_jsxs(TableRow, { children: [enableMultiRowSelection && (_jsx(TableCell, { className: 'py-2', children: _jsx(Skeleton, { className: 'h-10 w-full' }) })), columns.map((column) => (_jsx(TableCell, { className: 'py-2', children: _jsx(Skeleton, { className: 'h-10 w-full' }) }, column.id)))] }, `loading-row-${i}`));
|
|
14
|
-
}
|
|
15
|
-
return rows;
|
|
16
|
-
};
|
|
17
|
-
const renderRows = () => {
|
|
18
|
-
return rows.map((row) => (_jsxs(TableRow, { "data-state": row.getIsSelected() && 'selected', className: 'group', children: [enableMultiRowSelection && (_jsx(TableCell, { className: 'py-4', children: _jsx(Checkbox, { checked: row.getIsSelected(), onCheckedChange: (value) => row.toggleSelected(!!value), "aria-label": 'Select row' }) })), row.getVisibleCells().map((cell) => (_jsx(TableCell, { className: 'py-4', children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))), actionsRow && (_jsx(TableCell, { className: 'opacity-0 group-hover:opacity-100 hover:opacity-100 relative overflow-visible w-[0px]', children: _jsx("div", { className: 'absolute transition-colors group-hover:bg-datatable-accent overflow-visible right-5 -translate-y-1/2 flex space-x-4', children: actionsRow.map((action, index) => (_jsxs(Button, { variant: action.variant || 'default', className: cn('bg-datatable-accent', action.className?.(row.original) || ''), onClick: () => action.onClick?.(row.original), disabled: action.disabled?.(row.original) || false, children: [action.icon, action.label] }, `action-row-${index}`))) }) }, `buttons-${row.id}`))] }, row.id)));
|
|
19
|
-
};
|
|
20
|
-
const renderEmptyRows = () => {
|
|
21
|
-
const colSpan = columns.length + (actionsRow ? 1 : 0);
|
|
22
|
-
return (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: colSpan, className: 'text-center h-[53px]', children: textNoRecords ? textNoRecords : 'Sem resultados.' }) }));
|
|
23
|
-
};
|
|
24
|
-
return isLoading ? renderLoadingRows() : rows.length ? renderRows() : renderEmptyRows();
|
|
25
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { ColumnDef } from '@tanstack/react-table';
|
|
2
|
-
import { ActionRow, ActionTable, ExportDataTable, FiltersActions } from './types/data-table';
|
|
3
|
-
export interface DataTableProps<TData> {
|
|
4
|
-
columns: ColumnDef<TData>[];
|
|
5
|
-
data: TData[];
|
|
6
|
-
actions?: ActionTable[];
|
|
7
|
-
actionsRow?: ActionRow[];
|
|
8
|
-
customFilters?: JSX.Element;
|
|
9
|
-
className?: string;
|
|
10
|
-
title?: string;
|
|
11
|
-
rowsPage?: number;
|
|
12
|
-
setSearch?: (value?: string) => void;
|
|
13
|
-
setSelectRows?: (ids: string[]) => void;
|
|
14
|
-
pageChanged?: (pageNumber: number) => void;
|
|
15
|
-
pageSizeChanged?: (pageSize: number) => void;
|
|
16
|
-
totalRows?: number;
|
|
17
|
-
filtersActions?: FiltersActions;
|
|
18
|
-
exportData?: ExportDataTable;
|
|
19
|
-
textNoRecords?: string;
|
|
20
|
-
heightRemainingScroll?: number;
|
|
21
|
-
hideFilterField?: boolean;
|
|
22
|
-
multiRowSelection?: {
|
|
23
|
-
callback: (selectedRows: any[]) => void;
|
|
24
|
-
};
|
|
25
|
-
hidePagination?: boolean;
|
|
26
|
-
disablePagination?: boolean;
|
|
27
|
-
isLoading?: boolean;
|
|
28
|
-
fixedHeight?: number;
|
|
29
|
-
}
|
|
30
|
-
export interface OriginalDataTableData {
|
|
31
|
-
id: string;
|
|
32
|
-
checked?: boolean;
|
|
33
|
-
}
|
|
34
|
-
export declare function DataTable<TData>({ columns, data, className, title, rowsPage, actions, actionsRow, customFilters, setSearch, pageChanged, pageSizeChanged, totalRows, filtersActions, exportData, textNoRecords, heightRemainingScroll, hideFilterField, multiRowSelection, hidePagination, disablePagination, isLoading, fixedHeight, }: DataTableProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
35
|
-
//# sourceMappingURL=data-table.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data-table.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/custom/table/data-table.tsx"],"names":[],"mappings":"AAAA,OAAO,EACN,SAAS,EAQT,MAAM,uBAAuB,CAAC;AAU/B,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAE7F,MAAM,WAAW,cAAc,CAAC,KAAK;IACpC,OAAO,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;IAC5B,IAAI,EAAE,KAAK,EAAE,CAAC;IACd,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;IACxB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,aAAa,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACxC,WAAW,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iBAAiB,CAAC,EAAE;QACnB,QAAQ,EAAE,CAAC,YAAY,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;KACxC,CAAC;IACF,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,qBAAqB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,EAChC,OAAO,EACP,IAAI,EACJ,SAAS,EACT,KAAK,EACL,QAAQ,EACR,OAAO,EACP,UAAU,EACV,aAAa,EACb,SAAS,EACT,WAAW,EACX,eAAe,EACf,SAAS,EACT,cAAc,EACd,UAAU,EACV,aAAa,EACb,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,SAAS,EACT,WAAW,GACX,EAAE,cAAc,CAAC,KAAK,CAAC,2CA+MvB"}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable, } from '@tanstack/react-table';
|
|
3
|
-
import { Filter, Search } from 'lucide-react';
|
|
4
|
-
import { useEffect, useRef, useState } from 'react';
|
|
5
|
-
import { cn } from '../../../../lib/utils';
|
|
6
|
-
import { Button } from '../../button';
|
|
7
|
-
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, SheetTrigger } from '../../sheet';
|
|
8
|
-
import { Table, TableBody } from '../../table';
|
|
9
|
-
import { DataTableFooter } from './data-table-footer';
|
|
10
|
-
import { DataTableHeader } from './data-table-header';
|
|
11
|
-
import { DataTableRows } from './data-table-rows';
|
|
12
|
-
export function DataTable({ columns, data, className, title, rowsPage, actions, actionsRow, customFilters, setSearch, pageChanged, pageSizeChanged, totalRows, filtersActions, exportData, textNoRecords, heightRemainingScroll, hideFilterField, multiRowSelection, hidePagination, disablePagination, isLoading, fixedHeight, }) {
|
|
13
|
-
const [sorting, setSorting] = useState([]);
|
|
14
|
-
const [pagination, setPagination] = useState({
|
|
15
|
-
pageIndex: 0,
|
|
16
|
-
pageSize: rowsPage ?? 25,
|
|
17
|
-
});
|
|
18
|
-
const enableMultiRowSelection = multiRowSelection !== undefined;
|
|
19
|
-
const [rowSelection, setRowSelection] = useState(enableMultiRowSelection
|
|
20
|
-
? Object.fromEntries((Array.isArray(data) ? data : []).map((row, idx) => {
|
|
21
|
-
return [idx, row.checked];
|
|
22
|
-
}))
|
|
23
|
-
: {});
|
|
24
|
-
const debounceTimeout = useRef(null);
|
|
25
|
-
const tableContainerRef = useRef(null);
|
|
26
|
-
const [tableHeight, setTableHeight] = useState('auto');
|
|
27
|
-
totalRows = totalRows ?? data.length;
|
|
28
|
-
const table = useReactTable({
|
|
29
|
-
manualPagination: true,
|
|
30
|
-
data: data,
|
|
31
|
-
columns,
|
|
32
|
-
getPaginationRowModel: getPaginationRowModel(),
|
|
33
|
-
onPaginationChange: setPagination,
|
|
34
|
-
getCoreRowModel: getCoreRowModel(),
|
|
35
|
-
onSortingChange: setSorting,
|
|
36
|
-
getSortedRowModel: getSortedRowModel(),
|
|
37
|
-
getFilteredRowModel: getFilteredRowModel(),
|
|
38
|
-
onRowSelectionChange: (rowSelection) => {
|
|
39
|
-
setRowSelection(rowSelection);
|
|
40
|
-
},
|
|
41
|
-
enableMultiRowSelection: enableMultiRowSelection,
|
|
42
|
-
state: { pagination, rowSelection, sorting },
|
|
43
|
-
pageCount: Math.ceil(totalRows / pagination.pageSize),
|
|
44
|
-
});
|
|
45
|
-
const totalPages = table.getPageCount();
|
|
46
|
-
const currentPage = table.getState().pagination.pageIndex;
|
|
47
|
-
const selectedRows = table.getSelectedRowModel().rows;
|
|
48
|
-
const selectedIds = selectedRows.map((row) => row.original.id);
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
if (data.length === 0 && pagination.pageIndex > 0) {
|
|
51
|
-
setPagination({ ...pagination, pageIndex: 0 });
|
|
52
|
-
}
|
|
53
|
-
}, [data]);
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
handleResize();
|
|
56
|
-
window.addEventListener('resize', handleResize);
|
|
57
|
-
return () => {
|
|
58
|
-
window.removeEventListener('resize', handleResize);
|
|
59
|
-
};
|
|
60
|
-
}, []);
|
|
61
|
-
useEffect(() => {
|
|
62
|
-
if (pageChanged)
|
|
63
|
-
pageChanged(pagination.pageIndex + 1);
|
|
64
|
-
}, [pagination]);
|
|
65
|
-
useEffect(() => {
|
|
66
|
-
const selectedRowsChecked = selectedRows.map((row) => row.original);
|
|
67
|
-
if (multiRowSelection && selectedRowsChecked.length > 0) {
|
|
68
|
-
multiRowSelection.callback(selectedRowsChecked);
|
|
69
|
-
}
|
|
70
|
-
}, [rowSelection]);
|
|
71
|
-
const handleResize = () => {
|
|
72
|
-
if (tableContainerRef.current) {
|
|
73
|
-
const newHeight = window.innerHeight - tableContainerRef.current.getBoundingClientRect().top - (hidePagination ? 30 : 74);
|
|
74
|
-
setTableHeight(`${newHeight - (heightRemainingScroll ?? 0)}px`);
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
const handleSearchChange = (event) => {
|
|
78
|
-
const value = event.currentTarget.value;
|
|
79
|
-
if (debounceTimeout.current) {
|
|
80
|
-
clearTimeout(debounceTimeout.current);
|
|
81
|
-
}
|
|
82
|
-
debounceTimeout.current = setTimeout(() => {
|
|
83
|
-
setSearch?.(value);
|
|
84
|
-
handlePage(0);
|
|
85
|
-
}, 300);
|
|
86
|
-
};
|
|
87
|
-
const handlePageSize = (value) => {
|
|
88
|
-
pageSizeChanged?.(value);
|
|
89
|
-
setPagination({ pageIndex: 0, pageSize: value });
|
|
90
|
-
};
|
|
91
|
-
const handlePage = (index) => {
|
|
92
|
-
if (index !== currentPage) {
|
|
93
|
-
setPagination({ ...pagination, pageIndex: index });
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
return (_jsxs("div", { className: 'flex flex-col flex-1', children: [(!hideFilterField || filtersActions || customFilters || actions) && (_jsxs("div", { className: 'flex items-end justify-between mb-4 space-x-6', children: [_jsxs("div", { className: 'flex items-center gap-x-4', children: [!hideFilterField && (_jsxs("div", { className: 'flex bg-background items-center border border-slate-300 rounded-sm w-[350px] overflow-hidden focus-within:outline-none focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 group', children: [_jsx("div", { className: 'pl-3.5 transform transition-transform duration-300 group-hover:-translate-x-1', children: _jsx(Search, { size: 18, className: 'w-5 h-5 stroke-zinc-500 dark:stroke-default' }) }), _jsx("input", { placeholder: 'Buscar', onKeyUp: (event) => {
|
|
97
|
-
handleSearchChange(event);
|
|
98
|
-
}, className: 'w-full bg-background text-default border-none focus:ring-0 focus:outline-none px-3 py-2 transform transition-transform duration-300 group-hover:-translate-x-1 ' })] })), filtersActions && (_jsxs(Sheet, { open: filtersActions.filterOpen, onOpenChange: filtersActions.setFilterOpen, children: [_jsx(SheetTrigger, { asChild: true, children: _jsxs(Button, { variant: 'secondary', type: 'button', children: [_jsx(Filter, { size: 20, className: 'h-4 w-4' }), " Filtros", filtersActions.countFilters > 0 && (_jsx("div", { className: 'bg-background-primary text-white rounded-full h-5 w-5 flex items-center justify-center text-sm placeholder:text-muted-foreground', children: filtersActions.countFilters }))] }) }), _jsxs(SheetContent, { children: [_jsxs(SheetHeader, { children: [_jsx(SheetTitle, { children: "Filtros" }), _jsx(SheetDescription, {})] }), _jsx("div", { className: 'flex flex-col py-6', children: filtersActions.fields })] })] }))] }), customFilters, _jsx("div", { className: 'flex space-x-4 content-end', children: actions?.map((action, index) => (_jsx("div", { children: _jsxs(Button, { onClick: () => action.onClick?.(selectedIds, selectedRows), className: cn(action.className, action.hideUnselectedRows && selectedRows.length === 0 ? 'hidden' : ''), variant: action.variant || 'default', disabled: action.disabled, children: [_jsx("div", { className: '[&_svg]:size-5', children: action.icon }), action.label] }) }, `action-table-${index}`))) })] })), _jsxs("div", { className: `flex-1 flex flex-col rounded-md border ${className}`, children: [_jsx("div", { className: 'flex items-center justify-between', children: title && _jsx("div", { className: 'text-h4 p-4', children: title }) }), _jsx("div", { id: 'data-table', ref: tableContainerRef, style: fixedHeight ? { height: fixedHeight } : { height: tableHeight }, className: 'flex flex-col justify-between rounded-md overflow-x-auto overflow-y-auto', children: _jsxs(Table, { children: [_jsx(DataTableHeader, { table: table, canActionsRow: actionsRow && actionsRow.length > 0, enableMultiRowSelection: enableMultiRowSelection }), _jsx(TableBody, { className: 'bg-background', children: _jsx(DataTableRows, { table: table, columns: columns, isLoading: isLoading, actionsRow: actionsRow, textNoRecords: textNoRecords, enableMultiRowSelection: enableMultiRowSelection }) })] }) })] }), _jsx(DataTableFooter, { hidePagination: hidePagination, disablePagination: disablePagination, isLoading: isLoading, totalRows: totalRows, totalPages: totalPages, currentPage: currentPage, pagination: pagination, handlePageSize: handlePageSize, handlePage: handlePage, previousPage: { action: () => table.previousPage(), disabled: !table.getCanPreviousPage() }, nextPage: { action: () => table.nextPage(), disabled: !table.getCanNextPage() }, exportData: exportData })] }));
|
|
99
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export type ActionTable = {
|
|
2
|
-
label: string;
|
|
3
|
-
icon?: JSX.Element;
|
|
4
|
-
variant?: string;
|
|
5
|
-
onClick?: (ids: any[], rows: any[]) => void;
|
|
6
|
-
className?: string;
|
|
7
|
-
hideUnselectedRows?: boolean;
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
};
|
|
10
|
-
export type ActionRow = {
|
|
11
|
-
label: string;
|
|
12
|
-
icon?: JSX.Element;
|
|
13
|
-
variant?: string;
|
|
14
|
-
onClick?: (row: any) => void;
|
|
15
|
-
className?: (row: any) => string;
|
|
16
|
-
disabled?: (row: any) => boolean;
|
|
17
|
-
};
|
|
18
|
-
export interface ExportDataTable {
|
|
19
|
-
type: 'xlsx' | 'dialog';
|
|
20
|
-
url: string;
|
|
21
|
-
params?: Record<string, string>;
|
|
22
|
-
}
|
|
23
|
-
export interface FiltersActions {
|
|
24
|
-
fields: JSX.Element;
|
|
25
|
-
countFilters: number;
|
|
26
|
-
filterOpen: boolean;
|
|
27
|
-
setFilterOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=data-table.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data-table.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/custom/table/types/data-table.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;IAC7B,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,CAAC;IACjC,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC;CACjC,CAAC;AAEF,MAAM,WAAW,eAAe;IAC/B,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,cAAc;IAC9B,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;CAC7D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
type Theme = 'light' | 'dark' | 'dark-side';
|
|
2
|
-
type ThemePortalDefinitions = {
|
|
3
|
-
faviconPath: string;
|
|
4
|
-
fullLogoPath: string;
|
|
5
|
-
bannerDesktopPath: string;
|
|
6
|
-
mvnoPrimaryColor: string;
|
|
7
|
-
mvnoMainTheme: Theme;
|
|
8
|
-
title: string;
|
|
9
|
-
hideModuleSwitcher: boolean;
|
|
10
|
-
};
|
|
11
|
-
type ThemeProviderProps = {
|
|
12
|
-
children: React.ReactNode;
|
|
13
|
-
defaultTheme?: ThemePortalDefinitions;
|
|
14
|
-
storageKey?: string;
|
|
15
|
-
};
|
|
16
|
-
type ThemeProviderState = {
|
|
17
|
-
portalDefinitions: ThemePortalDefinitions;
|
|
18
|
-
setPortalDefinitions: (portalDefinitions: ThemePortalDefinitions) => void;
|
|
19
|
-
};
|
|
20
|
-
export declare const DEFAULT_THEME_DATA: ThemePortalDefinitions;
|
|
21
|
-
export declare function ThemeProvider({ children, defaultTheme, storageKey, ...props }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
export declare const useTheme: () => ThemeProviderState;
|
|
23
|
-
export {};
|
|
24
|
-
//# sourceMappingURL=theme-provider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"theme-provider.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/custom/theme-provider.tsx"],"names":[],"mappings":"AAGA,KAAK,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,WAAW,CAAC;AAE5C,KAAK,sBAAsB,GAAG;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,KAAK,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACzB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,YAAY,CAAC,EAAE,sBAAsB,CAAC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACzB,iBAAiB,EAAE,sBAAsB,CAAC;IAC1C,oBAAoB,EAAE,CAAC,iBAAiB,EAAE,sBAAsB,KAAK,IAAI,CAAC;CAC1E,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,sBAQhC,CAAC;AASF,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,YAAiC,EAAE,UAA4B,EAAE,GAAG,KAAK,EAAE,EAAE,kBAAkB,2CAqExI;AAED,eAAO,MAAM,QAAQ,0BAMpB,CAAC"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useContext, useEffect, useState } from 'react';
|
|
3
|
-
import { replaceThemeTailwindColors } from '../../../lib/help/theme';
|
|
4
|
-
export const DEFAULT_THEME_DATA = {
|
|
5
|
-
faviconPath: '',
|
|
6
|
-
fullLogoPath: '',
|
|
7
|
-
bannerDesktopPath: '/imgs/background-auth.png',
|
|
8
|
-
mvnoPrimaryColor: 'green',
|
|
9
|
-
mvnoMainTheme: 'light',
|
|
10
|
-
title: '-',
|
|
11
|
-
hideModuleSwitcher: false,
|
|
12
|
-
};
|
|
13
|
-
const initialState = {
|
|
14
|
-
portalDefinitions: DEFAULT_THEME_DATA,
|
|
15
|
-
setPortalDefinitions: () => null,
|
|
16
|
-
};
|
|
17
|
-
const ThemeProviderContext = createContext(initialState);
|
|
18
|
-
export function ThemeProvider({ children, defaultTheme = DEFAULT_THEME_DATA, storageKey = 'vite-ui-theme', ...props }) {
|
|
19
|
-
const [portalDefinitions, setPortalDefinitionsState] = useState({
|
|
20
|
-
faviconPath: localStorage.getItem(`${storageKey}-faviconPath`) || defaultTheme.faviconPath,
|
|
21
|
-
fullLogoPath: localStorage.getItem(`${storageKey}-fullLogoPath`) || defaultTheme.fullLogoPath,
|
|
22
|
-
bannerDesktopPath: localStorage.getItem(`${storageKey}-bannerDesktopPath`) || defaultTheme.bannerDesktopPath,
|
|
23
|
-
mvnoPrimaryColor: localStorage.getItem(`${storageKey}-mvnoPrimaryColor`) || defaultTheme.mvnoPrimaryColor,
|
|
24
|
-
mvnoMainTheme: localStorage.getItem(storageKey) || defaultTheme.mvnoMainTheme,
|
|
25
|
-
title: localStorage.getItem(`${storageKey}-title`) || defaultTheme.title,
|
|
26
|
-
hideModuleSwitcher: localStorage.getItem(`${storageKey}-hideModuleSwitcher`) === 'true',
|
|
27
|
-
});
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
const theme = portalDefinitions?.mvnoMainTheme;
|
|
30
|
-
const root = window.document.documentElement;
|
|
31
|
-
root.classList.remove('light', 'dark', 'dark-side');
|
|
32
|
-
root.classList.add(theme);
|
|
33
|
-
document.title = portalDefinitions?.title;
|
|
34
|
-
const meta = document.querySelector('meta[name="description"]');
|
|
35
|
-
if (meta) {
|
|
36
|
-
meta.setAttribute('content', portalDefinitions?.title);
|
|
37
|
-
}
|
|
38
|
-
let link = document.querySelector("link[rel~='icon']");
|
|
39
|
-
if (!link) {
|
|
40
|
-
link = document.createElement('link');
|
|
41
|
-
link.rel = 'icon';
|
|
42
|
-
document.getElementsByTagName('head')[0].appendChild(link);
|
|
43
|
-
}
|
|
44
|
-
link.href = portalDefinitions?.faviconPath;
|
|
45
|
-
const el = replaceThemeTailwindColors(theme, portalDefinitions?.mvnoPrimaryColor);
|
|
46
|
-
document.getElementById('theme-variables') &&
|
|
47
|
-
document.getElementsByTagName('head')[0].removeChild(document.getElementById('theme-variables'));
|
|
48
|
-
document.getElementsByTagName('head')[0].appendChild(el);
|
|
49
|
-
}, [portalDefinitions]);
|
|
50
|
-
const setPortalDefinitions = (portalDefinitions) => {
|
|
51
|
-
localStorage.setItem(`${storageKey}-faviconPath`, portalDefinitions.faviconPath);
|
|
52
|
-
localStorage.setItem(`${storageKey}-fullLogoPath`, portalDefinitions.fullLogoPath);
|
|
53
|
-
localStorage.setItem(`${storageKey}-bannerDesktopPath`, portalDefinitions.bannerDesktopPath);
|
|
54
|
-
localStorage.setItem(`${storageKey}-mvnoPrimaryColor`, portalDefinitions.mvnoPrimaryColor);
|
|
55
|
-
localStorage.setItem(`${storageKey}-mvnoMainTheme`, portalDefinitions.mvnoMainTheme);
|
|
56
|
-
localStorage.setItem(`${storageKey}-title`, portalDefinitions.title);
|
|
57
|
-
localStorage.setItem(`${storageKey}-hideModuleSwitcher`, String(portalDefinitions.hideModuleSwitcher));
|
|
58
|
-
setPortalDefinitionsState({
|
|
59
|
-
faviconPath: portalDefinitions.faviconPath || DEFAULT_THEME_DATA.faviconPath,
|
|
60
|
-
fullLogoPath: portalDefinitions.fullLogoPath || DEFAULT_THEME_DATA.fullLogoPath,
|
|
61
|
-
bannerDesktopPath: portalDefinitions.bannerDesktopPath || DEFAULT_THEME_DATA.bannerDesktopPath,
|
|
62
|
-
mvnoPrimaryColor: portalDefinitions.mvnoPrimaryColor || DEFAULT_THEME_DATA.mvnoPrimaryColor,
|
|
63
|
-
mvnoMainTheme: portalDefinitions.mvnoMainTheme ? portalDefinitions.mvnoMainTheme : DEFAULT_THEME_DATA.mvnoMainTheme,
|
|
64
|
-
title: portalDefinitions.title || DEFAULT_THEME_DATA.title,
|
|
65
|
-
hideModuleSwitcher: portalDefinitions.hideModuleSwitcher || DEFAULT_THEME_DATA.hideModuleSwitcher,
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
const value = {
|
|
69
|
-
portalDefinitions,
|
|
70
|
-
setPortalDefinitions: setPortalDefinitions,
|
|
71
|
-
};
|
|
72
|
-
return (_jsx(ThemeProviderContext.Provider, { ...props, value: value, children: children }));
|
|
73
|
-
}
|
|
74
|
-
export const useTheme = () => {
|
|
75
|
-
const context = useContext(ThemeProviderContext);
|
|
76
|
-
if (context === undefined)
|
|
77
|
-
throw new Error('useTheme must be used within a ThemeProvider');
|
|
78
|
-
return context;
|
|
79
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dateRangePicker.d.ts","sourceRoot":"","sources":["../../../src/components/ui/dateRangePicker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAY9B,wBAAgB,mBAAmB,CAAC,EAClC,SAAS,GACV,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,2CA8CtC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { addDays, format } from "date-fns";
|
|
3
|
-
import { CalendarIcon } from "lucide-react";
|
|
4
|
-
import * as React from "react";
|
|
5
|
-
import { cn } from "@/lib/utils";
|
|
6
|
-
import { Button } from "./button";
|
|
7
|
-
import { Calendar } from "./calendar";
|
|
8
|
-
import { Popover, PopoverContent, PopoverTrigger, } from "./popover";
|
|
9
|
-
export function DatePickerWithRange({ className, }) {
|
|
10
|
-
const [date, setDate] = React.useState({
|
|
11
|
-
from: new Date(2022, 0, 20),
|
|
12
|
-
to: addDays(new Date(2022, 0, 20), 20),
|
|
13
|
-
});
|
|
14
|
-
return (_jsx("div", { className: cn("grid gap-2", className), children: _jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { id: "date", variant: "outline", className: cn("w-[300px] justify-start text-left font-normal", !date && "text-muted-foreground"), children: [_jsx(CalendarIcon, {}), date?.from ? (date.to ? (_jsxs(_Fragment, { children: [format(date.from, "LLL dd, y"), " -", " ", format(date.to, "LLL dd, y")] })) : (format(date.from, "LLL dd, y"))) : (_jsx("span", { children: "Pick a date" }))] }) }), _jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: _jsx(Calendar, { initialFocus: true, mode: "range", defaultMonth: date?.from, selected: date, onSelect: setDate, numberOfMonths: 2 }) })] }) }));
|
|
15
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
declare const Dialog: React.FC<DialogPrimitive.DialogProps>;
|
|
4
|
-
declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
|
-
declare const DialogPortal: React.FC<DialogPrimitive.DialogPortalProps>;
|
|
6
|
-
declare const DialogClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
7
|
-
declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
-
interface DialogContentProps extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {
|
|
9
|
-
hideClose?: boolean;
|
|
10
|
-
}
|
|
11
|
-
declare const DialogContent: React.ForwardRefExoticComponent<DialogContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
-
declare const DialogHeader: {
|
|
13
|
-
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
displayName: string;
|
|
15
|
-
};
|
|
16
|
-
declare const DialogFooter: {
|
|
17
|
-
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
displayName: string;
|
|
19
|
-
};
|
|
20
|
-
declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
21
|
-
declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
22
|
-
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
|
|
23
|
-
//# sourceMappingURL=dialog.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../src/components/ui/dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAE1D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,QAAA,MAAM,MAAM,uCAAuB,CAAC;AAEpC,QAAA,MAAM,aAAa,8GAA0B,CAAC;AAE9C,QAAA,MAAM,YAAY,6CAAyB,CAAC;AAE5C,QAAA,MAAM,WAAW,4GAAwB,CAAC;AAE1C,QAAA,MAAM,aAAa,8JAYjB,CAAC;AAGH,UAAU,kBAAmB,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC;IAClG,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,aAAa,2FAsBlB,CAAC;AAGF,QAAA,MAAM,YAAY;8BAA6B,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;;CAElF,CAAC;AAGF,QAAA,MAAM,YAAY;8BAA6B,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;;CAElF,CAAC;AAGF,QAAA,MAAM,WAAW,oKAIhB,CAAC;AAGF,QAAA,MAAM,iBAAiB,8KAG6H,CAAC;AAGrJ,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,iBAAiB,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
4
|
-
import { X } from 'lucide-react';
|
|
5
|
-
import * as React from 'react';
|
|
6
|
-
import { cn } from '../../lib/utils';
|
|
7
|
-
const Dialog = DialogPrimitive.Root;
|
|
8
|
-
const DialogTrigger = DialogPrimitive.Trigger;
|
|
9
|
-
const DialogPortal = DialogPrimitive.Portal;
|
|
10
|
-
const DialogClose = DialogPrimitive.Close;
|
|
11
|
-
const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Overlay, { ref: ref, className: cn('fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0', className), ...props })));
|
|
12
|
-
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
13
|
-
const DialogContent = React.forwardRef(({ className, children, hideClose, ...props }, ref) => (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { ref: ref, className: cn('fixed left-[50%] top-[50%] z-50 grid translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg', className), ...props, children: [children, !hideClose && (_jsxs(DialogPrimitive.Close, { className: 'absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground', children: [_jsx(X, { className: 'h-4 w-4' }), _jsx("span", { className: 'sr-only', children: "Close" })] }))] })] })));
|
|
14
|
-
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
15
|
-
const DialogHeader = ({ className, ...props }) => (_jsx("div", { className: cn('flex flex-col space-y-1.5 text-center sm:text-left', className), ...props }));
|
|
16
|
-
DialogHeader.displayName = 'DialogHeader';
|
|
17
|
-
const DialogFooter = ({ className, ...props }) => (_jsx("div", { className: cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className), ...props }));
|
|
18
|
-
DialogFooter.displayName = 'DialogFooter';
|
|
19
|
-
const DialogTitle = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Title, { ref: ref, className: cn('text-lg font-semibold leading-none tracking-tight', className), ...props })));
|
|
20
|
-
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
21
|
-
const DialogDescription = React.forwardRef(({ className, ...props }, ref) => _jsx(DialogPrimitive.Description, { ref: ref, className: cn('text-sm text-muted-foreground', className), ...props }));
|
|
22
|
-
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
23
|
-
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
|