@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,188 @@
|
|
|
1
|
+
# Input Groups
|
|
2
|
+
|
|
3
|
+
Using the `<d-input-group>` component you can easily extend form controls by adding various elements such as text, buttons and button groups.
|
|
4
|
+
|
|
5
|
+
## Basic Input Groups
|
|
6
|
+
|
|
7
|
+
:::demo
|
|
8
|
+
```html
|
|
9
|
+
|
|
10
|
+
<div>
|
|
11
|
+
<!-- Using Props -->
|
|
12
|
+
<d-input-group prepend="$" class="mb-2">
|
|
13
|
+
<d-input placeholder="Total Amount"/>
|
|
14
|
+
</d-input-group>
|
|
15
|
+
|
|
16
|
+
<!-- Using Slots -->
|
|
17
|
+
<d-input-group class="mb-2">
|
|
18
|
+
<d-input placeholder="Total Amount"/>
|
|
19
|
+
<d-input-group-text slot="append">$</d-input-group-text>
|
|
20
|
+
</d-input-group>
|
|
21
|
+
|
|
22
|
+
<!-- Using Components -->
|
|
23
|
+
<d-input-group prepend="designrevision.com/user/">
|
|
24
|
+
<d-input placeholder="username" />
|
|
25
|
+
<d-input-group-addon append>
|
|
26
|
+
<d-btn theme="secondary">Check</d-btn>
|
|
27
|
+
</d-input-group-addon>
|
|
28
|
+
</d-input-group>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<!-- input-group-1.vue -->
|
|
32
|
+
```
|
|
33
|
+
:::
|
|
34
|
+
|
|
35
|
+
## Prepending and Appending via Props
|
|
36
|
+
|
|
37
|
+
The simplest way of attaching addons to your inputs would be by using the `prepend` or `append` props on the `<d-input-group>` component.
|
|
38
|
+
|
|
39
|
+
:::demo
|
|
40
|
+
```html
|
|
41
|
+
|
|
42
|
+
<d-input-group prepend="Total Amount" append=".00 (USD)" class="mb-2">
|
|
43
|
+
<d-input/>
|
|
44
|
+
</d-input-group>
|
|
45
|
+
|
|
46
|
+
<!-- input-group-2.vue -->
|
|
47
|
+
```
|
|
48
|
+
:::
|
|
49
|
+
|
|
50
|
+
## Using Named Slots
|
|
51
|
+
|
|
52
|
+
If you'd like better control over your input group's contents, you can also use the `prepend` or `append` slots.
|
|
53
|
+
|
|
54
|
+
:::demo
|
|
55
|
+
```html
|
|
56
|
+
|
|
57
|
+
<d-input-group>
|
|
58
|
+
<d-input-group-text slot="prepend">Total Amount</d-input-group-text>
|
|
59
|
+
<d-input placeholder="Total Amount"/>
|
|
60
|
+
<d-input-group-text slot="append">$</d-input-group-text>
|
|
61
|
+
</d-input-group>
|
|
62
|
+
|
|
63
|
+
<!-- input-group-3.vue -->
|
|
64
|
+
```
|
|
65
|
+
:::
|
|
66
|
+
|
|
67
|
+
## Using Input Group Addons
|
|
68
|
+
|
|
69
|
+
You can also use the `<d-input-group-addon>` component with the `append` or `prepend` props for more flexibility.
|
|
70
|
+
|
|
71
|
+
:::demo
|
|
72
|
+
```html
|
|
73
|
+
|
|
74
|
+
<d-input-group class="mb-2">
|
|
75
|
+
<d-input-group-addon prepend>
|
|
76
|
+
<d-btn outline theme="danger">Delete</d-btn>
|
|
77
|
+
</d-input-group-addon>
|
|
78
|
+
<d-input placeholder="Email Address"/>
|
|
79
|
+
<d-input-group-addon append>
|
|
80
|
+
<d-btn outline theme="success">Create</d-btn>
|
|
81
|
+
</d-input-group-addon>
|
|
82
|
+
</d-input-group>
|
|
83
|
+
|
|
84
|
+
<!-- input-group-4.vue -->
|
|
85
|
+
```
|
|
86
|
+
:::
|
|
87
|
+
|
|
88
|
+
## Input Group Dropdowns
|
|
89
|
+
|
|
90
|
+
> Note: Using dropdowns inside input groups are currently not supported, but available on the [roadmap](/roadmap).
|
|
91
|
+
|
|
92
|
+
:::demo
|
|
93
|
+
```html
|
|
94
|
+
|
|
95
|
+
<div>
|
|
96
|
+
<d-input-group prepend="Username">
|
|
97
|
+
<d-form-input />
|
|
98
|
+
<d-input-group-addon append>
|
|
99
|
+
<d-dropdown text="Dropdown" variant="success">
|
|
100
|
+
<d-dropdown-item>Action A</d-dropdown-item>
|
|
101
|
+
<d-dropdown-item>Action B</d-dropdown-item>
|
|
102
|
+
</d-dropdown>
|
|
103
|
+
</d-input-group-addon>
|
|
104
|
+
</d-input-group>
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
<!-- input-group-4.vue -->
|
|
108
|
+
```
|
|
109
|
+
:::
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
## Plain Checkboxes and Radios
|
|
114
|
+
|
|
115
|
+
:::demo
|
|
116
|
+
```html
|
|
117
|
+
|
|
118
|
+
<d-container>
|
|
119
|
+
<d-row>
|
|
120
|
+
<d-col lg="6">
|
|
121
|
+
<d-input-group>
|
|
122
|
+
<d-input-group-text slot="prepend">
|
|
123
|
+
<input type="checkbox" aria-label="Checkbox for following text input">
|
|
124
|
+
</d-input-group-text>
|
|
125
|
+
<d-form-input type="text" aria-label="Text input with checkbox" />
|
|
126
|
+
</d-input-group>
|
|
127
|
+
</d-col>
|
|
128
|
+
|
|
129
|
+
<d-col lg="6">
|
|
130
|
+
<d-input-group>
|
|
131
|
+
<d-input-group-text slot="prepend">
|
|
132
|
+
<input type="radio" aria-label="Radio for following text input">
|
|
133
|
+
</d-input-group-text>
|
|
134
|
+
<d-form-input type="text" aria-label="Text input with radio button" />
|
|
135
|
+
</d-input-group>
|
|
136
|
+
</d-col>
|
|
137
|
+
</d-row>
|
|
138
|
+
</d-container>
|
|
139
|
+
|
|
140
|
+
<!-- input-group-5.vue -->
|
|
141
|
+
```
|
|
142
|
+
:::
|
|
143
|
+
|
|
144
|
+
## Sizing
|
|
145
|
+
|
|
146
|
+
You can control the sizing of the `<d-input-group>` component using the `size` prop with the `sm` value for small input groups and `lg` for large input groups.
|
|
147
|
+
|
|
148
|
+
:::demo
|
|
149
|
+
```html
|
|
150
|
+
|
|
151
|
+
<div>
|
|
152
|
+
<!-- Small -->
|
|
153
|
+
<d-input-group prepend="$" class="mb-2" size="sm">
|
|
154
|
+
<d-input placeholder="Total Amount"/>
|
|
155
|
+
</d-input-group>
|
|
156
|
+
|
|
157
|
+
<!-- Normal -->
|
|
158
|
+
<d-input-group prepend="$" class="mb-2">
|
|
159
|
+
<d-input placeholder="Total Amount"/>
|
|
160
|
+
</d-input-group>
|
|
161
|
+
|
|
162
|
+
<!-- Large -->
|
|
163
|
+
<d-input-group prepend="$" class="mb-2" size="lg">
|
|
164
|
+
<d-input placeholder="Total Amount"/>
|
|
165
|
+
</d-input-group>
|
|
166
|
+
</div>
|
|
167
|
+
|
|
168
|
+
<!-- input-group-6.vue -->
|
|
169
|
+
```
|
|
170
|
+
:::
|
|
171
|
+
|
|
172
|
+
## Seamless Input Groups
|
|
173
|
+
|
|
174
|
+
You can create seamless input groups using the `seamless` prop.
|
|
175
|
+
|
|
176
|
+
:::demo
|
|
177
|
+
```html
|
|
178
|
+
|
|
179
|
+
<d-input-group seamless>
|
|
180
|
+
<d-input-group-text slot="prepend">
|
|
181
|
+
<fa :icon="['fas', 'dollar-sign']" />
|
|
182
|
+
</d-input-group-text>
|
|
183
|
+
<d-input placeholder="Total Amount"/>
|
|
184
|
+
</d-input-group>
|
|
185
|
+
|
|
186
|
+
<!-- input-group-7.vue -->
|
|
187
|
+
```
|
|
188
|
+
:::
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { registerComponents, vueUse } from './../../utils'
|
|
2
|
+
|
|
3
|
+
import dInputGroup from './InputGroup.vue'
|
|
4
|
+
import dInputGroupText from './InputGroupText.vue'
|
|
5
|
+
import dInputGroupAddon from './InputGroupAddon.vue'
|
|
6
|
+
|
|
7
|
+
const components = {
|
|
8
|
+
dInputGroup,
|
|
9
|
+
dInputGroupText,
|
|
10
|
+
dInputGroupAddon
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const VuePlugin = {
|
|
14
|
+
install (Vue) {
|
|
15
|
+
registerComponents(Vue, components)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
vueUse(VuePlugin)
|
|
20
|
+
|
|
21
|
+
export default VuePlugin
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component v-bind="$props"
|
|
3
|
+
:is="computedTag"
|
|
4
|
+
:rel="computedRel"
|
|
5
|
+
:href="computedHref"
|
|
6
|
+
:target="target"
|
|
7
|
+
:to="to"
|
|
8
|
+
:tabindex="computedTabindex"
|
|
9
|
+
:class="[
|
|
10
|
+
active ? (exact ? exactActiveClass : activeClass) : '',
|
|
11
|
+
disabled ? 'disabled' : ''
|
|
12
|
+
]"
|
|
13
|
+
:aria-disabled="computedAriaDisabled"
|
|
14
|
+
@click.native="handleClick">
|
|
15
|
+
<slot>Link</slot>
|
|
16
|
+
</component>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
import { LINK_EVENTS } from '../../utils/constants';
|
|
21
|
+
import rootListenerMixin from '../../mixins/root-listener.mixin'
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
name: 'd-link',
|
|
25
|
+
mixins: [ rootListenerMixin ],
|
|
26
|
+
props: {
|
|
27
|
+
/**
|
|
28
|
+
* The link href.
|
|
29
|
+
*/
|
|
30
|
+
href: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: null
|
|
33
|
+
},
|
|
34
|
+
/**
|
|
35
|
+
* The router location.
|
|
36
|
+
*/
|
|
37
|
+
to: {
|
|
38
|
+
type: [String, Object],
|
|
39
|
+
default: null
|
|
40
|
+
},
|
|
41
|
+
/**
|
|
42
|
+
* Whether the link is disabled, or not.
|
|
43
|
+
*/
|
|
44
|
+
disabled: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false
|
|
47
|
+
},
|
|
48
|
+
/**
|
|
49
|
+
* The link target.
|
|
50
|
+
*/
|
|
51
|
+
target: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: '_self'
|
|
54
|
+
},
|
|
55
|
+
/**
|
|
56
|
+
* The link rel.
|
|
57
|
+
*/
|
|
58
|
+
rel: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: null
|
|
61
|
+
},
|
|
62
|
+
/**
|
|
63
|
+
* Whether the route is exact, or not.
|
|
64
|
+
*/
|
|
65
|
+
exact: {
|
|
66
|
+
type: Boolean,
|
|
67
|
+
default: false
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* The class name attached when the route is exact,
|
|
71
|
+
*/
|
|
72
|
+
exactActiveClass: {
|
|
73
|
+
type: String
|
|
74
|
+
},
|
|
75
|
+
/**
|
|
76
|
+
* Whether the link is active, or not.
|
|
77
|
+
*/
|
|
78
|
+
active: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: false
|
|
81
|
+
},
|
|
82
|
+
/**
|
|
83
|
+
* The class applied when the link is active.
|
|
84
|
+
*/
|
|
85
|
+
activeClass: {
|
|
86
|
+
type: String
|
|
87
|
+
},
|
|
88
|
+
/**
|
|
89
|
+
* The component tag.
|
|
90
|
+
*/
|
|
91
|
+
tag: {
|
|
92
|
+
type: String,
|
|
93
|
+
default: 'a'
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
computed: {
|
|
97
|
+
computedTag() {
|
|
98
|
+
return this.to
|
|
99
|
+
&& !this.disabled
|
|
100
|
+
&& Boolean(this.$parent.$router) ? 'router-link' : 'a'
|
|
101
|
+
},
|
|
102
|
+
computedRel() {
|
|
103
|
+
return this.target === '_blank'
|
|
104
|
+
&& this.rel === null ? 'noopener' : this.rel || null
|
|
105
|
+
},
|
|
106
|
+
computedHref() {
|
|
107
|
+
if (this.computedTag === 'router-link') {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (this.href) {
|
|
112
|
+
return this.href;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (this.to) {
|
|
116
|
+
if (typeof this.to === 'string') {
|
|
117
|
+
return this.to;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (typeof this.to === 'object' && this.to.path) {
|
|
121
|
+
return this.to.path;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return '#';
|
|
126
|
+
},
|
|
127
|
+
computedTabindex() {
|
|
128
|
+
return this.disabled ? '-1' : (this.$attrs ? this.$attrs.tabindex : null);
|
|
129
|
+
},
|
|
130
|
+
computedAriaDisabled() {
|
|
131
|
+
return (this.tag === 'a' && this.disabled) ? 'true' : null;
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
methods: {
|
|
135
|
+
handleClick(event) {
|
|
136
|
+
const isRouterLink = this.computedTag === 'router-link';
|
|
137
|
+
|
|
138
|
+
if (this.disabled && event instanceof Event) {
|
|
139
|
+
event.stopPropagation();
|
|
140
|
+
event.stopImmediatePropagation();
|
|
141
|
+
} else {
|
|
142
|
+
if (isRouterLink && event.target.__vue__) {
|
|
143
|
+
event.target.__vue__.$emit('click', event);
|
|
144
|
+
} else {
|
|
145
|
+
this.$emit('click', event);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
this.emitOnRoot(LINK_EVENTS.CLICKED, event);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if ((!isRouterLink && this.computedHref === '#') || this.disabled) {
|
|
152
|
+
event.preventDefault();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Links
|
|
2
|
+
|
|
3
|
+
The `<d-link>` component is a wrapper over regular `<a>` links or `<router-link>`s and it is used behind the scenes across multiple components.
|
|
4
|
+
|
|
5
|
+
> **Note:** Most components that use the `<d-link>` component are properly documented so you can see where you can take advantage of the props provided by this component.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Basic Example
|
|
9
|
+
|
|
10
|
+
Creating a regular link using the `<d-link>` component is fairly simple.
|
|
11
|
+
|
|
12
|
+
:::demo
|
|
13
|
+
```html
|
|
14
|
+
|
|
15
|
+
<d-link href="#lorem-ipsum">My Link</d-link>
|
|
16
|
+
|
|
17
|
+
<!-- link-1.vue -->
|
|
18
|
+
```
|
|
19
|
+
:::
|
|
20
|
+
|
|
21
|
+
## Router Links
|
|
22
|
+
|
|
23
|
+
Using the `to` prop will turn the link into a `<router-link>` component.
|
|
24
|
+
|
|
25
|
+
## Disabled State
|
|
26
|
+
|
|
27
|
+
Using the `disabled` prop you can set your link as disabled.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export default function createLinkProps() {
|
|
2
|
+
return {
|
|
3
|
+
href: {
|
|
4
|
+
type: String,
|
|
5
|
+
default: null
|
|
6
|
+
},
|
|
7
|
+
to: {
|
|
8
|
+
type: [String, Object],
|
|
9
|
+
default: null
|
|
10
|
+
},
|
|
11
|
+
disabled: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: false
|
|
14
|
+
},
|
|
15
|
+
target: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: '_self'
|
|
18
|
+
},
|
|
19
|
+
rel: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: null
|
|
22
|
+
},
|
|
23
|
+
exact: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: false
|
|
26
|
+
},
|
|
27
|
+
exactActiveClass: {
|
|
28
|
+
type: String
|
|
29
|
+
},
|
|
30
|
+
active: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: false
|
|
33
|
+
},
|
|
34
|
+
activeClass: {
|
|
35
|
+
type: String
|
|
36
|
+
},
|
|
37
|
+
tag: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: 'a'
|
|
40
|
+
},
|
|
41
|
+
routerTag: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: 'a'
|
|
44
|
+
},
|
|
45
|
+
event: {
|
|
46
|
+
type: [String, Array],
|
|
47
|
+
default: 'click'
|
|
48
|
+
},
|
|
49
|
+
append: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: false
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { registerComponents, vueUse } from './../../utils';
|
|
2
|
+
|
|
3
|
+
import dLink from './Link.vue';
|
|
4
|
+
|
|
5
|
+
const components = {
|
|
6
|
+
dLink
|
|
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,30 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="tag" :class="[
|
|
3
|
+
'list-group',
|
|
4
|
+
flush ? 'list-group-flush' : ''
|
|
5
|
+
]">
|
|
6
|
+
<slot />
|
|
7
|
+
</component>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
export default {
|
|
12
|
+
name: 'd-list-group',
|
|
13
|
+
props: {
|
|
14
|
+
/**
|
|
15
|
+
* The element tag.
|
|
16
|
+
*/
|
|
17
|
+
tag: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: 'div'
|
|
20
|
+
},
|
|
21
|
+
/**
|
|
22
|
+
* Whether the list group should be flushed, or not.
|
|
23
|
+
*/
|
|
24
|
+
flush: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: false
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
</script>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="computedTag"
|
|
3
|
+
:class="[
|
|
4
|
+
'list-group-item',
|
|
5
|
+
theme ? `list-group-item-${theme}` : '',
|
|
6
|
+
isAction ? 'list-group-item-action': '',
|
|
7
|
+
active ? 'active' : '',
|
|
8
|
+
disabled ? 'disabled' : ''
|
|
9
|
+
]"
|
|
10
|
+
:disabled="button && disabled">
|
|
11
|
+
<slot />
|
|
12
|
+
</component>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script>
|
|
16
|
+
import dLink from '../link/Link.vue'
|
|
17
|
+
import createLinkProps from '../link/create-link-props'
|
|
18
|
+
import { THEMECOLORS } from '../../utils/constants'
|
|
19
|
+
|
|
20
|
+
let _linkProps = createLinkProps()
|
|
21
|
+
|
|
22
|
+
if (_linkProps && typeof _linkProps.href !== 'undefined') {
|
|
23
|
+
delete _linkProps.href.default
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (_linkProps && typeof _linkProps.to !== 'undefined') {
|
|
27
|
+
delete _linkProps.to.default
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const _actionTags = ['a', 'router-link', 'button', 'd-link']
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* This subcomponent is inheriting <a href="/docs/components/link">Link</a> component's props.
|
|
34
|
+
*/
|
|
35
|
+
export default {
|
|
36
|
+
name: 'd-list-group-item',
|
|
37
|
+
components: {
|
|
38
|
+
dLink
|
|
39
|
+
},
|
|
40
|
+
props: {
|
|
41
|
+
..._linkProps, ...{
|
|
42
|
+
/**
|
|
43
|
+
* The element tag.
|
|
44
|
+
*/
|
|
45
|
+
tag: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: 'div'
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* The element action.
|
|
51
|
+
*/
|
|
52
|
+
action: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: null
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* Whether the element tag should be a button, or not.
|
|
58
|
+
*/
|
|
59
|
+
button: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: null
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* The theme color.
|
|
65
|
+
*/
|
|
66
|
+
theme: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: null,
|
|
69
|
+
validator: v => THEMECOLORS.includes(v)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
computed: {
|
|
74
|
+
computedTag() {
|
|
75
|
+
const _tagOrLink = ((!this.href && !this.to) ? this.tag : 'd-link')
|
|
76
|
+
return this.button ? 'button' : _tagOrLink
|
|
77
|
+
},
|
|
78
|
+
isAction() {
|
|
79
|
+
return Boolean(
|
|
80
|
+
this.href
|
|
81
|
+
|| this.to
|
|
82
|
+
|| this.action
|
|
83
|
+
|| this.button
|
|
84
|
+
|| _actionTags.includes(this.tag)
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
</script>
|
|
90
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# List Groups
|
|
2
|
+
|
|
3
|
+
List groups allow you to display series of content.
|
|
4
|
+
|
|
5
|
+
## Basic Example
|
|
6
|
+
|
|
7
|
+
You can create list groups using the `<d-list-group>` component with the `<d-list-group-item>` sub-component.
|
|
8
|
+
|
|
9
|
+
:::demo
|
|
10
|
+
```html
|
|
11
|
+
|
|
12
|
+
<d-list-group>
|
|
13
|
+
<d-list-group-item>Cras justo odio</d-list-group-item>
|
|
14
|
+
<d-list-group-item>Dapibus ac facilisis in</d-list-group-item>
|
|
15
|
+
<d-list-group-item>Morbi leo risus</d-list-group-item>
|
|
16
|
+
<d-list-group-item>Porta ac consectetur ac</d-list-group-item>
|
|
17
|
+
<d-list-group-item>Vestibulum at eros</d-list-group-item>
|
|
18
|
+
</d-list-group>
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
<!-- list-group-1.vue -->
|
|
22
|
+
```
|
|
23
|
+
:::
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { registerComponents, vueUse } from './../../utils';
|
|
2
|
+
|
|
3
|
+
import dListGroup from './ListGroup.vue';
|
|
4
|
+
import dListGroupItem from './ListGroupItem.vue'
|
|
5
|
+
|
|
6
|
+
const components = {
|
|
7
|
+
dListGroup,
|
|
8
|
+
dListGroupItem
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const VuePlugin = {
|
|
12
|
+
install (Vue) {
|
|
13
|
+
registerComponents(Vue, components)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
vueUse(VuePlugin)
|
|
18
|
+
|
|
19
|
+
export default VuePlugin
|