@veritree/ui 0.20.0 → 0.21.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritree/ui",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "description": "veritree ui library",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -12,7 +12,7 @@
12
12
  v-show="visible"
13
13
  :class="{
14
14
  'Drawer-content': headless,
15
- 'absolute z-20 flex h-screen max-h-full max-w-full flex-col overflow-auto p-5 outline-0 sm:px-10 sm:py-6':
15
+ 'fixed z-20 flex h-screen max-h-full max-w-full flex-col overflow-auto p-5 outline-0 sm:px-10 sm:py-6':
16
16
  !headless,
17
17
  'bg-white text-gray-600': !dark,
18
18
  'bg-fd-600': dark,
@@ -1,7 +1,27 @@
1
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>
2
+ <div
3
+ :class="[
4
+ headless ? 'form-feedback' : 'flex gap-2 mt-1 items-baseline',
5
+ // variant styles
6
+ headless ? `form-feedback--{$variant}` : null,
7
+ ]"
8
+ >
9
+ <component
10
+ v-if="showIcon"
11
+ :is="icon"
12
+ :class="[
13
+ headless ? 'form-feedback__icon' : 'relative top-1 shrink-0 h-4 w-4',
14
+ // variant styles
15
+ headless
16
+ ? `form-feedback__icon--{$variant}`
17
+ : isError
18
+ ? 'text-error-500'
19
+ : null,
20
+ ]"
21
+ />
22
+ <span :class="[headless ? 'form-feedback--text' : 'text-gray-500 text-sm']">
23
+ <slot />
24
+ </span>
5
25
  </div>
6
26
  </template>
7
27
 
@@ -17,32 +37,23 @@ export default {
17
37
  },
18
38
 
19
39
  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
40
  hideIcon: {
32
41
  type: Boolean,
33
42
  default: false,
34
43
  },
44
+ headless: {
45
+ type: Boolean,
46
+ default: false,
47
+ },
48
+ variant: {
49
+ type: [String, Object],
50
+ default: '',
51
+ },
35
52
  },
36
53
 
37
54
  computed: {
38
- classes() {
39
- const classes = {};
40
-
41
- if (this.variant) {
42
- classes[`form-feedback--${this.variant}`] = true;
43
- }
44
-
45
- return classes;
55
+ isError() {
56
+ return this.variant === 'error';
46
57
  },
47
58
 
48
59
  icon() {
@@ -0,0 +1,52 @@
1
+ <template>
2
+ <input
3
+ v-bind="$attrs"
4
+ :class="[
5
+ headless
6
+ ? 'form-control'
7
+ : 'border border-solid py-2 px-3 rounded text-inherit',
8
+ headless
9
+ ? `form-control--${variant}`
10
+ : isError
11
+ ? 'border-error-300'
12
+ : 'border-gray-300',
13
+ ]"
14
+ :value="value"
15
+ @input="$emit('input', $event.target.value)"
16
+ @blur="$emit('blur')"
17
+ />
18
+ </template>
19
+
20
+ <script>
21
+ export default {
22
+ model: {
23
+ prop: 'value',
24
+ event: 'input',
25
+ },
26
+
27
+ props: {
28
+ disabled: {
29
+ type: Boolean,
30
+ default: false,
31
+ },
32
+ value: {
33
+ type: [String, Number, Object, Array],
34
+ default: null,
35
+ },
36
+ variant: {
37
+ type: [String, Object, Function],
38
+ default: '',
39
+ },
40
+ headless: {
41
+ type: Boolean,
42
+ default: false,
43
+ },
44
+ },
45
+
46
+ computed: {
47
+ isError() {
48
+ return this.variant === 'error';
49
+ },
50
+ },
51
+ };
52
+ </script>
package/package-lock.json DELETED
@@ -1,13 +0,0 @@
1
- {
2
- "name": "@veritree/ui",
3
- "version": "0.1.9",
4
- "lockfileVersion": 1,
5
- "requires": true,
6
- "dependencies": {
7
- "@veritree/icons": {
8
- "version": "0.12.0",
9
- "resolved": "https://registry.npmjs.org/@veritree/icons/-/icons-0.12.0.tgz",
10
- "integrity": "sha512-vunUKzvS9neslSf3R3y6RYQrcfRpxmp8PnhWWe2peYiyElLIJcb7zAsfCZ+I0Fg5PQ6GZG6StqWy0WF7MJ7VOg=="
11
- }
12
- }
13
- }