@usssa/component-library 1.0.0-alpha.114 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usssa/component-library",
3
- "version": "1.0.0-alpha.114",
3
+ "version": "1.0.0-alpha.115",
4
4
  "description": "A Quasar component library project",
5
5
  "productName": "Quasar component library App",
6
6
  "author": "Troy Moreland <troy.moreland@usssa.com>",
@@ -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
- bgColor: {
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
- const emit = defineEmits(['onClick'])
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
- const handleClick = () => {
52
- return emit('onClick')
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
- const initials = computed(() => {
73
- if (props.name) {
74
- const name = props.name.replace(/\s+/g, ' ')
75
- const parts = name.split(' ')
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
- :class="`size-${size}`"
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
- icon: {
16
+ dataTestId: {
11
17
  type: String,
18
+ default: 'avatar-group',
12
19
  },
13
- size: {
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
- showIndicator: {
33
+ round: {
27
34
  type: Boolean,
28
35
  default: false,
29
36
  },
30
- round: {
37
+ showEachTooltip: {
31
38
  type: Boolean,
32
39
  default: true,
33
40
  },
34
- avatarLimit: {
35
- type: Number,
36
- default: 4,
37
- },
38
- showEachTooltip: {
41
+ showIndicator: {
39
42
  type: Boolean,
40
- default: true
41
- }
43
+ default: false,
44
+ },
45
+ size: {
46
+ type: String,
47
+ },
42
48
  })
43
49
 
44
- const emit = defineEmits(['onClick'])
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
- <UAvatar
60
- v-for="(avatar, index) in displayedAvatars"
61
- class="avatarGroup"
62
- :image="avatar.image"
63
- :indicatorColor="indicatorColor"
64
- :key="index"
65
- :name="avatar.name"
66
- :round="round"
67
- :showIndicator="showIndicator"
68
- :showTooltip="showEachTooltip"
69
- :size="size"
70
- tabindex="0"
71
- @click="handleClick"
72
- />
73
- <q-icon
74
- v-if="remainingAvatars.length"
75
- :class="`avatarGroup additonalUsersAvatar size-${size} fa-duotone fa-solid fa-circle-plus`"
76
- aria-label="See more Avatar"
77
- color="primary"
78
- >
79
- <UTooltip
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
- <template v-slot:item>
86
- <div class="text-body-xs tooltip-text">
87
- <span v-for="(avatar, index) in remainingAvatars" :key="index">
88
- {{ avatar.name }}<br />
89
- </span>
90
- </div>
91
- </template>
92
- </UTooltip>
93
- </q-icon>
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
  >
@@ -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"