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