mehdi-simple-tailwind-button 0.1.2 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -14
- package/dist/index.mjs +2 -14
- package/package.json +4 -3
- package/tailwind.preset.js +36 -0
package/dist/index.js
CHANGED
|
@@ -25,24 +25,12 @@ __export(index_exports, {
|
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(index_exports);
|
|
27
27
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
-
var buttonStyles = {
|
|
29
|
-
base: "px-6 py-3 rounded-lg font-medium transition-all",
|
|
30
|
-
variants: {
|
|
31
|
-
primary: "bg-blue-600 text-white hover:bg-blue-700 shadow-lg",
|
|
32
|
-
secondary: "bg-gray-200 text-gray-800 hover:bg-gray-300"
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
28
|
var SimpleButton = ({
|
|
36
29
|
children,
|
|
37
30
|
variant = "primary"
|
|
38
31
|
}) => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
{
|
|
42
|
-
className: `${buttonStyles.base} ${buttonStyles.variants[variant]}`,
|
|
43
|
-
children
|
|
44
|
-
}
|
|
45
|
-
);
|
|
32
|
+
const className = `btn ${variant === "primary" ? "btn-primary" : "btn-secondary"}`;
|
|
33
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className, children });
|
|
46
34
|
};
|
|
47
35
|
// Annotate the CommonJS export names for ESM import in node:
|
|
48
36
|
0 && (module.exports = {
|
package/dist/index.mjs
CHANGED
|
@@ -2,24 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
// src/index.tsx
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
var buttonStyles = {
|
|
6
|
-
base: "px-6 py-3 rounded-lg font-medium transition-all",
|
|
7
|
-
variants: {
|
|
8
|
-
primary: "bg-blue-600 text-white hover:bg-blue-700 shadow-lg",
|
|
9
|
-
secondary: "bg-gray-200 text-gray-800 hover:bg-gray-300"
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
5
|
var SimpleButton = ({
|
|
13
6
|
children,
|
|
14
7
|
variant = "primary"
|
|
15
8
|
}) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
{
|
|
19
|
-
className: `${buttonStyles.base} ${buttonStyles.variants[variant]}`,
|
|
20
|
-
children
|
|
21
|
-
}
|
|
22
|
-
);
|
|
9
|
+
const className = `btn ${variant === "primary" ? "btn-primary" : "btn-secondary"}`;
|
|
10
|
+
return /* @__PURE__ */ jsx("button", { className, children });
|
|
23
11
|
};
|
|
24
12
|
export {
|
|
25
13
|
SimpleButton
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mehdi-simple-tailwind-button",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Simple Tailwind button component",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
|
-
|
|
9
|
-
"dist"
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"tailwind.preset.js"
|
|
10
11
|
],
|
|
11
12
|
"exports": {
|
|
12
13
|
".": {
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// simple-tailwind-component/tailwind.preset.js
|
|
2
|
+
const plugin = require('tailwindcss/plugin');
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
plugins: [
|
|
6
|
+
plugin(function({ addComponents }) {
|
|
7
|
+
const buttons = {
|
|
8
|
+
// کلاس پایه برای همه دکمه ها
|
|
9
|
+
'.btn': {
|
|
10
|
+
padding: '.75rem 1.5rem', // معادل py-3 px-6
|
|
11
|
+
borderRadius: '.5rem', // معادل rounded-lg
|
|
12
|
+
fontWeight: '500', // معادل font-medium
|
|
13
|
+
transition: 'all .15s ease-in-out', // معادل transition-all
|
|
14
|
+
},
|
|
15
|
+
// استایل برای variant اصلی
|
|
16
|
+
'.btn-primary': {
|
|
17
|
+
backgroundColor: '#2563eb', // معادل bg-blue-600
|
|
18
|
+
color: '#ffffff', // معادل text-white
|
|
19
|
+
boxShadow: '0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)', // معادل shadow-lg
|
|
20
|
+
'&:hover': {
|
|
21
|
+
backgroundColor: '#1d4ed8', // معادل hover:bg-blue-700
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
// استایل برای variant ثانویه
|
|
25
|
+
'.btn-secondary': {
|
|
26
|
+
backgroundColor: '#e5e7eb', // معادل bg-gray-200
|
|
27
|
+
color: '#1f2937', // معادل text-gray-800
|
|
28
|
+
'&:hover': {
|
|
29
|
+
backgroundColor: '#d1d5db', // معادل hover:bg-gray-300
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
addComponents(buttons);
|
|
34
|
+
})
|
|
35
|
+
]
|
|
36
|
+
};
|