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 5.0.1 to 6.0.0

24

build/index.d.ts

@@ -1,2 +0,2 @@

/// <reference types="react" />
import React from 'react';
import type { Except } from 'type-fest';

@@ -7,3 +7,3 @@ export type Props = {

*/
placeholder?: string;
readonly placeholder?: string;
/**

@@ -13,29 +13,29 @@ * Listen to user's input. Useful in case there are multiple input components

*/
focus?: boolean;
readonly focus?: boolean;
/**
* Replace all chars and mask the value. Useful for password inputs.
*/
mask?: string;
readonly mask?: string;
/**
* Whether to show cursor and allow navigation inside text input with arrow keys.
*/
showCursor?: boolean;
readonly showCursor?: boolean;
/**
* Highlight pasted text
*/
highlightPastedText?: boolean;
readonly highlightPastedText?: boolean;
/**
* Value to display in a text input.
*/
value: string;
readonly value: string;
/**
* Function to call when value updates.
*/
onChange: (value: string) => void;
readonly onChange: (value: string) => void;
/**
* Function to call when `Enter` is pressed, where first argument is a value of the input.
*/
onSubmit?: (value: string) => void;
readonly onSubmit?: (value: string) => void;
};
declare function TextInput({ value: originalValue, placeholder, focus, mask, highlightPastedText, showCursor, onChange, onSubmit }: Props): JSX.Element;
declare function TextInput({ value: originalValue, placeholder, focus, mask, highlightPastedText, showCursor, onChange, onSubmit, }: Props): React.JSX.Element;
export default TextInput;

@@ -46,4 +46,4 @@ type UncontrolledProps = {

*/
initialValue?: string;
readonly initialValue?: string;
} & Except<Props, 'value' | 'onChange'>;
export declare function UncontrolledTextInput({ initialValue, ...props }: UncontrolledProps): JSX.Element;
export declare function UncontrolledTextInput({ initialValue, ...props }: UncontrolledProps): React.JSX.Element;
import React, { useState, useEffect } from 'react';
import { Text, useInput } from 'ink';
import chalk from 'chalk';
function TextInput({ value: originalValue, placeholder = '', focus = true, mask, highlightPastedText = false, showCursor = true, onChange, onSubmit }) {
function TextInput({ value: originalValue, placeholder = '', focus = true, mask, highlightPastedText = false, showCursor = true, onChange, onSubmit, }) {
const [state, setState] = useState({
cursorOffset: (originalValue || '').length,
cursorWidth: 0
cursorWidth: 0,
});

@@ -19,3 +19,3 @@ const { cursorOffset, cursorWidth } = state;

cursorOffset: newValue.length,
cursorWidth: 0
cursorWidth: 0,
};

@@ -102,3 +102,3 @@ }

cursorOffset: nextCursorOffset,
cursorWidth: nextCursorWidth
cursorWidth: nextCursorWidth,
});

@@ -105,0 +105,0 @@ if (nextValue !== originalValue) {

{
"name": "ink-text-input",
"version": "5.0.1",
"version": "6.0.0",
"description": "Text input component for Ink",

@@ -18,3 +18,3 @@ "license": "MIT",

"engines": {
"node": ">=14.16"
"node": ">=18"
},

@@ -43,27 +43,27 @@ "scripts": {

"dependencies": {
"chalk": "^5.2.0",
"type-fest": "^3.6.1"
"chalk": "^5.3.0",
"type-fest": "^4.18.2"
},
"devDependencies": {
"@sindresorhus/tsconfig": "^3.0.1",
"@types/react": "^18.0.0",
"@types/sinon": "^10.0.13",
"@vdemedes/prettier-config": "^1.0.1",
"ava": "^5.1.1",
"delay": "^5.0.0",
"@sindresorhus/tsconfig": "^5.0.0",
"@types/react": "^18.3.2",
"@types/sinon": "^17.0.3",
"@vdemedes/prettier-config": "^2.0.1",
"ava": "^6.1.3",
"delay": "^6.0.0",
"eslint-config-xo-react": "^0.27.0",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"ink": "^4.0.0",
"ink-testing-library": "^3.0.0",
"prettier": "^2.0.5",
"react": "^18.0.0",
"sinon": "^15.0.1",
"ts-node": "^10.9.1",
"typescript": "^4.9.5",
"xo": "^0.53.0"
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.2",
"ink": "^5.0.0",
"ink-testing-library": "vadimdemedes/ink-testing-library#f44b077e9a05a1d615bab41c72906726d34ea085",
"prettier": "^3.2.5",
"react": "^18.3.1",
"sinon": "^17.0.1",
"tsimp": "^2.0.11",
"typescript": "^5.4.5",
"xo": "^0.58.0"
},
"peerDependencies": {
"ink": "^4.0.0",
"react": "^18.0.0"
"ink": ">=5",
"react": ">=18"
},

@@ -76,3 +76,3 @@ "ava": {

"nodeArguments": [
"--loader=ts-node/esm"
"--import=tsimp/import"
]

@@ -86,3 +86,3 @@ },

"rules": {
"unicorn/no-hex-escape": 0
"unicorn/prevent-abbreviations": "off"
}

@@ -89,0 +89,0 @@ },

@@ -5,9 +5,7 @@ # ink-text-input ![test](https://github.com/vadimdemedes/ink-text-input/workflows/test/badge.svg)

Looking for a version compatible with Ink 2.x? Check out [this release](https://github.com/vadimdemedes/ink-text-input/tree/v3.3.0).
## Install
```sh
npm install ink-text-input
```
$ npm install ink-text-input
```

@@ -14,0 +12,0 @@ ## Usage

Sorry, the diff of this file is not supported yet

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