@nxgt/material 2.11.1 → 2.13.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 +38 -0
  2. package/README.md +1 -1
  3. package/dist/{_Uint8Array-azThpjEP.js → _Uint8Array-QCcRMhXd.js} +1 -1
  4. package/dist/{_overRest-DMn4Dt71.js → _overRest-C21ZmKyH.js} +1 -1
  5. package/dist/{async-slice-DhZDjEtw.js → async-slice-TBZ6Taw2.js} +2 -2
  6. package/dist/{blockDiagram-BEXU5L5S-CDfO7C_5.js → blockDiagram-BEXU5L5S-CQaNV8rX.js} +2 -2
  7. package/dist/{chunk-3FUC2YCW-DX6GTgi6.js → chunk-3FUC2YCW-DmtO_Y9L.js} +2 -2
  8. package/dist/{chunk-7M6MHVWA-DTELAJpl.js → chunk-7M6MHVWA-BQ0cJz5u.js} +1 -1
  9. package/dist/{chunk-GNY47TPC-DHf7k1Oo.js → chunk-GNY47TPC-DiVMvIit.js} +4 -4
  10. package/dist/{chunk-NETBCI7D-CxCnFTsw.js → chunk-NETBCI7D-B5Av2fJk.js} +1 -1
  11. package/dist/{chunk-Z7XXMR3K-B7iHRZcb.js → chunk-Z7XXMR3K-D4uKosJW.js} +1 -1
  12. package/dist/{classDiagram-v2-NBCMYWYE-CSaKhTA1.js → classDiagram-v2-NBCMYWYE-BYktffst.js} +2 -2
  13. package/dist/{components-Z9FC6CY-.js → components-C-y3kTRm.js} +23668 -23488
  14. package/dist/components.js +5 -5
  15. package/dist/{dagre-6A5THRUB-Bk4P7elf.js → dagre-6A5THRUB-BvQAvoOX.js} +11 -11
  16. package/dist/{diagram-22UHCM2B-CcBy66NF.js → diagram-22UHCM2B-BYd0lEdS.js} +2 -2
  17. package/dist/{diagram-3UASUU5V-DauW2GeC.js → diagram-3UASUU5V-B3ndNq2p.js} +1 -1
  18. package/dist/dnd.js +1 -1
  19. package/dist/{elk-276RUBZZ-DB8zFfHZ.js → elk-276RUBZZ-BxXn1nvc.js} +3 -3
  20. package/dist/{erDiagram-OPXOYQCR-DO6SpxA4.js → erDiagram-OPXOYQCR-DjYy4h_r.js} +2 -2
  21. package/dist/{field-blur-DgfIJceK.js → field-blur-V8o79CDN.js} +1 -1
  22. package/dist/{flowDiagram-KWPJA3E3-DewDNLd0.js → flowDiagram-KWPJA3E3-BD7xvcMh.js} +3 -3
  23. package/dist/{ganttDiagram-FUAMR5RP-B845QbUZ.js → ganttDiagram-FUAMR5RP-BAuk7X6i.js} +1 -1
  24. package/dist/{graphlib-DLjE3QPd.js → graphlib-CbcZi5bx.js} +6 -6
  25. package/dist/hooks.js +2 -2
  26. package/dist/{i18n-provider-CQL7fqLy.js → i18n-provider-D5hkauu6.js} +1 -1
  27. package/dist/i18n.js +6 -6
  28. package/dist/{isArrayLikeObject-CO-5KAzG.js → isArrayLikeObject-COiPdhFP.js} +3 -3
  29. package/dist/{isEmpty-Bl1drJE7.js → isEmpty-B7UlCLih.js} +3 -3
  30. package/dist/{journeyDiagram-ZHPQQLJL-DVX8uCK8.js → journeyDiagram-ZHPQQLJL-h2S56BMC.js} +1 -1
  31. package/dist/lib/components/ui/fields/search-field/index.d.ts +2 -2
  32. package/dist/lib/components/ui/selection/autocomplete/autocomplete.d.ts +2 -34
  33. package/dist/lib/components/ui/selection/autocomplete/partials/autocomplete-announcer.d.ts +10 -0
  34. package/dist/lib/components/ui/selection/autocomplete/partials/autocomplete-chips.d.ts +8 -3
  35. package/dist/lib/components/ui/selection/autocomplete/partials/autocomplete-list-status.d.ts +13 -0
  36. package/dist/lib/components/ui/selection/autocomplete/partials/autocomplete-popup.d.ts +26 -0
  37. package/dist/lib/components/ui/selection/autocomplete/types.d.ts +72 -0
  38. package/dist/lib/components/ui/selection/autocomplete/use-autocomplete-filter.d.ts +13 -0
  39. package/dist/lib/components/ui/selection/autocomplete/use-autocomplete-handlers.d.ts +17 -0
  40. package/dist/lib/components/ui/selection/autocomplete/use-autocomplete-search.d.ts +8 -0
  41. package/dist/lib/components/ui/selection/autocomplete/use-autocomplete-status.d.ts +28 -0
  42. package/dist/lib/components/ui/selection/autocomplete/use-autocomplete-values.d.ts +27 -0
  43. package/dist/lib/components/ui/selection/autocomplete/use-autocomplete.d.ts +29 -0
  44. package/dist/lib/components/ui/selection/radio-group/radio-group.d.ts +7 -4
  45. package/dist/lib/components/ui/selection/select-chip-field/select-chip-field.d.ts +8 -3
  46. package/dist/lib/i18n/resources/en/en.d.ts +4 -0
  47. package/dist/lib/i18n/resources/en/material.json.d.ts +5 -1
  48. package/dist/lib/i18n/resources/fr/fr.d.ts +4 -0
  49. package/dist/lib/i18n/resources/fr/material.json.d.ts +5 -1
  50. package/dist/lib/i18n/resources/resources.d.ts +8 -0
  51. package/dist/lib/i18n/translator.d.ts +1 -1
  52. package/dist/lib.js +3 -3
  53. package/dist/main.js +11 -11
  54. package/dist/map.js +2 -2
  55. package/dist/{merge-CwwtONfp.js → merge-KEf_u3Zy.js} +4 -4
  56. package/dist/{mermaid.core-0q3uq37S.js → mermaid.core-BWF4Tq7X.js} +21 -21
  57. package/dist/{mindmap-definition-NLK3R4M7-BU79I9UY.js → mindmap-definition-NLK3R4M7-Q-4J7KMu.js} +2 -2
  58. package/dist/{pieDiagram-5QR66LMP-DGVDzpXW.js → pieDiagram-5QR66LMP-BIxQ164y.js} +1 -1
  59. package/dist/print.js +2 -2
  60. package/dist/{quadrantDiagram-O4NWA36T-CAgci1ex.js → quadrantDiagram-O4NWA36T-BlI0otnv.js} +1 -1
  61. package/dist/{requirementDiagram-PLB6GJNP-CDOjIVlE.js → requirementDiagram-PLB6GJNP-CuVPUh0S.js} +2 -2
  62. package/dist/{sankeyDiagram-IPEJSGJF-DCbUg-Vu.js → sankeyDiagram-IPEJSGJF-Cke5i_9w.js} +1 -1
  63. package/dist/{sortable-provider-D4S-mqLP.js → sortable-provider-C8mr3XP2.js} +1 -1
  64. package/dist/{stateDiagram-v2-GCMORJYK-C3WWpb0o.js → stateDiagram-v2-GCMORJYK-CT53U-pL.js} +2 -2
  65. package/dist/{stored-language-BW32owje.js → stored-language-g121Yv0w.js} +10 -2
  66. package/dist/{swimlanes-2SLR337P-CtayEq5L.js → swimlanes-2SLR337P-BwEtm09G.js} +3 -3
  67. package/dist/{swimlanesDiagram-TC7HE7FX-yV5ARDns.js → swimlanesDiagram-TC7HE7FX-36JXV6X2.js} +3 -3
  68. package/dist/{timeline-definition-EJHVYXUP-BKuUPBMr.js → timeline-definition-EJHVYXUP-BeX-S1oM.js} +1 -1
  69. package/dist/{translate-material-ZEzF-LKH.js → translate-material-D3Hp_AI5.js} +2 -2
  70. package/dist/{translator-BfqVlNGW.js → translator-BMFC0lBV.js} +1 -1
  71. package/dist/{use-heading-spy-DvZVu15k.js → use-heading-spy--7KHY3lw.js} +2 -2
  72. package/dist/{use-material-translation-B2GUtxUY.js → use-material-translation-BGFp1yXp.js} +2 -2
  73. package/dist/{usecaseDiagram-POWQR4AR-ClgRhO0q.js → usecaseDiagram-POWQR4AR-Dfd0rXLr.js} +2 -2
  74. package/dist/{xychartDiagram-PMCCYNJV-BVKAUhvv.js → xychartDiagram-PMCCYNJV-D0UPPflL.js} +1 -1
  75. package/docs/components/selection-and-choice.md +76 -4
  76. package/docs/roadmap.md +4 -0
  77. package/docs/troubleshooting.md +98 -0
  78. package/package.json +7 -2
  79. package/dist/lib/components/ui/fields/search-field/debounce.d.ts +0 -5
@@ -120,6 +120,7 @@ words in your error.
120
120
  - [A `TimeFormField` shows its error on a desktop but not on a phone](#a-timeformfield-shows-its-error-on-a-desktop-but-not-on-a-phone)
121
121
  - [`setError(…, { shouldFocus: true })` or a failed submit does not focus the field](#seterror--shouldfocus-true--or-a-failed-submit-does-not-focus-the-field)
122
122
  - [A test that finds a chip by `aria-selected` or `getByRole('option')` no longer finds it](#a-test-that-finds-a-chip-by-aria-selected-or-getbyroleoption-no-longer-finds-it)
123
+ - [The `ref` of a `SelectChipField` focuses nothing](#the-ref-of-a-selectchipfield-focuses-nothing)
123
124
  - [`touchedFields` stays empty after leaving a field, or `mode: 'onBlur'` never validates](#touchedfields-stays-empty-after-leaving-a-field-or-mode-onblur-never-validates)
124
125
  - [`TypeError: values.map is not a function` (a `SliderFormField`)](#typeerror-valuesmap-is-not-a-function)
125
126
  - [An end-to-end test no longer finds `aria-expanded` on a `ResponsiveButton`](#an-end-to-end-test-no-longer-finds-aria-expanded-on-a-responsivebutton)
@@ -139,6 +140,9 @@ words in your error.
139
140
  - [A test no longer finds `aria-invalid` on an upload field's group or drop zone](#a-test-no-longer-finds-aria-invalid-on-an-upload-fields-group-or-drop-zone)
140
141
  - [A test no longer finds `aria-invalid` on a `CheckboxGroup`](#a-test-no-longer-finds-aria-invalid-on-a-checkboxgroup)
141
142
  - [A test no longer finds `aria-invalid` on a `Switch` row or an `Autocomplete`'s chips](#a-test-no-longer-finds-aria-invalid-on-a-switch-row-or-an-autocompletes-chips)
143
+ - [An `Autocomplete` lists more options than before, or "ecole" finds "École"](#an-autocomplete-lists-more-options-than-before-or-ecole-finds-école)
144
+ - [`onQueryChange` runs more often after upgrading](#onquerychange-runs-more-often-after-upgrading)
145
+ - [An older search's results replace the newer ones in an `Autocomplete`](#an-older-searchs-results-replace-the-newer-ones-in-an-autocomplete)
142
146
  - [A test no longer finds `aria-invalid` on an `OtpField` slot](#a-test-no-longer-finds-aria-invalid-on-an-otpfield-slot)
143
147
  - [A test no longer finds the breadcrumb's home button](#a-test-no-longer-finds-the-breadcrumbs-home-button)
144
148
  - [A test no longer finds a sidebar entry by the `button` role](#a-test-no-longer-finds-a-sidebar-entry-by-the-button-role)
@@ -150,6 +154,7 @@ words in your error.
150
154
  - [A test no longer finds a calendar day by its number, or by "Today" or "selected"](#a-test-no-longer-finds-a-calendar-day-by-its-number-or-by-today-or-selected)
151
155
  - [`#<name>` no longer finds a `SwitchFormField` or `CheckboxFormField`](#name-no-longer-finds-a-switchformfield-or-checkboxformfield)
152
156
  - [`#<name>` or `#<option value>` no longer finds a radio or checkbox group or one of its options](#name-or-option-value-no-longer-finds-a-radio-or-checkbox-group-or-one-of-its-options)
157
+ - [One option of a `RadioGroup` cannot be disabled](#one-option-of-a-radiogroup-cannot-be-disabled)
153
158
  - [`#<name>` no longer finds a text, OTP, number, date or picker form field, or a second form's field has no name](#name-no-longer-finds-a-text-otp-number-date-or-picker-form-field-or-a-second-forms-field-has-no-name)
154
159
  - [A double click or Enter submits a form twice, or a test finds `aria-busy` in an idle `Button`](#a-double-click-or-enter-submits-a-form-twice-or-a-test-finds-aria-busy-in-an-idle-button)
155
160
  - [An empty `UploadField` or `TimeField` is no longer tinted](#an-empty-uploadfield-or-timefield-is-no-longer-tinted)
@@ -2152,6 +2157,22 @@ const design = within(topics).getByRole('button', { name: 'Design' });
2152
2157
  expect(design).toHaveAttribute('aria-pressed', 'true');
2153
2158
  ```
2154
2159
 
2160
+ ### The `ref` of a `SelectChipField` focuses nothing
2161
+
2162
+ **When:** `ref.current?.focus()` on a `SelectChipField`, or React Hook Form's
2163
+ `setFocus(name)` on a `SelectChipFormField`, leaves focus where it was, or
2164
+ lands on the first chip when one is chosen. Before the release that lists
2165
+ this fix only.
2166
+ **Why:** the `ref` is the `role="group"` element, which a browser cannot
2167
+ focus; the chips are the focusable controls.
2168
+ **Fix:** upgrade: the `ref` now reaches the chosen chip, else the first, as a
2169
+ radio group does (type `Ref<HTMLButtonElement>`). Temporary, until
2170
+ material #502: on an older release, focus the chip yourself.
2171
+
2172
+ ```tsx
2173
+ group.current?.querySelector<HTMLElement>('[aria-pressed="true"], button')?.focus();
2174
+ ```
2175
+
2155
2176
  ### `touchedFields` stays empty after leaving a field, or `mode: 'onBlur'` never validates
2156
2177
 
2157
2178
  **When:** a `*FormField` keeps `formState.touchedFields` (and
@@ -2657,6 +2678,60 @@ await expect(page.getByRole('switch', { name: 'Notifications' })).toHaveAttribut
2657
2678
  await expect(page.getByRole('combobox', { name: 'Country' })).toHaveAttribute('aria-invalid', 'true');
2658
2679
  ```
2659
2680
 
2681
+ ### An `Autocomplete` lists more options than before, or "ecole" finds "École"
2682
+
2683
+ **When:** after upgrading to 2.12.0, typing in an `Autocomplete` with local
2684
+ `options` keeps options it used to drop: `e` keeps "Évry", `orle` keeps
2685
+ "Orléans".
2686
+ **Why:** local matching is now accent-insensitive by default (`filter`
2687
+ defaults to `'accent-insensitive'`): the label or value and the query are
2688
+ both lowercased in the provider's language and stripped of their accents
2689
+ before they are compared. Before, an accent had to be typed to match.
2690
+ **Fix:** nothing, if that is what your users expect. To match as before,
2691
+ pass your own `filter`; to show `options` exactly as you give them (they are
2692
+ filtered on your server), pass `filter="none"`:
2693
+
2694
+ ```tsx
2695
+ // Back to a plain case-insensitive match, accents counted:
2696
+ <Autocomplete
2697
+ mode="single"
2698
+ options={options}
2699
+ value={value}
2700
+ filter={(option, query) => option.label.toLowerCase().includes(query.toLowerCase())}
2701
+ />
2702
+ ```
2703
+
2704
+ ### `onQueryChange` runs more often after upgrading
2705
+
2706
+ **When:** after upgrading to 2.12.0, `onQueryChange` is called sooner after the
2707
+ user stops typing, so a server you fetch from there gets more requests.
2708
+ **Why:** the pause it waits for is now `debounceMs`, 250 ms by default; it
2709
+ was a fixed 1 s.
2710
+ **Fix:** set the pause you had, `debounceMs={1000}`, or move the fetch to `onSearch`, which
2711
+ also aborts the previous request and drops a stale response.
2712
+
2713
+ ### An older search's results replace the newer ones in an `Autocomplete`
2714
+
2715
+ **When:** you fetch `options` yourself from `onQueryChange`, and a slow response
2716
+ for an earlier query lands after a faster one for the latest: the list shows
2717
+ the results of what the user typed before.
2718
+ **Why:** each of your requests resolves whenever the server answers, and
2719
+ the last one to resolve wins.
2720
+ **Fix:** use `onSearch`. It hands each search an `AbortSignal` (pass it to
2721
+ `fetch`), aborts the previous search, and drops any response that lands for
2722
+ an older query, even from an API that ignores the signal:
2723
+
2724
+ ```tsx
2725
+ <Autocomplete
2726
+ mode="single"
2727
+ value={value}
2728
+ onValueChange={(next) => setValue(next ?? '')}
2729
+ onSearch={(query, { signal }) =>
2730
+ fetch(`/api/people?q=${encodeURIComponent(query)}`, { signal }).then((r) => r.json())
2731
+ }
2732
+ />
2733
+ ```
2734
+
2660
2735
  ### A test no longer finds `aria-invalid` on an `OtpField` slot
2661
2736
 
2662
2737
  **When:** `[data-slot="input-otp-slot"][aria-invalid]` (or
@@ -2867,6 +2942,29 @@ await page.locator('#married').getByRole('radio', { name: 'Yes' }).check();
2867
2942
  await page.locator('#married-0').check(); // the first option
2868
2943
  ```
2869
2944
 
2945
+ ### One option of a `RadioGroup` cannot be disabled
2946
+
2947
+ **When:** you need one choice greyed out (a person already linked, a plan the
2948
+ account cannot take) and `disabled` on the group disables all of them. Before
2949
+ this release the options had no `disabled`, so apps listed the unavailable ones
2950
+ apart or hand-built the group from `RadioGroupItem`.
2951
+ **Why:** an option was only `{ value, label }`; `disabled` was the group's.
2952
+ **Fix:** upgrade, and set `disabled` on the option. It is rendered and
2953
+ announced as disabled, its label is muted (still 4.5:1) and the arrow keys
2954
+ skip it; the group's own `disabled` still disables every option. An option
2955
+ that is disabled while it is the current `value` stays checked, as in the
2956
+ Radix and Reka primitives:
2957
+
2958
+ ```tsx
2959
+ <RadioGroup
2960
+ label="Person"
2961
+ options={[
2962
+ { value: 'ada', label: 'Ada' },
2963
+ { value: 'bob', label: 'Bob (already linked)', disabled: true },
2964
+ ]}
2965
+ />
2966
+ ```
2967
+
2870
2968
  ### `#<name>` no longer finds a text, OTP, number, date or picker form field, or a second form's field has no name
2871
2969
 
2872
2970
  **When:** two forms on one page have a field with the same `name` (a sign-in
package/package.json CHANGED
@@ -1,10 +1,15 @@
1
1
  {
2
2
  "name": "@nxgt/material",
3
- "version": "2.11.1",
3
+ "version": "2.13.0",
4
4
  "license": "MIT",
5
5
  "bugs": {
6
6
  "email": "stevegires@gmail.com"
7
7
  },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/softistx/nxgt-material.git",
11
+ "directory": "packages/material"
12
+ },
8
13
  "type": "module",
9
14
  "files": [
10
15
  "dist",
@@ -114,7 +119,7 @@
114
119
  "docs:previews": "vitest run --project previews"
115
120
  },
116
121
  "dependencies": {
117
- "@nxgt/material-core": "^0.7.1",
122
+ "@nxgt/material-core": "^0.8.0",
118
123
  "@base-ui/react": "^1.6.0",
119
124
  "@dnd-kit/core": "^6.3.1",
120
125
  "@dnd-kit/sortable": "^10.0.0",
@@ -1,5 +0,0 @@
1
- export type Debounced<Args extends unknown[]> = ((...args: Args) => void) & {
2
- cancel: () => void;
3
- flush: () => void;
4
- };
5
- export declare function debounce<Args extends unknown[]>(fn: (...args: Args) => void, ms: number): Debounced<Args>;