@veritree/ui 0.73.0 → 0.74.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.
@@ -39,8 +39,8 @@ export const floatingUiItemMixin = {
39
39
  ? `${this.componentName}--disabled`
40
40
  : null
41
41
  : this.disabled
42
- ? 'pointer-events-none opacity-75'
43
- : null,
42
+ ? 'pointer-events-none opacity-75'
43
+ : null,
44
44
  // selected state styles
45
45
  this.headless
46
46
  ? this.selected
@@ -49,8 +49,8 @@ export const floatingUiItemMixin = {
49
49
  : `${this.componentName}--selected`
50
50
  : null
51
51
  : this.selected
52
- ? 'bg-gray-200'
53
- : null,
52
+ ? 'bg-gray-200'
53
+ : null,
54
54
  ];
55
55
  },
56
56
  },
@@ -53,7 +53,7 @@ export const formControlMixin = {
53
53
  blur: (event) => {
54
54
  this.$emit('blur', event);
55
55
  },
56
- }
56
+ },
57
57
  );
58
58
  },
59
59
 
@@ -78,18 +78,18 @@ export const formControlStyleMixin = {
78
78
  this.headless
79
79
  ? `${this.name}--${this.variant}`
80
80
  : this.isError
81
- ? 'border-error-300'
82
- : this.isSuccess
83
- ? 'border-success-300'
84
- : 'border-gray-300',
81
+ ? 'border-error-300'
82
+ : this.isSuccess
83
+ ? 'border-success-300'
84
+ : 'border-gray-300',
85
85
  // height styles
86
86
  this.headless
87
87
  ? null
88
88
  : this.name === 'textarea'
89
- ? 'min-h-10' // limit it because input type number height can be different from other input types
90
- : this.size === 'small'
91
- ? 'h-8 text-sm'
92
- : 'h-10 text-base',
89
+ ? 'min-h-10' // limit it because input type number height can be different from other input types
90
+ : this.size === 'small'
91
+ ? 'h-8 text-sm'
92
+ : 'h-10 text-base',
93
93
  // disabled styles
94
94
  this.disabled
95
95
  ? this.headless
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritree/ui",
3
- "version": "0.73.0",
3
+ "version": "0.74.0",
4
4
  "description": "veritree ui library",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -12,7 +12,7 @@
12
12
  ? 'button'
13
13
  : isIcon
14
14
  ? 'relative inline-flex items-center justify-center rounded-full [&_svg]:max-h-full [&_svg]:max-w-full'
15
- : 'relative inline-flex rounded border border-solid px-4 text-sm font-semibold leading-none no-underline transition-all',
15
+ : 'relative inline-flex rounded border border-solid px-4 text-sm font-medium leading-none no-underline transition-all',
16
16
  // variant styles
17
17
  headless
18
18
  ? `button--${variant}`
@@ -88,7 +88,7 @@ export default {
88
88
  checked() {
89
89
  if (this.multiple) {
90
90
  return this.apiListbox().valueComputed.some(
91
- (value) => JSON.stringify(this.value) === JSON.stringify(value)
91
+ (value) => JSON.stringify(this.value) === JSON.stringify(value),
92
92
  );
93
93
  }
94
94
 
@@ -164,7 +164,7 @@ export default {
164
164
  * with any of the items to get its index value
165
165
  */
166
166
  const newItemSelectedIndex = this.items.findIndex((item) =>
167
- item.text.toLowerCase().includes(this.search.toLowerCase())
167
+ item.text.toLowerCase().includes(this.search.toLowerCase()),
168
168
  );
169
169
 
170
170
  /**
@@ -11,17 +11,6 @@
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> -->
25
14
  <span :class="[headless ? 'listbox-button__text' : 'truncate text-left']">
26
15
  <slot></slot>
27
16
  </span>
@@ -171,8 +160,8 @@ export default {
171
160
  keyCode === 'ArrowDown'
172
161
  ? 'firstMenuItem'
173
162
  : keyCode === 'ArrowUp'
174
- ? 'lastMenuItem'
175
- : null;
163
+ ? 'lastMenuItem'
164
+ : null;
176
165
 
177
166
  // settimeout here is delaying the focusing the element
178
167
  // since it is not rendered yet. All items will only
@@ -1,14 +1,5 @@
1
1
  <template>
2
- <component
3
- :is="as"
4
- :class="[
5
- // default styles
6
- headless
7
- ? 'popover-item'
8
- : 'relative z-10 -mx-3 flex items-center gap-2 px-3 py-2 text-inherit no-underline hover:bg-secondary-200/10',
9
- ]"
10
- @click="onClick"
11
- >
2
+ <component :is="as" :class="classComputed">
12
3
  <slot></slot>
13
4
  </component>
14
5
  </template>
@@ -32,27 +23,54 @@ export default {
32
23
  type: [String, Object],
33
24
  default: null,
34
25
  },
26
+ as: {
27
+ type: String,
28
+ default: 'div',
29
+ },
35
30
  },
36
31
 
37
32
  computed: {
38
- dark() {
39
- return this.apiPopover().isDark;
33
+ classComputed() {
34
+ return [
35
+ // default styles
36
+ this.headless
37
+ ? `${this.componentName}`
38
+ : 'relative z-10 text-sm flex items-center gap-2 px-3 py-2 text-inherit no-underline cursor-pointer',
39
+ // disabled state styles
40
+ this.headless
41
+ ? this.disabled
42
+ ? `${this.componentName}--disabled`
43
+ : null
44
+ : this.disabled
45
+ ? 'pointer-events-none opacity-75'
46
+ : null,
47
+ // selected state styles
48
+ // this.headless
49
+ // ? this.selected
50
+ // ? this.multiple
51
+ // ? null
52
+ // : `${this.componentName}--selected`
53
+ // : null
54
+ // : this.selected
55
+ // ? 'bg-gray-200'
56
+ // : null,
57
+ ];
40
58
  },
41
59
 
42
- headless() {
43
- return this.apiPopover().isHeadless;
44
- },
60
+ // tag() {
61
+ // if(this.href) {
45
62
 
46
- as() {
47
- return this.href ? 'a' : this.to ? 'NuxtLink' : 'button';
48
- },
63
+ // }
64
+
65
+ // return this.href ? 'a' : this.to ? 'NuxtLink' : 'button';
66
+ // },
49
67
  },
50
68
 
51
69
  methods: {
52
- onClick() {
53
- if (this.href || this.to) return;
54
- this.$emit('click');
55
- },
70
+ // onClick() {
71
+ // if (this.href || this.to) return;
72
+ // this.$emit('click');
73
+ // },
56
74
  },
57
75
  };
58
76
  </script>
@@ -0,0 +1,33 @@
1
+ <template>
2
+ <div
3
+ :id="id"
4
+ :class="[
5
+ headless
6
+ ? 'listbox-viewport'
7
+ : '-mx-3 max-h-[200px] w-auto overflow-y-auto scroll-auto',
8
+ ]"
9
+ >
10
+ <slot></slot>
11
+ </div>
12
+ </template>
13
+
14
+ <script>
15
+ export default {
16
+ name: 'VTListboxViewport',
17
+
18
+ inject: ['apiPopover'],
19
+
20
+ props: {
21
+ headless: {
22
+ type: Boolean,
23
+ default: false,
24
+ },
25
+ },
26
+
27
+ computed: {
28
+ id() {
29
+ return `popover-viewport-${this.apiPopover().id}`;
30
+ },
31
+ },
32
+ };
33
+ </script>