gridsmith-ui 0.19.0 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -106,8 +106,19 @@ interface FieldControlWiring {
106
106
  required?: boolean;
107
107
  error?: boolean;
108
108
  }
109
+ /**
110
+ * A field's label: any text or element, never nothing. Sprint 25.12 A31 (R28-59): run 75 labelled only the first of its
111
+ * repeated rows (`label={index === 0 ? … : undefined}`), and every other row's fields had no name. A label that
112
+ * shouldn't show takes `hideLabel`; repeated rows use AddAnother, which shows each label once.
113
+ */
114
+ type FieldLabel = Exclude<ReactNode, null | undefined | boolean>;
109
115
  interface FieldProps {
110
- label: ReactNode;
116
+ label: FieldLabel;
117
+ /**
118
+ * The label is read out but not shown (Sprint 25.12 A31): for a field whose purpose the page shows another way, such
119
+ * as a column heading above repeated rows. In an AddAnother group it shows again when the group stacks its rows.
120
+ */
121
+ hideLabel?: boolean;
111
122
  /** The single form control. Receives id, aria-describedby, aria-invalid/error and required automatically. */
112
123
  children: ReactElement | ((props: FieldControlProps) => ReactNode);
113
124
  /** Persistent help text (format requirements, why a field is disabled). Shown below the control, above any error. */
@@ -123,7 +134,8 @@ interface FieldProps {
123
134
  * - `onSubmit`: on submit only.
124
135
  *
125
136
  * Whatever the timing, it runs on every submit, and FormWrapper's `onSubmit` gets its message under this Field's
126
- * `id`. A message that shows is checked again as the value changes, so it goes as soon as the value is right. Focus
137
+ * `id`, or no key at all when the value passes, so an empty `errors` means the form is valid. A message that shows is
138
+ * checked again as the value changes, so it goes as soon as the value is right. Focus
127
139
  * moving into the control's own popup (a Dropdown's list, a DatePicker's calendar) is not leaving the field. Outside
128
140
  * a FormWrapper it runs when the field is left (round 26, R26-2).
129
141
  */
@@ -145,7 +157,7 @@ interface FieldProps {
145
157
  * In a SettingsLayout panel a Field keeps the narrow page's reading width however wide the page is (the panel's
146
158
  * --ds-form-max, Sprint 25.9); a `max-w-*` class of your own wins.
147
159
  */
148
- declare function Field({ label, children, hint, error, required, labelAction, id: idProp, validate, className }: FieldProps): react_jsx_runtime.JSX.Element;
160
+ declare function Field({ label, children, hint, error, required, labelAction, hideLabel, id: idProp, validate, className }: FieldProps): react_jsx_runtime.JSX.Element;
149
161
 
150
162
  interface Option {
151
163
  id: string;
@@ -172,7 +184,7 @@ interface DropdownProps extends FieldControlWiring {
172
184
  /** Accessible name for the trigger, for when there is no visible `label` (e.g. in a toolbar). */
173
185
  "aria-label"?: string;
174
186
  }
175
- declare function Dropdown({ options, value, onChange, label, disabled, placeholder, multiple, searchable, size: sizeProp, className, ref, container, error, showChips, "aria-label": ariaLabel, ...wiring }: DropdownProps): react_jsx_runtime.JSX.Element;
187
+ declare function Dropdown({ options, value, onChange: onChangeProp, label, disabled, placeholder, multiple, searchable, size: sizeProp, className, ref, container, error, showChips, "aria-label": ariaLabel, ...wiring }: DropdownProps): react_jsx_runtime.JSX.Element;
176
188
 
177
189
  interface ComboboxOption {
178
190
  value: string;
@@ -192,10 +204,11 @@ interface ComboboxProps extends FieldControlWiring {
192
204
  error?: boolean;
193
205
  size?: ControlSize;
194
206
  }
195
- declare function Combobox({ value, onChange, options, placeholder, disabled, loading, className, ref, container, error, size: sizeProp, ...wiring }: ComboboxProps): react_jsx_runtime.JSX.Element;
207
+ declare function Combobox({ value, onChange: onChangeProp, options, placeholder, disabled, loading, className, ref, container, error, size: sizeProp, ...wiring }: ComboboxProps): react_jsx_runtime.JSX.Element;
196
208
 
197
209
  type CheckboxSize = "sm" | "md";
198
- interface CheckboxProps {
210
+ /** A Field passes its wiring (0.21.0): its label names the box, and its hint and error describe it. */
211
+ interface CheckboxProps extends FieldControlWiring {
199
212
  checked: boolean;
200
213
  onChange: (checked: boolean) => void;
201
214
  label?: string;
@@ -205,7 +218,7 @@ interface CheckboxProps {
205
218
  className?: string;
206
219
  ref?: Ref<HTMLInputElement>;
207
220
  }
208
- declare function Checkbox({ checked, onChange, label, size, disabled, indeterminate, className, ref }: CheckboxProps): react_jsx_runtime.JSX.Element;
221
+ declare function Checkbox({ checked, onChange: onChangeProp, label, size, disabled, indeterminate, className, ref, ...wiring }: CheckboxProps): react_jsx_runtime.JSX.Element;
209
222
  interface CheckboxGroupProps {
210
223
  value: string[];
211
224
  onChange: (value: string[]) => void;
@@ -229,7 +242,8 @@ interface RadioOption {
229
242
  label: string;
230
243
  disabled?: boolean;
231
244
  }
232
- interface RadioGroupProps {
245
+ /** A Field passes its wiring (0.21.0): its label names the group, and its hint and error describe it. */
246
+ interface RadioGroupProps extends FieldControlWiring {
233
247
  value: string;
234
248
  onChange: (value: string) => void;
235
249
  options: RadioOption[];
@@ -237,7 +251,7 @@ interface RadioGroupProps {
237
251
  className?: string;
238
252
  label?: string;
239
253
  }
240
- declare function RadioGroup({ value, onChange, options, orientation, className, label }: RadioGroupProps): react_jsx_runtime.JSX.Element;
254
+ declare function RadioGroup({ value, onChange: onChangeProp, options, orientation, className, label, ...wiring }: RadioGroupProps): react_jsx_runtime.JSX.Element;
241
255
 
242
256
  interface DatePickerProps extends Omit<FieldControlWiring, "id"> {
243
257
  value: Date | null;
@@ -266,7 +280,7 @@ interface DatePickerProps extends Omit<FieldControlWiring, "id"> {
266
280
  end?: Date | null;
267
281
  };
268
282
  }
269
- declare function DatePicker({ value, onChange, placeholder, disabled, className, ref, container, error, label, id, size: sizeProp, min, max, range, ...wiring }: DatePickerProps): react_jsx_runtime.JSX.Element;
283
+ declare function DatePicker({ value, onChange: onChangeProp, placeholder, disabled, className, ref, container, error, label, id, size: sizeProp, min, max, range, ...wiring }: DatePickerProps): react_jsx_runtime.JSX.Element;
270
284
 
271
285
  interface DateRange {
272
286
  start: Date | null;
@@ -305,10 +319,58 @@ declare const DEFAULT_DATE_RANGE_PRESETS: DateRangePreset[];
305
319
  * the end (clicking before the start restarts the selection). Closes on
306
320
  * Escape or outside click. Pair with <Field> for label/hint/error wiring.
307
321
  */
308
- declare function DateRangePicker({ value, onChange, placeholder, disabled, error, label, id, className, ref, container, min, max, presets, weekStartsOn, size: sizeProp, ...wiring }: DateRangePickerProps): react_jsx_runtime.JSX.Element;
322
+ declare function DateRangePicker({ value, onChange: onChangeProp, placeholder, disabled, error, label, id, className, ref, container, min, max, presets, weekStartsOn, size: sizeProp, ...wiring }: DateRangePickerProps): react_jsx_runtime.JSX.Element;
309
323
 
324
+ type FileUploadStatus = "added" | "queued" | "uploading" | "done" | "error";
325
+ /** One file in the list: the page's own (`files`), or FileUpload's (the file was picked here). */
326
+ interface FileUploadItem {
327
+ /** The page's id for the file (with `files`), or FileUpload's own. */
328
+ id: string;
329
+ name: string;
330
+ /** In bytes. */
331
+ size?: number;
332
+ /**
333
+ * "added": picked, with nothing uploading it (a FileUpload with only onFiles); "queued": waiting its turn;
334
+ * "uploading"; "done"; "error".
335
+ */
336
+ status: FileUploadStatus;
337
+ /** 0–100 while uploading. */
338
+ progress?: number;
339
+ /** Why it failed, in words ("The file is over 10 MB"). */
340
+ error?: string;
341
+ /** The picked File, when FileUpload has it. */
342
+ file?: File;
343
+ }
344
+ interface FileUploadRequestOptions {
345
+ /** Report progress, 0–100. */
346
+ onProgress: (percent: number) => void;
347
+ /** Aborted when the user cancels, the FileUpload goes, or its overlay closes: stop the request. */
348
+ signal: AbortSignal;
349
+ }
310
350
  interface FileUploadProps {
311
- onFiles: (files: File[]) => void;
351
+ /** The files the user picked or dropped, after the accept and size checks. */
352
+ onFiles?: (files: File[]) => void;
353
+ /**
354
+ * The page's uploads as they really are (Sprint 25.12 A33, R28-63): each file's status, progress and error. The list
355
+ * shows exactly these; the page adds what onFiles gives it, and answers onCancel, onRetry and onRemove. Pass `files`
356
+ * or `upload`, not both.
357
+ */
358
+ files?: FileUploadItem[];
359
+ /**
360
+ * Uploads one file. FileUpload runs it for each picked file, at most three at once while the rest wait, and keeps the
361
+ * list itself: report progress with onProgress, resolve when done, reject to fail (the error's message says why), and
362
+ * stop when the signal aborts. Cancel aborts; Retry runs it again with a fresh signal.
363
+ */
364
+ upload?: (file: File, options: FileUploadRequestOptions) => Promise<unknown>;
365
+ /** A running upload's Cancel. With `upload`, FileUpload has already aborted it and taken it off the list. */
366
+ onCancel?: (item: FileUploadItem) => void;
367
+ /** A failed upload's Retry. With `upload`, FileUpload runs it again itself. */
368
+ onRetry?: (item: FileUploadItem) => void;
369
+ /**
370
+ * A file's Remove. With `files` the page takes it off its list; otherwise FileUpload does, and tells the page. Without
371
+ * it, Remove shows only on a failed file: the page would still have a file the user removed (0.21.0).
372
+ */
373
+ onRemove?: (item: FileUploadItem) => void;
312
374
  /**
313
375
  * The types the zone takes, as for an `<input type="file">`: ".csv", "image/*", "application/pdf". The zone says them
314
376
  * in words ("CSV files"), and a picked or dropped file that isn't one gets a message instead of reaching onFiles.
@@ -328,7 +390,7 @@ interface FileUploadProps {
328
390
  /** The file input's id. A Field passes its own, so its label opens the picker. */
329
391
  id?: string;
330
392
  }
331
- declare function FileUpload({ onFiles, accept, multiple, maxSize, className, error, label, id }: FileUploadProps): react_jsx_runtime.JSX.Element;
393
+ declare function FileUpload({ onFiles, files, upload, onCancel, onRetry, onRemove, accept, multiple, maxSize, className, error, label, id }: FileUploadProps): react_jsx_runtime.JSX.Element;
332
394
 
333
395
  interface SliderRangeProps {
334
396
  /**
@@ -362,7 +424,7 @@ interface SliderRangeProps {
362
424
  */
363
425
  formatValue?: (value: number) => string;
364
426
  }
365
- declare function SliderRange({ value, onChange, min, max, step, disabled, showValue, className, ref, error, label, "aria-label": ariaLabel, "aria-describedby": describedByProp, trackStyle, formatValue }: SliderRangeProps): react_jsx_runtime.JSX.Element;
427
+ declare function SliderRange({ value, onChange: onChangeProp, min, max, step, disabled, showValue, className, ref, error, label, "aria-label": ariaLabel, "aria-describedby": describedByProp, trackStyle, formatValue }: SliderRangeProps): react_jsx_runtime.JSX.Element;
366
428
 
367
429
  interface TimePickerProps extends Omit<FieldControlWiring, "id"> {
368
430
  value: string;
@@ -378,7 +440,7 @@ interface TimePickerProps extends Omit<FieldControlWiring, "id"> {
378
440
  id?: string;
379
441
  size?: ControlSize;
380
442
  }
381
- declare function TimePicker({ value, onChange, use24Hour, minuteStep, disabled, className, ref, container, error, id, size: sizeProp, ...wiring }: TimePickerProps): react_jsx_runtime.JSX.Element;
443
+ declare function TimePicker({ value, onChange: onChangeProp, use24Hour, minuteStep, disabled, className, ref, container, error, id, size: sizeProp, ...wiring }: TimePickerProps): react_jsx_runtime.JSX.Element;
382
444
 
383
445
  interface NumberInputProps {
384
446
  value: number;
@@ -398,7 +460,7 @@ interface NumberInputProps {
398
460
  /** Forwarded to the inner input element so a Label htmlFor can be associated. */
399
461
  id?: string;
400
462
  }
401
- declare function NumberInput({ value, onChange, min, max, step, disabled, placeholder, prefix, suffix, size: sizeProp, className, error, allowDecimals, id, }: NumberInputProps): react_jsx_runtime.JSX.Element;
463
+ declare function NumberInput({ value, onChange: onChangeProp, min, max, step, disabled, placeholder, prefix, suffix, size: sizeProp, className, error, allowDecimals, id, }: NumberInputProps): react_jsx_runtime.JSX.Element;
402
464
 
403
465
  interface TagInputProps {
404
466
  value: string[];
@@ -413,7 +475,7 @@ interface TagInputProps {
413
475
  /** Accessible name for the input when no visible Label is associated via id. Default "Add tag". */
414
476
  "aria-label"?: string;
415
477
  }
416
- declare function TagInput({ value, onChange, placeholder, maxTags, disabled, className, error, id, "aria-label": ariaLabel }: TagInputProps): react_jsx_runtime.JSX.Element;
478
+ declare function TagInput({ value, onChange: onChangeProp, placeholder, maxTags, disabled, className, error, id, "aria-label": ariaLabel }: TagInputProps): react_jsx_runtime.JSX.Element;
417
479
 
418
480
  interface PinInputProps {
419
481
  value: string;
@@ -427,9 +489,10 @@ interface PinInputProps {
427
489
  /** Forwarded to the first pin box so a Label htmlFor can be associated. */
428
490
  id?: string;
429
491
  }
430
- declare function PinInput({ value, onChange, length, mask, disabled, size: sizeProp, className, error, id, }: PinInputProps): react_jsx_runtime.JSX.Element;
492
+ declare function PinInput({ value, onChange: onChangeProp, length, mask, disabled, size: sizeProp, className, error, id, }: PinInputProps): react_jsx_runtime.JSX.Element;
431
493
 
432
- interface RatingProps {
494
+ /** A Field passes its wiring (0.21.0): its label names the stars, and its hint and error describe them. */
495
+ interface RatingProps extends FieldControlWiring {
433
496
  value: number;
434
497
  onChange?: (value: number) => void;
435
498
  max?: number;
@@ -439,7 +502,7 @@ interface RatingProps {
439
502
  className?: string;
440
503
  error?: boolean;
441
504
  }
442
- declare function Rating({ value, onChange, max, allowHalf, readOnly, size, className, error, }: RatingProps): react_jsx_runtime.JSX.Element;
505
+ declare function Rating({ value, onChange: onChangeProp, max, allowHalf, readOnly, size, className, error, ...wiring }: RatingProps): react_jsx_runtime.JSX.Element;
443
506
 
444
507
  interface ColorPickerProps {
445
508
  value: string;
@@ -450,7 +513,7 @@ interface ColorPickerProps {
450
513
  className?: string;
451
514
  error?: boolean;
452
515
  }
453
- declare function ColorPicker({ value, onChange, showAlpha, swatches, disabled, className, error, }: ColorPickerProps): react_jsx_runtime.JSX.Element;
516
+ declare function ColorPicker({ value, onChange: onChangeProp, showAlpha, swatches, disabled, className, error, }: ColorPickerProps): react_jsx_runtime.JSX.Element;
454
517
 
455
518
  interface InlineFieldErrorProps {
456
519
  message: string;
@@ -489,11 +552,18 @@ interface FormFieldError {
489
552
  }
490
553
  interface FormWrapperProps {
491
554
  /**
492
- * Called on each submit with the fields' errors, by Field id: the message of every Field whose `validate` finds its
493
- * value wrong, undefined for the rest. Save only when there are none. Checks of your own that set a Field's `error`
494
- * still work, and the form reads them from the page as before.
555
+ * Called on each submit, valid or not, with the fields that failed, by Field id: the message of every Field whose
556
+ * `validate` finds its value wrong. A field that passes has no key, so save when `errors` is empty
557
+ * (`Object.keys(errors).length === 0`). Checks of your own that set a Field's `error` still work, and the form reads
558
+ * them from the page as before.
559
+ *
560
+ * In a Drawer, Dialog or Sheet, return the save's promise: the overlay stops asking before discarding once it
561
+ * resolves, and keeps asking if it's rejected. If you catch a failure to show it, throw it again, so the promise
562
+ * rejects: one that resolves is a save. Returning nothing works for a save that keeps the form on screen or shows a
563
+ * confirmation in its place; a submit that moves on to another step keeps the overlay's changes until the flow saves
564
+ * (Sprint 25.12 A15). A field still invalid once the page has answered means nothing saved.
495
565
  */
496
- onSubmit: (errors: FormErrors) => void;
566
+ onSubmit: (errors: FormErrors) => unknown;
497
567
  validationMode?: ValidationMode;
498
568
  children: ReactNode;
499
569
  /**
@@ -503,8 +573,8 @@ interface FormWrapperProps {
503
573
  actions?: ReactNode;
504
574
  actionsAlign?: "start" | "end";
505
575
  /**
506
- * Renders a secondary Cancel before the actions. Inside a Drawer, a Dialog, or a Sheet given `dirty`, it closes the
507
- * overlay through its unsaved-changes check — the question Escape and the close control ask while the form is dirty —
576
+ * Renders a secondary Cancel before the actions. Inside a Drawer, a Dialog or a Sheet, it closes the overlay through
577
+ * its unsaved-changes check — the question Escape and the close control ask once the user has changed something —
508
578
  * and then this function runs, unless it is the overlay's own onClose; it does not run when the user keeps editing.
509
579
  * Anywhere else this function runs. Never hand-wire a Cancel to the overlay's close: it skips the question (round 21).
510
580
  */
@@ -530,6 +600,40 @@ interface FormWrapperProps {
530
600
  }
531
601
  declare function FormWrapper({ onSubmit, validationMode: validationModeProp, children, actions: actionsProp, actionsAlign: actionsAlignProp, onCancel, cancelLabel, focusFirstError, errorSummary, className, ref }: FormWrapperProps): react_jsx_runtime.JSX.Element;
532
602
 
603
+ interface AddAnotherProps<T> {
604
+ /** The rows. Each keeps its own id (`getId`), never its index, so its values, field ids and errors stay with it when another row goes. */
605
+ items: T[];
606
+ getId: (item: T) => string;
607
+ /** A row's name in words, from its position: `(i) => \`person ${i + 1}\``. It names every field in the row ("Email address, person 2") and the row's Remove button. */
608
+ itemName: (index: number) => string;
609
+ /** The fields' labels, in order. They show once, as the group's column headings; on a narrow group each field shows its own. */
610
+ columns: string[];
611
+ /**
612
+ * A row's fields. `label(column)` names a field for its row: wrap each control in
613
+ * `<Field hideLabel label={label("Email address")}>`, so it's read out in full while the heading shows it once.
614
+ */
615
+ renderRow: (item: T, index: number, label: (column: string) => string) => ReactNode;
616
+ onAdd: () => void;
617
+ onRemove: (id: string) => void;
618
+ /** The Add button's text (default "Add another"). */
619
+ addLabel?: string;
620
+ /** The group's own label, as a legend above it (for example "Team members"). */
621
+ label?: string;
622
+ /** Fewest rows kept (default 1): a row can't be removed below it. */
623
+ minItems?: number;
624
+ /** Most rows allowed: Add goes once there are this many. */
625
+ maxItems?: number;
626
+ className?: string;
627
+ }
628
+ /**
629
+ * Repeated rows of fields: MOJ's "Add another" (Sprint 25.12 A31, R28-59; the owner's P24). Builders dropped the labels
630
+ * of every row but the first to avoid repeating them on screen, and those fields had no name. Here the labels show
631
+ * once, as column headings, while every field is named for its row; Add and Remove name the row they act on, and
632
+ * focus moves to the new row after an add, or to the previous row after a removal. On a narrow group the rows stack,
633
+ * the headings go, and each field shows its own label.
634
+ */
635
+ declare function AddAnother<T>({ items, getId, itemName, columns, renderRow, onAdd, onRemove, addLabel, label, minItems, maxItems, className }: AddAnotherProps<T>): react_jsx_runtime.JSX.Element;
636
+
533
637
  interface TransferItem {
534
638
  id: string;
535
639
  label: string;
@@ -545,7 +649,7 @@ interface TransferListProps {
545
649
  className?: string;
546
650
  ref?: Ref<HTMLDivElement>;
547
651
  }
548
- declare function TransferList({ available, selected, onChange, availableTitle, selectedTitle, searchable, className, ref, }: TransferListProps): react_jsx_runtime.JSX.Element;
652
+ declare function TransferList({ available, selected, onChange: onChangeProp, availableTitle, selectedTitle, searchable, className, ref, }: TransferListProps): react_jsx_runtime.JSX.Element;
549
653
 
550
654
  interface MentionSuggestion {
551
655
  id: string;
@@ -562,7 +666,7 @@ interface MentionInputProps {
562
666
  disabled?: boolean;
563
667
  className?: string;
564
668
  }
565
- declare function MentionInput({ value: controlledValue, onChange, suggestions, trigger, placeholder, disabled, className, }: MentionInputProps): react_jsx_runtime.JSX.Element;
669
+ declare function MentionInput({ value: controlledValue, onChange: onChangeProp, suggestions, trigger, placeholder, disabled, className, }: MentionInputProps): react_jsx_runtime.JSX.Element;
566
670
 
567
671
  type CardVariant = "default" | "featured" | "interactive" | "outline" | "ghost";
568
672
  type CardSelectType = "radio" | "checkbox" | "toggle";
@@ -697,7 +801,12 @@ declare const DescriptionList: react.ForwardRefExoticComponent<DescriptionListPr
697
801
  type StatusDotVariant = "success" | "warning" | "error" | "info" | "neutral" | "offline";
698
802
  interface StatusDotProps {
699
803
  variant?: StatusDotVariant;
700
- label?: string;
804
+ /**
805
+ * The status in words ("Online", "Healthy"), drawn beside the dot and read as the status. Required: a dot alone would
806
+ * show the status by colour only (WCAG 1.4.1). Words a page already writes beside a dot are its label: pass them here
807
+ * and never write them again (Sprint 25.12 A48, R28-87).
808
+ */
809
+ label: string;
701
810
  pulse?: boolean;
702
811
  className?: string;
703
812
  }
@@ -2260,7 +2369,7 @@ interface SegmentedControlProps extends FieldControlWiring {
2260
2369
  */
2261
2370
  maxOptions?: number;
2262
2371
  }
2263
- declare function SegmentedControl({ value, onChange, options, size: sizeProp, variant, fullWidth, onHoverChange, className, "aria-label": ariaLabel, maxOptions, ...wiring }: SegmentedControlProps): react_jsx_runtime.JSX.Element;
2372
+ declare function SegmentedControl({ value, onChange: onChangeProp, options, size: sizeProp, variant, fullWidth, onHoverChange, className, "aria-label": ariaLabel, maxOptions, ...wiring }: SegmentedControlProps): react_jsx_runtime.JSX.Element;
2264
2373
 
2265
2374
  interface BottomNavItem {
2266
2375
  label: string;
@@ -2711,36 +2820,64 @@ type ToastVariant = "default" | "success" | "warning" | "error";
2711
2820
  type ToastPosition = "top-right" | "top-left" | "bottom-right" | "bottom-left" | "top-center" | "bottom-center";
2712
2821
  interface ToastAction {
2713
2822
  label: string;
2714
- onClick: () => void;
2823
+ /** Runs once when pressed; the toast then closes. It may return a promise (useDestructiveAction's Undo confirms itself when it settles). */
2824
+ onClick: () => unknown;
2715
2825
  }
2716
2826
  interface ToastProps {
2717
2827
  variant?: ToastVariant;
2718
2828
  message: ReactNode;
2719
2829
  visible: boolean;
2720
2830
  onDismiss: () => void;
2831
+ /** Milliseconds a plain toast stays. 0 or Infinity keeps it until dismissed. */
2721
2832
  duration?: number;
2722
2833
  pauseOnHover?: boolean;
2834
+ /**
2835
+ * The toast's action. Sprint 25.12 A40 (the sourced overlays#18): a toast with an action never closes on a timer while
2836
+ * the action can still be taken. With `actionWindow` the action lapses after that long: in a ToastProvider the toast
2837
+ * then stays as a plain message for its `duration`, and a standalone toast closes (onDismiss). Without one it stays until
2838
+ * the user acts or dismisses it.
2839
+ */
2723
2840
  action?: ToastAction;
2841
+ /** How long the action is offered once the toast shows, in ms (an Undo's window). A standalone toast closes when it ends. */
2842
+ actionWindow?: number;
2724
2843
  position?: ToastPosition;
2725
2844
  mode?: "light" | "dark";
2726
2845
  container?: Element | DocumentFragment;
2727
2846
  /**
2728
- * Render only the toast card, without the portal and fixed positioning.
2729
- * Used by ToastProvider, which owns stacking and placement. Standalone
2730
- * usage should leave this unset.
2847
+ * Render only the toast card, without the portal, the fixed position or a live region of its own. ToastProvider
2848
+ * renders cards this way: it owns their stacking, their timers' pause and their announcements. Standalone use
2849
+ * leaves this unset, and the toast announces itself.
2731
2850
  */
2732
2851
  inline?: boolean;
2852
+ /** ToastProvider: every timer pauses while the stack is hovered or holds focus. */
2853
+ paused?: boolean;
2854
+ /** ToastProvider: the action's window ran out (the provider drops the action and the plain time starts). */
2855
+ onActionLapse?: () => void;
2856
+ /** ToastProvider: the action was pressed (the provider runs it once and closes the toast). */
2857
+ onAction?: () => void;
2858
+ /** ToastProvider: a new value restarts the toast's time (a toast for the same item replaced this one). */
2859
+ restartKey?: number;
2733
2860
  }
2734
- declare function Toast({ variant, message, visible, onDismiss, duration, pauseOnHover, action, position, mode, container, inline }: ToastProps): react_jsx_runtime.JSX.Element | null;
2861
+ declare function Toast({ variant, message, visible, onDismiss, duration, pauseOnHover, action, actionWindow, position, mode, container, inline, paused, onActionLapse, onAction, restartKey }: ToastProps): react_jsx_runtime.JSX.Element | null;
2735
2862
 
2736
2863
  interface ToastOptions {
2737
2864
  variant?: ToastVariant;
2738
- /** Milliseconds before auto-dismiss. 0 or Infinity keeps the toast until dismissed. */
2865
+ /** Milliseconds a plain toast stays once shown. 0 or Infinity keeps it until dismissed. */
2739
2866
  duration?: number;
2867
+ /**
2868
+ * An action (Undo, Retry). A toast with an action stays until the user acts or dismisses it, or until its action
2869
+ * lapses (`actionWindow`); pressing it runs it once and closes the toast (Sprint 25.12 A40, A41).
2870
+ */
2740
2871
  action?: ToastAction;
2872
+ /** How long the action is offered once the toast shows, in ms (an Undo's window); the toast then stays as a plain message for its `duration`. */
2873
+ actionWindow?: number;
2741
2874
  /** Supply to update an existing toast in place instead of adding a new one. */
2742
2875
  id?: string;
2743
- /** Coalescing key (round 15): while the visible slots are full, a new toast replaces the queued toast with the same key instead of joining the queue behind it. Defaults to the variant. */
2876
+ /**
2877
+ * The item this toast is about (Sprint 25.12 A7, D28): a new toast with the same key takes the place of the one on
2878
+ * screen, or the one waiting, and its time starts again — six flips of one switch give one toast. Toasts without a
2879
+ * key never merge, whatever their wording; toasts with an action, and errors, never merge.
2880
+ */
2744
2881
  key?: string;
2745
2882
  }
2746
2883
  interface PromiseToastMessages<T> {
@@ -2749,7 +2886,7 @@ interface PromiseToastMessages<T> {
2749
2886
  error: ReactNode | ((error: unknown) => ReactNode);
2750
2887
  }
2751
2888
  interface ToastApi {
2752
- /** Enqueue a toast. Returns its id. */
2889
+ /** Show a toast (it waits behind the stack when the stack is full). Returns its id. */
2753
2890
  toast: (message: ReactNode, options?: ToastOptions) => string;
2754
2891
  success: (message: ReactNode, options?: Omit<ToastOptions, "variant">) => string;
2755
2892
  warning: (message: ReactNode, options?: Omit<ToastOptions, "variant">) => string;
@@ -2763,31 +2900,38 @@ interface ToastApi {
2763
2900
  }
2764
2901
  interface ToastProviderProps {
2765
2902
  children: ReactNode;
2766
- /** Maximum toasts shown at once; further toasts queue until one dismisses. Default 1 — the house rule (feedback-notifications rule 4: one at a time, the rest queued). */
2903
+ /**
2904
+ * Most toasts shown at once (the project's notifications.toastMaxVisible). The rest wait behind a "+N" count, their
2905
+ * time starting only when shown. Default 3 (Sprint 25.12 A40, the owner's R28-81: every deletion's confirmation
2906
+ * shows); 1 is the least.
2907
+ */
2767
2908
  maxVisible?: number;
2768
2909
  /** Where the stack is anchored. Default "bottom-right". */
2769
2910
  position?: ToastPosition;
2770
- /** Default auto-dismiss duration in ms. Default 5000. */
2911
+ /** Default time a plain toast stays, in ms. Default 5000. */
2771
2912
  duration?: number;
2772
- /**
2773
- * Round 15 (the owner's 52.4): ten toggle flips queued ten toasts, each waiting its full duration. While the visible
2774
- * slots are full, a new toast replaces the queued toast that shares its key (the variant by default) — the user sees
2775
- * the current one and the latest, never a backlog. Default true.
2776
- */
2913
+ /** Toasts with the same explicit `key` replace each other (D28). Default true. */
2777
2914
  coalesce?: boolean;
2778
2915
  /** Independent colour mode for toasts, when the theme configures one. */
2779
2916
  mode?: "light" | "dark";
2780
- /** Pause a toast's timer while hovered. Default true. */
2917
+ /** Pause every toast's time while the stack is hovered (focus inside it always pauses). Default true. */
2781
2918
  pauseOnHover?: boolean;
2782
2919
  }
2783
2920
  declare function useToast(): ToastApi;
2784
2921
  /** The toast API when a ToastProvider is above, else null — for components that can do without one (useDestructiveAction in dialog mode). */
2785
2922
  declare function useToastOptional(): ToastApi | null;
2786
2923
  /**
2787
- * Queue-backed toast manager. Wrap the app once (get_app_shell does this),
2788
- * then call useToast() anywhere. Enforces the configured maximum visible
2789
- * count, stacks toasts at the configured position, and provides success /
2790
- * error / promise helpers so pages never hand-roll their own queue.
2924
+ * Toasts for the whole app. Wrap it once (get_app_shell does), then call useToast() anywhere (Sprint 25.12 A40):
2925
+ * - up to `maxVisible` show at once; the rest wait behind a "+N" count, their time starting only when shown, with
2926
+ * toasts that carry an action and errors ahead of plain confirmations; "Clear all" empties the stack;
2927
+ * - only toasts for the same item (the same `key`) replace each other (D28);
2928
+ * - hovering the stack, or focus inside it, pauses every toast's time, an Undo's window included;
2929
+ * - two live regions, polite and assertive, present from the start, announce each toast once as it comes; the cards
2930
+ * themselves stay quiet;
2931
+ * - F8 moves focus to the stack (a region named "Notifications"), and a toast with an action says so as it's announced;
2932
+ * when an action or the dismiss button closes a toast, focus returns where it was, else to the next toast, else
2933
+ * to the page's main content;
2934
+ * - on a phone the stack sits above the bottom tab bar.
2791
2935
  */
2792
2936
  declare function ToastProvider({ children, maxVisible, position, duration, mode, pauseOnHover, coalesce }: ToastProviderProps): react_jsx_runtime.JSX.Element;
2793
2937
 
@@ -3107,12 +3251,27 @@ interface DestructiveActionOptions {
3107
3251
  confirmLabel?: string;
3108
3252
  /** The text the user must type when the action is on the type-to-confirm list (the item's name). */
3109
3253
  typeToConfirm?: string;
3110
- /** Performs the action. In undo mode it runs at once. */
3111
- onConfirm: () => void | Promise<void>;
3112
- /** Restores what the action removed; the Undo toast's action in undo mode. Without it the toast has no Undo. */
3113
- onUndo?: () => void;
3114
- /** The toast's message in undo mode ("Office removed"). */
3254
+ /**
3255
+ * Performs the action. In undo mode it runs at once. Reject (throw) when it fails: the hook then says so and claims
3256
+ * nothing. Any return is allowed; a promise is awaited.
3257
+ */
3258
+ onConfirm: () => unknown;
3259
+ /**
3260
+ * Restores what the action removed; the Undo toast's action in undo mode. Without it the toast has no Undo. It may
3261
+ * return a promise: once it resolves the hook confirms with a toast (`restoredMessage`), and a rejection shows an
3262
+ * error toast (Sprint 25.12 A41).
3263
+ */
3264
+ onUndo?: () => unknown;
3265
+ /**
3266
+ * The completed action's message, in both modes ("Office removed"): the confirmation toast in dialog mode, and the
3267
+ * text beside Undo in undo mode. Without it the hook says the action's verb in the past tense ("Removed"). A page
3268
+ * that shows its own toast during `onConfirm` isn't given a second one (Sprint 25.12 A34).
3269
+ */
3270
+ doneMessage?: ReactNode;
3271
+ /** The older name of `doneMessage`, for undo mode. */
3115
3272
  undoMessage?: ReactNode;
3273
+ /** The toast once an Undo has worked ("Office restored"); "Restored" without one. */
3274
+ restoredMessage?: ReactNode;
3116
3275
  /** `high` always confirms in a dialog, even in undo mode; the preference's high-severity list does the same by key. */
3117
3276
  severity?: "low" | "high";
3118
3277
  }
@@ -3275,4 +3434,4 @@ interface UseTextOverflowResult {
3275
3434
  */
3276
3435
  declare function useTextOverflow(options?: UseTextOverflowOptions): UseTextOverflowResult;
3277
3436
 
3278
- export { Accordion, ActionPanel, ActionPanelGroup, Alert, type AlertPlacement, AppShell, type AppShellContextValue, type AppShellFocus, type AppShellPreferences, type AppShellTheme, AsidePanel, type AsidePanelProps, type AsidePanelSide, Avatar, AvatarGroup, type AvatarGroupItem, type AvatarGroupProps, type AvatarStatus, Badge, type BadgePaletteColor, type BadgeSeverity, type BadgeSize, type BadgeVariant, BottomNav, type BottomNavItem, type BreadcrumbItem$1 as BreadcrumbItem, Breadcrumbs, type BreadcrumbsSeparator, type BreadcrumbsSize, type BreadcrumbsVariant, BreakpointKey, BulkActionBar, Button, ButtonSizeContext, Calendar, type CalendarDay, Card, CardContent, CardDescription, CardFooter, CardGrid, type CardGridProps, CardHeader, type CardSelectType, CardTitle, type CardVariant, Carousel, type ChatMessage, type ChatMessageAction, type ChatMessageLayout, ChatMessageList, type ChatMessageSender, type ChatMessageSource, type ChatMessageStatus, ChatPanel, type ChatPanelProps, type ChatPanelStatusTone, Checkbox, CheckboxGroup, CheckboxGroupItem, CodeBlock, Collapsible, ColorPicker, type Column, Combobox, CommandPalette, ContextMenu, type ControlSize, ControlSizeContext, CornerPanel, type CornerPanelEdge, type CornerPanelProps, DEFAULT_DATE_RANGE_PRESETS, DataList, type DateInput, DatePicker, type DateRange, DateRangePicker, type DateRangePickerProps, type DateRangePreset, type DateRangeWords, type DescriptionItem, DescriptionList, type DescriptionListOrientation, type DescriptionListSize, type DestructiveActionHandle, type DestructiveActionOptions, Dialog, Divider, Dock, Drawer, Dropdown, DropdownMenu, type DropdownMenuDivider, type DropdownMenuEntry, type DropdownMenuItem, EmptyState, EntityCell, Field, type FieldControlProps, type FieldProps, FileUpload, type FitLabelsOptions, type FittedLabel, FormWrapper, Gantt, type GanttGroup, type GanttItem, type GanttProps, type GanttStatus, type GanttTone, type GridKeyboard, type GridKeyboardOptions, HoverCard, InlineFieldError, Input, Kbd, Label, type LabelBox, Launcher, type LauncherEdge, type LauncherProps, type LauncherVariant, type LauncherWhenOpen, Link, type LinkProps, MentionInput, MobileHeaderMenu, type MobileHeaderMenuItemData, type MobileHeaderMenuType, NavItem, type NavItemProps, type NavItemType, NavMenu, type NavMenuItem, Navbar, type NavbarSize, type NavbarType, type NavbarVariant, NotificationCenter, NumberInput, PageContainer, type PageContainerWidth, PageHeader, type PageHeaderBehavior, type PageHeaderIntensity, type PageHeaderProps, type PageHeaderVariant, type Pager, Pagination, type PaginationOptions, PinInput, Popover, PreferencesContext, Progress, type PromiseToastMessages, RadioGroup, Rating, type ResolvedPreferences, ScrollArea, SectionHeading, type SectionHeadingProps, SegmentedControl, SettingsLayout, type SettingsLayoutProps, type SettingsSection, Sheet, Sidebar, type SidebarContextValue, type SidebarItem, SidebarNav, type SidebarNavSize, type SidebarPosition, type SidebarSection, type SidebarType, Skeleton, SkipLink, SliderRange, Spinner, StackedList, type StackedListVariant, StatsCard, StatusDot, type StatusDotVariant, Stepper, TIME_ZOOMS, type Tab, Table, type TableDensity, type TableProps, TableToolbar, type TableToolbarActiveFilter, type TableToolbarFilterOption, Tabs, Tag, TagInput, type TagPaletteColor, type TagVariant, TextOverflow, type TextOverflowProps, Textarea, TimeBar, type TimeBarProps, TimePicker, TimeRow, type TimeRowProps, type TimeScale, TimeScaleHeader, type TimeScaleHeaderProps, type TimeScaleOptions, type TimeTick, TimeViewport, type TimeViewportHandle, type TimeViewportLayout, type TimeViewportProps, type TimeViewportState, type TimeZoom, Timeline, Toast, type ToastAction, type ToastApi, type ToastOptions, type ToastPosition, ToastProvider, type ToastVariant, Toggle, Tooltip, Tour, TransferList, TreeView, type Trend, type UseTextOverflowOptions, type UseTextOverflowResult, dateOfDay, dayOf, endDayOf, fitLabel, fitLabels, formatDateRange, preferenceActionKey, timeExtent, useAppShell, useContentWidth, useDestructiveAction, useFittedLabels, useFormContext, useGridKeyboard, usePagination, usePreferences, useSidebar, useTextMeasure, useTextOverflow, useTimeScale, useTimeViewport, useTimeViewportLayout, useToast, useToastOptional, useUnsavedChanges };
3437
+ export { Accordion, ActionPanel, ActionPanelGroup, AddAnother, type AddAnotherProps, Alert, type AlertPlacement, AppShell, type AppShellContextValue, type AppShellFocus, type AppShellPreferences, type AppShellTheme, AsidePanel, type AsidePanelProps, type AsidePanelSide, Avatar, AvatarGroup, type AvatarGroupItem, type AvatarGroupProps, type AvatarStatus, Badge, type BadgePaletteColor, type BadgeSeverity, type BadgeSize, type BadgeVariant, BottomNav, type BottomNavItem, type BreadcrumbItem$1 as BreadcrumbItem, Breadcrumbs, type BreadcrumbsSeparator, type BreadcrumbsSize, type BreadcrumbsVariant, BreakpointKey, BulkActionBar, Button, ButtonSizeContext, Calendar, type CalendarDay, Card, CardContent, CardDescription, CardFooter, CardGrid, type CardGridProps, CardHeader, type CardSelectType, CardTitle, type CardVariant, Carousel, type ChatMessage, type ChatMessageAction, type ChatMessageLayout, ChatMessageList, type ChatMessageSender, type ChatMessageSource, type ChatMessageStatus, ChatPanel, type ChatPanelProps, type ChatPanelStatusTone, Checkbox, CheckboxGroup, CheckboxGroupItem, CodeBlock, Collapsible, ColorPicker, type Column, Combobox, CommandPalette, ContextMenu, type ControlSize, ControlSizeContext, CornerPanel, type CornerPanelEdge, type CornerPanelProps, DEFAULT_DATE_RANGE_PRESETS, DataList, type DateInput, DatePicker, type DateRange, DateRangePicker, type DateRangePickerProps, type DateRangePreset, type DateRangeWords, type DescriptionItem, DescriptionList, type DescriptionListOrientation, type DescriptionListSize, type DestructiveActionHandle, type DestructiveActionOptions, Dialog, Divider, Dock, Drawer, Dropdown, DropdownMenu, type DropdownMenuDivider, type DropdownMenuEntry, type DropdownMenuItem, EmptyState, EntityCell, Field, type FieldControlProps, type FieldLabel, type FieldProps, FileUpload, type FileUploadItem, type FileUploadRequestOptions, type FileUploadStatus, type FitLabelsOptions, type FittedLabel, FormWrapper, Gantt, type GanttGroup, type GanttItem, type GanttProps, type GanttStatus, type GanttTone, type GridKeyboard, type GridKeyboardOptions, HoverCard, InlineFieldError, Input, Kbd, Label, type LabelBox, Launcher, type LauncherEdge, type LauncherProps, type LauncherVariant, type LauncherWhenOpen, Link, type LinkProps, MentionInput, MobileHeaderMenu, type MobileHeaderMenuItemData, type MobileHeaderMenuType, NavItem, type NavItemProps, type NavItemType, NavMenu, type NavMenuItem, Navbar, type NavbarSize, type NavbarType, type NavbarVariant, NotificationCenter, NumberInput, PageContainer, type PageContainerWidth, PageHeader, type PageHeaderBehavior, type PageHeaderIntensity, type PageHeaderProps, type PageHeaderVariant, type Pager, Pagination, type PaginationOptions, PinInput, Popover, PreferencesContext, Progress, type PromiseToastMessages, RadioGroup, Rating, type ResolvedPreferences, ScrollArea, SectionHeading, type SectionHeadingProps, SegmentedControl, SettingsLayout, type SettingsLayoutProps, type SettingsSection, Sheet, Sidebar, type SidebarContextValue, type SidebarItem, SidebarNav, type SidebarNavSize, type SidebarPosition, type SidebarSection, type SidebarType, Skeleton, SkipLink, SliderRange, Spinner, StackedList, type StackedListVariant, StatsCard, StatusDot, type StatusDotVariant, Stepper, TIME_ZOOMS, type Tab, Table, type TableDensity, type TableProps, TableToolbar, type TableToolbarActiveFilter, type TableToolbarFilterOption, Tabs, Tag, TagInput, type TagPaletteColor, type TagVariant, TextOverflow, type TextOverflowProps, Textarea, TimeBar, type TimeBarProps, TimePicker, TimeRow, type TimeRowProps, type TimeScale, TimeScaleHeader, type TimeScaleHeaderProps, type TimeScaleOptions, type TimeTick, TimeViewport, type TimeViewportHandle, type TimeViewportLayout, type TimeViewportProps, type TimeViewportState, type TimeZoom, Timeline, Toast, type ToastAction, type ToastApi, type ToastOptions, type ToastPosition, ToastProvider, type ToastVariant, Toggle, Tooltip, Tour, TransferList, TreeView, type Trend, type UseTextOverflowOptions, type UseTextOverflowResult, dateOfDay, dayOf, endDayOf, fitLabel, fitLabels, formatDateRange, preferenceActionKey, timeExtent, useAppShell, useContentWidth, useDestructiveAction, useFittedLabels, useFormContext, useGridKeyboard, usePagination, usePreferences, useSidebar, useTextMeasure, useTextOverflow, useTimeScale, useTimeViewport, useTimeViewportLayout, useToast, useToastOptional, useUnsavedChanges };