generative-ui-library 1.0.0
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 +192 -0
- package/dist/index.mjs +155 -0
- package/package.json +20 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/index.js
|
|
30
|
+
var index_exports = {};
|
|
31
|
+
__export(index_exports, {
|
|
32
|
+
Button: () => Button,
|
|
33
|
+
Card: () => Card
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(index_exports);
|
|
36
|
+
|
|
37
|
+
// src/components/Button/Button.jsx
|
|
38
|
+
var import_react = __toESM(require("react"));
|
|
39
|
+
var Button = ({
|
|
40
|
+
text = "Click Me",
|
|
41
|
+
onClick = () => {
|
|
42
|
+
},
|
|
43
|
+
bgColor = "#4f46e5",
|
|
44
|
+
hoverColor = "#4338ca",
|
|
45
|
+
textColor = "#ffffff",
|
|
46
|
+
size = "medium",
|
|
47
|
+
disabled = false,
|
|
48
|
+
rounded = true
|
|
49
|
+
}) => {
|
|
50
|
+
const [isHovered, setIsHovered] = (0, import_react.useState)(false);
|
|
51
|
+
const [isPressed, setIsPressed] = (0, import_react.useState)(false);
|
|
52
|
+
const sizeStyles = {
|
|
53
|
+
small: { padding: "6px 14px", fontSize: "13px" },
|
|
54
|
+
medium: { padding: "10px 20px", fontSize: "15px" },
|
|
55
|
+
large: { padding: "14px 28px", fontSize: "17px" }
|
|
56
|
+
};
|
|
57
|
+
const styles = {
|
|
58
|
+
backgroundColor: disabled ? "#a0a0a0" : isHovered ? hoverColor : bgColor,
|
|
59
|
+
color: textColor,
|
|
60
|
+
border: "none",
|
|
61
|
+
borderRadius: rounded ? "9999px" : "6px",
|
|
62
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
63
|
+
fontWeight: 600,
|
|
64
|
+
fontFamily: "inherit",
|
|
65
|
+
transition: "all 0.2s ease",
|
|
66
|
+
transform: isPressed ? "scale(0.96)" : isHovered ? "scale(1.03)" : "scale(1)",
|
|
67
|
+
boxShadow: isHovered && !disabled ? "0 6px 14px rgba(0,0,0,0.18)" : "0 2px 6px rgba(0,0,0,0.12)",
|
|
68
|
+
outline: "none",
|
|
69
|
+
...sizeStyles[size]
|
|
70
|
+
};
|
|
71
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
72
|
+
"button",
|
|
73
|
+
{
|
|
74
|
+
style: styles,
|
|
75
|
+
disabled,
|
|
76
|
+
onClick,
|
|
77
|
+
onMouseEnter: () => setIsHovered(true),
|
|
78
|
+
onMouseLeave: () => {
|
|
79
|
+
setIsHovered(false);
|
|
80
|
+
setIsPressed(false);
|
|
81
|
+
},
|
|
82
|
+
onMouseDown: () => setIsPressed(true),
|
|
83
|
+
onMouseUp: () => setIsPressed(false)
|
|
84
|
+
},
|
|
85
|
+
text
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// src/components/Card/Card.jsx
|
|
90
|
+
var import_react2 = __toESM(require("react"));
|
|
91
|
+
var Card = ({
|
|
92
|
+
title = "Card Title",
|
|
93
|
+
description = "This is a simple, reusable card component built with React.",
|
|
94
|
+
imageUrl = "",
|
|
95
|
+
bgColor = "#ffffff",
|
|
96
|
+
textColor = "#1f2937",
|
|
97
|
+
accentColor = "#4f46e5",
|
|
98
|
+
width = "300px",
|
|
99
|
+
rounded = true,
|
|
100
|
+
elevated = true,
|
|
101
|
+
buttonText = "Learn More",
|
|
102
|
+
onButtonClick = () => {
|
|
103
|
+
},
|
|
104
|
+
showButton = true
|
|
105
|
+
}) => {
|
|
106
|
+
const [isHovered, setIsHovered] = (0, import_react2.useState)(false);
|
|
107
|
+
const [isButtonHovered, setIsButtonHovered] = (0, import_react2.useState)(false);
|
|
108
|
+
const [isButtonPressed, setIsButtonPressed] = (0, import_react2.useState)(false);
|
|
109
|
+
const cardStyles = {
|
|
110
|
+
width,
|
|
111
|
+
backgroundColor: bgColor,
|
|
112
|
+
color: textColor,
|
|
113
|
+
borderRadius: rounded ? "16px" : "4px",
|
|
114
|
+
overflow: "hidden",
|
|
115
|
+
boxShadow: isHovered ? "0 12px 24px rgba(0,0,0,0.18)" : elevated ? "0 4px 12px rgba(0,0,0,0.1)" : "0 1px 3px rgba(0,0,0,0.08)",
|
|
116
|
+
transform: isHovered ? "translateY(-6px)" : "translateY(0)",
|
|
117
|
+
transition: "all 0.25s ease",
|
|
118
|
+
fontFamily: "inherit",
|
|
119
|
+
border: "1px solid rgba(0,0,0,0.06)",
|
|
120
|
+
display: "flex",
|
|
121
|
+
flexDirection: "column"
|
|
122
|
+
};
|
|
123
|
+
const imageStyles = {
|
|
124
|
+
width: "100%",
|
|
125
|
+
height: "160px",
|
|
126
|
+
objectFit: "cover",
|
|
127
|
+
display: "block"
|
|
128
|
+
};
|
|
129
|
+
const contentStyles = {
|
|
130
|
+
padding: "18px 20px",
|
|
131
|
+
display: "flex",
|
|
132
|
+
flexDirection: "column",
|
|
133
|
+
gap: "8px"
|
|
134
|
+
};
|
|
135
|
+
const titleStyles = {
|
|
136
|
+
margin: 0,
|
|
137
|
+
fontSize: "18px",
|
|
138
|
+
fontWeight: 700,
|
|
139
|
+
color: textColor
|
|
140
|
+
};
|
|
141
|
+
const descStyles = {
|
|
142
|
+
margin: 0,
|
|
143
|
+
fontSize: "14px",
|
|
144
|
+
lineHeight: 1.5,
|
|
145
|
+
color: textColor,
|
|
146
|
+
opacity: 0.75
|
|
147
|
+
};
|
|
148
|
+
const buttonStyles = {
|
|
149
|
+
marginTop: "10px",
|
|
150
|
+
alignSelf: "flex-start",
|
|
151
|
+
padding: "8px 18px",
|
|
152
|
+
fontSize: "13px",
|
|
153
|
+
fontWeight: 600,
|
|
154
|
+
color: "#ffffff",
|
|
155
|
+
backgroundColor: accentColor,
|
|
156
|
+
border: "none",
|
|
157
|
+
borderRadius: rounded ? "9999px" : "6px",
|
|
158
|
+
cursor: "pointer",
|
|
159
|
+
transition: "all 0.2s ease",
|
|
160
|
+
transform: isButtonPressed ? "scale(0.96)" : isButtonHovered ? "scale(1.04)" : "scale(1)",
|
|
161
|
+
opacity: isButtonHovered ? 0.9 : 1
|
|
162
|
+
};
|
|
163
|
+
return /* @__PURE__ */ import_react2.default.createElement(
|
|
164
|
+
"div",
|
|
165
|
+
{
|
|
166
|
+
style: cardStyles,
|
|
167
|
+
onMouseEnter: () => setIsHovered(true),
|
|
168
|
+
onMouseLeave: () => setIsHovered(false)
|
|
169
|
+
},
|
|
170
|
+
imageUrl && /* @__PURE__ */ import_react2.default.createElement("img", { src: imageUrl, alt: title, style: imageStyles }),
|
|
171
|
+
/* @__PURE__ */ import_react2.default.createElement("div", { style: contentStyles }, /* @__PURE__ */ import_react2.default.createElement("h3", { style: titleStyles }, title), /* @__PURE__ */ import_react2.default.createElement("p", { style: descStyles }, description), showButton && /* @__PURE__ */ import_react2.default.createElement(
|
|
172
|
+
"button",
|
|
173
|
+
{
|
|
174
|
+
style: buttonStyles,
|
|
175
|
+
onClick: onButtonClick,
|
|
176
|
+
onMouseEnter: () => setIsButtonHovered(true),
|
|
177
|
+
onMouseLeave: () => {
|
|
178
|
+
setIsButtonHovered(false);
|
|
179
|
+
setIsButtonPressed(false);
|
|
180
|
+
},
|
|
181
|
+
onMouseDown: () => setIsButtonPressed(true),
|
|
182
|
+
onMouseUp: () => setIsButtonPressed(false)
|
|
183
|
+
},
|
|
184
|
+
buttonText
|
|
185
|
+
))
|
|
186
|
+
);
|
|
187
|
+
};
|
|
188
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
189
|
+
0 && (module.exports = {
|
|
190
|
+
Button,
|
|
191
|
+
Card
|
|
192
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
// src/components/Button/Button.jsx
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
var Button = ({
|
|
4
|
+
text = "Click Me",
|
|
5
|
+
onClick = () => {
|
|
6
|
+
},
|
|
7
|
+
bgColor = "#4f46e5",
|
|
8
|
+
hoverColor = "#4338ca",
|
|
9
|
+
textColor = "#ffffff",
|
|
10
|
+
size = "medium",
|
|
11
|
+
disabled = false,
|
|
12
|
+
rounded = true
|
|
13
|
+
}) => {
|
|
14
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
15
|
+
const [isPressed, setIsPressed] = useState(false);
|
|
16
|
+
const sizeStyles = {
|
|
17
|
+
small: { padding: "6px 14px", fontSize: "13px" },
|
|
18
|
+
medium: { padding: "10px 20px", fontSize: "15px" },
|
|
19
|
+
large: { padding: "14px 28px", fontSize: "17px" }
|
|
20
|
+
};
|
|
21
|
+
const styles = {
|
|
22
|
+
backgroundColor: disabled ? "#a0a0a0" : isHovered ? hoverColor : bgColor,
|
|
23
|
+
color: textColor,
|
|
24
|
+
border: "none",
|
|
25
|
+
borderRadius: rounded ? "9999px" : "6px",
|
|
26
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
27
|
+
fontWeight: 600,
|
|
28
|
+
fontFamily: "inherit",
|
|
29
|
+
transition: "all 0.2s ease",
|
|
30
|
+
transform: isPressed ? "scale(0.96)" : isHovered ? "scale(1.03)" : "scale(1)",
|
|
31
|
+
boxShadow: isHovered && !disabled ? "0 6px 14px rgba(0,0,0,0.18)" : "0 2px 6px rgba(0,0,0,0.12)",
|
|
32
|
+
outline: "none",
|
|
33
|
+
...sizeStyles[size]
|
|
34
|
+
};
|
|
35
|
+
return /* @__PURE__ */ React.createElement(
|
|
36
|
+
"button",
|
|
37
|
+
{
|
|
38
|
+
style: styles,
|
|
39
|
+
disabled,
|
|
40
|
+
onClick,
|
|
41
|
+
onMouseEnter: () => setIsHovered(true),
|
|
42
|
+
onMouseLeave: () => {
|
|
43
|
+
setIsHovered(false);
|
|
44
|
+
setIsPressed(false);
|
|
45
|
+
},
|
|
46
|
+
onMouseDown: () => setIsPressed(true),
|
|
47
|
+
onMouseUp: () => setIsPressed(false)
|
|
48
|
+
},
|
|
49
|
+
text
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// src/components/Card/Card.jsx
|
|
54
|
+
import React2, { useState as useState2 } from "react";
|
|
55
|
+
var Card = ({
|
|
56
|
+
title = "Card Title",
|
|
57
|
+
description = "This is a simple, reusable card component built with React.",
|
|
58
|
+
imageUrl = "",
|
|
59
|
+
bgColor = "#ffffff",
|
|
60
|
+
textColor = "#1f2937",
|
|
61
|
+
accentColor = "#4f46e5",
|
|
62
|
+
width = "300px",
|
|
63
|
+
rounded = true,
|
|
64
|
+
elevated = true,
|
|
65
|
+
buttonText = "Learn More",
|
|
66
|
+
onButtonClick = () => {
|
|
67
|
+
},
|
|
68
|
+
showButton = true
|
|
69
|
+
}) => {
|
|
70
|
+
const [isHovered, setIsHovered] = useState2(false);
|
|
71
|
+
const [isButtonHovered, setIsButtonHovered] = useState2(false);
|
|
72
|
+
const [isButtonPressed, setIsButtonPressed] = useState2(false);
|
|
73
|
+
const cardStyles = {
|
|
74
|
+
width,
|
|
75
|
+
backgroundColor: bgColor,
|
|
76
|
+
color: textColor,
|
|
77
|
+
borderRadius: rounded ? "16px" : "4px",
|
|
78
|
+
overflow: "hidden",
|
|
79
|
+
boxShadow: isHovered ? "0 12px 24px rgba(0,0,0,0.18)" : elevated ? "0 4px 12px rgba(0,0,0,0.1)" : "0 1px 3px rgba(0,0,0,0.08)",
|
|
80
|
+
transform: isHovered ? "translateY(-6px)" : "translateY(0)",
|
|
81
|
+
transition: "all 0.25s ease",
|
|
82
|
+
fontFamily: "inherit",
|
|
83
|
+
border: "1px solid rgba(0,0,0,0.06)",
|
|
84
|
+
display: "flex",
|
|
85
|
+
flexDirection: "column"
|
|
86
|
+
};
|
|
87
|
+
const imageStyles = {
|
|
88
|
+
width: "100%",
|
|
89
|
+
height: "160px",
|
|
90
|
+
objectFit: "cover",
|
|
91
|
+
display: "block"
|
|
92
|
+
};
|
|
93
|
+
const contentStyles = {
|
|
94
|
+
padding: "18px 20px",
|
|
95
|
+
display: "flex",
|
|
96
|
+
flexDirection: "column",
|
|
97
|
+
gap: "8px"
|
|
98
|
+
};
|
|
99
|
+
const titleStyles = {
|
|
100
|
+
margin: 0,
|
|
101
|
+
fontSize: "18px",
|
|
102
|
+
fontWeight: 700,
|
|
103
|
+
color: textColor
|
|
104
|
+
};
|
|
105
|
+
const descStyles = {
|
|
106
|
+
margin: 0,
|
|
107
|
+
fontSize: "14px",
|
|
108
|
+
lineHeight: 1.5,
|
|
109
|
+
color: textColor,
|
|
110
|
+
opacity: 0.75
|
|
111
|
+
};
|
|
112
|
+
const buttonStyles = {
|
|
113
|
+
marginTop: "10px",
|
|
114
|
+
alignSelf: "flex-start",
|
|
115
|
+
padding: "8px 18px",
|
|
116
|
+
fontSize: "13px",
|
|
117
|
+
fontWeight: 600,
|
|
118
|
+
color: "#ffffff",
|
|
119
|
+
backgroundColor: accentColor,
|
|
120
|
+
border: "none",
|
|
121
|
+
borderRadius: rounded ? "9999px" : "6px",
|
|
122
|
+
cursor: "pointer",
|
|
123
|
+
transition: "all 0.2s ease",
|
|
124
|
+
transform: isButtonPressed ? "scale(0.96)" : isButtonHovered ? "scale(1.04)" : "scale(1)",
|
|
125
|
+
opacity: isButtonHovered ? 0.9 : 1
|
|
126
|
+
};
|
|
127
|
+
return /* @__PURE__ */ React2.createElement(
|
|
128
|
+
"div",
|
|
129
|
+
{
|
|
130
|
+
style: cardStyles,
|
|
131
|
+
onMouseEnter: () => setIsHovered(true),
|
|
132
|
+
onMouseLeave: () => setIsHovered(false)
|
|
133
|
+
},
|
|
134
|
+
imageUrl && /* @__PURE__ */ React2.createElement("img", { src: imageUrl, alt: title, style: imageStyles }),
|
|
135
|
+
/* @__PURE__ */ React2.createElement("div", { style: contentStyles }, /* @__PURE__ */ React2.createElement("h3", { style: titleStyles }, title), /* @__PURE__ */ React2.createElement("p", { style: descStyles }, description), showButton && /* @__PURE__ */ React2.createElement(
|
|
136
|
+
"button",
|
|
137
|
+
{
|
|
138
|
+
style: buttonStyles,
|
|
139
|
+
onClick: onButtonClick,
|
|
140
|
+
onMouseEnter: () => setIsButtonHovered(true),
|
|
141
|
+
onMouseLeave: () => {
|
|
142
|
+
setIsButtonHovered(false);
|
|
143
|
+
setIsButtonPressed(false);
|
|
144
|
+
},
|
|
145
|
+
onMouseDown: () => setIsButtonPressed(true),
|
|
146
|
+
onMouseUp: () => setIsButtonPressed(false)
|
|
147
|
+
},
|
|
148
|
+
buttonText
|
|
149
|
+
))
|
|
150
|
+
);
|
|
151
|
+
};
|
|
152
|
+
export {
|
|
153
|
+
Button,
|
|
154
|
+
Card
|
|
155
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "generative-ui-library",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Generative UI React Component Library",
|
|
5
|
+
"license": "ISC",
|
|
6
|
+
"author": "Pankajkumar",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"module": "dist/index.mjs",
|
|
9
|
+
"files": ["dist"],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsup"
|
|
12
|
+
},
|
|
13
|
+
"peerDependencies": {
|
|
14
|
+
"react": ">=18"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"tsup": "^8.5.1",
|
|
18
|
+
"typescript": "^7.0.2"
|
|
19
|
+
}
|
|
20
|
+
}
|