@carbon/vue 3.0.21 → 3.0.23

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 (54) hide show
  1. package/README.md +2 -3
  2. package/dist/carbon-vue-3.common.js +750 -1169
  3. package/dist/carbon-vue-3.common.js.map +1 -1
  4. package/dist/carbon-vue-3.umd.js +750 -1169
  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/package.json +10 -7
  9. package/src/components/CvAspectRatio/CvAspectRatio.stories.js +2 -5
  10. package/src/components/CvBreadcrumb/CvBreadcrumb.stories.js +2 -5
  11. package/src/components/CvButton/CvButton.stories.js +1 -3
  12. package/src/components/CvButton/CvButtonSet.stories.js +2 -6
  13. package/src/components/CvButton/CvButtonSkeleton.stories.js +1 -3
  14. package/src/components/CvButton/CvIconButton.stories.js +1 -3
  15. package/src/components/CvCheckbox/CvCheckbox.stories.js +1 -2
  16. package/src/components/CvCodeSnippet/CvCodeSnippet.stories.js +1 -2
  17. package/src/components/CvComboBox/CvComboBox.stories.js +2 -5
  18. package/src/components/CvCopyButton/CvCopyButton.stories.js +2 -5
  19. package/src/components/CvDataTable/CvDataTable.stories.mdx +61 -30
  20. package/src/components/CvDataTable/CvDataTable.vue +73 -103
  21. package/src/components/CvDataTable/CvDataTableHeading.vue +25 -45
  22. package/src/components/CvDataTable/CvDataTableRow.vue +52 -51
  23. package/src/components/CvDataTable/_CvDataTableRowInner.vue +9 -18
  24. package/src/components/CvDatePicker/CvDatePicker.stories.js +2 -5
  25. package/src/components/CvDatePicker/CvDatePicker.vue +1 -1
  26. package/src/components/CvLink/CvLink.stories.js +1 -2
  27. package/src/components/CvList/CvList.stories.js +2 -5
  28. package/src/components/CvLoading/CvLoading.stories.js +2 -5
  29. package/src/components/CvMultiSelect/CvMultiSelect.vue +4 -1
  30. package/src/components/CvNotification/CvInlineNotification.stories.js +2 -2
  31. package/src/components/CvNotification/CvToastNotification.stories.js +2 -2
  32. package/src/components/CvNumberInput/CvNumberInput.stories.js +2 -6
  33. package/src/components/CvNumberInput/CvNumberInputSkeleton.stories.js +2 -6
  34. package/src/components/CvRadioButton/CvRadioButton.stories.js +2 -5
  35. package/src/components/CvSkeletonText/CvSkeletonText.stories.js +2 -5
  36. package/src/components/CvSlider/CvSlider.stories.js +2 -6
  37. package/src/components/CvSlider/CvSliderSkeleton.stories.js +2 -6
  38. package/src/components/CvStructuredList/CvStructuredList.stories.js +2 -5
  39. package/src/components/CvTag/CvTag.stories.js +2 -5
  40. package/src/components/CvTag/CvTagSkeleton.stories.js +2 -5
  41. package/src/components/CvTextArea/CvTextArea.stories.js +2 -6
  42. package/src/components/CvTextArea/CvTextAreaSkeleton.stories.js +2 -6
  43. package/src/components/CvTextInput/CvTextInput.stories.js +2 -5
  44. package/src/components/CvToggle/CvToggle.stories.js +2 -5
  45. package/src/components/CvTooltip/CvDefinitionTooltip.stories.js +2 -6
  46. package/src/components/CvTooltip/CvInteractiveTooltip.stories.js +2 -6
  47. package/src/components/CvTooltip/CvTooltip.stories.js +2 -6
  48. package/src/components/CvUIShell/CvContent.stories.js +22 -0
  49. package/src/components/CvUIShell/CvContent.vue +14 -0
  50. package/src/index.js +1 -0
  51. package/src/use/overflow.js +2 -2
  52. package/telemetry.yml +1 -1
  53. package/dist/web-types.json +0 -5555
  54. package/src/components/CvDataTable/cvDataTableStore.js +0 -314
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.21",
4
+ "version": "3.0.23",
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",
@@ -51,7 +51,7 @@
51
51
  "@vue/cli-plugin-unit-jest": "^5.0.8",
52
52
  "@vue/cli-service": "^5.0.8",
53
53
  "@vue/compiler-sfc": "^3.3.4",
54
- "@vue/eslint-config-prettier": "^7.0.0",
54
+ "@vue/eslint-config-prettier": "^10.1.0",
55
55
  "@vue/test-utils": "^2.2.4",
56
56
  "@vue/vue3-jest": "^27.0.0",
57
57
  "accessibility-checker": "^3.1.59",
@@ -61,17 +61,17 @@
61
61
  "copy-webpack-plugin": "^10.2.4",
62
62
  "css-loader": "^6.7.2",
63
63
  "eslint": "^8.28.0",
64
- "eslint-plugin-prettier": "^4.2.1",
64
+ "eslint-plugin-prettier": "^5.2.1",
65
65
  "eslint-plugin-vue": "^8.7.1",
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
- "postcss-loader": "^6.2.1",
71
+ "postcss-loader": "^8.1.1",
72
72
  "prettier": "^2.8.0",
73
73
  "sass": "^1.56.1",
74
- "sass-loader": "^12.6.0",
74
+ "sass-loader": "^16.0.2",
75
75
  "storybook": "^6.5.13",
76
76
  "style-loader": "^3.3.1",
77
77
  "stylelint": "^14.15.0",
@@ -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,15 +1,12 @@
1
1
  import { h } from 'vue';
2
- import {
3
- sbCompPrefix,
4
- storyParametersObject,
5
- } from '../../global/storybook-utils';
2
+ import { storyParametersObject } from '../../global/storybook-utils';
6
3
 
7
4
  import { CvAspectRatio, CvAspectRatioConsts } from '.';
8
5
 
9
6
  import './CvAspectRatio.stories.scss';
10
7
 
11
8
  export default {
12
- title: `${sbCompPrefix}/CvAspectRatio`,
9
+ title: 'Component/CvAspectRatio',
13
10
  component: CvAspectRatio,
14
11
  decorators: [
15
12
  story => h('div', { class: 'aspect-ratio-story' }, story().render()),
@@ -5,13 +5,10 @@ import {
5
5
  CvBreadcrumbSkeletonItem,
6
6
  } from '.';
7
7
 
8
- import {
9
- sbCompPrefix,
10
- storyParametersObject,
11
- } from '../../global/storybook-utils';
8
+ import { storyParametersObject } from '../../global/storybook-utils';
12
9
 
13
10
  export default {
14
- title: `${sbCompPrefix}/CvBreadcrumb`,
11
+ title: 'Component/CvBreadcrumb',
15
12
  component: CvBreadcrumb,
16
13
  argTypes: {
17
14
  ariaLabel: {
@@ -2,12 +2,10 @@ import { action } from '@storybook/addon-actions';
2
2
  import { CvButton } from './';
3
3
  import { buttonKinds, buttonSizes } from './consts';
4
4
  import {
5
- sbCompPrefix,
6
5
  splitSlotArgs,
7
6
  storybookControlsFromProps,
8
7
  storyParametersObject,
9
8
  } from '../../global/storybook-utils';
10
- import { sbBtnPrefix } from './sbBtnPrefix';
11
9
  import { props as commonCvButtonProps } from './CvButtonCommon';
12
10
  import {
13
11
  Bee20,
@@ -28,7 +26,7 @@ const icons = {
28
26
  };
29
27
 
30
28
  export default {
31
- title: `${sbCompPrefix}/${sbBtnPrefix}/CvButton`,
29
+ title: 'Component/CvButton',
32
30
  component: CvButton,
33
31
  argTypes: {
34
32
  ...storybookControlsFromProps(commonCvButtonProps),
@@ -1,13 +1,9 @@
1
1
  import { CvButtonSet, CvButton } from './';
2
2
 
3
- import {
4
- sbCompPrefix,
5
- storyParametersObject,
6
- } from '../../global/storybook-utils';
7
- import { sbBtnPrefix } from './sbBtnPrefix';
3
+ import { storyParametersObject } from '../../global/storybook-utils';
8
4
 
9
5
  export default {
10
- title: `${sbCompPrefix}/${sbBtnPrefix}/CvButtonSet`,
6
+ title: 'Component/CvButtonSet',
11
7
  component: CvButtonSet,
12
8
  };
13
9
 
@@ -1,16 +1,14 @@
1
1
  import { CvButtonSkeleton } from '.';
2
2
  import { buttonSizes } from './consts.js';
3
3
  import {
4
- sbCompPrefix,
5
4
  storybookControlsFromProps,
6
5
  storyParametersObject,
7
6
  } from '../../global/storybook-utils';
8
- import { sbBtnPrefix } from './sbBtnPrefix';
9
7
 
10
8
  import { props as commonCvButtonProps } from './CvButtonCommon';
11
9
 
12
10
  export default {
13
- title: `${sbCompPrefix}/${sbBtnPrefix}/CvButtonSkeleton`,
11
+ title: 'Component/CvButtonSkeleton',
14
12
  component: CvButtonSkeleton,
15
13
  argTypes: {
16
14
  ...storybookControlsFromProps({ size: commonCvButtonProps.size }),
@@ -2,12 +2,10 @@ import { action } from '@storybook/addon-actions';
2
2
  import { CvIconButton } from './';
3
3
  import { buttonKinds, buttonSizes } from './consts.js';
4
4
  import {
5
- sbCompPrefix,
6
5
  storybookControlsFromProps,
7
6
  storyParametersObject,
8
7
  } from '../../global/storybook-utils';
9
8
  import { TipAlignments } from '../CvTooltip/consts.js';
10
- import { sbBtnPrefix } from './sbBtnPrefix';
11
9
 
12
10
  import { props as commonCvButtonProps } from './CvButtonCommon';
13
11
  import {
@@ -29,7 +27,7 @@ const icons = {
29
27
  };
30
28
 
31
29
  export default {
32
- title: `${sbCompPrefix}/${sbBtnPrefix}/CvIconButton`,
30
+ title: 'Component/CvIconButton',
33
31
  component: CvIconButton,
34
32
  argTypes: {
35
33
  ...storybookControlsFromProps(commonCvButtonProps),
@@ -1,5 +1,4 @@
1
1
  import {
2
- sbCompPrefix,
3
2
  storybookControlsFromProps,
4
3
  storyParametersObject,
5
4
  } from '../../global/storybook-utils';
@@ -10,7 +9,7 @@ import { props as propsCvCheck } from '../../use/cvCheck';
10
9
  import { ref } from 'vue';
11
10
 
12
11
  export default {
13
- title: `${sbCompPrefix}/CvCheckbox`,
12
+ title: 'Component/CvCheckbox',
14
13
  component: CvCheckbox,
15
14
  argTypes: {
16
15
  ...storybookControlsFromProps(propsCvCheck),
@@ -1,6 +1,5 @@
1
1
  import { carbonPrefix } from '../../global/settings';
2
2
  import {
3
- sbCompPrefix,
4
3
  splitSlotArgs,
5
4
  storyParametersObject,
6
5
  } from '../../global/storybook-utils';
@@ -12,7 +11,7 @@ import CvCodeSnippetConsts from './consts';
12
11
  import './CvCodeSnippet.stories.scss';
13
12
 
14
13
  export default {
15
- title: `${sbCompPrefix}/CvCodeSnippet`,
14
+ title: 'Component/CvCodeSnippet',
16
15
  component: CvCodeSnippet,
17
16
  argTypes: {
18
17
  default: { control: { type: 'text' } },
@@ -1,7 +1,4 @@
1
- import {
2
- sbCompPrefix,
3
- storyParametersObject,
4
- } from '../../global/storybook-utils';
1
+ import { storyParametersObject } from '../../global/storybook-utils';
5
2
 
6
3
  import { CvComboBox } from '.';
7
4
  import { action } from '@storybook/addon-actions';
@@ -41,7 +38,7 @@ const initArgs = {
41
38
  };
42
39
 
43
40
  export default {
44
- title: `${sbCompPrefix}/CvComboBox`,
41
+ title: 'Component/CvComboBox',
45
42
  component: CvComboBox,
46
43
  parameters: {
47
44
  a11y: {
@@ -1,13 +1,10 @@
1
1
  import CvCopyButton from '.';
2
2
 
3
3
  import { action } from '@storybook/addon-actions';
4
- import {
5
- sbCompPrefix,
6
- storyParametersObject,
7
- } from '../../global/storybook-utils';
4
+ import { storyParametersObject } from '../../global/storybook-utils';
8
5
 
9
6
  export default {
10
- title: `${sbCompPrefix}/CvCopyButton`,
7
+ title: 'Component/CvCopyButton',
11
8
  component: CvCopyButton,
12
9
  argTypes: {},
13
10
  };
@@ -44,6 +44,7 @@ function searchTestData(opts) {
44
44
  else testData.value = originalTestData.value.filter(data => data.name.indexOf(opts) > -1)
45
45
  return sortTestData(sortOpts.value)
46
46
  }
47
+ const selectedRows = ref(["COBOL"])
47
48
 
48
49
  <Meta title={`${sbCompPrefix}/CvDataTable`} component={CvDataTable} />
49
50
 
@@ -75,6 +76,7 @@ setup() {
75
76
  onRowSelectChange: action('row-select-change'),
76
77
  onRowSelectChanges: action('row-select-changes'),
77
78
  onOverflowMenuClick: action('overflow-menu-click'),
79
+ onVmodel: action('v-model'),
78
80
  onRowExpanded: action('row-expanded'),
79
81
  onPagination: action('pagination'),
80
82
  onAction1: action('compile'),
@@ -84,13 +86,15 @@ setup() {
84
86
  useActions: args.useActions,
85
87
  useBatchActions: args.useBatchActions,
86
88
  useHelperTextSlot: args.useHelperTextSlot,
89
+ usePagination: args.usePagination,
87
90
  skeletonRows: args.skeletonRows,
88
91
  skeletonCols: args.skeletonCols,
89
92
  skeletonTitle: args.title,
90
93
  skeletonHelper: args.helperText,
91
94
  testData,
92
95
  originalTestData,
93
- searchOpts
96
+ searchOpts,
97
+ selectedRows
94
98
  };
95
99
  },
96
100
  // And then the `args` are bound to your component with `v-bind="args"`
@@ -105,6 +109,7 @@ const defaultTemplate = `
105
109
  @overflow-menu-click="onOverflowMenuClick"
106
110
  @row-expanded="onRowExpanded"
107
111
  @pagination="onPagination"
112
+ :pagination="usePagination"
108
113
  :initialSearchValue="searchOpts"
109
114
  >
110
115
  <template v-if="useBatchActions" #batch-actions>
@@ -128,14 +133,14 @@ const defaultTemplate = `
128
133
  </cv-data-table-action>
129
134
  </template>
130
135
  <template #headings>
131
- <cv-data-table-heading heading="Name" name="name" sortable/>
132
- <cv-data-table-heading heading="Year" name="year" sortable/>
133
- <cv-data-table-heading heading="Object Oriented"/>
134
- <cv-data-table-heading heading="Purpose" />
135
- <cv-data-table-heading heading="Standard" />
136
+ <cv-data-table-heading id="sb-name" heading="Name" name="name" sortable order="ascending"/>
137
+ <cv-data-table-heading id="sb-year" heading="Year" name="year" sortable/>
138
+ <cv-data-table-heading id="sb-oo" heading="Object Oriented"/>
139
+ <cv-data-table-heading id="sb-purpose" heading="Purpose" />
140
+ <cv-data-table-heading id="sb-standard" heading="Standard" />
136
141
  </template>
137
142
  <template #data>
138
- <cv-data-table-row v-for="row in testData" :key="row.name" :value="row.name">
143
+ <cv-data-table-row v-for="row in testData" :id="row.name" :key="row.name" :value="row.name">
139
144
  <cv-data-table-cell>{{row.name}}</cv-data-table-cell>
140
145
  <cv-data-table-cell>{{row.year}}</cv-data-table-cell>
141
146
  <cv-data-table-cell>{{row.oo}}</cv-data-table-cell>
@@ -149,7 +154,7 @@ const defaultTemplate = `
149
154
  const expandingRowsTemplate = defaultTemplate.replace(
150
155
  "<!-- Add optional expanding data here -->",
151
156
  `<template #expandedContent>{{row.desc}}</template>`)
152
- .replace('@search="onSearch"', '')
157
+ .replace('@search="onSearch"', ':expandable="true"')
153
158
  .replace('testData', 'originalTestData')
154
159
  const skeletonTemplate = `
155
160
  <cv-data-table-skeleton
@@ -169,6 +174,17 @@ const skeletonTemplate = `
169
174
  </template>
170
175
  </cv-data-table-skeleton>
171
176
  `;
177
+ const vModelTemplate = defaultTemplate
178
+ .replace('@search="onSearch"', 'v-model:rows-selected="selectedRows"')
179
+ .replace('@row-select-change="onRowSelectChange"', '@update:rows-selected="onVmodel"')
180
+ .replace('@row-select-changes="onRowSelectChanges"','')
181
+ .replace('testData', 'originalTestData') + `
182
+ <div style="margin-top:1rem; background-color: #888888; padding:1rem"><div style="font-size: 150%">Sample interaction</div>
183
+ <select name="programming-languages" id="programming-languages" v-model="selectedRows" multiple>
184
+ <option v-for="l in originalTestData" :id="l.name" :key="l.name" :value="l.name">{{l.name}}</option>
185
+ </select>
186
+ <div>selections: {{ selectedRows }} </div>
187
+ </div>`
172
188
 
173
189
  # CvDataTable
174
190
 
@@ -197,6 +213,7 @@ const skeletonTemplate = `
197
213
  }
198
214
  ```
199
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" ...`
200
217
 
201
218
  **Row attributes:**
202
219
  - aria-label-for-batch-checkbox: Aria label for batch checkbox. default 'Select row N for batch action'.
@@ -251,10 +268,12 @@ when no items were select, please now use the new property `stickyBatchActive`.
251
268
  helperText: 'Table helper text',
252
269
  useActions: false,
253
270
  useBatchActions: false,
271
+ usePagination: true
254
272
  }}
255
273
  argTypes={{
256
274
  rowSize: { control: 'select', default: 'lg', options: ['xs', 'sm', 'md', 'lg', 'xl'] },
257
275
  rowsSelected: { control: 'multi-select', options: ['Java', 'COBOL', 'C++'] },
276
+ useBatchActions: { description: "To use batch actions you should assign a usable `id` to each row. i.e. `<cv-data-table-row :id=\"item.id\" ...` This `id` value is passed to the row selection events." }
258
277
  }}
259
278
  >
260
279
  {Template.bind({})}
@@ -265,34 +284,17 @@ when no items were select, please now use the new property `stickyBatchActive`.
265
284
  <Story
266
285
  name="Expanding rows"
267
286
  parameters={{
268
- controls: { exclude: ['default',
269
- 'template',
270
- 'overflow-menu-click',
271
- 'pagination',
272
- 'row-expanded',
273
- 'row-select-change',
274
- 'row-select-changes',
275
- 'search',
276
- 'sort',
277
- 'actions',
278
- 'batch-actions',
279
- 'data',
280
- 'headings',
281
- 'helper-text',
282
- 'items-selected',
283
- 'of-n-pages',
284
- 'range-text',
285
- 'skeleton',
286
- 'update:rowsSelected',
287
- ] },
287
+ controls: { include: [ "helperText", "title", "hasExpandAll"] },
288
288
  docs: { source: { code: storySourceCode(expandingRowsTemplate, Template.args) } },
289
289
  }}
290
290
  args={{
291
291
  template: expandingRowsTemplate,
292
- title: 'Table with expanding rows',
292
+ title: 'Table with expanding rows - NOTE: expandable property must be set to true',
293
293
  helperText: 'Click row to expand',
294
294
  useActions: false,
295
295
  useBatchActions: false,
296
+ usePagination: true,
297
+ expandable: true
296
298
  }}
297
299
  argTypes={{
298
300
  rowSize: { control: 'select', default: 'standard', options: ['compact', 'short', 'standard', 'tall'] },
@@ -319,7 +321,36 @@ when no items were select, please now use the new property `stickyBatchActive`.
319
321
  skeletonRows: 5,
320
322
  skeletonCols: 5,
321
323
  useBatchActions: false,
322
- useActions: false
324
+ useActions: false,
325
+ usePagination: true
326
+ }}
327
+ argTypes={{
328
+ }}
329
+ >
330
+ {Template.bind({})}
331
+ </Story>
332
+ </Canvas>
333
+
334
+
335
+ # Using v-model selected rows
336
+ If you are using the selected rows for batch actions or any other purpose, you should assign usable values to the rows.
337
+ It is these values that are included in the selected rows events and in the selected rows v-model. Set the v-model on the
338
+ cv-table like `<cv-table v-model:rows-selected="selectedRows" ...`
339
+
340
+ <Canvas>
341
+ <Story
342
+ name="v-model Selected Rows"
343
+ parameters={{
344
+ controls: { include: [ ] },
345
+ docs: { source: { code: storySourceCode(vModelTemplate, Template.args) } },
346
+ }}
347
+ args={{
348
+ template: vModelTemplate,
349
+ title: 'v-model example',
350
+ helperText: 'select rows to see updates',
351
+ useBatchActions: true,
352
+ useActions: false,
353
+ usePagination: false
323
354
  }}
324
355
  argTypes={{
325
356
  }}