@usssa/component-library 1.0.0-alpha.45 → 1.0.0-alpha.47

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.45",
3
+ "version": "1.0.0-alpha.47",
4
4
  "description": "A Quasar component library project",
5
5
  "productName": "Quasar component library App",
6
6
  "author": "Troy Moreland <troy.moreland@usssa.com>",
@@ -7,6 +7,9 @@ const props = defineProps({
7
7
  type: String,
8
8
  default: 'primary',
9
9
  },
10
+ bgColor: {
11
+ type: String,
12
+ },
10
13
  icon: {
11
14
  type: String,
12
15
  },
@@ -80,10 +83,11 @@ const initials = computed(() => {
80
83
  <q-avatar
81
84
  class="u-avatar"
82
85
  :class="`size-${size}`"
83
- @click="handleClick"
86
+ :color="bgColor"
84
87
  :round="round"
85
88
  :rounded="!round"
86
89
  :icon="icon"
90
+ @click="handleClick"
87
91
  v-bind="$attrs"
88
92
  >
89
93
  <img v-if="image" :src="image" :alt="`avatar ${name}`" :aria-label="name" />
@@ -33,7 +33,7 @@ const handleClick = () => {
33
33
  </script>
34
34
 
35
35
  <template>
36
- <q-list :class="`u-menu-dropdown size-${size} ${menuClass}`">
36
+ <q-list :class="`u-menu-dropdown size-${size} ${menuClass} q-gutter-y-xxs`">
37
37
  <template v-for="(item, index) in data" :key="index">
38
38
  <UMenuItem
39
39
  :label="item.label"
@@ -66,11 +66,10 @@ const backgroundColor = computed(() => {
66
66
  </script>
67
67
 
68
68
  <template>
69
- <div class="u-menu-link q-mb-xxs">
70
69
  <q-item
71
70
  clickable
72
71
  role="button"
73
- :class="`${backgroundColor} item-${type}`"
72
+ :class="`${backgroundColor} item-${type} u-menu-link q-mb-xxs`"
74
73
  @click="handleClick"
75
74
  :aria-label="label"
76
75
  >
@@ -100,12 +99,11 @@ const backgroundColor = computed(() => {
100
99
 
101
100
  <slot name="trailing_slot"></slot>
102
101
  </q-item>
103
- </div>
104
102
  </template>
105
103
 
106
104
  <style lang="sass">
107
105
  .u-menu-link
108
- .q-item
106
+ &.q-item
109
107
  border-radius: $xxs
110
108
  padding: 0rem $xs
111
109
  align-items: center
@@ -126,7 +124,4 @@ const backgroundColor = computed(() => {
126
124
  opacity: 1
127
125
  .label
128
126
  word-break: break-all
129
-
130
- .u-menu-link:last-child
131
- margin-bottom : 0
132
127
  </style>
@@ -1,6 +1,8 @@
1
1
  <script setup>
2
2
  import { computed } from 'vue'
3
3
  import UTooltip from './UTooltip.vue'
4
+ import UMenuItem from './UMenuItem.vue'
5
+ import UAvatar from './UAvatar.vue'
4
6
 
5
7
  const props = defineProps({
6
8
  label: {
@@ -45,6 +47,10 @@ const props = defineProps({
45
47
  type: Boolean,
46
48
  required: false,
47
49
  },
50
+ disableAvatar: {
51
+ type: Boolean,
52
+ default: true,
53
+ },
48
54
  size: {
49
55
  type: String,
50
56
  default: 'md',
@@ -89,26 +95,29 @@ const model = computed({
89
95
  </div>
90
96
 
91
97
  <q-icon
92
- class="q-ml-xs fa-kit-duotone fa-circle-info cursor-pointer"
93
98
  v-if="toolTipText"
99
+ aria-hidden="true"
100
+ class="q-ml-xs fa-kit-duotone fa-circle-info cursor-pointer"
94
101
  size="1rem"
95
102
  color="neutral-9"
96
- aria-hidden="true"
97
103
  >
98
104
  <UTooltip
99
- :description="toolTipText"
100
105
  anchor="top middle"
106
+ :description="toolTipText"
101
107
  self="bottom middle"
102
108
  />
103
109
  </q-icon>
104
110
  </label>
105
111
 
106
112
  <q-select
107
- class="u-select"
108
- :class="`field-${size}`"
109
- id="select"
113
+ v-model="model"
114
+ v-bind="$attrs"
115
+ bottom-slots
116
+ :class="`u-select field-${size}`"
110
117
  :color="color"
111
118
  emit-value
119
+ hide-bottom-space
120
+ id="select"
112
121
  map-options
113
122
  :menu-offset="[0, 5]"
114
123
  :option-value="optionValue"
@@ -117,13 +126,9 @@ const model = computed({
117
126
  outlined
118
127
  options-selected-class="primary bg-blue-1"
119
128
  :popup-content-class="`u-options-menu ${popupClass}`"
120
- v-model="model"
121
- hide-bottom-space
122
- bottom-slots
123
- v-bind="$attrs"
129
+ :placeholder="placeholder"
124
130
  :use-input="useInput"
125
131
  @filter="filterFn"
126
- :placeholder="placeholder"
127
132
  >
128
133
  <template v-slot:no-option>
129
134
  <q-item>
@@ -140,7 +145,6 @@ const model = computed({
140
145
  <template v-if="hintText" v-slot:hint>
141
146
  <div class="row no-wrap items-center text-neutral-9">
142
147
  <q-icon :class="hintIcon" size="1rem" v-if="hintIcon" />
143
-
144
148
  <div class="q-mx-xxs text-body-xs">
145
149
  {{ hintText }}
146
150
  </div>
@@ -148,28 +152,42 @@ const model = computed({
148
152
  </template>
149
153
 
150
154
  <template v-slot:option="scope">
151
- <q-item class="items-center u-custom-option" v-bind="scope.itemProps">
152
- <div class="q-pr-xs" v-if="scope.opt.icon">
153
- <q-icon :class="scope.opt.icon" color="neutral-13" size="1rem" />
154
- </div>
155
-
156
- <q-item-section>
157
- <q-item-label class="text-body-sm">
158
- {{ scope.opt.label }}
159
- </q-item-label>
160
- <q-item-label caption v-if="scope.opt.description">
161
- {{ scope.opt.description }}
162
- </q-item-label>
163
- </q-item-section>
164
-
165
- <q-item-section v-if="scope.selected" side>
166
- <q-icon
167
- class="fa-kit-duotone fa-circle-check"
168
- color="primary"
169
- size="1rem"
170
- />
171
- </q-item-section>
172
- </q-item>
155
+ <UMenuItem
156
+ v-bind="scope.itemProps"
157
+ class="q-ma-xxs"
158
+ iconClass="icon-secondary-opacity"
159
+ :label="scope.opt.label"
160
+ :leftIcon="scope.opt.leftIcon"
161
+ :rightIcon="scope.opt.rightIcon"
162
+ :selected="scope.selected"
163
+ >
164
+ <template #leading_slot>
165
+ <slot name="leading_slot"/>
166
+ <div v-if="!disableAvatar">
167
+ <UAvatar
168
+ v-if="scope.opt.avatarUrl"
169
+ :image="scope.opt.avatarUrl"
170
+ :name="scope.opt.label"
171
+ size="md"
172
+ />
173
+ <UAvatar
174
+ v-else
175
+ :name="scope.opt.label"
176
+ size="md"
177
+ />
178
+ </div>
179
+ </template>
180
+ <template #trailing_slot>
181
+ <slot name="trailing_slot">
182
+ <q-icon
183
+ v-if="scope.selected"
184
+ class="fa-kit-duotone fa-circle-check"
185
+ color="primary"
186
+ size="1rem"
187
+ />
188
+ </slot>
189
+ </template>
190
+ </UMenuItem>
173
191
  </template>
174
192
  </q-select>
175
193
  </section>
@@ -224,10 +242,9 @@ const model = computed({
224
242
  width: 18rem
225
243
  overflow-y: auto
226
244
  scrollbar-width: none
227
-
228
- .u-custom-option
229
- margin: $xxs
230
- border-radius: $xxs
231
- padding: $xs
232
- min-height: $lg
245
+
246
+ .u-options-menu
247
+ .q-item:last-child
248
+ margin-bottom: $xxs
249
+
233
250
  </style>
@@ -4,7 +4,7 @@ import UBtnIcon from './UBtnIcon.vue'
4
4
  import UBtnStd from './UBtnStd.vue'
5
5
  import UInputTextStd from './UInputTextStd.vue'
6
6
  import UTooltip from './UTooltip.vue'
7
- import { fixStringLength, formatDate, getFileCategory } from 'src/utils/data'
7
+ import { fixStringLength, formatDate, getFileCategory } from '../../utils/data'
8
8
 
9
9
  const props = defineProps({
10
10
  autoUpload: {
@@ -34,6 +34,14 @@ const props = defineProps({
34
34
  type: String,
35
35
  default: 'Remove File',
36
36
  },
37
+ editIconLabel: {
38
+ type: String,
39
+ default: 'Edit File Name',
40
+ },
41
+ viewIconLabel: {
42
+ type: String,
43
+ default: 'view File Name',
44
+ },
37
45
  listExternal: {
38
46
  type: Boolean,
39
47
  default: false,
@@ -61,11 +69,13 @@ const props = defineProps({
61
69
  })
62
70
 
63
71
  const emit = defineEmits(['onUploadFactory', 'onViewFile', 'getFilesOnAdded'])
64
-
72
+ const fileDisplayName = ref([])
65
73
  const isEditing = ref([])
66
74
  const uploaderRef = ref(null)
67
75
 
68
- const cancelEdit = (index) => {
76
+ const cancelEdit = (payload) => {
77
+ const { index, file } = payload
78
+ fileDisplayName.value[file['__key']] = file.displayName
69
79
  isEditing.value[index] = false
70
80
  }
71
81
 
@@ -78,14 +88,17 @@ const editFileName = (index) => {
78
88
  }
79
89
 
80
90
  const updateFileName = (payload) => {
81
- const { index } = payload
91
+ const { index, scope, file } = payload
92
+ scope.files[index].displayName = fileDisplayName.value[file['__key']]
82
93
  isEditing.value[index] = false
83
94
  }
84
95
 
85
96
  const OnFileAdded = (files) => {
86
97
  files.forEach((file, index) => {
87
98
  files[index]['displayName'] = files[index]['name']
99
+ fileDisplayName.value[file['__key']] = files[index]['displayName']
88
100
  })
101
+
89
102
  return emit('getFilesOnAdded', uploaderRef.value.files)
90
103
  }
91
104
 
@@ -95,7 +108,9 @@ const OnFileUploaded = ({ files, xhr }) => {
95
108
  })
96
109
  }
97
110
 
98
- const removeFile = (scope, file) => {
111
+ const removeFile = (payload) => {
112
+ const { scope, file } = payload
113
+ fileDisplayName.value.splice(file['__key'], 1)
99
114
  scope.removeFile(file)
100
115
  }
101
116
 
@@ -135,6 +150,7 @@ defineExpose({ upload })
135
150
  size="lg"
136
151
  :full-width="true"
137
152
  :label="selectFileBtnLabel"
153
+ @click="scope.pickFiles"
138
154
  >
139
155
  {{ selectFileBtnLabel }}
140
156
  <q-uploader-add-trigger
@@ -206,7 +222,7 @@ defineExpose({ upload })
206
222
  size="sm"
207
223
  tabindex="0"
208
224
  :aria-label="removeIconLabel"
209
- @click="removeFile(scope, file)"
225
+ @click="removeFile({ scope, file, index })"
210
226
  />
211
227
  </div>
212
228
  </q-card-section>
@@ -259,7 +275,7 @@ defineExpose({ upload })
259
275
  size="sm"
260
276
  tabindex="0"
261
277
  :aria-label="removeIconLabel"
262
- @click="removeFile(scope, file)"
278
+ @click="removeFile({ scope, file, index })"
263
279
  />
264
280
  </div>
265
281
  <div class="progress-bar-container flex items-center q-mt-xxs">
@@ -333,6 +349,7 @@ defineExpose({ upload })
333
349
  color="primary"
334
350
  size="md"
335
351
  tabindex="0"
352
+ :aria-label="editIconLabel"
336
353
  @click="editFileName(index)"
337
354
  v-if="!isEditing[index] && size == 'md'"
338
355
  />
@@ -342,7 +359,8 @@ defineExpose({ upload })
342
359
  color="accent"
343
360
  size="md"
344
361
  tabindex="0"
345
- @click="removeFile(scope, file)"
362
+ :aria-label="removeIconLabel"
363
+ @click="removeFile({ scope, file, index })"
346
364
  />
347
365
 
348
366
  <UBtnStd
@@ -350,7 +368,7 @@ defineExpose({ upload })
350
368
  label="View"
351
369
  size="sm"
352
370
  outline
353
- tabindex="-1"
371
+ :aria-label="viewIconLabel"
354
372
  @onClick="handleViewClick(file)"
355
373
  v-if="size == 'md'"
356
374
  />
@@ -359,7 +377,7 @@ defineExpose({ upload })
359
377
  <UInputTextStd
360
378
  label="Edit file name"
361
379
  size="md"
362
- v-model="file.displayName"
380
+ v-model="fileDisplayName[file.__key]"
363
381
  />
364
382
  </div>
365
383
  <div
@@ -371,6 +389,7 @@ defineExpose({ upload })
371
389
  label="Edit"
372
390
  size="md"
373
391
  flat
392
+ :aria-label="editIconLabel"
374
393
  :full-width="true"
375
394
  @click="editFileName(index)"
376
395
  />
@@ -380,6 +399,7 @@ defineExpose({ upload })
380
399
  size="md"
381
400
  :full-width="true"
382
401
  :outline="true"
402
+ :aria-label="viewIconLabel"
383
403
  @onClick="handleViewClick(file)"
384
404
  />
385
405
  </div>
@@ -390,7 +410,7 @@ defineExpose({ upload })
390
410
  size="md"
391
411
  flat
392
412
  :full-width="true"
393
- @click="cancelEdit(index)"
413
+ @click="cancelEdit({ index, file })"
394
414
  />
395
415
 
396
416
  <UBtnStd
@@ -40,7 +40,7 @@ const onClick = () => {
40
40
  <template>
41
41
  <q-page class="flex flex-center">
42
42
  <ComponentBase
43
- figmaUrl="https://www.figma.com/design/2FoTrjVL4ZrTdsvB4DcSao/Components?node-id=4-24&node-type=canvas&t=nWq2UjUIdqvWKgPg-0"
43
+ figmaUrl="https://www.figma.com/design/2FoTrjVL4ZrTdsvB4DcSao/Components?node-id=8616-334031&node-type=canvas"
44
44
  >
45
45
  <template v-slot:component>
46
46
  <!-- Using test-cls to demonstrate how to pass custom css -->
@@ -1,73 +1,75 @@
1
1
  <script setup>
2
2
  import { ref } from 'vue'
3
3
  import ComponentBase from './ComponentBase.vue'
4
- import { USelectStd } from 'src/components'
4
+ import { USelectStd, UBtnStd } from 'src/components'
5
5
 
6
6
  const options_data = [
7
7
  {
8
8
  label: 'Guatemala',
9
9
  value: 'Guatemala',
10
- icon: 'fa-kit-duotone fa-home',
10
+ description: 'Guatemala',
11
+ leftIcon: 'fa-kit-duotone fa-home',
12
+ avatarUrl: 'https://cdn.quasar.dev/img/avatar2.jpg',
13
+ rightIcon: 'fa-kit-duotone fa-home',
11
14
  },
12
15
  {
13
16
  label: 'Philippines',
14
17
  value: 'Philippines',
15
- icon: 'fa-kit-duotone fa-home',
18
+ leftIcon: 'fa-kit-duotone fa-home',
16
19
  },
17
20
  {
18
21
  label: 'Colombia',
19
22
  value: 'Colombia',
20
- icon: 'fa-kit-duotone fa-home',
23
+ avatarUrl: 'https://cdn.quasar.dev/img/avatar2.jpg',
21
24
  },
22
25
  {
23
26
  label: 'Turkmenistan',
24
27
  value: 'Turkmenistan',
25
- icon: 'fa-kit-duotone fa-home',
26
28
  },
27
29
  {
28
30
  label: 'France',
29
31
  value: 'France',
30
- icon: 'fa-kit-duotone fa-home',
32
+ leftIcon: 'fa-kit-duotone fa-home',
31
33
  },
32
34
  {
33
35
  label: 'Philippines',
34
36
  value: 'Philippines',
35
- icon: 'fa-kit-duotone fa-home',
37
+ leftIcon: 'fa-kit-duotone fa-home',
36
38
  },
37
39
  {
38
40
  label: 'Greece',
39
41
  value: 'Greece',
40
- icon: 'fa-kit-duotone fa-home',
42
+ leftIcon: 'fa-kit-duotone fa-home',
41
43
  },
42
44
  {
43
45
  label: 'Indonesia',
44
46
  value: 'Indonesia',
45
- icon: 'fa-kit-duotone fa-home',
47
+ leftIcon: 'fa-kit-duotone fa-home',
46
48
  },
47
49
  {
48
50
  label: 'Russia',
49
51
  value: 'Russia',
50
- icon: 'fa-kit-duotone fa-home',
52
+ leftIcon: 'fa-kit-duotone fa-home',
51
53
  },
52
54
  {
53
55
  label: 'Albania',
54
56
  value: 'Albania',
55
- icon: 'fa-kit-duotone fa-home',
57
+ leftIcon: 'fa-kit-duotone fa-home',
56
58
  },
57
59
  {
58
60
  label: 'Sweden',
59
61
  value: 'Sweden',
60
- icon: 'fa-kit-duotone fa-home',
62
+ leftIcon: 'fa-kit-duotone fa-home',
61
63
  },
62
64
  {
63
65
  label: 'Japan',
64
66
  value: 'Japan',
65
- icon: 'fa-kit-duotone fa-home',
67
+ leftIcon: 'fa-kit-duotone fa-home',
66
68
  },
67
69
  {
68
70
  label: 'Czech Republic',
69
71
  value: 'Czech Republic',
70
- icon: 'fa-kit-duotone fa-home',
72
+ leftIcon: 'fa-kit-duotone fa-home',
71
73
  },
72
74
  ]
73
75
  const options = ref(options_data)
@@ -87,12 +89,14 @@ const filterFn = (val, update) => {
87
89
 
88
90
  const size = ref('sm')
89
91
  const useInput = ref(false)
92
+ const trailingSlot = ref(false)
90
93
  const hintText = ref('This is hint text')
91
94
  const toolTipText = ref('This is tooltip text')
92
95
  const label = ref('Label')
93
96
  const hintIcon = ref('fa-kit-duotone fa-triangle-exclamation')
94
97
  const leftIcon = ref('')
95
98
  const isRequired = ref(true)
99
+ const disableAvatar = ref(true) // disable avatar of both type image and initials
96
100
  const placeholderText = ref('Placeholder')
97
101
  const htmlContent = `<USelectStd
98
102
  v-model="modelMultiple"
@@ -109,7 +113,16 @@ const htmlContent = `<USelectStd
109
113
  :leftIcon="leftIcon"
110
114
  :filterFn="filterFn"
111
115
  :placeholder="placeholderText"
112
- />`
116
+ >
117
+ <template #trailing_slot>
118
+ <UBtnStd
119
+ color="primary"
120
+ label="Label"
121
+ size="sm"
122
+ outline
123
+ />
124
+ </template>
125
+ </USelectStd>`
113
126
  </script>
114
127
 
115
128
  <template>
@@ -133,7 +146,17 @@ const htmlContent = `<USelectStd
133
146
  :leftIcon="leftIcon"
134
147
  :filterFn="filterFn"
135
148
  :placeholder="placeholderText"
136
- />
149
+ :disableAvatar="disableAvatar"
150
+ >
151
+ <template #trailing_slot v-if="trailingSlot">
152
+ <UBtnStd
153
+ color="primary"
154
+ label="Label"
155
+ size="sm"
156
+ outline
157
+ />
158
+ </template>
159
+ </USelectStd>
137
160
  </template>
138
161
 
139
162
  <template v-slot:properties>
@@ -149,6 +172,8 @@ const htmlContent = `<USelectStd
149
172
  <div class="row">
150
173
  <q-checkbox size="xs" v-model="isRequired" label="Required" />
151
174
  <q-checkbox size="xs" v-model="useInput" label="Use Input" />
175
+ <q-checkbox size="xs" v-model="trailingSlot" label="Trailing Slot" />
176
+ <q-checkbox size="xs" v-model="disableAvatar" label="Disable Avatar" />
152
177
  </div>
153
178
  </div>
154
179
  </template>
@@ -223,6 +223,7 @@ const rowsData = computed(() => {
223
223
  let newRows = []
224
224
  for (let index = 0; index < 5000; index++) {
225
225
  newRows.push({
226
+ id: `${index + 1 * 295}`,
226
227
  _id: `${index + 1 * 295}`,
227
228
  name: `Frozen Yogurt - ${index}`,
228
229
  calories: index % 2 ? `fa-kit-duotone fa-jersey` : null,
@@ -85,13 +85,16 @@ const upload = () => {
85
85
  refUpload.value.upload()
86
86
  }
87
87
 
88
- const removeFile = (scope, file) => {
88
+ const removeFile = (file) => {
89
89
  //remove file from File list goes here
90
90
  }
91
91
 
92
92
  const editFileName = (index) => {
93
93
  isEditing.value[index] = true
94
94
  }
95
+ const cancelEdit = (index) => {
96
+ isEditing.value[index] = false
97
+ }
95
98
 
96
99
  const updateFileName = (payload) => {
97
100
  const { index } = payload