@vcita/design-system 1.2.1 → 1.2.3
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 +11 -0
- package/config/locales/ds.en.yml +5 -1
- package/dist/@vcita/design-system.esm.js +1492 -913
- package/dist/@vcita/design-system.min.js +2 -2
- package/dist/@vcita/design-system.ssr.js +1290 -811
- package/package.json +1 -1
- package/src/components/VcAvatar/VcAvatar.stories.js +0 -1
- 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/VcGalleryItem/VcGalleryItem.spec.js +120 -0
- package/src/components/VcGalleryItem/VcGalleryItem.stories.js +94 -0
- package/src/components/VcGalleryItem/VcGalleryItem.vue +161 -0
- package/src/components/VcGalleryList/VcGalleryList.spec.js +86 -0
- package/src/components/VcGalleryList/VcGalleryList.stories.js +63 -0
- package/src/components/VcGalleryList/VcGalleryList.vue +102 -0
- package/src/components/VcGalleryList/mockData.js +50 -0
- package/src/components/VcIcon/VcIcon.stories.js +30 -7
- package/src/components/VcIcon/VcIcon.vue +11 -2
- package/src/components/VcMiniBanner/VcMiniBanner.spec.js +74 -0
- package/src/components/VcMiniBanner/VcMiniBanner.stories.js +75 -0
- package/src/components/VcMiniBanner/VcMiniBanner.vue +129 -0
- package/src/components/VcSearchPicker/VcSearchPicker.vue +12 -5
- 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 +4 -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
- package/src/stories/assets/app-market/fc.svg +31 -0
- package/src/stories/assets/app-market/google.svg +1 -0
- package/src/stories/assets/app-market/qb.svg +9 -0
- package/src/stories/assets/app-market/stripe.svg +1 -0
- package/src/stories/assets/app-market/zapier.svg +1 -0
- package/src/stories/assets/pics/gallery-item-1.jpg +0 -0
- package/src/stories/assets/pics/gallery-item-2.jpg +0 -0
- package/src/stories/assets/pics/gallery-item-3.jpg +0 -0
- package/src/stories/assets/pics/gallery-item-4.jpg +0 -0
- package/src/stories/assets/pics/gallery-item-5.jpg +0 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
2
|
+
import VcSideNav from "./VcSideNav.vue";
|
|
3
|
+
import Vue from 'vue';
|
|
4
|
+
import Vuetify from 'vuetify';
|
|
5
|
+
import {render} from "@testing-library/vue";
|
|
6
|
+
import init from "../../../testing-library.config";
|
|
7
|
+
import userEvent from "@testing-library/user-event";
|
|
8
|
+
|
|
9
|
+
init();
|
|
10
|
+
|
|
11
|
+
Vue.use(Vuetify);
|
|
12
|
+
|
|
13
|
+
describe("VcSideNav.vue", () => {
|
|
14
|
+
const renderWithVuetify = (component, options, callback, isMobile = false) => {
|
|
15
|
+
const root = document.createElement('div')
|
|
16
|
+
root.setAttribute('data-app', 'true')
|
|
17
|
+
|
|
18
|
+
const vuetify = new Vuetify()
|
|
19
|
+
if (isMobile) {
|
|
20
|
+
const breakpoint = {
|
|
21
|
+
init: jest.fn(),
|
|
22
|
+
framework: {},
|
|
23
|
+
smAndDown: true,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
vuetify.framework.breakpoint = breakpoint;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return render(
|
|
30
|
+
component,
|
|
31
|
+
{
|
|
32
|
+
container: document.body.appendChild(root),
|
|
33
|
+
// for Vuetify components that use the vuetify instance property
|
|
34
|
+
vuetify,
|
|
35
|
+
...options,
|
|
36
|
+
mocks: {
|
|
37
|
+
$t: value => value,
|
|
38
|
+
$dst: value => value, // <- for the design system
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
callback,
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const navGroupsData = [
|
|
46
|
+
{id: 1, label: 'Group 1', items: [{id: '1', label: 'Item 1'},{id: '2', label: 'Item 2'}]},
|
|
47
|
+
{id: 2, label: 'Group 2', items: [{id: '3', label: 'Item 3'},{id: '4', label: 'Item 4'}]}
|
|
48
|
+
]
|
|
49
|
+
const slotItemText = 'item as slot';
|
|
50
|
+
const slotGroupHeaderText = 'group header as slot';
|
|
51
|
+
|
|
52
|
+
it ("mount with all elements", async ()=> {
|
|
53
|
+
const {container, getByTestId} = renderWithVuetify(VcSideNav, {props: {navGroups: navGroupsData}})
|
|
54
|
+
|
|
55
|
+
expect(container).toHaveAttribute('data-app', "true")
|
|
56
|
+
const component = getByTestId('VcSideNav');
|
|
57
|
+
expect(component).toBeInTheDocument()
|
|
58
|
+
navGroupsData.forEach((group) => {
|
|
59
|
+
// Verify Groups
|
|
60
|
+
let groupElement = getByTestId(group.id)
|
|
61
|
+
expect(groupElement).toBeInTheDocument()
|
|
62
|
+
group.items.forEach((item) => {
|
|
63
|
+
// Verify Items
|
|
64
|
+
let itemElement = getByTestId(`item-${item.id}`)
|
|
65
|
+
expect(itemElement).toBeInTheDocument()
|
|
66
|
+
})
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
it ("check selected items", async () => {
|
|
71
|
+
const {emitted, getByTestId, updateProps} = renderWithVuetify(VcSideNav, {props: {navGroups: navGroupsData, selected: '4'}})
|
|
72
|
+
const selectedCmp = getByTestId(`item-4`);
|
|
73
|
+
expect(selectedCmp).toBeInTheDocument()
|
|
74
|
+
expect(selectedCmp).toHaveClass("selected")
|
|
75
|
+
|
|
76
|
+
let item2 = getByTestId('item-2')
|
|
77
|
+
await userEvent.click(item2)
|
|
78
|
+
expect(emitted().change.length).toBe(1);
|
|
79
|
+
expect(emitted().change[0]).toEqual(["2"]);
|
|
80
|
+
|
|
81
|
+
await updateProps({selected: '2'})
|
|
82
|
+
item2 = getByTestId('item-2')
|
|
83
|
+
expect(item2).toHaveClass("selected")
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
it ("check slot usage", async () => {
|
|
87
|
+
const {getByText} = renderWithVuetify(VcSideNav, {
|
|
88
|
+
props: {navGroups: navGroupsData, selected: '2'}
|
|
89
|
+
,
|
|
90
|
+
slots: {
|
|
91
|
+
"item-2" : slotItemText,
|
|
92
|
+
"group-1-header" : slotGroupHeaderText,
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
const slotItem = getByText(slotItemText);
|
|
96
|
+
expect(slotItem).toBeInTheDocument()
|
|
97
|
+
expect(slotItem).toHaveClass("selected")
|
|
98
|
+
|
|
99
|
+
const slotGroupHeader = getByText(slotGroupHeaderText);
|
|
100
|
+
expect(slotGroupHeader).toBeInTheDocument()
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
})
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import VcSideNav from './VcSideNav';
|
|
2
|
+
import VcIcon from "@/components/VcIcon/VcIcon";
|
|
3
|
+
import VcBadge from "@/components/VcBadge/VcBadge";
|
|
4
|
+
import VcBaseDocs from "@/stories/VcBaseDocs.mdx";
|
|
5
|
+
|
|
6
|
+
const basicProps = {
|
|
7
|
+
navGroups: [
|
|
8
|
+
{
|
|
9
|
+
label: 'GROUP 1',
|
|
10
|
+
id: 1,
|
|
11
|
+
items: [
|
|
12
|
+
{id: '1', label: 'Menu Item'},
|
|
13
|
+
{id: '2', label: 'Menu Item'},
|
|
14
|
+
{id: '3', label: 'Menu Item'},
|
|
15
|
+
{id: '4', label: 'Menu Item'},
|
|
16
|
+
{id: '5', label: 'Menu Item', disabled: true},
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
label: 'GROUP 2',
|
|
21
|
+
id: 2,
|
|
22
|
+
items: [
|
|
23
|
+
{id: '6', label: 'Menu Item'},
|
|
24
|
+
{id: '7', label: 'Menu Item'},
|
|
25
|
+
{id: '8', label: 'Menu Item'},
|
|
26
|
+
{id: '9', label: 'Menu Item'},
|
|
27
|
+
{id: '10', label: 'Menu Item'},
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
dataQa: 'VcSideNav',
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
const Template = (args, {argTypes}) => ({
|
|
36
|
+
components: {VcSideNav: VcSideNav},
|
|
37
|
+
props: Object.keys(argTypes),
|
|
38
|
+
data: () => ({
|
|
39
|
+
selectedIdx: '1',
|
|
40
|
+
}),
|
|
41
|
+
template: `<div>
|
|
42
|
+
<VcSideNav :navGroups="navGroups" v-model="selectedIdx" @change="onChange">
|
|
43
|
+
</VcSideNav>
|
|
44
|
+
</div>`,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export const Playground = Template.bind({});
|
|
48
|
+
|
|
49
|
+
Playground.args = {
|
|
50
|
+
...basicProps,
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const UsingSlotsTemplate = (args, {argTypes}) => ({
|
|
54
|
+
components: {VcSideNav: VcSideNav, VcIcon: VcIcon, VcBadge: VcBadge},
|
|
55
|
+
props: Object.keys(argTypes),
|
|
56
|
+
data: () => ({
|
|
57
|
+
selectedIdx: '',
|
|
58
|
+
navGroupsData: [{id: 1, label: 'GROUP', items: [{id: '0', label: 'This is place holder'},{id: '1', label: 'This is place holder'}]}]
|
|
59
|
+
}),
|
|
60
|
+
template: `
|
|
61
|
+
<div>
|
|
62
|
+
<VcSideNav :navGroups="navGroupsData" v-model="selectedIdx" @change="onChange">
|
|
63
|
+
<template #group-1-header>
|
|
64
|
+
<div class="d-flex align-center">
|
|
65
|
+
<span>Group Title</span>
|
|
66
|
+
<VcBadge class="ps-2" badgeText="new" :offsetX="-2" :offsetY="0"></VcBadge>
|
|
67
|
+
</div>
|
|
68
|
+
</template>
|
|
69
|
+
<template #item-0>
|
|
70
|
+
<div class="d-flex align-center flex-grow-1 justify-space-between px-6">
|
|
71
|
+
<span>Slot Label</span>
|
|
72
|
+
<div class="d-flex align-center">
|
|
73
|
+
<vc-icon size="16" color="black" class="mx-3">$magnify_glass</vc-icon>
|
|
74
|
+
<vc-icon size="16" color="black" class="mx-3">$plus</vc-icon>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
</template>
|
|
78
|
+
|
|
79
|
+
<template #item-1>
|
|
80
|
+
<div class="d-flex align-center flex-grow-1 justify-space-between px-6">
|
|
81
|
+
<div class="d-flex align-center">
|
|
82
|
+
<span>Slot Label </span>
|
|
83
|
+
<VcBadge class="ps-2" badgeText="beta" :offsetX="-2" :offsetY="4"></VcBadge>
|
|
84
|
+
</div>
|
|
85
|
+
<vc-icon size="16" color="black" class="mx-3">$plus</vc-icon>
|
|
86
|
+
</div>
|
|
87
|
+
</template>
|
|
88
|
+
</VcSideNav>
|
|
89
|
+
</div>
|
|
90
|
+
`
|
|
91
|
+
})
|
|
92
|
+
export const UsingSlots = UsingSlotsTemplate.bind({});
|
|
93
|
+
|
|
94
|
+
UsingSlots.args = {}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
export default {
|
|
98
|
+
title: 'containers / VcSideNav',
|
|
99
|
+
component: VcSideNav,
|
|
100
|
+
id: 'VcSideNav',
|
|
101
|
+
argTypes: {
|
|
102
|
+
onChange: {action: 'change', table: {disable: true}},
|
|
103
|
+
|
|
104
|
+
},
|
|
105
|
+
parameters: {
|
|
106
|
+
design: {
|
|
107
|
+
type: 'figma',
|
|
108
|
+
url: 'https://www.figma.com/file/xIOY6fBoA1wpy1tHv3i5js/vcita---ui-library?node-id=11638%3A241955',
|
|
109
|
+
},
|
|
110
|
+
status: {
|
|
111
|
+
type: 'stable', // 'beta' | 'stable' | 'deprecated' | 'releaseCandidate'
|
|
112
|
+
},
|
|
113
|
+
docs: {
|
|
114
|
+
page: VcBaseDocs,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:data-qa="dataQa" class="side-nav d-flex flex-column">
|
|
4
|
+
<div class="side-nav__group"
|
|
5
|
+
v-for="group in navGroups"
|
|
6
|
+
:key="group.id"
|
|
7
|
+
:data-qa="group.id">
|
|
8
|
+
<div class="side-nav__group__header mb-2" >
|
|
9
|
+
<slot :name="`group-${group.id}-header`">
|
|
10
|
+
{{group.label}}
|
|
11
|
+
</slot>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="side-nav__group__container d-flex flex-column mb-5">
|
|
14
|
+
<div @click="$emit('change',item.id)"
|
|
15
|
+
:data-qa="`item-${item.id}`"
|
|
16
|
+
v-if="group.items"
|
|
17
|
+
v-for="(item) in group.items"
|
|
18
|
+
:key="item.id"
|
|
19
|
+
:class="{selected: item.id === selected, disabled: item.disabled, mobile: isMobile, 'rtl': $vuetify.rtl}"
|
|
20
|
+
class="side-nav__group__container__menu-item d-flex align-center flex-grow-1">
|
|
21
|
+
<slot :name="`item-${item.id}`" :item="item">
|
|
22
|
+
<div class="d-flex justify-space-between px-4 align-center flex-grow-1">
|
|
23
|
+
<span>{{item.label}}</span>
|
|
24
|
+
<vcIcon size="12" v-if="isMobile">$chevron_right</vcIcon>
|
|
25
|
+
</div>
|
|
26
|
+
</slot>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</template>
|
|
32
|
+
<script>
|
|
33
|
+
import VcIcon from "@/components/VcIcon/VcIcon.vue";
|
|
34
|
+
export default {
|
|
35
|
+
name: "VcSideNav",
|
|
36
|
+
components: {VcIcon},
|
|
37
|
+
props: {
|
|
38
|
+
dataQa: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: 'VcSideNav'
|
|
41
|
+
},
|
|
42
|
+
selected: {
|
|
43
|
+
type: String,
|
|
44
|
+
required: true,
|
|
45
|
+
},
|
|
46
|
+
navGroups: {
|
|
47
|
+
type: Array,
|
|
48
|
+
validator: prop => prop.every((group) => group.label && group.id)
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
model: {
|
|
52
|
+
prop: 'selected',
|
|
53
|
+
event: 'change'
|
|
54
|
+
},
|
|
55
|
+
computed: {
|
|
56
|
+
isMobile(){
|
|
57
|
+
return !this.$vuetify.breakpoint.mdAndUp
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<style lang="scss" scoped>
|
|
64
|
+
.side-nav{
|
|
65
|
+
&__group{
|
|
66
|
+
&__header{
|
|
67
|
+
font-size: var(--font-size-xx-small);
|
|
68
|
+
font-weight: var(--font-weight-large);
|
|
69
|
+
line-height: var(--size-value5);
|
|
70
|
+
color: var(--gray-darken-2);
|
|
71
|
+
}
|
|
72
|
+
&__container{
|
|
73
|
+
border-radius: var(--border-radius);
|
|
74
|
+
background-color: var(--modal-bg-color);
|
|
75
|
+
box-shadow: var(--shadow-1);
|
|
76
|
+
&__menu-item{
|
|
77
|
+
cursor: pointer;
|
|
78
|
+
box-sizing: border-box;
|
|
79
|
+
height: var(--size-value11);
|
|
80
|
+
font-weight: var(--font-weight-medium2);
|
|
81
|
+
font-size: var(--font-size-x-small);
|
|
82
|
+
border-inline-start: 3px solid var(--modal-bg-color);
|
|
83
|
+
transition: 0.3s;
|
|
84
|
+
transition-property: border-color, background-color;
|
|
85
|
+
&:first-of-type{
|
|
86
|
+
margin-top: var(--size-value1);
|
|
87
|
+
}
|
|
88
|
+
&:last-of-type{
|
|
89
|
+
margin-bottom: var(--size-value1);
|
|
90
|
+
}
|
|
91
|
+
&:hover{
|
|
92
|
+
border-color: var(--gray-lighten-3);
|
|
93
|
+
background-color: var(--gray-lighten-3);
|
|
94
|
+
}
|
|
95
|
+
&:focus{
|
|
96
|
+
border: 3px solid var(--v-secondary-lighten1);
|
|
97
|
+
}
|
|
98
|
+
&:active:not(.mobile){
|
|
99
|
+
border-color: var(--gray-lighten-1);
|
|
100
|
+
background-color: var(--gray-lighten-1);
|
|
101
|
+
}
|
|
102
|
+
&.selected{
|
|
103
|
+
font-weight: var(--font-weight-large);
|
|
104
|
+
}
|
|
105
|
+
&.selected:not(.mobile){
|
|
106
|
+
border-inline-start: 3px solid var(--v-secondary-base);
|
|
107
|
+
}
|
|
108
|
+
&.disabled{
|
|
109
|
+
cursor: unset;
|
|
110
|
+
pointer-events: none;
|
|
111
|
+
border-color: var(--gray-lighten-3);
|
|
112
|
+
background-color: var(--gray-lighten-3);
|
|
113
|
+
color: var(--gray-darken-2);
|
|
114
|
+
}
|
|
115
|
+
&.mobile{
|
|
116
|
+
color: var(--gray-darken-5);
|
|
117
|
+
height: var(--size-value13);
|
|
118
|
+
::v-deep{
|
|
119
|
+
svg.vc-chevron-right {
|
|
120
|
+
fill: var(--gray-darken-2);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
&.rtl{
|
|
124
|
+
::v-deep{
|
|
125
|
+
svg.vc-chevron-right {
|
|
126
|
+
-webkit-transform: scaleX(-1);
|
|
127
|
+
transform: scaleX(-1);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
</style>
|
|
@@ -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,7 @@ 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';
|
|
68
|
+
export {default as VcMiniBanner} from './VcMiniBanner/VcMiniBanner.vue';
|
|
69
|
+
export {default as VcGalleryItem} from './VcGalleryItem/VcGalleryItem.vue';
|
|
70
|
+
export {default as VcGalleryList} from './VcGalleryList/VcGalleryList.vue';
|