@bizapps/ui 1.5.0 → 1.6.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';
@@ -14,6 +16,8 @@ export { Controller, useFieldArray } from 'react-hook-form';
14
16
  import { ZodType, z } from 'zod';
15
17
  import { ColumnDef, SortingState, ColumnFiltersState, Row, RowSelectionState, Table as Table$1, VisibilityState, ColumnSizingState, Header, Updater, Column } from '@tanstack/react-table';
16
18
  export { Column, ColumnDef, ColumnFiltersState, Row, SortingState, Table as TanStackTableType, createColumnHelper } from '@tanstack/react-table';
19
+ import { P as Permission } from './policy-DPpMNLiO.cjs';
20
+ export { K as KNOWN_PERMISSIONS, a as KnownPermission, m as matchPermission } from './policy-DPpMNLiO.cjs';
17
21
 
18
22
  declare const alertVariants: (props?: ({
19
23
  variant?: "default" | "info" | "success" | "warning" | "error" | null | undefined;
@@ -239,6 +243,15 @@ interface PhoneFieldProps extends Omit<ComponentProps<'input'>, 'value' | 'defau
239
243
  value?: string;
240
244
  /** Emits the E.164 form whenever the national number changes; emits "" when empty. */
241
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;
242
255
  /** ISO code preselected when `value` is empty, e.g. "CO". Falls back to the first country. */
243
256
  defaultCountry?: string;
244
257
  /** Placeholder for the number input. */
@@ -256,7 +269,7 @@ interface PhoneFieldProps extends Omit<ComponentProps<'input'>, 'value' | 'defau
256
269
  */
257
270
  name?: string;
258
271
  }
259
- 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;
260
273
 
261
274
  interface PinInputProps {
262
275
  length?: number;
@@ -2071,32 +2084,6 @@ interface UseTableSizingReturn {
2071
2084
  */
2072
2085
  declare function useTableSizing({ columnSizing: controlledSizing, defaultColumnSizing, onColumnSizingChange, }: UseTableSizingProps): UseTableSizingReturn;
2073
2086
 
2074
- /**
2075
- * AUTO-GENERATED — do not edit by hand.
2076
- *
2077
- * Regenerate with `pnpm generate-permissions`, which reads the catalog from the
2078
- * Nexus backend. The list is committed so the library build never depends on a
2079
- * live backend call.
2080
- *
2081
- * While this list is empty, `Permission` degrades to plain `string` and the
2082
- * development-time unknown-permission warning is skipped entirely — an empty
2083
- * catalog must never produce false positives.
2084
- */
2085
- declare const KNOWN_PERMISSIONS: readonly [];
2086
- type KnownPermission = (typeof KNOWN_PERMISSIONS)[number];
2087
-
2088
- /**
2089
- * A permission string in `resource.action` or `module.resource.action`
2090
- * dot-notation, lowercase, with `*` as a segment wildcard and a bare `*` as the
2091
- * super-grant.
2092
- *
2093
- * Known catalog entries are suggested by autocomplete; any other string is still
2094
- * accepted, so a permission the catalog has not caught up with never blocks a
2095
- * build. The `(string & {})` half is the TypeScript idiom that keeps the literal
2096
- * suggestions from collapsing into plain `string`.
2097
- */
2098
- type Permission = KnownPermission | (string & {});
2099
-
2100
2087
  /** `'loading'` while the grant set is unresolved, `'ready'` once it is known. */
2101
2088
  type AbilityStatus = 'loading' | 'ready';
2102
2089
  interface AbilityContextValue {
@@ -2115,11 +2102,6 @@ interface AbilityProviderProps {
2115
2102
  children: ReactNode;
2116
2103
  permissions?: string[];
2117
2104
  }
2118
- /**
2119
- * @param pattern - an entry from the user's grant set (may contain `*` as a segment wildcard)
2120
- * @param permission - the permission being requested (from `Can.perform`)
2121
- */
2122
- declare function matchPermission(pattern: string, permission: string): boolean;
2123
2105
  declare function AbilityProvider({ children, permissions }: AbilityProviderProps): react.JSX.Element;
2124
2106
  declare function useAbility(): AbilityContextValue;
2125
2107
  declare function useCan(permissions: Permission | Permission[], mode?: 'any' | 'all'): boolean;
@@ -2277,4 +2259,4 @@ interface TCCEProviderProps {
2277
2259
  }
2278
2260
  declare function TCCEProvider({ children, permissions, toasterPosition, tooltipDelayDuration, }: TCCEProviderProps): react.JSX.Element;
2279
2261
 
2280
- 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, KNOWN_PERMISSIONS, type KnownPermission, 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, type 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, 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 };
2262
+ 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, 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, 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 };
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';
@@ -14,6 +16,8 @@ export { Controller, useFieldArray } from 'react-hook-form';
14
16
  import { ZodType, z } from 'zod';
15
17
  import { ColumnDef, SortingState, ColumnFiltersState, Row, RowSelectionState, Table as Table$1, VisibilityState, ColumnSizingState, Header, Updater, Column } from '@tanstack/react-table';
16
18
  export { Column, ColumnDef, ColumnFiltersState, Row, SortingState, Table as TanStackTableType, createColumnHelper } from '@tanstack/react-table';
19
+ import { P as Permission } from './policy-DPpMNLiO.js';
20
+ export { K as KNOWN_PERMISSIONS, a as KnownPermission, m as matchPermission } from './policy-DPpMNLiO.js';
17
21
 
18
22
  declare const alertVariants: (props?: ({
19
23
  variant?: "default" | "info" | "success" | "warning" | "error" | null | undefined;
@@ -239,6 +243,15 @@ interface PhoneFieldProps extends Omit<ComponentProps<'input'>, 'value' | 'defau
239
243
  value?: string;
240
244
  /** Emits the E.164 form whenever the national number changes; emits "" when empty. */
241
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;
242
255
  /** ISO code preselected when `value` is empty, e.g. "CO". Falls back to the first country. */
243
256
  defaultCountry?: string;
244
257
  /** Placeholder for the number input. */
@@ -256,7 +269,7 @@ interface PhoneFieldProps extends Omit<ComponentProps<'input'>, 'value' | 'defau
256
269
  */
257
270
  name?: string;
258
271
  }
259
- 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;
260
273
 
261
274
  interface PinInputProps {
262
275
  length?: number;
@@ -2071,32 +2084,6 @@ interface UseTableSizingReturn {
2071
2084
  */
2072
2085
  declare function useTableSizing({ columnSizing: controlledSizing, defaultColumnSizing, onColumnSizingChange, }: UseTableSizingProps): UseTableSizingReturn;
2073
2086
 
2074
- /**
2075
- * AUTO-GENERATED — do not edit by hand.
2076
- *
2077
- * Regenerate with `pnpm generate-permissions`, which reads the catalog from the
2078
- * Nexus backend. The list is committed so the library build never depends on a
2079
- * live backend call.
2080
- *
2081
- * While this list is empty, `Permission` degrades to plain `string` and the
2082
- * development-time unknown-permission warning is skipped entirely — an empty
2083
- * catalog must never produce false positives.
2084
- */
2085
- declare const KNOWN_PERMISSIONS: readonly [];
2086
- type KnownPermission = (typeof KNOWN_PERMISSIONS)[number];
2087
-
2088
- /**
2089
- * A permission string in `resource.action` or `module.resource.action`
2090
- * dot-notation, lowercase, with `*` as a segment wildcard and a bare `*` as the
2091
- * super-grant.
2092
- *
2093
- * Known catalog entries are suggested by autocomplete; any other string is still
2094
- * accepted, so a permission the catalog has not caught up with never blocks a
2095
- * build. The `(string & {})` half is the TypeScript idiom that keeps the literal
2096
- * suggestions from collapsing into plain `string`.
2097
- */
2098
- type Permission = KnownPermission | (string & {});
2099
-
2100
2087
  /** `'loading'` while the grant set is unresolved, `'ready'` once it is known. */
2101
2088
  type AbilityStatus = 'loading' | 'ready';
2102
2089
  interface AbilityContextValue {
@@ -2115,11 +2102,6 @@ interface AbilityProviderProps {
2115
2102
  children: ReactNode;
2116
2103
  permissions?: string[];
2117
2104
  }
2118
- /**
2119
- * @param pattern - an entry from the user's grant set (may contain `*` as a segment wildcard)
2120
- * @param permission - the permission being requested (from `Can.perform`)
2121
- */
2122
- declare function matchPermission(pattern: string, permission: string): boolean;
2123
2105
  declare function AbilityProvider({ children, permissions }: AbilityProviderProps): react.JSX.Element;
2124
2106
  declare function useAbility(): AbilityContextValue;
2125
2107
  declare function useCan(permissions: Permission | Permission[], mode?: 'any' | 'all'): boolean;
@@ -2277,4 +2259,4 @@ interface TCCEProviderProps {
2277
2259
  }
2278
2260
  declare function TCCEProvider({ children, permissions, toasterPosition, tooltipDelayDuration, }: TCCEProviderProps): react.JSX.Element;
2279
2261
 
2280
- 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, KNOWN_PERMISSIONS, type KnownPermission, 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, type 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, 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 };
2262
+ 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, 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, 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 };
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';
@@ -1049,6 +1049,15 @@ function Link({
1049
1049
  }
1050
1050
  );
1051
1051
  }
1052
+ function validatePhone(value) {
1053
+ if (!value) {
1054
+ return { isValid: false };
1055
+ }
1056
+ if (isValidPhoneNumber(value)) {
1057
+ return { isValid: true };
1058
+ }
1059
+ return { isValid: false, problem: validatePhoneNumberLength(value) ?? "INVALID" };
1060
+ }
1052
1061
  function Popover({ ...props }) {
1053
1062
  return /* @__PURE__ */ jsx(Popover$1.Root, { "data-slot": "popover", ...props });
1054
1063
  }
@@ -1121,68 +1130,36 @@ function stripLeadingDialCode(raw, dialCode) {
1121
1130
  const code = dialCode.replace(/\D/g, "");
1122
1131
  return code && digits.startsWith(code) ? digits.length > code.length ? digits.slice(code.length) : "" : digits;
1123
1132
  }
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
- };
1133
+ var flagByCode = countryFlags;
1154
1134
  function CountryFlag({
1155
1135
  code,
1156
1136
  flagUrl,
1157
1137
  className
1158
1138
  }) {
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) });
1139
+ const isoCode = (code || "").toUpperCase();
1140
+ const FlagComponent = flagByCode[isoCode];
1141
+ 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;
1142
+ return /* @__PURE__ */ jsx(
1143
+ "span",
1144
+ {
1145
+ "data-slot": "phone-field-country-flag",
1146
+ "data-country": isoCode || void 0,
1147
+ "data-fallback": flag ? void 0 : "true",
1148
+ "aria-hidden": "true",
1149
+ className: cn(
1150
+ "size-4 shrink-0 overflow-hidden rounded-[2px]",
1151
+ !flag && "bg-muted rounded-full",
1152
+ className
1153
+ ),
1154
+ children: flag
1155
+ }
1156
+ );
1181
1157
  }
1182
1158
  function PhoneField({
1183
1159
  countries,
1184
1160
  value,
1185
1161
  onValueChange,
1162
+ onValidityChange,
1186
1163
  defaultCountry,
1187
1164
  placeholder = "Phone number",
1188
1165
  disabled = false,
@@ -1199,6 +1176,7 @@ function PhoneField({
1199
1176
  const listRef = useRef(null);
1200
1177
  const inputRef = useRef(null);
1201
1178
  const caretRef = useRef(null);
1179
+ const lastValidityRef = useRef(null);
1202
1180
  const listId = `${useId()}-countries-list`;
1203
1181
  const isControlled = value !== void 0;
1204
1182
  const currentValue = isControlled ? value : internalValue;
@@ -1209,7 +1187,9 @@ function PhoneField({
1209
1187
  const callingCodeInList = parsedCallingCode !== void 0 && countries.some(
1210
1188
  (country) => country.dialCode.replace(/\D/g, "") === parsedCallingCode
1211
1189
  );
1212
- const representedCode = countryInList ? parsedCountry : callingCodeInList ? countries.find(
1190
+ const pickedCountry = pickedCode ? countries.find((country) => country.code.toUpperCase() === pickedCode.toUpperCase()) : void 0;
1191
+ const pickMatchesValue = pickedCountry !== void 0 && pickedCountry.dialCode.replace(/\D/g, "") === parsedCallingCode;
1192
+ const representedCode = countryInList ? parsedCountry : pickMatchesValue ? pickedCountry.code : callingCodeInList ? countries.find(
1213
1193
  (country) => country.dialCode.replace(/\D/g, "") === parsedCallingCode
1214
1194
  )?.code : void 0;
1215
1195
  const selectedCode = representedCode ?? pickedCode ?? defaultCountry ?? countries[0]?.code;
@@ -1224,6 +1204,15 @@ function PhoneField({
1224
1204
  nationalDigits
1225
1205
  ) : nationalDigits;
1226
1206
  const isInvalid = inputProps["aria-invalid"] === true || inputProps["aria-invalid"] === "true";
1207
+ const { isValid, problem } = validatePhone(currentValue);
1208
+ useEffect(() => {
1209
+ const last = lastValidityRef.current;
1210
+ if (last && last.isValid === isValid && last.problem === problem) {
1211
+ return;
1212
+ }
1213
+ lastValidityRef.current = { isValid, problem };
1214
+ onValidityChange?.({ isValid, problem });
1215
+ }, [isValid, problem, onValidityChange]);
1227
1216
  useLayoutEffect(() => {
1228
1217
  const input = inputRef.current;
1229
1218
  const caret = caretRef.current;
@@ -1316,17 +1305,21 @@ function PhoneField({
1316
1305
  }
1317
1306
  }
1318
1307
  }
1319
- if (nextPickedCode) {
1320
- setPickedCode(nextPickedCode);
1321
- }
1322
- if (!national) {
1323
- onValueChange?.("");
1324
- if (!isControlled) {
1325
- setInternalValue("");
1308
+ const next = national ? `+${emitCode}${national}` : "";
1309
+ const grew = national.replace(/\D/g, "").length > nationalDigits.length;
1310
+ const isPaste = nativeEvent?.inputType === "insertFromPaste";
1311
+ if (grew && !isPaste && validatePhoneNumberLength(next) === "TOO_LONG") {
1312
+ if (input) {
1313
+ const caret = Math.max(0, (input.selectionStart ?? inputValue.length) - 1);
1314
+ input.value = inputValue;
1315
+ input.setSelectionRange(caret, caret);
1326
1316
  }
1317
+ caretRef.current = null;
1327
1318
  return;
1328
1319
  }
1329
- const next = `+${emitCode}${national}`;
1320
+ if (nextPickedCode) {
1321
+ setPickedCode(nextPickedCode);
1322
+ }
1330
1323
  onValueChange?.(next);
1331
1324
  if (!isControlled) {
1332
1325
  setInternalValue(next);
@@ -5117,6 +5110,8 @@ function NavigationMenuIndicator({
5117
5110
  }
5118
5111
  );
5119
5112
  }
5113
+
5114
+ // src/components/authorization/policy.ts
5120
5115
  function matchPermission(pattern, permission) {
5121
5116
  if (pattern === "*") return true;
5122
5117
  if (pattern === permission) return true;
@@ -5132,6 +5127,15 @@ function matchesAny(permissionSet, permission) {
5132
5127
  }
5133
5128
  return false;
5134
5129
  }
5130
+ function can(permissionSet, perms, mode = "any") {
5131
+ const list = Array.isArray(perms) ? perms : [perms];
5132
+ if (list.length === 0) return false;
5133
+ if (permissionSet.has("*")) return true;
5134
+ if (mode === "all") {
5135
+ return list.every((p) => matchesAny(permissionSet, p));
5136
+ }
5137
+ return list.some((p) => matchesAny(permissionSet, p));
5138
+ }
5135
5139
  var AbilityContext = createContext(void 0);
5136
5140
  AbilityContext.displayName = "AbilityContext";
5137
5141
  function AbilityProvider({ children, permissions }) {
@@ -5140,16 +5144,8 @@ function AbilityProvider({ children, permissions }) {
5140
5144
  );
5141
5145
  const [imperativelyResolved, setImperativelyResolved] = useState(false);
5142
5146
  const status = permissions !== void 0 || imperativelyResolved ? "ready" : "loading";
5143
- const can = useCallback(
5144
- (perms, mode = "any") => {
5145
- const list = Array.isArray(perms) ? perms : [perms];
5146
- if (list.length === 0) return false;
5147
- if (permissionSet.has("*")) return true;
5148
- if (mode === "all") {
5149
- return list.every((p) => matchesAny(permissionSet, p));
5150
- }
5151
- return list.some((p) => matchesAny(permissionSet, p));
5152
- },
5147
+ const can2 = useCallback(
5148
+ (perms, mode = "any") => can(permissionSet, perms, mode),
5153
5149
  [permissionSet]
5154
5150
  );
5155
5151
  const setAbilities = useCallback((perms) => {
@@ -5169,8 +5165,8 @@ function AbilityProvider({ children, permissions }) {
5169
5165
  setPermissionSet(new Set(permissions));
5170
5166
  }, [permissionKey, permissions]);
5171
5167
  const value = useMemo(
5172
- () => ({ can, setAbilities, clearAbilities, status }),
5173
- [can, setAbilities, clearAbilities, status]
5168
+ () => ({ can: can2, setAbilities, clearAbilities, status }),
5169
+ [can2, setAbilities, clearAbilities, status]
5174
5170
  );
5175
5171
  return /* @__PURE__ */ jsx(AbilityContext.Provider, { value, children });
5176
5172
  }
@@ -5182,8 +5178,8 @@ function useAbility() {
5182
5178
  return context;
5183
5179
  }
5184
5180
  function useCan(permissions, mode = "any") {
5185
- const { can } = useAbility();
5186
- return can(permissions, mode);
5181
+ const { can: can2 } = useAbility();
5182
+ return can2(permissions, mode);
5187
5183
  }
5188
5184
  function useAbilityStatus() {
5189
5185
  return useAbility().status;
@@ -5290,8 +5286,8 @@ function Can({
5290
5286
  children
5291
5287
  }) {
5292
5288
  warnUnknownPermission(permission);
5293
- const { can, status } = useAbility();
5294
- const hasPermission = status === "ready" && can(permission, mode);
5289
+ const { can: can2, status } = useAbility();
5290
+ const hasPermission = status === "ready" && can2(permission, mode);
5295
5291
  const show = negate ? !hasPermission : hasPermission;
5296
5292
  if (typeof children === "function") {
5297
5293
  warnRenderPropVoidsProps([
@@ -9371,6 +9367,6 @@ function TCCEProvider({
9371
9367
  return /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: tooltipDelayDuration, children: /* @__PURE__ */ jsx(AbilityProvider, { permissions, children: /* @__PURE__ */ jsx(Toaster, { position: toasterPosition, children }) }) });
9372
9368
  }
9373
9369
 
9374
- 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 };
9370
+ 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, validatePhone };
9375
9371
  //# sourceMappingURL=main.js.map
9376
9372
  //# sourceMappingURL=main.js.map