@momo-webplatform/mobase 0.0.37 → 0.0.39
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 +2 -1
- package/publish/cjs/components/Dialog/Dialog.js +34 -8
- package/publish/cjs/components/DialogQr/DialogQr.js +98 -0
- package/publish/cjs/components/DialogQr/index.js +5 -0
- package/publish/cjs/components/TextArea/TextArea.js +1 -1
- package/publish/cjs/components/TextInput/TextInput.js +3 -4
- package/publish/cjs/index.js +1 -0
- package/publish/cjs/mobase-tw-plugin/plugin.js +1 -0
- package/publish/cjs/mobase-tw-plugin/utilities/custom.js +3 -0
- package/publish/cjs/tsconfig.lib.tsbuildinfo +1 -1
- package/publish/esm/components/Dialog/Dialog.d.ts +4 -0
- package/publish/esm/components/Dialog/Dialog.js +34 -8
- package/publish/esm/components/DialogQr/DialogQr.d.ts +33 -0
- package/publish/esm/components/DialogQr/DialogQr.js +91 -0
- package/publish/esm/components/DialogQr/index.d.ts +1 -0
- package/publish/esm/components/DialogQr/index.js +1 -0
- package/publish/esm/components/TextArea/TextArea.js +1 -1
- package/publish/esm/components/TextInput/TextInput.js +3 -4
- package/publish/esm/index.d.ts +1 -0
- package/publish/esm/index.js +1 -0
- package/publish/esm/mobase-tw-plugin/plugin.js +1 -0
- package/publish/esm/mobase-tw-plugin/utilities/custom.d.ts +3 -0
- package/publish/esm/mobase-tw-plugin/utilities/custom.js +3 -0
- package/publish/esm/mobase-tw-plugin/utilities/index.d.ts +3 -0
- package/publish/esm/tsconfig.lib.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-webplatform/mobase",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.39",
|
|
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": "next dev",
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
"nextra": "^2.13.2",
|
|
81
81
|
"nextra-theme-docs": "^2.13.2",
|
|
82
82
|
"postcss": "^8.4.33",
|
|
83
|
+
"qrcode.react": "1.0.1",
|
|
83
84
|
"react": "^18.2.0",
|
|
84
85
|
"react-day-picker": "^8.10.0",
|
|
85
86
|
"react-docgen-typescript": "^2.2.2",
|
|
@@ -28,7 +28,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
28
28
|
const React = __importStar(require("react"));
|
|
29
29
|
const DialogPrimitive = __importStar(require("@radix-ui/react-dialog"));
|
|
30
30
|
const utils_1 = require("../../helpers/utils");
|
|
31
|
-
const solid_1 = require("@heroicons/react/
|
|
31
|
+
const solid_1 = require("@heroicons/react/20/solid");
|
|
32
32
|
const Dialog = DialogPrimitive.Root;
|
|
33
33
|
exports.Dialog = Dialog;
|
|
34
34
|
const DialogTrigger = DialogPrimitive.Trigger;
|
|
@@ -40,11 +40,37 @@ exports.DialogClose = DialogClose;
|
|
|
40
40
|
const DialogOverlay = React.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/60 !duration-300 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className), ...props })));
|
|
41
41
|
exports.DialogOverlay = DialogOverlay;
|
|
42
42
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
43
|
-
const DialogContent = React.forwardRef(({ className, isRightCloseButton, size = "md", position = "center", isFull = false, children, ...props }, ref) =>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
const DialogContent = React.forwardRef(({ className, isRightCloseButton, size = "md", position = "center", height = "auto", isFull = false, children, ...props }, ref) => {
|
|
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",
|
|
50
|
+
};
|
|
51
|
+
const sizeClassNames = {
|
|
52
|
+
sm: "w-80 sm:w-80",
|
|
53
|
+
md: "w-[512px] sm:w-[512px]",
|
|
54
|
+
lg: "w-[672px] sm:w-[672px]",
|
|
55
|
+
xl: "w-[1024px] sm:-[1024px]",
|
|
56
|
+
};
|
|
57
|
+
const heightClassNames = {
|
|
58
|
+
auto: "h-auto sm:h-auto",
|
|
59
|
+
small: "h-[480px] sm:h-[480px]",
|
|
60
|
+
large: "h-[640px] sm:h-[640px]",
|
|
61
|
+
full: "h-full",
|
|
62
|
+
};
|
|
63
|
+
const classNamesDialogContent = [
|
|
64
|
+
classNames.base,
|
|
65
|
+
classNames[position],
|
|
66
|
+
sizeClassNames[size],
|
|
67
|
+
heightClassNames[height],
|
|
68
|
+
isFull &&
|
|
69
|
+
"h-full max-h-screen max-w-full w-full rounded-none sm:rounded-lg sm:max-h-[calc(-64px_+_100vh)]",
|
|
70
|
+
className,
|
|
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" })] })] })] }));
|
|
73
|
+
});
|
|
48
74
|
exports.DialogContent = DialogContent;
|
|
49
75
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
50
76
|
const DialogHeader = ({ className, ...props }) => ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("dialog-header py-2 md:py-4 h-12 md:h-16 px-10 md:px-12 items-center justify-center flex border-b border-gray-200 w-full shrink-0", className), ...props }));
|
|
@@ -56,9 +82,9 @@ DialogBody.displayName = "DialogBody";
|
|
|
56
82
|
const DialogFooter = ({ className, isDivider = true, ...props }) => ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("dialog-footer flex sm:flex-row justify-center [&>*]:basis-1/2 [&>*]:sm:basis-auto sm:justify-end space-x-2 px-6 pb-4 shrink-0", isDivider && "border-gray-200 border-t py-4", className), ...props }));
|
|
57
83
|
exports.DialogFooter = DialogFooter;
|
|
58
84
|
DialogFooter.displayName = "DialogFooter";
|
|
59
|
-
const DialogTitle = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(DialogPrimitive.Title, { ref: ref, className: (0, utils_1.cn)("text-base font-
|
|
85
|
+
const DialogTitle = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(DialogPrimitive.Title, { ref: ref, className: (0, utils_1.cn)("text-base font-semibold line-clamp-1 max-w-full", className), ...props })));
|
|
60
86
|
exports.DialogTitle = DialogTitle;
|
|
61
87
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
62
|
-
const DialogDescription = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(DialogPrimitive.Description, { ref: ref, className: (0, utils_1.cn)("text-sm text-
|
|
88
|
+
const DialogDescription = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(DialogPrimitive.Description, { ref: ref, className: (0, utils_1.cn)("text-sm text-gray-700", className), ...props })));
|
|
63
89
|
exports.DialogDescription = DialogDescription;
|
|
64
90
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DialogQr = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const Dialog_1 = require("../Dialog");
|
|
9
|
+
const qrcode_react_1 = __importDefault(require("qrcode.react"));
|
|
10
|
+
const utils_1 = require("../../helpers/utils");
|
|
11
|
+
const QRCodeScan = ({ img = "", children, isQrForAll }) => {
|
|
12
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "qrcode__scan__container", children: (0, jsx_runtime_1.jsxs)("div", { className: "qrcode__scan", children: [(0, jsx_runtime_1.jsx)("div", { className: "qrcode__gradient", children: (0, jsx_runtime_1.jsx)("img", { alt: "step 1", className: "img-fluid", src: "https://homepage.momocdn.net/jk/momo2020/img/qrcode/qrcode-gradient.png" }) }), (0, jsx_runtime_1.jsx)("div", { className: "qrcode__border", children: (0, jsx_runtime_1.jsx)("img", { alt: "step 2", className: "img-fluid", src: "https://homepage.momocdn.net/jk/momo2020/img/qrcode/border-qrcode.svg" }) }), (0, jsx_runtime_1.jsx)("div", { className: "qrcode__image p-4", children: img ? ((0, jsx_runtime_1.jsx)("img", { alt: "step 3", className: "img-fluid d-block mx-auto", src: img, loading: "lazy" })) : (children) })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "mt-4 text-sm text-white", children: isQrForAll ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("img", { src: "https://homepage.momocdn.net/img/momo-upload-api-231211171009-638379114093056419.png", width: 255, height: 32, className: "mx-auto", alt: "QR all" }), (0, jsx_runtime_1.jsx)("div", { className: "mt-3", children: "Nh\u1EADn ti\u1EC1n t\u1EEB m\u1ECDi V\u00ED \u0110i\u1EC7n T\u1EED v\u00E0 Ng\u00E2n H\u00E0ng" })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", className: "mr-1 inline h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 4v1m6 11h2m-6 0h-2v4m0-11v3m0 0h.01M12 12h4.01M16 20h4M4 12h4m12 0h.01M5 8h2a1 1 0 001-1V5a1 1 0 00-1-1H5a1 1 0 00-1 1v2a1 1 0 001 1zm12 0h2a1 1 0 001-1V5a1 1 0 00-1-1h-2a1 1 0 00-1 1v2a1 1 0 001 1zM5 20h2a1 1 0 001-1v-2a1 1 0 00-1-1H5a1 1 0 00-1 1v2a1 1 0 001 1z" }) }), "S\u1EED d\u1EE5ng App MoMo ho\u1EB7c", (0, jsx_runtime_1.jsx)("br", {}), "\u1EE9ng d\u1EE5ng Camera h\u1ED7 tr\u1EE3 QR code \u0111\u1EC3 qu\u00E9t m\u00E3."] })) }), (0, jsx_runtime_1.jsx)("style", { children: `
|
|
13
|
+
.qrcode__scan__container {
|
|
14
|
+
padding: 15px;
|
|
15
|
+
background-color: white;
|
|
16
|
+
width: 280px;
|
|
17
|
+
height: 280px;
|
|
18
|
+
border-radius: 20px;
|
|
19
|
+
border-radius: 15px;
|
|
20
|
+
margin: 0 auto;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.qrcode__image {
|
|
24
|
+
width: 100%;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.qrcode__image img {
|
|
28
|
+
width: 100%;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.qrcode__scan {
|
|
32
|
+
width: 245px;
|
|
33
|
+
height: 245px;
|
|
34
|
+
margin: 0 auto;
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
background-color: white;
|
|
37
|
+
position: relative;
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.qrcode__border {
|
|
44
|
+
position: absolute;
|
|
45
|
+
width: 100%;
|
|
46
|
+
height: 100%;
|
|
47
|
+
top: 0;
|
|
48
|
+
left: 0;
|
|
49
|
+
z-index: 5;
|
|
50
|
+
opacity: 0.9;
|
|
51
|
+
pointer-events: none;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.qrcode__gradient {
|
|
55
|
+
position: absolute;
|
|
56
|
+
opacity: 0.6;
|
|
57
|
+
width: 98%;
|
|
58
|
+
height: 98%;
|
|
59
|
+
top: 1%;
|
|
60
|
+
left: 1%;
|
|
61
|
+
z-index: 6;
|
|
62
|
+
// pointer-events: none;
|
|
63
|
+
transform: translate3d(0, -110%, 0);
|
|
64
|
+
animation: QRCodeScan 3s infinite cubic-bezier(0.45, 0.03, 0.81, 0.63);
|
|
65
|
+
|
|
66
|
+
backface-visibility: hidden;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@keyframes QRCodeScan {
|
|
70
|
+
0% {
|
|
71
|
+
transform: translate3d(0, -110%, 0);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
90% {
|
|
75
|
+
transform: translate3d(0, 30%, 0);
|
|
76
|
+
}
|
|
77
|
+
100% {
|
|
78
|
+
transform: translate3d(0, 30%, 0);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
` })] }));
|
|
82
|
+
};
|
|
83
|
+
const DialogQr = ({ className, children, title, shortTitle, qrImage, qrLink, logoQr, isQrForAll = false, ...props }) => {
|
|
84
|
+
return ((0, jsx_runtime_1.jsx)(Dialog_1.Dialog, { ...props, children: (0, jsx_runtime_1.jsx)(Dialog_1.DialogContent, { className: (0, utils_1.cn)("md:max-w-2xl lg:max-w-3xl h-auto md:max-h-screen max-h-screen overflow-hidden [&>button>svg]:text-white border-0", className), size: "xl", isRightCloseButton: true, children: (0, jsx_runtime_1.jsx)(Dialog_1.DialogBody, { className: "p-0", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-row flex-wrap", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-full flex-none md:w-5/12 hidden sm:block", children: children || ((0, jsx_runtime_1.jsxs)("div", { className: "px-5 text-sm py-8 grid grid-cols-1 gap-y-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-nowrap items-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex-none", children: (0, jsx_runtime_1.jsx)("img", { className: "w-20", loading: "lazy", src: "https://homepage.momocdn.net/images/s/momo-upload-api-200917091602-637359309621891617.png", alt: "Step 1" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1 pl-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "step font-semibold text-gray-800 ", children: "B\u01B0\u1EDBc 1 :" }), (0, jsx_runtime_1.jsx)("div", { className: "mt-1 text-gray-500 ", children: isQrForAll
|
|
85
|
+
? "Mở app MoMo hoặc ứng dụng ngân hàng/ví điện tử chấp nhận mã vạch từ QR Đa Năng"
|
|
86
|
+
: "Mở ứng dụng camera mặc định hoặc ứng dụng hỗ trợ QR code của bạn" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-nowrap items-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex-none", children: (0, jsx_runtime_1.jsx)("img", { className: "w-20 ", loading: "lazy", src: "https://homepage.momocdn.net/images/s/momo-upload-api-200917091443-637359308837905996.png", alt: "Step 2" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1 pl-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "step font-semibold text-gray-800 ", children: "B\u01B0\u1EDBc 2 :" }), (0, jsx_runtime_1.jsx)("div", { className: "mt-1 text-gray-500 ", children: "Qu\u00E9t m\u00E3 QR Code theo h\u00ECnh b\u00EAn ph\u1EA3i" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-nowrap items-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex-none", children: (0, jsx_runtime_1.jsx)("img", { className: "w-20 ", loading: "lazy", src: "https://homepage.momocdn.net/images/s/momo-upload-api-200917090146-637359301062519803.png", alt: "Step 3" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1 pl-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "step font-semibold text-gray-800 ", children: "B\u01B0\u1EDBc 3 :" }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-1 text-gray-500 ", children: ["B\u1EA5m v\u00E0o th\u00F4ng b\u00E1o hi\u1EC3n th\u1ECB \u0111\u1EC3 t\u1EA3i \u1EE9ng d\u1EE5ng ho\u1EB7c", " ", shortTitle || "Truy cập ngay"] })] })] })] })) }), (0, jsx_runtime_1.jsx)("div", { className: "flex w-full items-center justify-center md:w-7/12 h-auto", style: {
|
|
87
|
+
background: "url(https://homepage.momocdn.net/jk/momo2020/img/intro/qrcode-pattern.png) 10px 10px no-repeat,linear-gradient(to top,#c1177c,#e11b90)",
|
|
88
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { className: "px-5 py-10 text-center", children: [title && ((0, jsx_runtime_1.jsx)("h4", { className: "mb-5 text-base font-semibold text-white", children: title })), (0, jsx_runtime_1.jsxs)("div", { className: "relative", children: [isQrForAll && ((0, jsx_runtime_1.jsx)("div", { className: "absolute -top-2 left-1/2 z-[5] -translate-x-1/2", children: (0, jsx_runtime_1.jsx)("img", { src: "https://homepage.momocdn.net/fileuploads/svg/momo-file-231211170324.svg", alt: "Title QR all" }) })), (0, jsx_runtime_1.jsx)(QRCodeScan, { img: qrImage, isQrForAll: isQrForAll, children: qrLink && ((0, jsx_runtime_1.jsx)(qrcode_react_1.default, { value: qrLink, size: 215, renderAs: "svg", imageSettings: {
|
|
89
|
+
src: `${logoQr ||
|
|
90
|
+
"https://homepage.momocdn.net/pwa/images/logoMomox50.png"}`,
|
|
91
|
+
x: null,
|
|
92
|
+
y: null,
|
|
93
|
+
height: 50,
|
|
94
|
+
width: 50,
|
|
95
|
+
excavate: true,
|
|
96
|
+
}, level: "H" })) })] })] }) })] }) }) }) }));
|
|
97
|
+
};
|
|
98
|
+
exports.DialogQr = DialogQr;
|
|
@@ -12,7 +12,7 @@ exports.TextArea = (0, react_1.forwardRef)(({ disabled, isError, message, label,
|
|
|
12
12
|
box-shadow: 0px 0px 0px 1px rgb(var(--mobase-gray-400) / 1) inset;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
.mobase-text-area-box:focus {
|
|
15
|
+
.mobase-text-area-box:focus, .mobase-text-area-box:focus-visible {
|
|
16
16
|
box-shadow: 0px 0px 0px 1px rgb(var(--mobase-pink-500) / 1) inset;
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -3,8 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TextInput = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const
|
|
7
|
-
const solid_1 = require("@heroicons/react/24/solid");
|
|
6
|
+
const solid_1 = require("@heroicons/react/16/solid");
|
|
8
7
|
const utils_1 = require("../../helpers/utils");
|
|
9
8
|
exports.TextInput = (0, react_1.forwardRef)(({ disabled, isError, message, label, className, inputClassName, withClearButton, size, onChange, onFocus, onClickClear, value, defaultValue, type = "text", ...restProps }, ref) => {
|
|
10
9
|
const [clearable, setClearable] = (0, react_1.useState)(false);
|
|
@@ -39,12 +38,12 @@ exports.TextInput = (0, react_1.forwardRef)(({ disabled, isError, message, label
|
|
|
39
38
|
(0, react_1.useEffect)(() => {
|
|
40
39
|
handleShowClearButton(defaultValue || value);
|
|
41
40
|
}, [value, defaultValue]);
|
|
42
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)(className, isError && "mobase-text-input-error"), ref: rootRef, children: [(0, jsx_runtime_1.jsxs)("div", { className: "relative", children: [label && ((0, jsx_runtime_1.jsx)("span", { className: (0, utils_1.cn)("mobase-text-input-label absolute bg-white -top-2 px-1.5 left-2 text-xs text-gray-500", size === 2 && " -top-2.5 text-sm"), children: label })), (0, jsx_runtime_1.jsx)("input", { disabled: disabled, type: type, ref: ref, className: (0, utils_1.cn)("mobase-text-input-box bg-white w-full transition-all text-sm rounded-md border border-gray-400 placeholder:text-gray-500 p-3 text-gray-900 h-11 focus:border-pink-500 disabled:bg-gray-50 disabled:border-gray-300 disabled:pointer-events-none block", size === 2 && "h-12 text-base", inputClassName), onChange: onChangeFactory, onFocus: onFocusFactory, value: value, defaultValue: defaultValue, ...restProps }), withClearButton && clearable && ((0, jsx_runtime_1.jsx)("button", { "aria-label": "button", type: "button", className: "absolute right-3 top-1/2 -translate-y-1/2 shrink-0 cursor-pointer text-gray-500 duration-200 hover:opacity-70 disabled:pointer-events-none", disabled: disabled, onClick: handleClear, children: (0, jsx_runtime_1.jsx)(
|
|
41
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)(className, isError && "mobase-text-input-error"), ref: rootRef, children: [(0, jsx_runtime_1.jsxs)("div", { className: "relative", children: [label && ((0, jsx_runtime_1.jsx)("span", { className: (0, utils_1.cn)("mobase-text-input-label absolute bg-white -top-2 px-1.5 left-2 text-xs text-gray-500", size === 2 && " -top-2.5 text-sm"), children: label })), (0, jsx_runtime_1.jsx)("input", { disabled: disabled, type: type, ref: ref, className: (0, utils_1.cn)("mobase-text-input-box bg-white w-full transition-all text-sm rounded-md border border-gray-400 placeholder:text-gray-500 p-3 text-gray-900 h-11 focus:border-pink-500 disabled:bg-gray-50 disabled:border-gray-300 disabled:pointer-events-none block outline-none", size === 2 && "h-12 text-base", inputClassName), onChange: onChangeFactory, onFocus: onFocusFactory, value: value, defaultValue: defaultValue, ...restProps }), withClearButton && clearable && ((0, jsx_runtime_1.jsx)("button", { "aria-label": "button", type: "button", className: "absolute right-3 top-1/2 -translate-y-1/2 shrink-0 cursor-pointer text-gray-500 duration-200 hover:opacity-70 disabled:pointer-events-none", disabled: disabled, onClick: handleClear, children: (0, jsx_runtime_1.jsx)(solid_1.XCircleIcon, { strokeWidth: 2, width: 20, height: 20 }) }))] }), message && ((0, jsx_runtime_1.jsxs)("div", { className: "mobase-text-input-message flex space-x-1 items-center mt-0.5", children: [isError ? ((0, jsx_runtime_1.jsx)(solid_1.XCircleIcon, { width: 16, height: 16, className: "text-red-500" })) : ((0, jsx_runtime_1.jsx)(solid_1.QuestionMarkCircleIcon, { width: 16, height: 16, className: "text-gray-500" })), (0, jsx_runtime_1.jsx)("span", { className: (0, utils_1.cn)("text-gray-500 ", size === 2 ? "text-sm" : "text-xs"), children: message })] })), (0, jsx_runtime_1.jsx)("style", { children: `
|
|
43
42
|
.mobase-text-input-box:hover {
|
|
44
43
|
box-shadow: 0px 0px 0px 1px rgb(var(--mobase-gray-400) / 1) inset;
|
|
45
44
|
}
|
|
46
45
|
|
|
47
|
-
.mobase-text-input-box:focus {
|
|
46
|
+
.mobase-text-input-box:focus , .mobase-text-input-box:focus-visible {
|
|
48
47
|
box-shadow: 0px 0px 0px 1px rgb(var(--mobase-pink-500) / 1) inset;
|
|
49
48
|
}
|
|
50
49
|
|
package/publish/cjs/index.js
CHANGED
|
@@ -19,6 +19,7 @@ __exportStar(require("./components/Breadcrumb"), exports);
|
|
|
19
19
|
__exportStar(require("./components/Button"), exports);
|
|
20
20
|
__exportStar(require("./components/Checkbox"), exports);
|
|
21
21
|
__exportStar(require("./components/Dialog"), exports);
|
|
22
|
+
__exportStar(require("./components/DialogQr"), exports);
|
|
22
23
|
__exportStar(require("./components/AlertDialog"), exports);
|
|
23
24
|
__exportStar(require("./components/IconButton"), exports);
|
|
24
25
|
__exportStar(require("./components/Pagination"), exports);
|