maz-ui 4.0.0-beta.4 → 4.0.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/dist/assets/MazAccordion.DUQCf8vy.css +1 -0
  2. package/dist/assets/{MazBtn.BnRxVlqS.css → MazBtn.FsG6p6NF.css} +1 -1
  3. package/dist/assets/MazCheckbox.CFqw9ybT.css +1 -0
  4. package/dist/assets/MazDatePicker.8GyrtM-j.css +1 -0
  5. package/dist/assets/MazInput.WPopv89k.css +1 -0
  6. package/dist/assets/MazPickerMonthSwitcher.CszcpCcY.css +1 -0
  7. package/dist/assets/{MazPickerYearSwitcher.Dl30Dwor.css → MazPickerYearSwitcher.Cn-nS-Vv.css} +1 -1
  8. package/dist/assets/MazPopover.D-WwUjU_.css +1 -0
  9. package/dist/assets/MazRadio.XGYnbTuB.css +1 -0
  10. package/dist/assets/MazSelect.DEBsk61Q.css +1 -0
  11. package/dist/assets/{MazStepper.DYMde9uq.css → MazStepper.DtWZmm-f.css} +1 -1
  12. package/dist/assets/MazSwitch.Bxmh2iFj.css +1 -0
  13. package/dist/assets/{MazTable.B1tkeUfE.css → MazTable.DMlQdImb.css} +1 -1
  14. package/dist/assets/{toast.kunueRvo.css → toast.CC2VQab8.css} +1 -1
  15. package/dist/chunks/{MazDatePicker.CT5yJhSN.js → MazDatePicker.EVP68BQf.js} +28 -30
  16. package/dist/chunks/{MazDropdown.vue_vue_type_style_index_0_lang.De5b1GG8.js → MazDropdown.vue_vue_type_style_index_0_lang.DjPJ9-gt.js} +1 -1
  17. package/dist/chunks/{MazInputPrice.vue_vue_type_script_setup_true_lang.GMKzSu7R.js → MazInputPrice.vue_vue_type_script_setup_true_lang.BA6TDX-T.js} +31 -1
  18. package/dist/chunks/{MazPickerCalendar.RS6ZMdDK.js → MazPickerCalendar.CzPlAVdQ.js} +1 -1
  19. package/dist/chunks/{MazPickerCalendarMonth.hQBSVkc9.js → MazPickerCalendarMonth.gZBcslia.js} +1 -1
  20. package/dist/chunks/{MazPickerCalendarSwitcher.Cp2ux3E4.js → MazPickerCalendarSwitcher.CzAkb2yj.js} +1 -1
  21. package/dist/chunks/{MazPickerContainer.DnfB3Dqg.js → MazPickerContainer.BodulCQp.js} +1 -1
  22. package/dist/chunks/{MazPickerHeader.Dlz2yJ1D.js → MazPickerHeader.ns_pHhiy.js} +1 -1
  23. package/dist/chunks/{MazPickerMonthSwitcher.BpfCGGxQ.js → MazPickerMonthSwitcher.BuZuUauW.js} +5 -6
  24. package/dist/chunks/{MazPickerTime.EuWWNfid.js → MazPickerTime.DMVpW3Ha.js} +1 -1
  25. package/dist/chunks/{MazPickerYearSwitcher.D4aO09D3.js → MazPickerYearSwitcher.METGgjem.js} +8 -27
  26. package/dist/chunks/{MazSwitch.vue_vue_type_style_index_0_lang.DQE0vFhe.js → MazSwitch.vue_vue_type_style_index_0_lang.CU43Y1ky.js} +1 -1
  27. package/dist/chunks/{MazTable.vue_vue_type_script_setup_true_lang.bm7ng8fK.js → MazTable.vue_vue_type_script_setup_true_lang.CK2bk5tI.js} +2 -2
  28. package/dist/chunks/{utils.BBuYjMbK.js → dom-events.CvkK8Xn2.js} +219 -115
  29. package/dist/chunks/{normalizeString.CFe2M8S_.js → useStringMatching.D5UvsCUS.js} +40 -1
  30. package/dist/chunks/vClickOutside.C69k0jaG.js +107 -0
  31. package/dist/components/MazAccordion.js +2 -2
  32. package/dist/components/MazBtn.js +2 -3
  33. package/dist/components/MazCheckbox.js +10 -12
  34. package/dist/components/MazChecklist.js +1 -2
  35. package/dist/components/MazDatePicker.js +1 -1
  36. package/dist/components/MazDropdown.js +1 -1
  37. package/dist/components/MazInput.js +9 -10
  38. package/dist/components/MazInputPrice.js +1 -1
  39. package/dist/components/MazPopover.js +163 -77
  40. package/dist/components/MazPullToRefresh.js +7 -2
  41. package/dist/components/MazRadio.js +8 -16
  42. package/dist/components/MazReadingProgressBar.js +9 -2
  43. package/dist/components/MazSelect.js +22 -12
  44. package/dist/components/MazSelectCountry.js +7 -2
  45. package/dist/components/MazStepper.js +2 -2
  46. package/dist/components/MazSwitch.js +1 -1
  47. package/dist/components/MazTable.js +3 -3
  48. package/dist/components/MazTableCell.js +1 -1
  49. package/dist/components/MazTableRow.js +1 -1
  50. package/dist/components/MazTableTitle.js +1 -1
  51. package/dist/components/MazTextarea.js +23 -2
  52. package/dist/components/index.js +4 -4
  53. package/dist/composables/index.js +2 -2
  54. package/dist/composables/useDisplayNames.js +7 -1
  55. package/dist/composables/useFormField.js +15 -19
  56. package/dist/composables/useFormValidator.js +41 -28
  57. package/dist/composables/useIdleTimeout.js +108 -1
  58. package/dist/composables/useStringMatching.js +3 -40
  59. package/dist/composables/useSwipe.js +77 -1
  60. package/dist/composables/useUserVisibility.js +47 -1
  61. package/dist/css/main.css +1 -1
  62. package/dist/directives/index.js +7 -7
  63. package/dist/directives/vClickOutside.js +4 -102
  64. package/dist/directives/vTooltip.js +96 -59
  65. package/dist/index.js +1 -114
  66. package/dist/plugins/toast.js +8 -11
  67. package/dist/resolvers/MazComponentsResolver.js +7 -1
  68. package/dist/resolvers/MazModulesResolver.js +3 -0
  69. package/dist/tailwindcss/tailwind.config.js +5 -2
  70. package/dist/tailwindcss/variables/design-tokens.js +3 -0
  71. package/dist/types/components/MazAccordion.vue.d.ts +15 -2
  72. package/dist/types/components/MazCheckbox.vue.d.ts +0 -6
  73. package/dist/types/components/MazDatePicker.vue.d.ts +4 -12
  74. package/dist/types/components/MazInputNumber.vue.d.ts +1 -1
  75. package/dist/types/components/MazPopover.vue.d.ts +7 -4
  76. package/dist/types/components/MazStepper.vue.d.ts +13 -2
  77. package/dist/types/components/MazTable.vue.d.ts +63 -2
  78. package/dist/types/components/index.d.ts +1 -1
  79. package/dist/types/composables/index.d.ts +1 -1
  80. package/dist/types/composables/useDisplayNames.d.ts +3 -3
  81. package/dist/types/composables/useFormField.d.ts +3 -41
  82. package/dist/types/composables/useFormValidator/dom-events.d.ts +19 -0
  83. package/dist/types/composables/useFormValidator/state-management.d.ts +54 -0
  84. package/dist/types/composables/useFormValidator/types.d.ts +9 -20
  85. package/dist/types/composables/useFormValidator/validation.d.ts +43 -0
  86. package/dist/types/composables/useFormValidator.d.ts +16 -10
  87. package/dist/types/directives/vTooltip.d.ts +2 -2
  88. package/dist/types/index.d.ts +1 -1
  89. package/dist/types/tailwindcss/tailwind.config.d.ts +5 -0
  90. package/dist/types/tailwindcss/variables/design-tokens.d.ts +3 -0
  91. package/package.json +8 -9
  92. package/dist/assets/MazAccordion.esK3rR4p.css +0 -1
  93. package/dist/assets/MazCheckbox.BFo5eYS6.css +0 -1
  94. package/dist/assets/MazDatePicker.V5JwKPrQ.css +0 -1
  95. package/dist/assets/MazInput.DW2KOJHY.css +0 -1
  96. package/dist/assets/MazPickerMonthSwitcher.168v7Hs1.css +0 -1
  97. package/dist/assets/MazPopover.COR-tym7.css +0 -1
  98. package/dist/assets/MazRadio.DKMFWwy_.css +0 -1
  99. package/dist/assets/MazSelect.DZZpDg8z.css +0 -1
  100. package/dist/assets/MazSwitch.Z1ZMm7tx.css +0 -1
  101. package/dist/chunks/TextareaAutogrow.C22LQx0k.js +0 -25
  102. package/dist/chunks/debounceCallback.B69vn57Q.js +0 -7
  103. package/dist/chunks/formatCurrency.C8NzW9Ii.js +0 -34
  104. package/dist/chunks/formatDate.DZ_OzdnV.js +0 -21
  105. package/dist/chunks/getCountryFlagUrl.dQjriBXx.js +0 -9
  106. package/dist/chunks/idleTimeout.-ICpdeGV.js +0 -111
  107. package/dist/chunks/isServer.BokzeB-Q.js +0 -6
  108. package/dist/chunks/isStandaloneMode.BpUpOTbA.js +0 -10
  109. package/dist/chunks/pascalCase.D_nuQ66I.js +0 -11
  110. package/dist/chunks/swipeHandler.8emelhOL.js +0 -80
  111. package/dist/chunks/throttle.DN8ARw0a.js +0 -11
  112. package/dist/chunks/throttleId.7PhWZjcS.js +0 -62
  113. package/dist/chunks/userVisibility.BbQSJASv.js +0 -50
  114. package/dist/chunks/x-mark.CTalOvvY.js +0 -23
  115. package/dist/types/composables/useFormValidator/utils.d.ts +0 -116
@@ -1,11 +0,0 @@
1
- import { c as capitalize } from "./capitalize.BF6CDS_4.js";
2
- function camelCase(str) {
3
- return str.replaceAll(/-(\w)/g, (_, c) => c ? c.toUpperCase() : "");
4
- }
5
- function pascalCase(str) {
6
- return capitalize(camelCase(str));
7
- }
8
- export {
9
- camelCase as c,
10
- pascalCase as p
11
- };
@@ -1,80 +0,0 @@
1
- const defaultOptions = {
2
- preventDefaultOnTouchMove: !1,
3
- preventDefaultOnMouseWheel: !1,
4
- threshold: 50,
5
- immediate: !1,
6
- triggerOnEnd: !1
7
- };
8
- class Swipe {
9
- constructor(inputOption) {
10
- this.inputOption = inputOption, this.options = { ...defaultOptions, ...inputOption }, this.onToucheStartCallback = this.toucheStartHandler.bind(this), this.onToucheMoveCallback = this.handleTouchMove.bind(this), this.onToucheEndCallback = this.handleTouchEnd.bind(this), this.onMouseWheelCallback = this.handleMouseWheel.bind(this), this.start = this.startListening.bind(this), this.stop = this.stopListening.bind(this), this.options.element && this.setElement(this.options.element), this.options.immediate && this.start();
11
- }
12
- element;
13
- xStart;
14
- yStart;
15
- xEnd;
16
- yEnd;
17
- xDiff;
18
- yDiff;
19
- onToucheStartCallback;
20
- onToucheMoveCallback;
21
- onToucheEndCallback;
22
- onMouseWheelCallback;
23
- start;
24
- stop;
25
- options;
26
- startListening() {
27
- this.setElement(this.options.element), this.element?.addEventListener("touchstart", this.onToucheStartCallback, { passive: !0 }), this.element?.addEventListener("touchmove", this.onToucheMoveCallback, { passive: !0 }), this.options.triggerOnEnd && this.element?.addEventListener("touchend", this.onToucheEndCallback, { passive: !0 }), this.options.preventDefaultOnMouseWheel && this.element?.addEventListener("mousewheel", this.onMouseWheelCallback, { passive: !1 });
28
- }
29
- stopListening() {
30
- this.element?.removeEventListener("touchstart", this.onToucheStartCallback), this.element?.removeEventListener("touchmove", this.onToucheMoveCallback), this.element?.removeEventListener("touchend", this.onToucheEndCallback), this.options.preventDefaultOnMouseWheel && this.element?.removeEventListener("mousewheel", this.onMouseWheelCallback);
31
- }
32
- setElement(element) {
33
- if (!element) {
34
- console.error(
35
- "[maz-ui][SwipeHandler](setElement) Element should be provided. Its can be a string selector or an HTMLElement"
36
- );
37
- return;
38
- }
39
- if (typeof element == "string") {
40
- const foundElement = document.querySelector(element);
41
- if (!(foundElement instanceof HTMLElement)) {
42
- console.error("[maz-ui][SwipeHandler](setElement) String selector for element is not found");
43
- return;
44
- }
45
- this.element = foundElement;
46
- } else
47
- this.element = element;
48
- }
49
- handleMouseWheel(event) {
50
- event.preventDefault();
51
- }
52
- toucheStartHandler(event) {
53
- this.xStart = event.touches[0].clientX, this.yStart = event.touches[0].clientY, this.emitValuesChanged();
54
- }
55
- emitValuesChanged() {
56
- this.options.onValuesChanged?.({
57
- xStart: this.xStart,
58
- yStart: this.yStart,
59
- xEnd: this.xEnd,
60
- yEnd: this.yEnd,
61
- xDiff: this.xDiff,
62
- yDiff: this.yDiff
63
- });
64
- }
65
- handleTouchMove(event) {
66
- this.options.preventDefaultOnTouchMove && event.cancelable && event.preventDefault(), this.xEnd = event.touches[0].clientX, this.yEnd = event.touches[0].clientY, !(!this.xStart || !this.yStart) && (this.xDiff = this.xStart - this.xEnd, this.yDiff = this.yStart - this.yEnd, this.emitValuesChanged(), this.options.triggerOnEnd || this.runCallbacks(event));
67
- }
68
- handleTouchEnd(event) {
69
- this.runCallbacks(event), this.emitValuesChanged();
70
- }
71
- runCallbacks(event) {
72
- typeof this.xDiff != "number" || typeof this.yDiff != "number" || Math.abs(this.xDiff) < this.options.threshold && Math.abs(this.yDiff) < this.options.threshold || (Math.abs(this.xDiff) > Math.abs(this.yDiff) ? this.xDiff > 0 ? this.options.onLeft?.(event) : this.options.onRight?.(event) : this.yDiff > 0 ? this.options.onUp?.(event) : this.options.onDown?.(event), this.resetValues());
73
- }
74
- resetValues() {
75
- this.xStart = void 0, this.yStart = void 0, this.xEnd = void 0, this.yEnd = void 0, this.xDiff = void 0, this.yDiff = void 0, this.emitValuesChanged();
76
- }
77
- }
78
- export {
79
- Swipe as S
80
- };
@@ -1,11 +0,0 @@
1
- function throttle(func, limit) {
2
- let inThrottle = !1, lastFunc, lastRan;
3
- return function(...args) {
4
- inThrottle ? (clearTimeout(lastFunc), lastFunc = setTimeout(() => {
5
- Date.now() - lastRan >= limit && (func.apply(this, args), lastRan = Date.now());
6
- }, Math.max(limit - (Date.now() - lastRan), 0))) : (func.apply(this, args), lastRan = Date.now(), inThrottle = !0);
7
- };
8
- }
9
- export {
10
- throttle as t
11
- };
@@ -1,62 +0,0 @@
1
- function debounceId(identifier, func, delay) {
2
- const debouncedFunctions = {};
3
- return function(...args) {
4
- debouncedFunctions[identifier] || (debouncedFunctions[identifier] = { timer: null, promise: null });
5
- const debounced = debouncedFunctions[identifier];
6
- return debounced.timer && clearTimeout(debounced.timer), debounced.promise = new Promise((resolve, reject) => {
7
- debounced.timer = setTimeout(async () => {
8
- try {
9
- resolve(await func(...args));
10
- } catch (error) {
11
- reject(error);
12
- } finally {
13
- delete debouncedFunctions[identifier];
14
- }
15
- }, delay);
16
- }), debounced.promise;
17
- };
18
- }
19
- function isPrimitive(value) {
20
- return value == null || typeof value == "string" || typeof value == "number" || typeof value == "boolean" || typeof value == "symbol" || typeof value == "bigint";
21
- }
22
- function isEqualArrays(a, b) {
23
- if (a.length !== b.length)
24
- return !1;
25
- for (const [i, element] of a.entries())
26
- if (!isEqual(element, b[i]))
27
- return !1;
28
- return !0;
29
- }
30
- function isEqualObjects(a, b) {
31
- const keysA = Object.keys(a), keysB = Object.keys(b);
32
- if (keysA.length !== keysB.length)
33
- return !1;
34
- for (const key of keysA)
35
- if (!keysB.includes(key) || !isEqual(a[key], b[key]))
36
- return !1;
37
- return !0;
38
- }
39
- function isEqual(a, b) {
40
- return isPrimitive(a) || isPrimitive(b) ? a === b : a instanceof Date && b instanceof Date ? a.getTime() === b.getTime() : typeof a != typeof b || Array.isArray(a) !== Array.isArray(b) ? !1 : Array.isArray(a) && Array.isArray(b) ? isEqualArrays(a, b) : typeof a == "object" && typeof b == "object" ? isEqualObjects(a, b) : !1;
41
- }
42
- function throttleId(identifier, func, interval) {
43
- const state = {};
44
- return async (...args) => {
45
- const now = Date.now();
46
- return state[identifier] || (state[identifier] = { promise: null, lastCall: 0, lastArgs: [] }), now - state[identifier].lastCall >= interval ? (state[identifier].lastCall = now, func(...args)) : (state[identifier].lastArgs = args, state[identifier].promise || (state[identifier].promise = new Promise((resolve) => {
47
- setTimeout(
48
- async () => {
49
- state[identifier].lastCall = Date.now();
50
- const result = await func(...state[identifier].lastArgs);
51
- state[identifier].promise = null, resolve(result);
52
- },
53
- interval - (now - state[identifier].lastCall)
54
- );
55
- })), state[identifier].promise);
56
- };
57
- }
58
- export {
59
- debounceId as d,
60
- isEqual as i,
61
- throttleId as t
62
- };
@@ -1,50 +0,0 @@
1
- import { i as isClient } from "./isClient.WI4oSt66.js";
2
- class UserVisibility {
3
- constructor(callback, options) {
4
- this.callback = callback, this.options = {
5
- ...this.defaultOptions,
6
- ...options
7
- }, this.eventHandlerFunction = this.eventHandler.bind(this), isClient() && this.start();
8
- }
9
- eventHandlerFunction;
10
- event = "visibilitychange";
11
- timeoutHandler;
12
- options;
13
- defaultOptions = {
14
- timeout: 5e3,
15
- once: !1,
16
- immediate: !0
17
- };
18
- isVisible = !1;
19
- start() {
20
- if (!isClient()) {
21
- console.warn("[UserVisibility](start) you should run this method on client side");
22
- return;
23
- }
24
- this.options.immediate && this.emitCallback(), this.addEventListener();
25
- }
26
- emitCallback() {
27
- this.isVisible = document.visibilityState === "visible", this.callback({ isVisible: this.isVisible }), this.options.once && this.destroy();
28
- }
29
- eventHandler() {
30
- document.visibilityState === "visible" && !this.isVisible ? (this.clearTimeout(), this.emitCallback()) : document.visibilityState === "hidden" && this.initTimeout();
31
- }
32
- clearTimeout() {
33
- this.timeoutHandler && (clearTimeout(this.timeoutHandler), this.timeoutHandler = void 0);
34
- }
35
- initTimeout() {
36
- this.clearTimeout(), this.timeoutHandler = setTimeout(this.emitCallback.bind(this), this.options.timeout);
37
- }
38
- addEventListener() {
39
- document.addEventListener(this.event, this.eventHandlerFunction);
40
- }
41
- removeEventListener() {
42
- document.removeEventListener(this.event, this.eventHandlerFunction);
43
- }
44
- destroy() {
45
- this.removeEventListener(), this.timeoutHandler && clearTimeout(this.timeoutHandler);
46
- }
47
- }
48
- export {
49
- UserVisibility as U
50
- };
@@ -1,23 +0,0 @@
1
- import { createElementBlock, openBlock, createElementVNode } from "vue";
2
- const _hoisted_1 = {
3
- xmlns: "http://www.w3.org/2000/svg",
4
- width: "1em",
5
- height: "1em",
6
- fill: "none",
7
- viewBox: "0 0 24 24"
8
- };
9
- function render(_ctx, _cache) {
10
- return openBlock(), createElementBlock("svg", _hoisted_1, _cache[0] || (_cache[0] = [
11
- createElementVNode("path", {
12
- stroke: "currentColor",
13
- "stroke-linecap": "round",
14
- "stroke-linejoin": "round",
15
- "stroke-width": "1.5",
16
- d: "M6 18 18 6M6 6l12 12"
17
- }, null, -1)
18
- ]));
19
- }
20
- const XMark = { render };
21
- export {
22
- XMark as X
23
- };
@@ -1,116 +0,0 @@
1
- import { InjectionKey } from 'vue';
2
- import { BaseFormPayload, CustomInstance, ExtractModelKey, FieldsStates, FieldState, FormContext, FormFieldOptions, FormSchema, StrictOptions, ValidationIssues } from './types';
3
- export declare function fieldHasValidation<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>>>(field: ModelKey, schema: FormSchema<Model>): boolean;
4
- export declare function scrollToError(selector?: string): void;
5
- export declare function getErrorMessages<Model extends BaseFormPayload = BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>(errors: Record<ModelKey, ValidationIssues>, fieldsStates: FieldsStates<Model>): Record<ModelKey, string | undefined>;
6
- export declare function isEmptyValue(value: unknown): value is null | undefined | '';
7
- export declare function getValidateFunction<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>({ name, hasValidation, debouncedFields, throttledFields, }: {
8
- name: ModelKey;
9
- hasValidation: boolean;
10
- debouncedFields?: StrictOptions<Model>['debouncedFields'];
11
- throttledFields?: StrictOptions<Model>['throttledFields'];
12
- }): ((args_0: {
13
- name: ExtractModelKey<FormSchema<Model>>;
14
- fieldState: FieldState<Model, Model[Extract<keyof { [K in Extract<keyof Model, string> as Model[K] extends Required<Model>[K] ? K : never]: import('./types').ValidationAsync; }, string> | Extract<keyof { [K_1 in Extract<keyof Model, string> as Model[K_1] extends Required<Model>[K_1] ? never : K_1]?: import('./types').ValidationAsync | undefined; }, string>]>;
15
- schema: FormSchema<Model>;
16
- payload: Model;
17
- setError?: boolean;
18
- setErrorIfInvalidAndNotEmpty?: boolean;
19
- }) => Promise<void>) | undefined;
20
- export declare function getFieldState<Model extends BaseFormPayload = BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>({ name, schema, initialValue, fieldState, options, }: {
21
- name: ModelKey;
22
- schema?: FormSchema<Model>;
23
- initialValue?: Model[ModelKey];
24
- fieldState: FieldState<Model>;
25
- options?: Pick<StrictOptions<Model>, 'debouncedFields' | 'throttledFields' | 'mode'>;
26
- }): FieldState<Model>;
27
- export declare function getFieldsStates<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>({ schema, payload, options, }: {
28
- schema: FormSchema<Model>;
29
- payload: Partial<Model>;
30
- options: StrictOptions<Model>;
31
- }): FieldsStates<Model>;
32
- export declare function updateFieldsStates<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>({ fieldsStates, payload, schema, options, updateMode, }: {
33
- fieldsStates: FieldsStates<Model>;
34
- payload: Model;
35
- schema: FormSchema<Model>;
36
- options: StrictOptions<Model>;
37
- updateMode?: boolean;
38
- }): void;
39
- export declare function updateFieldState<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>({ name, fieldState, payload, schema, options, updateMode, }: {
40
- name: ModelKey;
41
- fieldState: FieldState<Model>;
42
- payload: Model;
43
- schema: FormSchema<Model>;
44
- options: FormFieldOptions<Model[ModelKey]> & StrictOptions<Model>;
45
- updateMode?: boolean;
46
- }): FieldState<Model>;
47
- export declare function getFieldsErrors<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>(fieldsStates: FieldsStates<Model>): Record<ModelKey, ValidationIssues>;
48
- export declare function findInteractiveElements(el: HTMLElement): (HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement)[];
49
- export declare function addEventToInteractiveElements({ interactiveElements, onBlur, mode, }: {
50
- interactiveElements: HTMLElement[];
51
- onBlur: () => void;
52
- mode: StrictOptions['mode'];
53
- }): void;
54
- export declare function removeEventFromInteractiveElements({ interactiveElements, onBlur, }: {
55
- interactiveElements: HTMLElement[];
56
- onBlur: () => void;
57
- }): void;
58
- export declare function getFieldValidationResult<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>(name: ModelKey, schema: FormSchema<Model>, value: Model[ModelKey]): Promise<{
59
- result: import('valibot').SafeParseResult<FormSchema<Model>[ModelKey]>;
60
- isValid: boolean;
61
- }>;
62
- export declare function setFieldValidationState<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>({ name, fieldState, schema, payload, setError, setErrorIfInvalidAndNotEmpty, }: {
63
- name: ModelKey;
64
- fieldState: FieldState<Model>;
65
- schema: FormSchema<Model>;
66
- payload: Model;
67
- setError?: boolean;
68
- setErrorIfInvalidAndNotEmpty?: boolean;
69
- }): Promise<void>;
70
- export declare function validateField<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>({ name, fieldState, payload, schema, }: {
71
- name: ModelKey;
72
- fieldState: FieldState<Model>;
73
- payload: Model;
74
- schema: FormSchema<Model>;
75
- }): Promise<void> | undefined;
76
- export declare function validateForm<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>({ fieldsStates, payload, showErrors, schema, }: {
77
- fieldsStates: FieldsStates<Model>;
78
- showErrors?: boolean;
79
- payload: Model;
80
- schema: FormSchema<Model>;
81
- }): Promise<void[]>;
82
- export declare function canExecuteValidation<Model extends BaseFormPayload>({ eventName, fieldState, isSubmitted, }: {
83
- eventName: 'blur' | 'input';
84
- fieldState: FieldState<Model>;
85
- isSubmitted: boolean;
86
- }): boolean;
87
- export declare function handleFieldBlur<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>({ name, force, payload, fieldState, schema, isSubmitted, }: {
88
- name: ModelKey;
89
- payload: Model;
90
- fieldState: FieldState<Model>;
91
- schema: FormSchema<Model>;
92
- isSubmitted: boolean;
93
- force?: boolean;
94
- }): Promise<void> | undefined;
95
- export declare function handleFieldInput<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>({ name, payload, fieldState, schema, isSubmitted, forceValidation, }: {
96
- name: ModelKey;
97
- payload: Model;
98
- fieldState: FieldState<Model>;
99
- schema: FormSchema<Model>;
100
- isSubmitted: boolean;
101
- forceValidation?: boolean;
102
- }): Promise<void> | undefined;
103
- export declare function getInstance<Model extends BaseFormPayload>(composableName: string): CustomInstance<Model>;
104
- export declare function getContext<Model extends BaseFormPayload>(identifier: string | symbol | InjectionKey<FormContext<Model>>, composableName: string): FormContext<Model, Extract<keyof { [K in Extract<keyof Model, string> as Model[K] extends Required<Model>[K] ? K : never]: import('./types').ValidationAsync; }, string> | Extract<keyof { [K_1 in Extract<keyof Model, string> as Model[K_1] extends Required<Model>[K_1] ? never : K_1]?: import('./types').ValidationAsync | undefined; }, string>>;
105
- export declare function getValidationEvents<Model extends BaseFormPayload>({ hasRef, fieldState, onBlur, }: {
106
- hasRef?: boolean;
107
- fieldState: FieldState<Model>;
108
- onBlur: () => void;
109
- }): {
110
- onBlur: () => void;
111
- } | undefined;
112
- type Valibot = typeof import('valibot');
113
- export declare function getValibotValidationMethod<MethodName extends keyof Valibot>(methodName: MethodName): Promise<Valibot[MethodName]>;
114
- export declare function getValidationSchema<Model extends BaseFormPayload>(formSchema: FormSchema<Model>): Promise<import('valibot').ObjectSchemaAsync<FormSchema<Model>, undefined>>;
115
- export declare function hasModeIncludes(modes: StrictOptions['mode'][], value?: StrictOptions['mode']): value is StrictOptions['mode'];
116
- export {};