@nxgt/material 3.51.0 → 3.53.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 (133) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +5 -4
  3. package/dist/{async-slice-BGtmF3K5.js → async-slice-DDSsekfm.js} +2 -2
  4. package/dist/{button-BWcr2b49.js → button-Ct8DSLVv.js} +1 -1
  5. package/dist/charts.js +1064 -932
  6. package/dist/{chip-CmLW6ZrT.js → chip-BzoNsd-W.js} +2 -2
  7. package/dist/{code-editor-BKMaeIF6.js → code-editor-DsLQeiZc.js} +6 -6
  8. package/dist/code-editor.js +5 -5
  9. package/dist/{code-language-items-Cs1Pwd1h.js → code-language-items-4zXlIEZ0.js} +2 -2
  10. package/dist/components/components.css +1 -5
  11. package/dist/components/ui/actions/action-card/action-card-tile.css +11 -2
  12. package/dist/components/ui/collections/data-table/data-table-items-record.css +27 -0
  13. package/dist/components/ui/collections/data-table/index.css +14 -0
  14. package/dist/{components-CuwU9Sux.js → components-DZPMvc1w.js} +16110 -15921
  15. package/dist/components.js +26 -26
  16. package/dist/{dialog-TdT_5iUc.js → dialog-DwPmwmA3.js} +4 -4
  17. package/dist/dnd.js +1 -1
  18. package/dist/draw-animate.js +1 -1
  19. package/dist/{dropdown-menu-BozV6Ikw.js → dropdown-menu-CDN6Nqx6.js} +1 -1
  20. package/dist/editor.js +9 -9
  21. package/dist/{empty-state-gzBPimAo.js → empty-state-Bb9W9did.js} +2 -2
  22. package/dist/{escape-owner-Bu-aDEEO.js → escape-owner-DI_lg2ID.js} +1 -1
  23. package/dist/{field-blur-47zmuDkH.js → field-blur-BcJH8H9B.js} +1 -1
  24. package/dist/{field-blur-context-6McYOnM8.js → field-blur-context-Dg1nwWOV.js} +1 -1
  25. package/dist/hooks.js +2 -2
  26. package/dist/{hover-card-zHdZJpBG.js → hover-card-Qse4gnop.js} +2 -2
  27. package/dist/i18n-provider-DlVPS58N.js +79 -0
  28. package/dist/i18n.js +5 -5
  29. package/dist/{icon-badge-CRFGIQPX.js → icon-badge-DVPBQOKe.js} +3 -3
  30. package/dist/{icon-button-CtG3Snfm.js → icon-button-C3wDxsh6.js} +12 -12
  31. package/dist/lib/components/ui/actions/action-card/action-card-semantics.d.ts +17 -1
  32. package/dist/lib/components/ui/actions/action-card/action-card.d.ts +16 -2
  33. package/dist/lib/components/ui/actions/action-card/partials/action-card-text.d.ts +6 -2
  34. package/dist/lib/components/ui/actions/action-card/partials/action-card-title-button.d.ts +15 -1
  35. package/dist/lib/components/ui/actions/action-card/partials/action-card-trail.d.ts +2 -1
  36. package/dist/lib/components/ui/collections/data-grid/columns/column-codec.d.ts +3 -3
  37. package/dist/lib/components/ui/collections/data-grid/columns/column-edit.d.ts +5 -5
  38. package/dist/lib/components/ui/collections/data-grid/columns/row-meta.d.ts +22 -0
  39. package/dist/lib/components/ui/collections/data-grid/grid-meta.d.ts +10 -3
  40. package/dist/lib/components/ui/collections/data-table/data-table.d.ts +1 -1
  41. package/dist/lib/components/ui/collections/data-table/layout-types.d.ts +27 -0
  42. package/dist/lib/components/ui/collections/data-table/partials/layouts/data-table-item-context.d.ts +2 -0
  43. package/dist/lib/components/ui/collections/data-table/partials/layouts/data-table-item-row.d.ts +8 -0
  44. package/dist/lib/components/ui/collections/data-table/types.d.ts +1 -1
  45. package/dist/lib/components/ui/collections/filter/bar/filter-bar-classes.d.ts +7 -2
  46. package/dist/lib/components/ui/collections/server-table/partials/filtered-server-table.d.ts +1 -0
  47. package/dist/lib/components/ui/collections/server-table/partials/server-table-band-classes.d.ts +5 -0
  48. package/dist/lib/components/ui/collections/server-table/partials/server-table-band-view.d.ts +18 -0
  49. package/dist/lib/components/ui/collections/server-table/partials/use-server-table-list-root.d.ts +10 -0
  50. package/dist/lib/components/ui/collections/server-table/partials/use-server-table-phone-row.d.ts +3 -2
  51. package/dist/lib/components/ui/display/change-history/types.d.ts +2 -1
  52. package/dist/lib/components/ui/display/description/description.d.ts +2 -2
  53. package/dist/lib/components/ui/display/list-tile/internal.d.ts +1 -0
  54. package/dist/lib/components/ui/display/list-tile/partials/list-tile-dense-text.d.ts +28 -0
  55. package/dist/lib/components/ui/feedback/toast/toast-text.d.ts +7 -0
  56. package/dist/lib/components/ui/fields/contacts/placeholders.d.ts +1 -1
  57. package/dist/lib/components/ui/fields/verification-code/use-resend-focus.d.ts +4 -1
  58. package/dist/lib/components/ui/forms/index.d.ts +2 -0
  59. package/dist/lib/components/ui/forms/use-fast-form.d.ts +25 -0
  60. package/dist/lib/components/ui/forms/use-focus-on-refusal.d.ts +14 -0
  61. package/dist/lib/components/ui/layout/app-shell/activity-content-aside.d.ts +3 -1
  62. package/dist/lib/components/ui/layout/app-shell/activity-content.d.ts +10 -1
  63. package/dist/lib/components/ui/primitives/tabs/tabs-overflow-classes.d.ts +8 -5
  64. package/dist/lib/components/ui/primitives/tabs/use-tabs-overflow.d.ts +4 -3
  65. package/dist/lib/components/ui/selection/switcher/partials/switcher-trigger.d.ts +3 -1
  66. package/dist/lib/components/ui/selection/switcher/switcher.d.ts +1 -1
  67. package/dist/lib/components/ui/selection/switcher/types.d.ts +7 -0
  68. package/dist/lib/components/ui/widgets/native-charts/core/reference-text.d.ts +14 -6
  69. package/dist/lib/components/ui/widgets/native-charts/core/reference.d.ts +57 -10
  70. package/dist/lib/components/ui/widgets/native-charts/core/types.d.ts +13 -5
  71. package/dist/lib/components/ui/widgets/native-charts/hooks/chart-model-types.d.ts +3 -2
  72. package/dist/lib/components/ui/widgets/native-charts/index.d.ts +1 -1
  73. package/dist/lib/components/ui/widgets/native-charts/line-chart/line-chart-types.d.ts +6 -1
  74. package/dist/lib/components/ui/widgets/native-charts/line-chart/partials/reference-marks.d.ts +1 -1
  75. package/dist/lib/i18n/i18n-provider.d.ts +14 -3
  76. package/dist/lib/i18n/material-resources-registry.d.ts +21 -0
  77. package/dist/lib/i18n/resources/en/en.d.ts +4 -0
  78. package/dist/lib/i18n/resources/en/material.json.d.ts +5 -1
  79. package/dist/lib/i18n/resources/fr/fr.d.ts +4 -0
  80. package/dist/lib/i18n/resources/fr/material.json.d.ts +5 -1
  81. package/dist/lib/i18n/resources/resources.d.ts +8 -0
  82. package/dist/lib/i18n/translate-material.d.ts +7 -1
  83. package/dist/lib/i18n/translator.d.ts +1 -1
  84. package/dist/lib/i18n/types.d.ts +6 -0
  85. package/dist/lib/i18n/use-material-translation.d.ts +4 -0
  86. package/dist/lib.js +1 -1
  87. package/dist/main.js +43 -43
  88. package/dist/map.js +8 -8
  89. package/dist/material.css +1 -1
  90. package/dist/pdf-reader.js +1 -1
  91. package/dist/print.js +5 -4
  92. package/dist/{public-CTZ5RK_Y.js → public-BoVE0ffh.js} +9 -9
  93. package/dist/{rich-code-block-oTgL-s4W.js → rich-code-block-DAUM7Yh_.js} +5 -5
  94. package/dist/{sortable-provider-CpA5NYgD.js → sortable-provider-BLXsGE_0.js} +2 -2
  95. package/dist/{spinner-UvqlDsV8.js → spinner-Rg4PnBPH.js} +1 -1
  96. package/dist/{stored-language-Cb9FMEwk.js → stored-language-B1lJMPbR.js} +10 -2
  97. package/dist/theme-picker.js +2 -2
  98. package/dist/{theme-toggle-BZVz6O5q.js → theme-toggle-jVdxF_mc.js} +1 -1
  99. package/dist/{toolbar-items-C09bJphe.js → toolbar-items-BFY_hns5.js} +4 -4
  100. package/dist/translate-material-q-JNxP1m.js +20 -0
  101. package/dist/{translator-BnQXtpSZ.js → translator-BU1o3_l9.js} +1 -1
  102. package/dist/{use-chat-composer-AZAj4tFJ.js → use-chat-composer-DGbDuIUa.js} +3783 -3719
  103. package/dist/{use-heading-spy-C9-A2md2.js → use-heading-spy-CP63sAcS.js} +1 -1
  104. package/dist/use-material-translation-nNF8fUXz.js +14 -0
  105. package/dist/use-shape-morph-DXdy2X5g.js +35 -0
  106. package/docs/components/buttons-and-actions.md +30 -1
  107. package/docs/components/data-display.md +3 -3
  108. package/docs/components/data-table-filter-and-lists.md +2 -2
  109. package/docs/components/navigation-and-layout.md +1 -0
  110. package/docs/components/primitives.md +1 -1
  111. package/docs/components/rich-widgets.md +2 -1
  112. package/docs/components/selection-and-choice.md +20 -0
  113. package/docs/guides/app-shell.md +22 -0
  114. package/docs/guides/cards-and-tiles.md +40 -4
  115. package/docs/guides/charts.md +30 -2
  116. package/docs/guides/data-grid.md +42 -2
  117. package/docs/guides/forms.md +35 -0
  118. package/docs/guides/helpers.md +1 -1
  119. package/docs/guides/i18n.md +34 -8
  120. package/docs/guides/two-factor.md +2 -1
  121. package/docs/previews/guides-i18n-i18nprovider.webp +0 -0
  122. package/docs/previews/guides-i18n-translated-components.webp +0 -0
  123. package/docs/roadmap.md +84 -684
  124. package/docs/troubleshooting.md +24 -2
  125. package/lib/components/components.css +1 -5
  126. package/lib/components/ui/actions/action-card/action-card-tile.css +11 -2
  127. package/lib/components/ui/collections/data-table/data-table-items-record.css +27 -0
  128. package/lib/components/ui/collections/data-table/index.css +14 -0
  129. package/package.json +1 -1
  130. package/dist/i18n-provider-Ang2f31m.js +0 -43
  131. package/dist/translate-material-D6KCK21i.js +0 -12
  132. package/dist/use-material-translation-pLgSqqLw.js +0 -14
  133. package/dist/use-shape-morph-BKA_R5P5.js +0 -35
@@ -1,6 +1,9 @@
1
1
  export declare const TABS_OVERFLOW_FADE = "data-[overflow-left]:[--tabs-fade-left:2rem] data-[overflow-right]:[--tabs-fade-right:2rem] data-[overflow-left]:[mask-image:linear-gradient(to_right,transparent,#000_var(--tabs-fade-left,0px),#000_calc(100%_-_var(--tabs-fade-right,0px)),transparent)] data-[overflow-right]:[mask-image:linear-gradient(to_right,transparent,#000_var(--tabs-fade-left,0px),#000_calc(100%_-_var(--tabs-fade-right,0px)),transparent)]";
2
- /** The box laid over the list: it ignores the pointer except on its buttons. */
3
- export declare const TABS_SCROLL_OVERLAY = "pointer-events-none absolute z-20";
4
- export declare const TABS_SCROLL_BUTTON = "pointer-events-auto absolute top-1/2 inline-flex size-7 -translate-y-1/2 cursor-pointer items-center justify-center rounded-full border border-border bg-background text-foreground shadow-sm transition-colors hover:bg-muted pointer-coarse:size-11 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary dark:focus-visible:outline-track-fill [&_svg]:size-4";
5
- export declare const TABS_SCROLL_LEFT = "pointer-events-auto absolute top-1/2 inline-flex size-7 -translate-y-1/2 cursor-pointer items-center justify-center rounded-full border border-border bg-background text-foreground shadow-sm transition-colors hover:bg-muted pointer-coarse:size-11 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary dark:focus-visible:outline-track-fill [&_svg]:size-4 left-1";
6
- export declare const TABS_SCROLL_RIGHT = "pointer-events-auto absolute top-1/2 inline-flex size-7 -translate-y-1/2 cursor-pointer items-center justify-center rounded-full border border-border bg-background text-foreground shadow-sm transition-colors hover:bg-muted pointer-coarse:size-11 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary dark:focus-visible:outline-track-fill [&_svg]:size-4 right-1";
2
+ /**
3
+ * The box laid over the list: it ignores the pointer except on its buttons,
4
+ * and clips them to the list's own box (#1824).
5
+ */
6
+ export declare const TABS_SCROLL_OVERLAY = "pointer-events-none absolute z-20 overflow-hidden";
7
+ export declare const TABS_SCROLL_BUTTON = "pointer-events-auto absolute top-1/2 inline-flex size-7 -translate-y-1/2 cursor-pointer items-center justify-center rounded-full border border-border bg-background text-foreground shadow-sm transition-colors hover:bg-muted pointer-coarse:h-full pointer-coarse:max-h-11 pointer-coarse:w-11 focus-visible:outline-2 focus-visible:outline-offset-[-3px] focus-visible:outline-primary dark:focus-visible:outline-track-fill [&_svg]:size-4";
8
+ export declare const TABS_SCROLL_LEFT = "pointer-events-auto absolute top-1/2 inline-flex size-7 -translate-y-1/2 cursor-pointer items-center justify-center rounded-full border border-border bg-background text-foreground shadow-sm transition-colors hover:bg-muted pointer-coarse:h-full pointer-coarse:max-h-11 pointer-coarse:w-11 focus-visible:outline-2 focus-visible:outline-offset-[-3px] focus-visible:outline-primary dark:focus-visible:outline-track-fill [&_svg]:size-4 left-1";
9
+ export declare const TABS_SCROLL_RIGHT = "pointer-events-auto absolute top-1/2 inline-flex size-7 -translate-y-1/2 cursor-pointer items-center justify-center rounded-full border border-border bg-background text-foreground shadow-sm transition-colors hover:bg-muted pointer-coarse:h-full pointer-coarse:max-h-11 pointer-coarse:w-11 focus-visible:outline-2 focus-visible:outline-offset-[-3px] focus-visible:outline-primary dark:focus-visible:outline-track-fill [&_svg]:size-4 right-1";
@@ -18,8 +18,9 @@ export declare function revealTab(list: HTMLElement, tab: HTMLElement, behavior?
18
18
  /**
19
19
  * Whether a horizontal tab list overflows, and on which side. It starts as
20
20
  * "fits" so the server markup and the first client render agree; a
21
- * ResizeObserver (tabs and list) and the scroll event update it, one frame at
22
- * a time, and the state only changes when a value does. The same effect
23
- * keeps the active tab (and the focused one) in view.
21
+ * ResizeObserver (tabs and list) updates it, one frame at a time, and the
22
+ * state only changes when a value does. The page-wide scroll listener lives
23
+ * in `useFollowScroll` and runs only while the list overflows. The same
24
+ * effect keeps the active tab (and the focused one) in view.
24
25
  */
25
26
  export declare function useTabsOverflow(ref: RefObject<HTMLElement | null>): TabsOverflow;
@@ -4,6 +4,8 @@ type Props = Omit<ComponentProps<'button'>, 'value' | 'onChange' | 'children'> &
4
4
  selected?: SwitcherItem;
5
5
  label: SwitcherProps['label'];
6
6
  expressive: boolean;
7
+ /** An icon-only round button: the label and the chosen title are read to screen readers only. */
8
+ compact?: boolean;
7
9
  titleRef: Ref<HTMLSpanElement>;
8
10
  /** The title is clipped by an ellipsis: it carries the full title as `aria-label` (what `expectNoTextOverflow` reads), the tooltip shows the rest. */
9
11
  clipped: boolean;
@@ -16,5 +18,5 @@ type Props = Omit<ComponentProps<'button'>, 'value' | 'onChange' | 'children'> &
16
18
  * chevron), or, expressive, a pill. Its accessible name is its content: the
17
19
  * label, the full title (the ellipsis is only CSS) and the subtitle.
18
20
  */
19
- export declare function SwitcherTrigger({ selected, label, expressive, titleRef, clipped, subtitleRef, subtitleClipped, className, name, ...props }: Props): import("react").JSX.Element;
21
+ export declare function SwitcherTrigger({ selected, label, expressive, compact, titleRef, clipped, subtitleRef, subtitleClipped, className, name, ...props }: Props): import("react").JSX.Element;
20
22
  export {};
@@ -7,4 +7,4 @@ export type { SwitcherFooter, SwitcherItem, SwitcherProps, } from './types.js';
7
7
  * on a phone, a bottom sheet. `variant="expressive"` is a pill with a larger
8
8
  * panel and a "Recent" strip. With `getHref` the options are links.
9
9
  */
10
- export declare function Switcher({ options, label, value, onValueChange, variant, searchable, recent, getHref, linkComponent, footer, emptyLabel, sheet, open: openProp, onOpenChange, ...props }: SwitcherProps): import("react").JSX.Element;
10
+ export declare function Switcher({ options, label, value, onValueChange, variant, size, searchable, recent, getHref, linkComponent, footer, emptyLabel, sheet, open: openProp, onOpenChange, ...props }: SwitcherProps): import("react").JSX.Element;
@@ -34,6 +34,13 @@ export type SwitcherProps = {
34
34
  onValueChange?: (value: string) => void;
35
35
  /** `default` is the tile trigger and menu; `expressive` is the pill and the large panel. */
36
36
  variant?: 'default' | 'expressive';
37
+ /**
38
+ * `default` is the full trigger (tile, title, subtitle). `compact` is an icon-only
39
+ * round button, for a bar whose title already names the chosen option (the
40
+ * `titleAfter` slot): named by the label and the chosen title, its tooltip shows
41
+ * them, the panel is unchanged. A 44px box on a coarse pointer.
42
+ */
43
+ size?: 'default' | 'compact';
37
44
  /** A search field in the panel; default: from 8 options (always, when expressive). */
38
45
  searchable?: boolean;
39
46
  /** Up to 3 option ids shown as tiles above the groups while nothing is typed (expressive). */
@@ -1,6 +1,6 @@
1
1
  import { ToneMark } from './point-tones.js';
2
+ import { RefBand, RefThreshold } from './reference.js';
2
3
  import { ChartTranslate } from './translate.js';
3
- import { ChartBand, ChartThreshold } from './types.js';
4
4
  /**
5
5
  * The words of a chart's reference bands, thresholds and toned points, for
6
6
  * the summary and the "View data" notes. Pure: the translator comes in as an
@@ -12,19 +12,27 @@ export type ReferenceSeries = {
12
12
  /** The tone mark of each row, null where there is none. */
13
13
  tones?: readonly (ToneMark | null)[];
14
14
  };
15
- /** One line per band ("Normal range: 40 to 60") then one per threshold ("High: 70"): the notes under the data table. */
15
+ /**
16
+ * One line per band ("Normal range: 40 to 60") then one per threshold
17
+ * ("High: 70"): the notes under the data table. A band or a threshold that
18
+ * steps along x names each of its values with the x labels it covers
19
+ * ("Normal range: 40 to 60 (Jan to Mar), 45 to 70 (Apr to Jun)"); `labels` are
20
+ * the x labels, one per row.
21
+ */
16
22
  export declare function referenceNotes(t: ChartTranslate, input: {
17
- bands: readonly ChartBand[];
18
- thresholds: readonly ChartThreshold[];
23
+ bands: readonly RefBand[];
24
+ thresholds: readonly RefThreshold[];
19
25
  format: (value: number) => string;
26
+ labels?: readonly string[];
20
27
  }): string[];
21
28
  /**
22
29
  * The summary sentences: the ranges and the lines, then for each series how
23
30
  * many values lie outside each band, then how many points carry each tone.
24
31
  */
25
32
  export declare function referenceSummary(t: ChartTranslate, input: {
26
- bands: readonly ChartBand[];
27
- thresholds: readonly ChartThreshold[];
33
+ bands: readonly RefBand[];
34
+ thresholds: readonly RefThreshold[];
28
35
  series: readonly ReferenceSeries[];
29
36
  format: (value: number) => string;
37
+ labels?: readonly string[];
30
38
  }): string[];
@@ -1,4 +1,4 @@
1
- import { ChartBand, ChartThreshold } from './types.js';
1
+ import { ChartBand, ChartRow, ChartThreshold } from './types.js';
2
2
  /**
3
3
  * The maths of a line chart's reference bands and threshold lines: they are
4
4
  * cleaned once (a range given backwards, a value that is not a number), fed
@@ -7,19 +7,66 @@ import { ChartBand, ChartThreshold } from './types.js';
7
7
  */
8
8
  /** A value-axis span, low then high. */
9
9
  export type Domain = readonly [number, number];
10
- /** The bands with a finite range, each as `from <= to`; the rest are dropped. */
11
- export declare function normalizeBands(bands: readonly ChartBand[] | undefined): ChartBand[];
12
- /** The thresholds with a finite value. */
13
- export declare function normalizeThresholds(thresholds: readonly ChartThreshold[] | undefined): ChartThreshold[];
10
+ /** One row's range of a stepped band. */
11
+ export type BandRange = {
12
+ from: number;
13
+ to: number;
14
+ };
15
+ /** A band as the chart draws it: numbers only. `from` and `to` hold the whole span (the envelope of a stepped band), `ranges` the range of each row. */
16
+ export type RefBand = Omit<ChartBand, 'from' | 'to'> & {
17
+ from: number;
18
+ to: number;
19
+ /** Set when the band steps along x: the range of each row, null where it has none. */
20
+ ranges?: (BandRange | null)[];
21
+ };
22
+ /** A threshold as the chart draws it; `values` holds the value of each row when it steps along x. */
23
+ export type RefThreshold = Omit<ChartThreshold, 'value'> & {
24
+ value: number;
25
+ values?: (number | null)[];
26
+ };
27
+ /**
28
+ * The bands with a finite range, each as `from <= to`; the rest are dropped.
29
+ * A band whose ends are a row field or a function is read against each row of
30
+ * `data`: it keeps its `ranges` unless every row gives the same one.
31
+ */
32
+ export declare function normalizeBands(bands: readonly ChartBand[] | undefined, data?: readonly ChartRow[]): RefBand[];
33
+ /** The thresholds with a finite value; one given by a row field or a function keeps its `values` unless every row gives the same one. */
34
+ export declare function normalizeThresholds(thresholds: readonly ChartThreshold[] | undefined, data?: readonly ChartRow[]): RefThreshold[];
14
35
  /** Every value a band or a threshold marks: the value domain grows to hold them. */
15
- export declare function referenceValues(bands: readonly ChartBand[], thresholds: readonly ChartThreshold[]): number[];
36
+ export declare function referenceValues(bands: readonly RefBand[], thresholds: readonly RefThreshold[]): number[];
37
+ /** A stretch of consecutive rows with the same reference value: `first` to `last` are row indexes. */
38
+ export type Run<V> = {
39
+ first: number;
40
+ last: number;
41
+ value: V;
42
+ };
43
+ /**
44
+ * The runs of consecutive rows that share a value (`same` tells), a row with
45
+ * no value (null) ending the run and leaving a gap. Without `perRow` the one
46
+ * constant value covers every row.
47
+ */
48
+ export declare function refRuns<V>(count: number, constant: V, perRow: readonly (V | null)[] | undefined, same: (a: V, b: V) => boolean): Run<V>[];
49
+ /** The runs of a band's ranges. */
50
+ export declare const bandRuns: (b: RefBand, count: number) => Run<BandRange>[];
51
+ /** The runs of a threshold's values. */
52
+ export declare const thresholdRuns: (th: RefThreshold, count: number) => Run<number>[];
53
+ /**
54
+ * Where a run sits across the plot, `x` mapping a row index to a pixel and
55
+ * `width` the plot's width: each row owns the stretch up to the midpoint to
56
+ * its neighbour, the first row from the plot's left edge and the last up to
57
+ * its right edge.
58
+ */
59
+ export declare function runSpan(run: Pick<Run<unknown>, 'first' | 'last'>, count: number, x: (index: number) => number, width: number): {
60
+ x1: number;
61
+ x2: number;
62
+ };
16
63
  /** The part of `band` inside `domain`; null when none of it is, or it has no height. */
17
- export declare function clipBand(band: Pick<ChartBand, 'from' | 'to'>, domain: Domain): {
64
+ export declare function clipBand(band: Pick<RefBand, 'from' | 'to'>, domain: Domain): {
18
65
  from: number;
19
66
  to: number;
20
67
  } | null;
21
68
  /** A band's box on the plot, `y` mapping a value to a pixel: its top and height, clipped to the domain; null when it is out of view. */
22
- export declare function bandBox(band: Pick<ChartBand, 'from' | 'to'>, domain: Domain, y: (value: number) => number): {
69
+ export declare function bandBox(band: Pick<RefBand, 'from' | 'to'>, domain: Domain, y: (value: number) => number): {
23
70
  top: number;
24
71
  height: number;
25
72
  } | null;
@@ -29,8 +76,8 @@ export declare function thresholdAt(value: number, domain: Domain, y: (value: nu
29
76
  export declare function bandLabelBaseline(top: number, height: number): number;
30
77
  /** The baseline of a threshold's label: above its line, or under it at the top of the plot. */
31
78
  export declare function thresholdLabelBaseline(lineY: number): number;
32
- /** How many of `values` lie outside `band` (a missing value is not counted), and how many there are. */
33
- export declare function outsideBand(values: readonly (number | null | undefined)[], band: Pick<ChartBand, 'from' | 'to'>): {
79
+ /** How many of `values` lie outside `band` (a missing value is not counted, nor one in a row where a stepped band has no range), and how many there are. */
80
+ export declare function outsideBand(values: readonly (number | null | undefined)[], band: Pick<RefBand, 'from' | 'to' | 'ranges'>): {
34
81
  outside: number;
35
82
  total: number;
36
83
  };
@@ -95,16 +95,23 @@ export interface ChartPoint {
95
95
  * the colour's ink (lines, points and swatches in the ink).
96
96
  */
97
97
  export type ChartPalette = 'default' | 'soft';
98
+ /** A reference value: fixed, the name of a numeric field read from each row, or computed from the row and its index. */
99
+ export type ChartRowValue = number | string | ((row: ChartRow, index: number) => number | null | undefined);
98
100
  /**
99
101
  * A shaded range of the value axis, drawn behind the lines: a normal range,
100
102
  * a target zone. Its `label` is drawn in the band and listed in the summary
101
103
  * and in "View data"; the shade is decorative, the label carries the meaning.
102
104
  */
103
105
  export interface ChartBand {
104
- /** One end of the range, in the value axis' units (either order). */
105
- from: number;
106
- /** The other end. */
107
- to: number;
106
+ /**
107
+ * One end of the range, in the value axis' units (either order): a
108
+ * number, the name of a row field, or a function of the row. With a field
109
+ * or a function the band steps along x, one range per row (a row it gives
110
+ * no number for leaves a gap).
111
+ */
112
+ from: ChartRowValue;
113
+ /** The other end; same forms as `from`. */
114
+ to: ChartRowValue;
108
115
  /** Names the range: drawn in it, read by the summary and the table. */
109
116
  label: string;
110
117
  /** Tints the band and its label in the tone; default a neutral wash. */
@@ -112,7 +119,8 @@ export interface ChartBand {
112
119
  }
113
120
  /** A horizontal line at a value, with a direct label at its end. */
114
121
  export interface ChartThreshold {
115
- value: number;
122
+ /** Where the line sits: a number, a row field or a function of the row (then it steps along x). */
123
+ value: ChartRowValue;
116
124
  /** Names the line: drawn at its end, read by the summary and the table. */
117
125
  label: string;
118
126
  /** Draws the line and its label in the tone's colour; default the axis colour. */
@@ -2,6 +2,7 @@ import { Tone } from '../../../tones.js';
2
2
  import { ResolvedSeries } from '../core/colors.js';
3
3
  import { SeriesAxis } from '../core/combo-axes.js';
4
4
  import { ToneMark, ToneWords } from '../core/point-tones.js';
5
+ import { RefBand, RefThreshold } from '../core/reference.js';
5
6
  import { ChartTableModel } from '../core/table.js';
6
7
  import { ChartAxis, ChartBand, ChartBaseProps, ChartPoint, ChartRow, ChartSeries, ChartThreshold, ChartXAxis, RowKey } from '../core/types.js';
7
8
  import { LegendItem } from '../partials/chart-legend.js';
@@ -39,8 +40,8 @@ export type { ToneMark };
39
40
  export type ChartModel = {
40
41
  /** The bands and thresholds, cleaned (`from <= to`, finite). */
41
42
  refs: {
42
- bands: ChartBand[];
43
- thresholds: ChartThreshold[];
43
+ bands: RefBand[];
44
+ thresholds: RefThreshold[];
44
45
  };
45
46
  size: ReturnType<typeof useChartSize<HTMLDivElement>>;
46
47
  /** Every series, resolved (colour, shape, dash, position). */
@@ -4,7 +4,7 @@ export type { BarChartProps, BarLayout, BarOrientation, } from './bar-chart/bar-
4
4
  export { ComboChart } from './combo-chart/combo-chart.js';
5
5
  export type { ComboChartProps } from './combo-chart/combo-chart-types.js';
6
6
  export type { ChartRange, ChartRangeProps, ChartScrollOptions, ChartZoomOptions, } from './core/range-types.js';
7
- export type { ChartAxis, ChartBand, ChartBaseProps, ChartColor, ChartPalette, ChartPoint, ChartRow, ChartSeries, ChartShape, ChartSlice, ChartThreshold, ChartValue, ChartXAxis, ComboSeries, RowKey, ScatterPoint, ScatterSeries, } from './core/types.js';
7
+ export type { ChartAxis, ChartBand, ChartBaseProps, ChartColor, ChartPalette, ChartPoint, ChartRow, ChartRowValue, ChartSeries, ChartShape, ChartSlice, ChartThreshold, ChartValue, ChartXAxis, ComboSeries, RowKey, ScatterPoint, ScatterSeries, } from './core/types.js';
8
8
  export { FunnelChart } from './funnel-chart/funnel-chart.js';
9
9
  export type { FunnelChartProps } from './funnel-chart/funnel-chart-types.js';
10
10
  export { Gauge } from './gauge/gauge.js';
@@ -21,9 +21,14 @@ export type LineChartProps<T extends object = ChartRow> = ChartModelProps<T> & C
21
21
  * unless `yAxis.min` / `max` pin it (a band is then clipped); the
22
22
  * summary says how many values fall outside each, and "View data"
23
23
  * lists them. Keep the array stable (memoize it).
24
+ *
25
+ * `from` and `to` also take a row field or a function of the row: the
26
+ * band then steps along x, one range per row (a normal range copied
27
+ * with each measurement), and the summary and "View data" name each
28
+ * range with the x labels it covers.
24
29
  */
25
30
  bands?: ChartBand[];
26
- /** Horizontal lines at a value with a label at their end, also in the summary and in "View data". Keep the array stable. */
31
+ /** Horizontal lines at a value with a label at their end, also in the summary and in "View data". `value` also takes a row field or a function of the row (the line then steps along x). Keep the array stable. */
27
32
  thresholds?: ChartThreshold[];
28
33
  /**
29
34
  * The tone of a point, or undefined for none. A toned point is drawn
@@ -10,7 +10,7 @@ export declare function ReferenceLayer({ refs, geo, }: {
10
10
  refs: ChartModel['refs'];
11
11
  geo: LineGeometry;
12
12
  }): import("react").JSX.Element;
13
- /** The labels of the bands (inside, at the plot's left) and of the thresholds (above the line, at its right end), over the series. */
13
+ /** The labels of the bands (inside, at the left of the widest stretch in view) and of the thresholds (above the line, at the right end of the last stretch), over the series. */
14
14
  export declare function ReferenceLabels({ refs, geo, }: {
15
15
  refs: ChartModel['refs'];
16
16
  geo: LineGeometry;
@@ -1,4 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
+ import { ResourceBundle } from './merge-resources.js';
2
3
  import { I18nContextValue, Language } from './types.js';
3
4
  export type I18nProviderProps = {
4
5
  children: ReactNode;
@@ -18,6 +19,14 @@ export type I18nProviderProps = {
18
19
  * agree and no hydration guard is needed downstream.
19
20
  */
20
21
  initialLanguage?: Language;
22
+ /**
23
+ * The app's resources, `mergeResources(materialResources, appResources)`.
24
+ * The components translate their `material.*` words through them, so an app
25
+ * override reaches them; leave it out and they read the base bundle. Pass a
26
+ * stable object (module scope): a new object on each render rebuilds the
27
+ * translators.
28
+ */
29
+ resources?: ResourceBundle;
21
30
  };
22
31
  /**
23
32
  * I18nProvider - Shares the current language across the whole React tree.
@@ -27,8 +36,10 @@ export type I18nProviderProps = {
27
36
  * `useState`/`useLocalStorage`, so no `window.location.reload()` is needed
28
37
  * after `changeLanguage`.
29
38
  *
30
- * Only language state is shared — resource bundles stay static module imports
31
- * inside each app, and are passed to `createTranslator` once.
39
+ * Language state is shared, and so are the app's resources when given through
40
+ * `resources`: the components then read their `material.*` words from them.
41
+ * Resource bundles otherwise stay static module imports inside each app, and
42
+ * are passed to `createTranslator` once.
32
43
  *
33
44
  * In a pure SPA (no `initialLanguage`), the initial language is read from
34
45
  * `localStorage` lazily inside `useState`. In SSR, pass `initialLanguage`
@@ -42,7 +53,7 @@ export type I18nProviderProps = {
42
53
  * </I18nProvider>
43
54
  * ```
44
55
  */
45
- export declare function I18nProvider({ children, defaultLanguage, storageKey, supportedLanguages, onLanguageChange, initialLanguage, }: I18nProviderProps): import("react").JSX.Element;
56
+ export declare function I18nProvider({ children, defaultLanguage, storageKey, supportedLanguages, onLanguageChange, initialLanguage, resources, }: I18nProviderProps): import("react").JSX.Element;
46
57
  /**
47
58
  * useI18nContext - Access the shared language state.
48
59
  *
@@ -0,0 +1,21 @@
1
+ import { ResourceBundle } from './merge-resources.js';
2
+ /** What the mounted `I18nProvider` told the code that runs outside React. */
3
+ export type MaterialResourcesRegistration = {
4
+ resources: ResourceBundle | undefined;
5
+ language: string;
6
+ };
7
+ /**
8
+ * Internal, not exported by the package: `I18nProvider` registers its
9
+ * `resources` and language here so `toast()`, which runs outside React, reads
10
+ * the app's `material.*` overrides. A stack: the provider mounted last wins,
11
+ * and its cleanup restores the previous one.
12
+ */
13
+ export declare function registerMaterialResources(resources: ResourceBundle | undefined, language: string): () => void;
14
+ /**
15
+ * Changes a registration in place, keeping its place in the stack: a provider
16
+ * whose resources or language change must not rise above one mounted after it.
17
+ * `handle` is what {@link registerMaterialResources} returned.
18
+ */
19
+ export declare function updateMaterialResources(handle: () => void, resources: ResourceBundle | undefined, language: string): void;
20
+ /** The registration of the provider mounted last, or `undefined` without one. */
21
+ export declare function currentMaterialResources(): MaterialResourcesRegistration | undefined;
@@ -2850,6 +2850,10 @@ export declare const en: {
2850
2850
  reference: {
2851
2851
  band: string;
2852
2852
  threshold: string;
2853
+ span: string;
2854
+ range: string;
2855
+ step: string;
2856
+ steps: string;
2853
2857
  };
2854
2858
  kind: {
2855
2859
  line: string;
@@ -2839,7 +2839,11 @@ declare const _default: {
2839
2839
  },
2840
2840
  "reference": {
2841
2841
  "band": "{label}: {from} to {to}",
2842
- "threshold": "{label}: {value}"
2842
+ "threshold": "{label}: {value}",
2843
+ "span": "{first} to {last}",
2844
+ "range": "{from} to {to}",
2845
+ "step": "{value} ({where})",
2846
+ "steps": "{label}: {list}"
2843
2847
  },
2844
2848
  "kind": {
2845
2849
  "line": "line chart",
@@ -2850,6 +2850,10 @@ export declare const fr: {
2850
2850
  reference: {
2851
2851
  band: string;
2852
2852
  threshold: string;
2853
+ span: string;
2854
+ range: string;
2855
+ step: string;
2856
+ steps: string;
2853
2857
  };
2854
2858
  kind: {
2855
2859
  line: string;
@@ -2839,7 +2839,11 @@ declare const _default: {
2839
2839
  },
2840
2840
  "reference": {
2841
2841
  "band": "{label} : de {from} à {to}",
2842
- "threshold": "{label} : {value}"
2842
+ "threshold": "{label} : {value}",
2843
+ "span": "de {first} à {last}",
2844
+ "range": "de {from} à {to}",
2845
+ "step": "{value} ({where})",
2846
+ "steps": "{label} : {list}"
2843
2847
  },
2844
2848
  "kind": {
2845
2849
  "line": "graphique en courbes",
@@ -2848,6 +2848,10 @@ export declare const resources: {
2848
2848
  reference: {
2849
2849
  band: string;
2850
2850
  threshold: string;
2851
+ span: string;
2852
+ range: string;
2853
+ step: string;
2854
+ steps: string;
2851
2855
  };
2852
2856
  kind: {
2853
2857
  line: string;
@@ -5752,6 +5756,10 @@ export declare const resources: {
5752
5756
  reference: {
5753
5757
  band: string;
5754
5758
  threshold: string;
5759
+ span: string;
5760
+ range: string;
5761
+ step: string;
5762
+ steps: string;
5755
5763
  };
5756
5764
  kind: {
5757
5765
  line: string;
@@ -1,3 +1,4 @@
1
+ import { ResourceBundle } from './merge-resources.js';
1
2
  import { MaterialLocaleKey, TranslationContext } from './types.js';
2
3
  /**
3
4
  * Translates one of this package's own strings (`material.*`) for a language
@@ -10,6 +11,11 @@ import { MaterialLocaleKey, TranslationContext } from './types.js';
10
11
  * have, or no language, gives `fallback`, formatted with that language's
11
12
  * `Intl` rules.
12
13
  *
14
+ * `resources` is the app's merged bundle. For each candidate language it is
15
+ * read first, then the base bundle, before the next candidate, so a bundle
16
+ * that was not merged with the base one keeps the built-in strings. Pass a
17
+ * stable object (module scope): the translator is cached per object.
18
+ *
13
19
  * @example translateMaterial('fr', 'material.print.page-of', 'Page {page} of {pages}', { page: 2, pages: 5 }) // 'Page 2 sur 5'
14
20
  */
15
- export declare function translateMaterial(language: string | null | undefined, key: MaterialLocaleKey, fallback: string, options?: TranslationContext): string;
21
+ export declare function translateMaterial(language: string | null | undefined, key: MaterialLocaleKey, fallback: string, options?: TranslationContext, resources?: ResourceBundle): string;