UNPKG

@metamask/snaps-sdk

Version:

A library containing the core functionality for building MetaMask Snaps

33 lines 1.46 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.copyable = exports.CopyableStruct = void 0; const superstruct_1 = require("@metamask/superstruct"); const internals_1 = require("../../internals/index.cjs"); const builder_1 = require("../builder.cjs"); const nodes_1 = require("../nodes.cjs"); exports.CopyableStruct = (0, superstruct_1.assign)(nodes_1.LiteralStruct, (0, superstruct_1.object)({ type: (0, internals_1.literal)(nodes_1.NodeType.Copyable), value: (0, superstruct_1.string)(), sensitive: (0, superstruct_1.optional)((0, superstruct_1.boolean)()), })); /** * Create a {@link Copyable} component. * * @param args - The node arguments. This can either be a string, or an object * with the `text` property. * @param args.value - The text to be copied. * @param args.sensitive - Whether the value is sensitive or not. Sensitive * values are only displayed to the user after clicking on the component. * Defaults to false. * @returns A {@link Copyable} component. * @deprecated Snaps component functions are deprecated, in favor of the new JSX * components. This function will be removed in a future release. * @example * const node = copyable('Hello, world!'); * const node = copyable({ value: 'Hello, world!' }); */ exports.copyable = (0, builder_1.createBuilder)(nodes_1.NodeType.Copyable, exports.CopyableStruct, [ 'value', 'sensitive', ]); //# sourceMappingURL=copyable.cjs.map