@nxgt/material 3.93.0 → 3.94.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 (92) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +2 -1
  3. package/dist/{alert-dialog-D37eph4I.js → alert-dialog-BaqK-rmd.js} +1 -1
  4. package/dist/{async-slice-BSqwhAj-.js → async-slice-BfNpIJAH.js} +1 -1
  5. package/dist/{button-CG9SBAT-.js → button-CozGHXAv.js} +1 -1
  6. package/dist/{calculator-YD3I3y-I.js → calculator-BIx6cwgU.js} +10 -10
  7. package/dist/calculator-field.js +6 -6
  8. package/dist/{calculator-segment-Cjec9zi7.js → calculator-segment-BsaxUtzL.js} +1 -1
  9. package/dist/calculator.js +1 -1
  10. package/dist/charts.js +3 -3
  11. package/dist/{chip-BbUSBl3i.js → chip-DMEUGYdC.js} +2 -2
  12. package/dist/{code-editor-ZEM7AAcs.js → code-editor-BWfky-aN.js} +4 -4
  13. package/dist/code-editor.js +4 -4
  14. package/dist/{code-language-items-CAuHPrHd.js → code-language-items-BUaNYJuw.js} +2 -2
  15. package/dist/{components-CuFTrmGy.js → components-CZpdAQMh.js} +19525 -19105
  16. package/dist/components.js +38 -38
  17. package/dist/{conversion-variant-DmEtTCSP.js → conversion-variant-aIBhul_U.js} +3 -3
  18. package/dist/{currency-field-CabGnVO9.js → currency-field-IcEMAcAw.js} +5 -5
  19. package/dist/{dialog-Jhpx6ulb.js → dialog-H40HjqXN.js} +3 -3
  20. package/dist/dnd.js +1 -1
  21. package/dist/{dropdown-menu-nl0Q3tQ2.js → dropdown-menu-CawkIlW8.js} +1 -1
  22. package/dist/editor.js +442 -442
  23. package/dist/{empty-state-mrJuqph3.js → empty-state-sRVjgCis.js} +1 -1
  24. package/dist/{financial-variant-P8gFA9aI.js → financial-variant-Bqo9-swy.js} +5 -5
  25. package/dist/{hooks-CjSpziWf.js → hooks-BTj_WJm9.js} +2 -2
  26. package/dist/hooks.js +2 -2
  27. package/dist/{hover-card-BNb1M8ij.js → hover-card-BZU1DWGY.js} +1 -1
  28. package/dist/i18n.js +3 -3
  29. package/dist/{icon-badge-CVMHwdFm.js → icon-badge-CXgvqMsM.js} +1 -1
  30. package/dist/{icon-button-Ch0PThsa.js → icon-button-B9WjQ3RO.js} +1 -1
  31. package/dist/{input-group-CPMSQcBx.js → input-group-Df9vp2EZ.js} +1 -1
  32. package/dist/lib/components/ui/display/entity-header/entity-metadata.d.ts +0 -7
  33. package/dist/lib/components/ui/display/entity-header/entity-stats.d.ts +2 -1
  34. package/dist/lib/components/ui/display/markdown/markdown.d.ts +2 -2
  35. package/dist/lib/components/ui/display/markdown/rehype-katex-classes.d.ts +21 -0
  36. package/dist/lib/components/ui/fields/contacts/placeholders.d.ts +1 -1
  37. package/dist/lib/components/ui/fields/index.d.ts +1 -0
  38. package/dist/lib/components/ui/fields/markdown-textarea-field/index.d.ts +2 -0
  39. package/dist/lib/components/ui/fields/markdown-textarea-field/markdown-preview.d.ts +6 -0
  40. package/dist/lib/components/ui/fields/markdown-textarea-field/markdown-syntax-help.d.ts +4 -0
  41. package/dist/lib/components/ui/fields/markdown-textarea-field/markdown-tabs.d.ts +13 -0
  42. package/dist/lib/components/ui/fields/markdown-textarea-field/markdown-textarea-field.d.ts +23 -0
  43. package/dist/lib/components/ui/fields/markdown-textarea-field/markdown-textarea-form-field.d.ts +3 -0
  44. package/dist/lib/components/ui/fields/markdown-textarea-field/use-text-value.d.ts +6 -0
  45. package/dist/lib/components/ui/widgets/education/questions/index.d.ts +1 -1
  46. package/dist/lib/components/ui/widgets/education/questions/partials/question-hints.d.ts +9 -0
  47. package/dist/lib/components/ui/widgets/education/questions/partials/question-reveal.d.ts +13 -0
  48. package/dist/lib/components/ui/widgets/education/questions/partials/rich-text.d.ts +17 -0
  49. package/dist/lib/components/ui/widgets/education/questions/types.d.ts +40 -1
  50. package/dist/lib/i18n/resources/en/en.d.ts +24 -0
  51. package/dist/lib/i18n/resources/en/material.json.d.ts +24 -0
  52. package/dist/lib/i18n/resources/fr/fr.d.ts +24 -0
  53. package/dist/lib/i18n/resources/fr/material.json.d.ts +24 -0
  54. package/dist/lib/i18n/resources/resources.d.ts +48 -0
  55. package/dist/lib/i18n/translator.d.ts +1 -1
  56. package/dist/lib.js +1 -1
  57. package/dist/main.js +54 -54
  58. package/dist/map.js +7 -7
  59. package/dist/material.css +1 -1
  60. package/dist/pdf-reader.js +1 -1
  61. package/dist/{percent-field-TWyupyr_.js → percent-field-DrI4_J7x.js} +1 -1
  62. package/dist/{picker-surface-CoNsDWxX.js → picker-surface-D2aYI4v7.js} +4 -4
  63. package/dist/{popover-BA1U82Wk.js → popover-QQYPWzw6.js} +1 -1
  64. package/dist/{pos-types-BQqv-kb6.js → pos-types-BIeZGGAs.js} +1 -1
  65. package/dist/{pos-variant-D043n5y8.js → pos-variant-Cdn1AVoA.js} +4 -4
  66. package/dist/print.js +1 -1
  67. package/dist/{programmer-variant-jneMqtLs.js → programmer-variant-CMBybkqw.js} +2 -2
  68. package/dist/{public-DgrbdeZj.js → public-CPxFxbi4.js} +9 -9
  69. package/dist/{rich-code-block-CGNjHawR.js → rich-code-block-DKJ8eKzL.js} +5 -5
  70. package/dist/{scientific-variant-1L7brNNT.js → scientific-variant-CXL1ayb7.js} +2 -2
  71. package/dist/{sortable-provider-DZLV_svg.js → sortable-provider-BYqwwyr1.js} +2 -2
  72. package/dist/{spinner-CQqRWxAW.js → spinner-D7ol2n_-.js} +1 -1
  73. package/dist/{tabs-DQTx3C8e.js → tabs-DyiFTy5g.js} +1 -1
  74. package/dist/theme-picker.js +2 -2
  75. package/dist/{theme-toggle-3NQ3VmJH.js → theme-toggle-QZ0bIrg9.js} +1 -1
  76. package/dist/{toolbar-items-BYCdJGUf.js → toolbar-items-BpOEBsSt.js} +4 -4
  77. package/dist/{translate-material-jxfcGlD5.js → translate-material-DlMetRSJ.js} +1 -1
  78. package/dist/{translator-6XuDmqUJ.js → translator-VtzVrnLm.js} +48 -0
  79. package/dist/{use-chat-composer-1eb4I1kM.js → use-chat-composer-DQ2rTD_q.js} +17 -17
  80. package/dist/{use-heading-spy-CzPujlKr.js → use-heading-spy-17B5xa7B.js} +4 -4
  81. package/dist/{use-material-translation-BUPqNmAg.js → use-material-translation-Cx5u36V5.js} +1 -1
  82. package/dist/{use-return-focus-B_enQxp5.js → use-return-focus-S7g7q_Yn.js} +1 -1
  83. package/docs/components/data-display.md +7 -6
  84. package/docs/components/form-fields.md +39 -0
  85. package/docs/components/rich-widgets.md +29 -0
  86. package/docs/guides/csp.md +20 -8
  87. package/docs/guides/forms.md +1 -0
  88. package/docs/guides/i18n.md +1 -1
  89. package/docs/previews/data-display-entityheader.webp +0 -0
  90. package/docs/previews/form-fields-markdowntextareafield.webp +0 -0
  91. package/docs/troubleshooting.md +22 -6
  92. package/package.json +1 -1
@@ -38,7 +38,7 @@ Components outside this table need nothing more. Measured per component:
38
38
  | --- | --- | --- |
39
39
  | `PdfReader` | `worker-src 'self'` (the worker is a file of the package), `connect-src` for the PDF's and the assets' origins, and `script-src 'wasm-unsafe-eval'` for the JPEG 2000 and ICC WebAssembly decoders (without it: a JavaScript fallback for JPEG 2000, device colours for ICC profiles) | worker checked in the same Playwright run (Vite production build under `worker-src 'self'`), the rest read from pdf.js's code: [PDF reader guide](pdf-reader.md#content-security-policy) |
40
40
  | `CodeEditor`, `CodeDiff` (Monaco) | `@monaco-editor/react` loads Monaco from `https://cdn.jsdelivr.net/npm/monaco-editor@…/min/vs` by default: that host in `style-src-elem` (Monaco's CSS) and `font-src` (its icon font), plus `worker-src blob:` | not yet verified in a browser. Safe default: allow `https://cdn.jsdelivr.net` in `script-src`, `style-src-elem` and `font-src`, and `worker-src blob:`; or stay on `'self'` by [serving Monaco yourself](#monaco-on-self) |
41
- | `Markdown` (maths, mermaid, code) | nothing beyond the policy above, in a client render | checked in Chromium under that policy with `style-src-attr 'none'`, no `img-src data:` and no `'unsafe-eval'`: [Markdown under a strict CSP](#markdown-katex-mermaid-and-code-under-a-strict-csp) |
41
+ | `Markdown` (maths, mermaid, code) | nothing beyond the policy above, on the server or the client (math needs `NonceProvider`); mermaid's mindmap and architecture diagrams still add an un-nonced `<style>` | checked in Chromium under that policy with `style-src-attr 'none'`, no `img-src data:` and no `'unsafe-eval'`: [Markdown under a strict CSP](#markdown-katex-mermaid-and-code-under-a-strict-csp) |
42
42
  | `RichTextViewer` (`@nxgt/material/editor/viewer`) | none, but it emits `style` attributes: a text colour, a highlight, a text alignment or a table cell's background in the saved document becomes an inline `style` (only allow-listed properties with plain values survive), so a page that shows such a document needs `style-src-attr 'unsafe-inline'`. A document with none sends no style | measured by reading the renderers; a strict `style-src-attr 'none'` page shows the document without those colours |
43
43
  | `Camera` | none: `getUserMedia` is not governed by CSP; the captured photo is a `data:` image | `media-src` for the live preview is not yet verified. Safe default: `media-src 'self' blob:` (a `srcObject` stream usually needs nothing) |
44
44
  | `MediaPlayer` with `hlsStreaming()` | `connect-src` and `media-src blob:` for the stream; `worker-src blob:` only with `config: { enableWorker: true }` (the adapter defaults to no worker) | see the [streaming guide](media-streaming.md#content-security-policy) |
@@ -211,6 +211,7 @@ mermaid and pdf.js's font fallback are the [known gaps](#known-gaps).
211
211
  | `Spinner` (variant `4`), `PdfReader` (search highlights, night mode) | nothing | their rules are in the stylesheet (`spinner.css`, `pdf-viewer.css`) |
212
212
  | `Progress`, `CircularProgress` | nothing | the server draws SVG percentages, SMIL and path data, and the rules are in the stylesheet (`progress.css`); no `style` attribute |
213
213
  | `ScrollArea`, `Select` (Radix) | the nonce | Radix renders a `<style>` element with `NonceProvider`'s nonce: wrap the app in [`NonceProvider`](#nonceprovider) |
214
+ | `Markdown` (math) | the nonce | one `<style>` of `mk-` rules replacing KaTeX's `style` attributes, with `NonceProvider`'s nonce |
214
215
  | `RichTextEditor` (tiptap) | the nonce | tiptap, on mount, with `NonceProvider`'s nonce as `injectNonce` |
215
216
  | `Dialog`, `AlertDialog`, `Sheet`, `ConfirmationDialog`, … (Radix scroll lock) | the nonce | react-style-singleton, when a modal opens: see below |
216
217
 
@@ -278,8 +279,17 @@ the page carry the nonce in its meta tag).
278
279
  (`data-scheme`), and `maxHeight` is a custom property written through the
279
280
  CSSOM in a layout effect (a server-rendered block is full height until
280
281
  hydration).
281
- - **KaTeX**: on a client render React writes its styles through the CSSOM.
282
- Its fonts are files ([KaTeX fonts](#katex-fonts)).
282
+ - **KaTeX**: its markup carries inline `style="…"` attributes (offsets,
283
+ heights, widths), which `style-src-attr 'none'` blocks on a server render
284
+ (hydration does not rewrite them). `Markdown` turns each into a class
285
+ (`mk-<hash>`, one per distinct declaration list, the same on the server and
286
+ the client) and appends one `<style>` with the rules, given the nonce of the
287
+ nearest `NonceProvider`: `style-src-elem 'nonce-…'` allows it, and the
288
+ formula is laid out as before, with server and client rendering the same
289
+ markup. So `NonceProvider` is required for math under a nonce policy
290
+ (without it the `<style>` has no nonce and is blocked); a declaration that
291
+ is not a plain `property:value` is dropped, never copied to the sheet. Its
292
+ fonts are files ([KaTeX fonts](#katex-fonts)).
283
293
  - **Mermaid**: the diagram stays an image, now from a `blob:` URL (revoked when
284
294
  the diagram goes), so the SVG's own `<style>` and `style` attributes live in
285
295
  the image and the page needs neither `data:` nor `style-src-attr` for them.
@@ -293,11 +303,13 @@ the page carry the nonce in its meta tag).
293
303
  each is a pass-through once the last render ends and is restored only if
294
304
  no other script patched it since). Unrelated calls, such as an editor
295
305
  parsing HTML, are left alone.
296
- - **Left**: a page whose HTML the server renders with math carries KaTeX's
297
- `style="…"` attributes in the markup, which `style-src-attr 'none'` blocks
298
- (the formula loses its spacing until `style-src-attr 'unsafe-inline'`, or a
299
- client-only render of the `Markdown`). Mermaid's mindmap and architecture
300
- diagrams add a `<style>` to `<head>` ([known gaps](#known-gaps)).
306
+ - **Left**: mermaid's mindmap and architecture diagrams (cytoscape) add a
307
+ `<style>` to `<head>` with no nonce, which `style-src-elem 'nonce-…'` blocks:
308
+ the diagram still draws, without that sheet's rules. The classes mechanism
309
+ above does not reach it; allow that element (a hash of the sheet, or
310
+ `style-src-elem 'unsafe-inline'`) only if you show those two diagram types
311
+ ([known gaps](#known-gaps)). Flowcharts, sequence and the other types are
312
+ checked and need nothing.
301
313
 
302
314
  ### Known gaps
303
315
 
@@ -490,6 +490,7 @@ or fails validation.
490
490
  | --- | --- | --- |
491
491
  | `TextField` · `TextFormField` | `string`. With `type="number"`: `number \| null` | `''` |
492
492
  | `TextareaField` · `TextareaFormField` | `string` | `''` |
493
+ | `MarkdownTextareaField` · `MarkdownTextareaFormField` | `string` (Markdown source) | `''` |
493
494
  | `EmailField` · `EmailFormField` | `string` (as typed; the field shows its own "Enter a valid email" hint on blur) | `''` |
494
495
  | `PasswordField` · `PasswordFormField` | `string` | `''` |
495
496
  | `NumberField` · `NumberFormField` | `number \| null`. `null` when cleared; clamped to `min` / `max` on blur | `null` |
@@ -247,7 +247,7 @@ until the bar is drawn), the `ThreadLayout` stepper's `nav` name `material.navig
247
247
  single value's input, when nothing names the slider, `material.slider.value`
248
248
  ("Value", "Valeur"). `CopyButton` reads `material.copy.copy`, `copied` and `failed` ("Copy", "Copied",
249
249
  "Copy failed"). An overflowing `TabsList`'s scroll buttons read
250
- `material.tabs.scroll-left` / `scroll-right` ("Scroll tabs left" / "Scroll tabs right"). The other icon-only buttons are named from it too: the
250
+ `material.tabs.scroll-left` / `scroll-right` ("Scroll tabs left" / "Scroll tabs right"). `QuestionCard`'s rich content reads `material.quiz.rich.*` (the hint button and names "Show hint 1 of 3" / "Hint 1 of 3", "About each answer", "References", "Examples" with its Input / Expected headers). The other icon-only buttons are named from it too: the
251
251
  `Sidebar` toggle (`material.sidebar.toggle`), the data table's row expander
252
252
  (`material.table.labels.toggle-row`) and its header, a hidden "Expand" / "Déplier"
253
253
  (`material.table.labels.expand`), its loading status, "Loading data…" /
@@ -43,6 +43,7 @@ words in your error.
43
43
  - [`IconRefError` from `IconSpritesProvider`](#iconreferror-from-iconspritesprovider)
44
44
  - [An accessibility audit reports low contrast on a badge, a button, a toast or a menu entry](#an-accessibility-audit-reports-low-contrast-on-a-badge-a-button-a-toast-or-a-menu-entry)
45
45
  - [`ARIA hidden element must not be focusable or contain focusable elements`](#aria-hidden-element-must-not-be-focusable-or-contain-focusable-elements)
46
+ - [An `EntityHeader` metadata test that measured the label beside its value now fails](#an-entityheader-metadata-test-that-measured-the-label-beside-its-value-now-fails)
46
47
  - [A control in an `EntityHeader`'s `icon` is hidden from assistive tech, squashed, and reports `aria-hidden-focus`](#a-control-in-an-entityheaders-icon-is-hidden-from-assistive-tech-squashed-and-reports-aria-hidden-focus)
47
48
  - [A `Switcher` in link mode leaves focus on the trigger after a navigation, and the new page's title never gets it](#a-switcher-in-link-mode-leaves-focus-on-the-trigger-after-a-navigation-and-the-new-pages-title-never-gets-it)
48
49
  - [An accessibility audit reports low contrast on a tonal or outlined button, a selected list tile or a hovered badge link](#an-accessibility-audit-reports-low-contrast-on-a-tonal-or-outlined-button-a-selected-list-tile-or-a-hovered-badge-link)
@@ -1152,6 +1153,21 @@ Elements mounted after the layer opens are not made inert: mount them
1152
1153
  first, or pass them to `inertOthers` in `keep` when they must stay
1153
1154
  reachable.
1154
1155
 
1156
+ ### An `EntityHeader` metadata test that measured the label beside its value now fails
1157
+
1158
+ **When:** after the metadata became a grid, a test reads the label and the value
1159
+ of an `EntityHeader` on one line, or measures their positions or heights.
1160
+ **Why:** each fact is now a grid cell with the label (`dt`) above its value
1161
+ (`dd`), as many columns as the width allows; a link or a text button in a value
1162
+ keeps the text's height.
1163
+ **Fix:** update the numbers, or assert on the text and on
1164
+ `data-slot="entity-metadata"` instead of the geometry.
1165
+
1166
+ ```tsx
1167
+ const meta = container.querySelector('[data-slot="entity-metadata"]');
1168
+ expect(meta).toHaveTextContent('Owner');
1169
+ ```
1170
+
1155
1171
  ### A control in an `EntityHeader`'s `icon` is hidden from assistive tech, squashed, and reports `aria-hidden-focus`
1156
1172
 
1157
1173
  **When:** an `EntityHeader` gets a `Switcher`, a button or a link as its `icon`.
@@ -8086,14 +8102,14 @@ with `style-src-elem` for a `<style>` element and `style-src-attr` for a
8086
8102
  **Why:** a `<style>` element needs the page's nonce, an attribute cannot carry
8087
8103
  one. The usual sources are the components listed in
8088
8104
  [the guide](guides/csp.md#style-elements-the-components-inject).
8089
- `ScrollArea`, `Select`, `RichTextEditor` and the scroll lock of dialogs and
8105
+ `ScrollArea`, `Select`, `RichTextEditor`, `Markdown` (math) and the scroll lock of dialogs and
8090
8106
  sheets take the nonce from `NonceProvider`, and report this when the app has
8091
- none (or gives it another nonce than the header's). Mermaid and KaTeX
8092
- need none of this on a client render
8107
+ none (or gives it another nonce than the header's). Math needs no
8108
+ `style-src-attr` on the server or the client, but needs `NonceProvider` (its
8109
+ `mk-` rules are one nonce'd `<style>`)
8093
8110
  ([Markdown under a strict CSP](guides/csp.md#markdown-katex-mermaid-and-code-under-a-strict-csp));
8094
- the two left are a server-rendered page with math (KaTeX's `style` attributes
8095
- need `style-src-attr 'unsafe-inline'`) and the `<style>` cytoscape adds to
8096
- `<head>` for mermaid's mindmap and architecture diagrams.
8111
+ the one left is the `<style>` cytoscape adds to `<head>` for mermaid's mindmap
8112
+ and architecture diagrams.
8097
8113
  `Toaster`, `Drawer`,
8098
8114
  `InputOTP`, `ImageCropper`, `Spinner` and `PdfReader` create none: their CSS is in the stylesheet, so if one of them looks unstyled, the
8099
8115
  app imports neither `styles.css` nor `dist/material.css`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxgt/material",
3
- "version": "3.93.0",
3
+ "version": "3.94.0",
4
4
  "license": "MIT",
5
5
  "bugs": {
6
6
  "email": "stevegires@gmail.com"