@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
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div :style="tableStyle" class="cv-data-table" :id="uid">
2
+ <div :id="uid" :style="tableStyle" class="cv-data-table">
3
3
  <div
4
4
  :class="[
5
5
  `${carbonPrefix}--data-table-container`,
@@ -10,7 +10,7 @@
10
10
  ]"
11
11
  >
12
12
  <div v-if="hasTableHeader" :class="`${carbonPrefix}--data-table-header`">
13
- <h4 :class="`${carbonPrefix}--data-table-header__title`" v-if="title">
13
+ <h4 v-if="title" :class="`${carbonPrefix}--data-table-header__title`">
14
14
  {{ title }}
15
15
  </h4>
16
16
  <p
@@ -22,8 +22,8 @@
22
22
  </div>
23
23
  <section v-if="hasToolbar" :class="`${carbonPrefix}--table-toolbar`">
24
24
  <div
25
- :aria-hidden="!batchActive"
26
25
  v-show="hasBatchActions"
26
+ :aria-hidden="!batchActive"
27
27
  :class="[
28
28
  `${carbonPrefix}--batch-actions`,
29
29
  { [`${carbonPrefix}--batch-actions--active`]: batchActive },
@@ -44,7 +44,7 @@
44
44
  <span data-items-selected>
45
45
  <slot
46
46
  name="items-selected"
47
- v-bind:scope="{ count: dataRowsSelected.length }"
47
+ :scope="{ count: dataRowsSelected.length }"
48
48
  >{{ dataRowsSelected.length }} items selected</slot
49
49
  >
50
50
  </span>
@@ -54,6 +54,7 @@
54
54
  <div :class="`${carbonPrefix}--toolbar-content`">
55
55
  <div
56
56
  v-if="onSearch"
57
+ ref="searchContainer"
57
58
  :aria-labelledby="`${uid}-search`"
58
59
  :class="[
59
60
  `${carbonPrefix}--search `,
@@ -67,9 +68,8 @@
67
68
  },
68
69
  ]"
69
70
  role="search"
70
- ref="searchContainer"
71
71
  >
72
- <div :class="`${carbonPrefix}--search-magnifier`" ref="magnifier">
72
+ <div ref="magnifier" :class="`${carbonPrefix}--search-magnifier`">
73
73
  <Search16 :class="`${carbonPrefix}--search-magnifier-icon`" />
74
74
  </div>
75
75
  <label
@@ -79,14 +79,14 @@
79
79
  >{{ searchLabel }}</label
80
80
  >
81
81
  <input
82
+ :id="`searchbox-${uid}`"
83
+ ref="search"
84
+ v-model="searchValue"
82
85
  :class="`${carbonPrefix}--search-input`"
83
86
  type="text"
84
- :id="`searchbox-${uid}`"
85
87
  role="searchbox"
86
88
  :placeholder="searchPlaceholder"
87
89
  :aria-labelledby="`searchbox-${uid}`"
88
- ref="search"
89
- v-model="searchValue"
90
90
  @input="onInternalSearch"
91
91
  @click="checkSearchExpand(true)"
92
92
  @keydown.esc.prevent="checkSearchExpand(false)"
@@ -103,8 +103,8 @@
103
103
  ]"
104
104
  :title="searchClearLabel"
105
105
  :aria-label="searchClearLabel"
106
- @click="onClearClick"
107
106
  type="button"
107
+ @click="onClearClick"
108
108
  >
109
109
  <Close16 />
110
110
  </button>
@@ -141,11 +141,11 @@
141
141
  <button
142
142
  v-if="hasExpandAll"
143
143
  :class="`${carbonPrefix}--table-expand__button`"
144
- @click="toggleExpandAll"
145
144
  type="button"
146
145
  :aria-label="
147
146
  dataExpandAll ? collapseAllAriaLabel : expandAllAriaLabel
148
147
  "
148
+ @click="toggleExpandAll"
149
149
  >
150
150
  <ChevronRight16
151
151
  :class="`${carbonPrefix}--table-expand__svg`"
@@ -158,12 +158,12 @@
158
158
  :class="`${carbonPrefix}--table-column-checkbox`"
159
159
  >
160
160
  <cv-checkbox
161
+ v-model="headingChecked"
161
162
  :form-item="false"
162
163
  value="headingCheck"
163
- v-model="headingChecked"
164
- @change="onHeadingCheckChange"
165
164
  :label="selectAllAriaLabel"
166
- hideLabel
165
+ hide-label
166
+ @change="onHeadingCheckChange"
167
167
  />
168
168
  </th>
169
169
  <slot name="headings">
@@ -186,8 +186,8 @@
186
186
  <cv-data-table-row
187
187
  v-for="(row, rowIndex) in data"
188
188
  :key="`row:${rowIndex}`"
189
- :value="`${rowIndex}`"
190
189
  ref="dataRows"
190
+ :value="`${rowIndex}`"
191
191
  :overflow-menu="overflowMenu"
192
192
  >
193
193
  <cv-data-table-cell
@@ -212,12 +212,12 @@
212
212
  :number-of-items="internalNumberOfItems"
213
213
  @change="$emit('pagination', $event)"
214
214
  >
215
- <template v-slot:range-text="{ scope }">
216
- <slot name="range-text" v-bind:scope="scope" />
215
+ <template #range-text="{ scope }">
216
+ <slot name="range-text" :scope="scope" />
217
217
  </template>
218
218
 
219
- <template v-slot:of-n-pages="{ scope }">
220
- <slot name="of-n-pages" v-bind:scope="scope"></slot>
219
+ <template #of-n-pages="{ scope }">
220
+ <slot name="of-n-pages" :scope="scope"></slot>
221
221
  </template>
222
222
  </cv-pagination>
223
223
  </div>
@@ -316,7 +316,7 @@ const props = defineProps({
316
316
  * can be sorted
317
317
  */
318
318
  sortable: { type: Boolean, default: false },
319
- title: String,
319
+ title: { type: String, default: undefined },
320
320
  /**
321
321
  * An array containing a list of columns
322
322
  * - Columns can be string labels or objects
@@ -326,11 +326,11 @@ const props = defineProps({
326
326
  * - Optionally a dataStyle object to be applied to the data in the column.
327
327
  * - Optionally a sortable property - if any column sets this to true then only columns with sortable set to true are sortable. NOTE: table sortable property not required.
328
328
  */
329
- columns: Array,
329
+ columns: { type: Array, default: () => [] },
330
330
  /**
331
331
  * Two-dimensional array of strings.
332
332
  */
333
- data: Array,
333
+ data: { type: Array, default: () => [] },
334
334
  /**
335
335
  * the table striped
336
336
  */
@@ -351,7 +351,7 @@ const props = defineProps({
351
351
  * Use a width of 'auto' instead of 100%
352
352
  */
353
353
  staticWidth: { type: Boolean, default: false },
354
- onSearch: { type: Function },
354
+ onSearch: { type: Function, default: undefined },
355
355
  ...propsCvId,
356
356
  });
357
357
  const uid = useCvId(props, true);
@@ -554,7 +554,8 @@ const clearSearchVisible = ref(false);
554
554
  function onClearClick() {
555
555
  searchValue.value = '';
556
556
  clearSearchVisible.value = false;
557
- emit('search', searchValue.value);
557
+ // eslint-disable-next-line vue/require-explicit-emits
558
+ emit('search', searchValue.value); // see comment above in defineEmits
558
559
  nextTick(() => {
559
560
  search.value?.focus();
560
561
  });
@@ -608,22 +609,23 @@ function onMenuItemClick(val) {
608
609
  }
609
610
  function onInternalSearch() {
610
611
  clearSearchVisible.value = searchValue.value.length > 0;
612
+ // eslint-disable-next-line vue/require-explicit-emits
611
613
  emit('search', searchValue.value);
612
614
  }
613
615
  function onSort(payload) {
614
- const { heading, val } = payload;
616
+ const { heading, value } = payload;
615
617
  const headings = store.headings(uid);
616
618
  let index;
617
619
  for (let colIndex in headings) {
618
620
  const column = headings[colIndex];
619
621
  if (column.id === heading.id) {
620
- store.updateHeading(uid, { ...column, order: val });
622
+ store.updateHeading(uid, { ...column, order: value });
621
623
  index = colIndex;
622
624
  } else {
623
625
  store.updateHeading(uid, { ...column, order: 'none' });
624
626
  }
625
627
  }
626
- emit('sort', { index, order: val, name: heading.name });
628
+ emit('sort', { index, order: value, name: heading.name });
627
629
  }
628
630
 
629
631
  // are all rows expanded
@@ -1,13 +1,13 @@
1
1
  <template>
2
2
  <th
3
- :aria-sort="internalOrder"
4
- :style="skeleton && headingStyle"
5
3
  :id="cvId"
6
4
  ref="el"
5
+ :aria-sort="internalOrder"
6
+ :style="skeleton && headingStyle"
7
7
  >
8
8
  <button
9
- type="button"
10
9
  v-if="sortable"
10
+ type="button"
11
11
  :class="[
12
12
  `${carbonPrefix}--table-sort`,
13
13
  {
@@ -17,8 +17,8 @@
17
17
  internalOrder === 'ascending',
18
18
  },
19
19
  ]"
20
- @click="onSortClick"
21
20
  :style="headingStyle"
21
+ @click="onSortClick"
22
22
  >
23
23
  <component
24
24
  :is="headingLabelTag"
@@ -30,8 +30,8 @@
30
30
  <Arrows16 :class="`${carbonPrefix}--table-sort__icon-unsorted`" />
31
31
  </button>
32
32
  <component
33
- v-else
34
33
  :is="headingLabelTag"
34
+ v-else
35
35
  :class="`${carbonPrefix}--table-header-label`"
36
36
  :style="headingStyle"
37
37
  >
@@ -56,13 +56,13 @@ const nextOrder = {
56
56
  none: 'ascending',
57
57
  };
58
58
  const props = defineProps({
59
- dataStyle: Object,
60
- heading: String,
61
- name: String,
59
+ dataStyle: { type: Object, default: undefined },
60
+ heading: { type: String, default: undefined },
61
+ name: { type: String, default: undefined },
62
62
  sortable: Boolean,
63
63
  order: { type: String, default: 'none' },
64
64
  skeleton: Boolean,
65
- headingStyle: Object,
65
+ headingStyle: { type: Object, default: undefined },
66
66
  ...propsCvId,
67
67
  });
68
68
  const cvId = useCvId(props, true);
@@ -1,17 +1,17 @@
1
1
  <template>
2
2
  <tbody
3
3
  v-if="dataSomeExpandingRows"
4
- class="cv-data-table-row cv-data-table-row--expandable"
5
4
  :id="cvId"
5
+ class="cv-data-table-row cv-data-table-row--expandable"
6
6
  >
7
7
  <cv-data-table-row-inner
8
8
  ref="row"
9
- :rowId="cvId"
9
+ :row-id="cvId"
10
10
  v-bind="$attrs"
11
11
  :expanding-row="dataExpandable"
12
+ :expanded="dataExpanded"
12
13
  @expanded-change="onExpandedChange"
13
14
  @checked-change="onCheckedChange"
14
- :expanded="dataExpanded"
15
15
  >
16
16
  <slot />
17
17
  </cv-data-table-row-inner>
@@ -29,11 +29,11 @@
29
29
  </tbody>
30
30
  <cv-data-table-row-inner
31
31
  v-else
32
- ref="row"
33
32
  v-bind="$attrs"
34
- class="cv-data-table-row"
35
33
  :id="cvId"
36
- :rowId="cvId"
34
+ ref="row"
35
+ class="cv-data-table-row"
36
+ :row-id="cvId"
37
37
  @checked-change="onCheckedChange"
38
38
  >
39
39
  <slot />
@@ -1,14 +1,14 @@
1
1
  <template>
2
2
  <cv-data-table skeleton :data="data" :columns="cols" v-bind="$attrs">
3
- <template v-if="hasHelperText" v-slot:helper-text>
3
+ <template v-if="hasHelperText" #helper-text>
4
4
  <slot name="helper-text" />
5
5
  </template>
6
6
 
7
- <template v-if="hasBatchActions" v-slot:batch-actions>
7
+ <template v-if="hasBatchActions" #batch-actions>
8
8
  <slot name="batch-actions" />
9
9
  </template>
10
10
 
11
- <template v-if="hasActions" v-slot:actions>
11
+ <template v-if="hasActions" #actions>
12
12
  <slot name="actions" />
13
13
  </template>
14
14
  </cv-data-table>
@@ -15,9 +15,9 @@
15
15
  <button
16
16
  v-if="expandingRow"
17
17
  :class="`${carbonPrefix}--table-expand__button`"
18
- @click="toggleExpand"
19
18
  type="button"
20
19
  :aria-label="dataExpanded ? ariaLabelCollapseRow : ariaLabelExpandRow"
20
+ @click="toggleExpand"
21
21
  >
22
22
  <ChevronRight16 :class="`${carbonPrefix}--table-expand__svg`" />
23
23
  </button>
@@ -28,16 +28,16 @@
28
28
  :class="`${carbonPrefix}--table-column-checkbox`"
29
29
  >
30
30
  <cv-checkbox
31
+ ref="rowChecked"
32
+ v-model="dataChecked"
31
33
  :form-item="false"
32
34
  :value="value"
33
35
  :inline="true"
34
- v-model="dataChecked"
35
- @change="onChange"
36
- ref="rowChecked"
37
36
  :label="
38
37
  ariaLabelForBatchCheckbox || `Select row ${value} for batch action`
39
38
  "
40
- hideLabel
39
+ hide-label
40
+ @change="onChange"
41
41
  />
42
42
  </td>
43
43
  <slot />
@@ -71,15 +71,15 @@ import store from './cvDataTableStore';
71
71
  import { getBus } from '../../global/component-utils/event-bus';
72
72
 
73
73
  const props = defineProps({
74
- ariaLabelForBatchCheckbox: String,
74
+ ariaLabelForBatchCheckbox: { type: String, default: undefined },
75
75
  checked: Boolean,
76
76
  expanded: Boolean,
77
77
  expandingRow: Boolean,
78
78
  ariaLabelExpandRow: { type: String, default: 'Expand current row' },
79
79
  ariaLabelCollapseRow: { type: String, default: 'Collapse current row' },
80
- overflowMenu: Array,
81
- value: String,
82
- rowId: String,
80
+ overflowMenu: { type: Array, default: () => [] },
81
+ value: { type: String, default: undefined },
82
+ rowId: { type: String, default: undefined },
83
83
  });
84
84
 
85
85
  const dataSomeExpandingRows = computed(() => {
@@ -1,10 +1,12 @@
1
1
  <template>
2
2
  <cv-wrapper
3
+ :id="cvId"
3
4
  :tag-type="formItem ? 'div' : ''"
4
5
  :class="`cv-date-picker ${carbonPrefix}--form-item`"
5
- :id="cvId"
6
6
  >
7
7
  <div
8
+ :id="formItem ? undefined : cvId"
9
+ ref="dateWrapper"
8
10
  :data-date-picker="['single', 'range'].includes(getKind)"
9
11
  :data-date-picker-type="getKind"
10
12
  :class="[
@@ -15,8 +17,6 @@
15
17
  'cv-date-picker': !formItem,
16
18
  },
17
19
  ]"
18
- ref="dateWrapper"
19
- :id="formItem ? undefined : cvId"
20
20
  >
21
21
  <div
22
22
  :class="{
@@ -36,6 +36,7 @@
36
36
  </label>
37
37
  <div :class="`${carbonPrefix}--date-picker-input__wrapper`">
38
38
  <input
39
+ :id="`${cvId}-input-1`"
39
40
  ref="date"
40
41
  type="text"
41
42
  data-date-picker-input
@@ -43,7 +44,6 @@
43
44
  :data-invalid="isInvalid || null"
44
45
  :disabled="disabled"
45
46
  :data-date-picker-input-from="getKind === 'range'"
46
- :id="`${cvId}-input-1`"
47
47
  :class="`${carbonPrefix}--date-picker__input`"
48
48
  :pattern="pattern"
49
49
  :placeholder="placeholder"
@@ -57,7 +57,7 @@
57
57
  />
58
58
  </div>
59
59
 
60
- <div :class="`${carbonPrefix}--form-requirement`" v-if="isInvalid">
60
+ <div v-if="isInvalid" :class="`${carbonPrefix}--form-requirement`">
61
61
  <slot name="invalid-message">{{ invalidMessage }}</slot>
62
62
  </div>
63
63
  </div>
@@ -82,6 +82,7 @@
82
82
  @click="calendar.open()"
83
83
  >
84
84
  <input
85
+ :id="`${cvId}-input-2`"
85
86
  ref="todate"
86
87
  type="text"
87
88
  data-date-picker-input
@@ -89,7 +90,6 @@
89
90
  :data-date-picker-input-to="kind === 'range'"
90
91
  :data-invalid="isInvalid || null"
91
92
  :disabled="disabled"
92
- :id="`${cvId}-input-2`"
93
93
  :class="`${carbonPrefix}--date-picker__input`"
94
94
  :pattern="pattern"
95
95
  :placeholder="placeholder"
@@ -100,7 +100,7 @@
100
100
  data-date-picker-icon
101
101
  />
102
102
  </div>
103
- <div :class="`${carbonPrefix}--form-requirement`" v-if="isInvalid">
103
+ <div v-if="isInvalid" :class="`${carbonPrefix}--form-requirement`">
104
104
  <span id="invalid-message-placeholder"></span>
105
105
  </div>
106
106
  </div>
@@ -142,12 +142,12 @@ const isLight = useIsLight(props);
142
142
  let calendar;
143
143
 
144
144
  const props = defineProps({
145
- modelValue: [String, Object, Array, Date],
145
+ modelValue: { type: [String, Object, Array, Date], default: undefined },
146
146
  dateLabel: { type: String, default: undefined },
147
147
  dateEndLabel: { type: String, default: 'End date' },
148
148
  invalid: { type: Boolean, default: false },
149
149
  disabled: { type: Boolean, default: false },
150
- invalidMessage: { type: String },
150
+ invalidMessage: { type: String, default: undefined },
151
151
  pattern: { type: String, default: '\\d{1,2}/\\d{1,2}/\\d{4}' },
152
152
  placeholder: { type: String, default: 'mm/dd/yyyy' },
153
153
  calOptions: {
@@ -164,7 +164,7 @@ const props = defineProps({
164
164
  default: 'simple',
165
165
  validator: val => ['short', 'simple', 'single', 'range'].includes(val),
166
166
  },
167
- value: [String, Object, Array, Date],
167
+ value: { type: [String, Object, Array, Date], default: undefined },
168
168
  ...propsCvId,
169
169
  ...propsCvTheme,
170
170
  });
@@ -1,10 +1,12 @@
1
1
  <template>
2
2
  <cv-wrapper
3
+ :id="cvId"
3
4
  :tag-type="formItem ? 'div' : ''"
4
5
  :class="`cv-date-picker ${carbonPrefix}--form-item`"
5
- :id="cvId"
6
6
  >
7
7
  <div
8
+ :id="formItem ? undefined : cvId"
9
+ ref="dateWrapper"
8
10
  :data-date-picker="['single', 'range'].includes(getKind)"
9
11
  :data-date-picker-type="getKind"
10
12
  :class="[
@@ -14,8 +16,6 @@
14
16
  'cv-date-picker': !formItem,
15
17
  },
16
18
  ]"
17
- ref="dateWrapper"
18
- :id="formItem ? undefined : cvId"
19
19
  >
20
20
  <div
21
21
  class="inputWrapper"
@@ -59,7 +59,7 @@
59
59
  [`${carbonPrefix}--dropdown--inline`]: inline,
60
60
  },
61
61
  ]"
62
- :data-invalid="data.isInvalid"
62
+ :data-invalid="data.isInvalid || null"
63
63
  :data-value="dataValue"
64
64
  data-dropdown
65
65
  v-bind="$attrs"
@@ -115,12 +115,9 @@
115
115
  tabindex="-1"
116
116
  >
117
117
  <slot>
118
- <cv-dropdown-item
119
- v-for="item in items"
120
- v-bind:key="item"
121
- :value="item"
122
- >{{ item }}</cv-dropdown-item
123
- >
118
+ <cv-dropdown-item v-for="item in items" :key="item" :value="item">{{
119
+ item
120
+ }}</cv-dropdown-item>
124
121
  </slot>
125
122
  </ul>
126
123
  </div>
@@ -205,11 +202,12 @@ const props = defineProps({
205
202
  }
206
203
  return arr;
207
204
  },
205
+ default: () => [],
208
206
  },
209
207
  /**
210
208
  * Generic label that will be used as the textual representation of what this field is for
211
209
  */
212
- label: String,
210
+ label: { type: String, default: undefined },
213
211
  /**
214
212
  * Value shown when nothing has been selected
215
213
  */
@@ -233,7 +231,7 @@ const props = defineProps({
233
231
  /**
234
232
  * Render with a value already selected. Available as `v-model:value`.
235
233
  */
236
- value: String,
234
+ value: { type: String, default: undefined },
237
235
  /**
238
236
  * Provide the text that is displayed and put the control in warning state
239
237
  */
@@ -20,10 +20,10 @@
20
20
  role="menuitem"
21
21
  >
22
22
  <a
23
+ ref="link"
23
24
  :aria-checked="dataSelected"
24
25
  :class="`${carbonPrefix}--dropdown-link`"
25
26
  href="javascript:void(0)"
26
- ref="link"
27
27
  role="menuitemradio"
28
28
  tabindex="-1"
29
29
  >
@@ -48,7 +48,7 @@ const skeletonTemplate = `
48
48
  </div>
49
49
  `;
50
50
 
51
- export const args = {
51
+ export const argTypes = {
52
52
  // attributes
53
53
  multiple: {
54
54
  type: 'boolean',
@@ -61,6 +61,7 @@ export const args = {
61
61
  // props
62
62
  accept: {
63
63
  type: 'string',
64
+ defaultValue: '.jpg,.png',
64
65
  table: {
65
66
  type: { summary: 'string' },
66
67
  category: 'props',
@@ -106,6 +107,14 @@ export const args = {
106
107
  },
107
108
  description: 'Reset file list when files are added',
108
109
  },
110
+ disabled: {
111
+ type: 'boolean',
112
+ table: {
113
+ type: { summary: 'boolean' },
114
+ category: 'props',
115
+ },
116
+ description: 'Disables input',
117
+ },
109
118
  dropTargetLabel: {
110
119
  type: 'string',
111
120
  table: {
@@ -122,6 +131,14 @@ export const args = {
122
131
  },
123
132
  description: 'Helper text positioned below label',
124
133
  },
134
+ initialStateUploading: {
135
+ type: 'boolean',
136
+ table: {
137
+ type: { summary: 'boolean' },
138
+ category: 'props',
139
+ },
140
+ description: 'Set "UPLOADING" state to new files',
141
+ },
125
142
  kind: {
126
143
  type: 'string',
127
144
  control: 'select',
@@ -235,7 +252,7 @@ Migration notes:
235
252
  helperText: 'Select the files you want to upload',
236
253
  removable: true,
237
254
  }}
238
- argTypes={args}
255
+ argTypes={argTypes}
239
256
  >
240
257
  {Template.bind({})}
241
258
  </Story>
@@ -263,11 +280,12 @@ Migration notes:
263
280
  helperText: 'Select the files you want to upload',
264
281
  kind: KINDS.BUTTON,
265
282
  removable: true,
283
+ dropTargetLabel: 'Add file',
266
284
  }}
267
285
  argTypes={{
268
- ...args,
286
+ ...argTypes,
269
287
  kind: {
270
- ...args.kind,
288
+ ...argTypes.kind,
271
289
  control: 'none',
272
290
  },
273
291
  }}
@@ -299,9 +317,9 @@ Migration notes:
299
317
  removable: true,
300
318
  }}
301
319
  argTypes={{
302
- ...args,
320
+ ...argTypes,
303
321
  kind: {
304
- ...args.kind,
322
+ ...argTypes.kind,
305
323
  control: 'none',
306
324
  },
307
325
  }}