@carbon/vue 3.0.23 → 3.0.25
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/dist/carbon-vue-3.common.js +865 -1922
- package/dist/carbon-vue-3.common.js.map +1 -1
- package/dist/carbon-vue-3.umd.js +865 -1922
- package/dist/carbon-vue-3.umd.js.map +1 -1
- package/dist/carbon-vue-3.umd.min.js +4 -4
- package/dist/carbon-vue-3.umd.min.js.map +1 -1
- package/dist/web-types.json +5602 -0
- package/package.json +7 -7
- package/src/components/CvAccordion/CvAccordionItem.vue +1 -7
- package/src/components/CvDataTable/CvDataTable.vue +14 -7
- package/src/components/CvDataTable/CvDataTableRow.vue +5 -5
- package/src/components/CvDataTable/_CvDataTableRowInner.vue +10 -1
- package/src/components/CvDataTable/index.js +14 -1
- package/src/components/CvFileUploader/CvFileUploader.stories.mdx +2 -1
- package/src/components/CvFileUploader/CvFileUploader.vue +9 -1
- package/src/components/CvMultiSelect/CvMultiSelect.vue +9 -8
- package/src/components/CvNumberInput/CvNumberInput.stories.js +5 -0
- package/src/components/CvNumberInput/CvNumberInput.vue +22 -5
- package/src/components/CvNumberInput/const.js +1 -0
- package/src/components/CvPagination/CvPagination.stories.mdx +1 -0
- package/src/components/CvPagination/CvPagination.vue +6 -1
- package/src/components/CvRadioButton/__tests__/__snapshots__/CvRadioButton.spec.js.snap +2 -2
- package/src/components/CvTextInput/CvTextInput.stories.js +7 -10
- package/src/components/CvTextInput/CvTextInput.vue +15 -1
- package/src/components/CvTextInput/const.js +1 -0
- package/src/components/CvTooltip/__tests__/__snapshots__/CvTooltip.spec.js.snap +18 -18
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/vue",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.25",
|
|
5
5
|
"description": "A collection of components for the Carbon Design System built using Vue.js",
|
|
6
6
|
"packageManager": "yarn@3.2.0",
|
|
7
7
|
"main": "dist/carbon-vue-3.umd.min.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"storybook"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@carbon/icons-vue": "^10.
|
|
32
|
+
"@carbon/icons-vue": "^10.102.0",
|
|
33
33
|
"@ibm/telemetry-js": "^1.5.1",
|
|
34
34
|
"@vueuse/core": "^4.11.2",
|
|
35
35
|
"carbon-components": "^10.58.5",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"@vue/cli-plugin-eslint": "^5.0.8",
|
|
51
51
|
"@vue/cli-plugin-unit-jest": "^5.0.8",
|
|
52
52
|
"@vue/cli-service": "^5.0.8",
|
|
53
|
-
"@vue/compiler-sfc": "^3.
|
|
53
|
+
"@vue/compiler-sfc": "^3.5.13",
|
|
54
54
|
"@vue/eslint-config-prettier": "^10.1.0",
|
|
55
|
-
"@vue/test-utils": "^2.
|
|
55
|
+
"@vue/test-utils": "^2.4.6",
|
|
56
56
|
"@vue/vue3-jest": "^27.0.0",
|
|
57
57
|
"accessibility-checker": "^3.1.59",
|
|
58
58
|
"babel-core": "^6.26.3",
|
|
@@ -72,14 +72,14 @@
|
|
|
72
72
|
"prettier": "^2.8.0",
|
|
73
73
|
"sass": "^1.56.1",
|
|
74
74
|
"sass-loader": "^16.0.2",
|
|
75
|
-
"storybook": "^6.5.
|
|
75
|
+
"storybook": "^6.5.16",
|
|
76
76
|
"style-loader": "^3.3.1",
|
|
77
77
|
"stylelint": "^14.15.0",
|
|
78
78
|
"stylelint-config-property-sort-order-smacss": "^9.0.0",
|
|
79
79
|
"stylelint-config-sass-guidelines": "^9.0.1",
|
|
80
|
-
"vue": "^3.
|
|
80
|
+
"vue": "^3.5.13",
|
|
81
81
|
"vue-docgen-web-types": "^0.1.8",
|
|
82
|
-
"vue-loader": "^17.
|
|
82
|
+
"vue-loader": "^17.4.2",
|
|
83
83
|
"webpack": "^5.75.0"
|
|
84
84
|
},
|
|
85
85
|
"eslintConfig": {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<li
|
|
3
|
+
data-allow-mismatch="children"
|
|
3
4
|
data-accordion-item
|
|
4
5
|
class="cv-accordion-item"
|
|
5
6
|
:class="[
|
|
6
7
|
`${carbonPrefix}--accordion__item`,
|
|
7
|
-
|
|
8
8
|
{
|
|
9
9
|
[`${carbonPrefix}--accordion__item--disabled`]: disabled,
|
|
10
10
|
[`${carbonPrefix}--accordion__item--active`]: isOpen,
|
|
@@ -23,17 +23,11 @@
|
|
|
23
23
|
@click.prevent.stop="onClick"
|
|
24
24
|
>
|
|
25
25
|
<ChevronRight16 :class="`${carbonPrefix}--accordion__arrow`" />
|
|
26
|
-
|
|
27
26
|
<p :class="`${carbonPrefix}--accordion__title`">
|
|
28
|
-
<!-- @slot title of the accordion item -->
|
|
29
|
-
|
|
30
27
|
<slot name="title"></slot>
|
|
31
28
|
</p>
|
|
32
29
|
</button>
|
|
33
|
-
|
|
34
30
|
<div :id="cvId" :class="`${carbonPrefix}--accordion__content`">
|
|
35
|
-
<!-- @slot content of accordion item -->
|
|
36
|
-
|
|
37
31
|
<slot name="content"></slot>
|
|
38
32
|
</div>
|
|
39
33
|
</li>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :id="
|
|
2
|
+
<div :id="cvId" :style="tableStyle" class="cv-data-table">
|
|
3
3
|
<div
|
|
4
4
|
:class="[
|
|
5
5
|
`${carbonPrefix}--data-table-container`,
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
<div
|
|
56
56
|
v-if="onSearch"
|
|
57
57
|
ref="searchContainer"
|
|
58
|
-
:aria-labelledby="`${
|
|
58
|
+
:aria-labelledby="`${cvId}-search`"
|
|
59
59
|
:class="[
|
|
60
60
|
`${carbonPrefix}--search `,
|
|
61
61
|
{
|
|
@@ -73,20 +73,20 @@
|
|
|
73
73
|
<Search16 :class="`${carbonPrefix}--search-magnifier-icon`" />
|
|
74
74
|
</div>
|
|
75
75
|
<label
|
|
76
|
-
:id="`${
|
|
77
|
-
:for="`searchbox-${
|
|
76
|
+
:id="`${cvId}-search`"
|
|
77
|
+
:for="`searchbox-${cvId}`"
|
|
78
78
|
:class="`${carbonPrefix}--label`"
|
|
79
79
|
>{{ searchLabel }}</label
|
|
80
80
|
>
|
|
81
81
|
<input
|
|
82
|
-
:id="`searchbox-${
|
|
82
|
+
:id="`searchbox-${cvId}`"
|
|
83
83
|
ref="search"
|
|
84
84
|
v-model="searchValue"
|
|
85
85
|
:class="`${carbonPrefix}--search-input`"
|
|
86
86
|
type="text"
|
|
87
87
|
role="searchbox"
|
|
88
88
|
:placeholder="searchPlaceholder"
|
|
89
|
-
:aria-labelledby="`searchbox-${
|
|
89
|
+
:aria-labelledby="`searchbox-${cvId}`"
|
|
90
90
|
@input="onInternalSearch"
|
|
91
91
|
@click="checkSearchExpand(true)"
|
|
92
92
|
@keydown.esc.prevent="checkSearchExpand(false)"
|
|
@@ -160,6 +160,7 @@
|
|
|
160
160
|
<cv-checkbox-skeleton v-if="isSkeleton" />
|
|
161
161
|
<cv-checkbox
|
|
162
162
|
v-else
|
|
163
|
+
:id="`${cvId}-headingCheck`"
|
|
163
164
|
v-model="headingChecked"
|
|
164
165
|
:form-item="false"
|
|
165
166
|
value="headingCheck"
|
|
@@ -187,6 +188,7 @@
|
|
|
187
188
|
<slot name="data">
|
|
188
189
|
<cv-data-table-row
|
|
189
190
|
v-for="(row, rowIndex) in data"
|
|
191
|
+
:id="`${cvId}-${rowIndex}`"
|
|
190
192
|
:key="`row:${rowIndex}`"
|
|
191
193
|
ref="dataRows"
|
|
192
194
|
:value="`${rowIndex}`"
|
|
@@ -211,6 +213,7 @@
|
|
|
211
213
|
<cv-pagination
|
|
212
214
|
v-if="pagination"
|
|
213
215
|
v-bind="internalPagination"
|
|
216
|
+
:id="`${cvId}-pagination`"
|
|
214
217
|
:number-of-items="internalNumberOfItems"
|
|
215
218
|
@change="$emit('pagination', $event)"
|
|
216
219
|
>
|
|
@@ -343,7 +346,7 @@ const props = defineProps({
|
|
|
343
346
|
onSearch: { type: Function, default: undefined },
|
|
344
347
|
...propsCvId,
|
|
345
348
|
});
|
|
346
|
-
const
|
|
349
|
+
const cvId = useCvId(props, true);
|
|
347
350
|
|
|
348
351
|
const isSkeleton = ref(props.skeleton);
|
|
349
352
|
provide('is-skeleton', isSkeleton);
|
|
@@ -361,12 +364,16 @@ const search = ref(null);
|
|
|
361
364
|
/** @type {Ref<Set<String>>} */
|
|
362
365
|
const expandingRowIds = ref(new Set());
|
|
363
366
|
provide('expanding-row-ids', expandingRowIds);
|
|
367
|
+
|
|
368
|
+
const tableExpandable = ref(props.expandable);
|
|
369
|
+
provide('table-expandable', tableExpandable);
|
|
364
370
|
onMounted(() => {
|
|
365
371
|
if (props.expandable) expandingRowIds.value.add('table-expand-row');
|
|
366
372
|
});
|
|
367
373
|
watch(
|
|
368
374
|
() => props.expandable,
|
|
369
375
|
() => {
|
|
376
|
+
tableExpandable.value = props.expandable;
|
|
370
377
|
if (props.expandable) expandingRowIds.value.add('table-expand-row');
|
|
371
378
|
else expandingRowIds.value.delete('table-expand-row');
|
|
372
379
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<tbody
|
|
3
|
-
v-if="
|
|
3
|
+
v-if="tableExpandable"
|
|
4
4
|
:id="cvId"
|
|
5
5
|
class="cv-data-table-row cv-data-table-row--expandable"
|
|
6
6
|
>
|
|
7
7
|
<cv-data-table-row-inner
|
|
8
|
+
:id="`${cvId}-ri`"
|
|
8
9
|
ref="row"
|
|
9
10
|
:row-id="cvId"
|
|
10
11
|
v-bind="$attrs"
|
|
@@ -75,9 +76,11 @@ watch(
|
|
|
75
76
|
() => (rowValue.value = props.value)
|
|
76
77
|
);
|
|
77
78
|
|
|
79
|
+
/** @type {Ref<boolean>} */
|
|
80
|
+
const tableExpandable = inject('table-expandable', ref(false));
|
|
78
81
|
/** @type {Ref<Set<String>>} */
|
|
79
82
|
const expandingRowIds = inject('expanding-row-ids', ref(new Set()));
|
|
80
|
-
const dataExpandable = ref(
|
|
83
|
+
const dataExpandable = ref(tableExpandable.value);
|
|
81
84
|
watch(dataExpandable, value => {
|
|
82
85
|
if (value && !expandingRowIds.value.has('table-expand-row')) {
|
|
83
86
|
console.warn(
|
|
@@ -87,9 +90,6 @@ watch(dataExpandable, value => {
|
|
|
87
90
|
if (dataExpandable.value) expandingRowIds.value.add(cvId.value);
|
|
88
91
|
else expandingRowIds.value?.delete(cvId.value);
|
|
89
92
|
});
|
|
90
|
-
const dataSomeExpandingRows = computed(() => {
|
|
91
|
-
return expandingRowIds.value?.size > 0;
|
|
92
|
-
});
|
|
93
93
|
const attrs = useAttrs();
|
|
94
94
|
const rowIds = inject('row-ids', ref(new Set()));
|
|
95
95
|
const expandedRowIds = inject('expanded-row-ids', ref(new Set()));
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
<cv-checkbox-skeleton v-if="isSkeleton" />
|
|
30
30
|
<cv-checkbox
|
|
31
31
|
v-else
|
|
32
|
+
:id="`${cvId}-row-checked`"
|
|
32
33
|
ref="rowChecked"
|
|
33
34
|
v-model="dataChecked"
|
|
34
35
|
:form-item="false"
|
|
@@ -43,7 +44,10 @@
|
|
|
43
44
|
</td>
|
|
44
45
|
<slot />
|
|
45
46
|
<td v-if="hasOverflowMenu" :class="`${carbonPrefix}--table-column-menu`">
|
|
46
|
-
<cv-overflow-menu
|
|
47
|
+
<cv-overflow-menu
|
|
48
|
+
v-bind="overflowMenuOptions"
|
|
49
|
+
:id="`${cvId}-overflow-menu`"
|
|
50
|
+
>
|
|
47
51
|
<cv-overflow-menu-item
|
|
48
52
|
v-for="(item, index) in overflowMenuButtons"
|
|
49
53
|
:key="`${index}`"
|
|
@@ -75,7 +79,9 @@ import {
|
|
|
75
79
|
useSlots,
|
|
76
80
|
watch,
|
|
77
81
|
inject,
|
|
82
|
+
useAttrs,
|
|
78
83
|
} from 'vue';
|
|
84
|
+
import { useCvId } from '../../use/cvId';
|
|
79
85
|
|
|
80
86
|
const props = defineProps({
|
|
81
87
|
ariaLabelForBatchCheckbox: { type: String, default: undefined },
|
|
@@ -89,6 +95,9 @@ const props = defineProps({
|
|
|
89
95
|
rowId: { type: String, default: undefined },
|
|
90
96
|
});
|
|
91
97
|
|
|
98
|
+
const attrs = useAttrs();
|
|
99
|
+
const cvId = useCvId(attrs, true);
|
|
100
|
+
|
|
92
101
|
const isSkeleton = inject('is-skeleton', ref(false));
|
|
93
102
|
/** @type {Ref<UnwrapRef<Set<>>>} */
|
|
94
103
|
const expandingRowIds = inject('expanding-row-ids', ref(new Set()));
|
|
@@ -1,3 +1,16 @@
|
|
|
1
1
|
import CvDataTable from './CvDataTable.vue';
|
|
2
|
-
|
|
2
|
+
import CvDataTableAction from './CvDataTableAction.vue';
|
|
3
|
+
import CvDataTableCell from './CvDataTableCell.vue';
|
|
4
|
+
import CvDataTableHeading from './CvDataTableHeading.vue';
|
|
5
|
+
import CvDataTableRow from './CvDataTableRow.vue';
|
|
6
|
+
import CvDataTableSkeleton from './CvDataTableSkeleton.vue';
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
CvDataTable,
|
|
10
|
+
CvDataTableAction,
|
|
11
|
+
CvDataTableCell,
|
|
12
|
+
CvDataTableHeading,
|
|
13
|
+
CvDataTableSkeleton,
|
|
14
|
+
CvDataTableRow,
|
|
15
|
+
};
|
|
3
16
|
export default CvDataTable;
|
|
@@ -112,9 +112,10 @@ export const argTypes = {
|
|
|
112
112
|
// attributes
|
|
113
113
|
multiple: {
|
|
114
114
|
type: 'boolean',
|
|
115
|
+
defaultValue: true,
|
|
115
116
|
table: {
|
|
116
117
|
type: { summary: 'boolean' },
|
|
117
|
-
category: '
|
|
118
|
+
category: 'props',
|
|
118
119
|
},
|
|
119
120
|
description: 'standard input attribute for file type, allow multiple files to be added in a single prompt',
|
|
120
121
|
},
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
:disabled="disabled || null"
|
|
38
38
|
type="file"
|
|
39
39
|
v-bind="$attrs"
|
|
40
|
+
:multiple="multiple"
|
|
40
41
|
data-file-uploader
|
|
41
42
|
data-target="[data-file-container]"
|
|
42
43
|
@change="onChange"
|
|
@@ -73,6 +74,7 @@
|
|
|
73
74
|
:disabled="disabled || null"
|
|
74
75
|
type="file"
|
|
75
76
|
v-bind="$attrs"
|
|
77
|
+
:multiple="multiple"
|
|
76
78
|
tabindex="-1"
|
|
77
79
|
data-file-uploader
|
|
78
80
|
data-target="[data-file-container]"
|
|
@@ -147,6 +149,7 @@ const props = defineProps({
|
|
|
147
149
|
},
|
|
148
150
|
label: { type: String, default: undefined },
|
|
149
151
|
modelValue: { type: Array, default: () => [] },
|
|
152
|
+
multiple: { type: Boolean, default: true },
|
|
150
153
|
removable: Boolean,
|
|
151
154
|
removeAriaLabel: { type: String, default: undefined },
|
|
152
155
|
...cvIdProps,
|
|
@@ -271,7 +274,12 @@ function onDragEvent(evt) {
|
|
|
271
274
|
|
|
272
275
|
if (evt.type === 'drop') {
|
|
273
276
|
evt.preventDefault();
|
|
274
|
-
|
|
277
|
+
if (props.multiple) {
|
|
278
|
+
addFiles(evt.dataTransfer.files);
|
|
279
|
+
} else {
|
|
280
|
+
internalFiles.value = [];
|
|
281
|
+
addFiles([evt.dataTransfer.files[0]]);
|
|
282
|
+
}
|
|
275
283
|
allowDrop.value = false;
|
|
276
284
|
}
|
|
277
285
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
>
|
|
17
17
|
<label
|
|
18
18
|
v-if="title"
|
|
19
|
-
:id="`${
|
|
19
|
+
:id="`${cvId}-label`"
|
|
20
20
|
:class="[
|
|
21
21
|
`${carbonPrefix}--label`,
|
|
22
22
|
{ [`${carbonPrefix}--label--disabled`]: disabled },
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
>{{ title }}</label
|
|
25
25
|
>
|
|
26
26
|
<div
|
|
27
|
-
:aria-labelledby="`${
|
|
27
|
+
:aria-labelledby="`${cvId}-label`"
|
|
28
28
|
role="listbox"
|
|
29
29
|
tabindex="-1"
|
|
30
30
|
:class="[
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
:aria-disabled="disabled || null"
|
|
69
69
|
aria-haspopup="listbox"
|
|
70
70
|
:aria-expanded="data.open ? 'true' : 'false'"
|
|
71
|
-
:aria-owns="
|
|
72
|
-
:aria-controls="
|
|
71
|
+
:aria-owns="cvId"
|
|
72
|
+
:aria-controls="cvId"
|
|
73
73
|
tabindex="0"
|
|
74
74
|
:aria-label="data.open ? 'close menu' : 'open menu'"
|
|
75
75
|
data-toggle="true"
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
!internalFilter || internalFilter.length === 0,
|
|
106
106
|
},
|
|
107
107
|
]"
|
|
108
|
-
:aria-controls="
|
|
108
|
+
:aria-controls="cvId"
|
|
109
109
|
aria-autocomplete="list"
|
|
110
110
|
role="combobox"
|
|
111
111
|
:aria-expanded="data.open ? 'true' : 'false'"
|
|
@@ -141,9 +141,9 @@
|
|
|
141
141
|
</button>
|
|
142
142
|
|
|
143
143
|
<div
|
|
144
|
-
:id="
|
|
144
|
+
:id="cvId"
|
|
145
145
|
ref="elList"
|
|
146
|
-
:aria-labelledby="`${
|
|
146
|
+
:aria-labelledby="`${cvId}-label`"
|
|
147
147
|
:class="`${carbonPrefix}--list-box__menu`"
|
|
148
148
|
role="listbox"
|
|
149
149
|
>
|
|
@@ -168,6 +168,7 @@
|
|
|
168
168
|
:title="item.label"
|
|
169
169
|
>
|
|
170
170
|
<cv-checkbox
|
|
171
|
+
:id="`${cvId}-cb-${item.value}`"
|
|
171
172
|
v-model="data.selectedItems"
|
|
172
173
|
tabindex="-1"
|
|
173
174
|
:form-item="false"
|
|
@@ -359,7 +360,7 @@ const props = defineProps({
|
|
|
359
360
|
...propsCvId,
|
|
360
361
|
...propsTheme,
|
|
361
362
|
});
|
|
362
|
-
const
|
|
363
|
+
const cvId = useCvId(props, true);
|
|
363
364
|
const isLight = useIsLight(props);
|
|
364
365
|
|
|
365
366
|
const data = reactive({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ref } from 'vue';
|
|
2
2
|
import { storyParametersObject } from '../../global/storybook-utils';
|
|
3
3
|
import CvNumberInput from './CvNumberInput.vue';
|
|
4
|
+
import { sizeTypes } from './const';
|
|
4
5
|
|
|
5
6
|
export default {
|
|
6
7
|
title: 'Component/CvNumberInput',
|
|
@@ -55,6 +56,10 @@ export default {
|
|
|
55
56
|
},
|
|
56
57
|
description: '`step` attribute for input HTML element',
|
|
57
58
|
},
|
|
59
|
+
size: {
|
|
60
|
+
type: 'select',
|
|
61
|
+
options: Array.from(sizeTypes),
|
|
62
|
+
},
|
|
58
63
|
// props
|
|
59
64
|
formItem: {
|
|
60
65
|
type: 'boolean',
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
{
|
|
11
11
|
[`${carbonPrefix}--number--light`]: isLight,
|
|
12
12
|
[`${carbonPrefix}--number--helpertext`]: isHelper,
|
|
13
|
+
[`${carbonPrefix}--number--sm`]: size === 'sm',
|
|
14
|
+
[`${carbonPrefix}--number--md`]: size === 'md',
|
|
15
|
+
[`${carbonPrefix}--number--lg`]: size === 'lg',
|
|
13
16
|
[`cv-number-input`]: !formItem,
|
|
14
17
|
},
|
|
15
18
|
]"
|
|
@@ -105,12 +108,13 @@ import { props as propsTheme } from '../../use/cvTheme';
|
|
|
105
108
|
import { useCvInputHelpers } from '../../use/cvInput';
|
|
106
109
|
import { carbonPrefix } from '../../global/settings';
|
|
107
110
|
import CvWrapper from '../CvWrapper/CvWrapper';
|
|
111
|
+
import { sizeTypes } from './const';
|
|
108
112
|
|
|
109
113
|
const props = defineProps({
|
|
110
114
|
disabled: Boolean,
|
|
111
115
|
modelValue: {
|
|
112
116
|
type: [String, Number],
|
|
113
|
-
default:
|
|
117
|
+
default: undefined,
|
|
114
118
|
},
|
|
115
119
|
formItem: {
|
|
116
120
|
type: Boolean,
|
|
@@ -148,6 +152,15 @@ const props = defineProps({
|
|
|
148
152
|
type: [String, Number],
|
|
149
153
|
default: undefined,
|
|
150
154
|
},
|
|
155
|
+
/** Specify the size of the Text Input. Currently, supports the following:
|
|
156
|
+
`sm`,
|
|
157
|
+
`md`,
|
|
158
|
+
`lg` */
|
|
159
|
+
size: {
|
|
160
|
+
type: String,
|
|
161
|
+
default: undefined,
|
|
162
|
+
validator: value => sizeTypes.has(value),
|
|
163
|
+
},
|
|
151
164
|
warnText: {
|
|
152
165
|
type: String,
|
|
153
166
|
default: undefined,
|
|
@@ -177,18 +190,22 @@ const modelValueType = typeof props.modelValue;
|
|
|
177
190
|
const valuesToNaN = ['', null, undefined];
|
|
178
191
|
|
|
179
192
|
const formatInputValueType = value => {
|
|
180
|
-
if (modelValueType === 'string') return value.toString();
|
|
193
|
+
if (modelValueType === 'string') return Number(value).toString();
|
|
181
194
|
// According to Vue2 component if there is no value NaN is emitted
|
|
182
195
|
return valuesToNaN.includes(value) ? NaN : Number(value);
|
|
183
196
|
};
|
|
184
197
|
|
|
198
|
+
const displayValue = ref(props.modelValue || props.min);
|
|
185
199
|
const internalValue = computed({
|
|
186
200
|
get() {
|
|
187
|
-
return props.modelValue;
|
|
201
|
+
return props.modelValue || displayValue.value;
|
|
188
202
|
},
|
|
189
203
|
set(value) {
|
|
190
|
-
|
|
191
|
-
|
|
204
|
+
displayValue.value = formatInputValueType(value);
|
|
205
|
+
if (typeof value === 'string') {
|
|
206
|
+
input.value.value = '';
|
|
207
|
+
}
|
|
208
|
+
onInput(displayValue.value);
|
|
192
209
|
},
|
|
193
210
|
});
|
|
194
211
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const sizeTypes = new Set(['sm', 'md', 'lg']);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<div :class="`cv-pagination ${carbonPrefix}--pagination`" data-pagination>
|
|
3
3
|
<div :class="`${carbonPrefix}--pagination__left`">
|
|
4
4
|
<cv-select
|
|
5
|
+
:id="`${cvId}-select-page-size`"
|
|
5
6
|
ref="pageSizeSelect"
|
|
6
7
|
:class="`${carbonPrefix}--select__item-count`"
|
|
7
8
|
:label="pageSizesLabel"
|
|
@@ -29,6 +30,7 @@
|
|
|
29
30
|
<div :class="`${carbonPrefix}--pagination__right`">
|
|
30
31
|
<cv-select
|
|
31
32
|
v-if="numberOfItems !== Infinity"
|
|
33
|
+
:id="`${cvId}-select-page`"
|
|
32
34
|
ref="pageSelect"
|
|
33
35
|
:class="`${carbonPrefix}--select__page-number`"
|
|
34
36
|
:label="pageNumberLabel"
|
|
@@ -82,10 +84,11 @@
|
|
|
82
84
|
|
|
83
85
|
<script setup>
|
|
84
86
|
import { carbonPrefix } from '../../global/settings';
|
|
85
|
-
import { computed, nextTick, onMounted, ref, watch } from 'vue';
|
|
87
|
+
import { computed, nextTick, onMounted, ref, useAttrs, watch } from 'vue';
|
|
86
88
|
import { CaretLeft16, CaretRight16 } from '@carbon/icons-vue';
|
|
87
89
|
import CvSelect from '../CvSelect';
|
|
88
90
|
import CvSelectOption from '../CvSelect/CvSelectOption.vue';
|
|
91
|
+
import { useCvId } from '../../use/cvId';
|
|
89
92
|
|
|
90
93
|
const emit = defineEmits(['change']);
|
|
91
94
|
|
|
@@ -101,6 +104,8 @@ const props = defineProps({
|
|
|
101
104
|
page: { type: Number, default: undefined },
|
|
102
105
|
pageSizes: { type: Array, default: () => [10, 20, 30, 40, 50] },
|
|
103
106
|
});
|
|
107
|
+
const attrs = useAttrs();
|
|
108
|
+
const cvId = useCvId(attrs, true);
|
|
104
109
|
|
|
105
110
|
const firstItem = ref(1);
|
|
106
111
|
const pageValue = ref(1);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`CvRadioButton matches render when checked 1`] = `<div class="cv-radio-button bx--radio-button-wrapper"><input id="1" class="bx--radio-button" type="radio" value=""><!-- symbol causes problem in codepen? --><label for="1" class="bx--radio-button__label"><span class="bx--radio-button__appearance"></span><span class="">test label</span></label></div>`;
|
|
3
|
+
exports[`CvRadioButton matches render when checked 1`] = `<div class="cv-radio-button bx--radio-button-wrapper"><input id="1" checked="" class="bx--radio-button" type="radio" value=""><!-- symbol causes problem in codepen? --><label for="1" class="bx--radio-button__label"><span class="bx--radio-button__appearance"></span><span class="">test label</span></label></div>`;
|
|
4
4
|
|
|
5
|
-
exports[`CvRadioButton matches render when modelValue is equal to value 1`] = `<div class="cv-radio-button bx--radio-button-wrapper"><input id="1" class="bx--radio-button" type="radio" value="test value"><!-- symbol causes problem in codepen? --><label for="1" class="bx--radio-button__label"><span class="bx--radio-button__appearance"></span><span class="">test label</span></label></div>`;
|
|
5
|
+
exports[`CvRadioButton matches render when modelValue is equal to value 1`] = `<div class="cv-radio-button bx--radio-button-wrapper"><input id="1" checked="" class="bx--radio-button" type="radio" value="test value"><!-- symbol causes problem in codepen? --><label for="1" class="bx--radio-button__label"><span class="bx--radio-button__appearance"></span><span class="">test label</span></label></div>`;
|
|
6
6
|
|
|
7
7
|
exports[`CvRadioButton matches render when modelValue is not equal to value 1`] = `<div class="cv-radio-button bx--radio-button-wrapper"><input id="1" class="bx--radio-button" type="radio" value="test value"><!-- symbol causes problem in codepen? --><label for="1" class="bx--radio-button__label"><span class="bx--radio-button__appearance"></span><span class="">test label</span></label></div>`;
|
|
8
8
|
|
|
@@ -2,6 +2,7 @@ import { storyParametersObject } from '../../global/storybook-utils';
|
|
|
2
2
|
|
|
3
3
|
import { CvTextInput, CvTextInputSkeleton } from '.';
|
|
4
4
|
import { ref } from 'vue';
|
|
5
|
+
import { sizeTypes, inputTypes } from './const';
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
title: 'Component/CvTextInput',
|
|
@@ -92,17 +93,13 @@ export default {
|
|
|
92
93
|
category: 'props',
|
|
93
94
|
},
|
|
94
95
|
},
|
|
96
|
+
size: {
|
|
97
|
+
type: 'select',
|
|
98
|
+
options: Array.from(sizeTypes),
|
|
99
|
+
},
|
|
95
100
|
type: {
|
|
96
|
-
type: '
|
|
97
|
-
|
|
98
|
-
type: { summary: 'string' },
|
|
99
|
-
category: 'props',
|
|
100
|
-
defaultValue: { summary: 'text' },
|
|
101
|
-
},
|
|
102
|
-
options: ['text', 'password'],
|
|
103
|
-
control: {
|
|
104
|
-
type: 'select',
|
|
105
|
-
},
|
|
101
|
+
type: 'select',
|
|
102
|
+
options: Array.from(inputTypes),
|
|
106
103
|
},
|
|
107
104
|
warnText: {
|
|
108
105
|
type: 'string',
|
|
@@ -44,6 +44,10 @@
|
|
|
44
44
|
[`${carbonPrefix}--text-input--light`]: isLight,
|
|
45
45
|
[`${carbonPrefix}--text-input--warning`]: isWarn,
|
|
46
46
|
[`${carbonPrefix}--password-input`]: isPassword,
|
|
47
|
+
[`${carbonPrefix}--text-input--sm`]: size === 'sm',
|
|
48
|
+
[`${carbonPrefix}--text-input--md`]: size === 'md',
|
|
49
|
+
[`${carbonPrefix}--text-input--lg`]: size === 'lg',
|
|
50
|
+
[`${carbonPrefix}--text-input--xl`]: size === 'xl',
|
|
47
51
|
},
|
|
48
52
|
]"
|
|
49
53
|
v-bind="$attrs"
|
|
@@ -115,7 +119,7 @@ import {
|
|
|
115
119
|
import { carbonPrefix } from '../../global/settings';
|
|
116
120
|
import { useCvId, props as propsCvId } from '../../use/cvId';
|
|
117
121
|
import { useIsLight, props as propsTheme } from '../../use/cvTheme';
|
|
118
|
-
import { inputTypes } from './const';
|
|
122
|
+
import { inputTypes, sizeTypes } from './const';
|
|
119
123
|
|
|
120
124
|
const props = defineProps({
|
|
121
125
|
/**
|
|
@@ -150,6 +154,16 @@ const props = defineProps({
|
|
|
150
154
|
* Toggle password visibility
|
|
151
155
|
*/
|
|
152
156
|
passwordVisible: { type: Boolean, default: undefined },
|
|
157
|
+
/** Specify the size of the Text Input. Currently, supports the following:
|
|
158
|
+
`sm`,
|
|
159
|
+
`md`,
|
|
160
|
+
`lg`,
|
|
161
|
+
`xl` */
|
|
162
|
+
size: {
|
|
163
|
+
type: String,
|
|
164
|
+
default: undefined,
|
|
165
|
+
validator: value => sizeTypes.has(value),
|
|
166
|
+
},
|
|
153
167
|
/**
|
|
154
168
|
* Input type, only `text` and `password` are available
|
|
155
169
|
*/
|