@carbon/vue 3.0.10 → 3.0.12

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 (37) hide show
  1. package/README.md +4 -4
  2. package/dist/carbon-vue-3.common.js +247 -166
  3. package/dist/carbon-vue-3.common.js.map +1 -1
  4. package/dist/carbon-vue-3.umd.js +247 -166
  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 +41 -36
  9. package/package.json +3 -3
  10. package/src/components/CvComboBox/CvComboBox.vue +1 -1
  11. package/src/components/CvDataTable/CvDataTable.stories.mdx +39 -14
  12. package/src/components/CvDataTable/CvDataTable.vue +1 -1
  13. package/src/components/CvDataTable/CvDataTableHeading.vue +3 -5
  14. package/src/components/CvDatePicker/CvDatePicker.vue +7 -8
  15. package/src/components/CvDropdown/CvDropdown.stories.mdx +7 -66
  16. package/src/components/CvDropdown/CvDropdown.vue +7 -18
  17. package/src/components/CvDropdown/CvDropdownItem.vue +1 -1
  18. package/src/components/CvFileUploader/CvFileUploader.stories.mdx +79 -14
  19. package/src/components/CvFileUploader/CvFileUploaderItem.vue +8 -7
  20. package/src/components/CvLink/CvLink.vue +6 -1
  21. package/src/components/CvLoading/CvLoading.vue +1 -1
  22. package/src/components/CvModal/CvModal.vue +35 -13
  23. package/src/components/CvModal/index.js +29 -1
  24. package/src/components/CvMultiSelect/CvMultiSelect.stories.mdx +8 -18
  25. package/src/components/CvMultiSelect/CvMultiSelect.vue +14 -19
  26. package/src/components/CvNotification/CvInlineNotification.stories.js +58 -1
  27. package/src/components/CvNotification/CvInlineNotification.vue +13 -3
  28. package/src/components/CvNotification/CvInlineNotificationTemplate.mdx +16 -0
  29. package/src/components/CvProgress/CvProgress.stories.mdx +23 -1
  30. package/src/components/CvProgress/CvProgressSkeleton.vue +37 -0
  31. package/src/components/CvProgress/CvProgressStep.vue +1 -1
  32. package/src/components/CvProgress/index.js +3 -1
  33. package/src/components/CvSearch/CvSearch.stories.mdx +4 -13
  34. package/src/components/CvSearch/CvSearch.vue +8 -20
  35. package/src/components/CvTabs/CvTabs.vue +3 -3
  36. package/src/components/CvTabs/__tests__/__snapshots__/CvTabs.spec.js.snap +3 -3
  37. package/src/components/CvTooltip/CvInteractiveTooltip.vue +1 -1
@@ -1,9 +1,9 @@
1
- import { Canvas, Meta, Story } from '@storybook/addon-docs';
1
+ import { Canvas, Meta, Story, ArgsTable } from '@storybook/addon-docs';
2
2
  import { sbCompPrefix } from '../../global/storybook-utils';
3
3
  import { CvFileUploader, CvFileUploaderSkeleton } from '.';
4
- import { KINDS } from './const';
4
+ import { KINDS, STATES } from './const';
5
5
  import { action } from '@storybook/addon-actions';
6
- import { nextTick, ref } from 'vue';
6
+ import { nextTick, ref, watch, onMounted } from 'vue';
7
7
  import { Add16 } from '@carbon/icons-vue';
8
8
  import { buttonKinds, buttonSizes } from '../CvButton/consts';
9
9
 
@@ -16,7 +16,57 @@ export const Template = args => ({
16
16
  Add16
17
17
  },
18
18
  setup() {
19
+ const fileUploader = ref(null);
20
+ const files = ref(storage.files);
21
+ // exposed methods handlers
22
+ function clear() {
23
+ if (args.clear && args.clear > storage.clearCount) {
24
+ storage.clearCount = args.clear;
25
+ fileUploader.value.clear();
26
+ action('cv-file-uploader clear')()
27
+ }
28
+ }
29
+ function remove() {
30
+ if (args.remove && args.remove > storage.removeCount && files.value.length > 0) {
31
+ const randomIndex = Math.floor(Math.random() * files.value.length);
32
+ storage.removeCount = args.remove;
33
+ fileUploader.value.remove(randomIndex);
34
+ action('cv-file-uploader remove')(randomIndex)
35
+ }
36
+ }
37
+ function setInvalidMessage(index) {
38
+ if (files.value[index].invalidMessage !== args.setInvalidMessage) {
39
+ fileUploader.value.setInvalidMessage(index, args.setInvalidMessage);
40
+ action('cv-file-uploader setInvalidMessage')(index, args.setInvalidMessage);
41
+ }
42
+ }
43
+ function setState(index) {
44
+ const newState = setStateOptionMap[args.setState];
45
+ if (files.value[index].state !== newState) {
46
+ fileUploader.value.setState(index, newState);
47
+ action('cv-file-uploader setState')(index, newState);
48
+ }
49
+ }
50
+ // exposed methods setState & setInvalidMessage handler
51
+ function changeFiles() {
52
+ const callbacks = [
53
+ typeof args.setState === 'string' ? setState : null,
54
+ typeof args.setInvalidMessage === 'string' ? setInvalidMessage : null,
55
+ ];
56
+ files.value.forEach((_, index) => callbacks.forEach(callback => callback && callback(index)));
57
+ }
58
+ watch(() => files.value, (newValue) => {
59
+ storage.files = newValue;
60
+ changeFiles();
61
+ }, { deep: true });
62
+ onMounted(() => {
63
+ clear();
64
+ remove();
65
+ changeFiles();
66
+ });
19
67
  return {
68
+ fileUploader,
69
+ files,
20
70
  slotContent: args.slot,
21
71
  args: {
22
72
  ...args,
@@ -26,9 +76,19 @@ export const Template = args => ({
26
76
  },
27
77
  template: args.template,
28
78
  });
79
+ const storage = {
80
+ files: [],
81
+ clearCount: 0,
82
+ removeCount: 0,
83
+ };
84
+ const setStateOptionMap = {
85
+ [`Set files status to: None`]: STATES.NONE,
86
+ [`Set files status to: Complete (${STATES.COMPLETE})`]: STATES.COMPLETE,
87
+ [`Set files status to: Uploading (${STATES.UPLOADING})`]: STATES.UPLOADING,
88
+ };
29
89
  const defaultTemplate = `
30
90
  <div style="display: inline-flex; align-items: flex-start;">
31
- <cv-file-uploader v-bind="args" />
91
+ <cv-file-uploader v-bind="args" ref="fileUploader" v-model="files" />
32
92
  </div>
33
93
  `;
34
94
  const slotTemplate = `
@@ -178,7 +238,8 @@ export const argTypes = {
178
238
  },
179
239
  // exposed methods
180
240
  clear: {
181
- control: 'none',
241
+ control: 'button',
242
+ buttonLabel: 'Clear',
182
243
  type: 'function',
183
244
  table: {
184
245
  type: { summary: '() => void' },
@@ -187,7 +248,8 @@ export const argTypes = {
187
248
  description: 'Clear file list',
188
249
  },
189
250
  remove: {
190
- control: 'none',
251
+ control: 'button',
252
+ buttonLabel: 'Remove a random file',
191
253
  type: 'function',
192
254
  table: {
193
255
  type: { summary: '(index: number) => void' },
@@ -195,23 +257,24 @@ export const argTypes = {
195
257
  },
196
258
  description: 'Removes an individual file',
197
259
  },
198
- setState: {
199
- control: 'none',
260
+ setInvalidMessage: {
261
+ control: 'text',
200
262
  type: 'function',
201
263
  table: {
202
- type: { summary: '(index: number, state: string) => void' },
264
+ type: { summary: '(index: number, invalidMessage: string) => void' },
203
265
  category: 'exposed methods',
204
266
  },
205
- description: 'Update the "state" field of a file. State must be `""`, `complete` or `loading`',
267
+ description: 'Update the "invalidMessage" field of a file.',
206
268
  },
207
- setInvalidMessage: {
208
- control: 'none',
269
+ setState: {
270
+ control: 'select',
271
+ options: Object.keys(setStateOptionMap),
209
272
  type: 'function',
210
273
  table: {
211
- type: { summary: '(index: number, invalidMessage: string) => void' },
274
+ type: { summary: '(index: number, state: string) => void' },
212
275
  category: 'exposed methods',
213
276
  },
214
- description: 'Update the "invalidMessage" field of a file.',
277
+ description: 'Update the "state" field of a file. State must be `""`, `complete` or `uploading`',
215
278
  },
216
279
  // slots
217
280
  'drop-target': {
@@ -258,6 +321,8 @@ Migration notes:
258
321
  </Story>
259
322
  </Canvas>
260
323
 
324
+ <ArgsTable story="Default" />
325
+
261
326
  # CvFileUploader Button
262
327
 
263
328
  <Canvas>
@@ -9,8 +9,12 @@
9
9
  {{ item.file?.name }}
10
10
  </p>
11
11
  <span :class="`${carbonPrefix}--file__state-container`">
12
+ <WarningFilled16
13
+ v-if="isInvalid"
14
+ :class="`${carbonPrefix}--file--invalid`"
15
+ />
12
16
  <div
13
- v-if="item.state === 'uploading'"
17
+ v-if="!isInvalid && item.state === 'uploading'"
14
18
  :class="`${carbonPrefix}--inline-loading__animation`"
15
19
  >
16
20
  <div
@@ -37,15 +41,12 @@
37
41
  </div>
38
42
  </div>
39
43
  <CheckmarkFilled16
40
- v-if="item.state === 'complete'"
44
+ v-else-if="!isInvalid && item.state === 'complete'"
41
45
  :class="`${carbonPrefix}--file-complete`"
42
46
  />
43
- <WarningFilled16
44
- v-if="isInvalid"
45
- :class="`${carbonPrefix}--file--invalid`"
46
- />
47
+ <!-- "edit" state at react -->
47
48
  <button
48
- v-if="removable"
49
+ v-else-if="removable"
49
50
  type="button"
50
51
  :class="`${carbonPrefix}--file-close`"
51
52
  :alt="removeAriaLabel"
@@ -14,7 +14,12 @@
14
14
  ]"
15
15
  >
16
16
  <slot></slot>
17
- <CvSvg v-if="icon" :class="`${carbonPrefix}--link__icon`" :svg="icon" />
17
+ <CvSvg
18
+ v-if="icon"
19
+ :class="`${carbonPrefix}--link__icon`"
20
+ :svg="icon"
21
+ alt=""
22
+ />
18
23
  </component>
19
24
  </template>
20
25
 
@@ -18,7 +18,7 @@
18
18
  :aria-labelledby="cvId"
19
19
  aria-live="assertive"
20
20
  role="progressbar"
21
- :aria-busy="active || stopping"
21
+ :aria-busy="`${active || stopping}`"
22
22
  >
23
23
  <label :id="cvId" :class="`${carbonPrefix}--visually-hidden`">
24
24
  {{ description }}
@@ -8,7 +8,7 @@
8
8
  `cv-modal ${carbonPrefix}--modal`,
9
9
  {
10
10
  'is-visible': dataVisible,
11
- [`${carbonPrefix}--modal--danger`]: kind === 'danger',
11
+ [`${carbonPrefix}--modal--danger`]: kind === MODAL_KIND_DANGER,
12
12
  },
13
13
  ]"
14
14
  tabindex="-1"
@@ -119,6 +119,15 @@
119
119
  </template>
120
120
 
121
121
  <script setup>
122
+ import {
123
+ MODAL_KIND_DANGER,
124
+ MODAL_KIND_PRIMARY,
125
+ MODAL_KINDS,
126
+ MODAL_SIZE_EXTRA_SMALL,
127
+ MODAL_SIZE_LARGE,
128
+ MODAL_SIZE_SMALL,
129
+ MODAL_SIZES,
130
+ } from './index';
122
131
  import CvButton from '../CvButton/CvButton.vue';
123
132
  import { carbonPrefix } from '../../global/settings';
124
133
  import { props as propsCvId, useCvId } from '../../use/cvId';
@@ -155,7 +164,11 @@ const props = defineProps({
155
164
  kind: {
156
165
  type: String,
157
166
  default: '',
158
- validator: val => ['', 'danger'].includes(val),
167
+ validator: val => {
168
+ const valid = MODAL_KINDS.includes(val);
169
+ if (!valid) console.warn('valid kinds:', MODAL_KINDS);
170
+ return valid;
171
+ },
159
172
  },
160
173
  /**
161
174
  * boolean value if true the component user is expected to close the modal via visible property.
@@ -187,8 +200,11 @@ const props = defineProps({
187
200
  */
188
201
  size: {
189
202
  type: String,
190
- validator: val =>
191
- ['', 'xs', 'sm', 'small', 'md', 'large', 'lg'].includes(val),
203
+ validator: val => {
204
+ const valid = MODAL_SIZES.includes(val);
205
+ if (!valid) console.warn('valid sizes:', MODAL_SIZES);
206
+ return valid;
207
+ },
192
208
  default: '',
193
209
  },
194
210
  /**
@@ -333,22 +349,22 @@ const dialogAttrs = computed(() => {
333
349
  return attrs;
334
350
  });
335
351
  const primaryKind = computed(() => {
336
- if (props.kind === 'danger') {
337
- return 'danger';
352
+ if (props.kind === MODAL_KIND_DANGER) {
353
+ return MODAL_KIND_DANGER;
338
354
  } else {
339
- return 'primary';
355
+ return MODAL_KIND_PRIMARY;
340
356
  }
341
357
  });
342
358
  const internalSize = computed(() => {
343
359
  switch (props.size) {
344
- case 'xs':
345
- return 'xs';
346
- case 'sm':
360
+ case MODAL_SIZE_EXTRA_SMALL:
361
+ return MODAL_SIZE_EXTRA_SMALL;
362
+ case MODAL_SIZE_SMALL:
347
363
  case 'small':
348
- return 'sm';
349
- case 'lg':
364
+ return MODAL_SIZE_SMALL;
365
+ case MODAL_SIZE_LARGE:
350
366
  case 'large':
351
- return 'lg';
367
+ return MODAL_SIZE_LARGE;
352
368
  default:
353
369
  return '';
354
370
  }
@@ -398,4 +414,10 @@ function onOtherBtnClick(ev) {
398
414
  onBeforeUnmount(() => {
399
415
  if (dataVisible.value) hide();
400
416
  });
417
+
418
+ // exposing methods
419
+ defineExpose({
420
+ show,
421
+ hide,
422
+ });
401
423
  </script>
@@ -1,3 +1,31 @@
1
1
  import CvModal from './CvModal.vue';
2
- export { CvModal };
2
+
3
+ const MODAL_SIZE_EXTRA_SMALL = 'xs';
4
+ const MODAL_SIZE_SMALL = 'sm';
5
+ const MODAL_SIZE_MEDIUM = 'md';
6
+ const MODAL_SIZE_LARGE = 'lg';
7
+ const MODAL_SIZES = [
8
+ '',
9
+ MODAL_SIZE_EXTRA_SMALL,
10
+ MODAL_SIZE_SMALL,
11
+ 'small',
12
+ MODAL_SIZE_MEDIUM,
13
+ 'medium',
14
+ 'large',
15
+ MODAL_SIZE_LARGE,
16
+ ];
17
+ const MODAL_KIND_PRIMARY = 'primary';
18
+ const MODAL_KIND_DANGER = 'danger';
19
+ const MODAL_KINDS = ['', MODAL_KIND_PRIMARY, MODAL_KIND_DANGER];
20
+
21
+ export {
22
+ CvModal,
23
+ MODAL_SIZES,
24
+ MODAL_SIZE_EXTRA_SMALL,
25
+ MODAL_SIZE_SMALL,
26
+ MODAL_SIZE_LARGE,
27
+ MODAL_KINDS,
28
+ MODAL_KIND_PRIMARY,
29
+ MODAL_KIND_DANGER,
30
+ };
3
31
  export default CvModal;
@@ -58,7 +58,7 @@ export const Template = args => ({
58
58
  title: args.title,
59
59
  label: args.label,
60
60
  highlight: args.highlight,
61
- value: args.value,
61
+ modelValue: args.modelValue,
62
62
  selectionFeedback: args.selectionFeedback,
63
63
  filterable: args.filterable,
64
64
  light: args.light,
@@ -70,7 +70,7 @@ export const Template = args => ({
70
70
  myValue: myValue,
71
71
  onChange: action('change'),
72
72
  onFilter: action('filter'),
73
- onVmodel: action('update:value'),
73
+ onVmodel: action('update:modelValue'),
74
74
  };
75
75
  },
76
76
  template: args.template,
@@ -93,7 +93,7 @@ const defaultTemplate = `
93
93
  :options="options"
94
94
  :selectionFeedback="selectionFeedback"
95
95
  :title="title"
96
- :value="value"
96
+ :modelValue="modelValue"
97
97
  :warningMessage="warningMessage"
98
98
  @change="onChange"
99
99
  @filter="onFilter"
@@ -123,13 +123,13 @@ const vModelTemplate = `
123
123
  :label="label"
124
124
  :options="options"
125
125
  :title="title"
126
- v-model:value="myValue"
126
+ v-model="myValue"
127
127
  @change="onChange"
128
128
  @filter="onFilter"
129
129
  >
130
130
  </cv-multi-select>
131
131
  <div style="margin-top:2rem">
132
- <div>v-model:value</div>
132
+ <div>v-model</div>
133
133
  <select name="cars" id="cars" v-model="myValue" multiple>
134
134
  <option v-for="opt in options" :key="opt.value" :value="opt.value">{{opt.value}}</option>
135
135
  </select>
@@ -147,8 +147,6 @@ Migration notes:
147
147
  - Added the `warningMessage` option to match Carbon React
148
148
  - Setting `autoFilter` to true now implies `filterable`. Previous versions required `filterable` to
149
149
  be explicitly set to `true` for `autoFilter` to work properly.
150
- - The `v-model` is different in Vue 3 than Vue 2.If you specify it you will see a error deprecation message in the log.
151
- Please use `v-model:value=something` instead.
152
150
 
153
151
  <Canvas>
154
152
  <Story
@@ -160,10 +158,8 @@ Migration notes:
160
158
  'filter',
161
159
  'helper-text',
162
160
  'invalid-message',
163
- 'modelValue',
164
161
  'template',
165
162
  'update:modelValue',
166
- 'update:value',
167
163
  'warning-message',
168
164
  ],
169
165
  },
@@ -210,7 +206,7 @@ Migration notes:
210
206
  control: 'inline-radio',
211
207
  options: [],
212
208
  },
213
- value: {
209
+ modelValue: {
214
210
  control: 'multi-select',
215
211
  options: pkdValues,
216
212
  },
@@ -242,15 +238,13 @@ Migration notes:
242
238
  'invalid-message',
243
239
  'invalidMessage',
244
240
  'light',
245
- 'modelValue',
246
241
  'options',
247
242
  'selectionFeedback',
248
243
  'template',
249
244
  'update:modelValue',
250
- 'update:value',
251
- 'value',
252
245
  'warning-message',
253
246
  'warningMessage',
247
+ 'modelValue'
254
248
  ],
255
249
  },
256
250
  docs: { source: { code: slotsTemplate } },
@@ -272,8 +266,6 @@ Migration notes:
272
266
 
273
267
  # v-model
274
268
 
275
- Note: Specifying `v-model="something"` will not work. Use `v-model:value=something` instead.
276
-
277
269
  <Canvas>
278
270
  <Story
279
271
  name="v-model"
@@ -300,8 +292,6 @@ Note: Specifying `v-model="something"` will not work. Use `v-model:value=somethi
300
292
  'selectionFeedback',
301
293
  'template',
302
294
  'update:modelValue',
303
- 'update:value',
304
- 'value',
305
295
  'warning-message',
306
296
  'warningMessage',
307
297
  ],
@@ -322,7 +312,7 @@ Note: Specifying `v-model="something"` will not work. Use `v-model:value=somethi
322
312
  control: 'inline-radio',
323
313
  options: [],
324
314
  },
325
- value: {
315
+ modelValue: {
326
316
  control: 'multi-select',
327
317
  options: pkdValues,
328
318
  },
@@ -65,7 +65,7 @@
65
65
  ref="elButton"
66
66
  type="button"
67
67
  :class="`${carbonPrefix}--list-box__field`"
68
- :aria-disabled="disabled"
68
+ :aria-disabled="disabled || null"
69
69
  aria-haspopup="listbox"
70
70
  :aria-expanded="data.open ? 'true' : 'false'"
71
71
  :aria-owns="uid"
@@ -342,23 +342,16 @@ const props = defineProps({
342
342
  * Provide text to be used in a <label> element that is tied to the multiselect via ARIA attributes.
343
343
  */
344
344
  title: { type: String, default: undefined },
345
- /***
346
- * Allow users to pass in arbitrary items from their collection that are pre-selected
347
- */
348
- value: { type: Array, default: () => [] },
349
345
  /**
350
346
  * Provide the text that is displayed and put the control in warning state
351
347
  */
352
348
  warningMessage: { type: String, default: undefined },
349
+ /***
350
+ * Allow users to pass in arbitrary items from their collection that are pre-selected
351
+ */
353
352
  modelValue: {
354
353
  type: Array,
355
- validator: val => {
356
- console.error(
357
- `v-model for cv-multi-select is deprecated. Specify "v-model:value" instead [${val}]`
358
- );
359
- return true;
360
- },
361
- default: undefined,
354
+ default: () => [],
362
355
  },
363
356
  ...propsCvId,
364
357
  ...propsTheme,
@@ -379,13 +372,15 @@ const data = reactive({
379
372
  isWarning: false,
380
373
  isInvalid: false,
381
374
  });
382
- const emit = defineEmits(['update:value', 'change', 'filter']);
375
+ const emit = defineEmits(['update:modelValue', 'change', 'filter']);
383
376
  watch(
384
377
  () => data.selectedItems,
385
378
  () => {
386
- if (JSON.stringify(data.selectedItems) !== JSON.stringify(props.value)) {
379
+ if (
380
+ JSON.stringify(data.selectedItems) !== JSON.stringify(props.modelValue)
381
+ ) {
387
382
  emit('change', data.selectedItems);
388
- emit('update:value', data.selectedItems);
383
+ emit('update:modelValue', data.selectedItems);
389
384
  }
390
385
  },
391
386
  {
@@ -409,7 +404,7 @@ const isFilterable = computed(() => {
409
404
  });
410
405
 
411
406
  function updateSelectedItems() {
412
- data.selectedItems = props.value.filter(
407
+ data.selectedItems = props.modelValue.filter(
413
408
  /***
414
409
  * @param {string} item
415
410
  * @returns {boolean}
@@ -431,8 +426,8 @@ onUpdated(checkSlots);
431
426
  onMounted(updateOptions);
432
427
  onMounted(updateSelectedItems);
433
428
 
434
- watch(() => props.value, updateSelectedItems);
435
- watch(() => props.options, updateOptions);
429
+ watch(() => props.modelValue, updateSelectedItems, { deep: true });
430
+ watch(() => props.options, updateOptions, { deep: true });
436
431
  watch(() => props.selectionFeedback, updateOptions);
437
432
 
438
433
  const highlighted = computed({
@@ -462,7 +457,7 @@ const highlighted = computed({
462
457
  },
463
458
  });
464
459
  onMounted(() => {
465
- highlighted.value = props.value ? props.value : props.highlight; // override highlight with value if provided
460
+ highlighted.value = props.modelValue ? props.modelValue : props.highlight; // override highlight with modelValue if provided
466
461
  });
467
462
 
468
463
  const internalFilter = computed({
@@ -1,7 +1,8 @@
1
1
  import { action } from '@storybook/addon-actions';
2
- import { sbCompPrefix } from '../../global/storybook-utils';
2
+ import { sbCompPrefix, storySourceCode } from '../../global/storybook-utils';
3
3
 
4
4
  import { CvInlineNotification, CvNotificationConsts } from '.';
5
+ import DocumentationTemplate from './CvInlineNotificationTemplate.mdx';
5
6
 
6
7
  export default {
7
8
  title: `${sbCompPrefix}/CvInlineNotification`,
@@ -59,6 +60,11 @@ export default {
59
60
  control: { type: 'boolean' },
60
61
  },
61
62
  },
63
+ parameters: {
64
+ docs: {
65
+ page: DocumentationTemplate,
66
+ },
67
+ },
62
68
  };
63
69
 
64
70
  const template = `<cv-inline-notification v-bind="args" @action="onAction" @close="onClose" />`;
@@ -79,6 +85,10 @@ const Template = args => {
79
85
  export const Info = Template.bind({});
80
86
  Info.args = {
81
87
  kind: CvNotificationConsts.notificationKinds[0],
88
+ primary: true,
89
+ };
90
+ Info.parameters = {
91
+ docs: { source: { code: storySourceCode(template, Info.args) } },
82
92
  };
83
93
 
84
94
  export const InfoSquare = Template.bind({});
@@ -86,24 +96,71 @@ InfoSquare.storyName = 'Info square';
86
96
  InfoSquare.args = {
87
97
  kind: CvNotificationConsts.notificationKinds[1],
88
98
  };
99
+ InfoSquare.parameters = {
100
+ docs: { source: { code: storySourceCode(template, InfoSquare.args) } },
101
+ };
89
102
 
90
103
  export const Success = Template.bind({});
91
104
  Success.args = {
92
105
  kind: CvNotificationConsts.notificationKinds[2],
93
106
  };
107
+ Success.parameters = {
108
+ docs: { source: { code: storySourceCode(template, Success.args) } },
109
+ };
94
110
 
95
111
  export const Warning = Template.bind({});
96
112
  Warning.args = {
97
113
  kind: CvNotificationConsts.notificationKinds[3],
98
114
  };
115
+ Warning.parameters = {
116
+ docs: { source: { code: storySourceCode(template, Warning.args) } },
117
+ };
99
118
 
100
119
  export const WarningAlt = Template.bind({});
101
120
  WarningAlt.storyName = 'Warning (alt)';
102
121
  WarningAlt.args = {
103
122
  kind: CvNotificationConsts.notificationKinds[4],
104
123
  };
124
+ WarningAlt.parameters = {
125
+ docs: { source: { code: storySourceCode(template, WarningAlt.args) } },
126
+ };
105
127
 
106
128
  export const Error = Template.bind({});
107
129
  Error.args = {
108
130
  kind: CvNotificationConsts.notificationKinds[5],
109
131
  };
132
+ Error.parameters = {
133
+ docs: { source: { code: storySourceCode(template, Error.args) } },
134
+ };
135
+
136
+ const templateSlots = `
137
+ <cv-inline-notification v-bind="args">
138
+ <template #title>
139
+ <h2>Big title</h2>
140
+ </template>
141
+ <template #subtitle>
142
+ Lorem ipsum dolor sit amet, <a href="#">consectetur adipisicing elit</a>, seed do eiusmod tempor <strong>incididunt ut labore</strong> et dolore magna aliqua.
143
+ </template>
144
+ </cv-inline-notification>`;
145
+ const SlotTemplate = args => {
146
+ return {
147
+ components: { CvInlineNotification },
148
+ template: templateSlots,
149
+ setup() {
150
+ return {
151
+ onAction: action('action'),
152
+ onClose: action('close'),
153
+ args,
154
+ };
155
+ },
156
+ };
157
+ };
158
+ export const Slots = SlotTemplate.bind({});
159
+ Slots.args = {
160
+ kind: CvNotificationConsts.notificationKinds[0],
161
+ actionLabel: '',
162
+ hideCloseButton: true,
163
+ };
164
+ Slots.parameters = {
165
+ docs: { source: { code: storySourceCode(templateSlots, Slots.args) } },
166
+ };
@@ -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 */