@usssa/component-library 1.0.0-alpha.41 → 1.0.0-alpha.43

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Component Library
2
2
 
3
- This library provides custom UI components for USSSA applications.
3
+ **This library provides custom UI components for USSSA applications.**
4
4
 
5
5
  ## Installation
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usssa/component-library",
3
- "version": "1.0.0-alpha.41",
3
+ "version": "1.0.0-alpha.43",
4
4
  "description": "A Quasar component library project",
5
5
  "productName": "Quasar component library App",
6
6
  "author": "Troy Moreland <troy.moreland@usssa.com>",
@@ -0,0 +1,52 @@
1
+ <script setup>
2
+ import UInputTextStd from './UInputTextStd.vue'
3
+
4
+ const props = defineProps({
5
+ label: {
6
+ type: String,
7
+ },
8
+ searchText: {
9
+ type: String,
10
+ },
11
+ size: {
12
+ type: String,
13
+ default: 'md',
14
+ validator: (val) => ['sm', 'md'].includes(val),
15
+ },
16
+ })
17
+
18
+ const emit = defineEmits(['updateInputVal'])
19
+
20
+ const updateInputVal = (event) => {
21
+ emit('updateInputVal', event)
22
+ }
23
+ </script>
24
+
25
+ <template>
26
+ <div :class="`input-search size-${size}`">
27
+ <UInputTextStd
28
+ v-bind="$attrs"
29
+ autocorrect="off"
30
+ autocapitalize="off"
31
+ autocomplete="off"
32
+ :aria-label="label"
33
+ :debounce="1500"
34
+ :label="label"
35
+ :modelValue="searchText"
36
+ ref="searchInputRef"
37
+ spellcheck="false"
38
+ @update:modelValue="updateInputVal($event)"
39
+ />
40
+ <slot name="menu"></slot>
41
+ </div>
42
+ </template>
43
+
44
+ <style lang="sass">
45
+ .input-search
46
+ display: flex
47
+ flex-direction: column
48
+ &.size-sm
49
+ width: 24.5625rem
50
+ &.size-md
51
+ width: 26.5rem
52
+ </style>
@@ -13,7 +13,6 @@ const props = defineProps({
13
13
  size: {
14
14
  type: String,
15
15
  default: 'md',
16
- validator: (val) => ['sm', 'md'].includes(val),
17
16
  },
18
17
  searchType: {
19
18
  type: String,
@@ -0,0 +1,376 @@
1
+ <script setup>
2
+ import { computed, ref, watch } from 'vue'
3
+ import UAvatar from './UAvatar.vue'
4
+ import UBtnStd from './UBtnStd.vue'
5
+ import UInputTypeaheadAdvanceSearch from './UInputTypeaheadAdvanceSearch.vue'
6
+ import UMenuDropdownAdvancedSearch from './UMenuDropdownAdvancedSearch.vue'
7
+ import UTabBtnStd from './UTabBtnStd.vue'
8
+ import UTooltip from './UTooltip.vue'
9
+ import { parseInitials } from '../../utils/data'
10
+
11
+ const props = defineProps({
12
+ actionButtonLabel: {
13
+ type: String,
14
+ },
15
+ category: {
16
+ type: String,
17
+ },
18
+ exceedLimit: {
19
+ type: Boolean,
20
+ default: false,
21
+ },
22
+ fields: {
23
+ type: Array,
24
+ },
25
+ headerLabel: {
26
+ type: String,
27
+ default: 'I’m looking for',
28
+ },
29
+ labelIcon: {
30
+ type: String,
31
+ default: 'fa-kit-duotone fa-filter-search',
32
+ },
33
+ menuClass: {
34
+ type: String,
35
+ },
36
+ model: {
37
+ type: Object,
38
+ },
39
+ options: {
40
+ type: Array,
41
+ },
42
+ recentlySelected: {
43
+ type: Array,
44
+ },
45
+ showCustomMenu: {
46
+ type: Boolean,
47
+ default: false,
48
+ },
49
+ searchResults: {
50
+ type: Array,
51
+ },
52
+ searchText: {
53
+ type: String,
54
+ },
55
+ size: {
56
+ type: String,
57
+ default: 'md',
58
+ },
59
+ // Show/hide advanced search
60
+ showAdvancedSearch: {
61
+ type: Boolean,
62
+ default: true,
63
+ },
64
+ // Show/hide entity tabs in advanced search
65
+ showAdvancedSearchTabs: {
66
+ type: Boolean,
67
+ default: true,
68
+ },
69
+ // Show/hide recent searches
70
+ showRecentSelected: {
71
+ type: Boolean,
72
+ default: true,
73
+ },
74
+ //Advance search title
75
+ title: {
76
+ type: String,
77
+ default: 'Advanced search',
78
+ },
79
+ })
80
+
81
+ const emit = defineEmits([
82
+ 'onInvitePerson',
83
+ 'onItemActionClick',
84
+ 'updateTab',
85
+ 'updateModelVal',
86
+ 'updateCountry',
87
+ ])
88
+
89
+ const selectedTab = ref('')
90
+
91
+ const updateModelVal = (event, label) => {
92
+ emit('updateModelVal', event, label)
93
+ }
94
+
95
+ const updateCountry = (val, label) => {
96
+ emit('updateCountry', val, label)
97
+ }
98
+
99
+ const updateTab = (val) => {
100
+ selectedTab.value = val
101
+ emit('updateTab', val)
102
+ }
103
+
104
+ const onItemActionClick = (item) => {
105
+ emit('onItemActionClick', item)
106
+ }
107
+
108
+ const onInvitePerson = (item) => {
109
+ emit('onInvitePerson', item)
110
+ }
111
+ </script>
112
+
113
+ <template>
114
+ <q-menu
115
+ v-bind="$attrs"
116
+ aria-label="search menu"
117
+ class="u-search-option-menu"
118
+ no-focus
119
+ :offset="[0, 4]"
120
+ ref="searchMenuRef"
121
+ role="dialog"
122
+ tabindex="1"
123
+ >
124
+ <q-list :class="`u-typeahead-menu q-px-ba q-pt-ba size-${size}`">
125
+ <div class="q-pb-xs" v-if="showAdvancedSearchTabs">
126
+ <span class="text-overline-xs">{{ headerLabel }}</span>
127
+
128
+ <!-- Tab options -->
129
+
130
+ <div class="tabs-option">
131
+ <UTabBtnStd
132
+ v-model="selectedTab"
133
+ :buttonTabsOptions="options"
134
+ size="sm"
135
+ :standard="false"
136
+ @update:model-value="(val) => updateTab(val)"
137
+ />
138
+ </div>
139
+ </div>
140
+ <div class="q-mt-xs">
141
+ <!-- Menu dropdown -->
142
+ <UMenuDropdownAdvancedSearch
143
+ v-if="showAdvancedSearch"
144
+ :fields="fields"
145
+ :labelIcon="labelIcon"
146
+ :menuClass="menuClass"
147
+ :model="model"
148
+ size="auto"
149
+ :showCustomMenu="showCustomMenu"
150
+ :title="title"
151
+ @updateCountry="(event, label) => updateCountry(event, label)"
152
+ @updateModelVal="(event, label) => updateModelVal(event, label)"
153
+ >
154
+ <template #action_left_button>
155
+ <slot name="action_left_button"></slot>
156
+ </template>
157
+ <template #action_right_button>
158
+ <slot name="action_right_button"></slot>
159
+ </template>
160
+ </UMenuDropdownAdvancedSearch>
161
+
162
+ <!-- Search Result list -->
163
+
164
+ <q-list
165
+ v-if="
166
+ searchResults &&
167
+ searchResults.length &&
168
+ !exceedLimit &&
169
+ searchText.length
170
+ "
171
+ class="search-list q-mt-xs"
172
+ >
173
+ <span class="text-overline-xs">Search results</span>
174
+ <q-item-label caption>
175
+ <span class="text-caption-sm">
176
+ {{ category }}
177
+ </span>
178
+ </q-item-label>
179
+ <template v-for="(item, index) in searchResults" :key="index">
180
+ <q-item class="list-item" clickable>
181
+ <q-item-section side>
182
+ <UAvatar
183
+ v-if="item.profilePictureUrl"
184
+ :aria-label="item.name"
185
+ image="https://cdn.quasar.dev/img/boy-avatar.png"
186
+ :name="item.name"
187
+ size="md"
188
+ />
189
+ <UAvatar
190
+ v-else
191
+ :aria-label="item.name"
192
+ :name="parseInitials(item.name)"
193
+ :round="true"
194
+ size="md"
195
+ :showIndicator="false"
196
+ />
197
+ </q-item-section>
198
+
199
+ <q-item-section>
200
+ <q-item-label class="text-caption-md label">
201
+ {{ item?.name }}
202
+ </q-item-label>
203
+ <q-item-label class="text-body-xs text-neutral-9 label">
204
+ {{ item?.description }}
205
+ </q-item-label>
206
+ </q-item-section>
207
+
208
+ <q-item-section side>
209
+ <UBtnStd
210
+ v-bind="item.btnProps"
211
+ :color="item.btnProps?.color ?? 'primary'"
212
+ :disable="item.disable"
213
+ :label="actionButtonLabel"
214
+ outline
215
+ size="sm"
216
+ @click.stop="onItemActionClick(item)"
217
+ >
218
+ <template v-if="item.tooltip && item.disable" #tooltip>
219
+ <UTooltip
220
+ :description="item.tooltip"
221
+ anchor="top middle"
222
+ self="bottom middle"
223
+ :offset="[0, 4]"
224
+ />
225
+ </template>
226
+ </UBtnStd>
227
+ </q-item-section>
228
+ </q-item>
229
+ </template>
230
+ </q-list>
231
+
232
+ <!-- No data section -->
233
+
234
+ <div v-if="searchText.length && !searchResults.length && !exceedLimit">
235
+ <div class="items-center column q-py-ba">
236
+ <img
237
+ src="/public/images/no-result.png"
238
+ alt="No result found"
239
+ aria-label="No result found"
240
+ />
241
+ <span class="text-caption-lg">No results found</span>
242
+ <span class="text-body-sm text-neutral-9 q-mt-xxs q-mb-ba">
243
+ Invite user to join USSSA.
244
+ </span>
245
+ </div>
246
+
247
+ <div class="row items-center full-width">
248
+ <span class="searchText text-caption-md">{{ searchText }}</span>
249
+ <UBtnStd
250
+ color="primary"
251
+ label="Invite"
252
+ outline
253
+ size="sm"
254
+ @click.stop="onInvitePerson(item)"
255
+ />
256
+ </div>
257
+ </div>
258
+
259
+ <!-- Exceed limit section -->
260
+
261
+ <div v-if="searchText.length && exceedLimit && searchResults.length">
262
+ <div class="column q-my-ba items-center">
263
+ <img
264
+ alt="No result found"
265
+ aria-label="No result found"
266
+ src="/public/images/no-result.png"
267
+ />
268
+ <span class="text-caption-lg">Results exceeds limit.</span>
269
+ <span class="text-body-sm text-neutral-9 q-mt-xxs text-center">
270
+ Please select advanced search to provide more details for your
271
+ searh.
272
+ </span>
273
+ </div>
274
+ </div>
275
+
276
+ <!-- Recently selected list -->
277
+
278
+ <q-list
279
+ v-if="showRecentSelected && recentlySelected.length"
280
+ class="search-list q-mt-xs"
281
+ >
282
+ <span class="text-overline-xs">Recently Selected</span>
283
+ <template v-for="(item, index) in recentlySelected" :key="index">
284
+ <q-item class="list-item" clickable>
285
+ <q-item-section side>
286
+ <UAvatar
287
+ v-if="item.profilePictureUrl"
288
+ :aria-label="item.name"
289
+ image="https://cdn.quasar.dev/img/boy-avatar.png"
290
+ :name="item.name"
291
+ size="md"
292
+ />
293
+ <UAvatar
294
+ v-else
295
+ :aria-label="item.name"
296
+ :name="parseInitials(item.name)"
297
+ :round="true"
298
+ size="md"
299
+ :showIndicator="false"
300
+ />
301
+ </q-item-section>
302
+
303
+ <q-item-section>
304
+ <q-item-label class="text-caption-md label">
305
+ {{ item?.name }}
306
+ </q-item-label>
307
+ <q-item-label class="text-body-xs text-neutral-9 label">
308
+ {{ item?.description }}
309
+ </q-item-label>
310
+ </q-item-section>
311
+
312
+ <q-item-section side>
313
+ <UBtnStd
314
+ v-bind="item.btnProps"
315
+ :color="item.btnProps?.color ?? 'primary'"
316
+ :label="actionButtonLabel"
317
+ outline
318
+ size="sm"
319
+ @click.stop="onItemActionClick(item)"
320
+ >
321
+ </UBtnStd>
322
+ </q-item-section>
323
+ </q-item>
324
+ </template>
325
+ </q-list>
326
+ </div>
327
+ </q-list>
328
+ </q-menu>
329
+ </template>
330
+
331
+ <style lang="sass">
332
+ .u-search-option-menu
333
+ overflow-y: auto
334
+ scrollbar-width: none
335
+ border-radius: $xs
336
+ padding-bottom: $xxs
337
+ .u-typeahead-menu
338
+ .u-tabs-outer .u-tab-button .truncated-label
339
+ overflow-wrap: unset
340
+ .u-tabs-outer .u-tab-sm
341
+ margin: 0 $xxs
342
+ .u-tabs-outer .u-tab-sm:first-child
343
+ margin-left: 0px
344
+ .tabs-option
345
+ display: flex
346
+ overflow-y: auto
347
+ scrollbar-width: none
348
+ flex-direction: column
349
+ align-items: flex-start
350
+ border-radius: $xs
351
+ background: $neutral-1
352
+ // box-shadow: 0px 8px 8px 0px rgba(16, 17, 20, 0.12)
353
+ &.size-sm
354
+ width: 24.5625rem
355
+ &.size-md
356
+ width: 26.5rem
357
+ .search-list
358
+ display: flex
359
+ flex-direction: column
360
+ gap: $xxs
361
+ .searchText
362
+ flex:1
363
+ .list-item
364
+ border-radius: $xs
365
+ padding: $xs
366
+ align-items: center
367
+ display: flex
368
+ cursor: default !important
369
+ gap: $xs
370
+ .q-item__section--avatar
371
+ min-width: 0px
372
+ .q-item__section--side
373
+ padding: 0px
374
+ .label
375
+ word-break: break-all
376
+ </style>