@nxgt/material 2.16.0 → 2.18.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/CHANGELOG.md +96 -0
- package/README.md +9 -4
- package/dist/{_Uint8Array-CjLUgWgf.js → _Uint8Array-C7apDrb7.js} +1 -1
- package/dist/{_overRest-HfSwfmH1.js → _overRest-CCAbV-eT.js} +1 -1
- package/dist/async-slice-Cuekts5f.js +459 -0
- package/dist/{blockDiagram-BEXU5L5S-DSNWJcbS.js → blockDiagram-BEXU5L5S-B63zbmDg.js} +2 -2
- package/dist/{chunk-3FUC2YCW-CcZvlyvW.js → chunk-3FUC2YCW-CE9T5wr6.js} +2 -2
- package/dist/{chunk-7M6MHVWA-21OdxoBq.js → chunk-7M6MHVWA-BjaezAbj.js} +1 -1
- package/dist/{chunk-GNY47TPC-BZdgq2LF.js → chunk-GNY47TPC-DjnciAsL.js} +4 -4
- package/dist/{chunk-NETBCI7D-CAgvlb0w.js → chunk-NETBCI7D-CxQxB74H.js} +1 -1
- package/dist/{chunk-Z7XXMR3K-BSXPgLtN.js → chunk-Z7XXMR3K-BBrCUBwp.js} +1 -1
- package/dist/{classDiagram-v2-NBCMYWYE-D_BHO1iT.js → classDiagram-v2-NBCMYWYE-FeyVcYCs.js} +2 -2
- package/dist/components/components.css +1 -0
- package/dist/components/print-only.css +44 -0
- package/dist/{components-Bkdm6jn6.js → components-CsPEBzNF.js} +59383 -58881
- package/dist/components.js +6 -6
- package/dist/{dagre-6A5THRUB-CsnftAPx.js → dagre-6A5THRUB-BjO_Ytfq.js} +64 -64
- package/dist/{diagram-22UHCM2B-D0yPa8vo.js → diagram-22UHCM2B-BBKawlhX.js} +2 -2
- package/dist/{diagram-3UASUU5V-f8LIX2sj.js → diagram-3UASUU5V-CKj_37_k.js} +1 -1
- package/dist/dnd.js +1 -1
- package/dist/{elk-276RUBZZ-DI8bDQAL.js → elk-276RUBZZ-DmkPwZLS.js} +3 -3
- package/dist/{erDiagram-OPXOYQCR-BGHFtxmB.js → erDiagram-OPXOYQCR-Dja943M3.js} +2 -2
- package/dist/{field-blur-C-5K6U1F.js → field-blur-DNHXOY0J.js} +3 -3
- package/dist/{flowDiagram-KWPJA3E3-CnFLTW-3.js → flowDiagram-KWPJA3E3-jmbjSQZS.js} +3 -3
- package/dist/{ganttDiagram-FUAMR5RP-B5uyVKE4.js → ganttDiagram-FUAMR5RP-BONNpqJt.js} +1 -1
- package/dist/{graphlib-BqO9Go2u.js → graphlib-DxjKaXeR.js} +42 -42
- package/dist/hooks.js +38 -26
- package/dist/{i18n-provider-C3SlA4J0.js → i18n-provider-Dv9ZSmgO.js} +1 -1
- package/dist/i18n.js +6 -6
- package/dist/{isArrayLikeObject-83P1fvEs.js → isArrayLikeObject-H8k6W51O.js} +3 -3
- package/dist/{isEmpty-C2z3Hypl.js → isEmpty-B0Bavg-e.js} +9 -9
- package/dist/{journeyDiagram-ZHPQQLJL-CKtbGcVT.js → journeyDiagram-ZHPQQLJL-C_omtnEz.js} +1 -1
- package/dist/lib/components/ui/actions/copy-button/use-copy-status.d.ts +13 -0
- package/dist/lib/components/ui/display/enrolment-secret/enrolment-secret.d.ts +30 -0
- package/dist/lib/components/ui/display/enrolment-secret/index.d.ts +2 -0
- package/dist/lib/components/ui/display/enrolment-secret/use-enrolment-secret-labels.d.ts +11 -0
- package/dist/lib/components/ui/display/index.d.ts +2 -0
- package/dist/lib/components/ui/display/recovery-codes/index.d.ts +4 -0
- package/dist/lib/components/ui/display/recovery-codes/partials/recovery-codes-actions.d.ts +14 -0
- package/dist/lib/components/ui/display/recovery-codes/partials/recovery-codes-confirm.d.ts +13 -0
- package/dist/lib/components/ui/display/recovery-codes/partials/recovery-codes-list.d.ts +5 -0
- package/dist/lib/components/ui/display/recovery-codes/recovery-codes.d.ts +8 -0
- package/dist/lib/components/ui/display/recovery-codes/types.d.ts +64 -0
- package/dist/lib/components/ui/display/recovery-codes/use-recovery-codes-labels.d.ts +7 -0
- package/dist/lib/components/ui/fields/form-section/form-section-classes.d.ts +30 -0
- package/dist/lib/components/ui/fields/form-section/form-section.d.ts +25 -0
- package/dist/lib/components/ui/fields/form-section/index.d.ts +1 -0
- package/dist/lib/components/ui/fields/index.d.ts +1 -0
- package/dist/lib/components/ui/forms/index.d.ts +1 -0
- package/dist/lib/components/ui/forms/use-code-resolver.d.ts +42 -0
- package/dist/lib/components/ui/layout/auth-card/auth-card-notice.d.ts +18 -0
- package/dist/lib/components/ui/layout/auth-card/auth-card.d.ts +35 -0
- package/dist/lib/components/ui/layout/auth-card/index.d.ts +1 -0
- package/dist/lib/components/ui/layout/index.d.ts +1 -0
- package/dist/lib/components/ui/selection/autocomplete/types.d.ts +9 -1
- package/dist/lib/components/ui/selection/autocomplete/use-autocomplete-status.d.ts +2 -2
- package/dist/lib/components/ui/selection/autocomplete/use-autocomplete.d.ts +2 -2
- package/dist/lib/hooks/index.d.ts +2 -0
- package/dist/lib/hooks/use-focus-on-mount.d.ts +24 -0
- package/dist/lib/hooks/use-submit-once.d.ts +32 -0
- package/dist/lib/i18n/resources/en/en.d.ts +21 -0
- package/dist/lib/i18n/resources/en/material.json.d.ts +21 -0
- package/dist/lib/i18n/resources/fr/fr.d.ts +21 -0
- package/dist/lib/i18n/resources/fr/material.json.d.ts +21 -0
- package/dist/lib/i18n/resources/resources.d.ts +42 -0
- package/dist/lib/i18n/translator.d.ts +1 -1
- package/dist/lib/lib/index.d.ts +1 -0
- package/dist/lib.js +58 -102
- package/dist/main.js +16 -16
- package/dist/map.js +22 -22
- package/dist/material.css +1 -1
- package/dist/{merge-CZIEHTTe.js → merge-Js8537dg.js} +4 -4
- package/dist/{mermaid.core-Cp75fWA9.js → mermaid.core-9dpDfc6Y.js} +21 -21
- package/dist/{mindmap-definition-NLK3R4M7-CFYIlEfW.js → mindmap-definition-NLK3R4M7-CjYayluH.js} +2 -2
- package/dist/{pieDiagram-5QR66LMP-CjvtBYDr.js → pieDiagram-5QR66LMP-BfFcf84S.js} +1 -1
- package/dist/print.js +2 -2
- package/dist/{quadrantDiagram-O4NWA36T-DPj8ndqA.js → quadrantDiagram-O4NWA36T-DdvYjvR0.js} +1 -1
- package/dist/{requirementDiagram-PLB6GJNP-DjVFwRJg.js → requirementDiagram-PLB6GJNP-CGG6Y3SN.js} +2 -2
- package/dist/{sankeyDiagram-IPEJSGJF-63wsgHUY.js → sankeyDiagram-IPEJSGJF-DJufZkAf.js} +1 -1
- package/dist/{sortable-provider-Chbn1x1i.js → sortable-provider-CUT5Wfdl.js} +1 -1
- package/dist/{stateDiagram-v2-GCMORJYK-DNc8m371.js → stateDiagram-v2-GCMORJYK-vRvpKK9I.js} +2 -2
- package/dist/{stored-language-DPqzxRmf.js → stored-language-BKoohv2_.js} +42 -0
- package/dist/{swimlanes-2SLR337P-B7_gOJxx.js → swimlanes-2SLR337P-Czy9f6gp.js} +3 -3
- package/dist/{swimlanesDiagram-TC7HE7FX-tqlBrGuu.js → swimlanesDiagram-TC7HE7FX-C6RYBQ-A.js} +3 -3
- package/dist/{timeline-definition-EJHVYXUP-DIA9CBZK.js → timeline-definition-EJHVYXUP-CS9RiAiW.js} +1 -1
- package/dist/{translate-material-CqB-j9WD.js → translate-material-CCJg3yfc.js} +2 -2
- package/dist/{translator-DTl9h__E.js → translator-DEde7BKz.js} +1 -1
- package/dist/{use-heading-spy-C1KA3PrF.js → use-heading-spy-XkSExwoT.js} +67 -59
- package/dist/{use-material-translation-DMa4Xrnd.js → use-material-translation-Cndoq_iK.js} +2 -2
- package/dist/{usecaseDiagram-POWQR4AR-FMjCkoxs.js → usecaseDiagram-POWQR4AR-CW-8YHgN.js} +2 -2
- package/dist/{xychartDiagram-PMCCYNJV-B76HOkCh.js → xychartDiagram-PMCCYNJV-G4PopeeF.js} +1 -1
- package/docs/components/README.md +3 -3
- package/docs/components/data-display.md +101 -0
- package/docs/components/feedback-and-status.md +2 -0
- package/docs/components/form-fields.md +78 -0
- package/docs/components/navigation-and-layout.md +51 -0
- package/docs/components/overlays-and-menus.md +18 -0
- package/docs/components/selection-and-choice.md +11 -3
- package/docs/guides/forms.md +111 -0
- package/docs/guides/helpers.md +81 -0
- package/docs/guides/i18n.md +17 -0
- package/docs/guides/printing.md +27 -0
- package/docs/previews/data-display-enrolmentsecret.webp +0 -0
- package/docs/previews/data-display-recoverycodes.webp +0 -0
- package/docs/previews/form-fields-formsection.webp +0 -0
- package/docs/previews/navigation-layout-authcard.webp +0 -0
- package/docs/roadmap.md +15 -0
- package/docs/troubleshooting.md +141 -0
- package/lib/components/components.css +1 -0
- package/lib/components/print-only.css +44 -0
- package/package.json +2 -2
- package/dist/async-slice-CsE3hkCD.js +0 -411
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** The heading elements a FormSection's title can render as. */
|
|
2
|
+
export type FormSectionTitleElement = 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
3
|
+
/**
|
|
4
|
+
* The section: a whole row of the form's grid (`.form-grid-layout`
|
|
5
|
+
* `[data-slot="form-fields"]`), and a container of its own, so its fields
|
|
6
|
+
* take columns by the section's width, inside a form or standalone.
|
|
7
|
+
*/
|
|
8
|
+
export declare const formSectionRootClass = "@container col-span-full flex w-full min-w-0 flex-col gap-2";
|
|
9
|
+
/**
|
|
10
|
+
* The rule between two sections: a top border on a section that follows
|
|
11
|
+
* another one, never on the first.
|
|
12
|
+
*/
|
|
13
|
+
export declare const formSectionSeparatedClass = "[[data-slot=form-section]+&]:mt-2 [[data-slot=form-section]+&]:border-t [[data-slot=form-section]+&]:pt-4";
|
|
14
|
+
/** The title and the actions, which wrap under the title on a phone. */
|
|
15
|
+
export declare const formSectionHeaderClass = "flex min-w-0 flex-wrap items-center justify-between gap-2";
|
|
16
|
+
/**
|
|
17
|
+
* Set apart from the fields' labels, which read as titles: small, semibold,
|
|
18
|
+
* uppercase and muted. `text-muted-foreground` reads 4.5:1 on the form's
|
|
19
|
+
* background in both themes.
|
|
20
|
+
*/
|
|
21
|
+
export declare const formSectionTitleClass = "min-w-0 break-words font-semibold text-muted-foreground text-sm uppercase tracking-wide";
|
|
22
|
+
export declare const formSectionActionsClass = "flex flex-wrap items-center gap-2";
|
|
23
|
+
export declare const formSectionDescriptionClass = "break-words text-muted-foreground text-sm";
|
|
24
|
+
/**
|
|
25
|
+
* The fields: one column on a phone, then the form grid's own columns. The
|
|
26
|
+
* form grid's wide-field rules (a switch, a textarea, chips, files, rich
|
|
27
|
+
* text on a row of their own) are descendant selectors under
|
|
28
|
+
* `[data-slot="form-fields"]`, so they still reach the fields in here.
|
|
29
|
+
*/
|
|
30
|
+
export declare const formSectionFieldsClass = "grid min-w-0 grid-cols-1 place-items-start gap-2 @2xl:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { FormSectionTitleElement } from './form-section-classes';
|
|
3
|
+
export type { FormSectionTitleElement } from './form-section-classes';
|
|
4
|
+
export type FormSectionProps = Omit<ComponentProps<'div'>, 'title'> & {
|
|
5
|
+
/** The section's heading. */
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* The heading element; `'h2'` by default (a section under the page's
|
|
9
|
+
* `h1`). Pass `'h3'` when the form already sits under an `h2`.
|
|
10
|
+
*/
|
|
11
|
+
titleAs?: FormSectionTitleElement;
|
|
12
|
+
/** A line under the title, tied to the group with `aria-describedby`. */
|
|
13
|
+
description?: ReactNode;
|
|
14
|
+
/** Controls beside the title (e.g. "Add"), wrapping under it on a phone. */
|
|
15
|
+
actions?: ReactNode;
|
|
16
|
+
/** A rule above the section when it follows another FormSection. Default `true`. */
|
|
17
|
+
separated?: boolean;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* A titled section of a form: a heading, an optional description and
|
|
21
|
+
* actions, then its fields. Inside `.form-grid-layout`'s
|
|
22
|
+
* `[data-slot="form-fields"]` it takes a whole row and lays its fields out
|
|
23
|
+
* in the form's columns; one column on a phone.
|
|
24
|
+
*/
|
|
25
|
+
export declare function FormSection({ title, titleAs: Title, description, actions, separated, className, children, ...props }: FormSectionProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './form-section';
|
|
@@ -5,6 +5,7 @@ export * from './country-field';
|
|
|
5
5
|
export * from './currency-field';
|
|
6
6
|
export * from './email-field';
|
|
7
7
|
export * from './field';
|
|
8
|
+
export * from './form-section';
|
|
8
9
|
export * from './inline-edit';
|
|
9
10
|
export * from './input-group-field';
|
|
10
11
|
export * from './number-field';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { CodeIssue } from '@nxgt/material-core/code-errors';
|
|
2
|
+
import { FieldValues, Resolver } from 'react-hook-form';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { Language, Translate } from '../../../i18n/types';
|
|
5
|
+
export { type CodeErrorMap, type CodeIssue, createCodeErrorMap, defaultCodeOf, isEmptyRequired, } from '@nxgt/material-core/code-errors';
|
|
6
|
+
export type CodeResolverOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* The app's translator, `createTranslator(mergeResources(resources,
|
|
9
|
+
* appResources))`: it words the codes (`translate(code, params,
|
|
10
|
+
* language)`; a key it returns verbatim has no words) and is handed to
|
|
11
|
+
* `zodLocaleError`, so the app's `material.zod.*` overrides apply. Without
|
|
12
|
+
* it, every issue is worded by the package's own zod messages. Pass a
|
|
13
|
+
* stable function (module scope): a new one re-creates the resolver.
|
|
14
|
+
*/
|
|
15
|
+
translate?: Translate<any>;
|
|
16
|
+
/**
|
|
17
|
+
* Which code an issue carries. Defaults to `defaultCodeOf`: a custom
|
|
18
|
+
* issue's `params.code`. Pass a stable function.
|
|
19
|
+
*/
|
|
20
|
+
codeOf?: (issue: CodeIssue) => string | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* The language to word the errors in. Defaults to `I18nProvider`'s, else
|
|
23
|
+
* what `zodLocaleError` reads by default (the stored language).
|
|
24
|
+
*/
|
|
25
|
+
language?: Language;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* A react-hook-form resolver for a zod 4 `schema` whose errors are worded in
|
|
29
|
+
* the page's language: a refinement carrying a code in `params.code`
|
|
30
|
+
* (`.refine(isFree, { params: { code: 'errors.taken' } })`) reads as the
|
|
31
|
+
* app's words for that code, and every other issue as the package's zod
|
|
32
|
+
* messages (`zodLocaleError`) — zod's own are English only. One resolver
|
|
33
|
+
* per schema and language, not one per render: switching the language
|
|
34
|
+
* re-words the errors on the next validation.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* const resolver = useCodeResolver(schema, { translate });
|
|
39
|
+
* const form = useForm({ resolver, defaultValues });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function useCodeResolver<Input extends FieldValues, Output>(schema: z.ZodType<Output, Input>, { translate, codeOf, language: languageOption }?: CodeResolverOptions): Resolver<Input, unknown, Output>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AuthCardNoticeTone } from './auth-card';
|
|
3
|
+
type AuthCardNoticeProps = {
|
|
4
|
+
notice: ReactNode;
|
|
5
|
+
tone: AuthCardNoticeTone;
|
|
6
|
+
/** Whether there is a notice to show. */
|
|
7
|
+
shown: boolean;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* The notice above the form. A polite status is announced when its text
|
|
11
|
+
* changes inside a live region that was already in the page, so that region
|
|
12
|
+
* is always rendered and a non-error notice goes into it. It takes no room
|
|
13
|
+
* while empty (`empty:-mb-4` cancels the card's gap; `display: none` would
|
|
14
|
+
* take it out of the accessibility tree). An error is an `alert`, inserted on
|
|
15
|
+
* demand: that is announced reliably.
|
|
16
|
+
*/
|
|
17
|
+
export declare function AuthCardNotice({ notice, tone, shown }: AuthCardNoticeProps): import("react").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
/** The notice's colour, and its role: `error` is an alert, the rest a status. */
|
|
3
|
+
export type AuthCardNoticeTone = 'info' | 'success' | 'warning' | 'error';
|
|
4
|
+
export type AuthCardProps = Omit<ComponentProps<'main'>, 'title'> & {
|
|
5
|
+
/** The page's `h1`, at the top of the card. */
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
/** A line under the title. */
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
/** A notice above the content: an expired link, a signed-out message. */
|
|
10
|
+
notice?: ReactNode;
|
|
11
|
+
/** `'info'` by default; `'error'` makes the notice an alert, the others a status. */
|
|
12
|
+
noticeTone?: AuthCardNoticeTone;
|
|
13
|
+
/**
|
|
14
|
+
* Moves the focus to the title once shown: for an end state that replaced
|
|
15
|
+
* the form the user acted on ("Check your inbox"), so a screen reader reads
|
|
16
|
+
* it and the keyboard goes on from there.
|
|
17
|
+
*/
|
|
18
|
+
focusTitle?: boolean;
|
|
19
|
+
/** The left of the row above the card: a logo, the product's name. */
|
|
20
|
+
brand?: ReactNode;
|
|
21
|
+
/** The right of that row: a language switcher, a theme toggle. */
|
|
22
|
+
toolbar?: ReactNode;
|
|
23
|
+
/** Above that row: an update notice, a maintenance banner. */
|
|
24
|
+
banner?: ReactNode;
|
|
25
|
+
/** Under the card: links to the terms, to help. */
|
|
26
|
+
footer?: ReactNode;
|
|
27
|
+
/** The form. */
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* The frame of a signed-out page (sign in, sign up, a reset link): one
|
|
32
|
+
* `main`, a centred card whose title is the page's `h1`, a row above it for
|
|
33
|
+
* the brand and a toolbar, padded clear of a phone's notch and home bar.
|
|
34
|
+
*/
|
|
35
|
+
export declare function AuthCard({ title, description, notice, noticeTone, focusTitle, brand, toolbar, banner, footer, className, children, ...props }: AuthCardProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './auth-card';
|
|
@@ -3,6 +3,11 @@ import { InputGroupFieldProps } from '../../fields/input-group-field/input-group
|
|
|
3
3
|
export type AutocompleteOption = {
|
|
4
4
|
value: string;
|
|
5
5
|
label: string;
|
|
6
|
+
/**
|
|
7
|
+
* Rendered and announced as disabled: the arrow keys still reach it so that
|
|
8
|
+
* it is announced, but it is never picked.
|
|
9
|
+
*/
|
|
10
|
+
disabled?: boolean;
|
|
6
11
|
};
|
|
7
12
|
/**
|
|
8
13
|
* How the list is filtered as the user types: `'accent-insensitive'` (the
|
|
@@ -31,7 +36,10 @@ export type AutocompleteSearchProps<T> = {
|
|
|
31
36
|
onSearchError?: (error: unknown) => void;
|
|
32
37
|
/** Controlled loading, when you fetch `options` yourself from `onQueryChange`. */
|
|
33
38
|
loading?: boolean;
|
|
34
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Failure text, shown and announced in place of the options — with
|
|
41
|
+
* `onSearch` too, where it replaces the generic "The search failed".
|
|
42
|
+
*/
|
|
35
43
|
searchError?: ReactNode;
|
|
36
44
|
/** The pause before `onSearch` and `onQueryChange` run, in ms. Default 250. */
|
|
37
45
|
debounceMs?: number;
|
|
@@ -20,9 +20,9 @@ type List = {
|
|
|
20
20
|
*/
|
|
21
21
|
export declare function useAutocompleteStatus(props: StatusProps, list: List): {
|
|
22
22
|
loading: boolean;
|
|
23
|
-
failure: ReactNode;
|
|
23
|
+
failure: string | number | bigint | true | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null;
|
|
24
24
|
hint: string | null;
|
|
25
25
|
emptyText: string | number | bigint | true | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null;
|
|
26
|
-
announcement: ReactNode;
|
|
26
|
+
announcement: string | number | bigint | true | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null;
|
|
27
27
|
};
|
|
28
28
|
export {};
|
|
@@ -20,10 +20,10 @@ export declare function useAutocomplete<T extends AutocompleteOption>(props: Aut
|
|
|
20
20
|
filter: ((option: T, query: string) => boolean) | null;
|
|
21
21
|
status: {
|
|
22
22
|
loading: boolean;
|
|
23
|
-
failure: import('react').ReactNode;
|
|
23
|
+
failure: string | number | bigint | true | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<import('react').ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<import('react').ReactNode> | null | undefined> | null;
|
|
24
24
|
hint: string | null;
|
|
25
25
|
emptyText: string | number | bigint | true | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<import('react').ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<import('react').ReactNode> | null | undefined> | null;
|
|
26
|
-
announcement: import('react').ReactNode;
|
|
26
|
+
announcement: string | number | bigint | true | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<import('react').ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<import('react').ReactNode> | null | undefined> | null;
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './resolve-theme';
|
|
2
2
|
export * from './use-allowed-transitions';
|
|
3
3
|
export { useCspNonce } from './use-csp-nonce';
|
|
4
|
+
export * from './use-focus-on-mount';
|
|
4
5
|
export * from './use-formatters';
|
|
5
6
|
export * from './use-heading-spy';
|
|
6
7
|
export * from './use-is-client';
|
|
@@ -10,4 +11,5 @@ export * from './use-navigation';
|
|
|
10
11
|
export * from './use-number-formatter';
|
|
11
12
|
export * from './use-options';
|
|
12
13
|
export * from './use-search-param';
|
|
14
|
+
export * from './use-submit-once';
|
|
13
15
|
export * from './use-theme';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A ref whose element takes focus once mounted, and again whenever `focus`
|
|
4
|
+
* turns true. Put it on the heading of what replaced the content the user
|
|
5
|
+
* acted on — a wizard's new step, an end state ("Message sent") — so a
|
|
6
|
+
* screen reader reads it and the keyboard goes on from there instead of from
|
|
7
|
+
* the top of the page.
|
|
8
|
+
*
|
|
9
|
+
* The element needs `tabIndex={-1}` unless it is natively focusable (a
|
|
10
|
+
* button, a link, a field): a heading is not.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* function Done() {
|
|
15
|
+
* const title = useFocusOnMount<HTMLHeadingElement>();
|
|
16
|
+
* return (
|
|
17
|
+
* <h2 ref={title} tabIndex={-1}>
|
|
18
|
+
* Message sent
|
|
19
|
+
* </h2>
|
|
20
|
+
* );
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function useFocusOnMount<T extends HTMLElement>(focus?: boolean): RefObject<T | null>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { SubmitGuard } from '@nxgt/material-core/submit-guard';
|
|
2
|
+
export { busySettler, createSubmitGuard, type SubmitGuard, type SubmitOnceOptions, } from '@nxgt/material-core/submit-guard';
|
|
3
|
+
/**
|
|
4
|
+
* One submit in flight for a form: wraps the submit handler so a second
|
|
5
|
+
* click, or Enter, before the first request ends is dropped. A disabled or
|
|
6
|
+
* `loading` button only stops clicks once it has rendered, and never Enter
|
|
7
|
+
* in a field.
|
|
8
|
+
*
|
|
9
|
+
* When the guard opens again:
|
|
10
|
+
* - **The handler returns the request's promise**: when it ends, fulfilled
|
|
11
|
+
* or rejected (the rejection still reaches the caller).
|
|
12
|
+
* - **`busy` is passed** (a router's navigation state): once it was true and
|
|
13
|
+
* is false again — for the run that was on its way when it rose, never a
|
|
14
|
+
* newer one. A handler that returns no promise then waits for `busy`.
|
|
15
|
+
* - **Neither**: a handler that returns no promise (it returned early, or
|
|
16
|
+
* did its work synchronously) opens it at once.
|
|
17
|
+
*
|
|
18
|
+
* So return the request's promise, or pass `busy`.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* const submitOnce = useSubmitOnce();
|
|
23
|
+
* const { handleSubmit } = useForm<Values>();
|
|
24
|
+
* // react-hook-form's handleSubmit returns a promise: the guard opens again
|
|
25
|
+
* // when `save` ends.
|
|
26
|
+
* <form onSubmit={submitOnce(handleSubmit(save))}>…</form>
|
|
27
|
+
*
|
|
28
|
+
* // A request tracked by a flag instead (a router's navigation state):
|
|
29
|
+
* const submitOnce = useSubmitOnce(navigation.state !== 'idle');
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function useSubmitOnce(busy?: boolean): SubmitGuard['once'];
|
|
@@ -1272,5 +1272,26 @@ export declare const en: {
|
|
|
1272
1272
|
truncated: string;
|
|
1273
1273
|
content: string;
|
|
1274
1274
|
};
|
|
1275
|
+
"enrolment-secret": {
|
|
1276
|
+
"qr-label": string;
|
|
1277
|
+
"open-app": string;
|
|
1278
|
+
manual: string;
|
|
1279
|
+
"secret-label": string;
|
|
1280
|
+
copy: string;
|
|
1281
|
+
copied: string;
|
|
1282
|
+
};
|
|
1283
|
+
"recovery-codes": {
|
|
1284
|
+
title: string;
|
|
1285
|
+
warning: string;
|
|
1286
|
+
list: string;
|
|
1287
|
+
copy: string;
|
|
1288
|
+
copied: string;
|
|
1289
|
+
"copy-failed": string;
|
|
1290
|
+
download: string;
|
|
1291
|
+
print: string;
|
|
1292
|
+
saved: string;
|
|
1293
|
+
"saved-required": string;
|
|
1294
|
+
done: string;
|
|
1295
|
+
};
|
|
1275
1296
|
};
|
|
1276
1297
|
};
|
|
@@ -1261,6 +1261,27 @@ declare const _default: {
|
|
|
1261
1261
|
"download": "Download",
|
|
1262
1262
|
"truncated": "Showing the first {size} of this file.",
|
|
1263
1263
|
"content": "Contents of {name}"
|
|
1264
|
+
},
|
|
1265
|
+
"enrolment-secret": {
|
|
1266
|
+
"qr-label": "QR code to scan with your authenticator app",
|
|
1267
|
+
"open-app": "Open in your authenticator app",
|
|
1268
|
+
"manual": "Or type this key in the app:",
|
|
1269
|
+
"secret-label": "Setup key",
|
|
1270
|
+
"copy": "Copy the key",
|
|
1271
|
+
"copied": "Key copied"
|
|
1272
|
+
},
|
|
1273
|
+
"recovery-codes": {
|
|
1274
|
+
"title": "Recovery codes",
|
|
1275
|
+
"warning": "Each code works once. Keep them somewhere safe: they are shown only now.",
|
|
1276
|
+
"list": "Recovery codes",
|
|
1277
|
+
"copy": "Copy codes",
|
|
1278
|
+
"copied": "Codes copied",
|
|
1279
|
+
"copy-failed": "Copy failed",
|
|
1280
|
+
"download": "Download",
|
|
1281
|
+
"print": "Print",
|
|
1282
|
+
"saved": "I have saved these codes",
|
|
1283
|
+
"saved-required": "Tick the box once your codes are safe",
|
|
1284
|
+
"done": "Done"
|
|
1264
1285
|
}
|
|
1265
1286
|
}
|
|
1266
1287
|
;
|
|
@@ -1272,5 +1272,26 @@ export declare const fr: {
|
|
|
1272
1272
|
truncated: string;
|
|
1273
1273
|
content: string;
|
|
1274
1274
|
};
|
|
1275
|
+
"enrolment-secret": {
|
|
1276
|
+
"qr-label": string;
|
|
1277
|
+
"open-app": string;
|
|
1278
|
+
manual: string;
|
|
1279
|
+
"secret-label": string;
|
|
1280
|
+
copy: string;
|
|
1281
|
+
copied: string;
|
|
1282
|
+
};
|
|
1283
|
+
"recovery-codes": {
|
|
1284
|
+
title: string;
|
|
1285
|
+
warning: string;
|
|
1286
|
+
list: string;
|
|
1287
|
+
copy: string;
|
|
1288
|
+
copied: string;
|
|
1289
|
+
"copy-failed": string;
|
|
1290
|
+
download: string;
|
|
1291
|
+
print: string;
|
|
1292
|
+
saved: string;
|
|
1293
|
+
"saved-required": string;
|
|
1294
|
+
done: string;
|
|
1295
|
+
};
|
|
1275
1296
|
};
|
|
1276
1297
|
};
|
|
@@ -1261,6 +1261,27 @@ declare const _default: {
|
|
|
1261
1261
|
"download": "Télécharger",
|
|
1262
1262
|
"truncated": "Seuls les premiers {size} de ce fichier sont affichés.",
|
|
1263
1263
|
"content": "Contenu de {name}"
|
|
1264
|
+
},
|
|
1265
|
+
"enrolment-secret": {
|
|
1266
|
+
"qr-label": "Code QR à scanner avec votre application d'authentification",
|
|
1267
|
+
"open-app": "Ouvrir dans votre application d'authentification",
|
|
1268
|
+
"manual": "Ou saisissez cette clé dans l'application :",
|
|
1269
|
+
"secret-label": "Clé de configuration",
|
|
1270
|
+
"copy": "Copier la clé",
|
|
1271
|
+
"copied": "Clé copiée"
|
|
1272
|
+
},
|
|
1273
|
+
"recovery-codes": {
|
|
1274
|
+
"title": "Codes de récupération",
|
|
1275
|
+
"warning": "Chaque code ne sert qu'une fois. Gardez-les en lieu sûr : ils ne sont affichés que maintenant.",
|
|
1276
|
+
"list": "Codes de récupération",
|
|
1277
|
+
"copy": "Copier les codes",
|
|
1278
|
+
"copied": "Codes copiés",
|
|
1279
|
+
"copy-failed": "Échec de la copie",
|
|
1280
|
+
"download": "Télécharger",
|
|
1281
|
+
"print": "Imprimer",
|
|
1282
|
+
"saved": "J'ai enregistré ces codes",
|
|
1283
|
+
"saved-required": "Cochez la case une fois vos codes en lieu sûr",
|
|
1284
|
+
"done": "Terminé"
|
|
1264
1285
|
}
|
|
1265
1286
|
}
|
|
1266
1287
|
;
|
|
@@ -1270,6 +1270,27 @@ export declare const resources: {
|
|
|
1270
1270
|
truncated: string;
|
|
1271
1271
|
content: string;
|
|
1272
1272
|
};
|
|
1273
|
+
"enrolment-secret": {
|
|
1274
|
+
"qr-label": string;
|
|
1275
|
+
"open-app": string;
|
|
1276
|
+
manual: string;
|
|
1277
|
+
"secret-label": string;
|
|
1278
|
+
copy: string;
|
|
1279
|
+
copied: string;
|
|
1280
|
+
};
|
|
1281
|
+
"recovery-codes": {
|
|
1282
|
+
title: string;
|
|
1283
|
+
warning: string;
|
|
1284
|
+
list: string;
|
|
1285
|
+
copy: string;
|
|
1286
|
+
copied: string;
|
|
1287
|
+
"copy-failed": string;
|
|
1288
|
+
download: string;
|
|
1289
|
+
print: string;
|
|
1290
|
+
saved: string;
|
|
1291
|
+
"saved-required": string;
|
|
1292
|
+
done: string;
|
|
1293
|
+
};
|
|
1273
1294
|
};
|
|
1274
1295
|
};
|
|
1275
1296
|
fr: {
|
|
@@ -2537,6 +2558,27 @@ export declare const resources: {
|
|
|
2537
2558
|
truncated: string;
|
|
2538
2559
|
content: string;
|
|
2539
2560
|
};
|
|
2561
|
+
"enrolment-secret": {
|
|
2562
|
+
"qr-label": string;
|
|
2563
|
+
"open-app": string;
|
|
2564
|
+
manual: string;
|
|
2565
|
+
"secret-label": string;
|
|
2566
|
+
copy: string;
|
|
2567
|
+
copied: string;
|
|
2568
|
+
};
|
|
2569
|
+
"recovery-codes": {
|
|
2570
|
+
title: string;
|
|
2571
|
+
warning: string;
|
|
2572
|
+
list: string;
|
|
2573
|
+
copy: string;
|
|
2574
|
+
copied: string;
|
|
2575
|
+
"copy-failed": string;
|
|
2576
|
+
download: string;
|
|
2577
|
+
print: string;
|
|
2578
|
+
saved: string;
|
|
2579
|
+
"saved-required": string;
|
|
2580
|
+
done: string;
|
|
2581
|
+
};
|
|
2540
2582
|
};
|
|
2541
2583
|
};
|
|
2542
2584
|
};
|