Comparing version 3.0.2 to 3.0.3
@@ -229,3 +229,4 @@ "use strict"; | ||
setRawMode: this.handleSetRawMode, | ||
isRawModeSupported: this.isRawModeSupported() | ||
isRawModeSupported: this.isRawModeSupported(), | ||
internal_exitOnCtrlC: this.props.exitOnCtrlC | ||
} }, | ||
@@ -232,0 +233,0 @@ react_1.default.createElement(StdoutContext_1.default.Provider, { value: { |
@@ -17,2 +17,3 @@ /// <reference types="node" /> | ||
readonly isRawModeSupported: boolean; | ||
readonly internal_exitOnCtrlC: boolean; | ||
} | ||
@@ -19,0 +20,0 @@ /** |
@@ -10,3 +10,4 @@ "use strict"; | ||
setRawMode: () => { }, | ||
isRawModeSupported: false | ||
isRawModeSupported: false, | ||
internal_exitOnCtrlC: true | ||
}); | ||
@@ -13,0 +14,0 @@ StdinContext.displayName = 'InternalStdinContext'; |
@@ -35,2 +35,6 @@ import type { FC, ReactNode } from 'react'; | ||
/** | ||
* Inverse background and foreground colors. | ||
*/ | ||
readonly inverse?: boolean; | ||
/** | ||
* This property tells Ink to wrap or truncate text if its width is larger than container. | ||
@@ -37,0 +41,0 @@ * If `wrap` is passed (by default), Ink will wrap text and split it into multiple lines. |
@@ -12,3 +12,3 @@ "use strict"; | ||
*/ | ||
const Text = ({ color, backgroundColor, dimColor, bold, italic, underline, strikethrough, wrap, children }) => { | ||
const Text = ({ color, backgroundColor, dimColor, bold, italic, underline, strikethrough, inverse, wrap, children }) => { | ||
if (children === undefined || children === null) { | ||
@@ -39,2 +39,5 @@ return null; | ||
} | ||
if (inverse) { | ||
children = chalk_1.default.inverse(children); | ||
} | ||
return children; | ||
@@ -41,0 +44,0 @@ }; |
@@ -33,3 +33,3 @@ "use strict"; | ||
const useInput = (inputHandler, options = {}) => { | ||
const { stdin, setRawMode } = use_stdin_1.default(); | ||
const { stdin, setRawMode, internal_exitOnCtrlC } = use_stdin_1.default(); | ||
react_1.useEffect(() => { | ||
@@ -87,3 +87,4 @@ if (options.isActive === false) { | ||
} | ||
if (!(input === 'c' && key.ctrl)) { | ||
// If app is not supposed to exit on Ctrl+C, then let input listener handle it | ||
if (!(input === 'c' && key.ctrl) || !internal_exitOnCtrlC) { | ||
inputHandler(input, key); | ||
@@ -96,5 +97,5 @@ } | ||
}; | ||
}, [options.isActive, stdin, inputHandler]); | ||
}, [options.isActive, stdin, internal_exitOnCtrlC, inputHandler]); | ||
}; | ||
exports.default = useInput; | ||
//# sourceMappingURL=use-input.js.map |
{ | ||
"name": "ink", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "React for CLI", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -208,2 +208,3 @@ <h1 align="center"> | ||
<Text strikethrough>I am strikethrough</Text> | ||
<Text inverse>I am inversed</Text> | ||
</> | ||
@@ -289,2 +290,17 @@ ); | ||
#### inverse | ||
Type: `boolean`\ | ||
Default: `false` | ||
Inverse background and foreground colors. | ||
```jsx | ||
<Text inverse color="yellow"> | ||
Inversed Yellow | ||
</Text> | ||
``` | ||
<img src="media/text-inverse.jpg" width="138"> | ||
#### wrap | ||
@@ -291,0 +307,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
286065
3926
1766