@mozaic-ds/vue 1.0.0-beta.4 → 1.0.0-beta.7
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 +33 -166
- package/dist/mozaic-vue.css +1 -1
- package/dist/mozaic-vue.d.ts +347 -65
- package/dist/mozaic-vue.js +670 -328
- 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 +3 -2
- package/src/components/GettingStarted.mdx +16 -5
- package/src/components/Introduction.mdx +35 -9
- package/src/components/Support.mdx +1 -1
- package/src/components/breadcrumb/MBreadcrumb.spec.ts +105 -0
- package/src/components/breadcrumb/MBreadcrumb.stories.ts +84 -0
- package/src/components/breadcrumb/MBreadcrumb.vue +70 -0
- package/src/components/button/MButton.stories.ts +1 -1
- package/src/components/checkbox/MCheckbox.stories.ts +1 -1
- package/src/components/checkboxgroup/MCheckboxGroup.stories.ts +1 -1
- package/src/components/checkboxgroup/MCheckboxGroup.vue +2 -2
- package/src/components/field/MField.stories.ts +1 -1
- package/src/components/fieldgroup/MFieldGroup.stories.ts +175 -26
- package/src/components/iconbutton/MIconButton.stories.ts +1 -1
- package/src/components/link/MLink.vue +1 -1
- package/src/components/loader/MLoader.stories.ts +1 -1
- package/src/components/numberbadge/MNumberBadge.spec.ts +56 -0
- package/src/components/{badge/MBadge.stories.ts → numberbadge/MNumberBadge.stories.ts} +8 -8
- package/src/components/{badge/MBadge.vue → numberbadge/MNumberBadge.vue} +4 -4
- package/src/components/passwordinput/MPasswordInput.spec.ts +104 -0
- package/src/components/passwordinput/MPasswordInput.stories.ts +75 -0
- package/src/components/passwordinput/MPasswordInput.vue +149 -0
- package/src/components/quantityselector/MQuantitySelector.stories.ts +1 -1
- package/src/components/radio/MRadio.stories.ts +1 -1
- package/src/components/radiogroup/MRadioGroup.stories.ts +1 -1
- package/src/components/select/MSelect.stories.ts +1 -1
- package/src/components/statusbadge/MStatusBadge.stories.ts +5 -5
- package/src/components/statusbadge/MStatusBadge.vue +6 -6
- package/src/components/statusdot/MStatusDot.spec.ts +51 -0
- package/src/components/statusdot/MStatusDot.stories.ts +48 -0
- package/src/components/{statusbadge → statusdot}/MStatusDot.vue +8 -4
- package/src/components/statusnotification/MStatusNotification.spec.ts +99 -0
- package/src/components/statusnotification/MStatusNotification.stories.ts +96 -0
- package/src/components/statusnotification/MStatusNotification.vue +106 -0
- package/src/components/textarea/MTextArea.stories.ts +1 -1
- package/src/components/textinput/MTextInput.stories.ts +1 -1
- package/src/components/toggle/MToggle.stories.ts +2 -2
- package/src/components/togglegroup/MToggleGroup.spec.ts +78 -0
- package/src/components/togglegroup/MToggleGroup.stories.ts +61 -0
- package/src/components/togglegroup/MToggleGroup.vue +97 -0
- package/src/main.ts +22 -39
- package/src/components/badge/MBadge.spec.ts +0 -16
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3';
|
|
2
|
+
import MBreadcrumb from './MBreadcrumb.vue';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof MBreadcrumb> = {
|
|
5
|
+
title: 'Navigation/Breadcrumb',
|
|
6
|
+
component: MBreadcrumb,
|
|
7
|
+
parameters: {
|
|
8
|
+
docs: {
|
|
9
|
+
description: {
|
|
10
|
+
component:
|
|
11
|
+
'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.',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
args: {
|
|
16
|
+
links: [
|
|
17
|
+
{
|
|
18
|
+
label: 'Home',
|
|
19
|
+
href: '#',
|
|
20
|
+
router: true
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: 'level 01',
|
|
24
|
+
href: '#',
|
|
25
|
+
router: true
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
label: 'level 02',
|
|
29
|
+
href: '#',
|
|
30
|
+
router: true
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
label: 'Current Page',
|
|
34
|
+
href: '#',
|
|
35
|
+
router: true
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
render: (args) => ({
|
|
40
|
+
components: { MBreadcrumb },
|
|
41
|
+
setup() {
|
|
42
|
+
return { args };
|
|
43
|
+
},
|
|
44
|
+
template: `
|
|
45
|
+
<MBreadcrumb v-bind="args"></MBreadcrumb>
|
|
46
|
+
`,
|
|
47
|
+
}),
|
|
48
|
+
};
|
|
49
|
+
export default meta;
|
|
50
|
+
type Story = StoryObj<typeof MBreadcrumb>;
|
|
51
|
+
|
|
52
|
+
export const Default: Story = {};
|
|
53
|
+
|
|
54
|
+
export const Inverse: Story = {
|
|
55
|
+
parameters: {
|
|
56
|
+
backgrounds: {
|
|
57
|
+
default: 'Inverse',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
args: { appearance: 'inverse' },
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const WithoutRouter: Story = {
|
|
64
|
+
args: {
|
|
65
|
+
links: [
|
|
66
|
+
{
|
|
67
|
+
label: 'Home',
|
|
68
|
+
href: '#'
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
label: 'level 01',
|
|
72
|
+
href: '#'
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
label: 'level 02',
|
|
76
|
+
href: '#'
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
label: 'Current Page',
|
|
80
|
+
href: '#'
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<nav class="mc-breadcrumb" :class="classObject" aria-label="Breadcrumb">
|
|
3
|
+
<ul class="mc-breadcrumb__container">
|
|
4
|
+
<li
|
|
5
|
+
class="mc-breadcrumb__item"
|
|
6
|
+
v-for="(link, index) in links"
|
|
7
|
+
:key="`breadcrumb-${index}`"
|
|
8
|
+
>
|
|
9
|
+
<MLink
|
|
10
|
+
:href="link.href"
|
|
11
|
+
:router="link.router"
|
|
12
|
+
:appearance="appearance"
|
|
13
|
+
inline
|
|
14
|
+
:class="{
|
|
15
|
+
'mc-breadcrumb__current': isLastLink(index),
|
|
16
|
+
}"
|
|
17
|
+
:aria-current="isLastLink(index) ? 'page' : undefined"
|
|
18
|
+
>
|
|
19
|
+
{{ link.label }}
|
|
20
|
+
</MLink>
|
|
21
|
+
</li>
|
|
22
|
+
</ul>
|
|
23
|
+
</nav>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script setup lang="ts">
|
|
27
|
+
import { computed } from 'vue';
|
|
28
|
+
import MLink from '../link/MLink.vue';
|
|
29
|
+
/**
|
|
30
|
+
* 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.
|
|
31
|
+
*/
|
|
32
|
+
const props = defineProps<{
|
|
33
|
+
/**
|
|
34
|
+
* Allows to define the breadcrumb style
|
|
35
|
+
*/
|
|
36
|
+
appearance?: 'standard' | 'inverse';
|
|
37
|
+
/**
|
|
38
|
+
* Links of the breadcrumb
|
|
39
|
+
*/
|
|
40
|
+
links?: Array<{
|
|
41
|
+
/**
|
|
42
|
+
* The label displayed for the link.
|
|
43
|
+
*/
|
|
44
|
+
label: string;
|
|
45
|
+
/**
|
|
46
|
+
* URL for the link (for external links or the `to` prop for `router-link`).
|
|
47
|
+
*/
|
|
48
|
+
href: string;
|
|
49
|
+
/**
|
|
50
|
+
* If `true`, the link will be rendered as a `router-link` for internal navigation (Vue Router).
|
|
51
|
+
*/
|
|
52
|
+
router?: boolean;
|
|
53
|
+
}>;
|
|
54
|
+
}>();
|
|
55
|
+
|
|
56
|
+
const classObject = computed(() => {
|
|
57
|
+
return {
|
|
58
|
+
[`mc-breadcrumb--${props.appearance}`]:
|
|
59
|
+
props.appearance && props.appearance != 'standard',
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const isLastLink = (index: number) => {
|
|
64
|
+
return index === (props.links?.length ?? 0) - 1;
|
|
65
|
+
};
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<style lang="scss" scoped>
|
|
69
|
+
@use '@mozaic-ds/styles/components/breadcrumb';
|
|
70
|
+
</style>
|
|
@@ -11,7 +11,7 @@ const meta: Meta<typeof MButton> = {
|
|
|
11
11
|
docs: {
|
|
12
12
|
description: {
|
|
13
13
|
component:
|
|
14
|
-
'Buttons are used to
|
|
14
|
+
'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.',
|
|
15
15
|
},
|
|
16
16
|
},
|
|
17
17
|
},
|
|
@@ -10,7 +10,7 @@ const meta: Meta<typeof MCheckbox> = {
|
|
|
10
10
|
docs: {
|
|
11
11
|
description: {
|
|
12
12
|
component:
|
|
13
|
-
'
|
|
13
|
+
'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.',
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
},
|
|
@@ -10,7 +10,7 @@ const meta: Meta<typeof MCheckboxGroup> = {
|
|
|
10
10
|
docs: {
|
|
11
11
|
description: {
|
|
12
12
|
component:
|
|
13
|
-
'
|
|
13
|
+
'A field label is a text element that identifies the purpose of an input field, providing users with clear guidance on what information to enter. It is typically placed above the input field and may include indicators for required or optional fields. Field Labels improve form usability, accessibility, and data entry accuracy by ensuring users understand the expected input.<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 Group section](/docs/form-elements-field-group--docs#checkbox-group).',
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
},
|
|
@@ -25,7 +25,7 @@ import MCheckbox from '../checkbox/MCheckbox.vue';
|
|
|
25
25
|
*/
|
|
26
26
|
const props = defineProps<{
|
|
27
27
|
/**
|
|
28
|
-
* The name attribute for the
|
|
28
|
+
* The name attribute for the checkbox element, typically used for form submission.
|
|
29
29
|
*/
|
|
30
30
|
name: string;
|
|
31
31
|
/**
|
|
@@ -34,7 +34,7 @@ const props = defineProps<{
|
|
|
34
34
|
*/
|
|
35
35
|
modelValue?: Array<string>;
|
|
36
36
|
/**
|
|
37
|
-
* list of properties of each
|
|
37
|
+
* list of properties of each checkbox button of the checkbox group
|
|
38
38
|
*/
|
|
39
39
|
options: Array<{
|
|
40
40
|
id: string;
|
|
@@ -13,7 +13,7 @@ const meta: Meta<typeof MField> = {
|
|
|
13
13
|
docs: {
|
|
14
14
|
description: {
|
|
15
15
|
component:
|
|
16
|
-
'
|
|
16
|
+
'A field label is a text element that identifies the purpose of an input field, providing users with clear guidance on what information to enter. It is typically placed above the input field and may include indicators for required or optional fields. Field Labels improve form usability, accessibility, and data entry accuracy by ensuring users understand the expected input.',
|
|
17
17
|
},
|
|
18
18
|
},
|
|
19
19
|
},
|
|
@@ -4,6 +4,7 @@ import { action } from '@storybook/addon-actions';
|
|
|
4
4
|
import MFieldGroup from './MFieldGroup.vue';
|
|
5
5
|
import MCheckboxGroup from '../checkboxgroup/MCheckboxGroup.vue';
|
|
6
6
|
import MRadioGroup from '../radiogroup/MRadioGroup.vue';
|
|
7
|
+
import MToggleGroup from '../togglegroup/MToggleGroup.vue';
|
|
7
8
|
|
|
8
9
|
const meta: Meta<typeof MFieldGroup> = {
|
|
9
10
|
title: 'Form Elements/Field Group',
|
|
@@ -12,7 +13,7 @@ const meta: Meta<typeof MFieldGroup> = {
|
|
|
12
13
|
docs: {
|
|
13
14
|
description: {
|
|
14
15
|
component:
|
|
15
|
-
'
|
|
16
|
+
'A field label is a text element that identifies the purpose of an input field, providing users with clear guidance on what information to enter. It is typically placed above the input field and may include indicators for required or optional fields. Field Labels improve form usability, accessibility, and data entry accuracy by ensuring users understand the expected input.',
|
|
16
17
|
},
|
|
17
18
|
},
|
|
18
19
|
},
|
|
@@ -60,7 +61,7 @@ const meta: Meta<typeof MFieldGroup> = {
|
|
|
60
61
|
},
|
|
61
62
|
},
|
|
62
63
|
render: (args) => ({
|
|
63
|
-
components: { MFieldGroup, MCheckboxGroup, MRadioGroup },
|
|
64
|
+
components: { MFieldGroup, MCheckboxGroup, MRadioGroup, MToggleGroup },
|
|
64
65
|
setup() {
|
|
65
66
|
const handleUpdate = action('update:modelValue');
|
|
66
67
|
|
|
@@ -111,6 +112,36 @@ export const CheckboxGroupValid: Story = {
|
|
|
111
112
|
requirementText: 'required',
|
|
112
113
|
isValid: true,
|
|
113
114
|
message: 'Validation message (Be concise and use comprehensive words).',
|
|
115
|
+
default: `
|
|
116
|
+
<MCheckboxGroup
|
|
117
|
+
name="checkboxGroupName"
|
|
118
|
+
:options="
|
|
119
|
+
[
|
|
120
|
+
{
|
|
121
|
+
id: 'checkbox-05',
|
|
122
|
+
label: 'checkbox Label',
|
|
123
|
+
value: 'checkbox5',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
id: 'checkbox-06',
|
|
127
|
+
label: 'checkbox Label',
|
|
128
|
+
value: 'checkbox6',
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
id: 'checkbox-07',
|
|
132
|
+
label: 'checkbox Label',
|
|
133
|
+
value: 'checkbox7',
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: 'checkbox-08',
|
|
137
|
+
label: 'checkbox Label',
|
|
138
|
+
value: 'checkbox8',
|
|
139
|
+
},
|
|
140
|
+
]
|
|
141
|
+
"
|
|
142
|
+
@update:modelValue="handleUpdate"
|
|
143
|
+
/>
|
|
144
|
+
`,
|
|
114
145
|
},
|
|
115
146
|
};
|
|
116
147
|
|
|
@@ -128,24 +159,24 @@ export const CheckboxGroupInvalid: Story = {
|
|
|
128
159
|
:options="
|
|
129
160
|
[
|
|
130
161
|
{
|
|
131
|
-
id: 'checkbox-
|
|
162
|
+
id: 'checkbox-09',
|
|
132
163
|
label: 'checkbox Label',
|
|
133
|
-
value: '
|
|
164
|
+
value: 'checkbox9',
|
|
134
165
|
},
|
|
135
166
|
{
|
|
136
|
-
id: 'checkbox-
|
|
167
|
+
id: 'checkbox-10',
|
|
137
168
|
label: 'checkbox Label',
|
|
138
|
-
value: '
|
|
169
|
+
value: 'checkbox10',
|
|
139
170
|
},
|
|
140
171
|
{
|
|
141
|
-
id: 'checkbox-
|
|
172
|
+
id: 'checkbox-11',
|
|
142
173
|
label: 'checkbox Label',
|
|
143
|
-
value: '
|
|
174
|
+
value: 'checkbox11',
|
|
144
175
|
},
|
|
145
176
|
{
|
|
146
|
-
id: 'checkbox-
|
|
177
|
+
id: 'checkbox-12',
|
|
147
178
|
label: 'checkbox Label',
|
|
148
|
-
value: '
|
|
179
|
+
value: 'checkbox12',
|
|
149
180
|
},
|
|
150
181
|
]
|
|
151
182
|
"
|
|
@@ -205,24 +236,24 @@ export const RadioGroupValid: Story = {
|
|
|
205
236
|
:options="
|
|
206
237
|
[
|
|
207
238
|
{
|
|
208
|
-
id: '
|
|
239
|
+
id: 'radio05',
|
|
209
240
|
label: 'Radio button Label',
|
|
210
|
-
value: '
|
|
241
|
+
value: 'radio5'
|
|
211
242
|
},
|
|
212
243
|
{
|
|
213
|
-
id: '
|
|
244
|
+
id: 'radio06',
|
|
214
245
|
label: 'Radio button Label',
|
|
215
|
-
value: '
|
|
246
|
+
value: 'radio6'
|
|
216
247
|
},
|
|
217
248
|
{
|
|
218
|
-
id: '
|
|
249
|
+
id: 'radio07',
|
|
219
250
|
label: 'Radio button Label',
|
|
220
|
-
value: '
|
|
251
|
+
value: 'radio7'
|
|
221
252
|
},
|
|
222
253
|
{
|
|
223
|
-
id: '
|
|
254
|
+
id: 'radio08',
|
|
224
255
|
label: 'Radio button Label',
|
|
225
|
-
value: '
|
|
256
|
+
value: 'radio8'
|
|
226
257
|
}
|
|
227
258
|
]
|
|
228
259
|
"
|
|
@@ -246,24 +277,24 @@ export const RadioGroupInvalid: Story = {
|
|
|
246
277
|
:options="
|
|
247
278
|
[
|
|
248
279
|
{
|
|
249
|
-
id: 'radio-
|
|
280
|
+
id: 'radio-9',
|
|
250
281
|
label: 'Radio button Label',
|
|
251
|
-
value: '
|
|
282
|
+
value: 'radio9'
|
|
252
283
|
},
|
|
253
284
|
{
|
|
254
|
-
id: 'radio-
|
|
285
|
+
id: 'radio-10',
|
|
255
286
|
label: 'Radio button Label',
|
|
256
|
-
value: '
|
|
287
|
+
value: 'radio10'
|
|
257
288
|
},
|
|
258
289
|
{
|
|
259
|
-
id: 'radio-
|
|
290
|
+
id: 'radio-11',
|
|
260
291
|
label: 'Radio button Label',
|
|
261
|
-
value: '
|
|
292
|
+
value: 'radio11'
|
|
262
293
|
},
|
|
263
294
|
{
|
|
264
|
-
id: 'radio-
|
|
295
|
+
id: 'radio-12',
|
|
265
296
|
label: 'Radio button Label',
|
|
266
|
-
value: '
|
|
297
|
+
value: 'radio12'
|
|
267
298
|
}
|
|
268
299
|
]
|
|
269
300
|
"
|
|
@@ -272,3 +303,121 @@ export const RadioGroupInvalid: Story = {
|
|
|
272
303
|
`,
|
|
273
304
|
},
|
|
274
305
|
};
|
|
306
|
+
|
|
307
|
+
export const ToggleGroup: Story = {
|
|
308
|
+
args: {
|
|
309
|
+
legend: 'Label',
|
|
310
|
+
id: 'ToggleGroupId',
|
|
311
|
+
requirementText: 'required',
|
|
312
|
+
default: `
|
|
313
|
+
<MToggleGroup
|
|
314
|
+
name="ToggleGroupName"
|
|
315
|
+
:options="
|
|
316
|
+
[
|
|
317
|
+
{
|
|
318
|
+
id: 'toggle-01',
|
|
319
|
+
label: 'Toggle Label',
|
|
320
|
+
value: 'toggle1',
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
id: 'toggle-02',
|
|
324
|
+
label: 'Toggle Label',
|
|
325
|
+
value: 'toggle2',
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
id: 'toggle-03',
|
|
329
|
+
label: 'Toggle Label',
|
|
330
|
+
value: 'toggle3',
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
id: 'toggle-04',
|
|
334
|
+
label: 'Toggle Label',
|
|
335
|
+
value: 'toggle4',
|
|
336
|
+
},
|
|
337
|
+
]
|
|
338
|
+
"
|
|
339
|
+
@update:modelValue="handleUpdate"
|
|
340
|
+
/>
|
|
341
|
+
`,
|
|
342
|
+
},
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
export const ToggleGroupValid: Story = {
|
|
346
|
+
args: {
|
|
347
|
+
legend: 'Label',
|
|
348
|
+
id: 'ToggleGroupId',
|
|
349
|
+
requirementText: 'required',
|
|
350
|
+
isValid: true,
|
|
351
|
+
message: 'Validation message (Be concise and use comprehensive words).',
|
|
352
|
+
default: `
|
|
353
|
+
<MToggleGroup
|
|
354
|
+
name="ToggleGroupName"
|
|
355
|
+
:options="
|
|
356
|
+
[
|
|
357
|
+
{
|
|
358
|
+
id: 'toggle-05',
|
|
359
|
+
label: 'Toggle Label',
|
|
360
|
+
value: 'toggle5',
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
id: 'toggle-06',
|
|
364
|
+
label: 'Toggle Label',
|
|
365
|
+
value: 'toggle6',
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
id: 'toggle-07',
|
|
369
|
+
label: 'Toggle Label',
|
|
370
|
+
value: 'toggle7',
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
id: 'toggle-08',
|
|
374
|
+
label: 'Toggle Label',
|
|
375
|
+
value: 'toggle8',
|
|
376
|
+
},
|
|
377
|
+
]
|
|
378
|
+
"
|
|
379
|
+
@update:modelValue="handleUpdate"
|
|
380
|
+
/>
|
|
381
|
+
`,
|
|
382
|
+
},
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
export const ToggleGroupInvalid: Story = {
|
|
386
|
+
args: {
|
|
387
|
+
legend: 'Label',
|
|
388
|
+
id: 'ToggleGroupId',
|
|
389
|
+
requirementText: 'required',
|
|
390
|
+
isInvalid: true,
|
|
391
|
+
message: 'Error message (Be concise and use comprehensive words)',
|
|
392
|
+
default: `
|
|
393
|
+
<MToggleGroup
|
|
394
|
+
name="ToggleGroupName"
|
|
395
|
+
:options="
|
|
396
|
+
[
|
|
397
|
+
{
|
|
398
|
+
id: 'toggle-09',
|
|
399
|
+
label: 'Toggle Label',
|
|
400
|
+
value: 'toggle9',
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
id: 'toggle-10',
|
|
404
|
+
label: 'Toggle Label',
|
|
405
|
+
value: 'toggle10',
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
id: 'toggle-11',
|
|
409
|
+
label: 'Toggle Label',
|
|
410
|
+
value: 'toggle11',
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
id: 'toggle-12',
|
|
414
|
+
label: 'Toggle Label',
|
|
415
|
+
value: 'toggle12',
|
|
416
|
+
},
|
|
417
|
+
]
|
|
418
|
+
"
|
|
419
|
+
@update:modelValue="handleUpdate"
|
|
420
|
+
/>
|
|
421
|
+
`,
|
|
422
|
+
},
|
|
423
|
+
};
|
|
@@ -10,7 +10,7 @@ const meta: Meta<typeof MIconButton> = {
|
|
|
10
10
|
docs: {
|
|
11
11
|
description: {
|
|
12
12
|
component:
|
|
13
|
-
'
|
|
13
|
+
'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.',
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
},
|
|
@@ -8,7 +8,7 @@ const meta: Meta<typeof MLoader> = {
|
|
|
8
8
|
docs: {
|
|
9
9
|
description: {
|
|
10
10
|
component:
|
|
11
|
-
'A loader
|
|
11
|
+
'A loader is a visual indicator used to inform users that a process is in progress, typically during data fetching, page loading, or background operations. It provides feedback that the system is working, helping to manage user expectations and reduce perceived wait time.',
|
|
12
12
|
},
|
|
13
13
|
},
|
|
14
14
|
},
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils';
|
|
2
|
+
import { describe, it, expect } from 'vitest';
|
|
3
|
+
import MNumberBadge from './MNumberBadge.vue';
|
|
4
|
+
|
|
5
|
+
describe('MNumberBadge component', () => {
|
|
6
|
+
it('renders the label correctly', () => {
|
|
7
|
+
const wrapper = mount(MNumberBadge, {
|
|
8
|
+
props: { label: 42 },
|
|
9
|
+
});
|
|
10
|
+
expect(wrapper.text()).toBe('42');
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('applies no modifier class by default', () => {
|
|
14
|
+
const wrapper = mount(MNumberBadge, {
|
|
15
|
+
props: { label: 1 },
|
|
16
|
+
});
|
|
17
|
+
expect(wrapper.classes()).toContain('mc-number-badge');
|
|
18
|
+
expect(wrapper.classes()).not.toContain('mc-number-badge--standard');
|
|
19
|
+
expect(wrapper.classes()).not.toContain('mc-number-badge--s');
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('applies appearance modifier class when set to danger', () => {
|
|
23
|
+
const wrapper = mount(MNumberBadge, {
|
|
24
|
+
props: {
|
|
25
|
+
label: 5,
|
|
26
|
+
appearance: 'danger',
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
expect(wrapper.classes()).toContain('mc-number-badge');
|
|
30
|
+
expect(wrapper.classes()).toContain('mc-number-badge--danger');
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('applies size modifier class when size is m', () => {
|
|
34
|
+
const wrapper = mount(MNumberBadge, {
|
|
35
|
+
props: {
|
|
36
|
+
label: 10,
|
|
37
|
+
size: 'm',
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
expect(wrapper.classes()).toContain('mc-number-badge');
|
|
41
|
+
expect(wrapper.classes()).toContain('mc-number-badge--m');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('applies both appearance and size modifier classes when set', () => {
|
|
45
|
+
const wrapper = mount(MNumberBadge, {
|
|
46
|
+
props: {
|
|
47
|
+
label: 3,
|
|
48
|
+
appearance: 'accent',
|
|
49
|
+
size: 'm',
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
expect(wrapper.classes()).toContain('mc-number-badge');
|
|
53
|
+
expect(wrapper.classes()).toContain('mc-number-badge--accent');
|
|
54
|
+
expect(wrapper.classes()).toContain('mc-number-badge--m');
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/vue3';
|
|
2
|
-
import
|
|
2
|
+
import MNumberBadge from './MNumberBadge.vue';
|
|
3
3
|
|
|
4
|
-
const meta: Meta<typeof
|
|
5
|
-
title: 'Indicators/Badge
|
|
6
|
-
component:
|
|
4
|
+
const meta: Meta<typeof MNumberBadge> = {
|
|
5
|
+
title: 'Indicators/Number Badge',
|
|
6
|
+
component: MNumberBadge,
|
|
7
7
|
parameters: {
|
|
8
8
|
docs: {
|
|
9
9
|
description: {
|
|
10
10
|
component:
|
|
11
|
-
'A
|
|
11
|
+
'A Number Badge represents a numeric count, often used to indicate notifications, updates, or items requiring attention. Its distinct appearance makes it easy to spot changes at a glance, ensuring users stay informed without breaking their workflow. Badges are commonly attached to icons, buttons, or tabs to provide contextual awareness.',
|
|
12
12
|
},
|
|
13
13
|
},
|
|
14
14
|
},
|
|
15
15
|
args: { label: 99 },
|
|
16
16
|
render: (args) => ({
|
|
17
|
-
components: {
|
|
17
|
+
components: { MNumberBadge },
|
|
18
18
|
setup() {
|
|
19
19
|
return { args };
|
|
20
20
|
},
|
|
21
21
|
template: `
|
|
22
|
-
<
|
|
22
|
+
<MNumberBadge v-bind="args"></MNumberBadge>
|
|
23
23
|
`,
|
|
24
24
|
}),
|
|
25
25
|
};
|
|
26
26
|
export default meta;
|
|
27
|
-
type Story = StoryObj<typeof
|
|
27
|
+
type Story = StoryObj<typeof MNumberBadge>;
|
|
28
28
|
|
|
29
29
|
export const Standard: Story = {};
|
|
30
30
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<span class="mc-badge" :class="classObject">
|
|
2
|
+
<span class="mc-number-badge" :class="classObject">
|
|
3
3
|
{{ label }}
|
|
4
4
|
</span>
|
|
5
5
|
</template>
|
|
@@ -33,13 +33,13 @@ const props = withDefaults(
|
|
|
33
33
|
|
|
34
34
|
const classObject = computed(() => {
|
|
35
35
|
return {
|
|
36
|
-
[`mc-badge--${props.appearance}`]:
|
|
36
|
+
[`mc-number-badge--${props.appearance}`]:
|
|
37
37
|
props.appearance && props.appearance != 'standard',
|
|
38
|
-
[`mc-badge--${props.size}`]: props.size && props.size != 's',
|
|
38
|
+
[`mc-number-badge--${props.size}`]: props.size && props.size != 's',
|
|
39
39
|
};
|
|
40
40
|
});
|
|
41
41
|
</script>
|
|
42
42
|
|
|
43
43
|
<style lang="scss" scoped>
|
|
44
|
-
@use '@mozaic-ds/styles/components/badge';
|
|
44
|
+
@use '@mozaic-ds/styles/components/number-badge';
|
|
45
45
|
</style>
|