eai-frontend-components 2.0.79 → 2.0.81
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/dist/index.d.ts +12 -11
- package/dist/index.esm.js +27 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +26 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -80,7 +80,7 @@ declare const AvatarImage: React$1.ForwardRefExoticComponent<Omit<AvatarPrimitiv
|
|
|
80
80
|
declare const AvatarFallback: React$1.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarFallbackProps & React$1.RefAttributes<HTMLSpanElement>, "ref"> & React$1.RefAttributes<HTMLSpanElement>>;
|
|
81
81
|
|
|
82
82
|
declare const badgeVariants: (props?: ({
|
|
83
|
-
variant?: "default" | "
|
|
83
|
+
variant?: "default" | "secondary" | "surface" | "destructive" | "outline" | "green" | "red" | "gray" | "blue" | "orange" | "yellow" | null | undefined;
|
|
84
84
|
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
85
85
|
interface BadgeProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
86
86
|
}
|
|
@@ -105,7 +105,7 @@ declare const BreadcrumbEllipsis: {
|
|
|
105
105
|
};
|
|
106
106
|
|
|
107
107
|
declare const buttonVariants: (props?: ({
|
|
108
|
-
variant?: "link" | "default" | "
|
|
108
|
+
variant?: "link" | "default" | "secondary" | "destructive" | "outline" | "primary" | "ghost" | null | undefined;
|
|
109
109
|
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
110
110
|
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
111
111
|
interface ButtonProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
@@ -208,7 +208,7 @@ declare const Command: React$1.ForwardRefExoticComponent<Omit<{
|
|
|
208
208
|
ref?: React$1.Ref<HTMLDivElement>;
|
|
209
209
|
} & {
|
|
210
210
|
asChild?: boolean;
|
|
211
|
-
}, "key" |
|
|
211
|
+
}, "key" | keyof React$1.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
|
212
212
|
label?: string;
|
|
213
213
|
shouldFilter?: boolean;
|
|
214
214
|
filter?: (value: string, search: string, keywords?: string[]) => number;
|
|
@@ -224,7 +224,7 @@ declare const CommandInput: React$1.ForwardRefExoticComponent<Omit<Omit<Pick<Pic
|
|
|
224
224
|
ref?: React$1.Ref<HTMLInputElement>;
|
|
225
225
|
} & {
|
|
226
226
|
asChild?: boolean;
|
|
227
|
-
}, "key" | "asChild" | keyof React$1.InputHTMLAttributes<HTMLInputElement>>, "onChange" | "
|
|
227
|
+
}, "key" | "asChild" | keyof React$1.InputHTMLAttributes<HTMLInputElement>>, "onChange" | "value" | "type"> & {
|
|
228
228
|
value?: string;
|
|
229
229
|
onValueChange?: (search: string) => void;
|
|
230
230
|
} & React$1.RefAttributes<HTMLInputElement>, "ref"> & React$1.RefAttributes<HTMLInputElement>>;
|
|
@@ -234,7 +234,7 @@ declare const CommandList: React$1.ForwardRefExoticComponent<Omit<{
|
|
|
234
234
|
ref?: React$1.Ref<HTMLDivElement>;
|
|
235
235
|
} & {
|
|
236
236
|
asChild?: boolean;
|
|
237
|
-
}, "key" |
|
|
237
|
+
}, "key" | keyof React$1.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
|
238
238
|
label?: string;
|
|
239
239
|
} & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
240
240
|
declare const CommandEmpty: React$1.ForwardRefExoticComponent<Omit<{
|
|
@@ -243,14 +243,14 @@ declare const CommandEmpty: React$1.ForwardRefExoticComponent<Omit<{
|
|
|
243
243
|
ref?: React$1.Ref<HTMLDivElement>;
|
|
244
244
|
} & {
|
|
245
245
|
asChild?: boolean;
|
|
246
|
-
}, "key" |
|
|
246
|
+
}, "key" | keyof React$1.HTMLAttributes<HTMLDivElement> | "asChild"> & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
247
247
|
declare const CommandGroup: React$1.ForwardRefExoticComponent<Omit<{
|
|
248
248
|
children?: React$1.ReactNode;
|
|
249
249
|
} & Omit<Pick<Pick<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React$1.HTMLAttributes<HTMLDivElement>> & {
|
|
250
250
|
ref?: React$1.Ref<HTMLDivElement>;
|
|
251
251
|
} & {
|
|
252
252
|
asChild?: boolean;
|
|
253
|
-
}, "key" |
|
|
253
|
+
}, "key" | keyof React$1.HTMLAttributes<HTMLDivElement> | "asChild">, "value" | "heading"> & {
|
|
254
254
|
heading?: React$1.ReactNode;
|
|
255
255
|
value?: string;
|
|
256
256
|
forceMount?: boolean;
|
|
@@ -259,7 +259,7 @@ declare const CommandSeparator: React$1.ForwardRefExoticComponent<Omit<Pick<Pick
|
|
|
259
259
|
ref?: React$1.Ref<HTMLDivElement>;
|
|
260
260
|
} & {
|
|
261
261
|
asChild?: boolean;
|
|
262
|
-
}, "key" |
|
|
262
|
+
}, "key" | keyof React$1.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
|
263
263
|
alwaysRender?: boolean;
|
|
264
264
|
} & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
265
265
|
declare const CommandItem: React$1.ForwardRefExoticComponent<Omit<{
|
|
@@ -268,7 +268,7 @@ declare const CommandItem: React$1.ForwardRefExoticComponent<Omit<{
|
|
|
268
268
|
ref?: React$1.Ref<HTMLDivElement>;
|
|
269
269
|
} & {
|
|
270
270
|
asChild?: boolean;
|
|
271
|
-
}, "key" |
|
|
271
|
+
}, "key" | keyof React$1.HTMLAttributes<HTMLDivElement> | "asChild">, "onSelect" | "disabled" | "value"> & {
|
|
272
272
|
disabled?: boolean;
|
|
273
273
|
onSelect?: (value: string) => void;
|
|
274
274
|
value?: string;
|
|
@@ -883,7 +883,7 @@ interface Props$8 {
|
|
|
883
883
|
declare const FormInputMask: React.FC<Props$8>;
|
|
884
884
|
|
|
885
885
|
declare const multiSelectVariants: (props?: ({
|
|
886
|
-
variant?: "default" | "
|
|
886
|
+
variant?: "default" | "secondary" | "destructive" | "inverted" | null | undefined;
|
|
887
887
|
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
888
888
|
interface MultiSelectOption {
|
|
889
889
|
value: string;
|
|
@@ -1234,6 +1234,7 @@ interface DataTableProps<TData> {
|
|
|
1234
1234
|
textNoRecords?: string;
|
|
1235
1235
|
heightRemainingScroll?: number;
|
|
1236
1236
|
hideFilterField?: boolean;
|
|
1237
|
+
defaultSearch?: string;
|
|
1237
1238
|
multiRowSelection?: {
|
|
1238
1239
|
callback: (selectedRows: any[]) => void;
|
|
1239
1240
|
};
|
|
@@ -1246,7 +1247,7 @@ interface OriginalDataTableData {
|
|
|
1246
1247
|
id: string;
|
|
1247
1248
|
checked?: boolean;
|
|
1248
1249
|
}
|
|
1249
|
-
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>): react_jsx_runtime.JSX.Element;
|
|
1250
|
+
declare function DataTable<TData>({ columns, data, className, title, rowsPage, actions, actionsRow, customFilters, setSearch, pageChanged, pageSizeChanged, totalRows, filtersActions, exportData, textNoRecords, heightRemainingScroll, hideFilterField, defaultSearch, multiRowSelection, hidePagination, disablePagination, isLoading, fixedHeight, }: DataTableProps<TData>): react_jsx_runtime.JSX.Element;
|
|
1250
1251
|
|
|
1251
1252
|
interface DataTableExportProps {
|
|
1252
1253
|
exportData?: ExportDataTable;
|
package/dist/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
3
3
|
import { ChevronDown, MoreHorizontal, ChevronRight, ChevronLeftIcon, ChevronRightIcon, ChevronDownIcon, ArrowLeft, ArrowRight, Check, X, Search, Circle, CalendarIcon, ChevronLeft, ChevronUp, PanelLeft, CircleX, CalendarDays, CircleHelp, Paintbrush, ChevronsUpDown, LoaderCircle, CheckIcon, EyeOff, Eye, Copy, BarChart2, LogOut, MoveUp, MoveDown, ArrowUpDown, Filter } from 'lucide-react';
|
|
4
4
|
import * as React$1 from 'react';
|
|
5
|
-
import React__default, { useState, useEffect, createContext, useContext, useRef, forwardRef, useImperativeHandle } from 'react';
|
|
5
|
+
import React__default, { useState, useEffect, createContext, useContext, useRef, useLayoutEffect, forwardRef, useImperativeHandle } from 'react';
|
|
6
6
|
import clsx$1, { clsx } from 'clsx';
|
|
7
7
|
import { twMerge } from 'tailwind-merge';
|
|
8
8
|
import { cva } from 'class-variance-authority';
|
|
@@ -10104,6 +10104,24 @@ const Header = ({ splittedPath, modules, pages, isLoading, combobox, }) => {
|
|
|
10104
10104
|
return (jsxs("header", { className: 'flex flex-col justify-between items-center w-full', children: [jsxs("div", { className: 'flex justify-between items-center py-3 px-5 w-full', children: [jsxs("div", { className: 'flex items-center gap-x-2 h-[40px]', children: [jsx(SidebarTrigger, { className: 'p-5' }), jsx("div", { className: 'p-2', children: jsx(Breadcrumb, { children: jsx(BreadcrumbList, { children: renderBreadcrumbItens() }) }) })] }), jsx("div", { className: 'flex items-center', children: combobox })] }), jsx(LoadingBar, { ref: refProgressLoading, color: getColorLoadingBar(), height: 7 })] }));
|
|
10105
10105
|
};
|
|
10106
10106
|
|
|
10107
|
+
const TruncatedText = ({ text }) => {
|
|
10108
|
+
const ref = useRef(null);
|
|
10109
|
+
const [isTruncated, setIsTruncated] = useState(false);
|
|
10110
|
+
useLayoutEffect(() => {
|
|
10111
|
+
const el = ref.current;
|
|
10112
|
+
if (!el)
|
|
10113
|
+
return;
|
|
10114
|
+
const check = () => setIsTruncated(el.scrollWidth > el.clientWidth);
|
|
10115
|
+
check();
|
|
10116
|
+
const observer = new ResizeObserver(check);
|
|
10117
|
+
observer.observe(el);
|
|
10118
|
+
return () => observer.disconnect();
|
|
10119
|
+
}, [text]);
|
|
10120
|
+
const inner = (jsx("div", { ref: ref, className: 'text-zinc-500 truncate', children: text }));
|
|
10121
|
+
if (!isTruncated)
|
|
10122
|
+
return inner;
|
|
10123
|
+
return (jsx(TooltipProvider, { children: jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: inner }), jsx(TooltipContent, { children: text })] }) }));
|
|
10124
|
+
};
|
|
10107
10125
|
const LabelWithTitle = ({ title, value, value2, required, showCopyIcon = false, className, isLoading, hoverAction, }) => {
|
|
10108
10126
|
const handleCopy = () => {
|
|
10109
10127
|
if (showCopyIcon && value) {
|
|
@@ -10114,7 +10132,7 @@ const LabelWithTitle = ({ title, value, value2, required, showCopyIcon = false,
|
|
|
10114
10132
|
});
|
|
10115
10133
|
}
|
|
10116
10134
|
};
|
|
10117
|
-
return (jsx("div", { className: cn('flex group', className), children: jsx("div", { className: cn('flex flex-col text-sm w-full', showCopyIcon || hoverAction ? 'p-1 rounded-md transition-colors group-hover:bg-sidebar-accent' : 'p-1'), children: jsxs("div", { className: 'relative', children: [jsxs("div", { className: 'flex items-center text-sm font-medium gap-0.5', children: [jsx("span", { className: 'text-default truncate', children: title }), required && jsx("div", { className: 'text-red-500 truncate', children: "*" })] }), jsx("div", { className: 'grid flex-1 items-center pt-1', children: isLoading ? jsx(Skeleton, { className: 'h-5 w-full rounded-lg' }) : jsx(
|
|
10135
|
+
return (jsx("div", { className: cn('flex group', className), children: jsx("div", { className: cn('flex flex-col text-sm w-full', showCopyIcon || hoverAction ? 'p-1 rounded-md transition-colors group-hover:bg-sidebar-accent' : 'p-1'), children: jsxs("div", { className: 'relative', children: [jsxs("div", { className: 'flex items-center text-sm font-medium gap-0.5', children: [jsx("span", { className: 'text-default truncate', children: title }), required && jsx("div", { className: 'text-red-500 truncate', children: "*" })] }), jsx("div", { className: 'grid flex-1 items-center pt-1', children: isLoading ? jsx(Skeleton, { className: 'h-5 w-full rounded-lg' }) : jsx(TruncatedText, { text: value }) }), value2 && (jsx("div", { className: 'grid flex-1 items-center pt-1', children: isLoading ? jsx(Skeleton, { className: 'h-5 w-full rounded-lg' }) : jsx(TruncatedText, { text: value2 }) })), showCopyIcon && (jsx("div", { className: cn('absolute top-1/2 right-0 -translate-y-1/2 opacity-0 transition-opacity group-hover:opacity-100'), children: jsx(TooltipProvider, { children: jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx(Button, { variant: 'ghost', type: 'button', className: cn('p-1 h-10 w-8 bg-sidebar-accent'), onClick: handleCopy, children: jsx(Copy, { size: 16 }) }) }), jsx(TooltipContent, { children: "Copiar" })] }) }) })), hoverAction && (jsx("div", { className: cn('absolute top-1/2 right-0 -translate-y-1/2 opacity-0 transition-opacity group-hover:opacity-100'), children: jsx(TooltipProvider, { children: jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx(Button, { variant: 'ghost', type: 'button', className: cn('p-1 h-10 w-8 bg-sidebar-accent'), onClick: hoverAction.onClick, children: hoverAction.icon }) }), jsx(TooltipContent, { children: hoverAction.tooltip })] }) }) }))] }) }) }));
|
|
10118
10136
|
};
|
|
10119
10137
|
|
|
10120
10138
|
const NotFound = () => {
|
|
@@ -10487,7 +10505,7 @@ function DataTableRows({ table, isLoading, columns, actionsRow, textNoRecords, e
|
|
|
10487
10505
|
return isLoading ? renderLoadingRows() : rows.length ? renderRows() : renderEmptyRows();
|
|
10488
10506
|
}
|
|
10489
10507
|
|
|
10490
|
-
function DataTable({ columns, data, className, title, rowsPage, actions, actionsRow, customFilters, setSearch, pageChanged, pageSizeChanged, totalRows, filtersActions, exportData, textNoRecords, heightRemainingScroll, hideFilterField, multiRowSelection, hidePagination, disablePagination, isLoading, fixedHeight, }) {
|
|
10508
|
+
function DataTable({ columns, data, className, title, rowsPage, actions, actionsRow, customFilters, setSearch, pageChanged, pageSizeChanged, totalRows, filtersActions, exportData, textNoRecords, heightRemainingScroll, hideFilterField, defaultSearch, multiRowSelection, hidePagination, disablePagination, isLoading, fixedHeight, }) {
|
|
10491
10509
|
const [sorting, setSorting] = useState([]);
|
|
10492
10510
|
const [pagination, setPagination] = useState({
|
|
10493
10511
|
pageIndex: 0,
|
|
@@ -10529,6 +10547,11 @@ function DataTable({ columns, data, className, title, rowsPage, actions, actions
|
|
|
10529
10547
|
setPagination({ ...pagination, pageIndex: 0 });
|
|
10530
10548
|
}
|
|
10531
10549
|
}, [data]);
|
|
10550
|
+
useEffect(() => {
|
|
10551
|
+
if (defaultSearch) {
|
|
10552
|
+
setSearch?.(defaultSearch);
|
|
10553
|
+
}
|
|
10554
|
+
}, []);
|
|
10532
10555
|
useEffect(() => {
|
|
10533
10556
|
handleResize();
|
|
10534
10557
|
window.addEventListener('resize', handleResize);
|
|
@@ -10571,7 +10594,7 @@ function DataTable({ columns, data, className, title, rowsPage, actions, actions
|
|
|
10571
10594
|
setPagination({ ...pagination, pageIndex: index });
|
|
10572
10595
|
}
|
|
10573
10596
|
};
|
|
10574
|
-
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 || customFilters) && (jsxs("div", { className: 'flex 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', onChange: (event) => {
|
|
10597
|
+
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 || customFilters) && (jsxs("div", { className: 'flex 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', defaultValue: defaultSearch, onChange: (event) => {
|
|
10575
10598
|
handleSearchChange(event);
|
|
10576
10599
|
}, 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 ' })] })), customFilters] })), 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 })] })] }))] }), jsx("div", { className: 'flex space-x-4 content-end', children: actions?.map((action, index) => (jsx("div", { children: jsxs(Button, { type: '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 })] }));
|
|
10577
10600
|
}
|