@carbon/vue 2.40.0 → 2.43.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.
- package/README.md +24 -2
- package/dist/carbon-vue.common.js +922 -817
- package/dist/carbon-vue.common.js.map +1 -1
- package/dist/carbon-vue.umd.js +922 -817
- package/dist/carbon-vue.umd.js.map +1 -1
- package/dist/carbon-vue.umd.min.js +3 -3
- package/dist/carbon-vue.umd.min.js.map +1 -1
- package/package.json +7 -7
- package/src/components/cv-accordion/cv-accordion-skeleton.vue +1 -1
- package/src/components/cv-accordion/cv-accordion.vue +1 -1
- package/src/components/cv-aspect-ratio/cv-aspect-ratio.vue +3 -2
- package/src/components/cv-aspect-ratio/index.js +2 -2
- package/src/components/cv-breadcrumb/cv-breadcrumb-skeleton.vue +8 -1
- package/src/components/cv-button/button-mixin.js +7 -4
- package/src/components/cv-button/consts.js +14 -0
- package/src/components/cv-button/cv-icon-button.vue +1 -1
- package/src/components/cv-code-snippet/cv-code-snippet-skeleton.vue +1 -1
- package/src/components/cv-code-snippet/cv-code-snippet.vue +1 -1
- package/src/components/cv-data-table/cv-data-table-heading.vue +1 -1
- package/src/components/cv-data-table/cv-data-table-skeleton.vue +1 -2
- package/src/components/cv-data-table/cv-data-table.vue +47 -44
- package/src/components/cv-date-picker/cv-date-picker.vue +11 -10
- package/src/components/cv-feedback-button/_cv-feedback-button.vue +1 -1
- package/src/components/cv-file-uploader/cv-file-uploader.vue +22 -12
- package/src/components/cv-inline-loading/cv-inline-loading.vue +1 -0
- package/src/components/cv-link/cv-link.vue +8 -1
- package/src/components/cv-loading/cv-loading.vue +4 -1
- package/src/components/cv-multi-select/cv-multi-select.vue +17 -11
- package/src/components/cv-number-input/cv-number-input.vue +38 -30
- package/src/components/cv-overflow-menu/cv-overflow-menu.vue +3 -3
- package/src/components/cv-search/cv-search.vue +17 -13
- package/src/components/cv-tabs/cv-tabs-skeleton.vue +7 -19
- package/src/components/cv-tabs/cv-tabs.vue +1 -1
- package/src/components/cv-tag/cv-tag-skeleton.vue +1 -3
- package/src/components/cv-tag/cv-tag.vue +6 -7
- package/src/components/cv-tag/index.js +3 -2
- package/src/components/cv-tile/_cv-tile-selectable.vue +0 -1
- package/src/components/cv-toast-notification/cv-toast-notification.vue +1 -1
- package/src/components/cv-tooltip/consts.js +2 -0
- package/src/components/cv-tooltip/cv-definition-tooltip.vue +5 -5
- package/src/components/cv-tooltip/cv-interactive-tooltip.vue +7 -7
- package/src/components/cv-tooltip/cv-tooltip.vue +5 -5
- package/src/components/cv-tooltip/index.js +1 -0
- package/src/components/cv-ui-shell/cv-header-global-action.vue +1 -1
- package/CHANGELOG.md +0 -1197
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<cv-wrapper :tag-type="formItem ? 'div' : ''" class="cv-number-input" :class="`${carbonPrefix}--form-item`">
|
|
3
3
|
<div
|
|
4
|
-
data-numberinput
|
|
5
4
|
:class="[
|
|
6
5
|
`${carbonPrefix}--number`,
|
|
7
6
|
{
|
|
@@ -14,20 +13,12 @@
|
|
|
14
13
|
:data-invalid="isInvalid"
|
|
15
14
|
>
|
|
16
15
|
<label :for="uid" :class="`${carbonPrefix}--label`">{{ label }}</label>
|
|
17
|
-
<div
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
:class="`${carbonPrefix}--number__control-btn down-icon`"
|
|
24
|
-
@click="doDown"
|
|
25
|
-
type="button"
|
|
26
|
-
:aria-label="ariaLabelForDownButton"
|
|
27
|
-
:disabled="disabled"
|
|
28
|
-
>
|
|
29
|
-
<Subtract16 />
|
|
30
|
-
</button>
|
|
16
|
+
<div
|
|
17
|
+
:class="[
|
|
18
|
+
`${carbonPrefix}--number__input-wrapper`,
|
|
19
|
+
{ [`${carbonPrefix}--number__input-wrapper--warning`]: isWarn },
|
|
20
|
+
]"
|
|
21
|
+
>
|
|
31
22
|
<input
|
|
32
23
|
:data-invalid="isInvalid"
|
|
33
24
|
:id="uid"
|
|
@@ -41,8 +32,9 @@
|
|
|
41
32
|
:max="max"
|
|
42
33
|
ref="input"
|
|
43
34
|
/>
|
|
44
|
-
<WarningFilled16 v-if="isInvalid
|
|
45
|
-
<
|
|
35
|
+
<WarningFilled16 v-if="isInvalid" :class="iconClasses" />
|
|
36
|
+
<WarningAltFilled16 v-if="isWarn && !isInvalid" :class="iconClasses" />
|
|
37
|
+
<div :class="`${carbonPrefix}--number__controls`">
|
|
46
38
|
<button
|
|
47
39
|
:class="`${carbonPrefix}--number__control-btn down-icon`"
|
|
48
40
|
@click="doDown"
|
|
@@ -68,21 +60,14 @@
|
|
|
68
60
|
</button>
|
|
69
61
|
<div :class="`${carbonPrefix}--number__rule-divider`" />
|
|
70
62
|
</div>
|
|
71
|
-
<button
|
|
72
|
-
v-else
|
|
73
|
-
:class="`${carbonPrefix}--number__control-btn up-icon`"
|
|
74
|
-
@click="doUp"
|
|
75
|
-
type="button"
|
|
76
|
-
:aria-label="ariaLabelForUpButton"
|
|
77
|
-
:disabled="disabled"
|
|
78
|
-
>
|
|
79
|
-
<Add16 />
|
|
80
|
-
</button>
|
|
81
63
|
</div>
|
|
82
64
|
<div :class="`${carbonPrefix}--form-requirement`" v-if="isInvalid">
|
|
83
65
|
<slot name="invalid-message">{{ invalidMessage }}</slot>
|
|
84
66
|
</div>
|
|
85
|
-
<div :class="`${carbonPrefix}--
|
|
67
|
+
<div :class="`${carbonPrefix}--form-requirement`" v-if="isWarn && !isInvalid">
|
|
68
|
+
<slot name="warn-text">{{ warnText }}</slot>
|
|
69
|
+
</div>
|
|
70
|
+
<div :class="`${carbonPrefix}--form__helper-text`" v-if="!(isInvalid || isWarn) && isHelper">
|
|
86
71
|
<slot name="helper-text">{{ helperText }}</slot>
|
|
87
72
|
</div>
|
|
88
73
|
</div>
|
|
@@ -94,12 +79,13 @@ import { uidMixin, themeMixin, carbonPrefixMixin, methodsMixin } from '../../mix
|
|
|
94
79
|
import Add16 from '@carbon/icons-vue/es/add/16';
|
|
95
80
|
import Subtract16 from '@carbon/icons-vue/es/subtract/16';
|
|
96
81
|
import WarningFilled16 from '@carbon/icons-vue/es/warning--filled/16';
|
|
82
|
+
import WarningAltFilled16 from '@carbon/icons-vue/es/warning--alt--filled/16';
|
|
97
83
|
import CvWrapper from '../cv-wrapper/_cv-wrapper';
|
|
98
84
|
|
|
99
85
|
export default {
|
|
100
86
|
name: 'CvNumberInput',
|
|
101
87
|
mixins: [uidMixin, themeMixin, carbonPrefixMixin, methodsMixin({ input: ['blur', 'focus'] })],
|
|
102
|
-
components: { Add16, Subtract16, WarningFilled16, CvWrapper },
|
|
88
|
+
components: { Add16, Subtract16, WarningFilled16, WarningAltFilled16, CvWrapper },
|
|
103
89
|
inheritAttrs: false,
|
|
104
90
|
props: {
|
|
105
91
|
disabled: Boolean,
|
|
@@ -111,6 +97,7 @@ export default {
|
|
|
111
97
|
invalid: /* deprecate */ {
|
|
112
98
|
type: Boolean,
|
|
113
99
|
default: undefined,
|
|
100
|
+
deprecated: true,
|
|
114
101
|
validator(val) {
|
|
115
102
|
if (val !== undefined && process.env.NODE_ENV === 'development') {
|
|
116
103
|
console.warn('CvNumberInput: invalid prop deprecated in favour of invalidMessage');
|
|
@@ -123,13 +110,25 @@ export default {
|
|
|
123
110
|
min: { type: [String, Number], default: undefined },
|
|
124
111
|
max: { type: [String, Number], default: undefined },
|
|
125
112
|
step: { type: [String, Number], default: undefined },
|
|
126
|
-
mobile:
|
|
113
|
+
mobile: /* deprecate */ {
|
|
114
|
+
type: Boolean,
|
|
115
|
+
default: undefined,
|
|
116
|
+
deprecated: true,
|
|
117
|
+
validator(val) {
|
|
118
|
+
if (val !== undefined) {
|
|
119
|
+
console.warn('CvNumberInput: mobile prop deprecated as no longer different to standard number input.');
|
|
120
|
+
}
|
|
121
|
+
return true;
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
warnText: { type: String, default: undefined },
|
|
127
125
|
},
|
|
128
126
|
data() {
|
|
129
127
|
return {
|
|
130
128
|
internalValue: 0,
|
|
131
129
|
isHelper: false,
|
|
132
130
|
isInvalid: false,
|
|
131
|
+
isWarn: false,
|
|
133
132
|
};
|
|
134
133
|
},
|
|
135
134
|
mounted() {
|
|
@@ -159,6 +158,14 @@ export default {
|
|
|
159
158
|
input: ev => this.onInput(ev.target.value),
|
|
160
159
|
});
|
|
161
160
|
},
|
|
161
|
+
iconClasses() {
|
|
162
|
+
const classes = [];
|
|
163
|
+
(this.isInvalid || this.isWarn) && classes.push(`${this.carbonPrefix}--number__invalid`);
|
|
164
|
+
this.isWarn && !this.isInvalid && classes.push(`${this.carbonPrefix}--number__invalid--warning`);
|
|
165
|
+
this.readOnly && classes.push(`${this.carbonPrefix}--number__readonly-icon`);
|
|
166
|
+
|
|
167
|
+
return classes.join(' ');
|
|
168
|
+
},
|
|
162
169
|
},
|
|
163
170
|
methods: {
|
|
164
171
|
onInput(val) {
|
|
@@ -168,6 +175,7 @@ export default {
|
|
|
168
175
|
checkSlots() {
|
|
169
176
|
// NOTE: this.$slots is not reactive so needs to be managed on updated
|
|
170
177
|
this.isInvalid = !!(this.$slots['invalid-message'] || (this.invalidMessage && this.invalidMessage.length));
|
|
178
|
+
this.isWarn = !!(this.$slots['warn-text'] || (this.warnText && this.warnText.length));
|
|
171
179
|
this.isHelper = !!(this.$slots['helper-text'] || (this.helperText && this.helperText.length));
|
|
172
180
|
},
|
|
173
181
|
doUp() {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
class="cv-overflow-menu__before-content"
|
|
49
49
|
ref="beforeContent"
|
|
50
50
|
tabindex="0"
|
|
51
|
-
style="position: absolute; height: 1px; width: 1px; left: -9999px
|
|
51
|
+
style="position: absolute; height: 1px; width: 1px; left: -9999px"
|
|
52
52
|
@focus="focusBeforeContent"
|
|
53
53
|
/>
|
|
54
54
|
<ul :class="`${carbonPrefix}--overflow-menu-options__content`">
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
class="cv-overflow-menu__after-content"
|
|
59
59
|
ref="afterContent"
|
|
60
60
|
tabindex="0"
|
|
61
|
-
style="position: absolute; height: 1px; width: 1px; left: -9999px
|
|
61
|
+
style="position: absolute; height: 1px; width: 1px; left: -9999px"
|
|
62
62
|
@focus="focusAfterContent"
|
|
63
63
|
/>
|
|
64
64
|
</div>
|
|
@@ -87,7 +87,7 @@ export default {
|
|
|
87
87
|
tipPosition: {
|
|
88
88
|
type: String,
|
|
89
89
|
default: 'right',
|
|
90
|
-
validator: val => ['top', 'left', 'bottom', 'right'.includes(val)
|
|
90
|
+
validator: val => ['top', 'left', 'bottom', 'right'].includes(val),
|
|
91
91
|
},
|
|
92
92
|
tipAlignment: { type: String, default: 'center', validator: val => ['start', 'center', 'end'].includes(val) },
|
|
93
93
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<cv-wrapper :tag-type="formItem ? 'div' : ''" :class="`cv-search ${carbonPrefix}--form-item`">
|
|
3
3
|
<div
|
|
4
|
+
:aria-labelledby="uid"
|
|
4
5
|
:class="[
|
|
5
6
|
`${carbonPrefix}--search`,
|
|
6
7
|
{
|
|
@@ -14,6 +15,21 @@
|
|
|
14
15
|
role="search"
|
|
15
16
|
ref="search"
|
|
16
17
|
>
|
|
18
|
+
<button
|
|
19
|
+
type="button"
|
|
20
|
+
v-if="isToolbarKind"
|
|
21
|
+
:class="`${carbonPrefix}--toolbar-search__btn`"
|
|
22
|
+
:aria-label="toolbarAriaLabel"
|
|
23
|
+
@click="toggleActive(true)"
|
|
24
|
+
@blur="checkFocus"
|
|
25
|
+
>
|
|
26
|
+
<component :is="icon" :class="`${carbonPrefix}--search-magnifier`" />
|
|
27
|
+
</button>
|
|
28
|
+
|
|
29
|
+
<div v-if="!isToolbarKind" :class="`${carbonPrefix}--search-magnifier`">
|
|
30
|
+
<Search20 :class="`${carbonPrefix}--search-magnifier-icon`" />
|
|
31
|
+
</div>
|
|
32
|
+
|
|
17
33
|
<label :for="uid" :class="`${carbonPrefix}--label`">{{ label }}</label>
|
|
18
34
|
|
|
19
35
|
<input
|
|
@@ -23,24 +39,12 @@
|
|
|
23
39
|
v-model="internalValue"
|
|
24
40
|
v-on="inputListeners"
|
|
25
41
|
type="text"
|
|
26
|
-
role="search"
|
|
27
42
|
ref="input"
|
|
28
43
|
:placeholder="placeholder"
|
|
29
44
|
:aria-labelledby="uid"
|
|
30
45
|
@blur="checkFocus"
|
|
31
46
|
/>
|
|
32
47
|
|
|
33
|
-
<button
|
|
34
|
-
type="button"
|
|
35
|
-
v-if="isToolbarKind"
|
|
36
|
-
:class="`${carbonPrefix}--toolbar-search__btn`"
|
|
37
|
-
:aria-label="toolbarAriaLabel"
|
|
38
|
-
@click="toggleActive(true)"
|
|
39
|
-
@blur="checkFocus"
|
|
40
|
-
>
|
|
41
|
-
<component :is="icon" :class="`${carbonPrefix}--search-magnifier`" />
|
|
42
|
-
</button>
|
|
43
|
-
<component v-if="!isToolbarKind" :is="icon" :class="`${carbonPrefix}--search-magnifier`" />
|
|
44
48
|
<button
|
|
45
49
|
type="button"
|
|
46
50
|
:class="[`${carbonPrefix}--search-close`, { [`${carbonPrefix}--search-close--hidden`]: !clearVisible }]"
|
|
@@ -64,7 +68,7 @@ import CvWrapper from '../cv-wrapper/_cv-wrapper';
|
|
|
64
68
|
export default {
|
|
65
69
|
name: 'CvSearch',
|
|
66
70
|
mixins: [uidMixin, themeMixin, carbonPrefixMixin, methodsMixin({ input: ['blur', 'focus'] })],
|
|
67
|
-
components: { Close16, CvWrapper },
|
|
71
|
+
components: { Close16, CvWrapper, Search20 },
|
|
68
72
|
inheritAttrs: false,
|
|
69
73
|
props: {
|
|
70
74
|
clearAriaLabel: { type: String, default: 'Clear search input' },
|
|
@@ -1,23 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="`cv-tabs ${carbonPrefix}--tabs ${carbonPrefix}--skeleton`">
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
<path d="M10 0L5 5 0 0z" />
|
|
7
|
-
</svg>
|
|
8
|
-
</div>
|
|
9
|
-
<ul :class="`${carbonPrefix}--tabs__nav ${carbonPrefix}--tabs__nav--hidden`">
|
|
10
|
-
<li :class="`cv-tab ${carbonPrefix}--tabs__nav-item ${carbonPrefix}--tabs__nav-item--selected`">
|
|
11
|
-
<div :class="`${carbonPrefix}--tabs__nav-link`"> </div>
|
|
12
|
-
</li>
|
|
13
|
-
<li :class="`cv-tab ${carbonPrefix}--tabs__nav-item`">
|
|
14
|
-
<div :class="`${carbonPrefix}--tabs__nav-link`"> </div>
|
|
15
|
-
</li>
|
|
16
|
-
<li :class="`cv-tab ${carbonPrefix}--tabs__nav-item`">
|
|
17
|
-
<div :class="`${carbonPrefix}--tabs__nav-link`"> </div>
|
|
18
|
-
</li>
|
|
19
|
-
<li :class="`cv-tab ${carbonPrefix}--tabs__nav-item`">
|
|
20
|
-
<div :class="`${carbonPrefix}--tabs__nav-link`"> </div>
|
|
2
|
+
<div :class="`cv-tabs ${carbonPrefix}--tabs ${carbonPrefix}--skeleton ${carbonPrefix}--tabs--scrollable`">
|
|
3
|
+
<ul :class="`${carbonPrefix}--tabs--scrollable__nav`">
|
|
4
|
+
<li v-for="index in tabCount" :key="index" :class="`${carbonPrefix}--tabs--scrollable__nav-item`">
|
|
5
|
+
<div :class="`${carbonPrefix}--tabs__nav-link`"><span></span></div>
|
|
21
6
|
</li>
|
|
22
7
|
</ul>
|
|
23
8
|
</div>
|
|
@@ -28,5 +13,8 @@ import { carbonPrefixMixin } from '../../mixins';
|
|
|
28
13
|
export default {
|
|
29
14
|
name: 'CvTabsSkeleton',
|
|
30
15
|
mixins: [carbonPrefixMixin],
|
|
16
|
+
props: {
|
|
17
|
+
tabCount: { type: Number, default: 5 },
|
|
18
|
+
},
|
|
31
19
|
};
|
|
32
20
|
</script>
|
|
@@ -196,7 +196,7 @@ export default {
|
|
|
196
196
|
},
|
|
197
197
|
doScrollIntoView(index) {
|
|
198
198
|
const tab = this.$refs.link[index];
|
|
199
|
-
const scrollContainer = tab.parentNode ? tab.parentNode.parentNode : null;
|
|
199
|
+
const scrollContainer = tab && tab.parentNode ? tab.parentNode.parentNode : null;
|
|
200
200
|
let newScrollLeft;
|
|
201
201
|
|
|
202
202
|
if (tab && scrollContainer) {
|
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
`cv-tag ${carbonPrefix}--tag`,
|
|
8
8
|
`${carbonPrefix}--tag--${tagKind}`,
|
|
9
9
|
{
|
|
10
|
+
[`${carbonPrefix}--tag--disabled`]: disabled,
|
|
10
11
|
[`${carbonPrefix}--tag--filter`]: isFilter,
|
|
12
|
+
[`${carbonPrefix}--tag--interactive`]: hasClickListener,
|
|
11
13
|
[`${carbonPrefix}--tag--${size}`]: size,
|
|
12
14
|
},
|
|
13
15
|
]"
|
|
@@ -19,7 +21,7 @@
|
|
|
19
21
|
<div v-if="icon && !filter" :class="`${carbonPrefix}--tag__custom-icon`">
|
|
20
22
|
<CvSvg :svg="icon" />
|
|
21
23
|
</div>
|
|
22
|
-
<span :class="`${carbonPrefix}--tag__label`">{{ label }}</span>
|
|
24
|
+
<span :class="`${carbonPrefix}--tag__label`" :title="hasClickListener ? label : ''">{{ label }}</span>
|
|
23
25
|
<button
|
|
24
26
|
v-if="isFilter"
|
|
25
27
|
:class="`${carbonPrefix}--tag__close-icon`"
|
|
@@ -37,7 +39,7 @@ import Close16 from '@carbon/icons-vue/es/close/16';
|
|
|
37
39
|
import { carbonPrefixMixin, uidMixin } from '../../mixins';
|
|
38
40
|
import CvSvg from '../cv-svg/_cv-svg';
|
|
39
41
|
|
|
40
|
-
const tagKinds = [
|
|
42
|
+
export const tagKinds = [
|
|
41
43
|
'red',
|
|
42
44
|
'magenta',
|
|
43
45
|
'purple',
|
|
@@ -71,8 +73,7 @@ export default {
|
|
|
71
73
|
label: { type: String, required: true },
|
|
72
74
|
kind: {
|
|
73
75
|
type: String,
|
|
74
|
-
|
|
75
|
-
validator(val) {
|
|
76
|
+
validator: val => {
|
|
76
77
|
if (val === 'filter' && process.env.NODE_ENV === 'development') {
|
|
77
78
|
console.warn('DEPRECARTED: Prefer props.filter (bool)');
|
|
78
79
|
return true;
|
|
@@ -86,9 +87,7 @@ export default {
|
|
|
86
87
|
},
|
|
87
88
|
size: {
|
|
88
89
|
type: String,
|
|
89
|
-
validator(val)
|
|
90
|
-
return !val || val == 'sm';
|
|
91
|
-
},
|
|
90
|
+
validator: val => ['sm'].includes(val),
|
|
92
91
|
},
|
|
93
92
|
},
|
|
94
93
|
data() {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div
|
|
3
3
|
data-notification
|
|
4
4
|
:class="[
|
|
5
|
-
`cv-
|
|
5
|
+
`cv-notification ${carbonPrefix}--toast-notification`,
|
|
6
6
|
`${carbonPrefix}--toast-notification--${kind.toLowerCase()}`,
|
|
7
7
|
{ [`${carbonPrefix}--toast-notification--low-contrast`]: lowContrast },
|
|
8
8
|
]"
|
|
@@ -19,21 +19,21 @@
|
|
|
19
19
|
|
|
20
20
|
<script>
|
|
21
21
|
import { uidMixin, carbonPrefixMixin } from '../../mixins';
|
|
22
|
+
import { alignments, directions } from './consts';
|
|
22
23
|
|
|
23
24
|
export default {
|
|
24
25
|
name: 'CvDefinitionTooltip',
|
|
25
26
|
mixins: [uidMixin, carbonPrefixMixin],
|
|
26
27
|
props: {
|
|
27
|
-
alignment: { type: String, default: 'center', validator: val =>
|
|
28
|
+
alignment: { type: String, default: 'center', validator: val => alignments.includes(val) },
|
|
28
29
|
definition: { type: String, required: true },
|
|
29
30
|
direction: {
|
|
30
31
|
type: String,
|
|
31
32
|
default: 'top',
|
|
32
|
-
validator
|
|
33
|
-
const
|
|
34
|
-
const valid = validValues.includes(val);
|
|
33
|
+
validator: val => {
|
|
34
|
+
const valid = directions.includes(val);
|
|
35
35
|
if (!valid) {
|
|
36
|
-
console.warn(`CVDefinitionTooltip.direction must be one of the following: ${
|
|
36
|
+
console.warn(`CVDefinitionTooltip.direction must be one of the following: ${directions}`);
|
|
37
37
|
}
|
|
38
38
|
return valid;
|
|
39
39
|
},
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
class="cv-interactive-tooltip__before-content"
|
|
47
47
|
ref="beforeContent"
|
|
48
48
|
tabindex="0"
|
|
49
|
-
style="position: absolute; left: -9999px; width: 1px; height: 1px
|
|
49
|
+
style="position: absolute; left: -9999px; width: 1px; height: 1px"
|
|
50
50
|
@focus="focusBeforeContent"
|
|
51
51
|
/>
|
|
52
52
|
<span :class="`${carbonPrefix}--tooltip__caret`"></span>
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
class="cv-interactive-tooltip__after-content"
|
|
58
58
|
ref="afterContent"
|
|
59
59
|
tabindex="0"
|
|
60
|
-
style="position: absolute; left: -9999px; width: 1px; height: 1px
|
|
60
|
+
style="position: absolute; left: -9999px; width: 1px; height: 1px"
|
|
61
61
|
@focus="focusAfterContent"
|
|
62
62
|
/>
|
|
63
63
|
</div>
|
|
@@ -67,21 +67,21 @@
|
|
|
67
67
|
<script>
|
|
68
68
|
import { uidMixin, carbonPrefixMixin } from '../../mixins';
|
|
69
69
|
import Information16 from '@carbon/icons-vue/es/information/16';
|
|
70
|
+
import { alignments, directions } from './consts';
|
|
70
71
|
|
|
71
72
|
export default {
|
|
72
73
|
name: 'CvInteractiveTooltip',
|
|
73
74
|
mixins: [uidMixin, carbonPrefixMixin],
|
|
74
75
|
components: { Information16 },
|
|
75
76
|
props: {
|
|
76
|
-
alignment: { type: String, default: 'center', validator: val =>
|
|
77
|
+
alignment: { type: String, default: 'center', validator: val => alignments.includes(val) },
|
|
77
78
|
direction: {
|
|
78
79
|
type: String,
|
|
79
80
|
default: 'top',
|
|
80
|
-
validator
|
|
81
|
-
const
|
|
82
|
-
const valid = validValues.includes(val);
|
|
81
|
+
validator: val => {
|
|
82
|
+
const valid = directions.includes(val);
|
|
83
83
|
if (!valid) {
|
|
84
|
-
console.warn(`CVInteractiveTooltip.direction must be one of the following: ${
|
|
84
|
+
console.warn(`CVInteractiveTooltip.direction must be one of the following: ${directions}`);
|
|
85
85
|
}
|
|
86
86
|
return valid;
|
|
87
87
|
},
|
|
@@ -19,21 +19,21 @@
|
|
|
19
19
|
<script>
|
|
20
20
|
import Information16 from '@carbon/icons-vue/es/information/16';
|
|
21
21
|
import { carbonPrefixMixin } from '../../mixins';
|
|
22
|
+
import { alignments, directions } from './consts';
|
|
22
23
|
|
|
23
24
|
export default {
|
|
24
25
|
name: 'CvTooltip',
|
|
25
26
|
mixins: [carbonPrefixMixin],
|
|
26
27
|
components: { Information16 },
|
|
27
28
|
props: {
|
|
28
|
-
alignment: { type: String, default: 'center', validator: val =>
|
|
29
|
+
alignment: { type: String, default: 'center', validator: val => alignments.includes(val) },
|
|
29
30
|
direction: {
|
|
30
31
|
type: String,
|
|
31
32
|
default: 'top',
|
|
32
|
-
validator
|
|
33
|
-
const
|
|
34
|
-
const valid = validValues.includes(val);
|
|
33
|
+
validator: val => {
|
|
34
|
+
const valid = directions.includes(val);
|
|
35
35
|
if (!valid) {
|
|
36
|
-
console.warn(`CVTooltip.direction must be one of the following: ${
|
|
36
|
+
console.warn(`CVTooltip.direction must be one of the following: ${directions}`);
|
|
37
37
|
}
|
|
38
38
|
return valid;
|
|
39
39
|
},
|
|
@@ -2,4 +2,5 @@ import CvTooltip from './cv-tooltip';
|
|
|
2
2
|
import CvInteractiveTooltip from './cv-interactive-tooltip';
|
|
3
3
|
import CvDefinitionTooltip from './cv-definition-tooltip';
|
|
4
4
|
|
|
5
|
+
export { alignments, directions } from './consts';
|
|
5
6
|
export { CvTooltip, CvInteractiveTooltip, CvDefinitionTooltip };
|
|
@@ -38,7 +38,7 @@ export default {
|
|
|
38
38
|
tipPosition: {
|
|
39
39
|
type: String,
|
|
40
40
|
default: 'bottom',
|
|
41
|
-
validator: val => ['top', 'left', 'bottom', 'right'.includes(val)
|
|
41
|
+
validator: val => ['top', 'left', 'bottom', 'right'].includes(val),
|
|
42
42
|
},
|
|
43
43
|
tipAlignment: { type: String, default: 'center', validator: val => ['start', 'center', 'end'].includes(val) },
|
|
44
44
|
},
|