@raycast/api 1.31.0 → 1.32.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.
Files changed (83) hide show
  1. package/README.md +2 -2
  2. package/bin/arm64/ray +0 -0
  3. package/bin/ray +10 -4
  4. package/bin/x86/ray +0 -0
  5. package/package.json +2 -2
  6. package/types/index.d.ts +5192 -0
  7. package/types/api/app/app.d.ts +0 -171
  8. package/types/api/app/clipboard.d.ts +0 -63
  9. package/types/api/app/index.d.ts +0 -4
  10. package/types/api/app/keyboard.d.ts +0 -56
  11. package/types/api/app/localStorage.d.ts +0 -117
  12. package/types/api/components/ActionPanel.d.ts +0 -261
  13. package/types/api/components/Detail.d.ts +0 -263
  14. package/types/api/components/Form.d.ts +0 -1016
  15. package/types/api/components/List.d.ts +0 -738
  16. package/types/api/components/actions/Action.d.ts +0 -458
  17. package/types/api/components/actions/CopyToClipboardAction.d.ts +0 -40
  18. package/types/api/components/actions/CreateQuicklinkAction.d.ts +0 -42
  19. package/types/api/components/actions/CreateSnippetAction.d.ts +0 -40
  20. package/types/api/components/actions/OpenAction.d.ts +0 -47
  21. package/types/api/components/actions/OpenInBrowserAction.d.ts +0 -43
  22. package/types/api/components/actions/OpenWithAction.d.ts +0 -40
  23. package/types/api/components/actions/PasteAction.d.ts +0 -40
  24. package/types/api/components/actions/PushAction.d.ts +0 -38
  25. package/types/api/components/actions/ShowInFinderAction.d.ts +0 -42
  26. package/types/api/components/actions/SubmitFormAction.d.ts +0 -35
  27. package/types/api/components/actions/TrashAction.d.ts +0 -43
  28. package/types/api/components/actions/index.d.ts +0 -1
  29. package/types/api/components/index.d.ts +0 -5
  30. package/types/api/components/propTypes.d.ts +0 -1
  31. package/types/api/components/types.d.ts +0 -30
  32. package/types/api/deprecated.d.ts +0 -415
  33. package/types/api/environment/environment.d.ts +0 -53
  34. package/types/api/environment/index.d.ts +0 -3
  35. package/types/api/environment/preferences.d.ts +0 -31
  36. package/types/api/environment/workspace.d.ts +0 -62
  37. package/types/api/hooks/index.d.ts +0 -1
  38. package/types/api/hooks/useNavigation.d.ts +0 -66
  39. package/types/api/index.d.ts +0 -6
  40. package/types/api/internal/comm/index.d.ts +0 -1
  41. package/types/api/internal/components/ErrorBoundary.d.ts +0 -1
  42. package/types/api/internal/components/Navigation.d.ts +0 -1
  43. package/types/api/internal/components/Root.d.ts +0 -1
  44. package/types/api/internal/components/index.d.ts +0 -3
  45. package/types/api/internal/devtools/actionPanel.d.ts +0 -1
  46. package/types/api/internal/devtools/index.d.ts +0 -2
  47. package/types/api/internal/devtools/react.d.ts +0 -1
  48. package/types/api/internal/hooks/index.d.ts +0 -1
  49. package/types/api/internal/hooks/useId.d.ts +0 -1
  50. package/types/api/internal/index.d.ts +0 -6
  51. package/types/api/internal/rendering/callbacks.d.ts +0 -1
  52. package/types/api/internal/rendering/index.d.ts +0 -6
  53. package/types/api/internal/rendering/logger.d.ts +0 -4
  54. package/types/api/internal/rendering/node-builders/actions.d.ts +0 -3
  55. package/types/api/internal/rendering/node-builders/detail.d.ts +0 -4
  56. package/types/api/internal/rendering/node-builders/forms.d.ts +0 -3
  57. package/types/api/internal/rendering/node-builders/keyboard.d.ts +0 -1
  58. package/types/api/internal/rendering/node-builders/list.d.ts +0 -5
  59. package/types/api/internal/rendering/node-builders/navigationStack.d.ts +0 -1
  60. package/types/api/internal/rendering/node-builders/root.d.ts +0 -1
  61. package/types/api/internal/rendering/node-builders/types.d.ts +0 -1
  62. package/types/api/internal/rendering/node-builders/utils.d.ts +0 -1
  63. package/types/api/internal/rendering/reconciler/index.d.ts +0 -2
  64. package/types/api/internal/rendering/reconciler/instance.d.ts +0 -3
  65. package/types/api/internal/rendering/reconciler/noHydratation.d.ts +0 -37
  66. package/types/api/internal/rendering/reconciler/noMutation.d.ts +0 -18
  67. package/types/api/internal/rendering/renderer.d.ts +0 -1
  68. package/types/api/internal/utils/ids.d.ts +0 -1
  69. package/types/api/internal/utils/index.d.ts +0 -4
  70. package/types/api/internal/utils/internal-children.d.ts +0 -26
  71. package/types/api/internal/utils/invariant.d.ts +0 -4
  72. package/types/api/internal/utils/propTypes.d.ts +0 -3
  73. package/types/api/ui/color.d.ts +0 -115
  74. package/types/api/ui/errors.d.ts +0 -1
  75. package/types/api/ui/feedback/alert.d.ts +0 -97
  76. package/types/api/ui/feedback/hud.d.ts +0 -16
  77. package/types/api/ui/feedback/index.d.ts +0 -3
  78. package/types/api/ui/feedback/toast.d.ts +0 -174
  79. package/types/api/ui/icon.d.ts +0 -89
  80. package/types/api/ui/image.d.ts +0 -162
  81. package/types/api/ui/index.d.ts +0 -5
  82. package/types/core/message-types.d.ts +0 -17
  83. package/types/core/preferences.d.ts +0 -69
@@ -1,1016 +0,0 @@
1
- import { ReactElement, ReactNode } from "react";
2
- import { Image } from "../ui";
3
- import { ActionsInterface, NavigationChildInterface } from "./types";
4
- import PropTypes from "prop-types";
5
- /**
6
- * Shows a list of form items such as {@link Form.TextField}, {@link Form.Checkbox} or {@link Form.Dropdown}.
7
- */
8
- export declare function Form(props: Form.Props): ReactElement<Form.Props>;
9
- export declare namespace Form {
10
- var propTypes: {
11
- submitTitle: PropTypes.Requireable<string>;
12
- navigationTitle: PropTypes.Requireable<string>;
13
- isLoading: PropTypes.Requireable<boolean>;
14
- };
15
- var displayName: string;
16
- }
17
- /**
18
- * See {@link Form.TextField}
19
- */
20
- declare function FormTextField(props: Form.TextField.Props): ReactElement<Form.TextField.Props>;
21
- declare namespace FormTextField {
22
- var propTypes: {
23
- id: PropTypes.Validator<string>;
24
- title: PropTypes.Requireable<string>;
25
- storeValue: PropTypes.Requireable<boolean>;
26
- value: PropTypes.Requireable<string>;
27
- defaultValue: PropTypes.Requireable<string>;
28
- placeholder: PropTypes.Requireable<string>;
29
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
30
- };
31
- var displayName: string;
32
- }
33
- /**
34
- * See {@link Form.PasswordField}
35
- */
36
- declare function FormPasswordField(props: Form.PasswordField.Props): ReactElement<Form.PasswordField.Props>;
37
- declare namespace FormPasswordField {
38
- var propTypes: {
39
- id: PropTypes.Validator<string>;
40
- title: PropTypes.Requireable<string>;
41
- storeValue: PropTypes.Requireable<boolean>;
42
- value: PropTypes.Requireable<string>;
43
- defaultValue: PropTypes.Requireable<string>;
44
- placeholder: PropTypes.Requireable<string>;
45
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
46
- };
47
- var displayName: string;
48
- }
49
- /**
50
- * See {@link Form.TextArea}
51
- */
52
- declare function FormTextArea(props: Form.TextArea.Props): ReactElement<Form.TextArea.Props>;
53
- declare namespace FormTextArea {
54
- var propTypes: {
55
- id: PropTypes.Validator<string>;
56
- title: PropTypes.Requireable<string>;
57
- storeValue: PropTypes.Requireable<boolean>;
58
- value: PropTypes.Requireable<string>;
59
- defaultValue: PropTypes.Requireable<string>;
60
- placeholder: PropTypes.Requireable<string>;
61
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
62
- };
63
- var displayName: string;
64
- }
65
- /**
66
- * See {@link Form.Checkbox}
67
- */
68
- declare function FormCheckbox(props: Form.Checkbox.Props): ReactElement<Form.Checkbox.Props>;
69
- declare namespace FormCheckbox {
70
- var propTypes: {
71
- id: PropTypes.Validator<string>;
72
- title: PropTypes.Requireable<string>;
73
- storeValue: PropTypes.Requireable<boolean>;
74
- value: PropTypes.Requireable<boolean>;
75
- defaultValue: PropTypes.Requireable<boolean>;
76
- label: PropTypes.Requireable<string>;
77
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
78
- };
79
- var displayName: string;
80
- }
81
- /**
82
- * See {@link Form.DatePicker}
83
- */
84
- declare function FormDatePicker(props: Form.DatePicker.Props): ReactElement<Form.DatePicker.Props>;
85
- declare namespace FormDatePicker {
86
- var propTypes: {
87
- id: PropTypes.Validator<string>;
88
- title: PropTypes.Requireable<string>;
89
- storeValue: PropTypes.Requireable<boolean>;
90
- value: PropTypes.Requireable<Date>;
91
- defaultValue: PropTypes.Requireable<Date>;
92
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
93
- };
94
- var displayName: string;
95
- }
96
- /**
97
- * See {@link Form.Separator}
98
- */
99
- declare function FormSeparator(): ReactElement<Form.Separator.Props>;
100
- declare namespace FormSeparator {
101
- var displayName: string;
102
- }
103
- /**
104
- * See {@link Form.Description}
105
- */
106
- declare function FormDescription(props: Form.Description.Props): ReactElement<Form.Description.Props>;
107
- declare namespace FormDescription {
108
- var propTypes: {
109
- text: PropTypes.Requireable<string>;
110
- };
111
- var displayName: string;
112
- }
113
- /**
114
- * See {@link Form.Dropdown}
115
- */
116
- declare function FormDropdown(props: Form.Dropdown.Props): ReactElement<Form.Dropdown.Props>;
117
- declare namespace FormDropdown {
118
- var propTypes: {
119
- id: PropTypes.Validator<string>;
120
- title: PropTypes.Requireable<string>;
121
- storeValue: PropTypes.Requireable<boolean>;
122
- value: PropTypes.Requireable<string>;
123
- defaultValue: PropTypes.Requireable<string>;
124
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
125
- };
126
- var displayName: string;
127
- }
128
- /**
129
- * See {@link Form.Dropdown.Section}
130
- */
131
- declare function FormDropdownSection(props: Form.Dropdown.Section.Props): ReactElement<Form.Dropdown.Section.Props>;
132
- declare namespace FormDropdownSection {
133
- var propTypes: {
134
- title: PropTypes.Requireable<string>;
135
- };
136
- var displayName: string;
137
- }
138
- /**
139
- * See {@link Form.Dropdown.Item}
140
- */
141
- declare function FormDropdownItem(props: Form.Dropdown.Item.Props): ReactElement<Form.Dropdown.Item.Props>;
142
- declare namespace FormDropdownItem {
143
- var propTypes: {
144
- value: PropTypes.Requireable<string>;
145
- title: PropTypes.Validator<string>;
146
- icon: PropTypes.Requireable<string | Required<PropTypes.InferProps<{
147
- fileIcon: PropTypes.Validator<string>;
148
- }>> | PropTypes.InferProps<{
149
- source: PropTypes.Requireable<string | PropTypes.InferProps<{
150
- light: PropTypes.Validator<string>;
151
- dark: PropTypes.Validator<string>;
152
- }>>;
153
- fallback: PropTypes.Requireable<string | PropTypes.InferProps<{
154
- light: PropTypes.Validator<string>;
155
- dark: PropTypes.Validator<string>;
156
- }>>;
157
- mask: PropTypes.Requireable<Image.Mask>;
158
- tintColor: PropTypes.Requireable<string | PropTypes.InferProps<{
159
- light: PropTypes.Validator<string>;
160
- dark: PropTypes.Validator<string>;
161
- adjustContrast: PropTypes.Requireable<boolean>;
162
- }>>;
163
- }>>;
164
- };
165
- var displayName: string;
166
- }
167
- /**
168
- * See {@link Form.TagPicker}
169
- */
170
- declare function FormTagPicker(props: Form.TagPicker.Props): ReactElement<Form.TagPicker.Props>;
171
- declare namespace FormTagPicker {
172
- var propTypes: {
173
- id: PropTypes.Validator<string>;
174
- title: PropTypes.Requireable<string>;
175
- storeValue: PropTypes.Requireable<boolean>;
176
- placeholder: PropTypes.Requireable<string>;
177
- value: PropTypes.Requireable<string[]>;
178
- defaultValue: PropTypes.Requireable<string[]>;
179
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
180
- };
181
- var displayName: string;
182
- }
183
- /**
184
- * See {@link Form.TagPicker.Item}
185
- */
186
- declare function FormTagPickerItem(props: Form.TagPicker.Item.Props): ReactElement<Form.TagPicker.Item.Props>;
187
- declare namespace FormTagPickerItem {
188
- var propTypes: {
189
- value: PropTypes.Validator<string>;
190
- title: PropTypes.Validator<string>;
191
- icon: PropTypes.Requireable<string | Required<PropTypes.InferProps<{
192
- fileIcon: PropTypes.Validator<string>;
193
- }>> | PropTypes.InferProps<{
194
- source: PropTypes.Requireable<string | PropTypes.InferProps<{
195
- light: PropTypes.Validator<string>;
196
- dark: PropTypes.Validator<string>;
197
- }>>;
198
- fallback: PropTypes.Requireable<string | PropTypes.InferProps<{
199
- light: PropTypes.Validator<string>;
200
- dark: PropTypes.Validator<string>;
201
- }>>;
202
- mask: PropTypes.Requireable<Image.Mask>;
203
- tintColor: PropTypes.Requireable<string | PropTypes.InferProps<{
204
- light: PropTypes.Validator<string>;
205
- dark: PropTypes.Validator<string>;
206
- adjustContrast: PropTypes.Requireable<boolean>;
207
- }>>;
208
- }>>;
209
- };
210
- var displayName: string;
211
- }
212
- declare namespace FormDropdown {
213
- /**
214
- * Visually separated group of dropdown items.
215
- *
216
- * @remarks
217
- * Use sections to group related menu items together.
218
- *
219
- * @example
220
- * ```typescript
221
- * import { ActionPanel, Form, Action } from "@raycast/api";
222
- *
223
- * export default function Command() {
224
- * return (
225
- * <Form
226
- * actions={
227
- * <ActionPanel>
228
- * <Action.SubmitForm title="Submit Favorite" onSubmit={(values) => console.log(values)} />
229
- * </ActionPanel>
230
- * }
231
- * >
232
- * <Form.Dropdown id="food" title="Favorite Food">
233
- * <Form.Dropdown.Section title="Fruits">
234
- * <Form.Dropdown.Item value="apple" title="Apple" icon="🍎" />
235
- * <Form.Dropdown.Item value="banana" title="Banana" icon="🍌" />
236
- * </Form.Dropdown.Section>
237
- * <Form.Dropdown.Section title="Vegetables">
238
- * <Form.Dropdown.Item value="broccoli" title="Broccoli" icon="🥦" />
239
- * <Form.Dropdown.Item value="carrot" title="Carrot" icon="🥕" />
240
- * </Form.Dropdown.Section>
241
- * </Form.Dropdown>
242
- * </Form>
243
- * );
244
- * }
245
- * ```
246
- */
247
- const Section: typeof FormDropdownSection;
248
- /**
249
- * A dropdown item in a {@link Form.Dropdown}
250
- *
251
- * @example
252
- * ```typescript
253
- * import { ActionPanel, Form, Action } from "@raycast/api";
254
- *
255
- * export default function Command() {
256
- * return (
257
- * <Form
258
- * actions={
259
- * <ActionPanel>
260
- * <Action.SubmitForm title="Submit Icon" onSubmit={(values) => console.log(values)} />
261
- * </ActionPanel>
262
- * }
263
- * >
264
- * <Form.Dropdown id="icon" title="Icon">
265
- * <Form.Dropdown.Item value="circle" title="Cirlce" icon={Icon.Circle} />
266
- * </Form.Dropdown>
267
- * </Form>
268
- * );
269
- * }
270
- * ```
271
- */
272
- const Item: typeof FormDropdownItem;
273
- }
274
- declare namespace FormTagPicker {
275
- /**
276
- * A tag picker item in a {@link Form.TagPicker}.
277
- *
278
- * @example
279
- * ```typescript
280
- * import { ActionPanel, Color, Form, Icon, Action } from "@raycast/api";
281
- *
282
- * export default function Command() {
283
- * return (
284
- * <Form
285
- * actions={
286
- * <ActionPanel>
287
- * <Action.SubmitForm title="Submit Color" onSubmit={(values) => console.log(values)} />
288
- * </ActionPanel>
289
- * }
290
- * >
291
- * <Form.TagPicker id="color" title="Color">
292
- * <Form.TagPicker.Item value="red" title="Red" icon={{ source: Icon.Circle, tintColor: Color.Red }} />
293
- * <Form.TagPicker.Item value="green" title="Green" icon={{ source: Icon.Circle, tintColor: Color.Green }} />
294
- * <Form.TagPicker.Item value="blue" title="Blue" icon={{ source: Icon.Circle, tintColor: Color.Blue }} />
295
- * </Form.TagPicker>
296
- * </Form>
297
- * );
298
- * }
299
- * ```
300
- */
301
- const Item: typeof FormTagPickerItem;
302
- }
303
- declare enum FormDatePickerType {
304
- /**
305
- * Only year, month, and day can be picked
306
- */
307
- Date = "date",
308
- /**
309
- * hour and second can be picked in addition to year, month and day
310
- */
311
- DateTime = "date_time"
312
- }
313
- declare namespace FormDatePicker {
314
- /**
315
- * The types of date components the user can pick
316
- * * `Date` – only year, month, and day can be picked
317
- * * `DateTime` – hour and second can be picked in addition to year, month and day
318
- */
319
- const Type: typeof FormDatePickerType;
320
- }
321
- export declare namespace Form {
322
- /**
323
- * @deprecated Use `Form.Dropdown.Section` instead.
324
- */
325
- const DropdownSection: typeof FormDropdownSection;
326
- /**
327
- * @deprecated Use `Form.Dropdown.Item` instead.
328
- */
329
- const DropdownItem: typeof FormDropdownItem;
330
- /**
331
- * @deprecated Use `Form.TagPicker.Item` instead.
332
- */
333
- const TagPickerItem: typeof FormTagPickerItem;
334
- /**
335
- * A form item with a text field for input.
336
- *
337
- * @example
338
- * Uncontrolled text field
339
- *
340
- * ```typescript
341
- * import { ActionPanel, Form, Action } from "@raycast/api";
342
- *
343
- * export default function Command() {
344
- * return (
345
- * <Form
346
- * actions={
347
- * <ActionPanel>
348
- * <Action.SubmitForm title="Submit Name" onSubmit={(values) => console.log(values)} />
349
- * </ActionPanel>
350
- * }
351
- * >
352
- * <Form.TextField id="name" defaultValue="Steve" />
353
- * </Form>
354
- * );
355
- * }
356
- * ```
357
- *
358
- * @example
359
- * Controlled text field
360
- *
361
- * ```typescript
362
- * import { ActionPanel, Form, Action } from "@raycast/api";
363
- * import { useState } from "react";
364
- *
365
- * export default function Command() {
366
- * const [name, setName] = useState<string>();
367
- *
368
- * return (
369
- * <Form
370
- * actions={
371
- * <ActionPanel>
372
- * <Action.SubmitForm title="Submit Name" onSubmit={(values) => console.log(values)} />
373
- * </ActionPanel>
374
- * }
375
- * >
376
- * <Form.TextField id="name" value={name} onChange={setName} />
377
- * </Form>
378
- * );
379
- * }
380
- * ```
381
- */
382
- const TextField: typeof FormTextField;
383
- /**
384
- * A form item with a text area for input.
385
- * The item supports multiline text entry.
386
- *
387
- * @example
388
- * Uncontrolled text area
389
- *
390
- * ```typescript
391
- * import { ActionPanel, Form, Action } from "@raycast/api";
392
- *
393
- * const DESCRIPTION =
394
- * "We spend too much time staring at loading indicators. The Raycast team is dedicated to make everybody interact faster with their computers.";
395
- *
396
- * export default function Command() {
397
- * return (
398
- * <Form
399
- * actions={
400
- * <ActionPanel>
401
- * <Action.SubmitForm title="Submit Description" onSubmit={(values) => console.log(values)} />
402
- * </ActionPanel>
403
- * }
404
- * >
405
- * <Form.TextArea id="description" defaultValue={DESCRIPTION} />
406
- * </Form>
407
- * );
408
- * }
409
- * ```
410
- *
411
- * @example
412
- * Controlled text area
413
- *
414
- * ```typescript
415
- * import { ActionPanel, Form, Action } from "@raycast/api";
416
- * import { useState } from "react";
417
- *
418
- * export default function Command() {
419
- * const [description, setDescription] = useState<string>();
420
- *
421
- * return (
422
- * <Form
423
- * actions={
424
- * <ActionPanel>
425
- * <Action.SubmitForm title="Submit Description" onSubmit={(values) => console.log(values)} />
426
- * </ActionPanel>
427
- * }
428
- * >
429
- * <Form.TextArea id="description" value={description} onChange={setDescription} />
430
- * </Form>
431
- * );
432
- * }
433
- * ```
434
- */
435
- const TextArea: typeof FormTextArea;
436
- /**
437
- * A form item with a checkbox.
438
- *
439
- * @example
440
- * Uncontrolled checkbox
441
- *
442
- * ```typescript
443
- * import { ActionPanel, Form, Action } from "@raycast/api";
444
- *
445
- * export default function Command() {
446
- * return (
447
- * <Form
448
- * actions={
449
- * <ActionPanel>
450
- * <Action.SubmitForm title="Submit Answer" onSubmit={(values) => console.log(values)} />
451
- * </ActionPanel>
452
- * }
453
- * >
454
- * <Form.Checkbox id="answer" label="Are you happy?" defaultValue={true} />
455
- * </Form>
456
- * );
457
- * }
458
- * ```
459
- *
460
- * @example
461
- * Controlled checkbox
462
- *
463
- * ```typescript
464
- * import { ActionPanel, Form, Action } from "@raycast/api";
465
- * import { useState } from "react";
466
- *
467
- * export default function Command() {
468
- * const [checked, setChecked] = useState(true);
469
- *
470
- * return (
471
- * <Form
472
- * actions={
473
- * <ActionPanel>
474
- * <Action.SubmitForm title="Submit Answer" onSubmit={(values) => console.log(values)} />
475
- * </ActionPanel>
476
- * }
477
- * >
478
- * <Form.Checkbox id="answer" label="Do you like orange juice?" value={checked} onChange={setChecked} />
479
- * </Form>
480
- * );
481
- * }
482
- * ```
483
- */
484
- const Checkbox: typeof FormCheckbox;
485
- /**
486
- * A form item with a date picker.
487
- *
488
- * @example
489
- * Uncontrolled date picker
490
- *
491
- * ```typescript
492
- * import { ActionPanel, Form, Action } from "@raycast/api";
493
- *
494
- * export default function Command() {
495
- * return (
496
- * <Form
497
- * actions={
498
- * <ActionPanel>
499
- * <Action.SubmitForm title="Submit Form" onSubmit={(values) => console.log(values)} />
500
- * </ActionPanel>
501
- * }
502
- * >
503
- * <Form.DatePicker id="dateOfBirth" title="Date of Birth" defaultValue={new Date(1955, 1, 24)} />
504
- * </Form>
505
- * );
506
- * }
507
- * ```
508
- *
509
- * @example
510
- * Controlled date picker
511
- *
512
- * ```typescript
513
- * import { ActionPanel, Form, Action } from "@raycast/api";
514
- * import { useState } from "react";
515
- *
516
- * export default function Command() {
517
- * const [date, setDate] = useState<Date>();
518
- *
519
- * return (
520
- * <Form
521
- * actions={
522
- * <ActionPanel>
523
- * <Action.SubmitForm title="Submit Form" onSubmit={(values) => console.log(values)} />
524
- * </ActionPanel>
525
- * }
526
- * >
527
- * <Form.DatePicker id="launchDate" title="Launch Date" value={date} onChange={setDate} />
528
- * </Form>
529
- * );
530
- * }
531
- * ```
532
- */
533
- const DatePicker: typeof FormDatePicker;
534
- /**
535
- * A form item that shows a separator line.
536
- * Use for grouping and visually separating form items.
537
- *
538
- * @example
539
- * ```typescript
540
- * import { ActionPanel, Form, Action } from "@raycast/api";
541
- *
542
- * export default function Command() {
543
- * return (
544
- * <Form
545
- * actions={
546
- * <ActionPanel>
547
- * <Action.SubmitForm title="Submit Form" onSubmit={(values) => console.log(values)} />
548
- * </ActionPanel>
549
- * }
550
- * >
551
- * <Form.TextField id="textfield" />
552
- * <Form.Separator />
553
- * <Form.TextArea id="textarea" />
554
- * </Form>
555
- * );
556
- * }
557
- * ```
558
- */
559
- const Separator: typeof FormSeparator;
560
- /**
561
- * A form item with a dropdown menu.
562
- *
563
- * @example
564
- * Uncontrolled dropdown
565
- *
566
- * ```typescript
567
- * import { ActionPanel, Form, Action } from "@raycast/api";
568
- *
569
- * export default function Command() {
570
- * return (
571
- * <Form
572
- * actions={
573
- * <ActionPanel>
574
- * <Action.SubmitForm title="Submit Favorite" onSubmit={(values) => console.log(values)} />
575
- * </ActionPanel>
576
- * }
577
- * >
578
- * <Form.Dropdown id="emoji" title="Favorite Emoji" defaultValue="lol">
579
- * <Form.Dropdown.Item value="poop" title="Pile of poop" icon="💩" />
580
- * <Form.Dropdown.Item value="rocket" title="Rocket" icon="🚀" />
581
- * <Form.Dropdown.Item value="lol" title="Rolling on the floor laughing face" icon="🤣" />
582
- * </Form.Dropdown>
583
- * </Form>
584
- * );
585
- * }
586
- * ```
587
- *
588
- * @example
589
- * Controlled dropdown
590
- *
591
- * ```typescript
592
- * import { ActionPanel, Form, Action } from "@raycast/api";
593
- * import { useState } from "react";
594
- *
595
- * export default function Command() {
596
- * const [programmingLanguage, setProgrammingLanguage] = useState<string>("typescript");
597
- *
598
- * return (
599
- * <Form
600
- * actions={
601
- * <ActionPanel>
602
- * <Action.SubmitForm title="Submit Favorite" onSubmit={(values) => console.log(values)} />
603
- * </ActionPanel>
604
- * }
605
- * >
606
- * <Form.Dropdown
607
- * id="dropdown"
608
- * title="Favorite Language"
609
- * value={programmingLanguage}
610
- * onChange={setProgrammingLanguage}
611
- * >
612
- * <Form.Dropdown.Item value="cpp" title="C++" />
613
- * <Form.Dropdown.Item value="javascript" title="JavaScript" />
614
- * <Form.Dropdown.Item value="ruby" title="Ruby" />
615
- * <Form.Dropdown.Item value="python" title="Python" />
616
- * <Form.Dropdown.Item value="swift" title="Swift" />
617
- * <Form.Dropdown.Item value="typescript" title="TypeScript" />
618
- * </Form.Dropdown>
619
- * </Form>
620
- * );
621
- * }
622
- * ```
623
- */
624
- const Dropdown: typeof FormDropdown;
625
- /**
626
- * A form item with a tag picker that allows the user to select multiple items.
627
- *
628
- * @example
629
- * Uncontrolled tag picker
630
- *
631
- * ```typescript
632
- * import { ActionPanel, Form, Action } from "@raycast/api";
633
- *
634
- * export default function Command() {
635
- * return (
636
- * <Form
637
- * actions={
638
- * <ActionPanel>
639
- * <Action.SubmitForm title="Submit Favorite" onSubmit={(values) => console.log(values)} />
640
- * </ActionPanel>
641
- * }
642
- * >
643
- * <Form.TagPicker id="sports" title="Favorite Sports" defaultValue={["football"]}>
644
- * <Form.TagPicker.Item value="basketball" title="Basketball" icon="🏀" />
645
- * <Form.TagPicker.Item value="football" title="Football" icon="⚽️" />
646
- * <Form.TagPicker.Item value="tennis" title="Tennis" icon="🎾" />
647
- * </Form.TagPicker>
648
- * </Form>
649
- * );
650
- * }
651
- * ```
652
- *
653
- * @example
654
- * Controlled tag picker
655
- *
656
- * ```typescript
657
- * import { ActionPanel, Form, Action } from "@raycast/api";
658
- * import { useState } from "react";
659
- *
660
- * export default function Command() {
661
- * const [countries, setCountries] = useState<string[]>(["ger", "ned", "pol"]);
662
- *
663
- * return (
664
- * <Form
665
- * actions={
666
- * <ActionPanel>
667
- * <Action.SubmitForm title="Submit Countries" onSubmit={(values) => console.log(values)} />
668
- * </ActionPanel>
669
- * }
670
- * >
671
- * <Form.TagPicker id="countries" title="Visited Countries" value={countries} onChange={setCountries}>
672
- * <Form.TagPicker.Item value="ger" title="Germany" icon="🇩🇪" />
673
- * <Form.TagPicker.Item value="ind" title="India" icon="🇮🇳" />
674
- * <Form.TagPicker.Item value="ned" title="Netherlands" icon="🇳🇱" />
675
- * <Form.TagPicker.Item value="nor" title="Norway" icon="🇳🇴" />
676
- * <Form.TagPicker.Item value="pol" title="Poland" icon="🇵🇱" />
677
- * <Form.TagPicker.Item value="rus" title="Russia" icon="🇷🇺" />
678
- * <Form.TagPicker.Item value="sco" title="Scotland" icon="🏴󠁧󠁢󠁳󠁣󠁴󠁿" />
679
- * </Form.TagPicker>
680
- * </Form>
681
- * );
682
- * }
683
- * ```
684
- */
685
- const TagPicker: typeof FormTagPicker;
686
- /**
687
- * A form item with a secure text field for password-entry in which the entered characters must be kept secret.
688
- *
689
- * @example
690
- * Uncontrolled password field
691
- *
692
- * ```typescript
693
- * import { ActionPanel, Form, Action } from "@raycast/api";
694
- *
695
- * export default function Command() {
696
- * return (
697
- * <Form
698
- * actions={
699
- * <ActionPanel>
700
- * <Action.SubmitFormAction title="Submit Password" onSubmit={(values) => console.log(values)} />
701
- * </ActionPanel>
702
- * }
703
- * >
704
- * <Form.PasswordField id="password" title="Enter Password" />
705
- * </Form>
706
- * );
707
- * }
708
- * ```
709
- *
710
- * @example
711
- * Controlled password field
712
- *
713
- * ```typescript
714
- * import { ActionPanel, Form, Action } from "@raycast/api";
715
- * import { useState } from "react";
716
- *
717
- * export default function Command() {
718
- * const [password, setPassword] = useState<string>();
719
- *
720
- * return (
721
- * <Form
722
- * actions={
723
- * <ActionPanel>
724
- * <Action.SubmitForm title="Submit Password" onSubmit={(values) => console.log(values)} />
725
- * </ActionPanel>
726
- * }
727
- * >
728
- * <Form.PasswordField id="password" value={password} onChange={setPassword} />
729
- * </Form>
730
- * );
731
- * }
732
- * ```
733
- */
734
- const PasswordField: typeof FormPasswordField;
735
- /**
736
- * A form item with a simple text label.
737
- *
738
- * @remarks Do *not* use this component to show validation messages for other form fields.
739
- *
740
- * @example
741
- * Label
742
- *
743
- * ```typescript
744
- * import { ActionPanel, Form, Action } from "@raycast/api";
745
- *
746
- * export default function Command() {
747
- * return (
748
- * <Form
749
- * actions={
750
- * <ActionPanel>
751
- * <Action.SubmitForm title="Submit" onSubmit={(values) => console.log(values)} />
752
- * </ActionPanel>
753
- * }
754
- * >
755
- * <Form.Description title="Import / Export" text="Exporting will back-up your preferences, quicklinks, snippets, floating notes, script-command folder paths, aliases, hotkeys, favorites and other data." />
756
- * </Form>
757
- * );
758
- * }
759
- * ```
760
- */
761
- const Description: typeof FormDescription;
762
- /**
763
- * Props of the {@link Form} React component.
764
- *
765
- * @category User Interface
766
- * @subcategory Form
767
- */
768
- interface Props extends ActionsInterface, NavigationChildInterface {
769
- /**
770
- * The Form.Item elements of the form.
771
- */
772
- children?: ReactNode;
773
- }
774
- /**
775
- * A possible form item value that will be used as an input for the submit callback of a form.
776
- */
777
- type Value = string | number | boolean | string[] | number[] | Date | null;
778
- /**
779
- * Values of items in the form.
780
- *
781
- * @remarks
782
- * For type-safe form values, you can define your own interface. Use the ID's of the form items
783
- * as the property names. See the example for more details.
784
- *
785
- * @example
786
- * ```typescript
787
- * import { Form, Action } from "@raycast/api";
788
- *
789
- * interface Values {
790
- * todo: string;
791
- * due?: Date;
792
- * }
793
- *
794
- * export default function Command() {
795
- * function handleSubmit(values: Values) {
796
- * console.log(values);
797
- * }
798
- *
799
- * return (
800
- * <Form
801
- * actions={
802
- * <ActionPanel>
803
- * <Action.SubmitForm title="Submit" onSubmit={handleSubmit} />
804
- * </ActionPanel>
805
- * }
806
- * >
807
- * <Form.TextField id="todo" title="Todo" />
808
- * <Form.DatePicker id="due" title="Due Date" />
809
- * </Form>
810
- * );
811
- * };
812
- * ```
813
- */
814
- interface Values {
815
- /**
816
- * The form value of a given item.
817
- */
818
- [item: string]: any;
819
- }
820
- /**
821
- * Props of the Form.Item React component.
822
- */
823
- interface ItemProps<Value extends Form.Value> {
824
- /**
825
- * ID of the form item.
826
- * Make sure to assign each form item a unique id.
827
- */
828
- id: string;
829
- /**
830
- * The title displayed on the left side of the item.
831
- */
832
- title?: string;
833
- /**
834
- * Indicates whether the value of the item should be persisted after submitting, and restored next time the form is rendered.
835
- */
836
- storeValue?: boolean;
837
- /**
838
- * The current value of the item.
839
- */
840
- value?: Value;
841
- /**
842
- * The default value of the item.
843
- * Keep in mind that `defaultValue` will be configured once per component lifecycle. This means that if a user changes the value, `defaultValue` won't be configured on re-rendering.
844
- * @important If you're using {@link Form.Item.Props.storeValue} and configured it as `true` then the stored value will be set.
845
- * @important If you configure {@link Form.Item.Props.value} at the same time with {@link Form.Item.Props.defaultValue}, the `value` will be set instead of `defaultValue`.
846
- */
847
- defaultValue?: Value;
848
- /**
849
- * The callback which will be triggered on the {@link Form.Item.Props.value} change for the item.
850
- */
851
- onChange?: (newValue: Value) => void;
852
- }
853
- namespace TextField {
854
- /**
855
- * Props of the {@link Form.TextField} React component.
856
- */
857
- interface Props extends Form.ItemProps<string> {
858
- /**
859
- * Placeholder text shown in the text field.
860
- */
861
- placeholder?: string;
862
- }
863
- }
864
- namespace TextArea {
865
- /**
866
- * Props of the {@link Form.TextArea} React component.
867
- */
868
- interface Props extends Form.ItemProps<string> {
869
- /**
870
- * Placeholder text shown in the text area.
871
- */
872
- placeholder?: string;
873
- }
874
- }
875
- namespace Dropdown {
876
- /**
877
- * Props of the {@link Form.Dropdown} React component.
878
- * The {@link Form.Dropdown.Props.value} here is ID ({@link Form.Dropdown.Item.Props.id}) of the default selected item.
879
- */
880
- interface Props extends Form.ItemProps<string> {
881
- /**
882
- * Sections or items. If {@link Form.Dropdown.Item} elements are specified, a default section is automatically created.
883
- */
884
- children?: ReactNode;
885
- }
886
- namespace Section {
887
- /**
888
- * Props of the {@link Form.Dropdown.Section} React component.
889
- */
890
- interface Props {
891
- /**
892
- * The item elements of the section.
893
- */
894
- children?: ReactNode;
895
- /**
896
- * Title displayed above the section
897
- */
898
- title?: string;
899
- }
900
- }
901
- namespace Item {
902
- /**
903
- * Props of the {@link Form.Dropdown.Item} React component.
904
- */
905
- interface Props {
906
- /**
907
- * Value of the dropdown item.
908
- * Make sure to assign each unique value for each item.
909
- */
910
- value: string;
911
- /**
912
- * The title displayed for the item.
913
- */
914
- title: string;
915
- /**
916
- * A optional icon displayed for the item.
917
- */
918
- icon?: Image.ImageLike;
919
- }
920
- }
921
- }
922
- namespace Checkbox {
923
- /**
924
- * Props of the {@link Form.Checkbox} React component.
925
- */
926
- interface Props extends Form.ItemProps<boolean> {
927
- /**
928
- * The label displayed on the right side of the checkbox.
929
- */
930
- label: string;
931
- }
932
- }
933
- namespace DatePicker {
934
- /**
935
- * Props of the {@link Form.DatePicker} React component.
936
- */
937
- interface Props extends Form.ItemProps<Date> {
938
- /**
939
- * Indicates what types of date components can be picked
940
- *
941
- * @default Form.DatePicker.Type.DateTime
942
- */
943
- type?: FormDatePickerType;
944
- }
945
- }
946
- namespace Separator {
947
- /**
948
- * Props of the {@link Form.Separator} React component.
949
- */
950
- interface Props {
951
- }
952
- }
953
- namespace TagPicker {
954
- /**
955
- * Props of the {@link Form.TagPicker} React component.
956
- * The {@link Form.TagPicker.Props.value} here is the IDs ({@link Form.TagPicker.Item.Props.id}) of the default selected items.
957
- */
958
- interface Props extends Form.ItemProps<string[]> {
959
- /**
960
- * The list of tags.
961
- */
962
- children?: ReactNode;
963
- /**
964
- * Placeholder text shown in the token field.
965
- */
966
- placeholder?: string;
967
- }
968
- namespace Item {
969
- /**
970
- * Props of the {@link Form.TagPicker.Item} React component.
971
- */
972
- interface Props {
973
- /**
974
- * Value of the tag.
975
- * Make sure to assign unique value for each item.
976
- */
977
- value: string;
978
- /**
979
- * The display title of the tag.
980
- */
981
- title: string;
982
- /**
983
- * An icon to show in the tag.
984
- */
985
- icon?: Image.ImageLike;
986
- }
987
- }
988
- }
989
- namespace PasswordField {
990
- /**
991
- * Props of the {@link Form.PasswordField} React component.
992
- */
993
- interface Props extends Form.ItemProps<string> {
994
- /**
995
- * Placeholder text shown in the password field.
996
- */
997
- placeholder?: string;
998
- }
999
- }
1000
- namespace Description {
1001
- /**
1002
- * Props of the {@link Form.Description} React component.
1003
- */
1004
- interface Props {
1005
- /**
1006
- * The display title of the left side from the description item.
1007
- */
1008
- title?: string;
1009
- /**
1010
- * Text that will be displayed in the middle.
1011
- */
1012
- text: string;
1013
- }
1014
- }
1015
- }
1016
- export {};