@carbon/vue 3.0.13 → 3.0.15

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 (50) hide show
  1. package/README.md +9 -0
  2. package/dist/carbon-vue-3.common.js +884 -324
  3. package/dist/carbon-vue-3.common.js.map +1 -1
  4. package/dist/carbon-vue-3.umd.js +884 -324
  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 +30 -3
  9. package/package.json +8 -5
  10. package/src/components/CvAccordion/CvAccordion.stories.mdx +11 -2
  11. package/src/components/CvAccordion/CvAccordionItem.vue +1 -1
  12. package/src/components/CvBreadcrumb/CvBreadcrumb.vue +1 -0
  13. package/src/components/CvBreadcrumb/CvBreadcrumbItem.vue +1 -0
  14. package/src/components/CvButton/CvButton.vue +1 -0
  15. package/src/components/CvButton/CvButtonSet.vue +1 -0
  16. package/src/components/CvButton/CvIconButton.vue +2 -1
  17. package/src/components/CvCheckbox/CvCheckbox.vue +2 -1
  18. package/src/components/CvCodeSnippet/CvCodeSnippet.vue +8 -3
  19. package/src/components/CvCodeSnippet/_CviCodeSnippetInline.vue +1 -0
  20. package/src/components/CvCodeSnippet/_CviCodeSnippetMultiline.vue +1 -0
  21. package/src/components/CvCodeSnippet/_CviCodeSnippetOneline.vue +1 -0
  22. package/src/components/CvComboBox/CvComboBox.vue +2 -1
  23. package/src/components/CvDataTable/CvDataTable.stories.mdx +26 -49
  24. package/src/components/CvDataTable/CvDataTable.vue +71 -52
  25. package/src/components/CvDataTable/CvDataTableRow.vue +11 -3
  26. package/src/components/CvDataTable/_CvDataTableRowInner.vue +18 -8
  27. package/src/components/CvDataTable/cvDataTableStore.js +1 -27
  28. package/src/components/CvDatePicker/CvDatePicker.stories.js +30 -6
  29. package/src/components/CvDatePicker/CvDatePicker.vue +24 -19
  30. package/src/components/CvDropdown/CvDropdown.stories.mdx +12 -2
  31. package/src/components/CvDropdown/CvDropdown.vue +4 -3
  32. package/src/components/CvFileUploader/CvFileUploader.vue +2 -2
  33. package/src/components/CvList/CvList.vue +1 -0
  34. package/src/components/CvList/CvListItem.vue +1 -1
  35. package/src/components/CvNotification/CvInlineNotification.vue +1 -0
  36. package/src/components/CvNotification/CvToastNotification.stories.js +65 -5
  37. package/src/components/CvNotification/CvToastNotification.vue +1 -0
  38. package/src/components/CvNotification/CvToastNotificationTemplate.mdx +17 -0
  39. package/src/components/CvNumberInput/CvNumberInput.vue +3 -3
  40. package/src/components/CvOverflowMenu/CvOverflowMenuItem.vue +2 -2
  41. package/src/components/CvPagination/CvPagination.stories.mdx +22 -15
  42. package/src/components/CvPagination/CvPagination.vue +16 -1
  43. package/src/components/CvProgress/CvProgress.stories.mdx +29 -7
  44. package/src/components/CvProgress/CvProgress.vue +1 -0
  45. package/src/components/CvProgress/CvProgressStep.vue +2 -0
  46. package/src/components/CvSlider/CvSlider.vue +1 -1
  47. package/src/components/CvTag/CvTag.stories.js +0 -2
  48. package/src/components/CvTag/CvTag.vue +6 -4
  49. package/src/index.js +112 -0
  50. package/telemetry.yml +8 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "@carbon/vue",
4
- "version": "3.0.12",
4
+ "version": "3.0.14",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -923,6 +923,7 @@
923
923
  "attributes": [
924
924
  {
925
925
  "name": "actionBarAriaLabel",
926
+ "description": "Arial label for the action bar.",
926
927
  "value": {
927
928
  "kind": "expression",
928
929
  "type": "string"
@@ -931,6 +932,7 @@
931
932
  },
932
933
  {
933
934
  "name": "collapseAllAriaLabel",
935
+ "description": "Arial label for the \"collapse all\" button in tables with expandable rows\".",
934
936
  "value": {
935
937
  "kind": "expression",
936
938
  "type": "string"
@@ -939,6 +941,7 @@
939
941
  },
940
942
  {
941
943
  "name": "expandAllAriaLabel",
944
+ "description": "Arial label for the \"expand all\" button in tables with expandable rows\".",
942
945
  "value": {
943
946
  "kind": "expression",
944
947
  "type": "string"
@@ -947,6 +950,7 @@
947
950
  },
948
951
  {
949
952
  "name": "selectAllAriaLabel",
953
+ "description": "Arial label for the \"select all\" button in tables with selectable rows\".",
950
954
  "value": {
951
955
  "kind": "expression",
952
956
  "type": "string"
@@ -1049,6 +1053,15 @@
1049
1053
  },
1050
1054
  "default": "false"
1051
1055
  },
1056
+ {
1057
+ "name": "expandable",
1058
+ "description": "Table will have expandable rows",
1059
+ "value": {
1060
+ "kind": "expression",
1061
+ "type": "boolean"
1062
+ },
1063
+ "default": "false"
1064
+ },
1052
1065
  {
1053
1066
  "name": "title",
1054
1067
  "value": {
@@ -1077,7 +1090,7 @@
1077
1090
  },
1078
1091
  {
1079
1092
  "name": "zebra",
1080
- "description": "the table striped",
1093
+ "description": "`true` to use Zebra style striping.",
1081
1094
  "value": {
1082
1095
  "kind": "expression",
1083
1096
  "type": "boolean"
@@ -1102,8 +1115,18 @@
1102
1115
  },
1103
1116
  "default": "[]"
1104
1117
  },
1118
+ {
1119
+ "name": "stickyBatchActive",
1120
+ "description": "Normally batch actions are hidden if no items are selected. Set this to true to always show batch actions",
1121
+ "value": {
1122
+ "kind": "expression",
1123
+ "type": "boolean"
1124
+ },
1125
+ "default": "false"
1126
+ },
1105
1127
  {
1106
1128
  "name": "helperText",
1129
+ "description": "subtext on the table",
1107
1130
  "value": {
1108
1131
  "kind": "expression",
1109
1132
  "type": "string"
@@ -1112,6 +1135,7 @@
1112
1135
  },
1113
1136
  {
1114
1137
  "name": "expandingSearch",
1138
+ "description": "Animate the search bar opening",
1115
1139
  "value": {
1116
1140
  "kind": "expression",
1117
1141
  "type": "boolean"
@@ -1120,6 +1144,7 @@
1120
1144
  },
1121
1145
  {
1122
1146
  "name": "skeleton",
1147
+ "description": "Show table loading / skeleton state",
1123
1148
  "value": {
1124
1149
  "kind": "expression",
1125
1150
  "type": "boolean"
@@ -1128,6 +1153,7 @@
1128
1153
  },
1129
1154
  {
1130
1155
  "name": "hasExpandAll",
1156
+ "description": "Should the expand all button be available",
1131
1157
  "value": {
1132
1158
  "kind": "expression",
1133
1159
  "type": "boolean"
@@ -1145,6 +1171,7 @@
1145
1171
  },
1146
1172
  {
1147
1173
  "name": "onSearch",
1174
+ "description": "User defined search action",
1148
1175
  "value": {
1149
1176
  "kind": "expression",
1150
1177
  "type": "func"
@@ -4731,7 +4758,7 @@
4731
4758
  "kind": "expression",
4732
4759
  "type": "string"
4733
4760
  },
4734
- "default": "'red'"
4761
+ "default": "undefined"
4735
4762
  },
4736
4763
  {
4737
4764
  "name": "filter",
package/package.json CHANGED
@@ -1,20 +1,21 @@
1
1
  {
2
2
  "name": "@carbon/vue",
3
3
  "license": "Apache-2.0",
4
- "version": "3.0.13",
4
+ "version": "3.0.15",
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",
8
8
  "types": "src/index.d.ts",
9
9
  "web-types": "dist/web-types.json",
10
10
  "scripts": {
11
- "_postinstall": "node prepare.js && node .storybook/postinstall.js",
11
+ "_postinstall": "node prepare.js && node .storybook/postinstall.js && ibmtelemetry --config=telemetry.yml",
12
12
  "prepack": "pinst --disable",
13
13
  "postpack": "pinst --enable",
14
14
  "build": "vue-cli-service build --target lib --name carbon-vue-3 ./src/index.js --no-clean",
15
15
  "lint": "vue-cli-service lint",
16
16
  "build-web-types": "vue-docgen-web-types --outFile dist/web-types.json",
17
- "ci-check": "yarn format:diff && yarn test && yarn build && yarn build-web-types",
17
+ "add-components-exports": "node addNamedComponentExports.js",
18
+ "ci-check": "yarn add-components-exports && yarn format:diff && yarn test && yarn build && yarn build-web-types",
18
19
  "format": "prettier --write '**/*.{scss,css,js,md,vue}' '!**/{build,es,lib,storybook,ts,umd,.coverage}/**'",
19
20
  "format:diff": "prettier --list-different '**/*.{scss,css,js,md,vue}' '!**/{dist,storybook-static,.coverage}/**'",
20
21
  "format:staged": "prettier --write '**/*.{scss,css,js,md,vue}' '!**/{dist,storybook-static,.coverage}/**'",
@@ -29,6 +30,7 @@
29
30
  ],
30
31
  "dependencies": {
31
32
  "@carbon/icons-vue": "^10.60.0",
33
+ "@ibm/telemetry-js": "^1.2.1",
32
34
  "@vueuse/core": "^4.11.2",
33
35
  "carbon-components": "^10.58.5",
34
36
  "eslint-plugin-prettier-vue": "^4.2.0",
@@ -157,7 +159,8 @@
157
159
  },
158
160
  "files": [
159
161
  "/dist",
160
- "/src"
162
+ "/src",
163
+ "telemetry.yml"
161
164
  ],
162
165
  "commitlint": {
163
166
  "extends": [
@@ -174,5 +177,5 @@
174
177
  "url": "git+https://github.com/carbon-design-system/carbon-components-vue.git"
175
178
  },
176
179
  "sideEffects": true,
177
- "gitHead": "44c7e6ba63dee51b7f6426b46283b40deaed413c"
180
+ "gitHead": "42b70938c7b033489892a7f7b27e2b1a8ba1e3d9"
178
181
  }
@@ -13,6 +13,11 @@ const open = ref({
13
13
  accItem3: false,
14
14
  accItem4: false,
15
15
  });
16
+ const disabledItems = ref(new Set())
17
+ function onToggleEpisode3(){
18
+ if (disabledItems.value.has(3)) disabledItems.value.delete(3)
19
+ else disabledItems.value.add(3)
20
+ }
16
21
 
17
22
  <Meta title={`${sbCompPrefix}/CvAccordion`} component={CvAccordion} />
18
23
 
@@ -24,19 +29,23 @@ export const Template = args => ({
24
29
  align: alignConsts[alignConsts.$labels[args.align]],
25
30
  size: sizeConsts[sizeConsts.$labels[args.size]],
26
31
  onChange: action('change'),
32
+ disabledItems,
33
+ onToggleEpisode3,
27
34
  open,
28
35
  };
29
36
  },
30
37
  template: args.template,
31
38
  });
32
39
  const template = `<cv-accordion @change="onChange" :align="align" :size="size">
33
- <cv-accordion-item v-for="n in 4" :key="\`acc-item-\${n}\`" :id="n % 2 ? \`acc-item-\${n}\` : ''">
40
+ <cv-accordion-item v-for="n in 4" :key="\`acc-item-\${n}\`" :id="n % 2 ? \`acc-item-\${n}\` : ''" :disabled="disabledItems.has(n)">
34
41
  <template v-slot:title>Episode {{n}} </template>
35
42
  <template v-slot:content>
36
43
  <p>Did you hear that? They've shut down the main reactor. We'll be destroyed for sure. This is madness! We're doomed! There'll be no escape for the Princess this time. What's that? R2! R2-D2, where are you? At last! Where have you been? They're heading in this direction.</p>
37
44
  </template>
38
45
  </cv-accordion-item>
39
- </cv-accordion>`;
46
+ </cv-accordion>
47
+ <div><button @click="onToggleEpisode3">Disable Episode 3</button></div>
48
+ `;
40
49
  const Default = Template.bind({});
41
50
  Default.args = {};
42
51
  Default.parameters = storyParametersObject(
@@ -15,7 +15,7 @@
15
15
  >
16
16
  <button
17
17
  ref="button"
18
- :disabled="disabled"
18
+ :disabled="disabled || null"
19
19
  type="button"
20
20
  :class="`${carbonPrefix}--accordion__heading`"
21
21
  :aria-expanded="isOpen ? 'true' : 'false'"
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <nav :aria-label="ariaLabel">
3
3
  <ol
4
+ class="cv-breadcrumb"
4
5
  :class="[
5
6
  `${carbonPrefix}--breadcrumb`,
6
7
  { [`${carbonPrefix}--breadcrumb--no-trailing-slash`]: noTrailingSlash },
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <li
3
+ class="cv-breadcrumb-item"
3
4
  :class="[
4
5
  `${carbonPrefix}--breadcrumb-item`,
5
6
  { [`${carbonPrefix}--breadcrumb-item--current`]: isCurrentPage },
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <button
3
+ class="cv-button"
3
4
  :class="buttonClasses"
4
5
  :disabled="disabled || skeleton"
5
6
  @click="$emit('click', $event)"
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <div
3
+ class="cv-button-set"
3
4
  :class="[
4
5
  `${carbonPrefix}--btn-set`,
5
6
  { [`${carbonPrefix}--btn-set--stacked`]: stacked },
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <button
3
+ class="cv-button"
3
4
  :class="[
4
5
  buttonClasses,
5
6
  `${carbonPrefix}--tooltip__trigger`,
@@ -7,7 +8,7 @@
7
8
  `${carbonPrefix}--tooltip--${tipPosition || 'bottom'}`,
8
9
  `${carbonPrefix}--tooltip--align-${tipAlignment || 'center'}`,
9
10
  ]"
10
- :disabled="disabled"
11
+ :disabled="disabled || null"
11
12
  @click="$emit('click', $event)"
12
13
  >
13
14
  <span :class="`${carbonPrefix}--assistive-text`">{{ label }}</span>
@@ -2,8 +2,9 @@
2
2
  <div
3
3
  class="cv-checkbox"
4
4
  :class="[
5
- `${carbonPrefix}--checkbox--${inline ? 'inline' : 'wrapper'}`,
6
5
  { [`${carbonPrefix}--form-item`]: formItem },
6
+ { [`${carbonPrefix}--checkbox--inline`]: inline },
7
+ { [`${carbonPrefix}--checkbox-wrapper`]: !inline },
7
8
  ]"
8
9
  >
9
10
  <input
@@ -1,7 +1,12 @@
1
1
  <template>
2
- <component :is="component" v-bind="subProps" @copy="handleCopy"
3
- ><slot
4
- /></component>
2
+ <component
3
+ :is="component"
4
+ v-bind="subProps"
5
+ class="cv-code-snippet"
6
+ @copy="handleCopy"
7
+ >
8
+ <slot />
9
+ </component>
5
10
  </template>
6
11
 
7
12
  <script>
@@ -48,6 +48,7 @@ export default {
48
48
  setup(props, { emit }) {
49
49
  const codeId = useCvId();
50
50
  const classes = computed(() => [
51
+ 'cv-code-snippet-inline',
51
52
  `${carbonPrefix}--snippet`,
52
53
  `${carbonPrefix}--snippet--inline`,
53
54
  {
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <div
3
+ class="cv-code-snippet-multiline"
3
4
  :class="[
4
5
  `${carbonPrefix}--snippet`,
5
6
  `${carbonPrefix}--snippet--multi`,
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <div
3
+ class="cv-code-snippet-oneline"
3
4
  :class="[
4
5
  `${carbonPrefix}--snippet`,
5
6
  `${carbonPrefix}--snippet--single`,
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <div
3
3
  ref="root"
4
+ class="cv-combo-box"
4
5
  :class="`${carbonPrefix}--list-box__wrapper`"
5
6
  @focusout="onFocusOut"
6
7
  >
@@ -62,7 +63,7 @@
62
63
  :aria-disabled="disabled || null"
63
64
  :aria-expanded="open ? 'true' : 'false'"
64
65
  autocomplete="off"
65
- :disabled="disabled"
66
+ :disabled="disabled || null"
66
67
  :placeholder="label"
67
68
  @input="onInput"
68
69
  @focus="inputFocus"
@@ -6,7 +6,7 @@ import CvDataTableCell from "./CvDataTableCell.vue";
6
6
  import CvDataTableAction from "./CvDataTableAction.vue";
7
7
  import CvDataTableSkeleton from "./CvDataTableSkeleton.vue";
8
8
  import CvButton from '../CvButton/CvButton.vue'
9
- import { sbCompPrefix } from '../../global/storybook-utils';
9
+ import { sbCompPrefix, storySourceCode } from '../../global/storybook-utils';
10
10
  import { action } from '@storybook/addon-actions';
11
11
  import { Terminal16 as CompileIcon, Debug16 as DebugIcon, Chip16 as EmbedIcon,
12
12
  TrashCan16 as TrashCanIcon} from '@carbon/icons-vue'
@@ -76,14 +76,14 @@ setup() {
76
76
  skeletonCols: args.skeletonCols,
77
77
  skeletonTitle: args.title,
78
78
  skeletonHelper: args.helperText,
79
- testData
79
+ testData,
80
80
  };
81
81
  },
82
82
  // And then the `args` are bound to your component with `v-bind="args"`
83
83
  template: args.template,
84
84
  });
85
85
  const defaultTemplate = `
86
- <cv-data-table
86
+ <cv-data-table v-bind="args"
87
87
  @search="onSearch"
88
88
  @sort="onSort"
89
89
  @row-select-change="onRowSelectChange"
@@ -91,12 +91,11 @@ const defaultTemplate = `
91
91
  @overflow-menu-click="onOverflowMenuClick"
92
92
  @row-expanded="onRowExpanded"
93
93
  @pagination="onPagination"
94
- v-bind="args"
95
94
  >
96
- <template v-if="useBatchActions" v-slot:batch-actions>
95
+ <template v-if="useBatchActions" #batch-actions>
97
96
  <cv-button :icon="trashIcon" @click="onDelete">Delete</cv-button>
98
97
  </template>
99
- <template v-if="useActions" v-slot:actions>
98
+ <template v-if="useActions" #actions>
100
99
  <cv-data-table-action @click="onAction1" aria-label="compile" alt="compile">
101
100
  <compile-icon>
102
101
  <title>Compile</title>
@@ -142,6 +141,16 @@ const skeletonTemplate = `
142
141
  :rows="skeletonRows"
143
142
  :title="skeletonTitle"
144
143
  :helperText="skeletonHelper">
144
+ <template v-if="useBatchActions" #batch-actions>
145
+ <cv-button :icon="trashIcon" @click="onDelete">Delete</cv-button>
146
+ </template>
147
+ <template v-if="useActions" #actions>
148
+ <cv-data-table-action @click="onAction1" aria-label="compile" alt="compile">
149
+ <compile-icon>
150
+ <title>Compile</title>
151
+ </compile-icon>
152
+ </cv-data-table-action>
153
+ </template>
145
154
  </cv-data-table-skeleton>
146
155
  `;
147
156
 
@@ -184,6 +193,8 @@ completion for it. See [discussion](https://github.com/vuejs/core/issues/3432) f
184
193
  - The Vue 3 implementation uses an internal store to manage the state of the table. You can see updates
185
194
  to the state by setting the debug variable in the local storage. `localStorage.debug="cv:data-table-store"`
186
195
  and then reloading the page.
196
+ - If you were using something like `this.$refs.tableEditPath.batchActive = true` to force batch actions to show even
197
+ when no items were select, please now use the new property `stickyBatchActive`.
187
198
 
188
199
  <Canvas>
189
200
  <Story
@@ -206,9 +217,10 @@ and then reloading the page.
206
217
  'items-selected',
207
218
  'of-n-pages',
208
219
  'range-text',
209
- 'skeleton'
220
+ 'skeleton',
221
+ 'update:rowsSelected',
210
222
  ] },
211
- docs: { source: { code: defaultTemplate.replace('v-bind="args"', '') } },
223
+ docs: { source: { code: storySourceCode(defaultTemplate, Template.args) } },
212
224
  }}
213
225
  args={{
214
226
  template: defaultTemplate,
@@ -248,8 +260,9 @@ and then reloading the page.
248
260
  'of-n-pages',
249
261
  'range-text',
250
262
  'skeleton',
263
+ 'update:rowsSelected',
251
264
  ] },
252
- docs: { source: { code: expandingRowsTemplate.replace('v-bind="args"', '') } },
265
+ docs: { source: { code: storySourceCode(expandingRowsTemplate, Template.args) } },
253
266
  }}
254
267
  args={{
255
268
  template: expandingRowsTemplate,
@@ -273,46 +286,8 @@ and then reloading the page.
273
286
  <Story
274
287
  name="Skeleton"
275
288
  parameters={{
276
- controls: { exclude: [
277
- 'template',
278
- 'actionBarAriaLabel',
279
- 'autoWidth',
280
- 'batchCancelLabel',
281
- 'borderless',
282
- 'collapseAllAriaLabel',
283
- 'expandAllAriaLabel',
284
- 'expandingSearch',
285
- 'hasExpandAll',
286
- 'initialSearchValue',
287
- 'overflowMenu',
288
- 'rowSize',
289
- 'rowsSelected',
290
- 'searchClearLabel',
291
- 'searchLabel',
292
- 'searchPlaceholder',
293
- 'selectAllAriaLabel',
294
- 'skeleton',
295
- 'sortable',
296
- 'staticWidth',
297
- 'stickyHeader',
298
- 'zebra',
299
- 'overflow-menu-click',
300
- 'pagination',
301
- 'row-expanded',
302
- 'actions',
303
- 'batch-actions',
304
- 'data',
305
- 'headings',
306
- 'row-select-change',
307
- 'row-select-changes',
308
- 'sort',
309
- 'helper-text',
310
- 'items-selected',
311
- 'of-n-pages',
312
- 'range-text',
313
- 'columns'
314
- ] },
315
- docs: { source: { code: skeletonTemplate.replace('v-bind="args"', '') } },
289
+ controls: { include: [ 'skeletonCols', 'skeletonRows', 'title', 'helperText', 'useBatchActions', 'useActions'] },
290
+ docs: { source: { code: storySourceCode(skeletonTemplate, Template.args) } },
316
291
  }}
317
292
  args={{
318
293
  template: skeletonTemplate,
@@ -320,6 +295,8 @@ and then reloading the page.
320
295
  helperText: 'Data has been requested...',
321
296
  skeletonRows: 5,
322
297
  skeletonCols: 5,
298
+ useBatchActions: false,
299
+ useActions: false
323
300
  }}
324
301
  argTypes={{
325
302
  }}