@nxgt/material-vue 0.31.0 → 0.33.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 (104) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/README.md +20 -7
  3. package/dist/{Button-CNbJT5qV.js → Button-DEA5W6O3.js} +1 -1
  4. package/dist/{HoverCardTrigger-BTAHE6wK.js → HoverCardTrigger-CjSteFgk.js} +2 -2
  5. package/dist/{camera-rJmgxIEn.js → camera-B063QUeM.js} +4 -4
  6. package/dist/components/components.css +3 -1
  7. package/dist/components/ui/fields/otp-field/input-otp.css +48 -0
  8. package/dist/{components-Dxy9DvEe.js → components-CmIOfRO4.js} +13547 -17345
  9. package/dist/components.js +8 -8
  10. package/dist/composables.js +25 -25
  11. package/dist/dnd.js +1 -1
  12. package/dist/fonts/katex/KaTeX_AMS-Regular.woff2 +0 -0
  13. package/dist/fonts/katex/KaTeX_Caligraphic-Bold.woff2 +0 -0
  14. package/dist/fonts/katex/KaTeX_Caligraphic-Regular.woff2 +0 -0
  15. package/dist/fonts/katex/KaTeX_Fraktur-Bold.woff2 +0 -0
  16. package/dist/fonts/katex/KaTeX_Fraktur-Regular.woff2 +0 -0
  17. package/dist/fonts/katex/KaTeX_Main-Bold.woff2 +0 -0
  18. package/dist/fonts/katex/KaTeX_Main-BoldItalic.woff2 +0 -0
  19. package/dist/fonts/katex/KaTeX_Main-Italic.woff2 +0 -0
  20. package/dist/fonts/katex/KaTeX_Main-Regular.woff2 +0 -0
  21. package/dist/fonts/katex/KaTeX_Math-BoldItalic.woff2 +0 -0
  22. package/dist/fonts/katex/KaTeX_Math-Italic.woff2 +0 -0
  23. package/dist/fonts/katex/KaTeX_SansSerif-Bold.woff2 +0 -0
  24. package/dist/fonts/katex/KaTeX_SansSerif-Italic.woff2 +0 -0
  25. package/dist/fonts/katex/KaTeX_SansSerif-Regular.woff2 +0 -0
  26. package/dist/fonts/katex/KaTeX_Script-Regular.woff2 +0 -0
  27. package/dist/fonts/katex/KaTeX_Size1-Regular.woff2 +0 -0
  28. package/dist/fonts/katex/KaTeX_Size2-Regular.woff2 +0 -0
  29. package/dist/fonts/katex/KaTeX_Size3-Regular.woff2 +0 -0
  30. package/dist/fonts/katex/KaTeX_Size4-Regular.woff2 +0 -0
  31. package/dist/fonts/katex/KaTeX_Typewriter-Regular.woff2 +0 -0
  32. package/dist/{form-scope-BhNw4Mm6.js → form-scope-DuDx5Jyx.js} +1 -1
  33. package/dist/{i18n-provider-BPK68eqM.js → i18n-provider-CiVi05fs.js} +1 -1
  34. package/dist/i18n.js +4 -4
  35. package/dist/{icon-button-DXXjxBgr.js → icon-button-CWcOcNHr.js} +1 -1
  36. package/dist/lib/components/ui/fields/attributes/form-schema.d.ts +11 -2
  37. package/dist/lib/components/ui/fields/contacts/consts.d.ts +1 -1
  38. package/dist/lib/components/ui/fields/opening-hours/consts.d.ts +12 -1
  39. package/dist/lib/components/ui/fields/search-field/index.d.ts +2 -1
  40. package/dist/lib/components/ui/primitives/index.d.ts +1 -0
  41. package/dist/lib/components/ui/primitives/nonce-provider/index.d.ts +2 -0
  42. package/dist/lib/components/ui/primitives/nonce-provider/nonce-provider.vue.d.ts +20 -0
  43. package/dist/lib/components/ui/selection/autocomplete/autocomplete-items.d.ts +5 -0
  44. package/dist/lib/components/ui/selection/autocomplete/autocomplete.vue.d.ts +6 -3
  45. package/dist/lib/components/ui/selection/autocomplete/filter-options.d.ts +9 -2
  46. package/dist/lib/components/ui/selection/autocomplete/index.d.ts +1 -0
  47. package/dist/lib/components/ui/selection/autocomplete/partials/autocomplete-list.vue.d.ts +8 -1
  48. package/dist/lib/components/ui/selection/autocomplete/search-types.d.ts +34 -0
  49. package/dist/lib/components/ui/selection/autocomplete/use-autocomplete-items.d.ts +20 -3
  50. package/dist/lib/components/ui/selection/autocomplete/use-autocomplete-list.d.ts +28 -0
  51. package/dist/lib/components/ui/selection/autocomplete/use-autocomplete-search.d.ts +11 -0
  52. package/dist/lib/components/ui/selection/autocomplete/use-autocomplete-status.d.ts +32 -0
  53. package/dist/lib/components/ui/selection/autocomplete/use-autocomplete-texts.d.ts +1 -3
  54. package/dist/lib/components/ui/selection/autocomplete/use-autocomplete.d.ts +10 -5
  55. package/dist/lib/components/ui/selection/radio-group/radio-group-field.vue.d.ts +2 -0
  56. package/dist/lib/composables/index.d.ts +1 -0
  57. package/dist/lib/composables/use-csp-nonce.d.ts +18 -0
  58. package/dist/lib/i18n/resources/en/en.d.ts +4 -0
  59. package/dist/lib/i18n/resources/en/material.json.d.ts +5 -1
  60. package/dist/lib/i18n/resources/fr/fr.d.ts +4 -0
  61. package/dist/lib/i18n/resources/fr/material.json.d.ts +5 -1
  62. package/dist/lib/i18n/resources/resources.d.ts +8 -0
  63. package/dist/lib/i18n/translator.d.ts +1 -1
  64. package/dist/lib/lib/index.d.ts +1 -0
  65. package/dist/lib/nuxt/auto-imports.d.ts +1 -1
  66. package/dist/lib/nuxt/component-names.d.ts +1 -1
  67. package/dist/lib/vite/index.d.ts +3 -2
  68. package/dist/lib.js +50 -49
  69. package/dist/main.js +17 -17
  70. package/dist/map.js +4 -4
  71. package/dist/material-vue.css +1 -1
  72. package/dist/{pdf-outline-sidebar-6pIxLP_o.js → pdf-outline-sidebar-CzY59j_Y.js} +2 -2
  73. package/dist/{pdf-page-list-ojy2YSTr.js → pdf-page-list-BMxNOnPk.js} +2 -2
  74. package/dist/{pdf-page--zE3j8bc.js → pdf-page-nM_fvTHh.js} +1 -1
  75. package/dist/{pdf-reader-CcSJaFFp.js → pdf-reader-Dpv3oWe1.js} +52 -49
  76. package/dist/{pdf-sidebar-8DC9VdCG.js → pdf-sidebar-DkefUgWg.js} +3 -3
  77. package/dist/{pdf-thumbnail-sidebar-BbPcfCYm.js → pdf-thumbnail-sidebar-I6i1lv5J.js} +3 -3
  78. package/dist/{pdf-toolbar-B_MDicKL.js → pdf-toolbar-Da6UMt1O.js} +4 -4
  79. package/dist/pdf.js +2 -2
  80. package/dist/{sortable-provider-Cb3tm9Cy.js → sortable-provider-Cvpqk8tp.js} +2 -2
  81. package/dist/{stored-language-UnInBB6T.js → stored-language-GDRdeYD8.js} +10 -2
  82. package/dist/{stx-player-CjGKQF6K.js → stx-player-CN7Ic8tP.js} +14 -14
  83. package/dist/{translator-J3_vaV_A.js → translator-BDFEmlcL.js} +1 -1
  84. package/dist/{use-heading-spy-_dk8kGwL.js → use-heading-spy-DimKb49j.js} +54 -46
  85. package/dist/{use-material-translation-Do6ztdtV.js → use-material-translation-CaHS6oZz.js} +3 -3
  86. package/dist/vite.js +2 -2
  87. package/docs/README.md +1 -0
  88. package/docs/components/data-display.md +5 -0
  89. package/docs/components/form-fields.md +23 -0
  90. package/docs/components/primitives.md +41 -0
  91. package/docs/components/selection-and-choice.md +75 -4
  92. package/docs/getting-started.md +5 -1
  93. package/docs/guides/csp.md +420 -0
  94. package/docs/guides/helpers.md +3 -1
  95. package/docs/guides/theming.md +27 -0
  96. package/docs/roadmap.md +21 -0
  97. package/docs/troubleshooting.md +217 -0
  98. package/lib/components/components.css +3 -1
  99. package/lib/components/ui/fields/otp-field/input-otp.css +48 -0
  100. package/lib/nuxt/auto-imports.ts +1 -0
  101. package/lib/nuxt/component-names.ts +1 -0
  102. package/lib/vite/index.ts +6 -2
  103. package/package.json +9 -4
  104. package/dist/lib/components/ui/fields/search-field/debounce.d.ts +0 -5
@@ -1,12 +1,23 @@
1
1
  import { z } from 'zod';
2
2
  import { MaterialLocaleKey } from '../../../../i18n/types';
3
3
  import { OpeningHour } from './models';
4
- export declare const OpeningHoursSchema: z.ZodObject<{
4
+ /**
5
+ * The schema of one opening hour: `dayOfWeek` `0`-`6` (coerced from a
6
+ * string), `openTime` and `closeTime` as `HH:mm`, `isClosed`. Built on the
7
+ * first call, then the same schema: nothing is built when the module loads,
8
+ * so an app under a strict CSP can call `z.config({ jitless: true })` first.
9
+ */
10
+ export declare const openingHoursSchema: () => z.ZodObject<{
5
11
  openTime: z.ZodOptional<z.ZodString>;
6
12
  closeTime: z.ZodOptional<z.ZodString>;
7
13
  isClosed: z.ZodOptional<z.ZodBoolean>;
8
14
  dayOfWeek: z.ZodCoercedNumber<unknown>;
9
15
  }, z.core.$strip>;
16
+ /**
17
+ * @deprecated Use `openingHoursSchema()`; removed in 1.0. Built on its first
18
+ * use, and behaves as the schema the factory returns (not the same object).
19
+ */
20
+ export declare const OpeningHoursSchema: ReturnType<typeof openingHoursSchema>;
10
21
  /** English fallback for every `material.opening-hours.days.*` key. */
11
22
  export declare const DAY_OF_WEEK_FALLBACKS: readonly ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
12
23
  /**
@@ -1,4 +1,5 @@
1
- export { debounce } from './debounce';
1
+ export type { Debounced } from '@nxgt/material-core/debounce';
2
+ export { debounce } from '@nxgt/material-core/debounce';
2
3
  export type { SearchFieldProps } from './search-field.vue';
3
4
  export { default as SearchField } from './search-field.vue';
4
5
  export { default as SearchFormField } from './search-form-field.vue';
@@ -10,6 +10,7 @@ export * from './input';
10
10
  export * from './input-group';
11
11
  export * from './kbd';
12
12
  export * from './label';
13
+ export * from './nonce-provider';
13
14
  export * from './scroll-area';
14
15
  export * from './separator';
15
16
  export * from './table';
@@ -0,0 +1,2 @@
1
+ export type { NonceProviderProps } from './nonce-provider.vue';
2
+ export { default as NonceProvider } from './nonce-provider.vue';
@@ -0,0 +1,20 @@
1
+ export type NonceProviderProps = {
2
+ /**
3
+ * This request's Content Security Policy nonce: the one in the
4
+ * `style-src-elem 'nonce-…'` directive (`useNonce()` with nuxt-security).
5
+ */
6
+ nonce?: string;
7
+ };
8
+ declare var __VLS_8: {};
9
+ type __VLS_Slots = {} & {
10
+ default?: (props: typeof __VLS_8) => any;
11
+ };
12
+ declare const __VLS_base: import('vue').DefineComponent<NonceProviderProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<NonceProviderProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
13
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
16
+ type __VLS_WithSlots<T, S> = T & {
17
+ new (): {
18
+ $slots: S;
19
+ };
20
+ };
@@ -15,6 +15,11 @@ export type OptionReaders<T> = {
15
15
  * cast to `T`, as `@nxgt/material` hands it: it has none of your extra fields.
16
16
  */
17
17
  export declare function autocompleteItems<T extends AutocompleteOption>(options: T[], selected: string[], { getOptionValue, getOptionLabel }: OptionReaders<T>): AutocompleteItem<T>[];
18
+ /**
19
+ * The options of `lists`, once each by value: the first list's copy wins its
20
+ * place, a later one only adds what the earlier lack.
21
+ */
22
+ export declare function knownAutocompleteOptions<T extends AutocompleteOption>(lists: T[][], { getOptionValue }: OptionReaders<T>): T[];
18
23
  /** The selection after picking `value`: unchanged (same array) when already in it. */
19
24
  export declare function withPickedValue(mode: 'single' | 'multiple', selected: string[], value: string): string[];
20
25
  /** The `modelValue` a selection emits: the list, or its first value (or `null`). */
@@ -1,3 +1,4 @@
1
+ import { AutocompleteSearchProps } from './search-types';
1
2
  export type AutocompleteOption = {
2
3
  value: string;
3
4
  label: string;
@@ -18,7 +19,8 @@ export type AutocompleteProps<T extends AutocompleteOption = AutocompleteOption>
18
19
  class?: string;
19
20
  name?: string;
20
21
  id?: string;
21
- options: T[];
22
+ /** The options; with `onSearch`, only those to show before a search (the selected ones). */
23
+ options?: T[];
22
24
  mode?: 'single' | 'multiple';
23
25
  freeSolo?: boolean;
24
26
  empty?: string;
@@ -29,10 +31,11 @@ export type AutocompleteProps<T extends AutocompleteOption = AutocompleteOption>
29
31
  getOptionLabel?: (option: T) => string;
30
32
  /** The free-solo button's text for `query`. Defaults to `Add "<query>"`, translated. */
31
33
  freeSoloLabel?: (query: string) => string;
32
- };
34
+ } & AutocompleteSearchProps<T>;
33
35
  declare const __VLS_export: <T extends AutocompleteOption = AutocompleteOption>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
34
36
  props: import('vue').PublicProps & __VLS_PrettifyLocal<AutocompleteProps<T> & {
35
37
  "onUpdate:modelValue"?: ((value: string | string[] | null) => any) | undefined;
38
+ onSearchError?: ((error: unknown) => any) | undefined;
36
39
  onQueryChange?: ((query: string) => any) | undefined;
37
40
  }> & (typeof globalThis extends {
38
41
  __VLS_PROPS_FALLBACK: infer P;
@@ -55,7 +58,7 @@ declare const __VLS_export: <T extends AutocompleteOption = AutocompleteOption>(
55
58
  query: string;
56
59
  }) => unknown;
57
60
  };
58
- emit: ((evt: "update:modelValue", value: string | string[] | null) => void) & ((evt: "queryChange", query: string) => void);
61
+ emit: ((evt: "update:modelValue", value: string | string[] | null) => void) & ((evt: "searchError", error: unknown) => void) & ((evt: "queryChange", query: string) => void);
59
62
  }>) => import('vue').VNode & {
60
63
  __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
61
64
  };
@@ -1,6 +1,13 @@
1
1
  import { AutocompleteOption } from './autocomplete.vue';
2
- /** The options whose label or value holds `query`; any extra fields are kept. */
3
- export declare function filterAutocompleteOptions<O extends AutocompleteOption>(options: O[], query: string): O[];
2
+ import { AutocompleteItem } from './autocomplete-items';
3
+ import { AutocompleteFilter } from './search-types';
4
+ /**
5
+ * The options whose label or value holds `query`, ignoring case and accents
6
+ * (`'e'` keeps "École"), lowercased for `locale`; any extra fields are kept.
7
+ */
8
+ export declare function filterAutocompleteOptions<O extends AutocompleteOption>(options: O[], query: string, locale?: string): O[];
9
+ /** The items `filter` keeps for `query` (trimmed; an empty one keeps all). */
10
+ export declare function filterAutocompleteItems<T>(items: AutocompleteItem<T>[], query: string, filter: AutocompleteFilter<T>, locale?: string): AutocompleteItem<T>[];
4
11
  export declare function selectedAutocompleteValues(mode: 'single' | 'multiple', modelValue?: string | string[] | null): string[];
5
12
  export declare function extraAutocompleteOptions(options: AutocompleteOption[], selected: string[]): {
6
13
  value: string;
@@ -2,3 +2,4 @@ export type { AutocompleteOption, AutocompleteProps } from './autocomplete.vue';
2
2
  export { default as Autocomplete } from './autocomplete.vue';
3
3
  export { default as AutocompleteFormField } from './autocomplete-form-field.vue';
4
4
  export { filterAutocompleteOptions } from './filter-options';
5
+ export type { AutocompleteFilter, AutocompleteSearch, AutocompleteSearchContext, AutocompleteSearchProps, } from './search-types';
@@ -5,7 +5,14 @@ type __VLS_Props = {
5
5
  filtered: AutocompleteItem<unknown>[];
6
6
  selected: string[];
7
7
  canAdd: boolean;
8
- empty: string;
8
+ /** The empty text, when nothing matches and nothing can be added. */
9
+ empty: string | null;
10
+ /** A search is running: the list is `aria-busy` and says so. */
11
+ loading: boolean;
12
+ /** Why the search failed, shown in place of the options. */
13
+ failure: string | null;
14
+ /** The minimum query length `onSearch` waits for, as a sentence. */
15
+ hint: string | null;
9
16
  addLabel: string;
10
17
  };
11
18
  type __VLS_Slots = {
@@ -0,0 +1,34 @@
1
+ /**
2
+ * How the list is filtered as the user types: `'accent-insensitive'` (the
3
+ * default without `onSearch`) keeps the options whose label or value holds
4
+ * the query, ignoring case and accents; `'none'` shows the options as given
5
+ * (the default with `onSearch`, or when you filter on a server); a function
6
+ * decides per option, given the trimmed query (never called for an empty one).
7
+ */
8
+ export type AutocompleteFilter<T> = 'accent-insensitive' | 'none' | ((option: T, query: string) => boolean);
9
+ /** What `onSearch` is handed besides the query: aborted once it is stale. */
10
+ export type AutocompleteSearchContext = {
11
+ signal: AbortSignal;
12
+ };
13
+ /** A server search: the options for `query`. Pass `signal` on to `fetch`. */
14
+ export type AutocompleteSearch<T> = (query: string, context: AutocompleteSearchContext) => Promise<T[]>;
15
+ /** The async and filtering props; see the Autocomplete page of the docs. */
16
+ export type AutocompleteSearchProps<T> = {
17
+ /**
18
+ * Server search (`@search`, a function prop): called once typing pauses
19
+ * (`debounceMs`) with the query and an `AbortSignal`; its results become
20
+ * the list. A response that lands after a newer query's is dropped.
21
+ * `options` then only needs the selected option(s), for their chips.
22
+ */
23
+ onSearch?: AutocompleteSearch<T>;
24
+ /** Controlled loading, when you fetch `options` yourself on `queryChange`. */
25
+ loading?: boolean;
26
+ /** Controlled failure text, shown and announced in place of the options. */
27
+ searchError?: string;
28
+ /** The pause before `onSearch` and `queryChange`, in ms. Default 250. */
29
+ debounceMs?: number;
30
+ /** `onSearch` waits for this many characters. Default 1. */
31
+ minQueryLength?: number;
32
+ /** Default `'accent-insensitive'`, or `'none'` with `onSearch`. */
33
+ filter?: AutocompleteFilter<T>;
34
+ };
@@ -1,15 +1,32 @@
1
+ import { AsyncSearchState } from '@nxgt/material-core/async-search';
1
2
  import { Ref } from 'vue';
2
3
  import { AutocompleteOption } from './autocomplete.vue';
3
4
  import { OptionReaders } from './autocomplete-items';
5
+ import { AutocompleteFilter } from './search-types';
4
6
  export type AutocompleteItemsOptions<T> = OptionReaders<T> & {
5
- options: T[];
7
+ options?: T[];
6
8
  mode: 'single' | 'multiple';
7
9
  modelValue?: string | string[] | null;
10
+ filter?: AutocompleteFilter<T>;
8
11
  };
9
- /** The selected values, every item, the ones the query keeps, and the selected ones. */
10
- export declare function useAutocompleteItems<T extends AutocompleteOption>(props: AutocompleteItemsOptions<T>, query: Readonly<Ref<string>>): {
12
+ type Lists<T> = {
13
+ query: Readonly<Ref<string>>;
14
+ /** `onSearch`'s state, `null` without it. */
15
+ search: Readonly<Ref<AsyncSearchState<T> | null>>;
16
+ /** The provider's language, which the accent-insensitive filter lowercases for. */
17
+ locale: () => string | undefined;
18
+ };
19
+ /**
20
+ * The selected values; every item a value may stand for (`options`, the
21
+ * search results, the options picked so far, then the free-solo values);
22
+ * the list the query keeps; and the selected items. A picked option keeps
23
+ * its chip once a new search no longer returns it.
24
+ */
25
+ export declare function useAutocompleteItems<T extends AutocompleteOption>(props: AutocompleteItemsOptions<T>, { query, search, locale }: Lists<T>): {
11
26
  selectedValues: import('vue').ComputedRef<string[]>;
12
27
  allItems: import('vue').ComputedRef<import('./autocomplete-items').AutocompleteItem<T>[]>;
13
28
  filtered: import('vue').ComputedRef<import('./autocomplete-items').AutocompleteItem<T>[]>;
14
29
  selectedItems: import('vue').ComputedRef<import('./autocomplete-items').AutocompleteItem<T>[]>;
30
+ remember: (value: string) => void;
15
31
  };
32
+ export {};
@@ -0,0 +1,28 @@
1
+ import { Ref } from 'vue';
2
+ import { AutocompleteOption } from './autocomplete.vue';
3
+ import { AutocompleteSearchProps } from './search-types';
4
+ import { AutocompleteItemsOptions } from './use-autocomplete-items';
5
+ export type AutocompleteListOptions<T> = AutocompleteItemsOptions<T> & Omit<AutocompleteSearchProps<T>, 'filter'> & {
6
+ freeSolo: boolean;
7
+ empty?: string;
8
+ };
9
+ /**
10
+ * The list behind the field: `onSearch`'s state, the items and the ones the
11
+ * query keeps, and what the list says (loading, failure, hint, empty text,
12
+ * the polite announcement).
13
+ */
14
+ export declare function useAutocompleteList<T extends AutocompleteOption>(props: AutocompleteListOptions<T>, query: Readonly<Ref<string>>, open: Readonly<Ref<boolean>>, onSearchError: (error: unknown) => void): {
15
+ status: {
16
+ loading: import('vue').ComputedRef<boolean>;
17
+ failure: import('vue').ComputedRef<string | null>;
18
+ hint: import('vue').ComputedRef<string | null>;
19
+ emptyText: import('vue').ComputedRef<string | null>;
20
+ announcement: import('vue').ComputedRef<string>;
21
+ };
22
+ debounceMs: () => number;
23
+ selectedValues: import('vue').ComputedRef<string[]>;
24
+ allItems: import('vue').ComputedRef<import('./autocomplete-items').AutocompleteItem<T>[]>;
25
+ filtered: import('vue').ComputedRef<import('./autocomplete-items').AutocompleteItem<T>[]>;
26
+ selectedItems: import('vue').ComputedRef<import('./autocomplete-items').AutocompleteItem<T>[]>;
27
+ remember: (value: string) => void;
28
+ };
@@ -0,0 +1,11 @@
1
+ import { AsyncSearchState } from '@nxgt/material-core/async-search';
2
+ import { Ref } from 'vue';
3
+ import { AutocompleteSearchProps } from './search-types';
4
+ type SearchProps<T> = Pick<AutocompleteSearchProps<T>, 'onSearch' | 'debounceMs' | 'minQueryLength'>;
5
+ /**
6
+ * `onSearch`'s state while the list is open: searched once typing pauses,
7
+ * each run aborting the last, and a stale response dropped (core's
8
+ * `createAsyncSearch`). `null` without `onSearch`.
9
+ */
10
+ export declare function useAutocompleteSearch<T>(props: SearchProps<T>, query: Readonly<Ref<string>>, open: Readonly<Ref<boolean>>, onError: (error: unknown) => void): import('vue').ComputedRef<AsyncSearchState<T> | null>;
11
+ export {};
@@ -0,0 +1,32 @@
1
+ import { AsyncSearchState } from '@nxgt/material-core/async-search';
2
+ import { Ref } from 'vue';
3
+ type StatusProps = {
4
+ loading?: boolean;
5
+ searchError?: string;
6
+ empty?: string;
7
+ freeSolo: boolean;
8
+ minQueryLength?: number;
9
+ };
10
+ type List = {
11
+ query: Readonly<Ref<string>>;
12
+ open: Readonly<Ref<boolean>>;
13
+ /** `onSearch`'s state, `null` without it. */
14
+ search: Readonly<Ref<AsyncSearchState<unknown> | null>>;
15
+ /** How many options the list shows for the query. */
16
+ count: Readonly<Ref<number>>;
17
+ debounceMs: () => number;
18
+ };
19
+ /**
20
+ * What the list says besides its options — loading, a failure, the minimum
21
+ * query length, the empty text — and the polite announcement: "Loading…",
22
+ * then the count once the search answered or typing paused, never on every
23
+ * keystroke.
24
+ */
25
+ export declare function useAutocompleteStatus(props: StatusProps, list: List): {
26
+ loading: import('vue').ComputedRef<boolean>;
27
+ failure: import('vue').ComputedRef<string | null>;
28
+ hint: import('vue').ComputedRef<string | null>;
29
+ emptyText: import('vue').ComputedRef<string | null>;
30
+ announcement: import('vue').ComputedRef<string>;
31
+ };
32
+ export {};
@@ -2,13 +2,11 @@ import { Ref } from 'vue';
2
2
  import { AutocompleteItem } from './autocomplete-items';
3
3
  type Options = {
4
4
  freeSolo: boolean;
5
- empty?: string;
6
5
  freeSoloLabel?: (query: string) => string;
7
6
  };
8
- /** Whether the typed text can be added (free solo), and the list's two texts. */
7
+ /** Whether the typed text can be added (free solo), and the button's text. */
9
8
  export declare function useAutocompleteTexts<T>(props: Options, query: Ref<string>, items: Readonly<Ref<AutocompleteItem<T>[]>>): {
10
9
  canAddFreeSolo: import('vue').ComputedRef<boolean>;
11
- emptyText: import('vue').ComputedRef<string>;
12
10
  addLabel: import('vue').ComputedRef<string>;
13
11
  };
14
12
  export {};
@@ -1,26 +1,31 @@
1
1
  import { Ref } from 'vue';
2
2
  import { AutocompleteOption } from './autocomplete.vue';
3
- import { AutocompleteItemsOptions } from './use-autocomplete-items';
4
- type Options<T> = AutocompleteItemsOptions<T> & {
5
- freeSolo: boolean;
3
+ import { AutocompleteListOptions } from './use-autocomplete-list';
4
+ type Options<T> = AutocompleteListOptions<T> & {
6
5
  disabled?: boolean;
7
- empty?: string;
8
6
  freeSoloLabel?: (query: string) => string;
9
7
  };
10
8
  type Emit = {
11
9
  (event: 'update:modelValue', value: string | string[] | null): void;
12
10
  (event: 'queryChange', query: string): void;
11
+ (event: 'searchError', error: unknown): void;
13
12
  };
14
13
  /** Autocomplete's state and actions; the SFC only lays them out. */
15
14
  export declare function useAutocomplete<T extends AutocompleteOption>(props: Options<T>, emit: Emit, root: Readonly<Ref<HTMLElement | null>>, box: Readonly<Ref<{
16
15
  focus: () => void;
17
16
  } | null>>): {
17
+ status: {
18
+ loading: import('vue').ComputedRef<boolean>;
19
+ failure: import('vue').ComputedRef<string | null>;
20
+ hint: import('vue').ComputedRef<string | null>;
21
+ emptyText: import('vue').ComputedRef<string | null>;
22
+ announcement: import('vue').ComputedRef<string>;
23
+ };
18
24
  pick: (value: string) => void;
19
25
  remove: (value: string) => void;
20
26
  addFreeSolo: () => void;
21
27
  onKeydown: (event: KeyboardEvent) => void;
22
28
  canAddFreeSolo: import('vue').ComputedRef<boolean>;
23
- emptyText: import('vue').ComputedRef<string>;
24
29
  addLabel: import('vue').ComputedRef<string>;
25
30
  query: Ref<string, string>;
26
31
  selectedValues: import('vue').ComputedRef<string[]>;
@@ -2,6 +2,8 @@ import { HTMLAttributes } from 'vue';
2
2
  export type RadioGroupOption = {
3
3
  value: string;
4
4
  label: string;
5
+ /** Rendered and announced as disabled, skipped by the arrow keys. */
6
+ disabled?: boolean;
5
7
  };
6
8
  export type RadioGroupFieldProps = {
7
9
  options: RadioGroupOption[];
@@ -1,5 +1,6 @@
1
1
  export * from './resolve-theme';
2
2
  export * from './use-allowed-transitions';
3
+ export { useCspNonce } from './use-csp-nonce';
3
4
  export * from './use-formatters';
4
5
  export * from './use-heading-spy';
5
6
  export * from './use-is-client';
@@ -0,0 +1,18 @@
1
+ import { ComputedRef, InjectionKey, Ref } from 'vue';
2
+ /**
3
+ * The page's CSP nonce, provided by `NonceProvider`. Internal: read it with
4
+ * `useCspNonce`.
5
+ */
6
+ export declare const CSP_NONCE_KEY: InjectionKey<Ref<string | undefined>>;
7
+ /** How many `NonceProvider`s enclose a component. Internal. */
8
+ export declare const CSP_NONCE_DEPTH_KEY: InjectionKey<number>;
9
+ /**
10
+ * The CSP nonce of the nearest `NonceProvider`, else of reka's nearest
11
+ * `ConfigProvider`, for a `<style>` (or `<script>`) a component creates. Call
12
+ * it in `setup`.
13
+ *
14
+ * `undefined` without either. It never reads the page, so the server and the
15
+ * client render the same attribute; code that runs once mounted can fall back
16
+ * to `getCspNonce()` (from `/lib`).
17
+ */
18
+ export declare function useCspNonce(): ComputedRef<string | undefined>;
@@ -798,6 +798,10 @@ export declare const en: {
798
798
  autocomplete: {
799
799
  empty: string;
800
800
  add: string;
801
+ loading: string;
802
+ results: string;
803
+ "search-error": string;
804
+ "min-query": string;
801
805
  };
802
806
  avatar: {
803
807
  online: string;
@@ -787,7 +787,11 @@ declare const _default: {
787
787
  },
788
788
  "autocomplete": {
789
789
  "empty": "No option found.",
790
- "add": "Add \"{query}\""
790
+ "add": "Add \"{query}\"",
791
+ "loading": "Loading…",
792
+ "results": "{count, plural, =0 {No results} one {# result} other {# results}}",
793
+ "search-error": "The search failed. Try again.",
794
+ "min-query": "Type at least {count, plural, one {# character} other {# characters}} to search."
791
795
  },
792
796
  "avatar": {
793
797
  "online": "Online",
@@ -798,6 +798,10 @@ export declare const fr: {
798
798
  autocomplete: {
799
799
  empty: string;
800
800
  add: string;
801
+ loading: string;
802
+ results: string;
803
+ "search-error": string;
804
+ "min-query": string;
801
805
  };
802
806
  avatar: {
803
807
  online: string;
@@ -787,7 +787,11 @@ declare const _default: {
787
787
  },
788
788
  "autocomplete": {
789
789
  "empty": "Aucune option.",
790
- "add": "Ajouter « {query} »"
790
+ "add": "Ajouter « {query} »",
791
+ "loading": "Chargement…",
792
+ "results": "{count, plural, =0 {Aucun résultat} one {# résultat} other {# résultats}}",
793
+ "search-error": "La recherche a échoué. Réessayez.",
794
+ "min-query": "Saisissez au moins {count, plural, one {# caractère} other {# caractères}} pour rechercher."
791
795
  },
792
796
  "avatar": {
793
797
  "online": "En ligne",
@@ -796,6 +796,10 @@ export declare const resources: {
796
796
  autocomplete: {
797
797
  empty: string;
798
798
  add: string;
799
+ loading: string;
800
+ results: string;
801
+ "search-error": string;
802
+ "min-query": string;
799
803
  };
800
804
  avatar: {
801
805
  online: string;
@@ -2051,6 +2055,10 @@ export declare const resources: {
2051
2055
  autocomplete: {
2052
2056
  empty: string;
2053
2057
  add: string;
2058
+ loading: string;
2059
+ results: string;
2060
+ "search-error": string;
2061
+ "min-query": string;
2054
2062
  };
2055
2063
  avatar: {
2056
2064
  online: string;