@policystudio/policy-studio-ui-vue 1.2.0-access.73 → 1.2.0-access.75
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.
|
@@ -2748,9 +2748,6 @@ video {
|
|
|
2748
2748
|
.psui-el-button span {
|
|
2749
2749
|
font-weight: 600;
|
|
2750
2750
|
}
|
|
2751
|
-
.psui-el-button span {
|
|
2752
|
-
line-height: 130%;
|
|
2753
|
-
}
|
|
2754
2751
|
.psui-el-button:focus {
|
|
2755
2752
|
outline: 2px solid transparent;
|
|
2756
2753
|
outline-offset: 2px;
|
|
@@ -2844,6 +2841,7 @@ video {
|
|
|
2844
2841
|
}
|
|
2845
2842
|
.psui-el-button.size-medium {
|
|
2846
2843
|
font-size: 14px;
|
|
2844
|
+
line-height: 20px;
|
|
2847
2845
|
}
|
|
2848
2846
|
.psui-el-button.size-medium .icon-left-side {
|
|
2849
2847
|
margin-right: 0.25rem;
|
|
@@ -2879,6 +2877,7 @@ video {
|
|
|
2879
2877
|
}
|
|
2880
2878
|
.psui-el-button.size-small {
|
|
2881
2879
|
font-size: 14px;
|
|
2880
|
+
line-height: 20px;
|
|
2882
2881
|
}
|
|
2883
2882
|
.psui-el-button.size-small .icon-left-side {
|
|
2884
2883
|
margin-right: 0.25rem;
|
|
@@ -2912,18 +2911,33 @@ video {
|
|
|
2912
2911
|
padding-left: 0.375rem;
|
|
2913
2912
|
padding-right: 0.375rem;
|
|
2914
2913
|
}
|
|
2915
|
-
.psui-el-button.size-compact {
|
|
2914
|
+
.psui-el-button.size-compact span {
|
|
2916
2915
|
font-size: 14px;
|
|
2916
|
+
line-height: 20px;
|
|
2917
2917
|
}
|
|
2918
2918
|
.psui-el-button.size-compact .icon-left-side {
|
|
2919
2919
|
margin-right: 0.125rem;
|
|
2920
2920
|
}
|
|
2921
|
+
.psui-el-button.size-compact .icon-left-side {
|
|
2922
|
+
aspect-ratio: 1/1;
|
|
2923
|
+
}
|
|
2924
|
+
.psui-el-button.size-compact .icon-left-side {
|
|
2925
|
+
padding-top: 2px;
|
|
2926
|
+
padding-bottom: 2px;
|
|
2927
|
+
}
|
|
2921
2928
|
.psui-el-button.size-compact .icon-left-side {
|
|
2922
2929
|
font-size: 16px;
|
|
2923
2930
|
}
|
|
2924
2931
|
.psui-el-button.size-compact .icon-right-side {
|
|
2925
2932
|
margin-left: 0.125rem;
|
|
2926
2933
|
}
|
|
2934
|
+
.psui-el-button.size-compact .icon-right-side {
|
|
2935
|
+
aspect-ratio: 1/1;
|
|
2936
|
+
}
|
|
2937
|
+
.psui-el-button.size-compact .icon-right-side {
|
|
2938
|
+
padding-top: 2px;
|
|
2939
|
+
padding-bottom: 2px;
|
|
2940
|
+
}
|
|
2927
2941
|
.psui-el-button.size-compact .icon-right-side {
|
|
2928
2942
|
font-size: 16px;
|
|
2929
2943
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
@apply psui-flex psui-items-center psui-content-center psui-font-bold psui-transition-all psui-ease-in-out psui-duration-[130ms] psui-no-underline psui-cursor-pointer;
|
|
4
4
|
|
|
5
5
|
span {
|
|
6
|
-
@apply psui-flex psui-items-center psui-font-semibold psui-flex-shrink-0 psui-
|
|
6
|
+
@apply psui-flex psui-items-center psui-font-semibold psui-flex-shrink-0 psui-font-[inherit] psui-text-right psui-pt-[1px] psui-align-middle;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
&:focus {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
&.size-medium {
|
|
40
|
-
@apply psui-flex psui-items-center psui-justify-center psui-content-center psui-rounded-md psui-py-1.5 psui-px-3 psui-text-
|
|
40
|
+
@apply psui-flex psui-items-center psui-justify-center psui-content-center psui-rounded-md psui-py-1.5 psui-px-3 psui-text-14;
|
|
41
41
|
|
|
42
42
|
.icon-left-side {
|
|
43
43
|
@apply psui-text-[18px] psui-mr-1;
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
&.size-small {
|
|
52
|
-
@apply psui-flex psui-items-center psui-justify-center psui-py-1 psui-px-2 psui-rounded psui-text-
|
|
52
|
+
@apply psui-flex psui-items-center psui-justify-center psui-py-1 psui-px-2 psui-rounded psui-text-14;
|
|
53
53
|
|
|
54
54
|
.icon-left-side {
|
|
55
55
|
@apply psui-text-[18px] psui-mr-1;
|
|
@@ -61,14 +61,18 @@
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
&.size-compact {
|
|
64
|
-
@apply psui-flex psui-items-center psui-justify-center psui-rounded psui-py-0.5 psui-px-1.5
|
|
64
|
+
@apply psui-flex psui-items-center psui-justify-center psui-rounded psui-py-0.5 psui-px-1.5;
|
|
65
|
+
|
|
66
|
+
span {
|
|
67
|
+
@apply psui-text-14;
|
|
68
|
+
}
|
|
65
69
|
|
|
66
70
|
.icon-left-side {
|
|
67
|
-
@apply psui-text-[16px] psui-mr-0.5;
|
|
71
|
+
@apply psui-text-[16px] psui-mr-0.5 psui-py-[2px] psui-aspect-square;
|
|
68
72
|
}
|
|
69
73
|
|
|
70
74
|
.icon-right-side {
|
|
71
|
-
@apply psui-text-[16px] psui-ml-0.5;
|
|
75
|
+
@apply psui-text-[16px] psui-ml-0.5 psui-py-[2px] psui-aspect-square;
|
|
72
76
|
}
|
|
73
77
|
}
|
|
74
78
|
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
<div
|
|
3
3
|
class="psui-el-tab-header"
|
|
4
4
|
:class="[getComponentClass, `layout-${layout}`]"
|
|
5
|
-
role="
|
|
5
|
+
role="tablist"
|
|
6
|
+
:aria-label="ariaLabel"
|
|
7
|
+
@keydown="onKeyDown"
|
|
6
8
|
>
|
|
7
9
|
<template v-for="(item, index) in getItems">
|
|
8
10
|
<slot :item="item">
|
|
@@ -14,7 +16,12 @@
|
|
|
14
16
|
<template #trigger>
|
|
15
17
|
<button
|
|
16
18
|
:key="item[keyValue] + index"
|
|
19
|
+
ref="tabButtons"
|
|
17
20
|
type="button"
|
|
21
|
+
role="tab"
|
|
22
|
+
:aria-selected="getSelected === item[keyValue]"
|
|
23
|
+
:tabindex="getSelected === item[keyValue] ? 0 : -1"
|
|
24
|
+
:aria-controls="ariaControlsPrefix ? `${ariaControlsPrefix}${item.id || item[keyValue]}` : undefined"
|
|
18
25
|
@click="selectTab(item)"
|
|
19
26
|
:class="getButtonClass(item).value"
|
|
20
27
|
>
|
|
@@ -31,9 +38,15 @@
|
|
|
31
38
|
</template>
|
|
32
39
|
</PsRichTooltip>
|
|
33
40
|
<button
|
|
34
|
-
v-else
|
|
35
|
-
|
|
41
|
+
v-else
|
|
42
|
+
:id="item.id ? item.id : (idSuffix ? `${item[keyValue]}${idSuffix}` : undefined)"
|
|
36
43
|
:key="item[keyValue] + index"
|
|
44
|
+
ref="tabButtons"
|
|
45
|
+
type="button"
|
|
46
|
+
role="tab"
|
|
47
|
+
:aria-selected="getSelected === item[keyValue]"
|
|
48
|
+
:tabindex="getSelected === item[keyValue] ? 0 : -1"
|
|
49
|
+
:aria-controls="ariaControlsPrefix ? `${ariaControlsPrefix}${item.id || item[keyValue]}` : undefined"
|
|
37
50
|
@click="selectTab(item)"
|
|
38
51
|
:class="getButtonClass(item).value"
|
|
39
52
|
>
|
|
@@ -54,7 +67,7 @@
|
|
|
54
67
|
|
|
55
68
|
<script setup>
|
|
56
69
|
import PsRichTooltip from '../tooltip/PsRichTooltip.vue'
|
|
57
|
-
import { computed } from 'vue'
|
|
70
|
+
import { computed, ref } from 'vue'
|
|
58
71
|
import PsIcon from '../ui/PsIcon.vue'
|
|
59
72
|
|
|
60
73
|
const props = defineProps({
|
|
@@ -98,10 +111,33 @@ const props = defineProps({
|
|
|
98
111
|
* It sets the tab seleced.
|
|
99
112
|
*/
|
|
100
113
|
selected: {},
|
|
114
|
+
/**
|
|
115
|
+
* The aria-label for the tablist.
|
|
116
|
+
*/
|
|
117
|
+
ariaLabel: {
|
|
118
|
+
type: String,
|
|
119
|
+
default: 'Tabs',
|
|
120
|
+
},
|
|
121
|
+
/**
|
|
122
|
+
* Prefix for the aria-controls attribute.
|
|
123
|
+
*/
|
|
124
|
+
ariaControlsPrefix: {
|
|
125
|
+
type: String,
|
|
126
|
+
default: '',
|
|
127
|
+
},
|
|
128
|
+
/**
|
|
129
|
+
* Suffix for the tab ID.
|
|
130
|
+
*/
|
|
131
|
+
idSuffix: {
|
|
132
|
+
type: String,
|
|
133
|
+
default: '',
|
|
134
|
+
},
|
|
101
135
|
})
|
|
102
136
|
|
|
103
137
|
const emit = defineEmits(['change', 'update:selected'])
|
|
104
138
|
|
|
139
|
+
const tabButtons = ref([])
|
|
140
|
+
|
|
105
141
|
const getComponentClass = computed(() => {
|
|
106
142
|
if (props.disabled) {
|
|
107
143
|
return 'status-disabled'
|
|
@@ -146,6 +182,46 @@ const selectTab = (item) => {
|
|
|
146
182
|
}
|
|
147
183
|
}
|
|
148
184
|
|
|
185
|
+
const onKeyDown = (e) => {
|
|
186
|
+
const tabs = tabButtons.value.filter(btn => btn !== null)
|
|
187
|
+
let currentIndex = tabs.findIndex(btn => btn === document.activeElement)
|
|
188
|
+
|
|
189
|
+
if (currentIndex === -1) return
|
|
190
|
+
|
|
191
|
+
let nextIndex
|
|
192
|
+
|
|
193
|
+
switch (e.key) {
|
|
194
|
+
case 'ArrowRight':
|
|
195
|
+
case 'ArrowDown':
|
|
196
|
+
e.preventDefault()
|
|
197
|
+
nextIndex = (currentIndex + 1) % tabs.length
|
|
198
|
+
break
|
|
199
|
+
case 'ArrowLeft':
|
|
200
|
+
case 'ArrowUp':
|
|
201
|
+
e.preventDefault()
|
|
202
|
+
nextIndex = (currentIndex - 1 + tabs.length) % tabs.length
|
|
203
|
+
break
|
|
204
|
+
case 'Home':
|
|
205
|
+
e.preventDefault()
|
|
206
|
+
nextIndex = 0
|
|
207
|
+
break
|
|
208
|
+
case 'End':
|
|
209
|
+
e.preventDefault()
|
|
210
|
+
nextIndex = tabs.length - 1
|
|
211
|
+
break
|
|
212
|
+
default:
|
|
213
|
+
return
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (nextIndex !== undefined) {
|
|
217
|
+
const nextTab = nextIndex >= 0 && nextIndex < getItems.value.length ? getItems.value[nextIndex] : null
|
|
218
|
+
if (nextTab && nextTab.disabled !== true) {
|
|
219
|
+
selectTab(nextTab)
|
|
220
|
+
tabs[nextIndex].focus()
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
149
225
|
const getButtonClass = (item) => {
|
|
150
226
|
return computed(() => {
|
|
151
227
|
if (item.disabled) {
|