Socket
Socket
Sign inDemoInstall

ink-text-input

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ink-text-input - npm Package Compare versions

Comparing version 3.1.1 to 3.2.0

32

build/index.js

@@ -6,3 +6,3 @@ "use strict";

});
exports.default = void 0;
exports.UncontrolledTextInput = exports.default = void 0;

@@ -221,2 +221,30 @@ var _react = _interopRequireWildcard(require("react"));

exports.default = TextInputWithStdin;
exports.default = TextInputWithStdin;
class UncontrolledTextInput extends _react.PureComponent {
constructor(...args) {
super(...args);
_defineProperty(this, "state", {
value: ''
});
_defineProperty(this, "setValue", this.setValue.bind(this));
}
setValue(value) {
this.setState({
value
});
}
render() {
return _react.default.createElement(TextInputWithStdin, _extends({}, this.props, {
value: this.state.value,
onChange: this.setValue
}));
}
}
exports.UncontrolledTextInput = UncontrolledTextInput;

2

package.json
{
"name": "ink-text-input",
"version": "3.1.1",
"version": "3.2.0",
"description": "Text input component for Ink",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -111,5 +111,32 @@ # ink-text-input [![Build Status](https://travis-ci.org/vadimdemedes/ink-text-input.svg?branch=master)](https://travis-ci.org/vadimdemedes/ink-text-input)

## Uncontrolled usage
This component also exposes an [uncontrolled](https://reactjs.org/docs/uncontrolled-components.html) version, which handles `value` changes for you. To receive the final input value, use `onSubmit` prop.
```jsx
import React from 'react';
import {render, Box} from 'ink';
import {UncontrolledTextInput} from 'ink-text-input';
const SearchQuery = () => {
const handleSubmit = query => {
// Do something with query
};
return (
<Box>
<Box marginRight={1}>
Enter your query:
</Box>
<UncontrolledTextInput onSubmit={handleSubmit}/>
</Box>
);
};
render(<SearchQuery/>);
```
## License
MIT © [Vadim Demedes](https://github.com/vadimdemedes)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc