sprintify-ui 0.0.193 → 0.0.195
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 +2352 -2291
- package/dist/style.css +1 -1
- package/dist/types/src/components/BaseTabItem.vue.d.ts +33 -30
- package/dist/types/src/components/BaseTabs.vue.d.ts +25 -1
- package/package.json +1 -1
- package/src/components/BaseMediaLibrary.vue +11 -10
- package/src/components/BaseTabItem.vue +53 -22
- package/src/components/BaseTabs.stories.js +33 -2
- package/src/components/BaseTabs.vue +74 -3
|
@@ -3,6 +3,7 @@ import BaseTabItem from './BaseTabItem.vue';
|
|
|
3
3
|
import BaseContainer from './BaseContainer.vue';
|
|
4
4
|
import BaseCard from './BaseCard.vue';
|
|
5
5
|
import BaseCardRow from './BaseCardRow.vue';
|
|
6
|
+
import BaseCounter from './BaseCounter.vue';
|
|
6
7
|
|
|
7
8
|
export default {
|
|
8
9
|
title: 'Layout/BaseTabs',
|
|
@@ -17,6 +18,7 @@ const Template = (args) => ({
|
|
|
17
18
|
BaseContainer,
|
|
18
19
|
BaseCard,
|
|
19
20
|
BaseCardRow,
|
|
21
|
+
BaseCounter,
|
|
20
22
|
},
|
|
21
23
|
setup() {
|
|
22
24
|
return { args };
|
|
@@ -25,8 +27,11 @@ const Template = (args) => ({
|
|
|
25
27
|
<div class="bg-slate-100 py-10">
|
|
26
28
|
<BaseContainer>
|
|
27
29
|
<BaseTabs v-bind="args">
|
|
28
|
-
<BaseTabItem to="/">
|
|
29
|
-
|
|
30
|
+
<BaseTabItem to="/" v-slot="{active}">
|
|
31
|
+
<div class="flex items-center">
|
|
32
|
+
<span class="mr-1">Home</span>
|
|
33
|
+
<BaseCounter :size="args.size" :color="active ? 'primary' : 'light'" :count="1"></BaseCounter>
|
|
34
|
+
</div>
|
|
30
35
|
</BaseTabItem>
|
|
31
36
|
<BaseTabItem to="/setup">
|
|
32
37
|
Setup
|
|
@@ -34,9 +39,15 @@ const Template = (args) => ({
|
|
|
34
39
|
<BaseTabItem to="/settings">
|
|
35
40
|
Settings
|
|
36
41
|
</BaseTabItem>
|
|
42
|
+
<BaseTabItem to="/articles">
|
|
43
|
+
Articles
|
|
44
|
+
</BaseTabItem>
|
|
37
45
|
<BaseTabItem to="/misc">
|
|
38
46
|
Miscellaneous
|
|
39
47
|
</BaseTabItem>
|
|
48
|
+
<BaseTabItem to="/users">
|
|
49
|
+
Users
|
|
50
|
+
</BaseTabItem>
|
|
40
51
|
</BaseTabs>
|
|
41
52
|
<div class="mt-10">
|
|
42
53
|
<BaseCard>
|
|
@@ -52,3 +63,23 @@ const Template = (args) => ({
|
|
|
52
63
|
|
|
53
64
|
export const Demo = Template.bind({});
|
|
54
65
|
Demo.args = {};
|
|
66
|
+
|
|
67
|
+
export const SizeXS = Template.bind({});
|
|
68
|
+
SizeXS.args = {
|
|
69
|
+
size: 'xs',
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const SizeSM = Template.bind({});
|
|
73
|
+
SizeSM.args = {
|
|
74
|
+
size: 'sm',
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const SizeMD = Template.bind({});
|
|
78
|
+
SizeMD.args = {
|
|
79
|
+
size: 'md',
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const SizeLG = Template.bind({});
|
|
83
|
+
SizeLG.args = {
|
|
84
|
+
size: 'lg',
|
|
85
|
+
};
|
|
@@ -2,14 +2,85 @@
|
|
|
2
2
|
<div class="relative">
|
|
3
3
|
<div class="absolute bottom-0 left-0 h-px w-full bg-slate-300" />
|
|
4
4
|
<div
|
|
5
|
-
|
|
5
|
+
ref="scrollable"
|
|
6
|
+
class="scrollable relative overflow-x-auto overflow-y-hidden"
|
|
6
7
|
data-scroll-lock-scrollable
|
|
7
8
|
>
|
|
8
|
-
<ul class="flex
|
|
9
|
+
<ul class="flex text-center" :class="[sizeClass]">
|
|
9
10
|
<slot />
|
|
10
11
|
</ul>
|
|
11
12
|
</div>
|
|
12
13
|
</div>
|
|
13
14
|
</template>
|
|
14
15
|
|
|
15
|
-
<script lang="ts" setup
|
|
16
|
+
<script lang="ts" setup>
|
|
17
|
+
const props = withDefaults(
|
|
18
|
+
defineProps<{
|
|
19
|
+
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
20
|
+
}>(),
|
|
21
|
+
{
|
|
22
|
+
size: 'md',
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const route = useRoute();
|
|
27
|
+
const scrollable = ref<HTMLElement | null>(null);
|
|
28
|
+
|
|
29
|
+
watch(
|
|
30
|
+
() => route.fullPath,
|
|
31
|
+
() => {
|
|
32
|
+
nextTick(() => {
|
|
33
|
+
scrollToCenter();
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
provide(
|
|
39
|
+
'tabs:size',
|
|
40
|
+
computed(() => props.size)
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const sizeClass = computed(() => {
|
|
44
|
+
switch (props.size) {
|
|
45
|
+
case 'xs':
|
|
46
|
+
return 'space-x-1.5';
|
|
47
|
+
case 'sm':
|
|
48
|
+
return 'space-x-3';
|
|
49
|
+
case 'md':
|
|
50
|
+
return 'space-x-3';
|
|
51
|
+
case 'lg':
|
|
52
|
+
return 'space-x-6';
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
function scrollToCenter() {
|
|
57
|
+
if (!scrollable.value) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const activeTab = scrollable.value.querySelector(
|
|
62
|
+
'.active'
|
|
63
|
+
) as HTMLElement | null;
|
|
64
|
+
|
|
65
|
+
if (!activeTab) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const scrollableRect = scrollable.value.getBoundingClientRect();
|
|
70
|
+
const activeTabRect = activeTab.getBoundingClientRect();
|
|
71
|
+
|
|
72
|
+
const scrollLeft =
|
|
73
|
+
activeTab.offsetLeft - (scrollableRect.width - activeTabRect.width) / 2;
|
|
74
|
+
|
|
75
|
+
scrollable.value.scrollTo({
|
|
76
|
+
left: scrollLeft,
|
|
77
|
+
behavior: 'smooth',
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
</script>
|
|
81
|
+
|
|
82
|
+
<style scoped>
|
|
83
|
+
.scrollable::-webkit-scrollbar {
|
|
84
|
+
display: none;
|
|
85
|
+
}
|
|
86
|
+
</style>
|