@tak-ps/vue-tabler 3.75.0 → 3.77.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/CHANGELOG.md CHANGED
@@ -10,6 +10,14 @@
10
10
 
11
11
  ## Version History
12
12
 
13
+ ### v3.77.0
14
+
15
+ - :tada: Allow changing the position of TablerDropdown
16
+
17
+ ### v3.76.0
18
+
19
+ - :tada: Add focus event on Input component
20
+
13
21
  ### v3.75.0
14
22
 
15
23
  - :tada: Teleport `TablerModal` to body by default
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class='dropdown'>
2
+ <div :class='dropdownClasses'>
3
3
  <div
4
4
  :id='id'
5
5
  data-bs-toggle='dropdown'
@@ -16,7 +16,7 @@
16
16
  </slot>
17
17
  </div>
18
18
  <ul
19
- class='dropdown-menu dropdown-menu-arrow dropdown-menu-end dropdown-menu-card'
19
+ :class='menuClasses'
20
20
  :style='{
21
21
  "width": width
22
22
  }'
@@ -30,7 +30,7 @@
30
30
  </template>
31
31
 
32
32
  <script setup>
33
- import { ref } from 'vue';
33
+ import { ref, computed } from 'vue';
34
34
  import {
35
35
  IconSettings
36
36
  } from '@tabler/icons-vue';
@@ -43,8 +43,52 @@ const props = defineProps({
43
43
  autoclose: {
44
44
  type: String,
45
45
  default: 'true'
46
+ },
47
+ position: {
48
+ type: String,
49
+ default: 'bottom-end',
50
+ validator: (value) => {
51
+ const validPositions = [
52
+ 'bottom', 'bottom-start', 'bottom-end',
53
+ 'top', 'top-start', 'top-end',
54
+ 'left', 'right'
55
+ ];
56
+ return validPositions.includes(value);
57
+ }
46
58
  }
47
59
  });
48
60
 
49
61
  const id = ref('tabler-dropdown-' + Math.random().toString(36).substr(2, 9) + '-' + Date.now().toString(36));
62
+
63
+ const dropdownClasses = computed(() => {
64
+ const baseClass = 'dropdown';
65
+
66
+ switch (props.position) {
67
+ case 'top':
68
+ case 'top-start':
69
+ case 'top-end':
70
+ return `${baseClass} dropup`;
71
+ case 'left':
72
+ return `${baseClass} dropstart`;
73
+ case 'right':
74
+ return `${baseClass} dropend`;
75
+ default: // bottom, bottom-start, bottom-end
76
+ return baseClass;
77
+ }
78
+ });
79
+
80
+ const menuClasses = computed(() => {
81
+ const baseClasses = 'dropdown-menu dropdown-menu-card';
82
+
83
+ switch (props.position) {
84
+ case 'bottom-start':
85
+ case 'top-start':
86
+ return `${baseClasses} dropdown-menu-start`;
87
+ case 'bottom-end':
88
+ case 'top-end':
89
+ return `${baseClasses} dropdown-menu-end dropdown-menu-arrow`;
90
+ default: // bottom, top, left, right
91
+ return baseClasses;
92
+ }
93
+ });
50
94
  </script>
@@ -48,6 +48,7 @@
48
48
  class='form-control'
49
49
  :placeholder='placeholder||label||""'
50
50
  @keyup.enter='$emit("submit")'
51
+ @focus='$emit("focus")'
51
52
  @blur='$emit("blur")'
52
53
  >
53
54
  <span
@@ -82,6 +83,7 @@
82
83
  class='form-control'
83
84
  :placeholder='placeholder||label||""'
84
85
  @keyup.enter='$emit("submit")'
86
+ @focus='$emit("focus")'
85
87
  @blur='$emit("blur")'
86
88
  />
87
89
  <div
@@ -158,7 +160,7 @@ export default {
158
160
  placeholder: String,
159
161
  error: String,
160
162
  },
161
- emits: ['blur', 'submit', 'update:modelValue'],
163
+ emits: ['blur', 'focus', 'submit', 'update:modelValue'],
162
164
  data: function() {
163
165
  return {
164
166
  help: false,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tak-ps/vue-tabler",
3
3
  "type": "module",
4
- "version": "3.75.0",
4
+ "version": "3.77.0",
5
5
  "lib": "lib.js",
6
6
  "module": "lib.js",
7
7
  "description": "Tabler UI components for Vue3",