@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,156 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="computedShow"
|
|
3
|
+
role="alert"
|
|
4
|
+
aria-live="polite"
|
|
5
|
+
aria-atomic="true"
|
|
6
|
+
:class="[
|
|
7
|
+
'alert',
|
|
8
|
+
theme ? `alert-${theme}` : '',
|
|
9
|
+
dismissible ? `alert-dismissible` : ''
|
|
10
|
+
]">
|
|
11
|
+
<slot />
|
|
12
|
+
<d-button-close v-if="dismissible"
|
|
13
|
+
:aria-label="dismissLabel"
|
|
14
|
+
@click="dismiss"
|
|
15
|
+
href="#" />
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
import { THEMECOLORS, ALERT_EVENTS } from '../../utils/constants';
|
|
21
|
+
import dButtonClose from '../button/ButtonClose.vue';
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
name: 'd-alert',
|
|
25
|
+
components: {
|
|
26
|
+
dButtonClose
|
|
27
|
+
},
|
|
28
|
+
props: {
|
|
29
|
+
/**
|
|
30
|
+
* Alert color theme.
|
|
31
|
+
*/
|
|
32
|
+
theme: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: 'primary',
|
|
35
|
+
validator: v => THEMECOLORS.includes(v)
|
|
36
|
+
},
|
|
37
|
+
/**
|
|
38
|
+
* Whether the alert is dismissible, or not.
|
|
39
|
+
*/
|
|
40
|
+
dismissible: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: false
|
|
43
|
+
},
|
|
44
|
+
/**
|
|
45
|
+
* Dismiss button label.
|
|
46
|
+
*/
|
|
47
|
+
dismissLabel: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: 'Close'
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
* Show state or duration.
|
|
53
|
+
*/
|
|
54
|
+
show: {
|
|
55
|
+
type: [Boolean, Number, String],
|
|
56
|
+
default: false
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
model: {
|
|
60
|
+
prop: 'show',
|
|
61
|
+
event: 'input'
|
|
62
|
+
},
|
|
63
|
+
data() {
|
|
64
|
+
return {
|
|
65
|
+
timer: null,
|
|
66
|
+
dismissed: false
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
watch: {
|
|
70
|
+
show() {
|
|
71
|
+
this.showChanged();
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
mounted() {
|
|
75
|
+
this.showChanged();
|
|
76
|
+
},
|
|
77
|
+
destroyed() {
|
|
78
|
+
this.clearCounter();
|
|
79
|
+
},
|
|
80
|
+
computed: {
|
|
81
|
+
computedShow() {
|
|
82
|
+
return !this.dismissed && (this.timer || this.show);
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
methods: {
|
|
86
|
+
clearCounter() {
|
|
87
|
+
if (this.timer) {
|
|
88
|
+
clearInterval(this.timer);
|
|
89
|
+
this.timer = null;
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
dismiss() {
|
|
94
|
+
this.clearCounter();
|
|
95
|
+
this.dismissed = true;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Alert dismissed event.
|
|
99
|
+
*
|
|
100
|
+
* @event alert-dismissed
|
|
101
|
+
* @type {Boolean}
|
|
102
|
+
*/
|
|
103
|
+
this.$emit(ALERT_EVENTS.DISMISSED);
|
|
104
|
+
this.$emit('input', false);
|
|
105
|
+
|
|
106
|
+
if (typeof this.show === 'boolean') {
|
|
107
|
+
this.$emit('input', false);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Alert dismiss countdown event.
|
|
113
|
+
*
|
|
114
|
+
* @event alert-dismiss-countdown
|
|
115
|
+
* @type {Number}
|
|
116
|
+
*/
|
|
117
|
+
this.$emit(ALERT_EVENTS.DISMISS_COUNTDOWN, 0);
|
|
118
|
+
this.$emit('input', 0);
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
showChanged() {
|
|
122
|
+
this.clearCounter();
|
|
123
|
+
this.dismissed = false;
|
|
124
|
+
|
|
125
|
+
if (typeof this.show === 'boolean' || this.show === null || this.show === 0)
|
|
126
|
+
return
|
|
127
|
+
|
|
128
|
+
let dismissTimer = this.show;
|
|
129
|
+
this.timer = setInterval(() => {
|
|
130
|
+
if (dismissTimer < 1) {
|
|
131
|
+
this.dismiss();
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
dismissTimer--;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Alert dismiss countdown event.
|
|
139
|
+
*
|
|
140
|
+
* @event alert-dismiss-countdown
|
|
141
|
+
* @type {Number}
|
|
142
|
+
*/
|
|
143
|
+
this.$emit(ALERT_EVENTS.DISMISS_COUNTDOWN, dismissTimer);
|
|
144
|
+
this.$emit('input', dismissTimer);
|
|
145
|
+
}, 1000);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
</script>
|
|
150
|
+
|
|
151
|
+
<style scoped>
|
|
152
|
+
.close {
|
|
153
|
+
min-height: 100%;
|
|
154
|
+
padding: 0.625rem 1.25rem 0.75rem 1.25rem;
|
|
155
|
+
}
|
|
156
|
+
</style>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Alerts
|
|
2
|
+
|
|
3
|
+
Alerts allow you to display contextual feedback for various user actions.
|
|
4
|
+
|
|
5
|
+
## Basic Alerts
|
|
6
|
+
|
|
7
|
+
Alerts come in various contextual theme colors
|
|
8
|
+
|
|
9
|
+
:::demo
|
|
10
|
+
```html Alerts contextual theme colors example
|
|
11
|
+
|
|
12
|
+
<div>
|
|
13
|
+
<d-alert show>Alert - Primary Theme (default) - <a class="alert-link" href="#">Example Link</a></d-alert>
|
|
14
|
+
<d-alert theme="secondary" show>Alert - Secondary Theme - <a class="alert-link" href="#">Example Link</a></d-alert>
|
|
15
|
+
<d-alert theme="success" show>Alert - Success Theme - <a class="alert-link" href="#">Example Link</a></d-alert>
|
|
16
|
+
<d-alert theme="danger" show>Alert - Danger Theme - <a class="alert-link" href="#">Example Link</a></d-alert>
|
|
17
|
+
<d-alert theme="warning" show>Alert - Warning Theme - <a class="alert-link" href="#">Example Link</a></d-alert>
|
|
18
|
+
<d-alert theme="info" show>Alert - Info Theme - <a class="alert-link" href="#">Example Link</a></d-alert>
|
|
19
|
+
<d-alert theme="light" show>Alert - Light Theme - <a class="alert-link" href="#">Example Link</a></d-alert>
|
|
20
|
+
<d-alert theme="dark" show>Alert - Dark Theme - <a class="alert-link" href="#">Example Link</a></d-alert>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<!-- alerts-1.vue -->
|
|
24
|
+
```
|
|
25
|
+
:::
|
|
26
|
+
|
|
27
|
+
## Dismissible Alerts
|
|
28
|
+
|
|
29
|
+
Dismissible alerts provide the option to hide the alert with a close X button.
|
|
30
|
+
|
|
31
|
+
:::demo Dismissible alert example
|
|
32
|
+
```html
|
|
33
|
+
|
|
34
|
+
<div>
|
|
35
|
+
<d-alert show dismissible>You can easily dismiss me using the <strong>close</strong> button →</d-alert>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<!-- alerts-2.vue -->
|
|
39
|
+
```
|
|
40
|
+
:::
|
|
41
|
+
|
|
42
|
+
## Self Dismissing Alerts
|
|
43
|
+
|
|
44
|
+
You can also control how much time an alert is visible by providing a `Number` in seconds for the `show` prop.
|
|
45
|
+
|
|
46
|
+
:::demo Auto dismissible alert example.
|
|
47
|
+
```html
|
|
48
|
+
|
|
49
|
+
<template>
|
|
50
|
+
<div>
|
|
51
|
+
<d-alert dismissible
|
|
52
|
+
:show="timeUntilDismissed"
|
|
53
|
+
theme="success"
|
|
54
|
+
@alert-dismissed="timeUntilDismissed = 0"
|
|
55
|
+
@alert-dismiss-countdown="handleTimeChange">
|
|
56
|
+
<b>Success!</b> This alert will will be dismissed in {{ timeUntilDismissed }} seconds!
|
|
57
|
+
</d-alert>
|
|
58
|
+
<d-btn @click="showAlert">
|
|
59
|
+
Show Alert!
|
|
60
|
+
</d-btn>
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
63
|
+
|
|
64
|
+
<script>
|
|
65
|
+
export default {
|
|
66
|
+
data () {
|
|
67
|
+
return {
|
|
68
|
+
duration: 5,
|
|
69
|
+
timeUntilDismissed: 0
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
methods: {
|
|
73
|
+
handleTimeChange (time) {
|
|
74
|
+
this.timeUntilDismissed = time
|
|
75
|
+
},
|
|
76
|
+
showAlert () {
|
|
77
|
+
this.timeUntilDismissed = this.duration
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
</script>
|
|
82
|
+
|
|
83
|
+
<!-- alerts-3.vue -->
|
|
84
|
+
```
|
|
85
|
+
:::
|
|
86
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { registerComponents, vueUse } from './../../utils';
|
|
2
|
+
|
|
3
|
+
import dAlert from './Alert.vue';
|
|
4
|
+
|
|
5
|
+
const components = {
|
|
6
|
+
dAlert
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const VuePlugin = {
|
|
10
|
+
install (Vue) {
|
|
11
|
+
registerComponents(Vue, components)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
vueUse(VuePlugin)
|
|
16
|
+
|
|
17
|
+
export default VuePlugin
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="computedTag" :class="[
|
|
3
|
+
'badge',
|
|
4
|
+
theme && !outline ? `badge-${theme}` : '',
|
|
5
|
+
outline ? `badge-outline-${theme}` : '',
|
|
6
|
+
pill ? `badge-pill` : '',
|
|
7
|
+
]">
|
|
8
|
+
<slot />
|
|
9
|
+
</component>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
import dLink from '../link/Link.vue'
|
|
14
|
+
import createLinkProps from '../link/create-link-props'
|
|
15
|
+
import { THEMECOLORS } from '../../utils/constants'
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* This subcomponent is inheriting <a href="/docs/components/link">Link</a> component's props.
|
|
19
|
+
*/
|
|
20
|
+
export default {
|
|
21
|
+
name: 'd-badge',
|
|
22
|
+
components: {
|
|
23
|
+
dLink
|
|
24
|
+
},
|
|
25
|
+
props: {...createLinkProps(), ...{
|
|
26
|
+
/**
|
|
27
|
+
* The element tag.
|
|
28
|
+
*/
|
|
29
|
+
tag: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: 'span'
|
|
32
|
+
},
|
|
33
|
+
/**
|
|
34
|
+
* The theme color.
|
|
35
|
+
*/
|
|
36
|
+
theme: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: 'primary',
|
|
39
|
+
validator: v => THEMECOLORS.includes(v)
|
|
40
|
+
},
|
|
41
|
+
/**
|
|
42
|
+
* Whether it should be displayed as a pill, or not.
|
|
43
|
+
*/
|
|
44
|
+
pill: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false
|
|
47
|
+
},
|
|
48
|
+
/**
|
|
49
|
+
* Whether it should be displayed with an outline, or not.
|
|
50
|
+
*/
|
|
51
|
+
outline: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: false
|
|
54
|
+
}
|
|
55
|
+
}},
|
|
56
|
+
computed: {
|
|
57
|
+
computedTag() {
|
|
58
|
+
return this.href || this.to ? 'd-link' : this.tag
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
</script>
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Badges
|
|
2
|
+
|
|
3
|
+
Badges are the perfect component for labels and count values.
|
|
4
|
+
|
|
5
|
+
## Contextual Variations
|
|
6
|
+
|
|
7
|
+
Using the `theme` prop you can easily change the appearance of your badge using the main theme colors: `primary, secondary, success, danger, warning, info, light` and `dark`.
|
|
8
|
+
|
|
9
|
+
:::demo
|
|
10
|
+
```html
|
|
11
|
+
<div>
|
|
12
|
+
<d-badge theme="primary">Primary</d-badge>
|
|
13
|
+
<d-badge theme="secondary">Secondary</d-badge>
|
|
14
|
+
<d-badge theme="success">Success</d-badge>
|
|
15
|
+
<d-badge theme="danger">Danger</d-badge>
|
|
16
|
+
<d-badge theme="warning">Warning</d-badge>
|
|
17
|
+
<d-badge theme="info">Info</d-badge>
|
|
18
|
+
<d-badge theme="light">Light</d-badge>
|
|
19
|
+
<d-badge theme="dark">Dark</d-badge>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<!-- badges-1.vue -->
|
|
23
|
+
```
|
|
24
|
+
:::
|
|
25
|
+
|
|
26
|
+
## Pill-Shaped Badges
|
|
27
|
+
|
|
28
|
+
Using the `pill` prop appiles a larger border radius that make your badges to look rounded.
|
|
29
|
+
|
|
30
|
+
:::demo
|
|
31
|
+
```html
|
|
32
|
+
<div>
|
|
33
|
+
<d-badge pill theme="primary">Primary</d-badge>
|
|
34
|
+
<d-badge pill theme="secondary">Secondary</d-badge>
|
|
35
|
+
<d-badge pill theme="success">Success</d-badge>
|
|
36
|
+
<d-badge pill theme="danger">Danger</d-badge>
|
|
37
|
+
<d-badge pill theme="warning">Warning</d-badge>
|
|
38
|
+
<d-badge pill theme="info">Info</d-badge>
|
|
39
|
+
<d-badge pill theme="light">Light</d-badge>
|
|
40
|
+
<d-badge pill theme="dark">Dark</d-badge>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<!-- badges-2.vue -->
|
|
44
|
+
```
|
|
45
|
+
:::
|
|
46
|
+
|
|
47
|
+
## Outline Badges
|
|
48
|
+
|
|
49
|
+
Using the `outline` prop removes the background color and applies a thin border that make your badges to look outlined.
|
|
50
|
+
|
|
51
|
+
:::demo
|
|
52
|
+
```html
|
|
53
|
+
<div>
|
|
54
|
+
<d-badge outline theme="primary">Primary</d-badge>
|
|
55
|
+
<d-badge outline theme="secondary">Secondary</d-badge>
|
|
56
|
+
<d-badge outline theme="success">Success</d-badge>
|
|
57
|
+
<d-badge outline theme="danger">Danger</d-badge>
|
|
58
|
+
<d-badge outline theme="warning">Warning</d-badge>
|
|
59
|
+
<d-badge outline theme="info">Info</d-badge>
|
|
60
|
+
<d-badge outline theme="light">Light</d-badge>
|
|
61
|
+
<d-badge outline theme="dark">Dark</d-badge>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<!-- badges-3.vue -->
|
|
65
|
+
```
|
|
66
|
+
:::
|
|
67
|
+
|
|
68
|
+
## Mixed Effects
|
|
69
|
+
|
|
70
|
+
You can also mix both `pill` and `outline` props to get mixed results.
|
|
71
|
+
|
|
72
|
+
:::demo
|
|
73
|
+
```html
|
|
74
|
+
<div>
|
|
75
|
+
<d-badge outline pill theme="primary">Primary</d-badge>
|
|
76
|
+
<d-badge outline pill theme="secondary">Secondary</d-badge>
|
|
77
|
+
<d-badge outline pill theme="success">Success</d-badge>
|
|
78
|
+
<d-badge outline pill theme="danger">Danger</d-badge>
|
|
79
|
+
<d-badge outline pill theme="warning">Warning</d-badge>
|
|
80
|
+
<d-badge outline pill theme="info">Info</d-badge>
|
|
81
|
+
<d-badge outline pill theme="light">Light</d-badge>
|
|
82
|
+
<d-badge outline pill theme="dark">Dark</d-badge>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<!-- badges-4.vue -->
|
|
86
|
+
```
|
|
87
|
+
:::
|
|
88
|
+
|
|
89
|
+
## Link Badges
|
|
90
|
+
|
|
91
|
+
Using the `href` or `to` prop you can turn your badges into regular or router links.
|
|
92
|
+
|
|
93
|
+
:::demo
|
|
94
|
+
```html
|
|
95
|
+
<div>
|
|
96
|
+
<d-badge href="#" theme="primary">Primary</d-badge>
|
|
97
|
+
<d-badge href="#" theme="secondary">Secondary</d-badge>
|
|
98
|
+
<d-badge href="#" theme="success">Success</d-badge>
|
|
99
|
+
<d-badge href="#" theme="danger">Danger</d-badge>
|
|
100
|
+
<d-badge href="#" theme="warning">Warning</d-badge>
|
|
101
|
+
<d-badge href="#" theme="info">Info</d-badge>
|
|
102
|
+
<d-badge href="#" theme="light">Light</d-badge>
|
|
103
|
+
<d-badge href="#" theme="dark">Dark</d-badge>
|
|
104
|
+
</div>
|
|
105
|
+
|
|
106
|
+
<!-- badges-5.vue -->
|
|
107
|
+
```
|
|
108
|
+
:::
|
|
109
|
+
|
|
110
|
+
## Inherited Props
|
|
111
|
+
|
|
112
|
+
> **Note:** This component is also inheriting the [Link](/docs/components/link) component's props.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { registerComponents, vueUse } from './../../utils'
|
|
2
|
+
|
|
3
|
+
import dBadge from './Badge.vue'
|
|
4
|
+
|
|
5
|
+
const components = {
|
|
6
|
+
dBadge
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const VuePlugin = {
|
|
10
|
+
install (Vue) {
|
|
11
|
+
registerComponents(Vue, components)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
vueUse(VuePlugin)
|
|
16
|
+
|
|
17
|
+
export default VuePlugin
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ol class="breadcrumb">
|
|
3
|
+
<BreadcrumbItem v-for="(item, index) in computedItems"
|
|
4
|
+
:key="`dr-breadcrumb-${index}`"
|
|
5
|
+
:active="item.active"
|
|
6
|
+
:text="item.text"
|
|
7
|
+
:href="item.href" />
|
|
8
|
+
<slot />
|
|
9
|
+
</ol>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
import BreadcrumbItem from './BreadcrumbItem.vue'
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
name: 'd-breadcrumb',
|
|
17
|
+
components: {
|
|
18
|
+
BreadcrumbItem
|
|
19
|
+
},
|
|
20
|
+
props: {
|
|
21
|
+
/**
|
|
22
|
+
* The breadcrumb items array.
|
|
23
|
+
*/
|
|
24
|
+
items: {
|
|
25
|
+
type: Array,
|
|
26
|
+
default: null
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
computed: {
|
|
30
|
+
computedItems() {
|
|
31
|
+
let isActiveDefined = false
|
|
32
|
+
|
|
33
|
+
if (!this.items || !this.items.length) {
|
|
34
|
+
return []
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return this.items.map((item, idx) => {
|
|
38
|
+
if (typeof item !== 'object') {
|
|
39
|
+
item = { text: item }
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (item.active) {
|
|
43
|
+
isActiveDefined = true
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (!item.active && !isActiveDefined) {
|
|
47
|
+
item.active = idx + 1 === this.items.length
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return item
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
</script>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<li :class="[ 'breadcrumb-item', active ? 'active' : '' ]" role="presentation">
|
|
3
|
+
<BreadcrumbLink :text="text"
|
|
4
|
+
:href="href"
|
|
5
|
+
v-if="!active" />
|
|
6
|
+
<span v-if="active">{{ text }}</span>
|
|
7
|
+
</li>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
import BreadcrumbLink from './BreadcrumbLink.vue'
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
name: 'd-breadcrumb-item',
|
|
15
|
+
components: {
|
|
16
|
+
BreadcrumbLink
|
|
17
|
+
},
|
|
18
|
+
props: {
|
|
19
|
+
/**
|
|
20
|
+
* The breadcrumb item text.
|
|
21
|
+
*/
|
|
22
|
+
text: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: null
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* The breadcrumb item href.
|
|
28
|
+
*/
|
|
29
|
+
href: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: '#'
|
|
32
|
+
},
|
|
33
|
+
/**
|
|
34
|
+
* Whether it is active, or not.
|
|
35
|
+
*/
|
|
36
|
+
active: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: false
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
</script>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="computedTag"
|
|
3
|
+
v-html="text"
|
|
4
|
+
:aria-current="ariaCurrent"
|
|
5
|
+
:href="href" />
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
import dLink from '../link/Link.vue'
|
|
10
|
+
import createLinkProps from '../link/create-link-props'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* This subcomponent is inheriting <a href="/docs/components/link">Link</a> component's props.
|
|
14
|
+
*/
|
|
15
|
+
export default {
|
|
16
|
+
name: 'd-breadcrumb-link',
|
|
17
|
+
components: {
|
|
18
|
+
dLink
|
|
19
|
+
},
|
|
20
|
+
props: {...createLinkProps(), ...{
|
|
21
|
+
/**
|
|
22
|
+
* The breadcrumb link text.
|
|
23
|
+
*/
|
|
24
|
+
text: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: null
|
|
27
|
+
},
|
|
28
|
+
/**
|
|
29
|
+
* The active state.
|
|
30
|
+
*/
|
|
31
|
+
active: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: false
|
|
34
|
+
},
|
|
35
|
+
/**
|
|
36
|
+
* The href.
|
|
37
|
+
*/
|
|
38
|
+
href: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: '#'
|
|
41
|
+
},
|
|
42
|
+
/**
|
|
43
|
+
* The aria-current state.
|
|
44
|
+
*/
|
|
45
|
+
ariaCurrent: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: 'location'
|
|
48
|
+
}
|
|
49
|
+
}},
|
|
50
|
+
computed: {
|
|
51
|
+
computedTag() {
|
|
52
|
+
return this.active ? 'span' : 'd-link'
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
</script>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Breadcrumbs
|
|
2
|
+
|
|
3
|
+
Breadcrumbs are a great component for indicating the current page's location within a navigation.
|
|
4
|
+
|
|
5
|
+
## Basic Example
|
|
6
|
+
|
|
7
|
+
The `<d-breadcrumb>` component comes with an `:items` prop that accepts an array of objects representing each breadcrumb menu item.
|
|
8
|
+
|
|
9
|
+
:::demo
|
|
10
|
+
```html
|
|
11
|
+
<template>
|
|
12
|
+
<d-breadcrumb :items="breadcrumbItems"/>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script>
|
|
16
|
+
export default {
|
|
17
|
+
data () {
|
|
18
|
+
return {
|
|
19
|
+
breadcrumbItems: [{
|
|
20
|
+
text: 'Products',
|
|
21
|
+
href: '#'
|
|
22
|
+
}, {
|
|
23
|
+
text: 'Home',
|
|
24
|
+
href: '#'
|
|
25
|
+
}, {
|
|
26
|
+
text: 'Lightbulbs',
|
|
27
|
+
active: true
|
|
28
|
+
}]
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<!-- breadcrumb-1.vue -->
|
|
35
|
+
```
|
|
36
|
+
:::
|
|
37
|
+
|
|
38
|
+
## Manual Breadcrumbs
|
|
39
|
+
|
|
40
|
+
You can also compose your own breadscumb structures using the `<d-breadcrumb-item>` component.
|
|
41
|
+
|
|
42
|
+
:::demo
|
|
43
|
+
```html
|
|
44
|
+
|
|
45
|
+
<d-breadcrumb>
|
|
46
|
+
<d-breadcrumb-item :active="false" text="Products" href="#" />
|
|
47
|
+
<d-breadcrumb-item :active="false" text="Home" href="#" />
|
|
48
|
+
<d-breadcrumb-item :active="true" text="Lightbulbs" href="#" />
|
|
49
|
+
</d-breadcrumb>
|
|
50
|
+
|
|
51
|
+
<!-- breadcrumb-2.vue -->
|
|
52
|
+
```
|
|
53
|
+
:::
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { registerComponents, vueUse } from './../../utils'
|
|
2
|
+
|
|
3
|
+
import dLink from '../link/Link.vue'
|
|
4
|
+
import dBreadcrumb from './Breadcrumb.vue'
|
|
5
|
+
import dBreadcrumbItem from './BreadcrumbItem.vue'
|
|
6
|
+
import dBreadcrumbLink from './BreadcrumbLink.vue'
|
|
7
|
+
|
|
8
|
+
const components = {
|
|
9
|
+
dLink,
|
|
10
|
+
dBreadcrumb,
|
|
11
|
+
dBreadcrumbItem,
|
|
12
|
+
dBreadcrumbLink
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const VuePlugin = {
|
|
16
|
+
install (Vue) {
|
|
17
|
+
registerComponents(Vue, components)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
vueUse(VuePlugin)
|
|
22
|
+
|
|
23
|
+
export default VuePlugin
|