@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
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { t as e } from "./field-blur-context-
|
|
1
|
+
import { t as e } from "./field-blur-context-BLGgf_3z.js";
|
|
2
2
|
import { t } from "./useEvent-2fKq-6w8.js";
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return t.current = e, t;
|
|
11
|
-
}, d = (e) => e.type === "checkbox", f = (e) => e.type === "file", p = (e) => e instanceof Date, m = (e) => e == null, h = (e) => typeof e == "object", g = (e) => !m(e) && !Array.isArray(e) && h(e) && !p(e), _ = (e) => g(e) && e.target ? d(e.target) ? e.target.checked : f(e.target) ? e.target.files : e.target.value : e, v = (e, t) => t.split(".").some((t, n, r) => !isNaN(Number(t)) && e.has(r.slice(0, n).join("."))), y = (e) => {
|
|
3
|
+
import { t as n } from "./useLatest-C2PnQEeD.js";
|
|
4
|
+
import r, { useCallback as i, useEffect as a, useRef as o } from "react";
|
|
5
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
6
|
+
import { focusHandle as c } from "@nxgt/material-core/focus-control";
|
|
7
|
+
import { layerOf as l, openerOf as u } from "@nxgt/material-core/field-blur-layers";
|
|
8
|
+
//#region ../../node_modules/react-hook-form/dist/index.esm.mjs
|
|
9
|
+
var d = (e) => e.type === "checkbox", f = (e) => e.type === "file", p = (e) => e instanceof Date, m = (e) => e == null, h = (e) => typeof e == "object", g = (e) => !m(e) && !Array.isArray(e) && h(e) && !p(e), _ = (e) => g(e) && e.target ? d(e.target) ? e.target.checked : f(e.target) ? e.target.files : e.target.value : e, v = (e, t) => t.split(".").some((t, n, r) => !isNaN(Number(t)) && e.has(r.slice(0, n).join("."))), y = (e) => {
|
|
12
10
|
let t = e.constructor && e.constructor.prototype;
|
|
13
11
|
return g(t) && t.hasOwnProperty("isPrototypeOf");
|
|
14
12
|
}, b = typeof window < "u" && window.HTMLElement !== void 0 && typeof document < "u";
|
|
@@ -64,16 +62,16 @@ var S = {
|
|
|
64
62
|
if (E.includes(t)) return;
|
|
65
63
|
e[t] = a, e = e[t];
|
|
66
64
|
}
|
|
67
|
-
}, I =
|
|
65
|
+
}, I = r.createContext(null);
|
|
68
66
|
I.displayName = "HookFormControlContext";
|
|
69
|
-
var L = () =>
|
|
67
|
+
var L = () => r.useContext(I), ee = (e, t, n, r = !0) => {
|
|
70
68
|
let i = {};
|
|
71
69
|
for (let a in e) Object.defineProperty(i, a, { get: () => {
|
|
72
70
|
let i = a;
|
|
73
71
|
return t._proxyFormState[i] !== C.all && (t._proxyFormState[i] = !r || C.all), n && (n[i] = !0), e[i];
|
|
74
72
|
} });
|
|
75
73
|
return i;
|
|
76
|
-
}, te = b ?
|
|
74
|
+
}, te = b ? r.useLayoutEffect : r.useEffect, R = (e) => m(e) || !h(e), z = (e, t) => t.length === 0 && !Array.isArray(e) && !y(e);
|
|
77
75
|
function B(e, t, n = /* @__PURE__ */ new WeakMap()) {
|
|
78
76
|
if (e === t) return !0;
|
|
79
77
|
if (R(e) || R(t)) return Object.is(e, t);
|
|
@@ -100,25 +98,25 @@ function B(e, t, n = /* @__PURE__ */ new WeakMap()) {
|
|
|
100
98
|
return !0;
|
|
101
99
|
}
|
|
102
100
|
function ne() {
|
|
103
|
-
let e =
|
|
101
|
+
let e = r.useRef(!1), t = r.useRef(void 0);
|
|
104
102
|
return {
|
|
105
|
-
resyncIfNeeded:
|
|
103
|
+
resyncIfNeeded: r.useCallback((n, r, i) => {
|
|
106
104
|
if (n && e.current) {
|
|
107
105
|
let e = r();
|
|
108
106
|
B(t.current, e) || i(e);
|
|
109
107
|
}
|
|
110
108
|
e.current = !0;
|
|
111
109
|
}, []),
|
|
112
|
-
snapshot:
|
|
110
|
+
snapshot: r.useCallback((e, n) => {
|
|
113
111
|
e && (t.current = x(n()));
|
|
114
112
|
}, [])
|
|
115
113
|
};
|
|
116
114
|
}
|
|
117
115
|
function re(e) {
|
|
118
|
-
let t = L(), { control:
|
|
119
|
-
...
|
|
120
|
-
defaultValues:
|
|
121
|
-
})), l =
|
|
116
|
+
let t = L(), { control: n = t, disabled: i, name: a, exact: o } = e || {}, [s, c] = r.useState(() => ({
|
|
117
|
+
...n._formState,
|
|
118
|
+
defaultValues: n._defaultValues
|
|
119
|
+
})), l = r.useRef({
|
|
122
120
|
isDirty: !1,
|
|
123
121
|
isLoading: !1,
|
|
124
122
|
dirtyFields: !1,
|
|
@@ -130,19 +128,19 @@ function re(e) {
|
|
|
130
128
|
}), { resyncIfNeeded: u, snapshot: d } = ne();
|
|
131
129
|
return te(() => {
|
|
132
130
|
let e = () => ({
|
|
133
|
-
...
|
|
134
|
-
defaultValues:
|
|
131
|
+
...n._formState,
|
|
132
|
+
defaultValues: n._defaultValues
|
|
135
133
|
});
|
|
136
134
|
u(!i, e, c);
|
|
137
|
-
let t =
|
|
135
|
+
let t = n._subscribe({
|
|
138
136
|
name: a,
|
|
139
137
|
formState: l.current,
|
|
140
138
|
exact: o,
|
|
141
139
|
callback: (e) => {
|
|
142
140
|
!i && c({
|
|
143
|
-
...
|
|
141
|
+
...n._formState,
|
|
144
142
|
...e,
|
|
145
|
-
defaultValues:
|
|
143
|
+
defaultValues: n._defaultValues
|
|
146
144
|
});
|
|
147
145
|
}
|
|
148
146
|
});
|
|
@@ -155,45 +153,45 @@ function re(e) {
|
|
|
155
153
|
o,
|
|
156
154
|
u,
|
|
157
155
|
d
|
|
158
|
-
]),
|
|
159
|
-
l.current.isValid &&
|
|
160
|
-
}, [
|
|
156
|
+
]), r.useEffect(() => {
|
|
157
|
+
l.current.isValid && n._setValid(!0);
|
|
158
|
+
}, [n]), r.useMemo(() => ee(s, n, l.current, !1), [s, n]);
|
|
161
159
|
}
|
|
162
160
|
var V = (e) => typeof e == "string", ie = (e, t, n, r, i) => V(e) ? (r && t.watch.add(e), M(n, e, i)) : Array.isArray(e) ? e.map((e) => (r && t.watch.add(e), M(n, e))) : (r && (t.watchAll = !0), n);
|
|
163
161
|
function ae(e) {
|
|
164
|
-
let t = L(), { control:
|
|
162
|
+
let t = L(), { control: n = t, name: i, defaultValue: a, disabled: o, exact: s, compute: c } = e || {}, l = r.useRef(a), u = r.useRef(c), d = r.useRef(void 0), f = r.useRef(n), p = r.useRef(i);
|
|
165
163
|
u.current = c;
|
|
166
|
-
let [m, h] =
|
|
167
|
-
let e =
|
|
164
|
+
let [m, h] = r.useState(() => {
|
|
165
|
+
let e = n._getWatch(i, l.current);
|
|
168
166
|
return u.current ? u.current(e) : e;
|
|
169
|
-
}), g =
|
|
170
|
-
let t = ie(i,
|
|
167
|
+
}), g = r.useCallback((e) => {
|
|
168
|
+
let t = ie(i, n._names, e || n._formValues, !1, l.current);
|
|
171
169
|
return u.current ? u.current(t) : t;
|
|
172
170
|
}, [
|
|
173
|
-
|
|
174
|
-
|
|
171
|
+
n._formValues,
|
|
172
|
+
n._names,
|
|
175
173
|
i
|
|
176
|
-
]), _ =
|
|
174
|
+
]), _ = r.useCallback((e) => {
|
|
177
175
|
if (!o) {
|
|
178
|
-
let t = ie(i,
|
|
176
|
+
let t = ie(i, n._names, e || n._formValues, !1, l.current);
|
|
179
177
|
if (u.current) {
|
|
180
178
|
let e = u.current(t);
|
|
181
179
|
B(e, d.current) || (h(e), d.current = e);
|
|
182
180
|
} else h(t);
|
|
183
181
|
}
|
|
184
182
|
}, [
|
|
185
|
-
|
|
186
|
-
|
|
183
|
+
n._formValues,
|
|
184
|
+
n._names,
|
|
187
185
|
o,
|
|
188
186
|
i
|
|
189
|
-
]), { resyncIfNeeded: v, snapshot: y } = ne(), b =
|
|
187
|
+
]), { resyncIfNeeded: v, snapshot: y } = ne(), b = r.useRef(_);
|
|
190
188
|
b.current = _;
|
|
191
|
-
let x =
|
|
189
|
+
let x = r.useRef(g);
|
|
192
190
|
x.current = g, te(() => {
|
|
193
|
-
f.current !==
|
|
191
|
+
f.current !== n || !B(p.current, i) ? (f.current = n, p.current = i, b.current()) : v(!o, () => x.current(), (e) => {
|
|
194
192
|
h(e), d.current = e;
|
|
195
193
|
});
|
|
196
|
-
let e =
|
|
194
|
+
let e = n._subscribe({
|
|
197
195
|
name: i,
|
|
198
196
|
formState: { values: !0 },
|
|
199
197
|
exact: s,
|
|
@@ -205,14 +203,14 @@ function ae(e) {
|
|
|
205
203
|
e(), y(!o, () => x.current());
|
|
206
204
|
};
|
|
207
205
|
}, [
|
|
208
|
-
|
|
206
|
+
n,
|
|
209
207
|
s,
|
|
210
208
|
i,
|
|
211
209
|
o,
|
|
212
210
|
v,
|
|
213
211
|
y
|
|
214
|
-
]),
|
|
215
|
-
let S = f.current !==
|
|
212
|
+
]), r.useEffect(() => n._removeUnmounted());
|
|
213
|
+
let S = f.current !== n, C = p.current, w = r.useMemo(() => {
|
|
216
214
|
if (o) return null;
|
|
217
215
|
let e = !S && !B(C, i);
|
|
218
216
|
return S || e ? g() : null;
|
|
@@ -226,82 +224,82 @@ function ae(e) {
|
|
|
226
224
|
return w === null ? m : w;
|
|
227
225
|
}
|
|
228
226
|
function oe(e) {
|
|
229
|
-
let t = L(), { name:
|
|
227
|
+
let t = L(), { name: n, disabled: i, control: a = t, shouldUnregister: o, defaultValue: s, exact: c = !0 } = e, l = v(a._names.array, n), u = ae({
|
|
230
228
|
control: a,
|
|
231
|
-
name:
|
|
232
|
-
defaultValue:
|
|
229
|
+
name: n,
|
|
230
|
+
defaultValue: r.useMemo(() => M(a._formValues, n, M(a._defaultValues, n, s)), [
|
|
233
231
|
a,
|
|
234
|
-
|
|
232
|
+
n,
|
|
235
233
|
s
|
|
236
234
|
]),
|
|
237
235
|
exact: c
|
|
238
236
|
}), d = re({
|
|
239
237
|
control: a,
|
|
240
|
-
name:
|
|
238
|
+
name: n,
|
|
241
239
|
exact: c
|
|
242
|
-
}), f =
|
|
240
|
+
}), f = r.useRef(e), p = r.useRef(null), m = r.useRef(a.register(n, {
|
|
243
241
|
...e.rules,
|
|
244
242
|
value: u,
|
|
245
243
|
...N(e.disabled) ? { disabled: e.disabled } : {}
|
|
246
244
|
}));
|
|
247
245
|
f.current = e;
|
|
248
|
-
let h =
|
|
246
|
+
let h = r.useMemo(() => Object.defineProperties({}, {
|
|
249
247
|
invalid: {
|
|
250
248
|
enumerable: !0,
|
|
251
|
-
get: () => !!M(d.errors,
|
|
249
|
+
get: () => !!M(d.errors, n)
|
|
252
250
|
},
|
|
253
251
|
isDirty: {
|
|
254
252
|
enumerable: !0,
|
|
255
|
-
get: () => !!M(d.dirtyFields,
|
|
253
|
+
get: () => !!M(d.dirtyFields, n)
|
|
256
254
|
},
|
|
257
255
|
isTouched: {
|
|
258
256
|
enumerable: !0,
|
|
259
|
-
get: () => !!M(d.touchedFields,
|
|
257
|
+
get: () => !!M(d.touchedFields, n)
|
|
260
258
|
},
|
|
261
259
|
isValidating: {
|
|
262
260
|
enumerable: !0,
|
|
263
|
-
get: () => !!M(d.validatingFields,
|
|
261
|
+
get: () => !!M(d.validatingFields, n)
|
|
264
262
|
},
|
|
265
263
|
error: {
|
|
266
264
|
enumerable: !0,
|
|
267
|
-
get: () => M(d.errors,
|
|
265
|
+
get: () => M(d.errors, n)
|
|
268
266
|
}
|
|
269
|
-
}), [d,
|
|
267
|
+
}), [d, n]), g = r.useCallback((e) => {
|
|
270
268
|
let t = _(e);
|
|
271
|
-
return M(a._fields,
|
|
269
|
+
return M(a._fields, n) || (m.current = a.register(n, {
|
|
272
270
|
...f.current.rules,
|
|
273
271
|
value: t
|
|
274
272
|
})), m.current.onChange({
|
|
275
273
|
target: {
|
|
276
274
|
value: _(e),
|
|
277
|
-
name:
|
|
275
|
+
name: n
|
|
278
276
|
},
|
|
279
277
|
type: S.CHANGE
|
|
280
278
|
});
|
|
281
|
-
}, [
|
|
279
|
+
}, [n, a]), y = r.useCallback(() => m.current.onBlur({
|
|
282
280
|
target: {
|
|
283
|
-
value: M(a._formValues,
|
|
284
|
-
name:
|
|
281
|
+
value: M(a._formValues, n),
|
|
282
|
+
name: n
|
|
285
283
|
},
|
|
286
284
|
type: S.BLUR
|
|
287
|
-
}), [
|
|
285
|
+
}), [n, a._formValues]), b = r.useCallback((e) => {
|
|
288
286
|
e && (p.current = {
|
|
289
287
|
focus: () => P(e.focus) && e.focus(),
|
|
290
288
|
select: () => P(e.select) && e.select(),
|
|
291
289
|
setCustomValidity: (t) => P(e.setCustomValidity) && e.setCustomValidity(t),
|
|
292
290
|
reportValidity: () => P(e.reportValidity) && e.reportValidity()
|
|
293
291
|
});
|
|
294
|
-
let t = M(a._fields,
|
|
292
|
+
let t = M(a._fields, n);
|
|
295
293
|
t && t._f && e && (t._f.ref = p.current);
|
|
296
|
-
}, [a._fields,
|
|
297
|
-
name:
|
|
294
|
+
}, [a._fields, n]), C = r.useMemo(() => ({
|
|
295
|
+
name: n,
|
|
298
296
|
value: u,
|
|
299
297
|
...N(i) || d.disabled ? { disabled: d.disabled || i } : {},
|
|
300
298
|
onChange: g,
|
|
301
299
|
onBlur: y,
|
|
302
300
|
ref: b
|
|
303
301
|
}), [
|
|
304
|
-
|
|
302
|
+
n,
|
|
305
303
|
i,
|
|
306
304
|
d.disabled,
|
|
307
305
|
g,
|
|
@@ -309,9 +307,9 @@ function oe(e) {
|
|
|
309
307
|
b,
|
|
310
308
|
u
|
|
311
309
|
]);
|
|
312
|
-
return
|
|
310
|
+
return r.useEffect(() => {
|
|
313
311
|
let e = a._options.shouldUnregister || o;
|
|
314
|
-
m.current = a.register(
|
|
312
|
+
m.current = a.register(n, {
|
|
315
313
|
...f.current.rules,
|
|
316
314
|
...N(f.current.disabled) ? { disabled: f.current.disabled } : {}
|
|
317
315
|
});
|
|
@@ -319,32 +317,32 @@ function oe(e) {
|
|
|
319
317
|
let n = M(a._fields, e);
|
|
320
318
|
n && n._f && (n._f.mount = t);
|
|
321
319
|
};
|
|
322
|
-
if (t(
|
|
323
|
-
let e = x(M(o ? a._defaultValues : a._options.values || a._defaultValues,
|
|
324
|
-
F(a._defaultValues,
|
|
320
|
+
if (t(n, !0), e) {
|
|
321
|
+
let e = x(M(o ? a._defaultValues : a._options.values || a._defaultValues, n, M(a._options.defaultValues, n, f.current.defaultValue)));
|
|
322
|
+
F(a._defaultValues, n, e), k(M(a._formValues, n)) && F(a._formValues, n, e);
|
|
325
323
|
}
|
|
326
|
-
if (!l && a.register(
|
|
327
|
-
let e = M(a._fields,
|
|
324
|
+
if (!l && a.register(n), p.current) {
|
|
325
|
+
let e = M(a._fields, n);
|
|
328
326
|
e && e._f && (e._f.ref = p.current);
|
|
329
327
|
}
|
|
330
328
|
return () => {
|
|
331
|
-
(l ? e && !a._state.action : e) ? a.unregister(
|
|
329
|
+
(l ? e && !a._state.action : e) ? a.unregister(n) : t(n, !1);
|
|
332
330
|
};
|
|
333
331
|
}, [
|
|
334
|
-
|
|
332
|
+
n,
|
|
335
333
|
a,
|
|
336
334
|
l,
|
|
337
335
|
o
|
|
338
|
-
]),
|
|
336
|
+
]), r.useEffect(() => {
|
|
339
337
|
a._setDisabledField({
|
|
340
338
|
disabled: i,
|
|
341
|
-
name:
|
|
339
|
+
name: n
|
|
342
340
|
});
|
|
343
341
|
}, [
|
|
344
342
|
i,
|
|
345
|
-
|
|
343
|
+
n,
|
|
346
344
|
a
|
|
347
|
-
]),
|
|
345
|
+
]), r.useMemo(() => ({
|
|
348
346
|
field: C,
|
|
349
347
|
formState: d,
|
|
350
348
|
fieldState: h
|
|
@@ -553,165 +551,165 @@ function Q(e, t) {
|
|
|
553
551
|
}
|
|
554
552
|
var ke = (e, t, n) => (e[t] = n, e);
|
|
555
553
|
function Ae(e) {
|
|
556
|
-
let t = L(), { control:
|
|
557
|
-
o ||
|
|
558
|
-
|
|
554
|
+
let t = L(), { control: n = t, name: i, keyName: a = "id", disabled: o, shouldUnregister: s, rules: c } = e, [l, u] = r.useState(n._getFieldArray(i)), d = r.useRef(n._getFieldArray(i).map(H)), f = r.useRef(!1);
|
|
555
|
+
o || n._names.array.add(i), r.useMemo(() => !o && c && l.length >= 0 && n.register(i, c), [
|
|
556
|
+
n,
|
|
559
557
|
i,
|
|
560
558
|
l.length,
|
|
561
559
|
c,
|
|
562
560
|
o
|
|
563
561
|
]), te(() => {
|
|
564
|
-
if (!o) return
|
|
562
|
+
if (!o) return n._subjects.array.subscribe({ next: ({ values: e, name: t }) => {
|
|
565
563
|
if (t === i || !t) {
|
|
566
564
|
let n = M(e, i);
|
|
567
565
|
Array.isArray(n) ? (u(n), d.current = n.map(H)) : t || (u([]), d.current = []);
|
|
568
566
|
}
|
|
569
567
|
} }).unsubscribe;
|
|
570
568
|
}, [
|
|
571
|
-
|
|
569
|
+
n,
|
|
572
570
|
i,
|
|
573
571
|
o
|
|
574
572
|
]);
|
|
575
|
-
let p =
|
|
576
|
-
f.current = !0,
|
|
577
|
-
}, [
|
|
578
|
-
return
|
|
573
|
+
let p = r.useCallback((e) => {
|
|
574
|
+
f.current = !0, n._setFieldArray(i, e);
|
|
575
|
+
}, [n, i]);
|
|
576
|
+
return r.useEffect(() => {
|
|
579
577
|
if (o) {
|
|
580
|
-
|
|
578
|
+
n._state.actionArrayLengths.delete(i);
|
|
581
579
|
return;
|
|
582
580
|
}
|
|
583
|
-
|
|
584
|
-
let e = U(
|
|
585
|
-
if (f.current && (!e.isOnSubmit ||
|
|
586
|
-
|
|
587
|
-
let t = M(e.errors, i),
|
|
588
|
-
(
|
|
581
|
+
n._state.action = !1, n._state.actionArrayLengths.delete(i), le(i, n._names) && n._subjects.state.next({ ...n._formState });
|
|
582
|
+
let e = U(n._options.mode);
|
|
583
|
+
if (f.current && (!e.isOnSubmit || n._formState.isSubmitted) && !U(n._options.reValidateMode).isOnSubmit && !e.isOnBlur) if (n._options.resolver) n._runSchema([i]).then((e) => {
|
|
584
|
+
n._updateIsValidating([i]);
|
|
585
|
+
let t = M(e.errors, i), r = M(n._formState.errors, i), a = r && (r.type || r.root?.type), o = r && (r.message || r.root?.message);
|
|
586
|
+
(r ? !t && a || t && (a !== t.type || o !== t.message) : t && t.type) && (t ? g(t) && !Object.keys(t).some((e) => !Number.isNaN(+e)) ? ue(n._formState.errors, { [i]: t }, i) : F(n._formState.errors, i, t) : Q(n._formState.errors, i), n._subjects.state.next({ errors: n._formState.errors }));
|
|
589
587
|
});
|
|
590
588
|
else {
|
|
591
|
-
let e = M(
|
|
592
|
-
e && e._f && !(U(
|
|
589
|
+
let e = M(n._fields, i);
|
|
590
|
+
e && e._f && !(U(n._options.reValidateMode).isOnSubmit && U(n._options.mode).isOnSubmit) && ve(e, n._names.disabled, n._formValues, n._options.criteriaMode === C.all, n._options.shouldUseNativeValidation, !0).then((e) => !G(e) && n._subjects.state.next({ errors: ue(n._formState.errors, e, i) }));
|
|
593
591
|
}
|
|
594
|
-
f.current &&
|
|
592
|
+
f.current && n._subjects.state.next({
|
|
595
593
|
name: i,
|
|
596
|
-
values: x(
|
|
597
|
-
}),
|
|
598
|
-
if (
|
|
599
|
-
}),
|
|
594
|
+
values: x(n._formValues)
|
|
595
|
+
}), n._names.focus && W(n._fields, (e, t) => {
|
|
596
|
+
if (n._names.focus && t.startsWith(n._names.focus) && e.focus) return e.focus(), 1;
|
|
597
|
+
}), n._names.focus = "", n._setValid(), f.current = !1;
|
|
600
598
|
}, [
|
|
601
599
|
l,
|
|
602
600
|
i,
|
|
603
|
-
|
|
601
|
+
n,
|
|
604
602
|
o
|
|
605
|
-
]),
|
|
606
|
-
if (
|
|
607
|
-
let e = !(
|
|
608
|
-
f.current && e &&
|
|
603
|
+
]), r.useEffect(() => (o || !M(n._formValues, i) && n._setFieldArray(i), () => {
|
|
604
|
+
if (n._state.actionArrayLengths.delete(i), o) return;
|
|
605
|
+
let e = !(n._options.shouldUnregister || s);
|
|
606
|
+
f.current && e && n._subjects.state.next({
|
|
609
607
|
name: i,
|
|
610
|
-
values: x(
|
|
608
|
+
values: x(n._formValues)
|
|
611
609
|
}), e ? ((e, t) => {
|
|
612
|
-
let
|
|
613
|
-
|
|
614
|
-
})(i, !1) :
|
|
610
|
+
let r = M(n._fields, e);
|
|
611
|
+
r && r._f && (r._f.mount = t);
|
|
612
|
+
})(i, !1) : n.unregister(i);
|
|
615
613
|
}), [
|
|
616
614
|
i,
|
|
617
|
-
|
|
615
|
+
n,
|
|
618
616
|
a,
|
|
619
617
|
s,
|
|
620
618
|
o
|
|
621
619
|
]), {
|
|
622
|
-
swap:
|
|
620
|
+
swap: r.useCallback((e, t) => {
|
|
623
621
|
if (o) return;
|
|
624
|
-
let
|
|
625
|
-
Ee(
|
|
622
|
+
let r = n._getFieldArray(i);
|
|
623
|
+
Ee(r, e, t), Ee(d.current, e, t), p(r), u(r), n._setFieldArray(i, r, Ee, {
|
|
626
624
|
argA: e,
|
|
627
625
|
argB: t
|
|
628
626
|
}, !1);
|
|
629
627
|
}, [
|
|
630
628
|
p,
|
|
631
629
|
i,
|
|
632
|
-
|
|
630
|
+
n,
|
|
633
631
|
o
|
|
634
632
|
]),
|
|
635
|
-
move:
|
|
633
|
+
move: r.useCallback((e, t) => {
|
|
636
634
|
if (o) return;
|
|
637
|
-
let
|
|
638
|
-
Z(
|
|
635
|
+
let r = n._getFieldArray(i);
|
|
636
|
+
Z(r, e, t), Z(d.current, e, t), p(r), u(r), n._setFieldArray(i, r, Z, {
|
|
639
637
|
argA: e,
|
|
640
638
|
argB: t
|
|
641
639
|
}, !1);
|
|
642
640
|
}, [
|
|
643
641
|
p,
|
|
644
642
|
i,
|
|
645
|
-
|
|
643
|
+
n,
|
|
646
644
|
o
|
|
647
645
|
]),
|
|
648
|
-
prepend:
|
|
646
|
+
prepend: r.useCallback((e, t) => {
|
|
649
647
|
if (o) return;
|
|
650
|
-
let
|
|
651
|
-
|
|
648
|
+
let r = X(x(e)), a = Se(n._getFieldArray(i), r);
|
|
649
|
+
n._names.focus = ce(i, 0, t), d.current = Se(d.current, r.map(H)), p(a), u(a), n._setFieldArray(i, a, Se, { argA: be(e) });
|
|
652
650
|
}, [
|
|
653
651
|
p,
|
|
654
652
|
i,
|
|
655
|
-
|
|
653
|
+
n,
|
|
656
654
|
o
|
|
657
655
|
]),
|
|
658
|
-
append:
|
|
656
|
+
append: r.useCallback((e, t) => {
|
|
659
657
|
if (o) return;
|
|
660
|
-
let
|
|
661
|
-
|
|
658
|
+
let r = X(x(e)), a = ye(n._getFieldArray(i), r);
|
|
659
|
+
n._names.focus = ce(i, a.length - 1, t), d.current = ye(d.current, r.map(H)), p(a), u(a), n._setFieldArray(i, a, ye, { argA: be(e) });
|
|
662
660
|
}, [
|
|
663
661
|
p,
|
|
664
662
|
i,
|
|
665
|
-
|
|
663
|
+
n,
|
|
666
664
|
o
|
|
667
665
|
]),
|
|
668
|
-
remove:
|
|
666
|
+
remove: r.useCallback((e) => {
|
|
669
667
|
if (o) return;
|
|
670
|
-
let t = Te(
|
|
671
|
-
d.current = Te(d.current, e), p(t), u(t), !Array.isArray(M(
|
|
668
|
+
let t = Te(n._getFieldArray(i), e);
|
|
669
|
+
d.current = Te(d.current, e), p(t), u(t), !Array.isArray(M(n._fields, i)) && F(n._fields, i, void 0), n._setFieldArray(i, t, Te, { argA: e });
|
|
672
670
|
}, [
|
|
673
671
|
p,
|
|
674
672
|
i,
|
|
675
|
-
|
|
673
|
+
n,
|
|
676
674
|
o
|
|
677
675
|
]),
|
|
678
|
-
insert:
|
|
676
|
+
insert: r.useCallback((e, t, r) => {
|
|
679
677
|
if (o) return;
|
|
680
|
-
let a = X(x(t)), s = xe(
|
|
681
|
-
|
|
678
|
+
let a = X(x(t)), s = xe(n._getFieldArray(i), e, a);
|
|
679
|
+
n._names.focus = ce(i, e, r), d.current = xe(d.current, e, a.map(H)), p(s), u(s), n._setFieldArray(i, s, xe, {
|
|
682
680
|
argA: e,
|
|
683
681
|
argB: be(t)
|
|
684
682
|
});
|
|
685
683
|
}, [
|
|
686
684
|
p,
|
|
687
685
|
i,
|
|
688
|
-
|
|
686
|
+
n,
|
|
689
687
|
o
|
|
690
688
|
]),
|
|
691
|
-
update:
|
|
689
|
+
update: r.useCallback((e, t) => {
|
|
692
690
|
if (o) return;
|
|
693
|
-
let
|
|
694
|
-
d.current = [...a].map((t, n) => !t || n === e ? H() : d.current[n]), p(a), u([...a]),
|
|
691
|
+
let r = x(t), a = ke(n._getFieldArray(i), e, r);
|
|
692
|
+
d.current = [...a].map((t, n) => !t || n === e ? H() : d.current[n]), p(a), u([...a]), n._setFieldArray(i, a, ke, {
|
|
695
693
|
argA: e,
|
|
696
|
-
argB:
|
|
694
|
+
argB: r
|
|
697
695
|
}, !0, !1);
|
|
698
696
|
}, [
|
|
699
697
|
p,
|
|
700
698
|
i,
|
|
701
|
-
|
|
699
|
+
n,
|
|
702
700
|
o
|
|
703
701
|
]),
|
|
704
|
-
replace:
|
|
702
|
+
replace: r.useCallback((e) => {
|
|
705
703
|
if (o) return;
|
|
706
704
|
let t = X(x(e));
|
|
707
|
-
d.current = t.map(H), p([...t]), u([...t]),
|
|
705
|
+
d.current = t.map(H), p([...t]), u([...t]), n._setFieldArray(i, [...t], (e) => e, {}, !0, !1);
|
|
708
706
|
}, [
|
|
709
707
|
p,
|
|
710
708
|
i,
|
|
711
|
-
|
|
709
|
+
n,
|
|
712
710
|
o
|
|
713
711
|
]),
|
|
714
|
-
fields:
|
|
712
|
+
fields: r.useMemo(() => l.map((e, t) => ({
|
|
715
713
|
...e,
|
|
716
714
|
...N(o) ? { disabled: o } : {},
|
|
717
715
|
[a]: d.current[t] || H()
|
|
@@ -729,9 +727,9 @@ var je = (e) => {
|
|
|
729
727
|
for (let e of Object.keys(r)) t[`${n}.${e}`] = r[e];
|
|
730
728
|
} else t[n] = e[n];
|
|
731
729
|
return t;
|
|
732
|
-
}, Me =
|
|
730
|
+
}, Me = r.createContext(null);
|
|
733
731
|
Me.displayName = "HookFormContext";
|
|
734
|
-
var Ne = () =>
|
|
732
|
+
var Ne = () => r.useContext(Me), Pe = () => {
|
|
735
733
|
let e = [];
|
|
736
734
|
return {
|
|
737
735
|
get observers() {
|
|
@@ -1530,7 +1528,7 @@ function lt(e = {}) {
|
|
|
1530
1528
|
};
|
|
1531
1529
|
}
|
|
1532
1530
|
function ut(e = {}) {
|
|
1533
|
-
let t =
|
|
1531
|
+
let t = r.useRef(void 0), n = r.useRef(void 0), i = r.useRef(e.formControl), [a, o] = r.useState(() => ({
|
|
1534
1532
|
...x(ct),
|
|
1535
1533
|
isLoading: P(e.defaultValues),
|
|
1536
1534
|
errors: e.errors || {},
|
|
@@ -1575,29 +1573,29 @@ function ut(e = {}) {
|
|
|
1575
1573
|
s,
|
|
1576
1574
|
c,
|
|
1577
1575
|
l
|
|
1578
|
-
]),
|
|
1576
|
+
]), r.useEffect(() => s._disableForm(e.disabled), [s, e.disabled]), r.useEffect(() => {
|
|
1579
1577
|
e.mode && (s._options.mode = e.mode), e.reValidateMode && (s._options.reValidateMode = e.reValidateMode);
|
|
1580
1578
|
}, [
|
|
1581
1579
|
s,
|
|
1582
1580
|
e.mode,
|
|
1583
1581
|
e.reValidateMode
|
|
1584
|
-
]),
|
|
1582
|
+
]), r.useEffect(() => {
|
|
1585
1583
|
e.errors && (s._setErrors(e.errors), s._focusError());
|
|
1586
|
-
}, [s, e.errors]),
|
|
1584
|
+
}, [s, e.errors]), r.useEffect(() => {
|
|
1587
1585
|
e.shouldUnregister && s._subjects.state.next({ values: s._getWatch() });
|
|
1588
|
-
}, [s, e.shouldUnregister]),
|
|
1586
|
+
}, [s, e.shouldUnregister]), r.useEffect(() => {
|
|
1589
1587
|
if (s._proxyFormState.isDirty) {
|
|
1590
1588
|
let e = s._getDirty();
|
|
1591
1589
|
e !== a.isDirty && s._subjects.state.next({ isDirty: e });
|
|
1592
1590
|
}
|
|
1593
|
-
}, [s, a.isDirty]),
|
|
1594
|
-
e.values && !B(e.values,
|
|
1591
|
+
}, [s, a.isDirty]), r.useEffect(() => {
|
|
1592
|
+
e.values && !B(e.values, n.current) ? (s._reset(e.values, {
|
|
1595
1593
|
keepFieldsRef: !0,
|
|
1596
1594
|
...s._options.resetOptions
|
|
1597
|
-
}), s._options.resetOptions?.keepIsValid || s._setValid(),
|
|
1598
|
-
}, [s, e.values]),
|
|
1595
|
+
}), s._options.resetOptions?.keepIsValid || s._setValid(), n.current = e.values, o((e) => ({ ...e }))) : s._resetDefaultValues();
|
|
1596
|
+
}, [s, e.values]), r.useEffect(() => {
|
|
1599
1597
|
s._state.mount || (s._setValid(), s._state.mount = !0), s._state.watch && (s._state.watch = !1, s._subjects.state.next({ ...s._formState })), s._removeUnmounted();
|
|
1600
|
-
}), t.current.formState =
|
|
1598
|
+
}), t.current.formState = r.useMemo(() => ee(a, s), [s, a]), t.current;
|
|
1601
1599
|
}
|
|
1602
1600
|
//#endregion
|
|
1603
1601
|
//#region lib/components/ui/forms/use-field-blur.ts
|
|
@@ -1609,47 +1607,47 @@ function pt(e, t) {
|
|
|
1609
1607
|
for (let t of e.roots) t.isConnected || e.roots.delete(t);
|
|
1610
1608
|
let n = [...e.roots];
|
|
1611
1609
|
if (!n.length) return !1;
|
|
1612
|
-
if (n.some((e) => e.contains(t))) return e.inside || (e.before = new Set(t.ownerDocument?.body.childNodes ?? []), e.home = new Set(n.map(
|
|
1610
|
+
if (n.some((e) => e.contains(t))) return e.inside || (e.before = new Set(t.ownerDocument?.body.childNodes ?? []), e.home = new Set(n.map(l)), e.opened = /* @__PURE__ */ new Set()), e.inside = !0, !1;
|
|
1613
1611
|
if (!e.inside) return !1;
|
|
1614
|
-
let r =
|
|
1612
|
+
let r = l(t);
|
|
1615
1613
|
if (e.home.has(r)) return !0;
|
|
1616
1614
|
if (!r || e.opened.has(r)) return !1;
|
|
1617
|
-
let i =
|
|
1615
|
+
let i = u(n, e, r);
|
|
1618
1616
|
return i === "theirs" || !i && e.before.has(r) ? !0 : (e.opened.add(r), !1);
|
|
1619
1617
|
}
|
|
1620
|
-
function mt(e,
|
|
1621
|
-
let
|
|
1618
|
+
function mt(e, r) {
|
|
1619
|
+
let s = n(r), l = n(e), u = o({
|
|
1622
1620
|
roots: /* @__PURE__ */ new Set(),
|
|
1623
1621
|
inside: !1,
|
|
1624
1622
|
before: /* @__PURE__ */ new Set(),
|
|
1625
1623
|
home: /* @__PURE__ */ new Set(),
|
|
1626
1624
|
opened: /* @__PURE__ */ new Set()
|
|
1627
|
-
}).current, d =
|
|
1628
|
-
if (e) return
|
|
1629
|
-
|
|
1625
|
+
}).current, d = i((e) => {
|
|
1626
|
+
if (e) return u.roots.add(e), s.current?.(c(u.roots)), () => {
|
|
1627
|
+
u.roots.delete(e);
|
|
1630
1628
|
};
|
|
1631
|
-
}, [
|
|
1632
|
-
|
|
1633
|
-
}, [
|
|
1629
|
+
}, [u, s]), f = i(() => {
|
|
1630
|
+
u.inside = !1, l.current();
|
|
1631
|
+
}, [u, l]), p = i((e) => {
|
|
1634
1632
|
let t = e.target;
|
|
1635
|
-
t instanceof Node && (clearTimeout(
|
|
1636
|
-
}, [
|
|
1637
|
-
!
|
|
1638
|
-
|
|
1633
|
+
t instanceof Node && (clearTimeout(u.settle), pt(u, t) && f());
|
|
1634
|
+
}, [u, f]), m = i((e) => {
|
|
1635
|
+
!u.inside || e.relatedTarget || (clearTimeout(u.settle), u.settle = setTimeout(() => {
|
|
1636
|
+
u.settle = setTimeout(() => {
|
|
1639
1637
|
let e = dt?.activeElement;
|
|
1640
|
-
|
|
1638
|
+
u.inside && (!e || e === dt?.body) && f();
|
|
1641
1639
|
});
|
|
1642
1640
|
}));
|
|
1643
|
-
}, [
|
|
1644
|
-
return t("focusin", p, dt, ft), t("focusout", m, dt, ft),
|
|
1641
|
+
}, [u, f]);
|
|
1642
|
+
return t("focusin", p, dt, ft), t("focusout", m, dt, ft), a(() => () => clearTimeout(u.settle), [u]), d;
|
|
1645
1643
|
}
|
|
1646
1644
|
//#endregion
|
|
1647
1645
|
//#region lib/components/ui/forms/field-blur.tsx
|
|
1648
1646
|
function ht({ onBlur: t, focusRef: n, children: r }) {
|
|
1649
|
-
return /* @__PURE__ */
|
|
1647
|
+
return /* @__PURE__ */ s(e, {
|
|
1650
1648
|
value: mt(t, n),
|
|
1651
1649
|
children: r
|
|
1652
1650
|
});
|
|
1653
1651
|
}
|
|
1654
1652
|
//#endregion
|
|
1655
|
-
export { M as a, Ae as c, re as d, ae as f, K as i, ut as l, mt as n, F as o,
|
|
1653
|
+
export { M as a, Ae as c, re as d, ae as f, K as i, ut as l, mt as n, F as o, se as r, oe as s, ht as t, Ne as u };
|