@mozaic-ds/vue 0.7.1 → 0.8.2-beta.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/package.json CHANGED
@@ -1,18 +1,21 @@
1
1
  {
2
2
  "name": "@mozaic-ds/vue",
3
- "version": "0.7.1",
3
+ "version": "0.8.2-beta.0",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build ./src/index.js",
7
7
  "build:bundle": "vue-cli-service build --target lib --name mozaic-vue ./src/index.js",
8
+ "build:bundleAdeo": "vue-cli-service build --target lib --formats umd --mode adeo --filename mozaic-vue.adeo ./src/index.js --no-clean",
8
9
  "lint": "vue-cli-service lint",
9
- "prepublishOnly": "npm run-script build:bundle",
10
- "publish:beta": "npm publish --access public --tag alpha"
10
+ "prepublishOnly": "npm run-script build:bundle && npm run-script build:bundleAdeo",
11
+ "publish:beta": "npm publish --access public --tag alpha",
12
+ "tokens:build": "mozaic-tokens-build",
13
+ "postinstall": "node postinstall.js"
11
14
  },
12
15
  "dependencies": {
13
- "@mozaic-ds/css-dev-tools": "^1.18.0",
14
- "@mozaic-ds/icons": "^1.14.0",
15
- "@mozaic-ds/styles": "^1.19.0",
16
+ "@mozaic-ds/css-dev-tools": "^1.20.0",
17
+ "@mozaic-ds/icons": "^1.20.0",
18
+ "@mozaic-ds/styles": "^1.20.1",
16
19
  "@mozaic-ds/web-fonts": "^1.18.0",
17
20
  "core-js": "^3.18.3",
18
21
  "libphonenumber-js": "^1.9.37",
@@ -57,7 +60,8 @@
57
60
  "dist/*",
58
61
  "src/*",
59
62
  "types/*",
60
- "*.d.ts"
63
+ "*.d.ts",
64
+ "postinstall.js"
61
65
  ],
62
66
  "types": "./types/index.d.ts",
63
67
  "repository": {
package/postinstall.js ADDED
@@ -0,0 +1,6 @@
1
+ const package = require('./package.json');
2
+
3
+ console.log(`${package.name} installed`);
4
+ console.log(
5
+ "MTextInput change coming on the 01/12/2021. All input events will be available and will receive the event object. The blur event won't receive the value anymore."
6
+ );
@@ -8,26 +8,22 @@
8
8
  :disabled="disabled"
9
9
  />
10
10
  <div
11
- v-if="$slots.beforeLabel"
12
- :class="['mc-accordion__header', setLabelClasses]"
11
+ :class="['mc-accordion__header', setHeaderClasses]"
13
12
  :aria-expanded="checked"
14
- @click.self="checked = !checked"
13
+ @click="onClick"
15
14
  >
16
15
  <slot name="beforeLabel" />
17
16
  <label
18
17
  :for="id"
19
18
  :aria-expanded="checked"
20
- class="mc-accordion__label--with-slot"
19
+ :class="['mc-accordion__header__label', setLabelClasses]"
20
+ @click.stop
21
21
  >
22
22
  <m-icon v-if="icon" :name="icon" class="mc-accordion__icon" />
23
23
  {{ label }}
24
24
  </label>
25
+ <slot name="afterLabel" />
25
26
  </div>
26
- <label v-else :for="id" :aria-expanded="checked" :class="setLabelClasses">
27
- <m-icon v-if="icon" :name="icon" class="mc-accordion__icon" />
28
- {{ label }}
29
- </label>
30
-
31
27
  <div class="mc-accordion__content">
32
28
  <slot />
33
29
  </div>
@@ -44,8 +40,6 @@ export default {
44
40
  MIcon,
45
41
  },
46
42
 
47
- inheritAttrs: false,
48
-
49
43
  props: {
50
44
  id: {
51
45
  type: String,
@@ -85,19 +79,38 @@ export default {
85
79
  },
86
80
 
87
81
  computed: {
88
- setLabelClasses() {
82
+ setHeaderClasses() {
89
83
  return {
90
84
  'mc-accordion__label': true,
91
85
  'mc-accordion__label--icon': this.icon,
92
86
  'mc-accordion__label--no-padding': !this.padding,
93
87
  };
94
88
  },
89
+
90
+ setLabelClasses() {
91
+ return {
92
+ 'mc-accordion__header__label--with-before-slot':
93
+ this.$slots.beforeLabel,
94
+ 'mc-accordion__header__label--with-after-slot': this.$slots.afterLabel,
95
+ };
96
+ },
95
97
  },
96
98
 
97
99
  watch: {
98
100
  open: function () {
99
101
  this.checked = !this.checked;
100
102
  },
103
+ checked: function () {
104
+ this.$emit('update:open', this.checked);
105
+ },
106
+ },
107
+
108
+ methods: {
109
+ onClick() {
110
+ if (this.disabled === false) {
111
+ this.checked = !this.checked;
112
+ }
113
+ },
101
114
  },
102
115
  };
103
116
  </script>
@@ -110,10 +123,21 @@ export default {
110
123
  &__header {
111
124
  display: flex;
112
125
  align-items: center;
113
- }
114
126
 
115
- &__label--with-slot {
116
- padding-left: $mu100;
127
+ &__label {
128
+ display: flex;
129
+ align-items: center;
130
+ white-space: nowrap;
131
+ cursor: pointer;
132
+
133
+ &--with-before-slot {
134
+ padding-left: $mu100;
135
+ }
136
+
137
+ &--with-after-slot {
138
+ padding-right: $mu100;
139
+ }
140
+ }
117
141
  }
118
142
  }
119
143
  </style>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div v-if="label" class="mc-checkbox">
2
+ <div v-if="hasLabel" class="mc-checkbox">
3
3
  <input
4
4
  :id="id"
5
5
  ref="input"
@@ -12,7 +12,9 @@
12
12
  @change="$emit('change', $event.target.checked)"
13
13
  />
14
14
  <label :for="id" class="mc-checkbox__label">
15
- {{ label }}
15
+ <slot name="label">
16
+ {{ label }}
17
+ </slot>
16
18
  </label>
17
19
  </div>
18
20
 
@@ -71,6 +73,10 @@ export default {
71
73
  },
72
74
 
73
75
  computed: {
76
+ hasLabel() {
77
+ return this.label != null || this.$slots.label != null;
78
+ },
79
+
74
80
  setInputClasses() {
75
81
  return {
76
82
  'is-invalid': this.isInvalid,
@@ -72,6 +72,13 @@
72
72
  @change="onPageSizeChanged"
73
73
  />
74
74
  </div>
75
+ <div
76
+ v-if="pagingOptions.displayTotal"
77
+ class="mc-data-table__footer__display-total-item"
78
+ >
79
+ <span class="strong">{{ getTotalStringCurrentCount }}</span> /
80
+ <span class="strong">{{ total }}</span>
81
+ </div>
75
82
  <div class="mc-data-table__footer__pagination">
76
83
  <m-pagination
77
84
  :disabled="loading"
@@ -327,6 +334,18 @@ export default {
327
334
  ? this.pagingOptions.index
328
335
  : this.getPagingSize;
329
336
  },
337
+
338
+ getTotalStringCurrentCount() {
339
+ const { skip, take } = buildOptions(
340
+ this.pagingOptions.enabled,
341
+ this.getPageValue,
342
+ this.getPagingIndex,
343
+ this.getPagingSize,
344
+ this.getSortHeader
345
+ );
346
+ const on = skip + take;
347
+ return `${skip + 1} - ${on >= this.total ? this.total : on}`;
348
+ },
330
349
  },
331
350
 
332
351
  watch: {
@@ -672,6 +691,16 @@ $local-config: (
672
691
  }
673
692
  }
674
693
 
694
+ &__display-total-item {
695
+ width: auto;
696
+ min-width: 150px;
697
+ padding: 0.5rem 2.25rem;
698
+ font-size: 0.875rem;
699
+ .strong {
700
+ font-weight: bold;
701
+ }
702
+ }
703
+
675
704
  &__pagination {
676
705
  text-align: right;
677
706
  width: 100%;
@@ -23,7 +23,7 @@ export { MPagination } from './pagination';
23
23
  export { MPhoneNumber } from './phonenumber';
24
24
  export { MProgress } from './progressbar';
25
25
  export { MQuantitySelector } from './quantityselector';
26
- export { MRadio } from './radio';
26
+ export { MRadio, MRadioGroup } from './radio';
27
27
  export { MStarsInput, MStarsResult } from './ratingstars';
28
28
  export { MSelect } from './select';
29
29
  export { MStepper } from './stepper';
@@ -5,7 +5,7 @@
5
5
  class="mc-modal"
6
6
  tabindex="-1"
7
7
  role="dialog"
8
- aria-labelledby="modalTitle"
8
+ aria-labelledby="modal_title"
9
9
  :aria-hidden="!open"
10
10
  >
11
11
  <div
@@ -16,7 +16,7 @@
16
16
  <header class="mc-modal__header">
17
17
  <component
18
18
  :is="modalTitleTag"
19
- id="modalTitle"
19
+ id="modal_title"
20
20
  class="mc-modal__title"
21
21
  >
22
22
  {{ modalTitle }}
@@ -0,0 +1,108 @@
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
+ class="mc-field__item"
27
+ :checked="value === option.value"
28
+ @change="(v) => (v ? $emit('input', option.value) : null)"
29
+ />
30
+ </div>
31
+ <span v-if="isInvalid" :id="errorId" class="mc-field__error-message">
32
+ {{ errorMessage }}
33
+ </span>
34
+ </fieldset>
35
+ </template>
36
+
37
+ <script>
38
+ import MRadio from './MRadio.vue';
39
+
40
+ export default {
41
+ name: 'MRadioGroup',
42
+
43
+ components: {
44
+ MRadio,
45
+ },
46
+
47
+ props: {
48
+ legend: {
49
+ type: String,
50
+ required: true,
51
+ },
52
+ requirementText: {
53
+ type: String,
54
+ default: null,
55
+ },
56
+ helpId: {
57
+ type: String,
58
+ default: null,
59
+ },
60
+ helpText: {
61
+ type: String,
62
+ default: null,
63
+ },
64
+ errorId: {
65
+ type: String,
66
+ default: null,
67
+ },
68
+ errorMessage: {
69
+ type: String,
70
+ default: null,
71
+ },
72
+ isInvalid: {
73
+ type: Boolean,
74
+ default: false,
75
+ },
76
+ inline: {
77
+ type: Boolean,
78
+ default: false,
79
+ },
80
+ value: {
81
+ type: String,
82
+ default: null,
83
+ },
84
+ options: {
85
+ type: Array,
86
+ default() {
87
+ return [];
88
+ },
89
+ validator(options) {
90
+ return options.every(
91
+ (o) =>
92
+ 'id' in o &&
93
+ typeof o.id == 'string' &&
94
+ 'label' in o &&
95
+ typeof o.label == 'string' &&
96
+ 'value' in o &&
97
+ typeof o.value == 'string'
98
+ );
99
+ },
100
+ },
101
+ },
102
+ };
103
+ </script>
104
+
105
+ <style lang="scss">
106
+ @import 'settings-tools/_all-settings';
107
+ @import 'components/_c.fields';
108
+ </style>
@@ -1,7 +1,12 @@
1
1
  import MRadio from './MRadio.vue';
2
+ import MRadioGroup from './MRadioGroup.vue';
2
3
 
3
4
  MRadio.install = function (Vue) {
4
5
  Vue.component(MRadio.name, MRadio);
5
6
  };
6
7
 
7
- export { MRadio };
8
+ MRadioGroup.install = function (Vue) {
9
+ Vue.component(MRadioGroup.name, MRadioGroup);
10
+ };
11
+
12
+ export { MRadio, MRadioGroup };
package/src/index.js CHANGED
@@ -42,7 +42,7 @@ export { MPagination } from './components/pagination';
42
42
  export { MPhoneNumber } from './components/phonenumber';
43
43
  export { MProgress } from './components/progressbar';
44
44
  export { MQuantitySelector } from './components/quantityselector';
45
- export { MRadio } from './components/radio';
45
+ export { MRadio, MRadioGroup } from './components/radio';
46
46
  export { MStarsInput, MStarsResult } from './components/ratingstars';
47
47
  export { MSelect } from './components/select';
48
48
  export { MStepper } from './components/stepper';