@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
@@ -21,6 +21,10 @@ defineProps<{
21
21
  */
22
22
  text?: string;
23
23
  }>();
24
+
25
+ defineOptions({
26
+ inheritAttrs: false,
27
+ });
24
28
  </script>
25
29
 
26
30
  <style lang="scss" scoped>
@@ -0,0 +1,11 @@
1
+ # MLoadingOverlay
2
+
3
+ A loading overlay is a full-screen or container-level layer that indicates a process is in progress, preventing user interaction until the task is completed. It includes a progress indicator, and a message to inform users about the loading state. Loading Overlays are commonly used in data-heavy applications, form submissions, and page transitions to enhance user experience by managing wait times effectively.
4
+
5
+
6
+ ## Props
7
+
8
+ | Name | Description | Type | Default |
9
+ | --- | --- | --- | --- |
10
+ | `isVisible` | Controls the visibility of the loading overlay. | `boolean` | - |
11
+ | `text` | Text of the loading overlay. | `string` | - |
@@ -61,11 +61,11 @@ const props = withDefaults(
61
61
  */
62
62
  open?: boolean;
63
63
  /**
64
- * Title of the modal
64
+ * Title of the modal.
65
65
  */
66
66
  title: string;
67
67
  /**
68
- * Description of the modal
68
+ * Description of the modal.
69
69
  */
70
70
  description?: string;
71
71
  /**
@@ -80,19 +80,19 @@ const props = withDefaults(
80
80
 
81
81
  defineSlots<{
82
82
  /**
83
- * Use this slot to insert an icon next to the title of the modal
83
+ * Use this slot to insert an icon next to the title of the modal.
84
84
  */
85
85
  icon?: VNode;
86
86
  /**
87
- * Use this slot to insert the content of the modal
87
+ * Use this slot to insert the content of the modal.
88
88
  */
89
89
  default?: VNode;
90
90
  /**
91
- * Use this slot to insert a link in the footer
91
+ * Use this slot to insert a link in the footer.
92
92
  */
93
93
  link?: VNode;
94
94
  /**
95
- * Use this slot to insert buttons in the footer
95
+ * Use this slot to insert buttons in the footer.
96
96
  */
97
97
  footer?: VNode;
98
98
  }>();
@@ -116,10 +116,14 @@ const onClose = () => {
116
116
 
117
117
  const emit = defineEmits<{
118
118
  /**
119
- * Emits when the checkbox value changes, updating the modelValue prop.
119
+ * Emits when the modal display changes, updating the modelValue prop.
120
120
  */
121
121
  (on: 'update:open', value: boolean): void;
122
122
  }>();
123
+
124
+ defineOptions({
125
+ inheritAttrs: false,
126
+ });
123
127
  </script>
124
128
 
125
129
  <style lang="scss" scoped>
@@ -0,0 +1,28 @@
1
+ # MModal
2
+
3
+ A modal is a dialog window that appears on top of the main content, requiring user interaction before returning to the main interface. It is used to focus attention on a specific task, provide important information, or request confirmation for an action. Modals typically include a title, description, and primary/secondary actions and should be used for single, focused tasks to avoid disrupting the user experience.
4
+
5
+
6
+ ## Props
7
+
8
+ | Name | Description | Type | Default |
9
+ | --- | --- | --- | --- |
10
+ | `open` | if `true`, display the modal. | `boolean` | - |
11
+ | `title*` | Title of the modal. | `string` | - |
12
+ | `description` | Description of the modal. | `string` | - |
13
+ | `closable` | if `true`, display the close button. | `boolean` | `true` |
14
+
15
+ ## Slots
16
+
17
+ | Name | Description |
18
+ | --- | --- |
19
+ | `icon` | Use this slot to insert an icon next to the title of the modal. |
20
+ | `default` | Use this slot to insert the content of the modal. |
21
+ | `link` | Use this slot to insert a link in the footer. |
22
+ | `footer` | Use this slot to insert buttons in the footer. |
23
+
24
+ ## Events
25
+
26
+ | Name | Description | Type |
27
+ | --- | --- | --- |
28
+ | `update:open` | Emits when the modal display changes, updating the modelValue prop. | [value: boolean] |
@@ -7,21 +7,21 @@
7
7
  <script setup lang="ts">
8
8
  import { computed } from 'vue';
9
9
  /**
10
- * A badge indicates the status of an entity and can evolve at any time.
10
+ * 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.
11
11
  */
12
12
  const props = withDefaults(
13
13
  defineProps<{
14
14
  /**
15
- * Content of the badge
15
+ * Content of the badge.
16
16
  */
17
17
  label: number;
18
18
  /**
19
- * Allows to define the Badge style
19
+ * Allows to define the badge appearance.
20
20
  */
21
21
  appearance?: 'danger' | 'accent' | 'inverse' | 'standard';
22
22
 
23
23
  /**
24
- * Allows to define the Badge size
24
+ * Allows to define the badge size.
25
25
  */
26
26
  size?: 's' | 'm';
27
27
  }>(),
@@ -0,0 +1,12 @@
1
+ # MNumberBadge
2
+
3
+ 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.
4
+
5
+
6
+ ## Props
7
+
8
+ | Name | Description | Type | Default |
9
+ | --- | --- | --- | --- |
10
+ | `label*` | Content of the badge. | `number` | - |
11
+ | `appearance` | Allows to define the badge appearance. | `"standard"` `"inverse"` `"accent"` `"danger"` | `"standard"` |
12
+ | `size` | Allows to define the badge size. | `"s"` `"m"` | `"s"` |
@@ -10,7 +10,7 @@ const meta: Meta<typeof MOverlay> = {
10
10
  story: { height: '400px' },
11
11
  description: {
12
12
  component:
13
- 'An overlay component is a UI element that appears above the main content to display additional information or interactions, often blocking or dimming the background.',
13
+ 'An overlay is a semi-transparent layer that appears on top of the main content, typically used to dim the background and focus user attention on a specific element. It is often combined with modals, popovers, or loading states to create a visual separation between the foreground and background. Overlays help prevent unintended interactions while keeping the primary content accessible.',
14
14
  },
15
15
  },
16
16
  },
@@ -10,7 +10,7 @@
10
10
  import type { VNode } from 'vue';
11
11
 
12
12
  /**
13
- * An overlay component is a UI element that appears above the main content to display additional information or interactions, often blocking or dimming the background.
13
+ * An overlay is a semi-transparent layer that appears on top of the main content, typically used to dim the background and focus user attention on a specific element. It is often combined with modals, popovers, or loading states to create a visual separation between the foreground and background. Overlays help prevent unintended interactions while keeping the primary content accessible.
14
14
  */
15
15
  defineProps<{
16
16
  /**
@@ -25,7 +25,7 @@ defineProps<{
25
25
 
26
26
  defineSlots<{
27
27
  /**
28
- * Use this slot to insert a centered content inside the overlay
28
+ * Use this slot to insert a centered content inside the overlay.
29
29
  */
30
30
  default?: VNode;
31
31
  }>();
@@ -0,0 +1,17 @@
1
+ # MOverlay
2
+
3
+ An overlay is a semi-transparent layer that appears on top of the main content, typically used to dim the background and focus user attention on a specific element. It is often combined with modals, popovers, or loading states to create a visual separation between the foreground and background. Overlays help prevent unintended interactions while keeping the primary content accessible.
4
+
5
+
6
+ ## Props
7
+
8
+ | Name | Description | Type | Default |
9
+ | --- | --- | --- | --- |
10
+ | `isVisible` | Controls the visibility of the overlay. | `boolean` | - |
11
+ | `dialogLabel` | Accessible label for the overlay dialog. | `string` | - |
12
+
13
+ ## Slots
14
+
15
+ | Name | Description |
16
+ | --- | --- |
17
+ | `default` | Use this slot to insert a centered content inside the overlay. |
@@ -40,6 +40,7 @@ const meta: Meta<typeof MPagination> = {
40
40
  },
41
41
  ],
42
42
  selectLabel: 'Select page',
43
+ ariaLabel: 'pagination',
43
44
  },
44
45
  render: (args) => ({
45
46
  components: { MPagination },
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <nav class="mc-pagination" role="navigation" aria-label="pagination">
2
+ <nav class="mc-pagination" role="navigation">
3
3
  <MButton
4
4
  v-if="!compact"
5
5
  icon-position="only"
@@ -0,0 +1,20 @@
1
+ # MPagination
2
+
3
+ Pagination is a navigation component that allows users to browse through large sets of content by dividing it into discrete pages. It typically includes previous and next buttons, numeric page selectors, or dropdowns to jump between pages efficiently. Pagination improves usability and performance in content-heavy applications such as tables, search results, and articles by preventing long scrolls and reducing page load times.
4
+
5
+
6
+ ## Props
7
+
8
+ | Name | Description | Type | Default |
9
+ | --- | --- | --- | --- |
10
+ | `id*` | A unique identifier for the pagination. | `string` | - |
11
+ | `modelValue*` | The current value of the selected page. | `number` | - |
12
+ | `compact` | If `true`, display a compact version without the select. | `boolean` | - |
13
+ | `options*` | Define the available choices for the pagination select element. | `{ id?: string` `undefined; text: string; value: number; }[]` | - |
14
+ | `selectLabel` | Accessible label for the select of the pagination. | `string` | - |
15
+
16
+ ## Events
17
+
18
+ | Name | Description | Type |
19
+ | --- | --- | --- |
20
+ | `update:modelValue` | Emits when the pagination value changes, updating the modelValue prop. | [value: number] |
@@ -81,11 +81,11 @@ const props = withDefaults(
81
81
  */
82
82
  isClearable?: boolean;
83
83
  /**
84
- * The label text for the clear button
84
+ * The label text for the clear button.
85
85
  */
86
86
  clearLabel?: string;
87
87
  /**
88
- * Labels of the button displayed when showing or hiding the password
88
+ * Labels of the button displayed when showing or hiding the password.
89
89
  */
90
90
  buttonLabel?: {
91
91
  show: string;
@@ -137,6 +137,10 @@ const emit = defineEmits<{
137
137
  */
138
138
  (on: 'update:modelValue', value: string | number): void;
139
139
  }>();
140
+
141
+ defineOptions({
142
+ inheritAttrs: false,
143
+ });
140
144
  </script>
141
145
 
142
146
  <style lang="scss" scoped>
@@ -0,0 +1,25 @@
1
+ # MPasswordInput
2
+
3
+ A password input is a specialized input field used to securely enter and manage passwords. It typically masks the characters entered to protect sensitive information from being seen. It includes a toggle button to show or hide the password, improving usability while maintaining security. Password inputs are commonly used in login forms, account creation, and authentication flows.
4
+
5
+
6
+ ## Props
7
+
8
+ | Name | Description | Type | Default |
9
+ | --- | --- | --- | --- |
10
+ | `id*` | A unique identifier for the password input element, used to associate the label with the form element. | `string` | - |
11
+ | `name` | The name attribute for the password input element, typically used for form submission. | `string` | - |
12
+ | `modelValue` | The current value of the password input field. | `string` `number` | - |
13
+ | `placeholder` | A placeholder text to show in the password input when it is empty. | `string` | - |
14
+ | `isInvalid` | If `true`, applies an invalid state to the password input. | `boolean` | - |
15
+ | `disabled` | If `true`, disables the password input, making it non-interactive. | `boolean` | - |
16
+ | `readonly` | If `true`, the password input is read-only (cannot be edited). | `boolean` | - |
17
+ | `isClearable` | If `true`, a clear button will appear when the password input has a value. | `boolean` | - |
18
+ | `clearLabel` | The label text for the clear button. | `string` | `"Clear content"` |
19
+ | `buttonLabel` | Labels of the button displayed when showing or hiding the password. | `{ show: string; hide: string; }` | `{ show: "Show", hide: "Hide" }` |
20
+
21
+ ## Events
22
+
23
+ | Name | Description | Type |
24
+ | --- | --- | --- |
25
+ | `update:modelValue` | Emits when the input value changes, updating the `modelValue` prop. | [value: string | number] |
@@ -93,7 +93,10 @@ describe('MPincode component', () => {
93
93
  },
94
94
  });
95
95
 
96
- expect(wrapper.classes()).toContain('is-invalid');
96
+ const inputs = wrapper.findAll('input');
97
+ for (const input of inputs) {
98
+ expect(input.classes()).toContain('is-invalid');
99
+ }
97
100
  });
98
101
 
99
102
  it('disables inputs when disabled is true', () => {
@@ -6,11 +6,12 @@ import MPincode from './MPincode.vue';
6
6
  const meta: Meta<typeof MPincode> = {
7
7
  title: 'Form Elements/Pincode',
8
8
  component: MPincode,
9
+ tags: ['v2'],
9
10
  parameters: {
10
11
  docs: {
11
12
  description: {
12
13
  component:
13
- 'A pincode input is a specialized input field used to enter short numeric codes, such as verification codes, security PINs, or authentication tokens. It typically separates each digit into individual fields to improve readability and ease of entry. This component is commonly used in two-factor authentication (2FA), password recovery, and secure access flows, ensuring a structured and user-friendly experience.',
14
+ 'A pincode input is a specialized input field used to enter short numeric codes, such as verification codes, security PINs, or authentication tokens. It typically separates each digit into individual fields to improve readability and ease of entry. This component is commonly used in two-factor authentication (2FA), password recovery, and secure access flows, ensuring a structured and user-friendly experience.<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).',
14
15
  },
15
16
  },
16
17
  },
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="mc-pincode-input" :class="classObject" @paste="onPaste">
2
+ <div class="mc-pincode-input" @paste="onPaste">
3
3
  <input
4
4
  v-for="(digit, index) in otp"
5
5
  :key="index"
@@ -12,6 +12,7 @@
12
12
  autocomplete="one-time-code"
13
13
  :name="name || `pincode-${id}`"
14
14
  class="mc-pincode-input__control"
15
+ :class="classObject"
15
16
  :disabled="disabled"
16
17
  :readonly="readonly"
17
18
  :value="digit"
@@ -32,7 +33,7 @@ import {
32
33
  type ComponentPublicInstance,
33
34
  } from 'vue';
34
35
  /**
35
- * A pincode input is a specialized input field used to enter short numeric codes, such as verification codes, security PINs, or authentication tokens. It typically separates each digit into individual fields to improve readability and ease of entry. This component is commonly used in two-factor authentication (2FA), password recovery, and secure access flows, ensuring a structured and user-friendly experience.
36
+ * A pincode input is a specialized input field used to enter short numeric codes, such as verification codes, security PINs, or authentication tokens. It typically separates each digit into individual fields to improve readability and ease of entry. This component is commonly used in two-factor authentication (2FA), password recovery, and secure access flows, ensuring a structured and user-friendly experience.<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).
36
37
  */
37
38
  const props = withDefaults(
38
39
  defineProps<{
@@ -77,6 +78,9 @@ const classObject = computed(() => {
77
78
  });
78
79
 
79
80
  const emit = defineEmits<{
81
+ /**
82
+ * Emits when the pincode value changes, updating the modelValue prop.
83
+ */
80
84
  (on: 'update:modelValue', value: string): void;
81
85
  }>();
82
86
 
@@ -141,6 +145,10 @@ const onPaste = (e: ClipboardEvent) => {
141
145
  emit('update:modelValue', otp.value.join(''));
142
146
  focusInput(Math.min(digits.length, props.length - 1));
143
147
  };
148
+
149
+ defineOptions({
150
+ inheritAttrs: false,
151
+ });
144
152
  </script>
145
153
 
146
154
  <style lang="scss" scoped>
@@ -0,0 +1,22 @@
1
+ # MPincode
2
+
3
+ A pincode input is a specialized input field used to enter short numeric codes, such as verification codes, security PINs, or authentication tokens. It typically separates each digit into individual fields to improve readability and ease of entry. This component is commonly used in two-factor authentication (2FA), password recovery, and secure access flows, ensuring a structured and user-friendly experience.<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 pincode element, used to associate the label with the form element. | `string` | - |
11
+ | `length` | The number of input displayed in the pincode element. | `4` `5` `6` | `6` |
12
+ | `name` | The name attribute for the pincode element, typically used for form submission. | `string` | - |
13
+ | `modelValue` | The current value of the pincode field. | `string` `number` | - |
14
+ | `isInvalid` | If `true`, applies an invalid state to the pincode. | `boolean` | - |
15
+ | `disabled` | If `true`, disables the pincode, making it non-interactive. | `boolean` | - |
16
+ | `readonly` | If `true`, the pincode is read-only (cannot be edited). | `boolean` | - |
17
+
18
+ ## Events
19
+
20
+ | Name | Description | Type |
21
+ | --- | --- | --- |
22
+ | `update:modelValue` | - | `[value: string]` |
@@ -10,7 +10,7 @@ const meta: Meta<typeof MQuantitySelector> = {
10
10
  docs: {
11
11
  description: {
12
12
  component:
13
- 'A quantity selector is an input component that allows users to increment or decrement a numeric value, typically using plus (+) and minus (−) buttons. It provides a simple and efficient way to adjust quantities without manual typing, ensuring controlled input. This component is commonly used in e-commerce, inventory management, and settings where users need to specify amounts.',
13
+ 'A quantity selector is an input component that allows users to increment or decrement a numeric value, typically using plus (+) and minus (−) buttons. It provides a simple and efficient way to adjust quantities without manual typing, ensuring controlled input. This component is commonly used in e-commerce, inventory management, and settings where users need to specify amounts.<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).',
14
14
  },
15
15
  },
16
16
  },
@@ -55,7 +55,7 @@ import More24 from '@mozaic-ds/icons-vue/src/components/More24/More24.vue';
55
55
  import Less24 from '@mozaic-ds/icons-vue/src/components/Less24/Less24.vue';
56
56
 
57
57
  /**
58
- * The quantity selector is a form element used to enter or select a number. This type of input is best used when the user needs to choose the quantity of a selected item, like a product before adding to cart for example.
58
+ * A quantity selector is an input component that allows users to increment or decrement a numeric value, typically using plus (+) and minus (−) buttons. It provides a simple and efficient way to adjust quantities without manual typing, ensuring controlled input. This component is commonly used in e-commerce, inventory management, and settings where users need to specify amounts.
59
59
  */
60
60
  const props = withDefaults(
61
61
  defineProps<{
@@ -80,7 +80,7 @@ const props = withDefaults(
80
80
  */
81
81
  disabled?: boolean;
82
82
  /**
83
- * Determines the size of the quantity selector
83
+ * Determines the size of the quantity selector.
84
84
  */
85
85
  size?: 's' | 'm';
86
86
  /**
@@ -170,6 +170,10 @@ const emit = defineEmits<{
170
170
  */
171
171
  (on: 'update:modelValue', value: number): void;
172
172
  }>();
173
+
174
+ defineOptions({
175
+ inheritAttrs: false,
176
+ });
173
177
  </script>
174
178
 
175
179
  <style lang="scss" scoped>
@@ -0,0 +1,27 @@
1
+ # MQuantitySelector
2
+
3
+ A quantity selector is an input component that allows users to increment or decrement a numeric value, typically using plus (+) and minus (−) buttons. It provides a simple and efficient way to adjust quantities without manual typing, ensuring controlled input. This component is commonly used in e-commerce, inventory management, and settings where users need to specify amounts.
4
+
5
+
6
+ ## Props
7
+
8
+ | Name | Description | Type | Default |
9
+ | --- | --- | --- | --- |
10
+ | `id*` | A unique identifier for the quantity selector element, used to associate the label with the form element. | `string` | - |
11
+ | `name` | The name attribute for the quantity selector element, typically used for form submission. | `string` | `"quantity-selector-input"` |
12
+ | `modelValue` | The current value of the quantity selector field. | `number` | `1` |
13
+ | `isInvalid` | If `true`, applies an invalid state to the quantity selector. | `boolean` | - |
14
+ | `disabled` | If `true`, disables the quantity selector, making it non-interactive. | `boolean` | - |
15
+ | `size` | Determines the size of the quantity selector. | `"s"` `"m"` | `"m"` |
16
+ | `min` | Minimum acceptable value for the quantity selector. | `number` | `1` |
17
+ | `max` | Maximum acceptable value for the quantity selector. | `number` | `100` |
18
+ | `step` | Determines how much the value will change per click when the quantity is increased or decreased. | `number` | `1` |
19
+ | `readonly` | If `true`, the quantity selector is read-only (cannot be edited). | `boolean` | - |
20
+ | `incrementlabel` | The label text for the increment button. | `string` | `"Increment"` |
21
+ | `decrementLabel` | The label text for the decrement button. | `string` | `"Decrement"` |
22
+
23
+ ## Events
24
+
25
+ | Name | Description | Type |
26
+ | --- | --- | --- |
27
+ | `update:modelValue` | Emits when the quantity selector value changes, updating the `modelValue` prop. | [value: number] |
@@ -24,7 +24,7 @@
24
24
  import { computed } from 'vue';
25
25
 
26
26
  /**
27
- * A radio button is used to offer a unique choice to your user in a form. Unlike checkboxes, it can not be used alone.
27
+ * A radio button is a selection control that allows users to choose a single option from a list of mutually exclusive choices. Unlike checkboxes, only one option can be selected at a time within the same group. Radio Buttons are commonly used in forms, surveys, and settings where a single choice must be made.
28
28
  */
29
29
  const props = defineProps<{
30
30
  /**
@@ -65,6 +65,10 @@ const emit = defineEmits<{
65
65
  */
66
66
  (on: 'update:modelValue', value: boolean): void;
67
67
  }>();
68
+
69
+ defineOptions({
70
+ inheritAttrs: false,
71
+ });
68
72
  </script>
69
73
 
70
74
  <style lang="scss" scoped>
@@ -0,0 +1,21 @@
1
+ # MRadio
2
+
3
+ A radio button is a selection control that allows users to choose a single option from a list of mutually exclusive choices. Unlike checkboxes, only one option can be selected at a time within the same group. Radio Buttons are commonly used in forms, surveys, and settings where a single choice must be made.
4
+
5
+
6
+ ## Props
7
+
8
+ | Name | Description | Type | Default |
9
+ | --- | --- | --- | --- |
10
+ | `id*` | A unique identifier for the radio, used to associate the label with the form element. | `string` | - |
11
+ | `name` | The name attribute for the radio element, typically used for form submission. | `string` | - |
12
+ | `label` | The text label displayed next to the radio. | `string` | - |
13
+ | `modelValue` | The radio's checked state, bound via v-model. | `boolean` | - |
14
+ | `isInvalid` | If `true`, applies an invalid state to the radio. | `boolean` | - |
15
+ | `disabled` | If `true`, disables the radio, making it non-interactive. | `boolean` | - |
16
+
17
+ ## Events
18
+
19
+ | Name | Description | Type |
20
+ | --- | --- | --- |
21
+ | `update:modelValue` | Emits when the radio value changes, updating the modelValue prop. | [value: boolean] |
@@ -23,7 +23,7 @@ import { computed } from 'vue';
23
23
  import MRadio from '../radio/MRadio.vue';
24
24
 
25
25
  /**
26
- * A radio button is used to offer a unique choice to your user in a form. Unlike checkboxes, it can not be used alone.
26
+ * A radio button is a selection control that allows users to choose a single option from a list of mutually exclusive choices. Unlike checkboxes, only one option can be selected at a time within the same group. Radio Buttons are commonly used in forms, surveys, and settings where a single choice must be made.<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#radio-group).
27
27
  */
28
28
  const props = defineProps<{
29
29
  /**
@@ -0,0 +1,21 @@
1
+ # MRadioGroup
2
+
3
+ A radio button is a selection control that allows users to choose a single option from a list of mutually exclusive choices. Unlike checkboxes, only one option can be selected at a time within the same group. Radio Buttons are commonly used in forms, surveys, and settings where a single choice must be made.<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#radio-group).
4
+
5
+
6
+ ## Props
7
+
8
+ | Name | Description | Type | Default |
9
+ | --- | --- | --- | --- |
10
+ | `name*` | The name attribute for the radio 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 radio button of the radio group | `{ id: string; label: string; value: string; disabled?: boolean` `undefined; }[]` | - |
14
+ | `isInvalid` | If `true`, applies an invalid state to the radio group. | `boolean` | - |
15
+ | `inline` | If `true`, make the form element of the group inline. | `boolean` | - |
16
+
17
+ ## Events
18
+
19
+ | Name | Description | Type |
20
+ | --- | --- | --- |
21
+ | `update:modelValue` | Emits when the radio group value changes, updating the modelValue prop. | [value: string] |
@@ -0,0 +1,116 @@
1
+ import { mount } from '@vue/test-utils';
2
+ import { describe, it, expect } from 'vitest';
3
+ import MSegmentedControl from './MSegmentedControl.vue';
4
+
5
+ describe('MSegmentedControl.vue', () => {
6
+ const segments = [
7
+ { label: 'First' },
8
+ { label: 'Second' },
9
+ { label: 'Third' },
10
+ ];
11
+
12
+ it('renders segments with correct labels', () => {
13
+ const wrapper = mount(MSegmentedControl, {
14
+ props: { segments },
15
+ });
16
+
17
+ const buttons = wrapper.findAll('button');
18
+ expect(buttons).toHaveLength(segments.length);
19
+ buttons.forEach((btn, i) => {
20
+ expect(btn.text()).toBe(segments[i].label);
21
+ });
22
+ });
23
+
24
+ it('sets default active segment based on modelValue prop', () => {
25
+ const wrapper = mount(MSegmentedControl, {
26
+ props: { segments, modelValue: 1 },
27
+ });
28
+
29
+ const buttons = wrapper.findAll('button');
30
+ expect(buttons[1].classes()).toContain(
31
+ 'mc-segmented-control__segment--selected',
32
+ );
33
+ expect(buttons[1].attributes('aria-checked')).toBe('true');
34
+ });
35
+
36
+ it('emits update:modelValue and changes active segment on click', async () => {
37
+ const wrapper = mount(MSegmentedControl, {
38
+ props: { segments, modelValue: 0 },
39
+ });
40
+
41
+ const buttons = wrapper.findAll('button');
42
+ await buttons[2].trigger('click');
43
+
44
+ expect(wrapper.emitted('update:modelValue')).toBeTruthy();
45
+ expect(wrapper.emitted('update:modelValue')![0]).toEqual([2]);
46
+
47
+ expect(buttons[2].classes()).toContain(
48
+ 'mc-segmented-control__segment--selected',
49
+ );
50
+ expect(buttons[2].attributes('aria-checked')).toBe('true');
51
+ });
52
+
53
+ it('does not emit update event if clicking already active segment', async () => {
54
+ const wrapper = mount(MSegmentedControl, {
55
+ props: { segments, modelValue: 1 },
56
+ });
57
+
58
+ const buttons = wrapper.findAll('button');
59
+ await buttons[1].trigger('click');
60
+
61
+ expect(wrapper.emitted('update:modelValue')).toBeFalsy();
62
+ });
63
+
64
+ it('applies full width class when full prop is true', () => {
65
+ const wrapper = mount(MSegmentedControl, {
66
+ props: { segments, full: true },
67
+ });
68
+
69
+ expect(wrapper.classes()).toContain('mc-segmented-control--full');
70
+ });
71
+
72
+ it('applies size class when size prop is "m"', () => {
73
+ const wrapper = mount(MSegmentedControl, {
74
+ props: { segments, size: 'm' },
75
+ });
76
+
77
+ expect(wrapper.classes()).toContain('mc-segmented-control--m');
78
+ });
79
+
80
+ it('does not apply size class when size is "s" (default)', () => {
81
+ const wrapper = mount(MSegmentedControl, {
82
+ props: { segments },
83
+ });
84
+
85
+ expect(wrapper.classes()).not.toContain('mc-segmented-control--s');
86
+ });
87
+
88
+ it('updates active segment when modelValue prop changes', async () => {
89
+ const wrapper = mount(MSegmentedControl, {
90
+ props: { segments, modelValue: 0 },
91
+ });
92
+
93
+ const buttons = wrapper.findAll('button');
94
+ expect(buttons[0].classes()).toContain(
95
+ 'mc-segmented-control__segment--selected',
96
+ );
97
+
98
+ await wrapper.setProps({ modelValue: 2 });
99
+
100
+ expect(buttons[2].classes()).toContain(
101
+ 'mc-segmented-control__segment--selected',
102
+ );
103
+ expect(buttons[2].attributes('aria-checked')).toBe('true');
104
+ });
105
+
106
+ it('adds role="radio" attribute to buttons', () => {
107
+ const wrapper = mount(MSegmentedControl, {
108
+ props: { segments },
109
+ });
110
+
111
+ const buttons = wrapper.findAll('button');
112
+ buttons.forEach((button) => {
113
+ expect(button.attributes('role')).toBe('radio');
114
+ });
115
+ });
116
+ });