@getcortexlabs/mavis-web 0.0.0-stage → 0.1.0-alpha.1

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 (60) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +25 -2
  3. package/dist/components/MButton.d.ts +102 -0
  4. package/dist/components/MButton.d.ts.map +1 -0
  5. package/dist/components/MButton.js +59 -0
  6. package/dist/components/MButton.js.map +1 -0
  7. package/dist/components/MCard.d.ts +127 -0
  8. package/dist/components/MCard.d.ts.map +1 -0
  9. package/dist/components/MCard.js +51 -0
  10. package/dist/components/MCard.js.map +1 -0
  11. package/dist/components/MInput.d.ts +175 -0
  12. package/dist/components/MInput.d.ts.map +1 -0
  13. package/dist/components/MInput.js +182 -0
  14. package/dist/components/MInput.js.map +1 -0
  15. package/dist/components/MReveal.d.ts +145 -0
  16. package/dist/components/MReveal.d.ts.map +1 -0
  17. package/dist/components/MReveal.js +40 -0
  18. package/dist/components/MReveal.js.map +1 -0
  19. package/dist/components/MScreen.d.ts +37 -0
  20. package/dist/components/MScreen.d.ts.map +1 -0
  21. package/dist/components/MScreen.js +32 -0
  22. package/dist/components/MScreen.js.map +1 -0
  23. package/dist/components/MSlider.d.ts +76 -0
  24. package/dist/components/MSlider.d.ts.map +1 -0
  25. package/dist/components/MSlider.js +54 -0
  26. package/dist/components/MSlider.js.map +1 -0
  27. package/dist/components/MText.d.ts +114 -0
  28. package/dist/components/MText.d.ts.map +1 -0
  29. package/dist/components/MText.js +33 -0
  30. package/dist/components/MText.js.map +1 -0
  31. package/dist/components/layout.d.ts +391 -0
  32. package/dist/components/layout.d.ts.map +1 -0
  33. package/dist/components/layout.js +56 -0
  34. package/dist/components/layout.js.map +1 -0
  35. package/dist/index.d.ts +21 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +35 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/screen-viewport.d.ts +2 -0
  40. package/dist/screen-viewport.d.ts.map +1 -0
  41. package/dist/screen-viewport.js +87 -0
  42. package/dist/screen-viewport.js.map +1 -0
  43. package/dist/style.d.ts +13 -0
  44. package/dist/style.d.ts.map +1 -0
  45. package/dist/style.js +33 -0
  46. package/dist/style.js.map +1 -0
  47. package/package.json +54 -4
  48. package/src/components/MButton.ts +73 -0
  49. package/src/components/MCard.ts +56 -0
  50. package/src/components/MInput.ts +217 -0
  51. package/src/components/MReveal.ts +43 -0
  52. package/src/components/MScreen.ts +45 -0
  53. package/src/components/MSlider.ts +59 -0
  54. package/src/components/MText.ts +46 -0
  55. package/src/components/layout.ts +84 -0
  56. package/src/index.ts +39 -0
  57. package/src/screen-viewport.ts +80 -0
  58. package/src/style.css +139 -0
  59. package/src/style.d.ts +2 -0
  60. package/src/style.ts +43 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Rafael Augusto
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,26 @@
1
- # Temporary Holding Version
1
+ # Mavis for Vue Web
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Vue Web implementation of the ten Mavis components, version `0.1.0-alpha.1`. Experimental prerelease for testing in real apps; the API can change between alpha versions. Licensed under MIT.
4
+
5
+ In an existing Vue application:
6
+
7
+ ```sh
8
+ npm install @getcortexlabs/mavis-web@0.1.0-alpha.1
9
+ ```
10
+
11
+ ```ts
12
+ import { createApp } from 'vue'
13
+ import { createMavis } from '@getcortexlabs/mavis-web'
14
+ import '@getcortexlabs/mavis-web/style.css'
15
+ import App from './App.vue'
16
+
17
+ createApp(App).use(createMavis()).mount('#app')
18
+ ```
19
+
20
+ The stylesheet supplies focus indicators, box overlays, and motion. The plugin registers Screen, Row, Column, Box, Card, Text, Button, Input, Slider and Reveal; Vue also accepts their `m-*` spellings.
21
+
22
+ Themes and Vue context come from `@getcortexlabs/mavis-core`. NativeScript and Jolt are not dependencies of this package. Browser motion currently uses CSS; [Jolt #236](https://github.com/rafaelaugustos/jolt/issues/236) tracks its Web backend.
23
+
24
+ Use `MText.as` for HTML heading semantics. Buttons emit a payload-free `click` and retain native HTML keyboard activation. Sliders expose semantic values to accessibility APIs, including fractional steps. Theme state belongs to each app. The package is safe to import during server rendering.
25
+
26
+ Tested with Vue 3.5.42, Vite 6.4.5, TypeScript 6.0.3 and vue-tsc 3.3.13. See the [Web guide](https://mavis-ui.getcortexlabs.com/guide/web) for setup and portability limits, and the [release notes](https://github.com/getcortexlabs/mavis-ui/blob/main/CHANGELOG.md) for the alpha boundary.
@@ -0,0 +1,102 @@
1
+ export declare const MButton: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ text: {
3
+ type: StringConstructor;
4
+ default: undefined;
5
+ };
6
+ variant: {
7
+ type: import("vue").PropType<"primary" | "secondary" | "ghost">;
8
+ default: "primary" | "secondary" | "ghost";
9
+ validator: (value: "primary" | "secondary" | "ghost") => boolean;
10
+ };
11
+ size: {
12
+ type: import("vue").PropType<"sm" | "md" | "lg">;
13
+ default: "sm" | "md" | "lg";
14
+ validator: (value: "sm" | "md" | "lg") => boolean;
15
+ };
16
+ disabled: BooleanConstructor;
17
+ loading: BooleanConstructor;
18
+ loadingText: {
19
+ type: StringConstructor;
20
+ default: string;
21
+ };
22
+ grow: {
23
+ type: NumberConstructor;
24
+ default: number;
25
+ };
26
+ shrink: {
27
+ type: NumberConstructor;
28
+ default: undefined;
29
+ };
30
+ id: {
31
+ type: StringConstructor;
32
+ default: undefined;
33
+ };
34
+ accessibilityLabel: {
35
+ type: StringConstructor;
36
+ default: undefined;
37
+ };
38
+ accessibilityHidden: {
39
+ type: BooleanConstructor;
40
+ default: undefined;
41
+ };
42
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
43
+ [key: string]: any;
44
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
45
+ click: () => boolean;
46
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
47
+ text: {
48
+ type: StringConstructor;
49
+ default: undefined;
50
+ };
51
+ variant: {
52
+ type: import("vue").PropType<"primary" | "secondary" | "ghost">;
53
+ default: "primary" | "secondary" | "ghost";
54
+ validator: (value: "primary" | "secondary" | "ghost") => boolean;
55
+ };
56
+ size: {
57
+ type: import("vue").PropType<"sm" | "md" | "lg">;
58
+ default: "sm" | "md" | "lg";
59
+ validator: (value: "sm" | "md" | "lg") => boolean;
60
+ };
61
+ disabled: BooleanConstructor;
62
+ loading: BooleanConstructor;
63
+ loadingText: {
64
+ type: StringConstructor;
65
+ default: string;
66
+ };
67
+ grow: {
68
+ type: NumberConstructor;
69
+ default: number;
70
+ };
71
+ shrink: {
72
+ type: NumberConstructor;
73
+ default: undefined;
74
+ };
75
+ id: {
76
+ type: StringConstructor;
77
+ default: undefined;
78
+ };
79
+ accessibilityLabel: {
80
+ type: StringConstructor;
81
+ default: undefined;
82
+ };
83
+ accessibilityHidden: {
84
+ type: BooleanConstructor;
85
+ default: undefined;
86
+ };
87
+ }>> & Readonly<{
88
+ onClick?: (() => any) | undefined;
89
+ }>, {
90
+ grow: number;
91
+ shrink: number;
92
+ id: string;
93
+ accessibilityLabel: string;
94
+ accessibilityHidden: boolean;
95
+ size: "sm" | "md" | "lg";
96
+ text: string;
97
+ disabled: boolean;
98
+ variant: "primary" | "secondary" | "ghost";
99
+ loading: boolean;
100
+ loadingText: string;
101
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
102
+ //# sourceMappingURL=MButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MButton.d.ts","sourceRoot":"","sources":["../../src/components/MButton.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4EA4DlB,CAAA"}
@@ -0,0 +1,59 @@
1
+ import { defineComponent, h, mergeProps } from 'vue';
2
+ import { buttonProps, useMavisTheme, actionEmits, textContent, useDefaultShrink, viewAttrs, } from '@getcortexlabs/mavis-core/vue';
3
+ import { nonNegative } from '@getcortexlabs/mavis-core';
4
+ import { webAttrs } from '../style.js';
5
+ export const MButton = defineComponent({
6
+ name: 'MButton',
7
+ inheritAttrs: false,
8
+ props: buttonProps,
9
+ emits: actionEmits,
10
+ setup(props, { attrs, slots, emit }) {
11
+ const { theme } = useMavisTheme();
12
+ const shrink = useDefaultShrink();
13
+ return () => {
14
+ const { colors, control, radius, motion } = theme.value;
15
+ const size = control[props.size];
16
+ const primary = props.variant === 'primary';
17
+ const text = props.loading
18
+ ? props.loadingText
19
+ : (props.text ?? textContent(slots.default?.()));
20
+ return h('button', mergeProps({
21
+ class: 'm-button',
22
+ style: {
23
+ boxSizing: 'border-box',
24
+ minHeight: `${size.height}px`,
25
+ padding: `12px ${size.padding}px`,
26
+ fontSize: `${size.fontSize}px`,
27
+ fontWeight: 600,
28
+ fontFamily: 'inherit',
29
+ lineHeight: 1.3,
30
+ backgroundColor: primary
31
+ ? colors.primary
32
+ : props.variant === 'secondary'
33
+ ? colors.elevated
34
+ : 'transparent',
35
+ color: primary ? colors.onPrimary : colors.text,
36
+ borderRadius: `${radius.md}px`,
37
+ border: 0,
38
+ margin: 0,
39
+ opacity: props.disabled ? 0.45 : 1,
40
+ flexGrow: nonNegative(props.grow, 'grow'),
41
+ flexShrink: nonNegative(props.shrink ?? shrink, 'shrink'),
42
+ minWidth: '44px',
43
+ '--m-press-scale': motion.pressScale,
44
+ '--m-focus': colors.primary,
45
+ },
46
+ }, webAttrs({ ...attrs, ...viewAttrs(props) }), {
47
+ type: 'button',
48
+ disabled: props.disabled,
49
+ 'aria-disabled': props.disabled || props.loading || undefined,
50
+ 'aria-busy': props.loading || undefined,
51
+ onClick: () => {
52
+ if (!props.disabled && !props.loading)
53
+ emit('click');
54
+ },
55
+ }), text);
56
+ };
57
+ },
58
+ });
59
+ //# sourceMappingURL=MButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MButton.js","sourceRoot":"","sources":["../../src/components/MButton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,CAAC,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EACL,WAAW,EACX,aAAa,EACb,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,SAAS,GACV,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CAAC;IACrC,IAAI,EAAE,SAAS;IACf,YAAY,EAAE,KAAK;IACnB,KAAK,EAAE,WAAW;IAClB,KAAK,EAAE,WAAW;IAClB,KAAK,CAAC,K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M,CAAC,EAAE,IAAI;oBAC9B,MAAM,EAAE,CAAC;oBACT,MAAM,EAAE,CAAC;oBACT,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;oBAClC,QAAQ,EAAE,WAAW,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC;oBACzC,UAAU,EAAE,WAAW,CAAC,KAAK,CAAC,MAAM,IAAI,MAAM,EAAE,QAAQ,CAAC;oBACzD,QAAQ,EAAE,MAAM;oBAChB,iBAAiB,EAAE,MAAM,CAAC,UAAU;oBACpC,WAAW,EAAE,MAAM,CAAC,OAAO;iBAC5B;aACF,EACD,QAAQ,CAAC,EAAE,GAAG,KAAK,EAAE,GAAG,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,EAC3C;gBACE,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,eAAe,EAAE,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,OAAO,IAAI,SAAS;gBAC7D,WAAW,EAAE,KAAK,CAAC,OAAO,IAAI,SAAS;gBACvC,OAAO,EAAE,GAAG,EAAE;oBACZ,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO;wBAAE,IAAI,CAAC,OAAO,CAAC,CAAA;gBACtD,CAAC;aACF,CACF,EACD,IAAI,CACL,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA"}
@@ -0,0 +1,127 @@
1
+ export declare const MCard: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ padding: {
3
+ default: string;
4
+ type: import("vue").PropType<import("@getcortexlabs/mavis-core").Spacing>;
5
+ };
6
+ radius: {
7
+ default: string;
8
+ type: import("vue").PropType<import("@getcortexlabs/mavis-core").Radius | number>;
9
+ };
10
+ gap: {
11
+ type: import("vue").PropType<import("@getcortexlabs/mavis-core").Spacing>;
12
+ default: undefined;
13
+ };
14
+ interactive: BooleanConstructor;
15
+ disabled: BooleanConstructor;
16
+ paddingX: {
17
+ type: import("vue").PropType<import("@getcortexlabs/mavis-core").Spacing>;
18
+ default: undefined;
19
+ };
20
+ paddingY: {
21
+ type: import("vue").PropType<import("@getcortexlabs/mavis-core").Spacing>;
22
+ default: undefined;
23
+ };
24
+ width: {
25
+ type: import("vue").PropType<import("@getcortexlabs/mavis-core").Dimension>;
26
+ default: undefined;
27
+ };
28
+ height: {
29
+ type: import("vue").PropType<import("@getcortexlabs/mavis-core").Dimension>;
30
+ default: undefined;
31
+ };
32
+ backgroundColor: StringConstructor;
33
+ grow: {
34
+ type: NumberConstructor;
35
+ default: number;
36
+ };
37
+ shrink: {
38
+ type: NumberConstructor;
39
+ default: undefined;
40
+ };
41
+ id: {
42
+ type: StringConstructor;
43
+ default: undefined;
44
+ };
45
+ accessibilityLabel: {
46
+ type: StringConstructor;
47
+ default: undefined;
48
+ };
49
+ accessibilityHidden: {
50
+ type: BooleanConstructor;
51
+ default: undefined;
52
+ };
53
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
54
+ [key: string]: any;
55
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
56
+ click: () => boolean;
57
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
58
+ padding: {
59
+ default: string;
60
+ type: import("vue").PropType<import("@getcortexlabs/mavis-core").Spacing>;
61
+ };
62
+ radius: {
63
+ default: string;
64
+ type: import("vue").PropType<import("@getcortexlabs/mavis-core").Radius | number>;
65
+ };
66
+ gap: {
67
+ type: import("vue").PropType<import("@getcortexlabs/mavis-core").Spacing>;
68
+ default: undefined;
69
+ };
70
+ interactive: BooleanConstructor;
71
+ disabled: BooleanConstructor;
72
+ paddingX: {
73
+ type: import("vue").PropType<import("@getcortexlabs/mavis-core").Spacing>;
74
+ default: undefined;
75
+ };
76
+ paddingY: {
77
+ type: import("vue").PropType<import("@getcortexlabs/mavis-core").Spacing>;
78
+ default: undefined;
79
+ };
80
+ width: {
81
+ type: import("vue").PropType<import("@getcortexlabs/mavis-core").Dimension>;
82
+ default: undefined;
83
+ };
84
+ height: {
85
+ type: import("vue").PropType<import("@getcortexlabs/mavis-core").Dimension>;
86
+ default: undefined;
87
+ };
88
+ backgroundColor: StringConstructor;
89
+ grow: {
90
+ type: NumberConstructor;
91
+ default: number;
92
+ };
93
+ shrink: {
94
+ type: NumberConstructor;
95
+ default: undefined;
96
+ };
97
+ id: {
98
+ type: StringConstructor;
99
+ default: undefined;
100
+ };
101
+ accessibilityLabel: {
102
+ type: StringConstructor;
103
+ default: undefined;
104
+ };
105
+ accessibilityHidden: {
106
+ type: BooleanConstructor;
107
+ default: undefined;
108
+ };
109
+ }>> & Readonly<{
110
+ onClick?: (() => any) | undefined;
111
+ }>, {
112
+ padding: import("@getcortexlabs/mavis-core").Spacing;
113
+ paddingX: import("@getcortexlabs/mavis-core").Spacing;
114
+ paddingY: import("@getcortexlabs/mavis-core").Spacing;
115
+ radius: number | import("@getcortexlabs/mavis-core").Radius;
116
+ width: import("@getcortexlabs/mavis-core").Dimension;
117
+ height: import("@getcortexlabs/mavis-core").Dimension;
118
+ grow: number;
119
+ shrink: number;
120
+ id: string;
121
+ accessibilityLabel: string;
122
+ accessibilityHidden: boolean;
123
+ gap: import("@getcortexlabs/mavis-core").Spacing;
124
+ interactive: boolean;
125
+ disabled: boolean;
126
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
127
+ //# sourceMappingURL=MCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MCard.d.ts","sourceRoot":"","sources":["../../src/components/MCard.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4EAmDhB,CAAA"}
@@ -0,0 +1,51 @@
1
+ import { defineComponent, h, mergeProps } from 'vue';
2
+ import { cardProps, useMavisTheme, actionEmits } from '@getcortexlabs/mavis-core/vue';
3
+ import { MColumn } from './layout.js';
4
+ export const MCard = defineComponent({
5
+ name: 'MCard',
6
+ inheritAttrs: false,
7
+ props: cardProps,
8
+ emits: actionEmits,
9
+ setup(props, { attrs, slots, emit }) {
10
+ const { theme } = useMavisTheme();
11
+ const activate = () => {
12
+ if (props.interactive && !props.disabled)
13
+ emit('click');
14
+ };
15
+ return () => {
16
+ const { interactive, disabled, ...layout } = props;
17
+ return h(MColumn, mergeProps(layout, {
18
+ class: { 'm-card-interactive': interactive },
19
+ style: {
20
+ backgroundColor: props.backgroundColor ?? theme.value.colors.surface,
21
+ border: `1px solid ${theme.value.colors.border}`,
22
+ opacity: interactive && disabled ? 0.45 : 1,
23
+ '--m-press-scale': theme.value.motion.pressScale,
24
+ '--m-focus': theme.value.colors.primary,
25
+ },
26
+ }, attrs, interactive
27
+ ? {
28
+ role: 'button',
29
+ tabindex: disabled ? -1 : 0,
30
+ 'aria-disabled': disabled || undefined,
31
+ onClick: activate,
32
+ onKeydown: (event) => {
33
+ if (event.target !== event.currentTarget)
34
+ return;
35
+ if (event.key === 'Enter' || event.key === ' ')
36
+ event.preventDefault();
37
+ if (event.key === 'Enter' && !event.repeat)
38
+ activate();
39
+ },
40
+ onKeyup: (event) => {
41
+ if (event.target === event.currentTarget && event.key === ' ') {
42
+ event.preventDefault();
43
+ activate();
44
+ }
45
+ },
46
+ }
47
+ : {}), slots);
48
+ };
49
+ },
50
+ });
51
+ //# sourceMappingURL=MCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MCard.js","sourceRoot":"","sources":["../../src/components/MCard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,CAAC,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE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AAC,CAAC,CAAC,CAAC,CAAC;oBAC3B,eAAe,EAAE,QAAQ,IAAI,SAAS;oBACtC,OAAO,EAAE,QAAQ;oBACjB,SAAS,EAAE,CAAC,KAAoB,EAAE,EAAE;wBAClC,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,aAAa;4BAAE,OAAM;wBAChD,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,IAAI,KAAK,CAAC,GAAG,KAAK,GAAG;4BAAE,KAAK,CAAC,cAAc,EAAE,CAAA;wBACtE,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM;4BAAE,QAAQ,EAAE,CAAA;oBACxD,CAAC;oBACD,OAAO,EAAE,CAAC,KAAoB,EAAE,EAAE;wBAChC,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,aAAa,IAAI,KAAK,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;4BAC9D,KAAK,CAAC,cAAc,EAAE,CAAA;4BACtB,QAAQ,EAAE,CAAA;wBACZ,CAAC;oBACH,CAAC;iBACF;gBACH,CAAC,CAAC,EAAE,CACP,EACD,KAAK,CACN,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA"}
@@ -0,0 +1,175 @@
1
+ export declare const MInput: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ width: {
3
+ type: import("vue").PropType<import("@getcortexlabs/mavis-core").Dimension>;
4
+ default: undefined;
5
+ };
6
+ modelValue: {
7
+ type: StringConstructor;
8
+ default: string;
9
+ };
10
+ label: {
11
+ type: StringConstructor;
12
+ required: true;
13
+ };
14
+ placeholder: {
15
+ type: StringConstructor;
16
+ default: string;
17
+ };
18
+ helperText: {
19
+ type: StringConstructor;
20
+ default: string;
21
+ };
22
+ error: {
23
+ type: StringConstructor;
24
+ default: string;
25
+ };
26
+ type: {
27
+ type: import("vue").PropType<"text" | "email" | "password" | "tel" | "url" | "search">;
28
+ default: "text" | "email" | "password" | "tel" | "url" | "search";
29
+ validator: (value: "text" | "email" | "password" | "tel" | "url" | "search") => boolean;
30
+ };
31
+ disabled: BooleanConstructor;
32
+ readonly: BooleanConstructor;
33
+ multiline: BooleanConstructor;
34
+ rows: {
35
+ type: NumberConstructor;
36
+ default: number;
37
+ };
38
+ maxLength: {
39
+ type: NumberConstructor;
40
+ default: undefined;
41
+ };
42
+ autocapitalize: {
43
+ type: import("vue").PropType<"none" | "sentences" | "words" | "characters">;
44
+ default: undefined;
45
+ validator: (value: string) => boolean;
46
+ };
47
+ autocorrect: {
48
+ type: BooleanConstructor;
49
+ default: undefined;
50
+ };
51
+ returnKey: {
52
+ type: import("vue").PropType<"search" | "done" | "next" | "go" | "send">;
53
+ default: "search" | "done" | "next" | "go" | "send";
54
+ validator: (value: "search" | "done" | "next" | "go" | "send") => boolean;
55
+ };
56
+ grow: {
57
+ type: NumberConstructor;
58
+ default: number;
59
+ };
60
+ shrink: {
61
+ type: NumberConstructor;
62
+ default: undefined;
63
+ };
64
+ id: {
65
+ type: StringConstructor;
66
+ default: undefined;
67
+ };
68
+ accessibilityHidden: {
69
+ type: BooleanConstructor;
70
+ default: undefined;
71
+ };
72
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
73
+ [key: string]: any;
74
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
75
+ 'update:modelValue': (value: string) => boolean;
76
+ focus: () => boolean;
77
+ blur: () => boolean;
78
+ submit: (value: string) => boolean;
79
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
80
+ width: {
81
+ type: import("vue").PropType<import("@getcortexlabs/mavis-core").Dimension>;
82
+ default: undefined;
83
+ };
84
+ modelValue: {
85
+ type: StringConstructor;
86
+ default: string;
87
+ };
88
+ label: {
89
+ type: StringConstructor;
90
+ required: true;
91
+ };
92
+ placeholder: {
93
+ type: StringConstructor;
94
+ default: string;
95
+ };
96
+ helperText: {
97
+ type: StringConstructor;
98
+ default: string;
99
+ };
100
+ error: {
101
+ type: StringConstructor;
102
+ default: string;
103
+ };
104
+ type: {
105
+ type: import("vue").PropType<"text" | "email" | "password" | "tel" | "url" | "search">;
106
+ default: "text" | "email" | "password" | "tel" | "url" | "search";
107
+ validator: (value: "text" | "email" | "password" | "tel" | "url" | "search") => boolean;
108
+ };
109
+ disabled: BooleanConstructor;
110
+ readonly: BooleanConstructor;
111
+ multiline: BooleanConstructor;
112
+ rows: {
113
+ type: NumberConstructor;
114
+ default: number;
115
+ };
116
+ maxLength: {
117
+ type: NumberConstructor;
118
+ default: undefined;
119
+ };
120
+ autocapitalize: {
121
+ type: import("vue").PropType<"none" | "sentences" | "words" | "characters">;
122
+ default: undefined;
123
+ validator: (value: string) => boolean;
124
+ };
125
+ autocorrect: {
126
+ type: BooleanConstructor;
127
+ default: undefined;
128
+ };
129
+ returnKey: {
130
+ type: import("vue").PropType<"search" | "done" | "next" | "go" | "send">;
131
+ default: "search" | "done" | "next" | "go" | "send";
132
+ validator: (value: "search" | "done" | "next" | "go" | "send") => boolean;
133
+ };
134
+ grow: {
135
+ type: NumberConstructor;
136
+ default: number;
137
+ };
138
+ shrink: {
139
+ type: NumberConstructor;
140
+ default: undefined;
141
+ };
142
+ id: {
143
+ type: StringConstructor;
144
+ default: undefined;
145
+ };
146
+ accessibilityHidden: {
147
+ type: BooleanConstructor;
148
+ default: undefined;
149
+ };
150
+ }>> & Readonly<{
151
+ onBlur?: (() => any) | undefined;
152
+ onFocus?: (() => any) | undefined;
153
+ onSubmit?: ((value: string) => any) | undefined;
154
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
155
+ }>, {
156
+ width: import("@getcortexlabs/mavis-core").Dimension;
157
+ grow: number;
158
+ shrink: number;
159
+ id: string;
160
+ accessibilityHidden: boolean;
161
+ type: "search" | "text" | "email" | "password" | "tel" | "url";
162
+ error: string;
163
+ disabled: boolean;
164
+ modelValue: string;
165
+ placeholder: string;
166
+ helperText: string;
167
+ readonly: boolean;
168
+ multiline: boolean;
169
+ rows: number;
170
+ maxLength: number;
171
+ autocapitalize: "none" | "sentences" | "words" | "characters";
172
+ autocorrect: boolean;
173
+ returnKey: "done" | "search" | "next" | "go" | "send";
174
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
175
+ //# sourceMappingURL=MInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MInput.d.ts","sourceRoot":"","sources":["../../src/components/MInput.ts"],"names":[],"mappings":"AAyBA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4EA+LjB,CAAA"}