virtual-ui-lib 1.0.12 → 1.0.14

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 (3) hide show
  1. package/dist/index.js +77 -383
  2. package/dist/index.mjs +75 -372
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -29,415 +29,109 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  // src/index.js
30
30
  var index_exports = {};
31
31
  __export(index_exports, {
32
- Alert: () => Alert,
33
- AnimatedButton: () => AnimatedButton,
34
- Avatar: () => Avatar,
35
- Badge: () => Badge,
36
- Button: () => Button,
37
- Card: () => Card,
38
- CopyButton: () => CopyButton,
39
- Input: () => Input,
40
- Modal: () => Modal,
41
- ProgressBar: () => ProgressBar,
42
- Spinner: () => Spinner
32
+ AlertBanner: () => AlertBanner,
33
+ Button: () => Button
43
34
  });
44
35
  module.exports = __toCommonJS(index_exports);
45
36
 
46
- // src/components/Button/Button.jsx
37
+ // src/components/AlertBanner/AlertBanner.jsx
47
38
  var import_react = __toESM(require("react"));
39
+ var AlertBanner = ({
40
+ message = "This is an alert message.",
41
+ type = "info",
42
+ onDismiss
43
+ }) => {
44
+ const [visible, setVisible] = (0, import_react.useState)(true);
45
+ const [fade, setFade] = (0, import_react.useState)(false);
46
+ const colors = {
47
+ success: { background: "#059669", color: "white" },
48
+ error: { background: "#dc2626", color: "white" },
49
+ warning: { background: "#f59e0b", color: "black" },
50
+ info: { background: "#2563eb", color: "white" }
51
+ };
52
+ (0, import_react.useEffect)(() => {
53
+ if (!visible) {
54
+ setFade(true);
55
+ const timeout = setTimeout(() => onDismiss && onDismiss(), 300);
56
+ return () => clearTimeout(timeout);
57
+ }
58
+ }, [visible, onDismiss]);
59
+ return /* @__PURE__ */ import_react.default.createElement("div", { style: {
60
+ position: "relative",
61
+ width: "100%",
62
+ background: colors[type].background,
63
+ color: colors[type].color,
64
+ padding: "16px 24px",
65
+ borderRadius: "8px",
66
+ boxShadow: "0 2px 10px rgba(0,0,0,0.2)",
67
+ transition: "opacity 0.3s ease, transform 0.3s ease",
68
+ transform: `translateY(${visible ? "0" : "-20px"})`,
69
+ opacity: fade ? 0 : 1,
70
+ zIndex: 1e3
71
+ }, className: visible ? "slide-down" : "fade-out" }, message, /* @__PURE__ */ import_react.default.createElement("button", { onClick: () => setVisible(false), style: {
72
+ position: "absolute",
73
+ top: "10px",
74
+ right: "10px",
75
+ background: "transparent",
76
+ color: "inherit",
77
+ border: "none",
78
+ cursor: "pointer",
79
+ fontSize: "16px"
80
+ } }, "\u2715"));
81
+ };
82
+
83
+ // src/components/Button/Button.jsx
84
+ var import_react2 = __toESM(require("react"));
48
85
  var Button = ({
49
86
  text = "Button",
50
- bg = "#2563eb",
87
+ variant = "primary",
51
88
  color = "white",
52
- size = "md",
89
+ bg = "#2563eb",
90
+ outlineColor = "#2563eb",
91
+ ghostColor = "#2563eb",
53
92
  width = "auto",
54
- radius = "6px",
55
- border = "none",
56
- weight = "500",
57
- shadow = "none",
58
- disabled = false,
93
+ radius = "8px",
94
+ weight = "600",
95
+ iconLeft = null,
96
+ iconRight = null,
97
+ onClick,
59
98
  loading = false,
60
- icon = null,
61
- onClick
99
+ disabled = false
62
100
  }) => {
63
- const sizes = {
64
- sm: "6px 12px",
65
- md: "8px 16px",
66
- lg: "12px 20px"
101
+ const variants = {
102
+ primary: { background: bg, color, border: "none" },
103
+ secondary: { background: "#7c3aed", color, border: "none" },
104
+ outline: { background: "transparent", color, border: `2px solid ${outlineColor}` },
105
+ ghost: { background: "transparent", color: ghostColor, border: "none" }
67
106
  };
68
- return /* @__PURE__ */ import_react.default.createElement(
107
+ const { background, border } = variants[variant];
108
+ return /* @__PURE__ */ import_react2.default.createElement(
69
109
  "button",
70
110
  {
71
111
  onClick,
72
112
  disabled: disabled || loading,
73
113
  style: {
74
- background: bg,
75
- color,
76
- padding: sizes[size],
114
+ background,
115
+ color: variants[variant].color,
77
116
  width,
78
117
  border,
79
118
  borderRadius: radius,
80
119
  cursor: disabled ? "not-allowed" : "pointer",
81
120
  fontWeight: weight,
82
- boxShadow: shadow,
121
+ padding: "10px 20px",
83
122
  opacity: disabled ? 0.6 : 1,
84
- display: "flex",
85
- alignItems: "center",
86
- gap: "6px",
87
- justifyContent: "center"
88
- }
89
- },
90
- loading ? "Loading..." : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, icon, text)
91
- );
92
- };
93
-
94
- // src/components/Card/Card.jsx
95
- var import_react2 = __toESM(require("react"));
96
- var Card = ({
97
- title = "Card Title",
98
- text = "Card description",
99
- width = "250px",
100
- bg = "white",
101
- border = "1px solid #eee",
102
- radius = "8px",
103
- padding = "16px",
104
- shadow = "0 2px 6px rgba(0,0,0,0.05)",
105
- titleSize = "18px",
106
- textSize = "14px",
107
- align = "left",
108
- children
109
- }) => {
110
- return /* @__PURE__ */ import_react2.default.createElement(
111
- "div",
112
- {
113
- style: {
114
- width,
115
- background: bg,
116
- border,
117
- borderRadius: radius,
118
- padding,
119
- boxShadow: shadow,
120
- textAlign: align
121
- }
122
- },
123
- /* @__PURE__ */ import_react2.default.createElement("h3", { style: { fontSize: titleSize, marginBottom: "8px" } }, title),
124
- /* @__PURE__ */ import_react2.default.createElement("p", { style: { fontSize: textSize, marginBottom: "10px" } }, text),
125
- children
126
- );
127
- };
128
-
129
- // src/components/Input/Input.jsx
130
- var import_react3 = __toESM(require("react"));
131
- var Input = ({
132
- placeholder = "Enter text",
133
- type = "text",
134
- width = "200px",
135
- bg = "white",
136
- color = "#111",
137
- border = "1px solid #ccc",
138
- radius = "6px",
139
- shadow = "none",
140
- size = "md",
141
- disabled = false,
142
- value,
143
- onChange
144
- }) => {
145
- const sizes = {
146
- sm: "6px",
147
- md: "8px",
148
- lg: "12px"
149
- };
150
- return /* @__PURE__ */ import_react3.default.createElement(
151
- "input",
152
- {
153
- type,
154
- placeholder,
155
- value,
156
- onChange,
157
- disabled,
158
- style: {
159
- width,
160
- padding: sizes[size],
161
- background: bg,
162
- color,
163
- border,
164
- borderRadius: radius,
165
- boxShadow: shadow,
166
- outline: "none",
167
- opacity: disabled ? 0.6 : 1
168
- }
169
- }
170
- );
171
- };
172
-
173
- // src/components/Badge/Badge.jsx
174
- var import_react4 = __toESM(require("react"));
175
- var Badge = ({
176
- text = "NEW",
177
- color = "#ffffff",
178
- bgColor = "#2563eb",
179
- radius = "12px"
180
- }) => {
181
- return /* @__PURE__ */ import_react4.default.createElement("div", { style: {
182
- background: bgColor,
183
- color,
184
- borderRadius: radius,
185
- padding: "8px 12px",
186
- fontSize: "14px",
187
- fontWeight: "600",
188
- display: "inline-block",
189
- boxShadow: "0 4px 10px rgba(0,0,0,0.2)",
190
- fontFamily: "system-ui, sans-serif"
191
- } }, text);
192
- };
193
-
194
- // src/components/Alert/Alert.jsx
195
- var import_react5 = __toESM(require("react"));
196
- var Alert = ({
197
- text = "Alert message",
198
- bg = "#facc15",
199
- color = "#111",
200
- radius = "6px",
201
- padding = "10px",
202
- width = "auto"
203
- }) => {
204
- return /* @__PURE__ */ import_react5.default.createElement(
205
- "div",
206
- {
207
- style: {
208
- background: bg,
209
- color,
210
- padding,
211
- borderRadius: radius,
212
- width
213
- }
214
- },
215
- text
216
- );
217
- };
218
-
219
- // src/components/Avatar/Avatar.jsx
220
- var import_react6 = __toESM(require("react"));
221
- var Avatar = ({
222
- src = "\u{1F464}",
223
- size = "40px",
224
- radius = "50%"
225
- }) => {
226
- return /* @__PURE__ */ import_react6.default.createElement(
227
- "img",
228
- {
229
- src,
230
- alt: "avatar",
231
- style: {
232
- width: size,
233
- height: size,
234
- borderRadius: radius,
235
- objectFit: "cover"
236
- }
237
- }
238
- );
239
- };
240
-
241
- // src/components/Spinner/Spinner.jsx
242
- var import_react7 = __toESM(require("react"));
243
- var Spinner = ({
244
- size = "30px",
245
- color = "#2563eb",
246
- border = "3px"
247
- }) => {
248
- return /* @__PURE__ */ import_react7.default.createElement(import_react7.default.Fragment, null, /* @__PURE__ */ import_react7.default.createElement("style", null, `
249
- @keyframes vui-spin {
250
- to {
251
- transform: rotate(360deg);
252
- }
253
- }
254
- `), /* @__PURE__ */ import_react7.default.createElement(
255
- "div",
256
- {
257
- style: {
258
- width: size,
259
- height: size,
260
- border: `${border} solid #eee`,
261
- borderTop: `${border} solid ${color}`,
262
- borderRadius: "50%",
263
- animation: "vui-spin 1s linear infinite"
264
- }
265
- }
266
- ));
267
- };
268
-
269
- // src/components/Modal/Modal.jsx
270
- var import_react8 = __toESM(require("react"));
271
- var Modal = ({
272
- open = false,
273
- title = "Modal Title",
274
- children,
275
- width = "300px",
276
- bg = "white",
277
- radius = "8px",
278
- onClose
279
- }) => {
280
- if (!open) return null;
281
- return /* @__PURE__ */ import_react8.default.createElement(
282
- "div",
283
- {
284
- style: {
285
- position: "fixed",
286
- top: 0,
287
- left: 0,
288
- width: "100%",
289
- height: "100%",
290
- background: "rgba(0,0,0,0.3)",
291
- display: "flex",
292
- alignItems: "center",
293
- justifyContent: "center"
294
- }
295
- },
296
- /* @__PURE__ */ import_react8.default.createElement(
297
- "div",
298
- {
299
- style: {
300
- width,
301
- background: bg,
302
- borderRadius: radius,
303
- padding: "20px"
304
- }
123
+ transition: "transform 0.2s ease, background 0.2s ease"
305
124
  },
306
- /* @__PURE__ */ import_react8.default.createElement("h3", null, title),
307
- children,
308
- /* @__PURE__ */ import_react8.default.createElement("button", { onClick: onClose }, "Close")
309
- )
310
- );
311
- };
312
-
313
- // src/components/ProgressBar/ProgressBar.jsx
314
- var import_react9 = __toESM(require("react"));
315
- var ProgressBar = ({
316
- progress = 50,
317
- height = "20px",
318
- bgColor = "#2563eb",
319
- trackColor = "#d1d5db",
320
- radius = "10px",
321
- label = "Progress",
322
- textColor = "#ffffff"
323
- }) => {
324
- return /* @__PURE__ */ import_react9.default.createElement("div", { style: { width: "100%", background: trackColor, borderRadius: radius, overflow: "hidden" } }, /* @__PURE__ */ import_react9.default.createElement("div", { style: {
325
- width: progress + "%",
326
- height,
327
- background: bgColor,
328
- borderRadius: radius,
329
- display: "flex",
330
- alignItems: "center",
331
- justifyContent: "center",
332
- position: "relative"
333
- } }, /* @__PURE__ */ import_react9.default.createElement("span", { style: { color: textColor, fontWeight: "600", fontSize: "14px" } }, label, ": ", progress, "%")));
334
- };
335
-
336
- // src/components/AnimatedButton/AnimatedButton.jsx
337
- var import_react10 = __toESM(require("react"));
338
- var AnimatedButton = ({
339
- text = "Click Me",
340
- gradient = "linear-gradient(45deg, #2563eb, #7c3aed)",
341
- color = "white",
342
- size = "md",
343
- width = "auto",
344
- radius = "12px",
345
- shadow = "0 4px 14px rgba(0, 0, 0, 0.2)",
346
- loading = false,
347
- onClick
348
- }) => {
349
- const sizes = { sm: "8px 16px", md: "12px 24px", lg: "16px 32px" };
350
- const handleMouseEnter = (e) => {
351
- e.target.style.transform = "scale(1.05)";
352
- };
353
- const handleMouseLeave = (e) => {
354
- e.target.style.transform = "scale(1)";
355
- };
356
- return /* @__PURE__ */ import_react10.default.createElement(
357
- "button",
358
- {
359
- onClick,
360
- onMouseEnter: handleMouseEnter,
361
- onMouseLeave: handleMouseLeave,
362
- disabled: loading,
363
- style: {
364
- background: gradient,
365
- color,
366
- padding: sizes[size],
367
- width,
368
- border: "none",
369
- borderRadius: radius,
370
- boxShadow: shadow,
371
- cursor: loading ? "not-allowed" : "pointer",
372
- fontWeight: "600",
373
- fontSize: "15px",
374
- transition: "transform 0.3s, box-shadow 0.3s",
375
- fontFamily: "system-ui, sans-serif",
376
- opacity: loading ? 0.6 : 1,
377
- display: "flex",
378
- alignItems: "center",
379
- justifyContent: "center",
380
- gap: "8px"
381
- }
382
- },
383
- loading ? "Loading..." : text
384
- );
385
- };
386
-
387
- // src/components/CopyButton/CopyButton.jsx
388
- var import_react11 = __toESM(require("react"));
389
- var CopyButton = ({
390
- text = "Copy",
391
- copyText = "Hello, World!",
392
- successMessage = "Copied!",
393
- bg = "#059669",
394
- successBg = "#7c3aed",
395
- color = "white",
396
- radius = "12px",
397
- padding = "10px 20px",
398
- onCopy
399
- }) => {
400
- const [copied, setCopied] = (0, import_react11.useState)(false);
401
- const handleCopy = () => {
402
- navigator.clipboard.writeText(copyText);
403
- setCopied(true);
404
- if (onCopy) onCopy();
405
- setTimeout(() => setCopied(false), 2e3);
406
- };
407
- return /* @__PURE__ */ import_react11.default.createElement(
408
- "button",
409
- {
410
- onClick: handleCopy,
411
- style: {
412
- background: copied ? successBg : bg,
413
- color,
414
- border: "none",
415
- borderRadius: radius,
416
- padding,
417
- cursor: "pointer",
418
- fontWeight: "600",
419
- fontSize: "16px",
420
- transition: "background 0.3s ease",
421
- display: "flex",
422
- alignItems: "center",
423
- justifyContent: "center",
424
- filter: copied ? "brightness(0.9)" : "none"
425
- }
125
+ onMouseEnter: (e) => e.currentTarget.style.transform = "scale(1.05)",
126
+ onMouseLeave: (e) => e.currentTarget.style.transform = "scale(1)",
127
+ onMouseDown: (e) => e.currentTarget.style.transform = "scale(0.95)",
128
+ onMouseUp: (e) => e.currentTarget.style.transform = "scale(1)"
426
129
  },
427
- copied ? successMessage : text
130
+ loading ? "Loading..." : /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, iconLeft, text, iconRight))
428
131
  );
429
132
  };
430
133
  // Annotate the CommonJS export names for ESM import in node:
431
134
  0 && (module.exports = {
432
- Alert,
433
- AnimatedButton,
434
- Avatar,
435
- Badge,
436
- Button,
437
- Card,
438
- CopyButton,
439
- Input,
440
- Modal,
441
- ProgressBar,
442
- Spinner
135
+ AlertBanner,
136
+ Button
443
137
  });
package/dist/index.mjs CHANGED
@@ -1,397 +1,100 @@
1
+ // src/components/AlertBanner/AlertBanner.jsx
2
+ import React, { useState, useEffect } from "react";
3
+ var AlertBanner = ({
4
+ message = "This is an alert message.",
5
+ type = "info",
6
+ onDismiss
7
+ }) => {
8
+ const [visible, setVisible] = useState(true);
9
+ const [fade, setFade] = useState(false);
10
+ const colors = {
11
+ success: { background: "#059669", color: "white" },
12
+ error: { background: "#dc2626", color: "white" },
13
+ warning: { background: "#f59e0b", color: "black" },
14
+ info: { background: "#2563eb", color: "white" }
15
+ };
16
+ useEffect(() => {
17
+ if (!visible) {
18
+ setFade(true);
19
+ const timeout = setTimeout(() => onDismiss && onDismiss(), 300);
20
+ return () => clearTimeout(timeout);
21
+ }
22
+ }, [visible, onDismiss]);
23
+ return /* @__PURE__ */ React.createElement("div", { style: {
24
+ position: "relative",
25
+ width: "100%",
26
+ background: colors[type].background,
27
+ color: colors[type].color,
28
+ padding: "16px 24px",
29
+ borderRadius: "8px",
30
+ boxShadow: "0 2px 10px rgba(0,0,0,0.2)",
31
+ transition: "opacity 0.3s ease, transform 0.3s ease",
32
+ transform: `translateY(${visible ? "0" : "-20px"})`,
33
+ opacity: fade ? 0 : 1,
34
+ zIndex: 1e3
35
+ }, className: visible ? "slide-down" : "fade-out" }, message, /* @__PURE__ */ React.createElement("button", { onClick: () => setVisible(false), style: {
36
+ position: "absolute",
37
+ top: "10px",
38
+ right: "10px",
39
+ background: "transparent",
40
+ color: "inherit",
41
+ border: "none",
42
+ cursor: "pointer",
43
+ fontSize: "16px"
44
+ } }, "\u2715"));
45
+ };
46
+
1
47
  // src/components/Button/Button.jsx
2
- import React from "react";
48
+ import React2 from "react";
3
49
  var Button = ({
4
50
  text = "Button",
5
- bg = "#2563eb",
51
+ variant = "primary",
6
52
  color = "white",
7
- size = "md",
53
+ bg = "#2563eb",
54
+ outlineColor = "#2563eb",
55
+ ghostColor = "#2563eb",
8
56
  width = "auto",
9
- radius = "6px",
10
- border = "none",
11
- weight = "500",
12
- shadow = "none",
13
- disabled = false,
57
+ radius = "8px",
58
+ weight = "600",
59
+ iconLeft = null,
60
+ iconRight = null,
61
+ onClick,
14
62
  loading = false,
15
- icon = null,
16
- onClick
63
+ disabled = false
17
64
  }) => {
18
- const sizes = {
19
- sm: "6px 12px",
20
- md: "8px 16px",
21
- lg: "12px 20px"
65
+ const variants = {
66
+ primary: { background: bg, color, border: "none" },
67
+ secondary: { background: "#7c3aed", color, border: "none" },
68
+ outline: { background: "transparent", color, border: `2px solid ${outlineColor}` },
69
+ ghost: { background: "transparent", color: ghostColor, border: "none" }
22
70
  };
23
- return /* @__PURE__ */ React.createElement(
71
+ const { background, border } = variants[variant];
72
+ return /* @__PURE__ */ React2.createElement(
24
73
  "button",
25
74
  {
26
75
  onClick,
27
76
  disabled: disabled || loading,
28
77
  style: {
29
- background: bg,
30
- color,
31
- padding: sizes[size],
78
+ background,
79
+ color: variants[variant].color,
32
80
  width,
33
81
  border,
34
82
  borderRadius: radius,
35
83
  cursor: disabled ? "not-allowed" : "pointer",
36
84
  fontWeight: weight,
37
- boxShadow: shadow,
85
+ padding: "10px 20px",
38
86
  opacity: disabled ? 0.6 : 1,
39
- display: "flex",
40
- alignItems: "center",
41
- gap: "6px",
42
- justifyContent: "center"
43
- }
44
- },
45
- loading ? "Loading..." : /* @__PURE__ */ React.createElement(React.Fragment, null, icon, text)
46
- );
47
- };
48
-
49
- // src/components/Card/Card.jsx
50
- import React2 from "react";
51
- var Card = ({
52
- title = "Card Title",
53
- text = "Card description",
54
- width = "250px",
55
- bg = "white",
56
- border = "1px solid #eee",
57
- radius = "8px",
58
- padding = "16px",
59
- shadow = "0 2px 6px rgba(0,0,0,0.05)",
60
- titleSize = "18px",
61
- textSize = "14px",
62
- align = "left",
63
- children
64
- }) => {
65
- return /* @__PURE__ */ React2.createElement(
66
- "div",
67
- {
68
- style: {
69
- width,
70
- background: bg,
71
- border,
72
- borderRadius: radius,
73
- padding,
74
- boxShadow: shadow,
75
- textAlign: align
76
- }
77
- },
78
- /* @__PURE__ */ React2.createElement("h3", { style: { fontSize: titleSize, marginBottom: "8px" } }, title),
79
- /* @__PURE__ */ React2.createElement("p", { style: { fontSize: textSize, marginBottom: "10px" } }, text),
80
- children
81
- );
82
- };
83
-
84
- // src/components/Input/Input.jsx
85
- import React3 from "react";
86
- var Input = ({
87
- placeholder = "Enter text",
88
- type = "text",
89
- width = "200px",
90
- bg = "white",
91
- color = "#111",
92
- border = "1px solid #ccc",
93
- radius = "6px",
94
- shadow = "none",
95
- size = "md",
96
- disabled = false,
97
- value,
98
- onChange
99
- }) => {
100
- const sizes = {
101
- sm: "6px",
102
- md: "8px",
103
- lg: "12px"
104
- };
105
- return /* @__PURE__ */ React3.createElement(
106
- "input",
107
- {
108
- type,
109
- placeholder,
110
- value,
111
- onChange,
112
- disabled,
113
- style: {
114
- width,
115
- padding: sizes[size],
116
- background: bg,
117
- color,
118
- border,
119
- borderRadius: radius,
120
- boxShadow: shadow,
121
- outline: "none",
122
- opacity: disabled ? 0.6 : 1
123
- }
124
- }
125
- );
126
- };
127
-
128
- // src/components/Badge/Badge.jsx
129
- import React4 from "react";
130
- var Badge = ({
131
- text = "NEW",
132
- color = "#ffffff",
133
- bgColor = "#2563eb",
134
- radius = "12px"
135
- }) => {
136
- return /* @__PURE__ */ React4.createElement("div", { style: {
137
- background: bgColor,
138
- color,
139
- borderRadius: radius,
140
- padding: "8px 12px",
141
- fontSize: "14px",
142
- fontWeight: "600",
143
- display: "inline-block",
144
- boxShadow: "0 4px 10px rgba(0,0,0,0.2)",
145
- fontFamily: "system-ui, sans-serif"
146
- } }, text);
147
- };
148
-
149
- // src/components/Alert/Alert.jsx
150
- import React5 from "react";
151
- var Alert = ({
152
- text = "Alert message",
153
- bg = "#facc15",
154
- color = "#111",
155
- radius = "6px",
156
- padding = "10px",
157
- width = "auto"
158
- }) => {
159
- return /* @__PURE__ */ React5.createElement(
160
- "div",
161
- {
162
- style: {
163
- background: bg,
164
- color,
165
- padding,
166
- borderRadius: radius,
167
- width
168
- }
169
- },
170
- text
171
- );
172
- };
173
-
174
- // src/components/Avatar/Avatar.jsx
175
- import React6 from "react";
176
- var Avatar = ({
177
- src = "\u{1F464}",
178
- size = "40px",
179
- radius = "50%"
180
- }) => {
181
- return /* @__PURE__ */ React6.createElement(
182
- "img",
183
- {
184
- src,
185
- alt: "avatar",
186
- style: {
187
- width: size,
188
- height: size,
189
- borderRadius: radius,
190
- objectFit: "cover"
191
- }
192
- }
193
- );
194
- };
195
-
196
- // src/components/Spinner/Spinner.jsx
197
- import React7 from "react";
198
- var Spinner = ({
199
- size = "30px",
200
- color = "#2563eb",
201
- border = "3px"
202
- }) => {
203
- return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement("style", null, `
204
- @keyframes vui-spin {
205
- to {
206
- transform: rotate(360deg);
207
- }
208
- }
209
- `), /* @__PURE__ */ React7.createElement(
210
- "div",
211
- {
212
- style: {
213
- width: size,
214
- height: size,
215
- border: `${border} solid #eee`,
216
- borderTop: `${border} solid ${color}`,
217
- borderRadius: "50%",
218
- animation: "vui-spin 1s linear infinite"
219
- }
220
- }
221
- ));
222
- };
223
-
224
- // src/components/Modal/Modal.jsx
225
- import React8 from "react";
226
- var Modal = ({
227
- open = false,
228
- title = "Modal Title",
229
- children,
230
- width = "300px",
231
- bg = "white",
232
- radius = "8px",
233
- onClose
234
- }) => {
235
- if (!open) return null;
236
- return /* @__PURE__ */ React8.createElement(
237
- "div",
238
- {
239
- style: {
240
- position: "fixed",
241
- top: 0,
242
- left: 0,
243
- width: "100%",
244
- height: "100%",
245
- background: "rgba(0,0,0,0.3)",
246
- display: "flex",
247
- alignItems: "center",
248
- justifyContent: "center"
249
- }
250
- },
251
- /* @__PURE__ */ React8.createElement(
252
- "div",
253
- {
254
- style: {
255
- width,
256
- background: bg,
257
- borderRadius: radius,
258
- padding: "20px"
259
- }
87
+ transition: "transform 0.2s ease, background 0.2s ease"
260
88
  },
261
- /* @__PURE__ */ React8.createElement("h3", null, title),
262
- children,
263
- /* @__PURE__ */ React8.createElement("button", { onClick: onClose }, "Close")
264
- )
265
- );
266
- };
267
-
268
- // src/components/ProgressBar/ProgressBar.jsx
269
- import React9 from "react";
270
- var ProgressBar = ({
271
- progress = 50,
272
- height = "20px",
273
- bgColor = "#2563eb",
274
- trackColor = "#d1d5db",
275
- radius = "10px",
276
- label = "Progress",
277
- textColor = "#ffffff"
278
- }) => {
279
- return /* @__PURE__ */ React9.createElement("div", { style: { width: "100%", background: trackColor, borderRadius: radius, overflow: "hidden" } }, /* @__PURE__ */ React9.createElement("div", { style: {
280
- width: progress + "%",
281
- height,
282
- background: bgColor,
283
- borderRadius: radius,
284
- display: "flex",
285
- alignItems: "center",
286
- justifyContent: "center",
287
- position: "relative"
288
- } }, /* @__PURE__ */ React9.createElement("span", { style: { color: textColor, fontWeight: "600", fontSize: "14px" } }, label, ": ", progress, "%")));
289
- };
290
-
291
- // src/components/AnimatedButton/AnimatedButton.jsx
292
- import React10 from "react";
293
- var AnimatedButton = ({
294
- text = "Click Me",
295
- gradient = "linear-gradient(45deg, #2563eb, #7c3aed)",
296
- color = "white",
297
- size = "md",
298
- width = "auto",
299
- radius = "12px",
300
- shadow = "0 4px 14px rgba(0, 0, 0, 0.2)",
301
- loading = false,
302
- onClick
303
- }) => {
304
- const sizes = { sm: "8px 16px", md: "12px 24px", lg: "16px 32px" };
305
- const handleMouseEnter = (e) => {
306
- e.target.style.transform = "scale(1.05)";
307
- };
308
- const handleMouseLeave = (e) => {
309
- e.target.style.transform = "scale(1)";
310
- };
311
- return /* @__PURE__ */ React10.createElement(
312
- "button",
313
- {
314
- onClick,
315
- onMouseEnter: handleMouseEnter,
316
- onMouseLeave: handleMouseLeave,
317
- disabled: loading,
318
- style: {
319
- background: gradient,
320
- color,
321
- padding: sizes[size],
322
- width,
323
- border: "none",
324
- borderRadius: radius,
325
- boxShadow: shadow,
326
- cursor: loading ? "not-allowed" : "pointer",
327
- fontWeight: "600",
328
- fontSize: "15px",
329
- transition: "transform 0.3s, box-shadow 0.3s",
330
- fontFamily: "system-ui, sans-serif",
331
- opacity: loading ? 0.6 : 1,
332
- display: "flex",
333
- alignItems: "center",
334
- justifyContent: "center",
335
- gap: "8px"
336
- }
337
- },
338
- loading ? "Loading..." : text
339
- );
340
- };
341
-
342
- // src/components/CopyButton/CopyButton.jsx
343
- import React11, { useState } from "react";
344
- var CopyButton = ({
345
- text = "Copy",
346
- copyText = "Hello, World!",
347
- successMessage = "Copied!",
348
- bg = "#059669",
349
- successBg = "#7c3aed",
350
- color = "white",
351
- radius = "12px",
352
- padding = "10px 20px",
353
- onCopy
354
- }) => {
355
- const [copied, setCopied] = useState(false);
356
- const handleCopy = () => {
357
- navigator.clipboard.writeText(copyText);
358
- setCopied(true);
359
- if (onCopy) onCopy();
360
- setTimeout(() => setCopied(false), 2e3);
361
- };
362
- return /* @__PURE__ */ React11.createElement(
363
- "button",
364
- {
365
- onClick: handleCopy,
366
- style: {
367
- background: copied ? successBg : bg,
368
- color,
369
- border: "none",
370
- borderRadius: radius,
371
- padding,
372
- cursor: "pointer",
373
- fontWeight: "600",
374
- fontSize: "16px",
375
- transition: "background 0.3s ease",
376
- display: "flex",
377
- alignItems: "center",
378
- justifyContent: "center",
379
- filter: copied ? "brightness(0.9)" : "none"
380
- }
89
+ onMouseEnter: (e) => e.currentTarget.style.transform = "scale(1.05)",
90
+ onMouseLeave: (e) => e.currentTarget.style.transform = "scale(1)",
91
+ onMouseDown: (e) => e.currentTarget.style.transform = "scale(0.95)",
92
+ onMouseUp: (e) => e.currentTarget.style.transform = "scale(1)"
381
93
  },
382
- copied ? successMessage : text
94
+ loading ? "Loading..." : /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(React2.Fragment, null, iconLeft, text, iconRight))
383
95
  );
384
96
  };
385
97
  export {
386
- Alert,
387
- AnimatedButton,
388
- Avatar,
389
- Badge,
390
- Button,
391
- Card,
392
- CopyButton,
393
- Input,
394
- Modal,
395
- ProgressBar,
396
- Spinner
98
+ AlertBanner,
99
+ Button
397
100
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "virtual-ui-lib",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "Virtual UI React Component Library",
5
5
  "author": "Ankush",
6
6
  "license": "ISC",