@nxgt/material 2.5.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.
Files changed (115) hide show
  1. package/README.md +5 -7
  2. package/dist/{_Uint8Array-DuTT6911.js → _Uint8Array-CDlDeQmw.js} +1 -1
  3. package/dist/{_overRest-93z6TD9V.js → _overRest-CWIWQwDJ.js} +1 -1
  4. package/dist/{async-slice-B8Xv2BLH.js → async-slice-Qoen0Mqm.js} +2 -2
  5. package/dist/{blockDiagram-BEXU5L5S-C8UXdLfB.js → blockDiagram-BEXU5L5S-_6EVgQ2-.js} +2 -2
  6. package/dist/{chunk-3FUC2YCW-4gCRt6fO.js → chunk-3FUC2YCW-CRQHl-Jx.js} +2 -2
  7. package/dist/{chunk-7M6MHVWA-DnPXbiTM.js → chunk-7M6MHVWA-DqXpf6CM.js} +1 -1
  8. package/dist/{chunk-GNY47TPC-DLqgU2SJ.js → chunk-GNY47TPC-BgMsLbCS.js} +4 -4
  9. package/dist/{chunk-NETBCI7D-CBowDvwz.js → chunk-NETBCI7D-CsyH43bj.js} +1 -1
  10. package/dist/{chunk-Z7XXMR3K-dRJc1Z30.js → chunk-Z7XXMR3K-CoCjTVVx.js} +1 -1
  11. package/dist/{classDiagram-v2-NBCMYWYE-CQmePeL4.js → classDiagram-v2-NBCMYWYE-j4vk04t-.js} +2 -2
  12. package/dist/{components-CUkJhBwK.js → components-C3wIUrWw.js} +25959 -25227
  13. package/dist/components.js +5 -5
  14. package/dist/{dagre-6A5THRUB-BhyJENrD.js → dagre-6A5THRUB-DXq_YBNL.js} +54 -54
  15. package/dist/{diagram-22UHCM2B-CJc0JoTV.js → diagram-22UHCM2B-He8NDldw.js} +2 -2
  16. package/dist/{diagram-3UASUU5V-0P3Cnq5H.js → diagram-3UASUU5V-CeILva4U.js} +1 -1
  17. package/dist/dnd.js +1 -1
  18. package/dist/{elk-276RUBZZ-CvgDuHoY.js → elk-276RUBZZ-DFn4kTey.js} +3 -3
  19. package/dist/{erDiagram-OPXOYQCR-BFgRy8E9.js → erDiagram-OPXOYQCR-BzVUcUwh.js} +2 -2
  20. package/dist/{field-blur-D1eQk-49.js → field-blur-BlrE9fOD.js} +1 -1
  21. package/dist/{flowDiagram-KWPJA3E3-DGaa9iT2.js → flowDiagram-KWPJA3E3-B4pJCj2Q.js} +3 -3
  22. package/dist/{ganttDiagram-FUAMR5RP-CDGrtGHY.js → ganttDiagram-FUAMR5RP-B4A4UFFi.js} +1 -1
  23. package/dist/{graphlib-Dt-isUVV.js → graphlib-CQ3hLS1N.js} +6 -6
  24. package/dist/hooks.js +2 -2
  25. package/dist/{i18n-provider-Drsc2YXX.js → i18n-provider-CbYD2KxP.js} +1 -1
  26. package/dist/i18n.js +6 -6
  27. package/dist/{isArrayLikeObject-BhWbq65y.js → isArrayLikeObject-5rnYwEK7.js} +3 -3
  28. package/dist/{isEmpty-DdlzV8Ue.js → isEmpty-DChvniYe.js} +3 -3
  29. package/dist/{journeyDiagram-ZHPQQLJL-BuLKqWS3.js → journeyDiagram-ZHPQQLJL-C91SPPkY.js} +1 -1
  30. package/dist/lib/components/ui/collections/tree/use-tree.d.ts +2 -0
  31. package/dist/lib/components/ui/dates/date-range-field/date-range-field-trigger.d.ts +1 -1
  32. package/dist/lib/components/ui/dates/date-range-field/date-range-field.d.ts +10 -1
  33. package/dist/lib/components/ui/dates/date-range-field/date-range-field.utils.d.ts +13 -0
  34. package/dist/lib/components/ui/dates/date-range-field/index.d.ts +1 -0
  35. package/dist/lib/components/ui/dates/date-range-field/partials/date-range-field-content.d.ts +25 -0
  36. package/dist/lib/components/ui/dates/date-range-field/partials/date-range-presets.d.ts +11 -0
  37. package/dist/lib/components/ui/dates/date-range-field/partials/date-range-times.d.ts +11 -0
  38. package/dist/lib/components/ui/dates/date-range-field/use-date-range-presets.d.ts +22 -0
  39. package/dist/lib/components/ui/dates/time-picker/time-picker-utils.d.ts +7 -0
  40. package/dist/lib/components/ui/fields/number-field/number-field.d.ts +3 -1
  41. package/dist/lib/components/ui/fields/slider/slider-header.d.ts +5 -1
  42. package/dist/lib/components/ui/fields/slider/slider-readout.d.ts +5 -1
  43. package/dist/lib/components/ui/media/file-preview/file-preview-pdf.lazy.d.ts +9 -0
  44. package/dist/lib/components/ui/media/file-preview/file-preview.d.ts +12 -0
  45. package/dist/lib/components/ui/media/file-preview/index.d.ts +3 -0
  46. package/dist/lib/components/ui/media/file-preview/partials/file-preview-body.d.ts +9 -0
  47. package/dist/lib/components/ui/media/file-preview/partials/file-preview-card.d.ts +20 -0
  48. package/dist/lib/components/ui/media/file-preview/partials/file-preview-media.d.ts +11 -0
  49. package/dist/lib/components/ui/media/file-preview/partials/file-preview-pdf.d.ts +10 -0
  50. package/dist/lib/components/ui/media/file-preview/partials/file-preview-status.d.ts +17 -0
  51. package/dist/lib/components/ui/media/file-preview/partials/file-preview-text.d.ts +13 -0
  52. package/dist/lib/components/ui/media/file-preview/types.d.ts +23 -0
  53. package/dist/lib/components/ui/media/file-preview/use-file-preview.d.ts +22 -0
  54. package/dist/lib/components/ui/media/file-preview/use-text-preview.d.ts +15 -0
  55. package/dist/lib/components/ui/media/index.d.ts +1 -0
  56. package/dist/lib/components/ui/media/upload/network-upload-field/use-image-preview.d.ts +6 -0
  57. package/dist/lib/components/ui/selection/index.d.ts +1 -0
  58. package/dist/lib/components/ui/selection/tree-select-field/index.d.ts +2 -0
  59. package/dist/lib/components/ui/selection/tree-select-field/partials/tree-select-content.d.ts +13 -0
  60. package/dist/lib/components/ui/selection/tree-select-field/partials/tree-select-panel.d.ts +19 -0
  61. package/dist/lib/components/ui/selection/tree-select-field/partials/tree-select-trigger.d.ts +24 -0
  62. package/dist/lib/components/ui/selection/tree-select-field/tree-select-field.d.ts +9 -0
  63. package/dist/lib/components/ui/selection/tree-select-field/tree-select-form-field.d.ts +8 -0
  64. package/dist/lib/components/ui/selection/tree-select-field/tree-select.utils.d.ts +35 -0
  65. package/dist/lib/components/ui/selection/tree-select-field/types.d.ts +37 -0
  66. package/dist/lib/components/ui/selection/tree-select-field/use-tree-select-field.d.ts +20 -0
  67. package/dist/lib/i18n/resources/en/en.d.ts +33 -0
  68. package/dist/lib/i18n/resources/en/material.json.d.ts +36 -3
  69. package/dist/lib/i18n/resources/fr/fr.d.ts +33 -0
  70. package/dist/lib/i18n/resources/fr/material.json.d.ts +36 -3
  71. package/dist/lib/i18n/resources/resources.d.ts +66 -0
  72. package/dist/lib/i18n/translator.d.ts +1 -1
  73. package/dist/lib.js +3 -3
  74. package/dist/main.js +15 -15
  75. package/dist/map.js +2 -2
  76. package/dist/material.css +1 -1
  77. package/dist/{merge-a7J0YkZX.js → merge-_Awk4ywA.js} +4 -4
  78. package/dist/{mermaid.core-CE34byhz.js → mermaid.core-DciYB1MV.js} +21 -21
  79. package/dist/{mindmap-definition-NLK3R4M7-emoij-nW.js → mindmap-definition-NLK3R4M7-Brf_2jIE.js} +2 -2
  80. package/dist/{pieDiagram-5QR66LMP-BdG1tWLn.js → pieDiagram-5QR66LMP-MPh-EWf-.js} +1 -1
  81. package/dist/print.js +2 -2
  82. package/dist/{quadrantDiagram-O4NWA36T-BCd-NwsO.js → quadrantDiagram-O4NWA36T-CwDeE9KB.js} +1 -1
  83. package/dist/{requirementDiagram-PLB6GJNP-CCcH5uSr.js → requirementDiagram-PLB6GJNP-CCP3YtvB.js} +2 -2
  84. package/dist/{sankeyDiagram-IPEJSGJF-78cK-bfe.js → sankeyDiagram-IPEJSGJF-vgVchd2a.js} +1 -1
  85. package/dist/{sortable-provider-VCxPasNp.js → sortable-provider-CzSnl6It.js} +1 -1
  86. package/dist/{stateDiagram-v2-GCMORJYK-B4ghJrhD.js → stateDiagram-v2-GCMORJYK-T-oIXh-8.js} +2 -2
  87. package/dist/{stored-language-CeD7kHui.js → stored-language-DmUUhRb5.js} +72 -6
  88. package/dist/{swimlanes-2SLR337P-DmHm2yJS.js → swimlanes-2SLR337P-tW3_wBWO.js} +3 -3
  89. package/dist/{swimlanesDiagram-TC7HE7FX-Dq3gGsPj.js → swimlanesDiagram-TC7HE7FX-B1lWzHp1.js} +3 -3
  90. package/dist/{timeline-definition-EJHVYXUP-EqJV_QKn.js → timeline-definition-EJHVYXUP-SdA6wt2-.js} +1 -1
  91. package/dist/{translate-material-DgRdhz5d.js → translate-material-DuY12xca.js} +2 -2
  92. package/dist/{translator-B4zUVm7j.js → translator-CaIYjyFP.js} +1 -1
  93. package/dist/{use-heading-spy-1BHMXjIn.js → use-heading-spy-Crdz4OH5.js} +2 -2
  94. package/dist/{use-material-translation-UbARR81K.js → use-material-translation-Od0QsFPA.js} +2 -2
  95. package/dist/{usecaseDiagram-POWQR4AR-CvCl0p5N.js → usecaseDiagram-POWQR4AR-B3rBcR4E.js} +2 -2
  96. package/dist/{xychartDiagram-PMCCYNJV-BphsHFKA.js → xychartDiagram-PMCCYNJV-stQWLgCx.js} +1 -1
  97. package/docs/components/README.md +2 -1
  98. package/docs/components/data-display.md +3 -3
  99. package/docs/components/data-table-filter-and-lists.md +5 -0
  100. package/docs/components/date-and-time.md +106 -6
  101. package/docs/components/feedback-and-status.md +1 -1
  102. package/docs/components/form-fields.md +8 -2
  103. package/docs/components/media-and-files.md +71 -1
  104. package/docs/components/primitives.md +1 -1
  105. package/docs/components/rich-widgets.md +1 -1
  106. package/docs/components/selection-and-choice.md +79 -2
  107. package/docs/guides/forms.md +2 -1
  108. package/docs/guides/i18n.md +47 -4
  109. package/docs/previews/date-time-daterangefield.webp +0 -0
  110. package/docs/previews/media-files-filepreview.webp +0 -0
  111. package/docs/previews/selection-choice-treeselectfield.webp +0 -0
  112. package/docs/roadmap.md +33 -27
  113. package/docs/troubleshooting.md +111 -0
  114. package/package.json +2 -2
  115. package/dist/lib/components/ui/fields/slider/slider-ticks.d.ts +0 -1
@@ -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
 
@@ -138,6 +140,9 @@ words in your error.
138
140
  - [The zoom changes by itself while a long PDF is open](#the-zoom-changes-by-itself-while-a-long-pdf-is-open)
139
141
  - [A link in a PDF replaces the page the reader is on](#a-link-in-a-pdf-replaces-the-page-the-reader-is-on)
140
142
  - [`onPageChange` is not called when `initialPage` is past the end, or after a new file](#onpagechange-is-not-called-when-initialpage-is-past-the-end-or-after-a-new-file)
143
+ - [`onPageChange` reports another page after opening on `initialPage`](#onpagechange-reports-another-page-after-opening-on-initialpage)
144
+ - [`FilePreview` shows a file card with a Download link for a PDF](#filepreview-shows-a-file-card-with-a-download-link-for-a-pdf)
145
+ - [`FilePreview` says "This file could not be previewed."](#filepreview-says-this-file-could-not-be-previewed)
141
146
  - [Reporting a bug](#reporting-a-bug)
142
147
 
143
148
  ---
@@ -2086,6 +2091,55 @@ const saveButtonRef = useRef<HTMLButtonElement>(null);
2086
2091
  A `Drawer` also takes Vaul's `autoFocus={false}`, which does the same as
2087
2092
  preventing the default.
2088
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
+
2089
2143
  ---
2090
2144
 
2091
2145
  ## PDF reader
@@ -2430,6 +2484,63 @@ before 2.2.0.
2430
2484
  to itself. Since 2.2.0 both are reported, once.
2431
2485
  **Fix:** update `@nxgt/material`. A page you kept in sync by hand can go.
2432
2486
 
2487
+ ### `onPageChange` reports another page after opening on `initialPage`
2488
+
2489
+ **When:** the reader opens on `initialPage` and, without the user scrolling,
2490
+ `onPageChange` reports another page, most often the last one, and the page field
2491
+ shows it. Seen on slow devices and busy machines, near the end of a
2492
+ document, with `@nxgt/material` 2.5.0 and earlier.
2493
+ **Why:** after placing the opening page, the reader ignored scrolling for
2494
+ only 150 ms. When the placement scroll landed later (a late frame), it was
2495
+ read as the user's, and at the end of the pages that is the last page.
2496
+ **Fix:** update `@nxgt/material`. The opening page now keeps the page number while
2497
+ the view stays on it; the user's own scroll, find in page or a screen
2498
+ reader moving the view still report the page they reach.
2499
+
2500
+ ### `FilePreview` shows a file card with a Download link for a PDF
2501
+
2502
+ **When:** a PDF given to `FilePreview` shows its name, size and a Download
2503
+ link instead of the reader.
2504
+ **Why:** `FilePreview` imports `PdfReader` the first time it previews a PDF,
2505
+ and falls back to the file card when that import fails: the viewer's chunk
2506
+ could not be fetched (a deploy replaced the chunks the open page was built
2507
+ with, or a network error), or the bundle has no `react-pdf` and `pdfjs-dist` — they are
2508
+ dependencies of `@nxgt/material`, not optional peers, so this is a bundler
2509
+ configuration that left them out. Nothing is thrown; the next PDF previewed
2510
+ tries again.
2511
+ **Fix:** reload the page after a deploy; otherwise check that your bundler
2512
+ keeps `react-pdf` and `pdfjs-dist` and pdf.js's worker (see `PdfReader` in
2513
+ [Media & files](components/media-and-files.md#pdfreader)). The same file in a
2514
+ `PdfReader` of its own shows the underlying error. A PDF the reader loaded
2515
+ but cannot open (a corrupt or password-protected file, a URL that answers an
2516
+ error page) is different: the preview stays `ready` and `PdfReader` shows its
2517
+ own error inside it.
2518
+
2519
+ ### `FilePreview` says "This file could not be previewed."
2520
+
2521
+ **When:** a `FilePreview` given a URL, or a file it cannot show, renders that
2522
+ message (and `onError` receives the error).
2523
+ **Why:** a text, JSON, CSV or Markdown URL is fetched with `fetch`: an HTTP
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
2527
+ without CORS headers is a `TypeError: Failed to fetch`. An image, video or
2528
+ audio file the browser cannot decode (a corrupt file, a codec the browser
2529
+ lacks, a URL that answers an error page) fails in its own element. A URL
2530
+ that is not `http(s):`, relative, `blob:`, or a `data:` URL of an image,
2531
+ video, audio file, plain text, CSV, Markdown, JSON or PDF (`javascript:`,
2532
+ `data:text/html`, and also a `data:` URL of XML, TSV or YAML, though
2533
+ `FilePreview` would show those kinds from a `Blob`) is refused before
2534
+ anything is linked, loaded or fetched: the error is a
2535
+ `FilePreviewUnsafeUrlError`, "Refused to preview a URL with an unsafe scheme", and there is no
2536
+ Download link.
2537
+ **Fix:** serve the file with `Access-Control-Allow-Origin` for your page's
2538
+ origin, or fetch it yourself (with your credentials) and pass the `Blob`;
2539
+ pass `type` when the server answers `application/octet-stream` for a file
2540
+ whose URL has no extension; pass a refused URL's file as a `Blob`, or from
2541
+ an `https:` URL. A text file larger than `maxTextBytes` is not an error: its
2542
+ beginning is shown, with "Showing the first … of this file." below.
2543
+
2433
2544
  ---
2434
2545
 
2435
2546
  ## Reporting a bug
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxgt/material",
3
- "version": "2.5.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.2.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",
@@ -1 +0,0 @@
1
- export declare function tickValues(min: number, max: number, ticks: boolean | number, step?: number): number[];