@carbon/vue 3.0.5-alpha.0 → 3.0.7-alpha.0
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 +16 -0
- package/dist/carbon-vue-3.common.js +22859 -11008
- package/dist/carbon-vue-3.common.js.map +1 -1
- package/dist/carbon-vue-3.css +1 -0
- package/dist/carbon-vue-3.umd.js +22859 -11008
- package/dist/carbon-vue-3.umd.js.map +1 -1
- package/dist/carbon-vue-3.umd.min.js +30 -2
- package/dist/carbon-vue-3.umd.min.js.map +1 -1
- package/package.json +5 -4
- package/src/components/CvAccordion/CvAccordion.stories.js +1 -0
- package/src/components/CvButton/CvButton.stories.js +3 -3
- package/src/components/CvButton/CvButtonSkeleton.stories.js +79 -0
- package/src/components/CvButton/CvButtonSkeleton.vue +19 -0
- package/src/components/CvButton/index.js +8 -1
- package/src/components/CvDatePicker/CvDatePicker-notes.md +86 -0
- package/src/components/CvDatePicker/CvDatePicker.stories.js +241 -0
- package/src/components/CvDatePicker/CvDatePicker.vue +402 -0
- package/src/components/CvDatePicker/CvDatePickerSkeleton.vue +106 -0
- package/src/components/CvDatePicker/index.js +4 -0
- package/src/components/CvDatePicker/plugins/appendToPlugin.js +64 -0
- package/src/components/CvDatePicker/plugins/fixEventsPlugin.js +79 -0
- package/src/components/CvDatePicker/plugins/monthSelectPlugin.js +86 -0
- package/src/components/CvDatePicker/plugins/rangePlugin.js +47 -0
- package/src/components/CvDropdown/CvDropdown.stories.mdx +407 -0
- package/src/components/CvDropdown/CvDropdown.vue +418 -0
- package/src/components/CvDropdown/CvDropdownItem.vue +86 -0
- package/src/components/CvDropdown/CvDropdownSkeleton.vue +17 -0
- package/src/components/CvDropdown/index.js +5 -0
- package/src/components/CvForm/CvForm.stories.mdx +193 -0
- package/src/components/CvForm/CvForm.vue +9 -0
- package/src/components/CvForm/CvFormGroup.vue +27 -0
- package/src/components/CvForm/CvFormItem.vue +9 -0
- package/src/components/CvForm/index.js +5 -0
- package/src/components/CvInlineLoading/CvInlineLoading.stories.mdx +87 -0
- package/src/components/CvInlineLoading/CvInlineLoading.vue +144 -0
- package/src/components/CvInlineLoading/consts.js +9 -0
- package/src/components/CvInlineLoading/index.js +4 -0
- package/src/components/CvModal/CvModal.stories.mdx +236 -0
- package/src/components/CvModal/CvModal.vue +401 -0
- package/src/components/CvModal/index.js +3 -0
- package/src/components/CvMultiSelect/CvMultiSelect.stories.mdx +333 -0
- package/src/components/CvMultiSelect/CvMultiSelect.vue +705 -0
- package/src/components/CvMultiSelect/consts.js +16 -0
- package/src/components/CvMultiSelect/index.js +3 -0
- package/src/components/CvNumberInput/CvNumberInput.stories.js +265 -0
- package/src/components/CvNumberInput/CvNumberInput.vue +227 -0
- package/src/components/CvNumberInput/CvNumberInputSkeleton.stories.js +30 -0
- package/src/components/CvNumberInput/CvNumberInputSkeleton.vue +10 -0
- package/src/components/CvNumberInput/StorybookGroupConst.js +1 -0
- package/src/components/CvNumberInput/__tests__/__snapshots__/CvNumberInput.spec.js.snap +21 -0
- package/src/components/CvNumberInput/index.js +5 -0
- package/src/components/CvTabs/CvTab.vue +77 -0
- package/src/components/CvTabs/CvTabs.stories.mdx +175 -0
- package/src/components/CvTabs/CvTabs.vue +406 -0
- package/src/components/CvTabs/CvTabsSkeleton.vue +24 -0
- package/src/components/CvTabs/_SbContainer.vue +22 -0
- package/src/components/CvTabs/index.js +5 -0
- package/src/components/CvToggle/CvToggle-Skeleton.vue +29 -0
- package/src/components/CvToggle/CvToggle.stories.js +232 -0
- package/src/components/CvToggle/CvToggle.vue +70 -0
- package/src/components/CvToggle/__tests__/__snapshots__/CvToggle.spec.js.snap +7 -0
- package/src/components/CvToggle/index.js +4 -0
- package/src/global/storybook-utils/story-source-code.js +1 -0
- package/src/use/cvInput.js +34 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* COPIED FROM carbon-components-react
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {number} monthNumber The month number.
|
|
7
|
+
* @param {boolean} shorthand `true` to use shorthand month.
|
|
8
|
+
* @param {Locale} locale The Flatpickr locale data.
|
|
9
|
+
* @returns {string} The month string.
|
|
10
|
+
*/
|
|
11
|
+
const monthToStr = (monthNumber, shorthand, locale) =>
|
|
12
|
+
locale.months[shorthand ? 'shorthand' : 'longhand'][monthNumber];
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param {object} config Plugin configuration.
|
|
16
|
+
* @param {boolean} [config.shorthand] `true` to use shorthand month.
|
|
17
|
+
* @param {string} config.selectorFlatpickrMonthYearContainer The CSS selector for the container of month/year selection UI.
|
|
18
|
+
* @param {string} config.selectorFlatpickrYearContainer The CSS selector for the container of year selection UI.
|
|
19
|
+
* @param {string} config.selectorFlatpickrCurrentMonth The CSS selector for the text-based month selection UI.
|
|
20
|
+
* @param {string} config.classFlatpickrCurrentMonth The CSS class for the text-based month selection UI.
|
|
21
|
+
* @returns {Plugin} A Flatpickr plugin to use text instead of `<select>` for month picker.
|
|
22
|
+
*/
|
|
23
|
+
export default config => fp => {
|
|
24
|
+
const setupElements = () => {
|
|
25
|
+
if (!fp.monthElements || fp.monthElements.length < 1) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
fp.monthElements.forEach(elem => {
|
|
29
|
+
if (!elem.parentNode) return;
|
|
30
|
+
elem.parentNode.removeChild(elem);
|
|
31
|
+
});
|
|
32
|
+
fp.monthElements.splice(
|
|
33
|
+
0,
|
|
34
|
+
fp.monthElements.length,
|
|
35
|
+
...fp.monthElements.map(() => {
|
|
36
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
37
|
+
const monthElement = fp._createElement(
|
|
38
|
+
'span',
|
|
39
|
+
config.classFlatpickrCurrentMonth
|
|
40
|
+
);
|
|
41
|
+
monthElement.textContent = monthToStr(
|
|
42
|
+
fp.currentMonth,
|
|
43
|
+
config.shorthand === true,
|
|
44
|
+
fp.l10n
|
|
45
|
+
);
|
|
46
|
+
fp.yearElements[0]
|
|
47
|
+
.closest(config.selectorFlatpickrMonthYearContainer)
|
|
48
|
+
.insertBefore(
|
|
49
|
+
monthElement,
|
|
50
|
+
fp.yearElements[0].closest(config.selectorFlatpickrYearContainer)
|
|
51
|
+
);
|
|
52
|
+
return monthElement;
|
|
53
|
+
})
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const updateCurrentMonth = () => {
|
|
58
|
+
const monthStr = monthToStr(
|
|
59
|
+
fp.currentMonth,
|
|
60
|
+
config.shorthand === true,
|
|
61
|
+
fp.l10n
|
|
62
|
+
);
|
|
63
|
+
fp.yearElements.forEach(elem => {
|
|
64
|
+
const currentMonthContainer = elem.closest(
|
|
65
|
+
config.selectorFlatpickrMonthYearContainer
|
|
66
|
+
);
|
|
67
|
+
Array.prototype.forEach.call(
|
|
68
|
+
currentMonthContainer.querySelectorAll('.cur-month'),
|
|
69
|
+
monthElement => {
|
|
70
|
+
monthElement.textContent = monthStr;
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const register = () => {
|
|
77
|
+
fp.loadedPlugins.push('carbonFlatpickrMonthSelectPlugin');
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
onMonthChange: updateCurrentMonth,
|
|
82
|
+
onValueUpdate: updateCurrentMonth,
|
|
83
|
+
onOpen: updateCurrentMonth,
|
|
84
|
+
onReady: [setupElements, updateCurrentMonth, register],
|
|
85
|
+
};
|
|
86
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import rangePlugin from 'flatpickr/dist/plugins/rangePlugin';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* COPIED FROM carbon-components-react
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @param {object} config Plugin configuration.
|
|
9
|
+
* @returns {Plugin} An extension of Flatpickr `rangePlugin` that does the following:
|
|
10
|
+
* * Better ensures the calendar dropdown is always aligned to the `<input>` for the starting date.
|
|
11
|
+
* Workaround for: https://github.com/flatpickr/flatpickr/issues/1944
|
|
12
|
+
* * A logic to ensure `fp.setDate()` call won't end up with "startDate to endDate" set to the first `<input>`
|
|
13
|
+
*/
|
|
14
|
+
export default config => {
|
|
15
|
+
const factory = rangePlugin(Object.assign({ position: 'left' }, config));
|
|
16
|
+
|
|
17
|
+
return fp => {
|
|
18
|
+
const origSetDate = fp.setDate;
|
|
19
|
+
|
|
20
|
+
const init = () => {
|
|
21
|
+
fp.setDate = function setDate(dates, triggerChange, format) {
|
|
22
|
+
origSetDate.call(this, dates, triggerChange, format);
|
|
23
|
+
// If `triggerChange` is `true`, `onValueUpdate` Flatpickr event is fired
|
|
24
|
+
// where Flatpickr's range plugin takes care of fixing the first `<input>`
|
|
25
|
+
if (!triggerChange) {
|
|
26
|
+
const { _input: inputFrom } = fp;
|
|
27
|
+
const { input: inputTo } = config;
|
|
28
|
+
[inputFrom, inputTo].forEach((input, i) => {
|
|
29
|
+
if (input) {
|
|
30
|
+
input.value = !dates[i]
|
|
31
|
+
? ''
|
|
32
|
+
: fp.formatDate(new Date(dates[i]), fp.config.dateFormat);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const origRangePlugin = factory(fp);
|
|
40
|
+
const { onReady: origOnReady } = origRangePlugin;
|
|
41
|
+
|
|
42
|
+
return Object.assign(origRangePlugin, {
|
|
43
|
+
onReady: [init, origOnReady],
|
|
44
|
+
onPreCalendarPosition() {},
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
};
|
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
import { Canvas, Meta, Story } from '@storybook/addon-docs';
|
|
2
|
+
import { sbCompPrefix } from '../../global/storybook-utils';
|
|
3
|
+
import CvDropdown from './CvDropdown.vue';
|
|
4
|
+
import CvDropdownItem from './CvDropdownItem.vue';
|
|
5
|
+
import CvDropdownSkeleton from './CvDropdownSkeleton.vue';
|
|
6
|
+
import { action } from '@storybook/addon-actions';
|
|
7
|
+
import { ref } from 'vue';
|
|
8
|
+
const myValue = ref('baby-yoda');
|
|
9
|
+
|
|
10
|
+
<Meta title={`${sbCompPrefix}/CvDropdown`} component={CvDropdown} />
|
|
11
|
+
|
|
12
|
+
export const Template = args => ({
|
|
13
|
+
// Components used in your story `template` are defined in the `components` object
|
|
14
|
+
components: {
|
|
15
|
+
CvDropdown,
|
|
16
|
+
CvDropdownItem,
|
|
17
|
+
CvDropdownSkeleton,
|
|
18
|
+
},
|
|
19
|
+
// The story's `args` need to be mapped into the template through the `setup()` method
|
|
20
|
+
setup() {
|
|
21
|
+
return {
|
|
22
|
+
...args,
|
|
23
|
+
props: args.props,
|
|
24
|
+
light: args.light,
|
|
25
|
+
placeholder: args.placeholder,
|
|
26
|
+
value: args.value,
|
|
27
|
+
label: args.label,
|
|
28
|
+
up: args.up,
|
|
29
|
+
inline: args.inline,
|
|
30
|
+
helperText: args.helperText,
|
|
31
|
+
hideSelected: args.hideSelected,
|
|
32
|
+
warningMessage: args.warningMessage,
|
|
33
|
+
invalidMessage: args.invalidMessage,
|
|
34
|
+
disabled: args.disabled,
|
|
35
|
+
size: args.size,
|
|
36
|
+
items: args.items,
|
|
37
|
+
onChange: action('change'),
|
|
38
|
+
myValue: myValue,
|
|
39
|
+
slotInvalidText: args.slotInvalidText,
|
|
40
|
+
slotWarningText: args.slotWarningText,
|
|
41
|
+
slotHelperText: args.slotHelperText,
|
|
42
|
+
slotInternalCaption: args.slotInternalCaption,
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
template: args.template,
|
|
46
|
+
});
|
|
47
|
+
const defaultTemplate = `
|
|
48
|
+
<div :style="{width: '300px', paddingTop: up ? '90px' : undefined}">
|
|
49
|
+
<cv-dropdown
|
|
50
|
+
:light="light"
|
|
51
|
+
:placeholder="placeholder"
|
|
52
|
+
:value="value"
|
|
53
|
+
:up="up"
|
|
54
|
+
:inline="inline"
|
|
55
|
+
:helper-text="helperText"
|
|
56
|
+
:warning-message="warningMessage"
|
|
57
|
+
:hide-selected="hideSelected"
|
|
58
|
+
:invalid-message="invalidMessage"
|
|
59
|
+
:label="label"
|
|
60
|
+
:disabled="disabled"
|
|
61
|
+
:size="size"
|
|
62
|
+
@change="onChange">
|
|
63
|
+
<cv-dropdown-item value="mando"><span style="color: darkred">Din Djarin</span></cv-dropdown-item>
|
|
64
|
+
<cv-dropdown-item value="nite-owl">Bo-Katan Kryze</cv-dropdown-item>
|
|
65
|
+
<cv-dropdown-item value="baby-yoda">Din Grogu</cv-dropdown-item>
|
|
66
|
+
<cv-dropdown-item value="mysterious">The Armorer</cv-dropdown-item>
|
|
67
|
+
<cv-dropdown-item value="bounty-hunter">Greef Karga</cv-dropdown-item>
|
|
68
|
+
</cv-dropdown>
|
|
69
|
+
</div>
|
|
70
|
+
`;
|
|
71
|
+
const slotsTemplate = `
|
|
72
|
+
<div :style="{width: '300px'}">
|
|
73
|
+
<cv-dropdown
|
|
74
|
+
v-model:value="myValue"
|
|
75
|
+
:light="light"
|
|
76
|
+
:placeholder="placeholder"
|
|
77
|
+
:up="up"
|
|
78
|
+
:inline="inline"
|
|
79
|
+
:helper-text="helperText"
|
|
80
|
+
:warning-message="warningMessage"
|
|
81
|
+
:hide-selected="hideSelected"
|
|
82
|
+
:invalid-message="invalidMessage"
|
|
83
|
+
:label="label"
|
|
84
|
+
:disabled="disabled"
|
|
85
|
+
:size="size"
|
|
86
|
+
@change="onChange">
|
|
87
|
+
<template v-if="slotInternalCaption" v-slot:internal-caption><h5>Edge case: {{ myValue }}</h5></template>
|
|
88
|
+
<template v-if="slotInvalidText" v-slot:invalid-message>Do not go to the dark side</template>
|
|
89
|
+
<template v-if="slotWarningText" v-slot:warning-message>Can this ally be trusted?</template>
|
|
90
|
+
<template v-if="slotHelperText" v-slot:helper-text>Choose ally strong with the force</template>
|
|
91
|
+
<cv-dropdown-item value="mando"><span>Din Djarin</span></cv-dropdown-item>
|
|
92
|
+
<cv-dropdown-item value="nite-owl">Bo-Katan Kryze</cv-dropdown-item>
|
|
93
|
+
<cv-dropdown-item value="baby-yoda">Din Grogu</cv-dropdown-item>
|
|
94
|
+
<cv-dropdown-item value="mysterious">The Armorer</cv-dropdown-item>
|
|
95
|
+
<cv-dropdown-item value="bounty-hunter">Greef Karga</cv-dropdown-item>
|
|
96
|
+
</cv-dropdown>
|
|
97
|
+
</div>
|
|
98
|
+
`;
|
|
99
|
+
const itemsTemplate = `
|
|
100
|
+
<div :style="{width: '300px'}">
|
|
101
|
+
<cv-dropdown
|
|
102
|
+
:light="light"
|
|
103
|
+
:placeholder="placeholder"
|
|
104
|
+
:value="value"
|
|
105
|
+
:up="up"
|
|
106
|
+
:inline="inline"
|
|
107
|
+
:helper-text="helperText"
|
|
108
|
+
:warning-message="warningMessage"
|
|
109
|
+
:hide-selected="hideSelected"
|
|
110
|
+
:invalid-message="invalidMessage"
|
|
111
|
+
:label="label"
|
|
112
|
+
:disabled="disabled"
|
|
113
|
+
:size="size"
|
|
114
|
+
:items="items"
|
|
115
|
+
@change="onChange">
|
|
116
|
+
</cv-dropdown>
|
|
117
|
+
</div>
|
|
118
|
+
`;
|
|
119
|
+
const vmodelTemplate = `
|
|
120
|
+
<div :style="{width: '300px'}">
|
|
121
|
+
<cv-dropdown
|
|
122
|
+
v-model:value="myValue"
|
|
123
|
+
:label="label"
|
|
124
|
+
:placeholder="placeholder"
|
|
125
|
+
@change="onChange">
|
|
126
|
+
<cv-dropdown-item value="mando"><span>Din Djarin</span></cv-dropdown-item>
|
|
127
|
+
<cv-dropdown-item value="nite-owl">Bo-Katan Kryze</cv-dropdown-item>
|
|
128
|
+
<cv-dropdown-item value="baby-yoda">Din Grogu</cv-dropdown-item>
|
|
129
|
+
<cv-dropdown-item value="mysterious">The Armorer</cv-dropdown-item>
|
|
130
|
+
<cv-dropdown-item value="bounty-hunter">Greef Karga</cv-dropdown-item>
|
|
131
|
+
</cv-dropdown>
|
|
132
|
+
<div>V-Model value: {{ myValue }}</div>
|
|
133
|
+
<select v-model="myValue">
|
|
134
|
+
<option value="mando">Mandalorian</option>
|
|
135
|
+
<option value="nite-owl">Bo-Katan</option>
|
|
136
|
+
<option value="baby-yoda">Grogu</option>
|
|
137
|
+
<option value="mysterious">Armorer</option>
|
|
138
|
+
<option value="bounty-hunter">Karga</option>
|
|
139
|
+
</select>
|
|
140
|
+
</div>
|
|
141
|
+
`;
|
|
142
|
+
const skeletonTemplate = `
|
|
143
|
+
<div :style="{width: '300px'}">
|
|
144
|
+
<cv-dropdown-skeleton :inline="inline"></cv-dropdown-skeleton>
|
|
145
|
+
</div>
|
|
146
|
+
`;
|
|
147
|
+
|
|
148
|
+
# CvDropdown
|
|
149
|
+
|
|
150
|
+
Notes:
|
|
151
|
+
|
|
152
|
+
- You can place a Dropdown inline with other content by using the inline variant
|
|
153
|
+
Migration notes:
|
|
154
|
+
|
|
155
|
+
- The `v-model` is different in Vue 3 than Vue 2. You can still specify the `v-model=something` to control the visibility but
|
|
156
|
+
if you specify it like this you will see a deprecation message in the log. Please use `v-model:value=something` instead.
|
|
157
|
+
- Add the `size` option to match Carbon React
|
|
158
|
+
- Added the `warningMessage` option to match Carbon React
|
|
159
|
+
|
|
160
|
+
<Canvas>
|
|
161
|
+
<Story
|
|
162
|
+
name="Default"
|
|
163
|
+
parameters={{
|
|
164
|
+
controls: {
|
|
165
|
+
exclude: [
|
|
166
|
+
'props',
|
|
167
|
+
'default',
|
|
168
|
+
'template',
|
|
169
|
+
'change',
|
|
170
|
+
'update:modelValue',
|
|
171
|
+
'update:value',
|
|
172
|
+
'helper-text',
|
|
173
|
+
'invalid-message',
|
|
174
|
+
'warning-message',
|
|
175
|
+
'internal-caption',
|
|
176
|
+
'modelValue',
|
|
177
|
+
],
|
|
178
|
+
},
|
|
179
|
+
docs: { source: { code: defaultTemplate } },
|
|
180
|
+
}}
|
|
181
|
+
args={{
|
|
182
|
+
template: defaultTemplate,
|
|
183
|
+
props: {
|
|
184
|
+
modelValue: undefined,
|
|
185
|
+
},
|
|
186
|
+
label: 'Characters',
|
|
187
|
+
placeholder: 'Choose an ally',
|
|
188
|
+
helperText: 'May the force be with you',
|
|
189
|
+
light: false,
|
|
190
|
+
}}
|
|
191
|
+
argTypes={{
|
|
192
|
+
light: {
|
|
193
|
+
type: String,
|
|
194
|
+
description: '`true` to use the light version',
|
|
195
|
+
table: { category: 'props' },
|
|
196
|
+
},
|
|
197
|
+
size: {
|
|
198
|
+
control: 'select',
|
|
199
|
+
default: 'md',
|
|
200
|
+
options: ['sm', 'md', 'lg'],
|
|
201
|
+
},
|
|
202
|
+
}}
|
|
203
|
+
>
|
|
204
|
+
{Template.bind({})}
|
|
205
|
+
</Story>
|
|
206
|
+
</Canvas>
|
|
207
|
+
|
|
208
|
+
# Use slots with helper, invalid, warning text, and the internal caption
|
|
209
|
+
|
|
210
|
+
<Canvas>
|
|
211
|
+
<Story
|
|
212
|
+
name="Slots"
|
|
213
|
+
parameters={{
|
|
214
|
+
controls: {
|
|
215
|
+
exclude: [
|
|
216
|
+
'props',
|
|
217
|
+
'default',
|
|
218
|
+
'template',
|
|
219
|
+
'change',
|
|
220
|
+
'update:modelValue',
|
|
221
|
+
'update:value',
|
|
222
|
+
'helper-text',
|
|
223
|
+
'invalid-message',
|
|
224
|
+
'warning-message',
|
|
225
|
+
'internal-caption',
|
|
226
|
+
'modelValue',
|
|
227
|
+
'ariaLabel',
|
|
228
|
+
'disabled',
|
|
229
|
+
'formItem',
|
|
230
|
+
'helperText',
|
|
231
|
+
'hideSelected',
|
|
232
|
+
'inline',
|
|
233
|
+
'invalidMessage',
|
|
234
|
+
'items',
|
|
235
|
+
'label',
|
|
236
|
+
'placeholder',
|
|
237
|
+
'size',
|
|
238
|
+
'up',
|
|
239
|
+
'value',
|
|
240
|
+
'warningMessage',
|
|
241
|
+
],
|
|
242
|
+
},
|
|
243
|
+
docs: { source: { code: slotsTemplate } },
|
|
244
|
+
}}
|
|
245
|
+
args={{
|
|
246
|
+
template: slotsTemplate,
|
|
247
|
+
label: 'Characters',
|
|
248
|
+
placeholder: 'Choose an ally',
|
|
249
|
+
slotInvalidText: false,
|
|
250
|
+
slotWarningText: false,
|
|
251
|
+
slotHelperText: true,
|
|
252
|
+
slotInternalCaption: false,
|
|
253
|
+
}}
|
|
254
|
+
argTypes={{}}
|
|
255
|
+
>
|
|
256
|
+
{Template.bind({})}
|
|
257
|
+
</Story>
|
|
258
|
+
</Canvas>
|
|
259
|
+
|
|
260
|
+
# Use an array of strings as the dropdown options
|
|
261
|
+
|
|
262
|
+
- Notes: this version does not seem very useful. Please comment in the Slack channel if you are using this.
|
|
263
|
+
Curious to know how it might be currently used.
|
|
264
|
+
|
|
265
|
+
<Canvas>
|
|
266
|
+
<Story
|
|
267
|
+
name="Items"
|
|
268
|
+
parameters={{
|
|
269
|
+
controls: {
|
|
270
|
+
exclude: [
|
|
271
|
+
'props',
|
|
272
|
+
'default',
|
|
273
|
+
'template',
|
|
274
|
+
'change',
|
|
275
|
+
'update:modelValue',
|
|
276
|
+
'update:value',
|
|
277
|
+
'helper-text',
|
|
278
|
+
'invalid-message',
|
|
279
|
+
'warning-message',
|
|
280
|
+
'internal-caption',
|
|
281
|
+
'modelValue',
|
|
282
|
+
'ariaLabel',
|
|
283
|
+
'disabled',
|
|
284
|
+
'formItem',
|
|
285
|
+
'helperText',
|
|
286
|
+
'hideSelected',
|
|
287
|
+
'inline',
|
|
288
|
+
'invalidMessage',
|
|
289
|
+
'items',
|
|
290
|
+
'label',
|
|
291
|
+
'placeholder',
|
|
292
|
+
'size',
|
|
293
|
+
'up',
|
|
294
|
+
'value',
|
|
295
|
+
'warningMessage',
|
|
296
|
+
],
|
|
297
|
+
},
|
|
298
|
+
docs: { source: { code: itemsTemplate } },
|
|
299
|
+
}}
|
|
300
|
+
args={{
|
|
301
|
+
template: itemsTemplate,
|
|
302
|
+
label: 'Planets',
|
|
303
|
+
placeholder: 'Where will you visit',
|
|
304
|
+
items: ['Coruscant', 'Tatooine', 'Naboo', 'Hoth', 'Kamino', 'Mandalore'],
|
|
305
|
+
}}
|
|
306
|
+
argTypes={{}}
|
|
307
|
+
>
|
|
308
|
+
{Template.bind({})}
|
|
309
|
+
</Story>
|
|
310
|
+
</Canvas>
|
|
311
|
+
|
|
312
|
+
# Use with v-model
|
|
313
|
+
|
|
314
|
+
<Canvas>
|
|
315
|
+
<Story
|
|
316
|
+
name="v-model"
|
|
317
|
+
parameters={{
|
|
318
|
+
controls: {
|
|
319
|
+
exclude: [
|
|
320
|
+
'props',
|
|
321
|
+
'default',
|
|
322
|
+
'template',
|
|
323
|
+
'change',
|
|
324
|
+
'update:modelValue',
|
|
325
|
+
'update:value',
|
|
326
|
+
'helper-text',
|
|
327
|
+
'invalid-message',
|
|
328
|
+
'warning-message',
|
|
329
|
+
'internal-caption',
|
|
330
|
+
'modelValue',
|
|
331
|
+
'ariaLabel',
|
|
332
|
+
'disabled',
|
|
333
|
+
'formItem',
|
|
334
|
+
'helperText',
|
|
335
|
+
'hideSelected',
|
|
336
|
+
'inline',
|
|
337
|
+
'invalidMessage',
|
|
338
|
+
'items',
|
|
339
|
+
'label',
|
|
340
|
+
'placeholder',
|
|
341
|
+
'size',
|
|
342
|
+
'up',
|
|
343
|
+
'value',
|
|
344
|
+
'warningMessage',
|
|
345
|
+
],
|
|
346
|
+
},
|
|
347
|
+
docs: { source: { code: vmodelTemplate } },
|
|
348
|
+
}}
|
|
349
|
+
args={{
|
|
350
|
+
template: vmodelTemplate,
|
|
351
|
+
label: 'Characters',
|
|
352
|
+
placeholder: 'Choose an ally',
|
|
353
|
+
}}
|
|
354
|
+
argTypes={{}}
|
|
355
|
+
>
|
|
356
|
+
{Template.bind({})}
|
|
357
|
+
</Story>
|
|
358
|
+
</Canvas>
|
|
359
|
+
|
|
360
|
+
# Skeleton - loading mode
|
|
361
|
+
|
|
362
|
+
- Notes: The Vue 2 story shows the `inline` attribute for the skeleton mode but this seems to have no effect on the display.
|
|
363
|
+
It is still supported but do not expect a change in display.
|
|
364
|
+
|
|
365
|
+
<Canvas>
|
|
366
|
+
<Story
|
|
367
|
+
name="skeleton"
|
|
368
|
+
parameters={{
|
|
369
|
+
controls: {
|
|
370
|
+
exclude: [
|
|
371
|
+
'props',
|
|
372
|
+
'default',
|
|
373
|
+
'template',
|
|
374
|
+
'change',
|
|
375
|
+
'update:modelValue',
|
|
376
|
+
'update:value',
|
|
377
|
+
'helper-text',
|
|
378
|
+
'invalid-message',
|
|
379
|
+
'warning-message',
|
|
380
|
+
'internal-caption',
|
|
381
|
+
'modelValue',
|
|
382
|
+
'ariaLabel',
|
|
383
|
+
'disabled',
|
|
384
|
+
'formItem',
|
|
385
|
+
'helperText',
|
|
386
|
+
'hideSelected',
|
|
387
|
+
'invalidMessage',
|
|
388
|
+
'items',
|
|
389
|
+
'label',
|
|
390
|
+
'placeholder',
|
|
391
|
+
'size',
|
|
392
|
+
'up',
|
|
393
|
+
'value',
|
|
394
|
+
'warningMessage',
|
|
395
|
+
'inline',
|
|
396
|
+
],
|
|
397
|
+
},
|
|
398
|
+
docs: { source: { code: skeletonTemplate } },
|
|
399
|
+
}}
|
|
400
|
+
args={{
|
|
401
|
+
template: skeletonTemplate,
|
|
402
|
+
}}
|
|
403
|
+
argTypes={{}}
|
|
404
|
+
>
|
|
405
|
+
{Template.bind({})}
|
|
406
|
+
</Story>
|
|
407
|
+
</Canvas>
|