virtual-ui-lib 1.0.11 → 1.0.12
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 +46 -0
- package/dist/index.mjs +45 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -35,6 +35,7 @@ __export(index_exports, {
|
|
|
35
35
|
Badge: () => Badge,
|
|
36
36
|
Button: () => Button,
|
|
37
37
|
Card: () => Card,
|
|
38
|
+
CopyButton: () => CopyButton,
|
|
38
39
|
Input: () => Input,
|
|
39
40
|
Modal: () => Modal,
|
|
40
41
|
ProgressBar: () => ProgressBar,
|
|
@@ -382,6 +383,50 @@ var AnimatedButton = ({
|
|
|
382
383
|
loading ? "Loading..." : text
|
|
383
384
|
);
|
|
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
|
+
}
|
|
426
|
+
},
|
|
427
|
+
copied ? successMessage : text
|
|
428
|
+
);
|
|
429
|
+
};
|
|
385
430
|
// Annotate the CommonJS export names for ESM import in node:
|
|
386
431
|
0 && (module.exports = {
|
|
387
432
|
Alert,
|
|
@@ -390,6 +435,7 @@ var AnimatedButton = ({
|
|
|
390
435
|
Badge,
|
|
391
436
|
Button,
|
|
392
437
|
Card,
|
|
438
|
+
CopyButton,
|
|
393
439
|
Input,
|
|
394
440
|
Modal,
|
|
395
441
|
ProgressBar,
|
package/dist/index.mjs
CHANGED
|
@@ -338,6 +338,50 @@ var AnimatedButton = ({
|
|
|
338
338
|
loading ? "Loading..." : text
|
|
339
339
|
);
|
|
340
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
|
+
}
|
|
381
|
+
},
|
|
382
|
+
copied ? successMessage : text
|
|
383
|
+
);
|
|
384
|
+
};
|
|
341
385
|
export {
|
|
342
386
|
Alert,
|
|
343
387
|
AnimatedButton,
|
|
@@ -345,6 +389,7 @@ export {
|
|
|
345
389
|
Badge,
|
|
346
390
|
Button,
|
|
347
391
|
Card,
|
|
392
|
+
CopyButton,
|
|
348
393
|
Input,
|
|
349
394
|
Modal,
|
|
350
395
|
ProgressBar,
|