@veritree/ui 0.7.0 → 0.8.0

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/index.js CHANGED
@@ -17,6 +17,8 @@ import VTPopoverDivider from "./src/Popover/VTPopoverDivider.vue";
17
17
  import VTPopoverGroup from "./src/Popover/VTPopoverGroup.vue";
18
18
  import VTPopoverItem from "./src/Popover/VTPopoverItem.vue";
19
19
  import VTPopoverTrigger from "./src/Popover/VTPopoverTrigger.vue";
20
+ import VTFormFeedback from "./src/Form/VTFormFeedback.vue";
21
+ import VTFormGroup from "./src/Form/VTFormGroup.vue";
20
22
 
21
23
  import VTAlert from "./src/Alerts/VTAlert.vue";
22
24
 
@@ -90,6 +92,8 @@ export {
90
92
  VTPopoverGroup,
91
93
  VTPopoverItem,
92
94
  VTPopoverTrigger,
95
+ VTFormFeedback,
96
+ VTFormGroup,
93
97
  VTButton,
94
98
  // VTButtonSave,
95
99
  VTInput,
package/nuxt.js ADDED
@@ -0,0 +1,20 @@
1
+ import { join } from 'path';
2
+
3
+ const components = [
4
+ 'src/Avatar',
5
+ 'src/Drawer',
6
+ 'src/Dialog',
7
+ 'src/DropdownMenu',
8
+ 'src/Form',
9
+ 'src/Image',
10
+ 'src/Tabs',
11
+ ]
12
+
13
+ export default function () {
14
+ this.nuxt.hook('components:dirs', dirs => {
15
+ // Add ./components dir to the list
16
+ components.forEach((component) => {
17
+ dirs.push(join(__dirname, component))
18
+ });
19
+ })
20
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritree/ui",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "veritree ui library",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -0,0 +1,64 @@
1
+ <template>
2
+ <div class="form-feedback" :class="classes">
3
+ <component :is="icon" v-if="showIcon" />
4
+ <span class="text-gray-500"><slot></slot></span>
5
+ </div>
6
+ </template>
7
+
8
+ <script>
9
+ import { IconCheck, IconWarning } from '@veritree/icons';
10
+
11
+ export default {
12
+ name: 'VTFormFeedback',
13
+
14
+ components: {
15
+ IconWarning,
16
+ IconCheck,
17
+ },
18
+
19
+ props: {
20
+ variant: {
21
+ type: [String, Object],
22
+ default: '',
23
+ validator(value) {
24
+ if (value === '' || typeof value === 'object') {
25
+ return true;
26
+ }
27
+
28
+ return ['success', 'warning', 'error'].includes(value);
29
+ },
30
+ },
31
+ hideIcon: {
32
+ type: Boolean,
33
+ default: false,
34
+ },
35
+ },
36
+
37
+ computed: {
38
+ classes() {
39
+ const classes = {};
40
+
41
+ if (this.variant) {
42
+ classes[`form-feedback--${this.variant}`] = true;
43
+ }
44
+
45
+ return classes;
46
+ },
47
+
48
+ icon() {
49
+ if (this.variant === 'success') return IconCheck;
50
+ return IconWarning;
51
+ },
52
+
53
+ showIcon() {
54
+ return !this.hideIcon;
55
+ },
56
+ },
57
+
58
+ methods: {
59
+ onClick() {
60
+ this.$emit('click');
61
+ },
62
+ },
63
+ };
64
+ </script>
@@ -0,0 +1,22 @@
1
+ <template>
2
+ <component :is="as" :class="classes" class="form-group">
3
+ <slot></slot>
4
+ </component>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ props: {
10
+ as: {
11
+ type: String,
12
+ default: 'div',
13
+ },
14
+ },
15
+
16
+ data() {
17
+ return {
18
+ classes: {},
19
+ };
20
+ },
21
+ };
22
+ </script>