@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,107 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<button class="btn"
|
|
3
|
+
@click="handleClick"
|
|
4
|
+
:class="[
|
|
5
|
+
themeClass,
|
|
6
|
+
sizeClass,
|
|
7
|
+
pill ? 'btn-pill' : '',
|
|
8
|
+
squared ? 'btn-squared' : '',
|
|
9
|
+
blockLevel ? 'btn-block' : '',
|
|
10
|
+
active ? 'active' : ''
|
|
11
|
+
]"
|
|
12
|
+
:disabled="this.disabled"
|
|
13
|
+
:aria-pressed="this.active">
|
|
14
|
+
<slot>Button</slot>
|
|
15
|
+
</button>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script>
|
|
19
|
+
import { THEMECOLORS } from '../../utils/constants'
|
|
20
|
+
|
|
21
|
+
export default {
|
|
22
|
+
name: 'd-button',
|
|
23
|
+
props: {
|
|
24
|
+
/**
|
|
25
|
+
* The theme style.
|
|
26
|
+
*/
|
|
27
|
+
theme: {
|
|
28
|
+
type: String,
|
|
29
|
+
validator: v => THEMECOLORS.includes(v),
|
|
30
|
+
default: 'primary'
|
|
31
|
+
},
|
|
32
|
+
/**
|
|
33
|
+
* Whether it should be displayed as an outline, or not.
|
|
34
|
+
*/
|
|
35
|
+
outline: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* Whether it should be displayed as a pill, or not.
|
|
41
|
+
*/
|
|
42
|
+
pill: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* Whether it should be displayed as a squared, or not.
|
|
48
|
+
*/
|
|
49
|
+
squared: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: false
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* The button's sizesize.
|
|
55
|
+
*/
|
|
56
|
+
size: {
|
|
57
|
+
type: String,
|
|
58
|
+
validator: v => ['sm', 'lg', null].includes(v),
|
|
59
|
+
default: null
|
|
60
|
+
},
|
|
61
|
+
/**
|
|
62
|
+
* Whether it should be displayed as block, or not.
|
|
63
|
+
*/
|
|
64
|
+
blockLevel: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
default: false
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* Whether it should be displayed as disabled, or not.
|
|
70
|
+
*/
|
|
71
|
+
disabled: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: false
|
|
74
|
+
},
|
|
75
|
+
/**
|
|
76
|
+
* Whether it should be displayed as active, or not.
|
|
77
|
+
*/
|
|
78
|
+
active: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: false
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
computed: {
|
|
84
|
+
sizeClass() {
|
|
85
|
+
if (this.size && this.size !== '') {
|
|
86
|
+
return `btn-${this.size}`;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return this.size;
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
themeClass() {
|
|
93
|
+
return this.theme ? `btn-${this.outline ? 'outline-' : ''}${this.theme}` : '';
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
methods: {
|
|
97
|
+
/**
|
|
98
|
+
* Triggered when the button is clicked.
|
|
99
|
+
*
|
|
100
|
+
* @event click
|
|
101
|
+
*/
|
|
102
|
+
handleClick(e) {
|
|
103
|
+
this.$emit('click', e);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
</script>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<button :class="[ 'close', theme ? `text-${theme}` : '' ]"
|
|
3
|
+
:disabled="disabled"
|
|
4
|
+
:aria-label="ariaLabel"
|
|
5
|
+
@click="handleClick">
|
|
6
|
+
<slot>×</slot>
|
|
7
|
+
</button>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
export default {
|
|
12
|
+
name: 'd-button-close',
|
|
13
|
+
props: {
|
|
14
|
+
/**
|
|
15
|
+
* Whether it should be displayed as disabled, or not.
|
|
16
|
+
*/
|
|
17
|
+
disabled: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: false
|
|
20
|
+
},
|
|
21
|
+
/**
|
|
22
|
+
* The theme color value.
|
|
23
|
+
*/
|
|
24
|
+
theme: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: null
|
|
27
|
+
},
|
|
28
|
+
/**
|
|
29
|
+
* The aria-label value.
|
|
30
|
+
*/
|
|
31
|
+
ariaLabel: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: 'Close'
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
methods: {
|
|
37
|
+
handleClick(e) {
|
|
38
|
+
if (this.disabled && e instanceof Event) {
|
|
39
|
+
e.stopPropagation();
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
this.$emit('click', e);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
</script>
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# Buttons
|
|
2
|
+
|
|
3
|
+
Buttons are Bootstrap's core component for triggering various actions. In Shards, they're very flxible, support multiple sizes, states and many more.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Button Themes
|
|
7
|
+
|
|
8
|
+
Using the `theme` prop you can easily change the appearance of your button using one the main theme colors: `primary, secondary, success, danger, warning, info, light` and `dark`. The default theme value is `primary`.
|
|
9
|
+
|
|
10
|
+
:::demo
|
|
11
|
+
```html
|
|
12
|
+
<d-button>Primary</d-button>
|
|
13
|
+
<d-button theme="secondary">Secondary</d-button>
|
|
14
|
+
<d-button theme="success">Success</d-button>
|
|
15
|
+
<d-button theme="info">Info</d-button>
|
|
16
|
+
<d-button theme="warning">Warning</d-button>
|
|
17
|
+
<d-button theme="danger">Danger</d-button>
|
|
18
|
+
<d-button theme="light">Light</d-button>
|
|
19
|
+
<d-button theme="dark">Dark</d-button>
|
|
20
|
+
|
|
21
|
+
<!-- buttons-1.vue -->
|
|
22
|
+
```
|
|
23
|
+
:::
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## Outline Styled Buttons
|
|
27
|
+
|
|
28
|
+
Using the `outline` prop removes the background color and applies a thin border that make your buttons to look outlined.
|
|
29
|
+
|
|
30
|
+
:::demo
|
|
31
|
+
```html
|
|
32
|
+
<d-button outline>Primary</d-button>
|
|
33
|
+
<d-button outline theme="secondary">Secondary</d-button>
|
|
34
|
+
<d-button outline theme="success">Success</d-button>
|
|
35
|
+
<d-button outline theme="info">Info</d-button>
|
|
36
|
+
<d-button outline theme="warning">Warning</d-button>
|
|
37
|
+
<d-button outline theme="danger">Danger</d-button>
|
|
38
|
+
<d-button outline theme="light">Light</d-button>
|
|
39
|
+
<d-button outline theme="dark">Dark</d-button>
|
|
40
|
+
|
|
41
|
+
<!-- buttons-2.vue -->
|
|
42
|
+
```
|
|
43
|
+
:::
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## Pill Shaped Buttons
|
|
47
|
+
|
|
48
|
+
Using the `pill` prop appiles a larger border radius that make your buttons to look more rounded and pill-like.
|
|
49
|
+
|
|
50
|
+
:::demo
|
|
51
|
+
```html
|
|
52
|
+
<d-button pill>Primary</d-button>
|
|
53
|
+
<d-button pill theme="secondary">Secondary</d-button>
|
|
54
|
+
<d-button pill theme="success">Success</d-button>
|
|
55
|
+
<d-button pill theme="info">Info</d-button>
|
|
56
|
+
<d-button pill theme="warning">Warning</d-button>
|
|
57
|
+
<d-button pill theme="danger">Danger</d-button>
|
|
58
|
+
<d-button pill theme="light">Light</d-button>
|
|
59
|
+
<d-button pill theme="dark">Dark</d-button>
|
|
60
|
+
|
|
61
|
+
<!-- buttons-3.vue -->
|
|
62
|
+
```
|
|
63
|
+
:::
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
## Mixed Styles
|
|
67
|
+
|
|
68
|
+
Similarly to [Badges](/docs/components/badges) you can also mix both `pill` and `outline` props to get a mixed "outline-pill" result.
|
|
69
|
+
|
|
70
|
+
:::demo
|
|
71
|
+
```html
|
|
72
|
+
<d-button outline pill>Primary</d-button>
|
|
73
|
+
<d-button outline pill theme="secondary">Secondary</d-button>
|
|
74
|
+
<d-button outline pill theme="success">Success</d-button>
|
|
75
|
+
<d-button outline pill theme="info">Info</d-button>
|
|
76
|
+
<d-button outline pill theme="warning">Warning</d-button>
|
|
77
|
+
<d-button outline pill theme="danger">Danger</d-button>
|
|
78
|
+
<d-button outline pill theme="light">Light</d-button>
|
|
79
|
+
<d-button outline pill theme="dark">Dark</d-button>
|
|
80
|
+
|
|
81
|
+
<!-- buttons-4.vue -->
|
|
82
|
+
```
|
|
83
|
+
:::
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
## Squared Style
|
|
87
|
+
|
|
88
|
+
Using the `squared` prop you can style your buttons to look, well, squared.
|
|
89
|
+
|
|
90
|
+
:::demo
|
|
91
|
+
```html
|
|
92
|
+
<d-button squared>Primary</d-button>
|
|
93
|
+
<d-button squared theme="secondary">Secondary</d-button>
|
|
94
|
+
<d-button squared theme="success">Success</d-button>
|
|
95
|
+
<d-button squared theme="info">Info</d-button>
|
|
96
|
+
<d-button squared theme="warning">Warning</d-button>
|
|
97
|
+
<d-button squared theme="danger">Danger</d-button>
|
|
98
|
+
<d-button squared theme="light">Light</d-button>
|
|
99
|
+
<d-button squared theme="dark">Dark</d-button>
|
|
100
|
+
|
|
101
|
+
<!-- buttons-5.vue -->
|
|
102
|
+
```
|
|
103
|
+
:::
|
|
104
|
+
|
|
105
|
+
> **Note:** The `pill` prop has priority over the `squared` prop.
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
## Mixed Outline-Squared Style
|
|
109
|
+
|
|
110
|
+
Mixing the `outline` and `squared` prop is also possible and it will render an outlined and squared button.
|
|
111
|
+
|
|
112
|
+
:::demo
|
|
113
|
+
```html
|
|
114
|
+
<d-button outline squared>Primary</d-button>
|
|
115
|
+
<d-button outline squared theme="secondary">Secondary</d-button>
|
|
116
|
+
<d-button outline squared theme="success">Success</d-button>
|
|
117
|
+
<d-button outline squared theme="info">Info</d-button>
|
|
118
|
+
<d-button outline squared theme="warning">Warning</d-button>
|
|
119
|
+
<d-button outline squared theme="danger">Danger</d-button>
|
|
120
|
+
<d-button outline squared theme="light">Light</d-button>
|
|
121
|
+
<d-button outline squared theme="dark">Dark</d-button>
|
|
122
|
+
|
|
123
|
+
<!-- buttons-6.vue -->
|
|
124
|
+
```
|
|
125
|
+
:::
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
## Button Sizes
|
|
129
|
+
|
|
130
|
+
Buttons come in three size variations: `lg`, normal (default) and `sm`. You can control the size of your buttons using the `size` prop.
|
|
131
|
+
|
|
132
|
+
:::demo
|
|
133
|
+
```html
|
|
134
|
+
<d-button size="lg">Large</d-button>
|
|
135
|
+
<d-button>Normal</d-button>
|
|
136
|
+
<d-button size="sm">Small</d-button>
|
|
137
|
+
|
|
138
|
+
<!-- buttons-7.vue -->
|
|
139
|
+
```
|
|
140
|
+
:::
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
## Active State
|
|
144
|
+
|
|
145
|
+
If you need to control the `active` state and appearance of your button programatically, you can use the `active` prop.
|
|
146
|
+
|
|
147
|
+
:::demo
|
|
148
|
+
```html
|
|
149
|
+
<d-button active theme="success">Success Active</d-button>
|
|
150
|
+
<d-button active theme="danger">Danger Active</d-button>
|
|
151
|
+
|
|
152
|
+
<!-- buttons-8.vue -->
|
|
153
|
+
```
|
|
154
|
+
:::
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
## Disabled State
|
|
158
|
+
|
|
159
|
+
Similarly to the active state, the `disabled` state can also be crontrolled via the `disabled` prop.
|
|
160
|
+
|
|
161
|
+
:::demo
|
|
162
|
+
```html
|
|
163
|
+
<d-button disabled theme="success">Success Disabled</d-button>
|
|
164
|
+
<d-button disabled theme="danger">Danger Disabled</d-button>
|
|
165
|
+
|
|
166
|
+
<!-- buttons-9.vue -->
|
|
167
|
+
```
|
|
168
|
+
:::
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
## Toggle State
|
|
172
|
+
|
|
173
|
+
Toggling a button's state is currently not supported, but available on the [roadmap](/roadmap).
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
## Change Tags
|
|
177
|
+
|
|
178
|
+
Changing the button's tag (eg. using native `<a>` or `<input>` elements) is currently not supported, but available on the [roadmap](/roadmap).
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
## Block Level Buttons
|
|
182
|
+
|
|
183
|
+
Using the `block-level` prop you can make buttons display using the full-width of their parent element
|
|
184
|
+
|
|
185
|
+
:::demo
|
|
186
|
+
```html
|
|
187
|
+
<d-button block-level>Primary</d-button>
|
|
188
|
+
<d-button block-level theme="secondary">Secondary</d-button>
|
|
189
|
+
|
|
190
|
+
<!-- buttons-10.vue -->
|
|
191
|
+
```
|
|
192
|
+
:::
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
## Alias
|
|
196
|
+
|
|
197
|
+
The `<d-button>` component is also available as `<d-btn>`.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { registerComponents, vueUse } from './../../utils';
|
|
2
|
+
|
|
3
|
+
import dButton from './Button.vue';
|
|
4
|
+
import dButtonClose from './ButtonClose.vue';
|
|
5
|
+
|
|
6
|
+
const components = {
|
|
7
|
+
dButton,
|
|
8
|
+
dBtn: dButton,
|
|
9
|
+
dButtonClose,
|
|
10
|
+
dBtnClose: dButtonClose
|
|
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,66 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="[
|
|
3
|
+
btnGroupSizeClass,
|
|
4
|
+
vertical ? 'btn-group-vertical' : 'btn-group'
|
|
5
|
+
]"
|
|
6
|
+
:aria-role="ariaRole"
|
|
7
|
+
:aria-label="ariaLabel">
|
|
8
|
+
<slot />
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
export default {
|
|
14
|
+
name: 'd-button-group',
|
|
15
|
+
props: {
|
|
16
|
+
/**
|
|
17
|
+
* Whether it is a vertical button group, or not.
|
|
18
|
+
*/
|
|
19
|
+
vertical: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: false
|
|
22
|
+
},
|
|
23
|
+
/**
|
|
24
|
+
* The button group size.
|
|
25
|
+
*/
|
|
26
|
+
size: {
|
|
27
|
+
type: String,
|
|
28
|
+
validator: v => ['small', 'large', null].includes(v),
|
|
29
|
+
default: null
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
* The button group's aria role.
|
|
33
|
+
*/
|
|
34
|
+
ariaRole: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: 'group'
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* The button group's aria label.
|
|
40
|
+
*/
|
|
41
|
+
ariaLabel: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: 'Button group'
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
computed: {
|
|
47
|
+
btnGroupSizeClass() {
|
|
48
|
+
const buttonGroupSizes = { small: 'sm', large: 'lg' };
|
|
49
|
+
|
|
50
|
+
if (this.size !== '') {
|
|
51
|
+
return `btn-group-${buttonGroupSizes[this.size]}`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return this.size;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<style lang="scss" scoped>
|
|
61
|
+
// TODO: This should be fixed in Shards.
|
|
62
|
+
.btn-group-vertical .btn + .btn {
|
|
63
|
+
margin-left: 0 !important;
|
|
64
|
+
}
|
|
65
|
+
</style>
|
|
66
|
+
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Button Groups
|
|
2
|
+
|
|
3
|
+
Button groups allow you to group buttons together on a single line.
|
|
4
|
+
|
|
5
|
+
## Basic Example
|
|
6
|
+
|
|
7
|
+
You can create button groups using the `<d-button-group>` component.
|
|
8
|
+
|
|
9
|
+
:::demo Default button group
|
|
10
|
+
```html
|
|
11
|
+
<d-button-group>
|
|
12
|
+
<d-button>Left</d-button>
|
|
13
|
+
<d-button>Middle</d-button>
|
|
14
|
+
<d-button>Right</d-button>
|
|
15
|
+
</d-button-group>
|
|
16
|
+
|
|
17
|
+
<!-- button-group-1.vue -->
|
|
18
|
+
```
|
|
19
|
+
:::
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## Button Group Size
|
|
23
|
+
|
|
24
|
+
The button group's size can be controlled via the `size` prop. The button group can be normal (default with no value), `small` or `large`.
|
|
25
|
+
|
|
26
|
+
:::demo
|
|
27
|
+
```html
|
|
28
|
+
|
|
29
|
+
<div>
|
|
30
|
+
<!-- Large Button Group -->
|
|
31
|
+
<d-button-group size="large" class="mr-2">
|
|
32
|
+
<d-button>Large</d-button>
|
|
33
|
+
<d-button>Large</d-button>
|
|
34
|
+
</d-button-group>
|
|
35
|
+
|
|
36
|
+
<!-- Normal Button Group -->
|
|
37
|
+
<d-button-group class="mr-2">
|
|
38
|
+
<d-button>Normal</d-button>
|
|
39
|
+
<d-button>Normal</d-button>
|
|
40
|
+
</d-button-group>
|
|
41
|
+
|
|
42
|
+
<!-- Small Button Group -->
|
|
43
|
+
<d-button-group size="small">
|
|
44
|
+
<d-button>Small</d-button>
|
|
45
|
+
<d-button>Small</d-button>
|
|
46
|
+
</d-button-group>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<!-- button-group-3.vue -->
|
|
50
|
+
```
|
|
51
|
+
:::
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## Vertical Button Group
|
|
55
|
+
|
|
56
|
+
You can stack button groups vertically using the `vertical` prop.
|
|
57
|
+
|
|
58
|
+
:::demo
|
|
59
|
+
```html
|
|
60
|
+
<d-button-group vertical>
|
|
61
|
+
<d-button>Button 1</d-button>
|
|
62
|
+
<d-button>Button 2</d-button>
|
|
63
|
+
</d-button-group>
|
|
64
|
+
|
|
65
|
+
<!-- button-group-3.vue -->
|
|
66
|
+
```
|
|
67
|
+
:::
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## Alias
|
|
71
|
+
|
|
72
|
+
The `<d-button-group>` component is also aliased as `<d-btn-group>`.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { registerComponents, vueUse } from '../../utils';
|
|
2
|
+
|
|
3
|
+
import dButtonGroup from './ButtonGroup.vue';
|
|
4
|
+
|
|
5
|
+
const components = {
|
|
6
|
+
dButtonGroup,
|
|
7
|
+
sBtnGroup: dButtonGroup
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const VuePlugin = {
|
|
11
|
+
install (Vue) {
|
|
12
|
+
registerComponents(Vue, components)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
vueUse(VuePlugin)
|
|
17
|
+
|
|
18
|
+
export default VuePlugin
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="btn-toolbar"
|
|
3
|
+
:aria-role="ariaRole"
|
|
4
|
+
:aria-label="ariaLabel">
|
|
5
|
+
<slot />
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
export default {
|
|
11
|
+
name: 'd-button-toolbar',
|
|
12
|
+
props: {
|
|
13
|
+
/**
|
|
14
|
+
* Button toolbar aria role.
|
|
15
|
+
*/
|
|
16
|
+
ariaRole: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: 'toolbar'
|
|
19
|
+
},
|
|
20
|
+
/**
|
|
21
|
+
* Button toolbar aria label.
|
|
22
|
+
*/
|
|
23
|
+
ariaLabel: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: 'Button toolbar'
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
</script>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Button Toolbars
|
|
2
|
+
|
|
3
|
+
Button toolbars allow you to group a series of button or input groups on a single line.
|
|
4
|
+
|
|
5
|
+
:::demo
|
|
6
|
+
```html
|
|
7
|
+
<d-button-toolbar>
|
|
8
|
+
<d-button-group size="small" class="mr-3">
|
|
9
|
+
<d-button>Create</d-button>
|
|
10
|
+
<d-button>Edit</d-button>
|
|
11
|
+
</d-button-group>
|
|
12
|
+
|
|
13
|
+
<d-input-group prepend="Project">
|
|
14
|
+
<d-input placeholder="Title"/>
|
|
15
|
+
</d-input-group>
|
|
16
|
+
</d-button-toolbar>
|
|
17
|
+
|
|
18
|
+
<!-- button-toolbar-1.vue -->
|
|
19
|
+
```
|
|
20
|
+
:::
|
|
21
|
+
|
|
22
|
+
## Alias
|
|
23
|
+
|
|
24
|
+
The `<d-button-toolbar>` component is also aliased as `<d-btn-toolbar>`.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { registerComponents, vueUse } from '../../utils';
|
|
2
|
+
|
|
3
|
+
import dButtonToolbar from './ButtonToolbar.vue';
|
|
4
|
+
|
|
5
|
+
const components = {
|
|
6
|
+
dButtonToolbar,
|
|
7
|
+
dBtnToolbar: dButtonToolbar
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const VuePlugin = {
|
|
11
|
+
install (Vue) {
|
|
12
|
+
registerComponents(Vue, components)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
vueUse(VuePlugin)
|
|
17
|
+
|
|
18
|
+
export default VuePlugin
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="tag"
|
|
3
|
+
v-bind="$attrs"
|
|
4
|
+
v-on="$listeners"
|
|
5
|
+
:class="[
|
|
6
|
+
'card',
|
|
7
|
+
Boolean(align) ? `text-${align}` : '',
|
|
8
|
+
Boolean(bgTheme) ? `bg-${bgTheme}` : '',
|
|
9
|
+
Boolean(borderTheme) ? `border-${borderTheme}` : '',
|
|
10
|
+
Boolean(textTheme) ? `text-${textTheme}` : ''
|
|
11
|
+
]">
|
|
12
|
+
<slot />
|
|
13
|
+
</component>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
export default {
|
|
18
|
+
name: 'd-card',
|
|
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
|
+
* Alignment
|
|
50
|
+
*/
|
|
51
|
+
align: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: null
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
</script>
|