@getcortexlabs/mavis-web 0.1.0-alpha.2 → 0.1.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/components/MAccordion.d.ts +109 -0
- package/dist/components/MAccordion.d.ts.map +1 -0
- package/dist/components/MAccordion.js +180 -0
- package/dist/components/MAccordion.js.map +1 -0
- package/dist/components/MAlert.d.ts +99 -0
- package/dist/components/MAlert.d.ts.map +1 -0
- package/dist/components/MAlert.js +88 -0
- package/dist/components/MAlert.js.map +1 -0
- package/dist/components/MAvatar.d.ts +74 -0
- package/dist/components/MAvatar.d.ts.map +1 -0
- package/dist/components/MAvatar.js +88 -0
- package/dist/components/MAvatar.js.map +1 -0
- package/dist/components/MBadge.d.ts +64 -0
- package/dist/components/MBadge.d.ts.map +1 -0
- package/dist/components/MBadge.js +35 -0
- package/dist/components/MBadge.js.map +1 -0
- package/dist/components/MButton.d.ts +59 -7
- package/dist/components/MButton.d.ts.map +1 -1
- package/dist/components/MButton.js +51 -18
- package/dist/components/MButton.js.map +1 -1
- package/dist/components/MCard.d.ts +23 -5
- package/dist/components/MCard.d.ts.map +1 -1
- package/dist/components/MCard.js +28 -6
- package/dist/components/MCard.js.map +1 -1
- package/dist/components/MCheckbox.d.ts +93 -0
- package/dist/components/MCheckbox.d.ts.map +1 -0
- package/dist/components/MCheckbox.js +108 -0
- package/dist/components/MCheckbox.js.map +1 -0
- package/dist/components/MChip.d.ts +107 -0
- package/dist/components/MChip.d.ts.map +1 -0
- package/dist/components/MChip.js +103 -0
- package/dist/components/MChip.js.map +1 -0
- package/dist/components/MDialog.d.ts +94 -0
- package/dist/components/MDialog.d.ts.map +1 -0
- package/dist/components/MDialog.js +214 -0
- package/dist/components/MDialog.js.map +1 -0
- package/dist/components/MEmptyState.d.ts +107 -0
- package/dist/components/MEmptyState.d.ts.map +1 -0
- package/dist/components/MEmptyState.js +79 -0
- package/dist/components/MEmptyState.js.map +1 -0
- package/dist/components/MIcon.d.ts +1 -1
- package/dist/components/MInput.d.ts +66 -8
- package/dist/components/MInput.d.ts.map +1 -1
- package/dist/components/MInput.js +96 -20
- package/dist/components/MInput.js.map +1 -1
- package/dist/components/MListItem.d.ts +92 -0
- package/dist/components/MListItem.d.ts.map +1 -0
- package/dist/components/MListItem.js +53 -0
- package/dist/components/MListItem.js.map +1 -0
- package/dist/components/MProgress.d.ts +112 -0
- package/dist/components/MProgress.d.ts.map +1 -0
- package/dist/components/MProgress.js +69 -0
- package/dist/components/MProgress.js.map +1 -0
- package/dist/components/MRadioGroup.d.ts +94 -0
- package/dist/components/MRadioGroup.d.ts.map +1 -0
- package/dist/components/MRadioGroup.js +167 -0
- package/dist/components/MRadioGroup.js.map +1 -0
- package/dist/components/MReveal.d.ts.map +1 -1
- package/dist/components/MReveal.js +28 -3
- package/dist/components/MReveal.js.map +1 -1
- package/dist/components/MScreen.d.ts +19 -1
- package/dist/components/MScreen.d.ts.map +1 -1
- package/dist/components/MScreen.js +30 -1
- package/dist/components/MScreen.js.map +1 -1
- package/dist/components/MSegmentedControl.d.ts +85 -0
- package/dist/components/MSegmentedControl.d.ts.map +1 -0
- package/dist/components/MSegmentedControl.js +128 -0
- package/dist/components/MSegmentedControl.js.map +1 -0
- package/dist/components/MSelect.d.ts +130 -0
- package/dist/components/MSelect.d.ts.map +1 -0
- package/dist/components/MSelect.js +308 -0
- package/dist/components/MSelect.js.map +1 -0
- package/dist/components/MSeparator.d.ts +54 -0
- package/dist/components/MSeparator.d.ts.map +1 -0
- package/dist/components/MSeparator.js +36 -0
- package/dist/components/MSeparator.js.map +1 -0
- package/dist/components/MSheet.d.ts +102 -0
- package/dist/components/MSheet.d.ts.map +1 -0
- package/dist/components/MSheet.js +265 -0
- package/dist/components/MSheet.js.map +1 -0
- package/dist/components/MSkeleton.d.ts +70 -0
- package/dist/components/MSkeleton.d.ts.map +1 -0
- package/dist/components/MSkeleton.js +43 -0
- package/dist/components/MSkeleton.js.map +1 -0
- package/dist/components/MSlider.d.ts +1 -1
- package/dist/components/MSlider.d.ts.map +1 -1
- package/dist/components/MSlider.js +2 -1
- package/dist/components/MSlider.js.map +1 -1
- package/dist/components/MSwitch.d.ts +79 -0
- package/dist/components/MSwitch.d.ts.map +1 -0
- package/dist/components/MSwitch.js +87 -0
- package/dist/components/MSwitch.js.map +1 -0
- package/dist/components/MTabs.d.ts +91 -0
- package/dist/components/MTabs.d.ts.map +1 -0
- package/dist/components/MTabs.js +228 -0
- package/dist/components/MTabs.js.map +1 -0
- package/dist/components/MText.d.ts +18 -9
- package/dist/components/MText.d.ts.map +1 -1
- package/dist/components/MText.js +26 -7
- package/dist/components/MText.js.map +1 -1
- package/dist/components/MToast.d.ts +24 -0
- package/dist/components/MToast.d.ts.map +1 -0
- package/dist/components/MToast.js +196 -0
- package/dist/components/MToast.js.map +1 -0
- package/dist/index.d.ts +27 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +46 -4
- package/dist/index.js.map +1 -1
- package/dist/input-attrs.d.ts +15 -0
- package/dist/input-attrs.d.ts.map +1 -0
- package/dist/input-attrs.js +18 -0
- package/dist/input-attrs.js.map +1 -0
- package/dist/motion-surface.d.ts +8 -0
- package/dist/motion-surface.d.ts.map +1 -0
- package/dist/motion-surface.js +79 -0
- package/dist/motion-surface.js.map +1 -0
- package/dist/motion.d.ts +20 -0
- package/dist/motion.d.ts.map +1 -0
- package/dist/motion.js +227 -0
- package/dist/motion.js.map +1 -0
- package/dist/screen-viewport.d.ts.map +1 -1
- package/dist/screen-viewport.js +3 -0
- package/dist/screen-viewport.js.map +1 -1
- package/dist/scroll-motion.d.ts +5 -0
- package/dist/scroll-motion.d.ts.map +1 -0
- package/dist/scroll-motion.js +69 -0
- package/dist/scroll-motion.js.map +1 -0
- package/dist/sheet-motion.d.ts +8 -0
- package/dist/sheet-motion.d.ts.map +1 -0
- package/dist/sheet-motion.js +148 -0
- package/dist/sheet-motion.js.map +1 -0
- package/dist/style.d.ts.map +1 -1
- package/dist/style.js +24 -9
- package/dist/style.js.map +1 -1
- package/package.json +4 -3
- package/src/components/MAccordion.ts +231 -0
- package/src/components/MAlert.ts +109 -0
- package/src/components/MAvatar.ts +97 -0
- package/src/components/MBadge.ts +40 -0
- package/src/components/MButton.ts +68 -15
- package/src/components/MCard.ts +43 -5
- package/src/components/MCheckbox.ts +127 -0
- package/src/components/MChip.ts +109 -0
- package/src/components/MDialog.ts +245 -0
- package/src/components/MEmptyState.ts +96 -0
- package/src/components/MInput.ts +166 -71
- package/src/components/MListItem.ts +66 -0
- package/src/components/MProgress.ts +82 -0
- package/src/components/MRadioGroup.ts +184 -0
- package/src/components/MReveal.ts +40 -3
- package/src/components/MScreen.ts +31 -1
- package/src/components/MSegmentedControl.ts +151 -0
- package/src/components/MSelect.ts +362 -0
- package/src/components/MSeparator.ts +40 -0
- package/src/components/MSheet.ts +317 -0
- package/src/components/MSkeleton.ts +52 -0
- package/src/components/MSlider.ts +7 -1
- package/src/components/MSwitch.ts +108 -0
- package/src/components/MTabs.ts +275 -0
- package/src/components/MText.ts +30 -7
- package/src/components/MToast.ts +241 -0
- package/src/index.ts +82 -4
- package/src/input-attrs.ts +41 -0
- package/src/motion-surface.ts +86 -0
- package/src/motion.ts +275 -0
- package/src/screen-viewport.ts +2 -0
- package/src/scroll-motion.ts +75 -0
- package/src/sheet-motion.ts +152 -0
- package/src/style.css +861 -39
- package/src/style.ts +20 -9
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Mavis for Vue Web
|
|
2
2
|
|
|
3
|
-
Vue Web
|
|
3
|
+
Vue Web components and themes for Mavis UI, version `0.1.0-alpha.4`. Experimental prerelease for testing in real apps; the API can change between alpha versions. Licensed under MIT.
|
|
4
4
|
|
|
5
5
|
In an existing Vue application:
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
|
-
npm install @getcortexlabs/mavis-web@0.1.0-alpha.
|
|
8
|
+
npm install @getcortexlabs/mavis-web@0.1.0-alpha.4 @rafaelaugusto/jolt@0.1.0-rc.6
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
```ts
|
|
@@ -17,9 +17,9 @@ import App from './App.vue'
|
|
|
17
17
|
createApp(App).use(createMavis()).mount('#app')
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
The stylesheet supplies focus indicators, box overlays, and motion. The plugin registers
|
|
20
|
+
The stylesheet supplies focus indicators, box overlays, and motion. The plugin registers the layout, typography, form, selection, feedback and overlay components, including scoped themes and inline text. Vue also accepts their `m-*` spellings. See the [component reference](https://mavis-ui.getcortexlabs.com/components/) for the full catalog.
|
|
21
21
|
|
|
22
|
-
Themes and Vue context come from `@getcortexlabs/mavis-core`.
|
|
22
|
+
Themes and Vue context come from `@getcortexlabs/mavis-core`. Alpha.4 requires Jolt 0.1.0-rc.6 as a peer for Button/Card/Reveal. Browser consumers do not install NativeScript; Mavis uses only Jolt /web and /web/vue. See the [motion guide](https://mavis-ui.getcortexlabs.com/guide/motion).
|
|
23
23
|
|
|
24
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
25
|
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { type SlotsType } from 'vue';
|
|
2
|
+
import { type AccordionItem, type AccordionPanelProps } from '@getcortexlabs/mavis-core';
|
|
3
|
+
export declare const MAccordion: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
width: {
|
|
5
|
+
type: import("vue").PropType<import("@getcortexlabs/mavis-core").Dimension>;
|
|
6
|
+
default: undefined;
|
|
7
|
+
};
|
|
8
|
+
items: {
|
|
9
|
+
type: import("vue").PropType<readonly AccordionItem[]>;
|
|
10
|
+
required: true;
|
|
11
|
+
};
|
|
12
|
+
modelValue: {
|
|
13
|
+
type: import("vue").PropType<readonly import("@getcortexlabs/mavis-core").ChoiceValue[]>;
|
|
14
|
+
default: () => never[];
|
|
15
|
+
};
|
|
16
|
+
multiple: BooleanConstructor;
|
|
17
|
+
disabled: BooleanConstructor;
|
|
18
|
+
label: {
|
|
19
|
+
type: StringConstructor;
|
|
20
|
+
required: true;
|
|
21
|
+
};
|
|
22
|
+
expandedLabel: {
|
|
23
|
+
type: StringConstructor;
|
|
24
|
+
default: string;
|
|
25
|
+
};
|
|
26
|
+
collapsedLabel: {
|
|
27
|
+
type: StringConstructor;
|
|
28
|
+
default: string;
|
|
29
|
+
};
|
|
30
|
+
grow: {
|
|
31
|
+
type: NumberConstructor;
|
|
32
|
+
default: number;
|
|
33
|
+
};
|
|
34
|
+
shrink: {
|
|
35
|
+
type: NumberConstructor;
|
|
36
|
+
default: undefined;
|
|
37
|
+
};
|
|
38
|
+
id: {
|
|
39
|
+
type: StringConstructor;
|
|
40
|
+
default: undefined;
|
|
41
|
+
};
|
|
42
|
+
accessibilityHidden: {
|
|
43
|
+
type: BooleanConstructor;
|
|
44
|
+
default: undefined;
|
|
45
|
+
};
|
|
46
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
47
|
+
[key: string]: any;
|
|
48
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
49
|
+
'update:modelValue': (value: import("@getcortexlabs/mavis-core").ChoiceValue[]) => boolean;
|
|
50
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
51
|
+
width: {
|
|
52
|
+
type: import("vue").PropType<import("@getcortexlabs/mavis-core").Dimension>;
|
|
53
|
+
default: undefined;
|
|
54
|
+
};
|
|
55
|
+
items: {
|
|
56
|
+
type: import("vue").PropType<readonly AccordionItem[]>;
|
|
57
|
+
required: true;
|
|
58
|
+
};
|
|
59
|
+
modelValue: {
|
|
60
|
+
type: import("vue").PropType<readonly import("@getcortexlabs/mavis-core").ChoiceValue[]>;
|
|
61
|
+
default: () => never[];
|
|
62
|
+
};
|
|
63
|
+
multiple: BooleanConstructor;
|
|
64
|
+
disabled: BooleanConstructor;
|
|
65
|
+
label: {
|
|
66
|
+
type: StringConstructor;
|
|
67
|
+
required: true;
|
|
68
|
+
};
|
|
69
|
+
expandedLabel: {
|
|
70
|
+
type: StringConstructor;
|
|
71
|
+
default: string;
|
|
72
|
+
};
|
|
73
|
+
collapsedLabel: {
|
|
74
|
+
type: StringConstructor;
|
|
75
|
+
default: string;
|
|
76
|
+
};
|
|
77
|
+
grow: {
|
|
78
|
+
type: NumberConstructor;
|
|
79
|
+
default: number;
|
|
80
|
+
};
|
|
81
|
+
shrink: {
|
|
82
|
+
type: NumberConstructor;
|
|
83
|
+
default: undefined;
|
|
84
|
+
};
|
|
85
|
+
id: {
|
|
86
|
+
type: StringConstructor;
|
|
87
|
+
default: undefined;
|
|
88
|
+
};
|
|
89
|
+
accessibilityHidden: {
|
|
90
|
+
type: BooleanConstructor;
|
|
91
|
+
default: undefined;
|
|
92
|
+
};
|
|
93
|
+
}>> & Readonly<{
|
|
94
|
+
"onUpdate:modelValue"?: ((value: import("@getcortexlabs/mavis-core").ChoiceValue[]) => any) | undefined;
|
|
95
|
+
}>, {
|
|
96
|
+
width: import("@getcortexlabs/mavis-core").Dimension;
|
|
97
|
+
grow: number;
|
|
98
|
+
shrink: number;
|
|
99
|
+
id: string;
|
|
100
|
+
accessibilityHidden: boolean;
|
|
101
|
+
disabled: boolean;
|
|
102
|
+
modelValue: readonly import("@getcortexlabs/mavis-core").ChoiceValue[];
|
|
103
|
+
multiple: boolean;
|
|
104
|
+
expandedLabel: string;
|
|
105
|
+
collapsedLabel: string;
|
|
106
|
+
}, SlotsType<{
|
|
107
|
+
default: AccordionPanelProps;
|
|
108
|
+
}>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
109
|
+
//# sourceMappingURL=MAccordion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MAccordion.d.ts","sourceRoot":"","sources":["../../src/components/MAccordion.ts"],"names":[],"mappings":"AACA,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,KAAK,CAAA;AAOZ,OAAO,EAKL,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACzB,MAAM,2BAA2B,CAAA;AAMlC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAKiB,mBAAmB;yEAmMzD,CAAA"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { fontFamily } from '@getcortexlabs/mavis-core';
|
|
2
|
+
import { defineComponent, h, mergeProps, nextTick, onBeforeUnmount, useId, watch, } from 'vue';
|
|
3
|
+
import { useButtonAction, accordionProps, accordionEmits, useMavisTheme, } from '@getcortexlabs/mavis-core/vue';
|
|
4
|
+
import { choiceKey, validateAccordion, toggleAccordion, accordionFocusTarget, } from '@getcortexlabs/mavis-core';
|
|
5
|
+
import { MColumn } from './layout.js';
|
|
6
|
+
import { MIcon } from './MIcon.js';
|
|
7
|
+
import { MReveal } from './MReveal.js';
|
|
8
|
+
import { MSeparator } from './MSeparator.js';
|
|
9
|
+
export const MAccordion = defineComponent({
|
|
10
|
+
name: 'MAccordion',
|
|
11
|
+
inheritAttrs: false,
|
|
12
|
+
props: accordionProps,
|
|
13
|
+
emits: accordionEmits,
|
|
14
|
+
slots: Object,
|
|
15
|
+
setup(props, { attrs, emit, slots }) {
|
|
16
|
+
useButtonAction();
|
|
17
|
+
const { theme } = useMavisTheme();
|
|
18
|
+
const generated = `m-accordion-${useId()}`;
|
|
19
|
+
const headers = new Map();
|
|
20
|
+
const panels = new Map();
|
|
21
|
+
let alive = true;
|
|
22
|
+
onBeforeUnmount(() => {
|
|
23
|
+
alive = false;
|
|
24
|
+
headers.clear();
|
|
25
|
+
panels.clear();
|
|
26
|
+
});
|
|
27
|
+
watch(() => [props.items, props.modelValue, props.disabled], () => {
|
|
28
|
+
if (typeof document === 'undefined')
|
|
29
|
+
return;
|
|
30
|
+
const focused = document.activeElement;
|
|
31
|
+
if (!focused)
|
|
32
|
+
return;
|
|
33
|
+
const panel = [...panels].find(([, element]) => element.contains(focused));
|
|
34
|
+
const header = [...headers].find(([, element]) => element === focused);
|
|
35
|
+
const key = panel?.[0] ?? header?.[0];
|
|
36
|
+
if (!key)
|
|
37
|
+
return;
|
|
38
|
+
const item = props.items.find((item) => choiceKey(item.value) === key);
|
|
39
|
+
if (panel && item && props.modelValue.includes(item.value))
|
|
40
|
+
return;
|
|
41
|
+
if (header && item && !item.disabled && !props.disabled)
|
|
42
|
+
return;
|
|
43
|
+
void nextTick(() => {
|
|
44
|
+
if (!alive || props.disabled)
|
|
45
|
+
return;
|
|
46
|
+
const target = (item && !item.disabled ? item : undefined) ??
|
|
47
|
+
props.items.find((item) => !item.disabled);
|
|
48
|
+
if (target)
|
|
49
|
+
headers.get(choiceKey(target.value))?.focus({ preventScroll: true });
|
|
50
|
+
});
|
|
51
|
+
}, { deep: true, flush: 'pre' });
|
|
52
|
+
function keydown(event, item) {
|
|
53
|
+
if (props.disabled || item.disabled || event.altKey || event.ctrlKey || event.metaKey)
|
|
54
|
+
return;
|
|
55
|
+
const next = accordionFocusTarget(props.items, item.value, event.key);
|
|
56
|
+
if (!next)
|
|
57
|
+
return;
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
headers.get(choiceKey(next.value))?.focus({ preventScroll: true });
|
|
60
|
+
}
|
|
61
|
+
return () => {
|
|
62
|
+
validateAccordion(props.items, props.modelValue, props.multiple, props.label, props.expandedLabel, props.collapsedLabel);
|
|
63
|
+
const { colors, typography, space, radius } = theme.value;
|
|
64
|
+
const id = props.id ?? generated;
|
|
65
|
+
return h(MColumn, mergeProps(attrs, {
|
|
66
|
+
id,
|
|
67
|
+
width: props.width,
|
|
68
|
+
grow: props.grow,
|
|
69
|
+
shrink: props.shrink,
|
|
70
|
+
gap: 'sm',
|
|
71
|
+
accessibilityHidden: props.accessibilityHidden,
|
|
72
|
+
class: 'm-accordion',
|
|
73
|
+
role: 'group',
|
|
74
|
+
'aria-label': props.label,
|
|
75
|
+
style: { '--m-focus': colors.primary },
|
|
76
|
+
}), {
|
|
77
|
+
default: () => props.items.map((item) => {
|
|
78
|
+
const key = choiceKey(item.value), expanded = props.modelValue.includes(item.value);
|
|
79
|
+
const headerId = `${id}-${encodeURIComponent(key)}`, panelId = `${headerId}-panel`;
|
|
80
|
+
return h(MColumn, {
|
|
81
|
+
key,
|
|
82
|
+
radius: 'md',
|
|
83
|
+
backgroundColor: colors.surface,
|
|
84
|
+
class: 'm-accordion-item',
|
|
85
|
+
'data-expanded': expanded,
|
|
86
|
+
style: { border: `1px solid ${expanded ? colors.primarySoft : colors.border}` },
|
|
87
|
+
}, {
|
|
88
|
+
default: () => [
|
|
89
|
+
h('h3', { class: 'm-accordion-heading' }, [
|
|
90
|
+
h('button', {
|
|
91
|
+
id: headerId,
|
|
92
|
+
type: 'button',
|
|
93
|
+
class: 'm-accordion-trigger',
|
|
94
|
+
ref: (element) => {
|
|
95
|
+
if (element)
|
|
96
|
+
headers.set(key, element);
|
|
97
|
+
else
|
|
98
|
+
headers.delete(key);
|
|
99
|
+
},
|
|
100
|
+
disabled: props.disabled || item.disabled,
|
|
101
|
+
'aria-label': item.title,
|
|
102
|
+
'aria-describedby': item.description
|
|
103
|
+
? `${headerId}-description`
|
|
104
|
+
: undefined,
|
|
105
|
+
'aria-expanded': expanded,
|
|
106
|
+
'aria-controls': expanded ? panelId : undefined,
|
|
107
|
+
style: {
|
|
108
|
+
padding: `${space.md}px`,
|
|
109
|
+
gap: `${space.md}px`,
|
|
110
|
+
borderRadius: `${radius.md}px`,
|
|
111
|
+
color: colors.text,
|
|
112
|
+
fontFamily: fontFamily(theme.value.typography.body.fontFamily, 'web'),
|
|
113
|
+
fontSize: `${typography.body.fontSize}px`,
|
|
114
|
+
},
|
|
115
|
+
onClick() {
|
|
116
|
+
const next = toggleAccordion(item, props.modelValue, props.multiple, props.disabled);
|
|
117
|
+
if (next)
|
|
118
|
+
emit('update:modelValue', next);
|
|
119
|
+
},
|
|
120
|
+
onKeydown: (event) => keydown(event, item),
|
|
121
|
+
}, [
|
|
122
|
+
item.icon
|
|
123
|
+
? h(MIcon, {
|
|
124
|
+
name: item.icon,
|
|
125
|
+
tone: expanded ? 'primary' : 'muted',
|
|
126
|
+
style: { flexShrink: 0 },
|
|
127
|
+
})
|
|
128
|
+
: null,
|
|
129
|
+
h('span', { class: 'm-accordion-copy' }, [
|
|
130
|
+
h('span', { style: { display: 'block', fontWeight: 600 } }, item.title),
|
|
131
|
+
item.description
|
|
132
|
+
? h('span', {
|
|
133
|
+
id: `${headerId}-description`,
|
|
134
|
+
style: {
|
|
135
|
+
display: 'block',
|
|
136
|
+
color: colors.muted,
|
|
137
|
+
marginTop: `${space.xs}px`,
|
|
138
|
+
fontSize: `${typography.caption.fontSize}px`,
|
|
139
|
+
},
|
|
140
|
+
}, item.description)
|
|
141
|
+
: null,
|
|
142
|
+
]),
|
|
143
|
+
h(MIcon, {
|
|
144
|
+
name: expanded ? 'chevron-up' : 'chevron-down',
|
|
145
|
+
size: 'sm',
|
|
146
|
+
tone: expanded ? 'primary' : 'muted',
|
|
147
|
+
style: { flexShrink: 0 },
|
|
148
|
+
}),
|
|
149
|
+
]),
|
|
150
|
+
]),
|
|
151
|
+
h(MReveal, {
|
|
152
|
+
show: expanded,
|
|
153
|
+
padding: 'md',
|
|
154
|
+
gap: 'md',
|
|
155
|
+
style: { paddingTop: 0 },
|
|
156
|
+
accessibilityHidden: props.accessibilityHidden,
|
|
157
|
+
}, {
|
|
158
|
+
default: () => [
|
|
159
|
+
h(MSeparator),
|
|
160
|
+
h('div', {
|
|
161
|
+
id: panelId,
|
|
162
|
+
role: 'region',
|
|
163
|
+
'aria-labelledby': headerId,
|
|
164
|
+
ref: (element) => {
|
|
165
|
+
if (element)
|
|
166
|
+
panels.set(key, element);
|
|
167
|
+
else
|
|
168
|
+
panels.delete(key);
|
|
169
|
+
},
|
|
170
|
+
}, slots.default?.({ item })),
|
|
171
|
+
],
|
|
172
|
+
}),
|
|
173
|
+
],
|
|
174
|
+
});
|
|
175
|
+
}),
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
//# sourceMappingURL=MAccordion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MAccordion.js","sourceRoot":"","sources":["../../src/components/MAccordion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,EACL,eAAe,EACf,CAAC,EACD,UAAU,EACV,QAAQ,EACR,eAAe,EACf,KAAK,EACL,KAAK,GAEN,MAAM,KAAK,CAAA;AACZ,OAAO,EACL,eAAe,EACf,cAAc,EACd,cAAc,EACd,aAAa,GACd,MAAM,+BAA+B,CAAA;AACtC,OAAO,EACL,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,oBAAoB,GAGrB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAC;IACxC,IAAI,EAAE,YAAY;IAClB,YAAY,EAAE,KAAK;IACnB,KAAK,EAAE,cAAc;IACrB,KAAK,EAAE,cAAc;IACrB,KAAK,EAAE,MAAqD;IAC5D,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE;QACjC,eAAe,EAAE,CAAA;QACjB,MAAM,EAAE,KAAK,EAAE,GAAG,aAAa,EAAE,CAAA;QACjC,MAAM,SAAS,G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ACD,IAAI,CAAC,WAAW,CACjB;4CACH,CAAC,CAAC,IAAI;qCACT,CAAC;oCACF,CAAC,CAAC,KAAK,EAAE;wCACP,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,cAAc;wCAC9C,IAAI,EAAE,IAAI;wCACV,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO;wCACpC,KAAK,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE;qCACzB,CAAC;iCACH,CACF;6BACF,CAAC;4BACF,CAAC,CACC,OAAO,EACP;gCACE,IAAI,EAAE,QAAQ;gCACd,OAAO,EAAE,IAAI;gCACb,GAAG,EAAE,IAAI;gCACT,KAAK,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE;gCACxB,mBAAmB,EAAE,KAAK,CAAC,mBAAmB;6BAC/C,EACD;gCACE,OAAO,EAAE,GAAG,EAAE,CAAC;oCACb,CAAC,CAAC,UAAU,CAAC;oCACb,CAAC,CACC,KAAK,EACL;wCACE,EAAE,EAAE,OAAO;wCACX,IAAI,EAAE,QAAQ;wCACd,iBAAiB,EAAE,QAAQ;wCAC3B,GAAG,EAAE,CAAC,OAAgB,EAAE,EAAE;4CACxB,IAAI,OAAO;gDAAE,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,OAAsB,CAAC,CAAA;;gDAC/C,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;wCACzB,CAAC;qCACF,EACD,KAAK,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAC1B;iCACF;6BACF,CACF;yBACF;qBACF,CACF,CAAA;gBACH,CAAC,CAAC;aACL,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export declare const MAlert: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
+
width: {
|
|
3
|
+
type: import("vue").PropType<import("@getcortexlabs/mavis-core").Dimension>;
|
|
4
|
+
default: undefined;
|
|
5
|
+
};
|
|
6
|
+
title: {
|
|
7
|
+
type: StringConstructor;
|
|
8
|
+
required: true;
|
|
9
|
+
};
|
|
10
|
+
description: {
|
|
11
|
+
type: StringConstructor;
|
|
12
|
+
default: string;
|
|
13
|
+
};
|
|
14
|
+
tone: {
|
|
15
|
+
type: import("vue").PropType<"info" | "success" | "warning" | "error">;
|
|
16
|
+
default: "info" | "success" | "warning" | "error";
|
|
17
|
+
validator: (value: "info" | "success" | "warning" | "error") => boolean;
|
|
18
|
+
};
|
|
19
|
+
dismissible: BooleanConstructor;
|
|
20
|
+
closeLabel: {
|
|
21
|
+
type: StringConstructor;
|
|
22
|
+
default: string;
|
|
23
|
+
};
|
|
24
|
+
announce: BooleanConstructor;
|
|
25
|
+
grow: {
|
|
26
|
+
type: NumberConstructor;
|
|
27
|
+
default: number;
|
|
28
|
+
};
|
|
29
|
+
shrink: {
|
|
30
|
+
type: NumberConstructor;
|
|
31
|
+
default: undefined;
|
|
32
|
+
};
|
|
33
|
+
id: {
|
|
34
|
+
type: StringConstructor;
|
|
35
|
+
default: undefined;
|
|
36
|
+
};
|
|
37
|
+
accessibilityHidden: {
|
|
38
|
+
type: BooleanConstructor;
|
|
39
|
+
default: undefined;
|
|
40
|
+
};
|
|
41
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
42
|
+
[key: string]: any;
|
|
43
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
44
|
+
close: () => boolean;
|
|
45
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
46
|
+
width: {
|
|
47
|
+
type: import("vue").PropType<import("@getcortexlabs/mavis-core").Dimension>;
|
|
48
|
+
default: undefined;
|
|
49
|
+
};
|
|
50
|
+
title: {
|
|
51
|
+
type: StringConstructor;
|
|
52
|
+
required: true;
|
|
53
|
+
};
|
|
54
|
+
description: {
|
|
55
|
+
type: StringConstructor;
|
|
56
|
+
default: string;
|
|
57
|
+
};
|
|
58
|
+
tone: {
|
|
59
|
+
type: import("vue").PropType<"info" | "success" | "warning" | "error">;
|
|
60
|
+
default: "info" | "success" | "warning" | "error";
|
|
61
|
+
validator: (value: "info" | "success" | "warning" | "error") => boolean;
|
|
62
|
+
};
|
|
63
|
+
dismissible: BooleanConstructor;
|
|
64
|
+
closeLabel: {
|
|
65
|
+
type: StringConstructor;
|
|
66
|
+
default: string;
|
|
67
|
+
};
|
|
68
|
+
announce: BooleanConstructor;
|
|
69
|
+
grow: {
|
|
70
|
+
type: NumberConstructor;
|
|
71
|
+
default: number;
|
|
72
|
+
};
|
|
73
|
+
shrink: {
|
|
74
|
+
type: NumberConstructor;
|
|
75
|
+
default: undefined;
|
|
76
|
+
};
|
|
77
|
+
id: {
|
|
78
|
+
type: StringConstructor;
|
|
79
|
+
default: undefined;
|
|
80
|
+
};
|
|
81
|
+
accessibilityHidden: {
|
|
82
|
+
type: BooleanConstructor;
|
|
83
|
+
default: undefined;
|
|
84
|
+
};
|
|
85
|
+
}>> & Readonly<{
|
|
86
|
+
onClose?: (() => any) | undefined;
|
|
87
|
+
}>, {
|
|
88
|
+
width: import("@getcortexlabs/mavis-core").Dimension;
|
|
89
|
+
grow: number;
|
|
90
|
+
shrink: number;
|
|
91
|
+
id: string;
|
|
92
|
+
accessibilityHidden: boolean;
|
|
93
|
+
tone: "error" | "warning" | "success" | "info";
|
|
94
|
+
description: string;
|
|
95
|
+
closeLabel: string;
|
|
96
|
+
dismissible: boolean;
|
|
97
|
+
announce: boolean;
|
|
98
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
99
|
+
//# sourceMappingURL=MAlert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MAlert.d.ts","sourceRoot":"","sources":["../../src/components/MAlert.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4EAoGjB,CAAA"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { defineComponent, h, mergeProps } from 'vue';
|
|
2
|
+
import { alertProps, alertEmits, useMavisTheme } from '@getcortexlabs/mavis-core/vue';
|
|
3
|
+
import { alertAppearance, checkAlertLabels } from '@getcortexlabs/mavis-core';
|
|
4
|
+
import { MBox, MColumn, MRow } from './layout.js';
|
|
5
|
+
import { MText } from './MText.js';
|
|
6
|
+
import { MIcon } from './MIcon.js';
|
|
7
|
+
import { MButton } from './MButton.js';
|
|
8
|
+
export const MAlert = defineComponent({
|
|
9
|
+
name: 'MAlert',
|
|
10
|
+
inheritAttrs: false,
|
|
11
|
+
props: alertProps,
|
|
12
|
+
emits: alertEmits,
|
|
13
|
+
setup(props, { attrs, slots, emit }) {
|
|
14
|
+
const { theme } = useMavisTheme();
|
|
15
|
+
return () => {
|
|
16
|
+
checkAlertLabels(props.title, props.dismissible, props.closeLabel);
|
|
17
|
+
const { colors } = theme.value;
|
|
18
|
+
const appearance = alertAppearance[props.tone];
|
|
19
|
+
return h(MColumn, mergeProps({
|
|
20
|
+
width: props.width,
|
|
21
|
+
grow: props.grow,
|
|
22
|
+
shrink: props.shrink,
|
|
23
|
+
padding: 'md',
|
|
24
|
+
gap: 'md',
|
|
25
|
+
radius: 'md',
|
|
26
|
+
backgroundColor: colors.surface,
|
|
27
|
+
style: {
|
|
28
|
+
border: `1px solid ${colors[appearance.tone]}`,
|
|
29
|
+
},
|
|
30
|
+
}, attrs, {
|
|
31
|
+
id: props.id,
|
|
32
|
+
accessibilityHidden: props.accessibilityHidden,
|
|
33
|
+
class: 'm-alert',
|
|
34
|
+
'data-tone': props.tone,
|
|
35
|
+
}), {
|
|
36
|
+
default: () => [
|
|
37
|
+
h(MRow, { gap: 'sm', align: 'start' }, {
|
|
38
|
+
default: () => [
|
|
39
|
+
h(MBox, {
|
|
40
|
+
width: 32,
|
|
41
|
+
height: 32,
|
|
42
|
+
radius: 'sm',
|
|
43
|
+
shrink: 0,
|
|
44
|
+
backgroundColor: colors.elevated,
|
|
45
|
+
style: { placeItems: 'center' },
|
|
46
|
+
}, {
|
|
47
|
+
default: () => h(MIcon, { name: appearance.icon, tone: appearance.tone, size: 20 }),
|
|
48
|
+
}),
|
|
49
|
+
h(MColumn, {
|
|
50
|
+
width: 0,
|
|
51
|
+
grow: 1,
|
|
52
|
+
gap: 'xs',
|
|
53
|
+
role: props.announce
|
|
54
|
+
? props.tone === 'error'
|
|
55
|
+
? 'alert'
|
|
56
|
+
: 'status'
|
|
57
|
+
: undefined,
|
|
58
|
+
'aria-atomic': props.announce ? 'true' : undefined,
|
|
59
|
+
}, {
|
|
60
|
+
default: () => [
|
|
61
|
+
h(MText, { text: props.title, style: { fontWeight: '600' } }),
|
|
62
|
+
props.description
|
|
63
|
+
? h(MText, { text: props.description, tone: 'muted' })
|
|
64
|
+
: null,
|
|
65
|
+
],
|
|
66
|
+
}),
|
|
67
|
+
props.dismissible
|
|
68
|
+
? h(MButton, {
|
|
69
|
+
icon: 'x',
|
|
70
|
+
variant: 'ghost',
|
|
71
|
+
size: 'sm',
|
|
72
|
+
accessibilityLabel: props.closeLabel,
|
|
73
|
+
shrink: 0,
|
|
74
|
+
style: { width: '44px', paddingLeft: 0, paddingRight: 0 },
|
|
75
|
+
onClick: () => emit('close'),
|
|
76
|
+
})
|
|
77
|
+
: null,
|
|
78
|
+
],
|
|
79
|
+
}),
|
|
80
|
+
slots.actions
|
|
81
|
+
? h(MRow, { gap: 'sm', wrap: true, align: 'start' }, { default: slots.actions })
|
|
82
|
+
: null,
|
|
83
|
+
],
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
//# sourceMappingURL=MAlert.js.map
|
|
@@ -0,0 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C,MAAM,CAAC,CAAC,CAAC,SAAS;6BACnD,EACD;gCACE,OAAO,EAAE,GAAG,EAAE,CAAC;oCACb,CAAC,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,CAAC;oCAC7D,KAAK,CAAC,WAAW;wCACf,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wCACtD,CAAC,CAAC,IAAI;iCACT;6BACF,CACF;4BACD,KAAK,CAAC,WAAW;gCACf,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE;oCACT,IAAI,EAAE,GAAG;oCACT,OAAO,EAAE,OAAO;oCAChB,IAAI,EAAE,IAAI;oCACV,kBAAkB,EAAE,KAAK,CAAC,UAAU;oCACpC,MAAM,EAAE,CAAC;oCACT,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE;oCACzD,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;iCAC7B,CAAC;gCACJ,CAAC,CAAC,IAAI;yBACT;qBACF,CACF;oBACD,KAAK,CAAC,OAAO;wBACX,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;wBAChF,CAAC,CAAC,IAAI;iBACT;aACF,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export declare const MAvatar: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
+
src: {
|
|
3
|
+
type: StringConstructor;
|
|
4
|
+
default: string;
|
|
5
|
+
};
|
|
6
|
+
name: {
|
|
7
|
+
type: StringConstructor;
|
|
8
|
+
default: string;
|
|
9
|
+
};
|
|
10
|
+
size: {
|
|
11
|
+
type: import("vue").PropType<"sm" | "md" | "lg" | "xl">;
|
|
12
|
+
default: "sm" | "md" | "lg" | "xl";
|
|
13
|
+
validator: (value: "sm" | "md" | "lg" | "xl") => boolean;
|
|
14
|
+
};
|
|
15
|
+
shape: {
|
|
16
|
+
type: import("vue").PropType<"circle" | "square">;
|
|
17
|
+
default: "circle" | "square";
|
|
18
|
+
validator: (value: "circle" | "square") => boolean;
|
|
19
|
+
};
|
|
20
|
+
id: {
|
|
21
|
+
type: StringConstructor;
|
|
22
|
+
default: undefined;
|
|
23
|
+
};
|
|
24
|
+
accessibilityLabel: {
|
|
25
|
+
type: StringConstructor;
|
|
26
|
+
default: undefined;
|
|
27
|
+
};
|
|
28
|
+
accessibilityHidden: {
|
|
29
|
+
type: BooleanConstructor;
|
|
30
|
+
default: undefined;
|
|
31
|
+
};
|
|
32
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
33
|
+
[key: string]: any;
|
|
34
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
35
|
+
src: {
|
|
36
|
+
type: StringConstructor;
|
|
37
|
+
default: string;
|
|
38
|
+
};
|
|
39
|
+
name: {
|
|
40
|
+
type: StringConstructor;
|
|
41
|
+
default: string;
|
|
42
|
+
};
|
|
43
|
+
size: {
|
|
44
|
+
type: import("vue").PropType<"sm" | "md" | "lg" | "xl">;
|
|
45
|
+
default: "sm" | "md" | "lg" | "xl";
|
|
46
|
+
validator: (value: "sm" | "md" | "lg" | "xl") => boolean;
|
|
47
|
+
};
|
|
48
|
+
shape: {
|
|
49
|
+
type: import("vue").PropType<"circle" | "square">;
|
|
50
|
+
default: "circle" | "square";
|
|
51
|
+
validator: (value: "circle" | "square") => boolean;
|
|
52
|
+
};
|
|
53
|
+
id: {
|
|
54
|
+
type: StringConstructor;
|
|
55
|
+
default: undefined;
|
|
56
|
+
};
|
|
57
|
+
accessibilityLabel: {
|
|
58
|
+
type: StringConstructor;
|
|
59
|
+
default: undefined;
|
|
60
|
+
};
|
|
61
|
+
accessibilityHidden: {
|
|
62
|
+
type: BooleanConstructor;
|
|
63
|
+
default: undefined;
|
|
64
|
+
};
|
|
65
|
+
}>> & Readonly<{}>, {
|
|
66
|
+
id: string;
|
|
67
|
+
accessibilityLabel: string;
|
|
68
|
+
accessibilityHidden: boolean;
|
|
69
|
+
name: string;
|
|
70
|
+
size: "sm" | "md" | "lg" | "xl";
|
|
71
|
+
src: string;
|
|
72
|
+
shape: "circle" | "square";
|
|
73
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
74
|
+
//# sourceMappingURL=MAvatar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MAvatar.d.ts","sourceRoot":"","sources":["../../src/components/MAvatar.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4EAyFlB,CAAA"}
|