@mozaic-ds/vue 1.0.0-rc.3 → 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 +111 -159
  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 -31341
  120. package/dist/mozaic-vue.common.js +0 -31331
  121. package/dist/mozaic-vue.common.js.map +0 -1
  122. package/dist/mozaic-vue.umd.js +0 -31342
  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 -380
  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 -204
  194. package/src/components/tabs/index.js +0 -7
  195. package/src/components/tags/MTag.vue +0 -175
  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 -452
  208. package/src/tokens/adeo/android/font_dimens.xml +0 -18
  209. package/src/tokens/adeo/css/_variables.scss +0 -446
  210. package/src/tokens/adeo/css/root.scss +0 -448
  211. package/src/tokens/adeo/ios/StyleDictionaryColor.h +0 -460
  212. package/src/tokens/adeo/ios/StyleDictionaryColor.m +0 -472
  213. package/src/tokens/adeo/ios/StyleDictionaryColor.swift +0 -455
  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 -544
  218. package/src/tokens/adeo/js/tokensObject.js +0 -11733
  219. package/src/tokens/adeo/scss/_tokens.scss +0 -1522
  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
@@ -1,398 +0,0 @@
1
- <template>
2
- <div
3
- class="mc-phone-number"
4
- :class="[
5
- { 'mc-phone-number--focused': isCountriesListOpened },
6
- cssFieldElementClass,
7
- ]"
8
- >
9
- <div
10
- v-if="isCountriesListOpened"
11
- class="mc-phone-number__overlay"
12
- @click="toggleCountriesList"
13
- />
14
- <div class="mc-phone-number__dropdown" @keydown="initKeyboardNav">
15
- <button
16
- id="dropdown_country"
17
- type="button"
18
- aria-haspopup="listbox"
19
- aria-labelledby="dropdown_country"
20
- class="mc-phone-number__button"
21
- :aria-expanded="isCountriesListOpened"
22
- @click="toggleCountriesList"
23
- >
24
- <country-flag
25
- v-if="!withoutFlags"
26
- class="flag"
27
- :country="selectedCountry.shortName"
28
- size="small"
29
- />
30
- <span class="mc-phone-number__indicator">{{
31
- selectedCountry.isd
32
- }}</span>
33
- </button>
34
- <ul
35
- v-show="isCountriesListOpened"
36
- id="phone_number_list"
37
- ref="countriesList"
38
- tabindex="-1"
39
- role="listbox"
40
- aria-labelledby="phone_number_list"
41
- class="mc-phone-number__list"
42
- :aria-activedescendant="selectedCountry.isd"
43
- >
44
- <li
45
- v-for="country in countries"
46
- :key="country.isd"
47
- role="option"
48
- class="mc-phone-number__item"
49
- :class="{
50
- 'mc-phone-number__item--focused':
51
- country.isd === selectedCountry.isd,
52
- }"
53
- :aria-selected="country.isd === selectedCountry.isd"
54
- @click="onChangeCountry(country)"
55
- @keyup.enter="onChangeCountry(country)"
56
- >
57
- <country-flag
58
- v-if="!withoutFlags"
59
- class="flag"
60
- :country="country.shortName"
61
- size="small"
62
- />
63
- <span class="mc-phone-number__country">{{ country.name }}</span>
64
- &nbsp;
65
- <span>{{ country.isd }}</span>
66
- </li>
67
- </ul>
68
- </div>
69
- <input
70
- :id="id"
71
- type="tel"
72
- class="mc-phone-number__input mc-text-input mc-text-input--m mc-field__input"
73
- name="phone-number-input"
74
- :value="phoneNumber"
75
- :placeholder="placeholder"
76
- :maxlength="maxlength"
77
- spellcheck="false"
78
- @blur="onChangePhoneNumber"
79
- @focus="(event) => (formatOnBlur ? cleanFormat(event) : null)"
80
- @keyup="onKeyPressPhoneNumber"
81
- @keydown.backspace="
82
- (event) => (formatOnBlur ? null : backspaceFunction(event))
83
- "
84
- v-on="$listeners"
85
- />
86
- </div>
87
- </template>
88
-
89
- <script>
90
- import CountryFlag from 'vue-country-flag';
91
-
92
- import {
93
- parsePhoneNumber,
94
- formatIncompletePhoneNumber,
95
- AsYouType,
96
- } from 'libphonenumber-js';
97
- import { getExampleNumber } from 'libphonenumber-js/max';
98
- import examples from 'libphonenumber-js/examples.mobile.json';
99
-
100
- export default {
101
- name: 'MPhoneNumber',
102
- components: {
103
- CountryFlag,
104
- },
105
- inject: {
106
- cssFieldElementClass: {
107
- default: '',
108
- },
109
- },
110
- props: {
111
- countries: {
112
- type: Array,
113
- default: () => [
114
- {
115
- isd: '+33',
116
- name: 'France',
117
- shortName: 'FR',
118
- },
119
- {
120
- isd: '+39',
121
- name: 'Italia',
122
- shortName: 'IT',
123
- },
124
- ],
125
- },
126
- value: {
127
- type: [String, Number],
128
- default: '',
129
- },
130
- id: {
131
- type: String,
132
- default: null,
133
- },
134
- maxlength: {
135
- type: Number,
136
- default: 25,
137
- },
138
- withoutFlags: {
139
- type: Boolean,
140
- default: false,
141
- },
142
- formatOnBlur: {
143
- type: Boolean,
144
- default: false,
145
- },
146
- },
147
- data: () => ({
148
- isCountriesListOpened: false,
149
- selectedCountry: undefined,
150
- phoneNumber: undefined,
151
- }),
152
- computed: {
153
- hasValue() {
154
- return this.value !== '';
155
- },
156
- placeholder() {
157
- return getExampleNumber(
158
- this.selectedCountry.shortName,
159
- examples
160
- ).formatNational();
161
- },
162
- },
163
- watch: {
164
- value() {
165
- this.init();
166
- },
167
- },
168
- created() {
169
- this.init();
170
- if (!this.hasValue) {
171
- this.selectedCountry = this.countries[0];
172
- }
173
- },
174
- methods: {
175
- init() {
176
- if (this.hasValue) {
177
- try {
178
- const parsedValue = parsePhoneNumber(
179
- this.value,
180
- this.countries[0].shortName
181
- );
182
- this.phoneNumber = parsedValue.formatNational();
183
- this.selectedCountry =
184
- this.countries.find(
185
- (country) => country.shortName === parsedValue.country
186
- ) || this.selectedCountry;
187
- } catch (error) {
188
- this.phoneNumber = this.value;
189
- } finally {
190
- this.selectedCountry =
191
- this.selectedCountry === undefined
192
- ? this.countries[0]
193
- : this.selectedCountry;
194
- }
195
- } else {
196
- this.phoneNumber = '';
197
- }
198
- },
199
- initKeyboardNav(event) {
200
- switch (event.keyCode) {
201
- case 40: // ARROW DOWN
202
- case 38: {
203
- // ARROW UP
204
- if (event.view && event.view.event) {
205
- event.view.event.preventDefault();
206
- }
207
-
208
- if (!this.isCountriesListOpened) {
209
- this.openCountriesList();
210
- }
211
-
212
- const tmpIndex = this.countries.findIndex(
213
- (country) => country.isd === this.selectedCountry.isd
214
- );
215
- let index = event.keyCode === 40 ? tmpIndex + 1 : tmpIndex - 1;
216
-
217
- if (index === -1 || index >= this.countries.length) {
218
- index = index === -1 ? this.countries.length - 1 : 0;
219
- }
220
-
221
- this.selectedCountry = this.countries[index];
222
- break;
223
- }
224
- case 13: // ENTER
225
- this.isCountriesListOpened
226
- ? this.onChangeCountry(this.selectedCountry)
227
- : this.openCountriesList();
228
- break;
229
- case 27: // ESC
230
- this.closeCountriesList();
231
- break;
232
- }
233
- },
234
-
235
- backspaceFunction(event) {
236
- const caretPosition = event.target.selectionStart;
237
- const char = event.target.value.charAt(event.target.selectionStart - 1);
238
- if (char === ' ' || char === ')' || char === '-') {
239
- event.target.value =
240
- event.target.value.slice(0, event.target.selectionStart - 1) +
241
- event.target.value.slice(event.target.selectionStart);
242
- event.target.selectionStart = caretPosition - 1;
243
- event.target.selectionEnd = caretPosition - 1;
244
- }
245
- },
246
-
247
- onKeyPressPhoneNumber(event) {
248
- if (this.formatOnBlur) {
249
- const phoneNumber = event ? event.target.value : this.phoneNumber;
250
- try {
251
- this.$emit(
252
- 'input',
253
- parsePhoneNumber(
254
- phoneNumber,
255
- this.selectedCountry.shortName
256
- ).formatInternational()
257
- );
258
- } catch (error) {
259
- this.$emit(
260
- 'input',
261
- formatIncompletePhoneNumber(
262
- phoneNumber,
263
- this.selectedCountry.shortName
264
- )
265
- );
266
- }
267
- } else {
268
- let caretPosition = event.target.selectionStart;
269
- if (
270
- (event.keyCode >= 48 && event.keyCode <= 57) ||
271
- (event.keyCode >= 96 && event.keyCode <= 105)
272
- ) {
273
- const asYouType = new AsYouType(this.selectedCountry.shortName);
274
- const phone = asYouType.input(event.target.value);
275
- event.target.value = phone;
276
- this.$nextTick(() => {
277
- const charBefore = event.target.value.charAt(caretPosition - 1);
278
- const charAfter = event.target.value.charAt(caretPosition + 1);
279
- caretPosition =
280
- charBefore === ' ' || charBefore === '-'
281
- ? caretPosition + 1
282
- : caretPosition;
283
- caretPosition =
284
- charAfter === '-' || charAfter === ')'
285
- ? caretPosition + 2
286
- : caretPosition;
287
- event.target.setSelectionRange(caretPosition, caretPosition);
288
- });
289
- try {
290
- this.$emit('input', asYouType.input(event.target.value));
291
- } catch (error) {
292
- this.$emit(
293
- 'input',
294
- formatIncompletePhoneNumber(
295
- event.target.value,
296
- this.selectedCountry.shortName
297
- )
298
- );
299
- }
300
- }
301
- }
302
- },
303
-
304
- onChangePhoneNumber(event) {
305
- const phoneNumber = event ? event.target.value : this.phoneNumber;
306
- try {
307
- this.$emit(
308
- 'blur',
309
- parsePhoneNumber(
310
- phoneNumber,
311
- this.selectedCountry.shortName
312
- ).formatInternational()
313
- );
314
- } catch (error) {
315
- this.$emit(
316
- 'blur',
317
- formatIncompletePhoneNumber(
318
- phoneNumber,
319
- this.selectedCountry.shortName
320
- )
321
- );
322
- }
323
- this.phoneNumber = parsePhoneNumber(
324
- phoneNumber,
325
- this.selectedCountry.shortName
326
- ).formatNational();
327
- if (event && event.target) {
328
- event.target.value = parsePhoneNumber(
329
- phoneNumber,
330
- this.selectedCountry.shortName
331
- ).formatNational();
332
- }
333
- },
334
- onChangeCountry(country) {
335
- this.selectedCountry = country;
336
- this.closeCountriesList();
337
- this.$emit('change-country', country);
338
- if (this.hasValue) {
339
- this.onChangePhoneNumber();
340
- }
341
- },
342
- toggleCountriesList() {
343
- this.$refs.countriesList.offsetParent
344
- ? this.closeCountriesList()
345
- : this.openCountriesList();
346
- },
347
- openCountriesList() {
348
- this.$emit('open-countries-list');
349
- this.isCountriesListOpened = true;
350
- },
351
- closeCountriesList() {
352
- this.$emit('close-countries-list');
353
- this.isCountriesListOpened = false;
354
- },
355
- cleanFormat(event) {
356
- this.phoneNumber = formatIncompletePhoneNumber(event.target.value);
357
- },
358
- },
359
- };
360
- </script>
361
-
362
- <style lang="scss">
363
- @import 'settings-tools/_all-settings';
364
- @import 'components/_c.text-input';
365
- @import 'components/_c.phone-number';
366
-
367
- .mc-phone-number {
368
- span.flag {
369
- /* stylelint-disable */
370
- background-repeat: no-repeat;
371
- transform: scale(0.46153846153);
372
- // For information:
373
- // The value 0.46153846153 is obtained by the calculation 24/52
374
- // 24 being the width in pixel desired by the design of the component
375
- // 52 being the width in pixel defined by the country-flag component
376
- /* stylelint-enable */
377
- }
378
-
379
- &__indicator,
380
- &__country {
381
- padding-left: 1rem;
382
- }
383
-
384
- &__overlay {
385
- position: fixed;
386
- top: 0;
387
- bottom: 0;
388
- left: 0;
389
- right: 0;
390
- background: transparent;
391
- z-index: 10;
392
- }
393
-
394
- &__dropdown {
395
- z-index: 20;
396
- }
397
- }
398
- </style>
@@ -1,7 +0,0 @@
1
- import MPhoneNumber from './MPhoneNumber.vue';
2
-
3
- MPhoneNumber.install = function (Vue) {
4
- Vue.component(MPhoneNumber.name, MPhoneNumber);
5
- };
6
-
7
- export { MPhoneNumber };
@@ -1,102 +0,0 @@
1
- <template>
2
- <div class="mc-progressbar" :class="setClasses">
3
- <div
4
- ref="indicator"
5
- class="mc-progressbar__indicator"
6
- role="progressbar"
7
- :style="`width: ${setProgressValue()}%;`"
8
- :aria-valuenow="value"
9
- :aria-valuemin="valueMin"
10
- :aria-valuemax="valueMax"
11
- >
12
- &nbsp;
13
- </div>
14
- <div v-if="percent" class="mc-progressbar__percentage">
15
- {{ setProgressValue() }}%
16
- </div>
17
- </div>
18
- </template>
19
-
20
- <script>
21
- export default {
22
- name: 'MProgress',
23
-
24
- props: {
25
- value: {
26
- type: Number,
27
- default: 0,
28
- },
29
- size: {
30
- type: String,
31
- default: 'm',
32
- validator: (value) => ['xs', 's', 'm'].includes(value),
33
- },
34
- valueMin: {
35
- type: Number,
36
- default: 0,
37
- },
38
- valueMax: {
39
- type: Number,
40
- default: 100,
41
- },
42
- branded: {
43
- type: Boolean,
44
- default: false,
45
- },
46
- percent: {
47
- type: Boolean,
48
- default: false,
49
- },
50
- },
51
-
52
- data() {
53
- return {
54
- currentValue: this.value,
55
- };
56
- },
57
-
58
- computed: {
59
- setClasses() {
60
- const classes = [
61
- {
62
- 'mc-progressbar--branded': this.branded,
63
- 'mc-progressbar--percent': this.percent,
64
- 'mc-progressbar--half':
65
- this.percent && this.currentValue >= this.valueMax / 2,
66
- },
67
- ];
68
-
69
- if (this.size) {
70
- classes.push(`mc-progressbar--${this.size}`);
71
- }
72
-
73
- return classes;
74
- },
75
- },
76
-
77
- methods: {
78
- setProgressValue() {
79
- const initValue = this.value;
80
-
81
- if (initValue > this.valueMax) {
82
- /* eslint-disable no-console */
83
- console.error(
84
- // eslint-disable-next-line quotes
85
- "You can't provide a value that is greater than the valueMax property"
86
- );
87
- /* eslint-enable no-console */
88
- return this.currentValue;
89
- }
90
-
91
- this.currentValue = Math.round(initValue);
92
-
93
- return this.currentValue;
94
- },
95
- },
96
- };
97
- </script>
98
-
99
- <style lang="scss">
100
- @import 'settings-tools/_all-settings';
101
- @import 'components/_c.progressbar';
102
- </style>
@@ -1,7 +0,0 @@
1
- import MProgress from './MProgress.vue';
2
-
3
- MProgress.install = function (Vue) {
4
- Vue.component(MProgress.name, MProgress);
5
- };
6
-
7
- export { MProgress };
@@ -1,7 +0,0 @@
1
- import MQuantitySelector from './MQuantitySelector.vue';
2
-
3
- MQuantitySelector.install = function (Vue) {
4
- Vue.component(MQuantitySelector.name, MQuantitySelector);
5
- };
6
-
7
- export { MQuantitySelector };
@@ -1,111 +0,0 @@
1
- <template>
2
- <fieldset class="mc-field mc-field--group">
3
- <legend class="mc-field__legend">
4
- {{ legend }}
5
- <span
6
- v-if="requirementText"
7
- class="mc-field__requirement"
8
- aria-hidden="true"
9
- >
10
- {{ requirementText }}
11
- </span>
12
- </legend>
13
- <span v-if="helpId && helpText" :id="helpId" class="mc-field__help">
14
- {{ helpText }}
15
- </span>
16
- <div
17
- class="mc-field__container"
18
- :class="{ 'mc-field__container--inline': inline }"
19
- >
20
- <m-radio
21
- v-for="option in options"
22
- :id="option.id ? option.id : option.value"
23
- :key="option.id ? option.id : option.value"
24
- :is-invalid="isInvalid"
25
- :label="option.label"
26
- :name="option.name"
27
- root-class="mc-field__item"
28
- :checked="value === option.value"
29
- @change="(v) => (v ? $emit('input', option.value) : null)"
30
- />
31
- </div>
32
- <span v-if="isInvalid" :id="errorId" class="mc-field__error-message">
33
- {{ errorMessage }}
34
- </span>
35
- </fieldset>
36
- </template>
37
-
38
- <script>
39
- import MRadio from './MRadio.vue';
40
-
41
- export default {
42
- name: 'MRadioGroup',
43
-
44
- components: {
45
- MRadio,
46
- },
47
-
48
- props: {
49
- legend: {
50
- type: String,
51
- required: true,
52
- },
53
- requirementText: {
54
- type: String,
55
- default: null,
56
- },
57
- helpId: {
58
- type: String,
59
- default: null,
60
- },
61
- helpText: {
62
- type: String,
63
- default: null,
64
- },
65
- errorId: {
66
- type: String,
67
- default: null,
68
- },
69
- errorMessage: {
70
- type: String,
71
- default: null,
72
- },
73
- isInvalid: {
74
- type: Boolean,
75
- default: false,
76
- },
77
- inline: {
78
- type: Boolean,
79
- default: false,
80
- },
81
-
82
- value: {
83
- type: String,
84
- default: null,
85
- },
86
-
87
- options: {
88
- type: Array,
89
- default() {
90
- return [];
91
- },
92
- validator(options) {
93
- return options.every(
94
- (o) =>
95
- 'id' in o &&
96
- typeof o.id == 'string' &&
97
- 'label' in o &&
98
- typeof o.label == 'string' &&
99
- 'value' in o &&
100
- typeof o.value == 'string'
101
- );
102
- },
103
- },
104
- },
105
- };
106
- </script>
107
-
108
- <style lang="scss">
109
- @import 'settings-tools/_all-settings';
110
- @import 'components/_c.fields';
111
- </style>
@@ -1,12 +0,0 @@
1
- import MRadio from './MRadio.vue';
2
- import MRadioGroup from './MRadioGroup.vue';
3
-
4
- MRadio.install = function (Vue) {
5
- Vue.component(MRadio.name, MRadio);
6
- };
7
-
8
- MRadioGroup.install = function (Vue) {
9
- Vue.component(MRadioGroup.name, MRadioGroup);
10
- };
11
-
12
- export { MRadio, MRadioGroup };