@nxgt/material 3.75.0 → 3.76.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 (239) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +37 -1
  3. package/dist/{alert-dialog-BfO_ri-N.js → alert-dialog-653apk3f.js} +8 -7
  4. package/dist/{async-slice-roMAJVzG.js → async-slice-CXLbQuOc.js} +1 -1
  5. package/dist/{bubble-input-B7BVd9fX.js → bubble-input-CQwVSoU3.js} +30 -29
  6. package/dist/{button-DgenqmpS.js → button-3op3rtZh.js} +5 -4
  7. package/dist/calculator-BaSMe0SK.js +1189 -0
  8. package/dist/calculator-announce-DRd2c6Dq.js +89 -0
  9. package/dist/calculator-context-BugcKuVG.js +10 -0
  10. package/dist/calculator-field.js +172 -0
  11. package/dist/calculator-panel-announce-AZSnZUSr.js +29 -0
  12. package/dist/calculator-segment-BlJE1LaS.js +22 -0
  13. package/dist/calculator.js +2 -0
  14. package/dist/charts.js +3 -3
  15. package/dist/{chip-CiDczNxO.js → chip-MuKDwtkG.js} +2 -2
  16. package/dist/{code-editor-CohlhFsA.js → code-editor-Bp2RrdNx.js} +13 -13
  17. package/dist/code-editor.js +37 -37
  18. package/dist/{code-language-items-Cs8GLYDp.js → code-language-items-B7WR5ua_.js} +19 -24
  19. package/dist/components/base-content.css +9 -4
  20. package/dist/components/ui/collections/server-table/server-table-phone-row.css +10 -3
  21. package/dist/{components-zJdfH4im.js → components-Ci3Zo8kC.js} +15837 -17245
  22. package/dist/components.js +37 -28
  23. package/dist/conversion-variant-BDFAxqe9.js +529 -0
  24. package/dist/copy-to-clipboard-Be5Ffvs_.js +7 -0
  25. package/dist/currency-B-r3ig11.js +16 -0
  26. package/dist/currency-field-BJ9rSrif.js +285 -0
  27. package/dist/{number.utils-BG_eEt5g.js → date.utils-DUvqcjan.js} +1 -7
  28. package/dist/dialog-Bm5LvVlB.js +166 -0
  29. package/dist/dist-BZe2evxL.js +139 -0
  30. package/dist/dist-CxhKjOYm.js +28 -0
  31. package/dist/dist-DHdUUM1w.js +241 -0
  32. package/dist/{dist-C4wtXCjf.js → dist-DOK3zo5C.js} +33 -32
  33. package/dist/dist-DWZXlCZR.js +182 -0
  34. package/dist/dist-DkQbkF9T.js +33 -0
  35. package/dist/dnd.js +1 -1
  36. package/dist/{dropdown-menu-CzR6JP31.js → dropdown-menu-xlZ6NYUA.js} +160 -159
  37. package/dist/editor.js +299 -298
  38. package/dist/{empty-state-DjHGMp5F.js → empty-state-C0kviQdW.js} +2 -2
  39. package/dist/{field-blur-CdASxjL7.js → field-blur-DkiZOVNV.js} +178 -180
  40. package/dist/{field-blur-context-kZ4SD7xu.js → field-blur-context-BLGgf_3z.js} +2 -2
  41. package/dist/financial-variant-BsZEa5sF.js +459 -0
  42. package/dist/{hooks-Dqq8O3Az.js → hooks-Dg94jPRq.js} +12 -12
  43. package/dist/hooks.js +2 -2
  44. package/dist/{hover-card-BPKqte4a.js → hover-card-B1g55Hi6.js} +44 -43
  45. package/dist/i18n.js +3 -3
  46. package/dist/icon-badge-BcW66bRk.js +17 -0
  47. package/dist/{icon-button-Cr-DyDGg.js → icon-button-Cogxy1cy.js} +5 -4
  48. package/dist/{in-dialog-Vwkyp-M5.js → in-dialog-D61Yeaol.js} +2 -1
  49. package/dist/input-CC2joTjB.js +56 -0
  50. package/dist/key-layout-cR79xfGE.js +38 -0
  51. package/dist/lib/calculator/index.d.ts +16 -0
  52. package/dist/lib/calculator-field/index.d.ts +12 -0
  53. package/dist/lib/components/ui/collections/filter/use-filter-field-config.d.ts +2 -2
  54. package/dist/lib/components/ui/feedback/moment/moment-body.d.ts +17 -2
  55. package/dist/lib/components/ui/feedback/moment/moment-passive.d.ts +13 -0
  56. package/dist/lib/components/ui/feedback/moment/moment.d.ts +16 -2
  57. package/dist/lib/components/ui/fields/calculator-field/apply-calculated.d.ts +17 -0
  58. package/dist/lib/components/ui/fields/calculator-field/calculator-field-content.d.ts +16 -0
  59. package/dist/lib/components/ui/fields/calculator-field/calculator-field-trigger.d.ts +4 -0
  60. package/dist/lib/components/ui/fields/calculator-field/calculator-field.d.ts +12 -0
  61. package/dist/lib/components/ui/fields/calculator-field/calculator-field.types.d.ts +31 -0
  62. package/dist/lib/components/ui/fields/calculator-field/calculator-form-field.d.ts +4 -0
  63. package/dist/lib/components/ui/fields/calculator-field/index.d.ts +3 -0
  64. package/dist/lib/components/ui/fields/calculator-field/use-calculator-field.d.ts +15 -0
  65. package/dist/lib/components/ui/fields/contacts/placeholders.d.ts +1 -1
  66. package/dist/lib/components/ui/fields/currency-field/currency-field.d.ts +7 -1
  67. package/dist/lib/components/ui/layout/app-shell/app-sidebar-context.d.ts +4 -0
  68. package/dist/lib/components/ui/widgets/calculator/calculator-announce.d.ts +27 -0
  69. package/dist/lib/components/ui/widgets/calculator/calculator-clipboard.d.ts +19 -0
  70. package/dist/lib/components/ui/widgets/calculator/calculator-context.d.ts +49 -0
  71. package/dist/lib/components/ui/widgets/calculator/calculator-feedback.d.ts +18 -0
  72. package/dist/lib/components/ui/widgets/calculator/calculator-keyboard.d.ts +30 -0
  73. package/dist/lib/components/ui/widgets/calculator/calculator-storage.d.ts +17 -0
  74. package/dist/lib/components/ui/widgets/calculator/calculator-variant-steps.d.ts +16 -0
  75. package/dist/lib/components/ui/widgets/calculator/calculator.d.ts +11 -0
  76. package/dist/lib/components/ui/widgets/calculator/calculator.selectors.d.ts +23 -0
  77. package/dist/lib/components/ui/widgets/calculator/calculator.slice.d.ts +1881 -0
  78. package/dist/lib/components/ui/widgets/calculator/currency.d.ts +9 -0
  79. package/dist/lib/components/ui/widgets/calculator/engine.d.ts +22 -0
  80. package/dist/lib/components/ui/widgets/calculator/index.d.ts +3 -0
  81. package/dist/lib/components/ui/widgets/calculator/partials/calculator-announcer.d.ts +2 -0
  82. package/dist/lib/components/ui/widgets/calculator/partials/calculator-display.d.ts +3 -0
  83. package/dist/lib/components/ui/widgets/calculator/partials/calculator-key.d.ts +17 -0
  84. package/dist/lib/components/ui/widgets/calculator/partials/calculator-keypad.d.ts +8 -0
  85. package/dist/lib/components/ui/widgets/calculator/partials/calculator-loading.d.ts +6 -0
  86. package/dist/lib/components/ui/widgets/calculator/partials/calculator-memory.d.ts +2 -0
  87. package/dist/lib/components/ui/widgets/calculator/partials/calculator-panel-announce.d.ts +10 -0
  88. package/dist/lib/components/ui/widgets/calculator/partials/calculator-panel-body.d.ts +9 -0
  89. package/dist/lib/components/ui/widgets/calculator/partials/calculator-screen.d.ts +4 -0
  90. package/dist/lib/components/ui/widgets/calculator/partials/calculator-segment.d.ts +21 -0
  91. package/dist/lib/components/ui/widgets/calculator/partials/calculator-shell.d.ts +9 -0
  92. package/dist/lib/components/ui/widgets/calculator/partials/calculator-switcher.d.ts +5 -0
  93. package/dist/lib/components/ui/widgets/calculator/partials/calculator-tape.d.ts +4 -0
  94. package/dist/lib/components/ui/widgets/calculator/partials/calculator-tools.d.ts +4 -0
  95. package/dist/lib/components/ui/widgets/calculator/partials/keypad-navigation.d.ts +24 -0
  96. package/dist/lib/components/ui/widgets/calculator/types.d.ts +102 -0
  97. package/dist/lib/components/ui/widgets/calculator/use-calculator-clipboard.d.ts +19 -0
  98. package/dist/lib/components/ui/widgets/calculator/use-calculator-conversion.d.ts +4 -0
  99. package/dist/lib/components/ui/widgets/calculator/use-calculator-feedback.d.ts +3 -0
  100. package/dist/lib/components/ui/widgets/calculator/use-calculator-keyboard.d.ts +22 -0
  101. package/dist/lib/components/ui/widgets/calculator/use-calculator-persistence.d.ts +14 -0
  102. package/dist/lib/components/ui/widgets/calculator/use-calculator-pos.d.ts +25 -0
  103. package/dist/lib/components/ui/widgets/calculator/use-calculator-press.d.ts +26 -0
  104. package/dist/lib/components/ui/widgets/calculator/use-calculator-tape.d.ts +29 -0
  105. package/dist/lib/components/ui/widgets/calculator/use-calculator-value.d.ts +9 -0
  106. package/dist/lib/components/ui/widgets/calculator/use-calculator-variant.d.ts +23 -0
  107. package/dist/lib/components/ui/widgets/calculator/use-calculator.d.ts +10 -0
  108. package/dist/lib/components/ui/widgets/calculator/use-engine-settings.d.ts +10 -0
  109. package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-fields.d.ts +19 -0
  110. package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-labels.d.ts +17 -0
  111. package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-math.d.ts +31 -0
  112. package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-names.d.ts +4 -0
  113. package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-panel.d.ts +7 -0
  114. package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-rates.d.ts +29 -0
  115. package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-result.d.ts +15 -0
  116. package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-state.d.ts +36 -0
  117. package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-variant.d.ts +3 -0
  118. package/dist/lib/components/ui/widgets/calculator/variants/conversion/use-conversion.d.ts +24 -0
  119. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-change.d.ts +4 -0
  120. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-figures.d.ts +43 -0
  121. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-format.d.ts +12 -0
  122. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-loan-math.d.ts +14 -0
  123. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-loan.d.ts +4 -0
  124. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-margin.d.ts +4 -0
  125. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-math.d.ts +10 -0
  126. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-panel.d.ts +7 -0
  127. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-parts.d.ts +35 -0
  128. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-table.d.ts +7 -0
  129. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-variant.d.ts +3 -0
  130. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-vat.d.ts +4 -0
  131. package/dist/lib/components/ui/widgets/calculator/variants/key-layout.d.ts +51 -0
  132. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-announce.d.ts +16 -0
  133. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-aside.d.ts +2 -0
  134. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-display.d.ts +2 -0
  135. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-fields.d.ts +2 -0
  136. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-layout.d.ts +9 -0
  137. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-line.d.ts +6 -0
  138. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-names.d.ts +2 -0
  139. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-state.d.ts +3 -0
  140. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-tender.d.ts +2 -0
  141. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-ticket-data.d.ts +41 -0
  142. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-ticket.d.ts +5 -0
  143. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-totals.d.ts +2 -0
  144. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-types.d.ts +76 -0
  145. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-variant.d.ts +3 -0
  146. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-vat.d.ts +2 -0
  147. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-view.d.ts +28 -0
  148. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-announce.d.ts +19 -0
  149. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-base.d.ts +11 -0
  150. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-bitpad.d.ts +14 -0
  151. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-display.d.ts +9 -0
  152. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-layout.d.ts +6 -0
  153. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-names.d.ts +2 -0
  154. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-readouts.d.ts +14 -0
  155. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-reduce.d.ts +29 -0
  156. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-state.d.ts +22 -0
  157. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-toolbar.d.ts +5 -0
  158. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-variant.d.ts +3 -0
  159. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-word.d.ts +15 -0
  160. package/dist/lib/components/ui/widgets/calculator/variants/registry.d.ts +21 -0
  161. package/dist/lib/components/ui/widgets/calculator/variants/scientific/scientific-layout.d.ts +3 -0
  162. package/dist/lib/components/ui/widgets/calculator/variants/scientific/scientific-names.d.ts +2 -0
  163. package/dist/lib/components/ui/widgets/calculator/variants/scientific/scientific-toolbar.d.ts +2 -0
  164. package/dist/lib/components/ui/widgets/calculator/variants/scientific/scientific-variant.d.ts +3 -0
  165. package/dist/lib/components/ui/widgets/calculator/variants/standard/standard-layout.d.ts +3 -0
  166. package/dist/lib/components/ui/widgets/calculator/variants/variant-loader.d.ts +34 -0
  167. package/dist/lib/components/ui/widgets/calculator/variants/variant-logic.d.ts +40 -0
  168. package/dist/lib/components/ui/widgets/calculator/variants/variant-types.d.ts +62 -0
  169. package/dist/lib/i18n/resources/en/en.d.ts +412 -0
  170. package/dist/lib/i18n/resources/en/material.json.d.ts +412 -0
  171. package/dist/lib/i18n/resources/fr/fr.d.ts +412 -0
  172. package/dist/lib/i18n/resources/fr/material.json.d.ts +412 -0
  173. package/dist/lib/i18n/resources/resources.d.ts +824 -0
  174. package/dist/lib/i18n/translator.d.ts +1 -1
  175. package/dist/lib.js +4 -3
  176. package/dist/main.js +50 -40
  177. package/dist/map.js +66 -65
  178. package/dist/material.css +1 -1
  179. package/dist/native-select-w_FlBLHV.js +40 -0
  180. package/dist/number.utils-CSueQZcv.js +7 -0
  181. package/dist/pdf-reader.js +1 -1
  182. package/dist/percent-field-lahyDJDG.js +14 -0
  183. package/dist/picker-surface-CV09H7Nb.js +1220 -0
  184. package/dist/popover-Cd7DkND4.js +233 -0
  185. package/dist/pos-types-DKCkOTYy.js +49 -0
  186. package/dist/pos-variant-GrUfbTTP.js +603 -0
  187. package/dist/print.js +1 -1
  188. package/dist/programmer-variant-eKJNKENL.js +501 -0
  189. package/dist/programmer-word-CNCF7DJF.js +15 -0
  190. package/dist/{public-DC9VQw4Z.js → public-y6g4ddxd.js} +895 -892
  191. package/dist/{rich-code-block-DBSL9zEN.js → rich-code-block-CRQ0iyLb.js} +5 -5
  192. package/dist/scientific-variant-2y3UxAAU.js +149 -0
  193. package/dist/{sortable-provider-C4tk5esY.js → sortable-provider-DdiI3Fwk.js} +2 -2
  194. package/dist/{spinner-B2MubVWb.js → spinner-C1QIewWv.js} +133 -159
  195. package/dist/standard-layout-BuSRr3TY.js +40 -0
  196. package/dist/tabs-DzEqMb1W.js +383 -0
  197. package/dist/{icon-badge-B9uvDoyY.js → text-field-BAdY-kpO.js} +20 -34
  198. package/dist/theme-picker.js +3 -3
  199. package/dist/{theme-toggle-BInlu21G.js → theme-toggle-C_VeiiCm.js} +2 -2
  200. package/dist/toggle-FeCCJqbg.js +40 -0
  201. package/dist/{toggle-group-DXXlqid2.js → toggle-group-CVMxEpWi.js} +1 -1
  202. package/dist/{toolbar-items-CRJSx1MU.js → toolbar-items-D310xDuM.js} +333 -554
  203. package/dist/{translate-material-pVlPJ1v4.js → translate-material-BypJJ1l5.js} +1 -1
  204. package/dist/{translator-BoYCward.js → translator-DJkf4J7t.js} +824 -0
  205. package/dist/{typography-B6YMbCge.js → typography-CYEquVeb.js} +1 -1
  206. package/dist/{use-chat-composer-BvWQogJe.js → use-chat-composer-DMXu9E1O.js} +4198 -4600
  207. package/dist/{use-heading-spy-B_Z4ArDh.js → use-heading-spy-DJR8YYm6.js} +19 -19
  208. package/dist/{use-material-translation-CIS2n3RB.js → use-material-translation-CD6QoVal.js} +1 -1
  209. package/dist/{use-return-focus-DNQtADAR.js → use-return-focus-Cevw_6yq.js} +106 -105
  210. package/dist/useLatest-C2PnQEeD.js +8 -0
  211. package/docs/README.md +1 -0
  212. package/docs/components/feedback-and-status.md +10 -1
  213. package/docs/components/form-fields.md +1 -0
  214. package/docs/components/rich-widgets.md +108 -0
  215. package/docs/getting-started.md +1 -0
  216. package/docs/guides/calculator.md +468 -0
  217. package/docs/guides/forms.md +4 -2
  218. package/docs/guides/i18n.md +5 -0
  219. package/docs/previews/rich-widgets-calculator-conversion.webp +0 -0
  220. package/docs/previews/rich-widgets-calculator-point-of-sale.webp +0 -0
  221. package/docs/previews/rich-widgets-calculator.webp +0 -0
  222. package/docs/roadmap.md +9 -3
  223. package/docs/troubleshooting.md +134 -0
  224. package/lib/components/base-content.css +9 -4
  225. package/lib/components/ui/collections/server-table/server-table-phone-row.css +10 -3
  226. package/lib/components/ui/widgets/calculator/calculator-bands.css +146 -0
  227. package/lib/components/ui/widgets/calculator/calculator-display.css +83 -0
  228. package/lib/components/ui/widgets/calculator/calculator-keys.css +118 -0
  229. package/lib/components/ui/widgets/calculator/calculator-pos-ticket.css +185 -0
  230. package/lib/components/ui/widgets/calculator/calculator-pos.css +38 -0
  231. package/lib/components/ui/widgets/calculator/calculator-tape.css +71 -0
  232. package/lib/components/ui/widgets/calculator/calculator.css +97 -0
  233. package/lib/components/ui/widgets/calculator/variants/conversion/conversion.css +98 -0
  234. package/lib/components/ui/widgets/calculator/variants/financial/financial.css +162 -0
  235. package/lib/components/ui/widgets/calculator/variants/programmer/programmer.css +162 -0
  236. package/package.json +17 -3
  237. package/dist/dialog-AGsB3bv4.js +0 -219
  238. package/dist/dist-B7RjY7SL.js +0 -158
  239. package/dist/dist-lmHmz_bu.js +0 -419
@@ -0,0 +1,27 @@
1
+ import { AngleMode, CalcErrorCode, CalcKey, CalcSession } from '@nxgt/material-core/calculator';
2
+ import { MaterialLocaleKey } from '../../../../i18n/types.js';
3
+ import { ResultNotation } from './engine.js';
4
+ import { ProgrammerState } from './variants/programmer/programmer-word.js';
5
+ /** What the live region says: a `material.*` key, its English text and values. */
6
+ export type Announcement = {
7
+ readonly key: MaterialLocaleKey;
8
+ readonly fallback: string;
9
+ readonly values?: Readonly<Record<string, string | number>>;
10
+ };
11
+ /** The engine's error codes as the `material.calculator.error.*` leaves. */
12
+ export declare const ERROR_KEYS: Readonly<Record<CalcErrorCode, MaterialLocaleKey>>;
13
+ /** The memory, as a number in `locale`. */
14
+ export declare function memoryText(memory: string, locale?: string): string;
15
+ /**
16
+ * What the live region says after `key`: the result after `=`, an error when
17
+ * one appears, and the memory keys. Nothing for the others (typing is not
18
+ * announced).
19
+ */
20
+ export declare function announceKey(key: CalcKey, prev: CalcSession, next: CalcSession, locale?: string, programmer?: ProgrammerState): Announcement | null;
21
+ export declare const message: (name: "copied" | "pasted") => Announcement;
22
+ /** The live region's words when the angle unit changes. */
23
+ export declare const angleMessage: (mode: AngleMode) => Announcement;
24
+ /** The live region's words when the result notation changes. */
25
+ export declare const notationMessage: (notation: ResultNotation) => Announcement;
26
+ /** The live region's words when 2nd turns the second functions on or off. */
27
+ export declare const secondMessage: (on: boolean) => Announcement;
@@ -0,0 +1,19 @@
1
+ import { Announcement } from './calculator-announce.js';
2
+ import { ProgrammerState } from './variants/programmer/programmer-word.js';
3
+ export type CopyDeps = {
4
+ /** Writes text to the clipboard; rejects when it cannot. */
5
+ write: (text: string) => Promise<void>;
6
+ announce: (m: Announcement) => void;
7
+ };
8
+ /**
9
+ * Copies the exact value shown (canonical `value`) in the locale's decimal,
10
+ * without grouping; the Programmer variant copies it in the base shown, which
11
+ * a paste reads back. A refusal (no clipboard, denied) copies nothing and says
12
+ * nothing; the result is whether the text was written.
13
+ */
14
+ export declare function copyResult(value: string, locale: string | undefined, deps: CopyDeps, programmer?: ProgrammerState): Promise<boolean>;
15
+ /**
16
+ * The text of the clipboard for the Paste button, or `''` when it is empty,
17
+ * missing or denied. A keyboard paste uses the paste event's own data.
18
+ */
19
+ export declare function readClipboardText(read: (() => Promise<string>) | undefined): Promise<string>;
@@ -0,0 +1,49 @@
1
+ import { AngleMode, CalcKey, HistoryEntry, RoundingMode } from '@nxgt/material-core/calculator';
2
+ import { RefObject } from 'react';
3
+ import { DisplayModel } from './calculator.selectors.js';
4
+ import { CalculatorState } from './calculator.slice.js';
5
+ import { ResultNotation } from './engine.js';
6
+ import { CalculatorRatesSource, CalculatorVariant } from './types.js';
7
+ import { PosModel } from './use-calculator-pos.js';
8
+ import { ProgrammerAction } from './variants/programmer/programmer-reduce.js';
9
+ import { VariantDefinition } from './variants/registry.js';
10
+ export type CalculatorContextValue = {
11
+ state: CalculatorState;
12
+ variant: CalculatorVariant;
13
+ definition: VariantDefinition;
14
+ variants: readonly CalculatorVariant[];
15
+ locale: string | undefined;
16
+ /** What the conversion variant needs: the rates and how to round. */
17
+ conversion: {
18
+ readonly currencyRates: CalculatorRatesSource | undefined;
19
+ readonly precision: number | undefined;
20
+ readonly rounding: RoundingMode | undefined;
21
+ };
22
+ /** ISO 4217 code of the amounts of the variants that show money. */
23
+ currency: string | undefined;
24
+ display: DisplayModel;
25
+ hasMemory: boolean;
26
+ press: (key: CalcKey) => void;
27
+ setVariant: (variant: CalculatorVariant) => void;
28
+ /** Scientific chrome. */
29
+ setAngle: (angle: AngleMode) => void;
30
+ setNotation: (notation: ResultNotation) => void;
31
+ toggleSecond: (on?: boolean) => void;
32
+ /** Programmer chrome: the base, the word, a bit. */
33
+ setProgrammer: (action: ProgrammerAction) => void;
34
+ replay: (entry: HistoryEntry) => void;
35
+ reuse: (entry: HistoryEntry) => void;
36
+ clearTape: () => void;
37
+ toggleTape: () => void;
38
+ copy: () => void;
39
+ paste: () => void;
40
+ /** A keyboard paste: the text of the paste event. */
41
+ pasteText: (text: string) => void;
42
+ /** The point-of-sale panel: its options, its ticket's view and its actions. */
43
+ pos: PosModel;
44
+ /** The history toggle and the tape: focus goes to the tape on open. */
45
+ toggleRef: RefObject<HTMLButtonElement | null>;
46
+ tapeRef: RefObject<HTMLDivElement | null>;
47
+ };
48
+ export declare const CalculatorProvider: import('react').Provider<CalculatorContextValue | null>;
49
+ export declare function useCalculatorContext(): CalculatorContextValue;
@@ -0,0 +1,18 @@
1
+ import { CalculatorFeedback } from './types.js';
2
+ /** The browser pieces feedback uses; tests pass stubs. */
3
+ export type FeedbackEnv = {
4
+ vibrate?: (ms: number) => boolean;
5
+ reducedMotion: () => boolean;
6
+ audio?: () => {
7
+ tick: () => void;
8
+ } | undefined;
9
+ };
10
+ export declare const HAPTIC_MS = 8;
11
+ /** Fires the enabled kinds for one key press. Never throws; off by default. */
12
+ export declare function fireFeedback(feedback: CalculatorFeedback | undefined, env: FeedbackEnv): void;
13
+ /** A tick made on demand by one shared oscillator-per-press, created on the first one. */
14
+ export declare function createTick(): () => {
15
+ tick: () => void;
16
+ } | undefined;
17
+ /** The real browser's pieces. */
18
+ export declare function browserFeedbackEnv(audio: FeedbackEnv['audio']): FeedbackEnv;
@@ -0,0 +1,30 @@
1
+ import { CalcKey, KeyAction, KeyEventLike } from '@nxgt/material-core/calculator';
2
+ /** The slice of an event target the rules read; a DOM `Element` fits. */
3
+ export type KeyTargetLike = {
4
+ readonly tagName?: string;
5
+ readonly isContentEditable?: boolean;
6
+ closest?: (selector: string) => unknown;
7
+ };
8
+ export type CalculatorKeyEvent = KeyEventLike & {
9
+ readonly target?: KeyTargetLike | EventTarget | null;
10
+ readonly defaultPrevented?: boolean;
11
+ readonly repeat?: boolean;
12
+ };
13
+ export type KeyboardContext = {
14
+ readonly locale?: string;
15
+ /** Whether the variant takes a key; others are left to the page. */
16
+ readonly accepts: (key: CalcKey) => boolean;
17
+ /** The window listener: leaves fields alone and events already handled. */
18
+ readonly global?: boolean;
19
+ /** The Programmer variant: `a` to `f` are digits. */
20
+ readonly programmer?: boolean;
21
+ /** True when the user has text selected: a copy is then the browser's. */
22
+ readonly hasSelection?: () => boolean;
23
+ };
24
+ export declare function isEditableTarget(target: KeyTargetLike | null | undefined): boolean;
25
+ /**
26
+ * The action a key event stands for in this calculator, or `null` to leave it
27
+ * to the browser. Enter on a focused button is that button's click, never
28
+ * `=`, so a keyboard user is not made to calculate by activating a key.
29
+ */
30
+ export declare function actionForKeyEvent(ev: CalculatorKeyEvent, ctx: KeyboardContext): KeyAction | null;
@@ -0,0 +1,17 @@
1
+ import { HistoryEntry } from '@nxgt/material-core/calculator';
2
+ /** The part of `Storage` the calculator uses; tests pass a map. */
3
+ export type CalculatorStorage = Pick<Storage, 'getItem' | 'setItem'>;
4
+ export type StoredCalculator = {
5
+ history: HistoryEntry[];
6
+ memory: string;
7
+ };
8
+ /** `localStorage`, or `undefined` where it is missing or blocked. */
9
+ export declare function browserStorage(): CalculatorStorage | undefined;
10
+ /** The slot name from the `persist` prop; `undefined` when persistence is off. */
11
+ export declare function storageSlot(persist: boolean | {
12
+ key: string;
13
+ } | undefined): string | undefined;
14
+ /** What the slot holds; anything unreadable gives an empty tape and memory `0`. Never throws. */
15
+ export declare function readStored(storage: CalculatorStorage | undefined, slot: string): StoredCalculator;
16
+ /** Writes the slot; a full or blocked storage is ignored. */
17
+ export declare function writeStored(storage: CalculatorStorage | undefined, slot: string, value: StoredCalculator): void;
@@ -0,0 +1,16 @@
1
+ import { CalculatorState } from './calculator.slice.js';
2
+ import { PosFormat } from './variants/pos/pos-announce.js';
3
+ import { PosAction, PosEnv } from './variants/pos/pos-types.js';
4
+ import { ProgrammerAction } from './variants/programmer/programmer-reduce.js';
5
+ /**
6
+ * One point-of-sale action on the state: the ticket's maths come with the
7
+ * point-of-sale chunk, and its actions only come from that variant's panels,
8
+ * so it is loaded by then (nothing happens otherwise).
9
+ */
10
+ export declare function stepPos(state: CalculatorState, p: {
11
+ action: PosAction;
12
+ env: PosEnv;
13
+ format: PosFormat;
14
+ }): void;
15
+ /** One Programmer action on the state, once the Programmer chunk is loaded. */
16
+ export declare function stepProgrammer(state: CalculatorState, action: ProgrammerAction): void;
@@ -0,0 +1,11 @@
1
+ import { CalculatorProps } from './types.js';
2
+ /**
3
+ * A calculator with exact decimal arithmetic and the usual precedence
4
+ * (`2 + 3 × 4` is 14): a display with the expression above the result, a
5
+ * keypad, a tape of past results, a memory, the physical keyboard, copy and
6
+ * paste, and a variant switcher. The engine is `@nxgt/material-core/calculator`;
7
+ * nothing is evaluated as code.
8
+ *
9
+ * Own entry, `@nxgt/material/calculator`: not exported from `./components`.
10
+ */
11
+ export declare function Calculator({ className, 'aria-label': ariaLabel, ...props }: CalculatorProps): import("react").JSX.Element;
@@ -0,0 +1,23 @@
1
+ import { CalcErrorCode } from '@nxgt/material-core/calculator';
2
+ import { CalculatorState } from './calculator.slice.js';
3
+ import { EngineSettings } from './engine.js';
4
+ export type DisplayModel = {
5
+ /** The expression, shown in the locale. */
6
+ expression: string;
7
+ /** The big line: the result, a live preview, or `0`. */
8
+ result: string;
9
+ kind: 'empty' | 'preview' | 'result' | 'error';
10
+ /** The exact value to copy (canonical text), or `''`. */
11
+ value: string;
12
+ error: CalcErrorCode | '';
13
+ };
14
+ /** The expression without the operator the user is about to follow with a number. */
15
+ export declare const withoutTrailingOperator: (expression: string) => string;
16
+ export declare function selectDisplay(state: CalculatorState, settings: EngineSettings): DisplayModel;
17
+ export declare const selectHasMemory: (state: CalculatorState) => boolean;
18
+ export declare const selectCanClearTape: (state: CalculatorState) => boolean;
19
+ export declare const calculatorSelectors: {
20
+ selectDisplay: typeof selectDisplay;
21
+ selectHasMemory: (state: CalculatorState) => boolean;
22
+ selectCanClearTape: (state: CalculatorState) => boolean;
23
+ };