@usssa/component-library 1.0.0-alpha.113 → 1.0.0-alpha.115
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/package.json +1 -1
- package/src/components/core/UAvatar.vue +36 -37
- package/src/components/core/UAvatarGroup.vue +61 -52
- package/src/components/core/UBadgeStd.vue +6 -1
- package/src/components/core/UBannerStd.vue +5 -0
- package/src/components/core/UBtnStd.vue +18 -13
- package/src/components/core/UBtnToggle.vue +11 -6
- package/src/components/core/UChip.vue +12 -6
package/package.json
CHANGED
|
@@ -3,21 +3,22 @@ import { computed } from 'vue'
|
|
|
3
3
|
import UBadgeStd from './UBadgeStd.vue'
|
|
4
4
|
import UTooltip from './UTooltip.vue'
|
|
5
5
|
|
|
6
|
+
const emit = defineEmits(['onClick'])
|
|
6
7
|
const props = defineProps({
|
|
8
|
+
bgColor: {
|
|
9
|
+
type: String,
|
|
10
|
+
},
|
|
7
11
|
color: {
|
|
8
12
|
type: String,
|
|
9
13
|
default: 'primary',
|
|
10
14
|
},
|
|
11
|
-
|
|
15
|
+
dataTestId: {
|
|
12
16
|
type: String,
|
|
17
|
+
default: 'avatar',
|
|
13
18
|
},
|
|
14
19
|
icon: {
|
|
15
20
|
type: String,
|
|
16
21
|
},
|
|
17
|
-
size: {
|
|
18
|
-
type: String,
|
|
19
|
-
default: 'xl',
|
|
20
|
-
},
|
|
21
22
|
image: {
|
|
22
23
|
type: String,
|
|
23
24
|
},
|
|
@@ -29,28 +30,38 @@ const props = defineProps({
|
|
|
29
30
|
type: String,
|
|
30
31
|
required: true,
|
|
31
32
|
},
|
|
32
|
-
showIndicator: {
|
|
33
|
-
type: Boolean,
|
|
34
|
-
default: false,
|
|
35
|
-
},
|
|
36
|
-
icon: {
|
|
37
|
-
type: String,
|
|
38
|
-
},
|
|
39
33
|
round: {
|
|
40
34
|
type: Boolean,
|
|
41
35
|
default: true,
|
|
42
36
|
},
|
|
37
|
+
showIndicator: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: false,
|
|
40
|
+
},
|
|
43
41
|
showTooltip: {
|
|
44
42
|
type: Boolean,
|
|
45
43
|
default: false,
|
|
46
44
|
},
|
|
45
|
+
size: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: 'xl',
|
|
48
|
+
},
|
|
47
49
|
})
|
|
48
50
|
|
|
49
|
-
|
|
51
|
+
// computed
|
|
52
|
+
const initials = computed(() => {
|
|
53
|
+
if (props.name) {
|
|
54
|
+
const name = props.name.replace(/\s+/g, ' ')
|
|
55
|
+
const parts = name.split(' ')
|
|
50
56
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
57
|
+
if (parts.length === 1) return parts[0].substring(0, 2).toUpperCase()
|
|
58
|
+
|
|
59
|
+
return `${parts[0].substring(0, 1).toUpperCase()}${parts[parts.length - 1]
|
|
60
|
+
.substring(0, 1)
|
|
61
|
+
.toUpperCase()}`
|
|
62
|
+
}
|
|
63
|
+
return props?.name
|
|
64
|
+
})
|
|
54
65
|
|
|
55
66
|
const labelSize = computed(() => {
|
|
56
67
|
if (props.size === 'sm') {
|
|
@@ -69,27 +80,19 @@ const labelSize = computed(() => {
|
|
|
69
80
|
return props.size
|
|
70
81
|
})
|
|
71
82
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (parts.length === 1) return parts[0].substring(0, 2).toUpperCase()
|
|
78
|
-
|
|
79
|
-
return `${parts[0].substring(0, 1).toUpperCase()}${parts[parts.length - 1]
|
|
80
|
-
.substring(0, 1)
|
|
81
|
-
.toUpperCase()}`
|
|
82
|
-
}
|
|
83
|
-
return props?.name
|
|
84
|
-
})
|
|
83
|
+
// custom functions
|
|
84
|
+
const handleClick = () => {
|
|
85
|
+
return emit('onClick')
|
|
86
|
+
}
|
|
85
87
|
</script>
|
|
86
88
|
|
|
87
89
|
<template>
|
|
88
90
|
<q-avatar
|
|
89
91
|
v-bind="$attrs"
|
|
90
|
-
class="u-avatar"
|
|
91
|
-
:
|
|
92
|
+
:class="`u-avatar size-${size}`"
|
|
93
|
+
:aria-label="name"
|
|
92
94
|
:color="bgColor"
|
|
95
|
+
:dataTestId="dataTestId"
|
|
93
96
|
:icon="icon"
|
|
94
97
|
:round="round"
|
|
95
98
|
:rounded="!round"
|
|
@@ -103,12 +106,8 @@ const initials = computed(() => {
|
|
|
103
106
|
self="top middle"
|
|
104
107
|
>
|
|
105
108
|
</UTooltip>
|
|
106
|
-
<img v-if="image" :alt="`avatar ${name}`" :aria-label="name" :src="image"/>
|
|
107
|
-
<span
|
|
108
|
-
v-if="!image"
|
|
109
|
-
class="name"
|
|
110
|
-
:class="`text-${color} text-caption-${labelSize}`"
|
|
111
|
-
>
|
|
109
|
+
<img v-if="image" :alt="`avatar ${name}`" :aria-label="name" :src="image" />
|
|
110
|
+
<span v-if="!image" :class="`name text-${color} text-caption-${labelSize}`">
|
|
112
111
|
{{ initials }}
|
|
113
112
|
</span>
|
|
114
113
|
<UBadgeStd
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from 'vue'
|
|
3
|
-
import UTooltip from './UTooltip.vue'
|
|
4
3
|
import UAvatar from './UAvatar.vue'
|
|
4
|
+
import UTooltip from './UTooltip.vue'
|
|
5
|
+
|
|
6
|
+
const emit = defineEmits(['onClick'])
|
|
5
7
|
const props = defineProps({
|
|
8
|
+
avatarLimit: {
|
|
9
|
+
type: Number,
|
|
10
|
+
default: 4,
|
|
11
|
+
},
|
|
6
12
|
color: {
|
|
7
13
|
type: String,
|
|
8
14
|
default: 'primary',
|
|
9
15
|
},
|
|
10
|
-
|
|
16
|
+
dataTestId: {
|
|
11
17
|
type: String,
|
|
18
|
+
default: 'avatar-group',
|
|
12
19
|
},
|
|
13
|
-
|
|
20
|
+
icon: {
|
|
14
21
|
type: String,
|
|
15
22
|
},
|
|
16
23
|
image: {
|
|
@@ -23,74 +30,76 @@ const props = defineProps({
|
|
|
23
30
|
type: String,
|
|
24
31
|
default: 'neutral-4',
|
|
25
32
|
},
|
|
26
|
-
|
|
33
|
+
round: {
|
|
27
34
|
type: Boolean,
|
|
28
35
|
default: false,
|
|
29
36
|
},
|
|
30
|
-
|
|
37
|
+
showEachTooltip: {
|
|
31
38
|
type: Boolean,
|
|
32
39
|
default: true,
|
|
33
40
|
},
|
|
34
|
-
|
|
35
|
-
type: Number,
|
|
36
|
-
default: 4,
|
|
37
|
-
},
|
|
38
|
-
showEachTooltip: {
|
|
41
|
+
showIndicator: {
|
|
39
42
|
type: Boolean,
|
|
40
|
-
default:
|
|
41
|
-
}
|
|
43
|
+
default: false,
|
|
44
|
+
},
|
|
45
|
+
size: {
|
|
46
|
+
type: String,
|
|
47
|
+
},
|
|
42
48
|
})
|
|
43
49
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const handleClick = () => {
|
|
47
|
-
return emit('onClick')
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
+
// computed properties
|
|
50
51
|
const displayedAvatars = computed(() => {
|
|
51
52
|
return props.images.slice(0, props.avatarLimit)
|
|
52
53
|
})
|
|
53
54
|
const remainingAvatars = computed(() => {
|
|
54
55
|
return props.images.slice(props.avatarLimit)
|
|
55
56
|
})
|
|
57
|
+
|
|
58
|
+
//custom functions
|
|
59
|
+
const handleClick = () => {
|
|
60
|
+
return emit('onClick')
|
|
61
|
+
}
|
|
56
62
|
</script>
|
|
57
63
|
|
|
58
64
|
<template>
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
anchor="bottom middle"
|
|
81
|
-
description=""
|
|
82
|
-
:offset="[4, 4]"
|
|
83
|
-
self="top middle"
|
|
65
|
+
<div :dataTestId="dataTestId">
|
|
66
|
+
<UAvatar
|
|
67
|
+
v-for="(avatar, index) in displayedAvatars"
|
|
68
|
+
class="avatarGroup"
|
|
69
|
+
:aria-label="avatar.name"
|
|
70
|
+
:image="avatar.image"
|
|
71
|
+
:indicatorColor="indicatorColor"
|
|
72
|
+
:key="index"
|
|
73
|
+
:name="avatar.name"
|
|
74
|
+
:round="round"
|
|
75
|
+
:showIndicator="showIndicator"
|
|
76
|
+
:showTooltip="showEachTooltip"
|
|
77
|
+
:size="size"
|
|
78
|
+
tabindex="0"
|
|
79
|
+
@click="handleClick"
|
|
80
|
+
/>
|
|
81
|
+
<q-icon
|
|
82
|
+
v-if="remainingAvatars.length"
|
|
83
|
+
:class="`avatarGroup additonalUsersAvatar size-${size} fa-duotone fa-solid fa-circle-plus`"
|
|
84
|
+
aria-label="See more Avatar"
|
|
85
|
+
color="primary"
|
|
84
86
|
>
|
|
85
|
-
<
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
87
|
+
<UTooltip
|
|
88
|
+
anchor="bottom middle"
|
|
89
|
+
description=""
|
|
90
|
+
:offset="[4, 4]"
|
|
91
|
+
self="top middle"
|
|
92
|
+
>
|
|
93
|
+
<template v-slot:item>
|
|
94
|
+
<div class="text-body-xs tooltip-text">
|
|
95
|
+
<span v-for="(avatar, index) in remainingAvatars" :key="index">
|
|
96
|
+
{{ avatar.name }}<br />
|
|
97
|
+
</span>
|
|
98
|
+
</div>
|
|
99
|
+
</template>
|
|
100
|
+
</UTooltip>
|
|
101
|
+
</q-icon>
|
|
102
|
+
</div>
|
|
94
103
|
</template>
|
|
95
104
|
<style lang="sass">
|
|
96
105
|
.additonalUsersAvatar:after
|
|
@@ -6,6 +6,10 @@ const props = defineProps({
|
|
|
6
6
|
type: String,
|
|
7
7
|
default: 'primary',
|
|
8
8
|
},
|
|
9
|
+
dataTestId: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: 'badge-std'
|
|
12
|
+
},
|
|
9
13
|
label: {
|
|
10
14
|
type: String,
|
|
11
15
|
default: '',
|
|
@@ -42,10 +46,11 @@ const currentColor = computed(() => {
|
|
|
42
46
|
: `text-overline-sm`
|
|
43
47
|
: '',
|
|
44
48
|
]"
|
|
49
|
+
:aria-label="label"
|
|
45
50
|
:color="currentColor"
|
|
51
|
+
:dataTestId="dataTestId"
|
|
46
52
|
rounded
|
|
47
53
|
tabindex="0"
|
|
48
|
-
:aria-label="label"
|
|
49
54
|
>
|
|
50
55
|
<div v-if="type === 'basic'">
|
|
51
56
|
{{ label }}
|
|
@@ -5,6 +5,10 @@ import UBtnStd from './UBtnStd.vue'
|
|
|
5
5
|
const emit = defineEmits(['primaryAction', 'secondaryAction'])
|
|
6
6
|
|
|
7
7
|
const props = defineProps({
|
|
8
|
+
dataTestId:{
|
|
9
|
+
type: String,
|
|
10
|
+
default: 'banner-std',
|
|
11
|
+
},
|
|
8
12
|
icon: {
|
|
9
13
|
type: String,
|
|
10
14
|
default: 'fa-kit-duotone fa-circle-info',
|
|
@@ -57,6 +61,7 @@ const handleSecondaryActionClick = () => {
|
|
|
57
61
|
:class="`u-banner u-banner-${type} ${
|
|
58
62
|
!icon ? 'no-padding-label' : ''
|
|
59
63
|
} ${bordered}`"
|
|
64
|
+
:dataTestId="dataTestId"
|
|
60
65
|
inline-actions
|
|
61
66
|
tabindex="0"
|
|
62
67
|
>
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from 'vue'
|
|
3
3
|
|
|
4
|
+
const emit = defineEmits(['onClick'])
|
|
5
|
+
|
|
4
6
|
const props = defineProps({
|
|
5
7
|
color: {
|
|
6
8
|
type: String,
|
|
7
9
|
default: 'neutral-7',
|
|
8
10
|
},
|
|
11
|
+
dataTestId: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: 'button-std'
|
|
14
|
+
},
|
|
9
15
|
disable: {
|
|
10
16
|
type: Boolean,
|
|
11
17
|
default: false,
|
|
@@ -14,6 +20,10 @@ const props = defineProps({
|
|
|
14
20
|
type: Boolean,
|
|
15
21
|
default: false,
|
|
16
22
|
},
|
|
23
|
+
fullWidth: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: false,
|
|
26
|
+
},
|
|
17
27
|
label: {
|
|
18
28
|
type: String,
|
|
19
29
|
default: 'Button',
|
|
@@ -21,26 +31,20 @@ const props = defineProps({
|
|
|
21
31
|
leftIcon: {
|
|
22
32
|
type: String,
|
|
23
33
|
},
|
|
24
|
-
rightIcon: {
|
|
25
|
-
type: String,
|
|
26
|
-
},
|
|
27
34
|
outline: {
|
|
28
35
|
type: Boolean,
|
|
29
36
|
default: false,
|
|
30
37
|
},
|
|
38
|
+
rightIcon: {
|
|
39
|
+
type: String,
|
|
40
|
+
},
|
|
31
41
|
size: {
|
|
32
42
|
type: String,
|
|
33
43
|
default: 'md',
|
|
34
44
|
validator: (val) => ['sm', 'md', 'lg'].includes(val),
|
|
35
45
|
},
|
|
36
|
-
fullWidth: {
|
|
37
|
-
type: Boolean,
|
|
38
|
-
default: false,
|
|
39
|
-
},
|
|
40
46
|
})
|
|
41
47
|
|
|
42
|
-
const emit = defineEmits(['onClick'])
|
|
43
|
-
|
|
44
48
|
const handleClick = () => {
|
|
45
49
|
return emit('onClick')
|
|
46
50
|
}
|
|
@@ -65,11 +69,12 @@ const isFullWidth = computed(() => {
|
|
|
65
69
|
class="u-btn q-py-none"
|
|
66
70
|
:class="`size-${size} ${textClass} focus-${color} ${isFullWidth}`"
|
|
67
71
|
:color="color"
|
|
72
|
+
:dataTestId="dataTestId"
|
|
68
73
|
:disable="disable"
|
|
74
|
+
:flat="flat"
|
|
75
|
+
no-caps
|
|
69
76
|
:unelevated="!outline"
|
|
70
77
|
:outline="outline"
|
|
71
|
-
no-caps
|
|
72
|
-
:flat="flat"
|
|
73
78
|
@click="handleClick"
|
|
74
79
|
>
|
|
75
80
|
<template #default>
|
|
@@ -77,9 +82,9 @@ const isFullWidth = computed(() => {
|
|
|
77
82
|
<div class="row items-center no-wrap">
|
|
78
83
|
<q-icon
|
|
79
84
|
v-if="leftIcon"
|
|
80
|
-
left
|
|
81
85
|
:class="leftIcon"
|
|
82
86
|
class="q-mr-xs"
|
|
87
|
+
left
|
|
83
88
|
size="1rem"
|
|
84
89
|
/>
|
|
85
90
|
|
|
@@ -88,9 +93,9 @@ const isFullWidth = computed(() => {
|
|
|
88
93
|
</div>
|
|
89
94
|
<q-icon
|
|
90
95
|
v-if="rightIcon"
|
|
91
|
-
right
|
|
92
96
|
:class="rightIcon"
|
|
93
97
|
class="q-ml-xs"
|
|
98
|
+
right
|
|
94
99
|
size="1rem"
|
|
95
100
|
/>
|
|
96
101
|
</div>
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
const props = defineProps({
|
|
3
|
+
dataTestId: {
|
|
4
|
+
type: String,
|
|
5
|
+
default: 'toggle-btn',
|
|
6
|
+
},
|
|
3
7
|
options: {
|
|
4
8
|
type: Array,
|
|
5
9
|
require: true,
|
|
@@ -10,16 +14,17 @@ const model = defineModel()
|
|
|
10
14
|
|
|
11
15
|
<template>
|
|
12
16
|
<q-btn-toggle
|
|
13
|
-
class="u-btn-toggle"
|
|
14
17
|
v-model="model"
|
|
15
|
-
|
|
16
|
-
text-color="dark"
|
|
17
|
-
unelevated
|
|
18
|
+
class="u-btn-toggle"
|
|
18
19
|
color="white"
|
|
20
|
+
:dataTestId="dataTestId"
|
|
19
21
|
no-caps
|
|
22
|
+
:options="options"
|
|
23
|
+
size="md"
|
|
20
24
|
spread
|
|
25
|
+
text-color="dark"
|
|
21
26
|
toggle-color="primary"
|
|
22
|
-
|
|
27
|
+
unelevated
|
|
23
28
|
>
|
|
24
29
|
<template
|
|
25
30
|
v-for="(option, index) in options"
|
|
@@ -28,8 +33,8 @@ const model = defineModel()
|
|
|
28
33
|
>
|
|
29
34
|
<div class="row items-center no-wrap slot">
|
|
30
35
|
<q-icon
|
|
31
|
-
:class="options[index].iconClass"
|
|
32
36
|
v-if="options[index].iconClass"
|
|
37
|
+
:class="options[index].iconClass"
|
|
33
38
|
/>
|
|
34
39
|
<div class="text-center text-caption-md">
|
|
35
40
|
{{ options[index].name }}
|
|
@@ -16,6 +16,10 @@ const props = defineProps({
|
|
|
16
16
|
type: String,
|
|
17
17
|
default: 'Chip',
|
|
18
18
|
},
|
|
19
|
+
dataTestId: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: 'u-chip'
|
|
22
|
+
},
|
|
19
23
|
dense: {
|
|
20
24
|
type: Boolean,
|
|
21
25
|
default: false,
|
|
@@ -51,12 +55,6 @@ const props = defineProps({
|
|
|
51
55
|
},
|
|
52
56
|
})
|
|
53
57
|
|
|
54
|
-
const size = computed(() => {
|
|
55
|
-
if (props.dense) {
|
|
56
|
-
return 'xs'
|
|
57
|
-
}
|
|
58
|
-
return 'sm'
|
|
59
|
-
})
|
|
60
58
|
const avatarLabel = computed(() => {
|
|
61
59
|
if (props.avatarLabel && props.avatarLabel.length > 2) {
|
|
62
60
|
return props.avatarLabel.substring(0, 2)
|
|
@@ -64,6 +62,13 @@ const avatarLabel = computed(() => {
|
|
|
64
62
|
return props.avatarLabel
|
|
65
63
|
})
|
|
66
64
|
|
|
65
|
+
const size = computed(() => {
|
|
66
|
+
if (props.dense) {
|
|
67
|
+
return 'xs'
|
|
68
|
+
}
|
|
69
|
+
return 'sm'
|
|
70
|
+
})
|
|
71
|
+
|
|
67
72
|
const handleClick = () => {
|
|
68
73
|
return emit('onClick')
|
|
69
74
|
}
|
|
@@ -76,6 +81,7 @@ const handleClick = () => {
|
|
|
76
81
|
class="u-chip q-px-xs"
|
|
77
82
|
:class="type"
|
|
78
83
|
:aria-label="chipLabel"
|
|
84
|
+
:dataTestId="dataTestId"
|
|
79
85
|
:dense="dense"
|
|
80
86
|
:modelValue="modelValue"
|
|
81
87
|
:removable="removable"
|