@veritree/ui 0.12.2 → 0.13.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/.prettierignore +96 -0
- package/.prettierrc +4 -0
- package/index.js +2 -8
- package/nuxt.js +3 -0
- package/package.json +1 -1
- package/src/components/Alert/VTAlert.vue +83 -0
- package/src/components/Button/VTButton.vue +84 -44
- package/src/components/Alerts/VTAlert.vue +0 -72
- package/src/components/Button/VTButtonSave.vue +0 -27
package/.prettierignore
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
###
|
|
2
|
+
# Place your Prettier ignore content here
|
|
3
|
+
|
|
4
|
+
###
|
|
5
|
+
# .gitignore content is duplicated here due to https://github.com/prettier/prettier/issues/8506
|
|
6
|
+
|
|
7
|
+
# Created by .ignore support plugin (hsz.mobi)
|
|
8
|
+
### Node template
|
|
9
|
+
# Logs
|
|
10
|
+
/logs
|
|
11
|
+
*.log
|
|
12
|
+
npm-debug.log*
|
|
13
|
+
yarn-debug.log*
|
|
14
|
+
yarn-error.log*
|
|
15
|
+
|
|
16
|
+
# Runtime data
|
|
17
|
+
pids
|
|
18
|
+
*.pid
|
|
19
|
+
*.seed
|
|
20
|
+
*.pid.lock
|
|
21
|
+
|
|
22
|
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
23
|
+
lib-cov
|
|
24
|
+
|
|
25
|
+
# Coverage directory used by tools like istanbul
|
|
26
|
+
coverage
|
|
27
|
+
|
|
28
|
+
# nyc test coverage
|
|
29
|
+
.nyc_output
|
|
30
|
+
|
|
31
|
+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
|
32
|
+
.grunt
|
|
33
|
+
|
|
34
|
+
# Bower dependency directory (https://bower.io/)
|
|
35
|
+
bower_components
|
|
36
|
+
|
|
37
|
+
# node-waf configuration
|
|
38
|
+
.lock-wscript
|
|
39
|
+
|
|
40
|
+
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
41
|
+
build/Release
|
|
42
|
+
|
|
43
|
+
# Dependency directories
|
|
44
|
+
node_modules/
|
|
45
|
+
jspm_packages/
|
|
46
|
+
|
|
47
|
+
# TypeScript v1 declaration files
|
|
48
|
+
typings/
|
|
49
|
+
|
|
50
|
+
# Optional npm cache directory
|
|
51
|
+
.npm
|
|
52
|
+
|
|
53
|
+
# Optional eslint cache
|
|
54
|
+
.eslintcache
|
|
55
|
+
|
|
56
|
+
# Optional REPL history
|
|
57
|
+
.node_repl_history
|
|
58
|
+
|
|
59
|
+
# Output of 'npm pack'
|
|
60
|
+
*.tgz
|
|
61
|
+
|
|
62
|
+
# Yarn Integrity file
|
|
63
|
+
.yarn-integrity
|
|
64
|
+
|
|
65
|
+
# dotenv environment variables file
|
|
66
|
+
.env
|
|
67
|
+
|
|
68
|
+
# parcel-bundler cache (https://parceljs.org/)
|
|
69
|
+
.cache
|
|
70
|
+
|
|
71
|
+
# next.js build output
|
|
72
|
+
.next
|
|
73
|
+
|
|
74
|
+
# nuxt.js build output
|
|
75
|
+
.nuxt
|
|
76
|
+
|
|
77
|
+
# Nuxt generate
|
|
78
|
+
dist
|
|
79
|
+
|
|
80
|
+
# vuepress build output
|
|
81
|
+
.vuepress/dist
|
|
82
|
+
|
|
83
|
+
# Serverless directories
|
|
84
|
+
.serverless
|
|
85
|
+
|
|
86
|
+
# IDE / Editor
|
|
87
|
+
.idea
|
|
88
|
+
|
|
89
|
+
# Service worker
|
|
90
|
+
sw.*
|
|
91
|
+
|
|
92
|
+
# macOS
|
|
93
|
+
.DS_Store
|
|
94
|
+
|
|
95
|
+
# Vim swap files
|
|
96
|
+
*.swp
|
package/.prettierrc
ADDED
package/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import VTAlert from "./src/components/Alert/VTAlert.vue";
|
|
1
2
|
import VTAvatar from "./src/components/Avatar/VTAvatar.vue";
|
|
2
3
|
import VTAvatarImage from "./src/components/Avatar/VTAvatarImage.vue";
|
|
3
4
|
import VTAvatarText from "./src/components/Avatar/VTAvatarText.vue";
|
|
5
|
+
import VTButton from "./src/components/Button/VTButton.vue";
|
|
4
6
|
import VTImage from "./src/components/Image/VTImage.vue";
|
|
5
7
|
import VTImageCounter from "./src/components/Image/VTImageCounter.vue";
|
|
6
8
|
import VTImageHover from "./src/components/Image/VTImageHover.vue";
|
|
@@ -26,14 +28,7 @@ import VTListboxLabel from "./src/components/Listbox/VTListboxLabel.vue";
|
|
|
26
28
|
import VTListboxList from "./src/components/Listbox/VTListboxList.vue";
|
|
27
29
|
import VTListboxSearch from "./src/components/Listbox/VTListboxSearch.vue";
|
|
28
30
|
import VTListboxTrigger from "./src/components/Listbox/VTListboxTrigger.vue";
|
|
29
|
-
|
|
30
|
-
import VTAlert from "./src/components/Alerts/VTAlert.vue";
|
|
31
|
-
|
|
32
31
|
import VTSpinner from "./src/components/Spinner/VTSpinner.vue";
|
|
33
|
-
|
|
34
|
-
import VTButton from "./src/components/Button/VTButton.vue";
|
|
35
|
-
// import VTButtonSave from './src/components/Button/VTButtonSave.vue';
|
|
36
|
-
|
|
37
32
|
import VTInput from "./src/components/Input/VTInput.vue";
|
|
38
33
|
import VTInputDate from "./src/components/Input/VTInputDate.vue";
|
|
39
34
|
import VTInputFile from "./src/components/Input/VTInputFile.vue";
|
|
@@ -104,7 +99,6 @@ export {
|
|
|
104
99
|
VTListboxSearch,
|
|
105
100
|
VTListboxTrigger,
|
|
106
101
|
VTButton,
|
|
107
|
-
// VTButtonSave,
|
|
108
102
|
VTInput,
|
|
109
103
|
VTInputDate,
|
|
110
104
|
VTInputFile,
|
package/nuxt.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { join } from 'path';
|
|
2
2
|
|
|
3
3
|
const components = [
|
|
4
|
+
'src/components/Alert',
|
|
4
5
|
'src/components/Avatar',
|
|
6
|
+
'src/components/Button',
|
|
5
7
|
'src/components/Drawer',
|
|
6
8
|
'src/components/Dialog',
|
|
7
9
|
'src/components/DropdownMenu',
|
|
8
10
|
'src/components/Form',
|
|
9
11
|
'src/components/Listbox',
|
|
10
12
|
'src/components/Image',
|
|
13
|
+
'src/components/Popover',
|
|
11
14
|
'src/components/Tabs',
|
|
12
15
|
]
|
|
13
16
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
v-if="show"
|
|
4
|
+
:class="[
|
|
5
|
+
// default styles
|
|
6
|
+
headless
|
|
7
|
+
? 'alert'
|
|
8
|
+
: 'flex items-start gap-3 rounded border border-solid p-3',
|
|
9
|
+
// variant styles
|
|
10
|
+
headless
|
|
11
|
+
? `alert--${variant}`
|
|
12
|
+
: isSuccess
|
|
13
|
+
? 'border-success-300 bg-success-200 text-success-700'
|
|
14
|
+
: isError
|
|
15
|
+
? 'border-error-300 bg-error-200 text-error-700'
|
|
16
|
+
: isWarning
|
|
17
|
+
? 'border-warning-300 bg-warning-200 text-warning-700'
|
|
18
|
+
: null,
|
|
19
|
+
]"
|
|
20
|
+
role="alert"
|
|
21
|
+
>
|
|
22
|
+
<slot></slot>
|
|
23
|
+
<button
|
|
24
|
+
v-if="dismissable"
|
|
25
|
+
:class="[
|
|
26
|
+
!headless
|
|
27
|
+
? 'ml-auto mt-1 h-4 w-4 shrink-0 text-current'
|
|
28
|
+
: 'alert-close',
|
|
29
|
+
]"
|
|
30
|
+
@click="hide"
|
|
31
|
+
>
|
|
32
|
+
<IconClose />
|
|
33
|
+
</button>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script>
|
|
38
|
+
export default {
|
|
39
|
+
name: 'VTAlert',
|
|
40
|
+
|
|
41
|
+
props: {
|
|
42
|
+
variant: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: 'success',
|
|
45
|
+
},
|
|
46
|
+
headless: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false,
|
|
49
|
+
},
|
|
50
|
+
dismissable: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: false,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
data() {
|
|
57
|
+
return {
|
|
58
|
+
show: true,
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
computed: {
|
|
63
|
+
isSuccess() {
|
|
64
|
+
return this.variant === 'success';
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
isError() {
|
|
68
|
+
return this.variant === 'error';
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
isWarning() {
|
|
72
|
+
return this.variant === 'warning';
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
methods: {
|
|
77
|
+
hide() {
|
|
78
|
+
this.$emit('dismiss');
|
|
79
|
+
this.show = false;
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
</script>
|
|
@@ -1,85 +1,125 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<component
|
|
3
3
|
:is="tag"
|
|
4
|
-
:class="classes"
|
|
5
|
-
:data-theme="theme"
|
|
6
4
|
:to="to"
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
:type="type"
|
|
6
|
+
:disabled="isDisabled"
|
|
7
|
+
:class="[
|
|
8
|
+
// default styles
|
|
9
|
+
headless
|
|
10
|
+
? 'button'
|
|
11
|
+
: isIcon
|
|
12
|
+
? 'inline-flex items-center justify-center rounded-full [&_svg]:max-h-full [&_svg]:max-w-full'
|
|
13
|
+
: 'relative inline-flex rounded border border-solid px-4 text-sm font-semibold leading-none no-underline transition-all',
|
|
14
|
+
// variant styles
|
|
15
|
+
headless
|
|
16
|
+
? `button--${variant}`
|
|
17
|
+
: isPrimary
|
|
18
|
+
? 'border-transparent bg-secondary-400 text-white hover:bg-secondary-500 active:bg-secondary-600 disabled:bg-gray-200 disabled:text-gray-400'
|
|
19
|
+
: isSecondary
|
|
20
|
+
? 'border-gray-400 bg-white text-gray-700 hover:bg-gray-100 active:bg-gray-200 disabled:border-gray-300 disabled:text-gray-400'
|
|
21
|
+
: isTertiary
|
|
22
|
+
? 'border-transparent text-secondary-400 hover:text-secondary-500 active:text-secondary-500 disabled:text-gray-400'
|
|
23
|
+
: isIcon
|
|
24
|
+
? 'text-primary-100 focus-within:bg-gray-200 hover:bg-gray-200 active:bg-gray-300'
|
|
25
|
+
: null,
|
|
26
|
+
// sizes styles
|
|
27
|
+
headless
|
|
28
|
+
? `button--${size}`
|
|
29
|
+
: isLarge
|
|
30
|
+
? isIcon
|
|
31
|
+
? 'h-8 w-8'
|
|
32
|
+
: 'h-10'
|
|
33
|
+
: isSmall
|
|
34
|
+
? isIcon
|
|
35
|
+
? 'h-6 w-6 p-1'
|
|
36
|
+
: 'h-8'
|
|
37
|
+
: null,
|
|
38
|
+
]"
|
|
9
39
|
v-on="$listeners"
|
|
10
40
|
>
|
|
11
|
-
<
|
|
41
|
+
<VTSpinner v-if="busy" class="absolute inset-0 m-auto" />
|
|
42
|
+
<span
|
|
43
|
+
:class="[
|
|
44
|
+
headless ? null : 'inline-flex items-center gap-2 self-center mx-auto',
|
|
45
|
+
headless && busy ? 'button--busy' : busy ? 'invisible' : null,
|
|
46
|
+
]"
|
|
47
|
+
>
|
|
48
|
+
<slot></slot>
|
|
49
|
+
</span>
|
|
12
50
|
</component>
|
|
13
51
|
</template>
|
|
14
52
|
|
|
15
53
|
<script>
|
|
54
|
+
import VTSpinner from '../Spinner/VTSpinner.vue';
|
|
55
|
+
|
|
16
56
|
export default {
|
|
17
57
|
name: 'VTButton',
|
|
18
58
|
|
|
59
|
+
components: { VTSpinner },
|
|
60
|
+
|
|
19
61
|
props: {
|
|
20
62
|
variant: {
|
|
21
63
|
type: String,
|
|
22
64
|
default: 'primary',
|
|
23
|
-
validator(value) {
|
|
24
|
-
return [
|
|
25
|
-
'primary',
|
|
26
|
-
'secondary',
|
|
27
|
-
'tertiary',
|
|
28
|
-
'danger',
|
|
29
|
-
'custom',
|
|
30
|
-
'icon',
|
|
31
|
-
].includes(value);
|
|
32
|
-
},
|
|
33
65
|
},
|
|
34
66
|
size: {
|
|
35
67
|
type: String,
|
|
36
68
|
default: 'large',
|
|
37
|
-
validator(value) {
|
|
38
|
-
return ['large', 'small'].includes(value);
|
|
39
|
-
},
|
|
40
69
|
},
|
|
41
|
-
|
|
70
|
+
to: {
|
|
71
|
+
type: [String, Object],
|
|
72
|
+
default: null,
|
|
73
|
+
},
|
|
74
|
+
headless: {
|
|
42
75
|
type: Boolean,
|
|
43
76
|
default: false,
|
|
44
77
|
},
|
|
45
|
-
|
|
46
|
-
type:
|
|
47
|
-
default:
|
|
48
|
-
validator(value) {
|
|
49
|
-
return ['dark'].includes(value);
|
|
50
|
-
},
|
|
78
|
+
busy: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: false,
|
|
51
81
|
},
|
|
52
|
-
|
|
53
|
-
type:
|
|
54
|
-
default:
|
|
82
|
+
disabled: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: false,
|
|
55
85
|
},
|
|
56
86
|
},
|
|
57
87
|
|
|
58
88
|
computed: {
|
|
59
|
-
|
|
60
|
-
|
|
89
|
+
isPrimary() {
|
|
90
|
+
return this.variant === 'primary';
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
isSecondary() {
|
|
94
|
+
return this.variant === 'secondary';
|
|
95
|
+
},
|
|
61
96
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
97
|
+
isTertiary() {
|
|
98
|
+
return this.variant === 'tertiary';
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
isIcon() {
|
|
102
|
+
return this.variant === 'icon';
|
|
103
|
+
},
|
|
65
104
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
105
|
+
isLarge() {
|
|
106
|
+
return this.size === 'large';
|
|
107
|
+
},
|
|
69
108
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
109
|
+
isSmall() {
|
|
110
|
+
return this.size === 'small';
|
|
111
|
+
},
|
|
73
112
|
|
|
74
|
-
|
|
113
|
+
isDisabled() {
|
|
114
|
+
return this.disabled || this.busy;
|
|
75
115
|
},
|
|
76
116
|
|
|
77
117
|
tag() {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
118
|
+
return this.to ? 'NuxtLink' : 'button';
|
|
119
|
+
},
|
|
81
120
|
|
|
82
|
-
|
|
121
|
+
type() {
|
|
122
|
+
return this.to ? null : 'button';
|
|
83
123
|
},
|
|
84
124
|
},
|
|
85
125
|
};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div v-if="isVisible" class="Alert" :class="classes" role="alert">
|
|
3
|
-
<slot></slot>
|
|
4
|
-
<button v-if="dismissable" class="Alert-close" @click="dismiss">
|
|
5
|
-
<IconClose />
|
|
6
|
-
</button>
|
|
7
|
-
</div>
|
|
8
|
-
</template>
|
|
9
|
-
|
|
10
|
-
<script>
|
|
11
|
-
import { IconClose } from '@veritree/icons';
|
|
12
|
-
|
|
13
|
-
export default {
|
|
14
|
-
name: 'VTAlert',
|
|
15
|
-
|
|
16
|
-
components: { IconClose },
|
|
17
|
-
|
|
18
|
-
model: {
|
|
19
|
-
prop: 'value',
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
props: {
|
|
23
|
-
dismissable: {
|
|
24
|
-
type: Boolean,
|
|
25
|
-
default: false,
|
|
26
|
-
},
|
|
27
|
-
variant: {
|
|
28
|
-
type: String,
|
|
29
|
-
default: '',
|
|
30
|
-
validate(value) {
|
|
31
|
-
if (value === '') return true;
|
|
32
|
-
return ['success', 'warning', 'error'].includes(value);
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
value: {
|
|
36
|
-
type: Boolean,
|
|
37
|
-
default: false,
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
data() {
|
|
42
|
-
return {
|
|
43
|
-
destroy: false,
|
|
44
|
-
};
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
computed: {
|
|
48
|
-
classes() {
|
|
49
|
-
return {
|
|
50
|
-
[`Alert--${this.variant}`]: this.variant,
|
|
51
|
-
};
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
isVisible() {
|
|
55
|
-
return this.value && !this.destroy;
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
watch: {
|
|
60
|
-
isVisible(newVal) {
|
|
61
|
-
if (newVal === false) this.destroy = false;
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
methods: {
|
|
66
|
-
dismiss() {
|
|
67
|
-
this.destroy = true;
|
|
68
|
-
this.$emit('input', false);
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
</script>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<VTButton
|
|
3
|
-
class="relative"
|
|
4
|
-
:disabled="saving"
|
|
5
|
-
v-bind="$attrs"
|
|
6
|
-
v-on="$listeners"
|
|
7
|
-
>
|
|
8
|
-
<VTSpinner v-if="saving" class="absolute m-auto" />
|
|
9
|
-
<span :class="{ invisible: saving }"><slot></slot></span>
|
|
10
|
-
</VTButton>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script>
|
|
14
|
-
import VTButton from '../Button/VTButton.vue';
|
|
15
|
-
import VTSpinner from '../Spinner/VTSpinner.vue';
|
|
16
|
-
|
|
17
|
-
export default {
|
|
18
|
-
components: { VTButton, VTSpinner },
|
|
19
|
-
|
|
20
|
-
props: {
|
|
21
|
-
saving: {
|
|
22
|
-
type: Boolean,
|
|
23
|
-
default: false,
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
</script>
|