@saasmakers/ui 2.0.46 → 2.0.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.
@@ -39,10 +39,33 @@ const hasAvatarBox = computed<boolean>(() => {
39
39
  return !!(props.avatar || props.emoji || props.icon || props.image)
40
40
  })
41
41
 
42
+ const hasMediaBox = computed<boolean>(() => {
43
+ return !!(props.avatar || props.icon || props.image)
44
+ })
45
+
46
+ const isHorizontal = computed(() => props.orientation === 'horizontal')
47
+
42
48
  const isClickable = computed(() => {
43
49
  return props.to || props.clickable
44
50
  })
45
51
 
52
+ const titleColorClass = computed(() => {
53
+ if (!isHorizontal.value || props.color === 'gray') {
54
+ return 'text-gray-900 dark:text-gray-100'
55
+ }
56
+
57
+ const colorClasses: Partial<Record<BaseColor, string>> = {
58
+ black: 'text-gray-900 dark:text-gray-100',
59
+ green: 'text-green-600 dark:text-green-400',
60
+ indigo: 'text-indigo-600 dark:text-indigo-400',
61
+ orange: 'text-orange-600 dark:text-orange-400',
62
+ red: 'text-red-600 dark:text-red-400',
63
+ white: 'text-gray-900 dark:text-gray-100',
64
+ }
65
+
66
+ return colorClasses[props.color] ?? 'text-gray-900 dark:text-gray-100'
67
+ })
68
+
46
69
  function onClick(event: MouseEvent) {
47
70
  emit('click', event, props.id)
48
71
  }
@@ -56,13 +79,15 @@ function onClick(event: MouseEvent) {
56
79
  'cursor-default': !isClickable,
57
80
  'cursor-pointer': isClickable,
58
81
  'opacity-50': disabled,
59
- 'base-surface p-1.5 pr-2.5': hasBackground && size === 'base' && orientation === 'horizontal',
60
- 'base-surface p-2.5 pr-4': hasBackground && size === 'lg' && orientation === 'horizontal',
61
- 'base-surface p-3': hasBackground && size === 'base' && orientation === 'vertical',
62
- 'base-surface p-4': hasBackground && size === 'lg' && orientation === 'vertical',
82
+ 'base-surface h-12 overflow-hidden pl-2 pr-2.5': hasBackground && size === 'base' && isHorizontal,
83
+ 'base-surface h-14 overflow-hidden pl-3 pr-3': hasBackground && size === 'lg' && isHorizontal,
84
+ 'base-surface p-3': hasBackground && size === 'base' && !isHorizontal,
85
+ 'base-surface p-4': hasBackground && size === 'lg' && !isHorizontal,
86
+ 'w-fit': !hasBackground && isHorizontal,
63
87
  'base-border-hover': hasBackground && isClickable,
64
- 'rounded-xl': hasBackground,
65
- 'relative': orientation === 'vertical',
88
+ 'rounded-lg': hasBackground && isHorizontal,
89
+ 'rounded-xl': hasBackground && !isHorizontal,
90
+ 'relative': !isHorizontal,
66
91
  }"
67
92
  :to="disabled ? undefined : to"
68
93
  @click="onClick"
@@ -70,28 +95,44 @@ function onClick(event: MouseEvent) {
70
95
  <div
71
96
  class="flex overflow-hidden"
72
97
  :class="{
73
- 'flex-row items-center text-left': orientation === 'horizontal',
74
- 'flex-col items-center text-center': orientation === 'vertical',
98
+ 'h-12 w-full flex-row items-center text-left': isHorizontal && size === 'base' && hasBackground,
99
+ 'h-14 w-full flex-row items-center text-left': isHorizontal && size === 'lg' && hasBackground,
100
+ 'flex-row items-center text-left': isHorizontal && !hasBackground,
101
+ 'flex-col items-center text-center': !isHorizontal,
75
102
  }"
76
103
  >
77
- <span class="flex justify-center">
104
+ <span
105
+ class="flex items-center"
106
+ :class="{
107
+ 'shrink-0 justify-center': isHorizontal,
108
+ 'justify-center': !isHorizontal,
109
+ }"
110
+ >
78
111
  <slot name="outerBoxLeft" />
79
112
 
113
+ <BaseEmoji
114
+ v-if="emoji && isHorizontal"
115
+ class="mr-2 shrink-0 bg-gray-100 flex-initial dark:bg-gray-900"
116
+ :clickable="false"
117
+ :emoji="emoji"
118
+ has-box
119
+ />
120
+
80
121
  <span
81
- v-if="hasAvatarBox"
122
+ v-if="hasMediaBox || (emoji && !isHorizontal)"
82
123
  class="relative z-10 flex items-center justify-center flex-initial"
83
124
  :class="{
84
- 'border shadow-inner': !avatar && !image,
85
- 'rounded-lg': !avatar && !image,
86
- 'base-border bg-gray-100 dark:bg-gray-900': !avatar && !image,
87
- 'mr-2': orientation === 'horizontal' && size === 'base',
88
- 'mr-3': orientation === 'horizontal' && size === 'lg',
89
- 'mb-2': orientation === 'vertical' && size === 'base',
90
- 'mb-3': orientation === 'vertical' && size === 'lg',
91
- 'h-9 w-9': size === 'base' && orientation === 'horizontal',
92
- 'h-11 w-11': size === 'lg' && orientation === 'horizontal',
93
- 'h-20 w-20': size === 'base' && orientation === 'vertical',
94
- 'h-24 w-24': size === 'lg' && orientation === 'vertical',
125
+ 'border shadow-inner': !avatar && !image && (!emoji || !isHorizontal),
126
+ 'rounded-lg': !avatar && !image && (!emoji || !isHorizontal),
127
+ 'base-border bg-gray-100 dark:bg-gray-900': !avatar && !image && (!emoji || !isHorizontal),
128
+ 'mr-2': isHorizontal && size === 'base',
129
+ 'mr-3': isHorizontal && size === 'lg',
130
+ 'mb-2': !isHorizontal && size === 'base',
131
+ 'mb-3': !isHorizontal && size === 'lg',
132
+ 'h-9 w-9': size === 'base' && isHorizontal,
133
+ 'h-11 w-11': size === 'lg' && isHorizontal,
134
+ 'h-20 w-20': size === 'base' && !isHorizontal,
135
+ 'h-24 w-24': size === 'lg' && !isHorizontal,
95
136
  }"
96
137
  >
97
138
  <slot name="innerBoxLeft" />
@@ -100,10 +141,10 @@ function onClick(event: MouseEvent) {
100
141
  v-if="avatar"
101
142
  class="rounded-lg flex-initial"
102
143
  :class="{
103
- 'h-10 w-10': size === 'base' && orientation === 'horizontal',
104
- 'h-12 w-12': size === 'lg' && orientation === 'horizontal',
105
- 'h-20 w-20': size === 'base' && orientation === 'vertical',
106
- 'h-24 w-24': size === 'lg' && orientation === 'vertical',
144
+ 'h-10 w-10': size === 'base' && isHorizontal,
145
+ 'h-12 w-12': size === 'lg' && isHorizontal,
146
+ 'h-20 w-20': size === 'base' && !isHorizontal,
147
+ 'h-24 w-24': size === 'lg' && !isHorizontal,
107
148
  }"
108
149
  :src="avatar"
109
150
  />
@@ -127,10 +168,10 @@ function onClick(event: MouseEvent) {
127
168
  v-else-if="image"
128
169
  class="select-none rounded-lg object-cover shadow-sm transition-[filter] duration-300 drag-none flex-initial"
129
170
  :class="{
130
- 'h-9 w-9': size === 'base' && orientation === 'horizontal',
131
- 'h-11 w-11': size === 'lg' && orientation === 'horizontal',
132
- 'h-20 w-20': size === 'base' && orientation === 'vertical',
133
- 'h-24 w-24': size === 'lg' && orientation === 'vertical',
171
+ 'h-9 w-9': size === 'base' && isHorizontal,
172
+ 'h-11 w-11': size === 'lg' && isHorizontal,
173
+ 'h-20 w-20': size === 'base' && !isHorizontal,
174
+ 'h-24 w-24': size === 'lg' && !isHorizontal,
134
175
  'grayscale': disabled,
135
176
  }"
136
177
  :alt="title"
@@ -147,11 +188,11 @@ function onClick(event: MouseEvent) {
147
188
  <div
148
189
  class="min-w-0 flex flex-col justify-center leading-snug"
149
190
  :class="{
150
- 'flex-1': orientation === 'horizontal',
151
- 'w-full': orientation === 'vertical',
152
- 'mr-4': orientation === 'horizontal' && size === 'base',
153
- 'mr-5': orientation === 'horizontal' && size === 'lg',
154
- 'items-center': orientation === 'vertical',
191
+ 'flex-1': isHorizontal && hasBackground,
192
+ 'w-full': !isHorizontal,
193
+ 'mr-4': isHorizontal && size === 'base' && (to || hasChevron),
194
+ 'mr-5': isHorizontal && size === 'lg' && (to || hasChevron),
195
+ 'items-center': !isHorizontal,
155
196
  }"
156
197
  >
157
198
  <div
@@ -159,22 +200,31 @@ function onClick(event: MouseEvent) {
159
200
  :class="{
160
201
  'gap-0': size === 'base',
161
202
  'gap-0.5': size === 'lg',
162
- 'gap-1': orientation === 'vertical' && size === 'base',
163
- 'gap-1.5': orientation === 'vertical' && size === 'lg',
203
+ 'gap-1': !isHorizontal && size === 'base',
204
+ 'gap-1.5': !isHorizontal && size === 'lg',
164
205
  }"
165
206
  >
207
+ <p
208
+ v-if="title && isHorizontal && !titleIcon && hasBackground"
209
+ class="line-clamp-1 min-w-0 break-words text-xs font-medium tracking-tight uppercase"
210
+ :class="titleColorClass"
211
+ >
212
+ {{ title }}
213
+ </p>
214
+
166
215
  <BaseIcon
167
- v-if="title"
216
+ v-else-if="title"
168
217
  class="w-full"
169
218
  :class="{ 'self-center': !hasAvatarBox }"
219
+ :color="isHorizontal ? color : undefined"
170
220
  :icon="titleIcon"
171
221
  :size="size === 'lg' ? 'base' : 'sm'"
172
222
  :text="title"
173
- :truncate="orientation === 'horizontal'"
223
+ :truncate="isHorizontal"
174
224
  />
175
225
 
176
226
  <BaseText
177
- v-if="description"
227
+ v-if="description && !isHorizontal"
178
228
  block
179
229
  class="text-gray-600 dark:text-gray-400"
180
230
  :size="size === 'lg' ? 'xs' : '2xs'"
@@ -187,9 +237,9 @@ function onClick(event: MouseEvent) {
187
237
  v-if="isSelected"
188
238
  class="flex-initial"
189
239
  :class="{
190
- 'mr-1.5 self-center': orientation === 'horizontal',
191
- 'absolute right-2 top-2': orientation === 'vertical' && size === 'base',
192
- 'absolute right-2.5 top-2.5': orientation === 'vertical' && size === 'lg',
240
+ 'mr-1.5 self-center': isHorizontal,
241
+ 'absolute right-2 top-2': !isHorizontal && size === 'base',
242
+ 'absolute right-2.5 top-2.5': !isHorizontal && size === 'lg',
193
243
  }"
194
244
  color="green"
195
245
  :icon="getLayerIcon('checkCircle')"
@@ -197,7 +247,7 @@ function onClick(event: MouseEvent) {
197
247
  />
198
248
 
199
249
  <BaseIcon
200
- v-else-if="orientation === 'horizontal' && (to || hasChevron)"
250
+ v-else-if="isHorizontal && (to || hasChevron)"
201
251
  class="self-center text-gray-500 flex-initial dark:text-gray-500 group-hover:text-gray-900 dark:group-hover:text-gray-100"
202
252
  :icon="getLayerIcon('chevronRight')"
203
253
  :size="size === 'lg' ? '2xl' : 'xl'"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saasmakers/ui",
3
- "version": "2.0.46",
3
+ "version": "2.0.48",
4
4
  "private": false,
5
5
  "description": "Reusable Nuxt UI components for SaaS Makers projects",
6
6
  "license": "MIT",
@@ -60,6 +60,7 @@
60
60
  "devDependencies": {
61
61
  "nuxt": "4.3.1",
62
62
  "typescript": "5.9.3",
63
+ "vue-tsc": "3.3.7",
63
64
  "@saasmakers/apps-helpers": "0.1.0",
64
65
  "@saasmakers/shared": "0.2.8"
65
66
  },