@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.
- package/dist/components/carousel/carousel.d.ts +3 -1
- package/dist/components/carousel/carousel.js +33 -3
- package/dist/components/carousel/index.d.ts +3 -1
- package/dist/components/carousel/index.js +3 -2
- package/dist/components/drawer/index.d.ts +13 -11
- package/dist/components/drawer/index.js +1 -0
- package/package.json +1 -1
|
@@ -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
|
-
|
|
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:
|
|
16
|
-
RootProps:
|
|
17
|
-
TriggerProps:
|
|
18
|
-
PortalProps:
|
|
19
|
-
CloseProps:
|
|
20
|
-
OverlayProps:
|
|
21
|
-
ContentProps:
|
|
22
|
-
HeaderProps:
|
|
23
|
-
FooterProps:
|
|
24
|
-
TitleProps:
|
|
25
|
-
DescriptionProps:
|
|
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,
|