@redseed/redseed-ui-vue3 8.24.0 → 8.25.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/index.js
CHANGED
|
@@ -39,6 +39,7 @@ export * from './src/components/Skeleton'
|
|
|
39
39
|
export * from './src/components/Social'
|
|
40
40
|
export * from './src/components/Sorting'
|
|
41
41
|
export * from './src/components/Switcher'
|
|
42
|
+
export * from './src/components/TabSlider'
|
|
42
43
|
export * from './src/components/Table'
|
|
43
44
|
export * from './src/components/Toggle'
|
|
44
45
|
export * from './src/components/Tooltip'
|
package/package.json
CHANGED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import Icon from '../Icon/Icon.vue'
|
|
4
|
+
import TabSliderItem from './TabSliderItem.vue'
|
|
5
|
+
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
items: {
|
|
8
|
+
type: Array,
|
|
9
|
+
required: true,
|
|
10
|
+
},
|
|
11
|
+
full: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: false,
|
|
14
|
+
},
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const emit = defineEmits(['change'])
|
|
18
|
+
|
|
19
|
+
const activeItem = ref(props.items.find(item => item.active) || props.items[0])
|
|
20
|
+
|
|
21
|
+
function setActiveItem(item) {
|
|
22
|
+
if (activeItem.value == item) return
|
|
23
|
+
activeItem.value = item
|
|
24
|
+
emit('change', item)
|
|
25
|
+
}
|
|
26
|
+
</script>
|
|
27
|
+
<template>
|
|
28
|
+
<div class="rsui-tab-slider"
|
|
29
|
+
:class="{
|
|
30
|
+
'rsui-tab-slider--full': props.full,
|
|
31
|
+
}"
|
|
32
|
+
>
|
|
33
|
+
<TabSliderItem v-for="item in items"
|
|
34
|
+
:key="item.id"
|
|
35
|
+
:active="activeItem.id == item.id"
|
|
36
|
+
:disabled="item.disabled"
|
|
37
|
+
@click="setActiveItem(item)"
|
|
38
|
+
>
|
|
39
|
+
<Icon v-if="item.icon">
|
|
40
|
+
<component :is="item.icon"></component>
|
|
41
|
+
</Icon>
|
|
42
|
+
|
|
43
|
+
{{ item.label }}
|
|
44
|
+
|
|
45
|
+
<template #badge v-if="item.badge && item.badgeText">
|
|
46
|
+
<component :is="item.badge">
|
|
47
|
+
{{ item.badgeText }}
|
|
48
|
+
</component>
|
|
49
|
+
</template>
|
|
50
|
+
</TabSliderItem>
|
|
51
|
+
</div>
|
|
52
|
+
</template>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
const props = defineProps({
|
|
3
|
+
active: {
|
|
4
|
+
type: Boolean,
|
|
5
|
+
default: false,
|
|
6
|
+
},
|
|
7
|
+
disabled: {
|
|
8
|
+
type: Boolean,
|
|
9
|
+
default: false,
|
|
10
|
+
},
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
const emit = defineEmits(['click'])
|
|
14
|
+
|
|
15
|
+
function handleClick() {
|
|
16
|
+
if (props.disabled) return
|
|
17
|
+
|
|
18
|
+
emit('click')
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
<template>
|
|
22
|
+
<div class="rsui-tab-slider-item"
|
|
23
|
+
:class="{
|
|
24
|
+
'rsui-tab-slider-item--active': props.active && !props.disabled,
|
|
25
|
+
'rsui-tab-slider-item--disabled': props.disabled,
|
|
26
|
+
}"
|
|
27
|
+
@click="handleClick"
|
|
28
|
+
>
|
|
29
|
+
<slot></slot>
|
|
30
|
+
<div v-if="$slots.badge" class="rsui-tab-slider-item__badge">
|
|
31
|
+
<slot name="badge"></slot>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|