diff --git a/.changeset/input-isolation-prompt-props.md b/.changeset/input-isolation-prompt-props.md new file mode 100644 index 00000000..618c6902 --- /dev/null +++ b/.changeset/input-isolation-prompt-props.md @@ -0,0 +1,13 @@ +--- +'@kidd-cli/core': minor +--- + +Replace implicit input gating with explicit `PromptProps` (`focused`, `disabled`) + +- Add `PromptProps` interface with `focused` and `disabled` fields, shared by all prompt components +- Remove `InputBlock` / `useInputBlock` context-based input gating +- Remove `useFocus` from all prompt components (was conflicting with Tabs key interception) +- Remove `@inkjs/ui` dependency (no longer needed) +- Rename `isDisabled` to `disabled` across all prompts and stories +- Stories viewer passes `focused` explicitly to story components in preview mode +- Remove `useInput` proxy wrapper — all components now import `useInput` directly from `ink` diff --git a/.gitignore b/.gitignore index 62d93e53..488de720 100644 --- a/.gitignore +++ b/.gitignore @@ -153,3 +153,6 @@ vite.config.ts.timestamp-* .zpress/content/ .zpress/dist/ .zpress/cache/ + +# bun +*.bun-build diff --git a/packages/core/package.json b/packages/core/package.json index 862d93e9..4668c2ab 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -89,7 +89,6 @@ "zod": "catalog:" }, "devDependencies": { - "@inkjs/ui": "^2.0.0", "@types/node": "catalog:", "@types/react": "^19.2.14", "@types/yargs": "^17.0.35", @@ -100,7 +99,6 @@ "vitest": "catalog:" }, "peerDependencies": { - "@inkjs/ui": ">=2.0.0", "ink": ">=5.0.0", "jiti": ">=2.0.0", "pino": ">=9.0.0", @@ -108,9 +106,6 @@ "vitest": ">=2.0.0" }, "peerDependenciesMeta": { - "@inkjs/ui": { - "optional": true - }, "jiti": { "optional": true }, diff --git a/packages/core/src/stories/viewer/components/field-control.tsx b/packages/core/src/stories/viewer/components/field-control.tsx index c5f1910d..0ebdd673 100644 --- a/packages/core/src/stories/viewer/components/field-control.tsx +++ b/packages/core/src/stories/viewer/components/field-control.tsx @@ -1,9 +1,12 @@ -import type { Option } from '@inkjs/ui' -import { ConfirmInput, MultiSelect, Select, TextInput } from '@inkjs/ui' import { Box, Text } from 'ink' import type { ReactElement } from 'react' import { match } from 'ts-pattern' +import { Confirm } from '../../../ui/prompts/confirm.js' +import { MultiSelect } from '../../../ui/prompts/multi-select.js' +import { Select } from '../../../ui/prompts/select.js' +import { TextInput } from '../../../ui/prompts/text-input.js' +import type { PromptOption } from '../../../ui/prompts/types.js' import type { FieldControlKind } from '../../types.js' // --------------------------------------------------------------------------- @@ -44,35 +47,31 @@ export function FieldControl({ .with('text', () => ( onChange(submitted)} /> )) .with('number', () => ( onChange(parseNumericValue(submitted))} /> )) .with('boolean', () => ( - - 'confirm' as const) - .otherwise(() => 'cancel' as const)} - onConfirm={() => onChange(true)} - onCancel={() => onChange(false)} - /> - (current: {String(value)}) - + true) + .otherwise(() => false)} + focused={isFocused} + onSubmit={(submitted) => onChange(submitted)} + /> )) .with('select', () => { const selectOptions = buildSelectOptions(options) return (