@saasmakers/ui 2.0.48 → 2.0.49

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.
@@ -3,22 +3,17 @@ import { NuxtLinkLocale } from '#components'
3
3
  import type { BaseCard } from '../../types/bases'
4
4
 
5
5
  const props = withDefaults(defineProps<BaseCard>(), {
6
- avatar: '',
7
6
  clickable: true,
8
7
  color: 'gray',
9
8
  description: '',
10
9
  disabled: false,
11
10
  emoji: undefined,
12
- hasBackground: true,
13
11
  hasChevron: false,
14
- icon: undefined,
15
12
  id: undefined,
16
13
  image: '',
17
14
  isSelected: false,
18
15
  orientation: 'horizontal',
19
- size: 'base',
20
16
  title: undefined,
21
- titleIcon: undefined,
22
17
  to: undefined,
23
18
  })
24
19
 
@@ -28,44 +23,18 @@ const emit = defineEmits<{
28
23
 
29
24
  defineSlots<{
30
25
  default?: () => VNode[]
31
- innerBoxLeft?: () => VNode[]
32
- innerBoxRight?: () => VNode[]
33
- outerBoxLeft?: () => VNode[]
34
- outerBoxRight?: () => VNode[]
35
- right?: () => VNode[]
36
26
  }>()
37
27
 
38
- const hasAvatarBox = computed<boolean>(() => {
39
- return !!(props.avatar || props.emoji || props.icon || props.image)
40
- })
28
+ const isHorizontal = computed(() => props.orientation === 'horizontal')
41
29
 
42
30
  const hasMediaBox = computed<boolean>(() => {
43
- return !!(props.avatar || props.icon || props.image)
31
+ return !!(props.image || (props.emoji && !isHorizontal.value))
44
32
  })
45
33
 
46
- const isHorizontal = computed(() => props.orientation === 'horizontal')
47
-
48
34
  const isClickable = computed(() => {
49
35
  return props.to || props.clickable
50
36
  })
51
37
 
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
-
69
38
  function onClick(event: MouseEvent) {
70
39
  emit('click', event, props.id)
71
40
  }
@@ -79,14 +48,11 @@ function onClick(event: MouseEvent) {
79
48
  'cursor-default': !isClickable,
80
49
  'cursor-pointer': isClickable,
81
50
  'opacity-50': disabled,
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,
87
- 'base-border-hover': hasBackground && isClickable,
88
- 'rounded-lg': hasBackground && isHorizontal,
89
- 'rounded-xl': hasBackground && !isHorizontal,
51
+ 'base-surface h-12 overflow-hidden pl-2 pr-2.5': isHorizontal,
52
+ 'base-surface p-3': !isHorizontal,
53
+ 'base-border-hover': isClickable,
54
+ 'rounded-lg': isHorizontal,
55
+ 'rounded-xl': !isHorizontal,
90
56
  'relative': !isHorizontal,
91
57
  }"
92
58
  :to="disabled ? undefined : to"
@@ -95,9 +61,7 @@ function onClick(event: MouseEvent) {
95
61
  <div
96
62
  class="flex overflow-hidden"
97
63
  :class="{
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,
64
+ 'h-12 w-full flex-row items-center text-left': isHorizontal,
101
65
  'flex-col items-center text-center': !isHorizontal,
102
66
  }"
103
67
  >
@@ -108,8 +72,6 @@ function onClick(event: MouseEvent) {
108
72
  'justify-center': !isHorizontal,
109
73
  }"
110
74
  >
111
- <slot name="outerBoxLeft" />
112
-
113
75
  <BaseEmoji
114
76
  v-if="emoji && isHorizontal"
115
77
  class="mr-2 shrink-0 bg-gray-100 flex-initial dark:bg-gray-900"
@@ -119,115 +81,79 @@ function onClick(event: MouseEvent) {
119
81
  />
120
82
 
121
83
  <span
122
- v-if="hasMediaBox || (emoji && !isHorizontal)"
84
+ v-if="hasMediaBox"
123
85
  class="relative z-10 flex items-center justify-center flex-initial"
124
86
  :class="{
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,
87
+ 'border shadow-inner rounded-lg base-border bg-gray-100 dark:bg-gray-900': !image && (!emoji || !isHorizontal),
88
+ 'mr-2': isHorizontal,
89
+ 'mb-2': !isHorizontal,
90
+ 'h-9 w-9': isHorizontal,
91
+ 'h-20 w-20': !isHorizontal,
136
92
  }"
137
93
  >
138
- <slot name="innerBoxLeft" />
139
-
140
- <BaseAvatar
141
- v-if="avatar"
142
- class="rounded-lg flex-initial"
143
- :class="{
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,
148
- }"
149
- :src="avatar"
150
- />
151
-
152
94
  <BaseEmoji
153
- v-else-if="emoji"
95
+ v-if="emoji && !isHorizontal"
154
96
  class="m-0.5"
155
97
  :emoji="emoji"
156
98
  :has-box="false"
157
- :size="size === 'lg' ? 'lg' : 'base'"
158
- />
159
-
160
- <BaseIcon
161
- v-else-if="icon"
162
- :color="color"
163
- :icon="icon"
164
- :size="size === 'lg' ? '2xl' : 'lg'"
165
99
  />
166
100
 
167
101
  <img
168
102
  v-else-if="image"
169
103
  class="select-none rounded-lg object-cover shadow-sm transition-[filter] duration-300 drag-none flex-initial"
170
104
  :class="{
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,
105
+ 'h-9 w-9': isHorizontal,
106
+ 'h-20 w-20': !isHorizontal,
175
107
  'grayscale': disabled,
176
108
  }"
177
109
  :alt="title"
178
110
  loading="lazy"
179
111
  :src="image"
180
112
  >
181
-
182
- <slot name="innerBoxRight" />
183
113
  </span>
184
-
185
- <slot name="outerBoxRight" />
186
114
  </span>
187
115
 
188
116
  <div
189
117
  class="min-w-0 flex flex-col justify-center leading-snug"
190
118
  :class="{
191
- 'flex-1': isHorizontal && hasBackground,
119
+ 'flex-1': isHorizontal,
192
120
  'w-full': !isHorizontal,
193
- 'mr-4': isHorizontal && size === 'base' && (to || hasChevron),
194
- 'mr-5': isHorizontal && size === 'lg' && (to || hasChevron),
195
121
  'items-center': !isHorizontal,
196
122
  }"
197
123
  >
198
124
  <div
199
125
  class="w-full flex flex-col"
200
126
  :class="{
201
- 'gap-0': size === 'base',
202
- 'gap-0.5': size === 'lg',
203
- 'gap-1': !isHorizontal && size === 'base',
204
- 'gap-1.5': !isHorizontal && size === 'lg',
127
+ 'gap-0': isHorizontal,
128
+ 'gap-1': !isHorizontal,
205
129
  }"
206
130
  >
207
131
  <p
208
- v-if="title && isHorizontal && !titleIcon && hasBackground"
132
+ v-if="title && isHorizontal"
209
133
  class="line-clamp-1 min-w-0 break-words text-xs font-medium tracking-tight uppercase"
210
- :class="titleColorClass"
134
+ :class="{
135
+ 'text-gray-900 dark:text-gray-100': color === 'gray' || color === 'black' || color === 'white',
136
+ 'text-green-600 dark:text-green-400': color === 'green',
137
+ 'text-indigo-600 dark:text-indigo-400': color === 'indigo',
138
+ 'text-orange-600 dark:text-orange-400': color === 'orange',
139
+ 'text-red-600 dark:text-red-400': color === 'red',
140
+ }"
211
141
  >
212
142
  {{ title }}
213
143
  </p>
214
144
 
215
145
  <BaseIcon
216
146
  v-else-if="title"
217
- class="w-full"
218
- :class="{ 'self-center': !hasAvatarBox }"
219
- :color="isHorizontal ? color : undefined"
220
- :icon="titleIcon"
221
- :size="size === 'lg' ? 'base' : 'sm'"
147
+ class="w-full self-center"
148
+ :size="'sm'"
222
149
  :text="title"
223
- :truncate="isHorizontal"
224
150
  />
225
151
 
226
152
  <BaseText
227
153
  v-if="description && !isHorizontal"
228
154
  block
229
155
  class="text-gray-600 dark:text-gray-400"
230
- :size="size === 'lg' ? 'xs' : '2xs'"
156
+ size="2xs"
231
157
  :text="description"
232
158
  />
233
159
  </div>
@@ -238,22 +164,19 @@ function onClick(event: MouseEvent) {
238
164
  class="flex-initial"
239
165
  :class="{
240
166
  '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',
167
+ 'absolute right-2 top-2': !isHorizontal,
243
168
  }"
244
169
  color="green"
245
170
  :icon="getLayerIcon('checkCircle')"
246
- :size="size === 'lg' ? '2xl' : 'xl'"
171
+ size="xl"
247
172
  />
248
173
 
249
174
  <BaseIcon
250
175
  v-else-if="isHorizontal && (to || hasChevron)"
251
176
  class="self-center text-gray-500 flex-initial dark:text-gray-500 group-hover:text-gray-900 dark:group-hover:text-gray-100"
252
177
  :icon="getLayerIcon('chevronRight')"
253
- :size="size === 'lg' ? '2xl' : 'xl'"
178
+ size="xl"
254
179
  />
255
-
256
- <slot name="right" />
257
180
  </div>
258
181
 
259
182
  <slot />
@@ -81,29 +81,22 @@ export type BaseButtonSize
81
81
  export type BaseButtonType = 'button' | 'reset' | 'submit'
82
82
 
83
83
  export interface BaseCard {
84
- avatar?: string
85
84
  clickable?: boolean
86
85
  color?: BaseColor
87
86
  description?: string
88
87
  disabled?: boolean
89
88
  emoji?: string
90
- hasBackground?: boolean
91
89
  hasChevron?: boolean
92
- icon?: string
93
90
  id?: number | string
94
91
  image?: string
95
92
  isSelected?: boolean
96
93
  orientation?: BaseCardOrientation
97
- size?: BaseCardSize
98
94
  title?: string
99
- titleIcon?: string
100
95
  to?: RouteLocationNamedI18n
101
96
  }
102
97
 
103
98
  export type BaseCardOrientation = 'horizontal' | 'vertical'
104
99
 
105
- export type BaseCardSize = 'base' | 'lg'
106
-
107
100
  export interface BaseCharacter {
108
101
  character?: BaseCharacterCharacter
109
102
  size?: BaseCharacterSize
@@ -30,7 +30,6 @@ declare global {
30
30
  type BaseButtonType = import('./bases').BaseButtonType
31
31
  type BaseCard = import('./bases').BaseCard
32
32
  type BaseCardOrientation = import('./bases').BaseCardOrientation
33
- type BaseCardSize = import('./bases').BaseCardSize
34
33
  type BaseCharacter = import('./bases').BaseCharacter
35
34
  type BaseCharacterCharacter = import('./bases').BaseCharacterCharacter
36
35
  type BaseCharacterSize = import('./bases').BaseCharacterSize
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saasmakers/ui",
3
- "version": "2.0.48",
3
+ "version": "2.0.49",
4
4
  "private": false,
5
5
  "description": "Reusable Nuxt UI components for SaaS Makers projects",
6
6
  "license": "MIT",