maz-ui 4.0.0-beta.1 → 4.0.0-beta.10
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/dist/assets/MazAccordion.DUQCf8vy.css +1 -0
- package/dist/assets/{MazAnimatedCounter.CTG-PC5W.css → MazAnimatedCounter.DkZNPRLp.css} +1 -1
- package/dist/assets/MazAnimatedText.DDqCxrFX.css +1 -0
- package/dist/assets/MazBackdrop.BnhcmjbP.css +1 -0
- package/dist/assets/{MazBtn.BnRxVlqS.css → MazBtn.DUBbj2mt.css} +1 -1
- package/dist/assets/{MazCardSpotlight.Dy-wuLQq.css → MazCardSpotlight.IbPp_y0j.css} +1 -1
- package/dist/assets/MazCheckbox.CFqw9ybT.css +1 -0
- package/dist/assets/MazChecklist.BzF5KtZ3.css +1 -0
- package/dist/assets/MazDatePicker.8GyrtM-j.css +1 -0
- package/dist/assets/{MazDropzone.DafxQwbq.css → MazDropzone.-8lzCrxJ.css} +1 -1
- package/dist/assets/MazInput.BcUsJg7p.css +1 -0
- package/dist/assets/MazInputPhoneNumber.CrXS7DOY.css +1 -0
- package/dist/assets/MazInputTags.DzTGy9z3.css +1 -0
- package/dist/assets/MazLazyImg.NlPRN3Nk.css +1 -0
- package/dist/assets/MazLink.wJoKRsCP.css +1 -0
- package/dist/assets/MazPickerCalendarMonth.Boe_8k4x.css +1 -0
- package/dist/assets/MazPickerMonthSwitcher.CszcpCcY.css +1 -0
- package/dist/assets/{MazPickerYearSwitcher.Dl30Dwor.css → MazPickerYearSwitcher.Cn-nS-Vv.css} +1 -1
- package/dist/assets/MazPopover.DzCAfuWw.css +1 -0
- package/dist/assets/MazPullToRefresh.BQ64UvzA.css +1 -0
- package/dist/assets/MazRadio.XGYnbTuB.css +1 -0
- package/dist/assets/MazReadingProgressBar.CwBVXE3g.css +1 -0
- package/dist/assets/MazSelect.Cljh3PVV.css +1 -0
- package/dist/assets/{MazSelectCountry.D2Qudf0K.css → MazSelectCountry.CdNTQPhr.css} +1 -1
- package/dist/assets/{MazSlider.D5SgmZLH.css → MazSlider.y4qpnD0N.css} +1 -1
- package/dist/assets/{MazStepper.DYMde9uq.css → MazStepper.DtWZmm-f.css} +1 -1
- package/dist/assets/MazSwitch.Bxmh2iFj.css +1 -0
- package/dist/assets/{MazTable.B1tkeUfE.css → MazTable.DMlQdImb.css} +1 -1
- package/dist/assets/{MazTabsBar.B9N_jdqU.css → MazTabsBar.gcS2Fc-B.css} +1 -1
- package/dist/assets/MazTextarea.DME7BHS5.css +1 -0
- package/dist/assets/{PhoneInput.CyWO76iq.css → PhoneInput.DBLH22G1.css} +1 -1
- package/dist/assets/{fullscreen-img.pvt6196l.css → fullscreen-img.Bkuz1GOX.css} +1 -1
- package/dist/assets/{toast.kunueRvo.css → toast.CC2VQab8.css} +1 -1
- package/dist/chunks/{MazDatePicker.CT5yJhSN.js → MazDatePicker.De3Ltb2F.js} +29 -31
- package/dist/chunks/{MazDialogPromise.vue_vue_type_script_setup_true_lang.BQvDEofz.js → MazDialogConfirm.vue_vue_type_script_setup_true_lang.Grn2kB3x.js} +78 -18
- package/dist/chunks/{MazDropdown.vue_vue_type_style_index_0_lang.abk1IbMX.js → MazDropdown.vue_vue_type_style_index_0_lang.BES3jpuw.js} +12 -22
- package/dist/chunks/{MazInputPhoneNumber.Uwhn1Q9j.js → MazInputPhoneNumber.DBncAmC5.js} +14 -12
- 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
- package/dist/chunks/{MazPickerCalendar.RS6ZMdDK.js → MazPickerCalendar.DKXNI8O4.js} +1 -1
- package/dist/chunks/{MazPickerCalendarMonth.hQBSVkc9.js → MazPickerCalendarMonth.DKBqgrNp.js} +5 -5
- package/dist/chunks/{MazPickerCalendarSwitcher.Cp2ux3E4.js → MazPickerCalendarSwitcher.CzIZol3Z.js} +1 -1
- package/dist/chunks/{MazPickerContainer.DnfB3Dqg.js → MazPickerContainer.Mrh-Q52I.js} +1 -1
- package/dist/chunks/{MazPickerHeader.Dlz2yJ1D.js → MazPickerHeader.Bm9vIrtB.js} +1 -1
- package/dist/chunks/{MazPickerMonthSwitcher.BpfCGGxQ.js → MazPickerMonthSwitcher.BSD2GtY6.js} +5 -6
- package/dist/chunks/{MazPickerTime.EuWWNfid.js → MazPickerTime.D0hilq5b.js} +1 -1
- package/dist/chunks/{MazPickerYearSwitcher.D4aO09D3.js → MazPickerYearSwitcher.BIUYJMvj.js} +8 -27
- package/dist/chunks/{MazSwitch.vue_vue_type_style_index_0_lang.DnCjlD6D.js → MazSwitch.vue_vue_type_style_index_0_lang.CU43Y1ky.js} +2 -2
- package/dist/chunks/{MazTable.vue_vue_type_script_setup_true_lang.bm7ng8fK.js → MazTable.vue_vue_type_script_setup_true_lang.BcTw9Tyh.js} +3 -3
- package/dist/chunks/{PhoneInput.CPjyZ8Sq.js → PhoneInput.iFkRoIFk.js} +5 -4
- package/dist/chunks/{utils.BBuYjMbK.js → dom-events.Bbe7wDQl.js} +221 -115
- package/dist/chunks/{en.BzBlrE0C.js → en.Q_4-KljL.js} +12 -0
- package/dist/chunks/{fullscreen-img.directive.CyOHexcO.js → fullscreen-img.directive.Be383en8.js} +2 -2
- package/dist/chunks/{lazy-img.directive.D5zCo3Zi.js → lazy-img.directive.BLFnGqQa.js} +1 -1
- package/dist/chunks/{normalizeString.CFe2M8S_.js → useStringMatching.D5UvsCUS.js} +40 -1
- package/dist/chunks/{useTranslations.BXuww4ux.js → useTranslations.D5aoYwD7.js} +1 -1
- package/dist/chunks/vClickOutside.DIOiluy0.js +107 -0
- package/dist/components/MazAccordion.js +2 -2
- package/dist/components/MazAnimatedCounter.js +3 -3
- package/dist/components/MazAnimatedText.js +2 -2
- package/dist/components/MazBackdrop.js +3 -3
- package/dist/components/MazBtn.js +5 -4
- package/dist/components/MazCardSpotlight.js +4 -4
- package/dist/components/MazCarousel.js +1 -1
- package/dist/components/MazCheckbox.js +10 -12
- package/dist/components/MazChecklist.js +4 -5
- package/dist/components/MazDatePicker.js +1 -1
- package/dist/components/MazDialogConfirm.js +6 -0
- package/dist/components/MazDropdown.js +1 -1
- package/dist/components/MazDropzone.js +5 -5
- package/dist/components/MazGallery.js +2 -2
- package/dist/components/MazInput.js +21 -16
- package/dist/components/MazInputPhoneNumber.js +1 -1
- package/dist/components/MazInputPrice.js +1 -1
- package/dist/components/MazInputTags.js +2 -2
- package/dist/components/MazLazyImg.js +9 -9
- package/dist/components/MazLink.js +9 -5
- package/dist/components/MazPagination.js +1 -1
- package/dist/components/MazPopover.js +175 -88
- package/dist/components/MazPullToRefresh.js +8 -3
- package/dist/components/MazRadio.js +8 -16
- package/dist/components/MazReadingProgressBar.js +10 -3
- package/dist/components/MazSelect.js +24 -14
- package/dist/components/MazSelectCountry.js +15 -9
- package/dist/components/MazSlider.js +2 -2
- package/dist/components/MazStepper.js +2 -2
- package/dist/components/MazSwitch.js +1 -1
- package/dist/components/MazTable.js +3 -3
- package/dist/components/MazTableCell.js +1 -1
- package/dist/components/MazTableRow.js +1 -1
- package/dist/components/MazTableTitle.js +1 -1
- package/dist/components/MazTabsBar.js +6 -6
- package/dist/components/MazTextarea.js +24 -3
- package/dist/components/index.js +8 -8
- package/dist/composables/index.js +2 -2
- package/dist/composables/useAos.js +1 -1
- package/dist/composables/useDialog.js +1 -1
- package/dist/composables/useDisplayNames.js +7 -1
- package/dist/composables/useDropzone.js +6 -6
- package/dist/composables/useFormField.js +15 -19
- package/dist/composables/useFormValidator.js +41 -28
- package/dist/composables/useIdleTimeout.js +108 -1
- package/dist/composables/useInjectStrict.js +2 -2
- package/dist/composables/useStringMatching.js +3 -40
- package/dist/composables/useSwipe.js +77 -1
- package/dist/composables/useToast.js +1 -1
- package/dist/composables/useUserVisibility.js +47 -1
- package/dist/composables/useWait.js +1 -1
- package/dist/composables/useWindowSize.js +1 -1
- package/dist/css/main.css +1 -1
- package/dist/directives/index.js +7 -7
- package/dist/directives/vClickOutside.js +4 -102
- package/dist/directives/vFullscreenImg.js +1 -1
- package/dist/directives/vLazyImg.js +2 -2
- package/dist/directives/vTooltip.js +97 -60
- package/dist/index.js +1 -114
- package/dist/plugins/dialog.js +3 -3
- package/dist/plugins/maz-ui.js +123 -119
- package/dist/plugins/toast.js +8 -11
- package/dist/resolvers/MazComponentsResolver.js +7 -1
- package/dist/resolvers/MazModulesResolver.js +1 -0
- package/dist/tailwindcss/tailwind.config.js +5 -2
- package/dist/tailwindcss/variables/design-tokens.js +3 -0
- package/dist/types/components/MazAccordion.vue.d.ts +15 -2
- package/dist/types/components/MazBtn.vue.d.ts +1 -0
- package/dist/types/components/MazCheckbox.vue.d.ts +0 -6
- package/dist/types/components/MazChecklist.vue.d.ts +1 -1
- package/dist/types/components/MazDatePicker.vue.d.ts +15 -23
- package/dist/types/components/MazDialogConfirm/useMazDialogConfirm.d.ts +47 -0
- package/dist/types/components/{MazDialogPromise.vue.d.ts → MazDialogConfirm.vue.d.ts} +42 -9
- package/dist/types/components/MazDropdown.vue.d.ts +11 -11
- package/dist/types/components/MazInput.vue.d.ts +7 -0
- package/dist/types/components/MazInputNumber.vue.d.ts +1 -1
- package/dist/types/components/MazInputPhoneNumber/useLibphonenumber.d.ts +2 -2
- package/dist/types/components/MazInputPhoneNumber/useMazInputPhoneNumber.d.ts +6 -2
- package/dist/types/components/MazInputPhoneNumber.vue.d.ts +38 -15
- package/dist/types/components/MazLazyImg.vue.d.ts +8 -8
- package/dist/types/components/MazLink.vue.d.ts +11 -0
- package/dist/types/components/MazPopover.vue.d.ts +18 -15
- package/dist/types/components/MazSelect.vue.d.ts +1 -1
- package/dist/types/components/MazSelectCountry.vue.d.ts +12 -3
- package/dist/types/components/MazStepper.vue.d.ts +13 -2
- package/dist/types/components/MazTable.vue.d.ts +63 -2
- package/dist/types/components/index.d.ts +4 -4
- package/dist/types/composables/index.d.ts +1 -1
- package/dist/types/composables/useDisplayNames.d.ts +2 -2
- package/dist/types/composables/useDropzone.d.ts +3 -3
- package/dist/types/composables/useFormField.d.ts +5 -43
- package/dist/types/composables/useFormValidator/dom-events.d.ts +19 -0
- package/dist/types/composables/useFormValidator/state-management.d.ts +54 -0
- package/dist/types/composables/useFormValidator/types.d.ts +8 -20
- package/dist/types/composables/useFormValidator/validation.d.ts +43 -0
- package/dist/types/composables/useFormValidator.d.ts +16 -10
- package/dist/types/composables/useIdleTimeout.d.ts +1 -1
- package/dist/types/composables/useInjectStrict.d.ts +1 -1
- package/dist/types/composables/useSwipe.d.ts +1 -1
- package/dist/types/composables/useUserVisibility.d.ts +1 -1
- package/dist/types/directives/vClickOutside.d.ts +11 -18
- package/dist/types/directives/vFullscreenImg/fullscreen-img.directive.d.ts +3 -5
- package/dist/types/directives/vFullscreenImg.d.ts +9 -4
- package/dist/types/directives/vLazyImg/lazy-img.directive.d.ts +3 -5
- package/dist/types/directives/vLazyImg.d.ts +11 -6
- package/dist/types/directives/vTooltip.d.ts +14 -14
- package/dist/types/directives/vZoomImg/zoom-img.directive.d.ts +2 -0
- package/dist/types/directives/vZoomImg.d.ts +9 -5
- package/dist/types/index.d.ts +1 -1
- package/dist/types/plugins/aos.d.ts +30 -4
- package/dist/types/plugins/dialog/DialogHandler.d.ts +2 -2
- package/dist/types/plugins/dialog.d.ts +2 -4
- package/dist/types/plugins/maz-ui.d.ts +2 -63
- package/dist/types/plugins/toast.d.ts +2 -4
- package/dist/types/plugins/wait.d.ts +2 -3
- package/dist/types/tailwindcss/tailwind.config.d.ts +5 -0
- package/dist/types/tailwindcss/variables/design-tokens.d.ts +3 -0
- package/package.json +35 -32
- package/dist/assets/MazAccordion.esK3rR4p.css +0 -1
- package/dist/assets/MazAnimatedText.BrOwWuqf.css +0 -1
- package/dist/assets/MazBackdrop.DNpnLh63.css +0 -1
- package/dist/assets/MazCheckbox.C_qIngLy.css +0 -1
- package/dist/assets/MazChecklist.CWK_Gl-t.css +0 -1
- package/dist/assets/MazDatePicker.V5JwKPrQ.css +0 -1
- package/dist/assets/MazInput.DW2KOJHY.css +0 -1
- package/dist/assets/MazInputPhoneNumber.vpA2mrZn.css +0 -1
- package/dist/assets/MazInputTags.B_s9J3sw.css +0 -1
- package/dist/assets/MazLazyImg.BNaVtpfX.css +0 -1
- package/dist/assets/MazLink.CCfbrUs0.css +0 -1
- package/dist/assets/MazPickerCalendarMonth.zkrPVHDv.css +0 -1
- package/dist/assets/MazPickerMonthSwitcher.168v7Hs1.css +0 -1
- package/dist/assets/MazPopover.Bth9NWia.css +0 -1
- package/dist/assets/MazPullToRefresh.DABqbGtK.css +0 -1
- package/dist/assets/MazRadio.DKMFWwy_.css +0 -1
- package/dist/assets/MazReadingProgressBar.n1Is8_Y3.css +0 -1
- package/dist/assets/MazSelect.DZZpDg8z.css +0 -1
- package/dist/assets/MazSwitch.Z1ZMm7tx.css +0 -1
- package/dist/assets/MazTextarea.Dz11mUeK.css +0 -1
- package/dist/chunks/TextareaAutogrow.C22LQx0k.js +0 -25
- package/dist/chunks/debounceCallback.B69vn57Q.js +0 -7
- package/dist/chunks/formatCurrency.C8NzW9Ii.js +0 -34
- package/dist/chunks/formatDate.DZ_OzdnV.js +0 -21
- package/dist/chunks/getCountryFlagUrl.dQjriBXx.js +0 -9
- package/dist/chunks/idleTimeout.-ICpdeGV.js +0 -111
- package/dist/chunks/isServer.BokzeB-Q.js +0 -6
- package/dist/chunks/isStandaloneMode.BpUpOTbA.js +0 -10
- package/dist/chunks/pascalCase.D_nuQ66I.js +0 -11
- package/dist/chunks/swipeHandler.8emelhOL.js +0 -80
- package/dist/chunks/throttle.DN8ARw0a.js +0 -11
- package/dist/chunks/throttleId.7PhWZjcS.js +0 -62
- package/dist/chunks/userVisibility.BbQSJASv.js +0 -50
- package/dist/chunks/x-mark.CTalOvvY.js +0 -23
- package/dist/components/MazDialogPromise.js +0 -6
- package/dist/types/components/MazDialogPromise/useMazDialogPromise.d.ts +0 -54
- package/dist/types/components/MazInputPhoneNumber/types.d.ts +0 -22
- package/dist/types/composables/useFormValidator/utils.d.ts +0 -116
|
@@ -47,15 +47,15 @@ declare function __VLS_template(): {
|
|
|
47
47
|
};
|
|
48
48
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
49
49
|
declare const __VLS_component: import('vue').DefineComponent<MazLazyImgProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
50
|
-
error: (el:
|
|
51
|
-
loaded: (el:
|
|
52
|
-
loading: (el:
|
|
53
|
-
intersecting: (el:
|
|
50
|
+
error: (el: Element) => any;
|
|
51
|
+
loaded: (el: Element) => any;
|
|
52
|
+
loading: (el: Element) => any;
|
|
53
|
+
intersecting: (el: Element) => any;
|
|
54
54
|
}, string, import('vue').PublicProps, Readonly<MazLazyImgProps> & Readonly<{
|
|
55
|
-
onError?: ((el:
|
|
56
|
-
onLoaded?: ((el:
|
|
57
|
-
onLoading?: ((el:
|
|
58
|
-
onIntersecting?: ((el:
|
|
55
|
+
onError?: ((el: Element) => any) | undefined;
|
|
56
|
+
onLoaded?: ((el: Element) => any) | undefined;
|
|
57
|
+
onLoading?: ((el: Element) => any) | undefined;
|
|
58
|
+
onIntersecting?: ((el: Element) => any) | undefined;
|
|
59
59
|
}>, {
|
|
60
60
|
src: MazImage | null;
|
|
61
61
|
style: string | false | import('vue').CSSProperties | import('vue').StyleValue[] | null;
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import { IconComponent } from '@maz-ui/icons';
|
|
2
2
|
import { RouteLocationRaw } from 'vue-router';
|
|
3
3
|
import { MazColor } from './types';
|
|
4
|
+
import { HTMLAttributes } from 'vue';
|
|
4
5
|
export interface MazLinkProps {
|
|
6
|
+
/**
|
|
7
|
+
* The class attribute of the link
|
|
8
|
+
* @default undefined
|
|
9
|
+
*/
|
|
10
|
+
class?: HTMLAttributes['class'];
|
|
11
|
+
/**
|
|
12
|
+
* The style attribute of the link
|
|
13
|
+
* @default undefined
|
|
14
|
+
*/
|
|
15
|
+
style?: HTMLAttributes['style'];
|
|
5
16
|
/**
|
|
6
17
|
* The component to use for the link - if not provided, it will be `router-link` if `to` is provided, will be `a` if `href` is provided, otherwise it will be `button`, you can force the component to be used with `as` prop
|
|
7
18
|
* @default depends on the provided props
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'vue';
|
|
2
2
|
import { MazColor } from './types';
|
|
3
3
|
type __VLS_Props = MazPopoverProps;
|
|
4
|
-
export type
|
|
5
|
-
export type
|
|
6
|
-
export type
|
|
4
|
+
export type MazPopoverPosition = 'auto' | 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end' | 'right-start' | 'right-end';
|
|
5
|
+
export type MazPopoverTrigger = 'click' | 'hover' | 'manual' | 'adaptive';
|
|
6
|
+
export type MazPopoverRole = 'dialog' | 'tooltip' | 'menu';
|
|
7
7
|
export interface MazPopoverProps {
|
|
8
8
|
/**
|
|
9
9
|
* Controls the popover open state
|
|
@@ -18,35 +18,35 @@ export interface MazPopoverProps {
|
|
|
18
18
|
* @default auto
|
|
19
19
|
* @description Position of the popover relative to trigger
|
|
20
20
|
*/
|
|
21
|
-
position?:
|
|
21
|
+
position?: MazPopoverPosition;
|
|
22
22
|
/**
|
|
23
23
|
* Preferred position of the popover relative to trigger when auto position is used
|
|
24
24
|
* @values auto, top, bottom, left, right, top-start, top-end, bottom-start, bottom-end, left-start, left-end, right-start, right-end
|
|
25
25
|
* @default 'bottom-start'
|
|
26
26
|
* @description Preferred position of the popover relative to trigger
|
|
27
27
|
*/
|
|
28
|
-
preferPosition?:
|
|
28
|
+
preferPosition?: MazPopoverPosition;
|
|
29
29
|
/**
|
|
30
30
|
* Fallback position of the popover relative to trigger when prefer position is not visible
|
|
31
31
|
* @values auto, top, bottom, left, right, top-start, top-end, bottom-start, bottom-end, left-start, left-end, right-start, right-end
|
|
32
32
|
* @default auto
|
|
33
33
|
* @description Fallback position of the popover relative to trigger
|
|
34
34
|
*/
|
|
35
|
-
fallbackPosition?:
|
|
35
|
+
fallbackPosition?: MazPopoverPosition;
|
|
36
36
|
/**
|
|
37
37
|
* How the popover is triggered
|
|
38
|
-
* @values click, hover, manual
|
|
38
|
+
* @values click, hover, manual, adaptive
|
|
39
39
|
* @default click
|
|
40
|
-
* @description How the popover is triggered
|
|
40
|
+
* @description How the popover is triggered. 'adaptive' uses hover on desktop and click on mobile
|
|
41
41
|
*/
|
|
42
|
-
trigger?:
|
|
42
|
+
trigger?: MazPopoverTrigger;
|
|
43
43
|
/**
|
|
44
44
|
* ARIA role for accessibility
|
|
45
45
|
* @values dialog, tooltip
|
|
46
46
|
* @default dialog
|
|
47
47
|
* @description ARIA role for accessibility
|
|
48
48
|
*/
|
|
49
|
-
role?:
|
|
49
|
+
role?: MazPopoverRole;
|
|
50
50
|
/**
|
|
51
51
|
* ARIA label for the popover
|
|
52
52
|
* @default undefined
|
|
@@ -155,11 +155,14 @@ export interface MazPopoverProps {
|
|
|
155
155
|
*/
|
|
156
156
|
block?: boolean;
|
|
157
157
|
/**
|
|
158
|
-
*
|
|
159
|
-
* @description
|
|
160
|
-
*
|
|
158
|
+
* CSS selector or element reference to use for positioning calculations
|
|
159
|
+
* @description When provided, the popover will position relative to this element instead of the trigger
|
|
160
|
+
* Useful for components with labels where you want to position relative to the actual input
|
|
161
|
+
* @type {string | HTMLElement}
|
|
162
|
+
* @default undefined
|
|
163
|
+
* @example "input" or "#my-input" or HTMLElement
|
|
161
164
|
*/
|
|
162
|
-
|
|
165
|
+
positionReference?: string | HTMLElement;
|
|
163
166
|
}
|
|
164
167
|
declare function updatePosition(): void;
|
|
165
168
|
declare function open(): void;
|
|
@@ -212,7 +215,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
|
|
|
212
215
|
toggle: typeof toggle;
|
|
213
216
|
/**
|
|
214
217
|
* Check if the popover is open
|
|
215
|
-
* @type {
|
|
218
|
+
* @type {ComputedRef<boolean>}
|
|
216
219
|
* @description Reactive reference to the popover open state
|
|
217
220
|
* @usage `const isPopoverOpen = mazPopoverInstance.value?.isOpen`
|
|
218
221
|
*/
|
|
@@ -11,7 +11,7 @@ export interface MazSelectOptionWithOptGroup {
|
|
|
11
11
|
options: (MazSelectNormalizedOption | string | number | boolean)[];
|
|
12
12
|
}
|
|
13
13
|
export type MazSelectOption = MazSelectNormalizedOption | string | number | boolean | MazSelectOptionWithOptGroup;
|
|
14
|
-
export interface MazSelectProps<Value extends MazInputValue, Option extends MazSelectOption, Multiple extends boolean> {
|
|
14
|
+
export interface MazSelectProps<Value extends MazInputValue = MazInputValue, Option extends MazSelectOption = MazSelectOption, Multiple extends boolean = false> {
|
|
15
15
|
/**
|
|
16
16
|
* Style attribut of the component root element
|
|
17
17
|
* @type {HTMLAttributes['style']}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { MazTranslationsNestedSchema } from '@maz-ui/translations/src/types.js';
|
|
2
2
|
import { HTMLAttributes } from 'vue';
|
|
3
|
-
import {
|
|
3
|
+
import { MazPopoverPosition } from './MazPopover.vue';
|
|
4
4
|
import { MazColor, MazSize } from './types';
|
|
5
5
|
import { CodesType, DisplayNameCode, DisplayNamesOptions } from '../composables/useDisplayNames';
|
|
6
6
|
import { MazSelectProps } from './MazSelect.vue';
|
|
7
7
|
export interface MazSelectCountryProps<Option extends {
|
|
8
8
|
name: string;
|
|
9
9
|
code: DisplayNameCode | string;
|
|
10
|
+
} = {
|
|
11
|
+
name: string;
|
|
12
|
+
code: string;
|
|
10
13
|
}> extends Omit<MazSelectProps<Option['code'], Option, false>, 'options' | 'multiple'> {
|
|
11
14
|
/**
|
|
12
15
|
* Style attribut of the component root element
|
|
@@ -54,7 +57,7 @@ export interface MazSelectCountryProps<Option extends {
|
|
|
54
57
|
* @type {PopoverPosition}
|
|
55
58
|
* @default bottom-start
|
|
56
59
|
*/
|
|
57
|
-
listPosition?:
|
|
60
|
+
listPosition?: MazPopoverPosition;
|
|
58
61
|
/**
|
|
59
62
|
* Hide flags
|
|
60
63
|
*/
|
|
@@ -89,7 +92,7 @@ export interface MazSelectCountryProps<Option extends {
|
|
|
89
92
|
*/
|
|
90
93
|
warning?: boolean;
|
|
91
94
|
/**
|
|
92
|
-
*
|
|
95
|
+
*
|
|
93
96
|
*/
|
|
94
97
|
displayCode?: boolean;
|
|
95
98
|
/**
|
|
@@ -124,6 +127,12 @@ export interface MazSelectCountryProps<Option extends {
|
|
|
124
127
|
* @values 'iso' | 'bcp' | 'country' | 'all'
|
|
125
128
|
*/
|
|
126
129
|
codesType?: CodesType;
|
|
130
|
+
/**
|
|
131
|
+
* Open the select
|
|
132
|
+
* @type {boolean}
|
|
133
|
+
* @default false
|
|
134
|
+
*/
|
|
135
|
+
open?: boolean;
|
|
127
136
|
}
|
|
128
137
|
declare const _default: <Option extends {
|
|
129
138
|
name: string;
|
|
@@ -33,13 +33,24 @@ export interface MazStepperProps {
|
|
|
33
33
|
/** Allow to close the steps */
|
|
34
34
|
canCloseSteps?: boolean;
|
|
35
35
|
}
|
|
36
|
-
declare function __VLS_template():
|
|
36
|
+
declare function __VLS_template(): {
|
|
37
|
+
attrs: Partial<{}>;
|
|
38
|
+
slots: Partial<Record<`icon-${number}`, (_: {}) => any>> & Partial<Record<`title-${number}`, (_: {}) => any>> & Partial<Record<`subtitle-${number}`, (_: {}) => any>> & Partial<Record<`title-info-${number}`, (_: {}) => any>> & Partial<Record<`content-${number}`, (_: {
|
|
39
|
+
validated: boolean;
|
|
40
|
+
error: boolean | undefined;
|
|
41
|
+
warning: boolean | undefined;
|
|
42
|
+
nextStep: () => void;
|
|
43
|
+
previousStep: () => void;
|
|
44
|
+
}) => any>>;
|
|
45
|
+
refs: {};
|
|
46
|
+
rootEl: HTMLDivElement;
|
|
47
|
+
};
|
|
37
48
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
38
49
|
declare const __VLS_component: import('vue').DefineComponent<MazStepperProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
39
50
|
"update:model-value": (value: number) => any;
|
|
40
51
|
}, string, import('vue').PublicProps, Readonly<MazStepperProps> & Readonly<{
|
|
41
52
|
"onUpdate:model-value"?: ((value: number) => any) | undefined;
|
|
42
|
-
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {},
|
|
53
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
43
54
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
44
55
|
export default _default;
|
|
45
56
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
@@ -244,10 +244,71 @@ declare const _default: <T extends MazTableRow<T>>(__VLS_props: NonNullable<Awai
|
|
|
244
244
|
readonly "onUpdate:search-query"?: ((searchQuery: string | undefined) => any) | undefined;
|
|
245
245
|
readonly "onUpdate:page"?: ((page: number) => any) | undefined;
|
|
246
246
|
readonly "onUpdate:page-size"?: ((pageSize: number) => any) | undefined;
|
|
247
|
-
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:model-value" | "onUpdate:search-query" | "onUpdate:page" | "onUpdate:page-size"> & MazTableProps<T> &
|
|
247
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:model-value" | "onUpdate:search-query" | "onUpdate:page" | "onUpdate:page-size"> & MazTableProps<T> & Partial<{}>> & import('vue').PublicProps;
|
|
248
248
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
249
249
|
attrs: any;
|
|
250
|
-
slots:
|
|
250
|
+
slots: Partial<Record<`header-label-${string}`, (_: {
|
|
251
|
+
header: {
|
|
252
|
+
label: string;
|
|
253
|
+
key?: string | undefined;
|
|
254
|
+
sortable?: boolean | undefined;
|
|
255
|
+
hidden?: boolean | undefined;
|
|
256
|
+
srOnly?: boolean | undefined;
|
|
257
|
+
width?: string | undefined;
|
|
258
|
+
maxWidth?: string | undefined;
|
|
259
|
+
classes?: ThHTMLAttributes["class"];
|
|
260
|
+
scope?: string | undefined;
|
|
261
|
+
align?: "justify" | "center" | "left" | "right" | "char" | undefined;
|
|
262
|
+
rowspan?: (string | number) | undefined;
|
|
263
|
+
colspan?: (string | number) | undefined;
|
|
264
|
+
headers?: string | undefined;
|
|
265
|
+
thHeaders?: string | undefined;
|
|
266
|
+
sorted?: "ASC" | "DESC" | undefined;
|
|
267
|
+
};
|
|
268
|
+
label: string;
|
|
269
|
+
}) => any>> & Partial<Record<`cell-${string}`, (_: {
|
|
270
|
+
row: T;
|
|
271
|
+
value: any;
|
|
272
|
+
}) => any>> & {
|
|
273
|
+
title?(_: {}): any;
|
|
274
|
+
caption?(_: {}): any;
|
|
275
|
+
thead?(_: {}): any;
|
|
276
|
+
header?(_: {
|
|
277
|
+
header: {
|
|
278
|
+
label: string;
|
|
279
|
+
key?: string | undefined;
|
|
280
|
+
sortable?: boolean | undefined;
|
|
281
|
+
hidden?: boolean | undefined;
|
|
282
|
+
srOnly?: boolean | undefined;
|
|
283
|
+
width?: string | undefined;
|
|
284
|
+
maxWidth?: string | undefined;
|
|
285
|
+
classes?: ThHTMLAttributes["class"];
|
|
286
|
+
scope?: string | undefined;
|
|
287
|
+
align?: "justify" | "center" | "left" | "right" | "char" | undefined;
|
|
288
|
+
rowspan?: (string | number) | undefined;
|
|
289
|
+
colspan?: (string | number) | undefined;
|
|
290
|
+
headers?: string | undefined;
|
|
291
|
+
thHeaders?: string | undefined;
|
|
292
|
+
sorted?: "ASC" | "DESC" | undefined;
|
|
293
|
+
};
|
|
294
|
+
label: string;
|
|
295
|
+
}): any;
|
|
296
|
+
'actions-header'?(_: {}): any;
|
|
297
|
+
default?(_: {}): any;
|
|
298
|
+
select?(_: {
|
|
299
|
+
row: T;
|
|
300
|
+
selected: boolean | undefined;
|
|
301
|
+
}): any;
|
|
302
|
+
cell?(_: {
|
|
303
|
+
row: T;
|
|
304
|
+
value: any;
|
|
305
|
+
}): any;
|
|
306
|
+
actions?(_: {
|
|
307
|
+
row: T;
|
|
308
|
+
}): any;
|
|
309
|
+
'no-results'?(_: {}): any;
|
|
310
|
+
'no-results-text'?(_: {}): any;
|
|
311
|
+
};
|
|
251
312
|
emit: {
|
|
252
313
|
(event: "update:model-value", value: (MazTableRow<T> | string | number | boolean)[] | undefined): void;
|
|
253
314
|
(event: "update:search-query", searchQuery: string | undefined): void;
|
|
@@ -34,12 +34,12 @@ export { default as MazDatePicker } from './MazDatePicker.vue';
|
|
|
34
34
|
export type { MazDatePickerPartialRangeValue, MazDatePickerProps, MazDatePickerRangeValue, MazDatePickerShortcut, MazDatePickerValue } from './MazDatePicker.vue';
|
|
35
35
|
export { default as MazDialog } from './MazDialog.vue';
|
|
36
36
|
export type { MazDialogProps } from './MazDialog.vue';
|
|
37
|
-
export { default as
|
|
38
|
-
export type {
|
|
37
|
+
export { default as MazDialogConfirm, useMazDialogConfirm } from './MazDialogConfirm.vue';
|
|
38
|
+
export type { MazDialogConfirmButton, MazDialogConfirmData, MazDialogConfirmProps } from './MazDialogConfirm.vue';
|
|
39
39
|
export { default as MazDrawer } from './MazDrawer.vue';
|
|
40
40
|
export type { MazDrawerProps } from './MazDrawer.vue';
|
|
41
41
|
export { default as MazDropdown } from './MazDropdown.vue';
|
|
42
|
-
export type { MazDropdownProps } from './MazDropdown.vue';
|
|
42
|
+
export type { MazDropdownMenuItem, MazDropdownProps } from './MazDropdown.vue';
|
|
43
43
|
export { default as MazDropzone } from './MazDropzone.vue';
|
|
44
44
|
export type { MazDropzoneErrorCode, MazDropzoneFileData, MazDropzoneProps } from './MazDropzone.vue';
|
|
45
45
|
export { default as MazExpandAnimation } from './MazExpandAnimation.vue';
|
|
@@ -71,7 +71,7 @@ export type { MazLoadingBarProps } from './MazLoadingBar.vue';
|
|
|
71
71
|
export { default as MazPagination } from './MazPagination.vue';
|
|
72
72
|
export type { MazPaginationProps } from './MazPagination.vue';
|
|
73
73
|
export { default as MazPopover } from './MazPopover.vue';
|
|
74
|
-
export type {
|
|
74
|
+
export type { MazPopoverPosition, MazPopoverProps, MazPopoverRole, MazPopoverTrigger } from './MazPopover.vue';
|
|
75
75
|
export { default as MazPullToRefresh } from './MazPullToRefresh.vue';
|
|
76
76
|
export type { MazPullToRefreshProps } from './MazPullToRefresh.vue';
|
|
77
77
|
export { default as MazRadio } from './MazRadio.vue';
|
|
@@ -4,7 +4,7 @@ export * from './useDialog';
|
|
|
4
4
|
export * from './useDisplayNames';
|
|
5
5
|
export * from './useFormField';
|
|
6
6
|
export * from './useFormValidator';
|
|
7
|
-
export
|
|
7
|
+
export type { FieldsStates, FieldState, FormFieldOptions, FormSchema, FormValidatorOptions, InferOutputSchemaFormValidator, InferSchemaFormValidator } from './useFormValidator/types';
|
|
8
8
|
export * from './useFreezeValue';
|
|
9
9
|
export * from './useIdleTimeout';
|
|
10
10
|
export * from './useInjectStrict';
|
|
@@ -34,8 +34,8 @@ type GetAllDisplayNamesOptions<T extends CodesType> = MaybeRefOrGetter<{
|
|
|
34
34
|
} & DynamicDisplayNamesOptions>;
|
|
35
35
|
type CodeResult<T extends CodesType> = T extends 'iso' ? Iso6391Code : T extends 'bcp' ? Bcp47Code : T extends 'country' ? CountryCode : DisplayNameCode | string;
|
|
36
36
|
export declare function useDisplayNames(mainLocale?: MaybeRefOrGetter<string | DisplayNameCode>): {
|
|
37
|
-
getDisplayName: (code: Parameters<typeof getDisplayName>[0], options
|
|
38
|
-
getAllDisplayNames: <T extends CodesType>(options
|
|
37
|
+
getDisplayName: (code: Parameters<typeof getDisplayName>[0], options?: GetDisplayNameOptions) => import('vue').ComputedRef<string | undefined>;
|
|
38
|
+
getAllDisplayNames: <T extends CodesType>(options?: GetAllDisplayNamesOptions<T>) => import('vue').ComputedRef<{
|
|
39
39
|
name: string;
|
|
40
40
|
code: CodeResult<T>;
|
|
41
41
|
}[] | undefined>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { MaybeRef, MaybeRefOrGetter, Ref } from 'vue';
|
|
2
|
-
export interface
|
|
2
|
+
export interface UseDropzoneReturn {
|
|
3
3
|
files: Ref<File[] | null>;
|
|
4
4
|
isOverDropZone: Ref<boolean>;
|
|
5
5
|
isOverError: Ref<boolean>;
|
|
6
6
|
}
|
|
7
|
-
export interface
|
|
7
|
+
export interface UseDropzoneOptions {
|
|
8
8
|
/**
|
|
9
9
|
* Allowed data types, if not set, all data types are allowed.
|
|
10
10
|
* Also can be a function to check the data types.
|
|
@@ -24,4 +24,4 @@ export interface UseDropZoneOptions {
|
|
|
24
24
|
*/
|
|
25
25
|
preventDefaultForUnhandled?: boolean;
|
|
26
26
|
}
|
|
27
|
-
export declare function
|
|
27
|
+
export declare function useDropzone(target: MaybeRefOrGetter<HTMLElement | null | undefined>, options?: UseDropzoneOptions | UseDropzoneOptions['onDrop']): UseDropzoneReturn;
|
|
@@ -1,56 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { getValidationEvents } from '
|
|
1
|
+
import { BaseFormPayload, ExtractModelKey, FormFieldOptions, FormSchema, ValidationIssues } from './useFormValidator/types';
|
|
2
|
+
import { ComputedRef, Ref } from 'vue';
|
|
3
|
+
import { getValidationEvents } from './useFormValidator/dom-events';
|
|
4
4
|
interface UseFormFieldReturn<FieldType> {
|
|
5
|
-
/**
|
|
6
|
-
* Indicates if the field has an error
|
|
7
|
-
*/
|
|
8
5
|
hasError: ComputedRef<boolean>;
|
|
9
|
-
/**
|
|
10
|
-
* Errors of the field
|
|
11
|
-
*/
|
|
12
6
|
errors: ComputedRef<ValidationIssues>;
|
|
13
|
-
/**
|
|
14
|
-
* Error message of the field
|
|
15
|
-
* It's the first error of the field
|
|
16
|
-
*/
|
|
17
7
|
errorMessage: ComputedRef<string | undefined>;
|
|
18
|
-
/**
|
|
19
|
-
* Indicates if the field is valid
|
|
20
|
-
*/
|
|
21
8
|
isValid: ComputedRef<boolean>;
|
|
22
|
-
/**
|
|
23
|
-
* Indicates if the field has been modified
|
|
24
|
-
*/
|
|
25
9
|
isDirty: ComputedRef<boolean>;
|
|
26
|
-
/**
|
|
27
|
-
* Indicates if the field has been blurred
|
|
28
|
-
*/
|
|
29
10
|
isBlurred: ComputedRef<boolean>;
|
|
30
|
-
/**
|
|
31
|
-
* Indicates if the field has been validated
|
|
32
|
-
*/
|
|
33
11
|
isValidated: ComputedRef<boolean>;
|
|
34
|
-
/**
|
|
35
|
-
* Indicates if the field is validating
|
|
36
|
-
*/
|
|
37
12
|
isValidating: ComputedRef<boolean>;
|
|
38
|
-
/**
|
|
39
|
-
* Validation mode of the field
|
|
40
|
-
*/
|
|
41
13
|
mode: ComputedRef<FormFieldOptions<FieldType>['mode']>;
|
|
42
|
-
|
|
43
|
-
* Value of the field
|
|
44
|
-
*/
|
|
45
|
-
value: WritableComputedRef<FieldType>;
|
|
46
|
-
/**
|
|
47
|
-
* Validation events of the field
|
|
48
|
-
*/
|
|
14
|
+
value: Ref<FieldType>;
|
|
49
15
|
validationEvents: ComputedRef<ReturnType<typeof getValidationEvents>>;
|
|
50
|
-
/**
|
|
51
|
-
* Function to handle the blur event of the field
|
|
52
|
-
*/
|
|
53
|
-
onBlur: () => void;
|
|
54
16
|
}
|
|
55
|
-
export declare function useFormField<FieldType
|
|
17
|
+
export declare function useFormField<FieldType, Model extends BaseFormPayload = BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>(name: ModelKey, options?: FormFieldOptions<FieldType>): UseFormFieldReturn<FieldType>;
|
|
56
18
|
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BaseFormPayload, FieldState, StrictOptions } from './types';
|
|
2
|
+
export declare function scrollToError(selector?: string): void;
|
|
3
|
+
export declare function findInteractiveElements(el: HTMLElement): HTMLElement[];
|
|
4
|
+
export declare function addEventToInteractiveElements({ interactiveElements, onBlur, mode, }: {
|
|
5
|
+
interactiveElements: HTMLElement[];
|
|
6
|
+
onBlur: () => void;
|
|
7
|
+
mode: StrictOptions['mode'];
|
|
8
|
+
}): void;
|
|
9
|
+
export declare function removeEventFromInteractiveElements({ interactiveElements, onBlur, }: {
|
|
10
|
+
interactiveElements: HTMLElement[];
|
|
11
|
+
onBlur: () => void;
|
|
12
|
+
}): void;
|
|
13
|
+
export declare function getValidationEvents<Model extends BaseFormPayload>({ hasRef, fieldState, onBlur, }: {
|
|
14
|
+
hasRef?: boolean;
|
|
15
|
+
fieldState: FieldState<Model>;
|
|
16
|
+
onBlur: () => void;
|
|
17
|
+
}): {
|
|
18
|
+
onBlur: () => void;
|
|
19
|
+
} | undefined;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { InjectionKey } from 'vue';
|
|
2
|
+
import { BaseFormPayload, CustomInstance, ExtractModelKey, FieldsStates, FieldState, FormContext, FormFieldOptions, FormSchema, StrictOptions } from './types';
|
|
3
|
+
export declare function getFieldState<Model extends BaseFormPayload = BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>({ name, schema, initialValue, fieldState, options, }: {
|
|
4
|
+
name: ModelKey;
|
|
5
|
+
schema?: FormSchema<Model>;
|
|
6
|
+
initialValue?: Model[ModelKey];
|
|
7
|
+
fieldState: FieldState<Model>;
|
|
8
|
+
options?: Pick<StrictOptions<Model>, 'debouncedFields' | 'throttledFields' | 'mode'>;
|
|
9
|
+
}): FieldState<Model>;
|
|
10
|
+
export declare function fieldHasValidation<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>>>(field: ModelKey, schema: FormSchema<Model>): boolean;
|
|
11
|
+
export declare function getFieldsStates<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>({ schema, payload, options, }: {
|
|
12
|
+
schema: FormSchema<Model>;
|
|
13
|
+
payload: Partial<Model>;
|
|
14
|
+
options: StrictOptions<Model>;
|
|
15
|
+
}): FieldsStates<Model>;
|
|
16
|
+
export declare function updateFieldsStates<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>({ fieldsStates, payload, schema, options, updateMode, }: {
|
|
17
|
+
fieldsStates: FieldsStates<Model>;
|
|
18
|
+
payload: Model;
|
|
19
|
+
schema: FormSchema<Model>;
|
|
20
|
+
options: StrictOptions<Model>;
|
|
21
|
+
updateMode?: boolean;
|
|
22
|
+
}): void;
|
|
23
|
+
export declare function updateFieldState<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>({ name, fieldState, payload, schema, options, updateMode, }: {
|
|
24
|
+
name: ModelKey;
|
|
25
|
+
fieldState: FieldState<Model>;
|
|
26
|
+
payload: Model;
|
|
27
|
+
schema: FormSchema<Model>;
|
|
28
|
+
options: FormFieldOptions<Model[ModelKey]> & StrictOptions<Model>;
|
|
29
|
+
updateMode?: boolean;
|
|
30
|
+
}): FieldState<Model>;
|
|
31
|
+
export declare function canExecuteValidation<Model extends BaseFormPayload>({ eventName, fieldState, isSubmitted, }: {
|
|
32
|
+
eventName: 'blur' | 'input';
|
|
33
|
+
fieldState: FieldState<Model>;
|
|
34
|
+
isSubmitted: boolean;
|
|
35
|
+
}): boolean;
|
|
36
|
+
export declare function handleFieldBlur<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>({ name, force, payload, fieldState, schema, isSubmitted, }: {
|
|
37
|
+
name: ModelKey;
|
|
38
|
+
payload: Model;
|
|
39
|
+
fieldState: FieldState<Model>;
|
|
40
|
+
schema: FormSchema<Model>;
|
|
41
|
+
isSubmitted: boolean;
|
|
42
|
+
force?: boolean;
|
|
43
|
+
}): Promise<void> | undefined;
|
|
44
|
+
export declare function handleFieldInput<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>({ name, payload, fieldState, schema, isSubmitted, forceValidation, }: {
|
|
45
|
+
name: ModelKey;
|
|
46
|
+
payload: Model;
|
|
47
|
+
fieldState: FieldState<Model>;
|
|
48
|
+
schema: FormSchema<Model>;
|
|
49
|
+
isSubmitted: boolean;
|
|
50
|
+
forceValidation?: boolean;
|
|
51
|
+
}): Promise<void> | undefined;
|
|
52
|
+
export declare function hasModeIncludes(modes: StrictOptions['mode'][], value?: StrictOptions['mode']): value is StrictOptions['mode'];
|
|
53
|
+
export declare function getInstance<Model extends BaseFormPayload>(composableName: string): CustomInstance<Model>;
|
|
54
|
+
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').Validation; }, string> | Extract<keyof { [K_1 in Extract<keyof Model, string> as Model[K_1] extends Required<Model>[K_1] ? never : K_1]?: import('./types').Validation | undefined; }, string>>;
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import { useFormValidator } from './../useFormValidator';
|
|
6
|
-
import { getValidateFunction } from './utils';
|
|
7
|
-
export type ValidationSync = BaseSchema<unknown, unknown, BaseIssue<unknown>>;
|
|
8
|
-
export type ValidationAsync = ValidationSync | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>;
|
|
9
|
-
export type Validation = ValidationAsync;
|
|
1
|
+
import { BaseIssue, BaseSchema, BaseSchemaAsync, InferInput, InferIssue, InferOutput, objectAsync } from 'valibot';
|
|
2
|
+
import { ComponentInternalInstance, InjectionKey, Ref, TemplateRef } from 'vue';
|
|
3
|
+
import { getValidateFunction } from './validation';
|
|
4
|
+
export type Validation = BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>;
|
|
10
5
|
export type ValidationIssues = InferIssue<Validation>[];
|
|
11
6
|
export type ExtractModelKey<T> = Extract<keyof T, string>;
|
|
12
|
-
export type FormSchema<Model> = {
|
|
7
|
+
export type FormSchema<Model = BaseFormPayload> = {
|
|
13
8
|
[K in Extract<keyof Model, string> as Model[K] extends Required<Model>[K] ? K : never]: Validation;
|
|
14
9
|
} & {
|
|
15
10
|
[K in Extract<keyof Model, string> as Model[K] extends Required<Model>[K] ? never : K]?: Validation;
|
|
@@ -91,7 +86,7 @@ export interface FormFieldOptions<FieldType> {
|
|
|
91
86
|
* Reference to the component or HTML element to associate and trigger validation events
|
|
92
87
|
* Necessary for 'eager', 'progressive' and 'blur' validation modes
|
|
93
88
|
*/
|
|
94
|
-
ref?: Ref
|
|
89
|
+
ref?: Ref | TemplateRef;
|
|
95
90
|
/**
|
|
96
91
|
* Identifier for the form
|
|
97
92
|
* Useful when you have multiple forms on the same component
|
|
@@ -99,12 +94,5 @@ export interface FormFieldOptions<FieldType> {
|
|
|
99
94
|
*/
|
|
100
95
|
formIdentifier?: string | symbol;
|
|
101
96
|
}
|
|
102
|
-
export type
|
|
103
|
-
export
|
|
104
|
-
schema: MaybeRef<FormSchema<Model>>;
|
|
105
|
-
defaultValues?: MaybeRef<DeepPartial<Model> | undefined | null>;
|
|
106
|
-
model?: Ref<DeepPartial<Model> | undefined | null>;
|
|
107
|
-
options?: FormValidatorOptions<Model>;
|
|
108
|
-
}
|
|
109
|
-
export type UseFormField<FieldType extends Model[ExtractModelKey<FormSchema<Model>>], Model extends BaseFormPayload = BaseFormPayload> = typeof useFormField<FieldType, Model>;
|
|
110
|
-
export type InferSchemaFormValidator<T> = T extends Ref<infer U> ? U extends Record<string, Validation> ? InferOutput<ReturnType<typeof objectAsync<U>>> : never : T extends Record<string, Validation> ? InferOutput<ReturnType<typeof objectAsync<T>>> : never;
|
|
97
|
+
export type InferSchemaFormValidator<T> = T extends Ref<infer U> ? U extends FormSchema<BaseFormPayload> ? Partial<InferInput<ReturnType<typeof objectAsync<U>>>> : never : T extends (...args: any[]) => FormSchema<BaseFormPayload> ? Partial<InferInput<ReturnType<typeof objectAsync<ReturnType<T>>>>> : T extends FormSchema<BaseFormPayload> ? Partial<InferInput<ReturnType<typeof objectAsync<T>>>> : never;
|
|
98
|
+
export type InferOutputSchemaFormValidator<T> = T extends Ref<infer U> ? U extends FormSchema<BaseFormPayload> ? InferOutput<ReturnType<typeof objectAsync<U>>> : never : T extends (...args: any[]) => FormSchema<BaseFormPayload> ? InferOutput<ReturnType<typeof objectAsync<ReturnType<T>>>> : T extends FormSchema<BaseFormPayload> ? InferOutput<ReturnType<typeof objectAsync<T>>> : never;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { BaseFormPayload, ExtractModelKey, FieldsStates, FieldState, FormSchema, StrictOptions, ValidationIssues } from './types';
|
|
2
|
+
export declare function isEmptyValue(value: unknown): value is null | undefined | '';
|
|
3
|
+
export declare function getValibotValidationMethod<MethodName extends keyof typeof import('valibot')>(methodName: MethodName): Promise<(typeof import('valibot'))[MethodName]>;
|
|
4
|
+
export declare function getValidationSchema<Model extends BaseFormPayload>(formSchema: FormSchema<Model>): Promise<import('valibot').ObjectSchemaAsync<FormSchema<Model>, undefined>>;
|
|
5
|
+
export declare function getFieldValidationResult<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>(name: ModelKey, schema: FormSchema<Model>, value: Model[ModelKey]): Promise<{
|
|
6
|
+
result: import('valibot').SafeParseResult<FormSchema<Model>[ModelKey]>;
|
|
7
|
+
isValid: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
export declare function setFieldValidationState<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>({ name, fieldState, schema, payload, setError, setErrorIfInvalidAndNotEmpty, }: {
|
|
10
|
+
name: ModelKey;
|
|
11
|
+
fieldState: FieldState<Model>;
|
|
12
|
+
schema: FormSchema<Model>;
|
|
13
|
+
payload: Model;
|
|
14
|
+
setError?: boolean;
|
|
15
|
+
setErrorIfInvalidAndNotEmpty?: boolean;
|
|
16
|
+
}): Promise<void>;
|
|
17
|
+
export declare function validateField<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>({ name, fieldState, payload, schema, }: {
|
|
18
|
+
name: ModelKey;
|
|
19
|
+
fieldState: FieldState<Model>;
|
|
20
|
+
payload: Model;
|
|
21
|
+
schema: FormSchema<Model>;
|
|
22
|
+
}): Promise<void> | undefined;
|
|
23
|
+
export declare function validateForm<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>({ fieldsStates, payload, setErrors, schema, }: {
|
|
24
|
+
fieldsStates: FieldsStates<Model>;
|
|
25
|
+
setErrors?: boolean;
|
|
26
|
+
payload: Model;
|
|
27
|
+
schema: FormSchema<Model>;
|
|
28
|
+
}): Promise<void[]>;
|
|
29
|
+
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>;
|
|
30
|
+
export declare function getFieldsErrors<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>(fieldsStates: FieldsStates<Model>): Record<ModelKey, ValidationIssues>;
|
|
31
|
+
export declare function getValidateFunction<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>({ name, hasValidation, debouncedFields, throttledFields, }: {
|
|
32
|
+
name: ModelKey;
|
|
33
|
+
hasValidation: boolean;
|
|
34
|
+
debouncedFields?: StrictOptions<Model>['debouncedFields'];
|
|
35
|
+
throttledFields?: StrictOptions<Model>['throttledFields'];
|
|
36
|
+
}): ((args_0: {
|
|
37
|
+
name: ExtractModelKey<FormSchema<Model>>;
|
|
38
|
+
fieldState: FieldState<Model, Model[Extract<keyof { [K in Extract<keyof Model, string> as Model[K] extends Required<Model>[K] ? K : never]: import('./types').Validation; }, string> | Extract<keyof { [K_1 in Extract<keyof Model, string> as Model[K_1] extends Required<Model>[K_1] ? never : K_1]?: import('./types').Validation | undefined; }, string>]>;
|
|
39
|
+
schema: FormSchema<Model>;
|
|
40
|
+
payload: Model;
|
|
41
|
+
setError?: boolean;
|
|
42
|
+
setErrorIfInvalidAndNotEmpty?: boolean;
|
|
43
|
+
}) => Promise<void>) | undefined;
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { DeepPartial } from '@maz-ui/utils/src/ts-helpers/DeepPartial.js';
|
|
2
|
+
import { MaybeRefOrGetter, Ref } from 'vue';
|
|
3
|
+
import { BaseFormPayload, ExtractModelKey, FieldsStates, FormSchema, FormValidatorOptions, InferOutputSchemaFormValidator, InferSchemaFormValidator } from './useFormValidator/types';
|
|
4
|
+
import { scrollToError } from './useFormValidator/dom-events';
|
|
5
|
+
export declare function useFormValidator<TSchema extends MaybeRefOrGetter<FormSchema<BaseFormPayload>>>({ schema, defaultValues, model, options }: {
|
|
6
|
+
schema: TSchema;
|
|
7
|
+
defaultValues?: MaybeRefOrGetter<DeepPartial<InferSchemaFormValidator<TSchema>> | undefined | null>;
|
|
8
|
+
model?: Ref<DeepPartial<InferSchemaFormValidator<TSchema>> | undefined | null>;
|
|
9
|
+
options?: FormValidatorOptions<InferSchemaFormValidator<TSchema>>;
|
|
10
|
+
}): {
|
|
5
11
|
identifier: string | symbol;
|
|
6
12
|
isDirty: import('vue').ComputedRef<boolean>;
|
|
7
13
|
isSubmitting: Ref<boolean, boolean>;
|
|
8
14
|
isSubmitted: Ref<boolean, boolean>;
|
|
9
15
|
isValid: import('vue').ComputedRef<boolean>;
|
|
10
|
-
errors: import('vue').ComputedRef<Record<ExtractModelKey<FormSchema<
|
|
11
|
-
model: Ref<
|
|
12
|
-
fieldsStates: Ref<FieldsStates<
|
|
13
|
-
validateForm: (
|
|
16
|
+
errors: import('vue').ComputedRef<Record<ExtractModelKey<FormSchema<InferSchemaFormValidator<TSchema>>>, import('./useFormValidator/types').ValidationIssues>>;
|
|
17
|
+
model: Ref<InferSchemaFormValidator<TSchema>, InferSchemaFormValidator<TSchema>>;
|
|
18
|
+
fieldsStates: Ref<FieldsStates<InferSchemaFormValidator<TSchema>>, FieldsStates<InferSchemaFormValidator<TSchema>>>;
|
|
19
|
+
validateForm: (setErrors?: boolean) => Promise<void[]>;
|
|
14
20
|
scrollToError: typeof scrollToError;
|
|
15
|
-
handleSubmit: <Func extends (model:
|
|
16
|
-
errorMessages: import('vue').ComputedRef<Record<ExtractModelKey<FormSchema<
|
|
21
|
+
handleSubmit: <Func extends (model: InferOutputSchemaFormValidator<TSchema>) => Promise<Awaited<ReturnType<Func>>> | ReturnType<Func>>(successCallback: Func, enableScrollOrSelector?: FormValidatorOptions["scrollToError"]) => (event?: Event) => Promise<ReturnType<Func> | undefined>;
|
|
22
|
+
errorMessages: import('vue').ComputedRef<Record<ExtractModelKey<FormSchema<InferSchemaFormValidator<TSchema>>>, string | undefined>>;
|
|
17
23
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IdleTimeoutCallback, IdleTimeoutOptions, IdleTimeout } from '@maz-ui/utils/src/
|
|
1
|
+
import { IdleTimeoutCallback, IdleTimeoutOptions, IdleTimeout } from '@maz-ui/utils/src/helpers/idleTimeout.js';
|
|
2
2
|
export declare function useIdleTimeout({ callback, options, }: {
|
|
3
3
|
callback: IdleTimeoutCallback;
|
|
4
4
|
options?: IdleTimeoutOptions;
|