@mantine/carousel 6.0.16 → 7.0.0-alpha.20

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 (45) hide show
  1. package/cjs/Carousel.context.js +4 -3
  2. package/cjs/Carousel.context.js.map +1 -1
  3. package/cjs/Carousel.js +150 -118
  4. package/cjs/Carousel.js.map +1 -1
  5. package/cjs/Carousel.module.css.js +8 -0
  6. package/cjs/Carousel.module.css.js.map +1 -0
  7. package/cjs/CarouselSlide/CarouselSlide.js +17 -28
  8. package/cjs/CarouselSlide/CarouselSlide.js.map +1 -1
  9. package/cjs/CarouselVariables/CarouselVariables.js +45 -0
  10. package/cjs/CarouselVariables/CarouselVariables.js.map +1 -0
  11. package/cjs/get-chevron-rotation.js.map +1 -1
  12. package/cjs/index.css +205 -0
  13. package/cjs/index.js +3 -0
  14. package/cjs/index.js.map +1 -1
  15. package/cjs/use-animation-offset-effect.js.map +1 -1
  16. package/esm/Carousel.context.js +4 -3
  17. package/esm/Carousel.context.js.map +1 -1
  18. package/esm/Carousel.js +151 -118
  19. package/esm/Carousel.js.map +1 -1
  20. package/esm/Carousel.module.css.js +4 -0
  21. package/esm/Carousel.module.css.js.map +1 -0
  22. package/esm/CarouselSlide/CarouselSlide.js +19 -30
  23. package/esm/CarouselSlide/CarouselSlide.js.map +1 -1
  24. package/esm/CarouselVariables/CarouselVariables.js +37 -0
  25. package/esm/CarouselVariables/CarouselVariables.js.map +1 -0
  26. package/esm/get-chevron-rotation.js.map +1 -1
  27. package/esm/index.css +205 -0
  28. package/esm/index.js +2 -0
  29. package/esm/index.js.map +1 -1
  30. package/esm/use-animation-offset-effect.js.map +1 -1
  31. package/lib/Carousel.context.d.ts +8 -16
  32. package/lib/Carousel.context.d.ts.map +1 -1
  33. package/lib/Carousel.d.ts +54 -43
  34. package/lib/Carousel.d.ts.map +1 -1
  35. package/lib/CarouselSlide/CarouselSlide.d.ts +15 -12
  36. package/lib/CarouselSlide/CarouselSlide.d.ts.map +1 -1
  37. package/lib/CarouselVariables/CarouselVariables.d.ts +8 -0
  38. package/lib/CarouselVariables/CarouselVariables.d.ts.map +1 -0
  39. package/lib/get-chevron-rotation.d.ts +1 -2
  40. package/lib/get-chevron-rotation.d.ts.map +1 -1
  41. package/lib/index.d.ts +4 -2
  42. package/lib/index.d.ts.map +1 -1
  43. package/lib/use-animation-offset-effect.d.ts +2 -2
  44. package/lib/use-animation-offset-effect.d.ts.map +1 -1
  45. package/package.json +18 -11
@@ -2,10 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var utils = require('@mantine/utils');
6
- var Carousel_errors = require('./Carousel.errors.js');
5
+ var core = require('@mantine/core');
7
6
 
8
- const [CarouselProvider, useCarouselContext] = utils.createSafeContext(Carousel_errors.CAROUSEL_ERRORS.context);
7
+ const [CarouselProvider, useCarouselContext] = core.createSafeContext(
8
+ "Carousel component was not found in tree"
9
+ );
9
10
 
10
11
  exports.CarouselProvider = CarouselProvider;
11
12
  exports.useCarouselContext = useCarouselContext;
@@ -1 +1 @@
1
- {"version":3,"file":"Carousel.context.js","sources":["../src/Carousel.context.ts"],"sourcesContent":["import { MantineNumberSize, Styles, ClassNames } from '@mantine/core';\nimport { createSafeContext } from '@mantine/utils';\nimport { CAROUSEL_ERRORS } from './Carousel.errors';\nimport { CarouselOrientation, Embla, CarouselBreakpoint } from './types';\nimport type { CarouselStylesNames } from './Carousel';\n\ninterface CarouselContext {\n embla: Embla;\n slideSize: string | number;\n slideGap: MantineNumberSize;\n orientation: CarouselOrientation;\n includeGapInSize: boolean;\n breakpoints: CarouselBreakpoint[];\n classNames: ClassNames<CarouselStylesNames>;\n styles: Styles<CarouselStylesNames>;\n unstyled: boolean;\n variant: string;\n}\n\nexport const [CarouselProvider, useCarouselContext] = createSafeContext<CarouselContext>(\n CAROUSEL_ERRORS.context\n);\n"],"names":["createSafeContext","CAROUSEL_ERRORS"],"mappings":";;;;;;;AAEY,MAAC,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,GAAGA,uBAAiB,CAACC,+BAAe,CAAC,OAAO;;;;;"}
1
+ {"version":3,"file":"Carousel.context.js","sources":["../src/Carousel.context.ts"],"sourcesContent":["import { createSafeContext, GetStylesApi } from '@mantine/core';\nimport type { CarouselFactory } from './Carousel';\n\ninterface CarouselContextValue {\n getStyles: GetStylesApi<CarouselFactory>;\n orientation: 'horizontal' | 'vertical' | undefined;\n}\n\nexport const [CarouselProvider, useCarouselContext] = createSafeContext<CarouselContextValue>(\n 'Carousel component was not found in tree'\n);\n"],"names":["createSafeContext"],"mappings":";;;;;;AACY,MAAC,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,GAAGA,sBAAiB;AACvE,EAAE,0CAA0C;AAC5C;;;;;"}
package/cjs/Carousel.js CHANGED
@@ -2,21 +2,24 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var React = require('react');
5
6
  var core = require('@mantine/core');
6
7
  var hooks = require('@mantine/hooks');
7
8
  var useEmblaCarousel = require('embla-carousel-react');
8
- var React = require('react');
9
+ var getChevronRotation = require('./get-chevron-rotation.js');
9
10
  var Carousel_context = require('./Carousel.context.js');
10
- var Carousel_styles = require('./Carousel.styles.js');
11
11
  var CarouselSlide = require('./CarouselSlide/CarouselSlide.js');
12
- var getChevronRotation = require('./get-chevron-rotation.js');
12
+ var CarouselVariables = require('./CarouselVariables/CarouselVariables.js');
13
+ var Carousel_module = require('./Carousel.module.css.js');
13
14
 
14
15
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
15
16
 
16
- var useEmblaCarousel__default = /*#__PURE__*/_interopDefaultLegacy(useEmblaCarousel);
17
17
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
18
+ var useEmblaCarousel__default = /*#__PURE__*/_interopDefaultLegacy(useEmblaCarousel);
18
19
 
19
20
  var __defProp = Object.defineProperty;
21
+ var __defProps = Object.defineProperties;
22
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
20
23
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
21
24
  var __hasOwnProp = Object.prototype.hasOwnProperty;
22
25
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -32,6 +35,7 @@ var __spreadValues = (a, b) => {
32
35
  }
33
36
  return a;
34
37
  };
38
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
35
39
  var __objRest = (source, exclude) => {
36
40
  var target = {};
37
41
  for (var prop in source)
@@ -65,21 +69,33 @@ const defaultProps = {
65
69
  containScroll: "",
66
70
  withKeyboardEvents: true
67
71
  };
68
- const _Carousel = React.forwardRef((props, ref) => {
69
- const _a = core.useComponentDefaultProps("Carousel", defaultProps, props), {
70
- children,
72
+ const varsResolver = core.createVarsResolver(
73
+ (_, { height, controlSize, controlsOffset }) => ({
74
+ root: {
75
+ "--carousel-height": core.rem(height),
76
+ "--carousel-control-size": core.rem(controlSize),
77
+ "--carousel-controls-offset": core.getSpacing(controlsOffset)
78
+ }
79
+ })
80
+ );
81
+ const Carousel = core.factory((_props, ref) => {
82
+ const props = core.useProps("Carousel", defaultProps, _props);
83
+ const _a = props, {
84
+ classNames,
71
85
  className,
86
+ style,
87
+ styles,
88
+ unstyled,
89
+ vars,
90
+ children,
72
91
  getEmblaApi,
73
92
  onNextSlide,
74
93
  onPreviousSlide,
75
94
  onSlideChange,
76
- nextControlLabel,
77
- previousControlLabel,
95
+ nextControlProps,
96
+ previousControlProps,
78
97
  controlSize,
79
98
  controlsOffset,
80
- classNames,
81
- styles,
82
- unstyled,
83
99
  slideSize,
84
100
  slideGap,
85
101
  orientation,
@@ -98,25 +114,25 @@ const _Carousel = React.forwardRef((props, ref) => {
98
114
  plugins,
99
115
  nextControlIcon,
100
116
  previousControlIcon,
101
- breakpoints,
102
117
  skipSnaps,
103
118
  containScroll,
104
- withKeyboardEvents,
105
- variant
119
+ withKeyboardEvents
106
120
  } = _a, others = __objRest(_a, [
107
- "children",
121
+ "classNames",
108
122
  "className",
123
+ "style",
124
+ "styles",
125
+ "unstyled",
126
+ "vars",
127
+ "children",
109
128
  "getEmblaApi",
110
129
  "onNextSlide",
111
130
  "onPreviousSlide",
112
131
  "onSlideChange",
113
- "nextControlLabel",
114
- "previousControlLabel",
132
+ "nextControlProps",
133
+ "previousControlProps",
115
134
  "controlSize",
116
135
  "controlsOffset",
117
- "classNames",
118
- "styles",
119
- "unstyled",
120
136
  "slideSize",
121
137
  "slideGap",
122
138
  "orientation",
@@ -135,27 +151,41 @@ const _Carousel = React.forwardRef((props, ref) => {
135
151
  "plugins",
136
152
  "nextControlIcon",
137
153
  "previousControlIcon",
138
- "breakpoints",
139
154
  "skipSnaps",
140
155
  "containScroll",
141
- "withKeyboardEvents",
142
- "variant"
156
+ "withKeyboardEvents"
143
157
  ]);
144
- const { classes, cx, theme } = Carousel_styles['default']({ controlSize, controlsOffset, orientation, height, includeGapInSize, breakpoints, slideGap }, { name: "Carousel", classNames, styles, unstyled, variant });
145
- const [emblaRefElement, embla] = useEmblaCarousel__default({
146
- axis: orientation === "horizontal" ? "x" : "y",
147
- direction: orientation === "horizontal" ? theme.dir : void 0,
148
- startIndex: initialSlide,
149
- loop,
150
- align,
151
- slidesToScroll,
152
- draggable,
153
- dragFree,
154
- speed,
155
- inViewThreshold,
156
- skipSnaps,
157
- containScroll
158
- }, plugins);
158
+ const getStyles = core.useStyles({
159
+ name: "Carousel",
160
+ classes: Carousel_module['default'],
161
+ props,
162
+ className,
163
+ style,
164
+ classNames,
165
+ styles,
166
+ unstyled,
167
+ vars,
168
+ varsResolver
169
+ });
170
+ const responsiveClassName = core.useRandomClassName();
171
+ const { dir } = core.useDirection();
172
+ const [emblaRefElement, embla] = useEmblaCarousel__default(
173
+ {
174
+ axis: orientation === "horizontal" ? "x" : "y",
175
+ direction: orientation === "horizontal" ? dir : void 0,
176
+ startIndex: initialSlide,
177
+ loop,
178
+ align,
179
+ slidesToScroll,
180
+ draggable,
181
+ dragFree,
182
+ speed,
183
+ inViewThreshold,
184
+ skipSnaps,
185
+ containScroll
186
+ },
187
+ plugins
188
+ );
159
189
  const [selected, setSelected] = React.useState(0);
160
190
  const [slidesCount, setSlidesCount] = React.useState(0);
161
191
  const handleScroll = React.useCallback((index) => embla && embla.scrollTo(index), [embla]);
@@ -174,18 +204,21 @@ const _Carousel = React.forwardRef((props, ref) => {
174
204
  embla == null ? void 0 : embla.scrollNext();
175
205
  onNextSlide == null ? void 0 : onNextSlide();
176
206
  }, [embla]);
177
- const handleKeydown = React.useCallback((event) => {
178
- if (withKeyboardEvents) {
179
- if (event.key === "ArrowRight") {
180
- event.preventDefault();
181
- handleNext();
182
- }
183
- if (event.key === "ArrowLeft") {
184
- event.preventDefault();
185
- handlePrevious();
207
+ const handleKeydown = React.useCallback(
208
+ (event) => {
209
+ if (withKeyboardEvents) {
210
+ if (event.key === "ArrowRight") {
211
+ event.preventDefault();
212
+ handleNext();
213
+ }
214
+ if (event.key === "ArrowLeft") {
215
+ event.preventDefault();
216
+ handlePrevious();
217
+ }
186
218
  }
187
- }
188
- }, [embla]);
219
+ },
220
+ [embla]
221
+ );
189
222
  React.useEffect(() => {
190
223
  if (embla) {
191
224
  getEmblaApi == null ? void 0 : getEmblaApi(embla);
@@ -202,79 +235,78 @@ const _Carousel = React.forwardRef((props, ref) => {
202
235
  if (embla) {
203
236
  embla.reInit();
204
237
  setSlidesCount(embla.scrollSnapList().length);
205
- setSelected((currentSelected) => hooks.clamp(currentSelected, 0, React.Children.toArray(children).length - 1));
238
+ setSelected(
239
+ (currentSelected) => hooks.clamp(currentSelected, 0, React.Children.toArray(children).length - 1)
240
+ );
206
241
  }
207
242
  }, [React.Children.toArray(children).length, slidesToScroll]);
208
243
  const canScrollPrev = (embla == null ? void 0 : embla.canScrollPrev()) || false;
209
244
  const canScrollNext = (embla == null ? void 0 : embla.canScrollNext()) || false;
210
- const indicators = Array(slidesCount).fill(0).map((_, index) => /* @__PURE__ */ React__default.createElement(core.UnstyledButton, {
211
- key: index,
212
- "data-active": index === selected || void 0,
213
- className: classes.indicator,
214
- "aria-hidden": true,
215
- tabIndex: -1,
216
- onClick: () => handleScroll(index)
217
- }));
218
- return /* @__PURE__ */ React__default.createElement(Carousel_context.CarouselProvider, {
219
- value: {
220
- slideGap,
221
- slideSize,
222
- embla,
223
- orientation,
224
- includeGapInSize,
225
- breakpoints,
226
- classNames,
227
- styles,
228
- unstyled,
229
- variant
230
- }
231
- }, /* @__PURE__ */ React__default.createElement(core.Box, __spreadValues({
232
- className: cx(classes.root, className),
233
- ref,
234
- onKeyDownCapture: handleKeydown
235
- }, others), /* @__PURE__ */ React__default.createElement("div", {
236
- className: classes.viewport,
237
- ref: emblaRefElement
238
- }, /* @__PURE__ */ React__default.createElement("div", {
239
- className: classes.container
240
- }, children)), withIndicators && /* @__PURE__ */ React__default.createElement("div", {
241
- className: classes.indicators
242
- }, indicators), withControls && /* @__PURE__ */ React__default.createElement("div", {
243
- className: classes.controls
244
- }, /* @__PURE__ */ React__default.createElement(core.UnstyledButton, {
245
- onClick: handlePrevious,
246
- className: classes.control,
247
- "aria-label": previousControlLabel,
248
- "data-inactive": !canScrollPrev || void 0,
249
- tabIndex: canScrollPrev ? 0 : -1
250
- }, typeof previousControlIcon !== "undefined" ? previousControlIcon : /* @__PURE__ */ React__default.createElement(core.ChevronIcon, {
251
- style: {
252
- transform: `rotate(${getChevronRotation.getChevronRotation({
253
- dir: theme.dir,
254
- orientation,
255
- direction: "previous"
256
- })}deg)`
257
- }
258
- })), /* @__PURE__ */ React__default.createElement(core.UnstyledButton, {
259
- onClick: handleNext,
260
- className: classes.control,
261
- "aria-label": nextControlLabel,
262
- "data-inactive": !canScrollNext || void 0,
263
- tabIndex: canScrollNext ? 0 : -1
264
- }, typeof nextControlIcon !== "undefined" ? nextControlIcon : /* @__PURE__ */ React__default.createElement(core.ChevronIcon, {
265
- style: {
266
- transform: `rotate(${getChevronRotation.getChevronRotation({
267
- dir: theme.dir,
268
- orientation,
269
- direction: "next"
270
- })}deg)`
271
- }
272
- })))));
245
+ const indicators = Array(slidesCount).fill(0).map((_, index) => /* @__PURE__ */ React__default.createElement(
246
+ core.UnstyledButton,
247
+ __spreadProps(__spreadValues({}, getStyles("indicator")), {
248
+ key: index,
249
+ "data-active": index === selected || void 0,
250
+ "aria-hidden": true,
251
+ tabIndex: -1,
252
+ onClick: () => handleScroll(index)
253
+ })
254
+ ));
255
+ return /* @__PURE__ */ React__default.createElement(Carousel_context.CarouselProvider, { value: { getStyles, orientation } }, /* @__PURE__ */ React__default.createElement(CarouselVariables.CarouselVariables, __spreadProps(__spreadValues({}, props), { selector: `.${responsiveClassName}` })), /* @__PURE__ */ React__default.createElement(
256
+ core.Box,
257
+ __spreadProps(__spreadValues(__spreadValues({
258
+ ref
259
+ }, getStyles("root", { className: responsiveClassName })), others), {
260
+ mod: { orientation, "include-gap-in-size": includeGapInSize },
261
+ onKeyDownCapture: handleKeydown
262
+ }),
263
+ /* @__PURE__ */ React__default.createElement("div", __spreadProps(__spreadValues({}, getStyles("viewport")), { ref: emblaRefElement }), /* @__PURE__ */ React__default.createElement("div", __spreadProps(__spreadValues({}, getStyles("container")), { "data-orientation": orientation }), children)),
264
+ withIndicators && /* @__PURE__ */ React__default.createElement("div", __spreadValues({}, getStyles("indicators")), indicators),
265
+ withControls && /* @__PURE__ */ React__default.createElement("div", __spreadValues({}, getStyles("controls")), /* @__PURE__ */ React__default.createElement(
266
+ core.UnstyledButton,
267
+ __spreadProps(__spreadValues(__spreadValues({}, previousControlProps), getStyles("control")), {
268
+ onClick: handlePrevious,
269
+ "data-inactive": !canScrollPrev || void 0,
270
+ tabIndex: canScrollPrev ? 0 : -1
271
+ }),
272
+ typeof previousControlIcon !== "undefined" ? previousControlIcon : /* @__PURE__ */ React__default.createElement(
273
+ core.AccordionChevron,
274
+ {
275
+ style: {
276
+ transform: `rotate(${getChevronRotation.getChevronRotation({
277
+ dir,
278
+ orientation,
279
+ direction: "previous"
280
+ })}deg)`
281
+ }
282
+ }
283
+ )
284
+ ), /* @__PURE__ */ React__default.createElement(
285
+ core.UnstyledButton,
286
+ __spreadProps(__spreadValues(__spreadValues({
287
+ onClick: handleNext
288
+ }, getStyles("control")), nextControlProps), {
289
+ "data-inactive": !canScrollNext || void 0,
290
+ tabIndex: canScrollNext ? 0 : -1
291
+ }),
292
+ typeof nextControlIcon !== "undefined" ? nextControlIcon : /* @__PURE__ */ React__default.createElement(
293
+ core.AccordionChevron,
294
+ {
295
+ style: {
296
+ transform: `rotate(${getChevronRotation.getChevronRotation({
297
+ dir,
298
+ orientation,
299
+ direction: "next"
300
+ })}deg)`
301
+ }
302
+ }
303
+ )
304
+ ))
305
+ ));
273
306
  });
274
- _Carousel.Slide = CarouselSlide.CarouselSlide;
275
- _Carousel.displayName = "@mantine/carousel/Carousel";
276
- const Carousel = _Carousel;
307
+ Carousel.classes = Carousel_module['default'];
308
+ Carousel.displayName = "@mantine/core/Carousel";
309
+ Carousel.Slide = CarouselSlide.CarouselSlide;
277
310
 
278
311
  exports.Carousel = Carousel;
279
- exports._Carousel = _Carousel;
280
312
  //# sourceMappingURL=Carousel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Carousel.js","sources":["../src/Carousel.tsx"],"sourcesContent":["/* eslint-disable react/no-unused-prop-types */\nimport {\n Box,\n ChevronIcon,\n DefaultProps,\n MantineNumberSize,\n Selectors,\n UnstyledButton,\n useComponentDefaultProps,\n} from '@mantine/core';\nimport { clamp } from '@mantine/hooks';\nimport { ForwardRefWithStaticComponents } from '@mantine/utils';\nimport useEmblaCarousel, { EmblaPluginType } from 'embla-carousel-react';\nimport React, { Children, forwardRef, useCallback, useEffect, useState } from 'react';\nimport { CarouselProvider } from './Carousel.context';\nimport useStyles, { CarouselStylesParams } from './Carousel.styles';\nimport { CarouselSlide, CarouselSlideStylesNames } from './CarouselSlide/CarouselSlide';\nimport { getChevronRotation } from './get-chevron-rotation';\nimport { CarouselBreakpoint, CarouselOrientation, Embla } from './types';\n\nexport type CarouselStylesNames = CarouselSlideStylesNames | Selectors<typeof useStyles>;\n\nexport interface CarouselProps\n extends DefaultProps<CarouselStylesNames, CarouselStylesParams>,\n React.ComponentPropsWithRef<'div'> {\n variant?: string;\n\n /** <Carousel.Slide /> components */\n children?: React.ReactNode;\n\n /** Called when user clicks next button */\n onNextSlide?(): void;\n\n /** Called when user clicks previous button */\n onPreviousSlide?(): void;\n\n /** Called with slide index when slide changes */\n onSlideChange?(index: number): void;\n\n /** Get embla API as ref */\n getEmblaApi?(embla: Embla): void;\n\n /** Next control aria-label */\n nextControlLabel?: string;\n\n /** Previous control aria-label */\n previousControlLabel?: string;\n\n /** Previous/next controls size */\n controlSize?: number;\n\n /** Key of theme.spacing or number to set space between next/previous control and carousel boundary */\n controlsOffset?: MantineNumberSize;\n\n /** Slide width, defaults to 100%, examples: 40rem 50% */\n slideSize?: string | number;\n\n /** Key of theme.spacing or number to set gap between slides */\n slideGap?: MantineNumberSize;\n\n /** Control slideSize and slideGap at different viewport sizes */\n breakpoints?: CarouselBreakpoint[];\n\n /** Carousel orientation, horizontal by default */\n orientation?: CarouselOrientation;\n\n /** Slides container height, required for vertical orientation */\n height?: React.CSSProperties['height'];\n\n /** Determines how slides will be aligned relative to the container. Use number between 0-1 to align slides based on percentage, where 0.5 equals 50% */\n align?: 'start' | 'center' | 'end' | number;\n\n /** Number of slides that should be scrolled with next/previous buttons */\n slidesToScroll?: number | 'auto';\n\n /** Determines whether gap should be treated as part of the slide size, true by default */\n includeGapInSize?: boolean;\n\n /** Determines whether carousel can be scrolled with mouse and touch interactions, true by default */\n draggable?: boolean;\n\n /** Determines whether momentum scrolling should be enabled, false by default */\n dragFree?: boolean;\n\n /** Enables infinite looping. Automatically falls back to false if slide content isn't enough to loop. */\n loop?: boolean;\n\n /** Adjusts scroll speed when triggered by any of the methods. Higher numbers enables faster scrolling. */\n speed?: number;\n\n /** Index of initial slide */\n initialSlide?: number;\n\n /** Choose a fraction representing the percentage portion of a slide that needs to be visible in order to be considered in view. For example, 0.5 equals 50%. */\n inViewThreshold?: number;\n\n /** Determines whether next/previous controls should be displayed, true by default */\n withControls?: boolean;\n\n /** Determines whether indicators should be displayed, false by default */\n withIndicators?: boolean;\n\n /** An array of embla plugins */\n plugins?: EmblaPluginType[];\n\n /** Icon of next control */\n nextControlIcon?: React.ReactNode;\n\n /** Previous control icon */\n previousControlIcon?: React.ReactNode;\n\n /** Allow the carousel to skip scroll snaps if it's dragged vigorously. Note that this option will be ignored if the dragFree option is set to true, false by default */\n skipSnaps?: boolean;\n\n /** Clear leading and trailing empty space that causes excessive scrolling. Use trimSnaps to only use snap points that trigger scrolling or keepSnaps to keep them. */\n containScroll?: 'trimSnaps' | 'keepSnaps' | '';\n\n /** Determines whether arrow key should switch slides, true by default */\n withKeyboardEvents?: boolean;\n}\n\nconst defaultProps: Partial<CarouselProps> = {\n controlSize: 26,\n controlsOffset: 'sm',\n slideSize: '100%',\n slideGap: 0,\n orientation: 'horizontal',\n align: 'center',\n slidesToScroll: 1,\n includeGapInSize: true,\n draggable: true,\n dragFree: false,\n loop: false,\n speed: 10,\n initialSlide: 0,\n inViewThreshold: 0,\n withControls: true,\n withIndicators: false,\n skipSnaps: false,\n containScroll: '',\n withKeyboardEvents: true,\n};\n\nexport const _Carousel = forwardRef<HTMLDivElement, CarouselProps>((props, ref) => {\n const {\n children,\n className,\n getEmblaApi,\n onNextSlide,\n onPreviousSlide,\n onSlideChange,\n nextControlLabel,\n previousControlLabel,\n controlSize,\n controlsOffset,\n classNames,\n styles,\n unstyled,\n slideSize,\n slideGap,\n orientation,\n height,\n align,\n slidesToScroll,\n includeGapInSize,\n draggable,\n dragFree,\n loop,\n speed,\n initialSlide,\n inViewThreshold,\n withControls,\n withIndicators,\n plugins,\n nextControlIcon,\n previousControlIcon,\n breakpoints,\n skipSnaps,\n containScroll,\n withKeyboardEvents,\n variant,\n ...others\n } = useComponentDefaultProps('Carousel', defaultProps, props);\n\n const { classes, cx, theme } = useStyles(\n { controlSize, controlsOffset, orientation, height, includeGapInSize, breakpoints, slideGap },\n { name: 'Carousel', classNames, styles, unstyled, variant }\n );\n\n const [emblaRefElement, embla] = useEmblaCarousel(\n {\n axis: orientation === 'horizontal' ? 'x' : 'y',\n // keep direction undefined for vertical orientation if the current theme is RTL\n direction: orientation === 'horizontal' ? theme.dir : undefined,\n startIndex: initialSlide,\n loop,\n align,\n slidesToScroll,\n draggable,\n dragFree,\n speed,\n inViewThreshold,\n skipSnaps,\n containScroll,\n },\n plugins\n );\n\n const [selected, setSelected] = useState(0);\n const [slidesCount, setSlidesCount] = useState(0);\n\n const handleScroll = useCallback((index: number) => embla && embla.scrollTo(index), [embla]);\n\n const handleSelect = useCallback(() => {\n if (!embla) return;\n const slide = embla.selectedScrollSnap();\n setSelected(slide);\n onSlideChange?.(slide);\n }, [embla, setSelected]);\n\n const handlePrevious = useCallback(() => {\n embla?.scrollPrev();\n onPreviousSlide?.();\n }, [embla]);\n\n const handleNext = useCallback(() => {\n embla?.scrollNext();\n onNextSlide?.();\n }, [embla]);\n\n const handleKeydown = useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (withKeyboardEvents) {\n if (event.key === 'ArrowRight') {\n event.preventDefault();\n handleNext();\n }\n\n if (event.key === 'ArrowLeft') {\n event.preventDefault();\n handlePrevious();\n }\n }\n },\n [embla]\n );\n\n useEffect(() => {\n if (embla) {\n getEmblaApi?.(embla);\n handleSelect();\n setSlidesCount(embla.scrollSnapList().length);\n embla.on('select', handleSelect);\n\n return () => {\n embla.off('select', handleSelect);\n };\n }\n\n return undefined;\n }, [embla, slidesToScroll]);\n\n useEffect(() => {\n if (embla) {\n embla.reInit();\n setSlidesCount(embla.scrollSnapList().length);\n setSelected((currentSelected) =>\n clamp(currentSelected, 0, Children.toArray(children).length - 1)\n );\n }\n }, [Children.toArray(children).length, slidesToScroll]);\n\n const canScrollPrev = embla?.canScrollPrev() || false;\n const canScrollNext = embla?.canScrollNext() || false;\n\n const indicators = Array(slidesCount)\n .fill(0)\n .map((_, index) => (\n <UnstyledButton\n key={index}\n data-active={index === selected || undefined}\n className={classes.indicator}\n aria-hidden\n tabIndex={-1}\n onClick={() => handleScroll(index)}\n />\n ));\n\n return (\n <CarouselProvider\n value={{\n slideGap,\n slideSize,\n embla,\n orientation,\n includeGapInSize,\n breakpoints,\n classNames,\n styles,\n unstyled,\n variant,\n }}\n >\n <Box\n className={cx(classes.root, className)}\n ref={ref}\n onKeyDownCapture={handleKeydown}\n {...others}\n >\n <div className={classes.viewport} ref={emblaRefElement}>\n <div className={classes.container}>{children}</div>\n </div>\n\n {withIndicators && <div className={classes.indicators}>{indicators}</div>}\n\n {withControls && (\n <div className={classes.controls}>\n <UnstyledButton\n onClick={handlePrevious}\n className={classes.control}\n aria-label={previousControlLabel}\n data-inactive={!canScrollPrev || undefined}\n tabIndex={canScrollPrev ? 0 : -1}\n >\n {typeof previousControlIcon !== 'undefined' ? (\n previousControlIcon\n ) : (\n <ChevronIcon\n style={{\n transform: `rotate(${getChevronRotation({\n dir: theme.dir,\n orientation,\n direction: 'previous',\n })}deg)`,\n }}\n />\n )}\n </UnstyledButton>\n\n <UnstyledButton\n onClick={handleNext}\n className={classes.control}\n aria-label={nextControlLabel}\n data-inactive={!canScrollNext || undefined}\n tabIndex={canScrollNext ? 0 : -1}\n >\n {typeof nextControlIcon !== 'undefined' ? (\n nextControlIcon\n ) : (\n <ChevronIcon\n style={{\n transform: `rotate(${getChevronRotation({\n dir: theme.dir,\n orientation,\n direction: 'next',\n })}deg)`,\n }}\n />\n )}\n </UnstyledButton>\n </div>\n )}\n </Box>\n </CarouselProvider>\n );\n}) as any;\n\n_Carousel.Slide = CarouselSlide;\n_Carousel.displayName = '@mantine/carousel/Carousel';\n\nexport const Carousel: ForwardRefWithStaticComponents<\n CarouselProps,\n { Slide: typeof CarouselSlide }\n> = _Carousel;\n"],"names":["forwardRef","useComponentDefaultProps","useStyles","useEmblaCarousel","useState","useCallback","useEffect","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I,eAAe,EAAE,CAAC,aAAa,IAAI,KAAK,CAAC;AAC7C,IAAI,QAAQ,EAAE,aAAa,GAAG,CAAC,GAAG,CAAC,CAAC;AACpC,GAAG,EAAE,OAAO,eAAe,KAAK,WAAW,GAAG,eAAe,mBAAmBD,cAAK,CAAC,aAAa,CAACI,gBAAW,EAAE;AACjH,IAAI,KAAK,EAAE;AACX,MAAM,SAAS,EAAE,CAAC,OAAO,EAAEC,qCAAkB,CAAC;AAC9C,QAAQ,GAAG,EAAE,KAAK,CAAC,GAAG;AACtB,QAAQ,WAAW;AACnB,QAAQ,SAAS,EAAE,MAAM;AACzB,OAAO,CAAC,CAAC,IAAI,CAAC;AACd,KAAK;AACL,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACT,CAAC,EAAE;AACH,SAAS,CAAC,KAAK,GAAGC,2BAAa,CAAC;AAChC,SAAS,CAAC,WAAW,GAAG,4BAA4B,CAAC;AACzC,MAAC,QAAQ,GAAG;;;;;"}
1
+ {"version":3,"file":"Carousel.js","sources":["../src/Carousel.tsx"],"sourcesContent":["import React, { Children, useCallback, useEffect, useState } from 'react';\nimport {\n Box,\n BoxProps,\n StylesApiProps,\n factory,\n ElementProps,\n useProps,\n useStyles,\n createVarsResolver,\n Factory,\n MantineSpacing,\n StyleProp,\n useDirection,\n UnstyledButton,\n AccordionChevron,\n useRandomClassName,\n rem,\n getSpacing,\n} from '@mantine/core';\nimport { clamp } from '@mantine/hooks';\nimport useEmblaCarousel, { EmblaPluginType, EmblaCarouselType } from 'embla-carousel-react';\nimport { getChevronRotation } from './get-chevron-rotation';\nimport { CarouselProvider } from './Carousel.context';\nimport { CarouselSlide } from './CarouselSlide/CarouselSlide';\nimport { CarouselVariables } from './CarouselVariables/CarouselVariables';\nimport classes from './Carousel.module.css';\n\nexport type CarouselStylesNames =\n | 'slide'\n | 'root'\n | 'viewport'\n | 'container'\n | 'controls'\n | 'control'\n | 'indicators'\n | 'indicator';\n\nexport type CarouselCssVariables = {\n root: '--carousel-height' | '--carousel-control-size' | '--carousel-controls-offset';\n};\n\nexport interface CarouselProps\n extends BoxProps,\n StylesApiProps<CarouselFactory>,\n ElementProps<'div'> {\n /** <Carousel.Slide /> components */\n children?: React.ReactNode;\n\n /** Called when next slide is shown */\n onNextSlide?(): void;\n\n /** Called when previous slider is shown */\n onPreviousSlide?(): void;\n\n /** Called with slide index when slide changes */\n onSlideChange?(index: number): void;\n\n /** Get embla API as ref */\n getEmblaApi?(embla: EmblaCarouselType): void;\n\n /** Props passed down to next control */\n nextControlProps?: React.ComponentPropsWithoutRef<'button'>;\n\n /** Props passed down to previous control */\n previousControlProps?: React.ComponentPropsWithoutRef<'button'>;\n\n /** Controls size of the next and previous controls, `26` by default */\n controlSize?: React.CSSProperties['width'];\n\n /** Controls position of the next and previous controls, key of `theme.spacing` or any valid CSS value, `'sm'` by default */\n controlsOffset?: MantineSpacing | (string & {}) | number;\n\n /** Controls slide width based on viewport width, `'100%'` by default */\n slideSize?: StyleProp<string | number>;\n\n /** Key of theme.spacing or number to set gap between slides */\n slideGap?: StyleProp<MantineSpacing | (string & {}) | number>;\n\n /** Carousel orientation, `'horizontal'` by default */\n orientation?: 'horizontal' | 'vertical';\n\n /** Slides container `height`, required for vertical orientation */\n height?: React.CSSProperties['height'];\n\n /** Determines how slides will be aligned relative to the container. Use number between 0-1 to align slides based on percentage, where 0.5 is 50%, `'center'` by default */\n align?: 'start' | 'center' | 'end' | number;\n\n /** Number of slides that will be scrolled with next/previous buttons, `1` by default */\n slidesToScroll?: number | 'auto';\n\n /** Determines whether gap between slides should be treated as part of the slide size, `true` by default */\n includeGapInSize?: boolean;\n\n /** Determines whether the carousel can be scrolled with mouse and touch interactions, `true` by default */\n draggable?: boolean;\n\n /** Determines whether momentum scrolling should be enabled, `false` by default */\n dragFree?: boolean;\n\n /** Enables infinite looping. `true` by default, automatically falls back to `false` if slide content isn't enough to loop. */\n loop?: boolean;\n\n /** Adjusts scroll speed when triggered by any of the methods. Higher numbers enables faster scrolling. */\n speed?: number;\n\n /** Index of initial slide */\n initialSlide?: number;\n\n /** Choose a fraction representing the percentage portion of a slide that needs to be visible in order to be considered in view. For example, 0.5 equals 50%. */\n inViewThreshold?: number;\n\n /** Determines whether next/previous controls should be displayed, true by default */\n withControls?: boolean;\n\n /** Determines whether indicators should be displayed, `false` by default */\n withIndicators?: boolean;\n\n /** An array of embla plugins */\n plugins?: EmblaPluginType[];\n\n /** Icon of the next control */\n nextControlIcon?: React.ReactNode;\n\n /** Icon of the previous control */\n previousControlIcon?: React.ReactNode;\n\n /** Allow the carousel to skip scroll snaps if it is dragged vigorously. Note that this option will be ignored if the dragFree option is set to `true`, `false` by default */\n skipSnaps?: boolean;\n\n /** Clear leading and trailing empty space that causes excessive scrolling. Use `trimSnaps` to only use snap points that trigger scrolling or keepSnaps to keep them. */\n containScroll?: 'trimSnaps' | 'keepSnaps' | '';\n\n /** Determines whether arrow key should switch slides, `true` by default */\n withKeyboardEvents?: boolean;\n}\n\nexport type CarouselFactory = Factory<{\n props: CarouselProps;\n ref: HTMLDivElement;\n stylesNames: CarouselStylesNames;\n vars: CarouselCssVariables;\n staticComponents: {\n Slide: typeof CarouselSlide;\n };\n}>;\n\nconst defaultProps: Partial<CarouselProps> = {\n controlSize: 26,\n controlsOffset: 'sm',\n slideSize: '100%',\n slideGap: 0,\n orientation: 'horizontal',\n align: 'center',\n slidesToScroll: 1,\n includeGapInSize: true,\n draggable: true,\n dragFree: false,\n loop: false,\n speed: 10,\n initialSlide: 0,\n inViewThreshold: 0,\n withControls: true,\n withIndicators: false,\n skipSnaps: false,\n containScroll: '',\n withKeyboardEvents: true,\n};\n\nconst varsResolver = createVarsResolver<CarouselFactory>(\n (_, { height, controlSize, controlsOffset }) => ({\n root: {\n '--carousel-height': rem(height),\n '--carousel-control-size': rem(controlSize),\n '--carousel-controls-offset': getSpacing(controlsOffset),\n },\n })\n);\n\nexport const Carousel = factory<CarouselFactory>((_props, ref) => {\n const props = useProps('Carousel', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n children,\n getEmblaApi,\n onNextSlide,\n onPreviousSlide,\n onSlideChange,\n nextControlProps,\n previousControlProps,\n controlSize,\n controlsOffset,\n slideSize,\n slideGap,\n orientation,\n height,\n align,\n slidesToScroll,\n includeGapInSize,\n draggable,\n dragFree,\n loop,\n speed,\n initialSlide,\n inViewThreshold,\n withControls,\n withIndicators,\n plugins,\n nextControlIcon,\n previousControlIcon,\n skipSnaps,\n containScroll,\n withKeyboardEvents,\n ...others\n } = props;\n\n const getStyles = useStyles<CarouselFactory>({\n name: 'Carousel',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n vars,\n varsResolver,\n });\n\n const responsiveClassName = useRandomClassName();\n const { dir } = useDirection();\n\n const [emblaRefElement, embla] = useEmblaCarousel(\n {\n axis: orientation === 'horizontal' ? 'x' : 'y',\n direction: orientation === 'horizontal' ? dir : undefined,\n startIndex: initialSlide,\n loop,\n align,\n slidesToScroll,\n draggable,\n dragFree,\n speed,\n inViewThreshold,\n skipSnaps,\n containScroll,\n },\n plugins\n );\n\n const [selected, setSelected] = useState(0);\n const [slidesCount, setSlidesCount] = useState(0);\n\n const handleScroll = useCallback((index: number) => embla && embla.scrollTo(index), [embla]);\n\n const handleSelect = useCallback(() => {\n if (!embla) return;\n const slide = embla.selectedScrollSnap();\n setSelected(slide);\n onSlideChange?.(slide);\n }, [embla, setSelected]);\n\n const handlePrevious = useCallback(() => {\n embla?.scrollPrev();\n onPreviousSlide?.();\n }, [embla]);\n\n const handleNext = useCallback(() => {\n embla?.scrollNext();\n onNextSlide?.();\n }, [embla]);\n\n const handleKeydown = useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (withKeyboardEvents) {\n if (event.key === 'ArrowRight') {\n event.preventDefault();\n handleNext();\n }\n\n if (event.key === 'ArrowLeft') {\n event.preventDefault();\n handlePrevious();\n }\n }\n },\n [embla]\n );\n\n useEffect(() => {\n if (embla) {\n getEmblaApi?.(embla);\n handleSelect();\n setSlidesCount(embla.scrollSnapList().length);\n embla.on('select', handleSelect);\n\n return () => {\n embla.off('select', handleSelect);\n };\n }\n\n return undefined;\n }, [embla, slidesToScroll]);\n\n useEffect(() => {\n if (embla) {\n embla.reInit();\n setSlidesCount(embla.scrollSnapList().length);\n setSelected((currentSelected) =>\n clamp(currentSelected, 0, Children.toArray(children).length - 1)\n );\n }\n }, [Children.toArray(children).length, slidesToScroll]);\n\n const canScrollPrev = embla?.canScrollPrev() || false;\n const canScrollNext = embla?.canScrollNext() || false;\n\n const indicators = Array(slidesCount)\n .fill(0)\n .map((_, index) => (\n <UnstyledButton\n {...getStyles('indicator')}\n key={index}\n data-active={index === selected || undefined}\n aria-hidden\n tabIndex={-1}\n onClick={() => handleScroll(index)}\n />\n ));\n\n return (\n <CarouselProvider value={{ getStyles, orientation }}>\n <CarouselVariables {...props} selector={`.${responsiveClassName}`} />\n <Box\n ref={ref}\n {...getStyles('root', { className: responsiveClassName })}\n {...others}\n mod={{ orientation, 'include-gap-in-size': includeGapInSize }}\n onKeyDownCapture={handleKeydown}\n >\n <div {...getStyles('viewport')} ref={emblaRefElement}>\n <div {...getStyles('container')} data-orientation={orientation}>\n {children}\n </div>\n </div>\n\n {withIndicators && <div {...getStyles('indicators')}>{indicators}</div>}\n\n {withControls && (\n <div {...getStyles('controls')}>\n <UnstyledButton\n {...previousControlProps}\n {...getStyles('control')}\n onClick={handlePrevious}\n data-inactive={!canScrollPrev || undefined}\n tabIndex={canScrollPrev ? 0 : -1}\n >\n {typeof previousControlIcon !== 'undefined' ? (\n previousControlIcon\n ) : (\n <AccordionChevron\n style={{\n transform: `rotate(${getChevronRotation({\n dir,\n orientation,\n direction: 'previous',\n })}deg)`,\n }}\n />\n )}\n </UnstyledButton>\n\n <UnstyledButton\n onClick={handleNext}\n {...getStyles('control')}\n {...nextControlProps}\n data-inactive={!canScrollNext || undefined}\n tabIndex={canScrollNext ? 0 : -1}\n >\n {typeof nextControlIcon !== 'undefined' ? (\n nextControlIcon\n ) : (\n <AccordionChevron\n style={{\n transform: `rotate(${getChevronRotation({\n dir,\n orientation,\n direction: 'next',\n })}deg)`,\n }}\n />\n )}\n </UnstyledButton>\n </div>\n )}\n </Box>\n </CarouselProvider>\n );\n});\n\nCarousel.classes = classes;\nCarousel.displayName = '@mantine/core/Carousel';\nCarousel.Slide = CarouselSlide;\n"],"names":["createVarsResolver","rem","getSpacing","factory","useProps","useStyles","classes","useRandomClassName","useDirection","useEmblaCarousel","useState","useCallback","useEffect","clamp","Children","React","UnstyledButton","CarouselProvider","CarouselVariables","Box","AccordionChevron","getChevronRotation","CarouselSlide"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,I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SAAS;AACT,OAAO;AACP,KAAK,kBAAkBN,cAAK,CAAC,aAAa;AAC1C,MAAMC,mBAAc;AACpB,MAAM,aAAa,CAAC,cAAc,CAAC,cAAc,CAAC;AAClD,QAAQ,OAAO,EAAE,UAAU;AAC3B,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,EAAE,gBAAgB,CAAC,EAAE;AACnD,QAAQ,eAAe,EAAE,CAAC,aAAa,IAAI,KAAK,CAAC;AACjD,QAAQ,QAAQ,EAAE,aAAa,GAAG,CAAC,GAAG,CAAC,CAAC;AACxC,OAAO,CAAC;AACR,MAAM,OAAO,eAAe,KAAK,WAAW,GAAG,eAAe,mBAAmBD,cAAK,CAAC,aAAa;AACpG,QAAQK,qBAAgB;AACxB,QAAQ;AACR,UAAU,KAAK,EAAE;AACjB,YAAY,SAAS,EAAE,CAAC,OAAO,EAAEC,qCAAkB,CAAC;AACpD,cAAc,GAAG;AACjB,cAAc,WAAW;AACzB,cAAc,SAAS,EAAE,MAAM;AAC/B,aAAa,CAAC,CAAC,IAAI,CAAC;AACpB,WAAW;AACX,SAAS;AACT,OAAO;AACP,KAAK,CAAC;AACN,GAAG,CAAC,CAAC;AACL,CAAC,EAAE;AACH,QAAQ,CAAC,OAAO,GAAGf,0BAAO,CAAC;AAC3B,QAAQ,CAAC,WAAW,GAAG,wBAAwB,CAAC;AAChD,QAAQ,CAAC,KAAK,GAAGgB,2BAAa;;;;"}
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var classes = {"root":"m-17884d0f","viewport":"m-a2dae653","container":"m-fcd81474","controls":"m-39bc3463","control":"m-64f58e10","indicators":"m-71ea3ab1","indicator":"m-eae68602","slide":"m-d98df724"};
6
+
7
+ exports.default = classes;
8
+ //# sourceMappingURL=Carousel.module.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Carousel.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var React = require('react');
6
6
  var core = require('@mantine/core');
7
7
  var Carousel_context = require('../Carousel.context.js');
8
- var CarouselSlide_styles = require('./CarouselSlide.styles.js');
8
+ var Carousel_module = require('../Carousel.module.css.js');
9
9
 
10
10
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
11
11
 
@@ -39,35 +39,24 @@ var __objRest = (source, exclude) => {
39
39
  }
40
40
  return target;
41
41
  };
42
- const CarouselSlide = React.forwardRef((_a, ref) => {
43
- var _b = _a, { children, className, size, gap, onClick } = _b, others = __objRest(_b, ["children", "className", "size", "gap", "onClick"]);
42
+ const defaultProps = {};
43
+ const CarouselSlide = core.factory((props, ref) => {
44
+ const _a = core.useProps(
45
+ "CarouselSlide",
46
+ defaultProps,
47
+ props
48
+ ), { classNames, className, style, styles, unstyled, vars } = _a, others = __objRest(_a, ["classNames", "className", "style", "styles", "unstyled", "vars"]);
44
49
  const ctx = Carousel_context.useCarouselContext();
45
- const { classes, cx } = CarouselSlide_styles['default']({
46
- gap: typeof gap === "undefined" ? ctx.slideGap : gap,
47
- size: typeof size === "undefined" ? ctx.slideSize : size,
48
- orientation: ctx.orientation,
49
- includeGapInSize: ctx.includeGapInSize,
50
- breakpoints: ctx.breakpoints
51
- }, {
52
- name: "Carousel",
53
- classNames: ctx.classNames,
54
- styles: ctx.styles,
55
- unstyled: ctx.unstyled,
56
- variant: ctx.variant
57
- });
58
- const handleClick = React.useCallback((event) => {
59
- var _a2;
60
- if ((_a2 = ctx.embla) == null ? void 0 : _a2.clickAllowed()) {
61
- onClick == null ? void 0 : onClick(event);
62
- }
63
- }, [ctx.embla, onClick]);
64
- return /* @__PURE__ */ React__default.createElement(core.Box, __spreadValues({
65
- className: cx(classes.slide, className),
66
- ref,
67
- onClick: handleClick
68
- }, others), children);
50
+ return /* @__PURE__ */ React__default.createElement(
51
+ core.Box,
52
+ __spreadValues(__spreadValues({
53
+ ref,
54
+ mod: { orientation: ctx.orientation }
55
+ }, ctx.getStyles("slide", { className, style, classNames, styles })), others)
56
+ );
69
57
  });
70
- CarouselSlide.displayName = "@mantine/carousel/CarouselSlide";
58
+ CarouselSlide.classes = Carousel_module['default'];
59
+ CarouselSlide.displayName = "@mantine/core/CarouselSlide";
71
60
 
72
61
  exports.CarouselSlide = CarouselSlide;
73
62
  //# sourceMappingURL=CarouselSlide.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CarouselSlide.js","sources":["../../src/CarouselSlide/CarouselSlide.tsx"],"sourcesContent":["import React, { forwardRef, useCallback } from 'react';\nimport { Box, DefaultProps, Selectors, MantineNumberSize } from '@mantine/core';\nimport { useCarouselContext } from '../Carousel.context';\nimport useStyles from './CarouselSlide.styles';\n\nexport type CarouselSlideStylesNames = Selectors<typeof useStyles>;\n\nexport interface CarouselSlideProps extends DefaultProps, React.ComponentPropsWithoutRef<'div'> {\n /** Slide content */\n children?: React.ReactNode;\n\n /** Slide width, defaults to 100%, examples: 40rem, 50% */\n size?: string | number;\n\n /** Key of theme.spacing or number to set gap between slides */\n gap?: MantineNumberSize;\n}\n\nexport const CarouselSlide = forwardRef<HTMLDivElement, CarouselSlideProps>(\n ({ children, className, size, gap, onClick, ...others }, ref) => {\n const ctx = useCarouselContext();\n const { classes, cx } = useStyles(\n {\n gap: typeof gap === 'undefined' ? ctx.slideGap : gap,\n size: typeof size === 'undefined' ? ctx.slideSize : size,\n orientation: ctx.orientation,\n includeGapInSize: ctx.includeGapInSize,\n breakpoints: ctx.breakpoints,\n },\n {\n name: 'Carousel',\n classNames: ctx.classNames,\n styles: ctx.styles,\n unstyled: ctx.unstyled,\n variant: ctx.variant,\n }\n );\n\n const handleClick = useCallback(\n (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n if (ctx.embla?.clickAllowed()) {\n onClick?.(event);\n }\n },\n [ctx.embla, onClick]\n );\n\n return (\n <Box className={cx(classes.slide, className)} ref={ref} onClick={handleClick} {...others}>\n {children}\n </Box>\n );\n }\n);\n\nCarouselSlide.displayName = '@mantine/carousel/CarouselSlide';\n"],"names":["forwardRef","useCarouselContext","useStyles","useCallback","React","Box"],"mappings":";;;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAClC,MAAM,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACxC,EAAE,IAAI,mBAAmB;AACzB,IAAI,KAAK,IAAI,IAAI,IAAI,mBAAmB,CAAC,CAAC,CAAC,EAAE;AAC7C,MAAM,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AACpC,QAAQ,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AAC1C,KAAK;AACL,EAAE,OAAO,CAAC,CAAC;AACX,CAAC,CA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\n Box,\n BoxProps,\n StylesApiProps,\n factory,\n ElementProps,\n useProps,\n Factory,\n} from '@mantine/core';\nimport { useCarouselContext } from '../Carousel.context';\nimport classes from '../Carousel.module.css';\n\nexport type CarouselSlideStylesNames = 'slide';\n\nexport interface CarouselSlideProps\n extends BoxProps,\n StylesApiProps<CarouselSlideFactory>,\n ElementProps<'div'> {}\n\nexport type CarouselSlideFactory = Factory<{\n props: CarouselSlideProps;\n ref: HTMLDivElement;\n stylesNames: CarouselSlideStylesNames;\n compound: true;\n}>;\n\nconst defaultProps: Partial<CarouselSlideProps> = {};\n\nexport const CarouselSlide = factory<CarouselSlideFactory>((props, ref) => {\n const { classNames, className, style, styles, unstyled, vars, ...others } = useProps(\n 'CarouselSlide',\n defaultProps,\n props\n );\n\n const ctx = useCarouselContext();\n\n return (\n <Box\n ref={ref}\n mod={{ orientation: ctx.orientation }}\n {...ctx.getStyles('slide', { className, style, classNames, styles })}\n {...others}\n />\n );\n});\n\nCarouselSlide.classes = classes;\nCarouselSlide.displayName = '@mantine/core/CarouselSlide';\n"],"names":["factory","useProps","useCarouselContext","React","Box","classes"],"mappings":";;;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GA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AAO,MAAM,CAAC;AAChB,CAAC,CAAC;AASF,MAAM,YAAY,GAAG,EAAE,CAAC;AACZ,MAAC,aAAa,GAAGA,YAAO,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACrD,EAAE,MAAM,EAAE,GAAGC,aAAQ;AACrB,IAAI,eAAe;AACnB,IAAI,YAAY;AAChB,IAAI,KAAK;AACT,GAAG,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC,EAAE,EAAE,CAAC,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AAC/J,EAAE,MAAM,GAAG,GAAGC,mCAAkB,EAAE,CAAC;AACnC,EAAE,uBAAuBC,cAAK,CAAC,aAAa;AAC5C,IAAIC,QAAG;AACP,IAAI,cAAc,CAAC,cAAc,CAAC;AAClC,MAAM,GAAG;AACT,MAAM,GAAG,EAAE,EAAE,WAAW,EAAE,GAAG,CAAC,WAAW,EAAE;AAC3C,KAAK,EAAE,GAAG,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC;AACjF,GAAG,CAAC;AACJ,CAAC,EAAE;AACH,aAAa,CAAC,OAAO,GAAGC,0BAAO,CAAC;AAChC,aAAa,CAAC,WAAW,GAAG,6BAA6B;;;;"}
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+ var core = require('@mantine/core');
7
+
8
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
9
+
10
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
11
+
12
+ function CarouselVariables({ slideGap, slideSize, selector }) {
13
+ var _a;
14
+ const theme = core.useMantineTheme();
15
+ const baseStyles = core.filterProps({
16
+ "--carousel-slide-gap": core.getSpacing(core.getBaseValue(slideGap)),
17
+ "--carousel-slide-size": (_a = core.getBaseValue(slideSize)) == null ? void 0 : _a.toString()
18
+ });
19
+ const queries = core.keys(theme.breakpoints).reduce(
20
+ (acc, breakpoint) => {
21
+ if (!acc[breakpoint]) {
22
+ acc[breakpoint] = {};
23
+ }
24
+ if (typeof slideGap === "object" && slideGap[breakpoint] !== void 0) {
25
+ acc[breakpoint]["--carousel-slide-gap"] = core.getSpacing(slideGap[breakpoint]);
26
+ }
27
+ if (typeof slideSize === "object" && slideSize[breakpoint] !== void 0) {
28
+ acc[breakpoint]["--carousel-slide-size"] = core.getSpacing(slideSize[breakpoint]);
29
+ }
30
+ return acc;
31
+ },
32
+ {}
33
+ );
34
+ const sortedBreakpoints = core.getSortedBreakpoints(core.keys(queries), theme).filter(
35
+ (breakpoint) => core.keys(queries[breakpoint.value]).length > 0
36
+ );
37
+ const media = sortedBreakpoints.map((breakpoint) => ({
38
+ query: `(min-width: ${theme.breakpoints[breakpoint.value]})`,
39
+ styles: queries[breakpoint.value]
40
+ }));
41
+ return /* @__PURE__ */ React__default.createElement(core.InlineStyles, { styles: baseStyles, media, selector });
42
+ }
43
+
44
+ exports.CarouselVariables = CarouselVariables;
45
+ //# sourceMappingURL=CarouselVariables.js.map