@coveord/plasma-mantine
Version:
A Plasma flavoured Mantine theme
56 lines (55 loc) • 2.28 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "CopyToClipboard", {
enumerable: true,
get: function() {
return CopyToClipboard;
}
});
var _object_spread = require("@swc/helpers/_/_object_spread");
var _object_without_properties = require("@swc/helpers/_/_object_without_properties");
var _jsxruntime = require("react/jsx-runtime");
var _plasmareacticons = require("@coveord/plasma-react-icons");
var _core = require("@mantine/core");
var CopyToClipboardButton = function(param) {
var value = param.value, onCopy = param.onCopy, color = param.color;
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_core.CopyButton, {
value: value,
timeout: 2000,
children: function(param) {
var copied = param.copied, copy = param.copy;
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_core.Tooltip, {
label: copied ? 'Copied' : 'Copy',
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_core.ActionIcon, {
variant: "subtle",
color: copied ? 'success' : color,
onClick: function() {
copy();
onCopy === null || onCopy === void 0 ? void 0 : onCopy();
},
children: copied ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_plasmareacticons.CheckSize16Px, {
height: 16
}) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_plasmareacticons.CopySize16Px, {
height: 16
})
})
});
}
});
};
var CopyToClipboard = function(_param) {
var withLabel = _param.withLabel, others = _object_without_properties._(_param, [
"withLabel"
]);
return withLabel ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_core.TextInput, {
value: others.value,
readOnly: true,
autoComplete: "off",
rightSection: /*#__PURE__*/ (0, _jsxruntime.jsx)(CopyToClipboardButton, _object_spread._({
color: "action"
}, others))
}) : /*#__PURE__*/ (0, _jsxruntime.jsx)(CopyToClipboardButton, _object_spread._({}, others));
};
//# sourceMappingURL=CopyToClipboard.js.map