@mozaic-ds/vue 1.0.0-beta.3 → 1.0.0-beta.5

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 (191) hide show
  1. package/LICENSE +51 -0
  2. package/README.md +224 -82
  3. package/dist/mozaic-vue.css +1 -1
  4. package/dist/mozaic-vue.d.ts +1202 -0
  5. package/dist/mozaic-vue.js +1220 -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 +81 -50
  11. package/src/components/Contributing.mdx +118 -0
  12. package/src/components/GettingStarted.mdx +50 -0
  13. package/src/components/Introduction.mdx +54 -0
  14. package/src/components/Support.mdx +18 -0
  15. package/src/components/badge/MBadge.spec.ts +16 -0
  16. package/src/components/badge/MBadge.stories.ts +50 -0
  17. package/src/components/badge/MBadge.vue +36 -34
  18. package/src/components/breadcrumb/MBreadcrumb.spec.ts +105 -0
  19. package/src/components/breadcrumb/MBreadcrumb.stories.ts +57 -0
  20. package/src/components/breadcrumb/MBreadcrumb.vue +52 -55
  21. package/src/components/button/MButton.spec.ts +191 -0
  22. package/src/components/button/MButton.stories.ts +66 -0
  23. package/src/components/button/MButton.vue +98 -154
  24. package/src/components/checkbox/MCheckbox.spec.ts +104 -0
  25. package/src/components/checkbox/MCheckbox.stories.ts +83 -0
  26. package/src/components/checkbox/MCheckbox.vue +60 -101
  27. package/src/components/checkboxgroup/MCheckboxGroup.spec.ts +78 -0
  28. package/src/components/checkboxgroup/MCheckboxGroup.stories.ts +61 -0
  29. package/src/components/checkboxgroup/MCheckboxGroup.vue +97 -0
  30. package/src/components/field/MField.spec.ts +166 -0
  31. package/src/components/field/MField.stories.ts +376 -0
  32. package/src/components/field/MField.vue +78 -61
  33. package/src/components/fieldgroup/MFieldGroup.spec.ts +165 -0
  34. package/src/components/fieldgroup/MFieldGroup.stories.ts +423 -0
  35. package/src/components/fieldgroup/MFieldGroup.vue +79 -0
  36. package/src/components/iconbutton/MIconButton.spec.ts +108 -0
  37. package/src/components/iconbutton/MIconButton.stories.ts +66 -0
  38. package/src/components/iconbutton/MIconButton.vue +73 -0
  39. package/src/components/link/MLink.spec.ts +154 -0
  40. package/src/components/link/MLink.stories.ts +98 -0
  41. package/src/components/link/MLink.vue +86 -109
  42. package/src/components/loader/MLoader.spec.ts +104 -0
  43. package/src/components/loader/MLoader.stories.ts +45 -0
  44. package/src/components/loader/MLoader.vue +65 -55
  45. package/src/components/overlay/MOverlay.spec.ts +51 -0
  46. package/src/components/overlay/MOverlay.stories.ts +40 -0
  47. package/src/components/overlay/MOverlay.vue +27 -19
  48. package/src/components/passwordinput/MPasswordInput.spec.ts +104 -0
  49. package/src/components/passwordinput/MPasswordInput.stories.ts +75 -0
  50. package/src/components/passwordinput/MPasswordInput.vue +129 -76
  51. package/src/components/quantityselector/MQuantitySelector.spec.ts +262 -0
  52. package/src/components/quantityselector/MQuantitySelector.stories.ts +89 -0
  53. package/src/components/quantityselector/MQuantitySelector.vue +160 -136
  54. package/src/components/radio/MRadio.spec.ts +104 -0
  55. package/src/components/radio/MRadio.stories.ts +68 -0
  56. package/src/components/radio/MRadio.vue +56 -39
  57. package/src/components/radiogroup/MRadioGroup.spec.ts +54 -0
  58. package/src/components/radiogroup/MRadioGroup.stories.ts +61 -0
  59. package/src/components/radiogroup/MRadioGroup.vue +79 -0
  60. package/src/components/select/MSelect.spec.ts +114 -0
  61. package/src/components/select/MSelect.stories.ts +101 -0
  62. package/src/components/select/MSelect.vue +77 -119
  63. package/src/components/statusbadge/MStatusBadge.stories.ts +45 -0
  64. package/src/components/statusbadge/MStatusBadge.vue +40 -0
  65. package/src/components/statusbadge/MstatusBadge.spec.ts +16 -0
  66. package/src/components/statusdot/MStatusDot.spec.ts +51 -0
  67. package/src/components/statusdot/MStatusDot.stories.ts +48 -0
  68. package/src/components/statusdot/MStatusDot.vue +36 -0
  69. package/src/components/statusnotification/MStatusNotification.spec.ts +99 -0
  70. package/src/components/statusnotification/MStatusNotification.stories.ts +96 -0
  71. package/src/components/statusnotification/MStatusNotification.vue +106 -0
  72. package/src/components/textarea/MTextArea.spec.ts +112 -0
  73. package/src/components/textarea/MTextArea.stories.ts +67 -0
  74. package/src/components/textarea/MTextArea.vue +81 -42
  75. package/src/components/textinput/MTextInput.spec.ts +121 -0
  76. package/src/components/textinput/MTextInput.stories.ts +114 -0
  77. package/src/components/textinput/MTextInput.vue +127 -47
  78. package/src/components/toggle/MToggle.spec.ts +99 -0
  79. package/src/components/toggle/MToggle.stories.ts +68 -0
  80. package/src/components/toggle/MToggle.vue +63 -103
  81. package/src/components/togglegroup/MToggleGroup.spec.ts +78 -0
  82. package/src/components/togglegroup/MToggleGroup.stories.ts +61 -0
  83. package/src/components/togglegroup/MToggleGroup.vue +97 -0
  84. package/src/components/usingIcons.mdx +43 -0
  85. package/src/components/usingPresets.mdx +125 -0
  86. package/src/main.ts +47 -0
  87. package/dist/demo.html +0 -1
  88. package/dist/mozaic-vue.adeo.css +0 -45
  89. package/dist/mozaic-vue.adeo.umd.js +0 -41775
  90. package/dist/mozaic-vue.common.js +0 -41765
  91. package/dist/mozaic-vue.common.js.map +0 -1
  92. package/dist/mozaic-vue.umd.js +0 -41776
  93. package/dist/mozaic-vue.umd.js.map +0 -1
  94. package/dist/mozaic-vue.umd.min.js +0 -4
  95. package/dist/mozaic-vue.umd.min.js.map +0 -1
  96. package/postinstall.js +0 -3
  97. package/src/components/accordion/MAccordion.vue +0 -128
  98. package/src/components/accordion/index.js +0 -7
  99. package/src/components/autocomplete/MAutocomplete.vue +0 -198
  100. package/src/components/autocomplete/index.js +0 -7
  101. package/src/components/badge/index.js +0 -7
  102. package/src/components/breadcrumb/index.js +0 -7
  103. package/src/components/button/index.js +0 -7
  104. package/src/components/card/MCard.vue +0 -78
  105. package/src/components/card/index.js +0 -7
  106. package/src/components/checkbox/MCheckboxGroup.vue +0 -155
  107. package/src/components/checkbox/index.js +0 -12
  108. package/src/components/container/MContainer.vue +0 -33
  109. package/src/components/container/index.js +0 -7
  110. package/src/components/datatable/MDataTable.vue +0 -651
  111. package/src/components/datatable/MDataTableHeader.vue +0 -55
  112. package/src/components/datatable/MDataTableTop.vue +0 -35
  113. package/src/components/datatable/helpers.js +0 -132
  114. package/src/components/datatable/index.js +0 -12
  115. package/src/components/field/index.js +0 -7
  116. package/src/components/fileuploader/MFileResult.vue +0 -149
  117. package/src/components/fileuploader/MFileUploader.vue +0 -142
  118. package/src/components/fileuploader/index.js +0 -7
  119. package/src/components/flag/MFlag.vue +0 -46
  120. package/src/components/flag/index.js +0 -7
  121. package/src/components/heading/MHeading.vue +0 -75
  122. package/src/components/heading/index.js +0 -7
  123. package/src/components/hero/MHero.vue +0 -93
  124. package/src/components/hero/index.js +0 -7
  125. package/src/components/icon/MIcon.vue +0 -120
  126. package/src/components/icon/index.js +0 -7
  127. package/src/components/index.js +0 -43
  128. package/src/components/layer/MLayer.vue +0 -208
  129. package/src/components/layer/index.js +0 -7
  130. package/src/components/link/index.js +0 -7
  131. package/src/components/listbox/MListBox.vue +0 -106
  132. package/src/components/listbox/index.js +0 -7
  133. package/src/components/loader/index.js +0 -7
  134. package/src/components/modal/MModal.vue +0 -179
  135. package/src/components/modal/index.js +0 -7
  136. package/src/components/notification/MNotification.vue +0 -110
  137. package/src/components/notification/index.js +0 -7
  138. package/src/components/optionbutton/MOptionButton.vue +0 -67
  139. package/src/components/optionbutton/index.js +0 -7
  140. package/src/components/optioncard/MOptionCard.vue +0 -132
  141. package/src/components/optioncard/index.js +0 -7
  142. package/src/components/optiongroup/MOptionGroup.vue +0 -18
  143. package/src/components/optiongroup/index.js +0 -7
  144. package/src/components/overlay/MOverlayLoader.vue +0 -43
  145. package/src/components/overlay/index.js +0 -12
  146. package/src/components/pagination/MPagination.vue +0 -162
  147. package/src/components/pagination/index.js +0 -7
  148. package/src/components/passwordinput/index.js +0 -7
  149. package/src/components/phonenumber/MPhoneNumber.vue +0 -390
  150. package/src/components/phonenumber/index.js +0 -7
  151. package/src/components/progressbar/MProgress.vue +0 -102
  152. package/src/components/progressbar/index.js +0 -7
  153. package/src/components/quantityselector/index.js +0 -7
  154. package/src/components/radio/MRadioGroup.vue +0 -111
  155. package/src/components/radio/index.js +0 -12
  156. package/src/components/ratingstars/MStarsInput.vue +0 -118
  157. package/src/components/ratingstars/MStarsResult.vue +0 -89
  158. package/src/components/ratingstars/index.js +0 -12
  159. package/src/components/select/index.js +0 -7
  160. package/src/components/stepper/MStepper.vue +0 -70
  161. package/src/components/stepper/index.js +0 -7
  162. package/src/components/tabs/MTab.vue +0 -184
  163. package/src/components/tabs/index.js +0 -7
  164. package/src/components/tags/MTag.vue +0 -173
  165. package/src/components/tags/index.js +0 -7
  166. package/src/components/textarea/index.js +0 -7
  167. package/src/components/textinput/MTextInputField.vue +0 -105
  168. package/src/components/textinput/MTextInputIcon.vue +0 -42
  169. package/src/components/textinput/index.js +0 -7
  170. package/src/components/toggle/index.js +0 -7
  171. package/src/components/tooltip/MTooltip.vue +0 -42
  172. package/src/components/tooltip/index.js +0 -7
  173. package/src/index.js +0 -62
  174. package/src/shims-tsx.d.ts +0 -13
  175. package/src/shims.vue.d.ts +0 -4
  176. package/src/tokens/adeo/android/colors.xml +0 -391
  177. package/src/tokens/adeo/android/font_dimens.xml +0 -18
  178. package/src/tokens/adeo/css/_variables.scss +0 -385
  179. package/src/tokens/adeo/css/root.scss +0 -387
  180. package/src/tokens/adeo/ios/StyleDictionaryColor.h +0 -399
  181. package/src/tokens/adeo/ios/StyleDictionaryColor.m +0 -411
  182. package/src/tokens/adeo/ios/StyleDictionaryColor.swift +0 -394
  183. package/src/tokens/adeo/ios/StyleDictionarySize.h +0 -69
  184. package/src/tokens/adeo/ios/StyleDictionarySize.m +0 -70
  185. package/src/tokens/adeo/ios/StyleDictionarySize.swift +0 -71
  186. package/src/tokens/adeo/js/tokens.js +0 -483
  187. package/src/tokens/adeo/js/tokensObject.js +0 -10354
  188. package/src/tokens/adeo/scss/_tokens.scss +0 -1300
  189. package/src/utils/mozaicClasses.js +0 -16
  190. package/src/utils/theme.validator.js +0 -19
  191. package/types/index.d.ts +0 -100
@@ -1,162 +0,0 @@
1
- <template>
2
- <div class="mc-pagination" :class="{ 'mc-pagination--light': light }">
3
- <component
4
- :is="hrefPrev ? 'a' : 'button'"
5
- v-if="value > 1"
6
- :type="hrefPrev ? null : 'button'"
7
- :href="hrefPrev"
8
- class="mc-pagination__button"
9
- aria-label="Previous Page"
10
- :disabled="disabled"
11
- @click="previousPage(currentPage - 1)"
12
- >
13
- <m-icon name="ArrowArrowLeft24" class="mc-pagination__button-icon" />
14
- </component>
15
-
16
- <div v-if="!light" class="mc-pagination__field">
17
- <m-select
18
- :id="`selectpagination${selectId}`"
19
- v-model="currentPage"
20
- :options="formattedOptions"
21
- :disabled="disabled"
22
- class="mc-pagination__select"
23
- @change="changePage(Number($event))"
24
- >
25
- <template #text="{ option }">
26
- <slot name="text" :option="{ ...option, length }">
27
- {{ option.text }}
28
- </slot>
29
- </template>
30
- </m-select>
31
- </div>
32
-
33
- <component
34
- :is="hrefNext ? 'a' : 'button'"
35
- v-if="value < length"
36
- :type="hrefNext ? null : 'button'"
37
- :href="hrefNext"
38
- class="mc-pagination__button"
39
- aria-label="Next Page"
40
- :disabled="disabled"
41
- @click="nextPage(currentPage + 1)"
42
- >
43
- <m-icon name="ArrowArrowRight24" class="mc-pagination__button-icon" />
44
- </component>
45
- </div>
46
- </template>
47
-
48
- <script>
49
- import MIcon from '../icon/MIcon.vue';
50
- import MSelect from '../select/MSelect.vue';
51
-
52
- export default {
53
- name: 'MPagination',
54
-
55
- components: {
56
- MIcon,
57
- MSelect,
58
- },
59
-
60
- props: {
61
- length: {
62
- type: Number,
63
- default: 0,
64
- },
65
- value: {
66
- type: Number,
67
- default: 0,
68
- },
69
- pageLabel: {
70
- type: String,
71
- default: 'sur',
72
- },
73
- light: {
74
- type: Boolean,
75
- default: false,
76
- },
77
- hrefPrev: {
78
- type: String,
79
- default: null,
80
- },
81
- hrefNext: {
82
- type: String,
83
- default: null,
84
- },
85
- disabled: {
86
- type: Boolean,
87
- default: false,
88
- },
89
- },
90
-
91
- data: function () {
92
- return {
93
- selectId: null,
94
- currentPage: Number(this.value),
95
- };
96
- },
97
-
98
- computed: {
99
- formattedOptions() {
100
- const pageOptions = [];
101
-
102
- for (let i = 1; i <= this.length; i++) {
103
- pageOptions.push({
104
- text: `${i} ${this.pageLabel} ${this.length}`,
105
- value: i,
106
- index: i,
107
- });
108
- }
109
-
110
- if (this.currentPage > this.length) {
111
- this.changePage(this.length);
112
- }
113
-
114
- return pageOptions;
115
- },
116
- },
117
-
118
- watch: {
119
- value: {
120
- handler(newPage) {
121
- this.currentPage = newPage;
122
- },
123
- },
124
- },
125
-
126
- created() {
127
- this.selectId = this._uid;
128
- },
129
-
130
- methods: {
131
- hasPreviousPageListener() {
132
- return this.$listeners && this.$listeners['on-previous-page'];
133
- },
134
- hasNextPageListener() {
135
- return this.$listeners && this.$listeners['on-next-page'];
136
- },
137
- changePage(newPage) {
138
- this.$emit('on-update-page', newPage);
139
- this.$emit('update:value',newPage);
140
- },
141
- previousPage(newPage) {
142
- if (this.hasPreviousPageListener()) {
143
- this.$emit('on-previous-page', newPage);
144
- } else {
145
- this.changePage(newPage);
146
- }
147
- },
148
- nextPage(newPage) {
149
- if (this.hasNextPageListener()) {
150
- this.$emit('on-next-page', newPage);
151
- } else {
152
- this.changePage(newPage);
153
- }
154
- },
155
- },
156
- };
157
- </script>
158
-
159
- <style lang="scss" scoped>
160
- @import 'settings-tools/_all-settings';
161
- @import 'components/_c.pagination';
162
- </style>
@@ -1,7 +0,0 @@
1
- import MPagination from './MPagination.vue';
2
-
3
- MPagination.install = function (Vue) {
4
- Vue.component(MPagination.name, MPagination);
5
- };
6
-
7
- export { MPagination };
@@ -1,7 +0,0 @@
1
- import MPasswordInput from './MPasswordInput.vue';
2
-
3
- MPasswordInput.install = function (Vue) {
4
- Vue.component(MPasswordInput.name, MPasswordInput);
5
- };
6
-
7
- export { MPasswordInput };
@@ -1,390 +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="smallField"
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
- @blur="onChangePhoneNumber"
78
- @focus="(event) => (formatOnBlur ? cleanFormat(event) : null)"
79
- @keyup="onKeyPressPhoneNumber"
80
- @keydown.backspace="
81
- (event) => (formatOnBlur ? null : backspaceFunction(event))
82
- "
83
- />
84
- </div>
85
- </template>
86
-
87
- <script>
88
- import CountryFlag from 'vue-country-flag';
89
-
90
- import {
91
- parsePhoneNumber,
92
- formatIncompletePhoneNumber,
93
- AsYouType,
94
- } from 'libphonenumber-js';
95
- import { getExampleNumber } from 'libphonenumber-js/max';
96
- import examples from 'libphonenumber-js/examples.mobile.json';
97
-
98
- export default {
99
- name: 'MPhoneNumber',
100
- components: {
101
- CountryFlag,
102
- },
103
- inject: {
104
- cssFieldElementClass: {
105
- default: '',
106
- },
107
- },
108
- props: {
109
- countries: {
110
- type: Array,
111
- default: () => [
112
- {
113
- isd: '+33',
114
- name: 'France',
115
- shortName: 'FR',
116
- },
117
- {
118
- isd: '+39',
119
- name: 'Italia',
120
- shortName: 'IT',
121
- },
122
- ],
123
- },
124
- value: {
125
- type: [String, Number],
126
- default: '',
127
- },
128
- maxlength: {
129
- type: Number,
130
- default: 25,
131
- },
132
- withoutFlags: {
133
- type: Boolean,
134
- default: false,
135
- },
136
- formatOnBlur: {
137
- type: Boolean,
138
- default: false,
139
- },
140
- },
141
- data: () => ({
142
- isCountriesListOpened: false,
143
- selectedCountry: undefined,
144
- phoneNumber: undefined,
145
- }),
146
- computed: {
147
- hasValue() {
148
- return this.phoneNumber !== '';
149
- },
150
- placeholder() {
151
- return getExampleNumber(
152
- this.selectedCountry.shortName,
153
- examples
154
- ).formatNational();
155
- },
156
- },
157
- watch: {
158
- value() {
159
- this.init();
160
- },
161
- },
162
- created() {
163
- this.init();
164
- },
165
- methods: {
166
- init() {
167
- if (this.hasValue) {
168
- try {
169
- const parsedValue = parsePhoneNumber(
170
- this.value,
171
- this.countries[0].shortName
172
- );
173
- this.phoneNumber = parsedValue.formatNational();
174
- this.selectedCountry =
175
- this.countries.find(
176
- (country) => country.shortName === parsedValue.country
177
- ) || this.selectedCountry;
178
- } catch (error) {
179
- this.phoneNumber = this.value;
180
- } finally {
181
- this.selectedCountry =
182
- this.selectedCountry === undefined
183
- ? this.countries[0]
184
- : this.selectedCountry;
185
- }
186
- } else {
187
- this.selectedCountry = this.countries[0];
188
- this.phoneNumber = '';
189
- }
190
- },
191
- initKeyboardNav(event) {
192
- switch (event.keyCode) {
193
- case 40: // ARROW DOWN
194
- case 38: {
195
- // ARROW UP
196
- if (event.view && event.view.event) {
197
- event.view.event.preventDefault();
198
- }
199
-
200
- if (!this.isCountriesListOpened) {
201
- this.openCountriesList();
202
- }
203
-
204
- const tmpIndex = this.countries.findIndex(
205
- (country) => country.isd === this.selectedCountry.isd
206
- );
207
- let index = event.keyCode === 40 ? tmpIndex + 1 : tmpIndex - 1;
208
-
209
- if (index === -1 || index >= this.countries.length) {
210
- index = index === -1 ? this.countries.length - 1 : 0;
211
- }
212
-
213
- this.selectedCountry = this.countries[index];
214
- break;
215
- }
216
- case 13: // ENTER
217
- this.isCountriesListOpened
218
- ? this.onChangeCountry(this.selectedCountry)
219
- : this.openCountriesList();
220
- break;
221
- case 27: // ESC
222
- this.closeCountriesList();
223
- break;
224
- }
225
- },
226
-
227
- backspaceFunction(event) {
228
- const caretPosition = event.target.selectionStart;
229
- const char = event.target.value.charAt(event.target.selectionStart - 1);
230
- if (char === ' ' || char === ')' || char === '-') {
231
- event.target.value =
232
- event.target.value.slice(0, event.target.selectionStart - 1) +
233
- event.target.value.slice(event.target.selectionStart);
234
- event.target.selectionStart = caretPosition - 1;
235
- event.target.selectionEnd = caretPosition - 1;
236
- }
237
- },
238
-
239
- onKeyPressPhoneNumber(event) {
240
- if (this.formatOnBlur) {
241
- const phoneNumber = event ? event.target.value : this.phoneNumber;
242
- try {
243
- this.$emit(
244
- 'input',
245
- parsePhoneNumber(
246
- phoneNumber,
247
- this.selectedCountry.shortName
248
- ).formatInternational()
249
- );
250
- } catch (error) {
251
- this.$emit(
252
- 'input',
253
- formatIncompletePhoneNumber(
254
- phoneNumber,
255
- this.selectedCountry.shortName
256
- )
257
- );
258
- }
259
- } else {
260
- let caretPosition = event.target.selectionStart;
261
- if (
262
- (event.keyCode >= 48 && event.keyCode <= 57) ||
263
- (event.keyCode >= 96 && event.keyCode <= 105)
264
- ) {
265
- const asYouType = new AsYouType(this.selectedCountry.shortName);
266
- const phone = asYouType.input(event.target.value);
267
- event.target.value = phone;
268
- this.$nextTick(() => {
269
- const charBefore = event.target.value.charAt(caretPosition - 1);
270
- const charAfter = event.target.value.charAt(caretPosition + 1);
271
- caretPosition =
272
- charBefore === ' ' || charBefore === '-'
273
- ? caretPosition + 1
274
- : caretPosition;
275
- caretPosition =
276
- charAfter === '-' || charAfter === ')'
277
- ? caretPosition + 2
278
- : caretPosition;
279
- event.target.setSelectionRange(caretPosition, caretPosition);
280
- });
281
- try {
282
- this.$emit('input', asYouType.input(event.target.value));
283
- } catch (error) {
284
- this.$emit(
285
- 'input',
286
- formatIncompletePhoneNumber(
287
- event.target.value,
288
- this.selectedCountry.shortName
289
- )
290
- );
291
- }
292
- }
293
- }
294
- },
295
-
296
- onChangePhoneNumber(event) {
297
- const phoneNumber = event ? event.target.value : this.phoneNumber;
298
- try {
299
- this.$emit(
300
- 'blur',
301
- parsePhoneNumber(
302
- phoneNumber,
303
- this.selectedCountry.shortName
304
- ).formatInternational()
305
- );
306
- } catch (error) {
307
- this.$emit(
308
- 'blur',
309
- formatIncompletePhoneNumber(
310
- phoneNumber,
311
- this.selectedCountry.shortName
312
- )
313
- );
314
- }
315
- this.phoneNumber = parsePhoneNumber(
316
- phoneNumber,
317
- this.selectedCountry.shortName
318
- ).formatNational();
319
- if (event && event.target) {
320
- event.target.value = parsePhoneNumber(
321
- phoneNumber,
322
- this.selectedCountry.shortName
323
- ).formatNational();
324
- }
325
- },
326
- onChangeCountry(country) {
327
- this.selectedCountry = country;
328
- this.closeCountriesList();
329
- this.$emit('change-country', country);
330
- if (this.hasValue) {
331
- this.onChangePhoneNumber();
332
- }
333
- },
334
- toggleCountriesList() {
335
- this.$refs.countriesList.offsetParent
336
- ? this.closeCountriesList()
337
- : this.openCountriesList();
338
- },
339
- openCountriesList() {
340
- this.$emit('open-countries-list');
341
- this.isCountriesListOpened = true;
342
- },
343
- closeCountriesList() {
344
- this.$emit('close-countries-list');
345
- this.isCountriesListOpened = false;
346
- },
347
- cleanFormat(event) {
348
- this.phoneNumber = formatIncompletePhoneNumber(event.target.value);
349
- },
350
- },
351
- };
352
- </script>
353
-
354
- <style lang="scss">
355
- @import 'settings-tools/_all-settings';
356
- @import 'components/_c.text-input';
357
- @import 'components/_c.phone-number';
358
-
359
- .mc-phone-number {
360
- span.flag {
361
- /* stylelint-disable */
362
- background-repeat: no-repeat;
363
- transform: scale(0.46153846153);
364
- // For information:
365
- // The value 0.46153846153 is obtained by the calculation 24/52
366
- // 24 being the width in pixel desired by the design of the component
367
- // 52 being the width in pixel defined by the country-flag component
368
- /* stylelint-enable */
369
- }
370
-
371
- &__indicator,
372
- &__country {
373
- padding-left: 1rem;
374
- }
375
-
376
- &__overlay {
377
- position: fixed;
378
- top: 0;
379
- bottom: 0;
380
- left: 0;
381
- right: 0;
382
- background: transparent;
383
- z-index: 10;
384
- }
385
-
386
- &__dropdown {
387
- z-index: 20;
388
- }
389
- }
390
- </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 };