@arobo/react 1.1.3 → 1.1.5

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.
@@ -22,5 +22,7 @@ type CarouselPreviousProps = React.ComponentProps<typeof Button>;
22
22
  declare function CarouselPrevious({ className, size, variant, children, ...props }: CarouselPreviousProps): import("react/jsx-runtime").JSX.Element;
23
23
  type CarouselNextProps = React.ComponentProps<typeof Button>;
24
24
  declare function CarouselNext({ className, size, variant, children, ...props }: CarouselNextProps): import("react/jsx-runtime").JSX.Element;
25
- export { Carousel as CarouselRoot, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext, };
25
+ type CarouselDotsProps = React.ComponentProps<"div">;
26
+ declare function CarouselDots({ className, ...props }: CarouselDotsProps): import("react/jsx-runtime").JSX.Element;
27
+ export { Carousel as CarouselRoot, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext, CarouselDots, };
26
28
  export type { CarouselProps as CarouselRootProps, CarouselContentProps, CarouselItemProps, CarouselPreviousProps, CarouselNextProps, };
@@ -133,7 +133,7 @@ function CarouselPrevious({
133
133
  isDisabled: !canScrollPrev,
134
134
  size: size,
135
135
  variant: variant,
136
- className: cn("absolute size-8 rounded-full", orientation === "horizontal" ? "top-1/2 -left-12 -translate-y-1/2" : "-top-12 left-1/2 -translate-x-1/2 rotate-90", className),
136
+ className: cn("absolute size-8 rounded-full hover:bg-accent hover:text-white transition-colors", orientation === "horizontal" ? "top-1/2 -left-12 -translate-y-1/2" : "-top-12 left-1/2 -translate-x-1/2 rotate-90", className),
137
137
  onClick: scrollPrev,
138
138
  ...props,
139
139
  children: children ? children : /*#__PURE__*/jsx(ArrowLeft, {})
@@ -156,11 +156,41 @@ function CarouselNext({
156
156
  isDisabled: !canScrollNext,
157
157
  size: size,
158
158
  variant: variant,
159
- className: cn("absolute size-8 rounded-full", orientation === "horizontal" ? "top-1/2 -right-12 -translate-y-1/2" : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90", className),
159
+ className: cn("absolute size-8 rounded-full hover:bg-accent hover:text-white transition-colors", orientation === "horizontal" ? "top-1/2 -right-12 -translate-y-1/2" : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90", className),
160
160
  onClick: scrollNext,
161
161
  ...props,
162
162
  children: children ? children : /*#__PURE__*/jsx(ArrowRight, {})
163
163
  });
164
164
  }
165
+ function CarouselDots({
166
+ className,
167
+ ...props
168
+ }) {
169
+ const {
170
+ api,
171
+ orientation
172
+ } = useCarousel();
173
+ const [scrollSnaps, setScrollSnaps] = React.useState([]);
174
+ const [selectedIndex, setSelectedIndex] = React.useState(0);
175
+ React.useEffect(() => {
176
+ if (!api) return;
177
+ setScrollSnaps(api.scrollSnapList());
178
+ setSelectedIndex(api.selectedScrollSnap());
179
+ api.on("select", () => setSelectedIndex(api.selectedScrollSnap()));
180
+ return () => {
181
+ api?.off("select", () => setSelectedIndex(api.selectedScrollSnap()));
182
+ };
183
+ }, [api]);
184
+ return /*#__PURE__*/jsx("div", {
185
+ className: cn("flex justify-center gap-2", orientation === "vertical" ? "flex-col" : "", className),
186
+ "data-slot": "carousel-dots",
187
+ ...props,
188
+ children: scrollSnaps.map((_, index) => /*#__PURE__*/jsx("div", {
189
+ className: cn("min-h-3 min-w-3 rounded-full transition-all cursor-pointer mt-4 border", selectedIndex === index ? "bg-accent" : "bg-gray-100"),
190
+ onClick: () => api?.scrollTo(index),
191
+ "aria-label": `Go to slide ${index + 1}`
192
+ }, index))
193
+ });
194
+ }
165
195
 
166
- export { CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Carousel as CarouselRoot };
196
+ export { CarouselContent, CarouselDots, CarouselItem, CarouselNext, CarouselPrevious, Carousel as CarouselRoot };
@@ -1,9 +1,10 @@
1
- import { CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, CarouselRoot } from "./carousel";
1
+ import { CarouselContent, CarouselDots, CarouselItem, CarouselNext, CarouselPrevious, CarouselRoot } from "./carousel";
2
2
  export declare const Carousel: typeof CarouselRoot & {
3
3
  Content: typeof CarouselContent;
4
4
  Item: typeof CarouselItem;
5
5
  Previous: typeof CarouselPrevious;
6
6
  Next: typeof CarouselNext;
7
+ Dot: typeof CarouselDots;
7
8
  };
8
9
  export type Carousel = {
9
10
  Props: React.ComponentProps<typeof CarouselRoot>;
@@ -12,6 +13,7 @@ export type Carousel = {
12
13
  ItemProps: React.ComponentProps<typeof CarouselItem>;
13
14
  PreviousProps: React.ComponentProps<typeof CarouselPrevious>;
14
15
  NextProps: React.ComponentProps<typeof CarouselNext>;
16
+ DotProps: React.ComponentProps<typeof CarouselDots>;
15
17
  };
16
18
  export { CarouselRoot, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext, };
17
19
  export type { CarouselApi, CarouselRootProps, CarouselContentProps, CarouselItemProps, CarouselPreviousProps, CarouselNextProps, } from "./carousel";
@@ -1,10 +1,11 @@
1
- import { CarouselRoot as Carousel$1, CarouselNext, CarouselPrevious, CarouselItem, CarouselContent } from './carousel.js';
1
+ import { CarouselRoot as Carousel$1, CarouselDots, CarouselNext, CarouselPrevious, CarouselItem, CarouselContent } from './carousel.js';
2
2
 
3
3
  const Carousel = Object.assign(Carousel$1, {
4
4
  Content: CarouselContent,
5
5
  Item: CarouselItem,
6
6
  Previous: CarouselPrevious,
7
- Next: CarouselNext
7
+ Next: CarouselNext,
8
+ Dot: CarouselDots
8
9
  });
9
10
 
10
11
  export { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Carousel$1 as CarouselRoot };
@@ -1,6 +1,8 @@
1
+ import type { ComponentProps } from "react";
1
2
  import type { DrawerCloseProps, DrawerContentProps, DrawerDescriptionProps, DrawerFooterProps, DrawerHeaderProps, DrawerOverlayProps, DrawerPortalProps, DrawerProps, DrawerTitleProps, DrawerTriggerProps } from "./drawer";
2
3
  import { DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerRoot, DrawerTitle, DrawerTrigger } from "./drawer";
3
4
  export declare const Drawer: typeof DrawerRoot & {
5
+ Root: typeof DrawerRoot;
4
6
  Trigger: typeof DrawerTrigger;
5
7
  Portal: typeof DrawerPortal;
6
8
  Close: typeof DrawerClose;
@@ -12,17 +14,17 @@ export declare const Drawer: typeof DrawerRoot & {
12
14
  Description: typeof DrawerDescription;
13
15
  };
14
16
  export type Drawer = {
15
- Props: React.ComponentProps<typeof DrawerRoot>;
16
- RootProps: React.ComponentProps<typeof DrawerRoot>;
17
- TriggerProps: React.ComponentProps<typeof DrawerTrigger>;
18
- PortalProps: React.ComponentProps<typeof DrawerPortal>;
19
- CloseProps: React.ComponentProps<typeof DrawerClose>;
20
- OverlayProps: React.ComponentProps<typeof DrawerOverlay>;
21
- ContentProps: React.ComponentProps<typeof DrawerContent>;
22
- HeaderProps: React.ComponentProps<typeof DrawerHeader>;
23
- FooterProps: React.ComponentProps<typeof DrawerFooter>;
24
- TitleProps: React.ComponentProps<typeof DrawerTitle>;
25
- DescriptionProps: React.ComponentProps<typeof DrawerDescription>;
17
+ Props: ComponentProps<typeof DrawerRoot>;
18
+ RootProps: ComponentProps<typeof DrawerRoot>;
19
+ TriggerProps: ComponentProps<typeof DrawerTrigger>;
20
+ PortalProps: ComponentProps<typeof DrawerPortal>;
21
+ CloseProps: ComponentProps<typeof DrawerClose>;
22
+ OverlayProps: ComponentProps<typeof DrawerOverlay>;
23
+ ContentProps: ComponentProps<typeof DrawerContent>;
24
+ HeaderProps: ComponentProps<typeof DrawerHeader>;
25
+ FooterProps: ComponentProps<typeof DrawerFooter>;
26
+ TitleProps: ComponentProps<typeof DrawerTitle>;
27
+ DescriptionProps: ComponentProps<typeof DrawerDescription>;
26
28
  };
27
29
  export { DrawerRoot, DrawerTrigger, DrawerPortal, DrawerClose, DrawerOverlay, DrawerContent, DrawerHeader, DrawerFooter, DrawerTitle, DrawerDescription, };
28
30
  export type { DrawerProps, DrawerTriggerProps, DrawerPortalProps, DrawerCloseProps, DrawerOverlayProps, DrawerContentProps, DrawerHeaderProps, DrawerFooterProps, DrawerTitleProps, DrawerDescriptionProps, };
@@ -5,6 +5,7 @@ import { DrawerRoot as Drawer$1, DrawerDescription, DrawerTitle, DrawerFooter, D
5
5
  * -----------------------------------------------------------------------------------------------*/
6
6
 
7
7
  const Drawer = Object.assign(Drawer$1, {
8
+ Root: Drawer$1,
8
9
  Trigger: DrawerTrigger,
9
10
  Portal: DrawerPortal,
10
11
  Close: DrawerClose,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arobo/react",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "files": [