@usssa/component-library 1.0.0-alpha.152 → 1.0.0-alpha.154

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,4 +1,4 @@
1
- # Component Library v1.0.0-alpha.150
1
+ # Component Library v1.0.0-alpha.153
2
2
 
3
3
  **This library provides custom UI components for USSSA applications.**
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usssa/component-library",
3
- "version": "1.0.0-alpha.152",
3
+ "version": "1.0.0-alpha.154",
4
4
  "description": "A Quasar component library project",
5
5
  "productName": "Quasar component library App",
6
6
  "author": "Troy Moreland <troy.moreland@usssa.com>",
@@ -98,6 +98,7 @@ const toLowerCase = (str) => str?.toLowerCase()
98
98
  :hintText="hintText"
99
99
  :isRequired="isRequired"
100
100
  :label="label"
101
+ inputType="tel"
101
102
  leftIcon="true"
102
103
  :mask="mask"
103
104
  :outlined="outlined"
@@ -33,6 +33,10 @@ const props = defineProps({
33
33
  hintText: {
34
34
  type: String,
35
35
  },
36
+ inputType: {
37
+ type: String,
38
+ default: 'text',
39
+ },
36
40
  isRequired: {
37
41
  type: Boolean,
38
42
  default: false,
@@ -143,7 +147,7 @@ const handleRightIconClick = () => {
143
147
  :readonly="readonly"
144
148
  :rules="validationRules"
145
149
  :standout="!outlined"
146
- type="text"
150
+ :type="inputType"
147
151
  >
148
152
  <!--Added below line to resolve "Missing form label" accessibility issue -->
149
153
  <template class="hidden">{{ label }}</template>
@@ -193,7 +197,7 @@ const handleRightIconClick = () => {
193
197
  </div>
194
198
  </div>
195
199
  </template>
196
- <slot name="menu"/>
200
+ <slot name="menu" />
197
201
  </q-input>
198
202
  </div>
199
203
  </template>
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { computed, ref, watch } from 'vue'
2
+ import { computed, onMounted, ref, watch } from 'vue'
3
3
  import { useScreenType } from '../../composables/useScreenType'
4
4
  import UAvatar from './UAvatar.vue'
5
5
  import UBtnStd from './UBtnStd.vue'
@@ -74,6 +74,10 @@ const props = defineProps({
74
74
  type: String,
75
75
  default: '',
76
76
  },
77
+ readonly: {
78
+ type: Boolean,
79
+ default: false
80
+ },
77
81
  sheetLabel: {
78
82
  type: String,
79
83
  default: '',
@@ -103,13 +107,7 @@ const initialOptions = ref([...props.options])
103
107
  const placeholderText = ref(props?.placeholder)
104
108
  const search = ref('')
105
109
  const selectedItem = ref(props.modelValue)
106
-
107
- const sheetHeading = computed(() => {
108
- if (props.sheetLabel) {
109
- return props.sheetLabel
110
- }
111
- return props.label
112
- })
110
+ const selectRef = ref(null)
113
111
 
114
112
  const filterOptions = computed(() => {
115
113
  if (!search.value) return initialOptions.value
@@ -126,6 +124,12 @@ const model = computed({
126
124
  return emit('update:modelValue', value)
127
125
  },
128
126
  })
127
+ const sheetHeading = computed(() => {
128
+ if (props.sheetLabel) {
129
+ return props.sheetLabel
130
+ }
131
+ return props.label
132
+ })
129
133
 
130
134
  // sheet apply action
131
135
  const handleApply = () => {
@@ -135,8 +139,16 @@ const handleApply = () => {
135
139
 
136
140
  // for opening the sheet in mobile screen
137
141
  const handleClick = (event) => {
138
- const isSelectElement = event.target.closest('.q-field__control')
139
- if ($screen.value.isMobile && isSelectElement) {
142
+ if(props.readonly) return
143
+ if (!$screen.value.isMobile) return
144
+ const isBorderClick = event.target.classList.contains('q-field__control')
145
+
146
+ if (
147
+ isBorderClick ||
148
+ event.target.closest('.q-field__control') ||
149
+ event.target.closest('.q-field__append')
150
+ ) {
151
+ event.preventDefault()
140
152
  event.stopPropagation()
141
153
  dialogs.value = [
142
154
  {
@@ -217,6 +229,18 @@ const updateVal = (val) => {
217
229
  placeholderText.value = val?.length ? '' : props?.placeholder
218
230
  }
219
231
 
232
+ onMounted(() => {
233
+ // Add click listener to handle border clicks more reliably
234
+ if (selectRef.value) {
235
+ const controlContainer =
236
+ selectRef.value?.$el.querySelector('.q-field__control')
237
+ if (controlContainer) {
238
+ controlContainer.addEventListener('click', handleClick, {
239
+ passive: false,
240
+ })
241
+ }
242
+ }
243
+ })
220
244
  watch(
221
245
  () => props?.placeholder,
222
246
  (value) => {
@@ -234,11 +258,7 @@ watch(
234
258
  </script>
235
259
 
236
260
  <template>
237
- <section
238
- class="column q-gutter-xs"
239
- :dataTestId="dataTestId"
240
- @click="handleClick"
241
- >
261
+ <section class="column q-gutter-xs" :dataTestId="dataTestId">
242
262
  <label class="row items-center" for="select">
243
263
  <div class="u-select-label text-body-sm">
244
264
  <span>{{ label }}</span>
@@ -271,6 +291,7 @@ watch(
271
291
  :color="color"
272
292
  emit-value
273
293
  hide-bottom-space
294
+ :hide-dropdown-icon="$screen.isMobile ? true : false"
274
295
  id="select"
275
296
  map-options
276
297
  :menu-offset="[0, 5]"
@@ -280,7 +301,10 @@ watch(
280
301
  :options="options"
281
302
  outlined
282
303
  :placeholder="placeholderText"
304
+ :readonly="readonly"
305
+ ref="selectRef"
283
306
  :use-input="useInput"
307
+ @click="handleClick"
284
308
  @filter="filterFn"
285
309
  @input="handleInput"
286
310
  @keydown="handleKeydown"
@@ -294,6 +318,13 @@ watch(
294
318
  </q-item-section>
295
319
  </q-item>
296
320
  </template>
321
+ <template v-if="$screen.isMobile && !readonly" v-slot:append>
322
+ <q-icon
323
+ class="cursor-pointer"
324
+ name="arrow_drop_down"
325
+ @click.stop="handleClick"
326
+ />
327
+ </template>
297
328
 
298
329
  <template v-if="leftIcon" v-slot:prepend>
299
330
  <q-icon :class="leftIcon" size="1rem" />
@@ -451,7 +482,7 @@ watch(
451
482
 
452
483
  &::before
453
484
  background: white
454
- border: 1.5px solid $neutral-4
485
+ border: 0.094rem solid $neutral-4
455
486
 
456
487
  &.field-sm
457
488
  .q-field__marginal
@@ -465,16 +496,16 @@ watch(
465
496
  height: $xl
466
497
 
467
498
  &:hover .q-field__control::before
468
- border: 1.5px solid $primary
499
+ border: 0.094rem solid $primary
469
500
 
470
501
  &.q-field--with-bottom
471
502
  padding-bottom: 0
472
503
 
473
504
  .q-field__control:focus-within
474
- box-shadow : 0 0 0 2px rgba(35, 75, 169, .20)
505
+ box-shadow : 0 0 0 0.125rem rgba(35, 75, 169, .20)
475
506
 
476
507
  .q-field__bottom
477
- padding: 4px 0 0 0
508
+ padding: $xxs 0 0 0
478
509
 
479
510
  .q-field__prepend
480
511
  padding-right: $xs