@aircall/ds 0.13.0 → 0.14.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/index.d.ts CHANGED
@@ -4,6 +4,7 @@ import { ClassValue } from "clsx";
4
4
  import * as react_jsx_runtime0 from "react/jsx-runtime";
5
5
  import { Button as Button$1 } from "@base-ui/react/button";
6
6
  import { VariantProps } from "class-variance-authority";
7
+ import "i18next";
7
8
  import { AlertDialog as AlertDialog$1 } from "@base-ui/react/alert-dialog";
8
9
  import { Avatar as Avatar$1 } from "@base-ui/react/avatar";
9
10
  import { useRender } from "@base-ui/react/use-render";
@@ -65,7 +66,7 @@ declare namespace AccordionContent {
65
66
  //#region src/components/button.d.ts
66
67
  declare const buttonVariants: (props?: ({
67
68
  variant?: "link" | "default" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
68
- size?: "default" | "icon" | "sm" | "lg" | "icon-sm" | "icon-lg" | null | undefined;
69
+ size?: "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg" | null | undefined;
69
70
  block?: boolean | null | undefined;
70
71
  } & class_variance_authority_types4.ClassProp) | undefined) => string;
71
72
  declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
@@ -112,9 +113,9 @@ interface ActionBarProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'chi
112
113
  onClear?: () => void;
113
114
  /** Action buttons rendered on the right of the bar — use `ActionBarButton`. */
114
115
  children?: React.ReactNode;
115
- /** Custom label renderer. Defaults to `${count} items selected.`. */
116
+ /** Custom label renderer. Defaults to the localized `actionBar.itemsSelected` string (`{{count}} items selected.`). */
116
117
  label?: (count: number) => React.ReactNode;
117
- /** Accessible label for the clear button. */
118
+ /** Accessible label for the clear button. Defaults to the localized `actionBar.clearSelection` string. */
118
119
  clearLabel?: string;
119
120
  }
120
121
  declare const ActionBar: React.ForwardRefExoticComponent<ActionBarProps & React.RefAttributes<HTMLDivElement>>;
@@ -1505,7 +1506,7 @@ declare namespace InputGroupTextarea {
1505
1506
  }
1506
1507
  //#endregion
1507
1508
  //#region src/components/input-otp.d.ts
1508
- declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "value" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
1509
+ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
1509
1510
  value?: string;
1510
1511
  onChange?: (newValue: string) => unknown;
1511
1512
  maxLength: number;
@@ -1520,7 +1521,7 @@ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHT
1520
1521
  children?: never;
1521
1522
  } & React.RefAttributes<HTMLInputElement> & {
1522
1523
  containerClassName?: string;
1523
- }, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "value" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
1524
+ }, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
1524
1525
  value?: string;
1525
1526
  onChange?: (newValue: string) => unknown;
1526
1527
  maxLength: number;
@@ -2278,6 +2279,66 @@ declare function TreeDragLine({
2278
2279
  ...props
2279
2280
  }: TreeDragLine.Props): react_jsx_runtime0.JSX.Element | null;
2280
2281
  //#endregion
2282
+ //#region src/components/ds-i18n-provider.d.ts
2283
+ /** Minimal shape of an i18next-like instance — structural to avoid coupling to a version. */
2284
+ interface I18nLanguageSource {
2285
+ language: string;
2286
+ on(event: 'languageChanged', cb: (lng: string) => void): void;
2287
+ off(event: 'languageChanged', cb: (lng: string) => void): void;
2288
+ }
2289
+ /**
2290
+ * Drives the language of the shared `dsI18n` singleton from React.
2291
+ *
2292
+ * PRODUCTION INVARIANT — mount EXACTLY ONE `DsI18nProvider` at the app root, as an
2293
+ * ancestor of all DS components. This is NOT a context provider: it mutates the single
2294
+ * shared `dsI18n` singleton inside an effect. Therefore NEVER nest two providers with
2295
+ * differing languages — they are competing singleton mutators, and because React runs
2296
+ * effects inside-out, the OUTERMOST provider's effect runs last and wins, silently
2297
+ * overriding the inner one. DS apps are single-locale, so one root provider is correct.
2298
+ *
2299
+ * Use either `DsI18nProvider` (React apps) OR `syncDsLanguage` (non-React startup) — not
2300
+ * both, for the same reason: each mutates the same singleton and they would compete.
2301
+ */
2302
+ declare function DsI18nProvider(componentProps: DsI18nProvider.Props): React.ReactNode;
2303
+ declare namespace DsI18nProvider {
2304
+ interface Props {
2305
+ /** Active language code (e.g. 'fr'). Falls back to navigator.language, then 'en'. */
2306
+ language?: string;
2307
+ children: React.ReactNode;
2308
+ }
2309
+ }
2310
+ /**
2311
+ * Escape hatch for non-React / global-instance startup (e.g. the browser extension).
2312
+ * Mirrors `instance`'s current language onto the ds instance and follows its changes.
2313
+ * Returns an unsubscribe function.
2314
+ *
2315
+ * PRODUCTION INVARIANT — call this OR mount `DsI18nProvider`, never both. Both mutate the
2316
+ * same `dsI18n` singleton, so running them together makes them compete (last writer wins).
2317
+ * Like the provider, the singleton is single-locale: drive it from exactly one source.
2318
+ */
2319
+ declare function syncDsLanguage(instance: I18nLanguageSource): () => void;
2320
+ //#endregion
2321
+ //#region src/i18n/instance.d.ts
2322
+ declare const SUPPORTED_LANGUAGES: readonly ["en", "fr", "es", "de", "it"];
2323
+ /** Resolve the initial language from the environment, falling back to English. */
2324
+ declare function detectInitialLanguage(): string;
2325
+ /** Register an additional namespace's resources into the shared instance (used by @aircall/blocks). */
2326
+ declare function registerI18nNamespace(ns: string, resources: Record<string, Record<string, string>>): void;
2327
+ //#endregion
2328
+ //#region src/i18n/use-ds-translation.d.ts
2329
+ /**
2330
+ * @internal
2331
+ * Reads translations from the shared ds instance and re-renders on language change.
2332
+ * Used by @aircall/ds and @aircall/blocks components only — not part of the consumer contract.
2333
+ */
2334
+ declare function useDsTranslation(ns: 'ds' | 'blocks'): (key: string, opts?: Record<string, unknown>) => string;
2335
+ //#endregion
2336
+ //#region src/i18n/keys.d.ts
2337
+ /** All translation keys owned by the `ds` namespace. Flat dotted keys (keySeparator: false). */
2338
+ type DsI18nKey = 'spinner.loading' | 'pagination.label' | 'pagination.previousPage' | 'pagination.nextPage' | 'dataTable.selectAllRows' | 'dataTable.selectRow' | 'tree.collapse' | 'tree.expand' | 'multiselect.remove' | 'multiselect.clearAll' | 'sidebar.toggle' | 'drawer.close' | 'emojiPicker.emoji' | 'emojiPicker.choose' | 'actionBar.selectionActions' | 'pagination.previous' | 'pagination.next' | 'actionBar.clearSelection' | 'actionBar.itemsSelected';
2339
+ /** A complete set of translations for one language. Missing a key is a compile error. */
2340
+ type DsLocale = Record<DsI18nKey, string>;
2341
+ //#endregion
2281
2342
  //#region src/hooks/use-audio-gauge.d.ts
2282
2343
  interface UseAudioGaugeOptions {
2283
2344
  /**
@@ -2336,4 +2397,4 @@ declare function useAudioGauge(options?: UseAudioGaugeOptions): UseAudioGaugeRes
2336
2397
  //#region src/lib/utils.d.ts
2337
2398
  declare function cn(...inputs: ClassValue[]): string;
2338
2399
  //#endregion
2339
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActionBar, ActionBarButton, ActionBarContext, type ActionBarContextValue, ActionBarHeight, Alert, AlertAction, AlertAction as BannerAction, AlertDescription, AlertDescription as BannerDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AlertTitle as BannerTitle, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, BadgeGroup, BadgeGroupCount, Banner, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, type CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, Chip, ChipRemove, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, type ComboboxClear, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CounterBadge, CountryFlag, DataTable, type DataTableLoadingState, DataTree, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerBackdrop, DrawerBar, DrawerClose, DrawerContent, DrawerCreateHandle, DrawerDescription, DrawerFooter, DrawerHeader, DrawerMenu, DrawerMenuCheckboxItem, DrawerMenuGroup, DrawerMenuGroupLabel, DrawerMenuItem, DrawerMenuRadioGroup, DrawerMenuRadioItem, DrawerMenuSeparator, DrawerMenuTrigger, DrawerPanel, DrawerPopup, DrawerPortal, DrawerPrimitive, DrawerSwipeArea, DrawerTitle, DrawerTrigger, DrawerViewport, DropdownMenu, DropdownMenuAddon, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Dropzone, DropzoneActions, DropzoneContent, DropzoneDescription, type DropzoneErrorCode, DropzoneIcon, DropzoneTitle, DropzoneTrigger, EmojiPicker, EmojiPickerCategories, type EmojiPickerCategory, EmojiPickerContent, EmojiPickerTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, FAB, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, type FileError, type FileRejection, Filter, FilterClearAllButton, FilterGroup, Gauge, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Label, List, ListCol, ListRow, type NotificationHandle, type NotificationOptions, type NotificationPriority, type NotificationQueueControls, NotificationQueueProvider, type NotificationRenderProps, NotificationSlot, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, RadioGroup, RadioGroupItem, ScrollArea, ScrollAreaPrimitive, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, type SheetOverlay, type SheetPortal, 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, type StepDefinition, Stepper, StepperContent, StepperCounter, StepperPanel, StepperProgress, Switch, Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeProvider, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Tree, TreeDragLine, TreeItem, TreeItemLabel, UseAudioGaugeOptions, UseAudioGaugeResult, alertVariants, bannerVariants, buttonGroupVariants, buttonVariants, cn, counterBadgeVariants, fabVariants, selectTriggerVariants, spinnerVariants, toast, toggleVariants, useAudioGauge, useComboboxAnchor, useNotification, useNotificationQueue, useSidebar, useStepper, useTheme };
2400
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActionBar, ActionBarButton, ActionBarContext, type ActionBarContextValue, ActionBarHeight, Alert, AlertAction, AlertAction as BannerAction, AlertDescription, AlertDescription as BannerDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AlertTitle as BannerTitle, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, BadgeGroup, BadgeGroupCount, Banner, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, type CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, Chip, ChipRemove, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, type ComboboxClear, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CounterBadge, CountryFlag, DataTable, type DataTableLoadingState, DataTree, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerBackdrop, DrawerBar, DrawerClose, DrawerContent, DrawerCreateHandle, DrawerDescription, DrawerFooter, DrawerHeader, DrawerMenu, DrawerMenuCheckboxItem, DrawerMenuGroup, DrawerMenuGroupLabel, DrawerMenuItem, DrawerMenuRadioGroup, DrawerMenuRadioItem, DrawerMenuSeparator, DrawerMenuTrigger, DrawerPanel, DrawerPopup, DrawerPortal, DrawerPrimitive, DrawerSwipeArea, DrawerTitle, DrawerTrigger, DrawerViewport, DropdownMenu, DropdownMenuAddon, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Dropzone, DropzoneActions, DropzoneContent, DropzoneDescription, type DropzoneErrorCode, DropzoneIcon, DropzoneTitle, DropzoneTrigger, type DsI18nKey, DsI18nProvider, type DsLocale, EmojiPicker, EmojiPickerCategories, type EmojiPickerCategory, EmojiPickerContent, EmojiPickerTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, FAB, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, type FileError, type FileRejection, Filter, FilterClearAllButton, FilterGroup, Gauge, type I18nLanguageSource, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Label, List, ListCol, ListRow, type NotificationHandle, type NotificationOptions, type NotificationPriority, type NotificationQueueControls, NotificationQueueProvider, type NotificationRenderProps, NotificationSlot, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, RadioGroup, RadioGroupItem, SUPPORTED_LANGUAGES, ScrollArea, ScrollAreaPrimitive, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, type SheetOverlay, type SheetPortal, 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, type StepDefinition, Stepper, StepperContent, StepperCounter, StepperPanel, StepperProgress, Switch, Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeProvider, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Tree, TreeDragLine, TreeItem, TreeItemLabel, UseAudioGaugeOptions, UseAudioGaugeResult, alertVariants, bannerVariants, buttonGroupVariants, buttonVariants, cn, counterBadgeVariants, detectInitialLanguage, fabVariants, registerI18nNamespace, selectTriggerVariants, spinnerVariants, syncDsLanguage, toast, toggleVariants, useAudioGauge, useComboboxAnchor, useDsTranslation, useNotification, useNotificationQueue, useSidebar, useStepper, useTheme };