@saasmakers/ui 2.0.32 → 2.0.34

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.
@@ -11,6 +11,7 @@ const props = withDefaults(defineProps<Omit<FieldSelect, 'modelValue'>>(), {
11
11
  direction: 'bottom',
12
12
  disabled: false,
13
13
  hideError: false,
14
+ hideLabel: false,
14
15
  label: '',
15
16
  labelIcon: undefined,
16
17
  maxHeight: 'xs',
@@ -186,7 +187,10 @@ function selectOption(event: MouseEvent, value: string) {
186
187
  </script>
187
188
 
188
189
  <template>
189
- <div class="flex flex-col">
190
+ <div
191
+ class="flex flex-col"
192
+ :class="{ 'w-fit': hideLabel }"
193
+ >
190
194
  <FieldLabel
191
195
  v-if="label"
192
196
  :disabled="disabled"
@@ -205,11 +209,15 @@ function selectOption(event: MouseEvent, value: string) {
205
209
  :class="{
206
210
  'field-disabled': disabled,
207
211
  'cursor-pointer': !disabled,
212
+ 'w-fit': hideLabel,
208
213
  }"
209
214
  >
210
215
  <div
211
216
  class="relative"
212
- :class="{ 'shadow-sm': border === 'full' }"
217
+ :class="{
218
+ 'shadow-sm': border === 'full',
219
+ 'w-fit': hideLabel,
220
+ }"
213
221
  >
214
222
  <div
215
223
  class="group flex items-center rounded-lg bg-white outline-none dark:bg-gray-900"
@@ -220,10 +228,12 @@ function selectOption(event: MouseEvent, value: string) {
220
228
  'base-border-active': opened,
221
229
  'base-border-hover': !opened && !disabled,
222
230
  'base-border-interactive-focus-visible': !disabled,
223
- 'px-3': padding,
231
+ 'px-3': padding && !hideLabel,
232
+ 'px-2': padding && hideLabel,
224
233
  'text-xs h-10': size === 'sm',
225
234
  'text-sm h-12': size === 'base',
226
235
  'text-base h-14': size === 'lg',
236
+ 'inline-flex w-fit gap-1': hideLabel,
227
237
  }"
228
238
  role="button"
229
239
  :aria-disabled="disabled"
@@ -236,14 +246,27 @@ function selectOption(event: MouseEvent, value: string) {
236
246
  @focusout="onMouseLeaveOrBlur"
237
247
  >
238
248
  <template v-if="selectedOption">
249
+ <BaseEmoji
250
+ v-if="selectedOption.emoji"
251
+ class="pointer-events-none shrink-0"
252
+ :class="{ 'mr-2': !hideLabel }"
253
+ :clickable="false"
254
+ :emoji="selectedOption.emoji"
255
+ size="sm"
256
+ />
257
+
239
258
  <BaseIcon
240
- v-if="selectedOption.icon"
241
- class="pointer-events-none mr-2"
259
+ v-else-if="selectedOption.icon"
260
+ class="pointer-events-none"
261
+ :class="{ 'mr-2': !hideLabel }"
242
262
  :color="selectedOption.iconColor"
243
263
  :icon="selectedOption.icon"
244
264
  />
245
265
 
246
- <span class="flex-1 truncate font-medium">
266
+ <span
267
+ v-if="selectedOption.text && !hideLabel"
268
+ class="flex-1 truncate font-medium"
269
+ >
247
270
  {{ selectedOption.text }}
248
271
  </span>
249
272
  </template>
@@ -257,8 +280,11 @@ function selectOption(event: MouseEvent, value: string) {
257
280
 
258
281
  <BaseIcon
259
282
  v-if="caret"
260
- class="ml-2 flex-initial"
261
- :class="{ 'rotate-180': opened }"
283
+ class="flex-initial"
284
+ :class="{
285
+ 'ml-2': !hideLabel,
286
+ 'rotate-180': opened,
287
+ }"
262
288
  color="gray"
263
289
  :icon="getLayerIcon('arrowDown')"
264
290
  />
@@ -276,8 +302,11 @@ function selectOption(event: MouseEvent, value: string) {
276
302
  :initial="fadeIn.initial"
277
303
  >
278
304
  <div
279
- class="options min-w-xs overflow-y-auto border base-border-active rounded-lg bg-white text-gray-600 font-medium dark:bg-gray-900 dark:text-gray-400"
305
+ class="options min-w-xs overflow-y-auto border base-border-active rounded-lg bg-white font-medium dark:bg-gray-900"
280
306
  :class="{
307
+ 'text-xs text-gray-600 dark:text-gray-400': size === 'sm',
308
+ 'text-sm text-gray-600 dark:text-gray-400': size === 'base',
309
+ 'text-base text-gray-600 dark:text-gray-400': size === 'lg',
281
310
  'md:min-w-xl p-1 pb-0': computedColumns.length >= 2,
282
311
  'mt-8': size === 'sm' && !padding && direction === 'bottom',
283
312
  'mt-10': ((size === 'sm' && padding) || (size === 'base' && !padding)) && direction === 'bottom',
@@ -349,8 +378,21 @@ function selectOption(event: MouseEvent, value: string) {
349
378
  @keydown.enter.prevent="onOptionKeyDown"
350
379
  @keydown.space.prevent="onOptionKeyDown"
351
380
  >
381
+ <template v-if="option.emoji">
382
+ <BaseEmoji
383
+ class="pointer-events-none mr-2 shrink-0"
384
+ :clickable="false"
385
+ :emoji="option.emoji"
386
+ size="sm"
387
+ />
388
+
389
+ <span class="truncate">
390
+ {{ option.text }}
391
+ </span>
392
+ </template>
393
+
352
394
  <BaseIcon
353
- v-if="option.text"
395
+ v-else-if="option.text"
354
396
  class="pointer-events-none mr-2 flex-initial"
355
397
  :color="option.iconColor"
356
398
  :icon="option.icon"
@@ -21,12 +21,17 @@ export default function useToast() {
21
21
  action?: BaseToastAction
22
22
  i18nParams?: Record<string, number | string>
23
23
  message: string
24
+ replaceAll?: boolean
24
25
  status?: BaseStatus
25
26
  }) => {
26
27
  if (!import.meta.client) {
27
28
  return
28
29
  }
29
30
 
31
+ if (params.replaceAll) {
32
+ clearToasts()
33
+ }
34
+
30
35
  const text = params.message.includes(' ')
31
36
  ? params.message
32
37
  : nuxtApp.$i18n.t(`toasts.${params.message}`, params.i18nParams ?? {})
@@ -122,6 +122,7 @@ export interface FieldSelect {
122
122
  direction?: FieldSelectDirection
123
123
  disabled?: boolean
124
124
  hideError?: boolean
125
+ hideLabel?: boolean
125
126
  label?: BaseTextText
126
127
  labelIcon?: string
127
128
  maxHeight?: FieldSelectMaxHeight
@@ -149,6 +150,7 @@ export type FieldSelectDirection = 'bottom' | 'top'
149
150
  export type FieldSelectMaxHeight = 'lg' | 'md' | 'sm' | 'xs'
150
151
 
151
152
  export interface FieldSelectOption {
153
+ emoji?: string
152
154
  icon?: string
153
155
  iconColor?: BaseColor
154
156
  text: string
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saasmakers/ui",
3
- "version": "2.0.32",
3
+ "version": "2.0.34",
4
4
  "private": false,
5
5
  "description": "Reusable Nuxt UI components for SaaS Makers projects",
6
6
  "license": "MIT",