@mozaic-ds/vue 1.0.0-rc.2 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/LICENSE +51 -0
  2. package/README.md +76 -77
  3. package/dist/mozaic-vue.css +1 -1
  4. package/dist/mozaic-vue.d.ts +1664 -0
  5. package/dist/mozaic-vue.js +1943 -0
  6. package/dist/mozaic-vue.js.map +1 -0
  7. package/dist/mozaic-vue.umd.cjs +2 -0
  8. package/dist/mozaic-vue.umd.cjs.map +1 -0
  9. package/env.d.ts +1 -0
  10. package/package.json +78 -51
  11. package/src/components/Contributing.mdx +118 -0
  12. package/src/components/GettingStarted.mdx +45 -0
  13. package/src/components/Introduction.mdx +100 -0
  14. package/src/components/Support.mdx +18 -0
  15. package/src/components/breadcrumb/MBreadcrumb.spec.ts +105 -0
  16. package/src/components/breadcrumb/MBreadcrumb.stories.ts +82 -0
  17. package/src/components/breadcrumb/MBreadcrumb.vue +52 -55
  18. package/src/components/button/MButton.spec.ts +191 -0
  19. package/src/components/button/MButton.stories.ts +59 -0
  20. package/src/components/button/MButton.vue +98 -154
  21. package/src/components/checkbox/MCheckbox.spec.ts +104 -0
  22. package/src/components/checkbox/MCheckbox.stories.ts +83 -0
  23. package/src/components/checkbox/MCheckbox.vue +60 -101
  24. package/src/components/checkboxgroup/MCheckboxGroup.spec.ts +78 -0
  25. package/src/components/checkboxgroup/MCheckboxGroup.stories.ts +61 -0
  26. package/src/components/checkboxgroup/MCheckboxGroup.vue +97 -0
  27. package/src/components/datepicker/MDatepicker.spec.ts +95 -0
  28. package/src/components/datepicker/MDatepicker.stories.ts +75 -0
  29. package/src/components/datepicker/MDatepicker.vue +114 -0
  30. package/src/components/divider/MDivider.spec.ts +57 -0
  31. package/src/components/divider/MDivider.stories.ts +64 -0
  32. package/src/components/divider/MDivider.vue +56 -0
  33. package/src/components/drawer/MDrawer.spec.ts +100 -0
  34. package/src/components/drawer/MDrawer.stories.ts +128 -0
  35. package/src/components/drawer/MDrawer.vue +140 -0
  36. package/src/components/field/MField.spec.ts +166 -0
  37. package/src/components/field/MField.stories.ts +369 -0
  38. package/src/components/field/MField.vue +78 -61
  39. package/src/components/fieldgroup/MFieldGroup.spec.ts +165 -0
  40. package/src/components/fieldgroup/MFieldGroup.stories.ts +416 -0
  41. package/src/components/fieldgroup/MFieldGroup.vue +79 -0
  42. package/src/components/flag/MFlag.spec.ts +46 -0
  43. package/src/components/flag/MFlag.stories.ts +46 -0
  44. package/src/components/flag/MFlag.vue +28 -39
  45. package/src/components/iconbutton/MIconButton.spec.ts +108 -0
  46. package/src/components/iconbutton/MIconButton.stories.ts +74 -0
  47. package/src/components/iconbutton/MIconButton.vue +73 -0
  48. package/src/components/link/MLink.spec.ts +154 -0
  49. package/src/components/link/MLink.stories.ts +89 -0
  50. package/src/components/link/MLink.vue +86 -120
  51. package/src/components/loader/MLoader.spec.ts +104 -0
  52. package/src/components/loader/MLoader.stories.ts +43 -0
  53. package/src/components/loader/MLoader.vue +66 -55
  54. package/src/components/loadingoverlay/MLoadingOverlay.spec.ts +37 -0
  55. package/src/components/loadingoverlay/MLoadingOverlay.stories.ts +40 -0
  56. package/src/components/loadingoverlay/MLoadingOverlay.vue +28 -0
  57. package/src/components/modal/MModal.spec.ts +103 -0
  58. package/src/components/modal/MModal.stories.ts +127 -0
  59. package/src/components/modal/MModal.vue +106 -154
  60. package/src/components/numberbadge/MNumberBadge.spec.ts +56 -0
  61. package/src/components/numberbadge/MNumberBadge.stories.ts +48 -0
  62. package/src/components/numberbadge/MNumberBadge.vue +45 -0
  63. package/src/components/overlay/MOverlay.spec.ts +51 -0
  64. package/src/components/overlay/MOverlay.stories.ts +35 -0
  65. package/src/components/overlay/MOverlay.vue +27 -19
  66. package/src/components/pagination/MPagination.spec.ts +123 -0
  67. package/src/components/pagination/MPagination.stories.ts +83 -0
  68. package/src/components/pagination/MPagination.vue +120 -140
  69. package/src/components/passwordinput/MPasswordInput.spec.ts +104 -0
  70. package/src/components/passwordinput/MPasswordInput.stories.ts +75 -0
  71. package/src/components/passwordinput/MPasswordInput.vue +126 -77
  72. package/src/components/pincode/MPincode.spec.ts +126 -0
  73. package/src/components/pincode/MPincode.stories.ts +68 -0
  74. package/src/components/pincode/MPincode.vue +148 -0
  75. package/src/components/quantityselector/MQuantitySelector.spec.ts +262 -0
  76. package/src/components/quantityselector/MQuantitySelector.stories.ts +89 -0
  77. package/src/components/quantityselector/MQuantitySelector.vue +159 -148
  78. package/src/components/radio/MRadio.spec.ts +104 -0
  79. package/src/components/radio/MRadio.stories.ts +68 -0
  80. package/src/components/radio/MRadio.vue +56 -39
  81. package/src/components/radiogroup/MRadioGroup.spec.ts +54 -0
  82. package/src/components/radiogroup/MRadioGroup.stories.ts +61 -0
  83. package/src/components/radiogroup/MRadioGroup.vue +79 -0
  84. package/src/components/select/MSelect.spec.ts +114 -0
  85. package/src/components/select/MSelect.stories.ts +101 -0
  86. package/src/components/select/MSelect.vue +77 -119
  87. package/src/components/statusbadge/MStatusBadge.stories.ts +45 -0
  88. package/src/components/statusbadge/MStatusBadge.vue +40 -0
  89. package/src/components/statusbadge/MstatusBadge.spec.ts +16 -0
  90. package/src/components/statusdot/MStatusDot.spec.ts +51 -0
  91. package/src/components/statusdot/MStatusDot.stories.ts +48 -0
  92. package/src/components/statusdot/MStatusDot.vue +36 -0
  93. package/src/components/statusnotification/MStatusNotification.spec.ts +103 -0
  94. package/src/components/statusnotification/MStatusNotification.stories.ts +89 -0
  95. package/src/components/statusnotification/MStatusNotification.vue +106 -0
  96. package/src/components/tabs/MTabs.stories.ts +104 -0
  97. package/src/components/tabs/MTabs.vue +113 -0
  98. package/src/components/tabs/Mtabs.spec.ts +149 -0
  99. package/src/components/tag/MTag.spec.ts +107 -0
  100. package/src/components/tag/MTag.stories.ts +75 -0
  101. package/src/components/tag/MTag.vue +151 -0
  102. package/src/components/textarea/MTextArea.spec.ts +112 -0
  103. package/src/components/textarea/MTextArea.stories.ts +67 -0
  104. package/src/components/textarea/MTextArea.vue +81 -43
  105. package/src/components/textinput/MTextInput.spec.ts +121 -0
  106. package/src/components/textinput/MTextInput.stories.ts +107 -0
  107. package/src/components/textinput/MTextInput.vue +127 -47
  108. package/src/components/toggle/MToggle.spec.ts +99 -0
  109. package/src/components/toggle/MToggle.stories.ts +68 -0
  110. package/src/components/toggle/MToggle.vue +63 -103
  111. package/src/components/togglegroup/MToggleGroup.spec.ts +78 -0
  112. package/src/components/togglegroup/MToggleGroup.stories.ts +61 -0
  113. package/src/components/togglegroup/MToggleGroup.vue +97 -0
  114. package/src/components/usingIcons.mdx +35 -0
  115. package/src/components/usingPresets.mdx +128 -0
  116. package/src/main.ts +32 -0
  117. package/dist/demo.html +0 -1
  118. package/dist/mozaic-vue.adeo.css +0 -47
  119. package/dist/mozaic-vue.adeo.umd.js +0 -31109
  120. package/dist/mozaic-vue.common.js +0 -31099
  121. package/dist/mozaic-vue.common.js.map +0 -1
  122. package/dist/mozaic-vue.umd.js +0 -31110
  123. package/dist/mozaic-vue.umd.js.map +0 -1
  124. package/dist/mozaic-vue.umd.min.js +0 -4
  125. package/dist/mozaic-vue.umd.min.js.map +0 -1
  126. package/postinstall.js +0 -3
  127. package/src/components/accordion/MAccordion.vue +0 -128
  128. package/src/components/accordion/index.js +0 -7
  129. package/src/components/autocomplete/MAutocomplete.vue +0 -381
  130. package/src/components/autocomplete/index.js +0 -7
  131. package/src/components/badge/MBadge.vue +0 -43
  132. package/src/components/badge/index.js +0 -7
  133. package/src/components/breadcrumb/index.js +0 -7
  134. package/src/components/button/index.js +0 -7
  135. package/src/components/card/MCard.vue +0 -78
  136. package/src/components/card/index.js +0 -7
  137. package/src/components/checkbox/MCheckboxGroup.vue +0 -163
  138. package/src/components/checkbox/index.js +0 -12
  139. package/src/components/container/MContainer.vue +0 -33
  140. package/src/components/container/index.js +0 -7
  141. package/src/components/datatable/MDataTable.vue +0 -651
  142. package/src/components/datatable/MDataTableHeader.vue +0 -55
  143. package/src/components/datatable/MDataTableTop.vue +0 -35
  144. package/src/components/datatable/helpers.js +0 -132
  145. package/src/components/datatable/index.js +0 -12
  146. package/src/components/dropdown/MDropdown.vue +0 -317
  147. package/src/components/dropdown/index.js +0 -7
  148. package/src/components/field/index.js +0 -7
  149. package/src/components/fileuploader/MFileResult.vue +0 -149
  150. package/src/components/fileuploader/MFileUploader.vue +0 -142
  151. package/src/components/fileuploader/index.js +0 -7
  152. package/src/components/flag/index.js +0 -7
  153. package/src/components/heading/MHeading.vue +0 -75
  154. package/src/components/heading/index.js +0 -7
  155. package/src/components/hero/MHero.vue +0 -93
  156. package/src/components/hero/index.js +0 -7
  157. package/src/components/icon/MIcon.vue +0 -136
  158. package/src/components/icon/index.js +0 -7
  159. package/src/components/index.js +0 -44
  160. package/src/components/layer/MLayer.vue +0 -208
  161. package/src/components/layer/index.js +0 -7
  162. package/src/components/link/index.js +0 -7
  163. package/src/components/listbox/MListBox.vue +0 -146
  164. package/src/components/listbox/MListBoxActions.vue +0 -251
  165. package/src/components/listbox/index.js +0 -12
  166. package/src/components/loader/index.js +0 -7
  167. package/src/components/modal/index.js +0 -7
  168. package/src/components/notification/MNotification.vue +0 -110
  169. package/src/components/notification/index.js +0 -7
  170. package/src/components/optionbutton/MOptionButton.vue +0 -67
  171. package/src/components/optionbutton/index.js +0 -7
  172. package/src/components/optioncard/MOptionCard.vue +0 -132
  173. package/src/components/optioncard/index.js +0 -7
  174. package/src/components/optiongroup/MOptionGroup.vue +0 -18
  175. package/src/components/optiongroup/index.js +0 -7
  176. package/src/components/overlay/MOverlayLoader.vue +0 -43
  177. package/src/components/overlay/index.js +0 -12
  178. package/src/components/pagination/index.js +0 -7
  179. package/src/components/passwordinput/index.js +0 -7
  180. package/src/components/phonenumber/MPhoneNumber.vue +0 -398
  181. package/src/components/phonenumber/index.js +0 -7
  182. package/src/components/progressbar/MProgress.vue +0 -102
  183. package/src/components/progressbar/index.js +0 -7
  184. package/src/components/quantityselector/index.js +0 -7
  185. package/src/components/radio/MRadioGroup.vue +0 -111
  186. package/src/components/radio/index.js +0 -12
  187. package/src/components/ratingstars/MStarsInput.vue +0 -119
  188. package/src/components/ratingstars/MStarsResult.vue +0 -89
  189. package/src/components/ratingstars/index.js +0 -12
  190. package/src/components/select/index.js +0 -7
  191. package/src/components/stepper/MStepper.vue +0 -111
  192. package/src/components/stepper/index.js +0 -7
  193. package/src/components/tabs/MTab.vue +0 -198
  194. package/src/components/tabs/index.js +0 -7
  195. package/src/components/tags/MTag.vue +0 -173
  196. package/src/components/tags/index.js +0 -7
  197. package/src/components/textarea/index.js +0 -7
  198. package/src/components/textinput/MTextInputField.vue +0 -105
  199. package/src/components/textinput/MTextInputIcon.vue +0 -42
  200. package/src/components/textinput/index.js +0 -7
  201. package/src/components/toggle/index.js +0 -7
  202. package/src/components/tooltip/MTooltip.vue +0 -42
  203. package/src/components/tooltip/index.js +0 -7
  204. package/src/index.js +0 -63
  205. package/src/shims-tsx.d.ts +0 -13
  206. package/src/shims.vue.d.ts +0 -4
  207. package/src/tokens/adeo/android/colors.xml +0 -448
  208. package/src/tokens/adeo/android/font_dimens.xml +0 -18
  209. package/src/tokens/adeo/css/_variables.scss +0 -442
  210. package/src/tokens/adeo/css/root.scss +0 -444
  211. package/src/tokens/adeo/ios/StyleDictionaryColor.h +0 -456
  212. package/src/tokens/adeo/ios/StyleDictionaryColor.m +0 -468
  213. package/src/tokens/adeo/ios/StyleDictionaryColor.swift +0 -451
  214. package/src/tokens/adeo/ios/StyleDictionarySize.h +0 -69
  215. package/src/tokens/adeo/ios/StyleDictionarySize.m +0 -70
  216. package/src/tokens/adeo/ios/StyleDictionarySize.swift +0 -71
  217. package/src/tokens/adeo/js/tokens.js +0 -540
  218. package/src/tokens/adeo/js/tokensObject.js +0 -11641
  219. package/src/tokens/adeo/scss/_tokens.scss +0 -1514
  220. package/src/utils/mozaicClasses.js +0 -16
  221. package/src/utils/theme.validator.js +0 -19
  222. package/types/index.d.ts +0 -104
package/postinstall.js DELETED
@@ -1,3 +0,0 @@
1
- const package = require('./package.json');
2
-
3
- console.log(`${package.name} installed`);
@@ -1,128 +0,0 @@
1
- <template>
2
- <div class="mc-accordion" :class="{ 'mc-accordion--s': size === 's' }">
3
- <input
4
- :id="id"
5
- ref="checkbox"
6
- type="checkbox"
7
- class="mc-accordion__trigger"
8
- :disabled="disabled"
9
- :checked="open"
10
- @change="$emit('update:open', $event.target.checked)"
11
- />
12
- <div
13
- :class="['mc-accordion__header', setHeaderClasses]"
14
- :aria-expanded="open"
15
- @click="$refs.checkbox.click()"
16
- >
17
- <slot name="beforeLabel" />
18
- <label
19
- :for="id"
20
- :aria-expanded="open"
21
- :class="['mc-accordion__header__label', setLabelClasses]"
22
- @click.stop
23
- >
24
- <m-icon v-if="icon" :name="icon" class="mc-accordion__icon" />
25
- {{ label }}
26
- </label>
27
- <slot name="afterLabel" />
28
- </div>
29
- <div class="mc-accordion__content">
30
- <slot />
31
- </div>
32
- </div>
33
- </template>
34
-
35
- <script>
36
- import MIcon from '../icon/MIcon.vue';
37
-
38
- export default {
39
- name: 'MAccordion',
40
-
41
- components: {
42
- MIcon,
43
- },
44
-
45
- model: {
46
- prop: 'open',
47
- event: 'change',
48
- },
49
-
50
- props: {
51
- id: {
52
- type: String,
53
- required: true,
54
- },
55
- label: {
56
- type: String,
57
- required: true,
58
- },
59
- open: {
60
- type: Boolean,
61
- default: false,
62
- },
63
- size: {
64
- type: String,
65
- default: null,
66
- validator: (value) => ['s', 'm'].includes(value),
67
- },
68
- disabled: {
69
- type: Boolean,
70
- default: false,
71
- },
72
- padding: {
73
- type: Boolean,
74
- default: true,
75
- },
76
- icon: {
77
- type: String,
78
- default: null,
79
- },
80
- },
81
-
82
- computed: {
83
- setHeaderClasses() {
84
- return {
85
- 'mc-accordion__label': true,
86
- 'mc-accordion__label--icon': this.icon,
87
- 'mc-accordion__label--no-padding': !this.padding,
88
- };
89
- },
90
-
91
- setLabelClasses() {
92
- return {
93
- 'mc-accordion__header__label--with-before-slot':
94
- this.$slots.beforeLabel,
95
- 'mc-accordion__header__label--with-after-slot': this.$slots.afterLabel,
96
- };
97
- },
98
- },
99
- };
100
- </script>
101
-
102
- <style lang="scss">
103
- @import 'settings-tools/_all-settings';
104
- @import 'components/c.accordion';
105
-
106
- .mc-accordion {
107
- &__header {
108
- display: flex;
109
- align-items: center;
110
-
111
- &__label {
112
- align-items: center;
113
- display: flex;
114
- cursor: pointer;
115
- gap: $mu050;
116
- white-space: nowrap;
117
-
118
- &--with-before-slot {
119
- padding-left: $mu100;
120
- }
121
-
122
- &--with-after-slot {
123
- padding-right: $mu100;
124
- }
125
- }
126
- }
127
- }
128
- </style>
@@ -1,7 +0,0 @@
1
- import MAccordion from './MAccordion.vue';
2
-
3
- MAccordion.install = function (Vue) {
4
- Vue.component(MAccordion.name, MAccordion);
5
- };
6
-
7
- export { MAccordion };
@@ -1,381 +0,0 @@
1
- <template>
2
- <div
3
- v-click-outside="onClickOutside"
4
- class="mc-autocomplete"
5
- :class="{ 'mc-autocomplete--multi': multiple }"
6
- :style="setStyles"
7
- >
8
- <MTag
9
- v-if="multiple && listboxValue.length > 0"
10
- :id="tagId ? tagId : `autocompleteTag-${uuid}`"
11
- ref="tag"
12
- :label="setTagLabel"
13
- :disabled="disabled"
14
- type="removable"
15
- class="mc-autocomplete__tag"
16
- size="s"
17
- @remove-tag="clearAutocomplete()"
18
- />
19
- <MLoader v-if="loading" class="mc-autocomplete__loader" size="s" />
20
- <MTextInput
21
- :id="id"
22
- v-model="inputValue"
23
- :placeholder="placeholder"
24
- :is-invalid="invalid"
25
- :disabled="disabled"
26
- text-input-field-class="mc-autocomplete__trigger"
27
- icon-position="left"
28
- icon="DisplaySearch48"
29
- autocomplete="off"
30
- type="search"
31
- @input="onInput"
32
- @click="openState = true"
33
- />
34
- <MListBox
35
- v-model="listboxValue"
36
- :open="openState"
37
- :items="localItems"
38
- :multiple="multiple"
39
- :empty-search-label="emptySearchLabel"
40
- :data-key-expr="dataKeyExpr"
41
- :data-text-expr="dataTextExpr"
42
- :data-value-expr="dataValueExpr"
43
- :is-filtered="isFiltered"
44
- :max-width="maxWidth"
45
- @change="onChange"
46
- >
47
- <template #item="{ item }">
48
- <slot name="item" :item="item"></slot>
49
- </template>
50
- </MListBox>
51
- </div>
52
- </template>
53
-
54
- <script>
55
- import MTag from '../tags/MTag.vue';
56
- import MLoader from '../loader/MLoader.vue';
57
- import MTextInput from '../textinput/MTextInput.vue';
58
- import MListBox from '../listbox/MListBox.vue';
59
-
60
- export default {
61
- name: 'MAutocomplete',
62
-
63
- components: {
64
- MTag,
65
- MLoader,
66
- MTextInput,
67
- MListBox,
68
- },
69
-
70
- directives: {
71
- 'click-outside': {
72
- bind(el, binding, vnode) {
73
- el.clickOutsideEvent = (event) => {
74
- if (!(el === event.target || el.contains(event.target))) {
75
- vnode.context[binding.expression](event);
76
- }
77
- };
78
- document.body.addEventListener('click', el.clickOutsideEvent);
79
- },
80
- unbind(el) {
81
- document.body.removeEventListener('click', el.clickOutsideEvent);
82
- },
83
- },
84
- },
85
-
86
- model: {
87
- event: 'change',
88
- },
89
-
90
- props: {
91
- // Tag Element
92
- tagId: {
93
- type: String,
94
- default: null,
95
- },
96
- tagLabel: {
97
- type: String,
98
- default: '',
99
- },
100
- // Input Element
101
- id: {
102
- type: String,
103
- default: null,
104
- },
105
- input: {
106
- type: String,
107
- default: null,
108
- },
109
- placeholder: {
110
- type: String,
111
- default: null,
112
- },
113
- filter: {
114
- type: Function,
115
- default: null,
116
- },
117
- filterOnType: {
118
- type: Boolean,
119
- default: true,
120
- },
121
- disabled: {
122
- type: Boolean,
123
- default: false,
124
- },
125
- invalid: {
126
- type: Boolean,
127
- default: false,
128
- },
129
- loading: {
130
- type: Boolean,
131
- default: false,
132
- },
133
- // Listbox Element
134
- items: {
135
- type: Array,
136
- required: true,
137
- },
138
- value: {
139
- type: [Array, String, Number],
140
- default: undefined,
141
- },
142
- open: {
143
- type: Boolean,
144
- default: false,
145
- },
146
- multiple: {
147
- type: Boolean,
148
- default: false,
149
- },
150
- emptySearchLabel: {
151
- type: String,
152
- default: 'No results found',
153
- },
154
- dataKeyExpr: {
155
- type: String,
156
- default: 'id',
157
- },
158
- dataTextExpr: {
159
- type: String,
160
- default: 'label',
161
- },
162
- dataValueExpr: {
163
- type: String,
164
- default: 'value',
165
- },
166
- sort: {
167
- type: Boolean,
168
- default: true,
169
- },
170
- // Global
171
- maxWidth: {
172
- type: String,
173
- default: '100%', // 17.875rem
174
- },
175
- },
176
-
177
- data() {
178
- return {
179
- uuid: Math.random(),
180
- openState: this.open,
181
- tagWidth: '0px',
182
- tagValue: null,
183
- inputValue: null,
184
- localItems: null,
185
- sortedListItems: null,
186
- listboxValue: null,
187
- isFiltered: null,
188
- };
189
- },
190
-
191
- computed: {
192
- setTagLabel() {
193
- return this.listboxValue.length.toString() + ' ' + this.tagLabel;
194
- },
195
- setStyles() {
196
- return {
197
- '--tag-width': this.tagWidth,
198
- '--max-width': this.maxWidth,
199
- };
200
- },
201
- },
202
-
203
- watch: {
204
- value: {
205
- handler: function (val) {
206
- if (!val && this.multiple) {
207
- this.listboxValue = [];
208
- } else {
209
- this.listboxValue = val;
210
- }
211
- },
212
- immediate: true,
213
- },
214
-
215
- items: {
216
- handler: function (val) {
217
- this.localItems = val;
218
- // this.clearAutocomplete();
219
- },
220
- immediate: true,
221
- },
222
-
223
- listboxValue: function (val) {
224
- const selectedItems = this.getSelectedItems(val);
225
-
226
- const seletedLabels = selectedItems.map(
227
- (item) => item[this.dataTextExpr]
228
- );
229
-
230
- this.inputValue = seletedLabels.join(', ');
231
-
232
- if (this.multiple) {
233
- this.tagValue = val;
234
- }
235
- },
236
-
237
- tagValue: function () {
238
- this.setTagWidth();
239
- },
240
-
241
- openState: function (val) {
242
- const eventName = val ? 'open' : 'close';
243
- this.$emit(eventName);
244
- this.$emit('update:open', val);
245
- },
246
-
247
- input: {
248
- handler: function (val) {
249
- this.inputValue = val;
250
- },
251
- immediate: true,
252
- },
253
- },
254
-
255
- methods: {
256
- setTagWidth() {
257
- this.$nextTick(() => {
258
- if (this.$refs.tag && this.$refs.tag.$el) {
259
- this.tagWidth = this.$refs.tag.$el.clientWidth + 'px';
260
- } else {
261
- this.tagWidth = '0px';
262
- }
263
- });
264
- },
265
-
266
- clearAutocomplete() {
267
- this.listboxValue = this.multiple ? [] : undefined;
268
- this.onChange();
269
- this.$emit('clear');
270
- },
271
-
272
- filterList(value) {
273
- if (value.length && this.filter) {
274
- this.filter(value);
275
- } else if (value.length && this.filterOnType) {
276
- this.localItems = this.items.filter((item) =>
277
- item[this.dataTextExpr].toUpperCase().includes(value.toUpperCase())
278
- );
279
-
280
- this.isFiltered = !this.localItems.length;
281
- } else {
282
- this.localItems = this.items;
283
- this.isFiltered = !this.localItems.length;
284
- }
285
- this.$emit('list-filtered', this.localItems);
286
- },
287
-
288
- onClickOutside() {
289
- this.openState = false;
290
-
291
- if (this.multiple && this.sort) {
292
- this.sortItems();
293
- } else {
294
- this.localItems = this.items;
295
- }
296
- },
297
-
298
- onChange() {
299
- this.$emit('change', this.listboxValue);
300
-
301
- if (!this.multiple) {
302
- this.onClickOutside();
303
- }
304
- },
305
-
306
- getSelectedItems(val) {
307
- const value = val ? val : this.listboxValue;
308
-
309
- const selectedItems = this.items.filter((item) => {
310
- return this.multiple
311
- ? value.includes(item[this.dataValueExpr])
312
- : value === item[this.dataValueExpr];
313
- });
314
-
315
- return selectedItems;
316
- },
317
-
318
- sortItems() {
319
- this.sortedListItems = this.items;
320
- const selectedItems = this.getSelectedItems();
321
-
322
- this.sortedListItems.sort((a, b) => {
323
- const hasItemA = selectedItems.includes(a);
324
- const hasItemB = selectedItems.includes(b);
325
-
326
- if (hasItemA === hasItemB) {
327
- return a[this.dataValueExpr] - b[this.dataValueExpr];
328
- } else if (hasItemA < hasItemB) {
329
- return 1;
330
- } else {
331
- return -1;
332
- }
333
- });
334
-
335
- this.localItems = this.sortedListItems;
336
- },
337
-
338
- handleInputValue(value) {
339
- this.$emit('update:input', value);
340
- },
341
-
342
- onInput(value) {
343
- this.handleInputValue(value);
344
- this.filterList(value);
345
- },
346
- },
347
- };
348
- </script>
349
-
350
- <style lang="scss">
351
- @import 'settings-tools/all-settings';
352
- @import 'components/c.autocomplete';
353
-
354
- .mc-autocomplete {
355
- max-width: var(--max-width);
356
-
357
- &__tag {
358
- position: absolute;
359
- top: 0;
360
- transform: translateY(50%);
361
- }
362
-
363
- &__loader {
364
- position: absolute;
365
- right: $mu075;
366
- top: $mu075;
367
- z-index: 10;
368
- }
369
-
370
- &__trigger {
371
- width: 100%;
372
- }
373
- }
374
-
375
- .mc-autocomplete--multi .mc-autocomplete__trigger {
376
- overflow: hidden;
377
- padding-left: calc(2.9375rem + var(--tag-width));
378
- text-overflow: ellipsis;
379
- white-space: nowrap;
380
- }
381
- </style>
@@ -1,7 +0,0 @@
1
- import MAutocomplete from './MAutocomplete.vue';
2
-
3
- MAutocomplete.install = function (Vue) {
4
- Vue.component(MAutocomplete.name, MAutocomplete);
5
- };
6
-
7
- export { MAutocomplete };
@@ -1,43 +0,0 @@
1
- <template>
2
- <component :is="htmlTag" class="mc-badge" :class="setClasses">
3
- <slot />
4
- </component>
5
- </template>
6
-
7
- <script>
8
- export default {
9
- name: 'MBadge',
10
-
11
- props: {
12
- type: {
13
- type: String,
14
- default: null,
15
- validator: (value) =>
16
- ['information', 'success', 'warning', 'danger', 'neutral'].includes(
17
- value
18
- ),
19
- },
20
- htmlTag: {
21
- type: String,
22
- default: 'span',
23
- },
24
- },
25
-
26
- computed: {
27
- setClasses() {
28
- const classes = [];
29
-
30
- if (this.type) {
31
- classes.push(`mc-badge--${this.type}`);
32
- }
33
-
34
- return classes;
35
- },
36
- },
37
- };
38
- </script>
39
-
40
- <style lang="scss">
41
- @import 'settings-tools/_all-settings';
42
- @import 'components/_c.badge';
43
- </style>
@@ -1,7 +0,0 @@
1
- import MBadge from './MBadge.vue';
2
-
3
- MBadge.install = function (Vue) {
4
- Vue.component(MBadge.name, MBadge);
5
- };
6
-
7
- export { MBadge };
@@ -1,7 +0,0 @@
1
- import MBreadcrumb from './MBreadcrumb.vue';
2
-
3
- MBreadcrumb.install = function (Vue) {
4
- Vue.component(MBreadcrumb.name, MBreadcrumb);
5
- };
6
-
7
- export { MBreadcrumb };
@@ -1,7 +0,0 @@
1
- import MButton from './MButton.vue';
2
-
3
- MButton.install = function (Vue) {
4
- Vue.component(MButton.name, MButton);
5
- };
6
-
7
- export { MButton };
@@ -1,78 +0,0 @@
1
- <template>
2
- <div class="mc-card" :class="{ 'mc-card--bordered': outlined }">
3
- <figure
4
- class="mc-card__visual"
5
- :class="imageratio ? `mc-card__visual--${imageratio}` : ''"
6
- >
7
- <img :src="imgSrc" :loading="lazy ? 'lazy' : 'eager'" :alt="imgAlt" class="mc-card__img" />
8
- <slot name="image" />
9
- </figure>
10
- <article class="mc-card__content">
11
- <component :is="titleTag" class="mc-card__title">
12
- {{ title }}
13
- </component>
14
- <component :is="subtitleTag" v-if="subtitle" class="mc-card__subtitle">
15
- {{ subtitle }}
16
- </component>
17
- <div class="mc-card__body">
18
- <slot />
19
- </div>
20
- <footer v-if="$slots.footer" class="mc-card__footer">
21
- <slot name="footer" />
22
- </footer>
23
- </article>
24
- </div>
25
- </template>
26
-
27
- <script>
28
- export default {
29
- name: 'MCard',
30
-
31
- props: {
32
- title: {
33
- type: String,
34
- required: true,
35
- },
36
- imgSrc: {
37
- type: String,
38
- required: true,
39
- },
40
- lazy: {
41
- type: Boolean,
42
- default: false
43
- },
44
- outlined: {
45
- type: Boolean,
46
- default: false,
47
- },
48
- titleTag: {
49
- type: String,
50
- default: 'h1',
51
- validator: (value) =>
52
- ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(value),
53
- },
54
- imgAlt: {
55
- type: String,
56
- default: '',
57
- },
58
- subtitle: {
59
- type: String,
60
- default: null,
61
- },
62
- subtitleTag: {
63
- type: String,
64
- default: 'h2',
65
- },
66
- imageratio: {
67
- type: String,
68
- default: null,
69
- validator: (value) => ['1x1', '4x3', '16x9'].includes(value),
70
- },
71
- },
72
- };
73
- </script>
74
-
75
- <style lang="scss">
76
- @import 'settings-tools/_all-settings';
77
- @import 'components/_c.card';
78
- </style>
@@ -1,7 +0,0 @@
1
- import MCard from './MCard.vue';
2
-
3
- MCard.install = function (Vue) {
4
- Vue.component(MCard.name, MCard);
5
- };
6
-
7
- export { MCard };