@usssa/component-library 1.0.0-alpha.49 → 1.0.0-alpha.50
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
|
@@ -22,9 +22,7 @@ const props = defineProps({
|
|
|
22
22
|
type: String,
|
|
23
23
|
},
|
|
24
24
|
})
|
|
25
|
-
const
|
|
26
|
-
const currentRoute = computed(() => $router.currentRoute.value.fullPath)
|
|
27
|
-
|
|
25
|
+
const emit = defineEmits(['menuItemClicked', 'closeDrawer'])
|
|
28
26
|
const open = defineModel('open', {
|
|
29
27
|
default: false,
|
|
30
28
|
type: Boolean,
|
|
@@ -34,14 +32,14 @@ const miniState = defineModel('miniState', {
|
|
|
34
32
|
type: Boolean,
|
|
35
33
|
})
|
|
36
34
|
|
|
35
|
+
const $router = useRouter()
|
|
36
|
+
const currentRoute = computed(() => $router.currentRoute.value.fullPath)
|
|
37
|
+
const currentPath = computed(() => getCurrentPath())
|
|
38
|
+
|
|
37
39
|
const getCurrentPath = (int = 1) => {
|
|
38
40
|
return currentRoute.value.split('/')[int]
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
const currentPath = computed(() => getCurrentPath())
|
|
42
|
-
|
|
43
|
-
const emit = defineEmits(['menuItemClicked', 'closeDrawer'])
|
|
44
|
-
|
|
45
43
|
const handleClick = (menu) => {
|
|
46
44
|
emit('menuItemClicked', menu)
|
|
47
45
|
}
|
|
@@ -62,13 +60,13 @@ const getXOffset = (label) => {
|
|
|
62
60
|
<template>
|
|
63
61
|
<q-drawer
|
|
64
62
|
v-model="open"
|
|
65
|
-
|
|
63
|
+
:class="`u-drawer ${miniState ? 'u-mini-drawer' : ''}`"
|
|
64
|
+
:breakpoint="400"
|
|
66
65
|
:mini="miniState"
|
|
67
|
-
:width="224"
|
|
68
66
|
:mini-width="64"
|
|
69
|
-
:breakpoint="400"
|
|
70
|
-
:class="`u-drawer ${miniState ? 'u-mini-drawer' : ''}`"
|
|
71
67
|
side="left"
|
|
68
|
+
show-if-above
|
|
69
|
+
:width="224"
|
|
72
70
|
>
|
|
73
71
|
<q-scroll-area class="u-drawer-scrollable-area">
|
|
74
72
|
<div
|
|
@@ -82,17 +80,17 @@ const getXOffset = (label) => {
|
|
|
82
80
|
>
|
|
83
81
|
<img
|
|
84
82
|
v-if="!miniState"
|
|
85
|
-
|
|
83
|
+
class="full-logo"
|
|
86
84
|
alt="usssa-logo"
|
|
87
85
|
aria-label="usssa logo"
|
|
88
|
-
|
|
86
|
+
:src="`${brandLogo}`"
|
|
89
87
|
/>
|
|
90
88
|
<img
|
|
91
89
|
v-else
|
|
92
|
-
|
|
90
|
+
class="mini-state-logo"
|
|
93
91
|
alt="usssa-logo"
|
|
94
92
|
aria-label="usssa logo"
|
|
95
|
-
|
|
93
|
+
:src="brandMiniLogo"
|
|
96
94
|
/>
|
|
97
95
|
</NuxtLink>
|
|
98
96
|
<div
|
|
@@ -100,13 +98,13 @@ const getXOffset = (label) => {
|
|
|
100
98
|
class="drawer-open-close-icon-wrapper flex items-center justify-center"
|
|
101
99
|
>
|
|
102
100
|
<UBtnIcon
|
|
103
|
-
ref="btn-icon"
|
|
104
|
-
size="sm"
|
|
105
101
|
ariaLabel="Sidebar shrink icon"
|
|
106
102
|
color="primary"
|
|
103
|
+
dense
|
|
107
104
|
iconClass="fa-kit-duotone fa-sidebar-shrink"
|
|
105
|
+
ref="btn-icon"
|
|
106
|
+
size="sm"
|
|
108
107
|
@click="handleCloseDrawer"
|
|
109
|
-
dense
|
|
110
108
|
/>
|
|
111
109
|
</div>
|
|
112
110
|
</div>
|
|
@@ -116,12 +114,12 @@ const getXOffset = (label) => {
|
|
|
116
114
|
>
|
|
117
115
|
<template v-for="(m, i) in menu" :key="i">
|
|
118
116
|
<UMenuItem
|
|
117
|
+
:class="`drawer-items ${miniState ? 'mini-menu-box' : ''}`"
|
|
118
|
+
:id="`u-drawer-menu-${i}`"
|
|
119
119
|
:label="m.label"
|
|
120
120
|
:left-icon="m.leftIcon"
|
|
121
|
-
@onClick="handleClick(m)"
|
|
122
|
-
:id="`u-drawer-menu-${i}`"
|
|
123
121
|
:selected="currentPath === m.to.replaceAll('/', '')"
|
|
124
|
-
|
|
122
|
+
@onClick="handleClick(m)"
|
|
125
123
|
>
|
|
126
124
|
<template v-if="!miniState" #trailing_slot>
|
|
127
125
|
<UBadgeStd v-if="m.badgeInfo" size="lg" :label="m.badgeInfo" />
|
|
@@ -212,4 +210,6 @@ const getXOffset = (label) => {
|
|
|
212
210
|
.drawer-menu-list
|
|
213
211
|
.non-active-right-icon
|
|
214
212
|
color: $dark !important
|
|
213
|
+
.drawer-items
|
|
214
|
+
margin-bottom: $xs!important
|
|
215
215
|
</style>
|
|
@@ -42,7 +42,6 @@ const props = defineProps({
|
|
|
42
42
|
<template #leading_slot>
|
|
43
43
|
<slot name="leading_slot"></slot>
|
|
44
44
|
</template>
|
|
45
|
-
|
|
46
45
|
<template #trailing_slot>
|
|
47
46
|
<slot name="trailing_slot"></slot>
|
|
48
47
|
</template>
|
|
@@ -53,21 +52,24 @@ const props = defineProps({
|
|
|
53
52
|
|
|
54
53
|
<style lang="sass">
|
|
55
54
|
.u-menu-dropdown
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
55
|
+
width: 11.5rem
|
|
56
|
+
padding: $xxs
|
|
57
|
+
flex-direction: column
|
|
58
|
+
align-items: flex-start
|
|
59
|
+
gap: q-my-xxs
|
|
60
|
+
flex-shrink: 0
|
|
61
|
+
border-radius: $xs
|
|
62
|
+
background: $neutral-1
|
|
63
|
+
box-shadow: 0px 0px 4px 0px rgba(16, 17, 20, 0.08)
|
|
64
|
+
&.size-sm
|
|
66
65
|
min-width: 11.5rem
|
|
67
66
|
max-width: 11.5rem
|
|
68
|
-
|
|
67
|
+
&.size-md
|
|
69
68
|
min-width: 11.75rem
|
|
70
69
|
max-width: 15rem
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
&.size-lg
|
|
71
|
+
width: 18rem
|
|
72
|
+
.u-menu-link
|
|
73
|
+
&.q-item:last-child
|
|
74
|
+
margin-bottom: 0px
|
|
73
75
|
</style>
|
|
@@ -32,21 +32,11 @@ const props = defineProps({
|
|
|
32
32
|
},
|
|
33
33
|
})
|
|
34
34
|
|
|
35
|
-
const type = ref(props.destructive ? 'destructive' : 'default')
|
|
36
|
-
|
|
37
|
-
watch(
|
|
38
|
-
() => props.destructive,
|
|
39
|
-
(newValue) => {
|
|
40
|
-
type.value = newValue ? 'destructive' : 'default'
|
|
41
|
-
}
|
|
42
|
-
)
|
|
43
|
-
|
|
44
35
|
const emit = defineEmits(['onClick'])
|
|
45
36
|
|
|
46
|
-
const
|
|
47
|
-
return emit('onClick')
|
|
48
|
-
}
|
|
37
|
+
const type = ref(props.destructive ? 'destructive' : 'default')
|
|
49
38
|
|
|
39
|
+
/* Computed variables */
|
|
50
40
|
const labelColor = computed(() => {
|
|
51
41
|
if (props.destructive) {
|
|
52
42
|
return 'text-red-6'
|
|
@@ -55,7 +45,6 @@ const labelColor = computed(() => {
|
|
|
55
45
|
}
|
|
56
46
|
return 'text-dark'
|
|
57
47
|
})
|
|
58
|
-
|
|
59
48
|
const iconColor = computed(() => {
|
|
60
49
|
if (props.destructive) {
|
|
61
50
|
return 'red-6'
|
|
@@ -64,53 +53,58 @@ const iconColor = computed(() => {
|
|
|
64
53
|
}
|
|
65
54
|
return 'dark'
|
|
66
55
|
})
|
|
67
|
-
|
|
68
56
|
const backgroundColor = computed(() => {
|
|
69
57
|
if (props.selected && !props.destructive) {
|
|
70
58
|
return 'bg-blue-1'
|
|
71
59
|
}
|
|
72
60
|
return 'bg-neutral-1'
|
|
73
61
|
})
|
|
74
|
-
</script>
|
|
75
|
-
|
|
76
|
-
<template>
|
|
77
|
-
<div v-if="!hide" class="u-menu-link">
|
|
78
|
-
<q-item
|
|
79
|
-
:class="`${backgroundColor} item-${type} u-menu-link q-mb-xxs`"
|
|
80
|
-
clickable
|
|
81
|
-
role="button"
|
|
82
|
-
tabindex="0"
|
|
83
|
-
:aria-label="label"
|
|
84
|
-
:disable="disable"
|
|
85
|
-
@click="handleClick"
|
|
86
|
-
>
|
|
87
|
-
<q-item-section side v-if="leftIcon">
|
|
88
|
-
<q-icon
|
|
89
|
-
:color="iconColor"
|
|
90
|
-
:class="`${leftIcon} ${iconClass}`"
|
|
91
|
-
size="1rem"
|
|
92
|
-
:aria-hidden="true"
|
|
93
|
-
/>
|
|
94
|
-
</q-item-section>
|
|
95
|
-
|
|
96
|
-
<slot name="leading_slot"></slot>
|
|
97
62
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
63
|
+
const handleClick = () => {
|
|
64
|
+
return emit('onClick')
|
|
65
|
+
}
|
|
101
66
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
</q-item-section>
|
|
67
|
+
watch(
|
|
68
|
+
() => props.destructive,
|
|
69
|
+
(newValue) => {
|
|
70
|
+
type.value = newValue ? 'destructive' : 'default'
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
</script>
|
|
110
74
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
75
|
+
<template>
|
|
76
|
+
<q-item
|
|
77
|
+
v-if="!hide"
|
|
78
|
+
:class="`${backgroundColor} item-${type} u-menu-link q-mb-xxs`"
|
|
79
|
+
:aria-label="label"
|
|
80
|
+
clickable
|
|
81
|
+
:disable="disable"
|
|
82
|
+
role="button"
|
|
83
|
+
tabindex="0"
|
|
84
|
+
@click="handleClick"
|
|
85
|
+
>
|
|
86
|
+
<q-item-section v-if="leftIcon" side>
|
|
87
|
+
<q-icon
|
|
88
|
+
:class="`${leftIcon} ${iconClass}`"
|
|
89
|
+
:aria-hidden="true"
|
|
90
|
+
:color="iconColor"
|
|
91
|
+
size="1rem"
|
|
92
|
+
/>
|
|
93
|
+
</q-item-section>
|
|
94
|
+
<slot name="leading_slot"></slot>
|
|
95
|
+
<q-item-section class="text-body-sm label" :class="labelColor">
|
|
96
|
+
{{ label }}
|
|
97
|
+
</q-item-section>
|
|
98
|
+
<q-item-section v-if="rightIcon" side>
|
|
99
|
+
<q-icon
|
|
100
|
+
:class="`${rightIcon} ${iconClass}`"
|
|
101
|
+
:color="iconColor"
|
|
102
|
+
size="1rem"
|
|
103
|
+
:aria-hidden="true"
|
|
104
|
+
/>
|
|
105
|
+
</q-item-section>
|
|
106
|
+
<slot name="trailing_slot"></slot>
|
|
107
|
+
</q-item>
|
|
114
108
|
</template>
|
|
115
109
|
|
|
116
110
|
<style lang="sass">
|