@v1nt1248/3nclient-lib 0.0.31 → 0.0.33
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/README.md +1 -0
- package/dist/components/index.d.ts +3 -1
- package/dist/components/ui3n-badge-simple.vue.d.ts +47 -0
- package/dist/components/ui3n-badge.vue.d.ts +48 -0
- package/dist/components/ui3n-button.vue.d.ts +1 -1
- package/dist/components/ui3n-chip.vue.d.ts +1 -1
- package/dist/components/ui3n-list.vue.d.ts +3 -3
- package/dist/index.d.ts +2 -0
- package/dist/stories/Ui3nBadge.stories.d.ts +160 -0
- package/dist/stories/Ui3nButton.stories.d.ts +6 -6
- package/dist/stories/Ui3nChip.stories.d.ts +465 -13
- package/dist/stories/Ui3nList.stories.d.ts +3 -3
- package/dist/style.css +1 -1
- package/dist/ui-3n-lib.js +7145 -6762
- package/package.json +1 -1
- package/src/components/index.ts +4 -0
- package/src/components/ui3n-badge-simple.vue +97 -0
- package/src/components/ui3n-badge.vue +89 -0
- package/src/components/ui3n-chip.vue +1 -0
package/package.json
CHANGED
package/src/components/index.ts
CHANGED
|
@@ -29,6 +29,8 @@ import Ui3nVirtualScroll from './ui3n-virtual-scroll.vue'
|
|
|
29
29
|
import type { Ui3nVirtualScrollProps, Ui3nVirtualScrollSlots } from './ui3n-virtual-scroll.vue'
|
|
30
30
|
import Ui3nTabs from './ui3n-tabs.vue'
|
|
31
31
|
import type { Ui3nTabsProps, Ui3nTabsEmits, Ui3nTabsSlots } from './ui3n-tabs.vue'
|
|
32
|
+
import Ui3nBadge from './ui3n-badge.vue'
|
|
33
|
+
import type { Ui3nBadgeProps } from './ui3n-badge.vue'
|
|
32
34
|
|
|
33
35
|
export {
|
|
34
36
|
Ui3nIcon,
|
|
@@ -83,4 +85,6 @@ export {
|
|
|
83
85
|
Ui3nTabsProps,
|
|
84
86
|
Ui3nTabsEmits,
|
|
85
87
|
Ui3nTabsSlots,
|
|
88
|
+
Ui3nBadge,
|
|
89
|
+
Ui3nBadgeProps,
|
|
86
90
|
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { nextTick, onMounted, ref, watch } from 'vue'
|
|
3
|
+
|
|
4
|
+
export interface Ui3nBadgeSimpleProps {
|
|
5
|
+
dot?: boolean;
|
|
6
|
+
value?: string | number;
|
|
7
|
+
color?: string;
|
|
8
|
+
textColor?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const props = withDefaults(
|
|
12
|
+
defineProps<Ui3nBadgeSimpleProps>(),
|
|
13
|
+
{
|
|
14
|
+
dot: false,
|
|
15
|
+
value: '',
|
|
16
|
+
color: '#0090ec',
|
|
17
|
+
textColor: '#fff',
|
|
18
|
+
},
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
const emits = defineEmits<{
|
|
22
|
+
(ev: 'change:size', val: { width: number; height: number }): void;
|
|
23
|
+
}>()
|
|
24
|
+
|
|
25
|
+
const element = ref<HTMLDivElement | null>(null)
|
|
26
|
+
|
|
27
|
+
watch(
|
|
28
|
+
() => [props.value, props.dot],
|
|
29
|
+
() => getElementSize(),
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
onMounted(() => {
|
|
33
|
+
getElementSize()
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
function getElementSize() {
|
|
37
|
+
nextTick(() => {
|
|
38
|
+
if (element.value) {
|
|
39
|
+
emits('change:size', { width: element.value.offsetWidth, height: element.value.offsetHeight })
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<template>
|
|
46
|
+
<div
|
|
47
|
+
ref="element"
|
|
48
|
+
:class="[
|
|
49
|
+
'ui3n-badge-simple',
|
|
50
|
+
{ 'ui3n-badge-simple__dot': dot },
|
|
51
|
+
]"
|
|
52
|
+
>
|
|
53
|
+
<span
|
|
54
|
+
v-if="!dot"
|
|
55
|
+
class="ui3n-badge-simple__text"
|
|
56
|
+
>
|
|
57
|
+
{{ value }}
|
|
58
|
+
</span>
|
|
59
|
+
</div>
|
|
60
|
+
</template>
|
|
61
|
+
|
|
62
|
+
<style lang="scss" scoped>
|
|
63
|
+
.ui3n-badge-simple{
|
|
64
|
+
--ui3n-badge-size: 20px;
|
|
65
|
+
|
|
66
|
+
position: relative;
|
|
67
|
+
box-sizing: border-box;
|
|
68
|
+
background-color: v-bind(color);
|
|
69
|
+
outline: 1px var(--system-white, #fff) solid;
|
|
70
|
+
|
|
71
|
+
&__dot {
|
|
72
|
+
min-width: 8px;
|
|
73
|
+
width: 8px;
|
|
74
|
+
max-width: 8px;
|
|
75
|
+
min-height: 8px;
|
|
76
|
+
height: 8px;
|
|
77
|
+
max-height: 8px;
|
|
78
|
+
border-radius: 50%;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&__text {
|
|
82
|
+
display: block;
|
|
83
|
+
color: v-bind(textColor);
|
|
84
|
+
font-size: 12px;
|
|
85
|
+
line-height: var(--ui3n-badge-size);
|
|
86
|
+
text-align: center;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&:not(.ui3n-badge-simple__dot) {
|
|
90
|
+
min-height: var(--ui3n-badge-size);
|
|
91
|
+
height: var(--ui3n-badge-size);
|
|
92
|
+
width: max-content;
|
|
93
|
+
padding: 0 6px;
|
|
94
|
+
border-radius: 10px;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
</style>
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed, ref, useSlots } from 'vue'
|
|
3
|
+
import get from 'lodash/get'
|
|
4
|
+
import Ui3nBadgeSimple from './ui3n-badge-simple.vue'
|
|
5
|
+
|
|
6
|
+
export interface Ui3nBadgeProps {
|
|
7
|
+
dot?: boolean;
|
|
8
|
+
value?: string | number;
|
|
9
|
+
color?: string;
|
|
10
|
+
textColor?: string;
|
|
11
|
+
position?: 'right-top' | 'right-bottom' | 'left-top' | 'left-bottom';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const props = withDefaults(
|
|
15
|
+
defineProps<Ui3nBadgeProps>(),
|
|
16
|
+
{
|
|
17
|
+
dot: false,
|
|
18
|
+
value: '',
|
|
19
|
+
color: '#0090ec',
|
|
20
|
+
textColor: '#fff',
|
|
21
|
+
position: 'right-top',
|
|
22
|
+
},
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
const slots = useSlots()
|
|
26
|
+
const badgeElementSize = ref<{
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
29
|
+
} | never>()
|
|
30
|
+
|
|
31
|
+
const hasDefaultSlot = computed(() => !!slots.default)
|
|
32
|
+
const style = computed(() => {
|
|
33
|
+
const [xPosition, yPosition] = props.position.split('-')
|
|
34
|
+
return {
|
|
35
|
+
...(xPosition === 'right' && { right: `-${get(badgeElementSize.value, 'width', 0) / 2}px` }),
|
|
36
|
+
...(xPosition === 'left' && { left: `-${get(badgeElementSize.value, 'width', 0) / 2}px` }),
|
|
37
|
+
...(yPosition === 'top' && { top: `-${get(badgeElementSize.value, 'height', 0) / 2}px` }),
|
|
38
|
+
...(yPosition === 'bottom' && { bottom: `-${get(badgeElementSize.value, 'height', 0) / 2}px` }),
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<template>
|
|
44
|
+
<!-- eslint-disable vue/no-multiple-template-root -->
|
|
45
|
+
<div
|
|
46
|
+
v-if="hasDefaultSlot"
|
|
47
|
+
class="ui3n-badge"
|
|
48
|
+
>
|
|
49
|
+
<div class="ui3n-badge__wrapper">
|
|
50
|
+
<slot />
|
|
51
|
+
|
|
52
|
+
<ui3n-badge-simple
|
|
53
|
+
:dot="dot"
|
|
54
|
+
:value="value"
|
|
55
|
+
:color="color"
|
|
56
|
+
:text-color="textColor"
|
|
57
|
+
:style="style"
|
|
58
|
+
class="ui3n-badge__content"
|
|
59
|
+
@change:size="badgeElementSize = $event"
|
|
60
|
+
/>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<ui3n-badge-simple
|
|
65
|
+
v-else
|
|
66
|
+
:dot="dot"
|
|
67
|
+
:value="value"
|
|
68
|
+
:color="color"
|
|
69
|
+
:text-color="textColor"
|
|
70
|
+
/>
|
|
71
|
+
</template>
|
|
72
|
+
|
|
73
|
+
<style lang="scss" scoped>
|
|
74
|
+
.ui3n-badge {
|
|
75
|
+
--ui3n-badge-size: 20px;
|
|
76
|
+
|
|
77
|
+
position: relative;
|
|
78
|
+
|
|
79
|
+
&__wrapper {
|
|
80
|
+
position: relative;
|
|
81
|
+
width: max-content;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&__content {
|
|
85
|
+
position: absolute;
|
|
86
|
+
z-index: 5;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
</style>
|