@nxgt/material 2.18.0 → 2.19.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 +88 -0
- package/README.md +1 -0
- package/dist/{_Uint8Array-C7apDrb7.js → _Uint8Array-B6RHzY7k.js} +1 -1
- package/dist/{_overRest-CCAbV-eT.js → _overRest-Cs3RIAVd.js} +1 -1
- package/dist/{async-slice-Cuekts5f.js → async-slice-CgbRYTRY.js} +3 -3
- package/dist/{blockDiagram-BEXU5L5S-B63zbmDg.js → blockDiagram-BEXU5L5S-D5ptXmBP.js} +2 -2
- package/dist/{chunk-3FUC2YCW-CE9T5wr6.js → chunk-3FUC2YCW-al8CepY8.js} +2 -2
- package/dist/{chunk-7M6MHVWA-BjaezAbj.js → chunk-7M6MHVWA-BERAnmfo.js} +1 -1
- package/dist/{chunk-GNY47TPC-DjnciAsL.js → chunk-GNY47TPC-DMMDhC9T.js} +4 -4
- package/dist/{chunk-NETBCI7D-CxQxB74H.js → chunk-NETBCI7D-CsMBdu5o.js} +1 -1
- package/dist/{chunk-Z7XXMR3K-BBrCUBwp.js → chunk-Z7XXMR3K-CLYmaWUD.js} +1 -1
- package/dist/{classDiagram-v2-NBCMYWYE-FeyVcYCs.js → classDiagram-v2-NBCMYWYE-C-6ddqhF.js} +2 -2
- package/dist/components/base.css +3 -1
- package/dist/{components-CsPEBzNF.js → components-C5y9FL-6.js} +23667 -23283
- package/dist/components.js +6 -6
- package/dist/{dagre-6A5THRUB-BjO_Ytfq.js → dagre-6A5THRUB-Ck8np52h.js} +11 -11
- package/dist/{diagram-22UHCM2B-BBKawlhX.js → diagram-22UHCM2B-oIfSvE0L.js} +2 -2
- package/dist/{diagram-3UASUU5V-CKj_37_k.js → diagram-3UASUU5V-CAG93Qkg.js} +1 -1
- package/dist/dnd.js +1 -1
- package/dist/{elk-276RUBZZ-DmkPwZLS.js → elk-276RUBZZ-BfEvNh_f.js} +3 -3
- package/dist/{erDiagram-OPXOYQCR-Dja943M3.js → erDiagram-OPXOYQCR-B966QSkJ.js} +2 -2
- package/dist/{field-blur-DNHXOY0J.js → field-blur-B6VqkpE6.js} +35 -23
- package/dist/{flowDiagram-KWPJA3E3-jmbjSQZS.js → flowDiagram-KWPJA3E3-CzUHW7vw.js} +3 -3
- package/dist/{ganttDiagram-FUAMR5RP-BONNpqJt.js → ganttDiagram-FUAMR5RP-B4JstFXN.js} +1 -1
- package/dist/{graphlib-DxjKaXeR.js → graphlib-CORKO6lR.js} +6 -6
- package/dist/hooks.js +2 -2
- package/dist/{i18n-provider-Dv9ZSmgO.js → i18n-provider-BC7MMAID.js} +1 -1
- package/dist/i18n.js +6 -6
- package/dist/{isArrayLikeObject-H8k6W51O.js → isArrayLikeObject-gzSxxbGJ.js} +3 -3
- package/dist/{isEmpty-B0Bavg-e.js → isEmpty-SD8ldTK-.js} +3 -3
- package/dist/{journeyDiagram-ZHPQQLJL-C_omtnEz.js → journeyDiagram-ZHPQQLJL-DcgTl4Bw.js} +1 -1
- package/dist/lib/components/ui/fields/index.d.ts +1 -0
- package/dist/lib/components/ui/fields/repeatable-group/index.d.ts +2 -0
- package/dist/lib/components/ui/fields/repeatable-group/partials/repeatable-group-footer.d.ts +14 -0
- package/dist/lib/components/ui/fields/repeatable-group/partials/repeatable-group-row.d.ts +19 -0
- package/dist/lib/components/ui/fields/repeatable-group/partials/repeatable-group-rows.d.ts +21 -0
- package/dist/lib/components/ui/fields/repeatable-group/partials/repeatable-group-status.d.ts +11 -0
- package/dist/lib/components/ui/fields/repeatable-group/repeatable-group-classes.d.ts +33 -0
- package/dist/lib/components/ui/fields/repeatable-group/repeatable-group-form-field.d.ts +28 -0
- package/dist/lib/components/ui/fields/repeatable-group/repeatable-group-names.d.ts +16 -0
- package/dist/lib/components/ui/fields/repeatable-group/repeatable-group.d.ts +12 -0
- package/dist/lib/components/ui/fields/repeatable-group/types.d.ts +45 -0
- package/dist/lib/components/ui/fields/repeatable-group/use-repeatable-group.d.ts +32 -0
- package/dist/lib/components/ui/fields/search-field/search-field.d.ts +7 -1
- package/dist/lib/components/ui/overlays/command/command-item.d.ts +10 -0
- package/dist/lib/components/ui/overlays/command/command.d.ts +5 -2
- package/dist/lib/components/ui/primitives/typography/typography.d.ts +2 -1
- package/dist/lib/components/ui/selection/autocomplete/types.d.ts +1 -1
- package/dist/lib/components/ui/selection/autocomplete/use-query-report.d.ts +8 -0
- package/dist/lib/components/ui/selection/checkbox-group/checkbox-group.d.ts +2 -0
- package/dist/lib/components/ui/selection/option-count/option-count.d.ts +18 -0
- package/dist/lib/components/ui/selection/radio-group/radio-group.d.ts +2 -0
- package/dist/lib/components/ui/selection/select-chip-field/next-selection.d.ts +10 -0
- package/dist/lib/components/ui/selection/select-chip-field/select-chip-field.d.ts +8 -1
- package/dist/lib/components/ui/selection/select-chip-field/select-chip-header.d.ts +15 -0
- package/dist/lib/components/ui/selection/select-chip-field/select-chip-option.d.ts +13 -0
- package/dist/lib/i18n/resources/en/en.d.ts +14 -0
- package/dist/lib/i18n/resources/en/material.json.d.ts +14 -0
- package/dist/lib/i18n/resources/fr/fr.d.ts +14 -0
- package/dist/lib/i18n/resources/fr/material.json.d.ts +14 -0
- package/dist/lib/i18n/resources/resources.d.ts +28 -0
- package/dist/lib/i18n/translator.d.ts +1 -1
- package/dist/lib.js +2 -2
- package/dist/main.js +16 -16
- package/dist/map.js +2 -2
- package/dist/material.css +1 -1
- package/dist/{merge-Js8537dg.js → merge-Cek5eQP5.js} +4 -4
- package/dist/{mermaid.core-9dpDfc6Y.js → mermaid.core-DZMjEtsT.js} +21 -21
- package/dist/{mindmap-definition-NLK3R4M7-CjYayluH.js → mindmap-definition-NLK3R4M7-BWaJFjFb.js} +2 -2
- package/dist/{pieDiagram-5QR66LMP-BfFcf84S.js → pieDiagram-5QR66LMP-C8iomTeg.js} +1 -1
- package/dist/print.js +2 -2
- package/dist/{quadrantDiagram-O4NWA36T-DdvYjvR0.js → quadrantDiagram-O4NWA36T-D529X2yn.js} +1 -1
- package/dist/{requirementDiagram-PLB6GJNP-CGG6Y3SN.js → requirementDiagram-PLB6GJNP-Cs5ieS_S.js} +2 -2
- package/dist/{sankeyDiagram-IPEJSGJF-DJufZkAf.js → sankeyDiagram-IPEJSGJF-BOIAba-k.js} +1 -1
- package/dist/{sortable-provider-CUT5Wfdl.js → sortable-provider-DNmv3XmW.js} +1 -1
- package/dist/{stateDiagram-v2-GCMORJYK-vRvpKK9I.js → stateDiagram-v2-GCMORJYK-CT46B5KK.js} +2 -2
- package/dist/{stored-language-BKoohv2_.js → stored-language-FHwsTPoM.js} +24 -0
- package/dist/{swimlanes-2SLR337P-Czy9f6gp.js → swimlanes-2SLR337P-C8TrgNLm.js} +3 -3
- package/dist/{swimlanesDiagram-TC7HE7FX-C6RYBQ-A.js → swimlanesDiagram-TC7HE7FX-Dii9S4bC.js} +3 -3
- package/dist/{timeline-definition-EJHVYXUP-CS9RiAiW.js → timeline-definition-EJHVYXUP-K00somtn.js} +1 -1
- package/dist/{translate-material-CCJg3yfc.js → translate-material-cZ6VSQ98.js} +2 -2
- package/dist/{translator-DEde7BKz.js → translator-DX_ArUA5.js} +1 -1
- package/dist/{use-heading-spy-XkSExwoT.js → use-heading-spy-DR1jat6E.js} +2 -2
- package/dist/{use-material-translation-Cndoq_iK.js → use-material-translation-W6jOKCbO.js} +2 -2
- package/dist/{usecaseDiagram-POWQR4AR-CW-8YHgN.js → usecaseDiagram-POWQR4AR-liF9q6mE.js} +2 -2
- package/dist/{xychartDiagram-PMCCYNJV-G4PopeeF.js → xychartDiagram-PMCCYNJV-B9Qx3wAO.js} +1 -1
- package/docs/components/README.md +1 -1
- package/docs/components/form-fields.md +146 -0
- package/docs/components/overlays-and-menus.md +2 -0
- package/docs/components/primitives.md +3 -1
- package/docs/components/selection-and-choice.md +22 -6
- package/docs/guides/forms.md +35 -0
- package/docs/previews/form-fields-repeatablegroup.webp +0 -0
- package/docs/roadmap.md +7 -0
- package/docs/troubleshooting.md +57 -0
- package/lib/components/base.css +3 -1
- package/package.json +2 -2
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RepeatableGroupProps } from './types';
|
|
2
|
+
export type { RepeatableGroupProps, RepeatableGroupRowContext, } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Rows of fields a user adds, removes and, with `reorderable`, moves: a list
|
|
5
|
+
* (`ul`/`li`) of rows, each from `renderRow`, a Remove button per row named
|
|
6
|
+
* after it ("Remove period 2"), and an Add button. An added row's first field
|
|
7
|
+
* takes the focus, a removed row hands it to its neighbour (or to Add), a
|
|
8
|
+
* moved row keeps it on its move button, and each change is announced
|
|
9
|
+
* politely. For react-hook-form, `RepeatableGroupFormField` wires it to
|
|
10
|
+
* `useFieldArray`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function RepeatableGroup<TItem>({ items, renderRow, getKey, label, rowLabel, addLabel, onAdd, onRemove, onMove, reorderable, min, max, disabled, error, emptyTitle, emptyDescription, className, ref, ...props }: RepeatableGroupProps<TItem>): import("react").JSX.Element;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ComponentProps, Key, ReactNode } from 'react';
|
|
2
|
+
/** What `renderRow` is given for each row. */
|
|
3
|
+
export type RepeatableGroupRowContext<TItem> = {
|
|
4
|
+
item: TItem;
|
|
5
|
+
/** 0-based, for the row's field names (`periods.${index}.name`). */
|
|
6
|
+
index: number;
|
|
7
|
+
/** 1-based, as a user reads it ("Period 2"). */
|
|
8
|
+
position: number;
|
|
9
|
+
};
|
|
10
|
+
export type RepeatableGroupProps<TItem> = Omit<ComponentProps<'div'>, 'children' | 'onChange'> & {
|
|
11
|
+
/** The rows' values, one row each. */
|
|
12
|
+
items: readonly TItem[];
|
|
13
|
+
/** Renders one row's fields. */
|
|
14
|
+
renderRow: (row: RepeatableGroupRowContext<TItem>) => ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* A stable key per row; by default the item's `id` (what react-hook-form's
|
|
17
|
+
* `useFieldArray` gives each field), else its index.
|
|
18
|
+
*/
|
|
19
|
+
getKey?: (item: TItem, index: number) => Key;
|
|
20
|
+
/** The group's label, above the rows; it names the group and the list. */
|
|
21
|
+
label?: ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* What one row is, lower case: it names the row's buttons ("Remove
|
|
24
|
+
* period 2") and the announcements. Default "row", translated.
|
|
25
|
+
*/
|
|
26
|
+
rowLabel?: string;
|
|
27
|
+
/** The Add button's text. Default "Add {rowLabel}", translated. */
|
|
28
|
+
addLabel?: string;
|
|
29
|
+
onAdd: () => void;
|
|
30
|
+
onRemove: (index: number) => void;
|
|
31
|
+
/** Called by the move buttons, which `reorderable` shows. */
|
|
32
|
+
onMove?: (from: number, to: number) => void;
|
|
33
|
+
/** Move up and move down buttons on each row. */
|
|
34
|
+
reorderable?: boolean;
|
|
35
|
+
/** No Remove at this many rows. */
|
|
36
|
+
min?: number;
|
|
37
|
+
/** The Add button is disabled at this many rows, and says why. */
|
|
38
|
+
max?: number;
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
/** An error about the whole group (`arrayErrorMessage`), under the rows. */
|
|
41
|
+
error?: ReactNode;
|
|
42
|
+
/** With no row: an EmptyState with this title (and description). */
|
|
43
|
+
emptyTitle?: ReactNode;
|
|
44
|
+
emptyDescription?: ReactNode;
|
|
45
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { RowMoveDirection } from '@nxgt/material-core/repeatable-group';
|
|
2
|
+
type Options = {
|
|
3
|
+
items: readonly unknown[];
|
|
4
|
+
rowLabel?: string;
|
|
5
|
+
max?: number;
|
|
6
|
+
onAdd: () => void;
|
|
7
|
+
onRemove: (index: number) => void;
|
|
8
|
+
onMove?: (from: number, to: number) => void;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* A RepeatableGroup's behaviour: the buttons' names, the focus after a row
|
|
12
|
+
* is added, removed or moved (the rules are `@nxgt/material-core`'s, shared
|
|
13
|
+
* with the Vue group), and what the polite live region says.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useRepeatableGroup(options: Options): {
|
|
16
|
+
setRoot: (node: Element | null) => void;
|
|
17
|
+
message: {
|
|
18
|
+
text: string;
|
|
19
|
+
id: number;
|
|
20
|
+
};
|
|
21
|
+
names: {
|
|
22
|
+
add: string;
|
|
23
|
+
remove: (position: number) => string;
|
|
24
|
+
moveUp: (position: number) => string;
|
|
25
|
+
moveDown: (position: number) => string;
|
|
26
|
+
maxReached: string;
|
|
27
|
+
};
|
|
28
|
+
add: () => void;
|
|
29
|
+
remove: (index: number) => void;
|
|
30
|
+
move: (index: number, direction: RowMoveDirection) => void;
|
|
31
|
+
};
|
|
32
|
+
export {};
|
|
@@ -7,5 +7,11 @@ export type SearchFieldProps = Omit<InputProps, 'type'> & {
|
|
|
7
7
|
loading?: boolean;
|
|
8
8
|
debounceMs?: number;
|
|
9
9
|
onValueChange?: (value: string) => void;
|
|
10
|
+
/**
|
|
11
|
+
* A hint for the key that focuses the field, for example `"/"`: shown as a
|
|
12
|
+
* `Kbd` while the field is empty and set as `aria-keyshortcuts`. It binds no
|
|
13
|
+
* key; the page owns the listener.
|
|
14
|
+
*/
|
|
15
|
+
shortcut?: string;
|
|
10
16
|
};
|
|
11
|
-
export declare function SearchField({ id, value: valueProp, defaultValue, onChange, onValueChange, debounceMs, loading, placeholder, label, helperText, error, disabled, required, name, className, onKeyDown, ...props }: SearchFieldProps): import("react").JSX.Element;
|
|
17
|
+
export declare function SearchField({ id, value: valueProp, defaultValue, onChange, onValueChange, debounceMs, loading, placeholder, label, helperText, error, disabled, required, name, className, onKeyDown, shortcut, ...props }: SearchFieldProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command as CommandPrimitive } from 'cmdk';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
declare function CommandItem({ className, checked, children, ...props }: ComponentProps<typeof CommandPrimitive.Item> & {
|
|
4
|
+
/**
|
|
5
|
+
* Sets `aria-checked` and shows a checkbox indicator. cmdk's
|
|
6
|
+
* `aria-selected` stays the highlighted item, not the checked one.
|
|
7
|
+
*/
|
|
8
|
+
checked?: boolean;
|
|
9
|
+
}): import("react").JSX.Element;
|
|
10
|
+
export { CommandItem };
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { Command as CommandPrimitive } from 'cmdk';
|
|
2
2
|
import { ComponentProps } from 'react';
|
|
3
3
|
import { Dialog } from '../dialog/dialog';
|
|
4
|
+
import { CommandItem } from './command-item';
|
|
4
5
|
declare function Command({ className, ...props }: ComponentProps<typeof CommandPrimitive>): import("react").JSX.Element;
|
|
5
6
|
declare function CommandDialog({ title, description, children, ...props }: ComponentProps<typeof Dialog> & {
|
|
6
7
|
title?: string;
|
|
7
8
|
description?: string;
|
|
8
9
|
}): import("react").JSX.Element;
|
|
9
10
|
declare function CommandInput({ className, ...props }: ComponentProps<typeof CommandPrimitive.Input>): import("react").JSX.Element;
|
|
10
|
-
declare function CommandList({ className, ...props }: ComponentProps<typeof CommandPrimitive.List>
|
|
11
|
+
declare function CommandList({ className, multiselectable, ...props }: ComponentProps<typeof CommandPrimitive.List> & {
|
|
12
|
+
/** Sets `aria-multiselectable`: the items carry a `checked` state. */
|
|
13
|
+
multiselectable?: boolean;
|
|
14
|
+
}): import("react").JSX.Element;
|
|
11
15
|
declare function CommandEmpty({ ...props }: ComponentProps<typeof CommandPrimitive.Empty>): import("react").JSX.Element;
|
|
12
16
|
declare function CommandGroup({ className, ...props }: ComponentProps<typeof CommandPrimitive.Group>): import("react").JSX.Element;
|
|
13
17
|
declare function CommandSeparator({ className, ...props }: ComponentProps<typeof CommandPrimitive.Separator>): import("react").JSX.Element;
|
|
14
|
-
declare function CommandItem({ className, ...props }: ComponentProps<typeof CommandPrimitive.Item>): import("react").JSX.Element;
|
|
15
18
|
declare function CommandShortcut({ className, ...props }: ComponentProps<'span'>): import("react").JSX.Element;
|
|
16
19
|
export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, };
|
|
@@ -2,6 +2,7 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
2
2
|
import { ComponentProps } from 'react';
|
|
3
3
|
export declare const typographyVariants: (props?: ({
|
|
4
4
|
variant?: "caption" | "normal" | "huge-larger" | "huge-large" | "huge-medium" | "huge-small" | "headline-larger" | "headline-large" | "headline-medium" | "headline-small" | "title-large" | "title-medium" | "title-small" | "body-medium" | "body-small" | null | undefined;
|
|
5
|
+
tone?: "error" | "default" | "primary" | "muted" | null | undefined;
|
|
5
6
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
7
|
export type TypographyProps = ComponentProps<'p'> & VariantProps<typeof typographyVariants> & {
|
|
7
8
|
/** The element to render, `div` by default. Intrinsic tags only. */
|
|
@@ -9,4 +10,4 @@ export type TypographyProps = ComponentProps<'p'> & VariantProps<typeof typograp
|
|
|
9
10
|
/** Merge the typography classes onto the single child instead of rendering an element. */
|
|
10
11
|
asChild?: boolean;
|
|
11
12
|
};
|
|
12
|
-
export declare function Typography({ className, variant, as, asChild, ...props }: TypographyProps): import("react").JSX.Element;
|
|
13
|
+
export declare function Typography({ className, variant, tone, as, asChild, ...props }: TypographyProps): import("react").JSX.Element;
|
|
@@ -67,7 +67,7 @@ export type AutocompleteProps<T extends AutocompleteOption = AutocompleteOption>
|
|
|
67
67
|
renderOption?: (option: T) => ReactNode;
|
|
68
68
|
renderSelectedLeading?: (option: T) => ReactNode;
|
|
69
69
|
actions?: ReactNode | ((query: string) => ReactNode);
|
|
70
|
-
/** The query, once typing pauses (`debounceMs`). */
|
|
70
|
+
/** The query, once typing pauses (`debounceMs`); `''` at once when it empties (a pick, a clear). */
|
|
71
71
|
onQueryChange?: (query: string) => void;
|
|
72
72
|
} & AutocompleteSearchProps<T> & ({
|
|
73
73
|
mode: 'single';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reports the query to `onQueryChange`: typing once it pauses for `debounceMs`,
|
|
3
|
+
* and `''` at once, but only when the query changes from a non-empty value
|
|
4
|
+
* to `''` (a pick, a clear), never on mount. What the page derives from the
|
|
5
|
+
* query then changes with the pick, not `debounceMs` later, under the click
|
|
6
|
+
* on the next field (#557). The same as the Vue Autocomplete's `queryChange`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useQueryReport(query: string, debounceMs: number, onQueryChange: ((query: string) => void) | undefined): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An option's trailing count, as plain text inside the option's label or
|
|
3
|
+
* chip: " 24" in muted `tabular-nums`, then a `sr-only` " results" (the
|
|
4
|
+
* `material.option-count.label` ICU plural, the unit word only). The name
|
|
5
|
+
* reads "CE1 24 results": it starts with the visible label (WCAG 2.5.3), and
|
|
6
|
+
* no ARIA attribute or zero-size trick is involved, so it names the same in
|
|
7
|
+
* Chromium, WebKit and Firefox.
|
|
8
|
+
*
|
|
9
|
+
* Limits: put it right after the label text, in the same inline wrapper
|
|
10
|
+
* (a `<span>`) for a checkbox or radio, so a flex `Label` sees one item. The
|
|
11
|
+
* leading space is a text node; a flex chip drops it and its `gap` spaces
|
|
12
|
+
* the items instead. On a filled chip (`inChip`) the count keeps the chip's
|
|
13
|
+
* colour: the muted one would not reach 4.5:1.
|
|
14
|
+
*/
|
|
15
|
+
export declare function OptionCount({ count, inChip, }: {
|
|
16
|
+
count?: number;
|
|
17
|
+
inChip?: boolean;
|
|
18
|
+
}): import("react").JSX.Element | null;
|
|
@@ -5,6 +5,8 @@ export type RadioGroupOption = {
|
|
|
5
5
|
label: ReactNode;
|
|
6
6
|
/** Rendered and announced as disabled, skipped by the arrow keys. */
|
|
7
7
|
disabled?: boolean;
|
|
8
|
+
/** Shown after the label and added to its accessible name. */
|
|
9
|
+
count?: number;
|
|
8
10
|
};
|
|
9
11
|
export type RadioGroupProps = {
|
|
10
12
|
options: RadioGroupOption[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The value after `target` was pressed. Multiple mode toggles it; single mode
|
|
3
|
+
* replaces the choice, and clears it on a second press unless `deselectable`
|
|
4
|
+
* is `false`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function nextSelection(mode: 'single' | 'multiple', value: string[], target: string, deselectable?: boolean): string[];
|
|
7
|
+
/** The chip the field's `ref` reaches: the first chosen one, else the first. */
|
|
8
|
+
export declare function firstChosenIndex(options: {
|
|
9
|
+
value: string;
|
|
10
|
+
}[], value: string[]): number;
|
|
@@ -7,7 +7,14 @@ export type SelectChipFieldProps = {
|
|
|
7
7
|
value: string;
|
|
8
8
|
label: string;
|
|
9
9
|
icon?: ReactNode;
|
|
10
|
+
/** Shown after the label and added to its accessible name. */
|
|
11
|
+
count?: number;
|
|
10
12
|
}[];
|
|
13
|
+
/**
|
|
14
|
+
* Single mode: pressing the chosen chip again clears it (`true`, the
|
|
15
|
+
* default). `false` keeps it chosen, as a radio group does.
|
|
16
|
+
*/
|
|
17
|
+
deselectable?: boolean;
|
|
11
18
|
label?: ReactNode;
|
|
12
19
|
helperText?: ReactNode;
|
|
13
20
|
error?: boolean;
|
|
@@ -19,4 +26,4 @@ export type SelectChipFieldProps = {
|
|
|
19
26
|
*/
|
|
20
27
|
ref?: Ref<HTMLButtonElement>;
|
|
21
28
|
} & Omit<ComponentProps<'div'>, 'children' | 'ref'>;
|
|
22
|
-
export declare function SelectChipField({ value, onValueChange, mode, options, className, label, error, helperText, disabled, name, id, 'aria-invalid': ariaInvalid, ref, ...props }: SelectChipFieldProps): import("react").JSX.Element;
|
|
29
|
+
export declare function SelectChipField({ value, onValueChange, mode, options, className, label, error, helperText, disabled, name, deselectable, id, 'aria-invalid': ariaInvalid, ref, ...props }: SelectChipFieldProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/** The ids of a `SelectChipField`'s label, help text and "not valid" hint. */
|
|
3
|
+
export declare const chipGroupIds: (groupId: string) => {
|
|
4
|
+
labelId: string;
|
|
5
|
+
helperId: string;
|
|
6
|
+
invalidId: string;
|
|
7
|
+
};
|
|
8
|
+
/** A `SelectChipField`'s label, help text and the hidden "not valid" hint. */
|
|
9
|
+
export declare function SelectChipHeader({ ids, label, helperText, error, invalid, }: {
|
|
10
|
+
ids: ReturnType<typeof chipGroupIds>;
|
|
11
|
+
label?: ReactNode;
|
|
12
|
+
helperText?: ReactNode;
|
|
13
|
+
error?: boolean;
|
|
14
|
+
invalid: boolean;
|
|
15
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode, Ref } from 'react';
|
|
2
|
+
export type SelectChipOptionProps = {
|
|
3
|
+
label: string;
|
|
4
|
+
icon?: ReactNode;
|
|
5
|
+
count?: number;
|
|
6
|
+
pressed: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
dataPw: string;
|
|
9
|
+
ref?: Ref<HTMLButtonElement>;
|
|
10
|
+
onPress: () => void;
|
|
11
|
+
};
|
|
12
|
+
/** One chip of a `SelectChipField`: a toggle button, `aria-pressed`. */
|
|
13
|
+
export declare function SelectChipOption({ label, icon, count, pressed, disabled, dataPw, ref, onPress, }: SelectChipOptionProps): import("react").JSX.Element;
|
|
@@ -795,6 +795,9 @@ export declare const en: {
|
|
|
795
795
|
placeholder: string;
|
|
796
796
|
empty: string;
|
|
797
797
|
};
|
|
798
|
+
"option-count": {
|
|
799
|
+
label: string;
|
|
800
|
+
};
|
|
798
801
|
autocomplete: {
|
|
799
802
|
empty: string;
|
|
800
803
|
add: string;
|
|
@@ -1293,5 +1296,16 @@ export declare const en: {
|
|
|
1293
1296
|
"saved-required": string;
|
|
1294
1297
|
done: string;
|
|
1295
1298
|
};
|
|
1299
|
+
"repeatable-group": {
|
|
1300
|
+
row: string;
|
|
1301
|
+
add: string;
|
|
1302
|
+
remove: string;
|
|
1303
|
+
"move-up": string;
|
|
1304
|
+
"move-down": string;
|
|
1305
|
+
added: string;
|
|
1306
|
+
removed: string;
|
|
1307
|
+
moved: string;
|
|
1308
|
+
"max-reached": string;
|
|
1309
|
+
};
|
|
1296
1310
|
};
|
|
1297
1311
|
};
|
|
@@ -785,6 +785,9 @@ declare const _default: {
|
|
|
785
785
|
"placeholder": "Search…",
|
|
786
786
|
"empty": "No results"
|
|
787
787
|
},
|
|
788
|
+
"option-count": {
|
|
789
|
+
"label": "{count, plural, one {result} other {results}}"
|
|
790
|
+
},
|
|
788
791
|
"autocomplete": {
|
|
789
792
|
"empty": "No option found.",
|
|
790
793
|
"add": "Add \"{query}\"",
|
|
@@ -1282,6 +1285,17 @@ declare const _default: {
|
|
|
1282
1285
|
"saved": "I have saved these codes",
|
|
1283
1286
|
"saved-required": "Tick the box once your codes are safe",
|
|
1284
1287
|
"done": "Done"
|
|
1288
|
+
},
|
|
1289
|
+
"repeatable-group": {
|
|
1290
|
+
"row": "row",
|
|
1291
|
+
"add": "Add {label}",
|
|
1292
|
+
"remove": "Remove {label} {index}",
|
|
1293
|
+
"move-up": "Move {label} {index} up",
|
|
1294
|
+
"move-down": "Move {label} {index} down",
|
|
1295
|
+
"added": "Added {label} {index}",
|
|
1296
|
+
"removed": "Removed {label} {index}",
|
|
1297
|
+
"moved": "Moved {label} {from} to position {to}",
|
|
1298
|
+
"max-reached": "Maximum reached ({max})"
|
|
1285
1299
|
}
|
|
1286
1300
|
}
|
|
1287
1301
|
;
|
|
@@ -795,6 +795,9 @@ export declare const fr: {
|
|
|
795
795
|
placeholder: string;
|
|
796
796
|
empty: string;
|
|
797
797
|
};
|
|
798
|
+
"option-count": {
|
|
799
|
+
label: string;
|
|
800
|
+
};
|
|
798
801
|
autocomplete: {
|
|
799
802
|
empty: string;
|
|
800
803
|
add: string;
|
|
@@ -1293,5 +1296,16 @@ export declare const fr: {
|
|
|
1293
1296
|
"saved-required": string;
|
|
1294
1297
|
done: string;
|
|
1295
1298
|
};
|
|
1299
|
+
"repeatable-group": {
|
|
1300
|
+
row: string;
|
|
1301
|
+
add: string;
|
|
1302
|
+
remove: string;
|
|
1303
|
+
"move-up": string;
|
|
1304
|
+
"move-down": string;
|
|
1305
|
+
added: string;
|
|
1306
|
+
removed: string;
|
|
1307
|
+
moved: string;
|
|
1308
|
+
"max-reached": string;
|
|
1309
|
+
};
|
|
1296
1310
|
};
|
|
1297
1311
|
};
|
|
@@ -785,6 +785,9 @@ declare const _default: {
|
|
|
785
785
|
"placeholder": "Rechercher…",
|
|
786
786
|
"empty": "Aucun résultat"
|
|
787
787
|
},
|
|
788
|
+
"option-count": {
|
|
789
|
+
"label": "{count, plural, one {résultat} other {résultats}}"
|
|
790
|
+
},
|
|
788
791
|
"autocomplete": {
|
|
789
792
|
"empty": "Aucune option.",
|
|
790
793
|
"add": "Ajouter « {query} »",
|
|
@@ -1282,6 +1285,17 @@ declare const _default: {
|
|
|
1282
1285
|
"saved": "J'ai enregistré ces codes",
|
|
1283
1286
|
"saved-required": "Cochez la case une fois vos codes en lieu sûr",
|
|
1284
1287
|
"done": "Terminé"
|
|
1288
|
+
},
|
|
1289
|
+
"repeatable-group": {
|
|
1290
|
+
"row": "ligne",
|
|
1291
|
+
"add": "Ajouter une {label}",
|
|
1292
|
+
"remove": "Retirer la {label} {index}",
|
|
1293
|
+
"move-up": "Monter la {label} {index}",
|
|
1294
|
+
"move-down": "Descendre la {label} {index}",
|
|
1295
|
+
"added": "Ajout : {label} {index}",
|
|
1296
|
+
"removed": "Suppression : {label} {index}",
|
|
1297
|
+
"moved": "Déplacement : {label} {from} en position {to}",
|
|
1298
|
+
"max-reached": "Maximum atteint ({max})"
|
|
1285
1299
|
}
|
|
1286
1300
|
}
|
|
1287
1301
|
;
|
|
@@ -793,6 +793,9 @@ export declare const resources: {
|
|
|
793
793
|
placeholder: string;
|
|
794
794
|
empty: string;
|
|
795
795
|
};
|
|
796
|
+
"option-count": {
|
|
797
|
+
label: string;
|
|
798
|
+
};
|
|
796
799
|
autocomplete: {
|
|
797
800
|
empty: string;
|
|
798
801
|
add: string;
|
|
@@ -1291,6 +1294,17 @@ export declare const resources: {
|
|
|
1291
1294
|
"saved-required": string;
|
|
1292
1295
|
done: string;
|
|
1293
1296
|
};
|
|
1297
|
+
"repeatable-group": {
|
|
1298
|
+
row: string;
|
|
1299
|
+
add: string;
|
|
1300
|
+
remove: string;
|
|
1301
|
+
"move-up": string;
|
|
1302
|
+
"move-down": string;
|
|
1303
|
+
added: string;
|
|
1304
|
+
removed: string;
|
|
1305
|
+
moved: string;
|
|
1306
|
+
"max-reached": string;
|
|
1307
|
+
};
|
|
1294
1308
|
};
|
|
1295
1309
|
};
|
|
1296
1310
|
fr: {
|
|
@@ -2081,6 +2095,9 @@ export declare const resources: {
|
|
|
2081
2095
|
placeholder: string;
|
|
2082
2096
|
empty: string;
|
|
2083
2097
|
};
|
|
2098
|
+
"option-count": {
|
|
2099
|
+
label: string;
|
|
2100
|
+
};
|
|
2084
2101
|
autocomplete: {
|
|
2085
2102
|
empty: string;
|
|
2086
2103
|
add: string;
|
|
@@ -2579,6 +2596,17 @@ export declare const resources: {
|
|
|
2579
2596
|
"saved-required": string;
|
|
2580
2597
|
done: string;
|
|
2581
2598
|
};
|
|
2599
|
+
"repeatable-group": {
|
|
2600
|
+
row: string;
|
|
2601
|
+
add: string;
|
|
2602
|
+
remove: string;
|
|
2603
|
+
"move-up": string;
|
|
2604
|
+
"move-down": string;
|
|
2605
|
+
added: string;
|
|
2606
|
+
removed: string;
|
|
2607
|
+
moved: string;
|
|
2608
|
+
"max-reached": string;
|
|
2609
|
+
};
|
|
2582
2610
|
};
|
|
2583
2611
|
};
|
|
2584
2612
|
};
|