@nxgt/material 3.48.0 → 3.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +3 -3
  3. package/dist/{async-slice-DlvKCKAa.js → async-slice-3loEtzUY.js} +2 -2
  4. package/dist/{button-yaltbQmC.js → button-BRUaHD8z.js} +81 -112
  5. package/dist/charts.js +144 -144
  6. package/dist/{chip-BqWbbr1b.js → chip-DneTrtNj.js} +56 -56
  7. package/dist/{code-editor-C9qBNoYb.js → code-editor-R_nPN_-d.js} +308 -308
  8. package/dist/code-editor.js +47 -47
  9. package/dist/{code-language-items-DAHtfQ7W.js → code-language-items-BKEUhQlF.js} +2 -2
  10. package/dist/components/components.css +1 -0
  11. package/dist/components/ui/actions/action-card/action-card-indicator.css +48 -0
  12. package/dist/components/ui/actions/action-card/action-card-modes.css +4 -1
  13. package/dist/components/ui/actions/action-card/action-card-tile.css +141 -0
  14. package/dist/components/ui/actions/action-card/action-card.css +33 -3
  15. package/dist/{components-Ox6FHmpx.js → components-D6xFLcoE.js} +17646 -17567
  16. package/dist/components.js +26 -27
  17. package/dist/{dialog-CCCcnTIx.js → dialog-S7dLsYRZ.js} +16 -16
  18. package/dist/dnd.js +1 -1
  19. package/dist/{dropdown-menu-Df8785nt.js → dropdown-menu-XLlxfDgq.js} +271 -272
  20. package/dist/editor.js +1028 -1028
  21. package/dist/{empty-state-DcF4TBzi.js → empty-state-Dsf6R-Zo.js} +37 -37
  22. package/dist/{escape-owner-C4W_sOAU.js → escape-owner-B9eCwjLw.js} +1 -1
  23. package/dist/{field-blur-CJHzVSh9.js → field-blur-5uRDFHvB.js} +1 -1
  24. package/dist/{field-blur-context-Cft9s7Hg.js → field-blur-context-Cwt4TuBq.js} +1 -1
  25. package/dist/hooks.js +4 -4
  26. package/dist/{hover-card-C0fw2kLK.js → hover-card-PHUgRSjJ.js} +24 -24
  27. package/dist/{i18n-provider-C0fB0sEL.js → i18n-provider-DPM_ALQ4.js} +1 -1
  28. package/dist/i18n.js +5 -5
  29. package/dist/{icon-badge-aJ22mKGh.js → icon-badge-Dh6-FNOF.js} +3 -3
  30. package/dist/{icon-button-CN9r5TNE.js → icon-button-DSC2-IAG.js} +118 -86
  31. package/dist/lib/components/ui/actions/action-card/action-card-semantics.d.ts +25 -2
  32. package/dist/lib/components/ui/actions/action-card/action-card.d.ts +18 -2
  33. package/dist/lib/components/ui/actions/action-card/partials/action-card-icon.d.ts +6 -0
  34. package/dist/lib/components/ui/actions/action-card/partials/action-card-meta.d.ts +15 -0
  35. package/dist/lib/components/ui/actions/action-card/partials/action-card-status.d.ts +6 -0
  36. package/dist/lib/components/ui/actions/action-card/partials/action-card-text.d.ts +20 -0
  37. package/dist/lib/components/ui/actions/action-card/partials/action-card-title-button.d.ts +14 -0
  38. package/dist/lib/components/ui/actions/action-card/partials/action-card-trail.d.ts +6 -0
  39. package/dist/lib/components/ui/actions/action-card/use-action-card-names.d.ts +22 -0
  40. package/dist/lib/components/ui/actions/action-card/use-reveal.d.ts +23 -0
  41. package/dist/lib/components/ui/actions/button/button.variants.d.ts +1 -1
  42. package/dist/lib/components/ui/actions/icon-button/icon-button-busy.d.ts +22 -0
  43. package/dist/lib/components/ui/actions/icon-button/icon-button-shape.d.ts +2 -0
  44. package/dist/lib/components/ui/actions/icon-button/icon-button.d.ts +7 -0
  45. package/dist/lib/components/ui/actions/icon-button/icon-button.variants.d.ts +1 -1
  46. package/dist/lib/components/ui/collections/filter/bar/partials/filter-quick-toggle.d.ts +3 -2
  47. package/dist/lib/components/ui/collections/filter/sections/filter-sections-classes.d.ts +7 -1
  48. package/dist/lib/components/ui/collections/page-footer/page-footer.d.ts +6 -1
  49. package/dist/lib/components/ui/collections/row-menu/row-menu-trigger.d.ts +5 -2
  50. package/dist/lib/components/ui/collections/row-menu/row-menu.d.ts +1 -1
  51. package/dist/lib/components/ui/collections/server-table/index.d.ts +1 -1
  52. package/dist/lib/components/ui/collections/server-table/partials/server-table-empty-chips.d.ts +5 -3
  53. package/dist/lib/components/ui/collections/server-table/types-paging.d.ts +17 -0
  54. package/dist/lib/components/ui/collections/server-table/types.d.ts +3 -10
  55. package/dist/lib/components/ui/dates/duration-field/partials/use-duration-box.d.ts +1 -1
  56. package/dist/lib/components/ui/display/badge/badge.d.ts +1 -1
  57. package/dist/lib/components/ui/display/day-separator/day-separator.d.ts +1 -1
  58. package/dist/lib/components/ui/feedback/step-up-dialog/partials/step-up-body.d.ts +5 -3
  59. package/dist/lib/components/ui/feedback/step-up-dialog/partials/step-up-request-error.d.ts +15 -0
  60. package/dist/lib/components/ui/feedback/step-up-dialog/step-up-dialog.d.ts +6 -3
  61. package/dist/lib/components/ui/feedback/step-up-dialog/types.d.ts +12 -1
  62. package/dist/lib/components/ui/feedback/step-up-dialog/use-retry-focus.d.ts +27 -0
  63. package/dist/lib/components/ui/feedback/step-up-dialog/use-retry.d.ts +11 -0
  64. package/dist/lib/components/ui/fields/contacts/placeholders.d.ts +1 -1
  65. package/dist/lib/components/ui/fields/slider/split-slider-props.d.ts +20 -20
  66. package/dist/lib/components/ui/fields/slider/use-slider-control.d.ts +20 -20
  67. package/dist/lib/components/ui/fields/verification-code/use-settled-focus.d.ts +10 -0
  68. package/dist/lib/components/ui/layout/app-shell/route-transition.d.ts +1 -1
  69. package/dist/lib/components/ui/media/carousel/use-carousel-engine.d.ts +1 -1
  70. package/dist/lib/components/ui/media/media-player/engine/use-queue-actions.d.ts +1 -1
  71. package/dist/lib/components/ui/media/pdf-reader/pdf-reader.slice.d.ts +1 -1
  72. package/dist/lib/components/ui/selection/choice-group/use-choice-group-field.d.ts +34 -34
  73. package/dist/lib/components/ui/widgets/chat/chat-message.variants.d.ts +2 -2
  74. package/dist/lib/components/ui/widgets/event-calendar/use-event-calendar.d.ts +1 -1
  75. package/dist/lib/i18n/resources/en/en.d.ts +1 -0
  76. package/dist/lib/i18n/resources/en/material.json.d.ts +2 -1
  77. package/dist/lib/i18n/resources/fr/fr.d.ts +1 -0
  78. package/dist/lib/i18n/resources/fr/material.json.d.ts +2 -1
  79. package/dist/lib/i18n/resources/resources.d.ts +2 -0
  80. package/dist/lib/i18n/translator.d.ts +1 -1
  81. package/dist/lib.js +1 -1
  82. package/dist/main.js +43 -44
  83. package/dist/map.js +79 -79
  84. package/dist/material.css +1 -1
  85. package/dist/nxgt-theme-ivgNca3z.js +37 -0
  86. package/dist/pdf-reader.js +1 -1
  87. package/dist/print.js +2 -2
  88. package/dist/{public-zVb_Nq_D.js → public-vxiijIJF.js} +82 -82
  89. package/dist/{rich-code-block-DMWZZJma.js → rich-code-block-BwvCXPqq.js} +52 -52
  90. package/dist/{sortable-provider-DstbgMVf.js → sortable-provider-D2pAFWQB.js} +218 -218
  91. package/dist/{tooltip-CkttDIab.js → spinner-BpVwI1ps.js} +503 -278
  92. package/dist/{stored-language-IaL1Ftn_.js → stored-language-Beyj2ult.js} +4 -2
  93. package/dist/theme-picker.js +45 -45
  94. package/dist/{theme-store-CSl51uNH.js → theme-store-BdPp43cV.js} +13 -13
  95. package/dist/{theme-toggle-CGW2_K54.js → theme-toggle-BTYRPkP4.js} +16 -16
  96. package/dist/themes.js +17 -17
  97. package/dist/{toggle-group-BMJNcFAC.js → toggle-group-BkH23Jk4.js} +11 -11
  98. package/dist/{toolbar-items-CsLGJMEJ.js → toolbar-items-CIMo4F9q.js} +421 -421
  99. package/dist/{translate-material-v9u-e7Kd.js → translate-material-DEUlaL_1.js} +2 -2
  100. package/dist/{translator-Dk4_qE6U.js → translator-CBgIb3zP.js} +1 -1
  101. package/dist/{use-chat-composer-Brcb5f7r.js → use-chat-composer-D8UAsX0f.js} +6228 -5999
  102. package/dist/{button-tones-BwuVvAmd.js → use-click-lock-BZYtTmVt.js} +37 -7
  103. package/dist/{use-heading-spy-DjKixjLm.js → use-heading-spy-C5LXtA8Z.js} +1 -1
  104. package/dist/{use-material-translation-DOkTaWK_.js → use-material-translation-DWWeeg-B.js} +2 -2
  105. package/dist/{use-theme-DMcyJ52N.js → use-theme-BCLireTd.js} +1 -1
  106. package/docs/components/buttons-and-actions.md +64 -5
  107. package/docs/components/data-table-filter-and-lists.md +30 -10
  108. package/docs/components/feedback-and-status.md +22 -3
  109. package/docs/components/form-fields.md +7 -0
  110. package/docs/guides/cards-and-tiles.md +60 -0
  111. package/docs/guides/server-lists-url.md +3 -2
  112. package/docs/roadmap.md +11 -0
  113. package/lib/components/components.css +1 -0
  114. package/lib/components/ui/actions/action-card/action-card-indicator.css +48 -0
  115. package/lib/components/ui/actions/action-card/action-card-modes.css +4 -1
  116. package/lib/components/ui/actions/action-card/action-card-tile.css +141 -0
  117. package/lib/components/ui/actions/action-card/action-card.css +33 -3
  118. package/package.json +1 -1
  119. package/dist/nxgt-theme-ZS945iMP.js +0 -37
  120. package/dist/spinner-C4CgDEYm.js +0 -229
@@ -51,6 +51,13 @@ export type IconButtonProps = {
51
51
  * alert), `error` (a notification) or `neutral` (the page's text colour).
52
52
  */
53
53
  badgeTone?: 'primary' | 'error' | 'neutral';
54
+ /**
55
+ * Busy, as `Button`'s `loading`: `aria-busy` and `aria-disabled`, a
56
+ * spinner in place of the icon (the button keeps its size) and every
57
+ * click blocked. It stays focusable (no native `disabled`), so the
58
+ * focus is not lost while the work runs.
59
+ */
60
+ loading?: boolean;
54
61
  };
55
62
  export declare function IconButton({ tooltip, 'aria-label': ariaLabel, ...props }: IconButtonProps): import("react").JSX.Element;
56
63
  export { variants as iconButtonVariants };
@@ -22,7 +22,7 @@ declare const variantsByColor: (props?: ({
22
22
  look?: "btn" | "shaped" | null | undefined;
23
23
  size?: "lg" | "sm" | "default" | "xs" | "xl" | "legacy" | null | undefined;
24
24
  width?: "default" | "narrow" | "wide" | null | undefined;
25
- variant?: "tonal" | "filled" | "link" | "ghost" | "outlined" | null | undefined;
25
+ variant?: "link" | "tonal" | "filled" | "ghost" | "outlined" | null | undefined;
26
26
  color?: "primary" | "secondary" | "success" | "info" | "warning" | "error" | "default" | null | undefined;
27
27
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
28
28
  type Props = Parameters<typeof variantsByColor>[0];
@@ -1,8 +1,9 @@
1
1
  import { FilterModelField } from '@nxgt/material-core/filter';
2
2
  /**
3
3
  * A switch or checkbox as a quick filter: a toggle button (`aria-pressed`),
4
- * dashed while off, selected (the Chip's own check) once on ("Yes");
5
- * pressed again, its condition goes.
4
+ * the Chip's toggle look: its label alone while off (no plus, not dashed, so
5
+ * it never reads as the "+ Field" pill that opens an editor), selected with
6
+ * the Chip's own check mark once on ("Yes"); pressed again, its condition goes.
6
7
  * A "No" condition leaves it off, shown as a chip; pressing it then sets
7
8
  * "Yes". The focus stays on it.
8
9
  * A field on by default shows pressed with no condition, marked "Default"
@@ -18,7 +18,13 @@ export declare const FILTER_SHEET_COUNT_CLASS = "rounded-full bg-primary/10 px-1
18
18
  /** The sheet: its header (the title, then Close), the scrolling sections, the footer. */
19
19
  export declare const FILTER_SHEET_CLASS = "motion-reduce:transition-none";
20
20
  export declare const FILTER_SHEET_HEADER_CLASS = "flex-row items-center justify-between gap-2 border-b py-2 pr-2 text-left";
21
- export declare const FILTER_SHEET_CLOSE_CLASS = "static size-11";
21
+ /**
22
+ * In the header's flow, not at the corner. `relative`, never `static`: the
23
+ * button's invisible 44px hit area (`::after`, absolute) is placed against
24
+ * the nearest positioned ancestor, which for a static button is the whole
25
+ * sheet, so it covered the sections and swallowed a tap on their headers (#1733).
26
+ */
27
+ export declare const FILTER_SHEET_CLOSE_CLASS = "relative top-auto right-auto size-11";
22
28
  export declare const FILTER_SHEET_LOCKED_CLASS = "flex flex-wrap items-center gap-2 border-b px-4 py-3";
23
29
  /**
24
30
  * The sections, each a FacetGroup. Every row is a 44px target (WCAG 2.5.5):
@@ -27,6 +27,11 @@ export type PageFooterProps = {
27
27
  live?: boolean;
28
28
  /** Makes Previous and Next inert (a feed that is loading). */
29
29
  disabled?: boolean;
30
+ /** Renders nothing when there is a single page: no previous page and no
31
+ * next page. Default `false` (the footer shows its range, "1–5 of 5").
32
+ * The range is then not on screen: say the count elsewhere (a status
33
+ * line, a heading) or keep the footer. */
34
+ hideOnSinglePage?: boolean;
30
35
  /** Your router's link; it must forward `className` and `ref`. */
31
36
  linkComponent?: DataTableLinkComponent;
32
37
  } & Omit<ComponentProps<'div'>, 'children'>;
@@ -37,4 +42,4 @@ export type PageFooterProps = {
37
42
  * `ServerTable` draws. Renders nothing for an empty result. Without a
38
43
  * `totalCount` (a cursor feed with no total) it is the Previous / Next alone.
39
44
  */
40
- export declare function PageFooter({ pageInfo, totalCount, params, pageSize, count, pageHref, pagingNames, pageControls, live, disabled, linkComponent, className, ...props }: PageFooterProps): import("react").JSX.Element | null;
45
+ export declare function PageFooter({ pageInfo, totalCount, params, pageSize, count, pageHref, pagingNames, pageControls, live, disabled, hideOnSinglePage, linkComponent, className, ...props }: PageFooterProps): import("react").JSX.Element | null;
@@ -11,6 +11,9 @@ export type RowMenuTriggerProps = Omit<IconButtonProps, 'children' | 'tooltip' |
11
11
  * The "..." button of a row: a ghost `IconButton` with an ellipsis, named
12
12
  * after its row. It is 44px on a coarse pointer (and below `md`), 36px with a
13
13
  * fine pointer from `md` up. It forwards its props and its `ref`, so it works
14
- * as the child of a `DropdownMenuTrigger asChild`.
14
+ * as the child of a `DropdownMenuTrigger asChild`. `loading` (as `Button`'s)
15
+ * marks it busy while an action chosen from its menu runs: `aria-busy`, a
16
+ * spinner in place of the dots, the same size, the focus kept, and the menu
17
+ * does not reopen until it is over.
15
18
  */
16
- export declare function RowMenuTrigger({ label, className, 'aria-label': ariaLabel, ...props }: RowMenuTriggerProps): import("react").JSX.Element;
19
+ export declare function RowMenuTrigger({ label, loading, onPointerDown, onKeyDown, className, 'aria-label': ariaLabel, ...props }: RowMenuTriggerProps): import("react").JSX.Element;
@@ -33,7 +33,7 @@ export type RowMenuProps = {
33
33
  };
34
34
  /**
35
35
  * A row's actions menu: `RowMenuTrigger` and a `DropdownMenu` aligned to the
36
- * end of it. Its items are 44px high on a coarse pointer, and the destructive
36
+ * end of it. Every item of its menu, `children` too, is 44px high on a coarse pointer, and the destructive
37
37
  * ones come last, after a separator. Focus returns to the trigger when the
38
38
  * menu closes, and when a dialog opened from an item closes.
39
39
  */
@@ -1,3 +1,3 @@
1
- export { defineFilterModel, type FilterCodecOptions, type FilterCondition, type FilterLockedCondition, type FilterModel, type FilterQuery, parseFilterQuery, serializeFilterQuery, } from '@nxgt/material-core/filter';
1
+ export { defineFilterModel, effectiveConditions, type FilterCodecOptions, type FilterCondition, type FilterFieldError, type FilterFieldErrors, type FilterLockedCondition, type FilterModel, type FilterQuery, type FilterSplitErrors, parseFilterQuery, serializeFilterQuery, splitFilterErrors, } from '@nxgt/material-core/filter';
2
2
  export { type CursorConnection, createSorting, FIRST_PAGE, firstPage, isFiltered, isNewQuery, nextPage, type PageCursor, type PagingNames, pagingNames, paramsFromQuery, previousPage, queryFromParams, queryKey, type RouterQuery, readCursor, type ServerPagination, type ServerPaginationOptions, type SortingOptions, serverPagination, type TableFilterBinding, type TableFilterOptions, type TableSort, type TableSorting, tableFilters, withoutFilters, } from '@nxgt/material-core/table-url';
3
3
  export * from './server-table.js';
@@ -1,8 +1,10 @@
1
1
  /**
2
2
  * "Nothing matches": the user's filters that narrow the list, as chips
3
3
  * removed by their ✕ (a kept field, a widening switch such as "Show archived" or a scope such as the period, is not
4
- * one, a locked condition stays in the band), then "Clear all" while two
5
- * or a search remain. A removal focuses the next chip, then "Clear all",
4
+ * one, a locked condition stays in the band), then "Clear all" (worded by
5
+ * `empty.clear`) whenever a chip or a search remains. A removal focuses the next chip, then "Clear all",
6
6
  * then the search (the core's `focusAfterRemove`, from `empty`).
7
7
  */
8
- export declare function ServerTableEmptyChips(): import("react").JSX.Element | null;
8
+ export declare function ServerTableEmptyChips({ clear }: {
9
+ clear?: string;
10
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,17 @@
1
+ import { PagingNames } from '@nxgt/material-core/table-url';
2
+ /** The footer and paging props of `ServerTable`, apart from the page's data. */
3
+ export type ServerTablePagingProps = {
4
+ /** How the footer's Previous and Next are drawn: `'labelled'` (default) or
5
+ * `'icon'`, icon-only buttons with a tooltip and a name that says the page
6
+ * ("Previous page"); a page given as an href stays a link. */
7
+ pageControls?: 'labelled' | 'icon';
8
+ /** Hides the footer's range and Previous / Next when the result is a single
9
+ * page (no previous page, no next page). Default `false`. The count is
10
+ * still announced by the live region, but no longer shown: show it in the
11
+ * `description` or keep the footer. A selection's "N rows selected" stays. */
12
+ hideOnSinglePage?: boolean;
13
+ /** A page's href. Default ``(params) => `?${params}` ``. */
14
+ pageHref?: (params: URLSearchParams) => string;
15
+ /** The cursor's search param names. Default `after` and `trail`. */
16
+ pagingNames?: Partial<PagingNames>;
17
+ };
@@ -1,7 +1,7 @@
1
1
  import { FilterDefaults, FilterFieldErrors, FilterLockedCondition, FilterModel } from '@nxgt/material-core/filter';
2
2
  import { IconStyleInput } from '@nxgt/material-core/icons';
3
3
  import { ErrorStateKind } from '@nxgt/material-core/states';
4
- import { PagingNames, TableFilterBinding, TableSorting } from '@nxgt/material-core/table-url';
4
+ import { TableFilterBinding, TableSorting } from '@nxgt/material-core/table-url';
5
5
  import { RowData } from '@tanstack/react-table';
6
6
  import { ReactNode, Ref } from 'react';
7
7
  import { StateHeadingLevel } from '../../feedback/state-frame/state-frame.js';
@@ -9,6 +9,7 @@ import { DataTableProps } from '../data-table/types.js';
9
9
  import { FilterBarFieldProps, FilterQueryProps } from '../filter/internal.js';
10
10
  import { ListEmptyContent } from '../list-empty/list-empty.js';
11
11
  import { ServerTableBulkAction } from './bulk-action.js';
12
+ import { ServerTablePagingProps } from './types-paging.js';
12
13
  /** What a bulk action can do to the selection once it acted. */
13
14
  export type ServerTableSelection = {
14
15
  /** Empties the selection; the table takes the focus the toolbar had. */
@@ -123,7 +124,7 @@ export type ServerTableFilterHandle = {
123
124
  };
124
125
  /** The `DataTable` props `ServerTable` passes through as they are. */
125
126
  export type PassedThrough<T extends RowData> = Pick<DataTableProps<T>, 'columns' | 'maxHeight' | 'scrollLabel' | 'showViewOptions' | 'renderExpandedRow' | 'options' | 'loading' | 'loadingRows' | 'getRowHref' | 'onRowClick' | 'linkComponent' | 'density' | 'layout' | 'cardDensity' | 'renderCard' | 'renderTile' | 'enableRowSelection' | 'rowSelectionDisabledReason'>;
126
- export type ServerTableProps<T extends RowData> = PassedThrough<T> & {
127
+ export type ServerTableProps<T extends RowData> = PassedThrough<T> & ServerTablePagingProps & {
127
128
  /** The URL's search params, as the router reads them. */
128
129
  params: URLSearchParams;
129
130
  /** The router's setter, called with new search params: React Router's
@@ -172,10 +173,6 @@ export type ServerTableProps<T extends RowData> = PassedThrough<T> & {
172
173
  * half the room above and under it (a list under a sticky app bar). The
173
174
  * controls keep their size (the Filter's `density` is theirs). */
174
175
  bandDensity?: 'comfortable' | 'compact';
175
- /** How the footer's Previous and Next are drawn: `'labelled'` (default) or
176
- * `'icon'`, icon-only buttons with a tooltip and a name that says the page
177
- * ("Previous page"); a page given as an href stays a link. */
178
- pageControls?: 'labelled' | 'icon';
179
176
  /** With `filter`: a handle to focus the Filter's first control, for the
180
177
  * app to move the focus there (after its own action). */
181
178
  filterRef?: Ref<ServerTableFilterHandle>;
@@ -191,10 +188,6 @@ export type ServerTableProps<T extends RowData> = PassedThrough<T> & {
191
188
  * across pages, and a new query empties the selection. Which rows can be
192
189
  * is `enableRowSelection`; why one cannot, `rowSelectionDisabledReason`. */
193
190
  bulkActions?: ((ids: string[], selection: ServerTableSelection) => ReactNode) | readonly ServerTableBulkAction<T>[];
194
- /** A page's href. Default ``(params) => `?${params}` ``. */
195
- pageHref?: (params: URLSearchParams) => string;
196
- /** The cursor's search param names. Default `after` and `trail`. */
197
- pagingNames?: Partial<PagingNames>;
198
191
  /** Without `filter`: what the live region says once a new query is
199
192
  * answered. Default "N results" (`material.server-table.results`). */
200
193
  resultsLabel?: (count: number) => string;
@@ -18,10 +18,10 @@ export declare function useDurationBox({ disabled, ...values }: Model): {
18
18
  labels: {
19
19
  hour: string;
20
20
  minute: string;
21
+ period: string;
21
22
  day: string;
22
23
  month: string;
23
24
  year: string;
24
- period: string;
25
25
  };
26
26
  placeholders: Record<import('../../../primitives/segmented-input/segment-defs.js').SegmentKey, string>;
27
27
  periodNames: [string, string];
@@ -3,7 +3,7 @@ import { ComponentProps, ReactNode } from 'react';
3
3
  import { IconName } from '../../primitives/icon/icon.js';
4
4
  import { Tone } from '../../tones.js';
5
5
  declare const badgeVariants: (props?: ({
6
- variant?: "secondary" | "success" | "info" | "warning" | "error" | "default" | "outlined" | "soft" | null | undefined;
6
+ variant?: "secondary" | "success" | "info" | "warning" | "error" | "default" | "soft" | "outlined" | null | undefined;
7
7
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
8
8
  /** The tone of a `soft` or `outlined` badge: a named tone or one the app declared in `AppTones`. */
9
9
  export type BadgeTone = Tone;
@@ -2,7 +2,7 @@ import { VariantProps } from 'class-variance-authority';
2
2
  import { ComponentProps, ReactNode } from 'react';
3
3
  import { DayInput } from './day-label.js';
4
4
  declare const daySeparatorVariants: (props?: ({
5
- variant?: "pill" | "line" | null | undefined;
5
+ variant?: "line" | "pill" | null | undefined;
6
6
  sticky?: boolean | null | undefined;
7
7
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
8
8
  export type DaySeparatorProps = Omit<ComponentProps<'div'>, 'children'> & VariantProps<typeof daySeparatorVariants> & {
@@ -1,15 +1,17 @@
1
- import { ReactNode } from 'react';
1
+ import { ComponentProps, ReactNode } from 'react';
2
2
  import { StepUpDialogProps } from '../types.js';
3
- type Props = Pick<StepUpDialogProps, 'via' | 'requestError' | 'confirming' | 'attemptsLeft' | 'locked' | 'error' | 'retryAfter' | 'pending' | 'onSubmit' | 'onResend' | 'resent' | 'length' | 'allowRecovery' | 'icons'> & {
3
+ import { StepUpRequestError } from './step-up-request-error.js';
4
+ type Props = Pick<StepUpDialogProps, 'via' | 'requestError' | 'confirming' | 'attemptsLeft' | 'locked' | 'error' | 'retryAfter' | 'pending' | 'onSubmit' | 'onResend' | 'resent' | 'length' | 'allowRecovery' | 'autoFocus' | 'icons'> & {
4
5
  formId: string;
5
6
  labels: NonNullable<StepUpDialogProps['labels']>;
6
7
  /** What is said instead of the field (requesting, confirming). */
7
8
  statusText: ReactNode;
9
+ retry: Omit<ComponentProps<typeof StepUpRequestError>, 'requestError'>;
8
10
  };
9
11
  /**
10
12
  * What sits between the title and the footer: the code form, or, when it is
11
13
  * not there (a code still being requested, a request that failed, an
12
14
  * accepted code), the status line or the alert that replaces it.
13
15
  */
14
- export declare function StepUpBody({ via, requestError, confirming, formId, labels, statusText, icons, ...code }: Props): import("react").JSX.Element;
16
+ export declare function StepUpBody({ via, requestError, confirming, formId, labels, statusText, icons, retry, ...code }: Props): import("react").JSX.Element;
15
17
  export {};
@@ -0,0 +1,15 @@
1
+ import { FocusEvent, ReactNode, RefObject } from 'react';
2
+ type Props = {
3
+ requestError: ReactNode;
4
+ /** The "Retry" button is drawn only with a handler. */
5
+ onRetry?: () => void;
6
+ retryLabel: string;
7
+ retrying: boolean;
8
+ /** Retries that finished: a new key tells the live region again, even for the same text. */
9
+ settled: number;
10
+ retryRef: RefObject<HTMLButtonElement | null>;
11
+ onRetryBlur: (event: FocusEvent) => void;
12
+ };
13
+ /** The alert that replaces the field when the code could not be requested, with "Retry" when the host offers it. */
14
+ export declare function StepUpRequestError({ requestError, onRetry, retryLabel, retrying, settled, retryRef, onRetryBlur, }: Props): import("react").JSX.Element;
15
+ export {};
@@ -7,10 +7,13 @@ import { StepUpDialogProps } from './types.js';
7
7
  * `error`, `pending`, `resent`, `onSubmit`, `onResend`), which the app
8
8
  * wires to its own model.
9
9
  *
10
- * The title takes the focus on open and whenever the field goes (a code
10
+ * The title takes the focus on open (unless `autoFocus` sends it to the
11
+ * field) and whenever the field goes (a code
11
12
  * being requested, a code accepted); the field takes it after a refusal; on
12
13
  * close it goes back to what opened the dialog. Escape, a click outside and
13
14
  * Cancel call `onCancel`, except while `confirming`. A locked code leaves
14
- * Cancel usable.
15
+ * Cancel usable. A failed code request (`requestError`) offers "Retry" when
16
+ * `onRetry` is set: the focus stays on it while it runs and goes to the
17
+ * field once the request succeeds.
15
18
  */
16
- export declare function StepUpDialog({ open, onCancel, cancelVariant, via, destination, requestError, confirming, confirmedLabel, title, description, labels: labelOverrides, icons, ...code }: StepUpDialogProps): import("react").JSX.Element;
19
+ export declare function StepUpDialog({ open, onCancel, cancelVariant, via, destination, requestError, onRetry, confirming, confirmedLabel, title, description, labels: labelOverrides, icons, ...code }: StepUpDialogProps): import("react").JSX.Element;
@@ -19,8 +19,10 @@ export type StepUpDialogLabels = {
19
19
  cancel: string;
20
20
  /** Said once the code was accepted and the host finishes its action. */
21
21
  confirmed: string;
22
+ /** The "Retry" button of a failed code request (see `onRetry`). */
23
+ retry: string;
22
24
  };
23
- export type StepUpDialogProps = Pick<VerificationCodeProps, 'attemptsLeft' | 'locked' | 'error' | 'retryAfter' | 'pending' | 'onSubmit' | 'onResend' | 'resent' | 'length' | 'allowRecovery'> & {
25
+ export type StepUpDialogProps = Pick<VerificationCodeProps, 'attemptsLeft' | 'locked' | 'error' | 'retryAfter' | 'pending' | 'onSubmit' | 'onResend' | 'resent' | 'length' | 'allowRecovery' | 'autoFocus'> & {
24
26
  open: boolean;
25
27
  /**
26
28
  * Escape, a click outside and Cancel call it, except while `confirming`.
@@ -38,6 +40,15 @@ export type StepUpDialogProps = Pick<VerificationCodeProps, 'attemptsLeft' | 'lo
38
40
  destination?: ReactNode;
39
41
  /** The request for a code failed; shown as an alert in place of the field. */
40
42
  requestError?: ReactNode;
43
+ /**
44
+ * Draws a "Retry" button in the `requestError` alert. Pressing it calls
45
+ * this; while the returned promise is pending the button is busy and keeps
46
+ * the focus. Answer by clearing `requestError` and setting `via` (the code
47
+ * field takes the focus) or by setting a new `requestError` (the focus
48
+ * stays on "Retry" and the new text is announced). Left out, the alert
49
+ * has no button.
50
+ */
51
+ onRetry?: () => unknown;
41
52
  /**
42
53
  * The code was accepted and the host re-runs its action: the field goes,
43
54
  * a status line shows `labels.confirmed` and Cancel is disabled until the
@@ -0,0 +1,27 @@
1
+ import { RefObject } from 'react';
2
+ type Input = {
3
+ open: boolean;
4
+ fieldShown: boolean;
5
+ requestError: unknown;
6
+ confirming: boolean;
7
+ formId: string;
8
+ titleRef: RefObject<HTMLElement | null>;
9
+ };
10
+ /**
11
+ * Where the focus goes around a "Retry": it stays on the button while the
12
+ * retry runs and when the request fails again (the button may be taken away
13
+ * and put back by the host meanwhile, the title holding the focus in the
14
+ * gap), and goes to the code field once the request succeeds. Only after a
15
+ * press of "Retry", and only while the focus is still free (the page, the
16
+ * dialog itself, the title or the button): a focus the user moved elsewhere is left alone.
17
+ */
18
+ export declare function useRetryFocus({ open, fieldShown, requestError, confirming, formId, titleRef, }: Input): {
19
+ retryRef: RefObject<HTMLButtonElement | null>;
20
+ /** On "Retry": the focus it holds is followed from here on. */
21
+ arm: () => void;
22
+ /** On the button's blur: a focus that went to another control is not ours any more. */
23
+ release: (event: {
24
+ relatedTarget: EventTarget | null;
25
+ }) => void;
26
+ };
27
+ export {};
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The retry of a failed code request: `run` calls the host's `onRetry` and
3
+ * stays `retrying` until what it returned settles (a thrown or rejected
4
+ * retry is the host's to show as a new `requestError`). `settled` counts the
5
+ * retries that finished, so the alert is told again, even for the same text.
6
+ */
7
+ export declare function useRetry(onRetry: (() => unknown) | undefined): {
8
+ retrying: boolean;
9
+ settled: number;
10
+ run: () => Promise<void>;
11
+ };