@mozaic-ds/vue 2.6.0 → 2.7.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.
Files changed (128) hide show
  1. package/README.md +3 -3
  2. package/dist/mozaic-vue.css +1 -1
  3. package/dist/mozaic-vue.d.ts +334 -274
  4. package/dist/mozaic-vue.js +1215 -1144
  5. package/dist/mozaic-vue.js.map +1 -1
  6. package/dist/mozaic-vue.umd.cjs +1 -1
  7. package/dist/mozaic-vue.umd.cjs.map +1 -1
  8. package/package.json +9 -7
  9. package/src/components/Contributing.mdx +1 -1
  10. package/src/components/GettingStarted.mdx +1 -1
  11. package/src/components/Introduction.mdx +1 -1
  12. package/src/components/Support.mdx +1 -1
  13. package/src/components/avatar/MAvatar.stories.ts +1 -0
  14. package/src/components/avatar/MAvatar.vue +2 -2
  15. package/src/components/avatar/README.md +16 -0
  16. package/src/components/breadcrumb/MBreadcrumb.stories.ts +1 -0
  17. package/src/components/breadcrumb/MBreadcrumb.vue +3 -3
  18. package/src/components/breadcrumb/README.md +11 -0
  19. package/src/components/button/MButton.stories.ts +1 -2
  20. package/src/components/button/MButton.vue +7 -2
  21. package/src/components/button/README.md +24 -0
  22. package/src/components/callout/MCallout.stories.ts +1 -0
  23. package/src/components/callout/MCallout.vue +5 -5
  24. package/src/components/callout/README.md +19 -0
  25. package/src/components/checkbox/MCheckbox.vue +5 -1
  26. package/src/components/checkbox/README.md +23 -0
  27. package/src/components/checkboxgroup/MCheckboxGroup.stories.ts +1 -1
  28. package/src/components/checkboxgroup/MCheckboxGroup.vue +1 -1
  29. package/src/components/checkboxgroup/README.md +20 -0
  30. package/src/components/circularprogressbar/MCircularProgressbar.stories.ts +1 -0
  31. package/src/components/circularprogressbar/MCircularProgressbar.vue +2 -2
  32. package/src/components/circularprogressbar/README.md +14 -0
  33. package/src/components/container/MContainer.stories.ts +11 -3
  34. package/src/components/container/MContainer.vue +3 -3
  35. package/src/components/container/README.md +16 -0
  36. package/src/components/datepicker/MDatepicker.stories.ts +2 -1
  37. package/src/components/datepicker/MDatepicker.vue +7 -3
  38. package/src/components/datepicker/README.md +24 -0
  39. package/src/components/divider/MDivider.spec.ts +5 -5
  40. package/src/components/divider/MDivider.stories.ts +8 -13
  41. package/src/components/divider/MDivider.vue +8 -8
  42. package/src/components/divider/README.md +18 -0
  43. package/src/components/drawer/MDrawer.spec.ts +28 -0
  44. package/src/components/drawer/MDrawer.stories.ts +1 -0
  45. package/src/components/drawer/MDrawer.vue +16 -5
  46. package/src/components/drawer/README.md +29 -0
  47. package/src/components/field/MField.vue +1 -1
  48. package/src/components/field/README.md +24 -0
  49. package/src/components/fieldgroup/README.md +22 -0
  50. package/src/components/flag/MFlag.vue +2 -2
  51. package/src/components/flag/README.md +11 -0
  52. package/src/components/iconbutton/MIconButton.stories.ts +1 -0
  53. package/src/components/iconbutton/MIconButton.vue +2 -2
  54. package/src/components/iconbutton/README.md +21 -0
  55. package/src/components/linearprogressbarbuffer/MLinearProgressbarBuffer.stories.ts +1 -0
  56. package/src/components/linearprogressbarbuffer/MLinearProgressbarBuffer.vue +5 -1
  57. package/src/components/linearprogressbarbuffer/README.md +11 -0
  58. package/src/components/linearprogressbarpercentage/MLinearProgressbarPercentage.stories.ts +1 -0
  59. package/src/components/linearprogressbarpercentage/MLinearProgressbarPercentage.vue +4 -0
  60. package/src/components/linearprogressbarpercentage/README.md +10 -0
  61. package/src/components/link/MLink.stories.ts +2 -2
  62. package/src/components/link/MLink.vue +22 -12
  63. package/src/components/link/README.md +23 -0
  64. package/src/components/loader/MLoader.vue +1 -1
  65. package/src/components/loader/README.md +12 -0
  66. package/src/components/loadingoverlay/MLoadingOverlay.stories.ts +1 -1
  67. package/src/components/loadingoverlay/MLoadingOverlay.vue +4 -0
  68. package/src/components/loadingoverlay/README.md +11 -0
  69. package/src/components/modal/MModal.vue +11 -7
  70. package/src/components/modal/README.md +28 -0
  71. package/src/components/numberbadge/MNumberBadge.vue +4 -4
  72. package/src/components/numberbadge/README.md +12 -0
  73. package/src/components/overlay/MOverlay.stories.ts +1 -1
  74. package/src/components/overlay/MOverlay.vue +2 -2
  75. package/src/components/overlay/README.md +17 -0
  76. package/src/components/pagination/MPagination.stories.ts +1 -0
  77. package/src/components/pagination/MPagination.vue +1 -1
  78. package/src/components/pagination/README.md +20 -0
  79. package/src/components/passwordinput/MPasswordInput.vue +6 -2
  80. package/src/components/passwordinput/README.md +25 -0
  81. package/src/components/pincode/MPincode.spec.ts +4 -1
  82. package/src/components/pincode/MPincode.stories.ts +2 -1
  83. package/src/components/pincode/MPincode.vue +10 -2
  84. package/src/components/pincode/README.md +22 -0
  85. package/src/components/quantityselector/MQuantitySelector.stories.ts +1 -1
  86. package/src/components/quantityselector/MQuantitySelector.vue +6 -2
  87. package/src/components/quantityselector/README.md +27 -0
  88. package/src/components/radio/MRadio.vue +5 -1
  89. package/src/components/radio/README.md +21 -0
  90. package/src/components/radiogroup/MRadioGroup.vue +1 -1
  91. package/src/components/radiogroup/README.md +21 -0
  92. package/src/components/segmentedcontrol/MSegmentedControl.spec.ts +116 -0
  93. package/src/components/segmentedcontrol/MSegmentedControl.stories.ts +78 -0
  94. package/src/components/segmentedcontrol/MSegmentedControl.vue +92 -0
  95. package/src/components/segmentedcontrol/README.md +19 -0
  96. package/src/components/select/MSelect.vue +6 -2
  97. package/src/components/select/README.md +24 -0
  98. package/src/components/statusbadge/MStatusBadge.stories.ts +1 -1
  99. package/src/components/statusbadge/MStatusBadge.vue +3 -3
  100. package/src/components/statusbadge/README.md +11 -0
  101. package/src/components/statusdot/MStatusDot.stories.ts +1 -0
  102. package/src/components/statusdot/MStatusDot.vue +3 -3
  103. package/src/components/statusdot/README.md +11 -0
  104. package/src/components/statusnotification/MStatusNotification.vue +3 -3
  105. package/src/components/statusnotification/README.md +25 -0
  106. package/src/components/tabs/MTabs.stories.ts +23 -1
  107. package/src/components/tabs/MTabs.vue +8 -0
  108. package/src/components/tabs/Mtabs.spec.ts +30 -9
  109. package/src/components/tabs/README.md +20 -0
  110. package/src/components/tag/MTag.stories.ts +1 -1
  111. package/src/components/tag/MTag.vue +4 -0
  112. package/src/components/tag/README.md +25 -0
  113. package/src/components/textarea/MTextArea.vue +5 -1
  114. package/src/components/textarea/README.md +25 -0
  115. package/src/components/textinput/MTextInput.vue +10 -6
  116. package/src/components/textinput/README.md +32 -0
  117. package/src/components/toaster/MToaster.stories.ts +1 -0
  118. package/src/components/toaster/MToaster.vue +4 -4
  119. package/src/components/toaster/README.md +28 -0
  120. package/src/components/toggle/MToggle.vue +6 -2
  121. package/src/components/toggle/README.md +21 -0
  122. package/src/components/togglegroup/MToggleGroup.vue +2 -2
  123. package/src/components/togglegroup/README.md +20 -0
  124. package/src/components/tooltip/MTooltip.vue +8 -10
  125. package/src/components/tooltip/README.md +19 -0
  126. package/src/components/usingIcons.mdx +1 -1
  127. package/src/components/usingPresets.mdx +1 -1
  128. package/src/main.ts +6 -4
@@ -0,0 +1,78 @@
1
+ import type { Meta, StoryObj } from '@storybook/vue3-vite';
2
+ import { action } from 'storybook/actions';
3
+
4
+ import MSegmentedControl from './MSegmentedControl.vue';
5
+
6
+ const meta: Meta<typeof MSegmentedControl> = {
7
+ title: 'Action/Segmented Control',
8
+ component: MSegmentedControl,
9
+ parameters: {
10
+ docs: {
11
+ description: {
12
+ component:
13
+ 'A Segmented Control allows users to switch between multiple options or views within a single container. It provides a compact and efficient way to toggle between sections without requiring a dropdown or separate navigation. Segmented Controls are commonly used in filters, tabbed navigation, and content selection to enhance user interaction and accessibility.',
14
+ },
15
+ },
16
+ },
17
+ args: {
18
+ segments: [
19
+ {
20
+ label: 'Label',
21
+ },
22
+ {
23
+ label: 'Label',
24
+ },
25
+ {
26
+ label: 'Label',
27
+ },
28
+ {
29
+ label: 'Label',
30
+ },
31
+ ],
32
+ },
33
+ render: (args) => ({
34
+ components: { MSegmentedControl },
35
+ setup() {
36
+ const handleUpdate = action('update:modelValue');
37
+
38
+ return { args, handleUpdate };
39
+ },
40
+ template: `
41
+ <MSegmentedControl
42
+ v-bind="args"
43
+ @update:modelValue="handleUpdate"
44
+ ></MSegmentedControl>
45
+ `,
46
+ }),
47
+ };
48
+ export default meta;
49
+ type Story = StoryObj<typeof MSegmentedControl>;
50
+
51
+ export const Default: Story = {};
52
+
53
+ export const Icons: Story = {
54
+ args: {
55
+ segments: [
56
+ {
57
+ label: 'Label',
58
+ },
59
+ {
60
+ label: 'Label',
61
+ },
62
+ {
63
+ label: 'Label',
64
+ },
65
+ {
66
+ label: 'Label',
67
+ },
68
+ ],
69
+ },
70
+ };
71
+
72
+ export const Size: Story = {
73
+ args: { size: 'm' },
74
+ };
75
+
76
+ export const Full: Story = {
77
+ args: { full: true },
78
+ };
@@ -0,0 +1,92 @@
1
+ <template>
2
+ <div class="mc-segmented-control" :class="classObject" role="radiogroup">
3
+ <button
4
+ v-for="(segment, index) in segments"
5
+ :key="`segment-${index}`"
6
+ type="button"
7
+ class="mc-segmented-control__segment"
8
+ :class="{
9
+ 'mc-segmented-control__segment--selected': isSegmentSelected(index),
10
+ }"
11
+ :aria-checked="isSegmentSelected(index)"
12
+ role="radio"
13
+ @click="onClickSegment(index)"
14
+ >
15
+ {{ segment.label }}
16
+ </button>
17
+ </div>
18
+ </template>
19
+
20
+ <script setup lang="ts">
21
+ import { computed, ref, watch } from 'vue';
22
+ /**
23
+ * A Segmented Control allows users to switch between multiple options or views within a single container. It provides a compact and efficient way to toggle between sections without requiring a dropdown or separate navigation. Segmented Controls are commonly used in filters, tabbed navigation, and content selection to enhance user interaction and accessibility.
24
+ */
25
+ const props = withDefaults(
26
+ defineProps<{
27
+ /**
28
+ * The selected segment index, bound via v-model.
29
+ */
30
+ modelValue?: number;
31
+ /**
32
+ * if `true`, the segmented control take the full width.
33
+ */
34
+ full?: boolean;
35
+ /**
36
+ * Determines the size of the segmented control.
37
+ */
38
+ size?: 's' | 'm';
39
+ /**
40
+ * An array of objects that allows you to provide all the data needed to generate the content for each segment.
41
+ */
42
+ segments: Array<{
43
+ /**
44
+ * The label displayed for the segment.
45
+ */
46
+ label: string;
47
+ }>;
48
+ }>(),
49
+ {
50
+ modelValue: 0,
51
+ size: 's',
52
+ },
53
+ );
54
+
55
+ const classObject = computed(() => {
56
+ return {
57
+ 'mc-segmented-control--full': props.full,
58
+ [`mc-segmented-control--${props.size}`]: props.size && props.size != 's',
59
+ };
60
+ });
61
+
62
+ const modelValue = ref(props.modelValue);
63
+
64
+ watch(
65
+ () => props.modelValue,
66
+ (newVal) => {
67
+ modelValue.value = newVal;
68
+ },
69
+ );
70
+
71
+ const onClickSegment = (index: number) => {
72
+ if (index !== modelValue.value) {
73
+ modelValue.value = index;
74
+ emit('update:modelValue', index);
75
+ }
76
+ };
77
+
78
+ const isSegmentSelected = (index: number) => {
79
+ return modelValue.value === index;
80
+ };
81
+
82
+ const emit = defineEmits<{
83
+ /**
84
+ * Emits when the selected segment changes, updating the modelValue prop.
85
+ */
86
+ (on: 'update:modelValue', value: number): void;
87
+ }>();
88
+ </script>
89
+
90
+ <style lang="scss" scoped>
91
+ @use '@mozaic-ds/styles/components/segmented-control';
92
+ </style>
@@ -0,0 +1,19 @@
1
+ # MSegmentedControl
2
+
3
+ A Segmented Control allows users to switch between multiple options or views within a single container. It provides a compact and efficient way to toggle between sections without requiring a dropdown or separate navigation. Segmented Controls are commonly used in filters, tabbed navigation, and content selection to enhance user interaction and accessibility.
4
+
5
+
6
+ ## Props
7
+
8
+ | Name | Description | Type | Default |
9
+ | --- | --- | --- | --- |
10
+ | `modelValue` | The selected segment index, bound via v-model. | `number` | `0` |
11
+ | `full` | if `true`, the segmented control take the full width. | `boolean` | - |
12
+ | `size` | Determines the size of the segmented control. | `"s"` `"m"` | `"s"` |
13
+ | `segments*` | An array of objects that allows you to provide all the data needed to generate the content for each segment. | `{ label: string; }[]` | - |
14
+
15
+ ## Events
16
+
17
+ | Name | Description | Type |
18
+ | --- | --- | --- |
19
+ | `update:modelValue` | Emits when the selected segment changes, updating the modelValue prop. | [value: number] |
@@ -30,7 +30,7 @@
30
30
  import { computed } from 'vue';
31
31
 
32
32
  /**
33
- * A select is a form element for multi-line text input, ideal for longer content like comments or descriptions.
33
+ * A select component allows users to choose a single option from a predefined list within a native dropdown menu. It helps simplify input by displaying only relevant choices, reducing the need for manual text entry. Select components are commonly used in forms, settings, and filters where structured selection is required.<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#select).
34
34
  */
35
35
  const props = withDefaults(
36
36
  defineProps<{
@@ -69,7 +69,7 @@ const props = withDefaults(
69
69
  */
70
70
  disabled?: boolean;
71
71
  /**
72
- * Determines the size of the select
72
+ * Determines the size of the select.
73
73
  */
74
74
  size?: 's' | 'm';
75
75
  /**
@@ -96,6 +96,10 @@ const emit = defineEmits<{
96
96
  */
97
97
  (on: 'update:modelValue', value: string | number): void;
98
98
  }>();
99
+
100
+ defineOptions({
101
+ inheritAttrs: false,
102
+ });
99
103
  </script>
100
104
 
101
105
  <style lang="scss" scoped>
@@ -0,0 +1,24 @@
1
+ # MSelect
2
+
3
+ A select component allows users to choose a single option from a predefined list within a native dropdown menu. It helps simplify input by displaying only relevant choices, reducing the need for manual text entry. Select components are commonly used in forms, settings, and filters where structured selection is required.<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#select).
4
+
5
+
6
+ ## Props
7
+
8
+ | Name | Description | Type | Default |
9
+ | --- | --- | --- | --- |
10
+ | `id*` | A unique identifier for the select, used to associate the label with the form element. | `string` | - |
11
+ | `name` | The name attribute for the select element, used for form submission. | `string` | - |
12
+ | `options*` | Define the available choices for the select element. | `{ id?: string` `undefined; text: string; value: string` `number; attributes?: Record<string` `string` `number` `boolean>` `undefined; disabled?: boolean` `undefined; }[]` | - |
13
+ | `modelValue` | The current value of the select. | `string` `number` | - |
14
+ | `placeholder` | Text displayed when the select has no selected value. | `string` | - |
15
+ | `isInvalid` | If `true`, the select is marked as invalid. | `boolean` | - |
16
+ | `disabled` | If `true`, the select is disabled and non-interactive. | `boolean` | - |
17
+ | `size` | Determines the size of the select. | `"s"` `"m"` | `"m"` |
18
+ | `readonly` | If `true`, the select is read-only (cannot be edited). | `boolean` | - |
19
+
20
+ ## Events
21
+
22
+ | Name | Description | Type |
23
+ | --- | --- | --- |
24
+ | `update:modelValue` | Emits when the select value changes, updating the modelValue prop. | [value: string | number] |
@@ -8,7 +8,7 @@ const meta: Meta<typeof MStatusBadge> = {
8
8
  docs: {
9
9
  description: {
10
10
  component:
11
- 'A status badge indicates the status of an entity and can evolve at any time.',
11
+ 'A Status Badge is used to indicate the current status of an element, providing a clear and concise visual cue. The status can change dynamically based on updates, events, or conditions within the system. Status Badges help users quickly identify the state of an item, such as an order status, system health, or process completion. They are often color-coded to enhance readability and recognition.',
12
12
  },
13
13
  },
14
14
  },
@@ -9,16 +9,16 @@
9
9
  import { computed } from 'vue';
10
10
  import MStatusDot from '../statusdot/MStatusDot.vue';
11
11
  /**
12
- * A status badge indicates the status of an entity and can evolve at any time.
12
+ * A Status Badge is used to indicate the current status of an element, providing a clear and concise visual cue. The status can change dynamically based on updates, events, or conditions within the system. Status Badges help users quickly identify the state of an item, such as an order status, system health, or process completion. They are often color-coded to enhance readability and recognition.
13
13
  */
14
14
  const props = withDefaults(
15
15
  defineProps<{
16
16
  /**
17
- * Content of the Status Badge
17
+ * Content of the status badge
18
18
  */
19
19
  label: string;
20
20
  /**
21
- * Allows to define the Status Badge style
21
+ * Allows to define the status badge type
22
22
  */
23
23
  status?: 'info' | 'success' | 'warning' | 'error' | 'neutral';
24
24
  }>(),
@@ -0,0 +1,11 @@
1
+ # MStatusBadge
2
+
3
+ A Status Badge is used to indicate the current status of an element, providing a clear and concise visual cue. The status can change dynamically based on updates, events, or conditions within the system. Status Badges help users quickly identify the state of an item, such as an order status, system health, or process completion. They are often color-coded to enhance readability and recognition.
4
+
5
+
6
+ ## Props
7
+
8
+ | Name | Description | Type | Default |
9
+ | --- | --- | --- | --- |
10
+ | `label*` | Content of the status badge | `string` | - |
11
+ | `status` | Allows to define the status badge type | `"info"` `"success"` `"warning"` `"error"` `"neutral"` | `"info"` |
@@ -4,6 +4,7 @@ import MStatusDot from './MStatusDot.vue';
4
4
  const meta: Meta<typeof MStatusDot> = {
5
5
  title: 'Status/Status Dot',
6
6
  component: MStatusDot,
7
+ tags: ['v2'],
7
8
  parameters: {
8
9
  docs: {
9
10
  description: {
@@ -5,16 +5,16 @@
5
5
  <script setup lang="ts">
6
6
  import { computed } from 'vue';
7
7
  /**
8
- * A badge indicates the status of an entity and can evolve at any time.
8
+ * A Status dot is a small visual indicator used to represent the state or condition of an element. It is often color-coded to convey different statuses at a glance, such as availability, activity, or urgency. Status Dots are commonly found in user presence indicators, system statuses, or process tracking to provide quick, unobtrusive feedback.
9
9
  */
10
10
  const props = withDefaults(
11
11
  defineProps<{
12
12
  /**
13
- * Allows to define the Status Dot style
13
+ * Allows to define the status dot type.
14
14
  */
15
15
  status?: 'info' | 'success' | 'warning' | 'error' | 'neutral';
16
16
  /**
17
- * Determines the size of the Status Dot.
17
+ * Determines the size of the status dot.
18
18
  */
19
19
  size?: 's' | 'm' | 'l';
20
20
  }>(),
@@ -0,0 +1,11 @@
1
+ # MStatusDot
2
+
3
+ A Status dot is a small visual indicator used to represent the state or condition of an element. It is often color-coded to convey different statuses at a glance, such as availability, activity, or urgency. Status Dots are commonly found in user presence indicators, system statuses, or process tracking to provide quick, unobtrusive feedback.
4
+
5
+
6
+ ## Props
7
+
8
+ | Name | Description | Type | Default |
9
+ | --- | --- | --- | --- |
10
+ | `status` | Allows to define the status dot type. | `"info"` `"success"` `"warning"` `"error"` `"neutral"` | `"info"` |
11
+ | `size` | Determines the size of the status dot. | `"s"` `"m"` `"l"` | - |
@@ -46,15 +46,15 @@ import MIconButton from '../iconbutton/MIconButton.vue';
46
46
  const props = withDefaults(
47
47
  defineProps<{
48
48
  /**
49
- * Title of the Status Notification
49
+ * Title of the status notification.
50
50
  */
51
51
  title: string;
52
52
  /**
53
- * Description of the Status Notification
53
+ * Description of the status notification.
54
54
  */
55
55
  description: string;
56
56
  /**
57
- * Allows to define the Status Notification style
57
+ * Allows to define the status notification type.
58
58
  */
59
59
  status?: 'info' | 'success' | 'warning' | 'error';
60
60
  /**
@@ -0,0 +1,25 @@
1
+ # MStatusNotification
2
+
3
+ A Status Notification is used to draw the user’s attention to important information that needs to be acknowledged. It often provides feedback on a process, highlights a status update, or alerts users about an issue. Notifications are typically triggered by user actions or system events and are designed to be easily noticeable while maintaining a non-intrusive experience.
4
+
5
+
6
+ ## Props
7
+
8
+ | Name | Description | Type | Default |
9
+ | --- | --- | --- | --- |
10
+ | `title*` | Title of the status notification. | `string` | - |
11
+ | `description*` | Description of the status notification. | `string` | - |
12
+ | `status` | Allows to define the status notification type. | `"info"` `"success"` `"warning"` `"error"` | `"info"` |
13
+ | `closable` | if `true`, display the close button. | `boolean` | - |
14
+
15
+ ## Slots
16
+
17
+ | Name | Description |
18
+ | --- | --- |
19
+ | `footer` | Use this slot to insert a button or a link in the footer |
20
+
21
+ ## Events
22
+
23
+ | Name | Description | Type |
24
+ | --- | --- | --- |
25
+ | `close` | Emits when closing the notification. | [] |
@@ -39,7 +39,7 @@ const meta: Meta<typeof Mtabs> = {
39
39
  return { args, handleUpdate };
40
40
  },
41
41
  template: `
42
- <Mtabs
42
+ <Mtabs
43
43
  v-bind="args"
44
44
  @update:modelValue="handleUpdate"
45
45
  ></Mtabs>
@@ -102,3 +102,25 @@ export const Disabled: Story = {
102
102
  ],
103
103
  },
104
104
  };
105
+
106
+ export const WithBadges: Story = {
107
+ args: {
108
+ tabs: [
109
+ {
110
+ label: 'Label',
111
+ badge: 3,
112
+ },
113
+ {
114
+ label: 'Label',
115
+ },
116
+ {
117
+ label: 'Label',
118
+ badge: 99,
119
+ },
120
+ {
121
+ label: 'Label',
122
+ badge: 100,
123
+ },
124
+ ],
125
+ },
126
+ };
@@ -25,6 +25,9 @@
25
25
  <div class="mc-tabs__label">
26
26
  <span>{{ tab.label }}</span>
27
27
  </div>
28
+ <span v-if="tab.badge" class="mc-tabs__badge">
29
+ <MNumberBadge :label="tab.badge" />
30
+ </span>
28
31
  </button>
29
32
  </li>
30
33
  </ul>
@@ -35,6 +38,7 @@
35
38
  <script setup lang="ts">
36
39
  import { computed, ref, type Component } from 'vue';
37
40
  import MDivider from '../divider/MDivider.vue';
41
+ import MNumberBadge from '../numberbadge/MNumberBadge.vue';
38
42
  /**
39
43
  * Tabs are a navigation component that allows users to switch between different sections within the same context. They help organize content efficiently by displaying only one section at a time, reducing clutter and improving accessibility. Tabs can include icons, labels, and notification badges to provide additional context. They are commonly used in dashboards, product management, and settings interfaces.
40
44
  */
@@ -64,6 +68,10 @@ const props = withDefaults(
64
68
  * The icon displayed for the tab from Mozaic-icon-vue.
65
69
  */
66
70
  icon?: Component;
71
+ /**
72
+ * The number badge displayed for the tab.
73
+ */
74
+ badge?: number;
67
75
  /**
68
76
  * The label displayed for the tab.
69
77
  */
@@ -1,7 +1,7 @@
1
1
  import { mount } from '@vue/test-utils';
2
2
  import { describe, it, expect } from 'vitest';
3
3
  import MTabs from './MTabs.vue';
4
- import { defineComponent, h } from 'vue';
4
+ import { defineComponent, h, markRaw } from 'vue';
5
5
 
6
6
  describe('MTabs.vue', () => {
7
7
  const tabs = [{ label: 'Tab 1' }, { label: 'Tab 2' }, { label: 'Tab 3' }];
@@ -119,14 +119,16 @@ describe('MTabs.vue', () => {
119
119
  });
120
120
 
121
121
  it('renders icon component when icon prop is provided', () => {
122
- const DummyIcon = defineComponent({
123
- name: 'DummyIcon',
124
- render() {
125
- return h('svg', { class: 'dummy-icon' }, [
126
- h('circle', { cx: 10, cy: 10, r: 10 }),
127
- ]);
128
- },
129
- });
122
+ const DummyIcon = markRaw(
123
+ defineComponent({
124
+ name: 'DummyIcon',
125
+ render() {
126
+ return h('svg', { class: 'dummy-icon' }, [
127
+ h('circle', { cx: 10, cy: 10, r: 10 }),
128
+ ]);
129
+ },
130
+ }),
131
+ );
130
132
 
131
133
  const tabsWithIcon = [
132
134
  { label: 'Tab 1', icon: DummyIcon },
@@ -146,4 +148,23 @@ describe('MTabs.vue', () => {
146
148
  const secondTabButton = wrapper.findAll('button.mc-tabs__tab')[1];
147
149
  expect(secondTabButton.findComponent(DummyIcon).exists()).toBe(false);
148
150
  });
151
+
152
+ it('renders badge when badge prop is provided', () => {
153
+ const tabsWithBadges = [{ label: 'Tab 1', badge: 5 }, { label: 'Tab 2' }];
154
+
155
+ const wrapper = mount(MTabs, {
156
+ props: {
157
+ tabs: tabsWithBadges,
158
+ },
159
+ });
160
+
161
+ const firstTabButton = wrapper.findAll('button.mc-tabs__tab')[0];
162
+ expect(firstTabButton.find('span.mc-tabs__badge').exists()).toBe(true);
163
+ expect(
164
+ firstTabButton.find('span.mc-tabs__badge .mc-number-badge').text(),
165
+ ).toBe('5');
166
+
167
+ const secondTabButton = wrapper.findAll('button.mc-tabs__tab')[1];
168
+ expect(secondTabButton.find('span.mc-tabs__badge').exists()).toBe(false);
169
+ });
149
170
  });
@@ -0,0 +1,20 @@
1
+ # MTabs
2
+
3
+ Tabs are a navigation component that allows users to switch between different sections within the same context. They help organize content efficiently by displaying only one section at a time, reducing clutter and improving accessibility. Tabs can include icons, labels, and notification badges to provide additional context. They are commonly used in dashboards, product management, and settings interfaces.
4
+
5
+
6
+ ## Props
7
+
8
+ | Name | Description | Type | Default |
9
+ | --- | --- | --- | --- |
10
+ | `description` | A description indicating the purpose of the set of tabs. Useful for improving the accessibility of the component. | `string` | - |
11
+ | `divider` | If `true`, the divider will appear. | `boolean` | `true` |
12
+ | `centered` | If `true`, the tabs of the component will be centered. | `boolean` | - |
13
+ | `modelValue` | The selected tab index, bound via v-model. | `number` | `0` |
14
+ | `tabs*` | An array of objects that allows you to provide all the data needed to generate the content for each tab. | `{ icon?: Component` `undefined; badge?: number` `undefined; label: string; disabled?: boolean` `undefined; }[]` | - |
15
+
16
+ ## Events
17
+
18
+ | Name | Description | Type |
19
+ | --- | --- | --- |
20
+ | `update:modelValue` | Emits when the selected tab changes, updating the modelValue prop. | [value: number] |
@@ -9,7 +9,7 @@ const meta: Meta<typeof MTag> = {
9
9
  docs: {
10
10
  description: {
11
11
  component:
12
- 'A Status dot is a small visual indicator used to represent the state or condition of an element. It is often color-coded to convey different statuses at a glance, such as availability, activity, or urgency. Status Dots are commonly found in user presence indicators, system statuses, or process tracking to provide quick, unobtrusive feedback.',
12
+ 'A Tag is a UI element used to filter data, categorize, select or deselect an option. It can appear standalone, in a group, or embedded within other components. Depending on its use, a tag can be interactive (clickable, removable, selectable) or static (serving as a visual indicator).',
13
13
  },
14
14
  },
15
15
  },
@@ -144,6 +144,10 @@ const emit = defineEmits<{
144
144
  */
145
145
  (on: 'remove-tag', id: string): void;
146
146
  }>();
147
+
148
+ defineOptions({
149
+ inheritAttrs: false,
150
+ });
147
151
  </script>
148
152
 
149
153
  <style lang="scss" scoped>
@@ -0,0 +1,25 @@
1
+ # MTag
2
+
3
+ A Tag is a UI element used to filter data, categorize, select or deselect an option. It can appear standalone, in a group, or embedded within other components. Depending on its use, a tag can be interactive (clickable, removable, selectable) or static (serving as a visual indicator).
4
+
5
+
6
+ ## Props
7
+
8
+ | Name | Description | Type | Default |
9
+ | --- | --- | --- | --- |
10
+ | `type` | Defines the behavior and layout of the tag. | `"informative"` `"interactive"` `"contextualised"` `"removable"` `"selectable"` | `"informative"` |
11
+ | `size` | Determines the size of the tag. | `"s"` `"m"` `"l"` | - |
12
+ | `id` | A unique identifier for the tag, used to associate the label with the form element. **Required** when type is 'selectable' or 'removable'. | `string` | - |
13
+ | `name` | The name attribute for the tag element, typically used for form submission. (only relevant for type: 'selectable'). | `string` | - |
14
+ | `label*` | The text label displayed next to the tag. | `string` | - |
15
+ | `modelValue` | The tag's checked state, bound via v-model. Used only for type: 'selectable'. | `boolean` | - |
16
+ | `disabled` | If `true`, disables the tag, making it non-interactive. Applicable to selectable, interactive, and contextualised types. | `boolean` | - |
17
+ | `contextualisedNumber` | A number displayed in the badge when the tag is contextualised. | `number` | `99` |
18
+ | `removableLabel` | Accessible label text for the remove button in removable tags. | `string` | - |
19
+
20
+ ## Events
21
+
22
+ | Name | Description | Type |
23
+ | --- | --- | --- |
24
+ | `update:modelValue` | Emits when the tag value changes, updating the modelValue prop. | [value: boolean] |
25
+ | `remove-tag` | Emits when the remove button of a tag is clicked, passing the tag's ID. | [id: string] |
@@ -23,7 +23,7 @@
23
23
  import { computed } from 'vue';
24
24
 
25
25
  /**
26
- * A textarea is a form element for multi-line text input, ideal for longer content like comments or descriptions.
26
+ * A text area is an input designed for multi-line text entry, allowing users to input longer content compared to a standard text input. It is commonly used for comments, feedback, descriptions, and messaging. Text areas can be resizable or fixed in height, depending on the context, and often include placeholder text, character limits, and validation messages to guide users.<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#textarea).
27
27
  */
28
28
  const props = withDefaults(
29
29
  defineProps<{
@@ -85,6 +85,10 @@ const emit = defineEmits<{
85
85
  */
86
86
  (on: 'update:modelValue', value: string | number): void;
87
87
  }>();
88
+
89
+ defineOptions({
90
+ inheritAttrs: false,
91
+ });
88
92
  </script>
89
93
 
90
94
  <style lang="scss" scoped>
@@ -0,0 +1,25 @@
1
+ # MTextArea
2
+
3
+ A text area is an input designed for multi-line text entry, allowing users to input longer content compared to a standard text input. It is commonly used for comments, feedback, descriptions, and messaging. Text areas can be resizable or fixed in height, depending on the context, and often include placeholder text, character limits, and validation messages to guide users.<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#textarea).
4
+
5
+
6
+ ## Props
7
+
8
+ | Name | Description | Type | Default |
9
+ | --- | --- | --- | --- |
10
+ | `id*` | A unique identifier for the textarea, used to associate the label with the form element. | `string` | - |
11
+ | `name` | The name attribute for the textarea element, used for form submission. | `string` | - |
12
+ | `modelValue` | The current value of the textarea field. | `string` `number` | - |
13
+ | `placeholder` | Text displayed when the textarea is empty. | `string` | - |
14
+ | `isInvalid` | If `true`, the textarea is marked as invalid. | `boolean` | - |
15
+ | `disabled` | If `true`, the textarea is disabled and non-interactive. | `boolean` | - |
16
+ | `rows` | The number of visible text lines in the textarea. | `number` | `2` |
17
+ | `minLength` | Minimum number of characters required for the textarea. | `number` | - |
18
+ | `maxLength` | Maximum number of characters allowed in the textarea. | `number` | - |
19
+ | `readonly` | If `true`, the textarea is read-only (cannot be edited). | `boolean` | - |
20
+
21
+ ## Events
22
+
23
+ | Name | Description | Type |
24
+ | --- | --- | --- |
25
+ | `update:modelValue` | Emits when the textarea value changes, updating the modelValue prop. | [value: string | number] |