@carbon/vue 3.0.4-alpha.0 → 3.0.5-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/dist/carbon-vue-3.common.js +1186 -219
- package/dist/carbon-vue-3.common.js.map +1 -1
- package/dist/carbon-vue-3.umd.js +1186 -219
- package/dist/carbon-vue-3.umd.js.map +1 -1
- package/dist/carbon-vue-3.umd.min.js +2 -2
- package/dist/carbon-vue-3.umd.min.js.map +1 -1
- package/package.json +2 -2
- package/src/components/CvCheckbox/CvCheckbox.vue +0 -2
- package/src/components/CvTextArea/CvTextArea.stories.js +174 -0
- package/src/components/CvTextArea/CvTextArea.vue +107 -0
- package/src/components/CvTextArea/index.js +4 -0
- package/src/components/CvTextInput/CvTextInput.stories.js +245 -0
- package/src/components/CvTextInput/CvTextInput.vue +217 -0
- package/src/components/CvTextInput/const.js +2 -0
- package/src/components/CvTextInput/index.js +4 -0
- package/src/components/CvTile/CvTile.stories.mdx +156 -0
- package/src/components/CvTile/CvTile.vue +67 -0
- package/src/components/CvTile/CvTileClickable.vue +23 -0
- package/src/components/CvTile/CvTileExpandable.vue +103 -0
- package/src/components/CvTile/CvTileSelectable.vue +52 -0
- package/src/components/CvTile/CvTileStandard.vue +7 -0
- package/src/components/CvTile/index.js +4 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/vue",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.5-alpha.0",
|
|
5
5
|
"description": "A collection of components for the Carbon Design System built using Vue.js",
|
|
6
6
|
"packageManager": "yarn@3.2.0",
|
|
7
7
|
"main": "dist/carbon-vue-3.umd.min.js",
|
|
@@ -202,5 +202,5 @@
|
|
|
202
202
|
"url": "git+https://github.com/carbon-design-system/carbon-components-vue.git"
|
|
203
203
|
},
|
|
204
204
|
"sideEffects": true,
|
|
205
|
-
"gitHead": "
|
|
205
|
+
"gitHead": "797d1eaacec0dcb8802ff5fea1fb08947955c9aa"
|
|
206
206
|
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import {
|
|
2
|
+
sbCompPrefix,
|
|
3
|
+
storyParametersObject,
|
|
4
|
+
} from '../../global/storybook-utils';
|
|
5
|
+
|
|
6
|
+
import CvTextArea from '.';
|
|
7
|
+
import { ref } from 'vue';
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: `${sbCompPrefix}/CvTextArea`,
|
|
11
|
+
component: CvTextArea,
|
|
12
|
+
argTypes: {
|
|
13
|
+
// attrs
|
|
14
|
+
disabled: {
|
|
15
|
+
type: 'boolean',
|
|
16
|
+
table: {
|
|
17
|
+
type: { summary: 'boolean' },
|
|
18
|
+
category: 'attributes',
|
|
19
|
+
},
|
|
20
|
+
description: 'Specify whether the textarea should be disabled',
|
|
21
|
+
},
|
|
22
|
+
placeholder: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
table: {
|
|
25
|
+
type: { summary: 'string' },
|
|
26
|
+
category: 'attributes',
|
|
27
|
+
},
|
|
28
|
+
description: 'Specify the placeholder attribute for the textarea',
|
|
29
|
+
},
|
|
30
|
+
// props
|
|
31
|
+
helperText: {
|
|
32
|
+
type: 'string',
|
|
33
|
+
table: {
|
|
34
|
+
type: { summary: 'string' },
|
|
35
|
+
category: 'props',
|
|
36
|
+
},
|
|
37
|
+
description:
|
|
38
|
+
'Provide text that is used alongside the control label for additional help',
|
|
39
|
+
},
|
|
40
|
+
hideLabel: {
|
|
41
|
+
type: 'boolean',
|
|
42
|
+
table: {
|
|
43
|
+
type: { summary: 'boolean' },
|
|
44
|
+
category: 'props',
|
|
45
|
+
defaultValue: false,
|
|
46
|
+
},
|
|
47
|
+
description:
|
|
48
|
+
'Specify whether you want the underlying label to be visually hidden',
|
|
49
|
+
},
|
|
50
|
+
invalidMessage: {
|
|
51
|
+
type: 'string',
|
|
52
|
+
table: {
|
|
53
|
+
type: { summary: 'string' },
|
|
54
|
+
category: 'props',
|
|
55
|
+
},
|
|
56
|
+
description:
|
|
57
|
+
'Provide the text that is displayed when the control is in an invalid state',
|
|
58
|
+
},
|
|
59
|
+
label: {
|
|
60
|
+
type: 'string',
|
|
61
|
+
table: {
|
|
62
|
+
type: { summary: 'string' },
|
|
63
|
+
category: 'props',
|
|
64
|
+
},
|
|
65
|
+
description: "Input's label",
|
|
66
|
+
},
|
|
67
|
+
light: {
|
|
68
|
+
type: 'boolean',
|
|
69
|
+
table: {
|
|
70
|
+
type: { summary: 'boolean' },
|
|
71
|
+
category: 'props',
|
|
72
|
+
defaultValue: false,
|
|
73
|
+
},
|
|
74
|
+
description:
|
|
75
|
+
"Toggles light version. For use on `$ui-01` backgrounds only. Don't use this to make tile background color same as container background color.",
|
|
76
|
+
},
|
|
77
|
+
modelValue: {
|
|
78
|
+
type: 'string',
|
|
79
|
+
table: {
|
|
80
|
+
type: { summary: 'string' },
|
|
81
|
+
category: 'props',
|
|
82
|
+
},
|
|
83
|
+
description:
|
|
84
|
+
"Input's value, modelValue is the vue3 default 'prop' for two-way data binding with v-model",
|
|
85
|
+
},
|
|
86
|
+
// slots
|
|
87
|
+
'helper-text': {
|
|
88
|
+
type: 'string',
|
|
89
|
+
table: {
|
|
90
|
+
type: { summary: 'string | html | Component' },
|
|
91
|
+
category: 'slots',
|
|
92
|
+
},
|
|
93
|
+
description:
|
|
94
|
+
"Helper text slot. It isn't shown if invalid message, either prop or slot, is available",
|
|
95
|
+
},
|
|
96
|
+
'invalid-message': {
|
|
97
|
+
type: 'string',
|
|
98
|
+
table: {
|
|
99
|
+
type: { summary: 'string | html | Component' },
|
|
100
|
+
category: 'slots',
|
|
101
|
+
},
|
|
102
|
+
description: 'Invalid message slot.',
|
|
103
|
+
},
|
|
104
|
+
// events
|
|
105
|
+
'update:modelValue': {
|
|
106
|
+
type: 'event',
|
|
107
|
+
table: {
|
|
108
|
+
category: 'events',
|
|
109
|
+
},
|
|
110
|
+
control: { type: null },
|
|
111
|
+
description:
|
|
112
|
+
"Triggered on textarea update. `update:modelValue` is the vue3 default 'event' for two-way data binding with v-model",
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const template = `
|
|
118
|
+
<cv-text-area v-bind="args">
|
|
119
|
+
<template v-if="args['helper-text']" v-slot:helper-text />
|
|
120
|
+
<template v-if="args['invalid-message']" v-slot:invalid-message />
|
|
121
|
+
</cv-text-area>
|
|
122
|
+
`;
|
|
123
|
+
const Template = args => {
|
|
124
|
+
return {
|
|
125
|
+
components: { CvTextArea },
|
|
126
|
+
setup: () => ({ args }),
|
|
127
|
+
template,
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export const Default = Template.bind({});
|
|
132
|
+
Default.args = {
|
|
133
|
+
label: 'Text area label',
|
|
134
|
+
placeholder: 'Sample placeholder',
|
|
135
|
+
};
|
|
136
|
+
Default.parameters = storyParametersObject(
|
|
137
|
+
Default.parameters,
|
|
138
|
+
template,
|
|
139
|
+
Default.args
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
export const Slots = Template.bind({});
|
|
143
|
+
Slots.args = {
|
|
144
|
+
['invalid-message']: 'Invalid text area message',
|
|
145
|
+
label: 'Text area label',
|
|
146
|
+
placeholder: 'Sample placeholder',
|
|
147
|
+
};
|
|
148
|
+
Slots.parameters = storyParametersObject(
|
|
149
|
+
Slots.parameters,
|
|
150
|
+
template,
|
|
151
|
+
Slots.args
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
const vModelTemplate = `
|
|
155
|
+
<cv-text-area v-bind="args" v-model="value" />
|
|
156
|
+
<p style="margin-top: 1rem;">Value passed to v-model: {{ value }}</p>
|
|
157
|
+
`;
|
|
158
|
+
const VModelTemplate = args => {
|
|
159
|
+
return {
|
|
160
|
+
components: { CvTextArea },
|
|
161
|
+
setup: () => ({ args, value: ref('') }),
|
|
162
|
+
template: vModelTemplate,
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
export const vModel = VModelTemplate.bind({});
|
|
166
|
+
vModel.args = {
|
|
167
|
+
label: 'Text area label',
|
|
168
|
+
placeholder: 'Sample placeholder',
|
|
169
|
+
};
|
|
170
|
+
vModel.parameters = storyParametersObject(
|
|
171
|
+
vModel.parameters,
|
|
172
|
+
vModelTemplate,
|
|
173
|
+
vModel.args
|
|
174
|
+
);
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="`cv-text-area ${carbonPrefix}--form-item`">
|
|
3
|
+
<label
|
|
4
|
+
:for="cvId"
|
|
5
|
+
:class="[
|
|
6
|
+
`${carbonPrefix}--label`,
|
|
7
|
+
{
|
|
8
|
+
[`${carbonPrefix}--label--disabled`]: $attrs.disabled,
|
|
9
|
+
[`${carbonPrefix}--visually-hidden`]: hideLabel,
|
|
10
|
+
},
|
|
11
|
+
]"
|
|
12
|
+
>
|
|
13
|
+
{{ label }}
|
|
14
|
+
</label>
|
|
15
|
+
<div
|
|
16
|
+
:class="`${carbonPrefix}--text-area__wrapper`"
|
|
17
|
+
:data-invalid="isInvalid"
|
|
18
|
+
>
|
|
19
|
+
<WarningFilled16
|
|
20
|
+
v-if="isInvalid"
|
|
21
|
+
:class="`${carbonPrefix}--text-area__invalid-icon`"
|
|
22
|
+
/>
|
|
23
|
+
<textarea
|
|
24
|
+
:aria-invalid="isInvalid"
|
|
25
|
+
:aria-describedby="isInvalid ? errorId : undefined"
|
|
26
|
+
:id="cvId"
|
|
27
|
+
:class="[
|
|
28
|
+
`${carbonPrefix}--text-area`,
|
|
29
|
+
{
|
|
30
|
+
[`${carbonPrefix}--text-area--invalid`]: isInvalid,
|
|
31
|
+
[`${carbonPrefix}--text-area--light`]: isLight,
|
|
32
|
+
},
|
|
33
|
+
]"
|
|
34
|
+
v-bind="$attrs"
|
|
35
|
+
:value="modelValue"
|
|
36
|
+
@input="$event => $emit('update:modelValue', $event.target.value)"
|
|
37
|
+
></textarea>
|
|
38
|
+
</div>
|
|
39
|
+
<div
|
|
40
|
+
v-if="isInvalid"
|
|
41
|
+
:id="errorId"
|
|
42
|
+
:class="`${carbonPrefix}--form-requirement`"
|
|
43
|
+
>
|
|
44
|
+
<slot name="invalid-message">{{ invalidMessage }}</slot>
|
|
45
|
+
</div>
|
|
46
|
+
<div
|
|
47
|
+
v-if="isHelper"
|
|
48
|
+
:class="[
|
|
49
|
+
`${carbonPrefix}--form__helper-text`,
|
|
50
|
+
{ [`${carbonPrefix}--form__helper-text--disabled`]: $attrs.disabled },
|
|
51
|
+
]"
|
|
52
|
+
>
|
|
53
|
+
<slot name="helper-text">{{ helperText }}</slot>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<script setup>
|
|
59
|
+
import { computed, ref, useSlots, onBeforeMount, onBeforeUpdate } from 'vue';
|
|
60
|
+
import { WarningFilled16 } from '@carbon/icons-vue';
|
|
61
|
+
import { carbonPrefix } from '../../global/settings';
|
|
62
|
+
import { useCvId, props as propsCvId } from '../../use/cvId';
|
|
63
|
+
import { useIsLight, props as propsTheme } from '../../use/cvTheme';
|
|
64
|
+
|
|
65
|
+
const props = defineProps({
|
|
66
|
+
helperText: { type: String, default: undefined },
|
|
67
|
+
hideLabel: { type: Boolean, default: false },
|
|
68
|
+
invalidMessage: { type: String, default: undefined },
|
|
69
|
+
label: String,
|
|
70
|
+
modelValue: String,
|
|
71
|
+
...propsCvId,
|
|
72
|
+
...propsTheme,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const cvId = useCvId(props);
|
|
76
|
+
|
|
77
|
+
// DOM
|
|
78
|
+
const slots = useSlots();
|
|
79
|
+
|
|
80
|
+
// Data
|
|
81
|
+
const isHelper = ref(false);
|
|
82
|
+
const isInvalid = ref(false);
|
|
83
|
+
const isLight = useIsLight(props);
|
|
84
|
+
|
|
85
|
+
// Computed
|
|
86
|
+
const errorId = computed(() => `error-${cvId.value}`);
|
|
87
|
+
|
|
88
|
+
// Methods
|
|
89
|
+
function checkSlots() {
|
|
90
|
+
// NOTE: this.$slots is not reactive so needs to be managed on updated
|
|
91
|
+
isInvalid.value = !!(
|
|
92
|
+
props.invalidMessage?.length || slots['invalid-message']
|
|
93
|
+
);
|
|
94
|
+
isHelper.value =
|
|
95
|
+
!isInvalid.value && !!(props.helperText?.length || slots['helper-text']);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Life Hooks
|
|
99
|
+
onBeforeMount(checkSlots);
|
|
100
|
+
onBeforeUpdate(checkSlots);
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<script>
|
|
104
|
+
export default {
|
|
105
|
+
inheritAttrs: false,
|
|
106
|
+
};
|
|
107
|
+
</script>
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import {
|
|
2
|
+
sbCompPrefix,
|
|
3
|
+
storyParametersObject,
|
|
4
|
+
} from '../../global/storybook-utils';
|
|
5
|
+
|
|
6
|
+
import CvTextInput from '.';
|
|
7
|
+
import { ref } from 'vue';
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: `${sbCompPrefix}/CvTextInput`,
|
|
11
|
+
component: CvTextInput,
|
|
12
|
+
argTypes: {
|
|
13
|
+
// attrs
|
|
14
|
+
disabled: {
|
|
15
|
+
type: 'boolean',
|
|
16
|
+
table: {
|
|
17
|
+
type: { summary: 'boolean' },
|
|
18
|
+
category: 'attributes',
|
|
19
|
+
},
|
|
20
|
+
description: 'Specify whether the `<input>` should be disabled',
|
|
21
|
+
},
|
|
22
|
+
placeholder: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
table: {
|
|
25
|
+
type: { summary: 'string' },
|
|
26
|
+
category: 'attributes',
|
|
27
|
+
},
|
|
28
|
+
description: 'Specify the placeholder attribute for the `<input>`',
|
|
29
|
+
},
|
|
30
|
+
// props
|
|
31
|
+
helperText: {
|
|
32
|
+
type: 'string',
|
|
33
|
+
table: {
|
|
34
|
+
type: { summary: 'string' },
|
|
35
|
+
category: 'props',
|
|
36
|
+
},
|
|
37
|
+
description:
|
|
38
|
+
'Provide text that is used alongside the control label for additional help',
|
|
39
|
+
},
|
|
40
|
+
hideLabel: {
|
|
41
|
+
type: 'boolean',
|
|
42
|
+
table: {
|
|
43
|
+
type: { summary: 'boolean' },
|
|
44
|
+
category: 'props',
|
|
45
|
+
defaultValue: false,
|
|
46
|
+
},
|
|
47
|
+
description:
|
|
48
|
+
'Specify whether you want the underlying label to be visually hidden',
|
|
49
|
+
},
|
|
50
|
+
invalidMessage: {
|
|
51
|
+
type: 'string',
|
|
52
|
+
table: {
|
|
53
|
+
type: { summary: 'string' },
|
|
54
|
+
category: 'props',
|
|
55
|
+
},
|
|
56
|
+
description:
|
|
57
|
+
'Provide the text that is displayed when the control is in an invalid state',
|
|
58
|
+
},
|
|
59
|
+
label: {
|
|
60
|
+
type: 'string',
|
|
61
|
+
table: {
|
|
62
|
+
type: { summary: 'string' },
|
|
63
|
+
category: 'props',
|
|
64
|
+
},
|
|
65
|
+
description: "Input's label",
|
|
66
|
+
},
|
|
67
|
+
light: {
|
|
68
|
+
type: 'boolean',
|
|
69
|
+
table: {
|
|
70
|
+
type: { summary: 'boolean' },
|
|
71
|
+
category: 'props',
|
|
72
|
+
defaultValue: false,
|
|
73
|
+
},
|
|
74
|
+
description:
|
|
75
|
+
"Toggles light version. For use on `$ui-01` backgrounds only. Don't use this to make tile background color same as container background color.",
|
|
76
|
+
},
|
|
77
|
+
modelValue: {
|
|
78
|
+
type: 'string',
|
|
79
|
+
table: {
|
|
80
|
+
type: { summary: 'string' },
|
|
81
|
+
category: 'props',
|
|
82
|
+
},
|
|
83
|
+
description:
|
|
84
|
+
"Input's value, modelValue is the vue3 default 'prop' for two-way data binding with v-model",
|
|
85
|
+
},
|
|
86
|
+
passwordHideLabel: {
|
|
87
|
+
type: 'string',
|
|
88
|
+
table: {
|
|
89
|
+
type: { summary: 'string' },
|
|
90
|
+
category: 'props',
|
|
91
|
+
},
|
|
92
|
+
description: '"Hide password" tooltip text on password visibility toggle',
|
|
93
|
+
},
|
|
94
|
+
passwordShowLabel: {
|
|
95
|
+
type: 'string',
|
|
96
|
+
table: {
|
|
97
|
+
type: { summary: 'string' },
|
|
98
|
+
category: 'props',
|
|
99
|
+
},
|
|
100
|
+
description: '"Show password" tooltip text on password visibility toggle',
|
|
101
|
+
},
|
|
102
|
+
passwordVisible: {
|
|
103
|
+
type: 'boolean',
|
|
104
|
+
table: {
|
|
105
|
+
type: { summary: 'boolean' },
|
|
106
|
+
category: 'props',
|
|
107
|
+
},
|
|
108
|
+
description: 'Toggle password visibility.',
|
|
109
|
+
},
|
|
110
|
+
type: {
|
|
111
|
+
type: 'string',
|
|
112
|
+
table: {
|
|
113
|
+
type: { summary: 'string' },
|
|
114
|
+
category: 'props',
|
|
115
|
+
defaultValue: { summary: 'text' },
|
|
116
|
+
},
|
|
117
|
+
options: ['text', 'password'],
|
|
118
|
+
control: {
|
|
119
|
+
type: 'select',
|
|
120
|
+
},
|
|
121
|
+
description: 'Input type, only `text` and `password` are available',
|
|
122
|
+
},
|
|
123
|
+
warnText: {
|
|
124
|
+
type: 'string',
|
|
125
|
+
table: {
|
|
126
|
+
type: { summary: 'string' },
|
|
127
|
+
category: 'props',
|
|
128
|
+
},
|
|
129
|
+
description:
|
|
130
|
+
'Provide the text that is displayed when the control is in warning state',
|
|
131
|
+
},
|
|
132
|
+
// slots
|
|
133
|
+
'helper-text': {
|
|
134
|
+
type: 'string',
|
|
135
|
+
table: {
|
|
136
|
+
type: { summary: 'string | html | Component' },
|
|
137
|
+
category: 'slots',
|
|
138
|
+
},
|
|
139
|
+
description:
|
|
140
|
+
"Helper text slot. It isn't shown if invalid message or warn text, either props or slots, are available",
|
|
141
|
+
},
|
|
142
|
+
'invalid-message': {
|
|
143
|
+
type: 'string',
|
|
144
|
+
table: {
|
|
145
|
+
type: { summary: 'string | html | Component' },
|
|
146
|
+
category: 'slots',
|
|
147
|
+
},
|
|
148
|
+
description: 'Invalid message slot.',
|
|
149
|
+
},
|
|
150
|
+
'warn-text': {
|
|
151
|
+
type: 'string',
|
|
152
|
+
table: {
|
|
153
|
+
type: { summary: 'string | html | Component' },
|
|
154
|
+
category: 'slots',
|
|
155
|
+
},
|
|
156
|
+
description:
|
|
157
|
+
"Warn text slot. It isn't shown if invalid message, either prop or slot, is available",
|
|
158
|
+
},
|
|
159
|
+
// events
|
|
160
|
+
'update:modelValue': {
|
|
161
|
+
type: 'event',
|
|
162
|
+
table: {
|
|
163
|
+
type: { summary: 'event' },
|
|
164
|
+
category: 'events',
|
|
165
|
+
},
|
|
166
|
+
control: { type: null },
|
|
167
|
+
description:
|
|
168
|
+
"Triggered on textarea update. `update:modelValue` is the vue3 default 'event' for two-way data binding with v-model",
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const template = `
|
|
174
|
+
<cv-text-input v-bind="args">
|
|
175
|
+
<template v-if="args['helper-text']" v-slot:helper-text />
|
|
176
|
+
<template v-if="args['warn-text']" v-slot:warn-text />
|
|
177
|
+
<template v-if="args['invalid-message']" v-slot:invalid-message />
|
|
178
|
+
</cv-text-input>
|
|
179
|
+
`;
|
|
180
|
+
const Template = args => {
|
|
181
|
+
return {
|
|
182
|
+
components: { CvTextInput },
|
|
183
|
+
setup: () => ({ args }),
|
|
184
|
+
template,
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export const Default = Template.bind({});
|
|
189
|
+
Default.args = {
|
|
190
|
+
helperText: 'Same helper text',
|
|
191
|
+
label: 'Text input label',
|
|
192
|
+
placeholder: 'Sample placeholder',
|
|
193
|
+
};
|
|
194
|
+
Default.parameters = storyParametersObject(
|
|
195
|
+
Default.parameters,
|
|
196
|
+
template,
|
|
197
|
+
Default.args
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
export const Slots = Template.bind({});
|
|
201
|
+
Slots.args = {
|
|
202
|
+
'invalid-message': 'Same invalid message',
|
|
203
|
+
'warn-text': 'Same warn message',
|
|
204
|
+
'helper-text': 'Same help message',
|
|
205
|
+
label: 'Text input label',
|
|
206
|
+
placeholder: 'Sample placeholder',
|
|
207
|
+
};
|
|
208
|
+
Slots.parameters = storyParametersObject(
|
|
209
|
+
Slots.parameters,
|
|
210
|
+
template,
|
|
211
|
+
Slots.args
|
|
212
|
+
);
|
|
213
|
+
|
|
214
|
+
const vModelTemplate = `
|
|
215
|
+
<cv-text-input v-bind="args" v-model="value" />
|
|
216
|
+
<p style="margin-top: 1rem;">Value passed to v-model: {{ value }}</p>
|
|
217
|
+
`;
|
|
218
|
+
const VModelTemplate = args => {
|
|
219
|
+
return {
|
|
220
|
+
components: { CvTextInput },
|
|
221
|
+
setup: () => ({ args, value: ref('') }),
|
|
222
|
+
template: vModelTemplate,
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
export const vModel = VModelTemplate.bind({});
|
|
226
|
+
vModel.args = {
|
|
227
|
+
label: 'Text input label',
|
|
228
|
+
placeholder: 'Sample placeholder',
|
|
229
|
+
};
|
|
230
|
+
vModel.parameters = storyParametersObject(
|
|
231
|
+
vModel.parameters,
|
|
232
|
+
vModelTemplate,
|
|
233
|
+
vModel.args
|
|
234
|
+
);
|
|
235
|
+
|
|
236
|
+
export const Password = Template.bind({});
|
|
237
|
+
Password.args = {
|
|
238
|
+
label: 'Password input label',
|
|
239
|
+
type: 'password',
|
|
240
|
+
};
|
|
241
|
+
Password.parameters = storyParametersObject(
|
|
242
|
+
Password.parameters,
|
|
243
|
+
template,
|
|
244
|
+
Password.args
|
|
245
|
+
);
|