eai-frontend-components 2.0.19 → 2.0.21

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" | "secondary" | "surface" | "outline" | "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" | "secondary" | "outline" | "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> {
@@ -408,8 +408,93 @@ declare const Input: React$1.ForwardRefExoticComponent<InputProps & React$1.RefA
408
408
 
409
409
  declare const Label: React$1.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React$1.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps<(props?: class_variance_authority_dist_types.ClassProp | undefined) => string> & React$1.RefAttributes<HTMLLabelElement>>;
410
410
 
411
+ /**
412
+ * Type for mask modification functions.
413
+ * Fallback for projects without @react-input/mask types.
414
+ */
415
+ type MaskModifyFunction = Modify;
416
+ /**
417
+ * Modify function for phone number input mask.
418
+ * Automatically adjusts between landline and mobile phone formats.
419
+ *
420
+ * @param value - Current input value
421
+ * @param data - New input data
422
+ * @param selectionStart - Cursor start position
423
+ * @param selectionEnd - Cursor end position
424
+ * @returns Mask configuration object
425
+ */
411
426
  declare const modifyPhone: Modify;
427
+ /**
428
+ * Creates a phone number mask based on the input length.
429
+ * - Landline: (XX) XXXX-XXXX
430
+ * - Mobile: (XX) X XXXX-XXXX
431
+ *
432
+ * @param value - Phone number string (can be null)
433
+ * @returns Mask configuration object with pattern and replacement rules
434
+ *
435
+ * @example
436
+ * ```tsx
437
+ * const mask = maskPhone('11987654321');
438
+ * // Returns: { mask: '(__) _ ____-____', replacement: { _: /\d/ } }
439
+ * ```
440
+ */
441
+ declare function maskPhone(value: string | null): {
442
+ mask: string;
443
+ replacement: {
444
+ _: RegExp;
445
+ };
446
+ };
447
+ /**
448
+ * Modify function for CPF/CNPJ input mask.
449
+ * Automatically switches between CPF and CNPJ formats based on input length.
450
+ *
451
+ * @param value - Current input value
452
+ * @param data - New input data
453
+ * @param selectionStart - Cursor start position
454
+ * @param selectionEnd - Cursor end position
455
+ * @returns Mask configuration object
456
+ */
412
457
  declare const modifyCpfCnpj: Modify;
458
+ /**
459
+ * Creates a CPF or CNPJ mask based on the input length.
460
+ * - CPF: XXX.XXX.XXX-XX (up to 11 digits)
461
+ * - CNPJ: XX.XXX.XXX/XXXX-XX (12+ digits)
462
+ *
463
+ * @param value - CPF/CNPJ string (can be null)
464
+ * @returns Mask configuration object with pattern and replacement rules
465
+ *
466
+ * @example
467
+ * ```tsx
468
+ * const cpfMask = maskCpfCnpj('12345678901');
469
+ * // Returns: { mask: '___.___.___-___', replacement: { _: /\d/ } }
470
+ *
471
+ * const cnpjMask = maskCpfCnpj('12345678000195');
472
+ * // Returns: { mask: '__.___.___/____-__', replacement: { _: /\d/ } }
473
+ * ```
474
+ */
475
+ declare function maskCpfCnpj(value: string | null): {
476
+ mask: string;
477
+ replacement: {
478
+ _: RegExp;
479
+ };
480
+ };
481
+ /**
482
+ * Removes all non-numeric characters from a string.
483
+ * Useful for extracting only digits from masked inputs.
484
+ *
485
+ * @param value - String with potential mask characters
486
+ * @returns String containing only numeric characters
487
+ *
488
+ * @example
489
+ * ```tsx
490
+ * const cleaned = removeMaskNumber('(11) 9 8765-4321');
491
+ * // Returns: '11987654321'
492
+ *
493
+ * const cleanCpf = removeMaskNumber('123.456.789-01');
494
+ * // Returns: '12345678901'
495
+ * ```
496
+ */
497
+ declare const removeMaskNumber: (value: string) => string;
413
498
 
414
499
  declare const Pagination: {
415
500
  ({ className, ...props }: React$1.ComponentProps<"nav">): react_jsx_runtime.JSX.Element;
@@ -1509,8 +1594,48 @@ declare function getTailwindColorShades(): {
1509
1594
  type TailwindColorName = keyof ReturnType<typeof getTailwindColorShades>;
1510
1595
  declare const replaceThemeTailwindColors: (theme: string, tailwindColor: string) => HTMLStyleElement;
1511
1596
 
1597
+ /**
1598
+ * Formats a phone number string with proper mask.
1599
+ * Automatically detects landline vs mobile format.
1600
+ *
1601
+ * @param telefone - Raw phone number string
1602
+ * @param removerCountryCode - Whether to remove country code (55) if present
1603
+ * @returns Formatted phone number string
1604
+ *
1605
+ * @example
1606
+ * ```tsx
1607
+ * formatPhone('11987654321') // '(11) 9 8765-4321'
1608
+ * formatPhone('1134567890') // '(11) 3456-7890'
1609
+ * ```
1610
+ */
1512
1611
  declare function formatPhone(telefone: string, removerCountryCode?: boolean): string;
1612
+ /**
1613
+ * Formats a CPF or CNPJ string with proper mask.
1614
+ * Automatically detects CPF vs CNPJ format based on length.
1615
+ *
1616
+ * @param cpfCnpj - Raw CPF/CNPJ string
1617
+ * @returns Formatted CPF/CNPJ string
1618
+ *
1619
+ * @example
1620
+ * ```tsx
1621
+ * formatCpfCnpj('12345678901') // '123.456.789-01'
1622
+ * formatCpfCnpj('12345678000195') // '12.345.678/0001-95'
1623
+ * ```
1624
+ */
1513
1625
  declare function formatCpfCnpj(cpfCnpj?: string): string;
1626
+ /**
1627
+ * Formats a date to Brazilian format (DD/MM/YYYY).
1628
+ *
1629
+ * @param date - Date string, Date object, or undefined
1630
+ * @param separator - Date separator (default: '/')
1631
+ * @returns Formatted date string in Brazilian format
1632
+ *
1633
+ * @example
1634
+ * ```tsx
1635
+ * formatDate('2023-12-25') // '25/12/2023'
1636
+ * formatDate(new Date()) // '13/10/2025'
1637
+ * ```
1638
+ */
1514
1639
  declare const formatDate: (date: string | Date | undefined, separator?: string) => string;
1515
1640
  declare const formatDateTime: (date: Date | undefined, returnSeconds?: boolean) => string;
1516
1641
  declare function formatDateCalendar(date: Date | undefined): string;
@@ -1524,7 +1649,74 @@ declare const convertBytesToMB: (bytes: number) => number;
1524
1649
  declare const convertMonthToDays: (months: number) => number;
1525
1650
  declare const convertDaysToMonth: (days: number) => number;
1526
1651
  declare const formatNumber: (value: number) => string;
1652
+ /**
1653
+ * Formats a number with Brazilian decimal format.
1654
+ *
1655
+ * @param value - Numeric value to format
1656
+ * @param decimalPlaces - Number of decimal places (default: 2)
1657
+ * @returns Formatted decimal string
1658
+ *
1659
+ * @example
1660
+ * ```tsx
1661
+ * formatDecimal(1234.56) // '1.234,56'
1662
+ * formatDecimal(1000.1, 1) // '1.000,1'
1663
+ * ```
1664
+ */
1527
1665
  declare const formatDecimal: (value: number, decimalPlaces?: number) => string;
1666
+ /**
1667
+ * Formats a number as percentage with Brazilian decimal format.
1668
+ *
1669
+ * @param value - Numeric value to format
1670
+ * @param decimalPlaces - Number of decimal places (default: 2)
1671
+ * @returns Formatted percentage string
1672
+ *
1673
+ * @example
1674
+ * ```tsx
1675
+ * formatPercent(15.5) // '% 15,50'
1676
+ * formatPercent(100, 0) // '% 100'
1677
+ * ```
1678
+ */
1679
+ declare const formatPercent: (value: number, decimalPlaces?: number) => string;
1680
+ /**
1681
+ * Formats a number as Brazilian currency (BRL).
1682
+ *
1683
+ * @param value - Numeric value to format
1684
+ * @param decimalPlaces - Number of decimal places (default: 2)
1685
+ * @returns Formatted currency string
1686
+ *
1687
+ * @example
1688
+ * ```tsx
1689
+ * formatCurrency(1234.56) // 'R$ 1.234,56'
1690
+ * formatCurrency(1000, 0) // 'R$ 1.000'
1691
+ * ```
1692
+ */
1693
+ declare const formatCurrency: (value: number, decimalPlaces?: number) => string;
1694
+ declare const isInvalidCurrencyValue: (rawValue: string | undefined) => boolean;
1695
+ /**
1696
+ * Formats an MSISDN (mobile phone number) to display format.
1697
+ *
1698
+ * @param value - Raw MSISDN string
1699
+ * @returns Formatted MSISDN string
1700
+ *
1701
+ * @example
1702
+ * ```tsx
1703
+ * formatMsisdn('5511987654321') // '(11) 98765-4321'
1704
+ * ```
1705
+ */
1706
+ declare function formatMsisdn(value?: string): string;
1707
+ /**
1708
+ * Formats a CEP (Brazilian postal code) with proper mask.
1709
+ *
1710
+ * @param cep - Raw CEP string
1711
+ * @returns Formatted CEP string (XXXXX-XXX)
1712
+ *
1713
+ * @example
1714
+ * ```tsx
1715
+ * formatCEP('01234567') // '01234-567'
1716
+ * formatCEP('12345') // '12345'
1717
+ * ```
1718
+ */
1719
+ declare function formatCEP(cep?: string): string;
1528
1720
 
1529
1721
  declare const getFirstDayOfCurrentMonth: () => Date;
1530
1722
  declare const getFirstDayOf90DaysAgo: () => Date;
@@ -1535,5 +1727,5 @@ declare const addDaysToToday: (days: number) => Date;
1535
1727
 
1536
1728
  declare function isUUIDv4(str: string): boolean;
1537
1729
 
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, ChartConfig, ComboboxOption, DataTableProps, ExportDataTable, FiltersActions, Module, MultiSelectOption, OriginalDataTableData, PropsStepNewForm, RadioOption, SelectOption, SidebarPage, TailwindColorName };
1730
+ 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, formatCEP, formatCpfCnpj, formatCurrency, formatDate, formatDateCalendar, formatDateTime, formatDecimal, formatMsisdn, formatNumber, formatPercent, formatPhone, getFirstDayOf90DaysAgo, getFirstDayOfCurrentMonth, getTailwindColorShades, invertDate, isInvalidCurrencyValue, isUUIDv4, maskCpfCnpj, maskPhone, modifyCpfCnpj, modifyPhone, removeMaskNumber, replaceThemeTailwindColors, roundNumber, stringDateToDate, stringToDate, stringToNumber, toast, useFormField, useSidebar, useTheme, useToast };
1731
+ export type { ActionRow, ActionTable, ButtonProps, CalendarProps, CarouselApi, ChartConfig, ComboboxOption, DataTableProps, ExportDataTable, FiltersActions, MaskModifyFunction, Module, MultiSelectOption, OriginalDataTableData, PropsStepNewForm, RadioOption, SelectOption, SidebarPage, TailwindColorName };