@nxgt/material 2.6.0 → 2.6.1

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.
package/docs/roadmap.md CHANGED
@@ -6,16 +6,7 @@ the version something shipped in.
6
6
 
7
7
  ## Now
8
8
 
9
- - **TreeSelectField** — pick one or several items from a tree inside a form
10
- field, as chips when several, with an optional filter that keeps each match
11
- under its ancestors (`TreeSelectField`, `TreeSelectFormField`).
12
- - **DateRangeField presets and time** — one-click ranges such as Today, Last 7
13
- days and This month, or your own, beside the calendar (`presets`), and a time
14
- of day on each end of the range (`withTime`).
15
- - **FilePreview** — preview a file picked by its type, in one component: an
16
- image, a PDF in `PdfReader`, a video or audio file, the text of a text, JSON,
17
- CSV or Markdown file, or a card with a download link for anything else
18
- (`FilePreview`, `onError`). Safe on a server.
9
+ Nothing in progress right now; see Next.
19
10
 
20
11
  ## Next
21
12
 
@@ -94,6 +85,16 @@ the version something shipped in.
94
85
 
95
86
  ## Shipped
96
87
 
88
+ - **TreeSelectField** — pick one or several items from a tree inside a form
89
+ field, as chips when several, with an optional filter that keeps each match
90
+ under its ancestors (`TreeSelectField`, `TreeSelectFormField`). 2.6.0.
91
+ - **DateRangeField presets and time** — one-click ranges such as Today, Last 7
92
+ days and This month, or your own, beside the calendar (`presets`), and a time
93
+ of day on each end of the range (`withTime`). 2.6.0.
94
+ - **FilePreview** — preview a file picked by its type, in one component: an
95
+ image, a PDF in `PdfReader`, a video or audio file, the text of a text, JSON,
96
+ CSV or Markdown file, or a card with a download link for anything else
97
+ (`FilePreview`, `onError`). Safe on a server. 2.6.0.
97
98
  - **Spinner `light` colour renders** — a `Spinner` with `color="light"` shows
98
99
  its light ring, for loading states on dark or coloured surfaces. 2.5.0.
99
100
  - **Range filters announce their field name** — the slider thumbs and the
@@ -113,6 +113,8 @@ words in your error.
113
113
  - [A menu item selected by `[data-variant=destructive]` stops matching](#a-menu-item-selected-by-data-variantdestructive-stops-matching)
114
114
  - [A `Stepper` step selected by `#step-N` stops matching](#a-stepper-step-selected-by-step-n-stops-matching)
115
115
  - [Keys typed right after opening a dialog, sheet or drawer land inside it](#keys-typed-right-after-opening-a-dialog-sheet-or-drawer-land-inside-it)
116
+ - [A `TimePicker` test expects AM / PM to add 12 hours, or a click on the pressed half to switch to PM](#a-timepicker-test-expects-am--pm-to-add-12-hours-or-a-click-on-the-pressed-half-to-switch-to-pm)
117
+ - [Focus is no longer in a `Tree` after it renders](#focus-is-no-longer-in-a-tree-after-it-renders)
116
118
 
117
119
  **PDF reader**
118
120
 
@@ -2089,6 +2091,55 @@ const saveButtonRef = useRef<HTMLButtonElement>(null);
2089
2091
  A `Drawer` also takes Vaul's `autoFocus={false}`, which does the same as
2090
2092
  preventing the default.
2091
2093
 
2094
+ ### A `TimePicker` test expects AM / PM to add 12 hours, or a click on the pressed half to switch to PM
2095
+
2096
+ **When:** after upgrading to 2.6.0, a test (or code of yours) around a
2097
+ `TimePicker` — or the popover of a `DateField` with `showTimePicker`, a
2098
+ `TimeField` or a `DateRangeField` with `withTime`, which hold one — sees a
2099
+ different time, or no `onChange`, when it clicks AM or PM.
2100
+ **Why:** before 2.6.0 the toggle added 12 hours on every PM and took
2101
+ `% 12` on AM. A time already in the afternoon went 12 hours further — PM on
2102
+ 14:00 gave 02:00 the next day — and a click on the half already pressed
2103
+ (which Radix reports as `''`, unpressing it) showed PM but took the time
2104
+ `% 12`, as AM does — a pressed PM on 14:00 gave 02:00, still shown as PM.
2105
+ The AM / PM shown was also read once, from the first `date`, so a `date`
2106
+ changed from outside kept its old half. Now AM / PM follows the `date` it is
2107
+ given, switching moves the time into that half and no further (09:30 + PM is
2108
+ 21:30, 21:30 + PM stays 21:30, 21:30 + AM is 09:30, on the same day), and a
2109
+ click on the pressed half changes nothing and calls no `onChange`.
2110
+ `@nxgt/material-vue` 0.25.0 has the same fix. The hours and minutes inputs
2111
+ are also named "Hours" and "Minutes" (`material.time-picker.hours`,
2112
+ `material.time-picker.minutes`).
2113
+ **Fix:** expect the time in the half you picked, and no call for a click on
2114
+ the pressed half. Find the inputs by their names rather than by position:
2115
+
2116
+ ```ts
2117
+ await userEvent.click(canvas.getByRole('radio', { name: 'PM' }));
2118
+ expect(onChange).toHaveBeenLastCalledWith(new Date(2026, 0, 1, 21, 30)); // from 09:30
2119
+ await userEvent.type(canvas.getByRole('spinbutton', { name: 'Hours' }), '10');
2120
+ ```
2121
+
2122
+ ### Focus is no longer in a `Tree` after it renders
2123
+
2124
+ **When:** after upgrading to 2.6.0, a test (or code of yours) that renders a
2125
+ `Tree` — or a page that holds one — and then presses arrow keys or Enter
2126
+ without first focusing a row finds nothing happens in the tree; a check such
2127
+ as `expect(row).toHaveFocus()` right after rendering fails.
2128
+ **Why:** before 2.6.0, mounting a `Tree` moved focus to its focused row (the
2129
+ default selection, else the first row), so a page that rendered one lost the
2130
+ user's focus to it, and under Strict Mode a remount did it again. Focus now
2131
+ follows the keyboard only, as in `@nxgt/material-vue`: it moves when the row
2132
+ that has the keyboard changes, never on mount. Tab still reaches the tree:
2133
+ the row with `tabindex="0"` (`useTree`'s `tabbableId`) is the focused row
2134
+ when it is shown, else the first visible row.
2135
+ **Fix:** focus the tree as a user does, by Tab or a click, before pressing
2136
+ keys; to move focus into it on purpose, focus a row yourself:
2137
+
2138
+ ```ts
2139
+ await userEvent.click(canvas.getByRole('treeitem', { name: /Docs/ }));
2140
+ await userEvent.keyboard('{ArrowDown}');
2141
+ ```
2142
+
2092
2143
  ---
2093
2144
 
2094
2145
  ## PDF reader
@@ -2470,7 +2521,9 @@ own error inside it.
2470
2521
  **When:** a `FilePreview` given a URL, or a file it cannot show, renders that
2471
2522
  message (and `onError` receives the error).
2472
2523
  **Why:** a text, JSON, CSV or Markdown URL is fetched with `fetch`: an HTTP
2473
- error is a `FilePreviewHttpError` with its `status`, and a cross-origin URL
2524
+ error is a `FilePreviewHttpError` with its `status`, whose message is
2525
+ `Could not read …: HTTP 404` (the URL as you passed it, then the status —
2526
+ `Could not read /files/notes.txt: HTTP 404`), and a cross-origin URL
2474
2527
  without CORS headers is a `TypeError: Failed to fetch`. An image, video or
2475
2528
  audio file the browser cannot decode (a corrupt file, a codec the browser
2476
2529
  lacks, a URL that answers an error page) fails in its own element. A URL
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxgt/material",
3
- "version": "2.6.0",
3
+ "version": "2.6.1",
4
4
  "license": "MIT",
5
5
  "bugs": {
6
6
  "email": "stevegires@gmail.com"
@@ -113,7 +113,7 @@
113
113
  "docs:previews": "vitest run --project previews"
114
114
  },
115
115
  "dependencies": {
116
- "@nxgt/material-core": "^0.3.0",
116
+ "@nxgt/material-core": "^0.3.1",
117
117
  "@base-ui/react": "^1.6.0",
118
118
  "@dnd-kit/core": "^6.3.1",
119
119
  "@dnd-kit/sortable": "^10.0.0",