@vcita/design-system 1.2.1 → 1.2.2
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/CHANGELOG.md +5 -0
- package/dist/@vcita/design-system.esm.js +1072 -910
- package/dist/@vcita/design-system.min.js +2 -2
- package/dist/@vcita/design-system.ssr.js +939 -804
- package/package.json +1 -1
- package/src/components/.DS_Store +0 -0
- package/src/components/VcButton/VcButton.stories.js +23 -23
- package/src/components/VcChip/VcChip.stories.js +3 -2
- package/src/components/VcChipList/VcChipList.stories.js +34 -21
- package/src/components/VcIcon/VcIcon.stories.js +30 -7
- package/src/components/VcIcon/VcIcon.vue +11 -2
- package/src/components/VcMenu/.DS_Store +0 -0
- package/src/components/VcSideNav/VcSideNav.spec.js +105 -0
- package/src/components/VcSideNav/VcSideNav.stories.js +117 -0
- package/src/components/VcSideNav/VcSideNav.vue +136 -0
- package/src/components/VcTextField/VcTextField.stories.js +60 -101
- package/src/components/VcTextField/VcTextField.vue +4 -0
- package/src/components/index.js +1 -0
- package/src/components/list/VcList/pattern/VcMobilePickerPattern.stories.js +22 -8
- package/src/components/list/VcListEntity/VcListEntity.stories.js +14 -19
- package/src/components/modal/VcConfirmModal/VcConfirmModal.stories.js +73 -46
- package/src/components/modal/VcConfirmModal/VcConfirmModal.vue +12 -2
- package/src/components/modal/VcConfirmProminentModal/VcConfirmProminentModal.stories.js +6 -10
- package/src/components/modal/VcConfirmProminentModal/VcConfirmProminentModal.vue +5 -0
- package/src/components/modal/VcInputModal/VcInputModal.stories.js +47 -56
- package/src/components/modal/VcInputModal/VcInputModal.vue +2 -1
- package/src/components/modal/VcNoticeModal/VcNoticeModal.stories.js +36 -45
- package/src/components/modal/VcNoticeModal/VcNoticeModal.vue +5 -0
- package/src/components/modal/elements/VcModalContainer.stories.js +35 -12
- package/src/components/modal/elements/VcModalContainer.vue +8 -1
- package/src/components/modal/elements/VcModalFooter.stories.js +10 -6
- package/src/components/modal/elements/VcModalWrapper.stories.js +13 -6
|
@@ -2,6 +2,32 @@ import VcTextFieldCmp from './VcTextField';
|
|
|
2
2
|
import icons from "../../../init/SvgIcons";
|
|
3
3
|
import VcBaseDocs from "@/stories/VcBaseDocs.mdx";
|
|
4
4
|
|
|
5
|
+
const baseProps = {
|
|
6
|
+
label: "Label",
|
|
7
|
+
type: 'text',
|
|
8
|
+
placeholder: '',
|
|
9
|
+
value: '',
|
|
10
|
+
maxlength: 100,
|
|
11
|
+
hint: '',
|
|
12
|
+
counter: false,
|
|
13
|
+
disabled: false,
|
|
14
|
+
appendIcon: '',
|
|
15
|
+
rules: [],
|
|
16
|
+
tooltipContent: '',
|
|
17
|
+
tooltipHeader: '',
|
|
18
|
+
tooltipNudgeLeft: 0,
|
|
19
|
+
tooltipNudgeRight: 0,
|
|
20
|
+
prefix: '',
|
|
21
|
+
errorMessages: '',
|
|
22
|
+
dataQa: 'vc-text-field',
|
|
23
|
+
hideDetails: 'auto',
|
|
24
|
+
persistentHint: true,
|
|
25
|
+
singleLine: false,
|
|
26
|
+
readonly: false,
|
|
27
|
+
googleAddressAutoComplete: false,
|
|
28
|
+
googleAddressCountryOptions: []
|
|
29
|
+
}
|
|
30
|
+
|
|
5
31
|
const TextFieldTemplate = (args, {argTypes}) => ({
|
|
6
32
|
components: {VcTextField: VcTextFieldCmp},
|
|
7
33
|
props: Object.keys(argTypes),
|
|
@@ -12,7 +38,7 @@ const TextFieldTemplate = (args, {argTypes}) => ({
|
|
|
12
38
|
},
|
|
13
39
|
template: `
|
|
14
40
|
<v-layout column>
|
|
15
|
-
|
|
41
|
+
${args.description}
|
|
16
42
|
<VcTextField :value="value"
|
|
17
43
|
:maxlength="maxlength"
|
|
18
44
|
:hint="hint"
|
|
@@ -34,6 +60,8 @@ const TextFieldTemplate = (args, {argTypes}) => ({
|
|
|
34
60
|
:persistent-hint="persistentHint"
|
|
35
61
|
:single-line="singleLine"
|
|
36
62
|
:readonly="readonly"
|
|
63
|
+
:google-address-auto-complete="googleAddressAutoComplete"
|
|
64
|
+
:google-address-country-options="googleAddressCountryOptions"
|
|
37
65
|
@click="onClick"
|
|
38
66
|
@input="onInput"/>
|
|
39
67
|
</v-layout>`,
|
|
@@ -41,86 +69,44 @@ const TextFieldTemplate = (args, {argTypes}) => ({
|
|
|
41
69
|
|
|
42
70
|
export const Playground = TextFieldTemplate.bind({});
|
|
43
71
|
Playground.args = {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
placeholder: 'Placeholder',
|
|
47
|
-
value: '',
|
|
48
|
-
maxlength: 10,
|
|
49
|
-
hint: 'Hint',
|
|
50
|
-
counter: true,
|
|
51
|
-
disabled: false,
|
|
52
|
-
appendIcon: '',
|
|
53
|
-
rules: [],
|
|
54
|
-
tooltipContent: 'Tooltip content',
|
|
55
|
-
tooltipHeader: 'Tooltip header',
|
|
56
|
-
tooltipNudgeLeft: 0,
|
|
57
|
-
tooltipNudgeRight: 0,
|
|
58
|
-
prefix: '',
|
|
59
|
-
errorMessages: '',
|
|
60
|
-
dataQa: 'vc-text-field',
|
|
61
|
-
hideDetails: 'auto',
|
|
62
|
-
persistentHint: true,
|
|
63
|
-
singleLine: false,
|
|
64
|
-
readonly: false,
|
|
72
|
+
...baseProps,
|
|
73
|
+
description: 'In the case of using the append icon make sure there is no tooltip content that will override the slot'
|
|
65
74
|
}
|
|
66
75
|
|
|
67
76
|
export const Prefix = TextFieldTemplate.bind({});
|
|
68
77
|
Prefix.args = {
|
|
69
|
-
|
|
70
|
-
type: 'text',
|
|
78
|
+
...baseProps,
|
|
71
79
|
prefix: '$'
|
|
72
80
|
}
|
|
73
81
|
|
|
74
82
|
export const Placeholder = TextFieldTemplate.bind({});
|
|
75
83
|
Placeholder.args = {
|
|
76
|
-
|
|
84
|
+
...baseProps,
|
|
77
85
|
placeholder: "Placeholder Text"
|
|
78
86
|
}
|
|
79
87
|
|
|
80
|
-
const
|
|
81
|
-
components: {VcTextField: VcTextFieldCmp},
|
|
82
|
-
props: Object.keys(argTypes),
|
|
83
|
-
template: `<div><br/><br/><br/><br/><br/><br/><br/>
|
|
84
|
-
<VcTextField :value="value"
|
|
85
|
-
:maxlength="maxlength"
|
|
86
|
-
:hint="hint"
|
|
87
|
-
:counter="counter"
|
|
88
|
-
:disabled="disabled"
|
|
89
|
-
:rules="rules"
|
|
90
|
-
:label="label"
|
|
91
|
-
:type="type"
|
|
92
|
-
:placeholder="placeholder"
|
|
93
|
-
:tooltip-content="tooltipContent"
|
|
94
|
-
:tooltip-header="tooltipHeader"
|
|
95
|
-
:tooltip-nudge-left="tooltipNudgeLeft"
|
|
96
|
-
:tooltip-nudge-right="tooltipNudgeRight"
|
|
97
|
-
@input="onInput"/></div>`,
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
export const Tooltip = TooltipTemplate.bind({});
|
|
88
|
+
export const Tooltip = TextFieldTemplate.bind({});
|
|
101
89
|
Tooltip.args = {
|
|
102
|
-
|
|
90
|
+
...baseProps,
|
|
103
91
|
tooltipHeader: "tooltipHeader",
|
|
104
92
|
tooltipContent: "tooltipContent"
|
|
105
93
|
}
|
|
106
94
|
|
|
107
95
|
export const Disabled = TextFieldTemplate.bind({});
|
|
108
96
|
Disabled.args = {
|
|
109
|
-
|
|
110
|
-
type: 'text',
|
|
97
|
+
...baseProps,
|
|
111
98
|
disabled: true
|
|
112
99
|
}
|
|
113
100
|
export const Hint = TextFieldTemplate.bind({});
|
|
114
101
|
Hint.args = {
|
|
115
|
-
|
|
116
|
-
type: 'text',
|
|
102
|
+
...baseProps,
|
|
117
103
|
hint: "Help text"
|
|
118
104
|
}
|
|
119
105
|
|
|
120
106
|
export const ErrorRules = TextFieldTemplate.bind({});
|
|
121
107
|
ErrorRules.args = {
|
|
108
|
+
...baseProps,
|
|
122
109
|
label: "Email",
|
|
123
|
-
type: 'text',
|
|
124
110
|
rules: [value => !!value || 'Required.', value => {
|
|
125
111
|
const pattern = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
|
126
112
|
return pattern.test(value) || 'Invalid e-mail.'
|
|
@@ -129,53 +115,29 @@ ErrorRules.args = {
|
|
|
129
115
|
|
|
130
116
|
export const ErrorMessage = TextFieldTemplate.bind({});
|
|
131
117
|
ErrorMessage.args = {
|
|
132
|
-
|
|
133
|
-
type: 'text',
|
|
118
|
+
...baseProps,
|
|
134
119
|
errorMessages: 'Error message'
|
|
135
120
|
}
|
|
136
121
|
|
|
137
122
|
export const Counter = TextFieldTemplate.bind({});
|
|
138
123
|
Counter.args = {
|
|
124
|
+
...baseProps,
|
|
139
125
|
label: "Email",
|
|
140
|
-
|
|
141
|
-
counter: true,
|
|
142
|
-
maxlength: 100
|
|
126
|
+
counter: true
|
|
143
127
|
}
|
|
144
128
|
|
|
145
|
-
const
|
|
146
|
-
components: {VcTextField: VcTextFieldCmp},
|
|
147
|
-
props: Object.keys(argTypes),
|
|
148
|
-
template: `<div>
|
|
149
|
-
<p>To use Google Address Auto Complete, you must have a Google API key.</p>
|
|
150
|
-
<p>Vue.prototype.$ds = {options: {googleAppKey: 'Google_API_Key'}};</p>
|
|
151
|
-
<VcTextField :value="value"
|
|
152
|
-
:maxlength="maxlength"
|
|
153
|
-
:hint="hint"
|
|
154
|
-
:counter="counter"
|
|
155
|
-
:disabled="disabled"
|
|
156
|
-
:rules="rules"
|
|
157
|
-
:label="label"
|
|
158
|
-
:type="type"
|
|
159
|
-
:placeholder="placeholder"
|
|
160
|
-
:tooltip-content="tooltipContent"
|
|
161
|
-
:tooltip-header="tooltipHeader"
|
|
162
|
-
:google-address-auto-complete="googleAddressAutoComplete"
|
|
163
|
-
:google-address-country-options="googleAddressCountryOptions"
|
|
164
|
-
@input="onInput"
|
|
165
|
-
@onPlaceSelected="onPlaceSelected"/>
|
|
166
|
-
</div>`,
|
|
167
|
-
})
|
|
168
|
-
|
|
169
|
-
export const GoogleAddressAutocomplete = GoogleAutoCompleteTemplate.bind({});
|
|
129
|
+
export const GoogleAddressAutocomplete = TextFieldTemplate.bind({});
|
|
170
130
|
GoogleAddressAutocomplete.args = {
|
|
131
|
+
...baseProps,
|
|
171
132
|
label: "Address",
|
|
172
|
-
type: 'text',
|
|
173
133
|
googleAddressAutoComplete: true,
|
|
174
134
|
googleAddressCountryOptions: ['us'],
|
|
175
135
|
tooltipHeader: "header",
|
|
176
136
|
tooltipContent: "content",
|
|
177
137
|
hint: "hint",
|
|
178
|
-
placeholder: "placeholder"
|
|
138
|
+
placeholder: "placeholder",
|
|
139
|
+
description: `<p>To use Google Address Auto Complete, you must have a Google API key.</p>
|
|
140
|
+
<p>Vue.prototype.$ds = {options: {googleAppKey: 'Google_API_Key'}};</p>`
|
|
179
141
|
}
|
|
180
142
|
|
|
181
143
|
export default {
|
|
@@ -187,27 +149,23 @@ export default {
|
|
|
187
149
|
options: ['number', 'text', 'search'],
|
|
188
150
|
control: {type: 'radio'}
|
|
189
151
|
},
|
|
190
|
-
disabled: {
|
|
191
|
-
options: [true, false],
|
|
192
|
-
control: {type: 'boolean'}
|
|
193
|
-
},
|
|
194
|
-
counter: {
|
|
195
|
-
options: [true, false],
|
|
196
|
-
control: {type: 'boolean'}
|
|
197
|
-
},
|
|
198
|
-
maxlength: {
|
|
199
|
-
control: {type: 'number'}
|
|
200
|
-
},
|
|
201
|
-
value: {
|
|
202
|
-
control: {type: 'text'}
|
|
203
|
-
},
|
|
204
|
-
googleAddressAutoComplete: {
|
|
205
|
-
control: {type: 'boolean'}
|
|
206
|
-
},
|
|
207
152
|
appendIcon: {
|
|
208
153
|
options: Object.keys(icons),
|
|
209
154
|
control: {type: 'select'}
|
|
210
155
|
},
|
|
156
|
+
counter: {table: {category: 'counter'}},
|
|
157
|
+
maxlength: {table: {category: 'counter'}},
|
|
158
|
+
rules: {table: {category: 'error'}},
|
|
159
|
+
hint: {table: {category: 'hint'}},
|
|
160
|
+
persistentHint: {table: {category: 'hint'}},
|
|
161
|
+
errorMessages: {table: {category: 'error'}},
|
|
162
|
+
tooltipContent: {table: {category: 'tooltip'}},
|
|
163
|
+
tooltipHeader: {table: {category: 'tooltip'}},
|
|
164
|
+
tooltipNudgeLeft: {table: {category: 'tooltip'}},
|
|
165
|
+
tooltipNudgeRight: {table: {category: 'tooltip'}},
|
|
166
|
+
googleAddressAutoComplete: {table: {category: 'google address'}},
|
|
167
|
+
googleAddressCountryOptions: {table: {category: 'google address'}},
|
|
168
|
+
description: {table: {disable: true}},
|
|
211
169
|
onInput: {action: 'input', table: {disable: true}},
|
|
212
170
|
onClick: {action: 'click', table: {disable: true}},
|
|
213
171
|
},
|
|
@@ -222,6 +180,7 @@ export default {
|
|
|
222
180
|
},
|
|
223
181
|
docs: {
|
|
224
182
|
page: VcBaseDocs,
|
|
183
|
+
inlineStories: false, // Opt-out of inline rendering
|
|
225
184
|
},
|
|
226
185
|
},
|
|
227
186
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-text-field class="VcTextInput"
|
|
3
3
|
dense
|
|
4
|
+
:class="{'no-label': !label}"
|
|
4
5
|
:data-qa="dataQa"
|
|
5
6
|
:label="label"
|
|
6
7
|
:placeholder="placeholder"
|
|
@@ -311,6 +312,9 @@ export default {
|
|
|
311
312
|
.v-text-field__slot {
|
|
312
313
|
margin-bottom: -14px;
|
|
313
314
|
}
|
|
315
|
+
&.no-label .v-text-field__slot {
|
|
316
|
+
margin-bottom: unset;
|
|
317
|
+
}
|
|
314
318
|
}
|
|
315
319
|
|
|
316
320
|
&.v-input--is-disabled {
|
package/src/components/index.js
CHANGED
|
@@ -64,3 +64,4 @@ export {default as VcTimeSince} from './VcTimeSince/VcTimeSince.vue';
|
|
|
64
64
|
export {default as VcSearchPicker} from './VcSearchPicker/VcSearchPicker.vue';
|
|
65
65
|
export {default as VcDraggableList} from './VcDraggableList/VcDraggableList.vue';
|
|
66
66
|
export {default as VcTabs} from './VcTabs/VcTabs.vue';
|
|
67
|
+
export {default as VcSideNav} from './VcSideNav/VcSideNav.vue';
|
|
@@ -247,8 +247,8 @@ MobileSingleSelectPickerWithAvatars.parameters = {
|
|
|
247
247
|
readonly
|
|
248
248
|
append-icon="$chevron_right"
|
|
249
249
|
@click="showDialog = true">
|
|
250
|
-
<template #prepend-inner>
|
|
251
|
-
[
|
|
250
|
+
<template #prepend-inner="data">
|
|
251
|
+
[1. implement selected item]
|
|
252
252
|
</template>
|
|
253
253
|
</VcTextField>
|
|
254
254
|
|
|
@@ -261,21 +261,30 @@ MobileSingleSelectPickerWithAvatars.parameters = {
|
|
|
261
261
|
@search="onSearch"
|
|
262
262
|
style="margin-bottom: 16px"/>
|
|
263
263
|
<VcList :items="items"
|
|
264
|
-
:image-path="[
|
|
264
|
+
:image-path="[2. (optional) - pass empty state image]"
|
|
265
265
|
:empty-list-msg="$t('your.emptyListMsg.here')"
|
|
266
266
|
@select="onSelect">
|
|
267
|
-
<template #default="
|
|
268
|
-
[
|
|
267
|
+
<template #default="data">
|
|
268
|
+
[3. your list item implementation]
|
|
269
269
|
</template>
|
|
270
270
|
</VcList>
|
|
271
271
|
</template>
|
|
272
272
|
</VcInputModal>
|
|
273
273
|
</template>
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
TODO: - to get this code running you need to
|
|
277
|
+
1. Implement selected item - display the current selected item
|
|
278
|
+
2. Optional - pass empty state image, or you can delete this line
|
|
279
|
+
3. Your list item implementation - display each item on the list
|
|
280
|
+
4. YourPageHere - declare the name of your page
|
|
281
|
+
5. YourStoreModule - map the items data to the store (the don't have to be called "items")
|
|
282
|
+
*/
|
|
274
283
|
|
|
275
284
|
import {mapGetters} from "vuex";
|
|
276
285
|
|
|
277
286
|
export default {
|
|
278
|
-
name: "[YourPageHere]",
|
|
287
|
+
name: "[4. YourPageHere]",
|
|
279
288
|
data() {
|
|
280
289
|
return {
|
|
281
290
|
showDialog: false,
|
|
@@ -284,7 +293,7 @@ MobileSingleSelectPickerWithAvatars.parameters = {
|
|
|
284
293
|
};
|
|
285
294
|
},
|
|
286
295
|
computed: {
|
|
287
|
-
...mapGetters("[
|
|
296
|
+
...mapGetters("[5. YourStoreModule]", ["items"]),
|
|
288
297
|
},
|
|
289
298
|
methods: {
|
|
290
299
|
onSearch(search) {
|
|
@@ -295,7 +304,12 @@ MobileSingleSelectPickerWithAvatars.parameters = {
|
|
|
295
304
|
// Handle any other reaction to selection change
|
|
296
305
|
},
|
|
297
306
|
},
|
|
298
|
-
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
<style lang="scss" scoped>
|
|
310
|
+
// Your css here
|
|
311
|
+
</style>
|
|
312
|
+
`,
|
|
299
313
|
type: "auto",
|
|
300
314
|
},
|
|
301
315
|
},
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import VcListEntityCmp from './VcListEntity.vue';
|
|
2
2
|
import VcBaseDocs from "@/stories/VcBaseDocs.mdx";
|
|
3
3
|
|
|
4
|
+
const baseProps = {
|
|
5
|
+
disabled: false,
|
|
6
|
+
value: false,
|
|
7
|
+
title: 'text for <b>storybook</b>',
|
|
8
|
+
dataQa: 'VcListEntity',
|
|
9
|
+
};
|
|
10
|
+
|
|
4
11
|
const Template = (args, {argTypes}) => ({
|
|
5
12
|
components: {VcListEntity: VcListEntityCmp},
|
|
6
13
|
props: Object.keys(argTypes),
|
|
@@ -10,6 +17,7 @@ const Template = (args, {argTypes}) => ({
|
|
|
10
17
|
template: `
|
|
11
18
|
<div>
|
|
12
19
|
<VcListEntity :disabled="disabled" v-model="itemValue" :value="itemValue" :title="title"
|
|
20
|
+
:data-qa="dataQa"
|
|
13
21
|
@input="onInput"></VcListEntity>
|
|
14
22
|
</div>`,
|
|
15
23
|
watch: {
|
|
@@ -23,27 +31,15 @@ export const Playground = Template.bind({});
|
|
|
23
31
|
|
|
24
32
|
// Set default values
|
|
25
33
|
Playground.args = {
|
|
26
|
-
|
|
27
|
-
value: false,
|
|
28
|
-
title: 'text to <b>storybook</b>'
|
|
34
|
+
...baseProps,
|
|
29
35
|
}
|
|
30
36
|
|
|
31
|
-
const
|
|
32
|
-
components: {VcListEntity: VcListEntityCmp},
|
|
33
|
-
props: Object.keys(argTypes),
|
|
34
|
-
data: () => ({
|
|
35
|
-
itemValue: true,
|
|
36
|
-
}),
|
|
37
|
-
template: '<div><VcListEntity :disabled="disabled" :value="itemValue" :title="title" /></div>',
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
export const Disabled = TemplateDisabled.bind({});
|
|
37
|
+
export const Disabled = Template.bind({});
|
|
41
38
|
|
|
42
39
|
// Set default values
|
|
43
40
|
Disabled.args = {
|
|
41
|
+
...baseProps,
|
|
44
42
|
disabled: true,
|
|
45
|
-
value: false,
|
|
46
|
-
title: 'text to <b>storybook</b>'
|
|
47
43
|
}
|
|
48
44
|
|
|
49
45
|
const TemplateWithSlot = (args, {argTypes}) => ({
|
|
@@ -54,7 +50,8 @@ const TemplateWithSlot = (args, {argTypes}) => ({
|
|
|
54
50
|
}),
|
|
55
51
|
template: `
|
|
56
52
|
<div>
|
|
57
|
-
<VcListEntity :disabled="disabled" :value="itemValue" :title="title"
|
|
53
|
+
<VcListEntity :disabled="disabled" :value="itemValue" :title="title" :data-qa="dataQa"
|
|
54
|
+
@input="onInput">
|
|
58
55
|
<template v-slot:icon>
|
|
59
56
|
<v-icon size="12">home</v-icon>
|
|
60
57
|
</template>
|
|
@@ -66,9 +63,7 @@ export const WithSlot = TemplateWithSlot.bind({});
|
|
|
66
63
|
|
|
67
64
|
// Set default values
|
|
68
65
|
WithSlot.args = {
|
|
69
|
-
|
|
70
|
-
value: false,
|
|
71
|
-
title: 'text to <b>storybook</b>'
|
|
66
|
+
...baseProps,
|
|
72
67
|
}
|
|
73
68
|
|
|
74
69
|
|
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
import VcConfirmModalCmp from './VcConfirmModal';
|
|
2
2
|
import VcModalFooter from "@/components/modal/elements/VcModalFooter";
|
|
3
3
|
import VcBaseDocs from "@/stories/VcBaseDocs.mdx";
|
|
4
|
+
import icons from "../../../../init/SvgIcons";
|
|
5
|
+
|
|
6
|
+
const baseProps = {
|
|
7
|
+
showDialog: true,
|
|
8
|
+
useOffset: true,
|
|
9
|
+
topTitle: '',
|
|
10
|
+
title: 'Some header text',
|
|
11
|
+
subtitle: '',
|
|
12
|
+
contentText: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
|
13
|
+
size: 'lg',
|
|
14
|
+
okButtonLabel: '',
|
|
15
|
+
cancelButtonLabel: '',
|
|
16
|
+
headerImage: '',
|
|
17
|
+
headerIcon: '',
|
|
18
|
+
loading: false,
|
|
19
|
+
dataQa: 'VcConfirmModal',
|
|
20
|
+
};
|
|
4
21
|
|
|
5
22
|
const Template = (args, {argTypes}) => ({
|
|
6
23
|
components: {VcConfirmModal: VcConfirmModalCmp},
|
|
@@ -9,13 +26,18 @@ const Template = (args, {argTypes}) => ({
|
|
|
9
26
|
<div>
|
|
10
27
|
<VcConfirmModal
|
|
11
28
|
:show-dialog="showDialog"
|
|
12
|
-
:useOffset="useOffset"
|
|
13
|
-
:
|
|
29
|
+
:useOffset="useOffset"
|
|
30
|
+
:topTitle="topTitle"
|
|
31
|
+
:title="title"
|
|
32
|
+
:subtitle="subtitle"
|
|
14
33
|
:header-icon="headerIcon"
|
|
34
|
+
:header-image="headerImage"
|
|
15
35
|
:content-text="contentText"
|
|
16
36
|
:size="size"
|
|
17
37
|
:ok-button-label="okButtonLabel"
|
|
18
38
|
:cancel-button-label="cancelButtonLabel"
|
|
39
|
+
:loading="loading"
|
|
40
|
+
:data-qa="dataQa"
|
|
19
41
|
@onCloseButtonClicked="onCloseButtonClicked"
|
|
20
42
|
@onOkClicked="onOkClicked"
|
|
21
43
|
@onCancelClicked="onCancelClicked"/>
|
|
@@ -26,28 +48,15 @@ export const Playground = Template.bind({});
|
|
|
26
48
|
|
|
27
49
|
// Set default values
|
|
28
50
|
Playground.args = {
|
|
29
|
-
|
|
30
|
-
useOffset: true,
|
|
31
|
-
topTitle: '',
|
|
32
|
-
title: 'Some header text',
|
|
33
|
-
subtitle: '',
|
|
34
|
-
contentText: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
|
35
|
-
size: 'lg',
|
|
36
|
-
okButtonLabel: undefined,
|
|
37
|
-
cancelButtonLabel: undefined,
|
|
51
|
+
...baseProps,
|
|
38
52
|
}
|
|
39
53
|
|
|
40
|
-
export const
|
|
54
|
+
export const WithHeaderIcon = Template.bind({});
|
|
41
55
|
|
|
42
56
|
// Set default values
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
headerIcon: 'mdi-delete',
|
|
47
|
-
contentText: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
|
48
|
-
size: 'lg',
|
|
49
|
-
buttons: [{label: "Cancel", event: "onCancelClicked", color: "white"},
|
|
50
|
-
{label: "Archive", event: "onOkClicked", color: "primary"},]
|
|
57
|
+
WithHeaderIcon.args = {
|
|
58
|
+
...baseProps,
|
|
59
|
+
headerIcon: '$trash',
|
|
51
60
|
}
|
|
52
61
|
|
|
53
62
|
const UsingFooterSlotTemplate = (args, {argTypes}) => ({
|
|
@@ -55,9 +64,19 @@ const UsingFooterSlotTemplate = (args, {argTypes}) => ({
|
|
|
55
64
|
props: Object.keys(argTypes),
|
|
56
65
|
template: `
|
|
57
66
|
<div>
|
|
58
|
-
<VcConfirmModal :show-dialog="showDialog"
|
|
59
|
-
:
|
|
60
|
-
:
|
|
67
|
+
<VcConfirmModal :show-dialog="showDialog"
|
|
68
|
+
:useOffset="useOffset"
|
|
69
|
+
:topTitle="topTitle"
|
|
70
|
+
:title="title"
|
|
71
|
+
:subtitle="subtitle"
|
|
72
|
+
:header-icon="headerIcon"
|
|
73
|
+
:header-image="headerImage"
|
|
74
|
+
:content-text="contentText"
|
|
75
|
+
:size="size"
|
|
76
|
+
:ok-button-label="okButtonLabel"
|
|
77
|
+
:cancel-button-label="cancelButtonLabel"
|
|
78
|
+
:loading="loading"
|
|
79
|
+
:data-qa="dataQa">
|
|
61
80
|
<template #footer>
|
|
62
81
|
<VcModalFooter
|
|
63
82
|
:buttons='[
|
|
@@ -78,13 +97,8 @@ export const UsingFooterSlot = UsingFooterSlotTemplate.bind({});
|
|
|
78
97
|
|
|
79
98
|
// Set default values
|
|
80
99
|
UsingFooterSlot.args = {
|
|
81
|
-
|
|
82
|
-
title: 'Some header text',
|
|
100
|
+
...baseProps,
|
|
83
101
|
headerIcon: 'mdi-delete',
|
|
84
|
-
contentText: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
|
85
|
-
size: 'lg',
|
|
86
|
-
buttons: [{label: "Cancel", event: "onCancelClicked", color: "white"},
|
|
87
|
-
{label: "Archive", event: "onOkClicked", color: "primary"},]
|
|
88
102
|
}
|
|
89
103
|
|
|
90
104
|
const TemplateWithImage = (args, {argTypes}) => ({
|
|
@@ -95,30 +109,32 @@ const TemplateWithImage = (args, {argTypes}) => ({
|
|
|
95
109
|
return require('@/stories/assets/HeaderImage.svg');
|
|
96
110
|
},
|
|
97
111
|
},
|
|
98
|
-
template:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
112
|
+
template: `
|
|
113
|
+
<div>
|
|
114
|
+
<VcConfirmModal :show-dialog="showDialog"
|
|
115
|
+
:useOffset="useOffset"
|
|
116
|
+
:topTitle="topTitle"
|
|
117
|
+
:title="title"
|
|
118
|
+
:subtitle="subtitle"
|
|
119
|
+
:header-icon="headerIcon"
|
|
120
|
+
:header-image="headerImage"
|
|
121
|
+
:content-text="contentText"
|
|
122
|
+
:size="size"
|
|
123
|
+
:ok-button-label="okButtonLabel"
|
|
124
|
+
:cancel-button-label="cancelButtonLabel"
|
|
125
|
+
:loading="loading"
|
|
126
|
+
@onCloseButtonClicked="onCloseButtonClicked"
|
|
127
|
+
@onOkClicked="onOkClicked"
|
|
128
|
+
@onCancelClicked="onCancelClicked"/>
|
|
129
|
+
</div>`,
|
|
109
130
|
})
|
|
110
131
|
|
|
111
132
|
export const WithHeaderImage = TemplateWithImage.bind({});
|
|
112
133
|
|
|
113
134
|
// Set default values
|
|
114
135
|
WithHeaderImage.args = {
|
|
115
|
-
|
|
136
|
+
...baseProps,
|
|
116
137
|
topTitle: 'Top title',
|
|
117
|
-
title: 'Some header text',
|
|
118
|
-
contentText: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
|
119
|
-
size: 'lg',
|
|
120
|
-
buttons: [{label: "Cancel", event: "onCancelClicked", color: "white"},
|
|
121
|
-
{label: "Archive", event: "onOkClicked", color: "primary"},]
|
|
122
138
|
}
|
|
123
139
|
|
|
124
140
|
export default {
|
|
@@ -130,6 +146,17 @@ export default {
|
|
|
130
146
|
options: ['sm', 'md', 'lg'],
|
|
131
147
|
control: {type: 'radio'}
|
|
132
148
|
},
|
|
149
|
+
headerIcon: {
|
|
150
|
+
options: Object.keys(icons).map(item => `$${item}`),
|
|
151
|
+
control: {type: 'select'},
|
|
152
|
+
table: {category: 'header'},
|
|
153
|
+
},
|
|
154
|
+
headerImage: {table: {category: 'header'}},
|
|
155
|
+
topTitle: {table: {category: 'header'}},
|
|
156
|
+
title: {table: {category: 'header'}},
|
|
157
|
+
subtitle: {table: {category: 'header'}},
|
|
158
|
+
okButtonLabel: {table: {category: 'footer'}},
|
|
159
|
+
cancelButtonLabel: {table: {category: 'footer'}},
|
|
133
160
|
onContactClicked: {action: 'onContactClicked', table: {disable: true}},
|
|
134
161
|
onClearClicked: {action: 'onClearClicked', table: {disable: true}},
|
|
135
162
|
onSaveClicked: {action: 'onSaveClicked', table: {disable: true}},
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<VcModalContainer showCloseButton
|
|
3
3
|
:useOffset="useOffset"
|
|
4
4
|
:showDialog="showDialog" :size="$vuetify.breakpoint.mdAndUp ? size : 'responsive'"
|
|
5
|
+
:data-qa="dataQa"
|
|
5
6
|
@onCloseButtonClicked="$emit('onCloseButtonClicked')">
|
|
6
7
|
<template #header>
|
|
7
8
|
<slot name="header">
|
|
@@ -10,7 +11,9 @@
|
|
|
10
11
|
@onCloseButtonClicked="$emit('onCloseButtonClicked')"/>
|
|
11
12
|
</slot>
|
|
12
13
|
</template>
|
|
13
|
-
<template #content>
|
|
14
|
+
<template #content>
|
|
15
|
+
<slot name="content"> {{ contentText }}</slot>
|
|
16
|
+
</template>
|
|
14
17
|
<template #footer>
|
|
15
18
|
<slot name="footer">
|
|
16
19
|
<VcModalFooter
|
|
@@ -65,6 +68,9 @@ export default {
|
|
|
65
68
|
type: String,
|
|
66
69
|
required: false
|
|
67
70
|
},
|
|
71
|
+
/**
|
|
72
|
+
* In case the component is being displayed in an iframe, and so can become un centered, this allows to correct the position, when combined with the --modal-desktop-offset css variable.
|
|
73
|
+
*/
|
|
68
74
|
useOffset: {
|
|
69
75
|
type: Boolean,
|
|
70
76
|
default: true
|
|
@@ -85,7 +91,11 @@ export default {
|
|
|
85
91
|
loading: {
|
|
86
92
|
type: Boolean,
|
|
87
93
|
default: false
|
|
88
|
-
}
|
|
94
|
+
},
|
|
95
|
+
dataQa: {
|
|
96
|
+
type: String,
|
|
97
|
+
default: 'VcConfirmModal',
|
|
98
|
+
},
|
|
89
99
|
}
|
|
90
100
|
}
|
|
91
101
|
</script>
|