@carbon/vue 2.27.1 → 2.28.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 (39) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/carbon-vue.common.js +332 -154
  3. package/dist/carbon-vue.common.js.map +1 -1
  4. package/dist/carbon-vue.umd.js +332 -154
  5. package/dist/carbon-vue.umd.js.map +1 -1
  6. package/dist/carbon-vue.umd.min.js +4 -4
  7. package/dist/carbon-vue.umd.min.js.map +1 -1
  8. package/package.json +2 -2
  9. package/src/assets/images/example-icon-svg.js +10 -0
  10. package/src/assets/images/example-icon.svg +6 -0
  11. package/src/components/cv-accordion/cv-accordion-item.vue +1 -1
  12. package/src/components/cv-breadcrumb/_cv-breadcrumb-item-skeleton.vue +4 -2
  13. package/src/components/cv-breadcrumb/cv-breadcrumb-item.vue +10 -5
  14. package/src/components/cv-breadcrumb/cv-breadcrumb-skeleton.vue +3 -1
  15. package/src/components/cv-breadcrumb/cv-breadcrumb.vue +12 -5
  16. package/src/components/cv-button/cv-button.vue +3 -4
  17. package/src/components/cv-button/cv-icon-button.vue +3 -4
  18. package/src/components/cv-checkbox/cv-checkbox-skeleton.vue +4 -2
  19. package/src/components/cv-checkbox/cv-checkbox.vue +32 -11
  20. package/src/components/cv-combo-box/cv-combo-box.vue +3 -3
  21. package/src/components/cv-content-switcher/cv-content-switcher-button.vue +4 -5
  22. package/src/components/cv-dropdown/cv-dropdown.vue +10 -4
  23. package/src/components/cv-form/cv-form.vue +1 -1
  24. package/src/components/cv-inline-loading/cv-inline-loading.vue +20 -14
  25. package/src/components/cv-link/cv-link.vue +12 -8
  26. package/src/components/cv-multi-select/cv-multi-select.vue +2 -2
  27. package/src/components/cv-number-input/cv-number-input-skeleton.vue +5 -3
  28. package/src/components/cv-number-input/cv-number-input.vue +32 -23
  29. package/src/components/cv-overflow-menu/cv-overflow-menu.vue +1 -1
  30. package/src/components/cv-svg/_cv-svg.vue +41 -0
  31. package/src/components/cv-tabs/cv-tab.vue +1 -1
  32. package/src/components/cv-tabs/cv-tabs.vue +1 -1
  33. package/src/components/cv-text-area/cv-text-area.vue +6 -0
  34. package/src/components/cv-text-input/cv-text-input.vue +5 -0
  35. package/src/components/cv-tooltip/cv-interactive-tooltip.vue +1 -1
  36. package/src/components/cv-ui-shell/cv-header-global-action.vue +1 -1
  37. package/src/components/cv-ui-shell/cv-header-menu-button.vue +1 -1
  38. package/src/components/cv-ui-shell/cv-header-panel.vue +1 -1
  39. package/src/components/cv-ui-shell/cv-side-nav.vue +1 -1
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.27.1",
4
+ "version": "2.28.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": "7a7cdf4e9694f1fda56404f36147f0a58551391a"
76
+ "gitHead": "e0141cdee45e0c910fbb10ac5c665b736712d99f"
77
77
  }
@@ -0,0 +1,10 @@
1
+ export default {
2
+ exampleSvgString: `
3
+ <?xml version="1.0" encoding="utf-8"?>
4
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" id="root">
5
+ <g fill-rule="evenodd" id="g">
6
+ <path id="path" d="M7 7H4v2h3v3h2V9h3V7H9V4H7v3zm1 9A8 8 0 1 1 8 0a8 8 0 0 1 0 16z"/>
7
+ </g>
8
+ </svg>
9
+ `,
10
+ };
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" id="root">
3
+ <g fill-rule="evenodd" id="g">
4
+ <path id="path" d="M7 7H4v2h3v3h2V9h3V7H9V4H7v3zm1 9A8 8 0 1 1 8 0a8 8 0 0 1 0 16z"/>
5
+ </g>
6
+ </svg>
@@ -10,7 +10,7 @@
10
10
  <button
11
11
  type="button"
12
12
  :class="`${carbonPrefix}--accordion__heading`"
13
- :aria-expanded="`${dataOpen}`"
13
+ :aria-expanded="dataOpen ? 'true' : 'false'"
14
14
  :aria-controls="uid"
15
15
  @click="toggle"
16
16
  >
@@ -1,11 +1,13 @@
1
1
  <template>
2
- <div class="bx--breadcrumb-item">
3
- <a class="bx--link">&nbsp;</a>
2
+ <div :class="`${carbonPrefix}--breadcrumb-item`">
3
+ <a :class="`${carbonPrefix}--link`">&nbsp;</a>
4
4
  </div>
5
5
  </template>
6
6
 
7
7
  <script>
8
+ import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
8
9
  export default {
9
10
  name: 'CvBreadcrumbItemSkeleton',
11
+ mixins: [carbonPrefixMixin],
10
12
  };
11
13
  </script>
@@ -1,16 +1,14 @@
1
1
  <template>
2
- <div
3
- class="cv-breadcrumb-item bx--breadcrumb-item"
4
- :class="{ 'bx--breadcrumb-item--current': activePage }"
5
- :aria-current="ariaCurrent"
6
- >
2
+ <div :class="breadcrumbItemClasses" :aria-current="ariaCurrent">
7
3
  <slot></slot>
8
4
  </div>
9
5
  </template>
10
6
 
11
7
  <script>
8
+ import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
12
9
  export default {
13
10
  name: 'CvBreadcrumbItem',
11
+ mixins: [carbonPrefixMixin],
14
12
  props: {
15
13
  active: Boolean,
16
14
  ariaCurrent: String,
@@ -19,6 +17,13 @@ export default {
19
17
  activePage() {
20
18
  return this.active && this.ariaCurrent !== 'page';
21
19
  },
20
+ breadcrumbItemClasses() {
21
+ const classes = [`cv-breadcrumb-item ${this.carbonPrefix}--breadcrumb-item`];
22
+ if (this.activePage) {
23
+ classes.push(`${this.carbonPrefix}--breadcrumb-item--current`);
24
+ }
25
+ return classes.join(' ');
26
+ },
22
27
  },
23
28
  };
24
29
  </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <nav class="bx--breadcrumb bx--skeleton" :aria-label="ariaLabel">
2
+ <nav :class="`${carbonPrefix}--breadcrumb ${carbonPrefix}--skeleton`" :aria-label="ariaLabel">
3
3
  <cv-breadcrumb-item-skeleton></cv-breadcrumb-item-skeleton>
4
4
  <cv-breadcrumb-item-skeleton></cv-breadcrumb-item-skeleton>
5
5
  <cv-breadcrumb-item-skeleton></cv-breadcrumb-item-skeleton>
@@ -8,9 +8,11 @@
8
8
 
9
9
  <script>
10
10
  import CvBreadcrumbItemSkeleton from './_cv-breadcrumb-item-skeleton';
11
+ import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
11
12
 
12
13
  export default {
13
14
  name: 'CvBreadcrumbSkeleton',
15
+ mixins: [carbonPrefixMixin],
14
16
  components: {
15
17
  CvBreadcrumbItemSkeleton,
16
18
  },
@@ -1,19 +1,26 @@
1
1
  <template>
2
- <nav
3
- class="cv-breadcrumb bx--breadcrumb"
4
- :class="{ 'bx--breadcrumb--no-trailing-slash': noTrailingSlash }"
5
- :aria-label="ariaLabel"
6
- >
2
+ <nav class="cv-breadcrumb" :class="breadcrumbClasses" :aria-label="ariaLabel">
7
3
  <slot></slot>
8
4
  </nav>
9
5
  </template>
10
6
 
11
7
  <script>
8
+ import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
12
9
  export default {
13
10
  name: 'CvBreadcrumb',
11
+ mixins: [carbonPrefixMixin],
14
12
  props: {
15
13
  ariaLabel: { type: String, default: 'breadcrumb' },
16
14
  noTrailingSlash: Boolean,
17
15
  },
16
+ computed: {
17
+ breadcrumbClasses() {
18
+ let classes = [`${this.carbonPrefix}--breadcrumb`];
19
+ if (this.noTrailingSlash) {
20
+ classes.push(`${this.carbonPrefix}--breadcrumb--no-trailing-slash`);
21
+ }
22
+ return classes;
23
+ },
24
+ },
18
25
  };
19
26
  </script>
@@ -2,20 +2,19 @@
2
2
  <button class="cv-button" :class="buttonClasses" v-on="inputListeners" role="button">
3
3
  <slot></slot>
4
4
 
5
- <component v-if="typeof icon === 'object'" :is="icon" class="bx--temp-fix" :class="`${carbonPrefix}--btn__icon`" />
6
- <svg v-if="typeof icon === 'string' || iconHref" :class="`${carbonPrefix}--btn__icon`">
7
- <use :href="icon || iconHref" />
8
- </svg>
5
+ <CvSvg v-if="icon || iconHref" :svg="icon || iconHref" :class="`${carbonPrefix}--btn__icon`" />
9
6
  </button>
10
7
  </template>
11
8
 
12
9
  <script>
13
10
  import buttonMixin from './button-mixin';
14
11
  import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
12
+ import CvSvg from '../cv-svg/_cv-svg';
15
13
 
16
14
  export default {
17
15
  name: 'CvButton',
18
16
  mixins: [buttonMixin, carbonPrefixMixin],
17
+ components: { CvSvg },
19
18
  computed: {
20
19
  buttonClasses() {
21
20
  return this.buttonClassOpts();
@@ -2,20 +2,19 @@
2
2
  <button class="cv-button" :class="buttonClasses" v-on="inputListeners" type="button">
3
3
  <span :class="`${carbonPrefix}--assistive-text`">{{ label }}</span>
4
4
 
5
- <component v-if="typeof icon === 'object'" :is="icon" class="bx--temp-fix" :class="`${carbonPrefix}--btn__icon`" />
6
- <svg v-if="typeof icon === 'string' || iconHref" :class="`${carbonPrefix}--btn__icon`">
7
- <use :href="icon || iconHref" />
8
- </svg>
5
+ <CvSvg v-if="icon || iconHref" :svg="icon || iconHref" :class="`${carbonPrefix}--btn__icon`" />
9
6
  </button>
10
7
  </template>
11
8
 
12
9
  <script>
13
10
  import buttonMixin from './button-mixin';
14
11
  import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
12
+ import CvSvg from '../cv-svg/_cv-svg';
15
13
 
16
14
  export default {
17
15
  name: 'CvIconButton',
18
16
  mixins: [buttonMixin, carbonPrefixMixin],
17
+ components: { CvSvg },
19
18
  props: {
20
19
  label: { type: String, default: undefined },
21
20
  tipPosition: {
@@ -1,11 +1,13 @@
1
1
  <template>
2
- <div class="cv-checkbox bx--form-item bx--checkbox-wrapper">
3
- <label class="bx--checkbox-label bx--skeleton"></label>
2
+ <div class="cv-checkbox" :class="`${carbonPrefix}--form-item ${carbonPrefix}--checkbox-wrapper`">
3
+ <label :class="`${carbonPrefix}--checkbox-label ${carbonPrefix}--skeleton`"></label>
4
4
  </div>
5
5
  </template>
6
6
 
7
7
  <script>
8
+ import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
8
9
  export default {
9
10
  name: 'CvCheckboxSkeleton',
11
+ mixins: [carbonPrefixMixin],
10
12
  };
11
13
  </script>
@@ -1,10 +1,10 @@
1
1
  <template>
2
- <div class="cv-checkbox bx--checkbox-wrapper" :class="{ 'bx--form-item': formItem }">
2
+ <div class="cv-checkbox" :class="formItemClasses">
3
3
  <input
4
4
  ref="input"
5
5
  v-bind="$attrs"
6
6
  v-on="inputListeners"
7
- class="bx--checkbox"
7
+ :class="`${carbonPrefix}--checkbox`"
8
8
  type="checkbox"
9
9
  :checked="isChecked === true"
10
10
  :aria-checked="`${isChecked}`"
@@ -14,18 +14,12 @@
14
14
  :id="uid"
15
15
  />
16
16
  <label
17
- :class="[
18
- 'bx--checkbox-label',
19
- {
20
- 'bx--label--disabled': $attrs.disabled !== undefined && $attrs.disabled,
21
- 'bx--checkbox-label__focus': hasFocus,
22
- },
23
- ]"
17
+ :class="labelClasses"
24
18
  :data-contained-checkbox-state="isChecked"
25
19
  :data-contained-checkbox-disabled="$attrs.disabled"
26
20
  :for="uid"
27
21
  >
28
- <span class="bx--checkbox-label-text" :class="{ 'bx--visually-hidden': hideLabel }">
22
+ <span :class="labelContentClasses">
29
23
  {{ label }}
30
24
  </span>
31
25
  </label>
@@ -35,10 +29,11 @@
35
29
  <script>
36
30
  import checkMixin from '../../mixins/check-mixin';
37
31
  import uidMixin from '../../mixins/uid-mixin';
32
+ import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
38
33
 
39
34
  export default {
40
35
  name: 'CvCheckbox',
41
- mixins: [checkMixin, uidMixin],
36
+ mixins: [checkMixin, uidMixin, carbonPrefixMixin],
42
37
  inheritAttrs: false,
43
38
  props: {
44
39
  hideLabel: Boolean,
@@ -60,6 +55,32 @@ export default {
60
55
  dataMixed: this.mixed,
61
56
  };
62
57
  },
58
+ computed: {
59
+ formItemClasses() {
60
+ const classes = [`${this.carbonPrefix}--checkbox-wrapper`];
61
+ if (this.formItem) {
62
+ classes.push(`${this.carbonPrefix}--form-item`);
63
+ }
64
+ return classes;
65
+ },
66
+ labelClasses() {
67
+ const classes = [`${this.carbonPrefix}--checkbox-label`];
68
+ if (this.$attrs.disabled !== undefined && this.$attrs.disabled) {
69
+ classes.push(`${this.carbonPrefix}--label--disabled`);
70
+ }
71
+ if (this.hasFocus) {
72
+ classes.push(`${this.carbonPrefix}--checkbox-label__focus`);
73
+ }
74
+ return classes;
75
+ },
76
+ labelContentClasses() {
77
+ const classes = [`${this.carbonPrefix}--checkbox-label-text`];
78
+ if (this.hideLabel) {
79
+ classes.push(`${this.carbonPrefix}--visually-hidden`);
80
+ }
81
+ return classes;
82
+ },
83
+ },
63
84
  methods: {
64
85
  onFocus() {
65
86
  this.hasFocus = true;
@@ -17,7 +17,7 @@
17
17
  'bx--combo-box--disabled bx--list-box--disabled': disabled,
18
18
  }"
19
19
  :data-invalid="isInvalid"
20
- v-bind="$attr"
20
+ v-bind="$attrs"
21
21
  @keydown.down.prevent="onDown"
22
22
  @keydown.up.prevent="onUp"
23
23
  @keydown.enter.prevent="onEnter"
@@ -28,7 +28,7 @@
28
28
  <div
29
29
  role="button"
30
30
  aria-haspopup="true"
31
- :aria-expanded="open"
31
+ :aria-expanded="open ? 'true' : 'false'"
32
32
  :aria-owns="uid"
33
33
  :aria-controls="uid"
34
34
  class="bx--list-box__field"
@@ -45,7 +45,7 @@
45
45
  aria-autocomplete="list"
46
46
  role="combobox"
47
47
  :aria-disabled="disabled"
48
- :aria-expanded="open"
48
+ :aria-expanded="open ? 'true' : 'false'"
49
49
  autocomplete="off"
50
50
  :disabled="disabled"
51
51
  :placeholder="label"
@@ -22,13 +22,10 @@
22
22
  },
23
23
  ]"
24
24
  :data-target="contentSelector"
25
- :aria-selected="`${dataSelected}`"
25
+ :aria-selected="dataSelected ? 'true' : 'false'"
26
26
  @click="open"
27
27
  >
28
- <component v-if="typeof icon === 'object'" :is="icon" class="bx--content-switcher__icon" />
29
- <svg v-if="typeof icon === 'string'" class="bx--content-switcher__icon" height="16" width="16">
30
- <use :href="icon" />
31
- </svg>
28
+ <CvSvg v-if="icon" :svg="icon" class="bx--content-switcher__icon" height="16" width="16" />
32
29
  <span class="bx--content-switcher__label">
33
30
  <slot></slot>
34
31
  </span>
@@ -37,10 +34,12 @@
37
34
 
38
35
  <script>
39
36
  import uidMixin from '../../mixins/uid-mixin';
37
+ import CvSvg from '../cv-svg/_cv-svg';
40
38
 
41
39
  export default {
42
40
  name: 'CvContentSwitcherButton',
43
41
  mixins: [uidMixin],
42
+ components: { CvSvg },
44
43
  props: {
45
44
  contentSelector: { type: String, default: undefined },
46
45
  icon: {
@@ -60,11 +60,12 @@
60
60
  class="bx--dropdown-text"
61
61
  :aria-disabled="disabled"
62
62
  aria-haspopup="true"
63
- :aria-expanded="open"
63
+ :aria-expanded="open ? 'true' : 'false'"
64
64
  :aria-controls="`${uid}-menu`"
65
65
  :aria-labelledby="ariaLabeledBy"
66
66
  :disabled="disabled"
67
67
  type="button"
68
+ ref="button"
68
69
  >
69
70
  <WarningFilled16 v-if="isInvalid && inline" class="bx--dropdown__invalid-icon" />
70
71
  <span
@@ -83,7 +84,7 @@
83
84
  class="bx--dropdown-list"
84
85
  :id="`${uid}-menu`"
85
86
  role="menu"
86
- :aria-hidden="!open"
87
+ :aria-hidden="!open ? 'true' : 'false'"
87
88
  wh-menu-anchor="left"
88
89
  :aria-labelledby="`${uid}-label`"
89
90
  ref="droplist"
@@ -285,7 +286,7 @@ export default {
285
286
  },
286
287
  onEsc() {
287
288
  this.open = false;
288
- this.$el.focus();
289
+ this.focus();
289
290
  },
290
291
  onClick(ev) {
291
292
  if (this.disabled) {
@@ -293,7 +294,7 @@ export default {
293
294
  } else {
294
295
  this.open = !this.open;
295
296
  if (!this.open) {
296
- this.$el.focus();
297
+ this.focus();
297
298
  }
298
299
 
299
300
  let target = ev.target;
@@ -309,6 +310,11 @@ export default {
309
310
  }
310
311
  }
311
312
  },
313
+ focus() {
314
+ this.$nextTick(() => {
315
+ this.$refs.button.focus();
316
+ });
317
+ },
312
318
  },
313
319
  };
314
320
  </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <form class="cv-form bx--form">
2
+ <form class="cv-form bx--form" v-on="$listeners">
3
3
  <slot></slot>
4
4
  </form>
5
5
  </template>
@@ -1,19 +1,22 @@
1
1
  <template>
2
- <div data-inline-loading class="bx--inline-loading" role="alert" aria-live="assertive">
3
- <div class="bx--inline-loading__animation" :class="{ 'bx--loading--stop': internalState === STATES.ENDING }">
2
+ <div data-inline-loading :class="`${carbonPrefix}--inline-loading`" role="alert" aria-live="assertive">
3
+ <div :class="animationClasses">
4
4
  <div
5
5
  v-show="internalState === STATES.LOADING || internalState === STATES.ENDING"
6
- class="bx--loading bx--loading--small"
6
+ :class="`${carbonPrefix}--loading ${carbonPrefix}--loading--small`"
7
7
  >
8
- <svg class="bx--loading__svg" viewBox="-75 -75 150 150">
9
- <circle class="bx--loading__background" cx="0" cy="0" r="26.8125" />
10
- <circle class="bx--loading__stroke" cx="0" cy="0" r="26.8125" />
8
+ <svg :class="`${carbonPrefix}--loading__svg`" viewBox="-75 -75 150 150">
9
+ <circle :class="`${carbonPrefix}--loading__background`" cx="0" cy="0" r="26.8125" />
10
+ <circle :class="`${carbonPrefix}--loading__stroke`" cx="0" cy="0" r="26.8125" />
11
11
  </svg>
12
12
  </div>
13
- <CheckmarkFilled16 :hidden="internalState !== STATES.LOADED" class="bx--inline-loading__checkmark-container" />
14
- <ErrorFilled16 :hidden="internalState !== STATES.ERROR" class="bx--inline-loading--error" />
13
+ <CheckmarkFilled16
14
+ :hidden="internalState !== STATES.LOADED"
15
+ :class="`${carbonPrefix}--inline-loading__checkmark-container`"
16
+ />
17
+ <ErrorFilled16 :hidden="internalState !== STATES.ERROR" :class="`${carbonPrefix}--inline-loading--error`" />
15
18
  </div>
16
- <p class="bx--inline-loading__text">{{ stateText }}</p>
19
+ <p :class="`${carbonPrefix}--inline-loading__text`">{{ stateText }}</p>
17
20
  </div>
18
21
  </template>
19
22
 
@@ -21,10 +24,12 @@
21
24
  import { STATES } from './consts';
22
25
  import ErrorFilled16 from '@carbon/icons-vue/lib/error--filled/16';
23
26
  import CheckmarkFilled16 from '@carbon/icons-vue/lib/checkmark--filled/16';
27
+ import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
24
28
 
25
29
  export default {
26
30
  name: 'CvInlineLoading',
27
31
  components: { ErrorFilled16, CheckmarkFilled16 },
32
+ mixins: [carbonPrefixMixin],
28
33
  created() {
29
34
  this.STATES = STATES;
30
35
  },
@@ -76,12 +81,13 @@ export default {
76
81
  return this.loadingText;
77
82
  }
78
83
  },
79
- CONSTS() {
80
- return { STATES };
84
+ animationClasses() {
85
+ const classes = [`${this.carbonPrefix}--inline-loading__animation`];
86
+ if (this.internalState === STATES.ENDING) {
87
+ classes.push(`${this.carbonPrefix}--loading--stop`);
88
+ }
89
+ return classes;
81
90
  },
82
91
  },
83
- CONSTS() {
84
- return { STATES };
85
- },
86
92
  };
87
93
  </script>
@@ -1,23 +1,27 @@
1
1
  <template>
2
- <component
3
- :is="tagType"
4
- v-on="$listeners"
5
- v-bind="linkProps"
6
- class="cv-link bx--link"
7
- :class="{ 'bx--link--inline': inline }"
8
- >
2
+ <component :is="tagType" v-on="$listeners" v-bind="linkProps" class="cv-link" :class="linkClasses">
9
3
  <slot></slot>
10
4
  </component>
11
5
  </template>
12
6
 
13
7
  <script>
14
8
  import LinkMixin from '../../mixins/link-mixin';
9
+ import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
15
10
 
16
11
  export default {
17
12
  name: 'CvLink',
18
- mixins: [LinkMixin],
13
+ mixins: [LinkMixin, carbonPrefixMixin],
19
14
  props: {
20
15
  inline: Boolean,
21
16
  },
17
+ computed: {
18
+ linkClasses() {
19
+ const classes = [`${this.carbonPrefix}--link`];
20
+ if (this.inline) {
21
+ classes.push(`${this.carbonPrefix}--link--inline`);
22
+ }
23
+ return classes;
24
+ },
25
+ },
22
26
  };
23
27
  </script>
@@ -43,7 +43,7 @@
43
43
  <div
44
44
  role="button"
45
45
  aria-haspopup="true"
46
- :aria-expanded="open"
46
+ :aria-expanded="open ? 'true' : 'false'"
47
47
  :aria-owns="uid"
48
48
  :aria-controls="uid"
49
49
  class="bx--list-box__field"
@@ -71,7 +71,7 @@
71
71
  :aria-controls="uid"
72
72
  aria-autocomplete="list"
73
73
  role="combobox"
74
- :aria-expanded="open"
74
+ :aria-expanded="open ? 'true' : 'false'"
75
75
  autocomplete="off"
76
76
  :placeholder="label"
77
77
  v-model="filter"
@@ -1,12 +1,14 @@
1
1
  <template>
2
- <div class="cv-number-input bx--form-item">
3
- <label class="bx--label bx--skeleton" />
4
- <div class="bx--number bx--skeleton" />
2
+ <div class="cv-number-input" :class="`${carbonPrefix}--form-item`">
3
+ <label :class="`${carbonPrefix}--label ${carbonPrefix}--skeleton`" />
4
+ <div :class="`${carbonPrefix}--number ${carbonPrefix}--skeleton`" />
5
5
  </div>
6
6
  </template>
7
7
 
8
8
  <script>
9
+ import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
9
10
  export default {
10
11
  name: 'CvNumberInputSkeleton',
12
+ mixins: [carbonPrefixMixin],
11
13
  };
12
14
  </script>
@@ -1,24 +1,14 @@
1
1
  <template>
2
- <cv-wrapper :tag-type="formItem ? 'div' : ''" class="cv-number-input bx--form-item">
3
- <div
4
- data-numberinput
5
- class="bx--number"
6
- :class="{
7
- 'bx--number--light': theme === 'light',
8
- 'bx--number--helpertext': isHelper,
9
- 'cv-number-input': !formItem,
10
- 'bx--number--mobile': mobile,
11
- }"
12
- :data-invalid="isInvalid"
13
- >
14
- <label :for="uid" class="bx--label">{{ label }}</label>
15
- <div class="bx--form__helper-text" v-if="isHelper">
2
+ <cv-wrapper :tag-type="formItem ? 'div' : ''" class="cv-number-input" :class="`${carbonPrefix}--form-item`">
3
+ <div data-numberinput :class="numberInputClasses" :data-invalid="isInvalid">
4
+ <label :for="uid" :class="`${carbonPrefix}--label`">{{ label }}</label>
5
+ <div :class="`${carbonPrefix}--form__helper-text`" v-if="isHelper">
16
6
  <slot name="helper-text">{{ helperText }}</slot>
17
7
  </div>
18
- <div class="bx--number__input-wrapper">
8
+ <div :class="`${carbonPrefix}--number__input-wrapper`">
19
9
  <button
20
10
  v-if="mobile"
21
- class="bx--number__control-btn down-icon"
11
+ :class="`${carbonPrefix}--number__control-btn down-icon`"
22
12
  @click="doDown"
23
13
  type="button"
24
14
  :aria-label="ariaLabelForDownButton"
@@ -38,10 +28,10 @@
38
28
  :max="max"
39
29
  ref="input"
40
30
  />
41
- <WarningFilled16 v-if="isInvalid && !mobile" class="bx--number__invalid" />
42
- <div class="bx--number__controls" v-if="!mobile">
31
+ <WarningFilled16 v-if="isInvalid && !mobile" :class="`${carbonPrefix}--number__invalid`" />
32
+ <div :class="`${carbonPrefix}--number__controls`" v-if="!mobile">
43
33
  <button
44
- class="bx--number__control-btn up-icon"
34
+ :class="`${carbonPrefix}--number__control-btn up-icon`"
45
35
  @click="doUp"
46
36
  type="button"
47
37
  :aria-label="ariaLabelForUpButton"
@@ -50,7 +40,7 @@
50
40
  <CaretUpGlyph />
51
41
  </button>
52
42
  <button
53
- class="bx--number__control-btn down-icon"
43
+ :class="`${carbonPrefix}--number__control-btn down-icon`"
54
44
  @click="doDown"
55
45
  type="button"
56
46
  :aria-label="ariaLabelForDownButton"
@@ -61,7 +51,7 @@
61
51
  </div>
62
52
  <button
63
53
  v-else
64
- class="bx--number__control-btn up-icon"
54
+ :class="`${carbonPrefix}--number__control-btn up-icon`"
65
55
  @click="doUp"
66
56
  type="button"
67
57
  :aria-label="ariaLabelForUpButton"
@@ -70,7 +60,7 @@
70
60
  <CaretUpGlyph />
71
61
  </button>
72
62
  </div>
73
- <div class="bx--form-requirement" v-if="isInvalid">
63
+ <div :class="`${carbonPrefix}--form-requirement`" v-if="isInvalid">
74
64
  <slot name="invalid-message">{{ invalidMessage }}</slot>
75
65
  </div>
76
66
  </div>
@@ -84,10 +74,11 @@ import CaretDownGlyph from '@carbon/icons-vue/es/caret--down/index';
84
74
  import CaretUpGlyph from '@carbon/icons-vue/es/caret--up/index';
85
75
  import WarningFilled16 from '@carbon/icons-vue/es/warning--filled/16';
86
76
  import CvWrapper from '../cv-wrapper/_cv-wrapper';
77
+ import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
87
78
 
88
79
  export default {
89
80
  name: 'CvNumberInput',
90
- mixins: [uidMixin, themeMixin],
81
+ mixins: [uidMixin, themeMixin, carbonPrefixMixin],
91
82
  components: { CaretDownGlyph, CaretUpGlyph, WarningFilled16, CvWrapper },
92
83
  inheritAttrs: false,
93
84
  props: {
@@ -140,6 +131,24 @@ export default {
140
131
  },
141
132
  },
142
133
  computed: {
134
+ numberInputClasses() {
135
+ const classes = [`${this.carbonPrefix}--number`];
136
+
137
+ if (this.theme === 'light') {
138
+ classes.push(`${this.carbonPrefix}--number--light`);
139
+ }
140
+ if (this.isHelper) {
141
+ classes.push(`${this.carbonPrefix}--number--helpertext`);
142
+ }
143
+ if (!this.formItem) {
144
+ classes.push(`cv-number-input`);
145
+ }
146
+ if (this.mobile) {
147
+ classes.push(`${this.carbonPrefix}--number--mobile`);
148
+ }
149
+
150
+ return classes;
151
+ },
143
152
  // Bind listeners at the component level to the embedded input element and
144
153
  // add our own input listener to service the v-model. See:
145
154
  // https://vuejs.org/v2/guide/components-custom-events.html#Customizing-Component-v-model