@mozaic-ds/vue 1.0.0-beta.8 → 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 +410 -198
- package/dist/mozaic-vue.js +1100 -777
- 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.stories.ts +2 -2
- package/src/components/divider/MDivider.vue +2 -2
- 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.stories.ts +3 -3
- package/src/components/pagination/MPagination.vue +5 -3
- 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 +4 -4
- package/src/components/tabs/MTabs.vue +2 -2
- package/src/components/tabs/Mtabs.spec.ts +56 -61
- package/src/components/tag/MTag.stories.ts +2 -2
- package/src/components/tag/MTag.vue +1 -4
- 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 +4 -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
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3';
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
2
2
|
import MDivider from './MDivider.vue';
|
|
3
3
|
|
|
4
4
|
const meta: Meta<typeof MDivider> = {
|
|
@@ -38,7 +38,7 @@ export const Standard: Story = {};
|
|
|
38
38
|
|
|
39
39
|
export const Vertical: Story = {
|
|
40
40
|
args: {
|
|
41
|
-
orientation: 'vertical'
|
|
41
|
+
orientation: 'vertical',
|
|
42
42
|
},
|
|
43
43
|
render: (args) => ({
|
|
44
44
|
components: { MDivider },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="mc-divider">
|
|
3
3
|
<div :class="classObject"></div>
|
|
4
|
-
<slot/>
|
|
4
|
+
<slot />
|
|
5
5
|
</div>
|
|
6
6
|
</template>
|
|
7
7
|
|
|
@@ -46,7 +46,7 @@ const classObject = computed(() => {
|
|
|
46
46
|
@use '@mozaic-ds/styles/components/divider';
|
|
47
47
|
|
|
48
48
|
.mc-divider-vertical {
|
|
49
|
-
content:
|
|
49
|
+
content: '';
|
|
50
50
|
display: block;
|
|
51
51
|
height: 100%;
|
|
52
52
|
position: absolute;
|
|
@@ -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
|
+
});
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
2
|
+
import { action } from 'storybook/actions';
|
|
3
|
+
import MDrawer from './MDrawer.vue';
|
|
4
|
+
import MButton from '../button/MButton.vue';
|
|
5
|
+
import { ref, watch } from 'vue';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof MDrawer> = {
|
|
8
|
+
title: 'Overlay/Drawer',
|
|
9
|
+
component: MDrawer,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: 'fullscreen',
|
|
12
|
+
docs: {
|
|
13
|
+
story: { height: '600px' },
|
|
14
|
+
description: {
|
|
15
|
+
component:
|
|
16
|
+
'A drawer is a sliding panel that appears from the side of the screen, providing additional content, settings, or actions without disrupting the main view. It is often used for filtering options, or contextual details. It enhances usability by keeping interfaces clean while offering expandable functionality.',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
args: {
|
|
21
|
+
open: true,
|
|
22
|
+
title: 'Drawer title (optionnal)',
|
|
23
|
+
contentTitle: 'Content title',
|
|
24
|
+
default: `
|
|
25
|
+
<p>
|
|
26
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod itaque
|
|
27
|
+
odit, eligendi non, minus soluta dicta, excepturi harum tempora
|
|
28
|
+
possimus dignissimos dolor rerum natus voluptatum quia. Architecto
|
|
29
|
+
temporibus repellendus sed.
|
|
30
|
+
</p>
|
|
31
|
+
<p>
|
|
32
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod itaque
|
|
33
|
+
odit, eligendi non, minus soluta dicta, excepturi harum tempora
|
|
34
|
+
possimus dignissimos dolor rerum natus voluptatum quia. Architecto
|
|
35
|
+
temporibus repellendus sed.
|
|
36
|
+
</p>
|
|
37
|
+
`,
|
|
38
|
+
footer: `
|
|
39
|
+
<MButton>Button label</MButton>
|
|
40
|
+
<MButton ghost>Button label</MButton>
|
|
41
|
+
`,
|
|
42
|
+
},
|
|
43
|
+
render: (args) => ({
|
|
44
|
+
components: { MDrawer, MButton },
|
|
45
|
+
setup() {
|
|
46
|
+
const handleUpdate = action('update:open');
|
|
47
|
+
const openState = ref(args.open);
|
|
48
|
+
|
|
49
|
+
watch(
|
|
50
|
+
() => args.open,
|
|
51
|
+
(val) => {
|
|
52
|
+
openState.value = val;
|
|
53
|
+
},
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const onUpdateOpen = (val: boolean) => {
|
|
57
|
+
openState.value = val;
|
|
58
|
+
handleUpdate(val);
|
|
59
|
+
args.open = val;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
return { args, openState, onUpdateOpen };
|
|
63
|
+
},
|
|
64
|
+
template: `
|
|
65
|
+
<MDrawer
|
|
66
|
+
v-bind="args"
|
|
67
|
+
@update:open="onUpdateOpen"
|
|
68
|
+
v-model:open="openState"
|
|
69
|
+
>
|
|
70
|
+
<template v-if="${'default' in args}" v-slot>${args.default}</template>
|
|
71
|
+
<template v-if="${'footer' in args}" v-slot:footer>${args.footer}</template>
|
|
72
|
+
</MDrawer>
|
|
73
|
+
`,
|
|
74
|
+
}),
|
|
75
|
+
};
|
|
76
|
+
export default meta;
|
|
77
|
+
type Story = StoryObj<typeof MDrawer>;
|
|
78
|
+
|
|
79
|
+
export const Default: Story = {
|
|
80
|
+
args: {
|
|
81
|
+
default: `
|
|
82
|
+
<!-- All the code below must be replaced by a form element. -->
|
|
83
|
+
<div class="content-slot content-slot-full">
|
|
84
|
+
Insert a form element here to replace this slot.
|
|
85
|
+
</div>
|
|
86
|
+
`,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const Left = {
|
|
91
|
+
args: {
|
|
92
|
+
position: 'left',
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export const Back = {
|
|
97
|
+
args: {
|
|
98
|
+
back: true,
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export const ValidationOnly = {
|
|
103
|
+
args: {
|
|
104
|
+
footer: `
|
|
105
|
+
<MButton>Button label</MButton>
|
|
106
|
+
`,
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export const TwoOptions = {
|
|
111
|
+
args: {
|
|
112
|
+
footer: `
|
|
113
|
+
<MButton>Button label</MButton>
|
|
114
|
+
<MButton outlined>Button label</MButton>
|
|
115
|
+
`,
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export const Cancel = {
|
|
120
|
+
args: {
|
|
121
|
+
extended: true,
|
|
122
|
+
footer: `
|
|
123
|
+
<MButton>Button label</MButton>
|
|
124
|
+
<MButton outlined>Button label</MButton>
|
|
125
|
+
<MButton ghost>Button label</MButton>
|
|
126
|
+
`,
|
|
127
|
+
},
|
|
128
|
+
};
|