@janbox/storefront-ui 2.0.15 → 2.0.17
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/badge/badge.d.ts +1 -1
- package/dist/lib/badge/badge.d.ts.map +1 -1
- package/dist/lib/badge/badge.js +56 -32
- package/dist/lib/badge/types.d.ts +10 -5
- package/dist/lib/badge/types.d.ts.map +1 -1
- 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 +1 -1
- 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 +45 -16
- package/dist/lib/swiper/swiper-side-arrows-paging/types.d.ts +2 -1
- 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/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +14 -7
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { BadgeProps } from './types';
|
|
2
|
-
export declare const Badge: ({
|
|
2
|
+
export declare const Badge: ({ color, content, children }: BadgeProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=badge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/lib/badge/badge.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/lib/badge/badge.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAOrC,eAAO,MAAM,KAAK,iCAA0C,UAAU,4CA2DrE,CAAC"}
|
package/dist/lib/badge/badge.js
CHANGED
|
@@ -1,39 +1,63 @@
|
|
|
1
|
-
import { jsxs, jsx } from "
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { isNil } from "lodash-es";
|
|
3
|
+
import { useFloating, autoUpdate, offset, useMergeRefs, FloatingPortal } from "@floating-ui/react";
|
|
4
4
|
import { getColorShadesByVariant } from "../../utils/index.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
import { cloneElement } from "react";
|
|
6
|
+
import { FLOATING_Z_INDEX } from "../../theme/index.js";
|
|
7
|
+
import { Primitive } from "../primitive/primitive.js";
|
|
8
|
+
import { getTypographyVar } from "../../theme/typography.js";
|
|
9
|
+
const Badge = ({ color = "red", content, children }) => {
|
|
10
|
+
const { main, contrast } = getColorShadesByVariant(color);
|
|
11
|
+
const {
|
|
12
|
+
floatingStyles,
|
|
13
|
+
refs: { setFloating, setReference },
|
|
14
|
+
context
|
|
15
|
+
} = useFloating({
|
|
16
|
+
placement: "top-end",
|
|
17
|
+
middleware: [
|
|
18
|
+
offset(({ rects }) => ({
|
|
19
|
+
crossAxis: Math.round(rects.floating.width / 2),
|
|
20
|
+
mainAxis: -Math.round(rects.floating.height / 2)
|
|
21
|
+
}))
|
|
22
|
+
],
|
|
23
|
+
whileElementsMounted: autoUpdate,
|
|
24
|
+
open: !isNil(content)
|
|
25
|
+
});
|
|
26
|
+
const mergedRefs = useMergeRefs([setReference, children.props.ref]);
|
|
27
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
28
|
+
cloneElement(children, {
|
|
29
|
+
...children.props,
|
|
30
|
+
ref: mergedRefs
|
|
31
|
+
}),
|
|
32
|
+
context.open && /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx(
|
|
33
|
+
"div",
|
|
11
34
|
{
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
height: "1.25rem",
|
|
16
|
-
zIndex: 10,
|
|
17
|
-
display: "flex",
|
|
18
|
-
opacity: 1,
|
|
19
|
-
alignItems: "center",
|
|
20
|
-
justifyContent: "center",
|
|
21
|
-
borderRadius: "9999px",
|
|
22
|
-
borderWidth: "1px",
|
|
23
|
-
borderStyle: "solid",
|
|
24
|
-
borderColor: "#FFFFFF",
|
|
25
|
-
color: "#FFFFFF",
|
|
26
|
-
fontSize: "0.75rem",
|
|
27
|
-
lineHeight: "1rem",
|
|
28
|
-
fontWeight: 400,
|
|
29
|
-
position: "absolute",
|
|
30
|
-
top: 0,
|
|
31
|
-
right: 0
|
|
35
|
+
style: {
|
|
36
|
+
zIndex: FLOATING_Z_INDEX,
|
|
37
|
+
...floatingStyles
|
|
32
38
|
},
|
|
33
|
-
|
|
39
|
+
ref: setFloating,
|
|
40
|
+
children: /* @__PURE__ */ jsx(
|
|
41
|
+
Primitive,
|
|
42
|
+
{
|
|
43
|
+
sx: {
|
|
44
|
+
display: "flex",
|
|
45
|
+
color: contrast,
|
|
46
|
+
alignItems: "center",
|
|
47
|
+
justifyContent: "center",
|
|
48
|
+
backgroundColor: main,
|
|
49
|
+
fontSize: getTypographyVar("xs").fontSize,
|
|
50
|
+
lineHeight: 1,
|
|
51
|
+
padding: 2,
|
|
52
|
+
minWidth: 20,
|
|
53
|
+
minHeight: 20,
|
|
54
|
+
borderRadius: 9999
|
|
55
|
+
},
|
|
56
|
+
children: content
|
|
57
|
+
}
|
|
58
|
+
)
|
|
34
59
|
}
|
|
35
|
-
)
|
|
36
|
-
children
|
|
60
|
+
) })
|
|
37
61
|
] });
|
|
38
62
|
};
|
|
39
63
|
export {
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ColorVariant
|
|
3
|
-
export type BadgeProps
|
|
4
|
-
|
|
1
|
+
import { ReactElement, Ref } from 'react';
|
|
2
|
+
import { ColorVariant } from '../../types';
|
|
3
|
+
export type BadgeProps<T extends {
|
|
4
|
+
ref?: Ref<Element>;
|
|
5
|
+
} = {
|
|
6
|
+
ref?: Ref<Element>;
|
|
7
|
+
}> = {
|
|
8
|
+
content?: number | string;
|
|
5
9
|
color?: ColorVariant;
|
|
6
|
-
|
|
10
|
+
children: ReactElement<T>;
|
|
11
|
+
};
|
|
7
12
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/badge/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/badge/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS;IAAE,GAAG,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;CAAE,GAAG;IAAE,GAAG,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;CAAE,IAAI;IAClF,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;CAC3B,CAAC"}
|
|
@@ -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,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E,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, offsetX, offsetY, color, visibility, sm, md, lg, }: SwiperSideArrowsPagingProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const SwiperSideArrowsPaging: ({ api, size, offsetX, offsetY, color, visibility, anchorSelector, sm, md, lg, }: SwiperSideArrowsPagingProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
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,4CA0L7B,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 { isNumber, isNil } from "lodash-es";
|
|
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";
|
|
@@ -14,13 +14,15 @@ const SwiperSideArrowsPaging = ({
|
|
|
14
14
|
offsetY = "center",
|
|
15
15
|
color = "primary",
|
|
16
16
|
visibility = "auto",
|
|
17
|
+
anchorSelector,
|
|
17
18
|
sm,
|
|
18
19
|
md,
|
|
19
20
|
lg
|
|
20
21
|
}) => {
|
|
21
|
-
const [canScrollPrev, setCanScrollPrev] = useState(
|
|
22
|
-
const [canScrollNext, setCanScrollNext] = useState(
|
|
22
|
+
const [canScrollPrev, setCanScrollPrev] = useState(api.canScrollPrev());
|
|
23
|
+
const [canScrollNext, setCanScrollNext] = useState(api.canScrollNext());
|
|
23
24
|
const [isVisible, setIsVisible] = useState(visibility === "always");
|
|
25
|
+
const [referenceStyle, setReferenceStyle] = useState(anchorSelector ? {} : { top: 0, bottom: 0 });
|
|
24
26
|
const hoverStateRef = useRef({ root: false, floating: false });
|
|
25
27
|
const updateVisibility = useCallback(() => {
|
|
26
28
|
const { root, floating } = hoverStateRef.current;
|
|
@@ -28,7 +30,8 @@ const SwiperSideArrowsPaging = ({
|
|
|
28
30
|
}, []);
|
|
29
31
|
const {
|
|
30
32
|
floatingStyles,
|
|
31
|
-
refs: { setFloating, setReference }
|
|
33
|
+
refs: { setFloating, setReference },
|
|
34
|
+
context
|
|
32
35
|
} = useFloating({
|
|
33
36
|
placement: "top",
|
|
34
37
|
middleware: [
|
|
@@ -38,6 +41,7 @@ const SwiperSideArrowsPaging = ({
|
|
|
38
41
|
})),
|
|
39
42
|
size({
|
|
40
43
|
apply({ elements, rects }) {
|
|
44
|
+
console.log(elements);
|
|
41
45
|
Object.assign(elements.floating.style, {
|
|
42
46
|
width: `calc(${rects.reference.width}px + var(${SWIPER_SIDE_ARROWS_OVERFLOW_VAR}, 0px) * 2)`,
|
|
43
47
|
height: `${rects.reference.height}px`
|
|
@@ -45,23 +49,23 @@ const SwiperSideArrowsPaging = ({
|
|
|
45
49
|
}
|
|
46
50
|
})
|
|
47
51
|
],
|
|
48
|
-
whileElementsMounted: autoUpdate
|
|
52
|
+
whileElementsMounted: autoUpdate,
|
|
53
|
+
open: !isEmpty(referenceStyle)
|
|
49
54
|
});
|
|
50
55
|
useEffect(() => {
|
|
51
56
|
const updateScrollState = (emblaApi) => {
|
|
52
57
|
setCanScrollPrev(emblaApi.canScrollPrev());
|
|
53
58
|
setCanScrollNext(emblaApi.canScrollNext());
|
|
54
59
|
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
api == null ? void 0 : api.on("select", updateScrollState);
|
|
60
|
+
api.on("select", updateScrollState);
|
|
61
|
+
api.on("slidesChanged", updateScrollState);
|
|
59
62
|
return () => {
|
|
60
|
-
api
|
|
63
|
+
api.off("select", updateScrollState);
|
|
64
|
+
api.off("slidesChanged", updateScrollState);
|
|
61
65
|
};
|
|
62
66
|
}, [api]);
|
|
63
67
|
useEffect(() => {
|
|
64
|
-
if (visibility === "always"
|
|
68
|
+
if (visibility === "always") return;
|
|
65
69
|
const rootNode = api == null ? void 0 : api.rootNode();
|
|
66
70
|
const onRootEnter = () => {
|
|
67
71
|
hoverStateRef.current.root = true;
|
|
@@ -78,15 +82,38 @@ const SwiperSideArrowsPaging = ({
|
|
|
78
82
|
rootNode.removeEventListener("mouseleave", onRootLeave);
|
|
79
83
|
};
|
|
80
84
|
}, [api, updateVisibility, visibility]);
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
if (!anchorSelector) return;
|
|
87
|
+
const rootNode = api.rootNode();
|
|
88
|
+
const update = () => {
|
|
89
|
+
const anchorEl2 = rootNode.querySelector(anchorSelector);
|
|
90
|
+
if (!anchorEl2) return;
|
|
91
|
+
const rootRect = rootNode.getBoundingClientRect();
|
|
92
|
+
const anchorRect = anchorEl2.getBoundingClientRect();
|
|
93
|
+
setReferenceStyle({
|
|
94
|
+
top: anchorRect.top - rootRect.top,
|
|
95
|
+
height: anchorRect.height
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
const anchorEl = rootNode.querySelector(anchorSelector);
|
|
99
|
+
if (anchorEl) {
|
|
100
|
+
const observer = new ResizeObserver(update);
|
|
101
|
+
observer.observe(anchorEl);
|
|
102
|
+
observer.observe(rootNode);
|
|
103
|
+
return () => {
|
|
104
|
+
observer.disconnect();
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}, [api, anchorSelector]);
|
|
81
108
|
const onButtonClick = (e) => {
|
|
82
109
|
const direction = e.currentTarget.dataset.direction;
|
|
83
110
|
if (direction === "next") {
|
|
84
|
-
api
|
|
111
|
+
api.scrollNext();
|
|
85
112
|
} else {
|
|
86
|
-
api
|
|
113
|
+
api.scrollPrev();
|
|
87
114
|
}
|
|
88
115
|
};
|
|
89
|
-
const onFloatingMouseEnter = (
|
|
116
|
+
const onFloatingMouseEnter = (_e) => {
|
|
90
117
|
if (visibility === "always") return;
|
|
91
118
|
hoverStateRef.current.floating = true;
|
|
92
119
|
updateVisibility();
|
|
@@ -104,11 +131,13 @@ const SwiperSideArrowsPaging = ({
|
|
|
104
131
|
sx: {
|
|
105
132
|
position: "absolute",
|
|
106
133
|
pointerEvents: "none",
|
|
107
|
-
|
|
134
|
+
left: 0,
|
|
135
|
+
right: 0,
|
|
136
|
+
...referenceStyle
|
|
108
137
|
}
|
|
109
138
|
}
|
|
110
139
|
),
|
|
111
|
-
/* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx(
|
|
140
|
+
context.open && /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx(
|
|
112
141
|
Primitive,
|
|
113
142
|
{
|
|
114
143
|
style: {
|
|
@@ -7,8 +7,9 @@ export type SwiperSideArrowsPagingResponsiveProps = {
|
|
|
7
7
|
};
|
|
8
8
|
export type SwiperSideArrowsPagingVisibility = 'auto' | 'always';
|
|
9
9
|
export type SwiperSideArrowsPagingProps = {
|
|
10
|
-
api
|
|
10
|
+
api: SwiperApi;
|
|
11
11
|
color?: ColorVariant;
|
|
12
12
|
visibility?: SwiperSideArrowsPagingVisibility;
|
|
13
|
+
anchorSelector?: string;
|
|
13
14
|
} & ToResponsiveProps<SwiperSideArrowsPagingResponsiveProps>;
|
|
14
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,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,
|
|
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,
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export declare const getColorShadesByVariant: (variant?: ColorVariant) => {
|
|
|
15
15
|
disabledText: string;
|
|
16
16
|
ariaDisabledSurface: string;
|
|
17
17
|
ariaDisabledText: string;
|
|
18
|
+
contrast: string;
|
|
18
19
|
} | {
|
|
19
20
|
main?: undefined;
|
|
20
21
|
contrastText?: undefined;
|
|
@@ -25,6 +26,7 @@ export declare const getColorShadesByVariant: (variant?: ColorVariant) => {
|
|
|
25
26
|
disabledText?: undefined;
|
|
26
27
|
ariaDisabledSurface?: undefined;
|
|
27
28
|
ariaDisabledText?: undefined;
|
|
29
|
+
contrast?: undefined;
|
|
28
30
|
};
|
|
29
31
|
export declare const mergeComponentProps: <T extends object>(...args: Array<T | object | ((current: T) => T | object)>) => T;
|
|
30
32
|
export declare const flattenChildren: (children: React.ReactNode) => ReactElement[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyD,YAAY,EAAE,MAAM,OAAO,CAAC;AAI5F,OAAO,EAAe,MAAM,EAAqB,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAEpD,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyD,YAAY,EAAE,MAAM,OAAO,CAAC;AAI5F,OAAO,EAAe,MAAM,EAAqB,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAEpD,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAerD,eAAO,MAAM,uBAAuB,aAAc,YAAY;;;;;;;;;;;;;;;;;;;;;;CAgG7D,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,MAAM,WAAW,KAAK,CAAC,CAAC,GAAG,MAAM,GAAG,CAAC,C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HANGED
|
@@ -17,7 +17,8 @@ const getColorShadesByVariant = (variant) => {
|
|
|
17
17
|
disabledSurface: getColorVar("primary.300"),
|
|
18
18
|
disabledText: getColorVar("primary.500"),
|
|
19
19
|
ariaDisabledSurface: getColorVar("primary.300"),
|
|
20
|
-
ariaDisabledText: getColorVar("primary.300")
|
|
20
|
+
ariaDisabledText: getColorVar("primary.300"),
|
|
21
|
+
contrast: getColorVar("white")
|
|
21
22
|
};
|
|
22
23
|
case "secondary":
|
|
23
24
|
return {
|
|
@@ -29,7 +30,8 @@ const getColorShadesByVariant = (variant) => {
|
|
|
29
30
|
disabledSurface: getColorVar("secondary.300"),
|
|
30
31
|
disabledText: getColorVar("secondary.500"),
|
|
31
32
|
ariaDisabledSurface: getColorVar("secondary.300"),
|
|
32
|
-
ariaDisabledText: getColorVar("secondary.300")
|
|
33
|
+
ariaDisabledText: getColorVar("secondary.300"),
|
|
34
|
+
contrast: getColorVar("white")
|
|
33
35
|
};
|
|
34
36
|
case "green":
|
|
35
37
|
return {
|
|
@@ -41,7 +43,8 @@ const getColorShadesByVariant = (variant) => {
|
|
|
41
43
|
disabledSurface: getColorVar("green.300"),
|
|
42
44
|
disabledText: getColorVar("green.500"),
|
|
43
45
|
ariaDisabledSurface: getColorVar("green.300"),
|
|
44
|
-
ariaDisabledText: getColorVar("green.300")
|
|
46
|
+
ariaDisabledText: getColorVar("green.300"),
|
|
47
|
+
contrast: getColorVar("white")
|
|
45
48
|
};
|
|
46
49
|
case "orange":
|
|
47
50
|
return {
|
|
@@ -53,7 +56,8 @@ const getColorShadesByVariant = (variant) => {
|
|
|
53
56
|
disabledSurface: getColorVar("orange.300"),
|
|
54
57
|
disabledText: getColorVar("orange.500"),
|
|
55
58
|
ariaDisabledSurface: getColorVar("orange.300"),
|
|
56
|
-
ariaDisabledText: getColorVar("orange.300")
|
|
59
|
+
ariaDisabledText: getColorVar("orange.300"),
|
|
60
|
+
contrast: getColorVar("white")
|
|
57
61
|
};
|
|
58
62
|
case "red":
|
|
59
63
|
return {
|
|
@@ -65,7 +69,8 @@ const getColorShadesByVariant = (variant) => {
|
|
|
65
69
|
disabledSurface: getColorVar("red.300"),
|
|
66
70
|
disabledText: getColorVar("red.500"),
|
|
67
71
|
ariaDisabledSurface: getColorVar("red.300"),
|
|
68
|
-
ariaDisabledText: getColorVar("red.300")
|
|
72
|
+
ariaDisabledText: getColorVar("red.300"),
|
|
73
|
+
contrast: getColorVar("white")
|
|
69
74
|
};
|
|
70
75
|
case "blue":
|
|
71
76
|
return {
|
|
@@ -77,7 +82,8 @@ const getColorShadesByVariant = (variant) => {
|
|
|
77
82
|
disabledSurface: getColorVar("blue.300"),
|
|
78
83
|
disabledText: getColorVar("blue.500"),
|
|
79
84
|
ariaDisabledSurface: getColorVar("blue.300"),
|
|
80
|
-
ariaDisabledText: getColorVar("blue.300")
|
|
85
|
+
ariaDisabledText: getColorVar("blue.300"),
|
|
86
|
+
contrast: getColorVar("white")
|
|
81
87
|
};
|
|
82
88
|
case "neutral":
|
|
83
89
|
return {
|
|
@@ -89,7 +95,8 @@ const getColorShadesByVariant = (variant) => {
|
|
|
89
95
|
disabledSurface: getColorVar("neutral.300"),
|
|
90
96
|
disabledText: getColorVar("neutral.500"),
|
|
91
97
|
ariaDisabledSurface: getColorVar("neutral.300"),
|
|
92
|
-
ariaDisabledText: getColorVar("neutral.300")
|
|
98
|
+
ariaDisabledText: getColorVar("neutral.300"),
|
|
99
|
+
contrast: getColorVar("white")
|
|
93
100
|
};
|
|
94
101
|
default:
|
|
95
102
|
return {};
|