@raycast/api 1.42.2 → 1.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api.d.ts +231 -3
- package/package.json +1 -1
- package/types/index.d.ts +231 -3
package/api.d.ts
CHANGED
|
@@ -389,6 +389,10 @@ declare interface ActionProps {
|
|
|
389
389
|
* Callback that is triggered when the item is selected.
|
|
390
390
|
*/
|
|
391
391
|
onAction?: () => void;
|
|
392
|
+
/**
|
|
393
|
+
* Indicates whether the Action should be focused automatically when the parent ActionPanel (or Actionpanel.Submenu) opens.
|
|
394
|
+
*/
|
|
395
|
+
autoFocus?: boolean;
|
|
392
396
|
}
|
|
393
397
|
|
|
394
398
|
/**
|
|
@@ -1914,11 +1918,11 @@ declare interface DropdownProps_2 {
|
|
|
1914
1918
|
*/
|
|
1915
1919
|
defaultValue?: string;
|
|
1916
1920
|
/**
|
|
1917
|
-
*
|
|
1921
|
+
* Dropdown sections or items. If Dropdown.Item elements are specified, a default section is automatically created.
|
|
1918
1922
|
*/
|
|
1919
1923
|
children?: ReactNode;
|
|
1920
1924
|
/**
|
|
1921
|
-
* Callback triggered when the
|
|
1925
|
+
* Callback triggered when the dropdown selection changes.
|
|
1922
1926
|
*/
|
|
1923
1927
|
onChange?: (newValue: string) => void;
|
|
1924
1928
|
}
|
|
@@ -2082,6 +2086,39 @@ export declare interface FileIcon {
|
|
|
2082
2086
|
fileIcon: string;
|
|
2083
2087
|
}
|
|
2084
2088
|
|
|
2089
|
+
/**
|
|
2090
|
+
* See {@link Form.FilePicker}
|
|
2091
|
+
*/
|
|
2092
|
+
declare const FilePicker: ForwardRefExoticComponent<FilePickerProps & RefAttributes<FilePickerRef>>;
|
|
2093
|
+
|
|
2094
|
+
/**
|
|
2095
|
+
* See {@link Form.FilePicker.Props}
|
|
2096
|
+
*/
|
|
2097
|
+
declare interface FilePickerProps extends FormItemProps_2<string[]> {
|
|
2098
|
+
/**
|
|
2099
|
+
* Indicates whether it's possible to choose a file.
|
|
2100
|
+
* @defaultValue `true`
|
|
2101
|
+
*/
|
|
2102
|
+
canChooseFiles?: boolean;
|
|
2103
|
+
/**
|
|
2104
|
+
* Indicates whether it's possible to choose a directory.
|
|
2105
|
+
* @defaultValue `false`
|
|
2106
|
+
*/
|
|
2107
|
+
canChooseDirectories?: boolean;
|
|
2108
|
+
/**
|
|
2109
|
+
* Indicates whether the file picker displays files that are normally hidden from the user.
|
|
2110
|
+
* @defaultValue `false`
|
|
2111
|
+
*/
|
|
2112
|
+
showHiddenFiles?: boolean;
|
|
2113
|
+
/**
|
|
2114
|
+
* Indicates whether the user can select multiple items or only one.
|
|
2115
|
+
* @defaultValue `true`
|
|
2116
|
+
*/
|
|
2117
|
+
allowMultipleSelection?: boolean;
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
declare type FilePickerRef = FormItemRef;
|
|
2121
|
+
|
|
2085
2122
|
/**
|
|
2086
2123
|
* Holds data about a File System item. Use the {@link getSelectedFinderItems} method to retrieve values.
|
|
2087
2124
|
*/
|
|
@@ -2686,6 +2723,77 @@ export declare namespace Form {
|
|
|
2686
2723
|
export type Props = TagPickerItemProps;
|
|
2687
2724
|
}
|
|
2688
2725
|
}
|
|
2726
|
+
/**
|
|
2727
|
+
* A Ref Type for the {@link Form.FilePicker}.
|
|
2728
|
+
* Use refs to control your Form by calling `Form.FilePicker.focus()` or `Form.FilePicker.reset()` functions.
|
|
2729
|
+
*
|
|
2730
|
+
* @example
|
|
2731
|
+
* Using Ref to focus {@link Form.FilePicker}.
|
|
2732
|
+
*
|
|
2733
|
+
* ```typescript
|
|
2734
|
+
* import { Form, ActionPanel, Action } from "@raycast/api";
|
|
2735
|
+
* import { useRef } from "react";
|
|
2736
|
+
*
|
|
2737
|
+
* export default function Command() {
|
|
2738
|
+
* const filePickerRef = useRef<Form.FilePicker>(null);
|
|
2739
|
+
*
|
|
2740
|
+
* return (
|
|
2741
|
+
* <Form
|
|
2742
|
+
* actions={
|
|
2743
|
+
* <ActionPanel>
|
|
2744
|
+
* <Action.SubmitForm
|
|
2745
|
+
* title="Submit"
|
|
2746
|
+
* onSubmit={(values) => {
|
|
2747
|
+
* filePickerRef.current?.focus();
|
|
2748
|
+
* console.log("Values", values);
|
|
2749
|
+
* }}
|
|
2750
|
+
* />
|
|
2751
|
+
* </ActionPanel>
|
|
2752
|
+
* }
|
|
2753
|
+
* >
|
|
2754
|
+
* <Form.FilePicker id="files" ref={filePickerRef} />
|
|
2755
|
+
* </Form>
|
|
2756
|
+
* );
|
|
2757
|
+
* }
|
|
2758
|
+
* ```
|
|
2759
|
+
*
|
|
2760
|
+
* @example
|
|
2761
|
+
* Using Ref to reset {@link Form.FilePicker}.
|
|
2762
|
+
*
|
|
2763
|
+
* ```typescript
|
|
2764
|
+
* import { Form, ActionPanel, Action } from "@raycast/api";
|
|
2765
|
+
* import { useRef } from "react";
|
|
2766
|
+
*
|
|
2767
|
+
* export default function Command() {
|
|
2768
|
+
* const filePickerRef = useRef<Form.FilePicker>(null);
|
|
2769
|
+
*
|
|
2770
|
+
* return (
|
|
2771
|
+
* <Form
|
|
2772
|
+
* actions={
|
|
2773
|
+
* <ActionPanel>
|
|
2774
|
+
* <Action.SubmitForm
|
|
2775
|
+
* title="Submit"
|
|
2776
|
+
* onSubmit={(values) => {
|
|
2777
|
+
* filePickerRef.current?.reset();
|
|
2778
|
+
* console.log("Values", values);
|
|
2779
|
+
* }}
|
|
2780
|
+
* />
|
|
2781
|
+
* </ActionPanel>
|
|
2782
|
+
* }
|
|
2783
|
+
* >
|
|
2784
|
+
* <Form.FilePicker id="files" ref={filePickerRef} />
|
|
2785
|
+
* </Form>
|
|
2786
|
+
* );
|
|
2787
|
+
* }
|
|
2788
|
+
* ```
|
|
2789
|
+
*/
|
|
2790
|
+
export type FilePicker = FilePickerRef;
|
|
2791
|
+
export namespace FilePicker {
|
|
2792
|
+
/**
|
|
2793
|
+
* Props of the {@link Form.TextField} React component.
|
|
2794
|
+
*/
|
|
2795
|
+
export type Props = FilePickerProps;
|
|
2796
|
+
}
|
|
2689
2797
|
}
|
|
2690
2798
|
|
|
2691
2799
|
/**
|
|
@@ -3368,6 +3476,117 @@ declare interface FormMembers {
|
|
|
3368
3476
|
* ```
|
|
3369
3477
|
*/
|
|
3370
3478
|
TextField: typeof TextField;
|
|
3479
|
+
/**
|
|
3480
|
+
* A form item with a button to open a dialog to pick some files and/or some directories (depending on its props).
|
|
3481
|
+
*
|
|
3482
|
+
* _While the user picked some items that existed, it might be possible for them to be deleted or changed when the `onSubmit` callback is called. Hence you should always make sure that the items exist before acting on them!_
|
|
3483
|
+
*
|
|
3484
|
+
* @example
|
|
3485
|
+
* Uncontrolled file picker
|
|
3486
|
+
*
|
|
3487
|
+
* ```typescript
|
|
3488
|
+
* import { ActionPanel, Form, Action } from "@raycast/api";
|
|
3489
|
+
* import fs from "fs";
|
|
3490
|
+
*
|
|
3491
|
+
* export default function Command() {
|
|
3492
|
+
* return (
|
|
3493
|
+
* <Form
|
|
3494
|
+
* actions={
|
|
3495
|
+
* <ActionPanel>
|
|
3496
|
+
* <Action.SubmitForm title="Submit Name" onSubmit={(values) => {
|
|
3497
|
+
* const files = values.files.filter(
|
|
3498
|
+
* file => fs.existsSync(values.file) && fs.lstatSync(values.file).isFile()
|
|
3499
|
+
* )
|
|
3500
|
+
* // do something with the files
|
|
3501
|
+
* } />
|
|
3502
|
+
* </ActionPanel>
|
|
3503
|
+
* }
|
|
3504
|
+
* >
|
|
3505
|
+
* <Form.FilePicker id="files" />
|
|
3506
|
+
* </Form>
|
|
3507
|
+
* );
|
|
3508
|
+
* }
|
|
3509
|
+
* ```
|
|
3510
|
+
*
|
|
3511
|
+
* @example
|
|
3512
|
+
* Single selection file picker
|
|
3513
|
+
*
|
|
3514
|
+
* ```typescript
|
|
3515
|
+
* import { ActionPanel, Form, Action } from "@raycast/api";
|
|
3516
|
+
* import fs from "fs";
|
|
3517
|
+
*
|
|
3518
|
+
* export default function Command() {
|
|
3519
|
+
* return (
|
|
3520
|
+
* <Form
|
|
3521
|
+
* actions={
|
|
3522
|
+
* <ActionPanel>
|
|
3523
|
+
* <Action.SubmitForm title="Submit Name" onSubmit={(values) => {
|
|
3524
|
+
* const file = values.file[0]
|
|
3525
|
+
* if (fs.existsSync(file) && fs.lstatSync(file).isFile()) {
|
|
3526
|
+
* // do something with the file
|
|
3527
|
+
* }
|
|
3528
|
+
* } />
|
|
3529
|
+
* </ActionPanel>
|
|
3530
|
+
* }
|
|
3531
|
+
* >
|
|
3532
|
+
* <Form.FilePicker id="file" allowMultipleSelection={false} />
|
|
3533
|
+
* </Form>
|
|
3534
|
+
* );
|
|
3535
|
+
* }
|
|
3536
|
+
* ```
|
|
3537
|
+
*
|
|
3538
|
+
* @example
|
|
3539
|
+
* Directory picker
|
|
3540
|
+
*
|
|
3541
|
+
* ```typescript
|
|
3542
|
+
* import { ActionPanel, Form, Action } from "@raycast/api";
|
|
3543
|
+
* import fs from "fs";
|
|
3544
|
+
*
|
|
3545
|
+
* export default function Command() {
|
|
3546
|
+
* return (
|
|
3547
|
+
* <Form
|
|
3548
|
+
* actions={
|
|
3549
|
+
* <ActionPanel>
|
|
3550
|
+
* <Action.SubmitForm title="Submit Name" onSubmit={(values) => {
|
|
3551
|
+
* const file = values.file[0]
|
|
3552
|
+
* if (fs.existsSync(file) && fs.lstatSync(file).isDirectory()) {
|
|
3553
|
+
* // do something with the directory
|
|
3554
|
+
* }
|
|
3555
|
+
* } />
|
|
3556
|
+
* </ActionPanel>
|
|
3557
|
+
* }
|
|
3558
|
+
* >
|
|
3559
|
+
* <Form.FilePicker id="file" allowMultipleSelection={false} canChooseDirectories canChooseFiles={false} />
|
|
3560
|
+
* </Form>
|
|
3561
|
+
* );
|
|
3562
|
+
* }
|
|
3563
|
+
* ```
|
|
3564
|
+
*
|
|
3565
|
+
* @example
|
|
3566
|
+
* Controlled file picker
|
|
3567
|
+
*
|
|
3568
|
+
* ```typescript
|
|
3569
|
+
* import { ActionPanel, Form, Action } from "@raycast/api";
|
|
3570
|
+
* import { useState } from "react";
|
|
3571
|
+
*
|
|
3572
|
+
* export default function Command() {
|
|
3573
|
+
* const [files, setFiles] = useState<string[]>([]);
|
|
3574
|
+
*
|
|
3575
|
+
* return (
|
|
3576
|
+
* <Form
|
|
3577
|
+
* actions={
|
|
3578
|
+
* <ActionPanel>
|
|
3579
|
+
* <Action.SubmitForm title="Submit Name" onSubmit={(values) => console.log(values)} />
|
|
3580
|
+
* </ActionPanel>
|
|
3581
|
+
* }
|
|
3582
|
+
* >
|
|
3583
|
+
* <Form.FilePicker id="files" value={files} onChange={setFiles} />
|
|
3584
|
+
* </Form>
|
|
3585
|
+
* );
|
|
3586
|
+
* }
|
|
3587
|
+
* ```
|
|
3588
|
+
*/
|
|
3589
|
+
FilePicker: typeof FilePicker;
|
|
3371
3590
|
}
|
|
3372
3591
|
|
|
3373
3592
|
/**
|
|
@@ -4012,7 +4231,7 @@ declare interface GridProps extends ActionsInterface, NavigationChildInterface {
|
|
|
4012
4231
|
* Callback triggered when the search bar text changes.
|
|
4013
4232
|
*
|
|
4014
4233
|
* @remarks
|
|
4015
|
-
* Specifying this implicitly toggles `
|
|
4234
|
+
* Specifying this implicitly toggles `filtering` to false. To enable native filtering when using `onSearchTextChange`, explicitly set `filtering` to true.
|
|
4016
4235
|
*/
|
|
4017
4236
|
onSearchTextChange?: (text: string) => void;
|
|
4018
4237
|
}
|
|
@@ -4109,9 +4328,13 @@ export declare enum Icon {
|
|
|
4109
4328
|
Checkmark = "check-circle-16",
|
|
4110
4329
|
ChessPiece = "chess-piece-16",
|
|
4111
4330
|
ChevronDown = "chevron-down-16",
|
|
4331
|
+
ChevronDownSmall = "chevron-down-small-16",
|
|
4112
4332
|
ChevronLeft = "chevron-left-16",
|
|
4333
|
+
ChevronLeftSmall = "chevron-left-small-16",
|
|
4113
4334
|
ChevronRight = "chevron-right-16",
|
|
4335
|
+
ChevronRightSmall = "chevron-right-small-16",
|
|
4114
4336
|
ChevronUp = "chevron-up-16",
|
|
4337
|
+
ChevronUpSmall = "chevron-up-small-16",
|
|
4115
4338
|
Circle = "circle-16",
|
|
4116
4339
|
CircleEllipsis = "circle-ellipsis-16",
|
|
4117
4340
|
CircleFilled = "circle-filled-16",
|
|
@@ -4207,6 +4430,7 @@ export declare enum Icon {
|
|
|
4207
4430
|
Link = "link-16",
|
|
4208
4431
|
List = "app-window-list-16",
|
|
4209
4432
|
Livestream = "livestream-01-16",
|
|
4433
|
+
LivestreamDisabled = "livestream-disabled-01-16",
|
|
4210
4434
|
Lock = "lock-16",
|
|
4211
4435
|
LockDisabled = "lock-disabled-16",
|
|
4212
4436
|
LockUnlocked = "lock-unlocked-16",
|
|
@@ -6892,6 +7116,10 @@ declare interface SubmenuProps {
|
|
|
6892
7116
|
* ```
|
|
6893
7117
|
*/
|
|
6894
7118
|
onOpen?: () => void;
|
|
7119
|
+
/**
|
|
7120
|
+
* Indicates whether the ActionPanel.Submenu should be focused automatically when the parent ActionPanel (or Actionpanel.Submenu) opens.
|
|
7121
|
+
*/
|
|
7122
|
+
autoFocus?: boolean;
|
|
6895
7123
|
}
|
|
6896
7124
|
|
|
6897
7125
|
declare interface SubmenuProps_2 {
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -389,6 +389,10 @@ declare interface ActionProps {
|
|
|
389
389
|
* Callback that is triggered when the item is selected.
|
|
390
390
|
*/
|
|
391
391
|
onAction?: () => void;
|
|
392
|
+
/**
|
|
393
|
+
* Indicates whether the Action should be focused automatically when the parent ActionPanel (or Actionpanel.Submenu) opens.
|
|
394
|
+
*/
|
|
395
|
+
autoFocus?: boolean;
|
|
392
396
|
}
|
|
393
397
|
|
|
394
398
|
/**
|
|
@@ -1914,11 +1918,11 @@ declare interface DropdownProps_2 {
|
|
|
1914
1918
|
*/
|
|
1915
1919
|
defaultValue?: string;
|
|
1916
1920
|
/**
|
|
1917
|
-
*
|
|
1921
|
+
* Dropdown sections or items. If Dropdown.Item elements are specified, a default section is automatically created.
|
|
1918
1922
|
*/
|
|
1919
1923
|
children?: ReactNode;
|
|
1920
1924
|
/**
|
|
1921
|
-
* Callback triggered when the
|
|
1925
|
+
* Callback triggered when the dropdown selection changes.
|
|
1922
1926
|
*/
|
|
1923
1927
|
onChange?: (newValue: string) => void;
|
|
1924
1928
|
}
|
|
@@ -2082,6 +2086,39 @@ export declare interface FileIcon {
|
|
|
2082
2086
|
fileIcon: string;
|
|
2083
2087
|
}
|
|
2084
2088
|
|
|
2089
|
+
/**
|
|
2090
|
+
* See {@link Form.FilePicker}
|
|
2091
|
+
*/
|
|
2092
|
+
declare const FilePicker: ForwardRefExoticComponent<FilePickerProps & RefAttributes<FilePickerRef>>;
|
|
2093
|
+
|
|
2094
|
+
/**
|
|
2095
|
+
* See {@link Form.FilePicker.Props}
|
|
2096
|
+
*/
|
|
2097
|
+
declare interface FilePickerProps extends FormItemProps_2<string[]> {
|
|
2098
|
+
/**
|
|
2099
|
+
* Indicates whether it's possible to choose a file.
|
|
2100
|
+
* @defaultValue `true`
|
|
2101
|
+
*/
|
|
2102
|
+
canChooseFiles?: boolean;
|
|
2103
|
+
/**
|
|
2104
|
+
* Indicates whether it's possible to choose a directory.
|
|
2105
|
+
* @defaultValue `false`
|
|
2106
|
+
*/
|
|
2107
|
+
canChooseDirectories?: boolean;
|
|
2108
|
+
/**
|
|
2109
|
+
* Indicates whether the file picker displays files that are normally hidden from the user.
|
|
2110
|
+
* @defaultValue `false`
|
|
2111
|
+
*/
|
|
2112
|
+
showHiddenFiles?: boolean;
|
|
2113
|
+
/**
|
|
2114
|
+
* Indicates whether the user can select multiple items or only one.
|
|
2115
|
+
* @defaultValue `true`
|
|
2116
|
+
*/
|
|
2117
|
+
allowMultipleSelection?: boolean;
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
declare type FilePickerRef = FormItemRef;
|
|
2121
|
+
|
|
2085
2122
|
/**
|
|
2086
2123
|
* Holds data about a File System item. Use the {@link getSelectedFinderItems} method to retrieve values.
|
|
2087
2124
|
*/
|
|
@@ -2686,6 +2723,77 @@ export declare namespace Form {
|
|
|
2686
2723
|
export type Props = TagPickerItemProps;
|
|
2687
2724
|
}
|
|
2688
2725
|
}
|
|
2726
|
+
/**
|
|
2727
|
+
* A Ref Type for the {@link Form.FilePicker}.
|
|
2728
|
+
* Use refs to control your Form by calling `Form.FilePicker.focus()` or `Form.FilePicker.reset()` functions.
|
|
2729
|
+
*
|
|
2730
|
+
* @example
|
|
2731
|
+
* Using Ref to focus {@link Form.FilePicker}.
|
|
2732
|
+
*
|
|
2733
|
+
* ```typescript
|
|
2734
|
+
* import { Form, ActionPanel, Action } from "@raycast/api";
|
|
2735
|
+
* import { useRef } from "react";
|
|
2736
|
+
*
|
|
2737
|
+
* export default function Command() {
|
|
2738
|
+
* const filePickerRef = useRef<Form.FilePicker>(null);
|
|
2739
|
+
*
|
|
2740
|
+
* return (
|
|
2741
|
+
* <Form
|
|
2742
|
+
* actions={
|
|
2743
|
+
* <ActionPanel>
|
|
2744
|
+
* <Action.SubmitForm
|
|
2745
|
+
* title="Submit"
|
|
2746
|
+
* onSubmit={(values) => {
|
|
2747
|
+
* filePickerRef.current?.focus();
|
|
2748
|
+
* console.log("Values", values);
|
|
2749
|
+
* }}
|
|
2750
|
+
* />
|
|
2751
|
+
* </ActionPanel>
|
|
2752
|
+
* }
|
|
2753
|
+
* >
|
|
2754
|
+
* <Form.FilePicker id="files" ref={filePickerRef} />
|
|
2755
|
+
* </Form>
|
|
2756
|
+
* );
|
|
2757
|
+
* }
|
|
2758
|
+
* ```
|
|
2759
|
+
*
|
|
2760
|
+
* @example
|
|
2761
|
+
* Using Ref to reset {@link Form.FilePicker}.
|
|
2762
|
+
*
|
|
2763
|
+
* ```typescript
|
|
2764
|
+
* import { Form, ActionPanel, Action } from "@raycast/api";
|
|
2765
|
+
* import { useRef } from "react";
|
|
2766
|
+
*
|
|
2767
|
+
* export default function Command() {
|
|
2768
|
+
* const filePickerRef = useRef<Form.FilePicker>(null);
|
|
2769
|
+
*
|
|
2770
|
+
* return (
|
|
2771
|
+
* <Form
|
|
2772
|
+
* actions={
|
|
2773
|
+
* <ActionPanel>
|
|
2774
|
+
* <Action.SubmitForm
|
|
2775
|
+
* title="Submit"
|
|
2776
|
+
* onSubmit={(values) => {
|
|
2777
|
+
* filePickerRef.current?.reset();
|
|
2778
|
+
* console.log("Values", values);
|
|
2779
|
+
* }}
|
|
2780
|
+
* />
|
|
2781
|
+
* </ActionPanel>
|
|
2782
|
+
* }
|
|
2783
|
+
* >
|
|
2784
|
+
* <Form.FilePicker id="files" ref={filePickerRef} />
|
|
2785
|
+
* </Form>
|
|
2786
|
+
* );
|
|
2787
|
+
* }
|
|
2788
|
+
* ```
|
|
2789
|
+
*/
|
|
2790
|
+
export type FilePicker = FilePickerRef;
|
|
2791
|
+
export namespace FilePicker {
|
|
2792
|
+
/**
|
|
2793
|
+
* Props of the {@link Form.TextField} React component.
|
|
2794
|
+
*/
|
|
2795
|
+
export type Props = FilePickerProps;
|
|
2796
|
+
}
|
|
2689
2797
|
}
|
|
2690
2798
|
|
|
2691
2799
|
/**
|
|
@@ -3368,6 +3476,117 @@ declare interface FormMembers {
|
|
|
3368
3476
|
* ```
|
|
3369
3477
|
*/
|
|
3370
3478
|
TextField: typeof TextField;
|
|
3479
|
+
/**
|
|
3480
|
+
* A form item with a button to open a dialog to pick some files and/or some directories (depending on its props).
|
|
3481
|
+
*
|
|
3482
|
+
* _While the user picked some items that existed, it might be possible for them to be deleted or changed when the `onSubmit` callback is called. Hence you should always make sure that the items exist before acting on them!_
|
|
3483
|
+
*
|
|
3484
|
+
* @example
|
|
3485
|
+
* Uncontrolled file picker
|
|
3486
|
+
*
|
|
3487
|
+
* ```typescript
|
|
3488
|
+
* import { ActionPanel, Form, Action } from "@raycast/api";
|
|
3489
|
+
* import fs from "fs";
|
|
3490
|
+
*
|
|
3491
|
+
* export default function Command() {
|
|
3492
|
+
* return (
|
|
3493
|
+
* <Form
|
|
3494
|
+
* actions={
|
|
3495
|
+
* <ActionPanel>
|
|
3496
|
+
* <Action.SubmitForm title="Submit Name" onSubmit={(values) => {
|
|
3497
|
+
* const files = values.files.filter(
|
|
3498
|
+
* file => fs.existsSync(values.file) && fs.lstatSync(values.file).isFile()
|
|
3499
|
+
* )
|
|
3500
|
+
* // do something with the files
|
|
3501
|
+
* } />
|
|
3502
|
+
* </ActionPanel>
|
|
3503
|
+
* }
|
|
3504
|
+
* >
|
|
3505
|
+
* <Form.FilePicker id="files" />
|
|
3506
|
+
* </Form>
|
|
3507
|
+
* );
|
|
3508
|
+
* }
|
|
3509
|
+
* ```
|
|
3510
|
+
*
|
|
3511
|
+
* @example
|
|
3512
|
+
* Single selection file picker
|
|
3513
|
+
*
|
|
3514
|
+
* ```typescript
|
|
3515
|
+
* import { ActionPanel, Form, Action } from "@raycast/api";
|
|
3516
|
+
* import fs from "fs";
|
|
3517
|
+
*
|
|
3518
|
+
* export default function Command() {
|
|
3519
|
+
* return (
|
|
3520
|
+
* <Form
|
|
3521
|
+
* actions={
|
|
3522
|
+
* <ActionPanel>
|
|
3523
|
+
* <Action.SubmitForm title="Submit Name" onSubmit={(values) => {
|
|
3524
|
+
* const file = values.file[0]
|
|
3525
|
+
* if (fs.existsSync(file) && fs.lstatSync(file).isFile()) {
|
|
3526
|
+
* // do something with the file
|
|
3527
|
+
* }
|
|
3528
|
+
* } />
|
|
3529
|
+
* </ActionPanel>
|
|
3530
|
+
* }
|
|
3531
|
+
* >
|
|
3532
|
+
* <Form.FilePicker id="file" allowMultipleSelection={false} />
|
|
3533
|
+
* </Form>
|
|
3534
|
+
* );
|
|
3535
|
+
* }
|
|
3536
|
+
* ```
|
|
3537
|
+
*
|
|
3538
|
+
* @example
|
|
3539
|
+
* Directory picker
|
|
3540
|
+
*
|
|
3541
|
+
* ```typescript
|
|
3542
|
+
* import { ActionPanel, Form, Action } from "@raycast/api";
|
|
3543
|
+
* import fs from "fs";
|
|
3544
|
+
*
|
|
3545
|
+
* export default function Command() {
|
|
3546
|
+
* return (
|
|
3547
|
+
* <Form
|
|
3548
|
+
* actions={
|
|
3549
|
+
* <ActionPanel>
|
|
3550
|
+
* <Action.SubmitForm title="Submit Name" onSubmit={(values) => {
|
|
3551
|
+
* const file = values.file[0]
|
|
3552
|
+
* if (fs.existsSync(file) && fs.lstatSync(file).isDirectory()) {
|
|
3553
|
+
* // do something with the directory
|
|
3554
|
+
* }
|
|
3555
|
+
* } />
|
|
3556
|
+
* </ActionPanel>
|
|
3557
|
+
* }
|
|
3558
|
+
* >
|
|
3559
|
+
* <Form.FilePicker id="file" allowMultipleSelection={false} canChooseDirectories canChooseFiles={false} />
|
|
3560
|
+
* </Form>
|
|
3561
|
+
* );
|
|
3562
|
+
* }
|
|
3563
|
+
* ```
|
|
3564
|
+
*
|
|
3565
|
+
* @example
|
|
3566
|
+
* Controlled file picker
|
|
3567
|
+
*
|
|
3568
|
+
* ```typescript
|
|
3569
|
+
* import { ActionPanel, Form, Action } from "@raycast/api";
|
|
3570
|
+
* import { useState } from "react";
|
|
3571
|
+
*
|
|
3572
|
+
* export default function Command() {
|
|
3573
|
+
* const [files, setFiles] = useState<string[]>([]);
|
|
3574
|
+
*
|
|
3575
|
+
* return (
|
|
3576
|
+
* <Form
|
|
3577
|
+
* actions={
|
|
3578
|
+
* <ActionPanel>
|
|
3579
|
+
* <Action.SubmitForm title="Submit Name" onSubmit={(values) => console.log(values)} />
|
|
3580
|
+
* </ActionPanel>
|
|
3581
|
+
* }
|
|
3582
|
+
* >
|
|
3583
|
+
* <Form.FilePicker id="files" value={files} onChange={setFiles} />
|
|
3584
|
+
* </Form>
|
|
3585
|
+
* );
|
|
3586
|
+
* }
|
|
3587
|
+
* ```
|
|
3588
|
+
*/
|
|
3589
|
+
FilePicker: typeof FilePicker;
|
|
3371
3590
|
}
|
|
3372
3591
|
|
|
3373
3592
|
/**
|
|
@@ -4012,7 +4231,7 @@ declare interface GridProps extends ActionsInterface, NavigationChildInterface {
|
|
|
4012
4231
|
* Callback triggered when the search bar text changes.
|
|
4013
4232
|
*
|
|
4014
4233
|
* @remarks
|
|
4015
|
-
* Specifying this implicitly toggles `
|
|
4234
|
+
* Specifying this implicitly toggles `filtering` to false. To enable native filtering when using `onSearchTextChange`, explicitly set `filtering` to true.
|
|
4016
4235
|
*/
|
|
4017
4236
|
onSearchTextChange?: (text: string) => void;
|
|
4018
4237
|
}
|
|
@@ -4109,9 +4328,13 @@ export declare enum Icon {
|
|
|
4109
4328
|
Checkmark = "check-circle-16",
|
|
4110
4329
|
ChessPiece = "chess-piece-16",
|
|
4111
4330
|
ChevronDown = "chevron-down-16",
|
|
4331
|
+
ChevronDownSmall = "chevron-down-small-16",
|
|
4112
4332
|
ChevronLeft = "chevron-left-16",
|
|
4333
|
+
ChevronLeftSmall = "chevron-left-small-16",
|
|
4113
4334
|
ChevronRight = "chevron-right-16",
|
|
4335
|
+
ChevronRightSmall = "chevron-right-small-16",
|
|
4114
4336
|
ChevronUp = "chevron-up-16",
|
|
4337
|
+
ChevronUpSmall = "chevron-up-small-16",
|
|
4115
4338
|
Circle = "circle-16",
|
|
4116
4339
|
CircleEllipsis = "circle-ellipsis-16",
|
|
4117
4340
|
CircleFilled = "circle-filled-16",
|
|
@@ -4207,6 +4430,7 @@ export declare enum Icon {
|
|
|
4207
4430
|
Link = "link-16",
|
|
4208
4431
|
List = "app-window-list-16",
|
|
4209
4432
|
Livestream = "livestream-01-16",
|
|
4433
|
+
LivestreamDisabled = "livestream-disabled-01-16",
|
|
4210
4434
|
Lock = "lock-16",
|
|
4211
4435
|
LockDisabled = "lock-disabled-16",
|
|
4212
4436
|
LockUnlocked = "lock-unlocked-16",
|
|
@@ -6892,6 +7116,10 @@ declare interface SubmenuProps {
|
|
|
6892
7116
|
* ```
|
|
6893
7117
|
*/
|
|
6894
7118
|
onOpen?: () => void;
|
|
7119
|
+
/**
|
|
7120
|
+
* Indicates whether the ActionPanel.Submenu should be focused automatically when the parent ActionPanel (or Actionpanel.Submenu) opens.
|
|
7121
|
+
*/
|
|
7122
|
+
autoFocus?: boolean;
|
|
6895
7123
|
}
|
|
6896
7124
|
|
|
6897
7125
|
declare interface SubmenuProps_2 {
|