@nxgt/material 3.101.0 → 3.104.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 +82 -0
- package/README.md +37 -5
- package/dist/{alert-dialog-DYzxchiS.js → alert-dialog-CK_47jfm.js} +1 -1
- package/dist/{async-slice-drJyPvuM.js → async-slice-1ZNMiwyJ.js} +1 -1
- package/dist/{bubble-input-CQwVSoU3.js → bubble-input-BxI1WmNs.js} +17 -5
- package/dist/{button-GeIsUekU.js → button-YfEMZbRO.js} +2 -2
- package/dist/{calculator-BS4PAm6l.js → calculator-BmYZId4c.js} +261 -460
- package/dist/calculator-field.js +7 -7
- package/dist/{calculator-segment-CEdwE24M.js → calculator-segment-DJ08DJ-n.js} +1 -1
- package/dist/calculator.js +1 -1
- package/dist/charts.js +819 -764
- package/dist/{chip-BdEtFQ85.js → chip-DPj6e-3v.js} +2 -2
- package/dist/{code-editor-BByXZOGy.js → code-editor-CZg3nLZO.js} +178 -177
- package/dist/code-editor.js +5 -5
- package/dist/{code-language-items-CSZX5zxD.js → code-language-items-Nq1iOGId.js} +14 -5
- package/dist/components/ui/actions/action-card/action-card-tile.css +47 -0
- package/dist/components/ui/display/chip/chip-soft.css +27 -2
- package/dist/components/ui/display/code/code-moonlight.css +10 -10
- package/dist/components/ui/primitives/collapsible/collapsible.css +9 -0
- package/dist/{components-DQ4MljCr.js → components-B2wrH_W0.js} +19302 -18583
- package/dist/components.js +38 -37
- package/dist/{conversion-variant-DTQqAyDt.js → conversion-variant-C-LPx5ek.js} +5 -5
- package/dist/{currency-field-Dnju7ss2.js → currency-field-DnsRIA80.js} +24 -23
- package/dist/{dialog-5_2__tu8.js → dialog-BKBsDGFc.js} +3 -3
- package/dist/dnd.js +1 -1
- package/dist/{dropdown-menu-FdGC5kIP.js → dropdown-menu-QMDbRidH.js} +1 -1
- package/dist/editor.js +9 -9
- package/dist/{empty-state-BoepPG5v.js → empty-state-BLIJ6znY.js} +1 -1
- package/dist/{field-blur-DkiZOVNV.js → field-blur-DMJwPLsg.js} +9 -9
- package/dist/field-blur-context-3rKussBQ.js +29 -0
- package/dist/{financial-variant-BhqJp5C-.js → financial-variant-Ws0Jp01H.js} +5 -5
- package/dist/{hooks-DjcbJZiO.js → hooks-C3vkQmzh.js} +106 -61
- package/dist/hooks.js +3 -3
- package/dist/{hover-card-CmHJeBeY.js → hover-card-Df649U6I.js} +1 -1
- package/dist/i18n.js +3 -3
- package/dist/{icon-badge-LGUPQh_c.js → icon-badge-Cma1qOOJ.js} +1 -1
- package/dist/{icon-button-BSVpO1jP.js → icon-button-CpKxV264.js} +1 -1
- package/dist/key-layout-D2goCDkD.js +31 -0
- package/dist/keypad.js +551 -0
- package/dist/label-DR-zZyGQ.js +47 -0
- package/dist/lib/components/ui/actions/index.d.ts +1 -0
- package/dist/lib/components/ui/actions/product-tile/index.d.ts +1 -0
- package/dist/lib/components/ui/actions/product-tile/product-tile-link.d.ts +16 -0
- package/dist/lib/components/ui/actions/product-tile/product-tile.d.ts +41 -0
- package/dist/lib/components/ui/collections/data-table/data-table-density.d.ts +1 -1
- package/dist/lib/components/ui/collections/data-table/partials/data-table-scroll-region.d.ts +4 -1
- package/dist/lib/components/ui/collections/data-table/partials/layouts/data-table-list-bar.d.ts +6 -3
- package/dist/lib/components/ui/collections/data-table/partials/layouts/list-bar-in-row.d.ts +2 -1
- package/dist/lib/components/ui/collections/data-table/types.d.ts +11 -8
- package/dist/lib/components/ui/collections/data-table/virtual-option.d.ts +9 -3
- package/dist/lib/components/ui/collections/filter/use-filter-field-config.d.ts +2 -0
- package/dist/lib/components/ui/collections/server-table/partials/server-table-passed-through.d.ts +1 -0
- package/dist/lib/components/ui/collections/server-table/types.d.ts +1 -1
- package/dist/lib/components/ui/display/chip/chip.variants.d.ts +5 -4
- package/dist/lib/components/ui/display/code/code-block-parts.d.ts +1 -1
- package/dist/lib/components/ui/display/code/code-block.d.ts +4 -1
- package/dist/lib/components/ui/display/code/languages.d.ts +2 -0
- package/dist/lib/components/ui/display/code/moonlight-tokens.d.ts +10 -10
- package/dist/lib/components/ui/feedback/confirm-dialog/confirm-dialog-props.d.ts +73 -0
- package/dist/lib/components/ui/feedback/confirm-dialog/confirm-dialog-rules.d.ts +12 -0
- package/dist/lib/components/ui/feedback/confirm-dialog/confirm-dialog.d.ts +5 -61
- package/dist/lib/components/ui/feedback/confirm-dialog/confirm-footer.d.ts +12 -0
- package/dist/lib/components/ui/feedback/confirm-dialog/confirm-phrase.d.ts +26 -0
- package/dist/lib/components/ui/feedback/confirm-dialog/use-confirm-action.d.ts +1 -1
- package/dist/lib/components/ui/fields/contacts/placeholders.d.ts +1 -1
- package/dist/lib/components/ui/fields/index.d.ts +1 -0
- package/dist/lib/components/ui/fields/quantity-field/types.d.ts +1 -1
- package/dist/lib/components/ui/fields/quantity-stepper/index.d.ts +2 -0
- package/dist/lib/components/ui/fields/quantity-stepper/quantity-stepper-model.d.ts +9 -0
- package/dist/lib/components/ui/fields/quantity-stepper/quantity-stepper-value.d.ts +15 -0
- package/dist/lib/components/ui/fields/quantity-stepper/quantity-stepper.d.ts +9 -0
- package/dist/lib/components/ui/fields/quantity-stepper/quantity-stepper.types.d.ts +35 -0
- package/dist/lib/components/ui/fields/quantity-stepper/use-quantity-stepper.d.ts +28 -0
- package/dist/lib/components/ui/layout/index.d.ts +1 -0
- package/dist/lib/components/ui/layout/pane-layout/pane-layout.d.ts +8 -3
- package/dist/lib/components/ui/layout/pane-layout/partials/pane-layout-classes.d.ts +2 -2
- package/dist/lib/components/ui/layout/pane-layout/partials/pane-layout-context.d.ts +9 -0
- package/dist/lib/components/ui/layout/pane-layout/partials/use-pane-layout-state.d.ts +7 -2
- package/dist/lib/components/ui/layout/panel-card/index.d.ts +1 -0
- package/dist/lib/components/ui/layout/panel-card/panel-card.d.ts +23 -0
- package/dist/lib/components/ui/primitives/collapsible/collapsible.d.ts +9 -1
- package/dist/lib/components/ui/primitives/tabs/partials/tabs-list.d.ts +6 -1
- package/dist/lib/components/ui/primitives/tabs/tabs-classes.d.ts +1 -0
- package/dist/lib/components/ui/selection/chip-group-field/chip-group-field.d.ts +8 -0
- package/dist/lib/components/ui/selection/chip-group-field/chip-group-field.types.d.ts +6 -0
- package/dist/lib/components/ui/selection/chip-group-field/partials/chip-group-reasons.d.ts +10 -0
- package/dist/lib/components/ui/selection/chip-group-field/partials/use-chip-rail.d.ts +12 -0
- package/dist/lib/components/ui/selection/choice-group/choice-group-root.d.ts +5 -2
- package/dist/lib/components/ui/selection/index.d.ts +1 -0
- package/dist/lib/components/ui/selection/status-menu/index.d.ts +3 -0
- package/dist/lib/components/ui/selection/status-menu/partials/status-confirm.d.ts +12 -0
- package/dist/lib/components/ui/selection/status-menu/partials/status-icon.d.ts +6 -0
- package/dist/lib/components/ui/selection/status-menu/partials/status-items.d.ts +18 -0
- package/dist/lib/components/ui/selection/status-menu/partials/status-menu-list.d.ts +14 -0
- package/dist/lib/components/ui/selection/status-menu/partials/status-sheet-row.d.ts +11 -0
- package/dist/lib/components/ui/selection/status-menu/partials/status-sheet.d.ts +21 -0
- package/dist/lib/components/ui/selection/status-menu/partials/status-trigger.d.ts +18 -0
- package/dist/lib/components/ui/selection/status-menu/status-menu-data.d.ts +12 -0
- package/dist/lib/components/ui/selection/status-menu/status-menu-form-field.d.ts +20 -0
- package/dist/lib/components/ui/selection/status-menu/status-menu.d.ts +13 -0
- package/dist/lib/components/ui/selection/status-menu/types.d.ts +76 -0
- package/dist/lib/components/ui/selection/status-menu/use-status-change.d.ts +18 -0
- package/dist/lib/components/ui/selection/status-menu/use-status-menu.d.ts +30 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-keypad.d.ts +1 -5
- package/dist/lib/components/ui/widgets/calculator/variants/key-layout.d.ts +3 -49
- package/dist/lib/components/ui/widgets/keypad/cash-model.d.ts +16 -0
- package/dist/lib/components/ui/widgets/keypad/index.d.ts +5 -0
- package/dist/lib/components/ui/widgets/keypad/key-layout.d.ts +56 -0
- package/dist/lib/components/ui/widgets/keypad/keypad-binding.d.ts +32 -0
- package/dist/lib/components/ui/widgets/keypad/keypad-cash.d.ts +28 -0
- package/dist/lib/components/ui/widgets/keypad/keypad-display.d.ts +11 -0
- package/dist/lib/components/ui/widgets/keypad/keypad-entry.d.ts +39 -0
- package/dist/lib/components/ui/widgets/keypad/keypad-grid.d.ts +27 -0
- package/dist/lib/components/ui/widgets/{calculator/partials/calculator-key.d.ts → keypad/keypad-key.d.ts} +6 -3
- package/dist/lib/components/ui/widgets/keypad/keypad-layout.d.ts +19 -0
- package/dist/lib/components/ui/widgets/{calculator/partials → keypad}/keypad-navigation.d.ts +1 -1
- package/dist/lib/components/ui/widgets/keypad/keypad.d.ts +9 -0
- package/dist/lib/components/ui/widgets/keypad/keypad.types.d.ts +91 -0
- package/dist/lib/components/ui/widgets/keypad/use-keypad-cash.d.ts +14 -0
- package/dist/lib/components/ui/widgets/keypad/use-keypad-keyboard.d.ts +7 -0
- package/dist/lib/components/ui/widgets/keypad/use-keypad-number.d.ts +10 -0
- package/dist/lib/components/ui/widgets/keypad/use-keypad-quantity.d.ts +16 -0
- package/dist/lib/components/ui/widgets/keypad/use-keypad-value.d.ts +17 -0
- package/dist/lib/components/ui/widgets/keypad/use-keypad.d.ts +23 -0
- package/dist/lib/components/ui/widgets/native-charts/core/label-placement.d.ts +25 -0
- package/dist/lib/components/ui/widgets/native-charts/core/reference-geometry.d.ts +3 -2
- package/dist/lib/hooks/index.d.ts +1 -0
- package/dist/lib/hooks/use-barcode-scanner.d.ts +39 -0
- package/dist/lib/i18n/resources/en/en.d.ts +28 -0
- package/dist/lib/i18n/resources/en/material.json.d.ts +30 -2
- package/dist/lib/i18n/resources/fr/fr.d.ts +28 -0
- package/dist/lib/i18n/resources/fr/material.json.d.ts +30 -2
- package/dist/lib/i18n/resources/resources.d.ts +56 -0
- package/dist/lib/i18n/translator.d.ts +1 -1
- package/dist/lib/keypad/index.d.ts +20 -0
- package/dist/lib/print/output/csv.d.ts +37 -0
- package/dist/lib/print/output/index.d.ts +1 -0
- package/dist/lib.js +1 -1
- package/dist/main.js +54 -53
- package/dist/map.js +9 -9
- package/dist/material.css +1 -1
- package/dist/pdf-reader.js +1 -1
- package/dist/{percent-field-DGlU_xii.js → percent-field-sAq7BaxN.js} +15 -14
- package/dist/{picker-surface-CGhqNR8a.js → picker-surface--6E-nvpU.js} +4 -4
- package/dist/{popover-ZxL7ktKk.js → popover-bEB8I_-w.js} +1 -1
- package/dist/{pos-types-BQ0QpYMp.js → pos-types-Cpdc4E33.js} +1 -1
- package/dist/{pos-variant-CKy8h_5i.js → pos-variant-ClMGu59I.js} +25 -25
- package/dist/print.js +146 -127
- package/dist/{programmer-variant-CbHstE28.js → programmer-variant-ChzgyA7x.js} +30 -30
- package/dist/{public-D-tdOz4b.js → public-BY8N5NDT.js} +9 -9
- package/dist/{rich-code-block-CTPj1LuD.js → rich-code-block-D2GiWuqD.js} +18 -18
- package/dist/{scientific-variant-B8U9h3II.js → scientific-variant-31_93gcZ.js} +8 -8
- package/dist/{sortable-provider-CSoWE7Ce.js → sortable-provider-DGiVn72t.js} +2 -2
- package/dist/{spinner-ffuwBXHl.js → spinner-CEVomQ5K.js} +1 -1
- package/dist/standard-layout-DTr9yy8Z.js +48 -0
- package/dist/{tabs-JgRq6ZJx.js → tabs-B8MXBbPW.js} +14 -14
- package/dist/{text-field-DURkIP-v.js → text-field-DN88qD0Q.js} +16 -15
- package/dist/theme-picker.js +13 -13
- package/dist/{theme-toggle-n_Zg7JAA.js → theme-toggle-C7pnu1Xh.js} +1 -1
- package/dist/{toolbar-items-IANZdcw4.js → toolbar-items-BDfoh8QB.js} +4 -4
- package/dist/{translate-material-CMHUH5Ha.js → translate-material-s_lxIV43.js} +1 -1
- package/dist/{translator-9zA-Um3W.js → translator-Cgql9srO.js} +56 -4
- package/dist/use-calculator-keyboard-DysnFK8m.js +222 -0
- package/dist/{use-chat-composer-BoIN7RCA.js → use-chat-composer-xCcp9fVc.js} +2250 -2195
- package/dist/{use-heading-spy-Ciw9GBHL.js → use-heading-spy-FIZlf9qj.js} +235 -154
- package/dist/{use-material-translation-CLNaMhUf.js → use-material-translation-xNzbSVgS.js} +1 -1
- package/dist/{use-return-focus-DWhbTGVe.js → use-return-focus-CW9KkDkp.js} +1 -1
- package/docs/README.md +2 -1
- package/docs/components/README.md +2 -0
- package/docs/components/buttons-and-actions.md +81 -2
- package/docs/components/data-display.md +6 -3
- package/docs/components/data-table-filter-and-lists.md +19 -6
- package/docs/components/feedback-and-status.md +20 -0
- package/docs/components/form-fields.md +60 -7
- package/docs/components/navigation-and-layout.md +48 -2
- package/docs/components/primitives.md +44 -2
- package/docs/components/rich-widgets.md +28 -0
- package/docs/components/selection-and-choice.md +176 -1
- package/docs/guides/calculator.md +1 -1
- package/docs/guides/cards-and-tiles.md +31 -24
- package/docs/guides/csp.md +4 -3
- package/docs/guides/data-grid.md +5 -4
- package/docs/guides/field-look-refined.md +2 -2
- package/docs/guides/forms.md +1 -0
- package/docs/guides/helpers.md +49 -0
- package/docs/guides/keypad.md +233 -0
- package/docs/guides/printing.md +51 -1
- package/docs/previews/buttons-actions-producttile.webp +0 -0
- package/docs/previews/data-display-codeblock.webp +0 -0
- package/docs/previews/data-display-codegroup.webp +0 -0
- package/docs/previews/data-display-jsonviewer.webp +0 -0
- package/docs/previews/form-fields-quantitystepper.webp +0 -0
- package/docs/previews/navigation-layout-panelcard.webp +0 -0
- package/docs/previews/rich-widgets-keypad.webp +0 -0
- package/docs/previews/selection-choice-statusmenu.webp +0 -0
- package/docs/roadmap.md +21 -0
- package/docs/troubleshooting.md +68 -4
- package/lib/components/ui/actions/action-card/action-card-tile.css +47 -0
- package/lib/components/ui/display/chip/chip-soft.css +27 -2
- package/lib/components/ui/display/code/code-moonlight.css +10 -10
- package/lib/components/ui/primitives/collapsible/collapsible.css +9 -0
- package/lib/components/ui/widgets/calculator/calculator-keys.css +3 -0
- package/lib/components/ui/widgets/calculator/calculator.css +118 -0
- package/package.json +7 -2
- package/dist/field-blur-context-BLGgf_3z.js +0 -73
- package/dist/key-layout-cR79xfGE.js +0 -38
- package/dist/standard-layout-BuSRr3TY.js +0 -40
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { t as e } from "./utils-BLfntITJ.js";
|
|
2
|
+
import { t } from "./use-material-translation-xNzbSVgS.js";
|
|
3
|
+
import { t as n } from "./useEvent-2fKq-6w8.js";
|
|
4
|
+
import { t as r } from "./useLatest-C2PnQEeD.js";
|
|
5
|
+
import { useCallback as i, useMemo as a, useRef as o, useState as s } from "react";
|
|
6
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
7
|
+
import { keyFromEvent as d } from "@nxgt/material-core/calculator";
|
|
8
|
+
//#region lib/components/ui/widgets/keypad/keypad-key.tsx
|
|
9
|
+
var f = {
|
|
10
|
+
digit: "bg-muted text-foreground",
|
|
11
|
+
operator: "bg-secondary-container text-foreground",
|
|
12
|
+
equals: "bg-primary text-primary-foreground",
|
|
13
|
+
utility: "bg-tertiary-container text-foreground",
|
|
14
|
+
function: "bg-muted text-foreground",
|
|
15
|
+
memory: "bg-muted text-foreground",
|
|
16
|
+
bracket: "bg-muted text-foreground"
|
|
17
|
+
};
|
|
18
|
+
function p({ def: n, row: r, index: i, tabIndex: a, decimal: o, unavailable: s, onPress: c, onFocus: u, buttonRef: d, slot: p = "calculator-key", className: m = "nxgt-calc-key" }) {
|
|
19
|
+
let { t: h } = t();
|
|
20
|
+
return /* @__PURE__ */ l("button", {
|
|
21
|
+
ref: d,
|
|
22
|
+
type: "button",
|
|
23
|
+
"data-slot": p,
|
|
24
|
+
"data-key": n.id,
|
|
25
|
+
"data-role": n.role,
|
|
26
|
+
"data-span": n.span,
|
|
27
|
+
"aria-disabled": s ? !0 : void 0,
|
|
28
|
+
tabIndex: a,
|
|
29
|
+
"aria-label": n.label ?? h(n.name.key, n.name.fallback),
|
|
30
|
+
className: e(m, f[n.role]),
|
|
31
|
+
onClick: () => !s && c(n),
|
|
32
|
+
onFocus: () => u(r, i),
|
|
33
|
+
children: /* @__PURE__ */ l("span", {
|
|
34
|
+
"aria-hidden": "true",
|
|
35
|
+
children: n.key === "." ? o : n.glyph
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region lib/components/ui/widgets/keypad/keypad-navigation.ts
|
|
41
|
+
function m(e) {
|
|
42
|
+
return e.rows.map((e) => {
|
|
43
|
+
let t = 0;
|
|
44
|
+
return e.map((e) => {
|
|
45
|
+
let n = t;
|
|
46
|
+
return t += e.span ?? 1, {
|
|
47
|
+
start: n,
|
|
48
|
+
end: t
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
var h = (e) => Math.max(e - 1, 0);
|
|
54
|
+
function g(e, t, n, r) {
|
|
55
|
+
let i = t.row < r, a = i ? 0 : r, o = i ? r - 1 : h(e.length), s = e[t.row] ?? [];
|
|
56
|
+
if (n === "ArrowUp" || n === "ArrowDown") {
|
|
57
|
+
let e = t.row + (n === "ArrowUp" ? -1 : 1);
|
|
58
|
+
return e < a || e > o ? void 0 : null;
|
|
59
|
+
}
|
|
60
|
+
if (!(i ? n === "ArrowRight" && t.index === h(s.length) : n === "ArrowLeft" && t.index === 0)) return null;
|
|
61
|
+
let c = t.row - a, l = i ? [r, h(e.length)] : [0, r - 1], u = Math.min(l[0] + c, l[1]);
|
|
62
|
+
return {
|
|
63
|
+
row: u,
|
|
64
|
+
index: i ? 0 : h((e[u] ?? []).length)
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function _(e, t, n, r = !1, i) {
|
|
68
|
+
let a = e[t.row] ?? [], o = a[t.index];
|
|
69
|
+
if (!o) return;
|
|
70
|
+
if (i && !(r && (n === "Home" || n === "End"))) {
|
|
71
|
+
let r = g(e, t, n, i);
|
|
72
|
+
if (r != null) return r;
|
|
73
|
+
if (r === void 0) return;
|
|
74
|
+
}
|
|
75
|
+
let s = h(e.length);
|
|
76
|
+
switch (n) {
|
|
77
|
+
case "ArrowLeft": return t.index > 0 ? {
|
|
78
|
+
row: t.row,
|
|
79
|
+
index: t.index - 1
|
|
80
|
+
} : void 0;
|
|
81
|
+
case "ArrowRight": return t.index < h(a.length) ? {
|
|
82
|
+
row: t.row,
|
|
83
|
+
index: t.index + 1
|
|
84
|
+
} : void 0;
|
|
85
|
+
case "ArrowUp":
|
|
86
|
+
case "ArrowDown": {
|
|
87
|
+
let r = t.row + (n === "ArrowUp" ? -1 : 1), i = e[r];
|
|
88
|
+
if (!i) return;
|
|
89
|
+
let a = i.findIndex((e) => e.start <= o.start && o.start < e.end);
|
|
90
|
+
return {
|
|
91
|
+
row: r,
|
|
92
|
+
index: Math.max(a, 0)
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
case "Home": return r ? {
|
|
96
|
+
row: 0,
|
|
97
|
+
index: 0
|
|
98
|
+
} : {
|
|
99
|
+
row: t.row,
|
|
100
|
+
index: 0
|
|
101
|
+
};
|
|
102
|
+
case "End": return r ? {
|
|
103
|
+
row: s,
|
|
104
|
+
index: h((e[s] ?? []).length)
|
|
105
|
+
} : {
|
|
106
|
+
row: t.row,
|
|
107
|
+
index: h(a.length)
|
|
108
|
+
};
|
|
109
|
+
default: return;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function v(e) {
|
|
113
|
+
let t = e.querySelectorAll("[data-pane]"), [n, r] = [t[0]?.firstElementChild, t[1]?.firstElementChild];
|
|
114
|
+
return !n || !r ? !1 : n.getBoundingClientRect().right <= r.getBoundingClientRect().left;
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region lib/components/ui/widgets/keypad/keypad-grid.tsx
|
|
118
|
+
var y = /* @__PURE__ */ new Set([
|
|
119
|
+
"ArrowLeft",
|
|
120
|
+
"ArrowRight",
|
|
121
|
+
"ArrowUp",
|
|
122
|
+
"ArrowDown",
|
|
123
|
+
"Home",
|
|
124
|
+
"End"
|
|
125
|
+
]);
|
|
126
|
+
function b(e, t, n, r) {
|
|
127
|
+
let i = e.map((e, t) => r(e, t));
|
|
128
|
+
return t ? /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("div", {
|
|
129
|
+
className: n,
|
|
130
|
+
"data-pane": "functions",
|
|
131
|
+
children: i.slice(0, t)
|
|
132
|
+
}), /* @__PURE__ */ l("div", {
|
|
133
|
+
className: n,
|
|
134
|
+
"data-pane": "main",
|
|
135
|
+
children: i.slice(t)
|
|
136
|
+
})] }) : i;
|
|
137
|
+
}
|
|
138
|
+
function x({ layout: e, label: t, describedBy: n, decimal: r, faceOf: i = (e) => e, unavailable: c, onPress: u, slot: d = "calculator-keypad", className: f = "nxgt-calc-keys", keySlot: h, keyClassName: g, paneClassName: x = "nxgt-calc-pane" }) {
|
|
139
|
+
let S = a(() => m(e), [e]), [C, w] = s({
|
|
140
|
+
row: 0,
|
|
141
|
+
index: 0
|
|
142
|
+
}), T = S[C.row]?.[C.index] ? C : {
|
|
143
|
+
row: 0,
|
|
144
|
+
index: 0
|
|
145
|
+
}, E = o(/* @__PURE__ */ new Map());
|
|
146
|
+
function D(t) {
|
|
147
|
+
if (!y.has(t.key) || t.altKey || t.metaKey) return;
|
|
148
|
+
let n = _(S, T, t.key, t.ctrlKey, v(t.currentTarget) ? e.split : void 0);
|
|
149
|
+
t.preventDefault(), n && E.current.get(`${n.row}:${n.index}`)?.focus();
|
|
150
|
+
}
|
|
151
|
+
return /* @__PURE__ */ l("div", {
|
|
152
|
+
role: "group",
|
|
153
|
+
"aria-label": t,
|
|
154
|
+
"aria-describedby": n,
|
|
155
|
+
dir: "ltr",
|
|
156
|
+
"data-slot": d,
|
|
157
|
+
"data-columns": e.columns,
|
|
158
|
+
className: f,
|
|
159
|
+
onKeyDown: D,
|
|
160
|
+
children: b(e.rows, e.split, x, (e, t) => e.map((e, n) => {
|
|
161
|
+
let a = i(e);
|
|
162
|
+
return /* @__PURE__ */ l(p, {
|
|
163
|
+
def: a,
|
|
164
|
+
row: t,
|
|
165
|
+
index: n,
|
|
166
|
+
decimal: r,
|
|
167
|
+
unavailable: c?.(a),
|
|
168
|
+
tabIndex: T.row === t && T.index === n ? 0 : -1,
|
|
169
|
+
slot: h,
|
|
170
|
+
className: g,
|
|
171
|
+
buttonRef: (e) => {
|
|
172
|
+
E.current.set(`${t}:${n}`, e);
|
|
173
|
+
},
|
|
174
|
+
onFocus: (e, t) => w({
|
|
175
|
+
row: e,
|
|
176
|
+
index: t
|
|
177
|
+
}),
|
|
178
|
+
onPress: u
|
|
179
|
+
}, a.id);
|
|
180
|
+
}))
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
//#endregion
|
|
184
|
+
//#region lib/components/ui/widgets/calculator/calculator-keyboard.ts
|
|
185
|
+
var S = /* @__PURE__ */ new Set([
|
|
186
|
+
"INPUT",
|
|
187
|
+
"TEXTAREA",
|
|
188
|
+
"SELECT"
|
|
189
|
+
]);
|
|
190
|
+
function C(e) {
|
|
191
|
+
return e ? S.has(e.tagName?.toUpperCase() ?? "") || e.isContentEditable === !0 : !1;
|
|
192
|
+
}
|
|
193
|
+
function w(e, t) {
|
|
194
|
+
if (e.defaultPrevented) return null;
|
|
195
|
+
let n = e.target;
|
|
196
|
+
if (t.global && C(n) || e.key === "Enter" && n?.closest?.("button")) return null;
|
|
197
|
+
let r = d(e, {
|
|
198
|
+
locale: t.locale,
|
|
199
|
+
programmer: t.programmer
|
|
200
|
+
});
|
|
201
|
+
return r === null ? null : r === "copy" ? t.hasSelection?.() ? null : r : r === "paste" ? null : t.accepts(r) ? r : null;
|
|
202
|
+
}
|
|
203
|
+
//#endregion
|
|
204
|
+
//#region lib/components/ui/widgets/calculator/use-calculator-keyboard.ts
|
|
205
|
+
var T = () => (globalThis.getSelection?.()?.toString() ?? "") !== "";
|
|
206
|
+
function E(e) {
|
|
207
|
+
let t = r(e), a = i((e) => {
|
|
208
|
+
let { locale: n, accepts: r, global: i, programmer: a, onKey: o, onCopy: s, beforeKey: c } = t.current;
|
|
209
|
+
if (!e.defaultPrevented && c?.(e)) return e.preventDefault();
|
|
210
|
+
let l = w(e, {
|
|
211
|
+
locale: n,
|
|
212
|
+
accepts: r,
|
|
213
|
+
global: i,
|
|
214
|
+
programmer: a,
|
|
215
|
+
hasSelection: T
|
|
216
|
+
});
|
|
217
|
+
l !== null && (e.preventDefault(), l === "copy" ? s() : l !== "paste" && o(l));
|
|
218
|
+
}, [t]);
|
|
219
|
+
return n("keydown", i((e) => a(e), [a]), e.global && typeof window < "u" ? window : null), i((e) => a(e), [a]);
|
|
220
|
+
}
|
|
221
|
+
//#endregion
|
|
222
|
+
export { x as n, E as t };
|