@nxgt/material 3.72.0 → 3.73.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.
@@ -375,6 +375,15 @@ up / down buttons, `min` and `max` rows (Remove is disabled at `min`, Add is
375
375
  announcements. Without a form library, `ChoiceListField` takes `value` and
376
376
  `onChange`.
377
377
 
378
+ **Focus.** `ChoiceListFormField` gives React Hook Form's `field.ref` a handle
379
+ that focuses the first refused row's text input: the row of the first
380
+ `choices.<i>.text` error (a resolver's), or the first blank row when the
381
+ built-in blank rule refused the list. An error on the list itself (too few
382
+ rows, no row marked) focuses its first control. So `shouldFocusError`,
383
+ `setFocus('choices')` and `setError('choices', …, { shouldFocus: true })` land
384
+ on the refused row when there is an error, and on the first control otherwise;
385
+ the form needs no `[aria-invalid="true"]` lookup.
386
+
378
387
  | Prop | Type | Default | What it does |
379
388
  | --- | --- | --- | --- |
380
389
  | `control`, `name` | `Control<T>`, `Path<T>` | — | the form and its array (`ChoiceListFormField`) |
@@ -163,7 +163,8 @@ import {
163
163
  Parts: `Card`, `CardHeader`, `CardTitle`, `CardDescription`, `CardAction`,
164
164
  `CardContent`, `CardFooter` — each a styled `<div>` taking its element's props,
165
165
  except `CardTitle`, a heading: an `h3` by default, another level or a `div`
166
- with `as` (`<CardTitle as="h2">`), so `getByRole('heading', { name })` finds it.
166
+ with `as` (`<CardTitle as="h2">`), so `getByRole('heading', { name })` finds it. The title takes its text size's
167
+ line height; pass a `leading-*` class to override.
167
168
  `CardAction` sits top-right of the header.
168
169
 
169
170
  **Storybook:** `Primitives/Card` · **Vue:** `Card` (same parts)
@@ -436,8 +436,10 @@ disabled with the field; Backspace in the empty input removes the last one.
436
436
  Enter in a form: it acts on the list and does not submit the form while it has
437
437
  something to do (WAI-ARIA combobox practice). It picks the highlighted option;
438
438
  with `freeSolo` and no option highlighted it adds the typed text; with the list
439
- open it is only default-prevented. On a closed list with nothing typed it
440
- submits, as a plain input does.
439
+ open it is only default-prevented. In `mode="multiple"` (a tags box, `freeSolo`
440
+ or not) Enter never submits the form, closed list and empty input included, so
441
+ the Enter after a pick does not save the form. In `single` mode, on a closed
442
+ list with nothing typed it submits, as a plain input does.
441
443
 
442
444
  An avatar in the rows and the chips:
443
445
  `getOptionLeading={(person) => <Avatar src={person.photo} alt="" />}`; see
@@ -313,6 +313,7 @@ words in your error.
313
313
  - [A click on the next field right after an `Autocomplete` pick is lost](#a-click-on-the-next-field-right-after-an-autocomplete-pick-is-lost)
314
314
  - [An older search's results replace the newer ones in an `Autocomplete`](#an-older-searchs-results-replace-the-newer-ones-in-an-autocomplete)
315
315
  - [An `Autocomplete` option does nothing on click or Enter](#an-autocomplete-option-does-nothing-on-click-or-enter)
316
+ - [Enter in a multiple `Autocomplete` no longer submits the form](#enter-in-a-multiple-autocomplete-no-longer-submits-the-form)
316
317
  - ["The search failed. Try again." no longer shows in an `Autocomplete`](#the-search-failed-try-again-no-longer-shows-in-an-autocomplete)
317
318
  - [A test no longer finds `aria-invalid` on an `OtpField` slot](#a-test-no-longer-finds-aria-invalid-on-an-otpfield-slot)
318
319
  - [A test no longer finds `aria-invalid` on a `CodeEditor`](#a-test-no-longer-finds-aria-invalid-on-a-codeeditor)
@@ -4880,6 +4881,19 @@ on a desktop and on a phone alike: closing the picker with OK hands focus back
4880
4881
  to the trigger, and the next Tab or click elsewhere touches it. See the next
4881
4882
  entry.
4882
4883
 
4884
+ ### A failed submit focuses a `ChoiceListFormField` but not the refused row
4885
+
4886
+ **When:** a form with a `ChoiceListFormField` fails validation (a row's text
4887
+ is blank, `choices.2.text` in a resolver) and `document.activeElement` is the
4888
+ list's first control, or nothing, instead of the refused row. In versions
4889
+ before this fix.
4890
+ **Why:** the field gave React Hook Form a handle that focused the first
4891
+ control of the list, whichever row was refused.
4892
+ **Fix:** upgrade to the release that lists this fix in its changelog:
4893
+ `shouldFocusError` and `setFocus(name)` focus the first refused row's text
4894
+ input. Remove a workaround that queries `[aria-invalid="true"]` after submit.
4895
+ For the other fields, see the next entry.
4896
+
4883
4897
  ### `setError(…, { shouldFocus: true })` or a failed submit does not focus the field
4884
4898
 
4885
4899
  **When:** a form wired with `*FormField`s: `handleSubmit` fails validation, or
@@ -5712,6 +5726,27 @@ may be chosen:
5712
5726
  />
5713
5727
  ```
5714
5728
 
5729
+ ### Enter in a multiple `Autocomplete` no longer submits the form
5730
+
5731
+ **When:** after upgrading, Enter in an `Autocomplete` (or `AutocompleteFormField`,
5732
+ a tags field) with `mode="multiple"` no longer submits the surrounding form
5733
+ when the list is closed and the input is empty.
5734
+ **Why:** the field is a tags box: the Enter that follows a pick used to save the
5735
+ whole form by surprise (#2199). Enter in `mode="multiple"` now only picks or
5736
+ adds. `single` mode is unchanged.
5737
+ **Fix:** submit with the form's button, or with a key handler of your own on the
5738
+ form if a keyboard shortcut is wanted (Ctrl/Cmd + Enter); drop any
5739
+ `onKeyDown` that prevented Enter on the combobox.
5740
+
5741
+ ```tsx
5742
+ <form
5743
+ onSubmit={save}
5744
+ onKeyDown={(e) => {
5745
+ if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) e.currentTarget.requestSubmit();
5746
+ }}
5747
+ >
5748
+ ```
5749
+
5715
5750
  ### "The search failed. Try again." no longer shows in an `Autocomplete`
5716
5751
 
5717
5752
  **When:** after upgrading, an `Autocomplete` whose `onSearch` rejects shows
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxgt/material",
3
- "version": "3.72.0",
3
+ "version": "3.73.0",
4
4
  "license": "MIT",
5
5
  "bugs": {
6
6
  "email": "stevegires@gmail.com"
@@ -372,7 +372,7 @@
372
372
  "docs:previews": "rm -rf node_modules/.cache/nxgt-preview-free/missing && NXGT_PREVIEW_FREE=1 vitest run --project previews && bun .storybook/preview-free-report.ts"
373
373
  },
374
374
  "dependencies": {
375
- "@nxgt/material-core": "^0.47.0",
375
+ "@nxgt/material-core": "^0.47.1",
376
376
  "@base-ui/react": "^1.6.0",
377
377
  "@dnd-kit/core": "^6.3.1",
378
378
  "@dnd-kit/sortable": "^10.0.0",