@carbon/vue 3.0.7-alpha.0 → 3.0.8-alpha.0

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 (73) hide show
  1. package/README.md +7 -0
  2. package/dist/carbon-vue-3.common.js +3438 -177
  3. package/dist/carbon-vue-3.common.js.map +1 -1
  4. package/dist/carbon-vue-3.umd.js +3438 -177
  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 +7 -4
  9. package/src/components/CvCheckbox/CvCheckbox.stories.js +18 -7
  10. package/src/components/CvCheckbox/CvCheckbox.vue +19 -3
  11. package/src/components/CvCheckbox/CvCheckboxSkeleton.vue +16 -0
  12. package/src/components/CvCheckbox/__tests__/__snapshots__/CvCheckboxSkeleton.spec.js.snap +3 -0
  13. package/src/components/CvCheckbox/index.js +2 -1
  14. package/src/components/CvDropdown/CvDropdown.vue +0 -2
  15. package/src/components/CvFileUploader/CvFileUploader.stories.mdx +333 -0
  16. package/src/components/CvFileUploader/CvFileUploader.vue +286 -0
  17. package/src/components/CvFileUploader/CvFileUploaderItem.vue +92 -0
  18. package/src/components/CvFileUploader/CvFileUploaderSkeleton.vue +16 -0
  19. package/src/components/CvFileUploader/const.js +10 -0
  20. package/src/components/CvFileUploader/index.js +5 -0
  21. package/src/components/CvMultiSelect/CvMultiSelect.stories.mdx +1 -1
  22. package/src/components/CvProgress/CvProgress.stories.mdx +202 -0
  23. package/src/components/CvProgress/CvProgress.vue +78 -0
  24. package/src/components/CvProgress/CvProgressStep.vue +124 -0
  25. package/src/components/CvProgress/index.js +4 -0
  26. package/src/components/CvRadioButton/CvRadioButton.stories.js +166 -0
  27. package/src/components/CvRadioButton/CvRadioButton.vue +57 -0
  28. package/src/components/CvRadioButton/CvRadioGroup.vue +27 -0
  29. package/src/components/CvRadioButton/__tests__/__snapshots__/CvRadioButton.spec.js.snap +27 -0
  30. package/src/components/CvRadioButton/index.js +6 -0
  31. package/src/components/CvSearch/CvSearch.stories.mdx +168 -0
  32. package/src/components/CvSearch/CvSearch.vue +250 -0
  33. package/src/components/CvSearch/index.js +3 -0
  34. package/src/components/CvSelect/CvSelect.vue +27 -6
  35. package/src/components/CvSlider/CvSlider.stories.js +166 -0
  36. package/src/components/CvSlider/CvSlider.vue +324 -0
  37. package/src/components/CvSlider/CvSliderSkeleton.stories.js +26 -0
  38. package/src/components/CvSlider/CvSliderSkeleton.vue +18 -0
  39. package/src/components/CvSlider/__tests__/__snapshots__/CvSlider.spec.js.snap +13 -0
  40. package/src/components/CvSlider/__tests__/__snapshots__/CvSliderSkeleton.spec.js.snap +13 -0
  41. package/src/components/CvSlider/index.js +5 -0
  42. package/src/components/CvSlider/sbSliderPrefix.js +2 -0
  43. package/src/components/CvTextArea/CvTextArea.stories.js +2 -2
  44. package/src/components/CvTextArea/CvTextAreaSkeleton.stories.js +29 -0
  45. package/src/components/CvTextArea/CvTextAreaSkeleton.vue +10 -0
  46. package/src/components/CvTextArea/StorybookGroupConst.js +1 -0
  47. package/src/components/CvTextArea/__tests__/__snapshots__/CvTextAreaSkeleton.spec.js.snap +7 -0
  48. package/src/components/CvTextArea/index.js +2 -1
  49. package/src/components/CvTimePicker/CvTimePicker.stories.mdx +325 -0
  50. package/src/components/CvTimePicker/CvTimePicker.vue +217 -0
  51. package/src/components/CvTimePicker/index.js +21 -0
  52. package/src/components/CvToggle/CvToggle-Skeleton.vue +27 -12
  53. package/src/components/CvToggle/CvToggle.stories.js +20 -3
  54. package/src/components/CvToggle/CvToggle.vue +22 -5
  55. package/src/components/CvToggle/__tests__/__snapshots__/CvToggle.spec.js.snap +3 -3
  56. package/src/components/CvTooltip/CvDefinitionTooltip.stories.js +80 -0
  57. package/src/components/CvTooltip/CvDefinitionTooltip.vue +61 -0
  58. package/src/components/CvTooltip/CvInteractiveTooltip.stories.js +90 -0
  59. package/src/components/CvTooltip/CvInteractiveTooltip.vue +267 -0
  60. package/src/components/CvTooltip/CvTooltip.stories.js +128 -0
  61. package/src/components/CvTooltip/CvTooltip.vue +44 -0
  62. package/src/components/CvTooltip/__tests__/__snapshots__/CvTooltip.spec.js.snap +525 -0
  63. package/src/components/CvTooltip/consts.js +15 -0
  64. package/src/components/CvTooltip/index.js +6 -0
  65. package/src/components/CvTooltip/sbTooltipPrefix.js +2 -0
  66. package/src/components/CvUIShell/CvSideNav.vue +10 -1
  67. package/src/components/CvUIShell/CvUIShell.stories.mdx +116 -50
  68. package/src/index.d.ts +6 -0
  69. package/src/index.js +11 -0
  70. package/src/use/cvCheck.js +3 -0
  71. package/src/use/index.js +2 -0
  72. package/src/use/useMethods.js +18 -0
  73. package/src/use/useRadio.js +25 -0
package/package.json CHANGED
@@ -1,24 +1,26 @@
1
1
  {
2
2
  "name": "@carbon/vue",
3
3
  "license": "Apache-2.0",
4
- "version": "3.0.7-alpha.0",
4
+ "version": "3.0.8-alpha.0",
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
+ "types": "src/index.d.ts",
8
9
  "scripts": {
9
10
  "_postinstall": "node prepare.js",
10
11
  "prepack": "pinst --disable",
11
12
  "postpack": "pinst --enable",
12
13
  "build": "vue-cli-service build --target lib --name carbon-vue-3 ./src/index.js --no-clean",
13
14
  "lint": "vue-cli-service lint",
14
- "ci-check": "yarn format:diff && yarn test --no-coverage && yarn build",
15
+ "ci-check": "yarn format:diff && yarn test && yarn build",
15
16
  "format": "prettier --write '**/*.{scss,css,js,md,vue}' '!**/{build,es,lib,storybook,ts,umd,.coverage}/**'",
16
17
  "format:diff": "prettier --list-different '**/*.{scss,css,js,md,vue}' '!**/{dist,storybook-static,.coverage}/**'",
17
18
  "format:staged": "prettier --write '**/*.{scss,css,js,md,vue}' '!**/{dist,storybook-static,.coverage}/**'",
18
19
  "lint:css": "stylelint '{packages,storybook}/**/*.{vue,scss}'",
19
20
  "lint:es": "eslint src/**/*.{js,vue}",
20
21
  "lint:style": "vue-cli-service lint:style",
21
- "test": "vue-cli-service test:unit",
22
+ "serve:storybook": "cd ./storybook && yarn run serve",
23
+ "test": "vue-cli-service test:unit --no-coverage",
22
24
  "a11test": "node -v"
23
25
  },
24
26
  "workspaces": [
@@ -28,6 +30,7 @@
28
30
  "@carbon/icons-vue": "^10.60.0",
29
31
  "@vueuse/core": "^4.11.2",
30
32
  "carbon-components": "^10.58.5",
33
+ "eslint-plugin-prettier-vue": "^4.2.0",
31
34
  "flatpickr": "^4.6.13",
32
35
  "mitt": "^3.0.0"
33
36
  },
@@ -203,5 +206,5 @@
203
206
  "url": "git+https://github.com/carbon-design-system/carbon-components-vue.git"
204
207
  },
205
208
  "sideEffects": true,
206
- "gitHead": "39152672459e58bef32b4eba92078c4ebdbe7ec9"
209
+ "gitHead": "15a95f30d38d6b600fd1b70274502895e777e02c"
207
210
  }
@@ -4,7 +4,7 @@ import {
4
4
  storyParametersObject,
5
5
  } from '../../global/storybook-utils';
6
6
 
7
- import { CvCheckbox } from '.';
7
+ import { CvCheckbox, CvCheckboxSkeleton } from '.';
8
8
  import { action } from '@storybook/addon-actions';
9
9
  import { props as propsCvCheck } from '../../use/cvCheck';
10
10
  import { ref } from 'vue';
@@ -14,21 +14,18 @@ export default {
14
14
  component: CvCheckbox,
15
15
  argTypes: {
16
16
  ...storybookControlsFromProps(propsCvCheck),
17
- label: { description: 'checkbox label' },
18
17
  value: {
19
18
  type: 'string',
19
+ description:
20
+ 'The value associated with the input (this is also the value that is sent on submit)',
20
21
  table: {
21
22
  type: { summary: 'string' },
22
23
  category: 'props',
23
24
  },
24
25
  },
25
- hideLabel: {
26
- description:
27
- 'makes the label visually hidden but still labels the checkbox',
28
- },
29
26
  mixed: {
30
27
  type: 'boolean',
31
- description: 'if true aria-checkbox set to mixed if checked is false',
28
+ description: 'Specify whether the Checkbox is in an indeterminate state',
32
29
  table: {
33
30
  type: { summary: 'boolean' },
34
31
  category: 'props',
@@ -47,12 +44,14 @@ export default {
47
44
  },
48
45
  checked: {
49
46
  type: 'boolean',
47
+ description: 'Specify whether the underlying input should be checked',
50
48
  table: {
51
49
  type: { summary: 'boolean' },
52
50
  category: 'props',
53
51
  },
54
52
  },
55
53
  },
54
+ parameters: { controls: { exclude: ['change', 'update:modelValue'] } },
56
55
  };
57
56
 
58
57
  const template = `
@@ -109,3 +108,15 @@ vModel.parameters = storyParametersObject(
109
108
  templateVModel,
110
109
  vModel.args
111
110
  );
111
+
112
+ const templateSkeleton = `<cv-checkbox-skeleton></cv-checkbox-skeleton>`;
113
+
114
+ const TemplateSkeleton = () => {
115
+ return {
116
+ components: { CvCheckboxSkeleton },
117
+ setup: () => {},
118
+ template: templateSkeleton,
119
+ };
120
+ };
121
+
122
+ export const Skeleton = TemplateSkeleton.bind({});
@@ -23,8 +23,7 @@
23
23
  :class="[
24
24
  `${carbonPrefix}--checkbox-label`,
25
25
  {
26
- [`${carbonPrefix}--label--disabled`]:
27
- $attrs.disabled !== undefined && this.$attrs.disabled,
26
+ [`${carbonPrefix}--label--disabled`]: disabled,
28
27
  [`${carbonPrefix}--checkbox-label__focus`]: hasFocus,
29
28
  },
30
29
  ]"
@@ -41,16 +40,33 @@
41
40
  </template>
42
41
 
43
42
  <script setup>
44
- import { ref, toRefs } from 'vue';
43
+ // noinspection ES6PreferShortImport
45
44
  import { carbonPrefix } from '../../global/settings';
45
+ import { ref, toRefs } from 'vue';
46
46
  import { useCheck, props as propsCvCheck } from '../../use/cvCheck';
47
47
  import { useCvId, props as propsCvId } from '../../use/cvId';
48
48
 
49
49
  const props = defineProps({
50
+ /**
51
+ * Specify whether the label should be hidden, or not
52
+ */
50
53
  hideLabel: { type: Boolean, default: null },
54
+ /**
55
+ * Provide a label to provide a description of the Checkbox input that you are exposing to the user
56
+ */
51
57
  label: { type: String, default: null },
58
+ /**
59
+ * Specify whether the "bx--form-item" style should be applied
60
+ */
52
61
  formItem: { type: Boolean, default: true },
62
+ /**
63
+ * Specify whether the "bx--checkbox--inline" style should be applied
64
+ */
53
65
  inline: { type: Boolean, default: false },
66
+ /**
67
+ * Specify whether the Checkbox should be disabled
68
+ */
69
+ disabled: { type: Boolean, default: false },
54
70
  ...propsCvCheck,
55
71
  ...propsCvId,
56
72
  });
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <div
3
+ class="cv-checkbox"
4
+ :class="`${carbonPrefix}--form-item ${carbonPrefix}--checkbox-wrapper`"
5
+ >
6
+ <label :class="`${carbonPrefix}--checkbox-label ${carbonPrefix}--skeleton`">
7
+ <span
8
+ :class="`${carbonPrefix}--checkbox-label-text ${carbonPrefix}--skeleton`"
9
+ ></span>
10
+ </label>
11
+ </div>
12
+ </template>
13
+
14
+ <script setup>
15
+ import { carbonPrefix } from '../../global/settings';
16
+ </script>
@@ -0,0 +1,3 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`CvCheckboxSkeleton renders checkbox skeleton 1`] = `<div class="cv-checkbox bx--form-item bx--checkbox-wrapper"><label class="bx--checkbox-label bx--skeleton"><span class="bx--checkbox-label-text bx--skeleton"></span></label></div>`;
@@ -1,3 +1,4 @@
1
1
  import CvCheckbox from './CvCheckbox.vue';
2
- export { CvCheckbox };
2
+ import CvCheckboxSkeleton from './CvCheckboxSkeleton.vue';
3
+ export { CvCheckbox, CvCheckboxSkeleton };
3
4
  export default CvCheckbox;
@@ -325,8 +325,6 @@ const wrapperStyleOverride = computed(() => {
325
325
  });
326
326
  const el = ref(null);
327
327
  function onClickOut() {
328
- // eslint-disable-next-line no-console
329
- console.log('onClickOut');
330
328
  open.value = false;
331
329
  }
332
330
  onClickOutside(el, onClickOut);
@@ -0,0 +1,333 @@
1
+ import { Canvas, Meta, Story } from '@storybook/addon-docs';
2
+ import { sbCompPrefix } from '../../global/storybook-utils';
3
+ import { CvFileUploader, CvFileUploaderSkeleton } from '.';
4
+ import { KINDS } from './const';
5
+ import { action } from '@storybook/addon-actions';
6
+ import { nextTick, ref } from 'vue';
7
+ import { Add16 } from '@carbon/icons-vue';
8
+ import { buttonKinds, buttonSizes } from '../CvButton/consts';
9
+
10
+ <Meta title={`${sbCompPrefix}/CvFileUploader`} component={CvFileUploader} />
11
+
12
+ export const Template = args => ({
13
+ components: {
14
+ CvFileUploader,
15
+ CvFileUploaderSkeleton,
16
+ Add16
17
+ },
18
+ setup() {
19
+ return {
20
+ slotContent: args.slot,
21
+ args: {
22
+ ...args,
23
+ template: undefined,
24
+ },
25
+ };
26
+ },
27
+ template: args.template,
28
+ });
29
+ const defaultTemplate = `
30
+ <div style="display: inline-flex; align-items: flex-start;">
31
+ <cv-file-uploader v-bind="args" />
32
+ </div>
33
+ `;
34
+ const slotTemplate = `
35
+ <div style="display: inline-flex; align-items: flex-start;">
36
+ <cv-file-uploader v-bind="args">
37
+ <template v-slot:drop-target>
38
+ <Add16 />
39
+ <span>File Drop</span>
40
+ <Add16 />
41
+ </template>
42
+ </cv-file-uploader>
43
+ </div>
44
+ `;
45
+ const skeletonTemplate = `
46
+ <div style="display: inline-flex; align-items: flex-start;">
47
+ <cv-file-uploader-skeleton />
48
+ </div>
49
+ `;
50
+
51
+ export const args = {
52
+ // attributes
53
+ multiple: {
54
+ type: 'boolean',
55
+ table: {
56
+ type: { summary: 'boolean' },
57
+ category: 'attributes',
58
+ },
59
+ description: 'standard input attribute for file type, allow multiple files to be added in a single prompt',
60
+ },
61
+ // props
62
+ accept: {
63
+ type: 'string',
64
+ table: {
65
+ type: { summary: 'string' },
66
+ category: 'props',
67
+ },
68
+ description: 'standard input attribute for file type',
69
+ },
70
+ buttonKind: {
71
+ control: 'select',
72
+ options: buttonKinds,
73
+ defaultValue: 'primary',
74
+ table: {
75
+ type: { summary: 'string' },
76
+ category: 'props',
77
+ defaultValue: { summary: 'primary' },
78
+ },
79
+ description: 'Button kind',
80
+ },
81
+ buttonLabel: {
82
+ type: 'string',
83
+ deprecated: true,
84
+ table: {
85
+ type: { summary: 'string' },
86
+ category: 'props',
87
+ },
88
+ description: '`button-label` prop deprecated in favour of drop-target-label',
89
+ },
90
+ buttonSize: {
91
+ control: 'select',
92
+ options: buttonSizes,
93
+ defaultValue: '',
94
+ table: {
95
+ type: { summary: 'string' },
96
+ category: 'props',
97
+ defaultValue: { summary: '' },
98
+ },
99
+ description: 'Button size',
100
+ },
101
+ clearOnReselect: {
102
+ type: 'boolean',
103
+ table: {
104
+ type: { summary: 'boolean' },
105
+ category: 'props',
106
+ },
107
+ description: 'Reset file list when files are added',
108
+ },
109
+ dropTargetLabel: {
110
+ type: 'string',
111
+ table: {
112
+ type: { summary: 'string' },
113
+ category: 'props',
114
+ },
115
+ description: "Drag & drop zone label. Also used as button label for button kind file uploader",
116
+ },
117
+ helperText: {
118
+ type: 'string',
119
+ table: {
120
+ type: { summary: 'string' },
121
+ category: 'props',
122
+ },
123
+ description: 'Helper text positioned below label',
124
+ },
125
+ kind: {
126
+ type: 'string',
127
+ control: 'select',
128
+ defaultValue: KINDS.DRAG_TARGET,
129
+ options: [KINDS.DRAG_TARGET, KINDS.BUTTON],
130
+ table: {
131
+ type: { summary: `${KINDS.DRAG_TARGET} | ${KINDS.BUTTON}` },
132
+ category: 'props',
133
+ defaultValue: { summary: KINDS.DRAG_TARGET },
134
+ },
135
+ description: 'Kind of file uploader to present',
136
+ },
137
+ label: {
138
+ table: {
139
+ type: { summary: 'text' },
140
+ category: 'props',
141
+ },
142
+ description: 'File input label',
143
+ },
144
+ removable: {
145
+ type: 'boolean',
146
+ table: {
147
+ type: { summary: 'boolean' },
148
+ category: 'props',
149
+ },
150
+ description: 'Enable file items remove button',
151
+ },
152
+ removeAriaLabel: {
153
+ type: 'string',
154
+ defaultValue: 'Remove selected file',
155
+ table: {
156
+ type: { summary: 'string' },
157
+ category: 'props',
158
+ defaultValue: { summary: 'Remove selected file' },
159
+ },
160
+ description: 'Aria label for item remove button',
161
+ },
162
+ // exposed methods
163
+ clear: {
164
+ control: 'none',
165
+ type: 'function',
166
+ table: {
167
+ type: { summary: '() => void' },
168
+ category: 'exposed methods',
169
+ },
170
+ description: 'Clear file list',
171
+ },
172
+ remove: {
173
+ control: 'none',
174
+ type: 'function',
175
+ table: {
176
+ type: { summary: '(index: number) => void' },
177
+ category: 'exposed methods',
178
+ },
179
+ description: 'Removes an individual file',
180
+ },
181
+ setState: {
182
+ control: 'none',
183
+ type: 'function',
184
+ table: {
185
+ type: { summary: '(index: number, state: string) => void' },
186
+ category: 'exposed methods',
187
+ },
188
+ description: 'Update the "state" field of a file. State must be `""`, `complete` or `loading`',
189
+ },
190
+ setInvalidMessage: {
191
+ control: 'none',
192
+ type: 'function',
193
+ table: {
194
+ type: { summary: '(index: number, invalidMessage: string) => void' },
195
+ category: 'exposed methods',
196
+ },
197
+ description: 'Update the "invalidMessage" field of a file.',
198
+ },
199
+ // slots
200
+ 'drop-target': {
201
+ control: 'none',
202
+ type: 'string',
203
+ table: {
204
+ type: { summary: 'string | HTML | Component' },
205
+ category: 'slots',
206
+ },
207
+ description: 'Overrides the drop-target-label with slotted content',
208
+ },
209
+ };
210
+
211
+ # CvFileUploader
212
+
213
+ Migration notes:
214
+
215
+ - The `v-model` is different in Vue 3 than Vue 2. You can still specify the `v-model="something"` for two way data bind,
216
+ but the value property is now `modelValue` instead of `files` and event linked to v-model is `update:modelValue`.
217
+
218
+ <Canvas>
219
+ <Story
220
+ name="Default"
221
+ parameters={{
222
+ controls: {
223
+ exclude: [
224
+ 'template',
225
+ 'props',
226
+ 'modelValue',
227
+ 'update:modelValue',
228
+ ],
229
+ },
230
+ docs: { source: { code: defaultTemplate } },
231
+ }}
232
+ args={{
233
+ template: defaultTemplate,
234
+ label: 'Choose files to upload',
235
+ helperText: 'Select the files you want to upload',
236
+ removable: true,
237
+ }}
238
+ argTypes={args}
239
+ >
240
+ {Template.bind({})}
241
+ </Story>
242
+ </Canvas>
243
+
244
+ # CvFileUploader Button
245
+
246
+ <Canvas>
247
+ <Story
248
+ name="FilerUploader Button"
249
+ parameters={{
250
+ controls: {
251
+ exclude: [
252
+ 'template',
253
+ 'props',
254
+ 'modelValue',
255
+ 'update:modelValue',
256
+ ],
257
+ },
258
+ docs: { source: { code: defaultTemplate } },
259
+ }}
260
+ args={{
261
+ template: defaultTemplate,
262
+ label: 'Choose files to upload',
263
+ helperText: 'Select the files you want to upload',
264
+ kind: KINDS.BUTTON,
265
+ removable: true,
266
+ }}
267
+ argTypes={{
268
+ ...args,
269
+ kind: {
270
+ ...args.kind,
271
+ control: 'none',
272
+ },
273
+ }}
274
+ >
275
+ {Template.bind({})}
276
+ </Story>
277
+ </Canvas>
278
+
279
+ # CvFileUploader Slotted
280
+
281
+ <Canvas>
282
+ <Story
283
+ name="Slot"
284
+ parameters={{
285
+ controls: {
286
+ exclude: [
287
+ 'template',
288
+ 'props',
289
+ 'modelValue',
290
+ 'update:modelValue',
291
+ ],
292
+ },
293
+ docs: { source: { code: slotTemplate } },
294
+ }}
295
+ args={{
296
+ template: slotTemplate,
297
+ label: 'Choose files to upload',
298
+ helperText: 'Select the files you want to upload',
299
+ removable: true,
300
+ }}
301
+ argTypes={{
302
+ ...args,
303
+ kind: {
304
+ ...args.kind,
305
+ control: 'none',
306
+ },
307
+ }}
308
+ >
309
+ {Template.bind({})}
310
+ </Story>
311
+ </Canvas>
312
+
313
+ # CvFileUploaderSkeleton
314
+
315
+ <Canvas>
316
+ <Story
317
+ name="Skeleton"
318
+ parameters={{
319
+ controls: {
320
+ exclude: [
321
+ 'template',
322
+ ],
323
+ },
324
+ docs: { source: { code: skeletonTemplate } },
325
+ }}
326
+ args={{
327
+ template: skeletonTemplate,
328
+ }}
329
+ argTypes={{}}
330
+ >
331
+ {Template.bind({})}
332
+ </Story>
333
+ </Canvas>