@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,86 @@
|
|
|
1
|
+
# Collapse
|
|
2
|
+
|
|
3
|
+
The `<collapse>` component, together with the [`v-d-toggle`](/docs/directives/toggle) directive allow you to easily toggle the visibility of your content.
|
|
4
|
+
|
|
5
|
+
## Basic Example
|
|
6
|
+
|
|
7
|
+
:::demo
|
|
8
|
+
```html
|
|
9
|
+
<div>
|
|
10
|
+
<d-btn v-d-toggle.my-collapse variant="primary">Toggle Collapse</d-btn>
|
|
11
|
+
<d-collapse id="my-collapse">
|
|
12
|
+
<div class="p-3 mt-3 border rounded">
|
|
13
|
+
<h5>😍 Now you see me!</h5>
|
|
14
|
+
<span>In sagittis nibh non arcu viverra, nec imperdiet quam suscipit. Sed porta eleifend scelerisque. Vestibulum dapibus quis arcu a facilisis.</span>
|
|
15
|
+
</div>
|
|
16
|
+
</d-collapse>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<!-- collapse-1.vue -->
|
|
20
|
+
```
|
|
21
|
+
:::
|
|
22
|
+
|
|
23
|
+
## Initial Visibility
|
|
24
|
+
|
|
25
|
+
Using the `visible` prop, you can make the `<d-collapse>` component show initially.
|
|
26
|
+
|
|
27
|
+
:::demo
|
|
28
|
+
```html
|
|
29
|
+
<div>
|
|
30
|
+
<d-btn v-d-toggle.my-collapse variant="primary">Toggle Collapse</d-btn>
|
|
31
|
+
<d-collapse visible id="my-collapse">
|
|
32
|
+
<div class="p-3 mt-3 border rounded">
|
|
33
|
+
<h5>😁 I'm already visible!</h5>
|
|
34
|
+
<span>In sagittis nibh non arcu viverra, nec imperdiet quam suscipit. Sed porta eleifend scelerisque. Vestibulum dapibus quis arcu a facilisis.</span>
|
|
35
|
+
</div>
|
|
36
|
+
</d-collapse>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<!-- collapse-2.vue -->
|
|
40
|
+
```
|
|
41
|
+
:::
|
|
42
|
+
|
|
43
|
+
## Accordions
|
|
44
|
+
|
|
45
|
+
The `accordion` prop you allows you to create dynamic and flexible accordions.
|
|
46
|
+
|
|
47
|
+
:::demo
|
|
48
|
+
```html
|
|
49
|
+
<div>
|
|
50
|
+
<d-card class="mb-1">
|
|
51
|
+
<d-card-header class="px-3 py-2" role="tab">
|
|
52
|
+
<d-btn block-level size="small" theme="secondary" href="#" v-d-toggle.accordion1>Accordion 1</d-btn>
|
|
53
|
+
</d-card-header>
|
|
54
|
+
<d-collapse id="accordion1" visible accordion="my-accordion" role="tabpanel">
|
|
55
|
+
<d-card-body>
|
|
56
|
+
<p class="card-text">Nullam augue tortor, viverra id gravida fermentum, posuere a libero. Curabitur at arcu tortor. Donec cursus blandit leo consequat convallis.</p>
|
|
57
|
+
</d-card-body>
|
|
58
|
+
</d-collapse>
|
|
59
|
+
</d-card>
|
|
60
|
+
|
|
61
|
+
<d-card class="mb-1">
|
|
62
|
+
<d-card-header class="px-3 py-2" role="tab">
|
|
63
|
+
<d-btn block-level size="small" theme="secondary" href="#" v-d-toggle.accordion2>Accordion 2</d-btn>
|
|
64
|
+
</d-card-header>
|
|
65
|
+
<d-collapse id="accordion2" accordion="my-accordion" role="tabpanel">
|
|
66
|
+
<d-card-body>
|
|
67
|
+
<p class="card-text">Etiam at congue tellus, vitae congue metus. Praesent eget arcu eget justo sodales venenatis. Nam nec est urna. Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
|
|
68
|
+
</d-card-body>
|
|
69
|
+
</d-collapse>
|
|
70
|
+
</d-card>
|
|
71
|
+
|
|
72
|
+
<d-card class="mb-1">
|
|
73
|
+
<d-card-header class="px-3 py-2" role="tab">
|
|
74
|
+
<d-btn block-level size="small" theme="secondary" href="#" v-d-toggle.accordion3>Accordion 3</d-btn>
|
|
75
|
+
</d-card-header>
|
|
76
|
+
<d-collapse id="accordion3" accordion="my-accordion" role="tabpanel">
|
|
77
|
+
<d-card-body>
|
|
78
|
+
<p class="card-text">Maecenas tempor dapibus eros, ut ultricies est dapibus eu. Pellentesque quis nisi suscipit, dignissim nunc nec, rhoncus dolor. Maecenas tempus egestas egestas.</p>
|
|
79
|
+
</d-card-body>
|
|
80
|
+
</d-collapse>
|
|
81
|
+
</d-card>
|
|
82
|
+
</div>
|
|
83
|
+
|
|
84
|
+
<!-- collapse-3.vue -->
|
|
85
|
+
```
|
|
86
|
+
:::
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { registerComponents, vueUse } from './../../utils';
|
|
2
|
+
|
|
3
|
+
import dCollapse from './Collapse.vue';
|
|
4
|
+
|
|
5
|
+
const components = {
|
|
6
|
+
dCollapse
|
|
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,125 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="tag"
|
|
3
|
+
:class="[
|
|
4
|
+
breakpointClasses,
|
|
5
|
+
(col || (breakpointClasses.length === 0 && !cols)) ? 'col' : '',
|
|
6
|
+
cols ? `col-${cols}` : '',
|
|
7
|
+
offset ? `offset-${offset}` : '',
|
|
8
|
+
order ? `order-${order}` : '',
|
|
9
|
+
alignSelf ? `align-self-${alignSelf}` : ''
|
|
10
|
+
]">
|
|
11
|
+
<slot />
|
|
12
|
+
</component>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script>
|
|
16
|
+
export const suffixPropName = (suffix, str) => str + (suffix ? upperFirst(suffix) : '')
|
|
17
|
+
export const upperFirst = (str) => String(str).charAt(0).toUpperCase() + String(str).slice(1)
|
|
18
|
+
|
|
19
|
+
// Creates Bootstrap specific breakpoint classes.
|
|
20
|
+
export const createBreakpointClass = (type, breakpoint, val) => {
|
|
21
|
+
if (!!val === false) {
|
|
22
|
+
return false
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let className = type
|
|
26
|
+
|
|
27
|
+
if (breakpoint) {
|
|
28
|
+
className += `-${breakpoint.replace(type, '')}` // -md ?
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (type === 'col' && (val === '' || val === true)) {
|
|
32
|
+
return className.toLowerCase() // .col-md
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return `${className}-${val}`.toLowerCase()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Generates component properties.
|
|
39
|
+
export function generateProp(type = [Boolean, String, Number], defaultVal = null) {
|
|
40
|
+
return {
|
|
41
|
+
default: defaultVal,
|
|
42
|
+
type
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Breakpoints for later use.
|
|
47
|
+
const BREAKPOINTS = ['sm', 'md', 'lg', 'xl']
|
|
48
|
+
|
|
49
|
+
// Generate breakpoint maps.
|
|
50
|
+
const breakpointCol = createBreakpointMap([String, Number, Boolean], false)
|
|
51
|
+
const breakpointOffset = createBreakpointMap([String, Number], null, suffixPropName, 'offset')
|
|
52
|
+
const breakpointOrder = createBreakpointMap([String, Number], null, suffixPropName, 'order')
|
|
53
|
+
|
|
54
|
+
// Creates breakpoint maps
|
|
55
|
+
function createBreakpointMap(propGenArgs = null, defaultValue, breakpointWrapper = null, ...breakpointWrapperArgs) {
|
|
56
|
+
breakpointWrapper = breakpointWrapper === null ? (v) => v : breakpointWrapper
|
|
57
|
+
return BREAKPOINTS.reduce(function (map, breakpoint) {
|
|
58
|
+
map[breakpointWrapper(breakpoint, ...breakpointWrapperArgs)] = generateProp(propGenArgs, defaultValue)
|
|
59
|
+
return map
|
|
60
|
+
}, {})
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Define breakpoint props map
|
|
64
|
+
const breakpointPropMap = Object.assign({}, {
|
|
65
|
+
col: Object.keys(breakpointCol),
|
|
66
|
+
offset: Object.keys(breakpointOffset),
|
|
67
|
+
order: Object.keys(breakpointOrder)
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
export default {
|
|
71
|
+
name: 'd-col',
|
|
72
|
+
props: Object.assign({},
|
|
73
|
+
breakpointCol,
|
|
74
|
+
breakpointOffset,
|
|
75
|
+
breakpointOrder, {
|
|
76
|
+
/**
|
|
77
|
+
* The col element tag.
|
|
78
|
+
*/
|
|
79
|
+
tag: {
|
|
80
|
+
type: String,
|
|
81
|
+
default: 'div'
|
|
82
|
+
},
|
|
83
|
+
/**
|
|
84
|
+
* Automatic column.
|
|
85
|
+
*/
|
|
86
|
+
col: {
|
|
87
|
+
type: Boolean,
|
|
88
|
+
default: false
|
|
89
|
+
},
|
|
90
|
+
/**
|
|
91
|
+
* Make the component span a certain no. of columns.
|
|
92
|
+
*/
|
|
93
|
+
cols: generateProp([String, Number]),
|
|
94
|
+
/**
|
|
95
|
+
* Offset certain no. of columns.
|
|
96
|
+
*/
|
|
97
|
+
offset: generateProp([String, Number]),
|
|
98
|
+
order: generateProp([String, Number]),
|
|
99
|
+
alignSelf: {
|
|
100
|
+
type: String,
|
|
101
|
+
default: null,
|
|
102
|
+
validator: v => ['auto', 'start', 'end', 'center', 'baseline', 'stretch'].includes(v)
|
|
103
|
+
}
|
|
104
|
+
}),
|
|
105
|
+
computed: {
|
|
106
|
+
breakpointClasses() {
|
|
107
|
+
const classList = []
|
|
108
|
+
for (const type in breakpointPropMap) {
|
|
109
|
+
const keys = breakpointPropMap[type]
|
|
110
|
+
for (let i = 0; i < keys.length; i++) {
|
|
111
|
+
const key = keys[i]
|
|
112
|
+
const breakpointClass = createBreakpointClass(type, key, this[key])
|
|
113
|
+
|
|
114
|
+
if (breakpointClass && classList.indexOf(breakpointClass) === -1) {
|
|
115
|
+
classList.push(breakpointClass)
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return classList
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
</script>
|
|
125
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="tag"
|
|
3
|
+
:class="[
|
|
4
|
+
!fluid ? 'container' : 'container-fluid'
|
|
5
|
+
]">
|
|
6
|
+
<slot />
|
|
7
|
+
</component>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
export default {
|
|
12
|
+
name: 'd-container',
|
|
13
|
+
props: {
|
|
14
|
+
/**
|
|
15
|
+
* Container element tag.
|
|
16
|
+
*/
|
|
17
|
+
tag: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: 'div'
|
|
20
|
+
},
|
|
21
|
+
/**
|
|
22
|
+
* Whether the container is fluid or not.
|
|
23
|
+
*/
|
|
24
|
+
fluid: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: false
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
</script>
|
|
31
|
+
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Layout & Grid System
|
|
2
|
+
|
|
3
|
+
Shards Vue provides support for all native Bootstrap 4 layout elements including **containers**, **rows**, **columns** and **form rows** so you can use its full power while building your project's responsive layout powered by flexbox.
|
|
4
|
+
|
|
5
|
+
:::demo
|
|
6
|
+
```html
|
|
7
|
+
<d-container class="dr-example-container">
|
|
8
|
+
<d-row>
|
|
9
|
+
<d-col>1 / 12</d-col>
|
|
10
|
+
<d-col>2 / 12</d-col>
|
|
11
|
+
<d-col>3 / 12</d-col>
|
|
12
|
+
<d-col>4 / 12</d-col>
|
|
13
|
+
<d-col>5 / 12</d-col>
|
|
14
|
+
<d-col>6 / 12</d-col>
|
|
15
|
+
<d-col>7 / 12</d-col>
|
|
16
|
+
<d-col>8 / 12</d-col>
|
|
17
|
+
<d-col>9 / 12</d-col>
|
|
18
|
+
<d-col>10 / 12</d-col>
|
|
19
|
+
<d-col>11 / 12</d-col>
|
|
20
|
+
<d-col>12 / 12</d-col>
|
|
21
|
+
</d-row>
|
|
22
|
+
|
|
23
|
+
<d-row>
|
|
24
|
+
<d-col>1 / 6</d-col>
|
|
25
|
+
<d-col>2 / 6</d-col>
|
|
26
|
+
<d-col>3 / 6</d-col>
|
|
27
|
+
<d-col>4 / 6</d-col>
|
|
28
|
+
<d-col>5 / 6</d-col>
|
|
29
|
+
<d-col>6 / 6</d-col>
|
|
30
|
+
</d-row>
|
|
31
|
+
|
|
32
|
+
<d-row>
|
|
33
|
+
<d-col>1 / 3</d-col>
|
|
34
|
+
<d-col>2 / 3</d-col>
|
|
35
|
+
<d-col>3 / 3</d-col>
|
|
36
|
+
</d-row>
|
|
37
|
+
|
|
38
|
+
<d-row>
|
|
39
|
+
<d-col>1 / 2</d-col>
|
|
40
|
+
<d-col>2 / 2</d-col>
|
|
41
|
+
</d-row>
|
|
42
|
+
|
|
43
|
+
<d-row>
|
|
44
|
+
<d-col>1 / 1</d-col>
|
|
45
|
+
</d-row>
|
|
46
|
+
</d-container>
|
|
47
|
+
|
|
48
|
+
<!-- layout-containers-1.vue -->
|
|
49
|
+
```
|
|
50
|
+
:::
|
|
51
|
+
|
|
52
|
+
## Containers
|
|
53
|
+
|
|
54
|
+
Containers are the most **fundamental and required layout element** for your application or website's layout. You can use the `<d-container>` component for a fixed container, or `<d-container fluid>` for a fluid container.
|
|
55
|
+
|
|
56
|
+
## Rows
|
|
57
|
+
|
|
58
|
+
The `<d-row>` component must be placed inside a `<d-container>` component and it is used to define a row of columns. You can also use the `<d-form-row>` component for building form layouts that help you create a layout with more compact margins.
|
|
59
|
+
|
|
60
|
+
## Columns
|
|
61
|
+
|
|
62
|
+
The `<d-col>` component is used to represent a column and must be placed inside a `<d-row>` component. You can also use the `<d-col>` component without a breakpoint-specific prop (`sm`, `md`, `lg`, `xl`) for easy column sizing that have an equal width (as seen in the examples above).
|
|
63
|
+
|
|
64
|
+
## Mixing Breakpoints
|
|
65
|
+
|
|
66
|
+
You can use a combination of different props for each tier as needed.
|
|
67
|
+
|
|
68
|
+
:::demo
|
|
69
|
+
```html
|
|
70
|
+
<d-container class="dr-example-container">
|
|
71
|
+
<d-row>
|
|
72
|
+
<d-col cols="12" md="6" lg="8">cols="12" md="6" lg="8"</d-col>
|
|
73
|
+
<d-col cols="12" md="6" lg="4">cols="12" md="6" lg="8"</d-col>
|
|
74
|
+
</d-row>
|
|
75
|
+
|
|
76
|
+
<d-row>
|
|
77
|
+
<d-col cols="12" md="4" lg="3">cols="12" md="4" lg="3"</d-col>
|
|
78
|
+
<d-col cols="12" md="4" lg="6">cols="12" md="4" lg="6"</d-col>
|
|
79
|
+
<d-col cols="12" md="4" lg="3">cols="12" md="4" lg="3"</d-col>
|
|
80
|
+
</d-row>
|
|
81
|
+
|
|
82
|
+
<d-row>
|
|
83
|
+
<d-col cols="12" md="6" lg="4">cols="12" md="6" lg="4"</d-col>
|
|
84
|
+
<d-col cols="12" md="6" lg="8">cols="12" md="6" lg="8"</d-col>
|
|
85
|
+
</d-row>
|
|
86
|
+
</d-container>
|
|
87
|
+
|
|
88
|
+
<!-- layout-containers-4.vue -->
|
|
89
|
+
```
|
|
90
|
+
:::
|
|
91
|
+
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="tag"
|
|
3
|
+
class="row"
|
|
4
|
+
:class="[
|
|
5
|
+
noGutters ? 'no-gutters' : '',
|
|
6
|
+
alignV ? `align-items-${alignV}` : '',
|
|
7
|
+
alignH ? `justify-content-${alignH}` : '',
|
|
8
|
+
alignContent ? `align-content-${alignContent}` : ''
|
|
9
|
+
]">
|
|
10
|
+
<slot />
|
|
11
|
+
</component>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
const ALIGNMENT = ['start', 'end', 'center'];
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The row subcomponent.
|
|
19
|
+
*/
|
|
20
|
+
export default {
|
|
21
|
+
name: 'd-row',
|
|
22
|
+
props: {
|
|
23
|
+
/**
|
|
24
|
+
* Row element tag.
|
|
25
|
+
*/
|
|
26
|
+
tag: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: 'div'
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* Whether to remove gutters, or not.
|
|
32
|
+
*/
|
|
33
|
+
noGutters: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false
|
|
36
|
+
},
|
|
37
|
+
/**
|
|
38
|
+
* Align items vertically.
|
|
39
|
+
*/
|
|
40
|
+
alignV: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: null,
|
|
43
|
+
validator: v => ALIGNMENT.concat(['baseline', 'stretch']).includes(v)
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* Justify content horizontally.
|
|
47
|
+
*/
|
|
48
|
+
alignH: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: null,
|
|
51
|
+
validator: v => ALIGNMENT.concat(['between', 'around']).includes(v)
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* Align content.
|
|
55
|
+
*/
|
|
56
|
+
alignContent: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: null,
|
|
59
|
+
validator: v => ALIGNMENT.concat(['between', 'around', 'stretch']).includes(v)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
</script>
|
|
64
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { registerComponents, vueUse } from './../../utils';
|
|
2
|
+
|
|
3
|
+
import dContainer from './Container.vue';
|
|
4
|
+
import dRow from './Row.vue';
|
|
5
|
+
import dCol from './Col.vue';
|
|
6
|
+
|
|
7
|
+
const components = {
|
|
8
|
+
dContainer,
|
|
9
|
+
dRow,
|
|
10
|
+
dCol,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const VuePlugin = {
|
|
14
|
+
install (Vue) {
|
|
15
|
+
registerComponents(Vue, components)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
vueUse(VuePlugin)
|
|
20
|
+
|
|
21
|
+
export default VuePlugin
|