@carbon/vue 3.0.9 → 3.0.11
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.
- package/README.md +1 -1
- package/dist/carbon-vue-3.common.js +19642 -19310
- package/dist/carbon-vue-3.common.js.map +1 -1
- package/dist/carbon-vue-3.css +1 -1
- package/dist/carbon-vue-3.umd.js +19721 -19389
- package/dist/carbon-vue-3.umd.js.map +1 -1
- package/dist/carbon-vue-3.umd.min.js +3 -3
- package/dist/carbon-vue-3.umd.min.js.map +1 -1
- package/package.json +11 -43
- package/src/components/CvAccordion/CvAccordionItem.vue +1 -1
- package/src/components/CvButton/CvButton.stories.js +1 -1
- package/src/components/CvButton/CvButton.vue +2 -2
- package/src/components/CvButton/CvIconButton.stories.js +14 -17
- package/src/components/CvButton/CvIconButton.vue +8 -7
- package/src/components/CvCheckbox/CvCheckbox.vue +4 -3
- package/src/components/CvCodeSnippet/CvCodeSnippet.vue +5 -5
- package/src/components/CvCodeSnippet/_CviCodeSnippetInline.vue +2 -2
- package/src/components/CvCodeSnippet/_CviCodeSnippetMultiline.vue +6 -6
- package/src/components/CvCodeSnippet/_CviCodeSnippetOneline.vue +3 -3
- package/src/components/CvComboBox/CvComboBox.vue +9 -9
- package/src/components/CvContentSwitcher/CvContentSwitcher.vue +1 -1
- package/src/components/CvContentSwitcher/CvContentSwitcherButton.vue +1 -1
- package/src/components/CvCopyButton/CvCopyButton.vue +1 -1
- package/src/components/CvCopyButton/_CviCopyButton.vue +2 -2
- package/src/components/CvDataTable/CvDataTable.vue +29 -27
- package/src/components/CvDataTable/CvDataTableHeading.vue +9 -9
- package/src/components/CvDataTable/CvDataTableRow.vue +6 -6
- package/src/components/CvDataTable/CvDataTableSkeleton.vue +3 -3
- package/src/components/CvDataTable/_CvDataTableRowInner.vue +9 -9
- package/src/components/CvDatePicker/CvDatePicker.vue +10 -10
- package/src/components/CvDatePicker/CvDatePickerSkeleton.vue +3 -3
- package/src/components/CvDropdown/CvDropdown.stories.mdx +7 -66
- package/src/components/CvDropdown/CvDropdown.vue +13 -26
- package/src/components/CvDropdown/CvDropdownItem.vue +2 -2
- package/src/components/CvFileUploader/CvFileUploader.stories.mdx +79 -14
- package/src/components/CvFileUploader/CvFileUploader.vue +7 -7
- package/src/components/CvFileUploader/CvFileUploaderItem.vue +9 -8
- package/src/components/CvForm/CvFormGroup.vue +2 -2
- package/src/components/CvGrid/CvColumn.vue +5 -0
- package/src/components/CvLink/CvLink.vue +7 -2
- package/src/components/CvLoading/CvLoading.stories.js +1 -1
- package/src/components/CvLoading/CvLoading.vue +2 -2
- package/src/components/CvModal/CvModal.vue +19 -19
- package/src/components/CvMultiSelect/CvMultiSelect.stories.mdx +8 -18
- package/src/components/CvMultiSelect/CvMultiSelect.vue +17 -22
- package/src/components/CvNotification/CvToastNotification.stories.js +12 -15
- package/src/components/CvNotification/CvToastNotification.vue +1 -1
- package/src/components/CvNumberInput/CvNumberInput.vue +3 -6
- package/src/components/CvOverflowMenu/CvOverflowMenu.vue +11 -10
- package/src/components/CvOverflowMenu/CvOverflowMenuItem.vue +1 -1
- package/src/components/CvPagination/CvPagination.vue +11 -15
- package/src/components/CvProgress/CvProgress.stories.mdx +23 -1
- package/src/components/CvProgress/CvProgress.vue +1 -1
- package/src/components/CvProgress/CvProgressSkeleton.vue +37 -0
- package/src/components/CvProgress/CvProgressStep.vue +6 -6
- package/src/components/CvProgress/index.js +3 -1
- package/src/components/CvRadioButton/CvRadioButton.vue +3 -3
- package/src/components/CvSearch/CvSearch.stories.mdx +4 -13
- package/src/components/CvSearch/CvSearch.vue +17 -28
- package/src/components/CvSelect/CvSelect.vue +1 -1
- package/src/components/CvSlider/CvSlider.vue +7 -7
- package/src/components/CvSlider/__tests__/__snapshots__/CvSlider.spec.js.snap +1 -1
- package/src/components/CvStructuredList/CvStructuredListItem.vue +3 -3
- package/src/components/CvStructuredList/CvStructuredListItemSelectable.vue +1 -1
- package/src/components/CvStructuredList/__tests__/__snapshots__/CvStructuredListItem.spec.js.snap +3 -3
- package/src/components/CvSvg/__tests__/_TestIcon.vue +2 -2
- package/src/components/CvTabs/CvTab.vue +1 -1
- package/src/components/CvTabs/CvTabs.vue +13 -13
- package/src/components/CvTabs/__tests__/__snapshots__/CvTabs.spec.js.snap +6 -6
- package/src/components/CvTag/CvTag.stories.js +1 -1
- package/src/components/CvTag/CvTag.vue +1 -1
- package/src/components/CvTextArea/CvTextArea.vue +6 -6
- package/src/components/CvTextInput/CvTextInput.stories.js +28 -16
- package/src/components/CvTextInput/CvTextInput.vue +37 -7
- package/src/components/CvTextInput/CvTextInputSkeleton.vue +17 -0
- package/src/components/CvTextInput/index.js +2 -1
- package/src/components/CvTile/CvTile.vue +3 -3
- package/src/components/CvTile/CvTileExpandable.vue +7 -7
- package/src/components/CvTile/CvTileSelectable.vue +2 -2
- package/src/components/CvTimePicker/CvTimePicker.vue +1 -1
- package/src/components/CvTooltip/CvDefinitionTooltip.vue +2 -2
- package/src/components/CvTooltip/CvInteractiveTooltip.vue +7 -7
- package/src/components/CvTooltip/__tests__/__snapshots__/CvTooltip.spec.js.snap +14 -14
- package/src/components/CvUIShell/CvHeader.vue +1 -1
- package/src/components/CvUIShell/CvHeaderGlobalAction.vue +7 -7
- package/src/components/CvUIShell/CvHeaderMenu.vue +3 -3
- package/src/components/CvUIShell/CvHeaderMenuButton.vue +2 -2
- package/src/components/CvUIShell/CvHeaderMenuItem.vue +2 -2
- package/src/components/CvUIShell/CvHeaderName.vue +1 -1
- package/src/components/CvUIShell/CvHeaderNav.vue +1 -1
- package/src/components/CvUIShell/CvHeaderPanel.vue +3 -2
- package/src/components/CvUIShell/CvSideNav.vue +5 -4
- package/src/components/CvUIShell/CvSideNavItems.vue +1 -1
- package/src/components/CvUIShell/CvSideNavLink.vue +1 -1
- package/src/components/CvUIShell/_CvSideNavFooter.vue +2 -1
|
@@ -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"
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
<button
|
|
74
74
|
ref="button"
|
|
75
75
|
:aria-controls="`${uid}-menu`"
|
|
76
|
-
:aria-disabled="disabled"
|
|
76
|
+
:aria-disabled="disabled || null"
|
|
77
77
|
:aria-expanded="open ? 'true' : 'false'"
|
|
78
78
|
:aria-labelledby="ariaLabeledBy"
|
|
79
79
|
:class="`${carbonPrefix}--list-box__field`"
|
|
@@ -115,12 +115,9 @@
|
|
|
115
115
|
tabindex="-1"
|
|
116
116
|
>
|
|
117
117
|
<slot>
|
|
118
|
-
<cv-dropdown-item
|
|
119
|
-
|
|
120
|
-
|
|
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>
|
|
@@ -132,7 +129,7 @@
|
|
|
132
129
|
</div>
|
|
133
130
|
<div
|
|
134
131
|
v-else-if="data.isHelper"
|
|
135
|
-
:aria-disabled="disabled"
|
|
132
|
+
:aria-disabled="disabled || null"
|
|
136
133
|
:class="[
|
|
137
134
|
`${carbonPrefix}--form__helper-text`,
|
|
138
135
|
{ [`${carbonPrefix}--form__helper-text--disabled`]: disabled },
|
|
@@ -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
|
*/
|
|
@@ -230,25 +228,15 @@ const props = defineProps({
|
|
|
230
228
|
* Specify the direction of the dropdown. Can be either true (top) or (false) bottom.
|
|
231
229
|
*/
|
|
232
230
|
up: { type: Boolean, default: false },
|
|
233
|
-
/**
|
|
234
|
-
* Render with a value already selected. Available as `v-model:value`.
|
|
235
|
-
*/
|
|
236
|
-
value: String,
|
|
237
231
|
/**
|
|
238
232
|
* Provide the text that is displayed and put the control in warning state
|
|
239
233
|
*/
|
|
240
234
|
warningMessage: { type: String, default: undefined },
|
|
241
235
|
/**
|
|
242
|
-
*
|
|
236
|
+
* Render with a value already selected. Available as `v-model`.
|
|
243
237
|
*/
|
|
244
238
|
modelValue: {
|
|
245
239
|
type: String,
|
|
246
|
-
validator: val => {
|
|
247
|
-
console.warn(
|
|
248
|
-
`v-model for cv-dropdown is deprecated. Specify "v-model:value" instead [${val}]`
|
|
249
|
-
);
|
|
250
|
-
return true;
|
|
251
|
-
},
|
|
252
240
|
default: undefined,
|
|
253
241
|
},
|
|
254
242
|
|
|
@@ -257,7 +245,7 @@ const props = defineProps({
|
|
|
257
245
|
});
|
|
258
246
|
const uid = useCvId(props, true);
|
|
259
247
|
const isLight = useIsLight(props);
|
|
260
|
-
const dataValue = ref(props.
|
|
248
|
+
const dataValue = ref(props.modelValue);
|
|
261
249
|
provide('dropdown-selected', dataValue);
|
|
262
250
|
const focusItem = ref(undefined);
|
|
263
251
|
provide('dropdown-focus', focusItem);
|
|
@@ -289,16 +277,15 @@ const isWarning = computed(() => {
|
|
|
289
277
|
});
|
|
290
278
|
onMounted(checkSlots);
|
|
291
279
|
onUpdated(checkSlots);
|
|
292
|
-
const emit = defineEmits(['update:
|
|
280
|
+
const emit = defineEmits(['update:modelValue', 'change']);
|
|
293
281
|
watch(
|
|
294
|
-
() => props.
|
|
282
|
+
() => props.modelValue,
|
|
295
283
|
() => {
|
|
296
|
-
dataValue.value = props.
|
|
284
|
+
dataValue.value = props.modelValue;
|
|
297
285
|
}
|
|
298
286
|
);
|
|
299
287
|
watch(dataValue, () => {
|
|
300
288
|
emit('change', dataValue.value);
|
|
301
|
-
emit('update:value', dataValue.value);
|
|
302
289
|
emit('update:modelValue', dataValue.value);
|
|
303
290
|
});
|
|
304
291
|
watch(open, () => {
|
|
@@ -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: '
|
|
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: '
|
|
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
|
-
|
|
199
|
-
control: '
|
|
260
|
+
setInvalidMessage: {
|
|
261
|
+
control: 'text',
|
|
200
262
|
type: 'function',
|
|
201
263
|
table: {
|
|
202
|
-
type: { summary: '(index: number,
|
|
264
|
+
type: { summary: '(index: number, invalidMessage: string) => void' },
|
|
203
265
|
category: 'exposed methods',
|
|
204
266
|
},
|
|
205
|
-
description: 'Update the "
|
|
267
|
+
description: 'Update the "invalidMessage" field of a file.',
|
|
206
268
|
},
|
|
207
|
-
|
|
208
|
-
control: '
|
|
269
|
+
setState: {
|
|
270
|
+
control: 'select',
|
|
271
|
+
options: Object.keys(setStateOptionMap),
|
|
209
272
|
type: 'function',
|
|
210
273
|
table: {
|
|
211
|
-
type: { summary: '(index: number,
|
|
274
|
+
type: { summary: '(index: number, state: string) => void' },
|
|
212
275
|
category: 'exposed methods',
|
|
213
276
|
},
|
|
214
|
-
description: 'Update the "
|
|
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>
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
:key="item.file.name"
|
|
90
90
|
:item="item"
|
|
91
91
|
:removable="removable"
|
|
92
|
-
:
|
|
92
|
+
:remove-aria-label="removeAriaLabel"
|
|
93
93
|
@remove="onItemRemove(index)"
|
|
94
94
|
/>
|
|
95
95
|
</div>
|
|
@@ -111,7 +111,7 @@ import {
|
|
|
111
111
|
const emit = defineEmits(['update:modelValue']);
|
|
112
112
|
|
|
113
113
|
const props = defineProps({
|
|
114
|
-
accept: String,
|
|
114
|
+
accept: { type: String, default: undefined },
|
|
115
115
|
buttonKind: commonCvButtonProps.kind,
|
|
116
116
|
buttonLabel: {
|
|
117
117
|
type: String,
|
|
@@ -129,8 +129,8 @@ const props = defineProps({
|
|
|
129
129
|
buttonSize: commonCvButtonProps.size,
|
|
130
130
|
clearOnReselect: Boolean,
|
|
131
131
|
disabled: Boolean,
|
|
132
|
-
dropTargetLabel: String,
|
|
133
|
-
helperText: String,
|
|
132
|
+
dropTargetLabel: { type: String, default: undefined },
|
|
133
|
+
helperText: { type: String, default: undefined },
|
|
134
134
|
initialStateUploading: Boolean,
|
|
135
135
|
kind: {
|
|
136
136
|
type: String,
|
|
@@ -145,10 +145,10 @@ const props = defineProps({
|
|
|
145
145
|
return true;
|
|
146
146
|
},
|
|
147
147
|
},
|
|
148
|
-
label: String,
|
|
149
|
-
modelValue: Array,
|
|
148
|
+
label: { type: String, default: undefined },
|
|
149
|
+
modelValue: { type: Array, default: () => [] },
|
|
150
150
|
removable: Boolean,
|
|
151
|
-
removeAriaLabel: String,
|
|
151
|
+
removeAriaLabel: { type: String, default: undefined },
|
|
152
152
|
...cvIdProps,
|
|
153
153
|
});
|
|
154
154
|
|
|
@@ -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
|
-
|
|
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"
|
|
@@ -80,7 +81,7 @@ import Close16 from '@carbon/icons-vue/es/close/16';
|
|
|
80
81
|
const emit = defineEmits(['remove']);
|
|
81
82
|
|
|
82
83
|
const props = defineProps({
|
|
83
|
-
item: Object,
|
|
84
|
+
item: { type: Object, default: () => Object() },
|
|
84
85
|
removable: Boolean,
|
|
85
86
|
removeAriaLabel: { type: String, default: 'Remove selected file' },
|
|
86
87
|
});
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
`cv-form-group ${carbonPrefix}--fieldset`,
|
|
5
5
|
{ [`${carbonPrefix}--fieldset--no-margin`]: noMargin },
|
|
6
6
|
]"
|
|
7
|
-
:data-invalid="invalid"
|
|
7
|
+
:data-invalid="invalid || null"
|
|
8
8
|
>
|
|
9
9
|
<legend :class="`${carbonPrefix}--label`">
|
|
10
10
|
<slot name="label"></slot>
|
|
@@ -21,7 +21,7 @@ import { carbonPrefix } from '../../global/settings';
|
|
|
21
21
|
|
|
22
22
|
defineProps({
|
|
23
23
|
invalid: Boolean,
|
|
24
|
-
message: String,
|
|
24
|
+
message: { type: String, default: undefined },
|
|
25
25
|
noMargin: Boolean,
|
|
26
26
|
});
|
|
27
27
|
</script>
|
|
@@ -13,22 +13,27 @@ const props = defineProps({
|
|
|
13
13
|
sm: {
|
|
14
14
|
type: [Boolean, Number, Object],
|
|
15
15
|
validator: value => columnValidator('sm', value),
|
|
16
|
+
default: false,
|
|
16
17
|
},
|
|
17
18
|
md: {
|
|
18
19
|
type: [Boolean, Number, Object],
|
|
19
20
|
validator: value => columnValidator('md', value),
|
|
21
|
+
default: false,
|
|
20
22
|
},
|
|
21
23
|
lg: {
|
|
22
24
|
type: [Boolean, Number, Object],
|
|
23
25
|
validator: value => columnValidator('lg', value),
|
|
26
|
+
default: false,
|
|
24
27
|
},
|
|
25
28
|
xlg: {
|
|
26
29
|
type: [Boolean, Number, Object],
|
|
27
30
|
validator: value => columnValidator('xlg', value),
|
|
31
|
+
default: false,
|
|
28
32
|
},
|
|
29
33
|
max: {
|
|
30
34
|
type: [Boolean, Number, Object],
|
|
31
35
|
validator: value => columnValidator('max', value),
|
|
36
|
+
default: false,
|
|
32
37
|
},
|
|
33
38
|
});
|
|
34
39
|
const classes = computed(() => {
|
|
@@ -14,7 +14,12 @@
|
|
|
14
14
|
]"
|
|
15
15
|
>
|
|
16
16
|
<slot></slot>
|
|
17
|
-
<CvSvg
|
|
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
|
|
|
@@ -28,7 +33,7 @@ import {
|
|
|
28
33
|
} from '../../use/cvLink';
|
|
29
34
|
|
|
30
35
|
const props = defineProps({
|
|
31
|
-
icon: { type: [String, Object] },
|
|
36
|
+
icon: { type: [String, Object], default: undefined },
|
|
32
37
|
inline: Boolean,
|
|
33
38
|
visited: Boolean,
|
|
34
39
|
...linkPropsDefinition,
|
|
@@ -26,7 +26,7 @@ export default {
|
|
|
26
26
|
const template = `<div>
|
|
27
27
|
<div class="loading-story">
|
|
28
28
|
<cv-loading @loading-end="onLoadingEnd" v-bind="args" :active="isActive"/>
|
|
29
|
-
</
|
|
29
|
+
</div>
|
|
30
30
|
<button @click="makeActive" :disabled="isActive" style="margin-top: 2rem;">{{buttonLabel}}</button>
|
|
31
31
|
</div>`;
|
|
32
32
|
let hidden = ref(true);
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
>
|
|
7
7
|
<div
|
|
8
8
|
v-bind="$attrs"
|
|
9
|
+
ref="loading"
|
|
9
10
|
data-loading
|
|
10
11
|
:class="{
|
|
11
12
|
'cv-loading': !overlay,
|
|
@@ -13,12 +14,11 @@
|
|
|
13
14
|
[`${carbonPrefix}--loading--stop`]: (!active && stopping) || stopped,
|
|
14
15
|
[`${carbonPrefix}--loading--small`]: small,
|
|
15
16
|
}"
|
|
16
|
-
ref="loading"
|
|
17
17
|
aria-atomic="true"
|
|
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 }}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Teleport to="body" :disabled="disableTeleport">
|
|
3
3
|
<div
|
|
4
|
+
:id="uid"
|
|
4
5
|
ref="el"
|
|
5
6
|
data-modal
|
|
6
|
-
:id="uid"
|
|
7
7
|
:class="[
|
|
8
8
|
`cv-modal ${carbonPrefix}--modal`,
|
|
9
9
|
{
|
|
@@ -12,24 +12,24 @@
|
|
|
12
12
|
},
|
|
13
13
|
]"
|
|
14
14
|
tabindex="-1"
|
|
15
|
+
v-bind="$attrs"
|
|
15
16
|
@keydown.esc.prevent="onEsc"
|
|
16
17
|
@click.self="onExternalClick"
|
|
17
|
-
v-bind="$attrs"
|
|
18
18
|
>
|
|
19
19
|
<div
|
|
20
|
+
v-bind="dialogAttrs"
|
|
21
|
+
ref="modalDialog"
|
|
20
22
|
:class="[
|
|
21
23
|
`${carbonPrefix}--modal-container`,
|
|
22
24
|
{
|
|
23
25
|
[`${carbonPrefix}--modal-container--${internalSize}`]: internalSize,
|
|
24
26
|
},
|
|
25
27
|
]"
|
|
26
|
-
v-bind="dialogAttrs"
|
|
27
28
|
:aria-label="ariaLabel"
|
|
28
|
-
ref="modalDialog"
|
|
29
29
|
>
|
|
30
30
|
<div
|
|
31
|
-
class="cv-modal__before-content"
|
|
32
31
|
ref="beforeContent"
|
|
32
|
+
class="cv-modal__before-content"
|
|
33
33
|
tabindex="0"
|
|
34
34
|
style="position: absolute; height: 1px; width: 1px; left: -9999px"
|
|
35
35
|
role="separator"
|
|
@@ -44,28 +44,29 @@
|
|
|
44
44
|
<slot name="title">Modal Title</slot>
|
|
45
45
|
</p>
|
|
46
46
|
<button
|
|
47
|
+
ref="closeBtn"
|
|
47
48
|
:class="`${carbonPrefix}--modal-close`"
|
|
48
49
|
type="button"
|
|
49
|
-
@click="onClose"
|
|
50
|
-
ref="closeBtn"
|
|
51
50
|
:aria-label="closeAriaLabel"
|
|
51
|
+
@click="onClose"
|
|
52
52
|
>
|
|
53
53
|
<Close16 :class="`${carbonPrefix}--modal-close__icon`" />
|
|
54
54
|
</button>
|
|
55
55
|
</div>
|
|
56
56
|
|
|
57
57
|
<div
|
|
58
|
+
ref="content"
|
|
58
59
|
:class="[
|
|
59
60
|
`${carbonPrefix}--modal-content`,
|
|
60
61
|
{ [`${carbonPrefix}--modal-content--with-form`]: hasFormContent },
|
|
61
62
|
]"
|
|
62
|
-
ref="content"
|
|
63
63
|
:tabindex="data.scrollable ? 0 : undefined"
|
|
64
64
|
>
|
|
65
65
|
<slot name="content"></slot>
|
|
66
66
|
</div>
|
|
67
67
|
|
|
68
68
|
<cv-button-set
|
|
69
|
+
v-if="data.hasFooter"
|
|
69
70
|
:class="[
|
|
70
71
|
`${carbonPrefix}--modal-footer`,
|
|
71
72
|
{
|
|
@@ -73,40 +74,39 @@
|
|
|
73
74
|
data.hasPrimary && data.hasSecondary && data.hasOtherBtn,
|
|
74
75
|
},
|
|
75
76
|
]"
|
|
76
|
-
v-if="data.hasFooter"
|
|
77
77
|
>
|
|
78
78
|
<cv-button
|
|
79
|
+
v-if="data.hasOtherBtn"
|
|
80
|
+
ref="otherBtn"
|
|
79
81
|
type="button"
|
|
80
82
|
kind="secondary"
|
|
81
83
|
@click="onOtherBtnClick"
|
|
82
|
-
v-if="data.hasOtherBtn"
|
|
83
|
-
ref="otherBtn"
|
|
84
84
|
>
|
|
85
85
|
<slot name="other-button">Other button</slot>
|
|
86
86
|
</cv-button>
|
|
87
87
|
<cv-button
|
|
88
|
+
v-if="data.hasSecondary"
|
|
89
|
+
ref="secondaryBtn"
|
|
88
90
|
type="button"
|
|
89
91
|
kind="secondary"
|
|
90
92
|
@click="onSecondaryClick"
|
|
91
|
-
v-if="data.hasSecondary"
|
|
92
|
-
ref="secondaryBtn"
|
|
93
93
|
>
|
|
94
94
|
<slot name="secondary-button">Secondary button</slot>
|
|
95
95
|
</cv-button>
|
|
96
96
|
<cv-button
|
|
97
|
+
v-if="data.hasPrimary"
|
|
98
|
+
ref="primary"
|
|
97
99
|
:disabled="primaryButtonDisabled"
|
|
98
100
|
type="button"
|
|
99
101
|
:kind="primaryKind"
|
|
100
102
|
@click="onPrimaryClick"
|
|
101
|
-
v-if="data.hasPrimary"
|
|
102
|
-
ref="primary"
|
|
103
103
|
>
|
|
104
104
|
<slot name="primary-button">Primary button</slot>
|
|
105
105
|
</cv-button>
|
|
106
106
|
</cv-button-set>
|
|
107
107
|
<div
|
|
108
|
-
class="cv-modal__after-content"
|
|
109
108
|
ref="afterContent"
|
|
109
|
+
class="cv-modal__after-content"
|
|
110
110
|
tabindex="0"
|
|
111
111
|
style="position: absolute; height: 1px; width: 1px; left: -9999px"
|
|
112
112
|
role="separator"
|
|
@@ -201,9 +201,9 @@ const props = defineProps({
|
|
|
201
201
|
disableTeleport: { type: Boolean, default: false },
|
|
202
202
|
|
|
203
203
|
// Listeners
|
|
204
|
-
onPrimaryClick: { type: Function },
|
|
205
|
-
onSecondaryClick: { type: Function },
|
|
206
|
-
onOtherBtnClick: { type: Function },
|
|
204
|
+
onPrimaryClick: { type: Function, default: undefined },
|
|
205
|
+
onSecondaryClick: { type: Function, default: undefined },
|
|
206
|
+
onOtherBtnClick: { type: Function, default: undefined },
|
|
207
207
|
|
|
208
208
|
...propsCvId,
|
|
209
209
|
});
|