@latte-macchiat-io/latte-vanilla-components 0.0.309 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@latte-macchiat-io/latte-vanilla-components",
3
- "version": "0.0.309",
3
+ "version": "0.0.311",
4
4
  "description": "Beautiful components for amazing projects, with a touch of Vanilla 🥤",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -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: {
@@ -89,26 +90,61 @@ export const carouselItem = style(
89
90
  globalStyle(`${carouselItem} > div`, {
90
91
  '@media': {
91
92
  ...generateResponsiveMedia({
92
- paddingBottom: combineResponsive(themeContract.carousel.bullet.height, themeContract.carousel.bullet.bottom),
93
+ marginBottom: combineResponsive(themeContract.carousel.bullet.height, themeContract.carousel.bullet.bottom),
93
94
  }),
94
95
  },
95
96
  });
96
97
 
97
- export const carouselNav = style(
98
+ export const carouselNav = recipe(
98
99
  {
99
- left: 0,
100
- right: 0,
101
- bottom: 0,
102
- zIndex: 30,
103
- width: '100%',
104
- display: 'flex',
105
- position: 'absolute',
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
- gap: themeContract.space.sm,
110
- padding: themeContract.space.md,
111
- maxWidth: themeContract.maxWidth,
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>;
@@ -1,13 +1,5 @@
1
1
  const themeCarouselBase = {
2
2
  carousel: {
3
- gap: {
4
- mobile: '15',
5
- sm: '15',
6
- md: '30',
7
- lg: '30',
8
- xl: '50',
9
- '2xl': '50',
10
- },
11
3
  nav: {
12
4
  borderRadius: '1000px',
13
5
  width: {