@carbon/vue 1.0.0 → 1.1.1

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 (59) hide show
  1. package/CHANGELOG.md +192 -0
  2. package/README.md +9 -156
  3. package/dist/carbon-data-viz-vue.common.js +6 -6
  4. package/dist/carbon-data-viz-vue.common.js.map +1 -1
  5. package/dist/carbon-data-viz-vue.css +1 -1
  6. package/dist/carbon-data-viz-vue.umd.js +6 -6
  7. package/dist/carbon-data-viz-vue.umd.js.map +1 -1
  8. package/dist/carbon-data-viz-vue.umd.min.js.map +1 -1
  9. package/dist/carbon-vue.common.js +8807 -4866
  10. package/dist/carbon-vue.common.js.map +1 -1
  11. package/dist/carbon-vue.umd.js +8807 -4866
  12. package/dist/carbon-vue.umd.js.map +1 -1
  13. package/dist/carbon-vue.umd.min.js +4 -4
  14. package/dist/carbon-vue.umd.min.js.map +1 -1
  15. package/dist/demo.html +2 -2
  16. package/package.json +21 -8
  17. package/src/_internal/_feature-flags.js +42 -0
  18. package/src/components/cv-accordion/_cv-accordion-item-skeleton.vue +10 -0
  19. package/src/components/cv-accordion/cv-accordion-item.vue +6 -0
  20. package/src/components/cv-button/cv-button.vue +32 -3
  21. package/src/components/cv-checkbox/_cv-checkbox-inner-form-item.vue +1 -1
  22. package/src/components/cv-checkbox/_cv-checkbox-inner.vue +1 -0
  23. package/src/components/cv-checkbox/cv-checkbox-skeleton.vue +13 -0
  24. package/src/components/cv-code-snippet/_cv-code-snippet-multiline.vue +10 -0
  25. package/src/components/cv-code-snippet/_cv-code-snippet-oneline.vue +10 -0
  26. package/src/components/cv-code-snippet/cv-code-snippet-skeleton.vue +29 -0
  27. package/src/components/cv-code-snippet/cv-code-snippet.vue +1 -1
  28. package/src/components/cv-content-switcher/cv-content-switcher-button.vue +28 -1
  29. package/src/components/cv-content-switcher/cv-content-switcher.vue +1 -1
  30. package/src/components/cv-data-table/cv-data-table.vue +54 -18
  31. package/src/components/cv-date-picker/_cv-date-picker-inner-c10.vue +220 -0
  32. package/src/components/cv-date-picker/_cv-date-picker-inner.vue +231 -0
  33. package/src/components/cv-date-picker/cv-date-picker.vue +17 -216
  34. package/src/components/cv-dropdown/_cv-dropdown-inner-c10.vue +201 -0
  35. package/src/components/cv-dropdown/_cv-dropdown-inner-form-item.vue +22 -0
  36. package/src/components/cv-dropdown/_cv-dropdown-inner.vue +213 -0
  37. package/src/components/cv-dropdown/cv-dropdown-item.vue +4 -0
  38. package/src/components/cv-dropdown/cv-dropdown-skeleton.vue +18 -0
  39. package/src/components/cv-dropdown/cv-dropdown.vue +20 -167
  40. package/src/components/cv-file-uploader/cv-file-uploader-skeleton.vue +22 -0
  41. package/src/components/cv-file-uploader/cv-file-uploader.vue +48 -8
  42. package/src/components/cv-inline-loader/cv-inline-loader.vue +42 -0
  43. package/src/components/cv-inline-notification/cv-inline-notification.vue +25 -7
  44. package/src/components/cv-loading/cv-loading.vue +18 -1
  45. package/src/components/cv-modal/cv-modal.vue +17 -6
  46. package/src/components/cv-number-input/cv-number-input.vue +9 -2
  47. package/src/components/cv-overflow-menu/cv-overflow-menu.vue +17 -15
  48. package/src/components/cv-pagination/cv-pagination.vue +2 -2
  49. package/src/components/cv-radio-button/cv-radio-button.vue +1 -0
  50. package/src/components/cv-slider/cv-slider.vue +6 -6
  51. package/src/components/cv-structured-list/_cv-structured-list-item-selectable.vue +1 -0
  52. package/src/components/cv-tabs/cv-tabs.vue +22 -11
  53. package/src/components/cv-text-input/cv-text-input.vue +70 -0
  54. package/src/components/cv-toast-notification/cv-toast-notification.vue +35 -0
  55. package/src/components/cv-tooltip/cv-interactive-tooltip.vue +4 -4
  56. package/src/data-viz/cv-bar-graph/cv-bar-graph.vue +7 -4
  57. package/src/data-viz/cv-gauge/cv-gauge.vue +1 -1
  58. package/src/data-viz/cv-pie-chart/cv-pie-chart.vue +8 -7
  59. package/src/components/cv-data-table/_cv-data-table-temp.vue +0 -669
@@ -1,13 +1,18 @@
1
1
  <template>
2
2
  <cv-form-item class="cv-file-uploader">
3
- <strong class="bx--label">{{ label }}</strong>
3
+ <strong :class="componentsX ? 'bx--label' : 'bx--file--label'">
4
+ {{ label }}
5
+ </strong>
4
6
  <p class="bx--label-description">{{ helperText }}</p>
5
7
  <div class="bx--file" data-file>
6
8
  <label
7
9
  :for="uid"
8
- class="bx--file-btn bx--btn bx--btn--secondary"
10
+ class="bx--file--btn bx--btn bx--btn--primary bx--btn--sm"
9
11
  role="button"
10
12
  tabindex="0"
13
+ @keydown.enter.prevent="onShow()"
14
+ @keydown.space.prevent
15
+ @keyup.space.prevent="onShow()"
11
16
  >{{ buttonLabel }}</label
12
17
  >
13
18
  <input
@@ -18,6 +23,8 @@
18
23
  data-file-uploader
19
24
  data-target="[data-file-container]"
20
25
  v-on="inputListeners"
26
+ ref="file-input"
27
+ tabindex="-1"
21
28
  />
22
29
  <div data-file-container class="bx--file-container">
23
30
  <div
@@ -32,10 +39,18 @@
32
39
  :data-for="uid"
33
40
  class="bx--file__state-container"
34
41
  :data-test="file.state"
35
- wibble="banana"
36
42
  >
43
+ <cv-inline-loader
44
+ v-if="
45
+ componentsX &&
46
+ (file.state === 'uploading' || file.state === 'complete')
47
+ "
48
+ :active="file.state === 'uploading'"
49
+ loading-text
50
+ loaded-text
51
+ />
37
52
  <div
38
- v-if="file.state === 'uploading'"
53
+ v-if="!componentsX && file.state === 'uploading'"
39
54
  class="bx--loading"
40
55
  tabindex="0"
41
56
  style="width: 1rem; height: 1rem;"
@@ -45,7 +60,7 @@
45
60
  </svg>
46
61
  </div>
47
62
  <svg
48
- v-if="file.state === 'complete'"
63
+ v-if="!componentsX && file.state === 'complete'"
49
64
  class="bx--file-complete"
50
65
  fill-rule="evenodd"
51
66
  height="16"
@@ -61,13 +76,32 @@
61
76
  ></path>
62
77
  </svg>
63
78
  <svg
64
- v-if="removable"
79
+ v-if="componentsX && removable"
65
80
  class="bx--file-close"
66
- fill-rule="evenodd"
67
81
  role="button"
82
+ width="16"
83
+ height="16"
84
+ viewBox="0 0 16 16"
85
+ tabindex="0"
86
+ alt="Remove file"
87
+ arial-label="Remove file"
88
+ @click="remove(index)"
89
+ @keydown.enter.prevent="remove(index)"
90
+ @keydown.space.prevent
91
+ @keyup.space.prevent="remove(index)"
92
+ >
93
+ <path
94
+ d="M12 4.7l-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8z"
95
+ ></path>
96
+ </svg>
97
+ <svg
98
+ v-if="!componentsX && removable"
99
+ class="bx--file-close"
100
+ fill-rule="evenodd"
68
101
  height="16"
69
102
  width="16"
70
103
  viewBox="0 0 16 16"
104
+ role="button"
71
105
  tabindex="0"
72
106
  alt="Remove file"
73
107
  arial-label="Remove file"
@@ -92,6 +126,8 @@
92
126
  <script>
93
127
  import uidMixin from '../../mixins/uid-mixin';
94
128
  import CvFormItem from '../cv-form/cv-form-item';
129
+ import { componentsX } from '../../_internal/_feature-flags';
130
+ import CvInlineLoader from '../cv-inline-loader/cv-inline-loader';
95
131
 
96
132
  const CONSTS = {
97
133
  STATES: {
@@ -103,7 +139,7 @@ const CONSTS = {
103
139
 
104
140
  export default {
105
141
  name: 'CvFileUploader',
106
- components: { CvFormItem },
142
+ components: { CvFormItem, CvInlineLoader },
107
143
  mixins: [uidMixin],
108
144
  inheritAttrs: false,
109
145
  props: {
@@ -124,6 +160,7 @@ export default {
124
160
  },
125
161
  data() {
126
162
  return {
163
+ componentsX,
127
164
  internalFiles: [],
128
165
  };
129
166
  },
@@ -165,6 +202,9 @@ export default {
165
202
  }
166
203
  this.$emit('change', this.internalFiles);
167
204
  },
205
+ onShow() {
206
+ this.$refs['file-input'].click();
207
+ },
168
208
  },
169
209
  };
170
210
  </script>
@@ -0,0 +1,42 @@
1
+ <template>
2
+ <div
3
+ data-inline-loading
4
+ class="bx--inline-loading"
5
+ role="alert"
6
+ aria-live="assertive"
7
+ >
8
+ <div class="bx--inline-loading__animation">
9
+ <cv-loading :hidden="!active" small />
10
+ <svg
11
+ :hidden="active"
12
+ data-inline-loading-finished
13
+ class="bx--inline-loading__checkmark-container bx--inline-loading__svg"
14
+ xmlns="http://www.w3.org/2000/svg"
15
+ viewBox="0 0 10 10"
16
+ >
17
+ <polyline
18
+ class="bx--inline-loading__checkmark"
19
+ points="0.74 3.4 3.67 6.34 9.24 0.74"
20
+ ></polyline>
21
+ </svg>
22
+ </div>
23
+ <p
24
+ data-inline-loading-text-active="active"
25
+ data-inline-loading-text-finished="!active"
26
+ class="bx--inline-loading__text"
27
+ >
28
+ {{ active ? loadingText : loadedText }}
29
+ </p>
30
+ </div>
31
+ </template>
32
+
33
+ <script>
34
+ export default {
35
+ name: 'CvInlineLoader',
36
+ props: {
37
+ active: Boolean,
38
+ loadingText: { type: String, default: 'Loading data...' },
39
+ loadedText: { type: String, default: 'Data loaded.' },
40
+ },
41
+ };
42
+ </script>
@@ -1,14 +1,20 @@
1
1
  <template>
2
2
  <div
3
- data-inline-notification
3
+ data-notification
4
4
  class="cv-inline-notification bx--inline-notification"
5
5
  :class="`bx--inline-notification--${kind.toLowerCase()}`"
6
6
  v-on="$listeners"
7
- :aria-role="isAlert ? 'alert' : false"
7
+ :role="isAlert ? 'alert' : false"
8
8
  :aria-live="!isAlert ? 'polite' : false"
9
9
  >
10
10
  <div class="bx--inline-notification__details">
11
+ <component
12
+ v-if="componentsX"
13
+ :is="icon"
14
+ class="bx--inline-notification__icon"
15
+ />
11
16
  <cv-icon
17
+ v-else
12
18
  :href="`cv(${icon})`"
13
19
  class="bx--inline-notification__icon"
14
20
  width="16"
@@ -25,7 +31,9 @@
25
31
  class="bx--inline-notification__close-button"
26
32
  @click="$emit('close')"
27
33
  >
34
+ <Close16 v-if="componentsX" class="bx--inline-notification__close-icon" />
28
35
  <svg
36
+ v-else
29
37
  class="bx--inline-notification__close-icon"
30
38
  aria-label="close"
31
39
  width="10"
@@ -45,10 +53,20 @@
45
53
  <script>
46
54
  import notificationMixin from '../../mixins/notification-mixin';
47
55
  import CvIcon from '../cv-icon/_cv-icon';
56
+ import { componentsX } from '../../_internal/_feature-flags';
57
+ import ErrorFilled16 from '@carbon/icons-vue/lib/error--filled/16';
58
+ import CheckmarkFilled16 from '@carbon/icons-vue/lib/checkmark--filled/16';
59
+ import WarningAltFilled16 from '@carbon/icons-vue/lib/warning--filled/16';
60
+ import Close16 from '@carbon/icons-vue/lib/close/16';
48
61
 
49
62
  export default {
50
63
  name: 'CvInlineNotification',
51
- components: { CvIcon },
64
+ components: { CvIcon, Close16 },
65
+ data() {
66
+ return {
67
+ componentsX,
68
+ };
69
+ },
52
70
  mixins: [notificationMixin],
53
71
  props: {
54
72
  kind: {
@@ -61,13 +79,13 @@ export default {
61
79
  icon() {
62
80
  switch (this.kind) {
63
81
  case 'error':
64
- return 'icon--error--solid';
82
+ return componentsX ? ErrorFilled16 : 'icon--error--solid';
65
83
  case 'warning':
66
- return 'icon--warning--solid';
84
+ return componentsX ? WarningAltFilled16 : 'icon--warning--solid';
67
85
  case 'success':
68
- return 'icon--checkmark--solid';
86
+ return componentsX ? CheckmarkFilled16 : 'icon--checkmark--solid';
69
87
  default:
70
- return 'icon--info--solid';
88
+ return componentsX ? null : 'icon--info--solid';
71
89
  }
72
90
  },
73
91
  },
@@ -11,13 +11,29 @@
11
11
  >
12
12
  <svg class="bx--loading__svg" viewBox="-75 -75 150 150">
13
13
  <title>Loading</title>
14
- <circle cx="0" cy="0" r="37.5"></circle>
14
+ <circle
15
+ v-if="componentsX && small"
16
+ class="bx--loading__background"
17
+ cx="0"
18
+ cy="0"
19
+ r="37.5"
20
+ ></circle>
21
+ <circle
22
+ :class="{
23
+ 'bx--loading__stroke': componentsX,
24
+ }"
25
+ cx="0"
26
+ cy="0"
27
+ r="37.5"
28
+ ></circle>
15
29
  </svg>
16
30
  </div>
17
31
  </div>
18
32
  </template>
19
33
 
20
34
  <script>
35
+ import { componentsX } from '../../_internal/_feature-flags';
36
+
21
37
  export default {
22
38
  name: 'CvLoading',
23
39
  props: {
@@ -36,6 +52,7 @@ export default {
36
52
  },
37
53
  data() {
38
54
  return {
55
+ componentsX,
39
56
  stopped: false,
40
57
  };
41
58
  },
@@ -16,7 +16,7 @@
16
16
  class="cv-modal__before-content"
17
17
  ref="beforeContent"
18
18
  tabindex="0"
19
- style="position: absolute; height: 1px; width: 1px; left: -9999px"
19
+ style="position: absolute; height: 1px; width: 1px; left: -9999px;"
20
20
  @focus="focusBeforeContent"
21
21
  />
22
22
  <div class="bx--modal-header">
@@ -27,7 +27,9 @@
27
27
  <slot name="title">Modal Title</slot>
28
28
  </h2>
29
29
  <button class="bx--modal-close" type="button" @click="hide" ref="close">
30
+ <Close16 v-if="componentsX" class="bx--modal-close__icon" />
30
31
  <cv-icon
32
+ v-else
31
33
  class="bx--modal-close__icon"
32
34
  href="cv(icon--close)"
33
35
  height="10px"
@@ -36,7 +38,7 @@
36
38
  </button>
37
39
  </div>
38
40
 
39
- <div class="bx--modal-content">
41
+ <div class="bx--modal-content" ref="content">
40
42
  <slot name="content">
41
43
  <p>
42
44
  Passive modal notifications should only appear if there is an action
@@ -70,7 +72,7 @@
70
72
  class="cv-modal__after-content"
71
73
  ref="afterContent"
72
74
  tabindex="0"
73
- style="position: absolute; height: 1px; width: 1px; left: -9999px"
75
+ style="position: absolute; height: 1px; width: 1px; left: -9999px;"
74
76
  @focus="focusAfterContent"
75
77
  />
76
78
  </div>
@@ -81,6 +83,8 @@
81
83
  import CvButton from '../cv-button/cv-button';
82
84
  import CvIcon from '../cv-icon/_cv-icon';
83
85
  import uidMixin from '../../mixins/uid-mixin';
86
+ import Close16 from '@carbon/icons-vue/lib/close//16';
87
+ import { componentsX } from '../../_internal/_feature-flags';
84
88
 
85
89
  export default {
86
90
  name: 'CvModal',
@@ -88,6 +92,7 @@ export default {
88
92
  components: {
89
93
  CvButton,
90
94
  CvIcon,
95
+ Close16,
91
96
  },
92
97
  props: {
93
98
  kind: {
@@ -99,6 +104,7 @@ export default {
99
104
  },
100
105
  data() {
101
106
  return {
107
+ componentsX,
102
108
  dataVisible: false,
103
109
  };
104
110
  },
@@ -119,14 +125,14 @@ export default {
119
125
  computed: {
120
126
  primaryKind() {
121
127
  if (this.kind === 'danger') {
122
- return 'danger--primary';
128
+ return componentsX ? 'danger' : 'danger--primary';
123
129
  } else {
124
130
  return 'primary';
125
131
  }
126
132
  },
127
133
  secondaryKind() {
128
134
  if (this.kind === 'danger') {
129
- return 'tertiary';
135
+ return componentsX ? 'secondary' : 'tertiary';
130
136
  } else {
131
137
  return 'secondary';
132
138
  }
@@ -149,7 +155,12 @@ export default {
149
155
  this.$refs.close.focus();
150
156
  },
151
157
  onShown() {
152
- if (this.$slots['primary-button']) {
158
+ const focusEl = this.$refs.content.querySelector(
159
+ '[data-modal-primary-focus]'
160
+ );
161
+ if (focusEl) {
162
+ focusEl.focus();
163
+ } else if (this.$slots['primary-button']) {
153
164
  this.$refs.primary.$el.focus();
154
165
  } else if (this.$slots['secondary-button']) {
155
166
  this.$refs.secondary.$el.focus();
@@ -15,7 +15,8 @@
15
15
  @click="doUp"
16
16
  type="button"
17
17
  >
18
- <svg width="10" height="5" viewBox="0 0 10 5">
18
+ <CaretUpGlyph v-if="componentsX" />
19
+ <svg v-else width="10" height="5" viewBox="0 0 10 5">
19
20
  <path d="M0 5L5 .002 10 5z" fill-rule="evenodd"></path>
20
21
  </svg>
21
22
  </button>
@@ -24,7 +25,8 @@
24
25
  @click="doDown"
25
26
  type="button"
26
27
  >
27
- <svg width="10" height="5" viewBox="0 0 10 5">
28
+ <CaretDownGlyph v-if="componentsX" />
29
+ <svg v-else width="10" height="5" viewBox="0 0 10 5">
28
30
  <path d="M0 0l5 4.998L10 0z" fill-rule="evenodd"></path>
29
31
  </svg>
30
32
  </button>
@@ -50,10 +52,14 @@
50
52
  <script>
51
53
  import uidMixin from '../../mixins/uid-mixin';
52
54
  import themeMixin from '../../mixins/theme-mixin';
55
+ import { componentsX } from '../../_internal/_feature-flags';
56
+ import CaretDownGlyph from '@carbon/icons-vue/lib/caret--down/index';
57
+ import CaretUpGlyph from '@carbon/icons-vue/lib/caret--up/index';
53
58
 
54
59
  export default {
55
60
  name: 'CvNumberInput',
56
61
  mixins: [uidMixin, themeMixin],
62
+ components: { CaretDownGlyph, CaretUpGlyph },
57
63
  inheritAttrs: false,
58
64
  props: {
59
65
  helperText: { type: String, default: null },
@@ -75,6 +81,7 @@ export default {
75
81
  },
76
82
  data() {
77
83
  return {
84
+ componentsX,
78
85
  internalValue: this.value,
79
86
  };
80
87
  },
@@ -43,7 +43,7 @@
43
43
  class="cv-overflow-menu__before-content"
44
44
  ref="beforeContent"
45
45
  tabindex="0"
46
- style="position: absolute; height: 1px; width: 1px; left: -9999px"
46
+ style="position: absolute; height: 1px; width: 1px; left: -9999px;"
47
47
  @focus="focusBeforeContent"
48
48
  />
49
49
  <slot></slot>
@@ -51,7 +51,7 @@
51
51
  class="cv-overflow-menu__after-content"
52
52
  ref="afterContent"
53
53
  tabindex="0"
54
- style="position: absolute; height: 1px; width: 1px; left: -9999px"
54
+ style="position: absolute; height: 1px; width: 1px; left: -9999px;"
55
55
  @focus="focusAfterContent"
56
56
  />
57
57
  </ul>
@@ -110,18 +110,18 @@ export default {
110
110
  ) {
111
111
  this.open = false;
112
112
  this.positionListen(false);
113
- setTimeout(() => {
113
+ this.$nextTick(() => {
114
114
  this.doFocus();
115
- }, 1);
115
+ });
116
116
  }
117
117
  }
118
118
  },
119
119
  menuItemclick() {
120
120
  this.open = false;
121
121
  this.positionListen(false);
122
- setTimeout(() => {
122
+ this.$nextTick(() => {
123
123
  this.doFocus();
124
- }, 1);
124
+ });
125
125
  },
126
126
  doClose() {
127
127
  this.open = false;
@@ -136,10 +136,10 @@ export default {
136
136
  window.removeEventListener('resize', this.positionMenu);
137
137
  }
138
138
  },
139
- positionMenu() {
139
+ async positionMenu() {
140
140
  if (this.open) {
141
141
  const menuPosition = this.$el.getBoundingClientRect();
142
- setTimeout(() => {
142
+ return this.$nextTick(() => {
143
143
  if (this.flipMenu) {
144
144
  this.left =
145
145
  menuPosition.left +
@@ -155,7 +155,7 @@ export default {
155
155
  this.top =
156
156
  menuPosition.bottom + 2 + this.offsetTop + window.scrollY;
157
157
  }
158
- }, 1);
158
+ });
159
159
  }
160
160
  },
161
161
  doFocus() {
@@ -184,16 +184,18 @@ export default {
184
184
  } else {
185
185
  focusOn = this.$el;
186
186
  }
187
- setTimeout(() => {
188
- focusOn.focus();
189
- }, 1);
187
+ focusOn.focus();
190
188
  },
191
- doToggle() {
189
+ async doToggle() {
192
190
  this.open = !this.open;
193
191
 
194
- this.positionMenu();
192
+ // await positionMenu otherwise it can race doFocus.
193
+ // On initial open the menu is positioned 0,0 causing a jump
194
+ await this.positionMenu();
195
195
  this.positionListen(this.open);
196
- this.doFocus();
196
+ this.$nextTick(() => {
197
+ this.doFocus();
198
+ });
197
199
  },
198
200
  onOverflowMenuTab(ev) {
199
201
  if (!ev.shiftKey) {
@@ -217,13 +217,13 @@ export default {
217
217
  this.pageCount = newPageCount(this.numberOfItems, this.pageSizeValue);
218
218
  this.pages = newPagesArray(this.pageCount);
219
219
  // what page is firstItem on
220
- setTimeout(() => {
220
+ this.$nextTick(() => {
221
221
  // setting pageValue immediately seems to cause a problem - test set pageSize to 40, page to 3, set pageSize to 10
222
222
  // this previously resulted in 1 being set on Chrome (other browsers untested)
223
223
  this.pageValue = Math.ceil(this.firstItem / this.pageSizeValue);
224
224
  this.firstItem = newFirstItem(this.pageValue, this.pageSizeValue);
225
225
  this.$emit('change', this.internalValue);
226
- }, 1);
226
+ });
227
227
  },
228
228
  onPrevPage() {
229
229
  if (this.pageValue > 1) {
@@ -24,6 +24,7 @@ import radioMixin from '../../mixins/radio-mixin';
24
24
 
25
25
  export default {
26
26
  name: 'CvRadioButton',
27
+ inheritAttrs: false,
27
28
  mixins: [uidMixin, radioMixin],
28
29
  };
29
30
  </script>
@@ -123,20 +123,20 @@ export default {
123
123
  this.setValue(val);
124
124
  },
125
125
  min() {
126
- setTimeout(() => {
126
+ this.$nextTick(() => {
127
127
  this.setValue(this.internalValue);
128
- }, 1);
128
+ });
129
129
  // this.internalMin = val && val.length ? val : '0';
130
130
  },
131
131
  max() {
132
- setTimeout(() => {
132
+ this.$nextTick(() => {
133
133
  this.setValue(this.internalValue);
134
- }, 1);
134
+ });
135
135
  },
136
136
  step() {
137
- setTimeout(() => {
137
+ this.$nextTick(() => {
138
138
  this.setValue(this.internalValue);
139
- }, 1);
139
+ });
140
140
  },
141
141
  },
142
142
  methods: {
@@ -39,6 +39,7 @@ import radioMixin from '../../mixins/radio-mixin';
39
39
 
40
40
  export default {
41
41
  name: 'CvStructuredListItemSelectable',
42
+ inheritAttrs: false,
42
43
  mixins: [uidMixin, radioMixin],
43
44
  };
44
45
  </script>
@@ -8,16 +8,18 @@
8
8
  @keydown.right.prevent="moveRight"
9
9
  @keydown.left.prevent="moveLeft"
10
10
  >
11
- <div class="bx--tabs-trigger" tabindex="0">
12
- <a
13
- href="javascript:void(0)"
14
- class="bx--tabs-trigger-text"
15
- tabindex="-1"
16
- ></a>
17
- <svg width="10" height="5" viewBox="0 0 10 5">
18
- <path d="M0 0l5 4.998L10 0z" fill-rule="evenodd"></path>
19
- </svg>
20
- </div>
11
+ <cv-dropdown
12
+ class="bx--tabs-trigger"
13
+ :value="`${selectedIndex}`"
14
+ @change="onDropChange"
15
+ >
16
+ <cv-dropdown-item
17
+ v-for="(tab, index) in tabs"
18
+ :key="`drop-${index}`"
19
+ :value="`${index}`"
20
+ >{{ tab.label }}</cv-dropdown-item
21
+ >
22
+ </cv-dropdown>
21
23
  <ul class="bx--tabs__nav bx--tabs__nav--hidden" role="tablist">
22
24
  <li
23
25
  v-for="(tab, index) in tabs"
@@ -42,13 +44,19 @@
42
44
  </li>
43
45
  </ul>
44
46
  </nav>
45
- <div class="cv-tabs__panels"><slot></slot></div>
47
+ <div class="cv-tabs__panels">
48
+ <slot></slot>
49
+ </div>
46
50
  </div>
47
51
  </template>
48
52
 
49
53
  <script>
54
+ import CvDropdown from '../cv-dropdown/cv-dropdown';
55
+ import CvDropdownItem from '../cv-dropdown/cv-dropdown-item';
56
+
50
57
  export default {
51
58
  name: 'CvTabs',
59
+ components: { CvDropdown, CvDropdownItem },
52
60
  data() {
53
61
  return {
54
62
  tabs: [],
@@ -64,6 +72,9 @@ export default {
64
72
  this.$on('cv:selected', srcComponent => this.onCvSelected(srcComponent));
65
73
  },
66
74
  methods: {
75
+ onDropChange(val) {
76
+ this.onTabClick(parseInt(val));
77
+ },
67
78
  onCvMount(srcComponent) {
68
79
  this.tabs.push(srcComponent);
69
80
  this.checkSelected();