@nxgt/material 3.91.0 → 3.93.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 +55 -0
- package/README.md +3 -3
- package/dist/{alert-dialog-BFk4ye-3.js → alert-dialog-D37eph4I.js} +1 -1
- package/dist/{async-slice-gGyfyUw2.js → async-slice-BSqwhAj-.js} +1 -1
- package/dist/{button-C5OEq9bi.js → button-CG9SBAT-.js} +1 -1
- package/dist/{calculator-Dg_L6d3R.js → calculator-YD3I3y-I.js} +10 -10
- package/dist/calculator-field.js +6 -6
- package/dist/{calculator-segment-CvAaDqKf.js → calculator-segment-Cjec9zi7.js} +1 -1
- package/dist/calculator.js +1 -1
- package/dist/charts.js +3 -3
- package/dist/{chip-DOxFA4BI.js → chip-BbUSBl3i.js} +2 -2
- package/dist/{code-editor-tiAjhXW-.js → code-editor-ZEM7AAcs.js} +4 -4
- package/dist/code-editor.js +4 -4
- package/dist/{code-language-items-CcdzQvLT.js → code-language-items-CAuHPrHd.js} +2 -2
- package/dist/components/components.css +1 -0
- package/dist/components/ui/widgets/event-calendar/event-calendar-backdrop.css +43 -0
- package/dist/{components-G0nEVa52.js → components-CuFTrmGy.js} +19023 -18257
- package/dist/components.js +38 -38
- package/dist/{conversion-variant-4gCdFWV-.js → conversion-variant-DmEtTCSP.js} +3 -3
- package/dist/{currency-field-CIqe7Wg4.js → currency-field-CabGnVO9.js} +5 -5
- package/dist/{dialog-d6Kdf5wc.js → dialog-Jhpx6ulb.js} +3 -3
- package/dist/dnd.js +1 -1
- package/dist/{dropdown-menu-DO5kUvof.js → dropdown-menu-nl0Q3tQ2.js} +1 -1
- package/dist/editor.js +7 -7
- package/dist/{empty-state-DQnICuun.js → empty-state-mrJuqph3.js} +1 -1
- package/dist/{financial-variant-D80C1hVD.js → financial-variant-P8gFA9aI.js} +5 -5
- package/dist/{hooks-C-yLDF39.js → hooks-CjSpziWf.js} +2 -2
- package/dist/hooks.js +2 -2
- package/dist/{hover-card-DU3TAME4.js → hover-card-BNb1M8ij.js} +1 -1
- package/dist/i18n.js +3 -3
- package/dist/{icon-badge-BGczZ4Hc.js → icon-badge-CVMHwdFm.js} +1 -1
- package/dist/{icon-button-D0xjBCst.js → icon-button-Ch0PThsa.js} +1 -1
- package/dist/{input-group-CSlXMFxu.js → input-group-CPMSQcBx.js} +1 -1
- package/dist/lib/components/ui/collections/day-grouped-list/day-grouped-list.d.ts +30 -2
- package/dist/lib/components/ui/collections/day-grouped-list/index.d.ts +7 -2
- package/dist/lib/components/ui/collections/day-grouped-list/partials/day-group-section.d.ts +17 -0
- package/dist/lib/components/ui/collections/day-grouped-list/use-day-groups.d.ts +24 -0
- package/dist/lib/components/ui/display/entity-header/entity-metadata.d.ts +2 -0
- package/dist/lib/components/ui/display/event-chip/event-chip-badges.d.ts +21 -0
- package/dist/lib/components/ui/display/event-chip/event-chip-content.d.ts +5 -7
- package/dist/lib/components/ui/display/event-chip/event-chip-title.d.ts +9 -0
- package/dist/lib/components/ui/display/event-chip/event-chip.classes.d.ts +9 -0
- package/dist/lib/components/ui/display/event-chip/event-chip.d.ts +15 -2
- package/dist/lib/components/ui/fields/attributes/attribute-values-form-field-set/attribute-values-form-field-set.d.ts +1 -1
- package/dist/lib/components/ui/fields/choice-list/choice-list-control.d.ts +1 -1
- package/dist/lib/components/ui/fields/choice-list/choice-list-field.d.ts +1 -1
- package/dist/lib/components/ui/fields/choice-list/choice-list-focus.d.ts +6 -3
- package/dist/lib/components/ui/fields/choice-list/choice-list-form-field.d.ts +2 -2
- package/dist/lib/components/ui/fields/choice-list/choice-list-names.d.ts +2 -0
- package/dist/lib/components/ui/fields/choice-list/choice-list.utils.d.ts +2 -0
- package/dist/lib/components/ui/fields/choice-list/index.d.ts +1 -1
- package/dist/lib/components/ui/fields/choice-list/partials/choice-row.d.ts +9 -3
- package/dist/lib/components/ui/fields/choice-list/types.d.ts +20 -0
- package/dist/lib/components/ui/fields/contacts/placeholders.d.ts +1 -1
- package/dist/lib/components/ui/layout/record-page/record-details.d.ts +6 -6
- package/dist/lib/components/ui/media/file-list/file-list-describe.d.ts +8 -0
- package/dist/lib/components/ui/media/file-list/file-list-field-row.d.ts +4 -1
- package/dist/lib/components/ui/media/file-list/file-list-field.d.ts +13 -0
- package/dist/lib/components/ui/media/file-list/index.d.ts +1 -1
- package/dist/lib/components/ui/media/file-list/partials/file-list-items.d.ts +5 -1
- package/dist/lib/components/ui/media/file-list/partials/file-list-move-buttons.d.ts +9 -0
- package/dist/lib/components/ui/media/file-list/partials/file-list-row-actions.d.ts +3 -1
- package/dist/lib/components/ui/media/file-list/types.d.ts +9 -0
- package/dist/lib/components/ui/media/file-list/use-file-list-field.d.ts +7 -1
- package/dist/lib/components/ui/media/file-list/use-file-list-move.d.ts +24 -0
- package/dist/lib/components/ui/media/upload/network-upload-field/network-upload-item.d.ts +7 -0
- package/dist/lib/components/ui/widgets/editor/extensions/marks/compact-mark-buttons.d.ts +5 -1
- package/dist/lib/components/ui/widgets/editor/kit/editor-features.d.ts +2 -1
- package/dist/lib/components/ui/widgets/editor/kit/features/marks.d.ts +6 -1
- package/dist/lib/components/ui/widgets/event-calendar/backdrop.types.d.ts +75 -0
- package/dist/lib/components/ui/widgets/event-calendar/chrome.types.d.ts +12 -0
- package/dist/lib/components/ui/widgets/event-calendar/event-calendar-context.d.ts +8 -1
- package/dist/lib/components/ui/widgets/event-calendar/event-calendar-events.utils.d.ts +3 -1
- package/dist/lib/components/ui/widgets/event-calendar/event-calendar-shell.d.ts +1 -1
- package/dist/lib/components/ui/widgets/event-calendar/event-calendar.backdrop.d.ts +38 -0
- package/dist/lib/components/ui/widgets/event-calendar/event-calendar.badges.d.ts +14 -0
- package/dist/lib/components/ui/widgets/event-calendar/event-calendar.labels.d.ts +14 -1
- package/dist/lib/components/ui/widgets/event-calendar/event-calendar.lanes.d.ts +9 -0
- package/dist/lib/components/ui/widgets/event-calendar/event-calendar.read-only.d.ts +57 -0
- package/dist/lib/components/ui/widgets/event-calendar/event-calendar.resources.d.ts +6 -1
- package/dist/lib/components/ui/widgets/event-calendar/index.d.ts +2 -1
- package/dist/lib/components/ui/widgets/event-calendar/partials/all-day-bars.d.ts +14 -0
- package/dist/lib/components/ui/widgets/event-calendar/partials/backdrop-bands.d.ts +11 -0
- package/dist/lib/components/ui/widgets/event-calendar/partials/backdrop-bar.d.ts +11 -0
- package/dist/lib/components/ui/widgets/event-calendar/partials/backdrop-cell.d.ts +13 -0
- package/dist/lib/components/ui/widgets/event-calendar/partials/backdrop-row.d.ts +8 -0
- package/dist/lib/components/ui/widgets/event-calendar/partials/calendar-badge.d.ts +16 -0
- package/dist/lib/components/ui/widgets/event-calendar/partials/month-day-cell.d.ts +4 -1
- package/dist/lib/components/ui/widgets/event-calendar/partials/month-day-parts.d.ts +12 -1
- package/dist/lib/components/ui/widgets/event-calendar/partials/resource-header.d.ts +2 -1
- package/dist/lib/components/ui/widgets/event-calendar/partials/span-event.d.ts +3 -1
- package/dist/lib/components/ui/widgets/event-calendar/partials/time-grid-header-day.d.ts +3 -6
- package/dist/lib/components/ui/widgets/event-calendar/partials/zone-corner.d.ts +10 -2
- package/dist/lib/components/ui/widgets/event-calendar/template.types.d.ts +7 -2
- package/dist/lib/components/ui/widgets/event-calendar/types.d.ts +25 -13
- package/dist/lib/components/ui/widgets/event-calendar/use-backdrops.d.ts +8 -0
- package/dist/lib/components/ui/widgets/event-calendar/use-badges.d.ts +5 -0
- package/dist/lib/components/ui/widgets/event-calendar/use-event-calendar.d.ts +3 -2
- package/dist/lib/components/ui/widgets/event-calendar/use-month-day.d.ts +6 -1
- package/dist/lib/components/ui/widgets/event-calendar/use-time-column.d.ts +1 -0
- package/dist/lib/i18n/resources/en/en.d.ts +10 -0
- package/dist/lib/i18n/resources/en/material.json.d.ts +11 -1
- package/dist/lib/i18n/resources/fr/fr.d.ts +10 -0
- package/dist/lib/i18n/resources/fr/material.json.d.ts +11 -1
- package/dist/lib/i18n/resources/resources.d.ts +20 -0
- package/dist/lib/i18n/translator.d.ts +1 -1
- package/dist/lib.js +1 -1
- package/dist/main.js +54 -54
- package/dist/map.js +7 -7
- package/dist/material.css +1 -1
- package/dist/pdf-reader.js +1 -1
- package/dist/{percent-field-DyJ2yOH4.js → percent-field-TWyupyr_.js} +1 -1
- package/dist/{picker-surface-CnlOKQ3D.js → picker-surface-CoNsDWxX.js} +4 -4
- package/dist/{popover-BevReSHi.js → popover-BA1U82Wk.js} +1 -1
- package/dist/{pos-types-BrZBX0Zg.js → pos-types-BQqv-kb6.js} +1 -1
- package/dist/{pos-variant-G12HCSfQ.js → pos-variant-D043n5y8.js} +4 -4
- package/dist/print.js +1 -1
- package/dist/{programmer-variant-WWLwTGRF.js → programmer-variant-jneMqtLs.js} +2 -2
- package/dist/{public-C1a6wQ6o.js → public-DgrbdeZj.js} +9 -9
- package/dist/{rich-code-block-Dh9J-VZ8.js → rich-code-block-CGNjHawR.js} +5 -5
- package/dist/{scientific-variant-BvutlF8a.js → scientific-variant-1L7brNNT.js} +2 -2
- package/dist/{sortable-provider-BrA5tfJX.js → sortable-provider-DZLV_svg.js} +2 -2
- package/dist/{spinner-JnLLiLIO.js → spinner-CQqRWxAW.js} +1 -1
- package/dist/{tabs-dXCZGShv.js → tabs-DQTx3C8e.js} +1 -1
- package/dist/theme-picker.js +2 -2
- package/dist/{theme-toggle-BmcK6mXV.js → theme-toggle-3NQ3VmJH.js} +1 -1
- package/dist/{toolbar-items-B-kMYsDT.js → toolbar-items-BYCdJGUf.js} +4 -4
- package/dist/{translate-material-BmpcP1p1.js → translate-material-jxfcGlD5.js} +1 -1
- package/dist/{translator-CfoXTrZd.js → translator-6XuDmqUJ.js} +18 -2
- package/dist/{use-chat-composer-DFD_eF-r.js → use-chat-composer-1eb4I1kM.js} +32 -31
- package/dist/{use-heading-spy-BcNK1qvq.js → use-heading-spy-CzPujlKr.js} +4 -4
- package/dist/{use-material-translation-DoymV6IP.js → use-material-translation-BUPqNmAg.js} +1 -1
- package/dist/{use-return-focus-CLEnhfka.js → use-return-focus-B_enQxp5.js} +1 -1
- package/docs/README.md +1 -0
- package/docs/components/data-display.md +6 -1
- package/docs/components/data-table-filter-and-lists.md +35 -0
- package/docs/components/form-fields.md +38 -5
- package/docs/components/media-and-files.md +16 -0
- package/docs/components/navigation-and-layout.md +1 -0
- package/docs/components/rich-widgets.md +73 -5
- package/docs/guides/event-calendar.md +163 -0
- package/docs/guides/forms.md +2 -1
- package/docs/guides/i18n.md +2 -0
- package/docs/previews/data-display-eventchip.webp +0 -0
- package/docs/previews/rich-widgets-eventcalendar.webp +0 -0
- package/docs/roadmap.md +12 -0
- package/lib/components/components.css +1 -0
- package/lib/components/ui/widgets/event-calendar/event-calendar-backdrop.css +43 -0
- package/package.json +3 -3
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/** A small label an event carries, drawn after its title. */
|
|
3
|
-
export type EventChipBadge = {
|
|
4
|
-
label: string;
|
|
5
|
-
tone?: Tone;
|
|
6
|
-
};
|
|
1
|
+
import { EventChipBadge } from './event-chip-badges.js';
|
|
7
2
|
type ContentProps = {
|
|
8
3
|
title: string;
|
|
9
4
|
/** The start time alone, shown before the title when compact. */
|
|
@@ -14,7 +9,10 @@ type ContentProps = {
|
|
|
14
9
|
compact: boolean;
|
|
15
10
|
tight: boolean;
|
|
16
11
|
solid: boolean;
|
|
17
|
-
|
|
12
|
+
/** Already merged by `eventChipBadges`. */
|
|
13
|
+
badges?: EventChipBadge[];
|
|
14
|
+
/** The event is cancelled: the title is struck through and "Cancelled" joins its name. */
|
|
15
|
+
cancelled?: boolean;
|
|
18
16
|
};
|
|
19
17
|
/** What a chip says: the title and its time, on one line when `compact`. */
|
|
20
18
|
export declare function EventChipContent(props: ContentProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An event's title: struck through (`<del>`) and followed by a hidden
|
|
3
|
+
* "Cancelled" (the chip's own translated word) when `cancelled`, so the state
|
|
4
|
+
* is spoken and not only drawn.
|
|
5
|
+
*/
|
|
6
|
+
export declare function ChipTitle({ title, cancelled, }: {
|
|
7
|
+
title: string;
|
|
8
|
+
cancelled?: boolean;
|
|
9
|
+
}): import("react").JSX.Element;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
export type EventChipVariant = 'soft' | 'solid' | 'outline';
|
|
2
2
|
/** Each variant's surface; the colour comes from `--event-color`. */
|
|
3
3
|
export declare const EVENT_CHIP_VARIANTS: Record<EventChipVariant, string>;
|
|
4
|
+
/** The classes of the chip's button: its variant, shape, size and, when cancelled, the muted dashed look. */
|
|
5
|
+
export declare function eventChipClass({ variant, color, compact, cancelled, continuesBefore, continuesAfter, }: {
|
|
6
|
+
variant: EventChipVariant;
|
|
7
|
+
color: string;
|
|
8
|
+
compact: boolean;
|
|
9
|
+
cancelled: boolean;
|
|
10
|
+
continuesBefore: boolean;
|
|
11
|
+
continuesAfter: boolean;
|
|
12
|
+
}): string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CSSProperties, MouseEventHandler } from 'react';
|
|
2
|
+
import { Tone } from '../../tones.js';
|
|
2
3
|
import { EventChipVariant } from './event-chip.classes.js';
|
|
3
|
-
import { EventChipBadge } from './event-chip-
|
|
4
|
+
import { EventChipBadge } from './event-chip-badges.js';
|
|
4
5
|
export type { EventChipVariant } from './event-chip.classes.js';
|
|
5
6
|
export type { EventChipBadge };
|
|
6
7
|
export type EventChipProps = {
|
|
@@ -11,6 +12,16 @@ export type EventChipProps = {
|
|
|
11
12
|
endTime?: string;
|
|
12
13
|
/** Any CSS colour. Default: the primary colour. */
|
|
13
14
|
color?: string;
|
|
15
|
+
/**
|
|
16
|
+
* A tone of the library (or one an app declared) the chip is drawn in when
|
|
17
|
+
* it sets no `color`.
|
|
18
|
+
*/
|
|
19
|
+
tone?: Tone;
|
|
20
|
+
/**
|
|
21
|
+
* The event is cancelled: a muted chip with a dashed outline, the title
|
|
22
|
+
* struck through (`<del>`) and "Cancelled" in its accessible name.
|
|
23
|
+
*/
|
|
24
|
+
cancelled?: boolean;
|
|
14
25
|
allDay?: boolean;
|
|
15
26
|
/** One line, the time before the title (a month cell, a short slot). */
|
|
16
27
|
compact?: boolean;
|
|
@@ -20,6 +31,8 @@ export type EventChipProps = {
|
|
|
20
31
|
variant?: EventChipVariant;
|
|
21
32
|
/** A small label (and tone) after the title; hidden but still named where the box is tiny. */
|
|
22
33
|
badge?: EventChipBadge;
|
|
34
|
+
/** Further badges after `badge` (a status, then a priority). */
|
|
35
|
+
badges?: EventChipBadge[];
|
|
23
36
|
selected?: boolean;
|
|
24
37
|
disabled?: boolean;
|
|
25
38
|
continuesBefore?: boolean;
|
|
@@ -34,4 +47,4 @@ export type EventChipProps = {
|
|
|
34
47
|
* is set from script (a CSS custom property), never as inline style in server
|
|
35
48
|
* markup.
|
|
36
49
|
*/
|
|
37
|
-
export declare function EventChip({ title, time, endTime, color, allDay, compact, tight, variant, badge, selected, disabled, continuesBefore, continuesAfter, onClick, className, style, }: EventChipProps): import("react").JSX.Element;
|
|
50
|
+
export declare function EventChip({ title, time, endTime, color: ownColor, tone, cancelled, allDay, compact, tight, variant, badge, badges, selected, disabled, continuesBefore, continuesAfter, onClick, className, style, }: EventChipProps): import("react").JSX.Element;
|
|
@@ -13,4 +13,4 @@ export interface AttributeValuesFormFieldSetProps<T extends Record<string, any>>
|
|
|
13
13
|
/** Keep `label` as the group's accessible name but draw nothing, e.g. under a `FormSection` that already titles it. */
|
|
14
14
|
hideLabel?: boolean;
|
|
15
15
|
}
|
|
16
|
-
export declare function AttributeValuesFormFieldSet<T extends Record<string,
|
|
16
|
+
export declare function AttributeValuesFormFieldSet<T extends Record<string, any>>({ attributes, defaultValues, name, control, label, hideLabel, className, }: AttributeValuesFormFieldSetProps<T>): import("react").JSX.Element;
|
|
@@ -11,7 +11,7 @@ export type ChoiceListControlProps = Pick<ChoiceListFieldProps, 'min' | 'rowLabe
|
|
|
11
11
|
setIds?: (next: ChoiceRow[]) => void;
|
|
12
12
|
t: ReturnType<typeof useMaterialTranslation>['t'];
|
|
13
13
|
label: ReturnType<typeof defaultRowLabel>;
|
|
14
|
-
props: Omit<ChoiceListFieldProps, 'value' | 'onChange' | 'onAssignIds' | 'error' | 'rowErrors' | 'onBlur'>;
|
|
14
|
+
props: Omit<ChoiceListFieldProps, 'value' | 'onChange' | 'onAssignIds' | 'error' | 'rowErrors' | 'rowDetailErrors' | 'onBlur'>;
|
|
15
15
|
};
|
|
16
16
|
/** The list itself, with the group and per-row errors of the field. */
|
|
17
17
|
export declare function ChoiceListControl({ rows, error, focus, setIds, onChange, t, label, min, selection, rowLabel, disabled, props, }: ChoiceListControlProps): import("react").JSX.Element;
|
|
@@ -10,4 +10,4 @@ export type { ChoiceListFieldProps } from './types.js';
|
|
|
10
10
|
* new one, with one call of `onAssignIds` (default: `onChange`) on mount.
|
|
11
11
|
* `ChoiceListFormField` wires it to react-hook-form.
|
|
12
12
|
*/
|
|
13
|
-
export declare function ChoiceListField({ value, onChange, onAssignIds, selection, rowLabel, reorderable, rowErrors, disabled, onBlur, ref, ...props }: ChoiceListFieldProps): import("react").JSX.Element;
|
|
13
|
+
export declare function ChoiceListField({ value, onChange, onAssignIds, selection, rowLabel, reorderable, rowErrors, rowDetail, rowDetailErrors, disabled, onBlur, ref, ...props }: ChoiceListFieldProps): import("react").JSX.Element;
|
|
@@ -10,6 +10,9 @@ export type ArrayError = {
|
|
|
10
10
|
text?: {
|
|
11
11
|
message?: string;
|
|
12
12
|
};
|
|
13
|
+
explanation?: {
|
|
14
|
+
message?: string;
|
|
15
|
+
};
|
|
13
16
|
} | undefined;
|
|
14
17
|
};
|
|
15
18
|
/**
|
|
@@ -43,7 +46,7 @@ export declare function useRefusedFocus(error: () => ArrayError | undefined, bla
|
|
|
43
46
|
};
|
|
44
47
|
/**
|
|
45
48
|
* The handle React Hook Form gets as the `ref` of a row path
|
|
46
|
-
* (`choices.<i>.text`): `setFocus` and `setError(…, { shouldFocus })` on that
|
|
47
|
-
* path call its `focus()`, which goes to the row's text input.
|
|
49
|
+
* (`choices.<i>.text`, or `.explanation`): `setFocus` and `setError(…, { shouldFocus })` on that
|
|
50
|
+
* path call its `focus()`, which goes to the row's text input (the detail textarea for `.explanation`).
|
|
48
51
|
*/
|
|
49
|
-
export declare function rowFocus(list: RefObject<Element | null>, position: number): FocusHandle;
|
|
52
|
+
export declare function rowFocus(list: RefObject<Element | null>, position: number, field?: 'text' | 'explanation'): FocusHandle;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FieldValues, UseControllerProps } from 'react-hook-form';
|
|
2
2
|
import { ChoiceListFieldProps } from './types.js';
|
|
3
|
-
export type ChoiceListFormFieldProps<T extends FieldValues> = Pick<UseControllerProps<T>, 'control' | 'name'> & Omit<ChoiceListFieldProps, 'value' | 'onChange' | 'onAssignIds' | 'error' | 'rowErrors' | 'onBlur'> & {
|
|
3
|
+
export type ChoiceListFormFieldProps<T extends FieldValues> = Pick<UseControllerProps<T>, 'control' | 'name'> & Omit<ChoiceListFieldProps, 'value' | 'onChange' | 'onAssignIds' | 'error' | 'rowErrors' | 'rowDetailErrors' | 'onBlur'> & {
|
|
4
4
|
/**
|
|
5
5
|
* The built-in rules ask for one marked row at least. `false` lets a list
|
|
6
6
|
* with none pass (a poll). Default true.
|
|
@@ -16,4 +16,4 @@ export type ChoiceListFormFieldProps<T extends FieldValues> = Pick<UseController
|
|
|
16
16
|
* way: `choices.2.text` under row 3, `choices` under the list. Ids given on
|
|
17
17
|
* mount do not make the form dirty when a `FormProvider` is above.
|
|
18
18
|
*/
|
|
19
|
-
export declare function ChoiceListFormField<T extends FieldValues>({ control, name, min, selection, requireCorrect, rowLabel, disabled, ...props }: ChoiceListFormFieldProps<T>): import("react").JSX.Element;
|
|
19
|
+
export declare function ChoiceListFormField<T extends FieldValues>({ control, name, min, selection, requireCorrect, rowLabel, disabled, rowDetail, ...props }: ChoiceListFormFieldProps<T>): import("react").JSX.Element;
|
|
@@ -5,6 +5,8 @@ type Translate = ReturnType<typeof useMaterialTranslation>['t'];
|
|
|
5
5
|
export declare const defaultRowLabel: (t: Translate) => string;
|
|
6
6
|
/** A row's text field label: "Answer 2". */
|
|
7
7
|
export declare const textLabel: (label: string, position: number) => string;
|
|
8
|
+
/** A row's detail textarea label: "Explanation 2". */
|
|
9
|
+
export declare const detailLabel: (label: string | undefined, t: Translate, position: number) => string;
|
|
8
10
|
/** The visible word beside the mark. */
|
|
9
11
|
export declare const correctText: (t: Translate) => string;
|
|
10
12
|
/** The mark's accessible name, which starts with its visible word. */
|
|
@@ -12,6 +12,8 @@ export declare function setCorrect(rows: readonly ChoiceRow[], id: string, corre
|
|
|
12
12
|
/** The rows with one more at the end; in `single` it is marked when none is. */
|
|
13
13
|
export declare function addChoice(rows: readonly ChoiceRow[], selection: ChoiceListSelection): ChoiceRow[];
|
|
14
14
|
export declare function setText(rows: readonly ChoiceRow[], id: string, text: string): ChoiceRow[];
|
|
15
|
+
/** Sets a row's detail text, keeping its other fields. */
|
|
16
|
+
export declare function setExplanation(rows: readonly ChoiceRow[], id: string, explanation: string): ChoiceRow[];
|
|
15
17
|
export declare const removeAt: (rows: readonly ChoiceRow[], index: number) => ChoiceRow[];
|
|
16
18
|
export declare function moveRow(rows: readonly ChoiceRow[], from: number, to: number): ChoiceRow[];
|
|
17
19
|
export type ChoiceListIssue = 'too-few' | 'too-many' | 'none-correct' | 'blank';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { ChoiceListSelection, ChoiceRow as Row } from '../types.js';
|
|
2
|
+
import { ChoiceListSelection, ChoiceRowDetail, ChoiceRow as Row } from '../types.js';
|
|
3
3
|
export type ChoiceRowProps = {
|
|
4
4
|
row: Row;
|
|
5
5
|
position: number;
|
|
@@ -7,6 +7,11 @@ export type ChoiceRowProps = {
|
|
|
7
7
|
selection: ChoiceListSelection;
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
error?: ReactNode;
|
|
10
|
+
/** The detail textarea under the row; absent: none. */
|
|
11
|
+
detail?: ChoiceRowDetail & {
|
|
12
|
+
name: string;
|
|
13
|
+
error?: ReactNode;
|
|
14
|
+
};
|
|
10
15
|
names: {
|
|
11
16
|
text: (position: number) => string;
|
|
12
17
|
correctText: string;
|
|
@@ -14,6 +19,7 @@ export type ChoiceRowProps = {
|
|
|
14
19
|
};
|
|
15
20
|
onText: (text: string) => void;
|
|
16
21
|
onCorrect: (correct: boolean) => void;
|
|
22
|
+
onDetail?: (explanation: string) => void;
|
|
17
23
|
};
|
|
18
|
-
/** One row's fields: the answer's text, then its
|
|
19
|
-
export declare function ChoiceListRow({ row, position, radioName, selection, disabled, error, names, onText, onCorrect, }: ChoiceRowProps): import("react").JSX.Element;
|
|
24
|
+
/** One row's fields: the answer's text, its mark, then its detail when asked. */
|
|
25
|
+
export declare function ChoiceListRow({ row, position, radioName, selection, disabled, error, detail, names, onText, onCorrect, onDetail, }: ChoiceRowProps): import("react").JSX.Element;
|
|
@@ -6,6 +6,19 @@ export type ChoiceRow = {
|
|
|
6
6
|
id: string;
|
|
7
7
|
text: string;
|
|
8
8
|
correct: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* A detail about the choice (why it is right or wrong), edited when the
|
|
11
|
+
* list has `rowDetail`. Absent until a user types in it.
|
|
12
|
+
*/
|
|
13
|
+
explanation?: string;
|
|
14
|
+
};
|
|
15
|
+
/** The optional detail textarea under each row (`ChoiceRow.explanation`). */
|
|
16
|
+
export type ChoiceRowDetail = {
|
|
17
|
+
/** The textarea's label, before the row's number. Default "Explanation", translated. */
|
|
18
|
+
label?: string;
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
/** Limits the text and shows a counter. */
|
|
21
|
+
maxLength?: number;
|
|
9
22
|
};
|
|
10
23
|
/**
|
|
11
24
|
* `single` marks one row (radios; marking a row unmarks the others) and
|
|
@@ -35,6 +48,13 @@ export type ChoiceListFieldProps = Omit<ComponentProps<'div'>, 'children' | 'onC
|
|
|
35
48
|
error?: ReactNode;
|
|
36
49
|
/** An error per row, by id: `{ [row.id]: 'Enter the answer' }`. */
|
|
37
50
|
rowErrors?: Readonly<Record<string, ReactNode>>;
|
|
51
|
+
/**
|
|
52
|
+
* Adds a textarea under each row, stored as `ChoiceRow.explanation`
|
|
53
|
+
* (`true` for its defaults). Absent: no detail, rows unchanged.
|
|
54
|
+
*/
|
|
55
|
+
rowDetail?: boolean | ChoiceRowDetail;
|
|
56
|
+
/** An error per row's detail, by id. */
|
|
57
|
+
rowDetailErrors?: Readonly<Record<string, ReactNode>>;
|
|
38
58
|
/**
|
|
39
59
|
* Called when the focus leaves the whole list, for a field used alone;
|
|
40
60
|
* inside a `FieldBlur` the list's root is registered and this is not
|