@aircall/ds 0.2.3 → 0.2.6

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.js CHANGED
@@ -22,9 +22,10 @@ import * as PopoverPrimitive from "@radix-ui/react-popover";
22
22
  import { ThemeProvider as ThemeProvider$1, useTheme, useTheme as useTheme$1 } from "next-themes";
23
23
  import * as TooltipPrimitive from "@radix-ui/react-tooltip";
24
24
  import * as LabelPrimitive from "@radix-ui/react-label";
25
+ import { OTPInput, OTPInputContext } from "input-otp";
26
+ import { CircleIcon, Loader2Icon, MinusIcon, OctagonXIcon, PanelLeftIcon, TriangleAlertIcon } from "lucide-react";
25
27
  import * as ProgressPrimitive from "@radix-ui/react-progress";
26
28
  import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
27
- import { CircleIcon, Loader2Icon, OctagonXIcon, PanelLeftIcon, TriangleAlertIcon } from "lucide-react";
28
29
  import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
29
30
  import * as SelectPrimitive from "@radix-ui/react-select";
30
31
  import * as SliderPrimitive from "@radix-ui/react-slider";
@@ -635,66 +636,6 @@ function capitalizeFirstLetter(val) {
635
636
  return String(val).charAt(0).toUpperCase() + String(val).slice(1);
636
637
  }
637
638
 
638
- //#endregion
639
- //#region src/components/dock.tsx
640
- const Dock = React$1.forwardRef(({ items, activeItem, onItemClick, variant = "default", size = "md", orientation = "horizontal", className, ...props }, ref) => {
641
- const isHorizontal = orientation === "horizontal";
642
- const dockVariants = {
643
- default: "bg-background/70 backdrop-blur-xl border border-border/20 shadow-2xl",
644
- floating: "bg-background/80 backdrop-blur-xl border border-border/10 shadow-2xl rounded-xl",
645
- minimal: "bg-transparent"
646
- };
647
- const sizeClasses = {
648
- sm: isHorizontal ? "h-14 px-3" : "w-14 py-3",
649
- md: isHorizontal ? "h-16 px-4" : "w-16 py-4",
650
- lg: isHorizontal ? "h-18 px-5" : "w-18 py-5"
651
- };
652
- const itemSizeClasses = {
653
- sm: "p-2.5 min-w-[48px] min-h-[48px]",
654
- md: "p-3 min-w-[56px] min-h-[56px]",
655
- lg: "p-4 min-w-[64px] min-h-[64px]"
656
- };
657
- const handleItemClick = (item) => {
658
- if (item.disabled) return;
659
- if (item.onClick) item.onClick();
660
- if (onItemClick) onItemClick(item.id, item);
661
- };
662
- return /* @__PURE__ */ jsx("div", {
663
- ref,
664
- className: cn("flex items-center justify-center", dockVariants[variant], sizeClasses[size], isHorizontal ? "flex-row gap-1.5" : "flex-col gap-1.5", className),
665
- ...props,
666
- children: items.map((item) => {
667
- const isActive = activeItem === item.id || item.isActive;
668
- return /* @__PURE__ */ jsxs("button", {
669
- onClick: () => handleItemClick(item),
670
- disabled: item.disabled,
671
- className: cn("relative flex flex-col items-center justify-center", "transition-all duration-300 ease-out", "rounded-lg group", itemSizeClasses[size], "hover:bg-accent/60 hover:text-accent-foreground", "focus:outline-none focus:ring-2 focus:ring-ring/50 focus:ring-offset-1", "disabled:opacity-40 disabled:cursor-not-allowed", "active:scale-95", isActive && [
672
- "bg-primary/90 text-primary-foreground",
673
- "hover:bg-primary hover:text-primary-foreground",
674
- "shadow-lg scale-105"
675
- ], !isActive && ["text-muted-foreground/80", "hover:text-foreground hover:scale-105"]),
676
- title: item.label,
677
- children: [
678
- item.icon && /* @__PURE__ */ jsx("div", {
679
- className: cn("transition-all duration-300 ease-out", "group-hover:scale-110 group-hover:-translate-y-0.5", isActive && "scale-110 -translate-y-0.5", size === "sm" ? "mb-1" : "mb-1.5"),
680
- children: item.icon
681
- }),
682
- /* @__PURE__ */ jsx("span", {
683
- className: cn("font-medium transition-all duration-300 ease-out", "group-hover:opacity-100", size === "sm" ? "text-xs" : size === "md" ? "text-xs" : "text-sm", isHorizontal && size === "sm" && "sr-only", isActive ? "opacity-100" : "opacity-80"),
684
- children: item.label
685
- }),
686
- item.badge !== void 0 && item.badge > 0 && /* @__PURE__ */ jsx("div", {
687
- className: cn("absolute -top-1.5 -right-1.5", "flex items-center justify-center", "min-w-5 h-5 px-1.5", "bg-destructive text-destructive-foreground text-xs font-semibold", "rounded-full border-2 border-background/80 backdrop-blur-sm", "shadow-lg animate-pulse", "transition-transform duration-200 ease-out", "group-hover:scale-110"),
688
- children: item.badge > 99 ? "99+" : item.badge
689
- }),
690
- isActive && /* @__PURE__ */ jsx("div", { className: cn("absolute", isHorizontal ? "-bottom-2 left-1/2 -translate-x-1/2 w-8 h-1" : "-right-2 top-1/2 -translate-y-1/2 h-8 w-1", "bg-primary rounded-full shadow-sm", "animate-in fade-in-0 slide-in-from-bottom-2 duration-300") })
691
- ]
692
- }, item.id);
693
- })
694
- });
695
- });
696
- Dock.displayName = "Dock";
697
-
698
639
  //#endregion
699
640
  //#region src/components/drawer.tsx
700
641
  function Drawer({ ...props }) {
@@ -1314,6 +1255,53 @@ function InputGroupTextarea({ className, ...props }) {
1314
1255
  });
1315
1256
  }
1316
1257
 
1258
+ //#endregion
1259
+ //#region src/components/input-otp.tsx
1260
+ const inputOTPVariants = cva("", {
1261
+ variants: { sizing: {
1262
+ default: "**:data-[slot=input-otp-slot]:h-9 **:data-[slot=input-otp-slot]:w-9",
1263
+ sm: "**:data-[slot=input-otp-slot]:h-8 **:data-[slot=input-otp-slot]:w-8",
1264
+ lg: "**:data-[slot=input-otp-slot]:h-12 **:data-[slot=input-otp-slot]:w-12"
1265
+ } },
1266
+ defaultVariants: { sizing: "default" }
1267
+ });
1268
+ function InputOTP({ className, containerClassName, sizing, ...props }) {
1269
+ return /* @__PURE__ */ jsx(OTPInput, {
1270
+ "data-slot": "input-otp",
1271
+ containerClassName: cn("flex items-center gap-2 has-disabled:opacity-50", inputOTPVariants({ sizing }), containerClassName),
1272
+ className: cn("disabled:cursor-not-allowed", className),
1273
+ ...props
1274
+ });
1275
+ }
1276
+ function InputOTPGroup({ className, ...props }) {
1277
+ return /* @__PURE__ */ jsx("div", {
1278
+ "data-slot": "input-otp-group",
1279
+ className: cn("flex items-center", className),
1280
+ ...props
1281
+ });
1282
+ }
1283
+ function InputOTPSlot({ index, className, ...props }) {
1284
+ const { char, hasFakeCaret, isActive } = React$1.useContext(OTPInputContext)?.slots[index] ?? {};
1285
+ return /* @__PURE__ */ jsxs("div", {
1286
+ "data-slot": "input-otp-slot",
1287
+ "data-active": isActive,
1288
+ className: cn("data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]", className),
1289
+ ...props,
1290
+ children: [char, hasFakeCaret && /* @__PURE__ */ jsx("div", {
1291
+ className: "pointer-events-none absolute inset-0 flex items-center justify-center",
1292
+ children: /* @__PURE__ */ jsx("div", { className: "animate-caret-blink bg-foreground h-4 w-px duration-1000" })
1293
+ })]
1294
+ });
1295
+ }
1296
+ function InputOTPSeparator({ ...props }) {
1297
+ return /* @__PURE__ */ jsx("div", {
1298
+ "data-slot": "input-otp-separator",
1299
+ role: "separator",
1300
+ ...props,
1301
+ children: /* @__PURE__ */ jsx(MinusIcon, {})
1302
+ });
1303
+ }
1304
+
1317
1305
  //#endregion
1318
1306
  //#region src/components/item.tsx
1319
1307
  const ItemGroup = React$1.forwardRef(({ className, stackedItems = false, ...props }, ref) => {
@@ -2010,10 +1998,11 @@ const sidebarMenuButtonVariants = cva("peer/menu-button flex w-full items-center
2010
1998
  size: "default"
2011
1999
  }
2012
2000
  });
2013
- function SidebarMenuButton({ asChild = false, isActive = false, variant = "default", size = "default", tooltip, className, ...props }) {
2001
+ const SidebarMenuButton = React$1.forwardRef(({ asChild = false, isActive = false, variant = "default", size = "default", tooltip, className, ...props }, ref) => {
2014
2002
  const Comp = asChild ? Slot$1 : "button";
2015
2003
  const { isMobile, state } = useSidebar();
2016
2004
  const button = /* @__PURE__ */ jsx(Comp, {
2005
+ ref,
2017
2006
  "data-slot": "sidebar-menu-button",
2018
2007
  "data-sidebar": "menu-button",
2019
2008
  "data-size": size,
@@ -2025,7 +2014,8 @@ function SidebarMenuButton({ asChild = false, isActive = false, variant = "defau
2025
2014
  ...props
2026
2015
  });
2027
2016
  if (!tooltip) return button;
2028
- if (typeof tooltip === "string") tooltip = { children: tooltip };
2017
+ let tooltipProps = tooltip;
2018
+ if (typeof tooltipProps === "string") tooltipProps = { children: tooltipProps };
2029
2019
  return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
2030
2020
  asChild: true,
2031
2021
  children: button
@@ -2033,19 +2023,22 @@ function SidebarMenuButton({ asChild = false, isActive = false, variant = "defau
2033
2023
  side: "right",
2034
2024
  align: "center",
2035
2025
  hidden: state !== "collapsed" || isMobile,
2036
- ...tooltip
2026
+ ...tooltipProps
2037
2027
  })] });
2038
- }
2039
- function SidebarMenuAction({ className, asChild = false, showOnHover = false, ...props }) {
2028
+ });
2029
+ SidebarMenuButton.displayName = "SidebarMenuButton";
2030
+ const SidebarMenuAction = React$1.forwardRef(({ className, asChild = false, showOnHover = false, ...props }, ref) => {
2040
2031
  const Comp = asChild ? Slot$1 : "button";
2041
2032
  const { isMobile } = useSidebar();
2042
2033
  return /* @__PURE__ */ jsx(Comp, {
2034
+ ref,
2043
2035
  "data-slot": "sidebar-menu-action",
2044
2036
  "data-sidebar": "menu-action",
2045
2037
  className: cn("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", "after:absolute after:-inset-2", isMobile && "md:after:hidden", "peer-data-[size=sm]/menu-button:top-1", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "group-data-[collapsible=icon]:hidden", showOnHover && cn("peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100", isMobile ? "md:opacity-0" : "opacity-0"), className),
2046
2038
  ...props
2047
2039
  });
2048
- }
2040
+ });
2041
+ SidebarMenuAction.displayName = "SidebarMenuAction";
2049
2042
  function SidebarMenuBadge({ className, ...props }) {
2050
2043
  return /* @__PURE__ */ jsx("div", {
2051
2044
  "data-slot": "sidebar-menu-badge",
@@ -2188,18 +2181,6 @@ function Spinner({ className, size, ...props }) {
2188
2181
  });
2189
2182
  }
2190
2183
 
2191
- //#endregion
2192
- //#region src/components/split-button.tsx
2193
- const SplitButton = React$1.forwardRef(({ children, className }, ref) => {
2194
- return /* @__PURE__ */ jsx("div", {
2195
- ref,
2196
- className: cn("inline-flex", "[&>*:first-child]:rounded-r-none", "[&>*:not(:first-child):not(:last-child)]:rounded-none", "[&>*:last-child]:rounded-l-none", "[&>*:not(:last-child)]:border-r [&>*:not(:last-child)]:border-r-border", className),
2197
- role: "group",
2198
- children
2199
- });
2200
- });
2201
- SplitButton.displayName = "SplitButton";
2202
-
2203
2184
  //#endregion
2204
2185
  //#region src/components/switch.tsx
2205
2186
  function Switch({ className, ...props }) {
@@ -2335,4 +2316,4 @@ function ToggleGroupItem({ className, children, variant, size, ...props }) {
2335
2316
  }
2336
2317
 
2337
2318
  //#endregion
2338
- export { Alert, AlertAction, AlertDescription, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CountryFlag, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Dock, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmojiPicker, EmojiPickerCategories, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Label, List, ListCol, ListRow, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, 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, Slot, Spinner, SplitButton, Switch, TabBar, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeProvider, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonGroupVariants, buttonVariants, cn, spinnerVariants, toast, toggleVariants, useSidebar, useTheme };
2319
+ export { Alert, AlertAction, AlertDescription, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CountryFlag, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmojiPicker, EmojiPickerCategories, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, 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, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, 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, Slot, Spinner, Switch, TabBar, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeProvider, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonGroupVariants, buttonVariants, cn, inputOTPVariants, spinnerVariants, toast, toggleVariants, useSidebar, useTheme };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aircall/ds",
3
- "version": "0.2.3",
3
+ "version": "0.2.6",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "sideEffects": [
@@ -57,6 +57,7 @@
57
57
  "cmdk": "1.1.1",
58
58
  "embla-carousel-react": "8.6.0",
59
59
  "emoji-picker-react": "4.4.9",
60
+ "input-otp": "1.4.2",
60
61
  "lucide-react": "0.562.0",
61
62
  "next-themes": "0.4.6",
62
63
  "sonner": "2.0.3",
@@ -83,9 +84,9 @@
83
84
  "@types/node": "24",
84
85
  "@types/react": "19",
85
86
  "@types/react-dom": "19",
86
- "@vitest/browser-playwright": "4.0.16",
87
- "@vitest/coverage-v8": "4.0.16",
88
- "chromatic": "13.3.4",
87
+ "@vitest/browser-playwright": "4.0.17",
88
+ "@vitest/coverage-v8": "4.0.17",
89
+ "chromatic": "13.3.5",
89
90
  "playwright": "1.57.0",
90
91
  "react": "19.2.3",
91
92
  "react-compiler-runtime": "1.0.0",
@@ -95,8 +96,8 @@
95
96
  "tailwindcss": "4.1.18",
96
97
  "tsdown": "0.20.0-beta.3",
97
98
  "typescript": "5.9.3",
98
- "vite": "5.4.2",
99
- "vitest": "4.0.16"
99
+ "vite": "7.3.1",
100
+ "vitest": "4.0.17"
100
101
  },
101
102
  "scripts": {
102
103
  "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",