@veritree/ui 0.45.0 → 0.47.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
@@ -31,11 +31,14 @@ import VTInputIcon from './src/components/Form/VTInputIcon.vue';
31
31
  import VTInputPassword from './src/components/Form/VTInputPassword.vue';
32
32
  import VTListbox from './src/components/Listbox/VTListbox.vue';
33
33
  import VTListboxContent from './src/components/Listbox/VTListboxContent.vue';
34
+ import VTListboxDivider from './src/components/Listbox/VTListboxDivider.vue';
35
+ import VTListboxGroup from './src/components/Listbox/VTListboxGroup.vue';
34
36
  import VTListboxItem from './src/components/Listbox/VTListboxItem.vue';
35
37
  import VTListboxLabel from './src/components/Listbox/VTListboxLabel.vue';
36
38
  import VTListboxList from './src/components/Listbox/VTListboxList.vue';
37
39
  import VTListboxSearch from './src/components/Listbox/VTListboxSearch.vue';
38
40
  import VTListboxTrigger from './src/components/Listbox/VTListboxTrigger.vue';
41
+ import VTListboxViewport from './src/components/Listbox/VTListboxViewport.vue';
39
42
  import VTListboxPlaceholder from './src/components/Listbox/VTListboxPlaceholder.vue';
40
43
  import VTSpinner from './src/components/Spinner/VTSpinner.vue';
41
44
  import VTInputDate from './src/components/Input/VTInputDate.vue';
@@ -104,12 +107,15 @@ export {
104
107
  VTLegend,
105
108
  VTListbox,
106
109
  VTListboxContent,
110
+ VTListboxDivider,
111
+ VTListboxGroup,
107
112
  VTListboxItem,
108
113
  VTListboxLabel,
109
114
  VTListboxList,
110
115
  VTListboxSearch,
111
116
  VTListboxTrigger,
112
117
  VTListboxPlaceholder,
118
+ VTListboxViewport,
113
119
  VTButton,
114
120
  VTInput,
115
121
  VTInputIcon,
@@ -70,6 +70,12 @@ export const formControlStyleMixin = {
70
70
  : this.name === 'textarea'
71
71
  ? 'min-h-10' // limit it because input type number height can be different from other input types
72
72
  : 'h-10',
73
+ // disabled styles
74
+ this.disabled
75
+ ? this.headless
76
+ ? `${this.name}--disabled`
77
+ : 'bg-gray-100'
78
+ : null,
73
79
  ];
74
80
  },
75
81
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritree/ui",
3
- "version": "0.45.0",
3
+ "version": "0.47.0",
4
4
  "description": "veritree ui library",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -0,0 +1,47 @@
1
+ <template>
2
+ <div class="relative">
3
+ <input
4
+ type="date"
5
+ :class="classComputed"
6
+ :value="date"
7
+ :disabled="disabled"
8
+ v-bind="$attrs"
9
+ v-on="listeners"
10
+ />
11
+ <span
12
+ class="absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none"
13
+ :class="[disabled ? 'bg-gray-100' : 'bg-white']"
14
+ ><IconCalendar class="-z-0 scale-90 text-gray-500"
15
+ /></span>
16
+ </div>
17
+ </template>
18
+
19
+ <script>
20
+ import {
21
+ formControlMixin,
22
+ formControlStyleMixin,
23
+ } from '../../../mixins/form-control';
24
+
25
+ export default {
26
+ name: 'VTInputDate',
27
+
28
+ mixins: [formControlMixin, formControlStyleMixin],
29
+
30
+ computed: {
31
+ date: {
32
+ get() {
33
+ return this.value ? this.$date.format(this.value, 'YYYY-MM-DD') : null;
34
+ },
35
+ set(newDate) {
36
+ this.$emit('input', newDate);
37
+ },
38
+ },
39
+ },
40
+ };
41
+ </script>
42
+
43
+ <style scoped lang="postcss">
44
+ input[type='date']::-webkit-calendar-picker-indicator {
45
+ @apply absolute right-0 z-10 h-10 w-10 cursor-pointer opacity-0;
46
+ }
47
+ </style>
@@ -0,0 +1,21 @@
1
+ <template>
2
+ <div
3
+ :class="{
4
+ 'listbox-divider': headless,
5
+ 'mx-3 my-0.5 h-[1px] bg-gray-200': !headless,
6
+ }"
7
+ ></div>
8
+ </template>
9
+
10
+ <script>
11
+ export default {
12
+ name: 'VTListboxDivider',
13
+
14
+ props: {
15
+ headless: {
16
+ type: Boolean,
17
+ default: false,
18
+ },
19
+ },
20
+ };
21
+ </script>
@@ -0,0 +1,9 @@
1
+ <template>
2
+ <div role="group"><slot></slot></div>
3
+ </template>
4
+
5
+ <script>
6
+ export default {
7
+ name: 'VTListboxGroup',
8
+ };
9
+ </script>
@@ -2,7 +2,9 @@
2
2
  <component
3
3
  :is="as"
4
4
  :class="[
5
- headless ? 'listbox-label' : 'mb-2 block text-xs font-normal uppercase',
5
+ headless
6
+ ? 'listbox-label'
7
+ : 'mb-0.5 block px-3 text-xs font-normal uppercase text-gray-600',
6
8
  ]"
7
9
  >
8
10
  <slot></slot>
@@ -1,12 +1,5 @@
1
1
  <template>
2
- <ul
3
- :id="id"
4
- :class="[
5
- headless
6
- ? 'listbox-list'
7
- : '-mx-3 max-h-[160px] w-auto overflow-y-auto scroll-auto',
8
- ]"
9
- >
2
+ <ul :id="id" :class="[headless ? 'listbox-list' : null]">
10
3
  <slot></slot>
11
4
  </ul>
12
5
  </template>
@@ -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: ['apiListbox'],
19
+
20
+ props: {
21
+ headless: {
22
+ type: Boolean,
23
+ default: false,
24
+ },
25
+ },
26
+
27
+ computed: {
28
+ id() {
29
+ return `listbox-viewport-${this.apiListbox().id}`;
30
+ },
31
+ },
32
+ };
33
+ </script>