@nxgt/material 3.67.0 → 3.70.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.
Files changed (105) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +6 -4
  3. package/dist/{alert-dialog-BgQDxcYh.js → alert-dialog-CBkWG32g.js} +1 -1
  4. package/dist/{async-slice-BCZyWgGr.js → async-slice-CNZ3N55P.js} +1 -1
  5. package/dist/{button-2de_lrix.js → button-D3qzqDY_.js} +1 -1
  6. package/dist/charts.js +3 -3
  7. package/dist/{chip-Cs0uEjpu.js → chip-CMTe4sQd.js} +2 -2
  8. package/dist/{code-editor-BYhBAfcc.js → code-editor-Cs7mz1J-.js} +5 -5
  9. package/dist/code-editor.js +5 -5
  10. package/dist/{code-language-items-xhmbF6wA.js → code-language-items-D_QMgjVy.js} +2 -2
  11. package/dist/{components-BRWaX4Xk.js → components-BbWcozcj.js} +18104 -17600
  12. package/dist/components.js +28 -28
  13. package/dist/{dialog-Co5oksU1.js → dialog-B3BSdRci.js} +4 -4
  14. package/dist/dnd.js +1 -1
  15. package/dist/{dropdown-menu-DdzyvN76.js → dropdown-menu-BaupOWgS.js} +1 -1
  16. package/dist/editor.js +661 -661
  17. package/dist/{empty-state-CQ0CV0kA.js → empty-state-B2Um5UpI.js} +2 -2
  18. package/dist/{field-blur-B2y-bNYi.js → field-blur-1XLyxRPr.js} +82 -82
  19. package/dist/{field-blur-context-BZtwcPUV.js → field-blur-context-XNvCDnMT.js} +1 -1
  20. package/dist/{hooks-DjuYsY-j.js → hooks-BU21Jpaa.js} +2 -2
  21. package/dist/hooks.js +2 -2
  22. package/dist/{hover-card-BeBVy6tB.js → hover-card-Bvm3svX9.js} +1 -1
  23. package/dist/i18n.js +3 -3
  24. package/dist/{icon-badge-DbYsbzwZ.js → icon-badge-wip9bfa2.js} +3 -3
  25. package/dist/{icon-button-Co6ttdv1.js → icon-button-QwIeBTdw.js} +1 -1
  26. package/dist/lib/components/ui/collections/filter/use-filter-field-config.d.ts +3 -3
  27. package/dist/lib/components/ui/fields/choice-list/choice-list-field.d.ts +13 -0
  28. package/dist/lib/components/ui/fields/choice-list/choice-list-form-field.d.ts +19 -0
  29. package/dist/lib/components/ui/fields/choice-list/choice-list-names.d.ts +19 -0
  30. package/dist/lib/components/ui/fields/choice-list/choice-list.utils.d.ts +27 -0
  31. package/dist/lib/components/ui/fields/choice-list/index.d.ts +3 -0
  32. package/dist/lib/components/ui/fields/choice-list/partials/choice-mark.d.ts +18 -0
  33. package/dist/lib/components/ui/fields/choice-list/partials/choice-row.d.ts +19 -0
  34. package/dist/lib/components/ui/fields/choice-list/types.d.ts +44 -0
  35. package/dist/lib/components/ui/fields/contacts/placeholders.d.ts +1 -1
  36. package/dist/lib/components/ui/fields/country-field/index.d.ts +2 -0
  37. package/dist/lib/components/ui/fields/country-field/iso-countries.d.ts +2 -0
  38. package/dist/lib/components/ui/fields/index.d.ts +2 -0
  39. package/dist/lib/components/ui/fields/phone-field/index.d.ts +1 -1
  40. package/dist/lib/components/ui/fields/phone-field/parse-phone.d.ts +2 -0
  41. package/dist/lib/components/ui/fields/phone-field/phone-field.d.ts +8 -1
  42. package/dist/lib/components/ui/fields/phone-field/phone-form-field.d.ts +8 -1
  43. package/dist/lib/components/ui/fields/phone-field/use-phone-value.d.ts +2 -1
  44. package/dist/lib/components/ui/fields/postal-address/utils.d.ts +15 -0
  45. package/dist/lib/components/ui/fields/quantity-field/index.d.ts +3 -0
  46. package/dist/lib/components/ui/fields/quantity-field/quantity-field.d.ts +8 -0
  47. package/dist/lib/components/ui/fields/quantity-field/quantity-form-field.d.ts +8 -0
  48. package/dist/lib/components/ui/fields/quantity-field/quantity-row.d.ts +13 -0
  49. package/dist/lib/components/ui/fields/quantity-field/quantity-unit.d.ts +12 -0
  50. package/dist/lib/components/ui/fields/quantity-field/quantity-value.d.ts +9 -0
  51. package/dist/lib/components/ui/fields/quantity-field/types.d.ts +45 -0
  52. package/dist/lib/components/ui/media/upload/index.d.ts +1 -0
  53. package/dist/lib/components/ui/media/upload/network-upload-field/network-upload-field.d.ts +6 -1
  54. package/dist/lib/components/ui/media/upload/network-upload-field/network-upload-field.errors.d.ts +8 -0
  55. package/dist/lib/components/ui/media/upload/network-upload-field/network-upload-field.utils.d.ts +2 -7
  56. package/dist/lib/components/ui/media/upload/network-upload-field/use-start-upload.d.ts +7 -3
  57. package/dist/lib/components/ui/media/upload/network-upload-field/use-upload-item-handlers.d.ts +2 -1
  58. package/dist/lib/components/ui/media/upload/s3-upload-field/s3-upload-field.d.ts +2 -5
  59. package/dist/lib/components/ui/media/upload/s3-upload-field/s3-upload-field.utils.d.ts +26 -1
  60. package/dist/lib/components/ui/media/upload/upload-error.d.ts +33 -0
  61. package/dist/lib/components/ui/selection/autocomplete/autocomplete-enter.d.ts +18 -0
  62. package/dist/lib/components/ui/selection/autocomplete/partials/autocomplete-chip-input.d.ts +2 -1
  63. package/dist/lib/components/ui/selection/autocomplete/partials/autocomplete-text-input.d.ts +2 -1
  64. package/dist/lib/components/ui/selection/autocomplete/types.d.ts +3 -1
  65. package/dist/lib/components/ui/widgets/education/questions/partials/question-content.d.ts +1 -1
  66. package/dist/lib/components/ui/widgets/education/questions/question-text.d.ts +1 -1
  67. package/dist/lib/components/ui/widgets/education/questions/question.d.ts +1 -1
  68. package/dist/lib/components/ui/widgets/education/questions/types.d.ts +10 -0
  69. package/dist/lib/i18n/resources/en/en.d.ts +20 -0
  70. package/dist/lib/i18n/resources/en/material.json.d.ts +21 -1
  71. package/dist/lib/i18n/resources/fr/fr.d.ts +20 -0
  72. package/dist/lib/i18n/resources/fr/material.json.d.ts +21 -1
  73. package/dist/lib/i18n/resources/resources.d.ts +40 -0
  74. package/dist/lib/i18n/translator.d.ts +1 -1
  75. package/dist/lib.js +1 -1
  76. package/dist/main.js +42 -42
  77. package/dist/map.js +8 -8
  78. package/dist/material.css +1 -1
  79. package/dist/pdf-reader.js +1 -1
  80. package/dist/print.js +1 -1
  81. package/dist/{public-AXwv1h3v.js → public-BuGgOtAl.js} +9 -9
  82. package/dist/{rich-code-block-qSvkA5rI.js → rich-code-block-DdHqzzek.js} +5 -5
  83. package/dist/{sortable-provider-DPk-RVEU.js → sortable-provider-DMyaSfZZ.js} +2 -2
  84. package/dist/{spinner-PdSk7zEs.js → spinner-ByYdcukU.js} +1 -1
  85. package/dist/theme-picker.js +2 -2
  86. package/dist/{theme-toggle-CZQckLDd.js → theme-toggle-DB3aZZnO.js} +1 -1
  87. package/dist/{toolbar-items-BmNYNaRB.js → toolbar-items-DbzIKjo7.js} +3 -3
  88. package/dist/{translate-material-BlCQ6AW9.js → translate-material-Dh7MYkHT.js} +1 -1
  89. package/dist/{translator-ChpeKCO3.js → translator-Byhohi1S.js} +42 -2
  90. package/dist/{typography-C4JSRr2B.js → typography-rUf0mE5a.js} +1 -1
  91. package/dist/{use-chat-composer-OUa9akfM.js → use-chat-composer-uUUTRB3Z.js} +2401 -2343
  92. package/dist/{use-heading-spy-K-HUp4o_.js → use-heading-spy-CVzW2NM3.js} +4 -4
  93. package/dist/{use-material-translation-DkE9J5NE.js → use-material-translation-BAYyZOcH.js} +1 -1
  94. package/dist/{use-return-focus-KypnR7vv.js → use-return-focus-CQAuk9kh.js} +1 -1
  95. package/docs/components/form-fields.md +196 -3
  96. package/docs/components/media-and-files.md +55 -9
  97. package/docs/components/primitives.md +9 -14
  98. package/docs/components/rich-widgets.md +2 -1
  99. package/docs/components/selection-and-choice.md +10 -3
  100. package/docs/guides/forms.md +4 -3
  101. package/docs/previews/form-fields-choicelistfield.webp +0 -0
  102. package/docs/previews/form-fields-quantityfield.webp +0 -0
  103. package/docs/roadmap.md +5 -2
  104. package/docs/troubleshooting.md +11 -4
  105. package/package.json +1 -1
@@ -0,0 +1,27 @@
1
+ import { ChoiceListSelection, ChoiceRow } from './types.js';
2
+ /** A new row id, unique in the page. */
3
+ export declare function newChoiceId(): string;
4
+ /** Rows that all have a distinct id: a missing or repeated one is replaced. */
5
+ export declare function withIds(rows: readonly ChoiceRow[]): ChoiceRow[];
6
+ /** Rows shown before they have a distinct id: a placeholder per position. */
7
+ export declare const provisionalIds: (rows: readonly ChoiceRow[]) => ChoiceRow[];
8
+ /** Whether every row has a distinct id. */
9
+ export declare const hasIds: (rows: readonly ChoiceRow[]) => boolean;
10
+ /** Marks or unmarks a row; in `single`, marking a row unmarks the others. */
11
+ export declare function setCorrect(rows: readonly ChoiceRow[], id: string, correct: boolean, selection: ChoiceListSelection): ChoiceRow[];
12
+ /** The rows with one more at the end; in `single` it is marked when none is. */
13
+ export declare function addChoice(rows: readonly ChoiceRow[], selection: ChoiceListSelection): ChoiceRow[];
14
+ export declare function setText(rows: readonly ChoiceRow[], id: string, text: string): ChoiceRow[];
15
+ export declare const removeAt: (rows: readonly ChoiceRow[], index: number) => ChoiceRow[];
16
+ export declare function moveRow(rows: readonly ChoiceRow[], from: number, to: number): ChoiceRow[];
17
+ export type ChoiceListIssue = 'too-few' | 'too-many' | 'none-correct' | 'blank';
18
+ /**
19
+ * What stops the list from being valid, first issue first: fewer than `min`
20
+ * rows, several rows marked in `single`, no row marked (unless
21
+ * `requireCorrect` is false), or a row with no text.
22
+ */
23
+ export declare function choiceListIssue(rows: readonly ChoiceRow[], options?: {
24
+ min?: number;
25
+ selection?: ChoiceListSelection;
26
+ requireCorrect?: boolean;
27
+ }): ChoiceListIssue | undefined;
@@ -0,0 +1,3 @@
1
+ export * from './choice-list-field.js';
2
+ export * from './choice-list-form-field.js';
3
+ export type { ChoiceListSelection, ChoiceRow } from './types.js';
@@ -0,0 +1,18 @@
1
+ import { ChoiceListSelection } from '../types.js';
2
+ export type ChoiceMarkProps = {
3
+ selection: ChoiceListSelection;
4
+ /** The list's radio `name`, shared by its radios (`single`). */
5
+ radioName: string;
6
+ correct: boolean;
7
+ /** Visible word, e.g. "Correct". */
8
+ text: string;
9
+ /** Accessible name; it starts with `text`. */
10
+ name: string;
11
+ disabled?: boolean;
12
+ onCorrectChange: (correct: boolean) => void;
13
+ };
14
+ /**
15
+ * A row's mark: a radio of the list's radio group in `single`, a checkbox in
16
+ * `multiple`, with a visible word beside it.
17
+ */
18
+ export declare function ChoiceMark({ selection, radioName, correct, text, name, disabled, onCorrectChange, }: ChoiceMarkProps): import("react").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { ReactNode } from 'react';
2
+ import { ChoiceListSelection, ChoiceRow as Row } from '../types.js';
3
+ export type ChoiceRowProps = {
4
+ row: Row;
5
+ position: number;
6
+ radioName: string;
7
+ selection: ChoiceListSelection;
8
+ disabled?: boolean;
9
+ error?: ReactNode;
10
+ names: {
11
+ text: (position: number) => string;
12
+ correctText: string;
13
+ correct: (position: number) => string;
14
+ };
15
+ onText: (text: string) => void;
16
+ onCorrect: (correct: boolean) => void;
17
+ };
18
+ /** One row's fields: the answer's text, then its mark. */
19
+ export declare function ChoiceListRow({ row, position, radioName, selection, disabled, error, names, onText, onCorrect, }: ChoiceRowProps): import("react").JSX.Element;
@@ -0,0 +1,44 @@
1
+ import { ComponentProps, ReactNode } from 'react';
2
+ import { RepeatableGroupProps } from '../repeatable-group/types.js';
3
+ /** One answer choice: its text, and whether it is a correct answer. */
4
+ export type ChoiceRow = {
5
+ /** Stable across edits and moves; given to a new row, kept on the others. */
6
+ id: string;
7
+ text: string;
8
+ correct: boolean;
9
+ };
10
+ /**
11
+ * `single` marks one row (radios; marking a row unmarks the others) and
12
+ * `multiple` allows several (checkboxes). A `single` list that holds several
13
+ * marked rows is not changed, and fails the `too-many` rule.
14
+ */
15
+ export type ChoiceListSelection = 'single' | 'multiple';
16
+ export type ChoiceListFieldProps = Omit<ComponentProps<'div'>, 'children' | 'onChange' | 'defaultValue'> & Pick<RepeatableGroupProps<ChoiceRow>, 'min' | 'max' | 'disabled' | 'emptyTitle' | 'emptyDescription'> & {
17
+ value: readonly ChoiceRow[];
18
+ onChange: (rows: ChoiceRow[]) => void;
19
+ /**
20
+ * Called once on mount, instead of `onChange`, with the rows whose id was
21
+ * missing or repeated given a new one. A form passes a handler that does
22
+ * not mark itself dirty.
23
+ */
24
+ onAssignIds?: (rows: ChoiceRow[]) => void;
25
+ selection?: ChoiceListSelection;
26
+ /** The group's label, above the rows. */
27
+ label?: ReactNode;
28
+ /** What one row is, lower case; default "answer", translated. */
29
+ rowLabel?: string;
30
+ /** The Add button's text. Default "Add {rowLabel}", translated. */
31
+ addLabel?: string;
32
+ /** Move up and move down buttons on each row. Default true. */
33
+ reorderable?: boolean;
34
+ /** An error about the whole list, under the rows. */
35
+ error?: ReactNode;
36
+ /** An error per row, by id: `{ [row.id]: 'Enter the answer' }`. */
37
+ rowErrors?: Readonly<Record<string, ReactNode>>;
38
+ /**
39
+ * Called when the focus leaves the whole list, for a field used alone;
40
+ * inside a `FieldBlur` the list's root is registered and this is not
41
+ * needed.
42
+ */
43
+ onBlur?: () => void;
44
+ };