@nxgt/material 3.60.0 → 3.63.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 (114) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +3 -2
  3. package/dist/alert-dialog-RHm6WtQj.js +189 -0
  4. package/dist/{async-slice-HJY_VJjD.js → async-slice-DmX59NyA.js} +3 -4
  5. package/dist/{button-7BuUCGRm.js → button-DfS_amfQ.js} +1 -1
  6. package/dist/charts.js +3 -3
  7. package/dist/{chip-kQOrHlDX.js → chip-Cbndukko.js} +2 -2
  8. package/dist/{code-editor-Ckc9TTCM.js → code-editor-B0tN8Ha_.js} +11 -11
  9. package/dist/code-editor.js +54 -37
  10. package/dist/{code-language-items-rCPB0Xee.js → code-language-items-andgHKrM.js} +2 -2
  11. package/dist/components/ui/layout/sidebar/sidebar-tokens.css +13 -1
  12. package/dist/{components-BSM-h5IQ.js → components-Cm2doOJS.js} +13090 -12957
  13. package/dist/components.js +28 -26
  14. package/dist/dialog-Bd7Hid2L.js +219 -0
  15. package/dist/dnd.js +1 -1
  16. package/dist/{dropdown-menu-CiobN1wi.js → dropdown-menu-_SyVmSuy.js} +1 -1
  17. package/dist/editor.js +707 -706
  18. package/dist/{empty-state-DA517HAb.js → empty-state-D-2ZMXXJ.js} +2 -2
  19. package/dist/escape-owner-DpaP0lm1.js +19 -0
  20. package/dist/{field-blur-DdvY0NQQ.js → field-blur-DyOByjzw.js} +1 -1
  21. package/dist/{field-blur-context-DbJQZkEB.js → field-blur-context-DPe5_Nv5.js} +1 -1
  22. package/dist/hooks-a7_exKWS.js +329 -0
  23. package/dist/hooks.js +8 -102
  24. package/dist/{hover-card-DPs9huSs.js → hover-card-D_0smKBQ.js} +2 -2
  25. package/dist/i18n.js +8 -10
  26. package/dist/{icon-badge-C646JTOI.js → icon-badge-CBCU3ySF.js} +14 -14
  27. package/dist/{icon-button-DvP0Gy3j.js → icon-button-hKHsWTAt.js} +1 -1
  28. package/dist/illustrations-game.js +2 -0
  29. package/dist/lib/components/ui/display/list-tile/list-tile.d.ts +6 -0
  30. package/dist/lib/components/ui/display/list-tile/partials/list-tile-classes.d.ts +3 -1
  31. package/dist/lib/components/ui/display/list-tile/partials/list-tile-line.d.ts +1 -1
  32. package/dist/lib/components/ui/display/list-tile/partials/list-tile-toggle.d.ts +1 -1
  33. package/dist/lib/components/ui/feedback/index.d.ts +1 -0
  34. package/dist/lib/components/ui/feedback/unsaved-dialog/index.d.ts +1 -0
  35. package/dist/lib/components/ui/feedback/unsaved-dialog/unsaved-dialog.d.ts +20 -0
  36. package/dist/lib/components/ui/fields/contacts/placeholders.d.ts +1 -1
  37. package/dist/lib/components/ui/fields/textarea-field/textarea-footer.d.ts +2 -1
  38. package/dist/lib/components/ui/layout/app-shell/activity-layout.types.d.ts +6 -3
  39. package/dist/lib/components/ui/layout/app-shell/index.d.ts +1 -1
  40. package/dist/lib/components/ui/layout/app-shell/route-transition.d.ts +20 -2
  41. package/dist/lib/components/ui/layout/app-shell/shapes-clear-content.d.ts +2 -1
  42. package/dist/lib/components/ui/widgets/code-editor/configure-monaco.d.ts +2 -0
  43. package/dist/lib/components/ui/widgets/education/questions/index.d.ts +3 -1
  44. package/dist/lib/components/ui/widgets/education/questions/partials/question-content.d.ts +1 -1
  45. package/dist/lib/components/ui/widgets/education/questions/partials/question-top.d.ts +6 -0
  46. package/dist/lib/components/ui/widgets/education/questions/question-long-text.d.ts +5 -0
  47. package/dist/lib/components/ui/widgets/education/questions/question-media-content.d.ts +24 -0
  48. package/dist/lib/components/ui/widgets/education/questions/question-media-helpers.d.ts +11 -0
  49. package/dist/lib/components/ui/widgets/education/questions/question-media-view.d.ts +18 -0
  50. package/dist/lib/components/ui/widgets/education/questions/question-media-view.types.d.ts +32 -0
  51. package/dist/lib/components/ui/widgets/education/questions/question-options.d.ts +2 -2
  52. package/dist/lib/components/ui/widgets/education/questions/question-text.d.ts +1 -1
  53. package/dist/lib/components/ui/widgets/education/questions/question.d.ts +1 -1
  54. package/dist/lib/components/ui/widgets/education/questions/types.d.ts +38 -1
  55. package/dist/lib/components/ui/widgets/education/questions/use-reload-focus.d.ts +13 -0
  56. package/dist/lib/hooks/drafts-store.d.ts +4 -0
  57. package/dist/lib/hooks/index.d.ts +4 -0
  58. package/dist/lib/hooks/unsaved-guard-rules.d.ts +30 -0
  59. package/dist/lib/hooks/use-drafts.d.ts +75 -0
  60. package/dist/lib/hooks/use-react-router-block.d.ts +11 -0
  61. package/dist/lib/hooks/use-unsaved-guard/guard-core.d.ts +30 -0
  62. package/dist/lib/hooks/use-unsaved-guard/index.d.ts +3 -0
  63. package/dist/lib/hooks/use-unsaved-guard/types.d.ts +63 -0
  64. package/dist/lib/hooks/use-unsaved-guard/use-discard-guard.d.ts +15 -0
  65. package/dist/lib/hooks/use-unsaved-guard/use-unsaved-guard.d.ts +19 -0
  66. package/dist/lib/i18n/resources/en/en.d.ts +20 -0
  67. package/dist/lib/i18n/resources/en/material.json.d.ts +21 -1
  68. package/dist/lib/i18n/resources/fr/fr.d.ts +20 -0
  69. package/dist/lib/i18n/resources/fr/material.json.d.ts +21 -1
  70. package/dist/lib/i18n/resources/resources.d.ts +40 -0
  71. package/dist/lib/i18n/translator.d.ts +1 -1
  72. package/dist/lib/illustrations-game/index.d.ts +17 -0
  73. package/dist/lib.js +1 -1
  74. package/dist/main.js +42 -43
  75. package/dist/map.js +63 -63
  76. package/dist/material.css +1 -1
  77. package/dist/pdf-reader.js +1 -1
  78. package/dist/print.js +1 -2
  79. package/dist/{public-BYsrhyPW.js → public-D8JGp3PH.js} +823 -822
  80. package/dist/{rich-code-block-WJxDWPPY.js → rich-code-block-0R3bidsM.js} +5 -5
  81. package/dist/{sortable-provider-oPjlhlZo.js → sortable-provider-B75v53sB.js} +2 -2
  82. package/dist/{spinner-C5lObWXT.js → spinner-CAnpF3RK.js} +1 -1
  83. package/dist/theme-picker.js +2 -2
  84. package/dist/{theme-toggle-CPEq5JG-.js → theme-toggle-pQ5F602V.js} +1 -1
  85. package/dist/{toolbar-items-ByvXcMHm.js → toolbar-items-_ezD5B0r.js} +4 -4
  86. package/dist/translate-material-CvZK8_S6.js +96 -0
  87. package/dist/{stored-language-B-tiWZU2.js → translator-Caf-d96e.js} +2497 -8
  88. package/dist/{escape-owner-r57kuPjn.js → typography-CEK19bj8.js} +17 -34
  89. package/dist/{use-chat-composer-CzOVaIed.js → use-chat-composer-Dpvi_-CR.js} +5164 -5338
  90. package/dist/{use-heading-spy-BOtygPFu.js → use-heading-spy-mmcyEGmm.js} +186 -71
  91. package/dist/{use-material-translation-B5j3jZs7.js → use-material-translation-C_1cWRzW.js} +1 -2
  92. package/dist/use-return-focus-1ZIchrBM.js +269 -0
  93. package/docs/components/data-display.md +1 -0
  94. package/docs/components/feedback-and-status.md +23 -0
  95. package/docs/components/navigation-and-layout.md +5 -4
  96. package/docs/components/rich-widgets.md +73 -1
  97. package/docs/guides/app-shell.md +17 -0
  98. package/docs/guides/code-editor.md +8 -0
  99. package/docs/guides/csp.md +4 -0
  100. package/docs/guides/helpers.md +120 -0
  101. package/docs/guides/icon-motifs.md +3 -1
  102. package/docs/guides/illustrations.md +33 -1
  103. package/docs/guides/migrating-to-3.md +4 -2
  104. package/docs/guides/theming.md +13 -3
  105. package/docs/previews/feedback-status-illustration-game.webp +0 -0
  106. package/docs/previews/feedback-status-unsaveddialog.webp +0 -0
  107. package/docs/roadmap.md +1 -1
  108. package/docs/troubleshooting.md +9 -6
  109. package/lib/components/ui/layout/sidebar/sidebar-tokens.css +13 -1
  110. package/package.json +7 -2
  111. package/dist/dialog-yfPkLqUQ.js +0 -482
  112. package/dist/i18n-provider-BehR6cU7.js +0 -79
  113. package/dist/translate-material-tUaLZUmT.js +0 -20
  114. package/dist/translator-B9XjUDRu.js +0 -2451
@@ -5,7 +5,7 @@ on a Material 3 Expressive plate, two to four satellite icons around it, a
5
5
  dashed ring and a few sparkles. There are twelve scenes: `empty`, `no-results`,
6
6
  `not-found`, `error`, `offline`, `success`, `welcome`, `forbidden`,
7
7
  `maintenance`, `invitation`, `sign-in` and `empty-inbox`, and two domain sets of
8
- ten more each, health and education, in their own entries ([health](#scene-sets-the-health-scenes) and [education](#scene-sets-the-education-scenes)). The icons are
8
+ ten more each, health and education, in their own entries ([health](#scene-sets-the-health-scenes) and [education](#scene-sets-the-education-scenes)), and eleven for games ([game](#scene-sets-the-game-scenes)). The icons are
9
9
  [Font Awesome](https://fontawesome.com) sprites **your app serves** (see
10
10
  [Icons](../getting-started.md#icons)): the package ships no icon artwork, so it
11
11
  works with the sprites your licence covers. The [icon motifs guide](icon-motifs.md) shows them next to the icon backgrounds, the sky and the themes, and lists the suggested names that are Pro only, with Free neighbours.
@@ -146,6 +146,38 @@ the icon names the set draws, hero first. Some of them (`backpack`,
146
146
  `clipboard-list-check`, `books`, `file-chart-column`) are Font Awesome Pro
147
147
  icons: serve a Pro sprite, or set `edition="free"` on `IconSpritesProvider`, which draws their Free twins (see the [Free edition](icon-motifs.md#the-free-edition)).
148
148
 
149
+ ## Scene sets: the game scenes
150
+
151
+ `@nxgt/material/illustrations/game` holds eleven scenes for a game, a quiz, a
152
+ community or an event app: `night-sky`, `village`, five character pictograms
153
+ (`seer`, `healer`, `archer`, `cupid`, `wolf`), `victory`, `empty-table`,
154
+ `waiting-players` and `connection-lost`. It works exactly like the other sets,
155
+ and they register side by side. Use them where a screen is empty, waiting,
156
+ failed, celebrating or opening: a lobby with no players, a round that waits, a
157
+ dropped connection, a winner, a night-phase hero. Keep them away from behind
158
+ data.
159
+
160
+ <img src="../previews/feedback-status-illustration-game.webp" width="480" alt="The eleven game scenes">
161
+
162
+ ```tsx
163
+ import { Illustration, IllustrationDefaults } from '@nxgt/material/illustrations';
164
+ import { GAME_SCENES } from '@nxgt/material/illustrations/game';
165
+ import { EmptyState } from '@nxgt/material/components';
166
+
167
+ <IllustrationDefaults sets={[GAME_SCENES]}>
168
+ <Illustration scene="night-sky" /> {/* decorative: aria-hidden */}
169
+ <Illustration scene="victory" title="Victory" /> {/* role="img" + aria-label */}
170
+ <EmptyState illustration="empty-table" title="No one at the table" />
171
+ </IllustrationDefaults>
172
+ ```
173
+
174
+ Colours come from the theme's tone tokens (light and dark follow the theme),
175
+ motion stops under `prefers-reduced-motion`, and a scene is 120, 190 or 280 px
176
+ wide (`size`), never wider than its container. The `night-sky` scene is
177
+ unrelated to the `night-sky` Background preset. Every icon is in the Free sheet, so `edition="free"`
178
+ needs no substitution; `GAME_SUGGESTED_ICONS` lists the names, hero first.
179
+ Importing the entry adds the ids to `SceneId`.
180
+
149
181
  ## Turn them on for an app
150
182
 
151
183
  `IllustrationDefaults` opts a subtree in: every default-size `EmptyState` and
@@ -59,7 +59,8 @@ component`). As a peer there is one copy, your app's.
59
59
  ## ActivityLayout animates route changes (`routeTransition`)
60
60
 
61
61
  3.0 wraps the content region of `ActivityLayout` in React's `<ViewTransition>`,
62
- on by default: a navigation cross-fades the page, the sidebar, header and
62
+ on by default: a navigation cross-fades the page (only when the pathname
63
+ changes; see [Route transitions](./app-shell.md#route-transitions)), the sidebar, header and
63
64
  breadcrumb staying still. Back and Forward may not animate (React skips view
64
65
  transitions for synchronous popstate updates).
65
66
 
@@ -92,7 +93,8 @@ shell's off with `routeTransition={false}`, or remove yours:
92
93
  ```
93
94
 
94
95
  The prop is `routeTransition?: boolean | Omit<ViewTransitionProps, 'children' | 'ref'>`,
95
- default `true`. An object turns it on and passes its props through, so the app
96
+ default `true` (it fades only when the pathname changes; see
97
+ [Route transitions](./app-shell.md#route-transitions)). An object turns it on and passes its props through, so the app
96
98
  can pick its own classes: `routeTransition={{ default: 'my-route' }}`.
97
99
 
98
100
  **Nested boundaries.** An inner `<ViewTransition>` takes the mutation from the
@@ -620,15 +620,16 @@ descendant of it: an element that reads `--nxgt-tone-container` needs its own
620
620
  ## The active entry of the sidebar and the rail
621
621
 
622
622
  The selected `SidebarMenuItem` (and so the `AppSidebar` and `ActivityLayout`
623
- rail and menu sheet) is drawn with three tokens, in light and in dark:
623
+ rail and menu sheet) is drawn with four tokens, in light and in dark:
624
624
 
625
625
  | Token | Tailwind | Default, light | Default, dark |
626
626
  | --- | --- | --- | --- |
627
627
  | `--sidebar-active` | `bg-sidebar-active` | primary at 15 % | primary at 30 % |
628
628
  | `--sidebar-active-hover` | `bg-sidebar-active-hover` | primary at 20 % | primary at 35 % |
629
629
  | `--sidebar-active-foreground` | `text-sidebar-active-foreground` | `oklch(from var(--primary) calc(l * 0.85) c h)`, 4.5:1 or more on the pill for every theme preset | `oklch(from var(--primary) 0.72 0.15 h)`, 6.3:1 or more on the pill |
630
+ | `--sidebar-active-edge` | `bg-sidebar-active-edge` | the value of `--sidebar-active-foreground` | the value of `--sidebar-active-foreground` |
630
631
 
631
- The pill is the icon's (collapsed rail) or the whole row (expanded), a pill in the collapsed rail and, in the expanded row, an `--nxgt-item-radius` (6px) shape that carries the 3px start bar every chosen row has, drawn in `--sidebar-active-foreground` (a `Highlight` bar in forced colours); the
632
+ The pill is the icon's (collapsed rail) or the whole row (expanded), a pill in the collapsed rail and, in the expanded row, an `--nxgt-item-radius` (6px) shape that carries the 3px start bar every chosen row has, drawn in `--sidebar-active-edge` (a `Highlight` bar in forced colours); the
632
633
  foreground is the label and the icon, whose duotone layers both follow it (in
633
634
  dark too: the icon of `AppSidebar` is the lifted lavender like its label). The
634
635
  label is read on the pill (expanded) or on the sidebar (collapsed rail); the
@@ -639,9 +640,18 @@ itself in light and dark, as both the light darkening and the dark lift need
639
640
 
640
641
  The defaults are derived where the entry is drawn, from the `--primary` it
641
642
  sits under, so a `--primary` set on a wrapper recolours the rail inside it.
642
- The three tokens are not declared on `:root`: setting one replaces its
643
+ The four tokens are not declared on `:root`: setting one replaces its
643
644
  default wherever it is set.
644
645
 
646
+ `--sidebar-active-edge` recolours the start bar alone; unset, the bar follows
647
+ the foreground:
648
+
649
+ ```css
650
+ :root {
651
+ --sidebar-active-edge: oklch(0.8 0.15 90);
652
+ }
653
+ ```
654
+
645
655
  Set them after importing the stylesheet, under the same selectors as the
646
656
  theme, for example a rail in the `maths` colour:
647
657
 
package/docs/roadmap.md CHANGED
@@ -250,7 +250,7 @@ version they shipped in, and planned entries may name the major they target.
250
250
  (`name` for a key, `range` for a value), as it does for the icon keys.
251
251
 
252
252
  - **More illustration sets** — finance, travel and tech scenes beside the
253
- health and education sets, each in its own subpath.
253
+ health, education and game sets, each in its own subpath.
254
254
  - **More generic scenes** — further base scenes for `Illustration` beyond the
255
255
  twelve it draws today (`forbidden`, `maintenance`, `invitation`, `sign-in`
256
256
  and `empty-inbox` are among them), added on demand.
@@ -2724,10 +2724,12 @@ See [Route transitions](./guides/app-shell.md#route-transitions).
2724
2724
  **When:** after upgrading to `@nxgt/material` 3.0, a filter, a tab switch, a
2725
2725
  `useDeferredValue` update or a lazy part loading inside `ActivityLayout`'s
2726
2726
  content fades the whole page, as a navigation does.
2727
- **Why:** the shell's `<ViewTransition>` animates every transition that changes
2728
- its content region, not only navigations: your `startTransition`,
2729
- `useDeferredValue` and Suspense reveals too. The Gallery's morph is the one
2730
- exception the shell makes itself.
2727
+ **Why:** the default fades the region only when the pathname changes, so a
2728
+ filter or a `?tab=` change does not fade it. Two cases still do: an explicit
2729
+ `routeTransition={{ default: 'nxgt-route' }}`, which animates every transition
2730
+ that changes the region (your `startTransition`, `useDeferredValue`, Suspense
2731
+ reveals), and a Suspense reveal or a transition that changes the pathname on the
2732
+ default. The Gallery's morph is the one exception the shell makes itself.
2731
2733
  **Fix:** give your transition a type and map that type to `'none'`:
2732
2734
 
2733
2735
  ```tsx
@@ -7801,14 +7803,15 @@ z.config({ jitless: true });
7801
7803
  ### `Illustration: … Drawing the built-in art instead.`
7802
7804
 
7803
7805
  **When:** a development-only `console.warn`, once per message, from an `Illustration` (or an `EmptyState` / `ErrorState` with `illustration`) that cannot be built. The page does not break: the built-in art of the scene's kind is drawn, and production builds do it silently.
7804
- **Why:** the scene id is in no table (`"patient-record" is not a scene of the table`), an icon name is not valid, or the style is not one Font Awesome 7.3.1 draws. A domain id such as `patient-record` (health) or `classroom` (education) is only a scene when its set is registered; in an `EmptyState`, `illustration="no-patients"` or `"no-students"` is otherwise drawn as text.
7806
+ **Why:** the scene id is in no table (`"patient-record" is not a scene of the table`), an icon name is not valid, or the style is not one Font Awesome 7.3.1 draws. A domain id such as `patient-record` (health) `classroom` (education) or `village` (game) is only a scene when its set is registered; in an `EmptyState`, `illustration="no-patients"`, `"no-students"` or `"empty-table"` is otherwise drawn as text.
7805
7807
  **Fix:** register the set once for the subtree, or pass it to the one `Illustration`; and take `iconStyle` from the 37 sprite file names (a bad name is a type error):
7806
7808
 
7807
7809
  ```tsx
7808
7810
  import { EDUCATION_SCENES } from '@nxgt/material/illustrations/education';
7811
+ import { GAME_SCENES } from '@nxgt/material/illustrations/game';
7809
7812
  import { HEALTH_SCENES } from '@nxgt/material/illustrations/health';
7810
7813
 
7811
- <IllustrationDefaults sets={[HEALTH_SCENES, EDUCATION_SCENES]}>
7814
+ <IllustrationDefaults sets={[HEALTH_SCENES, EDUCATION_SCENES, GAME_SCENES]}>
7812
7815
  <EmptyState illustration="no-patients" />
7813
7816
  </IllustrationDefaults>;
7814
7817
 
@@ -8,7 +8,9 @@
8
8
  * follow a `--primary` set below :root. To theme the rail set
9
9
  * `--sidebar-active`, `--sidebar-active-hover` and
10
10
  * `--sidebar-active-foreground` (all three, or the first two and the
11
- * foreground); the derived colours are not declared here, on purpose. */
11
+ * foreground); the derived colours are not declared here, on purpose.
12
+ * `--sidebar-active-edge` recolours the start bar alone; unset, the bar is
13
+ * the foreground (`--sidebar-active-edge: gold` changes nothing else). */
12
14
  --nxgt-sidebar-active-share: 15%;
13
15
  /* Light: primary itself reads 4.5:1 on the page but not on its own 15 % pill
14
16
  * for every preset (corail 3.7:1), so the label is primary darkened to 85 %
@@ -71,4 +73,14 @@
71
73
  var(--nxgt-sidebar-active-c, c) h
72
74
  )
73
75
  );
76
+ --color-sidebar-active-edge: var(
77
+ --sidebar-active-edge,
78
+ var(
79
+ --sidebar-active-foreground,
80
+ oklch(
81
+ from var(--primary) var(--nxgt-sidebar-active-l, l)
82
+ var(--nxgt-sidebar-active-c, c) h
83
+ )
84
+ )
85
+ );
74
86
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxgt/material",
3
- "version": "3.60.0",
3
+ "version": "3.63.0",
4
4
  "license": "MIT",
5
5
  "bugs": {
6
6
  "email": "stevegires@gmail.com"
@@ -105,6 +105,11 @@
105
105
  "types": "./dist/lib/illustrations-education/index.d.ts",
106
106
  "require": "./dist/illustrations-education.js"
107
107
  },
108
+ "./illustrations/game": {
109
+ "import": "./dist/illustrations-game.js",
110
+ "types": "./dist/lib/illustrations-game/index.d.ts",
111
+ "require": "./dist/illustrations-game.js"
112
+ },
108
113
  "./themes": {
109
114
  "import": "./dist/themes.js",
110
115
  "types": "./dist/lib/themes/index.d.ts",
@@ -367,7 +372,7 @@
367
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"
368
373
  },
369
374
  "dependencies": {
370
- "@nxgt/material-core": "^0.43.0",
375
+ "@nxgt/material-core": "^0.44.0",
371
376
  "@base-ui/react": "^1.6.0",
372
377
  "@dnd-kit/core": "^6.3.1",
373
378
  "@dnd-kit/sortable": "^10.0.0",