@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
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { Meta, Source } from '@storybook/addon-docs/blocks';
|
|
2
|
-
|
|
3
|
-
<Meta title="Brand Presets" />
|
|
4
|
-
|
|
5
|
-
# Brand Presets
|
|
6
|
-
|
|
7
|
-
**Mozaic** is a **multi-brand** design system.<br/>
|
|
8
|
-
This means that it is fully customisable so that its constituent elements _(foundations, components, etc.)_ can be adapted to the graphic charter of the brand that uses it.
|
|
9
|
-
|
|
10
|
-
To simplify this aspect of customising **Mozaic** for you, we have created themes _(which we also call **"presets"**)_ ready to use according to your context of use.
|
|
11
|
-
|
|
12
|
-
Currently **Mozaic** can be customized with the following presets:
|
|
13
|
-
|
|
14
|
-
- Preset **Leroy Merlin**: this is the default preset/theme configured when **Mozaic** was first installed
|
|
15
|
-
- Preset **Adeo**: dedicated to the **Adeo Group's** internal interfaces and products
|
|
16
|
-
- Preset **Bricoman**: dedicated to the interfaces and products of the **Bricoman** brand
|
|
17
|
-
|
|
18
|
-
The rest of this documentation shows you how to use/install the Adeo preset in your project.
|
|
19
|
-
|
|
20
|
-
> Note that the procedure remains the same for all other presets.<br/> You just need to replace all references to "Adeo" with the brand name of your choice.
|
|
21
|
-
|
|
22
|
-
## Using the Adeo's preset
|
|
23
|
-
|
|
24
|
-
Before anything else, make sure you have followed the **Mozaic-Vue** installation procedure as described in the [Getting Started](?path=/docs/getting-started--docs) page.
|
|
25
|
-
|
|
26
|
-
Once **Mozaic-Vue** is installed as shown, we can make the following changes:
|
|
27
|
-
|
|
28
|
-
### 1. Loading preset
|
|
29
|
-
|
|
30
|
-
All it has to do is insert the following code into its main Sass file (entrypoint stylesheet):
|
|
31
|
-
|
|
32
|
-
<Source
|
|
33
|
-
language="css"
|
|
34
|
-
dark
|
|
35
|
-
code={`
|
|
36
|
-
// Entrypoint stylesheet
|
|
37
|
-
@use "@mozaic-ds/tokens/<presetName>/theme" as *;
|
|
38
|
-
`}
|
|
39
|
-
/>
|
|
40
|
-
|
|
41
|
-
> [!NOTE]
|
|
42
|
-
> The `<presetName>` string should be replaced by the name of the preset you want, one of the following values: `adeo | mbrand`.
|
|
43
|
-
> As the `leroymerlin` preset is the default preset, you don't need to use this syntax to use it.
|
|
44
|
-
|
|
45
|
-
For example, for ADEO
|
|
46
|
-
|
|
47
|
-
<Source
|
|
48
|
-
language="css"
|
|
49
|
-
dark
|
|
50
|
-
code={`
|
|
51
|
-
// Entrypoint stylesheet
|
|
52
|
-
@use "@mozaic-ds/tokens/adeo/theme" as *;
|
|
53
|
-
`}
|
|
54
|
-
/>
|
|
55
|
-
|
|
56
|
-
### 2. Font by brand
|
|
57
|
-
|
|
58
|
-
Each brand is distinguished not only by different styles but also by a different font.
|
|
59
|
-
|
|
60
|
-
The table below summarises which font to use depending on the brand.
|
|
61
|
-
|
|
62
|
-
<table>
|
|
63
|
-
<tr>
|
|
64
|
-
<td>Brand</td>
|
|
65
|
-
<td>Font</td>
|
|
66
|
-
</tr>
|
|
67
|
-
<tr>
|
|
68
|
-
<td>Leroy Merlin</td>
|
|
69
|
-
<td>
|
|
70
|
-
[LeroyMerlinSans](https://mozaic.adeo.cloud/foundations/typography/font-families/)
|
|
71
|
-
</td>
|
|
72
|
-
</tr>
|
|
73
|
-
<tr>
|
|
74
|
-
<td>Adeo</td>
|
|
75
|
-
<td>[Roboto](https://fonts.google.com/specimen/Roboto)</td>
|
|
76
|
-
</tr>
|
|
77
|
-
<tr>
|
|
78
|
-
<td>Bricoman</td>
|
|
79
|
-
<td>[Inter](https://fonts.google.com/specimen/Inter)</td>
|
|
80
|
-
</tr>
|
|
81
|
-
</table>
|
|
82
|
-
|
|
83
|
-
For example, here is how to include the Roboto font in your HTML for the Adeo brand:
|
|
84
|
-
|
|
85
|
-
<Source
|
|
86
|
-
language="html"
|
|
87
|
-
dark
|
|
88
|
-
code={`
|
|
89
|
-
<head>
|
|
90
|
-
<meta charset="UTF-8" />
|
|
91
|
-
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
92
|
-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
93
|
-
<link
|
|
94
|
-
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap"
|
|
95
|
-
rel="stylesheet"
|
|
96
|
-
/>
|
|
97
|
-
</head>
|
|
98
|
-
`}
|
|
99
|
-
/>
|
|
100
|
-
|
|
101
|
-
From there, we can update the main style sheet of your project, in order to import the right font.
|
|
102
|
-
|
|
103
|
-
<Source
|
|
104
|
-
language='css'
|
|
105
|
-
dark
|
|
106
|
-
code={`
|
|
107
|
-
@use '@mozaic-ds/tokens/adeo/theme' as *;
|
|
108
|
-
|
|
109
|
-
body {
|
|
110
|
-
font-family: var(--font-family, 'Roboto', sans-serif);
|
|
111
|
-
}
|
|
112
|
-
`} />
|
|
113
|
-
|
|
114
|
-
Specific for LM fonts
|
|
115
|
-
|
|
116
|
-
> This section describes the use of fonts for the **Leroy Merlin** preset, but if you are using another preset, please see [the associated documentation](?path=/docs/using-presets--docs).
|
|
117
|
-
|
|
118
|
-
The theme defined by default when **Mozaic-Vue** is first installed/used is the theme corresponding to the **Leroy Merlin** charter.
|
|
119
|
-
|
|
120
|
-
For any use of the **Leroy Merlin** theme, it is recommended to use the font [LeroyMerlinSans](/typography/font-families/) which has been specially designed for **Leroy Merlin** products.
|
|
121
|
-
|
|
122
|
-
To use the `LeroyMerlinSans` font in your project, you must copy it into your project so that it is present in your `assets`.
|
|
123
|
-
|
|
124
|
-
You can do this as follows:
|
|
125
|
-
|
|
126
|
-
1. Create a folder in your project where you can save the fonts, for example: `static/assets/fonts`
|
|
127
|
-
|
|
128
|
-
2. Copy fonts from Mozaic dependencies:
|
|
129
|
-
|
|
130
|
-
<Source
|
|
131
|
-
language="bash"
|
|
132
|
-
dark
|
|
133
|
-
code="cp node_modules/@mozaic-ds/web-fonts/*.{woff,woff2} static/assets/fonts"
|
|
134
|
-
/>
|
|
135
|
-
|
|
136
|
-
### 3. Usage
|
|
137
|
-
|
|
138
|
-
At this stage, the integration of the **Mozaic-Vue** components should normally be customised with the preset values.
|
|
139
|
-
|
|
140
|
-
All that remains is to use the components as usual:
|
|
141
|
-
|
|
142
|
-
<Source
|
|
143
|
-
language="html"
|
|
144
|
-
dark
|
|
145
|
-
code='<MButton label="This is a Mozaic Button" />'
|
|
146
|
-
/>
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { Meta, Source } from '@storybook/addon-docs/blocks';
|
|
2
|
-
|
|
3
|
-
<Meta title="Dark Mode" />
|
|
4
|
-
|
|
5
|
-
# Dark Mode
|
|
6
|
-
|
|
7
|
-
A concise guide explaining **how dark mode works** with your CSS variables and **how to use it** in Storybook.
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## What dark mode is (high‑level)
|
|
12
|
-
|
|
13
|
-
Dark mode is implemented with **two sets of CSS variables** (tokens):
|
|
14
|
-
|
|
15
|
-
- **Light** values live under `:root`.
|
|
16
|
-
- **Dark** values override under `:root[data-theme="dark"]`.
|
|
17
|
-
|
|
18
|
-
Components only reference tokens with `var(--token-name)` — switching theme is just toggling the `data-theme` attribute (no component code changes).
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## Token structure (SCSS → CSS)
|
|
23
|
-
|
|
24
|
-
Your presets export SCSS like this:
|
|
25
|
-
|
|
26
|
-
<Source
|
|
27
|
-
language="scss"
|
|
28
|
-
dark
|
|
29
|
-
code={`
|
|
30
|
-
$root-selector: ':root' !default;
|
|
31
|
-
$dark-selector: '[data-theme="dark"]' !default;
|
|
32
|
-
|
|
33
|
-
#{$root-selector} {
|
|
34
|
-
/_ Light tokens _/
|
|
35
|
-
--color-background-primary: #ffffff;
|
|
36
|
-
--color-text-primary: #000000;
|
|
37
|
-
/_ … all your light variables … _/
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
#{$root-selector}#{$dark-selector} {
|
|
41
|
-
/_ Dark tokens _/
|
|
42
|
-
--color-background-primary: #191919;
|
|
43
|
-
--color-text-primary: #d9d9d9;
|
|
44
|
-
/_ … all your dark variables … _/
|
|
45
|
-
}
|
|
46
|
-
`}
|
|
47
|
-
/>
|
|
48
|
-
|
|
49
|
-
After compilation, this becomes standard CSS:
|
|
50
|
-
|
|
51
|
-
<Source
|
|
52
|
-
language="css"
|
|
53
|
-
dark
|
|
54
|
-
code={`
|
|
55
|
-
:root {
|
|
56
|
-
/* light tokens */
|
|
57
|
-
}
|
|
58
|
-
:root[data-theme='dark'] {
|
|
59
|
-
/* dark tokens */
|
|
60
|
-
}
|
|
61
|
-
`}
|
|
62
|
-
/>
|
|
63
|
-
|
|
64
|
-
> If you can’t (or don’t want to) target `:root`, you can pass a different `$root-selector` when building your theme and apply `data-theme="dark"` on that container instead.
|
|
65
|
-
|
|
66
|
-
---
|
|
67
|
-
|
|
68
|
-
## Using tokens inside components
|
|
69
|
-
|
|
70
|
-
To enable the dark mode you have to ensure to:
|
|
71
|
-
|
|
72
|
-
- Add the `data-theme` attribute in your root element with the value `dark`,
|
|
73
|
-
- Use variables — never hard‑code colors or sizes
|
|
74
|
-
|
|
75
|
-
```html
|
|
76
|
-
<div class="root" data-theme="dark">…</div>
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
<Source
|
|
80
|
-
language="sass"
|
|
81
|
-
dark
|
|
82
|
-
code={`
|
|
83
|
-
@use "@mozaic-ds/tokens" as *;
|
|
84
|
-
|
|
85
|
-
.mc-component: {
|
|
86
|
-
background-color: $--color-background-primary;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
`}
|
|
90
|
-
/>
|
|
91
|
-
|
|
92
|
-
When the theme changes, these values update automatically via CSS.
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
## Accessibility & good practices
|
|
97
|
-
|
|
98
|
-
- Aim for **WCAG AA** contrast at minimum; verify text vs. background pairs.
|
|
99
|
-
- Prefer **semantic tokens** (`--button-color-…`, `--color-text-…`) over raw color hexes.
|
|
100
|
-
- Keep all component styles expressed in tokens so the **theme switch has zero component logic**.
|
|
101
|
-
|
|
102
|
-
---
|
|
103
|
-
|
|
104
|
-
## Troubleshooting
|
|
105
|
-
|
|
106
|
-
- **Dark toggle does nothing** → Ensure the tokens were imported **before** component styles and that `data-theme="dark"` is set on the same selector the tokens target (usually `:root`).
|
|
107
|
-
- **Weird colors** → Search for hard‑coded values and replace them with tokens.
|
|
108
|
-
- **Variables undefined** → Check your build order and that the SCSS was compiled to CSS and loaded by Storybook.
|
|
109
|
-
|
|
110
|
-
---
|
|
111
|
-
|
|
112
|
-
## Summary
|
|
113
|
-
|
|
114
|
-
- Light tokens on `:root`, dark overrides on `:root[data-theme="dark"]`.
|
|
115
|
-
- Components read tokens with `var(--$token-name)` — no runtime branching required.
|