@m3ui-vue/m3ui-vue 1.6.2 → 1.8.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.
Files changed (191) hide show
  1. package/dist/API.md +1224 -28
  2. package/dist/{MColorPickerModal-NtkihoK6.js → MColorPickerModal-H8nuX0Wu.js} +3 -4
  3. package/dist/{MColorPickerModal-NtkihoK6.js.map → MColorPickerModal-H8nuX0Wu.js.map} +1 -1
  4. package/dist/MDialog-B42Mhn8W.js +331 -0
  5. package/dist/MDialog-B42Mhn8W.js.map +1 -0
  6. package/dist/{MListItem-D2cNUyzP.js → MListItem-DiOAxaN7.js} +431 -325
  7. package/dist/MListItem-DiOAxaN7.js.map +1 -0
  8. package/dist/{MLoadingIndicator-DWUj0BAB.js → MLoadingIndicator-CuTZYFFj.js} +2 -2
  9. package/dist/{MLoadingIndicator-DWUj0BAB.js.map → MLoadingIndicator-CuTZYFFj.js.map} +1 -1
  10. package/dist/{MSeekBar-C4cn9RIF.js → MSeekBar-BCDQTx2t.js} +2 -2
  11. package/dist/{MSeekBar-C4cn9RIF.js.map → MSeekBar-BCDQTx2t.js.map} +1 -1
  12. package/dist/MSegmentedButton-BXzRsg1S.js +105 -0
  13. package/dist/MSegmentedButton-BXzRsg1S.js.map +1 -0
  14. package/dist/MSignaturePad-BTqGaPXA.js +313 -0
  15. package/dist/MSignaturePad-BTqGaPXA.js.map +1 -0
  16. package/dist/MSlider-D_O8J9YH.js +739 -0
  17. package/dist/MSlider-D_O8J9YH.js.map +1 -0
  18. package/dist/{MSpinner-DZkXZJpc.js → MSpinner-UCdtSOHP.js} +2 -2
  19. package/dist/{MSpinner-DZkXZJpc.js.map → MSpinner-UCdtSOHP.js.map} +1 -1
  20. package/dist/{MTextField-CNH-byir.js → MTextField-CYk9yFvi.js} +162 -115
  21. package/dist/MTextField-CYk9yFvi.js.map +1 -0
  22. package/dist/_useFieldValidation-B0B44M_t.js +191 -0
  23. package/dist/_useFieldValidation-B0B44M_t.js.map +1 -0
  24. package/dist/api.json +1 -1
  25. package/dist/code-editor.js +184 -103
  26. package/dist/code-editor.js.map +1 -1
  27. package/dist/components/MAddressField.vue.d.ts +18 -3
  28. package/dist/components/MAppBarWithSearch.vue.d.ts +1 -1
  29. package/dist/components/MAudioRecorder.vue.d.ts +2 -2
  30. package/dist/components/MAutocomplete.vue.d.ts +22 -3
  31. package/dist/components/MCheckbox.vue.d.ts +23 -1
  32. package/dist/components/MCodeEditor.vue.d.ts +23 -1
  33. package/dist/components/MColorPicker.vue.d.ts +24 -3
  34. package/dist/components/MConfirmDialog.vue.d.ts +2 -2
  35. package/dist/components/MCountrySelect.vue.d.ts +13 -2
  36. package/dist/components/MCreditCardInput.vue.d.ts +33 -0
  37. package/dist/components/MCronField.vue.d.ts +23 -1
  38. package/dist/components/MDataTable.vue.d.ts +1 -1
  39. package/dist/components/MDatePicker.vue.d.ts +24 -3
  40. package/dist/components/MDateRangePicker.vue.d.ts +24 -3
  41. package/dist/components/MFileUpload.vue.d.ts +23 -2
  42. package/dist/components/MForm.vue.d.ts +61 -0
  43. package/dist/components/MFormBuilder.vue.d.ts +22 -0
  44. package/dist/components/MFormRenderer.vue.d.ts +151 -0
  45. package/dist/components/MJsonEditor.vue.d.ts +23 -1
  46. package/dist/components/MMapRoute.vue.d.ts +176 -0
  47. package/dist/components/MMaskField.vue.d.ts +20 -2
  48. package/dist/components/MMentionField.vue.d.ts +13 -2
  49. package/dist/components/MMultiAutocomplete.vue.d.ts +22 -3
  50. package/dist/components/MMultiSelect.vue.d.ts +22 -3
  51. package/dist/components/MNavigationRail.vue.d.ts +1 -1
  52. package/dist/components/MNotificationCenter.vue.d.ts +2 -2
  53. package/dist/components/MNumberField.vue.d.ts +20 -2
  54. package/dist/components/MPdfSigner.vue.d.ts +499 -0
  55. package/dist/components/MPdfViewer.vue.d.ts +12 -0
  56. package/dist/components/MPhoneInput.vue.d.ts +19 -4
  57. package/dist/components/MPinInput.vue.d.ts +24 -3
  58. package/dist/components/MPosKeypad.vue.d.ts +3 -3
  59. package/dist/components/MRadioGroup.vue.d.ts +23 -1
  60. package/dist/components/MRating.vue.d.ts +23 -1
  61. package/dist/components/MRichTextEditor.vue.d.ts +23 -1
  62. package/dist/components/MSearchBar.vue.d.ts +1 -1
  63. package/dist/components/MSegmentedButton.vue.d.ts +23 -2
  64. package/dist/components/MSelect.vue.d.ts +22 -3
  65. package/dist/components/MSignaturePad.vue.d.ts +19 -0
  66. package/dist/components/MSlider.vue.d.ts +23 -1
  67. package/dist/components/MSpreadsheet.vue.d.ts +137 -0
  68. package/dist/components/MStack.vue.d.ts +1 -1
  69. package/dist/components/MSwitch.vue.d.ts +23 -1
  70. package/dist/components/MTable.vue.d.ts +1 -1
  71. package/dist/components/MTagInput.vue.d.ts +20 -2
  72. package/dist/components/MText.vue.d.ts +1 -1
  73. package/dist/components/MTextField.vue.d.ts +26 -3
  74. package/dist/components/MTimePicker.vue.d.ts +24 -3
  75. package/dist/components/MTimezoneSelect.vue.d.ts +13 -2
  76. package/dist/components/MTour.vue.d.ts +2 -2
  77. package/dist/components/MTrackingTimeline.vue.d.ts +75 -0
  78. package/dist/components/MWindow.vue.d.ts +2 -2
  79. package/dist/composables/_routeGeometry.d.ts +26 -0
  80. package/dist/composables/_useFieldValidation.d.ts +91 -0
  81. package/dist/composables/mapRouting.d.ts +35 -0
  82. package/dist/composables/pdfSign.d.ts +52 -0
  83. package/dist/composables/spreadsheetFormula.d.ts +55 -0
  84. package/dist/composables/useLocale.d.ts +177 -0
  85. package/dist/composables/validation.d.ts +82 -0
  86. package/dist/draw.js +2 -2
  87. package/dist/flow.js +1 -1
  88. package/dist/gantt.js +2 -2
  89. package/dist/index.d.ts +12 -0
  90. package/dist/locales/index.js +693 -7
  91. package/dist/locales/index.js.map +1 -1
  92. package/dist/m3ui-vue.css +1 -1
  93. package/dist/m3ui.js +15507 -12417
  94. package/dist/m3ui.js.map +1 -1
  95. package/dist/map.d.ts +4 -0
  96. package/dist/map.js +1207 -745
  97. package/dist/map.js.map +1 -1
  98. package/dist/media.js +4 -4
  99. package/dist/pdf.d.ts +3 -0
  100. package/dist/pdf.js +1228 -687
  101. package/dist/pdf.js.map +1 -1
  102. package/dist/rich-text-editor.js +188 -146
  103. package/dist/rich-text-editor.js.map +1 -1
  104. package/dist/styles.css +1 -1
  105. package/dist/{useLocale-DaVSTdm0.js → useLocale-DL96OFgr.js} +99 -1
  106. package/dist/useLocale-DL96OFgr.js.map +1 -0
  107. package/package.json +5 -1
  108. package/src/__tests__/MForm.test.ts +325 -0
  109. package/src/__tests__/MFormRenderer.test.ts +157 -0
  110. package/src/__tests__/MMapRoute.test.ts +418 -0
  111. package/src/__tests__/MPdfSigner.test.ts +175 -0
  112. package/src/__tests__/MPhoneInput.test.ts +5 -2
  113. package/src/__tests__/MRichTextEditor.test.ts +2 -1
  114. package/src/__tests__/MSpreadsheet.test.ts +223 -0
  115. package/src/__tests__/MTrackingTimeline.test.ts +66 -0
  116. package/src/__tests__/_fakeMaplibre.ts +4 -1
  117. package/src/__tests__/_osrmRoutes.ts +10 -0
  118. package/src/__tests__/attrsFallthrough.test.ts +11 -0
  119. package/src/__tests__/fieldsValidation.test.ts +229 -0
  120. package/src/__tests__/spreadsheetFormula.test.ts +77 -0
  121. package/src/__tests__/ssr.test.ts +4 -0
  122. package/src/__tests__/validation.test.ts +77 -0
  123. package/src/components/MAddressField.vue +45 -8
  124. package/src/components/MAutocomplete.vue +69 -23
  125. package/src/components/MCheckbox.vue +80 -17
  126. package/src/components/MCodeEditor.vue +59 -2
  127. package/src/components/MColorPicker.vue +65 -16
  128. package/src/components/MCountrySelect.vue +17 -3
  129. package/src/components/MCreditCardInput.vue +76 -7
  130. package/src/components/MCronField.vue +60 -10
  131. package/src/components/MDatePicker.vue +65 -16
  132. package/src/components/MDateRangePicker.vue +66 -16
  133. package/src/components/MFileUpload.vue +71 -8
  134. package/src/components/MForm.vue +208 -0
  135. package/src/components/MFormBuilder.vue +417 -0
  136. package/src/components/MFormRenderer.vue +324 -0
  137. package/src/components/MJsonEditor.vue +57 -3
  138. package/src/components/MMapRoute.vue +523 -0
  139. package/src/components/MMaskField.vue +55 -13
  140. package/src/components/MMentionField.vue +17 -2
  141. package/src/components/MMultiAutocomplete.vue +70 -23
  142. package/src/components/MMultiSelect.vue +70 -23
  143. package/src/components/MNumberField.vue +58 -16
  144. package/src/components/MPdfSigner.vue +433 -0
  145. package/src/components/MPdfViewer.vue +12 -0
  146. package/src/components/MPhoneInput.vue +60 -18
  147. package/src/components/MPinInput.vue +58 -10
  148. package/src/components/MRadioGroup.vue +65 -4
  149. package/src/components/MRating.vue +62 -6
  150. package/src/components/MRichTextEditor.vue +64 -4
  151. package/src/components/MSegmentedButton.vue +59 -2
  152. package/src/components/MSelect.vue +72 -26
  153. package/src/components/MSignaturePad.vue +71 -6
  154. package/src/components/MSlider.vue +61 -10
  155. package/src/components/MSpreadsheet.vue +992 -0
  156. package/src/components/MSwitch.vue +63 -8
  157. package/src/components/MTagInput.vue +67 -25
  158. package/src/components/MTextField.vue +68 -14
  159. package/src/components/MTimePicker.vue +65 -16
  160. package/src/components/MTimezoneSelect.vue +17 -3
  161. package/src/components/MTrackingTimeline.vue +257 -0
  162. package/src/composables/_routeGeometry.ts +140 -0
  163. package/src/composables/_useFieldValidation.ts +287 -0
  164. package/src/composables/mapRouting.ts +55 -0
  165. package/src/composables/pdfSign.ts +141 -0
  166. package/src/composables/spreadsheetFormula.ts +459 -0
  167. package/src/composables/useLocale.ts +277 -0
  168. package/src/composables/validation.ts +178 -0
  169. package/src/index.ts +12 -0
  170. package/src/locales/de.ts +98 -0
  171. package/src/locales/es.ts +105 -7
  172. package/src/locales/fr.ts +98 -0
  173. package/src/locales/ja.ts +98 -0
  174. package/src/locales/ko.ts +98 -0
  175. package/src/locales/pt.ts +98 -0
  176. package/src/locales/zh.ts +98 -0
  177. package/src/map.ts +4 -0
  178. package/src/pdf.ts +3 -0
  179. package/dist/MButton-OQ4wIERQ.js +0 -171
  180. package/dist/MButton-OQ4wIERQ.js.map +0 -1
  181. package/dist/MDialog-DYMnaBlt.js +0 -167
  182. package/dist/MDialog-DYMnaBlt.js.map +0 -1
  183. package/dist/MListItem-D2cNUyzP.js.map +0 -1
  184. package/dist/MProgressBar-BWly1UKN.js +0 -179
  185. package/dist/MProgressBar-BWly1UKN.js.map +0 -1
  186. package/dist/MSegmentedButton-BEB4gXLA.js +0 -64
  187. package/dist/MSegmentedButton-BEB4gXLA.js.map +0 -1
  188. package/dist/MSlider-BIkA6DiE.js +0 -690
  189. package/dist/MSlider-BIkA6DiE.js.map +0 -1
  190. package/dist/MTextField-CNH-byir.js.map +0 -1
  191. package/dist/useLocale-DaVSTdm0.js.map +0 -1
@@ -0,0 +1,151 @@
1
+ import type { ValidateOn } from '../composables/validation';
2
+ import type { ValidationRule } from '../composables/validation';
3
+ /** The kinds of field a form schema can hold. `heading` and `divider` only lay the form out */
4
+ export type FormFieldType = 'text' | 'email' | 'password' | 'tel' | 'url' | 'textarea' | 'number' | 'select' | 'autocomplete' | 'radio' | 'checkbox' | 'switch' | 'date' | 'time' | 'slider' | 'rating' | 'phone' | 'heading' | 'divider';
5
+ /** A choice of a select, autocomplete or radio group */
6
+ export interface FormFieldOption {
7
+ label: string;
8
+ value: string | number | boolean;
9
+ }
10
+ /** Shows a field only while another field's value matches */
11
+ export interface FormFieldCondition {
12
+ /** The other field's name */
13
+ field: string;
14
+ /** Its value is this */
15
+ equals?: unknown;
16
+ /** Its value isn't this */
17
+ notEquals?: unknown;
18
+ /** Its value is one of these */
19
+ in?: unknown[];
20
+ /** It has a value (true) or is empty (false) */
21
+ filled?: boolean;
22
+ }
23
+ /** One field of a form schema: plain JSON, so it can be stored, sent and built with MFormBuilder */
24
+ export interface FormFieldSchema {
25
+ type: FormFieldType;
26
+ /** The value's key (required for every type but heading and divider) */
27
+ name?: string;
28
+ label?: string;
29
+ placeholder?: string;
30
+ /** Help under the field */
31
+ hint?: string;
32
+ /** A heading's text under its title */
33
+ description?: string;
34
+ required?: boolean;
35
+ disabled?: boolean;
36
+ /** Its value before the user changes it */
37
+ default?: unknown;
38
+ /** select, autocomplete, radio: the choices (a plain string is its own label and value) */
39
+ options?: (FormFieldOption | string)[];
40
+ /** number, slider: limits. date: earliest/latest as `YYYY-MM-DD` strings */
41
+ min?: number | string;
42
+ max?: number | string;
43
+ step?: number;
44
+ /** text-like fields: length limits */
45
+ minLength?: number;
46
+ maxLength?: number;
47
+ /** text-like fields: a regular expression the value must match (as a string, without slashes) */
48
+ pattern?: string;
49
+ /** The message when `pattern` doesn't match */
50
+ patternMessage?: string;
51
+ /** textarea: visible lines */
52
+ rows?: number;
53
+ /** How much of the row it takes on a wide form (stacked on a narrow one). Default `full` */
54
+ width?: 'full' | 'half' | 'third' | 'two-thirds';
55
+ /** A Material Symbol at the start of text-like fields */
56
+ icon?: string;
57
+ /** Show it only when this (or all of these) holds */
58
+ visibleWhen?: FormFieldCondition | FormFieldCondition[];
59
+ /** More rules, in code (not JSON): validators, zod/valibot schemas, functions */
60
+ rules?: ValidationRule[];
61
+ }
62
+ /** A whole form: its fields in order, and its buttons' text */
63
+ export interface FormSchema {
64
+ title?: string;
65
+ description?: string;
66
+ fields: FormFieldSchema[];
67
+ /** The submit button's text */
68
+ submitLabel?: string;
69
+ /** Show a reset button with this text */
70
+ resetLabel?: string;
71
+ }
72
+ /** Whether a field takes a value (headings and dividers don't) */
73
+ export declare const isValueField: (f: FormFieldSchema) => boolean;
74
+ /** A field's options as `{ label, value }` */
75
+ export declare const normalizeOptions: (options: FormFieldSchema["options"]) => FormFieldOption[];
76
+ /** What a field holds before anything is typed */
77
+ export declare function emptyValue(f: FormFieldSchema): unknown;
78
+ /** Whether a field shows, given the form's values */
79
+ export declare function fieldVisible(f: FormFieldSchema, values: Record<string, unknown>): boolean;
80
+ declare const _default: typeof __VLS_export;
81
+ export default _default;
82
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
83
+ /** The form to render */
84
+ schema: FormSchema;
85
+ /** The values by field name (v-model). Missing ones start from each field's `default` */
86
+ modelValue?: Record<string, unknown>;
87
+ /** When fields check their rules (MForm's) */
88
+ validateOn?: ValidateOn;
89
+ /** Wait this long (ms) after typing stops before re-checking */
90
+ validateDebounce?: number;
91
+ /** Errors from outside (a server's), by field name */
92
+ errors?: Record<string, string | string[] | null | undefined>;
93
+ /** Disables every field and the buttons */
94
+ disabled?: boolean;
95
+ /** Show the submit (and reset) buttons */
96
+ actions?: boolean;
97
+ /** The submit button shows a spinner and can't be pressed */
98
+ loading?: boolean;
99
+ }, {
100
+ /** Checks every field on show (or the named ones) and shows their messages; resolves to whether they pass */
101
+ validate: (names?: string[] | undefined, options?: {
102
+ focus?: boolean;
103
+ } | undefined) => Promise<boolean>;
104
+ /** Clears the messages */
105
+ resetValidation: (names?: string[]) => void | undefined;
106
+ /** The values, defaults included */
107
+ values: import("vue").ComputedRef<Record<string, unknown>>;
108
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
109
+ submit: (values: Record<string, unknown>) => any;
110
+ "update:modelValue": (values: Record<string, unknown>) => any;
111
+ invalid: (errors: Record<string, string>) => any;
112
+ }, string, import("vue").PublicProps, Readonly<{
113
+ /** The form to render */
114
+ schema: FormSchema;
115
+ /** The values by field name (v-model). Missing ones start from each field's `default` */
116
+ modelValue?: Record<string, unknown>;
117
+ /** When fields check their rules (MForm's) */
118
+ validateOn?: ValidateOn;
119
+ /** Wait this long (ms) after typing stops before re-checking */
120
+ validateDebounce?: number;
121
+ /** Errors from outside (a server's), by field name */
122
+ errors?: Record<string, string | string[] | null | undefined>;
123
+ /** Disables every field and the buttons */
124
+ disabled?: boolean;
125
+ /** Show the submit (and reset) buttons */
126
+ actions?: boolean;
127
+ /** The submit button shows a spinner and can't be pressed */
128
+ loading?: boolean;
129
+ }> & Readonly<{
130
+ onSubmit?: ((values: Record<string, unknown>) => any) | undefined;
131
+ "onUpdate:modelValue"?: ((values: Record<string, unknown>) => any) | undefined;
132
+ onInvalid?: ((errors: Record<string, string>) => any) | undefined;
133
+ }>, {
134
+ modelValue: Record<string, unknown>;
135
+ actions: boolean;
136
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
137
+ [x: `field-${string}`]: ((props: {
138
+ field: FormFieldSchema;
139
+ value: unknown;
140
+ update: (v: unknown) => void;
141
+ }) => any) | undefined;
142
+ } & {
143
+ actions?: (props: {
144
+ reset: () => Promise<void> | undefined;
145
+ }) => any;
146
+ }>;
147
+ type __VLS_WithSlots<T, S> = T & {
148
+ new (): {
149
+ $slots: S;
150
+ };
151
+ };
@@ -1,3 +1,4 @@
1
+ import type { ValidateOn, ValidationRule } from '../composables/validation';
1
2
  export interface JsonEditorLabels {
2
3
  valid?: string;
3
4
  invalid?: string;
@@ -9,6 +10,20 @@ type __VLS_Props = {
9
10
  modelValue: unknown;
10
11
  /** Read-only mode */
11
12
  readonly?: boolean;
13
+ /** Error state. A string is also the message */
14
+ error?: boolean | string;
15
+ /** Error message shown when `error` is true */
16
+ errorLabel?: string;
17
+ /** Inside an `MForm` or with `rules`, it can't be empty (null) */
18
+ required?: boolean;
19
+ /** Validation rules (functions or a Standard Schema); see `MForm` */
20
+ rules?: ValidationRule | ValidationRule[];
21
+ /** When the rules are checked and shown: on leaving it (default), on change, or only on submit */
22
+ validateOn?: ValidateOn;
23
+ /** Wait this long (ms) after the value stops changing before re-checking (one request for an async rule, not one per key). Defaults to its `MForm`'s */
24
+ validateDebounce?: number;
25
+ /** The key of this field in its `MForm` */
26
+ name?: string;
12
27
  /** Min height */
13
28
  minHeight?: string;
14
29
  /** Max height */
@@ -19,9 +34,16 @@ type __VLS_Props = {
19
34
  */
20
35
  labels?: JsonEditorLabels;
21
36
  };
22
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
37
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
38
+ /** Checks its rules and shows the result; resolves to whether they pass */
39
+ validate: () => Promise<boolean>;
40
+ /** Hides its validation error (until the next check) */
41
+ resetValidation: () => void;
42
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
43
+ blur: () => any;
23
44
  "update:modelValue": (args_0: unknown) => any;
24
45
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
46
+ onBlur?: (() => any) | undefined;
25
47
  "onUpdate:modelValue"?: ((args_0: unknown) => any) | undefined;
26
48
  }>, {
27
49
  readonly: boolean;
@@ -0,0 +1,176 @@
1
+ import type { MapRouteProvider, MapRouteResult } from '../composables/mapRouting';
2
+ import type { LngLat } from '../composables/_mapGeometry';
3
+ /** A stop on an `MMapRoute`: a pickup, a drop-off, a waypoint. */
4
+ export interface MapRouteStop {
5
+ /** Where it is, `[lng, lat]` */
6
+ lngLat: LngLat;
7
+ /** Its name (the marker's accessible name and tooltip) */
8
+ label?: string;
9
+ /** A Material Symbol inside its marker. Defaults to a number for the stops in between, a flag for the last one */
10
+ icon?: string;
11
+ /** Mark it reached (or not) yourself, instead of by where the vehicle is along the route */
12
+ done?: boolean;
13
+ }
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
16
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
17
+ /** The stops, in order: the start, any in between, the destination */
18
+ stops: MapRouteStop[];
19
+ /**
20
+ * The road to follow, `[lng, lat][]`: a routing service's geometry (OSRM, GraphHopper, Mapbox…), with the streets'
21
+ * real shape. Without it, `provider` fetches one, or the stops are joined by straight lines
22
+ */
23
+ path?: LngLat[];
24
+ /** How far the vehicle is, 0–1 of the route's length. Ignored when `vehicle` is set */
25
+ progress?: number;
26
+ /** The vehicle's live position, `[lng, lat]`: it's placed on the nearest point of the route */
27
+ vehicle?: LngLat | null;
28
+ /** A Material Symbol for the vehicle. The default arrow turns with the road; other icons (`two_wheeler`, `local_shipping`) face the way it goes */
29
+ vehicleIcon?: string;
30
+ /**
31
+ * Turn the vehicle with the road (following the map's own rotation too): on for the default arrow, off for other
32
+ * icons (they're mirrored when heading west instead). Set it for `#vehicle` content drawn pointing up (north)
33
+ */
34
+ rotateVehicle?: boolean;
35
+ /** Show the vehicle (when there's a `progress` or `vehicle`) */
36
+ showVehicle?: boolean;
37
+ /**
38
+ * How long the vehicle takes to move to a new position, in ms (0 jumps). `auto` (default) takes as long as the
39
+ * time between the last two positions, so a vehicle fed every few seconds keeps moving at an even pace instead of
40
+ * stopping between fixes (or slowing down when one arrives early). Reduced motion jumps
41
+ */
42
+ duration?: number | "auto";
43
+ /** Fit the map to the whole route when it's shown and when the route changes */
44
+ fit?: boolean;
45
+ /** Keep the vehicle in the middle of the map as it moves */
46
+ follow?: boolean;
47
+ /** Room around the route when fitting it, in px */
48
+ padding?: number;
49
+ /** The route's color: one MapLibre reads (hex, rgb()…), not `var()`. Defaults to the theme's primary, following palette and dark mode */
50
+ color?: string;
51
+ /** The dots of the route ahead flow toward the destination (off with reduced motion) */
52
+ flow?: boolean;
53
+ /** Line width in px */
54
+ width?: number;
55
+ /** Insert the route's lines below this layer id (e.g. under the style's labels) */
56
+ before?: string;
57
+ /** The source's id (and the prefix of its layers' ids). Generated when left out */
58
+ id?: string;
59
+ /**
60
+ * Fetches the road between the stops when there's no `path` (again when they change): `osrmRouteProvider()`, or
61
+ * your own function. Straight lines meanwhile, and if it fails (`error` event)
62
+ */
63
+ provider?: MapRouteProvider;
64
+ /**
65
+ * How a `vehicle` position lands on the route: `forward` (default) only moves ahead from where it was, so a route
66
+ * that passes the same place twice (out and back, a loop, close parallel streets) doesn't jump to the other pass;
67
+ * `nearest` takes the closest point of the whole route every time
68
+ */
69
+ snap?: "forward" | "nearest";
70
+ }, {
71
+ /** Fits the map to the whole route */
72
+ fit: () => void;
73
+ /** The route's length, in meters */
74
+ length: import("vue").ComputedRef<number>;
75
+ /** How far the vehicle is now, in meters */
76
+ travelled: import("vue").Ref<number, number>;
77
+ /** The source's id */
78
+ sourceId: string;
79
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
80
+ error: (error: unknown) => any;
81
+ route: (route: MapRouteResult) => any;
82
+ "stop-click": (stop: MapRouteStop, index: number) => any;
83
+ arrive: () => any;
84
+ }, string, import("vue").PublicProps, Readonly<{
85
+ /** The stops, in order: the start, any in between, the destination */
86
+ stops: MapRouteStop[];
87
+ /**
88
+ * The road to follow, `[lng, lat][]`: a routing service's geometry (OSRM, GraphHopper, Mapbox…), with the streets'
89
+ * real shape. Without it, `provider` fetches one, or the stops are joined by straight lines
90
+ */
91
+ path?: LngLat[];
92
+ /** How far the vehicle is, 0–1 of the route's length. Ignored when `vehicle` is set */
93
+ progress?: number;
94
+ /** The vehicle's live position, `[lng, lat]`: it's placed on the nearest point of the route */
95
+ vehicle?: LngLat | null;
96
+ /** A Material Symbol for the vehicle. The default arrow turns with the road; other icons (`two_wheeler`, `local_shipping`) face the way it goes */
97
+ vehicleIcon?: string;
98
+ /**
99
+ * Turn the vehicle with the road (following the map's own rotation too): on for the default arrow, off for other
100
+ * icons (they're mirrored when heading west instead). Set it for `#vehicle` content drawn pointing up (north)
101
+ */
102
+ rotateVehicle?: boolean;
103
+ /** Show the vehicle (when there's a `progress` or `vehicle`) */
104
+ showVehicle?: boolean;
105
+ /**
106
+ * How long the vehicle takes to move to a new position, in ms (0 jumps). `auto` (default) takes as long as the
107
+ * time between the last two positions, so a vehicle fed every few seconds keeps moving at an even pace instead of
108
+ * stopping between fixes (or slowing down when one arrives early). Reduced motion jumps
109
+ */
110
+ duration?: number | "auto";
111
+ /** Fit the map to the whole route when it's shown and when the route changes */
112
+ fit?: boolean;
113
+ /** Keep the vehicle in the middle of the map as it moves */
114
+ follow?: boolean;
115
+ /** Room around the route when fitting it, in px */
116
+ padding?: number;
117
+ /** The route's color: one MapLibre reads (hex, rgb()…), not `var()`. Defaults to the theme's primary, following palette and dark mode */
118
+ color?: string;
119
+ /** The dots of the route ahead flow toward the destination (off with reduced motion) */
120
+ flow?: boolean;
121
+ /** Line width in px */
122
+ width?: number;
123
+ /** Insert the route's lines below this layer id (e.g. under the style's labels) */
124
+ before?: string;
125
+ /** The source's id (and the prefix of its layers' ids). Generated when left out */
126
+ id?: string;
127
+ /**
128
+ * Fetches the road between the stops when there's no `path` (again when they change): `osrmRouteProvider()`, or
129
+ * your own function. Straight lines meanwhile, and if it fails (`error` event)
130
+ */
131
+ provider?: MapRouteProvider;
132
+ /**
133
+ * How a `vehicle` position lands on the route: `forward` (default) only moves ahead from where it was, so a route
134
+ * that passes the same place twice (out and back, a loop, close parallel streets) doesn't jump to the other pass;
135
+ * `nearest` takes the closest point of the whole route every time
136
+ */
137
+ snap?: "forward" | "nearest";
138
+ }> & Readonly<{
139
+ onError?: ((error: unknown) => any) | undefined;
140
+ onRoute?: ((route: MapRouteResult) => any) | undefined;
141
+ "onStop-click"?: ((stop: MapRouteStop, index: number) => any) | undefined;
142
+ onArrive?: (() => any) | undefined;
143
+ }>, {
144
+ width: number;
145
+ duration: number | "auto";
146
+ snap: "forward" | "nearest";
147
+ flow: boolean;
148
+ fit: boolean;
149
+ padding: number;
150
+ vehicleIcon: string;
151
+ rotateVehicle: boolean;
152
+ showVehicle: boolean;
153
+ follow: boolean;
154
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
155
+ stop?: (props: {
156
+ stop: MapRouteStop;
157
+ index: number;
158
+ done: boolean;
159
+ }) => any;
160
+ } & {
161
+ 'stop-popup'?: (props: {
162
+ stop: MapRouteStop;
163
+ index: number;
164
+ done: boolean;
165
+ }) => any;
166
+ } & {
167
+ vehicle?: (props: {
168
+ bearing: number;
169
+ west: boolean;
170
+ }) => any;
171
+ }>;
172
+ type __VLS_WithSlots<T, S> = T & {
173
+ new (): {
174
+ $slots: S;
175
+ };
176
+ };
@@ -1,3 +1,4 @@
1
+ import type { ValidateOn, ValidationRule } from '../composables/validation';
1
2
  export type MaskPreset = 'credit-card' | 'phone' | 'date' | 'time' | 'cpf' | 'cnpj' | 'zip';
2
3
  type __VLS_Props = {
3
4
  /** Masked value (v-model) */
@@ -8,10 +9,21 @@ type __VLS_Props = {
8
9
  mask: string | MaskPreset;
9
10
  /** Visual style */
10
11
  variant?: 'filled' | 'outlined';
11
- /** Error state */
12
- error?: boolean;
12
+ /** Error state. A string is also the message (`:error="errors.x"`) */
13
+ error?: boolean | string;
13
14
  /** Error message shown when error is true */
14
15
  errorLabel?: string;
16
+ /**
17
+ * Validation rules: functions `(value, ctx) => true | 'message'` (may be async; see the built-in `required`,
18
+ * `email`, `minLength`…) or a Standard Schema (zod, valibot…). Checked in order; the first failure is shown
19
+ */
20
+ rules?: ValidationRule | ValidationRule[];
21
+ /** When the rules are checked and shown: on leaving the field (default; live after that), while typing, or only on submit (`MForm`) */
22
+ validateOn?: ValidateOn;
23
+ /** Wait this long (ms) after the value stops changing before re-checking (one request for an async rule, not one per key). Defaults to its `MForm`'s */
24
+ validateDebounce?: number;
25
+ /** The key of this field in its `MForm`'s values, errors and schema */
26
+ name?: string;
15
27
  /** Hint text */
16
28
  hint?: string;
17
29
  /** Disables the field */
@@ -30,6 +42,10 @@ type __VLS_Props = {
30
42
  debounce?: number;
31
43
  };
32
44
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
45
+ /** Checks its rules and shows the result; resolves to whether they pass */
46
+ validate: () => Promise<boolean>;
47
+ /** Hides its validation error (until the next check) */
48
+ resetValidation: () => void;
33
49
  /** The `<input>` (or `<textarea>`) element */
34
50
  inputEl: import("vue").Ref<HTMLInputElement | null, HTMLInputElement | null>;
35
51
  /** Focuses the field */
@@ -41,9 +57,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
41
57
  /** Selects part of its text (e.g. a file name without its extension) */
42
58
  setSelectionRange: (start: number, end: number, direction?: "forward" | "backward" | "none") => void | undefined;
43
59
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
60
+ blur: () => any;
44
61
  "update:modelValue": (args_0: string) => any;
45
62
  debounced: (args_0: string) => any;
46
63
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
64
+ onBlur?: (() => any) | undefined;
47
65
  "onUpdate:modelValue"?: ((args_0: string) => any) | undefined;
48
66
  onDebounced?: ((args_0: string) => any) | undefined;
49
67
  }>, {
@@ -1,3 +1,4 @@
1
+ import type { ValidateOn, ValidationRule } from '../composables/validation';
1
2
  /** Something that can be mentioned. */
2
3
  export interface MentionItem {
3
4
  id: string | number;
@@ -52,10 +53,18 @@ type __VLS_Props = {
52
53
  leadingIcon?: string;
53
54
  /** Helper text below the field */
54
55
  hint?: string;
55
- /** Error state */
56
- error?: boolean;
56
+ /** Error state. A string is also the message */
57
+ error?: boolean | string;
57
58
  /** Error message shown when `error` is true */
58
59
  errorLabel?: string;
60
+ /** Validation rules (functions or a Standard Schema); see `MForm` */
61
+ rules?: ValidationRule | ValidationRule[];
62
+ /** When the rules are checked and shown: on leaving the field (default), while typing, or only on submit */
63
+ validateOn?: ValidateOn;
64
+ /** Wait this long (ms) after the value stops changing before re-checking (one request for an async rule, not one per key). Defaults to its `MForm`'s */
65
+ validateDebounce?: number;
66
+ /** The key of this field in its `MForm` */
67
+ name?: string;
59
68
  /** Marks it as required */
60
69
  required?: boolean;
61
70
  /** Disables the field */
@@ -77,10 +86,12 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
77
86
  /** Inserts text at the caret (a trigger, to open the list from a button: `insert('@')`) */
78
87
  insert(text: string): void;
79
88
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
89
+ blur: () => any;
80
90
  "update:modelValue": (text: string) => any;
81
91
  "update:mentions": (mentions: MentionRef[]) => any;
82
92
  mention: (item: MentionItem, trigger: string) => any;
83
93
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
94
+ onBlur?: (() => any) | undefined;
84
95
  "onUpdate:modelValue"?: ((text: string) => any) | undefined;
85
96
  "onUpdate:mentions"?: ((mentions: MentionRef[]) => any) | undefined;
86
97
  onMention?: ((item: MentionItem, trigger: string) => any) | undefined;
@@ -1,3 +1,4 @@
1
+ import type { ValidateOn, ValidationRule } from '../composables/validation';
1
2
  import type { MultiSelectOption } from './MMultiSelect.vue';
2
3
  type __VLS_Props = {
3
4
  /** Selected values (v-model) */
@@ -14,10 +15,21 @@ type __VLS_Props = {
14
15
  mode?: 'docked' | 'modal';
15
16
  /** Disables the field */
16
17
  disabled?: boolean;
17
- /** Error state */
18
- error?: boolean;
18
+ /** Error state. A string is also the message (`:error="errors.x"`) */
19
+ error?: boolean | string;
19
20
  /** Error message shown when error is true */
20
21
  errorLabel?: string;
22
+ /**
23
+ * Validation rules: functions `(value, ctx) => true | 'message'` (may be async; see the built-in `required`,
24
+ * `email`, `minLength`…) or a Standard Schema (zod, valibot…). Checked in order; the first failure is shown
25
+ */
26
+ rules?: ValidationRule | ValidationRule[];
27
+ /** When the rules are checked and shown: on leaving the field (default; live after that), while typing, or only on submit (`MForm`) */
28
+ validateOn?: ValidateOn;
29
+ /** Wait this long (ms) after the value stops changing before re-checking (one request for an async rule, not one per key). Defaults to its `MForm`'s */
30
+ validateDebounce?: number;
31
+ /** The key of this field in its `MForm`'s values, errors and schema */
32
+ name?: string;
21
33
  /** Helper text below field */
22
34
  hint?: string;
23
35
  /** Marks as required — adds a red asterisk after the label */
@@ -39,10 +51,17 @@ type __VLS_Props = {
39
51
  /** Delay (ms) before filtering and firing @debounced. Selection is always instant */
40
52
  debounce?: number;
41
53
  };
42
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
54
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
55
+ /** Checks its rules and shows the result; resolves to whether they pass */
56
+ validate: () => Promise<boolean>;
57
+ /** Hides its validation error (until the next check) */
58
+ resetValidation: () => void;
59
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
60
+ blur: () => any;
43
61
  "update:modelValue": (args_0: unknown[]) => any;
44
62
  debounced: (args_0: string) => any;
45
63
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
64
+ onBlur?: (() => any) | undefined;
46
65
  "onUpdate:modelValue"?: ((args_0: unknown[]) => any) | undefined;
47
66
  onDebounced?: ((args_0: string) => any) | undefined;
48
67
  }>, {
@@ -1,3 +1,4 @@
1
+ import type { ValidateOn, ValidationRule } from '../composables/validation';
1
2
  export interface MultiSelectOption {
2
3
  label: string;
3
4
  value: unknown;
@@ -18,10 +19,21 @@ type __VLS_Props = {
18
19
  mode?: 'docked' | 'modal';
19
20
  /** Disables the field */
20
21
  disabled?: boolean;
21
- /** Error state */
22
- error?: boolean;
22
+ /** Error state. A string is also the message (`:error="errors.x"`) */
23
+ error?: boolean | string;
23
24
  /** Error message shown when error is true */
24
25
  errorLabel?: string;
26
+ /**
27
+ * Validation rules: functions `(value, ctx) => true | 'message'` (may be async; see the built-in `required`,
28
+ * `email`, `minLength`…) or a Standard Schema (zod, valibot…). Checked in order; the first failure is shown
29
+ */
30
+ rules?: ValidationRule | ValidationRule[];
31
+ /** When the rules are checked and shown: on leaving the field (default; live after that), while typing, or only on submit (`MForm`) */
32
+ validateOn?: ValidateOn;
33
+ /** Wait this long (ms) after the value stops changing before re-checking (one request for an async rule, not one per key). Defaults to its `MForm`'s */
34
+ validateDebounce?: number;
35
+ /** The key of this field in its `MForm`'s values, errors and schema */
36
+ name?: string;
25
37
  /** Hint text below the field */
26
38
  hint?: string;
27
39
  /** Marks as required — adds a red asterisk after the label */
@@ -51,9 +63,16 @@ declare const __VLS_template: () => {
51
63
  };
52
64
  };
53
65
  type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
54
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
66
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
67
+ /** Checks its rules and shows the result; resolves to whether they pass */
68
+ validate: () => Promise<boolean>;
69
+ /** Hides its validation error (until the next check) */
70
+ resetValidation: () => void;
71
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
72
+ blur: () => any;
55
73
  "update:modelValue": (args_0: unknown[]) => any;
56
74
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
75
+ onBlur?: (() => any) | undefined;
57
76
  "onUpdate:modelValue"?: ((args_0: unknown[]) => any) | undefined;
58
77
  }>, {
59
78
  required: boolean;
@@ -49,7 +49,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
49
49
  }>, {
50
50
  expanded: boolean;
51
51
  modal: boolean;
52
- alignment: "top" | "center" | "bottom";
52
+ alignment: "center" | "top" | "bottom";
53
53
  hideOnCollapse: boolean;
54
54
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
55
55
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -36,12 +36,12 @@ declare const __VLS_template: () => {
36
36
  };
37
37
  type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
38
38
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
39
- "update:modelValue": (items: InboxNotification[]) => any;
40
39
  open: (item: InboxNotification) => any;
40
+ "update:modelValue": (items: InboxNotification[]) => any;
41
41
  dismiss: (item: InboxNotification) => any;
42
42
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
43
- "onUpdate:modelValue"?: ((items: InboxNotification[]) => any) | undefined;
44
43
  onOpen?: ((item: InboxNotification) => any) | undefined;
44
+ "onUpdate:modelValue"?: ((items: InboxNotification[]) => any) | undefined;
45
45
  onDismiss?: ((item: InboxNotification) => any) | undefined;
46
46
  }>, {
47
47
  filter: boolean;
@@ -1,3 +1,4 @@
1
+ import type { ValidateOn, ValidationRule } from '../composables/validation';
1
2
  type __VLS_Props = {
2
3
  /** Bound numeric value (v-model) */
3
4
  modelValue: number | null;
@@ -11,10 +12,21 @@ type __VLS_Props = {
11
12
  max?: number;
12
13
  /** Increment/decrement step */
13
14
  step?: number;
14
- /** Error state */
15
- error?: boolean;
15
+ /** Error state. A string is also the message (`:error="errors.x"`) */
16
+ error?: boolean | string;
16
17
  /** Error message shown when error is true */
17
18
  errorLabel?: string;
19
+ /**
20
+ * Validation rules: functions `(value, ctx) => true | 'message'` (may be async; see the built-in `required`,
21
+ * `email`, `minLength`…) or a Standard Schema (zod, valibot…). Checked in order; the first failure is shown
22
+ */
23
+ rules?: ValidationRule | ValidationRule[];
24
+ /** When the rules are checked and shown: on leaving the field (default; live after that), while typing, or only on submit (`MForm`) */
25
+ validateOn?: ValidateOn;
26
+ /** Wait this long (ms) after the value stops changing before re-checking (one request for an async rule, not one per key). Defaults to its `MForm`'s */
27
+ validateDebounce?: number;
28
+ /** The key of this field in its `MForm`'s values, errors and schema */
29
+ name?: string;
18
30
  /** Hint text */
19
31
  hint?: string;
20
32
  /** Disables the field */
@@ -33,6 +45,10 @@ type __VLS_Props = {
33
45
  debounce?: number;
34
46
  };
35
47
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
48
+ /** Checks its rules and shows the result; resolves to whether they pass */
49
+ validate: () => Promise<boolean>;
50
+ /** Hides its validation error (until the next check) */
51
+ resetValidation: () => void;
36
52
  /** The `<input>` (or `<textarea>`) element */
37
53
  inputEl: import("vue").Ref<HTMLInputElement | null, HTMLInputElement | null>;
38
54
  /** Focuses the field */
@@ -42,9 +58,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
42
58
  /** Selects all its text */
43
59
  select: () => void | undefined;
44
60
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
61
+ blur: () => any;
45
62
  "update:modelValue": (args_0: number | null) => any;
46
63
  debounced: (args_0: number | null) => any;
47
64
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
65
+ onBlur?: (() => any) | undefined;
48
66
  "onUpdate:modelValue"?: ((args_0: number | null) => any) | undefined;
49
67
  onDebounced?: ((args_0: number | null) => any) | undefined;
50
68
  }>, {