@carbon/vue 2.26.0 → 2.27.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,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/vue",
3
3
  "description": "A collection of components for the Carbon Design System built using Vue.js",
4
- "version": "2.26.0",
4
+ "version": "2.27.0",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -73,5 +73,5 @@
73
73
  "eslint-plugin-prettier": "^3.1.1",
74
74
  "vue-template-compiler": "^2.6.10"
75
75
  },
76
- "gitHead": "5bcf4d93005e113e5501524d339f0907f57f1758"
76
+ "gitHead": "48ffc15e8d83bb013b01139b1d88d4b542895796"
77
77
  }
@@ -12,7 +12,7 @@
12
12
  </template>
13
13
 
14
14
  <script>
15
- import CvFeedbackButton from './_cv-feedback-button';
15
+ import CvFeedbackButton from '../cv-feedback-button/_cv-feedback-button';
16
16
  import themeMixin from '../../mixins/theme-mixin';
17
17
 
18
18
  export default {
@@ -21,7 +21,7 @@
21
21
  </template>
22
22
 
23
23
  <script>
24
- import CvFeedbackButton from './_cv-feedback-button';
24
+ import CvFeedbackButton from '../cv-feedback-button/_cv-feedback-button';
25
25
  import CvButton from '../cv-button/cv-button';
26
26
 
27
27
  import Copy16 from '@carbon/icons-vue/es/copy/16';
@@ -12,7 +12,7 @@
12
12
  </template>
13
13
 
14
14
  <script>
15
- import CvFeedbackButton from './_cv-feedback-button';
15
+ import CvFeedbackButton from '../cv-feedback-button/_cv-feedback-button';
16
16
 
17
17
  import Copy16 from '@carbon/icons-vue/es/copy/16';
18
18
 
@@ -1,10 +1,8 @@
1
1
  <template>
2
2
  <div class="cv-combo-box bx--list-box__wrapper" @focusout="onFocusOut">
3
- <label v-if="title" :for="uid" class="bx--label" :class="{ 'bx--label--disabled': $attrs.disabled }">
4
- {{ title }}
5
- </label>
3
+ <label v-if="title" :for="uid" class="bx--label" :class="{ 'bx--label--disabled': disabled }">{{ title }}</label>
6
4
 
7
- <div v-if="isHelper" class="bx--form__helper-text" :class="{ 'bx--form__helper-text--disabled': $attrs.disabled }">
5
+ <div v-if="isHelper" class="bx--form__helper-text" :class="{ 'bx--form__helper-text--disabled': disabled }">
8
6
  <slot name="helper-text">{{ helperText }}</slot>
9
7
  </div>
10
8
 
@@ -16,10 +14,10 @@
16
14
  'bx--list-box--light': theme === 'light',
17
15
  'bx--combo-box--expanded': open,
18
16
  'bx--list-box--expanded': open,
19
- 'bx--combo-box--disabled bx--list-box--disabled': $attrs.disabled,
17
+ 'bx--combo-box--disabled bx--list-box--disabled': disabled,
20
18
  }"
21
19
  :data-invalid="isInvalid"
22
- v-bind="$attrs"
20
+ v-bind="$attr"
23
21
  @keydown.down.prevent="onDown"
24
22
  @keydown.up.prevent="onUp"
25
23
  @keydown.enter.prevent="onEnter"
@@ -46,8 +44,10 @@
46
44
  :aria-controls="uid"
47
45
  aria-autocomplete="list"
48
46
  role="combobox"
47
+ :aria-disabled="disabled"
49
48
  :aria-expanded="open"
50
49
  autocomplete="off"
50
+ :disabled="disabled"
51
51
  :placeholder="label"
52
52
  v-model="filter"
53
53
  @input="onInput"
@@ -109,6 +109,7 @@ export default {
109
109
  props: {
110
110
  autoFilter: Boolean,
111
111
  autoHighlight: Boolean,
112
+ disabled: Boolean,
112
113
  invalidMessage: { type: String, default: undefined },
113
114
  helperText: { type: String, default: undefined },
114
115
  title: String,
@@ -209,6 +210,7 @@ export default {
209
210
  this.isHelper = !!(this.$slots['helper-text'] || (this.helperText && this.helperText.length));
210
211
  },
211
212
  clearFilter() {
213
+ if (this.disabled) return;
212
214
  this.internalUpdateValue('');
213
215
  this.filter = '';
214
216
  this.$refs.input.focus();
@@ -280,6 +282,7 @@ export default {
280
282
  }
281
283
  },
282
284
  onInput() {
285
+ if (this.disabled) return;
283
286
  this.doOpen(true);
284
287
 
285
288
  this.updateOptions();
@@ -289,6 +292,7 @@ export default {
289
292
  this.open = newVal;
290
293
  },
291
294
  onDown() {
295
+ if (this.disabled) return;
292
296
  if (!this.open) {
293
297
  this.doOpen(true);
294
298
  } else {
@@ -296,15 +300,18 @@ export default {
296
300
  }
297
301
  },
298
302
  onUp() {
303
+ if (this.disabled) return;
299
304
  if (this.open) {
300
305
  this.doMove(true);
301
306
  }
302
307
  },
303
308
  onEsc() {
309
+ if (this.disabled) return;
304
310
  this.doOpen(false);
305
311
  this.$el.focus();
306
312
  },
307
313
  onEnter() {
314
+ if (this.disabled) return;
308
315
  this.doOpen(!this.open);
309
316
  if (!this.open) {
310
317
  this.onItemClick(this.highlighted);
@@ -312,6 +319,7 @@ export default {
312
319
  }
313
320
  },
314
321
  onClick() {
322
+ if (this.disabled) return;
315
323
  this.doOpen(!this.open);
316
324
  if (this.open) {
317
325
  this.$refs.input.focus();
@@ -340,17 +348,20 @@ export default {
340
348
  }
341
349
  },
342
350
  onItemClick(val) {
351
+ if (this.disabled) return;
343
352
  this.internalUpdateValue(val);
344
353
  this.$refs.input.focus();
345
354
  this.open = false; // close after user makes a selection
346
355
  this.$emit('change', this.dataValue);
347
356
  },
348
357
  inputClick() {
358
+ if (this.disabled) return;
349
359
  if (!this.open) {
350
360
  this.doOpen(true);
351
361
  }
352
362
  },
353
363
  inputFocus() {
364
+ if (this.disabled) return;
354
365
  this.doOpen(true);
355
366
  },
356
367
  },
@@ -16,14 +16,15 @@
16
16
  v-model="dataChecked"
17
17
  @change="onChange"
18
18
  ref="rowChecked"
19
- :aria-label="ariaLabelForBatchCheckbox || `Select row ${value} for batch action`"
19
+ :label="ariaLabelForBatchCheckbox || `Select row ${value} for batch action`"
20
+ hideLabel
20
21
  />
21
22
  </td>
22
23
  <slot />
23
24
  <td v-if="hasOverflowMenu" class="bx--table-column-menu">
24
- <cv-overflow-menu flip-menu>
25
+ <cv-overflow-menu v-bind="overflowMenuOptions">
25
26
  <cv-overflow-menu-item
26
- v-for="(item, index) in overflowMenu"
27
+ v-for="(item, index) in overflowMenuButtons"
27
28
  :key="`${index}`"
28
29
  @click="
29
30
  onMenuItemClick({
@@ -96,6 +97,14 @@ export default {
96
97
  isChecked() {
97
98
  return this.dataChecked;
98
99
  },
100
+ overflowMenuButtons() {
101
+ return this.overflowMenu.filter(item => typeof item === 'string');
102
+ },
103
+ overflowMenuOptions() {
104
+ const incomingOptions = this.overflowMenu.find(item => typeof item === 'object') || {};
105
+ const defaultOptions = { flipMenu: true, label: 'Row overflow menu', tipPosition: 'left' };
106
+ return { ...defaultOptions, ...incomingOptions };
107
+ },
99
108
  },
100
109
  methods: {
101
110
  checkSlots() {
@@ -109,6 +109,8 @@
109
109
  value="headingCheck"
110
110
  v-model="headingChecked"
111
111
  @change="onHeadingCheckChange"
112
+ :label="selectAllAriaLabel"
113
+ hideLabel
112
114
  />
113
115
  </th>
114
116
  <slot name="headings">
@@ -140,7 +142,7 @@
140
142
  :key="`cell:${colIndex}:${rowIndex}`"
141
143
  :style="dataStyle(colIndex)"
142
144
  >
143
- <cv-wrapper :tag-type="skeleton && rowIndex < 1 ? 'span' : ''">{{ cell }}</cv-wrapper>
145
+ <cv-wrapper :tag-type="skeleton ? 'span' : ''">{{ cell }}</cv-wrapper>
144
146
  </cv-data-table-cell>
145
147
  </cv-data-table-row>
146
148
  </slot>
@@ -151,6 +153,7 @@
151
153
  v-if="pagination"
152
154
  v-bind="internalPagination"
153
155
  :number-of-items="internalNumberOfItems"
156
+ :actual-items-on-page="this.registeredRows.length"
154
157
  @change="$emit('pagination', $event)"
155
158
  >
156
159
  <template v-slot:range-text="{ scope }">
@@ -196,6 +199,7 @@ export default {
196
199
  actionBarAriaLabel: { type: String, default: 'Table Action Bar' },
197
200
  collapseAllAriaLabel: { type: String, default: 'Collapse all rows' },
198
201
  expandAllAriaLabel: { type: String, default: 'Expand all rows' },
202
+ selectAllAriaLabel: { type: String, default: 'Select all rows' },
199
203
  autoWidth: Boolean,
200
204
  batchCancelLabel: { type: String, default: 'cancel' },
201
205
  borderless: Boolean,
@@ -22,9 +22,9 @@
22
22
  :class="{ 'bx--dropdown__wrapper--inline': inline, 'cv-dropdown': !formItem }"
23
23
  :style="wrapperStyleOverride"
24
24
  >
25
- <span v-if="label" :id="`${uid}-label`" class="bx--label" :class="{ 'bx--label--disabled': disabled }">
26
- {{ label }}
27
- </span>
25
+ <span v-if="label" :id="`${uid}-label`" class="bx--label" :class="{ 'bx--label--disabled': disabled }">{{
26
+ label
27
+ }}</span>
28
28
 
29
29
  <div
30
30
  v-if="!inline && isHelper"
@@ -58,10 +58,12 @@
58
58
  >
59
59
  <button
60
60
  class="bx--dropdown-text"
61
+ :aria-disabled="disabled"
61
62
  aria-haspopup="true"
62
63
  :aria-expanded="open"
63
64
  :aria-controls="`${uid}-menu`"
64
- :aria-labelledby="`${uid}-label ${uid}-value`"
65
+ :aria-labelledby="ariaLabeledBy"
66
+ :disabled="disabled"
65
67
  type="button"
66
68
  >
67
69
  <WarningFilled16 v-if="isInvalid && inline" class="bx--dropdown__invalid-icon" />
@@ -161,6 +163,13 @@ export default {
161
163
  },
162
164
  },
163
165
  computed: {
166
+ ariaLabeledBy() {
167
+ if (this.label) {
168
+ return `${this.uid}-label ${this.uid}-value`;
169
+ } else {
170
+ return `${this.uid}-value`;
171
+ }
172
+ },
164
173
  internalCaption() {
165
174
  if (this.selectedChild) {
166
175
  return this.selectedChild.internalContent;
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <button
3
+ aria-label="ariaLabel"
3
4
  type="button"
4
5
  class="cv-feedback-button"
5
6
  v-bind="$attrs"
@@ -27,6 +28,7 @@ export default {
27
28
  name: 'cvFeedbackButton',
28
29
  inheritAttrs: false,
29
30
  props: {
31
+ ariaLabel: { type: String, default: 'Feedback button' },
30
32
  feedback: { type: String, required: true },
31
33
  inline: Boolean,
32
34
  timeout: { type: Number, default: 2000 },
@@ -131,6 +131,7 @@ export default {
131
131
  pageNumberLabel: { type: String, default: 'Page number:' },
132
132
  pageSizesLabel: { type: String, default: 'Items per page:' },
133
133
  numberOfItems: { type: Number, default: Infinity },
134
+ actualItemsOnPage: { type: Number, default: Infinity },
134
135
  page: Number,
135
136
  pageSizes: { type: Array, default: () => [10, 20, 30, 40, 50] },
136
137
  },
@@ -164,7 +165,9 @@ export default {
164
165
  this.pageValue = newPageValue(this.page, this.pageCount);
165
166
  this.firstItem = newFirstItem(this.pageValue, this.pageSizeValue);
166
167
  },
167
- pageSizes() {
168
+ pageSizes(a, b) {
169
+ if (!a.some(item => !b.includes(item))) return; // /possible issue when pageSizes defined in DOM
170
+
168
171
  this.pageSizeValue = newPageSizeValue(this.pageSizes);
169
172
  this.pageCount = newPageCount(this.numberOfItems, this.pageSizeValue);
170
173
  this.pages = newPagesArray(this.pageCount);
@@ -197,7 +200,10 @@ export default {
197
200
  rangeProps() {
198
201
  return {
199
202
  start: Math.min(this.firstItem, this.numberOfItems),
200
- end: Math.min(this.firstItem + parseInt(this.pageSizeValue, 10) - 1, this.numberOfItems),
203
+ end: Math.min(
204
+ this.firstItem + Math.min(parseInt(this.pageSizeValue, 10), this.actualItemsOnPage) - 1,
205
+ this.numberOfItems
206
+ ),
201
207
  items: this.numberOfItems,
202
208
  };
203
209
  },
@@ -16,7 +16,13 @@
16
16
  @keyup.space.prevent="$emit('remove')"
17
17
  >
18
18
  <span class="bx--tag__label">{{ label }}</span>
19
- <button v-if="isFilter" class="bx--tag__close-icon" :aria-label="clearAriaLabel" @click.stop.prevent="onRemove">
19
+ <button
20
+ v-if="isFilter"
21
+ class="bx--tag__close-icon"
22
+ :aria-label="clearAriaLabel"
23
+ @click.stop.prevent="onRemove"
24
+ :disabled="disabled"
25
+ >
20
26
  <Close16 />
21
27
  </button>
22
28
  </span>