@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.
Files changed (173) hide show
  1. package/.editorconfig +13 -0
  2. package/CHANGELOG.md +49 -0
  3. package/CONTRIBUTING.md +92 -0
  4. package/ISSUE_TEMPLATE.md +19 -0
  5. package/LICENSE +21 -0
  6. package/README.md +157 -0
  7. package/build/optimize.js +49 -0
  8. package/build/paths.js +12 -0
  9. package/build/rollup.config.js +106 -0
  10. package/dist/shards-vue.common.js +13994 -0
  11. package/dist/shards-vue.common.js.map +1 -0
  12. package/dist/shards-vue.common.min.js +1 -0
  13. package/dist/shards-vue.common.min.map +1 -0
  14. package/dist/shards-vue.esm.js +13990 -0
  15. package/dist/shards-vue.esm.js.map +1 -0
  16. package/dist/shards-vue.esm.min.js +1 -0
  17. package/dist/shards-vue.esm.min.map +1 -0
  18. package/dist/shards-vue.umd.js +13997 -0
  19. package/dist/shards-vue.umd.js.map +1 -0
  20. package/dist/shards-vue.umd.min.js +1 -0
  21. package/dist/shards-vue.umd.min.map +1 -0
  22. package/logo.jpg +0 -0
  23. package/package.json +121 -0
  24. package/sandbox/Sandbox.vue +45 -0
  25. package/src/components/alert/Alert.vue +156 -0
  26. package/src/components/alert/README.md +86 -0
  27. package/src/components/alert/index.js +17 -0
  28. package/src/components/badge/Badge.vue +62 -0
  29. package/src/components/badge/README.md +112 -0
  30. package/src/components/badge/index.js +17 -0
  31. package/src/components/breadcrumb/Breadcrumb.vue +55 -0
  32. package/src/components/breadcrumb/BreadcrumbItem.vue +42 -0
  33. package/src/components/breadcrumb/BreadcrumbLink.vue +56 -0
  34. package/src/components/breadcrumb/README.md +53 -0
  35. package/src/components/breadcrumb/index.js +23 -0
  36. package/src/components/button/Button.vue +107 -0
  37. package/src/components/button/ButtonClose.vue +47 -0
  38. package/src/components/button/README.md +197 -0
  39. package/src/components/button/index.js +21 -0
  40. package/src/components/button-group/ButtonGroup.vue +66 -0
  41. package/src/components/button-group/README.md +72 -0
  42. package/src/components/button-group/index.js +18 -0
  43. package/src/components/button-toolbar/ButtonToolbar.vue +29 -0
  44. package/src/components/button-toolbar/README.md +24 -0
  45. package/src/components/button-toolbar/index.js +18 -0
  46. package/src/components/card/Card.vue +57 -0
  47. package/src/components/card/CardBody.vue +92 -0
  48. package/src/components/card/CardFooter.vue +61 -0
  49. package/src/components/card/CardGroup.vue +47 -0
  50. package/src/components/card/CardHeader.vue +61 -0
  51. package/src/components/card/CardImg.vue +64 -0
  52. package/src/components/card/README.md +96 -0
  53. package/src/components/card/index.js +27 -0
  54. package/src/components/collapse/Collapse.vue +209 -0
  55. package/src/components/collapse/README.md +86 -0
  56. package/src/components/collapse/index.js +17 -0
  57. package/src/components/container/Col.vue +125 -0
  58. package/src/components/container/Container.vue +31 -0
  59. package/src/components/container/README.md +91 -0
  60. package/src/components/container/Row.vue +64 -0
  61. package/src/components/container/index.js +21 -0
  62. package/src/components/datepicker/Datepicker.vue +391 -0
  63. package/src/components/datepicker/README.md +185 -0
  64. package/src/components/datepicker/index.js +17 -0
  65. package/src/components/dropdown/Dropdown.vue +442 -0
  66. package/src/components/dropdown/DropdownDivider.vue +22 -0
  67. package/src/components/dropdown/DropdownHeader.vue +29 -0
  68. package/src/components/dropdown/DropdownItem.vue +25 -0
  69. package/src/components/dropdown/README.md +177 -0
  70. package/src/components/dropdown/index.js +23 -0
  71. package/src/components/embed/Embed.vue +47 -0
  72. package/src/components/embed/README.md +23 -0
  73. package/src/components/embed/index.js +17 -0
  74. package/src/components/form/Form.vue +40 -0
  75. package/src/components/form/FormFeedback.vue +39 -0
  76. package/src/components/form/FormInvalidFeedback.vue +39 -0
  77. package/src/components/form/FormRow.vue +21 -0
  78. package/src/components/form/FormText.vue +41 -0
  79. package/src/components/form/FormValidFeedback.vue +39 -0
  80. package/src/components/form/README.md +84 -0
  81. package/src/components/form/index.js +29 -0
  82. package/src/components/form-checkbox/FormCheckbox.vue +200 -0
  83. package/src/components/form-checkbox/README.md +131 -0
  84. package/src/components/form-checkbox/index.js +18 -0
  85. package/src/components/form-input/FormInput.vue +176 -0
  86. package/src/components/form-input/README.md +110 -0
  87. package/src/components/form-input/index.js +18 -0
  88. package/src/components/form-radio/FormRadio.vue +155 -0
  89. package/src/components/form-radio/README.md +61 -0
  90. package/src/components/form-radio/index.js +18 -0
  91. package/src/components/form-select/FormSelect.vue +246 -0
  92. package/src/components/form-select/README.md +180 -0
  93. package/src/components/form-select/index.js +18 -0
  94. package/src/components/form-textarea/FormTextarea.vue +250 -0
  95. package/src/components/form-textarea/README.md +74 -0
  96. package/src/components/form-textarea/index.js +18 -0
  97. package/src/components/image/Image.vue +123 -0
  98. package/src/components/image/README.md +32 -0
  99. package/src/components/image/index.js +18 -0
  100. package/src/components/index.js +63 -0
  101. package/src/components/input-group/InputGroup.vue +125 -0
  102. package/src/components/input-group/InputGroupAddon.vue +58 -0
  103. package/src/components/input-group/InputGroupText.vue +20 -0
  104. package/src/components/input-group/README.md +188 -0
  105. package/src/components/input-group/index.js +21 -0
  106. package/src/components/link/Link.vue +157 -0
  107. package/src/components/link/README.md +27 -0
  108. package/src/components/link/create-link-props.js +54 -0
  109. package/src/components/link/index.js +17 -0
  110. package/src/components/list-group/ListGroup.vue +30 -0
  111. package/src/components/list-group/ListGroupItem.vue +90 -0
  112. package/src/components/list-group/README.md +23 -0
  113. package/src/components/list-group/index.js +19 -0
  114. package/src/components/modal/Modal.vue +121 -0
  115. package/src/components/modal/ModalBody.vue +20 -0
  116. package/src/components/modal/ModalFooter.vue +21 -0
  117. package/src/components/modal/ModalHeader.vue +39 -0
  118. package/src/components/modal/ModalTitle.vue +21 -0
  119. package/src/components/modal/README.md +74 -0
  120. package/src/components/modal/index.js +25 -0
  121. package/src/components/nav/Nav.vue +62 -0
  122. package/src/components/nav/NavItem.vue +23 -0
  123. package/src/components/nav/NavText.vue +21 -0
  124. package/src/components/nav/README.md +94 -0
  125. package/src/components/nav/index.js +19 -0
  126. package/src/components/navbar/Navbar.vue +63 -0
  127. package/src/components/navbar/NavbarBrand.vue +41 -0
  128. package/src/components/navbar/NavbarNav.vue +38 -0
  129. package/src/components/navbar/NavbarToggle.vue +55 -0
  130. package/src/components/navbar/README.md +51 -0
  131. package/src/components/navbar/index.js +23 -0
  132. package/src/components/popover/Popover.vue +126 -0
  133. package/src/components/popover/README.md +73 -0
  134. package/src/components/popover/index.js +17 -0
  135. package/src/components/progress/Progress.vue +93 -0
  136. package/src/components/progress/ProgressBar.vue +123 -0
  137. package/src/components/progress/README.md +95 -0
  138. package/src/components/progress/index.js +19 -0
  139. package/src/components/slider/README.md +120 -0
  140. package/src/components/slider/Slider.vue +103 -0
  141. package/src/components/slider/index.js +17 -0
  142. package/src/components/tabs/README.md +111 -0
  143. package/src/components/tabs/Tab.vue +132 -0
  144. package/src/components/tabs/Tabs.vue +290 -0
  145. package/src/components/tabs/_TabButton.vue +130 -0
  146. package/src/components/tabs/index.js +19 -0
  147. package/src/components/tooltip/README.md +70 -0
  148. package/src/components/tooltip/Tooltip.vue +115 -0
  149. package/src/components/tooltip/index.js +17 -0
  150. package/src/directives/index.js +7 -0
  151. package/src/directives/toggle/index.js +16 -0
  152. package/src/directives/toggle/toggle.js +45 -0
  153. package/src/directives/tooltip/README.md +42 -0
  154. package/src/directives/tooltip/index.js +16 -0
  155. package/src/directives/tooltip/meta.json +5 -0
  156. package/src/directives/tooltip/tooltip.js +145 -0
  157. package/src/index.js +27 -0
  158. package/src/markdown/getting-started/README.md +80 -0
  159. package/src/markdown/getting-started/meta.json +4 -0
  160. package/src/markdown/roadmap/README.md +3 -0
  161. package/src/markdown/roadmap/meta.json +4 -0
  162. package/src/mixins/checkbox-radio.mixin.js +73 -0
  163. package/src/mixins/root-listener.mixin.js +32 -0
  164. package/src/mixins/tooltip-popover.mixin.js +292 -0
  165. package/src/scripts/utils.js +18 -0
  166. package/src/utils/constants.js +191 -0
  167. package/src/utils/events.js +48 -0
  168. package/src/utils/index.js +251 -0
  169. package/src/utils/observer.js +56 -0
  170. package/src/utils/popover.class.js +91 -0
  171. package/src/utils/target.js +50 -0
  172. package/src/utils/tooltip.class.js +60 -0
  173. package/src/utils/tpmanager.class.js +730 -0
@@ -0,0 +1,55 @@
1
+ <template>
2
+ <button class="navbar-toggler"
3
+ :aria-label="label"
4
+ :aria-controls="target"
5
+ :aria-expanded="toggleState ? 'true' : 'false'"
6
+ @click="onClick">
7
+ <slot>
8
+ <span class="navbar-toggler-icon"></span>
9
+ </slot>
10
+ </button>
11
+ </template>
12
+
13
+ <script>
14
+ import rootListenerMixin from '../../mixins/root-listener.mixin'
15
+ import { COLLAPSE_EVENTS } from '../../utils/constants';
16
+
17
+ export default {
18
+ name: 'd-navbar-toggle',
19
+ mixins: [ rootListenerMixin ],
20
+ data() {
21
+ return {
22
+ toggleState: false
23
+ }
24
+ },
25
+ props: {
26
+ /**
27
+ * The label value.
28
+ */
29
+ label: {
30
+ type: String,
31
+ default: 'Toggle navigation'
32
+ },
33
+ /**
34
+ * The toggle target.
35
+ */
36
+ target: {
37
+ type: String,
38
+ required: true
39
+ }
40
+ },
41
+ methods: {
42
+ onClick() {
43
+ this.$root.$emit(COLLAPSE_EVENTS.TOGGLE, this.target)
44
+ },
45
+ handleStateEvent(id, state) {
46
+ if (id === this.target) {
47
+ this.toggleState = state
48
+ }
49
+ }
50
+ },
51
+ created() {
52
+ this.listenOnRoot(COLLAPSE_EVENTS.STATE, this.handleStateEvent)
53
+ }
54
+ }
55
+ </script>
@@ -0,0 +1,51 @@
1
+ # Navbars
2
+
3
+ Using the `<d-navbar>` component you can create powerful and responsive navigation headers.
4
+
5
+ ## Basic Example
6
+
7
+ :::demo
8
+ ```html
9
+
10
+ <d-navbar toggleable="md" type="dark" theme="primary">
11
+ <d-navbar-toggle target="nav-collapse"></d-navbar-toggle>
12
+ <d-navbar-brand>
13
+ <h6 class="text-white my-auto mr-4">Shards Vue</h6>
14
+ </d-navbar-brand>
15
+
16
+ <d-collapse is-nav id="nav-collapse">
17
+ <d-navbar-nav>
18
+ <d-nav-item href="#">Link</d-nav-item>
19
+ <d-nav-item href="#" disabled>Disabled</d-nav-item>
20
+ <d-dropdown text="Dropdown" is-nav>
21
+ <d-dropdown-item>Action</d-dropdown-item>
22
+ <d-dropdown-item>Another action</d-dropdown-item>
23
+ <d-dropdown-item>Something else here</d-dropdown-item>
24
+ <d-dropdown-divider />
25
+ <d-dropdown-item>Separated link</d-dropdown-item>
26
+ </d-dropdown>
27
+ </d-navbar-nav>
28
+
29
+ <d-navbar-nav class="ml-auto">
30
+ <d-input-group seamless>
31
+ <d-input-group-text slot="prepend">
32
+ <fa :icon="['fas', 'search']" />
33
+ </d-input-group-text>
34
+ <d-input size="sm" placeholder="Search..."/>
35
+ </d-input-group>
36
+ </d-navbar-nav>
37
+
38
+ </d-collapse>
39
+ </d-navbar>
40
+
41
+ <!-- navbar-1.vue -->
42
+ ```
43
+ :::
44
+
45
+ ## Themes and Text Colors
46
+
47
+ The `<d-navbar>` component supports all available color themes as well as text color types such as `dark` or `light`.
48
+
49
+ ## Placement
50
+
51
+ You an control the placement of the navbar component using the `fixed` and `sticky` props.
@@ -0,0 +1,23 @@
1
+ import { registerComponents, vueUse } from '../../utils';
2
+
3
+ import dNavbar from './Navbar.vue'
4
+ import dNavbarBrand from './NavbarBrand.vue'
5
+ import dNavbarNav from './NavbarNav.vue'
6
+ import dNavbarToggle from './NavbarToggle.vue'
7
+
8
+ const components = {
9
+ dNavbar,
10
+ dNavbarBrand,
11
+ dNavbarNav,
12
+ dNavbarToggle
13
+ }
14
+
15
+ const VuePlugin = {
16
+ install (Vue) {
17
+ registerComponents(Vue, components)
18
+ }
19
+ }
20
+
21
+ vueUse(VuePlugin)
22
+
23
+ export default VuePlugin
@@ -0,0 +1,126 @@
1
+ <template>
2
+ <div class="d-none" style="display: none;" aria-hidden="true">
3
+ <div ref="title">
4
+ <slot name="title" />
5
+ </div>
6
+ <div ref="content">
7
+ <slot />
8
+ </div>
9
+ </div>
10
+ </template>
11
+
12
+ <script>
13
+ import Popover from '../../utils/popover.class'
14
+ import TooltipPopoverMixin from '../../mixins/tooltip-popover.mixin'
15
+ import { TP_PLACEMENTS } from '../../utils/constants';
16
+
17
+ export default {
18
+ name: 'd-popover',
19
+ mixins: [ TooltipPopoverMixin ],
20
+ props: {
21
+ /**
22
+ * Title
23
+ */
24
+ title: {
25
+ type: String,
26
+ default: ''
27
+ },
28
+ /**
29
+ * Content
30
+ */
31
+ content: {
32
+ type: String,
33
+ default: ''
34
+ },
35
+ /**
36
+ * Triggers
37
+ */
38
+ triggers: {
39
+ type: [String, Array],
40
+ default: 'click'
41
+ },
42
+ /**
43
+ * Placement.
44
+ */
45
+ placement: {
46
+ type: String,
47
+ default: 'top',
48
+ validator: val => Object.keys(TP_PLACEMENTS).map(p => p.toLowerCase()).includes(val)
49
+ },
50
+ /**
51
+ * The target element.
52
+ */
53
+ target: {
54
+ type: [String, Object, Function]
55
+ },
56
+ /**
57
+ * Delay in miliseconds.
58
+ */
59
+ delay: {
60
+ type: [Number, Object, String],
61
+ default: 0
62
+ },
63
+ /**
64
+ * Offset.
65
+ */
66
+ offset: {
67
+ type: [Number, String]
68
+ },
69
+ /**
70
+ * Disable animations.
71
+ */
72
+ noFade: {
73
+ type: Boolean,
74
+ default: false
75
+ },
76
+ /**
77
+ * Wrapping container.
78
+ */
79
+ container: {
80
+ type: String,
81
+ default: null
82
+ },
83
+ /**
84
+ * Instance boundaries.
85
+ */
86
+ boundary: {
87
+ type: [String, Object],
88
+ default: 'scrollParent'
89
+ },
90
+ /**
91
+ * Show state.
92
+ */
93
+ show: {
94
+ type: Boolean,
95
+ default: false
96
+ },
97
+ /**
98
+ * Disabled state.
99
+ */
100
+ disabled: {
101
+ type: Boolean,
102
+ default: false
103
+ },
104
+ },
105
+ methods: {
106
+ /**
107
+ * Gets the target and if the target exists, it initializes the Popover.
108
+ * Used inside the TooltipPopoverMixin
109
+ */
110
+ bootstrap() {
111
+ const target = this.getTarget()
112
+
113
+ if (target) {
114
+ this._TPInstance = new Popover(
115
+ target,
116
+ this.getUpdatedConfig(),
117
+ this.$root
118
+ )
119
+ }
120
+
121
+ return this._TPInstance
122
+ }
123
+ }
124
+ }
125
+ </script>
126
+
@@ -0,0 +1,73 @@
1
+ # Popovers
2
+
3
+ Popovers are powerful elements similar to tooltips and powered by Popper.js that can be applies to any interactive element.
4
+
5
+ > Note: The `container` prop is not always necessary and it is required in the following examples just for demo purposes.
6
+
7
+ ## Basic Example
8
+
9
+ Popovers can be created using the `<d-popover>` component.
10
+
11
+ :::demo
12
+ ```html
13
+
14
+ <div>
15
+ <d-btn id="popover-example-1">Click Me</d-btn>
16
+ <d-popover target="popover-example-1" container=".shards-demo--example--popover-01">
17
+ <template slot="title">
18
+ Title Here
19
+ </template>
20
+ Content Here
21
+ </d-popover>
22
+ </div>
23
+
24
+ <!-- popover-1.vue -->
25
+ ```
26
+ :::
27
+
28
+ ## Triggers
29
+
30
+ The `<d-popover>` component, by default is triggered by the `click` event. However, this can be easily adjusted using the `triggers` component which accepts one or multiple triggers.
31
+
32
+ :::demo
33
+ ```html
34
+
35
+ <div>
36
+ <d-btn id="popover-example-2">Hover Me</d-btn>
37
+ <d-popover target="popover-example-2"
38
+ container=".shards-demo--example--popover-02"
39
+ :triggers="['hover']">
40
+ <template slot="title">
41
+ Title Here
42
+ </template>
43
+ Content Here
44
+ </d-popover>
45
+ </div>
46
+
47
+ <!-- popover-2.vue -->
48
+ ```
49
+ :::
50
+
51
+
52
+ ## Placement
53
+
54
+ Using the `placement` prop you can adjust where your popover will be displayed. So far, the following positions are available: `top`, `topleft`, `topright`, `right`, `righttop`, `rightbottom`, `bottom`, `bottomleft`, `bottomright`, `left`, `lefttop`, and `leftbottom`.
55
+
56
+ :::demo
57
+ ```html
58
+
59
+ <div>
60
+ <d-btn id="popover-example-3">Click Me</d-btn>
61
+ <d-popover target="popover-example-3"
62
+ :placement="'rightbottom'"
63
+ container=".shards-demo--example--popover-03">
64
+ <template slot="title">
65
+ Title Here
66
+ </template>
67
+ Content Here
68
+ </d-popover>
69
+ </div>
70
+
71
+ <!-- popover-3.vue -->
72
+ ```
73
+ :::
@@ -0,0 +1,17 @@
1
+ import { registerComponents, vueUse } from '../../utils';
2
+
3
+ import dPopover from './Popover.vue';
4
+
5
+ const components = {
6
+ dPopover
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,93 @@
1
+ <template>
2
+ <div :class="['progress', size ? `progress-${size}` : '']" :style="{ height: height || null }">
3
+ <slot>
4
+ <d-progress-bar v-bind="$props"/>
5
+ </slot>
6
+ </div>
7
+ </template>
8
+
9
+ <script>
10
+ export default {
11
+ name: 'd-progress',
12
+ props: {
13
+ /**
14
+ * Theme color.
15
+ */
16
+ theme: {
17
+ type: String,
18
+ default: 'primary'
19
+ },
20
+ /**
21
+ * Whether it should be striped, or not.
22
+ */
23
+ striped: {
24
+ type: Boolean,
25
+ default: false
26
+ },
27
+ /**
28
+ * Whether it should be animated, or not.
29
+ */
30
+ animated: {
31
+ type: Boolean,
32
+ default: false
33
+ },
34
+ /**
35
+ * Height value.
36
+ */
37
+ height: {
38
+ type: String,
39
+ default: null
40
+ },
41
+ /**
42
+ * Precision number of digits.
43
+ */
44
+ precision: {
45
+ type: Number,
46
+ default: 0
47
+ },
48
+ /**
49
+ * Whether to show progress, or not.
50
+ */
51
+ showProgress: {
52
+ type: Boolean,
53
+ default: false
54
+ },
55
+ /**
56
+ * Whether to show the value, or not.
57
+ */
58
+ showValue: {
59
+ type: Boolean,
60
+ default: false
61
+ },
62
+ /**
63
+ * The maximum value.
64
+ */
65
+ max: {
66
+ type: Number,
67
+ default: 100
68
+ },
69
+ /**
70
+ * The value.
71
+ */
72
+ value: {
73
+ type: Number,
74
+ default: 0
75
+ },
76
+ /**
77
+ * The size.
78
+ */
79
+ size: {
80
+ type: String,
81
+ default: null,
82
+ validator: (v) => ['sm', 'lg'].includes(v)
83
+ }
84
+ }
85
+ }
86
+ </script>
87
+
88
+ <style>
89
+ /* Hide labels for small progress bars */
90
+ .progress-sm span {
91
+ color: transparent;
92
+ }
93
+ </style>
@@ -0,0 +1,123 @@
1
+ <template>
2
+ <div :class="[
3
+ 'progress-bar',
4
+ computedTheme ? `bg-${computedTheme}` : '',
5
+ (computedStriped || computedAnimated) ? 'progress-bar-striped' : '',
6
+ computedAnimated ? 'progress-bar-animated' : ''
7
+ ]"
8
+ :style="{ width: (100 * (value / computedMax)) + '%' }"
9
+ role="progressbar"
10
+ :aria-valuemin="0"
11
+ :aria-valuemax="computedMax.toString()"
12
+ :aria-valuenow="value.toFixed(computedPrecision)">
13
+ <slot>
14
+ <span v-if="label" v-html="label"></span>
15
+ <span v-if="computedShowProgress">{{ computedProgress.toFixed(computedPrecision) }}</span>
16
+ <span v-if="computedShowValue">{{ value.toFixed(computedPrecision) }}</span>
17
+ </slot>
18
+ </div>
19
+ </template>
20
+
21
+ <script>
22
+ export default {
23
+ name: 'd-progress-bar',
24
+ props: {
25
+ /**
26
+ * The value.
27
+ */
28
+ value: {
29
+ type: Number,
30
+ default: 0
31
+ },
32
+ /**
33
+ * The label.
34
+ */
35
+ label: {
36
+ type: String,
37
+ value: null
38
+ },
39
+ /**
40
+ * The max value.
41
+ */
42
+ max: {
43
+ type: Number,
44
+ default: null
45
+ },
46
+ /**
47
+ * Precision number of digits.
48
+ */
49
+ precision: {
50
+ type: Number,
51
+ default: null
52
+ },
53
+ /**
54
+ * Theme color.
55
+ */
56
+ theme: {
57
+ type: String,
58
+ default: null
59
+ },
60
+ /**
61
+ * Whether it should be striped, or not.
62
+ */
63
+ striped: {
64
+ type: Boolean,
65
+ default: null
66
+ },
67
+ /**
68
+ * Whether it should be animated, or not.
69
+ */
70
+ animated: {
71
+ type: Boolean,
72
+ default: null
73
+ },
74
+ /**
75
+ * Whether it should show the progress, or not.
76
+ */
77
+ showProgress: {
78
+ type: Boolean,
79
+ default: null
80
+ },
81
+ /**
82
+ * Whether it should show the value, or not.
83
+ */
84
+ showValue: {
85
+ type: Boolean,
86
+ default: null
87
+ }
88
+ },
89
+ computed: {
90
+ computedTheme() {
91
+ return this.theme || this.$parent.theme
92
+ },
93
+ computedStriped() {
94
+ return typeof this.striped === 'boolean' ? this.striped : (this.$parent.striped || false)
95
+ },
96
+ computedAnimated() {
97
+ return typeof this.animated === 'boolean' ? this.animated : (this.$parent.animated || false)
98
+ },
99
+ computedMax() {
100
+ return typeof this.max === 'number' ? this.max : (this.$parent.max || 100)
101
+ },
102
+ computedPrecision() {
103
+ return typeof this.precision === 'number' ? this.precision : (this.$parent.precision || 0)
104
+ },
105
+ computedShowProgress() {
106
+ return typeof this.showProgress === 'boolean' ? this.showProgress : (this.$parent.showProgress || false)
107
+ },
108
+ computedShowValue() {
109
+ return typeof this.showValue === 'boolean' ? this.showValue : (this.$parent.showValue || false)
110
+ },
111
+ computedProgress() {
112
+ const p = Math.pow(10, this.computedPrecision)
113
+ return Math.round((100 * p * this.value) / this.computedMax) / p
114
+ }
115
+ }
116
+ }
117
+ </script>
118
+
119
+ <style scoped>
120
+ .progress-bar {
121
+ height: 100%;
122
+ }
123
+ </style>
@@ -0,0 +1,95 @@
1
+ # Progres Bars
2
+
3
+ You can use the `<d-progress>` component to display simple or complex progress bars.
4
+
5
+ ## Basic Example
6
+
7
+ :::demo
8
+ ```html
9
+
10
+ <d-progress :value="50" :max="100" />
11
+
12
+ <!-- progress-1.vue -->
13
+ ```
14
+ :::
15
+
16
+ ## Labels
17
+
18
+ You can add labels to your progress bars either by using the `show-progress` or `show-value` props.
19
+
20
+ :::demo
21
+ ```html
22
+
23
+ <div>
24
+ <!-- Showing Percentage Progress -->
25
+ <d-progress theme="success" :value="50" :max="250" show-progress />
26
+
27
+ <!-- Showing Value -->
28
+ <d-progress :value="50" :max="250" show-value />
29
+ </div>
30
+
31
+ <!-- progress-2.vue -->
32
+ ```
33
+ :::
34
+
35
+ ## Size
36
+
37
+ The size of the progress bar can be controlled via the `size` prop. Progress bars can be either `sm` for small or `lg` for large. Using a small progress bar would hide the label due to the lack of space.
38
+
39
+ :::demo
40
+ ```html
41
+
42
+ <div>
43
+ <!-- Small Progress Bar -->
44
+ <d-progress size="sm" :value="50" :max="100" />
45
+
46
+ <!-- Large Progress Bar -->
47
+ <d-progress size="lg" :value="75" :max="100" />
48
+ </div>
49
+
50
+ <!-- progress-3.vue -->
51
+ ```
52
+ :::
53
+
54
+ ## Precision
55
+
56
+ Using the `precision` prop you can specify the precision number of digits.
57
+
58
+ :::demo
59
+ ```html
60
+
61
+ <d-progress :value="66.29123" :max="100" :precision="2" show-progress />
62
+
63
+ <!-- progress-4.vue -->
64
+ ```
65
+ :::
66
+
67
+ ## Multiple Progress Bars
68
+
69
+ Inside the `<d-progress>` component you can also stack multiple `<d-progress-bar>` components.
70
+
71
+ :::demo
72
+ ```html
73
+
74
+ <d-progress :max="100" show-value>
75
+ <d-progress-bar :value="50" theme="primary"></d-progress-bar>
76
+ <d-progress-bar :value="30" theme="warning"></d-progress-bar>
77
+ <d-progress-bar :value="10" theme="info"></d-progress-bar>
78
+ </d-progress>
79
+
80
+ <!-- progress-5.vue -->
81
+ ```
82
+
83
+ ## Height
84
+
85
+ Using the `height` prop you can control the progress bar's height.
86
+
87
+ :::demo
88
+ ```html
89
+
90
+ <div>
91
+ <d-progress :max="100" :value="50" height="15px" class="mb-2" />
92
+ <d-progress :max="100" :value="50" height="3px" />
93
+ </div>
94
+ <!-- progress-6.vue -->
95
+ ```
@@ -0,0 +1,19 @@
1
+ import { registerComponents, vueUse } from './../../utils';
2
+
3
+ import dProgress from './Progress.vue';
4
+ import dProgressBar from './ProgressBar.vue'
5
+
6
+ const components = {
7
+ dProgress,
8
+ dProgressBar
9
+ }
10
+
11
+ const VuePlugin = {
12
+ install (Vue) {
13
+ registerComponents(Vue, components)
14
+ }
15
+ }
16
+
17
+ vueUse(VuePlugin)
18
+
19
+ export default VuePlugin