@nxgt/material 3.16.0 → 3.18.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 (79) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +1 -1
  3. package/dist/{async-slice-ChtlTP8W.js → async-slice-gqif7FX9.js} +2 -2
  4. package/dist/{button-BrgyWw7T.js → button-Ck1Bif-Q.js} +1 -1
  5. package/dist/charts.js +3 -3
  6. package/dist/{chip-BZu-bvAJ.js → chip-B9pZFWbi.js} +1 -1
  7. package/dist/{code-editor-DjY7_8TH.js → code-editor-M4DcaX-P.js} +4 -4
  8. package/dist/code-editor.js +4 -4
  9. package/dist/{code-language-items-D1lpNQ6J.js → code-language-items-Bnm_WDVg.js} +2 -2
  10. package/dist/{components-BOF9frx3.js → components-nq1rUKCK.js} +18648 -18025
  11. package/dist/components.js +15 -15
  12. package/dist/{dialog-YHZJjDrI.js → dialog-jYcWDh9G.js} +1 -1
  13. package/dist/dnd.js +1 -1
  14. package/dist/{dropdown-menu-BEyP-A0J.js → dropdown-menu-BEZhNnhr.js} +1 -1
  15. package/dist/editor.js +7 -7
  16. package/dist/{empty-state-ZtqqpX0S.js → empty-state-BBUsR0_X.js} +1 -1
  17. package/dist/hooks.js +2 -2
  18. package/dist/{i18n-provider-GV4Ukoe2.js → i18n-provider-3TsMIGn1.js} +1 -1
  19. package/dist/i18n.js +5 -5
  20. package/dist/{icon-badge-C0TGvF9o.js → icon-badge-92uhu2o6.js} +1 -1
  21. package/dist/lib/components/ui/collections/filter/editors/text-editor.d.ts +6 -1
  22. package/dist/lib/components/ui/collections/filter/index.d.ts +1 -1
  23. package/dist/lib/components/ui/collections/filter/query/types.d.ts +20 -1
  24. package/dist/lib/components/ui/collections/filter/query/use-filter-query-value.d.ts +3 -0
  25. package/dist/lib/components/ui/collections/filter/query/use-filter-query.d.ts +6 -2
  26. package/dist/lib/components/ui/collections/filter/sections/filter-search.d.ts +7 -1
  27. package/dist/lib/components/ui/collections/server-table/types.d.ts +12 -1
  28. package/dist/lib/components/ui/collections/server-table/use-table-answer.d.ts +1 -1
  29. package/dist/lib/components/ui/fields/search-field/search-field.d.ts +6 -1
  30. package/dist/lib/components/ui/selection/switcher/partials/switcher-footer.d.ts +13 -0
  31. package/dist/lib/components/ui/selection/switcher/partials/switcher-groups.d.ts +9 -0
  32. package/dist/lib/components/ui/selection/switcher/partials/switcher-list.d.ts +8 -0
  33. package/dist/lib/components/ui/selection/switcher/partials/switcher-menu.d.ts +13 -0
  34. package/dist/lib/components/ui/selection/switcher/partials/switcher-popover.d.ts +12 -0
  35. package/dist/lib/components/ui/selection/switcher/partials/switcher-row.d.ts +22 -0
  36. package/dist/lib/components/ui/selection/switcher/partials/switcher-search.d.ts +14 -0
  37. package/dist/lib/components/ui/selection/switcher/partials/switcher-sheet.d.ts +12 -0
  38. package/dist/lib/components/ui/selection/switcher/partials/switcher-tile.d.ts +7 -0
  39. package/dist/lib/components/ui/selection/switcher/partials/switcher-tooltip.d.ts +9 -0
  40. package/dist/lib/components/ui/selection/switcher/partials/switcher-trigger.d.ts +17 -0
  41. package/dist/lib/components/ui/selection/switcher/switcher.d.ts +10 -15
  42. package/dist/lib/components/ui/selection/switcher/switcher.utils.d.ts +13 -0
  43. package/dist/lib/components/ui/selection/switcher/types.d.ts +73 -0
  44. package/dist/lib/components/ui/selection/switcher/use-clipped.d.ts +3 -0
  45. package/dist/lib/components/ui/selection/switcher/use-switcher-list.d.ts +21 -0
  46. package/dist/lib/i18n/resources/en/en.d.ts +11 -0
  47. package/dist/lib/i18n/resources/en/material.json.d.ts +11 -0
  48. package/dist/lib/i18n/resources/fr/fr.d.ts +11 -0
  49. package/dist/lib/i18n/resources/fr/material.json.d.ts +11 -0
  50. package/dist/lib/i18n/resources/resources.d.ts +22 -0
  51. package/dist/lib/i18n/translator.d.ts +1 -1
  52. package/dist/lib.js +1 -1
  53. package/dist/main.js +21 -21
  54. package/dist/map.js +4 -4
  55. package/dist/material.css +1 -1
  56. package/dist/pdf-reader.js +1 -1
  57. package/dist/print.js +2 -2
  58. package/dist/{public-Bj3rGSfS.js → public-BLw13izR.js} +6 -6
  59. package/dist/{rich-code-block-RN-EpeTA.js → rich-code-block-DPe5USBG.js} +4 -4
  60. package/dist/{sortable-provider-Iej7IS4n.js → sortable-provider-CtAb1Q02.js} +1 -1
  61. package/dist/{spinner-BwWDXIbg.js → spinner-CcmXeIHf.js} +1 -1
  62. package/dist/{stored-language-BAAP7qS3.js → stored-language-CsDEJDR7.js} +24 -2
  63. package/dist/theme-picker.js +2 -2
  64. package/dist/{theme-toggle-8zHeXSD1.js → theme-toggle-CWovcIQY.js} +1 -1
  65. package/dist/{toolbar-items-CVQBYp4K.js → toolbar-items-CrATPuOX.js} +2 -2
  66. package/dist/{translate-material-C0aOnHpZ.js → translate-material-X1daoGxE.js} +2 -2
  67. package/dist/{translator-BU07gNva.js → translator-BUVKAo4l.js} +1 -1
  68. package/dist/{use-chat-composer-CoXmJCkr.js → use-chat-composer-UZVFm8Tw.js} +52 -52
  69. package/dist/{use-heading-spy-DETdqnB6.js → use-heading-spy-ByraZUf9.js} +1 -1
  70. package/dist/{use-material-translation-DGeVp-qP.js → use-material-translation-tD9XqIBm.js} +2 -2
  71. package/docs/components/data-table-filter-and-lists.md +35 -3
  72. package/docs/components/form-fields.md +1 -0
  73. package/docs/components/overlays-and-menus.md +1 -1
  74. package/docs/components/selection-and-choice.md +76 -6
  75. package/docs/guides/i18n.md +1 -1
  76. package/docs/guides/server-lists-url.md +12 -0
  77. package/docs/previews/selection-choice-switcher.webp +0 -0
  78. package/docs/troubleshooting.md +18 -1
  79. package/package.json +2 -2
@@ -0,0 +1,73 @@
1
+ import { ComponentProps, ReactNode } from 'react';
2
+ import { LinkComponent } from '../../primitives/link/link-component.js';
3
+ import { Tone } from '../../tones.js';
4
+ export type SwitcherItem = {
5
+ id: string;
6
+ /** Drawn in the tile instead of the initial. */
7
+ icon?: ReactNode;
8
+ title: string;
9
+ subtitle?: string;
10
+ /** The header of the group the option sits under (options with none come first). */
11
+ group?: string;
12
+ /** The letter(s) of the tile when there is no `icon`; default: the title's first letter. */
13
+ initial?: string;
14
+ /** The tile's colours (a named tone, or one the app declared). */
15
+ tone?: Tone;
16
+ /** A soft badge after the title (a count, "New"). Put a fact here or in the subtitle, not in both. */
17
+ badge?: ReactNode;
18
+ /** The link of this option in link mode, when `getHref` returns nothing for it. Link mode itself is on only with `getHref`. */
19
+ href?: string;
20
+ disabled?: boolean;
21
+ };
22
+ /** The footer of the panel ("Manage…"): a button, or a link with `href`. */
23
+ export type SwitcherFooter = {
24
+ /** Default: "Manage…" (`material.switcher.manage`). */
25
+ label?: ReactNode;
26
+ onSelect?: () => void;
27
+ href?: string;
28
+ };
29
+ export type SwitcherProps = {
30
+ options: SwitcherItem[];
31
+ /** What is switched ("Workspace", "Class"): names the trigger, the panel and the list. */
32
+ label: ReactNode;
33
+ value: string;
34
+ onValueChange?: (value: string) => void;
35
+ /** `default` is the tile trigger and menu; `expressive` is the pill and the large panel. */
36
+ variant?: 'default' | 'expressive';
37
+ /** A search field in the panel; default: from 8 options (always, when expressive). */
38
+ searchable?: boolean;
39
+ /** Up to 3 option ids shown as tiles above the groups while nothing is typed (expressive). */
40
+ recent?: string[];
41
+ /** Turns on link mode: each option is a link to this address (pass `(item) => item.href` to use the options' own) (`aria-current="page"` on the chosen one). */
42
+ getHref?: (item: SwitcherItem) => string | undefined;
43
+ /** The link element of link mode (your router's, wrapped as in the app shell). Default: `<a>`. */
44
+ linkComponent?: LinkComponent;
45
+ footer?: SwitcherFooter;
46
+ /** Shown when the search matches nothing. Default: `material.switcher.empty`. */
47
+ emptyLabel?: ReactNode;
48
+ /** `true` always opens a sheet, `false` never; default: a sheet on a phone. */
49
+ sheet?: boolean;
50
+ } & Omit<ComponentProps<'button'>, 'value' | 'onChange' | 'children'>;
51
+ /** What the inside of the panel (menu apart) reads, whatever the variant. */
52
+ export type SwitcherPanelProps = {
53
+ options: SwitcherItem[];
54
+ value: string;
55
+ label: ReactNode;
56
+ /** The id of the element that holds the label (names the dialog, the list and the nav). */
57
+ labelId: string;
58
+ expressive: boolean;
59
+ searchable: boolean;
60
+ recent: SwitcherItem[];
61
+ linkMode: boolean;
62
+ hrefOf: (item: SwitcherItem) => string | undefined;
63
+ linkComponent?: LinkComponent;
64
+ footer?: SwitcherFooter;
65
+ emptyLabel?: ReactNode;
66
+ onSelect: (item: SwitcherItem) => void;
67
+ /** Closes the panel (the footer's action). */
68
+ onClose: () => void;
69
+ /** The trigger's `name`: prefixes the options' `data-pw` (`<name>-<index>`). */
70
+ name?: string;
71
+ autoFocus?: boolean;
72
+ className?: string;
73
+ };
@@ -0,0 +1,3 @@
1
+ import { RefObject } from 'react';
2
+ /** Whether the element's text is clipped by an ellipsis, kept up to date as it resizes. */
3
+ export declare function useClipped(ref: RefObject<HTMLElement | null>, text: unknown, key?: unknown): boolean;
@@ -0,0 +1,21 @@
1
+ import { KeyboardEvent } from 'react';
2
+ import { SwitcherPanelProps } from './types.js';
3
+ type Params = Pick<SwitcherPanelProps, 'options' | 'value' | 'recent' | 'linkMode' | 'searchable' | 'onSelect' | 'autoFocus'>;
4
+ /** The state and the keys of the panel's list: search, the active option, arrows, Enter. */
5
+ export declare function useSwitcherList({ options, value, recent, linkMode, searchable, onSelect, autoFocus, }: Params): {
6
+ uid: string;
7
+ rootRef: import('react').RefObject<HTMLDivElement | null>;
8
+ inputRef: import('react').RefObject<HTMLInputElement | null>;
9
+ listRef: import('react').RefObject<HTMLDivElement | null>;
10
+ query: string;
11
+ setQuery: (next: string) => void;
12
+ filtered: import('./types.js').SwitcherItem[];
13
+ groups: import('./switcher.utils.js').SwitcherGroup[];
14
+ recents: import('./types.js').SwitcherItem[];
15
+ active: string;
16
+ setActiveKey: import('react').Dispatch<import('react').SetStateAction<string | undefined>>;
17
+ optionId: (key: string) => string;
18
+ onKeyDown: (event: KeyboardEvent<HTMLElement>) => void;
19
+ };
20
+ export type SwitcherListState = ReturnType<typeof useSwitcherList>;
21
+ export {};
@@ -1329,6 +1329,7 @@ export declare const en: {
1329
1329
  bar: {
1330
1330
  label: string;
1331
1331
  search: string;
1332
+ "search-min": string;
1332
1333
  active: string;
1333
1334
  locked: string;
1334
1335
  "locked-reason": string;
@@ -2674,5 +2675,15 @@ export declare const en: {
2674
2675
  "list-details": {
2675
2676
  back: string;
2676
2677
  };
2678
+ switcher: {
2679
+ search: string;
2680
+ "search-placeholder": string;
2681
+ clear: string;
2682
+ empty: string;
2683
+ results: string;
2684
+ recent: string;
2685
+ manage: string;
2686
+ choose: string;
2687
+ };
2677
2688
  };
2678
2689
  };
@@ -1319,6 +1319,7 @@ declare const _default: {
1319
1319
  "bar": {
1320
1320
  "label": "Filters",
1321
1321
  "search": "Search",
1322
+ "search-min": "Type at least {min, plural, one {# character} other {# characters}} to search",
1322
1323
  "active": "Active filters",
1323
1324
  "locked": "Locked",
1324
1325
  "locked-reason": "Locked: {reason}",
@@ -2663,6 +2664,16 @@ declare const _default: {
2663
2664
  },
2664
2665
  "list-details": {
2665
2666
  "back": "Back to the list"
2667
+ },
2668
+ "switcher": {
2669
+ "search": "Search",
2670
+ "search-placeholder": "Search…",
2671
+ "clear": "Clear the search",
2672
+ "empty": "No results for “{query}”",
2673
+ "results": "{count, plural, =0 {No results} one {# result} other {# results}}",
2674
+ "recent": "Recent",
2675
+ "manage": "Manage…",
2676
+ "choose": "Choose"
2666
2677
  }
2667
2678
  }
2668
2679
  ;
@@ -1329,6 +1329,7 @@ export declare const fr: {
1329
1329
  bar: {
1330
1330
  label: string;
1331
1331
  search: string;
1332
+ "search-min": string;
1332
1333
  active: string;
1333
1334
  locked: string;
1334
1335
  "locked-reason": string;
@@ -2674,5 +2675,15 @@ export declare const fr: {
2674
2675
  "list-details": {
2675
2676
  back: string;
2676
2677
  };
2678
+ switcher: {
2679
+ search: string;
2680
+ "search-placeholder": string;
2681
+ clear: string;
2682
+ empty: string;
2683
+ results: string;
2684
+ recent: string;
2685
+ manage: string;
2686
+ choose: string;
2687
+ };
2677
2688
  };
2678
2689
  };
@@ -1319,6 +1319,7 @@ declare const _default: {
1319
1319
  "bar": {
1320
1320
  "label": "Filtres",
1321
1321
  "search": "Rechercher",
1322
+ "search-min": "Saisissez au moins {min, plural, one {# caractère} other {# caractères}} pour rechercher",
1322
1323
  "active": "Filtres actifs",
1323
1324
  "locked": "Verrouillé",
1324
1325
  "locked-reason": "Verrouillé : {reason}",
@@ -2663,6 +2664,16 @@ declare const _default: {
2663
2664
  },
2664
2665
  "list-details": {
2665
2666
  "back": "Retour à la liste"
2667
+ },
2668
+ "switcher": {
2669
+ "search": "Rechercher",
2670
+ "search-placeholder": "Rechercher…",
2671
+ "clear": "Effacer la recherche",
2672
+ "empty": "Aucun résultat pour « {query} »",
2673
+ "results": "{count, plural, =0 {Aucun résultat} one {# résultat} other {# résultats}}",
2674
+ "recent": "Récents",
2675
+ "manage": "Gérer…",
2676
+ "choose": "Choisir"
2666
2677
  }
2667
2678
  }
2668
2679
  ;
@@ -1327,6 +1327,7 @@ export declare const resources: {
1327
1327
  bar: {
1328
1328
  label: string;
1329
1329
  search: string;
1330
+ "search-min": string;
1330
1331
  active: string;
1331
1332
  locked: string;
1332
1333
  "locked-reason": string;
@@ -2672,6 +2673,16 @@ export declare const resources: {
2672
2673
  "list-details": {
2673
2674
  back: string;
2674
2675
  };
2676
+ switcher: {
2677
+ search: string;
2678
+ "search-placeholder": string;
2679
+ clear: string;
2680
+ empty: string;
2681
+ results: string;
2682
+ recent: string;
2683
+ manage: string;
2684
+ choose: string;
2685
+ };
2675
2686
  };
2676
2687
  };
2677
2688
  fr: {
@@ -3996,6 +4007,7 @@ export declare const resources: {
3996
4007
  bar: {
3997
4008
  label: string;
3998
4009
  search: string;
4010
+ "search-min": string;
3999
4011
  active: string;
4000
4012
  locked: string;
4001
4013
  "locked-reason": string;
@@ -5341,6 +5353,16 @@ export declare const resources: {
5341
5353
  "list-details": {
5342
5354
  back: string;
5343
5355
  };
5356
+ switcher: {
5357
+ search: string;
5358
+ "search-placeholder": string;
5359
+ clear: string;
5360
+ empty: string;
5361
+ results: string;
5362
+ recent: string;
5363
+ manage: string;
5364
+ choose: string;
5365
+ };
5344
5366
  };
5345
5367
  };
5346
5368
  };