@nxgt/material 3.55.0 → 3.57.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 (119) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +8 -4
  3. package/dist/{async-slice-yhXT9cml.js → async-slice-B3RMgJUn.js} +2 -2
  4. package/dist/{button-CD7f4KFL.js → button-hnUZpzYu.js} +1 -1
  5. package/dist/charts.js +3 -3
  6. package/dist/{chip-Cl7Wm8Pn.js → chip-kplPa8ZV.js} +2 -2
  7. package/dist/{code-editor-tOhXy6Qo.js → code-editor-Ba61Cd-g.js} +6 -6
  8. package/dist/code-editor.js +5 -5
  9. package/dist/{code-language-items-BxlY6onk.js → code-language-items-CsDC4Ky4.js} +2 -2
  10. package/dist/components/components.css +4 -0
  11. package/dist/components/ui/display/secret-card/secret-card.css +65 -0
  12. package/dist/components/ui/display/vote-tally/vote-tally.css +94 -0
  13. package/dist/{components-B58ZWZYR.js → components-BgckuX2C.js} +16870 -16252
  14. package/dist/components.js +26 -26
  15. package/dist/{dialog-BzfHcRo6.js → dialog-DS8O4Kkb.js} +4 -4
  16. package/dist/dnd.js +1 -1
  17. package/dist/{dropdown-menu-DUZF4xAJ.js → dropdown-menu-CvVQJpsn.js} +1 -1
  18. package/dist/editor.js +9 -9
  19. package/dist/{empty-state-D9o2id1p.js → empty-state-4gmbCkcw.js} +2 -2
  20. package/dist/{escape-owner-BYs2_7T5.js → escape-owner-BJvicDmr.js} +1 -1
  21. package/dist/{field-blur-r1tHwqdF.js → field-blur-Cnjk0o9A.js} +1 -1
  22. package/dist/{field-blur-context-ZsK8OTNg.js → field-blur-context-CYlx9KnB.js} +1 -1
  23. package/dist/hooks.js +28 -28
  24. package/dist/{hover-card-NfF8taLj.js → hover-card-DW4XnExA.js} +2 -2
  25. package/dist/{i18n-provider-TQAEPlJ5.js → i18n-provider-DBr59j1p.js} +1 -1
  26. package/dist/i18n.js +5 -5
  27. package/dist/{icon-badge-BlaY_a-P.js → icon-badge-4FMy66AC.js} +3 -3
  28. package/dist/{icon-button-B8tdlP6R.js → icon-button-QF7smCoV.js} +1 -1
  29. package/dist/lib/components/ui/actions/link/link.d.ts +8 -0
  30. package/dist/lib/components/ui/collections/data-table/partials/data-table-page-control.d.ts +1 -1
  31. package/dist/lib/components/ui/collections/data-table/partials/data-table-row.d.ts +1 -1
  32. package/dist/lib/components/ui/collections/data-table/partials/layouts/data-table-card.d.ts +1 -1
  33. package/dist/lib/components/ui/collections/server-table/partials/server-table-past-end.d.ts +1 -1
  34. package/dist/lib/components/ui/display/index.d.ts +2 -0
  35. package/dist/lib/components/ui/display/list-tile/partials/list-tile-line.d.ts +1 -1
  36. package/dist/lib/components/ui/display/period-cards/period-cards.d.ts +1 -1
  37. package/dist/lib/components/ui/display/secret-card/index.d.ts +2 -0
  38. package/dist/lib/components/ui/display/secret-card/secret-card.d.ts +11 -0
  39. package/dist/lib/components/ui/display/secret-card/types.d.ts +49 -0
  40. package/dist/lib/components/ui/display/secret-card/use-secret-card.d.ts +20 -0
  41. package/dist/lib/components/ui/display/vote-tally/announcer.d.ts +11 -0
  42. package/dist/lib/components/ui/display/vote-tally/index.d.ts +2 -0
  43. package/dist/lib/components/ui/display/vote-tally/partials/tally-bar.d.ts +8 -0
  44. package/dist/lib/components/ui/display/vote-tally/partials/tally-row.d.ts +9 -0
  45. package/dist/lib/components/ui/display/vote-tally/partials/tally-voters.d.ts +9 -0
  46. package/dist/lib/components/ui/display/vote-tally/types.d.ts +73 -0
  47. package/dist/lib/components/ui/display/vote-tally/use-announcement.d.ts +7 -0
  48. package/dist/lib/components/ui/display/vote-tally/use-tally-summary.d.ts +3 -0
  49. package/dist/lib/components/ui/display/vote-tally/vote-tally.d.ts +10 -0
  50. package/dist/lib/components/ui/display/vote-tally/vote-tally.utils.d.ts +18 -0
  51. package/dist/lib/components/ui/feedback/countdown-timer/countdown-ring.d.ts +7 -0
  52. package/dist/lib/components/ui/feedback/countdown-timer/countdown-timer.d.ts +7 -1
  53. package/dist/lib/components/ui/fields/contacts/placeholders.d.ts +1 -1
  54. package/dist/lib/components/ui/layout/account-menu/account-menu.d.ts +1 -1
  55. package/dist/lib/components/ui/layout/app-shell/app-sidebar-icon-item.d.ts +1 -1
  56. package/dist/lib/components/ui/layout/app-shell/app-sidebar-label-item.d.ts +1 -1
  57. package/dist/lib/components/ui/layout/app-shell/app-sidebar.d.ts +1 -1
  58. package/dist/lib/components/ui/layout/pager/pager.d.ts +1 -1
  59. package/dist/lib/components/ui/layout/see-also/see-also.d.ts +1 -1
  60. package/dist/lib/components/ui/layout/toc/toc.d.ts +1 -1
  61. package/dist/lib/components/ui/primitives/index.d.ts +1 -0
  62. package/dist/lib/components/ui/primitives/link/index.d.ts +2 -0
  63. package/dist/lib/components/ui/primitives/link/link-component-provider.d.ts +26 -0
  64. package/dist/lib/components/ui/widgets/education/index.d.ts +1 -0
  65. package/dist/lib/components/ui/widgets/education/navigator/index.d.ts +2 -0
  66. package/dist/lib/components/ui/widgets/education/navigator/partials/navigator-item.d.ts +10 -0
  67. package/dist/lib/components/ui/widgets/education/navigator/question-navigator.d.ts +27 -0
  68. package/dist/lib/components/ui/widgets/education/questions/index.d.ts +1 -1
  69. package/dist/lib/components/ui/widgets/education/questions/partials/question-media.d.ts +5 -0
  70. package/dist/lib/components/ui/widgets/education/questions/partials/question-verdict.d.ts +12 -0
  71. package/dist/lib/components/ui/widgets/education/questions/question-options.d.ts +2 -2
  72. package/dist/lib/components/ui/widgets/education/questions/question-text.d.ts +1 -1
  73. package/dist/lib/components/ui/widgets/education/questions/question.d.ts +1 -1
  74. package/dist/lib/components/ui/widgets/education/questions/types.d.ts +33 -1
  75. package/dist/lib/hooks/index.d.ts +1 -0
  76. package/dist/lib/hooks/use-countdown.d.ts +18 -0
  77. package/dist/lib/i18n/resources/en/en.d.ts +32 -0
  78. package/dist/lib/i18n/resources/en/material.json.d.ts +33 -1
  79. package/dist/lib/i18n/resources/fr/fr.d.ts +32 -0
  80. package/dist/lib/i18n/resources/fr/material.json.d.ts +33 -1
  81. package/dist/lib/i18n/resources/resources.d.ts +64 -0
  82. package/dist/lib/i18n/translator.d.ts +1 -1
  83. package/dist/lib.js +1 -1
  84. package/dist/main.js +43 -43
  85. package/dist/map.js +8 -8
  86. package/dist/material.css +1 -1
  87. package/dist/pdf-reader.js +1 -1
  88. package/dist/print.js +2 -2
  89. package/dist/{public-tWgM204K.js → public-DVZJVdxD.js} +9 -9
  90. package/dist/{rich-code-block-0OcsqURY.js → rich-code-block-DL5-9JIi.js} +5 -5
  91. package/dist/{sortable-provider-DzFAlPU_.js → sortable-provider-DrpBwx75.js} +2 -2
  92. package/dist/{spinner-GKZcQmrR.js → spinner-D4XGdse6.js} +1 -1
  93. package/dist/{stored-language-B39mABN7.js → stored-language-C89mti-z.js} +66 -2
  94. package/dist/theme-picker.js +2 -2
  95. package/dist/{theme-toggle-C8idk_jQ.js → theme-toggle-BFhqLmgx.js} +1 -1
  96. package/dist/{toolbar-items-BrJI-BCs.js → toolbar-items-SZ5pyAFz.js} +4 -4
  97. package/dist/{translate-material-hUA-UAP6.js → translate-material-BkqnImND.js} +2 -2
  98. package/dist/{translator-1ql2sxrx.js → translator-B5fId5Rw.js} +1 -1
  99. package/dist/{use-chat-composer-DQpb8ZXV.js → use-chat-composer-BG5B4DGB.js} +16 -16
  100. package/dist/{use-heading-spy-vlPOI1Aj.js → use-heading-spy-51GQw8tH.js} +32 -5
  101. package/dist/{use-material-translation-B1p5y3s9.js → use-material-translation-BQOr4Oks.js} +2 -2
  102. package/docs/components/README.md +1 -1
  103. package/docs/components/buttons-and-actions.md +1 -0
  104. package/docs/components/data-display.md +147 -2
  105. package/docs/components/data-table-filter-and-lists.md +3 -3
  106. package/docs/components/feedback-and-status.md +12 -5
  107. package/docs/components/navigation-and-layout.md +4 -4
  108. package/docs/components/primitives.md +62 -0
  109. package/docs/components/rich-widgets.md +51 -0
  110. package/docs/components/selection-and-choice.md +1 -1
  111. package/docs/guides/app-shell.md +2 -2
  112. package/docs/guides/helpers.md +40 -0
  113. package/docs/previews/data-display-secretcard.webp +0 -0
  114. package/docs/previews/data-display-votetally.webp +0 -0
  115. package/lib/components/components.css +4 -0
  116. package/lib/components/ui/display/secret-card/secret-card.css +65 -0
  117. package/lib/components/ui/display/vote-tally/vote-tally.css +94 -0
  118. package/package.json +1 -1
  119. package/dist/lib/components/ui/feedback/countdown-timer/use-countdown.d.ts +0 -6
@@ -0,0 +1,49 @@
1
+ import { ComponentProps, ReactNode } from 'react';
2
+ import { Tone } from '../../tones.js';
3
+ /** The words the card says: its button and what a screen reader hears after a change. */
4
+ export type SecretCardLabels = {
5
+ /** The button's name, the same hidden or shown: `aria-expanded` carries the state (default "Show secret"). */
6
+ reveal: string;
7
+ /** Announced politely when the secret is shown by something other than a click on the button (default "Secret revealed"). */
8
+ revealed: string;
9
+ /** Announced politely when it is hidden by something other than a click on the button, an auto-hide or the parent (default "Secret hidden"). */
10
+ hidden: string;
11
+ };
12
+ export type SecretCardState = 'hidden' | 'revealed';
13
+ /** Controlled (`revealed` and `onRevealedChange`) or not (`defaultRevealed`), never both. */
14
+ export type SecretCardReveal = {
15
+ revealed: boolean;
16
+ onRevealedChange: (revealed: boolean) => void;
17
+ defaultRevealed?: never;
18
+ } | {
19
+ revealed?: never;
20
+ defaultRevealed?: boolean;
21
+ onRevealedChange?: (revealed: boolean) => void;
22
+ };
23
+ export type SecretCardProps = Omit<ComponentProps<'div'>, 'children' | 'title' | 'defaultValue'> & SecretCardReveal & {
24
+ /** The card's name, always shown: "Your role", "Recovery key". */
25
+ title: ReactNode;
26
+ /** A hint shown only while the secret is hidden ("Tap to see it, then hide it"). */
27
+ description?: ReactNode;
28
+ /** A decorative icon or illustration before the title. */
29
+ icon?: ReactNode;
30
+ /** A named tone or one the app declared (`data-tone`). */
31
+ tone?: Tone;
32
+ /**
33
+ * The hidden face, under the title: anything that is no secret.
34
+ * Default: a neutral pattern.
35
+ */
36
+ front?: ReactNode;
37
+ /**
38
+ * The secret. It is not rendered, so it is not in the markup, read out
39
+ * or copied, until the card is revealed.
40
+ */
41
+ back: ReactNode;
42
+ /** Buttons beside the reveal button (a copy button, "Next player"). */
43
+ actions?: ReactNode;
44
+ /** Hides the secret again after this many milliseconds shown. */
45
+ autoHideMs?: number;
46
+ /** The card cannot be revealed. A revealed card can always be hidden. */
47
+ disabled?: boolean;
48
+ labels?: Partial<SecretCardLabels>;
49
+ };
@@ -0,0 +1,20 @@
1
+ import { SecretCardLabels, SecretCardProps } from './types.js';
2
+ /**
3
+ * The reveal state (controlled or not), the optional auto-hide, the focus
4
+ * kept on the button when the face under it is swapped, and a polite message
5
+ * for the changes a click on the button does not explain (auto-hide, the
6
+ * parent): a click is already said by `aria-expanded`.
7
+ */
8
+ export declare function useSecretCard(props: SecretCardProps): {
9
+ shown: boolean;
10
+ faceId: string;
11
+ message: string | null;
12
+ changed: boolean;
13
+ labels: SecretCardLabels;
14
+ button: import('react').RefObject<HTMLButtonElement | null>;
15
+ toggle: () => void;
16
+ faceProps: {
17
+ onFocus: () => void;
18
+ onBlur: () => void;
19
+ };
20
+ };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The debounce behind the live status, apart from React so it can be tested
3
+ * with fake timers. `follow(text, delay)` is called each time the text or the
4
+ * delay changes: a text equal to the last one said (or the first one) cancels
5
+ * what is pending, any other waits `delay` ms from now, and `say` gets it only
6
+ * if nothing newer arrived meanwhile.
7
+ */
8
+ export declare function createAnnouncer(initial: string, say: (text: string) => void): {
9
+ follow(text: string, delay: number): void;
10
+ cancel: () => void;
11
+ };
@@ -0,0 +1,2 @@
1
+ export type { VoteOption, VoteRow, Voter, VoteTallyProps, VoteTallySlots, VoteTallySort, VoteTallyVoters, } from './types.js';
2
+ export * from './vote-tally.js';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The bar: decorative (the row's text carries the number). An SVG so the
3
+ * width is an attribute, never a `style` (strict CSP); its width transition
4
+ * is in the stylesheet, and only without reduced motion.
5
+ */
6
+ export declare function TallyBar({ percent }: {
7
+ percent: number;
8
+ }): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { VoteRow, VoteTallyProps } from '../types.js';
2
+ type Props = Pick<VoteTallyProps, 'renderOption' | 'renderVoters' | 'showLeader'> & {
3
+ row: VoteRow;
4
+ voters: NonNullable<VoteTallyProps['showVoters']>;
5
+ maxVoters: number;
6
+ };
7
+ /** One option: label and marks, "n votes, x%" as text, a decorative bar, voters. */
8
+ export declare function TallyRow({ row, voters, maxVoters, showLeader, renderOption, renderVoters, }: Props): import("react").JSX.Element;
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import { VoteRow, VoteTallyVoters } from '../types.js';
2
+ type Props = {
3
+ row: VoteRow;
4
+ mode: VoteTallyVoters;
5
+ max: number;
6
+ };
7
+ /** Who voted for an option: an avatar group or a line of names, both named. */
8
+ export declare function TallyVoters({ row, mode, max }: Props): import("react").JSX.Element | null;
9
+ export {};
@@ -0,0 +1,73 @@
1
+ import { ComponentProps, ReactNode } from 'react';
2
+ /** Someone who voted: shown as an avatar (or a name) and read out by name. */
3
+ export type Voter = {
4
+ id: string;
5
+ /** The voter's name: the avatar's accessible name and the text in `names` mode. */
6
+ label: string;
7
+ /** A photo (`src`) or the fallback; without either, the label's initials. */
8
+ avatar?: {
9
+ src?: string;
10
+ fallback?: ReactNode;
11
+ };
12
+ };
13
+ export type VoteOption = {
14
+ id: string;
15
+ /** The option's name: a candidate, an answer, a player. */
16
+ label: string;
17
+ /** Votes it received (a whole number, 0 or more). */
18
+ count: number;
19
+ /** Who voted for it, when the vote is public. */
20
+ voters?: Voter[];
21
+ /** A photo or fallback shown beside the label. */
22
+ avatar?: {
23
+ src?: string;
24
+ fallback?: ReactNode;
25
+ };
26
+ };
27
+ /** How a row's rank and share are known to the slots. */
28
+ export type VoteRow = {
29
+ option: VoteOption;
30
+ /** 1-based place; options with the same count share it. */
31
+ rank: number;
32
+ /** Share of the total, 0 to 100, whole number. */
33
+ percent: number;
34
+ /** Has the top count, alone. */
35
+ leader: boolean;
36
+ /** Shares the top count with another option. */
37
+ tied: boolean;
38
+ /** The viewer's own vote. */
39
+ selected: boolean;
40
+ };
41
+ export type VoteTallySort = 'count' | 'none';
42
+ export type VoteTallyVoters = 'none' | 'avatars' | 'names';
43
+ export type VoteTallySlots = {
44
+ /** Replaces an option's label cell (avatar, name and marks). */
45
+ renderOption?: (row: VoteRow) => ReactNode;
46
+ /** Replaces the voters under a bar. */
47
+ renderVoters?: (row: VoteRow) => ReactNode;
48
+ header?: ReactNode;
49
+ footer?: ReactNode;
50
+ };
51
+ export type VoteTallyProps = {
52
+ options: VoteOption[];
53
+ /** The base of the shares; the sum of the counts when omitted. Abstentions are not in it. */
54
+ total?: number;
55
+ /** `count` ranks by votes, highest first (ties keep their order); `none` keeps the given order. */
56
+ sort?: VoteTallySort;
57
+ /** The viewer's own choice, marked "Your vote" in words. */
58
+ selectedId?: string;
59
+ /** Marks the leader, or the tied options, in words ("Leader", "Tie"), and says them in the live status. Off: no mark, the status gives the votes cast. On by default. */
60
+ showLeader?: boolean;
61
+ /** `avatars` shows who voted as an avatar group, `names` as text. */
62
+ showVoters?: VoteTallyVoters;
63
+ /** How many voters show before "+N". 5 by default. */
64
+ maxVoters?: number;
65
+ /** The bar's width eases when a count changes (only the width); never under reduced motion. On by default. */
66
+ animated?: boolean;
67
+ /** People who voted for nobody: counted and shown beneath the bars. */
68
+ abstainCount?: number;
69
+ /** Shown while there is no vote. */
70
+ emptyLabel?: ReactNode;
71
+ /** Milliseconds a change waits before it is announced. 1000 by default. */
72
+ announceDelay?: number;
73
+ } & VoteTallySlots & Omit<ComponentProps<'div'>, 'children'>;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The text a polite live region should say, once `text` has stopped changing
3
+ * for `delay` ms. The first text is never said (it is the page as loaded,
4
+ * not news), a return to what was last said is not said again, and a burst of
5
+ * live updates becomes one announcement. `null` while there is nothing to say.
6
+ */
7
+ export declare function useAnnouncement(text: string, delay: number): string | null;
@@ -0,0 +1,3 @@
1
+ import { Tally } from './vote-tally.utils.js';
2
+ /** One sentence on where the vote stands: the leader, the tie, the abstentions. */
3
+ export declare function useTallySummary(result: Tally, abstain: number, showLeader?: boolean): string;
@@ -0,0 +1,10 @@
1
+ import { VoteTallyProps } from './types.js';
2
+ /**
3
+ * A live ranked tally of a vote: one row per option with its count and share
4
+ * as text ("Ada, 3 votes, 42%"), a decorative bar, and who voted for it. A
5
+ * leader, a tie and the viewer's own vote are marked in words, never by
6
+ * colour alone. Counts may change at any time: bars ease only without
7
+ * reduced motion, and a polite live region says what changed, once the
8
+ * changes stop for `announceDelay`.
9
+ */
10
+ export declare function VoteTally(props: VoteTallyProps): import("react").JSX.Element;
@@ -0,0 +1,18 @@
1
+ import { VoteOption, VoteRow, VoteTallySort } from './types.js';
2
+ export type Tally = {
3
+ rows: VoteRow[];
4
+ /** The base of the shares. */
5
+ total: number;
6
+ /** Top count, 0 without a vote. */
7
+ top: number;
8
+ /** Several options share the top count. */
9
+ tie: boolean;
10
+ };
11
+ /**
12
+ * Ranks the options and works out each share. Options with the same count
13
+ * share a rank and are never ordered by an arbitrary leader: with the top
14
+ * count held by several, none is a `leader`, all are `tied`.
15
+ */
16
+ export declare function tally(options: VoteOption[], sort: VoteTallySort, total?: number, selectedId?: string, marks?: boolean): Tally;
17
+ /** Whole votes an option is shown with. */
18
+ export declare const votesOf: (option: VoteOption) => number;
@@ -0,0 +1,7 @@
1
+ import { CountdownTone } from './countdown-timer.utils.js';
2
+ /** The ring that empties as the time runs out; decoration, the clock carries the time. */
3
+ export declare function CountdownRing({ tone, fraction, size, }: {
4
+ tone: CountdownTone;
5
+ fraction: number;
6
+ size: 'sm' | 'md';
7
+ }): import("react").JSX.Element;
@@ -12,6 +12,12 @@ export type CountdownTimerProps = {
12
12
  criticalAt?: number;
13
13
  /** Its name; "Time remaining" by default. */
14
14
  label?: string;
15
+ /**
16
+ * What the warning tone says beside the clock, with a clock icon, so low
17
+ * time is not shown by colour alone. "Little time left" by default; `false`
18
+ * hides the icon and the words (the announcement then speaks the time only).
19
+ */
20
+ warningText?: string | false;
15
21
  size?: 'sm' | 'md';
16
22
  } & Omit<ComponentProps<'div'>, 'children'>;
17
23
  /**
@@ -20,4 +26,4 @@ export type CountdownTimerProps = {
20
26
  * assistive tech hears it only when it crosses a threshold and when the time
21
27
  * is up, never every second.
22
28
  */
23
- export declare function CountdownTimer({ duration, paused, onExpire, warningAt, criticalAt, label, size, className, ...props }: CountdownTimerProps): import("react").JSX.Element;
29
+ export declare function CountdownTimer({ duration, paused, onExpire, warningAt, criticalAt, label, warningText, size, className, ...props }: CountdownTimerProps): import("react").JSX.Element;