@nxgt/material 3.96.2 → 3.98.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 +32 -0
- package/README.md +2 -2
- package/dist/calculator-field.js +2 -2
- package/dist/{calculator-BVuQG9PG.js → calculator-kdSjeRhf.js} +1 -1
- package/dist/calculator.js +1 -1
- package/dist/{components-B125euHt.js → components-3rMGln0P.js} +11597 -11442
- package/dist/components.js +34 -34
- package/dist/{currency-field-Dj1mBZ9n.js → currency-field-5Zg_sjY1.js} +91 -57
- package/dist/editor.js +1 -1
- package/dist/{financial-variant-DnHWDZ8t.js → financial-variant-DR7pCGqi.js} +2 -2
- package/dist/lib/components/ui/collections/filter/use-filter-field-config.d.ts +1 -0
- package/dist/lib/components/ui/collections/row-menu/use-row-menu-focus.d.ts +4 -2
- package/dist/lib/components/ui/display/event-chip/event-chip-badges.d.ts +2 -1
- package/dist/lib/components/ui/display/event-chip/event-chip-content.d.ts +2 -0
- package/dist/lib/components/ui/display/event-chip/event-chip.d.ts +3 -1
- package/dist/lib/components/ui/fields/currency-field/currency-field.d.ts +9 -1
- package/dist/lib/components/ui/fields/currency-field/use-currency-amount.d.ts +3 -1
- package/dist/lib/components/ui/fields/currency-field/use-minor-units.d.ts +9 -0
- package/dist/lib/components/ui/fields/repeatable-group/partials/repeatable-group-heading.d.ts +12 -0
- package/dist/lib/components/ui/fields/repeatable-group/repeatable-group.d.ts +1 -1
- package/dist/lib/components/ui/fields/repeatable-group/types.d.ts +5 -0
- package/dist/lib/components/ui/fields/repeatable-group/use-repeatable-group-text.d.ts +19 -0
- package/dist/lib/components/ui/fields/textarea-field/textarea-field.d.ts +3 -1
- package/dist/lib/components/ui/media/image-cropper/crop-image.d.ts +15 -2
- package/dist/lib/components/ui/media/image-cropper/image-cropper.d.ts +9 -4
- package/dist/lib/components/ui/media/image-cropper/index.d.ts +3 -2
- package/dist/lib/components/ui/media/image-cropper/types.d.ts +9 -0
- package/dist/lib/components/ui/media/image-cropper/use-apply-crop.d.ts +16 -0
- package/dist/lib/components/ui/media/image-cropper/use-image-cropper.d.ts +5 -5
- package/dist/lib/components/ui/widgets/education/questions/partials/content-lang.d.ts +14 -0
- package/dist/lib/components/ui/widgets/education/questions/partials/question-content.d.ts +1 -1
- package/dist/lib/components/ui/widgets/education/questions/question-props.types.d.ts +87 -0
- package/dist/lib/components/ui/widgets/education/questions/question.d.ts +1 -1
- package/dist/lib/components/ui/widgets/education/questions/types.d.ts +1 -74
- package/dist/lib/components/ui/widgets/event-calendar/partials/calendar-event-chip.d.ts +3 -1
- package/dist/main.js +50 -50
- package/dist/material.css +1 -1
- package/dist/{pdf-MkmivNXn.js → pdf-9BAZhzg9.js} +9777 -7726
- package/dist/pdf-reader.js +1 -1
- package/dist/pdf.worker.min.mjs +5 -5
- package/dist/{percent-field-DT4qNaCH.js → percent-field-D1Y4HUPt.js} +1 -1
- package/dist/{public-BxLp7Qn8.js → public-BuRnxJOK.js} +2 -2
- package/dist/{use-chat-composer-U7jZfdQN.js → use-chat-composer-4cs6opDX.js} +2092 -2085
- package/docs/components/data-display.md +3 -2
- package/docs/components/data-table-filter-and-lists.md +3 -1
- package/docs/components/form-fields.md +6 -2
- package/docs/components/media-and-files.md +40 -2
- package/docs/components/rich-widgets.md +13 -3
- package/docs/guides/csp.md +0 -1
- package/docs/guides/event-calendar.md +7 -2
- package/docs/guides/forms.md +1 -1
- package/docs/guides/i18n.md +1 -1
- package/docs/guides/pdf-reader.md +13 -2
- package/docs/troubleshooting.md +7 -0
- package/package.json +3 -3
|
@@ -7,9 +7,10 @@ export type EventChipBadge = {
|
|
|
7
7
|
/** The `badge` then the further `badges`: the one place that order is made. */
|
|
8
8
|
export declare function eventChipBadges(badge?: EventChipBadge, badges?: EventChipBadge[]): EventChipBadge[];
|
|
9
9
|
/** Every badge as a pill or a tone dot. */
|
|
10
|
-
export declare function ChipBadges({ badges, tight, }: {
|
|
10
|
+
export declare function ChipBadges({ badges, tight, inline, }: {
|
|
11
11
|
badges: EventChipBadge[];
|
|
12
12
|
tight: boolean;
|
|
13
|
+
inline?: boolean;
|
|
13
14
|
}): import("react").JSX.Element;
|
|
14
15
|
/**
|
|
15
16
|
* The badges as a wrapping row of small pills, for a place with room (an
|
|
@@ -8,6 +8,8 @@ type ContentProps = {
|
|
|
8
8
|
allDay: boolean;
|
|
9
9
|
compact: boolean;
|
|
10
10
|
tight: boolean;
|
|
11
|
+
/** The box is too short for title, time and a badge row: the badges join the time's line. */
|
|
12
|
+
short?: boolean;
|
|
11
13
|
solid: boolean;
|
|
12
14
|
/** Already merged by `eventChipBadges`. */
|
|
13
15
|
badges?: EventChipBadge[];
|
|
@@ -27,6 +27,8 @@ export type EventChipProps = {
|
|
|
27
27
|
compact?: boolean;
|
|
28
28
|
/** The box is under 20px: no padding or line gap, the title clips inside it. */
|
|
29
29
|
tight?: boolean;
|
|
30
|
+
/** The box is too short for title, time and a badge row: the badge joins the time's line. */
|
|
31
|
+
short?: boolean;
|
|
30
32
|
/** `soft` (the default): a tint and a bar; `solid`: filled; `outline`: a border. */
|
|
31
33
|
variant?: EventChipVariant;
|
|
32
34
|
/** A small label (and tone) after the title; hidden but still named where the box is tiny. */
|
|
@@ -47,4 +49,4 @@ export type EventChipProps = {
|
|
|
47
49
|
* is set from script (a CSS custom property), never as inline style in server
|
|
48
50
|
* markup.
|
|
49
51
|
*/
|
|
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;
|
|
52
|
+
export declare function EventChip({ title, time, endTime, color: ownColor, tone, cancelled, allDay, compact, tight, short, variant, badge, badges, selected, disabled, continuesBefore, continuesAfter, onClick, className, style, }: EventChipProps): import("react").JSX.Element;
|
|
@@ -17,5 +17,13 @@ export type CurrencyFieldProps = Omit<TextFieldProps, 'type' | 'value' | 'defaul
|
|
|
17
17
|
* (`CalculatorField`'s "Open calculator"). It keeps its own name and focus.
|
|
18
18
|
*/
|
|
19
19
|
trailingAction?: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* `value`, `defaultValue` and `onChange` are whole minor units (cents,
|
|
22
|
+
* centimes, yen) instead of major units: `1999` shows `19.99` in EUR.
|
|
23
|
+
* The decimals are the currency's own (EUR 2, XAF 0, KWD 3), or
|
|
24
|
+
* `fractionDigits` when given, as `formatAmount`'s `minorUnits` option.
|
|
25
|
+
* Off by default.
|
|
26
|
+
*/
|
|
27
|
+
minorUnits?: boolean;
|
|
20
28
|
};
|
|
21
|
-
export declare function CurrencyField({ value, defaultValue, onChange, currency, fractionDigits, trailingAction, className, ...props }: CurrencyFieldProps): import("react").JSX.Element;
|
|
29
|
+
export declare function CurrencyField({ value, defaultValue, onChange, currency, fractionDigits, trailingAction, minorUnits, className, ...props }: CurrencyFieldProps): import("react").JSX.Element;
|
|
@@ -4,12 +4,14 @@ type Options = {
|
|
|
4
4
|
onChange?: (value: number | null) => void;
|
|
5
5
|
currency: string;
|
|
6
6
|
fractionDigits?: number;
|
|
7
|
+
/** `value`, `defaultValue` and `onChange` are whole minor units. */
|
|
8
|
+
minorUnits?: boolean;
|
|
7
9
|
};
|
|
8
10
|
/**
|
|
9
11
|
* The text a currency field shows and the amount it holds, controlled or
|
|
10
12
|
* not: `change` follows typing, `commit` formats the amount on blur.
|
|
11
13
|
*/
|
|
12
|
-
export declare function useCurrencyAmount({ value, defaultValue, onChange, currency, fractionDigits, }: Options): {
|
|
14
|
+
export declare function useCurrencyAmount({ value, defaultValue, onChange, currency, fractionDigits, minorUnits, }: Options): {
|
|
13
15
|
draft: string;
|
|
14
16
|
change: (raw: string) => void;
|
|
15
17
|
commit: (raw: string) => void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two conversions between the amount a currency field holds (major
|
|
3
|
+
* units) and the one its props carry: identity, or whole minor units when
|
|
4
|
+
* `minorUnits` is set.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useMinorUnits(minorUnits: boolean, currency: string, fractionDigits?: number): {
|
|
7
|
+
toMajor: (external: number | null | undefined) => number | null | undefined;
|
|
8
|
+
toExternal: (major: number | null) => number | null;
|
|
9
|
+
};
|
package/dist/lib/components/ui/fields/repeatable-group/partials/repeatable-group-heading.d.ts
CHANGED
|
@@ -6,6 +6,18 @@ export declare function RepeatableGroupLabel({ id, children, }: {
|
|
|
6
6
|
}): import("react").JSX.Element;
|
|
7
7
|
/** An error about the whole group, under the rows; it describes the group. */
|
|
8
8
|
export declare function RepeatableGroupError({ id, children, }: {
|
|
9
|
+
id: string;
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
}): import("react").JSX.Element | null;
|
|
12
|
+
/** Help text under the label; it describes the group. */
|
|
13
|
+
export declare function RepeatableGroupDescription({ id, children, }: {
|
|
9
14
|
id: string;
|
|
10
15
|
children: ReactNode;
|
|
11
16
|
}): import("react").JSX.Element;
|
|
17
|
+
/** The label, then the description under it, each only when given. */
|
|
18
|
+
export declare function RepeatableGroupHeading({ label, labelId, description, descriptionId, }: {
|
|
19
|
+
label?: ReactNode;
|
|
20
|
+
labelId: string;
|
|
21
|
+
description?: ReactNode;
|
|
22
|
+
descriptionId: string;
|
|
23
|
+
}): import("react").JSX.Element;
|
|
@@ -9,4 +9,4 @@ export type { RepeatableGroupProps, RepeatableGroupRowContext, } from './types.j
|
|
|
9
9
|
* politely. For react-hook-form, `RepeatableGroupFormField` wires it to
|
|
10
10
|
* `useFieldArray`.
|
|
11
11
|
*/
|
|
12
|
-
export declare function RepeatableGroup<TItem>({ items, renderRow, getKey, label, rowLabel, addLabel, onAdd, onRemove, onMove, reorderable, min, removeAtMin, max, removable, removeDisabledReason, disabled, error, emptyTitle, emptyDescription, className, ref, ...props }: RepeatableGroupProps<TItem>): import("react").JSX.Element;
|
|
12
|
+
export declare function RepeatableGroup<TItem>({ items, renderRow, getKey, label, description, rowLabel, addLabel, onAdd, onRemove, onMove, reorderable, min, removeAtMin, max, removable, removeDisabledReason, disabled, error, emptyTitle, emptyDescription, className, ref, 'aria-describedby': own, ...props }: RepeatableGroupProps<TItem>): import("react").JSX.Element;
|
|
@@ -19,6 +19,11 @@ export type RepeatableGroupProps<TItem> = Omit<ComponentProps<'div'>, 'children'
|
|
|
19
19
|
getKey?: (item: TItem, index: number) => Key;
|
|
20
20
|
/** The group's label, above the rows; it names the group and the list. */
|
|
21
21
|
label?: ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* Help text under the label, like other fields' help text; the group's
|
|
24
|
+
* `aria-describedby` points at it, so it is announced with the group.
|
|
25
|
+
*/
|
|
26
|
+
description?: ReactNode;
|
|
22
27
|
/**
|
|
23
28
|
* What one row is, lower case: it names the row's buttons ("Remove
|
|
24
29
|
* period 2") and the announcements. Default "row", translated.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The ids of the group's label, description and error, which of the three are
|
|
4
|
+
* given, and the group's `aria-describedby` (the caller's own ids, then the
|
|
5
|
+
* description's and the error's).
|
|
6
|
+
*/
|
|
7
|
+
export declare function useRepeatableGroupText(label: ReactNode, description: ReactNode, error: ReactNode, own?: string): {
|
|
8
|
+
named: boolean;
|
|
9
|
+
failed: boolean;
|
|
10
|
+
errorId: string;
|
|
11
|
+
/** The `RepeatableGroupHeading` props: what is not given stays undefined. */
|
|
12
|
+
heading: {
|
|
13
|
+
label: ReactNode;
|
|
14
|
+
labelId: string;
|
|
15
|
+
description: ReactNode;
|
|
16
|
+
descriptionId: string;
|
|
17
|
+
};
|
|
18
|
+
describedBy: string | undefined;
|
|
19
|
+
};
|
|
@@ -6,5 +6,7 @@ export type TextareaProps = {
|
|
|
6
6
|
minRows?: number;
|
|
7
7
|
maxRows?: number;
|
|
8
8
|
showCount?: boolean;
|
|
9
|
+
/** Sets the theme's monospace font (`--font-mono`) for code-like plain text. */
|
|
10
|
+
monospace?: boolean;
|
|
9
11
|
} & ComponentProps<'textarea'>;
|
|
10
|
-
export declare function TextareaField({ error, helperText, label, className, placeholder, minRows, maxRows, showCount, maxLength, value, defaultValue, onChange, ...props }: TextareaProps): import("react").JSX.Element;
|
|
12
|
+
export declare function TextareaField({ error, helperText, label, className, placeholder, minRows, maxRows, showCount, monospace, maxLength, value, defaultValue, onChange, ...props }: TextareaProps): import("react").JSX.Element;
|
|
@@ -5,9 +5,22 @@ export declare function rotateSize(width: number, height: number, rotation: numb
|
|
|
5
5
|
height: number;
|
|
6
6
|
};
|
|
7
7
|
export declare function createImage(url: string): Promise<HTMLImageElement>;
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* The size to draw a crop at: its longest side capped at `outputSize` px,
|
|
10
|
+
* the ratio kept. Downscale only: a crop already small enough is unchanged.
|
|
11
|
+
*/
|
|
12
|
+
export declare function fitOutputSize(width: number, height: number, outputSize?: number): {
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
};
|
|
16
|
+
export type CropImageOptions = {
|
|
9
17
|
rotation?: number;
|
|
18
|
+
/** Longest side of the file in px. Downscale only. Default: the crop's size. */
|
|
19
|
+
outputSize?: number;
|
|
20
|
+
/** Default `'image/jpeg'`. */
|
|
10
21
|
mimeType?: string;
|
|
22
|
+
/** 0 to 1, for the lossy types. Default `0.92`. */
|
|
11
23
|
quality?: number;
|
|
12
24
|
fileName?: string;
|
|
13
|
-
}
|
|
25
|
+
};
|
|
26
|
+
export declare function cropImageToFile(imageSrc: string, pixelCrop: Area, options?: CropImageOptions): Promise<File>;
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { ButtonVariant } from '../../actions/button/button.js';
|
|
2
|
-
import { ImageCropResult, ImageCropShape } from './types.js';
|
|
3
|
-
export type ImageCropperProps = {
|
|
2
|
+
import { ImageCropOutput, ImageCropResult, ImageCropShape } from './types.js';
|
|
3
|
+
export type ImageCropperProps = ImageCropOutput & {
|
|
4
4
|
src: string;
|
|
5
5
|
aspect?: number;
|
|
6
6
|
cropShape?: ImageCropShape;
|
|
7
7
|
fileName?: string;
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Receives the cropped file. May return a promise (an upload, say): Apply
|
|
10
|
+
* stays busy and Cancel disabled until it settles. A rejection keeps the
|
|
11
|
+
* crop, so the user can apply again; show your own error.
|
|
12
|
+
*/
|
|
13
|
+
onCrop: (result: ImageCropResult) => void | Promise<void>;
|
|
9
14
|
onCancel?: () => void;
|
|
10
15
|
/** The Cancel button's variant. Default `'tonal'`; `'ghost'` restores the earlier look. */
|
|
11
16
|
cancelVariant?: ButtonVariant;
|
|
12
17
|
className?: string;
|
|
13
18
|
};
|
|
14
|
-
export declare function ImageCropper({ src, aspect: aspectProp, cropShape, fileName, onCrop, onCancel, cancelVariant, className, }: ImageCropperProps): import("react").JSX.Element;
|
|
19
|
+
export declare function ImageCropper({ src, aspect: aspectProp, cropShape, fileName, outputSize, mimeType, quality, onCrop, onCancel, cancelVariant, className, }: ImageCropperProps): import("react").JSX.Element;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export type { CropImageOptions } from './crop-image.js';
|
|
2
|
+
export { cropImageToFile, fitOutputSize, getRadianAngle, rotateSize, } from './crop-image.js';
|
|
2
3
|
export type { ImageCropperProps } from './image-cropper.js';
|
|
3
4
|
export { ImageCropper } from './image-cropper.js';
|
|
4
5
|
export type { ImageCropperDialogProps } from './image-cropper-dialog.js';
|
|
5
6
|
export { ImageCropperDialog } from './image-cropper-dialog.js';
|
|
6
|
-
export type { ImageCropAspectId, ImageCropResult, ImageCropShape, } from './types.js';
|
|
7
|
+
export type { ImageCropAspectId, ImageCropOutput, ImageCropResult, ImageCropShape, } from './types.js';
|
|
7
8
|
export { IMAGE_CROP_ASPECTS } from './types.js';
|
|
@@ -4,6 +4,15 @@ export type ImageCropResult = {
|
|
|
4
4
|
file: File;
|
|
5
5
|
area: Area;
|
|
6
6
|
};
|
|
7
|
+
/** What the cropped file is made of, shared by the helper and the cropper. */
|
|
8
|
+
export type ImageCropOutput = {
|
|
9
|
+
/** Longest side of the file in px (512, say). Downscale only. Default: the crop's own size. */
|
|
10
|
+
outputSize?: number;
|
|
11
|
+
/** Default `'image/jpeg'`. */
|
|
12
|
+
mimeType?: string;
|
|
13
|
+
/** 0 to 1, for the lossy types. Default `0.92`. */
|
|
14
|
+
quality?: number;
|
|
15
|
+
};
|
|
7
16
|
export declare const IMAGE_CROP_ASPECTS: readonly [{
|
|
8
17
|
readonly id: "1:1";
|
|
9
18
|
readonly label: "1:1";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Area } from 'react-easy-crop';
|
|
2
|
+
import { ImageCropOutput, ImageCropResult } from './types.js';
|
|
3
|
+
type Options = ImageCropOutput & {
|
|
4
|
+
src: string;
|
|
5
|
+
area: Area | null;
|
|
6
|
+
rotation: number;
|
|
7
|
+
fileName?: string;
|
|
8
|
+
onCrop: (result: ImageCropResult) => void | Promise<void>;
|
|
9
|
+
};
|
|
10
|
+
/** The apply step: crops the image, hands it to `onCrop` and tracks saving. */
|
|
11
|
+
export declare function useApplyCrop({ src, area, rotation, fileName, outputSize, mimeType, quality, onCrop, }: Options): {
|
|
12
|
+
apply: () => Promise<void>;
|
|
13
|
+
isSaving: boolean;
|
|
14
|
+
error: string | null;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
2
|
import { Area, Point } from 'react-easy-crop';
|
|
3
3
|
import { CropSize } from './crop-resize-handles.js';
|
|
4
|
-
import { ImageCropAspectId, ImageCropResult } from './types.js';
|
|
5
|
-
type Options = {
|
|
4
|
+
import { ImageCropAspectId, ImageCropOutput, ImageCropResult } from './types.js';
|
|
5
|
+
type Options = ImageCropOutput & {
|
|
6
6
|
src: string;
|
|
7
7
|
aspect?: number;
|
|
8
8
|
fileName?: string;
|
|
9
|
-
onCrop: (result: ImageCropResult) => void
|
|
9
|
+
onCrop: (result: ImageCropResult) => void | Promise<void>;
|
|
10
10
|
frameRef: RefObject<HTMLDivElement | null>;
|
|
11
11
|
};
|
|
12
|
-
/** The cropper's crop, zoom, rotation and aspect state, and the apply
|
|
13
|
-
export declare function useImageCropper({ src, aspect: aspectProp, fileName, onCrop, frameRef, }: Options): {
|
|
12
|
+
/** The cropper's crop, zoom, rotation and aspect state, and the area to apply. */
|
|
13
|
+
export declare function useImageCropper({ src, aspect: aspectProp, fileName, outputSize, mimeType, quality, onCrop, frameRef, }: Options): {
|
|
14
14
|
crop: Point;
|
|
15
15
|
setCrop: import('react').Dispatch<import('react').SetStateAction<Point>>;
|
|
16
16
|
zoom: number;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export declare const ContentLangProvider: import('react').Provider<string | undefined>;
|
|
3
|
+
export declare function useContentLang(): string | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* Marks a content part (prompt, option, hint, explanation, reference, example)
|
|
6
|
+
* with the question's `contentLang`. Without one it renders its children as
|
|
7
|
+
* they are, so a card with no `contentLang` keeps its markup. The card's own
|
|
8
|
+
* strings never go through it.
|
|
9
|
+
*/
|
|
10
|
+
export declare function ContentLang({ children, block, }: {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
/** A `div` instead of a `span`, for block content. */
|
|
13
|
+
block?: boolean;
|
|
14
|
+
}): import("react").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { QuestionProps } from '../types.js';
|
|
2
2
|
/** A question's fieldset: prompt, header, media, hint, the answer body and the feedback. */
|
|
3
|
-
export declare function QuestionContent({ question, value, onValueChange, revealed: revealedProp, verdict, points, feedback, disabled, readOnly, busy, renderCode, promptId: promptIdProp, variant, density, showShortcuts, number, showFeedback: showFeedbackProp, preview, }: QuestionProps): import("react").JSX.Element;
|
|
3
|
+
export declare function QuestionContent({ question, value, onValueChange, revealed: revealedProp, verdict, points, feedback, disabled, readOnly, busy, renderCode, promptId: promptIdProp, variant, density, showShortcuts, number, showFeedback: showFeedbackProp, preview, contentLang, }: QuestionProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Question, QuestionAnswer, QuestionPoints, QuestionVerdict } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* What `renderCode` gets to draw the code field of a `code` question. The
|
|
5
|
+
* editor must be named by the prompt (`label`, or `aria-labelledby={labelledBy}`)
|
|
6
|
+
* and honour `readOnly` and `disabled`.
|
|
7
|
+
*/
|
|
8
|
+
export type QuestionCodeField = {
|
|
9
|
+
value: string;
|
|
10
|
+
onChange: (value: string) => void;
|
|
11
|
+
/** The prompt's id: name the field with `aria-labelledby`. */
|
|
12
|
+
labelledBy: string;
|
|
13
|
+
/** The id of the `description` line, when there is one: add it to `aria-describedby`. */
|
|
14
|
+
describedBy?: string;
|
|
15
|
+
/** The prompt, as a text label for editors that take one. */
|
|
16
|
+
label: string;
|
|
17
|
+
language?: string;
|
|
18
|
+
maxLength?: number;
|
|
19
|
+
readOnly: boolean;
|
|
20
|
+
disabled: boolean;
|
|
21
|
+
/** The card's `contentLang`, for an editor that takes a `lang` (the starter code's language). */
|
|
22
|
+
lang?: string;
|
|
23
|
+
};
|
|
24
|
+
export type QuestionProps = {
|
|
25
|
+
question: Question;
|
|
26
|
+
value?: QuestionAnswer;
|
|
27
|
+
onValueChange?: (value: QuestionAnswer) => void;
|
|
28
|
+
revealed?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* The id of the prompt (the fieldset's legend text), so a wrapper can use
|
|
31
|
+
* `aria-labelledby`. Default: a generated id. The `description` line is
|
|
32
|
+
* `${promptId}-description`.
|
|
33
|
+
*/
|
|
34
|
+
promptId?: string;
|
|
35
|
+
/**
|
|
36
|
+
* The verdict the server gave, shown as given (no comparison with
|
|
37
|
+
* `question.correct` in the browser). It reveals the card; `pending` is a
|
|
38
|
+
* free answer still waiting for a grader; `unanswered` is a question left
|
|
39
|
+
* blank (no value is shown, the points read 0). `question.correct` may still
|
|
40
|
+
* be passed to highlight the correct choices.
|
|
41
|
+
*/
|
|
42
|
+
verdict?: QuestionVerdict;
|
|
43
|
+
/** Points earned, shown in the verdict banner (needs `verdict`). */
|
|
44
|
+
points?: QuestionPoints;
|
|
45
|
+
/** A grader's remark, shown in the verdict banner (needs `verdict`). */
|
|
46
|
+
feedback?: string;
|
|
47
|
+
disabled?: boolean;
|
|
48
|
+
/** The answer is shown but not editable (already submitted), without the revealed marks. Every kind honours it. */
|
|
49
|
+
readOnly?: boolean;
|
|
50
|
+
/** An answer is being saved: the field is locked like `readOnly` and `aria-busy`. Every kind honours it. */
|
|
51
|
+
busy?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* The code field of a `code` question, e.g. `@nxgt/material/code-editor`'s
|
|
54
|
+
* `CodeEditor` (kept out of this bundle: Monaco is heavy). Without it the
|
|
55
|
+
* field is a monospace textarea.
|
|
56
|
+
*/
|
|
57
|
+
renderCode?: (field: QuestionCodeField) => ReactNode;
|
|
58
|
+
className?: string;
|
|
59
|
+
/** `card` (the default) is framed; `plain` sits inside another surface. */
|
|
60
|
+
variant?: 'card' | 'plain';
|
|
61
|
+
density?: 'comfortable' | 'compact';
|
|
62
|
+
/** Shows a key badge (1, 2, 3…) on each option. */
|
|
63
|
+
showShortcuts?: boolean;
|
|
64
|
+
/** The question's number, shown above the prompt ("Question 2"). */
|
|
65
|
+
number?: number;
|
|
66
|
+
/** The verdict banner once revealed: right or wrong, the correct answer. */
|
|
67
|
+
showFeedback?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* An author's preview: the card is read-only and shows the marks, the
|
|
70
|
+
* `question.correct` answer (the right options marked, the expected text or
|
|
71
|
+
* number filled in) and the `explanation`, with no verdict banner.
|
|
72
|
+
* `verdict` and `showFeedback` are always ignored in a preview; `value` is
|
|
73
|
+
* ignored when the question has a `correct`. An `open` or `code` question
|
|
74
|
+
* has none, so pass its reference answer as `value`. Never used for a
|
|
75
|
+
* learner's attempt.
|
|
76
|
+
*/
|
|
77
|
+
preview?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* The language of the question's content (a BCP 47 tag, `en`): sets `lang`
|
|
80
|
+
* on the prompt, the options, the hints, the explanation, the option
|
|
81
|
+
* explanations, the references and the code examples and starter, so a
|
|
82
|
+
* screen reader announces them in their own language. The card's own
|
|
83
|
+
* strings (buttons, labels, notes) keep the page's language. Default: no
|
|
84
|
+
* `lang`, the content takes the page's.
|
|
85
|
+
*/
|
|
86
|
+
contentLang?: string;
|
|
87
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { QuestionProps } from './types.js';
|
|
2
|
-
export declare function QuestionCard({ question, value, onValueChange, revealed, verdict, points, feedback, disabled, readOnly, busy, renderCode, promptId, className, variant, density, showShortcuts, number, showFeedback, preview, }: QuestionProps): import("react").JSX.Element;
|
|
2
|
+
export declare function QuestionCard({ question, value, onValueChange, revealed, verdict, points, feedback, disabled, readOnly, busy, renderCode, promptId, className, variant, density, showShortcuts, number, showFeedback, preview, contentLang, }: QuestionProps): import("react").JSX.Element;
|
|
@@ -109,77 +109,4 @@ export type Question = {
|
|
|
109
109
|
/** `code`: the language of the code ("python"), given to `renderCode`. */
|
|
110
110
|
language?: string;
|
|
111
111
|
};
|
|
112
|
-
|
|
113
|
-
* What `renderCode` gets to draw the code field of a `code` question. The
|
|
114
|
-
* editor must be named by the prompt (`label`, or `aria-labelledby={labelledBy}`)
|
|
115
|
-
* and honour `readOnly` and `disabled`.
|
|
116
|
-
*/
|
|
117
|
-
export type QuestionCodeField = {
|
|
118
|
-
value: string;
|
|
119
|
-
onChange: (value: string) => void;
|
|
120
|
-
/** The prompt's id: name the field with `aria-labelledby`. */
|
|
121
|
-
labelledBy: string;
|
|
122
|
-
/** The id of the `description` line, when there is one: add it to `aria-describedby`. */
|
|
123
|
-
describedBy?: string;
|
|
124
|
-
/** The prompt, as a text label for editors that take one. */
|
|
125
|
-
label: string;
|
|
126
|
-
language?: string;
|
|
127
|
-
maxLength?: number;
|
|
128
|
-
readOnly: boolean;
|
|
129
|
-
disabled: boolean;
|
|
130
|
-
};
|
|
131
|
-
export type QuestionProps = {
|
|
132
|
-
question: Question;
|
|
133
|
-
value?: QuestionAnswer;
|
|
134
|
-
onValueChange?: (value: QuestionAnswer) => void;
|
|
135
|
-
revealed?: boolean;
|
|
136
|
-
/**
|
|
137
|
-
* The id of the prompt (the fieldset's legend text), so a wrapper can use
|
|
138
|
-
* `aria-labelledby`. Default: a generated id. The `description` line is
|
|
139
|
-
* `${promptId}-description`.
|
|
140
|
-
*/
|
|
141
|
-
promptId?: string;
|
|
142
|
-
/**
|
|
143
|
-
* The verdict the server gave, shown as given (no comparison with
|
|
144
|
-
* `question.correct` in the browser). It reveals the card; `pending` is a
|
|
145
|
-
* free answer still waiting for a grader; `unanswered` is a question left
|
|
146
|
-
* blank (no value is shown, the points read 0). `question.correct` may still
|
|
147
|
-
* be passed to highlight the correct choices.
|
|
148
|
-
*/
|
|
149
|
-
verdict?: QuestionVerdict;
|
|
150
|
-
/** Points earned, shown in the verdict banner (needs `verdict`). */
|
|
151
|
-
points?: QuestionPoints;
|
|
152
|
-
/** A grader's remark, shown in the verdict banner (needs `verdict`). */
|
|
153
|
-
feedback?: string;
|
|
154
|
-
disabled?: boolean;
|
|
155
|
-
/** The answer is shown but not editable (already submitted), without the revealed marks. Every kind honours it. */
|
|
156
|
-
readOnly?: boolean;
|
|
157
|
-
/** An answer is being saved: the field is locked like `readOnly` and `aria-busy`. Every kind honours it. */
|
|
158
|
-
busy?: boolean;
|
|
159
|
-
/**
|
|
160
|
-
* The code field of a `code` question, e.g. `@nxgt/material/code-editor`'s
|
|
161
|
-
* `CodeEditor` (kept out of this bundle: Monaco is heavy). Without it the
|
|
162
|
-
* field is a monospace textarea.
|
|
163
|
-
*/
|
|
164
|
-
renderCode?: (field: QuestionCodeField) => ReactNode;
|
|
165
|
-
className?: string;
|
|
166
|
-
/** `card` (the default) is framed; `plain` sits inside another surface. */
|
|
167
|
-
variant?: 'card' | 'plain';
|
|
168
|
-
density?: 'comfortable' | 'compact';
|
|
169
|
-
/** Shows a key badge (1, 2, 3…) on each option. */
|
|
170
|
-
showShortcuts?: boolean;
|
|
171
|
-
/** The question's number, shown above the prompt ("Question 2"). */
|
|
172
|
-
number?: number;
|
|
173
|
-
/** The verdict banner once revealed: right or wrong, the correct answer. */
|
|
174
|
-
showFeedback?: boolean;
|
|
175
|
-
/**
|
|
176
|
-
* An author's preview: the card is read-only and shows the marks, the
|
|
177
|
-
* `question.correct` answer (the right options marked, the expected text or
|
|
178
|
-
* number filled in) and the `explanation`, with no verdict banner.
|
|
179
|
-
* `verdict` and `showFeedback` are always ignored in a preview; `value` is
|
|
180
|
-
* ignored when the question has a `correct`. An `open` or `code` question
|
|
181
|
-
* has none, so pass its reference answer as `value`. Never used for a
|
|
182
|
-
* learner's attempt.
|
|
183
|
-
*/
|
|
184
|
-
preview?: boolean;
|
|
185
|
-
};
|
|
112
|
+
export type { QuestionCodeField, QuestionProps, } from './question-props.types.js';
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { CalendarEvent } from '../types.js';
|
|
2
|
-
export declare function CalendarEventChip({ event: drawn, compact, tight, className, continuesBefore, continuesAfter, appearance, }: {
|
|
2
|
+
export declare function CalendarEventChip({ event: drawn, compact, tight, short, className, continuesBefore, continuesAfter, appearance, }: {
|
|
3
3
|
event: CalendarEvent;
|
|
4
4
|
compact?: boolean;
|
|
5
5
|
/** The chip's box is under 20px tall (back-to-back short events). */
|
|
6
6
|
tight?: boolean;
|
|
7
|
+
/** The box is under 60px: a badge joins the time's line instead of a row of its own. */
|
|
8
|
+
short?: boolean;
|
|
7
9
|
className?: string;
|
|
8
10
|
continuesBefore?: boolean;
|
|
9
11
|
continuesAfter?: boolean;
|