@mozaic-ds/vue 1.0.0-beta.1 → 1.0.0-beta.4
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/LICENSE +51 -0
- package/README.md +218 -84
- package/dist/mozaic-vue.css +1 -1
- package/dist/mozaic-vue.d.ts +920 -0
- package/dist/mozaic-vue.js +877 -0
- package/dist/mozaic-vue.js.map +1 -0
- package/dist/mozaic-vue.umd.cjs +2 -0
- package/dist/mozaic-vue.umd.cjs.map +1 -0
- package/env.d.ts +1 -0
- package/package.json +80 -50
- package/src/components/Contributing.mdx +118 -0
- package/src/components/GettingStarted.mdx +39 -0
- package/src/components/Introduction.mdx +54 -0
- package/src/components/Support.mdx +18 -0
- package/src/components/badge/MBadge.spec.ts +16 -0
- package/src/components/badge/MBadge.stories.ts +50 -0
- package/src/components/badge/MBadge.vue +36 -34
- package/src/components/button/MButton.spec.ts +191 -0
- package/src/components/button/MButton.stories.ts +66 -0
- package/src/components/button/MButton.vue +98 -154
- package/src/components/checkbox/MCheckbox.spec.ts +104 -0
- package/src/components/checkbox/MCheckbox.stories.ts +83 -0
- package/src/components/checkbox/MCheckbox.vue +60 -101
- package/src/components/checkboxgroup/MCheckboxGroup.spec.ts +78 -0
- package/src/components/checkboxgroup/MCheckboxGroup.stories.ts +61 -0
- package/src/components/checkboxgroup/MCheckboxGroup.vue +97 -0
- package/src/components/field/MField.spec.ts +166 -0
- package/src/components/field/MField.stories.ts +376 -0
- package/src/components/field/MField.vue +78 -61
- package/src/components/fieldgroup/MFieldGroup.spec.ts +165 -0
- package/src/components/fieldgroup/MFieldGroup.stories.ts +274 -0
- package/src/components/fieldgroup/MFieldGroup.vue +79 -0
- package/src/components/iconbutton/MIconButton.spec.ts +108 -0
- package/src/components/iconbutton/MIconButton.stories.ts +66 -0
- package/src/components/iconbutton/MIconButton.vue +73 -0
- package/src/components/link/MLink.spec.ts +154 -0
- package/src/components/link/MLink.stories.ts +98 -0
- package/src/components/link/MLink.vue +86 -109
- package/src/components/loader/MLoader.spec.ts +104 -0
- package/src/components/loader/MLoader.stories.ts +45 -0
- package/src/components/loader/MLoader.vue +65 -55
- package/src/components/overlay/MOverlay.spec.ts +51 -0
- package/src/components/overlay/MOverlay.stories.ts +40 -0
- package/src/components/overlay/MOverlay.vue +27 -19
- package/src/components/quantityselector/MQuantitySelector.spec.ts +262 -0
- package/src/components/quantityselector/MQuantitySelector.stories.ts +89 -0
- package/src/components/quantityselector/MQuantitySelector.vue +160 -136
- package/src/components/radio/MRadio.spec.ts +104 -0
- package/src/components/radio/MRadio.stories.ts +68 -0
- package/src/components/radio/MRadio.vue +56 -39
- package/src/components/radiogroup/MRadioGroup.spec.ts +54 -0
- package/src/components/radiogroup/MRadioGroup.stories.ts +61 -0
- package/src/components/radiogroup/MRadioGroup.vue +79 -0
- package/src/components/select/MSelect.spec.ts +114 -0
- package/src/components/select/MSelect.stories.ts +101 -0
- package/src/components/select/MSelect.vue +77 -119
- package/src/components/statusbadge/MStatusBadge.stories.ts +45 -0
- package/src/components/statusbadge/MStatusBadge.vue +40 -0
- package/src/components/statusbadge/MStatusDot.vue +32 -0
- package/src/components/statusbadge/MstatusBadge.spec.ts +16 -0
- package/src/components/textarea/MTextArea.spec.ts +112 -0
- package/src/components/textarea/MTextArea.stories.ts +67 -0
- package/src/components/textarea/MTextArea.vue +81 -42
- package/src/components/textinput/MTextInput.spec.ts +121 -0
- package/src/components/textinput/MTextInput.stories.ts +114 -0
- package/src/components/textinput/MTextInput.vue +127 -47
- package/src/components/toggle/MToggle.spec.ts +99 -0
- package/src/components/toggle/MToggle.stories.ts +68 -0
- package/src/components/toggle/MToggle.vue +63 -103
- package/src/components/usingIcons.mdx +43 -0
- package/src/components/usingPresets.mdx +125 -0
- package/src/main.ts +39 -0
- package/dist/demo.html +0 -1
- package/dist/mozaic-vue.adeo.css +0 -45
- package/dist/mozaic-vue.adeo.umd.js +0 -41775
- package/dist/mozaic-vue.common.js +0 -41765
- package/dist/mozaic-vue.common.js.map +0 -1
- package/dist/mozaic-vue.umd.js +0 -41776
- package/dist/mozaic-vue.umd.js.map +0 -1
- package/dist/mozaic-vue.umd.min.js +0 -4
- package/dist/mozaic-vue.umd.min.js.map +0 -1
- package/postinstall.js +0 -3
- package/src/components/accordion/MAccordion.vue +0 -128
- package/src/components/accordion/index.js +0 -7
- package/src/components/autocomplete/MAutocomplete.vue +0 -198
- package/src/components/autocomplete/index.js +0 -7
- package/src/components/badge/index.js +0 -7
- package/src/components/breadcrumb/MBreadcrumb.vue +0 -73
- package/src/components/breadcrumb/index.js +0 -7
- package/src/components/button/index.js +0 -7
- package/src/components/card/MCard.vue +0 -78
- package/src/components/card/index.js +0 -7
- package/src/components/checkbox/MCheckboxGroup.vue +0 -155
- package/src/components/checkbox/index.js +0 -12
- package/src/components/container/MContainer.vue +0 -33
- package/src/components/container/index.js +0 -7
- package/src/components/datatable/MDataTable.vue +0 -651
- package/src/components/datatable/MDataTableHeader.vue +0 -55
- package/src/components/datatable/MDataTableTop.vue +0 -35
- package/src/components/datatable/helpers.js +0 -132
- package/src/components/datatable/index.js +0 -12
- package/src/components/field/index.js +0 -7
- package/src/components/fileuploader/MFileResult.vue +0 -149
- package/src/components/fileuploader/MFileUploader.vue +0 -142
- package/src/components/fileuploader/index.js +0 -7
- package/src/components/flag/MFlag.vue +0 -46
- package/src/components/flag/index.js +0 -7
- package/src/components/heading/MHeading.vue +0 -75
- package/src/components/heading/index.js +0 -7
- package/src/components/hero/MHero.vue +0 -93
- package/src/components/hero/index.js +0 -7
- package/src/components/icon/MIcon.vue +0 -120
- package/src/components/icon/index.js +0 -7
- package/src/components/index.js +0 -43
- package/src/components/layer/MLayer.vue +0 -208
- package/src/components/layer/index.js +0 -7
- package/src/components/link/index.js +0 -7
- package/src/components/listbox/MListBox.vue +0 -106
- package/src/components/listbox/index.js +0 -7
- package/src/components/loader/index.js +0 -7
- package/src/components/modal/MModal.vue +0 -179
- package/src/components/modal/index.js +0 -7
- package/src/components/notification/MNotification.vue +0 -110
- package/src/components/notification/index.js +0 -7
- package/src/components/optionbutton/MOptionButton.vue +0 -67
- package/src/components/optionbutton/index.js +0 -7
- package/src/components/optioncard/MOptionCard.vue +0 -132
- package/src/components/optioncard/index.js +0 -7
- package/src/components/optiongroup/MOptionGroup.vue +0 -18
- package/src/components/optiongroup/index.js +0 -7
- package/src/components/overlay/MOverlayLoader.vue +0 -43
- package/src/components/overlay/index.js +0 -12
- package/src/components/pagination/MPagination.vue +0 -162
- package/src/components/pagination/index.js +0 -7
- package/src/components/passwordinput/MPasswordInput.vue +0 -96
- package/src/components/passwordinput/index.js +0 -7
- package/src/components/phonenumber/MPhoneNumber.vue +0 -390
- package/src/components/phonenumber/index.js +0 -7
- package/src/components/progressbar/MProgress.vue +0 -102
- package/src/components/progressbar/index.js +0 -7
- package/src/components/quantityselector/index.js +0 -7
- package/src/components/radio/MRadioGroup.vue +0 -111
- package/src/components/radio/index.js +0 -12
- package/src/components/ratingstars/MStarsInput.vue +0 -118
- package/src/components/ratingstars/MStarsResult.vue +0 -89
- package/src/components/ratingstars/index.js +0 -12
- package/src/components/select/index.js +0 -7
- package/src/components/stepper/MStepper.vue +0 -70
- package/src/components/stepper/index.js +0 -7
- package/src/components/tabs/MTab.vue +0 -184
- package/src/components/tabs/index.js +0 -7
- package/src/components/tags/MTag.vue +0 -173
- package/src/components/tags/index.js +0 -7
- package/src/components/textarea/index.js +0 -7
- package/src/components/textinput/MTextInputField.vue +0 -105
- package/src/components/textinput/MTextInputIcon.vue +0 -42
- package/src/components/textinput/index.js +0 -7
- package/src/components/toggle/index.js +0 -7
- package/src/components/tooltip/MTooltip.vue +0 -42
- package/src/components/tooltip/index.js +0 -7
- package/src/index.js +0 -62
- package/src/shims-tsx.d.ts +0 -13
- package/src/shims.vue.d.ts +0 -4
- package/src/tokens/adeo/android/colors.xml +0 -391
- package/src/tokens/adeo/android/font_dimens.xml +0 -18
- package/src/tokens/adeo/css/_variables.scss +0 -385
- package/src/tokens/adeo/css/root.scss +0 -387
- package/src/tokens/adeo/ios/StyleDictionaryColor.h +0 -399
- package/src/tokens/adeo/ios/StyleDictionaryColor.m +0 -411
- package/src/tokens/adeo/ios/StyleDictionaryColor.swift +0 -394
- package/src/tokens/adeo/ios/StyleDictionarySize.h +0 -69
- package/src/tokens/adeo/ios/StyleDictionarySize.m +0 -70
- package/src/tokens/adeo/ios/StyleDictionarySize.swift +0 -71
- package/src/tokens/adeo/js/tokens.js +0 -483
- package/src/tokens/adeo/js/tokensObject.js +0 -10354
- package/src/tokens/adeo/scss/_tokens.scss +0 -1300
- package/src/utils/mozaicClasses.js +0 -16
- package/src/utils/theme.validator.js +0 -19
- package/types/index.d.ts +0 -100
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="mc-hero"
|
|
4
|
-
:class="{
|
|
5
|
-
'mc-hero--center': center,
|
|
6
|
-
'mc-hero--with-content': $slots.default,
|
|
7
|
-
'mc-hero--with-boxed': $slots.boxed,
|
|
8
|
-
}"
|
|
9
|
-
>
|
|
10
|
-
<div :class="{ 'ml-container': true, 'ml-container--fluid': !fixed }">
|
|
11
|
-
<div class="ml-flexy ml-flexy--gutter">
|
|
12
|
-
<div class="mc-hero__main ml-flexy__col">
|
|
13
|
-
<picture class="mc-hero__cover">
|
|
14
|
-
<source
|
|
15
|
-
v-for="(src, index) in srcSet"
|
|
16
|
-
:key="index"
|
|
17
|
-
:srcset="src.url"
|
|
18
|
-
:media="`(max-width: ${src.width}px)`"
|
|
19
|
-
/>
|
|
20
|
-
<img class="mc-hero__visual" :src="imgSrc" :alt="imgAlt" />
|
|
21
|
-
</picture>
|
|
22
|
-
<div class="mc-hero__header">
|
|
23
|
-
<component
|
|
24
|
-
:is="titleTag"
|
|
25
|
-
class="
|
|
26
|
-
mc-hero__title
|
|
27
|
-
mt-heading
|
|
28
|
-
mt-heading--lightest
|
|
29
|
-
mt-heading--s
|
|
30
|
-
mt-heading--underline
|
|
31
|
-
"
|
|
32
|
-
:class="{ 'mt-heading--center': center }"
|
|
33
|
-
>
|
|
34
|
-
{{ title }}
|
|
35
|
-
</component>
|
|
36
|
-
</div>
|
|
37
|
-
<div v-if="$slots.default" class="mc-hero__content mt-body-m">
|
|
38
|
-
<slot />
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
<div v-if="$slots.boxed" class="mc-hero__boxed ml-flexy__col">
|
|
42
|
-
<slot name="boxed" />
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
</template>
|
|
48
|
-
|
|
49
|
-
<script>
|
|
50
|
-
export default {
|
|
51
|
-
name: 'MHero',
|
|
52
|
-
props: {
|
|
53
|
-
title: {
|
|
54
|
-
type: String,
|
|
55
|
-
required: true,
|
|
56
|
-
},
|
|
57
|
-
imgSrc: {
|
|
58
|
-
type: String,
|
|
59
|
-
required: true,
|
|
60
|
-
},
|
|
61
|
-
titleTag: {
|
|
62
|
-
type: String,
|
|
63
|
-
default: 'h1',
|
|
64
|
-
validator: (value) =>
|
|
65
|
-
['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(value),
|
|
66
|
-
},
|
|
67
|
-
imgAlt: {
|
|
68
|
-
type: String,
|
|
69
|
-
default: '',
|
|
70
|
-
},
|
|
71
|
-
fixed: {
|
|
72
|
-
type: Boolean,
|
|
73
|
-
default: false,
|
|
74
|
-
},
|
|
75
|
-
center: {
|
|
76
|
-
type: Boolean,
|
|
77
|
-
default: false,
|
|
78
|
-
},
|
|
79
|
-
srcSet: {
|
|
80
|
-
type: Array,
|
|
81
|
-
default: null,
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
};
|
|
85
|
-
</script>
|
|
86
|
-
|
|
87
|
-
<style lang="scss">
|
|
88
|
-
@import 'settings-tools/_all-settings';
|
|
89
|
-
@import 'typography/_t.all-base-typography';
|
|
90
|
-
@import 'layouts/_l.container';
|
|
91
|
-
@import 'layouts/_l.flexy';
|
|
92
|
-
@import 'components/_c.hero';
|
|
93
|
-
</style>
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
export default {
|
|
3
|
-
name: 'MIcon',
|
|
4
|
-
|
|
5
|
-
props: {
|
|
6
|
-
/**
|
|
7
|
-
* Icon name
|
|
8
|
-
*/
|
|
9
|
-
name: {
|
|
10
|
-
type: String,
|
|
11
|
-
required: true,
|
|
12
|
-
},
|
|
13
|
-
/**
|
|
14
|
-
* Icon color
|
|
15
|
-
*/
|
|
16
|
-
color: {
|
|
17
|
-
type: String,
|
|
18
|
-
default: 'currentColor',
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
data() {
|
|
23
|
-
return {
|
|
24
|
-
id: null,
|
|
25
|
-
viewbox: null,
|
|
26
|
-
size: null,
|
|
27
|
-
paths: null,
|
|
28
|
-
};
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
computed: {
|
|
32
|
-
loadIcons() {
|
|
33
|
-
if (!this.name) {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return () =>
|
|
38
|
-
import(
|
|
39
|
-
/* webpackMode: 'eager' */
|
|
40
|
-
'@mozaic-ds/icons/js/icons.js'
|
|
41
|
-
);
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
getIconName() {
|
|
45
|
-
if (!this.name) {
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return this.name;
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
watch: {
|
|
54
|
-
name() {
|
|
55
|
-
this.setIconElement();
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
created() {
|
|
60
|
-
this.id = this._uid;
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
mounted() {
|
|
64
|
-
this.setIconElement();
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
methods: {
|
|
68
|
-
setIconElement() {
|
|
69
|
-
this.loadIcons().then((icons) => {
|
|
70
|
-
const iconName = this.getIconName;
|
|
71
|
-
const selectedIcon = icons[iconName];
|
|
72
|
-
|
|
73
|
-
if (!selectedIcon) {
|
|
74
|
-
throw new Error(
|
|
75
|
-
'The icon you are trying to display does not exist. Maybe the name is incorrect. => (See all available icons: http://mozaic.adeo.cloud/Foundations/Icons/catalog/)'
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
this.viewbox = selectedIcon.viewBox;
|
|
80
|
-
this.size = selectedIcon.size;
|
|
81
|
-
this.paths = selectedIcon.paths;
|
|
82
|
-
});
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
render: function (createElement) {
|
|
87
|
-
const paths = this.paths;
|
|
88
|
-
const svgAttrs = {
|
|
89
|
-
id: `MIcon-${this.name}-${this.id}`,
|
|
90
|
-
viewBox: this.viewbox,
|
|
91
|
-
height: this.size,
|
|
92
|
-
width: this.size,
|
|
93
|
-
fill: this.color,
|
|
94
|
-
'aria-hidden': 'true',
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
function generatePaths(paths) {
|
|
98
|
-
return paths.map(function (path) {
|
|
99
|
-
const children = path.children;
|
|
100
|
-
|
|
101
|
-
if (children) {
|
|
102
|
-
return createElement(
|
|
103
|
-
path.tagName,
|
|
104
|
-
{ attrs: path.attrs },
|
|
105
|
-
generatePaths(children)
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return createElement(path.tagName, { attrs: path.attrs });
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (paths) {
|
|
114
|
-
return createElement('svg', { attrs: svgAttrs }, generatePaths(paths));
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return createElement('svg', { attrs: svgAttrs });
|
|
118
|
-
},
|
|
119
|
-
};
|
|
120
|
-
</script>
|
package/src/components/index.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// import/export individual components
|
|
2
|
-
// Foundations
|
|
3
|
-
export { MContainer } from './container';
|
|
4
|
-
export { MHeading } from './heading';
|
|
5
|
-
// Components
|
|
6
|
-
export { MAccordion } from './accordion';
|
|
7
|
-
export { MAutocomplete } from './autocomplete';
|
|
8
|
-
export { MBadge } from './badge';
|
|
9
|
-
export { MBreadcrumb } from './breadcrumb';
|
|
10
|
-
export { MButton } from './button';
|
|
11
|
-
export { MCard } from './card';
|
|
12
|
-
export { MCheckbox, MCheckboxGroup } from './checkbox';
|
|
13
|
-
export { MDataTable, MDataTableHeader } from './datatable';
|
|
14
|
-
export { MField } from './field';
|
|
15
|
-
export { MFileUploader } from './fileuploader';
|
|
16
|
-
export { MFlag } from './flag';
|
|
17
|
-
export { MHero } from './hero';
|
|
18
|
-
export { MIcon } from './icon';
|
|
19
|
-
export { MLayer } from './layer';
|
|
20
|
-
export { MLink } from './link';
|
|
21
|
-
export { MListBox } from './listbox';
|
|
22
|
-
export { MLoader } from './loader';
|
|
23
|
-
export { MModal } from './modal';
|
|
24
|
-
export { MNotification } from './notification';
|
|
25
|
-
export { MOptionButton } from './optionbutton';
|
|
26
|
-
export { MOptionCard } from './optioncard';
|
|
27
|
-
export { MOptionGroup } from './optiongroup';
|
|
28
|
-
export { MOverlay, MOverlayLoader } from './overlay';
|
|
29
|
-
export { MPagination } from './pagination';
|
|
30
|
-
export { MPasswordInput } from './passwordinput';
|
|
31
|
-
export { MPhoneNumber } from './phonenumber';
|
|
32
|
-
export { MProgress } from './progressbar';
|
|
33
|
-
export { MQuantitySelector } from './quantityselector';
|
|
34
|
-
export { MRadio, MRadioGroup } from './radio';
|
|
35
|
-
export { MStarsInput, MStarsResult } from './ratingstars';
|
|
36
|
-
export { MSelect } from './select';
|
|
37
|
-
export { MStepper } from './stepper';
|
|
38
|
-
export { MTab } from './tabs';
|
|
39
|
-
export { MTag } from './tags';
|
|
40
|
-
export { MTextArea } from './textarea';
|
|
41
|
-
export { MTextInput } from './textinput';
|
|
42
|
-
export { MToggle } from './toggle';
|
|
43
|
-
export { MTooltip } from './tooltip';
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<div
|
|
4
|
-
ref="layer"
|
|
5
|
-
class="mc-layer"
|
|
6
|
-
:class="{ 'mc-layer--ltr': position === 'left' }"
|
|
7
|
-
role="dialog"
|
|
8
|
-
aria-labelledby="layerTitle"
|
|
9
|
-
:aria-modal="open"
|
|
10
|
-
:aria-hidden="!open"
|
|
11
|
-
tabindex="-1"
|
|
12
|
-
@keyup.esc="closeLayer()"
|
|
13
|
-
>
|
|
14
|
-
<div
|
|
15
|
-
class="mc-layer__dialog"
|
|
16
|
-
:class="{ 'is-open': open, 'mc-layer__dialog--extend': extended }"
|
|
17
|
-
role="document"
|
|
18
|
-
>
|
|
19
|
-
<div class="mc-layer__header">
|
|
20
|
-
<m-icon v-if="headerIcon" :name="headerIcon" class="mc-layer__icon" />
|
|
21
|
-
<component
|
|
22
|
-
:is="layerTitleTag"
|
|
23
|
-
id="layerTitle"
|
|
24
|
-
class="mc-layer__title"
|
|
25
|
-
>
|
|
26
|
-
{{ layerTitle }}
|
|
27
|
-
</component>
|
|
28
|
-
<button
|
|
29
|
-
ref="close"
|
|
30
|
-
class="mc-layer__close"
|
|
31
|
-
type="button"
|
|
32
|
-
@click="closeLayer()"
|
|
33
|
-
>
|
|
34
|
-
<span class="mc-layer__close-text">
|
|
35
|
-
{{ closeButtonText }}
|
|
36
|
-
</span>
|
|
37
|
-
</button>
|
|
38
|
-
</div>
|
|
39
|
-
<div ref="body" class="mc-layer__body">
|
|
40
|
-
<div ref="content" class="mc-layer__content">
|
|
41
|
-
<slot />
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
<div v-if="$slots.footer" class="mc-layer__footer">
|
|
45
|
-
<slot name="footer" />
|
|
46
|
-
</div>
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
<div
|
|
50
|
-
class="mc-layer-overlay"
|
|
51
|
-
:class="{ 'is-visible': open }"
|
|
52
|
-
tabindex="-1"
|
|
53
|
-
role="dialog"
|
|
54
|
-
@click="closeOnOverlay && closeLayer()"
|
|
55
|
-
/>
|
|
56
|
-
</div>
|
|
57
|
-
</template>
|
|
58
|
-
|
|
59
|
-
<script>
|
|
60
|
-
import MIcon from '../icon/MIcon.vue';
|
|
61
|
-
|
|
62
|
-
export default {
|
|
63
|
-
name: 'MLayer',
|
|
64
|
-
|
|
65
|
-
components: {
|
|
66
|
-
MIcon,
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
props: {
|
|
70
|
-
open: {
|
|
71
|
-
type: Boolean,
|
|
72
|
-
default: false,
|
|
73
|
-
},
|
|
74
|
-
headerIcon: {
|
|
75
|
-
type: String,
|
|
76
|
-
default: null,
|
|
77
|
-
},
|
|
78
|
-
layerTitle: {
|
|
79
|
-
type: String,
|
|
80
|
-
required: true,
|
|
81
|
-
},
|
|
82
|
-
layerTitleTag: {
|
|
83
|
-
type: String,
|
|
84
|
-
default: 'h2',
|
|
85
|
-
},
|
|
86
|
-
closeButtonText: {
|
|
87
|
-
type: String,
|
|
88
|
-
default: 'Close',
|
|
89
|
-
validator: (value) => value !== '',
|
|
90
|
-
},
|
|
91
|
-
extended: {
|
|
92
|
-
type: Boolean,
|
|
93
|
-
default: false,
|
|
94
|
-
},
|
|
95
|
-
closeOnOverlay: {
|
|
96
|
-
type: Boolean,
|
|
97
|
-
default: false,
|
|
98
|
-
},
|
|
99
|
-
scrollbarEdge: {
|
|
100
|
-
type: Boolean,
|
|
101
|
-
default: false,
|
|
102
|
-
},
|
|
103
|
-
position: {
|
|
104
|
-
type: String,
|
|
105
|
-
default: 'right',
|
|
106
|
-
validator: (value) => ['right', 'left'].includes(value),
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
watch: {
|
|
111
|
-
open(isOpen) {
|
|
112
|
-
this.$nextTick(() => {
|
|
113
|
-
if (isOpen) {
|
|
114
|
-
this.trapFocus();
|
|
115
|
-
document.body.classList.add('mc-layer-open');
|
|
116
|
-
this.$emit('layer-opened');
|
|
117
|
-
} else {
|
|
118
|
-
document.body.classList.remove('mc-layer-open');
|
|
119
|
-
this.$emit('layer-closed');
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
|
|
125
|
-
mounted() {
|
|
126
|
-
this.$nextTick(() => {
|
|
127
|
-
this.setOverflow();
|
|
128
|
-
});
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
methods: {
|
|
132
|
-
closeLayer: function () {
|
|
133
|
-
this.$emit('update:open', false);
|
|
134
|
-
},
|
|
135
|
-
|
|
136
|
-
trapFocus: function () {
|
|
137
|
-
const layer = document.querySelector('.mc-layer');
|
|
138
|
-
const focusableElements = layer.querySelectorAll(
|
|
139
|
-
'a[href], button, input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
140
|
-
);
|
|
141
|
-
const firstFocusableElement = focusableElements[0]; // get first element to be focused inside layer
|
|
142
|
-
const lastFocusableElement =
|
|
143
|
-
focusableElements[focusableElements.length - 1];
|
|
144
|
-
|
|
145
|
-
document.addEventListener('keydown', function (e) {
|
|
146
|
-
const isTabPressed = e.key === 'Tab' || e.keyCode === 9;
|
|
147
|
-
|
|
148
|
-
if (!isTabPressed) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
if (e.shiftKey) {
|
|
153
|
-
// if shift key pressed for shift + tab combination
|
|
154
|
-
if (document.activeElement === firstFocusableElement) {
|
|
155
|
-
lastFocusableElement.focus(); // add focus for the last focusable element
|
|
156
|
-
e.preventDefault();
|
|
157
|
-
}
|
|
158
|
-
} else {
|
|
159
|
-
// if tab key is pressed
|
|
160
|
-
if (document.activeElement === lastFocusableElement) {
|
|
161
|
-
// if focused has reached to last focusable element then focus first focusable element after pressing tab
|
|
162
|
-
firstFocusableElement.focus(); // add focus for the first focusable element
|
|
163
|
-
e.preventDefault();
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
},
|
|
168
|
-
|
|
169
|
-
setOverflow: function () {
|
|
170
|
-
const layer = this.$refs.layer;
|
|
171
|
-
const body = this.$refs.body;
|
|
172
|
-
const content = this.$refs.content;
|
|
173
|
-
const overflowingClass = !this.scrollbarEdge
|
|
174
|
-
? 'mc-layer__body--overflowing'
|
|
175
|
-
: 'mc-layer__body--overflowing-scroll-edge';
|
|
176
|
-
|
|
177
|
-
const ro = new ResizeObserver((entries) => {
|
|
178
|
-
for (let entry of entries) {
|
|
179
|
-
const bodyHeight =
|
|
180
|
-
layer.querySelector('.mc-layer__body').clientHeight;
|
|
181
|
-
const contentHeight = entry.target.scrollHeight;
|
|
182
|
-
|
|
183
|
-
if (contentHeight > bodyHeight) {
|
|
184
|
-
body.classList.add(overflowingClass);
|
|
185
|
-
} else {
|
|
186
|
-
body.classList.remove(overflowingClass);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
ro.observe(content);
|
|
192
|
-
},
|
|
193
|
-
},
|
|
194
|
-
};
|
|
195
|
-
</script>
|
|
196
|
-
|
|
197
|
-
<style lang="scss">
|
|
198
|
-
@import 'settings-tools/_all-settings';
|
|
199
|
-
@import 'components/_c.layer';
|
|
200
|
-
|
|
201
|
-
// NOTE: temporary fix
|
|
202
|
-
.mc-layer__body--overflowing,
|
|
203
|
-
.mc-layer__body--overflowing-scroll-edge {
|
|
204
|
-
&::after {
|
|
205
|
-
pointer-events: none;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
</style>
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<ul
|
|
3
|
-
v-if="items.length > 0"
|
|
4
|
-
ref="listbox"
|
|
5
|
-
role="listbox"
|
|
6
|
-
class="mc-listbox"
|
|
7
|
-
aria-labelledby="listbox"
|
|
8
|
-
:class="{ 'is-open': open, 'mc-listbox--multi': multiple }"
|
|
9
|
-
>
|
|
10
|
-
<li
|
|
11
|
-
v-for="item in selectableItems"
|
|
12
|
-
:key="item.id"
|
|
13
|
-
class="mc-listbox__item"
|
|
14
|
-
@change="$emit('update:itemSelected', item)"
|
|
15
|
-
@click.self="updateList(item.id, item.text, !item.selected, true)"
|
|
16
|
-
>
|
|
17
|
-
<slot name="item" :item="item">
|
|
18
|
-
<span class="mc-listbox__text">{{ item.text }} </span>
|
|
19
|
-
</slot>
|
|
20
|
-
<m-checkbox
|
|
21
|
-
v-if="multiple"
|
|
22
|
-
:id="`checkbox-dropdown-${item.id}`"
|
|
23
|
-
v-model="selectableItems.find((elem) => elem.id === item.id).selected"
|
|
24
|
-
class="mc-listbox__input"
|
|
25
|
-
@change="updateList(item.id, item.text, !item.selected, $e)"
|
|
26
|
-
/>
|
|
27
|
-
</li>
|
|
28
|
-
</ul>
|
|
29
|
-
<div v-else class="mc-list-box__empty">
|
|
30
|
-
{{ emptySearchLabel }}
|
|
31
|
-
</div>
|
|
32
|
-
</template>
|
|
33
|
-
<script>
|
|
34
|
-
import MCheckbox from '../checkbox/MCheckbox.vue';
|
|
35
|
-
export default {
|
|
36
|
-
name: 'MListbox',
|
|
37
|
-
|
|
38
|
-
components: { MCheckbox },
|
|
39
|
-
|
|
40
|
-
props: {
|
|
41
|
-
open: {
|
|
42
|
-
type: Boolean,
|
|
43
|
-
default: false,
|
|
44
|
-
},
|
|
45
|
-
items: {
|
|
46
|
-
type: Array,
|
|
47
|
-
default: () => [],
|
|
48
|
-
},
|
|
49
|
-
multiple: {
|
|
50
|
-
type: Boolean,
|
|
51
|
-
default: false,
|
|
52
|
-
},
|
|
53
|
-
emptySearchLabel: {
|
|
54
|
-
type: String,
|
|
55
|
-
default: 'No item matching your criteria found',
|
|
56
|
-
},
|
|
57
|
-
icon: {
|
|
58
|
-
type: Boolean,
|
|
59
|
-
default: false,
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
data() {
|
|
63
|
-
return {
|
|
64
|
-
selectableItems: null,
|
|
65
|
-
selected: [],
|
|
66
|
-
};
|
|
67
|
-
},
|
|
68
|
-
watch: {
|
|
69
|
-
items: {
|
|
70
|
-
handler: function (val) {
|
|
71
|
-
this.selectableItems = val;
|
|
72
|
-
},
|
|
73
|
-
immediate: true,
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
methods: {
|
|
77
|
-
updateList(id, text, value, isCheckboxUpdate) {
|
|
78
|
-
if (!this.multiple) {
|
|
79
|
-
this.$emit('update:itemSelected', [{ id, selected: value, text }]);
|
|
80
|
-
|
|
81
|
-
this.$emit('close-list-box');
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (
|
|
86
|
-
isCheckboxUpdate &&
|
|
87
|
-
this.selectableItems.find((item) => item.id === id)
|
|
88
|
-
) {
|
|
89
|
-
this.selectableItems.find((item) => item.id === id).selected = value;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (value) {
|
|
93
|
-
this.selected = [...this.selected, { id, selected: value, text }];
|
|
94
|
-
} else {
|
|
95
|
-
this.selected = this.selected.filter((item) => item.id !== id);
|
|
96
|
-
}
|
|
97
|
-
this.$emit('update:itemSelected', this.selectableItems);
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
};
|
|
101
|
-
</script>
|
|
102
|
-
|
|
103
|
-
<style lang="scss">
|
|
104
|
-
@import 'settings-tools/_all-settings';
|
|
105
|
-
@import 'components/_c.listbox';
|
|
106
|
-
</style>
|