@usssa/component-library 1.0.0-alpha.21 → 1.0.0-alpha.23
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 +1 -1
- package/package.json +1 -1
- package/src/components/core/UInputPhoneStd.vue +0 -1
- package/src/components/core/UMenutem.vue +130 -0
- package/src/components/core/UPagination.vue +1 -3
- package/src/components/index.js +2 -0
- package/src/css/app.sass +3 -0
- package/src/css/quasar.variables.sass +6 -6
- package/src/layouts/MainLayout.vue +4 -0
- package/src/pages/MenuItem.vue +68 -0
- package/src/router/routes.js +4 -0
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, ref, watch } from 'vue'
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
leftIcon: {
|
|
6
|
+
type: String,
|
|
7
|
+
},
|
|
8
|
+
rightIcon: {
|
|
9
|
+
type: String,
|
|
10
|
+
},
|
|
11
|
+
label: {
|
|
12
|
+
type: String,
|
|
13
|
+
},
|
|
14
|
+
selected: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: false,
|
|
17
|
+
},
|
|
18
|
+
destructive: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: false,
|
|
21
|
+
},
|
|
22
|
+
iconClass: {
|
|
23
|
+
type: String,
|
|
24
|
+
},
|
|
25
|
+
onClick: {
|
|
26
|
+
type: Function,
|
|
27
|
+
},
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
const type = ref(props.destructive ? 'destructive' : 'default')
|
|
31
|
+
|
|
32
|
+
watch(
|
|
33
|
+
() => props.destructive,
|
|
34
|
+
(newValue) => {
|
|
35
|
+
type.value = newValue ? 'destructive' : 'default'
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
const emit = defineEmits(['onClick'])
|
|
40
|
+
|
|
41
|
+
const handleClick = () => {
|
|
42
|
+
return emit('onClick')
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const labelColor = computed(() => {
|
|
46
|
+
if (props.destructive) {
|
|
47
|
+
return 'text-red-6'
|
|
48
|
+
} else if (props.selected) {
|
|
49
|
+
return 'text-primary'
|
|
50
|
+
}
|
|
51
|
+
return 'text-dark'
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
const iconColor = computed(() => {
|
|
55
|
+
if (props.destructive) {
|
|
56
|
+
return 'red-6'
|
|
57
|
+
} else if (props.selected) {
|
|
58
|
+
return 'primary'
|
|
59
|
+
}
|
|
60
|
+
return 'dark'
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
const backgroundColor = computed(() => {
|
|
64
|
+
if (props.selected && !props.destructive) {
|
|
65
|
+
return 'bg-blue-1'
|
|
66
|
+
}
|
|
67
|
+
return 'bg-neutral-1'
|
|
68
|
+
})
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<template>
|
|
72
|
+
<div class="u-menu-link">
|
|
73
|
+
<q-item
|
|
74
|
+
clickable
|
|
75
|
+
:class="`${backgroundColor} item-${type}`"
|
|
76
|
+
@click="handleClick"
|
|
77
|
+
>
|
|
78
|
+
<q-item-section side v-if="leftIcon">
|
|
79
|
+
<q-icon
|
|
80
|
+
:color="iconColor"
|
|
81
|
+
:class="`${leftIcon} ${iconClass}`"
|
|
82
|
+
size="1rem"
|
|
83
|
+
:aria-hidden="true"
|
|
84
|
+
/>
|
|
85
|
+
</q-item-section>
|
|
86
|
+
|
|
87
|
+
<slot name="leading_slot"></slot>
|
|
88
|
+
|
|
89
|
+
<q-item-section class="text-body-sm label" :class="labelColor">
|
|
90
|
+
{{ label }}
|
|
91
|
+
</q-item-section>
|
|
92
|
+
|
|
93
|
+
<q-item-section side v-if="rightIcon">
|
|
94
|
+
<q-icon
|
|
95
|
+
:color="iconColor"
|
|
96
|
+
:class="`${rightIcon} ${iconClass}`"
|
|
97
|
+
size="1rem"
|
|
98
|
+
:aria-hidden="true"
|
|
99
|
+
/>
|
|
100
|
+
</q-item-section>
|
|
101
|
+
|
|
102
|
+
<slot name="trailing_slot"></slot>
|
|
103
|
+
</q-item>
|
|
104
|
+
</div>
|
|
105
|
+
</template>
|
|
106
|
+
|
|
107
|
+
<style lang="sass">
|
|
108
|
+
.u-menu-link
|
|
109
|
+
.q-item
|
|
110
|
+
border-radius: $xxs
|
|
111
|
+
padding: 0rem $xs
|
|
112
|
+
align-items: center
|
|
113
|
+
display: flex
|
|
114
|
+
min-height: $lg
|
|
115
|
+
gap: $xs
|
|
116
|
+
.q-item__section--avatar
|
|
117
|
+
min-width: 0px
|
|
118
|
+
.q-item__section--side
|
|
119
|
+
padding: 0px
|
|
120
|
+
&.item-destructive
|
|
121
|
+
&.q-hoverable:hover > .q-focus-helper:after
|
|
122
|
+
background: $red-6
|
|
123
|
+
opacity: 1
|
|
124
|
+
&.item-default
|
|
125
|
+
&.q-hoverable:hover > .q-focus-helper:after
|
|
126
|
+
background: $surface-bg-link-hover
|
|
127
|
+
opacity: 1
|
|
128
|
+
.label
|
|
129
|
+
word-break: break-all
|
|
130
|
+
</style>
|
|
@@ -46,7 +46,7 @@ const onRowChange = (newRowPerPage) => {
|
|
|
46
46
|
</script>
|
|
47
47
|
|
|
48
48
|
<template>
|
|
49
|
-
<div class="row u-pagination-container">
|
|
49
|
+
<div class="row u-pagination-container">
|
|
50
50
|
<q-pagination
|
|
51
51
|
class="u-pagination"
|
|
52
52
|
v-model="currentPage"
|
|
@@ -58,8 +58,6 @@ const onRowChange = (newRowPerPage) => {
|
|
|
58
58
|
:max-pages="maxPageLink"
|
|
59
59
|
boundary-numbers
|
|
60
60
|
@update:model-value="onPageChange"
|
|
61
|
-
icon-prev="img:icons/chevron-left.svg"
|
|
62
|
-
icon-next="img:icons/chevron-right.svg"
|
|
63
61
|
gutter="sm"
|
|
64
62
|
/>
|
|
65
63
|
|
package/src/components/index.js
CHANGED
|
@@ -20,6 +20,7 @@ import UInputPhoneStd from './core/UInputPhoneStd.vue'
|
|
|
20
20
|
import UInputTextStd from './core/UInputTextStd.vue'
|
|
21
21
|
import UDialogStd from './core/UDialogStd.vue'
|
|
22
22
|
import URadioBtn from './core/URadioBtn.vue'
|
|
23
|
+
import UMenuItem from './core/UMenutem.vue'
|
|
23
24
|
|
|
24
25
|
import { useNotify } from '../composables/useNotify.js'
|
|
25
26
|
|
|
@@ -46,4 +47,5 @@ export {
|
|
|
46
47
|
useNotify,
|
|
47
48
|
UDialogStd,
|
|
48
49
|
UInputPhoneStd,
|
|
50
|
+
UMenuItem,
|
|
49
51
|
}
|
package/src/css/app.sass
CHANGED
|
@@ -50,10 +50,10 @@ $h4-sm: (size: 1.00rem , line-height: 1.25rem, letter-spacing: .35px, weight: bo
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
// DESKTOP
|
|
53
|
-
$caption-lg:
|
|
54
|
-
$caption-md:
|
|
55
|
-
$caption-sm:
|
|
56
|
-
$caption-xs:
|
|
53
|
+
$caption-lg: (size: 1rem, line-height: 1.25rem, letter-spacing: .03333rem, weight: 500) !default
|
|
54
|
+
$caption-md: (size: 0.875rem, line-height: 1.25rem, letter-spacing: .03333rem, weight: 500) !default
|
|
55
|
+
$caption-sm: (size: 0.75rem, line-height: 1.25rem, letter-spacing: .03333rem, weight: 500) !default
|
|
56
|
+
$caption-xs: (size: 0.688rem, line-height: 1.25rem, letter-spacing: .03333rem, weight: 500) !default
|
|
57
57
|
|
|
58
58
|
$body-xl: (size: 1.25rem, line-height: 2.5rem, letter-spacing: .03215rem, weight: 400) !default
|
|
59
59
|
$body-lg: (size: 1.125rem, line-height: 1.75rem, letter-spacing: .03215rem, weight: 400) !default
|
|
@@ -115,5 +115,5 @@ $shadow-inner: 0px 0px 1px 1px rgb(16, 17, 20, .12) inset
|
|
|
115
115
|
$shadow-skeumorphic-primary: 0px 1px 0.4px 0px rgba(136, 136, 138, 0.40) inset, 0px -1px 0.4px 0px rgba(16, 17, 20, 0.40) inset, 0px 4px 10px 0px rgba(16,17,20,0.00), 0px 0px 0px 1px rgb(35,75,169)
|
|
116
116
|
$stroke-skeuomorphic: 1px solid rgba(255, 255, 255, 0.12)
|
|
117
117
|
$shadow-2: 0px 0px 8px 0px rgba(16, 17, 20, 0.12)
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
$accent-bg-hover: rgba(203, 42, 61, 0.15)
|
|
119
|
+
$surface-bg-link-hover :rgba(16, 17, 20, .5)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import { UMenuItem } from 'src/components'
|
|
4
|
+
import ComponentBase from './ComponentBase.vue'
|
|
5
|
+
|
|
6
|
+
const leftIcon = ref('fa-kit-duotone fa-home')
|
|
7
|
+
const rightIcon = ref('fa-kit-duotone fa-circle-check')
|
|
8
|
+
const label = ref('Label')
|
|
9
|
+
const selected = ref(false)
|
|
10
|
+
const destructive = ref(false)
|
|
11
|
+
|
|
12
|
+
const htmlContent = `<UMenuItem
|
|
13
|
+
:label="label"
|
|
14
|
+
:leftIcon="leftIcon"
|
|
15
|
+
:rightIcon="rightIcon"
|
|
16
|
+
:selected="selected"
|
|
17
|
+
:destructive="destructive"
|
|
18
|
+
/>`
|
|
19
|
+
|
|
20
|
+
defineOptions({
|
|
21
|
+
name: 'UMenuItem',
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
const handleClick = () => {
|
|
25
|
+
console.log('item clicked')
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<q-page class="flex flex-center">
|
|
31
|
+
<ComponentBase
|
|
32
|
+
figmaUrl="https://www.figma.com/design/2FoTrjVL4ZrTdsvB4DcSao/Components?node-id=4-24&node-type=canvas&t=nWq2UjUIdqvWKgPg-0"
|
|
33
|
+
>
|
|
34
|
+
<template v-slot:component>
|
|
35
|
+
<UMenuItem
|
|
36
|
+
:label="label"
|
|
37
|
+
:leftIcon="leftIcon"
|
|
38
|
+
:rightIcon="rightIcon"
|
|
39
|
+
:selected="selected"
|
|
40
|
+
:destructive="destructive"
|
|
41
|
+
iconClass="icon-secondary-opacity"
|
|
42
|
+
@onClick="handleClick"
|
|
43
|
+
/>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<template v-slot:properties>
|
|
47
|
+
<div class="q-gutter-y-lg">
|
|
48
|
+
<q-input label="Label" v-model="label" />
|
|
49
|
+
<q-input label="Left Icon" v-model="leftIcon" />
|
|
50
|
+
<q-input label="Right Icon" v-model="rightIcon" />
|
|
51
|
+
<div>
|
|
52
|
+
<q-checkbox
|
|
53
|
+
size="xs"
|
|
54
|
+
v-model="selected"
|
|
55
|
+
label="Selected"
|
|
56
|
+
v-if="!destructive"
|
|
57
|
+
/>
|
|
58
|
+
<q-checkbox size="xs" v-model="destructive" label="Destructive" />
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</template>
|
|
62
|
+
|
|
63
|
+
<template v-slot:code>
|
|
64
|
+
<pre>{{ htmlContent }}</pre>
|
|
65
|
+
</template>
|
|
66
|
+
</ComponentBase>
|
|
67
|
+
</q-page>
|
|
68
|
+
</template>
|