@eifi1/ui-kit 0.23.0 → 0.24.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 (101) hide show
  1. package/README.md +6 -6
  2. package/dist/chart.d.ts +2 -4
  3. package/dist/components/amount-input.d.ts +16 -9
  4. package/dist/components/amount-input.js +13 -11
  5. package/dist/components/amount-input.js.map +1 -1
  6. package/dist/components/autocomplete.d.ts +5 -0
  7. package/dist/components/autocomplete.js +39 -37
  8. package/dist/components/autocomplete.js.map +1 -1
  9. package/dist/components/button-group.d.ts +2 -4
  10. package/dist/components/calculator.d.ts +2 -4
  11. package/dist/components/column-mapper.d.ts +62 -9
  12. package/dist/components/column-mapper.js +85 -49
  13. package/dist/components/column-mapper.js.map +1 -1
  14. package/dist/components/combobox.d.ts +33 -1
  15. package/dist/components/combobox.js +8 -2
  16. package/dist/components/combobox.js.map +1 -1
  17. package/dist/components/confirm-dialog.d.ts +2 -4
  18. package/dist/components/copy-button.d.ts +2 -4
  19. package/dist/components/danger-confirm.d.ts +2 -4
  20. package/dist/components/danger-confirm.js +52 -5
  21. package/dist/components/danger-confirm.js.map +1 -1
  22. package/dist/components/entity-combobox.d.ts +13 -1
  23. package/dist/components/entity-combobox.js +13 -4
  24. package/dist/components/entity-combobox.js.map +1 -1
  25. package/dist/components/facing-pair.d.ts +2 -4
  26. package/dist/components/file-button.d.ts +2 -4
  27. package/dist/components/file-dropzone.d.ts +2 -4
  28. package/dist/components/form-actions.d.ts +1 -3
  29. package/dist/components/form-actions.js +15 -1
  30. package/dist/components/form-actions.js.map +1 -1
  31. package/dist/components/iban-input.d.ts +2 -4
  32. package/dist/components/language-select.d.ts +2 -4
  33. package/dist/components/money-field.d.ts +2 -4
  34. package/dist/components/multi-entity-combobox.d.ts +5 -1
  35. package/dist/components/multi-entity-combobox.js +11 -3
  36. package/dist/components/multi-entity-combobox.js.map +1 -1
  37. package/dist/components/number-field.d.ts +2 -4
  38. package/dist/components/number-input.d.ts +2 -4
  39. package/dist/components/numpad-sheet.d.ts +2 -4
  40. package/dist/components/phone-input.d.ts +2 -4
  41. package/dist/components/series-chart.d.ts +2 -4
  42. package/dist/components/settings-fields.d.ts +2 -4
  43. package/dist/components/share-card.d.ts +1 -3
  44. package/dist/components/text-link.d.ts +1 -3
  45. package/dist/components/time-input.d.ts +2 -4
  46. package/dist/components/ui.d.ts +2 -4
  47. package/dist/components/ui.js +55 -17
  48. package/dist/components/ui.js.map +1 -1
  49. package/dist/feedback/feedback-attachment.d.ts +66 -1
  50. package/dist/feedback/feedback-attachment.js +32 -12
  51. package/dist/feedback/feedback-attachment.js.map +1 -1
  52. package/dist/feedback/feedback-dialog.d.ts +66 -1
  53. package/dist/feedback/feedback-inbox.d.ts +67 -253
  54. package/dist/feedback/feedback-thread.d.ts +1 -3
  55. package/dist/feedback/feedback-thread.js +8 -2
  56. package/dist/feedback/feedback-thread.js.map +1 -1
  57. package/dist/{feedback-BxeQVzwq.d.ts → feedback-DOwPu-Il.d.ts} +878 -18
  58. package/dist/feedback.d.ts +2 -4
  59. package/dist/hooks/use-file-drop.d.ts +2 -4
  60. package/dist/i18n/defaults.d.ts +2 -4
  61. package/dist/i18n/german.d.ts +2 -4
  62. package/dist/i18n/kit-labels.d.ts +1 -3
  63. package/dist/i18n/languages.d.ts +2 -4
  64. package/dist/i18n/locales/de-CH.d.ts +2 -4
  65. package/dist/i18n/locales/en.d.ts +2 -4
  66. package/dist/i18n/locales/es.d.ts +2 -4
  67. package/dist/i18n/locales/fr.d.ts +2 -4
  68. package/dist/i18n/locales/hu.d.ts +2 -4
  69. package/dist/i18n/locales/it.d.ts +2 -4
  70. package/dist/i18n/locales/zh.d.ts +2 -4
  71. package/dist/i18n/review.d.ts +2 -4
  72. package/dist/index.d.ts +2 -4
  73. package/dist/lib/strip-fade.d.ts +2 -2
  74. package/dist/lib/strip-fade.js.map +1 -1
  75. package/dist/rhf/fields.d.ts +59 -8
  76. package/dist/rhf/fields.js +61 -3
  77. package/dist/rhf/fields.js.map +1 -1
  78. package/dist/rhf/form.d.ts +2 -4
  79. package/dist/rhf.d.ts +3 -5
  80. package/dist/rhf.js.map +1 -1
  81. package/dist/shell/app-shell.d.ts +1 -3
  82. package/dist/shell/top-bar-brand.d.ts +2 -4
  83. package/dist/shell.d.ts +1 -3
  84. package/dist/wizard/stepper-nav.d.ts +2 -4
  85. package/dist/wizard.d.ts +2 -4
  86. package/package.json +2 -2
  87. package/src/components/amount-input.tsx +37 -20
  88. package/src/components/autocomplete.tsx +16 -5
  89. package/src/components/column-mapper.tsx +181 -79
  90. package/src/components/combobox.tsx +41 -3
  91. package/src/components/danger-confirm.tsx +193 -22
  92. package/src/components/entity-combobox.tsx +28 -5
  93. package/src/components/form-actions.tsx +20 -1
  94. package/src/components/multi-entity-combobox.tsx +16 -3
  95. package/src/components/ui.tsx +107 -0
  96. package/src/feedback/feedback-attachment.tsx +65 -12
  97. package/src/feedback/feedback-thread.tsx +66 -6
  98. package/src/lib/strip-fade.ts +2 -2
  99. package/src/rhf/fields.tsx +167 -6
  100. package/src/rhf.ts +1 -1
  101. package/dist/feedback-attachment-fGAzZPf0.d.ts +0 -469
@@ -1,469 +0,0 @@
1
- import * as react from 'react';
2
- import { ReactNode, RefObject } from 'react';
3
-
4
- interface FeedbackCategoryOption {
5
- value: string;
6
- label: string;
7
- }
8
- interface FeedbackAttachmentLabels {
9
- /** The heading over the field. Optional: a note editor puts the buttons
10
- * straight under its textarea, where a second heading is noise. */
11
- attachment?: string;
12
- attachmentAdd: string;
13
- /** Label for the "capture screenshot" button. Optional — falls back to the provider's
14
- * `feedbackAttachment.attachmentCapture`, then English. */
15
- attachmentCapture?: string;
16
- /** The line under the attachment buttons saying a screenshot can be pasted
17
- * straight in. Optional — falls back to the provider's `feedbackAttachment`, then English. */
18
- attachmentPaste?: string;
19
- attachmentRemove: string;
20
- /** `multiple` mode (0.15.5): the chip list's accessible name — and, in
21
- * `<FeedbackDialog attachments="multiple">`, the heading over it (0.16.0). Optional,
22
- * as are the keys below — they fall back to the provider's `feedbackAttachment`,
23
- * then English. */
24
- attachmentList?: string;
25
- /** `multiple` mode (0.16.0): the screenshot slot's chip title, in place of its file name. */
26
- attachmentScreenshot?: string;
27
- /** `multiple` mode: one chip's remove button, given the file's name. */
28
- attachmentRemoveFile?: (name: string) => string;
29
- /** `multiple` mode: the line shown once `max` files are attached. */
30
- attachmentLimit?: (max: number) => string;
31
- /** `refs` mode (0.22.0): the second line of a chip whose upload is still running. */
32
- attachmentUploading?: string;
33
- }
34
- interface FeedbackDialogLabels extends FeedbackAttachmentLabels {
35
- title: string;
36
- category: string;
37
- subject: string;
38
- body: string;
39
- attachment: string;
40
- submitHint: string;
41
- cancel: string;
42
- save: string;
43
- /** @deprecated since 0.16.0 — use `attachmentList`, the one key for the heading and
44
- * the chip list it names. Still honoured: set, it wins over the provider's
45
- * `attachmentList` (but not over an `attachmentList` passed beside it). */
46
- attachments?: string;
47
- }
48
- /**
49
- * The dialog's own strings — the `feedbackDialog` namespace of `<UiKitProvider
50
- * labels>` (0.12.0). The attachment keys are not repeated here: they are the
51
- * `feedbackAttachment` namespace's, which the field inside already reads.
52
- *
53
- * Before, every key was required at the call site, so each app restated ten strings
54
- * wherever it mounted the dialog (kastlan feedback-button.tsx built the object inline).
55
- */
56
- interface FeedbackDialogTextLabels {
57
- title: string;
58
- category: string;
59
- subject: string;
60
- body: string;
61
- /** The body's label when `requireBody={false}`: "What happened? (optional)".
62
- * Optional, so a complete `UiKitLabels` typed before 0.14.2 still compiles. */
63
- bodyOptional?: string;
64
- /** The heading over the attachment buttons. */
65
- attachment: string;
66
- /** The line beside the buttons naming the shortcut. */
67
- submitHint: string;
68
- cancel: string;
69
- save: string;
70
- /** @deprecated since 0.16.0 — use `feedbackAttachment.attachmentList`. It and this
71
- * key were two names for one heading ("Attachments" over the chips that list names
72
- * "Attachments"), and a catalogue that translated one left the other English. Still
73
- * honoured when set: it wins over `feedbackAttachment.attachmentList`. */
74
- attachments?: string;
75
- }
76
- declare const DEFAULT_FEEDBACK_DIALOG_LABELS: FeedbackDialogTextLabels;
77
- interface FeedbackSubmission {
78
- title: string;
79
- body: string;
80
- category: string;
81
- attachment: File | null;
82
- }
83
- /**
84
- * What `onSubmit` gets under `attachments="multiple"` (0.15.5): the screenshot and
85
- * the picked/pasted files apart, because an app files them differently — keksdose
86
- * attaches the screenshot to the report and the photos as its evidence list. No
87
- * `attachment`: there is no one file it could name.
88
- */
89
- interface FeedbackMultipleSubmission {
90
- title: string;
91
- body: string;
92
- category: string;
93
- /** What `onCaptureScreenshot` returned, or `null` — at most one. */
94
- screenshot: File | null;
95
- /** Picked and pasted files, in the order they were added; at most `maxAttachments`. */
96
- attachments: File[];
97
- }
98
- interface FeedbackDialogBaseProps {
99
- open: boolean;
100
- onClose: () => void;
101
- categories: FeedbackCategoryOption[];
102
- category: string;
103
- onCategoryChange: (value: string) => void;
104
- /** Prop > `<UiKitProvider labels={{ feedbackDialog, feedbackAttachment }}>` >
105
- * English. Optional since 0.12.0; a whole `FeedbackDialogLabels` still fits. */
106
- labels?: Partial<FeedbackDialogLabels>;
107
- submitting?: boolean;
108
- contextSlot?: ReactNode;
109
- attachmentAccept?: string[];
110
- maxAttachmentBytes?: number;
111
- /**
112
- * Optional: capture a screenshot of the underlying app view and return it as a
113
- * File. When provided, a "Capture screenshot" button is shown next to "Add
114
- * attachment"; the returned file is fed through the same validation + preview.
115
- */
116
- onCaptureScreenshot?: () => Promise<File | null>;
117
- /**
118
- * `false`: a report with only a subject can be sent, and the body's label says it is
119
- * optional (`bodyOptional`, unless `labels.body` is passed). Default `true`, the
120
- * dialog's behaviour until 0.14.2 (keksdose K1: its backend takes title-only reports).
121
- */
122
- requireBody?: boolean;
123
- }
124
- /** One attachment — a screenshot, a picked or a pasted image; a second replaces
125
- * nothing, it has to wait for the first to be removed. The default. */
126
- interface FeedbackDialogSingleProps extends FeedbackDialogBaseProps {
127
- attachments?: "single";
128
- onSubmit: (data: FeedbackSubmission) => void | Promise<void>;
129
- /** `info` (0.23.0) names the refused file and the limit — see
130
- * {@link FeedbackAttachmentErrorInfo}. */
131
- onAttachmentError?: (kind: "type" | "size", info: FeedbackAttachmentErrorInfo) => void;
132
- /** Multiple mode only — refused here rather than silently ignored. */
133
- maxAttachments?: never;
134
- }
135
- /**
136
- * One screenshot plus up to `maxAttachments` picked or pasted files (0.15.5, keksdose
137
- * dev#578: "pasted two photos, the second overwrote the first"). The capture button is
138
- * offered while there is no screenshot yet; the add button while there is room.
139
- */
140
- interface FeedbackDialogMultipleProps extends FeedbackDialogBaseProps {
141
- attachments: "multiple";
142
- /** Default `DEFAULT_MAX_ATTACHMENTS` (5). The screenshot does not count. */
143
- maxAttachments?: number;
144
- onSubmit: (data: FeedbackMultipleSubmission) => void | Promise<void>;
145
- /** `"count"`: more files arrived at once than there was room for; the surplus was
146
- * dropped. `info` (0.23.0) names the refused file(s) and the limit. */
147
- onAttachmentError?: (kind: FeedbackAttachmentError, info: FeedbackAttachmentErrorInfo) => void;
148
- }
149
- type FeedbackDialogProps = FeedbackDialogSingleProps | FeedbackDialogMultipleProps;
150
- /**
151
- * The generic feedback form dialog: category + subject + body + an optional image
152
- * attachment, with Ctrl/Cmd+Enter to submit. Domain-free — the app supplies the
153
- * category options, labels and an `onSubmit` that talks to its own backend, plus
154
- * an optional `contextSlot` for app-specific context (user, current URL, …).
155
- *
156
- * **A screenshot can be pasted straight in.** Ctrl/Cmd+V anywhere in the dialog
157
- * takes an image off the clipboard and makes it the attachment, through the same
158
- * validation and the same preview as the file picker. It is the gesture the two
159
- * ways in did not cover: `onCaptureScreenshot` snapshots the *whole* app view,
160
- * and the file picker needs a file — so somebody who wanted to show one panel,
161
- * or one region of one, had to save a crop to disk first and then find it again
162
- * (Steering Design feedback #39). The clipboard is where a region snip already
163
- * is on every platform.
164
- *
165
- * **`attachments="multiple"`** (0.15.5) takes several: every paste and pick adds a
166
- * chip, and `onSubmit` gets `{ screenshot, attachments }` ({@link
167
- * FeedbackMultipleSubmission}) instead of `attachment`. Opt-in, so a caller typed
168
- * against the one-file submission keeps compiling and behaving as before.
169
- */
170
- declare function FeedbackDialog(props: FeedbackDialogProps): react.JSX.Element | null;
171
-
172
- declare const DEFAULT_ATTACHMENT_ACCEPT: string[];
173
- declare const DEFAULT_MAX_ATTACHMENT_BYTES: number;
174
- /** How many files `<FeedbackAttachmentField multiple>` takes when `max` is not given
175
- * (0.15.5). Five photos of one problem is already a lot to look through; a report
176
- * that needs more is a conversation, which the thread is for. */
177
- declare const DEFAULT_MAX_ATTACHMENTS = 5;
178
- /**
179
- * The field's own strings — the `feedbackAttachment` namespace of `<UiKitProvider
180
- * labels>`. The keys are {@link FeedbackAttachmentLabels}' own, so the `labels` prop
181
- * (and a whole `FeedbackDialogLabels` handed down by the dialog) merges over them
182
- * one to one. The optional heading, `attachment`, stays a prop: a note editor puts
183
- * the buttons straight under its textarea and wants none.
184
- *
185
- * Before 0.7.0 the two optional keys fell back to hard-coded English, so a German app
186
- * that relied on its provider got "Capture screenshot" under a German form.
187
- *
188
- * The three keys added in 0.15.5 for `multiple` mode are optional, so a complete
189
- * `UiKitLabels` typed before it still compiles; they fall back to English. So is
190
- * `attachmentScreenshot` (0.16.0).
191
- */
192
- interface FeedbackAttachmentFieldLabels {
193
- attachmentAdd: string;
194
- attachmentCapture: string;
195
- attachmentPaste: string;
196
- attachmentRemove: string;
197
- /** `multiple` mode: the accessible name of the list of chosen files — and, since
198
- * 0.16.0, the heading `<FeedbackDialog attachments="multiple">` puts over it. */
199
- attachmentList?: string;
200
- /** `multiple` mode (0.16.0): what the screenshot slot's chip is called — "Screenshot"
201
- * rather than the capture's file name ("screenshot.webp"), which says nothing a
202
- * reporter chose. The file name stays as the chip's second line. */
203
- attachmentScreenshot?: string;
204
- /** `multiple` mode: one chip's remove button — "Remove photo.jpg". Named per file,
205
- * because five buttons all called "Remove attachment" say nothing about which. */
206
- attachmentRemoveFile?: (name: string) => string;
207
- /** `multiple` mode: the line shown in place of the add buttons once `max` is reached. */
208
- attachmentLimit?: (max: number) => string;
209
- /** `refs` mode (0.22.0, keksdose K16): the second line of a chip whose upload is still
210
- * running, where an uploaded one shows its size — "Uploading…". Optional, like the
211
- * keys above, so a `UiKitLabels` typed before it still compiles. */
212
- attachmentUploading?: string;
213
- /** `refs` mode (0.23.0, keksdose G5a): {@link FeedbackAttachmentErrorInfo.message} for
214
- * an `"upload"` refusal — "“huge.png” could not be uploaded". The other refusals'
215
- * sentences are the `filePicker` namespace's, shared with FileButton. Optional, like
216
- * the keys above. */
217
- attachmentUploadFailed?: (name: string) => string;
218
- }
219
- declare const DEFAULT_FEEDBACK_ATTACHMENT_LABELS: FeedbackAttachmentFieldLabels;
220
- /** Why a file was turned away. `"count"` only ever comes from `multiple` (and `refs`)
221
- * mode: more files arrived at once than `max` left room for, and the surplus was
222
- * dropped. */
223
- type FeedbackAttachmentError = "type" | "size" | "count";
224
- /** `refs` mode's reasons: {@link FeedbackAttachmentError}, or `"upload"` — `onUpload`
225
- * rejected, and what it rejected with is `onError`'s second argument. A type of its
226
- * own so a host's exhaustive switch over the File modes' reasons stays exhaustive. */
227
- type FeedbackAttachmentRefsError = FeedbackAttachmentError | "upload";
228
- /**
229
- * What `onError` knows about a refusal beyond its kind (0.23.0, keksdose G5a): the file
230
- * it was about, the limit that refused it, and a sentence that says both.
231
- *
232
- * keksdose's support chat toasted "File too large" with no name — the field's `onError`
233
- * carried a kind and nothing else, so a refusal could not say WHICH of three pasted
234
- * screenshots went, nor what the ceiling was, and its own `AttachmentPicker` (a
235
- * FileButton, whose `onReject` hands over `{ file, message }`) said more than the kit's
236
- * field would have. This is that, for every mode.
237
- *
238
- * It arrives as an EXTRA argument, after the ones `onError` already had, so a handler
239
- * written for 0.22 — `(kind) => …`, or `refs` mode's `(kind, error) => …` — compiles
240
- * and behaves as before:
241
- *
242
- * - single and `multiple`: `onError(kind, info)`;
243
- * - `refs`: `onError(kind, error, info)` — the second place is `onUpload`'s rejection
244
- * since 0.22 (`undefined` for the other kinds, as it always was), so the info comes
245
- * third rather than changing what a 0.22 handler reads there. It also carries that
246
- * `error`, so one helper `(kind, info) => …` serves all three modes.
247
- *
248
- * An object rather than more positional arguments because what a host reaches for
249
- * differs by kind — the bytes for `"size"`, `max` for `"count"`, the server's answer for
250
- * `"upload"` — and a field added later must not shift anyone's arguments.
251
- */
252
- interface FeedbackAttachmentErrorInfo {
253
- /** The file refused — under the name the field would have given it (a pasted image
254
- * is already "pasted.png"). For `"count"`, the first of the surplus; for
255
- * `"upload"`, the file whose upload failed. */
256
- file: File;
257
- /** `"count"`: every file of the surplus (several can arrive in one pick). Otherwise
258
- * `[file]`. */
259
- files: File[];
260
- /**
261
- * One translated sentence naming the file and the limit — the ones FileButton's
262
- * `onReject` hands over, from the same `filePicker` namespace: "“huge.png” is larger
263
- * than 10 MB", "Only image/png, image/jpeg files", "“c.png” was not added: at most 5
264
- * files" (several at once: "3 files were not added"). `"upload"`: the field's own
265
- * `attachmentUploadFailed`, "“huge.png” could not be uploaded" — a host with a better
266
- * sentence from the server's answer uses `error`. Ready for a toast as it is.
267
- */
268
- message: string;
269
- /** The field's `maxBytes` — the ceiling a `"size"` refusal went over, in bytes. */
270
- maxBytes: number;
271
- /** The field's `accept` — the types a `"type"` refusal was not among. */
272
- accept: string[];
273
- /** The field's `max` — the ceiling a `"count"` refusal hit. Absent in single mode,
274
- * which holds one file by definition. */
275
- max?: number;
276
- /** `"upload"` only: what `onUpload` rejected with — `onError`'s second argument. */
277
- error?: unknown;
278
- }
279
- /**
280
- * One uploaded attachment in `refs` mode: what the host's upload answered with. `key`
281
- * identifies it (a storage key, an upload id) and is what a remove goes by; `name` is
282
- * what the chip says. `size` (bytes) and `type` (mime) are optional — given, the chip
283
- * shows the size and an image icon or a file icon accordingly.
284
- */
285
- interface FeedbackAttachmentRef {
286
- key: string;
287
- name: string;
288
- size?: number;
289
- type?: string;
290
- }
291
- interface FeedbackAttachmentFieldBaseProps {
292
- /** Prop > `<UiKitProvider labels={{ feedbackAttachment }}>` > English. Optional
293
- * since 0.7.0; `attachment` (the heading) is only ever read from here. */
294
- labels?: Partial<FeedbackAttachmentLabels> & Pick<Partial<FeedbackAttachmentFieldLabels>, "attachmentUploading" | "attachmentUploadFailed">;
295
- accept?: string[];
296
- maxBytes?: number;
297
- /**
298
- * Take no files for now (0.23.0, keksdose G5b): the add and capture buttons, the
299
- * hidden file input and every chip's remove button are natively disabled, and a paste
300
- * is let through untouched. The chips stay as they are — what is about to be sent
301
- * stays readable.
302
- *
303
- * For the moment a send is in flight. keksdose's support picker is `disabled` while
304
- * the message goes out, because the message carries the attachments AS THEY WERE at
305
- * the press: a chip removed mid-send has gone with it all the same, and one added
306
- * mid-send looks as if it had. The field has no drop target; the paste is its drop.
307
- *
308
- * This is a pause, not a lock that explains itself — for that, `refs` mode (the mode
309
- * that commits) takes `commit` and `disabledReason`.
310
- */
311
- disabled?: boolean;
312
- /** Snapshot the app view behind this and return it as a File. A "Capture
313
- * screenshot" button appears only when it is given. */
314
- onCaptureScreenshot?: () => Promise<File | null>;
315
- /** Listen for the paste on `document` rather than on this field's own
316
- * subtree. For a modal, which owns the whole page while it is up. */
317
- documentPaste?: boolean;
318
- /** Listen for the paste within this element's subtree rather than this
319
- * field's own — for a field standing *beside* the text box a paste is made
320
- * in, whose common parent is where the event bubbles to. Ignored when
321
- * `documentPaste` is set. */
322
- pasteFrom?: RefObject<HTMLElement | null>;
323
- className?: string;
324
- }
325
- /** One file: choosing a second means removing the first. The field's only mode until 0.15.5. */
326
- interface FeedbackAttachmentFieldSingleProps extends FeedbackAttachmentFieldBaseProps {
327
- multiple?: false;
328
- refs?: false;
329
- value: File | null;
330
- onChange: (file: File | null) => void;
331
- /** A file was refused. `info` (0.23.0) names it and the limit — see
332
- * {@link FeedbackAttachmentErrorInfo}. */
333
- onError?: (kind: "type" | "size", info: FeedbackAttachmentErrorInfo) => void;
334
- max?: never;
335
- screenshot?: never;
336
- onScreenshotChange?: never;
337
- commit?: never;
338
- disabledReason?: never;
339
- }
340
- /**
341
- * Several files (0.15.5, keksdose dev#578: "pasted two photos, the second overwrote
342
- * the first"). Every way in ADDS — a pick of several files, a paste, a capture — up to
343
- * `max`, and each file is a removable chip.
344
- */
345
- interface FeedbackAttachmentFieldMultipleProps extends FeedbackAttachmentFieldBaseProps {
346
- multiple: true;
347
- refs?: false;
348
- value: File[];
349
- onChange: (files: File[]) => void;
350
- /** How many files `value` may hold. Default {@link DEFAULT_MAX_ATTACHMENTS} (5). The
351
- * add buttons and the paste hint are offered only while there is room. */
352
- max?: number;
353
- /** Per file: a rejected one is reported and the others are still added. `"count"` is
354
- * once per pick, with the whole surplus in `info.files`. `info` (0.23.0): see
355
- * {@link FeedbackAttachmentErrorInfo}. */
356
- onError?: (kind: FeedbackAttachmentError, info: FeedbackAttachmentErrorInfo) => void;
357
- /**
358
- * A separate slot for THE screenshot, outside `value` and `max`. Given
359
- * `onScreenshotChange`, what `onCaptureScreenshot` returns lands here instead of in
360
- * `value`, shown as the first chip, and the capture button is offered only while the
361
- * slot is empty — a second snapshot of the same view is not more evidence. This is
362
- * how `<FeedbackDialog attachments="multiple">` keeps the screenshot apart from the
363
- * photos; a form built from the parts can do the same.
364
- */
365
- screenshot?: File | null;
366
- onScreenshotChange?: (file: File | null) => void;
367
- commit?: never;
368
- disabledReason?: never;
369
- }
370
- /**
371
- * Uploaded on pick (0.22.0, keksdose K16). keksdose's support chat uploads each file
372
- * the moment it is chosen and sends the message with the REFS the uploads answered —
373
- * a 10 MB screenshot is refused while the reporter is still typing, not when they
374
- * press Send — so its `AttachmentPicker` could not use this field, whose value is
375
- * `File`s held until the form is submitted. Here the value is
376
- * {@link FeedbackAttachmentRef}s: every way in (pick, paste, capture) validates the
377
- * file as the other modes do, then hands it to `onUpload` and shows a chip with a
378
- * spinner until it answers; the ref it resolves to joins `value` through `onChange`.
379
- * A rejection drops the chip and reports `onError("upload", error)`. A chip is removed
380
- * BY KEY: `onChange` gets the list without it, and `onRemove` the key, for a host that
381
- * deletes the upload on the server too.
382
- *
383
- * Uploads still running count against `max`, so five picks in quick succession cannot
384
- * overshoot it; they are not in `value` until they land, so a send that reads `value`
385
- * sends only what has arrived — hold Send back while {@link onUploadingChange} says
386
- * an upload is running. Several files upload side by side and join in the order they
387
- * finish. The File modes are unchanged.
388
- */
389
- interface FeedbackAttachmentFieldRefsProps extends FeedbackAttachmentFieldBaseProps {
390
- refs: true;
391
- multiple?: never;
392
- value: FeedbackAttachmentRef[];
393
- onChange: (refs: FeedbackAttachmentRef[]) => void;
394
- /** Upload one file; resolve to its ref, or reject to refuse it. Called once per
395
- * accepted file, the moment it is chosen. */
396
- onUpload: (file: File) => Promise<FeedbackAttachmentRef>;
397
- /** A chip was removed — after `onChange` — with its ref's key. */
398
- onRemove?: (key: string) => void;
399
- /** Whether any upload is running: `true` when the first starts, `false` when the
400
- * last settles — for the host's Send, which should wait. */
401
- onUploadingChange?: (uploading: boolean) => void;
402
- /** How many refs `value` may hold, uploads in flight included. Default
403
- * {@link DEFAULT_MAX_ATTACHMENTS} (5). */
404
- max?: number;
405
- /** Per file. `"upload"` carries what `onUpload` rejected with as `error` (`undefined`
406
- * for the other kinds). `info` (0.23.0) comes third so a 0.22 handler's `error` is
407
- * still the second argument — see {@link FeedbackAttachmentErrorInfo}. */
408
- onError?: (kind: FeedbackAttachmentRefsError, error: unknown, info: FeedbackAttachmentErrorInfo) => void;
409
- /**
410
- * This field COMMITS (0.23.0): each file is uploaded the moment it is chosen, and a
411
- * remove may delete the upload (`onRemove`) — a save, unlike the File modes, which
412
- * only stage a file for a form sent later (and so stay open under a lock, like every
413
- * field). Under a locked {@link WriteLockProvider} it takes the `disabledReason` path
414
- * with the lock's reason, which wins over one of its own. No provider, or an unlocked
415
- * one: no effect.
416
- */
417
- commit?: boolean;
418
- /**
419
- * Why no file can be added or removed — the write lock's sentence, a quota, a thread
420
- * closed to replies. Unlike `disabled`, it SAYS so, the kit's commit-control way: the
421
- * buttons (add, capture, every chip's remove) stay focusable, `aria-disabled`, with
422
- * the reason in the kit Tooltip and their description; no pick, paste or remove gets
423
- * through; and the reason stands where the paste hint was, for a phone that never
424
- * hovers. The chips stay readable.
425
- */
426
- disabledReason?: ReactNode;
427
- screenshot?: never;
428
- onScreenshotChange?: never;
429
- }
430
- type FeedbackAttachmentFieldProps = FeedbackAttachmentFieldSingleProps | FeedbackAttachmentFieldMultipleProps | FeedbackAttachmentFieldRefsProps;
431
- /**
432
- * Picking one picture: the file dialog, a capture of the app view, or a paste.
433
- * With `multiple`, picking several (see {@link FeedbackAttachmentFieldMultipleProps}).
434
- *
435
- * Lifted out of {@link FeedbackDialog} so the *reply* half of the feature can
436
- * have it too (Steering Design feedback #128). A report is a conversation — it
437
- * is filed, it is answered, and the reporter sends it back saying that is not
438
- * what they meant — and the screenshot showing what they mean is taken at
439
- * whichever of those points they looked. Only the first of them had a way to
440
- * attach one, so everything after it had to be described in words.
441
- *
442
- * **Three ways in, and they are three because no one of them covers the others.**
443
- * The file dialog needs a file on disk; `onCaptureScreenshot` snapshots the
444
- * *whole* app view; and the clipboard is where a region snip already is on every
445
- * platform (Steering Design feedback #39). Somebody who wanted to show one panel
446
- * had to save a crop and then find it again.
447
- *
448
- * `documentPaste` and `pasteFrom` decide where the paste is listened for, and
449
- * it is a real choice rather than a flag with a default. A modal traps focus,
450
- * so while it is up every paste in the page is meant for it — including one
451
- * made with nothing in particular focused, which never reaches a React
452
- * `onPaste` on a child: that is `documentPaste`. An editor **inline on a
453
- * page** is not that: the page around it has its own fields, so it listens
454
- * within its own subtree and a paste elsewhere stays where it was aimed. But
455
- * "its own subtree" has to include the text box the paste is actually made in,
456
- * and that box is this field's *sibling*, not its child — a paste in it bubbles
457
- * to their common parent and never through here. `pasteFrom` is that parent
458
- * (Steering Design feedback #140): the element whose subtree is listened to,
459
- * handed in by whoever renders both the box and this field side by side.
460
- */
461
- declare function FeedbackAttachmentField(props: FeedbackAttachmentFieldProps): react.JSX.Element;
462
- /** What a pasted image is called once it is an attachment.
463
- *
464
- * The extension is read off the mime type rather than assumed to be `.png`:
465
- * Safari puts TIFF on the clipboard and a file called `pasted.png` that is not
466
- * a PNG is one the receiving end opens wrong. */
467
- declare function pastedName(type: string): string;
468
-
469
- export { DEFAULT_ATTACHMENT_ACCEPT as D, type FeedbackAttachmentError as F, DEFAULT_FEEDBACK_ATTACHMENT_LABELS as a, DEFAULT_FEEDBACK_DIALOG_LABELS as b, DEFAULT_MAX_ATTACHMENTS as c, DEFAULT_MAX_ATTACHMENT_BYTES as d, type FeedbackAttachmentErrorInfo as e, FeedbackAttachmentField as f, type FeedbackAttachmentFieldLabels as g, type FeedbackAttachmentFieldMultipleProps as h, type FeedbackAttachmentFieldProps as i, type FeedbackAttachmentFieldRefsProps as j, type FeedbackAttachmentFieldSingleProps as k, type FeedbackAttachmentLabels as l, type FeedbackAttachmentRef as m, type FeedbackAttachmentRefsError as n, type FeedbackCategoryOption as o, FeedbackDialog as p, type FeedbackDialogLabels as q, type FeedbackDialogMultipleProps as r, type FeedbackDialogProps as s, type FeedbackDialogSingleProps as t, type FeedbackDialogTextLabels as u, type FeedbackMultipleSubmission as v, type FeedbackSubmission as w, pastedName as x };