@tak-ps/vue-tabler 4.14.0 → 4.15.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,10 @@
10
10
 
11
11
  ## Version History
12
12
 
13
+ ### v4.15.0 - 2026-04-20
14
+
15
+ - :rocket: Click anywhere collapse
16
+
13
17
  ### v4.14.0 - 2026-04-19
14
18
 
15
19
  - :rocket: Add ability to turn off border
@@ -3,10 +3,10 @@
3
3
  class='hover-expandable rounded position-relative px-2 py-2'
4
4
  :class='{
5
5
  "expanded mb-3": isExpanded,
6
- "cursor-pointer": props.clickAnywhereExpand && !isExpanded,
6
+ "cursor-pointer": props.clickAnywhereExpand || props.clickAnywhereCollapse,
7
7
  "no-border": !props.border
8
8
  }'
9
- @click='(props.clickAnywhereExpand && !isExpanded) ? toggle() : null'
9
+ @click='handleClick'
10
10
  >
11
11
  <div
12
12
  :class='{
@@ -53,12 +53,14 @@ export interface SlidedownProps {
53
53
  arrow?: boolean;
54
54
  border?: boolean;
55
55
  clickAnywhereExpand?: boolean;
56
+ clickAnywhereCollapse?: boolean;
56
57
  }
57
58
 
58
59
  const props = withDefaults(defineProps<SlidedownProps>(), {
59
60
  arrow: true,
60
61
  border: true,
61
- clickAnywhereExpand: false
62
+ clickAnywhereExpand: false,
63
+ clickAnywhereCollapse: false
62
64
  });
63
65
 
64
66
  const isExpanded = ref(false);
@@ -77,6 +79,19 @@ function toggle() {
77
79
  el.style.maxHeight = ''; // Reset to CSS default (0)
78
80
  }
79
81
  }
82
+ }
83
+
84
+ function handleClick(event: MouseEvent) {
85
+ // Don't handle clicks from the expanded content wrapper
86
+ const el = contentWrapperRef.value;
87
+ if (el && el === event.target) return;
88
+ if (el && el.contains(event.target as Node)) return;
89
+
90
+ if (props.clickAnywhereExpand) {
91
+ toggle();
92
+ } else if (props.clickAnywhereCollapse && isExpanded.value) {
93
+ toggle();
94
+ }
80
95
  };
81
96
  </script>
82
97
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tak-ps/vue-tabler",
3
3
  "type": "module",
4
- "version": "4.14.0",
4
+ "version": "4.15.0",
5
5
  "lib": "lib.ts",
6
6
  "main": "lib.ts",
7
7
  "module": "lib.ts",