@mozaic-ds/vue 1.0.0-rc.3 → 2.2.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/LICENSE +51 -0
- package/README.md +76 -77
- package/dist/mozaic-vue.css +1 -1
- package/dist/mozaic-vue.d.ts +1718 -0
- package/dist/mozaic-vue.js +1971 -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 +78 -51
- package/src/components/Contributing.mdx +118 -0
- package/src/components/GettingStarted.mdx +45 -0
- package/src/components/Introduction.mdx +100 -0
- package/src/components/Support.mdx +18 -0
- package/src/components/breadcrumb/MBreadcrumb.spec.ts +105 -0
- package/src/components/breadcrumb/MBreadcrumb.stories.ts +82 -0
- package/src/components/breadcrumb/MBreadcrumb.vue +52 -55
- package/src/components/button/MButton.spec.ts +191 -0
- package/src/components/button/MButton.stories.ts +59 -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/datepicker/MDatepicker.spec.ts +95 -0
- package/src/components/datepicker/MDatepicker.stories.ts +75 -0
- package/src/components/datepicker/MDatepicker.vue +114 -0
- package/src/components/divider/MDivider.spec.ts +57 -0
- package/src/components/divider/MDivider.stories.ts +64 -0
- package/src/components/divider/MDivider.vue +56 -0
- package/src/components/drawer/MDrawer.spec.ts +100 -0
- package/src/components/drawer/MDrawer.stories.ts +128 -0
- package/src/components/drawer/MDrawer.vue +140 -0
- package/src/components/field/MField.spec.ts +166 -0
- package/src/components/field/MField.stories.ts +369 -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 +416 -0
- package/src/components/fieldgroup/MFieldGroup.vue +79 -0
- package/src/components/flag/MFlag.spec.ts +46 -0
- package/src/components/flag/MFlag.stories.ts +46 -0
- package/src/components/flag/MFlag.vue +28 -39
- package/src/components/iconbutton/MIconButton.spec.ts +108 -0
- package/src/components/iconbutton/MIconButton.stories.ts +74 -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 +89 -0
- package/src/components/link/MLink.vue +86 -120
- package/src/components/loader/MLoader.spec.ts +104 -0
- package/src/components/loader/MLoader.stories.ts +43 -0
- package/src/components/loader/MLoader.vue +66 -55
- package/src/components/loadingoverlay/MLoadingOverlay.spec.ts +37 -0
- package/src/components/loadingoverlay/MLoadingOverlay.stories.ts +40 -0
- package/src/components/loadingoverlay/MLoadingOverlay.vue +28 -0
- package/src/components/modal/MModal.spec.ts +103 -0
- package/src/components/modal/MModal.stories.ts +127 -0
- package/src/components/modal/MModal.vue +111 -159
- package/src/components/numberbadge/MNumberBadge.spec.ts +56 -0
- package/src/components/numberbadge/MNumberBadge.stories.ts +48 -0
- package/src/components/numberbadge/MNumberBadge.vue +45 -0
- package/src/components/overlay/MOverlay.spec.ts +51 -0
- package/src/components/overlay/MOverlay.stories.ts +35 -0
- package/src/components/overlay/MOverlay.vue +27 -19
- package/src/components/pagination/MPagination.spec.ts +123 -0
- package/src/components/pagination/MPagination.stories.ts +83 -0
- package/src/components/pagination/MPagination.vue +120 -140
- package/src/components/passwordinput/MPasswordInput.spec.ts +104 -0
- package/src/components/passwordinput/MPasswordInput.stories.ts +75 -0
- package/src/components/passwordinput/MPasswordInput.vue +126 -77
- package/src/components/pincode/MPincode.spec.ts +126 -0
- package/src/components/pincode/MPincode.stories.ts +68 -0
- package/src/components/pincode/MPincode.vue +148 -0
- package/src/components/quantityselector/MQuantitySelector.spec.ts +262 -0
- package/src/components/quantityselector/MQuantitySelector.stories.ts +89 -0
- package/src/components/quantityselector/MQuantitySelector.vue +159 -148
- 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/MstatusBadge.spec.ts +16 -0
- package/src/components/statusdot/MStatusDot.spec.ts +51 -0
- package/src/components/statusdot/MStatusDot.stories.ts +48 -0
- package/src/components/statusdot/MStatusDot.vue +36 -0
- package/src/components/statusnotification/MStatusNotification.spec.ts +103 -0
- package/src/components/statusnotification/MStatusNotification.stories.ts +89 -0
- package/src/components/statusnotification/MStatusNotification.vue +106 -0
- package/src/components/tabs/MTabs.stories.ts +104 -0
- package/src/components/tabs/MTabs.vue +113 -0
- package/src/components/tabs/Mtabs.spec.ts +149 -0
- package/src/components/tag/MTag.spec.ts +107 -0
- package/src/components/tag/MTag.stories.ts +75 -0
- package/src/components/tag/MTag.vue +151 -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 -43
- package/src/components/textinput/MTextInput.spec.ts +121 -0
- package/src/components/textinput/MTextInput.stories.ts +107 -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/togglegroup/MToggleGroup.spec.ts +78 -0
- package/src/components/togglegroup/MToggleGroup.stories.ts +61 -0
- package/src/components/togglegroup/MToggleGroup.vue +97 -0
- package/src/components/tooltip/MTooltip.spec.ts +47 -0
- package/src/components/tooltip/MTooltip.stories.ts +59 -0
- package/src/components/tooltip/MTooltip.vue +49 -32
- package/src/components/usingIcons.mdx +35 -0
- package/src/components/usingPresets.mdx +128 -0
- package/src/main.ts +33 -0
- package/dist/demo.html +0 -1
- package/dist/mozaic-vue.adeo.css +0 -47
- package/dist/mozaic-vue.adeo.umd.js +0 -31341
- package/dist/mozaic-vue.common.js +0 -31331
- package/dist/mozaic-vue.common.js.map +0 -1
- package/dist/mozaic-vue.umd.js +0 -31342
- 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 -380
- package/src/components/autocomplete/index.js +0 -7
- package/src/components/badge/MBadge.vue +0 -43
- package/src/components/badge/index.js +0 -7
- 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 -163
- 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/dropdown/MDropdown.vue +0 -317
- package/src/components/dropdown/index.js +0 -7
- 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/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 -136
- package/src/components/icon/index.js +0 -7
- package/src/components/index.js +0 -44
- 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 -146
- package/src/components/listbox/MListBoxActions.vue +0 -251
- package/src/components/listbox/index.js +0 -12
- package/src/components/loader/index.js +0 -7
- 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/index.js +0 -7
- package/src/components/passwordinput/index.js +0 -7
- package/src/components/phonenumber/MPhoneNumber.vue +0 -398
- 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 -119
- 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 -111
- package/src/components/stepper/index.js +0 -7
- package/src/components/tabs/MTab.vue +0 -204
- package/src/components/tabs/index.js +0 -7
- package/src/components/tags/MTag.vue +0 -175
- 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/index.js +0 -7
- package/src/index.js +0 -63
- package/src/shims-tsx.d.ts +0 -13
- package/src/shims.vue.d.ts +0 -4
- package/src/tokens/adeo/android/colors.xml +0 -452
- package/src/tokens/adeo/android/font_dimens.xml +0 -18
- package/src/tokens/adeo/css/_variables.scss +0 -446
- package/src/tokens/adeo/css/root.scss +0 -448
- package/src/tokens/adeo/ios/StyleDictionaryColor.h +0 -460
- package/src/tokens/adeo/ios/StyleDictionaryColor.m +0 -472
- package/src/tokens/adeo/ios/StyleDictionaryColor.swift +0 -455
- 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 -544
- package/src/tokens/adeo/js/tokensObject.js +0 -11733
- package/src/tokens/adeo/scss/_tokens.scss +0 -1522
- package/src/utils/mozaicClasses.js +0 -16
- package/src/utils/theme.validator.js +0 -19
- package/types/index.d.ts +0 -104
|
@@ -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,146 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<ul
|
|
3
|
-
role="listbox"
|
|
4
|
-
class="mc-listbox"
|
|
5
|
-
aria-labelledby="listbox"
|
|
6
|
-
:class="{ 'is-open': open, 'mc-listbox--multi': multiple }"
|
|
7
|
-
:style="{ '--listbox-width': maxWidth }"
|
|
8
|
-
>
|
|
9
|
-
<template v-if="!isFiltered">
|
|
10
|
-
<li
|
|
11
|
-
v-for="(item, index) in localItems"
|
|
12
|
-
:key="item.id"
|
|
13
|
-
class="mc-listbox__item"
|
|
14
|
-
>
|
|
15
|
-
<MIcon
|
|
16
|
-
v-if="item.icon"
|
|
17
|
-
:name="item.icon"
|
|
18
|
-
class="mc-listbox__icon"
|
|
19
|
-
color="#666666"
|
|
20
|
-
/>
|
|
21
|
-
<input
|
|
22
|
-
:id="setItemId(index)"
|
|
23
|
-
v-model="localValue"
|
|
24
|
-
class="mc-listbox__input"
|
|
25
|
-
:class="{ 'mc-checkbox__input': multiple }"
|
|
26
|
-
:type="multiple ? 'checkbox' : 'radio'"
|
|
27
|
-
:value="item[dataValueExpr]"
|
|
28
|
-
:name="!multiple ? `listboxradio-${uuid}` : null"
|
|
29
|
-
@change="onChange"
|
|
30
|
-
/>
|
|
31
|
-
<label :for="setItemId(index)" class="mc-listbox__label">
|
|
32
|
-
<slot name="item" :item="item">
|
|
33
|
-
{{ item[dataTextExpr] }}
|
|
34
|
-
</slot>
|
|
35
|
-
</label>
|
|
36
|
-
</li>
|
|
37
|
-
</template>
|
|
38
|
-
<li v-else class="mc-listbox__item">
|
|
39
|
-
<span class="mc-listbox__empty">{{ emptySearchLabel }}</span>
|
|
40
|
-
</li>
|
|
41
|
-
</ul>
|
|
42
|
-
</template>
|
|
43
|
-
|
|
44
|
-
<script>
|
|
45
|
-
import MIcon from '../icon/MIcon.vue';
|
|
46
|
-
|
|
47
|
-
export default {
|
|
48
|
-
name: 'MListBox',
|
|
49
|
-
|
|
50
|
-
components: {
|
|
51
|
-
MIcon,
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
model: {
|
|
55
|
-
event: 'change',
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
props: {
|
|
59
|
-
items: {
|
|
60
|
-
type: Array,
|
|
61
|
-
required: true,
|
|
62
|
-
},
|
|
63
|
-
open: {
|
|
64
|
-
type: Boolean,
|
|
65
|
-
default: false,
|
|
66
|
-
},
|
|
67
|
-
isFiltered: {
|
|
68
|
-
type: Boolean,
|
|
69
|
-
default: false,
|
|
70
|
-
},
|
|
71
|
-
multiple: {
|
|
72
|
-
type: Boolean,
|
|
73
|
-
default: false,
|
|
74
|
-
},
|
|
75
|
-
emptySearchLabel: {
|
|
76
|
-
type: String,
|
|
77
|
-
default: 'No item matching your criteria found',
|
|
78
|
-
},
|
|
79
|
-
dataKeyExpr: {
|
|
80
|
-
type: String,
|
|
81
|
-
default: 'id',
|
|
82
|
-
},
|
|
83
|
-
dataTextExpr: {
|
|
84
|
-
type: String,
|
|
85
|
-
default: 'label',
|
|
86
|
-
},
|
|
87
|
-
dataValueExpr: {
|
|
88
|
-
type: String,
|
|
89
|
-
default: 'value',
|
|
90
|
-
},
|
|
91
|
-
value: {
|
|
92
|
-
type: [Array, String, Number],
|
|
93
|
-
default: undefined,
|
|
94
|
-
},
|
|
95
|
-
maxWidth: {
|
|
96
|
-
type: String,
|
|
97
|
-
default: '17.875rem',
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
data() {
|
|
102
|
-
return {
|
|
103
|
-
uuid: Math.random(),
|
|
104
|
-
localItems: undefined,
|
|
105
|
-
localValue: undefined,
|
|
106
|
-
};
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
computed: {
|
|
110
|
-
setItemId() {
|
|
111
|
-
return (index) => `listboxItem-${index + this.uuid}`;
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
|
|
115
|
-
watch: {
|
|
116
|
-
items: {
|
|
117
|
-
handler: function (val) {
|
|
118
|
-
this.localItems = val;
|
|
119
|
-
},
|
|
120
|
-
immediate: true,
|
|
121
|
-
},
|
|
122
|
-
value: {
|
|
123
|
-
handler: function (val) {
|
|
124
|
-
this.localValue = val;
|
|
125
|
-
},
|
|
126
|
-
immediate: true,
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
methods: {
|
|
131
|
-
onChange() {
|
|
132
|
-
this.$emit('change', this.localValue);
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
};
|
|
136
|
-
</script>
|
|
137
|
-
|
|
138
|
-
<style lang="scss">
|
|
139
|
-
@import 'settings-tools/all-settings';
|
|
140
|
-
@import 'components/c.checkbox';
|
|
141
|
-
@import 'components/c.listbox';
|
|
142
|
-
|
|
143
|
-
.mc-listbox__empty {
|
|
144
|
-
margin-top: 0;
|
|
145
|
-
}
|
|
146
|
-
</style>
|
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div v-click-outside="onClickOutside" class="mc-listbox-options">
|
|
3
|
-
<button
|
|
4
|
-
type="button"
|
|
5
|
-
class="mc-listbox-options__trigger"
|
|
6
|
-
@click="isOpen = !isOpen"
|
|
7
|
-
>
|
|
8
|
-
<m-icon name="DisplayOptions24" />
|
|
9
|
-
<span class="mc-listbox-options__trigger-label">{{ triggerLabel }}</span>
|
|
10
|
-
</button>
|
|
11
|
-
<div
|
|
12
|
-
ref="listbox"
|
|
13
|
-
class="mc-listbox-options__container"
|
|
14
|
-
:class="{ 'is-open': isOpen, 'align-right': position == 'right' }"
|
|
15
|
-
role="listbox"
|
|
16
|
-
aria-labelledby="listbox"
|
|
17
|
-
>
|
|
18
|
-
<ul
|
|
19
|
-
v-for="(list, i) in listItems"
|
|
20
|
-
:key="`list${i}`"
|
|
21
|
-
class="mc-listbox-options__list"
|
|
22
|
-
>
|
|
23
|
-
<li
|
|
24
|
-
v-for="(item, j) in list"
|
|
25
|
-
:key="`item${j}`"
|
|
26
|
-
class="mc-listbox-options__tile"
|
|
27
|
-
:class="{ 'is-disabled': item.disabled }"
|
|
28
|
-
>
|
|
29
|
-
<m-icon
|
|
30
|
-
v-if="item.icon"
|
|
31
|
-
:name="item.icon"
|
|
32
|
-
class="mc-listbox-options__icon"
|
|
33
|
-
:color="item.danger ? '#C61112' : '#71706B'"
|
|
34
|
-
/>
|
|
35
|
-
<component
|
|
36
|
-
:is="item.href ? 'a' : 'button'"
|
|
37
|
-
:href="item.href ? item.href : null"
|
|
38
|
-
:type="item.href ? null : 'button'"
|
|
39
|
-
:disabled="item.disabled ? true : null"
|
|
40
|
-
class="mc-listbox-options__item"
|
|
41
|
-
:class="{ 'is-danger': item.danger, 'is-disabled': item.disabled }"
|
|
42
|
-
@click.self="onClickItem(item, i, j)"
|
|
43
|
-
>
|
|
44
|
-
{{ item.text }}
|
|
45
|
-
</component>
|
|
46
|
-
</li>
|
|
47
|
-
</ul>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
</template>
|
|
51
|
-
|
|
52
|
-
<script>
|
|
53
|
-
import MIcon from '../icon/MIcon.vue';
|
|
54
|
-
|
|
55
|
-
export default {
|
|
56
|
-
name: 'MListBoxActions',
|
|
57
|
-
|
|
58
|
-
components: {
|
|
59
|
-
MIcon,
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
directives: {
|
|
63
|
-
'click-outside': {
|
|
64
|
-
bind(el, binding, vnode) {
|
|
65
|
-
el.clickOutsideEvent = (event) => {
|
|
66
|
-
if (!(el === event.target || el.contains(event.target))) {
|
|
67
|
-
vnode.context[binding.expression](event);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
document.body.addEventListener('click', el.clickOutsideEvent);
|
|
71
|
-
},
|
|
72
|
-
unbind(el) {
|
|
73
|
-
document.body.removeEventListener('click', el.clickOutsideEvent);
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
props: {
|
|
79
|
-
open: {
|
|
80
|
-
type: Boolean,
|
|
81
|
-
default: false,
|
|
82
|
-
},
|
|
83
|
-
position: {
|
|
84
|
-
type: String,
|
|
85
|
-
default: 'left',
|
|
86
|
-
},
|
|
87
|
-
items: {
|
|
88
|
-
type: Array,
|
|
89
|
-
default: () => [],
|
|
90
|
-
},
|
|
91
|
-
triggerLabel: {
|
|
92
|
-
type: String,
|
|
93
|
-
default: 'Display options',
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
data() {
|
|
98
|
-
return {
|
|
99
|
-
isOpen: this.open,
|
|
100
|
-
};
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
computed: {
|
|
104
|
-
listItems: function () {
|
|
105
|
-
const hasNestedArray = this.items.filter(Array.isArray).length;
|
|
106
|
-
|
|
107
|
-
if (hasNestedArray === 0) {
|
|
108
|
-
const listItems = [];
|
|
109
|
-
listItems.push(this.items);
|
|
110
|
-
return [this.items];
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
return this.items;
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
methods: {
|
|
118
|
-
onClickOutside() {
|
|
119
|
-
this.isOpen = false;
|
|
120
|
-
},
|
|
121
|
-
onClickItem(item, listIndex, itemIndex) {
|
|
122
|
-
const valToEmit = Object.assign(
|
|
123
|
-
{ listIndex: listIndex, itemIndex: itemIndex },
|
|
124
|
-
item
|
|
125
|
-
);
|
|
126
|
-
this.$emit('update:itemSelected', valToEmit);
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
};
|
|
130
|
-
</script>
|
|
131
|
-
|
|
132
|
-
<style lang="scss">
|
|
133
|
-
@import 'settings-tools/all-settings';
|
|
134
|
-
|
|
135
|
-
.mc-listbox-options {
|
|
136
|
-
display: inline-block;
|
|
137
|
-
position: relative;
|
|
138
|
-
|
|
139
|
-
&__trigger {
|
|
140
|
-
align-items: center;
|
|
141
|
-
background: none;
|
|
142
|
-
border: none;
|
|
143
|
-
cursor: pointer;
|
|
144
|
-
display: flex;
|
|
145
|
-
height: $mu150;
|
|
146
|
-
justify-content: center;
|
|
147
|
-
padding: 0;
|
|
148
|
-
width: $mu150;
|
|
149
|
-
|
|
150
|
-
&-label {
|
|
151
|
-
@include visually-hidden();
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
&__container {
|
|
156
|
-
position: absolute;
|
|
157
|
-
overflow-y: auto;
|
|
158
|
-
opacity: 0;
|
|
159
|
-
visibility: hidden;
|
|
160
|
-
min-width: $mu800;
|
|
161
|
-
background-color: $color-grey-000;
|
|
162
|
-
border: 1px solid $color-grey-600;
|
|
163
|
-
border-radius: 3px;
|
|
164
|
-
|
|
165
|
-
&.is-open {
|
|
166
|
-
opacity: 1;
|
|
167
|
-
visibility: visible;
|
|
168
|
-
z-index: 11;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
&.align-right {
|
|
172
|
-
transform: translateX(calc(-100% + #{$mu150}));
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
&__list {
|
|
177
|
-
$parent: get-parent-selector(&);
|
|
178
|
-
@include unstyle-list();
|
|
179
|
-
margin: 0 auto;
|
|
180
|
-
padding: 8px 0;
|
|
181
|
-
|
|
182
|
-
&::-webkit-scrollbar {
|
|
183
|
-
background-color: $color-grey-100;
|
|
184
|
-
width: $mu025;
|
|
185
|
-
|
|
186
|
-
&-thumb {
|
|
187
|
-
background: $color-grey-600;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
&:not(:last-child) {
|
|
192
|
-
border-bottom: 1px solid #bab6bc;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
&__tile {
|
|
197
|
-
align-items: center;
|
|
198
|
-
color: #1e1e1c;
|
|
199
|
-
display: flex;
|
|
200
|
-
gap: $mu050;
|
|
201
|
-
min-height: $mu250;
|
|
202
|
-
padding-left: $mu075;
|
|
203
|
-
padding-right: $mu075;
|
|
204
|
-
position: relative;
|
|
205
|
-
|
|
206
|
-
&:hover {
|
|
207
|
-
background-color: #eeedea;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
&.is-disabled {
|
|
211
|
-
background-color: $color-grey-200;
|
|
212
|
-
|
|
213
|
-
&,
|
|
214
|
-
.mc-listbox-options__item {
|
|
215
|
-
color: $color-grey-600;
|
|
216
|
-
cursor: not-allowed;
|
|
217
|
-
pointer-events: none;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
&__item {
|
|
223
|
-
@include set-font-scale('05', 'm');
|
|
224
|
-
|
|
225
|
-
background: none;
|
|
226
|
-
border: none;
|
|
227
|
-
color: currentColor;
|
|
228
|
-
cursor: pointer;
|
|
229
|
-
padding: 0;
|
|
230
|
-
white-space: nowrap;
|
|
231
|
-
|
|
232
|
-
&::after {
|
|
233
|
-
content: '';
|
|
234
|
-
position: absolute;
|
|
235
|
-
inset: 0;
|
|
236
|
-
z-index: 2;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
&,
|
|
240
|
-
&:active,
|
|
241
|
-
&:hover,
|
|
242
|
-
&:focus {
|
|
243
|
-
text-decoration: none;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
&.is-danger {
|
|
247
|
-
color: #c61112;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
</style>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import MListBox from './MListBox.vue';
|
|
2
|
-
import MListBoxActions from './MListBoxActions.vue';
|
|
3
|
-
|
|
4
|
-
MListBox.install = function (Vue) {
|
|
5
|
-
Vue.component(MListBox.name, MListBox);
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
MListBoxActions.install = function (Vue) {
|
|
9
|
-
Vue.component(MListBoxActions.name, MListBoxActions);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export { MListBox, MListBoxActions };
|