eai-frontend-components 2.0.18 → 2.0.19
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 +4 -4
- package/dist/index.esm.js +35 -56
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +35 -56
- 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" | "destructive" | "secondary" | "surface" | "outline" | "green" | "red" | "gray" | "blue" | "orange" | 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" | "destructive" | "secondary" | "outline" | "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> {
|
|
@@ -808,7 +808,7 @@ interface Props$8 {
|
|
|
808
808
|
declare const FormInputMask: React.FC<Props$8>;
|
|
809
809
|
|
|
810
810
|
declare const multiSelectVariants: (props?: ({
|
|
811
|
-
variant?: "default" | "
|
|
811
|
+
variant?: "default" | "destructive" | "secondary" | "inverted" | null | undefined;
|
|
812
812
|
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
813
813
|
interface MultiSelectOption {
|
|
814
814
|
value: string;
|
|
@@ -1536,4 +1536,4 @@ declare const addDaysToToday: (days: number) => Date;
|
|
|
1536
1536
|
declare function isUUIDv4(str: string): boolean;
|
|
1537
1537
|
|
|
1538
1538
|
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, ChartContainer, ChartLegend, ChartLegendContent, ChartTooltip, ChartTooltipContent, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DEFAULT_THEME_DATA, DataTable, DataTableExport, DataTableFooter, DataTableHeader, DataTableRows, DatePickerWithRange as DateRangePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Form, FormCombobox, FormControl, FormDataRange, FormDescription, FormField, FormInput, FormInputCheckbox, FormInputColor, FormInputCpfCnpj, FormInputCurrency, FormInputDate, FormInputDecimal, FormInputFile, FormInputGhost, FormInputMask, FormInputPassWord, FormInputPercent, FormInputPhone, FormInputSwitch, FormInputText, FormItem, FormLabel, FormMessage, FormRadioGroup, FormSelect, FormTextarea, Header, HoverCard, HoverCardContent, HoverCardTrigger, Input, Label, LabelWithTitle, ModuleSwitcher, MultiSelect, NavFooter, NavMain, NavSubmenuCollapsible, NavSubmenuDropdown, NavUser, NotFound, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarButton, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarItem, SidebarItemTwoLines, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarSubmenuType, SidebarTrigger, Skeleton, Slider, StepNewForm, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeProvider, Toast$1 as Toast, ToastAction, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UseCalendar, aYearAgo, addDaysToToday, badgeVariants, buttonVariants, cn, convertBytesToMB, convertDaysToMonth, convertGbToMb, convertMbToGb, convertMonthToDays, convertSecondsToMinutes, formHelpText, formLabel, formLabelAndSubLabel, formMessage, formatCpfCnpj, formatDate, formatDateCalendar, formatDateTime, formatDecimal, formatNumber, formatPhone, getFirstDayOf90DaysAgo, getFirstDayOfCurrentMonth, getTailwindColorShades, invertDate, isUUIDv4, modifyCpfCnpj, modifyPhone, replaceThemeTailwindColors, roundNumber, stringDateToDate, stringToDate, stringToNumber, toast, useFormField, useSidebar, useTheme, useToast };
|
|
1539
|
-
export type { ActionRow, ActionTable, ButtonProps, CalendarProps, CarouselApi, ComboboxOption, DataTableProps, ExportDataTable, FiltersActions, Module, MultiSelectOption, OriginalDataTableData, PropsStepNewForm, RadioOption, SelectOption, SidebarPage, TailwindColorName };
|
|
1539
|
+
export type { ActionRow, ActionTable, ButtonProps, CalendarProps, CarouselApi, ChartConfig, ComboboxOption, DataTableProps, ExportDataTable, FiltersActions, Module, MultiSelectOption, OriginalDataTableData, PropsStepNewForm, RadioOption, SelectOption, SidebarPage, TailwindColorName };
|
package/dist/index.esm.js
CHANGED
|
@@ -342,22 +342,21 @@ const CarouselNext = React.forwardRef(({ className, variant = "outline", size =
|
|
|
342
342
|
});
|
|
343
343
|
CarouselNext.displayName = "CarouselNext";
|
|
344
344
|
|
|
345
|
-
|
|
346
|
-
const THEMES = { light: "", dark: ".dark" };
|
|
345
|
+
const THEMES = { light: '', dark: '.dark' };
|
|
347
346
|
const ChartContext = React.createContext(null);
|
|
348
347
|
function useChart() {
|
|
349
348
|
const context = React.useContext(ChartContext);
|
|
350
349
|
if (!context) {
|
|
351
|
-
throw new Error(
|
|
350
|
+
throw new Error('useChart must be used within a <ChartContainer />');
|
|
352
351
|
}
|
|
353
352
|
return context;
|
|
354
353
|
}
|
|
355
354
|
const ChartContainer = React.forwardRef(({ id, className, children, config, ...props }, ref) => {
|
|
356
355
|
const uniqueId = React.useId();
|
|
357
|
-
const chartId = `chart-${id || uniqueId.replace(/:/g,
|
|
356
|
+
const chartId = `chart-${id || uniqueId.replace(/:/g, '')}`;
|
|
358
357
|
return (jsx(ChartContext.Provider, { value: { config }, children: jsxs("div", { "data-chart": chartId, ref: ref, className: cn("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none", className), ...props, children: [jsx(ChartStyle, { id: chartId, config: config }), jsx(RechartsPrimitive.ResponsiveContainer, { children: children })] }) }));
|
|
359
358
|
});
|
|
360
|
-
ChartContainer.displayName =
|
|
359
|
+
ChartContainer.displayName = 'Chart';
|
|
361
360
|
const ChartStyle = ({ id, config }) => {
|
|
362
361
|
const colorConfig = Object.entries(config).filter(([, config]) => config.theme || config.color);
|
|
363
362
|
if (!colorConfig.length) {
|
|
@@ -371,103 +370,83 @@ const ChartStyle = ({ id, config }) => {
|
|
|
371
370
|
${prefix} [data-chart=${id}] {
|
|
372
371
|
${colorConfig
|
|
373
372
|
.map(([key, itemConfig]) => {
|
|
374
|
-
const color = itemConfig.theme?.[theme] ||
|
|
375
|
-
itemConfig.color;
|
|
373
|
+
const color = itemConfig.theme?.[theme] || itemConfig.color;
|
|
376
374
|
return color ? ` --color-${key}: ${color};` : null;
|
|
377
375
|
})
|
|
378
|
-
.join(
|
|
376
|
+
.join('\n')}
|
|
379
377
|
}
|
|
380
378
|
`)
|
|
381
|
-
.join(
|
|
379
|
+
.join('\n'),
|
|
382
380
|
} }));
|
|
383
381
|
};
|
|
384
382
|
const ChartTooltip = RechartsPrimitive.Tooltip;
|
|
385
|
-
const ChartTooltipContent = React.forwardRef(({ active, payload, className, indicator =
|
|
383
|
+
const ChartTooltipContent = React.forwardRef(({ active, payload, className, indicator = 'dot', hideLabel = false, hideIndicator = false, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey, }, ref) => {
|
|
386
384
|
const { config } = useChart();
|
|
387
385
|
const tooltipLabel = React.useMemo(() => {
|
|
388
386
|
if (hideLabel || !payload?.length) {
|
|
389
387
|
return null;
|
|
390
388
|
}
|
|
391
389
|
const [item] = payload;
|
|
392
|
-
const key = `${labelKey || item.dataKey || item.name ||
|
|
390
|
+
const key = `${labelKey || item.dataKey || item.name || 'value'}`;
|
|
393
391
|
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
394
|
-
const value = !labelKey && typeof label ===
|
|
395
|
-
? config[label]?.label || label
|
|
396
|
-
: itemConfig?.label;
|
|
392
|
+
const value = !labelKey && typeof label === 'string' ? config[label]?.label || label : itemConfig?.label;
|
|
397
393
|
if (labelFormatter) {
|
|
398
|
-
return
|
|
394
|
+
return jsx("div", { className: cn('font-medium', labelClassName), children: labelFormatter(value, payload) });
|
|
399
395
|
}
|
|
400
396
|
if (!value) {
|
|
401
397
|
return null;
|
|
402
398
|
}
|
|
403
|
-
return jsx("div", { className: cn(
|
|
404
|
-
}, [
|
|
405
|
-
label,
|
|
406
|
-
labelFormatter,
|
|
407
|
-
payload,
|
|
408
|
-
hideLabel,
|
|
409
|
-
labelClassName,
|
|
410
|
-
config,
|
|
411
|
-
labelKey,
|
|
412
|
-
]);
|
|
399
|
+
return jsx("div", { className: cn('font-medium', labelClassName), children: value });
|
|
400
|
+
}, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
|
|
413
401
|
if (!active || !payload?.length) {
|
|
414
402
|
return null;
|
|
415
403
|
}
|
|
416
|
-
const nestLabel = payload.length === 1 && indicator !==
|
|
417
|
-
return (jsxs("div", { ref: ref, className: cn(
|
|
418
|
-
const key = `${nameKey || item.name || item.dataKey ||
|
|
404
|
+
const nestLabel = payload.length === 1 && indicator !== 'dot';
|
|
405
|
+
return (jsxs("div", { ref: ref, className: cn('grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl', className), children: [!nestLabel ? tooltipLabel : null, jsx("div", { className: 'grid gap-1.5', children: payload.map((item, index) => {
|
|
406
|
+
const key = `${nameKey || item.name || item.dataKey || 'value'}`;
|
|
419
407
|
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
420
408
|
const indicatorColor = color || item.payload.fill || item.color;
|
|
421
|
-
return (jsx("div", { className: cn(
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
409
|
+
return (jsx("div", { className: cn('flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground', indicator === 'dot' && 'items-center'), children: formatter && item?.value !== undefined && item.name ? (formatter(item.value, item.name, item, index, item.payload)) : (jsxs(Fragment, { children: [itemConfig?.icon ? (jsx(itemConfig.icon, {})) : (!hideIndicator && (jsx("div", { className: cn('shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]', {
|
|
410
|
+
'h-2.5 w-2.5': indicator === 'dot',
|
|
411
|
+
'w-1': indicator === 'line',
|
|
412
|
+
'w-0 border-[1.5px] border-dashed bg-transparent': indicator === 'dashed',
|
|
413
|
+
'my-0.5': nestLabel && indicator === 'dashed',
|
|
426
414
|
}), style: {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
} }))), jsxs("div", { className: cn(
|
|
415
|
+
'--color-bg': indicatorColor,
|
|
416
|
+
'--color-border': indicatorColor,
|
|
417
|
+
} }))), jsxs("div", { className: cn('flex flex-1 justify-between leading-none', nestLabel ? 'items-end' : 'items-center'), children: [jsxs("div", { className: 'grid gap-1.5', children: [nestLabel ? tooltipLabel : null, jsx("span", { className: 'text-muted-foreground', children: itemConfig?.label || item.name })] }), item.value && (jsx("span", { className: 'font-mono font-medium tabular-nums text-foreground', children: item.value.toLocaleString() }))] })] })) }, item.dataKey));
|
|
430
418
|
}) })] }));
|
|
431
419
|
});
|
|
432
|
-
ChartTooltipContent.displayName =
|
|
420
|
+
ChartTooltipContent.displayName = 'ChartTooltip';
|
|
433
421
|
const ChartLegend = RechartsPrimitive.Legend;
|
|
434
|
-
const ChartLegendContent = React.forwardRef(({ className, hideIcon = false, payload, verticalAlign =
|
|
422
|
+
const ChartLegendContent = React.forwardRef(({ className, hideIcon = false, payload, verticalAlign = 'bottom', nameKey }, ref) => {
|
|
435
423
|
const { config } = useChart();
|
|
436
424
|
if (!payload?.length) {
|
|
437
425
|
return null;
|
|
438
426
|
}
|
|
439
|
-
return (jsx("div", { ref: ref, className: cn(
|
|
440
|
-
const key = `${nameKey || item.dataKey ||
|
|
427
|
+
return (jsx("div", { ref: ref, className: cn('flex items-center justify-center gap-4', verticalAlign === 'top' ? 'pb-3' : 'pt-3', className), children: payload.map((item) => {
|
|
428
|
+
const key = `${nameKey || item.dataKey || 'value'}`;
|
|
441
429
|
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
442
|
-
return (jsxs("div", { className: cn(
|
|
430
|
+
return (jsxs("div", { className: cn('flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground'), children: [itemConfig?.icon && !hideIcon ? (jsx(itemConfig.icon, {})) : (jsx("div", { className: 'h-2 w-2 shrink-0 rounded-[2px]', style: {
|
|
443
431
|
backgroundColor: item.color,
|
|
444
432
|
} })), itemConfig?.label] }, item.value));
|
|
445
433
|
}) }));
|
|
446
434
|
});
|
|
447
|
-
ChartLegendContent.displayName =
|
|
435
|
+
ChartLegendContent.displayName = 'ChartLegend';
|
|
448
436
|
// Helper to extract item config from a payload.
|
|
449
437
|
function getPayloadConfigFromPayload(config, payload, key) {
|
|
450
|
-
if (typeof payload !==
|
|
438
|
+
if (typeof payload !== 'object' || payload === null) {
|
|
451
439
|
return undefined;
|
|
452
440
|
}
|
|
453
|
-
const payloadPayload =
|
|
454
|
-
typeof payload.payload === "object" &&
|
|
455
|
-
payload.payload !== null
|
|
456
|
-
? payload.payload
|
|
457
|
-
: undefined;
|
|
441
|
+
const payloadPayload = 'payload' in payload && typeof payload.payload === 'object' && payload.payload !== null ? payload.payload : undefined;
|
|
458
442
|
let configLabelKey = key;
|
|
459
|
-
if (key in payload &&
|
|
460
|
-
typeof payload[key] === "string") {
|
|
443
|
+
if (key in payload && typeof payload[key] === 'string') {
|
|
461
444
|
configLabelKey = payload[key];
|
|
462
445
|
}
|
|
463
|
-
else if (payloadPayload &&
|
|
464
|
-
key in payloadPayload &&
|
|
465
|
-
typeof payloadPayload[key] === "string") {
|
|
446
|
+
else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === 'string') {
|
|
466
447
|
configLabelKey = payloadPayload[key];
|
|
467
448
|
}
|
|
468
|
-
return configLabelKey in config
|
|
469
|
-
? config[configLabelKey]
|
|
470
|
-
: config[key];
|
|
449
|
+
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
471
450
|
}
|
|
472
451
|
|
|
473
452
|
const Checkbox = React.forwardRef(({ className, value, ...props }, ref) => (jsx(CheckboxPrimitive.Root, { ref: ref, checked: !!value, className: cn('peer h-4 w-4 shrink-0 rounded-sm border ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-background-primary data-[state=checked]:text-primary-foreground', className), ...props, children: jsx(CheckboxPrimitive.Indicator, { className: cn('flex items-center justify-center text-current'), children: jsx(Check, { className: 'h-4 w-4' }) }) })));
|