@metamask/snaps-sdk
Version:
A library containing the core functionality for building MetaMask Snaps
30 lines • 1.44 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.InputStruct = exports.InputType = void 0;
const superstruct_1 = require("@metamask/superstruct");
const internals_1 = require("../../internals/index.cjs");
const nodes_1 = require("../nodes.cjs");
/**
* This replicates the available input types from the metamask extension.
* https://github.com/MetaMask/metamask-extension/main/ui/components/component-library/input/input.constants.js
*/
var InputType;
(function (InputType) {
InputType["Text"] = "text";
InputType["Number"] = "number";
InputType["Password"] = "password";
})(InputType || (exports.InputType = InputType = {}));
exports.InputStruct = (0, superstruct_1.assign)(nodes_1.LiteralStruct, (0, superstruct_1.object)({
type: (0, internals_1.literal)(nodes_1.NodeType.Input),
value: (0, superstruct_1.optional)((0, superstruct_1.string)()),
name: (0, superstruct_1.string)(),
inputType: (0, superstruct_1.optional)((0, superstruct_1.union)([
(0, internals_1.enumValue)(InputType.Text),
(0, internals_1.enumValue)(InputType.Password),
(0, internals_1.enumValue)(InputType.Number),
])),
placeholder: (0, superstruct_1.optional)((0, superstruct_1.string)()),
label: (0, superstruct_1.optional)((0, superstruct_1.string)()),
error: (0, superstruct_1.optional)((0, superstruct_1.string)()),
}));
//# sourceMappingURL=input.cjs.map