@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,121 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<transition name="fade">
|
|
3
|
+
<component :is="tag"
|
|
4
|
+
:class="[
|
|
5
|
+
'modal',
|
|
6
|
+
this.noBackdrop ? 'modal--no-backdrop' : ''
|
|
7
|
+
]">
|
|
8
|
+
<div :class="[
|
|
9
|
+
'modal-dialog',
|
|
10
|
+
size ? `modal-${size}` : '',
|
|
11
|
+
centered ? `modal-dialog-centered` : '',
|
|
12
|
+
]"
|
|
13
|
+
role="document"
|
|
14
|
+
v-on-clickaway="away">
|
|
15
|
+
<div class="modal-content">
|
|
16
|
+
<slot />
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</component>
|
|
20
|
+
</transition>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
import { mixin as clickAwayMixin } from 'vue-clickaway';
|
|
25
|
+
import { MODAL_EVENTS } from '../../utils/constants';
|
|
26
|
+
|
|
27
|
+
export default {
|
|
28
|
+
name: 'd-modal',
|
|
29
|
+
mixins: [clickAwayMixin],
|
|
30
|
+
props: {
|
|
31
|
+
/**
|
|
32
|
+
* The component tag.
|
|
33
|
+
*/
|
|
34
|
+
tag: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: "div"
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* The size (sm, lg).
|
|
40
|
+
*/
|
|
41
|
+
size: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: null,
|
|
44
|
+
validator: v => ['sm', 'lg'].includes(v)
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* Hides the backdrop overlay.
|
|
48
|
+
*/
|
|
49
|
+
noBackdrop: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: false
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* Whether it is centered, or not.
|
|
55
|
+
*/
|
|
56
|
+
centered: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: false
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
methods: {
|
|
62
|
+
away() {
|
|
63
|
+
if (this.noBackdrop) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @event close
|
|
69
|
+
*
|
|
70
|
+
* Triggered when the modal is closed.
|
|
71
|
+
*/
|
|
72
|
+
this.$emit('close');
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @event hidden
|
|
76
|
+
*
|
|
77
|
+
* Triggered when the modal is hidden.
|
|
78
|
+
*/
|
|
79
|
+
this.$root.$emit(MODAL_EVENTS.HIDDEN)
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
<style scoped>
|
|
86
|
+
.modal {
|
|
87
|
+
display: block;
|
|
88
|
+
background-color: rgba(0,0,0,0.5);
|
|
89
|
+
transition: .3s;
|
|
90
|
+
overflow-y: auto;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.modal-dialog {
|
|
94
|
+
transition: .3s;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.modal--no-backdrop {
|
|
98
|
+
background: none;
|
|
99
|
+
pointer-events: none;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.fade-enter {
|
|
103
|
+
transform: translate(0,0);
|
|
104
|
+
opacity: 1;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.fade-leave-active {
|
|
108
|
+
transform: translate(0,0);
|
|
109
|
+
opacity: 1;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.fade-enter, .fade-leave-active {
|
|
113
|
+
opacity: 0;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.fade-enter .modal-dialog,
|
|
117
|
+
.fade-leave-active .modal-dialog {
|
|
118
|
+
-webkit-transform: translate(0,-25%);
|
|
119
|
+
transform: translate(0,-25%);
|
|
120
|
+
}
|
|
121
|
+
</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="tag" class="modal-body">
|
|
3
|
+
<slot />
|
|
4
|
+
</component>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
export default {
|
|
9
|
+
name: 'd-modal-body',
|
|
10
|
+
props: {
|
|
11
|
+
/**
|
|
12
|
+
* The component's tag.
|
|
13
|
+
*/
|
|
14
|
+
tag: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: 'div'
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="tag" class="modal-footer">
|
|
3
|
+
<slot />
|
|
4
|
+
</component>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
export default {
|
|
9
|
+
name: 'd-modal-footer',
|
|
10
|
+
props: {
|
|
11
|
+
/**
|
|
12
|
+
* The component's tag.
|
|
13
|
+
*/
|
|
14
|
+
tag: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: 'div'
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="tag" class="modal-header">
|
|
3
|
+
<slot />
|
|
4
|
+
<d-btn-close v-if="close" @click.prevent="away" />
|
|
5
|
+
</component>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
import dBtnClose from '../button/ButtonClose.vue'
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
name: 'd-modal-header',
|
|
13
|
+
components: {
|
|
14
|
+
dBtnClose
|
|
15
|
+
},
|
|
16
|
+
props: {
|
|
17
|
+
/**
|
|
18
|
+
* The component's tag.
|
|
19
|
+
*/
|
|
20
|
+
tag: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: 'div'
|
|
23
|
+
},
|
|
24
|
+
/**
|
|
25
|
+
* Whether to display the close button, or not.
|
|
26
|
+
*/
|
|
27
|
+
close: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: true
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
methods: {
|
|
33
|
+
away() {
|
|
34
|
+
this.$parent.$emit('close');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
</script>
|
|
39
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="tag" class="modal-title">
|
|
3
|
+
<slot />
|
|
4
|
+
</component>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
export default {
|
|
9
|
+
name: 'd-modal-title',
|
|
10
|
+
props: {
|
|
11
|
+
/**
|
|
12
|
+
* The component's tag.
|
|
13
|
+
*/
|
|
14
|
+
tag: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: 'h5'
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Modals
|
|
2
|
+
|
|
3
|
+
Creating flexible modal dialogs can be achieved using the `<d-modal>` component. They feature a series of helpful subcomponents, sizes and various other options that you can use to customize the display and behavior of your modals.
|
|
4
|
+
|
|
5
|
+
## Basic Example
|
|
6
|
+
|
|
7
|
+
:::demo
|
|
8
|
+
```html
|
|
9
|
+
<template>
|
|
10
|
+
<div>Modal opened: <span :class="[showModal ? 'text-success' : 'text-danger']">{{ showModal }}</span></div>
|
|
11
|
+
<d-btn @click.native="handleClick">Click Me</d-btn>
|
|
12
|
+
<d-modal v-if="showModal" @close="handleClose">
|
|
13
|
+
<d-modal-header>
|
|
14
|
+
<d-modal-title>Header</d-modal-title>
|
|
15
|
+
</d-modal-header>
|
|
16
|
+
<d-modal-body>👋 Hello there!</d-modal-body>
|
|
17
|
+
</d-modal>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
export default {
|
|
22
|
+
data() {
|
|
23
|
+
return {
|
|
24
|
+
showModal: false,
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
methods: {
|
|
28
|
+
handleClick() {
|
|
29
|
+
this.showModal = true
|
|
30
|
+
},
|
|
31
|
+
handleClose() {
|
|
32
|
+
this.showModal = false
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<!-- modal-1.vue -->
|
|
39
|
+
```
|
|
40
|
+
:::
|
|
41
|
+
|
|
42
|
+
## Modal Size
|
|
43
|
+
|
|
44
|
+
Using the `size` prop on the `<d-modal>` component, you can control the size of your modal.
|
|
45
|
+
|
|
46
|
+
:::demo
|
|
47
|
+
```html
|
|
48
|
+
<template>
|
|
49
|
+
<d-btn @click.native="showModal = true">Click Me</d-btn>
|
|
50
|
+
<d-modal v-if="showModal" size="sm" @close="showModal = false" :size="modalSize">
|
|
51
|
+
<d-modal-header>
|
|
52
|
+
<d-modal-title>Hello</d-modal-title>
|
|
53
|
+
</d-modal-header>
|
|
54
|
+
<d-modal-body>
|
|
55
|
+
<div class="mb-3">👋 I'm a <span v-html="modalSize === 'sm' ? 'small' : 'large'" /> modal!</div>
|
|
56
|
+
<d-btn @click="modalSize = modalSize === 'sm' ? 'lg' : 'sm'">Toggle Size</d-btn>
|
|
57
|
+
</d-modal-body>
|
|
58
|
+
</d-modal>
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<script>
|
|
62
|
+
export default {
|
|
63
|
+
data() {
|
|
64
|
+
return {
|
|
65
|
+
showModal: false,
|
|
66
|
+
modalSize: 'sm'
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<!-- modal-2.vue -->
|
|
73
|
+
```
|
|
74
|
+
:::
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { registerComponents, vueUse } from './../../utils';
|
|
2
|
+
|
|
3
|
+
import dModal from './Modal.vue';
|
|
4
|
+
import dModalHeader from './ModalHeader.vue';
|
|
5
|
+
import dModalTitle from './ModalTitle.vue';
|
|
6
|
+
import dModalBody from './ModalBody.vue';
|
|
7
|
+
import dModalFooter from './ModalFooter.vue';
|
|
8
|
+
|
|
9
|
+
const components = {
|
|
10
|
+
dModal,
|
|
11
|
+
dModalHeader,
|
|
12
|
+
dModalTitle,
|
|
13
|
+
dModalBody,
|
|
14
|
+
dModalFooter
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const VuePlugin = {
|
|
18
|
+
install (Vue) {
|
|
19
|
+
registerComponents(Vue, components)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
vueUse(VuePlugin)
|
|
24
|
+
|
|
25
|
+
export default VuePlugin
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="tag" :class="[
|
|
3
|
+
'nav',
|
|
4
|
+
tabs ? 'nav-tabs' : '',
|
|
5
|
+
pills ? 'nav-pills' : '',
|
|
6
|
+
vertical ? 'flex-column' : '',
|
|
7
|
+
fill ? 'nav-fill' : '',
|
|
8
|
+
justified ? 'nav-justified' : ''
|
|
9
|
+
]">
|
|
10
|
+
<slot />
|
|
11
|
+
</component>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
export default {
|
|
16
|
+
name: 'd-nav',
|
|
17
|
+
props: {
|
|
18
|
+
/**
|
|
19
|
+
* The element tag.
|
|
20
|
+
*/
|
|
21
|
+
tag: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: 'ul'
|
|
24
|
+
},
|
|
25
|
+
/**
|
|
26
|
+
* Fill all available space.
|
|
27
|
+
*/
|
|
28
|
+
fill: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false
|
|
31
|
+
},
|
|
32
|
+
/**
|
|
33
|
+
* Define equal width elements.
|
|
34
|
+
*/
|
|
35
|
+
justified: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* Display as tabs.
|
|
41
|
+
*/
|
|
42
|
+
tabs: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* Display as pills.
|
|
48
|
+
*/
|
|
49
|
+
pills: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: false
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* Display vertical.
|
|
55
|
+
*/
|
|
56
|
+
vertical: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: false
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
</script>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<li class="nav-item">
|
|
3
|
+
<d-link v-bind="$props" class="nav-link">
|
|
4
|
+
<slot />
|
|
5
|
+
</d-link>
|
|
6
|
+
</li>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
import dLink from '../link/Link.vue'
|
|
11
|
+
import createLinkProps from '../link/create-link-props';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* This subcomponent is inheriting <a href="/docs/components/link">Link</a> component's props.
|
|
15
|
+
*/
|
|
16
|
+
export default {
|
|
17
|
+
name: 'd-nav-item',
|
|
18
|
+
components: {
|
|
19
|
+
dLink
|
|
20
|
+
},
|
|
21
|
+
props: createLinkProps()
|
|
22
|
+
}
|
|
23
|
+
</script>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="tag" class="navbar-text">
|
|
3
|
+
<slot />
|
|
4
|
+
</component>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
export default {
|
|
9
|
+
name: 'd-nav-text',
|
|
10
|
+
props: {
|
|
11
|
+
/**
|
|
12
|
+
* The element tag.
|
|
13
|
+
*/
|
|
14
|
+
tag: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: 'span'
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Navs
|
|
2
|
+
|
|
3
|
+
The `<d-nav>` component allows you to build all types of navigation components.
|
|
4
|
+
|
|
5
|
+
## Basic Demo
|
|
6
|
+
|
|
7
|
+
Creating navs can be easily achieved using the `<d-nav>` component together with the `<d-nav-item>` component.
|
|
8
|
+
|
|
9
|
+
:::demo
|
|
10
|
+
```html
|
|
11
|
+
|
|
12
|
+
<d-nav>
|
|
13
|
+
<d-nav-item active>Active</d-nav-item>
|
|
14
|
+
<d-nav-item>Link</d-nav-item>
|
|
15
|
+
<d-nav-item>Another Link</d-nav-item>
|
|
16
|
+
<d-nav-item disabled>Disabled</d-nav-item>
|
|
17
|
+
</d-nav>
|
|
18
|
+
|
|
19
|
+
<!-- nav-1.vue -->
|
|
20
|
+
```
|
|
21
|
+
:::
|
|
22
|
+
|
|
23
|
+
## Tabs Style
|
|
24
|
+
|
|
25
|
+
Using the `tabs` prop, you can style the navs to look like tabs.
|
|
26
|
+
|
|
27
|
+
:::demo
|
|
28
|
+
```html
|
|
29
|
+
|
|
30
|
+
<d-nav tabs>
|
|
31
|
+
<d-nav-item active>Active</d-nav-item>
|
|
32
|
+
<d-nav-item>Link</d-nav-item>
|
|
33
|
+
<d-nav-item>Another Link</d-nav-item>
|
|
34
|
+
<d-nav-item disabled>Disabled</d-nav-item>
|
|
35
|
+
</d-nav>
|
|
36
|
+
|
|
37
|
+
<!-- nav-2.vue -->
|
|
38
|
+
```
|
|
39
|
+
:::
|
|
40
|
+
|
|
41
|
+
## Pill Style
|
|
42
|
+
|
|
43
|
+
Using the `pills` prop you can style the navs to look like pills.
|
|
44
|
+
|
|
45
|
+
:::demo
|
|
46
|
+
```html
|
|
47
|
+
|
|
48
|
+
<d-nav pills>
|
|
49
|
+
<d-nav-item active>Active</d-nav-item>
|
|
50
|
+
<d-nav-item>Link</d-nav-item>
|
|
51
|
+
<d-nav-item>Another Link</d-nav-item>
|
|
52
|
+
<d-nav-item disabled>Disabled</d-nav-item>
|
|
53
|
+
</d-nav>
|
|
54
|
+
|
|
55
|
+
<!-- nav-3.vue -->
|
|
56
|
+
```
|
|
57
|
+
:::
|
|
58
|
+
|
|
59
|
+
## Fill
|
|
60
|
+
|
|
61
|
+
Using the `fill` prop, you can force the nav content to extend the full available width.
|
|
62
|
+
|
|
63
|
+
:::demo
|
|
64
|
+
```html
|
|
65
|
+
|
|
66
|
+
<d-nav fill>
|
|
67
|
+
<d-nav-item active>Active</d-nav-item>
|
|
68
|
+
<d-nav-item>Link</d-nav-item>
|
|
69
|
+
<d-nav-item>Another Link</d-nav-item>
|
|
70
|
+
<d-nav-item disabled>Disabled</d-nav-item>
|
|
71
|
+
</d-nav>
|
|
72
|
+
|
|
73
|
+
<!-- nav-4.vue -->
|
|
74
|
+
```
|
|
75
|
+
:::
|
|
76
|
+
|
|
77
|
+
## Justified
|
|
78
|
+
|
|
79
|
+
Using the `justified` prop, you can define equal-width nav elements.
|
|
80
|
+
|
|
81
|
+
:::demo
|
|
82
|
+
```html
|
|
83
|
+
|
|
84
|
+
<d-nav justified>
|
|
85
|
+
<d-nav-item active>Active</d-nav-item>
|
|
86
|
+
<d-nav-item>Link</d-nav-item>
|
|
87
|
+
<d-nav-item>Another Link</d-nav-item>
|
|
88
|
+
<d-nav-item disabled>Disabled</d-nav-item>
|
|
89
|
+
</d-nav>
|
|
90
|
+
|
|
91
|
+
<!-- nav-5.vue -->
|
|
92
|
+
```
|
|
93
|
+
:::
|
|
94
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { registerComponents, vueUse } from './../../utils';
|
|
2
|
+
|
|
3
|
+
import dNav from './Nav.vue';
|
|
4
|
+
import dNavItem from './NavItem.vue';
|
|
5
|
+
|
|
6
|
+
const components = {
|
|
7
|
+
dNav,
|
|
8
|
+
dNavItem
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const VuePlugin = {
|
|
12
|
+
install (Vue) {
|
|
13
|
+
registerComponents(Vue, components)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
vueUse(VuePlugin)
|
|
18
|
+
|
|
19
|
+
export default VuePlugin
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="tag" :class="[
|
|
3
|
+
'navbar',
|
|
4
|
+
type ? `navbar-${type}` : '',
|
|
5
|
+
theme ? `bg-${theme}` : '',
|
|
6
|
+
fixed ? `fixed-${fixed}` : '',
|
|
7
|
+
sticky ? 'sticky-top' : '',
|
|
8
|
+
toggleable ? `navbar-expand-${(toggleable ? 'sm' : toggleable) || 'sm'}` : ''
|
|
9
|
+
]">
|
|
10
|
+
<slot />
|
|
11
|
+
</component>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
import { THEMECOLORS } from '../../utils/constants';
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
name: 'd-navbar',
|
|
19
|
+
props: {
|
|
20
|
+
/**
|
|
21
|
+
* The element tag.
|
|
22
|
+
*/
|
|
23
|
+
tag: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: 'nav'
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* The navbar type.
|
|
29
|
+
*/
|
|
30
|
+
type: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: 'light'
|
|
33
|
+
},
|
|
34
|
+
/**
|
|
35
|
+
* The theme color.
|
|
36
|
+
*/
|
|
37
|
+
theme: {
|
|
38
|
+
type: String,
|
|
39
|
+
validator: v => THEMECOLORS.includes(v)
|
|
40
|
+
},
|
|
41
|
+
/**
|
|
42
|
+
* Whether the navbar is toggleable, or not. Also accepts String for breakpoint definition.
|
|
43
|
+
*/
|
|
44
|
+
toggleable: {
|
|
45
|
+
type: [String, Boolean],
|
|
46
|
+
default: false
|
|
47
|
+
},
|
|
48
|
+
/**
|
|
49
|
+
* Fix the navbar to either `top` or `bottom`.
|
|
50
|
+
*/
|
|
51
|
+
fixed: {
|
|
52
|
+
type: String
|
|
53
|
+
},
|
|
54
|
+
/**
|
|
55
|
+
* Whether the navbar should be sticky.
|
|
56
|
+
*/
|
|
57
|
+
sticky: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: false
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
</script>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="computedTag" v-bind="computedProps">
|
|
3
|
+
<slot />
|
|
4
|
+
</component>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import dLink from '../link/Link.vue'
|
|
9
|
+
import createLinkProps from '../link/create-link-props'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* This subcomponent is inheriting <a href="/docs/components/link">Link</a> component's props.
|
|
13
|
+
*/
|
|
14
|
+
export default {
|
|
15
|
+
name: 'd-navbar-brand',
|
|
16
|
+
components: {
|
|
17
|
+
dLink
|
|
18
|
+
},
|
|
19
|
+
props: {
|
|
20
|
+
...createLinkProps(), ...{
|
|
21
|
+
/**
|
|
22
|
+
* The element tag.
|
|
23
|
+
*/
|
|
24
|
+
tag: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: 'div'
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
computed: {
|
|
31
|
+
computedTag() {
|
|
32
|
+
// eslint-disable-next-line
|
|
33
|
+
return Boolean(this.to || this.href) ? 'd-link' : this.tag
|
|
34
|
+
},
|
|
35
|
+
computedProps() {
|
|
36
|
+
// eslint-disable-next-line
|
|
37
|
+
return Boolean(this.to || this.href) ? this.$props : {}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="tag" :class="[
|
|
3
|
+
'navbar-nav',
|
|
4
|
+
fill ? 'nav-fill' : '',
|
|
5
|
+
justified ? 'nav-justified' : ''
|
|
6
|
+
]">
|
|
7
|
+
<slot />
|
|
8
|
+
</component>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
export default {
|
|
13
|
+
name: 'd-navbar-nav',
|
|
14
|
+
props: {
|
|
15
|
+
/**
|
|
16
|
+
* The element tag.
|
|
17
|
+
*/
|
|
18
|
+
tag: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: 'ul'
|
|
21
|
+
},
|
|
22
|
+
/**
|
|
23
|
+
* Whether it should fill the entire space, or not.
|
|
24
|
+
*/
|
|
25
|
+
fill: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: false
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* Whether to proportionally fill all abailable space, or not.
|
|
31
|
+
*/
|
|
32
|
+
justified: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: false
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
</script>
|