rename pickerEnabled, add showPicker to MultiPathField, export both fields

Signed-off-by: FTCHD <144691102+FTCHD@users.noreply.github.com>
This commit is contained in:
FTCHD
2025-08-13 00:06:14 +02:00
parent 7d277c54f9
commit 615c62bb12
+13 -9
View File
@@ -68,7 +68,7 @@ export function PathFinder({
placeholder={sourceOptions.placeholder}
showSuggestions={sourceOptions.showSuggestions}
clearable={sourceOptions.clearable}
pickerEnabled={sourceOptions.showPicker}
showPicker={sourceOptions.showPicker}
/>
{switchable && (
@@ -93,7 +93,7 @@ export function PathFinder({
placeholder={destOptions.placeholder}
showSuggestions={destOptions.showSuggestions}
clearable={destOptions.clearable}
pickerEnabled={destOptions.showPicker}
showPicker={destOptions.showPicker}
/>
</div>
)
@@ -208,14 +208,14 @@ export function MultiPathFinder({
)
}
function PathField({
export function PathField({
path,
setPath,
label,
placeholder = 'Enter a remote:/path or local path, or tap to select files',
showSuggestions = true,
clearable = true,
pickerEnabled = true,
showPicker = true,
}: {
path: string
setPath: (path: string) => void
@@ -223,11 +223,11 @@ function PathField({
placeholder?: string
showSuggestions?: boolean
clearable?: boolean
pickerEnabled?: boolean
showPicker?: boolean
}) {
const remotes = useStore((state) => state.remotes)
const [debouncedPath] = useDebounce(path, 200)
const [debouncedPath] = useDebounce(path, 800)
const fieldRef = useRef<HTMLInputElement>(null)
@@ -424,7 +424,7 @@ function PathField({
))}
</Autocomplete>
</div>
{pickerEnabled && (
{showPicker && (
<Button
onPress={handleBrowse}
type="button"
@@ -440,12 +440,13 @@ function PathField({
)
}
function MultiPathField({
export function MultiPathField({
paths,
setPaths,
label,
placeholder = 'Enter a remote:/path or local path, or tap to select files',
showSuggestions = true,
showPicker = true,
clearable = true,
}: {
paths: string[]
@@ -453,11 +454,12 @@ function MultiPathField({
label: string
placeholder?: string
showSuggestions?: boolean
showPicker?: boolean
clearable?: boolean
}) {
const remotes = useStore((state) => state.remotes)
const [debouncedPath] = useDebounce(paths?.[0], 200)
const [debouncedPath] = useDebounce(paths?.[0], 800)
const fieldRef = useRef<HTMLInputElement>(null)
@@ -683,6 +685,7 @@ function MultiPathField({
</Autocomplete>
)}
</div>
{showPicker && (
<div className="relative w-20 group h-18">
<Button
onPress={() => {
@@ -739,6 +742,7 @@ function MultiPathField({
</Button>
</div>
</div>
)}
</div>
)
}