@zenpatient-org/healthspan-marketing-ui 0.2.4 → 0.2.5
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/components/ImageGallery/ImageGallery.cjs.js +1 -1
- package/dist/components/ImageGallery/ImageGallery.d.ts +2 -1
- package/dist/components/ImageGallery/ImageGallery.es.js +31 -29
- package/dist/components/ImageGallery/components/ImageGalleryPagination/ImageGalleryPagination.cjs.js +1 -0
- package/dist/components/ImageGallery/components/ImageGalleryPagination/ImageGalleryPagination.d.ts +9 -0
- package/dist/components/ImageGallery/components/ImageGalleryPagination/ImageGalleryPagination.es.js +16 -0
- package/dist/components/ImageGallery/components/ImageGalleryPagination/imageGalleryPagination.module.css +30 -0
- package/dist/components/ImageGallery/components/ImageGalleryPagination/index.d.ts +1 -0
- package/dist/components/ImageGallery/components/index.d.ts +1 -0
- package/dist/components/ImageGallery/imageGallery.module.css +3 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("swiper/modules"),
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("swiper/modules"),d=require("swiper/react"),q=require("react"),w=require("../../utils/useSwiper/useSwiper.cjs.js"),j=require("../../utils/cn/cn.cjs.js");;/* empty css */;/* empty css */;/* empty css */const i=require("../../src/components/ImageGallery/imageGallery.module.css"),y=require("../Label/Label.cjs.js"),x=require("./components/ImageGalleryPagination/ImageGalleryPagination.cjs.js"),P=require("../GalleryPagination/GalleryPagination.cjs.js"),_=[m.Navigation],v=({images:n,label:a,className:p,pagination:s="preview"})=>{const{activeIndex:t,handleSlideTo:c,handleSlideChange:S,onSwiperInit:h,handleSwiperResize:g,handleUserInteraction:r}=w.useSwiperWithAutoPlay(3e3),o=q.useCallback(l=>{r(),c(l)},[r,c]);return e.jsxs("div",{className:j.cn(i.root,p),children:[a&&e.jsx("div",{className:i.labelWrap,children:e.jsx(y.Label,{color:"black",size:"sm",children:a})}),e.jsx(d.Swiper,{onSwiper:h,onResize:g,onSlideChange:S,onTouchStart:r,onTouchEnd:r,modules:_,spaceBetween:0,slidesPerView:1,className:i.swiper,children:n.map((l,u)=>e.jsx(d.SwiperSlide,{children:e.jsx("div",{className:i.imageWrapper,children:e.jsx("img",{src:l,alt:"product image",className:i.image,onClick:r},u)})},u))}),s==="preview"&&n.length>1&&e.jsx(x.ImageGalleryPagination,{images:n,activeIndex:t,onSelect:o}),s==="plain"&&n.length>1&&e.jsx(P.GalleryPagination,{count:n.length,activeIndex:t,onSelect:o})]})};exports.ImageGallery=v;
|
|
@@ -3,6 +3,7 @@ type ImageGalleryProps = {
|
|
|
3
3
|
images: Array<string>;
|
|
4
4
|
label?: string;
|
|
5
5
|
className?: string;
|
|
6
|
+
pagination?: 'plain' | 'preview';
|
|
6
7
|
};
|
|
7
|
-
export declare const ImageGallery: ({ images, label, className }: ImageGalleryProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const ImageGallery: ({ images, label, className, pagination }: ImageGalleryProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
export {};
|
|
@@ -1,52 +1,54 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { Navigation as
|
|
4
|
-
import { Swiper as
|
|
5
|
-
import { useCallback as
|
|
6
|
-
import { useSwiperWithAutoPlay as
|
|
7
|
-
import { cn as
|
|
2
|
+
import { jsxs as w, jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import { Navigation as f } from "swiper/modules";
|
|
4
|
+
import { Swiper as g, SwiperSlide as u } from "swiper/react";
|
|
5
|
+
import { useCallback as v } from "react";
|
|
6
|
+
import { useSwiperWithAutoPlay as I } from "../../utils/useSwiper/useSwiper.es.js";
|
|
7
|
+
import { cn as N } from "../../utils/cn/cn.es.js";
|
|
8
8
|
/* empty css */
|
|
9
9
|
/* empty css */
|
|
10
10
|
/* empty css */
|
|
11
|
-
import
|
|
12
|
-
import { Label as
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
import o from "../../components/ImageGallery/imageGallery.module.css";
|
|
12
|
+
import { Label as P } from "../Label/Label.es.js";
|
|
13
|
+
import { ImageGalleryPagination as y } from "./components/ImageGalleryPagination/ImageGalleryPagination.es.js";
|
|
14
|
+
import { GalleryPagination as C } from "../GalleryPagination/GalleryPagination.es.js";
|
|
15
|
+
const W = [f], D = ({ images: r, label: n, className: s, pagination: t = "preview" }) => {
|
|
16
|
+
const { activeIndex: a, handleSlideTo: m, handleSlideChange: d, onSwiperInit: h, handleSwiperResize: S, handleUserInteraction: i } = I(3e3), c = v(
|
|
17
|
+
(l) => {
|
|
18
|
+
i(), m(l);
|
|
18
19
|
},
|
|
19
|
-
[i,
|
|
20
|
+
[i, m]
|
|
20
21
|
);
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
-
|
|
22
|
+
return /* @__PURE__ */ w("div", { className: N(o.root, s), children: [
|
|
23
|
+
n && /* @__PURE__ */ e("div", { className: o.labelWrap, children: /* @__PURE__ */ e(P, { color: "black", size: "sm", children: n }) }),
|
|
23
24
|
/* @__PURE__ */ e(
|
|
24
|
-
|
|
25
|
+
g,
|
|
25
26
|
{
|
|
26
|
-
onSwiper:
|
|
27
|
-
onResize:
|
|
28
|
-
onSlideChange:
|
|
27
|
+
onSwiper: h,
|
|
28
|
+
onResize: S,
|
|
29
|
+
onSlideChange: d,
|
|
29
30
|
onTouchStart: i,
|
|
30
31
|
onTouchEnd: i,
|
|
31
|
-
modules:
|
|
32
|
+
modules: W,
|
|
32
33
|
spaceBetween: 0,
|
|
33
34
|
slidesPerView: 1,
|
|
34
|
-
className:
|
|
35
|
-
children:
|
|
35
|
+
className: o.swiper,
|
|
36
|
+
children: r.map((l, p) => /* @__PURE__ */ e(u, { children: /* @__PURE__ */ e("div", { className: o.imageWrapper, children: /* @__PURE__ */ e(
|
|
36
37
|
"img",
|
|
37
38
|
{
|
|
38
|
-
src:
|
|
39
|
+
src: l,
|
|
39
40
|
alt: "product image",
|
|
40
|
-
className:
|
|
41
|
+
className: o.image,
|
|
41
42
|
onClick: i
|
|
42
43
|
},
|
|
43
|
-
|
|
44
|
-
) }) },
|
|
44
|
+
p
|
|
45
|
+
) }) }, p))
|
|
45
46
|
}
|
|
46
47
|
),
|
|
47
|
-
|
|
48
|
+
t === "preview" && r.length > 1 && /* @__PURE__ */ e(y, { images: r, activeIndex: a, onSelect: c }),
|
|
49
|
+
t === "plain" && r.length > 1 && /* @__PURE__ */ e(C, { count: r.length, activeIndex: a, onSelect: c })
|
|
48
50
|
] });
|
|
49
51
|
};
|
|
50
52
|
export {
|
|
51
|
-
|
|
53
|
+
D as ImageGallery
|
|
52
54
|
};
|
package/dist/components/ImageGallery/components/ImageGalleryPagination/ImageGalleryPagination.cjs.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),r=require("../../../../utils/cn/cn.cjs.js"),t=require("../../../../src/components/ImageGallery/components/ImageGalleryPagination/imageGalleryPagination.module.css"),c=({images:s,activeIndex:l,onSelect:i})=>n.jsx("div",{className:t.root,children:s.map((a,e)=>n.jsx("button",{type:"button",className:r.cn(t.thumbnailButton,{[t.active]:e===l}),onClick:()=>i(e),children:n.jsx("img",{src:a,alt:`thumbnail ${e+1}`,className:t.thumbnailImage})},a))});exports.ImageGalleryPagination=c;
|
package/dist/components/ImageGallery/components/ImageGalleryPagination/ImageGalleryPagination.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
type ImageGalleryPaginationProps = {
|
|
4
|
+
images: string[];
|
|
5
|
+
activeIndex: number;
|
|
6
|
+
onSelect: (index: number) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const ImageGalleryPagination: React.FC<ImageGalleryPaginationProps>;
|
|
9
|
+
export {};
|
package/dist/components/ImageGallery/components/ImageGalleryPagination/ImageGalleryPagination.es.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { cn as e } from "../../../../utils/cn/cn.es.js";
|
|
3
|
+
import t from "../../../../components/ImageGallery/components/ImageGalleryPagination/imageGalleryPagination.module.css";
|
|
4
|
+
const u = ({ images: n, activeIndex: r, onSelect: l }) => /* @__PURE__ */ m("div", { className: t.root, children: n.map((o, a) => /* @__PURE__ */ m(
|
|
5
|
+
"button",
|
|
6
|
+
{
|
|
7
|
+
type: "button",
|
|
8
|
+
className: e(t.thumbnailButton, { [t.active]: a === r }),
|
|
9
|
+
onClick: () => l(a),
|
|
10
|
+
children: /* @__PURE__ */ m("img", { src: o, alt: `thumbnail ${a + 1}`, className: t.thumbnailImage })
|
|
11
|
+
},
|
|
12
|
+
o
|
|
13
|
+
)) });
|
|
14
|
+
export {
|
|
15
|
+
u as ImageGalleryPagination
|
|
16
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: center;
|
|
4
|
+
gap: 12px;
|
|
5
|
+
padding: 0 24px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.thumbnailButton {
|
|
9
|
+
width: 64px;
|
|
10
|
+
height: 64px;
|
|
11
|
+
padding: 0;
|
|
12
|
+
border: 1px solid var(--color-neutral-200);
|
|
13
|
+
border-radius: var(--border-radius-xs);
|
|
14
|
+
background: none;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
opacity: 0.5;
|
|
17
|
+
transition: opacity 0.3s ease;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.thumbnailButton.active {
|
|
22
|
+
opacity: 1;
|
|
23
|
+
border-color: var(--color-neutral-200);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.thumbnailImage {
|
|
27
|
+
width: 100%;
|
|
28
|
+
height: 100%;
|
|
29
|
+
object-fit: cover;
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ImageGalleryPagination';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ImageGalleryPagination';
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
overflow: hidden;
|
|
10
10
|
border-radius: var(--border-radius-md);
|
|
11
11
|
background-color: var(--color-bg-neutral-light);
|
|
12
|
+
gap: 24px;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
.labelWrap {
|
|
15
16
|
width: 100%;
|
|
16
17
|
display: flex;
|
|
17
18
|
align-items: flex-start;
|
|
18
|
-
margin-bottom: 12px;
|
|
19
19
|
padding: 0 24px;
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -43,15 +43,15 @@
|
|
|
43
43
|
@media (width <= 768px) {
|
|
44
44
|
.root {
|
|
45
45
|
padding: 16px 0;
|
|
46
|
+
gap: 16px;
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
.labelWrap {
|
|
49
50
|
padding: 0 16px;
|
|
50
|
-
margin-bottom: 14px;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
.swiper {
|
|
54
|
-
margin-bottom:
|
|
54
|
+
margin-bottom: 0;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
.imageWrapper {
|