@momo-webplatform/mobase 0.0.40 → 0.0.42

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.
Files changed (28) hide show
  1. package/README.md +1 -1
  2. package/package.json +5 -3
  3. package/publish/cjs/components/Accordion/Accordion.js +1 -1
  4. package/publish/cjs/components/Choicebox/Choicebox.js +90 -0
  5. package/publish/cjs/components/Choicebox/index.js +6 -0
  6. package/publish/cjs/components/Dialog/Dialog.js +7 -7
  7. package/publish/cjs/components/LightboxGallery/LightboxGallery.js +203 -0
  8. package/publish/cjs/components/LightboxGallery/index.js +7 -0
  9. package/publish/cjs/components/TextButton/index.js +2 -1
  10. package/publish/cjs/index.js +2 -0
  11. package/publish/cjs/mobase-tw-plugin/plugin.js +4 -4
  12. package/publish/cjs/tsconfig.lib.tsbuildinfo +1 -1
  13. package/publish/esm/components/Accordion/Accordion.js +1 -1
  14. package/publish/esm/components/Choicebox/Choicebox.d.ts +31 -0
  15. package/publish/esm/components/Choicebox/Choicebox.js +62 -0
  16. package/publish/esm/components/Choicebox/index.d.ts +1 -0
  17. package/publish/esm/components/Choicebox/index.js +1 -0
  18. package/publish/esm/components/Dialog/Dialog.js +7 -7
  19. package/publish/esm/components/LightboxGallery/LightboxGallery.d.ts +37 -0
  20. package/publish/esm/components/LightboxGallery/LightboxGallery.js +171 -0
  21. package/publish/esm/components/LightboxGallery/index.d.ts +1 -0
  22. package/publish/esm/components/LightboxGallery/index.js +1 -0
  23. package/publish/esm/components/TextButton/index.d.ts +1 -1
  24. package/publish/esm/components/TextButton/index.js +1 -1
  25. package/publish/esm/index.d.ts +2 -0
  26. package/publish/esm/index.js +2 -0
  27. package/publish/esm/mobase-tw-plugin/plugin.js +5 -5
  28. package/publish/esm/tsconfig.lib.tsbuildinfo +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <p align="center">
2
2
  <a href="https://momo.vn/">
3
- <img width="100%" src="https://homepage.momocdn.net/img/momo-upload-api-240307154531-638454231312111578.jpeg" alt="Mobase UI library" />
3
+ <img width="100%" src="https://homepage.momocdn.net/img/momo-upload-api-240509152105-638508648658180278.jpg" alt="Mobase UI library" />
4
4
  </a>
5
5
  </p>
6
6
 
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@momo-webplatform/mobase",
3
- "version": "0.0.40",
3
+ "version": "0.0.42",
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
- "dev": "next dev",
7
- "build": "next build",
6
+ "dev": "rm -rf .next && next dev",
7
+ "build": "rm -rf .next && next build",
8
8
  "start": "next start",
9
9
  "build:lib": "rm -rf ./publish/ && yarn build:lib:esm && yarn build:lib:cjs",
10
10
  "build:lib:cjs": "tsc -p tsconfig.lib.json",
@@ -69,6 +69,7 @@
69
69
  "date-fns": "^3.2.0",
70
70
  "deepmerge": "^4.3.1",
71
71
  "dlv": "^1.1.3",
72
+ "embla-carousel-react": "^8.0.4",
72
73
  "flat": "^3.0.1",
73
74
  "framer-motion": "^11.0.24",
74
75
  "html-react-parser": "^5.1.10",
@@ -88,6 +89,7 @@
88
89
  "react-icons": "^4.11.0",
89
90
  "react-indiana-drag-scroll": "^2.2.0",
90
91
  "react-use": "^17.5.0",
92
+ "swiper": "^8.4.4",
91
93
  "tailwind-merge": "^2.2.0",
92
94
  "tailwindcss": "^3.4.3",
93
95
  "tailwindcss-animate": "^1.0.7",
@@ -36,7 +36,7 @@ Accordion.displayName = "AccordionRoot";
36
36
  const AccordionItem = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(AccordionPrimitive.Item, { ref: ref, className: (0, utils_1.cn)("border-b border-gray-200", className), ...props })));
37
37
  exports.AccordionItem = AccordionItem;
38
38
  AccordionItem.displayName = "AccordionItem";
39
- const AccordionTrigger = React.forwardRef(({ className, children, ...props }, ref) => ((0, jsx_runtime_1.jsx)(AccordionPrimitive.Header, { className: "flex", children: (0, jsx_runtime_1.jsxs)(AccordionPrimitive.Trigger, { ref: ref, className: (0, utils_1.cn)("flex flex-1 items-center text-left justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180 text-gray-900", className), ...props, children: [children, (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { className: "h-4 w-4 shrink-0 transition-transform duration-200 ml-1" })] }) })));
39
+ const AccordionTrigger = React.forwardRef(({ className, children, ...props }, ref) => ((0, jsx_runtime_1.jsx)(AccordionPrimitive.Header, { className: "flex", children: (0, jsx_runtime_1.jsxs)(AccordionPrimitive.Trigger, { ref: ref, className: (0, utils_1.cn)("flex flex-1 items-center text-left justify-between py-4 font-medium transition-all hover:underline hover:text-pink-600 [&[data-state=open]]:text-pink-600 [&[data-state=open]>svg]:rotate-180 text-gray-900", className), ...props, children: [children, (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { className: "h-4 w-4 shrink-0 transition-transform duration-200 ml-1" })] }) })));
40
40
  exports.AccordionTrigger = AccordionTrigger;
41
41
  AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
42
42
  const AccordionContent = React.forwardRef(({ className, children, ...props }, ref) => ((0, jsx_runtime_1.jsx)(AccordionPrimitive.Content, { ref: ref, className: "overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down text-left ", ...props, children: (0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("pb-4 pt-0 text-gray-900 prose-sm", className), children: children }) })));
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.ChoiceboxGroup = exports.ChoiceboxGroupItem = void 0;
27
+ const jsx_runtime_1 = require("react/jsx-runtime");
28
+ const react_1 = __importStar(require("react"));
29
+ const Checkbox_1 = require("../Checkbox");
30
+ const utils_1 = require("../../helpers/utils");
31
+ const lucide_react_1 = require("lucide-react");
32
+ const ChoiceboxGroupItem = ({ title, description, value, type, name, checked, disabled, hiddenInput, classNameDescription, classNameTitle, className, onChange, children, }) => {
33
+ const [checkedCheckbox, setCheckedCheckbox] = (0, react_1.useState)(false);
34
+ const handleChange = (event) => {
35
+ if (onChange) {
36
+ onChange(event?.target?.value);
37
+ }
38
+ };
39
+ const handleChangeCheckbox = (checked) => {
40
+ setCheckedCheckbox(checked);
41
+ onChange?.(checked);
42
+ };
43
+ return ((0, jsx_runtime_1.jsxs)("label", { className: (0, utils_1.cn)(" flex rounded-md cursor-pointer p-4 items-center space-x-6", checked || checkedCheckbox ? "mobase-focus" : "mobase-visible", disabled ? "opacity-60 bg-gray-100" : "", className), htmlFor: value, children: [!title && !description ? null : ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("text-gray-900 text-sm select-none font-bold", classNameTitle), children: title }), (0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("text-gray-900 select-none text-sm", classNameDescription), children: description })] })), children, type === "radio" ? ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("relative", hiddenInput ? "hidden" : ""), children: [(0, jsx_runtime_1.jsx)("input", { "aria-checked": checked, "data-state": checked ? "checked" : "unchecked", checked: checked, type: "radio", value: value, name: name, id: value, disabled: disabled, onChange: handleChange, className: "custom-radio cursor-pointer aspect-square ml-auto h-4 w-4 rounded-full border border-gray-700 disabled:bg-gray-300 disabled:data-[state=checked]:text-gray-500 data-[state=checked]:text-white disabled:data-[state=checked]:bg-gray-300 data-[state=checked]:bg-pink-500 disabled:border-none data-[state=checked]:border-none text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-default disabled:opacity-40" }), (0, jsx_runtime_1.jsx)(lucide_react_1.Circle, { className: (0, utils_1.cn)("h-2 w-2 absolute top-[6px] right-[4px] fill-white text-current transition-opacity", checked ? "opacti-100" : "opacity-0", disabled ? "fill-gray-300" : "") })] })) : ((0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { disabled: disabled, id: value, value: value, name: value, onCheckedChange: handleChangeCheckbox, className: (0, utils_1.cn)("ml-auto", hiddenInput ? "hidden" : "") })), (0, jsx_runtime_1.jsx)("style", { children: `
44
+ .custom-radio {
45
+ appearance: none;
46
+ border: 1px solid #ccc;
47
+ border-radius: 50%;
48
+ width: 16px;
49
+ height: 16px;
50
+ position: relative;
51
+ }
52
+ .mobase-visible {
53
+ box-shadow: 0px 0px 0px 1px rgb(var(--mobase-gray-400) / 1) inset;
54
+ }
55
+
56
+ .mobase-focus {
57
+ box-shadow: 0px 0px 0px 2px rgb(var(--mobase-pink-500) / 1) inset;
58
+ }
59
+ ` })] }));
60
+ };
61
+ exports.ChoiceboxGroupItem = ChoiceboxGroupItem;
62
+ const ChoiceboxGroup = ({ direction = "row", label, type, value, children, disabled, hiddenInput, onChange, className, ...props }) => {
63
+ const name = `choicebox-group-${label?.replace(/\s+/g, "-").toLowerCase()}`;
64
+ return ((0, jsx_runtime_1.jsxs)("div", { ...props, children: [(0, jsx_runtime_1.jsx)("label", { children: label }), (0, jsx_runtime_1.jsx)("ul", { className: (0, utils_1.cn)("", className, direction
65
+ ? "flex md:flex-row md:space-y-0 md:space-x-4 flex-col space-y-4"
66
+ : "block"), children: react_1.default.Children?.map(children, (child) => {
67
+ if (react_1.default.isValidElement(child)) {
68
+ const updatedProps = {
69
+ disabled: child.props.disabled ?? disabled,
70
+ type,
71
+ name,
72
+ checked: child.props.value === value,
73
+ hiddenInput,
74
+ className: child.props.className,
75
+ classNameTitle: child.props.classNameTitle,
76
+ classNameDescription: child.props.classNameDescription,
77
+ onChange,
78
+ };
79
+ const knownProps = Object.keys(updatedProps).reduce((acc, key) => {
80
+ if (updatedProps[key] !== undefined) {
81
+ acc[key] = updatedProps[key];
82
+ }
83
+ return acc;
84
+ }, {});
85
+ return react_1.default.cloneElement(child, knownProps);
86
+ }
87
+ return null;
88
+ }) })] }));
89
+ };
90
+ exports.ChoiceboxGroup = ChoiceboxGroup;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChoiceboxGroupItem = exports.ChoiceboxGroup = void 0;
4
+ var Choicebox_1 = require("./Choicebox");
5
+ Object.defineProperty(exports, "ChoiceboxGroup", { enumerable: true, get: function () { return Choicebox_1.ChoiceboxGroup; } });
6
+ Object.defineProperty(exports, "ChoiceboxGroupItem", { enumerable: true, get: function () { return Choicebox_1.ChoiceboxGroupItem; } });
@@ -42,11 +42,11 @@ exports.DialogOverlay = DialogOverlay;
42
42
  DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
43
43
  const DialogContent = React.forwardRef(({ className, isRightCloseButton, size = "md", position = "center", height = "auto", isFull = false, children, ...props }, ref) => {
44
44
  const classNames = {
45
- base: "fixed z-50 flex border bg-background shadow-lg sm:rounded-lg bg-white text-gray-900 w-full max-w-[calc(-64px_+_100vw)] max-h-[calc(-64px_+_100vh)] flex-col",
46
- center: "left-[50%] top-[50%] translate-x-[-50%] translate-y-[-50%] 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%] rounded-lg",
47
- bottom: "!duration-300 bottom-0 sm:bottom-1/2 left-1/2 rounded-t-lg sm:translate-y-1/2 data-[state=closed]:animate-out -translate-x-1/2 data-[state=open]:animate-in data-[state=open]:slide-in-from-left-1/2 ease-in-out data-[state=open]:slide-in-from-bottom-2/3 data-[state=closed]:slide-out-to-bottom-2/3 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 max-w-full max-h-[calc(-32px_+_100vh)] sm:max-h-[calc(-64px_+_100vh)]",
48
- left: "!duration-300 max-h-screen !h-full rounded-r-lg sm:rounded-l-none top-0 data-[state=open]:animate-in data-[state=open]:slide-in-from-left data-[state=closed]:animate-out data-[state=closed]:slide-out-to-left ease-in-out",
49
- right: "!duration-300 !h-full rounded-l-lg sm:rounded-r-none max-h-screen top-0 right-0 data-[state=open]:animate-in data-[state=open]:slide-in-from-right data-[state=closed]:animate-out data-[state=closed]:slide-out-to-right ease-in-out",
45
+ base: "fixed z-50 flex bg-white shadow-lg sm:rounded-xl bg-white text-gray-900 w-full max-w-[calc(-64px_+_100vw)] max-h-[calc(-64px_+_100vh)] flex-col",
46
+ center: "left-[50%] top-[50%] translate-x-[-50%] translate-y-[-50%] 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%] rounded-xl",
47
+ bottom: "!duration-300 bottom-0 sm:bottom-1/2 left-1/2 rounded-t-xl sm:translate-y-1/2 data-[state=closed]:animate-out -translate-x-1/2 data-[state=open]:animate-in data-[state=open]:slide-in-from-left-1/2 ease-in-out data-[state=open]:slide-in-from-bottom-2/3 data-[state=closed]:slide-out-to-bottom-2/3 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 max-w-full max-h-[calc(-32px_+_100vh)] sm:max-h-[calc(-64px_+_100vh)]",
48
+ left: "!duration-300 max-h-screen !h-full rounded-r-xl sm:rounded-l-none top-0 data-[state=open]:animate-in data-[state=open]:slide-in-from-left data-[state=closed]:animate-out data-[state=closed]:slide-out-to-left ease-in-out",
49
+ right: "!duration-300 !h-full rounded-l-xl sm:rounded-r-none max-h-screen top-0 right-0 data-[state=open]:animate-in data-[state=open]:slide-in-from-right data-[state=closed]:animate-out data-[state=closed]:slide-out-to-right ease-in-out",
50
50
  };
51
51
  const sizeClassNames = {
52
52
  sm: "w-80 sm:w-80",
@@ -66,10 +66,10 @@ const DialogContent = React.forwardRef(({ className, isRightCloseButton, size =
66
66
  sizeClassNames[size],
67
67
  heightClassNames[height],
68
68
  isFull &&
69
- "h-full max-h-screen max-w-full w-full rounded-none sm:rounded-lg sm:max-h-[calc(-64px_+_100vh)]",
69
+ "h-full max-h-screen max-w-full w-full rounded-none sm:rounded-xl sm:max-h-[calc(-64px_+_100vh)]",
70
70
  className,
71
71
  ];
72
- return ((0, jsx_runtime_1.jsxs)(DialogPortal, { children: [(0, jsx_runtime_1.jsx)(DialogOverlay, {}), (0, jsx_runtime_1.jsxs)(DialogPrimitive.Content, { ref: ref, className: (0, utils_1.cn)(...classNamesDialogContent), ...props, children: [children, (0, jsx_runtime_1.jsxs)(DialogPrimitive.Close, { className: (0, utils_1.cn)("absolute md:top-4 top-2 focus:outline-none focus:ring-0 disabled:pointer-events-none data-[state=open]:bg-gray-100 data-[state=open]:text-gray-700 text-gray-900 w-8 h-8 flex justify-center items-center rounded-full before:opacity-0 hover:before:opacity-100 before:transition-opacity before:z-[-1] before:content-[''] before:absolute before:inset-0 before:rounded-full before:select-none before:left-0 before:top-0 before:bg-gray-200 left-3 md:left-auto md:right-4", isRightCloseButton && "left-auto right-3 md:right-4"), title: "\u0110\u00F3ng", children: [(0, jsx_runtime_1.jsx)(solid_1.XMarkIcon, { className: "h-5 w-5 text-gray-900" }), (0, jsx_runtime_1.jsx)("span", { className: "sr-only", children: "Close" })] })] })] }));
72
+ return ((0, jsx_runtime_1.jsxs)(DialogPortal, { children: [(0, jsx_runtime_1.jsx)(DialogOverlay, {}), (0, jsx_runtime_1.jsxs)(DialogPrimitive.Content, { ref: ref, className: (0, utils_1.cn)(...classNamesDialogContent), ...props, children: [children, (0, jsx_runtime_1.jsxs)(DialogPrimitive.Close, { className: (0, utils_1.cn)("absolute md:top-4 top-2 focus:outline-none focus:ring-0 disabled:pointer-events-none data-[state=open]:bg-gray-100 data-[state=open]:text-gray-700 text-gray-900 w-8 h-8 flex justify-center items-center rounded-full before:opacity-0 hover:before:opacity-100 before:transition-opacity before:z-[-1] before:content-[''] before:absolute before:inset-0 before:rounded-full before:select-none before:left-0 before:top-0 before:bg-gray-200 left-3 md:left-auto md:right-4", isRightCloseButton && "left-auto right-3 md:right-4"), title: "\u0110\u00F3ng", children: [(0, jsx_runtime_1.jsx)(solid_1.XMarkIcon, { className: "h-5 w-5 text-gray-700" }), (0, jsx_runtime_1.jsx)("span", { className: "sr-only", children: "Close" })] })] })] }));
73
73
  });
74
74
  exports.DialogContent = DialogContent;
75
75
  DialogContent.displayName = DialogPrimitive.Content.displayName;
@@ -0,0 +1,203 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.LightboxGallery = exports.LightBoxContent = exports.DialogContent = exports.LightboxThumbnail = exports.LightboxGalleryDialog = void 0;
30
+ const jsx_runtime_1 = require("react/jsx-runtime");
31
+ const react_1 = require("swiper/react");
32
+ const swiper_1 = require("swiper");
33
+ const DialogPrimitive = __importStar(require("@radix-ui/react-dialog"));
34
+ const react_2 = __importStar(require("react"));
35
+ require("swiper/css");
36
+ require("swiper/css/navigation");
37
+ require("swiper/css/pagination");
38
+ const IconButton_1 = require("../IconButton");
39
+ const utils_1 = require("../../helpers/utils");
40
+ const lucide_react_1 = require("lucide-react");
41
+ const outline_1 = require("@heroicons/react/24/outline");
42
+ const lodash_1 = __importDefault(require("lodash"));
43
+ exports.LightboxGalleryDialog = DialogPrimitive.Root;
44
+ 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 })));
46
+ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
47
+ const CloseDialog = ({ clearActiveIndex }) => {
48
+ 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" })] }));
49
+ };
50
+ const LightboxThumbnail = ({ children, src, alt, className, classNameImage, onClick, }) => {
51
+ const handleOnClickThumbnail = () => {
52
+ onClick?.();
53
+ };
54
+ 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
+ };
56
+ 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, {})] })] })));
58
+ exports.DialogContent.displayName = DialogPrimitive.Content.displayName;
59
+ 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
+ DialogHeader.displayName = "DialogHeader";
61
+ const DialogFooter = ({ className, ...props }) => ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className), ...props }));
62
+ DialogFooter.displayName = "DialogFooter";
63
+ const DialogTitle = react_2.default.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(DialogPrimitive.Title, { ref: ref, className: (0, utils_1.cn)("text-lg font-semibold leading-none tracking-tight", className), ...props })));
64
+ DialogTitle.displayName = DialogPrimitive.Title.displayName;
65
+ 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
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
67
+ const LightBoxContent = ({ images, activeSlideIndex = 0, withSideBar, subHtmlSideBar, classNameSubHtmSideBar, className, }) => {
68
+ const [activeSlide, setActiveSlide] = (0, react_2.useState)(activeSlideIndex);
69
+ const [titleImage, setTitleImg] = (0, react_2.useState)("");
70
+ const onGetTitleImage = () => {
71
+ const result = lodash_1.default.filter(images, (_, idx) => idx === activeSlideIndex);
72
+ const titleImgDraf = result.length > 0 ? result[0]?.titleImage : "";
73
+ setTitleImg(titleImgDraf);
74
+ };
75
+ (0, react_2.useEffect)(() => {
76
+ setActiveSlide(activeSlideIndex);
77
+ onGetTitleImage();
78
+ }, [activeSlideIndex]);
79
+ const pagination = {
80
+ clickable: true,
81
+ renderBullet(index, className) {
82
+ const classNameParent = (0, utils_1.cn)("aspect-[1/1] min-w-[96px] mt-40 min-h-[76px] !rounded-lg overflow-hidden", className);
83
+ const classNameImage = (0, utils_1.cn)("w-full h-full object-cover rounded-lg");
84
+ if (!images[index]?.url) {
85
+ return "<div></div>";
86
+ }
87
+ return `
88
+ <div class="${classNameParent} ">
89
+ <img class="${classNameImage} " src="${images[index]?.url}" alt="Slide ${index + 1}" />
90
+ </div>
91
+ `;
92
+ },
93
+ };
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
+ setActiveSlide(realIndex);
96
+ onGetTitleImage();
97
+ const activeBullet = document.querySelector(".swiper-pagination-bullet-active");
98
+ if (activeBullet) {
99
+ activeBullet.scrollIntoView({
100
+ behavior: "smooth",
101
+ block: "nearest",
102
+ });
103
+ }
104
+ }, onDestroy: () => {
105
+ setActiveSlide(activeSlideIndex);
106
+ onGetTitleImage();
107
+ }, slidesPerView: "auto", className: "swiper lightboxSwiper", navigation: {
108
+ nextEl: ".lightbox .next-lightbox",
109
+ prevEl: ".lightbox .prev-lightbox",
110
+ }, pagination: pagination, modules: [swiper_1.Navigation, swiper_1.Lazy, swiper_1.Pagination], lazy: {
111
+ loadPrevNext: true,
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
+ .lightbox {
114
+ --lightbox-topnav: 112px;
115
+ --lightbox-botnav: 80px;
116
+ }
117
+
118
+ @media (max-width: 639px) {
119
+ .lightbox {
120
+ --lightbox-topnav: 60px;
121
+ --lightbox-botnav: 80px;
122
+ }
123
+ .lightbox .swiper-button-prev {
124
+ display: none;
125
+ }
126
+
127
+ .lightbox .swiper-button-next {
128
+ display: none;
129
+ }
130
+ .swiper-pagination{
131
+ justify-content: start !important;
132
+ }
133
+ }
134
+
135
+ .lightbox-content {
136
+ top: var(--lightbox-topnav) !important;
137
+ height: calc(100% - var(--lightbox-topnav)) !important;
138
+ width: 100% !important;
139
+ }
140
+ .lightboxSwiper {
141
+ width: 100%;
142
+ height: 95%;
143
+ padding: 0;
144
+ }
145
+
146
+ .lightboxSwiper .swiper-slide {
147
+ text-align: center;
148
+ display: -webkit-box;
149
+ display: -ms-flexbox;
150
+ display: -webkit-flex;
151
+ display: flex;
152
+ -webkit-box-pack: center;
153
+ -ms-flex-pack: center;
154
+ -webkit-justify-content: center;
155
+ justify-content: center;
156
+ -webkit-box-align: center;
157
+ -ms-flex-align: center;
158
+ -webkit-align-items: center;
159
+ align-items: center;
160
+ }
161
+
162
+ .lightboxSwiper.swiper-slide img {
163
+ display: block;
164
+ width: 100%;
165
+ height: 100%;
166
+ }
167
+ .swiper-wrapper{
168
+ bottom: 90px;
169
+ }
170
+ .swiper-pagination{
171
+ max-width: 100%;
172
+ width: 100%;
173
+ overflow-x: auto;
174
+ display: flex;
175
+ justify-content: center;
176
+ }
177
+
178
+ .swiper-pagination-bullet{
179
+ background: unset;
180
+ opacity: 1;
181
+ }
182
+ .swiper-pagination-bullet-active{
183
+ border: 2px solid white;
184
+ }
185
+ ` })] }), withSideBar && ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("hidden md:flex overflow-y-auto bg-white text-gray-900 px-6 pb-4 pt-2 w-full max-w-sm lg:max-w-md", classNameSubHtmSideBar), children: subHtmlSideBar }))] }));
186
+ };
187
+ exports.LightBoxContent = LightBoxContent;
188
+ const LightboxGallery = ({ children, className, open, onOpenChange, }) => {
189
+ return ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("lightbox-gallery ", className), children: (0, jsx_runtime_1.jsx)(exports.LightboxGalleryDialog, { open: open, onOpenChange: onOpenChange, children: react_2.default.Children?.map(children, (child) => {
190
+ if (react_2.default.isValidElement(child)) {
191
+ const updatedProps = {};
192
+ const knownProps = Object.keys(updatedProps).reduce((acc, key) => {
193
+ if (updatedProps[key] !== undefined) {
194
+ acc[key] = updatedProps[key];
195
+ }
196
+ return acc;
197
+ }, {});
198
+ return react_2.default.cloneElement(child, knownProps);
199
+ }
200
+ return null;
201
+ }) }) }));
202
+ };
203
+ exports.LightboxGallery = LightboxGallery;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LightBoxContent = exports.LightboxThumbnail = exports.LightboxGallery = void 0;
4
+ var LightboxGallery_1 = require("./LightboxGallery");
5
+ Object.defineProperty(exports, "LightboxGallery", { enumerable: true, get: function () { return LightboxGallery_1.LightboxGallery; } });
6
+ Object.defineProperty(exports, "LightboxThumbnail", { enumerable: true, get: function () { return LightboxGallery_1.LightboxThumbnail; } });
7
+ Object.defineProperty(exports, "LightBoxContent", { enumerable: true, get: function () { return LightboxGallery_1.LightBoxContent; } });
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TextButton = void 0;
3
+ exports.textButtonVariants = exports.TextButton = void 0;
4
4
  var TextButton_1 = require("./TextButton");
5
5
  Object.defineProperty(exports, "TextButton", { enumerable: true, get: function () { return TextButton_1.TextButton; } });
6
+ Object.defineProperty(exports, "textButtonVariants", { enumerable: true, get: function () { return TextButton_1.textButtonVariants; } });
@@ -42,5 +42,7 @@ __exportStar(require("./components/Command"), exports);
42
42
  __exportStar(require("./components/Combobox"), exports);
43
43
  __exportStar(require("./components/Callout"), exports);
44
44
  __exportStar(require("./components/SearchBar"), exports);
45
+ __exportStar(require("./components/LightboxGallery"), exports);
46
+ __exportStar(require("./components/Choicebox"), exports);
45
47
  __exportStar(require("./mobase-tw-plugin"), exports);
46
48
  __exportStar(require("./site"), exports);
@@ -189,10 +189,10 @@ const mobaseTW = () => {
189
189
  fontSize: {
190
190
  ...(0, font_sizes_1.fontSizes)(prefix),
191
191
  },
192
- spacing: {
193
- unit: `var(--${prefix}-spacing-unit)`,
194
- ...(0, theme_1.createSpacingUnits)(prefix),
195
- },
192
+ // spacing: {
193
+ // unit: `var(--${prefix}-spacing-unit)`,
194
+ // ...createSpacingUnits(prefix),
195
+ // },
196
196
  ...animations_1.animations,
197
197
  },
198
198
  },