Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
omni-code / tui / dist / components / TextInput.js
Size: Mime:
import React from "react";
import { Box, Text, useInput } from "ink";
export function TextInput({ value, onChange, onSubmit, onCancel, placeholder, prompt }) {
    useInput((input, key) => {
        if (key.escape) {
            onCancel();
            return;
        }
        if (key.return) {
            onSubmit(value);
            return;
        }
        if (key.backspace || key.delete) {
            onChange(value.slice(0, -1));
            return;
        }
        if (!key.ctrl && !key.meta && input) {
            onChange(value + input);
        }
    });
    return (React.createElement(Box, null,
        prompt ? React.createElement(Text, { color: "cyan" },
            prompt,
            " ") : null,
        React.createElement(Text, null, value || (placeholder ? React.createElement(Text, { color: "gray" }, placeholder) : "")),
        React.createElement(Text, { color: "cyan" }, "_")));
}
//# sourceMappingURL=TextInput.js.map