@mozaic-ds/vue 2.19.2 → 2.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mozaic-vue.css +1 -1
- package/dist/mozaic-vue.d.ts +512 -296
- package/dist/mozaic-vue.js +2005 -1758
- package/dist/mozaic-vue.js.map +1 -1
- package/dist/mozaic-vue.umd.cjs +6 -6
- package/dist/mozaic-vue.umd.cjs.map +1 -1
- package/package.json +5 -2
- package/src/components/Catalog.scss +84 -0
- package/src/components/Catalog.stories.ts +146 -0
- package/src/components/GettingStarted.mdx +258 -2
- package/src/components/Migration.mdx +4135 -532
- package/src/components/Welcome.mdx +1 -1
- package/src/components/carousel/MCarousel.spec.ts +174 -55
- package/src/components/carousel/MCarousel.vue +106 -33
- package/src/components/checkboxgroup/MCheckboxGroup.vue +2 -9
- package/src/components/combobox/MCombobox.spec.ts +144 -0
- package/src/components/combobox/MCombobox.stories.ts +2 -1
- package/src/components/combobox/MCombobox.vue +68 -38
- package/src/components/combobox/README.md +6 -0
- package/src/components/datatable/DataTable.stories.ts +2 -2
- package/src/components/datatable/DataTableCells.stories.ts +1 -0
- package/src/components/datatable/DataTableEmpty.stories.ts +1 -0
- package/src/components/datatable/DataTableExpandable.stories.ts +1 -0
- package/src/components/datatable/DataTableNested.stories.ts +1 -0
- package/src/components/datatable/DataTablePageable.stories.ts +194 -0
- package/src/components/datatable/DataTableSelectable.stories.ts +1 -0
- package/src/components/datatable/DataTableSortable.stories.ts +1 -0
- package/src/components/datepicker/MDatepicker.stories.ts +2 -0
- package/src/components/datepicker/MDatepicker.vue +17 -11
- package/src/components/divider/README.md +2 -0
- package/src/components/drawer/MDrawer.vue +7 -5
- package/src/components/link/MLink.stories.ts +18 -0
- package/src/components/link/MLink.vue +20 -4
- package/src/components/link/README.md +2 -1
- package/src/components/optionListbox/MOptionListbox.spec.ts +78 -1
- package/src/components/optionListbox/MOptionListbox.types.ts +7 -0
- package/src/components/optionListbox/MOptionListbox.vue +31 -217
- package/src/components/optionListbox/README.md +2 -0
- package/src/components/optionListbox/use-listbox-navigation.composable.ts +147 -0
- package/src/components/optionListbox/use-listbox-selection.composable.ts +149 -0
- package/src/components/pageheader/MPageHeader.spec.ts +17 -3
- package/src/components/pageheader/MPageHeader.stories.ts +37 -41
- package/src/components/pageheader/MPageHeader.vue +26 -16
- package/src/components/pageheader/README.md +2 -1
- package/src/components/pageheadercontext/MPageHeaderContext.spec.ts +155 -0
- package/src/components/pageheadercontext/MPageHeaderContext.vue +126 -0
- package/src/components/pageheadercontext/README.md +33 -0
- package/src/components/pageheaderfeature/MPageHeaderFeature.spec.ts +39 -0
- package/src/components/pageheaderfeature/MPageHeaderFeature.vue +40 -0
- package/src/components/pageheaderfeature/README.md +17 -0
- package/src/components/radiogroup/MRadioGroup.stories.ts +6 -0
- package/src/components/radiogroup/MRadioGroup.vue +2 -9
- package/src/components/sidebar/MSidebar.const.ts +2 -0
- package/src/components/sidebar/MSidebar.stories.ts +33 -0
- package/src/components/sidebar/MSidebar.vue +10 -1
- package/src/components/sidebar/README.md +1 -0
- package/src/components/sidebar/stories/DefaultCase.stories.vue +12 -11
- package/src/components/sidebar/use-floating-item.composable.ts +1 -1
- package/src/components/sidebarexpandableitem/MSidebarExpandableItem.vue +13 -7
- package/src/components/sidebarexpandableitem/README.md +2 -1
- package/src/components/sidebarfooter/MSidebarFooter.vue +16 -9
- package/src/components/sidebarfooter/_MSidebarFooterMenu.vue +10 -2
- package/src/components/sidebarnavitem/MSidebarNavItem.vue +36 -5
- package/src/components/sidebarnavitem/README.md +1 -0
- package/src/components/sidebarshortcutitem/MSidebarShortcutItem.vue +24 -3
- package/src/components/sidebarshortcutitem/README.md +3 -1
- package/src/components/sidebarshortcuts/MSidebarShortcuts.vue +6 -1
- package/src/components/sidebarshortcuts/README.md +12 -0
- package/src/components/statusbadge/MStatusBadge.stories.ts +5 -1
- package/src/components/statusbadge/MStatusBadge.vue +7 -1
- package/src/components/statusbadge/MstatusBadge.spec.ts +31 -0
- package/src/components/statusbadge/README.md +1 -0
- package/src/components/statusmessage/MStatusMessage.spec.ts +4 -4
- package/src/components/statusmessage/MStatusMessage.vue +5 -10
- package/src/components/statusnotification/MStatusNotification.spec.ts +9 -9
- package/src/components/statusnotification/MStatusNotification.vue +9 -8
- package/src/components/tabs/MTabs.stories.ts +30 -1
- package/src/components/tabs/MTabs.vue +12 -3
- package/src/components/tabs/Mtabs.spec.ts +19 -0
- package/src/components/tabs/README.md +1 -0
- package/src/components/tileselectable/MTileSelectable.spec.ts +69 -0
- package/src/components/tileselectable/MTileSelectable.stories.ts +8 -2
- package/src/components/tileselectable/MTileSelectable.vue +18 -1
- package/src/components/tileselectable/README.md +1 -0
- package/src/main.ts +3 -0
- package/src/utils/debounce.ts +15 -0
- package/src/components/BrandPresets.mdx +0 -146
- package/src/components/DarkMode.mdx +0 -115
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
:aria-controls="`listbox-${id}`"
|
|
21
21
|
:disabled="disabled"
|
|
22
22
|
class="mc-combobox__control"
|
|
23
|
-
aria-label="
|
|
23
|
+
:aria-label="props.controlAriaLabel"
|
|
24
24
|
@click="toggleListbox"
|
|
25
25
|
v-bind="
|
|
26
26
|
search
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
v-if="clearable && hasValue"
|
|
46
46
|
type="button"
|
|
47
47
|
class="mc-combobox__clear"
|
|
48
|
-
aria-label="
|
|
48
|
+
:aria-label="props.clearAriaLabel"
|
|
49
49
|
@click="listbox?.clearSelection"
|
|
50
50
|
>
|
|
51
51
|
<CrossCircleFilled24 />
|
|
@@ -55,40 +55,42 @@
|
|
|
55
55
|
type="button"
|
|
56
56
|
:tabindex="-1"
|
|
57
57
|
class="mc-combobox__icon"
|
|
58
|
-
aria-
|
|
58
|
+
aria-hidden="true"
|
|
59
59
|
@click="toggleListbox"
|
|
60
60
|
>
|
|
61
61
|
<ChevronDown24 />
|
|
62
62
|
</button>
|
|
63
63
|
</div>
|
|
64
64
|
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
65
|
+
<div class="mc-combobox__listbox">
|
|
66
|
+
<MOptionListbox
|
|
67
|
+
ref="listbox"
|
|
68
|
+
v-model="selection"
|
|
69
|
+
@update:model-value="onSelectionUpdate"
|
|
70
|
+
:id
|
|
71
|
+
:open="isOpen"
|
|
72
|
+
:multiple
|
|
73
|
+
:search
|
|
74
|
+
:actions
|
|
75
|
+
:checkable-sections
|
|
76
|
+
:search-placeholder
|
|
77
|
+
:select-label
|
|
78
|
+
:clear-label
|
|
79
|
+
:options
|
|
80
|
+
class="mc-combobox__listbox"
|
|
81
|
+
@open="openListbox"
|
|
82
|
+
@close="
|
|
83
|
+
() => {
|
|
84
|
+
closeListbox();
|
|
85
|
+
comboboxControl?.focus();
|
|
86
|
+
}
|
|
87
|
+
"
|
|
88
|
+
>
|
|
89
|
+
<template #item="{ item }">
|
|
90
|
+
<slot name="item" v-bind="{ item }" />
|
|
91
|
+
</template>
|
|
92
|
+
</MOptionListbox>
|
|
93
|
+
</div>
|
|
92
94
|
</div>
|
|
93
95
|
</template>
|
|
94
96
|
|
|
@@ -175,13 +177,31 @@ const props = withDefaults(
|
|
|
175
177
|
* Array of options to display in the listbox.
|
|
176
178
|
*/
|
|
177
179
|
options: Array<ListboxOption>;
|
|
180
|
+
/**
|
|
181
|
+
* Accessible label for the combobox trigger button. Should describe what
|
|
182
|
+
* the combobox selects (e.g. "Select a country").
|
|
183
|
+
*/
|
|
184
|
+
controlAriaLabel?: string;
|
|
185
|
+
/**
|
|
186
|
+
* Accessible label for the clear selection button.
|
|
187
|
+
*/
|
|
188
|
+
clearAriaLabel?: string;
|
|
189
|
+
/**
|
|
190
|
+
* Controls the open state of the listbox. When provided, the component operates in controlled
|
|
191
|
+
* mode and delegates open/close decisions to the parent via `v-model:open`. When omitted, the
|
|
192
|
+
* component manages its own open state internally.
|
|
193
|
+
*/
|
|
194
|
+
open?: boolean;
|
|
178
195
|
}>(),
|
|
179
196
|
{
|
|
197
|
+
open: undefined,
|
|
180
198
|
placeholder: 'Select an option',
|
|
181
199
|
searchPlaceholder: 'Find an option...',
|
|
182
200
|
selectLabel: 'Select all',
|
|
183
201
|
clearLabel: 'Clear',
|
|
184
202
|
size: 'm',
|
|
203
|
+
controlAriaLabel: 'Combobox input',
|
|
204
|
+
clearAriaLabel: 'Clear selection',
|
|
185
205
|
},
|
|
186
206
|
);
|
|
187
207
|
|
|
@@ -212,7 +232,19 @@ const combobox = useTemplateRef('combobox');
|
|
|
212
232
|
const listbox = useTemplateRef('listbox');
|
|
213
233
|
const comboboxControl = useTemplateRef('comboboxControl');
|
|
214
234
|
|
|
215
|
-
const
|
|
235
|
+
const showListbox = ref(false);
|
|
236
|
+
|
|
237
|
+
const isControlled = computed(() => props.open !== undefined);
|
|
238
|
+
|
|
239
|
+
const isOpen = computed({
|
|
240
|
+
get() {
|
|
241
|
+
return isControlled.value ? (props.open as boolean) : showListbox.value;
|
|
242
|
+
},
|
|
243
|
+
set(value: boolean) {
|
|
244
|
+
emit('update:open', value);
|
|
245
|
+
if (!isControlled.value) showListbox.value = value;
|
|
246
|
+
},
|
|
247
|
+
});
|
|
216
248
|
|
|
217
249
|
const activeDescendantId = computed(() => {
|
|
218
250
|
const activeIndex = listbox.value?.activeIndex || -1;
|
|
@@ -252,30 +284,28 @@ function handleClickOutside(event: MouseEvent) {
|
|
|
252
284
|
!combobox.value?.contains(event.target as Node) &&
|
|
253
285
|
!listbox.value?.listboxEl?.contains(event.target as Node)
|
|
254
286
|
) {
|
|
255
|
-
|
|
287
|
+
closeListbox();
|
|
256
288
|
}
|
|
257
289
|
}
|
|
258
290
|
|
|
259
|
-
function
|
|
291
|
+
function openListbox() {
|
|
260
292
|
isOpen.value = true;
|
|
261
|
-
emit('update:open', true);
|
|
262
293
|
document.addEventListener('click', handleClickOutside);
|
|
263
294
|
}
|
|
264
295
|
|
|
265
|
-
function
|
|
296
|
+
function closeListbox() {
|
|
266
297
|
isOpen.value = false;
|
|
267
|
-
emit('update:open', false);
|
|
268
298
|
document.removeEventListener('click', handleClickOutside);
|
|
269
299
|
}
|
|
270
300
|
|
|
271
301
|
function onSelectionUpdate() {
|
|
272
302
|
if (!props.multiple) {
|
|
273
|
-
|
|
303
|
+
closeListbox();
|
|
274
304
|
}
|
|
275
305
|
}
|
|
276
306
|
|
|
277
307
|
function toggleListbox() {
|
|
278
|
-
return isOpen.value ?
|
|
308
|
+
return isOpen.value ? closeListbox() : openListbox();
|
|
279
309
|
}
|
|
280
310
|
|
|
281
311
|
function getOptionLabel(value: string | number) {
|
|
@@ -23,6 +23,12 @@ A combobox is an input field that allows users to select an option from a dropdo
|
|
|
23
23
|
| `selectLabel` | Label for the "Select all" button. | `string` | `"Select all"` |
|
|
24
24
|
| `clearLabel` | Label for the "Clear selection" button. | `string` | `"Clear"` |
|
|
25
25
|
| `options*` | Array of options to display in the listbox. | `ListboxOption[]` | - |
|
|
26
|
+
| `controlAriaLabel` | Accessible label for the combobox trigger button. Should describe what
|
|
27
|
+
the combobox selects (e.g. "Select a country"). | `string` | `"Combobox input"` |
|
|
28
|
+
| `clearAriaLabel` | Accessible label for the clear selection button. | `string` | `"Clear selection"` |
|
|
29
|
+
| `open` | Controls the open state of the listbox. When provided, the component operates in controlled
|
|
30
|
+
mode and delegates open/close decisions to the parent via `v-model:open`. When omitted, the
|
|
31
|
+
component manages its own open state internally. | `boolean` | - |
|
|
26
32
|
|
|
27
33
|
## Slots
|
|
28
34
|
|
|
@@ -132,7 +132,7 @@ export const TopbarActions: Story = {
|
|
|
132
132
|
<template v-slot:topbar>
|
|
133
133
|
<MDataTableTop>
|
|
134
134
|
<template v-slot:actions>
|
|
135
|
-
<MToggle size="s" label="Toggle Label" />
|
|
135
|
+
<MToggle size="s" label="Toggle Label" id="idofthetoggle" />
|
|
136
136
|
<MButton iconPosition="left" outlined size="s"><template #icon><Filter24 /></template> Filter</MButton>
|
|
137
137
|
<MButton iconPosition="only" outlined size="s"><template #icon><Settings24 /></template></MButton>
|
|
138
138
|
<MButton appearance="accent" size="s" >Primary action</MButton>
|
|
@@ -256,7 +256,7 @@ export const TopbarFull: Story = {
|
|
|
256
256
|
<div style="display: flex;align-items: center;">999 selected</div>
|
|
257
257
|
</template>
|
|
258
258
|
<template v-slot:actions>
|
|
259
|
-
<MToggle size="s" label="Toggle Label" />
|
|
259
|
+
<MToggle size="s" label="Toggle Label" id="idofthetoggletopbarfull" />
|
|
260
260
|
<MButton iconPosition="left" outlined size="s"><template #icon><Filter24 /></template> Filter</MButton>
|
|
261
261
|
<MButton iconPosition="only" outlined size="s"><template #icon><Settings24 /></template></MButton>
|
|
262
262
|
<MButton appearance="accent" size="s" >Primary action</MButton>
|
|
@@ -2,6 +2,7 @@ import { ref } from 'vue';
|
|
|
2
2
|
import * as utils from './utils';
|
|
3
3
|
|
|
4
4
|
// Components
|
|
5
|
+
import '@mozaic-ds/datatable-vue/style.css';
|
|
5
6
|
import { MDataTable, MDataTableColumn } from '@mozaic-ds/datatable-vue';
|
|
6
7
|
import MTextInput from '../textinput/MTextInput.vue';
|
|
7
8
|
import MStatusBadge from '../statusbadge/MStatusBadge.vue';
|
|
@@ -2,6 +2,7 @@ import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
|
2
2
|
import * as utils from './utils';
|
|
3
3
|
|
|
4
4
|
// Components
|
|
5
|
+
import '@mozaic-ds/datatable-vue/style.css';
|
|
5
6
|
import { MDataTable } from '@mozaic-ds/datatable-vue';
|
|
6
7
|
import MButton from '../button/MButton.vue';
|
|
7
8
|
import { Filter24 } from '@mozaic-ds/icons-vue';
|
|
@@ -2,6 +2,7 @@ import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
|
2
2
|
import * as utils from './utils';
|
|
3
3
|
|
|
4
4
|
// Components
|
|
5
|
+
import '@mozaic-ds/datatable-vue/style.css';
|
|
5
6
|
import { MDataTable, MDataTableColumn } from '@mozaic-ds/datatable-vue';
|
|
6
7
|
|
|
7
8
|
const meta: Meta<typeof MDataTable> = {
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { ref } from 'vue';
|
|
2
|
+
import * as utils from './utils';
|
|
3
|
+
|
|
4
|
+
// Components
|
|
5
|
+
import '@mozaic-ds/datatable-vue/style.css';
|
|
6
|
+
import { MDataTable, MDataTableColumn } from '@mozaic-ds/datatable-vue';
|
|
7
|
+
|
|
8
|
+
// Styles
|
|
9
|
+
import './assets/styles.scss';
|
|
10
|
+
|
|
11
|
+
// Scripts
|
|
12
|
+
const api = {
|
|
13
|
+
fetchItems: ({ sort, size, page }) =>
|
|
14
|
+
new Promise((resolve) => {
|
|
15
|
+
setTimeout(() => {
|
|
16
|
+
let items = [...utils.addlDeals];
|
|
17
|
+
if (sort)
|
|
18
|
+
items = items.sort((itemA, itemB) => {
|
|
19
|
+
const { column, direction } = sort;
|
|
20
|
+
if (direction === 'ASC') {
|
|
21
|
+
return itemA[column] > itemB[column] ? 1 : -1;
|
|
22
|
+
} else {
|
|
23
|
+
return itemA[column] < itemB[column] ? 1 : -1;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
const paginated = items.slice((page - 1) * size, page * size);
|
|
27
|
+
resolve(paginated);
|
|
28
|
+
}, 1000);
|
|
29
|
+
}),
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default {
|
|
33
|
+
title: 'DataTable/MDataTable Pageable',
|
|
34
|
+
component: MDataTable,
|
|
35
|
+
args: utils.args,
|
|
36
|
+
argTypes: utils.argtypes,
|
|
37
|
+
parameters: {
|
|
38
|
+
componentName: 'MDataTable',
|
|
39
|
+
docs: { autodocs: false },
|
|
40
|
+
backgrounds: utils.backgrounds,
|
|
41
|
+
},
|
|
42
|
+
render: (args) => ({
|
|
43
|
+
components: { MDataTable, MDataTableColumn },
|
|
44
|
+
setup() {
|
|
45
|
+
return { args };
|
|
46
|
+
},
|
|
47
|
+
template: `
|
|
48
|
+
<MDataTable v-bind="args">
|
|
49
|
+
<!--
|
|
50
|
+
Default content
|
|
51
|
+
-->
|
|
52
|
+
<MDataTableColumn label="Name" value="name" />
|
|
53
|
+
<MDataTableColumn label="Stock" value="stock" />
|
|
54
|
+
|
|
55
|
+
<!-- Start Date -->
|
|
56
|
+
<MDataTableColumn label="Start date" value="startDate" />
|
|
57
|
+
<template v-slot:cell.startDate="{ item }">
|
|
58
|
+
{{ formatDate(item.startDate) }}
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<!-- End Date -->
|
|
62
|
+
<MDataTableColumn label="End date" value="endDate" />
|
|
63
|
+
<template v-slot:cell.endDate="{ item }">
|
|
64
|
+
{{ formatDate(item.startDate) }}
|
|
65
|
+
</template>
|
|
66
|
+
|
|
67
|
+
<!-- Status -->
|
|
68
|
+
<MDataTableColumn label="Statut" value="status" />
|
|
69
|
+
<template v-slot:cell.status="{ item }"> {{ item.status.code }} </template>
|
|
70
|
+
</MDataTable>
|
|
71
|
+
`,
|
|
72
|
+
methods: {
|
|
73
|
+
formatDate(date) {
|
|
74
|
+
return new Date(date).toLocaleString();
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
}),
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export const Default = {
|
|
81
|
+
args: {
|
|
82
|
+
pageable: true,
|
|
83
|
+
totalItems: utils.deals10.length,
|
|
84
|
+
accessibilityLabels: { paginationAriaLabel: 'Select a DataTable page' },
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const CustomPaginationText = {
|
|
89
|
+
args: { ...Default.args },
|
|
90
|
+
render: (args) => ({
|
|
91
|
+
components: { MDataTable, MDataTableColumn },
|
|
92
|
+
setup() {
|
|
93
|
+
return { args };
|
|
94
|
+
},
|
|
95
|
+
template: `
|
|
96
|
+
<MDataTable v-bind="args">
|
|
97
|
+
<!--
|
|
98
|
+
Default content
|
|
99
|
+
-->
|
|
100
|
+
<MDataTableColumn label="Name" value="name" />
|
|
101
|
+
<MDataTableColumn label="Stock" value="stock" />
|
|
102
|
+
|
|
103
|
+
<!-- Start Date -->
|
|
104
|
+
<MDataTableColumn label="Start date" value="startDate" />
|
|
105
|
+
<template v-slot:cell.startDate="{ item }">
|
|
106
|
+
{{ formatDate(item.startDate) }}
|
|
107
|
+
</template>
|
|
108
|
+
|
|
109
|
+
<!-- End Date -->
|
|
110
|
+
<MDataTableColumn label="End date" value="endDate" />
|
|
111
|
+
<template v-slot:cell.endDate="{ item }">
|
|
112
|
+
{{ formatDate(item.startDate) }}
|
|
113
|
+
</template>
|
|
114
|
+
|
|
115
|
+
<!-- Status -->
|
|
116
|
+
<MDataTableColumn label="Statut" value="status" />
|
|
117
|
+
<template v-slot:cell.status="{ item }"> {{ item.status.code }} </template>
|
|
118
|
+
|
|
119
|
+
<!-- Custom Pagination Text -->
|
|
120
|
+
<template v-slot:paging.text="{ option }">
|
|
121
|
+
Custom pagination - {{ option.value }} / {{ option.length }}
|
|
122
|
+
</template>
|
|
123
|
+
</MDataTable>
|
|
124
|
+
`,
|
|
125
|
+
methods: {
|
|
126
|
+
formatDate(date) {
|
|
127
|
+
return new Date(date).toLocaleString();
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
}),
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export const FullPaginatedExample = {
|
|
134
|
+
args: {
|
|
135
|
+
pageable: true,
|
|
136
|
+
itemsPerPage: 10,
|
|
137
|
+
},
|
|
138
|
+
render: (args) => ({
|
|
139
|
+
components: { MDataTable, MDataTableColumn },
|
|
140
|
+
setup() {
|
|
141
|
+
const items = ref(utils.deals10);
|
|
142
|
+
const totalItems = ref(utils.addlDeals.length);
|
|
143
|
+
const loading = ref(false);
|
|
144
|
+
const currentPage = ref(1);
|
|
145
|
+
return { args, items, totalItems, loading, currentPage };
|
|
146
|
+
},
|
|
147
|
+
template: `
|
|
148
|
+
<MDataTable
|
|
149
|
+
v-bind="args"
|
|
150
|
+
:items="items"
|
|
151
|
+
:totalItems="totalItems"
|
|
152
|
+
:loading="loading"
|
|
153
|
+
@change="updatePage"
|
|
154
|
+
>
|
|
155
|
+
<!--
|
|
156
|
+
Default content
|
|
157
|
+
-->
|
|
158
|
+
<MDataTableColumn label="Name" value="name" />
|
|
159
|
+
<MDataTableColumn label="Stock" value="stock" />
|
|
160
|
+
|
|
161
|
+
<!-- Start Date -->
|
|
162
|
+
<MDataTableColumn label="Start date" value="startDate" />
|
|
163
|
+
<template v-slot:cell.startDate="{ item }">
|
|
164
|
+
{{ formatDate(item.startDate) }}
|
|
165
|
+
</template>
|
|
166
|
+
|
|
167
|
+
<!-- End Date -->
|
|
168
|
+
<MDataTableColumn label="End date" value="endDate" />
|
|
169
|
+
<template v-slot:cell.endDate="{ item }">
|
|
170
|
+
{{ formatDate(item.startDate) }}
|
|
171
|
+
</template>
|
|
172
|
+
|
|
173
|
+
<!-- Status -->
|
|
174
|
+
<MDataTableColumn label="Statut" value="status" />
|
|
175
|
+
<template v-slot:cell.status="{ item }"> {{ item.status.code }} </template>
|
|
176
|
+
</MDataTable>
|
|
177
|
+
`,
|
|
178
|
+
methods: {
|
|
179
|
+
formatDate(date) {
|
|
180
|
+
return new Date(date).toLocaleString();
|
|
181
|
+
},
|
|
182
|
+
async updatePage({
|
|
183
|
+
sort = undefined,
|
|
184
|
+
size = undefined,
|
|
185
|
+
page = undefined,
|
|
186
|
+
}) {
|
|
187
|
+
console.log('Poulou');
|
|
188
|
+
this.loading = true;
|
|
189
|
+
this.items = await api.fetchItems({ sort, size, page });
|
|
190
|
+
this.loading = false;
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
}),
|
|
194
|
+
};
|
|
@@ -2,6 +2,7 @@ import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
|
2
2
|
import * as utils from './utils';
|
|
3
3
|
|
|
4
4
|
// Components
|
|
5
|
+
import '@mozaic-ds/datatable-vue/style.css';
|
|
5
6
|
import { MDataTable, MDataTableColumn } from '@mozaic-ds/datatable-vue';
|
|
6
7
|
import MCheckbox from '../checkbox/MCheckbox.vue';
|
|
7
8
|
|
|
@@ -17,6 +17,7 @@ const meta: Meta<typeof MDatepicker> = {
|
|
|
17
17
|
},
|
|
18
18
|
args: {
|
|
19
19
|
id: 'datepickerId',
|
|
20
|
+
modelValue: '2025-07-22',
|
|
20
21
|
ariaLabel: 'enter the date',
|
|
21
22
|
},
|
|
22
23
|
render: (args) => ({
|
|
@@ -29,6 +30,7 @@ const meta: Meta<typeof MDatepicker> = {
|
|
|
29
30
|
template: `
|
|
30
31
|
<MDatepicker
|
|
31
32
|
v-bind="args"
|
|
33
|
+
v-model="args.modelValue"
|
|
32
34
|
@update:modelValue="handleUpdate"
|
|
33
35
|
></MDatepicker>
|
|
34
36
|
`,
|
|
@@ -3,20 +3,18 @@
|
|
|
3
3
|
<input
|
|
4
4
|
:id="id"
|
|
5
5
|
class="mc-datepicker__control mc-text-input__control"
|
|
6
|
-
:value="
|
|
6
|
+
:value="model"
|
|
7
7
|
type="date"
|
|
8
8
|
:name="name"
|
|
9
9
|
:disabled="disabled"
|
|
10
10
|
:aria-invalid="isInvalid"
|
|
11
11
|
:readonly="readonly"
|
|
12
12
|
v-bind="$attrs"
|
|
13
|
-
@input="
|
|
14
|
-
emit('update:modelValue', ($event.target as HTMLInputElement).value)
|
|
15
|
-
"
|
|
13
|
+
@input="model = ($event.target as HTMLInputElement).value"
|
|
16
14
|
/>
|
|
17
15
|
|
|
18
16
|
<div
|
|
19
|
-
v-if="isClearable &&
|
|
17
|
+
v-if="isClearable && model"
|
|
20
18
|
class="mc-datepicker__controls-options mc-controls-options"
|
|
21
19
|
>
|
|
22
20
|
<button
|
|
@@ -24,7 +22,8 @@
|
|
|
24
22
|
class="mc-controls-options__button"
|
|
25
23
|
@click="clearValue"
|
|
26
24
|
>
|
|
27
|
-
<
|
|
25
|
+
<component
|
|
26
|
+
:is="props.size === 'm' ? CrossCircleFilled24 : CrossCircleFilled20"
|
|
28
27
|
class="mc-controls-options__icon"
|
|
29
28
|
aria-hidden="true"
|
|
30
29
|
/>
|
|
@@ -35,8 +34,8 @@
|
|
|
35
34
|
</template>
|
|
36
35
|
|
|
37
36
|
<script setup lang="ts">
|
|
38
|
-
import { computed
|
|
39
|
-
import { CrossCircleFilled24 } from '@mozaic-ds/icons-vue';
|
|
37
|
+
import { computed } from 'vue';
|
|
38
|
+
import { CrossCircleFilled20, CrossCircleFilled24 } from '@mozaic-ds/icons-vue';
|
|
40
39
|
/**
|
|
41
40
|
* A date picker is an input component that allows users to select a date from a calendar interface or manually enter a date value. It enhances usability by providing structured date selection, reducing input errors, and ensuring format consistency. Date Pickers are commonly used in forms, booking systems, scheduling tools, and data filtering interfaces to facilitate accurate date entry.<br><br> To put a label, requierement text, help text or to apply a valid or invalid message, the examples are available in the [Field section](/docs/form-elements-field--docs#input).
|
|
42
41
|
*/
|
|
@@ -93,10 +92,17 @@ const classObject = computed(() => {
|
|
|
93
92
|
};
|
|
94
93
|
});
|
|
95
94
|
|
|
96
|
-
const
|
|
95
|
+
const model = computed({
|
|
96
|
+
get() {
|
|
97
|
+
return props.modelValue;
|
|
98
|
+
},
|
|
99
|
+
set(value: string | number) {
|
|
100
|
+
emit('update:modelValue', value);
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
|
|
97
104
|
const clearValue = () => {
|
|
98
|
-
|
|
99
|
-
emit('update:modelValue', '');
|
|
105
|
+
model.value = '';
|
|
100
106
|
};
|
|
101
107
|
|
|
102
108
|
const emit = defineEmits<{
|
|
@@ -26,6 +26,7 @@ A divider is a visual element used to separate content or sections within an int
|
|
|
26
26
|
- [MFileUploaderItem](../fileuploaderitem)
|
|
27
27
|
- [MSidebarFooter](../sidebarfooter)
|
|
28
28
|
- [_MSidebarFooterMenu](../sidebarfooter)
|
|
29
|
+
- [MSidebarShortcuts](../sidebarshortcuts)
|
|
29
30
|
- [MStepperBottomBar](../stepperbottombar)
|
|
30
31
|
- [MTabs](../tabs)
|
|
31
32
|
|
|
@@ -38,6 +39,7 @@ graph TD;
|
|
|
38
39
|
MFileUploaderItem --> MDivider
|
|
39
40
|
MSidebarFooter --> MDivider
|
|
40
41
|
_MSidebarFooterMenu --> MDivider
|
|
42
|
+
MSidebarShortcuts --> MDivider
|
|
41
43
|
MStepperBottomBar --> MDivider
|
|
42
44
|
MTabs --> MDivider
|
|
43
45
|
style MDivider fill:#008240,stroke:#333,stroke-width:4px
|
|
@@ -226,11 +226,13 @@ onUnmounted(() => {
|
|
|
226
226
|
});
|
|
227
227
|
|
|
228
228
|
const onClickOverlay = (event: MouseEvent) => {
|
|
229
|
-
if (
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
229
|
+
if (props.closeOnOverlay) {
|
|
230
|
+
const path = event.composedPath();
|
|
231
|
+
const clickedInsideDrawer =
|
|
232
|
+
sectionRef.value && path.includes(sectionRef.value);
|
|
233
|
+
if (!clickedInsideDrawer) {
|
|
234
|
+
onClose();
|
|
235
|
+
}
|
|
234
236
|
}
|
|
235
237
|
};
|
|
236
238
|
|
|
@@ -13,6 +13,24 @@ const meta: Meta<typeof MLink> = {
|
|
|
13
13
|
},
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
|
+
argTypes: {
|
|
17
|
+
appearance: {
|
|
18
|
+
options: [
|
|
19
|
+
'primary',
|
|
20
|
+
'secondary',
|
|
21
|
+
'accent',
|
|
22
|
+
'inverse',
|
|
23
|
+
'standard (deprecated)',
|
|
24
|
+
],
|
|
25
|
+
mapping: {
|
|
26
|
+
primary: 'primary',
|
|
27
|
+
secondary: 'secondary',
|
|
28
|
+
accent: 'accent',
|
|
29
|
+
inverse: 'inverse',
|
|
30
|
+
'standard (deprecated)': 'standard',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
16
34
|
args: {
|
|
17
35
|
default: 'Stand-alone link',
|
|
18
36
|
href: '#',
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
</template>
|
|
27
27
|
|
|
28
28
|
<script setup lang="ts">
|
|
29
|
-
import { computed, type VNode } from 'vue';
|
|
29
|
+
import { computed, onMounted, type VNode } from 'vue';
|
|
30
30
|
/**
|
|
31
31
|
* A link is an interactive text element used to navigate between pages, sections, or external resources. It is typically underlined and styled to indicate its clickable nature. Links can be standalone or embedded within text, and they may include icons to reinforce their purpose. They are essential for navigation and content referencing in web and application interfaces.
|
|
32
32
|
*/
|
|
@@ -38,8 +38,14 @@ const props = withDefaults(
|
|
|
38
38
|
iconPosition?: 'left' | 'right';
|
|
39
39
|
/**
|
|
40
40
|
* Allows to define the link appearance.
|
|
41
|
+
* `standard` value is deprecated and will be removed in the next major release. Use `primary` instead.
|
|
41
42
|
*/
|
|
42
|
-
appearance?:
|
|
43
|
+
appearance?:
|
|
44
|
+
| 'primary'
|
|
45
|
+
| 'secondary'
|
|
46
|
+
| 'accent'
|
|
47
|
+
| 'inverse'
|
|
48
|
+
| /** @deprecated Use 'primary' instead */ 'standard';
|
|
43
49
|
/**
|
|
44
50
|
* Allows to define the link size.
|
|
45
51
|
*/
|
|
@@ -62,7 +68,7 @@ const props = withDefaults(
|
|
|
62
68
|
router?: boolean;
|
|
63
69
|
}>(),
|
|
64
70
|
{
|
|
65
|
-
appearance: '
|
|
71
|
+
appearance: 'primary',
|
|
66
72
|
size: 's',
|
|
67
73
|
iconPosition: 'left',
|
|
68
74
|
},
|
|
@@ -82,7 +88,9 @@ defineSlots<{
|
|
|
82
88
|
const classObject = computed(() => {
|
|
83
89
|
return {
|
|
84
90
|
[`mc-link--${props.appearance}`]:
|
|
85
|
-
props.appearance &&
|
|
91
|
+
props.appearance &&
|
|
92
|
+
props.appearance !== 'standard' &&
|
|
93
|
+
props.appearance !== 'primary',
|
|
86
94
|
[`mc-link--${props.size}`]: props.size && props.size != 's',
|
|
87
95
|
'mc-link--inline': props.inline,
|
|
88
96
|
'mc-link--stand-alone': !props.inline,
|
|
@@ -102,6 +110,14 @@ const linkProps = computed(() => {
|
|
|
102
110
|
target: props.target,
|
|
103
111
|
};
|
|
104
112
|
});
|
|
113
|
+
|
|
114
|
+
onMounted(() => {
|
|
115
|
+
if (props.appearance === 'standard' && import.meta.env.DEV) {
|
|
116
|
+
console.warn(
|
|
117
|
+
'[Mozaic]: The value "standard" for the "appearance" prop is deprecated — use "primary" instead.',
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
105
121
|
</script>
|
|
106
122
|
|
|
107
123
|
<style lang="scss" scoped>
|
|
@@ -8,7 +8,8 @@ A link is an interactive text element used to navigate between pages, sections,
|
|
|
8
8
|
| Name | Description | Type | Default |
|
|
9
9
|
| --- | --- | --- | --- |
|
|
10
10
|
| `iconPosition` | Position of the icon relative to the text. | `"left"` `"right"` | `"left"` |
|
|
11
|
-
| `appearance` | Allows to define the link appearance.
|
|
11
|
+
| `appearance` | Allows to define the link appearance.
|
|
12
|
+
`standard` value is deprecated and will be removed in the next major release. Use `primary` instead. | `"standard"` `"inverse"` `"accent"` `"primary"` `"secondary"` | `"primary"` |
|
|
12
13
|
| `size` | Allows to define the link size. | `"s"` `"m"` | `"s"` |
|
|
13
14
|
| `href` | URL for the link (for external links or the `to` prop for `router-link`). | `string` | - |
|
|
14
15
|
| `target` | Where to open the link. | `"_self"` `"_blank"` `"_parent"` `"_top"` | - |
|