@mozaic-ds/vue 2.13.0 → 2.14.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 (90) hide show
  1. package/dist/mozaic-vue.css +1 -1
  2. package/dist/mozaic-vue.d.ts +1088 -378
  3. package/dist/mozaic-vue.js +2662 -1854
  4. package/dist/mozaic-vue.js.map +1 -1
  5. package/dist/mozaic-vue.umd.cjs +5 -5
  6. package/dist/mozaic-vue.umd.cjs.map +1 -1
  7. package/package.json +4 -4
  8. package/src/components/actionlistbox/MActionListbox.spec.ts +53 -59
  9. package/src/components/actionlistbox/MActionListbox.stories.ts +22 -1
  10. package/src/components/actionlistbox/MActionListbox.vue +91 -28
  11. package/src/components/actionlistbox/README.md +15 -0
  12. package/src/components/breadcrumb/MBreadcrumb.vue +5 -0
  13. package/src/components/button/README.md +4 -0
  14. package/src/components/checkbox/README.md +2 -0
  15. package/src/components/divider/README.md +4 -0
  16. package/src/components/iconbutton/MIconButton.stories.ts +12 -0
  17. package/src/components/iconbutton/MIconButton.vue +13 -1
  18. package/src/components/iconbutton/README.md +27 -0
  19. package/src/components/loader/README.md +2 -0
  20. package/src/components/navigationindicator/MNavigationIndicator.spec.ts +152 -0
  21. package/src/components/navigationindicator/MNavigationIndicator.stories.ts +41 -0
  22. package/src/components/navigationindicator/MNavigationIndicator.vue +132 -0
  23. package/src/components/navigationindicator/README.md +37 -0
  24. package/src/components/pageheader/MPageHeader.spec.ts +142 -0
  25. package/src/components/pageheader/MPageHeader.stories.ts +125 -0
  26. package/src/components/pageheader/MPageHeader.vue +133 -0
  27. package/src/components/pageheader/README.md +46 -0
  28. package/src/components/popover/MPopover.spec.ts +106 -0
  29. package/src/components/popover/MPopover.stories.ts +126 -0
  30. package/src/components/popover/MPopover.vue +131 -0
  31. package/src/components/popover/README.md +42 -0
  32. package/src/components/radio/README.md +2 -0
  33. package/src/components/select/MSelect.spec.ts +2 -1
  34. package/src/components/select/MSelect.vue +30 -25
  35. package/src/components/sidebar/MSidebar.const.ts +6 -0
  36. package/src/components/sidebar/MSidebar.spec.ts +110 -0
  37. package/src/components/sidebar/MSidebar.stories.ts +108 -0
  38. package/src/components/sidebar/MSidebar.vue +124 -0
  39. package/src/components/sidebar/README.md +59 -0
  40. package/src/components/sidebar/stories/DefaultCase.stories.vue +120 -0
  41. package/src/components/sidebar/stories/README.md +27 -0
  42. package/src/components/sidebar/stories/WithExpandOnly.stories.vue +112 -0
  43. package/src/components/sidebar/stories/WithProfileInfoOnly.stories.vue +119 -0
  44. package/src/components/sidebar/stories/WithSingleLevel.stories.vue +98 -0
  45. package/src/components/sidebar/use-floating-item.composable.ts +135 -0
  46. package/src/components/sidebar/use-floating-item.spec.ts +251 -0
  47. package/src/components/sidebarexpandableitem/MSidebarExpandableItem.spec.ts +151 -0
  48. package/src/components/sidebarexpandableitem/MSidebarExpandableItem.vue +113 -0
  49. package/src/components/sidebarexpandableitem/README.md +36 -0
  50. package/src/components/sidebarfooter/MSidebarFooter.spec.ts +276 -0
  51. package/src/components/sidebarfooter/MSidebarFooter.vue +201 -0
  52. package/src/components/sidebarfooter/README.md +52 -0
  53. package/src/components/sidebarfooter/_MSidebarFooterMenu.vue +64 -0
  54. package/src/components/sidebarheader/MSidebarHeader.vue +36 -0
  55. package/src/components/sidebarheader/README.md +31 -0
  56. package/src/components/sidebarnavitem/MSidebarNavItem.spec.ts +127 -0
  57. package/src/components/sidebarnavitem/MSidebarNavItem.vue +113 -0
  58. package/src/components/sidebarnavitem/README.md +56 -0
  59. package/src/components/sidebarshortcutitem/MSidebarShortcutItem.spec.ts +59 -0
  60. package/src/components/sidebarshortcutitem/MSidebarShortcutItem.vue +52 -0
  61. package/src/components/sidebarshortcutitem/README.md +32 -0
  62. package/src/components/sidebarshortcuts/MSidebarShortcuts.spec.ts +87 -0
  63. package/src/components/sidebarshortcuts/MSidebarShortcuts.vue +101 -0
  64. package/src/components/sidebarshortcuts/README.md +36 -0
  65. package/src/components/statusbadge/README.md +12 -0
  66. package/src/components/textinput/MTextInput.stories.ts +13 -1
  67. package/src/components/textinput/MTextInput.vue +12 -0
  68. package/src/components/textinput/README.md +3 -1
  69. package/src/components/tile/MTile.spec.ts +61 -0
  70. package/src/components/tile/MTile.stories.ts +102 -0
  71. package/src/components/tile/MTile.vue +68 -0
  72. package/src/components/tile/README.md +19 -0
  73. package/src/components/tileclickable/MTileClickable.spec.ts +130 -0
  74. package/src/components/tileclickable/MTileClickable.stories.ts +60 -0
  75. package/src/components/tileclickable/MTileClickable.vue +106 -0
  76. package/src/components/tileclickable/README.md +30 -0
  77. package/src/components/tileexpandable/MTileExpandable.spec.ts +121 -0
  78. package/src/components/tileexpandable/MTileExpandable.stories.ts +50 -0
  79. package/src/components/tileexpandable/MTileExpandable.vue +131 -0
  80. package/src/components/tileexpandable/README.md +36 -0
  81. package/src/components/tileselectable/MTileSelectable.spec.ts +177 -0
  82. package/src/components/tileselectable/MTileSelectable.stories.ts +55 -0
  83. package/src/components/tileselectable/MTileSelectable.vue +142 -0
  84. package/src/components/tileselectable/README.md +44 -0
  85. package/src/components/toaster/README.md +1 -1
  86. package/src/components/tooltip/MTooltip.vue +5 -0
  87. package/src/components/tooltip/README.md +16 -1
  88. package/src/main.ts +12 -2
  89. package/src/utils/use-is-mobile.composable.ts +20 -0
  90. package/src/utils/use-is-mobile.spec.ts +70 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mozaic-ds/vue",
3
- "version": "2.13.0",
3
+ "version": "2.14.0",
4
4
  "type": "module",
5
5
  "description": "Mozaic-Vue is the Vue.js implementation of ADEO Design system",
6
6
  "author": "ADEO - ADEO Design system",
@@ -41,7 +41,7 @@
41
41
  "*.d.ts"
42
42
  ],
43
43
  "dependencies": {
44
- "@mozaic-ds/styles": "^2.7.0",
44
+ "@mozaic-ds/styles": "^2.11.0",
45
45
  "@mozaic-ds/web-fonts": "^1.65.0",
46
46
  "postcss-scss": "^4.0.9",
47
47
  "vue": "^3.5.13"
@@ -50,7 +50,7 @@
50
50
  "@commitlint/cli": "^20.1.0",
51
51
  "@commitlint/config-conventional": "^20.0.0",
52
52
  "@mozaic-ds/css-dev-tools": "1.75.0",
53
- "@mozaic-ds/icons-vue": "^2.2.0",
53
+ "@mozaic-ds/icons-vue": "^2.5.0",
54
54
  "@release-it/conventional-changelog": "^10.0.1",
55
55
  "@storybook/addon-a11y": "^10.0.4",
56
56
  "@storybook/addon-docs": "^10.0.4",
@@ -68,7 +68,7 @@
68
68
  "eslint-plugin-vue": "^10.0.0",
69
69
  "eslint-plugin-vuejs-accessibility": "^2.4.1",
70
70
  "husky": "^9.1.7",
71
- "jsdom": "^27.0.0",
71
+ "jsdom": "^28.0.0",
72
72
  "libphonenumber-js": "^1.12.23",
73
73
  "lint-staged": "^16.1.5",
74
74
  "mdx-mermaid": "^2.0.3",
@@ -40,12 +40,9 @@ const items = [
40
40
  ];
41
41
 
42
42
  describe('MActionListbox', () => {
43
- it('renders the title if provided', () => {
44
- const wrapper = mount(MActionListbox, {
45
- props: {
46
- title: 'Action List',
47
- items,
48
- },
43
+ function mountComponent(props = {}, options = {}) {
44
+ return mount(MActionListbox, {
45
+ props: { items, ...props },
49
46
  global: {
50
47
  components: {
51
48
  MDivider,
@@ -53,82 +50,79 @@ describe('MActionListbox', () => {
53
50
  Cross24,
54
51
  },
55
52
  },
53
+ ...options,
56
54
  });
55
+ }
57
56
 
57
+ it('renders the title if provided', () => {
58
+ const wrapper = mountComponent({ title: 'Action List' });
58
59
  expect(wrapper.find('.mc-listbox__title').text()).toBe('Action List');
59
60
  });
60
61
 
61
62
  it('renders all item labels', () => {
62
- const wrapper = mount(MActionListbox, {
63
- props: {
64
- items,
65
- },
66
- global: {
67
- components: {
68
- MDivider,
69
- MIconButton,
70
- Cross24,
71
- },
72
- },
73
- });
74
-
63
+ const wrapper = mountComponent();
75
64
  items.forEach((item) => {
76
65
  expect(wrapper.text()).toContain(item.label);
77
66
  });
78
67
  });
79
68
 
80
69
  it('renders icons for each item', () => {
81
- const wrapper = mount(MActionListbox, {
82
- props: {
83
- items,
84
- },
85
- global: {
86
- components: {
87
- MDivider,
88
- MIconButton,
89
- Cross24,
90
- },
91
- },
92
- });
93
-
70
+ const wrapper = mountComponent();
94
71
  const icons = wrapper.findAll('[data-testid="icon"]');
95
72
  expect(icons.length).toBe(items.length);
96
73
  });
97
74
 
98
75
  it('adds danger class to items with appearance set to danger', () => {
99
- const wrapper = mount(MActionListbox, {
100
- props: {
101
- items,
102
- },
103
- global: {
104
- components: {
105
- MDivider,
106
- MIconButton,
107
- Cross24,
108
- },
109
- },
110
- });
111
-
76
+ const wrapper = mountComponent();
112
77
  const dangerousItem = wrapper.findAll('.mc-action-list__element--danger');
78
+
113
79
  expect(dangerousItem.length).toBe(1);
114
80
  expect(dangerousItem[0].text()).toContain('Delete');
115
81
  });
116
82
 
117
- it('renders MDivider with divider set to true', () => {
118
- const wrapper = mount(MActionListbox, {
119
- props: {
120
- items,
121
- },
122
- global: {
123
- components: {
124
- MDivider,
125
- MIconButton,
126
- Cross24,
127
- },
128
- },
129
- });
130
-
83
+ it('renders MDivider when divider is true', () => {
84
+ const wrapper = mountComponent();
131
85
  const dividers = wrapper.findAll('.mc-action-list__divider');
132
86
  expect(dividers.length).toBe(1);
133
87
  });
88
+
89
+ it('applies disabled class when item.disabled is true', () => {
90
+ const disabledItems = [
91
+ ...items,
92
+ { label: 'Disabled', disabled: true },
93
+ ];
94
+
95
+ const wrapper = mountComponent({ items: disabledItems });
96
+
97
+ const disabled = wrapper.findAll('.mc-action-list__element--disabled');
98
+ expect(disabled.length).toBe(1);
99
+ expect(disabled[0].text()).toContain('Disabled');
100
+ });
101
+
102
+ it('applies mc-listbox--bottom by default', () => {
103
+ const wrapper = mountComponent();
104
+ expect(wrapper.find('.mc-listbox').classes())
105
+ .toContain('mc-listbox--bottom');
106
+ });
107
+
108
+ it('applies mc-listbox--top when position is "top"', () => {
109
+ const wrapper = mountComponent({ position: 'top' });
110
+ expect(wrapper.find('.mc-listbox').classes())
111
+ .toContain('mc-listbox--top');
112
+ });
113
+
114
+ it('applies mc-listbox--left when position is "left"', () => {
115
+ const wrapper = mountComponent({ position: 'left' });
116
+ expect(wrapper.find('.mc-listbox').classes())
117
+ .toContain('mc-listbox--left');
118
+ });
119
+
120
+ it('emits "close" when close button is clicked', async () => {
121
+ const wrapper = mountComponent({ title: 'Action List' });
122
+
123
+ await wrapper.find('.mc-listbox__close').trigger('click');
124
+
125
+ expect(wrapper.emitted('close')).toBeTruthy();
126
+ expect(wrapper.emitted('close')?.length).toBe(1);
127
+ });
134
128
  });
@@ -1,6 +1,7 @@
1
1
  import type { Meta, StoryObj } from '@storybook/vue3-vite';
2
2
 
3
3
  import MActionListbox from './MActionListbox.vue';
4
+ import MButton from '../button/MButton.vue';
4
5
  import {
5
6
  Copy20,
6
7
  ArrowTopRight20,
@@ -12,7 +13,9 @@ const meta: Meta<typeof MActionListbox> = {
12
13
  title: 'Overlay/Action Listbox',
13
14
  component: MActionListbox,
14
15
  parameters: {
16
+ layout: 'centered',
15
17
  docs: {
18
+ story: { height: '700px' },
16
19
  description: {
17
20
  component:
18
21
  'An action list is a contextual menu that presents a list of available actions related to a specific element or interface area. It allows users to quickly access functions such as editing, sharing, deleting, or navigating to sub-actions. Action Lists are commonly triggered by buttons, icons (e.g., three-dot menus), or right-click interactions, ensuring a clean and efficient UI.',
@@ -64,7 +67,7 @@ const meta: Meta<typeof MActionListbox> = {
64
67
  return { args };
65
68
  },
66
69
  template: `
67
- <MActionListbox v-bind="args"></MActionListbox>
70
+ <MActionListbox v-bind="args" />
68
71
  `,
69
72
  }),
70
73
  };
@@ -72,3 +75,21 @@ export default meta;
72
75
  type Story = StoryObj<typeof MActionListbox>;
73
76
 
74
77
  export const Default: Story = {};
78
+
79
+ export const Activator: Story = {
80
+ render: (args) => ({
81
+ components: { MActionListbox, MButton },
82
+ setup() {
83
+ return { args };
84
+ },
85
+ template: `
86
+ <div>
87
+ <MActionListbox v-bind="args">
88
+ <template #activator="{id}">
89
+ <MButton :popovertarget="id">Activator</MButton>
90
+ </template>
91
+ </MActionListbox>
92
+ </div>
93
+ `,
94
+ }),
95
+ };
@@ -1,9 +1,23 @@
1
1
  <template>
2
- <div class="mc-listbox">
3
- <div class="mc-listbox__content">
2
+ <div
3
+ :class="{
4
+ 'mc-listbox': true,
5
+ [`mc-listbox--${props.position}`]: true,
6
+ }"
7
+ >
8
+ <div
9
+ ref="popover"
10
+ class="mc-listbox__content"
11
+ v-bind="$slots.activator ? { id, popover: '' } : {}"
12
+ >
4
13
  <div class="mc-listbox__header">
5
14
  <h3 v-if="title" class="mc-listbox__title">{{ title }}</h3>
6
- <MIconButton class="mc-listbox__close" ghost aria-label="Close">
15
+ <MIconButton
16
+ class="mc-listbox__close"
17
+ ghost
18
+ aria-label="Close"
19
+ @click="close"
20
+ >
7
21
  <template #icon>
8
22
  <Cross24 aria-hidden="true" />
9
23
  </template>
@@ -42,45 +56,94 @@
42
56
  </div>
43
57
  </div>
44
58
  </div>
59
+
60
+ <slot name="activator" v-bind="{ id }" />
45
61
  </template>
46
62
 
47
63
  <script setup lang="ts">
48
- import type { Component } from 'vue';
64
+ import {
65
+ useId,
66
+ useTemplateRef,
67
+ type Component,
68
+ type VNode,
69
+ } from 'vue';
70
+ import MIconButton from '../iconbutton/MIconButton.vue';
49
71
  import MDivider from '../divider/MDivider.vue';
72
+ import { Cross24 } from '@mozaic-ds/icons-vue';
73
+
50
74
  /**
51
75
  * An action list is a contextual menu that presents a list of available actions related to a specific element or interface area. It allows users to quickly access functions such as editing, sharing, deleting, or navigating to sub-actions. Action Lists are commonly triggered by buttons, icons (e.g., three-dot menus), or right-click interactions, ensuring a clean and efficient UI.
52
76
  */
53
- defineProps<{
54
- /**
55
- * title displayed in mobile version.
56
- */
57
- title?: string;
58
- /**
59
- * An array of objects that allows you to provide all the data needed to generate the content for each item.
60
- */
61
- items: Array<{
77
+ const props = withDefaults(
78
+ defineProps<{
62
79
  /**
63
- * The icon displayed for the item from Mozaic-icon-vue.
80
+ * title displayed in mobile version.
64
81
  */
65
- icon?: Component;
66
- /**
67
- * The label displayed for the item.
68
- */
69
- label: string;
70
- /**
71
- * If `true`, the item will be disabled.
72
- */
73
- disabled?: boolean;
82
+
83
+ title?: string;
74
84
  /**
75
- * Allows to define the item appearance.
85
+ * Defines the position of the listbox relative to its trigger or container.
76
86
  */
77
- appearance?: 'standard' | 'danger';
87
+ position?:
88
+ | 'top'
89
+ | 'bottom'
90
+ | 'left'
91
+ | 'right';
78
92
  /**
79
- * Add a divider on top of the item.
93
+ * An array of objects that allows you to provide all the data needed to generate the content for each item.
80
94
  */
81
- divider?: boolean;
82
- }>;
95
+
96
+ items: Array<{
97
+ /**
98
+ * The icon displayed for the item from Mozaic-icon-vue.
99
+ */
100
+ icon?: Component;
101
+ /**
102
+ * The label displayed for the item.
103
+ */
104
+ label: string;
105
+ /**
106
+ * If `true`, the item will be disabled.
107
+ */
108
+ disabled?: boolean;
109
+ /**
110
+ * Allows to define the item appearance.
111
+ */
112
+ appearance?: 'standard' | 'danger';
113
+ /**
114
+ * Add a divider on top of the item.
115
+ */
116
+ divider?: boolean;
117
+ }>;
118
+ }>(),
119
+ { position: 'bottom' },
120
+ );
121
+
122
+ const emit = defineEmits<{
123
+ /**
124
+ * Emits when the close button is clicked.
125
+ */
126
+ (on: 'close'): void;
83
127
  }>();
128
+
129
+ const slots = defineSlots<{
130
+ /**
131
+ * Activator element that triggers the listbox.
132
+ */
133
+ activator?: VNode[];
134
+ }>();
135
+
136
+ const id = useId();
137
+
138
+ const popover = useTemplateRef('popover');
139
+
140
+ function close() {
141
+ emit('close');
142
+
143
+ if (slots.activator) {
144
+ popover.value?.hidePopover();
145
+ }
146
+ }
84
147
  </script>
85
148
 
86
149
  <style lang="scss" scoped>
@@ -8,18 +8,33 @@ An action list is a contextual menu that presents a list of available actions re
8
8
  | Name | Description | Type | Default |
9
9
  | --- | --- | --- | --- |
10
10
  | `title` | title displayed in mobile version. | `string` | - |
11
+ | `position` | Defines the position of the listbox relative to its trigger or container. | `"bottom"` `"top"` `"left"` `"right"` | `"bottom"` |
11
12
  | `items*` | An array of objects that allows you to provide all the data needed to generate the content for each item. | `{ icon?: Component` `undefined; label: string; disabled?: boolean` `undefined; appearance?: "standard"` `"danger"` `undefined; divider?: boolean` `undefined; }[]` | - |
12
13
 
14
+ ## Slots
15
+
16
+ | Name | Description |
17
+ | --- | --- |
18
+ | `activator` | Activator element that triggers the listbox. |
19
+
20
+ ## Events
21
+
22
+ | Name | Description | Type |
23
+ | --- | --- | --- |
24
+ | `close` | Emits when the close button is clicked. | [] |
25
+
13
26
  ## Dependencies
14
27
 
15
28
  ### Depends on
16
29
 
17
30
  - [MDivider](../divider)
31
+ - [MIconButton](../iconbutton)
18
32
 
19
33
  ### Graph
20
34
 
21
35
  ```mermaid
22
36
  graph TD;
37
+ MActionListbox --> MIconButton
23
38
  MActionListbox --> MDivider
24
39
  style MActionListbox fill:#008240,stroke:#333,stroke-width:4px
25
40
  ```
@@ -14,9 +14,13 @@
14
14
  :class="{
15
15
  'mc-breadcrumb__current': isLastLink(index),
16
16
  }"
17
+ iconPosition="right"
17
18
  :aria-current="isLastLink(index) ? 'page' : undefined"
18
19
  >
19
20
  {{ link.label }}
21
+ <template v-if="index !== (links.length - 1)" #icon>
22
+ <ChevronRight20/>
23
+ </template>
20
24
  </MLink>
21
25
  </li>
22
26
  </ul>
@@ -26,6 +30,7 @@
26
30
  <script setup lang="ts">
27
31
  import { computed } from 'vue';
28
32
  import MLink from '../link/MLink.vue';
33
+ import { ChevronRight20 } from '@mozaic-ds/icons-vue';
29
34
  /**
30
35
  * 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
36
  */
@@ -40,17 +40,21 @@ style MButton fill:#008240,stroke:#333,stroke-width:4px
40
40
  ### Used By
41
41
 
42
42
  - [MFileUploaderItem](../fileuploaderitem)
43
+ - [MNavigationIndicator](../navigationindicator)
43
44
  - [MPagination](../pagination)
44
45
  - [MPasswordInput](../passwordinput)
45
46
  - [MStepperBottomBar](../stepperbottombar)
47
+ - [MTileExpandable](../tileexpandable)
46
48
 
47
49
  ### Graph
48
50
 
49
51
  ```mermaid
50
52
  graph TD;
51
53
  MFileUploaderItem --> MButton
54
+ MNavigationIndicator --> MButton
52
55
  MPagination --> MButton
53
56
  MPasswordInput --> MButton
54
57
  MStepperBottomBar --> MButton
58
+ MTileExpandable --> MButton
55
59
  style MButton fill:#008240,stroke:#333,stroke-width:4px
56
60
  ```
@@ -27,11 +27,13 @@ A checkbox is an interactive component used to select or deselect an option, typ
27
27
  ### Used By
28
28
 
29
29
  - [MCheckboxGroup](../checkboxgroup)
30
+ - [MTileSelectable](../tileselectable)
30
31
 
31
32
  ### Graph
32
33
 
33
34
  ```mermaid
34
35
  graph TD;
35
36
  MCheckboxGroup --> MCheckbox
37
+ MTileSelectable --> MCheckbox
36
38
  style MCheckbox fill:#008240,stroke:#333,stroke-width:4px
37
39
  ```
@@ -24,6 +24,8 @@ A divider is a visual element used to separate content or sections within an int
24
24
  - [MActionBottomBar](../actionbottombar)
25
25
  - [MActionListbox](../actionlistbox)
26
26
  - [MFileUploaderItem](../fileuploaderitem)
27
+ - [MSidebarFooter](../sidebarfooter)
28
+ - [_MSidebarFooterMenu](../sidebarfooter)
27
29
  - [MStepperBottomBar](../stepperbottombar)
28
30
  - [MTabs](../tabs)
29
31
 
@@ -34,6 +36,8 @@ graph TD;
34
36
  MActionBottomBar --> MDivider
35
37
  MActionListbox --> MDivider
36
38
  MFileUploaderItem --> MDivider
39
+ MSidebarFooter --> MDivider
40
+ _MSidebarFooterMenu --> MDivider
37
41
  MStepperBottomBar --> MDivider
38
42
  MTabs --> MDivider
39
43
  style MDivider fill:#008240,stroke:#333,stroke-width:4px
@@ -87,6 +87,18 @@ export const Ghost: Story = {
87
87
  },
88
88
  };
89
89
 
90
+ export const Loading: Story = {
91
+ args: { isLoading: true },
92
+ parameters: {
93
+ docs: {
94
+ description: {
95
+ story:
96
+ 'A loader replaces the icon to indicate that an action is in progress. Mouse events are prohibited.',
97
+ },
98
+ },
99
+ },
100
+ };
101
+
90
102
  export const Standard: Story = {
91
103
  args: { appearance: 'standard' },
92
104
  parameters: {
@@ -5,7 +5,14 @@
5
5
  :disabled="disabled"
6
6
  :type="type"
7
7
  >
8
- <span class="mc-button__icon">
8
+ <span
9
+ v-if="isLoading"
10
+ class="mc-button__icon"
11
+ :style="{ position: 'absolute' }"
12
+ >
13
+ <MLoader :style="{ color: 'currentColor' }" size="s" />
14
+ </span>
15
+ <span v-else class="mc-button__icon">
9
16
  <slot name="icon" />
10
17
  </span>
11
18
  </button>
@@ -13,6 +20,7 @@
13
20
 
14
21
  <script setup lang="ts">
15
22
  import { computed, type VNode } from 'vue';
23
+ import MLoader from '../loader/MLoader.vue';
16
24
  /**
17
25
  * 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.
18
26
  */
@@ -42,6 +50,10 @@ const props = withDefaults(
42
50
  * Specifies the button's HTML `type` attribute.
43
51
  */
44
52
  type?: 'button' | 'reset' | 'submit';
53
+ /**
54
+ * If `true`, a loading state is displayed.
55
+ */
56
+ isLoading?: boolean;
45
57
  }>(),
46
58
  {
47
59
  appearance: 'standard',
@@ -13,6 +13,7 @@ Buttons are key interactive elements used to perform actions and can be used as
13
13
  | `ghost` | If `true`, applies a "ghost" style to the icon button. | `boolean` | - |
14
14
  | `outlined` | If `true`, the icon button gets an outlined style. | `boolean` | - |
15
15
  | `type` | Specifies the button's HTML `type` attribute. | `"button"` `"reset"` `"submit"` | `"button"` |
16
+ | `isLoading` | If `true`, a loading state is displayed. | `boolean` | - |
16
17
 
17
18
  ## Slots
18
19
 
@@ -22,24 +23,50 @@ Buttons are key interactive elements used to perform actions and can be used as
22
23
 
23
24
  ## Dependencies
24
25
 
26
+ ### Depends on
27
+
28
+ - [MLoader](../loader)
29
+
30
+ ### Graph
31
+
32
+ ```mermaid
33
+ graph TD;
34
+ MIconButton --> MLoader
35
+ style MIconButton fill:#008240,stroke:#333,stroke-width:4px
36
+ ```
37
+
25
38
  ### Used By
26
39
 
40
+ - [MActionListbox](../actionlistbox)
27
41
  - [MCarousel](../carousel)
28
42
  - [MDrawer](../drawer)
29
43
  - [MModal](../modal)
44
+ - [MNavigationIndicator](../navigationindicator)
45
+ - [MPageHeader](../pageheader)
30
46
  - [MPagination](../pagination)
47
+ - [MPopover](../popover)
48
+ - [MSidebar](../sidebar)
49
+ - [MSidebarFooter](../sidebarfooter)
31
50
  - [MStatusNotification](../statusnotification)
51
+ - [MTileExpandable](../tileexpandable)
32
52
  - [MToaster](../toaster)
33
53
 
34
54
  ### Graph
35
55
 
36
56
  ```mermaid
37
57
  graph TD;
58
+ MActionListbox --> MIconButton
38
59
  MCarousel --> MIconButton
39
60
  MDrawer --> MIconButton
40
61
  MModal --> MIconButton
62
+ MNavigationIndicator --> MIconButton
63
+ MPageHeader --> MIconButton
41
64
  MPagination --> MIconButton
65
+ MPopover --> MIconButton
66
+ MSidebar --> MIconButton
67
+ MSidebarFooter --> MIconButton
42
68
  MStatusNotification --> MIconButton
69
+ MTileExpandable --> MIconButton
43
70
  MToaster --> MIconButton
44
71
  style MIconButton fill:#008240,stroke:#333,stroke-width:4px
45
72
  ```
@@ -17,6 +17,7 @@ A loader is a visual indicator used to inform users that a process is in progres
17
17
 
18
18
  - [MButton](../button)
19
19
  - [MField](../field)
20
+ - [MIconButton](../iconbutton)
20
21
  - [MLoadingOverlay](../loadingoverlay)
21
22
  - [MStatusMessage](../statusmessage)
22
23
 
@@ -26,6 +27,7 @@ A loader is a visual indicator used to inform users that a process is in progres
26
27
  graph TD;
27
28
  MButton --> MLoader
28
29
  MField --> MLoader
30
+ MIconButton --> MLoader
29
31
  MLoadingOverlay --> MLoader
30
32
  MStatusMessage --> MLoader
31
33
  style MLoader fill:#008240,stroke:#333,stroke-width:4px