@nxgt/material 3.34.0 → 3.35.1
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 +34 -0
- package/README.md +4 -4
- package/dist/{async-slice-C9q_eMJD.js → async-slice-BNI_F0jz.js} +2 -2
- package/dist/{button-CoAu_GuF.js → button-EMWOFSDB.js} +1 -1
- package/dist/charts.js +3 -3
- package/dist/{chip-Ch21Qbnj.js → chip-B6m3yagf.js} +1 -1
- package/dist/{code-editor-CEdEmolU.js → code-editor-BdiufnpC.js} +4 -4
- package/dist/code-editor.js +4 -4
- package/dist/{code-language-items-BNMM7YlZ.js → code-language-items-v5Rnq425.js} +2 -2
- package/dist/{components-BM9WHviO.js → components-jh9l5bIA.js} +16962 -14252
- package/dist/components.js +26 -26
- package/dist/{dialog-C_U4twIJ.js → dialog-Cdv9IXVo.js} +1 -1
- package/dist/dnd.js +1 -1
- package/dist/{dropdown-menu-DSgkmogX.js → dropdown-menu-CpSnRXd-.js} +1 -1
- package/dist/editor.js +7 -7
- package/dist/{empty-state-CJZ0sVE8.js → empty-state-DMr94lsF.js} +1 -1
- package/dist/hooks.js +2 -2
- package/dist/{i18n-provider-CLq-1Qgc.js → i18n-provider-A4mI4vc1.js} +1 -1
- package/dist/i18n.js +5 -5
- package/dist/{icon-badge-Dssl4rfn.js → icon-badge-BFScQnp9.js} +1 -1
- package/dist/lib/components/ui/collections/server-table/bulk-action-targets.d.ts +6 -5
- package/dist/lib/components/ui/collections/server-table/bulk-action.d.ts +6 -5
- package/dist/lib/components/ui/collections/server-table/partials/server-table-bulk-buttons.d.ts +6 -5
- package/dist/lib/components/ui/collections/server-table/selected-rows.d.ts +17 -0
- package/dist/lib/components/ui/collections/server-table/use-query-selection.d.ts +6 -1
- package/dist/lib/components/ui/collections/server-table/use-server-table-selection.d.ts +3 -1
- package/dist/lib/components/ui/collections/server-table/use-server-table.d.ts +1 -0
- package/dist/lib/components/ui/dates/picker-trigger/typed-box-compact.d.ts +12 -0
- package/dist/lib/components/ui/dates/picker-trigger/typed-box.d.ts +6 -2
- package/dist/lib/components/ui/dates/picker-trigger/typed-trigger.d.ts +3 -2
- package/dist/lib/components/ui/dates/time-field/index.d.ts +1 -0
- package/dist/lib/components/ui/dates/time-field/partials/time-field-body.d.ts +2 -1
- package/dist/lib/components/ui/dates/time-field/partials/time-field-entry.d.ts +1 -0
- package/dist/lib/components/ui/dates/time-field/partials/time-field-typed.d.ts +2 -2
- package/dist/lib/components/ui/dates/time-field/time-field.d.ts +6 -1
- package/dist/lib/components/ui/dates/time-field/time-string-field.d.ts +14 -0
- package/dist/lib/components/ui/fields/attributes/attribute-dialog.d.ts +3 -1
- package/dist/lib/components/ui/fields/attributes/attribute-form/attribute-form.d.ts +3 -1
- package/dist/lib/components/ui/fields/attributes/attribute-form/attribute-text-form-fields.d.ts +6 -0
- package/dist/lib/components/ui/fields/attributes/attribute-form/consts.d.ts +7 -6
- package/dist/lib/components/ui/fields/attributes/attribute-form/use-attribute-form.d.ts +44 -0
- package/dist/lib/components/ui/fields/attributes/attributes-editor.d.ts +22 -0
- package/dist/lib/components/ui/fields/attributes/attributes-field/attributes-dialog-field.d.ts +14 -0
- package/dist/lib/components/ui/fields/attributes/attributes-field/attributes-field.d.ts +14 -12
- package/dist/lib/components/ui/fields/attributes/attributes-field/attributes-inline-field.d.ts +8 -0
- package/dist/lib/components/ui/fields/attributes/attributes-field/use-dialog-field.d.ts +15 -0
- package/dist/lib/components/ui/fields/attributes/attributes-form-field/attributes-form-field.d.ts +7 -1
- package/dist/lib/components/ui/fields/attributes/attributes-summary.d.ts +22 -0
- package/dist/lib/components/ui/fields/attributes/index.d.ts +3 -0
- package/dist/lib/components/ui/fields/attributes/logic/names.d.ts +13 -0
- package/dist/lib/components/ui/fields/attributes/logic/order.d.ts +15 -0
- package/dist/lib/components/ui/fields/attributes/logic/reorder-keys.d.ts +9 -0
- package/dist/lib/components/ui/fields/attributes/logic/value.d.ts +42 -0
- package/dist/lib/components/ui/fields/attributes/models/attribute.d.ts +5 -1
- package/dist/lib/components/ui/fields/attributes/partials/attribute-row.d.ts +18 -0
- package/dist/lib/components/ui/fields/attributes/partials/default-choices.d.ts +5 -0
- package/dist/lib/components/ui/fields/attributes/partials/default-field.d.ts +12 -0
- package/dist/lib/components/ui/fields/attributes/partials/default-inputs.d.ts +16 -0
- package/dist/lib/components/ui/fields/attributes/partials/editor-notes.d.ts +11 -0
- package/dist/lib/components/ui/fields/attributes/partials/labeled.d.ts +10 -0
- package/dist/lib/components/ui/fields/attributes/partials/name-field.d.ts +15 -0
- package/dist/lib/components/ui/fields/attributes/partials/options-field.d.ts +11 -0
- package/dist/lib/components/ui/fields/attributes/partials/phone-sheet.d.ts +12 -0
- package/dist/lib/components/ui/fields/attributes/partials/reorder-handle.d.ts +19 -0
- package/dist/lib/components/ui/fields/attributes/partials/row-fields.d.ts +16 -0
- package/dist/lib/components/ui/fields/attributes/partials/row-footer.d.ts +12 -0
- package/dist/lib/components/ui/fields/attributes/partials/row-head.d.ts +12 -0
- package/dist/lib/components/ui/fields/attributes/partials/row-panel.d.ts +15 -0
- package/dist/lib/components/ui/fields/attributes/partials/rows-dnd.d.ts +11 -0
- package/dist/lib/components/ui/fields/attributes/partials/simple-fields.d.ts +20 -0
- package/dist/lib/components/ui/fields/attributes/partials/summary-item.d.ts +9 -0
- package/dist/lib/components/ui/fields/attributes/partials/type-icon.d.ts +13 -0
- package/dist/lib/components/ui/fields/attributes/partials/value-text.d.ts +12 -0
- package/dist/lib/components/ui/fields/attributes/schema.d.ts +32 -0
- package/dist/lib/components/ui/fields/attributes/use-announce.d.ts +14 -0
- package/dist/lib/components/ui/fields/attributes/use-attribute-text.d.ts +13 -0
- package/dist/lib/components/ui/fields/attributes/use-attributes-editor.d.ts +34 -0
- package/dist/lib/components/ui/fields/attributes/use-reorder.d.ts +26 -0
- package/dist/lib/components/ui/fields/contacts/contacts-dialog-form-field.d.ts +9 -0
- package/dist/lib/components/ui/fields/contacts/contacts-editor.d.ts +29 -0
- package/dist/lib/components/ui/fields/contacts/contacts-form-field.d.ts +14 -1
- package/dist/lib/components/ui/fields/contacts/contacts-summary.d.ts +23 -0
- package/dist/lib/components/ui/fields/contacts/index.d.ts +3 -0
- package/dist/lib/components/ui/fields/contacts/logic/check-contact.d.ts +11 -0
- package/dist/lib/components/ui/fields/contacts/logic/contact-action.d.ts +11 -0
- package/dist/lib/components/ui/fields/contacts/logic/duplicates.d.ts +17 -0
- package/dist/lib/components/ui/fields/contacts/logic/issues.d.ts +7 -0
- package/dist/lib/components/ui/fields/contacts/logic/primary.d.ts +33 -0
- package/dist/lib/components/ui/fields/contacts/models.d.ts +7 -0
- package/dist/lib/components/ui/fields/contacts/partials/contact-fields.d.ts +29 -0
- package/dist/lib/components/ui/fields/contacts/partials/contact-links.d.ts +15 -0
- package/dist/lib/components/ui/fields/contacts/partials/contact-row.d.ts +14 -0
- package/dist/lib/components/ui/fields/contacts/partials/phone-sheet.d.ts +14 -0
- package/dist/lib/components/ui/fields/contacts/partials/quick-add.d.ts +12 -0
- package/dist/lib/components/ui/fields/contacts/partials/row-actions.d.ts +16 -0
- package/dist/lib/components/ui/fields/contacts/partials/summary-item.d.ts +11 -0
- package/dist/lib/components/ui/fields/contacts/partials/summary-row.d.ts +14 -0
- package/dist/lib/components/ui/fields/contacts/partials/type-group.d.ts +15 -0
- package/dist/lib/components/ui/fields/contacts/partials/type-icon.d.ts +12 -0
- package/dist/lib/components/ui/fields/contacts/partials/value-field.d.ts +25 -0
- package/dist/lib/components/ui/fields/contacts/placeholders.d.ts +2 -0
- package/dist/lib/components/ui/fields/contacts/schema.d.ts +18 -0
- package/dist/lib/components/ui/fields/contacts/use-contact-text.d.ts +9 -0
- package/dist/lib/components/ui/fields/contacts/use-contacts-editor.d.ts +33 -0
- package/dist/lib/components/ui/fields/inline-editor/action-tone.d.ts +2 -0
- package/dist/lib/components/ui/fields/inline-editor/editor-header.d.ts +19 -0
- package/dist/lib/components/ui/fields/inline-editor/editor-sheet.d.ts +20 -0
- package/dist/lib/components/ui/fields/inline-editor/empty-summary.d.ts +19 -0
- package/dist/lib/components/ui/fields/inline-editor/use-focus-request.d.ts +13 -0
- package/dist/lib/components/ui/fields/inline-editor/use-row-ids.d.ts +13 -0
- package/dist/lib/components/ui/fields/opening-hours/consts.d.ts +17 -3
- package/dist/lib/components/ui/fields/opening-hours/index.d.ts +2 -0
- package/dist/lib/components/ui/fields/opening-hours/logic/edit-days.d.ts +9 -0
- package/dist/lib/components/ui/fields/opening-hours/logic/first-day.d.ts +14 -0
- package/dist/lib/components/ui/fields/opening-hours/logic/format.d.ts +6 -0
- package/dist/lib/components/ui/fields/opening-hours/logic/group.d.ts +13 -0
- package/dist/lib/components/ui/fields/opening-hours/logic/range-errors.d.ts +20 -0
- package/dist/lib/components/ui/fields/opening-hours/logic/status.d.ts +19 -0
- package/dist/lib/components/ui/fields/opening-hours/logic/week.d.ts +32 -0
- package/dist/lib/components/ui/fields/opening-hours/logic/zoned.d.ts +10 -0
- package/dist/lib/components/ui/fields/opening-hours/opening-hours-dialog-form-field.d.ts +10 -0
- package/dist/lib/components/ui/fields/opening-hours/opening-hours-editor.d.ts +26 -0
- package/dist/lib/components/ui/fields/opening-hours/opening-hours-form-field.d.ts +17 -1
- package/dist/lib/components/ui/fields/opening-hours/opening-hours-summary.d.ts +32 -0
- package/dist/lib/components/ui/fields/opening-hours/partials/copy-chips.d.ts +12 -0
- package/dist/lib/components/ui/fields/opening-hours/partials/copy-menu.d.ts +10 -0
- package/dist/lib/components/ui/fields/opening-hours/partials/day-controls.d.ts +14 -0
- package/dist/lib/components/ui/fields/opening-hours/partials/day-row.d.ts +15 -0
- package/dist/lib/components/ui/fields/opening-hours/partials/day-summary-row.d.ts +15 -0
- package/dist/lib/components/ui/fields/opening-hours/partials/group-row.d.ts +13 -0
- package/dist/lib/components/ui/fields/opening-hours/partials/phone-sheet.d.ts +18 -0
- package/dist/lib/components/ui/fields/opening-hours/partials/range-field-props.d.ts +28 -0
- package/dist/lib/components/ui/fields/opening-hours/partials/range-row.d.ts +24 -0
- package/dist/lib/components/ui/fields/opening-hours/partials/status-pill.d.ts +13 -0
- package/dist/lib/components/ui/fields/opening-hours/use-first-day.d.ts +8 -0
- package/dist/lib/components/ui/fields/opening-hours/use-hours-editor.d.ts +26 -0
- package/dist/lib/components/ui/fields/opening-hours/use-hours-text.d.ts +8 -0
- package/dist/lib/components/ui/fields/opening-hours/use-now.d.ts +6 -0
- package/dist/lib/i18n/resources/en/en.d.ts +75 -0
- package/dist/lib/i18n/resources/en/material.json.d.ts +86 -11
- package/dist/lib/i18n/resources/fr/fr.d.ts +75 -0
- package/dist/lib/i18n/resources/fr/material.json.d.ts +86 -11
- package/dist/lib/i18n/resources/resources.d.ts +150 -0
- package/dist/lib/i18n/translator.d.ts +1 -1
- package/dist/lib.js +1 -1
- package/dist/main.js +43 -43
- package/dist/map.js +4 -4
- package/dist/material.css +1 -1
- package/dist/pdf-reader.js +1 -1
- package/dist/print.js +2 -2
- package/dist/{public-CX7FN97X.js → public-CYdnlHqA.js} +6 -6
- package/dist/{rich-code-block-cc1NZtbD.js → rich-code-block-Bwhfhu7J.js} +4 -4
- package/dist/{sortable-provider-D43VdFMP.js → sortable-provider-CY_YD3Ee.js} +1 -1
- package/dist/{spinner-wKfFAVU9.js → spinner-CKlDba5I.js} +1 -1
- package/dist/{stored-language-D73ujVW4.js → stored-language-CfQGHLq9.js} +176 -22
- package/dist/theme-picker.js +2 -2
- package/dist/{theme-toggle-Drab-hke.js → theme-toggle--Zcf5AM8.js} +1 -1
- package/dist/{toolbar-items-D7R9YtYx.js → toolbar-items-B1W-uVHS.js} +2 -2
- package/dist/{translate-material-CdpLjkcD.js → translate-material-xDh10aWZ.js} +2 -2
- package/dist/{translator-BE-yEb0p.js → translator-BbOZntEF.js} +1 -1
- package/dist/{use-chat-composer-CpKh8564.js → use-chat-composer-CoyqPKbt.js} +12 -12
- package/dist/{use-heading-spy-DgWhvYfh.js → use-heading-spy-DXYCeegh.js} +1 -1
- package/dist/{use-material-translation-Da9Ponn5.js → use-material-translation-BK2YYCY3.js} +2 -2
- package/docs/components/data-table-filter-and-lists.md +10 -3
- package/docs/components/date-and-time.md +9 -1
- package/docs/components/form-fields.md +298 -67
- package/docs/guides/forms.md +18 -12
- package/docs/guides/i18n.md +1 -1
- package/docs/guides/ssr.md +1 -0
- package/docs/previews/form-fields-contacts.webp +0 -0
- package/docs/previews/form-fields-openinghours.webp +0 -0
- package/package.json +1 -1
|
@@ -6,5 +6,7 @@ export type AttributeDialogProps = {
|
|
|
6
6
|
onSave: (attribute: Attribute) => void;
|
|
7
7
|
onDelete?: () => void;
|
|
8
8
|
disabled?: boolean;
|
|
9
|
+
/** The other attributes' names; the form refuses to save one of them. */
|
|
10
|
+
otherNames?: string[];
|
|
9
11
|
};
|
|
10
|
-
export declare function AttributeDialog({ open, onOpenChange, attribute, onSave, onDelete, disabled, }: AttributeDialogProps): import("react").JSX.Element;
|
|
12
|
+
export declare function AttributeDialog({ open, onOpenChange, attribute, onSave, onDelete, disabled, otherNames, }: AttributeDialogProps): import("react").JSX.Element;
|
|
@@ -5,6 +5,8 @@ type AttributeFormProps = {
|
|
|
5
5
|
defaultValues?: TFormValues | null;
|
|
6
6
|
hideActions?: boolean;
|
|
7
7
|
formId?: string;
|
|
8
|
+
/** The other attributes' names: saving one of them is an inline error on the name. */
|
|
9
|
+
otherNames?: string[];
|
|
8
10
|
} & Omit<ComponentProps<'div'>, 'onSubmit' | 'id'>;
|
|
9
|
-
export declare function AttributeForm({ onSubmit, defaultValues, className, hideActions, formId, ...props }: AttributeFormProps): import("react").JSX.Element;
|
|
11
|
+
export declare function AttributeForm({ onSubmit, defaultValues, className, hideActions, formId, otherNames, ...props }: AttributeFormProps): import("react").JSX.Element;
|
|
10
12
|
export {};
|
package/dist/lib/components/ui/fields/attributes/attribute-form/attribute-text-form-fields.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Control } from 'react-hook-form';
|
|
2
|
+
import { TFormValues } from './types.js';
|
|
3
|
+
/** The name, label, unit, priority and description fields of the attribute form. */
|
|
4
|
+
export declare function AttributeTextFields({ control, }: {
|
|
5
|
+
control: Control<TFormValues>;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as z } from 'zod';
|
|
2
2
|
import { MaterialLocaleKey } from '../../../../../i18n/types.js';
|
|
3
3
|
import { TFormValues } from './types.js';
|
|
4
|
-
export declare const ATTRIBUTE_TYPES: readonly ["COLOR", "DATE", "DATETIME", "MULTI_SELECT", "NUMBER", "RICH_TEXT", "SELECT", "STRING", "TEXT", "TIME"];
|
|
4
|
+
export declare const ATTRIBUTE_TYPES: readonly ["BOOLEAN", "COLOR", "DATE", "DATETIME", "MULTI_SELECT", "NUMBER", "RICH_TEXT", "SELECT", "STRING", "TEXT", "TIME"];
|
|
5
5
|
/**
|
|
6
6
|
* The attribute form's schema, built on the first call (inside `AttributeForm`'s
|
|
7
7
|
* render), never when the module loads: see `openingHoursSchema`.
|
|
@@ -14,16 +14,17 @@ export declare const attributeFormSchema: () => z.ZodObject<{
|
|
|
14
14
|
name: z.ZodString;
|
|
15
15
|
options: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
16
16
|
type: z.ZodEnum<{
|
|
17
|
-
|
|
18
|
-
TEXT: "TEXT";
|
|
17
|
+
BOOLEAN: "BOOLEAN";
|
|
19
18
|
COLOR: "COLOR";
|
|
20
|
-
NUMBER: "NUMBER";
|
|
21
19
|
DATE: "DATE";
|
|
22
20
|
DATETIME: "DATETIME";
|
|
23
|
-
TIME: "TIME";
|
|
24
|
-
SELECT: "SELECT";
|
|
25
21
|
MULTI_SELECT: "MULTI_SELECT";
|
|
22
|
+
NUMBER: "NUMBER";
|
|
26
23
|
RICH_TEXT: "RICH_TEXT";
|
|
24
|
+
SELECT: "SELECT";
|
|
25
|
+
STRING: "STRING";
|
|
26
|
+
TEXT: "TEXT";
|
|
27
|
+
TIME: "TIME";
|
|
27
28
|
}>;
|
|
28
29
|
unit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
29
30
|
}, z.core.$strip>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { TFormValues } from './types.js';
|
|
2
|
+
type Options = {
|
|
3
|
+
defaultValues?: TFormValues | null;
|
|
4
|
+
otherNames?: string[];
|
|
5
|
+
onSubmit: (values: TFormValues) => void;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* The attribute form's state: the form with its schema, the reset of the
|
|
9
|
+
* default value and the options when the type changes, a multi-select default
|
|
10
|
+
* kept to the options, and a submit that refuses a name another attribute has.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useAttributeForm({ defaultValues, otherNames, onSubmit, }: Options): {
|
|
13
|
+
control: import('react-hook-form').Control<{
|
|
14
|
+
label: string;
|
|
15
|
+
name: string;
|
|
16
|
+
type: "BOOLEAN" | "COLOR" | "DATE" | "DATETIME" | "MULTI_SELECT" | "NUMBER" | "RICH_TEXT" | "SELECT" | "STRING" | "TEXT" | "TIME";
|
|
17
|
+
defaultValue?: any;
|
|
18
|
+
description?: string | null | undefined;
|
|
19
|
+
priority?: number | null | undefined;
|
|
20
|
+
options?: string[] | null | undefined;
|
|
21
|
+
unit?: string | null | undefined;
|
|
22
|
+
}, any, {
|
|
23
|
+
label: string;
|
|
24
|
+
name: string;
|
|
25
|
+
type: "BOOLEAN" | "COLOR" | "DATE" | "DATETIME" | "MULTI_SELECT" | "NUMBER" | "RICH_TEXT" | "SELECT" | "STRING" | "TEXT" | "TIME";
|
|
26
|
+
defaultValue?: any;
|
|
27
|
+
description?: string | null | undefined;
|
|
28
|
+
priority?: number | null | undefined;
|
|
29
|
+
options?: string[] | null | undefined;
|
|
30
|
+
unit?: string | null | undefined;
|
|
31
|
+
}>;
|
|
32
|
+
values: {
|
|
33
|
+
label?: string | undefined;
|
|
34
|
+
name?: string | undefined;
|
|
35
|
+
type?: "BOOLEAN" | "COLOR" | "DATE" | "DATETIME" | "MULTI_SELECT" | "NUMBER" | "RICH_TEXT" | "SELECT" | "STRING" | "TEXT" | "TIME" | undefined;
|
|
36
|
+
defaultValue?: any;
|
|
37
|
+
description?: string | null | undefined;
|
|
38
|
+
priority?: number | null | undefined;
|
|
39
|
+
options?: string[] | null | undefined;
|
|
40
|
+
unit?: string | null | undefined;
|
|
41
|
+
};
|
|
42
|
+
submit: (e?: React.BaseSyntheticEvent) => Promise<void | undefined>;
|
|
43
|
+
};
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { HeadingLevel } from '../inline-editor/editor-header.js';
|
|
3
|
+
import { Attribute } from './models/attribute.js';
|
|
4
|
+
export type AttributesEditorProps = {
|
|
5
|
+
value?: Attribute[];
|
|
6
|
+
onValueChange?: (value: Attribute[]) => void;
|
|
7
|
+
/** The heading; "Attributes" by default. */
|
|
8
|
+
label?: ReactNode;
|
|
9
|
+
/** The heading's level; `3` by default. */
|
|
10
|
+
headingLevel?: HeadingLevel;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
className?: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Attributes edited in place: one row each, with its type's icon, its name,
|
|
16
|
+
* type, unit and default value; a row opens to its fields (below 640px, to a
|
|
17
|
+
* bottom sheet with the same fields). Rows are reordered by dragging the grip,
|
|
18
|
+
* or by Space, the arrows and Space again, which sets every `priority`. A
|
|
19
|
+
* name another attribute has is a `role="alert"` under it. It holds the value
|
|
20
|
+
* model of `AttributesField`; nothing is toasted.
|
|
21
|
+
*/
|
|
22
|
+
export declare function AttributesEditor({ value, onValueChange, label, headingLevel, disabled, className, }: AttributesEditorProps): import("react").JSX.Element;
|
package/dist/lib/components/ui/fields/attributes/attributes-field/attributes-dialog-field.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { Attribute } from '../models/attribute.js';
|
|
3
|
+
export type AttributesDialogFieldProps = {
|
|
4
|
+
attributes?: Attribute[];
|
|
5
|
+
onChange?: (values: Attribute[]) => void;
|
|
6
|
+
readonly?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
label: ReactNode;
|
|
9
|
+
/** Shows `helperText` as an error. */
|
|
10
|
+
error?: boolean;
|
|
11
|
+
helperText?: ReactNode;
|
|
12
|
+
} & ComponentProps<'div'>;
|
|
13
|
+
/** The attributes as a list, and one dialog that edits one of them at a time. */
|
|
14
|
+
export declare function AttributesDialogField({ attributes, onChange, readonly, disabled, label, error, helperText, className, ...props }: AttributesDialogFieldProps): import("react").JSX.Element;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { AttributesDialogFieldProps } from './attributes-dialog-field.js';
|
|
2
|
+
export type AttributesFieldProps = AttributesDialogFieldProps & {
|
|
3
|
+
/**
|
|
4
|
+
* `'inline'` (the default) edits the attributes in place
|
|
5
|
+
* (`AttributesEditor`); `'dialog'` keeps the list and the dialog that
|
|
6
|
+
* edits one attribute at a time. `readonly` is always the list.
|
|
7
|
+
*/
|
|
8
|
+
editing?: 'inline' | 'dialog';
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* A field for typed custom attributes (`Attribute[]`). Inline by default;
|
|
12
|
+
* `editing="dialog"` is the earlier list and dialog.
|
|
13
|
+
*/
|
|
14
|
+
export declare function AttributesField({ editing, ...props }: AttributesFieldProps): import("react").JSX.Element;
|
package/dist/lib/components/ui/fields/attributes/attributes-field/attributes-inline-field.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AttributesDialogFieldProps } from './attributes-dialog-field.js';
|
|
2
|
+
/**
|
|
3
|
+
* The attributes edited in place (`AttributesEditor`), as a field: it keeps
|
|
4
|
+
* its list, calls `onChange` with each edit and follows `attributes` when it
|
|
5
|
+
* changes from outside (a form `reset`), without echoing it back. A new array
|
|
6
|
+
* with the same content is not a change.
|
|
7
|
+
*/
|
|
8
|
+
export declare function AttributesInlineField({ attributes, onChange, disabled, label, error, helperText, className, readonly: _readonly, ...props }: AttributesDialogFieldProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Attribute } from '../models/attribute.js';
|
|
2
|
+
/** The reducer behind `AttributesDialogField`, synced with `attributes` and `onChange`. */
|
|
3
|
+
export declare function useDialogFieldState(attributes: Attribute[] | undefined, onChange: ((values: Attribute[]) => void) | undefined): {
|
|
4
|
+
state: {
|
|
5
|
+
attributes: Attribute[];
|
|
6
|
+
editing: boolean;
|
|
7
|
+
selected?: Attribute | null;
|
|
8
|
+
result?: {
|
|
9
|
+
message: import('../../../../../i18n/index.js').MaterialLocaleKey;
|
|
10
|
+
fallback: string;
|
|
11
|
+
context?: import('../../../../../i18n/index.js').TranslationContext;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
dispatch: import('react').ActionDispatch<[action: import('redux').UnknownAction]>;
|
|
15
|
+
};
|
package/dist/lib/components/ui/fields/attributes/attributes-form-field/attributes-form-field.d.ts
CHANGED
|
@@ -4,10 +4,16 @@ import { Attribute } from '../models/attribute.js';
|
|
|
4
4
|
export type AttributesFormFieldProps<T extends Record<string, any>> = {
|
|
5
5
|
value?: Attribute[];
|
|
6
6
|
readonly?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* `'inline'` (the default) edits the attributes in place; `'dialog'` keeps
|
|
10
|
+
* the list and the dialog that edits one attribute at a time.
|
|
11
|
+
*/
|
|
12
|
+
editing?: 'inline' | 'dialog';
|
|
7
13
|
name: Path<T>;
|
|
8
14
|
control: Control<T>;
|
|
9
15
|
label: ReactNode;
|
|
10
16
|
/** Shown when the field has no error. */
|
|
11
17
|
helperText?: ReactNode;
|
|
12
18
|
} & ComponentProps<'div'>;
|
|
13
|
-
export declare function AttributesFormField<T extends Record<string, any>>({ name, readonly, value, control, label, helperText, ...props }: AttributesFormFieldProps<T>): import("react").JSX.Element;
|
|
19
|
+
export declare function AttributesFormField<T extends Record<string, any>>({ name, readonly, value, control, label, helperText, disabled, ...props }: AttributesFormFieldProps<T>): import("react").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Attribute } from './models/attribute.js';
|
|
3
|
+
export type AttributesSummaryProps = {
|
|
4
|
+
/** The attributes, in the value model of `AttributesField`. */
|
|
5
|
+
data?: Attribute[] | null;
|
|
6
|
+
/** Names the region; "Attributes" by default. */
|
|
7
|
+
label?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
/**
|
|
10
|
+
* What shows when there is nothing to list. A quiet "No attributes" by default; your
|
|
11
|
+
* node replaces it, and `null` renders nothing.
|
|
12
|
+
*/
|
|
13
|
+
empty?: ReactNode;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The read-only counterpart of `AttributesEditor`: a description list of the
|
|
17
|
+
* attributes by `priority`, each with its type icon, its label and its
|
|
18
|
+
* default value (a Yes or No, a colour swatch, a number with its unit).
|
|
19
|
+
* With nothing to list it shows a quiet "No attributes" (see `empty`;
|
|
20
|
+
* `empty={null}` renders nothing).
|
|
21
|
+
*/
|
|
22
|
+
export declare function AttributesSummary({ data, label, className, empty, }: AttributesSummaryProps): import("react").JSX.Element;
|
|
@@ -2,8 +2,11 @@ export * from './attribute-dialog.js';
|
|
|
2
2
|
export * from './attribute-form/index.js';
|
|
3
3
|
export * from './attribute-values-form/index.js';
|
|
4
4
|
export * from './attribute-values-form-field-set/index.js';
|
|
5
|
+
export * from './attributes-editor.js';
|
|
5
6
|
export * from './attributes-field/index.js';
|
|
6
7
|
export * from './attributes-form-field/index.js';
|
|
7
8
|
export * from './attributes-list/index.js';
|
|
9
|
+
export * from './attributes-summary.js';
|
|
8
10
|
export * from './models/index.js';
|
|
11
|
+
export * from './schema.js';
|
|
9
12
|
export * from './utils.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Attribute } from '../models/attribute.js';
|
|
2
|
+
export type NameIssue = 'empty' | 'duplicate';
|
|
3
|
+
/** The other attributes' names: what a name may not repeat. */
|
|
4
|
+
export declare function otherNames(items: readonly Attribute[], index: number): string[];
|
|
5
|
+
/** The first problem with the name of `items[index]`, or `null`. */
|
|
6
|
+
export declare function nameIssue(items: readonly Attribute[], index: number): NameIssue | null;
|
|
7
|
+
/**
|
|
8
|
+
* How many name problems there are to fix: each empty name, and each name
|
|
9
|
+
* several attributes share counts once (one fix settles it).
|
|
10
|
+
*/
|
|
11
|
+
export declare function nameIssues(items: readonly Attribute[]): number;
|
|
12
|
+
/** `base`, or `base_2`, `base_3`… the first one no attribute uses. */
|
|
13
|
+
export declare function uniqueName(items: readonly Attribute[], base: string): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Attribute } from '../models/attribute.js';
|
|
2
|
+
/**
|
|
3
|
+
* The attributes' indices in display order: by `priority`, lowest first, an
|
|
4
|
+
* attribute without one after the others, ties kept in list order.
|
|
5
|
+
*/
|
|
6
|
+
export declare function orderedIndices(items: readonly Attribute[]): number[];
|
|
7
|
+
/** `order` with the entry at `from` moved to `to` (a copy). */
|
|
8
|
+
export declare function moveEntry(order: readonly number[], from: number, to: number): number[];
|
|
9
|
+
/**
|
|
10
|
+
* The list laid out in `order`, each attribute given the `priority` of its
|
|
11
|
+
* place (1 first): what a drag or a keyboard move writes.
|
|
12
|
+
*/
|
|
13
|
+
export declare function applyOrder(items: readonly Attribute[], order: readonly number[]): Attribute[];
|
|
14
|
+
/** The priority a new attribute gets so it comes last, ranked or not. */
|
|
15
|
+
export declare function nextPriority(items: readonly Attribute[]): number;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type ReorderCommand = 'lift' | 'up' | 'down' | 'drop' | 'cancel';
|
|
2
|
+
/**
|
|
3
|
+
* What a key does on a row's handle. At rest, Space or Enter lifts the row.
|
|
4
|
+
* Lifted, the arrows move it, Space or Enter drops it, Escape puts it back
|
|
5
|
+
* and Tab drops it as the focus leaves. Anything else is not the handle's.
|
|
6
|
+
*/
|
|
7
|
+
export declare function reorderCommand(key: string, lifted: boolean): ReorderCommand | null;
|
|
8
|
+
/** The place after one step, kept inside the list; the same place at an edge. */
|
|
9
|
+
export declare function stepPlace(place: number, command: 'up' | 'down', count: number): number;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Attribute, AttributeType } from '../models/attribute.js';
|
|
2
|
+
/**
|
|
3
|
+
* A stored date as a `Date`: a `Date`, an ISO string, or a bare `yyyy-MM-dd`
|
|
4
|
+
* (read as that local day, never shifted by the time zone) or an `HH:mm`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function toDateValue(value: unknown): Date | undefined;
|
|
7
|
+
/** What the inline editor stores for a picked date: `yyyy-MM-dd`, or an ISO instant. */
|
|
8
|
+
export declare function fromDateValue(type: AttributeType, date?: Date): string | null;
|
|
9
|
+
/** `true`, `false`, or `null` while unset (also reads `'true'` and `'false'`). */
|
|
10
|
+
export declare function toBooleanValue(value: unknown): boolean | null;
|
|
11
|
+
/** A stored time as `HH:mm`, or `''` (a `Date` or an ISO string is read too). */
|
|
12
|
+
export declare function toClockValue(value: unknown): string;
|
|
13
|
+
/** The default value a type starts with when the type changes. */
|
|
14
|
+
export declare function emptyDefault(type: AttributeType): never[] | null;
|
|
15
|
+
/** True for the types whose value is one of the attribute's `options`. */
|
|
16
|
+
export declare function hasOptions(type: AttributeType): type is "MULTI_SELECT" | "SELECT";
|
|
17
|
+
/** How a stored instant is shown: in the viewer's zone and locale, or the same everywhere. */
|
|
18
|
+
export type TextView = {
|
|
19
|
+
/** `false` (the default) is the server's view: an instant in UTC, as ISO text. */
|
|
20
|
+
local?: boolean;
|
|
21
|
+
/** The locale of an instant once it is shown `local`. */
|
|
22
|
+
locale?: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* The default value as the plain text a row shows, or `null` when there is
|
|
26
|
+
* none. A bare day or clock reads the same everywhere; an instant is shown
|
|
27
|
+
* per `view` (see {@link TextView}).
|
|
28
|
+
*/
|
|
29
|
+
export declare function defaultText(attribute: Attribute, view?: TextView): string | null;
|
|
30
|
+
/**
|
|
31
|
+
* The default value once the options are `options`: a choice no longer
|
|
32
|
+
* offered is dropped (`null`, or left out of a list).
|
|
33
|
+
*/
|
|
34
|
+
export declare function pruneDefault(type: AttributeType, value: unknown, options: string[]): unknown;
|
|
35
|
+
export type DefaultIssue = 'option' | 'boolean' | 'number' | 'date';
|
|
36
|
+
/**
|
|
37
|
+
* Whether the default value fits the attribute's type, or why not: a choice
|
|
38
|
+
* the options no longer offer (`pruneDefault` would drop it), a boolean that
|
|
39
|
+
* is neither `true` nor `false`, a number that is not one, a date that does
|
|
40
|
+
* not read. An unset default (`null`, `''`, an empty list) always fits.
|
|
41
|
+
*/
|
|
42
|
+
export declare function defaultIssue(attribute: Attribute): DefaultIssue | null;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Enumeration of possible data types for an attribute.
|
|
3
3
|
* Defines the kind of data an attribute can hold.
|
|
4
4
|
*/
|
|
5
|
-
export type AttributeType = 'STRING' | 'TEXT' | 'COLOR' | 'NUMBER' | 'DATE' | 'DATETIME' | 'TIME' | 'SELECT' | 'MULTI_SELECT' | 'RICH_TEXT';
|
|
5
|
+
export type AttributeType = 'STRING' | 'TEXT' | 'COLOR' | 'NUMBER' | 'DATE' | 'DATETIME' | 'TIME' | 'SELECT' | 'MULTI_SELECT' | 'RICH_TEXT' | 'BOOLEAN';
|
|
6
6
|
/**
|
|
7
7
|
* Represents an attribute within the system.
|
|
8
8
|
* Attributes define customizable properties of a resource,
|
|
@@ -23,5 +23,9 @@ export interface Attribute {
|
|
|
23
23
|
options?: string[] | null;
|
|
24
24
|
/** The default value of the attribute. */
|
|
25
25
|
defaultValue?: any | null;
|
|
26
|
+
/**
|
|
27
|
+
* The attribute's place in the list, 1 first. The inline editor shows the
|
|
28
|
+
* attributes by `priority` and sets it for every one when a row is moved.
|
|
29
|
+
*/
|
|
26
30
|
priority?: number | null;
|
|
27
31
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Attribute } from '../models/attribute.js';
|
|
2
|
+
import { AttributeText } from '../use-attribute-text.js';
|
|
3
|
+
import { AttributesEditorState } from '../use-attributes-editor.js';
|
|
4
|
+
export type AttributeRowProps = {
|
|
5
|
+
text: AttributeText;
|
|
6
|
+
editor: AttributesEditorState;
|
|
7
|
+
items: Attribute[];
|
|
8
|
+
index: number;
|
|
9
|
+
/** The id of the hint that says which keys move a row. */
|
|
10
|
+
hintId: string;
|
|
11
|
+
/** On a phone the row opens the sheet instead of growing. */
|
|
12
|
+
phone: boolean;
|
|
13
|
+
/** More than one row: the grip shows. */
|
|
14
|
+
reorderable: boolean;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
};
|
|
17
|
+
/** One attribute: its grip, its summary, and (open, off a phone) its fields. */
|
|
18
|
+
export declare function AttributeRow({ text, editor, items, index, hintId, phone, reorderable, disabled, }: AttributeRowProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DefaultInputProps } from './default-inputs.js';
|
|
2
|
+
/** A choice among the options: a native select, with "—" for none. */
|
|
3
|
+
export declare function SelectDefault({ label, attribute, onChange, disabled, className, }: DefaultInputProps): import("react").JSX.Element;
|
|
4
|
+
/** Several of the options: a toggle chip each, kept in the options' order. */
|
|
5
|
+
export declare function MultiDefault({ label, attribute, onChange, disabled, className, }: DefaultInputProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Attribute } from '../models/attribute.js';
|
|
2
|
+
import { AttributeText } from '../use-attribute-text.js';
|
|
3
|
+
type DefaultFieldProps = {
|
|
4
|
+
text: AttributeText;
|
|
5
|
+
attribute: Attribute;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
onChange: (value: unknown) => void;
|
|
9
|
+
};
|
|
10
|
+
/** The default value, edited the way its type is: a switch, a date, a colour, a choice… */
|
|
11
|
+
export declare function DefaultField({ text, attribute, ...rest }: DefaultFieldProps): import("react").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Attribute } from '../models/attribute.js';
|
|
3
|
+
export type DefaultInputProps = {
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
attribute: Attribute;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
onChange: (value: unknown) => void;
|
|
9
|
+
};
|
|
10
|
+
export declare function BooleanDefault({ label, attribute, ...rest }: DefaultInputProps): import("react").JSX.Element;
|
|
11
|
+
export declare function NumberDefault({ label, attribute, onChange, ...rest }: DefaultInputProps): import("react").JSX.Element;
|
|
12
|
+
export declare function ColorDefault({ label, attribute, onChange, ...rest }: DefaultInputProps): import("react").JSX.Element;
|
|
13
|
+
export declare function DateDefault({ label, attribute, onChange, ...rest }: DefaultInputProps): import("react").JSX.Element;
|
|
14
|
+
export declare function TimeDefault({ label, attribute, onChange, ...rest }: DefaultInputProps): import("react").JSX.Element;
|
|
15
|
+
export declare function RichDefault({ label, attribute, onChange, disabled, className, }: DefaultInputProps): import("react").JSX.Element;
|
|
16
|
+
export declare function TextDefault({ label, attribute, onChange, disabled, className, }: DefaultInputProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AttributeText } from '../use-attribute-text.js';
|
|
2
|
+
type NoteProps = {
|
|
3
|
+
text: AttributeText;
|
|
4
|
+
};
|
|
5
|
+
/** The reorder hint, shown when the rows can be moved. */
|
|
6
|
+
export declare function ReorderHint({ text, id }: NoteProps & {
|
|
7
|
+
id: string;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
9
|
+
/** What shows when there is no attribute. */
|
|
10
|
+
export declare function NoAttributes({ text }: NoteProps): import("react").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
type LabeledProps = {
|
|
3
|
+
label: ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
/** The control, given the id its label points at. */
|
|
6
|
+
children: (id: string) => ReactNode;
|
|
7
|
+
};
|
|
8
|
+
/** A small field: its visible label and the control it names. */
|
|
9
|
+
export declare function Labeled({ label, className, children }: LabeledProps): import("react").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Attribute } from '../models/attribute.js';
|
|
2
|
+
import { AttributeText } from '../use-attribute-text.js';
|
|
3
|
+
type NameFieldProps = {
|
|
4
|
+
text: AttributeText;
|
|
5
|
+
items: readonly Attribute[];
|
|
6
|
+
index: number;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
onChange: (name: string) => void;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* The attribute's name. Another attribute with the same name is an inline
|
|
12
|
+
* `role="alert"` at once; an empty name is one once the field was left.
|
|
13
|
+
*/
|
|
14
|
+
export declare function NameField({ text, items, index, disabled, onChange, }: NameFieldProps): import("react").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AttributeText } from '../use-attribute-text.js';
|
|
2
|
+
type OptionsFieldProps = {
|
|
3
|
+
text: AttributeText;
|
|
4
|
+
options: string[];
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
onChange: (options: string[]) => void;
|
|
8
|
+
};
|
|
9
|
+
/** The allowed choices: a chip each, and a field that adds one on Enter, a comma or leaving it. */
|
|
10
|
+
export declare function OptionsField({ text, options, disabled, className, onChange, }: OptionsFieldProps): import("react").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Attribute } from '../models/attribute.js';
|
|
2
|
+
import { AttributeText } from '../use-attribute-text.js';
|
|
3
|
+
import { AttributesEditorState } from '../use-attributes-editor.js';
|
|
4
|
+
type PhoneSheetProps = {
|
|
5
|
+
text: AttributeText;
|
|
6
|
+
editor: AttributesEditorState;
|
|
7
|
+
items: Attribute[];
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
};
|
|
10
|
+
/** A phone's editor for one attribute: the same fields, in a bottom sheet. */
|
|
11
|
+
export declare function PhoneSheet({ text, editor, items, disabled }: PhoneSheetProps): import("react").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AttributeText } from '../use-attribute-text.js';
|
|
2
|
+
import { AttributesEditorState } from '../use-attributes-editor.js';
|
|
3
|
+
type ReorderHandleProps = {
|
|
4
|
+
text: AttributeText;
|
|
5
|
+
editor: AttributesEditorState;
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
/** The id of the hint that says which keys move a row. */
|
|
9
|
+
hintId: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* A row's grip. The pointer drags it; Space or Enter lifts the row, the
|
|
14
|
+
* arrows move it, Space or Enter drops it, Escape puts it back. Lifted, it is
|
|
15
|
+
* the one tinted control. It has no tooltip: the hint above the list says how,
|
|
16
|
+
* and a tooltip would flash over the rows while one is dragged.
|
|
17
|
+
*/
|
|
18
|
+
export declare function ReorderHandle({ text, editor, id, name, hintId, disabled, }: ReorderHandleProps): import("react").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Attribute } from '../models/attribute.js';
|
|
2
|
+
import { AttributeText } from '../use-attribute-text.js';
|
|
3
|
+
type RowFieldsProps = {
|
|
4
|
+
text: AttributeText;
|
|
5
|
+
/** The focus key of the label: the control that takes focus when the row is added. */
|
|
6
|
+
labelFocusKey: string;
|
|
7
|
+
items: readonly Attribute[];
|
|
8
|
+
index: number;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/** One column: the sheet's layout. */
|
|
11
|
+
stacked?: boolean;
|
|
12
|
+
onChange: (patch: Partial<Attribute>) => void;
|
|
13
|
+
};
|
|
14
|
+
/** The fields of one attribute: label, name, type, unit, options, default value and description. */
|
|
15
|
+
export declare function RowFields({ text, labelFocusKey, items, index, disabled, stacked, onChange, }: RowFieldsProps): import("react").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AttributeText } from '../use-attribute-text.js';
|
|
2
|
+
type RowFooterProps = {
|
|
3
|
+
text: AttributeText;
|
|
4
|
+
/** Names the attribute in the remove button: "Remove Weight". */
|
|
5
|
+
name: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
onRemove: () => void;
|
|
8
|
+
onDone: () => void;
|
|
9
|
+
};
|
|
10
|
+
/** Under an open row: Remove, in the quiet tone, and Done. */
|
|
11
|
+
export declare function RowFooter({ text: { t }, name, disabled, onRemove, onDone, }: RowFooterProps): import("react").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Attribute } from '../models/attribute.js';
|
|
2
|
+
import { AttributeText } from '../use-attribute-text.js';
|
|
3
|
+
type RowHeadProps = {
|
|
4
|
+
attribute: Attribute;
|
|
5
|
+
text: AttributeText;
|
|
6
|
+
open: boolean;
|
|
7
|
+
/** The name is wrong: a mark shows even where the default is hidden. */
|
|
8
|
+
problem: boolean;
|
|
9
|
+
};
|
|
10
|
+
/** What a row shows closed: its icon, its title, its unit and default, and the chevron. */
|
|
11
|
+
export declare function RowHead({ attribute, text, open, problem }: RowHeadProps): import("react").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Attribute } from '../models/attribute.js';
|
|
2
|
+
import { AttributeText } from '../use-attribute-text.js';
|
|
3
|
+
import { AttributesEditorState } from '../use-attributes-editor.js';
|
|
4
|
+
type RowPanelProps = {
|
|
5
|
+
text: AttributeText;
|
|
6
|
+
editor: AttributesEditorState;
|
|
7
|
+
items: Attribute[];
|
|
8
|
+
index: number;
|
|
9
|
+
id: string;
|
|
10
|
+
title: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
};
|
|
13
|
+
/** The fields of an open row, below it. */
|
|
14
|
+
export declare function RowPanel({ text, editor, items, index, id, title, disabled, }: RowPanelProps): import("react").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
type RowsDndProps = {
|
|
3
|
+
/** The rows' ids, in the order shown. */
|
|
4
|
+
ids: string[];
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
onMove: (from: string, to: string) => void;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
/** The pointer drag over the rows: vertical only, announced by the editor's own live region. */
|
|
10
|
+
export declare function RowsDnd({ ids, disabled, onMove, children }: RowsDndProps): import("react").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Attribute } from '../models/attribute.js';
|
|
2
|
+
import { AttributeText } from '../use-attribute-text.js';
|
|
3
|
+
type SimpleFieldProps = {
|
|
4
|
+
text: AttributeText;
|
|
5
|
+
attribute: Attribute;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
onChange: (patch: Partial<Attribute>) => void;
|
|
9
|
+
};
|
|
10
|
+
/** The label: what people read; the row's focus target when it is added. */
|
|
11
|
+
export declare function LabelField({ text, attribute, disabled, focusKey, onChange, }: SimpleFieldProps & {
|
|
12
|
+
focusKey: string;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
14
|
+
/** The type, a native select; changing it resets what no longer fits. */
|
|
15
|
+
export declare function TypeField({ text, attribute, disabled, onChange, }: SimpleFieldProps): import("react").JSX.Element;
|
|
16
|
+
/** The unit of a number (kept for another type that already has one). */
|
|
17
|
+
export declare function UnitField({ text, attribute, disabled, onChange, }: SimpleFieldProps): import("react").JSX.Element | null;
|
|
18
|
+
/** The description, one line. */
|
|
19
|
+
export declare function DescriptionField({ text, attribute, disabled, className, onChange, }: SimpleFieldProps): import("react").JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Attribute } from '../models/attribute.js';
|
|
2
|
+
import { AttributeText } from '../use-attribute-text.js';
|
|
3
|
+
type SummaryItemProps = {
|
|
4
|
+
text: AttributeText;
|
|
5
|
+
attribute: Attribute;
|
|
6
|
+
};
|
|
7
|
+
/** One attribute in the read-only summary: type icon, label, and its default value. */
|
|
8
|
+
export declare function SummaryItem({ text, attribute }: SummaryItemProps): import("react").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IconName } from '@fortawesome/fontawesome-common-types';
|
|
2
|
+
import { AttributeType } from '../models/attribute.js';
|
|
3
|
+
/** The icon of a type. */
|
|
4
|
+
export declare const typeIconName: (type: AttributeType) => IconName;
|
|
5
|
+
type TypeIconProps = {
|
|
6
|
+
type: AttributeType;
|
|
7
|
+
/** `tile` (default) is a tinted square; `bare` is the glyph alone. */
|
|
8
|
+
look?: 'tile' | 'bare';
|
|
9
|
+
className?: string;
|
|
10
|
+
};
|
|
11
|
+
/** A type's icon; decoration, the row names the type in words. */
|
|
12
|
+
export declare function TypeIcon({ type, look, className }: TypeIconProps): import("react").JSX.Element;
|
|
13
|
+
export {};
|