@arolariu/components 0.4.2 → 0.5.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
@@ -19,6 +19,7 @@ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, Di
19
19
  export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, } from "./components/ui/drawer";
20
20
  export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, } from "./components/ui/dropdown-menu";
21
21
  export { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "./components/ui/empty";
22
+ export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, } from "./components/ui/field";
22
23
  export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField } from "./components/ui/form";
23
24
  export { HoverCard, HoverCardContent, HoverCardTrigger } from "./components/ui/hover-card";
24
25
  export { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot } from "./components/ui/input-otp";
@@ -52,6 +53,7 @@ export { Toggle, toggleVariants } from "./components/ui/toggle";
52
53
  export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./components/ui/tooltip";
53
54
  export { useIsMobile } from "./hooks/useIsMobile";
54
55
  export { useWindowSize } from "./hooks/useWindowSize";
56
+ export { adjustHexColorLightness, adjustLightness, calculateComplementaryHexColor, convertHexToHslString, convertHslToHexString, getComplementaryColor, hexToHsl, hslToHex, isValidHexColor, parseHslString, parseHslStringToComponents, validateHexColorFormat, } from "./lib/color-conversion-utilities";
55
57
  export { cn } from "./lib/utilities";
56
58
  export { FlipButton, type FlipButtonProps, type FlipDirection } from "./components/ui/flip-button";
57
59
  export { RippleButton, type RippleButtonProps } from "./components/ui/ripple-button";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AAEvG,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAC,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAE1E,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAC,MAAM,EAAE,cAAc,EAAE,WAAW,EAAC,MAAM,wBAAwB,CAAC;AAE3E,OAAO,EAAC,KAAK,EAAE,aAAa,EAAC,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAC,MAAM,EAAE,cAAc,EAAC,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAC,WAAW,EAAE,oBAAoB,EAAE,eAAe,EAAE,mBAAmB,EAAC,MAAM,8BAA8B,CAAC;AAErH,OAAO,EAAC,QAAQ,EAAC,MAAM,0BAA0B,CAAC;AAElD,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAC,MAAM,sBAAsB,CAAC;A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AwB,EAAC,MAAM,sCAAsC,CAAC;AAExG,OAAO,EAAC,kBAAkB,EAAE,KAAK,uBAAuB,EAAC,MAAM,qCAAqC,CAAC;AAErG,OAAO,EAAC,cAAc,EAAE,KAAK,mBAAmB,EAAC,MAAM,iCAAiC,CAAC;AAGzF,OAAO,EAAC,aAAa,EAAC,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAC,SAAS,EAAC,MAAM,2BAA2B,CAAC;AAGpD,OAAO,EAAC,eAAe,EAAC,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAC,cAAc,EAAE,oBAAoB,EAAC,MAAM,4BAA4B,CAAC;AAGhF,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC"}
package/dist/index.js CHANGED
@@ -19,6 +19,7 @@ import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, Di
19
19
  import { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger } from "./components/ui/drawer.js";
20
20
  import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "./components/ui/dropdown-menu.js";
21
21
  import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "./components/ui/empty.js";
22
+ import { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle } from "./components/ui/field.js";
22
23
  import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField } from "./components/ui/form.js";
23
24
  import { HoverCard, HoverCardContent, HoverCardTrigger } from "./components/ui/hover-card.js";
24
25
  import { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot } from "./components/ui/input-otp.js";
@@ -52,6 +53,7 @@ import { Toggle, toggleVariants } from "./components/ui/toggle.js";
52
53
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./components/ui/tooltip.js";
53
54
  import { useIsMobile } from "./hooks/useIsMobile.js";
54
55
  import { useWindowSize } from "./hooks/useWindowSize.js";
56
+ import { adjustHexColorLightness, adjustLightness, calculateComplementaryHexColor, convertHexToHslString, convertHslToHexString, getComplementaryColor, hexToHsl, hslToHex, isValidHexColor, parseHslString, parseHslStringToComponents, validateHexColorFormat } from "./lib/color-conversion-utilities.js";
55
57
  import { cn } from "./lib/utilities.js";
56
58
  import { FlipButton } from "./components/ui/flip-button.js";
57
59
  import { RippleButton } from "./components/ui/ripple-button.js";
@@ -67,4 +69,4 @@ import { Scratcher } from "./components/ui/scratcher.js";
67
69
  import { BackgroundBeams } from "./components/ui/background-beams.js";
68
70
  import { TypewriterText, TypewriterTextSmooth } from "./components/ui/typewriter.js";
69
71
  import { DropDrawer, DropDrawerContent, DropDrawerFooter, DropDrawerGroup, DropDrawerItem, DropDrawerLabel, DropDrawerSeparator, DropDrawerSub, DropDrawerSubContent, DropDrawerSubTrigger, DropDrawerTrigger } from "./components/ui/dropdrawer.js";
70
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, Avatar, AvatarFallback, AvatarImage, BackgroundBeams, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, BubbleBackground, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Calendar, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CountingNumber, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DotBackground, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropDrawer, DropDrawerContent, DropDrawerFooter, DropDrawerGroup, DropDrawerItem, DropDrawerLabel, DropDrawerSeparator, DropDrawerSub, DropDrawerSubContent, DropDrawerSubTrigger, DropDrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, FireworksBackground, FlipButton, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, GradientBackground, GradientText, HighlightText, HoleBackground, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Kbd, KbdGroup, Label, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, RippleButton, Scratcher, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, 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, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TypewriterText, TypewriterTextSmooth, badgeVariants, buttonGroupVariants, buttonVariants, cn, navigationMenuTriggerStyle, toast, toggleVariants, useFormField, useIsMobile, useSidebar, useWindowSize };
72
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, Avatar, AvatarFallback, AvatarImage, BackgroundBeams, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, BubbleBackground, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Calendar, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CountingNumber, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DotBackground, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropDrawer, DropDrawerContent, DropDrawerFooter, DropDrawerGroup, DropDrawerItem, DropDrawerLabel, DropDrawerSeparator, DropDrawerSub, DropDrawerSubContent, DropDrawerSubTrigger, DropDrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, FireworksBackground, FlipButton, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, GradientBackground, GradientText, HighlightText, HoleBackground, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Kbd, KbdGroup, Label, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, RippleButton, Scratcher, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, 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, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TypewriterText, TypewriterTextSmooth, adjustHexColorLightness, adjustLightness, badgeVariants, buttonGroupVariants, buttonVariants, calculateComplementaryHexColor, cn, convertHexToHslString, convertHslToHexString, getComplementaryColor, hexToHsl, hslToHex, isValidHexColor, navigationMenuTriggerStyle, parseHslString, parseHslStringToComponents, toast, toggleVariants, useFormField, useIsMobile, useSidebar, useWindowSize, validateHexColorFormat };
@@ -0,0 +1,82 @@
1
+ /**
2
+ * @fileoverview Utility functions for color conversion and manipulation.
3
+ * Provides hex-to-HSL conversion and color validation for CSS custom properties.
4
+ * @module lib/color-conversion-utilities
5
+ */
6
+ /**
7
+ * Converts a hexadecimal color code to an HSL string for CSS variables.
8
+ * The output format matches Tailwind CSS HSL variable format: "h s% l%"
9
+ *
10
+ * @param hexColor - Hex color code (e.g., "#06b6d4" or "06b6d4")
11
+ * @returns HSL values as "h s% l%" string suitable for CSS variables
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * convertHexToHslString("#06b6d4"); // "187 94% 43%"
16
+ * convertHexToHslString("#ec4899"); // "330 81% 60%"
17
+ * ```
18
+ */
19
+ export declare function convertHexToHslString(hexColor: string): string;
20
+ /**
21
+ * Converts HSL color values to a hexadecimal color string.
22
+ *
23
+ * @param hue - Hue value (0-360)
24
+ * @param saturation - Saturation percentage (0-100)
25
+ * @param lightness - Lightness percentage (0-100)
26
+ * @returns Hex color code (e.g., "#06b6d4")
27
+ */
28
+ export declare function convertHslToHexString(hue: number, saturation: number, lightness: number): string;
29
+ /**
30
+ * Validates whether a string is a valid 6-digit hexadecimal color code.
31
+ *
32
+ * @param hexColor - String to validate
33
+ * @returns True if valid 6-digit hex color (with or without #)
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * validateHexColorFormat("#06b6d4"); // true
38
+ * validateHexColorFormat("06b6d4"); // true
39
+ * validateHexColorFormat("#FFF"); // false (3-digit not supported)
40
+ * validateHexColorFormat("invalid"); // false
41
+ * ```
42
+ */
43
+ export declare function validateHexColorFormat(hexColor: string): boolean;
44
+ /**
45
+ * Generates the complementary (inverse) color for a given hex color.
46
+ *
47
+ * @param hexColor - Hex color code
48
+ * @returns Complementary hex color code
49
+ */
50
+ export declare function calculateComplementaryHexColor(hexColor: string): string;
51
+ /**
52
+ * Adjusts the lightness of a hexadecimal color by a specified amount.
53
+ *
54
+ * @param hexColor - Hex color code
55
+ * @param lightnessAdjustment - Amount to adjust lightness (-100 to 100)
56
+ * @returns Adjusted hex color code
57
+ */
58
+ export declare function adjustHexColorLightness(hexColor: string, lightnessAdjustment: number): string;
59
+ /**
60
+ * Parses an HSL CSS variable string into its numeric components.
61
+ *
62
+ * @param hslString - HSL string in format "h s% l%"
63
+ * @returns Object with hue, saturation, lightness values or null if invalid
64
+ */
65
+ export declare function parseHslStringToComponents(hslString: string): {
66
+ hue: number;
67
+ saturation: number;
68
+ lightness: number;
69
+ } | null;
70
+ /** @deprecated Use convertHexToHslString instead */
71
+ export declare const hexToHsl: typeof convertHexToHslString;
72
+ /** @deprecated Use convertHslToHexString instead */
73
+ export declare const hslToHex: typeof convertHslToHexString;
74
+ /** @deprecated Use validateHexColorFormat instead */
75
+ export declare const isValidHexColor: typeof validateHexColorFormat;
76
+ /** @deprecated Use calculateComplementaryHexColor instead */
77
+ export declare const getComplementaryColor: typeof calculateComplementaryHexColor;
78
+ /** @deprecated Use adjustHexColorLightness instead */
79
+ export declare const adjustLightness: typeof adjustHexColorLightness;
80
+ /** @deprecated Use parseHslStringToComponents instead */
81
+ export declare const parseHslString: typeof parseHslStringToComponents;
82
+ //# sourceMappingURL=color-conversion-utilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-conversion-utilities.d.ts","sourceRoot":"","sources":["../../src/lib/color-conversion-utilities.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CA8B9D;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAyBhG;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEhE;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOvE;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,GAAG,MAAM,CAM7F;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,MAAM,GAAG;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAC,GAAG,IAAI,CAUzH;AAGD,oDAAoD;AACpD,eAAO,MAAM,QAAQ,8BAAwB,CAAC;AAC9C,oDAAoD;AACpD,eAAO,MAAM,QAAQ,8BAAwB,CAAC;AAC9C,qDAAqD;AACrD,eAAO,MAAM,eAAe,+BAAyB,CAAC;AACtD,6DAA6D;AAC7D,eAAO,MAAM,qBAAqB,uCAAiC,CAAC;AACpE,sDAAsD;AACtD,eAAO,MAAM,eAAe,gCAA0B,CAAC;AACvD,yDAAyD;AACzD,eAAO,MAAM,cAAc,mCAA6B,CAAC"}
@@ -0,0 +1,94 @@
1
+ function convertHexToHslString(hexColor) {
2
+ const cleanHex = hexColor.replace("#", "");
3
+ const r = Number.parseInt(cleanHex.slice(0, 2), 16) / 255;
4
+ const g = Number.parseInt(cleanHex.slice(2, 4), 16) / 255;
5
+ const b = Number.parseInt(cleanHex.slice(4, 6), 16) / 255;
6
+ const max = Math.max(r, g, b);
7
+ const min = Math.min(r, g, b);
8
+ let h = 0;
9
+ let s = 0;
10
+ const l = (max + min) / 2;
11
+ if (max !== min) {
12
+ const d = max - min;
13
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
14
+ h = max === r ? ((g - b) / d + (g < b ? 6 : 0)) / 6 : max === g ? ((b - r) / d + 2) / 6 : ((r - g) / d + 4) / 6;
15
+ }
16
+ return `${Math.round(360 * h)} ${Math.round(100 * s)}% ${Math.round(100 * l)}%`;
17
+ }
18
+ function convertHslToHexString(hue, saturation, lightness) {
19
+ const sNorm = saturation / 100;
20
+ const lNorm = lightness / 100;
21
+ const c = (1 - Math.abs(2 * lNorm - 1)) * sNorm;
22
+ const x = c * (1 - Math.abs(hue / 60 % 2 - 1));
23
+ const m = lNorm - c / 2;
24
+ const getRgb = ()=>{
25
+ if (hue >= 0 && hue < 60) return [
26
+ c,
27
+ x,
28
+ 0
29
+ ];
30
+ if (hue >= 60 && hue < 120) return [
31
+ x,
32
+ c,
33
+ 0
34
+ ];
35
+ if (hue >= 120 && hue < 180) return [
36
+ 0,
37
+ c,
38
+ x
39
+ ];
40
+ if (hue >= 180 && hue < 240) return [
41
+ 0,
42
+ x,
43
+ c
44
+ ];
45
+ if (hue >= 240 && hue < 300) return [
46
+ x,
47
+ 0,
48
+ c
49
+ ];
50
+ return [
51
+ c,
52
+ 0,
53
+ x
54
+ ];
55
+ };
56
+ const rgb = getRgb();
57
+ const toHex = (n)=>Math.round((n + m) * 255).toString(16).padStart(2, "0");
58
+ return `#${toHex(rgb[0])}${toHex(rgb[1])}${toHex(rgb[2])}`;
59
+ }
60
+ function validateHexColorFormat(hexColor) {
61
+ return /^#?[\dA-Fa-f]{6}$/u.test(hexColor);
62
+ }
63
+ function calculateComplementaryHexColor(hexColor) {
64
+ const cleanHex = hexColor.replace("#", "");
65
+ const r = 255 - Number.parseInt(cleanHex.slice(0, 2), 16);
66
+ const g = 255 - Number.parseInt(cleanHex.slice(2, 4), 16);
67
+ const b = 255 - Number.parseInt(cleanHex.slice(4, 6), 16);
68
+ return `#${r.toString(16).padStart(2, "0")}${g.toString(16).padStart(2, "0")}${b.toString(16).padStart(2, "0")}`;
69
+ }
70
+ function adjustHexColorLightness(hexColor, lightnessAdjustment) {
71
+ const hsl = convertHexToHslString(hexColor);
72
+ const [h, s, l] = hsl.split(" ").map((v, i)=>0 === i ? Number.parseInt(v, 10) : Number.parseInt(v.replace("%", ""), 10));
73
+ const newL = Math.max(0, Math.min(100, (l ?? 50) + lightnessAdjustment));
74
+ return convertHslToHexString(h ?? 0, s ?? 50, newL);
75
+ }
76
+ function parseHslStringToComponents(hslString) {
77
+ const pattern = /^(?<hue>\d+)\s+(?<sat>\d+)%\s+(?<light>\d+)%$/u;
78
+ const match = pattern.exec(hslString);
79
+ if (!match?.groups) return null;
80
+ return {
81
+ hue: Number.parseInt(match.groups["hue"] ?? "0", 10),
82
+ saturation: Number.parseInt(match.groups["sat"] ?? "0", 10),
83
+ lightness: Number.parseInt(match.groups["light"] ?? "0", 10)
84
+ };
85
+ }
86
+ const hexToHsl = convertHexToHslString;
87
+ const hslToHex = convertHslToHexString;
88
+ const isValidHexColor = validateHexColorFormat;
89
+ const getComplementaryColor = calculateComplementaryHexColor;
90
+ const adjustLightness = adjustHexColorLightness;
91
+ const parseHslString = parseHslStringToComponents;
92
+ export { adjustHexColorLightness, adjustLightness, calculateComplementaryHexColor, convertHexToHslString, convertHslToHexString, getComplementaryColor, hexToHsl, hslToHex, isValidHexColor, parseHslString, parseHslStringToComponents, validateHexColorFormat };
93
+
94
+ //# sourceMappingURL=color-conversion-utilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lib/color-conversion-utilities.js","sources":["../../src/lib/color-conversion-utilities.ts"],"sourcesContent":["/**\r\n * @fileoverview Utility functions for color conversion and manipulation.\r\n * Provides hex-to-HSL conversion and color validation for CSS custom properties.\r\n * @module lib/color-conversion-utilities\r\n */\r\n\r\n/**\r\n * Converts a hexadecimal color code to an HSL string for CSS variables.\r\n * The output format matches Tailwind CSS HSL variable format: \"h s% l%\"\r\n *\r\n * @param hexColor - Hex color code (e.g., \"#06b6d4\" or \"06b6d4\")\r\n * @returns HSL values as \"h s% l%\" string suitable for CSS variables\r\n *\r\n * @example\r\n * ```typescript\r\n * convertHexToHslString(\"#06b6d4\"); // \"187 94% 43%\"\r\n * convertHexToHslString(\"#ec4899\"); // \"330 81% 60%\"\r\n * ```\r\n */\r\nexport function convertHexToHslString(hexColor: string): string {\r\n // Remove # if present\r\n const cleanHex = hexColor.replace(\"#\", \"\");\r\n\r\n // Parse RGB values\r\n const r = Number.parseInt(cleanHex.slice(0, 2), 16) / 255;\r\n const g = Number.parseInt(cleanHex.slice(2, 4), 16) / 255;\r\n const b = Number.parseInt(cleanHex.slice(4, 6), 16) / 255;\r\n\r\n const max = Math.max(r, g, b);\r\n const min = Math.min(r, g, b);\r\n let h = 0;\r\n let s = 0;\r\n const l = (max + min) / 2;\r\n\r\n if (max !== min) {\r\n const d = max - min;\r\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\r\n\r\n // max is always r, g, or b - no default case needed\r\n if (max === r) {\r\n h = ((g - b) / d + (g < b ? 6 : 0)) / 6;\r\n } else if (max === g) {\r\n h = ((b - r) / d + 2) / 6;\r\n } else {\r\n h = ((r - g) / d + 4) / 6;\r\n }\r\n }\r\n\r\n return `${Math.round(h * 360)} ${Math.round(s * 100)}% ${Math.round(l * 100)}%`;\r\n}\r\n\r\n/**\r\n * Converts HSL color values to a hexadecimal color string.\r\n *\r\n * @param hue - Hue value (0-360)\r\n * @param saturation - Saturation percentage (0-100)\r\n * @param lightness - Lightness percentage (0-100)\r\n * @returns Hex color code (e.g., \"#06b6d4\")\r\n */\r\nexport function convertHslToHexString(hue: number, saturation: number, lightness: number): string {\r\n const sNorm = saturation / 100;\r\n const lNorm = lightness / 100;\r\n\r\n const c = (1 - Math.abs(2 * lNorm - 1)) * sNorm;\r\n const x = c * (1 - Math.abs(((hue / 60) % 2) - 1));\r\n const m = lNorm - c / 2;\r\n\r\n const getRgb = (): [number, number, number] => {\r\n if (hue >= 0 && hue < 60) return [c, x, 0];\r\n if (hue >= 60 && hue < 120) return [x, c, 0];\r\n if (hue >= 120 && hue < 180) return [0, c, x];\r\n if (hue >= 180 && hue < 240) return [0, x, c];\r\n if (hue >= 240 && hue < 300) return [x, 0, c];\r\n return [c, 0, x];\r\n };\r\n\r\n const rgb = getRgb();\r\n\r\n const toHex = (n: number) =>\r\n Math.round((n + m) * 255)\r\n .toString(16)\r\n .padStart(2, \"0\");\r\n\r\n return `#${toHex(rgb[0])}${toHex(rgb[1])}${toHex(rgb[2])}`;\r\n}\r\n\r\n/**\r\n * Validates whether a string is a valid 6-digit hexadecimal color code.\r\n *\r\n * @param hexColor - String to validate\r\n * @returns True if valid 6-digit hex color (with or without #)\r\n *\r\n * @example\r\n * ```typescript\r\n * validateHexColorFormat(\"#06b6d4\"); // true\r\n * validateHexColorFormat(\"06b6d4\"); // true\r\n * validateHexColorFormat(\"#FFF\"); // false (3-digit not supported)\r\n * validateHexColorFormat(\"invalid\"); // false\r\n * ```\r\n */\r\nexport function validateHexColorFormat(hexColor: string): boolean {\r\n return /^#?[\\dA-Fa-f]{6}$/u.test(hexColor);\r\n}\r\n\r\n/**\r\n * Generates the complementary (inverse) color for a given hex color.\r\n *\r\n * @param hexColor - Hex color code\r\n * @returns Complementary hex color code\r\n */\r\nexport function calculateComplementaryHexColor(hexColor: string): string {\r\n const cleanHex = hexColor.replace(\"#\", \"\");\r\n const r = 255 - Number.parseInt(cleanHex.slice(0, 2), 16);\r\n const g = 255 - Number.parseInt(cleanHex.slice(2, 4), 16);\r\n const b = 255 - Number.parseInt(cleanHex.slice(4, 6), 16);\r\n\r\n return `#${r.toString(16).padStart(2, \"0\")}${g.toString(16).padStart(2, \"0\")}${b.toString(16).padStart(2, \"0\")}`;\r\n}\r\n\r\n/**\r\n * Adjusts the lightness of a hexadecimal color by a specified amount.\r\n *\r\n * @param hexColor - Hex color code\r\n * @param lightnessAdjustment - Amount to adjust lightness (-100 to 100)\r\n * @returns Adjusted hex color code\r\n */\r\nexport function adjustHexColorLightness(hexColor: string, lightnessAdjustment: number): string {\r\n const hsl = convertHexToHslString(hexColor);\r\n const [h, s, l] = hsl.split(\" \").map((v, i) => (i === 0 ? Number.parseInt(v, 10) : Number.parseInt(v.replace(\"%\", \"\"), 10)));\r\n\r\n const newL = Math.max(0, Math.min(100, (l ?? 50) + lightnessAdjustment));\r\n return convertHslToHexString(h ?? 0, s ?? 50, newL);\r\n}\r\n\r\n/**\r\n * Parses an HSL CSS variable string into its numeric components.\r\n *\r\n * @param hslString - HSL string in format \"h s% l%\"\r\n * @returns Object with hue, saturation, lightness values or null if invalid\r\n */\r\nexport function parseHslStringToComponents(hslString: string): {hue: number; saturation: number; lightness: number} | null {\r\n const pattern = /^(?<hue>\\d+)\\s+(?<sat>\\d+)%\\s+(?<light>\\d+)%$/u;\r\n const match = pattern.exec(hslString);\r\n if (!match?.groups) return null;\r\n\r\n return {\r\n hue: Number.parseInt(match.groups[\"hue\"] ?? \"0\", 10),\r\n saturation: Number.parseInt(match.groups[\"sat\"] ?? \"0\", 10),\r\n lightness: Number.parseInt(match.groups[\"light\"] ?? \"0\", 10),\r\n };\r\n}\r\n\r\n// Legacy aliases for backwards compatibility (deprecated)\r\n/** @deprecated Use convertHexToHslString instead */\r\nexport const hexToHsl = convertHexToHslString;\r\n/** @deprecated Use convertHslToHexString instead */\r\nexport const hslToHex = convertHslToHexString;\r\n/** @deprecated Use validateHexColorFormat instead */\r\nexport const isValidHexColor = validateHexColorFormat;\r\n/** @deprecated Use calculateComplementaryHexColor instead */\r\nexport const getComplementaryColor = calculateComplementaryHexColor;\r\n/** @deprecated Use adjustHexColorLightness instead */\r\nexport const adjustLightness = adjustHexColorLightness;\r\n/** @deprecated Use parseHslStringToComponents instead */\r\nexport const parseHslString = parseHslStringToComponents;\r\n"],"names":["convertHexToHslString","hexColor","cleanHex","r","Number","g","b","max","Math","min","h","s","l","d","convertHslToHexString","hue","saturation","lightness","sNorm","lNorm","c","x","m","getRgb","rgb","toHex","n","validateHexColorFormat","calculateComplementaryHexColor","adjustHexColorLightness","lightnessAdjustment","hsl","v","i","newL","parseHslStringToComponents","hslString","pattern","match","hexToHsl","hslToHex","isValidHexColor","getComplementaryColor","adjustLightness","parseHslString"],"mappings":"AAmBO,SAASA,sBAAsBC,QAAgB;IAEpD,MAAMC,WAAWD,SAAS,OAAO,CAAC,KAAK;IAGvC,MAAME,IAAIC,OAAO,QAAQ,CAACF,SAAS,KAAK,CAAC,GAAG,IAAI,MAAM;IACtD,MAAMG,IAAID,OAAO,QAAQ,CAACF,SAAS,KAAK,CAAC,GAAG,IAAI,MAAM;IACtD,MAAMI,IAAIF,OAAO,QAAQ,CAACF,SAAS,KAAK,CAAC,GAAG,IAAI,MAAM;IAEtD,MAAMK,MAAMC,KAAK,GAAG,CAACL,GAAGE,GAAGC;IAC3B,MAAMG,MAAMD,KAAK,GAAG,CAACL,GAAGE,GAAGC;IAC3B,IAAII,IAAI;IACR,IAAIC,IAAI;IACR,MAAMC,IAAKL,AAAAA,CAAAA,MAAME,GAAE,IAAK;IAExB,IAAIF,QAAQE,KAAK;QACf,MAAMI,IAAIN,MAAME;QAChBE,IAAIC,IAAI,MAAMC,IAAK,KAAIN,MAAME,GAAE,IAAKI,IA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AGC,KAAK,IAAIuB;AAChD;AAQO,SAASC,2BAA2BC,SAAiB;IAC1D,MAAMC,UAAU;IAChB,MAAMC,QAAQD,QAAQ,IAAI,CAACD;IAC3B,IAAI,CAACE,OAAO,QAAQ,OAAO;IAE3B,OAAO;QACL,KAAKlC,OAAO,QAAQ,CAACkC,MAAM,MAAM,CAAC,MAAM,IAAI,KAAK;QACjD,YAAYlC,OAAO,QAAQ,CAACkC,MAAM,MAAM,CAAC,MAAM,IAAI,KAAK;QACxD,WAAWlC,OAAO,QAAQ,CAACkC,MAAM,MAAM,CAAC,QAAQ,IAAI,KAAK;IAC3D;AACF;AAIO,MAAMC,WAAWvC;AAEjB,MAAMwC,WAAW1B;AAEjB,MAAM2B,kBAAkBd;AAExB,MAAMe,wBAAwBd;AAE9B,MAAMe,kBAAkBd;AAExB,MAAMe,iBAAiBT"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arolariu/components",
3
3
  "displayName": "@arolariu/components",
4
- "version": "0.4.2",
4
+ "version": "0.5.0",
5
5
  "description": "🎨 70+ beautiful, accessible React components built on Radix UI. TypeScript-first, tree-shakeable, SSR-ready. Perfect for modern web apps, design systems & rapid prototyping. Zero config, maximum flexibility! ⚡",
6
6
  "homepage": "https://arolariu.ro",
7
7
  "repository": {
@@ -81,7 +81,9 @@
81
81
  "build:before": "node scripts/beforeBuild.ts",
82
82
  "build:after": "node scripts/afterBuild.ts",
83
83
  "build:clean": "rimraf dist",
84
- "build:exports": "node scripts/generate-exports.ts"
84
+ "build:exports": "node scripts/generate-exports.ts",
85
+ "test": "npm run test:unit",
86
+ "test:unit": "vitest run"
85
87
  },
86
88
  "dependencies": {
87
89
  "@hookform/resolvers": "*",
@@ -517,6 +519,11 @@
517
519
  "import": "./dist/components/ui/usewindowsize.js",
518
520
  "default": "./dist/components/ui/usewindowsize.js"
519
521
  },
522
+ "./color-conversion-utilities": {
523
+ "types": "./dist/components/ui/color-conversion-utilities.d.ts",
524
+ "import": "./dist/components/ui/color-conversion-utilities.js",
525
+ "default": "./dist/components/ui/color-conversion-utilities.js"
526
+ },
520
527
  "./utilities": {
521
528
  "types": "./dist/components/ui/utilities.d.ts",
522
529
  "import": "./dist/components/ui/utilities.js",
@@ -5,7 +5,7 @@ import {Command as CommandPrimitive} from "cmdk";
5
5
  import {Search} from "lucide-react";
6
6
  import * as React from "react";
7
7
 
8
- import {Dialog, DialogContent} from "@/components/ui/dialog";
8
+ import {Dialog, DialogContent, DialogTitle} from "@/components/ui/dialog";
9
9
  import {cn} from "@/lib/utilities";
10
10
 
11
11
  const Command = React.forwardRef<React.ComponentRef<typeof CommandPrimitive>, React.ComponentPropsWithoutRef<typeof CommandPrimitive>>(
@@ -26,6 +26,7 @@ const CommandDialog = ({children, ...props}: DialogProps) => {
26
26
  return (
27
27
  <Dialog {...props}>
28
28
  <DialogContent className='overflow-hidden p-0'>
29
+ <DialogTitle className='sr-only' />
29
30
  <Command className='[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-neutral-500 dark:[&_[cmdk-group-heading]]:text-neutral-400 [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5'>
30
31
  {children}
31
32
  </Command>
@@ -0,0 +1,96 @@
1
+ import {act, renderHook} from "@testing-library/react";
2
+ import {beforeEach, describe, expect, it, vi} from "vitest";
3
+ import {useIsMobile} from "./useIsMobile";
4
+
5
+ describe("useIsMobile", () => {
6
+ beforeEach(() => {
7
+ vi.stubGlobal("innerWidth", 1024);
8
+ vi.stubGlobal(
9
+ "matchMedia",
10
+ vi.fn().mockImplementation((query: string) => ({
11
+ matches: false,
12
+ media: query,
13
+ onchange: null,
14
+ addListener: vi.fn(), // Deprecated
15
+ removeListener: vi.fn(), // Deprecated
16
+ addEventListener: vi.fn(),
17
+ removeEventListener: vi.fn(),
18
+ dispatchEvent: vi.fn(),
19
+ })),
20
+ );
21
+ });
22
+
23
+ it("should return false initially on desktop", () => {
24
+ vi.stubGlobal("innerWidth", 1024);
25
+ const {result} = renderHook(() => useIsMobile());
26
+ expect(result.current).toBe(false);
27
+ });
28
+
29
+ it("should return true initially on mobile", () => {
30
+ vi.stubGlobal("innerWidth", 500);
31
+ const {result} = renderHook(() => useIsMobile());
32
+ expect(result.current).toBe(true);
33
+ });
34
+
35
+ it("should update when window is resized", () => {
36
+ let changeHandler: () => void = () => {};
37
+ const addEventListener = vi.fn((event: string, handler: () => void) => {
38
+ if (event === "change") changeHandler = handler;
39
+ });
40
+
41
+ vi.stubGlobal(
42
+ "matchMedia",
43
+ vi.fn().mockImplementation((query: string) => ({
44
+ matches: false,
45
+ media: query,
46
+ onchange: null,
47
+ addListener: vi.fn(),
48
+ removeListener: vi.fn(),
49
+ addEventListener,
50
+ removeEventListener: vi.fn(),
51
+ dispatchEvent: vi.fn(),
52
+ })),
53
+ );
54
+
55
+ const {result} = renderHook(() => useIsMobile());
56
+ expect(result.current).toBe(false);
57
+
58
+ // Simulate resize
59
+ vi.stubGlobal("innerWidth", 500);
60
+ act(() => {
61
+ changeHandler();
62
+ });
63
+
64
+ expect(result.current).toBe(true);
65
+
66
+ // Simulate resize back to desktop
67
+ vi.stubGlobal("innerWidth", 1024);
68
+ act(() => {
69
+ changeHandler();
70
+ });
71
+
72
+ expect(result.current).toBe(false);
73
+ });
74
+
75
+ it("should cleanup event listener on unmount", () => {
76
+ const removeEventListener = vi.fn();
77
+ vi.stubGlobal(
78
+ "matchMedia",
79
+ vi.fn().mockImplementation((query: string) => ({
80
+ matches: false,
81
+ media: query,
82
+ onchange: null,
83
+ addListener: vi.fn(),
84
+ removeListener: vi.fn(),
85
+ addEventListener: vi.fn(),
86
+ removeEventListener,
87
+ dispatchEvent: vi.fn(),
88
+ })),
89
+ );
90
+
91
+ const {unmount} = renderHook(() => useIsMobile());
92
+ unmount();
93
+
94
+ expect(removeEventListener).toHaveBeenCalledWith("change", expect.any(Function));
95
+ });
96
+ });
@@ -0,0 +1,57 @@
1
+ import {act, renderHook} from "@testing-library/react";
2
+ import {describe, expect, it, vi} from "vitest";
3
+ import {useWindowSize} from "./useWindowSize";
4
+
5
+ describe("useWindowSize", () => {
6
+ it("should return initial window size on mount", () => {
7
+ vi.stubGlobal("innerWidth", 1024);
8
+ vi.stubGlobal("innerHeight", 768);
9
+
10
+ const {result} = renderHook(() => useWindowSize());
11
+
12
+ expect(result.current.windowSize).toEqual({width: 1024, height: 768});
13
+ expect(result.current.isMobile).toBe(false);
14
+ expect(result.current.isDesktop).toBe(true);
15
+ });
16
+
17
+ it("should return mobile state when width is below breakpoint", () => {
18
+ vi.stubGlobal("innerWidth", 500);
19
+ vi.stubGlobal("innerHeight", 800);
20
+
21
+ const {result} = renderHook(() => useWindowSize());
22
+
23
+ expect(result.current.windowSize).toEqual({width: 500, height: 800});
24
+ expect(result.current.isMobile).toBe(true);
25
+ expect(result.current.isDesktop).toBe(false);
26
+ });
27
+
28
+ it("should update window size on resize", () => {
29
+ vi.stubGlobal("innerWidth", 1024);
30
+ vi.stubGlobal("innerHeight", 768);
31
+
32
+ const {result} = renderHook(() => useWindowSize());
33
+
34
+ expect(result.current.windowSize.width).toBe(1024);
35
+
36
+ // Simulate resize
37
+ vi.stubGlobal("innerWidth", 500);
38
+ vi.stubGlobal("innerHeight", 800);
39
+
40
+ act(() => {
41
+ globalThis.dispatchEvent(new Event("resize"));
42
+ });
43
+
44
+ expect(result.current.windowSize).toEqual({width: 500, height: 800});
45
+ expect(result.current.isMobile).toBe(true);
46
+ expect(result.current.isDesktop).toBe(false);
47
+ });
48
+
49
+ it("should cleanup event listener on unmount", () => {
50
+ const removeEventListenerSpy = vi.spyOn(globalThis, "removeEventListener");
51
+ const {unmount} = renderHook(() => useWindowSize());
52
+
53
+ unmount();
54
+
55
+ expect(removeEventListenerSpy).toHaveBeenCalledWith("resize", expect.any(Function));
56
+ });
57
+ });