@atom63/ui-react 0.2.0-beta.14 → 0.2.0-beta.15

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.
Files changed (50) hide show
  1. package/dist/chunk-3LGXD3HE.js +450 -0
  2. package/dist/chunk-3LGXD3HE.js.map +1 -0
  3. package/dist/chunk-6HKGC3HE.js +3 -0
  4. package/dist/chunk-6HKGC3HE.js.map +1 -0
  5. package/dist/chunk-6VV4EBOO.js +25 -0
  6. package/dist/chunk-6VV4EBOO.js.map +1 -0
  7. package/dist/{chunk-IXWOWQBP.js → chunk-ALARPBUL.js} +5 -22
  8. package/dist/chunk-ALARPBUL.js.map +1 -0
  9. package/dist/chunk-FHL2NLXP.js +101 -0
  10. package/dist/chunk-FHL2NLXP.js.map +1 -0
  11. package/dist/chunk-HPUHI2YJ.js +69 -0
  12. package/dist/chunk-HPUHI2YJ.js.map +1 -0
  13. package/dist/chunk-QU33S646.js +118 -0
  14. package/dist/chunk-QU33S646.js.map +1 -0
  15. package/dist/components/art-plate/index.js +7 -0
  16. package/dist/components/art-plate/index.js.map +1 -0
  17. package/dist/components/layered-scene/index.js +7 -0
  18. package/dist/components/layered-scene/index.js.map +1 -0
  19. package/dist/components/segmented-control/index.js +1 -1
  20. package/dist/index.d.ts +89 -6
  21. package/dist/index.js +18 -13
  22. package/dist/media/index.d.ts +24 -3
  23. package/dist/media/index.js +9 -361
  24. package/dist/media/index.js.map +1 -1
  25. package/dist/media/media-lightbox/parts/index.js +2 -1
  26. package/dist/preview/index.js +4 -4
  27. package/dist/theme/index.d.ts +6 -2
  28. package/dist/theme/index.js +10 -1
  29. package/dist/theme/index.js.map +1 -1
  30. package/package.json +5 -3
  31. package/src/components/alert-dialog/alert-dialog.css +1 -1
  32. package/src/components/art-plate/art-plate.css +172 -0
  33. package/src/components/autocomplete/autocomplete.css +3 -3
  34. package/src/components/checkbox/checkbox.css +1 -1
  35. package/src/components/feedback-state/feedback-state.css +1 -1
  36. package/src/components/field/field.css +1 -1
  37. package/src/components/form/form.css +1 -1
  38. package/src/components/input/input.css +3 -3
  39. package/src/components/input-otp/input-otp.css +3 -3
  40. package/src/components/layered-scene/layered-scene.css +117 -0
  41. package/src/components/load-more-trigger/load-more-trigger.css +4 -2
  42. package/src/components/radio/radio.css +1 -1
  43. package/src/components/rating/rating.css +18 -17
  44. package/src/components/segmented-control/segmented-control.css +11 -11
  45. package/src/components/select/select.css +3 -3
  46. package/src/components/textarea/textarea.css +3 -3
  47. package/src/styles/recipes.css +2 -0
  48. package/dist/chunk-IXWOWQBP.js.map +0 -1
  49. package/dist/chunk-T7FUZUZO.js +0 -70
  50. package/dist/chunk-T7FUZUZO.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } from './chunk-GRRWPMZI.js';
2
+ export { Tabs, TabsPanel as TabsContent, TabsList, TabsPanel, TabsTab, TabsTab as TabsTrigger } from './chunk-HSOEBAWM.js';
1
3
  export { Toaster, toast } from './chunk-CIWJP6G7.js';
2
4
  export { ToggleGroup, ToggleGroupItem, ToggleGroupSeparator } from './chunk-6YFKZ5CD.js';
3
5
  export { Toggle } from './chunk-FZ6JHXQI.js';
@@ -6,36 +8,35 @@ export { TextTicker } from './chunk-6XJCNBGH.js';
6
8
  export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar } from './chunk-L5KFLZUC.js';
7
9
  export { Skeleton } from './chunk-34JIIXPP.js';
8
10
  export { Switch } from './chunk-7QY24D5A.js';
9
- export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } from './chunk-GRRWPMZI.js';
10
- export { Tabs, TabsPanel as TabsContent, TabsList, TabsPanel, TabsTab, TabsTab as TabsTrigger } from './chunk-HSOEBAWM.js';
11
+ export { Rating } from './chunk-FPIUWNK6.js';
12
+ export { Radio, RadioGroup, Radio as RadioGroupItem } from './chunk-WHUL6ADM.js';
11
13
  export { ResizableHandle, ResizablePanel, ResizablePanelGroup } from './chunk-R2CNNKB3.js';
12
14
  export { SearchField } from './chunk-KX5E5UUZ.js';
15
+ export { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious } from './chunk-CFFGYLY3.js';
13
16
  export { PanelSettingButton } from './chunk-63D5JSVT.js';
14
17
  export { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverDescription, PopoverHeader, PopoverPortal, PopoverTitle, PopoverTrigger } from './chunk-ADZSCK32.js';
15
18
  export { PreviewCard, PreviewCardPopup, PreviewCardTrigger } from './chunk-FBMTWUHX.js';
16
19
  export { ProgressiveBlur } from './chunk-TBB22HVY.js';
17
- export { Rating } from './chunk-FPIUWNK6.js';
18
- export { Radio, RadioGroup, Radio as RadioGroupItem } from './chunk-WHUL6ADM.js';
20
+ export { Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle } from './chunk-XHSP2SJ2.js';
19
21
  export { Kbd, KbdGroup } from './chunk-RDIGEW6P.js';
22
+ export { LayeredScene, LayeredSceneContent, LayeredSceneForeground, LayeredScenePlate, LayeredSceneStage } from './chunk-FHL2NLXP.js';
20
23
  export { LoadMoreTrigger } from './chunk-QIDU2WXD.js';
21
24
  export { Marquee } from './chunk-GAGAOFX3.js';
22
25
  export { Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger } from './chunk-XEXDR2WZ.js';
23
26
  export { Message, MessageEvent, MessageList } from './chunk-2Z2DZLD7.js';
24
- export { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious } from './chunk-CFFGYLY3.js';
27
+ export { Empty, EmptyContent, EmptyDescription, EmptyErrorDetail, EmptyHeader, EmptyMedia, EmptyTitle } from './chunk-H7JEKEVY.js';
25
28
  export { FeedbackState } from './chunk-ASV4A4YB.js';
26
29
  export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle } from './chunk-MRDIIUUY.js';
27
30
  export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField } from './chunk-WLLPGOQ7.js';
28
31
  export { Label } from './chunk-ATSXKARJ.js';
29
32
  export { HoverCard, HoverCardContent, HoverCardTrigger } from './chunk-5GU3MTAL.js';
30
33
  export { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot } from './chunk-6RAWJDPH.js';
31
- export { Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle } from './chunk-XHSP2SJ2.js';
32
34
  export { ConnectedPanel, ConnectedPanelBody, ConnectedPanelContent, ConnectedPanelDescription, ConnectedPanelFooter, ConnectedPanelHeader, ConnectedPanelTitle, ConnectedPanelTrigger } from './chunk-F52PXIER.js';
33
35
  export { ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger } from './chunk-XLSK66GO.js';
36
+ export { CopyButton, CopyButtonFeedback } from './chunk-FAOZ6X2C.js';
34
37
  export { Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHandle, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger } from './chunk-TAXYD4I4.js';
35
38
  import './chunk-CAS7T4PQ.js';
36
39
  export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from './chunk-QCNBLY6M.js';
37
- export { Empty, EmptyContent, EmptyDescription, EmptyErrorDetail, EmptyHeader, EmptyMedia, EmptyTitle } from './chunk-H7JEKEVY.js';
38
- export { CopyButton, CopyButtonFeedback } from './chunk-FAOZ6X2C.js';
39
40
  export { Carousel, CarouselContent, CarouselDots, CarouselItem, CarouselNext, CarouselPrevious, useCarousel } from './chunk-AOX2S6EH.js';
40
41
  export { ChatComposer } from './chunk-XUOJLQ75.js';
41
42
  export { ChatMessage, ChatMessageList } from './chunk-EAWOBJ24.js';
@@ -46,28 +47,32 @@ export { ChatTypingIndicator } from './chunk-ICVKZEAA.js';
46
47
  export { Checkbox } from './chunk-XUMQEMB3.js';
47
48
  export { Collapsible, CollapsibleContent, CollapsibleIndicator, CollapsibleTrigger } from './chunk-2GKXGY2X.js';
48
49
  export { AnimatedCheck } from './chunk-WVMYVQE2.js';
50
+ import './chunk-6HKGC3HE.js';
51
+ export { ArtPlate } from './chunk-HPUHI2YJ.js';
49
52
  export { Badge } from './chunk-YB2OXQAI.js';
50
53
  export { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from './chunk-FREL2MPS.js';
51
54
  export { DestinationIndicator, DestinationLink } from './chunk-IPU75YIQ.js';
55
+ import './chunk-3LGXD3HE.js';
56
+ import './chunk-6VV4EBOO.js';
52
57
  export { Tooltip, TooltipPopup as TooltipContent, TooltipCreateHandle, TooltipPopup, TooltipPrimitive, TooltipProvider, TooltipTrigger } from './chunk-KJMIFN46.js';
58
+ export { Sheet, SheetBackdrop, SheetClose, SheetPopup as SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetBackdrop as SheetOverlay, SheetPanel, SheetPopup, SheetPortal, SheetPrimitive, SheetTitle, SheetTrigger, SheetViewport } from './chunk-BSDSLG3L.js';
53
59
  export { ScrollableList, scrollableListControlClassNames } from './chunk-ZSP4XLPE.js';
54
60
  export { Select, SelectContent, SelectGroup, SelectGroupLabel, SelectItem, SelectPopup, SelectSeparator, SelectTrigger, SelectValue, selectTriggerDefaultClassName } from './chunk-MOWXMXSH.js';
55
- export { Sheet, SheetBackdrop, SheetClose, SheetPopup as SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetBackdrop as SheetOverlay, SheetPanel, SheetPopup, SheetPortal, SheetPrimitive, SheetTitle, SheetTrigger, SheetViewport } from './chunk-BSDSLG3L.js';
56
- export { Progress, ProgressIndicator, ProgressLabel, ProgressPrimitive, ProgressTrack, ProgressValue } from './chunk-JRMKDIGF.js';
57
61
  export { NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuPositioner, NavigationMenuTrigger, NavigationMenuViewport, navigationMenuTriggerStyle } from './chunk-IHEBXCAF.js';
62
+ export { Progress, ProgressIndicator, ProgressLabel, ProgressPrimitive, ProgressTrack, ProgressValue } from './chunk-JRMKDIGF.js';
58
63
  import './chunk-GZPV4T4I.js';
59
64
  import './chunk-2QUN4K6Z.js';
65
+ export { Command, CommandCollection, CommandCreateHandle, CommandDialog, CommandDialogBackdrop, CommandDialogPopup, CommandDialogPortal, CommandDialogTrigger, CommandDialogViewport, CommandEmpty, CommandFooter, CommandGroup, CommandGroupLabel, CommandInput, CommandItem, CommandList, CommandPanel, CommandSeparator, CommandShortcut } from './chunk-CJAWGKA5.js';
60
66
  export { Dialog, DialogBackdrop, DialogClose, DialogPopup as DialogContent, DialogCreateHandle, DialogDescription, DialogFooter, DialogHeader, DialogBackdrop as DialogOverlay, DialogPanel, DialogPopup, DialogPortal, DialogPrimitive, DialogTitle, DialogTrigger, DialogViewport } from './chunk-LKERWO2G.js';
67
+ export { Card, CardAction, CardContent, CardCursorLabel, CardDescription, CardFooter, CardHeader, CardLabel, CardMedia, CardMediaOverlay, CardMediaOverlayBottom, CardMediaOverlayIconButton, CardMediaOverlayImage, CardMediaOverlayScrim, CardMediaOverlayTopRight, CardTags, CardTitle, cardLinkClassName, useCardCursor } from './chunk-KC6GYHDU.js';
61
68
  export { Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputPrimitive } from './chunk-PAWFTQV6.js';
62
69
  export { Textarea } from './chunk-NBBMTH3K.js';
63
- export { Command, CommandCollection, CommandCreateHandle, CommandDialog, CommandDialogBackdrop, CommandDialogPopup, CommandDialogPortal, CommandDialogTrigger, CommandDialogViewport, CommandEmpty, CommandFooter, CommandGroup, CommandGroupLabel, CommandInput, CommandItem, CommandList, CommandPanel, CommandSeparator, CommandShortcut } from './chunk-CJAWGKA5.js';
64
70
  export { Autocomplete, AutocompleteClear, AutocompleteCollection, AutocompleteEmpty, AutocompleteGroup, AutocompleteGroupLabel, AutocompleteInput, AutocompleteItem, AutocompleteList, AutocompletePopup, AutocompletePrimitive, AutocompleteRow, AutocompleteSeparator, AutocompleteStatus, AutocompleteTrigger, AutocompleteValue, useAutocompleteFilter } from './chunk-C3MWASGU.js';
65
71
  export { Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, AvatarPrimitive } from './chunk-ITVGYZ7X.js';
66
72
  export { ButtonGroup, ButtonGroupProvider, ButtonGroupSeparator, ButtonGroupText, useButtonGroupContext } from './chunk-RI5ZROIJ.js';
67
73
  export { Separator, SeparatorPrimitive } from './chunk-R35FHBSP.js';
68
- export { Card, CardAction, CardContent, CardCursorLabel, CardDescription, CardFooter, CardHeader, CardLabel, CardMedia, CardMediaOverlay, CardMediaOverlayBottom, CardMediaOverlayIconButton, CardMediaOverlayImage, CardMediaOverlayScrim, CardMediaOverlayTopRight, CardTags, CardTitle, cardLinkClassName, useCardCursor } from './chunk-KC6GYHDU.js';
69
74
  export { Slider, SliderValue } from './chunk-6EFUKXXN.js';
70
- export { SegmentedControl } from './chunk-T7FUZUZO.js';
75
+ export { SegmentedControl } from './chunk-QU33S646.js';
71
76
  export { Frame, FrameDescription, FrameFooter, FrameHeader, FramePanel, FrameTitle } from './chunk-VNBJK2HH.js';
72
77
  import './chunk-KQ7W3CBS.js';
73
78
  export { ScrollArea, ScrollBar } from './chunk-Q2BXME6U.js';
@@ -4,7 +4,16 @@ import { M as MediaLightboxLabels, a as MediaLightboxProps, b as MediaLightboxTr
4
4
  export { c as MediaLightboxAppearance, d as MediaLightboxItem, e as MediaLightboxItemKind, f as MediaLightboxVideoSource, g as MediaLightboxVideoTrack } from '../types-KQLxlHQZ.js';
5
5
 
6
6
  declare const clearImageAnimationCache: () => void;
7
- type AspectRatio = 'auto' | '1/1' | '4/3' | '3/4' | '16/9' | '9/16' | '2/3' | '3/2' | '5/4' | '21/9' | '9/21';
7
+ type AspectRatio = 'auto' | 'fill' | '1/1' | '4/3' | '3/4' | '16/9' | '9/16' | '2/3' | '3/2' | '5/4' | '21/9' | '9/21';
8
+ /** One art-directed `<source>` of a responsive image. */
9
+ interface ImageSource {
10
+ /** Media query that selects this source, such as `(max-width: 767px)`. */
11
+ media?: string;
12
+ sizes?: string;
13
+ srcSet: string;
14
+ /** MIME type, such as `image/avif`. */
15
+ type?: string;
16
+ }
8
17
  interface ImageProps extends React.HTMLAttributes<HTMLDivElement> {
9
18
  alt?: string;
10
19
  aspectRatio?: AspectRatio;
@@ -23,9 +32,21 @@ interface ImageProps extends React.HTMLAttributes<HTMLDivElement> {
23
32
  rootMargin?: string;
24
33
  showSkeleton?: boolean;
25
34
  skeletonClassName?: string;
35
+ /**
36
+ * Layout width of the image for the browser to pick a `srcSet` candidate,
37
+ * such as `100vw`. Used with `srcSet` or `sources`.
38
+ */
39
+ sizes?: string;
40
+ /**
41
+ * Art-directed sources, tried in order before `src`. Passing `sources` or
42
+ * `srcSet` renders a native `<picture>`/`<img>` with native lazy loading.
43
+ */
44
+ sources?: ImageSource[];
26
45
  src?: string;
46
+ /** Width candidates for `src`, such as `plate-960.webp 960w, plate-1920.webp 1920w`. */
47
+ srcSet?: string;
27
48
  }
28
- declare const Image: ({ src, alt, className, imageClassName, aspectRatio, fallbackText, errorText, showSkeleton, skeletonClassName, containerClassName, lazy, rootMargin, priority, forceNoLazy, onLoad, onError, decoding, fetchPriority, ...props }: ImageProps) => React$1.JSX.Element;
49
+ declare const Image: ({ sizes, sources, srcSet, ...props }: ImageProps) => React$1.JSX.Element;
29
50
 
30
51
  /**
31
52
  * English defaults so the common case needs no wiring. A localized surface
@@ -217,4 +238,4 @@ interface VideoThumbnailProps {
217
238
  declare function VideoThumbnail({ src, className }: VideoThumbnailProps): React$1.JSX.Element;
218
239
 
219
240
  export { DEFAULT_MEDIA_LIGHTBOX_LABELS, Image, MediaLightbox, MediaLightboxLabels, MediaLightboxProps, MediaLightboxTransition, MediaLightboxZoomCursor, Video, VideoDialog, VideoManagerContext, VideoManagerProvider, VideoModal, VideoThumbnail, clearImageAnimationCache, isVideoSrc, useMediaLightbox, useMediaLightboxZoomCursor, useVideoManager };
220
- export type { AspectRatio, ImageProps, UseMediaLightboxOptions, UseMediaLightboxResult, VideoDialogProps, VideoManagerContextType, VideoManagerProviderProps, VideoModalInteractionMode, VideoModalProps, VideoProps, VideoSource, VideoThumbnailProps };
241
+ export type { AspectRatio, ImageProps, ImageSource, UseMediaLightboxOptions, UseMediaLightboxResult, VideoDialogProps, VideoManagerContextType, VideoManagerProviderProps, VideoModalInteractionMode, VideoModalProps, VideoProps, VideoSource, VideoThumbnailProps };
@@ -1,369 +1,17 @@
1
- import { useReducedMotion, Lightbox, revealOrigin, supportsViewTransitions, preferCheapMediaTransition, runMediaViewTransition, useLightboxRefs, useLightboxConfig, useLightboxState, CHROME_IN, CHROME_OUT, CHROME_EXIT_OFFSET, AXIS_LOCK_THRESHOLD } from '../chunk-IXWOWQBP.js';
2
- export { DEFAULT_MEDIA_LIGHTBOX_LABELS } from '../chunk-IXWOWQBP.js';
1
+ import { Lightbox, revealOrigin, supportsViewTransitions, preferCheapMediaTransition, runMediaViewTransition, useLightboxRefs, useLightboxConfig, useLightboxState, CHROME_IN, CHROME_OUT, CHROME_EXIT_OFFSET, AXIS_LOCK_THRESHOLD } from '../chunk-ALARPBUL.js';
2
+ export { DEFAULT_MEDIA_LIGHTBOX_LABELS } from '../chunk-ALARPBUL.js';
3
3
  import '../chunk-IPU75YIQ.js';
4
+ import { Image } from '../chunk-3LGXD3HE.js';
5
+ export { Image, clearImageAnimationCache } from '../chunk-3LGXD3HE.js';
6
+ import { useReducedMotion } from '../chunk-6VV4EBOO.js';
4
7
  import '../chunk-WKORZULQ.js';
5
8
  import { cn } from '../chunk-AJLHJRK6.js';
6
- import { motion, AnimatePresence } from 'motion/react';
7
- import * as React from 'react';
8
- import { memo, forwardRef, createContext, useRef, useEffect, useState, useCallback, useMemo, useContext } from 'react';
9
- import { jsxs, jsx } from 'react/jsx-runtime';
10
9
  import { Plus, LoaderCircle, ZoomOut, ZoomIn, X, ChevronLeft, ChevronRight, Play, Maximize } from 'lucide-react';
10
+ import { AnimatePresence, motion } from 'motion/react';
11
+ import { forwardRef, createContext, useRef, useState, useCallback, useMemo, useContext, useEffect } from 'react';
12
+ import { jsxs, jsx } from 'react/jsx-runtime';
11
13
  import { Dialog } from '@base-ui/react/dialog';
12
14
 
13
- function useIntersectionObserver(options = {}) {
14
- const {
15
- threshold = 0.1,
16
- root = null,
17
- rootMargin = "50px",
18
- // Load content 50px before it enters viewport
19
- freezeOnceVisible = false
20
- } = options;
21
- const elementRef = useRef(null);
22
- const [isIntersecting, setIsIntersecting] = useState(false);
23
- useEffect(() => {
24
- const element = elementRef.current;
25
- if (!element) return;
26
- const observer = new IntersectionObserver(
27
- ([entry]) => {
28
- const isElementIntersecting = entry.isIntersecting;
29
- setIsIntersecting(isElementIntersecting);
30
- if (isElementIntersecting && freezeOnceVisible) {
31
- observer.unobserve(element);
32
- }
33
- },
34
- { threshold, root, rootMargin }
35
- );
36
- observer.observe(element);
37
- return () => {
38
- observer.disconnect();
39
- };
40
- }, [threshold, root, rootMargin, freezeOnceVisible]);
41
- return [elementRef, isIntersecting];
42
- }
43
-
44
- // src/media/hooks/use-lazy-media.ts
45
- function useLazyMedia(options = {}) {
46
- const {
47
- rootMargin = "100px",
48
- // Start loading 100px before entering viewport
49
- threshold = 0.1,
50
- enabled = true
51
- } = options;
52
- const [hasLoaded, setHasLoaded] = useState(!enabled);
53
- const [elementRef, isIntersecting] = useIntersectionObserver({
54
- rootMargin,
55
- threshold,
56
- freezeOnceVisible: true
57
- // Once visible, stay loaded
58
- });
59
- const shouldLoad = isIntersecting || hasLoaded;
60
- const markAsLoaded = useCallback(() => {
61
- setHasLoaded(true);
62
- }, []);
63
- return {
64
- ref: elementRef,
65
- shouldLoad,
66
- isIntersecting,
67
- hasLoaded,
68
- markAsLoaded
69
- };
70
- }
71
- var MOBILE_BREAKPOINT = 768;
72
- function useIsMobile() {
73
- const [isMobile, setIsMobile] = React.useState(void 0);
74
- React.useEffect(() => {
75
- const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
76
- const onChange = () => {
77
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
78
- };
79
- mql.addEventListener("change", onChange);
80
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
81
- return () => mql.removeEventListener("change", onChange);
82
- }, []);
83
- return !!isMobile;
84
- }
85
- function Skeleton({ className }) {
86
- return /* @__PURE__ */ jsx("div", { className: cn("animate-pulse rounded-md bg-muted", className) });
87
- }
88
- var animatedImagesCache = /* @__PURE__ */ new Set();
89
- var IMAGE_REVEAL_INITIAL = { opacity: 0, scale: 1.02 };
90
- var IMAGE_REVEAL_ANIMATE = { opacity: 1, scale: 1 };
91
- var IMAGE_REVEAL_TRANSITION = {
92
- duration: 0.4,
93
- ease: [0.25, 0.46, 0.45, 0.94]
94
- };
95
- var clearImageAnimationCache = () => animatedImagesCache.clear();
96
- var Image = ({
97
- src,
98
- alt,
99
- className,
100
- imageClassName,
101
- aspectRatio = "16/9",
102
- fallbackText = "No image provided",
103
- errorText = "Failed to load image",
104
- showSkeleton = true,
105
- skeletonClassName,
106
- containerClassName,
107
- lazy = true,
108
- rootMargin = "100px",
109
- priority = false,
110
- forceNoLazy = false,
111
- onLoad,
112
- onError,
113
- decoding = "async",
114
- fetchPriority = "auto",
115
- ...props
116
- }) => {
117
- const [isLoading, setIsLoading] = useState(true);
118
- const [hasError, setHasError] = useState(false);
119
- const [imageSrc, setImageSrc] = useState(null);
120
- const [imageDimensions, setImageDimensions] = useState(
121
- null
122
- );
123
- const isMobile = useIsMobile();
124
- const reducedMotion = useReducedMotion();
125
- const shouldUseLazy = lazy && !priority && !forceNoLazy;
126
- const { ref: lazyRef, shouldLoad } = useLazyMedia({
127
- rootMargin: shouldUseLazy ? rootMargin : "0px",
128
- // Reduce unnecessary triggering
129
- enabled: shouldUseLazy
130
- });
131
- useEffect(() => {
132
- if (!src) {
133
- setHasError(true);
134
- setIsLoading(false);
135
- return;
136
- }
137
- if (!shouldUseLazy || shouldLoad) {
138
- if (imageSrc === src) {
139
- return;
140
- }
141
- setIsLoading(true);
142
- setHasError(false);
143
- const img = new window.Image();
144
- if (decoding) {
145
- img.decoding = decoding;
146
- }
147
- if (fetchPriority && "fetchPriority" in img) {
148
- img.fetchPriority = fetchPriority;
149
- }
150
- const loadImage = () => {
151
- if ("decode" in img && decoding === "async") {
152
- img.decode().then(() => {
153
- setImageSrc(src);
154
- setImageDimensions({ width: img.naturalWidth, height: img.naturalHeight });
155
- setIsLoading(false);
156
- onLoad?.();
157
- }).catch(() => {
158
- setImageSrc(src);
159
- setImageDimensions({ width: img.naturalWidth, height: img.naturalHeight });
160
- setIsLoading(false);
161
- onLoad?.();
162
- });
163
- } else {
164
- img.onload = () => {
165
- setImageSrc(src);
166
- setImageDimensions({ width: img.naturalWidth, height: img.naturalHeight });
167
- setIsLoading(false);
168
- onLoad?.();
169
- };
170
- }
171
- };
172
- img.onerror = () => {
173
- setIsLoading(false);
174
- if (onError) {
175
- onError();
176
- return;
177
- }
178
- setHasError(true);
179
- };
180
- img.src = src;
181
- loadImage();
182
- }
183
- }, [src, shouldUseLazy, shouldLoad, imageSrc, onLoad, onError, decoding, fetchPriority]);
184
- const getAspectRatioClass = () => {
185
- switch (aspectRatio) {
186
- case "auto": {
187
- if (isLoading && !imageDimensions) {
188
- return "aspect-[4/3]";
189
- }
190
- return "";
191
- }
192
- case "1/1": {
193
- return "aspect-square";
194
- }
195
- case "4/3": {
196
- return "aspect-[4/3]";
197
- }
198
- case "3/4": {
199
- return "aspect-[3/4]";
200
- }
201
- case "16/9": {
202
- return "aspect-video";
203
- }
204
- case "9/16": {
205
- return "aspect-[9/16]";
206
- }
207
- case "2/3": {
208
- return "aspect-[2/3]";
209
- }
210
- case "3/2": {
211
- return "aspect-[3/2]";
212
- }
213
- case "5/4": {
214
- return "aspect-[5/4]";
215
- }
216
- case "21/9": {
217
- return "aspect-[21/9]";
218
- }
219
- case "9/21": {
220
- return "aspect-[9/21]";
221
- }
222
- default: {
223
- return "aspect-video";
224
- }
225
- }
226
- };
227
- if (!src) {
228
- return /* @__PURE__ */ jsx(
229
- "div",
230
- {
231
- className: cn(
232
- "flex items-center justify-center bg-muted p-8",
233
- getAspectRatioClass(),
234
- containerClassName,
235
- className
236
- ),
237
- ...props,
238
- children: /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: fallbackText })
239
- }
240
- );
241
- }
242
- if (hasError) {
243
- return /* @__PURE__ */ jsx(
244
- "div",
245
- {
246
- className: cn(
247
- "flex items-center justify-center bg-muted p-8",
248
- getAspectRatioClass(),
249
- containerClassName,
250
- className
251
- ),
252
- ...props,
253
- children: /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: errorText })
254
- }
255
- );
256
- }
257
- const aspectRatioStyle = aspectRatio === "auto" && imageDimensions ? { aspectRatio: `${imageDimensions.width} / ${imageDimensions.height}` } : void 0;
258
- return /* @__PURE__ */ jsxs(
259
- "div",
260
- {
261
- className: cn("relative", getAspectRatioClass(), className, containerClassName),
262
- ref: shouldUseLazy ? lazyRef : void 0,
263
- style: aspectRatioStyle,
264
- ...props,
265
- children: [
266
- isLoading && showSkeleton && /* @__PURE__ */ jsx(Skeleton, { className: cn("absolute inset-0 h-full w-full", skeletonClassName) }),
267
- imageSrc && /* @__PURE__ */ jsx(
268
- ImageDisplay,
269
- {
270
- alt,
271
- aspectRatio,
272
- imageClassName,
273
- imageDimensions,
274
- imageSrc,
275
- isMobile,
276
- reducedMotion
277
- }
278
- )
279
- ]
280
- }
281
- );
282
- };
283
- var ImageDisplayComponent = ({
284
- imageSrc,
285
- alt,
286
- imageClassName,
287
- aspectRatio,
288
- imageDimensions,
289
- isMobile,
290
- reducedMotion
291
- }) => {
292
- const hasAnimatedBefore = animatedImagesCache.has(imageSrc);
293
- const animationTimerRef = useRef(null);
294
- useEffect(() => {
295
- if (!hasAnimatedBefore) {
296
- animationTimerRef.current = setTimeout(() => {
297
- animatedImagesCache.add(imageSrc);
298
- }, 500);
299
- }
300
- return () => {
301
- if (animationTimerRef.current) {
302
- clearTimeout(animationTimerRef.current);
303
- }
304
- };
305
- }, [imageSrc, hasAnimatedBefore]);
306
- const skipAnimation = hasAnimatedBefore || reducedMotion || isMobile;
307
- if (aspectRatio === "auto") {
308
- return skipAnimation ? /* @__PURE__ */ jsx(
309
- "img",
310
- {
311
- alt: alt || "Image",
312
- className: cn("h-auto w-full object-cover", imageClassName),
313
- decoding: "async",
314
- height: imageDimensions?.height ?? 600,
315
- src: imageSrc,
316
- style: { pointerEvents: "none" },
317
- width: imageDimensions?.width ?? 800
318
- }
319
- ) : /* @__PURE__ */ jsx(
320
- motion.img,
321
- {
322
- alt: alt || "Image",
323
- animate: { opacity: 1, scale: 1 },
324
- className: cn("h-auto w-full object-cover", imageClassName),
325
- decoding: "async",
326
- height: imageDimensions?.height ?? 600,
327
- initial: IMAGE_REVEAL_INITIAL,
328
- src: imageSrc,
329
- style: { pointerEvents: "none" },
330
- transition: IMAGE_REVEAL_TRANSITION,
331
- width: imageDimensions?.width ?? 800
332
- }
333
- );
334
- }
335
- return /* @__PURE__ */ jsx("div", { "aria-label": alt || "Image", className: "absolute inset-0 overflow-hidden", role: "img", children: skipAnimation ? (
336
- // Static for mobile/reduced motion/already animated - no animation conflicts
337
- /* @__PURE__ */ jsx(
338
- "div",
339
- {
340
- className: cn("absolute inset-0 bg-cover bg-center bg-no-repeat", imageClassName),
341
- style: {
342
- backgroundImage: `url("${imageSrc}")`,
343
- pointerEvents: "none"
344
- }
345
- }
346
- )
347
- ) : (
348
- // Framer Motion for desktop - but only animate on initial load
349
- /* @__PURE__ */ jsx(
350
- motion.div,
351
- {
352
- animate: IMAGE_REVEAL_ANIMATE,
353
- className: cn("absolute inset-0 bg-cover bg-center bg-no-repeat", imageClassName),
354
- initial: IMAGE_REVEAL_INITIAL,
355
- style: {
356
- backgroundImage: `url("${imageSrc}")`,
357
- pointerEvents: "none"
358
- },
359
- transition: IMAGE_REVEAL_TRANSITION
360
- }
361
- )
362
- ) });
363
- };
364
- var ImageDisplay = memo(ImageDisplayComponent, (prevProps, nextProps) => {
365
- return prevProps.imageSrc === nextProps.imageSrc && prevProps.aspectRatio === nextProps.aspectRatio && prevProps.isMobile === nextProps.isMobile && prevProps.reducedMotion === nextProps.reducedMotion;
366
- });
367
15
  var CHROME_IDLE_MS = 2500;
368
16
  function isRevealingPointer(event) {
369
17
  return event.pointerType !== "touch" && event.pointerType !== "pen";
@@ -1688,6 +1336,6 @@ function VideoThumbnail({ src, className }) {
1688
1336
  );
1689
1337
  }
1690
1338
 
1691
- export { Image, MediaLightbox, MediaLightboxZoomCursor, Video, VideoDialog, VideoManagerContext, VideoManagerProvider, VideoModal, VideoThumbnail, clearImageAnimationCache, isVideoSrc, useMediaLightbox, useMediaLightboxZoomCursor, useVideoManager };
1339
+ export { MediaLightbox, MediaLightboxZoomCursor, Video, VideoDialog, VideoManagerContext, VideoManagerProvider, VideoModal, VideoThumbnail, isVideoSrc, useMediaLightbox, useMediaLightboxZoomCursor, useVideoManager };
1692
1340
  //# sourceMappingURL=index.js.map
1693
1341
  //# sourceMappingURL=index.js.map