@nxgt/material 3.68.0 → 3.71.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 +84 -0
- package/README.md +13 -9
- package/dist/{alert-dialog-BhARh_qC.js → alert-dialog-y2pbowVh.js} +1 -1
- package/dist/{async-slice-CHyRU5V3.js → async-slice-CGfWBOaV.js} +1 -1
- package/dist/{button-Du7fJ9i_.js → button-D54Hrjo0.js} +1 -1
- package/dist/charts.js +3 -3
- package/dist/{chip-BVB6UYl-.js → chip-B5MhXBfm.js} +2 -2
- package/dist/{code-editor-D-GBs2yu.js → code-editor-mULs4SL8.js} +5 -5
- package/dist/code-editor.js +5 -5
- package/dist/{code-language-items-xrgq1Am0.js → code-language-items-BWDnqUqn.js} +2 -2
- package/dist/components/ui/collections/server-table/server-table-phone-row.css +6 -0
- package/dist/components/ui/display/code/code-moonlight.css +37 -0
- package/dist/{components-iNCh4A6M.js → components-B_taYVcd.js} +19740 -18682
- package/dist/components.js +28 -28
- package/dist/{dialog-DFY_nsqF.js → dialog-AjCYZ2Vz.js} +4 -4
- package/dist/dnd.js +1 -1
- package/dist/{dropdown-menu-B6Yh4XJu.js → dropdown-menu-LN60hu_3.js} +1 -1
- package/dist/editor.js +673 -673
- package/dist/{empty-state-DGtwE50c.js → empty-state-Bo8G8W8G.js} +2 -2
- package/dist/{field-blur-Br7ij-a1.js → field-blur-Cnd6FfCH.js} +1 -1
- package/dist/{field-blur-context-CucMAZLj.js → field-blur-context-bUFZj8iN.js} +1 -1
- package/dist/{hooks-CYQJkKGc.js → hooks-Dt4PkQiZ.js} +2 -2
- package/dist/hooks.js +3 -3
- package/dist/{hover-card-C2J0GwWf.js → hover-card-QtGnvsnc.js} +1 -1
- package/dist/i18n.js +3 -3
- package/dist/{icon-badge-LzO5K6Wu.js → icon-badge-DLbpCQIm.js} +3 -3
- package/dist/{icon-button-vLJ4YrEW.js → icon-button-C59DqL7L.js} +1 -1
- package/dist/lib/components/ui/actions/fab/fab-dock-inset.d.ts +29 -0
- package/dist/lib/components/ui/actions/fab/fab-dock.d.ts +6 -1
- package/dist/lib/components/ui/collections/data-table/select-checkbox.d.ts +3 -2
- package/dist/lib/components/ui/collections/filter/use-filter-field-config.d.ts +3 -3
- package/dist/lib/components/ui/collections/index.d.ts +1 -0
- package/dist/lib/components/ui/collections/record-actions-menu/index.d.ts +2 -0
- package/dist/lib/components/ui/collections/record-actions-menu/record-actions-dialogs.d.ts +15 -0
- package/dist/lib/components/ui/collections/record-actions-menu/record-actions-menu.d.ts +72 -0
- package/dist/lib/components/ui/collections/record-actions-menu/record-actions-rules.d.ts +68 -0
- package/dist/lib/components/ui/collections/record-actions-menu/record-actions-words.d.ts +52 -0
- package/dist/lib/components/ui/collections/record-actions-menu/use-record-actions.d.ts +51 -0
- package/dist/lib/components/ui/collections/record-actions-menu/use-record-flight.d.ts +16 -0
- package/dist/lib/components/ui/collections/row-menu/row-menu-column.d.ts +4 -0
- package/dist/lib/components/ui/collections/row-menu/row-menu.d.ts +1 -1
- package/dist/lib/components/ui/collections/server-table/partials/server-table-band-classes.d.ts +7 -5
- package/dist/lib/components/ui/collections/server-table/partials/server-table-column-sorting.d.ts +7 -0
- package/dist/lib/components/ui/collections/server-table/types.d.ts +3 -1
- package/dist/lib/components/ui/display/markdown/markdown.d.ts +12 -1
- package/dist/lib/components/ui/display/markdown/markdown.utils.d.ts +2 -0
- package/dist/lib/components/ui/display/markdown/mermaid-csp-scope.d.ts +8 -0
- package/dist/lib/components/ui/display/markdown/mermaid-markup.d.ts +20 -0
- package/dist/lib/components/ui/display/markdown/partials/markdown-code.d.ts +5 -1
- package/dist/lib/components/ui/feedback/confirm-dialog/action-refusal.d.ts +24 -0
- package/dist/lib/components/ui/feedback/confirm-dialog/confirm-alert.d.ts +17 -0
- package/dist/lib/components/ui/feedback/confirm-dialog/confirm-description.d.ts +10 -0
- package/dist/lib/components/ui/feedback/confirm-dialog/confirm-dialog.d.ts +24 -2
- package/dist/lib/components/ui/feedback/confirm-dialog/confirm-refusal.d.ts +7 -0
- package/dist/lib/components/ui/feedback/confirm-dialog/index.d.ts +1 -0
- package/dist/lib/components/ui/feedback/confirm-dialog/use-confirm-action.d.ts +6 -0
- package/dist/lib/components/ui/feedback/index.d.ts +1 -0
- package/dist/lib/components/ui/feedback/stale-notice/index.d.ts +1 -0
- package/dist/lib/components/ui/feedback/stale-notice/stale-notice.d.ts +15 -0
- package/dist/lib/components/ui/fields/contacts/placeholders.d.ts +1 -1
- package/dist/lib/components/ui/fields/country-field/index.d.ts +2 -0
- package/dist/lib/components/ui/fields/country-field/iso-countries.d.ts +2 -0
- package/dist/lib/components/ui/fields/index.d.ts +1 -0
- package/dist/lib/components/ui/fields/phone-field/index.d.ts +1 -1
- package/dist/lib/components/ui/fields/phone-field/parse-phone.d.ts +2 -0
- package/dist/lib/components/ui/fields/phone-field/phone-field.d.ts +8 -1
- package/dist/lib/components/ui/fields/phone-field/phone-form-field.d.ts +8 -1
- package/dist/lib/components/ui/fields/phone-field/use-phone-value.d.ts +2 -1
- package/dist/lib/components/ui/fields/postal-address/utils.d.ts +15 -0
- package/dist/lib/components/ui/fields/quantity-field/index.d.ts +3 -0
- package/dist/lib/components/ui/fields/quantity-field/quantity-field.d.ts +8 -0
- package/dist/lib/components/ui/fields/quantity-field/quantity-form-field.d.ts +8 -0
- package/dist/lib/components/ui/fields/quantity-field/quantity-row.d.ts +13 -0
- package/dist/lib/components/ui/fields/quantity-field/quantity-unit.d.ts +12 -0
- package/dist/lib/components/ui/fields/quantity-field/quantity-value.d.ts +9 -0
- package/dist/lib/components/ui/fields/quantity-field/types.d.ts +45 -0
- package/dist/lib/components/ui/forms/index.d.ts +1 -0
- package/dist/lib/components/ui/forms/use-server-field-errors.d.ts +21 -0
- package/dist/lib/components/ui/layout/index.d.ts +1 -0
- package/dist/lib/components/ui/layout/record-page/index.d.ts +2 -0
- package/dist/lib/components/ui/layout/record-page/record-details.d.ts +40 -0
- package/dist/lib/components/ui/layout/record-page/record-page.d.ts +27 -0
- package/dist/lib/components/ui/media/upload/index.d.ts +1 -0
- package/dist/lib/components/ui/media/upload/network-upload-field/network-upload-field.d.ts +6 -1
- package/dist/lib/components/ui/media/upload/network-upload-field/network-upload-field.errors.d.ts +8 -0
- package/dist/lib/components/ui/media/upload/network-upload-field/network-upload-field.utils.d.ts +2 -7
- package/dist/lib/components/ui/media/upload/network-upload-field/use-start-upload.d.ts +7 -3
- package/dist/lib/components/ui/media/upload/network-upload-field/use-upload-item-handlers.d.ts +2 -1
- package/dist/lib/components/ui/media/upload/s3-upload-field/s3-upload-field.d.ts +2 -5
- package/dist/lib/components/ui/media/upload/s3-upload-field/s3-upload-field.utils.d.ts +26 -1
- package/dist/lib/components/ui/media/upload/upload-error.d.ts +33 -0
- package/dist/lib/components/ui/selection/autocomplete/autocomplete-enter.d.ts +18 -0
- package/dist/lib/components/ui/selection/autocomplete/partials/autocomplete-chip-input.d.ts +2 -1
- package/dist/lib/components/ui/selection/autocomplete/partials/autocomplete-text-input.d.ts +2 -1
- package/dist/lib/components/ui/selection/autocomplete/types.d.ts +3 -1
- package/dist/lib/components/ui/widgets/chat/chat-conversation-item.d.ts +8 -2
- package/dist/lib/components/ui/widgets/chat/chat-markdown.d.ts +4 -0
- package/dist/lib/components/ui/widgets/chat/chat-message-list.d.ts +8 -1
- package/dist/lib/components/ui/widgets/chat/index.d.ts +2 -0
- package/dist/lib/components/ui/widgets/chat/partials/chat-conversation-item-text.d.ts +2 -1
- package/dist/lib/components/ui/widgets/chat/partials/chat-empty-thread.d.ts +2 -0
- package/dist/lib/components/ui/widgets/chat/proposal/chat-action-proposal-parts.d.ts +24 -0
- package/dist/lib/components/ui/widgets/chat/proposal/chat-action-proposal.d.ts +39 -0
- package/dist/lib/components/ui/widgets/chat/proposal/chat-action-proposal.rules.d.ts +17 -0
- package/dist/lib/components/ui/widgets/chat/proposal/chat-tool-activity.d.ts +16 -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-text.d.ts +1 -1
- package/dist/lib/components/ui/widgets/education/questions/question.d.ts +1 -1
- package/dist/lib/components/ui/widgets/education/questions/types.d.ts +10 -0
- package/dist/lib/i18n/resources/en/en.d.ts +49 -0
- package/dist/lib/i18n/resources/en/material.json.d.ts +50 -1
- package/dist/lib/i18n/resources/fr/fr.d.ts +49 -0
- package/dist/lib/i18n/resources/fr/material.json.d.ts +50 -1
- package/dist/lib/i18n/resources/resources.d.ts +98 -0
- package/dist/lib/i18n/translator.d.ts +1 -1
- package/dist/lib/print/output/to-pdf-element.d.ts +6 -0
- package/dist/lib.js +1 -1
- package/dist/main.js +42 -42
- package/dist/map.js +8 -8
- package/dist/material.css +1 -1
- package/dist/pdf-reader.js +1 -1
- package/dist/print.js +135 -131
- package/dist/{public-BHthpdpe.js → public-BSaSCwy7.js} +9 -9
- package/dist/{rich-code-block-DoW7l2ND.js → rich-code-block-BFVj1GWz.js} +5 -5
- package/dist/{sortable-provider-FLNMfr0o.js → sortable-provider-REwyjiOZ.js} +2 -2
- package/dist/{spinner-DCgDw8eq.js → spinner-BFZxqdWC.js} +1 -1
- package/dist/theme-picker.js +2 -2
- package/dist/{theme-toggle-BMDAwMLh.js → theme-toggle-BHi6miz-.js} +1 -1
- package/dist/{toolbar-items-CkPEhQq7.js → toolbar-items-BTtoKVlx.js} +3 -3
- package/dist/{translate-material-DkcuQBNr.js → translate-material-R-uLthBy.js} +1 -1
- package/dist/{translator-DXdVRdMm.js → translator-ClbXOGQO.js} +100 -2
- package/dist/{typography-BNS_IbFI.js → typography-v-PJ4Zco.js} +1 -1
- package/dist/{use-chat-composer-B-tGRLkI.js → use-chat-composer-Rhan4Xv0.js} +2463 -2405
- package/dist/{use-heading-spy-DaqibCCm.js → use-heading-spy-CJnBkCY0.js} +179 -87
- package/dist/{use-material-translation-Bxl8sv1n.js → use-material-translation-CCWUeiEn.js} +1 -1
- package/dist/{use-return-focus-Y_Kx0QlW.js → use-return-focus-Duk40DZI.js} +1 -1
- package/docs/components/buttons-and-actions.md +24 -0
- package/docs/components/data-display.md +33 -0
- package/docs/components/data-table-filter-and-lists.md +117 -5
- package/docs/components/feedback-and-status.md +58 -2
- package/docs/components/form-fields.md +97 -3
- package/docs/components/media-and-files.md +55 -9
- package/docs/components/navigation-and-layout.md +58 -0
- package/docs/components/rich-widgets.md +37 -3
- package/docs/components/selection-and-choice.md +10 -3
- package/docs/guides/cards-and-tiles.md +4 -2
- package/docs/guides/csp.md +44 -6
- package/docs/guides/forms.md +55 -7
- package/docs/guides/i18n.md +6 -5
- package/docs/guides/printing.md +17 -7
- package/docs/previews/data-table-filter-lists-recordactionsmenu.webp +0 -0
- package/docs/previews/feedback-status-stalenotice.webp +0 -0
- package/docs/previews/form-fields-quantityfield.webp +0 -0
- package/docs/previews/media-files-networkuploadfield.webp +0 -0
- package/docs/previews/media-files-s3uploadfield.webp +0 -0
- package/docs/previews/media-files-uploadfield.webp +0 -0
- package/docs/previews/navigation-layout-recordpage.webp +0 -0
- package/docs/previews/rich-widgets-chat-action-proposal.webp +0 -0
- package/docs/roadmap.md +14 -1
- package/docs/troubleshooting.md +58 -11
- package/lib/components/ui/collections/server-table/server-table-phone-row.css +6 -0
- package/lib/components/ui/display/code/code-moonlight.css +37 -0
- package/package.json +2 -2
|
@@ -2,3 +2,18 @@ import { PostalAddressFieldValue } from './models.js';
|
|
|
2
2
|
export declare function isPostalAddressEmpty(data?: PostalAddressFieldValue | null): boolean;
|
|
3
3
|
export declare function postalAddressCountryName(iso?: string | null, language?: string): string;
|
|
4
4
|
export declare function cityLine(data?: PostalAddressFieldValue | null): string;
|
|
5
|
+
export type FormatPostalAddressOptions = {
|
|
6
|
+
/** The language of the country name (default `'en'`). */
|
|
7
|
+
language?: string;
|
|
8
|
+
/** Between the parts (default `', '`). */
|
|
9
|
+
separator?: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* One line for a read view: street, city line, country name. The city line is
|
|
13
|
+
* "74000 Annecy" or, for GB, US, CA, IE, AU, NZ and IN, "London SW1A 2AA";
|
|
14
|
+
* the region follows the city. Empty parts are skipped and the country is
|
|
15
|
+
* named like `postalAddressCountryName`.
|
|
16
|
+
* @example formatPostalAddress({ street: '12 rue du Lac', postalCode: '74000', locality: 'Annecy', country: 'FR' }, { language: 'fr' })
|
|
17
|
+
* // "12 rue du Lac, 74000 Annecy, France"
|
|
18
|
+
*/
|
|
19
|
+
export declare function formatPostalAddress(address?: PostalAddressFieldValue | null, { language, separator }?: FormatPostalAddressOptions): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { QuantityFieldProps } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* One labelled field holding an amount and its unit: a group named by the one
|
|
4
|
+
* label, a NumberField's number (locale decimal, min, max, step, steppers named
|
|
5
|
+
* after the field), a unit picker (or a typed unit), and one message under the
|
|
6
|
+
* pair. The value is `{ value, unit }`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function QuantityField({ label, helperText, className, value, defaultValue, onChange, unitLabel, 'aria-label': ariaLabel, ...props }: QuantityFieldProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UseControllerProps } from 'react-hook-form';
|
|
2
|
+
import { QuantityFieldProps } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* A QuantityField wired to React Hook Form. The field's value is
|
|
5
|
+
* `{ value, unit }`; an error on the whole field, on `<name>.value` or on
|
|
6
|
+
* `<name>.unit` shows as the one message under the pair.
|
|
7
|
+
*/
|
|
8
|
+
export declare function QuantityFormField<T extends Record<string, any>>({ control, name, ...props }: Pick<UseControllerProps<T>, 'control' | 'name'> & Omit<QuantityFieldProps, 'name' | 'value' | 'onChange' | 'onBlur'>): import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { QuantityFieldProps, QuantityValue } from './types.js';
|
|
2
|
+
type QuantityRowProps = Pick<QuantityFieldProps, 'name' | 'id' | 'placeholder' | 'onBlur' | 'min' | 'max' | 'step' | 'hideSteppers' | 'units' | 'allowCustomUnit' | 'unitPlaceholder' | 'disabled' | 'required' | 'error' | 'ref'> & {
|
|
3
|
+
current: QuantityValue;
|
|
4
|
+
change: (next: QuantityValue) => void;
|
|
5
|
+
labelId?: string;
|
|
6
|
+
ariaLabel?: string;
|
|
7
|
+
describedBy?: string;
|
|
8
|
+
unitName: string;
|
|
9
|
+
stepperName?: string;
|
|
10
|
+
};
|
|
11
|
+
/** The pair on one line: the number (NumberControl's row) shrinks, the unit keeps its width. */
|
|
12
|
+
export declare function QuantityRow({ name, current, change, labelId, ariaLabel, describedBy, unitName, stepperName, unitPlaceholder, units, allowCustomUnit, ...props }: QuantityRowProps): import("react").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { QuantityFieldProps } from './types.js';
|
|
2
|
+
type QuantityUnitProps = Pick<QuantityFieldProps, 'units' | 'allowCustomUnit' | 'disabled' | 'required' | 'error'> & {
|
|
3
|
+
unit: string;
|
|
4
|
+
onUnit: (unit: string) => void;
|
|
5
|
+
name?: string;
|
|
6
|
+
label: string;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
describedBy?: string;
|
|
9
|
+
};
|
|
10
|
+
/** A quantity's unit: a picker over `units`, or a text input suggesting them. */
|
|
11
|
+
export declare function QuantityUnitPicker({ units, allowCustomUnit, disabled, required, error, unit, onUnit, name, label, placeholder, describedBy, }: QuantityUnitProps): import("react").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { QuantityValue } from './types.js';
|
|
2
|
+
/** The value of a quantity nobody has filled in. */
|
|
3
|
+
export declare const EMPTY_QUANTITY: QuantityValue;
|
|
4
|
+
/**
|
|
5
|
+
* The one message of a quantity's React Hook Form error: its own, else the
|
|
6
|
+
* number's, else the unit's (a resolver reports `dose.value` and `dose.unit`
|
|
7
|
+
* as children of `dose`).
|
|
8
|
+
*/
|
|
9
|
+
export declare function quantityErrorMessage(error: unknown): string | undefined;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { FocusEventHandler, ReactNode, Ref } from 'react';
|
|
2
|
+
/** What a QuantityField holds: the amount (`null` while empty) and its unit. */
|
|
3
|
+
export type QuantityValue = {
|
|
4
|
+
value: number | null;
|
|
5
|
+
unit: string;
|
|
6
|
+
};
|
|
7
|
+
/** A unit the picker offers: `value` is stored, `label` is shown. */
|
|
8
|
+
export type QuantityUnit = {
|
|
9
|
+
value: string;
|
|
10
|
+
label: string;
|
|
11
|
+
};
|
|
12
|
+
export type QuantityFieldProps = {
|
|
13
|
+
/** The one label of the pair; it names the group. */
|
|
14
|
+
label?: ReactNode;
|
|
15
|
+
/** The one message under the pair; the group, the number and the unit are described by it. */
|
|
16
|
+
helperText?: ReactNode;
|
|
17
|
+
error?: boolean;
|
|
18
|
+
required?: boolean;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
className?: string;
|
|
21
|
+
/** Names the parts `<name>.value` and `<name>.unit` for a native form. */
|
|
22
|
+
name?: string;
|
|
23
|
+
id?: string;
|
|
24
|
+
placeholder?: string;
|
|
25
|
+
value?: QuantityValue;
|
|
26
|
+
defaultValue?: QuantityValue;
|
|
27
|
+
onChange?: (value: QuantityValue) => void;
|
|
28
|
+
/** Fires when the number input loses focus. */
|
|
29
|
+
onBlur?: FocusEventHandler<HTMLInputElement>;
|
|
30
|
+
min?: number;
|
|
31
|
+
max?: number;
|
|
32
|
+
step?: number;
|
|
33
|
+
hideSteppers?: boolean;
|
|
34
|
+
/** The units offered. */
|
|
35
|
+
units?: QuantityUnit[];
|
|
36
|
+
/** The unit is typed; `units` become suggestions. Without it the unit is picked from `units`. */
|
|
37
|
+
allowCustomUnit?: boolean;
|
|
38
|
+
unitPlaceholder?: string;
|
|
39
|
+
/** Names the unit part. Defaults to "<label> unit". */
|
|
40
|
+
unitLabel?: string;
|
|
41
|
+
/** Names the group when `label` is not plain text. */
|
|
42
|
+
'aria-label'?: string;
|
|
43
|
+
/** Reaches the number input (React Hook Form's `field.ref`, `setFocus`). */
|
|
44
|
+
ref?: Ref<HTMLInputElement>;
|
|
45
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FieldValues, UseFormSetError } from 'react-hook-form';
|
|
2
|
+
/**
|
|
3
|
+
* Puts an action's field errors (`{ path: message }`) on the form, each under
|
|
4
|
+
* its field with `type: 'server'`, the first one taking the focus.
|
|
5
|
+
*
|
|
6
|
+
* It runs when the `fieldErrors` object changes: pass the answer's own object
|
|
7
|
+
* (one per answer), and `undefined` while a request runs or when the answer is
|
|
8
|
+
* not a refusal. Entries with an empty message are skipped. A form that resets
|
|
9
|
+
* itself after a submit resets in an effect declared before this call. The
|
|
10
|
+
* keys must be names of the form's fields (filter an API's answer first when
|
|
11
|
+
* it can name others).
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* const form = useFastForm<Values>({ defaultValues }, 'email');
|
|
16
|
+
* useServerFieldErrors(form, actionData?.fieldErrors);
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function useServerFieldErrors<T extends FieldValues>(form: {
|
|
20
|
+
setError: UseFormSetError<T>;
|
|
21
|
+
}, fieldErrors: Partial<Record<string, string>> | undefined): void;
|
|
@@ -10,6 +10,7 @@ export * from './list-details-layout/index.js';
|
|
|
10
10
|
export * from './navigation-rail/index.js';
|
|
11
11
|
export * from './pager/index.js';
|
|
12
12
|
export * from './pane-layout/index.js';
|
|
13
|
+
export * from './record-page/index.js';
|
|
13
14
|
export * from './resizable/index.js';
|
|
14
15
|
export * from './responsive-grid/index.js';
|
|
15
16
|
export * from './section-columns/index.js';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { CardTitleElement } from '../../primitives/card/card.js';
|
|
3
|
+
/** One « label date » segment of the meta line. */
|
|
4
|
+
export type RecordDetailsStamp = {
|
|
5
|
+
/** The words before the date: "Added on", "Updated on". */
|
|
6
|
+
label: string;
|
|
7
|
+
/** The instant: a `Date`, an ISO string or a timestamp. */
|
|
8
|
+
at: Date | string | number;
|
|
9
|
+
};
|
|
10
|
+
export type RecordDetailsProps = {
|
|
11
|
+
/** The card's heading. */
|
|
12
|
+
title?: ReactNode;
|
|
13
|
+
/** The heading level of `title`, `'h2'` by default (under the page's `h1`). */
|
|
14
|
+
titleAs?: CardTitleElement;
|
|
15
|
+
/** Beside the title: a `Badge` or `StatusIndicator`. */
|
|
16
|
+
status?: ReactNode;
|
|
17
|
+
/** « Added on … », the first segment of the meta line. */
|
|
18
|
+
created?: RecordDetailsStamp;
|
|
19
|
+
/** « Updated on … », the second segment. */
|
|
20
|
+
updated?: RecordDetailsStamp;
|
|
21
|
+
/**
|
|
22
|
+
* The IANA zone the dates are written in (`Europe/Paris`), `UTC` by
|
|
23
|
+
* default: no call reads the machine's zone, so a server and a browser
|
|
24
|
+
* print the same.
|
|
25
|
+
*/
|
|
26
|
+
timeZone?: string;
|
|
27
|
+
/** The most columns of the facts when the panel is wide (stacked), 1 to 6. Default 4. */
|
|
28
|
+
maxColumns?: number;
|
|
29
|
+
/** The `Description`s. */
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
className?: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* RecordDetails - the record's facts as one card: a title and a status, the
|
|
35
|
+
* `Description`s in a `DescriptionList` (one column in a side panel, up to
|
|
36
|
+
* `maxColumns` once the panel is stacked and wide) and a muted
|
|
37
|
+
* « Added on … · Updated on … » line under them, the dates written without
|
|
38
|
+
* seconds in `timeZone`. Made for `RecordPage`'s `details`.
|
|
39
|
+
*/
|
|
40
|
+
export declare function RecordDetails({ title, titleAs, status, created, updated, timeZone, maxColumns, children, className, }: RecordDetailsProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ActivityContentProps } from '../app-shell/activity-content.js';
|
|
3
|
+
export type RecordPageProps = Omit<ActivityContentProps, 'aside' | 'asideLabel' | 'asideLabelledBy' | 'asideStack' | 'asideClassName' | 'asideSide'> & {
|
|
4
|
+
/**
|
|
5
|
+
* The record's facts, usually a {@link RecordDetails}: a side panel from
|
|
6
|
+
* `asideFrom` (`xl` by default), sticky under the app bar, and stacked
|
|
7
|
+
* below it. A `complementary` landmark named by `detailsLabel`.
|
|
8
|
+
*/
|
|
9
|
+
details?: ReactNode;
|
|
10
|
+
/** The side panel's accessible name (`aria-label`), such as "Item details". */
|
|
11
|
+
detailsLabel?: string;
|
|
12
|
+
/** The id of the heading inside the details that names the panel. */
|
|
13
|
+
detailsLabelledBy?: string;
|
|
14
|
+
/** Where the details go below `asideFrom`: `'after'` the content (default) or `'before'` it. */
|
|
15
|
+
detailsStack?: 'before' | 'after';
|
|
16
|
+
/** Classes for the side panel itself. */
|
|
17
|
+
detailsClassName?: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* RecordPage - the page of one record: a header card (`header`, or `title`,
|
|
21
|
+
* `subtitle` and `actions`), the content, and the record's facts (`details`,
|
|
22
|
+
* a {@link RecordDetails}) as a side panel from `xl` that stacks after the
|
|
23
|
+
* content, or before it, below. It composes `ActivityContent`, so `width`,
|
|
24
|
+
* `notice`, `inset`, `titleAs` and the others work as there; only the side
|
|
25
|
+
* panel's props are renamed `details*`. A layout: no data, no state.
|
|
26
|
+
*/
|
|
27
|
+
export declare function RecordPage({ details, detailsLabel, detailsLabelledBy, detailsStack, detailsClassName, ...props }: RecordPageProps): import("react").JSX.Element;
|
|
@@ -7,7 +7,12 @@ export type NetworkUploadFieldProps = {
|
|
|
7
7
|
accept?: string;
|
|
8
8
|
maxSize?: number;
|
|
9
9
|
maxFiles?: number;
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Sends the file and resolves with the value to commit. `signal` aborts
|
|
12
|
+
* when the row is removed or the field unmounts: pass it to the request
|
|
13
|
+
* (`fetch`, `putFileWithProgress`) so a cancelled upload never lands.
|
|
14
|
+
*/
|
|
15
|
+
onUpload: (file: File, onProgress?: (percent: number) => void, signal?: AbortSignal) => Promise<string>;
|
|
11
16
|
onRemove?: (value: string) => void | Promise<void>;
|
|
12
17
|
onError?: (file: File, error: unknown) => void;
|
|
13
18
|
/**
|
package/dist/lib/components/ui/media/upload/network-upload-field/network-upload-field.errors.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MaterialLocaleKey } from '../../../../../i18n/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Translates an upload message: `useMaterialTranslation()`'s `t` fits. Without
|
|
4
|
+
* one, the English fallback is formatted.
|
|
5
|
+
*/
|
|
6
|
+
export type UploadMessageTranslate = (key: MaterialLocaleKey, fallback: string, values?: Record<string, string | number>) => string;
|
|
7
|
+
export declare const inEnglish: UploadMessageTranslate;
|
|
8
|
+
export declare function getUploadErrorMessage(error: unknown, t?: UploadMessageTranslate): string;
|
package/dist/lib/components/ui/media/upload/network-upload-field/network-upload-field.utils.d.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/**
|
|
3
|
-
* Translates an upload message: `useMaterialTranslation()`'s `t` fits. Without
|
|
4
|
-
* one, the English fallback is formatted.
|
|
5
|
-
*/
|
|
6
|
-
export type UploadMessageTranslate = (key: MaterialLocaleKey, fallback: string, values?: Record<string, string | number>) => string;
|
|
1
|
+
import { UploadMessageTranslate } from './network-upload-field.errors.js';
|
|
7
2
|
export type FileValidationError = 'accept' | 'max-size' | 'max-files';
|
|
8
3
|
export type ValidateFileOptions = {
|
|
9
4
|
accept?: string;
|
|
@@ -16,7 +11,6 @@ export declare function validateFile(file: File, options: ValidateFileOptions):
|
|
|
16
11
|
export declare function getValidationMessage(error: FileValidationError, options: ValidateFileOptions, t?: UploadMessageTranslate): string;
|
|
17
12
|
export declare function createFileId(): string;
|
|
18
13
|
export declare function filenameFromValue(value: string): string;
|
|
19
|
-
export declare function getUploadErrorMessage(error: unknown, t?: UploadMessageTranslate): string;
|
|
20
14
|
/**
|
|
21
15
|
* Whether a stored value looks like an image, judged by extension.
|
|
22
16
|
*
|
|
@@ -43,3 +37,4 @@ export declare function isDisplayableSrc(value: string): boolean;
|
|
|
43
37
|
* image is enough.
|
|
44
38
|
*/
|
|
45
39
|
export declare function resolvePreviewUrl(value: string, resolveUrl?: (value: string) => string | null | undefined): string | undefined;
|
|
40
|
+
export { getUploadErrorMessage, type UploadMessageTranslate, } from './network-upload-field.errors.js';
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
2
|
import { UploadItemActions } from './network-upload-field.slice.js';
|
|
3
3
|
import { UploadMessageTranslate } from './network-upload-field.utils.js';
|
|
4
|
+
type UploadFn = (file: File, onProgress?: (percent: number) => void, signal?: AbortSignal) => Promise<string>;
|
|
4
5
|
/**
|
|
5
6
|
* Runs `onUpload` for one local item: its progress, then the committed value
|
|
6
|
-
* or the error. An item removed meanwhile (`removedIdsRef`)
|
|
7
|
+
* or the error. An item removed meanwhile (`removedIdsRef`) has its request
|
|
8
|
+
* aborted (`controllersRef`) and is left alone: neither an error nor a value.
|
|
7
9
|
*/
|
|
8
|
-
export declare function useStartUpload({ onUpload, onError, actions, removedIdsRef, commitUploaded, t, }: {
|
|
9
|
-
onUpload:
|
|
10
|
+
export declare function useStartUpload({ onUpload, onError, actions, removedIdsRef, controllersRef, commitUploaded, t, }: {
|
|
11
|
+
onUpload: UploadFn;
|
|
10
12
|
onError?: (file: File, error: unknown) => void;
|
|
11
13
|
actions: UploadItemActions;
|
|
12
14
|
removedIdsRef: RefObject<Set<string>>;
|
|
15
|
+
controllersRef: RefObject<Map<string, AbortController>>;
|
|
13
16
|
commitUploaded: (value: string, file: File, replacesValue?: string) => void;
|
|
14
17
|
t: UploadMessageTranslate;
|
|
15
18
|
}): (uploadId: string, file: File, replacesValue?: string) => void;
|
|
19
|
+
export {};
|
package/dist/lib/components/ui/media/upload/network-upload-field/use-upload-item-handlers.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export type UploadItemHandlerDeps = {
|
|
|
10
10
|
onError?: (file: File, error: unknown) => void;
|
|
11
11
|
actions: UploadItemActions;
|
|
12
12
|
removedIdsRef: RefObject<Set<string>>;
|
|
13
|
+
controllersRef: RefObject<Map<string, AbortController>>;
|
|
13
14
|
startUpload: (uploadId: string, file: File, replacesValue?: string) => void;
|
|
14
15
|
addLocalItem: (file: File, options?: {
|
|
15
16
|
replacesValue?: string;
|
|
@@ -18,7 +19,7 @@ export type UploadItemHandlerDeps = {
|
|
|
18
19
|
t: UploadMessageTranslate;
|
|
19
20
|
};
|
|
20
21
|
/** What a row's Replace, Retry and Remove do, for a local item or a value. */
|
|
21
|
-
export declare function useUploadItemHandlers({ disabled, accept, maxSize, onRemove, onError, actions, removedIdsRef, startUpload, addLocalItem, commitRemove, t, }: UploadItemHandlerDeps): {
|
|
22
|
+
export declare function useUploadItemHandlers({ disabled, accept, maxSize, onRemove, onError, actions, removedIdsRef, controllersRef, startUpload, addLocalItem, commitRemove, t, }: UploadItemHandlerDeps): {
|
|
22
23
|
handleItemReplace: (item: NetworkUploadDisplayItem, file: File) => void;
|
|
23
24
|
handleItemRetry: (item: NetworkUploadDisplayItem) => void;
|
|
24
25
|
handleItemRemove: (item: NetworkUploadDisplayItem) => void;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { DistributiveOmit } from '../../../../../lib/distributive-omit.js';
|
|
2
2
|
import { NetworkUploadFieldProps } from '../network-upload-field/network-upload-field.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
publicUrl: string;
|
|
6
|
-
headers?: Record<string, string>;
|
|
7
|
-
};
|
|
3
|
+
import { PresignedUploadTarget } from './s3-upload-field.utils.js';
|
|
4
|
+
export type { PresignedPostTarget, PresignedPutTarget, PresignedUploadTarget, } from './s3-upload-field.utils.js';
|
|
8
5
|
export type S3UploadFieldProps = DistributiveOmit<NetworkUploadFieldProps, 'onUpload'> & {
|
|
9
6
|
getPresignedUrl: (file: File) => Promise<PresignedUploadTarget>;
|
|
10
7
|
};
|
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
export type PutFileWithProgressOptions = {
|
|
2
2
|
headers?: Record<string, string>;
|
|
3
3
|
onProgress?: (percent: number) => void;
|
|
4
|
+
/** Aborts the request (`xhr.abort()`); the promise then rejects with an `UploadError` of kind `aborted` (named `AbortError`). */
|
|
5
|
+
signal?: AbortSignal;
|
|
4
6
|
};
|
|
5
|
-
|
|
7
|
+
/** A presigned PUT: the file is the request body. */
|
|
8
|
+
export type PresignedPutTarget = {
|
|
9
|
+
method?: 'PUT';
|
|
10
|
+
uploadUrl: string;
|
|
11
|
+
publicUrl: string;
|
|
12
|
+
headers?: Record<string, string>;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* A presigned POST policy: `fields` are sent first, in order, then the file
|
|
16
|
+
* as the last part, named `file`. `value` is what the field stores (the key).
|
|
17
|
+
*/
|
|
18
|
+
export type PresignedPostTarget = {
|
|
19
|
+
method: 'POST';
|
|
20
|
+
url: string;
|
|
21
|
+
fields: Record<string, string>;
|
|
22
|
+
value: string;
|
|
23
|
+
};
|
|
24
|
+
export type PresignedUploadTarget = PresignedPutTarget | PresignedPostTarget;
|
|
25
|
+
/** Fields in insertion order, then the file last: S3 ignores what follows `file`. */
|
|
26
|
+
export declare function buildPostFormData(fields: Record<string, string>, file: File): FormData;
|
|
27
|
+
export declare function putFileWithProgress(url: string, file: File, { headers, onProgress, signal }?: PutFileWithProgressOptions): Promise<void>;
|
|
28
|
+
export declare function postFileWithProgress(url: string, fields: Record<string, string>, file: File, { onProgress, signal, }?: Pick<PutFileWithProgressOptions, 'onProgress' | 'signal'>): Promise<void>;
|
|
29
|
+
/** Sends `file` to a PUT or POST target and resolves with the value to store. */
|
|
30
|
+
export declare function uploadToTarget(target: PresignedUploadTarget, file: File, onProgress?: (percent: number) => void, signal?: AbortSignal): Promise<string>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why a transport-level upload failed. The S3 helpers (`putFileWithProgress`,
|
|
3
|
+
* `postFileWithProgress`, `uploadToTarget`) reject with an `UploadError`, so a
|
|
4
|
+
* field can word the failure in the active language.
|
|
5
|
+
*
|
|
6
|
+
* - `status`: the storage answered a non-2xx `status`; `code` is the S3 error
|
|
7
|
+
* code (`EntityTooLarge`) when the XML body carries one.
|
|
8
|
+
* - `network`: the request never completed (CORS, offline, blocked by CSP).
|
|
9
|
+
* - `aborted`: the request was cancelled through its `AbortSignal`. The error's
|
|
10
|
+
* `name` is `AbortError`.
|
|
11
|
+
*
|
|
12
|
+
* `message` stays English, for logs and for code that reads it. An abort is an
|
|
13
|
+
* `UploadError` named `AbortError`, no longer a `DOMException`: test
|
|
14
|
+
* `error.name === 'AbortError'` or `error.kind === 'aborted'`, not `instanceof
|
|
15
|
+
* DOMException`. Across two copies of the package, use `isUploadError(e)`
|
|
16
|
+
* rather than `instanceof`.
|
|
17
|
+
*/
|
|
18
|
+
export type UploadErrorKind = 'status' | 'network' | 'aborted';
|
|
19
|
+
export declare class UploadError extends Error {
|
|
20
|
+
/** Brand read by `isUploadError`, so a copy from another bundle is recognised. */
|
|
21
|
+
readonly isUploadError = true;
|
|
22
|
+
readonly kind: UploadErrorKind;
|
|
23
|
+
/** The HTTP status, for `kind: 'status'`. */
|
|
24
|
+
readonly status?: number;
|
|
25
|
+
/** The S3 error code, for `kind: 'status'` when the body carried one. */
|
|
26
|
+
readonly code?: string;
|
|
27
|
+
constructor(kind: UploadErrorKind, options?: {
|
|
28
|
+
status?: number;
|
|
29
|
+
code?: string;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/** Structural guard: an `UploadError`, even one made by another copy of the package. */
|
|
33
|
+
export declare function isUploadError(error: unknown): error is UploadError;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { KeyboardEvent } from 'react';
|
|
2
|
+
type Enter = {
|
|
3
|
+
freeSolo?: boolean;
|
|
4
|
+
/** Typed text that matches no option: the "Add" button shows. */
|
|
5
|
+
showAddButton: boolean;
|
|
6
|
+
open: boolean;
|
|
7
|
+
onAdd: () => void;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Enter in the input, as the WAI-ARIA combobox pattern has it: Enter acts on
|
|
11
|
+
* the list, so it never submits the surrounding form while it has something to
|
|
12
|
+
* do. A highlighted option is picked (Base UI), else a `freeSolo` text with no
|
|
13
|
+
* match is added; either way, as with an open list, the default action (the
|
|
14
|
+
* form's implicit submission) is cancelled. Enter on a closed list, or with
|
|
15
|
+
* nothing typed, still submits as a plain input does.
|
|
16
|
+
*/
|
|
17
|
+
export declare function enterHandler({ freeSolo, showAddButton, open, onAdd }: Enter): (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
18
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
|
-
import { AutocompleteOption, AutocompleteProps } from '../types.js';
|
|
2
|
+
import { AutocompleteChipsProps, AutocompleteOption, AutocompleteProps } from '../types.js';
|
|
3
3
|
/** The chips box: a chip for each selected option, then the input. */
|
|
4
4
|
export declare function AutocompleteChipInput<T extends AutocompleteOption>({ id, labelId, helperId, values, getOptionValue, getOptionLabel, ...props }: AutocompleteProps<T> & {
|
|
5
5
|
id: string;
|
|
@@ -8,6 +8,7 @@ export declare function AutocompleteChipInput<T extends AutocompleteOption>({ id
|
|
|
8
8
|
values: string[];
|
|
9
9
|
anchor: RefObject<HTMLDivElement | null>;
|
|
10
10
|
onRemove: (value: string) => void;
|
|
11
|
+
onInputKeyDown?: AutocompleteChipsProps<T>['onInputKeyDown'];
|
|
11
12
|
getOptionValue: (option: T) => string;
|
|
12
13
|
getOptionLabel: (option: T) => string;
|
|
13
14
|
}): import("react").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
|
-
import { AutocompleteOption, AutocompleteProps } from '../types.js';
|
|
2
|
+
import { AutocompleteChipsProps, AutocompleteOption, AutocompleteProps } from '../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* `display="text"`: the single value is the input's own text, in the field
|
|
5
5
|
* box, with the clear button and the chevron at its end. The text is selected
|
|
@@ -12,4 +12,5 @@ export declare function AutocompleteTextInput<T extends AutocompleteOption>({ id
|
|
|
12
12
|
helperId: string;
|
|
13
13
|
/** The option picked, for its avatar before the text. */
|
|
14
14
|
selected: T | null;
|
|
15
|
+
onInputKeyDown?: AutocompleteChipsProps<T>['onInputKeyDown'];
|
|
15
16
|
}): import("react").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FocusEvent, ReactNode, RefObject } from 'react';
|
|
1
|
+
import { FocusEvent, KeyboardEvent, ReactNode, RefObject } from 'react';
|
|
2
2
|
import { InputGroupFieldProps } from '../../fields/input-group-field/input-group-field.js';
|
|
3
3
|
export type AutocompleteOption = {
|
|
4
4
|
value: string;
|
|
@@ -111,6 +111,8 @@ export type AutocompleteChipsProps<T extends AutocompleteOption> = AutocompleteP
|
|
|
111
111
|
selected?: T | null;
|
|
112
112
|
/** Focus left an element of the field (`text` display restores the label). */
|
|
113
113
|
onFieldBlur?: (event: FocusEvent<HTMLElement>) => void;
|
|
114
|
+
/** Enter in the input: picks or adds, and keeps the form from submitting. */
|
|
115
|
+
onInputKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
114
116
|
/** What the field's polite live region says about the list. */
|
|
115
117
|
announcement?: ReactNode;
|
|
116
118
|
/** The list, when it sits in the field's flow (in a dialog). */
|
|
@@ -3,7 +3,13 @@ import { StatusTone } from '../../display/status-indicator/status-indicator.js';
|
|
|
3
3
|
export type ChatConversationItemProps = {
|
|
4
4
|
avatarSrc?: string;
|
|
5
5
|
avatarFallback?: ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* The conversation's name. A string also becomes the `title` attribute of
|
|
8
|
+
* the clipped line, so the full text stays readable on hover.
|
|
9
|
+
*/
|
|
6
10
|
title: ReactNode;
|
|
11
|
+
/** The full text of a clipped `title` that is not a string (a node). */
|
|
12
|
+
titleText?: string;
|
|
7
13
|
preview?: ReactNode;
|
|
8
14
|
timestamp?: ReactNode;
|
|
9
15
|
unreadCount?: number;
|
|
@@ -13,5 +19,5 @@ export type ChatConversationItemProps = {
|
|
|
13
19
|
status?: StatusTone;
|
|
14
20
|
/** Shows a typing line instead of the preview. */
|
|
15
21
|
isTyping?: boolean;
|
|
16
|
-
} & Omit<ComponentProps<'button'>, 'children'>;
|
|
17
|
-
export declare function ChatConversationItem({ avatarSrc, avatarFallback, title, preview, timestamp, unreadCount, isActive, isLoading, status, isTyping, className, ...props }: ChatConversationItemProps): import("react").JSX.Element;
|
|
22
|
+
} & Omit<ComponentProps<'button'>, 'children' | 'title'>;
|
|
23
|
+
export declare function ChatConversationItem({ avatarSrc, avatarFallback, title, titleText, preview, timestamp, unreadCount, isActive, isLoading, status, isTyping, className, ...props }: ChatConversationItemProps): import("react").JSX.Element;
|
|
@@ -2,5 +2,9 @@ import { ComponentProps } from 'react';
|
|
|
2
2
|
export { sanitizeHref } from '../../display/markdown/markdown.utils.js';
|
|
3
3
|
export type ChatMarkdownProps = {
|
|
4
4
|
content: string;
|
|
5
|
+
/** KaTeX maths, default `true`; see `Markdown`. */
|
|
6
|
+
math?: boolean;
|
|
7
|
+
/** Mermaid diagrams, default `true`; see `Markdown`. */
|
|
8
|
+
mermaid?: boolean;
|
|
5
9
|
} & Omit<ComponentProps<'div'>, 'children'>;
|
|
6
10
|
export declare function ChatMarkdown({ content, className, ...props }: ChatMarkdownProps): import("react").JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { ScrollArea } from '../../primitives/scroll-area/scroll-area.js';
|
|
2
3
|
import { ChatDensity, ChatLayout } from './chat-layout-context.js';
|
|
3
4
|
export type ChatMessageListProps = {
|
|
4
5
|
isTyping?: boolean;
|
|
@@ -14,5 +15,11 @@ export type ChatMessageListProps = {
|
|
|
14
15
|
/** `comfortable` (default) or `compact`, for every `ChatMessage` inside. */
|
|
15
16
|
density?: ChatDensity;
|
|
16
17
|
children?: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Attributes for the scrolling element itself. It is a tab stop by default
|
|
20
|
+
* (`tabIndex={0}`), so a keyboard reader can scroll a transcript that holds
|
|
21
|
+
* nothing focusable; pass `tabIndex={-1}` to opt out.
|
|
22
|
+
*/
|
|
23
|
+
viewportProps?: ComponentProps<typeof ScrollArea>['viewportProps'];
|
|
17
24
|
} & Omit<ComponentProps<'div'>, 'children' | 'dir'>;
|
|
18
|
-
export declare function ChatMessageList({ isTyping, typingLabel, typingAvatar, emptyState, scrollToBottomLabel, showScrollToBottom, bottomThreshold, layout, density, children, className, ...props }: ChatMessageListProps): import("react").JSX.Element;
|
|
25
|
+
export declare function ChatMessageList({ isTyping, typingLabel, typingAvatar, emptyState, scrollToBottomLabel, showScrollToBottom, bottomThreshold, layout, density, children, className, viewportProps, ...props }: ChatMessageListProps): import("react").JSX.Element;
|
|
@@ -15,4 +15,6 @@ export * from './chat-typing-indicator.js';
|
|
|
15
15
|
export * from './chat-widget.js';
|
|
16
16
|
export * from './partials/chat-composer-attachment-chip.js';
|
|
17
17
|
export * from './partials/chat-composer-attachments.js';
|
|
18
|
+
export * from './proposal/chat-action-proposal.js';
|
|
19
|
+
export * from './proposal/chat-tool-activity.js';
|
|
18
20
|
export * from './use-chat-composer-attachments.js';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
/** The title, timestamp, preview (or typing line) and unread badge of a conversation row. */
|
|
3
|
-
export declare function ChatConversationItemText({ title, preview, timestamp, unreadCount, isActive, isTyping, }: {
|
|
3
|
+
export declare function ChatConversationItemText({ title, titleText, preview, timestamp, unreadCount, isActive, isTyping, }: {
|
|
4
4
|
title: ReactNode;
|
|
5
|
+
titleText?: string;
|
|
5
6
|
preview?: ReactNode;
|
|
6
7
|
timestamp?: ReactNode;
|
|
7
8
|
unreadCount?: number;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ReactNode, RefObject } from 'react';
|
|
2
|
+
import { ChatActionProposalStatus } from './chat-action-proposal.rules.js';
|
|
3
|
+
export declare function ProposalFailure({ code, message, }: {
|
|
4
|
+
code?: string;
|
|
5
|
+
message?: ReactNode;
|
|
6
|
+
}): import("react").JSX.Element | null;
|
|
7
|
+
export declare function ProposalButtons({ actions, onConfirm, onReject, confirmLabel, rejectLabel, busy, locked, }: {
|
|
8
|
+
actions?: ReactNode;
|
|
9
|
+
onConfirm?: () => void;
|
|
10
|
+
onReject?: () => void;
|
|
11
|
+
confirmLabel?: string;
|
|
12
|
+
rejectLabel?: string;
|
|
13
|
+
busy: boolean;
|
|
14
|
+
locked: boolean;
|
|
15
|
+
}): import("react").JSX.Element;
|
|
16
|
+
export declare function Deadline({ at, status, }: {
|
|
17
|
+
at: Date | string | number;
|
|
18
|
+
status: ChatActionProposalStatus;
|
|
19
|
+
}): import("react").JSX.Element | null;
|
|
20
|
+
export declare function ProposalHeader({ toolLabel, status, statusRef, }: {
|
|
21
|
+
toolLabel?: ReactNode;
|
|
22
|
+
status: ChatActionProposalStatus;
|
|
23
|
+
statusRef: RefObject<HTMLSpanElement | null>;
|
|
24
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { ChatActionProposalStatus } from './chat-action-proposal.rules.js';
|
|
3
|
+
export type { ChatActionProposalStatus };
|
|
4
|
+
export type ChatActionProposalProps = {
|
|
5
|
+
/** What the assistant wants to do, in a few words. */
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
/** The effect in plain words: what will change, and for whom. */
|
|
8
|
+
summary?: ReactNode;
|
|
9
|
+
/** The tool behind the action (a name, a badge, an icon with a name). */
|
|
10
|
+
toolLabel?: ReactNode;
|
|
11
|
+
/** Extra detail under the summary (a list of the records touched). */
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
/** The last moment to answer; written in the active language. */
|
|
14
|
+
deadline?: Date | string | number;
|
|
15
|
+
/** Default `pending`. Only `pending` shows the buttons. */
|
|
16
|
+
status?: ChatActionProposalStatus;
|
|
17
|
+
/** A `failed` proposal: the code the tool returned, shown beside the message. */
|
|
18
|
+
failureCode?: string;
|
|
19
|
+
/** A `failed` proposal: why, in words. */
|
|
20
|
+
failureMessage?: ReactNode;
|
|
21
|
+
/** The confirm button. With neither this nor `actions`, no buttons. */
|
|
22
|
+
onConfirm?: () => void;
|
|
23
|
+
/** The reject button. */
|
|
24
|
+
onReject?: () => void;
|
|
25
|
+
confirmLabel?: string;
|
|
26
|
+
rejectLabel?: string;
|
|
27
|
+
/** An answer is being sent: both buttons are disabled and Confirm shows its spinner. */
|
|
28
|
+
busy?: boolean;
|
|
29
|
+
/** Disables both buttons without the spinner (a read-only viewer). */
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
/** Replaces the two buttons (a split button, a reason dialog's trigger). Shown while `pending` only. */
|
|
32
|
+
actions?: ReactNode;
|
|
33
|
+
} & Omit<ComponentProps<'section'>, 'title' | 'children'>;
|
|
34
|
+
/**
|
|
35
|
+
* A card in a chat thread for an action an assistant proposes and the user
|
|
36
|
+
* confirms or rejects. Once answered, the focus moves to the status line so
|
|
37
|
+
* a screen reader reads the outcome.
|
|
38
|
+
*/
|
|
39
|
+
export declare function ChatActionProposal({ title, summary, toolLabel, children, deadline, status, failureCode, failureMessage, onConfirm, onReject, confirmLabel, rejectLabel, busy, disabled, actions, className, ...props }: ChatActionProposalProps): import("react").JSX.Element;
|