@janbox/storefront-ui 2.0.14 → 2.0.16
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/lib/button/button.d.ts.map +1 -1
- package/dist/lib/button/button.js +10 -6
- package/dist/lib/swiper/swiper/swiper.d.ts.map +1 -1
- package/dist/lib/swiper/swiper/swiper.js +1 -1
- package/dist/lib/swiper/swiper/types.d.ts +1 -1
- package/dist/lib/swiper/swiper/types.d.ts.map +1 -1
- package/dist/lib/swiper/swiper-dots-paging/types.d.ts +1 -1
- package/dist/lib/swiper/swiper-dots-paging/types.d.ts.map +1 -1
- package/dist/lib/swiper/swiper-side-arrows-paging/swiper-side-arrows-paging.d.ts +2 -2
- package/dist/lib/swiper/swiper-side-arrows-paging/swiper-side-arrows-paging.d.ts.map +1 -1
- package/dist/lib/swiper/swiper-side-arrows-paging/swiper-side-arrows-paging.js +77 -25
- package/dist/lib/swiper/swiper-side-arrows-paging/types.d.ts +4 -2
- package/dist/lib/swiper/swiper-side-arrows-paging/types.d.ts.map +1 -1
- package/dist/lib/tabs/tab-content/tab-content.d.ts +1 -1
- package/dist/lib/tabs/tab-content/tab-content.d.ts.map +1 -1
- package/dist/lib/tabs/tab-content/tab-content.js +4 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/lib/button/button.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAyB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/lib/button/button.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAyB,MAAM,SAAS,CAAC;AAY7D,eAAO,MAAM,MAAM,iCAAkC,WAAW,qDA+N/D,CAAC"}
|
|
@@ -12,6 +12,7 @@ import { getColorVar } from "../../theme/palette.js";
|
|
|
12
12
|
import { getColorShadesByVariant, getSizeVariantState } from "../../utils/index.js";
|
|
13
13
|
import { createSxInterpolation, cn } from "../../utils/stylesheet.js";
|
|
14
14
|
import { Icon } from "../icon/icon.js";
|
|
15
|
+
import { Primitive } from "../primitive/primitive.js";
|
|
15
16
|
const Button = ({ children, ref, ..._props }) => {
|
|
16
17
|
const buttonRef = useRef(null);
|
|
17
18
|
const { className } = useRippleEffect(buttonRef);
|
|
@@ -156,8 +157,9 @@ const Button = ({ children, ref, ..._props }) => {
|
|
|
156
157
|
{
|
|
157
158
|
size: getSizeVariantState(size).iconSize,
|
|
158
159
|
...startIcon,
|
|
159
|
-
|
|
160
|
-
flexShrink: 0
|
|
160
|
+
sx: {
|
|
161
|
+
flexShrink: 0,
|
|
162
|
+
...startIcon.sx
|
|
161
163
|
},
|
|
162
164
|
sm: {
|
|
163
165
|
size: getSizeVariantState(sm == null ? void 0 : sm.size).iconSize,
|
|
@@ -179,8 +181,9 @@ const Button = ({ children, ref, ..._props }) => {
|
|
|
179
181
|
{
|
|
180
182
|
size: getSizeVariantState(size).iconSize,
|
|
181
183
|
...endIcon,
|
|
182
|
-
|
|
183
|
-
flexShrink: 0
|
|
184
|
+
sx: {
|
|
185
|
+
flexShrink: 0,
|
|
186
|
+
...endIcon.sx
|
|
184
187
|
},
|
|
185
188
|
sm: {
|
|
186
189
|
size: getSizeVariantState(sm == null ? void 0 : sm.size).iconSize,
|
|
@@ -198,16 +201,17 @@ const Button = ({ children, ref, ..._props }) => {
|
|
|
198
201
|
),
|
|
199
202
|
suffix,
|
|
200
203
|
isLoading && /* @__PURE__ */ jsx(
|
|
201
|
-
|
|
204
|
+
Primitive,
|
|
202
205
|
{
|
|
203
206
|
"data-loading": true,
|
|
204
|
-
|
|
207
|
+
sx: {
|
|
205
208
|
position: "absolute",
|
|
206
209
|
inset: 0,
|
|
207
210
|
display: "flex",
|
|
208
211
|
alignItems: "center",
|
|
209
212
|
justifyContent: "center"
|
|
210
213
|
},
|
|
214
|
+
as: "span",
|
|
211
215
|
children: /* @__PURE__ */ jsx(Icon, { css: animateSpinStyle, source: LoadingIcon })
|
|
212
216
|
}
|
|
213
217
|
)
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,qDA+DtE,CAAC"}
|
|
@@ -68,7 +68,7 @@ const Swiper = ({ children, onApi, ref, ..._props }) => {
|
|
|
68
68
|
children
|
|
69
69
|
}
|
|
70
70
|
),
|
|
71
|
-
/* @__PURE__ */ jsxs(Suspense, { fallback: null, children: [
|
|
71
|
+
!!emblaApi && /* @__PURE__ */ jsxs(Suspense, { fallback: null, children: [
|
|
72
72
|
(paging == null ? void 0 : paging.type) === "dots" && /* @__PURE__ */ jsx(SwiperDotsPaging, { api: emblaApi, ...paging }),
|
|
73
73
|
(paging == null ? void 0 : paging.type) === "side-arrows" && /* @__PURE__ */ jsx(SwiperSideArrowsPaging, { api: emblaApi, ...paging })
|
|
74
74
|
] })
|
|
@@ -18,7 +18,7 @@ type SwiperDosPaging = ShallowMerge<SwiperDotsPagingProps, {
|
|
|
18
18
|
type SwiperSideArrowsPaging = ShallowMerge<SwiperSideArrowsPagingProps, {
|
|
19
19
|
type: 'side-arrows';
|
|
20
20
|
}>;
|
|
21
|
-
type SwiperPaging = SwiperDosPaging | SwiperSideArrowsPaging
|
|
21
|
+
type SwiperPaging = Omit<SwiperDosPaging, 'api'> | Omit<SwiperSideArrowsPaging, 'api'>;
|
|
22
22
|
type SwiperExtendedProps = ToResponsiveProps<SwiperResponsiveProps> & {
|
|
23
23
|
autoplayOptions?: ShallowMerge<AutoplayOptionsType, {
|
|
24
24
|
delay?: number;
|
|
@@ -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;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;
|
|
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,IAAI,CAAC,eAAe,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC;AAEvF,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"}
|
|
@@ -6,7 +6,7 @@ export type SwiperDotsPagingResponsiveProps = {
|
|
|
6
6
|
offset?: number;
|
|
7
7
|
};
|
|
8
8
|
export type SwiperDotsPagingProps = {
|
|
9
|
-
api
|
|
9
|
+
api: SwiperApi;
|
|
10
10
|
color?: ColorVariant;
|
|
11
11
|
} & ToResponsiveProps<SwiperDotsPagingResponsiveProps>;
|
|
12
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,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,
|
|
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,EAAE,SAAS,CAAC;IACf,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB,GAAG,iBAAiB,CAAC,+BAA+B,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SwiperSideArrowsPagingProps, SwiperSideArrowsPagingResponsiveProps } from './types';
|
|
2
2
|
import { StyledCSS } from '../../../types';
|
|
3
|
-
export declare const SwiperSideArrowsPaging: ({ api, size,
|
|
4
|
-
export declare const createOverflowStyle: ({
|
|
3
|
+
export declare const SwiperSideArrowsPaging: ({ api, size, offsetX, offsetY, color, visibility, anchorSelector, sm, md, lg, }: SwiperSideArrowsPagingProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const createOverflowStyle: ({ offsetX, }?: Pick<SwiperSideArrowsPagingResponsiveProps, "offsetX">) => StyledCSS;
|
|
5
5
|
//# sourceMappingURL=swiper-side-arrows-paging.d.ts.map
|
|
@@ -1 +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,
|
|
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,oFAWhC,2BAA2B,4CA4L7B,CAAC;AA2IF,eAAO,MAAM,mBAAmB,kBAE7B,IAAI,CAAC,qCAAqC,EAAE,SAAS,CAAC,KAAQ,SAMhE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useRef, useCallback, useEffect } from "react";
|
|
3
3
|
import { useFloating, autoUpdate, offset, size, FloatingPortal } from "@floating-ui/react";
|
|
4
|
-
import {
|
|
4
|
+
import { isEmpty, isNumber, isNil } from "lodash-es";
|
|
5
5
|
import { getColorVar } from "../../../theme/palette.js";
|
|
6
6
|
import ArrowLeftIcon from "../../../assets/svg/arrow-left.svg.js";
|
|
7
7
|
import { SvgLoader } from "../../../components/svg-loader.js";
|
|
@@ -10,9 +10,11 @@ const SWIPER_SIDE_ARROWS_OVERFLOW_VAR = "--swiper-side-arrows-overflow";
|
|
|
10
10
|
const SwiperSideArrowsPaging = ({
|
|
11
11
|
api,
|
|
12
12
|
size: size$1 = 32,
|
|
13
|
-
|
|
13
|
+
offsetX = "center",
|
|
14
|
+
offsetY = "center",
|
|
14
15
|
color = "primary",
|
|
15
16
|
visibility = "auto",
|
|
17
|
+
anchorSelector,
|
|
16
18
|
sm,
|
|
17
19
|
md,
|
|
18
20
|
lg
|
|
@@ -20,6 +22,7 @@ const SwiperSideArrowsPaging = ({
|
|
|
20
22
|
const [canScrollPrev, setCanScrollPrev] = useState(false);
|
|
21
23
|
const [canScrollNext, setCanScrollNext] = useState(false);
|
|
22
24
|
const [isVisible, setIsVisible] = useState(visibility === "always");
|
|
25
|
+
const [referenceStyle, setReferenceStyle] = useState(anchorSelector ? {} : { top: 0, bottom: 0 });
|
|
23
26
|
const hoverStateRef = useRef({ root: false, floating: false });
|
|
24
27
|
const updateVisibility = useCallback(() => {
|
|
25
28
|
const { root, floating } = hoverStateRef.current;
|
|
@@ -27,7 +30,8 @@ const SwiperSideArrowsPaging = ({
|
|
|
27
30
|
}, []);
|
|
28
31
|
const {
|
|
29
32
|
floatingStyles,
|
|
30
|
-
refs: { setFloating, setReference }
|
|
33
|
+
refs: { setFloating, setReference },
|
|
34
|
+
context
|
|
31
35
|
} = useFloating({
|
|
32
36
|
placement: "top",
|
|
33
37
|
middleware: [
|
|
@@ -37,6 +41,7 @@ const SwiperSideArrowsPaging = ({
|
|
|
37
41
|
})),
|
|
38
42
|
size({
|
|
39
43
|
apply({ elements, rects }) {
|
|
44
|
+
console.log(elements);
|
|
40
45
|
Object.assign(elements.floating.style, {
|
|
41
46
|
width: `calc(${rects.reference.width}px + var(${SWIPER_SIDE_ARROWS_OVERFLOW_VAR}, 0px) * 2)`,
|
|
42
47
|
height: `${rects.reference.height}px`
|
|
@@ -44,7 +49,8 @@ const SwiperSideArrowsPaging = ({
|
|
|
44
49
|
}
|
|
45
50
|
})
|
|
46
51
|
],
|
|
47
|
-
whileElementsMounted: autoUpdate
|
|
52
|
+
whileElementsMounted: autoUpdate,
|
|
53
|
+
open: !isEmpty(referenceStyle)
|
|
48
54
|
});
|
|
49
55
|
useEffect(() => {
|
|
50
56
|
const updateScrollState = (emblaApi) => {
|
|
@@ -77,6 +83,29 @@ const SwiperSideArrowsPaging = ({
|
|
|
77
83
|
rootNode.removeEventListener("mouseleave", onRootLeave);
|
|
78
84
|
};
|
|
79
85
|
}, [api, updateVisibility, visibility]);
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
if (!anchorSelector || !api) return;
|
|
88
|
+
const rootNode = api.rootNode();
|
|
89
|
+
const update = () => {
|
|
90
|
+
const anchorEl2 = rootNode.querySelector(anchorSelector);
|
|
91
|
+
if (!anchorEl2) return;
|
|
92
|
+
const rootRect = rootNode.getBoundingClientRect();
|
|
93
|
+
const anchorRect = anchorEl2.getBoundingClientRect();
|
|
94
|
+
setReferenceStyle({
|
|
95
|
+
top: anchorRect.top - rootRect.top,
|
|
96
|
+
height: anchorRect.height
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
const anchorEl = rootNode.querySelector(anchorSelector);
|
|
100
|
+
if (anchorEl) {
|
|
101
|
+
const observer = new ResizeObserver(update);
|
|
102
|
+
observer.observe(anchorEl);
|
|
103
|
+
observer.observe(rootNode);
|
|
104
|
+
return () => {
|
|
105
|
+
observer.disconnect();
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}, [api, anchorSelector]);
|
|
80
109
|
const onButtonClick = (e) => {
|
|
81
110
|
const direction = e.currentTarget.dataset.direction;
|
|
82
111
|
if (direction === "next") {
|
|
@@ -85,7 +114,7 @@ const SwiperSideArrowsPaging = ({
|
|
|
85
114
|
api == null ? void 0 : api.scrollPrev();
|
|
86
115
|
}
|
|
87
116
|
};
|
|
88
|
-
const onFloatingMouseEnter = (
|
|
117
|
+
const onFloatingMouseEnter = (_e) => {
|
|
89
118
|
if (visibility === "always") return;
|
|
90
119
|
hoverStateRef.current.floating = true;
|
|
91
120
|
updateVisibility();
|
|
@@ -103,11 +132,13 @@ const SwiperSideArrowsPaging = ({
|
|
|
103
132
|
sx: {
|
|
104
133
|
position: "absolute",
|
|
105
134
|
pointerEvents: "none",
|
|
106
|
-
|
|
135
|
+
left: 0,
|
|
136
|
+
right: 0,
|
|
137
|
+
...referenceStyle
|
|
107
138
|
}
|
|
108
139
|
}
|
|
109
140
|
),
|
|
110
|
-
/* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx(
|
|
141
|
+
context.open && /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx(
|
|
111
142
|
Primitive,
|
|
112
143
|
{
|
|
113
144
|
style: {
|
|
@@ -118,7 +149,7 @@ const SwiperSideArrowsPaging = ({
|
|
|
118
149
|
display: "flex",
|
|
119
150
|
alignItems: "stretch",
|
|
120
151
|
justifyContent: "space-between",
|
|
121
|
-
...createOverflowStyle({
|
|
152
|
+
...createOverflowStyle({ offsetX }),
|
|
122
153
|
sm: createOverflowStyle(sm),
|
|
123
154
|
md: createOverflowStyle(md),
|
|
124
155
|
lg: createOverflowStyle(lg)
|
|
@@ -135,7 +166,8 @@ const SwiperSideArrowsPaging = ({
|
|
|
135
166
|
disabled: !canScroll,
|
|
136
167
|
direction,
|
|
137
168
|
color,
|
|
138
|
-
|
|
169
|
+
offsetX,
|
|
170
|
+
offsetY,
|
|
139
171
|
size: size$1,
|
|
140
172
|
sm,
|
|
141
173
|
md,
|
|
@@ -153,7 +185,8 @@ const SwiperSideArrowsPaging = ({
|
|
|
153
185
|
const ArrowButton = ({
|
|
154
186
|
direction,
|
|
155
187
|
size: size2,
|
|
156
|
-
|
|
188
|
+
offsetX,
|
|
189
|
+
offsetY,
|
|
157
190
|
color,
|
|
158
191
|
visible,
|
|
159
192
|
sm,
|
|
@@ -161,7 +194,6 @@ const ArrowButton = ({
|
|
|
161
194
|
lg,
|
|
162
195
|
...props
|
|
163
196
|
}) => {
|
|
164
|
-
const slideOffset = direction === "prev" ? "-100%" : "100%";
|
|
165
197
|
return /* @__PURE__ */ jsx(
|
|
166
198
|
Primitive,
|
|
167
199
|
{
|
|
@@ -176,7 +208,6 @@ const ArrowButton = ({
|
|
|
176
208
|
sx: {
|
|
177
209
|
position: "absolute",
|
|
178
210
|
top: "50%",
|
|
179
|
-
transform: visible ? "translateY(-50%) translateX(0)" : `translateY(-50%) translateX(${slideOffset})`,
|
|
180
211
|
opacity: visible ? 1 : 0,
|
|
181
212
|
aspectRatio: 1,
|
|
182
213
|
pointerEvents: "auto",
|
|
@@ -198,15 +229,15 @@ const ArrowButton = ({
|
|
|
198
229
|
transition: "opacity 200ms ease, background-color 200ms ease, transform 250ms ease",
|
|
199
230
|
"@media (hover: none) and (pointer: coarse)": {
|
|
200
231
|
opacity: 1,
|
|
201
|
-
transform: "translateY(-50%)",
|
|
202
232
|
":disabled": {
|
|
203
233
|
opacity: 0.5
|
|
204
|
-
}
|
|
234
|
+
},
|
|
235
|
+
...createArrowButtonStyle({ size: size2, offsetX, offsetY }, direction, true)
|
|
205
236
|
},
|
|
206
|
-
...createArrowButtonStyle({ size: size2,
|
|
207
|
-
sm: createArrowButtonStyle(sm, direction),
|
|
208
|
-
md: createArrowButtonStyle(md, direction),
|
|
209
|
-
lg: createArrowButtonStyle(lg, direction)
|
|
237
|
+
...createArrowButtonStyle({ size: size2, offsetX, offsetY }, direction, visible),
|
|
238
|
+
sm: createArrowButtonStyle(sm, direction, visible),
|
|
239
|
+
md: createArrowButtonStyle(md, direction, visible),
|
|
240
|
+
lg: createArrowButtonStyle(lg, direction, visible)
|
|
210
241
|
},
|
|
211
242
|
...props,
|
|
212
243
|
as: "button",
|
|
@@ -228,17 +259,38 @@ const ArrowButton = ({
|
|
|
228
259
|
}
|
|
229
260
|
);
|
|
230
261
|
};
|
|
231
|
-
const createArrowButtonStyle = ({ size: size2,
|
|
262
|
+
const createArrowButtonStyle = ({ size: size2, offsetX, offsetY } = {}, direction, visible) => {
|
|
232
263
|
const css = {
|
|
233
264
|
width: size2,
|
|
234
265
|
height: size2
|
|
235
266
|
};
|
|
236
|
-
|
|
267
|
+
const transforms = [];
|
|
268
|
+
if (offsetY === "center") {
|
|
269
|
+
css.top = "50%";
|
|
270
|
+
transforms.push("translateY(-50%)");
|
|
271
|
+
} else if (isNumber(offsetY)) {
|
|
272
|
+
css.top = offsetY;
|
|
273
|
+
}
|
|
274
|
+
if (offsetX === "center") {
|
|
237
275
|
if (direction === "prev") {
|
|
238
|
-
css.left =
|
|
276
|
+
css.left = 0;
|
|
277
|
+
transforms.push(visible === false ? "translateX(-100%)" : "translateX(-50%)");
|
|
239
278
|
} else {
|
|
240
|
-
css.right =
|
|
279
|
+
css.right = 0;
|
|
280
|
+
transforms.push(visible === false ? "translateX(100%)" : "translateX(50%)");
|
|
241
281
|
}
|
|
282
|
+
} else if (isNumber(offsetX)) {
|
|
283
|
+
if (direction === "prev") {
|
|
284
|
+
css.left = Math.max(offsetX, 0);
|
|
285
|
+
} else {
|
|
286
|
+
css.right = Math.max(offsetX, 0);
|
|
287
|
+
}
|
|
288
|
+
if (visible === false) {
|
|
289
|
+
transforms.push(direction === "prev" ? "translateX(-100%)" : "translateX(100%)");
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
if (transforms.length > 0) {
|
|
293
|
+
css.transform = transforms.join(" ");
|
|
242
294
|
}
|
|
243
295
|
return css;
|
|
244
296
|
};
|
|
@@ -251,10 +303,10 @@ const createArrowIconStyle = ({ size: size2 } = {}) => {
|
|
|
251
303
|
};
|
|
252
304
|
};
|
|
253
305
|
const createOverflowStyle = ({
|
|
254
|
-
|
|
306
|
+
offsetX = 0
|
|
255
307
|
} = {}) => {
|
|
256
|
-
return
|
|
257
|
-
[SWIPER_SIDE_ARROWS_OVERFLOW_VAR]: `${-
|
|
308
|
+
return isNumber(offsetX) && offsetX < 0 ? {
|
|
309
|
+
[SWIPER_SIDE_ARROWS_OVERFLOW_VAR]: `${-offsetX}px`
|
|
258
310
|
} : {};
|
|
259
311
|
};
|
|
260
312
|
export {
|
|
@@ -2,12 +2,14 @@ import { ColorVariant, ToResponsiveProps } from '../../../types';
|
|
|
2
2
|
import { SwiperApi } from '../swiper/types';
|
|
3
3
|
export type SwiperSideArrowsPagingResponsiveProps = {
|
|
4
4
|
size?: number;
|
|
5
|
-
|
|
5
|
+
offsetX?: number | 'center';
|
|
6
|
+
offsetY?: number | 'center';
|
|
6
7
|
};
|
|
7
8
|
export type SwiperSideArrowsPagingVisibility = 'auto' | 'always';
|
|
8
9
|
export type SwiperSideArrowsPagingProps = {
|
|
9
|
-
api
|
|
10
|
+
api: SwiperApi;
|
|
10
11
|
color?: ColorVariant;
|
|
11
12
|
visibility?: SwiperSideArrowsPagingVisibility;
|
|
13
|
+
anchorSelector?: string;
|
|
12
14
|
} & ToResponsiveProps<SwiperSideArrowsPagingResponsiveProps>;
|
|
13
15
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +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;
|
|
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,OAAO,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEjE,MAAM,MAAM,2BAA2B,GAAG;IACxC,GAAG,EAAE,SAAS,CAAC;IACf,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,UAAU,CAAC,EAAE,gCAAgC,CAAC;IAC9C,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,iBAAiB,CAAC,qCAAqC,CAAC,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { TabContentProps } from './types';
|
|
2
|
-
export declare const TabContent: ({ children, ...rest }: TabContentProps) => import("
|
|
2
|
+
export declare const TabContent: ({ children, ...rest }: TabContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=tab-content.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-content.d.ts","sourceRoot":"","sources":["../../../../src/lib/tabs/tab-content/tab-content.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"tab-content.d.ts","sourceRoot":"","sources":["../../../../src/lib/tabs/tab-content/tab-content.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAO1C,eAAO,MAAM,UAAU,0BAA2B,eAAe,4CAehE,CAAC"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { jsx } from "
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { flattenChildren } from "../../../utils/index.js";
|
|
3
3
|
import { useTabsContext } from "../tabs/helpers.js";
|
|
4
|
+
import { Primitive } from "../../primitive/primitive.js";
|
|
4
5
|
const TabContent = ({ children, ...rest }) => {
|
|
5
6
|
const { activeIndex } = useTabsContext();
|
|
6
7
|
const flattenedChildren = flattenChildren(children);
|
|
7
8
|
return /* @__PURE__ */ jsx(
|
|
8
|
-
|
|
9
|
+
Primitive,
|
|
9
10
|
{
|
|
10
|
-
|
|
11
|
+
sx: {
|
|
11
12
|
display: "contents"
|
|
12
13
|
},
|
|
13
14
|
...rest,
|