@momo-webplatform/mobase 0.0.22 → 0.0.24

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 (93) hide show
  1. package/README.md +11 -6
  2. package/package.json +2 -2
  3. package/publish/cjs/components/AlertDialog/AlertDialog.js +5 -5
  4. package/publish/cjs/components/Pagination/Pagination.js +31 -0
  5. package/publish/cjs/components/Pagination/index.js +8 -0
  6. package/publish/cjs/components/TextArea/TextArea.js +6 -6
  7. package/publish/cjs/components/TextInput/TextInput.js +6 -6
  8. package/publish/cjs/index.js +1 -0
  9. package/publish/cjs/mobase-tw-plugin/colors/blue.js +16 -0
  10. package/publish/cjs/mobase-tw-plugin/colors/green.js +16 -0
  11. package/publish/cjs/mobase-tw-plugin/colors/orange.js +16 -0
  12. package/publish/cjs/mobase-tw-plugin/{foundation/colors → colors}/pink.js +8 -8
  13. package/publish/cjs/mobase-tw-plugin/colors/purple.js +16 -0
  14. package/publish/cjs/mobase-tw-plugin/colors/red.js +16 -0
  15. package/publish/cjs/mobase-tw-plugin/colors/yellow.js +16 -0
  16. package/publish/cjs/mobase-tw-plugin/font-sizes.js +98 -0
  17. package/publish/cjs/mobase-tw-plugin/layout.js +37 -0
  18. package/publish/cjs/mobase-tw-plugin/plugin.js +81 -17
  19. package/publish/cjs/mobase-tw-plugin/radius.js +16 -0
  20. package/publish/cjs/mobase-tw-plugin/types.js +54 -0
  21. package/publish/cjs/mobase-tw-plugin/utils/object.js +36 -17
  22. package/publish/cjs/mobase-tw-plugin/utils/theme.js +70 -0
  23. package/publish/cjs/tsconfig.lib.tsbuildinfo +1 -1
  24. package/publish/esm/components/AlertDialog/AlertDialog.js +5 -5
  25. package/publish/esm/components/Pagination/Pagination.d.ts +16 -0
  26. package/publish/esm/components/Pagination/Pagination.js +28 -0
  27. package/publish/esm/components/Pagination/index.d.ts +1 -0
  28. package/publish/esm/components/Pagination/index.js +1 -0
  29. package/publish/esm/components/TextArea/TextArea.js +6 -6
  30. package/publish/esm/components/TextInput/TextInput.js +6 -6
  31. package/publish/esm/index.d.ts +1 -0
  32. package/publish/esm/index.js +1 -0
  33. package/publish/esm/mobase-tw-plugin/colors/blue.js +13 -0
  34. package/publish/esm/mobase-tw-plugin/colors/green.js +13 -0
  35. package/publish/esm/mobase-tw-plugin/colors/orange.js +13 -0
  36. package/publish/esm/mobase-tw-plugin/colors/pink.js +13 -0
  37. package/publish/esm/mobase-tw-plugin/colors/purple.js +13 -0
  38. package/publish/esm/mobase-tw-plugin/colors/red.js +13 -0
  39. package/publish/esm/mobase-tw-plugin/colors/yellow.js +13 -0
  40. package/publish/esm/mobase-tw-plugin/{foundation/font-sizes/index.d.ts → font-sizes.d.ts} +1 -1
  41. package/publish/esm/mobase-tw-plugin/font-sizes.js +94 -0
  42. package/publish/esm/mobase-tw-plugin/layout.d.ts +34 -0
  43. package/publish/esm/mobase-tw-plugin/layout.js +34 -0
  44. package/publish/esm/mobase-tw-plugin/plugin.js +78 -14
  45. package/publish/esm/mobase-tw-plugin/radius.d.ts +9 -0
  46. package/publish/esm/mobase-tw-plugin/radius.js +12 -0
  47. package/publish/esm/mobase-tw-plugin/types.d.ts +103 -0
  48. package/publish/esm/mobase-tw-plugin/types.js +51 -0
  49. package/publish/esm/mobase-tw-plugin/utils/object.d.ts +3 -18
  50. package/publish/esm/mobase-tw-plugin/utils/object.js +30 -15
  51. package/publish/esm/mobase-tw-plugin/utils/theme.d.ts +2 -0
  52. package/publish/esm/mobase-tw-plugin/utils/theme.js +65 -0
  53. package/publish/esm/tsconfig.lib.tsbuildinfo +1 -1
  54. package/publish/cjs/mobase-tw-plugin/foundation/colors/blue.js +0 -16
  55. package/publish/cjs/mobase-tw-plugin/foundation/colors/green.js +0 -16
  56. package/publish/cjs/mobase-tw-plugin/foundation/colors/orange.js +0 -16
  57. package/publish/cjs/mobase-tw-plugin/foundation/colors/purple.js +0 -16
  58. package/publish/cjs/mobase-tw-plugin/foundation/colors/red.js +0 -16
  59. package/publish/cjs/mobase-tw-plugin/foundation/colors/yellow.js +0 -16
  60. package/publish/cjs/mobase-tw-plugin/foundation/font-sizes/index.js +0 -94
  61. package/publish/cjs/mobase-tw-plugin/foundation/index.js +0 -20
  62. package/publish/cjs/mobase-tw-plugin/foundation/shadows/index.js +0 -12
  63. package/publish/esm/mobase-tw-plugin/foundation/colors/blue.js +0 -13
  64. package/publish/esm/mobase-tw-plugin/foundation/colors/green.js +0 -13
  65. package/publish/esm/mobase-tw-plugin/foundation/colors/orange.js +0 -13
  66. package/publish/esm/mobase-tw-plugin/foundation/colors/pink.js +0 -13
  67. package/publish/esm/mobase-tw-plugin/foundation/colors/purple.js +0 -13
  68. package/publish/esm/mobase-tw-plugin/foundation/colors/red.js +0 -13
  69. package/publish/esm/mobase-tw-plugin/foundation/colors/yellow.js +0 -13
  70. package/publish/esm/mobase-tw-plugin/foundation/font-sizes/index.js +0 -91
  71. package/publish/esm/mobase-tw-plugin/foundation/index.d.ts +0 -4
  72. package/publish/esm/mobase-tw-plugin/foundation/index.js +0 -4
  73. package/publish/esm/mobase-tw-plugin/foundation/shadows/index.d.ts +0 -10
  74. package/publish/esm/mobase-tw-plugin/foundation/shadows/index.js +0 -9
  75. /package/publish/cjs/mobase-tw-plugin/{foundation/animations → animations}/index.js +0 -0
  76. /package/publish/cjs/mobase-tw-plugin/{foundation/colors → colors}/common.js +0 -0
  77. /package/publish/cjs/mobase-tw-plugin/{foundation/colors → colors}/gray.js +0 -0
  78. /package/publish/cjs/mobase-tw-plugin/{foundation/colors → colors}/index.js +0 -0
  79. /package/publish/esm/mobase-tw-plugin/{foundation/animations → animations}/index.d.ts +0 -0
  80. /package/publish/esm/mobase-tw-plugin/{foundation/animations → animations}/index.js +0 -0
  81. /package/publish/esm/mobase-tw-plugin/{foundation/colors → colors}/blue.d.ts +0 -0
  82. /package/publish/esm/mobase-tw-plugin/{foundation/colors → colors}/common.d.ts +0 -0
  83. /package/publish/esm/mobase-tw-plugin/{foundation/colors → colors}/common.js +0 -0
  84. /package/publish/esm/mobase-tw-plugin/{foundation/colors → colors}/gray.d.ts +0 -0
  85. /package/publish/esm/mobase-tw-plugin/{foundation/colors → colors}/gray.js +0 -0
  86. /package/publish/esm/mobase-tw-plugin/{foundation/colors → colors}/green.d.ts +0 -0
  87. /package/publish/esm/mobase-tw-plugin/{foundation/colors → colors}/index.d.ts +0 -0
  88. /package/publish/esm/mobase-tw-plugin/{foundation/colors → colors}/index.js +0 -0
  89. /package/publish/esm/mobase-tw-plugin/{foundation/colors → colors}/orange.d.ts +0 -0
  90. /package/publish/esm/mobase-tw-plugin/{foundation/colors → colors}/pink.d.ts +0 -0
  91. /package/publish/esm/mobase-tw-plugin/{foundation/colors → colors}/purple.d.ts +0 -0
  92. /package/publish/esm/mobase-tw-plugin/{foundation/colors → colors}/red.d.ts +0 -0
  93. /package/publish/esm/mobase-tw-plugin/{foundation/colors → colors}/yellow.d.ts +0 -0
package/README.md CHANGED
@@ -31,13 +31,18 @@ pnpm tailwindcss init -p
31
31
  Point Tailwind CSS to files you have `className=".."` in:
32
32
 
33
33
  ```javascript
34
- module.exports = {
35
- content: ["./src/**/*.{js,jsx,ts,tsx}" /* src folder, for example */],
36
- theme: {
37
- extend: {},
38
- },
39
- plugins: [],
34
+ import { mobaseTW } from "@momo-webplatform/mobase";
35
+
36
+ const config = {
37
+ content: [
38
+ // ...
39
+ "node_modules/@momo-webplatform/mobase/publish/esm/**/*.js",
40
+ ],
41
+ darkMode: ["class"],
42
+ plugins: [mobaseTW()],
40
43
  };
44
+
45
+ export default config;
41
46
  ```
42
47
 
43
48
  Add Tailwind CSS to a CSS file:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-webplatform/mobase",
3
- "version": "0.0.22",
3
+ "version": "0.0.24",
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",
@@ -65,12 +65,12 @@
65
65
  "class-variance-authority": "^0.7.0",
66
66
  "clsx": "^2.1.0",
67
67
  "cmdk": "^0.2.0",
68
+ "color": "^4.2.3",
68
69
  "date-fns": "^3.2.0",
69
70
  "deepmerge": "^4.3.1",
70
71
  "dlv": "^1.1.3",
71
72
  "flat": "^3.0.1",
72
73
  "framer-motion": "^11.0.3",
73
- "fs": "0.0.1-security",
74
74
  "lodash": "^4.17.21",
75
75
  "lodash.foreach": "^4.5.0",
76
76
  "lodash.omit": "^4.5.0",
@@ -38,13 +38,13 @@ exports.AlertDialogPortal = AlertDialogPortal;
38
38
  const AlertDialogOverlay = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(AlertDialogPrimitive.Overlay, { className: (0, utils_1.cn)("fixed inset-0 z-50 bg-black/70 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className), ...props, ref: ref })));
39
39
  exports.AlertDialogOverlay = AlertDialogOverlay;
40
40
  AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
41
- const AlertDialogContent = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsxs)(AlertDialogPortal, { children: [(0, jsx_runtime_1.jsx)(AlertDialogOverlay, {}), (0, jsx_runtime_1.jsx)(AlertDialogPrimitive.Content, { ref: ref, className: (0, utils_1.cn)("fixed left-[50%] bg-white text-gray-700 border rounded-sm border-gray-300 top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 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%] sm:rounded-lg", className), ...props })] })));
41
+ const AlertDialogContent = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsxs)(AlertDialogPortal, { children: [(0, jsx_runtime_1.jsx)(AlertDialogOverlay, {}), (0, jsx_runtime_1.jsx)(AlertDialogPrimitive.Content, { ref: ref, className: (0, utils_1.cn)("fixed left-[50%] w-[90vw] bg-white text-gray-700 border border-gray-300 top-[50%] z-50 grid w- max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 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%] rounded-xl", className), ...props })] })));
42
42
  exports.AlertDialogContent = AlertDialogContent;
43
43
  AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
44
- const AlertDialogHeader = ({ className, ...props }) => ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("flex flex-col space-y-2 text-center sm:text-left", className), ...props }));
44
+ const AlertDialogHeader = ({ className, ...props }) => ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("flex flex-col space-y-2 text-left", className), ...props }));
45
45
  exports.AlertDialogHeader = AlertDialogHeader;
46
46
  AlertDialogHeader.displayName = "AlertDialogHeader";
47
- const AlertDialogFooter = ({ 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 }));
47
+ const AlertDialogFooter = ({ className, ...props }) => ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("flex flex-row justify-end space-x-4", className), ...props }));
48
48
  exports.AlertDialogFooter = AlertDialogFooter;
49
49
  AlertDialogFooter.displayName = "AlertDialogFooter";
50
50
  const AlertDialogTitle = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(AlertDialogPrimitive.Title, { ref: ref, className: (0, utils_1.cn)("text-lg text-gray-900 font-semibold", className), ...props })));
@@ -54,9 +54,9 @@ const AlertDialogDescription = React.forwardRef(({ className, ...props }, ref) =
54
54
  exports.AlertDialogDescription = AlertDialogDescription;
55
55
  AlertDialogDescription.displayName =
56
56
  AlertDialogPrimitive.Description.displayName;
57
- const AlertDialogAction = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(AlertDialogPrimitive.Action, { ref: ref, className: (0, utils_1.cn)((0, Button_1.buttonVariants)(), "", className), ...props })));
57
+ const AlertDialogAction = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(AlertDialogPrimitive.Action, { ref: ref, className: (0, utils_1.cn)((0, Button_1.buttonVariants)({ variant: "primary" }), "", className), ...props })));
58
58
  exports.AlertDialogAction = AlertDialogAction;
59
59
  AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
60
- const AlertDialogCancel = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(AlertDialogPrimitive.Cancel, { ref: ref, className: (0, utils_1.cn)((0, Button_1.buttonVariants)({ variant: "secondary" }), "mt-2 sm:mt-0", className), ...props })));
60
+ const AlertDialogCancel = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(AlertDialogPrimitive.Cancel, { ref: ref, className: (0, utils_1.cn)((0, Button_1.buttonVariants)({ variant: "secondary" }), className), ...props })));
61
61
  exports.AlertDialogCancel = AlertDialogCancel;
62
62
  AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ const lucide_react_1 = require("lucide-react");
5
+ const IconButton_1 = require("../IconButton/IconButton");
6
+ const utils_1 = require("../../helpers/utils");
7
+ function Pagination({ current, total, onChange, }) {
8
+ const getButton = (index) => ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)("button", { className: (0, utils_1.cn)((0, IconButton_1.iconButtonVariants)({
9
+ variant: current === index ? "outline" : "secondary",
10
+ size: "sm",
11
+ })), onClick: () => onChange(index), children: index }) }, index));
12
+ return ((0, jsx_runtime_1.jsx)("nav", { role: "navigation", "aria-label": "pagination", className: (0, utils_1.cn)("mx-auto flex w-full justify-center"), children: (0, jsx_runtime_1.jsxs)("ul", { className: (0, utils_1.cn)("flex flex-row flex-wrap items-center gap-2"), children: [total > 1 && ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)("button", { className: (0, utils_1.cn)((0, IconButton_1.iconButtonVariants)({
13
+ variant: "secondary",
14
+ size: "sm",
15
+ })), disabled: current === 1, onClick: () => current > 1 && onChange(current - 1), children: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronLeft, { className: "h-4 w-4" }) }) })), total <= 6 ? (Array(total)
16
+ .fill(0)
17
+ .map((_, index) => getButton(index + 1))) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [getButton(1), current === 1 && [getButton(2), getButton(3)], current > 3 && ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)("button", { className: (0, utils_1.cn)((0, IconButton_1.iconButtonVariants)({
18
+ variant: "secondary",
19
+ size: "sm",
20
+ })), disabled: current === 1, onClick: () => onChange(current - 3), children: "..." }) })), current > 2 &&
21
+ current !== 1 &&
22
+ current !== total &&
23
+ getButton(current - 1), current > 1 && current < total && getButton(current), current < total - 1 && current !== 1 && getButton(current + 1), current === total && [getButton(total - 2), getButton(total - 1)], current < total - 2 && current !== total && ((0, jsx_runtime_1.jsx)("button", { className: (0, utils_1.cn)((0, IconButton_1.iconButtonVariants)({
24
+ variant: "secondary",
25
+ size: "sm",
26
+ })), disabled: current === 1, onClick: () => onChange(current + 3), children: "..." })), getButton(total)] })), total > 1 && ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)("button", { className: (0, utils_1.cn)((0, IconButton_1.iconButtonVariants)({
27
+ variant: "secondary",
28
+ size: "sm",
29
+ })), disabled: current === total, onClick: () => current < total && onChange(current + 1), children: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" }) }) }))] }) }));
30
+ }
31
+ exports.default = Pagination;
@@ -0,0 +1,8 @@
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.Pagination = void 0;
7
+ var Pagination_1 = require("./Pagination");
8
+ Object.defineProperty(exports, "Pagination", { enumerable: true, get: function () { return __importDefault(Pagination_1).default; } });
@@ -9,11 +9,11 @@ const utils_1 = require("../../helpers/utils");
9
9
  exports.TextArea = (0, react_1.forwardRef)(({ disabled, isError, message, label, className, inputClassName, rows = 3, ...restProps }, ref) => {
10
10
  return ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("relative", className, isError && "mobase-text-area-error"), children: [label && ((0, jsx_runtime_1.jsx)("span", { className: (0, utils_1.cn)("mobase-text-area-label absolute bg-white -top-2.5 px-1.5 left-2 text-sm", disabled ? "text-gray-400" : "text-gray-500"), children: label })), (0, jsx_runtime_1.jsx)("textarea", { disabled: disabled, ref: ref, className: (0, utils_1.cn)("mobase-text-area-box bg-white w-full transition-all rounded border border-gray-400 placeholder:text-base placeholder:text-gray-500 p-3 text-gray-900 focus:border-pink-500 disabled:bg-gray-50 disabled:border-gray-300 outline-none block", inputClassName), rows: rows, ...restProps }), message && ((0, jsx_runtime_1.jsxs)("div", { className: "mobase-text-area-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)(outline_1.QuestionMarkCircleIcon, { width: 16, height: 16, className: "text-gray-500" })), (0, jsx_runtime_1.jsx)("span", { className: "text-gray-500 text-sm", children: message })] })), (0, jsx_runtime_1.jsx)("style", { children: `
11
11
  .mobase-text-area-box:hover {
12
- box-shadow: 0px 0px 0px 1px rgb(var(--gray-400) / 1) inset;
12
+ box-shadow: 0px 0px 0px 1px rgb(var(--mobase-gray-400) / 1) inset;
13
13
  }
14
14
 
15
15
  .mobase-text-area-box:focus {
16
- box-shadow: 0px 0px 0px 1px rgb(var(--pink-500) / 1) inset;
16
+ box-shadow: 0px 0px 0px 1px rgb(var(--mobase-pink-500) / 1) inset;
17
17
  }
18
18
 
19
19
  .mobase-text-area-box:disabled {
@@ -22,16 +22,16 @@ exports.TextArea = (0, react_1.forwardRef)(({ disabled, isError, message, label,
22
22
 
23
23
  .mobase-text-area-error {
24
24
  .mobase-text-area-label {
25
- color: rgb(var(--red-500) / 1);
25
+ color: rgb(var(--mobase-red-500) / 1);
26
26
  }
27
27
 
28
28
  .mobase-text-area-box {
29
- box-shadow: 0px 0px 0px 1px hsl(var(--red-500) / 1) inset;
30
- border-color: rgb(var(--red-500) / 1);
29
+ box-shadow: 0px 0px 0px 1px rgb(var(--mobase-red-500) / 1) inset;
30
+ border-color: rgb(var(--mobase-red-500) / 1);
31
31
  }
32
32
 
33
33
  .mobase-text-area-message span {
34
- color: rgb(var(--red-500) / 1);
34
+ color: rgb(var(--mobase-red-500) / 1);
35
35
  }
36
36
  }
37
37
  ` })] }));
@@ -41,25 +41,25 @@ exports.TextInput = (0, react_1.forwardRef)(({ disabled, isError, message, label
41
41
  }, [value, defaultValue]);
42
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.5 px-1.5 left-2 text-sm", disabled ? "text-gray-400" : "text-gray-500"), 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 rounded border border-gray-400 placeholder:text-base placeholder:text-gray-500 p-3 text-gray-900 h-12 focus:border-pink-500 disabled:bg-gray-50 disabled:border-gray-300 disabled:pointer-events-none block", 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)(outline_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)(outline_1.QuestionMarkCircleIcon, { width: 16, height: 16, className: "text-gray-500" })), (0, jsx_runtime_1.jsx)("span", { className: "text-gray-500 text-sm", children: message })] })), (0, jsx_runtime_1.jsx)("style", { children: `
43
43
  .mobase-text-input-box:hover {
44
- box-shadow: 0px 0px 0px 1px rgb(var(--gray-400) / 1) inset;
44
+ box-shadow: 0px 0px 0px 1px rgb(var(--mobase-gray-400) / 1) inset;
45
45
  }
46
46
 
47
47
  .mobase-text-input-box:focus {
48
- box-shadow: 0px 0px 0px 1px rgb(var(--pink-500) / 1) inset;
48
+ box-shadow: 0px 0px 0px 1px rgb(var(--mobase-pink-500) / 1) inset;
49
49
  }
50
50
 
51
51
  .mobase-text-input-error {
52
52
  .mobase-text-input-label {
53
- color: rgb(var(--red-500) / 1);
53
+ color: rgb(var(--mobase-red-500) / 1);
54
54
  }
55
55
 
56
56
  .mobase-text-input-box {
57
- box-shadow: 0px 0px 0px 1px rgb(var(--red-500) / 1) inset;
58
- border-color: rgb(var(--red-500) / 1);
57
+ box-shadow: 0px 0px 0px 1px rgb(var(--mobase-red-500) / 1) inset;
58
+ border-color: rgb(var(--mobase-red-500) / 1);
59
59
  }
60
60
 
61
61
  .mobase-text-input-message span {
62
- color: rgb(var(--red-500) / 1);
62
+ color: rgb(var(--mobase-red-500) / 1);
63
63
  }
64
64
  }
65
65
  ` })] }));
@@ -20,6 +20,7 @@ __exportStar(require("./components/Button"), exports);
20
20
  __exportStar(require("./components/Checkbox"), exports);
21
21
  __exportStar(require("./components/AlertDialog"), exports);
22
22
  __exportStar(require("./components/IconButton"), exports);
23
+ __exportStar(require("./components/Pagination"), exports);
23
24
  __exportStar(require("./components/Popover"), exports);
24
25
  __exportStar(require("./components/Tabs"), exports);
25
26
  __exportStar(require("./components/TextArea"), exports);
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.blue = void 0;
4
+ exports.blue = {
5
+ 50: "#eef8ff",
6
+ 100: "#d9eeff",
7
+ 200: "#bce1ff",
8
+ 300: "#8ed0ff",
9
+ 400: "#59b4ff",
10
+ 500: "#429cff",
11
+ 600: "#1b74f5",
12
+ 700: "#145ee1",
13
+ 800: "#174bb6",
14
+ 900: "#19428f",
15
+ DEFAULT: "#429cff",
16
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.green = void 0;
4
+ exports.green = {
5
+ 50: "#f1fcf3",
6
+ 100: "#dff9e5",
7
+ 200: "#c0f2cc",
8
+ 300: "#8fe6a4",
9
+ 400: "#57d175",
10
+ 500: "#34c759",
11
+ 600: "#22973f",
12
+ 700: "#1e7735",
13
+ 800: "#1d5e2e",
14
+ 900: "#194e28",
15
+ DEFAULT: "#34c759",
16
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.orange = void 0;
4
+ exports.orange = {
5
+ 50: "#fff4ed",
6
+ 100: "#ffe6d5",
7
+ 200: "#fecaaa",
8
+ 300: "#fea473",
9
+ 400: "#fc743b",
10
+ 500: "#fa541c",
11
+ 600: "#eb350b",
12
+ 700: "#c3240b",
13
+ 800: "#9b1e11",
14
+ 900: "#7c1c12",
15
+ DEFAULT: "#fa541c",
16
+ };
@@ -2,15 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.pink = void 0;
4
4
  exports.pink = {
5
- 50: "#FEF8FC",
6
- 100: "#FDEAF4",
7
- 200: "#FBD5EA",
8
- 300: "#F382C0",
9
- 400: "#EF59AB",
5
+ 50: "#FEE5F6",
6
+ 100: "#FECCED",
7
+ 200: "#FFA2DF",
8
+ 300: "#FE68C6",
9
+ 400: "#F93BAD",
10
10
  500: "#EB2F96",
11
11
  600: "#D42A87",
12
- 700: "#BC2678",
13
- 800: "#A50064",
14
- 900: "#780650",
12
+ 700: "#CB0B6F",
13
+ 800: "#A70D5B",
14
+ 900: "#8B104E",
15
15
  DEFAULT: "#EB2F96",
16
16
  };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.purple = void 0;
4
+ exports.purple = {
5
+ 50: "#faf5ff",
6
+ 100: "#f4e9fe",
7
+ 200: "#ead6fe",
8
+ 300: "#dab6fc",
9
+ 400: "#c487f9",
10
+ 500: "#ab55f3",
11
+ 600: "#9937e6",
12
+ 700: "#8326ca",
13
+ 800: "#6f24a5",
14
+ 900: "#5b1e85",
15
+ DEFAULT: "#ab55f3",
16
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.red = void 0;
4
+ exports.red = {
5
+ 50: "#fff1f2",
6
+ 100: "#ffe1e3",
7
+ 200: "#ffc8cb",
8
+ 300: "#ffa1a6",
9
+ 400: "#fe6b73",
10
+ 500: "#f74e57",
11
+ 600: "#e41e29",
12
+ 700: "#c0151e",
13
+ 800: "#9e161d",
14
+ 900: "#83191f",
15
+ DEFAULT: "#f74e57",
16
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.yellow = void 0;
4
+ exports.yellow = {
5
+ 50: "#fffee7",
6
+ 100: "#fffec1",
7
+ 200: "#fff886",
8
+ 300: "#ffec41",
9
+ 400: "#ffdb0d",
10
+ 500: "#ffcc00",
11
+ 600: "#d19500",
12
+ 700: "#a66a02",
13
+ 800: "#89530a",
14
+ 900: "#74430f",
15
+ DEFAULT: "#ffcc00",
16
+ };
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fontSizes = void 0;
4
+ function fontSizes(prefix) {
5
+ const fontSizes = {
6
+ xxs: [
7
+ `var(--${prefix}-font-size-xxs)`,
8
+ {
9
+ lineHeight: "1rem",
10
+ },
11
+ ],
12
+ xs: [
13
+ `var(--${prefix}-font-size-xs)`,
14
+ {
15
+ lineHeight: "1rem",
16
+ },
17
+ ],
18
+ sm: [
19
+ `var(--${prefix}-font-size-sm)`,
20
+ {
21
+ lineHeight: "1.25rem",
22
+ },
23
+ ],
24
+ base: [
25
+ `var(--${prefix}-font-size-base)`,
26
+ {
27
+ lineHeight: "1.5rem",
28
+ },
29
+ ],
30
+ lg: [
31
+ `var(--${prefix}-font-size-lg)`,
32
+ {
33
+ lineHeight: "1.75rem",
34
+ },
35
+ ],
36
+ xl: [
37
+ `var(--${prefix}-font-size-xl)`,
38
+ {
39
+ lineHeight: "1.75rem",
40
+ },
41
+ ],
42
+ "2xl": [
43
+ `var(--${prefix}-font-size-2xl)`,
44
+ {
45
+ lineHeight: "2rem",
46
+ },
47
+ ],
48
+ "3xl": [
49
+ `var(--${prefix}-font-size-3xl)`,
50
+ {
51
+ lineHeight: "2.25rem",
52
+ },
53
+ ],
54
+ "4xl": [
55
+ `var(--${prefix}-font-size-4xl)`,
56
+ {
57
+ lineHeight: "2.5rem",
58
+ },
59
+ ],
60
+ "5xl": [
61
+ `var(--${prefix}-font-size-5xl)`,
62
+ {
63
+ lineHeight: "3.5rem",
64
+ letterSpacing: "-0.075rem",
65
+ },
66
+ ],
67
+ "6xl": [
68
+ `var(--${prefix}-font-size-6xl)`,
69
+ {
70
+ lineHeight: "4.5rem",
71
+ letterSpacing: "-0.09375rem",
72
+ },
73
+ ],
74
+ "7xl": [
75
+ `var(--${prefix}-font-size-7xl)`,
76
+ {
77
+ lineHeight: "5rem",
78
+ letterSpacing: "-0.1125rem",
79
+ },
80
+ ],
81
+ "8xl": [
82
+ `var(--${prefix}-font-size-8xl)`,
83
+ {
84
+ lineHeight: "6.5rem",
85
+ letterSpacing: "-0.15rem",
86
+ },
87
+ ],
88
+ "9xl": [
89
+ `var(--${prefix}-font-size-9xl)`,
90
+ {
91
+ lineHeight: "8rem",
92
+ letterSpacing: "-0.2rem",
93
+ },
94
+ ],
95
+ };
96
+ return fontSizes;
97
+ }
98
+ exports.fontSizes = fontSizes;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.layout = void 0;
4
+ exports.layout = {
5
+ "spacing-unit": 4,
6
+ "disabled-opacity": 0.5, // Numeric values don't need quotes
7
+ "font-size": {
8
+ xxs: "0.625rem",
9
+ xs: "0.75rem",
10
+ sm: "0.875rem",
11
+ base: "1rem",
12
+ lg: "1.125rem",
13
+ xl: "1.25rem",
14
+ "2xl": "1.5rem",
15
+ "3xl": "1.875rem",
16
+ "4xl": "2.25rem",
17
+ "5xl": "3rem",
18
+ "6xl": "3.75rem",
19
+ "7xl": "4.5rem",
20
+ "8xl": "6rem",
21
+ "9xl": "8rem",
22
+ },
23
+ radius: {
24
+ sm: "0.125rem",
25
+ base: "0.25rem",
26
+ md: "0.375rem",
27
+ lg: "0.5rem",
28
+ xl: "0.75rem",
29
+ "2xl": "1rem",
30
+ "3xl": "1.5rem",
31
+ },
32
+ "box-shadow": {
33
+ small: "0px 0px 5px 0px rgb(0 0 0 / 0.02), 0px 2px 10px 0px rgb(0 0 0 / 0.06), 0px 0px 1px 0px rgb(0 0 0 / 0.3)",
34
+ medium: "0px 0px 15px 0px rgb(0 0 0 / 0.03), 0px 2px 30px 0px rgb(0 0 0 / 0.08), 0px 0px 1px 0px rgb(0 0 0 / 0.3)",
35
+ large: "0px 0px 30px 0px rgb(0 0 0 / 0.04), 0px 30px 60px 0px rgb(0 0 0 / 0.12), 0px 0px 1px 0px rgb(0 0 0 / 0.3)",
36
+ },
37
+ };
@@ -16,27 +16,32 @@ exports.mobaseTW = void 0;
16
16
  const color_1 = __importDefault(require("color"));
17
17
  const plugin_js_1 = __importDefault(require("tailwindcss/plugin.js"));
18
18
  const utilities_1 = require("./utilities");
19
- const utils_1 = require("./utils");
20
- const foundation_1 = require("./foundation");
21
- const lodash_foreach_1 = __importDefault(require("lodash.foreach"));
22
- const parsedColorsCache = {};
23
- const resolveConfig = () => {
19
+ const object_1 = require("./utils/object");
20
+ const theme_1 = require("./utils/theme");
21
+ const colors_1 = require("./colors");
22
+ const layout_1 = require("./layout");
23
+ const animations_1 = require("./animations");
24
+ const font_sizes_1 = require("./font-sizes");
25
+ const radius_1 = require("./radius");
26
+ // import { animations } from "./animations";
27
+ // import { fontSizes } from "./font-sizes";
28
+ // import { radius } from "./radius";
29
+ const resolveConfig = (prefix) => {
24
30
  const resolved = {
25
31
  utilities: {},
26
32
  colors: {},
27
33
  };
28
- const flatColors = (0, utils_1.flattenThemeObject)(foundation_1.colors);
34
+ const flatColors = (0, object_1.flattenThemeObject)(colors_1.colors);
35
+ const flatLayout = layout_1.layout;
29
36
  const cssSelector = ":root";
30
37
  resolved.utilities[cssSelector] = {};
31
- (0, lodash_foreach_1.default)(flatColors, (colorValue, colorName) => {
38
+ // Color
39
+ Object.entries(flatColors).forEach(([colorName, colorValue]) => {
32
40
  if (!colorValue)
33
41
  return;
34
42
  try {
35
- const parsedColor = parsedColorsCache[colorValue] ||
36
- (0, color_1.default)(colorValue).rgb().round().array();
37
- parsedColorsCache[colorValue] = parsedColor;
38
- const [r, g, b] = parsedColor;
39
- const colorVar = `--${colorName}`;
43
+ const [r, g, b] = (0, color_1.default)(colorValue).rgb().array();
44
+ const colorVar = `--${prefix}-${colorName}`;
40
45
  // Set the css variable in "@layer utilities"
41
46
  resolved.utilities[cssSelector][colorVar] = `${r} ${g} ${b}`;
42
47
  resolved.colors[colorName] = `rgb(var(${colorVar}) / <alpha-value>)`;
@@ -46,10 +51,37 @@ const resolveConfig = () => {
46
51
  console.log("error", error?.message);
47
52
  }
48
53
  });
54
+ // Layout
55
+ Object.entries(flatLayout).forEach(([key, value]) => {
56
+ if (!value)
57
+ return;
58
+ const layoutVariablePrefix = `--${prefix}-${key}`;
59
+ if (typeof value === "object") {
60
+ Object.entries(value).forEach(([nestedKey, nestedValue]) => {
61
+ const nestedLayoutVariable = `${layoutVariablePrefix}-${nestedKey}`;
62
+ resolved.utilities[cssSelector][nestedLayoutVariable] = nestedValue;
63
+ });
64
+ }
65
+ else if (key === "spacing-unit") {
66
+ resolved.utilities[cssSelector][layoutVariablePrefix] = value;
67
+ const spacingScale = (0, theme_1.generateSpacingScale)(Number(value));
68
+ Object.entries(spacingScale).forEach(([scaleKey, scaleValue]) => {
69
+ const spacingVariable = `${layoutVariablePrefix}-${scaleKey}`;
70
+ resolved.utilities[cssSelector][spacingVariable] = scaleValue;
71
+ });
72
+ }
73
+ else {
74
+ const formattedValue = layoutVariablePrefix.includes("opacity") && typeof value === "number"
75
+ ? value.toString().replace(/^0\./, ".")
76
+ : value;
77
+ resolved.utilities[cssSelector][layoutVariablePrefix] = formattedValue;
78
+ }
79
+ });
49
80
  return resolved;
50
81
  };
51
82
  const mobaseTW = () => {
52
- const resolved = resolveConfig();
83
+ const prefix = "mobase";
84
+ const resolved = resolveConfig(prefix);
53
85
  return (0, plugin_js_1.default)(({ addBase, addUtilities }) => {
54
86
  addBase({
55
87
  ":root": {
@@ -66,17 +98,49 @@ const mobaseTW = () => {
66
98
  {
67
99
  theme: {
68
100
  extend: {
101
+ fontFamily: {
102
+ sans: [
103
+ "-apple-system",
104
+ "BlinkMacSystemFont",
105
+ "Segoe UI",
106
+ "Helvetica",
107
+ "Arial",
108
+ "sans-serif",
109
+ "Apple Color Emoji",
110
+ "Segoe UI Emoji",
111
+ "Segoe UI Symbol",
112
+ ],
113
+ mono: [
114
+ "SFMono-Regular",
115
+ "Consolas",
116
+ "Liberation Mono",
117
+ "Menlo",
118
+ "monospace",
119
+ ],
120
+ },
69
121
  colors: {
70
- ...foundation_1.colors,
122
+ ...colors_1.colors,
71
123
  ...resolved?.colors,
72
124
  },
73
125
  boxShadow: {
74
- ...foundation_1.boxShadows,
126
+ small: `var(--${prefix}-box-shadow-small)`,
127
+ medium: `var(--${prefix}-box-shadow-medium)`,
128
+ large: `var(--${prefix}-box-shadow-large)`,
129
+ },
130
+ // fontSize: {
131
+ // ...fontSizes,
132
+ // },
133
+ borderRadius: {
134
+ ...(0, radius_1.radius)(prefix),
75
135
  },
76
136
  fontSize: {
77
- ...foundation_1.fontSizes,
137
+ ...(0, font_sizes_1.fontSizes)(prefix),
138
+ },
139
+ spacing: {
140
+ unit: `var(--${prefix}-spacing-unit)`,
141
+ ...(0, theme_1.createSpacingUnits)(prefix),
78
142
  },
79
- ...foundation_1.animations,
143
+ ...animations_1.animations,
80
144
  },
81
145
  },
82
146
  });
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.radius = void 0;
4
+ function radius(prefix) {
5
+ const radius = {
6
+ sm: `var(--${prefix}-radius-sm)`,
7
+ DEFAULT: `var(--${prefix}-radius-base)`,
8
+ md: `var(--${prefix}-radius-md)`,
9
+ lg: `var(--${prefix}-radius-lg)`,
10
+ xl: `var(--${prefix}-radius-xl)`,
11
+ "2xl": `var(--${prefix}-radius-2xl)`,
12
+ "3xl": `var(--${prefix}-radius-3xl)`,
13
+ };
14
+ return radius;
15
+ }
16
+ exports.radius = radius;