omui-lib 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 ADDED
@@ -0,0 +1,311 @@
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 = "Button",
41
+ variant = "solid",
42
+ // solid | outline | ghost
43
+ size = "md",
44
+ // sm | md | lg
45
+ palette = "primary",
46
+ // primary | secondary | danger | success
47
+ disabled = false,
48
+ fullWidth = false,
49
+ onClick = () => {
50
+ }
51
+ }) => {
52
+ const [isHovered, setIsHovered] = (0, import_react.useState)(false);
53
+ const [isActive, setIsActive] = (0, import_react.useState)(false);
54
+ const palettes = {
55
+ primary: {
56
+ bg: "#4CAF50",
57
+ text: "#ffffff",
58
+ border: "#4CAF50",
59
+ hover: "#45a049",
60
+ active: "#3e8e41"
61
+ },
62
+ secondary: {
63
+ bg: "#2196F3",
64
+ text: "#ffffff",
65
+ border: "#2196F3",
66
+ hover: "#1976d2",
67
+ active: "#1565c0"
68
+ },
69
+ danger: {
70
+ bg: "#f44336",
71
+ text: "#ffffff",
72
+ border: "#f44336",
73
+ hover: "#d32f2f",
74
+ active: "#b71c1c"
75
+ },
76
+ success: {
77
+ bg: "#00897b",
78
+ text: "#ffffff",
79
+ border: "#00897b",
80
+ hover: "#00695c",
81
+ active: "#004d40"
82
+ }
83
+ };
84
+ const sizes = {
85
+ sm: {
86
+ padding: "6px 12px",
87
+ fontSize: "12px"
88
+ },
89
+ md: {
90
+ padding: "10px 18px",
91
+ fontSize: "14px"
92
+ },
93
+ lg: {
94
+ padding: "14px 26px",
95
+ fontSize: "16px"
96
+ }
97
+ };
98
+ const selectedPalette = palettes[palette] || palettes.primary;
99
+ const selectedSize = sizes[size] || sizes.md;
100
+ const getVariantStyles = () => {
101
+ if (variant === "outline") {
102
+ return {
103
+ backgroundColor: "transparent",
104
+ color: selectedPalette.border,
105
+ border: `2px solid ${selectedPalette.border}`
106
+ };
107
+ }
108
+ if (variant === "ghost") {
109
+ return {
110
+ backgroundColor: "transparent",
111
+ color: selectedPalette.border,
112
+ border: "none"
113
+ };
114
+ }
115
+ return {
116
+ backgroundColor: selectedPalette.bg,
117
+ color: selectedPalette.text,
118
+ border: "none"
119
+ };
120
+ };
121
+ const getStateStyles = () => {
122
+ if (disabled) {
123
+ return {
124
+ backgroundColor: "#ccc",
125
+ color: "#666",
126
+ cursor: "not-allowed"
127
+ };
128
+ }
129
+ if (isActive) {
130
+ return {
131
+ backgroundColor: variant === "solid" ? selectedPalette.active : "#e0e0e0",
132
+ transform: "scale(0.96)"
133
+ };
134
+ }
135
+ if (isHovered) {
136
+ return {
137
+ backgroundColor: variant === "solid" ? selectedPalette.hover : "#f5f5f5"
138
+ };
139
+ }
140
+ return {};
141
+ };
142
+ const baseStyles = {
143
+ display: "inline-block",
144
+ width: fullWidth ? "100%" : "auto",
145
+ borderRadius: "8px",
146
+ fontWeight: "600",
147
+ transition: "all 0.25s ease",
148
+ cursor: disabled ? "not-allowed" : "pointer",
149
+ outline: "none",
150
+ userSelect: "none"
151
+ };
152
+ const combinedStyles = {
153
+ ...baseStyles,
154
+ ...selectedSize,
155
+ ...getVariantStyles(),
156
+ ...getStateStyles()
157
+ };
158
+ return /* @__PURE__ */ import_react.default.createElement(
159
+ "button",
160
+ {
161
+ style: combinedStyles,
162
+ disabled,
163
+ onClick: (e) => !disabled && onClick(e),
164
+ onMouseEnter: () => setIsHovered(true),
165
+ onMouseLeave: () => {
166
+ setIsHovered(false);
167
+ setIsActive(false);
168
+ },
169
+ onMouseDown: () => setIsActive(true),
170
+ onMouseUp: () => setIsActive(false)
171
+ },
172
+ text
173
+ );
174
+ };
175
+
176
+ // src/components/Card/Card.jsx
177
+ var import_react2 = __toESM(require("react"));
178
+ var Card = ({
179
+ title = "Card Title",
180
+ description = "This is a simple card description.",
181
+ image = "",
182
+ variant = "elevated",
183
+ // elevated | outlined | flat
184
+ size = "md",
185
+ // sm | md | lg
186
+ palette = "primary",
187
+ // primary | secondary | danger | success
188
+ hoverable = true,
189
+ clickable = false,
190
+ fullWidth = false,
191
+ onClick = () => {
192
+ }
193
+ }) => {
194
+ const [isHovered, setIsHovered] = (0, import_react2.useState)(false);
195
+ const palettes = {
196
+ primary: {
197
+ bg: "#ffffff",
198
+ border: "#4CAF50",
199
+ title: "#333",
200
+ text: "#555"
201
+ },
202
+ secondary: {
203
+ bg: "#ffffff",
204
+ border: "#2196F3",
205
+ title: "#333",
206
+ text: "#555"
207
+ },
208
+ danger: {
209
+ bg: "#ffffff",
210
+ border: "#f44336",
211
+ title: "#333",
212
+ text: "#555"
213
+ },
214
+ success: {
215
+ bg: "#ffffff",
216
+ border: "#00897b",
217
+ title: "#333",
218
+ text: "#555"
219
+ }
220
+ };
221
+ const sizes = {
222
+ sm: {
223
+ padding: "10px",
224
+ titleSize: "14px",
225
+ textSize: "12px"
226
+ },
227
+ md: {
228
+ padding: "16px",
229
+ titleSize: "18px",
230
+ textSize: "14px"
231
+ },
232
+ lg: {
233
+ padding: "20px",
234
+ titleSize: "22px",
235
+ textSize: "16px"
236
+ }
237
+ };
238
+ const selectedPalette = palettes[palette] || palettes.primary;
239
+ const selectedSize = sizes[size] || sizes.md;
240
+ const getVariantStyles = () => {
241
+ switch (variant) {
242
+ case "outlined":
243
+ return {
244
+ border: `2px solid ${selectedPalette.border}`,
245
+ boxShadow: "none"
246
+ };
247
+ case "flat":
248
+ return {
249
+ border: "none",
250
+ boxShadow: "none"
251
+ };
252
+ default:
253
+ return {
254
+ border: "none",
255
+ boxShadow: "0 4px 10px rgba(0,0,0,0.15)"
256
+ };
257
+ }
258
+ };
259
+ const hoverStyles = hoverable && isHovered ? {
260
+ transform: "translateY(-5px)",
261
+ boxShadow: "0 8px 18px rgba(0,0,0,0.2)"
262
+ } : {};
263
+ const baseStyles = {
264
+ width: fullWidth ? "100%" : "280px",
265
+ backgroundColor: selectedPalette.bg,
266
+ borderRadius: "12px",
267
+ overflow: "hidden",
268
+ cursor: clickable ? "pointer" : "default",
269
+ transition: "all 0.3s ease"
270
+ };
271
+ const containerStyles = {
272
+ ...baseStyles,
273
+ ...getVariantStyles(),
274
+ ...hoverStyles
275
+ };
276
+ const contentStyles = {
277
+ padding: selectedSize.padding
278
+ };
279
+ const titleStyles = {
280
+ fontSize: selectedSize.titleSize,
281
+ fontWeight: "600",
282
+ marginBottom: "8px",
283
+ color: selectedPalette.title
284
+ };
285
+ const textStyles = {
286
+ fontSize: selectedSize.textSize,
287
+ color: selectedPalette.text,
288
+ lineHeight: "1.5"
289
+ };
290
+ const imageStyles = {
291
+ width: "100%",
292
+ height: "160px",
293
+ objectFit: "cover"
294
+ };
295
+ return /* @__PURE__ */ import_react2.default.createElement(
296
+ "div",
297
+ {
298
+ style: containerStyles,
299
+ onMouseEnter: () => setIsHovered(true),
300
+ onMouseLeave: () => setIsHovered(false),
301
+ onClick: (e) => clickable && onClick(e)
302
+ },
303
+ image && /* @__PURE__ */ import_react2.default.createElement("img", { src: image, alt: "card", style: imageStyles }),
304
+ /* @__PURE__ */ import_react2.default.createElement("div", { style: contentStyles }, /* @__PURE__ */ import_react2.default.createElement("div", { style: titleStyles }, title), /* @__PURE__ */ import_react2.default.createElement("div", { style: textStyles }, description))
305
+ );
306
+ };
307
+ // Annotate the CommonJS export names for ESM import in node:
308
+ 0 && (module.exports = {
309
+ Button,
310
+ Card
311
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,274 @@
1
+ // src/components/Button/Button.jsx
2
+ import React, { useState } from "react";
3
+ var Button = ({
4
+ text = "Button",
5
+ variant = "solid",
6
+ // solid | outline | ghost
7
+ size = "md",
8
+ // sm | md | lg
9
+ palette = "primary",
10
+ // primary | secondary | danger | success
11
+ disabled = false,
12
+ fullWidth = false,
13
+ onClick = () => {
14
+ }
15
+ }) => {
16
+ const [isHovered, setIsHovered] = useState(false);
17
+ const [isActive, setIsActive] = useState(false);
18
+ const palettes = {
19
+ primary: {
20
+ bg: "#4CAF50",
21
+ text: "#ffffff",
22
+ border: "#4CAF50",
23
+ hover: "#45a049",
24
+ active: "#3e8e41"
25
+ },
26
+ secondary: {
27
+ bg: "#2196F3",
28
+ text: "#ffffff",
29
+ border: "#2196F3",
30
+ hover: "#1976d2",
31
+ active: "#1565c0"
32
+ },
33
+ danger: {
34
+ bg: "#f44336",
35
+ text: "#ffffff",
36
+ border: "#f44336",
37
+ hover: "#d32f2f",
38
+ active: "#b71c1c"
39
+ },
40
+ success: {
41
+ bg: "#00897b",
42
+ text: "#ffffff",
43
+ border: "#00897b",
44
+ hover: "#00695c",
45
+ active: "#004d40"
46
+ }
47
+ };
48
+ const sizes = {
49
+ sm: {
50
+ padding: "6px 12px",
51
+ fontSize: "12px"
52
+ },
53
+ md: {
54
+ padding: "10px 18px",
55
+ fontSize: "14px"
56
+ },
57
+ lg: {
58
+ padding: "14px 26px",
59
+ fontSize: "16px"
60
+ }
61
+ };
62
+ const selectedPalette = palettes[palette] || palettes.primary;
63
+ const selectedSize = sizes[size] || sizes.md;
64
+ const getVariantStyles = () => {
65
+ if (variant === "outline") {
66
+ return {
67
+ backgroundColor: "transparent",
68
+ color: selectedPalette.border,
69
+ border: `2px solid ${selectedPalette.border}`
70
+ };
71
+ }
72
+ if (variant === "ghost") {
73
+ return {
74
+ backgroundColor: "transparent",
75
+ color: selectedPalette.border,
76
+ border: "none"
77
+ };
78
+ }
79
+ return {
80
+ backgroundColor: selectedPalette.bg,
81
+ color: selectedPalette.text,
82
+ border: "none"
83
+ };
84
+ };
85
+ const getStateStyles = () => {
86
+ if (disabled) {
87
+ return {
88
+ backgroundColor: "#ccc",
89
+ color: "#666",
90
+ cursor: "not-allowed"
91
+ };
92
+ }
93
+ if (isActive) {
94
+ return {
95
+ backgroundColor: variant === "solid" ? selectedPalette.active : "#e0e0e0",
96
+ transform: "scale(0.96)"
97
+ };
98
+ }
99
+ if (isHovered) {
100
+ return {
101
+ backgroundColor: variant === "solid" ? selectedPalette.hover : "#f5f5f5"
102
+ };
103
+ }
104
+ return {};
105
+ };
106
+ const baseStyles = {
107
+ display: "inline-block",
108
+ width: fullWidth ? "100%" : "auto",
109
+ borderRadius: "8px",
110
+ fontWeight: "600",
111
+ transition: "all 0.25s ease",
112
+ cursor: disabled ? "not-allowed" : "pointer",
113
+ outline: "none",
114
+ userSelect: "none"
115
+ };
116
+ const combinedStyles = {
117
+ ...baseStyles,
118
+ ...selectedSize,
119
+ ...getVariantStyles(),
120
+ ...getStateStyles()
121
+ };
122
+ return /* @__PURE__ */ React.createElement(
123
+ "button",
124
+ {
125
+ style: combinedStyles,
126
+ disabled,
127
+ onClick: (e) => !disabled && onClick(e),
128
+ onMouseEnter: () => setIsHovered(true),
129
+ onMouseLeave: () => {
130
+ setIsHovered(false);
131
+ setIsActive(false);
132
+ },
133
+ onMouseDown: () => setIsActive(true),
134
+ onMouseUp: () => setIsActive(false)
135
+ },
136
+ text
137
+ );
138
+ };
139
+
140
+ // src/components/Card/Card.jsx
141
+ import React2, { useState as useState2 } from "react";
142
+ var Card = ({
143
+ title = "Card Title",
144
+ description = "This is a simple card description.",
145
+ image = "",
146
+ variant = "elevated",
147
+ // elevated | outlined | flat
148
+ size = "md",
149
+ // sm | md | lg
150
+ palette = "primary",
151
+ // primary | secondary | danger | success
152
+ hoverable = true,
153
+ clickable = false,
154
+ fullWidth = false,
155
+ onClick = () => {
156
+ }
157
+ }) => {
158
+ const [isHovered, setIsHovered] = useState2(false);
159
+ const palettes = {
160
+ primary: {
161
+ bg: "#ffffff",
162
+ border: "#4CAF50",
163
+ title: "#333",
164
+ text: "#555"
165
+ },
166
+ secondary: {
167
+ bg: "#ffffff",
168
+ border: "#2196F3",
169
+ title: "#333",
170
+ text: "#555"
171
+ },
172
+ danger: {
173
+ bg: "#ffffff",
174
+ border: "#f44336",
175
+ title: "#333",
176
+ text: "#555"
177
+ },
178
+ success: {
179
+ bg: "#ffffff",
180
+ border: "#00897b",
181
+ title: "#333",
182
+ text: "#555"
183
+ }
184
+ };
185
+ const sizes = {
186
+ sm: {
187
+ padding: "10px",
188
+ titleSize: "14px",
189
+ textSize: "12px"
190
+ },
191
+ md: {
192
+ padding: "16px",
193
+ titleSize: "18px",
194
+ textSize: "14px"
195
+ },
196
+ lg: {
197
+ padding: "20px",
198
+ titleSize: "22px",
199
+ textSize: "16px"
200
+ }
201
+ };
202
+ const selectedPalette = palettes[palette] || palettes.primary;
203
+ const selectedSize = sizes[size] || sizes.md;
204
+ const getVariantStyles = () => {
205
+ switch (variant) {
206
+ case "outlined":
207
+ return {
208
+ border: `2px solid ${selectedPalette.border}`,
209
+ boxShadow: "none"
210
+ };
211
+ case "flat":
212
+ return {
213
+ border: "none",
214
+ boxShadow: "none"
215
+ };
216
+ default:
217
+ return {
218
+ border: "none",
219
+ boxShadow: "0 4px 10px rgba(0,0,0,0.15)"
220
+ };
221
+ }
222
+ };
223
+ const hoverStyles = hoverable && isHovered ? {
224
+ transform: "translateY(-5px)",
225
+ boxShadow: "0 8px 18px rgba(0,0,0,0.2)"
226
+ } : {};
227
+ const baseStyles = {
228
+ width: fullWidth ? "100%" : "280px",
229
+ backgroundColor: selectedPalette.bg,
230
+ borderRadius: "12px",
231
+ overflow: "hidden",
232
+ cursor: clickable ? "pointer" : "default",
233
+ transition: "all 0.3s ease"
234
+ };
235
+ const containerStyles = {
236
+ ...baseStyles,
237
+ ...getVariantStyles(),
238
+ ...hoverStyles
239
+ };
240
+ const contentStyles = {
241
+ padding: selectedSize.padding
242
+ };
243
+ const titleStyles = {
244
+ fontSize: selectedSize.titleSize,
245
+ fontWeight: "600",
246
+ marginBottom: "8px",
247
+ color: selectedPalette.title
248
+ };
249
+ const textStyles = {
250
+ fontSize: selectedSize.textSize,
251
+ color: selectedPalette.text,
252
+ lineHeight: "1.5"
253
+ };
254
+ const imageStyles = {
255
+ width: "100%",
256
+ height: "160px",
257
+ objectFit: "cover"
258
+ };
259
+ return /* @__PURE__ */ React2.createElement(
260
+ "div",
261
+ {
262
+ style: containerStyles,
263
+ onMouseEnter: () => setIsHovered(true),
264
+ onMouseLeave: () => setIsHovered(false),
265
+ onClick: (e) => clickable && onClick(e)
266
+ },
267
+ image && /* @__PURE__ */ React2.createElement("img", { src: image, alt: "card", style: imageStyles }),
268
+ /* @__PURE__ */ React2.createElement("div", { style: contentStyles }, /* @__PURE__ */ React2.createElement("div", { style: titleStyles }, title), /* @__PURE__ */ React2.createElement("div", { style: textStyles }, description))
269
+ );
270
+ };
271
+ export {
272
+ Button,
273
+ Card
274
+ };
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "omui-lib",
3
+ "version": "1.0.0",
4
+ "description": "omUI react component library",
5
+ "license": "ISC",
6
+ "author": "Om Mohanty",
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": "^6.0.3"
19
+ }
20
+ }