sprintify-ui 0.5.2 → 0.5.3
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/dist/sprintify-ui.es.js +3909 -3783
- package/dist/style.css +1 -1
- package/dist/types/src/components/BaseLayoutStacked.vue.d.ts +24 -1
- package/dist/types/src/components/BaseLayoutStackedConfigurable.vue.d.ts +18 -0
- package/dist/types/src/components/BaseMenuItem.vue.d.ts +9 -0
- package/dist/types/src/components/BaseNavbar.vue.d.ts +10 -9
- package/dist/types/src/components/BaseNavbarItem.vue.d.ts +9 -0
- package/dist/types/src/components/BaseNavbarItemContent.vue.d.ts +3 -3
- package/dist/types/src/types/ActionItem.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/BaseLayoutNotificationDropdown.vue +7 -7
- package/src/components/BaseLayoutStacked.vue +14 -3
- package/src/components/BaseLayoutStackedConfigurable.stories.js +52 -7
- package/src/components/BaseLayoutStackedConfigurable.vue +19 -4
- package/src/components/BaseMenuItem.vue +39 -15
- package/src/components/BaseNavbar.vue +27 -9
- package/src/components/BaseNavbarItem.vue +36 -2
- package/src/components/BaseNavbarItemContent.vue +37 -19
- package/src/components/BaseNavbarSideItemContent.vue +1 -1
- package/src/components/BaseTabItem.vue +4 -9
- package/src/components/BaseTabs.stories.js +6 -2
- package/src/components/BaseTabs.vue +94 -5
- package/src/types/ActionItem.ts +1 -0
|
@@ -4,9 +4,20 @@
|
|
|
4
4
|
<div
|
|
5
5
|
ref="scrollable"
|
|
6
6
|
class="scrollable relative overflow-x-auto overflow-y-hidden"
|
|
7
|
+
:class="{
|
|
8
|
+
'-mx-2': size == 'xs',
|
|
9
|
+
'-mx-3': size == 'sm',
|
|
10
|
+
'-mx-4': size == 'md',
|
|
11
|
+
'-mx-5': size == 'lg',
|
|
12
|
+
}"
|
|
7
13
|
data-scroll-lock-scrollable
|
|
8
14
|
>
|
|
9
15
|
<ul class="flex text-center">
|
|
16
|
+
<div
|
|
17
|
+
ref="lineRef"
|
|
18
|
+
style="visibility: hidden; width: 0px;"
|
|
19
|
+
class="absolute left-0 bottom-0 w-full h-[2px] bg-primary-600"
|
|
20
|
+
/>
|
|
10
21
|
<slot />
|
|
11
22
|
</ul>
|
|
12
23
|
</div>
|
|
@@ -31,6 +42,7 @@ watch(
|
|
|
31
42
|
() => {
|
|
32
43
|
nextTick(() => {
|
|
33
44
|
scrollToCenter();
|
|
45
|
+
animateLine();
|
|
34
46
|
});
|
|
35
47
|
}
|
|
36
48
|
);
|
|
@@ -40,15 +52,37 @@ provide(
|
|
|
40
52
|
computed(() => props.size)
|
|
41
53
|
);
|
|
42
54
|
|
|
43
|
-
function
|
|
55
|
+
function getActiveTab(): HTMLElement | null {
|
|
56
|
+
|
|
44
57
|
if (!scrollable.value) {
|
|
45
|
-
return;
|
|
58
|
+
return null;
|
|
46
59
|
}
|
|
47
60
|
|
|
48
|
-
|
|
61
|
+
return scrollable.value.querySelector(
|
|
49
62
|
'.active'
|
|
50
63
|
) as HTMLElement | null;
|
|
51
64
|
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function getActiveTabSlot(): HTMLElement | null {
|
|
68
|
+
|
|
69
|
+
if (!scrollable.value) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return scrollable.value.querySelector(
|
|
74
|
+
'.active .base-tab-item-slot'
|
|
75
|
+
) as HTMLElement | null;
|
|
76
|
+
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function scrollToCenter() {
|
|
80
|
+
if (!scrollable.value) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const activeTab = getActiveTab();
|
|
85
|
+
|
|
52
86
|
if (!activeTab) {
|
|
53
87
|
return;
|
|
54
88
|
}
|
|
@@ -56,14 +90,69 @@ function scrollToCenter() {
|
|
|
56
90
|
const scrollableRect = scrollable.value.getBoundingClientRect();
|
|
57
91
|
const activeTabRect = activeTab.getBoundingClientRect();
|
|
58
92
|
|
|
59
|
-
const scrollLeft =
|
|
60
|
-
activeTab.offsetLeft - (scrollableRect.width - activeTabRect.width) / 2;
|
|
93
|
+
const scrollLeft = activeTab.offsetLeft - (scrollableRect.width - activeTabRect.width) / 2;
|
|
61
94
|
|
|
62
95
|
scrollable.value.scrollTo({
|
|
63
96
|
left: scrollLeft,
|
|
64
97
|
behavior: 'smooth',
|
|
65
98
|
});
|
|
66
99
|
}
|
|
100
|
+
|
|
101
|
+
// Line animation
|
|
102
|
+
|
|
103
|
+
const lineRef = ref<HTMLElement | null>(null);
|
|
104
|
+
|
|
105
|
+
onMounted(() => {
|
|
106
|
+
nextTick(() => {
|
|
107
|
+
animateLine(false);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
function animateLine(animate = true) {
|
|
112
|
+
|
|
113
|
+
const activeTabSlot = getActiveTabSlot();
|
|
114
|
+
|
|
115
|
+
if (!scrollable.value) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (!lineRef.value) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (!activeTabSlot) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const width = activeTabSlot.clientWidth;
|
|
128
|
+
const activeTabSlotRect = activeTabSlot.getBoundingClientRect();
|
|
129
|
+
const scrollableRect = scrollable.value.getBoundingClientRect();
|
|
130
|
+
|
|
131
|
+
const x = activeTabSlotRect.left - scrollableRect.left + scrollable.value.scrollLeft;
|
|
132
|
+
|
|
133
|
+
lineRef.value.style.visibility = 'visible';
|
|
134
|
+
|
|
135
|
+
if (!animate) {
|
|
136
|
+
lineRef.value.style.transform = `translateX(${x}px)`;
|
|
137
|
+
lineRef.value.style.width = `${width}px`;
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
lineRef.value.animate(
|
|
142
|
+
[
|
|
143
|
+
{
|
|
144
|
+
transform: `translateX(${x}px)`,
|
|
145
|
+
width: `${width}px`,
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
{
|
|
149
|
+
duration: 200,
|
|
150
|
+
easing: 'ease-in-out',
|
|
151
|
+
fill: 'both',
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
}
|
|
67
156
|
</script>
|
|
68
157
|
|
|
69
158
|
<style scoped>
|