@scaleflex/ui-tw 0.0.154 → 0.0.155
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/package.json +2 -2
- package/utils/copy-to-clipboard.js +23 -22
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scaleflex/ui-tw",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.155",
|
|
4
4
|
"author": "scaleflex",
|
|
5
5
|
"repository": "github:scaleflex/ui",
|
|
6
6
|
"homepage": "https://github.com/scaleflex/ui/blob/master/README.md",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@radix-ui/react-switch": "^1.0.1",
|
|
30
30
|
"@radix-ui/react-tabs": "^1.1.13",
|
|
31
31
|
"@radix-ui/react-tooltip": "^1.2.6",
|
|
32
|
-
"@scaleflex/icons-tw": "^0.0.
|
|
32
|
+
"@scaleflex/icons-tw": "^0.0.155",
|
|
33
33
|
"@tanstack/react-table": "^8.21.3",
|
|
34
34
|
"@types/lodash.merge": "^4.6.9",
|
|
35
35
|
"class-variance-authority": "^0.7.1",
|
|
@@ -14,52 +14,53 @@ export function copyToClipboard(_x) {
|
|
|
14
14
|
}
|
|
15
15
|
function _copyToClipboard() {
|
|
16
16
|
_copyToClipboard = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(text) {
|
|
17
|
-
var _navigator$clipboard;
|
|
18
|
-
var textarea;
|
|
17
|
+
var _self, _navigator$clipboard;
|
|
18
|
+
var isSecureContext, textarea;
|
|
19
19
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
20
20
|
while (1) switch (_context.prev = _context.next) {
|
|
21
21
|
case 0:
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
isSecureContext = typeof window !== 'undefined' ? window.isSecureContext : !!((_self = self) !== null && _self !== void 0 && _self.isSecureContext);
|
|
23
|
+
if (!(isSecureContext && typeof navigator !== 'undefined' && (_navigator$clipboard = navigator.clipboard) !== null && _navigator$clipboard !== void 0 && _navigator$clipboard.writeText)) {
|
|
24
|
+
_context.next = 10;
|
|
24
25
|
break;
|
|
25
26
|
}
|
|
26
|
-
_context.prev =
|
|
27
|
-
_context.next =
|
|
27
|
+
_context.prev = 2;
|
|
28
|
+
_context.next = 5;
|
|
28
29
|
return navigator.clipboard.writeText(text);
|
|
29
|
-
case
|
|
30
|
+
case 5:
|
|
30
31
|
return _context.abrupt("return", true);
|
|
31
|
-
case
|
|
32
|
-
_context.prev =
|
|
33
|
-
_context.t0 = _context["catch"](
|
|
34
|
-
case
|
|
32
|
+
case 8:
|
|
33
|
+
_context.prev = 8;
|
|
34
|
+
_context.t0 = _context["catch"](2);
|
|
35
|
+
case 10:
|
|
35
36
|
if (!(typeof document === 'undefined')) {
|
|
36
|
-
_context.next =
|
|
37
|
+
_context.next = 12;
|
|
37
38
|
break;
|
|
38
39
|
}
|
|
39
40
|
return _context.abrupt("return", false);
|
|
40
|
-
case
|
|
41
|
+
case 12:
|
|
41
42
|
// Fallback for iframes, HTTP contexts, older browsers
|
|
42
43
|
textarea = document.createElement('textarea');
|
|
43
44
|
textarea.value = text;
|
|
44
45
|
textarea.style.cssText = 'position:fixed;top:0;left:0;opacity:0;pointer-events:none';
|
|
45
46
|
document.body.appendChild(textarea);
|
|
46
|
-
_context.prev =
|
|
47
|
+
_context.prev = 16;
|
|
47
48
|
textarea.focus();
|
|
48
49
|
textarea.select();
|
|
49
50
|
return _context.abrupt("return", document.execCommand('copy'));
|
|
50
|
-
case
|
|
51
|
-
_context.prev =
|
|
52
|
-
_context.t1 = _context["catch"](
|
|
51
|
+
case 22:
|
|
52
|
+
_context.prev = 22;
|
|
53
|
+
_context.t1 = _context["catch"](16);
|
|
53
54
|
return _context.abrupt("return", false);
|
|
54
|
-
case
|
|
55
|
-
_context.prev =
|
|
55
|
+
case 25:
|
|
56
|
+
_context.prev = 25;
|
|
56
57
|
document.body.removeChild(textarea);
|
|
57
|
-
return _context.finish(
|
|
58
|
-
case
|
|
58
|
+
return _context.finish(25);
|
|
59
|
+
case 28:
|
|
59
60
|
case "end":
|
|
60
61
|
return _context.stop();
|
|
61
62
|
}
|
|
62
|
-
}, _callee, null, [[
|
|
63
|
+
}, _callee, null, [[2, 8], [16, 22, 25, 28]]);
|
|
63
64
|
}));
|
|
64
65
|
return _copyToClipboard.apply(this, arguments);
|
|
65
66
|
}
|