@openwarelabs/ui 0.15.0 → 0.16.1

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 (59) hide show
  1. package/README.md +8 -8
  2. package/dist/components/ActivityHeatmap/ActivityHeatmap.d.cts +8 -0
  3. package/dist/components/ActivityHeatmap/ActivityHeatmap.d.ts +8 -0
  4. package/dist/components/ActivityHeatmap/ActivityHeatmap.types.d.cts +73 -0
  5. package/dist/components/ActivityHeatmap/ActivityHeatmap.types.d.ts +73 -0
  6. package/dist/components/DiffViewer/DiffViewer.d.cts +8 -0
  7. package/dist/components/DiffViewer/DiffViewer.d.ts +8 -0
  8. package/dist/components/DiffViewer/DiffViewer.types.d.cts +131 -0
  9. package/dist/components/DiffViewer/DiffViewer.types.d.ts +131 -0
  10. package/dist/components/DiffViewer/diff.d.cts +10 -0
  11. package/dist/components/DiffViewer/diff.d.ts +10 -0
  12. package/dist/components/Markdown/Markdown.d.cts +8 -0
  13. package/dist/components/Markdown/Markdown.d.ts +8 -0
  14. package/dist/components/Markdown/Markdown.types.d.cts +59 -0
  15. package/dist/components/Markdown/Markdown.types.d.ts +59 -0
  16. package/dist/components/MediaPlayer/MediaPlayer.d.cts +8 -0
  17. package/dist/components/MediaPlayer/MediaPlayer.d.ts +8 -0
  18. package/dist/components/MediaPlayer/MediaPlayer.types.d.cts +109 -0
  19. package/dist/components/MediaPlayer/MediaPlayer.types.d.ts +109 -0
  20. package/dist/components/MentionInput/MentionInput.d.cts +9 -0
  21. package/dist/components/MentionInput/MentionInput.d.ts +9 -0
  22. package/dist/components/MentionInput/MentionInput.types.d.cts +125 -0
  23. package/dist/components/MentionInput/MentionInput.types.d.ts +125 -0
  24. package/dist/components/MentionInput/useMentions.d.cts +8 -0
  25. package/dist/components/MentionInput/useMentions.d.ts +8 -0
  26. package/dist/components/NotificationCenter/NotificationCenter.d.cts +12 -0
  27. package/dist/components/NotificationCenter/NotificationCenter.d.ts +12 -0
  28. package/dist/components/NotificationCenter/NotificationCenter.types.d.cts +129 -0
  29. package/dist/components/NotificationCenter/NotificationCenter.types.d.ts +129 -0
  30. package/dist/components/QRCode/QRCode.d.cts +18 -0
  31. package/dist/components/QRCode/QRCode.d.ts +18 -0
  32. package/dist/components/QRCode/QRCode.types.d.cts +53 -0
  33. package/dist/components/QRCode/QRCode.types.d.ts +53 -0
  34. package/dist/components/QRCode/qr.d.cts +8 -0
  35. package/dist/components/QRCode/qr.d.ts +8 -0
  36. package/dist/components/SignaturePad/SignaturePad.d.cts +8 -0
  37. package/dist/components/SignaturePad/SignaturePad.d.ts +8 -0
  38. package/dist/components/SignaturePad/SignaturePad.types.d.cts +102 -0
  39. package/dist/components/SignaturePad/SignaturePad.types.d.ts +102 -0
  40. package/dist/components/TransferList/TransferList.d.cts +7 -0
  41. package/dist/components/TransferList/TransferList.d.ts +7 -0
  42. package/dist/components/TransferList/TransferList.types.d.cts +75 -0
  43. package/dist/components/TransferList/TransferList.types.d.ts +75 -0
  44. package/dist/components/UploadList/UploadList.d.cts +9 -0
  45. package/dist/components/UploadList/UploadList.d.ts +9 -0
  46. package/dist/components/UploadList/UploadList.types.d.cts +113 -0
  47. package/dist/components/UploadList/UploadList.types.d.ts +113 -0
  48. package/dist/components/UploadList/useUploadQueue.d.cts +8 -0
  49. package/dist/components/UploadList/useUploadQueue.d.ts +8 -0
  50. package/dist/components.css +1194 -104
  51. package/dist/index.cjs +5489 -2267
  52. package/dist/index.cjs.map +4 -4
  53. package/dist/index.d.cts +20 -0
  54. package/dist/index.d.ts +20 -0
  55. package/dist/index.js +5518 -2280
  56. package/dist/index.js.map +4 -4
  57. package/dist/openware-ui.iife.js +24 -9
  58. package/dist/styles.css +1194 -104
  59. package/package.json +1 -1
@@ -0,0 +1,7 @@
1
+ import type { TransferListProps } from "./TransferList.types.js";
2
+ export type { TransferListOption, TransferListProps } from "./TransferList.types.js";
3
+ /**
4
+ * Two lists side by side, the available items and the chosen ones, with buttons between them that move the selected
5
+ * items across: permissions, the columns a table shows, a team's members. Double-click or Enter moves an item too.
6
+ */
7
+ export declare const TransferList: import("react").ForwardRefExoticComponent<TransferListProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,75 @@
1
+ import type { ReactNode } from "react";
2
+ export interface TransferListOption {
3
+ /** What goes in the value when it's chosen. Unique among the options. */
4
+ value: string;
5
+ /** The text in the list, matched by the search and read out when it moves. */
6
+ label: string;
7
+ /** A muted line under the label; matched by the search when it's a string. */
8
+ description?: ReactNode;
9
+ /** Stays on its side: it can't be selected or moved. */
10
+ disabled?: boolean;
11
+ /** A heading to show it under. Options with the same group are listed together, groups in the order they first appear. */
12
+ group?: string;
13
+ }
14
+ /** One side of the transfer list. Internal. */
15
+ export type TransferListSide = "source" | "target";
16
+ export interface TransferListProps {
17
+ /** Everything that can be chosen. The available side lists them in this order. */
18
+ options: TransferListOption[];
19
+ /** The chosen values, in order, when you control them. */
20
+ value?: string[];
21
+ /** The chosen values at first, when it controls them itself.
22
+ * @default [] */
23
+ defaultValue?: string[];
24
+ /** Called with the chosen values when they move or are reordered. Moved values join the end. */
25
+ onChange?(value: string[]): void;
26
+ /** The heading over the available list, which also names it.
27
+ * @default "Available" */
28
+ sourceLabel?: string;
29
+ /** The heading over the chosen list, which also names it.
30
+ * @default "Selected" */
31
+ targetLabel?: string;
32
+ /** A search box over each list that filters it by label and description.
33
+ * @default false */
34
+ searchable?: boolean;
35
+ /** Adds buttons that move every item (that the search shows) from one side to the other.
36
+ * @default false */
37
+ showMoveAll?: boolean;
38
+ /** Adds Move up and Move down buttons under the chosen list (and Alt+Up/Down in it), for an order that matters.
39
+ * The chosen list is then shown without group headings, in the value's order.
40
+ * @default false */
41
+ orderable?: boolean;
42
+ /** Submits each chosen value under this name, in a hidden input, so a Form or a plain form sends them as a list. */
43
+ name?: string;
44
+ /** Fades both lists and the buttons, and takes them out of the tab order.
45
+ * @default false */
46
+ disabled?: boolean;
47
+ /** The lists' height, e.g. 320 or "40vh"; they scroll past it.
48
+ * @default 280 */
49
+ height?: number | string;
50
+ id?: string;
51
+ /** The words it uses, for other languages. `to` is the side's label. */
52
+ labels?: {
53
+ /** The count under each heading. @default (selected, total) => `${selected} of ${total} selected` */
54
+ count?(selected: number, total: number): string;
55
+ /** The button that moves the selected items. @default (count, to) => `Move 2 selected to ${to}`, or `Move selected to ${to}` with none */
56
+ moveSelected?(count: number, to: string): string;
57
+ /** The button that moves them all, with `showMoveAll`. @default (to) => `Move all to ${to}` */
58
+ moveAll?(to: string): string;
59
+ /** Read out after a move. @default (names, to) => `Moved Ada and Grace to ${to}`, or `Moved 7 items to ${to}` past five */
60
+ moved?(names: string[], to: string): string;
61
+ /** With `orderable`. @default "Move up" */
62
+ moveUp?: string;
63
+ /** With `orderable`. @default "Move down" */
64
+ moveDown?: string;
65
+ /** Read out after reordering. @default (names, direction) => `Moved Ada up` */
66
+ reordered?(names: string[], direction: "up" | "down"): string;
67
+ /** Names a side's search box. @default (side) => `Search ${side}` */
68
+ search?(side: string): string;
69
+ /** Shown in an empty list. @default "No items" */
70
+ empty?: ReactNode;
71
+ /** Shown when the search matches nothing. @default "No matches" */
72
+ noMatches?: ReactNode;
73
+ };
74
+ className?: string;
75
+ }
@@ -0,0 +1,75 @@
1
+ import type { ReactNode } from "react";
2
+ export interface TransferListOption {
3
+ /** What goes in the value when it's chosen. Unique among the options. */
4
+ value: string;
5
+ /** The text in the list, matched by the search and read out when it moves. */
6
+ label: string;
7
+ /** A muted line under the label; matched by the search when it's a string. */
8
+ description?: ReactNode;
9
+ /** Stays on its side: it can't be selected or moved. */
10
+ disabled?: boolean;
11
+ /** A heading to show it under. Options with the same group are listed together, groups in the order they first appear. */
12
+ group?: string;
13
+ }
14
+ /** One side of the transfer list. Internal. */
15
+ export type TransferListSide = "source" | "target";
16
+ export interface TransferListProps {
17
+ /** Everything that can be chosen. The available side lists them in this order. */
18
+ options: TransferListOption[];
19
+ /** The chosen values, in order, when you control them. */
20
+ value?: string[];
21
+ /** The chosen values at first, when it controls them itself.
22
+ * @default [] */
23
+ defaultValue?: string[];
24
+ /** Called with the chosen values when they move or are reordered. Moved values join the end. */
25
+ onChange?(value: string[]): void;
26
+ /** The heading over the available list, which also names it.
27
+ * @default "Available" */
28
+ sourceLabel?: string;
29
+ /** The heading over the chosen list, which also names it.
30
+ * @default "Selected" */
31
+ targetLabel?: string;
32
+ /** A search box over each list that filters it by label and description.
33
+ * @default false */
34
+ searchable?: boolean;
35
+ /** Adds buttons that move every item (that the search shows) from one side to the other.
36
+ * @default false */
37
+ showMoveAll?: boolean;
38
+ /** Adds Move up and Move down buttons under the chosen list (and Alt+Up/Down in it), for an order that matters.
39
+ * The chosen list is then shown without group headings, in the value's order.
40
+ * @default false */
41
+ orderable?: boolean;
42
+ /** Submits each chosen value under this name, in a hidden input, so a Form or a plain form sends them as a list. */
43
+ name?: string;
44
+ /** Fades both lists and the buttons, and takes them out of the tab order.
45
+ * @default false */
46
+ disabled?: boolean;
47
+ /** The lists' height, e.g. 320 or "40vh"; they scroll past it.
48
+ * @default 280 */
49
+ height?: number | string;
50
+ id?: string;
51
+ /** The words it uses, for other languages. `to` is the side's label. */
52
+ labels?: {
53
+ /** The count under each heading. @default (selected, total) => `${selected} of ${total} selected` */
54
+ count?(selected: number, total: number): string;
55
+ /** The button that moves the selected items. @default (count, to) => `Move 2 selected to ${to}`, or `Move selected to ${to}` with none */
56
+ moveSelected?(count: number, to: string): string;
57
+ /** The button that moves them all, with `showMoveAll`. @default (to) => `Move all to ${to}` */
58
+ moveAll?(to: string): string;
59
+ /** Read out after a move. @default (names, to) => `Moved Ada and Grace to ${to}`, or `Moved 7 items to ${to}` past five */
60
+ moved?(names: string[], to: string): string;
61
+ /** With `orderable`. @default "Move up" */
62
+ moveUp?: string;
63
+ /** With `orderable`. @default "Move down" */
64
+ moveDown?: string;
65
+ /** Read out after reordering. @default (names, direction) => `Moved Ada up` */
66
+ reordered?(names: string[], direction: "up" | "down"): string;
67
+ /** Names a side's search box. @default (side) => `Search ${side}` */
68
+ search?(side: string): string;
69
+ /** Shown in an empty list. @default "No items" */
70
+ empty?: ReactNode;
71
+ /** Shown when the search matches nothing. @default "No matches" */
72
+ noMatches?: ReactNode;
73
+ };
74
+ className?: string;
75
+ }
@@ -0,0 +1,9 @@
1
+ import type { UploadListProps } from "./UploadList.types.cjs";
2
+ export type { UploadContext, Uploader, UploadListItem, UploadListLabels, UploadListProps, UploadQueue, UploadStatus, UseUploadQueueOptions, } from "./UploadList.types.cjs";
3
+ export { useUploadQueue } from "./useUploadQueue.cjs";
4
+ /**
5
+ * The files being uploaded, under a FileDropZone: each with its size, a progress bar while it uploads, and its
6
+ * status. Retry, Cancel and Remove buttons call back with the file's id. Finished and failed files are announced
7
+ * politely. `useUploadQueue` does the uploading and keeps the `items` for you.
8
+ */
9
+ export declare function UploadList({ items, onRetry, onCancel, onRemove, layout, density, showTimeRemaining, locale, labels: labelsProp, className, }: UploadListProps): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import type { UploadListProps } from "./UploadList.types.js";
2
+ export type { UploadContext, Uploader, UploadListItem, UploadListLabels, UploadListProps, UploadQueue, UploadStatus, UseUploadQueueOptions, } from "./UploadList.types.js";
3
+ export { useUploadQueue } from "./useUploadQueue.js";
4
+ /**
5
+ * The files being uploaded, under a FileDropZone: each with its size, a progress bar while it uploads, and its
6
+ * status. Retry, Cancel and Remove buttons call back with the file's id. Finished and failed files are announced
7
+ * politely. `useUploadQueue` does the uploading and keeps the `items` for you.
8
+ */
9
+ export declare function UploadList({ items, onRetry, onCancel, onRemove, layout, density, showTimeRemaining, locale, labels: labelsProp, className, }: UploadListProps): import("react").JSX.Element;
@@ -0,0 +1,113 @@
1
+ /** Where a file's upload has got to. */
2
+ export type UploadStatus = "queued" | "uploading" | "done" | "error" | "canceled";
3
+ /** One file in an UploadList. */
4
+ export interface UploadListItem {
5
+ /** Tells the rows apart; stays the same while the file uploads. */
6
+ id: string;
7
+ /** The file's name, shown and used to name its buttons: "report.pdf". */
8
+ name: string;
9
+ /** The file's size in bytes. */
10
+ size: number;
11
+ /** The file's MIME type, such as "image/png". */
12
+ type?: string;
13
+ /** How far it's got, from 0 to 100. Leave it out while uploading for a bar of unknown length. */
14
+ progress?: number;
15
+ /** Where it's got to: `queued` waits its turn, `uploading` shows a bar, `done`, `error` and `canceled` say so. */
16
+ status: UploadStatus;
17
+ /** Why it failed, shown in place of the size when the status is "error". */
18
+ error?: string;
19
+ /** An image to show as its thumbnail, such as an object URL of the file. */
20
+ previewUrl?: string;
21
+ /** Where the uploaded file is: once it's done, the name links there. */
22
+ href?: string;
23
+ }
24
+ export interface UploadListLabels {
25
+ /** Names the list for screen readers.
26
+ * @default "Uploads" */
27
+ list?: string;
28
+ /** @default "Waiting" */
29
+ queued?: string;
30
+ /** Shown while uploading when the progress isn't known.
31
+ * @default "Uploading" */
32
+ uploading?: string;
33
+ /** @default "Upload failed" */
34
+ failed?: string;
35
+ /** @default "Canceled" */
36
+ canceled?: string;
37
+ /** How much has gone up, from sizes already formatted.
38
+ * @default (loaded, total) => `${loaded} of ${total}` */
39
+ progress?(loaded: string, total: string): string;
40
+ /** The time left, in seconds.
41
+ * @default (seconds) => "About 12 sec left" */
42
+ remaining?(seconds: number): string;
43
+ /** Formats a size in bytes.
44
+ * @default 2.1 MB, 340 kB, with Intl.NumberFormat */
45
+ size?(bytes: number): string;
46
+ /** @default (name) => `Retry upload of ${name}` */
47
+ retry?(name: string): string;
48
+ /** @default (name) => `Cancel upload of ${name}` */
49
+ cancel?(name: string): string;
50
+ /** @default (name) => `Remove ${name}` */
51
+ remove?(name: string): string;
52
+ /** Announced when a file finishes.
53
+ * @default (name) => `${name} uploaded` */
54
+ done?(name: string): string;
55
+ /** Announced when a file fails.
56
+ * @default (name, error) => `${name} failed to upload: ${error}` */
57
+ error?(name: string, error?: string): string;
58
+ }
59
+ export interface UploadListProps {
60
+ /** The files, in the order to show them. `useUploadQueue` keeps a list like this for you. */
61
+ items: UploadListItem[];
62
+ /** Called when Retry is pressed on a file that failed or was canceled. Without it there's no Retry button. */
63
+ onRetry?(id: string): void;
64
+ /** Called when Cancel is pressed on a file that's waiting or uploading. Without it there's no Cancel button. */
65
+ onCancel?(id: string): void;
66
+ /** Called when Remove is pressed. Without it there's no Remove button. */
67
+ onRemove?(id: string): void;
68
+ /** `list` is a row per file; `grid` is a tile per file, with a large thumbnail, for images.
69
+ * @default "list" */
70
+ layout?: "list" | "grid";
71
+ /** `compact` fits each file on one short line, for a sidebar or a long list.
72
+ * @default "comfortable" */
73
+ density?: "comfortable" | "compact";
74
+ /** Shows an estimate of the time left on files that are uploading.
75
+ * @default false */
76
+ showTimeRemaining?: boolean;
77
+ /** The locale sizes and times are formatted in.
78
+ * @default "en" */
79
+ locale?: string;
80
+ /** The words it uses, for other languages. */
81
+ labels?: UploadListLabels;
82
+ className?: string;
83
+ }
84
+ /** What an uploader is given along with the file. */
85
+ export interface UploadContext {
86
+ /** Report how far it's got, from 0 to 100, or undefined when it can't tell. */
87
+ onProgress(progress: number | undefined): void;
88
+ /** Aborted when the upload is canceled or removed: pass it to fetch, or listen for "abort". */
89
+ signal: AbortSignal;
90
+ }
91
+ /**
92
+ * Uploads one file. Resolve when it's done, with the uploaded file's URL if you have one (the name then links to it);
93
+ * throw or reject to fail it, and the error's message is shown.
94
+ */
95
+ export type Uploader = (file: File, context: UploadContext) => Promise<string | void>;
96
+ export interface UseUploadQueueOptions {
97
+ /** How many files upload at once.
98
+ * @default 3 */
99
+ concurrency?: number;
100
+ }
101
+ /** What `useUploadQueue` returns: the items for UploadList and the actions for its buttons. */
102
+ export interface UploadQueue {
103
+ /** The files and how they're going, for `UploadList`'s `items`. */
104
+ items: UploadListItem[];
105
+ /** Adds files to the queue, such as those from `FileDropZone`'s `onFiles`. */
106
+ add(files: File[]): void;
107
+ /** Puts a failed or canceled file back in the queue. */
108
+ retry(id: string): void;
109
+ /** Stops a file that's waiting or uploading, aborting its signal. */
110
+ cancel(id: string): void;
111
+ /** Stops a file if it's going, and takes it off the list. */
112
+ remove(id: string): void;
113
+ }
@@ -0,0 +1,113 @@
1
+ /** Where a file's upload has got to. */
2
+ export type UploadStatus = "queued" | "uploading" | "done" | "error" | "canceled";
3
+ /** One file in an UploadList. */
4
+ export interface UploadListItem {
5
+ /** Tells the rows apart; stays the same while the file uploads. */
6
+ id: string;
7
+ /** The file's name, shown and used to name its buttons: "report.pdf". */
8
+ name: string;
9
+ /** The file's size in bytes. */
10
+ size: number;
11
+ /** The file's MIME type, such as "image/png". */
12
+ type?: string;
13
+ /** How far it's got, from 0 to 100. Leave it out while uploading for a bar of unknown length. */
14
+ progress?: number;
15
+ /** Where it's got to: `queued` waits its turn, `uploading` shows a bar, `done`, `error` and `canceled` say so. */
16
+ status: UploadStatus;
17
+ /** Why it failed, shown in place of the size when the status is "error". */
18
+ error?: string;
19
+ /** An image to show as its thumbnail, such as an object URL of the file. */
20
+ previewUrl?: string;
21
+ /** Where the uploaded file is: once it's done, the name links there. */
22
+ href?: string;
23
+ }
24
+ export interface UploadListLabels {
25
+ /** Names the list for screen readers.
26
+ * @default "Uploads" */
27
+ list?: string;
28
+ /** @default "Waiting" */
29
+ queued?: string;
30
+ /** Shown while uploading when the progress isn't known.
31
+ * @default "Uploading" */
32
+ uploading?: string;
33
+ /** @default "Upload failed" */
34
+ failed?: string;
35
+ /** @default "Canceled" */
36
+ canceled?: string;
37
+ /** How much has gone up, from sizes already formatted.
38
+ * @default (loaded, total) => `${loaded} of ${total}` */
39
+ progress?(loaded: string, total: string): string;
40
+ /** The time left, in seconds.
41
+ * @default (seconds) => "About 12 sec left" */
42
+ remaining?(seconds: number): string;
43
+ /** Formats a size in bytes.
44
+ * @default 2.1 MB, 340 kB, with Intl.NumberFormat */
45
+ size?(bytes: number): string;
46
+ /** @default (name) => `Retry upload of ${name}` */
47
+ retry?(name: string): string;
48
+ /** @default (name) => `Cancel upload of ${name}` */
49
+ cancel?(name: string): string;
50
+ /** @default (name) => `Remove ${name}` */
51
+ remove?(name: string): string;
52
+ /** Announced when a file finishes.
53
+ * @default (name) => `${name} uploaded` */
54
+ done?(name: string): string;
55
+ /** Announced when a file fails.
56
+ * @default (name, error) => `${name} failed to upload: ${error}` */
57
+ error?(name: string, error?: string): string;
58
+ }
59
+ export interface UploadListProps {
60
+ /** The files, in the order to show them. `useUploadQueue` keeps a list like this for you. */
61
+ items: UploadListItem[];
62
+ /** Called when Retry is pressed on a file that failed or was canceled. Without it there's no Retry button. */
63
+ onRetry?(id: string): void;
64
+ /** Called when Cancel is pressed on a file that's waiting or uploading. Without it there's no Cancel button. */
65
+ onCancel?(id: string): void;
66
+ /** Called when Remove is pressed. Without it there's no Remove button. */
67
+ onRemove?(id: string): void;
68
+ /** `list` is a row per file; `grid` is a tile per file, with a large thumbnail, for images.
69
+ * @default "list" */
70
+ layout?: "list" | "grid";
71
+ /** `compact` fits each file on one short line, for a sidebar or a long list.
72
+ * @default "comfortable" */
73
+ density?: "comfortable" | "compact";
74
+ /** Shows an estimate of the time left on files that are uploading.
75
+ * @default false */
76
+ showTimeRemaining?: boolean;
77
+ /** The locale sizes and times are formatted in.
78
+ * @default "en" */
79
+ locale?: string;
80
+ /** The words it uses, for other languages. */
81
+ labels?: UploadListLabels;
82
+ className?: string;
83
+ }
84
+ /** What an uploader is given along with the file. */
85
+ export interface UploadContext {
86
+ /** Report how far it's got, from 0 to 100, or undefined when it can't tell. */
87
+ onProgress(progress: number | undefined): void;
88
+ /** Aborted when the upload is canceled or removed: pass it to fetch, or listen for "abort". */
89
+ signal: AbortSignal;
90
+ }
91
+ /**
92
+ * Uploads one file. Resolve when it's done, with the uploaded file's URL if you have one (the name then links to it);
93
+ * throw or reject to fail it, and the error's message is shown.
94
+ */
95
+ export type Uploader = (file: File, context: UploadContext) => Promise<string | void>;
96
+ export interface UseUploadQueueOptions {
97
+ /** How many files upload at once.
98
+ * @default 3 */
99
+ concurrency?: number;
100
+ }
101
+ /** What `useUploadQueue` returns: the items for UploadList and the actions for its buttons. */
102
+ export interface UploadQueue {
103
+ /** The files and how they're going, for `UploadList`'s `items`. */
104
+ items: UploadListItem[];
105
+ /** Adds files to the queue, such as those from `FileDropZone`'s `onFiles`. */
106
+ add(files: File[]): void;
107
+ /** Puts a failed or canceled file back in the queue. */
108
+ retry(id: string): void;
109
+ /** Stops a file that's waiting or uploading, aborting its signal. */
110
+ cancel(id: string): void;
111
+ /** Stops a file if it's going, and takes it off the list. */
112
+ remove(id: string): void;
113
+ }
@@ -0,0 +1,8 @@
1
+ import type { UploadQueue, Uploader, UseUploadQueueOptions } from "./UploadList.types.cjs";
2
+ /**
3
+ * Keeps a queue of files for `UploadList`: uploads them with your `uploader`, a few at a time, and tracks each one's
4
+ * progress and status. Cancel and remove abort the upload's signal; retry puts a file back in the queue.
5
+ *
6
+ * `const queue = useUploadQueue((file, { onProgress, signal }) => upload(file, onProgress, signal));`
7
+ */
8
+ export declare function useUploadQueue(uploader: Uploader, { concurrency }?: UseUploadQueueOptions): UploadQueue;
@@ -0,0 +1,8 @@
1
+ import type { UploadQueue, Uploader, UseUploadQueueOptions } from "./UploadList.types.js";
2
+ /**
3
+ * Keeps a queue of files for `UploadList`: uploads them with your `uploader`, a few at a time, and tracks each one's
4
+ * progress and status. Cancel and remove abort the upload's signal; retry puts a file back in the queue.
5
+ *
6
+ * `const queue = useUploadQueue((file, { onProgress, signal }) => upload(file, onProgress, signal));`
7
+ */
8
+ export declare function useUploadQueue(uploader: Uploader, { concurrency }?: UseUploadQueueOptions): UploadQueue;