@tak-ps/vue-tabler 4.18.0 → 4.20.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 +6 -0
- package/components/Border.vue +11 -77
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,7 +9,13 @@
|
|
|
9
9
|
- :tada: when adding new features
|
|
10
10
|
|
|
11
11
|
## Version History
|
|
12
|
+
### v4.19.1
|
|
12
13
|
|
|
14
|
+
- :bug: Fix `TablerBorder` `tools` slot not appearing on hover when scoped CSS selector matched the wrong element
|
|
15
|
+
|
|
16
|
+
### v4.19.0
|
|
17
|
+
|
|
18
|
+
- :rocket: Simplify `TablerBorder` to expose a generic `tools` slot for hover-revealed actions; remove edit-specific props and slots
|
|
13
19
|
### v4.17.0
|
|
14
20
|
|
|
15
21
|
- :rocket: `TablerBorder` now supports `background`, `editable`, `editing`, `editAriaLabel` props plus `actions` and `editor` slots and an `edit` event for inline edit container patterns
|
package/components/Border.vue
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
class='card border border-light-subtle'
|
|
3
|
+
class='card tabler-border border border-light-subtle'
|
|
4
4
|
:class='{
|
|
5
5
|
"h-100": fillHeight,
|
|
6
6
|
"shadow-sm": shadow,
|
|
7
|
-
"tabler-border--clickable": clickable,
|
|
8
7
|
}'
|
|
9
8
|
:style='backgroundStyle'
|
|
10
|
-
:role='clickable ? "button" : undefined'
|
|
11
|
-
:tabindex='clickable ? 0 : undefined'
|
|
12
|
-
@click='handleClick'
|
|
13
|
-
@keyup.enter='handleClick'
|
|
14
|
-
@keyup.space.prevent='handleClick'
|
|
15
9
|
>
|
|
16
10
|
<div
|
|
17
11
|
class='card-body d-flex flex-column position-relative'
|
|
@@ -36,36 +30,19 @@
|
|
|
36
30
|
</div>
|
|
37
31
|
|
|
38
32
|
<div
|
|
39
|
-
v-if='
|
|
40
|
-
class='tabler-
|
|
33
|
+
v-if='$slots.tools'
|
|
34
|
+
class='tabler-border__tools position-absolute'
|
|
41
35
|
>
|
|
42
|
-
<slot name='
|
|
43
|
-
<TablerIconButton
|
|
44
|
-
v-if='editable && !editing'
|
|
45
|
-
:title='resolvedEditAriaLabel'
|
|
46
|
-
@click.stop.prevent='emit("edit")'
|
|
47
|
-
>
|
|
48
|
-
<IconPencil
|
|
49
|
-
:size='24'
|
|
50
|
-
stroke='1'
|
|
51
|
-
/>
|
|
52
|
-
</TablerIconButton>
|
|
53
|
-
</slot>
|
|
36
|
+
<slot name='tools' />
|
|
54
37
|
</div>
|
|
55
38
|
|
|
56
|
-
<slot
|
|
57
|
-
v-if='editing'
|
|
58
|
-
name='editor'
|
|
59
|
-
/>
|
|
60
|
-
<slot v-else />
|
|
39
|
+
<slot />
|
|
61
40
|
</div>
|
|
62
41
|
</div>
|
|
63
42
|
</template>
|
|
64
43
|
|
|
65
44
|
<script setup lang='ts'>
|
|
66
|
-
import { computed
|
|
67
|
-
import TablerIconButton from './IconButton.vue';
|
|
68
|
-
import { IconPencil } from '@tabler/icons-vue';
|
|
45
|
+
import { computed } from 'vue';
|
|
69
46
|
|
|
70
47
|
export interface BorderProps {
|
|
71
48
|
label?: string;
|
|
@@ -73,9 +50,6 @@ export interface BorderProps {
|
|
|
73
50
|
background?: string;
|
|
74
51
|
shadow?: boolean;
|
|
75
52
|
fillHeight?: boolean;
|
|
76
|
-
editable?: boolean;
|
|
77
|
-
editing?: boolean;
|
|
78
|
-
editAriaLabel?: string;
|
|
79
53
|
}
|
|
80
54
|
|
|
81
55
|
const props = withDefaults(defineProps<BorderProps>(), {
|
|
@@ -84,65 +58,25 @@ const props = withDefaults(defineProps<BorderProps>(), {
|
|
|
84
58
|
background: '',
|
|
85
59
|
shadow: true,
|
|
86
60
|
fillHeight: true,
|
|
87
|
-
editable: false,
|
|
88
|
-
editing: false,
|
|
89
|
-
editAriaLabel: '',
|
|
90
61
|
});
|
|
91
62
|
|
|
92
|
-
const emit = defineEmits<{
|
|
93
|
-
edit: [];
|
|
94
|
-
}>();
|
|
95
|
-
|
|
96
|
-
const slots = useSlots();
|
|
97
|
-
|
|
98
63
|
const backgroundStyle = computed(() => {
|
|
99
64
|
if (!props.background) return undefined;
|
|
100
65
|
return { backgroundColor: props.background };
|
|
101
66
|
});
|
|
102
|
-
|
|
103
|
-
const clickable = computed(() => props.editable && !props.editing);
|
|
104
|
-
|
|
105
|
-
const showActions = computed(() => {
|
|
106
|
-
if (slots.actions) return true;
|
|
107
|
-
return props.editable && !props.editing;
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
const resolvedEditAriaLabel = computed(() => {
|
|
111
|
-
if (props.editAriaLabel) return props.editAriaLabel;
|
|
112
|
-
if (props.label) return `Edit ${props.label.toLowerCase()}`;
|
|
113
|
-
return 'Edit';
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
function handleClick(): void {
|
|
117
|
-
if (!clickable.value) return;
|
|
118
|
-
emit('edit');
|
|
119
|
-
}
|
|
120
67
|
</script>
|
|
121
68
|
|
|
122
69
|
<style scoped>
|
|
123
|
-
.tabler-
|
|
124
|
-
cursor: pointer;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.tabler-border--clickable:focus-visible {
|
|
128
|
-
outline: 2px solid rgba(var(--tblr-primary-rgb, 32, 107, 196), 0.7);
|
|
129
|
-
outline-offset: 2px;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.tabler-border__actions {
|
|
70
|
+
.tabler-border__tools {
|
|
133
71
|
top: 8px;
|
|
134
72
|
right: 8px;
|
|
135
|
-
|
|
136
|
-
transition: opacity 0.15s ease-in-out;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.tabler-border--clickable .tabler-border__actions {
|
|
73
|
+
z-index: 2;
|
|
140
74
|
opacity: 0;
|
|
75
|
+
transition: opacity 0.15s ease-in-out;
|
|
141
76
|
}
|
|
142
77
|
|
|
143
|
-
.tabler-border
|
|
144
|
-
.tabler-border
|
|
145
|
-
.tabler-border__actions:focus-within {
|
|
78
|
+
.tabler-border:hover > .card-body > .tabler-border__tools,
|
|
79
|
+
.tabler-border:focus-within > .card-body > .tabler-border__tools {
|
|
146
80
|
opacity: 1;
|
|
147
81
|
}
|
|
148
82
|
</style>
|