eai-frontend-components 2.0.66 → 2.0.67

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.js CHANGED
@@ -9556,7 +9556,7 @@ const MultiSelect = React__namespace.forwardRef(({ control, name, label, subLabe
9556
9556
  }
9557
9557
  };
9558
9558
  return (jsxRuntime.jsx(FormField, { control: control, name: name, render: ({ field }) => (jsxRuntime.jsxs(FormItem, { children: [jsxRuntime.jsxs("div", { className: 'flex items-center space-x-1.5', children: [label && formLabelAndSubLabel(FormLabel, label, subLabel, required), helpText && formHelpText(helpText)] }), jsxRuntime.jsxs(Popover, { open: isPopoverOpen, onOpenChange: setIsPopoverOpen, modal: modalPopover, children: [jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: jsxRuntime.jsx(Button, { ref: ref, ...props, onClick: handleTogglePopover, type: 'button', className: cn('flex w-full p-1 rounded-md border min-h-10 h-auto items-center justify-between bg-background hover:bg-background [&_svg]:size-3.5', className), children: field.value?.length > 0 ? (jsxRuntime.jsxs("div", { className: 'flex justify-between items-center w-full', children: [jsxRuntime.jsxs("div", { className: 'flex items-center', children: [jsxRuntime.jsx("div", { className: `grid grid-cols-${maxCount}`, children: field.value.slice(0, maxCount).map((option) => {
9559
- return (jsxRuntime.jsxs(Badge, { className: cn(multiSelectVariants({ variant })), onClick: (event) => {
9559
+ return (jsxRuntime.jsxs(Badge, { className: cn('justify-between', multiSelectVariants({ variant })), onClick: (event) => {
9560
9560
  event.stopPropagation();
9561
9561
  toggleOption(option, field);
9562
9562
  }, children: [jsxRuntime.jsx("div", { className: 'truncate', children: option?.label }), jsxRuntime.jsx(lucideReact.X, { className: 'ml-2 cursor-pointer text-zinc-500' })] }, `msoptlbl-${option.value}`));
@@ -10367,12 +10367,15 @@ const NavUser = ({ userName, userEmail, userInitials, callbackLogout }) => {
10367
10367
  } }) }) }), jsxRuntime.jsxs(DropdownMenuContent, { className: 'w-[250px] rounded-lg', side: isMobile ? 'bottom' : 'right', align: 'end', sideOffset: 4, children: [jsxRuntime.jsx(DropdownMenuLabel, { className: 'p-0 font-normal', children: jsxRuntime.jsxs("div", { className: 'flex items-center gap-2 px-1 py-1.5 text-left text-sm', children: [jsxRuntime.jsxs(Avatar, { className: 'h-8 w-8 rounded-lg', children: [jsxRuntime.jsx(AvatarImage, { src: userInitials, alt: userName }), jsxRuntime.jsx(AvatarFallback, { className: 'rounded-lg bg-background-primary text-white', children: userInitials })] }), jsxRuntime.jsxs("div", { className: 'grid flex-1 text-left text-sm leading-tight', children: [jsxRuntime.jsx("span", { className: 'truncate font-semibold', children: userName }), jsxRuntime.jsx("span", { className: 'truncate text-xs', children: userEmail })] })] }) }), jsxRuntime.jsx(DropdownMenuItem, { className: 'p-0 font-normal cursor-pointer', onClick: () => handleLogout(), children: jsxRuntime.jsxs("div", { className: 'flex items-center gap-2 px-1 py-1.5 text-left text-sm', children: [jsxRuntime.jsx("div", { className: 'flex w-8 h-8 p-2 items-center rounded-md', children: jsxRuntime.jsx(lucideReact.LogOut, { size: 16 }) }), "Log out"] }) })] })] }) }) }));
10368
10368
  };
10369
10369
 
10370
- const downloadWithServiceWorker = async (urlDownload, fileName) => {
10370
+ const downloadWithServiceWorker = async (urlDownload) => {
10371
10371
  try {
10372
10372
  const response = await fetch(urlDownload);
10373
10373
  if (!response.ok) {
10374
10374
  throw new Error('Erro ao fazer o download');
10375
10375
  }
10376
+ const contentDisposition = response.headers.get('content-disposition');
10377
+ const match = contentDisposition?.match(/filename\*?=(?:UTF-8''|")?([^";\n]+)"?/i);
10378
+ const fileName = match?.[1] ? decodeURIComponent(match[1].trim()) : (urlDownload.split('/').pop()?.split('?')[0] ?? 'download');
10376
10379
  const blob = await response.blob();
10377
10380
  const url = window.URL.createObjectURL(blob);
10378
10381
  const a = document.createElement('a');
@@ -10414,7 +10417,7 @@ function DataTableExport({ exportData, totalRows }) {
10414
10417
  return {};
10415
10418
  }
10416
10419
  const params = new URLSearchParams(exportData.params).toString();
10417
- downloadWithServiceWorker(`${exportData.url}?${params}`, 'data_export.xlsx');
10420
+ downloadWithServiceWorker(`${exportData.url}?${params}`);
10418
10421
  };
10419
10422
  const renderExport = () => {
10420
10423
  if (!exportData)