@veritree/ui 0.53.0 → 0.55.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.
@@ -61,7 +61,7 @@ export const formControlStyleMixin = {
61
61
  return [
62
62
  this.headless
63
63
  ? `${this.name}`
64
- : 'leading-0 flex w-full max-w-full appearance-none placeholder:font-light placeholder:text-gray-500 items-center justify-between rounded border border-solid px-3 py-2 font-inherit text-base text-inherit file:hidden focus:border-secondary-200 focus:placeholder:text-gray-400',
64
+ : 'leading-0 flex w-full max-w-full relative appearance-none placeholder:font-light placeholder:text-gray-500 items-center justify-between rounded border border-solid px-3 py-2 font-inherit text-base text-inherit file:hidden focus:border-gray-600 focus:placeholder:text-gray-400',
65
65
  // variant styles
66
66
  this.headless
67
67
  ? `${this.name}--${this.variant}`
@@ -69,6 +69,8 @@ export const formControlStyleMixin = {
69
69
  ? 'border-error-300'
70
70
  : this.isSuccess
71
71
  ? 'border-success-300'
72
+ : this?.isOutline
73
+ ? 'border-gray-700'
72
74
  : 'border-gray-300',
73
75
  // height styles
74
76
  this.headless
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritree/ui",
3
- "version": "0.53.0",
3
+ "version": "0.55.0",
4
4
  "description": "veritree ui library",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -42,14 +42,11 @@ export default {
42
42
  this.overlay = overlay;
43
43
  };
44
44
 
45
- const hide = () => this.hide();
46
-
47
- const emit = () => this.emit();
48
-
49
45
  return {
50
46
  componentId,
51
- hide,
52
- emit,
47
+ hide: this.hide,
48
+ emitHidden: this.emitHidden,
49
+ emitShown: this.emitShown,
53
50
  registerContent,
54
51
  registerOverlay,
55
52
  full: this.full,
@@ -125,13 +122,19 @@ export default {
125
122
  if (this.hasContent) this.content.hide();
126
123
  },
127
124
 
128
- emit() {
125
+ emitHidden() {
129
126
  this.$nextTick(() => {
130
127
  this.$emit('input', false);
131
128
  this.$emit('hidden');
132
129
  });
133
130
  },
134
131
 
132
+ emitShown() {
133
+ this.$nextTick(() => {
134
+ this.$emit('shown');
135
+ });
136
+ },
137
+
135
138
  /**
136
139
  * Hides the dialog when clicking outside its content.
137
140
  *
@@ -6,6 +6,7 @@
6
6
  leave-active-class="duration-300 ease-out"
7
7
  leave-class="translate-y-0 opacity-100"
8
8
  leave-to-class="translate-y-[50px] opacity-0"
9
+ @after-enter="showDialog"
9
10
  @after-leave="hideDialog"
10
11
  >
11
12
  <div
@@ -83,7 +84,11 @@ export default {
83
84
  },
84
85
 
85
86
  hideDialog() {
86
- this.apiDialog().emit();
87
+ this.apiDialog().emitHidden();
88
+ },
89
+
90
+ showDialog() {
91
+ this.apiDialog().emitShown();
87
92
  },
88
93
  },
89
94
  };
@@ -11,6 +11,17 @@
11
11
  @keydown.up.prevent="onKeyDownOrUp"
12
12
  @keydown.esc.stop="onKeyEsc"
13
13
  >
14
+ <template v-if="hasBadge">
15
+ <span
16
+ :class="[
17
+ headless
18
+ ? 'listbox-button__badge'
19
+ : 'absolute -right-2 -top-2 grid h-5 min-w-[20px] place-content-center rounded-full bg-gray-800 text-xs font-medium text-white',
20
+ ]"
21
+ >
22
+ {{ valueLength }}
23
+ </span>
24
+ </template>
14
25
  <span :class="[headless ? 'listbox-button__text' : 'truncate text-left']">
15
26
  <slot></slot>
16
27
  </span>
@@ -59,6 +70,10 @@ export default {
59
70
  return this.apiListbox().componentContent;
60
71
  },
61
72
 
73
+ multiple() {
74
+ return this.apiListbox().multiple;
75
+ },
76
+
62
77
  items() {
63
78
  return this.apiListbox().items;
64
79
  },
@@ -70,6 +85,22 @@ export default {
70
85
  lastMenuItem() {
71
86
  return this.items[this.items.length - 1];
72
87
  },
88
+
89
+ valueLength() {
90
+ if (this.multiple) {
91
+ return this.apiListbox().valueComputed.length;
92
+ }
93
+
94
+ return 0;
95
+ },
96
+
97
+ hasBadge() {
98
+ return this.valueLength > 0;
99
+ },
100
+
101
+ isOutline() {
102
+ return this.valueLength > 0;
103
+ },
73
104
  },
74
105
 
75
106
  mounted() {