@mozaic-ds/vue 1.0.0-beta.7 → 1.0.0-beta.9
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 +1 -1
- package/dist/mozaic-vue.css +1 -1
- package/dist/mozaic-vue.d.ts +605 -210
- package/dist/mozaic-vue.js +1281 -629
- package/dist/mozaic-vue.js.map +1 -1
- package/dist/mozaic-vue.umd.cjs +1 -1
- package/dist/mozaic-vue.umd.cjs.map +1 -1
- package/package.json +8 -11
- package/src/components/Contributing.mdx +1 -1
- package/src/components/GettingStarted.mdx +2 -7
- package/src/components/Introduction.mdx +41 -21
- package/src/components/Support.mdx +1 -1
- package/src/components/breadcrumb/MBreadcrumb.stories.ts +11 -13
- package/src/components/breadcrumb/MBreadcrumb.vue +1 -1
- package/src/components/button/MButton.stories.ts +1 -8
- package/src/components/checkbox/MCheckbox.stories.ts +2 -2
- package/src/components/checkboxgroup/MCheckboxGroup.stories.ts +2 -2
- package/src/components/divider/MDivider.spec.ts +57 -0
- package/src/components/divider/MDivider.stories.ts +64 -0
- package/src/components/divider/MDivider.vue +56 -0
- package/src/components/drawer/MDrawer.spec.ts +100 -0
- package/src/components/drawer/MDrawer.stories.ts +128 -0
- package/src/components/drawer/MDrawer.vue +140 -0
- package/src/components/field/MField.stories.ts +2 -9
- package/src/components/fieldgroup/MFieldGroup.stories.ts +2 -9
- package/src/components/iconbutton/MIconButton.stories.ts +12 -4
- package/src/components/link/MLink.stories.ts +3 -12
- package/src/components/loader/MLoader.stories.ts +3 -5
- package/src/components/loader/MLoader.vue +1 -0
- package/src/components/loadingoverlay/MLoadingOverlay.spec.ts +37 -0
- package/src/components/loadingoverlay/MLoadingOverlay.stories.ts +40 -0
- package/src/components/loadingoverlay/MLoadingOverlay.vue +28 -0
- package/src/components/modal/MModal.spec.ts +103 -0
- package/src/components/modal/MModal.stories.ts +127 -0
- package/src/components/modal/MModal.vue +131 -0
- package/src/components/numberbadge/MNumberBadge.stories.ts +3 -5
- package/src/components/overlay/MOverlay.stories.ts +3 -8
- package/src/components/pagination/MPagination.spec.ts +123 -0
- package/src/components/pagination/MPagination.stories.ts +83 -0
- package/src/components/pagination/MPagination.vue +142 -0
- package/src/components/passwordinput/MPasswordInput.stories.ts +2 -2
- package/src/components/passwordinput/MPasswordInput.vue +2 -5
- package/src/components/pincode/MPincode.spec.ts +126 -0
- package/src/components/pincode/MPincode.stories.ts +68 -0
- package/src/components/pincode/MPincode.vue +139 -0
- package/src/components/quantityselector/MQuantitySelector.stories.ts +2 -2
- package/src/components/radio/MRadio.stories.ts +2 -2
- package/src/components/radiogroup/MRadioGroup.stories.ts +2 -2
- package/src/components/select/MSelect.stories.ts +2 -2
- package/src/components/statusbadge/MStatusBadge.stories.ts +1 -1
- package/src/components/statusdot/MStatusDot.stories.ts +1 -1
- package/src/components/statusnotification/MStatusNotification.spec.ts +12 -8
- package/src/components/statusnotification/MStatusNotification.stories.ts +2 -9
- package/src/components/statusnotification/MStatusNotification.vue +8 -8
- package/src/components/tabs/MTabs.stories.ts +104 -0
- package/src/components/tabs/MTabs.vue +113 -0
- package/src/components/tabs/Mtabs.spec.ts +149 -0
- package/src/components/tag/MTag.spec.ts +107 -0
- package/src/components/tag/MTag.stories.ts +75 -0
- package/src/components/tag/MTag.vue +151 -0
- package/src/components/textarea/MTextArea.stories.ts +2 -2
- package/src/components/textinput/MTextInput.stories.ts +2 -9
- package/src/components/toggle/MToggle.stories.ts +2 -2
- package/src/components/togglegroup/MToggleGroup.stories.ts +2 -2
- package/src/components/usingIcons.mdx +5 -13
- package/src/components/usingPresets.mdx +12 -9
- package/src/main.ts +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mozaic-ds/vue",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Mozaic-Vue is the Vue.js implementation of ADEO Design system",
|
|
6
6
|
"author": "ADEO - ADEO Design system",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"*.d.ts"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@mozaic-ds/styles": "2.0.0-alpha.
|
|
43
|
+
"@mozaic-ds/styles": "2.0.0-alpha.6",
|
|
44
44
|
"@mozaic-ds/web-fonts": "1.65.0",
|
|
45
45
|
"postcss-scss": "^4.0.9",
|
|
46
46
|
"vue": "^3.5.13"
|
|
@@ -49,15 +49,12 @@
|
|
|
49
49
|
"@commitlint/cli": "^19.8.0",
|
|
50
50
|
"@commitlint/config-conventional": "^19.8.0",
|
|
51
51
|
"@mozaic-ds/css-dev-tools": "1.75.0",
|
|
52
|
-
"@mozaic-ds/icons-vue": "^0.0
|
|
52
|
+
"@mozaic-ds/icons-vue": "^0.1.0-beta.3",
|
|
53
53
|
"@release-it/conventional-changelog": "^8.0.2",
|
|
54
|
-
"@storybook/addon-a11y": "^
|
|
55
|
-
"@storybook/addon-
|
|
56
|
-
"@storybook/
|
|
57
|
-
"@storybook/
|
|
58
|
-
"@storybook/theming": "^8.4.7",
|
|
59
|
-
"@storybook/vue3": "^8.4.6",
|
|
60
|
-
"@storybook/vue3-vite": "^8.6.7",
|
|
54
|
+
"@storybook/addon-a11y": "^9.0.18",
|
|
55
|
+
"@storybook/addon-themes": "^9.0.18",
|
|
56
|
+
"@storybook/vue3-vite": "^9.0.18",
|
|
57
|
+
"@storybook/addon-docs": "^9.0.18",
|
|
61
58
|
"@types/jsdom": "^21.1.7",
|
|
62
59
|
"@vitejs/plugin-vue": "^5.2.3",
|
|
63
60
|
"@vitest/coverage-v8": "^3.0.9",
|
|
@@ -78,7 +75,7 @@
|
|
|
78
75
|
"prettier": "^3.5.3",
|
|
79
76
|
"release-it": "^18.1.2",
|
|
80
77
|
"sass": "^1.86.0",
|
|
81
|
-
"storybook": "^
|
|
78
|
+
"storybook": "^9.0.18",
|
|
82
79
|
"typescript": "^5.7.2",
|
|
83
80
|
"vite": "^6.2.2",
|
|
84
81
|
"vite-plugin-dts": "^4.5.3",
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Meta } from '@storybook/blocks';
|
|
2
|
-
import { Source } from '@storybook/addon-docs';
|
|
1
|
+
import { Meta, Source } from '@storybook/addon-docs/blocks';
|
|
3
2
|
|
|
4
3
|
<Meta title="Getting Started" />
|
|
5
4
|
|
|
@@ -11,11 +10,7 @@ import { Source } from '@storybook/addon-docs';
|
|
|
11
10
|
|
|
12
11
|
In order to use **Mozaic-Vue** in your **Vue.js** project, you must first install the [npm package](https://www.npmjs.com/package/@mozaic-ds/vue):
|
|
13
12
|
|
|
14
|
-
<Source
|
|
15
|
-
language="bash"
|
|
16
|
-
dark
|
|
17
|
-
code="npm i @mozaic-ds/vue@beta"
|
|
18
|
-
/>
|
|
13
|
+
<Source language="bash" dark code="npm i @mozaic-ds/vue@beta" />
|
|
19
14
|
|
|
20
15
|
Or with **Yarn**:
|
|
21
16
|
|
|
@@ -1,45 +1,65 @@
|
|
|
1
|
-
import { Meta } from '@storybook/blocks';
|
|
2
|
-
import { Source } from '@storybook/addon-docs';
|
|
1
|
+
import { Meta, Source } from '@storybook/addon-docs/blocks';
|
|
3
2
|
import ads from '../../.storybook/assets/logo.svg';
|
|
4
3
|
import vue from '../../.storybook/assets/vue.svg';
|
|
5
4
|
|
|
6
5
|
<Meta title="Introduction" />
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
<p
|
|
8
|
+
style={{
|
|
9
|
+
display: 'flex',
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
justifyContent: 'center',
|
|
12
|
+
gap: '1rem',
|
|
13
|
+
}}
|
|
14
|
+
>
|
|
15
|
+
<img src={ads} alt="ADEO Design system logo" style={{ height: '80px' }} />
|
|
15
16
|
<span style={{ fontSize: '32px' }}>x</span>
|
|
16
|
-
<img
|
|
17
|
-
src={vue}
|
|
18
|
-
alt="Vue.js logo"
|
|
19
|
-
style={{ height: '80px' }}
|
|
20
|
-
/>
|
|
17
|
+
<img src={vue} alt="Vue.js logo" style={{ height: '80px' }} />
|
|
21
18
|
</p>
|
|
22
19
|
|
|
23
20
|
<h1 align="center">ADEO Design system - Vue.js library</h1>
|
|
24
21
|
|
|
25
|
-
<p align="center">
|
|
22
|
+
<p align="center">
|
|
23
|
+
A library of **Vue.js** components implementing **ADEO Design system**
|
|
24
|
+
guidelines.
|
|
25
|
+
</p>
|
|
26
26
|
|
|
27
|
-
<div
|
|
27
|
+
<div
|
|
28
|
+
style={{
|
|
29
|
+
display: 'flex',
|
|
30
|
+
alignItems: 'center',
|
|
31
|
+
justifyContent: 'center',
|
|
32
|
+
gap: '0.5rem',
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
28
35
|
<a href="https://www.npmjs.com/package/@mozaic-ds/vue/v/beta">
|
|
29
|
-
<img
|
|
36
|
+
<img
|
|
37
|
+
src="https://img.shields.io/npm/v/@mozaic-ds/vue/beta?label=NPM&logo=npm&color=yellow"
|
|
38
|
+
alt="npm beta version"
|
|
39
|
+
/>
|
|
30
40
|
</a>
|
|
31
41
|
<a href="https://github.com/adeo/mozaic-vue/blob/master/CONTRIBUTING.md">
|
|
32
|
-
<img
|
|
42
|
+
<img
|
|
43
|
+
src="https://img.shields.io/badge/PRs-welcome-blue.svg?logo=github"
|
|
44
|
+
alt="PRs welcome"
|
|
45
|
+
/>
|
|
33
46
|
</a>
|
|
34
47
|
<a href="https://app.slack.com/client/T4R6RCZFA/CN4K3A99R">
|
|
35
|
-
<img
|
|
48
|
+
<img
|
|
49
|
+
src="https://img.shields.io/badge/Slack-mozaic_vue-611f69.svg?logo=slack"
|
|
50
|
+
alt="Slack mozaic-vue"
|
|
51
|
+
/>
|
|
36
52
|
</a>
|
|
37
53
|
<a href="https://keys.adeo.com/keys/ls/space/2583429798460717/adeo-adeo-design-system">
|
|
38
|
-
<img
|
|
54
|
+
<img
|
|
55
|
+
src="https://img.shields.io/badge/KEYS-Adeo_Design_System-4526ce.svg"
|
|
56
|
+
alt="KEYS ADEO Design system"
|
|
57
|
+
/>
|
|
39
58
|
</a>
|
|
40
59
|
</div>
|
|
41
60
|
|
|
42
|
-
<br
|
|
61
|
+
<br />
|
|
62
|
+
<br />
|
|
43
63
|
|
|
44
64
|
## 🪄 Introduction
|
|
45
65
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3';
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
2
2
|
import MBreadcrumb from './MBreadcrumb.vue';
|
|
3
3
|
|
|
4
4
|
const meta: Meta<typeof MBreadcrumb> = {
|
|
@@ -17,22 +17,22 @@ const meta: Meta<typeof MBreadcrumb> = {
|
|
|
17
17
|
{
|
|
18
18
|
label: 'Home',
|
|
19
19
|
href: '#',
|
|
20
|
-
router: true
|
|
20
|
+
router: true,
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
label: 'level 01',
|
|
24
24
|
href: '#',
|
|
25
|
-
router: true
|
|
25
|
+
router: true,
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
label: 'level 02',
|
|
29
29
|
href: '#',
|
|
30
|
-
router: true
|
|
30
|
+
router: true,
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
label: 'Current Page',
|
|
34
34
|
href: '#',
|
|
35
|
-
router: true
|
|
35
|
+
router: true,
|
|
36
36
|
},
|
|
37
37
|
],
|
|
38
38
|
},
|
|
@@ -52,10 +52,8 @@ type Story = StoryObj<typeof MBreadcrumb>;
|
|
|
52
52
|
export const Default: Story = {};
|
|
53
53
|
|
|
54
54
|
export const Inverse: Story = {
|
|
55
|
-
|
|
56
|
-
backgrounds: {
|
|
57
|
-
default: 'Inverse',
|
|
58
|
-
},
|
|
55
|
+
globals: {
|
|
56
|
+
backgrounds: { value: 'inverse' },
|
|
59
57
|
},
|
|
60
58
|
args: { appearance: 'inverse' },
|
|
61
59
|
};
|
|
@@ -65,19 +63,19 @@ export const WithoutRouter: Story = {
|
|
|
65
63
|
links: [
|
|
66
64
|
{
|
|
67
65
|
label: 'Home',
|
|
68
|
-
href: '#'
|
|
66
|
+
href: '#',
|
|
69
67
|
},
|
|
70
68
|
{
|
|
71
69
|
label: 'level 01',
|
|
72
|
-
href: '#'
|
|
70
|
+
href: '#',
|
|
73
71
|
},
|
|
74
72
|
{
|
|
75
73
|
label: 'level 02',
|
|
76
|
-
href: '#'
|
|
74
|
+
href: '#',
|
|
77
75
|
},
|
|
78
76
|
{
|
|
79
77
|
label: 'Current Page',
|
|
80
|
-
href: '#'
|
|
78
|
+
href: '#',
|
|
81
79
|
},
|
|
82
80
|
],
|
|
83
81
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3';
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
2
2
|
|
|
3
3
|
import MButton from './MButton.vue';
|
|
4
4
|
import Download24 from '@mozaic-ds/icons-vue/src/components/Download24/Download24.vue';
|
|
@@ -16,13 +16,6 @@ const meta: Meta<typeof MButton> = {
|
|
|
16
16
|
},
|
|
17
17
|
},
|
|
18
18
|
args: { default: 'Button Label' },
|
|
19
|
-
argTypes: {
|
|
20
|
-
$slots: {
|
|
21
|
-
table: {
|
|
22
|
-
disable: true,
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
19
|
render: (args) => ({
|
|
27
20
|
components: { MButton, Download24, ChevronRight24 },
|
|
28
21
|
setup() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3';
|
|
2
|
-
import { action } from '
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
2
|
+
import { action } from 'storybook/actions';
|
|
3
3
|
|
|
4
4
|
import MCheckboxGroup from './MCheckboxGroup.vue';
|
|
5
5
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils';
|
|
2
|
+
import { describe, it, expect } from 'vitest';
|
|
3
|
+
import MDivider from './MDivider.vue';
|
|
4
|
+
|
|
5
|
+
describe('MDivider component', () => {
|
|
6
|
+
it('renders correctly with default props', () => {
|
|
7
|
+
const wrapper = mount(MDivider);
|
|
8
|
+
expect(wrapper.classes()).toContain('mc-divider');
|
|
9
|
+
|
|
10
|
+
const innerDiv = wrapper.find('.mc-divider > div');
|
|
11
|
+
expect(innerDiv.classes()).toContain('mc-divider-horizontal');
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('renders with vertical orientation', () => {
|
|
15
|
+
const wrapper = mount(MDivider, {
|
|
16
|
+
props: { orientation: 'vertical' },
|
|
17
|
+
});
|
|
18
|
+
const innerDiv = wrapper.find('.mc-divider > div');
|
|
19
|
+
expect(innerDiv.classes()).toContain('mc-divider-vertical');
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('applies the correct style class', () => {
|
|
23
|
+
const wrapper = mount(MDivider, {
|
|
24
|
+
props: { style: 'secondary' },
|
|
25
|
+
});
|
|
26
|
+
const innerDiv = wrapper.find('.mc-divider > div');
|
|
27
|
+
expect(innerDiv.classes()).toContain('mc-divider-horizontal--secondary');
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('applies the correct size class', () => {
|
|
31
|
+
const wrapper = mount(MDivider, {
|
|
32
|
+
props: { size: 'm' },
|
|
33
|
+
});
|
|
34
|
+
const innerDiv = wrapper.find('.mc-divider > div');
|
|
35
|
+
expect(innerDiv.classes()).toContain('mc-divider-horizontal--m');
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('uses default props when none are provided', () => {
|
|
39
|
+
const wrapper = mount(MDivider);
|
|
40
|
+
expect(wrapper.props().orientation).toBe('horizontal');
|
|
41
|
+
expect(wrapper.props().style).toBe('primary');
|
|
42
|
+
expect(wrapper.props().size).toBe('s');
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('handles custom props correctly', () => {
|
|
46
|
+
const wrapper = mount(MDivider, {
|
|
47
|
+
props: {
|
|
48
|
+
orientation: 'vertical',
|
|
49
|
+
style: 'tertiary',
|
|
50
|
+
size: 'l',
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
expect(wrapper.props().orientation).toBe('vertical');
|
|
54
|
+
expect(wrapper.props().style).toBe('tertiary');
|
|
55
|
+
expect(wrapper.props().size).toBe('l');
|
|
56
|
+
});
|
|
57
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
2
|
+
import MDivider from './MDivider.vue';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof MDivider> = {
|
|
5
|
+
title: 'Structure/Divider',
|
|
6
|
+
component: MDivider,
|
|
7
|
+
argTypes: {
|
|
8
|
+
orientation: {
|
|
9
|
+
control: 'radio',
|
|
10
|
+
options: ['horizontal', 'vertical'],
|
|
11
|
+
},
|
|
12
|
+
style: {
|
|
13
|
+
control: 'radio',
|
|
14
|
+
options: ['primary', 'secondary', 'tertiary', 'inverse'],
|
|
15
|
+
},
|
|
16
|
+
size: {
|
|
17
|
+
control: 'radio',
|
|
18
|
+
options: ['s', 'm', 'l'],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
render: (args) => ({
|
|
22
|
+
components: { MDivider },
|
|
23
|
+
setup() {
|
|
24
|
+
return { args };
|
|
25
|
+
},
|
|
26
|
+
template: `
|
|
27
|
+
<div>
|
|
28
|
+
<MDivider v-bind="args"></MDivider>
|
|
29
|
+
<p style="padding: 1rem">Horizontal Divider</p>
|
|
30
|
+
</div>
|
|
31
|
+
`,
|
|
32
|
+
}),
|
|
33
|
+
};
|
|
34
|
+
export default meta;
|
|
35
|
+
type Story = StoryObj<typeof MDivider>;
|
|
36
|
+
|
|
37
|
+
export const Standard: Story = {};
|
|
38
|
+
|
|
39
|
+
export const Vertical: Story = {
|
|
40
|
+
args: {
|
|
41
|
+
orientation: 'vertical',
|
|
42
|
+
},
|
|
43
|
+
render: (args) => ({
|
|
44
|
+
components: { MDivider },
|
|
45
|
+
setup() {
|
|
46
|
+
return { args };
|
|
47
|
+
},
|
|
48
|
+
template: `
|
|
49
|
+
<div>
|
|
50
|
+
<MDivider v-bind="args">
|
|
51
|
+
<p style="padding: 1rem">Vertical Divider</p>
|
|
52
|
+
</MDivider>
|
|
53
|
+
</div>
|
|
54
|
+
`,
|
|
55
|
+
}),
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const Size: Story = {
|
|
59
|
+
args: { size: 'm' },
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const Secondary: Story = {
|
|
63
|
+
args: { style: 'secondary' },
|
|
64
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="mc-divider">
|
|
3
|
+
<div :class="classObject"></div>
|
|
4
|
+
<slot />
|
|
5
|
+
</div>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script setup lang="ts">
|
|
9
|
+
import { computed } from 'vue';
|
|
10
|
+
/**
|
|
11
|
+
* A Divider serves as a visual divider to separate content, providing a clear distinction between sections.
|
|
12
|
+
*/
|
|
13
|
+
const props = withDefaults(
|
|
14
|
+
defineProps<{
|
|
15
|
+
/**
|
|
16
|
+
* Determines the orientation of the divider
|
|
17
|
+
*/
|
|
18
|
+
orientation?: 'vertical' | 'horizontal';
|
|
19
|
+
/**
|
|
20
|
+
* Determines the style of the divider
|
|
21
|
+
*/
|
|
22
|
+
style?: 'primary' | 'secondary' | 'tertiary' | 'inverse';
|
|
23
|
+
/**
|
|
24
|
+
* Determines the size of the divider
|
|
25
|
+
*/
|
|
26
|
+
size?: 's' | 'm' | 'l';
|
|
27
|
+
}>(),
|
|
28
|
+
{
|
|
29
|
+
orientation: 'horizontal',
|
|
30
|
+
style: 'primary',
|
|
31
|
+
size: 's',
|
|
32
|
+
},
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const classObject = computed(() => {
|
|
36
|
+
return {
|
|
37
|
+
[`mc-divider-${props.orientation}`]: props.orientation,
|
|
38
|
+
[`mc-divider-horizontal--${props.style}`]:
|
|
39
|
+
props.style && props.style != 'primary',
|
|
40
|
+
[`mc-divider-horizontal--${props.size}`]: props.size && props.size != 's',
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<style lang="scss" scoped>
|
|
46
|
+
@use '@mozaic-ds/styles/components/divider';
|
|
47
|
+
|
|
48
|
+
.mc-divider-vertical {
|
|
49
|
+
content: '';
|
|
50
|
+
display: block;
|
|
51
|
+
height: 100%;
|
|
52
|
+
position: absolute;
|
|
53
|
+
top: 50%;
|
|
54
|
+
transform: translateY(-50%);
|
|
55
|
+
}
|
|
56
|
+
</style>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { mount } from '@vue/test-utils';
|
|
3
|
+
import MDrawer from '@/components/drawer/MDrawer.vue';
|
|
4
|
+
|
|
5
|
+
describe('MDrawer component', () => {
|
|
6
|
+
it('renders title and contentTitle when provided', () => {
|
|
7
|
+
const wrapper = mount(MDrawer, {
|
|
8
|
+
props: {
|
|
9
|
+
open: true,
|
|
10
|
+
title: 'Main Drawer Title',
|
|
11
|
+
contentTitle: 'Drawer Content Title',
|
|
12
|
+
},
|
|
13
|
+
slots: {
|
|
14
|
+
default: '<p>Drawer content</p>',
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
expect(wrapper.find('.mc-drawer__title').text()).toBe('Main Drawer Title');
|
|
19
|
+
expect(wrapper.find('.mc-drawer__content__title').text()).toBe(
|
|
20
|
+
'Drawer Content Title',
|
|
21
|
+
);
|
|
22
|
+
expect(wrapper.find('.mc-drawer__content').text()).toContain(
|
|
23
|
+
'Drawer content',
|
|
24
|
+
);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('emits update:open false when close button is clicked', async () => {
|
|
28
|
+
const wrapper = mount(MDrawer, {
|
|
29
|
+
props: {
|
|
30
|
+
open: true,
|
|
31
|
+
title: 'Test Title',
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const closeButton = wrapper.find('.mc-drawer__close');
|
|
36
|
+
await closeButton.trigger('click');
|
|
37
|
+
|
|
38
|
+
expect(wrapper.emitted('update:open')).toBeTruthy();
|
|
39
|
+
expect(wrapper.emitted('update:open')![0]).toEqual([false]);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('emits back event when back button is clicked', async () => {
|
|
43
|
+
const wrapper = mount(MDrawer, {
|
|
44
|
+
props: {
|
|
45
|
+
open: true,
|
|
46
|
+
title: 'Test Title',
|
|
47
|
+
back: true,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const backButton = wrapper.find('.mc-drawer__back');
|
|
52
|
+
await backButton.trigger('click');
|
|
53
|
+
|
|
54
|
+
expect(wrapper.emitted('back')).toBeTruthy();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('renders footer slot when provided', () => {
|
|
58
|
+
const wrapper = mount(MDrawer, {
|
|
59
|
+
props: {
|
|
60
|
+
open: true,
|
|
61
|
+
title: 'Test Title',
|
|
62
|
+
},
|
|
63
|
+
slots: {
|
|
64
|
+
footer: '<button>Footer Button</button>',
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
expect(wrapper.find('.mc-drawer__footer').exists()).toBe(true);
|
|
69
|
+
expect(wrapper.find('.mc-drawer__footer button').text()).toBe(
|
|
70
|
+
'Footer Button',
|
|
71
|
+
);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('applies correct class when extended and position is left', () => {
|
|
75
|
+
const wrapper = mount(MDrawer, {
|
|
76
|
+
props: {
|
|
77
|
+
open: true,
|
|
78
|
+
title: 'Test Title',
|
|
79
|
+
extended: true,
|
|
80
|
+
position: 'left',
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const section = wrapper.find('section.mc-drawer');
|
|
85
|
+
expect(section.classes()).toContain('mc-drawer--extend');
|
|
86
|
+
expect(section.classes()).toContain('mc-drawer--left');
|
|
87
|
+
expect(section.classes()).toContain('is-open');
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('does not render back button if prop `back` is false', () => {
|
|
91
|
+
const wrapper = mount(MDrawer, {
|
|
92
|
+
props: {
|
|
93
|
+
open: true,
|
|
94
|
+
title: 'Test Title',
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
expect(wrapper.find('.mc-drawer__back').exists()).toBe(false);
|
|
99
|
+
});
|
|
100
|
+
});
|