@bigbinary/neeto-molecules 1.0.99 → 1.0.101
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/README.md +1 -0
- package/dist/Codeblock.cjs.js +302 -0
- package/dist/Codeblock.cjs.js.map +1 -0
- package/dist/Codeblock.js +296 -0
- package/dist/Codeblock.js.map +1 -0
- package/dist/CustomDomain.cjs.js +4 -0
- package/dist/CustomDomain.cjs.js.map +1 -1
- package/dist/CustomDomain.js +4 -0
- package/dist/CustomDomain.js.map +1 -1
- package/dist/CustomDomainDashboard.cjs.js +11 -5
- package/dist/CustomDomainDashboard.cjs.js.map +1 -1
- package/dist/CustomDomainDashboard.js +11 -5
- package/dist/CustomDomainDashboard.js.map +1 -1
- package/dist/Header.cjs.js +4 -1
- package/dist/Header.cjs.js.map +1 -1
- package/dist/Header.js +4 -1
- package/dist/Header.js.map +1 -1
- package/dist/MenuBar.cjs.js +19446 -16229
- package/dist/MenuBar.cjs.js.map +1 -1
- package/dist/MenuBar.js +19446 -16229
- package/dist/MenuBar.js.map +1 -1
- package/dist/Sidebar.cjs.js +19478 -16243
- package/dist/Sidebar.cjs.js.map +1 -1
- package/dist/Sidebar.js +19478 -16243
- package/dist/Sidebar.js.map +1 -1
- package/package.json +16 -13
- package/types/Codeblock.d.ts +36 -0
- package/types/CopyToClipboardButton.d.ts +8 -7
package/README.md
CHANGED
|
@@ -49,6 +49,7 @@ https://neeto-molecules.neeto.com/
|
|
|
49
49
|
- [ImageWIthFallback](./docs/components.md#ImageWIthFallback)
|
|
50
50
|
- [ToggleFeatureCard](./docs/components.md#ToggleFeatureCard)
|
|
51
51
|
- [Settings](./docs/components.md#Settings)
|
|
52
|
+
- [Codeblock](./docs/components.md#Codeblock)
|
|
52
53
|
|
|
53
54
|
## Installation Instructions
|
|
54
55
|
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var reactSyntaxHighlighter = require('react-syntax-highlighter');
|
|
5
|
+
var prism = require('react-syntax-highlighter/dist/esm/styles/prism');
|
|
6
|
+
var utils = require('@bigbinary/neeto-commons-frontend/utils');
|
|
7
|
+
var neetoIcons = require('@bigbinary/neeto-icons');
|
|
8
|
+
var neetoui = require('@bigbinary/neetoui');
|
|
9
|
+
|
|
10
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
|
+
|
|
12
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
13
|
+
|
|
14
|
+
function _extends() {
|
|
15
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
16
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
17
|
+
var source = arguments[i];
|
|
18
|
+
for (var key in source) {
|
|
19
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
20
|
+
target[key] = source[key];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return target;
|
|
25
|
+
};
|
|
26
|
+
return _extends.apply(this, arguments);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function _typeof(obj) {
|
|
30
|
+
"@babel/helpers - typeof";
|
|
31
|
+
|
|
32
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
33
|
+
return typeof obj;
|
|
34
|
+
} : function (obj) {
|
|
35
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
36
|
+
}, _typeof(obj);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function _toPrimitive(input, hint) {
|
|
40
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
41
|
+
var prim = input[Symbol.toPrimitive];
|
|
42
|
+
if (prim !== undefined) {
|
|
43
|
+
var res = prim.call(input, hint || "default");
|
|
44
|
+
if (_typeof(res) !== "object") return res;
|
|
45
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
46
|
+
}
|
|
47
|
+
return (hint === "string" ? String : Number)(input);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function _toPropertyKey(arg) {
|
|
51
|
+
var key = _toPrimitive(arg, "string");
|
|
52
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function _defineProperty(obj, key, value) {
|
|
56
|
+
key = _toPropertyKey(key);
|
|
57
|
+
if (key in obj) {
|
|
58
|
+
Object.defineProperty(obj, key, {
|
|
59
|
+
value: value,
|
|
60
|
+
enumerable: true,
|
|
61
|
+
configurable: true,
|
|
62
|
+
writable: true
|
|
63
|
+
});
|
|
64
|
+
} else {
|
|
65
|
+
obj[key] = value;
|
|
66
|
+
}
|
|
67
|
+
return obj;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function _arrayWithHoles(arr) {
|
|
71
|
+
if (Array.isArray(arr)) return arr;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function _iterableToArrayLimit(arr, i) {
|
|
75
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
76
|
+
if (null != _i) {
|
|
77
|
+
var _s,
|
|
78
|
+
_e,
|
|
79
|
+
_x,
|
|
80
|
+
_r,
|
|
81
|
+
_arr = [],
|
|
82
|
+
_n = !0,
|
|
83
|
+
_d = !1;
|
|
84
|
+
try {
|
|
85
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
86
|
+
if (Object(_i) !== _i) return;
|
|
87
|
+
_n = !1;
|
|
88
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
89
|
+
} catch (err) {
|
|
90
|
+
_d = !0, _e = err;
|
|
91
|
+
} finally {
|
|
92
|
+
try {
|
|
93
|
+
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
|
|
94
|
+
} finally {
|
|
95
|
+
if (_d) throw _e;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return _arr;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function _arrayLikeToArray(arr, len) {
|
|
103
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
104
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
105
|
+
return arr2;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
109
|
+
if (!o) return;
|
|
110
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
111
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
112
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
113
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
114
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function _nonIterableRest() {
|
|
118
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function _slicedToArray(arr, i) {
|
|
122
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
126
|
+
if (source == null) return {};
|
|
127
|
+
var target = {};
|
|
128
|
+
var sourceKeys = Object.keys(source);
|
|
129
|
+
var key, i;
|
|
130
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
131
|
+
key = sourceKeys[i];
|
|
132
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
133
|
+
target[key] = source[key];
|
|
134
|
+
}
|
|
135
|
+
return target;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function _objectWithoutProperties(source, excluded) {
|
|
139
|
+
if (source == null) return {};
|
|
140
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
141
|
+
var key, i;
|
|
142
|
+
if (Object.getOwnPropertySymbols) {
|
|
143
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
144
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
145
|
+
key = sourceSymbolKeys[i];
|
|
146
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
147
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
148
|
+
target[key] = source[key];
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return target;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
var classnames$1 = {exports: {}};
|
|
155
|
+
|
|
156
|
+
/*!
|
|
157
|
+
Copyright (c) 2018 Jed Watson.
|
|
158
|
+
Licensed under the MIT License (MIT), see
|
|
159
|
+
http://jedwatson.github.io/classnames
|
|
160
|
+
*/
|
|
161
|
+
|
|
162
|
+
(function (module) {
|
|
163
|
+
/* global define */
|
|
164
|
+
|
|
165
|
+
(function () {
|
|
166
|
+
|
|
167
|
+
var hasOwn = {}.hasOwnProperty;
|
|
168
|
+
|
|
169
|
+
function classNames() {
|
|
170
|
+
var classes = [];
|
|
171
|
+
|
|
172
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
173
|
+
var arg = arguments[i];
|
|
174
|
+
if (!arg) continue;
|
|
175
|
+
|
|
176
|
+
var argType = typeof arg;
|
|
177
|
+
|
|
178
|
+
if (argType === 'string' || argType === 'number') {
|
|
179
|
+
classes.push(arg);
|
|
180
|
+
} else if (Array.isArray(arg)) {
|
|
181
|
+
if (arg.length) {
|
|
182
|
+
var inner = classNames.apply(null, arg);
|
|
183
|
+
if (inner) {
|
|
184
|
+
classes.push(inner);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
} else if (argType === 'object') {
|
|
188
|
+
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
|
|
189
|
+
classes.push(arg.toString());
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
for (var key in arg) {
|
|
194
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
195
|
+
classes.push(key);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return classes.join(' ');
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (module.exports) {
|
|
205
|
+
classNames.default = classNames;
|
|
206
|
+
module.exports = classNames;
|
|
207
|
+
} else {
|
|
208
|
+
window.classNames = classNames;
|
|
209
|
+
}
|
|
210
|
+
}());
|
|
211
|
+
} (classnames$1));
|
|
212
|
+
|
|
213
|
+
var classnames = classnames$1.exports;
|
|
214
|
+
|
|
215
|
+
var TIME_OUT = 2000;
|
|
216
|
+
var TOOLTIP_CONFIG = {
|
|
217
|
+
content: "Copied",
|
|
218
|
+
trigger: "click",
|
|
219
|
+
hideAfter: TIME_OUT,
|
|
220
|
+
position: "top"
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
224
|
+
|
|
225
|
+
var css = ".neeto-molecules-copy-button{display:flex;justify-content:space-between}.neeto-molecules-copy-button .neeto-ui-btn:active,.neeto-molecules-copy-button .neeto-ui-btn:focus,.neeto-molecules-copy-button .neeto-ui-btn:hover{box-shadow:none}.neeto-molecules-copy-button--active{background:rgba(var(--neeto-ui-success-500));color:#fff}.neeto-molecules-copy-button--active.neeto-ui-btn:active,.neeto-molecules-copy-button--active.neeto-ui-btn:focus,.neeto-molecules-copy-button--active.neeto-ui-btn:hover{background:rgba(var(--neeto-ui-success-600));box-shadow:none;color:#fff}";
|
|
226
|
+
n(css,{});
|
|
227
|
+
|
|
228
|
+
var _excluded = ["className", "icon", "label", "value", "style"];
|
|
229
|
+
var CopyToClipboardButton = function CopyToClipboardButton(_ref) {
|
|
230
|
+
var _classnames;
|
|
231
|
+
var className = _ref.className,
|
|
232
|
+
_ref$icon = _ref.icon,
|
|
233
|
+
icon = _ref$icon === void 0 ? neetoIcons.Copy : _ref$icon,
|
|
234
|
+
_ref$label = _ref.label,
|
|
235
|
+
label = _ref$label === void 0 ? "" : _ref$label,
|
|
236
|
+
value = _ref.value,
|
|
237
|
+
style = _ref.style,
|
|
238
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
239
|
+
var _useState = React.useState(false),
|
|
240
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
241
|
+
isChecked = _useState2[0],
|
|
242
|
+
setIsChecked = _useState2[1];
|
|
243
|
+
var ref = React.useRef();
|
|
244
|
+
var onHandleClick = function onHandleClick(event) {
|
|
245
|
+
event.preventDefault();
|
|
246
|
+
utils.copyToClipboard(value, {
|
|
247
|
+
showToastr: false
|
|
248
|
+
});
|
|
249
|
+
setIsChecked(true);
|
|
250
|
+
setTimeout(function () {
|
|
251
|
+
setIsChecked(false);
|
|
252
|
+
}, TIME_OUT); // Reset copied state after 2 seconds
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
React.useEffect(function () {
|
|
256
|
+
if (ref.current) {
|
|
257
|
+
var buttonWidth = ref.current.clientWidth;
|
|
258
|
+
ref.current.style.minWidth = "".concat(buttonWidth, "px");
|
|
259
|
+
}
|
|
260
|
+
}, []);
|
|
261
|
+
var tooltipProps = label ? null : TOOLTIP_CONFIG;
|
|
262
|
+
var buttonLabel = isChecked && label ? "Copied" : label;
|
|
263
|
+
var buttonIcon = isChecked ? neetoIcons.Check : icon;
|
|
264
|
+
return /*#__PURE__*/React__default["default"].createElement(neetoui.Button, _extends({
|
|
265
|
+
ref: ref,
|
|
266
|
+
style: style,
|
|
267
|
+
tooltipProps: tooltipProps,
|
|
268
|
+
"data-testid": "copy-button",
|
|
269
|
+
icon: buttonIcon,
|
|
270
|
+
label: buttonLabel,
|
|
271
|
+
className: classnames("neeto-molecules-copy-button", (_classnames = {}, _defineProperty(_classnames, className, className), _defineProperty(_classnames, "neeto-molecules-copy-button--active", isChecked), _classnames)),
|
|
272
|
+
onClick: onHandleClick
|
|
273
|
+
}, otherProps));
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
var Codeblock = function Codeblock(_ref) {
|
|
277
|
+
var code = _ref.code,
|
|
278
|
+
_ref$showCopyButton = _ref.showCopyButton,
|
|
279
|
+
showCopyButton = _ref$showCopyButton === void 0 ? true : _ref$showCopyButton,
|
|
280
|
+
codeblockProps = _ref.codeblockProps,
|
|
281
|
+
_ref$copyButtonProps = _ref.copyButtonProps,
|
|
282
|
+
copyButtonProps = _ref$copyButtonProps === void 0 ? {
|
|
283
|
+
label: "Copy"
|
|
284
|
+
} : _ref$copyButtonProps;
|
|
285
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(reactSyntaxHighlighter.PrismLight, _extends({
|
|
286
|
+
wrapLines: true,
|
|
287
|
+
"data-cy": "code-block",
|
|
288
|
+
"data-testid": "codeblock-react-highlighter",
|
|
289
|
+
language: "javascript",
|
|
290
|
+
style: prism.dracula
|
|
291
|
+
}, codeblockProps), code), showCopyButton && /*#__PURE__*/React__default["default"].createElement(CopyToClipboardButton, _extends({
|
|
292
|
+
className: "absolute top-3 right-3",
|
|
293
|
+
"data-cy": "copy-button",
|
|
294
|
+
"data-testid": "codeblock-copy-button",
|
|
295
|
+
size: "small",
|
|
296
|
+
style: "secondary",
|
|
297
|
+
value: code
|
|
298
|
+
}, copyButtonProps)));
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
module.exports = Codeblock;
|
|
302
|
+
//# sourceMappingURL=Codeblock.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Codeblock.cjs.js","sources":["../node_modules/@babel/runtime/helpers/esm/extends.js","../node_modules/@babel/runtime/helpers/esm/typeof.js","../node_modules/@babel/runtime/helpers/esm/toPrimitive.js","../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","../node_modules/@babel/runtime/helpers/esm/defineProperty.js","../node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js","../node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js","../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js","../node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js","../node_modules/@babel/runtime/helpers/esm/nonIterableRest.js","../node_modules/@babel/runtime/helpers/esm/slicedToArray.js","../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","../node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js","../node_modules/classnames/index.js","../src/components/CopyToClipboardButton/constants.js","../node_modules/rollup-plugin-styles/dist/runtime/inject-css.js","../src/components/CopyToClipboardButton/index.jsx","../src/components/Codeblock.jsx"],"sourcesContent":["export default function _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, _typeof(obj);\n}","import _typeof from \"./typeof.js\";\nexport default function _toPrimitive(input, hint) {\n if (_typeof(input) !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (_typeof(res) !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n}","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nexport default function _toPropertyKey(arg) {\n var key = toPrimitive(arg, \"string\");\n return _typeof(key) === \"symbol\" ? key : String(key);\n}","import toPropertyKey from \"./toPropertyKey.js\";\nexport default function _defineProperty(obj, key, value) {\n key = toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}","export default function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}","export default function _iterableToArrayLimit(arr, i) {\n var _i = null == arr ? null : \"undefined\" != typeof Symbol && arr[Symbol.iterator] || arr[\"@@iterator\"];\n if (null != _i) {\n var _s,\n _e,\n _x,\n _r,\n _arr = [],\n _n = !0,\n _d = !1;\n try {\n if (_x = (_i = _i.call(arr)).next, 0 === i) {\n if (Object(_i) !== _i) return;\n _n = !1;\n } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);\n } catch (err) {\n _d = !0, _e = err;\n } finally {\n try {\n if (!_n && null != _i[\"return\"] && (_r = _i[\"return\"](), Object(_r) !== _r)) return;\n } finally {\n if (_d) throw _e;\n }\n }\n return _arr;\n }\n}","export default function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n return arr2;\n}","import arrayLikeToArray from \"./arrayLikeToArray.js\";\nexport default function _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}","export default function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","import arrayWithHoles from \"./arrayWithHoles.js\";\nimport iterableToArrayLimit from \"./iterableToArrayLimit.js\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray.js\";\nimport nonIterableRest from \"./nonIterableRest.js\";\nexport default function _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}","export default function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n return target;\n}","import objectWithoutPropertiesLoose from \"./objectWithoutPropertiesLoose.js\";\nexport default function _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n return target;\n}","/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\tvar nativeCodeString = '[native code]';\n\n\tfunction classNames() {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg)) {\n\t\t\t\tif (arg.length) {\n\t\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\t\tif (inner) {\n\t\t\t\t\t\tclasses.push(inner);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\t\t\tclasses.push(arg.toString());\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","const TIME_OUT = 2000;\n\nconst TOOLTIP_CONFIG = {\n content: \"Copied\",\n trigger: \"click\",\n hideAfter: TIME_OUT,\n position: \"top\",\n};\n\nconst BUTTON_STYLES = {\n primary: \"primary\",\n secondary: \"secondary\",\n text: \"text\",\n};\n\nexport { TOOLTIP_CONFIG, TIME_OUT, BUTTON_STYLES };\n","var e=[],t=[];function n(n,r){if(n&&\"undefined\"!=typeof document){var a,s=!0===r.prepend?\"prepend\":\"append\",d=!0===r.singleTag,i=\"string\"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName(\"head\")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c()}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n))}function c(){var e=document.createElement(\"style\");if(e.setAttribute(\"type\",\"text/css\"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a=\"prepend\"===s?\"afterbegin\":\"beforeend\";return i.insertAdjacentElement(a,e),e}}export{n as default};\n","import React, { useState, useEffect, useRef } from \"react\";\n\nimport classnames from \"classnames\";\nimport { copyToClipboard } from \"neetocommons/utils\";\nimport { Copy, Check } from \"neetoicons\";\nimport { Button } from \"neetoui\";\nimport PropTypes from \"prop-types\";\n\nimport { TOOLTIP_CONFIG, TIME_OUT, BUTTON_STYLES } from \"./constants\";\nimport \"./copyToClipboard.scss\";\n\nconst CopyToClipboardButton = ({\n className,\n icon = Copy,\n label = \"\",\n value,\n style,\n ...otherProps\n}) => {\n const [isChecked, setIsChecked] = useState(false);\n const ref = useRef();\n\n const onHandleClick = event => {\n event.preventDefault();\n copyToClipboard(value, { showToastr: false });\n setIsChecked(true);\n setTimeout(() => {\n setIsChecked(false);\n }, TIME_OUT); // Reset copied state after 2 seconds\n };\n\n useEffect(() => {\n if (ref.current) {\n const buttonWidth = ref.current.clientWidth;\n ref.current.style.minWidth = `${buttonWidth}px`;\n }\n }, []);\n\n const tooltipProps = label ? null : TOOLTIP_CONFIG;\n const buttonLabel = isChecked && label ? \"Copied\" : label;\n const buttonIcon = isChecked ? Check : icon;\n\n return (\n <Button\n {...{ ref, style, tooltipProps }}\n data-testid=\"copy-button\"\n icon={buttonIcon}\n label={buttonLabel}\n className={classnames(\"neeto-molecules-copy-button\", {\n [className]: className,\n \"neeto-molecules-copy-button--active\": isChecked,\n })}\n onClick={onHandleClick}\n {...otherProps}\n />\n );\n};\n\nCopyToClipboardButton.propTypes = {\n /**\n * To provide additional classnames to the button.\n */\n className: PropTypes.string,\n /**\n * To provide the icon to be passed to the button. Defaults to the Copy icon.\n */\n icon: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n /**\n * To provide the label to the button. By default there is no label.\n */\n label: PropTypes.string,\n /**\n * The value to be copied to clipboard. (required)\n */\n value: PropTypes.string,\n /**\n * To specify the style of the Button.\n */\n style: PropTypes.oneOf(Object.values(BUTTON_STYLES)),\n};\n\nexport default CopyToClipboardButton;\n","import React from \"react\";\n\nimport PropTypes from \"prop-types\";\nimport { PrismLight as CodeBlock } from \"react-syntax-highlighter\";\nimport { dracula } from \"react-syntax-highlighter/dist/esm/styles/prism\";\n\nimport CopyCode from \"components/CopyToClipboardButton\";\n\nconst Codeblock = ({\n code,\n showCopyButton = true,\n codeblockProps,\n copyButtonProps = { label: \"Copy\" },\n}) => (\n <>\n <CodeBlock\n wrapLines\n data-cy=\"code-block\"\n data-testid=\"codeblock-react-highlighter\"\n language=\"javascript\"\n style={dracula}\n {...codeblockProps}\n >\n {code}\n </CodeBlock>\n {showCopyButton && (\n <CopyCode\n className=\"absolute top-3 right-3\"\n data-cy=\"copy-button\"\n data-testid=\"codeblock-copy-button\"\n size=\"small\"\n style=\"secondary\"\n value={code}\n {...copyButtonProps}\n />\n )}\n </>\n);\n\nCodeblock.propTypes = {\n /**\n * The code to be displayed.\n */\n code: PropTypes.string,\n /**\n * Flag to determine whether the 'Copy' button is displayed.\n */\n showCopyButton: PropTypes.bool,\n /**\n * Additional props that can be passed on to the 'PrismLight' component from 'react-syntax-highlighter'.\n */\n codeblockProps: PropTypes.object,\n /**\n * Additional props that can be passed on to the 'CopyToClipboardButton' component from 'neeto-molecules'.\n */\n copyButtonProps: PropTypes.object,\n};\n\nexport default Codeblock;\n"],"names":["toPrimitive","toPropertyKey","arrayLikeToArray","arrayWithHoles","iterableToArrayLimit","unsupportedIterableToArray","nonIterableRest","objectWithoutPropertiesLoose","TIME_OUT","TOOLTIP_CONFIG","content","trigger","hideAfter","position","CopyToClipboardButton","_ref","_classnames","className","_ref$icon","icon","Copy","_ref$label","label","value","style","otherProps","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","isChecked","setIsChecked","ref","useRef","onHandleClick","event","preventDefault","copyToClipboard","showToastr","setTimeout","useEffect","current","buttonWidth","clientWidth","minWidth","concat","tooltipProps","buttonLabel","buttonIcon","Check","React","createElement","Button","_extends","classnames","_defineProperty","onClick","Codeblock","code","_ref$showCopyButton","showCopyButton","codeblockProps","_ref$copyButtonProps","copyButtonProps","Fragment","CodeBlock","wrapLines","language","dracula","CopyCode","size"],"mappings":";;;;;;;;;;;;;AAAe,SAAS,QAAQ,GAAG;AACnC,EAAE,QAAQ,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,UAAU,MAAM,EAAE;AACtE,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAC/C,MAAM,IAAI,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAChC,MAAM,KAAK,IAAI,GAAG,IAAI,MAAM,EAAE;AAC9B,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE;AAC/D,UAAU,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;AACpC,SAAS;AACT,OAAO;AACP,KAAK;AACL,IAAI,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A,CAAA5C,IAAA,EAAA;AAAA,EAAA,IACb6C,IAAI,GAAA7C,IAAA,CAAJ6C,IAAI;IAAAC,mBAAA,GAAA9C,IAAA,CACJ+C,cAAc;AAAdA,IAAAA,cAAc,GAAAD,mBAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,mBAAA;IACrBE,cAAc,GAAAhD,IAAA,CAAdgD,cAAc;IAAAC,oBAAA,GAAAjD,IAAA,CACdkD,eAAe;IAAfA,eAAe,GAAAD,oBAAA,KAAG,KAAA,CAAA,GAAA;AAAE1C,MAAAA,KAAK,EAAE,MAAA;AAAO,KAAC,GAAA0C,oBAAA,CAAA;AAAA,EAAA,oBAEnCZ,yBAAA,CAAAC,aAAA,CAAAD,yBAAA,CAAAc,QAAA,EACEd,IAAAA,eAAAA,yBAAA,CAAAC,aAAA,CAACc,iCAAS,EAAAZ,QAAA,CAAA;IACRa,SAAS,EAAA,IAAA;AACT,IAAA,SAAA,EAAQ,YAAY;AACpB,IAAA,aAAA,EAAY,6BAA6B;AACzCC,IAAAA,QAAQ,EAAC,YAAY;AACrB7C,IAAAA,KAAK,EAAE8C,aAAAA;AAAQ,GAAA,EACXP,cAAc,CAAA,EAEjBH,IAAI,CACK,EACXE,cAAc,iBACbV,yBAAA,CAAAC,aAAA,CAACkB,qBAAQ,EAAAhB,QAAA,CAAA;AACPtC,IAAAA,SAAS,EAAC,wBAAwB;AAClC,IAAA,SAAA,EAAQ,aAAa;AACrB,IAAA,aAAA,EAAY,uBAAuB;AACnCuD,IAAAA,IAAI,EAAC,OAAO;AACZhD,IAAAA,KAAK,EAAC,WAAW;AACjBD,IAAAA,KAAK,EAAEqC,IAAAA;GACHK,EAAAA,eAAe,EAEtB,CACA,CAAA;AAAA;;;;"}
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
2
|
+
import { PrismLight } from 'react-syntax-highlighter';
|
|
3
|
+
import { dracula } from 'react-syntax-highlighter/dist/esm/styles/prism';
|
|
4
|
+
import { copyToClipboard } from '@bigbinary/neeto-commons-frontend/utils';
|
|
5
|
+
import { Check, Copy } from '@bigbinary/neeto-icons';
|
|
6
|
+
import { Button } from '@bigbinary/neetoui';
|
|
7
|
+
|
|
8
|
+
function _extends() {
|
|
9
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
10
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
11
|
+
var source = arguments[i];
|
|
12
|
+
for (var key in source) {
|
|
13
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
14
|
+
target[key] = source[key];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
return _extends.apply(this, arguments);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function _typeof(obj) {
|
|
24
|
+
"@babel/helpers - typeof";
|
|
25
|
+
|
|
26
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
27
|
+
return typeof obj;
|
|
28
|
+
} : function (obj) {
|
|
29
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
30
|
+
}, _typeof(obj);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function _toPrimitive(input, hint) {
|
|
34
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
35
|
+
var prim = input[Symbol.toPrimitive];
|
|
36
|
+
if (prim !== undefined) {
|
|
37
|
+
var res = prim.call(input, hint || "default");
|
|
38
|
+
if (_typeof(res) !== "object") return res;
|
|
39
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
40
|
+
}
|
|
41
|
+
return (hint === "string" ? String : Number)(input);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function _toPropertyKey(arg) {
|
|
45
|
+
var key = _toPrimitive(arg, "string");
|
|
46
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function _defineProperty(obj, key, value) {
|
|
50
|
+
key = _toPropertyKey(key);
|
|
51
|
+
if (key in obj) {
|
|
52
|
+
Object.defineProperty(obj, key, {
|
|
53
|
+
value: value,
|
|
54
|
+
enumerable: true,
|
|
55
|
+
configurable: true,
|
|
56
|
+
writable: true
|
|
57
|
+
});
|
|
58
|
+
} else {
|
|
59
|
+
obj[key] = value;
|
|
60
|
+
}
|
|
61
|
+
return obj;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function _arrayWithHoles(arr) {
|
|
65
|
+
if (Array.isArray(arr)) return arr;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function _iterableToArrayLimit(arr, i) {
|
|
69
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
70
|
+
if (null != _i) {
|
|
71
|
+
var _s,
|
|
72
|
+
_e,
|
|
73
|
+
_x,
|
|
74
|
+
_r,
|
|
75
|
+
_arr = [],
|
|
76
|
+
_n = !0,
|
|
77
|
+
_d = !1;
|
|
78
|
+
try {
|
|
79
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
80
|
+
if (Object(_i) !== _i) return;
|
|
81
|
+
_n = !1;
|
|
82
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
83
|
+
} catch (err) {
|
|
84
|
+
_d = !0, _e = err;
|
|
85
|
+
} finally {
|
|
86
|
+
try {
|
|
87
|
+
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
|
|
88
|
+
} finally {
|
|
89
|
+
if (_d) throw _e;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return _arr;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function _arrayLikeToArray(arr, len) {
|
|
97
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
98
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
99
|
+
return arr2;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
103
|
+
if (!o) return;
|
|
104
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
105
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
106
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
107
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
108
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function _nonIterableRest() {
|
|
112
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function _slicedToArray(arr, i) {
|
|
116
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
120
|
+
if (source == null) return {};
|
|
121
|
+
var target = {};
|
|
122
|
+
var sourceKeys = Object.keys(source);
|
|
123
|
+
var key, i;
|
|
124
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
125
|
+
key = sourceKeys[i];
|
|
126
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
127
|
+
target[key] = source[key];
|
|
128
|
+
}
|
|
129
|
+
return target;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function _objectWithoutProperties(source, excluded) {
|
|
133
|
+
if (source == null) return {};
|
|
134
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
135
|
+
var key, i;
|
|
136
|
+
if (Object.getOwnPropertySymbols) {
|
|
137
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
138
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
139
|
+
key = sourceSymbolKeys[i];
|
|
140
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
141
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
142
|
+
target[key] = source[key];
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return target;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
var classnames$1 = {exports: {}};
|
|
149
|
+
|
|
150
|
+
/*!
|
|
151
|
+
Copyright (c) 2018 Jed Watson.
|
|
152
|
+
Licensed under the MIT License (MIT), see
|
|
153
|
+
http://jedwatson.github.io/classnames
|
|
154
|
+
*/
|
|
155
|
+
|
|
156
|
+
(function (module) {
|
|
157
|
+
/* global define */
|
|
158
|
+
|
|
159
|
+
(function () {
|
|
160
|
+
|
|
161
|
+
var hasOwn = {}.hasOwnProperty;
|
|
162
|
+
|
|
163
|
+
function classNames() {
|
|
164
|
+
var classes = [];
|
|
165
|
+
|
|
166
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
167
|
+
var arg = arguments[i];
|
|
168
|
+
if (!arg) continue;
|
|
169
|
+
|
|
170
|
+
var argType = typeof arg;
|
|
171
|
+
|
|
172
|
+
if (argType === 'string' || argType === 'number') {
|
|
173
|
+
classes.push(arg);
|
|
174
|
+
} else if (Array.isArray(arg)) {
|
|
175
|
+
if (arg.length) {
|
|
176
|
+
var inner = classNames.apply(null, arg);
|
|
177
|
+
if (inner) {
|
|
178
|
+
classes.push(inner);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
} else if (argType === 'object') {
|
|
182
|
+
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
|
|
183
|
+
classes.push(arg.toString());
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
for (var key in arg) {
|
|
188
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
189
|
+
classes.push(key);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return classes.join(' ');
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (module.exports) {
|
|
199
|
+
classNames.default = classNames;
|
|
200
|
+
module.exports = classNames;
|
|
201
|
+
} else {
|
|
202
|
+
window.classNames = classNames;
|
|
203
|
+
}
|
|
204
|
+
}());
|
|
205
|
+
} (classnames$1));
|
|
206
|
+
|
|
207
|
+
var classnames = classnames$1.exports;
|
|
208
|
+
|
|
209
|
+
var TIME_OUT = 2000;
|
|
210
|
+
var TOOLTIP_CONFIG = {
|
|
211
|
+
content: "Copied",
|
|
212
|
+
trigger: "click",
|
|
213
|
+
hideAfter: TIME_OUT,
|
|
214
|
+
position: "top"
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
218
|
+
|
|
219
|
+
var css = ".neeto-molecules-copy-button{display:flex;justify-content:space-between}.neeto-molecules-copy-button .neeto-ui-btn:active,.neeto-molecules-copy-button .neeto-ui-btn:focus,.neeto-molecules-copy-button .neeto-ui-btn:hover{box-shadow:none}.neeto-molecules-copy-button--active{background:rgba(var(--neeto-ui-success-500));color:#fff}.neeto-molecules-copy-button--active.neeto-ui-btn:active,.neeto-molecules-copy-button--active.neeto-ui-btn:focus,.neeto-molecules-copy-button--active.neeto-ui-btn:hover{background:rgba(var(--neeto-ui-success-600));box-shadow:none;color:#fff}";
|
|
220
|
+
n(css,{});
|
|
221
|
+
|
|
222
|
+
var _excluded = ["className", "icon", "label", "value", "style"];
|
|
223
|
+
var CopyToClipboardButton = function CopyToClipboardButton(_ref) {
|
|
224
|
+
var _classnames;
|
|
225
|
+
var className = _ref.className,
|
|
226
|
+
_ref$icon = _ref.icon,
|
|
227
|
+
icon = _ref$icon === void 0 ? Copy : _ref$icon,
|
|
228
|
+
_ref$label = _ref.label,
|
|
229
|
+
label = _ref$label === void 0 ? "" : _ref$label,
|
|
230
|
+
value = _ref.value,
|
|
231
|
+
style = _ref.style,
|
|
232
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
233
|
+
var _useState = useState(false),
|
|
234
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
235
|
+
isChecked = _useState2[0],
|
|
236
|
+
setIsChecked = _useState2[1];
|
|
237
|
+
var ref = useRef();
|
|
238
|
+
var onHandleClick = function onHandleClick(event) {
|
|
239
|
+
event.preventDefault();
|
|
240
|
+
copyToClipboard(value, {
|
|
241
|
+
showToastr: false
|
|
242
|
+
});
|
|
243
|
+
setIsChecked(true);
|
|
244
|
+
setTimeout(function () {
|
|
245
|
+
setIsChecked(false);
|
|
246
|
+
}, TIME_OUT); // Reset copied state after 2 seconds
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
useEffect(function () {
|
|
250
|
+
if (ref.current) {
|
|
251
|
+
var buttonWidth = ref.current.clientWidth;
|
|
252
|
+
ref.current.style.minWidth = "".concat(buttonWidth, "px");
|
|
253
|
+
}
|
|
254
|
+
}, []);
|
|
255
|
+
var tooltipProps = label ? null : TOOLTIP_CONFIG;
|
|
256
|
+
var buttonLabel = isChecked && label ? "Copied" : label;
|
|
257
|
+
var buttonIcon = isChecked ? Check : icon;
|
|
258
|
+
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
259
|
+
ref: ref,
|
|
260
|
+
style: style,
|
|
261
|
+
tooltipProps: tooltipProps,
|
|
262
|
+
"data-testid": "copy-button",
|
|
263
|
+
icon: buttonIcon,
|
|
264
|
+
label: buttonLabel,
|
|
265
|
+
className: classnames("neeto-molecules-copy-button", (_classnames = {}, _defineProperty(_classnames, className, className), _defineProperty(_classnames, "neeto-molecules-copy-button--active", isChecked), _classnames)),
|
|
266
|
+
onClick: onHandleClick
|
|
267
|
+
}, otherProps));
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
var Codeblock = function Codeblock(_ref) {
|
|
271
|
+
var code = _ref.code,
|
|
272
|
+
_ref$showCopyButton = _ref.showCopyButton,
|
|
273
|
+
showCopyButton = _ref$showCopyButton === void 0 ? true : _ref$showCopyButton,
|
|
274
|
+
codeblockProps = _ref.codeblockProps,
|
|
275
|
+
_ref$copyButtonProps = _ref.copyButtonProps,
|
|
276
|
+
copyButtonProps = _ref$copyButtonProps === void 0 ? {
|
|
277
|
+
label: "Copy"
|
|
278
|
+
} : _ref$copyButtonProps;
|
|
279
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(PrismLight, _extends({
|
|
280
|
+
wrapLines: true,
|
|
281
|
+
"data-cy": "code-block",
|
|
282
|
+
"data-testid": "codeblock-react-highlighter",
|
|
283
|
+
language: "javascript",
|
|
284
|
+
style: dracula
|
|
285
|
+
}, codeblockProps), code), showCopyButton && /*#__PURE__*/React.createElement(CopyToClipboardButton, _extends({
|
|
286
|
+
className: "absolute top-3 right-3",
|
|
287
|
+
"data-cy": "copy-button",
|
|
288
|
+
"data-testid": "codeblock-copy-button",
|
|
289
|
+
size: "small",
|
|
290
|
+
style: "secondary",
|
|
291
|
+
value: code
|
|
292
|
+
}, copyButtonProps)));
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
export { Codeblock as default };
|
|
296
|
+
//# sourceMappingURL=Codeblock.js.map
|