@carbon/vue 3.0.12 → 3.0.14

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 (40) hide show
  1. package/README.md +9 -0
  2. package/dist/carbon-vue-3.common.js +216 -108
  3. package/dist/carbon-vue-3.common.js.map +1 -1
  4. package/dist/carbon-vue-3.umd.js +216 -108
  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 +49 -17
  9. package/package.json +6 -4
  10. package/src/components/CvAccordion/CvAccordion.stories.mdx +162 -0
  11. package/src/components/CvAccordion/CvAccordion.vue +18 -5
  12. package/src/components/CvAccordion/CvAccordionItem.vue +19 -7
  13. package/src/components/CvAccordion/consts.js +8 -9
  14. package/src/components/CvButton/CvIconButton.vue +1 -1
  15. package/src/components/CvCheckbox/CvCheckbox.vue +8 -3
  16. package/src/components/CvComboBox/CvComboBox.vue +1 -1
  17. package/src/components/CvDataTable/CvDataTable.vue +26 -7
  18. package/src/components/CvDataTable/CvDataTableRow.vue +11 -3
  19. package/src/components/CvDataTable/_CvDataTableRowInner.vue +12 -3
  20. package/src/components/CvDataTable/cvDataTableStore.js +1 -0
  21. package/src/components/CvDatePicker/CvDatePicker.stories.js +165 -14
  22. package/src/components/CvDatePicker/CvDatePicker.vue +33 -20
  23. package/src/components/CvDropdown/CvDropdown.stories.mdx +6 -2
  24. package/src/components/CvDropdown/CvDropdown.vue +3 -3
  25. package/src/components/CvFileUploader/CvFileUploader.vue +2 -2
  26. package/src/components/CvNotification/CvToastNotification.stories.js +65 -5
  27. package/src/components/CvNotification/CvToastNotificationTemplate.mdx +17 -0
  28. package/src/components/CvNumberInput/CvNumberInput.vue +3 -3
  29. package/src/components/CvOverflowMenu/CvOverflowMenuItem.vue +2 -2
  30. package/src/components/CvProgress/CvProgress.stories.mdx +29 -7
  31. package/src/components/CvProgress/CvProgress.vue +1 -0
  32. package/src/components/CvProgress/CvProgressStep.vue +2 -0
  33. package/src/components/CvRadioButton/CvRadioButton.stories.js +20 -1
  34. package/src/components/CvRadioButton/CvRadioButton.vue +7 -5
  35. package/src/components/CvRadioButton/CvRadioGroup.vue +18 -2
  36. package/src/components/CvRadioButton/__tests__/__snapshots__/CvRadioButton.spec.js.snap +6 -4
  37. package/src/components/CvSlider/CvSlider.vue +1 -1
  38. package/src/components/CvTag/CvTag.vue +1 -1
  39. package/telemetry.yml +8 -0
  40. package/src/components/CvAccordion/CvAccordion.stories.js +0 -55
@@ -1,6 +1,6 @@
1
1
  import { action } from '@storybook/addon-actions';
2
- import { sbCompPrefix } from '../../global/storybook-utils';
3
-
2
+ import DocumentationTemplate from './CvToastNotificationTemplate.mdx';
3
+ import { sbCompPrefix, storySourceCode } from '../../global/storybook-utils';
4
4
  import { CvToastNotification, CvNotificationConsts } from '.';
5
5
 
6
6
  export default {
@@ -85,6 +85,11 @@ export default {
85
85
  description: 'Caption slot for more custom content.',
86
86
  },
87
87
  },
88
+ parameters: {
89
+ docs: {
90
+ page: DocumentationTemplate,
91
+ },
92
+ },
88
93
  };
89
94
 
90
95
  const template = `
@@ -118,58 +123,113 @@ const Template = args => {
118
123
  };
119
124
  };
120
125
 
121
- export const Info = Template.bind({});
122
- Info.args = {
126
+ export const Default = Template.bind({});
127
+ Default.args = {
123
128
  kind: CvNotificationConsts.notificationKinds[0],
129
+ title: 'info',
130
+ subTitle: 'subtitle',
131
+ caption: 'more information',
132
+ };
133
+ Default.parameters = {
134
+ docs: { source: { code: storySourceCode(template, Default.args) } },
124
135
  };
125
136
 
126
137
  export const InfoSquare = Template.bind({});
127
138
  InfoSquare.storyName = 'Info square';
128
139
  InfoSquare.args = {
129
140
  kind: CvNotificationConsts.notificationKinds[1],
141
+ title: 'info²',
142
+ subTitle: 'subtitle',
143
+ caption: 'more information',
144
+ };
145
+ InfoSquare.parameters = {
146
+ docs: { source: { code: storySourceCode(template, InfoSquare.args) } },
130
147
  };
131
148
 
132
149
  export const Success = Template.bind({});
133
150
  Success.args = {
134
151
  kind: CvNotificationConsts.notificationKinds[2],
152
+ title: 'success',
153
+ subTitle: 'subtitle',
154
+ caption: 'more information',
155
+ };
156
+ Success.parameters = {
157
+ docs: { source: { code: storySourceCode(template, Success.args) } },
135
158
  };
136
-
137
159
  export const Warning = Template.bind({});
138
160
  Warning.args = {
139
161
  kind: CvNotificationConsts.notificationKinds[3],
162
+ title: 'warning',
163
+ subTitle: 'subtitle',
164
+ caption: 'more information',
165
+ };
166
+ Warning.parameters = {
167
+ docs: { source: { code: storySourceCode(template, Warning.args) } },
140
168
  };
141
169
 
142
170
  export const WarningAlt = Template.bind({});
143
171
  WarningAlt.storyName = 'Warning (alt)';
144
172
  WarningAlt.args = {
145
173
  kind: CvNotificationConsts.notificationKinds[4],
174
+ title: 'warning △',
175
+ subTitle: 'subtitle',
176
+ caption: 'more information',
177
+ };
178
+ WarningAlt.parameters = {
179
+ docs: { source: { code: storySourceCode(template, WarningAlt.args) } },
146
180
  };
147
181
 
148
182
  export const Error = Template.bind({});
149
183
  Error.args = {
150
184
  kind: CvNotificationConsts.notificationKinds[5],
185
+ title: 'error',
186
+ subTitle: 'subtitle',
187
+ caption: 'more information',
188
+ };
189
+ Error.parameters = {
190
+ docs: { source: { code: storySourceCode(template, Error.args) } },
151
191
  };
152
192
 
153
193
  export const SlotDefault = Template.bind({});
154
194
  SlotDefault.args = {
155
195
  kind: CvNotificationConsts.notificationKinds[4],
196
+ title: 'title',
197
+ subTitle: 'subtitle',
156
198
  defaultSlot: true,
157
199
  };
200
+ SlotDefault.parameters = {
201
+ docs: { source: { code: storySourceCode(template, SlotDefault.args) } },
202
+ };
158
203
 
159
204
  export const SlotTitle = Template.bind({});
160
205
  SlotTitle.args = {
161
206
  kind: CvNotificationConsts.notificationKinds[0],
162
207
  titleSlot: true,
208
+ subTitle: 'subtitle',
209
+ caption: 'more information',
210
+ };
211
+ SlotTitle.parameters = {
212
+ docs: { source: { code: storySourceCode(template, SlotTitle.args) } },
163
213
  };
164
214
 
165
215
  export const SlotSubtitle = Template.bind({});
166
216
  SlotSubtitle.args = {
167
217
  kind: CvNotificationConsts.notificationKinds[3],
168
218
  subtitleSlot: true,
219
+ title: 'title',
220
+ caption: 'more information',
221
+ };
222
+ SlotSubtitle.parameters = {
223
+ docs: { source: { code: storySourceCode(template, SlotSubtitle.args) } },
169
224
  };
170
225
 
171
226
  export const SlotCaption = Template.bind({});
172
227
  SlotCaption.args = {
173
228
  kind: CvNotificationConsts.notificationKinds[1],
174
229
  captionSlot: true,
230
+ title: 'title',
231
+ subTitle: 'subtitle',
232
+ };
233
+ SlotCaption.parameters = {
234
+ docs: { source: { code: storySourceCode(template, SlotCaption.args) } },
175
235
  };
@@ -0,0 +1,17 @@
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
+ - **Breaking**. The `caption` property no longer renders html. Please use the `caption` slot instead.
11
+ - The `title` content can now be provided in the `title` slot.
12
+
13
+ <Primary />
14
+
15
+ <Controls />
16
+
17
+ <Stories />
@@ -38,7 +38,7 @@
38
38
  :data-invalid="isInvalid || null"
39
39
  type="number"
40
40
  v-bind="$attrs"
41
- :disabled="disabled"
41
+ :disabled="disabled || null"
42
42
  :step="step"
43
43
  :min="min"
44
44
  :max="max"
@@ -53,7 +53,7 @@
53
53
  :class="`${carbonPrefix}--number__control-btn down-icon`"
54
54
  type="button"
55
55
  :aria-label="ariaLabelForDownButton"
56
- :disabled="disabled"
56
+ :disabled="disabled || null"
57
57
  aria-live="polite"
58
58
  aria-atomic="true"
59
59
  @click="doDown"
@@ -67,7 +67,7 @@
67
67
  :class="`${carbonPrefix}--number__control-btn up-icon`"
68
68
  type="button"
69
69
  :aria-label="ariaLabelForUpButton"
70
- :disabled="disabled"
70
+ :disabled="disabled || null"
71
71
  aria-live="polite"
72
72
  aria-atomic="true"
73
73
  @click="doUp"
@@ -13,8 +13,8 @@
13
13
  <button
14
14
  type="button"
15
15
  :class="`${carbonPrefix}--overflow-menu-options__btn`"
16
- :data-floating-menu-primary-focus="primaryFocus"
17
- :disabled="disabled"
16
+ :data-floating-menu-primary-focus="primaryFocus || null"
17
+ :disabled="disabled || null"
18
18
  @click="onClick"
19
19
  >
20
20
  <span :class="`${carbonPrefix}--overflow-menu-options__option-content`">
@@ -4,6 +4,19 @@ import { Time20 as TimeIcon } from '@carbon/icons-vue';
4
4
  // noinspection ES6PreferShortImport
5
5
  import { sbCompPrefix } from '../../global/storybook-utils';
6
6
  import { action } from '@storybook/addon-actions';
7
+ import {ref } from "vue";
8
+ const step3Invalid = ref(false)
9
+ const step4Disable = ref(false)
10
+ const step5Complete = ref(false)
11
+ function onStep4Disable() {
12
+ step4Disable.value = !step4Disable.value
13
+ }
14
+ function onStep3Invalid() {
15
+ step3Invalid.value = !step3Invalid.value
16
+ }
17
+ function onStep5Complete() {
18
+ step5Complete.value = !step5Complete.value
19
+ }
7
20
 
8
21
  <Meta title={`${sbCompPrefix}/CvProgress`} component={CvProgress} />
9
22
 
@@ -31,6 +44,12 @@ export const Template = args => ({
31
44
  invalidIds: args.invalidIds,
32
45
  disabledIds: args.disabledIds,
33
46
  onStepClicked: action('step-clicked'),
47
+ step3Invalid,
48
+ onStep3Invalid,
49
+ step4Disable,
50
+ onStep4Disable,
51
+ step5Complete,
52
+ onStep5Complete,
34
53
  };
35
54
  },
36
55
  // And then the `args` are bound to your component with `v-bind="args"`
@@ -79,7 +98,7 @@ const slotTemplate = `
79
98
  id="step-3"
80
99
  :label="step3"
81
100
  :complete="completeIds.includes('step-3')"
82
- :invalid="invalidIds.includes('step-3')"
101
+ :invalid="step3Invalid"
83
102
  :disabled="disabledIds.includes('step-3')"
84
103
  additionalInfo="save the world"
85
104
  @step-clicked="onStepClicked"
@@ -90,7 +109,7 @@ const slotTemplate = `
90
109
  :label="step4"
91
110
  :complete="completeIds.includes('step-4')"
92
111
  :invalid="invalidIds.includes('step-4')"
93
- :disabled="disabledIds.includes('step-4')"
112
+ :disabled="step4Disable"
94
113
  additionalInfo="Twins Dennys and Sandy"
95
114
  @step-clicked="onStepClicked"
96
115
  >
@@ -98,7 +117,7 @@ const slotTemplate = `
98
117
  <cv-progress-step
99
118
  id="step-5"
100
119
  :label="step5"
101
- :complete="completeIds.includes('step-5')"
120
+ :complete="step5Complete"
102
121
  :invalid="invalidIds.includes('step-5')"
103
122
  :disabled="disabledIds.includes('step-5')"
104
123
  additionalInfo="with Polyhymnia O'Keefe"
@@ -106,6 +125,9 @@ const slotTemplate = `
106
125
  >
107
126
  </cv-progress-step>
108
127
  </cv-progress>
128
+ <div><button @click=onStep3Invalid>Toggle step 3 invalid</button></div>
129
+ <div><button @click=onStep4Disable>Toggle step 4 disabled</button></div>
130
+ <div><button @click=onStep5Complete>Toggle step 5 complete</button></div>
109
131
  `;
110
132
  const skeletonTemplate = `<cv-progress-skeleton :vertical="vertical" />`;
111
133
 
@@ -187,15 +209,15 @@ Use `cv-progress-step` for more control over the display.
187
209
  },
188
210
  disabledIds: {
189
211
  control: 'multi-select',
190
- options: ['step-1', 'step-2', 'step-3', 'step-4', 'step-5'],
212
+ options: ['step-1', 'step-2', 'step-3', 'step-5'],
191
213
  },
192
214
  completeIds: {
193
215
  control: 'multi-select',
194
- options: ['step-1', 'step-2', 'step-3', 'step-4', 'step-5'],
216
+ options: ['step-1', 'step-2', 'step-3', 'step-4'],
195
217
  },
196
218
  invalidIds: {
197
219
  control: 'multi-select',
198
- options: ['step-1', 'step-2', 'step-3', 'step-4', 'step-5'],
220
+ options: ['step-1', 'step-2', 'step-4', 'step-5'],
199
221
  },
200
222
  }}
201
223
  >
@@ -221,4 +243,4 @@ Use `cv-progress-step` for more control over the display.
221
243
  >
222
244
  {Template.bind({})}
223
245
  </Story>
224
- </Canvas>
246
+ </Canvas>
@@ -75,4 +75,5 @@ function updateSteps() {
75
75
  }
76
76
  onMounted(updateSteps);
77
77
  watch(() => props.initialStep, updateSteps);
78
+ watch(progressSteps, updateSteps);
78
79
  </script>
@@ -106,6 +106,8 @@ function checkCurrentStep() {
106
106
  onMounted(checkCurrentStep);
107
107
  watch(currentStep, checkCurrentStep);
108
108
  watch(completedSteps, checkCurrentStep);
109
+ watch(() => props.complete, checkCurrentStep);
110
+ watch(() => props.disabled, checkCurrentStep);
109
111
 
110
112
  onBeforeUnmount(() => {
111
113
  const index = progressSteps.value.findIndex(step => step.uid === uid.value);
@@ -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
  `;
@@ -76,7 +76,7 @@
76
76
  { [`${carbonPrefix}--text-input--light`]: isLight },
77
77
  ]"
78
78
  :placeholder="min"
79
- :disabled="disabled"
79
+ :disabled="disabled || null"
80
80
  @change="onChange"
81
81
  @keydown.up.prevent="onUp"
82
82
  @keydown.down.prevent="onDown"
@@ -8,7 +8,7 @@
8
8
  v-if="filter"
9
9
  :class="`${carbonPrefix}--tag__close-icon`"
10
10
  :aria-label="clearAriaLabel"
11
- :disabled="disabled"
11
+ :disabled="disabled || null"
12
12
  @click.stop.prevent="onRemove"
13
13
  >
14
14
  <Close16 />
package/telemetry.yml ADDED
@@ -0,0 +1,8 @@
1
+ # yaml-language-server: $schema=https://unpkg.com/@ibm/telemetry-config-schema@v1/dist/config.schema.json
2
+
3
+ version: 1
4
+ projectId: 084968c7-d247-4ddb-bc07-cbdbe57fdd43
5
+ endpoint: https://collector-prod.1am6wm210aow.us-south.codeengine.appdomain.cloud/v1/metrics
6
+ collect:
7
+ npm:
8
+ dependencies: null
@@ -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
- );