+2
-2
| { | ||
| "name": "@farjs/ui", | ||
| "author": "viktor-podzigun", | ||
| "version": "0.8.0", | ||
| "version": "0.9.0", | ||
| "license": "MIT", | ||
@@ -57,3 +57,3 @@ "description": "Terminal UI React.js components library", | ||
| "quick-lint-js": "^3.0.0", | ||
| "react-assert": "^1.1.0", | ||
| "react-assert": "^1.2.0", | ||
| "react-test-renderer": "^17.0.1", | ||
@@ -60,0 +60,0 @@ "typescript": "^5.7.3" |
+6
-12
@@ -37,4 +37,2 @@ /** | ||
| ); | ||
| const programRef = | ||
| /** @type {React.MutableRefObject<BlessedProgram | null>} */ (useRef(null)); | ||
| const autoCompleteTimeoutRef = | ||
@@ -66,4 +64,5 @@ /** @type {React.MutableRefObject<NodeJS.Timeout | null>} */ (useRef(null)); | ||
| if (programRef.current) { | ||
| programRef.current.hideCursor(); | ||
| const el = inputRef.current; | ||
| if (el) { | ||
| el.screen.program.hideCursor(); | ||
| } | ||
@@ -75,4 +74,5 @@ } | ||
| if (programRef.current) { | ||
| programRef.current.showCursor(); | ||
| const el = inputRef.current; | ||
| if (el) { | ||
| el.screen.program.showCursor(); | ||
| } | ||
@@ -205,8 +205,2 @@ } | ||
| { | ||
| /** @type {(el?: BlessedElement) => void} */ | ||
| ref: (el) => { | ||
| if (el) { | ||
| programRef.current = el.screen.program; | ||
| } | ||
| }, | ||
| clickable: true, | ||
@@ -213,0 +207,0 @@ mouse: true, |
@@ -11,6 +11,6 @@ /** | ||
| * @param {string} label | ||
| * @param {boolean} triggeredOnClose | ||
| * @param {boolean} [triggeredOnClose] | ||
| * @returns {(onAction: () => void) => MessageBoxAction} | ||
| */ | ||
| function createAction(label, triggeredOnClose = false) { | ||
| function MessageBoxAction(label, triggeredOnClose = false) { | ||
| return (onAction) => { | ||
@@ -25,8 +25,6 @@ return { | ||
| const MessageBoxAction = { | ||
| OK: createAction("OK", true), | ||
| YES: createAction("YES"), | ||
| NO: createAction("NO", true), | ||
| }; | ||
| MessageBoxAction.OK = MessageBoxAction("OK", true); | ||
| MessageBoxAction.YES = MessageBoxAction("YES"); | ||
| MessageBoxAction.NO = MessageBoxAction("NO", true); | ||
| export default MessageBoxAction; |
@@ -7,2 +7,15 @@ export default MessageBoxAction; | ||
| }; | ||
| /** | ||
| * @typedef {{ | ||
| * readonly label: string; | ||
| * readonly triggeredOnClose: boolean; | ||
| * onAction(): void; | ||
| * }} MessageBoxAction | ||
| */ | ||
| /** | ||
| * @param {string} label | ||
| * @param {boolean} [triggeredOnClose] | ||
| * @returns {(onAction: () => void) => MessageBoxAction} | ||
| */ | ||
| declare function MessageBoxAction(label: string, triggeredOnClose?: boolean): (onAction: () => void) => MessageBoxAction; | ||
| declare namespace MessageBoxAction { | ||
@@ -9,0 +22,0 @@ let OK: (onAction: () => void) => MessageBoxAction; |
157006
0.1%3904
-0.2%