@nxgt/material 3.101.0 → 3.103.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 (155) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +32 -2
  3. package/dist/{alert-dialog-DYzxchiS.js → alert-dialog-NFyAiSqc.js} +1 -1
  4. package/dist/{async-slice-drJyPvuM.js → async-slice-D35bX79S.js} +1 -1
  5. package/dist/{bubble-input-CQwVSoU3.js → bubble-input-BxI1WmNs.js} +17 -5
  6. package/dist/{button-GeIsUekU.js → button-Be7GZzF9.js} +2 -2
  7. package/dist/{calculator-BS4PAm6l.js → calculator-BGy1Q7rn.js} +261 -460
  8. package/dist/calculator-field.js +7 -7
  9. package/dist/{calculator-segment-CEdwE24M.js → calculator-segment-uixk6lBg.js} +1 -1
  10. package/dist/calculator.js +1 -1
  11. package/dist/charts.js +3 -3
  12. package/dist/{chip-BdEtFQ85.js → chip-3rWebZEM.js} +2 -2
  13. package/dist/{code-editor-BByXZOGy.js → code-editor-BqSVMfy-.js} +178 -177
  14. package/dist/code-editor.js +5 -5
  15. package/dist/{code-language-items-CSZX5zxD.js → code-language-items-Cf2LJVg2.js} +14 -5
  16. package/dist/components/ui/actions/action-card/action-card-tile.css +47 -0
  17. package/dist/components/ui/display/code/code-moonlight.css +10 -10
  18. package/dist/{components-DQ4MljCr.js → components-D2liJ9Yu.js} +17725 -17287
  19. package/dist/components.js +38 -37
  20. package/dist/{conversion-variant-DTQqAyDt.js → conversion-variant-clFZ6ZMJ.js} +5 -5
  21. package/dist/{currency-field-Dnju7ss2.js → currency-field-CBFEVNM1.js} +24 -23
  22. package/dist/{dialog-5_2__tu8.js → dialog-CrIIINTk.js} +3 -3
  23. package/dist/dnd.js +1 -1
  24. package/dist/{dropdown-menu-FdGC5kIP.js → dropdown-menu-BnfLWu8n.js} +1 -1
  25. package/dist/editor.js +9 -9
  26. package/dist/{empty-state-BoepPG5v.js → empty-state-CuUaCPY7.js} +1 -1
  27. package/dist/{field-blur-DkiZOVNV.js → field-blur-DMJwPLsg.js} +9 -9
  28. package/dist/field-blur-context-3rKussBQ.js +29 -0
  29. package/dist/{financial-variant-BhqJp5C-.js → financial-variant-BY_VCUuk.js} +5 -5
  30. package/dist/{hooks-DjcbJZiO.js → hooks-hHoZbL-4.js} +106 -61
  31. package/dist/hooks.js +3 -3
  32. package/dist/{hover-card-CmHJeBeY.js → hover-card-Do2-uzlF.js} +1 -1
  33. package/dist/i18n.js +3 -3
  34. package/dist/{icon-badge-LGUPQh_c.js → icon-badge-CHaVNEmb.js} +1 -1
  35. package/dist/{icon-button-BSVpO1jP.js → icon-button-BIAubLeJ.js} +1 -1
  36. package/dist/key-layout-D2goCDkD.js +31 -0
  37. package/dist/keypad.js +551 -0
  38. package/dist/label-DR-zZyGQ.js +47 -0
  39. package/dist/lib/components/ui/display/code/code-block-parts.d.ts +1 -1
  40. package/dist/lib/components/ui/display/code/code-block.d.ts +4 -1
  41. package/dist/lib/components/ui/display/code/languages.d.ts +2 -0
  42. package/dist/lib/components/ui/display/code/moonlight-tokens.d.ts +10 -10
  43. package/dist/lib/components/ui/feedback/confirm-dialog/confirm-dialog-props.d.ts +73 -0
  44. package/dist/lib/components/ui/feedback/confirm-dialog/confirm-dialog-rules.d.ts +12 -0
  45. package/dist/lib/components/ui/feedback/confirm-dialog/confirm-dialog.d.ts +5 -61
  46. package/dist/lib/components/ui/feedback/confirm-dialog/confirm-footer.d.ts +12 -0
  47. package/dist/lib/components/ui/feedback/confirm-dialog/confirm-phrase.d.ts +26 -0
  48. package/dist/lib/components/ui/feedback/confirm-dialog/use-confirm-action.d.ts +1 -1
  49. package/dist/lib/components/ui/fields/contacts/placeholders.d.ts +1 -1
  50. package/dist/lib/components/ui/layout/index.d.ts +1 -0
  51. package/dist/lib/components/ui/layout/panel-card/index.d.ts +1 -0
  52. package/dist/lib/components/ui/layout/panel-card/panel-card.d.ts +21 -0
  53. package/dist/lib/components/ui/selection/index.d.ts +1 -0
  54. package/dist/lib/components/ui/selection/status-menu/index.d.ts +3 -0
  55. package/dist/lib/components/ui/selection/status-menu/partials/status-confirm.d.ts +12 -0
  56. package/dist/lib/components/ui/selection/status-menu/partials/status-icon.d.ts +6 -0
  57. package/dist/lib/components/ui/selection/status-menu/partials/status-items.d.ts +18 -0
  58. package/dist/lib/components/ui/selection/status-menu/partials/status-menu-list.d.ts +14 -0
  59. package/dist/lib/components/ui/selection/status-menu/partials/status-sheet-row.d.ts +11 -0
  60. package/dist/lib/components/ui/selection/status-menu/partials/status-sheet.d.ts +21 -0
  61. package/dist/lib/components/ui/selection/status-menu/partials/status-trigger.d.ts +18 -0
  62. package/dist/lib/components/ui/selection/status-menu/status-menu-data.d.ts +12 -0
  63. package/dist/lib/components/ui/selection/status-menu/status-menu-form-field.d.ts +20 -0
  64. package/dist/lib/components/ui/selection/status-menu/status-menu.d.ts +13 -0
  65. package/dist/lib/components/ui/selection/status-menu/types.d.ts +76 -0
  66. package/dist/lib/components/ui/selection/status-menu/use-status-change.d.ts +18 -0
  67. package/dist/lib/components/ui/selection/status-menu/use-status-menu.d.ts +30 -0
  68. package/dist/lib/components/ui/widgets/calculator/partials/calculator-keypad.d.ts +1 -5
  69. package/dist/lib/components/ui/widgets/calculator/variants/key-layout.d.ts +3 -49
  70. package/dist/lib/components/ui/widgets/keypad/cash-model.d.ts +16 -0
  71. package/dist/lib/components/ui/widgets/keypad/index.d.ts +5 -0
  72. package/dist/lib/components/ui/widgets/keypad/key-layout.d.ts +56 -0
  73. package/dist/lib/components/ui/widgets/keypad/keypad-binding.d.ts +32 -0
  74. package/dist/lib/components/ui/widgets/keypad/keypad-cash.d.ts +28 -0
  75. package/dist/lib/components/ui/widgets/keypad/keypad-display.d.ts +11 -0
  76. package/dist/lib/components/ui/widgets/keypad/keypad-entry.d.ts +39 -0
  77. package/dist/lib/components/ui/widgets/keypad/keypad-grid.d.ts +27 -0
  78. package/dist/lib/components/ui/widgets/{calculator/partials/calculator-key.d.ts → keypad/keypad-key.d.ts} +6 -3
  79. package/dist/lib/components/ui/widgets/keypad/keypad-layout.d.ts +19 -0
  80. package/dist/lib/components/ui/widgets/{calculator/partials → keypad}/keypad-navigation.d.ts +1 -1
  81. package/dist/lib/components/ui/widgets/keypad/keypad.d.ts +9 -0
  82. package/dist/lib/components/ui/widgets/keypad/keypad.types.d.ts +91 -0
  83. package/dist/lib/components/ui/widgets/keypad/use-keypad-cash.d.ts +14 -0
  84. package/dist/lib/components/ui/widgets/keypad/use-keypad-keyboard.d.ts +7 -0
  85. package/dist/lib/components/ui/widgets/keypad/use-keypad-number.d.ts +10 -0
  86. package/dist/lib/components/ui/widgets/keypad/use-keypad-quantity.d.ts +16 -0
  87. package/dist/lib/components/ui/widgets/keypad/use-keypad-value.d.ts +17 -0
  88. package/dist/lib/components/ui/widgets/keypad/use-keypad.d.ts +23 -0
  89. package/dist/lib/hooks/index.d.ts +1 -0
  90. package/dist/lib/hooks/use-barcode-scanner.d.ts +39 -0
  91. package/dist/lib/i18n/resources/en/en.d.ts +25 -0
  92. package/dist/lib/i18n/resources/en/material.json.d.ts +26 -1
  93. package/dist/lib/i18n/resources/fr/fr.d.ts +25 -0
  94. package/dist/lib/i18n/resources/fr/material.json.d.ts +26 -1
  95. package/dist/lib/i18n/resources/resources.d.ts +50 -0
  96. package/dist/lib/i18n/translator.d.ts +1 -1
  97. package/dist/lib/keypad/index.d.ts +20 -0
  98. package/dist/lib.js +1 -1
  99. package/dist/main.js +54 -53
  100. package/dist/map.js +9 -9
  101. package/dist/material.css +1 -1
  102. package/dist/pdf-reader.js +1 -1
  103. package/dist/{percent-field-DGlU_xii.js → percent-field-DU8eIMD3.js} +15 -14
  104. package/dist/{picker-surface-CGhqNR8a.js → picker-surface-XmA--JVI.js} +4 -4
  105. package/dist/{popover-ZxL7ktKk.js → popover-D8iHiAbl.js} +1 -1
  106. package/dist/{pos-types-BQ0QpYMp.js → pos-types-BEAY27Rm.js} +1 -1
  107. package/dist/{pos-variant-CKy8h_5i.js → pos-variant-ClGI92Lt.js} +25 -25
  108. package/dist/print.js +1 -1
  109. package/dist/{programmer-variant-CbHstE28.js → programmer-variant-Boq2O8hB.js} +30 -30
  110. package/dist/{public-D-tdOz4b.js → public-DOrXKmcL.js} +9 -9
  111. package/dist/{rich-code-block-CTPj1LuD.js → rich-code-block-Djj2XE_u.js} +18 -18
  112. package/dist/{scientific-variant-B8U9h3II.js → scientific-variant-BzF_aMQP.js} +8 -8
  113. package/dist/{sortable-provider-CSoWE7Ce.js → sortable-provider-DCZjsIIH.js} +2 -2
  114. package/dist/{spinner-ffuwBXHl.js → spinner-Cg0y_E_K.js} +1 -1
  115. package/dist/standard-layout-DTr9yy8Z.js +48 -0
  116. package/dist/{tabs-JgRq6ZJx.js → tabs-DpessV5s.js} +1 -1
  117. package/dist/{text-field-DURkIP-v.js → text-field-Dxk9lAKM.js} +16 -15
  118. package/dist/theme-picker.js +13 -13
  119. package/dist/{theme-toggle-n_Zg7JAA.js → theme-toggle-B6Jl5Kfn.js} +1 -1
  120. package/dist/{toolbar-items-IANZdcw4.js → toolbar-items-Cs1XrZsH.js} +4 -4
  121. package/dist/{translate-material-CMHUH5Ha.js → translate-material-Du0j0t97.js} +1 -1
  122. package/dist/{translator-9zA-Um3W.js → translator-BVs4n0Fz.js} +52 -2
  123. package/dist/use-calculator-keyboard-BZ1CA4Ut.js +222 -0
  124. package/dist/{use-chat-composer-BoIN7RCA.js → use-chat-composer-B4m3OEm1.js} +241 -240
  125. package/dist/{use-heading-spy-Ciw9GBHL.js → use-heading-spy-CO3_AtY9.js} +235 -154
  126. package/dist/{use-material-translation-CLNaMhUf.js → use-material-translation-uNc1FyC8.js} +1 -1
  127. package/dist/{use-return-focus-DWhbTGVe.js → use-return-focus-AfLRrUm-.js} +1 -1
  128. package/docs/README.md +1 -0
  129. package/docs/components/README.md +1 -0
  130. package/docs/components/buttons-and-actions.md +34 -2
  131. package/docs/components/data-display.md +4 -1
  132. package/docs/components/feedback-and-status.md +20 -0
  133. package/docs/components/navigation-and-layout.md +28 -0
  134. package/docs/components/rich-widgets.md +28 -0
  135. package/docs/components/selection-and-choice.md +120 -0
  136. package/docs/guides/calculator.md +1 -1
  137. package/docs/guides/cards-and-tiles.md +21 -24
  138. package/docs/guides/forms.md +1 -0
  139. package/docs/guides/helpers.md +49 -0
  140. package/docs/guides/keypad.md +225 -0
  141. package/docs/previews/data-display-codeblock.webp +0 -0
  142. package/docs/previews/data-display-codegroup.webp +0 -0
  143. package/docs/previews/data-display-jsonviewer.webp +0 -0
  144. package/docs/previews/navigation-layout-panelcard.webp +0 -0
  145. package/docs/previews/rich-widgets-keypad.webp +0 -0
  146. package/docs/previews/selection-choice-statusmenu.webp +0 -0
  147. package/docs/roadmap.md +21 -0
  148. package/docs/troubleshooting.md +63 -0
  149. package/lib/components/ui/actions/action-card/action-card-tile.css +47 -0
  150. package/lib/components/ui/display/code/code-moonlight.css +10 -10
  151. package/lib/components/ui/widgets/calculator/calculator.css +87 -0
  152. package/package.json +7 -2
  153. package/dist/field-blur-context-BLGgf_3z.js +0 -73
  154. package/dist/key-layout-cR79xfGE.js +0 -38
  155. package/dist/standard-layout-BuSRr3TY.js +0 -40
@@ -1,6 +1,6 @@
1
1
  import { Ref } from 'react';
2
- import { KeyDef } from '../variants/key-layout.js';
3
- export type CalculatorKeyProps = {
2
+ import { KeyDef } from './key-layout.js';
3
+ export type KeypadKeyProps = {
4
4
  def: KeyDef;
5
5
  row: number;
6
6
  index: number;
@@ -12,6 +12,9 @@ export type CalculatorKeyProps = {
12
12
  onPress: (def: KeyDef) => void;
13
13
  onFocus: (row: number, index: number) => void;
14
14
  buttonRef: Ref<HTMLButtonElement>;
15
+ /** The button's `data-slot` and class (the calculator's by default). */
16
+ slot?: string;
17
+ className?: string;
15
18
  };
16
19
  /** One native button. Its glyph is decoration; the spoken name is the label. */
17
- export declare function CalculatorKey({ def, row, index, tabIndex, decimal, unavailable, onPress, onFocus, buttonRef, }: CalculatorKeyProps): import("react").JSX.Element;
20
+ export declare function KeypadKey({ def, row, index, tabIndex, decimal, unavailable, onPress, onFocus, buttonRef, slot, className, }: KeypadKeyProps): import("react").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { KeyLayout } from './key-layout.js';
2
+ import { KeypadOperation } from './keypad.types.js';
3
+ export type KeypadLayoutOptions = {
4
+ operations: readonly KeypadOperation[];
5
+ /** The decimal key; off at no decimals, and when digits go in as minor units. */
6
+ decimal: boolean;
7
+ /** The commit key's text and name, when the app names it. */
8
+ commitLabel?: string;
9
+ /** True while a calculation waits: the commit key then reads "=". */
10
+ pending: boolean;
11
+ /** The cash variant: the commit key tenders. */
12
+ cash?: boolean;
13
+ };
14
+ /**
15
+ * Twelve grid units: 7 8 9 C / 4 5 6 ⌫ / 1 2 3 00 / 0 . and the commit key,
16
+ * with a row of the offered operations above. `wide` makes four keys of three
17
+ * units; the last row's `0` takes six.
18
+ */
19
+ export declare function keypadLayout(o: KeypadLayoutOptions): KeyLayout;
@@ -1,4 +1,4 @@
1
- import { KeyLayout } from '../variants/key-layout.js';
1
+ import { KeyLayout } from './key-layout.js';
2
2
  export type Cell = {
3
3
  readonly row: number;
4
4
  readonly index: number;
@@ -0,0 +1,9 @@
1
+ import { KeypadProps } from './keypad.types.js';
2
+ /**
3
+ * `Keypad`: touch and keyboard numeric entry outside the Calculator widget,
4
+ * for a quantity, a price, a percentage. The digits go in as typed
5
+ * (`entry="decimal"`) or like a till (`entry="minor"`); `operations` adds
6
+ * calculation keys. The value is a canonical decimal string. Styled by
7
+ * `calculator.css`.
8
+ */
9
+ export declare function Keypad(raw: KeypadProps): import("react").JSX.Element;
@@ -0,0 +1,91 @@
1
+ /** A calculation key the keypad can offer next to the digits. */
2
+ export type KeypadOperation = 'add' | 'subtract' | 'multiply' | 'divide';
3
+ /** What the keypad is for: plain `standard` entry, or a `cash` tender against a `total`. */
4
+ export type KeypadVariant = 'standard' | 'cash';
5
+ /**
6
+ * The outcome of a cash tender, amounts as canonical decimal text: the
7
+ * customer gave enough (`change` may be `'0'`), or still owes `due`.
8
+ */
9
+ export type KeypadSettlement = {
10
+ readonly status: 'paid';
11
+ readonly change: string;
12
+ } | {
13
+ readonly status: 'short';
14
+ readonly due: string;
15
+ };
16
+ /** How the digits go in: `decimal` as typed (`1`, `2`, `.`, `5` is 12.5), or `minor` like a till (`1`, `2`, `5` is 1.25). */
17
+ export type KeypadEntry = 'decimal' | 'minor';
18
+ /**
19
+ * A field's number as the keypad reads and writes it (from `useKeypadNumber`
20
+ * or `useKeypadQuantity`). Pass it whole as the `binding` prop. The field keeps its number while a calculation is typed; `onValueChange` is called with the result at `=`.
21
+ */
22
+ export type KeypadBinding = {
23
+ /** The field's number as canonical decimal text (`''` when empty). */
24
+ value: string;
25
+ onValueChange: (value: string) => void;
26
+ /** The decimals the field keeps. */
27
+ fractionDigits?: number;
28
+ min?: number;
29
+ max?: number;
30
+ };
31
+ export type KeypadProps = {
32
+ /** The value as canonical decimal text (`'12.5'`, `''` when empty). Controlled with `onValueChange`. */
33
+ value?: string;
34
+ /** The value of an uncontrolled keypad. */
35
+ defaultValue?: string;
36
+ /** Called with the new value text whenever it changes (`''` when emptied); not while a calculation waits for `=`. */
37
+ onValueChange?: (value: string) => void;
38
+ /**
39
+ * The commit key (or Enter): the value, within `min` and `max`, and the
40
+ * expression that gave it (`'2+3'`; the value itself without operations).
41
+ * With operations, the key first evaluates a pending calculation.
42
+ */
43
+ onCommit?: (value: string, expression: string) => void;
44
+ /** Calculation keys: `true` offers all four, a list picks some. Off by default; `minor` entry and the `cash` variant take none. */
45
+ operations?: boolean | readonly KeypadOperation[];
46
+ /** The locale of the decimal separator, grouping and spoken results; the page's by default. */
47
+ locale?: string;
48
+ /** Decimals kept: further digits are refused, a calculation is rounded half-up to them. The currency's by default. */
49
+ fractionDigits?: number;
50
+ /** An ISO 4217 code: the amount shows its symbol and takes the currency's decimals. */
51
+ currency?: string;
52
+ /** The commit key clamps the value to this floor and ceiling; typing past `max` is refused. */
53
+ min?: number;
54
+ max?: number;
55
+ /**
56
+ * Where the physical keyboard works: `'focus'` (default) when focus is in
57
+ * the keypad, `'global'` anywhere on the page outside fields, `false` never.
58
+ */
59
+ keyboard?: 'focus' | 'global' | false;
60
+ /** Key height: `comfortable` (default) or `large` for a till. */
61
+ size?: 'comfortable' | 'large';
62
+ /** The commit key's name and text; the translated "Enter" by default. */
63
+ commitLabel?: string;
64
+ /** Keys do nothing and say so. */
65
+ disabled?: boolean;
66
+ /** `'standard'` (default) or `'cash'`: tender against `total`, with change, bill shortcuts and `onTender`. */
67
+ variant?: KeypadVariant;
68
+ /** `cash`: the amount due, as a number or exact decimal text. */
69
+ total?: number | string;
70
+ /** `cash`: the bills and coins (`[5, 10, 20, 50]`) whose next round amount at or above `total` is offered as an amount button after the exact total (four buttons at most, none above `max`). A button fills the amount; the commit key tenders. */
71
+ denominations?: readonly number[];
72
+ /**
73
+ * `cash`: the commit key (or Enter) with the amount tendered and the
74
+ * settlement, once a valid `total` is set and an amount is entered (a missing
75
+ * or negative `total` does nothing). `onCommit` is not called in this variant. The app owns the charge; the keypad only reports it. A
76
+ * short payment is a settlement too, not an error.
77
+ */
78
+ onTender?: (tendered: string, settlement: KeypadSettlement) => void;
79
+ /** `'decimal'` (default) or `'minor'`. */
80
+ entry?: KeypadEntry;
81
+ /**
82
+ * A field the keypad types into (`useKeypadNumber`, `useKeypadQuantity`).
83
+ * Its value, decimals, `min` and `max` apply unless the same prop is given.
84
+ */
85
+ binding?: KeypadBinding;
86
+ /** Shows the amount above the keys: by default when no `binding` is given or `operations` are offered (the field shows the number, not the calculation). */
87
+ display?: boolean;
88
+ /** The keypad's accessible name; "Keypad" by default. */
89
+ label?: string;
90
+ className?: string;
91
+ };
@@ -0,0 +1,14 @@
1
+ import { KeypadProps } from './keypad.types.js';
2
+ import { useKeypad } from './use-keypad.js';
3
+ /**
4
+ * What the cash variant adds to the keypad: the settlement of what is
5
+ * tendered so far, the bill shortcuts, and the sentence the live region says
6
+ * ("Change 2.65", "Still due 1.00"). Nothing for the standard variant.
7
+ */
8
+ export declare function useKeypadCash(p: Pick<KeypadProps, 'variant' | 'total' | 'denominations' | 'locale' | 'currency' | 'max'>, k: ReturnType<typeof useKeypad>): {
9
+ cash: boolean;
10
+ total: string | undefined;
11
+ settlement: import('./keypad.types.js').KeypadSettlement | undefined;
12
+ shortcuts: string[];
13
+ said: string | undefined;
14
+ };
@@ -0,0 +1,7 @@
1
+ import { useKeypad } from './use-keypad.js';
2
+ /**
3
+ * The physical keyboard: `onKeyDown` for the keypad's root (the `'focus'`
4
+ * mode), and with `global` a window listener too. Enter commits, the other
5
+ * keys press; a key the keypad does not offer is left to the page.
6
+ */
7
+ export declare function useKeypadKeyboard(k: ReturnType<typeof useKeypad>, locale: string | undefined, global: boolean): (ev: import('react').KeyboardEvent<HTMLElement>) => void;
@@ -0,0 +1,10 @@
1
+ import { KeypadBinding } from './keypad.types.js';
2
+ import { UseKeypadNumberOptions } from './keypad-binding.js';
3
+ /**
4
+ * Binds a Keypad to a number field's value (`NumberField`, `PercentField`,
5
+ * `CurrencyField`, including its `minorUnits`): pass the result as the
6
+ * keypad's `binding`. The keypad reads the field's number, writes each change
7
+ * back, holds `min` / `max` and the decimals, and hides its own display unless
8
+ * `operations` are offered.
9
+ */
10
+ export declare function useKeypadNumber(options: UseKeypadNumberOptions): KeypadBinding;
@@ -0,0 +1,16 @@
1
+ import { QuantityValue } from '../../fields/quantity-field/types.js';
2
+ import { KeypadBinding } from './keypad.types.js';
3
+ export type UseKeypadQuantityOptions = {
4
+ /** The QuantityField's value: the amount and its unit. */
5
+ value: QuantityValue | undefined;
6
+ /** Called on each change; `value` is `null` when the keypad is emptied. */
7
+ onChange?: (value: QuantityValue) => void;
8
+ min?: number;
9
+ max?: number;
10
+ fractionDigits?: number;
11
+ };
12
+ /**
13
+ * Binds a Keypad to a `QuantityField`'s amount: the keypad types the number,
14
+ * the unit stays as the field holds it.
15
+ */
16
+ export declare function useKeypadQuantity(options: UseKeypadQuantityOptions): KeypadBinding;
@@ -0,0 +1,17 @@
1
+ import { CalcSession } from '@nxgt/material-core/calculator';
2
+ import { RefObject } from 'react';
3
+ import { KeypadProps } from './keypad.types.js';
4
+ type ValueOptions = Pick<KeypadProps, 'value' | 'defaultValue' | 'onValueChange'>;
5
+ /**
6
+ * The keypad's session and its link to the app's value. A controlled `value`
7
+ * is the truth on every render: when it differs from the value the keypad
8
+ * last held or reported, the session is replaced by it (the app cleared, set
9
+ * or refused a change), even while a calculation waits. `report` tells the
10
+ * app the value, except while a calculation waits for `=`.
11
+ */
12
+ export declare function useKeypadValue(o: ValueOptions, onValueChange: RefObject<ValueOptions['onValueChange']>): {
13
+ session: CalcSession;
14
+ setInner: import('react').Dispatch<import('react').SetStateAction<CalcSession>>;
15
+ report: (next: CalcSession) => void;
16
+ };
17
+ export {};
@@ -0,0 +1,23 @@
1
+ import { CalcKey } from '@nxgt/material-core/calculator';
2
+ import { KeypadProps } from './keypad.types.js';
3
+ type Options = Pick<KeypadProps, 'value' | 'defaultValue' | 'onValueChange' | 'onCommit' | 'variant' | 'total' | 'onTender' | 'operations' | 'fractionDigits' | 'currency' | 'min' | 'max' | 'entry' | 'disabled'>;
4
+ /**
5
+ * The keypad's state: a calculator session, held as typed. A controlled
6
+ * `value` is the truth on every render: when it differs from the value the
7
+ * keypad last held or reported, it replaces the session (the app cleared, set
8
+ * or refused a change), even while a calculation waits; `onValueChange` fires when a key changes the
9
+ * value text, not on every key (a `.` or an operator does not) and never
10
+ * while a calculation waits for `=`.
11
+ */
12
+ export declare function useKeypad(o: Options): {
13
+ session: import('@nxgt/material-core/calculator').CalcSession;
14
+ value: string;
15
+ pending: boolean;
16
+ digits: number | undefined;
17
+ entry: import('./keypad.types.js').KeypadEntry;
18
+ operations: readonly import('./keypad.types.js').KeypadOperation[];
19
+ press: (key: CalcKey) => void;
20
+ commit: () => void;
21
+ set: (value: string) => void;
22
+ };
23
+ export {};
@@ -1,6 +1,7 @@
1
1
  export * from './resolve-theme.js';
2
2
  export * from './unsaved-guard-rules.js';
3
3
  export * from './use-allowed-transitions.js';
4
+ export * from './use-barcode-scanner.js';
4
5
  export * from './use-countdown.js';
5
6
  export { useCspNonce } from './use-csp-nonce.js';
6
7
  export * from './use-drafts.js';
@@ -0,0 +1,39 @@
1
+ import { ScannerOptions, ScannerResult } from '@nxgt/material-core/barcode-scanner';
2
+ export { createScanner, DEFAULT_SCANNER_MAX_GAP, DEFAULT_SCANNER_MIN_LENGTH, type Scanner, type ScannerOptions, type ScannerResult, } from '@nxgt/material-core/barcode-scanner';
3
+ export type UseBarcodeScannerOptions = ScannerOptions & {
4
+ /** Called with the code when a scan ends. The Enter that closed it is swallowed. */
5
+ onScan: (code: string) => void;
6
+ /** Off while false: nothing is listened to and nothing is swallowed. Default `true`. */
7
+ enabled?: boolean;
8
+ /**
9
+ * A CSS selector of the form fields a scan is also accepted in (a search
10
+ * field). A scan is always accepted outside form fields; every other
11
+ * `input`, `textarea`, `select` and editable element is typed in.
12
+ */
13
+ acceptIn?: string;
14
+ /**
15
+ * Called for each key the scanner looked at, after it did, with what it
16
+ * made of the key and the characters buffered so far. A screen with its own
17
+ * shortcuts skips them while `pending.length > 1`: those keys are a scan's.
18
+ */
19
+ onKey?: (event: KeyboardEvent, state: {
20
+ result: ScannerResult;
21
+ pending: string;
22
+ }) => void;
23
+ };
24
+ type KeyTarget = Pick<Document, 'addEventListener' | 'removeEventListener'>;
25
+ /**
26
+ * The framework-free binding behind `useBarcodeScanner`: one capture-phase
27
+ * `keydown` listener on `target`. Returns what removes it.
28
+ */
29
+ export declare function attachBarcodeScanner(target: KeyTarget, { onScan, acceptIn, onKey, maxGap, minLength, }: Omit<UseBarcodeScannerOptions, 'enabled'>): () => void;
30
+ /**
31
+ * Hears a keyboard-wedge barcode reader anywhere on the page: a run of keys
32
+ * each within `maxGap` ms (50) of the last, at least `minLength` (4) long,
33
+ * closed by Enter, reaches `onScan(code)`. Slower or shorter runs are typing
34
+ * and are left alone, as are Ctrl, Meta and Alt chords and key repeat. Scans
35
+ * are accepted outside form fields, and in the fields `acceptIn` names. The
36
+ * callbacks are read from a ref: a new function each render never re-binds
37
+ * the listener. Does nothing on the server.
38
+ */
39
+ export declare function useBarcodeScanner(options: UseBarcodeScannerOptions): void;
@@ -70,6 +70,7 @@ export declare const en: {
70
70
  processing: string;
71
71
  failed: string;
72
72
  "form-failed": string;
73
+ "type-phrase": string;
73
74
  };
74
75
  "scroll-progress": string;
75
76
  "skip-link": string;
@@ -1460,6 +1461,19 @@ export declare const en: {
1460
1461
  invalid: string;
1461
1462
  open: string;
1462
1463
  };
1464
+ "status-menu": {
1465
+ trigger: string;
1466
+ current: string;
1467
+ confirms: string;
1468
+ "confirm-default": string;
1469
+ locked: string;
1470
+ unavailable: string;
1471
+ saving: string;
1472
+ changed: string;
1473
+ failed: string;
1474
+ close: string;
1475
+ choose: string;
1476
+ };
1463
1477
  stepper: {
1464
1478
  step: string;
1465
1479
  completed: string;
@@ -3535,6 +3549,17 @@ export declare const en: {
3535
3549
  cancel: string;
3536
3550
  };
3537
3551
  };
3552
+ keypad: {
3553
+ commit: string;
3554
+ tender: string;
3555
+ total: string;
3556
+ change: string;
3557
+ due: string;
3558
+ shortcuts: string;
3559
+ "change-label": string;
3560
+ "due-label": string;
3561
+ amount: string;
3562
+ };
3538
3563
  "record-actions": {
3539
3564
  archive: string;
3540
3565
  restore: string;
@@ -59,7 +59,8 @@ declare const _default: {
59
59
  "cancel": "Cancel",
60
60
  "processing": "Processing...",
61
61
  "failed": "The action failed.",
62
- "form-failed": "The form could not be loaded."
62
+ "form-failed": "The form could not be loaded.",
63
+ "type-phrase": "Type {phrase} to confirm"
63
64
  },
64
65
  "scroll-progress": "Scroll progress",
65
66
  "skip-link": "Skip to content",
@@ -1450,6 +1451,19 @@ declare const _default: {
1450
1451
  "invalid": "Enter a valid URL",
1451
1452
  "open": "Open URL"
1452
1453
  },
1454
+ "status-menu": {
1455
+ "trigger": "Status of {label}: {status}",
1456
+ "current": "Current status",
1457
+ "confirms": "Asks first",
1458
+ "confirm-default": "Change the status to {label}?",
1459
+ "locked": "Locked",
1460
+ "unavailable": "Not available from {status}",
1461
+ "saving": "Saving the status of {label}",
1462
+ "changed": "Status of {label} changed to {status}",
1463
+ "failed": "The status of {label} could not be changed",
1464
+ "close": "Close",
1465
+ "choose": "Choose a status"
1466
+ },
1453
1467
  "stepper": {
1454
1468
  "step": "Step {step}",
1455
1469
  "completed": "Completed",
@@ -3525,6 +3539,17 @@ declare const _default: {
3525
3539
  "cancel": "Cancel"
3526
3540
  }
3527
3541
  },
3542
+ "keypad": {
3543
+ "commit": "Enter",
3544
+ "tender": "Tender",
3545
+ "total": "Total",
3546
+ "change": "Change {amount}",
3547
+ "due": "Still due {amount}",
3548
+ "shortcuts": "Quick amounts",
3549
+ "change-label": "Change",
3550
+ "due-label": "Still due",
3551
+ "amount": "Amount {amount}"
3552
+ },
3528
3553
  "record-actions": {
3529
3554
  "archive": "Archive",
3530
3555
  "restore": "Restore",
@@ -70,6 +70,7 @@ export declare const fr: {
70
70
  processing: string;
71
71
  failed: string;
72
72
  "form-failed": string;
73
+ "type-phrase": string;
73
74
  };
74
75
  "scroll-progress": string;
75
76
  "skip-link": string;
@@ -1460,6 +1461,19 @@ export declare const fr: {
1460
1461
  invalid: string;
1461
1462
  open: string;
1462
1463
  };
1464
+ "status-menu": {
1465
+ trigger: string;
1466
+ current: string;
1467
+ confirms: string;
1468
+ "confirm-default": string;
1469
+ locked: string;
1470
+ unavailable: string;
1471
+ saving: string;
1472
+ changed: string;
1473
+ failed: string;
1474
+ close: string;
1475
+ choose: string;
1476
+ };
1463
1477
  stepper: {
1464
1478
  step: string;
1465
1479
  completed: string;
@@ -3535,6 +3549,17 @@ export declare const fr: {
3535
3549
  cancel: string;
3536
3550
  };
3537
3551
  };
3552
+ keypad: {
3553
+ commit: string;
3554
+ tender: string;
3555
+ total: string;
3556
+ change: string;
3557
+ due: string;
3558
+ shortcuts: string;
3559
+ "change-label": string;
3560
+ "due-label": string;
3561
+ amount: string;
3562
+ };
3538
3563
  "record-actions": {
3539
3564
  archive: string;
3540
3565
  restore: string;
@@ -59,7 +59,8 @@ declare const _default: {
59
59
  "cancel": "Annuler",
60
60
  "processing": "Traitement en cours…",
61
61
  "failed": "L’action a échoué.",
62
- "form-failed": "Le formulaire n’a pas pu être chargé."
62
+ "form-failed": "Le formulaire n’a pas pu être chargé.",
63
+ "type-phrase": "Saisissez {phrase} pour confirmer"
63
64
  },
64
65
  "scroll-progress": "Progression du défilement",
65
66
  "skip-link": "Aller au contenu",
@@ -1450,6 +1451,19 @@ declare const _default: {
1450
1451
  "invalid": "Saisissez une URL valide",
1451
1452
  "open": "Ouvrir l’URL"
1452
1453
  },
1454
+ "status-menu": {
1455
+ "trigger": "Statut de {label} : {status}",
1456
+ "current": "Statut actuel",
1457
+ "confirms": "Demande confirmation",
1458
+ "confirm-default": "Changer le statut en {label} ?",
1459
+ "locked": "Verrouillé",
1460
+ "unavailable": "Indisponible depuis {status}",
1461
+ "saving": "Enregistrement du statut de {label}",
1462
+ "changed": "Statut de {label} changé en {status}",
1463
+ "failed": "Le statut de {label} n'a pas pu être changé",
1464
+ "close": "Fermer",
1465
+ "choose": "Choisir un statut"
1466
+ },
1453
1467
  "stepper": {
1454
1468
  "step": "Étape {step}",
1455
1469
  "completed": "Terminée",
@@ -3525,6 +3539,17 @@ declare const _default: {
3525
3539
  "cancel": "Annuler"
3526
3540
  }
3527
3541
  },
3542
+ "keypad": {
3543
+ "commit": "Valider",
3544
+ "tender": "Encaisser",
3545
+ "total": "Total",
3546
+ "change": "Monnaie à rendre {amount}",
3547
+ "due": "Reste à payer {amount}",
3548
+ "shortcuts": "Montants rapides",
3549
+ "change-label": "Monnaie",
3550
+ "due-label": "Reste à payer",
3551
+ "amount": "Montant {amount}"
3552
+ },
3528
3553
  "record-actions": {
3529
3554
  "archive": "Archiver",
3530
3555
  "restore": "Restaurer",
@@ -68,6 +68,7 @@ export declare const resources: {
68
68
  processing: string;
69
69
  failed: string;
70
70
  "form-failed": string;
71
+ "type-phrase": string;
71
72
  };
72
73
  "scroll-progress": string;
73
74
  "skip-link": string;
@@ -1458,6 +1459,19 @@ export declare const resources: {
1458
1459
  invalid: string;
1459
1460
  open: string;
1460
1461
  };
1462
+ "status-menu": {
1463
+ trigger: string;
1464
+ current: string;
1465
+ confirms: string;
1466
+ "confirm-default": string;
1467
+ locked: string;
1468
+ unavailable: string;
1469
+ saving: string;
1470
+ changed: string;
1471
+ failed: string;
1472
+ close: string;
1473
+ choose: string;
1474
+ };
1461
1475
  stepper: {
1462
1476
  step: string;
1463
1477
  completed: string;
@@ -3533,6 +3547,17 @@ export declare const resources: {
3533
3547
  cancel: string;
3534
3548
  };
3535
3549
  };
3550
+ keypad: {
3551
+ commit: string;
3552
+ tender: string;
3553
+ total: string;
3554
+ change: string;
3555
+ due: string;
3556
+ shortcuts: string;
3557
+ "change-label": string;
3558
+ "due-label": string;
3559
+ amount: string;
3560
+ };
3536
3561
  "record-actions": {
3537
3562
  archive: string;
3538
3563
  restore: string;
@@ -3668,6 +3693,7 @@ export declare const resources: {
3668
3693
  processing: string;
3669
3694
  failed: string;
3670
3695
  "form-failed": string;
3696
+ "type-phrase": string;
3671
3697
  };
3672
3698
  "scroll-progress": string;
3673
3699
  "skip-link": string;
@@ -5058,6 +5084,19 @@ export declare const resources: {
5058
5084
  invalid: string;
5059
5085
  open: string;
5060
5086
  };
5087
+ "status-menu": {
5088
+ trigger: string;
5089
+ current: string;
5090
+ confirms: string;
5091
+ "confirm-default": string;
5092
+ locked: string;
5093
+ unavailable: string;
5094
+ saving: string;
5095
+ changed: string;
5096
+ failed: string;
5097
+ close: string;
5098
+ choose: string;
5099
+ };
5061
5100
  stepper: {
5062
5101
  step: string;
5063
5102
  completed: string;
@@ -7133,6 +7172,17 @@ export declare const resources: {
7133
7172
  cancel: string;
7134
7173
  };
7135
7174
  };
7175
+ keypad: {
7176
+ commit: string;
7177
+ tender: string;
7178
+ total: string;
7179
+ change: string;
7180
+ due: string;
7181
+ shortcuts: string;
7182
+ "change-label": string;
7183
+ "due-label": string;
7184
+ amount: string;
7185
+ };
7136
7186
  "record-actions": {
7137
7187
  archive: string;
7138
7188
  restore: string;