@momo-webplatform/mobase 0.0.42 → 0.0.43

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-webplatform/mobase",
3
- "version": "0.0.42",
3
+ "version": "0.0.43",
4
4
  "description": "Mobase is the UI framework upon we build product experiences at MoMo.vn, base on Radix primitives, and Tailwind CSS.",
5
5
  "scripts": {
6
6
  "dev": "rm -rf .next && next dev",
@@ -32,9 +32,6 @@ const react_1 = require("swiper/react");
32
32
  const swiper_1 = require("swiper");
33
33
  const DialogPrimitive = __importStar(require("@radix-ui/react-dialog"));
34
34
  const react_2 = __importStar(require("react"));
35
- require("swiper/css");
36
- require("swiper/css/navigation");
37
- require("swiper/css/pagination");
38
35
  const IconButton_1 = require("../IconButton");
39
36
  const utils_1 = require("../../helpers/utils");
40
37
  const lucide_react_1 = require("lucide-react");
@@ -42,7 +39,7 @@ const outline_1 = require("@heroicons/react/24/outline");
42
39
  const lodash_1 = __importDefault(require("lodash"));
43
40
  exports.LightboxGalleryDialog = DialogPrimitive.Root;
44
41
  const DialogPortal = DialogPrimitive.Portal;
45
- const DialogOverlay = react_2.default.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(DialogPrimitive.Overlay, { ref: ref, className: (0, utils_1.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className), ...props })));
42
+ const DialogOverlay = react_2.default.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(DialogPrimitive.Overlay, { ref: ref, className: (0, utils_1.cn)("fixed inset-0 bg-black/80 z-50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className), ...props })));
46
43
  DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
47
44
  const CloseDialog = ({ clearActiveIndex }) => {
48
45
  return ((0, jsx_runtime_1.jsxs)(DialogPrimitive.Close, { onClick: () => clearActiveIndex?.(), className: "flex transition-all z-10 text-sm items-center space-x-1 absolute left-3 top-6 md:left-6 hover:bg-white/20 text-white rounded-md px-4 py-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "h-4 w-4 mt-0.5" }), (0, jsx_runtime_1.jsx)("div", { className: "", children: "\u0110\u00F3ng c\u1EEDa s\u1ED5" })] }));
@@ -54,7 +51,7 @@ const LightboxThumbnail = ({ children, src, alt, className, classNameImage, onCl
54
51
  return ((0, jsx_runtime_1.jsxs)(DialogPrimitive.Trigger, { className: (0, utils_1.cn)("aspect-[2/3] relative overflow-hidden rounded-lg", className), onClick: handleOnClickThumbnail, children: [children, (0, jsx_runtime_1.jsx)("img", { src: src, alt: alt, className: (0, utils_1.cn)("w-full h-full object-cover rounded-lg", classNameImage) })] }));
55
52
  };
56
53
  exports.LightboxThumbnail = LightboxThumbnail;
57
- exports.DialogContent = react_2.default.forwardRef(({ className, children, ...props }, ref) => ((0, jsx_runtime_1.jsxs)(DialogPortal, { children: [(0, jsx_runtime_1.jsx)(DialogOverlay, { className: "bg-black" }), (0, jsx_runtime_1.jsxs)(DialogPrimitive.Content, { ref: ref, className: (0, utils_1.cn)("h-full min-w-full border-none rounded-none fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] ", className), ...props, children: [children, (0, jsx_runtime_1.jsx)(CloseDialog, {})] })] })));
54
+ exports.DialogContent = react_2.default.forwardRef(({ className, children, ...props }, ref) => ((0, jsx_runtime_1.jsxs)(DialogPortal, { children: [(0, jsx_runtime_1.jsx)(DialogOverlay, { className: "bg-black" }), (0, jsx_runtime_1.jsxs)(DialogPrimitive.Content, { ref: ref, className: (0, utils_1.cn)("h-full min-w-full border-none rounded-none z-[999] fixed bg-black left-[50%] top-[50%] grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] ", className), ...props, children: [children, (0, jsx_runtime_1.jsx)(CloseDialog, {})] })] })));
58
55
  exports.DialogContent.displayName = DialogPrimitive.Content.displayName;
59
56
  const DialogHeader = ({ className, ...props }) => ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props }));
60
57
  DialogHeader.displayName = "DialogHeader";
@@ -64,7 +61,7 @@ const DialogTitle = react_2.default.forwardRef(({ className, ...props }, ref) =>
64
61
  DialogTitle.displayName = DialogPrimitive.Title.displayName;
65
62
  const DialogDescription = react_2.default.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(DialogPrimitive.Description, { ref: ref, className: (0, utils_1.cn)("text-sm text-muted-foreground", className), ...props })));
66
63
  DialogDescription.displayName = DialogPrimitive.Description.displayName;
67
- const LightBoxContent = ({ images, activeSlideIndex = 0, withSideBar, subHtmlSideBar, classNameSubHtmSideBar, className, }) => {
64
+ const LightBoxContent = ({ images, activeSlideIndex = 0, withSideBar, subHtmlSideBar, classNameSubHtmSideBar, className, isPagination = false, }) => {
68
65
  const [activeSlide, setActiveSlide] = (0, react_2.useState)(activeSlideIndex);
69
66
  const [titleImage, setTitleImg] = (0, react_2.useState)("");
70
67
  const onGetTitleImage = () => {
@@ -91,6 +88,9 @@ const LightBoxContent = ({ images, activeSlideIndex = 0, withSideBar, subHtmlSid
91
88
  `;
92
89
  },
93
90
  };
91
+ const arrayModule = isPagination
92
+ ? [swiper_1.Navigation, swiper_1.Lazy, swiper_1.Pagination]
93
+ : [swiper_1.Navigation, swiper_1.Lazy];
94
94
  return ((0, jsx_runtime_1.jsxs)(exports.DialogContent, { className: (0, utils_1.cn)("flex py-0", className), children: [(0, jsx_runtime_1.jsxs)("div", { className: "lightbox flex-1 py-6", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-end md:justify-center mt-2 w-full", children: (0, jsx_runtime_1.jsxs)("div", { children: [activeSlide ? activeSlide + 1 : 1, " / ", images?.length] }) }), (0, jsx_runtime_1.jsxs)(react_1.Swiper, { initialSlide: activeSlideIndex, onSlideChange: ({ realIndex }) => {
95
95
  setActiveSlide(realIndex);
96
96
  onGetTitleImage();
@@ -107,7 +107,7 @@ const LightBoxContent = ({ images, activeSlideIndex = 0, withSideBar, subHtmlSid
107
107
  }, slidesPerView: "auto", className: "swiper lightboxSwiper", navigation: {
108
108
  nextEl: ".lightbox .next-lightbox",
109
109
  prevEl: ".lightbox .prev-lightbox",
110
- }, pagination: pagination, modules: [swiper_1.Navigation, swiper_1.Lazy, swiper_1.Pagination], lazy: {
110
+ }, pagination: pagination, modules: arrayModule, lazy: {
111
111
  loadPrevNext: true,
112
112
  }, children: [images.map((img, index) => ((0, jsx_runtime_1.jsxs)(react_1.SwiperSlide, { children: [(0, jsx_runtime_1.jsx)("div", { className: "absolute top-28 bottom-28 left-0 right-0 min-h-0 sm:left-20 sm:right-20", children: (0, jsx_runtime_1.jsx)("img", { src: img.url, alt: "", className: "absolute h-full w-full object-contain", loading: "lazy" }) }), (0, jsx_runtime_1.jsx)("div", { className: "swiper-lazy-preloader swiper-lazy-preloader-white" }), (0, jsx_runtime_1.jsx)("div", { className: "text-sm px-20 text-center text-white/80 absolute bottom-10 my-4 flex items-center justify-center w-full z-[999]", children: titleImage })] }, index))), (0, jsx_runtime_1.jsx)(IconButton_1.IconButton, { className: "disabled:bg-white/60 prev-lightbox button-swiper translate swiper-cate-merchant absolute inset-y-1/2 left-6 z-10 hidden h-12 w-12 -translate-y-1/2 cursor-pointer items-center justify-center rounded-full border border-gray-300 bg-white text-white shadow-md duration-200 ease-in-out hover:bg-white/80 hover:shadow-md md:flex", children: (0, jsx_runtime_1.jsx)(outline_1.ChevronLeftIcon, { className: "w-7 text-slate-900" }) }), (0, jsx_runtime_1.jsx)(IconButton_1.IconButton, { className: "disabled:bg-white/60 next-lightbox translate swiper-cate-merchant button-swiper absolute inset-y-1/2 right-6 z-10 hidden h-12 w-12 -translate-y-1/2 cursor-pointer items-center justify-center rounded-full border border-gray-300 bg-white text-white shadow-md duration-300 ease-in-out hover:bg-white/80 hover:shadow-md md:flex", children: (0, jsx_runtime_1.jsx)(outline_1.ChevronRightIcon, { className: "w-7 text-slate-900" }) })] }), (0, jsx_runtime_1.jsx)("style", { children: `
113
113
  .lightbox {
@@ -139,7 +139,7 @@ const LightBoxContent = ({ images, activeSlideIndex = 0, withSideBar, subHtmlSid
139
139
  }
140
140
  .lightboxSwiper {
141
141
  width: 100%;
142
- height: 95%;
142
+ height: 100%;
143
143
  padding: 0;
144
144
  }
145
145
 
@@ -165,7 +165,7 @@ const LightBoxContent = ({ images, activeSlideIndex = 0, withSideBar, subHtmlSid
165
165
  height: 100%;
166
166
  }
167
167
  .swiper-wrapper{
168
- bottom: 90px;
168
+ bottom: 0px;
169
169
  }
170
170
  .swiper-pagination{
171
171
  max-width: 100%;