@gorse/shards-vue 1.0.8
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/.editorconfig +13 -0
- package/CHANGELOG.md +49 -0
- package/CONTRIBUTING.md +92 -0
- package/ISSUE_TEMPLATE.md +19 -0
- package/LICENSE +21 -0
- package/README.md +157 -0
- package/build/optimize.js +49 -0
- package/build/paths.js +12 -0
- package/build/rollup.config.js +106 -0
- package/dist/shards-vue.common.js +13994 -0
- package/dist/shards-vue.common.js.map +1 -0
- package/dist/shards-vue.common.min.js +1 -0
- package/dist/shards-vue.common.min.map +1 -0
- package/dist/shards-vue.esm.js +13990 -0
- package/dist/shards-vue.esm.js.map +1 -0
- package/dist/shards-vue.esm.min.js +1 -0
- package/dist/shards-vue.esm.min.map +1 -0
- package/dist/shards-vue.umd.js +13997 -0
- package/dist/shards-vue.umd.js.map +1 -0
- package/dist/shards-vue.umd.min.js +1 -0
- package/dist/shards-vue.umd.min.map +1 -0
- package/logo.jpg +0 -0
- package/package.json +121 -0
- package/sandbox/Sandbox.vue +45 -0
- package/src/components/alert/Alert.vue +156 -0
- package/src/components/alert/README.md +86 -0
- package/src/components/alert/index.js +17 -0
- package/src/components/badge/Badge.vue +62 -0
- package/src/components/badge/README.md +112 -0
- package/src/components/badge/index.js +17 -0
- package/src/components/breadcrumb/Breadcrumb.vue +55 -0
- package/src/components/breadcrumb/BreadcrumbItem.vue +42 -0
- package/src/components/breadcrumb/BreadcrumbLink.vue +56 -0
- package/src/components/breadcrumb/README.md +53 -0
- package/src/components/breadcrumb/index.js +23 -0
- package/src/components/button/Button.vue +107 -0
- package/src/components/button/ButtonClose.vue +47 -0
- package/src/components/button/README.md +197 -0
- package/src/components/button/index.js +21 -0
- package/src/components/button-group/ButtonGroup.vue +66 -0
- package/src/components/button-group/README.md +72 -0
- package/src/components/button-group/index.js +18 -0
- package/src/components/button-toolbar/ButtonToolbar.vue +29 -0
- package/src/components/button-toolbar/README.md +24 -0
- package/src/components/button-toolbar/index.js +18 -0
- package/src/components/card/Card.vue +57 -0
- package/src/components/card/CardBody.vue +92 -0
- package/src/components/card/CardFooter.vue +61 -0
- package/src/components/card/CardGroup.vue +47 -0
- package/src/components/card/CardHeader.vue +61 -0
- package/src/components/card/CardImg.vue +64 -0
- package/src/components/card/README.md +96 -0
- package/src/components/card/index.js +27 -0
- package/src/components/collapse/Collapse.vue +209 -0
- package/src/components/collapse/README.md +86 -0
- package/src/components/collapse/index.js +17 -0
- package/src/components/container/Col.vue +125 -0
- package/src/components/container/Container.vue +31 -0
- package/src/components/container/README.md +91 -0
- package/src/components/container/Row.vue +64 -0
- package/src/components/container/index.js +21 -0
- package/src/components/datepicker/Datepicker.vue +391 -0
- package/src/components/datepicker/README.md +185 -0
- package/src/components/datepicker/index.js +17 -0
- package/src/components/dropdown/Dropdown.vue +442 -0
- package/src/components/dropdown/DropdownDivider.vue +22 -0
- package/src/components/dropdown/DropdownHeader.vue +29 -0
- package/src/components/dropdown/DropdownItem.vue +25 -0
- package/src/components/dropdown/README.md +177 -0
- package/src/components/dropdown/index.js +23 -0
- package/src/components/embed/Embed.vue +47 -0
- package/src/components/embed/README.md +23 -0
- package/src/components/embed/index.js +17 -0
- package/src/components/form/Form.vue +40 -0
- package/src/components/form/FormFeedback.vue +39 -0
- package/src/components/form/FormInvalidFeedback.vue +39 -0
- package/src/components/form/FormRow.vue +21 -0
- package/src/components/form/FormText.vue +41 -0
- package/src/components/form/FormValidFeedback.vue +39 -0
- package/src/components/form/README.md +84 -0
- package/src/components/form/index.js +29 -0
- package/src/components/form-checkbox/FormCheckbox.vue +200 -0
- package/src/components/form-checkbox/README.md +131 -0
- package/src/components/form-checkbox/index.js +18 -0
- package/src/components/form-input/FormInput.vue +176 -0
- package/src/components/form-input/README.md +110 -0
- package/src/components/form-input/index.js +18 -0
- package/src/components/form-radio/FormRadio.vue +155 -0
- package/src/components/form-radio/README.md +61 -0
- package/src/components/form-radio/index.js +18 -0
- package/src/components/form-select/FormSelect.vue +246 -0
- package/src/components/form-select/README.md +180 -0
- package/src/components/form-select/index.js +18 -0
- package/src/components/form-textarea/FormTextarea.vue +250 -0
- package/src/components/form-textarea/README.md +74 -0
- package/src/components/form-textarea/index.js +18 -0
- package/src/components/image/Image.vue +123 -0
- package/src/components/image/README.md +32 -0
- package/src/components/image/index.js +18 -0
- package/src/components/index.js +63 -0
- package/src/components/input-group/InputGroup.vue +125 -0
- package/src/components/input-group/InputGroupAddon.vue +58 -0
- package/src/components/input-group/InputGroupText.vue +20 -0
- package/src/components/input-group/README.md +188 -0
- package/src/components/input-group/index.js +21 -0
- package/src/components/link/Link.vue +157 -0
- package/src/components/link/README.md +27 -0
- package/src/components/link/create-link-props.js +54 -0
- package/src/components/link/index.js +17 -0
- package/src/components/list-group/ListGroup.vue +30 -0
- package/src/components/list-group/ListGroupItem.vue +90 -0
- package/src/components/list-group/README.md +23 -0
- package/src/components/list-group/index.js +19 -0
- package/src/components/modal/Modal.vue +121 -0
- package/src/components/modal/ModalBody.vue +20 -0
- package/src/components/modal/ModalFooter.vue +21 -0
- package/src/components/modal/ModalHeader.vue +39 -0
- package/src/components/modal/ModalTitle.vue +21 -0
- package/src/components/modal/README.md +74 -0
- package/src/components/modal/index.js +25 -0
- package/src/components/nav/Nav.vue +62 -0
- package/src/components/nav/NavItem.vue +23 -0
- package/src/components/nav/NavText.vue +21 -0
- package/src/components/nav/README.md +94 -0
- package/src/components/nav/index.js +19 -0
- package/src/components/navbar/Navbar.vue +63 -0
- package/src/components/navbar/NavbarBrand.vue +41 -0
- package/src/components/navbar/NavbarNav.vue +38 -0
- package/src/components/navbar/NavbarToggle.vue +55 -0
- package/src/components/navbar/README.md +51 -0
- package/src/components/navbar/index.js +23 -0
- package/src/components/popover/Popover.vue +126 -0
- package/src/components/popover/README.md +73 -0
- package/src/components/popover/index.js +17 -0
- package/src/components/progress/Progress.vue +93 -0
- package/src/components/progress/ProgressBar.vue +123 -0
- package/src/components/progress/README.md +95 -0
- package/src/components/progress/index.js +19 -0
- package/src/components/slider/README.md +120 -0
- package/src/components/slider/Slider.vue +103 -0
- package/src/components/slider/index.js +17 -0
- package/src/components/tabs/README.md +111 -0
- package/src/components/tabs/Tab.vue +132 -0
- package/src/components/tabs/Tabs.vue +290 -0
- package/src/components/tabs/_TabButton.vue +130 -0
- package/src/components/tabs/index.js +19 -0
- package/src/components/tooltip/README.md +70 -0
- package/src/components/tooltip/Tooltip.vue +115 -0
- package/src/components/tooltip/index.js +17 -0
- package/src/directives/index.js +7 -0
- package/src/directives/toggle/index.js +16 -0
- package/src/directives/toggle/toggle.js +45 -0
- package/src/directives/tooltip/README.md +42 -0
- package/src/directives/tooltip/index.js +16 -0
- package/src/directives/tooltip/meta.json +5 -0
- package/src/directives/tooltip/tooltip.js +145 -0
- package/src/index.js +27 -0
- package/src/markdown/getting-started/README.md +80 -0
- package/src/markdown/getting-started/meta.json +4 -0
- package/src/markdown/roadmap/README.md +3 -0
- package/src/markdown/roadmap/meta.json +4 -0
- package/src/mixins/checkbox-radio.mixin.js +73 -0
- package/src/mixins/root-listener.mixin.js +32 -0
- package/src/mixins/tooltip-popover.mixin.js +292 -0
- package/src/scripts/utils.js +18 -0
- package/src/utils/constants.js +191 -0
- package/src/utils/events.js +48 -0
- package/src/utils/index.js +251 -0
- package/src/utils/observer.js +56 -0
- package/src/utils/popover.class.js +91 -0
- package/src/utils/target.js +50 -0
- package/src/utils/tooltip.class.js +60 -0
- package/src/utils/tpmanager.class.js +730 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="tag" :class="[
|
|
3
|
+
'card-body',
|
|
4
|
+
overlay ? 'card-img-overlay' : '',
|
|
5
|
+
Boolean(bgTheme) ? `bg-${bgTheme}` : '',
|
|
6
|
+
Boolean(borderTheme) ? `border-${borderTheme}` : '',
|
|
7
|
+
Boolean(textTheme) ? `text-${textTheme}` : '',
|
|
8
|
+
bodyClass
|
|
9
|
+
]">
|
|
10
|
+
<component :is="titleTag" v-if="title" class="card-title" v-html="title" />
|
|
11
|
+
<component :is="subtitleTag" v-if="subtitle" class="card-subtitle mb-2 text-muted" v-html="subtitle"/>
|
|
12
|
+
<slot />
|
|
13
|
+
</component>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
export default {
|
|
18
|
+
name: 'd-card-body',
|
|
19
|
+
props: {
|
|
20
|
+
/**
|
|
21
|
+
* Element tag type.
|
|
22
|
+
*/
|
|
23
|
+
tag: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: 'div'
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* Background theme color.
|
|
29
|
+
*/
|
|
30
|
+
bgTheme: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: null
|
|
33
|
+
},
|
|
34
|
+
/**
|
|
35
|
+
* Border theme color.
|
|
36
|
+
*/
|
|
37
|
+
borderTheme: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: null
|
|
40
|
+
},
|
|
41
|
+
/**
|
|
42
|
+
* Text theme color.
|
|
43
|
+
*/
|
|
44
|
+
textTheme: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: null
|
|
47
|
+
},
|
|
48
|
+
/**
|
|
49
|
+
* Body class.
|
|
50
|
+
*/
|
|
51
|
+
bodyClass: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: ''
|
|
54
|
+
},
|
|
55
|
+
/**
|
|
56
|
+
* Body title value.
|
|
57
|
+
*/
|
|
58
|
+
title: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: null
|
|
61
|
+
},
|
|
62
|
+
/**
|
|
63
|
+
* Body title element tag type.
|
|
64
|
+
*/
|
|
65
|
+
titleTag: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: 'h4'
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* Body subtitle value.
|
|
71
|
+
*/
|
|
72
|
+
subtitle: {
|
|
73
|
+
type: String,
|
|
74
|
+
default: null
|
|
75
|
+
},
|
|
76
|
+
/**
|
|
77
|
+
* Body subtitle element tag type.
|
|
78
|
+
*/
|
|
79
|
+
subtitleTag: {
|
|
80
|
+
type: String,
|
|
81
|
+
default: 'h6'
|
|
82
|
+
},
|
|
83
|
+
/**
|
|
84
|
+
* Overlay.
|
|
85
|
+
*/
|
|
86
|
+
overlay: {
|
|
87
|
+
type: Boolean,
|
|
88
|
+
default: false
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
</script>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="tag" :class="[
|
|
3
|
+
'card-footer',
|
|
4
|
+
Boolean(bgTheme) ? `bg-${bgTheme}` : '',
|
|
5
|
+
Boolean(borderTheme) ? `border-${borderTheme}` : '',
|
|
6
|
+
Boolean(textTheme) ? `text-${textTheme}` : '',
|
|
7
|
+
footerClass
|
|
8
|
+
]">
|
|
9
|
+
<slot />
|
|
10
|
+
</component>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
export default {
|
|
15
|
+
name: 'd-card-footer',
|
|
16
|
+
props: {
|
|
17
|
+
/**
|
|
18
|
+
* Element tag type.
|
|
19
|
+
*/
|
|
20
|
+
tag: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: 'div'
|
|
23
|
+
},
|
|
24
|
+
/**
|
|
25
|
+
* Background theme color.
|
|
26
|
+
*/
|
|
27
|
+
bgTheme: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: null
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
* Border theme color.
|
|
33
|
+
*/
|
|
34
|
+
borderTheme: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: null
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* Text theme color.
|
|
40
|
+
*/
|
|
41
|
+
textTheme: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: null
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* Footer value.
|
|
47
|
+
*/
|
|
48
|
+
footer: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: null
|
|
51
|
+
},
|
|
52
|
+
/**
|
|
53
|
+
* Footer class.
|
|
54
|
+
*/
|
|
55
|
+
footerClass: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: ''
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
</script>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="tag" :class="computedClass">
|
|
3
|
+
<slot />
|
|
4
|
+
</component>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
export default {
|
|
9
|
+
name: 'd-card-group',
|
|
10
|
+
props: {
|
|
11
|
+
/**
|
|
12
|
+
* Component tag type.
|
|
13
|
+
*/
|
|
14
|
+
tag: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: 'div'
|
|
17
|
+
},
|
|
18
|
+
/**
|
|
19
|
+
* Whether it should be displayed as a deck, or not.
|
|
20
|
+
*/
|
|
21
|
+
deck: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: false
|
|
24
|
+
},
|
|
25
|
+
/**
|
|
26
|
+
* Whether it should be displayed as columns, or not.
|
|
27
|
+
*/
|
|
28
|
+
columns: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
computed: {
|
|
34
|
+
computedClass() {
|
|
35
|
+
if (this.columns) {
|
|
36
|
+
return 'card-columns'
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (this.deck) {
|
|
40
|
+
return 'card-deck'
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return 'card-group'
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
</script>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="tag" :class="[
|
|
3
|
+
'card-header',
|
|
4
|
+
Boolean(bgTheme) ? `bg-${bgTheme}` : '',
|
|
5
|
+
Boolean(borderTheme) ? `border-${borderTheme}` : '',
|
|
6
|
+
Boolean(textTheme) ? `text-${textTheme}` : '',
|
|
7
|
+
headerClass
|
|
8
|
+
]">
|
|
9
|
+
<slot />
|
|
10
|
+
</component>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
export default {
|
|
15
|
+
name: 'd-card-header',
|
|
16
|
+
props: {
|
|
17
|
+
/**
|
|
18
|
+
* Element tag type.
|
|
19
|
+
*/
|
|
20
|
+
tag: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: 'div'
|
|
23
|
+
},
|
|
24
|
+
/**
|
|
25
|
+
* Background theme color.
|
|
26
|
+
*/
|
|
27
|
+
bgTheme: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: null
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
* Border theme color.
|
|
33
|
+
*/
|
|
34
|
+
borderTheme: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: null
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* Text theme color.
|
|
40
|
+
*/
|
|
41
|
+
textTheme: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: null
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* Header value.
|
|
47
|
+
*/
|
|
48
|
+
header: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: null
|
|
51
|
+
},
|
|
52
|
+
/**
|
|
53
|
+
* Header class.
|
|
54
|
+
*/
|
|
55
|
+
headerClass: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: ''
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
</script>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<img :class="computedClass" :src="src" :alt="alt" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
export default {
|
|
7
|
+
name: 'd-card-img',
|
|
8
|
+
props: {
|
|
9
|
+
/**
|
|
10
|
+
* The image source.
|
|
11
|
+
*/
|
|
12
|
+
src: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: null,
|
|
15
|
+
required: true
|
|
16
|
+
},
|
|
17
|
+
/**
|
|
18
|
+
* Alternative image text.
|
|
19
|
+
*/
|
|
20
|
+
alt: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: null
|
|
23
|
+
},
|
|
24
|
+
/**
|
|
25
|
+
* Top positioned.
|
|
26
|
+
*/
|
|
27
|
+
top: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: false
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
* Bottom positioned.
|
|
33
|
+
*/
|
|
34
|
+
bottom: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* Fluid display.
|
|
40
|
+
*/
|
|
41
|
+
fluid: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: false
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
computed: {
|
|
47
|
+
computedClass() {
|
|
48
|
+
let _classList = []
|
|
49
|
+
|
|
50
|
+
_classList.push(this.fluid ? 'img-fluid' : '')
|
|
51
|
+
|
|
52
|
+
if (this.top && !this.bottom) {
|
|
53
|
+
_classList.push('card-img-top')
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (this.bottom && !this.top) {
|
|
57
|
+
_classList.push('card-img-bottom')
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return _classList
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
</script>
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Cards
|
|
2
|
+
|
|
3
|
+
Cards provide a flexible content container that you can use to display a variety of content using contextual background colors, headers and footers.
|
|
4
|
+
|
|
5
|
+
By default, cards fill in the full width of their parent element, however this can be customized via styling.
|
|
6
|
+
|
|
7
|
+
## Basic Example
|
|
8
|
+
|
|
9
|
+
:::demo
|
|
10
|
+
```html
|
|
11
|
+
|
|
12
|
+
<d-card style="max-width: 300px">
|
|
13
|
+
<d-card-header>Card header</d-card-header>
|
|
14
|
+
<d-card-img src="https://place-hold.it/300x200"/>
|
|
15
|
+
<d-card-body title="Lorem Ipsum">
|
|
16
|
+
<p>Lorem ipsum dolor sit amet.</p>
|
|
17
|
+
<d-btn theme="primary">Read more →</d-btn>
|
|
18
|
+
</d-card-body>
|
|
19
|
+
<d-card-footer>Card footer</d-card-footer>
|
|
20
|
+
</d-card>
|
|
21
|
+
|
|
22
|
+
<!-- card-1.vue -->
|
|
23
|
+
```
|
|
24
|
+
:::
|
|
25
|
+
|
|
26
|
+
## Card Content Types
|
|
27
|
+
|
|
28
|
+
Cards support a large variety of content including images, links, text, list groups and more. Make sure to check out the examples below.
|
|
29
|
+
|
|
30
|
+
### Card Body
|
|
31
|
+
|
|
32
|
+
The core building block of a card is the `<d-card-body>`. You can use it whenever you'd like to add a padded section within a card.
|
|
33
|
+
|
|
34
|
+
:::demo
|
|
35
|
+
```html
|
|
36
|
+
|
|
37
|
+
<d-card>
|
|
38
|
+
<d-card-body>
|
|
39
|
+
Nunc quis nisl ac justo elementum sagittis in quis justo.
|
|
40
|
+
</d-card-body>
|
|
41
|
+
</d-card>
|
|
42
|
+
|
|
43
|
+
<!-- card-2.vue -->
|
|
44
|
+
```
|
|
45
|
+
:::
|
|
46
|
+
|
|
47
|
+
#### Card Body Title and Subtitle
|
|
48
|
+
|
|
49
|
+
You can display a card's Title and Subtitle using the `title` and `subtitle` props on the `<d-card-body>` component.
|
|
50
|
+
|
|
51
|
+
:::demo
|
|
52
|
+
```html
|
|
53
|
+
|
|
54
|
+
<d-card>
|
|
55
|
+
<d-card-body title="Card Title" subtitle="Card subtitle">
|
|
56
|
+
Nunc quis nisl ac justo elementum sagittis in quis justo.
|
|
57
|
+
</d-card-body>
|
|
58
|
+
</d-card>
|
|
59
|
+
|
|
60
|
+
<!-- card-3.vue -->
|
|
61
|
+
```
|
|
62
|
+
:::
|
|
63
|
+
|
|
64
|
+
### Card Image
|
|
65
|
+
|
|
66
|
+
Using the `<d-card-img>` component you can place a responsive image on top of the card that will adjust its width when the width of the card changes.
|
|
67
|
+
|
|
68
|
+
:::demo
|
|
69
|
+
```html
|
|
70
|
+
|
|
71
|
+
<div>
|
|
72
|
+
<d-container>
|
|
73
|
+
<d-row>
|
|
74
|
+
<d-col>
|
|
75
|
+
<d-card>
|
|
76
|
+
<d-card-img src="https://place-hold.it/300x200" top />
|
|
77
|
+
<d-card-body>
|
|
78
|
+
<div>this is the body contents</div>
|
|
79
|
+
</d-card-body>
|
|
80
|
+
</d-card>
|
|
81
|
+
</d-col>
|
|
82
|
+
<d-col>
|
|
83
|
+
<d-card>
|
|
84
|
+
<d-card-body>
|
|
85
|
+
<div>this is the body contents</div>
|
|
86
|
+
</d-card-body>
|
|
87
|
+
<d-card-img src="https://place-hold.it/300x200" bottom />
|
|
88
|
+
</d-card>
|
|
89
|
+
</d-col>
|
|
90
|
+
</d-row>
|
|
91
|
+
</d-container>
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
<!-- card-4.vue -->
|
|
95
|
+
```
|
|
96
|
+
:::
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { registerComponents, vueUse } from '../../utils';
|
|
2
|
+
|
|
3
|
+
import dCard from './Card.vue'
|
|
4
|
+
import dCardBody from './CardBody.vue'
|
|
5
|
+
import dCardFooter from './CardFooter.vue'
|
|
6
|
+
import dCardGroup from './CardGroup.vue'
|
|
7
|
+
import dCardHeader from './CardHeader.vue'
|
|
8
|
+
import dCardImg from './CardImg.vue'
|
|
9
|
+
|
|
10
|
+
const components = {
|
|
11
|
+
dCard,
|
|
12
|
+
dCardBody,
|
|
13
|
+
dCardFooter,
|
|
14
|
+
dCardGroup,
|
|
15
|
+
dCardHeader,
|
|
16
|
+
dCardImg
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const VuePlugin = {
|
|
20
|
+
install (Vue) {
|
|
21
|
+
registerComponents(Vue, components)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
vueUse(VuePlugin)
|
|
26
|
+
|
|
27
|
+
export default VuePlugin
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<transition :enterActiveClass="'collapsing'"
|
|
3
|
+
:leaveActiveClass="'collapsing'"
|
|
4
|
+
@enter="onEnter"
|
|
5
|
+
@afterEnter="onAfterEnter"
|
|
6
|
+
@leave="onLeave"
|
|
7
|
+
@afterLeave="onAfterLeave" >
|
|
8
|
+
<component :is="tag"
|
|
9
|
+
v-show="show"
|
|
10
|
+
:class="[
|
|
11
|
+
isNav ? 'navbar-collapse' : '',
|
|
12
|
+
!transitioning ? 'collapse' : '',
|
|
13
|
+
show && !transitioning ? 'show' : ''
|
|
14
|
+
]"
|
|
15
|
+
:id="[ id ? id : '' ]"
|
|
16
|
+
@click="handleClick">
|
|
17
|
+
<slot />
|
|
18
|
+
</component>
|
|
19
|
+
</transition>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
import { hasClass, isElement } from '../../utils'
|
|
24
|
+
import { COLLAPSE_EVENTS } from '../../utils/constants'
|
|
25
|
+
import rootListenerMixin from '../../mixins/root-listener.mixin'
|
|
26
|
+
|
|
27
|
+
export default {
|
|
28
|
+
name: 'd-collapse',
|
|
29
|
+
mixins: [ rootListenerMixin ],
|
|
30
|
+
props: {
|
|
31
|
+
/**
|
|
32
|
+
* The component ID.
|
|
33
|
+
*/
|
|
34
|
+
id: {
|
|
35
|
+
type: String,
|
|
36
|
+
required: true
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* The component tag.
|
|
40
|
+
*/
|
|
41
|
+
tag: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: 'div'
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* The visibility state.
|
|
47
|
+
*/
|
|
48
|
+
visible: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: false
|
|
51
|
+
},
|
|
52
|
+
/**
|
|
53
|
+
* Whether it is located in a nav, or not.
|
|
54
|
+
*/
|
|
55
|
+
isNav: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: false
|
|
58
|
+
},
|
|
59
|
+
/**
|
|
60
|
+
* The accordion component identifier (not element ID).
|
|
61
|
+
*/
|
|
62
|
+
accordion: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: null
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
model: {
|
|
68
|
+
prop: 'visible',
|
|
69
|
+
event: 'input'
|
|
70
|
+
},
|
|
71
|
+
watch: {
|
|
72
|
+
visible(newVal) {
|
|
73
|
+
if (newVal !== this.show) {
|
|
74
|
+
this.show = newVal
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
show(newVal, oldVal) {
|
|
78
|
+
if (newVal !== oldVal) {
|
|
79
|
+
this.emitStateChange()
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
data() {
|
|
84
|
+
return {
|
|
85
|
+
show: this.visible,
|
|
86
|
+
transitioning: false
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
methods: {
|
|
90
|
+
toggle() {
|
|
91
|
+
this.show = !this.show
|
|
92
|
+
},
|
|
93
|
+
emitStateChange() {
|
|
94
|
+
this.$emit('input', this.show)
|
|
95
|
+
this.$root.$emit('state', this.id, this.show)
|
|
96
|
+
|
|
97
|
+
if (this.accordion && this.show) {
|
|
98
|
+
/**
|
|
99
|
+
* Triggered when the accordion is collapsed.
|
|
100
|
+
*
|
|
101
|
+
* @event accordion-collapse
|
|
102
|
+
*/
|
|
103
|
+
this.$root.$emit(COLLAPSE_EVENTS.ACCORDION, this.id, this.accordion)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
},
|
|
107
|
+
handleClick(e) {
|
|
108
|
+
const el = e.target
|
|
109
|
+
if (!this.isNav || !el || getComputedStyle(this.$el).display !== 'block') {
|
|
110
|
+
return
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (hasClass(el, 'nav-link') || hasClass(el, 'dropdown-item')) {
|
|
114
|
+
this.show = false
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
handleToggleEvent(e) {
|
|
118
|
+
if (e !== this.id) {
|
|
119
|
+
return
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
this.toggle()
|
|
123
|
+
},
|
|
124
|
+
handleAccordionEvent(id, acc) {
|
|
125
|
+
if (!this.accordion || acc !== this.accordion) {
|
|
126
|
+
return
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (id === this.id) {
|
|
130
|
+
if(!this.show) {
|
|
131
|
+
this.toggle()
|
|
132
|
+
}
|
|
133
|
+
} else {
|
|
134
|
+
if(this.show) {
|
|
135
|
+
this.toggle()
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
handleResize() {
|
|
140
|
+
this.show = (getComputedStyle(this.$el).display === 'block')
|
|
141
|
+
},
|
|
142
|
+
onEnter(el) {
|
|
143
|
+
el.style.height = 0
|
|
144
|
+
isElement(el) && el.offsetHeight
|
|
145
|
+
el.style.height = el.scrollHeight + 'px'
|
|
146
|
+
this.transitioning = true
|
|
147
|
+
/**
|
|
148
|
+
* Triggered on show.
|
|
149
|
+
*
|
|
150
|
+
* @event show
|
|
151
|
+
*/
|
|
152
|
+
this.$emit('show')
|
|
153
|
+
},
|
|
154
|
+
onAfterEnter(el) {
|
|
155
|
+
el.style.height = null
|
|
156
|
+
this.transitioning = false
|
|
157
|
+
/**
|
|
158
|
+
* Triggered after show.
|
|
159
|
+
*
|
|
160
|
+
* @event shown
|
|
161
|
+
*/
|
|
162
|
+
this.$emit('shown')
|
|
163
|
+
},
|
|
164
|
+
onLeave(el) {
|
|
165
|
+
el.style.height = 'auto'
|
|
166
|
+
el.style.display = 'block'
|
|
167
|
+
el.style.height = el.getBoundingClientRect().height + 'px'
|
|
168
|
+
isElement(el) && el.offsetHeight
|
|
169
|
+
this.transitioning = true
|
|
170
|
+
el.style.height = 0
|
|
171
|
+
/**
|
|
172
|
+
* Triggered on hide.
|
|
173
|
+
*
|
|
174
|
+
* @event hide
|
|
175
|
+
*/
|
|
176
|
+
this.$emit('hide')
|
|
177
|
+
},
|
|
178
|
+
onAfterLeave(el) {
|
|
179
|
+
el.style.height = null
|
|
180
|
+
this.transitioning = false
|
|
181
|
+
/**
|
|
182
|
+
* Triggered when hidden.
|
|
183
|
+
*
|
|
184
|
+
* @event hidden
|
|
185
|
+
*/
|
|
186
|
+
this.$emit('hidden')
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
created() {
|
|
190
|
+
this.listenOnRoot(COLLAPSE_EVENTS.TOGGLE, this.handleToggleEvent)
|
|
191
|
+
this.listenOnRoot(COLLAPSE_EVENTS.ACCORDION, this.handleAccordionEvent)
|
|
192
|
+
},
|
|
193
|
+
mounted() {
|
|
194
|
+
if (this.isNav && typeof document !== 'undefined') {
|
|
195
|
+
window.addEventListener('resize', this.handleResize, false)
|
|
196
|
+
window.addEventListener('orientationchange', this.handleResize, false)
|
|
197
|
+
this.handleResize()
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
this.emitStateChange()
|
|
201
|
+
},
|
|
202
|
+
beforeDestroy() {
|
|
203
|
+
if (this.isNav && typeof document !== 'undefined') {
|
|
204
|
+
window.removeEventListener('resize', this.handleResize, false)
|
|
205
|
+
window.removeEventListener('orientationchange', this.handleResize, false)
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
</script>
|