@carbon/vue 3.0.6-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 (109) hide show
  1. package/README.md +7 -0
  2. package/dist/carbon-vue-3.common.js +16111 -9105
  3. package/dist/carbon-vue-3.common.js.map +1 -1
  4. package/dist/carbon-vue-3.umd.js +16111 -9105
  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 +9 -6
  9. package/src/components/CvAccordion/CvAccordion.stories.js +1 -0
  10. package/src/components/CvButton/CvButton.stories.js +3 -3
  11. package/src/components/CvButton/CvButtonSkeleton.stories.js +79 -0
  12. package/src/components/CvButton/CvButtonSkeleton.vue +19 -0
  13. package/src/components/CvButton/index.js +8 -1
  14. package/src/components/CvCheckbox/CvCheckbox.stories.js +18 -7
  15. package/src/components/CvCheckbox/CvCheckbox.vue +19 -3
  16. package/src/components/CvCheckbox/CvCheckboxSkeleton.vue +16 -0
  17. package/src/components/CvCheckbox/__tests__/__snapshots__/CvCheckboxSkeleton.spec.js.snap +3 -0
  18. package/src/components/CvCheckbox/index.js +2 -1
  19. package/src/components/CvDatePicker/CvDatePicker.vue +1 -1
  20. package/src/components/CvDropdown/CvDropdown.stories.mdx +407 -0
  21. package/src/components/CvDropdown/CvDropdown.vue +416 -0
  22. package/src/components/CvDropdown/CvDropdownItem.vue +86 -0
  23. package/src/components/CvDropdown/CvDropdownSkeleton.vue +17 -0
  24. package/src/components/CvDropdown/index.js +5 -0
  25. package/src/components/CvFileUploader/CvFileUploader.stories.mdx +333 -0
  26. package/src/components/CvFileUploader/CvFileUploader.vue +286 -0
  27. package/src/components/CvFileUploader/CvFileUploaderItem.vue +92 -0
  28. package/src/components/CvFileUploader/CvFileUploaderSkeleton.vue +16 -0
  29. package/src/components/CvFileUploader/const.js +10 -0
  30. package/src/components/CvFileUploader/index.js +5 -0
  31. package/src/components/CvForm/CvFormGroup.vue +1 -1
  32. package/src/components/CvInlineLoading/CvInlineLoading.stories.mdx +87 -0
  33. package/src/components/CvInlineLoading/CvInlineLoading.vue +144 -0
  34. package/src/components/CvInlineLoading/consts.js +9 -0
  35. package/src/components/CvInlineLoading/index.js +4 -0
  36. package/src/components/CvModal/CvModal.stories.mdx +4 -2
  37. package/src/components/CvModal/CvModal.vue +3 -5
  38. package/src/components/CvMultiSelect/CvMultiSelect.stories.mdx +333 -0
  39. package/src/components/CvMultiSelect/CvMultiSelect.vue +705 -0
  40. package/src/components/CvMultiSelect/consts.js +16 -0
  41. package/src/components/CvMultiSelect/index.js +3 -0
  42. package/src/components/CvNumberInput/CvNumberInput.stories.js +265 -0
  43. package/src/components/CvNumberInput/CvNumberInput.vue +227 -0
  44. package/src/components/CvNumberInput/CvNumberInputSkeleton.stories.js +30 -0
  45. package/src/components/CvNumberInput/CvNumberInputSkeleton.vue +10 -0
  46. package/src/components/CvNumberInput/StorybookGroupConst.js +1 -0
  47. package/src/components/CvNumberInput/__tests__/__snapshots__/CvNumberInput.spec.js.snap +21 -0
  48. package/src/components/CvNumberInput/index.js +5 -0
  49. package/src/components/CvProgress/CvProgress.stories.mdx +202 -0
  50. package/src/components/CvProgress/CvProgress.vue +78 -0
  51. package/src/components/CvProgress/CvProgressStep.vue +124 -0
  52. package/src/components/CvProgress/index.js +4 -0
  53. package/src/components/CvRadioButton/CvRadioButton.stories.js +166 -0
  54. package/src/components/CvRadioButton/CvRadioButton.vue +57 -0
  55. package/src/components/CvRadioButton/CvRadioGroup.vue +27 -0
  56. package/src/components/CvRadioButton/__tests__/__snapshots__/CvRadioButton.spec.js.snap +27 -0
  57. package/src/components/CvRadioButton/index.js +6 -0
  58. package/src/components/CvSearch/CvSearch.stories.mdx +168 -0
  59. package/src/components/CvSearch/CvSearch.vue +250 -0
  60. package/src/components/CvSearch/index.js +3 -0
  61. package/src/components/CvSelect/CvSelect.vue +27 -6
  62. package/src/components/CvSlider/CvSlider.stories.js +166 -0
  63. package/src/components/CvSlider/CvSlider.vue +324 -0
  64. package/src/components/CvSlider/CvSliderSkeleton.stories.js +26 -0
  65. package/src/components/CvSlider/CvSliderSkeleton.vue +18 -0
  66. package/src/components/CvSlider/__tests__/__snapshots__/CvSlider.spec.js.snap +13 -0
  67. package/src/components/CvSlider/__tests__/__snapshots__/CvSliderSkeleton.spec.js.snap +13 -0
  68. package/src/components/CvSlider/index.js +5 -0
  69. package/src/components/CvSlider/sbSliderPrefix.js +2 -0
  70. package/src/components/CvTabs/CvTab.vue +77 -0
  71. package/src/components/CvTabs/CvTabs.stories.mdx +175 -0
  72. package/src/components/CvTabs/CvTabs.vue +406 -0
  73. package/src/components/CvTabs/CvTabsSkeleton.vue +24 -0
  74. package/src/components/CvTabs/_SbContainer.vue +22 -0
  75. package/src/components/CvTabs/index.js +5 -0
  76. package/src/components/CvTextArea/CvTextArea.stories.js +2 -2
  77. package/src/components/CvTextArea/CvTextAreaSkeleton.stories.js +29 -0
  78. package/src/components/CvTextArea/CvTextAreaSkeleton.vue +10 -0
  79. package/src/components/CvTextArea/StorybookGroupConst.js +1 -0
  80. package/src/components/CvTextArea/__tests__/__snapshots__/CvTextAreaSkeleton.spec.js.snap +7 -0
  81. package/src/components/CvTextArea/index.js +2 -1
  82. package/src/components/CvTimePicker/CvTimePicker.stories.mdx +325 -0
  83. package/src/components/CvTimePicker/CvTimePicker.vue +217 -0
  84. package/src/components/CvTimePicker/index.js +21 -0
  85. package/src/components/CvToggle/CvToggle-Skeleton.vue +44 -0
  86. package/src/components/CvToggle/CvToggle.stories.js +249 -0
  87. package/src/components/CvToggle/CvToggle.vue +87 -0
  88. package/src/components/CvToggle/__tests__/__snapshots__/CvToggle.spec.js.snap +7 -0
  89. package/src/components/CvToggle/index.js +4 -0
  90. package/src/components/CvTooltip/CvDefinitionTooltip.stories.js +80 -0
  91. package/src/components/CvTooltip/CvDefinitionTooltip.vue +61 -0
  92. package/src/components/CvTooltip/CvInteractiveTooltip.stories.js +90 -0
  93. package/src/components/CvTooltip/CvInteractiveTooltip.vue +267 -0
  94. package/src/components/CvTooltip/CvTooltip.stories.js +128 -0
  95. package/src/components/CvTooltip/CvTooltip.vue +44 -0
  96. package/src/components/CvTooltip/__tests__/__snapshots__/CvTooltip.spec.js.snap +525 -0
  97. package/src/components/CvTooltip/consts.js +15 -0
  98. package/src/components/CvTooltip/index.js +6 -0
  99. package/src/components/CvTooltip/sbTooltipPrefix.js +2 -0
  100. package/src/components/CvUIShell/CvSideNav.vue +10 -1
  101. package/src/components/CvUIShell/CvUIShell.stories.mdx +116 -50
  102. package/src/global/storybook-utils/story-source-code.js +1 -0
  103. package/src/index.d.ts +6 -0
  104. package/src/index.js +11 -0
  105. package/src/use/cvCheck.js +3 -0
  106. package/src/use/cvInput.js +34 -0
  107. package/src/use/index.js +2 -0
  108. package/src/use/useMethods.js +18 -0
  109. 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.6-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
  },
@@ -43,7 +46,7 @@
43
46
  "@vue/cli-plugin-eslint": "^5.0.8",
44
47
  "@vue/cli-plugin-unit-jest": "^5.0.8",
45
48
  "@vue/cli-service": "^5.0.8",
46
- "@vue/compiler-sfc": "^3.2.45",
49
+ "@vue/compiler-sfc": "^3.3.4",
47
50
  "@vue/eslint-config-prettier": "^7.0.0",
48
51
  "@vue/test-utils": "^2.2.4",
49
52
  "@vue/vue3-jest": "^27.0.0",
@@ -70,7 +73,7 @@
70
73
  "stylelint": "^14.15.0",
71
74
  "stylelint-config-property-sort-order-smacss": "^9.0.0",
72
75
  "stylelint-config-sass-guidelines": "^9.0.1",
73
- "vue": "^3.2.45",
76
+ "vue": "^3.3.4",
74
77
  "vue-loader": "^17.0.1",
75
78
  "webpack": "^5.75.0"
76
79
  },
@@ -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": "b428c30785a4cfc937c68a3122e0af82645fef8e"
209
+ "gitHead": "15a95f30d38d6b600fd1b70274502895e777e02c"
207
210
  }
@@ -30,6 +30,7 @@ const template = `<cv-accordion @change="onChange" v-bind="args">
30
30
  </cv-accordion-item>
31
31
  </cv-accordion>`;
32
32
  const Template = (args, { argTypes }) => {
33
+ // eslint-disable-next-line no-param-reassign
33
34
  args = {
34
35
  ...args,
35
36
  align: alignConsts[alignConsts.$labels[args.align]],
@@ -87,7 +87,7 @@ Secondary.parameters = storyParametersObject(
87
87
 
88
88
  export const Field = Template.bind({});
89
89
  Field.args = {
90
- 'slotArgs.default': 'Field size',
90
+ default: 'Field size',
91
91
  size: 'field',
92
92
  };
93
93
  Field.parameters = storyParametersObject(
@@ -98,7 +98,7 @@ Field.parameters = storyParametersObject(
98
98
 
99
99
  export const Small = Template.bind({});
100
100
  Small.args = {
101
- 'slotArgs.default': 'sm',
101
+ default: 'sm',
102
102
  size: 'sm',
103
103
  };
104
104
  Small.parameters = storyParametersObject(
@@ -109,7 +109,7 @@ Small.parameters = storyParametersObject(
109
109
 
110
110
  export const Large = Template.bind({});
111
111
  Large.args = {
112
- 'slotArgs.default': 'Large size',
112
+ default: 'Large size',
113
113
  size: 'lg',
114
114
  };
115
115
  Large.parameters = storyParametersObject(
@@ -0,0 +1,79 @@
1
+ import { CvButtonSkeleton } from '.';
2
+ import { buttonSizes } from './consts.js';
3
+ import {
4
+ sbCompPrefix,
5
+ storybookControlsFromProps,
6
+ storyParametersObject,
7
+ } from '../../global/storybook-utils';
8
+ import { sbBtnPrefix } from './sbBtnPrefix';
9
+
10
+ import { props as commonCvButtonProps } from './CvButtonCommon';
11
+
12
+ export default {
13
+ title: `${sbCompPrefix}/${sbBtnPrefix}/CvButtonSkeleton`,
14
+ component: CvButtonSkeleton,
15
+ argTypes: {
16
+ ...storybookControlsFromProps({ size: commonCvButtonProps.size }),
17
+ size: {
18
+ control: { type: 'select', options: buttonSizes },
19
+ defaultValue: 'default',
20
+ },
21
+ },
22
+ };
23
+
24
+ const template = `<cv-button-skeleton v-bind="buttonProps" />`;
25
+ const Template = (args, { argTypes }) => {
26
+ const buttonProps = { ...args };
27
+ return {
28
+ props: Object.keys(argTypes),
29
+ components: { CvButtonSkeleton },
30
+ template,
31
+ setup() {
32
+ return { buttonProps };
33
+ },
34
+ };
35
+ };
36
+
37
+ export const Default = Template.bind({});
38
+ Default.args = {
39
+ size: 'default',
40
+ };
41
+ Default.parameters = storyParametersObject(
42
+ Default.parameters,
43
+ template,
44
+ Default.args,
45
+ 'v-bind="buttonProps"'
46
+ );
47
+
48
+ export const Field = Template.bind({});
49
+ Field.args = {
50
+ size: 'field',
51
+ };
52
+ Field.parameters = storyParametersObject(
53
+ Field.parameters,
54
+ template,
55
+ Field.args,
56
+ 'v-bind="buttonProps"'
57
+ );
58
+
59
+ export const Small = Template.bind({});
60
+ Small.args = {
61
+ size: 'sm',
62
+ };
63
+ Small.parameters = storyParametersObject(
64
+ Small.parameters,
65
+ template,
66
+ Small.args,
67
+ 'v-bind="buttonProps"'
68
+ );
69
+
70
+ export const Large = Template.bind({});
71
+ Large.args = {
72
+ size: 'lg',
73
+ };
74
+ Large.parameters = storyParametersObject(
75
+ Large.parameters,
76
+ template,
77
+ Large.args,
78
+ 'v-bind="buttonProps"'
79
+ );
@@ -0,0 +1,19 @@
1
+ <template>
2
+ <button disabled :class="buttonClasses" type="button"></button>
3
+ </template>
4
+
5
+ <script setup>
6
+ import {
7
+ props as commonCvButtonProps,
8
+ useCvButtonCommon,
9
+ } from './CvButtonCommon';
10
+
11
+ const props = defineProps({
12
+ /**
13
+ * Size of the button
14
+ */
15
+ size: commonCvButtonProps.size,
16
+ });
17
+
18
+ const { buttonClasses } = useCvButtonCommon(undefined, props.size, true);
19
+ </script>
@@ -1,7 +1,14 @@
1
1
  import CvButton from './CvButton.vue';
2
2
  import CvIconButton from './CvIconButton.vue';
3
3
  import CvButtonSet from './CvButtonSet.vue';
4
+ import CvButtonSkeleton from './CvButtonSkeleton.vue';
4
5
  import CvButtonConsts from './consts';
5
6
 
6
- export { CvButton, CvButtonConsts, CvButtonSet, CvIconButton };
7
+ export {
8
+ CvButton,
9
+ CvButtonConsts,
10
+ CvButtonSet,
11
+ CvIconButton,
12
+ CvButtonSkeleton,
13
+ };
7
14
  export default CvButton;
@@ -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;
@@ -113,7 +113,6 @@ import {
113
113
  ref,
114
114
  computed,
115
115
  onMounted,
116
- onUpdated,
117
116
  onBeforeMount,
118
117
  onUnmounted,
119
118
  watch,
@@ -305,6 +304,7 @@ let dateToString = val => {
305
304
  return calendar.formatDate(val, props.calOptions.dateFormat);
306
305
  };
307
306
 
307
+ // eslint-disable-next-line no-unused-vars
308
308
  const handleDatePick = (selectedDates, dateStr, instance) => {
309
309
  if (isSingle.value) {
310
310
  const temp = dateToString(selectedDates[0]);