@carbon/vue 3.0.11 → 3.0.13

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 +4 -4
  2. package/dist/carbon-vue-3.common.js +197 -99
  3. package/dist/carbon-vue-3.common.js.map +1 -1
  4. package/dist/carbon-vue-3.umd.js +197 -99
  5. package/dist/carbon-vue-3.umd.js.map +1 -1
  6. package/dist/carbon-vue-3.umd.min.js +2 -2
  7. package/dist/carbon-vue-3.umd.min.js.map +1 -1
  8. package/dist/web-types.json +5505 -0
  9. package/package.json +2 -2
  10. package/src/components/CvAccordion/CvAccordion.stories.mdx +153 -0
  11. package/src/components/CvAccordion/CvAccordion.vue +18 -5
  12. package/src/components/CvAccordion/CvAccordionItem.vue +18 -6
  13. package/src/components/CvAccordion/consts.js +8 -9
  14. package/src/components/CvCheckbox/CvCheckbox.vue +6 -2
  15. package/src/components/CvDataTable/CvDataTable.stories.mdx +39 -14
  16. package/src/components/CvDataTable/CvDataTableHeading.vue +3 -5
  17. package/src/components/CvDatePicker/CvDatePicker.stories.js +165 -14
  18. package/src/components/CvDatePicker/CvDatePicker.vue +31 -17
  19. package/src/components/CvModal/CvModal.vue +35 -13
  20. package/src/components/CvModal/index.js +29 -1
  21. package/src/components/CvMultiSelect/CvMultiSelect.vue +2 -2
  22. package/src/components/CvNotification/CvInlineNotification.stories.js +58 -1
  23. package/src/components/CvNotification/CvInlineNotification.vue +13 -3
  24. package/src/components/CvNotification/CvInlineNotificationTemplate.mdx +16 -0
  25. package/src/components/CvRadioButton/CvRadioButton.stories.js +20 -1
  26. package/src/components/CvRadioButton/CvRadioButton.vue +7 -5
  27. package/src/components/CvRadioButton/CvRadioGroup.vue +18 -2
  28. package/src/components/CvRadioButton/__tests__/__snapshots__/CvRadioButton.spec.js.snap +6 -4
  29. package/src/components/CvSearch/CvSearch.vue +1 -1
  30. package/src/components/CvTabs/CvTabs.vue +2 -2
  31. package/src/components/CvAccordion/CvAccordion.stories.js +0 -55
@@ -15,10 +15,14 @@
15
15
  />
16
16
  <div :class="`${carbonPrefix}--inline-notification__text-wrapper`">
17
17
  <p :class="`${carbonPrefix}--inline-notification__title`">
18
- {{ title }}
18
+ <slot name="title">
19
+ {{ title }}
20
+ </slot>
19
21
  </p>
20
22
  <div :class="`${carbonPrefix}--inline-notification__subtitle`">
21
- {{ subTitle }}
23
+ <slot name="subtitle">
24
+ {{ subTitle }}
25
+ </slot>
22
26
  </div>
23
27
  </div>
24
28
  </div>
@@ -35,6 +39,7 @@
35
39
  {{ actionLabel }}
36
40
  </button>
37
41
  <button
42
+ v-if="!hideCloseButton"
38
43
  type="button"
39
44
  :aria-label="closeAriaLabel"
40
45
  :class="`${carbonPrefix}--inline-notification__close-button`"
@@ -66,7 +71,7 @@ export default {
66
71
  type: String,
67
72
  default: '',
68
73
  },
69
- /** Notification sub title (supports HTML) */
74
+ /** Notification subtitle */
70
75
  subTitle: {
71
76
  type: String,
72
77
  default: '',
@@ -86,6 +91,11 @@ export default {
86
91
  type: Boolean,
87
92
  default: false,
88
93
  },
94
+ /** Set to true to hide the code button */
95
+ hideCloseButton: {
96
+ type: Boolean,
97
+ default: false,
98
+ },
89
99
  },
90
100
  emits: [
91
101
  /** Emitted on clicking the action button */
@@ -0,0 +1,16 @@
1
+ import { Meta, Title, Primary, Stories } from '@storybook/addon-docs';
2
+
3
+ <Meta isTemplate />
4
+
5
+ <Title />
6
+
7
+ Migration notes:
8
+
9
+ - **Breaking**. The `subTitle` property no longer renders html. Please use the `subtitle` slot instead.
10
+ - The `title` content can now be provided in the `title` slot.
11
+
12
+ <Primary />
13
+
14
+ <Controls />
15
+
16
+ <Stories />
@@ -38,11 +38,28 @@ export default {
38
38
  type: 'boolean',
39
39
  table: {
40
40
  type: { summary: 'boolean' },
41
- category: 'props',
41
+ category: 'CvRadioGroup - props',
42
42
  },
43
43
  description:
44
44
  'Property of CvRadioGroup component - stacks inside radio components vertically',
45
45
  },
46
+ legendText: {
47
+ control: 'text',
48
+ table: {
49
+ type: { summary: 'text' },
50
+ category: 'CvRadioGroup - props',
51
+ },
52
+ description: 'Property of CvRadioGroup component',
53
+ },
54
+ hideLegend: {
55
+ type: 'boolean',
56
+ table: {
57
+ type: { summary: 'boolean' },
58
+ category: 'CvRadioGroup - props',
59
+ },
60
+ description:
61
+ 'Property of CvRadioGroup component - makes the legend visually hidden',
62
+ },
46
63
  },
47
64
  };
48
65
 
@@ -105,6 +122,8 @@ const Template = (args, { argTypes }) => {
105
122
  export const Default = Template.bind({});
106
123
  Default.args = {
107
124
  vertical: false,
125
+ legendText: 'CvRadioGroup legend',
126
+ hideLegend: false,
108
127
  };
109
128
  Default.parameters = storyParametersObject(
110
129
  DefaultStoryParameters,
@@ -18,10 +18,7 @@
18
18
  <!-- symbol causes problem in codepen? -->
19
19
  <label :for="cvId" :class="`${carbonPrefix}--radio-button__label`">
20
20
  <span :class="`${carbonPrefix}--radio-button__appearance`"></span>
21
- <span
22
- v-if="label"
23
- :class="{ [`${carbonPrefix}--visually-hidden`]: hideLabel }"
24
- >
21
+ <span :class="{ [`${carbonPrefix}--visually-hidden`]: hideLabel }">
25
22
  {{ label }}
26
23
  </span>
27
24
  </label>
@@ -35,7 +32,12 @@ import { useCvId, propsCvId, useMethods, useRadio } from '../../use';
35
32
  const props = defineProps({
36
33
  modelValue: { type: String, default: undefined },
37
34
  checked: Boolean,
38
- label: { type: String, default: undefined },
35
+ label: {
36
+ type: String,
37
+ default: null,
38
+ required: true,
39
+ validator: label => !!label.length,
40
+ },
39
41
  value: { type: String, required: true },
40
42
  hideLabel: Boolean,
41
43
  labelLeft: Boolean,
@@ -1,13 +1,22 @@
1
1
  <template>
2
2
  <div :class="`cv-radio-group ${carbonPrefix}--form-item`">
3
- <div
3
+ <fieldset
4
4
  :class="[
5
5
  `${carbonPrefix}--radio-button-group`,
6
6
  { [`${carbonPrefix}--radio-button-group--vertical`]: vertical },
7
7
  ]"
8
8
  >
9
+ <legend
10
+ :class="[
11
+ `${carbonPrefix}--label`,
12
+ { [`${carbonPrefix}--visually-hidden`]: hideLegend },
13
+ ]"
14
+ dir="auto"
15
+ >
16
+ {{ legendText }}
17
+ </legend>
9
18
  <slot></slot>
10
- </div>
19
+ </fieldset>
11
20
  </div>
12
21
  </template>
13
22
 
@@ -17,6 +26,13 @@ import { carbonPrefix } from '../../global/settings';
17
26
 
18
27
  defineProps({
19
28
  vertical: Boolean,
29
+ legendText: {
30
+ type: String,
31
+ default: null,
32
+ required: true,
33
+ validator: legend => !!legend.length,
34
+ },
35
+ hideLegend: Boolean,
20
36
  });
21
37
 
22
38
  const emit = defineEmits(['change']);
@@ -12,16 +12,18 @@ exports[`CvRadioButton matches render with right label 1`] = `<div class="cv-rad
12
12
 
13
13
  exports[`CvRadioGroup matches render when horizontal 1`] = `
14
14
  <div class="cv-radio-group bx--form-item">
15
- <div class="bx--radio-button-group">
15
+ <fieldset class="bx--radio-button-group">
16
+ <legend class="bx--label" dir="auto">test legend</legend>
16
17
  <div class="cv-radio-button-stub">RadioButtonStub</div>
17
- </div>
18
+ </fieldset>
18
19
  </div>
19
20
  `;
20
21
 
21
22
  exports[`CvRadioGroup matches render when vertical 1`] = `
22
23
  <div class="cv-radio-group bx--form-item">
23
- <div class="bx--radio-button-group bx--radio-button-group--vertical">
24
+ <fieldset class="bx--radio-button-group bx--radio-button-group--vertical">
25
+ <legend class="bx--label" dir="auto">test legend</legend>
24
26
  <div class="cv-radio-button-stub">RadioButtonStub</div>
25
- </div>
27
+ </fieldset>
26
28
  </div>
27
29
  `;
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <component
3
3
  :is="formItem ? 'div' : CvEmpty"
4
- :class="`cv-search ${carbonPrefix}--form-item`"
4
+ :class="[`cv-search`, `${carbonPrefix}--form-item`, $attrs.class]"
5
5
  >
6
6
  <div
7
7
  ref="elSearch"
@@ -71,7 +71,7 @@
71
71
  role="tab"
72
72
  :aria-controls="tab.uid"
73
73
  :aria-disabled="disabledTabs.has(tab.uid) || null"
74
- :aria-selected="selectedId === tab.uid"
74
+ :aria-selected="`${selectedId === tab.uid}`"
75
75
  :tabindex="selectedId === tab.uid ? 0 : -1"
76
76
  type="button"
77
77
  @click="onTabClick(tab.uid)"
@@ -187,7 +187,7 @@ function maybeSelectFirstTab() {
187
187
  if (index > -1) selectedId.value = tabs.value[index].uid;
188
188
  }
189
189
  onMounted(maybeSelectFirstTab);
190
- watch(tabs, maybeSelectFirstTab);
190
+ watch(tabs, maybeSelectFirstTab, { deep: true });
191
191
  watch(selectedId, () => {
192
192
  nextTick(() => {
193
193
  doTabClick(selectedId.value);
@@ -1,55 +0,0 @@
1
- import { action } from '@storybook/addon-actions';
2
- import { CvAccordion, CvAccordionItem } from '.';
3
- import { alignConsts, sizeConsts } from './consts';
4
-
5
- import {
6
- sbCompPrefix,
7
- storyParametersObject,
8
- } from '../../global/storybook-utils';
9
-
10
- export default {
11
- title: `${sbCompPrefix}/CvAccordion`,
12
- component: CvAccordion,
13
- argTypes: {
14
- align: {
15
- control: { type: 'select', options: Object.keys(alignConsts.$labels) },
16
- },
17
- size: {
18
- control: { type: 'select', options: Object.keys(sizeConsts.$labels) },
19
- },
20
- },
21
- };
22
-
23
- // <cv-button @click="onClick" v-bind="newArgs">{{defaultSlot}}</cv-button>
24
- const template = `<cv-accordion @change="onChange" v-bind="args">
25
- <cv-accordion-item v-for="n in 4" :key="\`acc-item-\${n}\`" :id="n % 2 ? \`acc-item-\${n}\` : ''">
26
- <template v-slot:title>Section {{n}} title </template>
27
- <template v-slot:content>
28
- <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
29
- </template>
30
- </cv-accordion-item>
31
- </cv-accordion>`;
32
- const Template = (args, { argTypes }) => {
33
- // eslint-disable-next-line no-param-reassign
34
- args = {
35
- ...args,
36
- align: alignConsts[alignConsts.$labels[args.align]],
37
- size: sizeConsts[sizeConsts.$labels[args.size]],
38
- };
39
- return {
40
- props: Object.keys(argTypes),
41
- components: { CvAccordion, CvAccordionItem },
42
- setup() {
43
- return { args, onChange: action('change') };
44
- },
45
- template,
46
- };
47
- };
48
-
49
- export const Default = Template.bind({});
50
- Default.args = {};
51
- Default.parameters = storyParametersObject(
52
- Default.parameters,
53
- template,
54
- Default.args
55
- );