(t0)
| 20 | * A base component for text inputs that handles rendering and basic input |
| 21 | */ |
| 22 | export function BaseTextInput(t0) { |
| 23 | const $ = _c(14); |
| 24 | const { |
| 25 | inputState, |
| 26 | children, |
| 27 | terminalFocus, |
| 28 | invert, |
| 29 | hidePlaceholderText, |
| 30 | ...props |
| 31 | } = t0; |
| 32 | const { |
| 33 | onInput, |
| 34 | renderedValue, |
| 35 | cursorLine, |
| 36 | cursorColumn |
| 37 | } = inputState; |
| 38 | const t1 = Boolean(props.focus && props.showCursor && terminalFocus); |
| 39 | let t2; |
| 40 | if ($[0] !== cursorColumn || $[1] !== cursorLine || $[2] !== t1) { |
| 41 | t2 = { |
| 42 | line: cursorLine, |
| 43 | column: cursorColumn, |
| 44 | active: t1 |
| 45 | }; |
| 46 | $[0] = cursorColumn; |
| 47 | $[1] = cursorLine; |
| 48 | $[2] = t1; |
| 49 | $[3] = t2; |
| 50 | } else { |
| 51 | t2 = $[3]; |
| 52 | } |
| 53 | const cursorRef = useDeclaredCursor(t2); |
| 54 | const { |
| 55 | wrappedOnInput, |
| 56 | isPasting: t3 |
| 57 | } = usePasteHandler({ |
| 58 | onPaste: props.onPaste, |
| 59 | onInput: (input, key) => { |
| 60 | if (isPasting && key.return) { |
| 61 | return; |
| 62 | } |
| 63 | onInput(input, key); |
| 64 | }, |
| 65 | onImagePaste: props.onImagePaste |
| 66 | }); |
| 67 | const isPasting = t3; |
| 68 | const { |
| 69 | onIsPastingChange |
| 70 | } = props; |
| 71 | React.useEffect(() => { |
| 72 | if (onIsPastingChange) { |
| 73 | onIsPastingChange(isPasting); |
| 74 | } |
| 75 | }, [isPasting, onIsPastingChange]); |
| 76 | const { |
| 77 | showPlaceholder, |
| 78 | renderedPlaceholder |
| 79 | } = renderPlaceholder({ |
nothing calls this directly
no test coverage detected