@saasmakers/ui 2.0.49 → 2.0.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.
|
@@ -25,10 +25,8 @@ defineSlots<{
|
|
|
25
25
|
default?: () => VNode[]
|
|
26
26
|
}>()
|
|
27
27
|
|
|
28
|
-
const isHorizontal = computed(() => props.orientation === 'horizontal')
|
|
29
|
-
|
|
30
28
|
const hasMediaBox = computed<boolean>(() => {
|
|
31
|
-
return !!(props.image || (props.emoji &&
|
|
29
|
+
return !!(props.image || (props.emoji && props.orientation !== 'horizontal'))
|
|
32
30
|
})
|
|
33
31
|
|
|
34
32
|
const isClickable = computed(() => {
|
|
@@ -48,12 +46,12 @@ function onClick(event: MouseEvent) {
|
|
|
48
46
|
'cursor-default': !isClickable,
|
|
49
47
|
'cursor-pointer': isClickable,
|
|
50
48
|
'opacity-50': disabled,
|
|
51
|
-
'base-surface h-12 overflow-hidden pl-2 pr-2.5':
|
|
52
|
-
'base-surface p-3':
|
|
49
|
+
'base-surface h-12 overflow-hidden pl-2 pr-2.5': orientation === 'horizontal',
|
|
50
|
+
'base-surface p-3': orientation !== 'horizontal',
|
|
53
51
|
'base-border-hover': isClickable,
|
|
54
|
-
'rounded-lg':
|
|
55
|
-
'rounded-xl':
|
|
56
|
-
'relative':
|
|
52
|
+
'rounded-lg': orientation === 'horizontal',
|
|
53
|
+
'rounded-xl': orientation !== 'horizontal',
|
|
54
|
+
'relative': orientation !== 'horizontal',
|
|
57
55
|
}"
|
|
58
56
|
:to="disabled ? undefined : to"
|
|
59
57
|
@click="onClick"
|
|
@@ -61,19 +59,19 @@ function onClick(event: MouseEvent) {
|
|
|
61
59
|
<div
|
|
62
60
|
class="flex overflow-hidden"
|
|
63
61
|
:class="{
|
|
64
|
-
'h-12 w-full flex-row items-center text-left':
|
|
65
|
-
'flex-col items-center text-center':
|
|
62
|
+
'h-12 w-full flex-row items-center text-left': orientation === 'horizontal',
|
|
63
|
+
'flex-col items-center text-center': orientation !== 'horizontal',
|
|
66
64
|
}"
|
|
67
65
|
>
|
|
68
66
|
<span
|
|
69
67
|
class="flex items-center"
|
|
70
68
|
:class="{
|
|
71
|
-
'shrink-0 justify-center':
|
|
72
|
-
'justify-center':
|
|
69
|
+
'shrink-0 justify-center': orientation === 'horizontal',
|
|
70
|
+
'justify-center': orientation !== 'horizontal',
|
|
73
71
|
}"
|
|
74
72
|
>
|
|
75
73
|
<BaseEmoji
|
|
76
|
-
v-if="emoji &&
|
|
74
|
+
v-if="emoji && orientation === 'horizontal'"
|
|
77
75
|
class="mr-2 shrink-0 bg-gray-100 flex-initial dark:bg-gray-900"
|
|
78
76
|
:clickable="false"
|
|
79
77
|
:emoji="emoji"
|
|
@@ -84,15 +82,15 @@ function onClick(event: MouseEvent) {
|
|
|
84
82
|
v-if="hasMediaBox"
|
|
85
83
|
class="relative z-10 flex items-center justify-center flex-initial"
|
|
86
84
|
:class="{
|
|
87
|
-
'border shadow-inner rounded-lg base-border bg-gray-100 dark:bg-gray-900': !image && (!emoji ||
|
|
88
|
-
'mr-2':
|
|
89
|
-
'mb-2':
|
|
90
|
-
'h-9 w-9':
|
|
91
|
-
'h-20 w-20':
|
|
85
|
+
'border shadow-inner rounded-lg base-border bg-gray-100 dark:bg-gray-900': !image && (!emoji || orientation !== 'horizontal'),
|
|
86
|
+
'mr-2': orientation === 'horizontal',
|
|
87
|
+
'mb-2': orientation !== 'horizontal',
|
|
88
|
+
'h-9 w-9': orientation === 'horizontal',
|
|
89
|
+
'h-20 w-20': orientation !== 'horizontal',
|
|
92
90
|
}"
|
|
93
91
|
>
|
|
94
92
|
<BaseEmoji
|
|
95
|
-
v-if="emoji &&
|
|
93
|
+
v-if="emoji && orientation !== 'horizontal'"
|
|
96
94
|
class="m-0.5"
|
|
97
95
|
:emoji="emoji"
|
|
98
96
|
:has-box="false"
|
|
@@ -102,8 +100,8 @@ function onClick(event: MouseEvent) {
|
|
|
102
100
|
v-else-if="image"
|
|
103
101
|
class="select-none rounded-lg object-cover shadow-sm transition-[filter] duration-300 drag-none flex-initial"
|
|
104
102
|
:class="{
|
|
105
|
-
'h-9 w-9':
|
|
106
|
-
'h-20 w-20':
|
|
103
|
+
'h-9 w-9': orientation === 'horizontal',
|
|
104
|
+
'h-20 w-20': orientation !== 'horizontal',
|
|
107
105
|
'grayscale': disabled,
|
|
108
106
|
}"
|
|
109
107
|
:alt="title"
|
|
@@ -116,20 +114,20 @@ function onClick(event: MouseEvent) {
|
|
|
116
114
|
<div
|
|
117
115
|
class="min-w-0 flex flex-col justify-center leading-snug"
|
|
118
116
|
:class="{
|
|
119
|
-
'flex-1':
|
|
120
|
-
'w-full':
|
|
121
|
-
'items-center':
|
|
117
|
+
'flex-1': orientation === 'horizontal',
|
|
118
|
+
'w-full': orientation !== 'horizontal',
|
|
119
|
+
'items-center': orientation !== 'horizontal',
|
|
122
120
|
}"
|
|
123
121
|
>
|
|
124
122
|
<div
|
|
125
123
|
class="w-full flex flex-col"
|
|
126
124
|
:class="{
|
|
127
|
-
'gap-0':
|
|
128
|
-
'gap-1':
|
|
125
|
+
'gap-0': orientation === 'horizontal',
|
|
126
|
+
'gap-1': orientation !== 'horizontal',
|
|
129
127
|
}"
|
|
130
128
|
>
|
|
131
129
|
<p
|
|
132
|
-
v-if="title &&
|
|
130
|
+
v-if="title && orientation === 'horizontal'"
|
|
133
131
|
class="line-clamp-1 min-w-0 break-words text-xs font-medium tracking-tight uppercase"
|
|
134
132
|
:class="{
|
|
135
133
|
'text-gray-900 dark:text-gray-100': color === 'gray' || color === 'black' || color === 'white',
|
|
@@ -145,12 +143,12 @@ function onClick(event: MouseEvent) {
|
|
|
145
143
|
<BaseIcon
|
|
146
144
|
v-else-if="title"
|
|
147
145
|
class="w-full self-center"
|
|
148
|
-
|
|
146
|
+
size="sm"
|
|
149
147
|
:text="title"
|
|
150
148
|
/>
|
|
151
149
|
|
|
152
150
|
<BaseText
|
|
153
|
-
v-if="description &&
|
|
151
|
+
v-if="description && orientation !== 'horizontal'"
|
|
154
152
|
block
|
|
155
153
|
class="text-gray-600 dark:text-gray-400"
|
|
156
154
|
size="2xs"
|
|
@@ -163,8 +161,8 @@ function onClick(event: MouseEvent) {
|
|
|
163
161
|
v-if="isSelected"
|
|
164
162
|
class="flex-initial"
|
|
165
163
|
:class="{
|
|
166
|
-
'mr-1.5 self-center':
|
|
167
|
-
'absolute right-2 top-2':
|
|
164
|
+
'mr-1.5 self-center': orientation === 'horizontal',
|
|
165
|
+
'absolute right-2 top-2': orientation !== 'horizontal',
|
|
168
166
|
}"
|
|
169
167
|
color="green"
|
|
170
168
|
:icon="getLayerIcon('checkCircle')"
|
|
@@ -172,7 +170,7 @@ function onClick(event: MouseEvent) {
|
|
|
172
170
|
/>
|
|
173
171
|
|
|
174
172
|
<BaseIcon
|
|
175
|
-
v-else-if="
|
|
173
|
+
v-else-if="orientation === 'horizontal' && (to || hasChevron)"
|
|
176
174
|
class="self-center text-gray-500 flex-initial dark:text-gray-500 group-hover:text-gray-900 dark:group-hover:text-gray-100"
|
|
177
175
|
:icon="getLayerIcon('chevronRight')"
|
|
178
176
|
size="xl"
|
|
@@ -100,15 +100,29 @@ function onClick(event: MouseEvent) {
|
|
|
100
100
|
emit('click', event)
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
function onEnterKeyDown(event: KeyboardEvent) {
|
|
104
|
+
if (!props.to) {
|
|
105
|
+
onKeyDown(event)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
103
109
|
function onKeyDown(event: KeyboardEvent) {
|
|
104
110
|
if (isClickable.value) {
|
|
105
111
|
(event.currentTarget as HTMLElement).click()
|
|
106
112
|
}
|
|
107
113
|
}
|
|
114
|
+
|
|
115
|
+
function onSpaceKeyDown(event: KeyboardEvent) {
|
|
116
|
+
if (!props.to) {
|
|
117
|
+
event.preventDefault()
|
|
118
|
+
onKeyDown(event)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
108
121
|
</script>
|
|
109
122
|
|
|
110
123
|
<template>
|
|
111
|
-
<
|
|
124
|
+
<component
|
|
125
|
+
:is="to ? NuxtLinkLocale : 'div'"
|
|
112
126
|
class="flex items-center"
|
|
113
127
|
:class="{
|
|
114
128
|
'group cursor-pointer hover:underline hover:text-black dark:hover:text-white': isClickable && text,
|
|
@@ -116,14 +130,14 @@ function onKeyDown(event: KeyboardEvent) {
|
|
|
116
130
|
'flex-row': !reverse,
|
|
117
131
|
'flex-row-reverse': reverse,
|
|
118
132
|
}"
|
|
119
|
-
:role="isClickable ? 'button' : undefined"
|
|
120
|
-
:tabindex="isClickable ? 0 : undefined"
|
|
133
|
+
:role="isClickable && !to ? 'button' : undefined"
|
|
134
|
+
:tabindex="isClickable && !to ? 0 : undefined"
|
|
135
|
+
:to="to"
|
|
121
136
|
@click="onClick"
|
|
122
|
-
@keydown.enter="
|
|
123
|
-
@keydown.space
|
|
137
|
+
@keydown.enter="onEnterKeyDown"
|
|
138
|
+
@keydown.space="onSpaceKeyDown"
|
|
124
139
|
>
|
|
125
|
-
<
|
|
126
|
-
:is="to ? NuxtLinkLocale : 'span'"
|
|
140
|
+
<span
|
|
127
141
|
v-if="finalIcon && !loading"
|
|
128
142
|
class="flex items-center justify-center"
|
|
129
143
|
:class="{
|
|
@@ -153,10 +167,9 @@ function onKeyDown(event: KeyboardEvent) {
|
|
|
153
167
|
'group-hover:text-orange-700 dark:group-hover:text-orange-300': isClickable && finalColor === 'orange',
|
|
154
168
|
'group-hover:text-red-700 dark:group-hover:text-red-300': isClickable && finalColor === 'red',
|
|
155
169
|
}"
|
|
156
|
-
:to="to"
|
|
157
170
|
>
|
|
158
171
|
<Icon :name="finalIcon" />
|
|
159
|
-
</
|
|
172
|
+
</span>
|
|
160
173
|
|
|
161
174
|
<BaseSpinner
|
|
162
175
|
v-else-if="loading"
|
|
@@ -176,7 +189,7 @@ function onKeyDown(event: KeyboardEvent) {
|
|
|
176
189
|
:truncate="truncate"
|
|
177
190
|
:underline="underline"
|
|
178
191
|
/>
|
|
179
|
-
</
|
|
192
|
+
</component>
|
|
180
193
|
</template>
|
|
181
194
|
|
|
182
195
|
<i18n lang="json">
|