@saasmakers/ui 1.4.53 → 1.4.55

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.
@@ -7,9 +7,6 @@ const props = withDefaults(defineProps<BaseCard>(), {
7
7
  clickable: true,
8
8
  color: 'gray',
9
9
  description: '',
10
- details: '',
11
- detailsIcon: undefined,
12
- direction: 'horizontal',
13
10
  disabled: false,
14
11
  emoji: undefined,
15
12
  hasBackground: true,
@@ -18,6 +15,7 @@ const props = withDefaults(defineProps<BaseCard>(), {
18
15
  id: undefined,
19
16
  image: '',
20
17
  isSelected: false,
18
+ orientation: 'horizontal',
21
19
  size: 'base',
22
20
  title: undefined,
23
21
  titleIcon: undefined,
@@ -30,7 +28,6 @@ const emit = defineEmits<{
30
28
 
31
29
  defineSlots<{
32
30
  default?: () => VNode[]
33
- detailsLeft?: () => VNode[]
34
31
  innerBoxLeft?: () => VNode[]
35
32
  innerBoxRight?: () => VNode[]
36
33
  outerBoxLeft?: () => VNode[]
@@ -62,11 +59,14 @@ function onClick(event: MouseEvent) {
62
59
  :is="to && !disabled ? NuxtLinkLocale : 'div'"
63
60
  class="group flex flex-col"
64
61
  :class="{
62
+ 'cursor-default': !isClickable,
65
63
  'cursor-pointer': isClickable,
66
64
  'pointer-events-none': disabled,
67
65
  'opacity-50': disabled,
68
- 'border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shadow-sm p-1.5 pr-2.5': hasBackground && size === 'base',
69
- 'border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shadow-sm p-2.5 pr-4': hasBackground && size === 'lg',
66
+ 'border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shadow-sm p-1.5 pr-2.5': hasBackground && size === 'base' && orientation === 'horizontal',
67
+ 'border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shadow-sm p-2.5 pr-4': hasBackground && size === 'lg' && orientation === 'horizontal',
68
+ 'border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shadow-sm p-3': hasBackground && size === 'base' && orientation === 'vertical',
69
+ 'border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shadow-sm p-4': hasBackground && size === 'lg' && orientation === 'vertical',
70
70
  'hover:border-gray-300 dark:hover:border-gray-700': hasBackground && isClickable,
71
71
  'rounded-xl': hasBackground,
72
72
  }"
@@ -76,8 +76,8 @@ function onClick(event: MouseEvent) {
76
76
  <div
77
77
  class="flex overflow-hidden"
78
78
  :class="{
79
- 'flex-row items-center text-left': direction === 'horizontal',
80
- 'flex-col text-center': direction === 'vertical',
79
+ 'flex-row items-center text-left': orientation === 'horizontal',
80
+ 'flex-col items-center text-center': orientation === 'vertical',
81
81
  }"
82
82
  >
83
83
  <span class="flex justify-center">
@@ -88,24 +88,31 @@ function onClick(event: MouseEvent) {
88
88
  class="relative z-10 flex items-center justify-center flex-initial"
89
89
  :class="{
90
90
  'border shadow-inner': !avatar && !image,
91
- 'rounded-lg': !avatar && !image,
91
+ 'rounded-lg': !avatar && !image && orientation === 'horizontal',
92
+ 'rounded-full': !avatar && !image && orientation === 'vertical',
92
93
  'border-gray-200 dark:border-gray-800 bg-gray-100 dark:bg-gray-900': !avatar && !image,
93
- 'mr-2': direction === 'horizontal' && size === 'base',
94
- 'mr-3': direction === 'horizontal' && size === 'lg',
95
- 'mb-1': direction === 'vertical' && size === 'base',
96
- 'mb-1.5': direction === 'vertical' && size === 'lg',
97
- 'h-9 w-9': size === 'base',
98
- 'h-11 w-11': size === 'lg',
94
+ 'mr-2': orientation === 'horizontal' && size === 'base',
95
+ 'mr-3': orientation === 'horizontal' && size === 'lg',
96
+ 'mb-2': orientation === 'vertical' && size === 'base',
97
+ 'mb-3': orientation === 'vertical' && size === 'lg',
98
+ 'h-9 w-9': size === 'base' && orientation === 'horizontal',
99
+ 'h-11 w-11': size === 'lg' && orientation === 'horizontal',
100
+ 'h-20 w-20': size === 'base' && orientation === 'vertical',
101
+ 'h-24 w-24': size === 'lg' && orientation === 'vertical',
99
102
  }"
100
103
  >
101
104
  <slot name="innerBoxLeft" />
102
105
 
103
106
  <BaseAvatar
104
107
  v-if="avatar"
105
- class="rounded-lg flex-initial"
108
+ class="flex-initial"
106
109
  :class="{
107
- 'h-10 w-10': size === 'base',
108
- 'h-12 w-12': size === 'lg',
110
+ 'rounded-lg': orientation === 'horizontal',
111
+ 'rounded-full': orientation === 'vertical',
112
+ 'h-10 w-10': size === 'base' && orientation === 'horizontal',
113
+ 'h-12 w-12': size === 'lg' && orientation === 'horizontal',
114
+ 'h-20 w-20': size === 'base' && orientation === 'vertical',
115
+ 'h-24 w-24': size === 'lg' && orientation === 'vertical',
109
116
  }"
110
117
  :src="avatar"
111
118
  />
@@ -130,10 +137,15 @@ function onClick(event: MouseEvent) {
130
137
 
131
138
  <img
132
139
  v-else-if="image"
133
- class="rounded-lg object-cover shadow-sm drag-none flex-initial"
140
+ class="object-cover shadow-sm transition-[filter] duration-300 drag-none flex-initial"
134
141
  :class="{
135
- 'h-9 w-9': size === 'base',
136
- 'h-11 w-11': size === 'lg',
142
+ 'rounded-lg': orientation === 'horizontal',
143
+ 'rounded-full': orientation === 'vertical',
144
+ 'h-9 w-9': size === 'base' && orientation === 'horizontal',
145
+ 'h-11 w-11': size === 'lg' && orientation === 'horizontal',
146
+ 'h-20 w-20': size === 'base' && orientation === 'vertical',
147
+ 'h-24 w-24': size === 'lg' && orientation === 'vertical',
148
+ 'grayscale': disabled,
137
149
  }"
138
150
  :alt="title"
139
151
  loading="lazy"
@@ -147,11 +159,13 @@ function onClick(event: MouseEvent) {
147
159
  </span>
148
160
 
149
161
  <div
150
- class="min-w-0 flex flex-1 flex-col justify-center leading-snug"
162
+ class="min-w-0 flex flex-col justify-center leading-snug"
151
163
  :class="{
152
- 'mr-4': direction === 'horizontal' && size === 'base',
153
- 'mr-5': direction === 'horizontal' && size === 'lg',
154
- 'items-center': direction === 'vertical',
164
+ 'flex-1': orientation === 'horizontal',
165
+ 'w-full': orientation === 'vertical',
166
+ 'mr-4': orientation === 'horizontal' && size === 'base',
167
+ 'mr-5': orientation === 'horizontal' && size === 'lg',
168
+ 'items-center': orientation === 'vertical',
155
169
  }"
156
170
  >
157
171
  <div
@@ -159,6 +173,8 @@ function onClick(event: MouseEvent) {
159
173
  :class="{
160
174
  'gap-0': size === 'base',
161
175
  'gap-0.5': size === 'lg',
176
+ 'gap-1': orientation === 'vertical' && size === 'base',
177
+ 'gap-1.5': orientation === 'vertical' && size === 'lg',
162
178
  }"
163
179
  >
164
180
  <BaseIcon
@@ -168,7 +184,7 @@ function onClick(event: MouseEvent) {
168
184
  :icon="titleIcon"
169
185
  :size="size === 'lg' ? 'base' : 'sm'"
170
186
  :text="title"
171
- truncate
187
+ :truncate="orientation === 'horizontal'"
172
188
  />
173
189
 
174
190
  <BaseText
@@ -179,33 +195,21 @@ function onClick(event: MouseEvent) {
179
195
  :text="description"
180
196
  />
181
197
  </div>
182
-
183
- <div class="flex items-center">
184
- <slot name="detailsLeft" />
185
-
186
- <BaseIcon
187
- v-if="details"
188
- class="mt-0.5 whitespace-nowrap text-gray-700 font-semibold tracking-tighter dark:text-gray-300"
189
- :icon="detailsIcon"
190
- :size="size === 'lg' ? 'xs' : '2xs'"
191
- :text="details"
192
- />
193
- </div>
194
198
  </div>
195
199
 
196
200
  <BaseIcon
197
201
  v-if="isSelected"
198
202
  class="mr-1.5 self-center flex-initial"
199
203
  :class="{
200
- 'text-2xl': size === 'base',
201
- 'text-3xl': size === 'lg',
204
+ 'text-xl': size === 'base',
205
+ 'text-2xl': size === 'lg',
202
206
  }"
203
207
  color="green"
204
208
  :icon="getIcon('checkCircle')"
205
209
  />
206
210
 
207
211
  <BaseIcon
208
- v-else-if="to || hasChevron"
212
+ v-else-if="orientation === 'horizontal' && (to || hasChevron)"
209
213
  class="self-center text-gray-500 flex-initial dark:text-gray-500"
210
214
  :class="{
211
215
  'group-hover:text-gray-900 dark:group-hover:text-gray-100': isClickable,
@@ -28,7 +28,7 @@ const { t } = useI18n()
28
28
  const { getIcon } = useLayerIcons()
29
29
 
30
30
  const isClickable = computed(() => {
31
- return props.clickable || props.to
31
+ return props.clickable || props.to || props.confirmation
32
32
  })
33
33
 
34
34
  const statusIcon = computed<string | undefined>(() => {
@@ -112,8 +112,8 @@ function onKeyDown(event: KeyboardEvent) {
112
112
  'flex-row': !reverse,
113
113
  'flex-row-reverse': reverse,
114
114
  }"
115
- role="button"
116
- tabindex="0"
115
+ :role="isClickable ? 'button' : undefined"
116
+ :tabindex="isClickable ? 0 : undefined"
117
117
  @click="onClick"
118
118
  @keydown.enter="onKeyDown"
119
119
  @keydown.space.prevent="onKeyDown"
@@ -4,7 +4,7 @@ import type { FieldTabs, FieldTabsAction } from '../../types/fields'
4
4
 
5
5
  withDefaults(defineProps<Omit<FieldTabs, 'modelValue'>>(), {
6
6
  disabled: false,
7
- minimizeOnMobile: false,
7
+ orientation: 'horizontal',
8
8
  size: 'base',
9
9
  tabs: undefined,
10
10
  theme: 'rounded',
@@ -45,12 +45,12 @@ function onTabClick(event: MouseEvent, tabValue: string) {
45
45
  :is="tab.to ? NuxtLinkLocale : 'div'"
46
46
  v-for="tab in tabs"
47
47
  :key="tab.value"
48
- class="flex cursor-pointer items-center justify-center text-xs"
48
+ class="flex flex-1 cursor-pointer items-center justify-center text-xs"
49
49
  :class="{
50
+ 'flex-col sm:flex-row': orientation === 'responsive',
51
+ 'flex-col': orientation === 'vertical',
50
52
  'text-gray-900 dark:text-gray-100': isTabActive(tab.value),
51
53
  'text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-gray-100': !isTabActive(tab.value) && !disabled,
52
- 'flex-1': !minimizeOnMobile || !isTabActive(tab.value),
53
- 'flex-2 sm:flex-1': minimizeOnMobile && isTabActive(tab.value),
54
54
  'py-1.5 px-2.5': size === 'xs' && theme === 'rounded',
55
55
  'py-2 px-3': size === 'sm' && theme === 'rounded',
56
56
  'py-2.5 px-3.5': size === 'base' && theme === 'rounded' || size === 'xs' && theme === 'border',
@@ -69,14 +69,22 @@ function onTabClick(event: MouseEvent, tabValue: string) {
69
69
  >
70
70
  <BaseIcon
71
71
  v-if="tab.icon"
72
- class="mr-1.5 flex-initial"
72
+ class="flex-initial"
73
+ :class="{
74
+ 'mb-1 sm:mb-0 sm:mr-1.5': orientation === 'responsive',
75
+ 'mr-1.5': orientation === 'horizontal',
76
+ 'mb-1': orientation === 'vertical',
77
+ }"
73
78
  :color="isTabActive(tab.value) ? tab.activeColor : 'black'"
74
79
  :icon="tab.icon"
75
80
  />
76
81
 
77
82
  <span
78
- class="flex-initial"
79
- :class="{ 'hidden sm:inline': minimizeOnMobile && !isTabActive(tab.value) }"
83
+ class="whitespace-nowrap flex-initial"
84
+ :class="{
85
+ 'text-2xs sm:text-xs': orientation === 'responsive',
86
+ 'text-2xs': orientation === 'vertical',
87
+ }"
80
88
  >
81
89
  {{ tab.label }}
82
90
  </span>
@@ -77,9 +77,6 @@ export interface BaseCard {
77
77
  clickable?: boolean
78
78
  color?: BaseColor
79
79
  description?: string
80
- details?: string
81
- detailsIcon?: string
82
- direction?: BaseCardDirection
83
80
  disabled?: boolean
84
81
  emoji?: string
85
82
  hasBackground?: boolean
@@ -88,13 +85,14 @@ export interface BaseCard {
88
85
  id?: number | string
89
86
  image?: string
90
87
  isSelected?: boolean
88
+ orientation?: BaseCardOrientation
91
89
  size?: BaseCardSize
92
90
  title?: string
93
91
  titleIcon?: string
94
92
  to?: RouteLocationNamedI18n
95
93
  }
96
94
 
97
- export type BaseCardDirection = 'horizontal' | 'vertical'
95
+ export type BaseCardOrientation = 'horizontal' | 'vertical'
98
96
 
99
97
  export type BaseCardSize = 'base' | 'lg'
100
98
 
@@ -167,8 +167,8 @@ export type FieldStatus
167
167
 
168
168
  export interface FieldTabs {
169
169
  disabled?: boolean
170
- minimizeOnMobile?: boolean
171
170
  modelValue: string
171
+ orientation?: FieldTabsOrientation
172
172
  size?: FieldSize
173
173
  tabs: FieldTabsTab[]
174
174
  theme?: FieldTabsTheme
@@ -176,6 +176,8 @@ export interface FieldTabs {
176
176
 
177
177
  export type FieldTabsAction = 'added' | 'removed'
178
178
 
179
+ export type FieldTabsOrientation = 'horizontal' | 'responsive' | 'vertical'
180
+
179
181
  export interface FieldTabsTab {
180
182
  activeColor?: BaseColor
181
183
  icon?: string
@@ -13,7 +13,7 @@ declare global {
13
13
  type BaseButtonSize = import('./bases').BaseButtonSize
14
14
  type BaseButtonType = import('./bases').BaseButtonType
15
15
  type BaseCard = import('./bases').BaseCard
16
- type BaseCardDirection = import('./bases').BaseCardDirection
16
+ type BaseCardOrientation = import('./bases').BaseCardOrientation
17
17
  type BaseCardSize = import('./bases').BaseCardSize
18
18
  type BaseCharacter = import('./bases').BaseCharacter
19
19
  type BaseCharacterCharacter = import('./bases').BaseCharacterCharacter
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saasmakers/ui",
3
- "version": "1.4.53",
3
+ "version": "1.4.55",
4
4
  "private": false,
5
5
  "description": "Reusable Nuxt UI components for SaaS Makers projects",
6
6
  "license": "MIT",