@usssa/component-library 1.0.0-alpha.46 → 1.0.0-alpha.48

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.46",
3
+ "version": "1.0.0-alpha.48",
4
4
  "description": "A Quasar component library project",
5
5
  "productName": "Quasar component library App",
6
6
  "author": "Troy Moreland <troy.moreland@usssa.com>",
@@ -70,7 +70,6 @@ const props = defineProps({
70
70
  })
71
71
 
72
72
  const modelValue = defineModel()
73
-
74
73
  const emit = defineEmits(['update-country'])
75
74
 
76
75
  const selectCountry = (country) => {
@@ -82,64 +81,65 @@ const toLowerCase = (str) => str.toLowerCase()
82
81
 
83
82
  <template>
84
83
  <UInputTextStd
84
+ v-model="modelValue"
85
+ :borderless="borderless"
85
86
  class="phone-input"
87
+ :disable="disable"
88
+ :error="error"
89
+ :error-message="errorMessage"
90
+ :hintText="hintText"
91
+ :hintIcon="hintIcon"
86
92
  :label="label"
87
93
  :isRequired="isRequired"
88
- v-model="modelValue"
89
- :mask="mask"
90
- :validationRules="validationRules"
91
94
  leftIcon="true"
92
- :rightIcon="rightIcon"
93
- :hintText="hintText"
94
- :hintIcon="hintIcon"
95
- :toolTipText="toolTipText"
95
+ :mask="mask"
96
+ :outlined="outlined"
96
97
  :placeholder="placeholder"
97
- :size="size"
98
- :disable="disable"
99
98
  :readonly="readonly"
100
- :error="error"
101
- :error-message="errorMessage"
102
- :borderless="borderless"
103
- :outlined="outlined"
99
+ :rightIcon="rightIcon"
100
+ :size="size"
101
+ :toolTipText="toolTipText"
102
+ :validationRules="validationRules"
104
103
  >
105
104
  <template v-slot:prepend>
106
105
  <q-btn-dropdown
106
+ v-bind="$attrs"
107
107
  :disable="readonly"
108
- rounded
109
- flat
110
- class="u-phone-dropdown text-body-sm"
111
108
  :class="`btn-field-${size}`"
109
+ class="u-phone-dropdown text-body-sm"
112
110
  content-class="u-dropdown-list"
111
+ flat
113
112
  menu-anchor="top right"
114
113
  menu-self="bottom middle"
115
114
  :menu-offset="[30, 5]"
115
+ rounded
116
116
  >
117
117
  <template #label>
118
118
  <q-icon
119
- left
120
119
  :aria-label="selectedCountry.name"
121
120
  :class="`fi fi-${toLowerCase(
122
121
  selectedCountry.flag
123
122
  )} flag-icon q-mr-xs`"
123
+ left
124
124
  />
125
- <label class="selected-code"> {{ selectedCountry.code }}</label>
125
+ <label class="selected-code">{{ selectedCountry.code }}</label>
126
126
  </template>
127
127
 
128
128
  <q-list class="u-list">
129
129
  <q-item
130
130
  v-for="country in options"
131
- :key="country.code"
131
+ class="q-my-xxs"
132
132
  clickable
133
+ :key="country.code"
133
134
  v-close-popup
134
135
  v-ripple
135
136
  @click="selectCountry(country)"
136
- class="q-my-xxs"
137
137
  >
138
138
  <q-item-section class="flag-section">
139
139
  <q-icon
140
140
  :aria-label="country.name"
141
- left
142
141
  :class="`fi fi-${toLowerCase(country.flag)} flag-icon q-mr-xs`"
142
+ left
143
143
  size="1.25rem"
144
144
  />
145
145
  </q-item-section>
@@ -66,11 +66,10 @@ const backgroundColor = computed(() => {
66
66
  </script>
67
67
 
68
68
  <template>
69
- <div class="u-menu-link">
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
@@ -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>
@@ -79,26 +79,27 @@ defineOptions({
79
79
  >
80
80
  <template v-slot:component>
81
81
  <UInputPhoneStd
82
- :label="label"
82
+ v-model="inputValue"
83
+ aria-label="Country code selection"
84
+ :borderless="borderless"
85
+ :disable="disabled"
86
+ :error="isError"
87
+ :error-message="errorMessage"
83
88
  :isRequired="isRequired"
89
+ :label="label"
90
+ lazy-rules
84
91
  :mask="mask"
85
- v-model="inputValue"
86
- :validationRules="validationRules"
87
- :rightIcon="rightIcon"
88
92
  :hintText="hintText"
89
93
  :hintIcon="hintIcon"
90
- :toolTipText="toolTipText"
94
+ :options="countryOptions"
95
+ :outlined="outline"
91
96
  :placeholder="placeholder"
92
- :size="size"
93
- :disable="disabled"
97
+ :rightIcon="rightIcon"
94
98
  :readonly="readonly"
95
- :error="isError"
96
- lazy-rules
97
- :error-message="errorMessage"
98
- :borderless="borderless"
99
- :outlined="outline"
100
- :options="countryOptions"
99
+ :size="size"
101
100
  :selected-country="selectedCountry"
101
+ :toolTipText="toolTipText"
102
+ :validationRules="validationRules"
102
103
  @update-country="selectCountry"
103
104
  />
104
105
  </template>
@@ -120,11 +121,11 @@ defineOptions({
120
121
  <div>
121
122
  <q-radio dense v-model="type" val="outline" label="Outline" />
122
123
  <q-radio
123
- dense
124
124
  v-model="type"
125
- val="borderless"
126
- label="Borderless"
127
125
  class="q-pa-sm"
126
+ dense
127
+ label="Borderless"
128
+ val="borderless"
128
129
  />
129
130
  </div>
130
131
  </div>
@@ -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>