@latte-macchiat-io/latte-vanilla-components 0.0.310 → 0.0.311
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/package.json
CHANGED
@@ -11,6 +11,7 @@ import {
|
|
11
11
|
carouselItem,
|
12
12
|
carouselNav,
|
13
13
|
carouselNavButton,
|
14
|
+
CarouselNavVariants,
|
14
15
|
carouselRecipe,
|
15
16
|
carouselSlide,
|
16
17
|
type CarouselVariants,
|
@@ -23,7 +24,8 @@ import { useWindowSize } from '../../utils/useWindowSize';
|
|
23
24
|
import { Icon } from '../Icon';
|
24
25
|
|
25
26
|
export type CarouselProps = React.HTMLAttributes<HTMLDivElement> &
|
26
|
-
CarouselVariants &
|
27
|
+
CarouselVariants &
|
28
|
+
CarouselNavVariants & {
|
27
29
|
gap?: number;
|
28
30
|
data: ReactNode[];
|
29
31
|
itemsPerView?: number;
|
@@ -44,6 +46,8 @@ export const Carousel = ({
|
|
44
46
|
gap = 16,
|
45
47
|
isFullWidth,
|
46
48
|
className,
|
49
|
+
navPositionVertical,
|
50
|
+
navPositionHorizontal,
|
47
51
|
}: CarouselProps) => {
|
48
52
|
const { width: windowWidth } = useWindowSize();
|
49
53
|
const [currentIndex, setCurrentIndex] = useState(0);
|
@@ -171,7 +175,7 @@ export const Carousel = ({
|
|
171
175
|
</div>
|
172
176
|
|
173
177
|
{showNavButtons && (
|
174
|
-
<div className={carouselNav}>
|
178
|
+
<div className={carouselNav({ navPositionHorizontal, navPositionVertical })}>
|
175
179
|
<button type="button" className={carouselNavButton} onClick={handlePrevious} disabled={currentIndex === 0} aria-label="Previous slide">
|
176
180
|
<Icon icon="arrowBack" />
|
177
181
|
</button>
|
@@ -48,6 +48,7 @@ export const carouselRecipe = recipe(
|
|
48
48
|
},
|
49
49
|
},
|
50
50
|
},
|
51
|
+
navPosition: {},
|
51
52
|
},
|
52
53
|
|
53
54
|
defaultVariants: {
|
@@ -94,21 +95,56 @@ globalStyle(`${carouselItem} > div`, {
|
|
94
95
|
},
|
95
96
|
});
|
96
97
|
|
97
|
-
export const carouselNav =
|
98
|
+
export const carouselNav = recipe(
|
98
99
|
{
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
pointerEvents: 'none',
|
107
|
-
justifyContent: 'flex-end',
|
100
|
+
base: {
|
101
|
+
zIndex: 30,
|
102
|
+
width: '100%',
|
103
|
+
display: 'flex',
|
104
|
+
position: 'absolute',
|
105
|
+
pointerEvents: 'none',
|
106
|
+
justifyContent: 'flex-end',
|
108
107
|
|
109
|
-
|
110
|
-
|
111
|
-
|
108
|
+
gap: themeContract.space.sm,
|
109
|
+
padding: themeContract.space.md,
|
110
|
+
maxWidth: themeContract.maxWidth,
|
111
|
+
},
|
112
|
+
|
113
|
+
variants: {
|
114
|
+
navPositionHorizontal: {
|
115
|
+
left: {
|
116
|
+
left: 0,
|
117
|
+
},
|
118
|
+
right: {
|
119
|
+
right: 0,
|
120
|
+
},
|
121
|
+
spaceBetween: {
|
122
|
+
left: 0,
|
123
|
+
right: 0,
|
124
|
+
},
|
125
|
+
center: {
|
126
|
+
left: 'auto',
|
127
|
+
right: 'auto',
|
128
|
+
},
|
129
|
+
},
|
130
|
+
|
131
|
+
navPositionVertical: {
|
132
|
+
top: {
|
133
|
+
top: 0,
|
134
|
+
},
|
135
|
+
center: {
|
136
|
+
top: '50%',
|
137
|
+
},
|
138
|
+
bottom: {
|
139
|
+
top: '100%',
|
140
|
+
},
|
141
|
+
},
|
142
|
+
},
|
143
|
+
|
144
|
+
defaultVariants: {
|
145
|
+
navPositionHorizontal: 'spaceBetween',
|
146
|
+
navPositionVertical: 'center',
|
147
|
+
},
|
112
148
|
},
|
113
149
|
'carousel-nav'
|
114
150
|
);
|
@@ -198,3 +234,4 @@ export const carouselBulletActive = style(
|
|
198
234
|
);
|
199
235
|
|
200
236
|
export type CarouselVariants = RecipeVariants<typeof carouselRecipe>;
|
237
|
+
export type CarouselNavVariants = RecipeVariants<typeof carouselNav>;
|