@usssa/component-library 1.0.0-alpha.10 → 1.0.0-alpha.100
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 +5 -2
- package/package.json +19 -4
- package/src/assets/files.png +0 -0
- package/src/assets/logo.svg +19 -0
- package/src/assets/no-result.png +0 -0
- package/src/assets/quasar-logo-vertical.svg +15 -0
- package/src/components/core/UAvatar.vue +39 -6
- package/src/components/core/UAvatarGroup.vue +15 -14
- package/src/components/core/UBannerStd.vue +51 -22
- package/src/components/core/UBreadCrumbs.vue +67 -0
- package/src/components/core/UBtnIcon.vue +24 -14
- package/src/components/core/UBtnStd.vue +35 -31
- package/src/components/core/UBtnToggle.vue +68 -0
- package/src/components/core/UCheckboxStd.vue +25 -8
- package/src/components/core/UChip.vue +30 -4
- package/src/components/core/UDialogStd.vue +244 -0
- package/src/components/core/UDrawer.vue +235 -0
- package/src/components/core/UInnerLoader.vue +58 -0
- package/src/components/core/UInputAddressLookup.vue +470 -0
- package/src/components/core/UInputPhoneStd.vue +299 -0
- package/src/components/core/UInputTextStd.vue +114 -85
- package/src/components/core/UInputTypeaheadAdvanceSearch.vue +59 -0
- package/src/components/core/UMenuButtonStd.vue +274 -0
- package/src/components/core/UMenuDropdown.vue +72 -0
- package/src/components/core/UMenuDropdownAdvancedSearch.vue +301 -0
- package/src/components/core/UMenuItem.vue +134 -0
- package/src/components/core/UMenuSearch.vue +752 -0
- package/src/components/core/UMultiSelectStd.vue +63 -57
- package/src/components/core/UPagination.vue +104 -0
- package/src/components/core/URadioBtn.vue +116 -0
- package/src/components/core/URadioStd.vue +7 -3
- package/src/components/core/USelectStd.vue +74 -59
- package/src/components/core/UTabBtnStd.vue +82 -59
- package/src/components/core/UTable/UTable.vue +93 -0
- package/src/components/core/UTable/UTd.vue +63 -0
- package/src/components/core/UTable/UTh.vue +48 -0
- package/src/components/core/UTable/UTr.vue +20 -0
- package/src/components/core/UTableStd.vue +1003 -0
- package/src/components/core/UTabsStd.vue +17 -5
- package/src/components/core/UToggleStd.vue +30 -20
- package/src/components/core/UToolbar.vue +94 -0
- package/src/components/core/UTooltip.vue +25 -4
- package/src/components/core/UUploader.vue +497 -0
- package/src/components/index.js +57 -6
- package/src/composables/useNotify.js +79 -0
- package/src/composables/useOverlayLoader.js +23 -0
- package/src/css/app.sass +159 -0
- package/src/css/colors.sass +101 -0
- package/src/css/media.sass +1 -0
- package/src/css/quasar.variables.sass +121 -0
- package/src/css/typography.sass +0 -0
- package/src/css/vars/colors.variables.sass +126 -0
- package/src/utils/data.ts +146 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
const props = defineProps({
|
|
3
|
+
options: {
|
|
4
|
+
type: Array,
|
|
5
|
+
require: true,
|
|
6
|
+
},
|
|
7
|
+
})
|
|
8
|
+
const model = defineModel()
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<q-btn-toggle
|
|
13
|
+
class="u-btn-toggle"
|
|
14
|
+
v-model="model"
|
|
15
|
+
size="md"
|
|
16
|
+
text-color="dark"
|
|
17
|
+
unelevated
|
|
18
|
+
color="white"
|
|
19
|
+
no-caps
|
|
20
|
+
spread
|
|
21
|
+
toggle-color="primary"
|
|
22
|
+
:options="options"
|
|
23
|
+
>
|
|
24
|
+
<template
|
|
25
|
+
v-for="(option, index) in options"
|
|
26
|
+
v-slot:[option.slot]
|
|
27
|
+
:key="option"
|
|
28
|
+
>
|
|
29
|
+
<div class="row items-center no-wrap slot">
|
|
30
|
+
<q-icon
|
|
31
|
+
:class="options[index].iconClass"
|
|
32
|
+
v-if="options[index].iconClass"
|
|
33
|
+
/>
|
|
34
|
+
<div class="text-center text-caption-md">
|
|
35
|
+
{{ options[index].name }}
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
39
|
+
</q-btn-toggle>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<style lang="sass">
|
|
43
|
+
.slot
|
|
44
|
+
gap: $xxs
|
|
45
|
+
|
|
46
|
+
.u-btn-toggle
|
|
47
|
+
&.q-btn-toggle
|
|
48
|
+
border-radius: $xs
|
|
49
|
+
padding: $xxs
|
|
50
|
+
box-shadow: $shadow-inner
|
|
51
|
+
|
|
52
|
+
.q-btn-item
|
|
53
|
+
.q-btn__content
|
|
54
|
+
font-size: 0.875rem
|
|
55
|
+
line-height: 1.25rem
|
|
56
|
+
letter-spacing: .03333rem
|
|
57
|
+
font-weight: 500
|
|
58
|
+
|
|
59
|
+
.q-btn-item
|
|
60
|
+
border-radius: $xxs !important
|
|
61
|
+
padding: $xs $sm !important
|
|
62
|
+
&[aria-pressed="true"]
|
|
63
|
+
&::before
|
|
64
|
+
color: $neutral-1
|
|
65
|
+
box-shadow: $shadow-skeumorphic-primary
|
|
66
|
+
border: $stroke-skeuomorphic
|
|
67
|
+
z-index: 2
|
|
68
|
+
</style>
|
|
@@ -4,7 +4,7 @@ import { onMounted } from 'vue'
|
|
|
4
4
|
const props = defineProps({
|
|
5
5
|
label: {
|
|
6
6
|
type: String,
|
|
7
|
-
default: '
|
|
7
|
+
default: '',
|
|
8
8
|
},
|
|
9
9
|
name: {
|
|
10
10
|
type: String,
|
|
@@ -23,23 +23,29 @@ const props = defineProps({
|
|
|
23
23
|
default: 'u-checkbox',
|
|
24
24
|
required: true, // it is required for to match accessibility crieteria
|
|
25
25
|
},
|
|
26
|
+
indeterminate: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false,
|
|
29
|
+
},
|
|
26
30
|
})
|
|
27
31
|
|
|
28
32
|
const isChecked = defineModel({ default: false, type: Boolean })
|
|
29
33
|
|
|
30
34
|
onMounted(() => {
|
|
31
|
-
const checkboxElement = document.getElementById(
|
|
35
|
+
const checkboxElement = document.getElementById(`${props.id}`)
|
|
32
36
|
if (checkboxElement) {
|
|
33
37
|
const inputElement = checkboxElement.querySelector('input')
|
|
34
|
-
inputElement.id =
|
|
38
|
+
inputElement.id = `${props.id}`
|
|
39
|
+
} else {
|
|
40
|
+
// need to add if element is not found
|
|
35
41
|
}
|
|
36
42
|
})
|
|
37
43
|
</script>
|
|
38
44
|
|
|
39
45
|
<template>
|
|
40
|
-
<label style="display: none" :for="
|
|
46
|
+
<label style="display: none" :for="`${id}`">Checkbox </label>
|
|
41
47
|
<q-checkbox
|
|
42
|
-
:id="
|
|
48
|
+
:id="`${id}`"
|
|
43
49
|
class="u-checkbox text-caption-lg"
|
|
44
50
|
:name="name"
|
|
45
51
|
v-model="isChecked"
|
|
@@ -48,6 +54,8 @@ onMounted(() => {
|
|
|
48
54
|
size="md"
|
|
49
55
|
keep-color
|
|
50
56
|
color="primary"
|
|
57
|
+
:toggle-indeterminate="indeterminate"
|
|
58
|
+
v-bind="$attrs"
|
|
51
59
|
/>
|
|
52
60
|
</template>
|
|
53
61
|
|
|
@@ -56,12 +64,21 @@ onMounted(() => {
|
|
|
56
64
|
color: $primary
|
|
57
65
|
font-weight: 500
|
|
58
66
|
|
|
59
|
-
|
|
67
|
+
.q-checkbox__inner
|
|
60
68
|
display: flex
|
|
61
69
|
justify-content: center
|
|
62
70
|
align-items: center
|
|
71
|
+
height: $ms
|
|
72
|
+
width: $ms
|
|
73
|
+
|
|
74
|
+
.q-checkbox__inner:before
|
|
75
|
+
top: -9px !important
|
|
76
|
+
left: -2px !important
|
|
77
|
+
width: 2.7rem
|
|
78
|
+
height: 2.7rem
|
|
79
|
+
border-radius: 10rem !important
|
|
63
80
|
|
|
64
|
-
|
|
81
|
+
.q-checkbox__bg
|
|
65
82
|
border: 0.125rem solid $primary
|
|
66
83
|
border-radius: $xxs
|
|
67
84
|
height: $ms
|
|
@@ -71,7 +88,7 @@ onMounted(() => {
|
|
|
71
88
|
justify-content: center
|
|
72
89
|
align-items: center
|
|
73
90
|
|
|
74
|
-
|
|
91
|
+
.q-checkbox__svg
|
|
75
92
|
position: static
|
|
76
93
|
height: 1rem !important
|
|
77
94
|
width: 1rem !important
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from 'vue'
|
|
3
|
+
import UTooltip from './UTooltip.vue'
|
|
3
4
|
|
|
4
5
|
const props = defineProps({
|
|
5
6
|
chipLabel: {
|
|
@@ -16,15 +17,13 @@ const props = defineProps({
|
|
|
16
17
|
},
|
|
17
18
|
avatarLabel: {
|
|
18
19
|
type: String,
|
|
19
|
-
default: '
|
|
20
|
+
default: '',
|
|
20
21
|
},
|
|
21
22
|
icon: {
|
|
22
23
|
type: String,
|
|
23
|
-
default: 'NA',
|
|
24
24
|
},
|
|
25
25
|
iconClass: {
|
|
26
26
|
type: String,
|
|
27
|
-
default: 'NA',
|
|
28
27
|
},
|
|
29
28
|
type: {
|
|
30
29
|
type: String,
|
|
@@ -34,6 +33,21 @@ const props = defineProps({
|
|
|
34
33
|
type: Boolean,
|
|
35
34
|
default: true,
|
|
36
35
|
},
|
|
36
|
+
remove: {
|
|
37
|
+
type: Function,
|
|
38
|
+
},
|
|
39
|
+
isShowTooltip: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: false,
|
|
42
|
+
},
|
|
43
|
+
offset: {
|
|
44
|
+
default: () => [14, 14],
|
|
45
|
+
type: Array,
|
|
46
|
+
},
|
|
47
|
+
anchor: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: 'bottom middle',
|
|
50
|
+
},
|
|
37
51
|
})
|
|
38
52
|
|
|
39
53
|
const emit = defineEmits(['update:modelValue', 'onClick'])
|
|
@@ -64,7 +78,7 @@ const avatarLabel = computed(() => {
|
|
|
64
78
|
:class="type"
|
|
65
79
|
:modelValue="modelValue"
|
|
66
80
|
:dense="dense"
|
|
67
|
-
@remove="
|
|
81
|
+
@remove="remove"
|
|
68
82
|
:removable="removable"
|
|
69
83
|
:aria-label="chipLabel"
|
|
70
84
|
@click="handleClick"
|
|
@@ -78,6 +92,12 @@ const avatarLabel = computed(() => {
|
|
|
78
92
|
<span :class="`chip-label text-overline-${size} text-uppercase`">
|
|
79
93
|
{{ chipLabel }}
|
|
80
94
|
</span>
|
|
95
|
+
<UTooltip
|
|
96
|
+
v-if="isShowTooltip"
|
|
97
|
+
:description="chipLabel"
|
|
98
|
+
:offset="offset"
|
|
99
|
+
:anchor="anchor"
|
|
100
|
+
/>
|
|
81
101
|
</q-chip>
|
|
82
102
|
</template>
|
|
83
103
|
|
|
@@ -222,4 +242,10 @@ const avatarLabel = computed(() => {
|
|
|
222
242
|
|
|
223
243
|
.q-chip__icon--remove
|
|
224
244
|
padding: $xxs
|
|
245
|
+
|
|
246
|
+
.chip-label
|
|
247
|
+
max-width: 12.5rem
|
|
248
|
+
white-space: normal
|
|
249
|
+
overflow-wrap: break-word
|
|
250
|
+
line-height: 1.2 !important // over-ridding this in long chip label case
|
|
225
251
|
</style>
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, ref } from 'vue'
|
|
3
|
+
import UBtnStd from './UBtnStd.vue'
|
|
4
|
+
|
|
5
|
+
const emit = defineEmits(['onBackIconClick', 'hideDialog'])
|
|
6
|
+
const model = defineModel()
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
heading: {
|
|
9
|
+
type: String,
|
|
10
|
+
required: true,
|
|
11
|
+
},
|
|
12
|
+
fields: Object,
|
|
13
|
+
position: String,
|
|
14
|
+
size: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: 'default',
|
|
17
|
+
},
|
|
18
|
+
customSize: {
|
|
19
|
+
type: String,
|
|
20
|
+
},
|
|
21
|
+
headingCaption: String,
|
|
22
|
+
leftIcon: String,
|
|
23
|
+
closeIcon: String,
|
|
24
|
+
showActionButtons: Boolean,
|
|
25
|
+
leftIconLabel: String,
|
|
26
|
+
closeIconLabel: String,
|
|
27
|
+
divider: Boolean,
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
const dialogRef = ref(true)
|
|
31
|
+
|
|
32
|
+
const dialogStyle = computed(() => ({
|
|
33
|
+
'--customSize': props.customSize,
|
|
34
|
+
}))
|
|
35
|
+
|
|
36
|
+
const headerClass = computed(() => {
|
|
37
|
+
return props.divider ? 'divider' : ''
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const handleBackClick = () => {
|
|
41
|
+
return emit('onBackIconClick')
|
|
42
|
+
}
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<template>
|
|
46
|
+
<q-dialog
|
|
47
|
+
v-bind="$attrs"
|
|
48
|
+
v-model="model"
|
|
49
|
+
:class="`dialog-${size}`"
|
|
50
|
+
full-width
|
|
51
|
+
no-backdrop-dismiss
|
|
52
|
+
:position="position"
|
|
53
|
+
ref="dialogRef"
|
|
54
|
+
:style="dialogStyle"
|
|
55
|
+
>
|
|
56
|
+
<q-card class="dialog-wrapper full-height">
|
|
57
|
+
<q-card-section
|
|
58
|
+
:class="`col items-center q-pa-none heading-section ${headerClass}`"
|
|
59
|
+
>
|
|
60
|
+
<div class="heading-wrapper row">
|
|
61
|
+
<div class="flex items-center dialog-heading-container">
|
|
62
|
+
<div v-if="leftIcon">
|
|
63
|
+
<UBtnStd
|
|
64
|
+
class="dialog-action-icons"
|
|
65
|
+
:aria-label="leftIconLabel"
|
|
66
|
+
:flat="true"
|
|
67
|
+
tabindex="0"
|
|
68
|
+
@click="handleBackClick()"
|
|
69
|
+
>
|
|
70
|
+
<q-icon
|
|
71
|
+
class="icon-back"
|
|
72
|
+
:class="leftIcon"
|
|
73
|
+
size="1.5rem"
|
|
74
|
+
tabindex="-1"
|
|
75
|
+
/>
|
|
76
|
+
</UBtnStd>
|
|
77
|
+
</div>
|
|
78
|
+
<div class="col">
|
|
79
|
+
<div>
|
|
80
|
+
<span class="text-heading-sm dialog-heading">
|
|
81
|
+
{{ heading }}
|
|
82
|
+
</span>
|
|
83
|
+
</div>
|
|
84
|
+
<div>
|
|
85
|
+
<span v-if="headingCaption" class="text-body-sm dialog-caption">
|
|
86
|
+
{{ headingCaption }}
|
|
87
|
+
</span>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
<UBtnStd
|
|
93
|
+
class="dialog-action-icons"
|
|
94
|
+
:aria-label="closeIconLabel"
|
|
95
|
+
:flat="true"
|
|
96
|
+
tabindex="0"
|
|
97
|
+
@click="dialogRef.hide()"
|
|
98
|
+
>
|
|
99
|
+
<q-icon
|
|
100
|
+
v-if="closeIcon"
|
|
101
|
+
class="icon-close"
|
|
102
|
+
:class="closeIcon"
|
|
103
|
+
size="1.5rem"
|
|
104
|
+
tabindex="-1"
|
|
105
|
+
/>
|
|
106
|
+
</UBtnStd>
|
|
107
|
+
</div>
|
|
108
|
+
<div class="row">
|
|
109
|
+
<slot name="secondary_row"></slot>
|
|
110
|
+
</div>
|
|
111
|
+
</q-card-section>
|
|
112
|
+
|
|
113
|
+
<q-card-section class="full-height main-content-dialog scroll q-px-ba">
|
|
114
|
+
<slot name="content" />
|
|
115
|
+
</q-card-section>
|
|
116
|
+
|
|
117
|
+
<div v-if="showActionButtons" class="q-pa-ba action-wrapper">
|
|
118
|
+
<q-card-actions class="action-buttons" align="left">
|
|
119
|
+
<slot name="action_secondary_one"></slot>
|
|
120
|
+
<slot name="action_secondary_two"></slot>
|
|
121
|
+
</q-card-actions>
|
|
122
|
+
<q-card-actions class="action-buttons" align="right">
|
|
123
|
+
<slot name="action_primary_one"></slot>
|
|
124
|
+
<slot name="action_primary_two"></slot>
|
|
125
|
+
</q-card-actions>
|
|
126
|
+
</div>
|
|
127
|
+
</q-card>
|
|
128
|
+
</q-dialog>
|
|
129
|
+
</template>
|
|
130
|
+
|
|
131
|
+
<style lang="sass">
|
|
132
|
+
.dialog-default, .dialog-half
|
|
133
|
+
.q-dialog__inner--left, .q-dialog__inner--right
|
|
134
|
+
.dialog-wrapper
|
|
135
|
+
max-height: 100vh !important
|
|
136
|
+
.q-dialog__inner
|
|
137
|
+
&.q-dialog__inner--right
|
|
138
|
+
padding-right: $ba !important
|
|
139
|
+
&.q-dialog__inner--left
|
|
140
|
+
padding-left: $ba !important
|
|
141
|
+
.dialog-heading-container
|
|
142
|
+
gap: $xs
|
|
143
|
+
|
|
144
|
+
.dialog-caption
|
|
145
|
+
color: $neutral-9
|
|
146
|
+
.dialog-heading
|
|
147
|
+
color: $dark
|
|
148
|
+
|
|
149
|
+
.heading-section
|
|
150
|
+
padding: $ba
|
|
151
|
+
|
|
152
|
+
.dialog-wrapper
|
|
153
|
+
border-radius: $xs !important
|
|
154
|
+
.divider
|
|
155
|
+
border-bottom: 1.5px solid $neutral-4
|
|
156
|
+
.action-wrapper
|
|
157
|
+
display: flex
|
|
158
|
+
justify-content: space-between
|
|
159
|
+
border-radius: 0 0 $xs $xs !important
|
|
160
|
+
.q-card__actions
|
|
161
|
+
padding: 0
|
|
162
|
+
|
|
163
|
+
.dialog-half
|
|
164
|
+
.q-dialog__inner
|
|
165
|
+
padding: $ba 0
|
|
166
|
+
width: 50% !important
|
|
167
|
+
|
|
168
|
+
.dialog-full
|
|
169
|
+
.q-dialog__inner
|
|
170
|
+
padding: 0 0
|
|
171
|
+
width: 100% !important
|
|
172
|
+
.dialog-wrapper
|
|
173
|
+
max-height: calc(100vh - 1rem)
|
|
174
|
+
border-radius: $xs $xs 0 0 !important
|
|
175
|
+
&.action-wrapper
|
|
176
|
+
border-radius: 0 !important
|
|
177
|
+
.main-content-dialog
|
|
178
|
+
padding: $ms $ms
|
|
179
|
+
padding-bottom: 0
|
|
180
|
+
margin-bottom: $ms !important
|
|
181
|
+
.heading-section
|
|
182
|
+
padding: $ba $ms !important
|
|
183
|
+
.action-wrapper
|
|
184
|
+
padding: $ba $ms
|
|
185
|
+
|
|
186
|
+
.dialog-custom
|
|
187
|
+
.q-dialog__inner
|
|
188
|
+
padding: $ba 0
|
|
189
|
+
width: var(--customSize)
|
|
190
|
+
|
|
191
|
+
.dialog-default
|
|
192
|
+
.q-dialog__inner
|
|
193
|
+
padding: $ba 0
|
|
194
|
+
width: 35.25rem !important
|
|
195
|
+
|
|
196
|
+
.heading-wrapper
|
|
197
|
+
justify-content: space-between
|
|
198
|
+
flex-wrap: nowrap
|
|
199
|
+
margin-bottom: $ba
|
|
200
|
+
|
|
201
|
+
.icon-close
|
|
202
|
+
color: $neutral-9
|
|
203
|
+
cursor: pointer
|
|
204
|
+
align-self: flex-start
|
|
205
|
+
|
|
206
|
+
.icon-back
|
|
207
|
+
cursor: pointer
|
|
208
|
+
color: $neutral-9
|
|
209
|
+
|
|
210
|
+
.main-content-dialog
|
|
211
|
+
margin-bottom: $ba
|
|
212
|
+
padding-bottom: 0
|
|
213
|
+
|
|
214
|
+
.full-height
|
|
215
|
+
height: 100vh
|
|
216
|
+
display: flex
|
|
217
|
+
flex-direction: column
|
|
218
|
+
|
|
219
|
+
.action-buttons
|
|
220
|
+
display: flex
|
|
221
|
+
align-items: center
|
|
222
|
+
gap: $xs
|
|
223
|
+
.q-btn
|
|
224
|
+
margin: 0 !important
|
|
225
|
+
|
|
226
|
+
.q-btn.dialog-action-icons
|
|
227
|
+
padding: 0px 0px !important
|
|
228
|
+
min-width: 1.5rem !important
|
|
229
|
+
min-height: 0px !important
|
|
230
|
+
height: fit-content !important
|
|
231
|
+
border-radius: 0px
|
|
232
|
+
|
|
233
|
+
&:focus
|
|
234
|
+
outline: auto !important
|
|
235
|
+
|
|
236
|
+
.q-focus-helper
|
|
237
|
+
background: transparent !important
|
|
238
|
+
|
|
239
|
+
#closeIconLabelRef
|
|
240
|
+
display: none
|
|
241
|
+
|
|
242
|
+
#leftIconLabelRef
|
|
243
|
+
display: none
|
|
244
|
+
</style>
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { useRouter } from 'vue-router'
|
|
4
|
+
import UBadgeStd from './UBadgeStd.vue'
|
|
5
|
+
import UBtnIcon from './UBtnIcon.vue'
|
|
6
|
+
import UBtnStd from './UBtnStd.vue'
|
|
7
|
+
import UMenuItem from './UMenuItem.vue'
|
|
8
|
+
import UTooltip from './UTooltip.vue'
|
|
9
|
+
|
|
10
|
+
const emit = defineEmits(['menuItemClicked', 'closeDrawer'])
|
|
11
|
+
const miniState = defineModel('miniState', {
|
|
12
|
+
default: false,
|
|
13
|
+
type: Boolean,
|
|
14
|
+
})
|
|
15
|
+
const open = defineModel('open', {
|
|
16
|
+
default: false,
|
|
17
|
+
type: Boolean,
|
|
18
|
+
})
|
|
19
|
+
const props = defineProps({
|
|
20
|
+
menu: {
|
|
21
|
+
default: () => [],
|
|
22
|
+
type: Array,
|
|
23
|
+
},
|
|
24
|
+
brandLogo: {
|
|
25
|
+
default: '',
|
|
26
|
+
},
|
|
27
|
+
brandMiniLogo: {
|
|
28
|
+
default: '',
|
|
29
|
+
},
|
|
30
|
+
homeLink: {
|
|
31
|
+
required: true,
|
|
32
|
+
default: '/home',
|
|
33
|
+
type: String,
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
const $router = useRouter()
|
|
38
|
+
const currentPath = computed(() => getCurrentPath())
|
|
39
|
+
const currentRoute = computed(() => $router.currentRoute.value.fullPath)
|
|
40
|
+
|
|
41
|
+
const getCurrentPath = (int = 1) => {
|
|
42
|
+
return currentRoute.value.split('/')[int]
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* returning x offset for tooltip for long text
|
|
47
|
+
* @param {*} label
|
|
48
|
+
*/
|
|
49
|
+
const getXOffset = (label) => {
|
|
50
|
+
let labelLength = label.trim().length
|
|
51
|
+
return labelLength <= 4 ? 65 : labelLength < 9 ? 85 : 145
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const handleClick = (menu) => {
|
|
55
|
+
emit('menuItemClicked', menu)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const handleCloseDrawer = () => {
|
|
59
|
+
emit('closeDrawer')
|
|
60
|
+
}
|
|
61
|
+
</script>
|
|
62
|
+
<template>
|
|
63
|
+
<q-drawer
|
|
64
|
+
v-model="open"
|
|
65
|
+
:class="`u-drawer ${miniState ? 'u-mini-drawer' : ''}`"
|
|
66
|
+
:breakpoint="400"
|
|
67
|
+
:mini="miniState"
|
|
68
|
+
:mini-width="64"
|
|
69
|
+
show-if-above
|
|
70
|
+
side="left"
|
|
71
|
+
:width="224"
|
|
72
|
+
>
|
|
73
|
+
<q-scroll-area class="u-drawer-scrollable-area">
|
|
74
|
+
<div
|
|
75
|
+
:class="`flex items-center justify-${
|
|
76
|
+
miniState ? 'center q-py-xs' : 'between q-py-xs q-pl-ba q-pr-xxs'
|
|
77
|
+
} `"
|
|
78
|
+
>
|
|
79
|
+
<UBtnStd
|
|
80
|
+
class="flex items-center justify-center drawer-logo q-pa-none"
|
|
81
|
+
flat
|
|
82
|
+
:ripple="false"
|
|
83
|
+
size="sm"
|
|
84
|
+
:to="homeLink"
|
|
85
|
+
>
|
|
86
|
+
<q-img
|
|
87
|
+
v-if="!miniState"
|
|
88
|
+
class="full-logo"
|
|
89
|
+
alt="usssa-logo"
|
|
90
|
+
aria-label="usssa logo"
|
|
91
|
+
:src="`${brandLogo}`"
|
|
92
|
+
/>
|
|
93
|
+
<q-img
|
|
94
|
+
v-else
|
|
95
|
+
class="mini-state-logo"
|
|
96
|
+
alt="usssa-logo"
|
|
97
|
+
aria-label="usssa logo"
|
|
98
|
+
:src="brandMiniLogo"
|
|
99
|
+
/>
|
|
100
|
+
</UBtnStd>
|
|
101
|
+
<div
|
|
102
|
+
v-if="!miniState"
|
|
103
|
+
class="drawer-open-close-icon-wrapper flex items-center justify-center"
|
|
104
|
+
>
|
|
105
|
+
<UBtnIcon
|
|
106
|
+
iconClass="fa-kit-duotone fa-sidebar-shrink"
|
|
107
|
+
ariaLabel="Sidebar shrink icon"
|
|
108
|
+
color="primary"
|
|
109
|
+
dense
|
|
110
|
+
ref="btn-icon"
|
|
111
|
+
size="sm"
|
|
112
|
+
@click="handleCloseDrawer"
|
|
113
|
+
/>
|
|
114
|
+
<UTooltip
|
|
115
|
+
anchor="center right"
|
|
116
|
+
description="Collapse Menu"
|
|
117
|
+
:offset="[4, 14]"
|
|
118
|
+
self="center start"
|
|
119
|
+
/>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
<q-list
|
|
123
|
+
:class="`drawer-menu-list ${miniState ? 'drawer-menu-mini-list' : ''}`"
|
|
124
|
+
padding
|
|
125
|
+
>
|
|
126
|
+
<template v-for="(m, i) in menu" :key="i">
|
|
127
|
+
<UMenuItem
|
|
128
|
+
:class="`drawer-items ${miniState ? 'mini-menu-box' : ''}`"
|
|
129
|
+
:id="`u-drawer-menu-${i}`"
|
|
130
|
+
:label="m.label"
|
|
131
|
+
:left-icon="m.leftIcon"
|
|
132
|
+
:selected="currentPath === m.to.replaceAll('/', '')"
|
|
133
|
+
@onClick="handleClick(m)"
|
|
134
|
+
>
|
|
135
|
+
<template v-if="!miniState" #trailing_slot>
|
|
136
|
+
<UBadgeStd v-if="m.badgeInfo" :label="m.badgeInfo" size="lg" />
|
|
137
|
+
<q-icon
|
|
138
|
+
v-if="m.rightIcon"
|
|
139
|
+
:class="`${m.rightIcon} ${
|
|
140
|
+
currentPath === m.to.replaceAll('/', '')
|
|
141
|
+
? ''
|
|
142
|
+
: 'non-active-right-icon'
|
|
143
|
+
}`"
|
|
144
|
+
:aria-label="m.badgeInfo"
|
|
145
|
+
size="1rem"
|
|
146
|
+
/>
|
|
147
|
+
</template>
|
|
148
|
+
</UMenuItem>
|
|
149
|
+
<UTooltip
|
|
150
|
+
v-if="miniState"
|
|
151
|
+
anchor="center right"
|
|
152
|
+
:description="m.label"
|
|
153
|
+
:offset="[getXOffset(m.label), 20]"
|
|
154
|
+
self="center right"
|
|
155
|
+
:target="`#u-drawer-menu-${i}`"
|
|
156
|
+
/>
|
|
157
|
+
</template>
|
|
158
|
+
</q-list>
|
|
159
|
+
</q-scroll-area>
|
|
160
|
+
</q-drawer>
|
|
161
|
+
</template>
|
|
162
|
+
<style lang="sass">
|
|
163
|
+
.mini-state-logo
|
|
164
|
+
height: 1.5rem
|
|
165
|
+
width: 2.022rem
|
|
166
|
+
|
|
167
|
+
.q-drawer:has(.u-drawer)
|
|
168
|
+
width: 14rem !important
|
|
169
|
+
|
|
170
|
+
.q-drawer:has(.u-mini-drawer)
|
|
171
|
+
width: 4rem !important
|
|
172
|
+
|
|
173
|
+
.u-drawer
|
|
174
|
+
background: $surface-bg-1
|
|
175
|
+
.q-scrollarea__content
|
|
176
|
+
width: 100%
|
|
177
|
+
.drawer-logo
|
|
178
|
+
padding: 0px !important
|
|
179
|
+
min-width: 0px !important
|
|
180
|
+
&.q-hoverable:hover > .q-focus-helper
|
|
181
|
+
opacity: 0
|
|
182
|
+
&:focus-visible
|
|
183
|
+
outline: auto !important
|
|
184
|
+
.q-focus-helper
|
|
185
|
+
display: none
|
|
186
|
+
|
|
187
|
+
.u-drawer-scrollable-area
|
|
188
|
+
height: calc(100% - 0px)
|
|
189
|
+
margin-top: 0px
|
|
190
|
+
|
|
191
|
+
.menu-icon-class
|
|
192
|
+
font-size: 1rem
|
|
193
|
+
|
|
194
|
+
.menu-icon-wrapper
|
|
195
|
+
min-width: auto !important
|
|
196
|
+
|
|
197
|
+
.full-logo
|
|
198
|
+
width: 5.918rem
|
|
199
|
+
height: 1.5rem
|
|
200
|
+
|
|
201
|
+
.drawer-open-close-icon
|
|
202
|
+
font-size: 1rem
|
|
203
|
+
color: $primary
|
|
204
|
+
|
|
205
|
+
.drawer-open-close-icon-wrapper
|
|
206
|
+
height: $md
|
|
207
|
+
width: $md
|
|
208
|
+
|
|
209
|
+
.drawer-menu-list
|
|
210
|
+
padding: 0px $xs
|
|
211
|
+
|
|
212
|
+
.u-menu-link
|
|
213
|
+
.q-item
|
|
214
|
+
margin-bottom: 0
|
|
215
|
+
|
|
216
|
+
.drawer-menu-mini-list
|
|
217
|
+
display: grid
|
|
218
|
+
place-content: center
|
|
219
|
+
place-items: center
|
|
220
|
+
|
|
221
|
+
.u-drawer
|
|
222
|
+
.drawer-menu-list
|
|
223
|
+
.q-icon
|
|
224
|
+
color: $primary !important
|
|
225
|
+
|
|
226
|
+
.mini-menu-box
|
|
227
|
+
width: 3.5rem
|
|
228
|
+
|
|
229
|
+
.u-drawer
|
|
230
|
+
.drawer-menu-list
|
|
231
|
+
.non-active-right-icon
|
|
232
|
+
color: $dark !important
|
|
233
|
+
.drawer-items
|
|
234
|
+
margin-bottom: $xs!important
|
|
235
|
+
</style>
|