@carbon/vue 3.0.9-alpha.0 → 3.0.10

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 (94) hide show
  1. package/README.md +60 -21
  2. package/dist/carbon-vue-3.common.js +19707 -19319
  3. package/dist/carbon-vue-3.common.js.map +1 -1
  4. package/dist/carbon-vue-3.css +1 -1
  5. package/dist/carbon-vue-3.umd.js +19658 -19270
  6. package/dist/carbon-vue-3.umd.js.map +1 -1
  7. package/dist/carbon-vue-3.umd.min.js +4 -4
  8. package/dist/carbon-vue-3.umd.min.js.map +1 -1
  9. package/dist/web-types.json +5477 -0
  10. package/package.json +10 -42
  11. package/src/components/CvAccordion/CvAccordionItem.vue +1 -1
  12. package/src/components/CvButton/CvButton.stories.js +1 -1
  13. package/src/components/CvButton/CvButton.vue +2 -2
  14. package/src/components/CvButton/CvIconButton.stories.js +14 -17
  15. package/src/components/CvButton/CvIconButton.vue +8 -7
  16. package/src/components/CvCheckbox/CvCheckbox.vue +4 -3
  17. package/src/components/CvCodeSnippet/CvCodeSnippet.vue +5 -5
  18. package/src/components/CvCodeSnippet/_CviCodeSnippetInline.vue +2 -2
  19. package/src/components/CvCodeSnippet/_CviCodeSnippetMultiline.vue +6 -6
  20. package/src/components/CvCodeSnippet/_CviCodeSnippetOneline.vue +3 -3
  21. package/src/components/CvComboBox/CvComboBox.vue +8 -8
  22. package/src/components/CvContentSwitcher/CvContentSwitcher.vue +1 -1
  23. package/src/components/CvContentSwitcher/CvContentSwitcherButton.vue +1 -1
  24. package/src/components/CvCopyButton/CvCopyButton.vue +1 -1
  25. package/src/components/CvCopyButton/_CviCopyButton.vue +2 -2
  26. package/src/components/CvDataTable/CvDataTable.vue +29 -27
  27. package/src/components/CvDataTable/CvDataTableHeading.vue +9 -9
  28. package/src/components/CvDataTable/CvDataTableRow.vue +6 -6
  29. package/src/components/CvDataTable/CvDataTableSkeleton.vue +3 -3
  30. package/src/components/CvDataTable/_CvDataTableRowInner.vue +9 -9
  31. package/src/components/CvDatePicker/CvDatePicker.vue +10 -10
  32. package/src/components/CvDatePicker/CvDatePickerSkeleton.vue +3 -3
  33. package/src/components/CvDropdown/CvDropdown.vue +7 -9
  34. package/src/components/CvDropdown/CvDropdownItem.vue +1 -1
  35. package/src/components/CvFileUploader/CvFileUploader.stories.mdx +24 -6
  36. package/src/components/CvFileUploader/CvFileUploader.vue +65 -26
  37. package/src/components/CvFileUploader/CvFileUploaderItem.vue +1 -1
  38. package/src/components/CvForm/CvFormGroup.vue +2 -2
  39. package/src/components/CvGrid/CvColumn.vue +5 -0
  40. package/src/components/CvLink/CvLink.vue +1 -1
  41. package/src/components/CvLoading/CvLoading.stories.js +1 -1
  42. package/src/components/CvLoading/CvLoading.vue +1 -1
  43. package/src/components/CvModal/CvModal.vue +19 -19
  44. package/src/components/CvMultiSelect/CvMultiSelect.vue +4 -4
  45. package/src/components/CvNotification/CvToastNotification.stories.js +12 -15
  46. package/src/components/CvNotification/CvToastNotification.vue +1 -1
  47. package/src/components/CvNumberInput/CvNumberInput.vue +3 -6
  48. package/src/components/CvOverflowMenu/CvOverflowMenu.vue +11 -10
  49. package/src/components/CvOverflowMenu/CvOverflowMenuItem.vue +1 -1
  50. package/src/components/CvPagination/CvPagination.vue +11 -15
  51. package/src/components/CvProgress/CvProgress.vue +1 -1
  52. package/src/components/CvProgress/CvProgressStep.vue +5 -5
  53. package/src/components/CvRadioButton/CvRadioButton.vue +3 -3
  54. package/src/components/CvSearch/CvSearch.vue +11 -10
  55. package/src/components/CvSelect/CvSelect.vue +1 -1
  56. package/src/components/CvSlider/CvSlider.vue +7 -7
  57. package/src/components/CvSlider/__tests__/__snapshots__/CvSlider.spec.js.snap +1 -1
  58. package/src/components/CvStructuredList/CvStructuredListItem.vue +3 -3
  59. package/src/components/CvStructuredList/CvStructuredListItemSelectable.vue +1 -1
  60. package/src/components/CvStructuredList/__tests__/__snapshots__/CvStructuredListItem.spec.js.snap +3 -3
  61. package/src/components/CvSvg/__tests__/_TestIcon.vue +2 -2
  62. package/src/components/CvTabs/CvTab.vue +1 -1
  63. package/src/components/CvTabs/CvTabs.stories.mdx +84 -3
  64. package/src/components/CvTabs/CvTabs.vue +15 -13
  65. package/src/components/CvTabs/__tests__/__snapshots__/CvTabs.spec.js.snap +24 -0
  66. package/src/components/CvTag/CvTag.stories.js +3 -2
  67. package/src/components/CvTag/CvTag.vue +11 -6
  68. package/src/components/CvTag/CvTagSkeleton.stories.js +39 -0
  69. package/src/components/CvTag/CvTagSkeleton.vue +20 -0
  70. package/src/components/CvTag/index.js +2 -1
  71. package/src/components/CvTextArea/CvTextArea.vue +6 -6
  72. package/src/components/CvTextInput/CvTextInput.stories.js +28 -16
  73. package/src/components/CvTextInput/CvTextInput.vue +37 -7
  74. package/src/components/CvTextInput/CvTextInputSkeleton.vue +17 -0
  75. package/src/components/CvTextInput/index.js +2 -1
  76. package/src/components/CvTile/CvTile.vue +3 -3
  77. package/src/components/CvTile/CvTileExpandable.vue +7 -7
  78. package/src/components/CvTile/CvTileSelectable.vue +2 -2
  79. package/src/components/CvTimePicker/CvTimePicker.vue +1 -1
  80. package/src/components/CvTooltip/CvDefinitionTooltip.vue +2 -2
  81. package/src/components/CvTooltip/CvInteractiveTooltip.vue +6 -6
  82. package/src/components/CvTooltip/__tests__/__snapshots__/CvTooltip.spec.js.snap +14 -14
  83. package/src/components/CvUIShell/CvHeader.vue +1 -1
  84. package/src/components/CvUIShell/CvHeaderGlobalAction.vue +7 -7
  85. package/src/components/CvUIShell/CvHeaderMenu.vue +3 -3
  86. package/src/components/CvUIShell/CvHeaderMenuButton.vue +2 -2
  87. package/src/components/CvUIShell/CvHeaderMenuItem.vue +2 -2
  88. package/src/components/CvUIShell/CvHeaderName.vue +1 -1
  89. package/src/components/CvUIShell/CvHeaderNav.vue +1 -1
  90. package/src/components/CvUIShell/CvHeaderPanel.vue +3 -2
  91. package/src/components/CvUIShell/CvSideNav.vue +5 -4
  92. package/src/components/CvUIShell/CvSideNavItems.vue +1 -1
  93. package/src/components/CvUIShell/CvSideNavLink.vue +1 -1
  94. package/src/components/CvUIShell/_CvSideNavFooter.vue +2 -1
@@ -2,12 +2,12 @@
2
2
  <div :class="`cv-pagination ${carbonPrefix}--pagination`" data-pagination>
3
3
  <div :class="`${carbonPrefix}--pagination__left`">
4
4
  <cv-select
5
+ ref="pageSizeSelect"
5
6
  :class="`${carbonPrefix}--select__item-count`"
6
7
  :label="pageSizesLabel"
7
8
  inline
8
- ref="pageSizeSelect"
9
- @change="onPageSizeChange"
10
9
  :value="`${pageSizeValue}`"
10
+ @change="onPageSizeChange"
11
11
  >
12
12
  <cv-select-option
13
13
  v-for="(size, index) in pageSizes"
@@ -21,23 +21,21 @@
21
21
 
22
22
  <span :class="`${carbonPrefix}--pagination__text`">
23
23
  <span data-displayed-item-range>
24
- <slot name="range-text" v-bind:scope="rangeProps">{{
25
- rangeText
26
- }}</slot>
24
+ <slot name="range-text" :scope="rangeProps">{{ rangeText }}</slot>
27
25
  </span>
28
26
  </span>
29
27
  </div>
30
28
 
31
29
  <div :class="`${carbonPrefix}--pagination__right`">
32
30
  <cv-select
31
+ v-if="numberOfItems !== Infinity"
32
+ ref="pageSelect"
33
33
  :class="`${carbonPrefix}--select__page-number`"
34
34
  :label="pageNumberLabel"
35
35
  inline
36
- hideLabel
37
- ref="pageSelect"
38
- @change="onPageChange"
36
+ hide-label
39
37
  :value="`${pageValue}`"
40
- v-if="numberOfItems !== Infinity"
38
+ @change="onPageChange"
41
39
  >
42
40
  <cv-select-option
43
41
  v-for="pageNumber in pages"
@@ -48,9 +46,7 @@
48
46
  >
49
47
  </cv-select>
50
48
  <span :class="`${carbonPrefix}--pagination__text`">
51
- <slot name="of-n-pages" v-bind:scope="ofNPagesProps">{{
52
- pageOfPages
53
- }}</slot>
49
+ <slot name="of-n-pages" :scope="ofNPagesProps">{{ pageOfPages }}</slot>
54
50
  </span>
55
51
 
56
52
  <button
@@ -61,8 +57,8 @@
61
57
  ]"
62
58
  data-page-backward
63
59
  :aria-label="backwardText"
64
- @click="onPrevPage"
65
60
  :disabled="noWayBack"
61
+ @click="onPrevPage"
66
62
  >
67
63
  <CaretLeft16 :class="`${carbonPrefix}--pagination__button-icon`" />
68
64
  </button>
@@ -75,8 +71,8 @@
75
71
  ]"
76
72
  data-page-forward
77
73
  :aria-label="forwardText"
78
- @click="onNextPage"
79
74
  :disabled="noWayForward"
75
+ @click="onNextPage"
80
76
  >
81
77
  <CaretRight16 :class="`${carbonPrefix}--pagination__button-icon`" />
82
78
  </button>
@@ -102,7 +98,7 @@ const props = defineProps({
102
98
  pageSizesLabel: { type: String, default: 'Items per page:' },
103
99
  numberOfItems: { type: Number, default: Infinity },
104
100
  actualItemsOnPage: { type: Number, default: Infinity },
105
- page: Number,
101
+ page: { type: Number, default: undefined },
106
102
  pageSizes: { type: Array, default: () => [10, 20, 30, 40, 50] },
107
103
  });
108
104
 
@@ -34,7 +34,7 @@ const props = defineProps({
34
34
  /**
35
35
  * An array of labels for the steps. Use `cv-progress-step` components for more control over the step logic.
36
36
  */
37
- steps: Array,
37
+ steps: { type: Array, default: () => [] },
38
38
  /**
39
39
  * Determines whether the ProgressIndicator should be rendered vertically.
40
40
  */
@@ -1,11 +1,11 @@
1
1
  <!--suppress HtmlUnknownTag -->
2
2
  <template>
3
3
  <li
4
+ :id="uid"
4
5
  :class="[
5
6
  `cv-progress-step ${carbonPrefix}--progress-step`,
6
7
  `${carbonPrefix}--progress-step--${internalState}`,
7
8
  ]"
8
- :id="uid"
9
9
  :aria-disabled="disabled"
10
10
  >
11
11
  <button
@@ -62,12 +62,12 @@ const STEP_INCOMPLETE = 'incomplete';
62
62
  const STEP_DISABLED = 'disabled';
63
63
 
64
64
  const props = defineProps({
65
- additionalInfo: String,
66
- description: String,
65
+ additionalInfo: { type: String, default: undefined },
66
+ description: { type: String, default: undefined },
67
67
  disabled: Boolean,
68
68
  invalid: Boolean,
69
- label: String,
70
- tipText: String,
69
+ label: { type: String, default: undefined },
70
+ tipText: { type: String, default: undefined },
71
71
  complete: Boolean,
72
72
  ...propsCvId,
73
73
  });
@@ -8,9 +8,9 @@
8
8
  <input
9
9
  v-bind="$attrs"
10
10
  :id="cvId"
11
+ ref="input"
11
12
  :checked="isChecked"
12
13
  :class="`${carbonPrefix}--radio-button`"
13
- ref="input"
14
14
  type="radio"
15
15
  :value="value"
16
16
  @change="onChange"
@@ -33,9 +33,9 @@ import { carbonPrefix } from '../../global/settings';
33
33
  import { useCvId, propsCvId, useMethods, useRadio } from '../../use';
34
34
 
35
35
  const props = defineProps({
36
- modelValue: String,
36
+ modelValue: { type: String, default: undefined },
37
37
  checked: Boolean,
38
- label: String,
38
+ label: { type: String, default: undefined },
39
39
  value: { type: String, required: true },
40
40
  hideLabel: Boolean,
41
41
  labelLeft: Boolean,
@@ -4,6 +4,7 @@
4
4
  :class="`cv-search ${carbonPrefix}--form-item`"
5
5
  >
6
6
  <div
7
+ ref="elSearch"
7
8
  :aria-label="internalAriaLabel"
8
9
  :aria-labelledby="internalAriaLabelBy"
9
10
  :class="[
@@ -18,7 +19,6 @@
18
19
  },
19
20
  ]"
20
21
  role="search"
21
- ref="elSearch"
22
22
  >
23
23
  <div
24
24
  :class="`${carbonPrefix}--search-magnifier`"
@@ -33,20 +33,20 @@
33
33
  }}</label>
34
34
 
35
35
  <input
36
- role="searchbox"
37
36
  :id="uid"
38
- :class="`${carbonPrefix}--search-input`"
39
37
  v-bind="$attrs"
38
+ ref="elInput"
40
39
  v-model="internalSearchText"
41
- @input="onInput"
40
+ role="searchbox"
41
+ :class="`${carbonPrefix}--search-input`"
42
42
  type="text"
43
- ref="elInput"
44
43
  :placeholder="placeholder"
45
44
  :aria-labelledby="uid"
45
+ :disabled="disabled ? 'true' : undefined"
46
+ @input="onInput"
46
47
  @blur="checkFocus"
47
48
  @click="toggleActive"
48
49
  @keydown.esc="onClearClick"
49
- :disabled="disabled ? 'true' : undefined"
50
50
  />
51
51
 
52
52
  <button
@@ -111,7 +111,7 @@ const props = defineProps({
111
111
  /**
112
112
  * Provide the label text for the Search icon
113
113
  */
114
- label: String,
114
+ label: { type: String, default: undefined },
115
115
  /**
116
116
  * Specify the search size ('sm', 'md', 'lg', 'xl')
117
117
  */
@@ -151,7 +151,7 @@ const props = defineProps({
151
151
  /**
152
152
  * Optionally provide the default value of the `<input>`
153
153
  */
154
- value: String,
154
+ value: { type: String, default: undefined },
155
155
  /**
156
156
  * @deprecated use value
157
157
  */
@@ -172,10 +172,11 @@ const props = defineProps({
172
172
  */
173
173
  toolbarAriaLabel: {
174
174
  type: String,
175
- validator: () => {
176
- console.warn('Deprecated: probably you want expandable=true');
175
+ validator: s => {
176
+ if (s) console.warn('Deprecated: probably you want expandable=true');
177
177
  return true;
178
178
  },
179
+ default: undefined,
179
180
  },
180
181
  ...propsTheme,
181
182
  ...propsCvId,
@@ -37,7 +37,7 @@
37
37
  >
38
38
  <div
39
39
  :class="`${carbonPrefix}--select-input__wrapper`"
40
- :data-invalid="isInvalid ? true : undefined"
40
+ :data-invalid="isInvalid || null"
41
41
  >
42
42
  <select
43
43
  v-bind="$attrs"
@@ -2,12 +2,12 @@
2
2
  <div :class="`cv-slider ${carbonPrefix}--form-item`">
3
3
  <label
4
4
  v-show="label"
5
+ :id="labelId"
5
6
  :for="cvId"
6
7
  :class="[
7
8
  `${carbonPrefix}--label`,
8
9
  { [`${carbonPrefix}--label--disabled`]: disabled },
9
10
  ]"
10
- :id="labelId"
11
11
  >
12
12
  {{ label }}
13
13
  </label>
@@ -26,9 +26,9 @@
26
26
  data-slider-input-box="#slider-input-box"
27
27
  >
28
28
  <div
29
+ ref="track"
29
30
  :class="`${carbonPrefix}--slider__track`"
30
31
  @click="onTrackClick"
31
- ref="track"
32
32
  ></div>
33
33
 
34
34
  <div
@@ -37,6 +37,7 @@
37
37
  ></div>
38
38
 
39
39
  <div
40
+ ref="thumb"
40
41
  :class="[
41
42
  `${carbonPrefix}--slider__thumb`,
42
43
  {
@@ -46,7 +47,6 @@
46
47
  tabindex="0"
47
48
  :aria-labelledby="labelId"
48
49
  :style="`left: ${percentage};`"
49
- ref="thumb"
50
50
  @keydown.up.right.prevent="onUp"
51
51
  @keydown.down.left.prevent="onDown"
52
52
  @mousedown="onStartDrag"
@@ -54,12 +54,12 @@
54
54
 
55
55
  <input
56
56
  :id="cvId"
57
+ ref="range"
57
58
  :class="`${carbonPrefix}--slider__input`"
58
59
  type="range"
59
60
  :step="step"
60
61
  :min="min"
61
62
  :max="max"
62
- ref="range"
63
63
  />
64
64
  </div>
65
65
 
@@ -68,18 +68,18 @@
68
68
  </span>
69
69
 
70
70
  <input
71
+ ref="inputBox"
72
+ v-model="internalValue"
71
73
  type="string"
72
74
  :class="[
73
75
  `${carbonPrefix}--text-input ${carbonPrefix}--slider-text-input`,
74
76
  { [`${carbonPrefix}--text-input--light`]: isLight },
75
77
  ]"
76
78
  :placeholder="min"
77
- v-model="internalValue"
79
+ :disabled="disabled"
78
80
  @change="onChange"
79
- ref="inputBox"
80
81
  @keydown.up.prevent="onUp"
81
82
  @keydown.down.prevent="onDown"
82
- :disabled="disabled"
83
83
  />
84
84
  </div>
85
85
  </div>
@@ -1,7 +1,7 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`CvSlider should match snapshot 1`] = `
4
- <div class="cv-slider bx--form-item"><label for="abc" class="bx--label" id="abc-label" style="display: none;"></label>
4
+ <div class="cv-slider bx--form-item"><label id="abc-label" for="abc" class="bx--label" style="display: none;"></label>
5
5
  <div class="bx--slider-container"><span class="bx--slider__range-label">0</span>
6
6
  <div class="bx--slider" data-slider="" data-slider-input-box="#slider-input-box">
7
7
  <div class="bx--slider__track"></div>
@@ -4,7 +4,7 @@
4
4
  v-bind="$attrs"
5
5
  class="cv-structured-list-item"
6
6
  :value="value"
7
- :modelValue="modelValue"
7
+ :model-value="modelValue"
8
8
  >
9
9
  <slot></slot>
10
10
  </component>
@@ -30,8 +30,8 @@ defineProps({
30
30
  },
31
31
  });
32
32
 
33
- const selectable = inject('selectable');
34
- const change = inject('change');
33
+ const selectable = inject('selectable', false);
34
+ const change = inject('change', () => {});
35
35
  const emit = defineEmits(['change']);
36
36
 
37
37
  provide('onRadioItemChange', clickedItemCvId => {
@@ -11,8 +11,8 @@
11
11
  <slot></slot>
12
12
  <input
13
13
  v-bind="$attrs"
14
- tabindex="-1"
15
14
  :id="cvId"
15
+ tabindex="-1"
16
16
  :class="`${carbonPrefix}--structured-list-input`"
17
17
  :checked="isChecked"
18
18
  :value="value"
@@ -1,7 +1,7 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`CvStructuredListItem should render correctly when \`value\` is default 1`] = `<cv-structured-list-item-standard-stub id="test-2" class="cv-structured-list-item" modelvalue="test"></cv-structured-list-item-standard-stub>`;
3
+ exports[`CvStructuredListItem should render correctly when \`value\` is default 1`] = `<cv-structured-list-item-standard-stub id="test-2" class="cv-structured-list-item" model-value="test"></cv-structured-list-item-standard-stub>`;
4
4
 
5
- exports[`CvStructuredListItem should render correctly when \`value\` is set 1`] = `<cv-structured-list-item-standard-stub id="test-2" class="cv-structured-list-item" modelvalue="test" value="strictured list item value test"></cv-structured-list-item-standard-stub>`;
5
+ exports[`CvStructuredListItem should render correctly when \`value\` is set 1`] = `<cv-structured-list-item-standard-stub id="test-2" class="cv-structured-list-item" model-value="test" value="strictured list item value test"></cv-structured-list-item-standard-stub>`;
6
6
 
7
- exports[`CvStructuredListItem should render correctly when slot is specified 1`] = `<cv-structured-list-item-standard-stub id="test-2" class="cv-structured-list-item" modelvalue="test"></cv-structured-list-item-standard-stub>`;
7
+ exports[`CvStructuredListItem should render correctly when slot is specified 1`] = `<cv-structured-list-item-standard-stub id="test-2" class="cv-structured-list-item" model-value="test"></cv-structured-list-item-standard-stub>`;
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" id="root">
3
- <g fill-rule="evenodd" id="g">
2
+ <svg id="root" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
3
+ <g id="g" fill-rule="evenodd">
4
4
  <path
5
5
  id="path"
6
6
  d="M7 7H4v2h3v3h2V9h3V7H9V4H7v3zm1 9A8 8 0 1 1 8 0a8 8 0 0 1 0 16z"
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div
3
- :class="`cv-tab ${carbonPrefix}--tab-content`"
4
3
  :id="uid"
4
+ :class="`cv-tab ${carbonPrefix}--tab-content`"
5
5
  role="tabpanel"
6
6
  :aria-labelledby="`${uid}-link`"
7
7
  :aria-hidden="!dataSelected ? 'true' : 'false'"
@@ -5,6 +5,7 @@ import CvTab from './CvTab.vue';
5
5
  import CvTabsSkeleton from './CvTabsSkeleton.vue';
6
6
  import SbContainer from './_SbContainer.vue';
7
7
  import { action } from '@storybook/addon-actions';
8
+ import { IbmSecurity20 as SampleIcon } from '@carbon/icons-vue';
8
9
 
9
10
  <Meta
10
11
  title={`${sbCompPrefix}/CvTabs`}
@@ -23,6 +24,7 @@ export const Template = args => ({
23
24
  CvTabs,
24
25
  CvTab,
25
26
  CvTabsSkeleton,
27
+ SampleIcon,
26
28
  },
27
29
  // The story's `args` need to be mapped into the template through the `setup()` method
28
30
  setup() {
@@ -31,6 +33,7 @@ export const Template = args => ({
31
33
  noDefaultToFirst: args.noDefaultToFirst,
32
34
  selectedId: args.selectedId,
33
35
  disabledIds: args.disabledIds,
36
+ slottedTabs: args.slottedTabs,
34
37
  onTabSelected: action('tab-selected'),
35
38
  onTabSelectedId: action('tab-selected-id'),
36
39
  };
@@ -46,20 +49,47 @@ const defaultTemplate = `
46
49
  @tab-selected-id="onTabSelectedId"
47
50
  aria-label="navigation tab label">
48
51
  <cv-tab id="tab-1" label="House" :selected="selectedId === 'tab-1'" :disabled="disabledIds.includes('tab-1')">
49
- <p>
52
+ <p v-if="slottedTabs">
53
+ To customise tab look, in CvTabs component use scoped slot named with tab's id.
54
+ Example: current tab has id "<strong>tab-1</strong>", so the code for customising tab looks like:
55
+ <div style="background-color: lightgrey; padding: 0.5rem;">
56
+ &lt;template #tab-1="tab"&gt;
57
+ {&nbsp;{ tab.label }&nbsp;} &lt;IbmSecurity20 /&gt;
58
+ &lt;template&gt;
59
+ </div>
60
+ </p>
61
+ <p v-else>
50
62
  29 Arlington Avenue is a house in Islington, London. Douglas Adams shared the house for a time
51
63
  with Jonny Brock and Clare Gorst. It is mentioned in the dedication of The Hitchhiker's Guide to
52
64
  the Galaxy, which is dedicated to the "Arlingtonians for tea, sympathy, and a sofa."
53
65
  </p>
54
66
  </cv-tab>
55
67
  <cv-tab id="tab-2" label="Bar" :selected="selectedId === 'tab-2'" :disabled="disabledIds.includes('tab-2')">
56
- <p>
68
+ <p v-if="slottedTabs">
69
+ To customise tab look, in CvTabs component use scoped slot named with tab's id.
70
+ Example: current tab has id "<strong>tab-2</strong>", so the code for customising tab looks like:
71
+ <div style="background-color: lightgrey; padding: 0.5rem;">
72
+ &lt;template #tab-2="tab"&gt;
73
+ {&nbsp;{ tab.label }&nbsp;} &lt;strong style="color: red;"&gt;(*)&lt;/strong&gt;
74
+ &lt;template&gt;
75
+ </div>
76
+ </p>
77
+ <p v-else>
57
78
  The Old Pink Dog Bar was the bar in Han Dold City that Ford Prefect was in when he discovered
58
79
  that his Guide had his full entry on Earth on it.
59
80
  </p>
60
81
  </cv-tab>
61
82
  <cv-tab id="tab-3" label="Reach" :selected="selectedId === 'tab-3'" :disabled="disabledIds.includes('tab-3')">
62
- <p>
83
+ <p v-if="slottedTabs">
84
+ To customise tab look, in CvTabs component use scoped slot named with tab's id.
85
+ Example: current tab has id "<strong>tab-3</strong>", so the code for customising tab looks like:
86
+ <div style="background-color: lightgrey; padding: 0.5rem;">
87
+ &lt;template #tab-3="tab"&gt;
88
+ {&nbsp;{ tab.label }&nbsp;} &lt;strong style="color: orange;"&gt;(!)&lt;/strong&gt;
89
+ &lt;template&gt;
90
+ </div>
91
+ </p>
92
+ <p v-else>
63
93
  The Third Reach of the Unknown is what might be loosely described as a "place" which exists only
64
94
  under high improbability conditions and was created on the starship Heart of Gold due to the
65
95
  Infinite Improbability Drive. During Arthur Dent and Ford Prefect's first trip on board the Heart
@@ -81,6 +111,15 @@ const defaultTemplate = `
81
111
  <a target='_blank' href='https://hitchhikers.fandom.com/wiki/Main_Page'>credits</a>
82
112
  </p>
83
113
  </cv-tab>
114
+ <template v-if="slottedTabs" #tab-1="tab">
115
+ House <SampleIcon/>
116
+ </template>
117
+ <template v-if="slottedTabs" #tab-2="tab">
118
+ {{tab.label}} <strong style="color: red;">(*)</strong>
119
+ </template>
120
+ <template v-if="slottedTabs" #tab-3="tab">
121
+ {{tab.label}} <strong style="color: orange;">(!)</strong>
122
+ </template>
84
123
  </cv-tabs>
85
124
  `;
86
125
  const skeletonTemplate = `<cv-tabs-skeleton></cv-tabs-skeleton>`;
@@ -173,3 +212,45 @@ screens, and so I suggest using a different component for mobile cases.
173
212
  {Template.bind({})}
174
213
  </Story>
175
214
  </Canvas>
215
+
216
+ # Tabs slotted
217
+
218
+ <Canvas>
219
+ <Story
220
+ name="tabsSlot"
221
+ parameters={{
222
+ controls: {
223
+ exclude: [
224
+ 'default',
225
+ 'template',
226
+ 'leftOverflowIconButtonProps',
227
+ 'rightOverflowIconButtonProps',
228
+ 'scrollIntoView',
229
+ 'tab-selected',
230
+ 'tab-selected-id',
231
+ 'slottedTabs',
232
+ ],
233
+ },
234
+ docs: { source: { code: defaultTemplate } },
235
+ }}
236
+ args={{
237
+ template: defaultTemplate,
238
+ selectedId: '',
239
+ disabledIds: [],
240
+ slottedTabs: true
241
+ }}
242
+ argTypes={{
243
+ selectedId: {
244
+ control: 'select',
245
+ default: '',
246
+ options: ['', 'tab-1', 'tab-2', 'tab-3', 'tab-4', 'tab-5'],
247
+ },
248
+ disabledIds: {
249
+ control: 'multi-select',
250
+ options: ['tab-1', 'tab-2', 'tab-3', 'tab-4', 'tab-5'],
251
+ },
252
+ }}
253
+ >
254
+ {Template.bind({})}
255
+ </Story>
256
+ </Canvas>
@@ -16,6 +16,7 @@
16
16
  @keydown.left.prevent.stop="onLeft"
17
17
  >
18
18
  <button
19
+ ref="elLeftOverflow"
19
20
  aria-hidden="true"
20
21
  aria-label="scroll left"
21
22
  :class="[
@@ -25,12 +26,11 @@
25
26
  leftOverflowNavButtonHidden,
26
27
  },
27
28
  ]"
29
+ tabIndex="-1"
30
+ type="button"
28
31
  @click.stop.prevent="e => onOverflowClick(e, { direction: -1 })"
29
32
  @mousedown.stop.prevent="e => onOverflowMouseDown(e, { direction: -1 })"
30
33
  @mouseup.stop.prevent="onOverflowMouseUp"
31
- tabIndex="-1"
32
- type="button"
33
- ref="elLeftOverflow"
34
34
  >
35
35
  <ChevronLeft16 />
36
36
  </button>
@@ -40,9 +40,9 @@
40
40
  />
41
41
 
42
42
  <ul
43
+ ref="elTabList"
43
44
  :class="`${carbonPrefix}--tabs--scrollable__nav`"
44
45
  role="tablist"
45
- ref="elTabList"
46
46
  >
47
47
  <li
48
48
  v-for="tab in tabs"
@@ -65,18 +65,20 @@
65
65
  role="presentation"
66
66
  >
67
67
  <button
68
+ :id="`${tab.uid}-link`"
69
+ ref="elLink"
68
70
  :class="`${carbonPrefix}--tabs--scrollable__nav-link`"
69
71
  role="tab"
70
72
  :aria-controls="tab.uid"
71
73
  :aria-disabled="disabledTabs.has(tab.uid)"
72
74
  :aria-selected="selectedId === tab.uid"
73
- :id="`${tab.uid}-link`"
74
- @click="onTabClick(tab.uid)"
75
- ref="elLink"
76
75
  :tabindex="selectedId === tab.uid ? 0 : -1"
77
76
  type="button"
77
+ @click="onTabClick(tab.uid)"
78
78
  >
79
- {{ tab.label }}
79
+ <slot :name="tab.uid" v-bind="tab">
80
+ {{ tab.label }}
81
+ </slot>
80
82
  </button>
81
83
  </li>
82
84
  </ul>
@@ -86,6 +88,7 @@
86
88
  :class="`${carbonPrefix}--tabs__overflow-indicator--right`"
87
89
  />
88
90
  <button
91
+ ref="elRightOverflow"
89
92
  aria-hidden="true"
90
93
  aria-label="scroll right"
91
94
  :class="[
@@ -95,12 +98,11 @@
95
98
  rightOverflowNavButtonHidden,
96
99
  },
97
100
  ]"
101
+ tabIndex="-1"
102
+ type="button"
98
103
  @click="e => onOverflowClick(e, { direction: 1 })"
99
104
  @mousedown="e => onOverflowMouseDown(e, { direction: 1 })"
100
105
  @mouseup="onOverflowMouseUp"
101
- tabIndex="-1"
102
- type="button"
103
- ref="elRightOverflow"
104
106
  >
105
107
  <ChevronRight16 />
106
108
  </button>
@@ -134,7 +136,7 @@ const props = defineProps({
134
136
  /**
135
137
  * @deprecated not used in component
136
138
  */
137
- leftOverflowIconButtonProps: Object,
139
+ leftOverflowIconButtonProps: { type: Object, default: undefined },
138
140
  /**
139
141
  * This is an edge use case. By default, if no tab is explicitly selected, the first non-disabled tab is selected.
140
142
  */
@@ -142,7 +144,7 @@ const props = defineProps({
142
144
  /**
143
145
  * @deprecated not used in component
144
146
  */
145
- rightOverflowIconButtonProps: Object,
147
+ rightOverflowIconButtonProps: { type: Object, default: undefined },
146
148
  /**
147
149
  * @deprecated not used in component
148
150
  */
@@ -0,0 +1,24 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`CvTabs CvTabs - test slotted tab buttons to match snapshot 1`] = `
4
+ <div class="cv-tabs ABC-class-123" style="width: 100%;" aria-label="ABC-aria-label-123">
5
+ <div data-tabs="" class="cv-tab bx--tabs--scrollable ABC-class-123" role="navigation" aria-label="ABC-aria-label-123"><button aria-hidden="true" aria-label="scroll left" class="bx--tab--overflow-nav-button--hidden" tabindex="-1" type="button"><svg focusable="false" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true">
6
+ <path d="M5 8L10 3 10.7 3.7 6.4 8 10.7 12.3 10 13z"></path>
7
+ </svg></button>
8
+ <!--v-if-->
9
+ <ul class="bx--tabs--scrollable__nav" role="tablist">
10
+ <li class="cv-tabs-button bx--tabs--scrollable__nav-item bx--tabs__nav-item--selected bx--tabs--scrollable__nav-item--selected" role="presentation"><button id="tab-1-link" class="bx--tabs--scrollable__nav-link" role="tab" aria-controls="tab-1" aria-disabled="false" aria-selected="true" tabindex="0" type="button">Hello <strong style="color: red;">(*)</strong></button></li>
11
+ <li class="cv-tabs-button bx--tabs--scrollable__nav-item" role="presentation"><button id="tab-2-link" class="bx--tabs--scrollable__nav-link" role="tab" aria-controls="tab-2" aria-disabled="false" aria-selected="false" tabindex="-1" type="button">Origin<strong style="color: orange;">(!)</strong></button></li>
12
+ <li class="cv-tabs-button bx--tabs--scrollable__nav-item" role="presentation"><button id="tab-3-link" class="bx--tabs--scrollable__nav-link" role="tab" aria-controls="tab-3" aria-disabled="false" aria-selected="false" tabindex="-1" type="button">Tab 3 label</button></li>
13
+ </ul>
14
+ <!--v-if--><button aria-hidden="true" aria-label="scroll right" class="bx--tab--overflow-nav-button--hidden" tabindex="-1" type="button"><svg focusable="false" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true">
15
+ <path d="M11 8L6 13 5.3 12.3 9.6 8 5.3 3.7 6 3z"></path>
16
+ </svg></button>
17
+ </div>
18
+ <div class="cv-tabs__panels">
19
+ <div id="tab-1" class="cv-tab bx--tab-content" role="tabpanel" aria-labelledby="tab-1-link" aria-hidden="false">Tab 1 content</div>
20
+ <div id="tab-2" class="cv-tab bx--tab-content" role="tabpanel" aria-labelledby="tab-2-link" aria-hidden="true" hidden="">Tab 2 content</div>
21
+ <div id="tab-3" class="cv-tab bx--tab-content" role="tabpanel" aria-labelledby="tab-3-link" aria-hidden="true" hidden="">Tab 3 content</div>
22
+ </div>
23
+ </div>
24
+ `;
@@ -10,11 +10,11 @@ export default {
10
10
  title: `${sbCompPrefix}/CvTag`,
11
11
  component: CvTag,
12
12
  argTypes: {
13
- kind: { control: { type: 'select', options: tagKinds } },
13
+ kind: { control: 'select', options: tagKinds },
14
14
  },
15
15
  };
16
16
 
17
- const template = `<CvTag @remove="onRemove" v-bind="args" />`;
17
+ const template = `<cv-tag @remove="onRemove" v-bind="args" />`;
18
18
  const Template = (args, { argTypes }) => {
19
19
  return {
20
20
  props: Object.keys(argTypes),
@@ -56,6 +56,7 @@ Filter.parameters = storyParametersObject(
56
56
  export const Skeleton = Template.bind({});
57
57
  Skeleton.args = {
58
58
  skeleton: true,
59
+ label: '',
59
60
  };
60
61
  Skeleton.parameters = storyParametersObject(
61
62
  Skeleton.parameters,