@tak-ps/vue-tabler 4.11.3 → 4.12.1
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 +8 -0
- package/components/Dropdown.vue +41 -14
- package/components/IconButton.vue +19 -2
- package/components/input/Input.vue +24 -1
- package/package.json +1 -1
- package/test/IconButton.spec.ts +64 -0
package/CHANGELOG.md
CHANGED
package/components/Dropdown.vue
CHANGED
|
@@ -84,20 +84,40 @@ const menuClasses = computed(() => {
|
|
|
84
84
|
|
|
85
85
|
<style scoped>
|
|
86
86
|
.tabler-dropdown__menu {
|
|
87
|
-
--
|
|
88
|
-
--
|
|
89
|
-
--
|
|
90
|
-
--
|
|
91
|
-
--
|
|
92
|
-
--
|
|
93
|
-
--
|
|
94
|
-
--tblr-dropdown-link-active-color: var(--tblr-primary);
|
|
87
|
+
--tabler-dropdown-color: rgba(255, 255, 255, 0.92);
|
|
88
|
+
--tabler-dropdown-bg: rgba(20, 20, 25, 0.96);
|
|
89
|
+
--tabler-dropdown-border-color: rgba(255, 255, 255, 0.25);
|
|
90
|
+
--tabler-dropdown-hover-bg: rgba(255, 255, 255, 0.1);
|
|
91
|
+
--tabler-dropdown-active-bg: rgba(var(--tblr-primary-rgb), 0.25);
|
|
92
|
+
--tabler-dropdown-active-color: var(--tblr-primary);
|
|
93
|
+
--tabler-dropdown-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.35);
|
|
95
94
|
margin-block: 0.25rem;
|
|
96
95
|
padding: 0.25rem 0;
|
|
97
96
|
overflow: hidden;
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
color: var(--tabler-dropdown-color);
|
|
98
|
+
border-color: var(--tabler-dropdown-border-color);
|
|
99
|
+
background: var(--tabler-dropdown-bg);
|
|
100
100
|
backdrop-filter: blur(8px);
|
|
101
|
+
box-shadow: var(--tabler-dropdown-shadow);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
[data-bs-theme='light'] .tabler-dropdown__menu {
|
|
105
|
+
--tabler-dropdown-color: var(--tblr-body-color);
|
|
106
|
+
--tabler-dropdown-bg: rgba(255, 255, 255, 0.96);
|
|
107
|
+
--tabler-dropdown-border-color: rgba(var(--tblr-primary-rgb), 0.15);
|
|
108
|
+
--tabler-dropdown-hover-bg: rgba(var(--tblr-primary-rgb), 0.08);
|
|
109
|
+
--tabler-dropdown-active-bg: rgba(var(--tblr-primary-rgb), 0.16);
|
|
110
|
+
--tabler-dropdown-shadow: 0 0.5rem 1rem rgba(15, 23, 42, 0.08);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
[data-bs-theme='light'] .tabler-dropdown__menu :deep(.dropdown-item),
|
|
114
|
+
[data-bs-theme='light'] .tabler-dropdown__menu :deep(.tabler-dropdown__item),
|
|
115
|
+
[data-bs-theme='light'] .tabler-dropdown__menu :deep(.text-white) {
|
|
116
|
+
color: var(--tblr-body-color) !important;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
[data-bs-theme='light'] .tabler-dropdown__menu :deep(.text-white-50) {
|
|
120
|
+
color: var(--tblr-secondary-color) !important;
|
|
101
121
|
}
|
|
102
122
|
|
|
103
123
|
.tabler-dropdown__menu.dropdown-menu-arrow::before,
|
|
@@ -109,22 +129,29 @@ const menuClasses = computed(() => {
|
|
|
109
129
|
.tabler-dropdown__menu :deep(.tabler-dropdown__item) {
|
|
110
130
|
cursor: pointer;
|
|
111
131
|
color: inherit;
|
|
112
|
-
transition: background 0.1s ease;
|
|
132
|
+
transition: background 0.1s ease, color 0.1s ease;
|
|
113
133
|
}
|
|
114
134
|
|
|
115
135
|
.tabler-dropdown__menu :deep(.dropdown-item:hover),
|
|
116
136
|
.tabler-dropdown__menu :deep(.tabler-dropdown__item:hover) {
|
|
117
|
-
background:
|
|
137
|
+
background: var(--tabler-dropdown-hover-bg);
|
|
118
138
|
}
|
|
119
139
|
|
|
120
140
|
.tabler-dropdown__menu :deep(.dropdown-item.active),
|
|
121
141
|
.tabler-dropdown__menu :deep(.dropdown-item:active),
|
|
122
142
|
.tabler-dropdown__menu :deep(.tabler-dropdown__item--active) {
|
|
123
|
-
background:
|
|
124
|
-
color: var(--
|
|
143
|
+
background: var(--tabler-dropdown-active-bg);
|
|
144
|
+
color: var(--tabler-dropdown-active-color);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.tabler-dropdown__menu :deep(.dropdown-item.active .text-white),
|
|
148
|
+
.tabler-dropdown__menu :deep(.dropdown-item:active .text-white),
|
|
149
|
+
.tabler-dropdown__menu :deep(.tabler-dropdown__item--active .text-white) {
|
|
150
|
+
color: var(--tabler-dropdown-active-color) !important;
|
|
125
151
|
}
|
|
126
152
|
|
|
127
153
|
.tabler-dropdown__menu :deep(.dropdown-item.active .text-white-50),
|
|
154
|
+
.tabler-dropdown__menu :deep(.dropdown-item:active .text-white-50),
|
|
128
155
|
.tabler-dropdown__menu :deep(.tabler-dropdown__item--active .text-white-50) {
|
|
129
156
|
color: rgba(var(--tblr-primary-rgb), 0.7) !important;
|
|
130
157
|
}
|
|
@@ -48,7 +48,24 @@ const iconButtonStyle = computed(() => {
|
|
|
48
48
|
color: var(--tblr-gray-500);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
.custom-hover:not(.disabled)
|
|
52
|
-
|
|
51
|
+
.custom-hover:not(.disabled) {
|
|
52
|
+
border: 1px solid transparent;
|
|
53
|
+
transition: background-color 0.15s ease, border-color 0.15s ease;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
[data-bs-theme='light'] .custom-hover:not(.disabled):hover,
|
|
57
|
+
[data-bs-theme='light'] .custom-hover:not(.disabled):focus-visible,
|
|
58
|
+
[data-bs-theme='light'] .custom-hover:not(.disabled):focus-within {
|
|
59
|
+
border-radius: 6px;
|
|
60
|
+
border-color: color-mix(in srgb, var(--tblr-body-color) 18%, transparent);
|
|
61
|
+
background: color-mix(in srgb, var(--tblr-body-color) 8%, transparent);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
[data-bs-theme='dark'] .custom-hover:not(.disabled):hover,
|
|
65
|
+
[data-bs-theme='dark'] .custom-hover:not(.disabled):focus-visible,
|
|
66
|
+
[data-bs-theme='dark'] .custom-hover:not(.disabled):focus-within {
|
|
67
|
+
border-radius: 6px;
|
|
68
|
+
border-color: color-mix(in srgb, var(--tblr-light) 30%, transparent);
|
|
69
|
+
background: color-mix(in srgb, var(--tblr-light) 12%, transparent);
|
|
53
70
|
}
|
|
54
71
|
</style>
|
|
@@ -318,6 +318,29 @@ input:autofill {
|
|
|
318
318
|
color calc(infinity * 1s) step-end;
|
|
319
319
|
}
|
|
320
320
|
|
|
321
|
+
.input-group :deep(.form-control),
|
|
322
|
+
.position-relative > .form-control,
|
|
323
|
+
.input-group :deep(.input-group-text) {
|
|
324
|
+
border-color: var(--tblr-border-color);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.input-group :deep(.form-control),
|
|
328
|
+
.position-relative > .form-control {
|
|
329
|
+
color: var(--tblr-body-color);
|
|
330
|
+
background-color: var(--tabler-input-bg, var(--tblr-bg-forms, var(--tblr-bg-surface, var(--tblr-body-bg))));
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.input-group :deep(.form-control)::placeholder,
|
|
334
|
+
.position-relative > .form-control::placeholder {
|
|
335
|
+
color: var(--tblr-secondary-color);
|
|
336
|
+
opacity: 1;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.input-group :deep(.input-group-text) {
|
|
340
|
+
color: var(--tblr-body-color);
|
|
341
|
+
background-color: var(--tabler-input-bg, var(--tblr-bg-forms, var(--tblr-bg-surface, var(--tblr-body-bg))));
|
|
342
|
+
}
|
|
343
|
+
|
|
321
344
|
.tabler-input-with-end {
|
|
322
345
|
padding-right: 3rem;
|
|
323
346
|
}
|
|
@@ -357,7 +380,7 @@ input:autofill {
|
|
|
357
380
|
}
|
|
358
381
|
|
|
359
382
|
.tabler-input-end {
|
|
360
|
-
color: var(--tblr-
|
|
383
|
+
color: var(--tblr-body-color);
|
|
361
384
|
opacity: 1;
|
|
362
385
|
}
|
|
363
386
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
|
|
3
|
+
import { describe, expect, it } from 'vitest'
|
|
4
|
+
import { mount } from '@vue/test-utils'
|
|
5
|
+
import IconButton from '../components/IconButton.vue'
|
|
6
|
+
import iconButtonSource from '../components/IconButton.vue?raw'
|
|
7
|
+
|
|
8
|
+
const global = {
|
|
9
|
+
directives: {
|
|
10
|
+
tooltip: {
|
|
11
|
+
mounted() {
|
|
12
|
+
return undefined
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
describe('TablerIconButton', () => {
|
|
19
|
+
it('adds hover styling when no explicit color is provided', () => {
|
|
20
|
+
const wrapper = mount(IconButton, {
|
|
21
|
+
props: {
|
|
22
|
+
title: 'Toggle Panel',
|
|
23
|
+
},
|
|
24
|
+
slots: {
|
|
25
|
+
default: 'X',
|
|
26
|
+
},
|
|
27
|
+
global,
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
expect(wrapper.get('div').classes()).toContain('custom-hover')
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
it('skips hover styling when a custom color is provided', () => {
|
|
34
|
+
const wrapper = mount(IconButton, {
|
|
35
|
+
props: {
|
|
36
|
+
title: 'Toggle Panel',
|
|
37
|
+
color: '#123456',
|
|
38
|
+
},
|
|
39
|
+
slots: {
|
|
40
|
+
default: 'X',
|
|
41
|
+
},
|
|
42
|
+
global,
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
expect(wrapper.get('div').classes()).not.toContain('custom-hover')
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
it('uses theme-derived hover colors and borders instead of fixed values', () => {
|
|
49
|
+
expect(iconButtonSource).toContain('transition: background-color 0.15s ease, border-color 0.15s ease;')
|
|
50
|
+
expect(iconButtonSource).toContain('border: 1px solid transparent;')
|
|
51
|
+
|
|
52
|
+
expect(iconButtonSource).toContain("[data-bs-theme='light'] .custom-hover:not(.disabled):hover,")
|
|
53
|
+
expect(iconButtonSource).toContain("[data-bs-theme='light'] .custom-hover:not(.disabled):focus-visible,")
|
|
54
|
+
expect(iconButtonSource).toContain("[data-bs-theme='light'] .custom-hover:not(.disabled):focus-within {")
|
|
55
|
+
expect(iconButtonSource).toContain('border-color: color-mix(in srgb, var(--tblr-body-color) 18%, transparent);')
|
|
56
|
+
expect(iconButtonSource).toContain('background: color-mix(in srgb, var(--tblr-body-color) 8%, transparent);')
|
|
57
|
+
|
|
58
|
+
expect(iconButtonSource).toContain("[data-bs-theme='dark'] .custom-hover:not(.disabled):hover,")
|
|
59
|
+
expect(iconButtonSource).toContain("[data-bs-theme='dark'] .custom-hover:not(.disabled):focus-visible,")
|
|
60
|
+
expect(iconButtonSource).toContain("[data-bs-theme='dark'] .custom-hover:not(.disabled):focus-within {")
|
|
61
|
+
expect(iconButtonSource).toContain('border-color: color-mix(in srgb, var(--tblr-light) 30%, transparent);')
|
|
62
|
+
expect(iconButtonSource).toContain('background: color-mix(in srgb, var(--tblr-light) 12%, transparent);')
|
|
63
|
+
})
|
|
64
|
+
})
|