@janbox/storefront-ui 2.0.12 → 2.0.14
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/index.js +0 -2
- package/dist/lib/swiper/index.d.ts +0 -1
- package/dist/lib/swiper/index.d.ts.map +1 -1
- package/dist/lib/swiper/swiper/swiper.d.ts.map +1 -1
- package/dist/lib/swiper/swiper/swiper.js +58 -57
- package/dist/lib/swiper/swiper/types.d.ts +15 -10
- package/dist/lib/swiper/swiper/types.d.ts.map +1 -1
- package/dist/lib/swiper/swiper-dots-paging/index.d.ts +1 -0
- package/dist/lib/swiper/swiper-dots-paging/index.d.ts.map +1 -1
- package/dist/lib/swiper/swiper-dots-paging/index.js +4 -0
- package/dist/lib/swiper/swiper-dots-paging/swiper-dots-paging.d.ts +1 -1
- package/dist/lib/swiper/swiper-dots-paging/swiper-dots-paging.d.ts.map +1 -1
- package/dist/lib/swiper/swiper-dots-paging/swiper-dots-paging.js +172 -48
- package/dist/lib/swiper/swiper-dots-paging/types.d.ts +7 -4
- package/dist/lib/swiper/swiper-dots-paging/types.d.ts.map +1 -1
- package/dist/lib/swiper/swiper-side-arrows-paging/index.d.ts +3 -0
- package/dist/lib/swiper/swiper-side-arrows-paging/index.d.ts.map +1 -0
- package/dist/lib/swiper/swiper-side-arrows-paging/index.js +6 -0
- package/dist/lib/swiper/swiper-side-arrows-paging/swiper-side-arrows-paging.d.ts +5 -0
- package/dist/lib/swiper/swiper-side-arrows-paging/swiper-side-arrows-paging.d.ts.map +1 -0
- package/dist/lib/swiper/swiper-side-arrows-paging/swiper-side-arrows-paging.js +263 -0
- package/dist/lib/swiper/swiper-side-arrows-paging/types.d.ts +13 -0
- package/dist/lib/swiper/swiper-side-arrows-paging/types.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -82,7 +82,6 @@ import { StarRating } from "./lib/star-rating/star-rating.js";
|
|
|
82
82
|
import { Step } from "./lib/stepper/step.js";
|
|
83
83
|
import { Stepper } from "./lib/stepper/stepper.js";
|
|
84
84
|
import { Swiper } from "./lib/swiper/swiper/swiper.js";
|
|
85
|
-
import { SwiperDotsPaging } from "./lib/swiper/swiper-dots-paging/swiper-dots-paging.js";
|
|
86
85
|
import { SwiperSlide } from "./lib/swiper/swiper-slide/swiper-slide.js";
|
|
87
86
|
import { Switch } from "./lib/switch/switch.js";
|
|
88
87
|
import { Tab } from "./lib/tabs/tab/tab.js";
|
|
@@ -228,7 +227,6 @@ export {
|
|
|
228
227
|
Step,
|
|
229
228
|
Stepper,
|
|
230
229
|
Swiper,
|
|
231
|
-
SwiperDotsPaging,
|
|
232
230
|
SwiperSlide,
|
|
233
231
|
Switch,
|
|
234
232
|
Tab,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/swiper/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/swiper/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swiper.d.ts","sourceRoot":"","sources":["../../../../src/lib/swiper/swiper/swiper.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"swiper.d.ts","sourceRoot":"","sources":["../../../../src/lib/swiper/swiper/swiper.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,WAAW,EAAyB,MAAM,SAAS,CAAC;AAe7D,eAAO,MAAM,MAAM,wCAAyC,WAAW,qDA6DtE,CAAC"}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { jsxs, jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import { useEffect, Suspense } from "react";
|
|
2
|
+
import { useEffect, Suspense, lazy } from "react";
|
|
3
3
|
import { useMergeRefs } from "@floating-ui/react";
|
|
4
4
|
import Autoplay from "embla-carousel-autoplay";
|
|
5
5
|
import useEmblaCarousel from "embla-carousel-react";
|
|
6
6
|
import { WheelGesturesPlugin } from "embla-carousel-wheel-gestures";
|
|
7
7
|
import { isNumber } from "lodash-es";
|
|
8
8
|
import { getSwiperProps } from "./helpers.js";
|
|
9
|
-
import { mediaQuery } from "../../../theme/screens.js";
|
|
10
|
-
import "../../../theme/palette.js";
|
|
11
|
-
import { createSxInterpolation } from "../../../utils/stylesheet.js";
|
|
12
|
-
import { SwiperDotsPaging } from "../swiper-dots-paging/swiper-dots-paging.js";
|
|
13
9
|
import { Primitive } from "../../primitive/primitive.js";
|
|
10
|
+
const SwiperDotsPaging = lazy(
|
|
11
|
+
() => import("../swiper-dots-paging/index.js").then((module) => ({ default: module.SwiperDotsPaging }))
|
|
12
|
+
);
|
|
13
|
+
const SwiperSideArrowsPaging = lazy(
|
|
14
|
+
() => import("../swiper-side-arrows-paging/index.js").then((module) => ({ default: module.SwiperSideArrowsPaging }))
|
|
15
|
+
);
|
|
14
16
|
const SWIPER_SLIDE_GAP_VAR_NAME = "--slice-gap";
|
|
15
17
|
const SWIPER_SLIDE_GAP_VAR = `var(${SWIPER_SLIDE_GAP_VAR_NAME}, 0px)`;
|
|
16
18
|
const Swiper = ({ children, onApi, ref, ..._props }) => {
|
|
@@ -26,65 +28,64 @@ const Swiper = ({ children, onApi, ref, ..._props }) => {
|
|
|
26
28
|
emblaApi && (onApi == null ? void 0 : onApi(emblaApi));
|
|
27
29
|
}, [emblaApi]);
|
|
28
30
|
const mergedRefs = useMergeRefs([emblaRef, ref]);
|
|
29
|
-
|
|
31
|
+
return /* @__PURE__ */ jsxs(
|
|
32
|
+
Primitive,
|
|
30
33
|
{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
createSxInterpolation(sx)
|
|
44
|
-
];
|
|
45
|
-
return /* @__PURE__ */ jsxs("div", { css, ...rest, ref: mergedRefs, children: [
|
|
46
|
-
/* @__PURE__ */ jsx(
|
|
47
|
-
"div",
|
|
48
|
-
{
|
|
49
|
-
role: "group",
|
|
50
|
-
css: {
|
|
51
|
-
display: "flex",
|
|
52
|
-
alignItems: "stretch",
|
|
53
|
-
height: "100%",
|
|
54
|
-
...(options == null ? void 0 : options.axis) === "y" ? { height: "100%", flexDirection: "column" } : {}
|
|
34
|
+
sx: {
|
|
35
|
+
position: "relative",
|
|
36
|
+
overflow: "hidden",
|
|
37
|
+
maxHeight: "100%",
|
|
38
|
+
maxWidth: "100%",
|
|
39
|
+
height: (options == null ? void 0 : options.axis) === "y" ? "100%" : void 0,
|
|
40
|
+
...createStyle({ slidesPerView, spaceBetween }),
|
|
41
|
+
...sx,
|
|
42
|
+
sm: {
|
|
43
|
+
...createStyle(sm),
|
|
44
|
+
...sx == null ? void 0 : sx.sm
|
|
55
45
|
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
/* @__PURE__ */ jsx(Suspense, { fallback: null, children: (paging == null ? void 0 : paging.type) === "dots" && /* @__PURE__ */ jsx(
|
|
60
|
-
Primitive,
|
|
61
|
-
{
|
|
62
|
-
sx: {
|
|
63
|
-
position: "absolute",
|
|
64
|
-
left: 0,
|
|
65
|
-
right: 0,
|
|
66
|
-
display: "flex",
|
|
67
|
-
justifyContent: "center",
|
|
68
|
-
bottom: 0,
|
|
69
|
-
...paging.sx
|
|
46
|
+
md: {
|
|
47
|
+
...createStyle(md),
|
|
48
|
+
...sx == null ? void 0 : sx.md
|
|
70
49
|
},
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
50
|
+
lg: {
|
|
51
|
+
...createStyle(lg),
|
|
52
|
+
...sx == null ? void 0 : sx.lg
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
...rest,
|
|
56
|
+
ref: mergedRefs,
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ jsx(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
role: "group",
|
|
62
|
+
css: {
|
|
63
|
+
display: "flex",
|
|
64
|
+
alignItems: "stretch",
|
|
65
|
+
height: "100%",
|
|
66
|
+
...(options == null ? void 0 : options.axis) === "y" ? { height: "100%", flexDirection: "column" } : {}
|
|
67
|
+
},
|
|
68
|
+
children
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
/* @__PURE__ */ jsxs(Suspense, { fallback: null, children: [
|
|
72
|
+
(paging == null ? void 0 : paging.type) === "dots" && /* @__PURE__ */ jsx(SwiperDotsPaging, { api: emblaApi, ...paging }),
|
|
73
|
+
(paging == null ? void 0 : paging.type) === "side-arrows" && /* @__PURE__ */ jsx(SwiperSideArrowsPaging, { api: emblaApi, ...paging })
|
|
74
|
+
] })
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
);
|
|
75
78
|
};
|
|
76
79
|
const createStyle = ({ slidesPerView, spaceBetween } = {}) => {
|
|
77
|
-
return
|
|
78
|
-
{
|
|
79
|
-
[
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
flexBasis: isNumber(slidesPerView) ? `calc((100% - (${SWIPER_SLIDE_GAP_VAR} * ${slidesPerView - 1})) / ${slidesPerView})` : void 0
|
|
84
|
-
}
|
|
80
|
+
return {
|
|
81
|
+
[`& > [role="group"]`]: {
|
|
82
|
+
[SWIPER_SLIDE_GAP_VAR_NAME]: isNumber(spaceBetween) ? `${spaceBetween}px` : void 0,
|
|
83
|
+
gap: SWIPER_SLIDE_GAP_VAR,
|
|
84
|
+
[`& > *`]: {
|
|
85
|
+
flexBasis: isNumber(slidesPerView) ? `calc((100% - (${SWIPER_SLIDE_GAP_VAR} * ${slidesPerView - 1})) / ${slidesPerView})` : void 0
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
|
-
|
|
88
|
+
};
|
|
88
89
|
};
|
|
89
90
|
export {
|
|
90
91
|
Swiper
|
|
@@ -1,27 +1,32 @@
|
|
|
1
1
|
import { JSX } from 'react';
|
|
2
|
+
import { EmblaCarouselType } from 'embla-carousel';
|
|
2
3
|
import { AutoplayOptionsType } from 'embla-carousel-autoplay';
|
|
3
|
-
import { default as useEmblaCarousel
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { default as useEmblaCarousel } from 'embla-carousel-react';
|
|
5
|
+
import { ShallowMerge, ToResponsiveProps } from '../../../types';
|
|
6
|
+
import { SwiperDotsPagingProps } from '../swiper-dots-paging';
|
|
7
|
+
import { SwiperSideArrowsPagingProps } from '../swiper-side-arrows-paging';
|
|
8
|
+
import { PrimitiveProps } from '../../primitive';
|
|
6
9
|
export type SwiperOptions = Parameters<typeof useEmblaCarousel>[0];
|
|
7
|
-
export type SwiperApi =
|
|
10
|
+
export type SwiperApi = EmblaCarouselType;
|
|
8
11
|
export type SwiperResponsiveProps = {
|
|
9
12
|
slidesPerView?: number | 'auto';
|
|
10
13
|
spaceBetween?: number;
|
|
11
14
|
};
|
|
12
|
-
type SwiperDosPaging =
|
|
15
|
+
type SwiperDosPaging = ShallowMerge<SwiperDotsPagingProps, {
|
|
13
16
|
type: 'dots';
|
|
14
|
-
options?: SwiperDotsPagingProps;
|
|
15
17
|
}>;
|
|
16
|
-
type
|
|
17
|
-
type
|
|
18
|
+
type SwiperSideArrowsPaging = ShallowMerge<SwiperSideArrowsPagingProps, {
|
|
19
|
+
type: 'side-arrows';
|
|
20
|
+
}>;
|
|
21
|
+
type SwiperPaging = SwiperDosPaging | SwiperSideArrowsPaging;
|
|
22
|
+
type SwiperExtendedProps = ToResponsiveProps<SwiperResponsiveProps> & {
|
|
18
23
|
autoplayOptions?: ShallowMerge<AutoplayOptionsType, {
|
|
19
24
|
delay?: number;
|
|
20
25
|
}>;
|
|
21
26
|
onApi?: (api: SwiperApi) => void;
|
|
22
27
|
options?: Partial<SwiperOptions>;
|
|
23
28
|
paging?: SwiperPaging;
|
|
24
|
-
}
|
|
25
|
-
export type SwiperProps = ShallowMerge<JSX.IntrinsicElements['div']
|
|
29
|
+
};
|
|
30
|
+
export type SwiperProps = ShallowMerge<PrimitiveProps<JSX.IntrinsicElements['div']>, SwiperExtendedProps>;
|
|
26
31
|
export {};
|
|
27
32
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/swiper/swiper/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/swiper/swiper/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,gBAAgB,MAAM,sBAAsB,CAAC;AAEpD,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,MAAM,SAAS,GAAG,iBAAiB,CAAC;AAE1C,MAAM,MAAM,qBAAqB,GAAG;IAClC,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,KAAK,eAAe,GAAG,YAAY,CACjC,qBAAqB,EACrB;IACE,IAAI,EAAE,MAAM,CAAC;CACd,CACF,CAAC;AAEF,KAAK,sBAAsB,GAAG,YAAY,CACxC,2BAA2B,EAC3B;IACE,IAAI,EAAE,aAAa,CAAC;CACrB,CACF,CAAC;AAEF,KAAK,YAAY,GAAG,eAAe,GAAG,sBAAsB,CAAC;AAE7D,KAAK,mBAAmB,GAAG,iBAAiB,CAAC,qBAAqB,CAAC,GAAG;IACpE,eAAe,CAAC,EAAE,YAAY,CAAC,mBAAmB,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACxE,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,IAAI,CAAC;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,YAAY,CAAC,cAAc,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/swiper/swiper-dots-paging/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/swiper/swiper-dots-paging/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SwiperDotsPagingProps } from './types';
|
|
2
|
-
export declare const SwiperDotsPaging: ({ api, size, spaceBetween,
|
|
2
|
+
export declare const SwiperDotsPaging: ({ api, size, spaceBetween, color, offset, sm, md, lg, }: SwiperDotsPagingProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=swiper-dots-paging.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swiper-dots-paging.d.ts","sourceRoot":"","sources":["../../../../src/lib/swiper/swiper-dots-paging/swiper-dots-paging.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"swiper-dots-paging.d.ts","sourceRoot":"","sources":["../../../../src/lib/swiper/swiper-dots-paging/swiper-dots-paging.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,qBAAqB,EAAmC,MAAM,SAAS,CAAC;AAOjF,eAAO,MAAM,gBAAgB,4DAS1B,qBAAqB,qDAwJvB,CAAC"}
|
|
@@ -1,77 +1,201 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, Fragment, jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { useFloating, autoUpdate, shift, flip, size, FloatingPortal } from "@floating-ui/react";
|
|
4
|
+
import { times, isNumber } from "lodash-es";
|
|
4
5
|
import { motion } from "motion/react";
|
|
5
|
-
import {
|
|
6
|
+
import { getColorVar } from "../../../theme/palette.js";
|
|
7
|
+
import { useIsHydrated } from "../../../hooks/use-is-hydrated/index.js";
|
|
8
|
+
import { Primitive } from "../../primitive/primitive.js";
|
|
9
|
+
const SWIPER_DOTS_SIZE_VAR = "--swiper-dots-size";
|
|
10
|
+
const SWIPER_DOTS_OFFSET_VAR = "--swiper-dots-offset";
|
|
11
|
+
const SWIPER_DOTS_SPACING_VAR = "--swiper-dots-spacing";
|
|
6
12
|
const SwiperDotsPaging = ({
|
|
7
13
|
api,
|
|
8
|
-
size = 12,
|
|
14
|
+
size: size$1 = 12,
|
|
9
15
|
spaceBetween = 4,
|
|
10
|
-
|
|
16
|
+
color = "primary",
|
|
17
|
+
offset = 0,
|
|
18
|
+
sm,
|
|
19
|
+
md,
|
|
20
|
+
lg
|
|
11
21
|
}) => {
|
|
12
22
|
const [inViewIndexes, setInViewIndexes] = useState((api == null ? void 0 : api.slidesInView()) ?? []);
|
|
13
23
|
const [totalSlides, setTotalSlides] = useState((api == null ? void 0 : api.slideNodes().length) ?? 0);
|
|
14
|
-
const
|
|
24
|
+
const isHydrated = useIsHydrated();
|
|
25
|
+
const {
|
|
26
|
+
floatingStyles,
|
|
27
|
+
refs: { setFloating, setReference }
|
|
28
|
+
} = useFloating({
|
|
29
|
+
placement: "bottom",
|
|
30
|
+
middleware: [
|
|
31
|
+
shift(),
|
|
32
|
+
flip(),
|
|
33
|
+
size({
|
|
34
|
+
apply({ elements, rects }) {
|
|
35
|
+
Object.assign(elements.floating.style, {
|
|
36
|
+
width: `${rects.reference.width}px`
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
],
|
|
41
|
+
whileElementsMounted: autoUpdate
|
|
42
|
+
});
|
|
15
43
|
useEffect(() => {
|
|
16
|
-
const
|
|
17
|
-
setInViewIndexes(
|
|
44
|
+
const updateSlidesInView = (emblaApi) => {
|
|
45
|
+
setInViewIndexes(emblaApi.slidesInView());
|
|
18
46
|
};
|
|
19
|
-
const
|
|
20
|
-
setTotalSlides(
|
|
47
|
+
const updateTotalSlides = (emblaApi) => {
|
|
48
|
+
setTotalSlides(emblaApi.slideNodes().length ?? 0);
|
|
21
49
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
api == null ? void 0 : api.on("
|
|
50
|
+
if (api) {
|
|
51
|
+
updateSlidesInView(api);
|
|
52
|
+
updateTotalSlides(api);
|
|
53
|
+
}
|
|
54
|
+
api == null ? void 0 : api.on("slidesInView", updateSlidesInView);
|
|
55
|
+
api == null ? void 0 : api.on("slidesChanged", updateTotalSlides);
|
|
27
56
|
return () => {
|
|
28
|
-
api == null ? void 0 : api.off("slidesInView",
|
|
29
|
-
api == null ? void 0 : api.off("
|
|
30
|
-
api == null ? void 0 : api.off("slidesChanged", checkTotalSlides);
|
|
57
|
+
api == null ? void 0 : api.off("slidesInView", updateSlidesInView);
|
|
58
|
+
api == null ? void 0 : api.off("slidesChanged", updateTotalSlides);
|
|
31
59
|
};
|
|
32
60
|
}, [api]);
|
|
33
61
|
const onDotClick = (e) => {
|
|
34
62
|
e.stopPropagation();
|
|
35
|
-
api == null ? void 0 : api.scrollTo(Number(e.currentTarget.
|
|
63
|
+
api == null ? void 0 : api.scrollTo(Number(e.currentTarget.dataset.index));
|
|
36
64
|
};
|
|
37
65
|
const firstInViewIndex = inViewIndexes.at(0) ?? 0;
|
|
38
|
-
return /* @__PURE__ */
|
|
39
|
-
|
|
40
|
-
|
|
66
|
+
if (!isHydrated) return /* @__PURE__ */ jsx(Fragment, {});
|
|
67
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
68
|
+
/* @__PURE__ */ jsx(
|
|
69
|
+
Primitive,
|
|
41
70
|
{
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
71
|
+
ref: setReference,
|
|
72
|
+
sx: {
|
|
73
|
+
position: "absolute",
|
|
74
|
+
width: "100%",
|
|
75
|
+
bottom: `calc(var(${SWIPER_DOTS_SIZE_VAR}) + var(${SWIPER_DOTS_OFFSET_VAR}))`,
|
|
76
|
+
pointerEvents: "none",
|
|
77
|
+
...createReferenceStyle({ size: size$1, offset }),
|
|
78
|
+
sm: createReferenceStyle(sm),
|
|
79
|
+
md: createReferenceStyle(md),
|
|
80
|
+
lg: createReferenceStyle(lg)
|
|
50
81
|
}
|
|
51
82
|
}
|
|
52
|
-
)
|
|
53
|
-
/* @__PURE__ */ jsx(
|
|
54
|
-
|
|
83
|
+
),
|
|
84
|
+
/* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx(
|
|
85
|
+
Primitive,
|
|
55
86
|
{
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
},
|
|
60
|
-
animate: {
|
|
61
|
-
width: inViewIndexes.length * size + (inViewIndexes.length - 1) * spaceBetween,
|
|
62
|
-
left: firstInViewIndex * size + firstInViewIndex * spaceBetween
|
|
87
|
+
style: {
|
|
88
|
+
overflow: "hidden",
|
|
89
|
+
...floatingStyles
|
|
63
90
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
91
|
+
ref: setFloating,
|
|
92
|
+
children: /* @__PURE__ */ jsx(
|
|
93
|
+
Primitive,
|
|
94
|
+
{
|
|
95
|
+
sx: {
|
|
96
|
+
display: "flex",
|
|
97
|
+
justifyContent: "center",
|
|
98
|
+
width: "100%"
|
|
99
|
+
},
|
|
100
|
+
children: /* @__PURE__ */ jsxs(
|
|
101
|
+
Primitive,
|
|
102
|
+
{
|
|
103
|
+
sx: {
|
|
104
|
+
position: "relative",
|
|
105
|
+
display: "flex",
|
|
106
|
+
width: "fit-content",
|
|
107
|
+
maxWidth: "100%",
|
|
108
|
+
...createDotListStyle({ size: size$1, spaceBetween }),
|
|
109
|
+
sm: createDotListStyle(sm),
|
|
110
|
+
md: createDotListStyle(md),
|
|
111
|
+
lg: createDotListStyle(lg),
|
|
112
|
+
gap: `var(${SWIPER_DOTS_SPACING_VAR})`
|
|
113
|
+
},
|
|
114
|
+
children: [
|
|
115
|
+
times(totalSlides).map((slideIndex) => /* @__PURE__ */ jsx(
|
|
116
|
+
Primitive,
|
|
117
|
+
{
|
|
118
|
+
role: "button",
|
|
119
|
+
sx: {
|
|
120
|
+
width: `var(${SWIPER_DOTS_SIZE_VAR})`,
|
|
121
|
+
height: `var(${SWIPER_DOTS_SIZE_VAR})`,
|
|
122
|
+
borderRadius: 9999,
|
|
123
|
+
position: "relative",
|
|
124
|
+
...inViewIndexes.includes(slideIndex) ? { visibility: "hidden" } : {},
|
|
125
|
+
borderWidth: 1,
|
|
126
|
+
borderColor: getColorVar(`${color}.600`),
|
|
127
|
+
backgroundColor: getColorVar("white")
|
|
128
|
+
},
|
|
129
|
+
onClick: onDotClick,
|
|
130
|
+
"data-index": slideIndex
|
|
131
|
+
},
|
|
132
|
+
slideIndex
|
|
133
|
+
)),
|
|
134
|
+
/* @__PURE__ */ jsx(
|
|
135
|
+
motion.div,
|
|
136
|
+
{
|
|
137
|
+
initial: {
|
|
138
|
+
width: 0,
|
|
139
|
+
left: 0
|
|
140
|
+
},
|
|
141
|
+
animate: {
|
|
142
|
+
width: `calc(${inViewIndexes.length} * var(${SWIPER_DOTS_SIZE_VAR}, 0) + ${inViewIndexes.length - 1} * var(${SWIPER_DOTS_SPACING_VAR}, 0))`,
|
|
143
|
+
left: `calc(${firstInViewIndex} * var(${SWIPER_DOTS_SIZE_VAR}) + ${firstInViewIndex} * var(${SWIPER_DOTS_SPACING_VAR}))`
|
|
144
|
+
},
|
|
145
|
+
css: {
|
|
146
|
+
position: "absolute",
|
|
147
|
+
top: 0,
|
|
148
|
+
bottom: 0,
|
|
149
|
+
borderRadius: 9999,
|
|
150
|
+
backgroundColor: "white",
|
|
151
|
+
borderWidth: 1,
|
|
152
|
+
borderColor: getColorVar(`${color}.600`),
|
|
153
|
+
padding: 1
|
|
154
|
+
},
|
|
155
|
+
children: /* @__PURE__ */ jsx(
|
|
156
|
+
"div",
|
|
157
|
+
{
|
|
158
|
+
style: {
|
|
159
|
+
height: "100%",
|
|
160
|
+
width: "100%",
|
|
161
|
+
borderRadius: 9999,
|
|
162
|
+
backgroundColor: getColorVar(`${color}.600`)
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
)
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
)
|
|
71
173
|
}
|
|
72
|
-
)
|
|
174
|
+
) })
|
|
73
175
|
] });
|
|
74
176
|
};
|
|
177
|
+
const createReferenceStyle = ({
|
|
178
|
+
size: size2,
|
|
179
|
+
offset
|
|
180
|
+
} = {}) => {
|
|
181
|
+
return {
|
|
182
|
+
bottom: size2,
|
|
183
|
+
marginBottom: offset
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
const createDotListStyle = ({
|
|
187
|
+
size: size2,
|
|
188
|
+
spaceBetween
|
|
189
|
+
} = {}) => {
|
|
190
|
+
const css = {};
|
|
191
|
+
if (isNumber(size2)) {
|
|
192
|
+
css[SWIPER_DOTS_SIZE_VAR] = `${size2}px`;
|
|
193
|
+
}
|
|
194
|
+
if (isNumber(spaceBetween)) {
|
|
195
|
+
css[SWIPER_DOTS_SPACING_VAR] = `${spaceBetween}px`;
|
|
196
|
+
}
|
|
197
|
+
return css;
|
|
198
|
+
};
|
|
75
199
|
export {
|
|
76
200
|
SwiperDotsPaging
|
|
77
201
|
};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { ColorVariant, ToResponsiveProps } from '../../../types';
|
|
1
2
|
import { SwiperApi } from '../swiper/types';
|
|
2
|
-
|
|
3
|
-
export type SwiperDotsPagingProps = {
|
|
4
|
-
api?: SwiperApi;
|
|
3
|
+
export type SwiperDotsPagingResponsiveProps = {
|
|
5
4
|
size?: number;
|
|
6
5
|
spaceBetween?: number;
|
|
7
|
-
|
|
6
|
+
offset?: number;
|
|
8
7
|
};
|
|
8
|
+
export type SwiperDotsPagingProps = {
|
|
9
|
+
api?: SwiperApi;
|
|
10
|
+
color?: ColorVariant;
|
|
11
|
+
} & ToResponsiveProps<SwiperDotsPagingResponsiveProps>;
|
|
9
12
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/swiper/swiper-dots-paging/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/swiper/swiper-dots-paging/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB,GAAG,iBAAiB,CAAC,+BAA+B,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/swiper/swiper-side-arrows-paging/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SwiperSideArrowsPagingProps, SwiperSideArrowsPagingResponsiveProps } from './types';
|
|
2
|
+
import { StyledCSS } from '../../../types';
|
|
3
|
+
export declare const SwiperSideArrowsPaging: ({ api, size, offset, color, visibility, sm, md, lg, }: SwiperSideArrowsPagingProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const createOverflowStyle: ({ offset, }?: Pick<SwiperSideArrowsPagingResponsiveProps, "offset">) => StyledCSS;
|
|
5
|
+
//# sourceMappingURL=swiper-side-arrows-paging.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swiper-side-arrows-paging.d.ts","sourceRoot":"","sources":["../../../../src/lib/swiper/swiper-side-arrows-paging/swiper-side-arrows-paging.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,2BAA2B,EAAE,qCAAqC,EAAE,MAAM,SAAS,CAAC;AAC7F,OAAO,EAA8B,SAAS,EAAqB,MAAM,SAAS,CAAC;AAQnF,eAAO,MAAM,sBAAsB,0DAShC,2BAA2B,4CAoJ7B,CAAC;AAoHF,eAAO,MAAM,mBAAmB,iBAE7B,IAAI,CAAC,qCAAqC,EAAE,QAAQ,CAAC,KAAQ,SAM/D,CAAC"}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useRef, useCallback, useEffect } from "react";
|
|
3
|
+
import { useFloating, autoUpdate, offset, size, FloatingPortal } from "@floating-ui/react";
|
|
4
|
+
import { isNil, isNumber } from "lodash-es";
|
|
5
|
+
import { getColorVar } from "../../../theme/palette.js";
|
|
6
|
+
import ArrowLeftIcon from "../../../assets/svg/arrow-left.svg.js";
|
|
7
|
+
import { SvgLoader } from "../../../components/svg-loader.js";
|
|
8
|
+
import { Primitive } from "../../primitive/primitive.js";
|
|
9
|
+
const SWIPER_SIDE_ARROWS_OVERFLOW_VAR = "--swiper-side-arrows-overflow";
|
|
10
|
+
const SwiperSideArrowsPaging = ({
|
|
11
|
+
api,
|
|
12
|
+
size: size$1 = 32,
|
|
13
|
+
offset: offset$1 = 0,
|
|
14
|
+
color = "primary",
|
|
15
|
+
visibility = "auto",
|
|
16
|
+
sm,
|
|
17
|
+
md,
|
|
18
|
+
lg
|
|
19
|
+
}) => {
|
|
20
|
+
const [canScrollPrev, setCanScrollPrev] = useState(false);
|
|
21
|
+
const [canScrollNext, setCanScrollNext] = useState(false);
|
|
22
|
+
const [isVisible, setIsVisible] = useState(visibility === "always");
|
|
23
|
+
const hoverStateRef = useRef({ root: false, floating: false });
|
|
24
|
+
const updateVisibility = useCallback(() => {
|
|
25
|
+
const { root, floating } = hoverStateRef.current;
|
|
26
|
+
setIsVisible(root || floating);
|
|
27
|
+
}, []);
|
|
28
|
+
const {
|
|
29
|
+
floatingStyles,
|
|
30
|
+
refs: { setFloating, setReference }
|
|
31
|
+
} = useFloating({
|
|
32
|
+
placement: "top",
|
|
33
|
+
middleware: [
|
|
34
|
+
offset(({ rects }) => ({
|
|
35
|
+
crossAxis: 0,
|
|
36
|
+
mainAxis: -rects.reference.height
|
|
37
|
+
})),
|
|
38
|
+
size({
|
|
39
|
+
apply({ elements, rects }) {
|
|
40
|
+
Object.assign(elements.floating.style, {
|
|
41
|
+
width: `calc(${rects.reference.width}px + var(${SWIPER_SIDE_ARROWS_OVERFLOW_VAR}, 0px) * 2)`,
|
|
42
|
+
height: `${rects.reference.height}px`
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
],
|
|
47
|
+
whileElementsMounted: autoUpdate
|
|
48
|
+
});
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
const updateScrollState = (emblaApi) => {
|
|
51
|
+
setCanScrollPrev(emblaApi.canScrollPrev());
|
|
52
|
+
setCanScrollNext(emblaApi.canScrollNext());
|
|
53
|
+
};
|
|
54
|
+
if (api) {
|
|
55
|
+
updateScrollState(api);
|
|
56
|
+
}
|
|
57
|
+
api == null ? void 0 : api.on("select", updateScrollState);
|
|
58
|
+
return () => {
|
|
59
|
+
api == null ? void 0 : api.off("select", updateScrollState);
|
|
60
|
+
};
|
|
61
|
+
}, [api]);
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (visibility === "always" || !api) return;
|
|
64
|
+
const rootNode = api == null ? void 0 : api.rootNode();
|
|
65
|
+
const onRootEnter = () => {
|
|
66
|
+
hoverStateRef.current.root = true;
|
|
67
|
+
updateVisibility();
|
|
68
|
+
};
|
|
69
|
+
const onRootLeave = () => {
|
|
70
|
+
hoverStateRef.current.root = false;
|
|
71
|
+
updateVisibility();
|
|
72
|
+
};
|
|
73
|
+
rootNode.addEventListener("mouseenter", onRootEnter);
|
|
74
|
+
rootNode.addEventListener("mouseleave", onRootLeave);
|
|
75
|
+
return () => {
|
|
76
|
+
rootNode.removeEventListener("mouseenter", onRootEnter);
|
|
77
|
+
rootNode.removeEventListener("mouseleave", onRootLeave);
|
|
78
|
+
};
|
|
79
|
+
}, [api, updateVisibility, visibility]);
|
|
80
|
+
const onButtonClick = (e) => {
|
|
81
|
+
const direction = e.currentTarget.dataset.direction;
|
|
82
|
+
if (direction === "next") {
|
|
83
|
+
api == null ? void 0 : api.scrollNext();
|
|
84
|
+
} else {
|
|
85
|
+
api == null ? void 0 : api.scrollPrev();
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const onFloatingMouseEnter = (e) => {
|
|
89
|
+
if (visibility === "always") return;
|
|
90
|
+
hoverStateRef.current.floating = true;
|
|
91
|
+
updateVisibility();
|
|
92
|
+
};
|
|
93
|
+
const onFloatingMouseLeave = (e) => {
|
|
94
|
+
if (visibility === "always") return;
|
|
95
|
+
hoverStateRef.current.floating = false;
|
|
96
|
+
updateVisibility();
|
|
97
|
+
};
|
|
98
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
99
|
+
/* @__PURE__ */ jsx(
|
|
100
|
+
Primitive,
|
|
101
|
+
{
|
|
102
|
+
ref: setReference,
|
|
103
|
+
sx: {
|
|
104
|
+
position: "absolute",
|
|
105
|
+
pointerEvents: "none",
|
|
106
|
+
inset: 0
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
/* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx(
|
|
111
|
+
Primitive,
|
|
112
|
+
{
|
|
113
|
+
style: {
|
|
114
|
+
pointerEvents: "none",
|
|
115
|
+
...floatingStyles
|
|
116
|
+
},
|
|
117
|
+
sx: {
|
|
118
|
+
display: "flex",
|
|
119
|
+
alignItems: "stretch",
|
|
120
|
+
justifyContent: "space-between",
|
|
121
|
+
...createOverflowStyle({ offset: offset$1 }),
|
|
122
|
+
sm: createOverflowStyle(sm),
|
|
123
|
+
md: createOverflowStyle(md),
|
|
124
|
+
lg: createOverflowStyle(lg)
|
|
125
|
+
},
|
|
126
|
+
onMouseEnter: onFloatingMouseEnter,
|
|
127
|
+
onMouseLeave: onFloatingMouseLeave,
|
|
128
|
+
ref: setFloating,
|
|
129
|
+
children: ["prev", "next"].map((direction) => {
|
|
130
|
+
const canScroll = direction === "prev" ? canScrollPrev : canScrollNext;
|
|
131
|
+
return /* @__PURE__ */ jsx(
|
|
132
|
+
ArrowButton,
|
|
133
|
+
{
|
|
134
|
+
"data-direction": direction,
|
|
135
|
+
disabled: !canScroll,
|
|
136
|
+
direction,
|
|
137
|
+
color,
|
|
138
|
+
offset: offset$1,
|
|
139
|
+
size: size$1,
|
|
140
|
+
sm,
|
|
141
|
+
md,
|
|
142
|
+
lg,
|
|
143
|
+
visible: visibility === "always" ? true : isVisible,
|
|
144
|
+
onClick: onButtonClick
|
|
145
|
+
},
|
|
146
|
+
direction
|
|
147
|
+
);
|
|
148
|
+
})
|
|
149
|
+
}
|
|
150
|
+
) })
|
|
151
|
+
] });
|
|
152
|
+
};
|
|
153
|
+
const ArrowButton = ({
|
|
154
|
+
direction,
|
|
155
|
+
size: size2,
|
|
156
|
+
offset: offset2,
|
|
157
|
+
color,
|
|
158
|
+
visible,
|
|
159
|
+
sm,
|
|
160
|
+
md,
|
|
161
|
+
lg,
|
|
162
|
+
...props
|
|
163
|
+
}) => {
|
|
164
|
+
const slideOffset = direction === "prev" ? "-100%" : "100%";
|
|
165
|
+
return /* @__PURE__ */ jsx(
|
|
166
|
+
Primitive,
|
|
167
|
+
{
|
|
168
|
+
sx: {
|
|
169
|
+
pointerEvents: "auto",
|
|
170
|
+
position: "relative",
|
|
171
|
+
width: `var(${SWIPER_SIDE_ARROWS_OVERFLOW_VAR})`
|
|
172
|
+
},
|
|
173
|
+
children: /* @__PURE__ */ jsx(
|
|
174
|
+
Primitive,
|
|
175
|
+
{
|
|
176
|
+
sx: {
|
|
177
|
+
position: "absolute",
|
|
178
|
+
top: "50%",
|
|
179
|
+
transform: visible ? "translateY(-50%) translateX(0)" : `translateY(-50%) translateX(${slideOffset})`,
|
|
180
|
+
opacity: visible ? 1 : 0,
|
|
181
|
+
aspectRatio: 1,
|
|
182
|
+
pointerEvents: "auto",
|
|
183
|
+
display: "flex",
|
|
184
|
+
alignItems: "center",
|
|
185
|
+
justifyContent: "center",
|
|
186
|
+
color: getColorVar(`${color}.600`),
|
|
187
|
+
borderWidth: 1,
|
|
188
|
+
borderStyle: "solid",
|
|
189
|
+
borderColor: getColorVar(`${color}.600`),
|
|
190
|
+
borderRadius: 9999,
|
|
191
|
+
backgroundColor: getColorVar("white"),
|
|
192
|
+
":disabled": {
|
|
193
|
+
opacity: visible ? 0.5 : 0
|
|
194
|
+
},
|
|
195
|
+
":hover:not(:disabled)": {
|
|
196
|
+
backgroundColor: getColorVar(`${color}.100`)
|
|
197
|
+
},
|
|
198
|
+
transition: "opacity 200ms ease, background-color 200ms ease, transform 250ms ease",
|
|
199
|
+
"@media (hover: none) and (pointer: coarse)": {
|
|
200
|
+
opacity: 1,
|
|
201
|
+
transform: "translateY(-50%)",
|
|
202
|
+
":disabled": {
|
|
203
|
+
opacity: 0.5
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
...createArrowButtonStyle({ size: size2, offset: offset2 }, direction),
|
|
207
|
+
sm: createArrowButtonStyle(sm, direction),
|
|
208
|
+
md: createArrowButtonStyle(md, direction),
|
|
209
|
+
lg: createArrowButtonStyle(lg, direction)
|
|
210
|
+
},
|
|
211
|
+
...props,
|
|
212
|
+
as: "button",
|
|
213
|
+
children: /* @__PURE__ */ jsx(
|
|
214
|
+
Primitive,
|
|
215
|
+
{
|
|
216
|
+
sx: {
|
|
217
|
+
rotate: direction === "next" ? "180deg" : void 0,
|
|
218
|
+
...createArrowIconStyle({ size: size2 }),
|
|
219
|
+
sm: createArrowIconStyle(sm),
|
|
220
|
+
md: createArrowIconStyle(md),
|
|
221
|
+
lg: createArrowIconStyle(lg)
|
|
222
|
+
},
|
|
223
|
+
children: /* @__PURE__ */ jsx(SvgLoader, { width: void 0, height: void 0, source: ArrowLeftIcon })
|
|
224
|
+
}
|
|
225
|
+
)
|
|
226
|
+
}
|
|
227
|
+
)
|
|
228
|
+
}
|
|
229
|
+
);
|
|
230
|
+
};
|
|
231
|
+
const createArrowButtonStyle = ({ size: size2, offset: offset2 } = {}, direction) => {
|
|
232
|
+
const css = {
|
|
233
|
+
width: size2,
|
|
234
|
+
height: size2
|
|
235
|
+
};
|
|
236
|
+
if (isNumber(offset2)) {
|
|
237
|
+
if (direction === "prev") {
|
|
238
|
+
css.left = Math.max(offset2, 0);
|
|
239
|
+
} else {
|
|
240
|
+
css.right = Math.max(offset2, 0);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return css;
|
|
244
|
+
};
|
|
245
|
+
const createArrowIconStyle = ({ size: size2 } = {}) => {
|
|
246
|
+
if (isNil(size2)) return {};
|
|
247
|
+
const iconSize = Math.round(size2 * 0.625);
|
|
248
|
+
return {
|
|
249
|
+
width: iconSize,
|
|
250
|
+
height: iconSize
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
const createOverflowStyle = ({
|
|
254
|
+
offset: offset2 = 0
|
|
255
|
+
} = {}) => {
|
|
256
|
+
return offset2 < 0 ? {
|
|
257
|
+
[SWIPER_SIDE_ARROWS_OVERFLOW_VAR]: `${-offset2}px`
|
|
258
|
+
} : {};
|
|
259
|
+
};
|
|
260
|
+
export {
|
|
261
|
+
SwiperSideArrowsPaging,
|
|
262
|
+
createOverflowStyle
|
|
263
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ColorVariant, ToResponsiveProps } from '../../../types';
|
|
2
|
+
import { SwiperApi } from '../swiper/types';
|
|
3
|
+
export type SwiperSideArrowsPagingResponsiveProps = {
|
|
4
|
+
size?: number;
|
|
5
|
+
offset?: number;
|
|
6
|
+
};
|
|
7
|
+
export type SwiperSideArrowsPagingVisibility = 'auto' | 'always';
|
|
8
|
+
export type SwiperSideArrowsPagingProps = {
|
|
9
|
+
api?: SwiperApi;
|
|
10
|
+
color?: ColorVariant;
|
|
11
|
+
visibility?: SwiperSideArrowsPagingVisibility;
|
|
12
|
+
} & ToResponsiveProps<SwiperSideArrowsPagingResponsiveProps>;
|
|
13
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/swiper/swiper-side-arrows-paging/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEjE,MAAM,MAAM,2BAA2B,GAAG;IACxC,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,UAAU,CAAC,EAAE,gCAAgC,CAAC;CAC/C,GAAG,iBAAiB,CAAC,qCAAqC,CAAC,CAAC"}
|