@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.
- package/CHANGELOG.md +40 -0
- package/README.md +37 -1
- package/dist/{alert-dialog-BfO_ri-N.js → alert-dialog-653apk3f.js} +8 -7
- package/dist/{async-slice-roMAJVzG.js → async-slice-CXLbQuOc.js} +1 -1
- package/dist/{bubble-input-B7BVd9fX.js → bubble-input-CQwVSoU3.js} +30 -29
- package/dist/{button-DgenqmpS.js → button-3op3rtZh.js} +5 -4
- package/dist/calculator-BaSMe0SK.js +1189 -0
- package/dist/calculator-announce-DRd2c6Dq.js +89 -0
- package/dist/calculator-context-BugcKuVG.js +10 -0
- package/dist/calculator-field.js +172 -0
- package/dist/calculator-panel-announce-AZSnZUSr.js +29 -0
- package/dist/calculator-segment-BlJE1LaS.js +22 -0
- package/dist/calculator.js +2 -0
- package/dist/charts.js +3 -3
- package/dist/{chip-CiDczNxO.js → chip-MuKDwtkG.js} +2 -2
- package/dist/{code-editor-CohlhFsA.js → code-editor-Bp2RrdNx.js} +13 -13
- package/dist/code-editor.js +37 -37
- package/dist/{code-language-items-Cs8GLYDp.js → code-language-items-B7WR5ua_.js} +19 -24
- package/dist/components/base-content.css +9 -4
- package/dist/components/ui/collections/server-table/server-table-phone-row.css +10 -3
- package/dist/{components-zJdfH4im.js → components-Ci3Zo8kC.js} +15837 -17245
- package/dist/components.js +37 -28
- package/dist/conversion-variant-BDFAxqe9.js +529 -0
- package/dist/copy-to-clipboard-Be5Ffvs_.js +7 -0
- package/dist/currency-B-r3ig11.js +16 -0
- package/dist/currency-field-BJ9rSrif.js +285 -0
- package/dist/{number.utils-BG_eEt5g.js → date.utils-DUvqcjan.js} +1 -7
- package/dist/dialog-Bm5LvVlB.js +166 -0
- package/dist/dist-BZe2evxL.js +139 -0
- package/dist/dist-CxhKjOYm.js +28 -0
- package/dist/dist-DHdUUM1w.js +241 -0
- package/dist/{dist-C4wtXCjf.js → dist-DOK3zo5C.js} +33 -32
- package/dist/dist-DWZXlCZR.js +182 -0
- package/dist/dist-DkQbkF9T.js +33 -0
- package/dist/dnd.js +1 -1
- package/dist/{dropdown-menu-CzR6JP31.js → dropdown-menu-xlZ6NYUA.js} +160 -159
- package/dist/editor.js +299 -298
- package/dist/{empty-state-DjHGMp5F.js → empty-state-C0kviQdW.js} +2 -2
- package/dist/{field-blur-CdASxjL7.js → field-blur-DkiZOVNV.js} +178 -180
- package/dist/{field-blur-context-kZ4SD7xu.js → field-blur-context-BLGgf_3z.js} +2 -2
- package/dist/financial-variant-BsZEa5sF.js +459 -0
- package/dist/{hooks-Dqq8O3Az.js → hooks-Dg94jPRq.js} +12 -12
- package/dist/hooks.js +2 -2
- package/dist/{hover-card-BPKqte4a.js → hover-card-B1g55Hi6.js} +44 -43
- package/dist/i18n.js +3 -3
- package/dist/icon-badge-BcW66bRk.js +17 -0
- package/dist/{icon-button-Cr-DyDGg.js → icon-button-Cogxy1cy.js} +5 -4
- package/dist/{in-dialog-Vwkyp-M5.js → in-dialog-D61Yeaol.js} +2 -1
- package/dist/input-CC2joTjB.js +56 -0
- package/dist/key-layout-cR79xfGE.js +38 -0
- package/dist/lib/calculator/index.d.ts +16 -0
- package/dist/lib/calculator-field/index.d.ts +12 -0
- package/dist/lib/components/ui/collections/filter/use-filter-field-config.d.ts +2 -2
- package/dist/lib/components/ui/feedback/moment/moment-body.d.ts +17 -2
- package/dist/lib/components/ui/feedback/moment/moment-passive.d.ts +13 -0
- package/dist/lib/components/ui/feedback/moment/moment.d.ts +16 -2
- package/dist/lib/components/ui/fields/calculator-field/apply-calculated.d.ts +17 -0
- package/dist/lib/components/ui/fields/calculator-field/calculator-field-content.d.ts +16 -0
- package/dist/lib/components/ui/fields/calculator-field/calculator-field-trigger.d.ts +4 -0
- package/dist/lib/components/ui/fields/calculator-field/calculator-field.d.ts +12 -0
- package/dist/lib/components/ui/fields/calculator-field/calculator-field.types.d.ts +31 -0
- package/dist/lib/components/ui/fields/calculator-field/calculator-form-field.d.ts +4 -0
- package/dist/lib/components/ui/fields/calculator-field/index.d.ts +3 -0
- package/dist/lib/components/ui/fields/calculator-field/use-calculator-field.d.ts +15 -0
- package/dist/lib/components/ui/fields/contacts/placeholders.d.ts +1 -1
- package/dist/lib/components/ui/fields/currency-field/currency-field.d.ts +7 -1
- package/dist/lib/components/ui/layout/app-shell/app-sidebar-context.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/calculator-announce.d.ts +27 -0
- package/dist/lib/components/ui/widgets/calculator/calculator-clipboard.d.ts +19 -0
- package/dist/lib/components/ui/widgets/calculator/calculator-context.d.ts +49 -0
- package/dist/lib/components/ui/widgets/calculator/calculator-feedback.d.ts +18 -0
- package/dist/lib/components/ui/widgets/calculator/calculator-keyboard.d.ts +30 -0
- package/dist/lib/components/ui/widgets/calculator/calculator-storage.d.ts +17 -0
- package/dist/lib/components/ui/widgets/calculator/calculator-variant-steps.d.ts +16 -0
- package/dist/lib/components/ui/widgets/calculator/calculator.d.ts +11 -0
- package/dist/lib/components/ui/widgets/calculator/calculator.selectors.d.ts +23 -0
- package/dist/lib/components/ui/widgets/calculator/calculator.slice.d.ts +1881 -0
- package/dist/lib/components/ui/widgets/calculator/currency.d.ts +9 -0
- package/dist/lib/components/ui/widgets/calculator/engine.d.ts +22 -0
- package/dist/lib/components/ui/widgets/calculator/index.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-announcer.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-display.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-key.d.ts +17 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-keypad.d.ts +8 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-loading.d.ts +6 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-memory.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-panel-announce.d.ts +10 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-panel-body.d.ts +9 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-screen.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-segment.d.ts +21 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-shell.d.ts +9 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-switcher.d.ts +5 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-tape.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-tools.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/partials/keypad-navigation.d.ts +24 -0
- package/dist/lib/components/ui/widgets/calculator/types.d.ts +102 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-clipboard.d.ts +19 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-conversion.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-feedback.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-keyboard.d.ts +22 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-persistence.d.ts +14 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-pos.d.ts +25 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-press.d.ts +26 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-tape.d.ts +29 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-value.d.ts +9 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-variant.d.ts +23 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator.d.ts +10 -0
- package/dist/lib/components/ui/widgets/calculator/use-engine-settings.d.ts +10 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-fields.d.ts +19 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-labels.d.ts +17 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-math.d.ts +31 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-names.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-panel.d.ts +7 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-rates.d.ts +29 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-result.d.ts +15 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-state.d.ts +36 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-variant.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/use-conversion.d.ts +24 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-change.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-figures.d.ts +43 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-format.d.ts +12 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-loan-math.d.ts +14 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-loan.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-margin.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-math.d.ts +10 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-panel.d.ts +7 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-parts.d.ts +35 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-table.d.ts +7 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-variant.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-vat.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/variants/key-layout.d.ts +51 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-announce.d.ts +16 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-aside.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-display.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-fields.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-layout.d.ts +9 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-line.d.ts +6 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-names.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-state.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-tender.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-ticket-data.d.ts +41 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-ticket.d.ts +5 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-totals.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-types.d.ts +76 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-variant.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-vat.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-view.d.ts +28 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-announce.d.ts +19 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-base.d.ts +11 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-bitpad.d.ts +14 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-display.d.ts +9 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-layout.d.ts +6 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-names.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-readouts.d.ts +14 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-reduce.d.ts +29 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-state.d.ts +22 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-toolbar.d.ts +5 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-variant.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-word.d.ts +15 -0
- package/dist/lib/components/ui/widgets/calculator/variants/registry.d.ts +21 -0
- package/dist/lib/components/ui/widgets/calculator/variants/scientific/scientific-layout.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/variants/scientific/scientific-names.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/scientific/scientific-toolbar.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/scientific/scientific-variant.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/variants/standard/standard-layout.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/variants/variant-loader.d.ts +34 -0
- package/dist/lib/components/ui/widgets/calculator/variants/variant-logic.d.ts +40 -0
- package/dist/lib/components/ui/widgets/calculator/variants/variant-types.d.ts +62 -0
- package/dist/lib/i18n/resources/en/en.d.ts +412 -0
- package/dist/lib/i18n/resources/en/material.json.d.ts +412 -0
- package/dist/lib/i18n/resources/fr/fr.d.ts +412 -0
- package/dist/lib/i18n/resources/fr/material.json.d.ts +412 -0
- package/dist/lib/i18n/resources/resources.d.ts +824 -0
- package/dist/lib/i18n/translator.d.ts +1 -1
- package/dist/lib.js +4 -3
- package/dist/main.js +50 -40
- package/dist/map.js +66 -65
- package/dist/material.css +1 -1
- package/dist/native-select-w_FlBLHV.js +40 -0
- package/dist/number.utils-CSueQZcv.js +7 -0
- package/dist/pdf-reader.js +1 -1
- package/dist/percent-field-lahyDJDG.js +14 -0
- package/dist/picker-surface-CV09H7Nb.js +1220 -0
- package/dist/popover-Cd7DkND4.js +233 -0
- package/dist/pos-types-DKCkOTYy.js +49 -0
- package/dist/pos-variant-GrUfbTTP.js +603 -0
- package/dist/print.js +1 -1
- package/dist/programmer-variant-eKJNKENL.js +501 -0
- package/dist/programmer-word-CNCF7DJF.js +15 -0
- package/dist/{public-DC9VQw4Z.js → public-y6g4ddxd.js} +895 -892
- package/dist/{rich-code-block-DBSL9zEN.js → rich-code-block-CRQ0iyLb.js} +5 -5
- package/dist/scientific-variant-2y3UxAAU.js +149 -0
- package/dist/{sortable-provider-C4tk5esY.js → sortable-provider-DdiI3Fwk.js} +2 -2
- package/dist/{spinner-B2MubVWb.js → spinner-C1QIewWv.js} +133 -159
- package/dist/standard-layout-BuSRr3TY.js +40 -0
- package/dist/tabs-DzEqMb1W.js +383 -0
- package/dist/{icon-badge-B9uvDoyY.js → text-field-BAdY-kpO.js} +20 -34
- package/dist/theme-picker.js +3 -3
- package/dist/{theme-toggle-BInlu21G.js → theme-toggle-C_VeiiCm.js} +2 -2
- package/dist/toggle-FeCCJqbg.js +40 -0
- package/dist/{toggle-group-DXXlqid2.js → toggle-group-CVMxEpWi.js} +1 -1
- package/dist/{toolbar-items-CRJSx1MU.js → toolbar-items-D310xDuM.js} +333 -554
- package/dist/{translate-material-pVlPJ1v4.js → translate-material-BypJJ1l5.js} +1 -1
- package/dist/{translator-BoYCward.js → translator-DJkf4J7t.js} +824 -0
- package/dist/{typography-B6YMbCge.js → typography-CYEquVeb.js} +1 -1
- package/dist/{use-chat-composer-BvWQogJe.js → use-chat-composer-DMXu9E1O.js} +4198 -4600
- package/dist/{use-heading-spy-B_Z4ArDh.js → use-heading-spy-DJR8YYm6.js} +19 -19
- package/dist/{use-material-translation-CIS2n3RB.js → use-material-translation-CD6QoVal.js} +1 -1
- package/dist/{use-return-focus-DNQtADAR.js → use-return-focus-Cevw_6yq.js} +106 -105
- package/dist/useLatest-C2PnQEeD.js +8 -0
- package/docs/README.md +1 -0
- package/docs/components/feedback-and-status.md +10 -1
- package/docs/components/form-fields.md +1 -0
- package/docs/components/rich-widgets.md +108 -0
- package/docs/getting-started.md +1 -0
- package/docs/guides/calculator.md +468 -0
- package/docs/guides/forms.md +4 -2
- package/docs/guides/i18n.md +5 -0
- package/docs/previews/rich-widgets-calculator-conversion.webp +0 -0
- package/docs/previews/rich-widgets-calculator-point-of-sale.webp +0 -0
- package/docs/previews/rich-widgets-calculator.webp +0 -0
- package/docs/roadmap.md +9 -3
- package/docs/troubleshooting.md +134 -0
- package/lib/components/base-content.css +9 -4
- package/lib/components/ui/collections/server-table/server-table-phone-row.css +10 -3
- package/lib/components/ui/widgets/calculator/calculator-bands.css +146 -0
- package/lib/components/ui/widgets/calculator/calculator-display.css +83 -0
- package/lib/components/ui/widgets/calculator/calculator-keys.css +118 -0
- package/lib/components/ui/widgets/calculator/calculator-pos-ticket.css +185 -0
- package/lib/components/ui/widgets/calculator/calculator-pos.css +38 -0
- package/lib/components/ui/widgets/calculator/calculator-tape.css +71 -0
- package/lib/components/ui/widgets/calculator/calculator.css +97 -0
- package/lib/components/ui/widgets/calculator/variants/conversion/conversion.css +98 -0
- package/lib/components/ui/widgets/calculator/variants/financial/financial.css +162 -0
- package/lib/components/ui/widgets/calculator/variants/programmer/programmer.css +162 -0
- package/package.json +17 -3
- package/dist/dialog-AGsB3bv4.js +0 -219
- package/dist/dist-B7RjY7SL.js +0 -158
- package/dist/dist-lmHmz_bu.js +0 -419
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ConversionOutcome } from './conversion-math.js';
|
|
2
|
+
import { RatesState } from './conversion-rates.js';
|
|
3
|
+
/** The quote date in the locale; a date-only text is read as UTC so the day never moves. */
|
|
4
|
+
export declare function formatAsOf(asOf: string, locale?: string): string;
|
|
5
|
+
/** How the rates stand: loading, failed (with a retry), or the date they were quoted. */
|
|
6
|
+
export declare function RatesStatus({ rates, locale, retry, }: {
|
|
7
|
+
rates: RatesState;
|
|
8
|
+
locale?: string;
|
|
9
|
+
retry?: () => void;
|
|
10
|
+
}): import("react").JSX.Element | null;
|
|
11
|
+
/** The answer, large; its symbol beside it; the engine's message when it failed. */
|
|
12
|
+
export declare function ConversionResult({ outcome, symbol, }: {
|
|
13
|
+
outcome: ConversionOutcome;
|
|
14
|
+
symbol: string;
|
|
15
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** What the panel remembers: the category, the units chosen and the value typed. */
|
|
2
|
+
export type ConversionState = {
|
|
3
|
+
readonly category: string;
|
|
4
|
+
/** `''` until chosen: the category's default unit is shown. */
|
|
5
|
+
readonly from: string;
|
|
6
|
+
readonly to: string;
|
|
7
|
+
readonly text: string;
|
|
8
|
+
};
|
|
9
|
+
export type ConversionAction = {
|
|
10
|
+
type: 'category';
|
|
11
|
+
id: string;
|
|
12
|
+
} | {
|
|
13
|
+
type: 'from';
|
|
14
|
+
id: string;
|
|
15
|
+
units: readonly string[];
|
|
16
|
+
} | {
|
|
17
|
+
type: 'to';
|
|
18
|
+
id: string;
|
|
19
|
+
units: readonly string[];
|
|
20
|
+
} | {
|
|
21
|
+
type: 'swap';
|
|
22
|
+
from: string;
|
|
23
|
+
to: string;
|
|
24
|
+
} | {
|
|
25
|
+
type: 'text';
|
|
26
|
+
text: string;
|
|
27
|
+
};
|
|
28
|
+
export declare const INITIAL_CONVERSION: ConversionState;
|
|
29
|
+
/** The unit ids of a category: the table's, or `currencies` for the currency. */
|
|
30
|
+
export declare function categoryUnits(category: string, currencies: readonly string[]): readonly string[];
|
|
31
|
+
/**
|
|
32
|
+
* The units to show: the chosen ones while they belong to the category, else
|
|
33
|
+
* its defaults, and never the same unit twice.
|
|
34
|
+
*/
|
|
35
|
+
export declare function pickPair(state: Pick<ConversionState, 'category' | 'from' | 'to'>, units: readonly string[]): readonly [string, string];
|
|
36
|
+
export declare function conversionReducer(state: ConversionState, action: ConversionAction): ConversionState;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** The panel's state and what it shows: the units, the outcome, what is said. */
|
|
2
|
+
export declare function useConversion(): {
|
|
3
|
+
state: import('./conversion-state.js').ConversionState;
|
|
4
|
+
dispatch: import('react').ActionDispatch<[action: import('./conversion-state.js').ConversionAction]>;
|
|
5
|
+
category: string;
|
|
6
|
+
rates: import('./conversion-rates.js').RatesState;
|
|
7
|
+
retry: (() => void) | undefined;
|
|
8
|
+
locale: string | undefined;
|
|
9
|
+
units: readonly string[];
|
|
10
|
+
from: string;
|
|
11
|
+
to: string;
|
|
12
|
+
options: {
|
|
13
|
+
id: string;
|
|
14
|
+
label: string;
|
|
15
|
+
}[];
|
|
16
|
+
categories: {
|
|
17
|
+
id: string;
|
|
18
|
+
label: string;
|
|
19
|
+
}[];
|
|
20
|
+
waiting: boolean;
|
|
21
|
+
outcome: import('./conversion-math.js').ConversionOutcome;
|
|
22
|
+
toLabel: import('./conversion-labels.js').UnitLabel;
|
|
23
|
+
said: string | null;
|
|
24
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { CalcErrorCode, Decimal } from '@nxgt/material-core/calculator';
|
|
2
|
+
import { CalculatorMessage } from '../../types.js';
|
|
3
|
+
/** How a figure is written: an amount in the currency, a percent, or a plain number. */
|
|
4
|
+
export type FigureUnit = 'money' | 'percent' | 'number';
|
|
5
|
+
export type Figure = {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly label: CalculatorMessage;
|
|
8
|
+
readonly value: Decimal;
|
|
9
|
+
readonly unit: FigureUnit;
|
|
10
|
+
/** The answer the live region reads, bold on screen. */
|
|
11
|
+
readonly main?: boolean;
|
|
12
|
+
};
|
|
13
|
+
/** What a calculation gives: figures, an engine error, or `null` while the fields are not filled. */
|
|
14
|
+
export type Outcome = {
|
|
15
|
+
readonly figures: readonly Figure[];
|
|
16
|
+
} | {
|
|
17
|
+
readonly error: CalcErrorCode;
|
|
18
|
+
} | null;
|
|
19
|
+
/** A field's value: a number, or `null` while it is empty. */
|
|
20
|
+
export type Input = number | null;
|
|
21
|
+
declare const KEYS: {
|
|
22
|
+
readonly net: "material.calculator.financial.figure.net";
|
|
23
|
+
readonly vat: "material.calculator.financial.figure.vat";
|
|
24
|
+
readonly gross: "material.calculator.financial.figure.gross";
|
|
25
|
+
readonly margin: "material.calculator.financial.figure.margin";
|
|
26
|
+
readonly markup: "material.calculator.financial.figure.markup";
|
|
27
|
+
readonly profit: "material.calculator.financial.figure.profit";
|
|
28
|
+
readonly price: "material.calculator.financial.figure.price";
|
|
29
|
+
readonly cost: "material.calculator.financial.figure.cost";
|
|
30
|
+
readonly change: "material.calculator.financial.figure.change";
|
|
31
|
+
readonly difference: "material.calculator.financial.figure.difference";
|
|
32
|
+
readonly payment: "material.calculator.financial.figure.payment";
|
|
33
|
+
readonly interest: "material.calculator.financial.figure.interest";
|
|
34
|
+
readonly total: "material.calculator.financial.figure.total";
|
|
35
|
+
readonly 'last-payment': "material.calculator.financial.figure.last-payment";
|
|
36
|
+
};
|
|
37
|
+
export declare const fig: (id: keyof typeof KEYS, fallback: string, value: Decimal, unit: FigureUnit, main?: boolean) => Figure;
|
|
38
|
+
/** Runs `build` when every input is filled; an engine error becomes its code. */
|
|
39
|
+
export declare function outcome(inputs: readonly Input[], build: (n: readonly string[]) => readonly Figure[]): Outcome;
|
|
40
|
+
export type MoneyDigits = {
|
|
41
|
+
readonly fractionDigits: number;
|
|
42
|
+
};
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Decimal } from '@nxgt/material-core/calculator';
|
|
2
|
+
import { Figure } from './financial-figures.js';
|
|
3
|
+
export type FigureFormat = {
|
|
4
|
+
readonly locale?: string;
|
|
5
|
+
/** ISO 4217 code written after amounts; none writes none. */
|
|
6
|
+
readonly currency?: string;
|
|
7
|
+
readonly fractionDigits: number;
|
|
8
|
+
};
|
|
9
|
+
/** A percent in `locale`: `33.33 %`, without float arithmetic. */
|
|
10
|
+
export declare const formatPercent: (d: Decimal, locale?: string) => string;
|
|
11
|
+
/** A figure as text, by its unit. */
|
|
12
|
+
export declare const formatFigure: (figure: Figure, f: FigureFormat) => string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { amortisation } from '@nxgt/material-core/calculator/financial';
|
|
2
|
+
import { Input, MoneyDigits, Outcome } from './financial-figures.js';
|
|
3
|
+
/** The most rows of the amortisation table shown. */
|
|
4
|
+
export declare const TABLE_ROWS = 12;
|
|
5
|
+
export type LoanResult = {
|
|
6
|
+
readonly rows: ReturnType<typeof amortisation>['rows'];
|
|
7
|
+
readonly periods: number;
|
|
8
|
+
readonly truncated: boolean;
|
|
9
|
+
};
|
|
10
|
+
/** The payment of a loan, its totals and the first rows of its schedule. */
|
|
11
|
+
export declare function loanOutcome(principal: Input, rate: Input, periods: Input, o: MoneyDigits): {
|
|
12
|
+
outcome: Outcome;
|
|
13
|
+
loan: LoanResult | null;
|
|
14
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Input, MoneyDigits, Outcome } from './financial-figures.js';
|
|
2
|
+
export type VatMode = 'add' | 'remove';
|
|
3
|
+
/** The VAT of a price: added on a net price, or taken out of a gross one. */
|
|
4
|
+
export declare const vatOutcome: (mode: VatMode, amount: Input, rate: Input, o: MoneyDigits) => Outcome;
|
|
5
|
+
export type MarginMode = 'rates' | 'price' | 'cost';
|
|
6
|
+
export type MarginBasis = 'margin' | 'markup';
|
|
7
|
+
/** Rates of a cost and a price; the price of a cost and a rate; or the cost. */
|
|
8
|
+
export declare const marginOutcome: (mode: MarginMode, basis: MarginBasis, first: Input, second: Input, o: MoneyDigits) => Outcome;
|
|
9
|
+
/** The change from one figure to another, in percent and as a difference. */
|
|
10
|
+
export declare const changeOutcome: (from: Input, to: Input) => Outcome;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Financial variant's body, in place of the display and the keypad: four
|
|
3
|
+
* calculations in sub-tabs (VAT, margin and markup, percent change, loan with
|
|
4
|
+
* its schedule). Plain local state; every tab stays mounted so what was typed
|
|
5
|
+
* is still there when it is opened again.
|
|
6
|
+
*/
|
|
7
|
+
export declare function FinancialPanel(): import("react").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Input, Outcome } from './financial-figures.js';
|
|
2
|
+
import { FigureFormat } from './financial-format.js';
|
|
3
|
+
/** Currency, minor-unit digits and locale of the panel, from the calculator. */
|
|
4
|
+
export declare function useFigureFormat(): FigureFormat;
|
|
5
|
+
type FieldProps = {
|
|
6
|
+
label: string;
|
|
7
|
+
value: Input;
|
|
8
|
+
onChange: (value: Input) => void;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* An amount: the library's CurrencyField in the calculator's currency, or a
|
|
12
|
+
* plain NumberField when none is set (no code to show).
|
|
13
|
+
*/
|
|
14
|
+
export declare function AmountField({ label, value, onChange }: FieldProps): import("react").JSX.Element;
|
|
15
|
+
/** A percent (0 to `max`): the library's PercentField. */
|
|
16
|
+
export declare function RateField({ max, ...props }: FieldProps & {
|
|
17
|
+
max?: number;
|
|
18
|
+
}): import("react").JSX.Element;
|
|
19
|
+
/** A plain number (a count, a figure to compare): NumberField without steppers. */
|
|
20
|
+
export declare function CountField({ min, max, ...props }: FieldProps & {
|
|
21
|
+
min?: number;
|
|
22
|
+
max?: number;
|
|
23
|
+
}): import("react").JSX.Element;
|
|
24
|
+
/** The figures of an outcome, or its error, or the hint while it is empty. */
|
|
25
|
+
export declare function Results({ outcome, active, }: {
|
|
26
|
+
outcome: Outcome;
|
|
27
|
+
active: boolean;
|
|
28
|
+
}): import("react").JSX.Element;
|
|
29
|
+
/** A choice of a `Segment`: the text is both what is drawn and its name. */
|
|
30
|
+
export declare const choice: <T extends string>(id: T, text: string) => {
|
|
31
|
+
id: T;
|
|
32
|
+
glyph: string;
|
|
33
|
+
name: string;
|
|
34
|
+
};
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FigureFormat } from './financial-format.js';
|
|
2
|
+
import { LoanResult } from './financial-loan-math.js';
|
|
3
|
+
/** The first payments of a loan: a real table, captioned, one row per payment. */
|
|
4
|
+
export declare function AmortisationTable({ loan, format, }: {
|
|
5
|
+
loan: LoanResult;
|
|
6
|
+
format: FigureFormat;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { CalcKey } from '@nxgt/material-core/calculator';
|
|
2
|
+
import { CalculatorMessage } from '../types.js';
|
|
3
|
+
import { POS_NAMES } from './pos/pos-names.js';
|
|
4
|
+
import { PROGRAMMER_NAMES } from './programmer/programmer-names.js';
|
|
5
|
+
import { SCIENTIFIC_NAMES } from './scientific/scientific-names.js';
|
|
6
|
+
/** What a key looks like: its shape and colour follow the role. */
|
|
7
|
+
export type KeyRole = 'digit' | 'operator' | 'equals' | 'utility' | 'function' | 'memory'
|
|
8
|
+
/** ( and ): small keys like the memory ones. */
|
|
9
|
+
| 'bracket';
|
|
10
|
+
export type KeyDef = {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
/** The engine key it presses. */
|
|
13
|
+
readonly key: CalcKey;
|
|
14
|
+
/** What is drawn; `aria-hidden`, the spoken name is `name`. */
|
|
15
|
+
readonly glyph: string;
|
|
16
|
+
readonly role: KeyRole;
|
|
17
|
+
/** The spoken name, the button's `aria-label`. */
|
|
18
|
+
readonly name: CalculatorMessage;
|
|
19
|
+
/** Grid units spanned, 1 by default. */
|
|
20
|
+
readonly span?: number;
|
|
21
|
+
/** What the key is on the second page (2nd): same place, another key. */
|
|
22
|
+
readonly alt?: KeyAlt;
|
|
23
|
+
/** Keys pressed one after the other, instead of `key` (`EE` is `* 10 ^`). */
|
|
24
|
+
readonly sequence?: readonly CalcKey[];
|
|
25
|
+
};
|
|
26
|
+
/** A key's second-page face: it keeps the button, so focus stays put. */
|
|
27
|
+
export type KeyAlt = Pick<KeyDef, 'key' | 'glyph' | 'name'>;
|
|
28
|
+
/** Keys by rows on a grid of `columns`. */
|
|
29
|
+
export type KeyLayout = {
|
|
30
|
+
readonly columns: number;
|
|
31
|
+
readonly rows: readonly (readonly KeyDef[])[];
|
|
32
|
+
/**
|
|
33
|
+
* The first `split` rows are a pane of their own (the scientific
|
|
34
|
+
* functions): above the rest on a phone, beside it from 600px.
|
|
35
|
+
*/
|
|
36
|
+
readonly split?: number;
|
|
37
|
+
};
|
|
38
|
+
/** The spoken names, as the `material.calculator.keys.*` leaves. */
|
|
39
|
+
export type KeyName = (typeof DIGIT_NAMES)[number] | 'decimal' | 'add' | 'subtract' | 'multiply' | 'divide' | 'equals' | 'clear' | 'backspace' | 'sign' | 'percent' | 'open-paren' | 'close-paren' | 'memory-clear' | 'memory-recall' | 'memory-add' | 'memory-subtract' | (typeof SCIENTIFIC_NAMES)[number] | (typeof POS_NAMES)[number] | (typeof PROGRAMMER_NAMES)[number];
|
|
40
|
+
export declare const msg: (name: KeyName, fallback: string) => CalculatorMessage;
|
|
41
|
+
export declare const key: (id: string, k: CalcKey, glyph: string, role: KeyRole, name: KeyName, fallback: string, span?: number) => KeyDef;
|
|
42
|
+
export declare const DIGIT_NAMES: readonly ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"];
|
|
43
|
+
export declare const digit: (n: number, span?: number) => KeyDef;
|
|
44
|
+
/** `( ) MC MR M+ M-`: six small keys, two grid units each (twelve units a row). */
|
|
45
|
+
export declare const MEMORY_ROW: readonly KeyDef[];
|
|
46
|
+
/** A row of four keys, three grid units each, on the twelve-unit grid. */
|
|
47
|
+
export declare const wide: (keys: readonly KeyDef[]) => readonly KeyDef[];
|
|
48
|
+
/** The key a pressed `def` stands for on page one or, with 2nd, page two. */
|
|
49
|
+
export declare const faceOf: (def: KeyDef, second: boolean) => KeyDef;
|
|
50
|
+
/** The keys a press of `def` sends to the engine, in order. */
|
|
51
|
+
export declare const keysOf: (def: KeyDef) => readonly CalcKey[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Announcement } from '../../calculator-announce.js';
|
|
2
|
+
import { PosAction, PosEnv, PosState } from './pos-types.js';
|
|
3
|
+
/** What the live region needs to word an amount. */
|
|
4
|
+
export type PosFormat = {
|
|
5
|
+
locale?: string;
|
|
6
|
+
denominations: readonly string[];
|
|
7
|
+
};
|
|
8
|
+
/** The change to give back, or what is still due: after a tender is entered. */
|
|
9
|
+
export declare function settlementMessage(s: PosState, env: PosEnv, f: PosFormat): Announcement | null;
|
|
10
|
+
export declare const totalMessage: (s: PosState, env: PosEnv, f: PosFormat) => Announcement;
|
|
11
|
+
/**
|
|
12
|
+
* The live region after `action`: the total when the ticket changed, the
|
|
13
|
+
* change or the amount still due when a tender is entered. Typing digits is
|
|
14
|
+
* never announced.
|
|
15
|
+
*/
|
|
16
|
+
export declare function announcePos(prev: PosState, next: PosState, action: PosAction, env: PosEnv, f: PosFormat): Announcement | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { KeyLayout } from '../key-layout.js';
|
|
2
|
+
/**
|
|
3
|
+
* A till's keys on twelve units: digits, `00`, a quantity key (`×`),
|
|
4
|
+
* a discount key (`%`) and `+` to add the amount to the ticket. The keys are
|
|
5
|
+
* the engine's, the point-of-sale panel decides what each one does.
|
|
6
|
+
*/
|
|
7
|
+
export declare const POS_LAYOUT: KeyLayout;
|
|
8
|
+
/** The keys the physical keyboard takes: the keypad's own, nothing more. */
|
|
9
|
+
export declare const POS_EXTRA_KEYS: readonly [];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PosLine } from './pos-types.js';
|
|
2
|
+
/** One line of the ticket: its name, quantity and price, its total, and a way to remove it. */
|
|
3
|
+
export declare function PosLineRow({ line, index }: {
|
|
4
|
+
line: PosLine;
|
|
5
|
+
index: number;
|
|
6
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Totals } from '@nxgt/material-core/calculator/pos';
|
|
2
|
+
import { PosEnv, PosState } from './pos-types.js';
|
|
3
|
+
/** A discount as handed to `onCharge`: a percent or an amount, as plain text. */
|
|
4
|
+
export type PosTicketDiscount = {
|
|
5
|
+
readonly percent: string;
|
|
6
|
+
} | {
|
|
7
|
+
readonly amount: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* What `onCharge` receives: plain data, JSON-safe. Amounts are text with the
|
|
11
|
+
* currency's decimals (`'12.50'`), rates and quantities are plain numbers as
|
|
12
|
+
* text (`'5.5'`).
|
|
13
|
+
*/
|
|
14
|
+
export type PosTicket = {
|
|
15
|
+
readonly currency?: string;
|
|
16
|
+
/** True when the prices on the lines include the VAT. */
|
|
17
|
+
readonly taxInclusive: boolean;
|
|
18
|
+
readonly lines: readonly {
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly unitPrice: string;
|
|
21
|
+
readonly quantity: string;
|
|
22
|
+
/** The VAT rate in percent. */
|
|
23
|
+
readonly vatRate: string;
|
|
24
|
+
readonly discount?: PosTicketDiscount;
|
|
25
|
+
/** The line's total with the VAT, after its discounts. */
|
|
26
|
+
readonly total: string;
|
|
27
|
+
}[];
|
|
28
|
+
readonly discount?: PosTicketDiscount;
|
|
29
|
+
readonly totals: {
|
|
30
|
+
readonly subtotal: string;
|
|
31
|
+
readonly discount: string;
|
|
32
|
+
readonly vatByRate: readonly {
|
|
33
|
+
readonly rate: string;
|
|
34
|
+
readonly base: string;
|
|
35
|
+
readonly vat: string;
|
|
36
|
+
}[];
|
|
37
|
+
readonly total: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
/** The ticket to hand over for a charge, from the state and its totals. */
|
|
41
|
+
export declare function plainTicket(s: PosState, totals: Totals, env: PosEnv): PosTicket;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { CalcKey } from '@nxgt/material-core/calculator';
|
|
2
|
+
export type PosField = 'price' | 'quantity' | 'discount' | 'tender';
|
|
3
|
+
export type DiscountKind = 'percent' | 'amount';
|
|
4
|
+
/** A discount as typed: a whole percent, or an amount in minor units. */
|
|
5
|
+
export type PosDiscount = {
|
|
6
|
+
kind: DiscountKind;
|
|
7
|
+
value: string;
|
|
8
|
+
};
|
|
9
|
+
/** One line of the ticket, as strings: price in minor units. */
|
|
10
|
+
export type PosLine = {
|
|
11
|
+
id: string;
|
|
12
|
+
price: string;
|
|
13
|
+
quantity: string;
|
|
14
|
+
rate: string;
|
|
15
|
+
discount?: PosDiscount;
|
|
16
|
+
};
|
|
17
|
+
/** The point-of-sale panel's state. Strings only, never persisted. */
|
|
18
|
+
export type PosState = {
|
|
19
|
+
lines: PosLine[];
|
|
20
|
+
discount?: PosDiscount;
|
|
21
|
+
field: PosField;
|
|
22
|
+
/** What is being typed: minor units, a count, or a whole percent. */
|
|
23
|
+
price: string;
|
|
24
|
+
quantity: string;
|
|
25
|
+
/** The next digit starts a new quantity instead of extending the old one. */
|
|
26
|
+
fresh: boolean;
|
|
27
|
+
entry: string;
|
|
28
|
+
kind: DiscountKind;
|
|
29
|
+
tendered: string;
|
|
30
|
+
rate: string;
|
|
31
|
+
/** `null`: follow the `pricesIncludeVat` prop. */
|
|
32
|
+
inclusive: boolean | null;
|
|
33
|
+
next: number;
|
|
34
|
+
};
|
|
35
|
+
export declare const INITIAL_POS: PosState;
|
|
36
|
+
/** What the props tell the panel; the reducer needs no more. */
|
|
37
|
+
export type PosEnv = {
|
|
38
|
+
/** ISO 4217 code, when the application names one. */
|
|
39
|
+
currency?: string;
|
|
40
|
+
digits: number;
|
|
41
|
+
rates: readonly string[];
|
|
42
|
+
inclusive: boolean;
|
|
43
|
+
};
|
|
44
|
+
export type PosAction = {
|
|
45
|
+
type: 'key';
|
|
46
|
+
key: CalcKey;
|
|
47
|
+
} | {
|
|
48
|
+
type: 'field';
|
|
49
|
+
field: PosField;
|
|
50
|
+
} | {
|
|
51
|
+
type: 'kind';
|
|
52
|
+
kind: DiscountKind;
|
|
53
|
+
} | {
|
|
54
|
+
type: 'rate';
|
|
55
|
+
rate: string;
|
|
56
|
+
} | {
|
|
57
|
+
type: 'inclusive';
|
|
58
|
+
on: boolean;
|
|
59
|
+
} | {
|
|
60
|
+
type: 'remove';
|
|
61
|
+
id: string;
|
|
62
|
+
} | {
|
|
63
|
+
type: 'remove-discount';
|
|
64
|
+
} | {
|
|
65
|
+
type: 'tender';
|
|
66
|
+
amount: string;
|
|
67
|
+
} | {
|
|
68
|
+
type: 'reset';
|
|
69
|
+
}
|
|
70
|
+
/** The ticket was charged: the same reset, announced. */
|
|
71
|
+
| {
|
|
72
|
+
type: 'charged';
|
|
73
|
+
};
|
|
74
|
+
export declare const isInclusive: (s: PosState, env: PosEnv) => boolean;
|
|
75
|
+
/** The VAT rate a new line takes: the chosen one, else the first, else none. */
|
|
76
|
+
export declare const rateOf: (s: PosState, env: PosEnv) => string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Decimal } from '@nxgt/material-core/calculator';
|
|
2
|
+
import { Settlement, Ticket, Totals } from '@nxgt/material-core/calculator/pos';
|
|
3
|
+
import { PosTicket } from './pos-ticket-data.js';
|
|
4
|
+
import { PosEnv, PosState } from './pos-types.js';
|
|
5
|
+
export type PosView = {
|
|
6
|
+
/** What `onCharge` receives. */
|
|
7
|
+
ticket: PosTicket;
|
|
8
|
+
totals: Totals;
|
|
9
|
+
/** Set once something was tendered. */
|
|
10
|
+
settlement: Settlement | null;
|
|
11
|
+
/** The exact total, then round bills at or above it (at most four). */
|
|
12
|
+
shortcuts: readonly Decimal[];
|
|
13
|
+
/** An amount in the locale, with the currency's decimals. */
|
|
14
|
+
money: (amount: Decimal) => string;
|
|
15
|
+
/** An amount with the currency's code after it, for the live region and the Charge button. */
|
|
16
|
+
withCode: (amount: Decimal) => string;
|
|
17
|
+
/** A plain number in the locale (a VAT rate: `5,5` in French). */
|
|
18
|
+
number: (value: Decimal) => string;
|
|
19
|
+
/** The total as plain text with the currency's decimals (`'12.50'`). */
|
|
20
|
+
total: string;
|
|
21
|
+
canCharge: boolean;
|
|
22
|
+
};
|
|
23
|
+
/** The core ticket for the state: the lines and discount, validated by the engine. */
|
|
24
|
+
export declare function buildTicket(s: PosState, digits: number): Ticket;
|
|
25
|
+
/** Everything the panel shows, computed by the engine from the state. */
|
|
26
|
+
export declare function selectPos(s: PosState, env: PosEnv, denominations: readonly string[], locale?: string): PosView;
|
|
27
|
+
/** The field being typed, as it is drawn on the display. */
|
|
28
|
+
export declare function entryText(s: PosState, env: PosEnv, view: PosView): string;
|
package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-announce.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CalcSession } from '@nxgt/material-core/calculator';
|
|
2
|
+
import { Base } from '@nxgt/material-core/calculator/programmer';
|
|
3
|
+
import { Announcement } from '../../calculator-announce.js';
|
|
4
|
+
import { ProgrammerState } from './programmer-state.js';
|
|
5
|
+
/**
|
|
6
|
+
* The result announcement of a Programmer `=`, with the value in the base
|
|
7
|
+
* being typed (`FF`, not `255`); every other announcement, and the other
|
|
8
|
+
* variants', pass through.
|
|
9
|
+
*/
|
|
10
|
+
export declare function programmerResult(said: Announcement | null, next: CalcSession, p: ProgrammerState | undefined): Announcement | null;
|
|
11
|
+
declare const BASE_NAME: {
|
|
12
|
+
readonly 16: readonly ["material.calculator.programmer.hex", "Hexadecimal"];
|
|
13
|
+
readonly 10: readonly ["material.calculator.programmer.dec", "Decimal"];
|
|
14
|
+
readonly 8: readonly ["material.calculator.programmer.oct", "Octal"];
|
|
15
|
+
readonly 2: readonly ["material.calculator.programmer.bin", "Binary"];
|
|
16
|
+
};
|
|
17
|
+
/** A press on a digit the base does not have: it says so instead of staying silent. */
|
|
18
|
+
export declare function unavailableDigit(base: Base, t: (key: (typeof BASE_NAME)[Base][0], fallback: string) => string): Announcement;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CalcSession } from '@nxgt/material-core/calculator';
|
|
2
|
+
import { Base } from '@nxgt/material-core/calculator/programmer';
|
|
3
|
+
import { ProgrammerStep } from './programmer-reduce.js';
|
|
4
|
+
import { ProgrammerState } from './programmer-state.js';
|
|
5
|
+
/**
|
|
6
|
+
* A new base. A calculable number follows into it (an expression collapses to
|
|
7
|
+
* its value, and says so); one that does not calculate yet (`(10`) has each
|
|
8
|
+
* literal rewritten in place, and a base change that cannot be done cleanly
|
|
9
|
+
* is refused.
|
|
10
|
+
*/
|
|
11
|
+
export declare function changeBase(session: CalcSession, p: ProgrammerState, base: Base, value: bigint | undefined): ProgrammerStep;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ProgrammerState } from './programmer-state.js';
|
|
2
|
+
type Props = {
|
|
3
|
+
/** The word's value; `undefined` while the expression does not calculate (the pad is inert). */
|
|
4
|
+
value: bigint | undefined;
|
|
5
|
+
programmer: ProgrammerState;
|
|
6
|
+
onToggle: (index: number) => void;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* One button per bit of the word, most significant first, grouped by four. A
|
|
10
|
+
* disclosure keeps the pad out of the way until it is wanted: sixty-four
|
|
11
|
+
* 44px targets are most of a phone screen.
|
|
12
|
+
*/
|
|
13
|
+
export declare function ProgrammerBitpad({ value, programmer, onToggle }: Props): import("react").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DisplayModel } from '../../calculator.selectors.js';
|
|
2
|
+
import { CalculatorState } from '../../calculator.slice.js';
|
|
3
|
+
import { EngineSettings } from '../../engine.js';
|
|
4
|
+
/**
|
|
5
|
+
* The display of the Programmer variant: the value in the base the keys type
|
|
6
|
+
* in (upper case, grouped), not in the locale's decimal. `value` stays the
|
|
7
|
+
* exact decimal text, which is what Copy writes.
|
|
8
|
+
*/
|
|
9
|
+
export declare function selectProgrammerDisplay(state: CalculatorState, settings: EngineSettings): DisplayModel;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CalcKey } from '@nxgt/material-core/calculator';
|
|
2
|
+
import { KeyLayout } from '../key-layout.js';
|
|
3
|
+
/** Digits, then the arithmetic keys: C ± mod ÷ over the digits, and `0 ⌫ =` last. */
|
|
4
|
+
export declare const PROGRAMMER_LAYOUT: KeyLayout;
|
|
5
|
+
/** Keys the physical keyboard takes beyond the keypad's. */
|
|
6
|
+
export declare const PROGRAMMER_EXTRA_KEYS: readonly CalcKey[];
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** The spoken names of the Programmer keys: `material.calculator.keys.<name>`. */
|
|
2
|
+
export declare const PROGRAMMER_NAMES: readonly ["hex-a", "hex-b", "hex-c", "hex-d", "hex-e", "hex-f", "and", "or", "xor", "not", "nand", "nor", "shift-left", "shift-right", "rotate-left", "rotate-right"];
|
package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-readouts.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Base } from '@nxgt/material-core/calculator/programmer';
|
|
2
|
+
import { ProgrammerState } from './programmer-state.js';
|
|
3
|
+
type Props = {
|
|
4
|
+
value: bigint;
|
|
5
|
+
programmer: ProgrammerState;
|
|
6
|
+
onBase: (base: Base) => void;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* The value in the four bases, as a single choice: the one chosen is the base
|
|
10
|
+
* the digit keys type in. Native radios (arrows move and choose), each read as
|
|
11
|
+
* its base's name followed by the value.
|
|
12
|
+
*/
|
|
13
|
+
export declare function ProgrammerReadouts({ value, programmer, onBase }: Props): import("react").JSX.Element;
|
|
14
|
+
export {};
|