@m3ui-vue/m3ui-vue 1.6.2 → 1.7.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 (163) hide show
  1. package/dist/API.md +649 -28
  2. package/dist/{MButton-OQ4wIERQ.js → MButton-CN3wYwIG.js} +2 -2
  3. package/dist/{MButton-OQ4wIERQ.js.map → MButton-CN3wYwIG.js.map} +1 -1
  4. package/dist/{MColorPickerModal-NtkihoK6.js → MColorPickerModal-BKM1CHxr.js} +4 -4
  5. package/dist/{MColorPickerModal-NtkihoK6.js.map → MColorPickerModal-BKM1CHxr.js.map} +1 -1
  6. package/dist/{MDialog-DYMnaBlt.js → MDialog-1LAk9WAO.js} +2 -2
  7. package/dist/{MDialog-DYMnaBlt.js.map → MDialog-1LAk9WAO.js.map} +1 -1
  8. package/dist/{MListItem-D2cNUyzP.js → MListItem-BU5KDRCB.js} +376 -270
  9. package/dist/MListItem-BU5KDRCB.js.map +1 -0
  10. package/dist/{MLoadingIndicator-DWUj0BAB.js → MLoadingIndicator-RykOo5tf.js} +2 -2
  11. package/dist/{MLoadingIndicator-DWUj0BAB.js.map → MLoadingIndicator-RykOo5tf.js.map} +1 -1
  12. package/dist/{MSeekBar-C4cn9RIF.js → MSeekBar-B_Y3MpVz.js} +2 -2
  13. package/dist/{MSeekBar-C4cn9RIF.js.map → MSeekBar-B_Y3MpVz.js.map} +1 -1
  14. package/dist/MSegmentedButton-CiOOY1-N.js +105 -0
  15. package/dist/MSegmentedButton-CiOOY1-N.js.map +1 -0
  16. package/dist/MSlider-BCeVIxcq.js +739 -0
  17. package/dist/MSlider-BCeVIxcq.js.map +1 -0
  18. package/dist/{MSpinner-DZkXZJpc.js → MSpinner-Cs03qoqE.js} +2 -2
  19. package/dist/{MSpinner-DZkXZJpc.js.map → MSpinner-Cs03qoqE.js.map} +1 -1
  20. package/dist/{MTextField-CNH-byir.js → MTextField-NaFbMkjv.js} +162 -115
  21. package/dist/MTextField-NaFbMkjv.js.map +1 -0
  22. package/dist/_useFieldValidation-Bz34IAQY.js +191 -0
  23. package/dist/_useFieldValidation-Bz34IAQY.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/MJsonEditor.vue.d.ts +23 -1
  44. package/dist/components/MMapRoute.vue.d.ts +168 -0
  45. package/dist/components/MMaskField.vue.d.ts +20 -2
  46. package/dist/components/MMentionField.vue.d.ts +13 -2
  47. package/dist/components/MMultiAutocomplete.vue.d.ts +22 -3
  48. package/dist/components/MMultiSelect.vue.d.ts +22 -3
  49. package/dist/components/MNavigationRail.vue.d.ts +1 -1
  50. package/dist/components/MNotificationCenter.vue.d.ts +2 -2
  51. package/dist/components/MNumberField.vue.d.ts +20 -2
  52. package/dist/components/MPhoneInput.vue.d.ts +19 -4
  53. package/dist/components/MPinInput.vue.d.ts +24 -3
  54. package/dist/components/MPosKeypad.vue.d.ts +2 -2
  55. package/dist/components/MRadioGroup.vue.d.ts +23 -1
  56. package/dist/components/MRating.vue.d.ts +23 -1
  57. package/dist/components/MRichTextEditor.vue.d.ts +23 -1
  58. package/dist/components/MSearchBar.vue.d.ts +1 -1
  59. package/dist/components/MSegmentedButton.vue.d.ts +23 -2
  60. package/dist/components/MSelect.vue.d.ts +22 -3
  61. package/dist/components/MSignaturePad.vue.d.ts +19 -0
  62. package/dist/components/MSlider.vue.d.ts +23 -1
  63. package/dist/components/MSwitch.vue.d.ts +23 -1
  64. package/dist/components/MTable.vue.d.ts +1 -1
  65. package/dist/components/MTagInput.vue.d.ts +20 -2
  66. package/dist/components/MText.vue.d.ts +1 -1
  67. package/dist/components/MTextField.vue.d.ts +26 -3
  68. package/dist/components/MTimePicker.vue.d.ts +24 -3
  69. package/dist/components/MTimezoneSelect.vue.d.ts +13 -2
  70. package/dist/components/MTour.vue.d.ts +2 -2
  71. package/dist/components/MTrackingTimeline.vue.d.ts +75 -0
  72. package/dist/components/MWindow.vue.d.ts +2 -2
  73. package/dist/composables/_routeGeometry.d.ts +26 -0
  74. package/dist/composables/_useFieldValidation.d.ts +91 -0
  75. package/dist/composables/mapRouting.d.ts +35 -0
  76. package/dist/composables/useLocale.d.ts +23 -0
  77. package/dist/composables/validation.d.ts +82 -0
  78. package/dist/draw.js +2 -2
  79. package/dist/flow.js +1 -1
  80. package/dist/gantt.js +2 -2
  81. package/dist/index.d.ts +5 -0
  82. package/dist/locales/index.js +154 -7
  83. package/dist/locales/index.js.map +1 -1
  84. package/dist/m3ui-vue.css +1 -1
  85. package/dist/m3ui.js +6768 -5602
  86. package/dist/m3ui.js.map +1 -1
  87. package/dist/map.d.ts +4 -0
  88. package/dist/map.js +1230 -784
  89. package/dist/map.js.map +1 -1
  90. package/dist/media.js +4 -4
  91. package/dist/pdf.js +4 -4
  92. package/dist/rich-text-editor.js +189 -146
  93. package/dist/rich-text-editor.js.map +1 -1
  94. package/dist/styles.css +1 -1
  95. package/dist/{useLocale-DaVSTdm0.js → useLocale-Dh1xZZ8i.js} +22 -1
  96. package/dist/useLocale-Dh1xZZ8i.js.map +1 -0
  97. package/package.json +1 -1
  98. package/src/__tests__/MForm.test.ts +325 -0
  99. package/src/__tests__/MMapRoute.test.ts +384 -0
  100. package/src/__tests__/MPhoneInput.test.ts +5 -2
  101. package/src/__tests__/MRichTextEditor.test.ts +2 -1
  102. package/src/__tests__/MTrackingTimeline.test.ts +66 -0
  103. package/src/__tests__/_fakeMaplibre.ts +4 -1
  104. package/src/__tests__/_osrmRoutes.ts +10 -0
  105. package/src/__tests__/attrsFallthrough.test.ts +11 -0
  106. package/src/__tests__/fieldsValidation.test.ts +229 -0
  107. package/src/__tests__/ssr.test.ts +1 -0
  108. package/src/__tests__/validation.test.ts +77 -0
  109. package/src/components/MAddressField.vue +45 -8
  110. package/src/components/MAutocomplete.vue +69 -23
  111. package/src/components/MCheckbox.vue +80 -17
  112. package/src/components/MCodeEditor.vue +59 -2
  113. package/src/components/MColorPicker.vue +65 -16
  114. package/src/components/MCountrySelect.vue +17 -3
  115. package/src/components/MCreditCardInput.vue +76 -7
  116. package/src/components/MCronField.vue +60 -10
  117. package/src/components/MDatePicker.vue +65 -16
  118. package/src/components/MDateRangePicker.vue +66 -16
  119. package/src/components/MFileUpload.vue +71 -8
  120. package/src/components/MForm.vue +208 -0
  121. package/src/components/MJsonEditor.vue +57 -3
  122. package/src/components/MMapRoute.vue +470 -0
  123. package/src/components/MMaskField.vue +55 -13
  124. package/src/components/MMentionField.vue +17 -2
  125. package/src/components/MMultiAutocomplete.vue +70 -23
  126. package/src/components/MMultiSelect.vue +70 -23
  127. package/src/components/MNumberField.vue +58 -16
  128. package/src/components/MPhoneInput.vue +60 -18
  129. package/src/components/MPinInput.vue +58 -10
  130. package/src/components/MRadioGroup.vue +65 -4
  131. package/src/components/MRating.vue +62 -6
  132. package/src/components/MRichTextEditor.vue +64 -4
  133. package/src/components/MSegmentedButton.vue +59 -2
  134. package/src/components/MSelect.vue +72 -26
  135. package/src/components/MSignaturePad.vue +71 -6
  136. package/src/components/MSlider.vue +61 -10
  137. package/src/components/MSwitch.vue +63 -8
  138. package/src/components/MTagInput.vue +67 -25
  139. package/src/components/MTextField.vue +68 -14
  140. package/src/components/MTimePicker.vue +65 -16
  141. package/src/components/MTimezoneSelect.vue +17 -3
  142. package/src/components/MTrackingTimeline.vue +257 -0
  143. package/src/composables/_routeGeometry.ts +140 -0
  144. package/src/composables/_useFieldValidation.ts +287 -0
  145. package/src/composables/mapRouting.ts +55 -0
  146. package/src/composables/useLocale.ts +46 -0
  147. package/src/composables/validation.ts +178 -0
  148. package/src/index.ts +5 -0
  149. package/src/locales/de.ts +21 -0
  150. package/src/locales/es.ts +28 -7
  151. package/src/locales/fr.ts +21 -0
  152. package/src/locales/ja.ts +21 -0
  153. package/src/locales/ko.ts +21 -0
  154. package/src/locales/pt.ts +21 -0
  155. package/src/locales/zh.ts +21 -0
  156. package/src/map.ts +4 -0
  157. package/dist/MListItem-D2cNUyzP.js.map +0 -1
  158. package/dist/MSegmentedButton-BEB4gXLA.js +0 -64
  159. package/dist/MSegmentedButton-BEB4gXLA.js.map +0 -1
  160. package/dist/MSlider-BIkA6DiE.js +0 -690
  161. package/dist/MSlider-BIkA6DiE.js.map +0 -1
  162. package/dist/MTextField-CNH-byir.js.map +0 -1
  163. package/dist/useLocale-DaVSTdm0.js.map +0 -1
@@ -1,3 +1,4 @@
1
+ import type { ValidateOn, ValidationRule } from '../composables/validation';
1
2
  export interface RichTextEditorLabels {
2
3
  bold?: string;
3
4
  italic?: string;
@@ -32,6 +33,20 @@ type __VLS_Props = {
32
33
  placeholder?: string;
33
34
  /** Disables editing */
34
35
  disabled?: boolean;
36
+ /** Error state. A string is also the message */
37
+ error?: boolean | string;
38
+ /** Error message shown when `error` is true */
39
+ errorLabel?: string;
40
+ /** Inside an `MForm` or with `rules`, the document must have some text (or an image) */
41
+ required?: boolean;
42
+ /** Validation rules (functions or a Standard Schema); see `MForm` */
43
+ rules?: ValidationRule | ValidationRule[];
44
+ /** When the rules are checked and shown: on leaving it (default), on change, or only on submit */
45
+ validateOn?: ValidateOn;
46
+ /** 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 */
47
+ validateDebounce?: number;
48
+ /** The key of this field in its `MForm` */
49
+ name?: string;
35
50
  /** Minimum height of the text area (not used with `fill`) */
36
51
  minHeight?: string;
37
52
  /**
@@ -45,9 +60,16 @@ type __VLS_Props = {
45
60
  */
46
61
  labels?: RichTextEditorLabels;
47
62
  };
48
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
63
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
64
+ /** Checks its rules and shows the result; resolves to whether they pass */
65
+ validate: () => Promise<boolean>;
66
+ /** Hides its validation error (until the next check) */
67
+ resetValidation: () => void;
68
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
69
+ blur: () => any;
49
70
  "update:modelValue": (args_0: string) => any;
50
71
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
72
+ onBlur?: (() => any) | undefined;
51
73
  "onUpdate:modelValue"?: ((args_0: string) => any) | undefined;
52
74
  }>, {
53
75
  fill: boolean;
@@ -48,8 +48,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
48
48
  "onUpdate:modelValue"?: ((args_0: string) => any) | undefined;
49
49
  "onUpdate:expanded"?: ((args_0: boolean) => any) | undefined;
50
50
  }>, {
51
- modelValue: string;
52
51
  loading: boolean;
52
+ modelValue: string;
53
53
  variant: "fullscreen" | "docked" | "fullscreen-contained";
54
54
  disabled: boolean;
55
55
  leadingIcon: string;
@@ -1,3 +1,4 @@
1
+ import type { ValidateOn, ValidationRule } from '../composables/validation';
1
2
  export interface SegmentedOption<V extends string | number = string | number> {
2
3
  value: V;
3
4
  label: string;
@@ -18,15 +19,35 @@ declare const __VLS_export: <V extends string | number, M extends V | V[] = V>(_
18
19
  density?: "default" | "comfortable" | "compact";
19
20
  /** Selected segment color */
20
21
  color?: "primary" | "secondary" | "tertiary";
22
+ /** Error state. A string is also the message */
23
+ error?: boolean | string;
24
+ /** Error message shown when `error` is true */
25
+ errorLabel?: string;
26
+ /** Inside an `MForm` or with `rules`, a segment must be selected */
27
+ required?: boolean;
28
+ /** Validation rules (functions or a Standard Schema); see `MForm` */
29
+ rules?: ValidationRule | ValidationRule[];
30
+ /** When the rules are checked and shown: on leaving it (default), on change, or only on submit */
31
+ validateOn?: ValidateOn;
32
+ /** 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 */
33
+ validateDebounce?: number;
34
+ /** The key of this field in its `MForm` */
35
+ name?: string;
21
36
  } & {
37
+ onBlur?: (() => any) | undefined;
22
38
  "onUpdate:modelValue"?: ((args_0: M) => any) | undefined;
23
39
  }> & (typeof globalThis extends {
24
40
  __VLS_PROPS_FALLBACK: infer P;
25
41
  } ? P : {});
26
- expose: (exposed: {}) => void;
42
+ expose: (exposed: import("vue").ShallowUnwrapRef<{
43
+ /** Checks its rules and shows the result; resolves to whether they pass */
44
+ validate: () => Promise<boolean>;
45
+ /** Hides its validation error (until the next check) */
46
+ resetValidation: () => void;
47
+ }>) => void;
27
48
  attrs: any;
28
49
  slots: {};
29
- emit: (evt: "update:modelValue", args_0: M) => void;
50
+ emit: ((evt: "blur") => void) & ((evt: "update:modelValue", args_0: M) => void);
30
51
  }>) => import("vue").VNode & {
31
52
  __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
32
53
  };
@@ -1,3 +1,4 @@
1
+ import type { ValidateOn, ValidationRule } from '../composables/validation';
1
2
  export interface SelectOption {
2
3
  label: string;
3
4
  value: unknown;
@@ -18,10 +19,21 @@ type __VLS_Props = {
18
19
  mode?: 'docked' | 'modal';
19
20
  /** Disables the select */
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 */
@@ -37,9 +49,16 @@ type __VLS_Props = {
37
49
  /** Text shown when options is empty — defaults to the current locale's string */
38
50
  noResultsText?: string;
39
51
  };
40
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
52
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
53
+ /** Checks its rules and shows the result; resolves to whether they pass */
54
+ validate: () => Promise<boolean>;
55
+ /** Hides its validation error (until the next check) */
56
+ resetValidation: () => void;
57
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
58
+ blur: () => any;
41
59
  "update:modelValue": (args_0: unknown) => any;
42
60
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
61
+ onBlur?: (() => any) | undefined;
43
62
  "onUpdate:modelValue"?: ((args_0: unknown) => any) | undefined;
44
63
  }>, {
45
64
  required: boolean;
@@ -1,3 +1,4 @@
1
+ import type { ValidateOn, ValidationRule } from '../composables/validation';
1
2
  type __VLS_Props = {
2
3
  /** Canvas width in px */
3
4
  width?: number;
@@ -13,6 +14,20 @@ type __VLS_Props = {
13
14
  variant?: 'filled' | 'outlined';
14
15
  /** Disables drawing */
15
16
  disabled?: boolean;
17
+ /** Error state. A string is also the message */
18
+ error?: boolean | string;
19
+ /** Error message shown when `error` is true */
20
+ errorLabel?: string;
21
+ /** Inside an `MForm` or with `rules`, a signature must be drawn */
22
+ required?: boolean;
23
+ /** Validation rules (functions or a Standard Schema); see `MForm` */
24
+ rules?: ValidationRule | ValidationRule[];
25
+ /** When the rules are checked and shown: after each stroke (default), or only on submit */
26
+ validateOn?: ValidateOn;
27
+ /** 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 */
28
+ validateDebounce?: number;
29
+ /** The key of this field in its `MForm` */
30
+ name?: string;
16
31
  };
17
32
  declare function clear(): void;
18
33
  declare function undo(): void;
@@ -23,6 +38,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
23
38
  undo: typeof undo;
24
39
  isEmpty: typeof isEmpty;
25
40
  toDataURL: typeof toDataURL;
41
+ /** Checks its rules and shows the result; resolves to whether they pass */
42
+ validate: () => Promise<boolean>;
43
+ /** Hides its validation error (until the next check) */
44
+ resetValidation: () => void;
26
45
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
27
46
  change: (args_0: string) => any;
28
47
  end: (args_0: string) => any;
@@ -1,3 +1,4 @@
1
+ import type { ValidateOn, ValidationRule } from '../composables/validation';
1
2
  type __VLS_Props = {
2
3
  /** Current value — a tuple when variant is range */
3
4
  modelValue: number | [number, number];
@@ -11,6 +12,20 @@ type __VLS_Props = {
11
12
  disabled?: boolean;
12
13
  /** Label text */
13
14
  label?: string;
15
+ /** Error state. A string is also the message */
16
+ error?: boolean | string;
17
+ /** Error message shown when `error` is true */
18
+ errorLabel?: string;
19
+ /** Marks it as required (asterisk); a slider always has a value, so use `rules` (e.g. `min(1)`) for limits */
20
+ required?: boolean;
21
+ /** Validation rules (functions or a Standard Schema); see `MForm` */
22
+ rules?: ValidationRule | ValidationRule[];
23
+ /** When the rules are checked and shown: on leaving it (default), on change, or only on submit */
24
+ validateOn?: ValidateOn;
25
+ /** 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 */
26
+ validateDebounce?: number;
27
+ /** The key of this field in its `MForm` */
28
+ name?: string;
14
29
  /** Show current value beside label */
15
30
  showValue?: boolean;
16
31
  /** Show value tooltip while dragging */
@@ -34,9 +49,16 @@ type __VLS_Props = {
34
49
  /** Custom color (hex, rgb(), a CSS var, etc.) for the thumb (bar or icon). Defaults to `color`'s M3 token. */
35
50
  thumbColor?: string;
36
51
  };
37
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
52
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
53
+ /** Checks its rules and shows the result; resolves to whether they pass */
54
+ validate: () => Promise<boolean>;
55
+ /** Hides its validation error (until the next check) */
56
+ resetValidation: () => void;
57
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
58
+ blur: () => any;
38
59
  "update:modelValue": (args_0: number | [number, number]) => any;
39
60
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
61
+ onBlur?: (() => any) | undefined;
40
62
  "onUpdate:modelValue"?: ((args_0: number | [number, number]) => any) | undefined;
41
63
  }>, {
42
64
  color: "primary" | "secondary" | "tertiary" | "error";
@@ -1,3 +1,4 @@
1
+ import type { ValidateOn, ValidationRule } from '../composables/validation';
1
2
  type __VLS_Props = {
2
3
  /** Toggle state (v-model) */
3
4
  modelValue: boolean;
@@ -9,10 +10,31 @@ type __VLS_Props = {
9
10
  color?: 'primary' | 'secondary' | 'tertiary' | 'error';
10
11
  /** Shows a check icon in the thumb while on. Set to `false` for M3's plain switch without an icon. */
11
12
  icon?: 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
+ /** Must be on, inside an `MForm` or with `rules` */
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
  };
13
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
28
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
29
+ /** Checks its rules and shows the result; resolves to whether they pass */
30
+ validate: () => Promise<boolean>;
31
+ /** Hides its validation error (until the next check) */
32
+ resetValidation: () => void;
33
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
34
+ blur: (args_0: FocusEvent) => any;
14
35
  "update:modelValue": (args_0: boolean) => any;
15
36
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
37
+ onBlur?: ((args_0: FocusEvent) => any) | undefined;
16
38
  "onUpdate:modelValue"?: ((args_0: boolean) => any) | undefined;
17
39
  }>, {
18
40
  color: "primary" | "secondary" | "tertiary" | "error";
@@ -76,8 +76,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
76
76
  onRowClick?: ((args_0: Record<string, any>) => any) | undefined;
77
77
  onFetch?: ((args_0: TableFetchParams) => any) | undefined;
78
78
  }>, {
79
- modelValue: Record<string, any>[];
80
79
  loading: boolean;
80
+ modelValue: Record<string, any>[];
81
81
  page: number;
82
82
  selectable: boolean;
83
83
  perPage: number;
@@ -1,3 +1,4 @@
1
+ import type { ValidateOn, ValidationRule } from '../composables/validation';
1
2
  type __VLS_Props = {
2
3
  /** Array of tags (v-model) */
3
4
  modelValue: string[];
@@ -9,10 +10,21 @@ type __VLS_Props = {
9
10
  variant?: 'filled' | 'outlined';
10
11
  /** Disables the field */
11
12
  disabled?: boolean;
12
- /** Error state */
13
- error?: boolean;
13
+ /** Error state. A string is also the message (`:error="errors.x"`) */
14
+ error?: boolean | string;
14
15
  /** Error message shown when error is true */
15
16
  errorLabel?: string;
17
+ /**
18
+ * Validation rules: functions `(value, ctx) => true | 'message'` (may be async; see the built-in `required`,
19
+ * `email`, `minLength`…) or a Standard Schema (zod, valibot…). Checked in order; the first failure is shown
20
+ */
21
+ rules?: ValidationRule | ValidationRule[];
22
+ /** When the rules are checked and shown: on leaving the field (default; live after that), while typing, or only on submit (`MForm`) */
23
+ validateOn?: ValidateOn;
24
+ /** 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 */
25
+ validateDebounce?: number;
26
+ /** The key of this field in its `MForm`'s values, errors and schema */
27
+ name?: string;
16
28
  /** Helper text below field */
17
29
  hint?: string;
18
30
  /** Marks as required — adds a red asterisk after the label */
@@ -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 */
@@ -44,9 +60,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
44
60
  /** Selects part of its text (e.g. a file name without its extension) */
45
61
  setSelectionRange: (start: number, end: number, direction?: "forward" | "backward" | "none") => void | undefined;
46
62
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
63
+ blur: () => any;
47
64
  "update:modelValue": (args_0: string[]) => any;
48
65
  debounced: (args_0: string[]) => any;
49
66
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
67
+ onBlur?: (() => any) | undefined;
50
68
  "onUpdate:modelValue"?: ((args_0: string[]) => any) | undefined;
51
69
  onDebounced?: ((args_0: string[]) => any) | undefined;
52
70
  }>, {
@@ -27,7 +27,7 @@ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
27
27
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
28
28
  color: "on-surface" | "on-surface-variant" | "primary" | "secondary" | "tertiary" | "error" | "inherit";
29
29
  variant: TextVariant;
30
- align: "left" | "center" | "right";
30
+ align: "center" | "left" | "right";
31
31
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
32
32
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
33
33
  declare const _default: typeof __VLS_export;
@@ -1,3 +1,4 @@
1
+ import type { ValidateOn, ValidationRule } from '../composables/validation';
1
2
  type __VLS_Props = {
2
3
  /** Bound value (v-model) */
3
4
  modelValue: string | number;
@@ -7,15 +8,29 @@ type __VLS_Props = {
7
8
  type?: string;
8
9
  /** Visual style */
9
10
  variant?: "filled" | "outlined";
10
- /** Puts the field in error state (red border and label) */
11
- error?: boolean;
11
+ /**
12
+ * Puts the field in error state (red border and label). A string is also the message, so a validation
13
+ * library's error plugs straight in: `:error="errors.email"`
14
+ */
15
+ error?: boolean | string;
12
16
  /** Error message shown below the field (only visible when error is true) */
13
17
  errorLabel?: string;
18
+ /**
19
+ * Validation rules: functions `(value, ctx) => true | 'message'` (may be async; see the built-in `required`,
20
+ * `email`, `minLength`…) or a Standard Schema (zod, valibot…). Checked in order; the first failure is shown
21
+ */
22
+ rules?: ValidationRule | ValidationRule[];
23
+ /** When the rules are checked and shown: on leaving the field (default; live after that), while typing, or only on submit (`MForm`) */
24
+ validateOn?: ValidateOn;
25
+ /** 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 */
26
+ validateDebounce?: number;
27
+ /** Native `name`; also the key of this field in its `MForm`'s values, errors and schema */
28
+ name?: string;
14
29
  /** Hint text shown below the field */
15
30
  hint?: string;
16
31
  /** Disables the field */
17
32
  disabled?: boolean;
18
- /** Marks as required — adds a red asterisk after the label */
33
+ /** Marks as required — adds a red asterisk after the label; inside an `MForm` or with `rules`, also validates it */
19
34
  required?: boolean;
20
35
  /** Renders a textarea instead of an input */
21
36
  multiline?: boolean;
@@ -53,13 +68,21 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
53
68
  blur: () => void | undefined;
54
69
  /** Selects all its text */
55
70
  select: () => void | undefined;
71
+ /** Checks its rules and shows the result; resolves to whether they pass */
72
+ validate: () => Promise<boolean>;
73
+ /** Hides its validation error (until the next check) */
74
+ resetValidation: () => void;
56
75
  /** Selects part of its text (e.g. a file name without its extension) */
57
76
  setSelectionRange: (start: number, end: number, direction?: "forward" | "backward" | "none") => void | undefined;
58
77
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
78
+ blur: (args_0: FocusEvent) => any;
59
79
  "update:modelValue": (args_0: string) => any;
80
+ focus: (args_0: FocusEvent) => any;
60
81
  debounced: (args_0: string) => any;
61
82
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
83
+ onBlur?: ((args_0: FocusEvent) => any) | undefined;
62
84
  "onUpdate:modelValue"?: ((args_0: string) => any) | undefined;
85
+ onFocus?: ((args_0: FocusEvent) => any) | undefined;
63
86
  onDebounced?: ((args_0: string) => any) | undefined;
64
87
  }>, {
65
88
  type: string;
@@ -1,3 +1,4 @@
1
+ import type { ValidateOn, ValidationRule } from '../composables/validation';
1
2
  type __VLS_Props = {
2
3
  /** Selected time (HH:MM, v-model) */
3
4
  modelValue: string | null;
@@ -7,10 +8,23 @@ type __VLS_Props = {
7
8
  placeholder?: string;
8
9
  /** Disables the picker */
9
10
  disabled?: boolean;
10
- /** Error state */
11
- error?: boolean;
11
+ /** Error state. A string is also the message (`:error="errors.x"`) */
12
+ error?: boolean | string;
12
13
  /** Error message shown when error is true */
13
14
  errorLabel?: string;
15
+ /** Marks as required — adds a red asterisk after the label; inside an `MForm` or with `rules`, also validates it */
16
+ required?: boolean;
17
+ /**
18
+ * Validation rules: functions `(value, ctx) => true | 'message'` (may be async; see the built-in `required`,
19
+ * `email`, `minLength`…) or a Standard Schema (zod, valibot…). Checked in order; the first failure is shown
20
+ */
21
+ rules?: ValidationRule | ValidationRule[];
22
+ /** When the rules are checked and shown: on leaving the field (default; live after that), while typing, or only on submit (`MForm`) */
23
+ validateOn?: ValidateOn;
24
+ /** 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 */
25
+ validateDebounce?: number;
26
+ /** The key of this field in its `MForm`'s values, errors and schema */
27
+ name?: string;
14
28
  /** Hint text below the field */
15
29
  hint?: string;
16
30
  /** Minute increment step */
@@ -20,9 +34,16 @@ type __VLS_Props = {
20
34
  /** Overrides the auto-detected background color used to cut the floating label out of the border */
21
35
  fieldBg?: string;
22
36
  };
23
- 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;
24
44
  "update:modelValue": (args_0: string | null) => any;
25
45
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
46
+ onBlur?: (() => any) | undefined;
26
47
  "onUpdate:modelValue"?: ((args_0: string | null) => any) | undefined;
27
48
  }>, {
28
49
  minuteStep: number;
@@ -1,3 +1,4 @@
1
+ import type { ValidateOn, ValidationRule } from '../composables/validation';
1
2
  type __VLS_Props = {
2
3
  /** The IANA time zone name (v-model), or null */
3
4
  modelValue?: string | null;
@@ -15,18 +16,28 @@ type __VLS_Props = {
15
16
  clearable?: boolean;
16
17
  /** Helper text below the field */
17
18
  hint?: string;
18
- /** Error state */
19
- error?: boolean;
19
+ /** Error state. A string is also the message */
20
+ error?: boolean | string;
20
21
  /** Error message shown when `error` is true */
21
22
  errorLabel?: string;
23
+ /** Validation rules (functions or a Standard Schema); see `MForm` */
24
+ rules?: ValidationRule | ValidationRule[];
25
+ /** When the rules are checked and shown: on leaving the field (default), while typing, or only on submit */
26
+ validateOn?: ValidateOn;
27
+ /** 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 */
28
+ validateDebounce?: number;
29
+ /** The key of this field in its `MForm` */
30
+ name?: string;
22
31
  /** Marks it as required */
23
32
  required?: boolean;
24
33
  /** Disables the field */
25
34
  disabled?: boolean;
26
35
  };
27
36
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
37
+ blur: () => any;
28
38
  "update:modelValue": (zone: string | null) => any;
29
39
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
40
+ onBlur?: (() => any) | undefined;
30
41
  "onUpdate:modelValue"?: ((zone: string | null) => any) | undefined;
31
42
  }>, {
32
43
  mode: "docked" | "modal";
@@ -61,12 +61,12 @@ declare const __VLS_template: () => {
61
61
  };
62
62
  type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
63
63
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
64
- "update:modelValue": (args_0: boolean) => any;
65
64
  finish: () => any;
65
+ "update:modelValue": (args_0: boolean) => any;
66
66
  "update:step": (args_0: number) => any;
67
67
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
68
- "onUpdate:modelValue"?: ((args_0: boolean) => any) | undefined;
69
68
  onFinish?: (() => any) | undefined;
69
+ "onUpdate:modelValue"?: ((args_0: boolean) => any) | undefined;
70
70
  "onUpdate:step"?: ((args_0: number) => any) | undefined;
71
71
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
72
72
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -0,0 +1,75 @@
1
+ /** A stage of an `MTrackingTimeline`: Order placed, Preparing, On the way, Delivered… */
2
+ export interface TrackingStep {
3
+ /** Its name */
4
+ label: string;
5
+ /** A line under it in the details (who, where) */
6
+ description?: string;
7
+ /** A Material Symbol for its dot */
8
+ icon?: string;
9
+ /** When it happened (or is expected): shown as a time in the details */
10
+ time?: string | number | Date;
11
+ }
12
+ /** Where the order stands besides its step: on time, running late, or called off */
13
+ export type TrackingStatus = 'active' | 'delayed' | 'canceled';
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
16
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
17
+ /** The stages, in order */
18
+ steps: TrackingStep[];
19
+ /** The stage it's at (0-based): earlier ones are done. `steps.length` (or more) means all done */
20
+ current: number;
21
+ /** How far along the current stage's leg it is, 0–1 (the bar fills toward the next stage) */
22
+ stepProgress?: number;
23
+ /** The expected arrival: shows the minutes left and the time, and updates by itself */
24
+ eta?: string | number | Date;
25
+ /** On time (`active`), running late (`delayed`) or called off (`canceled`) */
26
+ status?: TrackingStatus;
27
+ /** The title, instead of the current stage's name */
28
+ title?: string;
29
+ /** A line under the title ("Your courier is 2 blocks away") */
30
+ message?: string;
31
+ /** Offer the stages with their times in a list that opens below */
32
+ details?: boolean;
33
+ /** Whether the details are open (v-model:expanded) */
34
+ expanded?: boolean;
35
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
36
+ "update:expanded": (open: boolean) => any;
37
+ }, string, import("vue").PublicProps, Readonly<{
38
+ /** The stages, in order */
39
+ steps: TrackingStep[];
40
+ /** The stage it's at (0-based): earlier ones are done. `steps.length` (or more) means all done */
41
+ current: number;
42
+ /** How far along the current stage's leg it is, 0–1 (the bar fills toward the next stage) */
43
+ stepProgress?: number;
44
+ /** The expected arrival: shows the minutes left and the time, and updates by itself */
45
+ eta?: string | number | Date;
46
+ /** On time (`active`), running late (`delayed`) or called off (`canceled`) */
47
+ status?: TrackingStatus;
48
+ /** The title, instead of the current stage's name */
49
+ title?: string;
50
+ /** A line under the title ("Your courier is 2 blocks away") */
51
+ message?: string;
52
+ /** Offer the stages with their times in a list that opens below */
53
+ details?: boolean;
54
+ /** Whether the details are open (v-model:expanded) */
55
+ expanded?: boolean;
56
+ }> & Readonly<{
57
+ "onUpdate:expanded"?: ((open: boolean) => any) | undefined;
58
+ }>, {
59
+ details: boolean;
60
+ status: TrackingStatus;
61
+ expanded: boolean;
62
+ stepProgress: number;
63
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
64
+ title?: (props: {
65
+ step: TrackingStep | undefined;
66
+ index: number;
67
+ }) => any;
68
+ } & {
69
+ extra?: (props: {}) => any;
70
+ }>;
71
+ type __VLS_WithSlots<T, S> = T & {
72
+ new (): {
73
+ $slots: S;
74
+ };
75
+ };
@@ -52,8 +52,8 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
52
52
  toggleMaximize: () => void;
53
53
  toggleMinimize: () => void;
54
54
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
55
- "update:modelValue": (value: boolean) => any;
56
55
  close: () => any;
56
+ "update:modelValue": (value: boolean) => any;
57
57
  focus: () => any;
58
58
  minimize: () => any;
59
59
  maximize: (maximized: boolean) => any;
@@ -104,8 +104,8 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
104
104
  /** Reset position, size, and state when the window is closed */
105
105
  resetPosition?: boolean;
106
106
  }> & Readonly<{
107
- "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
108
107
  onClose?: (() => any) | undefined;
108
+ "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
109
109
  onFocus?: (() => any) | undefined;
110
110
  onMinimize?: (() => any) | undefined;
111
111
  onMaximize?: ((maximized: boolean) => any) | undefined;
@@ -0,0 +1,26 @@
1
+ import { type LngLat } from './_mapGeometry';
2
+ /** Distance from the start to each point of the path, in meters (`[0, …, total]`). */
3
+ export declare function cumulative(path: LngLat[]): number[];
4
+ /** Initial bearing from a to b, degrees clockwise from north (0–360). */
5
+ export declare function bearing(a: LngLat, b: LngLat): number;
6
+ /** The point `d` meters along the path, and the heading there. Clamped to the path's ends. */
7
+ export declare function pointAlong(path: LngLat[], cum: number[], d: number): {
8
+ lngLat: LngLat;
9
+ bearing: number;
10
+ };
11
+ /** The part of the path between two distances along it. */
12
+ export declare function slicePath(path: LngLat[], cum: number[], from: number, to: number): LngLat[];
13
+ /**
14
+ * How far along the path (meters) the point nearest to `p` is: where a GPS position, slightly off the road, falls on
15
+ * the route. Projects onto each segment in a local flat approximation (fine at street scale).
16
+ */
17
+ export declare function project(path: LngLat[], cum: number[], p: LngLat): number;
18
+ /**
19
+ * Like `project`, but for something that moves forward along the route (a vehicle's GPS fixes, the stops in order):
20
+ * only the part from `from` on is considered (minus `back` meters of slack for jitter), and points further ahead
21
+ * cost a little more, so a route that passes the same place twice (out and back on one avenue, a loop, two close
22
+ * parallel streets) doesn't snap a fix to the wrong pass. Never returns less than `from`.
23
+ */
24
+ export declare function projectForward(path: LngLat[], cum: number[], p: LngLat, from: number, back?: number): number;
25
+ /** The bounding box of points, `[[west, south], [east, north]]`. */
26
+ export declare function bounds(points: LngLat[]): [LngLat, LngLat];