@veritree/ui 0.46.0 → 0.48.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.
@@ -1,6 +1,13 @@
1
1
  import { computePosition, flip, shift, offset, size } from '@floating-ui/dom';
2
2
 
3
3
  export const floatingUiMixin = {
4
+ props: {
5
+ offset: {
6
+ type: [Number, String],
7
+ default: 5,
8
+ },
9
+ },
10
+
4
11
  data() {
5
12
  return {
6
13
  component: null,
@@ -40,7 +47,7 @@ export const floatingUiMixin = {
40
47
  computePosition(trigger, content, {
41
48
  placement: this.placement,
42
49
  middleware: [
43
- offset(5),
50
+ offset(Number(this.offset)),
44
51
  flip(),
45
52
  shift({ padding: 5 }),
46
53
  size({
@@ -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.46.0",
3
+ "version": "0.48.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>
@@ -18,18 +18,30 @@ export default {
18
18
  type: [String, Number],
19
19
  default: 500,
20
20
  },
21
+ /**
22
+ * Determines whether the button will use its default atomic style (tailwind) or its default class
23
+ * @type {boolean}
24
+ * @values
25
+ * - true: The button will have no default style and can be fully customized with a custom class
26
+ * - false: The button will use its default atomic style (tailwind) and can be further customized with additional classes
27
+ * @default null
28
+ */
29
+ headless: {
30
+ type: Boolean,
31
+ default: false,
32
+ },
33
+ /**
34
+ * The placement of the component relative to its trigger element.
35
+ * @type {string}
36
+ * @values 'top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'
37
+ * @default 'bottom-start'
38
+ */
21
39
  placement: {
22
40
  type: String,
23
41
  default: 'bottom',
24
42
  },
25
43
  },
26
44
 
27
- data() {
28
- return {
29
- floatingUiMinWidth: 0,
30
- };
31
- },
32
-
33
45
  provide() {
34
46
  return {
35
47
  apiTooltip: () => {
@@ -59,6 +71,7 @@ export default {
59
71
  data() {
60
72
  return {
61
73
  componentId: genId(),
74
+ floatingUiMinWidth: 0,
62
75
  };
63
76
  },
64
77
  };