eai-frontend-components 2.0.44 → 2.0.45

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 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" | "destructive" | "outline" | "secondary" | "surface" | "green" | "red" | "gray" | "blue" | "orange" | null | undefined;
83
+ variant?: "default" | "outline" | "destructive" | "secondary" | "surface" | "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" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
108
+ variant?: "link" | "default" | "outline" | "destructive" | "secondary" | "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" | keyof React$1.HTMLAttributes<HTMLDivElement> | "asChild"> & {
211
+ }, "key" | "asChild" | keyof React$1.HTMLAttributes<HTMLDivElement>> & {
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" | "value" | "type"> & {
227
+ }, "key" | "asChild" | keyof React$1.InputHTMLAttributes<HTMLInputElement>>, "type" | "value" | "onChange"> & {
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" | keyof React$1.HTMLAttributes<HTMLDivElement> | "asChild"> & {
237
+ }, "key" | "asChild" | keyof React$1.HTMLAttributes<HTMLDivElement>> & {
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" | keyof React$1.HTMLAttributes<HTMLDivElement> | "asChild"> & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
246
+ }, "key" | "asChild" | keyof React$1.HTMLAttributes<HTMLDivElement>> & 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" | keyof React$1.HTMLAttributes<HTMLDivElement> | "asChild">, "value" | "heading"> & {
253
+ }, "key" | "asChild" | keyof React$1.HTMLAttributes<HTMLDivElement>>, "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" | keyof React$1.HTMLAttributes<HTMLDivElement> | "asChild"> & {
262
+ }, "key" | "asChild" | keyof React$1.HTMLAttributes<HTMLDivElement>> & {
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" | keyof React$1.HTMLAttributes<HTMLDivElement> | "asChild">, "onSelect" | "disabled" | "value"> & {
271
+ }, "key" | "asChild" | keyof React$1.HTMLAttributes<HTMLDivElement>>, "disabled" | "value" | "onSelect"> & {
272
272
  disabled?: boolean;
273
273
  onSelect?: (value: string) => void;
274
274
  value?: string;
@@ -722,6 +722,7 @@ interface Props$h {
722
722
  subLabel?: string;
723
723
  helpText?: JSX.Element;
724
724
  placeholder?: string;
725
+ placeholderSearch?: string;
725
726
  className?: string;
726
727
  disabled?: boolean;
727
728
  required?: boolean;
package/dist/index.esm.js CHANGED
@@ -9199,12 +9199,12 @@ const FormInputColor = ({ control, name, label, subLabel, helpText, placeholder,
9199
9199
  return (jsx(FormField, { control: control, name: name, render: ({ field, formState }) => (jsxs(FormItem, { className: className, children: [jsxs("div", { className: 'flex items-center space-x-1.5', children: [label && formLabelAndSubLabel(FormLabel, label, subLabel, required), helpText && formHelpText(helpText)] }), jsxs(Popover, { children: [jsx(PopoverTrigger, { asChild: true, children: jsx(FormControl, { children: jsx(Button, { type: 'button', variant: 'outline', className: cn('w-[240px] justify-start text-left font-normal', !field.value && 'text-zinc-500', className), disabled: disabled || formState.isSubmitting, children: jsxs("div", { className: 'w-full flex items-center gap-2', children: [field.value ? (jsx("div", { className: 'h-4 w-4 rounded !bg-center !bg-cover transition-all border', style: { backgroundColor: field.value } })) : (jsx(Paintbrush, { className: 'h-4 w-4' })), jsx("div", { className: 'truncate flex-1 text-sm', children: field.value ? field.value : placeholder || 'Selecione uma cor' })] }) }) }) }), jsx(PopoverContent, { className: cn('w-80', className), children: jsxs("div", { className: 'flex flex-col gap-4', children: [jsx("section", { className: '[&_.react-colorful]:w-auto', children: jsx(HexColorPicker, { color: field.value ?? DEFAULT_COLOR, onChange: (newColor) => handleColorChange(newColor, field.onChange) }) }), jsxs("div", { className: 'flex gap-2', children: [jsxs("div", { className: 'flex flex-col gap-1', children: [jsx(Label, { children: "Hex" }), jsx(Input, { value: currentColor, onChange: (e) => handleHexChange(e.target.value, field.onChange), maxLength: 7 })] }), jsxs("div", { className: 'flex gap-2', children: [jsxs("div", { className: 'flex flex-col gap-1', children: [jsx(Label, { children: "R" }), jsx(Input, { value: rgb.r, onChange: (e) => handleRgbChange('r', e.target.value, field.onChange), className: 'w-14' })] }), jsxs("div", { className: 'flex flex-col gap-1', children: [jsx(Label, { children: "G" }), jsx(Input, { value: rgb.g, onChange: (e) => handleRgbChange('g', e.target.value, field.onChange), className: 'w-14' })] }), jsxs("div", { className: 'flex flex-col gap-1', children: [jsx(Label, { children: "B" }), jsx(Input, { value: rgb.b, onChange: (e) => handleRgbChange('b', e.target.value, field.onChange), className: 'w-14' })] })] })] })] }) })] }), formMessage(FormMessage)] })) }));
9200
9200
  };
9201
9201
 
9202
- const FormCombobox = ({ control, variant = 'outline', name, label, subLabel, helpText, placeholder, className, disabled, required, options, selectedOption, iconLeft, iconRight, addEmptyOption, canUnselect = false, closePopUpOnChange = true, runInternalSearch = true, disabledSearch = false, onChange, onSearch, footerAction, }) => {
9202
+ const FormCombobox = ({ control, variant = 'outline', name, label, subLabel, helpText, placeholder, placeholderSearch, className, disabled, required, options, selectedOption, iconLeft, iconRight, addEmptyOption, canUnselect = false, closePopUpOnChange = true, runInternalSearch = true, disabledSearch = false, onChange, onSearch, footerAction, }) => {
9203
9203
  const { FormField, FormItem, FormLabel, FormControl, FormMessage } = FormComponents;
9204
9204
  const [open, setOpen] = useState(false);
9205
9205
  const [loading, setLoading] = useState(false);
9206
9206
  const [searchString, setSearchString] = useState('');
9207
- const DEFAULT_PLACEHOLDER = 'Digite para buscar...';
9207
+ const DEFAULT_PLACEHOLDER = 'Selecione';
9208
9208
  useEffect(() => {
9209
9209
  setLoading(false);
9210
9210
  }, [options]);
@@ -9273,7 +9273,7 @@ const FormCombobox = ({ control, variant = 'outline', name, label, subLabel, hel
9273
9273
  return (jsx(FormField, { control: control, name: name, render: ({ field, formState }) => (jsxs(FormItem, { className: className, children: [jsxs("div", { className: 'flex items-center space-x-1.5', children: [label && formLabelAndSubLabel(FormLabel, label, subLabel, required), helpText && formHelpText(helpText)] }), jsxs(Popover, { open: open, onOpenChange: (open) => {
9274
9274
  if (!disabled)
9275
9275
  setOpen(open);
9276
- }, children: [jsx(PopoverTrigger, { asChild: true, children: jsx(FormControl, { children: jsx("div", { className: cn(`rounded-sm outline-none ${open ? 'ring-2 ring-ring ring-offset-2' : 'ring-0'}`, className), children: jsxs(Button, { type: 'button', variant: variant, role: 'combobox', "aria-expanded": open, className: cn('justify-between disabled:border-disabled disabled:cursor-not-allowed disabled:opacity-50', formState.errors[name] ? 'border-red-600' : '', className), disabled: disabled || formState.isSubmitting, children: [iconLeft, jsx("div", { className: 'grid flex-1 text-left text-sm leading-tight', children: jsx("span", { className: 'truncate font-normal', children: getSelectedOption(field.value) ? (jsxs("div", { className: 'flex gap-2', children: [getSelectedOption(field.value)?.icon, getSelectedOption(field.value)?.title] })) : (jsx("span", { className: 'text-zinc-500', children: placeholder ?? DEFAULT_PLACEHOLDER })) }) }), iconRight ?? jsx(ChevronsUpDown, { size: 20, className: 'stroke-zinc-500' })] }) }) }) }), jsxs(PopoverContent, { className: cn('p-0', className, 'w-[--radix-popover-trigger-width]'), children: [jsxs(Command, { shouldFilter: false, children: [!disabledSearch && jsx(CommandInput, { placeholder: placeholder ?? DEFAULT_PLACEHOLDER, onKeyUp: handleKeyUp }), jsxs(CommandList, { children: [jsx(CommandEmpty, { className: 'flex flex-col justify-between items-center p-3 font-normal text-sm', children: loading ? (jsx(LoaderCircle, { size: 16, className: 'text-muted-foreground animate-spin mr-2' })) : getOptions()?.length === 0 && (searchString !== '' || disabledSearch) ? ('Nenhum resultado encontrado') : ('Utilize o campo de busca acima') }), options.length > 0 && (jsx(CommandGroup, { children: getOptions().map((option) => (jsxs(CommandItem, { value: option.value, className: 'group', onSelect: () => handleSelect(option.value, field), children: [jsxs("div", { className: cn('grid flex-1 text-left text-sm leading-tight', option.className), children: [jsxs("div", { className: 'flex gap-2', children: [option.icon, jsx("span", { className: 'truncate font-normal', children: option.title })] }), jsx("span", { className: 'truncate text-xs text-zinc-500', children: option.subTitle })] }), jsxs("div", { className: `ml-auto text-zinc-500 ${field.value === option.value ? 'opacity-100' : 'opacity-0'}`, children: [jsx(Check, { className: cn('flex', canUnselect && 'group-hover:hidden hover:hidden'), size: 16 }), jsx(X, { className: cn('hidden', canUnselect && 'group-hover:flex hover:flex'), size: 16 })] })] }, `key-opt-${option.value}`))) }))] })] }), footerAction && (jsx("div", { className: 'grid w-full p-1 border-t', children: jsxs(Button, { type: 'button', variant: 'ghost', className: 'h-8', onClick: () => footerAction.onClick(), children: [footerAction.icon, footerAction.label] }) }))] })] }), formMessage(FormMessage)] })) }));
9276
+ }, children: [jsx(PopoverTrigger, { asChild: true, children: jsx(FormControl, { children: jsx("div", { className: cn(`rounded-sm outline-none ${open ? 'ring-2 ring-ring ring-offset-2' : 'ring-0'}`, className), children: jsxs(Button, { type: 'button', variant: variant, role: 'combobox', "aria-expanded": open, className: cn('justify-between disabled:border-disabled disabled:cursor-not-allowed disabled:opacity-50', formState.errors[name] ? 'border-red-600' : '', className), disabled: disabled || formState.isSubmitting, children: [iconLeft, jsx("div", { className: 'grid flex-1 text-left text-sm leading-tight', children: jsx("span", { className: 'truncate font-normal', children: getSelectedOption(field.value) ? (jsxs("div", { className: 'flex gap-2', children: [getSelectedOption(field.value)?.icon, getSelectedOption(field.value)?.title] })) : (jsx("span", { className: 'text-zinc-500', children: placeholder ?? DEFAULT_PLACEHOLDER })) }) }), iconRight ?? jsx(ChevronsUpDown, { size: 20, className: 'stroke-zinc-500' })] }) }) }) }), jsxs(PopoverContent, { className: cn('p-0', className, 'w-[--radix-popover-trigger-width]'), children: [jsxs(Command, { shouldFilter: false, children: [!disabledSearch && jsx(CommandInput, { placeholder: placeholder ?? DEFAULT_PLACEHOLDER, onKeyUp: handleKeyUp }), jsxs(CommandList, { children: [jsx(CommandEmpty, { className: 'flex flex-col justify-between items-center p-3 font-normal text-sm', children: loading ? (jsx(LoaderCircle, { size: 16, className: 'text-muted-foreground animate-spin mr-2' })) : getOptions()?.length === 0 && (searchString !== '' || disabledSearch) ? ('Nenhum resultado encontrado') : ((placeholderSearch ?? 'Utilize o campo de busca acima')) }), options.length > 0 && (jsx(CommandGroup, { children: getOptions().map((option) => (jsxs(CommandItem, { value: option.value, className: 'group', onSelect: () => handleSelect(option.value, field), children: [jsxs("div", { className: cn('grid flex-1 text-left text-sm leading-tight', option.className), children: [jsxs("div", { className: 'flex gap-2', children: [option.icon, jsx("span", { className: 'truncate font-normal', children: option.title })] }), jsx("span", { className: 'truncate text-xs text-zinc-500', children: option.subTitle })] }), jsxs("div", { className: `ml-auto text-zinc-500 ${field.value === option.value ? 'opacity-100' : 'opacity-0'}`, children: [jsx(Check, { className: cn('flex', canUnselect && 'group-hover:hidden hover:hidden'), size: 16 }), jsx(X, { className: cn('hidden', canUnselect && 'group-hover:flex hover:flex'), size: 16 })] })] }, `key-opt-${option.value}`))) }))] })] }), footerAction && (jsx("div", { className: 'grid w-full p-1 border-t', children: jsxs(Button, { type: 'button', variant: 'ghost', className: 'h-8', onClick: () => footerAction.onClick(), children: [footerAction.icon, footerAction.label] }) }))] })] }), formMessage(FormMessage)] })) }));
9277
9277
  };
9278
9278
 
9279
9279
  const masks$1 = ['999.999.999-999', '99.999.999/9999-99'];