@tak-ps/vue-tabler 5.0.0 → 5.2.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 +15 -0
- package/components/Delete.vue +3 -1
- package/components/IconButton.vue +2 -1
- package/components/Slidedown.vue +26 -1
- package/package.json +1 -1
- package/test/IconButton.spec.ts +14 -12
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,21 @@
|
|
|
10
10
|
|
|
11
11
|
## Version History
|
|
12
12
|
|
|
13
|
+
### Pending
|
|
14
|
+
|
|
15
|
+
### v5.2.0
|
|
16
|
+
|
|
17
|
+
- :rocket: Allow setting custom Delete title
|
|
18
|
+
|
|
19
|
+
### v5.1.0
|
|
20
|
+
|
|
21
|
+
- :bug: TablerSlidedown: `clickAnywhereExpand` no longer collapses an expanded slidedown - collapse is explicit via the arrow control (or opt-in via `clickAnywhereCollapse`)
|
|
22
|
+
|
|
23
|
+
### v5.0.1
|
|
24
|
+
|
|
25
|
+
- :bug: TablerSlidedown: reset wrapper scroll on expand so content focused while collapsed (ie autofocused inputs) cannot leave the top of the expanded content cut off
|
|
26
|
+
- :bug: TablerSlidedown: release the measured max-height once the expand transition completes so content that grows after expansion (async lists etc.) is not clipped
|
|
27
|
+
|
|
13
28
|
### v5.0.0
|
|
14
29
|
|
|
15
30
|
- :rocket: Remove `TablerList` as it used an outdated `window.std` requirement for fetching data
|
package/components/Delete.vue
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
</template>
|
|
30
30
|
<template v-else>
|
|
31
31
|
<TablerIconButton
|
|
32
|
-
title='
|
|
32
|
+
:title='props.title'
|
|
33
33
|
:disabled='props.disabled'
|
|
34
34
|
@click.stop.prevent='openModal'
|
|
35
35
|
>
|
|
@@ -103,6 +103,7 @@ import {
|
|
|
103
103
|
|
|
104
104
|
export interface DeleteProps {
|
|
105
105
|
label?: string;
|
|
106
|
+
title?: string;
|
|
106
107
|
size?: number;
|
|
107
108
|
disabled?: boolean;
|
|
108
109
|
displaytype?: 'button' | 'icon' | 'menu';
|
|
@@ -111,6 +112,7 @@ export interface DeleteProps {
|
|
|
111
112
|
|
|
112
113
|
const props = withDefaults(defineProps<DeleteProps>(), {
|
|
113
114
|
label: 'Delete',
|
|
115
|
+
title: 'Delete',
|
|
114
116
|
size: 32,
|
|
115
117
|
disabled: false,
|
|
116
118
|
displaytype: 'button'
|
package/components/Slidedown.vue
CHANGED
|
@@ -74,8 +74,33 @@ function toggle() {
|
|
|
74
74
|
|
|
75
75
|
if (el) {
|
|
76
76
|
if (isExpanded.value) {
|
|
77
|
+
// The wrapper is overflow: hidden but can still be scrolled
|
|
78
|
+
// programmatically (ie by a browser focus() scrolling an input in
|
|
79
|
+
// the collapsed content into view) which would leave the top of
|
|
80
|
+
// the expanded content cut off
|
|
81
|
+
el.scrollTop = 0;
|
|
82
|
+
|
|
77
83
|
el.style.maxHeight = el.scrollHeight + 'px';
|
|
84
|
+
|
|
85
|
+
const release = (event: TransitionEvent) => {
|
|
86
|
+
if (event.target !== el) return;
|
|
87
|
+
el.removeEventListener('transitionend', release);
|
|
88
|
+
|
|
89
|
+
if (isExpanded.value) {
|
|
90
|
+
// Release the measured height so content that grows after
|
|
91
|
+
// expansion (async lists etc.) is not clipped
|
|
92
|
+
el.style.maxHeight = 'none';
|
|
93
|
+
el.scrollTop = 0;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
el.addEventListener('transitionend', release);
|
|
78
98
|
} else {
|
|
99
|
+
// Re-fix the current height so the collapse can animate from it
|
|
100
|
+
// even if the max-height was released after expansion
|
|
101
|
+
el.style.maxHeight = el.scrollHeight + 'px';
|
|
102
|
+
void el.offsetHeight;
|
|
103
|
+
|
|
79
104
|
el.style.maxHeight = ''; // Reset to CSS default (0)
|
|
80
105
|
}
|
|
81
106
|
}
|
|
@@ -87,7 +112,7 @@ function handleClick(event: MouseEvent) {
|
|
|
87
112
|
if (el && el === event.target) return;
|
|
88
113
|
if (el && el.contains(event.target as Node)) return;
|
|
89
114
|
|
|
90
|
-
if (props.clickAnywhereExpand) {
|
|
115
|
+
if (props.clickAnywhereExpand && !isExpanded.value) {
|
|
91
116
|
toggle();
|
|
92
117
|
} else if (props.clickAnywhereCollapse && isExpanded.value) {
|
|
93
118
|
toggle();
|
package/package.json
CHANGED
package/test/IconButton.spec.ts
CHANGED
|
@@ -5,16 +5,6 @@ import { mount } from '@vue/test-utils'
|
|
|
5
5
|
import IconButton from '../components/IconButton.vue'
|
|
6
6
|
import iconButtonSource from '../components/IconButton.vue?raw'
|
|
7
7
|
|
|
8
|
-
const global = {
|
|
9
|
-
directives: {
|
|
10
|
-
tooltip: {
|
|
11
|
-
mounted() {
|
|
12
|
-
return undefined
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
}
|
|
17
|
-
|
|
18
8
|
describe('TablerIconButton', () => {
|
|
19
9
|
it('adds hover styling when no explicit color is provided', () => {
|
|
20
10
|
const wrapper = mount(IconButton, {
|
|
@@ -24,12 +14,25 @@ describe('TablerIconButton', () => {
|
|
|
24
14
|
slots: {
|
|
25
15
|
default: 'X',
|
|
26
16
|
},
|
|
27
|
-
global,
|
|
28
17
|
})
|
|
29
18
|
|
|
30
19
|
expect(wrapper.get('div').classes()).toContain('custom-hover')
|
|
31
20
|
})
|
|
32
21
|
|
|
22
|
+
it('exposes the title as a native tooltip and accessible name', () => {
|
|
23
|
+
const wrapper = mount(IconButton, {
|
|
24
|
+
props: {
|
|
25
|
+
title: 'Toggle Panel',
|
|
26
|
+
},
|
|
27
|
+
slots: {
|
|
28
|
+
default: 'X',
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
expect(wrapper.get('div').attributes('title')).toBe('Toggle Panel')
|
|
33
|
+
expect(wrapper.get('div').attributes('aria-label')).toBe('Toggle Panel')
|
|
34
|
+
})
|
|
35
|
+
|
|
33
36
|
it('skips hover styling when a custom color is provided', () => {
|
|
34
37
|
const wrapper = mount(IconButton, {
|
|
35
38
|
props: {
|
|
@@ -39,7 +42,6 @@ describe('TablerIconButton', () => {
|
|
|
39
42
|
slots: {
|
|
40
43
|
default: 'X',
|
|
41
44
|
},
|
|
42
|
-
global,
|
|
43
45
|
})
|
|
44
46
|
|
|
45
47
|
expect(wrapper.get('div').classes()).not.toContain('custom-hover')
|