@mozaic-ds/vue 2.11.0 → 2.13.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.
- package/dist/mozaic-vue.css +1 -1
- package/dist/mozaic-vue.d.ts +791 -353
- package/dist/mozaic-vue.js +2945 -2404
- package/dist/mozaic-vue.js.map +1 -1
- package/dist/mozaic-vue.umd.cjs +5 -5
- package/dist/mozaic-vue.umd.cjs.map +1 -1
- package/package.json +7 -6
- package/src/components/{usingPresets.mdx → BrandPresets.mdx} +2 -2
- package/src/components/Changelog.mdx +19 -0
- package/src/components/Color.mdx +226 -0
- package/src/components/Contributing.mdx +12 -6
- package/src/components/GettingStarted.mdx +1 -1
- package/src/components/Icon.stories.ts +134 -0
- package/src/components/Welcome.mdx +49 -0
- package/src/components/accordionlist/MAccordionList.spec.ts +136 -0
- package/src/components/accordionlist/MAccordionList.stories.ts +123 -0
- package/src/components/accordionlist/MAccordionList.vue +91 -0
- package/src/components/accordionlist/README.md +24 -0
- package/src/components/accordionlist/m-accordion-list.const.ts +9 -0
- package/src/components/accordionlistitem/MAccordionListItem.spec.ts +123 -0
- package/src/components/accordionlistitem/MAccordionListItem.vue +95 -0
- package/src/components/accordionlistitem/README.md +23 -0
- package/src/components/actionbottombar/MActionBottomBar.spec.ts +52 -0
- package/src/components/actionbottombar/MActionBottomBar.stories.ts +162 -0
- package/src/components/actionbottombar/MActionBottomBar.vue +45 -0
- package/src/components/actionbottombar/README.md +31 -0
- package/src/components/actionlistbox/MActionListbox.spec.ts +134 -0
- package/src/components/actionlistbox/MActionListbox.stories.ts +74 -0
- package/src/components/actionlistbox/MActionListbox.vue +89 -0
- package/src/components/actionlistbox/README.md +25 -0
- package/src/components/avatar/MAvatar.stories.ts +1 -1
- package/src/components/breadcrumb/README.md +14 -0
- package/src/components/builtinmenu/MBuiltInMenu.spec.ts +111 -0
- package/src/components/builtinmenu/MBuiltInMenu.stories.ts +59 -0
- package/src/components/builtinmenu/MBuiltInMenu.vue +110 -0
- package/src/components/builtinmenu/README.md +32 -0
- package/src/components/button/MButton.spec.ts +1 -1
- package/src/components/button/MButton.stories.ts +165 -5
- package/src/components/button/README.md +33 -1
- package/src/components/callout/MCallout.spec.ts +7 -6
- package/src/components/callout/MCallout.stories.ts +1 -2
- package/src/components/carousel/MCarousel.spec.ts +1 -2
- package/src/components/carousel/MCarousel.stories.ts +2 -1
- package/src/components/carousel/MCarousel.vue +1 -2
- package/src/components/carousel/README.md +14 -0
- package/src/components/checkbox/README.md +14 -0
- package/src/components/checkboxgroup/README.md +14 -0
- package/src/components/checklistmenu/MCheckListMenu.spec.ts +77 -0
- package/src/components/checklistmenu/MCheckListMenu.stories.ts +47 -0
- package/src/components/checklistmenu/MCheckListMenu.vue +61 -0
- package/src/components/checklistmenu/README.md +32 -0
- package/src/components/circularprogressbar/README.md +15 -1
- package/src/components/datepicker/MDatepicker.vue +1 -1
- package/src/components/divider/README.md +22 -0
- package/src/components/drawer/MDrawer.vue +1 -2
- package/src/components/drawer/README.md +16 -0
- package/src/components/field/README.md +14 -0
- package/src/components/fileuploader/MFileUploader.spec.ts +304 -0
- package/src/components/fileuploader/MFileUploader.stories.ts +123 -0
- package/src/components/fileuploader/MFileUploader.vue +314 -0
- package/src/components/fileuploader/README.md +58 -0
- package/src/components/fileuploaderitem/MFileUploaderItem.spec.ts +91 -0
- package/src/components/fileuploaderitem/MFileUploaderItem.vue +180 -0
- package/src/components/fileuploaderitem/README.md +58 -0
- package/src/components/flag/README.md +1 -1
- package/src/components/iconbutton/MIconButton.spec.ts +1 -1
- package/src/components/iconbutton/MIconButton.stories.ts +116 -7
- package/src/components/iconbutton/README.md +25 -1
- package/src/components/kpiitem/MKpiItem.vue +5 -3
- package/src/components/linearprogressbarbuffer/README.md +14 -0
- package/src/components/link/MLink.stories.ts +1 -2
- package/src/components/link/README.md +14 -0
- package/src/components/loader/README.md +20 -0
- package/src/components/loadingoverlay/README.md +14 -0
- package/src/components/modal/MModal.stories.ts +1 -2
- package/src/components/modal/MModal.vue +1 -1
- package/src/components/modal/README.md +16 -0
- package/src/components/numberbadge/README.md +17 -1
- package/src/components/overlay/README.md +16 -0
- package/src/components/pagination/MPagination.vue +1 -2
- package/src/components/pagination/README.md +18 -0
- package/src/components/passwordinput/MPasswordInput.vue +1 -1
- package/src/components/passwordinput/README.md +14 -0
- package/src/components/phonenumber/MPhoneNumber.spec.ts +7 -6
- package/src/components/phonenumber/MPhoneNumber.vue +1 -1
- package/src/components/quantityselector/MQuantitySelector.vue +1 -2
- package/src/components/radio/README.md +14 -0
- package/src/components/radiogroup/README.md +14 -0
- package/src/components/select/README.md +14 -0
- package/src/components/starrating/MStarRating.spec.ts +1 -2
- package/src/components/starrating/MStarRating.vue +1 -3
- package/src/components/statusbadge/README.md +14 -0
- package/src/components/statusdot/README.md +14 -0
- package/src/components/statusmessage/MStatusMessage.spec.ts +6 -4
- package/src/components/statusmessage/MStatusMessage.vue +6 -4
- package/src/components/statusmessage/README.md +14 -0
- package/src/components/statusnotification/MStatusNotification.spec.ts +6 -4
- package/src/components/statusnotification/MStatusNotification.stories.ts +1 -1
- package/src/components/statusnotification/MStatusNotification.vue +7 -5
- package/src/components/statusnotification/README.md +14 -0
- package/src/components/stepperbottombar/MStepperBottomBar.spec.ts +134 -0
- package/src/components/stepperbottombar/MStepperBottomBar.stories.ts +72 -0
- package/src/components/stepperbottombar/MStepperBottomBar.vue +131 -0
- package/src/components/stepperbottombar/README.md +40 -0
- package/src/components/steppercompact/README.md +14 -0
- package/src/components/stepperinline/MStepperInline.spec.ts +78 -0
- package/src/components/stepperinline/MStepperInline.stories.ts +49 -0
- package/src/components/stepperinline/MStepperInline.vue +93 -0
- package/src/components/stepperinline/README.md +11 -0
- package/src/components/tabs/MTabs.stories.ts +1 -1
- package/src/components/tabs/README.md +16 -0
- package/src/components/tag/MTag.vue +1 -1
- package/src/components/tag/README.md +14 -0
- package/src/components/textinput/MTextInput.spec.ts +1 -1
- package/src/components/textinput/MTextInput.stories.ts +1 -1
- package/src/components/textinput/MTextInput.vue +1 -1
- package/src/components/toaster/MToaster.spec.ts +6 -4
- package/src/components/toaster/MToaster.vue +7 -5
- package/src/components/toaster/README.md +16 -0
- package/src/components/toggle/README.md +14 -0
- package/src/components/togglegroup/README.md +14 -0
- package/src/main.ts +8 -0
- package/src/components/Introduction.mdx +0 -100
- package/src/components/Support.mdx +0 -18
- package/src/components/usingIcons.mdx +0 -35
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
2
|
+
import MBuiltInMenu from './MBuiltInMenu.vue';
|
|
3
|
+
import { Less24 } from '@mozaic-ds/icons-vue';
|
|
4
|
+
import { action } from 'storybook/actions';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof MBuiltInMenu> = {
|
|
7
|
+
title: 'Navigation/Built-in menu',
|
|
8
|
+
component: MBuiltInMenu,
|
|
9
|
+
tags: ['v2'],
|
|
10
|
+
parameters: {
|
|
11
|
+
docs: {
|
|
12
|
+
description: {
|
|
13
|
+
component:
|
|
14
|
+
'A built-in menu is a structured list of navigational or interactive options, typically displayed as a vertical stack. It allows users to browse categories, access settings, or navigate through different sections of an interface.',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
args: {
|
|
19
|
+
items: [
|
|
20
|
+
{ label: 'Label' },
|
|
21
|
+
{ label: 'Label' },
|
|
22
|
+
{ label: 'Label' },
|
|
23
|
+
{ label: 'Label' },
|
|
24
|
+
],
|
|
25
|
+
modelValue: 0,
|
|
26
|
+
},
|
|
27
|
+
render: (args) => ({
|
|
28
|
+
components: { MBuiltInMenu },
|
|
29
|
+
setup() {
|
|
30
|
+
const handleUpdate = action('update:modelValue');
|
|
31
|
+
|
|
32
|
+
return { args, handleUpdate };
|
|
33
|
+
},
|
|
34
|
+
template: `
|
|
35
|
+
<MBuiltInMenu v-model="args.modelValue" v-bind="args" @update:modelValue="handleUpdate"></MBuiltInMenu>
|
|
36
|
+
`,
|
|
37
|
+
}),
|
|
38
|
+
};
|
|
39
|
+
export default meta;
|
|
40
|
+
type Story = StoryObj<typeof MBuiltInMenu>;
|
|
41
|
+
|
|
42
|
+
export const Default: Story = {};
|
|
43
|
+
|
|
44
|
+
export const WithIcons: Story = {
|
|
45
|
+
args: {
|
|
46
|
+
items: [
|
|
47
|
+
{ label: 'Label', icon: Less24 },
|
|
48
|
+
{ label: 'Label', icon: Less24 },
|
|
49
|
+
{ label: 'Label', icon: Less24 },
|
|
50
|
+
{ label: 'Label', icon: Less24 },
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const Outlined: Story = {
|
|
56
|
+
args: {
|
|
57
|
+
outlined: true,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<nav
|
|
3
|
+
:class="{
|
|
4
|
+
'mc-built-in-menu': true,
|
|
5
|
+
'mc-built-in-menu--outlined': props.outlined,
|
|
6
|
+
}"
|
|
7
|
+
aria-label="menu"
|
|
8
|
+
>
|
|
9
|
+
<ul class="mc-built-in-menu__list">
|
|
10
|
+
<li
|
|
11
|
+
v-for="(item, index) in props.items"
|
|
12
|
+
:key="index"
|
|
13
|
+
:class="{
|
|
14
|
+
'mc-built-in-menu__item': true,
|
|
15
|
+
'mc-built-in-menu__item--selected': currentMenuItem === index,
|
|
16
|
+
}"
|
|
17
|
+
v-bind="currentMenuItem === index ? { 'aria-current': true } : {}"
|
|
18
|
+
>
|
|
19
|
+
<component
|
|
20
|
+
:is="getItemTag(item)"
|
|
21
|
+
:class="{
|
|
22
|
+
'mc-built-in-menu__button': getItemTag(item) === 'button',
|
|
23
|
+
'mc-built-in-menu__link': isLink(item),
|
|
24
|
+
}"
|
|
25
|
+
v-bind="isLink(item) ? getLinkAttrs(item) : {}"
|
|
26
|
+
@click="currentMenuItem = index"
|
|
27
|
+
>
|
|
28
|
+
<component
|
|
29
|
+
v-if="item.icon"
|
|
30
|
+
:is="item.icon"
|
|
31
|
+
class="mc-built-in-menu__icon"
|
|
32
|
+
/>
|
|
33
|
+
|
|
34
|
+
<span class="mc-built-in-menu__label">{{ item.label }}</span>
|
|
35
|
+
|
|
36
|
+
<ChevronRight20 class="mc-built-in-menu__icon" />
|
|
37
|
+
</component>
|
|
38
|
+
</li>
|
|
39
|
+
</ul>
|
|
40
|
+
</nav>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script setup lang="ts">
|
|
44
|
+
import { ChevronRight20 } from '@mozaic-ds/icons-vue';
|
|
45
|
+
import { computed, type Component } from 'vue';
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A built-in menu is a structured list of navigational or interactive options, typically displayed as a vertical stack. It allows users to browse categories, access settings, or navigate through different sections of an interface.
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
export type MenuItem = {
|
|
52
|
+
label: string;
|
|
53
|
+
icon?: Component;
|
|
54
|
+
href?: string;
|
|
55
|
+
to?: string;
|
|
56
|
+
target?: '_self' | '_blank' | '_parent' | '_top';
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const props = defineProps<{
|
|
60
|
+
/**
|
|
61
|
+
* Specifies the key of the currently selected menu item. It allows the component to highlight or style the corresponding item to indicate it is selected or currently in use.
|
|
62
|
+
*/
|
|
63
|
+
modelValue?: number;
|
|
64
|
+
/**
|
|
65
|
+
* Defines the menu items, each of which can include an icon and act as a button, link, or router-link.
|
|
66
|
+
*/
|
|
67
|
+
items: MenuItem[];
|
|
68
|
+
/**
|
|
69
|
+
* When enabled, adds a visible border around the wrapper to highlight or separate its content.
|
|
70
|
+
*/
|
|
71
|
+
outlined?: boolean;
|
|
72
|
+
}>();
|
|
73
|
+
|
|
74
|
+
const emit = defineEmits<{
|
|
75
|
+
/**
|
|
76
|
+
* Emitted when the selected item changes, providing the updated selected value.
|
|
77
|
+
*/
|
|
78
|
+
(on: 'update:modelValue', value: number): void;
|
|
79
|
+
}>();
|
|
80
|
+
|
|
81
|
+
const currentMenuItem = computed({
|
|
82
|
+
get() {
|
|
83
|
+
return props.modelValue;
|
|
84
|
+
},
|
|
85
|
+
set(value: number) {
|
|
86
|
+
emit('update:modelValue', value);
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
function getItemTag(item: MenuItem) {
|
|
91
|
+
if (item.href) return 'a';
|
|
92
|
+
if (item.to) return 'router-link';
|
|
93
|
+
return 'button';
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function isLink(item: MenuItem) {
|
|
97
|
+
return getItemTag(item) === 'a' || getItemTag(item) === 'router-link';
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function getLinkAttrs(item: MenuItem) {
|
|
101
|
+
return {
|
|
102
|
+
...(getItemTag(item) === 'a' ? { href: item.href } : { to: item.to }),
|
|
103
|
+
target: item.target || '_self',
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
</script>
|
|
107
|
+
|
|
108
|
+
<style lang="scss" scoped>
|
|
109
|
+
@use '@mozaic-ds/styles/components/built-in-menu';
|
|
110
|
+
</style>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# MBuiltInMenu
|
|
2
|
+
|
|
3
|
+
A built-in menu is a structured list of navigational or interactive options, typically displayed as a vertical stack. It allows users to browse categories, access settings, or navigate through different sections of an interface.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Props
|
|
7
|
+
|
|
8
|
+
| Name | Description | Type | Default |
|
|
9
|
+
| --- | --- | --- | --- |
|
|
10
|
+
| `modelValue` | Specifies the key of the currently selected menu item. It allows the component to highlight or style the corresponding item to indicate it is selected or currently in use. | `number` | - |
|
|
11
|
+
| `items*` | Defines the menu items, each of which can include an icon and act as a button, link, or router-link. | `MenuItem[]` | - |
|
|
12
|
+
| `outlined` | When enabled, adds a visible border around the wrapper to highlight or separate its content. | `boolean` | - |
|
|
13
|
+
|
|
14
|
+
## Events
|
|
15
|
+
|
|
16
|
+
| Name | Description | Type |
|
|
17
|
+
| --- | --- | --- |
|
|
18
|
+
| `update:modelValue` | Emitted when the selected item changes, providing the updated selected value. | [value: number] |
|
|
19
|
+
|
|
20
|
+
## Dependencies
|
|
21
|
+
|
|
22
|
+
### Used By
|
|
23
|
+
|
|
24
|
+
- [MCheckListMenu](../checklistmenu)
|
|
25
|
+
|
|
26
|
+
### Graph
|
|
27
|
+
|
|
28
|
+
```mermaid
|
|
29
|
+
graph TD;
|
|
30
|
+
MCheckListMenu --> MBuiltInMenu
|
|
31
|
+
style MBuiltInMenu fill:#008240,stroke:#333,stroke-width:4px
|
|
32
|
+
```
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mount } from '@vue/test-utils';
|
|
2
2
|
import { describe, it, expect } from 'vitest';
|
|
3
3
|
import MButton from './MButton.vue';
|
|
4
|
-
import ChevronRight24 from '@mozaic-ds/icons-vue
|
|
4
|
+
import { ChevronRight24 } from '@mozaic-ds/icons-vue';
|
|
5
5
|
import MLoader from '../loader/MLoader.vue';
|
|
6
6
|
|
|
7
7
|
describe('MButton component', () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
2
2
|
|
|
3
3
|
import MButton from './MButton.vue';
|
|
4
|
-
import ChevronRight24 from '@mozaic-ds/icons-vue
|
|
4
|
+
import { ChevronRight24, Edit24, Search24 } from '@mozaic-ds/icons-vue';
|
|
5
5
|
|
|
6
6
|
const meta: Meta<typeof MButton> = {
|
|
7
7
|
title: 'Action/Button',
|
|
@@ -16,7 +16,7 @@ const meta: Meta<typeof MButton> = {
|
|
|
16
16
|
},
|
|
17
17
|
args: { default: 'Button Label' },
|
|
18
18
|
render: (args) => ({
|
|
19
|
-
components: { MButton, ChevronRight24 },
|
|
19
|
+
components: { MButton, ChevronRight24, Edit24, Search24 },
|
|
20
20
|
setup() {
|
|
21
21
|
return { args };
|
|
22
22
|
},
|
|
@@ -33,21 +33,173 @@ const meta: Meta<typeof MButton> = {
|
|
|
33
33
|
export default meta;
|
|
34
34
|
type Story = StoryObj<typeof MButton>;
|
|
35
35
|
|
|
36
|
-
export const Filled: Story = {
|
|
36
|
+
export const Filled: Story = {
|
|
37
|
+
parameters: {
|
|
38
|
+
docs: {
|
|
39
|
+
description: {
|
|
40
|
+
story:
|
|
41
|
+
'Most visible variant, used to emphasize the primary action on a page or a section.',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
};
|
|
37
46
|
|
|
38
|
-
export const
|
|
47
|
+
export const Outlined: Story = {
|
|
39
48
|
args: { outlined: true },
|
|
49
|
+
parameters: {
|
|
50
|
+
docs: {
|
|
51
|
+
description: {
|
|
52
|
+
story:
|
|
53
|
+
'Complements the filled button for secondary actions that require less attention. It can also be used when multiple actions are available, without one standing out as more important.',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
40
57
|
};
|
|
41
58
|
|
|
42
59
|
export const Ghost: Story = {
|
|
43
60
|
args: { ghost: true },
|
|
61
|
+
parameters: {
|
|
62
|
+
docs: {
|
|
63
|
+
description: {
|
|
64
|
+
story:
|
|
65
|
+
'More discreet, should be used exclusively for canceling or ignoring a task or action.',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
44
69
|
};
|
|
45
70
|
|
|
46
|
-
export const
|
|
71
|
+
export const IconLeft: Story = {
|
|
47
72
|
args: {
|
|
48
73
|
iconPosition: 'left',
|
|
74
|
+
icon: '<Edit24/>',
|
|
75
|
+
},
|
|
76
|
+
parameters: {
|
|
77
|
+
docs: {
|
|
78
|
+
description: {
|
|
79
|
+
story:
|
|
80
|
+
'An icon can enhance the action or provide a visual element that helps user understanding.<br/> Used in conjunction with the action verb, reinforcing its meaning.',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const IconRight: Story = {
|
|
87
|
+
args: {
|
|
88
|
+
iconPosition: 'right',
|
|
49
89
|
icon: '<ChevronRight24/>',
|
|
50
90
|
},
|
|
91
|
+
parameters: {
|
|
92
|
+
docs: {
|
|
93
|
+
description: {
|
|
94
|
+
story:
|
|
95
|
+
'An icon can enhance the action or provide a visual element that helps user understanding.<br/> Often emphasizes the concept of navigation, guiding users effectively.',
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export const IconOnly: Story = {
|
|
102
|
+
args: {
|
|
103
|
+
default: undefined,
|
|
104
|
+
iconPosition: 'only',
|
|
105
|
+
icon: '<Search24/>',
|
|
106
|
+
ariaLabel: 'Search button',
|
|
107
|
+
},
|
|
108
|
+
parameters: {
|
|
109
|
+
docs: {
|
|
110
|
+
description: {
|
|
111
|
+
story:
|
|
112
|
+
'An icon can enhance the action or provide a visual element that helps user understanding.<br/> Used when the action is generic enough to be understood without accompanying text.',
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export const Standard: Story = {
|
|
119
|
+
args: { appearance: 'standard' },
|
|
120
|
+
parameters: {
|
|
121
|
+
docs: {
|
|
122
|
+
description: {
|
|
123
|
+
story:
|
|
124
|
+
'The standard style is a neutral variant used for general actions that don’t require special attention, ensuring a consistent and accessible look.',
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export const Accent: Story = {
|
|
131
|
+
args: { appearance: 'accent' },
|
|
132
|
+
parameters: {
|
|
133
|
+
docs: {
|
|
134
|
+
description: {
|
|
135
|
+
story:
|
|
136
|
+
'The accent style is a more prominent variant used for engaging actions that require attention, such as conversions or highlighting specific tasks, ensuring a vibrant and accessible appearance.',
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export const Danger: Story = {
|
|
143
|
+
args: { appearance: 'danger' },
|
|
144
|
+
parameters: {
|
|
145
|
+
docs: {
|
|
146
|
+
description: {
|
|
147
|
+
story:
|
|
148
|
+
'The danger style is intended for critical or irreversible actions, such as deleting sensitive data (e.g., deleting a profile picture is not considered sensitive), ensuring that users are clearly warned before proceeding.',
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export const Inverse: Story = {
|
|
155
|
+
globals: {
|
|
156
|
+
backgrounds: { value: 'inverse' },
|
|
157
|
+
},
|
|
158
|
+
args: { appearance: 'inverse' },
|
|
159
|
+
parameters: {
|
|
160
|
+
docs: {
|
|
161
|
+
description: {
|
|
162
|
+
story:
|
|
163
|
+
'The inverse style must be used exclusively on dark backgrounds, providing contrast and clarity.',
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export const Small: Story = {
|
|
170
|
+
args: { size: 's' },
|
|
171
|
+
parameters: {
|
|
172
|
+
docs: {
|
|
173
|
+
description: {
|
|
174
|
+
story:
|
|
175
|
+
'Exclusively used on desktop interfaces. Ideal for complex interfaces with a high volume of content.',
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export const Medium: Story = {
|
|
182
|
+
args: { size: 'm' },
|
|
183
|
+
parameters: {
|
|
184
|
+
docs: {
|
|
185
|
+
description: {
|
|
186
|
+
story:
|
|
187
|
+
'This is the minimum size recommended for mobile use, and it is the default size based on standard height. It provides an adequate touch area for mobile devices.',
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
export const Large: Story = {
|
|
194
|
+
args: { size: 'l' },
|
|
195
|
+
parameters: {
|
|
196
|
+
docs: {
|
|
197
|
+
description: {
|
|
198
|
+
story:
|
|
199
|
+
'Primarily used on landing pages or layouts with generous spacing. It may also be applicable in more complex scenarios, such as for small mobile devices used by warehouse employees.',
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
},
|
|
51
203
|
};
|
|
52
204
|
|
|
53
205
|
export const Loading: Story = {
|
|
@@ -55,4 +207,12 @@ export const Loading: Story = {
|
|
|
55
207
|
isLoading: true,
|
|
56
208
|
ariaLabel: 'Loading button',
|
|
57
209
|
},
|
|
210
|
+
parameters: {
|
|
211
|
+
docs: {
|
|
212
|
+
description: {
|
|
213
|
+
story:
|
|
214
|
+
'Visually communicates to users that a process or action is in progress. It helps set user expectations during waiting periods by indicating that the system is working. Typically used for actions that require more than a fraction of a second to complete.',
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
},
|
|
58
218
|
};
|
|
@@ -7,7 +7,7 @@ Buttons are key interactive elements used to perform actions and can be used as
|
|
|
7
7
|
|
|
8
8
|
| Name | Description | Type | Default |
|
|
9
9
|
| --- | --- | --- | --- |
|
|
10
|
-
| `appearance` | Defines the visual style of the button. | `"standard"` `"
|
|
10
|
+
| `appearance` | Defines the visual style of the button. | `"standard"` `"danger"` `"inverse"` `"accent"` | `"standard"` |
|
|
11
11
|
| `size` | Determines the size of the button. | `"s"` `"m"` `"l"` | `"m"` |
|
|
12
12
|
| `disabled` | If `true`, disables the button, making it non-interactive. | `boolean` | - |
|
|
13
13
|
| `ghost` | If `true`, applies a "ghost" style to the button, typically a transparent background with a border. | `boolean` | - |
|
|
@@ -22,3 +22,35 @@ Buttons are key interactive elements used to perform actions and can be used as
|
|
|
22
22
|
| --- | --- |
|
|
23
23
|
| `default` | The content displayed in the button. |
|
|
24
24
|
| `icon` | Use this slot to insert an icon for the Button. |
|
|
25
|
+
|
|
26
|
+
## Dependencies
|
|
27
|
+
|
|
28
|
+
### Depends on
|
|
29
|
+
|
|
30
|
+
- [MLoader](../loader)
|
|
31
|
+
|
|
32
|
+
### Graph
|
|
33
|
+
|
|
34
|
+
```mermaid
|
|
35
|
+
graph TD;
|
|
36
|
+
MButton --> MLoader
|
|
37
|
+
style MButton fill:#008240,stroke:#333,stroke-width:4px
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Used By
|
|
41
|
+
|
|
42
|
+
- [MFileUploaderItem](../fileuploaderitem)
|
|
43
|
+
- [MPagination](../pagination)
|
|
44
|
+
- [MPasswordInput](../passwordinput)
|
|
45
|
+
- [MStepperBottomBar](../stepperbottombar)
|
|
46
|
+
|
|
47
|
+
### Graph
|
|
48
|
+
|
|
49
|
+
```mermaid
|
|
50
|
+
graph TD;
|
|
51
|
+
MFileUploaderItem --> MButton
|
|
52
|
+
MPagination --> MButton
|
|
53
|
+
MPasswordInput --> MButton
|
|
54
|
+
MStepperBottomBar --> MButton
|
|
55
|
+
style MButton fill:#008240,stroke:#333,stroke-width:4px
|
|
56
|
+
```
|
|
@@ -2,15 +2,16 @@ import { describe, it, expect, vi } from 'vitest';
|
|
|
2
2
|
import { mount } from '@vue/test-utils';
|
|
3
3
|
import MCallout from './MCallout.vue';
|
|
4
4
|
|
|
5
|
-
vi.mock(
|
|
6
|
-
'@mozaic-ds/icons-vue
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
vi.mock('@mozaic-ds/icons-vue', async () => {
|
|
6
|
+
const actual = await vi.importActual('@mozaic-ds/icons-vue');
|
|
7
|
+
return {
|
|
8
|
+
...actual,
|
|
9
|
+
ImageAlt32: {
|
|
9
10
|
name: 'ImageAlt32',
|
|
10
11
|
template: '<svg class="mock-icon" />',
|
|
11
12
|
},
|
|
12
|
-
}
|
|
13
|
-
);
|
|
13
|
+
};
|
|
14
|
+
});
|
|
14
15
|
|
|
15
16
|
describe('MCallout.vue', () => {
|
|
16
17
|
it('renders title and description correctly', () => {
|
|
@@ -2,8 +2,7 @@ import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
|
2
2
|
import MCallout from './MCallout.vue';
|
|
3
3
|
import MButton from '../button/MButton.vue';
|
|
4
4
|
import MLink from '../link/MLink.vue';
|
|
5
|
-
import ArrowNext20 from '@mozaic-ds/icons-vue
|
|
6
|
-
import ImageAlt32 from '@mozaic-ds/icons-vue/src/components/ImageAlt32/ImageAlt32.vue';
|
|
5
|
+
import { ArrowNext20, ImageAlt32 } from '@mozaic-ds/icons-vue';
|
|
7
6
|
|
|
8
7
|
const meta: Meta<typeof MCallout> = {
|
|
9
8
|
title: 'Content/Callout',
|
|
@@ -2,8 +2,7 @@ import { mount } from '@vue/test-utils';
|
|
|
2
2
|
import { describe, it, expect, vi, beforeAll, afterAll } from 'vitest';
|
|
3
3
|
import MCarousel from './MCarousel.vue';
|
|
4
4
|
import MIconButton from '../iconbutton/MIconButton.vue';
|
|
5
|
-
import ChevronLeft20 from '@mozaic-ds/icons-vue
|
|
6
|
-
import ChevronRight20 from '@mozaic-ds/icons-vue/src/components/ChevronRight20/ChevronRight20.vue';
|
|
5
|
+
import { ChevronLeft20, ChevronRight20 } from '@mozaic-ds/icons-vue';
|
|
7
6
|
|
|
8
7
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
9
8
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
2
2
|
import MCarousel from './MCarousel.vue';
|
|
3
3
|
import MLink from '../link/MLink.vue';
|
|
4
|
-
import ArrowNext24 from '@mozaic-ds/icons-vue
|
|
4
|
+
import { ArrowNext24 } from '@mozaic-ds/icons-vue';
|
|
5
5
|
|
|
6
6
|
const meta: Meta<typeof MCarousel> = {
|
|
7
7
|
title: 'Content/Carousel',
|
|
8
8
|
component: MCarousel,
|
|
9
|
+
tags: ['v2'],
|
|
9
10
|
parameters: {
|
|
10
11
|
docs: {
|
|
11
12
|
description: {
|
|
@@ -48,8 +48,7 @@
|
|
|
48
48
|
<script setup lang="ts">
|
|
49
49
|
import { computed, onMounted, ref, type VNode } from 'vue';
|
|
50
50
|
import MIconButton from '../iconbutton/MIconButton.vue';
|
|
51
|
-
import ChevronLeft20 from '@mozaic-ds/icons-vue
|
|
52
|
-
import ChevronRight20 from '@mozaic-ds/icons-vue/src/components/ChevronRight20/ChevronRight20.vue';
|
|
51
|
+
import { ChevronLeft20, ChevronRight20 } from '@mozaic-ds/icons-vue';
|
|
53
52
|
/**
|
|
54
53
|
* A Carousel allows users to browse through multiple items within a horizontal container, using swipe gestures on mobile or navigation controls on desktop. It is primarily used to showcase products, promotions, or visual content, offering an engaging way to explore information in a condensed and interactive format. Carousels help optimize space while keeping content visually appealing and easily accessible.
|
|
55
54
|
*/
|
|
@@ -16,3 +16,17 @@ A Carousel allows users to browse through multiple items within a horizontal con
|
|
|
16
16
|
| --- | --- |
|
|
17
17
|
| `default` | Use this slot to insert a list of components to be displayed in the carousel. |
|
|
18
18
|
| `header` | Use this slot to insert the title, subtitle or link of the carousel. |
|
|
19
|
+
|
|
20
|
+
## Dependencies
|
|
21
|
+
|
|
22
|
+
### Depends on
|
|
23
|
+
|
|
24
|
+
- [MIconButton](../iconbutton)
|
|
25
|
+
|
|
26
|
+
### Graph
|
|
27
|
+
|
|
28
|
+
```mermaid
|
|
29
|
+
graph TD;
|
|
30
|
+
MCarousel --> MIconButton
|
|
31
|
+
style MCarousel fill:#008240,stroke:#333,stroke-width:4px
|
|
32
|
+
```
|
|
@@ -21,3 +21,17 @@ A checkbox is an interactive component used to select or deselect an option, typ
|
|
|
21
21
|
| Name | Description | Type |
|
|
22
22
|
| --- | --- | --- |
|
|
23
23
|
| `update:modelValue` | Emits when the checkbox value changes, updating the modelValue prop. | [value: boolean] |
|
|
24
|
+
|
|
25
|
+
## Dependencies
|
|
26
|
+
|
|
27
|
+
### Used By
|
|
28
|
+
|
|
29
|
+
- [MCheckboxGroup](../checkboxgroup)
|
|
30
|
+
|
|
31
|
+
### Graph
|
|
32
|
+
|
|
33
|
+
```mermaid
|
|
34
|
+
graph TD;
|
|
35
|
+
MCheckboxGroup --> MCheckbox
|
|
36
|
+
style MCheckbox fill:#008240,stroke:#333,stroke-width:4px
|
|
37
|
+
```
|
|
@@ -18,3 +18,17 @@ A checkbox is an interactive component used to select or deselect an option, typ
|
|
|
18
18
|
| Name | Description | Type |
|
|
19
19
|
| --- | --- | --- |
|
|
20
20
|
| `update:modelValue` | Emits when the checkbox group value changes, updating the modelValue prop. | [value: Array<string>] |
|
|
21
|
+
|
|
22
|
+
## Dependencies
|
|
23
|
+
|
|
24
|
+
### Depends on
|
|
25
|
+
|
|
26
|
+
- [MCheckbox](../checkbox)
|
|
27
|
+
|
|
28
|
+
### Graph
|
|
29
|
+
|
|
30
|
+
```mermaid
|
|
31
|
+
graph TD;
|
|
32
|
+
MCheckboxGroup --> MCheckbox
|
|
33
|
+
style MCheckboxGroup fill:#008240,stroke:#333,stroke-width:4px
|
|
34
|
+
```
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils';
|
|
2
|
+
import { describe, it, expect } from 'vitest';
|
|
3
|
+
import MCheckListMenu, { type CheckListMenuItem } from './MCheckListMenu.vue';
|
|
4
|
+
import { CheckCircleFilled24 } from '@mozaic-ds/icons-vue';
|
|
5
|
+
import type { MenuItem } from '../builtinmenu/MBuiltInMenu.vue';
|
|
6
|
+
|
|
7
|
+
const StubMBuiltInMenu = {
|
|
8
|
+
name: 'MBuiltInMenu',
|
|
9
|
+
props: ['modelValue', 'items', 'outlined'],
|
|
10
|
+
emits: ['update:modelValue'],
|
|
11
|
+
template: '<div />',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
describe('MCheckListMenu', () => {
|
|
15
|
+
it('maps items and sets icon for checked items', () => {
|
|
16
|
+
const items: CheckListMenuItem[] = [
|
|
17
|
+
{
|
|
18
|
+
label: 'One',
|
|
19
|
+
checked: true,
|
|
20
|
+
href: '/one',
|
|
21
|
+
to: undefined,
|
|
22
|
+
target: undefined,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
label: 'Two',
|
|
26
|
+
checked: false,
|
|
27
|
+
href: undefined,
|
|
28
|
+
to: '/two',
|
|
29
|
+
target: '_blank',
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
const wrapper = mount(MCheckListMenu, {
|
|
34
|
+
props: { items, modelValue: undefined },
|
|
35
|
+
global: { components: { MBuiltInMenu: StubMBuiltInMenu } },
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const builtIn = wrapper.findComponent(StubMBuiltInMenu);
|
|
39
|
+
const passedItems = builtIn.props('items') as MenuItem[];
|
|
40
|
+
|
|
41
|
+
expect(passedItems).toHaveLength(2);
|
|
42
|
+
expect(passedItems[0].label).toBe('One');
|
|
43
|
+
expect(passedItems[0].icon).toBe(CheckCircleFilled24);
|
|
44
|
+
expect(passedItems[0].href).toBe('/one');
|
|
45
|
+
|
|
46
|
+
expect(passedItems[1].label).toBe('Two');
|
|
47
|
+
expect(passedItems[1].icon).toBeUndefined();
|
|
48
|
+
expect(passedItems[1].to).toBe('/two');
|
|
49
|
+
expect(passedItems[1].target).toBe('_blank');
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('forwards outlined prop to MBuiltInMenu', () => {
|
|
53
|
+
const items = [{ label: 'A', checked: false }];
|
|
54
|
+
const wrapper = mount(MCheckListMenu, {
|
|
55
|
+
props: { items, modelValue: undefined, outlined: true },
|
|
56
|
+
global: { components: { MBuiltInMenu: StubMBuiltInMenu } },
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const builtIn = wrapper.findComponent(StubMBuiltInMenu);
|
|
60
|
+
expect(builtIn.props('outlined')).toBe(true);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('emits update:modelValue when inner menu updates modelValue', async () => {
|
|
64
|
+
const items = [{ label: 'X', checked: false }];
|
|
65
|
+
const wrapper = mount(MCheckListMenu, {
|
|
66
|
+
props: { items, modelValue: undefined },
|
|
67
|
+
global: { components: { MBuiltInMenu: StubMBuiltInMenu } },
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const builtIn = wrapper.findComponent(StubMBuiltInMenu);
|
|
71
|
+
await builtIn.vm.$emit('update:modelValue', 3);
|
|
72
|
+
|
|
73
|
+
const emitted = wrapper.emitted('update:modelValue');
|
|
74
|
+
expect(emitted).toBeTruthy();
|
|
75
|
+
expect(emitted![0]).toEqual([3]);
|
|
76
|
+
});
|
|
77
|
+
});
|