@mozaic-ds/vue 2.6.1 → 2.8.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/README.md +3 -3
- package/dist/mozaic-vue.css +1 -1
- package/dist/mozaic-vue.d.ts +211 -101
- package/dist/mozaic-vue.js +3034 -1070
- package/dist/mozaic-vue.js.map +1 -1
- package/dist/mozaic-vue.umd.cjs +5 -1
- package/dist/mozaic-vue.umd.cjs.map +1 -1
- package/package.json +10 -7
- package/src/components/Contributing.mdx +1 -1
- package/src/components/GettingStarted.mdx +1 -1
- package/src/components/Introduction.mdx +1 -1
- package/src/components/Support.mdx +1 -1
- package/src/components/avatar/MAvatar.stories.ts +1 -0
- package/src/components/avatar/README.md +16 -0
- package/src/components/breadcrumb/README.md +11 -0
- package/src/components/button/MButton.stories.ts +1 -2
- package/src/components/button/MButton.vue +6 -1
- package/src/components/button/README.md +24 -0
- package/src/components/callout/MCallout.stories.ts +1 -0
- package/src/components/callout/README.md +19 -0
- package/src/components/checkbox/README.md +23 -0
- package/src/components/checkboxgroup/README.md +20 -0
- package/src/components/circularprogressbar/MCircularProgressbar.stories.ts +1 -0
- package/src/components/circularprogressbar/README.md +14 -0
- package/src/components/container/MContainer.stories.ts +8 -0
- package/src/components/container/MContainer.vue +1 -1
- package/src/components/container/README.md +16 -0
- package/src/components/datepicker/MDatepicker.stories.ts +1 -0
- package/src/components/datepicker/README.md +24 -0
- package/src/components/divider/MDivider.stories.ts +1 -0
- package/src/components/divider/README.md +18 -0
- package/src/components/drawer/MDrawer.spec.ts +95 -0
- package/src/components/drawer/MDrawer.stories.ts +1 -0
- package/src/components/drawer/MDrawer.vue +34 -3
- package/src/components/drawer/README.md +30 -0
- package/src/components/field/MField.vue +1 -1
- package/src/components/field/README.md +24 -0
- package/src/components/fieldgroup/README.md +22 -0
- package/src/components/flag/README.md +11 -0
- package/src/components/iconbutton/MIconButton.stories.ts +1 -0
- package/src/components/iconbutton/MIconButton.vue +6 -1
- package/src/components/iconbutton/README.md +21 -0
- package/src/components/linearprogressbarbuffer/MLinearProgressbarBuffer.stories.ts +1 -0
- package/src/components/linearprogressbarbuffer/README.md +11 -0
- package/src/components/linearprogressbarpercentage/MLinearProgressbarPercentage.stories.ts +1 -0
- package/src/components/linearprogressbarpercentage/README.md +10 -0
- package/src/components/link/MLink.vue +0 -2
- package/src/components/link/README.md +23 -0
- package/src/components/loader/MLoader.vue +1 -1
- package/src/components/loader/README.md +12 -0
- package/src/components/loadingoverlay/MLoadingOverlay.stories.ts +1 -1
- package/src/components/loadingoverlay/README.md +11 -0
- package/src/components/modal/MModal.spec.ts +36 -1
- package/src/components/modal/MModal.vue +11 -1
- package/src/components/modal/README.md +29 -0
- package/src/components/numberbadge/README.md +12 -0
- package/src/components/overlay/README.md +17 -0
- package/src/components/pagination/README.md +20 -0
- package/src/components/passwordinput/README.md +25 -0
- package/src/components/phonenumber/MPhoneNumber.spec.ts +294 -0
- package/src/components/phonenumber/MPhoneNumber.stories.ts +88 -0
- package/src/components/phonenumber/MPhoneNumber.vue +271 -0
- package/src/components/phonenumber/README.md +26 -0
- package/src/components/pincode/MPincode.spec.ts +4 -1
- package/src/components/pincode/MPincode.stories.ts +1 -0
- package/src/components/pincode/MPincode.vue +5 -1
- package/src/components/pincode/README.md +22 -0
- package/src/components/quantityselector/MQuantitySelector.stories.ts +0 -7
- package/src/components/quantityselector/README.md +27 -0
- package/src/components/radio/README.md +21 -0
- package/src/components/radiogroup/README.md +21 -0
- package/src/components/segmentedcontrol/MSegmentedControl.spec.ts +116 -0
- package/src/components/segmentedcontrol/MSegmentedControl.stories.ts +78 -0
- package/src/components/segmentedcontrol/MSegmentedControl.vue +92 -0
- package/src/components/segmentedcontrol/README.md +19 -0
- package/src/components/select/README.md +24 -0
- package/src/components/statusbadge/README.md +11 -0
- package/src/components/statusdot/MStatusDot.stories.ts +1 -0
- package/src/components/statusdot/README.md +11 -0
- package/src/components/statusnotification/README.md +25 -0
- package/src/components/tabs/MTabs.stories.ts +23 -1
- package/src/components/tabs/MTabs.vue +8 -0
- package/src/components/tabs/Mtabs.spec.ts +29 -8
- package/src/components/tabs/README.md +20 -0
- package/src/components/tag/README.md +25 -0
- package/src/components/textarea/README.md +25 -0
- package/src/components/textinput/README.md +32 -0
- package/src/components/toaster/MToaster.stories.ts +1 -0
- package/src/components/toaster/README.md +28 -0
- package/src/components/toggle/README.md +21 -0
- package/src/components/togglegroup/MToggleGroup.vue +1 -3
- package/src/components/togglegroup/README.md +20 -0
- package/src/components/tooltip/README.md +19 -0
- package/src/components/usingIcons.mdx +1 -1
- package/src/components/usingPresets.mdx +1 -1
- package/src/main.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mozaic-ds/vue",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
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",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"test:unit": "vitest",
|
|
23
23
|
"format": "prettier --write src/",
|
|
24
24
|
"build": "vite build",
|
|
25
|
+
"readme": "node generate-readmes.js ",
|
|
25
26
|
"storybook": "storybook dev -p 6006",
|
|
26
27
|
"storybook:build": "npm run build-storybook",
|
|
27
28
|
"storybook:deploy": "storybook-to-ghpages",
|
|
@@ -40,14 +41,14 @@
|
|
|
40
41
|
"*.d.ts"
|
|
41
42
|
],
|
|
42
43
|
"dependencies": {
|
|
43
|
-
"@mozaic-ds/styles": "2.0.
|
|
44
|
+
"@mozaic-ds/styles": "^2.0.1",
|
|
44
45
|
"@mozaic-ds/web-fonts": "1.65.0",
|
|
45
46
|
"postcss-scss": "^4.0.9",
|
|
46
47
|
"vue": "^3.5.13"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
|
-
"@commitlint/cli": "^
|
|
50
|
-
"@commitlint/config-conventional": "^
|
|
50
|
+
"@commitlint/cli": "^20.1.0",
|
|
51
|
+
"@commitlint/config-conventional": "^20.0.0",
|
|
51
52
|
"@mozaic-ds/css-dev-tools": "1.75.0",
|
|
52
53
|
"@mozaic-ds/icons-vue": "^1.0.0",
|
|
53
54
|
"@release-it/conventional-changelog": "^10.0.1",
|
|
@@ -55,14 +56,13 @@
|
|
|
55
56
|
"@storybook/addon-docs": "^9.0.18",
|
|
56
57
|
"@storybook/addon-themes": "^9.0.18",
|
|
57
58
|
"@storybook/vue3-vite": "^9.0.18",
|
|
58
|
-
"@types/jsdom": "^
|
|
59
|
+
"@types/jsdom": "^27.0.0",
|
|
59
60
|
"@vitejs/plugin-vue": "^6.0.1",
|
|
60
61
|
"@vitest/coverage-v8": "^3.0.9",
|
|
61
62
|
"@vitest/eslint-plugin": "^1.1.38",
|
|
62
63
|
"@vue/eslint-config-prettier": "^10.2.0",
|
|
63
64
|
"@vue/eslint-config-typescript": "^14.5.0",
|
|
64
65
|
"@vue/test-utils": "^2.4.6",
|
|
65
|
-
"all-contributors-cli": "^6.26.1",
|
|
66
66
|
"eslint": "^9.22.0",
|
|
67
67
|
"eslint-plugin-vue": "^10.0.0",
|
|
68
68
|
"eslint-plugin-vuejs-accessibility": "^2.4.1",
|
|
@@ -76,11 +76,14 @@
|
|
|
76
76
|
"release-it": "^19.0.4",
|
|
77
77
|
"sass": "^1.86.0",
|
|
78
78
|
"storybook": "^9.0.18",
|
|
79
|
+
"storybook-addon-tag-badges": "^2.0.2",
|
|
79
80
|
"typescript": "^5.7.2",
|
|
80
81
|
"vite": "^7.1.1",
|
|
81
82
|
"vite-plugin-dts": "^4.5.3",
|
|
82
83
|
"vitest": "^3.0.9",
|
|
83
|
-
"vue-
|
|
84
|
+
"vue-component-meta": "^3.0.8",
|
|
85
|
+
"vue-eslint-parser": "^10.1.1",
|
|
86
|
+
"libphonenumber-js": "^1.12.23"
|
|
84
87
|
},
|
|
85
88
|
"bugs": {
|
|
86
89
|
"url": "https://github.com/adeo/mozaic-vue/issues"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# MAvatar
|
|
2
|
+
|
|
3
|
+
An avatar is a graphical representation of a user, entity, or group, commonly displayed as an image, initials, or an icon. It helps identify individuals or accounts in profiles, comments, chat interfaces, and user lists. Avatars can be customized with different styles, sizes, and fallback options (such as initials or placeholders) to ensure consistency and recognition across interfaces. When multiple users are represented, Avatar groups provide a compact way to display them collectively.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Props
|
|
7
|
+
|
|
8
|
+
| Name | Description | Type | Default |
|
|
9
|
+
| --- | --- | --- | --- |
|
|
10
|
+
| `size` | Allows to define the avatar size. | `"s"` `"m"` `"l"` | `"s"` |
|
|
11
|
+
|
|
12
|
+
## Slots
|
|
13
|
+
|
|
14
|
+
| Name | Description |
|
|
15
|
+
| --- | --- |
|
|
16
|
+
| `default` | Use this slot to insert the image, icon or intials of the avatar. |
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# MBreadcrumb
|
|
2
|
+
|
|
3
|
+
A breadcrumb is a navigation help that displays the hierarchical path of the current page within a website or application. It helps users understand their location and allows them to navigate back to previous levels easily. Breadcrumbs improve usability and accessibility, especially in multi-level websites, dashboards, and e-commerce platforms.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Props
|
|
7
|
+
|
|
8
|
+
| Name | Description | Type | Default |
|
|
9
|
+
| --- | --- | --- | --- |
|
|
10
|
+
| `appearance` | Allows to define the breadcrumb appearance. | `"standard"` `"inverse"` | - |
|
|
11
|
+
| `links*` | Links of the breadcrumb. | `{ label: string; href: string; router?: boolean` `undefined; }[]` | - |
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
2
2
|
|
|
3
3
|
import MButton from './MButton.vue';
|
|
4
|
-
import Download24 from '@mozaic-ds/icons-vue/src/components/Download24/Download24.vue';
|
|
5
4
|
import ChevronRight24 from '@mozaic-ds/icons-vue/src/components/ChevronRight24/ChevronRight24.vue';
|
|
6
5
|
|
|
7
6
|
const meta: Meta<typeof MButton> = {
|
|
@@ -17,7 +16,7 @@ const meta: Meta<typeof MButton> = {
|
|
|
17
16
|
},
|
|
18
17
|
args: { default: 'Button Label' },
|
|
19
18
|
render: (args) => ({
|
|
20
|
-
components: { MButton,
|
|
19
|
+
components: { MButton, ChevronRight24 },
|
|
21
20
|
setup() {
|
|
22
21
|
return { args };
|
|
23
22
|
},
|
|
@@ -91,7 +91,7 @@ defineSlots<{
|
|
|
91
91
|
*/
|
|
92
92
|
default: string;
|
|
93
93
|
/**
|
|
94
|
-
* Use this slot to insert an icon for the Button
|
|
94
|
+
* Use this slot to insert an icon for the Button.
|
|
95
95
|
*/
|
|
96
96
|
icon?: VNode;
|
|
97
97
|
}>();
|
|
@@ -110,4 +110,9 @@ const classObject = computed(() => {
|
|
|
110
110
|
|
|
111
111
|
<style lang="scss" scoped>
|
|
112
112
|
@use '@mozaic-ds/styles/components/button';
|
|
113
|
+
|
|
114
|
+
.mc-button__icon::v-deep(svg) {
|
|
115
|
+
width: 100%;
|
|
116
|
+
height: 100%;
|
|
117
|
+
}
|
|
113
118
|
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# MButton
|
|
2
|
+
|
|
3
|
+
Buttons are key interactive elements used to perform actions and can be used as standalone element, or as part of another component. Their appearance depends on the type of action required from the user and the context in which they are used.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Props
|
|
7
|
+
|
|
8
|
+
| Name | Description | Type | Default |
|
|
9
|
+
| --- | --- | --- | --- |
|
|
10
|
+
| `appearance` | Defines the visual style of the button. | `"standard"` `"inverse"` `"accent"` `"danger"` | `"standard"` |
|
|
11
|
+
| `size` | Determines the size of the button. | `"s"` `"m"` `"l"` | `"m"` |
|
|
12
|
+
| `disabled` | If `true`, disables the button, making it non-interactive. | `boolean` | - |
|
|
13
|
+
| `ghost` | If `true`, applies a "ghost" style to the button, typically a transparent background with a border. | `boolean` | - |
|
|
14
|
+
| `outlined` | If `true`, the button gets an outlined style, usually with just the border and no solid background. | `boolean` | - |
|
|
15
|
+
| `iconPosition` | Controls the positioning of an icon in the button. | `"left"` `"right"` `"only"` | - |
|
|
16
|
+
| `type` | Specifies the button's HTML `type` attribute. | `"button"` `"reset"` `"submit"` | `"button"` |
|
|
17
|
+
| `isLoading` | If `true`, a loading state is displayed. | `boolean` | - |
|
|
18
|
+
|
|
19
|
+
## Slots
|
|
20
|
+
|
|
21
|
+
| Name | Description |
|
|
22
|
+
| --- | --- |
|
|
23
|
+
| `default` | The content displayed in the button. |
|
|
24
|
+
| `icon` | Use this slot to insert an icon for the Button. |
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# MCallout
|
|
2
|
+
|
|
3
|
+
A callout is used to highlight additional information that can assist users with tips, extra details, or helpful guidance, without signaling a critical status or alert. Unlike notifications, callouts are not triggered by user actions and do not correspond to specific system states. They are designed to enhance the user experience by providing contextually relevant information that supports comprehension and usability.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Props
|
|
7
|
+
|
|
8
|
+
| Name | Description | Type | Default |
|
|
9
|
+
| --- | --- | --- | --- |
|
|
10
|
+
| `title*` | Title of the callout. | `string` | - |
|
|
11
|
+
| `description*` | Description of the callout. | `string` | - |
|
|
12
|
+
| `appearance` | Allows to define the callout appearance. | `"standard"` `"inverse"` `"accent"` `"tips"` | `"standard"` |
|
|
13
|
+
|
|
14
|
+
## Slots
|
|
15
|
+
|
|
16
|
+
| Name | Description |
|
|
17
|
+
| --- | --- |
|
|
18
|
+
| `icon` | Use this slot to insert an icon. |
|
|
19
|
+
| `footer` | Use this slot to insert a button or a link in the footer of the callout. |
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# MCheckbox
|
|
2
|
+
|
|
3
|
+
A checkbox is an interactive component used to select or deselect an option, typically within a list of choices. It allows users to make multiple selections independently and is often accompanied by a label for clarity. Checkboxes are commonly used in forms, filters, settings, and preference selections to provide a simple and intuitive way to enable or disable specific options.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Props
|
|
7
|
+
|
|
8
|
+
| Name | Description | Type | Default |
|
|
9
|
+
| --- | --- | --- | --- |
|
|
10
|
+
| `id*` | A unique identifier for the checkbox, used to associate the label with the form element. | `string` | - |
|
|
11
|
+
| `name` | The name attribute for the checkbox element, typically used for form submission. | `string` | - |
|
|
12
|
+
| `label` | The text label displayed next to the checkbox. | `string` | - |
|
|
13
|
+
| `modelValue` | The checkbox's checked state, bound via v-model. | `boolean` | - |
|
|
14
|
+
| `indeterminate` | Sets the checkbox to an indeterminate state (partially selected). | `boolean` | - |
|
|
15
|
+
| `isInvalid` | If `true`, applies an invalid state to the checkbox. | `boolean` | - |
|
|
16
|
+
| `disabled` | If `true`, disables the checkbox, making it non-interactive. | `boolean` | - |
|
|
17
|
+
| `indented` | If `true`, indent the checkbox. | `boolean` | - |
|
|
18
|
+
|
|
19
|
+
## Events
|
|
20
|
+
|
|
21
|
+
| Name | Description | Type |
|
|
22
|
+
| --- | --- | --- |
|
|
23
|
+
| `update:modelValue` | Emits when the checkbox value changes, updating the modelValue prop. | [value: boolean] |
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# MCheckboxGroup
|
|
2
|
+
|
|
3
|
+
A checkbox is an interactive component used to select or deselect an option, typically within a list of choices. It allows users to make multiple selections independently and is often accompanied by a label for clarity. Checkboxes are commonly used in forms, filters, settings, and preference selections to provide a simple and intuitive way to enable or disable specific options. <br><br> To put a label, requierement text, help text or to apply a valid or invalid message, the examples are available in the [Field section](/docs/form-elements-field--docs#input).
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Props
|
|
7
|
+
|
|
8
|
+
| Name | Description | Type | Default |
|
|
9
|
+
| --- | --- | --- | --- |
|
|
10
|
+
| `name*` | The name attribute for the checkbox element, typically used for form submission. | `string` | - |
|
|
11
|
+
| `modelValue` | Property used to manage the values checked by v-model
|
|
12
|
+
(Do not use directly) | `string[]` | - |
|
|
13
|
+
| `options*` | list of properties of each checkbox button of the checkbox group | `{ id: string; label: string; value: string; disabled?: boolean` `undefined; isInvalid?: boolean` `undefined; indented?: boolean` `undefined; }[]` | - |
|
|
14
|
+
| `inline` | If `true`, make the form element of the group inline. | `boolean` | - |
|
|
15
|
+
|
|
16
|
+
## Events
|
|
17
|
+
|
|
18
|
+
| Name | Description | Type |
|
|
19
|
+
| --- | --- | --- |
|
|
20
|
+
| `update:modelValue` | Emits when the checkbox group value changes, updating the modelValue prop. | [value: Array<string>] |
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# MCircularProgressbar
|
|
2
|
+
|
|
3
|
+
A circular progress bar visually represents progress toward a goal or completion of a process using a circular shape. It is commonly used to indicate task completion or performance metrics. The progress is displayed as a partially filled ring, often accompanied by a percentage or status indicator. Circular Progress Bars are useful for providing users with real-time feedback on ongoing actions without taking up significant screen space.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Props
|
|
7
|
+
|
|
8
|
+
| Name | Description | Type | Default |
|
|
9
|
+
| --- | --- | --- | --- |
|
|
10
|
+
| `size` | Sets the size of the progress bar. | `"s"` `"m"` `"l"` | - |
|
|
11
|
+
| `value` | The current value of the progress bar. | `number` | `0` |
|
|
12
|
+
| `type` | Shows either a percentage or custom content. | `"percentage"` `"content"` | `"percentage"` |
|
|
13
|
+
| `contentValue` | Main content shown when `type` is `'content'`. | `string` | - |
|
|
14
|
+
| `additionalInfo` | Additional text shown to define the `contentValue`. | `string` | - |
|
|
@@ -4,6 +4,14 @@ import MContainer from './MContainer.vue';
|
|
|
4
4
|
const meta: Meta<typeof MContainer> = {
|
|
5
5
|
title: 'Foundations/Container',
|
|
6
6
|
component: MContainer,
|
|
7
|
+
parameters: {
|
|
8
|
+
docs: {
|
|
9
|
+
description: {
|
|
10
|
+
component:
|
|
11
|
+
'The Container component is designed to wrap your page or section content, typically grids or other layout elements. By default, it centers the content with a maximum width to ensure consistent alignment and spacing.',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
7
15
|
args: {
|
|
8
16
|
default: `<h1>Container</h1>`,
|
|
9
17
|
},
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
8
|
import { computed, type VNode } from 'vue';
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* The Container component is designed to wrap your page or section content, typically grids or other layout elements. By default, it centers the content with a maximum width to ensure consistent alignment and spacing.
|
|
11
11
|
*/
|
|
12
12
|
const props = defineProps<{
|
|
13
13
|
/**
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# MContainer
|
|
2
|
+
|
|
3
|
+
The Container component is designed to wrap your page or section content, typically grids or other layout elements. By default, it centers the content with a maximum width to ensure consistent alignment and spacing.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Props
|
|
7
|
+
|
|
8
|
+
| Name | Description | Type | Default |
|
|
9
|
+
| --- | --- | --- | --- |
|
|
10
|
+
| `fluid` | If `true`, the container will take the full width. | `boolean` | - |
|
|
11
|
+
|
|
12
|
+
## Slots
|
|
13
|
+
|
|
14
|
+
| Name | Description |
|
|
15
|
+
| --- | --- |
|
|
16
|
+
| `default` | Use this slot to insert the content of the container. |
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# MDatepicker
|
|
2
|
+
|
|
3
|
+
A date picker is an input component that allows users to select a date from a calendar interface or manually enter a date value. It enhances usability by providing structured date selection, reducing input errors, and ensuring format consistency. Date Pickers are commonly used in forms, booking systems, scheduling tools, and data filtering interfaces to facilitate accurate date entry.<br><br> To put a label, requierement text, help text or to apply a valid or invalid message, the examples are available in the [Field section](/docs/form-elements-field--docs#input).
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Props
|
|
7
|
+
|
|
8
|
+
| Name | Description | Type | Default |
|
|
9
|
+
| --- | --- | --- | --- |
|
|
10
|
+
| `id*` | A unique identifier for the datepicker element, used to associate the label with the form element. | `string` | - |
|
|
11
|
+
| `name` | The name attribute for the datepicker element, typically used for form submission. | `string` | - |
|
|
12
|
+
| `modelValue` | The current value of the datepicker field. | `string` `number` | - |
|
|
13
|
+
| `isInvalid` | If `true`, applies an invalid state to the datepicker. | `boolean` | - |
|
|
14
|
+
| `disabled` | If `true`, disables the datepicker, making it non-interactive. | `boolean` | - |
|
|
15
|
+
| `size` | Determines the size of the datepicker. | `"s"` `"m"` | `"m"` |
|
|
16
|
+
| `readonly` | If `true`, the datepicker is read-only (cannot be edited). | `boolean` | - |
|
|
17
|
+
| `isClearable` | If `true`, a clear button will appear when the datepicker has a value. | `boolean` | - |
|
|
18
|
+
| `clearLabel` | The label text for the clear button. | `string` | `"clear content"` |
|
|
19
|
+
|
|
20
|
+
## Events
|
|
21
|
+
|
|
22
|
+
| Name | Description | Type |
|
|
23
|
+
| --- | --- | --- |
|
|
24
|
+
| `update:modelValue` | Emits when the datepicker value changes, updating the `modelValue` prop. | [value: string | number] |
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# MDivider
|
|
2
|
+
|
|
3
|
+
A divider is a visual element used to separate content or sections within an interface. It helps improve readability and organization by creating clear distinctions between groups of information. Dividers can be thin lines, thick separators, or even styled with spacing variations, adapting to different layouts. They are commonly used in menus, lists, forms, and content blocks to create a structured visual hierarchy.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Props
|
|
7
|
+
|
|
8
|
+
| Name | Description | Type | Default |
|
|
9
|
+
| --- | --- | --- | --- |
|
|
10
|
+
| `orientation` | Determines the orientation of the divider. | `"horizontal"` `"vertical"` | `"horizontal"` |
|
|
11
|
+
| `appearance` | Determines the appearance of the divider. | `"inverse"` `"primary"` `"secondary"` `"tertiary"` | `"primary"` |
|
|
12
|
+
| `size` | Determines the size of the divider. | `"s"` `"m"` `"l"` | `"s"` |
|
|
13
|
+
|
|
14
|
+
## Slots
|
|
15
|
+
|
|
16
|
+
| Name | Description |
|
|
17
|
+
| --- | --- |
|
|
18
|
+
| `default` | Use this slot to insert the content who need a vertical divider |
|
|
@@ -2,6 +2,19 @@ import { describe, it, expect } from 'vitest';
|
|
|
2
2
|
import { mount } from '@vue/test-utils';
|
|
3
3
|
import MDrawer from '@/components/drawer/MDrawer.vue';
|
|
4
4
|
|
|
5
|
+
// Stubs for child components
|
|
6
|
+
const stubs = {
|
|
7
|
+
ArrowBack24: { template: '<svg />' },
|
|
8
|
+
Cross24: { template: '<svg />' },
|
|
9
|
+
MIconButton: {
|
|
10
|
+
template: `<button @click="$emit('click')"><slot name="icon"/></button>`,
|
|
11
|
+
},
|
|
12
|
+
MOverlay: {
|
|
13
|
+
name: 'MOverlay',
|
|
14
|
+
template: `<div class="overlay" @click="$emit('click')"><slot/></div>`,
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
5
18
|
describe('MDrawer component', () => {
|
|
6
19
|
it('renders title and contentTitle when provided', () => {
|
|
7
20
|
const wrapper = mount(MDrawer, {
|
|
@@ -13,6 +26,7 @@ describe('MDrawer component', () => {
|
|
|
13
26
|
slots: {
|
|
14
27
|
default: '<p>Drawer content</p>',
|
|
15
28
|
},
|
|
29
|
+
global: { stubs },
|
|
16
30
|
});
|
|
17
31
|
|
|
18
32
|
expect(wrapper.find('.mc-drawer__title').text()).toBe('Main Drawer Title');
|
|
@@ -30,6 +44,7 @@ describe('MDrawer component', () => {
|
|
|
30
44
|
open: true,
|
|
31
45
|
title: 'Test Title',
|
|
32
46
|
},
|
|
47
|
+
global: { stubs },
|
|
33
48
|
});
|
|
34
49
|
|
|
35
50
|
const closeButton = wrapper.find('.mc-drawer__close');
|
|
@@ -46,6 +61,7 @@ describe('MDrawer component', () => {
|
|
|
46
61
|
title: 'Test Title',
|
|
47
62
|
back: true,
|
|
48
63
|
},
|
|
64
|
+
global: { stubs },
|
|
49
65
|
});
|
|
50
66
|
|
|
51
67
|
const backButton = wrapper.find('.mc-drawer__back');
|
|
@@ -63,6 +79,7 @@ describe('MDrawer component', () => {
|
|
|
63
79
|
slots: {
|
|
64
80
|
footer: '<button>Footer Button</button>',
|
|
65
81
|
},
|
|
82
|
+
global: { stubs },
|
|
66
83
|
});
|
|
67
84
|
|
|
68
85
|
expect(wrapper.find('.mc-drawer__footer').exists()).toBe(true);
|
|
@@ -79,6 +96,7 @@ describe('MDrawer component', () => {
|
|
|
79
96
|
extended: true,
|
|
80
97
|
position: 'left',
|
|
81
98
|
},
|
|
99
|
+
global: { stubs },
|
|
82
100
|
});
|
|
83
101
|
|
|
84
102
|
const section = wrapper.find('section.mc-drawer');
|
|
@@ -93,8 +111,85 @@ describe('MDrawer component', () => {
|
|
|
93
111
|
open: true,
|
|
94
112
|
title: 'Test Title',
|
|
95
113
|
},
|
|
114
|
+
global: { stubs },
|
|
96
115
|
});
|
|
97
116
|
|
|
98
117
|
expect(wrapper.find('.mc-drawer__back').exists()).toBe(false);
|
|
99
118
|
});
|
|
119
|
+
|
|
120
|
+
it('sets the focus on the title when the drawer opens', async () => {
|
|
121
|
+
const wrapper = mount(MDrawer, {
|
|
122
|
+
props: {
|
|
123
|
+
title: 'Test Title',
|
|
124
|
+
},
|
|
125
|
+
attachTo: document.body,
|
|
126
|
+
global: { stubs },
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
const titleElement = wrapper.find('.mc-drawer__title').element;
|
|
130
|
+
expect(document.activeElement).not.toBe(titleElement);
|
|
131
|
+
await wrapper.setProps({ open: true });
|
|
132
|
+
expect(document.activeElement).toBe(titleElement);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it('does not set the focus on the title when the drawer closes', async () => {
|
|
136
|
+
const wrapper = mount(MDrawer, {
|
|
137
|
+
props: {
|
|
138
|
+
title: 'Test Title',
|
|
139
|
+
open: true,
|
|
140
|
+
},
|
|
141
|
+
attachTo: document.body,
|
|
142
|
+
global: { stubs },
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
const titleElement = wrapper.find('.mc-drawer__title').element;
|
|
146
|
+
await wrapper.setProps({ open: false });
|
|
147
|
+
expect(document.activeElement).not.toBe(titleElement);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
// ✅ New tests for closeOnOverlay behavior
|
|
151
|
+
it('emits update:open false when overlay is clicked and closeOnOverlay is true', async () => {
|
|
152
|
+
const wrapper = mount(MDrawer, {
|
|
153
|
+
props: {
|
|
154
|
+
open: true,
|
|
155
|
+
title: 'Test Title',
|
|
156
|
+
closeOnOverlay: true,
|
|
157
|
+
},
|
|
158
|
+
global: { stubs },
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
await wrapper.find('.overlay').trigger('click');
|
|
162
|
+
|
|
163
|
+
expect(wrapper.emitted('update:open')).toBeTruthy();
|
|
164
|
+
expect(wrapper.emitted('update:open')![0]).toEqual([false]);
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
it('does not emit update:open when overlay is clicked and closeOnOverlay is false', async () => {
|
|
168
|
+
const wrapper = mount(MDrawer, {
|
|
169
|
+
props: {
|
|
170
|
+
open: true,
|
|
171
|
+
title: 'Test Title',
|
|
172
|
+
closeOnOverlay: false,
|
|
173
|
+
},
|
|
174
|
+
global: { stubs },
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
await wrapper.find('.overlay').trigger('click');
|
|
178
|
+
|
|
179
|
+
expect(wrapper.emitted('update:open')).toBeFalsy();
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
it('does not emit update:open when overlay is clicked and closeOnOverlay is not set', async () => {
|
|
183
|
+
const wrapper = mount(MDrawer, {
|
|
184
|
+
props: {
|
|
185
|
+
open: true,
|
|
186
|
+
title: 'Test Title',
|
|
187
|
+
},
|
|
188
|
+
global: { stubs },
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
await wrapper.find('.overlay').trigger('click');
|
|
192
|
+
|
|
193
|
+
expect(wrapper.emitted('update:open')).toBeFalsy();
|
|
194
|
+
});
|
|
100
195
|
});
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<MOverlay
|
|
2
|
+
<MOverlay
|
|
3
|
+
:is-visible="open"
|
|
4
|
+
dialogLabel="drawerTitle"
|
|
5
|
+
@click="onClickOverlay"
|
|
6
|
+
>
|
|
3
7
|
<section
|
|
4
8
|
class="mc-drawer"
|
|
5
9
|
:class="classObject"
|
|
@@ -24,7 +28,14 @@
|
|
|
24
28
|
<ArrowBack24 aria-hidden="true" />
|
|
25
29
|
</template>
|
|
26
30
|
</MIconButton>
|
|
27
|
-
<h2
|
|
31
|
+
<h2
|
|
32
|
+
class="mc-drawer__title"
|
|
33
|
+
tabindex="-1"
|
|
34
|
+
id="drawerTitle"
|
|
35
|
+
ref="titleRef"
|
|
36
|
+
>
|
|
37
|
+
{{ title }}
|
|
38
|
+
</h2>
|
|
28
39
|
<MIconButton
|
|
29
40
|
class="mc-drawer__close"
|
|
30
41
|
aria-label="Close"
|
|
@@ -53,7 +64,7 @@
|
|
|
53
64
|
</template>
|
|
54
65
|
|
|
55
66
|
<script setup lang="ts">
|
|
56
|
-
import { computed, watch, type VNode } from 'vue';
|
|
67
|
+
import { computed, watch, type VNode, ref } from 'vue';
|
|
57
68
|
import ArrowBack24 from '@mozaic-ds/icons-vue/src/components/ArrowBack24/ArrowBack24.vue';
|
|
58
69
|
import Cross24 from '@mozaic-ds/icons-vue/src/components/Cross24/Cross24.vue';
|
|
59
70
|
import MIconButton from '../iconbutton/MIconButton.vue';
|
|
@@ -86,6 +97,10 @@ const props = defineProps<{
|
|
|
86
97
|
* Title of the content of the drawer.
|
|
87
98
|
*/
|
|
88
99
|
contentTitle?: string;
|
|
100
|
+
/**
|
|
101
|
+
* if `true`, close the drawer when clicking the overlay.
|
|
102
|
+
*/
|
|
103
|
+
closeOnOverlay?: boolean;
|
|
89
104
|
}>();
|
|
90
105
|
|
|
91
106
|
defineSlots<{
|
|
@@ -115,6 +130,22 @@ watch(
|
|
|
115
130
|
},
|
|
116
131
|
);
|
|
117
132
|
|
|
133
|
+
const titleRef = ref<HTMLElement | null>(null);
|
|
134
|
+
watch(
|
|
135
|
+
() => props.open,
|
|
136
|
+
(newValue) => {
|
|
137
|
+
if (newValue && titleRef.value) {
|
|
138
|
+
titleRef.value.focus();
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
const onClickOverlay = () => {
|
|
144
|
+
if (props.closeOnOverlay) {
|
|
145
|
+
onClose();
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
118
149
|
const onClose = () => {
|
|
119
150
|
emit('update:open', false);
|
|
120
151
|
};
|