@carbon/vue 1.0.2 → 1.1.3
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/CHANGELOG.md +192 -0
- package/README.md +156 -211
- package/dist/carbon-vue.common.js +10567 -12509
- package/dist/carbon-vue.common.js.map +1 -1
- package/dist/carbon-vue.umd.js +10567 -12509
- package/dist/carbon-vue.umd.js.map +1 -1
- package/dist/carbon-vue.umd.min.js +31 -7
- package/dist/carbon-vue.umd.min.js.map +1 -1
- package/dist/demo.html +2 -2
- package/package.json +17 -157
- package/src/components/cv-accordion/_cv-accordion-item-skeleton.vue +3 -13
- package/src/components/cv-accordion/cv-accordion-item.vue +2 -9
- package/src/components/cv-breadcrumb/cv-breadcrumb-item.vue +3 -1
- package/src/components/cv-button/cv-button-skeleton.vue +1 -6
- package/src/components/cv-button/cv-button.vue +15 -37
- package/src/components/cv-checkbox/cv-checkbox.vue +42 -26
- package/src/components/cv-code-snippet/_cv-code-snippet-multiline.vue +13 -23
- package/src/components/cv-code-snippet/_cv-code-snippet-oneline.vue +11 -5
- package/src/components/cv-code-snippet/_cv-feedback-button.vue +1 -3
- package/src/components/cv-code-snippet/cv-code-snippet.vue +2 -7
- package/src/components/cv-content-switcher/cv-content-switcher-button.vue +20 -4
- package/src/components/cv-content-switcher/cv-content-switcher.vue +3 -10
- package/src/components/cv-data-table/cv-data-table-row.vue +15 -11
- package/src/components/cv-data-table/cv-data-table.vue +30 -28
- package/src/components/cv-date-picker/cv-date-picker.vue +53 -47
- package/src/components/cv-dropdown/_cv-dropdown-inner-c10.vue +226 -0
- package/src/components/cv-dropdown/_cv-dropdown-inner.vue +201 -0
- package/src/components/cv-dropdown/cv-dropdown-item.vue +6 -8
- package/src/components/cv-dropdown/cv-dropdown-skeleton.vue +1 -5
- package/src/components/cv-dropdown/cv-dropdown.vue +22 -169
- package/src/components/cv-file-uploader/cv-file-uploader.vue +44 -22
- package/src/components/cv-inline-loading/cv-inline-loading.vue +37 -0
- package/src/components/cv-inline-notification/cv-inline-notification.vue +22 -19
- package/src/components/cv-link/cv-link.vue +1 -6
- package/src/components/cv-loading/cv-loading.vue +13 -4
- package/src/components/cv-modal/cv-modal.vue +17 -15
- package/src/components/cv-number-input/cv-number-input.vue +20 -32
- package/src/components/cv-overflow-menu/cv-overflow-menu.vue +13 -19
- package/src/components/cv-pagination/cv-pagination.vue +61 -42
- package/src/components/cv-progress/_cv-progress-step-complete.vue +3 -12
- package/src/components/cv-progress/cv-progress-step.vue +97 -0
- package/src/components/cv-progress/cv-progress.vue +68 -13
- package/src/components/cv-radio-button/cv-radio-button.vue +1 -0
- package/src/components/cv-search/cv-search.vue +144 -15
- package/src/components/cv-select/cv-select-option.vue +3 -1
- package/src/components/cv-select/cv-select.vue +147 -15
- package/src/components/cv-slider/cv-slider.vue +14 -43
- package/src/components/cv-structured-list/_cv-structured-list-item-selectable.vue +18 -6
- package/src/components/cv-structured-list/cv-structured-list-item.vue +1 -3
- package/src/components/cv-structured-list/cv-structured-list.vue +10 -2
- package/src/components/cv-tabs/cv-tabs.vue +31 -15
- package/src/components/cv-tag/cv-tag.vue +23 -13
- package/src/components/cv-text-area/cv-text-area.vue +23 -10
- package/src/components/cv-text-input/cv-text-input.vue +80 -10
- package/src/components/cv-tile/_cv-tile-clickable.vue +1 -5
- package/src/components/cv-tile/_cv-tile-expandable.vue +11 -15
- package/src/components/cv-tile/_cv-tile-selectable.vue +14 -3
- package/src/components/cv-tile/cv-tile.vue +1 -4
- package/src/components/cv-time-picker/cv-time-picker.vue +27 -29
- package/src/components/cv-toast-notification/cv-toast-notification.vue +32 -6
- package/src/components/cv-toggle/cv-toggle.vue +3 -7
- package/src/components/cv-toolbar/cv-toolbar-option.vue +1 -4
- package/src/components/cv-toolbar/cv-toolbar-search.vue +5 -0
- package/src/components/cv-tooltip/cv-definition-tooltip.vue +1 -3
- package/src/components/cv-tooltip/cv-interactive-tooltip.vue +13 -28
- package/src/components/cv-tooltip/cv-tooltip.vue +11 -15
- package/src/components/cv-wrapper/_cv-wrapper.js +33 -0
- package/src/index-components-vue.js +1 -3
- package/src/index.js +1 -5
- package/src/{_internal/_feature-flags.js → internal/feature-flags.js} +30 -2
- package/dist/carbon-data-viz-vue.common.js +0 -23907
- package/dist/carbon-data-viz-vue.common.js.map +0 -1
- package/dist/carbon-data-viz-vue.css +0 -1
- package/dist/carbon-data-viz-vue.umd.js +0 -23917
- package/dist/carbon-data-viz-vue.umd.js.map +0 -1
- package/dist/carbon-data-viz-vue.umd.min.js +0 -2
- package/dist/carbon-data-viz-vue.umd.min.js.map +0 -1
- package/src/assets/styles/_carbon-helpers.scss +0 -8
- package/src/components/cv-checkbox/_cv-checkbox-inner-form-item.vue +0 -19
- package/src/components/cv-checkbox/_cv-checkbox-inner.vue +0 -59
- package/src/components/cv-progress/_cv-progress-step.vue +0 -51
- package/src/components/cv-search/_cv-search-inner-form-item.vue +0 -22
- package/src/components/cv-search/_cv-search-inner.vue +0 -162
- package/src/components/cv-select/_cv-select-inner-form-item.vue +0 -22
- package/src/components/cv-select/_cv-select-inner.vue +0 -78
- package/src/data-viz/cv-bar-graph/cv-bar-graph.vue +0 -495
- package/src/data-viz/cv-gauge/cv-gauge.vue +0 -196
- package/src/data-viz/cv-pie-chart/cv-pie-chart.vue +0 -194
- package/src/index-data-viz.js +0 -29
|
@@ -1,31 +1,24 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
data-
|
|
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
|
-
:
|
|
7
|
+
:role="isAlert ? 'alert' : false"
|
|
8
8
|
:aria-live="!isAlert ? 'polite' : false"
|
|
9
9
|
>
|
|
10
10
|
<div class="bx--inline-notification__details">
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
class="bx--inline-notification__icon"
|
|
14
|
-
width="16"
|
|
15
|
-
height="16"
|
|
16
|
-
></cv-icon>
|
|
11
|
+
<component v-if="componentsX" :is="icon" class="bx--inline-notification__icon" />
|
|
12
|
+
<cv-icon v-else :href="`cv(${icon})`" class="bx--inline-notification__icon" width="16" height="16"></cv-icon>
|
|
17
13
|
<div class="bx--inline-notification__text-wrapper">
|
|
18
14
|
<p class="bx--inline-notification__title">{{ title }}</p>
|
|
19
15
|
<p class="bx--inline-notification__subtitle">{{ subTitle }}.</p>
|
|
20
16
|
</div>
|
|
21
17
|
</div>
|
|
22
|
-
<button
|
|
23
|
-
|
|
24
|
-
data-notification-btn
|
|
25
|
-
class="bx--inline-notification__close-button"
|
|
26
|
-
@click="$emit('close')"
|
|
27
|
-
>
|
|
18
|
+
<button type="button" data-notification-btn class="bx--inline-notification__close-button" @click="$emit('close')">
|
|
19
|
+
<Close16 v-if="componentsX" class="bx--inline-notification__close-icon" />
|
|
28
20
|
<svg
|
|
21
|
+
v-else
|
|
29
22
|
class="bx--inline-notification__close-icon"
|
|
30
23
|
aria-label="close"
|
|
31
24
|
width="10"
|
|
@@ -45,10 +38,20 @@
|
|
|
45
38
|
<script>
|
|
46
39
|
import notificationMixin from '../../mixins/notification-mixin';
|
|
47
40
|
import CvIcon from '../cv-icon/_cv-icon';
|
|
41
|
+
import { componentsX } from '../../internal/feature-flags';
|
|
42
|
+
import ErrorFilled16 from '@carbon/icons-vue/lib/error--filled/16';
|
|
43
|
+
import CheckmarkFilled16 from '@carbon/icons-vue/lib/checkmark--filled/16';
|
|
44
|
+
import WarningAltFilled16 from '@carbon/icons-vue/lib/warning--filled/16';
|
|
45
|
+
import Close16 from '@carbon/icons-vue/lib/close/16';
|
|
48
46
|
|
|
49
47
|
export default {
|
|
50
48
|
name: 'CvInlineNotification',
|
|
51
|
-
components: { CvIcon },
|
|
49
|
+
components: { CvIcon, Close16 },
|
|
50
|
+
data() {
|
|
51
|
+
return {
|
|
52
|
+
componentsX,
|
|
53
|
+
};
|
|
54
|
+
},
|
|
52
55
|
mixins: [notificationMixin],
|
|
53
56
|
props: {
|
|
54
57
|
kind: {
|
|
@@ -61,13 +64,13 @@ export default {
|
|
|
61
64
|
icon() {
|
|
62
65
|
switch (this.kind) {
|
|
63
66
|
case 'error':
|
|
64
|
-
return 'icon--error--solid';
|
|
67
|
+
return componentsX ? ErrorFilled16 : 'icon--error--solid';
|
|
65
68
|
case 'warning':
|
|
66
|
-
return 'icon--warning--solid';
|
|
69
|
+
return componentsX ? WarningAltFilled16 : 'icon--warning--solid';
|
|
67
70
|
case 'success':
|
|
68
|
-
return 'icon--checkmark--solid';
|
|
71
|
+
return componentsX ? CheckmarkFilled16 : 'icon--checkmark--solid';
|
|
69
72
|
default:
|
|
70
|
-
return 'icon--info--solid';
|
|
73
|
+
return componentsX ? null : 'icon--info--solid';
|
|
71
74
|
}
|
|
72
75
|
},
|
|
73
76
|
},
|
|
@@ -11,13 +11,23 @@
|
|
|
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 v-if="componentsX && small" class="bx--loading__background" cx="0" cy="0" r="37.5"></circle>
|
|
15
|
+
<circle
|
|
16
|
+
:class="{
|
|
17
|
+
'bx--loading__stroke': componentsX,
|
|
18
|
+
}"
|
|
19
|
+
cx="0"
|
|
20
|
+
cy="0"
|
|
21
|
+
r="37.5"
|
|
22
|
+
></circle>
|
|
15
23
|
</svg>
|
|
16
24
|
</div>
|
|
17
25
|
</div>
|
|
18
26
|
</template>
|
|
19
27
|
|
|
20
28
|
<script>
|
|
29
|
+
import { componentsX } from '../../internal/feature-flags';
|
|
30
|
+
|
|
21
31
|
export default {
|
|
22
32
|
name: 'CvLoading',
|
|
23
33
|
props: {
|
|
@@ -29,13 +39,12 @@ export default {
|
|
|
29
39
|
overlayClasses() {
|
|
30
40
|
if (!this.overlay) return '';
|
|
31
41
|
|
|
32
|
-
return `bx--loading-overlay ${
|
|
33
|
-
this.stopped ? 'bx--loading-overlay--stop' : ''
|
|
34
|
-
}`;
|
|
42
|
+
return `bx--loading-overlay ${this.stopped ? 'bx--loading-overlay--stop' : ''}`;
|
|
35
43
|
},
|
|
36
44
|
},
|
|
37
45
|
data() {
|
|
38
46
|
return {
|
|
47
|
+
componentsX,
|
|
39
48
|
stopped: false,
|
|
40
49
|
};
|
|
41
50
|
},
|
|
@@ -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,21 +27,16 @@
|
|
|
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
|
-
<
|
|
31
|
-
|
|
32
|
-
href="cv(icon--close)"
|
|
33
|
-
height="10px"
|
|
34
|
-
width="10px"
|
|
35
|
-
></cv-icon>
|
|
30
|
+
<Close16 v-if="componentsX" class="bx--modal-close__icon" />
|
|
31
|
+
<cv-icon v-else class="bx--modal-close__icon" href="cv(icon--close)" height="10px" width="10px"></cv-icon>
|
|
36
32
|
</button>
|
|
37
33
|
</div>
|
|
38
34
|
|
|
39
|
-
<div class="bx--modal-content">
|
|
35
|
+
<div class="bx--modal-content" ref="content">
|
|
40
36
|
<slot name="content">
|
|
41
37
|
<p>
|
|
42
|
-
Passive modal notifications should only appear if there is an action
|
|
43
|
-
|
|
44
|
-
are persistent on the screen.
|
|
38
|
+
Passive modal notifications should only appear if there is an action the user needs to address immediately.
|
|
39
|
+
Passive modal notifications are persistent on the screen.
|
|
45
40
|
</p>
|
|
46
41
|
</slot>
|
|
47
42
|
</div>
|
|
@@ -70,7 +65,7 @@
|
|
|
70
65
|
class="cv-modal__after-content"
|
|
71
66
|
ref="afterContent"
|
|
72
67
|
tabindex="0"
|
|
73
|
-
style="position: absolute; height: 1px; width: 1px; left: -9999px"
|
|
68
|
+
style="position: absolute; height: 1px; width: 1px; left: -9999px;"
|
|
74
69
|
@focus="focusAfterContent"
|
|
75
70
|
/>
|
|
76
71
|
</div>
|
|
@@ -81,6 +76,8 @@
|
|
|
81
76
|
import CvButton from '../cv-button/cv-button';
|
|
82
77
|
import CvIcon from '../cv-icon/_cv-icon';
|
|
83
78
|
import uidMixin from '../../mixins/uid-mixin';
|
|
79
|
+
import Close16 from '@carbon/icons-vue/lib/close/16';
|
|
80
|
+
import { componentsX } from '../../internal/feature-flags';
|
|
84
81
|
|
|
85
82
|
export default {
|
|
86
83
|
name: 'CvModal',
|
|
@@ -88,6 +85,7 @@ export default {
|
|
|
88
85
|
components: {
|
|
89
86
|
CvButton,
|
|
90
87
|
CvIcon,
|
|
88
|
+
Close16,
|
|
91
89
|
},
|
|
92
90
|
props: {
|
|
93
91
|
kind: {
|
|
@@ -99,6 +97,7 @@ export default {
|
|
|
99
97
|
},
|
|
100
98
|
data() {
|
|
101
99
|
return {
|
|
100
|
+
componentsX,
|
|
102
101
|
dataVisible: false,
|
|
103
102
|
};
|
|
104
103
|
},
|
|
@@ -119,14 +118,14 @@ export default {
|
|
|
119
118
|
computed: {
|
|
120
119
|
primaryKind() {
|
|
121
120
|
if (this.kind === 'danger') {
|
|
122
|
-
return 'danger--primary';
|
|
121
|
+
return componentsX ? 'danger' : 'danger--primary';
|
|
123
122
|
} else {
|
|
124
123
|
return 'primary';
|
|
125
124
|
}
|
|
126
125
|
},
|
|
127
126
|
secondaryKind() {
|
|
128
127
|
if (this.kind === 'danger') {
|
|
129
|
-
return 'tertiary';
|
|
128
|
+
return componentsX ? 'secondary' : 'tertiary';
|
|
130
129
|
} else {
|
|
131
130
|
return 'secondary';
|
|
132
131
|
}
|
|
@@ -149,7 +148,10 @@ export default {
|
|
|
149
148
|
this.$refs.close.focus();
|
|
150
149
|
},
|
|
151
150
|
onShown() {
|
|
152
|
-
|
|
151
|
+
const focusEl = this.$refs.content.querySelector('[data-modal-primary-focus]');
|
|
152
|
+
if (focusEl) {
|
|
153
|
+
focusEl.focus();
|
|
154
|
+
} else if (this.$slots['primary-button']) {
|
|
153
155
|
this.$refs.primary.$el.focus();
|
|
154
156
|
} else if (this.$slots['secondary-button']) {
|
|
155
157
|
this.$refs.secondary.$el.focus();
|
|
@@ -1,41 +1,30 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="cv-number-input bx--form-item">
|
|
2
|
+
<cv-wrapper :tag-type="formItem ? 'div' : ''" class="cv-number-input bx--form-item">
|
|
3
3
|
<div
|
|
4
4
|
data-numberinput
|
|
5
5
|
class="bx--number"
|
|
6
6
|
:class="{
|
|
7
7
|
'bx--number--light': theme === 'light',
|
|
8
8
|
'bx--number--helpertext': isHelper,
|
|
9
|
+
'cv-number-input': !formItem,
|
|
9
10
|
}"
|
|
10
11
|
:data-invalid="isInvalid"
|
|
11
12
|
>
|
|
12
13
|
<div class="bx--number__controls">
|
|
13
|
-
<button
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
type="button"
|
|
17
|
-
>
|
|
18
|
-
<svg width="10" height="5" viewBox="0 0 10 5">
|
|
14
|
+
<button class="bx--number__control-btn up-icon" @click="doUp" type="button">
|
|
15
|
+
<CaretUpGlyph v-if="componentsX" />
|
|
16
|
+
<svg v-else width="10" height="5" viewBox="0 0 10 5">
|
|
19
17
|
<path d="M0 5L5 .002 10 5z" fill-rule="evenodd"></path>
|
|
20
18
|
</svg>
|
|
21
19
|
</button>
|
|
22
|
-
<button
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
type="button"
|
|
26
|
-
>
|
|
27
|
-
<svg width="10" height="5" viewBox="0 0 10 5">
|
|
20
|
+
<button class="bx--number__control-btn down-icon" @click="doDown" type="button">
|
|
21
|
+
<CaretDownGlyph v-if="componentsX" />
|
|
22
|
+
<svg v-else width="10" height="5" viewBox="0 0 10 5">
|
|
28
23
|
<path d="M0 0l5 4.998L10 0z" fill-rule="evenodd"></path>
|
|
29
24
|
</svg>
|
|
30
25
|
</button>
|
|
31
26
|
</div>
|
|
32
|
-
<input
|
|
33
|
-
:id="uid"
|
|
34
|
-
type="number"
|
|
35
|
-
v-model="internalValue"
|
|
36
|
-
v-bind="$attrs"
|
|
37
|
-
v-on="inputListeners"
|
|
38
|
-
/>
|
|
27
|
+
<input :id="uid" type="number" v-model="internalValue" v-bind="$attrs" v-on="inputListeners" />
|
|
39
28
|
<label :for="uid" class="bx--label">{{ label }}</label>
|
|
40
29
|
<div class="bx--form-requirement" v-if="isInvalid">
|
|
41
30
|
<slot name="invalid-message">{{ invalidMessage }}</slot>
|
|
@@ -44,18 +33,24 @@
|
|
|
44
33
|
<slot name="helper-text">{{ helperText }}</slot>
|
|
45
34
|
</div>
|
|
46
35
|
</div>
|
|
47
|
-
</
|
|
36
|
+
</cv-wrapper>
|
|
48
37
|
</template>
|
|
49
38
|
|
|
50
39
|
<script>
|
|
51
40
|
import uidMixin from '../../mixins/uid-mixin';
|
|
52
41
|
import themeMixin from '../../mixins/theme-mixin';
|
|
42
|
+
import { componentsX } from '../../internal/feature-flags';
|
|
43
|
+
import CaretDownGlyph from '@carbon/icons-vue/lib/caret--down/index';
|
|
44
|
+
import CaretUpGlyph from '@carbon/icons-vue/lib/caret--up/index';
|
|
45
|
+
import CvWrapper from '../cv-wrapper/_cv-wrapper';
|
|
53
46
|
|
|
54
47
|
export default {
|
|
55
48
|
name: 'CvNumberInput',
|
|
56
49
|
mixins: [uidMixin, themeMixin],
|
|
50
|
+
components: { CaretDownGlyph, CaretUpGlyph, CvWrapper },
|
|
57
51
|
inheritAttrs: false,
|
|
58
52
|
props: {
|
|
53
|
+
formItem: { type: Boolean, default: true },
|
|
59
54
|
helperText: { type: String, default: null },
|
|
60
55
|
invalidMessage: { type: String, default: null },
|
|
61
56
|
label: String,
|
|
@@ -65,9 +60,7 @@ export default {
|
|
|
65
60
|
default: undefined,
|
|
66
61
|
validator(val) {
|
|
67
62
|
if (val !== undefined) {
|
|
68
|
-
console.warn(
|
|
69
|
-
'CvNumberInput: invalid prop deprecated in favour of invalidMessage'
|
|
70
|
-
);
|
|
63
|
+
console.warn('CvNumberInput: invalid prop deprecated in favour of invalidMessage');
|
|
71
64
|
}
|
|
72
65
|
return true;
|
|
73
66
|
},
|
|
@@ -75,6 +68,7 @@ export default {
|
|
|
75
68
|
},
|
|
76
69
|
data() {
|
|
77
70
|
return {
|
|
71
|
+
componentsX,
|
|
78
72
|
internalValue: this.value,
|
|
79
73
|
};
|
|
80
74
|
},
|
|
@@ -101,16 +95,10 @@ export default {
|
|
|
101
95
|
return intVal;
|
|
102
96
|
},
|
|
103
97
|
isInvalid() {
|
|
104
|
-
return (
|
|
105
|
-
this.$slots['invalid-message'] ||
|
|
106
|
-
(this.invalidMessage && this.invalidMessage.length)
|
|
107
|
-
);
|
|
98
|
+
return this.$slots['invalid-message'] || (this.invalidMessage && this.invalidMessage.length);
|
|
108
99
|
},
|
|
109
100
|
isHelper() {
|
|
110
|
-
return (
|
|
111
|
-
this.$slots['helper-text'] ||
|
|
112
|
-
(this.helperText && this.helperText.length)
|
|
113
|
-
);
|
|
101
|
+
return this.$slots['helper-text'] || (this.helperText && this.helperText.length);
|
|
114
102
|
},
|
|
115
103
|
},
|
|
116
104
|
methods: {
|
|
@@ -13,12 +13,8 @@
|
|
|
13
13
|
:class="{ 'bx--overflow-menu--open': open }"
|
|
14
14
|
>
|
|
15
15
|
<slot name="trigger">
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
width="3"
|
|
19
|
-
height="15"
|
|
20
|
-
viewBox="0 0 3 15"
|
|
21
|
-
>
|
|
16
|
+
<OverflowMenuVertical16 v-if="componentsX" class="bx--overflow-menu__icon" />
|
|
17
|
+
<svg v-else class="bx--overflow-menu__icon" width="3" height="15" viewBox="0 0 3 15">
|
|
22
18
|
<g fill-rule="evenodd">
|
|
23
19
|
<circle cx="1.5" cy="1.5" r="1.5"></circle>
|
|
24
20
|
<circle cx="1.5" cy="7.5" r="1.5"></circle>
|
|
@@ -43,7 +39,7 @@
|
|
|
43
39
|
class="cv-overflow-menu__before-content"
|
|
44
40
|
ref="beforeContent"
|
|
45
41
|
tabindex="0"
|
|
46
|
-
style="position: absolute; height: 1px; width: 1px; left: -9999px"
|
|
42
|
+
style="position: absolute; height: 1px; width: 1px; left: -9999px;"
|
|
47
43
|
@focus="focusBeforeContent"
|
|
48
44
|
/>
|
|
49
45
|
<slot></slot>
|
|
@@ -51,7 +47,7 @@
|
|
|
51
47
|
class="cv-overflow-menu__after-content"
|
|
52
48
|
ref="afterContent"
|
|
53
49
|
tabindex="0"
|
|
54
|
-
style="position: absolute; height: 1px; width: 1px; left: -9999px"
|
|
50
|
+
style="position: absolute; height: 1px; width: 1px; left: -9999px;"
|
|
55
51
|
@focus="focusAfterContent"
|
|
56
52
|
/>
|
|
57
53
|
</ul>
|
|
@@ -59,10 +55,13 @@
|
|
|
59
55
|
</template>
|
|
60
56
|
|
|
61
57
|
<script>
|
|
58
|
+
import { componentsX } from '../../internal/feature-flags';
|
|
59
|
+
import OverflowMenuVertical16 from '@carbon/icons-vue/lib/overflow-menu--vertical/16';
|
|
62
60
|
import uidMixin from '../../mixins/uid-mixin';
|
|
63
61
|
|
|
64
62
|
export default {
|
|
65
63
|
name: 'CvOverflowMenu',
|
|
64
|
+
components: { OverflowMenuVertical16 },
|
|
66
65
|
mixins: [uidMixin],
|
|
67
66
|
props: {
|
|
68
67
|
label: String,
|
|
@@ -81,6 +80,7 @@ export default {
|
|
|
81
80
|
},
|
|
82
81
|
data() {
|
|
83
82
|
return {
|
|
83
|
+
componentsX,
|
|
84
84
|
open: false,
|
|
85
85
|
left: -9999, // offscreen,
|
|
86
86
|
top: 0,
|
|
@@ -103,10 +103,7 @@ export default {
|
|
|
103
103
|
if (this.open) {
|
|
104
104
|
if (
|
|
105
105
|
ev.relatedTarget === null ||
|
|
106
|
-
!(
|
|
107
|
-
this.$el === ev.relatedTarget ||
|
|
108
|
-
this.$refs.popup.contains(ev.relatedTarget)
|
|
109
|
-
)
|
|
106
|
+
!(this.$el === ev.relatedTarget || this.$refs.popup.contains(ev.relatedTarget))
|
|
110
107
|
) {
|
|
111
108
|
this.open = false;
|
|
112
109
|
this.positionListen(false);
|
|
@@ -143,17 +140,14 @@ export default {
|
|
|
143
140
|
if (this.flipMenu) {
|
|
144
141
|
this.left =
|
|
145
142
|
menuPosition.left +
|
|
146
|
-
20 +
|
|
143
|
+
(this.componentsX ? 0 : 20) +
|
|
147
144
|
this.offsetLeft -
|
|
148
145
|
this.$refs.popup.offsetWidth +
|
|
149
146
|
this.$el.offsetWidth;
|
|
150
|
-
this.top =
|
|
151
|
-
menuPosition.bottom + 2 + this.offsetTop + window.scrollY;
|
|
147
|
+
this.top = menuPosition.bottom + 2 + this.offsetTop + window.scrollY;
|
|
152
148
|
} else {
|
|
153
|
-
this.left =
|
|
154
|
-
|
|
155
|
-
this.top =
|
|
156
|
-
menuPosition.bottom + 2 + this.offsetTop + window.scrollY;
|
|
149
|
+
this.left = menuPosition.left - (this.componentsX ? 0 : 20) + this.offsetLeft + window.scrollX;
|
|
150
|
+
this.top = menuPosition.bottom + 2 + this.offsetTop + window.scrollY;
|
|
157
151
|
}
|
|
158
152
|
});
|
|
159
153
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<div class="cv-pagination bx--pagination" data-pagination>
|
|
3
3
|
<div class="bx--pagination__left">
|
|
4
4
|
<cv-select
|
|
5
|
+
class="bx--select__item-count"
|
|
5
6
|
:label="`${pageSizesLabel}`"
|
|
6
7
|
inline
|
|
7
8
|
ref="pageSizeSelect"
|
|
@@ -12,42 +13,34 @@
|
|
|
12
13
|
v-for="(size, index) in pageSizes"
|
|
13
14
|
:key="index"
|
|
14
15
|
:value="`${size.value ? size.value : size}`"
|
|
15
|
-
>{{
|
|
16
|
-
size.label ? size.label : size.value ? size.value : size
|
|
17
|
-
}}</cv-select-option
|
|
16
|
+
>{{ size.label ? size.label : size.value ? size.value : size }}</cv-select-option
|
|
18
17
|
>
|
|
19
18
|
</cv-select>
|
|
20
19
|
|
|
21
20
|
<span class="bx--pagination__text">
|
|
22
|
-
<span>| </span>
|
|
21
|
+
<span v-if="!componentsX">| </span>
|
|
23
22
|
<span data-displayed-item-range>{{ rangeText }}</span>
|
|
24
23
|
</span>
|
|
25
24
|
</div>
|
|
26
25
|
|
|
27
|
-
<div class="bx--pagination__right
|
|
28
|
-
<span class="bx--pagination__text">{{ pageOfPages }}</span>
|
|
26
|
+
<div class="bx--pagination__right">
|
|
27
|
+
<span v-if="!componentsX" class="bx--pagination__text">{{ pageOfPages }}</span>
|
|
29
28
|
|
|
30
29
|
<button
|
|
30
|
+
v-if="!componentsX"
|
|
31
31
|
type="button"
|
|
32
32
|
class="bx--pagination__button bx--pagination__button--backward"
|
|
33
33
|
data-page-backward
|
|
34
34
|
:aria-label="backwardText"
|
|
35
35
|
@click="onPrevPage"
|
|
36
36
|
>
|
|
37
|
-
<svg
|
|
38
|
-
|
|
39
|
-
width="7"
|
|
40
|
-
height="12"
|
|
41
|
-
viewBox="0 0 7 12"
|
|
42
|
-
>
|
|
43
|
-
<path
|
|
44
|
-
fill-rule="nonzero"
|
|
45
|
-
d="M1.45 6.002L7 11.27l-.685.726L0 6.003 6.315 0 7 .726z"
|
|
46
|
-
></path>
|
|
37
|
+
<svg class="bx--pagination__button-icon" width="7" height="12" viewBox="0 0 7 12">
|
|
38
|
+
<path fill-rule="nonzero" d="M1.45 6.002L7 11.27l-.685.726L0 6.003 6.315 0 7 .726z"></path>
|
|
47
39
|
</svg>
|
|
48
40
|
</button>
|
|
49
41
|
|
|
50
42
|
<cv-select
|
|
43
|
+
class="bx--select__page-number"
|
|
51
44
|
:label="`${pageNumberLabel}:`"
|
|
52
45
|
inline
|
|
53
46
|
hideLabel
|
|
@@ -60,29 +53,39 @@
|
|
|
60
53
|
v-for="pageNumber in pages"
|
|
61
54
|
:key="pageNumber"
|
|
62
55
|
:value="`${pageNumber}`"
|
|
56
|
+
:selected="pageValue === pageNumber"
|
|
63
57
|
>{{ pageNumber }}</cv-select-option
|
|
64
58
|
>
|
|
65
59
|
</cv-select>
|
|
60
|
+
<span v-if="componentsX" class="bx--pagination__text">{{ pageOfPages }}</span>
|
|
61
|
+
|
|
66
62
|
<span v-if="pages.length == 0">{{ pageValue }}</span>
|
|
67
63
|
|
|
64
|
+
<button
|
|
65
|
+
v-if="componentsX"
|
|
66
|
+
type="button"
|
|
67
|
+
class="bx--pagination__button bx--pagination__button--backward"
|
|
68
|
+
data-page-backward
|
|
69
|
+
:aria-label="backwardText"
|
|
70
|
+
@click="onPrevPage"
|
|
71
|
+
:disabled="noWayBack"
|
|
72
|
+
:class="{ 'bx--pagination__button--no-index': noWayBack }"
|
|
73
|
+
>
|
|
74
|
+
<CaretLeft16 class="bx--pagination__button-icon" />
|
|
75
|
+
</button>
|
|
76
|
+
|
|
68
77
|
<button
|
|
69
78
|
type="button"
|
|
70
79
|
class="bx--pagination__button bx--pagination__button--forward"
|
|
71
80
|
data-page-forward
|
|
72
81
|
:aria-label="forwardText"
|
|
73
82
|
@click="onNextPage"
|
|
74
|
-
:disabled="
|
|
83
|
+
:disabled="noWayForward"
|
|
84
|
+
:class="{ 'bx--pagination__button--no-index': noWayForward }"
|
|
75
85
|
>
|
|
76
|
-
<
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
height="12"
|
|
80
|
-
viewBox="0 0 7 12"
|
|
81
|
-
>
|
|
82
|
-
<path
|
|
83
|
-
fill-rule="nonzero"
|
|
84
|
-
d="M5.569 5.994L0 .726.687 0l6.336 5.994-6.335 6.002L0 11.27z"
|
|
85
|
-
></path>
|
|
86
|
+
<CaretRight16 v-if="componentsX" class="bx--pagination__button-icon" />
|
|
87
|
+
<svg v-else class="bx--pagination__button-icon" width="7" height="12" viewBox="0 0 7 12">
|
|
88
|
+
<path fill-rule="nonzero" d="M5.569 5.994L0 .726.687 0l6.336 5.994-6.335 6.002L0 11.27z"></path>
|
|
86
89
|
</svg>
|
|
87
90
|
</button>
|
|
88
91
|
</div>
|
|
@@ -90,6 +93,12 @@
|
|
|
90
93
|
</template>
|
|
91
94
|
|
|
92
95
|
<script>
|
|
96
|
+
import CvSelect from '../cv-select/cv-select';
|
|
97
|
+
import CvSelectOption from '../cv-select/cv-select-option';
|
|
98
|
+
import { componentsX } from '../../internal/feature-flags';
|
|
99
|
+
import CaretLeft16 from '@carbon/icons-vue/lib/caret--left/16';
|
|
100
|
+
import CaretRight16 from '@carbon/icons-vue/lib/caret--right/16';
|
|
101
|
+
|
|
93
102
|
const newPageValue = (page, lastPage) => {
|
|
94
103
|
let result = 1;
|
|
95
104
|
if (page && page > 0) {
|
|
@@ -128,22 +137,23 @@ const newPagesArray = pageCount => {
|
|
|
128
137
|
return Array.from({ length: pageCount }, (val, key) => key + 1);
|
|
129
138
|
};
|
|
130
139
|
|
|
131
|
-
const newFirstItem = (pageValue, pageSizeValue) =>
|
|
132
|
-
1 + (pageValue - 1) * pageSizeValue;
|
|
140
|
+
const newFirstItem = (pageValue, pageSizeValue) => 1 + (pageValue - 1) * pageSizeValue;
|
|
133
141
|
|
|
134
142
|
export default {
|
|
135
143
|
name: 'CvPagination',
|
|
144
|
+
components: { CvSelect, CvSelectOption, CaretLeft16, CaretRight16 },
|
|
136
145
|
props: {
|
|
137
146
|
backwardText: { type: String, default: 'Prev page' },
|
|
138
147
|
forwardText: { type: String, default: 'Next page' },
|
|
139
148
|
pageNumberLabel: { type: String, default: 'Page number:' },
|
|
140
|
-
pageSizesLabel: { type: String, default: '
|
|
149
|
+
pageSizesLabel: { type: String, default: 'Items per page:' },
|
|
141
150
|
numberOfItems: { type: Number, default: Infinity },
|
|
142
151
|
page: Number,
|
|
143
152
|
pageSizes: { type: Array, default: () => [10, 20, 30, 40, 50] },
|
|
144
153
|
},
|
|
145
154
|
data() {
|
|
146
155
|
return {
|
|
156
|
+
componentsX,
|
|
147
157
|
firstItem: 1,
|
|
148
158
|
pageValue: 1,
|
|
149
159
|
pageSizeValue: 10,
|
|
@@ -157,16 +167,14 @@ export default {
|
|
|
157
167
|
this.pageValue = newPageValue(this.page, this.pageCount);
|
|
158
168
|
this.pages = newPagesArray(this.pageCount);
|
|
159
169
|
this.firstItem = newFirstItem(this.pageValue, this.pageSizeValue);
|
|
170
|
+
// console.log(this.pageValue);
|
|
160
171
|
},
|
|
161
172
|
watch: {
|
|
162
173
|
numberOfItems() {
|
|
163
174
|
this.pageCount = newPageCount(this.numberOfItems, this.pageSizeValue);
|
|
164
175
|
this.pages = newPagesArray(this.pageCount);
|
|
165
|
-
this.pageValue = Math.
|
|
166
|
-
|
|
167
|
-
Math.ceil(this.firstItem / this.pageSizeValue)
|
|
168
|
-
);
|
|
169
|
-
this.firstItem = 1 + (this.pageValue - 1) * this.pageSizeValue;
|
|
176
|
+
this.pageValue = Math.max(this.pageCount, Math.ceil(this.firstItem / this.pageSizeValue));
|
|
177
|
+
this.firstItem = Math.max(0, 1 + (this.pageValue - 1) * this.pageSizeValue);
|
|
170
178
|
},
|
|
171
179
|
page() {
|
|
172
180
|
this.pageValue = newPageValue(this.page, this.pageCount);
|
|
@@ -182,22 +190,29 @@ export default {
|
|
|
182
190
|
},
|
|
183
191
|
},
|
|
184
192
|
computed: {
|
|
193
|
+
noWayBack() {
|
|
194
|
+
return this.pageValue === 1;
|
|
195
|
+
},
|
|
196
|
+
noWayForward() {
|
|
197
|
+
return this.pageValue === this.pageCount;
|
|
198
|
+
},
|
|
185
199
|
pageOfPages() {
|
|
186
200
|
// console.log(this.pageValue, this.pageCount);
|
|
187
201
|
if (this.numberOfItems !== Infinity) {
|
|
188
|
-
|
|
202
|
+
if (this.componentsX) {
|
|
203
|
+
return `of ${this.pageCount} pages`;
|
|
204
|
+
} else {
|
|
205
|
+
return `${this.pageValue} of ${this.pageCount}`;
|
|
206
|
+
}
|
|
189
207
|
}
|
|
190
208
|
return '';
|
|
191
209
|
},
|
|
192
210
|
rangeText() {
|
|
193
211
|
const start = this.firstItem;
|
|
194
|
-
const end = Math.min(
|
|
195
|
-
start + parseInt(this.pageSizeValue, 10) - 1,
|
|
196
|
-
this.numberOfItems
|
|
197
|
-
);
|
|
212
|
+
const end = Math.min(start + parseInt(this.pageSizeValue, 10) - 1, this.numberOfItems);
|
|
198
213
|
|
|
199
214
|
if (this.numberOfItems !== Infinity) {
|
|
200
|
-
return `${start}-${end} of ${this.numberOfItems}`;
|
|
215
|
+
return `${start}-${end} of ${this.numberOfItems} items`;
|
|
201
216
|
} else {
|
|
202
217
|
return `${start}-${end}`;
|
|
203
218
|
}
|
|
@@ -243,4 +258,8 @@ export default {
|
|
|
243
258
|
};
|
|
244
259
|
</script>
|
|
245
260
|
|
|
246
|
-
<style lang="scss"
|
|
261
|
+
<style lang="scss">
|
|
262
|
+
.bx--pagination .bx--select .bx--select-input ~ .bx--select__arrow {
|
|
263
|
+
position: absolute;
|
|
264
|
+
}
|
|
265
|
+
</style>
|
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
<template functional>
|
|
2
|
-
<svg
|
|
3
|
-
class="cv-progress-step-complete"
|
|
4
|
-
width="16"
|
|
5
|
-
height="16"
|
|
6
|
-
viewBox="0 0 16 16"
|
|
7
|
-
>
|
|
2
|
+
<svg class="cv-progress-step-complete" width="16" height="16" viewBox="0 0 16 16">
|
|
8
3
|
<g fill-rule="nonzero">
|
|
9
|
-
<path
|
|
10
|
-
|
|
11
|
-
></path>
|
|
12
|
-
<path
|
|
13
|
-
d="M11.646 5.146l.708.708-5.604 5.603-3.104-3.103.708-.708 2.396 2.397z"
|
|
14
|
-
></path>
|
|
4
|
+
<path d="M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14zm0 1A8 8 0 1 1 8 0a8 8 0 0 1 0 16z"></path>
|
|
5
|
+
<path d="M11.646 5.146l.708.708-5.604 5.603-3.104-3.103.708-.708 2.396 2.397z"></path>
|
|
15
6
|
</g>
|
|
16
7
|
</svg>
|
|
17
8
|
</template>
|