@carbon/vue 3.0.22 → 3.0.24

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 (31) hide show
  1. package/README.md +2 -3
  2. package/dist/carbon-vue-3.common.js +920 -1924
  3. package/dist/carbon-vue-3.common.js.map +1 -1
  4. package/dist/carbon-vue-3.umd.js +920 -1924
  5. package/dist/carbon-vue-3.umd.js.map +1 -1
  6. package/dist/carbon-vue-3.umd.min.js +4 -4
  7. package/dist/carbon-vue-3.umd.min.js.map +1 -1
  8. package/dist/web-types.json +52 -5
  9. package/package.json +13 -10
  10. package/src/components/CvAccordion/CvAccordionItem.vue +1 -7
  11. package/src/components/CvDataTable/CvDataTable.stories.mdx +6 -22
  12. package/src/components/CvDataTable/CvDataTable.vue +16 -13
  13. package/src/components/CvDataTable/CvDataTableRow.vue +11 -6
  14. package/src/components/CvDataTable/_CvDataTableRowInner.vue +10 -1
  15. package/src/components/CvFileUploader/CvFileUploader.stories.mdx +2 -1
  16. package/src/components/CvFileUploader/CvFileUploader.vue +9 -1
  17. package/src/components/CvMultiSelect/CvMultiSelect.vue +9 -8
  18. package/src/components/CvNumberInput/CvNumberInput.stories.js +5 -0
  19. package/src/components/CvNumberInput/CvNumberInput.vue +13 -0
  20. package/src/components/CvNumberInput/const.js +1 -0
  21. package/src/components/CvPagination/CvPagination.stories.mdx +1 -0
  22. package/src/components/CvPagination/CvPagination.vue +6 -1
  23. package/src/components/CvRadioButton/__tests__/__snapshots__/CvRadioButton.spec.js.snap +2 -2
  24. package/src/components/CvTextInput/CvTextInput.stories.js +7 -10
  25. package/src/components/CvTextInput/CvTextInput.vue +15 -1
  26. package/src/components/CvTextInput/const.js +1 -0
  27. package/src/components/CvTooltip/__tests__/__snapshots__/CvTooltip.spec.js.snap +18 -18
  28. package/src/components/CvUIShell/CvContent.stories.js +22 -0
  29. package/src/components/CvUIShell/CvContent.vue +14 -0
  30. package/src/index.js +1 -0
  31. package/telemetry.yml +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "@carbon/vue",
4
- "version": "3.0.21",
4
+ "version": "3.0.23",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -74,12 +74,10 @@
74
74
  ],
75
75
  "slots": [
76
76
  {
77
- "name": "title",
78
- "description": "title of the accordion item"
77
+ "name": "title"
79
78
  },
80
79
  {
81
- "name": "content",
82
- "description": "content of accordion item"
80
+ "name": "content"
83
81
  }
84
82
  ],
85
83
  "source": {
@@ -761,6 +759,29 @@
761
759
  "symbol": "default"
762
760
  }
763
761
  },
762
+ {
763
+ "name": "CvContent",
764
+ "description": "",
765
+ "attributes": [
766
+ {
767
+ "name": "tagType",
768
+ "value": {
769
+ "kind": "expression",
770
+ "type": "string"
771
+ },
772
+ "default": "'main'"
773
+ }
774
+ ],
775
+ "slots": [
776
+ {
777
+ "name": "default"
778
+ }
779
+ ],
780
+ "source": {
781
+ "module": "./src/components/CvUIShell/CvContent.vue",
782
+ "symbol": "default"
783
+ }
784
+ },
764
785
  {
765
786
  "name": "CvContentSwitcher",
766
787
  "description": "",
@@ -1918,6 +1939,14 @@
1918
1939
  },
1919
1940
  "default": "[]"
1920
1941
  },
1942
+ {
1943
+ "name": "multiple",
1944
+ "value": {
1945
+ "kind": "expression",
1946
+ "type": "boolean"
1947
+ },
1948
+ "default": "true"
1949
+ },
1921
1950
  {
1922
1951
  "name": "removable",
1923
1952
  "value": {
@@ -3219,6 +3248,15 @@
3219
3248
  },
3220
3249
  "default": "undefined"
3221
3250
  },
3251
+ {
3252
+ "name": "size",
3253
+ "description": "Specify the size of the Text Input. Currently, supports the following:\n `sm`,\n `md`,\n `lg`",
3254
+ "value": {
3255
+ "kind": "expression",
3256
+ "type": "string"
3257
+ },
3258
+ "default": "undefined"
3259
+ },
3222
3260
  {
3223
3261
  "name": "warnText",
3224
3262
  "value": {
@@ -4985,6 +5023,15 @@
4985
5023
  },
4986
5024
  "default": "undefined"
4987
5025
  },
5026
+ {
5027
+ "name": "size",
5028
+ "description": "Specify the size of the Text Input. Currently, supports the following:\n `sm`,\n `md`,\n `lg`,\n `xl`",
5029
+ "value": {
5030
+ "kind": "expression",
5031
+ "type": "string"
5032
+ },
5033
+ "default": "undefined"
5034
+ },
4988
5035
  {
4989
5036
  "name": "type",
4990
5037
  "description": "Input type, only `text` and `password` are available",
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.22",
4
+ "version": "3.0.24",
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.60.0",
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.3.4",
54
- "@vue/eslint-config-prettier": "^7.0.0",
55
- "@vue/test-utils": "^2.2.4",
53
+ "@vue/compiler-sfc": "^3.5.13",
54
+ "@vue/eslint-config-prettier": "^10.1.0",
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",
@@ -66,20 +66,20 @@
66
66
  "husky": "^7.0.4",
67
67
  "jest": "^27.5.1",
68
68
  "lerna": "^6.5.1",
69
- "lint-staged": "^12.5.0",
69
+ "lint-staged": "^15.2.10",
70
70
  "postcss": "^8.4.19",
71
71
  "postcss-loader": "^8.1.1",
72
72
  "prettier": "^2.8.0",
73
73
  "sass": "^1.56.1",
74
74
  "sass-loader": "^16.0.2",
75
- "storybook": "^6.5.13",
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.3.4",
80
+ "vue": "^3.5.13",
81
81
  "vue-docgen-web-types": "^0.1.8",
82
- "vue-loader": "^17.0.1",
82
+ "vue-loader": "^17.4.2",
83
83
  "webpack": "^5.75.0"
84
84
  },
85
85
  "eslintConfig": {
@@ -170,7 +170,10 @@
170
170
  },
171
171
  "lint-staged": {
172
172
  "*.{scss,css,js,md,vue}": [
173
- "yarn format:staged"
173
+ "prettier --write"
174
+ ],
175
+ "*.{js,vue}": [
176
+ "eslint --fix --max-warnings 0"
174
177
  ]
175
178
  },
176
179
  "repository": {
@@ -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>
@@ -154,7 +154,7 @@ const defaultTemplate = `
154
154
  const expandingRowsTemplate = defaultTemplate.replace(
155
155
  "<!-- Add optional expanding data here -->",
156
156
  `<template #expandedContent>{{row.desc}}</template>`)
157
- .replace('@search="onSearch"', '')
157
+ .replace('@search="onSearch"', ':expandable="true"')
158
158
  .replace('testData', 'originalTestData')
159
159
  const skeletonTemplate = `
160
160
  <cv-data-table-skeleton
@@ -213,6 +213,7 @@ const vModelTemplate = defaultTemplate
213
213
  }
214
214
  ```
215
215
  - The search bar appears only if the search event is listened for.
216
+ - If your table has expanding rows, you MUST set the `expandable` property on CvTable to `true`. `<cv-table :expandable="true" ...`
216
217
 
217
218
  **Row attributes:**
218
219
  - aria-label-for-batch-checkbox: Aria label for batch checkbox. default 'Select row N for batch action'.
@@ -283,34 +284,17 @@ when no items were select, please now use the new property `stickyBatchActive`.
283
284
  <Story
284
285
  name="Expanding rows"
285
286
  parameters={{
286
- controls: { exclude: ['default',
287
- 'template',
288
- 'overflow-menu-click',
289
- 'row-expanded',
290
- 'row-select-change',
291
- 'row-select-changes',
292
- 'search',
293
- 'sort',
294
- 'actions',
295
- 'batch-actions',
296
- 'data',
297
- 'headings',
298
- 'helper-text',
299
- 'items-selected',
300
- 'of-n-pages',
301
- 'range-text',
302
- 'skeleton',
303
- 'update:rowsSelected',
304
- ] },
287
+ controls: { include: [ "helperText", "title", "hasExpandAll"] },
305
288
  docs: { source: { code: storySourceCode(expandingRowsTemplate, Template.args) } },
306
289
  }}
307
290
  args={{
308
291
  template: expandingRowsTemplate,
309
- title: 'Table with expanding rows',
292
+ title: 'Table with expanding rows - NOTE: expandable property must be set to true',
310
293
  helperText: 'Click row to expand',
311
294
  useActions: false,
312
295
  useBatchActions: false,
313
- usePagination: true
296
+ usePagination: true,
297
+ expandable: true
314
298
  }}
315
299
  argTypes={{
316
300
  rowSize: { control: 'select', default: 'standard', options: ['compact', 'short', 'standard', 'tall'] },
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div :id="uid" :style="tableStyle" class="cv-data-table">
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="`${uid}-search`"
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="`${uid}-search`"
77
- :for="`searchbox-${uid}`"
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-${uid}`"
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-${uid}`"
89
+ :aria-labelledby="`searchbox-${cvId}`"
90
90
  @input="onInternalSearch"
91
91
  @click="checkSearchExpand(true)"
92
92
  @keydown.esc.prevent="checkSearchExpand(false)"
@@ -132,7 +132,7 @@
132
132
  <thead>
133
133
  <tr>
134
134
  <th
135
- v-if="hasExpandingRows"
135
+ v-if="expandable"
136
136
  :class="`${carbonPrefix}--table-expand`"
137
137
  :data-previous-value="
138
138
  dataExpandAll ? 'collapsed' : 'expanded'
@@ -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"
@@ -183,10 +184,11 @@
183
184
  </tr>
184
185
  </thead>
185
186
 
186
- <component :is="hasExpandingRows ? Empty : 'tbody'">
187
+ <component :is="expandable ? Empty : 'tbody'">
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 uid = useCvId(props, true);
349
+ const cvId = useCvId(props, true);
347
350
 
348
351
  const isSkeleton = ref(props.skeleton);
349
352
  provide('is-skeleton', isSkeleton);
@@ -360,17 +363,17 @@ const search = ref(null);
360
363
 
361
364
  /** @type {Ref<Set<String>>} */
362
365
  const expandingRowIds = ref(new Set());
363
- const hasExpandingRows = computed(() => {
364
- return expandingRowIds.value.size > 0;
365
- });
366
366
  provide('expanding-row-ids', expandingRowIds);
367
- provide('has-expanding-rows', hasExpandingRows);
367
+
368
+ const tableExpandable = ref(props.expandable);
369
+ provide('table-expandable', tableExpandable);
368
370
  onMounted(() => {
369
371
  if (props.expandable) expandingRowIds.value.add('table-expand-row');
370
372
  });
371
373
  watch(
372
374
  () => props.expandable,
373
375
  () => {
376
+ tableExpandable.value = props.expandable;
374
377
  if (props.expandable) expandingRowIds.value.add('table-expand-row');
375
378
  else expandingRowIds.value.delete('table-expand-row');
376
379
  }
@@ -1,10 +1,11 @@
1
1
  <template>
2
2
  <tbody
3
- v-if="dataSomeExpandingRows"
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,16 +76,20 @@ 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(false);
81
- watch(dataExpandable, () => {
83
+ const dataExpandable = ref(tableExpandable.value);
84
+ watch(dataExpandable, value => {
85
+ if (value && !expandingRowIds.value.has('table-expand-row')) {
86
+ console.warn(
87
+ `row ${cvId.value} is expandable but the expandable property is not set to true on the table`
88
+ );
89
+ }
82
90
  if (dataExpandable.value) expandingRowIds.value.add(cvId.value);
83
91
  else expandingRowIds.value?.delete(cvId.value);
84
92
  });
85
- const dataSomeExpandingRows = computed(() => {
86
- return expandingRowIds.value?.size > 0;
87
- });
88
93
  const attrs = useAttrs();
89
94
  const rowIds = inject('row-ids', ref(new Set()));
90
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 v-bind="overflowMenuOptions">
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()));
@@ -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: 'attributes',
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
- addFiles(evt.dataTransfer.files);
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="`${uid}-label`"
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="`${uid}-label`"
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="uid"
72
- :aria-controls="uid"
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="uid"
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="uid"
144
+ :id="cvId"
145
145
  ref="elList"
146
- :aria-labelledby="`${uid}-label`"
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 uid = useCvId(props, true);
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,6 +108,7 @@ 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,
@@ -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,
@@ -0,0 +1 @@
1
+ export const sizeTypes = new Set(['sm', 'md', 'lg']);
@@ -30,6 +30,7 @@ export const Template = args => ({
30
30
  const defaultTemplate = `
31
31
  <cv-pagination
32
32
  @change="onChange"
33
+ id="pagination-story"
33
34
  :backward-text="backwardText"
34
35
  :forward-text="forwardText"
35
36
  :page-number-label="pageNumberLabel"
@@ -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