@bizapps/ui 1.5.1 → 1.7.0

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/main.d.cts CHANGED
@@ -4,6 +4,8 @@ import * as class_variance_authority_types from 'class-variance-authority/types'
4
4
  import { VariantProps } from 'class-variance-authority';
5
5
  import { Avatar as Avatar$1, Label as Label$1, Toggle as Toggle$1, ToggleGroup as ToggleGroup$1, Select as Select$1, Separator as Separator$1, Progress as Progress$1, Slider as Slider$1, Switch as Switch$1, Tabs as Tabs$1, Tooltip as Tooltip$1, Popover as Popover$1, Dialog as Dialog$1, AlertDialog as AlertDialog$1, Accordion as Accordion$1, DropdownMenu as DropdownMenu$1, RadioGroup as RadioGroup$1, NavigationMenu as NavigationMenu$1, Checkbox as Checkbox$1 } from 'radix-ui';
6
6
  import useEmblaCarousel, { UseEmblaCarouselType } from 'embla-carousel-react';
7
+ import { PhoneFieldValidity } from './phone.cjs';
8
+ export { PhoneFieldProblem, validatePhone } from './phone.cjs';
7
9
  import { DropzoneOptions, FileRejection, DropEvent } from 'react-dropzone';
8
10
  import Color from 'color';
9
11
  import { DateRange } from 'react-day-picker';
@@ -241,6 +243,15 @@ interface PhoneFieldProps extends Omit<ComponentProps<'input'>, 'value' | 'defau
241
243
  value?: string;
242
244
  /** Emits the E.164 form whenever the national number changes; emits "" when empty. */
243
245
  onValueChange?: (value: string) => void;
246
+ /**
247
+ * Emits whether the current value is a valid number, and why it is not when
248
+ * it fails. Fires on mount and on every change of the verdict — including
249
+ * changes caused by picking another country, which do not always change the
250
+ * value. It emits STATE, never copy: the message belongs to the consumer's
251
+ * i18n catalog. For the same rule outside React (Zod schema, route handler)
252
+ * import `validatePhone` from `@bizapps/design-system-testing/phone`.
253
+ */
254
+ onValidityChange?: (validity: PhoneFieldValidity) => void;
244
255
  /** ISO code preselected when `value` is empty, e.g. "CO". Falls back to the first country. */
245
256
  defaultCountry?: string;
246
257
  /** Placeholder for the number input. */
@@ -258,7 +269,7 @@ interface PhoneFieldProps extends Omit<ComponentProps<'input'>, 'value' | 'defau
258
269
  */
259
270
  name?: string;
260
271
  }
261
- declare function PhoneField({ countries, value, onValueChange, defaultCountry, placeholder, disabled, className, container, name, ...inputProps }: PhoneFieldProps): react.JSX.Element;
272
+ declare function PhoneField({ countries, value, onValueChange, onValidityChange, defaultCountry, placeholder, disabled, className, container, name, ...inputProps }: PhoneFieldProps): react.JSX.Element;
262
273
 
263
274
  interface PinInputProps {
264
275
  length?: number;
@@ -1280,6 +1291,45 @@ declare const logos: {
1280
1291
  };
1281
1292
  type LogoKey = keyof typeof logos;
1282
1293
 
1294
+ /**
1295
+ * Brand palette for the celebration burst, resolved from the `--color-main-*`
1296
+ * tokens rather than referenced through them: the canvas is appended to the
1297
+ * body, outside the themed tree, so `var()` would resolve against the document
1298
+ * root and miss any scoped override anyway.
1299
+ *
1300
+ * `--color-main-white` is deliberately absent. The app paints its page ground
1301
+ * `--color-main-light-background` (#f1f5f7), which swallows white particles.
1302
+ */
1303
+ declare const CONFETTI_COLORS: readonly ["#22205f", "#f66a24", "#faca4a", "#01d42f", "#d93235"];
1304
+ type FireConfettiOptions = {
1305
+ /** Particles per cannon. Two cannons fire, so the burst is twice this. */
1306
+ particleCount?: number;
1307
+ /** Vertical launch point: 0 is the top of the viewport, 1 the bottom. */
1308
+ originY?: number;
1309
+ /** Overrides the brand palette. Any CSS color string canvas can parse. */
1310
+ colors?: string[];
1311
+ };
1312
+ /**
1313
+ * Fires a celebration burst from two cannons angled inward at the lower corners
1314
+ * of the viewport.
1315
+ *
1316
+ * The geometry is the whole point. A single centred burst reads as a puff and
1317
+ * dies mid-screen; the crossfire covers the full width, which is what carries
1318
+ * the celebration. Launching from 0.7 rather than the centre reads as confetti
1319
+ * thrown upward instead of an explosion pushing outward.
1320
+ *
1321
+ * Resolves once the last particle has settled, so a caller can sequence on it.
1322
+ * Honours `prefers-reduced-motion`, in which case it resolves immediately
1323
+ * without drawing.
1324
+ */
1325
+ declare function fireConfetti({ particleCount, originY, colors, }?: FireConfettiOptions): Promise<void>;
1326
+ /**
1327
+ * Clears every burst still in flight and removes the canvas.
1328
+ *
1329
+ * For a caller that unmounts, or navigates away, while particles are airborne.
1330
+ */
1331
+ declare function resetConfetti(): void;
1332
+
1283
1333
  declare function Table({ className, containerClassName, ...props }: ComponentProps<'table'> & {
1284
1334
  /**
1285
1335
  * Classes for the scroll container that wraps the table. Defaults to
@@ -2248,4 +2298,4 @@ interface TCCEProviderProps {
2248
2298
  }
2249
2299
  declare function TCCEProvider({ children, permissions, toasterPosition, tooltipDelayDuration, }: TCCEProviderProps): react.JSX.Element;
2250
2300
 
2251
- export { type AbilityContextValue, AbilityProvider, type AbilityProviderProps, type AbilityStatus, Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, type AnimationTokens, AppShell, type AppShellItem, type AppShellProps, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, BottomNav, type BottomNavItem, BottomNavTabs, BottomNavTabsContent, type BottomNavTabsItem, BottomNavTabsList, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button$1 as Button, type CalendarEvent, type CalendarView, Can, CanNot, type CanNotProps, type CanProps, type CanState, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, type CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, type CellAlignment, Checkbox, ColorPicker, ColorPickerAlpha, type ColorPickerAlphaProps, ColorPickerEyeDropper, type ColorPickerEyeDropperProps, ColorPickerFormat, type ColorPickerFormatProps, ColorPickerHue, type ColorPickerHueProps, ColorPickerOutput, type ColorPickerOutputProps, ColorPickerPresets, type ColorPickerPresetsProps, type ColorPickerProps, ColorPickerSelection, type ColorPickerSelectionProps, type ColumnMeta, Combobox, type ComboboxMatchMode, type ComboboxOption, type ComboboxProps, DataTable, DataTableCardView, type DataTableCardViewProps, DataTableColumnFilter, type DataTableColumnFilterProps, DataTableFooter, type DataTableFooterProps, DataTableHeaderCell, type DataTableHeaderCellProps, type DataTableProps, DataTableRowActions, type DataTableRowActionsProps, DataTableSearch, type DataTableSearchProps, DataTableSkeleton, type DataTableSkeletonProps, DataTableToolbar, type DataTableToolbarProps, DatePicker, type DatePickerProps, type DatePickerRangeProps, type DatePickerSingleProps, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, type DrawerSide, type DrawerSize, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Dropzone, DropzoneContent, type DropzoneContentProps, DropzoneEmptyState, type DropzoneEmptyStateProps, type DropzoneProps, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, EventCalendar, type EventCalendarProps, type EventCreateRange, Field, FieldDescription, FieldError, FieldGroup, FieldLabel, FilterOption, type FilterOptionProps, Input, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Label, Link, Logo, type LogoKey, MiniCalendar, MiniCalendarDay, type MiniCalendarDayProps, MiniCalendarDays, type MiniCalendarDaysProps, MiniCalendarNavigation, type MiniCalendarNavigationProps, type MiniCalendarProps, Navbar, type NavbarDropdownItem, type NavbarNavLink, type NavbarNotification, type NavbarProps, type NavbarUtilityLink, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Permission, PhoneField, type PhoneFieldCountry, type PhoneFieldProps, PinInput, type PinInputProps, Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, type ProgressProps, RadioGroup, RadioGroupItem, type RowAction, SegmentedControl, SegmentedControlItem, type SegmentedControlProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger$1 as SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, type SortDirection, type SortRecord, Spinner, SpinnerDots, type SpinnerDotsProps, SpinnerLoader, type SpinnerLoaderProps, type SpinnerProps, Status, StatusIndicator, type StatusIndicatorProps, StatusLabel, type StatusLabelProps, type StatusProps, Switch, TCCEProvider, type TCCEProviderProps, TEXT_SIZES, TEXT_WEIGHTS, Table, TableBody, TableCaption, TableCell, type TableCellSize, type TableClassNames, type TableColumnDef, type TableContextType, TableFooter, TableHead, TableHeader, TablePagination, type TablePaginationProps, TableRow, type TableVariant, Tabs, TabsContent, TabsList, TabsTrigger, Text, type TextAs, type TextProps, type TextSize, type TextWeight, Textarea, type ToastAction, type ToastItem, type ToastType, Toaster, type ToasterPosition, type ToasterProps, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UseTableDataProps, type UseTableDataReturn, type UseTableFilteringProps, type UseTableFilteringReturn, type UseTableGlobalFilterProps, type UseTableGlobalFilterReturn, type UseTableSizingProps, type UseTableSizingReturn, type UseTableSortingProps, type UseTableSortingReturn, type UseTableVisibilityProps, type UseTableVisibilityReturn, alertVariants, animation, avatarVariants, badgeVariants, buttonVariants$1 as buttonVariants, columnFiltersToArrayQueryParams, columnFiltersToJsonString, columnFiltersToQueryParams, columnFiltersToRecord, createBackendParams, createBackendParamsWithFilters, duration, ease, fadeIn, getActiveFilterCount, getActiveFilterValues, getColumnValueCounts, getUniqueColumnValues, hasActiveFilters, linkVariants, logos, mergeFilters, multiSelectFilter, navigationMenuTriggerStyle, parseJsonToFilters, parseQueryParamsToFilters, progressIndicatorVariants, progressVariants, scaleIn, searchInArray, skeletonVariants, slideRight, slideUp, sortRecordToSortingState, sortingStateToJsonString, sortingStateToRecord, spinnerDotsVariants, spinnerLoaderVariants, spinnerVariants, spring, stagger, toggleVariants, tooltipContentVariants, transition, useAbility, useAbilityStatus, useAppForm, useCan, useCarousel, useColorPicker, useColumnFilter, useSidebar, useTableContext, useTableData, useTableFiltering, useTableGlobalFilter, useTableSizing, useTableSorting, useTableVisibility, useToast };
2301
+ export { type AbilityContextValue, AbilityProvider, type AbilityProviderProps, type AbilityStatus, Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, type AnimationTokens, AppShell, type AppShellItem, type AppShellProps, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, BottomNav, type BottomNavItem, BottomNavTabs, BottomNavTabsContent, type BottomNavTabsItem, BottomNavTabsList, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button$1 as Button, CONFETTI_COLORS, type CalendarEvent, type CalendarView, Can, CanNot, type CanNotProps, type CanProps, type CanState, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, type CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, type CellAlignment, Checkbox, ColorPicker, ColorPickerAlpha, type ColorPickerAlphaProps, ColorPickerEyeDropper, type ColorPickerEyeDropperProps, ColorPickerFormat, type ColorPickerFormatProps, ColorPickerHue, type ColorPickerHueProps, ColorPickerOutput, type ColorPickerOutputProps, ColorPickerPresets, type ColorPickerPresetsProps, type ColorPickerProps, ColorPickerSelection, type ColorPickerSelectionProps, type ColumnMeta, Combobox, type ComboboxMatchMode, type ComboboxOption, type ComboboxProps, DataTable, DataTableCardView, type DataTableCardViewProps, DataTableColumnFilter, type DataTableColumnFilterProps, DataTableFooter, type DataTableFooterProps, DataTableHeaderCell, type DataTableHeaderCellProps, type DataTableProps, DataTableRowActions, type DataTableRowActionsProps, DataTableSearch, type DataTableSearchProps, DataTableSkeleton, type DataTableSkeletonProps, DataTableToolbar, type DataTableToolbarProps, DatePicker, type DatePickerProps, type DatePickerRangeProps, type DatePickerSingleProps, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, type DrawerSide, type DrawerSize, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Dropzone, DropzoneContent, type DropzoneContentProps, DropzoneEmptyState, type DropzoneEmptyStateProps, type DropzoneProps, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, EventCalendar, type EventCalendarProps, type EventCreateRange, Field, FieldDescription, FieldError, FieldGroup, FieldLabel, FilterOption, type FilterOptionProps, type FireConfettiOptions, Input, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Label, Link, Logo, type LogoKey, MiniCalendar, MiniCalendarDay, type MiniCalendarDayProps, MiniCalendarDays, type MiniCalendarDaysProps, MiniCalendarNavigation, type MiniCalendarNavigationProps, type MiniCalendarProps, Navbar, type NavbarDropdownItem, type NavbarNavLink, type NavbarNotification, type NavbarProps, type NavbarUtilityLink, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Permission, PhoneField, type PhoneFieldCountry, type PhoneFieldProps, PhoneFieldValidity, PinInput, type PinInputProps, Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, type ProgressProps, RadioGroup, RadioGroupItem, type RowAction, SegmentedControl, SegmentedControlItem, type SegmentedControlProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger$1 as SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, type SortDirection, type SortRecord, Spinner, SpinnerDots, type SpinnerDotsProps, SpinnerLoader, type SpinnerLoaderProps, type SpinnerProps, Status, StatusIndicator, type StatusIndicatorProps, StatusLabel, type StatusLabelProps, type StatusProps, Switch, TCCEProvider, type TCCEProviderProps, TEXT_SIZES, TEXT_WEIGHTS, Table, TableBody, TableCaption, TableCell, type TableCellSize, type TableClassNames, type TableColumnDef, type TableContextType, TableFooter, TableHead, TableHeader, TablePagination, type TablePaginationProps, TableRow, type TableVariant, Tabs, TabsContent, TabsList, TabsTrigger, Text, type TextAs, type TextProps, type TextSize, type TextWeight, Textarea, type ToastAction, type ToastItem, type ToastType, Toaster, type ToasterPosition, type ToasterProps, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UseTableDataProps, type UseTableDataReturn, type UseTableFilteringProps, type UseTableFilteringReturn, type UseTableGlobalFilterProps, type UseTableGlobalFilterReturn, type UseTableSizingProps, type UseTableSizingReturn, type UseTableSortingProps, type UseTableSortingReturn, type UseTableVisibilityProps, type UseTableVisibilityReturn, alertVariants, animation, avatarVariants, badgeVariants, buttonVariants$1 as buttonVariants, columnFiltersToArrayQueryParams, columnFiltersToJsonString, columnFiltersToQueryParams, columnFiltersToRecord, createBackendParams, createBackendParamsWithFilters, duration, ease, fadeIn, fireConfetti, getActiveFilterCount, getActiveFilterValues, getColumnValueCounts, getUniqueColumnValues, hasActiveFilters, linkVariants, logos, mergeFilters, multiSelectFilter, navigationMenuTriggerStyle, parseJsonToFilters, parseQueryParamsToFilters, progressIndicatorVariants, progressVariants, resetConfetti, scaleIn, searchInArray, skeletonVariants, slideRight, slideUp, sortRecordToSortingState, sortingStateToJsonString, sortingStateToRecord, spinnerDotsVariants, spinnerLoaderVariants, spinnerVariants, spring, stagger, toggleVariants, tooltipContentVariants, transition, useAbility, useAbilityStatus, useAppForm, useCan, useCarousel, useColorPicker, useColumnFilter, useSidebar, useTableContext, useTableData, useTableFiltering, useTableGlobalFilter, useTableSizing, useTableSorting, useTableVisibility, useToast };
package/dist/main.d.ts CHANGED
@@ -4,6 +4,8 @@ import * as class_variance_authority_types from 'class-variance-authority/types'
4
4
  import { VariantProps } from 'class-variance-authority';
5
5
  import { Avatar as Avatar$1, Label as Label$1, Toggle as Toggle$1, ToggleGroup as ToggleGroup$1, Select as Select$1, Separator as Separator$1, Progress as Progress$1, Slider as Slider$1, Switch as Switch$1, Tabs as Tabs$1, Tooltip as Tooltip$1, Popover as Popover$1, Dialog as Dialog$1, AlertDialog as AlertDialog$1, Accordion as Accordion$1, DropdownMenu as DropdownMenu$1, RadioGroup as RadioGroup$1, NavigationMenu as NavigationMenu$1, Checkbox as Checkbox$1 } from 'radix-ui';
6
6
  import useEmblaCarousel, { UseEmblaCarouselType } from 'embla-carousel-react';
7
+ import { PhoneFieldValidity } from './phone.js';
8
+ export { PhoneFieldProblem, validatePhone } from './phone.js';
7
9
  import { DropzoneOptions, FileRejection, DropEvent } from 'react-dropzone';
8
10
  import Color from 'color';
9
11
  import { DateRange } from 'react-day-picker';
@@ -241,6 +243,15 @@ interface PhoneFieldProps extends Omit<ComponentProps<'input'>, 'value' | 'defau
241
243
  value?: string;
242
244
  /** Emits the E.164 form whenever the national number changes; emits "" when empty. */
243
245
  onValueChange?: (value: string) => void;
246
+ /**
247
+ * Emits whether the current value is a valid number, and why it is not when
248
+ * it fails. Fires on mount and on every change of the verdict — including
249
+ * changes caused by picking another country, which do not always change the
250
+ * value. It emits STATE, never copy: the message belongs to the consumer's
251
+ * i18n catalog. For the same rule outside React (Zod schema, route handler)
252
+ * import `validatePhone` from `@bizapps/design-system-testing/phone`.
253
+ */
254
+ onValidityChange?: (validity: PhoneFieldValidity) => void;
244
255
  /** ISO code preselected when `value` is empty, e.g. "CO". Falls back to the first country. */
245
256
  defaultCountry?: string;
246
257
  /** Placeholder for the number input. */
@@ -258,7 +269,7 @@ interface PhoneFieldProps extends Omit<ComponentProps<'input'>, 'value' | 'defau
258
269
  */
259
270
  name?: string;
260
271
  }
261
- declare function PhoneField({ countries, value, onValueChange, defaultCountry, placeholder, disabled, className, container, name, ...inputProps }: PhoneFieldProps): react.JSX.Element;
272
+ declare function PhoneField({ countries, value, onValueChange, onValidityChange, defaultCountry, placeholder, disabled, className, container, name, ...inputProps }: PhoneFieldProps): react.JSX.Element;
262
273
 
263
274
  interface PinInputProps {
264
275
  length?: number;
@@ -1280,6 +1291,45 @@ declare const logos: {
1280
1291
  };
1281
1292
  type LogoKey = keyof typeof logos;
1282
1293
 
1294
+ /**
1295
+ * Brand palette for the celebration burst, resolved from the `--color-main-*`
1296
+ * tokens rather than referenced through them: the canvas is appended to the
1297
+ * body, outside the themed tree, so `var()` would resolve against the document
1298
+ * root and miss any scoped override anyway.
1299
+ *
1300
+ * `--color-main-white` is deliberately absent. The app paints its page ground
1301
+ * `--color-main-light-background` (#f1f5f7), which swallows white particles.
1302
+ */
1303
+ declare const CONFETTI_COLORS: readonly ["#22205f", "#f66a24", "#faca4a", "#01d42f", "#d93235"];
1304
+ type FireConfettiOptions = {
1305
+ /** Particles per cannon. Two cannons fire, so the burst is twice this. */
1306
+ particleCount?: number;
1307
+ /** Vertical launch point: 0 is the top of the viewport, 1 the bottom. */
1308
+ originY?: number;
1309
+ /** Overrides the brand palette. Any CSS color string canvas can parse. */
1310
+ colors?: string[];
1311
+ };
1312
+ /**
1313
+ * Fires a celebration burst from two cannons angled inward at the lower corners
1314
+ * of the viewport.
1315
+ *
1316
+ * The geometry is the whole point. A single centred burst reads as a puff and
1317
+ * dies mid-screen; the crossfire covers the full width, which is what carries
1318
+ * the celebration. Launching from 0.7 rather than the centre reads as confetti
1319
+ * thrown upward instead of an explosion pushing outward.
1320
+ *
1321
+ * Resolves once the last particle has settled, so a caller can sequence on it.
1322
+ * Honours `prefers-reduced-motion`, in which case it resolves immediately
1323
+ * without drawing.
1324
+ */
1325
+ declare function fireConfetti({ particleCount, originY, colors, }?: FireConfettiOptions): Promise<void>;
1326
+ /**
1327
+ * Clears every burst still in flight and removes the canvas.
1328
+ *
1329
+ * For a caller that unmounts, or navigates away, while particles are airborne.
1330
+ */
1331
+ declare function resetConfetti(): void;
1332
+
1283
1333
  declare function Table({ className, containerClassName, ...props }: ComponentProps<'table'> & {
1284
1334
  /**
1285
1335
  * Classes for the scroll container that wraps the table. Defaults to
@@ -2248,4 +2298,4 @@ interface TCCEProviderProps {
2248
2298
  }
2249
2299
  declare function TCCEProvider({ children, permissions, toasterPosition, tooltipDelayDuration, }: TCCEProviderProps): react.JSX.Element;
2250
2300
 
2251
- export { type AbilityContextValue, AbilityProvider, type AbilityProviderProps, type AbilityStatus, Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, type AnimationTokens, AppShell, type AppShellItem, type AppShellProps, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, BottomNav, type BottomNavItem, BottomNavTabs, BottomNavTabsContent, type BottomNavTabsItem, BottomNavTabsList, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button$1 as Button, type CalendarEvent, type CalendarView, Can, CanNot, type CanNotProps, type CanProps, type CanState, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, type CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, type CellAlignment, Checkbox, ColorPicker, ColorPickerAlpha, type ColorPickerAlphaProps, ColorPickerEyeDropper, type ColorPickerEyeDropperProps, ColorPickerFormat, type ColorPickerFormatProps, ColorPickerHue, type ColorPickerHueProps, ColorPickerOutput, type ColorPickerOutputProps, ColorPickerPresets, type ColorPickerPresetsProps, type ColorPickerProps, ColorPickerSelection, type ColorPickerSelectionProps, type ColumnMeta, Combobox, type ComboboxMatchMode, type ComboboxOption, type ComboboxProps, DataTable, DataTableCardView, type DataTableCardViewProps, DataTableColumnFilter, type DataTableColumnFilterProps, DataTableFooter, type DataTableFooterProps, DataTableHeaderCell, type DataTableHeaderCellProps, type DataTableProps, DataTableRowActions, type DataTableRowActionsProps, DataTableSearch, type DataTableSearchProps, DataTableSkeleton, type DataTableSkeletonProps, DataTableToolbar, type DataTableToolbarProps, DatePicker, type DatePickerProps, type DatePickerRangeProps, type DatePickerSingleProps, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, type DrawerSide, type DrawerSize, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Dropzone, DropzoneContent, type DropzoneContentProps, DropzoneEmptyState, type DropzoneEmptyStateProps, type DropzoneProps, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, EventCalendar, type EventCalendarProps, type EventCreateRange, Field, FieldDescription, FieldError, FieldGroup, FieldLabel, FilterOption, type FilterOptionProps, Input, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Label, Link, Logo, type LogoKey, MiniCalendar, MiniCalendarDay, type MiniCalendarDayProps, MiniCalendarDays, type MiniCalendarDaysProps, MiniCalendarNavigation, type MiniCalendarNavigationProps, type MiniCalendarProps, Navbar, type NavbarDropdownItem, type NavbarNavLink, type NavbarNotification, type NavbarProps, type NavbarUtilityLink, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Permission, PhoneField, type PhoneFieldCountry, type PhoneFieldProps, PinInput, type PinInputProps, Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, type ProgressProps, RadioGroup, RadioGroupItem, type RowAction, SegmentedControl, SegmentedControlItem, type SegmentedControlProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger$1 as SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, type SortDirection, type SortRecord, Spinner, SpinnerDots, type SpinnerDotsProps, SpinnerLoader, type SpinnerLoaderProps, type SpinnerProps, Status, StatusIndicator, type StatusIndicatorProps, StatusLabel, type StatusLabelProps, type StatusProps, Switch, TCCEProvider, type TCCEProviderProps, TEXT_SIZES, TEXT_WEIGHTS, Table, TableBody, TableCaption, TableCell, type TableCellSize, type TableClassNames, type TableColumnDef, type TableContextType, TableFooter, TableHead, TableHeader, TablePagination, type TablePaginationProps, TableRow, type TableVariant, Tabs, TabsContent, TabsList, TabsTrigger, Text, type TextAs, type TextProps, type TextSize, type TextWeight, Textarea, type ToastAction, type ToastItem, type ToastType, Toaster, type ToasterPosition, type ToasterProps, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UseTableDataProps, type UseTableDataReturn, type UseTableFilteringProps, type UseTableFilteringReturn, type UseTableGlobalFilterProps, type UseTableGlobalFilterReturn, type UseTableSizingProps, type UseTableSizingReturn, type UseTableSortingProps, type UseTableSortingReturn, type UseTableVisibilityProps, type UseTableVisibilityReturn, alertVariants, animation, avatarVariants, badgeVariants, buttonVariants$1 as buttonVariants, columnFiltersToArrayQueryParams, columnFiltersToJsonString, columnFiltersToQueryParams, columnFiltersToRecord, createBackendParams, createBackendParamsWithFilters, duration, ease, fadeIn, getActiveFilterCount, getActiveFilterValues, getColumnValueCounts, getUniqueColumnValues, hasActiveFilters, linkVariants, logos, mergeFilters, multiSelectFilter, navigationMenuTriggerStyle, parseJsonToFilters, parseQueryParamsToFilters, progressIndicatorVariants, progressVariants, scaleIn, searchInArray, skeletonVariants, slideRight, slideUp, sortRecordToSortingState, sortingStateToJsonString, sortingStateToRecord, spinnerDotsVariants, spinnerLoaderVariants, spinnerVariants, spring, stagger, toggleVariants, tooltipContentVariants, transition, useAbility, useAbilityStatus, useAppForm, useCan, useCarousel, useColorPicker, useColumnFilter, useSidebar, useTableContext, useTableData, useTableFiltering, useTableGlobalFilter, useTableSizing, useTableSorting, useTableVisibility, useToast };
2301
+ export { type AbilityContextValue, AbilityProvider, type AbilityProviderProps, type AbilityStatus, Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, type AnimationTokens, AppShell, type AppShellItem, type AppShellProps, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, BottomNav, type BottomNavItem, BottomNavTabs, BottomNavTabsContent, type BottomNavTabsItem, BottomNavTabsList, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button$1 as Button, CONFETTI_COLORS, type CalendarEvent, type CalendarView, Can, CanNot, type CanNotProps, type CanProps, type CanState, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, type CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, type CellAlignment, Checkbox, ColorPicker, ColorPickerAlpha, type ColorPickerAlphaProps, ColorPickerEyeDropper, type ColorPickerEyeDropperProps, ColorPickerFormat, type ColorPickerFormatProps, ColorPickerHue, type ColorPickerHueProps, ColorPickerOutput, type ColorPickerOutputProps, ColorPickerPresets, type ColorPickerPresetsProps, type ColorPickerProps, ColorPickerSelection, type ColorPickerSelectionProps, type ColumnMeta, Combobox, type ComboboxMatchMode, type ComboboxOption, type ComboboxProps, DataTable, DataTableCardView, type DataTableCardViewProps, DataTableColumnFilter, type DataTableColumnFilterProps, DataTableFooter, type DataTableFooterProps, DataTableHeaderCell, type DataTableHeaderCellProps, type DataTableProps, DataTableRowActions, type DataTableRowActionsProps, DataTableSearch, type DataTableSearchProps, DataTableSkeleton, type DataTableSkeletonProps, DataTableToolbar, type DataTableToolbarProps, DatePicker, type DatePickerProps, type DatePickerRangeProps, type DatePickerSingleProps, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, type DrawerSide, type DrawerSize, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Dropzone, DropzoneContent, type DropzoneContentProps, DropzoneEmptyState, type DropzoneEmptyStateProps, type DropzoneProps, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, EventCalendar, type EventCalendarProps, type EventCreateRange, Field, FieldDescription, FieldError, FieldGroup, FieldLabel, FilterOption, type FilterOptionProps, type FireConfettiOptions, Input, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Label, Link, Logo, type LogoKey, MiniCalendar, MiniCalendarDay, type MiniCalendarDayProps, MiniCalendarDays, type MiniCalendarDaysProps, MiniCalendarNavigation, type MiniCalendarNavigationProps, type MiniCalendarProps, Navbar, type NavbarDropdownItem, type NavbarNavLink, type NavbarNotification, type NavbarProps, type NavbarUtilityLink, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Permission, PhoneField, type PhoneFieldCountry, type PhoneFieldProps, PhoneFieldValidity, PinInput, type PinInputProps, Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, type ProgressProps, RadioGroup, RadioGroupItem, type RowAction, SegmentedControl, SegmentedControlItem, type SegmentedControlProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger$1 as SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, type SortDirection, type SortRecord, Spinner, SpinnerDots, type SpinnerDotsProps, SpinnerLoader, type SpinnerLoaderProps, type SpinnerProps, Status, StatusIndicator, type StatusIndicatorProps, StatusLabel, type StatusLabelProps, type StatusProps, Switch, TCCEProvider, type TCCEProviderProps, TEXT_SIZES, TEXT_WEIGHTS, Table, TableBody, TableCaption, TableCell, type TableCellSize, type TableClassNames, type TableColumnDef, type TableContextType, TableFooter, TableHead, TableHeader, TablePagination, type TablePaginationProps, TableRow, type TableVariant, Tabs, TabsContent, TabsList, TabsTrigger, Text, type TextAs, type TextProps, type TextSize, type TextWeight, Textarea, type ToastAction, type ToastItem, type ToastType, Toaster, type ToasterPosition, type ToasterProps, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UseTableDataProps, type UseTableDataReturn, type UseTableFilteringProps, type UseTableFilteringReturn, type UseTableGlobalFilterProps, type UseTableGlobalFilterReturn, type UseTableSizingProps, type UseTableSizingReturn, type UseTableSortingProps, type UseTableSortingReturn, type UseTableVisibilityProps, type UseTableVisibilityReturn, alertVariants, animation, avatarVariants, badgeVariants, buttonVariants$1 as buttonVariants, columnFiltersToArrayQueryParams, columnFiltersToJsonString, columnFiltersToQueryParams, columnFiltersToRecord, createBackendParams, createBackendParamsWithFilters, duration, ease, fadeIn, fireConfetti, getActiveFilterCount, getActiveFilterValues, getColumnValueCounts, getUniqueColumnValues, hasActiveFilters, linkVariants, logos, mergeFilters, multiSelectFilter, navigationMenuTriggerStyle, parseJsonToFilters, parseQueryParamsToFilters, progressIndicatorVariants, progressVariants, resetConfetti, scaleIn, searchInArray, skeletonVariants, slideRight, slideUp, sortRecordToSortingState, sortingStateToJsonString, sortingStateToRecord, spinnerDotsVariants, spinnerLoaderVariants, spinnerVariants, spring, stagger, toggleVariants, tooltipContentVariants, transition, useAbility, useAbilityStatus, useAppForm, useCan, useCarousel, useColorPicker, useColumnFilter, useSidebar, useTableContext, useTableData, useTableFiltering, useTableGlobalFilter, useTableSizing, useTableSorting, useTableVisibility, useToast };
package/dist/main.js CHANGED
@@ -8,9 +8,9 @@ import { createContext, memo, useRef, useState, useMemo, useCallback, useEffect,
8
8
  import { Avatar as Avatar$1, Checkbox as Checkbox$1, Slot, Select as Select$1, Label as Label$1, Popover as Popover$1, Toggle as Toggle$1, ToggleGroup, Separator as Separator$1, Progress as Progress$1, Slider as Slider$1, Switch as Switch$1, Tabs as Tabs$1, Tooltip as Tooltip$1, Dialog as Dialog$1, AlertDialog as AlertDialog$1, Accordion as Accordion$1, DropdownMenu as DropdownMenu$1, RadioGroup as RadioGroup$1, NavigationMenu as NavigationMenu$1 } from 'radix-ui';
9
9
  import { isSameDay, isToday, format, addDays } from 'date-fns';
10
10
  import useEmblaCarousel from 'embla-carousel-react';
11
- import { parsePhoneNumberFromString, AsYouType } from 'libphonenumber-js';
11
+ import { isValidPhoneNumber, validatePhoneNumberLength, parsePhoneNumberFromString, AsYouType } from 'libphonenumber-js';
12
12
  import { Command } from 'cmdk';
13
- import { VE, UY, US, SV, PY, PT, PE, PA, NI, MX, IT, IN, HN, GT, GB, FR, ES, EC, DO, DE, CU, CR, CO, CL, CA, BR, BO, AR } from 'country-flag-icons/react/3x2';
13
+ import * as countryFlags from 'country-flag-icons/react/3x2';
14
14
  import { motion, AnimatePresence } from 'motion/react';
15
15
  import { useDropzone } from 'react-dropzone';
16
16
  import Color from 'color';
@@ -25,6 +25,7 @@ import { Temporal } from 'temporal-polyfill';
25
25
  import { useForm } from 'react-hook-form';
26
26
  export { Controller, useFieldArray } from 'react-hook-form';
27
27
  import { zodResolver } from '@hookform/resolvers/zod';
28
+ import confetti from 'canvas-confetti';
28
29
  import { flexRender, useReactTable, getFilteredRowModel, getSortedRowModel, getCoreRowModel } from '@tanstack/react-table';
29
30
  export { createColumnHelper } from '@tanstack/react-table';
30
31
 
@@ -1049,6 +1050,15 @@ function Link({
1049
1050
  }
1050
1051
  );
1051
1052
  }
1053
+ function validatePhone(value) {
1054
+ if (!value) {
1055
+ return { isValid: false };
1056
+ }
1057
+ if (isValidPhoneNumber(value)) {
1058
+ return { isValid: true };
1059
+ }
1060
+ return { isValid: false, problem: validatePhoneNumberLength(value) ?? "INVALID" };
1061
+ }
1052
1062
  function Popover({ ...props }) {
1053
1063
  return /* @__PURE__ */ jsx(Popover$1.Root, { "data-slot": "popover", ...props });
1054
1064
  }
@@ -1121,68 +1131,36 @@ function stripLeadingDialCode(raw, dialCode) {
1121
1131
  const code = dialCode.replace(/\D/g, "");
1122
1132
  return code && digits.startsWith(code) ? digits.length > code.length ? digits.slice(code.length) : "" : digits;
1123
1133
  }
1124
- var flagByCode = {
1125
- AR: AR,
1126
- BO: BO,
1127
- BR: BR,
1128
- CA: CA,
1129
- CL: CL,
1130
- CO: CO,
1131
- CR: CR,
1132
- CU: CU,
1133
- DE: DE,
1134
- DO: DO,
1135
- EC: EC,
1136
- ES: ES,
1137
- FR: FR,
1138
- GB: GB,
1139
- GT: GT,
1140
- HN: HN,
1141
- IN: IN,
1142
- IT: IT,
1143
- MX: MX,
1144
- NI: NI,
1145
- PA: PA,
1146
- PE: PE,
1147
- PT: PT,
1148
- PY: PY,
1149
- SV: SV,
1150
- US: US,
1151
- UY: UY,
1152
- VE: VE
1153
- };
1134
+ var flagByCode = countryFlags;
1154
1135
  function CountryFlag({
1155
1136
  code,
1156
1137
  flagUrl,
1157
1138
  className
1158
1139
  }) {
1159
- if (flagUrl) {
1160
- return /* @__PURE__ */ jsx(
1161
- "img",
1162
- {
1163
- src: flagUrl,
1164
- alt: "",
1165
- "aria-hidden": "true",
1166
- className: cn("size-4 shrink-0 rounded-[2px] object-cover", className)
1167
- }
1168
- );
1169
- }
1170
- const FlagComponent = flagByCode[(code || "").toUpperCase()];
1171
- if (FlagComponent) {
1172
- return /* @__PURE__ */ jsx(
1173
- FlagComponent,
1174
- {
1175
- "aria-hidden": "true",
1176
- className: cn("size-4 shrink-0 rounded-[2px]", className)
1177
- }
1178
- );
1179
- }
1180
- return /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn("bg-muted size-4 shrink-0 rounded-full", className) });
1140
+ const isoCode = (code || "").toUpperCase();
1141
+ const FlagComponent = flagByCode[isoCode];
1142
+ const flag = flagUrl ? /* @__PURE__ */ jsx("img", { src: flagUrl, alt: "", "aria-hidden": "true", className: "size-full object-cover" }) : FlagComponent ? /* @__PURE__ */ jsx(FlagComponent, { "aria-hidden": "true", className: "size-full" }) : null;
1143
+ return /* @__PURE__ */ jsx(
1144
+ "span",
1145
+ {
1146
+ "data-slot": "phone-field-country-flag",
1147
+ "data-country": isoCode || void 0,
1148
+ "data-fallback": flag ? void 0 : "true",
1149
+ "aria-hidden": "true",
1150
+ className: cn(
1151
+ "size-4 shrink-0 overflow-hidden rounded-[2px]",
1152
+ !flag && "bg-muted rounded-full",
1153
+ className
1154
+ ),
1155
+ children: flag
1156
+ }
1157
+ );
1181
1158
  }
1182
1159
  function PhoneField({
1183
1160
  countries,
1184
1161
  value,
1185
1162
  onValueChange,
1163
+ onValidityChange,
1186
1164
  defaultCountry,
1187
1165
  placeholder = "Phone number",
1188
1166
  disabled = false,
@@ -1199,6 +1177,7 @@ function PhoneField({
1199
1177
  const listRef = useRef(null);
1200
1178
  const inputRef = useRef(null);
1201
1179
  const caretRef = useRef(null);
1180
+ const lastValidityRef = useRef(null);
1202
1181
  const listId = `${useId()}-countries-list`;
1203
1182
  const isControlled = value !== void 0;
1204
1183
  const currentValue = isControlled ? value : internalValue;
@@ -1209,7 +1188,9 @@ function PhoneField({
1209
1188
  const callingCodeInList = parsedCallingCode !== void 0 && countries.some(
1210
1189
  (country) => country.dialCode.replace(/\D/g, "") === parsedCallingCode
1211
1190
  );
1212
- const representedCode = countryInList ? parsedCountry : callingCodeInList ? countries.find(
1191
+ const pickedCountry = pickedCode ? countries.find((country) => country.code.toUpperCase() === pickedCode.toUpperCase()) : void 0;
1192
+ const pickMatchesValue = pickedCountry !== void 0 && pickedCountry.dialCode.replace(/\D/g, "") === parsedCallingCode;
1193
+ const representedCode = countryInList ? parsedCountry : pickMatchesValue ? pickedCountry.code : callingCodeInList ? countries.find(
1213
1194
  (country) => country.dialCode.replace(/\D/g, "") === parsedCallingCode
1214
1195
  )?.code : void 0;
1215
1196
  const selectedCode = representedCode ?? pickedCode ?? defaultCountry ?? countries[0]?.code;
@@ -1224,6 +1205,15 @@ function PhoneField({
1224
1205
  nationalDigits
1225
1206
  ) : nationalDigits;
1226
1207
  const isInvalid = inputProps["aria-invalid"] === true || inputProps["aria-invalid"] === "true";
1208
+ const { isValid, problem } = validatePhone(currentValue);
1209
+ useEffect(() => {
1210
+ const last = lastValidityRef.current;
1211
+ if (last && last.isValid === isValid && last.problem === problem) {
1212
+ return;
1213
+ }
1214
+ lastValidityRef.current = { isValid, problem };
1215
+ onValidityChange?.({ isValid, problem });
1216
+ }, [isValid, problem, onValidityChange]);
1227
1217
  useLayoutEffect(() => {
1228
1218
  const input = inputRef.current;
1229
1219
  const caret = caretRef.current;
@@ -1316,17 +1306,21 @@ function PhoneField({
1316
1306
  }
1317
1307
  }
1318
1308
  }
1319
- if (nextPickedCode) {
1320
- setPickedCode(nextPickedCode);
1321
- }
1322
- if (!national) {
1323
- onValueChange?.("");
1324
- if (!isControlled) {
1325
- setInternalValue("");
1309
+ const next = national ? `+${emitCode}${national}` : "";
1310
+ const grew = national.replace(/\D/g, "").length > nationalDigits.length;
1311
+ const isPaste = nativeEvent?.inputType === "insertFromPaste";
1312
+ if (grew && !isPaste && validatePhoneNumberLength(next) === "TOO_LONG") {
1313
+ if (input) {
1314
+ const caret = Math.max(0, (input.selectionStart ?? inputValue.length) - 1);
1315
+ input.value = inputValue;
1316
+ input.setSelectionRange(caret, caret);
1326
1317
  }
1318
+ caretRef.current = null;
1327
1319
  return;
1328
1320
  }
1329
- const next = `+${emitCode}${national}`;
1321
+ if (nextPickedCode) {
1322
+ setPickedCode(nextPickedCode);
1323
+ }
1330
1324
  onValueChange?.(next);
1331
1325
  if (!isControlled) {
1332
1326
  setInternalValue(next);
@@ -7095,6 +7089,38 @@ var logos = {
7095
7089
  monochBlack: `${CDN_BASE}/logos/Logo_Total_monochB.webp`,
7096
7090
  monochOrange: `${CDN_BASE}/logos/Logo_Total_monochO.webp`
7097
7091
  };
7092
+ var CONFETTI_COLORS = [
7093
+ "#22205f",
7094
+ // --color-main-blue-primary
7095
+ "#f66a24",
7096
+ // --color-main-orange-primary
7097
+ "#faca4a",
7098
+ // --color-main-yellow-primary
7099
+ "#01d42f",
7100
+ // --color-main-positive-state
7101
+ "#d93235"
7102
+ // --color-main-warning-state
7103
+ ];
7104
+ function fireConfetti({
7105
+ particleCount = 60,
7106
+ originY = 0.7,
7107
+ colors = [...CONFETTI_COLORS]
7108
+ } = {}) {
7109
+ const shared = {
7110
+ particleCount,
7111
+ colors,
7112
+ spread: 70,
7113
+ startVelocity: 55,
7114
+ disableForReducedMotion: true
7115
+ };
7116
+ return Promise.all([
7117
+ confetti({ ...shared, angle: 60, origin: { x: 0, y: originY } }),
7118
+ confetti({ ...shared, angle: 120, origin: { x: 1, y: originY } })
7119
+ ]).then(() => void 0);
7120
+ }
7121
+ function resetConfetti() {
7122
+ confetti.reset();
7123
+ }
7098
7124
  function Table({
7099
7125
  className,
7100
7126
  containerClassName = "overflow-x-auto",
@@ -9374,6 +9400,6 @@ function TCCEProvider({
9374
9400
  return /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: tooltipDelayDuration, children: /* @__PURE__ */ jsx(AbilityProvider, { permissions, children: /* @__PURE__ */ jsx(Toaster, { position: toasterPosition, children }) }) });
9375
9401
  }
9376
9402
 
9377
- export { AbilityProvider, Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AppShell, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge2 as Badge, BottomNav, BottomNavTabs, BottomNavTabsContent, BottomNavTabsList, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Can, CanNot, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, ColorPicker, ColorPickerAlpha, ColorPickerEyeDropper, ColorPickerFormat, ColorPickerHue, ColorPickerOutput, ColorPickerPresets, ColorPickerSelection, Combobox, DataTable, DataTableCardView, DataTableColumnFilter, DataTableFooter, DataTableHeaderCell, DataTableRowActions, DataTableSearch, DataTableSkeleton, DataTableToolbar, DatePicker, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Dropzone, DropzoneContent, DropzoneEmptyState, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, EventCalendar, Field, FieldDescription, FieldError, FieldGroup, FieldLabel, FilterOption, Input, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, KNOWN_PERMISSIONS, Label, Link, Logo, MiniCalendar, MiniCalendarDay, MiniCalendarDays, MiniCalendarNavigation, Navbar, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PhoneField, PinInput, Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, SegmentedControl, SegmentedControlItem, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Spinner, SpinnerDots, SpinnerLoader, Status, StatusIndicator, StatusLabel, Switch, TCCEProvider, TEXT_SIZES, TEXT_WEIGHTS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TablePagination, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Text, Textarea, Toaster, Toggle, ToggleGroup2 as ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, alertVariants, animation, avatarVariants, badgeVariants2 as badgeVariants, buttonVariants, columnFiltersToArrayQueryParams, columnFiltersToJsonString, columnFiltersToQueryParams, columnFiltersToRecord, createBackendParams, createBackendParamsWithFilters, duration, ease, fadeIn, getActiveFilterCount, getActiveFilterValues, getColumnValueCounts, getUniqueColumnValues, hasActiveFilters, linkVariants, logos, matchPermission, mergeFilters, multiSelectFilter, navigationMenuTriggerStyle, parseJsonToFilters, parseQueryParamsToFilters, progressIndicatorVariants, progressVariants, scaleIn, searchInArray, skeletonVariants, slideRight, slideUp, sortRecordToSortingState, sortingStateToJsonString, sortingStateToRecord, spinnerDotsVariants, spinnerLoaderVariants, spinnerVariants, spring, stagger, toggleVariants, tooltipContentVariants, transition, useAbility, useAbilityStatus, useAppForm, useCan, useCarousel, useColorPicker, useColumnFilter, useSidebar, useTableContext, useTableData, useTableFiltering, useTableGlobalFilter, useTableSizing, useTableSorting, useTableVisibility, useToast };
9403
+ export { AbilityProvider, Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AppShell, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge2 as Badge, BottomNav, BottomNavTabs, BottomNavTabsContent, BottomNavTabsList, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, CONFETTI_COLORS, Can, CanNot, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, ColorPicker, ColorPickerAlpha, ColorPickerEyeDropper, ColorPickerFormat, ColorPickerHue, ColorPickerOutput, ColorPickerPresets, ColorPickerSelection, Combobox, DataTable, DataTableCardView, DataTableColumnFilter, DataTableFooter, DataTableHeaderCell, DataTableRowActions, DataTableSearch, DataTableSkeleton, DataTableToolbar, DatePicker, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Dropzone, DropzoneContent, DropzoneEmptyState, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, EventCalendar, Field, FieldDescription, FieldError, FieldGroup, FieldLabel, FilterOption, Input, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, KNOWN_PERMISSIONS, Label, Link, Logo, MiniCalendar, MiniCalendarDay, MiniCalendarDays, MiniCalendarNavigation, Navbar, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PhoneField, PinInput, Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, SegmentedControl, SegmentedControlItem, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Spinner, SpinnerDots, SpinnerLoader, Status, StatusIndicator, StatusLabel, Switch, TCCEProvider, TEXT_SIZES, TEXT_WEIGHTS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TablePagination, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Text, Textarea, Toaster, Toggle, ToggleGroup2 as ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, alertVariants, animation, avatarVariants, badgeVariants2 as badgeVariants, buttonVariants, columnFiltersToArrayQueryParams, columnFiltersToJsonString, columnFiltersToQueryParams, columnFiltersToRecord, createBackendParams, createBackendParamsWithFilters, duration, ease, fadeIn, fireConfetti, getActiveFilterCount, getActiveFilterValues, getColumnValueCounts, getUniqueColumnValues, hasActiveFilters, linkVariants, logos, matchPermission, mergeFilters, multiSelectFilter, navigationMenuTriggerStyle, parseJsonToFilters, parseQueryParamsToFilters, progressIndicatorVariants, progressVariants, resetConfetti, scaleIn, searchInArray, skeletonVariants, slideRight, slideUp, sortRecordToSortingState, sortingStateToJsonString, sortingStateToRecord, spinnerDotsVariants, spinnerLoaderVariants, spinnerVariants, spring, stagger, toggleVariants, tooltipContentVariants, transition, useAbility, useAbilityStatus, useAppForm, useCan, useCarousel, useColorPicker, useColumnFilter, useSidebar, useTableContext, useTableData, useTableFiltering, useTableGlobalFilter, useTableSizing, useTableSorting, useTableVisibility, useToast, validatePhone };
9378
9404
  //# sourceMappingURL=main.js.map
9379
9405
  //# sourceMappingURL=main.js.map